@open-pioneer/scale-viewer 1.3.0-dev-map-loading.20260202144650 → 1.3.0-dev-css-prop.20260210130215
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.
- package/CHANGELOG.md +12 -4
- package/ScaleViewer.js +18 -16
- package/ScaleViewer.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# @open-pioneer/scale-viewer
|
|
2
2
|
|
|
3
|
-
## 1.3.0-dev-
|
|
3
|
+
## 1.3.0-dev-css-prop.20260210130215
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 911fda5: Support for new common container props (role, aria-_, data-_ and css)
|
|
8
|
+
- d54ccfd: Update to Chakra UI 3.32.0
|
|
4
9
|
|
|
5
10
|
### Patch Changes
|
|
6
11
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- Updated dependencies [
|
|
9
|
-
|
|
12
|
+
- Updated dependencies [911fda5]
|
|
13
|
+
- Updated dependencies [2ceb1ca]
|
|
14
|
+
- Updated dependencies [d54ccfd]
|
|
15
|
+
- Updated dependencies [4bcc8ce]
|
|
16
|
+
- Updated dependencies [2ceb1ca]
|
|
17
|
+
- @open-pioneer/map@1.3.0-dev-css-prop.20260210130215
|
|
10
18
|
|
|
11
19
|
## 1.2.0
|
|
12
20
|
|
package/ScaleViewer.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Box, VisuallyHidden, Text } from '@chakra-ui/react';
|
|
3
3
|
import { useMapModelValue } from '@open-pioneer/map';
|
|
4
|
-
import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
4
|
+
import { useCommonComponentProps, mergeChakraProps } from '@open-pioneer/react-utils';
|
|
5
5
|
import { useReactiveSnapshot } from '@open-pioneer/reactivity';
|
|
6
6
|
import { useIntl } from './_virtual/hooks.js';
|
|
7
|
-
import { useState, useEffect } from 'react';
|
|
7
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
8
8
|
|
|
9
9
|
const ScaleViewer = (props) => {
|
|
10
10
|
const { containerProps } = useCommonComponentProps("scale-viewer", props);
|
|
@@ -14,21 +14,23 @@ const ScaleViewer = (props) => {
|
|
|
14
14
|
const displayScale = intl.formatNumber(scale);
|
|
15
15
|
const debouncedScale = useDebouncedValue(scale, 3e3);
|
|
16
16
|
const ariaLabel = intl.formatMessage({ id: "scaleLabel" }, { scale: debouncedScale });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"1:",
|
|
27
|
-
displayScale
|
|
28
|
-
] })
|
|
29
|
-
]
|
|
30
|
-
}
|
|
17
|
+
const mergedBoxProps = useMemo(
|
|
18
|
+
() => mergeChakraProps(
|
|
19
|
+
{
|
|
20
|
+
role: "region",
|
|
21
|
+
"aria-label": intl.formatMessage({ id: "regionLabel" })
|
|
22
|
+
},
|
|
23
|
+
containerProps
|
|
24
|
+
),
|
|
25
|
+
[intl, containerProps]
|
|
31
26
|
);
|
|
27
|
+
return /* @__PURE__ */ jsxs(Box, { ...mergedBoxProps, children: [
|
|
28
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "polite", "aria-atomic": "true", children: ariaLabel }),
|
|
29
|
+
/* @__PURE__ */ jsxs(Text, { as: "p", "aria-hidden": "true", children: [
|
|
30
|
+
"1:",
|
|
31
|
+
displayScale
|
|
32
|
+
] })
|
|
33
|
+
] });
|
|
32
34
|
};
|
|
33
35
|
function useDebouncedValue(currentValue, timeout = 1e3) {
|
|
34
36
|
const [value, setValue] = useState(currentValue);
|
package/ScaleViewer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaleViewer.js","sources":["ScaleViewer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Text, VisuallyHidden } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport {
|
|
1
|
+
{"version":3,"file":"ScaleViewer.js","sources":["ScaleViewer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, BoxProps, Text, VisuallyHidden } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useMemo, useState } from \"react\";\n\n/**\n * These are the properties supported by the {@link ScaleViewer}.\n */\nexport interface ScaleViewerProps extends CommonComponentProps, MapModelProps {}\n\nexport const ScaleViewer: FC<ScaleViewerProps> = (props) => {\n const { containerProps } = useCommonComponentProps(\"scale-viewer\", props);\n const map = useMapModelValue(props);\n const intl = useIntl();\n\n const scale = useReactiveSnapshot(() => map.scale ?? 1, [map]);\n const displayScale = intl.formatNumber(scale);\n\n // Make the scale shown to the screen reader lag behind a bit via debounce.\n // Otherwise, the user is notified of too many updates (individual scale changes).\n // See https://github.com/open-pioneer/trails-openlayers-base-packages/issues/431\n const debouncedScale = useDebouncedValue(scale, 3000);\n const ariaLabel = intl.formatMessage({ id: \"scaleLabel\" }, { scale: debouncedScale });\n\n const mergedBoxProps = useMemo(\n () =>\n mergeChakraProps<BoxProps>(\n {\n role: \"region\",\n \"aria-label\": intl.formatMessage({ id: \"regionLabel\" })\n },\n containerProps\n ),\n [intl, containerProps]\n );\n\n return (\n <Box {...mergedBoxProps}>\n <VisuallyHidden aria-live=\"polite\" aria-atomic=\"true\">\n {ariaLabel}\n </VisuallyHidden>\n <Text as=\"p\" aria-hidden=\"true\">\n 1:{displayScale}\n </Text>\n </Box>\n );\n};\n\n// TODO: Might be useful in a shared package\nfunction useDebouncedValue<T>(currentValue: T, timeout = 1000): T {\n const [value, setValue] = useState<T>(currentValue);\n\n useEffect(() => {\n const id = setTimeout(() => setValue(currentValue), timeout);\n return () => clearTimeout(id);\n }, [currentValue, timeout]);\n\n return value;\n}\n"],"names":[],"mappings":";;;;;;;;AAkBO,MAAM,WAAA,GAAoC,CAAC,KAAA,KAAU;AACxD,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,gBAAgB,KAAK,CAAA;AACxE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AAErB,EAAA,MAAM,KAAA,GAAQ,oBAAoB,MAAM,GAAA,CAAI,SAAS,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AAC7D,EAAA,MAAM,YAAA,GAAe,IAAA,CAAK,YAAA,CAAa,KAAK,CAAA;AAK5C,EAAA,MAAM,cAAA,GAAiB,iBAAA,CAAkB,KAAA,EAAO,GAAI,CAAA;AACpD,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,cAAa,EAAG,EAAE,KAAA,EAAO,cAAA,EAAgB,CAAA;AAEpF,EAAA,MAAM,cAAA,GAAiB,OAAA;AAAA,IACnB,MACI,gBAAA;AAAA,MACI;AAAA,QACI,IAAA,EAAM,QAAA;AAAA,QACN,cAAc,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,eAAe;AAAA,OAC1D;AAAA,MACA;AAAA,KACJ;AAAA,IACJ,CAAC,MAAM,cAAc;AAAA,GACzB;AAEA,EAAA,uBACI,IAAA,CAAC,GAAA,EAAA,EAAK,GAAG,cAAA,EACL,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,WAAA,EAAU,QAAA,EAAS,aAAA,EAAY,QAC1C,QAAA,EAAA,SAAA,EACL,CAAA;AAAA,oBACA,IAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,GAAA,EAAI,eAAY,MAAA,EAAO,QAAA,EAAA;AAAA,MAAA,IAAA;AAAA,MACzB;AAAA,KAAA,EACP;AAAA,GAAA,EACJ,CAAA;AAER;AAGA,SAAS,iBAAA,CAAqB,YAAA,EAAiB,OAAA,GAAU,GAAA,EAAS;AAC9D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAY,YAAY,CAAA;AAElD,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,MAAM,KAAK,UAAA,CAAW,MAAM,QAAA,CAAS,YAAY,GAAG,OAAO,CAAA;AAC3D,IAAA,OAAO,MAAM,aAAa,EAAE,CAAA;AAAA,EAChC,CAAA,EAAG,CAAC,YAAA,EAAc,OAAO,CAAC,CAAA;AAE1B,EAAA,OAAO,KAAA;AACX;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/scale-viewer",
|
|
4
|
-
"version": "1.3.0-dev-
|
|
4
|
+
"version": "1.3.0-dev-css-prop.20260210130215",
|
|
5
5
|
"description": "This package provides a UI component to show the actual map scale to the user.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"directory": "src/packages/scale-viewer"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@chakra-ui/react": "^3.
|
|
18
|
-
"@open-pioneer/react-utils": "
|
|
19
|
-
"@open-pioneer/runtime": "
|
|
20
|
-
"@open-pioneer/reactivity": "
|
|
21
|
-
"react": "^19.2.
|
|
22
|
-
"@open-pioneer/map": "1.3.0-dev-
|
|
17
|
+
"@chakra-ui/react": "^3.32.0",
|
|
18
|
+
"@open-pioneer/react-utils": "4.5.0-dev-css-prop.20260210120105",
|
|
19
|
+
"@open-pioneer/runtime": "4.5.0-dev-css-prop.20260210120105",
|
|
20
|
+
"@open-pioneer/reactivity": "4.5.0-dev-css-prop.20260210120105",
|
|
21
|
+
"react": "^19.2.4",
|
|
22
|
+
"@open-pioneer/map": "1.3.0-dev-css-prop.20260210130215"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
"./package.json": "./package.json",
|