@canonical/react-ds-global 0.37.0 → 0.40.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 +72 -0
- package/dist/esm/lib/_work_in_progress/Announcement/styles.css +51 -47
- package/dist/esm/lib/_work_in_progress/CategoriesSection/common/Category/styles.css +21 -17
- package/dist/esm/lib/_work_in_progress/CategoriesSection/styles.css +16 -12
- package/dist/esm/lib/_work_in_progress/ChatSection/styles.css +22 -18
- package/dist/esm/lib/_work_in_progress/DescriptionSection/styles.css +14 -10
- package/dist/esm/lib/_work_in_progress/IconSection/styles.css +18 -14
- package/dist/esm/lib/_work_in_progress/Label/styles.css +36 -32
- package/dist/esm/lib/_work_in_progress/Link/styles.css +32 -28
- package/dist/esm/lib/_work_in_progress/Rule/styles.css +21 -14
- package/dist/esm/lib/_work_in_progress/Section/styles.css +66 -62
- package/dist/esm/lib/_work_in_progress/SkipLink/styles.css +35 -32
- package/dist/esm/lib/_work_in_progress/TSection/styles.css +26 -22
- package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js +4 -1
- package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/styles.css +21 -17
- package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js +4 -1
- package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/grid/GridCard/styles.css +8 -4
- package/dist/esm/lib/_work_in_progress/grid/InnerGridDemo/styles.css +38 -33
- package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js +4 -1
- package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js.map +1 -1
- package/dist/esm/lib/_work_in_progress/grid/SettingsView/styles.css +23 -19
- package/dist/esm/lib/component/Accordion/common/Item/styles.css +305 -299
- package/dist/esm/lib/component/Accordion/styles.css +35 -31
- package/dist/esm/lib/component/Badge/hooks/useBadge.js +1 -1
- package/dist/esm/lib/component/Badge/hooks/useBadge.js.map +1 -1
- package/dist/esm/lib/component/Badge/styles.css +45 -41
- package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +69 -65
- package/dist/esm/lib/component/Breadcrumbs/styles.css +30 -26
- package/dist/esm/lib/component/Button/styles.css +293 -260
- package/dist/esm/lib/component/Card/common/Content/styles.css +27 -23
- package/dist/esm/lib/component/Card/common/Footer/styles.css +30 -26
- package/dist/esm/lib/component/Card/common/Header/styles.css +25 -21
- package/dist/esm/lib/component/Card/common/Image/styles.css +8 -4
- package/dist/esm/lib/component/Card/styles.css +77 -73
- package/dist/esm/lib/component/Chip/Chip.js.map +1 -1
- package/dist/esm/lib/component/Chip/styles.css +105 -101
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +30 -22
- package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js +25 -2
- package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +116 -106
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js +29 -10
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/styles.css +73 -72
- package/dist/esm/lib/component/Icon/styles.css +24 -20
- package/dist/esm/lib/component/InlineCode/styles.css +19 -15
- package/dist/esm/lib/component/KeyboardKey/styles.css +44 -40
- package/dist/esm/lib/component/Popover/Popover.js.map +1 -1
- package/dist/esm/lib/component/Popover/styles.css +59 -52
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +80 -76
- package/dist/esm/lib/component/Tabs/styles.css +36 -32
- package/dist/esm/lib/component/Tile/common/Content/styles.css +28 -24
- package/dist/esm/lib/component/Tile/common/Header/styles.css +28 -24
- package/dist/esm/lib/component/Tile/styles.css +31 -27
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js +66 -0
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js.map +1 -0
- package/dist/esm/lib/component/Tooltip/index.js +1 -0
- package/dist/esm/lib/component/Tooltip/index.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/styles.css +213 -208
- package/dist/esm/lib/component/Tooltip/withTooltip.js +11 -63
- package/dist/esm/lib/component/Tooltip/withTooltip.js.map +1 -1
- package/dist/esm/lib/group/Cards/styles.css +26 -22
- package/dist/esm/lib/group/KeyboardKeys/styles.css +14 -10
- package/dist/esm/lib/hooks/useContextualMenu/index.js +1 -0
- package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -1
- package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js +11 -0
- package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js.map +1 -0
- package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +54 -34
- package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -1
- package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +1 -1
- package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +29 -6
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
- package/dist/esm/lib/index.css +79 -0
- package/dist/esm/lib/pattern/Modal/Context.js +10 -0
- package/dist/esm/lib/pattern/Modal/Context.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/Provider.js +103 -0
- package/dist/esm/lib/pattern/Modal/Provider.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Content/Content.js +15 -0
- package/dist/esm/lib/pattern/Modal/common/Content/Content.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Content/index.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Content/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Content/styles.css +37 -0
- package/dist/esm/lib/pattern/Modal/common/Content/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/common/Content/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js +16 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/index.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +57 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/common/Footer/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Header/Header.js +27 -0
- package/dist/esm/lib/pattern/Modal/common/Header/Header.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Header/index.js +3 -0
- package/dist/esm/lib/pattern/Modal/common/Header/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/Header/styles.css +79 -0
- package/dist/esm/lib/pattern/Modal/common/Header/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/common/Header/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/common/index.js +5 -0
- package/dist/esm/lib/pattern/Modal/common/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js +11 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalState.js +15 -0
- package/dist/esm/lib/pattern/Modal/hooks/useModalState.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/index.js +4 -0
- package/dist/esm/lib/pattern/Modal/index.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/styles.css +119 -0
- package/dist/esm/lib/pattern/Modal/types.js +2 -0
- package/dist/esm/lib/pattern/Modal/types.js.map +1 -0
- package/dist/esm/lib/pattern/Modal/withModal.js +102 -0
- package/dist/esm/lib/pattern/Modal/withModal.js.map +1 -0
- package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +16 -12
- package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +116 -112
- package/dist/esm/lib/pattern/Timeline/styles.css +16 -12
- package/dist/esm/lib/pattern/index.js +1 -0
- package/dist/esm/lib/pattern/index.js.map +1 -1
- package/dist/esm/lib/subcomponent/Spinner/styles.css +38 -34
- package/dist/types/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
- package/dist/types/lib/_work_in_progress/grid/GridCard/GridCard.d.ts.map +1 -1
- package/dist/types/lib/_work_in_progress/grid/SettingsView/SettingsView.d.ts.map +1 -1
- package/dist/types/lib/component/Badge/types.d.ts +1 -1
- package/dist/types/lib/component/Badge/types.d.ts.map +1 -1
- package/dist/types/lib/component/Breadcrumbs/types.d.ts +2 -2
- package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
- package/dist/types/lib/component/Chip/Chip.d.ts +2 -2
- package/dist/types/lib/component/Chip/Chip.d.ts.map +1 -1
- package/dist/types/lib/component/Chip/types.d.ts +10 -8
- package/dist/types/lib/component/Chip/types.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +4 -4
- package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +1 -1
- package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +9 -7
- package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -1
- package/dist/types/lib/component/ContextualMenu/types.d.ts +15 -7
- package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tabs/types.d.ts +2 -2
- package/dist/types/lib/component/Tabs/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts +16 -0
- package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts.map +1 -0
- package/dist/types/lib/component/Tooltip/index.d.ts +1 -0
- package/dist/types/lib/component/Tooltip/index.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/withTooltip.d.ts +9 -3
- package/dist/types/lib/component/Tooltip/withTooltip.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/index.d.ts +1 -0
- package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts +13 -0
- package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts.map +1 -0
- package/dist/types/lib/hooks/useContextualMenu/types.d.ts +45 -15
- package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +5 -6
- package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -1
- package/dist/types/lib/hooks/useDisclosure/types.d.ts +7 -2
- package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +1 -1
- package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/types.d.ts +12 -3
- package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +11 -6
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
- package/dist/types/lib/pattern/Modal/Context.d.ts +10 -0
- package/dist/types/lib/pattern/Modal/Context.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/Provider.d.ts +63 -0
- package/dist/types/lib/pattern/Modal/Provider.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts +17 -0
- package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Content/index.d.ts +3 -0
- package/dist/types/lib/pattern/Modal/common/Content/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Content/types.d.ts +15 -0
- package/dist/types/lib/pattern/Modal/common/Content/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts +18 -0
- package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts +3 -0
- package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts +16 -0
- package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts +24 -0
- package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Header/index.d.ts +3 -0
- package/dist/types/lib/pattern/Modal/common/Header/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/Header/types.d.ts +36 -0
- package/dist/types/lib/pattern/Modal/common/Header/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/common/index.d.ts +4 -0
- package/dist/types/lib/pattern/Modal/common/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts +4 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts +10 -0
- package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/index.d.ts +4 -0
- package/dist/types/lib/pattern/Modal/index.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/types.d.ts +122 -0
- package/dist/types/lib/pattern/Modal/types.d.ts.map +1 -0
- package/dist/types/lib/pattern/Modal/withModal.d.ts +74 -0
- package/dist/types/lib/pattern/Modal/withModal.d.ts.map +1 -0
- package/dist/types/lib/pattern/index.d.ts +1 -0
- package/dist/types/lib/pattern/index.d.ts.map +1 -1
- package/package.json +28 -18
|
@@ -1,231 +1,236 @@
|
|
|
1
|
-
/*
|
|
2
|
-
positioned inline span around the target. The `.target` child carries the
|
|
3
|
-
measuring ref and strips margins from its content so placement is exact. */
|
|
4
|
-
.ds.tooltip-area {
|
|
5
|
-
position: relative;
|
|
6
|
-
& .target {
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
position: relative;
|
|
9
|
-
display: inline-block;
|
|
1
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
10
2
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
@layer ds.components.global {
|
|
4
|
+
/* The tooltip engine wrapper (rendered by `withTooltip`) — a relatively
|
|
5
|
+
positioned inline span around the target. The `.target` child carries the
|
|
6
|
+
measuring ref and strips margins from its content so placement is exact. */
|
|
7
|
+
.ds.tooltip-area {
|
|
8
|
+
position: relative;
|
|
9
|
+
& .target {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
|
|
14
|
+
& > * {
|
|
15
|
+
/* biome-ignore lint/complexity/noImportantStyles: The tooltip targets must have no margin in order for tooltip placements to work correctly */
|
|
16
|
+
margin: 0 !important;
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* Component tokens — sourced from @canonical/design-tokens.
|
|
19
|
-
The tooltip runs on the `contrasted` surface so its colours invert against
|
|
20
|
-
the ambient theme (dark chip on a light UI, light chip on a dark UI). The
|
|
21
|
-
surface channels (--surface-color-*) are read directly on the .contrasted
|
|
22
|
-
element below, NOT via a :root intermediate (which would see them unset and
|
|
23
|
-
fall back to the base colour). */
|
|
24
|
-
:root {
|
|
25
|
-
--tooltip-border-radius: 0;
|
|
26
|
-
--tooltip-margin-left: 0;
|
|
27
|
-
--tooltip-margin-bottom: 0;
|
|
28
|
-
/* Figma: py = dimension-100 (8px), px = dimension-200 (16px). */
|
|
29
|
-
--tooltip-padding-vertical: var(--dimension-100);
|
|
30
|
-
--tooltip-padding-horizontal: var(--dimension-200);
|
|
31
|
-
--tooltip-border-width: 0;
|
|
32
|
-
/* Figma: text-secondary (14px / 20px line-height). */
|
|
33
|
-
--tooltip-font-size: var(--font-size-small, 14px);
|
|
34
|
-
--tooltip-font-weight: var(--font-weight-default);
|
|
35
|
-
--tooltip-line-height: var(--line-height-small, 20px);
|
|
36
|
-
--tooltip-max-width: 284px;
|
|
37
|
-
/* Gap between an optional leading icon and the text (dimension-100). */
|
|
38
|
-
--tooltip-gap: var(--dimension-100);
|
|
39
|
-
|
|
40
|
-
/* Arrow geometry, independent of `distance` (the gap to the trigger).
|
|
41
|
-
Figma: 14px base (dimension-175) across the edge, 8px depth pointing out. */
|
|
42
|
-
--tooltip-arrow-width: var(--dimension-175, 14px);
|
|
43
|
-
--tooltip-arrow-depth: var(--dimension-100, 8px);
|
|
44
|
-
|
|
45
|
-
/* Duration of the open/close fade. */
|
|
46
|
-
--tooltip-motion-duration: 0.1s;
|
|
47
|
-
}
|
|
48
20
|
|
|
49
|
-
/*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
--tooltip-
|
|
57
|
-
--tooltip-
|
|
58
|
-
--tooltip-
|
|
59
|
-
|
|
60
|
-
--tooltip-
|
|
61
|
-
|
|
62
|
-
--tooltip-
|
|
63
|
-
|
|
64
|
-
--tooltip-
|
|
65
|
-
--tooltip-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var(--
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
built from two half-width transparent borders; the depth from the coloured
|
|
79
|
-
border on the pointing side. */
|
|
80
|
-
--tooltip-arrow-half-width: calc(var(--tooltip-arrow-width) / 2);
|
|
81
|
-
/* Centre of the edge. `left`/`top` positions the ZERO-width pseudo-element's
|
|
82
|
-
origin, but its two half-width side borders render the triangle from that
|
|
83
|
-
origin OUTWARD, so the visible apex sits half-a-width past `left`. To centre
|
|
84
|
-
the apex on the box we therefore pull the origin back by half-width:
|
|
85
|
-
`50% - half-width`. (Verified by pixel measurement: plain `50%` renders the
|
|
86
|
-
apex +7px off-centre.) The magnetic offset then shifts from this centre. */
|
|
87
|
-
--tooltip-arrow-middle: calc(50% - var(--tooltip-arrow-half-width));
|
|
88
|
-
--tooltip-arrow-edge: calc(-1 * var(--tooltip-arrow-depth));
|
|
89
|
-
--tooltip-arrow-offset-left: 0px;
|
|
90
|
-
--tooltip-arrow-offset-top: 0px;
|
|
91
|
-
|
|
92
|
-
color: var(--tooltip-color-text);
|
|
93
|
-
background-color: var(--tooltip-color-background);
|
|
94
|
-
border-color: var(--tooltip-color-background);
|
|
95
|
-
border-style: solid;
|
|
96
|
-
border-radius: var(--tooltip-border-radius);
|
|
97
|
-
border-width: var(--tooltip-border-width, 1px);
|
|
98
|
-
font-size: var(--tooltip-font-size, var(--font-size-small));
|
|
99
|
-
font-weight: var(--tooltip-font-weight, var(--font-weight-default));
|
|
100
|
-
line-height: var(--tooltip-line-height, var(--line-height-small));
|
|
101
|
-
margin-block-end: var(--tooltip-margin-bottom, 0);
|
|
102
|
-
margin-inline-end: var(--tooltip-margin-left, 0);
|
|
103
|
-
padding-block: var(--tooltip-padding-vertical, 5px);
|
|
104
|
-
padding-inline: var(--tooltip-padding-horizontal, 10px);
|
|
105
|
-
text-align: left;
|
|
106
|
-
text-decoration: initial;
|
|
107
|
-
pointer-events: auto;
|
|
108
|
-
/* The box stays `inline-block` — it is the positioning context for the arrow
|
|
109
|
-
`::before`, and its `50%` centring must resolve against this box. The
|
|
110
|
-
icon+text layout lives in an inner `.content` flex row so the pseudo-element
|
|
111
|
-
is never a flex item (which would shift the arrow and reserve gap for it). */
|
|
112
|
-
display: inline-block;
|
|
113
|
-
max-width: var(--tooltip-max-width);
|
|
114
|
-
position: fixed;
|
|
115
|
-
/* MUST stay `visible`: the arrow is a `::before` positioned just outside the
|
|
116
|
-
box (e.g. bottom: -8px). Any `overflow: auto | hidden | clip` clips it and
|
|
117
|
-
the triangle disappears entirely. */
|
|
118
|
-
overflow: visible;
|
|
119
|
-
|
|
120
|
-
/* Inner row: optional leading icon before the text, top-aligned with the
|
|
121
|
-
first line (Figma). Without an icon it is just the text. */
|
|
122
|
-
& > .content {
|
|
123
|
-
display: flex;
|
|
124
|
-
align-items: flex-start;
|
|
125
|
-
gap: var(--tooltip-gap);
|
|
21
|
+
/* Component tokens — sourced from @canonical/design-tokens.
|
|
22
|
+
The tooltip runs on the `contrasted` surface so its colours invert against
|
|
23
|
+
the ambient theme (dark chip on a light UI, light chip on a dark UI). The
|
|
24
|
+
surface channels (--surface-color-*) are read directly on the .contrasted
|
|
25
|
+
element below, NOT via a :root intermediate (which would see them unset and
|
|
26
|
+
fall back to the base colour). */
|
|
27
|
+
:root {
|
|
28
|
+
--tooltip-border-radius: 0;
|
|
29
|
+
--tooltip-margin-left: 0;
|
|
30
|
+
--tooltip-margin-bottom: 0;
|
|
31
|
+
/* Figma: py = dimension-100 (8px), px = dimension-200 (16px). */
|
|
32
|
+
--tooltip-padding-vertical: var(--dimension-100);
|
|
33
|
+
--tooltip-padding-horizontal: var(--dimension-200);
|
|
34
|
+
--tooltip-border-width: 0;
|
|
35
|
+
/* Figma: text-secondary (14px / 20px line-height). */
|
|
36
|
+
--tooltip-font-size: var(--font-size-small, 14px);
|
|
37
|
+
--tooltip-font-weight: var(--font-weight-default);
|
|
38
|
+
--tooltip-line-height: var(--line-height-small, 20px);
|
|
39
|
+
--tooltip-max-width: 284px;
|
|
40
|
+
/* Gap between an optional leading icon and the text (dimension-100). */
|
|
41
|
+
--tooltip-gap: var(--dimension-100);
|
|
42
|
+
|
|
43
|
+
/* Arrow geometry, independent of `distance` (the gap to the trigger).
|
|
44
|
+
Figma: 14px base (dimension-175) across the edge, 8px depth pointing out. */
|
|
45
|
+
--tooltip-arrow-width: var(--dimension-175, 14px);
|
|
46
|
+
--tooltip-arrow-depth: var(--dimension-100, 8px);
|
|
47
|
+
|
|
48
|
+
/* Duration of the open/close fade. */
|
|
49
|
+
--tooltip-motion-duration: 0.1s;
|
|
126
50
|
}
|
|
127
51
|
|
|
128
|
-
/*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
display: inline-flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
justify-content: center;
|
|
135
|
-
inline-size: var(--dimension-200, 16px);
|
|
136
|
-
block-size: var(--tooltip-line-height, 20px);
|
|
137
|
-
|
|
138
|
-
& > svg {
|
|
139
|
-
inline-size: var(--dimension-200, 16px);
|
|
140
|
-
block-size: var(--dimension-200, 16px);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
52
|
+
/* component variables
|
|
53
|
+
--tooltip-color-background: background color of the tooltip
|
|
54
|
+
--tooltip-color-text: text color of the tooltip
|
|
55
|
+
--tooltip-color-border: border color of the tooltip
|
|
143
56
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
57
|
+
--tooltip-margin-left: left margin of the tooltip
|
|
58
|
+
--tooltip-margin-bottom: bottom margin of the tooltip
|
|
59
|
+
--tooltip-padding-vertical: vertical padding of the tooltip
|
|
60
|
+
--tooltip-padding-horizontal: horizontal padding of the tooltip
|
|
61
|
+
--tooltip-font-size: font size of the tooltip
|
|
62
|
+
--tooltip-font-weight: font weight of the tooltip
|
|
63
|
+
--tooltip-line-height: line height of the tooltip
|
|
149
64
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
65
|
+
--tooltip-spacing-arrow-size: size of the arrow (independent of `distance`)
|
|
66
|
+
|
|
67
|
+
--tooltip-arrow-offset-left: offset of the arrow along the x-axis (top/bottom placements)
|
|
68
|
+
--tooltip-arrow-offset-top: offset of the arrow along the y-axis (left/right placements)
|
|
154
69
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
70
|
+
|
|
71
|
+
.ds.tooltip {
|
|
72
|
+
/* The tooltip's own background colour, read from the contrasted surface on
|
|
73
|
+
this element (so the arrow, which reuses it, is coloured correctly too). */
|
|
74
|
+
--tooltip-color-background: var(
|
|
75
|
+
--surface-color-background,
|
|
76
|
+
var(--color-background)
|
|
77
|
+
);
|
|
78
|
+
--tooltip-color-text: var(--surface-color-text, var(--color-text));
|
|
79
|
+
|
|
80
|
+
/* Figma arrow: 14px across the edge (base), 8px deep (point). The base is
|
|
81
|
+
built from two half-width transparent borders; the depth from the coloured
|
|
82
|
+
border on the pointing side. */
|
|
83
|
+
--tooltip-arrow-half-width: calc(var(--tooltip-arrow-width) / 2);
|
|
84
|
+
/* Centre of the edge. `left`/`top` positions the ZERO-width pseudo-element's
|
|
85
|
+
origin, but its two half-width side borders render the triangle from that
|
|
86
|
+
origin OUTWARD, so the visible apex sits half-a-width past `left`. To centre
|
|
87
|
+
the apex on the box we therefore pull the origin back by half-width:
|
|
88
|
+
`50% - half-width`. (Verified by pixel measurement: plain `50%` renders the
|
|
89
|
+
apex +7px off-centre.) The magnetic offset then shifts from this centre. */
|
|
90
|
+
--tooltip-arrow-middle: calc(50% - var(--tooltip-arrow-half-width));
|
|
91
|
+
--tooltip-arrow-edge: calc(-1 * var(--tooltip-arrow-depth));
|
|
92
|
+
--tooltip-arrow-offset-left: 0px;
|
|
93
|
+
--tooltip-arrow-offset-top: 0px;
|
|
94
|
+
|
|
95
|
+
color: var(--tooltip-color-text);
|
|
96
|
+
background-color: var(--tooltip-color-background);
|
|
97
|
+
border-color: var(--tooltip-color-background);
|
|
98
|
+
border-style: solid;
|
|
99
|
+
border-radius: var(--tooltip-border-radius);
|
|
100
|
+
border-width: var(--tooltip-border-width, 1px);
|
|
101
|
+
font-size: var(--tooltip-font-size, var(--font-size-small));
|
|
102
|
+
font-weight: var(--tooltip-font-weight, var(--font-weight-default));
|
|
103
|
+
line-height: var(--tooltip-line-height, var(--line-height-small));
|
|
104
|
+
margin-block-end: var(--tooltip-margin-bottom, 0);
|
|
105
|
+
margin-inline-end: var(--tooltip-margin-left, 0);
|
|
106
|
+
padding-block: var(--tooltip-padding-vertical, 5px);
|
|
107
|
+
padding-inline: var(--tooltip-padding-horizontal, 10px);
|
|
108
|
+
text-align: left;
|
|
109
|
+
text-decoration: initial;
|
|
163
110
|
pointer-events: auto;
|
|
164
|
-
|
|
111
|
+
/* The box stays `inline-block` — it is the positioning context for the arrow
|
|
112
|
+
`::before`, and its `50%` centring must resolve against this box. The
|
|
113
|
+
icon+text layout lives in an inner `.content` flex row so the pseudo-element
|
|
114
|
+
is never a flex item (which would shift the arrow and reserve gap for it). */
|
|
115
|
+
display: inline-block;
|
|
116
|
+
max-width: var(--tooltip-max-width);
|
|
117
|
+
position: fixed;
|
|
118
|
+
/* MUST stay `visible`: the arrow is a `::before` positioned just outside the
|
|
119
|
+
box (e.g. bottom: -8px). Any `overflow: auto | hidden | clip` clips it and
|
|
120
|
+
the triangle disappears entirely. */
|
|
121
|
+
overflow: visible;
|
|
122
|
+
|
|
123
|
+
/* Inner row: optional leading icon before the text, top-aligned with the
|
|
124
|
+
first line (Figma). Without an icon it is just the text. */
|
|
125
|
+
& > .content {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: flex-start;
|
|
128
|
+
gap: var(--tooltip-gap);
|
|
129
|
+
}
|
|
165
130
|
|
|
166
|
-
|
|
167
|
-
|
|
131
|
+
/* Leading icon: fixed 16px box, top-aligned with the first text line, purely
|
|
132
|
+
decorative (the text carries the meaning). */
|
|
133
|
+
& .icon {
|
|
134
|
+
flex: 0 0 auto;
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
inline-size: var(--dimension-200, 16px);
|
|
139
|
+
block-size: var(--tooltip-line-height, 20px);
|
|
140
|
+
|
|
141
|
+
& > svg {
|
|
142
|
+
inline-size: var(--dimension-200, 16px);
|
|
143
|
+
block-size: var(--dimension-200, 16px);
|
|
144
|
+
}
|
|
168
145
|
}
|
|
169
|
-
}
|
|
170
146
|
|
|
171
|
-
|
|
147
|
+
/* The text wraps at max-width (Figma shows multi-line) while honouring any
|
|
148
|
+
explicit newlines in the message. */
|
|
149
|
+
& .text {
|
|
150
|
+
white-space: pre-wrap;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/*
|
|
154
|
+
CSS-only enter/exit animation. `allow-discrete` lets `visibility` (a discrete
|
|
155
|
+
property) transition alongside `opacity`, and `@starting-style` gives the
|
|
156
|
+
opening frame a starting opacity so the fade-in runs. No JavaScript timing.
|
|
157
|
+
*/
|
|
172
158
|
opacity: 0;
|
|
173
|
-
pointer-events: none;
|
|
174
159
|
visibility: hidden;
|
|
175
|
-
|
|
160
|
+
transition:
|
|
161
|
+
opacity var(--tooltip-motion-duration) ease-in-out,
|
|
162
|
+
visibility var(--tooltip-motion-duration) allow-discrete;
|
|
163
|
+
|
|
164
|
+
&[aria-hidden="false"] {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
pointer-events: auto;
|
|
167
|
+
visibility: visible;
|
|
168
|
+
|
|
169
|
+
@starting-style {
|
|
170
|
+
opacity: 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
176
173
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
&[aria-hidden="true"] {
|
|
175
|
+
opacity: 0;
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
visibility: hidden;
|
|
178
|
+
}
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
pointing side). The always-on offset shifts it along the edge so the tip
|
|
185
|
-
stays pinned to the trigger centre for every placement — including after a
|
|
186
|
-
resize or scroll reposition (the offset is recomputed live).
|
|
187
|
-
*/
|
|
188
|
-
&::before {
|
|
189
|
-
content: "";
|
|
190
|
-
width: 0;
|
|
191
|
-
height: 0;
|
|
192
|
-
position: absolute;
|
|
193
|
-
transform: translateX(var(--tooltip-arrow-offset-left))
|
|
194
|
-
translateY(var(--tooltip-arrow-offset-top));
|
|
195
|
-
}
|
|
180
|
+
@media (prefers-reduced-motion: reduce) {
|
|
181
|
+
transition: none;
|
|
182
|
+
}
|
|
196
183
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
184
|
+
/*
|
|
185
|
+
The arrow is a CSS border-triangle: 14px across the edge (two
|
|
186
|
+
half-width transparent borders) and 8px deep (the coloured border on the
|
|
187
|
+
pointing side). The always-on offset shifts it along the edge so the tip
|
|
188
|
+
stays pinned to the trigger centre for every placement — including after a
|
|
189
|
+
resize or scroll reposition (the offset is recomputed live).
|
|
190
|
+
*/
|
|
191
|
+
&::before {
|
|
192
|
+
content: "";
|
|
193
|
+
width: 0;
|
|
194
|
+
height: 0;
|
|
195
|
+
position: absolute;
|
|
196
|
+
transform: translateX(var(--tooltip-arrow-offset-left))
|
|
197
|
+
translateY(var(--tooltip-arrow-offset-top));
|
|
198
|
+
}
|
|
204
199
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
200
|
+
/* Placed above the trigger → arrow points down, on the tooltip's bottom edge. */
|
|
201
|
+
&.top::before {
|
|
202
|
+
border-inline: var(--tooltip-arrow-half-width) solid transparent;
|
|
203
|
+
border-top: var(--tooltip-arrow-depth) solid
|
|
204
|
+
var(--tooltip-color-background);
|
|
205
|
+
bottom: var(--tooltip-arrow-edge);
|
|
206
|
+
left: var(--tooltip-arrow-middle);
|
|
207
|
+
}
|
|
213
208
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
209
|
+
/* Placed below → arrow points up, on the top edge. */
|
|
210
|
+
&.bottom::before {
|
|
211
|
+
border-inline: var(--tooltip-arrow-half-width) solid transparent;
|
|
212
|
+
border-bottom: var(--tooltip-arrow-depth) solid
|
|
213
|
+
var(--tooltip-color-background);
|
|
214
|
+
top: var(--tooltip-arrow-edge);
|
|
215
|
+
left: var(--tooltip-arrow-middle);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Placed left → arrow points right, on the right edge. */
|
|
219
|
+
&.left::before {
|
|
220
|
+
border-block: var(--tooltip-arrow-half-width) solid transparent;
|
|
221
|
+
border-left: var(--tooltip-arrow-depth) solid
|
|
222
|
+
var(--tooltip-color-background);
|
|
223
|
+
right: var(--tooltip-arrow-edge);
|
|
224
|
+
top: var(--tooltip-arrow-middle);
|
|
225
|
+
}
|
|
222
226
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
/* Placed right → arrow points left, on the left edge. */
|
|
228
|
+
&.right::before {
|
|
229
|
+
border-block: var(--tooltip-arrow-half-width) solid transparent;
|
|
230
|
+
border-right: var(--tooltip-arrow-depth) solid
|
|
231
|
+
var(--tooltip-color-background);
|
|
232
|
+
left: var(--tooltip-arrow-edge);
|
|
233
|
+
top: var(--tooltip-arrow-middle);
|
|
234
|
+
}
|
|
230
235
|
}
|
|
231
236
|
}
|
|
@@ -1,69 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import
|
|
3
|
-
import { useDisclosure, useIsMounted } from "../../hooks/index.js";
|
|
4
|
-
import Tooltip from "./Tooltip.js";
|
|
5
|
-
import "./styles.css";
|
|
6
|
-
const componentCssClassName = "ds tooltip-area";
|
|
7
|
-
/**
|
|
8
|
-
* The tooltip engine: wraps a target element with a hover/focus tooltip. It
|
|
9
|
-
* drives {@link useDisclosure} in `hover` mode, portals the message to the
|
|
10
|
-
* client only, positions it against the target span, and points the arrow. This
|
|
11
|
-
* is the shared implementation that {@link withTooltip} builds on — it renders
|
|
12
|
-
* the wrapped component as its `children` target.
|
|
13
|
-
*/
|
|
14
|
-
const TooltipEngine = ({ children, style, className, Message, icon, open, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
|
|
15
|
-
const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, bestPosition, arrowOffset, getToggleProps, getContentProps,
|
|
16
|
-
// `open` is the public alias for the hook's controlled `isOpen`; when set it
|
|
17
|
-
// overrides hover/focus so the tooltip stays in the given state.
|
|
18
|
-
} = useDisclosure({
|
|
19
|
-
distance,
|
|
20
|
-
autoFit,
|
|
21
|
-
...props,
|
|
22
|
-
isOpen: open ?? props.isOpen,
|
|
23
|
-
mode: "hover",
|
|
24
|
-
});
|
|
25
|
-
const triggerProps = getToggleProps();
|
|
26
|
-
const contentProps = getContentProps();
|
|
27
|
-
// The message is portalled to the client only. Rendering it on the server (or
|
|
28
|
-
// on the first client render) would differ from the post-mount portal output
|
|
29
|
-
// and force a hydration mismatch + full re-mount — which resets the fitment
|
|
30
|
-
// refs to null and re-triggers the unpositioned first frame. Deferring to a
|
|
31
|
-
// mounted gate makes the server and first client render identical (nothing
|
|
32
|
-
// at the call site); the tooltip mounts once, cleanly, after hydration.
|
|
33
|
-
const mounted = useIsMounted();
|
|
34
|
-
// The always-on arrow offset keeps the arrow pointing at the target centre
|
|
35
|
-
// for every placement, not only when auto-fit clamps.
|
|
36
|
-
const arrowStyle = arrowOffset
|
|
37
|
-
? {
|
|
38
|
-
[arrowOffset.axis === "x"
|
|
39
|
-
? "--tooltip-arrow-offset-left"
|
|
40
|
-
: "--tooltip-arrow-offset-top"]: `${arrowOffset.offset}px`,
|
|
41
|
-
}
|
|
42
|
-
: {};
|
|
43
|
-
const TooltipMessageElement = (_jsx(Tooltip, { id: popupId, className: [bestPosition?.positionName, messageElementClassName]
|
|
44
|
-
.filter(Boolean)
|
|
45
|
-
.join(" "), icon: icon, onPointerEnter: contentProps.onPointerEnter, ref: popupRef, style: {
|
|
46
|
-
...messageElementStyle,
|
|
47
|
-
...popupPositionStyle,
|
|
48
|
-
...arrowStyle,
|
|
49
|
-
},
|
|
50
|
-
// Reveal only once a position has been resolved. Until `bestPosition`
|
|
51
|
-
// exists the popup would render at the fallback top:0/left:0 with no
|
|
52
|
-
// placement class (and so no arrow); gating the reveal on it means that
|
|
53
|
-
// unpositioned frame stays `visibility:hidden` and never paints — no
|
|
54
|
-
// visible 0,0 flash, and the open fade always runs from an anchored spot.
|
|
55
|
-
isOpen: isOpen && Boolean(bestPosition), children: Message }));
|
|
56
|
-
return (
|
|
57
|
-
// biome-ignore lint/a11y/noStaticElementInteractions: the wrapper forwards pointer/focus to the tooltip trigger
|
|
58
|
-
_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
|
|
59
|
-
? createPortal(TooltipMessageElement, parentElement || document.body)
|
|
60
|
-
: null] }));
|
|
61
|
-
};
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import TooltipEngine from "./TooltipEngine.js";
|
|
62
3
|
/**
|
|
63
4
|
* A higher-order component that wraps a component with a tooltip. It is the
|
|
64
5
|
* single public tooltip primitive: it owns the engine (hover-mode
|
|
65
|
-
* {@link useDisclosure}, client-only portal, arrow positioning) and renders
|
|
66
|
-
* wrapped component as the tooltip target.
|
|
6
|
+
* {@link useDisclosure}, client-only portal, arrow positioning) and renders
|
|
7
|
+
* the wrapped component as the tooltip target.
|
|
8
|
+
*
|
|
9
|
+
* `Message` is fixed at wrap time — not reactive to the wrapped component's
|
|
10
|
+
* props. When the message must follow prop state (e.g. a toggle whose
|
|
11
|
+
* tooltip names the current action), render {@link TooltipEngine} directly
|
|
12
|
+
* with a live `Message`; one stable element type also keeps the target
|
|
13
|
+
* mounted across state changes, preserving focus and hover state.
|
|
14
|
+
*
|
|
67
15
|
* @param Component The component type to wrap.
|
|
68
16
|
* @param Message The content of the tooltip.
|
|
69
17
|
* @param popupProps Tooltip options — positioning, sizing, timing, plus `open`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":";AACA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAG/C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,GAAG,CAClB,SAAgC,EAChC,OAAkB,EAClB,aAAiC,EAAE,EACvB,EAAE;IACd,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAwB,EAAE;QAC/D,OAAO,CACL,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,KAAM,UAAU,YAC7C,KAAC,SAAS,OAAK,KAAK,GAAI,GACV,CACjB,CAAC;IACJ,CAAC,CAAC;IAEF,2CAA2C;IAC3C,gBAAgB,CAAC,WAAW,GAAG,eAC7B,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAC7C,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;GAEG;AACH,eAAe,WAAW,CAAC"}
|
|
@@ -25,31 +25,35 @@
|
|
|
25
25
|
* `--card-span` (the `cardSpan` prop) is the NUMBER OF PARENT COLUMNS each card
|
|
26
26
|
* spans — not a pixel width. `1` (default) packs the most cards per row; use 2
|
|
27
27
|
* or 4 for fewer, wider cards on the 4/8/12-column responsive grid.
|
|
28
|
+
*
|
|
29
|
+
* Layer: ds.components.global (@canonical/styles README, "Cascade layers").
|
|
28
30
|
*/
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
@layer ds.components.global {
|
|
33
|
+
.ds.cards {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: subgrid;
|
|
36
|
+
/* The Cards container itself always spans the full master grid; `--card-span`
|
|
37
|
+
* (the per-card column span) inherits down to each Card, it is NOT the
|
|
38
|
+
* container's own span. */
|
|
39
|
+
grid-column: 1 / -1;
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
/* The four shared section tracks (image / header / content / footer), repeated
|
|
42
|
+
* for every wrapped band via `grid-auto-rows`. They are ALL `auto`, so each
|
|
43
|
+
* track sizes to the tallest of that section across the row — every card takes
|
|
44
|
+
* its intrinsic height plus only the extra needed to align with the tallest
|
|
45
|
+
* card on the band (no `1fr`, which would stretch a card to fill surplus
|
|
46
|
+
* container height). Cards each `span 4` rows and auto-place across the columns
|
|
47
|
+
* (DOM order), wrapping to the next band. */
|
|
48
|
+
grid-auto-flow: row;
|
|
49
|
+
grid-auto-rows: auto;
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
/* Bands take their intrinsic height and pack to the top — never stretch to
|
|
52
|
+
* fill a taller container. */
|
|
53
|
+
align-self: start;
|
|
54
|
+
align-content: start;
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
gap: var(--grid-row-gap, var(--grid-gutter))
|
|
57
|
+
var(--grid-column-gap, var(--grid-gutter));
|
|
58
|
+
}
|
|
55
59
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
2
|
+
|
|
3
|
+
@layer ds.components.global {
|
|
4
|
+
:root {
|
|
5
|
+
/* Figma (node 6004-72): 2px between adjacent keys in a chord. */
|
|
6
|
+
--keyboard-keys-gap: var(--dimension-025);
|
|
7
|
+
--keyboard-keys-margin-inline: var(--dimension-050);
|
|
8
|
+
}
|
|
6
9
|
|
|
7
|
-
.ds.keyboard-keys {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
.ds.keyboard-keys {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--keyboard-keys-gap);
|
|
14
|
+
margin-inline: var(--keyboard-keys-margin-inline);
|
|
15
|
+
}
|
|
12
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow a menu entry (raw or annotated) to a separator via its `type`
|
|
3
|
+
* discriminant. In the false branch the entry narrows to a `MenuItem`, so
|
|
4
|
+
* render code can branch between a divider and an interactive item.
|
|
5
|
+
*
|
|
6
|
+
* @param entry The menu entry to test.
|
|
7
|
+
* @returns Whether the entry is a separator.
|
|
8
|
+
*/
|
|
9
|
+
const isMenuSeparator = (entry) => "type" in entry && entry.type === "separator";
|
|
10
|
+
export default isMenuSeparator;
|
|
11
|
+
//# sourceMappingURL=isMenuSeparator.js.map
|