@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,13 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Content, Header } from "./common/index.js";
|
|
3
3
|
import "./styles.css";
|
|
4
|
-
|
|
4
|
+
// The Tile always provides a surface: it establishes its own `.surface`
|
|
5
|
+
// context (so its background and foreground channels resolve, and step when
|
|
6
|
+
// nested), unlike the Card which is not a surface.
|
|
7
|
+
const componentCssClassName = "ds tile surface";
|
|
5
8
|
/**
|
|
6
9
|
* The tile component is a flexible surface used to group related information
|
|
7
10
|
* and actions into a single, recognizable unit. It acts as a container that
|
|
8
11
|
* creates a clear boundary between different pieces of content, making complex
|
|
9
12
|
* layouts easier to scan and organize.
|
|
10
13
|
*
|
|
14
|
+
* `import { Tile } from "@canonical/react-ds-global";`
|
|
15
|
+
*
|
|
11
16
|
* @implements ds:global.component.tile
|
|
12
17
|
*/
|
|
13
18
|
const Tile = ({ children, className, ...props }) => (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tile/Tile.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"Tile.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tile/Tile.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,cAAc,CAAC;AAEtB,wEAAwE;AACxE,4EAA4E;AAC5E,mDAAmD;AACnD,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACE,EAAsB,EAAE,CAAC,CACnC,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,YAGR,QAAQ,GACL,CACP,CAAC;AAEF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAEvB,eAAe,IAAI,CAAC"}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tile.Content styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.subcomponent.tile-content
|
|
4
4
|
*
|
|
5
5
|
* DSL anatomy mapping:
|
|
6
|
-
* - layout.type: stack
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
6
|
+
* - layout.type: stack, layout.direction: vertical -> flex column
|
|
7
|
+
* - spacing.padding.top: dimension/100, spacing.padding.bottom: dimension/200,
|
|
8
|
+
* spacing.internal.horizontal: dimension/200 -> top 100, bottom 200,
|
|
9
|
+
* sides 200. With a header above (padding-bottom 100), the two sections read
|
|
10
|
+
* as top 100 / sides 200 / bottom 200 with the sections meeting in between.
|
|
9
11
|
*/
|
|
12
|
+
:root {
|
|
13
|
+
--tile-content-padding-top: var(--dimension-100);
|
|
14
|
+
--tile-content-padding-bottom: var(--dimension-200);
|
|
15
|
+
--tile-content-padding-inline: var(--dimension-200);
|
|
16
|
+
--tile-content-gap: var(--dimension-100);
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
.ds.tile-content {
|
|
11
|
-
/* layout.type: stack, layout.direction: vertical */
|
|
12
20
|
display: flex;
|
|
13
21
|
flex-direction: column;
|
|
22
|
+
gap: var(--tile-content-gap);
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
padding: var(--tile-content-padding
|
|
17
|
-
|
|
24
|
+
padding-block-start: var(--tile-content-padding-top);
|
|
25
|
+
padding-block-end: var(--tile-content-padding-bottom);
|
|
26
|
+
padding-inline: var(--tile-content-padding-inline);
|
|
18
27
|
}
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tile.Header styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.subcomponent.tile-header
|
|
4
4
|
*
|
|
5
5
|
* DSL anatomy mapping:
|
|
6
|
-
* - layout.type: flow ->
|
|
7
|
-
* - layout.direction: horizontal -> flex-direction: row
|
|
6
|
+
* - layout.type: flow, layout.direction: horizontal -> flex row
|
|
8
7
|
* - layout.align: center -> align-items: center
|
|
9
|
-
* - spacing.internal:
|
|
8
|
+
* - spacing.internal.vertical: dimension/100, spacing.internal.horizontal:
|
|
9
|
+
* dimension/200 -> padding 100 (block) / 200 (inline). The header's block
|
|
10
|
+
* padding is 100 top and bottom; the content below adds its own top padding.
|
|
10
11
|
*/
|
|
12
|
+
:root {
|
|
13
|
+
--tile-header-padding-block: var(--dimension-100);
|
|
14
|
+
--tile-header-padding-inline: var(--dimension-200);
|
|
15
|
+
--tile-header-gap: var(--dimension-100);
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
.ds.tile-header {
|
|
12
|
-
/* layout.type: flow, layout.direction: horizontal */
|
|
13
19
|
display: flex;
|
|
14
20
|
flex-direction: row;
|
|
15
|
-
|
|
16
|
-
/* layout.align: center */
|
|
17
21
|
align-items: center;
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
padding: var(--tile-header-padding
|
|
21
|
-
gap: var(--tile-header-gap
|
|
23
|
+
padding-block: var(--tile-header-padding-block);
|
|
24
|
+
padding-inline: var(--tile-header-padding-inline);
|
|
25
|
+
gap: var(--tile-header-gap);
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
font-weight: var(--tile-header-font-weight, var(--font-weight-semibold, 600));
|
|
27
|
+
font-weight: var(--typography-weight-semibold, 600);
|
|
25
28
|
}
|
|
@@ -1,66 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tile styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.component.tile
|
|
4
|
+
*
|
|
5
|
+
* The Tile always provides a surface: the component adds `.surface`, so the
|
|
6
|
+
* surface channel is established on this element (and steps when tiles/surfaces
|
|
7
|
+
* nest). It paints that background so it stands out on the page (dashboards,
|
|
8
|
+
* bento layouts). It shares the Card radius and has no border of its own. It is
|
|
9
|
+
* a static container — no cursor, hover, or focus affordance.
|
|
4
10
|
*
|
|
5
11
|
* DSL anatomy mapping:
|
|
6
|
-
* - layout.type: stack
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* - appearance.background: color/surface/tile -> background: var(--color-surface-tile)
|
|
10
|
-
* - appearance.radius: radius/tile -> border-radius: var(--radius-tile)
|
|
12
|
+
* - layout.type: stack, layout.direction: vertical -> flex column
|
|
13
|
+
* - appearance.background: color/surface/tile -> the surface background channel
|
|
14
|
+
* - appearance.radius: radius/card -> shared card radius (--dimension-radius-medium)
|
|
11
15
|
*/
|
|
16
|
+
:root {
|
|
17
|
+
/* Shared with Card. --dimension-radius-medium is currently 0; intended 9. */
|
|
18
|
+
--tile-border-radius: var(--dimension-radius-medium);
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
.ds.tile {
|
|
13
|
-
/* layout.type: stack, layout.direction: vertical */
|
|
14
22
|
display: flex;
|
|
15
23
|
flex-direction: column;
|
|
16
24
|
|
|
17
|
-
/*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/* appearance.background: color/surface/tile */
|
|
21
|
-
background: var(
|
|
22
|
-
--tile-background,
|
|
23
|
-
var(--color-surface-tile, var(--color-surface, #fff))
|
|
24
|
-
);
|
|
25
|
+
/* Tile is a surface: it paints its own background (stands out on the page). */
|
|
26
|
+
background: var(--surface-color-background, var(--color-background));
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
border-radius: var(
|
|
28
|
-
--tile-border-radius,
|
|
29
|
-
var(--radius-tile, var(--border-radius, 0.5rem))
|
|
30
|
-
);
|
|
28
|
+
border-radius: var(--tile-border-radius);
|
|
31
29
|
|
|
32
|
-
/*
|
|
33
|
-
border: var(--tile-border-width, 1px) var(--tile-border-style, solid)
|
|
34
|
-
var(--tile-border-color, var(--color-border, #e0e0e0));
|
|
35
|
-
box-shadow: var(
|
|
36
|
-
--tile-box-shadow,
|
|
37
|
-
var(--shadow-small, 0 1px 3px rgba(0, 0, 0, 0.1))
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
/* Transition for hover effect */
|
|
41
|
-
transition:
|
|
42
|
-
box-shadow var(--transition-duration-fast, 150ms)
|
|
43
|
-
var(--transition-easing-standard, ease-out),
|
|
44
|
-
border-color var(--transition-duration-fast, 150ms)
|
|
45
|
-
var(--transition-easing-standard, ease-out);
|
|
46
|
-
|
|
47
|
-
/* Prevent overflow */
|
|
30
|
+
/* Clip section corners (e.g. full-bleed content) to the tile radius. */
|
|
48
31
|
overflow: hidden;
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
box-shadow: var(
|
|
52
|
-
--tile-box-shadow-hover,
|
|
53
|
-
var(--shadow-medium, 0 4px 6px rgba(0, 0, 0, 0.1))
|
|
54
|
-
);
|
|
55
|
-
border-color: var(
|
|
56
|
-
--tile-border-color-hover,
|
|
57
|
-
var(--color-border-hover, #bdbdbd)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&:focus-visible {
|
|
62
|
-
outline: var(--focus-outline-width, 2px) solid
|
|
63
|
-
var(--focus-outline-color, var(--color-focus, #0066cc));
|
|
64
|
-
outline-offset: var(--focus-outline-offset, 2px);
|
|
65
|
-
}
|
|
66
32
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./styles.css";
|
|
3
|
-
|
|
3
|
+
// The `contrasted` surface makes the tooltip invert against the ambient theme
|
|
4
|
+
// for greater contrast against its context.
|
|
5
|
+
const componentCssClassName = "ds tooltip contrasted";
|
|
4
6
|
/**
|
|
5
7
|
* The Tooltip component renders the message part of a tooltip. It has no
|
|
6
8
|
* interactivity or positioning logic and is generally consumed via
|
|
@@ -8,12 +10,12 @@ const componentCssClassName = "ds tooltip";
|
|
|
8
10
|
*
|
|
9
11
|
* @implements ds:global.component.tooltip
|
|
10
12
|
*/
|
|
11
|
-
const Tooltip = ({ id, children, className, style, ref, isOpen = false, zIndex, onPointerEnter, onFocus, }) => {
|
|
13
|
+
const Tooltip = ({ id, children, icon, className, style, ref, isOpen = false, zIndex, onPointerEnter, onFocus, }) => {
|
|
12
14
|
return (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ref: ref, id: id, "aria-hidden": !isOpen, onPointerEnter: onPointerEnter, onFocus: onFocus, role: "tooltip", style: {
|
|
13
15
|
...style,
|
|
14
16
|
visibility: isOpen ? "visible" : "hidden",
|
|
15
17
|
zIndex,
|
|
16
|
-
}, children: children }));
|
|
18
|
+
}, children: _jsxs("span", { className: "content", children: [icon ? (_jsx("span", { className: "icon", "aria-hidden": "true", children: icon })) : null, _jsx("span", { className: "text", children: children })] }) }));
|
|
17
19
|
};
|
|
18
20
|
export default Tooltip;
|
|
19
21
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AACA,OAAO,cAAc,CAAC;AAGtB,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AACA,OAAO,cAAc,CAAC;AAGtB,8EAA8E;AAC9E,4CAA4C;AAC5C,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,OAAO,GAAG,CAAC,EACf,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,EACL,GAAG,EACH,MAAM,GAAG,KAAK,EACd,MAAM,EACN,cAAc,EACd,OAAO,GACM,EAAsB,EAAE;IACrC,OAAO,CACL,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,iBACO,CAAC,MAAM,EACpB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,SAAS,EACd,KAAK,EAAE;YACL,GAAG,KAAK;YACR,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YACzC,MAAM;SACP,YAID,gBAAM,SAAS,EAAC,SAAS,aAEtB,IAAI,CAAC,CAAC,CAAC,CACN,eAAM,SAAS,EAAC,MAAM,iBAAa,MAAM,YACtC,IAAI,GACA,CACR,CAAC,CAAC,CAAC,IAAI,EACR,eAAM,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAQ,IACnC,GACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,40 +1,62 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useState, } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useDisclosure } from "../../../../hooks/index.js";
|
|
3
5
|
import { Tooltip } from "../../index.js";
|
|
4
6
|
import "./styles.css";
|
|
5
|
-
import { createPortal } from "react-dom";
|
|
6
7
|
const componentCssClassName = "ds tooltip-area";
|
|
7
8
|
/**
|
|
8
9
|
* Wraps a target element with a tooltip.
|
|
9
10
|
* This component allows you to attach a tooltip to any JSX fragment.
|
|
10
11
|
*/
|
|
11
|
-
const TooltipArea = ({ children, style, className, Message, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
|
|
12
|
-
const { targetRef, popupRef, popupPositionStyle, popupId, isOpen,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const TooltipArea = ({ children, style, className, Message, icon, open, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
|
|
13
|
+
const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, bestPosition, arrowOffset, getToggleProps, getContentProps,
|
|
14
|
+
// `open` is the public alias for the hook's controlled `isOpen`; when set it
|
|
15
|
+
// overrides hover/focus so the tooltip stays in the given state.
|
|
16
|
+
} = useDisclosure({
|
|
17
|
+
distance,
|
|
18
|
+
autoFit,
|
|
19
|
+
...props,
|
|
20
|
+
isOpen: open ?? props.isOpen,
|
|
21
|
+
mode: "hover",
|
|
22
|
+
});
|
|
23
|
+
const triggerProps = getToggleProps();
|
|
24
|
+
const contentProps = getContentProps();
|
|
25
|
+
// The message is portalled to the client only. Rendering it on the server (or
|
|
26
|
+
// on the first client render) would differ from the post-mount portal output
|
|
27
|
+
// and force a hydration mismatch + full re-mount — which resets the fitment
|
|
28
|
+
// refs to null and re-triggers the unpositioned first frame. Deferring to a
|
|
29
|
+
// `mounted` gate makes the server and first client render identical (nothing
|
|
30
|
+
// at the call site); the tooltip mounts once, cleanly, after hydration.
|
|
31
|
+
const [mounted, setMounted] = useState(false);
|
|
32
|
+
useEffect(() => setMounted(true), []);
|
|
33
|
+
// The always-on arrow offset keeps the arrow pointing at the target centre
|
|
34
|
+
// for every placement, not only when auto-fit clamps.
|
|
35
|
+
const arrowStyle = arrowOffset
|
|
36
|
+
? {
|
|
37
|
+
[arrowOffset.axis === "x"
|
|
38
|
+
? "--tooltip-arrow-offset-left"
|
|
39
|
+
: "--tooltip-arrow-offset-top"]: `${arrowOffset.offset}px`,
|
|
40
|
+
}
|
|
41
|
+
: {};
|
|
42
|
+
const TooltipMessageElement = (_jsx(Tooltip, { id: popupId, className: [bestPosition?.positionName, messageElementClassName]
|
|
18
43
|
.filter(Boolean)
|
|
19
|
-
.join(" "),
|
|
44
|
+
.join(" "), icon: icon, onPointerEnter: contentProps.onPointerEnter, ref: popupRef, style: {
|
|
20
45
|
...messageElementStyle,
|
|
21
46
|
...popupPositionStyle,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
...arrowStyle,
|
|
48
|
+
},
|
|
49
|
+
// Reveal only once a position has been resolved. Until `bestPosition`
|
|
50
|
+
// exists the popup would render at the fallback top:0/left:0 with no
|
|
51
|
+
// placement class (and so no arrow); gating the reveal on it means that
|
|
52
|
+
// unpositioned frame stays `visibility:hidden` and never paints — no
|
|
53
|
+
// visible 0,0 flash, and the open fade always runs from an anchored spot.
|
|
54
|
+
isOpen: isOpen && Boolean(bestPosition), children: Message }));
|
|
30
55
|
return (
|
|
31
|
-
// biome-ignore lint/a11y/noStaticElementInteractions:
|
|
32
|
-
_jsxs("span", { className: [componentCssClassName, className].filter(Boolean).join(" "), style: style, onFocus:
|
|
33
|
-
?
|
|
34
|
-
|
|
35
|
-
// overflown by the tooltip message.
|
|
36
|
-
createPortal(TooltipMessageElement, parentElement || document.body)
|
|
37
|
-
: TooltipMessageElement] }));
|
|
56
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: the wrapper forwards pointer/focus to the tooltip trigger
|
|
57
|
+
_jsxs("span", { className: [componentCssClassName, className].filter(Boolean).join(" "), style: style, onFocus: triggerProps.onFocus, onBlur: triggerProps.onBlur, onPointerEnter: triggerProps.onPointerEnter, onPointerLeave: triggerProps.onPointerLeave, children: [_jsx("span", { id: targetElementId, style: targetElementStyle, className: ["target", targetElementClassName].filter(Boolean).join(" "), ref: targetRef, "aria-describedby": popupId, children: children }), mounted
|
|
58
|
+
? createPortal(TooltipMessageElement, parentElement || document.body)
|
|
59
|
+
: null] }));
|
|
38
60
|
};
|
|
39
61
|
export default TooltipArea;
|
|
40
62
|
//# sourceMappingURL=TooltipArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipArea.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TooltipArea.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
/* Component tokens — sourced from @canonical/design-tokens
|
|
1
|
+
/* Component tokens — sourced from @canonical/design-tokens.
|
|
2
|
+
The tooltip runs on the `contrasted` surface so its colours invert against
|
|
3
|
+
the ambient theme (dark chip on a light UI, light chip on a dark UI). The
|
|
4
|
+
surface channels (--surface-color-*) are read directly on the .contrasted
|
|
5
|
+
element below, NOT via a :root intermediate (which would see them unset and
|
|
6
|
+
fall back to the base colour). */
|
|
2
7
|
:root {
|
|
3
|
-
/*
|
|
4
|
-
TODO the tooltip's color tokens should be inverted from the active color theme.
|
|
5
|
-
This is to provide greater color contrast against its context.
|
|
6
|
-
This will be implemented once theming DS-wide is added.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
--tooltip-color-background: var(--color-foreground-ghost);
|
|
10
|
-
--tooltip-color-background-hover: var(--color-foreground-ghost-hover);
|
|
11
|
-
--tooltip-color-background-active: var(--color-foreground-ghost-active);
|
|
12
|
-
--tooltip-color-text: var(--color-text);
|
|
13
|
-
--tooltip-color-border: var(--color-border-high-contrast);
|
|
14
|
-
--tooltip-color-border-hover: var(--tooltip-color-border);
|
|
15
|
-
--tooltip-color-border-active: var(--tooltip-color-border);
|
|
16
|
-
|
|
17
8
|
--tooltip-border-radius: 0;
|
|
18
9
|
--tooltip-margin-left: 0;
|
|
19
10
|
--tooltip-margin-bottom: 0;
|
|
20
|
-
|
|
21
|
-
--tooltip-padding-
|
|
22
|
-
--tooltip-
|
|
23
|
-
--tooltip-
|
|
11
|
+
/* Figma: py = dimension-100 (8px), px = dimension-200 (16px). */
|
|
12
|
+
--tooltip-padding-vertical: var(--dimension-100);
|
|
13
|
+
--tooltip-padding-horizontal: var(--dimension-200);
|
|
14
|
+
--tooltip-border-width: 0;
|
|
15
|
+
/* Figma: text-secondary (14px / 20px line-height). */
|
|
16
|
+
--tooltip-font-size: var(--font-size-small, 14px);
|
|
24
17
|
--tooltip-font-weight: var(--font-weight-default);
|
|
25
|
-
--tooltip-line-height: var(--line-height-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
--tooltip-line-height: var(--line-height-small, 20px);
|
|
19
|
+
--tooltip-max-width: 284px;
|
|
20
|
+
/* Gap between an optional leading icon and the text (dimension-100). */
|
|
21
|
+
--tooltip-gap: var(--dimension-100);
|
|
22
|
+
|
|
23
|
+
/* Arrow geometry, independent of `distance` (the gap to the trigger).
|
|
24
|
+
Figma: 14px base (dimension-175) across the edge, 8px depth pointing out. */
|
|
25
|
+
--tooltip-arrow-width: var(--dimension-175, 14px);
|
|
26
|
+
--tooltip-arrow-depth: var(--dimension-100, 8px);
|
|
27
|
+
|
|
28
|
+
/* Duration of the open/close fade. */
|
|
29
|
+
--tooltip-motion-duration: 0.1s;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/* component variables
|
|
31
33
|
--tooltip-color-background: background color of the tooltip
|
|
32
|
-
--tooltip-color-background-hover: background color of the tooltip on hover
|
|
33
|
-
--tooltip-color-background-active: background color of the tooltip on active
|
|
34
34
|
--tooltip-color-text: text color of the tooltip
|
|
35
35
|
--tooltip-color-border: border color of the tooltip
|
|
36
|
-
--tooltip-color-border-hover: border color of the tooltip on hover
|
|
37
|
-
--tooltip-color-border-active: border color of the tooltip on active
|
|
38
36
|
|
|
39
37
|
--tooltip-margin-left: left margin of the tooltip
|
|
40
38
|
--tooltip-margin-bottom: bottom margin of the tooltip
|
|
@@ -44,32 +42,39 @@
|
|
|
44
42
|
--tooltip-font-weight: font weight of the tooltip
|
|
45
43
|
--tooltip-line-height: line height of the tooltip
|
|
46
44
|
|
|
47
|
-
--tooltip-spacing-arrow-size: size of the arrow
|
|
45
|
+
--tooltip-spacing-arrow-size: size of the arrow (independent of `distance`)
|
|
48
46
|
|
|
49
|
-
--tooltip-arrow-offset-left: offset of the arrow
|
|
50
|
-
--tooltip-arrow-offset-top: offset of the arrow
|
|
47
|
+
--tooltip-arrow-offset-left: offset of the arrow along the x-axis (top/bottom placements)
|
|
48
|
+
--tooltip-arrow-offset-top: offset of the arrow along the y-axis (left/right placements)
|
|
51
49
|
*/
|
|
52
50
|
|
|
53
51
|
.ds.tooltip {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
--tooltip-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
transparent;
|
|
60
|
-
|
|
61
|
-
color: var(
|
|
62
|
-
--modifier-color-text,
|
|
63
|
-
var(--tooltip-color-text, var(--color-text-default))
|
|
64
|
-
);
|
|
65
|
-
background-color: var(
|
|
66
|
-
--modifier-color-foreground-ghost,
|
|
67
|
-
var(--tooltip-color-background, var(--color-background-default))
|
|
68
|
-
);
|
|
69
|
-
border-color: var(
|
|
70
|
-
--modifier-color-border,
|
|
71
|
-
var(--tooltip-color-border, transparent)
|
|
52
|
+
/* The tooltip's own background colour, read from the contrasted surface on
|
|
53
|
+
this element (so the arrow, which reuses it, is coloured correctly too). */
|
|
54
|
+
--tooltip-color-background: var(
|
|
55
|
+
--surface-color-background,
|
|
56
|
+
var(--color-background)
|
|
72
57
|
);
|
|
58
|
+
--tooltip-color-text: var(--surface-color-text, var(--color-text));
|
|
59
|
+
|
|
60
|
+
/* Figma arrow: 14px across the edge (base), 8px deep (point). The base is
|
|
61
|
+
built from two half-width transparent borders; the depth from the coloured
|
|
62
|
+
border on the pointing side. */
|
|
63
|
+
--tooltip-arrow-half-width: calc(var(--tooltip-arrow-width) / 2);
|
|
64
|
+
/* Centre of the edge. `left`/`top` positions the ZERO-width pseudo-element's
|
|
65
|
+
origin, but its two half-width side borders render the triangle from that
|
|
66
|
+
origin OUTWARD, so the visible apex sits half-a-width past `left`. To centre
|
|
67
|
+
the apex on the box we therefore pull the origin back by half-width:
|
|
68
|
+
`50% - half-width`. (Verified by pixel measurement: plain `50%` renders the
|
|
69
|
+
apex +7px off-centre.) The magnetic offset then shifts from this centre. */
|
|
70
|
+
--tooltip-arrow-middle: calc(50% - var(--tooltip-arrow-half-width));
|
|
71
|
+
--tooltip-arrow-edge: calc(-1 * var(--tooltip-arrow-depth));
|
|
72
|
+
--tooltip-arrow-offset-left: 0px;
|
|
73
|
+
--tooltip-arrow-offset-top: 0px;
|
|
74
|
+
|
|
75
|
+
color: var(--tooltip-color-text);
|
|
76
|
+
background-color: var(--tooltip-color-background);
|
|
77
|
+
border-color: var(--tooltip-color-background);
|
|
73
78
|
border-style: solid;
|
|
74
79
|
border-radius: var(--tooltip-border-radius);
|
|
75
80
|
border-width: var(--tooltip-border-width, 1px);
|
|
@@ -80,70 +85,130 @@
|
|
|
80
85
|
margin-inline-end: var(--tooltip-margin-left, 0);
|
|
81
86
|
padding-block: var(--tooltip-padding-vertical, 5px);
|
|
82
87
|
padding-inline: var(--tooltip-padding-horizontal, 10px);
|
|
83
|
-
white-space: pre;
|
|
84
88
|
text-align: left;
|
|
85
89
|
text-decoration: initial;
|
|
86
90
|
pointer-events: auto;
|
|
91
|
+
/* The box stays `inline-block` — it is the positioning context for the arrow
|
|
92
|
+
`::before`, and its `50%` centring must resolve against this box. The
|
|
93
|
+
icon+text layout lives in an inner `.content` flex row so the pseudo-element
|
|
94
|
+
is never a flex item (which would shift the arrow and reserve gap for it). */
|
|
87
95
|
display: inline-block;
|
|
88
|
-
|
|
96
|
+
max-width: var(--tooltip-max-width);
|
|
89
97
|
position: fixed;
|
|
90
|
-
|
|
98
|
+
/* MUST stay `visible`: the arrow is a `::before` positioned just outside the
|
|
99
|
+
box (e.g. bottom: -8px). Any `overflow: auto | hidden | clip` clips it and
|
|
100
|
+
the triangle disappears entirely. */
|
|
101
|
+
overflow: visible;
|
|
102
|
+
|
|
103
|
+
/* Inner row: optional leading icon before the text, top-aligned with the
|
|
104
|
+
first line (Figma). Without an icon it is just the text. */
|
|
105
|
+
& > .content {
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
gap: var(--tooltip-gap);
|
|
109
|
+
}
|
|
91
110
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
/* Leading icon: fixed 16px box, top-aligned with the first text line, purely
|
|
112
|
+
decorative (the text carries the meaning). */
|
|
113
|
+
& .icon {
|
|
114
|
+
flex: 0 0 auto;
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
inline-size: var(--dimension-200, 16px);
|
|
119
|
+
block-size: var(--tooltip-line-height, 20px);
|
|
120
|
+
|
|
121
|
+
& > svg {
|
|
122
|
+
inline-size: var(--dimension-200, 16px);
|
|
123
|
+
block-size: var(--dimension-200, 16px);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* The text wraps at max-width (Figma shows multi-line) while honouring any
|
|
128
|
+
explicit newlines in the message. */
|
|
129
|
+
& .text {
|
|
130
|
+
white-space: pre-wrap;
|
|
96
131
|
}
|
|
97
132
|
|
|
133
|
+
/*
|
|
134
|
+
CSS-only enter/exit animation. `allow-discrete` lets `visibility` (a discrete
|
|
135
|
+
property) transition alongside `opacity`, and `@starting-style` gives the
|
|
136
|
+
opening frame a starting opacity so the fade-in runs. No JavaScript timing.
|
|
137
|
+
*/
|
|
138
|
+
opacity: 0;
|
|
139
|
+
visibility: hidden;
|
|
140
|
+
transition:
|
|
141
|
+
opacity var(--tooltip-motion-duration) ease-in-out,
|
|
142
|
+
visibility var(--tooltip-motion-duration) allow-discrete;
|
|
143
|
+
|
|
98
144
|
&[aria-hidden="false"] {
|
|
99
145
|
opacity: 1;
|
|
100
146
|
pointer-events: auto;
|
|
101
147
|
visibility: visible;
|
|
148
|
+
|
|
149
|
+
@starting-style {
|
|
150
|
+
opacity: 0;
|
|
151
|
+
}
|
|
102
152
|
}
|
|
103
153
|
|
|
104
|
-
|
|
154
|
+
&[aria-hidden="true"] {
|
|
155
|
+
opacity: 0;
|
|
156
|
+
pointer-events: none;
|
|
157
|
+
visibility: hidden;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@media (prefers-reduced-motion: reduce) {
|
|
161
|
+
transition: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/*
|
|
165
|
+
The arrow is a CSS border-triangle: 14px across the edge (two
|
|
166
|
+
half-width transparent borders) and 8px deep (the coloured border on the
|
|
167
|
+
pointing side). The always-on offset shifts it along the edge so the tip
|
|
168
|
+
stays pinned to the trigger centre for every placement — including after a
|
|
169
|
+
resize or scroll reposition (the offset is recomputed live).
|
|
170
|
+
*/
|
|
105
171
|
&::before {
|
|
106
172
|
content: "";
|
|
107
173
|
width: 0;
|
|
108
174
|
height: 0;
|
|
109
|
-
border: var(--tooltip-border-arrow-hidden);
|
|
110
175
|
position: absolute;
|
|
176
|
+
transform: translateX(var(--tooltip-arrow-offset-left))
|
|
177
|
+
translateY(var(--tooltip-arrow-offset-top));
|
|
111
178
|
}
|
|
112
179
|
|
|
113
|
-
|
|
114
|
-
&::before {
|
|
115
|
-
transform: translateX(var(--tooltip-arrow-offset-left))
|
|
116
|
-
translateY(var(--tooltip-arrow-offset-top));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
180
|
+
/* Placed above the trigger → arrow points down, on the tooltip's bottom edge. */
|
|
120
181
|
&.top::before {
|
|
121
|
-
border-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
&.right::before {
|
|
126
|
-
border-right: var(--tooltip-border-arrow-visible);
|
|
127
|
-
left: var(--tooltip-spacing-arrow-edge);
|
|
182
|
+
border-inline: var(--tooltip-arrow-half-width) solid transparent;
|
|
183
|
+
border-top: var(--tooltip-arrow-depth) solid var(--tooltip-color-background);
|
|
184
|
+
bottom: var(--tooltip-arrow-edge);
|
|
185
|
+
left: var(--tooltip-arrow-middle);
|
|
128
186
|
}
|
|
129
187
|
|
|
188
|
+
/* Placed below → arrow points up, on the top edge. */
|
|
130
189
|
&.bottom::before {
|
|
131
|
-
border-
|
|
132
|
-
|
|
190
|
+
border-inline: var(--tooltip-arrow-half-width) solid transparent;
|
|
191
|
+
border-bottom: var(--tooltip-arrow-depth) solid
|
|
192
|
+
var(--tooltip-color-background);
|
|
193
|
+
top: var(--tooltip-arrow-edge);
|
|
194
|
+
left: var(--tooltip-arrow-middle);
|
|
133
195
|
}
|
|
134
196
|
|
|
197
|
+
/* Placed left → arrow points right, on the right edge. */
|
|
135
198
|
&.left::before {
|
|
136
|
-
border-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
&.bottom::before {
|
|
142
|
-
left: var(--tooltip-spacing-arrow-middle);
|
|
199
|
+
border-block: var(--tooltip-arrow-half-width) solid transparent;
|
|
200
|
+
border-left: var(--tooltip-arrow-depth) solid
|
|
201
|
+
var(--tooltip-color-background);
|
|
202
|
+
right: var(--tooltip-arrow-edge);
|
|
203
|
+
top: var(--tooltip-arrow-middle);
|
|
143
204
|
}
|
|
144
205
|
|
|
145
|
-
|
|
206
|
+
/* Placed right → arrow points left, on the left edge. */
|
|
146
207
|
&.right::before {
|
|
147
|
-
|
|
208
|
+
border-block: var(--tooltip-arrow-half-width) solid transparent;
|
|
209
|
+
border-right: var(--tooltip-arrow-depth) solid
|
|
210
|
+
var(--tooltip-color-background);
|
|
211
|
+
left: var(--tooltip-arrow-edge);
|
|
212
|
+
top: var(--tooltip-arrow-middle);
|
|
148
213
|
}
|
|
149
214
|
}
|
|
@@ -4,11 +4,11 @@ import { TooltipArea } from "./common/TooltipArea/index.js";
|
|
|
4
4
|
* A higher-order component that wraps a component with a tooltip.
|
|
5
5
|
* @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
6
|
* @param Message The content of the tooltip
|
|
7
|
-
* @param popupProps
|
|
7
|
+
* @param popupProps Tooltip options forwarded to the underlying `TooltipArea`
|
|
8
8
|
*/
|
|
9
9
|
const withTooltip = (Component, Message, popupProps = {}) => {
|
|
10
|
-
const WrappedComponent = (props
|
|
11
|
-
return (_jsx(TooltipArea, { Message: Message, ...popupProps, children: _jsx(Component, { ...props
|
|
10
|
+
const WrappedComponent = (props) => {
|
|
11
|
+
return (_jsx(TooltipArea, { Message: Message, ...popupProps, children: _jsx(Component, { ...props }) }));
|
|
12
12
|
};
|
|
13
13
|
// Set the displayName for easier debugging
|
|
14
14
|
WrappedComponent.displayName = `withTooltip(${Component.displayName || Component.name || "Component"})`;
|