@open-pioneer/map-ui-components 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.
- package/CHANGELOG.md +21 -19
- package/README.md +14 -0
- package/ToolButton.js.map +1 -1
- package/TooltipBox.d.ts +11 -0
- package/TooltipBox.js +16 -0
- package/TooltipBox.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# @open-pioneer/map-ui-components
|
|
2
2
|
|
|
3
|
-
## 1.5.0
|
|
3
|
+
## 1.5.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- f790fda: Update to Chakra 3.37.0
|
|
8
|
+
- a186f5d: Update core packages to 4.8.0.
|
|
9
|
+
- a9c1213: Add `TooltipBox` component, a small helper component that is styled like a chakra Tooltip.
|
|
8
10
|
|
|
9
11
|
### Patch Changes
|
|
10
12
|
|
|
@@ -68,9 +70,9 @@
|
|
|
68
70
|
- 66179bc: Update to core-packages v4.0.0
|
|
69
71
|
- 738390e: **Breaking:** Rename `<ToolButton />` props for consistency with Chakra naming conventions:
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
- `isLoading` (old) --> `loading` (new)
|
|
74
|
+
- `isActive` (old) --> `active` (new)
|
|
75
|
+
- `isDisabled` (old) --> `disabled` (new)
|
|
74
76
|
|
|
75
77
|
- 738390e: Update to Chakra v3
|
|
76
78
|
|
|
@@ -78,16 +80,16 @@
|
|
|
78
80
|
|
|
79
81
|
- 9376a74: Ensure that icons and other decorative elements are hidden from the screen reader using the `aria-hidden="true"` attribute.
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
The easiest way to do that is to wrap icons into chakra's `<Icon />` component, for example:
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
```tsx
|
|
86
|
+
import { Icon } from "@chakra-ui/react";
|
|
87
|
+
import { FiX } from "react-icons/fi";
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
<Icon>
|
|
90
|
+
<FiX />
|
|
91
|
+
</Icon>;
|
|
92
|
+
```
|
|
91
93
|
|
|
92
94
|
## 0.10.0
|
|
93
95
|
|
|
@@ -108,9 +110,9 @@
|
|
|
108
110
|
### Minor Changes
|
|
109
111
|
|
|
110
112
|
- 2fa8020: Update trails core package dependencies.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
- Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
|
|
114
|
+
- Removes any obsolete references to `@chakra-ui/system`.
|
|
115
|
+
This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
|
|
114
116
|
|
|
115
117
|
### Patch Changes
|
|
116
118
|
|
|
@@ -142,11 +144,11 @@
|
|
|
142
144
|
- 2090e72: Initial release.
|
|
143
145
|
The purpose of this package is to develop UI components that are closely related to the map.
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
The package `@open-pioneer/react-utils` has been moved into the [core-packages repository](https://github.com/open-pioneer/trails-core-packages/tree/main/src/packages/react-utils).
|
|
148
|
+
Most contents of the package have been moved as well, if they can be used independently from the map.
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
The component `ToolButton` has been moved into _this_ package instead.
|
|
151
|
+
See also the [release notes](https://github.com/open-pioneer/trails-core-packages/releases/tag/%40open-pioneer%2Freact-utils%401.0.0) of `@open-pioneer/react-utils`.
|
|
150
152
|
|
|
151
153
|
### Patch Changes
|
|
152
154
|
|
package/README.md
CHANGED
|
@@ -12,6 +12,20 @@ To create a simple icon button with a tooltip and an `aria-label`, use the `Tool
|
|
|
12
12
|
|
|
13
13
|
This component is used to add an icon button to the map.
|
|
14
14
|
|
|
15
|
+
## Tooltip box
|
|
16
|
+
|
|
17
|
+
The `TooltipBox` component is a simple `Box` that is styled like a chakra tooltip.
|
|
18
|
+
Its styles are derived from the current chakra theme (the `tooltip` recipe).
|
|
19
|
+
It is useful to place tooltip-like messages at a custom location, for example on the map:
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
<TooltipBox>Click on the map to start drawing.</TooltipBox>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`TooltipBox` accepts all `Box` props.
|
|
26
|
+
Additional styles can be applied via the `css` prop (or any other chakra style prop).
|
|
27
|
+
The rendered element always has the css class `tooltip-box`.
|
|
28
|
+
|
|
15
29
|
## License
|
|
16
30
|
|
|
17
31
|
Apache-2.0 (see `LICENSE` file)
|
package/ToolButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolButton.js","sources":["ToolButton.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Button, ButtonProps, Icon, Toggle } from \"@chakra-ui/react\";\nimport { Tooltip, TooltipProps } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps,\n classNames\n} from \"@open-pioneer/react-utils\";\nimport {\n FC,\n MouseEvent,\n MouseEventHandler,\n ReactElement,\n RefAttributes,\n memo,\n useState\n} from \"react\";\n\n/**\n * Properties supported by {@link ToolButton}.\n */\nexport interface ToolButtonProps extends CommonComponentProps, RefAttributes<HTMLButtonElement> {\n /**\n * The label for the ToolButton.\n * This value services as the tooltip text and the aria-label.\n *\n * This property is required for a11y reasons because a ToolButton usually only displays an icon.\n */\n label: string;\n\n /**\n * The icon displayed by the button.\n *\n * NOTE: You can use raw icons here (e.g. svgs from react-icons).\n * The ToolButton will surround the icon with chakra's `<Icon />` component.\n * This will apply the `aria-hidden` attribute, among other things.\n */\n icon: ReactElement;\n\n /**\n * If `true`, the button will show a spinner.\n * Defaults to `false`.\n */\n loading?: boolean;\n\n /**\n * If `true`, indicates that the button is currently active with a different style.\n * Defaults to `undefined`.\n *\n * A value of `true` or `false` indicates that the button supports being active (i.e. pressed).\n * In that case the `aria-pressed` attribute will be configured automatically\n * (see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed).\n */\n active?: boolean;\n\n /**\n * If `true`, the button will be disabled.\n * Defaults to `false`.\n */\n disabled?: boolean;\n\n /**\n * The callback that will be called when the user clicks the button.\n */\n onClick?: MouseEventHandler<HTMLButtonElement> | undefined;\n\n /**\n * Additional properties for the `Tooltip` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n tooltipProps?: Partial<TooltipProps>;\n\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * An button with a tooltip, used for tool buttons on a map.\n */\nexport const ToolButton: FC<ToolButtonProps> = memo(function ToolButton(props: ToolButtonProps) {\n const {\n label,\n icon,\n onClick: onClickProp,\n loading,\n disabled,\n active,\n tooltipProps,\n buttonProps = {},\n ref\n } = props;\n\n const {\n containerProps: { className: baseClassName, ...containerProps }\n } = useCommonComponentProps(\"tool-button\", props);\n\n const className = classNames(baseClassName, {\n \"tool-button--active\": active,\n \"tool-button--loading\": loading,\n \"tool-button--disabled\": disabled\n });\n\n const [tooltipOpen, setTooltipOpen] = useState(false);\n const onClick = (e: MouseEvent<HTMLButtonElement>) => {\n // Immediately hide the tooltip. When the label switches in reaction to the click,\n // the tooltip would flicker briefly with the new label.\n setTooltipOpen(false);\n onClickProp?.(e);\n };\n\n const mergedButtonProps = mergeChakraProps<ButtonProps>(\n { className, onClick, \"aria-label\": label, padding: 0, disabled, loading },\n containerProps,\n buttonProps\n );\n let button = (\n <ButtonIgnoringAriaProps ref={ref} {...mergedButtonProps}>\n <Icon>{icon}</Icon>\n </ButtonIgnoringAriaProps>\n );\n if (active != null) {\n // Make sure that only \"pressable\" buttons receive the aria-pressed attribute.\n button = (\n <Toggle.Root pressed={active} asChild>\n {button}\n </Toggle.Root>\n );\n }\n\n return (\n <Tooltip\n content={label}\n openDelay={500}\n {...tooltipProps}\n /* don't allow overwrite because component would break */\n open={tooltipOpen}\n onOpenChange={(e) => setTooltipOpen(e.open)}\n >\n {button}\n </Tooltip>\n );\n});\n\n/**\n * The tooltip will automatically set 'aria-describedby' when it is being shown.\n * This is redundant because the aria-label already has the same content as the tooltip.\n * This component wraps chakra's button to ignore the *-by attributes.\n */\nconst ButtonIgnoringAriaProps = function ButtonIgnoringAriaProps(\n props: ButtonProps & { ref?: React.Ref<HTMLButtonElement> }\n) {\n const { \"aria-labelledby\": _label, \"aria-describedby\": _describedBy, ref, ...rest } = props;\n return <Button ref={ref} {...rest} />;\n};\n"],"names":["ToolButton","ButtonIgnoringAriaProps"],"mappings":";;;;;;AAuFO,MAAM,UAAA,GAAkC,IAAA,CAAK,SAASA,WAAAA,CAAW,KAAA,EAAwB;AAC5F,EAAA,MAAM;AAAA,IACF,KAAA;AAAA,IACA,IAAA;AAAA,IACA,OAAA,EAAS,WAAA;AAAA,IACT,OAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAc,EAAC;AAAA,IACf;AAAA,GACJ,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACF,cAAA,EAAgB,EAAE,SAAA,EAAW,aAAA,EAAe,GAAG,cAAA;AAAe,GAClE,GAAI,uBAAA,CAAwB,aAAA,EAAe,KAAK,CAAA;AAEhD,EAAA,MAAM,SAAA,GAAY,WAAW,aAAA,EAAe;AAAA,IACxC,qBAAA,EAAuB,MAAA;AAAA,IACvB,sBAAA,EAAwB,OAAA;AAAA,IACxB,uBAAA,EAAyB;AAAA,GAC5B,CAAA;AAED,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA;AACpD,EAAA,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["ToolButton.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Button, ButtonProps, Icon, Toggle } from \"@chakra-ui/react\";\nimport { Tooltip, TooltipProps } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps,\n classNames\n} from \"@open-pioneer/react-utils\";\nimport {\n FC,\n MouseEvent,\n MouseEventHandler,\n ReactElement,\n RefAttributes,\n memo,\n useState\n} from \"react\";\n\n/**\n * Properties supported by {@link ToolButton}.\n */\nexport interface ToolButtonProps extends CommonComponentProps, RefAttributes<HTMLButtonElement> {\n /**\n * The label for the ToolButton.\n * This value services as the tooltip text and the aria-label.\n *\n * This property is required for a11y reasons because a ToolButton usually only displays an icon.\n */\n label: string;\n\n /**\n * The icon displayed by the button.\n *\n * NOTE: You can use raw icons here (e.g. svgs from react-icons).\n * The ToolButton will surround the icon with chakra's `<Icon />` component.\n * This will apply the `aria-hidden` attribute, among other things.\n */\n icon: ReactElement;\n\n /**\n * If `true`, the button will show a spinner.\n * Defaults to `false`.\n */\n loading?: boolean;\n\n /**\n * If `true`, indicates that the button is currently active with a different style.\n * Defaults to `undefined`.\n *\n * A value of `true` or `false` indicates that the button supports being active (i.e. pressed).\n * In that case the `aria-pressed` attribute will be configured automatically\n * (see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed).\n */\n active?: boolean;\n\n /**\n * If `true`, the button will be disabled.\n * Defaults to `false`.\n */\n disabled?: boolean;\n\n /**\n * The callback that will be called when the user clicks the button.\n */\n onClick?: MouseEventHandler<HTMLButtonElement> | undefined;\n\n /**\n * Additional properties for the `Tooltip` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n tooltipProps?: Partial<TooltipProps>;\n\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * An button with a tooltip, used for tool buttons on a map.\n */\nexport const ToolButton: FC<ToolButtonProps> = memo(function ToolButton(props: ToolButtonProps) {\n const {\n label,\n icon,\n onClick: onClickProp,\n loading,\n disabled,\n active,\n tooltipProps,\n buttonProps = {},\n ref\n } = props;\n\n const {\n containerProps: { className: baseClassName, ...containerProps }\n } = useCommonComponentProps(\"tool-button\", props);\n\n const className = classNames(baseClassName, {\n \"tool-button--active\": active,\n \"tool-button--loading\": loading,\n \"tool-button--disabled\": disabled\n });\n\n const [tooltipOpen, setTooltipOpen] = useState(false);\n const onClick = (e: MouseEvent<HTMLButtonElement>) => {\n // Immediately hide the tooltip. When the label switches in reaction to the click,\n // the tooltip would flicker briefly with the new label.\n setTooltipOpen(false);\n onClickProp?.(e);\n };\n\n const mergedButtonProps = mergeChakraProps<ButtonProps>(\n { className, onClick, \"aria-label\": label, padding: 0, disabled, loading },\n containerProps,\n buttonProps\n );\n let button = (\n <ButtonIgnoringAriaProps ref={ref} {...mergedButtonProps}>\n <Icon>{icon}</Icon>\n </ButtonIgnoringAriaProps>\n );\n if (active != null) {\n // Make sure that only \"pressable\" buttons receive the aria-pressed attribute.\n button = (\n <Toggle.Root pressed={active} asChild>\n {button}\n </Toggle.Root>\n );\n }\n\n return (\n <Tooltip\n content={label}\n openDelay={500}\n {...tooltipProps}\n /* don't allow overwrite because component would break */\n open={tooltipOpen}\n onOpenChange={(e) => setTooltipOpen(e.open)}\n >\n {button}\n </Tooltip>\n );\n});\n\n/**\n * The tooltip will automatically set 'aria-describedby' when it is being shown.\n * This is redundant because the aria-label already has the same content as the tooltip.\n * This component wraps chakra's button to ignore the *-by attributes.\n */\nconst ButtonIgnoringAriaProps = function ButtonIgnoringAriaProps(\n props: ButtonProps & { ref?: React.Ref<HTMLButtonElement> }\n) {\n const { \"aria-labelledby\": _label, \"aria-describedby\": _describedBy, ref, ...rest } = props;\n return <Button ref={ref} {...rest} />;\n};\n"],"names":["ToolButton","ButtonI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AAC,OAAO,IAAA,EAAP,EAAY,SAAS,MAAA,EAAQ,OAAA,EAAO,MAChC,QAAA,EAAA,MAAA,EACL,CAAA;AAAA,EAER;AAEA,EAAA,uBACI,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACG,OAAA,EAAS,KAAA;AAAA,MACT,SAAA,EAAW,GAAA;AAAA,MACV,GAAG,YAAA;AAAA,MAEJ,IAAA,EAAM,WAAA;AAAA,MACN,YAAA,EAAc,CAAC,CAAA,KAAM,cAAA,CAAe,EAAE,IAAI,CAAA;AAAA,MAEzC,QAAA,EAAA;AAAA;AAAA,GACL;AAER,CAAC;AAOD,MAAM,uBAAA,GAA0B,SAASC,wBAAAA,CACrC,KAAA,EACF;AACE,EAAA,MAAM,EAAE,mBAAmB,MAAA,EAAQ,kBAAA,EAAoB,cAAc,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AACtF,EAAA,uBAAO,GAAA,CAAC,MAAA,EAAA,EAAO,GAAA,EAAW,GAAG,IAAA,EAAM,CAAA;AACvC,CAAA;;"}
|
package/TooltipBox.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BoxProps } from "@chakra-ui/react";
|
|
2
|
+
export type TooltipBoxProps = BoxProps;
|
|
3
|
+
/**
|
|
4
|
+
* A box that looks like a chakra tooltip.
|
|
5
|
+
*
|
|
6
|
+
* Useful for placing a tooltip-like element at a custom location, for example on the map.
|
|
7
|
+
*
|
|
8
|
+
* Styles are derived from chakra's current theme.
|
|
9
|
+
* Additional styles can be applied via the `css` prop (or any other chakra style props).
|
|
10
|
+
*/
|
|
11
|
+
export declare function TooltipBox(props: TooltipBoxProps): import("react").JSX.Element;
|
package/TooltipBox.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useSlotRecipe, Box } from '@chakra-ui/react';
|
|
3
|
+
import { classNames } from '@open-pioneer/react-utils';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
function TooltipBox(props) {
|
|
7
|
+
const { className, css, ...restProps } = props;
|
|
8
|
+
const tooltipStyles = useSlotRecipe({ key: "tooltip" })();
|
|
9
|
+
const finalCss = useMemo(() => {
|
|
10
|
+
return [tooltipStyles.content, css];
|
|
11
|
+
}, [tooltipStyles.content, css]);
|
|
12
|
+
return /* @__PURE__ */ jsx(Box, { className: classNames("tooltip-box", className), css: finalCss, ...restProps });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { TooltipBox };
|
|
16
|
+
//# sourceMappingURL=TooltipBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipBox.js","sources":["TooltipBox.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, BoxProps, useSlotRecipe } from \"@chakra-ui/react\";\nimport { classNames } from \"@open-pioneer/react-utils\";\nimport { useMemo } from \"react\";\n\nexport type TooltipBoxProps = BoxProps;\n\n/**\n * A box that looks like a chakra tooltip.\n *\n * Useful for placing a tooltip-like element at a custom location, for example on the map.\n *\n * Styles are derived from chakra's current theme.\n * Additional styles can be applied via the `css` prop (or any other chakra style props).\n */\nexport function TooltipBox(props: TooltipBoxProps) {\n const { className, css, ...restProps } = props;\n const tooltipStyles = useSlotRecipe({ key: \"tooltip\" })();\n const finalCss = useMemo(() => {\n return [tooltipStyles.content, css];\n }, [tooltipStyles.content, css]);\n\n return <Box className={classNames(\"tooltip-box\", className)} css={finalCss} {...restProps} />;\n}\n"],"names":[],"mappings":";;;;;AAiBO,SAAS,WAAW,KAAA,EAAwB;AAC/C,EAAA,MAAM,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,WAAU,GAAI,KAAA;AACzC,EAAA,MAAM,gBAAgB,aAAA,CAAc,EAAE,GAAA,EAAK,SAAA,EAAW,CAAA,EAAE;AACxD,EAAA,MAAM,QAAA,GAAW,QAAQ,MAAM;AAC3B,IAAA,OAAO,CAAC,aAAA,CAAc,OAAA,EAAS,GAAG,CAAA;AAAA,EACtC,CAAA,EAAG,CAAC,aAAA,CAAc,OAAA,EAAS,GAAG,CAAC,CAAA;AAE/B,EAAA,uBAAO,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAW,UAAA,CAAW,aAAA,EAAe,SAAS,CAAA,EAAG,GAAA,EAAK,QAAA,EAAW,GAAG,SAAA,EAAW,CAAA;AAC/F;;"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/map-ui-components",
|
|
4
|
-
"version": "1.5.0
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"description": "Contains ui components that can used together with the map",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@chakra-ui/react": "^3.37.0",
|
|
18
|
-
"@open-pioneer/chakra-snippets": "4.8.0
|
|
19
|
-
"@open-pioneer/react-utils": "4.8.0
|
|
20
|
-
"react": "^19.
|
|
18
|
+
"@open-pioneer/chakra-snippets": "^4.8.0",
|
|
19
|
+
"@open-pioneer/react-utils": "^4.8.0",
|
|
20
|
+
"react": "^19.3.0"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"directory": "dist",
|