@canonical/react-ds-global 0.29.1 → 0.30.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/README.md +33 -0
- package/dist/esm/lib/_work_in_progress/IconSection/IconSection.js +1 -1
- package/dist/esm/lib/_work_in_progress/IconSection/IconSection.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/index.js +13 -0
- package/dist/esm/lib/_work_in_progress/index.js.map +1 -0
- package/dist/esm/lib/component/Accordion/common/Item/styles.css +19 -50
- package/dist/esm/lib/component/Accordion/styles.css +5 -1
- package/dist/esm/lib/component/Announcement/Announcement.js +5 -3
- package/dist/esm/lib/component/Announcement/Announcement.js.map +1 -1
- package/dist/esm/lib/component/Announcement/index.js +1 -0
- package/dist/esm/lib/component/Announcement/index.js.map +1 -1
- package/dist/esm/lib/component/Announcement/styles.css +60 -36
- package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js +1 -1
- package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/component/Button/Button.js +13 -5
- package/dist/esm/lib/component/Button/Button.js.map +1 -1
- package/dist/esm/lib/component/Button/styles.css +135 -39
- package/dist/esm/lib/component/Card/Card.js +9 -6
- package/dist/esm/lib/component/Card/Card.js.map +1 -1
- package/dist/esm/lib/component/Card/common/Content/styles.css +1 -1
- package/dist/esm/lib/component/Card/common/Footer/Footer.js +1 -1
- package/dist/esm/lib/component/Card/common/Footer/styles.css +1 -1
- package/dist/esm/lib/component/Card/common/Header/styles.css +1 -1
- package/dist/esm/lib/component/Card/common/index.js +0 -1
- package/dist/esm/lib/component/Card/common/index.js.map +1 -1
- package/dist/esm/lib/component/Card/styles.css +8 -8
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +94 -0
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js +32 -0
- package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/Item/index.js +2 -0
- package/dist/esm/lib/component/ContextualMenu/common/Item/index.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +93 -0
- package/dist/esm/lib/component/ContextualMenu/common/Item/types.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/MenuContext.js +12 -0
- package/dist/esm/lib/component/ContextualMenu/common/MenuContext.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js +109 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/index.js +2 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/index.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/index.js +2 -0
- package/dist/esm/lib/component/ContextualMenu/index.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/styles.css +86 -0
- package/dist/esm/lib/component/ContextualMenu/types.js.map +1 -0
- package/dist/esm/lib/component/Popover/Popover.js +50 -0
- package/dist/esm/lib/component/Popover/Popover.js.map +1 -0
- package/dist/esm/lib/component/Popover/index.js +2 -0
- package/dist/esm/lib/component/Popover/index.js.map +1 -0
- package/dist/esm/lib/component/Popover/styles.css +65 -0
- package/dist/esm/lib/component/Popover/types.js +2 -0
- package/dist/esm/lib/component/Popover/types.js.map +1 -0
- package/dist/esm/lib/component/Tabs/Tabs.js +27 -0
- package/dist/esm/lib/component/Tabs/Tabs.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/Item/Item.js +20 -0
- package/dist/esm/lib/component/Tabs/common/Item/Item.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/Item/index.js +3 -0
- package/dist/esm/lib/component/Tabs/common/Item/index.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +75 -0
- package/dist/esm/lib/component/Tabs/common/Item/types.js +2 -0
- package/dist/esm/lib/component/Tabs/common/Item/types.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/index.js +2 -0
- package/dist/esm/lib/component/Tabs/common/index.js.map +1 -0
- package/dist/esm/lib/component/Tabs/index.js +3 -0
- package/dist/esm/lib/component/Tabs/index.js.map +1 -0
- package/dist/esm/lib/component/Tabs/styles.css +37 -0
- package/dist/esm/lib/component/Tabs/types.js +2 -0
- package/dist/esm/lib/component/Tabs/types.js.map +1 -0
- package/dist/esm/lib/component/Tile/Tile.js +6 -1
- package/dist/esm/lib/component/Tile/Tile.js.map +1 -1
- package/dist/esm/lib/component/Tile/common/Content/styles.css +17 -8
- package/dist/esm/lib/component/Tile/common/Header/styles.css +15 -12
- package/dist/esm/lib/component/Tile/styles.css +19 -53
- package/dist/esm/lib/component/Tooltip/Tooltip.js +6 -4
- package/dist/esm/lib/component/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js +47 -25
- package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/styles.css +146 -81
- package/dist/esm/lib/component/Tooltip/withTooltip.js +3 -3
- package/dist/esm/lib/component/Tooltip/withTooltip.js.map +1 -1
- package/dist/esm/lib/component/index.js +17 -0
- package/dist/esm/lib/component/index.js.map +1 -0
- package/dist/esm/lib/group/index.js +3 -0
- package/dist/esm/lib/group/index.js.map +1 -0
- package/dist/esm/lib/hooks/index.js +2 -1
- package/dist/esm/lib/hooks/index.js.map +1 -1
- package/dist/esm/lib/hooks/useContextualMenu/index.js +3 -0
- package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -0
- package/dist/esm/lib/hooks/useContextualMenu/types.js +2 -0
- package/dist/esm/lib/hooks/useContextualMenu/types.js.map +1 -0
- package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +175 -0
- package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -0
- package/dist/esm/lib/hooks/useDisclosure/index.js +3 -0
- package/dist/esm/lib/hooks/useDisclosure/index.js.map +1 -0
- package/dist/esm/lib/hooks/useDisclosure/types.js +2 -0
- package/dist/esm/lib/hooks/useDisclosure/types.js.map +1 -0
- package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js +230 -0
- package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -0
- package/dist/esm/lib/hooks/useResizeObserver/useResizeObserver.js +37 -7
- package/dist/esm/lib/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +9 -0
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/index.js +1 -0
- package/dist/esm/lib/hooks/useWindowFitment/index.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js +25 -0
- package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js.map +1 -0
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +211 -21
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
- package/dist/esm/lib/index.js +8 -25
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/pattern/index.js +3 -0
- package/dist/esm/lib/pattern/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/Spinner/Spinner.js +35 -0
- package/dist/esm/lib/subcomponent/Spinner/Spinner.js.map +1 -0
- package/dist/esm/lib/subcomponent/Spinner/index.js +2 -0
- package/dist/esm/lib/subcomponent/Spinner/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/Spinner/styles.css +50 -0
- package/dist/esm/lib/subcomponent/Spinner/types.js +2 -0
- package/dist/esm/lib/subcomponent/Spinner/types.js.map +1 -0
- package/dist/esm/lib/subcomponent/index.js +3 -0
- package/dist/esm/lib/subcomponent/index.js.map +1 -0
- package/dist/esm/lib/types/link.js +2 -0
- package/dist/esm/lib/types/link.js.map +1 -0
- package/dist/types/lib/_work_in_progress/Link/types.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/Link/types.d.ts.map +1 -1
- package/dist/types/lib/_work_in_progress/index.d.ts +12 -0
- package/dist/types/lib/_work_in_progress/index.d.ts.map +1 -0
- package/dist/types/lib/component/Announcement/Announcement.d.ts +2 -2
- package/dist/types/lib/component/Announcement/Announcement.d.ts.map +1 -1
- package/dist/types/lib/component/Announcement/index.d.ts.map +1 -1
- package/dist/types/lib/component/Announcement/types.d.ts +17 -6
- package/dist/types/lib/component/Announcement/types.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/types/lib/component/Breadcrumbs/common/Item/Item.d.ts +1 -1
- package/dist/types/lib/component/Breadcrumbs/common/Item/Item.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/common/Item/types.d.ts +8 -13
- package/dist/types/lib/component/Breadcrumbs/common/Item/types.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/types.d.ts +8 -1
- package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
- package/dist/types/lib/component/Button/Button.d.ts +3 -1
- package/dist/types/lib/component/Button/Button.d.ts.map +1 -1
- package/dist/types/lib/component/Button/types.d.ts +8 -4
- package/dist/types/lib/component/Button/types.d.ts.map +1 -1
- package/dist/types/lib/component/Card/Card.d.ts +3 -5
- package/dist/types/lib/component/Card/Card.d.ts.map +1 -1
- package/dist/types/lib/component/Card/common/Footer/Footer.d.ts +1 -1
- package/dist/types/lib/component/Card/common/Footer/types.d.ts +1 -1
- package/dist/types/lib/component/Card/common/index.d.ts +0 -1
- package/dist/types/lib/component/Card/common/index.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +15 -0
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts +14 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/index.d.ts +3 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/index.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/types.d.ts +11 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/types.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +19 -0
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +15 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/index.d.ts +2 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/index.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/index.d.ts +3 -0
- package/dist/types/lib/component/ContextualMenu/index.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/types.d.ts +30 -0
- package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -0
- package/dist/types/lib/component/Popover/Popover.d.ts +16 -0
- package/dist/types/lib/component/Popover/Popover.d.ts.map +1 -0
- package/dist/types/lib/component/Popover/index.d.ts +3 -0
- package/dist/types/lib/component/Popover/index.d.ts.map +1 -0
- package/dist/types/lib/component/Popover/types.d.ts +24 -0
- package/dist/types/lib/component/Popover/types.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/Tabs.d.ts +18 -0
- package/dist/types/lib/component/Tabs/Tabs.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/Item/Item.d.ts +15 -0
- package/dist/types/lib/component/Tabs/common/Item/Item.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/Item/index.d.ts +3 -0
- package/dist/types/lib/component/Tabs/common/Item/index.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/Item/types.d.ts +18 -0
- package/dist/types/lib/component/Tabs/common/Item/types.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/index.d.ts +2 -0
- package/dist/types/lib/component/Tabs/common/index.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/index.d.ts +3 -0
- package/dist/types/lib/component/Tabs/index.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/types.d.ts +46 -0
- package/dist/types/lib/component/Tabs/types.d.ts.map +1 -0
- package/dist/types/lib/component/Tile/Tile.d.ts +2 -0
- package/dist/types/lib/component/Tile/Tile.d.ts.map +1 -1
- package/dist/types/lib/component/Tile/common/Content/types.d.ts +1 -1
- package/dist/types/lib/component/Tile/common/Header/types.d.ts +1 -1
- package/dist/types/lib/component/Tile/types.d.ts +4 -5
- package/dist/types/lib/component/Tile/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/lib/component/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts +2 -2
- package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/common/TooltipArea/types.d.ts +14 -2
- package/dist/types/lib/component/Tooltip/common/TooltipArea/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/types.d.ts +6 -0
- package/dist/types/lib/component/Tooltip/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/withTooltip.d.ts +10 -3
- package/dist/types/lib/component/Tooltip/withTooltip.d.ts.map +1 -1
- package/dist/types/lib/component/index.d.ts +16 -0
- package/dist/types/lib/component/index.d.ts.map +1 -0
- package/dist/types/lib/group/index.d.ts +2 -0
- package/dist/types/lib/group/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/index.d.ts +2 -1
- package/dist/types/lib/hooks/index.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/index.d.ts +3 -0
- package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/useContextualMenu/types.d.ts +71 -0
- package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -0
- package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +20 -0
- package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -0
- package/dist/types/lib/hooks/useDisclosure/index.d.ts +3 -0
- package/dist/types/lib/hooks/useDisclosure/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/useDisclosure/types.d.ts +103 -0
- package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -0
- package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +32 -0
- package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -0
- package/dist/types/lib/hooks/useResizeObserver/useResizeObserver.d.ts +6 -0
- package/dist/types/lib/hooks/useResizeObserver/useResizeObserver.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowDimensions/useWindowDimensions.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/index.d.ts +1 -0
- package/dist/types/lib/hooks/useWindowFitment/index.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/readingDirection.d.ts +14 -0
- package/dist/types/lib/hooks/useWindowFitment/readingDirection.d.ts.map +1 -0
- package/dist/types/lib/hooks/useWindowFitment/types.d.ts +75 -4
- package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +44 -2
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +5 -25
- package/dist/types/lib/index.d.ts.map +1 -1
- package/dist/types/lib/pattern/index.d.ts +2 -0
- package/dist/types/lib/pattern/index.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/Spinner/Spinner.d.ts +24 -0
- package/dist/types/lib/subcomponent/Spinner/Spinner.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/Spinner/index.d.ts +3 -0
- package/dist/types/lib/subcomponent/Spinner/index.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/Spinner/types.d.ts +17 -0
- package/dist/types/lib/subcomponent/Spinner/types.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/index.d.ts +2 -0
- package/dist/types/lib/subcomponent/index.d.ts.map +1 -0
- package/dist/types/lib/types/index.d.ts +1 -0
- package/dist/types/lib/types/index.d.ts.map +1 -1
- package/dist/types/lib/types/link.d.ts +26 -0
- package/dist/types/lib/types/link.d.ts.map +1 -0
- package/package.json +16 -19
- package/dist/esm/lib/component/Card/common/Thumbnail/Thumbnail.js +0 -21
- package/dist/esm/lib/component/Card/common/Thumbnail/Thumbnail.js.map +0 -1
- package/dist/esm/lib/component/Card/common/Thumbnail/index.js +0 -2
- package/dist/esm/lib/component/Card/common/Thumbnail/index.js.map +0 -1
- package/dist/esm/lib/component/Card/common/Thumbnail/styles.css +0 -39
- package/dist/esm/lib/component/Card/common/Thumbnail/types.js.map +0 -1
- package/dist/esm/lib/hooks/usePopup/index.js +0 -3
- package/dist/esm/lib/hooks/usePopup/index.js.map +0 -1
- package/dist/esm/lib/hooks/usePopup/types.js.map +0 -1
- package/dist/esm/lib/hooks/usePopup/usePopup.js +0 -93
- package/dist/esm/lib/hooks/usePopup/usePopup.js.map +0 -1
- package/dist/esm/storybook/decorators.js +0 -16
- package/dist/esm/storybook/decorators.js.map +0 -1
- package/dist/types/lib/component/Card/common/Thumbnail/Thumbnail.d.ts +0 -23
- package/dist/types/lib/component/Card/common/Thumbnail/Thumbnail.d.ts.map +0 -1
- package/dist/types/lib/component/Card/common/Thumbnail/index.d.ts +0 -3
- package/dist/types/lib/component/Card/common/Thumbnail/index.d.ts.map +0 -1
- package/dist/types/lib/component/Card/common/Thumbnail/types.d.ts +0 -27
- package/dist/types/lib/component/Card/common/Thumbnail/types.d.ts.map +0 -1
- package/dist/types/lib/hooks/usePopup/index.d.ts +0 -3
- package/dist/types/lib/hooks/usePopup/index.d.ts.map +0 -1
- package/dist/types/lib/hooks/usePopup/types.d.ts +0 -65
- package/dist/types/lib/hooks/usePopup/types.d.ts.map +0 -1
- package/dist/types/lib/hooks/usePopup/usePopup.d.ts +0 -19
- package/dist/types/lib/hooks/usePopup/usePopup.d.ts.map +0 -1
- package/dist/types/storybook/decorators.d.ts +0 -15
- package/dist/types/storybook/decorators.d.ts.map +0 -1
- /package/dist/esm/lib/component/{Card/common/Thumbnail → ContextualMenu/common/Item}/types.js +0 -0
- /package/dist/esm/lib/{hooks/usePopup → component/ContextualMenu}/types.js +0 -0
|
@@ -7,11 +7,17 @@ export interface UseWindowFitmentProps {
|
|
|
7
7
|
*/
|
|
8
8
|
autoFit?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Ordered preferred placements for the popup. Each entry is either a bare
|
|
11
|
+
* logical side (`inline-start` | `inline-end` | `block-start` | `block-end`,
|
|
12
|
+
* implying `align: "center"`) or a `{ side, align }` pair. The hook resolves
|
|
13
|
+
* each logical side to a physical direction from the anchored element's
|
|
14
|
+
* writing direction — so `inline-*` mirrors automatically in RTL — then tries
|
|
15
|
+
* them in order and takes the first that naturally fits. Alignment-flipping is
|
|
16
|
+
* expressed by listing e.g. `{inline-end, start}` then `{inline-end, end}`.
|
|
17
|
+
* Defaults to centred ['block-start', 'block-end', 'inline-start',
|
|
18
|
+
* 'inline-end'] (= [top, bottom, left, right] in LTR).
|
|
13
19
|
*/
|
|
14
|
-
preferredDirections?:
|
|
20
|
+
preferredDirections?: (WindowFitmentSide | WindowFitmentPlacement)[];
|
|
15
21
|
/**
|
|
16
22
|
* The distance, in pixels between the target and the popup.
|
|
17
23
|
* @TODO support non-px units. E.G., someone should be able to request '1em`.
|
|
@@ -36,12 +42,45 @@ export interface UseWindowFitmentProps {
|
|
|
36
42
|
scrollDelay?: number;
|
|
37
43
|
/** Whether the popup is open or not. */
|
|
38
44
|
isOpen?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Override the writing direction used to resolve logical (`inline-*`)
|
|
47
|
+
* placements. Defaults to the document's `<html dir>` — the single source of
|
|
48
|
+
* truth for the app locale. Set this only to force a subtree to a direction
|
|
49
|
+
* that differs from the document.
|
|
50
|
+
*/
|
|
51
|
+
direction?: "ltr" | "rtl";
|
|
39
52
|
/**
|
|
40
53
|
* An optional callback to be called when the best position of the popup changes.
|
|
41
54
|
*/
|
|
42
55
|
onBestPositionChange?: (bestPosition?: BestPosition) => void;
|
|
43
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* A PHYSICAL side — the resolved OUTPUT axis (keys the arrow CSS and fakeMargin).
|
|
59
|
+
* Callers supply logical sides (see {@link WindowFitmentSide}); the hook resolves
|
|
60
|
+
* them to a physical direction for the current writing direction.
|
|
61
|
+
*/
|
|
44
62
|
export type WindowFitmentDirection = "top" | "bottom" | "left" | "right";
|
|
63
|
+
/**
|
|
64
|
+
* A LOGICAL side — the INPUT axis vocabulary. `inline-*` follows the anchored
|
|
65
|
+
* element's writing direction, so it mirrors in RTL: `inline-start` is the start
|
|
66
|
+
* of the line (LEFT in LTR / RIGHT in RTL) and `inline-end` is the trailing edge
|
|
67
|
+
* (RIGHT in LTR / LEFT in RTL). `block-*` is the vertical axis and is
|
|
68
|
+
* dir-invariant (`block-start` = top, `block-end` = bottom).
|
|
69
|
+
*/
|
|
70
|
+
export type WindowFitmentSide = "inline-start" | "inline-end" | "block-start" | "block-end";
|
|
71
|
+
/**
|
|
72
|
+
* Where the popup sits along the cross-axis of its side (Floating-UI's alignment
|
|
73
|
+
* axis). For a vertical side this is the vertical axis: `start` top-aligns the
|
|
74
|
+
* popup with the target (`popup.top = target.top`), `end` bottom-aligns it,
|
|
75
|
+
* `center` centres it. For a horizontal side it is the horizontal axis. Defaults
|
|
76
|
+
* to `center` — the historical behaviour the tooltip relies on.
|
|
77
|
+
*/
|
|
78
|
+
export type WindowFitmentAlign = "start" | "center" | "end";
|
|
79
|
+
/** A LOGICAL placement supplied to the hook: which logical side, and where along it. */
|
|
80
|
+
export interface WindowFitmentPlacement {
|
|
81
|
+
side: WindowFitmentSide;
|
|
82
|
+
align: WindowFitmentAlign;
|
|
83
|
+
}
|
|
45
84
|
export interface UseWindowFitmentResult {
|
|
46
85
|
/**
|
|
47
86
|
* A ref to be attached to the target element.
|
|
@@ -59,14 +98,46 @@ export interface UseWindowFitmentResult {
|
|
|
59
98
|
* The style object to be applied to the popup element.
|
|
60
99
|
*/
|
|
61
100
|
popupPositionStyle: CSSProperties;
|
|
101
|
+
/**
|
|
102
|
+
* The offset, in pixels, needed to keep an arrow pointing at the target's
|
|
103
|
+
* centre, along the cross-axis of the current placement (horizontal for
|
|
104
|
+
* `top`/`bottom`, vertical for `left`/`right`). Zero when the popup is
|
|
105
|
+
* centred on the target. Optional to consume: popups without an arrow ignore
|
|
106
|
+
* it. `undefined` until a position has been measured.
|
|
107
|
+
*/
|
|
108
|
+
arrowOffset?: ArrowOffset;
|
|
109
|
+
/**
|
|
110
|
+
* The writing direction resolved from the anchored element (`ltr` on the
|
|
111
|
+
* server / before mount). Set it as `dir` on a PORTALLED popup so its contents
|
|
112
|
+
* (e.g. a submenu caret, text alignment) inherit the anchor's direction even
|
|
113
|
+
* though the portal escapes the anchor's DOM subtree.
|
|
114
|
+
*/
|
|
115
|
+
direction: "ltr" | "rtl";
|
|
62
116
|
}
|
|
63
117
|
export type RelativePosition = {
|
|
64
118
|
top: number;
|
|
65
119
|
left: number;
|
|
66
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* The displacement of an arrow from the centre of a popup edge so it points at
|
|
123
|
+
* the target. `axis` names which dimension the `offset` applies to: `x` shifts
|
|
124
|
+
* the arrow horizontally (for `top`/`bottom` placements), `y` vertically (for
|
|
125
|
+
* `left`/`right`).
|
|
126
|
+
*/
|
|
127
|
+
export interface ArrowOffset {
|
|
128
|
+
axis: "x" | "y";
|
|
129
|
+
offset: number;
|
|
130
|
+
}
|
|
67
131
|
export interface BestPosition {
|
|
68
132
|
position: RelativePosition;
|
|
133
|
+
/**
|
|
134
|
+
* The SIDE the popup was placed on — always one of the four base directions.
|
|
135
|
+
* Keys the arrow CSS, `computeArrowOffset`, and `fakeMargin`. Alignment never
|
|
136
|
+
* appears here (see `align`), so those consumers stay corner-free.
|
|
137
|
+
*/
|
|
69
138
|
positionName: WindowFitmentDirection;
|
|
139
|
+
/** The alignment that produced this position. `center` for legacy callers. */
|
|
140
|
+
align: WindowFitmentAlign;
|
|
70
141
|
fits: boolean;
|
|
71
142
|
autoFitOffset: RelativePosition;
|
|
72
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,EAAE,CAAC;IACrE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CAC9D;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,YAAY,GACZ,aAAa,GACb,WAAW,CAAC;AAEhB;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5D,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,kBAAkB,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC5C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,aAAa,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;CAO1B;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,YAAY,EAAE,sBAAsB,CAAC;IACrC,8EAA8E;IAC9E,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,gBAAgB,CAAC;CACjC"}
|
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
import type { UseWindowFitmentProps, UseWindowFitmentResult } from "./types.js";
|
|
2
|
-
|
|
1
|
+
import type { ArrowOffset, UseWindowFitmentProps, UseWindowFitmentResult, WindowFitmentAlign, WindowFitmentDirection, WindowFitmentPlacement, WindowFitmentSide } from "./types.js";
|
|
2
|
+
/** A resolved PHYSICAL placement — what the fitment core consumes internally. */
|
|
3
|
+
type PhysicalPlacement = {
|
|
4
|
+
direction: WindowFitmentDirection;
|
|
5
|
+
align: WindowFitmentAlign;
|
|
6
|
+
};
|
|
7
|
+
/** Coerce a bare logical side or a placement into a full logical placement. */
|
|
8
|
+
export declare const toPlacement: (entry: WindowFitmentSide | WindowFitmentPlacement) => WindowFitmentPlacement;
|
|
9
|
+
/**
|
|
10
|
+
* Map a LOGICAL placement to a PHYSICAL one for a writing direction. The inline
|
|
11
|
+
* axis follows `dir` (mirrors in RTL); the block axis is dir-invariant.
|
|
12
|
+
*
|
|
13
|
+
* INVARIANT: `align` is passed through UNMODIFIED. This is only correct because
|
|
14
|
+
* every `inline-*` side has a dir-invariant (block/vertical) cross-axis, and
|
|
15
|
+
* every `block-*` side in use is `align: "center"` (dir-blind). If a future
|
|
16
|
+
* `block-*` placement ever needs `start`/`end`, that align becomes dir-dependent
|
|
17
|
+
* and MUST be flipped here for RTL — do not add one without handling it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const resolveLogicalPlacement: (placement: WindowFitmentPlacement, dir: "ltr" | "rtl") => PhysicalPlacement;
|
|
20
|
+
/**
|
|
21
|
+
* Compute the cross-axis displacement needed to keep an arrow pointing at the
|
|
22
|
+
* target's centre for a given placement. The arrow sits at the popup edge
|
|
23
|
+
* centre by default; this returns how far to shift it so it aligns with the
|
|
24
|
+
* target centre, clamped to the popup's half-extent so it never leaves the edge.
|
|
25
|
+
* @param direction The side of the target the popup is placed on.
|
|
26
|
+
* @param targetRect The bounding client rect of the target element.
|
|
27
|
+
* @param popupRect The bounding client rect of the popup element.
|
|
28
|
+
* @returns The arrow axis and offset in pixels.
|
|
29
|
+
*/
|
|
30
|
+
export declare const computeArrowOffset: (direction: WindowFitmentDirection, targetRect: DOMRect, popupRect: DOMRect,
|
|
31
|
+
/**
|
|
32
|
+
* The authoritative popup position (top-left, viewport coordinates) as just
|
|
33
|
+
* computed by fitment. The popup's live `getBoundingClientRect()` lags one
|
|
34
|
+
* frame behind `bestPosition` (it still reflects the previous placement while
|
|
35
|
+
* the new `left`/`top` are applied), so measuring the centre from the live
|
|
36
|
+
* rect yields a stale offset and the arrow drifts off the anchor. Passing the
|
|
37
|
+
* authoritative position removes that lag; the rect is still used for the
|
|
38
|
+
* popup's stable width/height. Defaults to the rect's own top-left.
|
|
39
|
+
*/
|
|
40
|
+
popupPosition?: {
|
|
41
|
+
top: number;
|
|
42
|
+
left: number;
|
|
43
|
+
}) => ArrowOffset;
|
|
44
|
+
declare const useWindowFitment: ({ preferredDirections, distance, gutter, maxWidth, resizeDelay, scrollDelay, onBestPositionChange, autoFit, direction: directionProp, }: UseWindowFitmentProps) => UseWindowFitmentResult;
|
|
3
45
|
export default useWindowFitment;
|
|
4
46
|
//# sourceMappingURL=useWindowFitment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowFitment.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/useWindowFitment.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useWindowFitment.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/useWindowFitment.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,WAAW,EAGX,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,iFAAiF;AACjF,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,WAAW,GACtB,OAAO,iBAAiB,GAAG,sBAAsB,KAChD,sBACmE,CAAC;AAEvE;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,sBAAsB,EACjC,KAAK,KAAK,GAAG,KAAK,KACjB,iBAiBF,CAAC;AAcF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,sBAAsB,EACjC,YAAY,OAAO,EACnB,WAAW,OAAO;AAClB;;;;;;;;GAQG;AACH,gBAAe;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAGzC,KACA,WAmBF,CAAC;AAEF,QAAA,MAAM,gBAAgB,GAAI,yIAevB,qBAAqB,KAAG,sBA6Y1B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
export * from "./_work_in_progress/
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./_work_in_progress/Label/index.js";
|
|
7
|
-
export * from "./_work_in_progress/Link/index.js";
|
|
8
|
-
export * from "./_work_in_progress/Rule/index.js";
|
|
9
|
-
export * from "./_work_in_progress/Section/index.js";
|
|
10
|
-
export * from "./_work_in_progress/SkipLink/index.js";
|
|
11
|
-
export * from "./_work_in_progress/TSection/index.js";
|
|
12
|
-
export * from "./component/Accordion/index.js";
|
|
13
|
-
export * from "./component/Announcement/index.js";
|
|
14
|
-
export * from "./component/Badge/index.js";
|
|
15
|
-
export * from "./component/Breadcrumbs/index.js";
|
|
16
|
-
export * from "./component/Button/index.js";
|
|
17
|
-
export * from "./component/Card/index.js";
|
|
18
|
-
export * from "./component/Chip/index.js";
|
|
19
|
-
export * from "./component/Icon/index.js";
|
|
20
|
-
export * from "./component/InlineCode/index.js";
|
|
21
|
-
export * from "./component/KeyboardKey/index.js";
|
|
22
|
-
export * from "./component/Tile/index.js";
|
|
23
|
-
export * from "./component/Tooltip/index.js";
|
|
24
|
-
export * from "./group/KeyboardKeys/index.js";
|
|
25
|
-
export * from "./pattern/Timeline/index.js";
|
|
1
|
+
export * from "./_work_in_progress/index.js";
|
|
2
|
+
export * from "./component/index.js";
|
|
3
|
+
export * from "./group/index.js";
|
|
4
|
+
export * from "./pattern/index.js";
|
|
5
|
+
export * from "./subcomponent/index.js";
|
|
26
6
|
export type * from "./types/index.js";
|
|
27
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAGA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,mBAAmB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/pattern/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { SpinnerProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
/**
|
|
5
|
+
* An indeterminate activity indicator: the `spinner` icon (the Canonical
|
|
6
|
+
* "circle of friends") rotating continuously to signal that work is in
|
|
7
|
+
* progress. Mirrors `Icon`'s rendering and accessibility model — decorative by
|
|
8
|
+
* default, exposed as a named `img` when given an `aria-label`/`aria-labelledby`
|
|
9
|
+
* — and adds the continuous rotation, which pauses under `prefers-reduced-motion`.
|
|
10
|
+
*
|
|
11
|
+
* The glyph is referenced from `@canonical/ds-assets` at runtime
|
|
12
|
+
* (`${rootPath}/spinner.svg#spinner`, default `/icons`), not bundled — the
|
|
13
|
+
* consuming app must serve those SVGs at that path, or the spinner renders
|
|
14
|
+
* empty. If the app serves icons from a different location, pass `rootPath`
|
|
15
|
+
* (per instance; there is no global default yet). See the package README
|
|
16
|
+
* ("Icon assets").
|
|
17
|
+
*
|
|
18
|
+
* `import { Spinner } from "@canonical/react-ds-global";`
|
|
19
|
+
*
|
|
20
|
+
* @implements ds:global.subcomponent.spinner
|
|
21
|
+
*/
|
|
22
|
+
declare const Spinner: ({ className, rootPath, role, ...props }: SpinnerProps) => ReactElement;
|
|
23
|
+
export default Spinner;
|
|
24
|
+
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/Spinner/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAQtB;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,OAAO,GAAI,yCAKd,YAAY,KAAG,YAqBjB,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/Spinner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SVGAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The Spinner has no props of its own beyond those of the underlying icon
|
|
4
|
+
* `<svg>`: it always renders the `spinner` icon and animates it. The `icon`
|
|
5
|
+
* name is fixed, so it is not part of the public surface.
|
|
6
|
+
*
|
|
7
|
+
* Like `Icon`, the Spinner is decorative by default (`aria-hidden="true"`).
|
|
8
|
+
* Pass an `aria-label` (or `aria-labelledby`) when the spinner is the only
|
|
9
|
+
* indication that work is in progress; it is then exposed as a named `img`.
|
|
10
|
+
* When the spinner sits inside a control that already announces its busy
|
|
11
|
+
* state (e.g. a submitting Button), leave it decorative.
|
|
12
|
+
*/
|
|
13
|
+
export interface SpinnerProps extends SVGAttributes<HTMLOrSVGElement> {
|
|
14
|
+
/** Root path to the icons (default: /icons). Must be exposed to the user. */
|
|
15
|
+
rootPath?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/Spinner/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAa,SAAQ,aAAa,CAAC,gBAAgB,CAAC;IACnE,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentType, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props passed to a custom `LinkComponent` for router integration.
|
|
4
|
+
*
|
|
5
|
+
* The single, shared contract for every component that injects one link
|
|
6
|
+
* renderer for its navigable items (Breadcrumbs, SideNavigation, Tabs, …).
|
|
7
|
+
* Deliberately narrow — only these four props are forwarded, not the full
|
|
8
|
+
* anchor attribute set — so the same router `Link` (e.g.
|
|
9
|
+
* `@canonical/router-react`, Next.js, React Router) works across all of them.
|
|
10
|
+
* The component receives `aria-current` and must forward it to the rendered
|
|
11
|
+
* anchor.
|
|
12
|
+
*
|
|
13
|
+
* @see cs:react.component.link_component
|
|
14
|
+
*/
|
|
15
|
+
export interface LinkComponentProps {
|
|
16
|
+
href?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
"aria-current"?: HTMLAttributes<HTMLElement>["aria-current"];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `LinkComponent` prop type: a component honouring {@link LinkComponentProps},
|
|
23
|
+
* or the intrinsic `"a"` element (the default when none is supplied).
|
|
24
|
+
*/
|
|
25
|
+
export type LinkComponent = ComponentType<LinkComponentProps> | "a";
|
|
26
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;CAC9D;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,kBAAkB,CAAC,GAAG,GAAG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-ds-global",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
|
-
"imports": {
|
|
9
|
-
"#lib/*": {
|
|
10
|
-
"development": "./src/lib/*",
|
|
11
|
-
"types": "./dist/types/lib/*",
|
|
12
|
-
"default": "./dist/esm/lib/*"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
8
|
"files": [
|
|
16
9
|
"dist"
|
|
17
10
|
],
|
|
@@ -50,21 +43,25 @@
|
|
|
50
43
|
"test:vitest:watch": "vitest"
|
|
51
44
|
},
|
|
52
45
|
"dependencies": {
|
|
53
|
-
"@canonical/
|
|
54
|
-
"@canonical/
|
|
55
|
-
"@canonical/
|
|
56
|
-
"@canonical/
|
|
46
|
+
"@canonical/design-tokens": "0.6.2-contrasted.0",
|
|
47
|
+
"@canonical/ds-assets": "^0.30.0",
|
|
48
|
+
"@canonical/react-hooks": "^0.30.0",
|
|
49
|
+
"@canonical/storybook-config": "^0.30.0",
|
|
50
|
+
"@canonical/styles": "^0.30.0",
|
|
51
|
+
"@canonical/utils": "^0.30.0",
|
|
57
52
|
"react": "^19.2.4",
|
|
58
53
|
"react-dom": "^19.2.4"
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@biomejs/biome": "2.4.9",
|
|
62
|
-
"@canonical/biome-config": "^0.
|
|
63
|
-
"@canonical/
|
|
64
|
-
"@canonical/
|
|
65
|
-
"@canonical/
|
|
66
|
-
"@canonical/
|
|
67
|
-
"@canonical/
|
|
57
|
+
"@canonical/biome-config": "^0.30.0",
|
|
58
|
+
"@canonical/ds-types": "^0.30.0",
|
|
59
|
+
"@canonical/router-core": "^0.30.0",
|
|
60
|
+
"@canonical/router-react": "^0.30.0",
|
|
61
|
+
"@canonical/storybook-helpers": "^0.30.0",
|
|
62
|
+
"@canonical/typescript-config-react": "^0.30.0",
|
|
63
|
+
"@canonical/vitest-config-react": "^0.30.0",
|
|
64
|
+
"@canonical/webarchitect": "^0.30.0",
|
|
68
65
|
"@chromatic-com/storybook": "^5.0.1",
|
|
69
66
|
"@storybook/addon-docs": "^10.3.1",
|
|
70
67
|
"@storybook/react-vite": "^10.3.1",
|
|
@@ -82,5 +79,5 @@
|
|
|
82
79
|
"vite": "^8.0.1",
|
|
83
80
|
"vitest": "^4.0.18"
|
|
84
81
|
},
|
|
85
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "40fe86ac955473536ac14f074812a9821f5b65c0"
|
|
86
83
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
const componentCssClassName = "ds card-thumbnail";
|
|
4
|
-
/**
|
|
5
|
-
* Card.Thumbnail subcomponent
|
|
6
|
-
*
|
|
7
|
-
* Displays a small thumbnail image within a card, typically used alongside
|
|
8
|
-
* content for logo/icon representation.
|
|
9
|
-
*
|
|
10
|
-
* DSL anatomy:
|
|
11
|
-
* - layout.type: flow
|
|
12
|
-
* - layout.direction: horizontal
|
|
13
|
-
* - layout.align: start
|
|
14
|
-
* - edges: [0] image, [1] content (optional)
|
|
15
|
-
*
|
|
16
|
-
* @implements ds:global.subcomponent.card-thumbnail
|
|
17
|
-
*/
|
|
18
|
-
const Thumbnail = ({ className, imageProps, children, ...props }) => (_jsxs("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: [_jsx("img", { className: "image", alt: imageProps.alt, ...imageProps }), children && _jsx("div", { className: "content", children: children })] }));
|
|
19
|
-
Thumbnail.displayName = "Card.Thumbnail";
|
|
20
|
-
export default Thumbnail;
|
|
21
|
-
//# sourceMappingURL=Thumbnail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Thumbnail.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Card/common/Thumbnail/Thumbnail.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,SAAS,GAAG,CAAC,EACjB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACO,EAAsB,EAAE,CAAC,CACxC,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,aAGT,cAAK,SAAS,EAAC,OAAO,EAAC,GAAG,EAAE,UAAU,CAAC,GAAG,KAAM,UAAU,GAAI,EAG7D,QAAQ,IAAI,cAAK,SAAS,EAAC,SAAS,YAAE,QAAQ,GAAO,IAClD,CACP,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAEzC,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Card/common/Thumbnail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Card.Thumbnail styles
|
|
3
|
-
* @implements dso:global.subcomponent.card-thumbnail
|
|
4
|
-
*
|
|
5
|
-
* DSL anatomy: layout.type flow, horizontal, align start. A content-bearing
|
|
6
|
-
* section (image + text): it pads itself. The image is a fixed 4rem square
|
|
7
|
-
* (per the DSL) and does not bleed. Vertical padding is in baseline multiples.
|
|
8
|
-
*/
|
|
9
|
-
:root {
|
|
10
|
-
--card-thumbnail-gap: var(--dimension-200);
|
|
11
|
-
--card-thumbnail-padding-block: var(--dimension-200);
|
|
12
|
-
--card-thumbnail-padding-inline: var(--dimension-200);
|
|
13
|
-
--card-thumbnail-image-size: var(--dimension-800);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.ds.card-thumbnail {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: row;
|
|
19
|
-
align-items: flex-start;
|
|
20
|
-
gap: var(--card-thumbnail-gap);
|
|
21
|
-
|
|
22
|
-
padding-block: var(--card-thumbnail-padding-block);
|
|
23
|
-
padding-inline: var(--card-thumbnail-padding-inline);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* Image element — DSL: fixed 4rem square, object-fit contain, no shrink. */
|
|
27
|
-
.ds.card-thumbnail > .image {
|
|
28
|
-
width: var(--card-thumbnail-image-size);
|
|
29
|
-
height: var(--card-thumbnail-image-size);
|
|
30
|
-
max-width: 100%;
|
|
31
|
-
object-fit: contain;
|
|
32
|
-
flex-shrink: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* Content element — grows to fill. */
|
|
36
|
-
.ds.card-thumbnail > .content {
|
|
37
|
-
flex: 1;
|
|
38
|
-
min-width: 0;
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Card/common/Thumbnail/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/usePopup/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/usePopup/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useId, useState, } from "react";
|
|
2
|
-
import { useDelayedToggle } from "../useDelayedToggle/index.js";
|
|
3
|
-
import { useWindowFitment } from "../useWindowFitment/index.js";
|
|
4
|
-
/**
|
|
5
|
-
* Manages the state of a popup.
|
|
6
|
-
* @param isOpen An override for the open state.
|
|
7
|
-
* @param deactivateDelay The delay in milliseconds before setting the flag to false.
|
|
8
|
-
* @param activateDelay The delay in milliseconds before setting the flag to true.
|
|
9
|
-
* @param onEnter A callback to be called when the mouse enters the target element.
|
|
10
|
-
* @param onLeave A callback to be called when the mouse leaves the target element.
|
|
11
|
-
* @param onFocus A callback to be called when the target element is focused.
|
|
12
|
-
* @param onBlur A callback to be called when the target element loses focus.
|
|
13
|
-
* @param onShow A callback to be called when the popup is shown.
|
|
14
|
-
* @param onHide A callback to be called when the popup is hidden.
|
|
15
|
-
* @param closeOnEscape Whether the popup should close when the escape key is pressed. Defaults to true.
|
|
16
|
-
* @param props The props to be passed to the useWindowFitment hook.
|
|
17
|
-
* @returns The current state of the popup, and event handlers for the target element.
|
|
18
|
-
*/
|
|
19
|
-
const usePopup = ({ isOpen: isOpenProp, deactivateDelay, activateDelay, onEnter, onLeave, onFocus, onBlur, onShow, onHide, closeOnEscape = true, ...props }) => {
|
|
20
|
-
const isServer = typeof window === "undefined";
|
|
21
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
22
|
-
const popupId = useId();
|
|
23
|
-
const { flag: isOpenHook, deactivate: close, activate: open, } = useDelayedToggle({
|
|
24
|
-
activateDelay,
|
|
25
|
-
deactivateDelay,
|
|
26
|
-
onActivate: onShow,
|
|
27
|
-
onDeactivate: onHide,
|
|
28
|
-
});
|
|
29
|
-
// Apply open override
|
|
30
|
-
const isOpen = typeof isOpenProp === "boolean" ? isOpenProp : isOpenHook;
|
|
31
|
-
const { targetRef, popupRef, bestPosition, popupPositionStyle } = useWindowFitment({
|
|
32
|
-
...props,
|
|
33
|
-
isOpen: isOpen,
|
|
34
|
-
});
|
|
35
|
-
const handleTriggerFocus = useCallback((event) => {
|
|
36
|
-
if (isServer)
|
|
37
|
-
return;
|
|
38
|
-
setIsFocused(true);
|
|
39
|
-
open(event.nativeEvent);
|
|
40
|
-
if (onFocus)
|
|
41
|
-
onFocus(event);
|
|
42
|
-
}, [open, onFocus, isServer]);
|
|
43
|
-
const handleTriggerBlur = useCallback((event) => {
|
|
44
|
-
if (isServer)
|
|
45
|
-
return;
|
|
46
|
-
setIsFocused(false);
|
|
47
|
-
close(event.nativeEvent);
|
|
48
|
-
if (onBlur)
|
|
49
|
-
onBlur(event);
|
|
50
|
-
}, [close, onBlur, isServer]);
|
|
51
|
-
const isDisabled = useCallback((el) => el?.disabled, []);
|
|
52
|
-
const handleTriggerEnter = useCallback((event) => {
|
|
53
|
-
if (isServer || isDisabled(event.target))
|
|
54
|
-
return;
|
|
55
|
-
open(event.nativeEvent);
|
|
56
|
-
if (onEnter)
|
|
57
|
-
onEnter(event);
|
|
58
|
-
}, [open, onEnter, isServer, isDisabled]);
|
|
59
|
-
const handleTriggerLeave = useCallback((event) => {
|
|
60
|
-
if (isServer || isDisabled(event.target))
|
|
61
|
-
return;
|
|
62
|
-
close(event.nativeEvent);
|
|
63
|
-
if (onLeave)
|
|
64
|
-
onLeave(event);
|
|
65
|
-
}, [close, onLeave, isServer, isDisabled]);
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (isServer || !closeOnEscape || !isOpen)
|
|
68
|
-
return;
|
|
69
|
-
const handleEscape = (event) => {
|
|
70
|
-
if (event.key === "Escape")
|
|
71
|
-
close(event);
|
|
72
|
-
};
|
|
73
|
-
document.addEventListener("keydown", handleEscape);
|
|
74
|
-
return () => {
|
|
75
|
-
document.removeEventListener("keydown", handleEscape);
|
|
76
|
-
};
|
|
77
|
-
}, [close, closeOnEscape, isOpen, isServer]);
|
|
78
|
-
return {
|
|
79
|
-
handleTriggerBlur,
|
|
80
|
-
handleTriggerEnter,
|
|
81
|
-
handleTriggerFocus,
|
|
82
|
-
handleTriggerLeave,
|
|
83
|
-
isFocused,
|
|
84
|
-
isOpen,
|
|
85
|
-
popupId,
|
|
86
|
-
popupRef,
|
|
87
|
-
targetRef,
|
|
88
|
-
bestPosition,
|
|
89
|
-
popupPositionStyle,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export default usePopup;
|
|
93
|
-
//# sourceMappingURL=usePopup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePopup.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/usePopup/usePopup.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const rtl = () => (Story) => (_jsx("div", { dir: "rtl", children: _jsx(Story, {}) }));
|
|
3
|
-
export const grid = () => (Story) => (_jsx("div", { style: {
|
|
4
|
-
display: "grid",
|
|
5
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(300px, 1fr))",
|
|
6
|
-
gap: "1em",
|
|
7
|
-
}, children: _jsx(Story, {}) }));
|
|
8
|
-
/**
|
|
9
|
-
* Places the story before a `<main>` element. This is useful for stories that need to be placed before the rest of the page contents in reading order (such as a skip link).
|
|
10
|
-
* @param id - The id of the main element
|
|
11
|
-
* @param children - Content to be rendered inside the main element
|
|
12
|
-
* @TODO this is the first decorator that seems like it may deserve a complex props object, and thus a separate Type.
|
|
13
|
-
* Should the type be declared separately? Should this be a separate file? Should the decorator be simplified somehow?
|
|
14
|
-
*/
|
|
15
|
-
export const beforeMain = ({ id = "main", children }) => (Story) => (_jsxs(_Fragment, { children: [_jsx(Story, {}), _jsx("main", { id: id, tabIndex: -1, children: children })] }));
|
|
16
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/storybook/decorators.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,CAC/C,cAAK,GAAG,EAAC,KAAK,YACZ,KAAC,KAAK,KAAG,GACL,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,CAChD,cACE,KAAK,EAAE;QACL,OAAO,EAAE,MAAM;QACf,mBAAmB,EAAE,sCAAsC;QAC3D,GAAG,EAAE,KAAK;KACX,YAED,KAAC,KAAK,KAAG,GACL,CACP,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GACrB,CAAC,EAAE,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAyC,EAAE,EAAE,CACrE,CAAC,KAAkB,EAAE,EAAE,CAAC,CACtB,8BACE,KAAC,KAAK,KAAG,EACT,eAAM,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,YACvB,QAAQ,GACJ,IACN,CACJ,CAAC"}
|