@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,37 +1,41 @@
1
- /**
2
- * Tabs styles
3
- * @implements ds:global.component.tabs
4
- *
5
- * DSL anatomy mapping:
6
- * - layout.type: stack, layout.direction: horizontal -> flex row of tabs
7
- * - edges: tabs-tab (1..*), slot default -> the <li> children of .tabs-list
8
- *
9
- * Figma (node 4388-106316): a horizontal strip of tabs with no gap between
10
- * them, over a full-width muted bottom border; the strip fills its container
11
- * and scrolls horizontally on overflow.
12
- */
13
- :root {
14
- --tabs-border-width: var(--dimension-strokeThickness-medium, 1px);
15
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
16
2
 
17
- .ds.tabs {
18
- display: block;
19
- }
3
+ @layer ds.components.global {
4
+ /**
5
+ * Tabs styles
6
+ * @implements ds:global.component.tabs
7
+ *
8
+ * DSL anatomy mapping:
9
+ * - layout.type: stack, layout.direction: horizontal -> flex row of tabs
10
+ * - edges: tabs-tab (1..*), slot default -> the <li> children of .tabs-list
11
+ *
12
+ * Figma (node 4388-106316): a horizontal strip of tabs with no gap between
13
+ * them, over a full-width muted bottom border; the strip fills its container
14
+ * and scrolls horizontally on overflow.
15
+ */
16
+ :root {
17
+ --tabs-border-width: var(--dimension-strokeThickness-medium, 1px);
18
+ }
19
+
20
+ .ds.tabs {
21
+ display: block;
22
+ }
20
23
 
21
- .ds.tabs .tabs-list {
22
- display: flex;
23
- flex-direction: row;
24
- /* No gap between tabs (Figma). */
25
- gap: 0;
26
- margin: 0;
27
- padding: 0;
28
- list-style: none;
24
+ .ds.tabs .tabs-list {
25
+ display: flex;
26
+ flex-direction: row;
27
+ /* No gap between tabs (Figma). */
28
+ gap: 0;
29
+ margin: 0;
30
+ padding: 0;
31
+ list-style: none;
29
32
 
30
- /* Full-width muted baseline; the active tab paints a highlighted segment
31
- over it (see Tabs.Tab). */
32
- border-bottom: var(--tabs-border-width) solid var(--color-border-muted);
33
+ /* Full-width muted baseline; the active tab paints a highlighted segment
34
+ over it (see Tabs.Tab). */
35
+ border-bottom: var(--tabs-border-width) solid var(--color-border-muted);
33
36
 
34
- /* Overflow: the strip scrolls horizontally when the tabs exceed the
35
- container width (Figma "Overflow"). */
36
- overflow-x: auto;
37
+ /* Overflow: the strip scrolls horizontally when the tabs exceed the
38
+ container width (Figma "Overflow"). */
39
+ overflow-x: auto;
40
+ }
37
41
  }
@@ -1,27 +1,31 @@
1
- /**
2
- * Tile.Content styles
3
- * @implements ds:global.subcomponent.tile-content
4
- *
5
- * DSL anatomy mapping:
6
- * - layout.type: stack, layout.direction: vertical -> flex column
7
- * - spacing.padding.top: dimension/100, spacing.padding.bottom: dimension/200,
8
- * spacing.internal.horizontal: dimension/200 -> top 100, bottom 200,
9
- * sides 200. With a header above (padding-bottom 100), the two sections read
10
- * as top 100 / sides 200 / bottom 200 with the sections meeting in between.
11
- */
12
- :root {
13
- --tile-content-padding-top: var(--dimension-100);
14
- --tile-content-padding-bottom: var(--dimension-200);
15
- --tile-content-padding-inline: var(--dimension-200);
16
- --tile-content-gap: var(--dimension-100);
17
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
2
+
3
+ @layer ds.components.global {
4
+ /**
5
+ * Tile.Content styles
6
+ * @implements ds:global.subcomponent.tile-content
7
+ *
8
+ * DSL anatomy mapping:
9
+ * - layout.type: stack, layout.direction: vertical -> flex column
10
+ * - spacing.padding.top: dimension/100, spacing.padding.bottom: dimension/200,
11
+ * spacing.internal.horizontal: dimension/200 -> top 100, bottom 200,
12
+ * sides 200. With a header above (padding-bottom 100), the two sections read
13
+ * as top 100 / sides 200 / bottom 200 with the sections meeting in between.
14
+ */
15
+ :root {
16
+ --tile-content-padding-top: var(--dimension-100);
17
+ --tile-content-padding-bottom: var(--dimension-200);
18
+ --tile-content-padding-inline: var(--dimension-200);
19
+ --tile-content-gap: var(--dimension-100);
20
+ }
18
21
 
19
- .ds.tile-content {
20
- display: flex;
21
- flex-direction: column;
22
- gap: var(--tile-content-gap);
22
+ .ds.tile-content {
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: var(--tile-content-gap);
23
26
 
24
- padding-block-start: var(--tile-content-padding-top);
25
- padding-block-end: var(--tile-content-padding-bottom);
26
- padding-inline: var(--tile-content-padding-inline);
27
+ padding-block-start: var(--tile-content-padding-top);
28
+ padding-block-end: var(--tile-content-padding-bottom);
29
+ padding-inline: var(--tile-content-padding-inline);
30
+ }
27
31
  }
@@ -1,28 +1,32 @@
1
- /**
2
- * Tile.Header styles
3
- * @implements ds:global.subcomponent.tile-header
4
- *
5
- * DSL anatomy mapping:
6
- * - layout.type: flow, layout.direction: horizontal -> flex row
7
- * - layout.align: center -> align-items: center
8
- * - spacing.internal.vertical: dimension/100, spacing.internal.horizontal:
9
- * dimension/200 -> padding 100 (block) / 200 (inline). The header's block
10
- * padding is 100 top and bottom; the content below adds its own top padding.
11
- */
12
- :root {
13
- --tile-header-padding-block: var(--dimension-100);
14
- --tile-header-padding-inline: var(--dimension-200);
15
- --tile-header-gap: var(--dimension-100);
16
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
2
+
3
+ @layer ds.components.global {
4
+ /**
5
+ * Tile.Header styles
6
+ * @implements ds:global.subcomponent.tile-header
7
+ *
8
+ * DSL anatomy mapping:
9
+ * - layout.type: flow, layout.direction: horizontal -> flex row
10
+ * - layout.align: center -> align-items: center
11
+ * - spacing.internal.vertical: dimension/100, spacing.internal.horizontal:
12
+ * dimension/200 -> padding 100 (block) / 200 (inline). The header's block
13
+ * padding is 100 top and bottom; the content below adds its own top padding.
14
+ */
15
+ :root {
16
+ --tile-header-padding-block: var(--dimension-100);
17
+ --tile-header-padding-inline: var(--dimension-200);
18
+ --tile-header-gap: var(--dimension-100);
19
+ }
17
20
 
18
- .ds.tile-header {
19
- display: flex;
20
- flex-direction: row;
21
- align-items: center;
21
+ .ds.tile-header {
22
+ display: flex;
23
+ flex-direction: row;
24
+ align-items: center;
22
25
 
23
- padding-block: var(--tile-header-padding-block);
24
- padding-inline: var(--tile-header-padding-inline);
25
- gap: var(--tile-header-gap);
26
+ padding-block: var(--tile-header-padding-block);
27
+ padding-inline: var(--tile-header-padding-inline);
28
+ gap: var(--tile-header-gap);
26
29
 
27
- font-weight: var(--typography-weight-semibold, 600);
30
+ font-weight: var(--typography-weight-semibold, 600);
31
+ }
28
32
  }
@@ -1,32 +1,36 @@
1
- /**
2
- * Tile styles
3
- * @implements ds:global.component.tile
4
- *
5
- * The Tile always provides a surface: the component adds `.surface`, so the
6
- * surface channel is established on this element (and steps when tiles/surfaces
7
- * nest). It paints that background so it stands out on the page (dashboards,
8
- * bento layouts). It shares the Card radius and has no border of its own. It is
9
- * a static container — no cursor, hover, or focus affordance.
10
- *
11
- * DSL anatomy mapping:
12
- * - layout.type: stack, layout.direction: vertical -> flex column
13
- * - appearance.background: color/surface/tile -> the surface background channel
14
- * - appearance.radius: radius/card -> shared card radius (--dimension-radius-medium)
15
- */
16
- :root {
17
- /* Shared with Card. --dimension-radius-medium is currently 0; intended 9. */
18
- --tile-border-radius: var(--dimension-radius-medium);
19
- }
1
+ /* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
2
+
3
+ @layer ds.components.global {
4
+ /**
5
+ * Tile styles
6
+ * @implements ds:global.component.tile
7
+ *
8
+ * The Tile always provides a surface: the component adds `.surface`, so the
9
+ * surface channel is established on this element (and steps when tiles/surfaces
10
+ * nest). It paints that background so it stands out on the page (dashboards,
11
+ * bento layouts). It shares the Card radius and has no border of its own. It is
12
+ * a static container — no cursor, hover, or focus affordance.
13
+ *
14
+ * DSL anatomy mapping:
15
+ * - layout.type: stack, layout.direction: vertical -> flex column
16
+ * - appearance.background: color/surface/tile -> the surface background channel
17
+ * - appearance.radius: radius/card -> shared card radius (--dimension-radius-medium)
18
+ */
19
+ :root {
20
+ /* Shared with Card. --dimension-radius-medium is currently 0; intended 9. */
21
+ --tile-border-radius: var(--dimension-radius-medium);
22
+ }
20
23
 
21
- .ds.tile {
22
- display: flex;
23
- flex-direction: column;
24
+ .ds.tile {
25
+ display: flex;
26
+ flex-direction: column;
24
27
 
25
- /* Tile is a surface: it paints its own background (stands out on the page). */
26
- background: var(--surface-color-background, var(--color-background));
28
+ /* Tile is a surface: it paints its own background (stands out on the page). */
29
+ background: var(--surface-color-background, var(--color-background));
27
30
 
28
- border-radius: var(--tile-border-radius);
31
+ border-radius: var(--tile-border-radius);
29
32
 
30
- /* Clip section corners (e.g. full-bleed content) to the tile radius. */
31
- overflow: hidden;
33
+ /* Clip section corners (e.g. full-bleed content) to the tile radius. */
34
+ overflow: hidden;
35
+ }
32
36
  }
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createPortal } from "react-dom";
3
+ import { useDisclosure, useIsMounted } from "../../hooks/index.js";
4
+ import Tooltip from "./Tooltip.js";
5
+ import "./styles.css";
6
+ const componentCssClassName = "ds tooltip-area";
7
+ /**
8
+ * The tooltip engine: wraps a target element with a hover/focus tooltip. It
9
+ * drives {@link useDisclosure} in `hover` mode, portals the message to the
10
+ * client only, positions it against the target span, and points the arrow.
11
+ * {@link withTooltip} builds on this; render it directly when the message
12
+ * must follow prop state (e.g. a toggle whose tooltip names the current
13
+ * action).
14
+ *
15
+ * `import { TooltipEngine } from "@canonical/react-ds-global";`
16
+ */
17
+ const TooltipEngine = ({ children, style, className, Message, icon, open, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
18
+ const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, bestPosition, arrowOffset, getToggleProps, getContentProps,
19
+ // `open` is the public alias for the hook's controlled `isOpen`; when set it
20
+ // overrides hover/focus so the tooltip stays in the given state.
21
+ } = useDisclosure({
22
+ distance,
23
+ autoFit,
24
+ ...props,
25
+ isOpen: open ?? props.isOpen,
26
+ mode: "hover",
27
+ });
28
+ const triggerProps = getToggleProps();
29
+ const contentProps = getContentProps();
30
+ // The message is portalled to the client only. Rendering it on the server (or
31
+ // on the first client render) would differ from the post-mount portal output
32
+ // and force a hydration mismatch + full re-mount — which resets the fitment
33
+ // refs to null and re-triggers the unpositioned first frame. Deferring to a
34
+ // mounted gate makes the server and first client render identical (nothing
35
+ // at the call site); the tooltip mounts once, cleanly, after hydration.
36
+ const mounted = useIsMounted();
37
+ // The always-on arrow offset keeps the arrow pointing at the target centre
38
+ // for every placement, not only when auto-fit clamps.
39
+ const arrowStyle = arrowOffset
40
+ ? {
41
+ [arrowOffset.axis === "x"
42
+ ? "--tooltip-arrow-offset-left"
43
+ : "--tooltip-arrow-offset-top"]: `${arrowOffset.offset}px`,
44
+ }
45
+ : {};
46
+ const TooltipMessageElement = (_jsx(Tooltip, { id: popupId, className: [bestPosition?.positionName, messageElementClassName]
47
+ .filter(Boolean)
48
+ .join(" "), icon: icon, onPointerEnter: contentProps.onPointerEnter, ref: popupRef, style: {
49
+ ...messageElementStyle,
50
+ ...popupPositionStyle,
51
+ ...arrowStyle,
52
+ },
53
+ // Reveal only once a position has been resolved. Until `bestPosition`
54
+ // exists the popup would render at the fallback top:0/left:0 with no
55
+ // placement class (and so no arrow); gating the reveal on it means that
56
+ // unpositioned frame stays `visibility:hidden` and never paints — no
57
+ // visible 0,0 flash, and the open fade always runs from an anchored spot.
58
+ isOpen: isOpen && Boolean(bestPosition), children: Message }));
59
+ return (
60
+ // biome-ignore lint/a11y/noStaticElementInteractions: the wrapper forwards pointer/focus to the tooltip trigger
61
+ _jsxs("span", { className: [componentCssClassName, className].filter(Boolean).join(" "), style: style, onFocus: triggerProps.onFocus, onBlur: triggerProps.onBlur, onPointerEnter: triggerProps.onPointerEnter, onPointerLeave: triggerProps.onPointerLeave, children: [_jsx("span", { id: targetElementId, style: targetElementStyle, className: ["target", targetElementClassName].filter(Boolean).join(" "), ref: targetRef, "aria-describedby": popupId, children: children }), mounted
62
+ ? createPortal(TooltipMessageElement, parentElement || document.body)
63
+ : null] }));
64
+ };
65
+ export default TooltipEngine;
66
+ //# sourceMappingURL=TooltipEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipEngine.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/TooltipEngine.tsx"],"names":[],"mappings":"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"}
@@ -1,3 +1,4 @@
1
1
  export { default as Tooltip } from "./Tooltip.js";
2
+ export { default as TooltipEngine } from "./TooltipEngine.js";
2
3
  export { default as withTooltip } from "./withTooltip.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}