@canonical/react-ds-global 0.37.0 → 0.38.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 +29 -20
- 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 -9
- package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -1
- package/dist/esm/lib/component/ContextualMenu/styles.css +74 -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/styles.css +213 -208
- 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 +3 -0
- 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 +14 -6
- 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/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 +1 -1
- 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,326 +1,332 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
--color-foreground-ghost
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
--accordion-item-header-padding-inline: var(--dimension-200);
|
|
49
|
-
|
|
50
|
-
--accordion-item-content-padding-inline: var(--dimension-200);
|
|
51
|
-
/* Vertical content padding in baseline multiples (dimension-100 = 1 bU). */
|
|
52
|
-
--accordion-item-content-padding-block: var(--dimension-100);
|
|
53
|
-
|
|
54
|
-
/* Fixed chevron size (per Figma) so every item reserves the same chevron
|
|
55
|
-
column width and all headings start at the same x-position, regardless of
|
|
56
|
-
heading level — no horizontal drift. */
|
|
57
|
-
--accordion-item-chevron-size: var(--dimension-200);
|
|
58
|
-
|
|
59
|
-
/* Indent the content so it aligns under the heading text, i.e. past the
|
|
60
|
-
header inline padding + chevron + the gap between chevron and heading. */
|
|
61
|
-
--accordion-item-content-indent: calc(
|
|
62
|
-
var(--accordion-item-header-padding-inline) +
|
|
63
|
-
var(--accordion-item-chevron-size) +
|
|
64
|
-
var(--accordion-item-header-gap)
|
|
65
|
-
);
|
|
66
|
-
}
|
|
1
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
2
|
+
|
|
3
|
+
@layer ds.components.global {
|
|
4
|
+
/**
|
|
5
|
+
* Accordion.Item styles
|
|
6
|
+
* @implements ds:global.subcomponent.accordion-item
|
|
7
|
+
*
|
|
8
|
+
* Rendered with native <details>/<summary>. Typography and baseline alignment
|
|
9
|
+
* come from the `.p` class on the heading and content. Tokens follow the Figma
|
|
10
|
+
* spec: header interactive background uses the ghost surface channel (which
|
|
11
|
+
* auto-steps on nested .surface contexts to layer2/layer3), text uses
|
|
12
|
+
* color-text, the chevron uses color-icon, and dividers use color-border-muted.
|
|
13
|
+
* Vertical padding is expressed in baseline multiples.
|
|
14
|
+
*
|
|
15
|
+
* NOTE: the apps/sites element-size sizing (collapsed item at 36px sites / 32px
|
|
16
|
+
* apps, and the matching h6 line box) is intentionally NOT set here — control
|
|
17
|
+
* heights across apps vs sites are owned by the density/height bucket, not this
|
|
18
|
+
* design-review geometry pass.
|
|
19
|
+
*/
|
|
20
|
+
:root {
|
|
21
|
+
--accordion-item-color-text: var(--color-text);
|
|
22
|
+
--accordion-item-color-icon: var(--color-icon);
|
|
23
|
+
--accordion-item-color-border: var(--color-border-muted);
|
|
24
|
+
|
|
25
|
+
/* Items have no side (inline) borders by default — the docs show only the
|
|
26
|
+
block-end divider. This token is an intentional extension point: it
|
|
27
|
+
references a currently-undefined colour, so it resolves to no border, but
|
|
28
|
+
a theme/consumer can supply `--accordion-item-border-inline-color` to turn
|
|
29
|
+
inline borders on without changing the component. */
|
|
30
|
+
--accordion-item-border-inline: var(--dimension-stroke-thickness-medium)
|
|
31
|
+
solid var(--accordion-item-border-inline-color);
|
|
32
|
+
|
|
33
|
+
/* Default header background (surface 1). The surface channel is applied on
|
|
34
|
+
the element below — NOT here — because a var() referencing
|
|
35
|
+
--surface-color-foreground-ghost resolved in :root would capture the :root
|
|
36
|
+
value (where no .surface is active) and never step. The built surface
|
|
37
|
+
layer re-channels only the base ghost (no hover/active channel), so
|
|
38
|
+
hover/active default to the non-layered ghost state vars here and are
|
|
39
|
+
re-pointed per surface nesting depth by the stopgap rules below the
|
|
40
|
+
header. */
|
|
41
|
+
--accordion-item-header-background: var(--color-foreground-ghost);
|
|
42
|
+
--accordion-item-header-background-hover: var(
|
|
43
|
+
--color-foreground-ghost-hover
|
|
44
|
+
);
|
|
45
|
+
--accordion-item-header-background-active: var(
|
|
46
|
+
--color-foreground-ghost-active
|
|
47
|
+
);
|
|
67
48
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
--accordion-item-header-gap: var(--dimension-200);
|
|
50
|
+
/* Header block padding in baseline multiples (dimension-100 = 1 bU). The
|
|
51
|
+
apps/sites element-size sizing (6px → 36/32) is owned by the height bucket. */
|
|
52
|
+
--accordion-item-header-padding-block: var(--dimension-100);
|
|
53
|
+
--accordion-item-header-padding-inline: var(--dimension-200);
|
|
54
|
+
|
|
55
|
+
--accordion-item-content-padding-inline: var(--dimension-200);
|
|
56
|
+
/* Vertical content padding in baseline multiples (dimension-100 = 1 bU). */
|
|
57
|
+
--accordion-item-content-padding-block: var(--dimension-100);
|
|
58
|
+
|
|
59
|
+
/* Fixed chevron size (per Figma) so every item reserves the same chevron
|
|
60
|
+
column width and all headings start at the same x-position, regardless of
|
|
61
|
+
heading level — no horizontal drift. */
|
|
62
|
+
--accordion-item-chevron-size: var(--dimension-200);
|
|
63
|
+
|
|
64
|
+
/* Indent the content so it aligns under the heading text, i.e. past the
|
|
65
|
+
header inline padding + chevron + the gap between chevron and heading. */
|
|
66
|
+
--accordion-item-content-indent: calc(
|
|
67
|
+
var(--accordion-item-header-padding-inline) +
|
|
68
|
+
var(--accordion-item-chevron-size) +
|
|
69
|
+
var(--accordion-item-header-gap)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var(--accordion-item-color-border);
|
|
76
|
-
}
|
|
73
|
+
.ds.accordion-item {
|
|
74
|
+
/* Inline (side) borders — off by default, see the token above. */
|
|
75
|
+
border-inline: var(--accordion-item-border-inline);
|
|
77
76
|
|
|
78
|
-
/*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
display: flex;
|
|
83
|
-
flex-direction: row;
|
|
84
|
-
align-items: center;
|
|
85
|
-
gap: var(--accordion-item-header-gap);
|
|
86
|
-
|
|
87
|
-
padding-block: var(--accordion-item-header-padding-block);
|
|
88
|
-
padding-inline: var(--accordion-item-header-padding-inline);
|
|
89
|
-
|
|
90
|
-
color: var(--accordion-item-color-text);
|
|
91
|
-
/* Consume the ghost surface channel here on the element so it resolves in the
|
|
92
|
-
.surface context and auto-steps (surface 1 -> base, 2 -> layer2, 3 ->
|
|
93
|
-
layer3); outside any .surface it falls back to the surface-1 default. */
|
|
94
|
-
background-color: var(
|
|
95
|
-
--surface-color-foreground-ghost,
|
|
96
|
-
var(--accordion-item-header-background)
|
|
97
|
-
);
|
|
98
|
-
cursor: pointer;
|
|
99
|
-
|
|
100
|
-
/* Hide the native disclosure triangle */
|
|
101
|
-
list-style: none;
|
|
102
|
-
|
|
103
|
-
&::-webkit-details-marker {
|
|
104
|
-
display: none;
|
|
77
|
+
/* Divider at the end of each item (Figma anatomy #6: "the divider at the end
|
|
78
|
+
of an accordion item indicates the end of an accordion item"). */
|
|
79
|
+
border-block-end: var(--dimension-stroke-thickness-medium) solid
|
|
80
|
+
var(--accordion-item-color-border);
|
|
105
81
|
}
|
|
106
82
|
|
|
107
|
-
/*
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
83
|
+
/* Header tab — the native <summary>. The chevron is a fixed size, so a fixed
|
|
84
|
+
chevron column keeps all headings left-aligned; align-items:center centres
|
|
85
|
+
the fixed chevron on the header line. */
|
|
86
|
+
.ds.accordion-item > .header {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: row;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: var(--accordion-item-header-gap);
|
|
91
|
+
|
|
92
|
+
padding-block: var(--accordion-item-header-padding-block);
|
|
93
|
+
padding-inline: var(--accordion-item-header-padding-inline);
|
|
94
|
+
|
|
95
|
+
color: var(--accordion-item-color-text);
|
|
96
|
+
/* Consume the ghost surface channel here on the element so it resolves in the
|
|
97
|
+
.surface context and auto-steps (surface 1 -> base, 2 -> layer2, 3 ->
|
|
98
|
+
layer3); outside any .surface it falls back to the surface-1 default. */
|
|
111
99
|
background-color: var(
|
|
112
|
-
--surface-color-foreground-ghost
|
|
113
|
-
var(--accordion-item-header-background
|
|
100
|
+
--surface-color-foreground-ghost,
|
|
101
|
+
var(--accordion-item-header-background)
|
|
114
102
|
);
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
|
|
105
|
+
/* Hide the native disclosure triangle */
|
|
106
|
+
list-style: none;
|
|
107
|
+
|
|
108
|
+
&::-webkit-details-marker {
|
|
109
|
+
display: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Prefer the surface hover/active channels so a future token build that
|
|
113
|
+
ships them steps automatically; today they are unset everywhere, so these
|
|
114
|
+
resolve to the fallback tokens, re-pointed per nesting depth below. */
|
|
115
|
+
&:hover {
|
|
116
|
+
background-color: var(
|
|
117
|
+
--surface-color-foreground-ghost-hover,
|
|
118
|
+
var(--accordion-item-header-background-hover)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:active {
|
|
123
|
+
background-color: var(
|
|
124
|
+
--surface-color-foreground-ghost-active,
|
|
125
|
+
var(--accordion-item-header-background-active)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
115
128
|
}
|
|
116
129
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
/* STOPGAP — step the header hover/active backgrounds with surface nesting.
|
|
131
|
+
The built surfaces modifier re-channels only the base ghost (it exposes no
|
|
132
|
+
--surface-color-foreground-ghost-hover/-active), so without this, hovering
|
|
133
|
+
a header on a layer-2/3 surface painted the base-layer colour. These rules
|
|
134
|
+
mirror the modifier's own nesting selectors to re-point the hover/active
|
|
135
|
+
tokens at the layered state tokens. Hard-coding surface depth in component
|
|
136
|
+
CSS is exactly what the token block above avoids — delete both rules once
|
|
137
|
+
the surfaces modifier ships the hover/active channels (the :hover/:active
|
|
138
|
+
rules above already prefer them). */
|
|
139
|
+
.surface .surface .ds.accordion-item {
|
|
140
|
+
--accordion-item-header-background-hover: var(
|
|
141
|
+
--color-foreground-ghost-layer2-hover
|
|
142
|
+
);
|
|
143
|
+
--accordion-item-header-background-active: var(
|
|
144
|
+
--color-foreground-ghost-layer2-active
|
|
121
145
|
);
|
|
122
146
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/* STOPGAP — step the header hover/active backgrounds with surface nesting.
|
|
126
|
-
The built surfaces modifier re-channels only the base ghost (it exposes no
|
|
127
|
-
--surface-color-foreground-ghost-hover/-active), so without this, hovering
|
|
128
|
-
a header on a layer-2/3 surface painted the base-layer colour. These rules
|
|
129
|
-
mirror the modifier's own nesting selectors to re-point the hover/active
|
|
130
|
-
tokens at the layered state tokens. Hard-coding surface depth in component
|
|
131
|
-
CSS is exactly what the token block above avoids — delete both rules once
|
|
132
|
-
the surfaces modifier ships the hover/active channels (the :hover/:active
|
|
133
|
-
rules above already prefer them). */
|
|
134
|
-
.surface .surface .ds.accordion-item {
|
|
135
|
-
--accordion-item-header-background-hover: var(
|
|
136
|
-
--color-foreground-ghost-layer2-hover
|
|
137
|
-
);
|
|
138
|
-
--accordion-item-header-background-active: var(
|
|
139
|
-
--color-foreground-ghost-layer2-active
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.surface .surface .surface .ds.accordion-item {
|
|
144
|
-
--accordion-item-header-background-hover: var(
|
|
145
|
-
--color-foreground-ghost-layer3-hover
|
|
146
|
-
);
|
|
147
|
-
--accordion-item-header-background-active: var(
|
|
148
|
-
--color-foreground-ghost-layer3-active
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
147
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
/* Default: body copy (text-primary) for plain text and any heading element. */
|
|
161
|
-
font-family: var(--typography-text-primary-font-family);
|
|
162
|
-
font-size: var(--typography-text-primary-font-size);
|
|
163
|
-
font-weight: var(--typography-text-primary-font-weight);
|
|
164
|
-
line-height: var(--typography-text-primary-line-height);
|
|
165
|
-
letter-spacing: var(--typography-text-primary-letter-spacing);
|
|
166
|
-
|
|
167
|
-
/* Normalise every heading element except <h6> down to the inherited body
|
|
168
|
-
tier. <h6> keeps the base h6 tier from @canonical/styles-typography
|
|
169
|
-
(correct heading-6 tokens, including the baseline-snapped line-height) — no
|
|
170
|
-
heading-6 tokens are restated here.
|
|
171
|
-
NOTE: the per-context h6 line box (24px sites / 20px apps) and zeroing the
|
|
172
|
-
heading padding-block nudges to make the header height padding-driven are
|
|
173
|
-
part of the apps/sites height bucket, not this pass. */
|
|
174
|
-
& :is(h1, h2, h3, h4, h5) {
|
|
175
|
-
margin: 0;
|
|
176
|
-
font: inherit;
|
|
177
|
-
letter-spacing: inherit;
|
|
148
|
+
.surface .surface .surface .ds.accordion-item {
|
|
149
|
+
--accordion-item-header-background-hover: var(
|
|
150
|
+
--color-foreground-ghost-layer3-hover
|
|
151
|
+
);
|
|
152
|
+
--accordion-item-header-background-active: var(
|
|
153
|
+
--color-foreground-ghost-layer3-active
|
|
154
|
+
);
|
|
178
155
|
}
|
|
179
156
|
|
|
180
|
-
|
|
181
|
-
|
|
157
|
+
/* The consumer supplies the heading content — plain text by default (rendered
|
|
158
|
+
as the text-primary body tier) or an <h6>, which renders at the heading-6
|
|
159
|
+
tier. Only those two type tokens are allowed on the accordion heading; any
|
|
160
|
+
other heading element is normalised to the text-primary body tier. */
|
|
161
|
+
.ds.accordion-item > .header > .heading {
|
|
162
|
+
flex: 1;
|
|
163
|
+
min-width: 0;
|
|
164
|
+
|
|
165
|
+
/* Default: body copy (text-primary) for plain text and any heading element. */
|
|
166
|
+
font-family: var(--typography-text-primary-font-family);
|
|
167
|
+
font-size: var(--typography-text-primary-font-size);
|
|
168
|
+
font-weight: var(--typography-text-primary-font-weight);
|
|
169
|
+
line-height: var(--typography-text-primary-line-height);
|
|
170
|
+
letter-spacing: var(--typography-text-primary-letter-spacing);
|
|
171
|
+
|
|
172
|
+
/* Normalise every heading element except <h6> down to the inherited body
|
|
173
|
+
tier. <h6> keeps the base h6 tier from @canonical/styles-typography
|
|
174
|
+
(correct heading-6 tokens, including the baseline-snapped line-height) — no
|
|
175
|
+
heading-6 tokens are restated here.
|
|
176
|
+
NOTE: the per-context h6 line box (24px sites / 20px apps) and zeroing the
|
|
177
|
+
heading padding-block nudges to make the header height padding-driven are
|
|
178
|
+
part of the apps/sites height bucket, not this pass. */
|
|
179
|
+
& :is(h1, h2, h3, h4, h5) {
|
|
180
|
+
margin: 0;
|
|
181
|
+
font: inherit;
|
|
182
|
+
letter-spacing: inherit;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
& h6 {
|
|
186
|
+
margin: 0;
|
|
187
|
+
}
|
|
182
188
|
}
|
|
183
|
-
}
|
|
184
189
|
|
|
185
|
-
/* Control indicator (chevron) — fixed size for consistent alignment. */
|
|
186
|
-
.ds.accordion-item > .header > .chevron {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
190
|
+
/* Control indicator (chevron) — fixed size for consistent alignment. */
|
|
191
|
+
.ds.accordion-item > .header > .chevron {
|
|
192
|
+
flex-shrink: 0;
|
|
193
|
+
width: var(--accordion-item-chevron-size);
|
|
194
|
+
height: var(--accordion-item-chevron-size);
|
|
195
|
+
|
|
196
|
+
/* Closed: chevron points right (the down-glyph rotated -90deg). */
|
|
197
|
+
transform: rotate(-90deg);
|
|
198
|
+
transition: transform var(--motion-duration-fast)
|
|
199
|
+
var(--motion-easing-standard);
|
|
200
|
+
|
|
201
|
+
/* Chevron glyph from the Canonical icon set, masked so it can take the theme
|
|
202
|
+
icon colour (same technique as CheckboxInput's checkmark). */
|
|
203
|
+
&::before {
|
|
204
|
+
content: "";
|
|
205
|
+
display: block;
|
|
206
|
+
width: 100%;
|
|
207
|
+
height: 100%;
|
|
208
|
+
background-color: var(--accordion-item-color-icon);
|
|
209
|
+
mask-image: url("/icons/chevron-down.svg#chevron-down");
|
|
210
|
+
mask-repeat: no-repeat;
|
|
211
|
+
mask-position: center;
|
|
212
|
+
mask-size: contain;
|
|
213
|
+
-webkit-mask-image: url("/icons/chevron-down.svg#chevron-down");
|
|
214
|
+
-webkit-mask-repeat: no-repeat;
|
|
215
|
+
-webkit-mask-position: center;
|
|
216
|
+
-webkit-mask-size: contain;
|
|
217
|
+
}
|
|
212
218
|
}
|
|
213
|
-
}
|
|
214
219
|
|
|
215
|
-
/* Open: chevron points down (Figma: right when closed, down when open). */
|
|
216
|
-
.ds.accordion-item[open] > .header > .chevron {
|
|
217
|
-
|
|
218
|
-
}
|
|
220
|
+
/* Open: chevron points down (Figma: right when closed, down when open). */
|
|
221
|
+
.ds.accordion-item[open] > .header > .chevron {
|
|
222
|
+
transform: rotate(0deg);
|
|
223
|
+
}
|
|
219
224
|
|
|
220
|
-
@media (prefers-reduced-motion: reduce) {
|
|
221
|
-
|
|
222
|
-
|
|
225
|
+
@media (prefers-reduced-motion: reduce) {
|
|
226
|
+
.ds.accordion-item > .header > .chevron {
|
|
227
|
+
transition: none;
|
|
228
|
+
}
|
|
223
229
|
}
|
|
224
|
-
}
|
|
225
230
|
|
|
226
|
-
/* Content panel. Uses `.editorial` (a prose context) rather than `.p`, so the
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
.ds.accordion-item > .content {
|
|
231
|
-
|
|
231
|
+
/* Content panel. Uses `.editorial` (a prose context) rather than `.p`, so the
|
|
232
|
+
wrapper doesn't add baseline padding that would double up with content that
|
|
233
|
+
is already `.p`. The wrapper owns its own vertical padding in baseline
|
|
234
|
+
multiples, and is indented inline to align under the heading. */
|
|
235
|
+
.ds.accordion-item > .content {
|
|
236
|
+
color: var(--accordion-item-color-text);
|
|
232
237
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
238
|
+
padding-block: var(--accordion-item-content-padding-block);
|
|
239
|
+
padding-inline-start: var(--accordion-item-content-indent);
|
|
240
|
+
padding-inline-end: var(--accordion-item-content-padding-inline);
|
|
241
|
+
}
|
|
237
242
|
|
|
238
|
-
/* 1px divider baseline compensation: subtract the divider thickness from the
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
.ds.accordion-item:not([open]) > .header {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
243
|
+
/* 1px divider baseline compensation: subtract the divider thickness from the
|
|
244
|
+
block-end padding of whichever element sits directly above the item's
|
|
245
|
+
block-end border, so the item's border-box height stays a baseline multiple
|
|
246
|
+
(no drift down the list) without pulling the content up in the process.
|
|
247
|
+
- collapsed: only the header is shown -> compensate the header
|
|
248
|
+
- expanded: the content is at the bottom -> compensate the content */
|
|
249
|
+
.ds.accordion-item:not([open]) > .header {
|
|
250
|
+
padding-block-end: calc(
|
|
251
|
+
var(--accordion-item-header-padding-block) -
|
|
252
|
+
var(--dimension-stroke-thickness-medium)
|
|
253
|
+
);
|
|
254
|
+
}
|
|
250
255
|
|
|
251
|
-
.ds.accordion-item[open] > .content {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
256
|
+
.ds.accordion-item[open] > .content {
|
|
257
|
+
padding-block-end: calc(
|
|
258
|
+
var(--accordion-item-content-padding-block) -
|
|
259
|
+
var(--dimension-stroke-thickness-medium)
|
|
260
|
+
);
|
|
261
|
+
}
|
|
257
262
|
|
|
258
|
-
/* ── Density seat (intrinsic) — the header is a control-height row ───────────
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
:is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
263
|
+
/* ── Density seat (intrinsic) — the header is a control-height row ───────────
|
|
264
|
+
* Inside a density scope the header takes the SHARED control seat from
|
|
265
|
+
* @canonical/styles (modifiers.density.css), exactly like the Button and the
|
|
266
|
+
* form inputs: the heading's own line box (`--control-seat-line`, the cell
|
|
267
|
+
* minus one baseline of headroom per side) is the header interior;
|
|
268
|
+
* `--seat-before` lands its baseline on the density target; `--seat-after`
|
|
269
|
+
* closes the row to EXACTLY the density cell (32px apps-comfortable, 24px
|
|
270
|
+
* apps-dense, …) with no block-size anywhere. So an accordion header, a
|
|
271
|
+
* button, and an input in the same cell are the same height and their text
|
|
272
|
+
* shares one baseline index.
|
|
273
|
+
*
|
|
274
|
+
* The header carries no border of its own — the item's DIVIDER plays that
|
|
275
|
+
* role, and only on the collapsed face: collapsed, the divider renders
|
|
276
|
+
* directly under the header, so the closing pad absorbs its thickness
|
|
277
|
+
* (header + divider = the cell); expanded, the divider sits after the content
|
|
278
|
+
* and the content's own compensation above owns it — the header keeps the full
|
|
279
|
+
* closing pad. This is the per-state split the pre-density compensation rules
|
|
280
|
+
* above apply to the legacy (non-density) look.
|
|
281
|
+
*
|
|
282
|
+
* The chevron needs no new rule: the header's `align-items: center` centres it
|
|
283
|
+
* on the flex line, whose cross-size IS the heading's line box — the same
|
|
284
|
+
* "centre on the glyph run" pairing the input affixes use.
|
|
285
|
+
*
|
|
286
|
+
* KNOWN LIMIT: an <h6> heading keeps its own engine line-height (see the
|
|
287
|
+
* heading rule above), so its line box may differ from --control-seat-line;
|
|
288
|
+
* the h6-in-header case is owned by a later pass. The default (body-tier)
|
|
289
|
+
* heading is exact. */
|
|
290
|
+
:is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item {
|
|
291
|
+
/* The CONTENT panel consumes the density system's semantic spacing rung for
|
|
292
|
+
its block padding — space-md (16px apps-comfortable, 8px apps-dense,
|
|
293
|
+
20/12px sites) — instead of the fixed 1 bU, so the panel's breathing room
|
|
294
|
+
follows the density cell. Every rung is a whole baseline multiple, so the
|
|
295
|
+
rhythm holds; the [open] divider compensation reads this same token, so it
|
|
296
|
+
follows automatically. Outside a density scope the :root default stands. */
|
|
297
|
+
--accordion-item-content-padding-block: var(
|
|
298
|
+
--density-space-md,
|
|
299
|
+
var(--dimension-100)
|
|
300
|
+
);
|
|
301
|
+
}
|
|
297
302
|
|
|
298
|
-
:is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item > .header {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
:is(.comfortable, .dense, .app, .site, .docs)
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
:is(.comfortable, .dense, .app, .site, .docs)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
303
|
+
:is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item > .header {
|
|
304
|
+
/* No border above the heading inside the header, so no border term. Rounded
|
|
305
|
+
to ¼px for exact layout-unit representability (see the shared seat). */
|
|
306
|
+
--seat-before: round(nearest, max(0px, var(--control-seat-basis)), 0.25px);
|
|
307
|
+
--seat-after: max(
|
|
308
|
+
0px,
|
|
309
|
+
calc(
|
|
310
|
+
var(--density-line-height-effective) -
|
|
311
|
+
var(--control-seat-line) -
|
|
312
|
+
var(--seat-before)
|
|
313
|
+
)
|
|
314
|
+
);
|
|
315
|
+
padding-block: var(--seat-before) var(--seat-after);
|
|
316
|
+
}
|
|
317
|
+
:is(.comfortable, .dense, .app, .site, .docs)
|
|
318
|
+
.ds.accordion-item:not([open])
|
|
319
|
+
> .header {
|
|
320
|
+
/* Collapsed: absorb the item divider below, keeping header + divider = cell. */
|
|
321
|
+
padding-block-end: max(
|
|
322
|
+
0px,
|
|
323
|
+
calc(var(--seat-after) - var(--dimension-stroke-thickness-medium))
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
:is(.comfortable, .dense, .app, .site, .docs)
|
|
327
|
+
.ds.accordion-item
|
|
328
|
+
> .header
|
|
329
|
+
> .heading {
|
|
330
|
+
line-height: var(--control-seat-line);
|
|
331
|
+
}
|
|
326
332
|
}
|