@canonical/react-ds-global 0.29.1 → 0.31.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 (308) hide show
  1. package/README.md +33 -0
  2. package/dist/esm/lib/_work_in_progress/IconSection/IconSection.js +1 -1
  3. package/dist/esm/lib/_work_in_progress/IconSection/IconSection.js.map +1 -1
  4. package/dist/esm/lib/_work_in_progress/index.js +13 -0
  5. package/dist/esm/lib/_work_in_progress/index.js.map +1 -0
  6. package/dist/esm/lib/component/Accordion/common/Item/styles.css +73 -56
  7. package/dist/esm/lib/component/Accordion/styles.css +5 -1
  8. package/dist/esm/lib/component/Announcement/Announcement.js +5 -3
  9. package/dist/esm/lib/component/Announcement/Announcement.js.map +1 -1
  10. package/dist/esm/lib/component/Announcement/index.js +1 -0
  11. package/dist/esm/lib/component/Announcement/index.js.map +1 -1
  12. package/dist/esm/lib/component/Announcement/styles.css +60 -36
  13. package/dist/esm/lib/component/Badge/styles.css +25 -24
  14. package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js +2 -2
  15. package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js +13 -3
  16. package/dist/esm/lib/component/Breadcrumbs/common/Item/Item.js.map +1 -1
  17. package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +17 -5
  18. package/dist/esm/lib/component/Breadcrumbs/styles.css +3 -0
  19. package/dist/esm/lib/component/Button/Button.js +13 -6
  20. package/dist/esm/lib/component/Button/Button.js.map +1 -1
  21. package/dist/esm/lib/component/Button/styles.css +200 -38
  22. package/dist/esm/lib/component/Card/Card.js +16 -6
  23. package/dist/esm/lib/component/Card/Card.js.map +1 -1
  24. package/dist/esm/lib/component/Card/common/Content/styles.css +8 -4
  25. package/dist/esm/lib/component/Card/common/Footer/Footer.js +2 -2
  26. package/dist/esm/lib/component/Card/common/Footer/styles.css +13 -3
  27. package/dist/esm/lib/component/Card/common/Header/styles.css +1 -1
  28. package/dist/esm/lib/component/Card/common/index.js +0 -1
  29. package/dist/esm/lib/component/Card/common/index.js.map +1 -1
  30. package/dist/esm/lib/component/Card/styles.css +60 -22
  31. package/dist/esm/lib/component/Chip/styles.css +3 -0
  32. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +96 -0
  33. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -0
  34. package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js +32 -0
  35. package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js.map +1 -0
  36. package/dist/esm/lib/component/ContextualMenu/common/Item/index.js +2 -0
  37. package/dist/esm/lib/component/ContextualMenu/common/Item/index.js.map +1 -0
  38. package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +121 -0
  39. package/dist/esm/lib/component/ContextualMenu/common/Item/types.js.map +1 -0
  40. package/dist/esm/lib/component/ContextualMenu/common/MenuContext.js +12 -0
  41. package/dist/esm/lib/component/ContextualMenu/common/MenuContext.js.map +1 -0
  42. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js +128 -0
  43. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -0
  44. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/index.js +2 -0
  45. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/index.js.map +1 -0
  46. package/dist/esm/lib/component/ContextualMenu/index.js +2 -0
  47. package/dist/esm/lib/component/ContextualMenu/index.js.map +1 -0
  48. package/dist/esm/lib/component/ContextualMenu/styles.css +86 -0
  49. package/dist/esm/lib/component/ContextualMenu/types.js.map +1 -0
  50. package/dist/esm/lib/component/Popover/Popover.js +50 -0
  51. package/dist/esm/lib/component/Popover/Popover.js.map +1 -0
  52. package/dist/esm/lib/component/Popover/index.js +2 -0
  53. package/dist/esm/lib/component/Popover/index.js.map +1 -0
  54. package/dist/esm/lib/component/Popover/styles.css +65 -0
  55. package/dist/esm/lib/component/Popover/types.js +2 -0
  56. package/dist/esm/lib/component/Popover/types.js.map +1 -0
  57. package/dist/esm/lib/component/Tabs/Tabs.js +27 -0
  58. package/dist/esm/lib/component/Tabs/Tabs.js.map +1 -0
  59. package/dist/esm/lib/component/Tabs/common/Item/Item.js +20 -0
  60. package/dist/esm/lib/component/Tabs/common/Item/Item.js.map +1 -0
  61. package/dist/esm/lib/component/Tabs/common/Item/index.js +3 -0
  62. package/dist/esm/lib/component/Tabs/common/Item/index.js.map +1 -0
  63. package/dist/esm/lib/component/Tabs/common/Item/styles.css +75 -0
  64. package/dist/esm/lib/component/Tabs/common/Item/types.js +2 -0
  65. package/dist/esm/lib/component/Tabs/common/Item/types.js.map +1 -0
  66. package/dist/esm/lib/component/Tabs/common/index.js +2 -0
  67. package/dist/esm/lib/component/Tabs/common/index.js.map +1 -0
  68. package/dist/esm/lib/component/Tabs/index.js +3 -0
  69. package/dist/esm/lib/component/Tabs/index.js.map +1 -0
  70. package/dist/esm/lib/component/Tabs/styles.css +37 -0
  71. package/dist/esm/lib/component/Tabs/types.js +2 -0
  72. package/dist/esm/lib/component/Tabs/types.js.map +1 -0
  73. package/dist/esm/lib/component/Tile/Tile.js +6 -1
  74. package/dist/esm/lib/component/Tile/Tile.js.map +1 -1
  75. package/dist/esm/lib/component/Tile/common/Content/styles.css +17 -8
  76. package/dist/esm/lib/component/Tile/common/Header/styles.css +15 -12
  77. package/dist/esm/lib/component/Tile/styles.css +19 -53
  78. package/dist/esm/lib/component/Tooltip/Tooltip.js +6 -4
  79. package/dist/esm/lib/component/Tooltip/Tooltip.js.map +1 -1
  80. package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js +45 -25
  81. package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js.map +1 -1
  82. package/dist/esm/lib/component/Tooltip/styles.css +146 -81
  83. package/dist/esm/lib/component/Tooltip/withTooltip.js +3 -3
  84. package/dist/esm/lib/component/Tooltip/withTooltip.js.map +1 -1
  85. package/dist/esm/lib/component/index.js +17 -0
  86. package/dist/esm/lib/component/index.js.map +1 -0
  87. package/dist/esm/lib/group/Cards/Cards.js +49 -0
  88. package/dist/esm/lib/group/Cards/Cards.js.map +1 -0
  89. package/dist/esm/lib/group/Cards/index.js +3 -0
  90. package/dist/esm/lib/group/Cards/index.js.map +1 -0
  91. package/dist/esm/lib/group/Cards/styles.css +55 -0
  92. package/dist/esm/lib/group/Cards/types.js +2 -0
  93. package/dist/esm/lib/group/Cards/types.js.map +1 -0
  94. package/dist/esm/lib/group/index.js +4 -0
  95. package/dist/esm/lib/group/index.js.map +1 -0
  96. package/dist/esm/lib/hooks/index.js +3 -1
  97. package/dist/esm/lib/hooks/index.js.map +1 -1
  98. package/dist/esm/lib/hooks/useContextualMenu/index.js +3 -0
  99. package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -0
  100. package/dist/esm/lib/hooks/useContextualMenu/types.js +2 -0
  101. package/dist/esm/lib/hooks/useContextualMenu/types.js.map +1 -0
  102. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +181 -0
  103. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -0
  104. package/dist/esm/lib/hooks/useDisclosure/index.js +3 -0
  105. package/dist/esm/lib/hooks/useDisclosure/index.js.map +1 -0
  106. package/dist/esm/lib/hooks/useDisclosure/types.js +2 -0
  107. package/dist/esm/lib/hooks/useDisclosure/types.js.map +1 -0
  108. package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js +230 -0
  109. package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -0
  110. package/dist/esm/lib/hooks/useIsMounted/index.js +3 -0
  111. package/dist/esm/lib/hooks/useIsMounted/index.js.map +1 -0
  112. package/dist/esm/lib/hooks/useIsMounted/types.js +2 -0
  113. package/dist/esm/lib/hooks/useIsMounted/types.js.map +1 -0
  114. package/dist/esm/lib/hooks/useIsMounted/useIsMounted.js +21 -0
  115. package/dist/esm/lib/hooks/useIsMounted/useIsMounted.js.map +1 -0
  116. package/dist/esm/lib/hooks/useResizeObserver/useResizeObserver.js +37 -7
  117. package/dist/esm/lib/hooks/useResizeObserver/useResizeObserver.js.map +1 -1
  118. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +9 -0
  119. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
  120. package/dist/esm/lib/hooks/useWindowFitment/index.js +1 -0
  121. package/dist/esm/lib/hooks/useWindowFitment/index.js.map +1 -1
  122. package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js +25 -0
  123. package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js.map +1 -0
  124. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +211 -21
  125. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
  126. package/dist/esm/lib/index.js +8 -25
  127. package/dist/esm/lib/index.js.map +1 -1
  128. package/dist/esm/lib/pattern/index.js +3 -0
  129. package/dist/esm/lib/pattern/index.js.map +1 -0
  130. package/dist/esm/lib/subcomponent/Spinner/Spinner.js +35 -0
  131. package/dist/esm/lib/subcomponent/Spinner/Spinner.js.map +1 -0
  132. package/dist/esm/lib/subcomponent/Spinner/index.js +2 -0
  133. package/dist/esm/lib/subcomponent/Spinner/index.js.map +1 -0
  134. package/dist/esm/lib/subcomponent/Spinner/styles.css +50 -0
  135. package/dist/esm/lib/subcomponent/Spinner/types.js +2 -0
  136. package/dist/esm/lib/subcomponent/Spinner/types.js.map +1 -0
  137. package/dist/esm/lib/subcomponent/index.js +3 -0
  138. package/dist/esm/lib/subcomponent/index.js.map +1 -0
  139. package/dist/esm/lib/types/link.js +2 -0
  140. package/dist/esm/lib/types/link.js.map +1 -0
  141. package/dist/types/lib/_work_in_progress/Link/types.d.ts +1 -1
  142. package/dist/types/lib/_work_in_progress/Link/types.d.ts.map +1 -1
  143. package/dist/types/lib/_work_in_progress/index.d.ts +12 -0
  144. package/dist/types/lib/_work_in_progress/index.d.ts.map +1 -0
  145. package/dist/types/lib/component/Announcement/Announcement.d.ts +2 -2
  146. package/dist/types/lib/component/Announcement/Announcement.d.ts.map +1 -1
  147. package/dist/types/lib/component/Announcement/index.d.ts.map +1 -1
  148. package/dist/types/lib/component/Announcement/types.d.ts +17 -6
  149. package/dist/types/lib/component/Announcement/types.d.ts.map +1 -1
  150. package/dist/types/lib/component/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  151. package/dist/types/lib/component/Breadcrumbs/common/Item/Item.d.ts +1 -1
  152. package/dist/types/lib/component/Breadcrumbs/common/Item/Item.d.ts.map +1 -1
  153. package/dist/types/lib/component/Breadcrumbs/common/Item/types.d.ts +13 -13
  154. package/dist/types/lib/component/Breadcrumbs/common/Item/types.d.ts.map +1 -1
  155. package/dist/types/lib/component/Breadcrumbs/types.d.ts +23 -1
  156. package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
  157. package/dist/types/lib/component/Button/Button.d.ts +3 -1
  158. package/dist/types/lib/component/Button/Button.d.ts.map +1 -1
  159. package/dist/types/lib/component/Button/types.d.ts +12 -6
  160. package/dist/types/lib/component/Button/types.d.ts.map +1 -1
  161. package/dist/types/lib/component/Card/Card.d.ts +10 -5
  162. package/dist/types/lib/component/Card/Card.d.ts.map +1 -1
  163. package/dist/types/lib/component/Card/common/Footer/Footer.d.ts +2 -2
  164. package/dist/types/lib/component/Card/common/Footer/types.d.ts +2 -2
  165. package/dist/types/lib/component/Card/common/Footer/types.d.ts.map +1 -1
  166. package/dist/types/lib/component/Card/common/index.d.ts +0 -1
  167. package/dist/types/lib/component/Card/common/index.d.ts.map +1 -1
  168. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +15 -0
  169. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -0
  170. package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts +14 -0
  171. package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -0
  172. package/dist/types/lib/component/ContextualMenu/common/Item/index.d.ts +3 -0
  173. package/dist/types/lib/component/ContextualMenu/common/Item/index.d.ts.map +1 -0
  174. package/dist/types/lib/component/ContextualMenu/common/Item/types.d.ts +11 -0
  175. package/dist/types/lib/component/ContextualMenu/common/Item/types.d.ts.map +1 -0
  176. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +19 -0
  177. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -0
  178. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +15 -0
  179. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -0
  180. package/dist/types/lib/component/ContextualMenu/common/SubMenu/index.d.ts +2 -0
  181. package/dist/types/lib/component/ContextualMenu/common/SubMenu/index.d.ts.map +1 -0
  182. package/dist/types/lib/component/ContextualMenu/index.d.ts +3 -0
  183. package/dist/types/lib/component/ContextualMenu/index.d.ts.map +1 -0
  184. package/dist/types/lib/component/ContextualMenu/types.d.ts +30 -0
  185. package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -0
  186. package/dist/types/lib/component/Popover/Popover.d.ts +16 -0
  187. package/dist/types/lib/component/Popover/Popover.d.ts.map +1 -0
  188. package/dist/types/lib/component/Popover/index.d.ts +3 -0
  189. package/dist/types/lib/component/Popover/index.d.ts.map +1 -0
  190. package/dist/types/lib/component/Popover/types.d.ts +24 -0
  191. package/dist/types/lib/component/Popover/types.d.ts.map +1 -0
  192. package/dist/types/lib/component/Tabs/Tabs.d.ts +18 -0
  193. package/dist/types/lib/component/Tabs/Tabs.d.ts.map +1 -0
  194. package/dist/types/lib/component/Tabs/common/Item/Item.d.ts +15 -0
  195. package/dist/types/lib/component/Tabs/common/Item/Item.d.ts.map +1 -0
  196. package/dist/types/lib/component/Tabs/common/Item/index.d.ts +3 -0
  197. package/dist/types/lib/component/Tabs/common/Item/index.d.ts.map +1 -0
  198. package/dist/types/lib/component/Tabs/common/Item/types.d.ts +18 -0
  199. package/dist/types/lib/component/Tabs/common/Item/types.d.ts.map +1 -0
  200. package/dist/types/lib/component/Tabs/common/index.d.ts +2 -0
  201. package/dist/types/lib/component/Tabs/common/index.d.ts.map +1 -0
  202. package/dist/types/lib/component/Tabs/index.d.ts +3 -0
  203. package/dist/types/lib/component/Tabs/index.d.ts.map +1 -0
  204. package/dist/types/lib/component/Tabs/types.d.ts +46 -0
  205. package/dist/types/lib/component/Tabs/types.d.ts.map +1 -0
  206. package/dist/types/lib/component/Tile/Tile.d.ts +2 -0
  207. package/dist/types/lib/component/Tile/Tile.d.ts.map +1 -1
  208. package/dist/types/lib/component/Tile/common/Content/types.d.ts +1 -1
  209. package/dist/types/lib/component/Tile/common/Header/types.d.ts +1 -1
  210. package/dist/types/lib/component/Tile/types.d.ts +4 -5
  211. package/dist/types/lib/component/Tile/types.d.ts.map +1 -1
  212. package/dist/types/lib/component/Tooltip/Tooltip.d.ts +1 -1
  213. package/dist/types/lib/component/Tooltip/Tooltip.d.ts.map +1 -1
  214. package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts +1 -1
  215. package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts.map +1 -1
  216. package/dist/types/lib/component/Tooltip/common/TooltipArea/types.d.ts +14 -2
  217. package/dist/types/lib/component/Tooltip/common/TooltipArea/types.d.ts.map +1 -1
  218. package/dist/types/lib/component/Tooltip/types.d.ts +6 -0
  219. package/dist/types/lib/component/Tooltip/types.d.ts.map +1 -1
  220. package/dist/types/lib/component/Tooltip/withTooltip.d.ts +10 -3
  221. package/dist/types/lib/component/Tooltip/withTooltip.d.ts.map +1 -1
  222. package/dist/types/lib/component/index.d.ts +16 -0
  223. package/dist/types/lib/component/index.d.ts.map +1 -0
  224. package/dist/types/lib/group/Cards/Cards.d.ts +40 -0
  225. package/dist/types/lib/group/Cards/Cards.d.ts.map +1 -0
  226. package/dist/types/lib/group/Cards/index.d.ts +3 -0
  227. package/dist/types/lib/group/Cards/index.d.ts.map +1 -0
  228. package/dist/types/lib/group/Cards/types.d.ts +14 -0
  229. package/dist/types/lib/group/Cards/types.d.ts.map +1 -0
  230. package/dist/types/lib/group/index.d.ts +3 -0
  231. package/dist/types/lib/group/index.d.ts.map +1 -0
  232. package/dist/types/lib/hooks/index.d.ts +3 -1
  233. package/dist/types/lib/hooks/index.d.ts.map +1 -1
  234. package/dist/types/lib/hooks/useContextualMenu/index.d.ts +3 -0
  235. package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -0
  236. package/dist/types/lib/hooks/useContextualMenu/types.d.ts +71 -0
  237. package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -0
  238. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +20 -0
  239. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -0
  240. package/dist/types/lib/hooks/useDisclosure/index.d.ts +3 -0
  241. package/dist/types/lib/hooks/useDisclosure/index.d.ts.map +1 -0
  242. package/dist/types/lib/hooks/useDisclosure/types.d.ts +103 -0
  243. package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -0
  244. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +32 -0
  245. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -0
  246. package/dist/types/lib/hooks/useIsMounted/index.d.ts +3 -0
  247. package/dist/types/lib/hooks/useIsMounted/index.d.ts.map +1 -0
  248. package/dist/types/lib/hooks/useIsMounted/types.d.ts +6 -0
  249. package/dist/types/lib/hooks/useIsMounted/types.d.ts.map +1 -0
  250. package/dist/types/lib/hooks/useIsMounted/useIsMounted.d.ts +15 -0
  251. package/dist/types/lib/hooks/useIsMounted/useIsMounted.d.ts.map +1 -0
  252. package/dist/types/lib/hooks/useResizeObserver/useResizeObserver.d.ts +6 -0
  253. package/dist/types/lib/hooks/useResizeObserver/useResizeObserver.d.ts.map +1 -1
  254. package/dist/types/lib/hooks/useWindowDimensions/useWindowDimensions.d.ts.map +1 -1
  255. package/dist/types/lib/hooks/useWindowFitment/index.d.ts +1 -0
  256. package/dist/types/lib/hooks/useWindowFitment/index.d.ts.map +1 -1
  257. package/dist/types/lib/hooks/useWindowFitment/readingDirection.d.ts +14 -0
  258. package/dist/types/lib/hooks/useWindowFitment/readingDirection.d.ts.map +1 -0
  259. package/dist/types/lib/hooks/useWindowFitment/types.d.ts +75 -4
  260. package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
  261. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +44 -2
  262. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
  263. package/dist/types/lib/index.d.ts +5 -25
  264. package/dist/types/lib/index.d.ts.map +1 -1
  265. package/dist/types/lib/pattern/index.d.ts +2 -0
  266. package/dist/types/lib/pattern/index.d.ts.map +1 -0
  267. package/dist/types/lib/subcomponent/Spinner/Spinner.d.ts +24 -0
  268. package/dist/types/lib/subcomponent/Spinner/Spinner.d.ts.map +1 -0
  269. package/dist/types/lib/subcomponent/Spinner/index.d.ts +3 -0
  270. package/dist/types/lib/subcomponent/Spinner/index.d.ts.map +1 -0
  271. package/dist/types/lib/subcomponent/Spinner/types.d.ts +17 -0
  272. package/dist/types/lib/subcomponent/Spinner/types.d.ts.map +1 -0
  273. package/dist/types/lib/subcomponent/index.d.ts +2 -0
  274. package/dist/types/lib/subcomponent/index.d.ts.map +1 -0
  275. package/dist/types/lib/types/index.d.ts +1 -0
  276. package/dist/types/lib/types/index.d.ts.map +1 -1
  277. package/dist/types/lib/types/link.d.ts +26 -0
  278. package/dist/types/lib/types/link.d.ts.map +1 -0
  279. package/package.json +16 -19
  280. package/dist/esm/lib/component/Card/common/Thumbnail/Thumbnail.js +0 -21
  281. package/dist/esm/lib/component/Card/common/Thumbnail/Thumbnail.js.map +0 -1
  282. package/dist/esm/lib/component/Card/common/Thumbnail/index.js +0 -2
  283. package/dist/esm/lib/component/Card/common/Thumbnail/index.js.map +0 -1
  284. package/dist/esm/lib/component/Card/common/Thumbnail/styles.css +0 -39
  285. package/dist/esm/lib/component/Card/common/Thumbnail/types.js.map +0 -1
  286. package/dist/esm/lib/hooks/usePopup/index.js +0 -3
  287. package/dist/esm/lib/hooks/usePopup/index.js.map +0 -1
  288. package/dist/esm/lib/hooks/usePopup/types.js.map +0 -1
  289. package/dist/esm/lib/hooks/usePopup/usePopup.js +0 -93
  290. package/dist/esm/lib/hooks/usePopup/usePopup.js.map +0 -1
  291. package/dist/esm/storybook/decorators.js +0 -16
  292. package/dist/esm/storybook/decorators.js.map +0 -1
  293. package/dist/types/lib/component/Card/common/Thumbnail/Thumbnail.d.ts +0 -23
  294. package/dist/types/lib/component/Card/common/Thumbnail/Thumbnail.d.ts.map +0 -1
  295. package/dist/types/lib/component/Card/common/Thumbnail/index.d.ts +0 -3
  296. package/dist/types/lib/component/Card/common/Thumbnail/index.d.ts.map +0 -1
  297. package/dist/types/lib/component/Card/common/Thumbnail/types.d.ts +0 -27
  298. package/dist/types/lib/component/Card/common/Thumbnail/types.d.ts.map +0 -1
  299. package/dist/types/lib/hooks/usePopup/index.d.ts +0 -3
  300. package/dist/types/lib/hooks/usePopup/index.d.ts.map +0 -1
  301. package/dist/types/lib/hooks/usePopup/types.d.ts +0 -65
  302. package/dist/types/lib/hooks/usePopup/types.d.ts.map +0 -1
  303. package/dist/types/lib/hooks/usePopup/usePopup.d.ts +0 -19
  304. package/dist/types/lib/hooks/usePopup/usePopup.d.ts.map +0 -1
  305. package/dist/types/storybook/decorators.d.ts +0 -15
  306. package/dist/types/storybook/decorators.d.ts.map +0 -1
  307. /package/dist/esm/lib/component/{Card/common/Thumbnail → ContextualMenu/common/Item}/types.js +0 -0
  308. /package/dist/esm/lib/{hooks/usePopup → component/ContextualMenu}/types.js +0 -0
@@ -1,4 +1,6 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Spinner } from "../../subcomponent/Spinner/index.js";
3
+ import { Icon } from "../Icon/index.js";
2
4
  import "./styles.css";
3
5
  const componentCssClassName = "ds button";
4
6
  /**
@@ -6,30 +8,35 @@ const componentCssClassName = "ds button";
6
8
  * data transformation or manipulation. They provide clear visual
7
9
  * indicators of the primary actions users can perform.
8
10
  *
11
+ * `import { Button } from "@canonical/react-ds-global";`
12
+ *
9
13
  * @implements ds:global.component.button
10
14
  */
11
- const Button = ({ id, className, children, style, importance, anticipation, variant, icon, iconPosition = "start", ...props }) => {
15
+ const Button = ({ id, className, children, style, importance = "primary", anticipation, variant, icon, loading = false, disabled, ...props }) => {
12
16
  // Booleans and nullish children render nothing; everything else (including
13
17
  // the number 0) produces visible text that names the button.
14
18
  const hasVisibleChildren = children != null && typeof children !== "boolean" && children !== "";
15
19
  if (typeof process !== "undefined" &&
16
20
  process.env.NODE_ENV !== "production" &&
17
- icon &&
21
+ (icon || loading) &&
18
22
  !hasVisibleChildren &&
19
23
  !props["aria-label"] &&
20
24
  !props["aria-labelledby"]) {
21
25
  console.warn("Button: icon-only buttons need an explicit `aria-label` or `aria-labelledby` to be accessible.");
22
26
  }
23
- const iconElement = icon && _jsx("span", { className: "icon", children: icon });
24
- return (_jsx("button", { id: id, className: [
27
+ // The icon slot only accepts a design-system icon name; the Icon component
28
+ // maps it to the @canonical/ds-assets sprite (decorative by default).
29
+ const iconElement = icon && (_jsx("span", { className: "icon", children: _jsx(Icon, { icon: icon }) }));
30
+ return (_jsxs("button", { id: id, className: [
25
31
  componentCssClassName,
26
32
  importance,
27
33
  anticipation,
28
34
  variant,
35
+ loading && "loading",
29
36
  className,
30
37
  ]
31
38
  .filter(Boolean)
32
- .join(" "), style: style, ...props, children: iconPosition === "start" ? (_jsxs(_Fragment, { children: [iconElement, children] })) : (_jsxs(_Fragment, { children: [children, iconElement] })) }));
39
+ .join(" "), style: style, "aria-busy": loading || undefined, disabled: disabled || loading, ...props, children: [iconElement, hasVisibleChildren && _jsx("span", { className: "label", children: children }), loading && (_jsx("span", { className: "loading-spinner", "aria-hidden": "true", children: _jsx(Spinner, {}) }))] }));
33
40
  };
34
41
  export default Button;
35
42
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,EACV,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,YAAY,GAAG,OAAO,EACtB,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,kBAAkB,GACtB,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,CAAC;IAEvE,IACE,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QACrC,IAAI;QACJ,CAAC,kBAAkB;QACnB,CAAC,KAAK,CAAC,YAAY,CAAC;QACpB,CAAC,KAAK,CAAC,iBAAiB,CAAC,EACzB,CAAC;QACD,OAAO,CAAC,IAAI,CACV,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,IAAI,eAAM,SAAS,EAAC,MAAM,YAAE,IAAI,GAAQ,CAAC;IAEjE,OAAO,CACL,iBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE;YACT,qBAAqB;YACrB,UAAU;YACV,YAAY;YACZ,OAAO;YACP,SAAS;SACV;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,KAAK,EAAE,KAAK,KACR,KAAK,YAER,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,CAC1B,8BACG,WAAW,EACX,QAAQ,IACR,CACJ,CAAC,CAAC,CAAC,CACF,8BACG,QAAQ,EACR,WAAW,IACX,CACJ,GACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/lib/component/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,GAAG,SAAS,EACtB,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,kBAAkB,GACtB,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,CAAC;IAEvE,IACE,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QACrC,CAAC,IAAI,IAAI,OAAO,CAAC;QACjB,CAAC,kBAAkB;QACnB,CAAC,KAAK,CAAC,YAAY,CAAC;QACpB,CAAC,KAAK,CAAC,iBAAiB,CAAC,EACzB,CAAC;QACD,OAAO,CAAC,IAAI,CACV,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,sEAAsE;IACtE,MAAM,WAAW,GAAG,IAAI,IAAI,CAC1B,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,GACf,CACR,CAAC;IAEF,OAAO,CACL,kBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE;YACT,qBAAqB;YACrB,UAAU;YACV,YAAY;YACZ,OAAO;YACP,OAAO,IAAI,SAAS;YACpB,SAAS;SACV;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,KAAK,EAAE,KAAK,eAED,OAAO,IAAI,SAAS,EAC/B,QAAQ,EAAE,QAAQ,IAAI,OAAO,KACzB,KAAK,aAMR,WAAW,EACX,kBAAkB,IAAI,eAAM,SAAS,EAAC,OAAO,YAAE,QAAQ,GAAQ,EAC/D,OAAO,IAAI,CACV,eAAM,SAAS,EAAC,iBAAiB,iBAAa,MAAM,YAClD,KAAC,OAAO,KAAG,GACN,CACR,IACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,21 +1,48 @@
1
1
  /* Component tokens — sourced from @canonical/design-tokens */
2
2
  :root {
3
- --button-color-background: var(--color-foreground-secondary);
4
- --button-color-background-hover: var(--color-foreground-secondary-hover);
5
- --button-color-background-active: var(--color-foreground-secondary-active);
3
+ /* Channel fallbacks used when no importance modifier is applied. Primary is
4
+ the default hierarchy, so a bare `<button class="ds button">` reads as the
5
+ filled primary look: the primary foreground fills the background and the
6
+ label takes the on-fill contrast colour. */
7
+ --button-color-background: var(
8
+ --modifier-color-foreground-primary,
9
+ var(--color-foreground-primary)
10
+ );
11
+ --button-color-background-hover: var(--color-foreground-primary-hover);
12
+ --button-color-background-active: var(--color-foreground-primary-active);
13
+ --button-color-background-disabled: var(--color-foreground-primary-disabled);
14
+ /* Neutral text is the normal text colour. The filled default reads as
15
+ contrast on the fill because `.primary` (the default importance, applied by
16
+ the component) overrides text/icon to the on-fill contrast tokens; ghost
17
+ importances keep this normal colour, so they stay visible. */
6
18
  --button-color-text: var(--color-text);
7
- --button-color-border: var(--color-border-high-contrast);
8
- --button-color-border-hover: var(--button-color-border);
9
- --button-color-border-active: var(--button-color-border);
10
-
11
- --button-margin-left: var(--spacing-horizontal-large);
12
- --button-margin-bottom: var(--spacing-input-margin-bottom);
13
- --button-padding-vertical: var(--spacing-input-padding-vertical);
14
- --button-padding-horizontal: var(--spacing-horizontal-large);
15
- --button-border-width: var(--spacing-border-width);
16
- --button-font-size: var(--font-size-default);
17
- --button-font-weight: var(--font-weight-default);
18
- --button-line-height: var(--line-height-default);
19
+ --button-color-border: var(--color-border-highlighted, var(--color-border));
20
+
21
+ /* Inline padding (Figma):
22
+ - end (right): always dimension-200 (16px) — the label always sits 16px
23
+ from the trailing edge.
24
+ - start (left): dimension-200 (16px) with no icon; dimension-100 (8px) when
25
+ an icon leads (the icon then sits closer to the edge), with a
26
+ dimension-100 (8px) gap between the icon and the label. */
27
+ --button-padding-inline-end: var(--dimension-200);
28
+ --button-padding-inline-start: var(--dimension-200);
29
+ --button-gap: var(--dimension-100);
30
+ --button-border-width: var(--dimension-stroke-thickness-medium);
31
+ /* Label weight — the button label is medium, not the `.p` body weight. */
32
+ --button-font-weight: var(--typography-weight-medium);
33
+ /* Label size — the button label is the text-secondary tier (14px), not the
34
+ `.p` text-primary tier (16px). The line-height snaps up to the baseline
35
+ grid exactly as the typography mapper does, so the box stays 32px tall
36
+ (24px line + 8px of baseline nudges) around 14px text. */
37
+ --button-font-size: var(--typography-text-secondary-font-size);
38
+ --button-line-height: round(
39
+ up,
40
+ calc(
41
+ var(--button-font-size) *
42
+ var(--typography-text-secondary-line-height)
43
+ ),
44
+ var(--baseline-height)
45
+ );
19
46
  }
20
47
 
21
48
  /* ==========================================================================
@@ -23,54 +50,105 @@
23
50
  ========================================================================== */
24
51
 
25
52
  /*
26
- Modifier channel variables (from @canonical/design-tokens):
27
- --modifier-color-foreground-primary filled background (constructive, destructive, caution)
28
- --modifier-color-text text colour
29
- --modifier-color-border border colour
30
- --modifier-color-icon icon colour
31
- --modifier-color-focusRing focus ring colour
53
+ The button reads the modifier CHANNEL generically — it is not aware of any
54
+ particular importance/anticipation class or combination:
55
+
56
+ --modifier-surface which foreground fills the background (importance:
57
+ filled for primary, ghost for secondary/tertiary).
58
+ --modifier-outline 1 when a border shows, 0 when it does not (importance).
59
+ --modifier-color-* the colour itself (anticipation/emphasis): text, icon,
60
+ border. `.primary` overrides text/icon with the on-fill
61
+ contrast tokens.
62
+
63
+ Interaction states read the per-state surface/text/border channels supplied
64
+ by the states shim (`--modifier-surface-{hover,active,disabled}`,
65
+ `--modifier-color-text-disabled`, `--modifier-color-border-disabled`), which
66
+ resolve to the explicit state tokens and recolour per anticipation.
32
67
  */
33
68
 
34
69
  .ds.button {
70
+ position: relative;
35
71
  display: inline-flex;
36
72
  align-items: center;
37
73
  justify-content: center;
38
- gap: var(--spacing-horizontal-small, 0.5rem);
74
+ gap: var(--button-gap);
39
75
  cursor: pointer;
40
76
 
41
77
  color: var(--modifier-color-text, var(--button-color-text));
42
- background-color: var(
43
- --modifier-color-foreground-primary,
44
- var(--button-color-background)
45
- );
78
+ background-color: var(--modifier-surface, var(--button-color-background));
46
79
  border-color: var(--modifier-color-border, var(--button-color-border));
47
80
  border-style: solid;
48
- border-width: var(--button-border-width);
81
+ /* The outline flag (0/1) toggles the border on: multiplying the width means
82
+ a borderless importance simply resolves to 0 with no separate rule. */
83
+ border-width: calc(var(--modifier-outline, 0) * var(--button-border-width));
49
84
 
50
- font-size: var(--button-font-size);
85
+ /* Label typography tokens (text-secondary tier, 14px). The block placement that
86
+ lands the label on the baseline grid comes from the density seat at the end of
87
+ this file (the button no longer carries `.p`, so the engine's on-element nudges
88
+ don't apply — without the seat the label is flat/unaligned). --font-size /
89
+ --line-height are still exposed for any consumer that reads them. */
90
+ --font-size: var(--button-font-size);
91
+ --line-height: var(--button-line-height);
51
92
  font-weight: var(--button-font-weight);
52
- line-height: var(--button-line-height);
53
- margin-block-end: var(--button-margin-bottom);
54
- margin-inline-end: var(--button-margin-left);
55
- padding-block: var(--button-padding-vertical);
56
- padding-inline: var(--button-padding-horizontal);
93
+ padding-inline: var(--button-padding-inline-start)
94
+ var(--button-padding-inline-end);
57
95
 
58
96
  text-align: center;
59
97
  text-decoration: none;
60
98
 
99
+ /* Fast colour transition on state change (hover/active/disabled). */
100
+ transition:
101
+ background-color var(--motion-duration-fast) var(--motion-easing-standard),
102
+ color var(--motion-duration-fast) var(--motion-easing-standard),
103
+ border-color var(--motion-duration-fast) var(--motion-easing-standard);
104
+
105
+ /* A leading icon tightens the start padding to dimension-100; the gap between
106
+ the icon and label is already dimension-100. */
107
+ &:has(> .icon) {
108
+ --button-padding-inline-start: var(--dimension-100);
109
+ }
110
+
111
+ /* State fallbacks resolve to the default (primary) surface states when no
112
+ importance modifier supplies `--modifier-surface-*`. */
61
113
  &:hover:not(:disabled) {
62
- background-color: var(--button-color-background-hover);
63
- border-color: var(--button-color-border-hover);
114
+ background-color: var(
115
+ --modifier-surface-hover,
116
+ var(--button-color-background-hover)
117
+ );
64
118
  }
65
119
 
66
120
  &:active:not(:disabled) {
67
- background-color: var(--button-color-background-active);
68
- border-color: var(--button-color-border-active);
121
+ background-color: var(
122
+ --modifier-surface-active,
123
+ var(--button-color-background-active)
124
+ );
69
125
  }
70
126
 
127
+ /* Keyboard focus ring — driven by the modifier focusRing channel so it
128
+ recolours per anticipation; falls back to the base focus ring token. */
129
+ &:focus-visible {
130
+ outline: var(--focus-outline-width, 2px) solid
131
+ var(--modifier-color-focusRing, var(--color-focusRing, currentColor));
132
+ outline-offset: var(--focus-outline-offset, 2px);
133
+ }
134
+
135
+ /* Disabled — explicit disabled tokens (not the computed deltas): the surface,
136
+ text and border each resolve to their `-disabled` token. Primary supplies
137
+ the on-fill disabled text via `--modifier-color-text-disabled`; ghost
138
+ importances fall back to the plain disabled text colour. The border reads
139
+ the disabled border channel, so it stays on the same highlighted ramp as
140
+ the enabled border and recolours per anticipation. */
71
141
  &:disabled {
72
142
  cursor: not-allowed;
73
- opacity: 0.5;
143
+ color: var(--modifier-color-text-disabled, var(--color-text-disabled));
144
+ background-color: var(
145
+ --modifier-surface-disabled,
146
+ var(--button-color-background-disabled)
147
+ );
148
+ border-color: var(
149
+ --modifier-color-border-disabled,
150
+ var(--color-border-highlighted-disabled)
151
+ );
74
152
  }
75
153
  }
76
154
 
@@ -85,6 +163,44 @@
85
163
  flex-shrink: 0;
86
164
  width: var(--icon-size, 1em);
87
165
  height: var(--icon-size, 1em);
166
+
167
+ /* The icon has its own colour channel (distinct from the label text): on a
168
+ filled primary it is the on-fill contrast icon, on ghost importances the
169
+ modifier icon colour. Icons drawn with `currentColor` follow this. */
170
+ color: var(--modifier-color-icon, var(--modifier-color-text, currentColor));
171
+ }
172
+
173
+ .ds.button:disabled > .icon {
174
+ color: var(--modifier-color-icon-disabled, var(--color-icon-disabled));
175
+ }
176
+
177
+ /* ==========================================================================
178
+ Loading State
179
+ ========================================================================== */
180
+
181
+ /* Loading replaces the label with a Spinner but keeps the button's width: the
182
+ icon and label stay in the DOM (hidden, so their box still reserves space)
183
+ and the Spinner is overlaid centred on top. A loading button is disabled (so
184
+ it can't be re-triggered), but it must not *read* as disabled — it is
185
+ working, not unavailable — so it keeps the enabled surface, text and border
186
+ colours, overriding the :disabled greying above. */
187
+ .ds.button.loading {
188
+ color: var(--modifier-color-text, var(--button-color-text));
189
+ background-color: var(--modifier-surface, var(--button-color-background));
190
+ border-color: var(--modifier-color-border, var(--button-color-border));
191
+
192
+ & > .icon,
193
+ & > .label {
194
+ visibility: hidden;
195
+ }
196
+
197
+ & > .loading-spinner {
198
+ position: absolute;
199
+ inset: 0;
200
+ display: inline-flex;
201
+ align-items: center;
202
+ justify-content: center;
203
+ }
88
204
  }
89
205
 
90
206
  /* ==========================================================================
@@ -114,3 +230,49 @@
114
230
  border-color: transparent;
115
231
  }
116
232
  }
233
+
234
+ /* ── Density seat (apps 32 / sites 36, dense 24 / 28) ────────────────────────
235
+ * The button consumes the density primitives from @canonical/styles (context ×
236
+ * density on an ancestor) to size its box to the cell and seat its label on the
237
+ * 4px baseline grid. This lives HERE (ds-global) and not in
238
+ * @canonical/react-ds-global-form's density.css, because the Button is a ds-global
239
+ * component: an app that ships ds-global without the form package must still get a
240
+ * seated button, not a flat one. The primitives are read from the shared styles
241
+ * layer, so there is no form dependency.
242
+ *
243
+ * `:is()` on the density scope (0,1,0) so `:is(...) .ds.button` (0,2,0) beats the
244
+ * button's own `.ds.button { align-items: center }` (0,1,0) — otherwise the label
245
+ * stays flex-CENTRED and the padding-based baseline placement can't govern. */
246
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.button {
247
+ box-sizing: border-box;
248
+ /* Fixed grid-multiple height (the density cell), border-box so the border is
249
+ absorbed into the height — a bordered and a borderless button of one density
250
+ are the same height. Top-referenced so the space-before below governs. */
251
+ block-size: var(--density-line-height-effective);
252
+ min-block-size: var(--density-line-height-effective);
253
+ align-items: flex-start;
254
+ justify-content: flex-start;
255
+ /* Kill only the UA bottom padding; the placement below owns padding-block-start
256
+ (a `padding-block: 0` shorthand would out-specify and wipe the start). */
257
+ padding-block-end: 0;
258
+
259
+ /* Crush to line-height:1 for the seat; the baseline within that box is the cap
260
+ approximation (1em + 1cap)/2. The label font tier (--font-size/--font-family)
261
+ is the button's own (text-secondary, 14px), set on the base rule. */
262
+ line-height: 1;
263
+ --natural-baseline: calc((1em + 1cap) / 2);
264
+ /* The box's top border sits above the label and counts toward the target, so
265
+ subtract the NOMINAL --button-border-width for BOTH importances — the primary's
266
+ 0-outline (borderless) is handled by the grid maths, not by zeroing this term
267
+ (a per-importance term lifts the primary a pixel; regression, reverted). */
268
+ --border-top-width: var(--button-border-width, 0px);
269
+ --space-before: max(
270
+ 0px,
271
+ calc(
272
+ var(--density-target-baseline-px, 0px) -
273
+ var(--natural-baseline) -
274
+ var(--border-top-width, 0px)
275
+ )
276
+ );
277
+ padding-block-start: var(--space-before);
278
+ }
@@ -1,9 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Content, Footer, Header, Image, Thumbnail } from "./common/index.js";
2
+ import { Content, Footer, Header, Image } from "./common/index.js";
3
3
  import "./styles.css";
4
- // The Card establishes its own `.surface` context so its background steps when
5
- // nested inside another surface or card.
6
- const componentCssClassName = "ds card surface";
4
+ // The Card is NOT a surface: it establishes no `.surface` context of its own,
5
+ // so on a surface it takes the same background (no step) and reads as flush
6
+ // with its container. It stays delimited by its border, radius, and the
7
+ // dividers between its sections.
8
+ const componentCssClassName = "ds card";
7
9
  /**
8
10
  * The card is a container that is designed to represent data objects that share
9
11
  * the same structure. Unlike the more flexible Tile, a card is designed to have
@@ -11,13 +13,21 @@ const componentCssClassName = "ds card surface";
11
13
  * predictable structure that allows the user to compare attributes across data
12
14
  * objects.
13
15
  *
14
- * @implements dso:global.component.card
16
+ * A Card is always a grid participant: `.ds.card` is a ROW SUBGRID that spans
17
+ * four fixed section tracks (image / header / content / footer), inheriting them
18
+ * from its parent grid. Standalone (wrapped in a `.grid`) it lays its own
19
+ * sections out on those tracks; inside a `Cards` group it shares the group's
20
+ * tracks so the same sections line up across every card in the row. See the
21
+ * `Cards` group component for the full layout model.
22
+ *
23
+ * `import { Card } from "@canonical/react-ds-global";`
24
+ *
25
+ * @implements ds:global.component.card
15
26
  */
16
27
  const Card = ({ className, children, ...props }) => (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: children }));
17
28
  Card.Content = Content;
18
29
  Card.Footer = Footer;
19
30
  Card.Header = Header;
20
31
  Card.Image = Image;
21
- Card.Thumbnail = Thumbnail;
22
32
  export default Card;
23
33
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../../src/lib/component/Card/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,cAAc,CAAC;AAEtB,+EAA+E;AAC/E,yCAAyC;AACzC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACE,EAAsB,EAAE,CAAC,CACnC,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AAEF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAE3B,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../../src/lib/component/Card/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,iCAAiC;AACjC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACE,EAAsB,EAAE,CAAC,CACnC,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AAEF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAEnB,eAAe,IAAI,CAAC"}
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * Card.Content styles
3
- * @implements dso:global.subcomponent.card-content
3
+ * @implements ds:global.subcomponent.card-content
4
4
  *
5
5
  * DSL anatomy: layout.type stack, direction vertical.
6
6
  * A content-bearing section: it pads itself (the card frame applies no general
7
- * padding). Vertical padding is in baseline multiples.
7
+ * padding). Vertical padding is in baseline multiples, asymmetric per the
8
+ * Figma styling frame: one baseline on top, two below (top 100 / bottom 200 /
9
+ * sides 200).
8
10
  */
9
11
  :root {
10
12
  --card-content-gap: var(--dimension-100);
11
- --card-content-padding-block: var(--dimension-200);
13
+ --card-content-padding-block-start: var(--dimension-100);
14
+ --card-content-padding-block-end: var(--dimension-200);
12
15
  --card-content-padding-inline: var(--dimension-200);
13
16
  }
14
17
 
@@ -17,6 +20,7 @@
17
20
  flex-direction: column;
18
21
  gap: var(--card-content-gap);
19
22
 
20
- padding-block: var(--card-content-padding-block);
23
+ padding-block-start: var(--card-content-padding-block-start);
24
+ padding-block-end: var(--card-content-padding-block-end);
21
25
  padding-inline: var(--card-content-padding-inline);
22
26
  }
@@ -3,9 +3,9 @@ import "./styles.css";
3
3
  const componentCssClassName = "ds card-footer";
4
4
  /**
5
5
  * Footer component for Card. A padded content-bearing section pinned to the
6
- * bottom of the card, for actions or supplementary information.
6
+ * bottom of the card, for tags and labels.
7
7
  *
8
- * @implements dso:global.subcomponent.card-footer
8
+ * @implements ds:global.subcomponent.card-footer
9
9
  */
10
10
  const Footer = ({ children, className, ...props }) => {
11
11
  return (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: children }));
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Card.Footer styles
3
- * @implements dso:global.subcomponent.card-footer
3
+ * @implements ds:global.subcomponent.card-footer
4
4
  *
5
5
  * A content-bearing section: it pads itself (the card frame applies no general
6
- * padding). Vertical padding is in baseline multiples.
6
+ * padding). Vertical padding is in baseline multiples. Holds tags and labels,
7
+ * which flow in a wrapping row.
7
8
  */
8
9
  :root {
9
10
  --card-footer-gap: var(--dimension-100);
@@ -12,10 +13,19 @@
12
13
  }
13
14
 
14
15
  .ds.card-footer {
16
+ /* Inline flow: badges, chips and inline text sit on a line and wrap. Children
17
+ * keep their natural width (`flex: 0 0 auto` — no grow, no shrink) and are
18
+ * vertically centred, so a Badge is not stretched to the footer width. */
15
19
  display: flex;
16
- flex-direction: column;
20
+ flex-direction: row;
21
+ flex-wrap: wrap;
22
+ align-items: center;
17
23
  gap: var(--card-footer-gap);
18
24
 
19
25
  padding-block: var(--card-footer-padding-block);
20
26
  padding-inline: var(--card-footer-padding-inline);
27
+
28
+ & > * {
29
+ flex: 0 0 auto;
30
+ }
21
31
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Card.Header styles
3
- * @implements dso:global.subcomponent.card-header
3
+ * @implements ds:global.subcomponent.card-header
4
4
  *
5
5
  * DSL anatomy: layout.type flow, space-between; title uses font/weight/semibold.
6
6
  * A content-bearing section: it pads itself (the card frame applies no general
@@ -2,5 +2,4 @@ export * from "./Content/index.js";
2
2
  export * from "./Footer/index.js";
3
3
  export * from "./Header/index.js";
4
4
  export * from "./Image/index.js";
5
- export * from "./Thumbnail/index.js";
6
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/component/Card/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/component/Card/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -1,11 +1,21 @@
1
1
  /**
2
2
  * Card styles
3
- * @implements dso:global.component.card
3
+ * @implements ds:global.component.card
4
4
  *
5
- * The Card establishes its own `.surface` context (applied by the component),
6
- * so its background reads the surface channel and auto-steps when a card is
7
- * nested inside another surface or card (surface 1 -> base, 2 -> layer2,
8
- * 3 -> layer3). Colour tokens follow the Figma spec.
5
+ * The Card is NOT a surface: it establishes no `.surface` context and sets no
6
+ * background of its own, so on a surface it takes the same background as its
7
+ * container (no step) and reads as flush. It stays delimited by its border,
8
+ * radius, and the dividers between its sections. Colour tokens follow the Figma
9
+ * spec.
10
+ *
11
+ * ── A Card is a grid participant ────────────────────────────────────────────
12
+ * A Card always lives inside a grid (standalone: wrap it in a `.grid`; in bulk:
13
+ * use the `Cards` group). It carries all of its OWN grid logic here. The card is
14
+ * a ROW SUBGRID spanning FOUR section tracks — image / header / content / footer
15
+ * — inheriting them from the parent so several cards can line their sections up
16
+ * across a row. A card that omits a section simply leaves that track empty for
17
+ * itself; the four-track vocabulary is fixed because a Card only ever has those
18
+ * four section types. `Cards` supplies the shared tracks and the column flow.
9
19
  */
10
20
  :root {
11
21
  --card-color-border: var(--color-border-muted);
@@ -15,27 +25,55 @@
15
25
  }
16
26
 
17
27
  .ds.card {
18
- display: flex;
19
- flex-direction: column;
20
-
21
- /* Background from the surface channel (the component adds `.surface`, so the
22
- channel is established on this element and steps with nesting). */
23
- background: var(--surface-color-background, var(--color-background));
28
+ /* One grid item spanning `--card-span` parent columns and its four section
29
+ * rows; a ROW subgrid so its sections snap to the parent's four shared tracks
30
+ * (that is the cross-card alignment). The parent (a `.grid` or the `Cards`
31
+ * group) owns the four row tracks. */
32
+ grid-column: span var(--card-span, 1);
33
+ grid-row: span 4;
34
+ display: grid;
35
+ grid-template-rows: subgrid;
36
+ grid-template-columns: minmax(0, 1fr);
24
37
 
38
+ /* No background of its own: the card is not a surface, so it inherits its
39
+ container's background and blends with the surface it sits on. */
25
40
  border: var(--card-border-width) solid var(--card-color-border);
26
41
  border-radius: var(--card-border-radius);
27
-
28
42
  /* Clip section corners (e.g. full-bleed images) to the card radius. */
29
43
  overflow: hidden;
44
+ }
45
+
46
+ /* Place each section on its fixed row track, spanning the card's single column.
47
+ * DOM order matches track order: image (1) / header (2) / content (3) /
48
+ * footer (4). An absent section leaves its track empty for this card only. */
49
+ .ds.card > .card-image {
50
+ grid-row: 1;
51
+ grid-column: 1 / -1;
52
+ }
53
+ .ds.card > .card-header {
54
+ grid-row: 2;
55
+ grid-column: 1 / -1;
56
+ }
57
+ .ds.card > .card-content {
58
+ grid-row: 3;
59
+ grid-column: 1 / -1;
60
+ }
61
+ .ds.card > .card-footer {
62
+ grid-row: 4;
63
+ grid-column: 1 / -1;
64
+ }
65
+
66
+ /* Section separators: a divider between adjacent sections. The card frame
67
+ * provides the outer border, so the last section has none. The header is NOT a
68
+ * separate visual section — no divider is drawn under it and it merges with the
69
+ * content that follows. Media (Image) stays full-bleed; the content-bearing
70
+ * sections pad themselves. */
71
+ .ds.card > :is(.card-content, .card-footer, .card-image):not(:last-child) {
72
+ border-block-end: var(--card-border-width) solid var(--card-color-border);
73
+ }
30
74
 
31
- /* Section separators: a divider between adjacent sections. The card frame
32
- already provides the outer border, so the last section has none. The card
33
- itself applies NO general padding — only the content-bearing sections
34
- (Content, Header, Footer) pad themselves; media (Image) stays full-bleed. */
35
- &
36
- > :is(.card-header, .card-content, .card-footer, .card-image):not(
37
- :last-child
38
- ) {
39
- border-block-end: var(--card-border-width) solid var(--card-color-border);
40
- }
75
+ /* Collapse the header/content seam so title and content read as one region
76
+ (raw 0: unthemable by design). */
77
+ .ds.card > .card-header:has(+ .card-content) {
78
+ padding-block-end: 0;
41
79
  }
@@ -99,6 +99,9 @@
99
99
 
100
100
  /* Context-specific styling for badges within chips */
101
101
  & .ds.badge {
102
+ /** Pull the badge closer to the edge of a chip */
103
+ --badge-chip-margin-tweak: var(--dimension-025);
104
+
102
105
  align-self: center;
103
106
  margin-left: var(--spacing-horizontal-small);
104
107
  margin-right: var(--badge-chip-margin-tweak);