@canonical/react-ds-global 0.29.1 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/esm/lib/_work_in_progress/IconSection/IconSection.js +1 -1
- package/dist/esm/lib/_work_in_progress/IconSection/IconSection.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/index.js +13 -0
- package/dist/esm/lib/_work_in_progress/index.js.map +1 -0
- package/dist/esm/lib/component/Accordion/common/Item/styles.css +73 -56
- 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/Badge/styles.css +25 -24
- package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js +13 -3
- package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +17 -5
- package/dist/esm/lib/component/Breadcrumbs/styles.css +3 -0
- package/dist/esm/lib/component/Button/Button.js +13 -6
- package/dist/esm/lib/component/Button/Button.js.map +1 -1
- package/dist/esm/lib/component/Button/styles.css +200 -38
- package/dist/esm/lib/component/Card/Card.js +16 -6
- package/dist/esm/lib/component/Card/Card.js.map +1 -1
- package/dist/esm/lib/component/Card/common/Content/styles.css +8 -4
- package/dist/esm/lib/component/Card/common/Footer/Footer.js +2 -2
- package/dist/esm/lib/component/Card/common/Footer/styles.css +13 -3
- 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 +60 -22
- package/dist/esm/lib/component/Chip/styles.css +3 -0
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +96 -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 +121 -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 +128 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/index.js +2 -0
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/index.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/index.js +2 -0
- package/dist/esm/lib/component/ContextualMenu/index.js.map +1 -0
- package/dist/esm/lib/component/ContextualMenu/styles.css +86 -0
- package/dist/esm/lib/component/ContextualMenu/types.js.map +1 -0
- package/dist/esm/lib/component/Popover/Popover.js +50 -0
- package/dist/esm/lib/component/Popover/Popover.js.map +1 -0
- package/dist/esm/lib/component/Popover/index.js +2 -0
- package/dist/esm/lib/component/Popover/index.js.map +1 -0
- package/dist/esm/lib/component/Popover/styles.css +65 -0
- package/dist/esm/lib/component/Popover/types.js +2 -0
- package/dist/esm/lib/component/Popover/types.js.map +1 -0
- package/dist/esm/lib/component/Tabs/Tabs.js +27 -0
- package/dist/esm/lib/component/Tabs/Tabs.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/Item/Item.js +20 -0
- package/dist/esm/lib/component/Tabs/common/Item/Item.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/Item/index.js +3 -0
- package/dist/esm/lib/component/Tabs/common/Item/index.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +75 -0
- package/dist/esm/lib/component/Tabs/common/Item/types.js +2 -0
- package/dist/esm/lib/component/Tabs/common/Item/types.js.map +1 -0
- package/dist/esm/lib/component/Tabs/common/index.js +2 -0
- package/dist/esm/lib/component/Tabs/common/index.js.map +1 -0
- package/dist/esm/lib/component/Tabs/index.js +3 -0
- package/dist/esm/lib/component/Tabs/index.js.map +1 -0
- package/dist/esm/lib/component/Tabs/styles.css +37 -0
- package/dist/esm/lib/component/Tabs/types.js +2 -0
- package/dist/esm/lib/component/Tabs/types.js.map +1 -0
- package/dist/esm/lib/component/Tile/Tile.js +6 -1
- package/dist/esm/lib/component/Tile/Tile.js.map +1 -1
- package/dist/esm/lib/component/Tile/common/Content/styles.css +17 -8
- package/dist/esm/lib/component/Tile/common/Header/styles.css +15 -12
- package/dist/esm/lib/component/Tile/styles.css +19 -53
- package/dist/esm/lib/component/Tooltip/Tooltip.js +6 -4
- package/dist/esm/lib/component/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js +45 -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/Cards/Cards.js +49 -0
- package/dist/esm/lib/group/Cards/Cards.js.map +1 -0
- package/dist/esm/lib/group/Cards/index.js +3 -0
- package/dist/esm/lib/group/Cards/index.js.map +1 -0
- package/dist/esm/lib/group/Cards/styles.css +55 -0
- package/dist/esm/lib/group/Cards/types.js +2 -0
- package/dist/esm/lib/group/Cards/types.js.map +1 -0
- package/dist/esm/lib/group/index.js +4 -0
- package/dist/esm/lib/group/index.js.map +1 -0
- package/dist/esm/lib/hooks/index.js +3 -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 +181 -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/useIsMounted/index.js +3 -0
- package/dist/esm/lib/hooks/useIsMounted/index.js.map +1 -0
- package/dist/esm/lib/hooks/useIsMounted/types.js +2 -0
- package/dist/esm/lib/hooks/useIsMounted/types.js.map +1 -0
- package/dist/esm/lib/hooks/useIsMounted/useIsMounted.js +21 -0
- package/dist/esm/lib/hooks/useIsMounted/useIsMounted.js.map +1 -0
- package/dist/esm/lib/hooks/useResizeObserver/useResizeObserver.js +37 -7
- package/dist/esm/lib/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +9 -0
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/index.js +1 -0
- package/dist/esm/lib/hooks/useWindowFitment/index.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js +25 -0
- package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js.map +1 -0
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +211 -21
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
- package/dist/esm/lib/index.js +8 -25
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/pattern/index.js +3 -0
- package/dist/esm/lib/pattern/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/Spinner/Spinner.js +35 -0
- package/dist/esm/lib/subcomponent/Spinner/Spinner.js.map +1 -0
- package/dist/esm/lib/subcomponent/Spinner/index.js +2 -0
- package/dist/esm/lib/subcomponent/Spinner/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/Spinner/styles.css +50 -0
- package/dist/esm/lib/subcomponent/Spinner/types.js +2 -0
- package/dist/esm/lib/subcomponent/Spinner/types.js.map +1 -0
- package/dist/esm/lib/subcomponent/index.js +3 -0
- package/dist/esm/lib/subcomponent/index.js.map +1 -0
- package/dist/esm/lib/types/link.js +2 -0
- package/dist/esm/lib/types/link.js.map +1 -0
- package/dist/types/lib/_work_in_progress/Link/types.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/Link/types.d.ts.map +1 -1
- package/dist/types/lib/_work_in_progress/index.d.ts +12 -0
- package/dist/types/lib/_work_in_progress/index.d.ts.map +1 -0
- package/dist/types/lib/component/Announcement/Announcement.d.ts +2 -2
- package/dist/types/lib/component/Announcement/Announcement.d.ts.map +1 -1
- package/dist/types/lib/component/Announcement/index.d.ts.map +1 -1
- package/dist/types/lib/component/Announcement/types.d.ts +17 -6
- package/dist/types/lib/component/Announcement/types.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- 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 +13 -13
- package/dist/types/lib/component/Breadcrumbs/common/Item/types.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/types.d.ts +23 -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 +12 -6
- package/dist/types/lib/component/Button/types.d.ts.map +1 -1
- package/dist/types/lib/component/Card/Card.d.ts +10 -5
- package/dist/types/lib/component/Card/Card.d.ts.map +1 -1
- package/dist/types/lib/component/Card/common/Footer/Footer.d.ts +2 -2
- package/dist/types/lib/component/Card/common/Footer/types.d.ts +2 -2
- package/dist/types/lib/component/Card/common/Footer/types.d.ts.map +1 -1
- package/dist/types/lib/component/Card/common/index.d.ts +0 -1
- package/dist/types/lib/component/Card/common/index.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +15 -0
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts +14 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/index.d.ts +3 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/index.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/types.d.ts +11 -0
- package/dist/types/lib/component/ContextualMenu/common/Item/types.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +19 -0
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +15 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/index.d.ts +2 -0
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/index.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/index.d.ts +3 -0
- package/dist/types/lib/component/ContextualMenu/index.d.ts.map +1 -0
- package/dist/types/lib/component/ContextualMenu/types.d.ts +30 -0
- package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -0
- package/dist/types/lib/component/Popover/Popover.d.ts +16 -0
- package/dist/types/lib/component/Popover/Popover.d.ts.map +1 -0
- package/dist/types/lib/component/Popover/index.d.ts +3 -0
- package/dist/types/lib/component/Popover/index.d.ts.map +1 -0
- package/dist/types/lib/component/Popover/types.d.ts +24 -0
- package/dist/types/lib/component/Popover/types.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/Tabs.d.ts +18 -0
- package/dist/types/lib/component/Tabs/Tabs.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/Item/Item.d.ts +15 -0
- package/dist/types/lib/component/Tabs/common/Item/Item.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/Item/index.d.ts +3 -0
- package/dist/types/lib/component/Tabs/common/Item/index.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/Item/types.d.ts +18 -0
- package/dist/types/lib/component/Tabs/common/Item/types.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/common/index.d.ts +2 -0
- package/dist/types/lib/component/Tabs/common/index.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/index.d.ts +3 -0
- package/dist/types/lib/component/Tabs/index.d.ts.map +1 -0
- package/dist/types/lib/component/Tabs/types.d.ts +46 -0
- package/dist/types/lib/component/Tabs/types.d.ts.map +1 -0
- package/dist/types/lib/component/Tile/Tile.d.ts +2 -0
- package/dist/types/lib/component/Tile/Tile.d.ts.map +1 -1
- package/dist/types/lib/component/Tile/common/Content/types.d.ts +1 -1
- package/dist/types/lib/component/Tile/common/Header/types.d.ts +1 -1
- package/dist/types/lib/component/Tile/types.d.ts +4 -5
- package/dist/types/lib/component/Tile/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/lib/component/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts +1 -1
- 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/Cards/Cards.d.ts +40 -0
- package/dist/types/lib/group/Cards/Cards.d.ts.map +1 -0
- package/dist/types/lib/group/Cards/index.d.ts +3 -0
- package/dist/types/lib/group/Cards/index.d.ts.map +1 -0
- package/dist/types/lib/group/Cards/types.d.ts +14 -0
- package/dist/types/lib/group/Cards/types.d.ts.map +1 -0
- package/dist/types/lib/group/index.d.ts +3 -0
- package/dist/types/lib/group/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/index.d.ts +3 -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/useIsMounted/index.d.ts +3 -0
- package/dist/types/lib/hooks/useIsMounted/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/useIsMounted/types.d.ts +6 -0
- package/dist/types/lib/hooks/useIsMounted/types.d.ts.map +1 -0
- package/dist/types/lib/hooks/useIsMounted/useIsMounted.d.ts +15 -0
- package/dist/types/lib/hooks/useIsMounted/useIsMounted.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,4 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Spinner } from "../../subcomponent/Spinner/index.js";
|
|
3
|
+
import { Icon } from "../Icon/index.js";
|
|
2
4
|
import "./styles.css";
|
|
3
5
|
const componentCssClassName = "ds button";
|
|
4
6
|
/**
|
|
@@ -6,30 +8,35 @@ const componentCssClassName = "ds button";
|
|
|
6
8
|
* data transformation or manipulation. They provide clear visual
|
|
7
9
|
* indicators of the primary actions users can perform.
|
|
8
10
|
*
|
|
11
|
+
* `import { Button } from "@canonical/react-ds-global";`
|
|
12
|
+
*
|
|
9
13
|
* @implements ds:global.component.button
|
|
10
14
|
*/
|
|
11
|
-
const Button = ({ id, className, children, style, importance, anticipation, variant, icon,
|
|
15
|
+
const Button = ({ id, className, children, style, importance = "primary", anticipation, variant, icon, loading = false, disabled, ...props }) => {
|
|
12
16
|
// Booleans and nullish children render nothing; everything else (including
|
|
13
17
|
// the number 0) produces visible text that names the button.
|
|
14
18
|
const hasVisibleChildren = children != null && typeof children !== "boolean" && children !== "";
|
|
15
19
|
if (typeof process !== "undefined" &&
|
|
16
20
|
process.env.NODE_ENV !== "production" &&
|
|
17
|
-
icon &&
|
|
21
|
+
(icon || loading) &&
|
|
18
22
|
!hasVisibleChildren &&
|
|
19
23
|
!props["aria-label"] &&
|
|
20
24
|
!props["aria-labelledby"]) {
|
|
21
25
|
console.warn("Button: icon-only buttons need an explicit `aria-label` or `aria-labelledby` to be accessible.");
|
|
22
26
|
}
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
// The icon slot only accepts a design-system icon name; the Icon component
|
|
28
|
+
// maps it to the @canonical/ds-assets sprite (decorative by default).
|
|
29
|
+
const iconElement = icon && (_jsx("span", { className: "icon", children: _jsx(Icon, { icon: icon }) }));
|
|
30
|
+
return (_jsxs("button", { id: id, className: [
|
|
25
31
|
componentCssClassName,
|
|
26
32
|
importance,
|
|
27
33
|
anticipation,
|
|
28
34
|
variant,
|
|
35
|
+
loading && "loading",
|
|
29
36
|
className,
|
|
30
37
|
]
|
|
31
38
|
.filter(Boolean)
|
|
32
|
-
.join(" "), style: style, ...props, children:
|
|
39
|
+
.join(" "), style: style, "aria-busy": loading || undefined, disabled: disabled || loading, ...props, children: [iconElement, hasVisibleChildren && _jsx("span", { className: "label", children: children }), loading && (_jsx("span", { className: "loading-spinner", "aria-hidden": "true", children: _jsx(Spinner, {}) }))] }));
|
|
33
40
|
};
|
|
34
41
|
export default Button;
|
|
35
42
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,GAAG,SAAS,EACtB,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,kBAAkB,GACtB,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,CAAC;IAEvE,IACE,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QACrC,CAAC,IAAI,IAAI,OAAO,CAAC;QACjB,CAAC,kBAAkB;QACnB,CAAC,KAAK,CAAC,YAAY,CAAC;QACpB,CAAC,KAAK,CAAC,iBAAiB,CAAC,EACzB,CAAC;QACD,OAAO,CAAC,IAAI,CACV,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,sEAAsE;IACtE,MAAM,WAAW,GAAG,IAAI,IAAI,CAC1B,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,GACf,CACR,CAAC;IAEF,OAAO,CACL,kBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE;YACT,qBAAqB;YACrB,UAAU;YACV,YAAY;YACZ,OAAO;YACP,OAAO,IAAI,SAAS;YACpB,SAAS;SACV;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,KAAK,EAAE,KAAK,eAED,OAAO,IAAI,SAAS,EAC/B,QAAQ,EAAE,QAAQ,IAAI,OAAO,KACzB,KAAK,aAMR,WAAW,EACX,kBAAkB,IAAI,eAAM,SAAS,EAAC,OAAO,YAAE,QAAQ,GAAQ,EAC/D,OAAO,IAAI,CACV,eAAM,SAAS,EAAC,iBAAiB,iBAAa,MAAM,YAClD,KAAC,OAAO,KAAG,GACN,CACR,IACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,21 +1,48 @@
|
|
|
1
1
|
/* Component tokens — sourced from @canonical/design-tokens */
|
|
2
2
|
:root {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/* Channel fallbacks used when no importance modifier is applied. Primary is
|
|
4
|
+
the default hierarchy, so a bare `<button class="ds button">` reads as the
|
|
5
|
+
filled primary look: the primary foreground fills the background and the
|
|
6
|
+
label takes the on-fill contrast colour. */
|
|
7
|
+
--button-color-background: var(
|
|
8
|
+
--modifier-color-foreground-primary,
|
|
9
|
+
var(--color-foreground-primary)
|
|
10
|
+
);
|
|
11
|
+
--button-color-background-hover: var(--color-foreground-primary-hover);
|
|
12
|
+
--button-color-background-active: var(--color-foreground-primary-active);
|
|
13
|
+
--button-color-background-disabled: var(--color-foreground-primary-disabled);
|
|
14
|
+
/* Neutral text is the normal text colour. The filled default reads as
|
|
15
|
+
contrast on the fill because `.primary` (the default importance, applied by
|
|
16
|
+
the component) overrides text/icon to the on-fill contrast tokens; ghost
|
|
17
|
+
importances keep this normal colour, so they stay visible. */
|
|
6
18
|
--button-color-text: var(--color-text);
|
|
7
|
-
--button-color-border: var(--color-border-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
--button-
|
|
16
|
-
--button-
|
|
17
|
-
--button-
|
|
18
|
-
--button-
|
|
19
|
+
--button-color-border: var(--color-border-highlighted, var(--color-border));
|
|
20
|
+
|
|
21
|
+
/* Inline padding (Figma):
|
|
22
|
+
- end (right): always dimension-200 (16px) — the label always sits 16px
|
|
23
|
+
from the trailing edge.
|
|
24
|
+
- start (left): dimension-200 (16px) with no icon; dimension-100 (8px) when
|
|
25
|
+
an icon leads (the icon then sits closer to the edge), with a
|
|
26
|
+
dimension-100 (8px) gap between the icon and the label. */
|
|
27
|
+
--button-padding-inline-end: var(--dimension-200);
|
|
28
|
+
--button-padding-inline-start: var(--dimension-200);
|
|
29
|
+
--button-gap: var(--dimension-100);
|
|
30
|
+
--button-border-width: var(--dimension-stroke-thickness-medium);
|
|
31
|
+
/* Label weight — the button label is medium, not the `.p` body weight. */
|
|
32
|
+
--button-font-weight: var(--typography-weight-medium);
|
|
33
|
+
/* Label size — the button label is the text-secondary tier (14px), not the
|
|
34
|
+
`.p` text-primary tier (16px). The line-height snaps up to the baseline
|
|
35
|
+
grid exactly as the typography mapper does, so the box stays 32px tall
|
|
36
|
+
(24px line + 8px of baseline nudges) around 14px text. */
|
|
37
|
+
--button-font-size: var(--typography-text-secondary-font-size);
|
|
38
|
+
--button-line-height: round(
|
|
39
|
+
up,
|
|
40
|
+
calc(
|
|
41
|
+
var(--button-font-size) *
|
|
42
|
+
var(--typography-text-secondary-line-height)
|
|
43
|
+
),
|
|
44
|
+
var(--baseline-height)
|
|
45
|
+
);
|
|
19
46
|
}
|
|
20
47
|
|
|
21
48
|
/* ==========================================================================
|
|
@@ -23,54 +50,105 @@
|
|
|
23
50
|
========================================================================== */
|
|
24
51
|
|
|
25
52
|
/*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
--modifier-
|
|
30
|
-
|
|
31
|
-
--modifier-
|
|
53
|
+
The button reads the modifier CHANNEL generically — it is not aware of any
|
|
54
|
+
particular importance/anticipation class or combination:
|
|
55
|
+
|
|
56
|
+
--modifier-surface which foreground fills the background (importance:
|
|
57
|
+
filled for primary, ghost for secondary/tertiary).
|
|
58
|
+
--modifier-outline 1 when a border shows, 0 when it does not (importance).
|
|
59
|
+
--modifier-color-* the colour itself (anticipation/emphasis): text, icon,
|
|
60
|
+
border. `.primary` overrides text/icon with the on-fill
|
|
61
|
+
contrast tokens.
|
|
62
|
+
|
|
63
|
+
Interaction states read the per-state surface/text/border channels supplied
|
|
64
|
+
by the states shim (`--modifier-surface-{hover,active,disabled}`,
|
|
65
|
+
`--modifier-color-text-disabled`, `--modifier-color-border-disabled`), which
|
|
66
|
+
resolve to the explicit state tokens and recolour per anticipation.
|
|
32
67
|
*/
|
|
33
68
|
|
|
34
69
|
.ds.button {
|
|
70
|
+
position: relative;
|
|
35
71
|
display: inline-flex;
|
|
36
72
|
align-items: center;
|
|
37
73
|
justify-content: center;
|
|
38
|
-
gap: var(--
|
|
74
|
+
gap: var(--button-gap);
|
|
39
75
|
cursor: pointer;
|
|
40
76
|
|
|
41
77
|
color: var(--modifier-color-text, var(--button-color-text));
|
|
42
|
-
background-color: var(
|
|
43
|
-
--modifier-color-foreground-primary,
|
|
44
|
-
var(--button-color-background)
|
|
45
|
-
);
|
|
78
|
+
background-color: var(--modifier-surface, var(--button-color-background));
|
|
46
79
|
border-color: var(--modifier-color-border, var(--button-color-border));
|
|
47
80
|
border-style: solid;
|
|
48
|
-
border
|
|
81
|
+
/* The outline flag (0/1) toggles the border on: multiplying the width means
|
|
82
|
+
a borderless importance simply resolves to 0 with no separate rule. */
|
|
83
|
+
border-width: calc(var(--modifier-outline, 0) * var(--button-border-width));
|
|
49
84
|
|
|
50
|
-
|
|
85
|
+
/* Label typography tokens (text-secondary tier, 14px). The block placement that
|
|
86
|
+
lands the label on the baseline grid comes from the density seat at the end of
|
|
87
|
+
this file (the button no longer carries `.p`, so the engine's on-element nudges
|
|
88
|
+
don't apply — without the seat the label is flat/unaligned). --font-size /
|
|
89
|
+
--line-height are still exposed for any consumer that reads them. */
|
|
90
|
+
--font-size: var(--button-font-size);
|
|
91
|
+
--line-height: var(--button-line-height);
|
|
51
92
|
font-weight: var(--button-font-weight);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
margin-inline-end: var(--button-margin-left);
|
|
55
|
-
padding-block: var(--button-padding-vertical);
|
|
56
|
-
padding-inline: var(--button-padding-horizontal);
|
|
93
|
+
padding-inline: var(--button-padding-inline-start)
|
|
94
|
+
var(--button-padding-inline-end);
|
|
57
95
|
|
|
58
96
|
text-align: center;
|
|
59
97
|
text-decoration: none;
|
|
60
98
|
|
|
99
|
+
/* Fast colour transition on state change (hover/active/disabled). */
|
|
100
|
+
transition:
|
|
101
|
+
background-color var(--motion-duration-fast) var(--motion-easing-standard),
|
|
102
|
+
color var(--motion-duration-fast) var(--motion-easing-standard),
|
|
103
|
+
border-color var(--motion-duration-fast) var(--motion-easing-standard);
|
|
104
|
+
|
|
105
|
+
/* A leading icon tightens the start padding to dimension-100; the gap between
|
|
106
|
+
the icon and label is already dimension-100. */
|
|
107
|
+
&:has(> .icon) {
|
|
108
|
+
--button-padding-inline-start: var(--dimension-100);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* State fallbacks resolve to the default (primary) surface states when no
|
|
112
|
+
importance modifier supplies `--modifier-surface-*`. */
|
|
61
113
|
&:hover:not(:disabled) {
|
|
62
|
-
background-color: var(
|
|
63
|
-
|
|
114
|
+
background-color: var(
|
|
115
|
+
--modifier-surface-hover,
|
|
116
|
+
var(--button-color-background-hover)
|
|
117
|
+
);
|
|
64
118
|
}
|
|
65
119
|
|
|
66
120
|
&:active:not(:disabled) {
|
|
67
|
-
background-color: var(
|
|
68
|
-
|
|
121
|
+
background-color: var(
|
|
122
|
+
--modifier-surface-active,
|
|
123
|
+
var(--button-color-background-active)
|
|
124
|
+
);
|
|
69
125
|
}
|
|
70
126
|
|
|
127
|
+
/* Keyboard focus ring — driven by the modifier focusRing channel so it
|
|
128
|
+
recolours per anticipation; falls back to the base focus ring token. */
|
|
129
|
+
&:focus-visible {
|
|
130
|
+
outline: var(--focus-outline-width, 2px) solid
|
|
131
|
+
var(--modifier-color-focusRing, var(--color-focusRing, currentColor));
|
|
132
|
+
outline-offset: var(--focus-outline-offset, 2px);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Disabled — explicit disabled tokens (not the computed deltas): the surface,
|
|
136
|
+
text and border each resolve to their `-disabled` token. Primary supplies
|
|
137
|
+
the on-fill disabled text via `--modifier-color-text-disabled`; ghost
|
|
138
|
+
importances fall back to the plain disabled text colour. The border reads
|
|
139
|
+
the disabled border channel, so it stays on the same highlighted ramp as
|
|
140
|
+
the enabled border and recolours per anticipation. */
|
|
71
141
|
&:disabled {
|
|
72
142
|
cursor: not-allowed;
|
|
73
|
-
|
|
143
|
+
color: var(--modifier-color-text-disabled, var(--color-text-disabled));
|
|
144
|
+
background-color: var(
|
|
145
|
+
--modifier-surface-disabled,
|
|
146
|
+
var(--button-color-background-disabled)
|
|
147
|
+
);
|
|
148
|
+
border-color: var(
|
|
149
|
+
--modifier-color-border-disabled,
|
|
150
|
+
var(--color-border-highlighted-disabled)
|
|
151
|
+
);
|
|
74
152
|
}
|
|
75
153
|
}
|
|
76
154
|
|
|
@@ -85,6 +163,44 @@
|
|
|
85
163
|
flex-shrink: 0;
|
|
86
164
|
width: var(--icon-size, 1em);
|
|
87
165
|
height: var(--icon-size, 1em);
|
|
166
|
+
|
|
167
|
+
/* The icon has its own colour channel (distinct from the label text): on a
|
|
168
|
+
filled primary it is the on-fill contrast icon, on ghost importances the
|
|
169
|
+
modifier icon colour. Icons drawn with `currentColor` follow this. */
|
|
170
|
+
color: var(--modifier-color-icon, var(--modifier-color-text, currentColor));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.ds.button:disabled > .icon {
|
|
174
|
+
color: var(--modifier-color-icon-disabled, var(--color-icon-disabled));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* ==========================================================================
|
|
178
|
+
Loading State
|
|
179
|
+
========================================================================== */
|
|
180
|
+
|
|
181
|
+
/* Loading replaces the label with a Spinner but keeps the button's width: the
|
|
182
|
+
icon and label stay in the DOM (hidden, so their box still reserves space)
|
|
183
|
+
and the Spinner is overlaid centred on top. A loading button is disabled (so
|
|
184
|
+
it can't be re-triggered), but it must not *read* as disabled — it is
|
|
185
|
+
working, not unavailable — so it keeps the enabled surface, text and border
|
|
186
|
+
colours, overriding the :disabled greying above. */
|
|
187
|
+
.ds.button.loading {
|
|
188
|
+
color: var(--modifier-color-text, var(--button-color-text));
|
|
189
|
+
background-color: var(--modifier-surface, var(--button-color-background));
|
|
190
|
+
border-color: var(--modifier-color-border, var(--button-color-border));
|
|
191
|
+
|
|
192
|
+
& > .icon,
|
|
193
|
+
& > .label {
|
|
194
|
+
visibility: hidden;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
& > .loading-spinner {
|
|
198
|
+
position: absolute;
|
|
199
|
+
inset: 0;
|
|
200
|
+
display: inline-flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
}
|
|
88
204
|
}
|
|
89
205
|
|
|
90
206
|
/* ==========================================================================
|
|
@@ -114,3 +230,49 @@
|
|
|
114
230
|
border-color: transparent;
|
|
115
231
|
}
|
|
116
232
|
}
|
|
233
|
+
|
|
234
|
+
/* ── Density seat (apps 32 / sites 36, dense 24 / 28) ────────────────────────
|
|
235
|
+
* The button consumes the density primitives from @canonical/styles (context ×
|
|
236
|
+
* density on an ancestor) to size its box to the cell and seat its label on the
|
|
237
|
+
* 4px baseline grid. This lives HERE (ds-global) and not in
|
|
238
|
+
* @canonical/react-ds-global-form's density.css, because the Button is a ds-global
|
|
239
|
+
* component: an app that ships ds-global without the form package must still get a
|
|
240
|
+
* seated button, not a flat one. The primitives are read from the shared styles
|
|
241
|
+
* layer, so there is no form dependency.
|
|
242
|
+
*
|
|
243
|
+
* `:is()` on the density scope (0,1,0) so `:is(...) .ds.button` (0,2,0) beats the
|
|
244
|
+
* button's own `.ds.button { align-items: center }` (0,1,0) — otherwise the label
|
|
245
|
+
* stays flex-CENTRED and the padding-based baseline placement can't govern. */
|
|
246
|
+
:is(.comfortable, .dense, .app, .site, .docs) .ds.button {
|
|
247
|
+
box-sizing: border-box;
|
|
248
|
+
/* Fixed grid-multiple height (the density cell), border-box so the border is
|
|
249
|
+
absorbed into the height — a bordered and a borderless button of one density
|
|
250
|
+
are the same height. Top-referenced so the space-before below governs. */
|
|
251
|
+
block-size: var(--density-line-height-effective);
|
|
252
|
+
min-block-size: var(--density-line-height-effective);
|
|
253
|
+
align-items: flex-start;
|
|
254
|
+
justify-content: flex-start;
|
|
255
|
+
/* Kill only the UA bottom padding; the placement below owns padding-block-start
|
|
256
|
+
(a `padding-block: 0` shorthand would out-specify and wipe the start). */
|
|
257
|
+
padding-block-end: 0;
|
|
258
|
+
|
|
259
|
+
/* Crush to line-height:1 for the seat; the baseline within that box is the cap
|
|
260
|
+
approximation (1em + 1cap)/2. The label font tier (--font-size/--font-family)
|
|
261
|
+
is the button's own (text-secondary, 14px), set on the base rule. */
|
|
262
|
+
line-height: 1;
|
|
263
|
+
--natural-baseline: calc((1em + 1cap) / 2);
|
|
264
|
+
/* The box's top border sits above the label and counts toward the target, so
|
|
265
|
+
subtract the NOMINAL --button-border-width for BOTH importances — the primary's
|
|
266
|
+
0-outline (borderless) is handled by the grid maths, not by zeroing this term
|
|
267
|
+
(a per-importance term lifts the primary a pixel; regression, reverted). */
|
|
268
|
+
--border-top-width: var(--button-border-width, 0px);
|
|
269
|
+
--space-before: max(
|
|
270
|
+
0px,
|
|
271
|
+
calc(
|
|
272
|
+
var(--density-target-baseline-px, 0px) -
|
|
273
|
+
var(--natural-baseline) -
|
|
274
|
+
var(--border-top-width, 0px)
|
|
275
|
+
)
|
|
276
|
+
);
|
|
277
|
+
padding-block-start: var(--space-before);
|
|
278
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Content, Footer, Header, Image
|
|
2
|
+
import { Content, Footer, Header, Image } from "./common/index.js";
|
|
3
3
|
import "./styles.css";
|
|
4
|
-
// The Card establishes
|
|
5
|
-
//
|
|
6
|
-
|
|
4
|
+
// The Card is NOT a surface: it establishes no `.surface` context of its own,
|
|
5
|
+
// so on a surface it takes the same background (no step) and reads as flush
|
|
6
|
+
// with its container. It stays delimited by its border, radius, and the
|
|
7
|
+
// dividers between its sections.
|
|
8
|
+
const componentCssClassName = "ds card";
|
|
7
9
|
/**
|
|
8
10
|
* The card is a container that is designed to represent data objects that share
|
|
9
11
|
* the same structure. Unlike the more flexible Tile, a card is designed to have
|
|
@@ -11,13 +13,21 @@ const componentCssClassName = "ds card surface";
|
|
|
11
13
|
* predictable structure that allows the user to compare attributes across data
|
|
12
14
|
* objects.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
16
|
+
* A Card is always a grid participant: `.ds.card` is a ROW SUBGRID that spans
|
|
17
|
+
* four fixed section tracks (image / header / content / footer), inheriting them
|
|
18
|
+
* from its parent grid. Standalone (wrapped in a `.grid`) it lays its own
|
|
19
|
+
* sections out on those tracks; inside a `Cards` group it shares the group's
|
|
20
|
+
* tracks so the same sections line up across every card in the row. See the
|
|
21
|
+
* `Cards` group component for the full layout model.
|
|
22
|
+
*
|
|
23
|
+
* `import { Card } from "@canonical/react-ds-global";`
|
|
24
|
+
*
|
|
25
|
+
* @implements ds:global.component.card
|
|
15
26
|
*/
|
|
16
27
|
const Card = ({ className, children, ...props }) => (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: children }));
|
|
17
28
|
Card.Content = Content;
|
|
18
29
|
Card.Footer = Footer;
|
|
19
30
|
Card.Header = Header;
|
|
20
31
|
Card.Image = Image;
|
|
21
|
-
Card.Thumbnail = Thumbnail;
|
|
22
32
|
export default Card;
|
|
23
33
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../../src/lib/component/Card/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../../src/lib/component/Card/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,iCAAiC;AACjC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,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,YAER,QAAQ,GACL,CACP,CAAC;AAEF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAEnB,eAAe,IAAI,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Card.Content styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.subcomponent.card-content
|
|
4
4
|
*
|
|
5
5
|
* DSL anatomy: layout.type stack, direction vertical.
|
|
6
6
|
* A content-bearing section: it pads itself (the card frame applies no general
|
|
7
|
-
* padding). Vertical padding is in baseline multiples
|
|
7
|
+
* padding). Vertical padding is in baseline multiples, asymmetric per the
|
|
8
|
+
* Figma styling frame: one baseline on top, two below (top 100 / bottom 200 /
|
|
9
|
+
* sides 200).
|
|
8
10
|
*/
|
|
9
11
|
:root {
|
|
10
12
|
--card-content-gap: var(--dimension-100);
|
|
11
|
-
--card-content-padding-block: var(--dimension-
|
|
13
|
+
--card-content-padding-block-start: var(--dimension-100);
|
|
14
|
+
--card-content-padding-block-end: var(--dimension-200);
|
|
12
15
|
--card-content-padding-inline: var(--dimension-200);
|
|
13
16
|
}
|
|
14
17
|
|
|
@@ -17,6 +20,7 @@
|
|
|
17
20
|
flex-direction: column;
|
|
18
21
|
gap: var(--card-content-gap);
|
|
19
22
|
|
|
20
|
-
padding-block: var(--card-content-padding-block);
|
|
23
|
+
padding-block-start: var(--card-content-padding-block-start);
|
|
24
|
+
padding-block-end: var(--card-content-padding-block-end);
|
|
21
25
|
padding-inline: var(--card-content-padding-inline);
|
|
22
26
|
}
|
|
@@ -3,9 +3,9 @@ import "./styles.css";
|
|
|
3
3
|
const componentCssClassName = "ds card-footer";
|
|
4
4
|
/**
|
|
5
5
|
* Footer component for Card. A padded content-bearing section pinned to the
|
|
6
|
-
* bottom of the card, for
|
|
6
|
+
* bottom of the card, for tags and labels.
|
|
7
7
|
*
|
|
8
|
-
* @implements
|
|
8
|
+
* @implements ds:global.subcomponent.card-footer
|
|
9
9
|
*/
|
|
10
10
|
const Footer = ({ children, className, ...props }) => {
|
|
11
11
|
return (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: children }));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Card.Footer styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.subcomponent.card-footer
|
|
4
4
|
*
|
|
5
5
|
* A content-bearing section: it pads itself (the card frame applies no general
|
|
6
|
-
* padding). Vertical padding is in baseline multiples.
|
|
6
|
+
* padding). Vertical padding is in baseline multiples. Holds tags and labels,
|
|
7
|
+
* which flow in a wrapping row.
|
|
7
8
|
*/
|
|
8
9
|
:root {
|
|
9
10
|
--card-footer-gap: var(--dimension-100);
|
|
@@ -12,10 +13,19 @@
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
.ds.card-footer {
|
|
16
|
+
/* Inline flow: badges, chips and inline text sit on a line and wrap. Children
|
|
17
|
+
* keep their natural width (`flex: 0 0 auto` — no grow, no shrink) and are
|
|
18
|
+
* vertically centred, so a Badge is not stretched to the footer width. */
|
|
15
19
|
display: flex;
|
|
16
|
-
flex-direction:
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
align-items: center;
|
|
17
23
|
gap: var(--card-footer-gap);
|
|
18
24
|
|
|
19
25
|
padding-block: var(--card-footer-padding-block);
|
|
20
26
|
padding-inline: var(--card-footer-padding-inline);
|
|
27
|
+
|
|
28
|
+
& > * {
|
|
29
|
+
flex: 0 0 auto;
|
|
30
|
+
}
|
|
21
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Card.Header styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.subcomponent.card-header
|
|
4
4
|
*
|
|
5
5
|
* DSL anatomy: layout.type flow, space-between; title uses font/weight/semibold.
|
|
6
6
|
* A content-bearing section: it pads itself (the card frame applies no general
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/component/Card/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/component/Card/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Card styles
|
|
3
|
-
* @implements
|
|
3
|
+
* @implements ds:global.component.card
|
|
4
4
|
*
|
|
5
|
-
* The Card establishes
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The Card is NOT a surface: it establishes no `.surface` context and sets no
|
|
6
|
+
* background of its own, so on a surface it takes the same background as its
|
|
7
|
+
* container (no step) and reads as flush. It stays delimited by its border,
|
|
8
|
+
* radius, and the dividers between its sections. Colour tokens follow the Figma
|
|
9
|
+
* spec.
|
|
10
|
+
*
|
|
11
|
+
* ── A Card is a grid participant ────────────────────────────────────────────
|
|
12
|
+
* A Card always lives inside a grid (standalone: wrap it in a `.grid`; in bulk:
|
|
13
|
+
* use the `Cards` group). It carries all of its OWN grid logic here. The card is
|
|
14
|
+
* a ROW SUBGRID spanning FOUR section tracks — image / header / content / footer
|
|
15
|
+
* — inheriting them from the parent so several cards can line their sections up
|
|
16
|
+
* across a row. A card that omits a section simply leaves that track empty for
|
|
17
|
+
* itself; the four-track vocabulary is fixed because a Card only ever has those
|
|
18
|
+
* four section types. `Cards` supplies the shared tracks and the column flow.
|
|
9
19
|
*/
|
|
10
20
|
:root {
|
|
11
21
|
--card-color-border: var(--color-border-muted);
|
|
@@ -15,27 +25,55 @@
|
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
.ds.card {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
/* One grid item spanning `--card-span` parent columns and its four section
|
|
29
|
+
* rows; a ROW subgrid so its sections snap to the parent's four shared tracks
|
|
30
|
+
* (that is the cross-card alignment). The parent (a `.grid` or the `Cards`
|
|
31
|
+
* group) owns the four row tracks. */
|
|
32
|
+
grid-column: span var(--card-span, 1);
|
|
33
|
+
grid-row: span 4;
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-rows: subgrid;
|
|
36
|
+
grid-template-columns: minmax(0, 1fr);
|
|
24
37
|
|
|
38
|
+
/* No background of its own: the card is not a surface, so it inherits its
|
|
39
|
+
container's background and blends with the surface it sits on. */
|
|
25
40
|
border: var(--card-border-width) solid var(--card-color-border);
|
|
26
41
|
border-radius: var(--card-border-radius);
|
|
27
|
-
|
|
28
42
|
/* Clip section corners (e.g. full-bleed images) to the card radius. */
|
|
29
43
|
overflow: hidden;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Place each section on its fixed row track, spanning the card's single column.
|
|
47
|
+
* DOM order matches track order: image (1) / header (2) / content (3) /
|
|
48
|
+
* footer (4). An absent section leaves its track empty for this card only. */
|
|
49
|
+
.ds.card > .card-image {
|
|
50
|
+
grid-row: 1;
|
|
51
|
+
grid-column: 1 / -1;
|
|
52
|
+
}
|
|
53
|
+
.ds.card > .card-header {
|
|
54
|
+
grid-row: 2;
|
|
55
|
+
grid-column: 1 / -1;
|
|
56
|
+
}
|
|
57
|
+
.ds.card > .card-content {
|
|
58
|
+
grid-row: 3;
|
|
59
|
+
grid-column: 1 / -1;
|
|
60
|
+
}
|
|
61
|
+
.ds.card > .card-footer {
|
|
62
|
+
grid-row: 4;
|
|
63
|
+
grid-column: 1 / -1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Section separators: a divider between adjacent sections. The card frame
|
|
67
|
+
* provides the outer border, so the last section has none. The header is NOT a
|
|
68
|
+
* separate visual section — no divider is drawn under it and it merges with the
|
|
69
|
+
* content that follows. Media (Image) stays full-bleed; the content-bearing
|
|
70
|
+
* sections pad themselves. */
|
|
71
|
+
.ds.card > :is(.card-content, .card-footer, .card-image):not(:last-child) {
|
|
72
|
+
border-block-end: var(--card-border-width) solid var(--card-color-border);
|
|
73
|
+
}
|
|
30
74
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
&
|
|
36
|
-
> :is(.card-header, .card-content, .card-footer, .card-image):not(
|
|
37
|
-
:last-child
|
|
38
|
-
) {
|
|
39
|
-
border-block-end: var(--card-border-width) solid var(--card-color-border);
|
|
40
|
-
}
|
|
75
|
+
/* Collapse the header/content seam so title and content read as one region
|
|
76
|
+
(raw 0: unthemable by design). */
|
|
77
|
+
.ds.card > .card-header:has(+ .card-content) {
|
|
78
|
+
padding-block-end: 0;
|
|
41
79
|
}
|
|
@@ -99,6 +99,9 @@
|
|
|
99
99
|
|
|
100
100
|
/* Context-specific styling for badges within chips */
|
|
101
101
|
& .ds.badge {
|
|
102
|
+
/** Pull the badge closer to the edge of a chip */
|
|
103
|
+
--badge-chip-margin-tweak: var(--dimension-025);
|
|
104
|
+
|
|
102
105
|
align-self: center;
|
|
103
106
|
margin-left: var(--spacing-horizontal-small);
|
|
104
107
|
margin-right: var(--badge-chip-margin-tweak);
|