@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAW5D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAClB,SAAgC,EAChC,OAAkB,EAClB,aAAiC,EAAE,EACvB,EAAE;IACd,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAwB,EAAE;QAC/D,OAAO,CACL,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,KAAM,UAAU,YAC3C,KAAC,SAAS,OAAK,KAAK,GAAI,GACZ,CACf,CAAC;IACJ,CAAC,CAAC;IAEF,2CAA2C;IAC3C,gBAAgB,CAAC,WAAW,GAAG,eAC7B,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAC7C,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// ds:Component tier barrel: the standalone global components.
|
|
2
|
+
export * from "./Accordion/index.js";
|
|
3
|
+
export * from "./Announcement/index.js";
|
|
4
|
+
export * from "./Badge/index.js";
|
|
5
|
+
export * from "./Breadcrumbs/index.js";
|
|
6
|
+
export * from "./Button/index.js";
|
|
7
|
+
export * from "./Card/index.js";
|
|
8
|
+
export * from "./Chip/index.js";
|
|
9
|
+
export * from "./ContextualMenu/index.js";
|
|
10
|
+
export * from "./Icon/index.js";
|
|
11
|
+
export * from "./InlineCode/index.js";
|
|
12
|
+
export * from "./KeyboardKey/index.js";
|
|
13
|
+
export * from "./Popover/index.js";
|
|
14
|
+
export * from "./Tabs/index.js";
|
|
15
|
+
export * from "./Tile/index.js";
|
|
16
|
+
export * from "./Tooltip/index.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/component/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,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 @@ const componentCssClassName = "ds keyboard-keys";
|
|
|
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
|
const KeyboardKeys = ({ className, children, ...props }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardKeys.js","sourceRoot":"","sources":["../../../../../src/lib/group/KeyboardKeys/KeyboardKeys.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"KeyboardKeys.js","sourceRoot":"","sources":["../../../../../src/lib/group/KeyboardKeys/KeyboardKeys.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACU,EAAsB,EAAE;IAC1C,OAAO,CACL,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/group/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,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.js","sourceRoot":"","sources":["../../../../src/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","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.js","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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { getMenuProps as getMenuAriaProps, getMenuGroupProps, getMenuItemProps, useNavigationTree, } from "@canonical/react-hooks";
|
|
2
|
+
import { createCrossGroupStateReducer, getFirstEnabledLeaf, } from "@canonical/utils";
|
|
3
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
4
|
+
import { useDisclosure } from "../useDisclosure/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Drives a contextual menu: a click-triggered, positioned popup listing grouped
|
|
7
|
+
* menu items with full keyboard support.
|
|
8
|
+
*
|
|
9
|
+
* Positioning, open state, outside-click and Escape dismissal come from
|
|
10
|
+
* {@link useDisclosure} in `click` mode. Roving focus, type-ahead, and ARIA
|
|
11
|
+
* wiring come from `useNavigationTree`. Vertical arrow keys cross group
|
|
12
|
+
* boundaries through a `stateReducer`, so the shared navigation machinery stays
|
|
13
|
+
* menu-agnostic.
|
|
14
|
+
*
|
|
15
|
+
* @param root The menu tree (menu -> group -> item).
|
|
16
|
+
* @param wrap Whether arrow keys wrap at the first/last item.
|
|
17
|
+
* @param typeAheadTimeout Type-ahead reset timeout in milliseconds.
|
|
18
|
+
* @param props Forwarded to the underlying disclosure (positioning, callbacks).
|
|
19
|
+
* @returns The open state, positioning, and menu prop-getters.
|
|
20
|
+
*/
|
|
21
|
+
const useContextualMenu = ({ root, wrap = false, typeAheadTimeout, ...props }) => {
|
|
22
|
+
const { isOpen, open, close, toggle, targetRef, popupRef, popupPositionStyle, popupId, bestPosition, arrowOffset, getToggleProps: getDisclosureToggleProps, } = useDisclosure({ ...props, mode: "click" });
|
|
23
|
+
// The cross-group reducer operates on state.highlightedItems (the tree's own
|
|
24
|
+
// instances), so it needs no external index — avoiding the instance mismatch
|
|
25
|
+
// that a separately-annotated tree would introduce.
|
|
26
|
+
const stateReducer = useMemo(() => createCrossGroupStateReducer(), []);
|
|
27
|
+
const nav = useNavigationTree({
|
|
28
|
+
root,
|
|
29
|
+
focus: "roving",
|
|
30
|
+
wrap,
|
|
31
|
+
typeAheadTimeout,
|
|
32
|
+
// The cross-group boundary rule lives here, not in the shared reducer.
|
|
33
|
+
stateReducer,
|
|
34
|
+
});
|
|
35
|
+
// The disclosure owns the open state (it drives positioning and dismissal);
|
|
36
|
+
// mirror it into the navigation tree so roving focus follows open/close. On
|
|
37
|
+
// open, highlight the first enabled LEAF (a real menuitem) rather than letting
|
|
38
|
+
// the shared reducer's OPEN land on the first child — which, for the menu's
|
|
39
|
+
// root -> group -> item tree, is a structural GROUP. Without a highlighted
|
|
40
|
+
// menuitem no item gets the roving `tabindex="0"` and arrow keys have no
|
|
41
|
+
// current item to move from, so keyboard navigation is dead.
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
nav.openMenu();
|
|
45
|
+
const firstLeaf = getFirstEnabledLeaf(nav.annotatedRoot);
|
|
46
|
+
if (firstLeaf)
|
|
47
|
+
nav.highlightItem(firstLeaf);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
nav.closeMenu();
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
isOpen,
|
|
54
|
+
nav.openMenu,
|
|
55
|
+
nav.closeMenu,
|
|
56
|
+
nav.highlightItem,
|
|
57
|
+
nav.annotatedRoot,
|
|
58
|
+
]);
|
|
59
|
+
// Move DOM focus into the menu when it opens so arrow keys reach the roving
|
|
60
|
+
// keyboard handler (WAI-ARIA menu button: opening focuses the first item).
|
|
61
|
+
// Fires only on open; the double rAF waits for the popup to render and the
|
|
62
|
+
// roving `tabindex="0"` to be applied before focus lands.
|
|
63
|
+
// @note Impure — moves DOM focus.
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (typeof window === "undefined" || !isOpen)
|
|
66
|
+
return;
|
|
67
|
+
const menu = popupRef.current;
|
|
68
|
+
if (!menu)
|
|
69
|
+
return;
|
|
70
|
+
const focusMenu = () => {
|
|
71
|
+
const firstItem = menu.querySelector('[role="menuitem"]:not([aria-disabled="true"])');
|
|
72
|
+
// Prefer the first enabled menuitem; fall back to the menu container,
|
|
73
|
+
// which carries the keyboard handler.
|
|
74
|
+
(firstItem ?? menu).focus();
|
|
75
|
+
};
|
|
76
|
+
const id = requestAnimationFrame(() => requestAnimationFrame(focusMenu));
|
|
77
|
+
return () => cancelAnimationFrame(id);
|
|
78
|
+
}, [isOpen, popupRef]);
|
|
79
|
+
// Keep DOM focus on the currently-highlighted item as the keyboard highlight
|
|
80
|
+
// moves. The tree only updates the roving `tabindex`; without moving focus too
|
|
81
|
+
// the new item is not scrolled into view — so navigating to an item below a
|
|
82
|
+
// long menu's fold would move the highlight to an item that stays off-screen.
|
|
83
|
+
// Focusing it (menu + submenus are portalled, so search the whole document)
|
|
84
|
+
// scrolls it into view natively. Guarded so it only runs while focus is
|
|
85
|
+
// already inside a menu (never steals focus when the menu is not in use).
|
|
86
|
+
// @note Impure — moves DOM focus.
|
|
87
|
+
const highlightedTail = nav.highlightedItems.at(-1);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (typeof window === "undefined" || !isOpen || !highlightedTail)
|
|
90
|
+
return;
|
|
91
|
+
const active = document.activeElement;
|
|
92
|
+
const focusWithinMenu = active instanceof HTMLElement && active.closest('[role="menu"]') !== null;
|
|
93
|
+
if (!focusWithinMenu)
|
|
94
|
+
return;
|
|
95
|
+
const id = requestAnimationFrame(() => {
|
|
96
|
+
const item = document.querySelector('[role="menuitem"][tabindex="0"]');
|
|
97
|
+
if (item && item !== document.activeElement) {
|
|
98
|
+
item.focus();
|
|
99
|
+
item.scrollIntoView({ block: "nearest" });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return () => cancelAnimationFrame(id);
|
|
103
|
+
}, [isOpen, highlightedTail]);
|
|
104
|
+
// The trigger must drive the DISCLOSURE (the source of truth for open) while
|
|
105
|
+
// keeping the disclosure's click/keyboard handlers. The tree's toggle is not
|
|
106
|
+
// used for open/close here.
|
|
107
|
+
const getTriggerProps = useCallback(() => ({
|
|
108
|
+
"aria-haspopup": "menu",
|
|
109
|
+
"aria-expanded": isOpen,
|
|
110
|
+
"aria-controls": popupId,
|
|
111
|
+
...getDisclosureToggleProps(),
|
|
112
|
+
}), [isOpen, popupId, getDisclosureToggleProps]);
|
|
113
|
+
// Bridge the tree's keyboard handling to the disclosure, which owns the open
|
|
114
|
+
// state. Escape and Tab close the menu and return focus to the trigger (WCAG /
|
|
115
|
+
// WAI-ARIA menu pattern); every other key (arrows, Home/End, type-ahead,
|
|
116
|
+
// Enter) is delegated to the navigation tree.
|
|
117
|
+
const handleMenuKeyDown = useCallback((event, treeKeyDown) => {
|
|
118
|
+
if (event.key === "Escape" || event.key === "Tab") {
|
|
119
|
+
// Tab must not move focus to the next control while the menu is open.
|
|
120
|
+
if (event.key === "Tab")
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
close();
|
|
123
|
+
// @note Impure — returns focus to the trigger.
|
|
124
|
+
targetRef.current?.focus();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
treeKeyDown?.(event);
|
|
128
|
+
}, [close, targetRef]);
|
|
129
|
+
// Menu-role ARIA getters, composing the base navigation prop-getters (for
|
|
130
|
+
// roving tabindex + refs) with the contextual-menu ARIA presets.
|
|
131
|
+
const getMenuProps = useCallback((opts) => {
|
|
132
|
+
const baseProps = nav.getMenuProps(opts?.ref ? { ref: opts.ref } : undefined);
|
|
133
|
+
const treeKeyDown = baseProps.onKeyDown;
|
|
134
|
+
// No `aria-modal`: it is only valid on modal dialog roles, not `role=
|
|
135
|
+
// "menu"`. The menu-button pattern (haspopup + expanded + Escape/Tab
|
|
136
|
+
// dismissal) already conveys the semantics.
|
|
137
|
+
return {
|
|
138
|
+
...baseProps,
|
|
139
|
+
...getMenuAriaProps(nav, opts),
|
|
140
|
+
onKeyDown: (event) => handleMenuKeyDown(event, treeKeyDown),
|
|
141
|
+
};
|
|
142
|
+
}, [nav, handleMenuKeyDown]);
|
|
143
|
+
const getGroupProps = useCallback((opts) => getMenuGroupProps(nav, opts), [nav]);
|
|
144
|
+
const getItemProps = useCallback((item) => ({
|
|
145
|
+
...nav.getItemProps(item),
|
|
146
|
+
...getMenuItemProps(nav, item),
|
|
147
|
+
}), [nav]);
|
|
148
|
+
return {
|
|
149
|
+
isOpen,
|
|
150
|
+
open,
|
|
151
|
+
close,
|
|
152
|
+
toggle,
|
|
153
|
+
targetRef,
|
|
154
|
+
popupRef,
|
|
155
|
+
popupPositionStyle,
|
|
156
|
+
popupId,
|
|
157
|
+
bestPosition,
|
|
158
|
+
arrowOffset,
|
|
159
|
+
annotatedRoot: nav.annotatedRoot,
|
|
160
|
+
index: nav.index,
|
|
161
|
+
highlightedItems: nav.highlightedItems,
|
|
162
|
+
highlightItem: nav.highlightItem,
|
|
163
|
+
selectItem: nav.selectItem,
|
|
164
|
+
// `getNodeStatus(P).inHighlightedBranch` is true when the keyboard path
|
|
165
|
+
// descends through P — i.e. P's submenu is the open one. The render layer
|
|
166
|
+
// uses it to decide which submenus to show.
|
|
167
|
+
getNodeStatus: nav.getNodeStatus,
|
|
168
|
+
getTriggerProps,
|
|
169
|
+
getMenuProps,
|
|
170
|
+
getGroupProps,
|
|
171
|
+
getItemProps,
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
export default useContextualMenu;
|
|
175
|
+
//# sourceMappingURL=useContextualMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextualMenu.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/useContextualMenu.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,IAAI,gBAAgB,EAChC,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,iBAAiB,GAAG,CAAC,EACzB,IAAI,EACJ,IAAI,GAAG,KAAK,EACZ,gBAAgB,EAChB,GAAG,KAAK,EACe,EAA2B,EAAE;IACpD,MAAM,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,cAAc,EAAE,wBAAwB,GACzC,GAAG,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAE/C,6EAA6E;IAC7E,6EAA6E;IAC7E,oDAAoD;IACpD,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,4BAA4B,EAAY,EAC9C,EAAE,CACH,CAAC;IAEF,MAAM,GAAG,GAAG,iBAAiB,CAAW;QACtC,IAAI;QACJ,KAAK,EAAE,QAAQ;QACf,IAAI;QACJ,gBAAgB;QAChB,uEAAuE;QACvE,YAAY;KACb,CAAC,CAAC;IAEH,4EAA4E;IAC5E,4EAA4E;IAC5E,+EAA+E;IAC/E,4EAA4E;IAC5E,2EAA2E;IAC3E,yEAAyE;IACzE,6DAA6D;IAC7D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,EAAE,CAAC;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C,IAAI,CAAC;QACzB,GAAG,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC;KAC/B,CAAC,EACF,CAAC,GAAG,CAAC,CACN,CAAC;IAEF,OAAO;QACL,MAAM;QACN,IAAI;QACJ,KAAK;QACL,MAAM;QACN,SAAS;QACT,QAAQ;QACR,kBAAkB;QAClB,OAAO;QACP,YAAY;QACZ,WAAW;QACX,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;QACtC,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,wEAAwE;QACxE,0EAA0E;QAC1E,4CAA4C;QAC5C,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,eAAe;QACf,YAAY;QACZ,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,230 @@
|
|
|
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 open state, positioning, and accessibility wiring of a disclosure
|
|
6
|
+
* (a popup revealed by a trigger). The hook is headless and element-agnostic:
|
|
7
|
+
* it renders nothing and returns prop-getters the consumer spreads onto whichever
|
|
8
|
+
* trigger and content elements it chooses to render.
|
|
9
|
+
*
|
|
10
|
+
* In `hover` mode the popup opens on pointer-enter / focus and closes on
|
|
11
|
+
* pointer-leave / blur, with a delay — suited to tooltips. In `click` mode it
|
|
12
|
+
* toggles on click, closes on outside-click and Escape, and returns focus to the
|
|
13
|
+
* trigger on close — suited to popovers, menus, and dropdowns, layered over a
|
|
14
|
+
* native `<details>` or `<button aria-expanded>` baseline.
|
|
15
|
+
*
|
|
16
|
+
* @param mode How the disclosure opens and closes. Defaults to `hover`.
|
|
17
|
+
* @param isOpen An override for the open state; when boolean, the hook is controlled.
|
|
18
|
+
* @param deactivateDelay Delay in milliseconds before closing (`hover` mode).
|
|
19
|
+
* @param activateDelay Delay in milliseconds before opening (`hover` mode).
|
|
20
|
+
* @param onEnter Called when the pointer enters the trigger (`hover` mode).
|
|
21
|
+
* @param onLeave Called when the pointer leaves the trigger (`hover` mode).
|
|
22
|
+
* @param onFocus Called when the trigger is focused.
|
|
23
|
+
* @param onBlur Called when the trigger loses focus.
|
|
24
|
+
* @param onShow Called when the popup is shown.
|
|
25
|
+
* @param onHide Called when the popup is hidden.
|
|
26
|
+
* @param closeOnEscape Whether Escape closes the popup. Defaults to true.
|
|
27
|
+
* @param closeOnOutsideClick Whether an outside pointer-down closes a `click` popup. Defaults to true.
|
|
28
|
+
* @param returnFocus Whether closing a `click` popup returns focus to the trigger. Defaults to true.
|
|
29
|
+
* @param props Forwarded to the useWindowFitment hook.
|
|
30
|
+
* @returns The open state, imperative controls, positioning refs and style, and prop-getters.
|
|
31
|
+
*/
|
|
32
|
+
const useDisclosure = ({ mode = "hover", isOpen: isOpenProp, deactivateDelay, activateDelay, onEnter, onLeave, onFocus, onBlur, onShow, onHide, closeOnEscape = true, closeOnOutsideClick = true, returnFocus = true, ...props }) => {
|
|
33
|
+
const isServer = typeof window === "undefined";
|
|
34
|
+
const isClick = mode === "click";
|
|
35
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
36
|
+
// Click disclosures open/close synchronously; hover disclosures use the timer.
|
|
37
|
+
const [isOpenClick, setIsOpenClick] = useState(false);
|
|
38
|
+
const popupId = useId();
|
|
39
|
+
const { flag: isOpenHover, deactivate: scheduleClose, activate: scheduleOpen, } = useDelayedToggle({
|
|
40
|
+
activateDelay,
|
|
41
|
+
deactivateDelay,
|
|
42
|
+
onActivate: onShow,
|
|
43
|
+
onDeactivate: onHide,
|
|
44
|
+
});
|
|
45
|
+
const isOpenInternal = isClick ? isOpenClick : isOpenHover;
|
|
46
|
+
// A boolean override makes the hook controlled; otherwise the internal state wins.
|
|
47
|
+
const isOpen = typeof isOpenProp === "boolean" ? isOpenProp : isOpenInternal;
|
|
48
|
+
const { targetRef, popupRef, bestPosition, popupPositionStyle, arrowOffset, direction, } = useWindowFitment({
|
|
49
|
+
...props,
|
|
50
|
+
isOpen,
|
|
51
|
+
});
|
|
52
|
+
const open = useCallback(() => {
|
|
53
|
+
if (isServer)
|
|
54
|
+
return;
|
|
55
|
+
if (isClick) {
|
|
56
|
+
setIsOpenClick(true);
|
|
57
|
+
onShow?.();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
scheduleOpen(new Event("open"));
|
|
61
|
+
}
|
|
62
|
+
}, [scheduleOpen, isServer, isClick, onShow]);
|
|
63
|
+
const close = useCallback(() => {
|
|
64
|
+
if (isServer)
|
|
65
|
+
return;
|
|
66
|
+
if (isClick) {
|
|
67
|
+
setIsOpenClick(false);
|
|
68
|
+
onHide?.();
|
|
69
|
+
// Return focus to the trigger whenever a click disclosure closes —
|
|
70
|
+
// outside-click, Escape, toggle, or an explicit close() all route here.
|
|
71
|
+
// @note Impure — moves DOM focus.
|
|
72
|
+
if (returnFocus)
|
|
73
|
+
targetRef.current?.focus();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
scheduleClose(new Event("close"));
|
|
77
|
+
}
|
|
78
|
+
}, [scheduleClose, isServer, isClick, onHide, returnFocus, targetRef]);
|
|
79
|
+
const toggle = useCallback(() => {
|
|
80
|
+
if (isOpen)
|
|
81
|
+
close();
|
|
82
|
+
else
|
|
83
|
+
open();
|
|
84
|
+
}, [isOpen, open, close]);
|
|
85
|
+
const isDisabled = useCallback((el) => el?.disabled, []);
|
|
86
|
+
const handleTriggerEnter = useCallback((event) => {
|
|
87
|
+
if (isServer || isDisabled(event.target))
|
|
88
|
+
return;
|
|
89
|
+
open();
|
|
90
|
+
onEnter?.(event);
|
|
91
|
+
}, [open, onEnter, isServer, isDisabled]);
|
|
92
|
+
const handleTriggerLeave = useCallback((event) => {
|
|
93
|
+
if (isServer || isDisabled(event.target))
|
|
94
|
+
return;
|
|
95
|
+
close();
|
|
96
|
+
onLeave?.(event);
|
|
97
|
+
}, [close, onLeave, isServer, isDisabled]);
|
|
98
|
+
const handleTriggerFocus = useCallback((event) => {
|
|
99
|
+
if (isServer)
|
|
100
|
+
return;
|
|
101
|
+
setIsFocused(true);
|
|
102
|
+
// Focus reveals a hover disclosure (keyboard parity); a click disclosure
|
|
103
|
+
// opens only on an explicit click, so focus alone must not open it.
|
|
104
|
+
if (!isClick)
|
|
105
|
+
open();
|
|
106
|
+
onFocus?.(event);
|
|
107
|
+
}, [open, onFocus, isServer, isClick]);
|
|
108
|
+
const handleTriggerBlur = useCallback((event) => {
|
|
109
|
+
if (isServer)
|
|
110
|
+
return;
|
|
111
|
+
setIsFocused(false);
|
|
112
|
+
if (!isClick)
|
|
113
|
+
close();
|
|
114
|
+
onBlur?.(event);
|
|
115
|
+
}, [close, onBlur, isServer, isClick]);
|
|
116
|
+
const handleTriggerClick = useCallback((event) => {
|
|
117
|
+
if (isServer || isDisabled(event.target))
|
|
118
|
+
return;
|
|
119
|
+
toggle();
|
|
120
|
+
}, [toggle, isServer, isDisabled]);
|
|
121
|
+
const handleTriggerKeyDown = useCallback((event) => {
|
|
122
|
+
if (isServer || !isClick)
|
|
123
|
+
return;
|
|
124
|
+
// Space and Enter activate the trigger; ArrowDown opens the popup so
|
|
125
|
+
// keyboard users can move into it without toggling it shut.
|
|
126
|
+
if (event.key === " " || event.key === "Enter") {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
toggle();
|
|
129
|
+
}
|
|
130
|
+
else if (event.key === "ArrowDown" && !isOpen) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
open();
|
|
133
|
+
}
|
|
134
|
+
}, [isClick, isOpen, toggle, open, isServer]);
|
|
135
|
+
// Close on Escape. `close()` handles return-focus for click disclosures.
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (isServer || !closeOnEscape || !isOpen)
|
|
138
|
+
return;
|
|
139
|
+
const handleEscape = (event) => {
|
|
140
|
+
if (event.key === "Escape")
|
|
141
|
+
close();
|
|
142
|
+
};
|
|
143
|
+
document.addEventListener("keydown", handleEscape);
|
|
144
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
145
|
+
}, [close, closeOnEscape, isOpen, isServer]);
|
|
146
|
+
// Close a click disclosure when a pointer-down lands outside trigger and content.
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (isServer || !isClick || !closeOnOutsideClick || !isOpen)
|
|
149
|
+
return;
|
|
150
|
+
const handlePointerDown = (event) => {
|
|
151
|
+
const node = event.target;
|
|
152
|
+
if (!node)
|
|
153
|
+
return;
|
|
154
|
+
if (targetRef.current?.contains(node) ||
|
|
155
|
+
popupRef.current?.contains(node)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
close();
|
|
159
|
+
};
|
|
160
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
161
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
162
|
+
}, [
|
|
163
|
+
isServer,
|
|
164
|
+
isClick,
|
|
165
|
+
closeOnOutsideClick,
|
|
166
|
+
isOpen,
|
|
167
|
+
close,
|
|
168
|
+
targetRef,
|
|
169
|
+
popupRef,
|
|
170
|
+
]);
|
|
171
|
+
const getToggleProps = useCallback(() => {
|
|
172
|
+
if (isClick) {
|
|
173
|
+
return {
|
|
174
|
+
"aria-expanded": isOpen,
|
|
175
|
+
"aria-controls": popupId,
|
|
176
|
+
onClick: handleTriggerClick,
|
|
177
|
+
onKeyDown: handleTriggerKeyDown,
|
|
178
|
+
onFocus: handleTriggerFocus,
|
|
179
|
+
onBlur: handleTriggerBlur,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
"aria-describedby": popupId,
|
|
184
|
+
onPointerEnter: handleTriggerEnter,
|
|
185
|
+
onPointerLeave: handleTriggerLeave,
|
|
186
|
+
onFocus: handleTriggerFocus,
|
|
187
|
+
onBlur: handleTriggerBlur,
|
|
188
|
+
};
|
|
189
|
+
}, [
|
|
190
|
+
isClick,
|
|
191
|
+
isOpen,
|
|
192
|
+
popupId,
|
|
193
|
+
handleTriggerClick,
|
|
194
|
+
handleTriggerKeyDown,
|
|
195
|
+
handleTriggerEnter,
|
|
196
|
+
handleTriggerLeave,
|
|
197
|
+
handleTriggerFocus,
|
|
198
|
+
handleTriggerBlur,
|
|
199
|
+
]);
|
|
200
|
+
const getContentProps = useCallback(() => {
|
|
201
|
+
const contentProps = {
|
|
202
|
+
id: popupId,
|
|
203
|
+
hidden: !isOpen,
|
|
204
|
+
};
|
|
205
|
+
// Hover popups keep the pointer handlers so moving onto the popup keeps it open.
|
|
206
|
+
if (!isClick) {
|
|
207
|
+
contentProps.onPointerEnter = handleTriggerEnter;
|
|
208
|
+
contentProps.onPointerLeave = handleTriggerLeave;
|
|
209
|
+
}
|
|
210
|
+
return contentProps;
|
|
211
|
+
}, [popupId, isOpen, isClick, handleTriggerEnter, handleTriggerLeave]);
|
|
212
|
+
return {
|
|
213
|
+
isOpen,
|
|
214
|
+
isFocused,
|
|
215
|
+
open,
|
|
216
|
+
close,
|
|
217
|
+
toggle,
|
|
218
|
+
targetRef,
|
|
219
|
+
popupRef,
|
|
220
|
+
popupPositionStyle,
|
|
221
|
+
popupId,
|
|
222
|
+
bestPosition,
|
|
223
|
+
arrowOffset,
|
|
224
|
+
direction,
|
|
225
|
+
getToggleProps,
|
|
226
|
+
getContentProps,
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
export default useDisclosure;
|
|
230
|
+
//# sourceMappingURL=useDisclosure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDisclosure.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/useDisclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAShE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,aAAa,GAAG,CAAC,EACrB,IAAI,GAAG,OAAO,EACd,MAAM,EAAE,UAAU,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,aAAa,GAAG,IAAI,EACpB,mBAAmB,GAAG,IAAI,EAC1B,WAAW,GAAG,IAAI,EAClB,GAAG,KAAK,EACW,EAAuB,EAAE;IAC5C,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC;IACjC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,+EAA+E;IAC/E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IAExB,MAAM,EACJ,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,YAAY,GACvB,GAAG,gBAAgB,CAAC;QACnB,aAAa;QAC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E,OAAO;gBACxB,OAAO,EAAE,kBAAkB;gBAC3B,SAAS,EAAE,oBAAoB;gBAC/B,OAAO,EAAE,kBAAkB;gBAC3B,MAAM,EAAE,iBAAiB;aAC1B,CAAC;QACJ,CAAC;QACD,OAAO;YACL,kBAAkB,EAAE,OAAO;YAC3B,cAAc,EAAE,kBAAkB;YAClC,cAAc,EAAE,kBAAkB;YAClC,OAAO,EAAE,kBAAkB;YAC3B,MAAM,EAAE,iBAAiB;SAC1B,CAAC;IACJ,CAAC,EAAE;QACD,OAAO;QACP,MAAM;QACN,OAAO;QACP,kBAAkB;QAClB,oBAAoB;QACpB,kBAAkB;QAClB,kBAAkB;QAClB,kBAAkB;QAClB,iBAAiB;KAClB,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,WAAW,CAAC,GAA2B,EAAE;QAC/D,MAAM,YAAY,GAA2B;YAC3C,EAAE,EAAE,OAAO;YACX,MAAM,EAAE,CAAC,MAAM;SAChB,CAAC;QACF,iFAAiF;QACjF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,YAAY,CAAC,cAAc,GAAG,kBAAkB,CAAC;YACjD,YAAY,CAAC,cAAc,GAAG,kBAAkB,CAAC;QACnD,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEvE,OAAO;QACL,MAAM;QACN,SAAS;QACT,IAAI;QACJ,KAAK;QACL,MAAM;QACN,SAAS;QACT,QAAQ;QACR,kBAAkB;QAClB,OAAO;QACP,YAAY;QACZ,WAAW;QACX,SAAS;QACT,cAAc;QACd,eAAe;KAChB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useEffect, useLayoutEffect, useState } from "react";
|
|
2
|
+
// `useLayoutEffect` logs a warning on the server ("does nothing on the server"),
|
|
3
|
+
// so fall back to `useEffect` there. On the client we keep the pre-paint
|
|
4
|
+
// measurement so the consumer settles in one pass (no mount-at-0×0 flicker).
|
|
5
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
2
6
|
/**
|
|
3
7
|
* Hook to observe the size of an element.
|
|
8
|
+
*
|
|
9
|
+
* The initial measurement is taken synchronously in a layout effect (before the
|
|
10
|
+
* browser paints), so a consumer that positions itself from this size settles in
|
|
11
|
+
* a single pre-paint pass rather than mounting at 0×0 and visibly jumping into
|
|
12
|
+
* place once the async ResizeObserver first fires. The observer then handles all
|
|
13
|
+
* subsequent size changes.
|
|
4
14
|
* @param element The element to observe.
|
|
5
15
|
* @returns The size of the element.
|
|
6
16
|
*/
|
|
@@ -10,16 +20,36 @@ export default function useResizeObserver(element) {
|
|
|
10
20
|
height: 0,
|
|
11
21
|
});
|
|
12
22
|
const isServer = typeof window === "undefined";
|
|
13
|
-
|
|
23
|
+
useIsomorphicLayoutEffect(() => {
|
|
14
24
|
if (!element || isServer)
|
|
15
25
|
return;
|
|
26
|
+
// Seed the size synchronously before paint so the first committed frame has
|
|
27
|
+
// the real dimensions (avoids the mount-at-0×0 reposition flicker).
|
|
28
|
+
const initial = element.getBoundingClientRect();
|
|
29
|
+
setSize((prev) => prev.width === initial.width && prev.height === initial.height
|
|
30
|
+
? prev
|
|
31
|
+
: { width: initial.width, height: initial.height });
|
|
16
32
|
const observer = new ResizeObserver(([entry]) => {
|
|
17
33
|
if (entry) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
// Report the BORDER-BOX size, to match the layout-effect seed
|
|
35
|
+
// (getBoundingClientRect is border-box) and the positioning math, which
|
|
36
|
+
// reads border-box rects everywhere. `entry.contentRect` excludes
|
|
37
|
+
// padding and border, so using it would report a box narrower by the
|
|
38
|
+
// horizontal padding — which then miscentres anything derived from the
|
|
39
|
+
// width (e.g. the arrow offset lands ~half-a-padding off-centre).
|
|
40
|
+
const border = entry.borderBoxSize?.[0];
|
|
41
|
+
const size = border
|
|
42
|
+
? { width: border.inlineSize, height: border.blockSize }
|
|
43
|
+
: {
|
|
44
|
+
width: element.getBoundingClientRect().width,
|
|
45
|
+
height: element.getBoundingClientRect().height,
|
|
46
|
+
};
|
|
47
|
+
// Skip updates that don't change the dimensions. The observer fires once
|
|
48
|
+
// immediately on observe() with a fresh object; bailing on equal values
|
|
49
|
+
// avoids a redundant re-render (and, downstream, a redundant reposition).
|
|
50
|
+
setSize((prev) => prev.width === size.width && prev.height === size.height
|
|
51
|
+
? prev
|
|
52
|
+
: size);
|
|
23
53
|
}
|
|
24
54
|
});
|
|
25
55
|
observer.observe(element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useResizeObserver/useResizeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useResizeObserver/useResizeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7D,iFAAiF;AACjF,yEAAyE;AACzE,6EAA6E;AAC7E,MAAM,yBAAyB,GAC7B,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,OAAyB;IAEzB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAA0B;QACxD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,OAAO,MA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ACN,CAAC,CAAC,IAAI,CACT,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE1B,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAExB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -32,6 +32,13 @@ export default function useWindowDimensions({ onResize, onScroll, resizeDelay =
|
|
|
32
32
|
}, scrollDelay);
|
|
33
33
|
window.addEventListener("resize", handleResize);
|
|
34
34
|
window.addEventListener("scroll", handleScroll);
|
|
35
|
+
// The visual viewport changes on pinch-zoom (and on-screen keyboards) WITHOUT
|
|
36
|
+
// firing a window `resize`, so anything positioned from viewport bounds would
|
|
37
|
+
// otherwise go stale on zoom. Its `resize`/`scroll` cover that. (Ctrl +/-
|
|
38
|
+
// page zoom already fires the window `resize` above, so it is covered too.)
|
|
39
|
+
const viewport = window.visualViewport;
|
|
40
|
+
viewport?.addEventListener("resize", handleResize);
|
|
41
|
+
viewport?.addEventListener("scroll", handleScroll);
|
|
35
42
|
// Initial trigger in case the values need to be passed immediately after mount
|
|
36
43
|
void handleResize();
|
|
37
44
|
void handleScroll();
|
|
@@ -40,6 +47,8 @@ export default function useWindowDimensions({ onResize, onScroll, resizeDelay =
|
|
|
40
47
|
handleScroll.cancel();
|
|
41
48
|
window.removeEventListener("resize", handleResize);
|
|
42
49
|
window.removeEventListener("scroll", handleScroll);
|
|
50
|
+
viewport?.removeEventListener("resize", handleResize);
|
|
51
|
+
viewport?.removeEventListener("scroll", handleScroll);
|
|
43
52
|
};
|
|
44
53
|
}, [onResize, onScroll, resizeDelay, scrollDelay, result, isServer]);
|
|
45
54
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowDimensions.js","sourceRoot":"","sources":["../../../../../src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