@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.
Files changed (204) 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 +30 -22
  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 -10
  47. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -1
  48. package/dist/esm/lib/component/ContextualMenu/styles.css +73 -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/TooltipEngine.js +66 -0
  60. package/dist/esm/lib/component/Tooltip/TooltipEngine.js.map +1 -0
  61. package/dist/esm/lib/component/Tooltip/index.js +1 -0
  62. package/dist/esm/lib/component/Tooltip/index.js.map +1 -1
  63. package/dist/esm/lib/component/Tooltip/styles.css +213 -208
  64. package/dist/esm/lib/component/Tooltip/withTooltip.js +11 -63
  65. package/dist/esm/lib/component/Tooltip/withTooltip.js.map +1 -1
  66. package/dist/esm/lib/group/Cards/styles.css +26 -22
  67. package/dist/esm/lib/group/KeyboardKeys/styles.css +14 -10
  68. package/dist/esm/lib/hooks/useContextualMenu/index.js +1 -0
  69. package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -1
  70. package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js +11 -0
  71. package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js.map +1 -0
  72. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +54 -34
  73. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -1
  74. package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -1
  75. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +1 -1
  76. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
  77. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +29 -6
  78. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
  79. package/dist/esm/lib/index.css +79 -0
  80. package/dist/esm/lib/pattern/Modal/Context.js +10 -0
  81. package/dist/esm/lib/pattern/Modal/Context.js.map +1 -0
  82. package/dist/esm/lib/pattern/Modal/Provider.js +103 -0
  83. package/dist/esm/lib/pattern/Modal/Provider.js.map +1 -0
  84. package/dist/esm/lib/pattern/Modal/common/Content/Content.js +15 -0
  85. package/dist/esm/lib/pattern/Modal/common/Content/Content.js.map +1 -0
  86. package/dist/esm/lib/pattern/Modal/common/Content/index.js +3 -0
  87. package/dist/esm/lib/pattern/Modal/common/Content/index.js.map +1 -0
  88. package/dist/esm/lib/pattern/Modal/common/Content/styles.css +37 -0
  89. package/dist/esm/lib/pattern/Modal/common/Content/types.js +2 -0
  90. package/dist/esm/lib/pattern/Modal/common/Content/types.js.map +1 -0
  91. package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js +16 -0
  92. package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js.map +1 -0
  93. package/dist/esm/lib/pattern/Modal/common/Footer/index.js +3 -0
  94. package/dist/esm/lib/pattern/Modal/common/Footer/index.js.map +1 -0
  95. package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +57 -0
  96. package/dist/esm/lib/pattern/Modal/common/Footer/types.js +2 -0
  97. package/dist/esm/lib/pattern/Modal/common/Footer/types.js.map +1 -0
  98. package/dist/esm/lib/pattern/Modal/common/Header/Header.js +27 -0
  99. package/dist/esm/lib/pattern/Modal/common/Header/Header.js.map +1 -0
  100. package/dist/esm/lib/pattern/Modal/common/Header/index.js +3 -0
  101. package/dist/esm/lib/pattern/Modal/common/Header/index.js.map +1 -0
  102. package/dist/esm/lib/pattern/Modal/common/Header/styles.css +79 -0
  103. package/dist/esm/lib/pattern/Modal/common/Header/types.js +2 -0
  104. package/dist/esm/lib/pattern/Modal/common/Header/types.js.map +1 -0
  105. package/dist/esm/lib/pattern/Modal/common/index.js +5 -0
  106. package/dist/esm/lib/pattern/Modal/common/index.js.map +1 -0
  107. package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js +11 -0
  108. package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js.map +1 -0
  109. package/dist/esm/lib/pattern/Modal/hooks/useModalState.js +15 -0
  110. package/dist/esm/lib/pattern/Modal/hooks/useModalState.js.map +1 -0
  111. package/dist/esm/lib/pattern/Modal/index.js +4 -0
  112. package/dist/esm/lib/pattern/Modal/index.js.map +1 -0
  113. package/dist/esm/lib/pattern/Modal/styles.css +119 -0
  114. package/dist/esm/lib/pattern/Modal/types.js +2 -0
  115. package/dist/esm/lib/pattern/Modal/types.js.map +1 -0
  116. package/dist/esm/lib/pattern/Modal/withModal.js +102 -0
  117. package/dist/esm/lib/pattern/Modal/withModal.js.map +1 -0
  118. package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +16 -12
  119. package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +116 -112
  120. package/dist/esm/lib/pattern/Timeline/styles.css +16 -12
  121. package/dist/esm/lib/pattern/index.js +1 -0
  122. package/dist/esm/lib/pattern/index.js.map +1 -1
  123. package/dist/esm/lib/subcomponent/Spinner/styles.css +38 -34
  124. package/dist/types/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
  125. package/dist/types/lib/_work_in_progress/grid/GridCard/GridCard.d.ts.map +1 -1
  126. package/dist/types/lib/_work_in_progress/grid/SettingsView/SettingsView.d.ts.map +1 -1
  127. package/dist/types/lib/component/Badge/types.d.ts +1 -1
  128. package/dist/types/lib/component/Badge/types.d.ts.map +1 -1
  129. package/dist/types/lib/component/Breadcrumbs/types.d.ts +2 -2
  130. package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
  131. package/dist/types/lib/component/Chip/Chip.d.ts +2 -2
  132. package/dist/types/lib/component/Chip/Chip.d.ts.map +1 -1
  133. package/dist/types/lib/component/Chip/types.d.ts +10 -8
  134. package/dist/types/lib/component/Chip/types.d.ts.map +1 -1
  135. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +4 -4
  136. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -1
  137. package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -1
  138. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +1 -1
  139. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -1
  140. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +9 -7
  141. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -1
  142. package/dist/types/lib/component/ContextualMenu/types.d.ts +15 -7
  143. package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -1
  144. package/dist/types/lib/component/Tabs/types.d.ts +2 -2
  145. package/dist/types/lib/component/Tabs/types.d.ts.map +1 -1
  146. package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts +16 -0
  147. package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts.map +1 -0
  148. package/dist/types/lib/component/Tooltip/index.d.ts +1 -0
  149. package/dist/types/lib/component/Tooltip/index.d.ts.map +1 -1
  150. package/dist/types/lib/component/Tooltip/withTooltip.d.ts +9 -3
  151. package/dist/types/lib/component/Tooltip/withTooltip.d.ts.map +1 -1
  152. package/dist/types/lib/hooks/useContextualMenu/index.d.ts +1 -0
  153. package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -1
  154. package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts +13 -0
  155. package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts.map +1 -0
  156. package/dist/types/lib/hooks/useContextualMenu/types.d.ts +45 -15
  157. package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -1
  158. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +5 -6
  159. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -1
  160. package/dist/types/lib/hooks/useDisclosure/types.d.ts +7 -2
  161. package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -1
  162. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +1 -1
  163. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -1
  164. package/dist/types/lib/hooks/useWindowFitment/types.d.ts +12 -3
  165. package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
  166. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +11 -6
  167. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
  168. package/dist/types/lib/pattern/Modal/Context.d.ts +10 -0
  169. package/dist/types/lib/pattern/Modal/Context.d.ts.map +1 -0
  170. package/dist/types/lib/pattern/Modal/Provider.d.ts +63 -0
  171. package/dist/types/lib/pattern/Modal/Provider.d.ts.map +1 -0
  172. package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts +17 -0
  173. package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts.map +1 -0
  174. package/dist/types/lib/pattern/Modal/common/Content/index.d.ts +3 -0
  175. package/dist/types/lib/pattern/Modal/common/Content/index.d.ts.map +1 -0
  176. package/dist/types/lib/pattern/Modal/common/Content/types.d.ts +15 -0
  177. package/dist/types/lib/pattern/Modal/common/Content/types.d.ts.map +1 -0
  178. package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts +18 -0
  179. package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts.map +1 -0
  180. package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts +3 -0
  181. package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts.map +1 -0
  182. package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts +16 -0
  183. package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts.map +1 -0
  184. package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts +24 -0
  185. package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts.map +1 -0
  186. package/dist/types/lib/pattern/Modal/common/Header/index.d.ts +3 -0
  187. package/dist/types/lib/pattern/Modal/common/Header/index.d.ts.map +1 -0
  188. package/dist/types/lib/pattern/Modal/common/Header/types.d.ts +36 -0
  189. package/dist/types/lib/pattern/Modal/common/Header/types.d.ts.map +1 -0
  190. package/dist/types/lib/pattern/Modal/common/index.d.ts +4 -0
  191. package/dist/types/lib/pattern/Modal/common/index.d.ts.map +1 -0
  192. package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts +4 -0
  193. package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts.map +1 -0
  194. package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts +10 -0
  195. package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts.map +1 -0
  196. package/dist/types/lib/pattern/Modal/index.d.ts +4 -0
  197. package/dist/types/lib/pattern/Modal/index.d.ts.map +1 -0
  198. package/dist/types/lib/pattern/Modal/types.d.ts +122 -0
  199. package/dist/types/lib/pattern/Modal/types.d.ts.map +1 -0
  200. package/dist/types/lib/pattern/Modal/withModal.d.ts +74 -0
  201. package/dist/types/lib/pattern/Modal/withModal.d.ts.map +1 -0
  202. package/dist/types/lib/pattern/index.d.ts +1 -0
  203. package/dist/types/lib/pattern/index.d.ts.map +1 -1
  204. package/package.json +28 -18
@@ -1,86 +1,87 @@
1
- /* Component tokens — sourced from @canonical/design-tokens.
2
- Mapped strictly to the Figma "Contextual Menu" frame: white background
3
- (color-background) on the modal surface, a drop shadow (no border), and a
4
- muted 1px divider between groups. */
5
- :root {
6
- --contextual-menu-color-divider: var(--color-border-muted);
7
- --contextual-menu-divider-width: var(--dimension-stroke-thickness-medium);
8
- --contextual-menu-min-width: 12rem;
9
- --contextual-menu-max-width: 20rem;
10
- /* Three-layer drop shadow from the Figma effect. */
11
- --contextual-menu-shadow:
12
- 0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 2px 2px -1px rgba(0, 0, 0, 0.15),
13
- 0 0 3px 0 rgba(0, 0, 0, 0.2);
14
- --contextual-menu-motion-duration: 0.12s;
15
- }
16
-
17
- .ds.contextual-menu {
18
- display: inline-block;
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
19
2
 
20
- > .trigger {
21
- cursor: pointer;
3
+ @layer ds.components.global {
4
+ /* Component tokens — sourced from @canonical/design-tokens.
5
+ Mapped strictly to the Figma "Contextual Menu" frame: white background
6
+ (color-background), a drop shadow (no border), and a
7
+ muted 1px divider between sections. */
8
+ :root {
9
+ --contextual-menu-color-divider: var(--color-border-muted);
10
+ --contextual-menu-divider-width: var(--dimension-stroke-thickness-medium);
11
+ --contextual-menu-min-width: 12rem;
12
+ --contextual-menu-max-width: 20rem;
13
+ /* Three-layer drop shadow from the Figma effect. */
14
+ --contextual-menu-shadow:
15
+ 0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 2px 2px -1px rgba(0, 0, 0, 0.15),
16
+ 0 0 3px 0 rgba(0, 0, 0, 0.2);
17
+ --contextual-menu-motion-duration: 0.12s;
22
18
  }
23
- }
24
-
25
- .ds.contextual-menu__surface {
26
- position: fixed;
27
- z-index: var(--z-index-overlay, 100);
28
- min-width: var(--contextual-menu-min-width);
29
- max-width: var(--contextual-menu-max-width);
30
- /* A menu (or submenu) taller than the viewport scrolls INSIDE itself instead
31
- of overflowing off-screen — otherwise keyboard-navigating to an item below
32
- the fold would move the highlight to an item that is not visible. The
33
- highlighted item is scrolled into view on keyboard nav (see Item). */
34
- max-block-size: calc(100dvh - 2 * var(--dimension-200, 16px));
35
- overflow-y: auto;
36
- overscroll-behavior: contain;
37
- /* Read the surface channel directly on this element so the `.modal` surface
38
- applied here resolves (a :root intermediate would see it unset). */
39
- background-color: var(--surface-color-background, var(--color-background));
40
- box-shadow: var(--contextual-menu-shadow);
41
-
42
- /* CSS-only enter/exit animation. */
43
- opacity: 0;
44
- visibility: hidden;
45
- transition:
46
- opacity var(--contextual-menu-motion-duration) ease-in-out,
47
- visibility var(--contextual-menu-motion-duration) allow-discrete;
48
19
 
49
- &[aria-hidden="false"] {
50
- opacity: 1;
51
- visibility: visible;
20
+ .ds.contextual-menu {
21
+ display: inline-block;
52
22
 
53
- @starting-style {
54
- opacity: 0;
23
+ > .trigger {
24
+ cursor: pointer;
55
25
  }
56
26
  }
57
27
 
58
- /* A submenu mounts on open but is positioned a frame later; keep it hidden
59
- until `data-positioned` so it never paints at the fallback top:0/left:0. */
60
- &.submenu[aria-hidden="false"]:not([data-positioned="true"]) {
28
+ .ds.contextual-menu__surface {
29
+ position: fixed;
30
+ z-index: var(--z-index-overlay, 100);
31
+ min-width: var(--contextual-menu-min-width);
32
+ max-width: var(--contextual-menu-max-width);
33
+ inline-size: 100%;
34
+ /* A menu (or submenu) taller than the viewport scrolls INSIDE itself instead
35
+ of overflowing off-screen — otherwise keyboard-navigating to an item below
36
+ the fold would move the highlight to an item that is not visible. The
37
+ highlighted item is scrolled into view on keyboard nav (see Item). */
38
+ max-block-size: calc(100dvh - 2 * var(--dimension-200, 16px));
39
+ overflow-y: auto;
40
+ overscroll-behavior: contain;
41
+ background-color: var(--color-background);
42
+ box-shadow: var(--contextual-menu-shadow);
43
+
44
+ /* CSS-only enter/exit animation. */
61
45
  opacity: 0;
62
46
  visibility: hidden;
63
- }
47
+ transition:
48
+ opacity var(--contextual-menu-motion-duration) ease-in-out,
49
+ visibility var(--contextual-menu-motion-duration) allow-discrete;
64
50
 
65
- @media (prefers-reduced-motion: reduce) {
66
- transition: none;
67
- }
51
+ &[aria-hidden="false"] {
52
+ opacity: 1;
53
+ visibility: visible;
68
54
 
69
- /* Every group reserves a 1px top border so group heights never shift when a
70
- divider is / isn't drawn (no layout drift). It is transparent by default and
71
- only coloured between groups, where the muted divider is wanted (Figma:
72
- group border-top, color-border-muted, stroke-thickness-medium). */
73
- .group {
74
- border-block-start: var(--contextual-menu-divider-width, 1px) solid
75
- transparent;
76
- }
77
- .group + .group {
78
- border-block-start-color: var(--contextual-menu-color-divider);
79
- }
55
+ @starting-style {
56
+ opacity: 0;
57
+ }
58
+ }
59
+
60
+ /* A submenu mounts on open but is positioned a frame later; keep it hidden
61
+ until `data-positioned` so it never paints at the fallback top:0/left:0. */
62
+ &.submenu[aria-hidden="false"]:not([data-positioned="true"]) {
63
+ opacity: 0;
64
+ visibility: hidden;
65
+ }
80
66
 
81
- /* The submenu-anchor wraps a submenu-parent item for hover detection; it must
82
- not disturb the vertical item flow, so it lays out like the item it wraps. */
83
- .submenu-anchor {
84
- display: block;
67
+ @media (prefers-reduced-motion: reduce) {
68
+ transition: none;
69
+ }
70
+
71
+ /* A separator entry draws the muted divider between sections (Figma:
72
+ color-border-muted, stroke-thickness-medium). Reset the UA's <hr> box —
73
+ the divider is a coloured border, not a margin-bearing rule. */
74
+ .separator {
75
+ margin: 0;
76
+ border: none;
77
+ border-block-start: var(--contextual-menu-divider-width, 1px) solid
78
+ var(--contextual-menu-color-divider);
79
+ }
80
+
81
+ /* The submenu-anchor wraps a submenu-parent item for hover detection; it must
82
+ not disturb the vertical item flow, so it lays out like the item it wraps. */
83
+ .submenu-anchor {
84
+ display: block;
85
+ }
85
86
  }
86
87
  }
@@ -1,23 +1,27 @@
1
- /* Component tokens (migrated from @canonical/styles-primitives-canonical tokens.css) */
2
- :root {
3
- --icon-size: 1em;
4
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
2
+
3
+ @layer ds.components.global {
4
+ /* Component tokens (migrated from @canonical/styles-primitives-canonical tokens.css) */
5
+ :root {
6
+ --icon-size: 1em;
7
+ }
5
8
 
6
- /**
7
- * Icon styles
8
- * @implements ds:global.component.icon
9
- *
10
- * DSL anatomy mapping:
11
- * - layout.display: inline-block -> display: inline-block
12
- * - size.width: size/icon/default -> width: var(--size-icon-default)
13
- * - size.height: size/icon/default -> height: var(--size-icon-default)
14
- */
15
- .ds.icon {
16
- /* layout.display: inline-block */
17
- display: inline-block;
18
- vertical-align: middle;
9
+ /**
10
+ * Icon styles
11
+ * @implements ds:global.component.icon
12
+ *
13
+ * DSL anatomy mapping:
14
+ * - layout.display: inline-block -> display: inline-block
15
+ * - size.width: size/icon/default -> width: var(--size-icon-default)
16
+ * - size.height: size/icon/default -> height: var(--size-icon-default)
17
+ */
18
+ .ds.icon {
19
+ /* layout.display: inline-block */
20
+ display: inline-block;
21
+ vertical-align: middle;
19
22
 
20
- /* size.width: size/icon/default, size.height: size/icon/default */
21
- width: var(--icon-size, var(--size-icon-default, 1rem));
22
- height: var(--icon-size, var(--size-icon-default, 1rem));
23
+ /* size.width: size/icon/default, size.height: size/icon/default */
24
+ width: var(--icon-size, var(--size-icon-default, 1rem));
25
+ height: var(--icon-size, var(--size-icon-default, 1rem));
26
+ }
23
27
  }
@@ -1,18 +1,22 @@
1
- :root {
2
- --inline-code-color-text: var(--color-text);
3
- --inline-code-color-background: var(--color-foreground-secondary);
4
- --inline-code-padding-inline: var(--dimension-050);
5
- --inline-code-border-radius: var(--dimension-radius-small);
6
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
2
+
3
+ @layer ds.components.global {
4
+ :root {
5
+ --inline-code-color-text: var(--color-text);
6
+ --inline-code-color-background: var(--color-foreground-secondary);
7
+ --inline-code-padding-inline: var(--dimension-050);
8
+ --inline-code-border-radius: var(--dimension-radius-small);
9
+ }
7
10
 
8
- /* The `.code` baseline utility (from @canonical/styles) supplies the
9
- monospace typography tier and the baseline-grid padding-block nudges, so
10
- the component sets no vertical padding. Per the Figma spec it adds only the
11
- horizontal padding plus the code colour and background (both mode-aware). */
12
- .ds.inline-code {
13
- color: var(--inline-code-color-text);
14
- background-color: var(--inline-code-color-background);
11
+ /* The `.code` baseline utility (from @canonical/styles) supplies the
12
+ monospace typography tier and the baseline-grid padding-block nudges, so
13
+ the component sets no vertical padding. Per the Figma spec it adds only the
14
+ horizontal padding plus the code colour and background (both mode-aware). */
15
+ .ds.inline-code {
16
+ color: var(--inline-code-color-text);
17
+ background-color: var(--inline-code-color-background);
15
18
 
16
- padding-inline: var(--inline-code-padding-inline);
17
- border-radius: var(--inline-code-border-radius);
19
+ padding-inline: var(--inline-code-padding-inline);
20
+ border-radius: var(--inline-code-border-radius);
21
+ }
18
22
  }
@@ -1,47 +1,51 @@
1
- :root {
2
- /* Static (surface-independent) chrome tokens only. The COLOUR reads that
3
- depend on the surface stack are NOT declared here — a custom property set at
4
- `:root` resolves its `var(--surface-color-*)` immediately at `:root`, where
5
- there is no `.surface` ancestor, so it would freeze to layer1 and the
6
- surface stepping would never happen. Those reads live on `.ds.keyboard-key`
7
- below, where the key's own `.surface` scope is in effect. */
8
- --keyboard-key-color-border: var(--color-border-muted);
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
9
2
 
10
- /* Figma corner radius is 2px, but that token is not yet validated / does not
11
- exist — the spec note says "maybe 0 for now", so this stays on radius-small
12
- (currently 0). Revisit once a 2px radius token lands. */
13
- --keyboard-key-border-radius: var(--dimension-radius-small);
14
- --keyboard-key-border-width: var(--dimension-stroke-thickness-medium);
15
- /* 4px inline padding (Figma: 4px left/right). */
16
- --keyboard-key-padding-inline: var(--dimension-050);
17
- }
3
+ @layer ds.components.global {
4
+ :root {
5
+ /* Static (surface-independent) chrome tokens only. The COLOUR reads that
6
+ depend on the surface stack are NOT declared here — a custom property set at
7
+ `:root` resolves its `var(--surface-color-*)` immediately at `:root`, where
8
+ there is no `.surface` ancestor, so it would freeze to layer1 and the
9
+ surface stepping would never happen. Those reads live on `.ds.keyboard-key`
10
+ below, where the key's own `.surface` scope is in effect. */
11
+ --keyboard-key-color-border: var(--color-border-muted);
12
+
13
+ /* Figma corner radius is 2px, but that token is not yet validated / does not
14
+ exist — the spec note says "maybe 0 for now", so this stays on radius-small
15
+ (currently 0). Revisit once a 2px radius token lands. */
16
+ --keyboard-key-border-radius: var(--dimension-radius-small);
17
+ --keyboard-key-border-width: var(--dimension-stroke-thickness-medium);
18
+ /* 4px inline padding (Figma: 4px left/right). */
19
+ --keyboard-key-padding-inline: var(--dimension-050);
20
+ }
18
21
 
19
- /* The `.code` baseline utility (from @canonical/styles) supplies the
20
- monospace typography tier — font-family, font-size, font-weight and
21
- line-height — plus the padding-block nudges that snap the box onto the
22
- baseline grid. The component itself only adds inline padding and the
23
- key-specific chrome (colour, border, radius); it must not redeclare the
24
- typography properties, which would bypass the baseline-grid maths. */
25
- .ds.keyboard-key {
26
- display: inline-block;
22
+ /* The `.code` baseline utility (from @canonical/styles) supplies the
23
+ monospace typography tier — font-family, font-size, font-weight and
24
+ line-height — plus the padding-block nudges that snap the box onto the
25
+ baseline grid. The component itself only adds inline padding and the
26
+ key-specific chrome (colour, border, radius); it must not redeclare the
27
+ typography properties, which would bypass the baseline-grid maths. */
28
+ .ds.keyboard-key {
29
+ display: inline-block;
27
30
 
28
- /* Figma (26.10 Keyboard Key, node 6004-72): a key-cap sits on a surface+1 fill
29
- "like an input", with a muted border and the surface's text colour.
31
+ /* Figma (26.10 Keyboard Key, node 6004-72): a key-cap sits on a surface+1 fill
32
+ "like an input", with a muted border and the surface's text colour.
30
33
 
31
- The key establishes its own `.surface` (see KeyboardKey.tsx), so it IS the
32
- next surface layer and paints ITSELF with that layer's background — exactly
33
- like the Tile. These reads MUST be here on the class (not `:root`) so
34
- `--surface-color-*` resolves against the key's own surface depth: nested in
35
- the ambient surface the background steps to the next layer (the "surface+1,
36
- like inputs" the spec asks for), and on a `.contrasted` surface it inverts
37
- for free. The fallbacks keep it sane when placed outside any surface. */
38
- background-color: var(--surface-color-background, var(--color-background));
39
- color: var(--surface-color-text, var(--color-text));
34
+ The key establishes its own `.surface` (see KeyboardKey.tsx), so it IS the
35
+ next surface layer and paints ITSELF with that layer's background — exactly
36
+ like the Tile. These reads MUST be here on the class (not `:root`) so
37
+ `--surface-color-*` resolves against the key's own surface depth: nested in
38
+ the ambient surface the background steps to the next layer (the "surface+1,
39
+ like inputs" the spec asks for), and on a `.contrasted` surface it inverts
40
+ for free. The fallbacks keep it sane when placed outside any surface. */
41
+ background-color: var(--surface-color-background, var(--color-background));
42
+ color: var(--surface-color-text, var(--color-text));
40
43
 
41
- border-style: solid;
42
- border-width: var(--keyboard-key-border-width);
43
- border-color: var(--keyboard-key-color-border);
44
- border-radius: var(--keyboard-key-border-radius);
44
+ border-style: solid;
45
+ border-width: var(--keyboard-key-border-width);
46
+ border-color: var(--keyboard-key-color-border);
47
+ border-radius: var(--keyboard-key-border-radius);
45
48
 
46
- padding-inline: var(--keyboard-key-padding-inline);
49
+ padding-inline: var(--keyboard-key-padding-inline);
50
+ }
47
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../../../src/lib/component/Popover/Popover.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,cAAc,CAAC;AAEtB,6EAA6E;AAC7E,oEAAoE;AACpE,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAC3C,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,OAAO,GAAG,CAAC,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,GAAG,KAAK,EACK,EAAsB,EAAE;IACrC,MAAM,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,GAAG,aAAa,CAAC;QAChB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,IAAI;QACZ,mEAAmE;QACnE,0EAA0E;QAC1E,mBAAmB,EAAE,mBAAmB,IAAI,iBAAiB;QAC7D,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,OAAO,EAAE,OAAO,IAAI,IAAI;QACxB,aAAa;QACb,mBAAmB;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC;QAClC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC;KACpC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IAEvC,4EAA4E;IAC5E,8EAA8E;IAC9E,yEAAyE;IACzE,wCAAwC;IACxC,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,KAAuB,EAAE,EAAE;QAC1B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,WAAW,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,CACL,mBACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC;aACtE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,SAA0C,KAC3C,KAAK,aAGT,kBACE,SAAS,EAAC,SAAS,mBAGJ,WAAW,CAAC,eAAe,CAAC,EAC3C,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,WAAW,CAAC,SAAS,YAE/B,OAAO,GACA,EACV,cACE,SAAS,EAAE,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACzD,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,QAAQ,iBAEA,CAAC,MAAM,qBAMH,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAClD,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,YAAY,CAAC,cAAc,YAE1C,QAAQ,GACL,IACE,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../../../src/lib/component/Popover/Popover.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,cAAc,CAAC;AAEtB,6EAA6E;AAC7E,oEAAoE;AACpE,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAC3C,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,OAAO,GAAG,CAAC,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,GAAG,KAAK,EACK,EAAsB,EAAE;IACrC,MAAM,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,GAAG,aAAa,CAAqB;QACpC,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,IAAI;QACZ,mEAAmE;QACnE,0EAA0E;QAC1E,mBAAmB,EAAE,mBAAmB,IAAI,iBAAiB;QAC7D,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,OAAO,EAAE,OAAO,IAAI,IAAI;QACxB,aAAa;QACb,mBAAmB;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC;QAClC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC;KACpC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IAEvC,4EAA4E;IAC5E,8EAA8E;IAC9E,yEAAyE;IACzE,wCAAwC;IACxC,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,KAAuB,EAAE,EAAE;QAC1B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,WAAW,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,CACL,mBACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC;aACtE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,SAAS,KACV,KAAK,aAGT,kBACE,SAAS,EAAC,SAAS,mBAGJ,WAAW,CAAC,eAAe,CAAC,EAC3C,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,WAAW,CAAC,SAAS,YAE/B,OAAO,GACA,EACV,cACE,SAAS,EAAE,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACzD,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,QAAQ,iBAEA,CAAC,MAAM,qBAMH,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAClD,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,YAAY,CAAC,cAAc,YAE1C,QAAQ,GACL,IACE,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,65 +1,72 @@
1
- /* Component tokens — sourced from @canonical/design-tokens */
2
- :root {
3
- --popover-color-border: var(--color-border);
4
- --popover-border-radius: 0;
5
- --popover-border-width: 1px;
6
- --popover-padding-vertical: var(--dimension-100);
7
- --popover-padding-horizontal: var(--dimension-200);
8
- --popover-motion-duration: 0.12s;
9
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
2
+
3
+ @layer ds.components.global {
4
+ /* Component tokens — sourced from @canonical/design-tokens */
5
+ :root {
6
+ --popover-color-border: var(--color-border);
7
+ --popover-border-radius: 0;
8
+ --popover-border-width: 1px;
9
+ --popover-padding-vertical: var(--dimension-100);
10
+ --popover-padding-horizontal: var(--dimension-200);
11
+ --popover-motion-duration: 0.12s;
12
+ }
10
13
 
11
- .ds.popover {
12
- position: relative;
13
- display: inline-block;
14
+ .ds.popover {
15
+ position: relative;
16
+ display: inline-block;
14
17
 
15
- > .trigger {
16
- cursor: pointer;
17
- list-style: none;
18
+ > .trigger {
19
+ cursor: pointer;
20
+ list-style: none;
18
21
 
19
- /* Remove the native disclosure triangle; the trigger content owns the affordance. */
20
- &::-webkit-details-marker {
21
- display: none;
22
+ /* Remove the native disclosure triangle; the trigger content owns the affordance. */
23
+ &::-webkit-details-marker {
24
+ display: none;
25
+ }
22
26
  }
23
- }
24
27
 
25
- > .content {
26
- position: fixed;
27
- z-index: var(--z-index-overlay, 100);
28
- /* Read the surface channels directly on .content so the `.contrasted`
29
- surface applied to this element resolves (a :root intermediate would see
30
- them unset and fall back to the base colours). */
31
- background-color: var(--surface-color-background, var(--color-background));
32
- color: var(--surface-color-text, var(--color-text));
33
- border: var(--popover-border-width, 1px) solid var(--popover-color-border);
34
- border-radius: var(--popover-border-radius);
35
- padding-block: var(--popover-padding-vertical);
36
- padding-inline: var(--popover-padding-horizontal);
28
+ > .content {
29
+ position: fixed;
30
+ z-index: var(--z-index-overlay, 100);
31
+ /* Read the surface channels directly on .content so the `.contrasted`
32
+ surface applied to this element resolves (a :root intermediate would see
33
+ them unset and fall back to the base colours). */
34
+ background-color: var(
35
+ --surface-color-background,
36
+ var(--color-background)
37
+ );
38
+ color: var(--surface-color-text, var(--color-text));
39
+ border: var(--popover-border-width, 1px) solid var(--popover-color-border);
40
+ border-radius: var(--popover-border-radius);
41
+ padding-block: var(--popover-padding-vertical);
42
+ padding-inline: var(--popover-padding-horizontal);
37
43
 
38
- /*
39
- CSS-only enter/exit animation. `allow-discrete` transitions `visibility`
40
- (a discrete property) alongside `opacity`; `@starting-style` supplies the
41
- opening frame so the fade-in runs. No JavaScript timing.
42
- */
43
- opacity: 0;
44
- visibility: hidden;
45
- transition:
46
- opacity var(--popover-motion-duration) ease-in-out,
47
- visibility var(--popover-motion-duration) allow-discrete;
44
+ /*
45
+ CSS-only enter/exit animation. `allow-discrete` transitions `visibility`
46
+ (a discrete property) alongside `opacity`; `@starting-style` supplies the
47
+ opening frame so the fade-in runs. No JavaScript timing.
48
+ */
49
+ opacity: 0;
50
+ visibility: hidden;
51
+ transition:
52
+ opacity var(--popover-motion-duration) ease-in-out,
53
+ visibility var(--popover-motion-duration) allow-discrete;
48
54
 
49
- /* Visible only when open (aria-hidden="false") AND positioned
50
- (data-positioned) — so the content never paints at the unresolved
51
- top:0/left:0 fallback, and the fade runs from the anchored position. */
52
- &[aria-hidden="false"][data-positioned="true"] {
53
- opacity: 1;
54
- visibility: visible;
55
+ /* Visible only when open (aria-hidden="false") AND positioned
56
+ (data-positioned) — so the content never paints at the unresolved
57
+ top:0/left:0 fallback, and the fade runs from the anchored position. */
58
+ &[aria-hidden="false"][data-positioned="true"] {
59
+ opacity: 1;
60
+ visibility: visible;
55
61
 
56
- @starting-style {
57
- opacity: 0;
62
+ @starting-style {
63
+ opacity: 0;
64
+ }
58
65
  }
59
- }
60
66
 
61
- @media (prefers-reduced-motion: reduce) {
62
- transition: none;
67
+ @media (prefers-reduced-motion: reduce) {
68
+ transition: none;
69
+ }
63
70
  }
64
71
  }
65
72
  }
@@ -1,87 +1,91 @@
1
- /**
2
- * Tabs Item styles (internal renderer)
3
- *
4
- * Figma (node 4388-106316): each tab is text with `--dimension-200` (16px)
5
- * horizontal padding, no gap to its neighbours. The tab shows a bottom border
6
- * on hover (muted) and when active (highlighted); an inert tab (no url) is
7
- * muted with no hover affordance.
8
- *
9
- * Baseline grid: the tab box snaps to the typographic baseline grid — its
10
- * min block-size and vertical padding are whole multiples of --baseline-height
11
- * (1bU = 8px), so the strip sits on the same grid as surrounding text.
12
- */
13
- :root {
14
- --tabs-tab-border-width: var(--dimension-strokeThickness-large, 2px);
15
- --tabs-tab-padding-inline: var(--space-200); /* 16px */
16
- /* 5bU = 40px tab height on the 8px baseline grid. */
17
- --tabs-tab-min-block-size: calc(var(--baseline-height) * 5);
18
- --tabs-tab-focus-ring-width: var(--dimension-strokeThickness-large, 2px);
19
- --tabs-tab-focus-ring-color: var(--color-focusRing);
20
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
21
2
 
22
- .ds.tabs-item {
23
- display: flex;
24
- }
3
+ @layer ds.components.global {
4
+ /**
5
+ * Tabs Item styles (internal renderer)
6
+ *
7
+ * Figma (node 4388-106316): each tab is text with `--dimension-200` (16px)
8
+ * horizontal padding, no gap to its neighbours. The tab shows a bottom border
9
+ * on hover (muted) and when active (highlighted); an inert tab (no url) is
10
+ * muted with no hover affordance.
11
+ *
12
+ * Baseline grid: the tab box snaps to the typographic baseline grid — its
13
+ * min block-size and vertical padding are whole multiples of --baseline-height
14
+ * (1bU = 8px), so the strip sits on the same grid as surrounding text.
15
+ */
16
+ :root {
17
+ --tabs-tab-border-width: var(--dimension-strokeThickness-large, 2px);
18
+ --tabs-tab-padding-inline: var(--space-200); /* 16px */
19
+ /* 5bU = 40px tab height on the 8px baseline grid. */
20
+ --tabs-tab-min-block-size: calc(var(--baseline-height) * 5);
21
+ --tabs-tab-focus-ring-width: var(--dimension-strokeThickness-large, 2px);
22
+ --tabs-tab-focus-ring-color: var(--color-focus-ring);
23
+ }
25
24
 
26
- .ds.tabs-item .tabs-link {
27
- display: inline-flex;
28
- align-items: center;
29
- box-sizing: border-box;
30
- /* Baseline-snapped block size; vertical padding kept to baseline units so the
31
- label's line box centres on the grid. */
32
- min-block-size: var(--tabs-tab-min-block-size);
33
- padding-block: var(--space-100); /* 1bU */
34
- padding-inline: var(--tabs-tab-padding-inline);
35
- font: var(--typography-text-primary);
36
- color: var(--color-text);
37
- text-decoration: none;
38
- white-space: nowrap;
25
+ .ds.tabs-item {
26
+ display: flex;
27
+ }
39
28
 
40
- /* Transparent underline reserved so the row never shifts when a border
41
- appears on hover/active. */
42
- border-bottom: var(--tabs-tab-border-width) solid transparent;
29
+ .ds.tabs-item .tabs-link {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ box-sizing: border-box;
33
+ /* Baseline-snapped block size; vertical padding kept to baseline units so the
34
+ label's line box centres on the grid. */
35
+ min-block-size: var(--tabs-tab-min-block-size);
36
+ padding-block: var(--space-100); /* 1bU */
37
+ padding-inline: var(--tabs-tab-padding-inline);
38
+ font: var(--typography-text-primary);
39
+ color: var(--color-text);
40
+ text-decoration: none;
41
+ white-space: nowrap;
42
+
43
+ /* Transparent underline reserved so the row never shifts when a border
44
+ appears on hover/active. */
45
+ border-bottom: var(--tabs-tab-border-width) solid transparent;
43
46
 
44
- /* Keyboard focus: a design-system focus ring (design review) instead of the
45
- UA default outline. Inset offset so the ring hugs the tab and the row's
46
- `overflow` never clips it; :focus-visible only, so pointer clicks stay
47
- quiet. */
48
- &:focus-visible {
49
- outline: var(--tabs-tab-focus-ring-width) solid
50
- var(--tabs-tab-focus-ring-color);
51
- outline-offset: calc(-1 * var(--tabs-tab-focus-ring-width));
47
+ /* Keyboard focus: a design-system focus ring (design review) instead of the
48
+ UA default outline. Inset offset so the ring hugs the tab and the row's
49
+ `overflow` never clips it; :focus-visible only, so pointer clicks stay
50
+ quiet. */
51
+ &:focus-visible {
52
+ outline: var(--tabs-tab-focus-ring-width) solid
53
+ var(--tabs-tab-focus-ring-color);
54
+ outline-offset: calc(-1 * var(--tabs-tab-focus-ring-width));
55
+ }
52
56
  }
53
- }
54
57
 
55
- /* Hover: a muted bottom border hints the tab is navigable, and settles faster
56
- than the active/selection change (below). Not on the active tab (it already
57
- shows the highlighted border), nor on inert or disabled tabs (they are not
58
- interactive). */
59
- .ds.tabs-item:not([data-active]):not([data-inert]):not([data-disabled])
60
- .tabs-link:hover {
61
- border-bottom-color: var(--color-border-muted);
62
- transition-duration: var(--motion-duration-fast);
63
- }
58
+ /* Hover: a muted bottom border hints the tab is navigable, and settles faster
59
+ than the active/selection change (below). Not on the active tab (it already
60
+ shows the highlighted border), nor on inert or disabled tabs (they are not
61
+ interactive). */
62
+ .ds.tabs-item:not([data-active]):not([data-inert]):not([data-disabled])
63
+ .tabs-link:hover {
64
+ border-bottom-color: var(--color-border-muted);
65
+ transition-duration: var(--motion-duration-fast);
66
+ }
64
67
 
65
- /* Active tab: highlighted underline over the strip's muted baseline. */
66
- .ds.tabs-item[data-active] .tabs-link,
67
- .ds.tabs-item .tabs-link[aria-current="page"] {
68
- border-bottom-color: var(--color-border-highlighted);
69
- }
68
+ /* Active tab: highlighted underline over the strip's muted baseline. */
69
+ .ds.tabs-item[data-active] .tabs-link,
70
+ .ds.tabs-item .tabs-link[aria-current="page"] {
71
+ border-bottom-color: var(--color-border-highlighted);
72
+ }
70
73
 
71
- /* Inert (no url) or disabled tabs: muted, non-interactive, no hover
72
- affordance. */
73
- .ds.tabs-item[data-inert] .tabs-link,
74
- .ds.tabs-item[data-disabled] .tabs-link {
75
- color: var(--color-text-muted);
76
- cursor: default;
77
- }
74
+ /* Inert (no url) or disabled tabs: muted, non-interactive, no hover
75
+ affordance. */
76
+ .ds.tabs-item[data-inert] .tabs-link,
77
+ .ds.tabs-item[data-disabled] .tabs-link {
78
+ color: var(--color-text-muted);
79
+ cursor: default;
80
+ }
78
81
 
79
- /* Motion: the border transitions on the medium duration by default; the hover
80
- rule above overrides it to the faster duration, so hover feedback is snappier
81
- than the active/selection settle. */
82
- @media (prefers-reduced-motion: no-preference) {
83
- .ds.tabs-item .tabs-link {
84
- transition: border-bottom-color var(--motion-duration-medium)
85
- var(--motion-easing-standard);
82
+ /* Motion: the border transitions on the medium duration by default; the hover
83
+ rule above overrides it to the faster duration, so hover feedback is snappier
84
+ than the active/selection settle. */
85
+ @media (prefers-reduced-motion: no-preference) {
86
+ .ds.tabs-item .tabs-link {
87
+ transition: border-bottom-color var(--motion-duration-medium)
88
+ var(--motion-easing-standard);
89
+ }
86
90
  }
87
91
  }