@open-pioneer/basemap-switcher 1.5.0-dev.20260911123645 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapSwitcher.js","sources":["BasemapSwitcher.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, createListCollection, Portal, Select, Text } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { Layer, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useMemo } from \"react\";\nimport { type IconType } from \"react-icons/lib\";\nimport { LuInfo, LuTriangleAlert } from \"react-icons/lu\";\n\n/*\n Exported for tests. Feels a bit hacky but should be fine for now.\n Originally was using the empty string, but that doesn't work well with happy-dom.\n*/\nexport const NO_BASEMAP_ID = \"___NO_BASEMAP___\";\n\n/**\n * Properties for single select options.\n */\ninterface SelectOption {\n /**\n * The id of the basemap for the select option.\n */\n value: string;\n\n /**\n * The label of the select option.\n */\n label: string;\n\n /**\n * The layer object for the select option.\n * Undefined is used for \"no basemap\".\n */\n layer: Layer | undefined;\n}\n\n/**\n * These are special properties for the BasemapSwitcher.\n */\nexport interface BasemapSwitcherProps extends CommonComponentProps, MapModelProps {\n /**\n * Additional css class name(s) that will be added to the BasemapSwitcher component.\n */\n className?: string;\n\n /**\n * Specifies whether an option to deactivate all basemap layers is available in the BasemapSwitcher.\n * Defaults to `false`.\n */\n allowSelectingEmptyBasemap?: boolean | undefined;\n\n /**\n * Optional aria-labelledby property.\n * Do not use together with aria-label.\n */\n \"aria-labelledby\"?: string;\n\n /**\n * Optional aria-label property.\n * Do not use together with aria-label.\n */\n \"aria-label\"?: string;\n}\n\n/**\n * The `BasemapSwitcher` component can be used in an app to switch between the different basemaps.\n */\nexport const BasemapSwitcher: FC<BasemapSwitcherProps> = (props) => {\n const map = useMapModelValue(props);\n const intl = useIntl();\n const {\n allowSelectingEmptyBasemap = false,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = props;\n const { containerProps } = useCommonComponentProps(\"basemap-switcher\", restProps);\n const emptyBasemapLabel = intl.formatMessage({ id: \"emptyBasemapLabel\" });\n\n const activateLayer = (layerId: string[]) => {\n map.layers.activateBaseLayer(layerId[0] === NO_BASEMAP_ID ? undefined : layerId[0]);\n };\n\n const { optionsListCollection, selectedOption } = useReactiveSnapshot(() => {\n const baseLayers = map.layers.getBaseLayers() ?? [];\n const options: SelectOption[] = baseLayers.map<SelectOption>((layer) => {\n return {\n value: layer.id,\n layer: layer,\n label: layer.title,\n disabled: layer.loadState == \"error\"\n };\n });\n\n const activeBaseLayer = map.layers.getActiveBaseLayer();\n if (allowSelectingEmptyBasemap || activeBaseLayer == null) {\n const emptyOption: SelectOption = {\n value: NO_BASEMAP_ID,\n layer: undefined,\n label: emptyBasemapLabel\n };\n options.push(emptyOption);\n }\n const optionsListCollection = createListCollection({ items: options });\n const selectedOption = optionsListCollection.find(activeBaseLayer?.id ?? NO_BASEMAP_ID);\n if (!selectedOption) {\n throw new Error(\"Internal error: selected option not found in list.\");\n }\n\n return { optionsListCollection, selectedOption };\n }, [allowSelectingEmptyBasemap, emptyBasemapLabel, map]);\n\n return (\n <Box {...containerProps}>\n <Select.Root\n collection={optionsListCollection}\n value={[selectedOption.value]}\n onValueChange={(option) => option && activateLayer(option.value)}\n className=\"basemap-switcher-select\"\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Control>\n <Select.Trigger\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className=\"basemap-switcher-select-trigger\"\n >\n <Select.ValueText display=\"flex\" alignItems=\"center\">\n <BasemapItemContent option={selectedOption} />\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"basemap-switcher-select-content\">\n {optionsListCollection.items.map((item) => (\n <BasemapItem item={item} key={item.value} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </Box>\n );\n};\n\nfunction BasemapItem(props: { item: SelectOption }) {\n const item = props.item;\n\n return (\n <Select.Item\n item={item}\n key={item.value}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n className=\"basemap-switcher-option\"\n >\n <BasemapItemContent option={item} />\n </Select.Item>\n );\n}\n\nfunction BasemapItemContent(props: { option: SelectOption }) {\n const { option } = props;\n const intl = useIntl();\n const loadState = useReactiveSnapshot(() => option.layer?.loadState, [option.layer]);\n const visibleInScale = useReactiveSnapshot(() => option.layer?.visibleInScale, [option.layer]);\n\n const { problem, opacity } = useMemo(() => {\n let problem = undefined;\n let opacity = undefined;\n if (option.layer) {\n if (loadState === \"error\") {\n problem = (\n <ProblemIndicator\n Icon={LuTriangleAlert}\n color=\"red\"\n message={intl.formatMessage({ id: \"layerNotAvailable\" })}\n />\n );\n } else if (!visibleInScale) {\n problem = (\n <ProblemIndicator\n Icon={LuInfo}\n message={intl.formatMessage({ id: \"layerNotVisible\" })}\n />\n );\n opacity = 0.5;\n }\n }\n return { problem, opacity };\n }, [option.layer, loadState, visibleInScale, intl]);\n\n return (\n <>\n <Text as=\"span\" opacity={opacity}>\n {option.label}\n </Text>\n {problem}\n </>\n );\n}\n\nfunction ProblemIndicator(props: { Icon: IconType; message: string; color?: string }) {\n const { Icon, message, color } = props;\n return (\n <Box ml={2} className=\"basemap-switcher-option-problem-indicator\">\n <Tooltip content={message} aria-label={message} positioning={{ placement: \"right\" }}>\n <span>\n <Icon aria-label={message} color={color} />\n </span>\n </Tooltip>\n </Box>\n );\n}\n"],"names":["optionsListCollection","selectedOption","problem","opacity"],"mappings":";;;;;;;;;;AAiBO,MAAM,aAAA,GAAgB,kBAAA;AAsDtB,MAAM,eAAA,GAA4C,CAAC,KAAA,KAAU;AAChE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,MAAM;AAAA,IACF,0BAAA,GAA6B,KAAA;AAAA,IAC7B,YAAA,EAAc,SAAA;AAAA,IACd,iBAAA,EAAmB,cAAA;AAAA,IACnB,GAAG;AAAA,GACP,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,oBAAoB,SAAS,CAAA;AAChF,EAAA,MAAM,oBAAoB,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,qBAAqB,CAAA;AAExE,EAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAsB;AACzC,IAAA,GAAA,CAAI,MAAA,CAAO,kBAAkB,OAAA,CAAQ,CAAC,MAAM,aAAA,GAAgB,MAAA,GAAY,OAAA,CAAQ,CAAC,CAAC,CAAA;AAAA,EACtF,CAAA;AAEA,EAAA,MAAM,EAAE,qBAAA,EAAuB,cAAA,EAAe,GAAI,oBAAoB,MAAM;AACxE,IAAA,MAAM,UAAA,GAAa,GAAA,CAAI,MAAA,CAAO,aAAA,MAAmB,EAAC;AAClD,IAAA,MAAM,OAAA,GAA0B,UAAA,CAAW,GAAA,CAAkB,CAAC,KAAA,KAAU;AACpE,MAAA,OAAO;AAAA,QACH,OAAO,KAAA,CAAM,EAAA;AAAA,QACb,KAAA;AAAA,QACA,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,QAAA,EAAU,MAAM,SAAA,IAAa;AAAA,OACjC;AAAA,IACJ,CAAC,CAAA;AAED,IAAA,MAAM,eAAA,GAAkB,GAAA,CAAI,MAAA,CAAO,kBAA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,EAAK,EAAA,EAAG,MAAA,EAAO,OAAA,EACX,iBAAO,KAAA,EACZ,CAAA;AAAA,IACC;AAAA,GAAA,EACL,CAAA;AAER;AAEA,SAAS,iBAAiB,KAAA,EAA4D;AAClF,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM,GAAI,KAAA;AACjC,EAAA,uBACI,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EAAG,SAAA,EAAU,2CAAA,EAClB,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,OAAA,EAAS,OAAA,EAAS,YAAA,EAAY,OAAA,EAAS,WAAA,EAAa,EAAE,SAAA,EAAW,OAAA,EAAQ,EAC9E,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EACG,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,YAAA,EAAY,OAAA,EAAS,KAAA,EAAc,CAAA,EAC7C,CAAA,EACJ,CAAA,EACJ,CAAA;AAER;;;;"}
1
+ {"version":3,"file":"BasemapSwitcher.js","sources":["BasemapSwitcher.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, createListCollection, Portal, Select, Text } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { Layer, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useMemo } from \"react\";\nimport { type IconType } from \"react-icons/lib\";\nimport { LuInfo, LuTriangleAlert } from \"react-icons/lu\";\n\n/*\n Exported for tests. Feels a bit hacky but should be fine for now.\n Originally was using the empty string, but that doesn't work well with happy-dom.\n*/\nexport const NO_BASEMAP_ID = \"___NO_BASEMAP___\";\n\n/**\n * Properties for single select options.\n */\ninterface SelectOption {\n /**\n * The id of the basemap for the select option.\n */\n value: string;\n\n /**\n * The label of the select option.\n */\n label: string;\n\n /**\n * The layer object for the select option.\n * Undefined is used for \"no basemap\".\n */\n layer: Layer | undefined;\n}\n\n/**\n * These are special properties for the BasemapSwitcher.\n */\nexport interface BasemapSwitcherProps extends CommonComponentProps, MapModelProps {\n /**\n * Additional css class name(s) that will be added to the BasemapSwitcher component.\n */\n className?: string;\n\n /**\n * Specifies whether an option to deactivate all basemap layers is available in the BasemapSwitcher.\n * Defaults to `false`.\n */\n allowSelectingEmptyBasemap?: boolean | undefined;\n\n /**\n * Optional aria-labelledby property.\n * Do not use together with aria-label.\n */\n \"aria-labelledby\"?: string;\n\n /**\n * Optional aria-label property.\n * Do not use together with aria-label.\n */\n \"aria-label\"?: string;\n}\n\n/**\n * The `BasemapSwitcher` component can be used in an app to switch between the different basemaps.\n */\nexport const BasemapSwitcher: FC<BasemapSwitcherProps> = (props) => {\n const map = useMapModelValue(props);\n const intl = useIntl();\n const {\n allowSelectingEmptyBasemap = false,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = props;\n const { containerProps } = useCommonComponentProps(\"basemap-switcher\", restProps);\n const emptyBasemapLabel = intl.formatMessage({ id: \"emptyBasemapLabel\" });\n\n const activateLayer = (layerId: string[]) => {\n map.layers.activateBaseLayer(layerId[0] === NO_BASEMAP_ID ? undefined : layerId[0]);\n };\n\n const { optionsListCollection, selectedOption } = useReactiveSnapshot(() => {\n const baseLayers = map.layers.getBaseLayers() ?? [];\n const options: SelectOption[] = baseLayers.map<SelectOption>((layer) => {\n return {\n value: layer.id,\n layer: layer,\n label: layer.title,\n disabled: layer.loadState == \"error\"\n };\n });\n\n const activeBaseLayer = map.layers.getActiveBaseLayer();\n if (allowSelectingEmptyBasemap || activeBaseLayer == null) {\n const emptyOption: SelectOption = {\n value: NO_BASEMAP_ID,\n layer: undefined,\n label: emptyBasemapLabel\n };\n options.push(emptyOption);\n }\n const optionsListCollection = createListCollection({ items: options });\n const selectedOption = optionsListCollection.find(activeBaseLayer?.id ?? NO_BASEMAP_ID);\n if (!selectedOption) {\n throw new Error(\"Internal error: selected option not found in list.\");\n }\n\n return { optionsListCollection, selectedOption };\n }, [allowSelectingEmptyBasemap, emptyBasemapLabel, map]);\n\n return (\n <Box {...containerProps}>\n <Select.Root\n collection={optionsListCollection}\n value={[selectedOption.value]}\n onValueChange={(option) => option && activateLayer(option.value)}\n className=\"basemap-switcher-select\"\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Control>\n <Select.Trigger\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className=\"basemap-switcher-select-trigger\"\n >\n <Select.ValueText display=\"flex\" alignItems=\"center\">\n <BasemapItemContent option={selectedOption} />\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"basemap-switcher-select-content\">\n {optionsListCollection.items.map((item) => (\n <BasemapItem item={item} key={item.value} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </Box>\n );\n};\n\nfunction BasemapItem(props: { item: SelectOption }) {\n const item = props.item;\n\n return (\n <Select.Item\n item={item}\n key={item.value}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n className=\"basemap-switcher-option\"\n >\n <BasemapItemContent option={item} />\n </Select.Item>\n );\n}\n\nfunction BasemapItemContent(props: { option: SelectOption }) {\n const { option } = props;\n const intl = useIntl();\n const loadState = useReactiveSnapshot(() => option.layer?.loadState, [option.layer]);\n const visibleInScale = useReactiveSnapshot(() => option.layer?.visibleInScale, [option.layer]);\n\n const { problem, opacity } = useMemo(() => {\n let problem = undefined;\n let opacity = undefined;\n if (option.layer) {\n if (loadState === \"error\") {\n problem = (\n <ProblemIndicator\n Icon={LuTriangleAlert}\n color=\"red\"\n message={intl.formatMessage({ id: \"layerNotAvailable\" })}\n />\n );\n } else if (!visibleInScale) {\n problem = (\n <ProblemIndicator\n Icon={LuInfo}\n message={intl.formatMessage({ id: \"layerNotVisible\" })}\n />\n );\n opacity = 0.5;\n }\n }\n return { problem, opacity };\n }, [option.layer, loadState, visibleInScale, intl]);\n\n return (\n <>\n <Text as=\"span\" opacity={opacity}>\n {option.label}\n </Text>\n {problem}\n </>\n );\n}\n\nfunction ProblemIndicator(props: { Icon: IconType; message: string; color?: string }) {\n const { Icon, message, color } = props;\n return (\n <Box ml={2} className=\"basemap-switcher-option-problem-indicator\">\n <Tooltip content={message} aria-label={message} positioning={{ placement: \"right\" }}>\n <span>\n <Icon aria-label={message} color={color} />\n </span>\n </Tooltip>\n </Box>\n );\n}\n"],"names":["optionsListCollection","selectedOption","problem","opacity"],"mappings":";;;;;;;;;;AAiBO,MAAM,aAAA,GAAgB,kBAAA;AAsDtB,MAAM,eAAA,GAA4C,CAAC,KAAA,KAAU;AAChE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,MAAM;AAAA,IACF,0BAAA,GAA6B,KAAA;AAAA,IAC7B,YAAA,EAAc,SAAA;AAAA,IACd,iBAAA,EAAmB,cAAA;AAAA,IACnB,GAAG;AAAA,GACP,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,oBAAoB,SAAS,CAAA;AAChF,EAAA,MAAM,oBAAoB,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,qBAAqB,CAAA;AAExE,EAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAsB;AACzC,IAAA,GAAA,CAAI,MAAA,CAAO,kBAAkB,OAAA,CAAQ,CAAC,MAAM,aAAA,GAAgB,MAAA,GAAY,OAAA,CAAQ,CAAC,CAA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 
5
5
  ### Minor Changes
6
6
 
7
7
  - f790fda: Update to Chakra 3.37.0
8
+ - a186f5d: Update core packages to 4.8.0.
8
9
 
9
10
  ### Patch Changes
10
11
 
12
+ - 0d9a9d0: Adapt to timing changes during map initialization.
11
13
  - 09ec7c7: Updated dependencies
12
14
 
13
15
  ## 1.4.0
@@ -80,17 +82,17 @@
80
82
  - 193068a: Deprecate the `mapId` property on React components.
81
83
  Use the `MapModel` directly instead to pass a reference to the map.
82
84
 
83
- Example:
85
+ Example:
84
86
 
85
- ```tsx
86
- // Default map for entire component tree
87
- <DefaultMapProvider map={mapModel}>
88
- <Toc />
89
- </DefaultMapProvider>
87
+ ```tsx
88
+ // Default map for entire component tree
89
+ <DefaultMapProvider map={mapModel}>
90
+ <Toc />
91
+ </DefaultMapProvider>
90
92
 
91
- // Map for specific component
92
- <Toc map={mapModel} />
93
- ```
93
+ // Map for specific component
94
+ <Toc map={mapModel} />
95
+ ```
94
96
 
95
97
  ### Patch Changes
96
98
 
@@ -113,9 +115,9 @@
113
115
  ### Minor Changes
114
116
 
115
117
  - 2fa8020: Update trails core package dependencies.
116
- - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
117
- - Removes any obsolete references to `@chakra-ui/system`.
118
- This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
118
+ - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
119
+ - Removes any obsolete references to `@chakra-ui/system`.
120
+ This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
119
121
 
120
122
  ### Patch Changes
121
123
 
@@ -134,7 +136,7 @@
134
136
  - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
135
137
  You can use the `DefaultMapProvider` to configure an implicit default value.
136
138
 
137
- Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
139
+ Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
138
140
 
139
141
  - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
140
142
  - a8b3449: Switch to a new versioning strategy.
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/basemap-switcher",
4
- "version": "1.5.0-dev.20260911123645",
4
+ "version": "1.5.0",
5
5
  "description": "This package provides a UI component that allows a user to switch between different base maps.",
6
6
  "keywords": [
7
7
  "open-pioneer-trails"
@@ -16,13 +16,13 @@
16
16
  "dependencies": {
17
17
  "@chakra-ui/react": "^3.37.0",
18
18
  "@conterra/reactivity-core": "^0.8.8",
19
- "@open-pioneer/chakra-snippets": "4.8.0-dev.20260910101405",
20
- "@open-pioneer/map": "1.5.0-dev.20260911123645",
21
- "@open-pioneer/react-utils": "4.8.0-dev.20260910101405",
22
- "@open-pioneer/reactivity": "4.8.0-dev.20260910101405",
23
- "@open-pioneer/runtime": "4.8.0-dev.20260910101405",
19
+ "@open-pioneer/chakra-snippets": "^4.8.0",
20
+ "@open-pioneer/map": "1.5.0",
21
+ "@open-pioneer/react-utils": "^4.8.0",
22
+ "@open-pioneer/reactivity": "^4.8.0",
23
+ "@open-pioneer/runtime": "^4.8.0",
24
24
  "ol": "^10.10.0",
25
- "react": "^19.2.8",
25
+ "react": "^19.3.0",
26
26
  "react-icons": "^5.7.0"
27
27
  },
28
28
  "publishConfig": {