@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.
Files changed (192) hide show
  1. package/README.md +72 -0
  2. package/dist/esm/lib/_work_in_progress/Announcement/styles.css +51 -47
  3. package/dist/esm/lib/_work_in_progress/CategoriesSection/common/Category/styles.css +21 -17
  4. package/dist/esm/lib/_work_in_progress/CategoriesSection/styles.css +16 -12
  5. package/dist/esm/lib/_work_in_progress/ChatSection/styles.css +22 -18
  6. package/dist/esm/lib/_work_in_progress/DescriptionSection/styles.css +14 -10
  7. package/dist/esm/lib/_work_in_progress/IconSection/styles.css +18 -14
  8. package/dist/esm/lib/_work_in_progress/Label/styles.css +36 -32
  9. package/dist/esm/lib/_work_in_progress/Link/styles.css +32 -28
  10. package/dist/esm/lib/_work_in_progress/Rule/styles.css +21 -14
  11. package/dist/esm/lib/_work_in_progress/Section/styles.css +66 -62
  12. package/dist/esm/lib/_work_in_progress/SkipLink/styles.css +35 -32
  13. package/dist/esm/lib/_work_in_progress/TSection/styles.css +26 -22
  14. package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js +4 -1
  15. package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js.map +1 -1
  16. package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/styles.css +21 -17
  17. package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js +4 -1
  18. package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js.map +1 -1
  19. package/dist/esm/lib/_work_in_progress/grid/GridCard/styles.css +8 -4
  20. package/dist/esm/lib/_work_in_progress/grid/InnerGridDemo/styles.css +38 -33
  21. package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js +4 -1
  22. package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js.map +1 -1
  23. package/dist/esm/lib/_work_in_progress/grid/SettingsView/styles.css +23 -19
  24. package/dist/esm/lib/component/Accordion/common/Item/styles.css +305 -299
  25. package/dist/esm/lib/component/Accordion/styles.css +35 -31
  26. package/dist/esm/lib/component/Badge/hooks/useBadge.js +1 -1
  27. package/dist/esm/lib/component/Badge/hooks/useBadge.js.map +1 -1
  28. package/dist/esm/lib/component/Badge/styles.css +45 -41
  29. package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js +1 -1
  30. package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js.map +1 -1
  31. package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +69 -65
  32. package/dist/esm/lib/component/Breadcrumbs/styles.css +30 -26
  33. package/dist/esm/lib/component/Button/styles.css +293 -260
  34. package/dist/esm/lib/component/Card/common/Content/styles.css +27 -23
  35. package/dist/esm/lib/component/Card/common/Footer/styles.css +30 -26
  36. package/dist/esm/lib/component/Card/common/Header/styles.css +25 -21
  37. package/dist/esm/lib/component/Card/common/Image/styles.css +8 -4
  38. package/dist/esm/lib/component/Card/styles.css +77 -73
  39. package/dist/esm/lib/component/Chip/Chip.js.map +1 -1
  40. package/dist/esm/lib/component/Chip/styles.css +105 -101
  41. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +29 -20
  42. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -1
  43. package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js +25 -2
  44. package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js.map +1 -1
  45. package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +116 -106
  46. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js +29 -9
  47. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -1
  48. package/dist/esm/lib/component/ContextualMenu/styles.css +74 -72
  49. package/dist/esm/lib/component/Icon/styles.css +24 -20
  50. package/dist/esm/lib/component/InlineCode/styles.css +19 -15
  51. package/dist/esm/lib/component/KeyboardKey/styles.css +44 -40
  52. package/dist/esm/lib/component/Popover/Popover.js.map +1 -1
  53. package/dist/esm/lib/component/Popover/styles.css +59 -52
  54. package/dist/esm/lib/component/Tabs/common/Item/styles.css +80 -76
  55. package/dist/esm/lib/component/Tabs/styles.css +36 -32
  56. package/dist/esm/lib/component/Tile/common/Content/styles.css +28 -24
  57. package/dist/esm/lib/component/Tile/common/Header/styles.css +28 -24
  58. package/dist/esm/lib/component/Tile/styles.css +31 -27
  59. package/dist/esm/lib/component/Tooltip/styles.css +213 -208
  60. package/dist/esm/lib/group/Cards/styles.css +26 -22
  61. package/dist/esm/lib/group/KeyboardKeys/styles.css +14 -10
  62. package/dist/esm/lib/hooks/useContextualMenu/index.js +1 -0
  63. package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -1
  64. package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js +11 -0
  65. package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js.map +1 -0
  66. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +54 -34
  67. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -1
  68. package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -1
  69. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +1 -1
  70. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
  71. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +3 -0
  72. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
  73. package/dist/esm/lib/index.css +79 -0
  74. package/dist/esm/lib/pattern/Modal/Context.js +10 -0
  75. package/dist/esm/lib/pattern/Modal/Context.js.map +1 -0
  76. package/dist/esm/lib/pattern/Modal/Provider.js +103 -0
  77. package/dist/esm/lib/pattern/Modal/Provider.js.map +1 -0
  78. package/dist/esm/lib/pattern/Modal/common/Content/Content.js +15 -0
  79. package/dist/esm/lib/pattern/Modal/common/Content/Content.js.map +1 -0
  80. package/dist/esm/lib/pattern/Modal/common/Content/index.js +3 -0
  81. package/dist/esm/lib/pattern/Modal/common/Content/index.js.map +1 -0
  82. package/dist/esm/lib/pattern/Modal/common/Content/styles.css +37 -0
  83. package/dist/esm/lib/pattern/Modal/common/Content/types.js +2 -0
  84. package/dist/esm/lib/pattern/Modal/common/Content/types.js.map +1 -0
  85. package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js +16 -0
  86. package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js.map +1 -0
  87. package/dist/esm/lib/pattern/Modal/common/Footer/index.js +3 -0
  88. package/dist/esm/lib/pattern/Modal/common/Footer/index.js.map +1 -0
  89. package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +57 -0
  90. package/dist/esm/lib/pattern/Modal/common/Footer/types.js +2 -0
  91. package/dist/esm/lib/pattern/Modal/common/Footer/types.js.map +1 -0
  92. package/dist/esm/lib/pattern/Modal/common/Header/Header.js +27 -0
  93. package/dist/esm/lib/pattern/Modal/common/Header/Header.js.map +1 -0
  94. package/dist/esm/lib/pattern/Modal/common/Header/index.js +3 -0
  95. package/dist/esm/lib/pattern/Modal/common/Header/index.js.map +1 -0
  96. package/dist/esm/lib/pattern/Modal/common/Header/styles.css +79 -0
  97. package/dist/esm/lib/pattern/Modal/common/Header/types.js +2 -0
  98. package/dist/esm/lib/pattern/Modal/common/Header/types.js.map +1 -0
  99. package/dist/esm/lib/pattern/Modal/common/index.js +5 -0
  100. package/dist/esm/lib/pattern/Modal/common/index.js.map +1 -0
  101. package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js +11 -0
  102. package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js.map +1 -0
  103. package/dist/esm/lib/pattern/Modal/hooks/useModalState.js +15 -0
  104. package/dist/esm/lib/pattern/Modal/hooks/useModalState.js.map +1 -0
  105. package/dist/esm/lib/pattern/Modal/index.js +4 -0
  106. package/dist/esm/lib/pattern/Modal/index.js.map +1 -0
  107. package/dist/esm/lib/pattern/Modal/styles.css +119 -0
  108. package/dist/esm/lib/pattern/Modal/types.js +2 -0
  109. package/dist/esm/lib/pattern/Modal/types.js.map +1 -0
  110. package/dist/esm/lib/pattern/Modal/withModal.js +102 -0
  111. package/dist/esm/lib/pattern/Modal/withModal.js.map +1 -0
  112. package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +16 -12
  113. package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +116 -112
  114. package/dist/esm/lib/pattern/Timeline/styles.css +16 -12
  115. package/dist/esm/lib/pattern/index.js +1 -0
  116. package/dist/esm/lib/pattern/index.js.map +1 -1
  117. package/dist/esm/lib/subcomponent/Spinner/styles.css +38 -34
  118. package/dist/types/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
  119. package/dist/types/lib/_work_in_progress/grid/GridCard/GridCard.d.ts.map +1 -1
  120. package/dist/types/lib/_work_in_progress/grid/SettingsView/SettingsView.d.ts.map +1 -1
  121. package/dist/types/lib/component/Badge/types.d.ts +1 -1
  122. package/dist/types/lib/component/Badge/types.d.ts.map +1 -1
  123. package/dist/types/lib/component/Breadcrumbs/types.d.ts +2 -2
  124. package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
  125. package/dist/types/lib/component/Chip/Chip.d.ts +2 -2
  126. package/dist/types/lib/component/Chip/Chip.d.ts.map +1 -1
  127. package/dist/types/lib/component/Chip/types.d.ts +10 -8
  128. package/dist/types/lib/component/Chip/types.d.ts.map +1 -1
  129. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +4 -4
  130. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -1
  131. package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -1
  132. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +1 -1
  133. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -1
  134. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +9 -7
  135. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -1
  136. package/dist/types/lib/component/ContextualMenu/types.d.ts +14 -6
  137. package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -1
  138. package/dist/types/lib/component/Tabs/types.d.ts +2 -2
  139. package/dist/types/lib/component/Tabs/types.d.ts.map +1 -1
  140. package/dist/types/lib/hooks/useContextualMenu/index.d.ts +1 -0
  141. package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -1
  142. package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts +13 -0
  143. package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts.map +1 -0
  144. package/dist/types/lib/hooks/useContextualMenu/types.d.ts +45 -15
  145. package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -1
  146. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +5 -6
  147. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -1
  148. package/dist/types/lib/hooks/useDisclosure/types.d.ts +7 -2
  149. package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -1
  150. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +1 -1
  151. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -1
  152. package/dist/types/lib/hooks/useWindowFitment/types.d.ts +12 -3
  153. package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
  154. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +1 -1
  155. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
  156. package/dist/types/lib/pattern/Modal/Context.d.ts +10 -0
  157. package/dist/types/lib/pattern/Modal/Context.d.ts.map +1 -0
  158. package/dist/types/lib/pattern/Modal/Provider.d.ts +63 -0
  159. package/dist/types/lib/pattern/Modal/Provider.d.ts.map +1 -0
  160. package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts +17 -0
  161. package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts.map +1 -0
  162. package/dist/types/lib/pattern/Modal/common/Content/index.d.ts +3 -0
  163. package/dist/types/lib/pattern/Modal/common/Content/index.d.ts.map +1 -0
  164. package/dist/types/lib/pattern/Modal/common/Content/types.d.ts +15 -0
  165. package/dist/types/lib/pattern/Modal/common/Content/types.d.ts.map +1 -0
  166. package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts +18 -0
  167. package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts.map +1 -0
  168. package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts +3 -0
  169. package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts.map +1 -0
  170. package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts +16 -0
  171. package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts.map +1 -0
  172. package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts +24 -0
  173. package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts.map +1 -0
  174. package/dist/types/lib/pattern/Modal/common/Header/index.d.ts +3 -0
  175. package/dist/types/lib/pattern/Modal/common/Header/index.d.ts.map +1 -0
  176. package/dist/types/lib/pattern/Modal/common/Header/types.d.ts +36 -0
  177. package/dist/types/lib/pattern/Modal/common/Header/types.d.ts.map +1 -0
  178. package/dist/types/lib/pattern/Modal/common/index.d.ts +4 -0
  179. package/dist/types/lib/pattern/Modal/common/index.d.ts.map +1 -0
  180. package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts +4 -0
  181. package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts.map +1 -0
  182. package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts +10 -0
  183. package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts.map +1 -0
  184. package/dist/types/lib/pattern/Modal/index.d.ts +4 -0
  185. package/dist/types/lib/pattern/Modal/index.d.ts.map +1 -0
  186. package/dist/types/lib/pattern/Modal/types.d.ts +122 -0
  187. package/dist/types/lib/pattern/Modal/types.d.ts.map +1 -0
  188. package/dist/types/lib/pattern/Modal/withModal.d.ts +74 -0
  189. package/dist/types/lib/pattern/Modal/withModal.d.ts.map +1 -0
  190. package/dist/types/lib/pattern/index.d.ts +1 -0
  191. package/dist/types/lib/pattern/index.d.ts.map +1 -1
  192. package/package.json +28 -18
@@ -1,326 +1,332 @@
1
- /**
2
- * Accordion.Item styles
3
- * @implements ds:global.subcomponent.accordion-item
4
- *
5
- * Rendered with native <details>/<summary>. Typography and baseline alignment
6
- * come from the `.p` class on the heading and content. Tokens follow the Figma
7
- * spec: header interactive background uses the ghost surface channel (which
8
- * auto-steps on nested .surface contexts to layer2/layer3), text uses
9
- * color-text, the chevron uses color-icon, and dividers use color-border-muted.
10
- * Vertical padding is expressed in baseline multiples.
11
- *
12
- * NOTE: the apps/sites element-size sizing (collapsed item at 36px sites / 32px
13
- * apps, and the matching h6 line box) is intentionally NOT set here — control
14
- * heights across apps vs sites are owned by the density/height bucket, not this
15
- * design-review geometry pass.
16
- */
17
- :root {
18
- --accordion-item-color-text: var(--color-text);
19
- --accordion-item-color-icon: var(--color-icon);
20
- --accordion-item-color-border: var(--color-border-muted);
21
-
22
- /* Items have no side (inline) borders by default — the docs show only the
23
- block-end divider. This token is an intentional extension point: it
24
- references a currently-undefined colour, so it resolves to no border, but
25
- a theme/consumer can supply `--accordion-item-border-inline-color` to turn
26
- inline borders on without changing the component. */
27
- --accordion-item-border-inline: var(--dimension-stroke-thickness-medium) solid
28
- var(--accordion-item-border-inline-color);
29
-
30
- /* Default header background (surface 1). The surface channel is applied on
31
- the element below — NOT here — because a var() referencing
32
- --surface-color-foreground-ghost resolved in :root would capture the :root
33
- value (where no .surface is active) and never step. The built surface
34
- layer re-channels only the base ghost (no hover/active channel), so
35
- hover/active default to the non-layered ghost state vars here and are
36
- re-pointed per surface nesting depth by the stopgap rules below the
37
- header. */
38
- --accordion-item-header-background: var(--color-foreground-ghost);
39
- --accordion-item-header-background-hover: var(--color-foreground-ghost-hover);
40
- --accordion-item-header-background-active: var(
41
- --color-foreground-ghost-active
42
- );
43
-
44
- --accordion-item-header-gap: var(--dimension-200);
45
- /* Header block padding in baseline multiples (dimension-100 = 1 bU). The
46
- apps/sites element-size sizing (6px → 36/32) is owned by the height bucket. */
47
- --accordion-item-header-padding-block: var(--dimension-100);
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
- .ds.accordion-item {
69
- /* Inline (side) borders — off by default, see the token above. */
70
- border-inline: var(--accordion-item-border-inline);
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
- /* Divider at the end of each item (Figma anatomy #6: "the divider at the end
73
- of an accordion item indicates the end of an accordion item"). */
74
- border-block-end: var(--dimension-stroke-thickness-medium) solid
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
- /* Header tab — the native <summary>. The chevron is a fixed size, so a fixed
79
- chevron column keeps all headings left-aligned; align-items:center centres
80
- the fixed chevron on the header line. */
81
- .ds.accordion-item > .header {
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
- /* Prefer the surface hover/active channels so a future token build that
108
- ships them steps automatically; today they are unset everywhere, so these
109
- resolve to the fallback tokens, re-pointed per nesting depth below. */
110
- &:hover {
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-hover,
113
- var(--accordion-item-header-background-hover)
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
- &:active {
118
- background-color: var(
119
- --surface-color-foreground-ghost-active,
120
- var(--accordion-item-header-background-active)
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
- /* The consumer supplies the heading content — plain text by default (rendered
153
- as the text-primary body tier) or an <h6>, which renders at the heading-6
154
- tier. Only those two type tokens are allowed on the accordion heading; any
155
- other heading element is normalised to the text-primary body tier. */
156
- .ds.accordion-item > .header > .heading {
157
- flex: 1;
158
- min-width: 0;
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
- & h6 {
181
- margin: 0;
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
- flex-shrink: 0;
188
- width: var(--accordion-item-chevron-size);
189
- height: var(--accordion-item-chevron-size);
190
-
191
- /* Closed: chevron points right (the down-glyph rotated -90deg). */
192
- transform: rotate(-90deg);
193
- transition: transform var(--motion-duration-fast)
194
- var(--motion-easing-standard);
195
-
196
- /* Chevron glyph from the Canonical icon set, masked so it can take the theme
197
- icon colour (same technique as CheckboxInput's checkmark). */
198
- &::before {
199
- content: "";
200
- display: block;
201
- width: 100%;
202
- height: 100%;
203
- background-color: var(--accordion-item-color-icon);
204
- mask-image: url("/icons/chevron-down.svg#chevron-down");
205
- mask-repeat: no-repeat;
206
- mask-position: center;
207
- mask-size: contain;
208
- -webkit-mask-image: url("/icons/chevron-down.svg#chevron-down");
209
- -webkit-mask-repeat: no-repeat;
210
- -webkit-mask-position: center;
211
- -webkit-mask-size: contain;
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
- transform: rotate(0deg);
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
- .ds.accordion-item > .header > .chevron {
222
- transition: none;
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
- wrapper doesn't add baseline padding that would double up with content that
228
- is already `.p`. The wrapper owns its own vertical padding in baseline
229
- multiples, and is indented inline to align under the heading. */
230
- .ds.accordion-item > .content {
231
- color: var(--accordion-item-color-text);
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
- padding-block: var(--accordion-item-content-padding-block);
234
- padding-inline-start: var(--accordion-item-content-indent);
235
- padding-inline-end: var(--accordion-item-content-padding-inline);
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
- block-end padding of whichever element sits directly above the item's
240
- block-end border, so the item's border-box height stays a baseline multiple
241
- (no drift down the list) without pulling the content up in the process.
242
- - collapsed: only the header is shown -> compensate the header
243
- - expanded: the content is at the bottom -> compensate the content */
244
- .ds.accordion-item:not([open]) > .header {
245
- padding-block-end: calc(
246
- var(--accordion-item-header-padding-block) -
247
- var(--dimension-stroke-thickness-medium)
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
- padding-block-end: calc(
253
- var(--accordion-item-content-padding-block) -
254
- var(--dimension-stroke-thickness-medium)
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
- * Inside a density scope the header takes the SHARED control seat from
260
- * @canonical/styles (modifiers.density.css), exactly like the Button and the
261
- * form inputs: the heading's own line box (`--control-seat-line`, the cell
262
- * minus one baseline of headroom per side) is the header interior;
263
- * `--seat-before` lands its baseline on the density target; `--seat-after`
264
- * closes the row to EXACTLY the density cell (32px apps-comfortable, 24px
265
- * apps-dense, …) with no block-size anywhere. So an accordion header, a
266
- * button, and an input in the same cell are the same height and their text
267
- * shares one baseline index.
268
- *
269
- * The header carries no border of its own — the item's DIVIDER plays that
270
- * role, and only on the collapsed face: collapsed, the divider renders
271
- * directly under the header, so the closing pad absorbs its thickness
272
- * (header + divider = the cell); expanded, the divider sits after the content
273
- * and the content's own compensation above owns it — the header keeps the full
274
- * closing pad. This is the per-state split the pre-density compensation rules
275
- * above apply to the legacy (non-density) look.
276
- *
277
- * The chevron needs no new rule: the header's `align-items: center` centres it
278
- * on the flex line, whose cross-size IS the heading's line box — the same
279
- * "centre on the glyph run" pairing the input affixes use.
280
- *
281
- * KNOWN LIMIT: an <h6> heading keeps its own engine line-height (see the
282
- * heading rule above), so its line box may differ from --control-seat-line;
283
- * the h6-in-header case is owned by a later pass. The default (body-tier)
284
- * heading is exact. */
285
- :is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item {
286
- /* The CONTENT panel consumes the density system's semantic spacing rung for
287
- its block padding — space-md (16px apps-comfortable, 8px apps-dense,
288
- 20/12px sites) — instead of the fixed 1 bU, so the panel's breathing room
289
- follows the density cell. Every rung is a whole baseline multiple, so the
290
- rhythm holds; the [open] divider compensation reads this same token, so it
291
- follows automatically. Outside a density scope the :root default stands. */
292
- --accordion-item-content-padding-block: var(
293
- --density-space-md,
294
- var(--dimension-100)
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
- /* No border above the heading inside the header, so no border term. Rounded
300
- to ¼px for exact layout-unit representability (see the shared seat). */
301
- --seat-before: round(nearest, max(0px, var(--control-seat-basis)), 0.25px);
302
- --seat-after: max(
303
- 0px,
304
- calc(
305
- var(--density-line-height-effective) -
306
- var(--control-seat-line) -
307
- var(--seat-before)
308
- )
309
- );
310
- padding-block: var(--seat-before) var(--seat-after);
311
- }
312
- :is(.comfortable, .dense, .app, .site, .docs)
313
- .ds.accordion-item:not([open])
314
- > .header {
315
- /* Collapsed: absorb the item divider below, keeping header + divider = cell. */
316
- padding-block-end: max(
317
- 0px,
318
- calc(var(--seat-after) - var(--dimension-stroke-thickness-medium))
319
- );
320
- }
321
- :is(.comfortable, .dense, .app, .site, .docs)
322
- .ds.accordion-item
323
- > .header
324
- > .heading {
325
- line-height: var(--control-seat-line);
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
  }