@canonical/react-ds-global 0.29.0 → 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/Accordion.js +2 -0
- package/dist/esm/lib/component/Accordion/Accordion.js.map +1 -1
- 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/Breadcrumbs.js +2 -0
- package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js.map +1 -1
- 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/Icon/Icon.js +3 -0
- package/dist/esm/lib/component/Icon/Icon.js.map +1 -1
- package/dist/esm/lib/component/InlineCode/InlineCode.js +2 -0
- package/dist/esm/lib/component/InlineCode/InlineCode.js.map +1 -1
- package/dist/esm/lib/component/KeyboardKey/KeyboardKey.js +2 -0
- package/dist/esm/lib/component/KeyboardKey/KeyboardKey.js.map +1 -1
- 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/KeyboardKeys/KeyboardKeys.js +3 -0
- package/dist/esm/lib/group/KeyboardKeys/KeyboardKeys.js.map +1 -1
- 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/Accordion/Accordion.d.ts +2 -0
- package/dist/types/lib/component/Accordion/Accordion.d.ts.map +1 -1
- 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 +3 -1
- package/dist/types/lib/component/Breadcrumbs/Breadcrumbs.d.ts.map +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/Icon/Icon.d.ts +3 -0
- package/dist/types/lib/component/Icon/Icon.d.ts.map +1 -1
- package/dist/types/lib/component/InlineCode/InlineCode.d.ts +2 -0
- package/dist/types/lib/component/InlineCode/InlineCode.d.ts.map +1 -1
- package/dist/types/lib/component/KeyboardKey/KeyboardKey.d.ts +2 -0
- package/dist/types/lib/component/KeyboardKey/KeyboardKey.d.ts.map +1 -1
- 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/KeyboardKeys/KeyboardKeys.d.ts +3 -0
- package/dist/types/lib/group/KeyboardKeys/KeyboardKeys.d.ts.map +1 -1
- 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ItemProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
/**
|
|
5
|
+
* Tabs Item — the internal renderer for a single tab. Not a public
|
|
6
|
+
* subcomponent: Tabs iterates `navigationRoot.items` and renders one of these
|
|
7
|
+
* per child.
|
|
8
|
+
*
|
|
9
|
+
* Renders an `<li>` whose content is a link when the item has a `url` (via the
|
|
10
|
+
* `LinkComponent`, default `"a"`) or inert text otherwise — never a button.
|
|
11
|
+
* The active tab is marked `aria-current="page"`.
|
|
12
|
+
*/
|
|
13
|
+
declare const Item: ({ item, active, LinkComponent, }: ItemProps) => React.ReactElement;
|
|
14
|
+
export default Item;
|
|
15
|
+
//# sourceMappingURL=Item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tabs/common/Item/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,IAAI,GAAI,kCAIX,SAAS,KAAG,KAAK,CAAC,YA0BpB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tabs/common/Item/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LinkComponent } from "../../../../types/link.js";
|
|
2
|
+
import type { TabItem } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Props for the internal Tabs Item renderer.
|
|
5
|
+
*
|
|
6
|
+
* Not a public subcomponent — Tabs iterates `navigationRoot.items` and renders
|
|
7
|
+
* one of these per child. Kept internal so router integration lives in one
|
|
8
|
+
* place (the `LinkComponent` on Tabs), mirroring SideNavigation.
|
|
9
|
+
*/
|
|
10
|
+
export interface ItemProps {
|
|
11
|
+
/** The tab's navigation item. */
|
|
12
|
+
item: TabItem;
|
|
13
|
+
/** Whether this tab is the current location (drives `aria-current="page"`). */
|
|
14
|
+
active: boolean;
|
|
15
|
+
/** Component used to render the tab when it is navigable. Defaults to `"a"`. */
|
|
16
|
+
LinkComponent: LinkComponent;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tabs/common/Item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,+EAA+E;IAC/E,MAAM,EAAE,OAAO,CAAC;IAChB,gFAAgF;IAChF,aAAa,EAAE,aAAa,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/component/Tabs/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tabs/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Item } from "@canonical/ds-types";
|
|
2
|
+
import type { HTMLAttributes } from "react";
|
|
3
|
+
import type { LinkComponent } from "../../types/link.js";
|
|
4
|
+
/**
|
|
5
|
+
* A tab, as a WD405 navigation `Item`. A tab strip is flat, so only the
|
|
6
|
+
* top-level fields are used: `url` (destination — a tab without one is inert),
|
|
7
|
+
* `label` (visible text), `key` (identity when there is no url), and
|
|
8
|
+
* `disabled`. Nested `items` are ignored (tabs cannot nest).
|
|
9
|
+
*/
|
|
10
|
+
export interface TabItem extends Item {
|
|
11
|
+
/** CSS class name applied to this tab's `<li>`, in addition to the base classes. */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Props for the Tabs component
|
|
16
|
+
*
|
|
17
|
+
* @implements dso:global.component.tabs
|
|
18
|
+
*/
|
|
19
|
+
export interface TabsProps extends HTMLAttributes<HTMLElement> {
|
|
20
|
+
/**
|
|
21
|
+
* The tab strip, as a root navigation `Item`. Its **direct children**
|
|
22
|
+
* (`navigationRoot.items`) are rendered as tabs; the root node itself is a
|
|
23
|
+
* container and is not rendered.
|
|
24
|
+
*/
|
|
25
|
+
navigationRoot: TabItem;
|
|
26
|
+
/**
|
|
27
|
+
* Component used to render navigable tabs (those with a `url`). Receives
|
|
28
|
+
* `LinkComponentProps`. Defaults to `"a"`. Pass a router `Link` (e.g.
|
|
29
|
+
* `@canonical/router-react`) to integrate with client-side navigation.
|
|
30
|
+
*/
|
|
31
|
+
LinkComponent?: LinkComponent;
|
|
32
|
+
/**
|
|
33
|
+
* Live current location, used to resolve which tab is active. The tab whose
|
|
34
|
+
* `url` matches is marked `aria-current`. Keep it in sync with the consumer's
|
|
35
|
+
* router (e.g. `useRoute().pathname`) so the active tab updates on navigation.
|
|
36
|
+
*/
|
|
37
|
+
currentUrl?: string;
|
|
38
|
+
/** Class applied to the `<ul>` tab list. */
|
|
39
|
+
listClassName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Accessible name for the navigation landmark. Required so assistive tech can
|
|
42
|
+
* distinguish this tab strip from other navigation regions.
|
|
43
|
+
*/
|
|
44
|
+
"aria-label": string;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,OAAQ,SAAQ,IAAI;IACnC,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC5D;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -7,6 +7,8 @@ import "./styles.css";
|
|
|
7
7
|
* creates a clear boundary between different pieces of content, making complex
|
|
8
8
|
* layouts easier to scan and organize.
|
|
9
9
|
*
|
|
10
|
+
* `import { Tile } from "@canonical/react-ds-global";`
|
|
11
|
+
*
|
|
10
12
|
* @implements ds:global.component.tile
|
|
11
13
|
*/
|
|
12
14
|
declare const Tile: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tile/Tile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tile/Tile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAOtB;;;;;;;;;GASG;AACH,QAAA,MAAM,IAAI;wCAIP,SAAS,GAAG,KAAK,CAAC,YAAY;;;;;;;;;CAQhC,CAAC;AAKF,eAAe,IAAI,CAAC"}
|
|
@@ -4,16 +4,15 @@ import type { HeaderProps } from "./common/Header/types.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Props for the Tile component
|
|
6
6
|
*
|
|
7
|
-
* @implements
|
|
7
|
+
* @implements ds:global.component.tile
|
|
8
8
|
*
|
|
9
9
|
* Anatomy (from DSL):
|
|
10
10
|
* - layout.type: stack
|
|
11
11
|
* - layout.direction: vertical
|
|
12
|
-
* -
|
|
13
|
-
* - appearance.
|
|
14
|
-
* - appearance.radius: radius/tile
|
|
12
|
+
* - appearance.background: color/surface/tile (Tile is a surface)
|
|
13
|
+
* - appearance.radius: radius/card (shared with Card)
|
|
15
14
|
* - edges:
|
|
16
|
-
* - [0] tile-header (slotName: header, cardinality: 1)
|
|
15
|
+
* - [0] tile-header (slotName: header, cardinality: 0..1)
|
|
17
16
|
* - [1] tile-content (slotName: default, cardinality: 1)
|
|
18
17
|
*/
|
|
19
18
|
export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC/D;;;OAGG;IACH,QAAQ,EACJ,YAAY,CAAC,WAAW,GAAG,YAAY,CAAC,GACxC,YAAY,CAAC,WAAW,GAAG,YAAY,CAAC,EAAE,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,YAAY,CAAC,GAAG;IACjE,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,YAAY,CAAC;IAC7C,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,CAAC;CAChD,CAAC"}
|
|
@@ -8,6 +8,6 @@ import type { TooltipProps } from "./types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* @implements ds:global.component.tooltip
|
|
10
10
|
*/
|
|
11
|
-
declare const Tooltip: ({ id, children, className, style, ref, isOpen, zIndex, onPointerEnter, onFocus, }: TooltipProps) => React.ReactElement;
|
|
11
|
+
declare const Tooltip: ({ id, children, icon, className, style, ref, isOpen, zIndex, onPointerEnter, onFocus, }: TooltipProps) => React.ReactElement;
|
|
12
12
|
export default Tooltip;
|
|
13
13
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM/C;;;;;;GAMG;AACH,QAAA,MAAM,OAAO,GAAI,yFAWd,YAAY,KAAG,KAAK,CAAC,YA6BvB,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
2
|
import type { TooltipAreaProps } from "./types.js";
|
|
3
3
|
import "./styles.css";
|
|
4
4
|
/**
|
|
5
5
|
* Wraps a target element with a tooltip.
|
|
6
6
|
* This component allows you to attach a tooltip to any JSX fragment.
|
|
7
7
|
*/
|
|
8
|
-
declare const TooltipArea: ({ children, style, className, Message, distance, targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }: TooltipAreaProps) => ReactElement;
|
|
8
|
+
declare const TooltipArea: ({ children, style, className, Message, icon, open, distance, targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }: TooltipAreaProps) => ReactElement;
|
|
9
9
|
export default TooltipArea;
|
|
10
10
|
//# sourceMappingURL=TooltipArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipArea.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TooltipArea.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAGlB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,cAAc,CAAC;AAItB;;;GAGG;AACH,QAAA,MAAM,WAAW,GAAI,4MAgBlB,gBAAgB,KAAG,YAiGrB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import type {
|
|
3
|
-
export interface TooltipAreaProps extends
|
|
2
|
+
import type { UseDisclosureProps } from "../../../../hooks/index.js";
|
|
3
|
+
export interface TooltipAreaProps extends Omit<UseDisclosureProps, "mode"> {
|
|
4
4
|
/**
|
|
5
5
|
* The target element to which the tooltip should be attached.
|
|
6
6
|
* This can be any valid React element.
|
|
@@ -10,6 +10,18 @@ export interface TooltipAreaProps extends UsePopupProps {
|
|
|
10
10
|
* The content of the tooltip. This can be a string or any valid React node.
|
|
11
11
|
*/
|
|
12
12
|
Message: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* An optional leading icon for the tooltip, rendered before the message
|
|
15
|
+
* (Figma: 16px glyph, dimension-100 gap). Purely decorative.
|
|
16
|
+
*/
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Force the tooltip open (or closed), overriding hover/focus. When a boolean
|
|
20
|
+
* is passed the tooltip is fully controlled and ignores pointer/keyboard —
|
|
21
|
+
* useful for stories, visual tests, or driving the tooltip from outside.
|
|
22
|
+
* Leave undefined for the default hover behaviour.
|
|
23
|
+
*/
|
|
24
|
+
open?: boolean;
|
|
13
25
|
/** Styles applied to the tooltip area */
|
|
14
26
|
style?: CSSProperties;
|
|
15
27
|
/** Class name applied to the tooltip area */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACxE;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC,wDAAwD;IACxD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,aAAa,CAAC;IACpC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC;CAC7B"}
|
|
@@ -3,6 +3,12 @@ export interface TooltipProps {
|
|
|
3
3
|
id?: string;
|
|
4
4
|
className?: string;
|
|
5
5
|
children: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* An optional leading icon, rendered before the text and top-aligned with the
|
|
8
|
+
* first line (Figma: 16px glyph, dimension-100 gap). Pass any glyph node
|
|
9
|
+
* (e.g. an `<Icon>` or inline SVG).
|
|
10
|
+
*/
|
|
11
|
+
icon?: ReactNode;
|
|
6
12
|
style?: CSSProperties;
|
|
7
13
|
/** Whether the tooltip is open or not */
|
|
8
14
|
isOpen?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAE3B,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAE3B,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACvC,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { ComponentType, FC, ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TooltipAreaProps } from "./common/TooltipArea/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The tooltip options for {@link withTooltip}: everything `TooltipArea` accepts
|
|
5
|
+
* except the wrapped content and the message (which are supplied separately).
|
|
6
|
+
* Includes `open` (force the tooltip open/closed — handy for stories), `icon`,
|
|
7
|
+
* `preferredDirections`, `distance`, `autoFit`, `maxWidth`, timing, etc.
|
|
8
|
+
*/
|
|
9
|
+
export type WithTooltipOptions = Omit<TooltipAreaProps, "children" | "Message">;
|
|
3
10
|
/**
|
|
4
11
|
* A higher-order component that wraps a component with a tooltip.
|
|
5
12
|
* @param Component The component function to wrap. If you need to use a Node instead of a function, use [`TooltipArea`](/?path=/docs/tooltip-withtooltip--docs) instead.
|
|
6
13
|
* @param Message The content of the tooltip
|
|
7
|
-
* @param popupProps
|
|
14
|
+
* @param popupProps Tooltip options forwarded to the underlying `TooltipArea`
|
|
8
15
|
*/
|
|
9
|
-
declare const withTooltip: <TProps extends object>(Component: ComponentType<TProps>, Message: ReactNode, popupProps?:
|
|
16
|
+
declare const withTooltip: <TProps extends object>(Component: ComponentType<TProps>, Message: ReactNode, popupProps?: WithTooltipOptions) => FC<TProps>;
|
|
10
17
|
export default withTooltip;
|
|
11
18
|
//# sourceMappingURL=withTooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"withTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,GAAI,MAAM,SAAS,MAAM,EACxC,WAAW,aAAa,CAAC,MAAM,CAAC,EAChC,SAAS,SAAS,EAClB,aAAY,kBAAuB,KAClC,EAAE,CAAC,MAAM,CAeX,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./Accordion/index.js";
|
|
2
|
+
export * from "./Announcement/index.js";
|
|
3
|
+
export * from "./Badge/index.js";
|
|
4
|
+
export * from "./Breadcrumbs/index.js";
|
|
5
|
+
export * from "./Button/index.js";
|
|
6
|
+
export * from "./Card/index.js";
|
|
7
|
+
export * from "./Chip/index.js";
|
|
8
|
+
export * from "./ContextualMenu/index.js";
|
|
9
|
+
export * from "./Icon/index.js";
|
|
10
|
+
export * from "./InlineCode/index.js";
|
|
11
|
+
export * from "./KeyboardKey/index.js";
|
|
12
|
+
export * from "./Popover/index.js";
|
|
13
|
+
export * from "./Tabs/index.js";
|
|
14
|
+
export * from "./Tile/index.js";
|
|
15
|
+
export * from "./Tooltip/index.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/component/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
|
@@ -13,6 +13,9 @@ import "./styles.css";
|
|
|
13
13
|
* single grouped keystroke.
|
|
14
14
|
*
|
|
15
15
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/kbd#representing_keystrokes_within_an_input
|
|
16
|
+
*
|
|
17
|
+
* `import { KeyboardKeys } from "@canonical/react-ds-global";`
|
|
18
|
+
*
|
|
16
19
|
* @implements dso:global.group.keyboard_keys
|
|
17
20
|
*/
|
|
18
21
|
declare const KeyboardKeys: ({ className, children, ...props }: KeyboardKeysProps) => React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardKeys.d.ts","sourceRoot":"","sources":["../../../../../src/lib/group/KeyboardKeys/KeyboardKeys.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,cAAc,CAAC;AAItB
|
|
1
|
+
{"version":3,"file":"KeyboardKeys.d.ts","sourceRoot":"","sources":["../../../../../src/lib/group/KeyboardKeys/KeyboardKeys.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,YAAY,GAAI,mCAInB,iBAAiB,KAAG,KAAK,CAAC,YAS5B,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/group/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export * from "./useContextualMenu/index.js";
|
|
1
2
|
export * from "./useDelayedToggle/index.js";
|
|
2
|
-
export * from "./
|
|
3
|
+
export * from "./useDisclosure/index.js";
|
|
3
4
|
export * from "./useResizeObserver/index.js";
|
|
4
5
|
export * from "./useWindowDimensions/index.js";
|
|
5
6
|
export * from "./useWindowFitment/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { _Item, Item } from "@canonical/ds-types";
|
|
2
|
+
import type { ItemProps, MenuGroupPropsResult, MenuItemPropsResult, MenuProps, MenuPropsResult, UseNavigationTreeResult } from "@canonical/react-hooks";
|
|
3
|
+
import type { UseDisclosureProps, UseDisclosureResult } from "../useDisclosure/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* A menu item that may carry a right-aligned slot (e.g. a badge or keyboard
|
|
6
|
+
* shortcut) in addition to the base navigation fields. The slot is an optional
|
|
7
|
+
* extension that survives tree annotation.
|
|
8
|
+
*/
|
|
9
|
+
export interface MenuItem extends Item {
|
|
10
|
+
/** Content rendered right-aligned within the item, such as a badge or shortcut. */
|
|
11
|
+
slot?: React.ReactNode;
|
|
12
|
+
/** Icon rendered left of the label. */
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
/** Child items — a group's items, or a future submenu's entries. */
|
|
15
|
+
items?: MenuItem[];
|
|
16
|
+
/** CSS class name applied to this item, in addition to the base classes. */
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Opts this item into rendering via `Component` instead of the default
|
|
20
|
+
* layout. `"custom"` without a `Component` falls back to the default.
|
|
21
|
+
*/
|
|
22
|
+
displayItemsType?: "default" | "custom";
|
|
23
|
+
/** Custom component for rendering this item itself, when `displayItemsType` is `"custom"`. */
|
|
24
|
+
Component?: React.ComponentType<{
|
|
25
|
+
item: MenuItem;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface UseContextualMenuProps extends Omit<UseDisclosureProps, "mode"> {
|
|
29
|
+
/**
|
|
30
|
+
* The menu tree. The root's children are groups; each group's children are
|
|
31
|
+
* the menu items (menu -> group -> item). One level of items is supported now;
|
|
32
|
+
* deeper nesting is reserved for submenus.
|
|
33
|
+
*/
|
|
34
|
+
root: MenuItem;
|
|
35
|
+
/** Whether arrow keys wrap at the first/last item. Defaults to false. */
|
|
36
|
+
wrap?: boolean;
|
|
37
|
+
/** Type-ahead reset timeout in milliseconds. */
|
|
38
|
+
typeAheadTimeout?: number;
|
|
39
|
+
}
|
|
40
|
+
/** Options for the menu/group ARIA prop-getters. */
|
|
41
|
+
export interface MenuAriaOptions {
|
|
42
|
+
/** Accessible name for the element. */
|
|
43
|
+
label?: string;
|
|
44
|
+
/** Id of an element that labels this one. */
|
|
45
|
+
labelledBy?: string;
|
|
46
|
+
/** A ref to compose with the menu's internal keyboard ref (menu container only). */
|
|
47
|
+
ref?: React.Ref<HTMLElement>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The contextual menu combines a click disclosure (open state, positioning,
|
|
51
|
+
* dismissal) with a navigation tree (roving keyboard focus, type-ahead, and
|
|
52
|
+
* cross-group arrow traversal via a `stateReducer`) and menu ARIA wiring.
|
|
53
|
+
*/
|
|
54
|
+
export interface UseContextualMenuResult extends Pick<UseDisclosureResult, "isOpen" | "open" | "close" | "toggle" | "targetRef" | "popupRef" | "popupPositionStyle" | "popupId" | "bestPosition" | "arrowOffset">, Pick<UseNavigationTreeResult<MenuItem>, "annotatedRoot" | "index" | "highlightedItems" | "highlightItem" | "selectItem" | "getNodeStatus"> {
|
|
55
|
+
/**
|
|
56
|
+
* Prop-getter for the menu trigger element. Drives the disclosure (open state,
|
|
57
|
+
* positioning, dismissal) and carries the menu ARIA wiring
|
|
58
|
+
* (`aria-haspopup`/`aria-expanded`/`aria-controls`).
|
|
59
|
+
*/
|
|
60
|
+
getTriggerProps: () => Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Prop-getter for the `role="menu"` container element. Merges the navigation
|
|
63
|
+
* container props (keyboard handler, ref) with the menu ARIA preset.
|
|
64
|
+
*/
|
|
65
|
+
getMenuProps: (opts?: MenuAriaOptions) => MenuProps & MenuPropsResult;
|
|
66
|
+
/** Prop-getter for a `role="group"` element. */
|
|
67
|
+
getGroupProps: (opts?: MenuAriaOptions) => MenuGroupPropsResult;
|
|
68
|
+
/** Prop-getter for a `role="menuitem"` element. */
|
|
69
|
+
getItemProps: (item: _Item<MenuItem>) => ItemProps & MenuItemPropsResult;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,mFAAmF;IACnF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,uCAAuC;IACvC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,oEAAoE;IACpE,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACxC,8FAA8F;IAC9F,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACxC;;;;OAIG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBACf,SAAQ,IAAI,CACR,mBAAmB,EACjB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,SAAS,GACT,cAAc,GACd,aAAa,CAChB,EACD,IAAI,CACF,uBAAuB,CAAC,QAAQ,CAAC,EAC/B,eAAe,GACf,OAAO,GACP,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,eAAe,CAClB;IACH;;;;OAIG;IACH,eAAe,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,SAAS,GAAG,eAAe,CAAC;IACtE,gDAAgD;IAChD,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,oBAAoB,CAAC;IAChE,mDAAmD;IACnD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,SAAS,GAAG,mBAAmB,CAAC;CAC1E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UseContextualMenuProps, UseContextualMenuResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Drives a contextual menu: a click-triggered, positioned popup listing grouped
|
|
4
|
+
* menu items with full keyboard support.
|
|
5
|
+
*
|
|
6
|
+
* Positioning, open state, outside-click and Escape dismissal come from
|
|
7
|
+
* {@link useDisclosure} in `click` mode. Roving focus, type-ahead, and ARIA
|
|
8
|
+
* wiring come from `useNavigationTree`. Vertical arrow keys cross group
|
|
9
|
+
* boundaries through a `stateReducer`, so the shared navigation machinery stays
|
|
10
|
+
* menu-agnostic.
|
|
11
|
+
*
|
|
12
|
+
* @param root The menu tree (menu -> group -> item).
|
|
13
|
+
* @param wrap Whether arrow keys wrap at the first/last item.
|
|
14
|
+
* @param typeAheadTimeout Type-ahead reset timeout in milliseconds.
|
|
15
|
+
* @param props Forwarded to the underlying disclosure (positioning, callbacks).
|
|
16
|
+
* @returns The open state, positioning, and menu prop-getters.
|
|
17
|
+
*/
|
|
18
|
+
declare const useContextualMenu: ({ root, wrap, typeAheadTimeout, ...props }: UseContextualMenuProps) => UseContextualMenuResult;
|
|
19
|
+
export default useContextualMenu;
|
|
20
|
+
//# sourceMappingURL=useContextualMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextualMenu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/useContextualMenu.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAEV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,iBAAiB,GAAI,4CAKxB,sBAAsB,KAAG,uBA0M3B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { CSSProperties, FocusEventHandler, KeyboardEventHandler, PointerEventHandler, RefObject } from "react";
|
|
2
|
+
import type { UseDelayedToggleProps } from "../useDelayedToggle/index.js";
|
|
3
|
+
import type { UseWindowFitmentProps, UseWindowFitmentResult } from "../useWindowFitment/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* How the disclosure is triggered.
|
|
6
|
+
* - `hover`: opens on pointer-enter / focus, closes on pointer-leave / blur,
|
|
7
|
+
* with a delay. Suits tooltips and other non-interactive overlays. There is
|
|
8
|
+
* no native HTML primitive for this; the hook owns the open state.
|
|
9
|
+
* - `click`: toggles on click, closes on outside-click and Escape, and returns
|
|
10
|
+
* focus to the trigger on close. Suits popovers, menus, and dropdowns. This
|
|
11
|
+
* mode is complementary to a native `<details>`/`<summary>` (or a
|
|
12
|
+
* `<button aria-expanded>` + panel), which provides the no-JS baseline while
|
|
13
|
+
* the hook layers on positioning and dismissal after hydration.
|
|
14
|
+
*/
|
|
15
|
+
export type DisclosureMode = "hover" | "click";
|
|
16
|
+
export interface UseDisclosureProps extends UseWindowFitmentProps, UseDelayedToggleProps {
|
|
17
|
+
/** How the disclosure opens and closes. Defaults to `hover`. */
|
|
18
|
+
mode?: DisclosureMode;
|
|
19
|
+
/** An override for the open state. When boolean, the hook is controlled. */
|
|
20
|
+
isOpen?: boolean;
|
|
21
|
+
/** Called when the popup is shown. */
|
|
22
|
+
onShow?: (event?: Event) => void;
|
|
23
|
+
/** Called when the popup is hidden. */
|
|
24
|
+
onHide?: (event?: Event) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the popup closes when the Escape key is pressed. Defaults to true.
|
|
27
|
+
*/
|
|
28
|
+
closeOnEscape?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether a `click` disclosure closes when a pointer-down occurs outside the
|
|
31
|
+
* trigger and content. Ignored in `hover` mode. Defaults to true.
|
|
32
|
+
*/
|
|
33
|
+
closeOnOutsideClick?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a `click` disclosure returns focus to the trigger when it closes.
|
|
36
|
+
* Ignored in `hover` mode. Defaults to true.
|
|
37
|
+
*/
|
|
38
|
+
returnFocus?: boolean;
|
|
39
|
+
/** Called when the pointer enters the trigger (`hover` mode). */
|
|
40
|
+
onEnter?: PointerEventHandler;
|
|
41
|
+
/** Called when the pointer leaves the trigger (`hover` mode). */
|
|
42
|
+
onLeave?: PointerEventHandler;
|
|
43
|
+
/** Called when the trigger is focused. */
|
|
44
|
+
onFocus?: FocusEventHandler;
|
|
45
|
+
/** Called when the trigger loses focus. */
|
|
46
|
+
onBlur?: FocusEventHandler;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Props to spread onto the trigger element. The trigger is whatever the
|
|
50
|
+
* component chooses to render (a `<button>`, a `<summary>`, a `<span>`); the
|
|
51
|
+
* hook stays element-agnostic.
|
|
52
|
+
*/
|
|
53
|
+
export interface DisclosureToggleProps {
|
|
54
|
+
/** Reflects the open state for assistive tech (`click` mode). */
|
|
55
|
+
"aria-expanded"?: boolean;
|
|
56
|
+
/** Points at the content element (`click` mode). */
|
|
57
|
+
"aria-controls"?: string;
|
|
58
|
+
/** Associates the trigger with its description (`hover` mode). */
|
|
59
|
+
"aria-describedby"?: string;
|
|
60
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
61
|
+
onKeyDown?: KeyboardEventHandler;
|
|
62
|
+
onPointerEnter?: PointerEventHandler;
|
|
63
|
+
onPointerLeave?: PointerEventHandler;
|
|
64
|
+
onFocus?: FocusEventHandler;
|
|
65
|
+
onBlur?: FocusEventHandler;
|
|
66
|
+
}
|
|
67
|
+
/** Props to spread onto the content (popup) element. */
|
|
68
|
+
export interface DisclosureContentProps {
|
|
69
|
+
/** Stable id, matched by the trigger's `aria-controls` / `aria-describedby`. */
|
|
70
|
+
id: string;
|
|
71
|
+
/** Hidden from layout and assistive tech while closed. */
|
|
72
|
+
hidden?: boolean;
|
|
73
|
+
onPointerEnter?: PointerEventHandler;
|
|
74
|
+
onPointerLeave?: PointerEventHandler;
|
|
75
|
+
}
|
|
76
|
+
export type DisableableElement = HTMLElement & {
|
|
77
|
+
disabled: boolean;
|
|
78
|
+
};
|
|
79
|
+
export interface UseDisclosureResult extends UseWindowFitmentResult {
|
|
80
|
+
/** Whether the disclosure is currently open. */
|
|
81
|
+
isOpen: boolean;
|
|
82
|
+
/** Whether the trigger is currently focused. */
|
|
83
|
+
isFocused: boolean;
|
|
84
|
+
/** Imperatively open the disclosure. */
|
|
85
|
+
open: () => void;
|
|
86
|
+
/** Imperatively close the disclosure. */
|
|
87
|
+
close: () => void;
|
|
88
|
+
/** Imperatively toggle the disclosure. */
|
|
89
|
+
toggle: () => void;
|
|
90
|
+
/** A ref to attach to the trigger element. */
|
|
91
|
+
targetRef: RefObject<HTMLDivElement | null>;
|
|
92
|
+
/** A ref to attach to the content (popup) element. */
|
|
93
|
+
popupRef: RefObject<HTMLDivElement | null>;
|
|
94
|
+
/** The style object to apply to the content element. */
|
|
95
|
+
popupPositionStyle: CSSProperties;
|
|
96
|
+
/** A stable id for the content element (associates trigger and content). */
|
|
97
|
+
popupId: string;
|
|
98
|
+
/** Prop-getter for the trigger element. */
|
|
99
|
+
getToggleProps: () => DisclosureToggleProps;
|
|
100
|
+
/** Prop-getter for the content (popup) element. */
|
|
101
|
+
getContentProps: () => DisclosureContentProps;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,kBACf,SAAQ,qBAAqB,EAC3B,qBAAqB;IACvB,gEAAgE;IAChE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,iEAAiE;IACjE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,0CAA0C;IAC1C,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,wDAAwD;AACxD,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG;IAC7C,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,gDAAgD;IAChD,MAAM,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,yCAAyC;IACzC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,8CAA8C;IAC9C,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC5C,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,wDAAwD;IACxD,kBAAkB,EAAE,aAAa,CAAC;IAClC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,qBAAqB,CAAC;IAC5C,mDAAmD;IACnD,eAAe,EAAE,MAAM,sBAAsB,CAAC;CAC/C"}
|