diff --git a/demo/js/index.js b/demo/js/index.js index 22431cf1..481a2ba4 100755 --- a/demo/js/index.js +++ b/demo/js/index.js @@ -126,7 +126,7 @@ const interactiveMap = new InteractiveMap('map', { transformRequest: transformTileRequest, enableZoomControls: true, readMapText: true, - enableFullscreen: true, + // enableFullscreen: true, // hasExitButton: true, // markers: [{ // id: 'location', diff --git a/demo/js/planning.js b/demo/js/planning.js index 6dec37a9..7f587089 100755 --- a/demo/js/planning.js +++ b/demo/js/planning.js @@ -71,8 +71,8 @@ const interactiveMap = new InteractiveMap('map', { mapStylesPlugin({ mapStyles: vtsMapStyles27700, manifest: { - buttons: [{ id: 'mapStyles', desktop: { slot: 'right-top', showLabel: false }}], - panels: [{ id: 'mapStyles', desktop: { slot: 'map-styles-button', width: '400px', modal: false }}] + buttons: [{ id: 'mapStyles', desktop: { slot: 'right-top', showLabel: false, modal: true }}], + panels: [{ id: 'mapStyles', desktop: { slot: 'map-styles-button', width: '400px' }}] } }), scaleBarPlugin({ @@ -134,6 +134,20 @@ interactiveMap.on('app:ready', function (e) { tablet: { slot: 'inset', width: '260px', open: false, exclusive: true }, desktop: { slot: 'inset', width: '280px', open: false, exclusive: true } }) + interactiveMap.addPanel('test', { + label: 'test', + html: '

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

', + mobile: { slot: 'inset', open: true, modal: true }, + tablet: { slot: 'left-top', open: true }, + desktop: { slot: 'left-top', open: true } + }) + interactiveMap.addPanel('test2', { + label: 'test2', + html: '

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

', + mobile: { slot: 'inset', open: true, modal: true }, + tablet: { slot: 'left-bottom', open: true }, + desktop: { slot: 'left-bottom', open: true } + }) }) interactiveMap.on('map:ready', function (e) { diff --git a/plugins/search/src/events/fetchSuggestions.js b/plugins/search/src/events/fetchSuggestions.js index 9fc24d6f..76f6ad06 100755 --- a/plugins/search/src/events/fetchSuggestions.js +++ b/plugins/search/src/events/fetchSuggestions.js @@ -2,19 +2,22 @@ export const sanitiseQuery = (value) => value.replace(/[^a-zA-Z0-9\s\-.,]/g, '').trim() -const getRequestConfig = (ds, query, transformRequest) => { +const getRequestConfig = async (ds, query, transformRequest) => { const defaultRequest = { url: ds.urlTemplate?.replace('{query}', encodeURIComponent(query)), options: { method: 'GET' } } - if (typeof ds.buildRequest === 'function') { + if (ds.buildRequest) { return ds.buildRequest(query, () => defaultRequest) } - return typeof transformRequest === 'function' - ? transformRequest(defaultRequest, query) - : defaultRequest + if (transformRequest) { + const transformedRequest = await transformRequest(defaultRequest, query) + return transformedRequest + } + + return defaultRequest } /** @@ -50,7 +53,7 @@ export const fetchSuggestions = async (value, datasets, dispatch, transformReque let finalResults = [] for (const ds of activeDatasets) { - const request = getRequestConfig(ds, sanitisedValue, transformRequest) + const request = await getRequestConfig(ds, sanitisedValue, transformRequest) const results = await fetchDatasetResults(ds, request, sanitisedValue) // Check if we have results to add diff --git a/providers/beta/esri/src/esriProvider.scss b/providers/beta/esri/src/esriProvider.scss index ec8ead3a..a36189ee 100644 --- a/providers/beta/esri/src/esriProvider.scss +++ b/providers/beta/esri/src/esriProvider.scss @@ -42,4 +42,9 @@ body, html { letter-spacing: inherit !important; line-height: inherit !important; } +} + +// Hide the ESRI Attribution, manage this elsewhere +.esri-view-attribution { + display: none; } \ No newline at end of file diff --git a/src/App/components/MapButton/MapButton.jsx b/src/App/components/MapButton/MapButton.jsx index bd33fc6d..16d8659c 100755 --- a/src/App/components/MapButton/MapButton.jsx +++ b/src/App/components/MapButton/MapButton.jsx @@ -244,6 +244,7 @@ export const MapButton = ({ return (
{showLabel ? buttonEl : {buttonEl}} diff --git a/src/App/components/Panel/Panel.jsx b/src/App/components/Panel/Panel.jsx index 1548fa7b..db8c4f01 100755 --- a/src/App/components/Panel/Panel.jsx +++ b/src/App/components/Panel/Panel.jsx @@ -10,17 +10,17 @@ const computePanelState = (bpConfig, triggeringElement) => { const isAside = bpConfig.slot === 'side' && bpConfig.open && !bpConfig.modal const isDialog = !isAside && bpConfig.dismissible const isModal = bpConfig.modal === true - const isDismissable = bpConfig.dismissible !== false + const isDismissible = bpConfig.dismissible !== false const shouldFocus = Boolean(isModal || triggeringElement) const buttonContainerEl = bpConfig.slot.endsWith('button') ? triggeringElement?.parentNode : undefined - return { isAside, isDialog, isModal, isDismissable, shouldFocus, buttonContainerEl } + return { isAside, isDialog, isModal, isDismissible, shouldFocus, buttonContainerEl } } -const getPanelRole = (isDialog, isDismissable) => { +const getPanelRole = (isDialog, isDismissible) => { if (isDialog) { return 'dialog' } - if (isDismissable) { + if (isDismissible) { return 'complementary' } return 'region' @@ -32,19 +32,20 @@ const buildPanelClassNames = (slot, showLabel) => [ !showLabel && 'im-c-panel--no-heading' ].filter(Boolean).join(' ') -const buildPanelBodyClassNames = (showLabel, isDismissable) => [ +const buildPanelBodyClassNames = (showLabel, isDismissible) => [ 'im-c-panel__body', - !showLabel && isDismissable && 'im-c-panel__body--offset' + !showLabel && isDismissible && 'im-c-panel__body--offset' ].filter(Boolean).join(' ') -const buildPanelProps = ({ elementId, shouldFocus, isDialog, isDismissable, isModal, width, panelClass }) => ({ +const buildPanelProps = ({ elementId, shouldFocus, isDialog, isDismissible, isModal, width, panelClass, slot }) => ({ id: elementId, 'aria-labelledby': `${elementId}-label`, tabIndex: shouldFocus ? -1 : undefined, // nosonar - role: getPanelRole(isDialog, isDismissable), + role: getPanelRole(isDialog, isDismissible), 'aria-modal': isDialog && isModal ? 'true' : undefined, style: width ? { width } : undefined, - className: panelClass + className: panelClass, + 'data-slot': slot }) const buildBodyProps = ({ bodyRef, panelBodyClass, isBodyScrollable, elementId }) => ({ @@ -65,7 +66,7 @@ export const Panel = ({ panelId, panelConfig, props, WrappedChild, label, html, const bpConfig = panelConfig[breakpoint] const elementId = `${id}-panel-${stringToKebab(panelId)}` - const { isAside, isDialog, isModal, isDismissable, shouldFocus, buttonContainerEl } = computePanelState(bpConfig, props?.triggeringElement) + const { isAside, isDialog, isModal, isDismissible, shouldFocus, buttonContainerEl } = computePanelState(bpConfig, props?.triggeringElement) // For persistent panels, gate modal behaviour on open state const isModalActive = isModal && isOpen @@ -97,10 +98,10 @@ export const Panel = ({ panelId, panelConfig, props, WrappedChild, label, html, }, [isOpen]) const panelClass = buildPanelClassNames(bpConfig.slot, bpConfig.showLabel ?? true) - const panelBodyClass = buildPanelBodyClassNames(bpConfig.showLabel ?? true, isDismissable) + const panelBodyClass = buildPanelBodyClassNames(bpConfig.showLabel ?? true, isDismissible) const innerHtmlProp = useMemo(() => html ? { __html: html } : null, [html]) - const panelProps = buildPanelProps({ elementId, shouldFocus, isDialog, isDismissable, isModal, width: bpConfig.width, panelClass }) + const panelProps = buildPanelProps({ elementId, shouldFocus, isDialog, isDismissible, isModal, width: bpConfig.width, panelClass, slot: bpConfig.slot }) const bodyProps = buildBodyProps({ bodyRef, panelBodyClass, isBodyScrollable, elementId }) return ( @@ -115,7 +116,7 @@ export const Panel = ({ panelId, panelConfig, props, WrappedChild, label, html, {label} - {isDismissable && ( + {isDismissible && (