@canonical/react-ds-global 0.10.0-experimental.8

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 +28 -0
  2. package/dist/esm/index.js +3 -0
  3. package/dist/esm/index.js.map +1 -0
  4. package/dist/esm/lib/index.js +2 -0
  5. package/dist/esm/lib/index.js.map +1 -0
  6. package/dist/esm/lib/types/index.js +2 -0
  7. package/dist/esm/lib/types/index.js.map +1 -0
  8. package/dist/esm/lib/types/polymorphic.js +2 -0
  9. package/dist/esm/lib/types/polymorphic.js.map +1 -0
  10. package/dist/esm/storybook/decorators.js +16 -0
  11. package/dist/esm/storybook/decorators.js.map +1 -0
  12. package/dist/esm/ui/Badge/Badge.js +21 -0
  13. package/dist/esm/ui/Badge/Badge.js.map +1 -0
  14. package/dist/esm/ui/Badge/hooks/useBadge.js +23 -0
  15. package/dist/esm/ui/Badge/hooks/useBadge.js.map +1 -0
  16. package/dist/esm/ui/Badge/index.js +4 -0
  17. package/dist/esm/ui/Badge/index.js.map +1 -0
  18. package/dist/esm/ui/Badge/styles.css +21 -0
  19. package/dist/esm/ui/Badge/types.js +3 -0
  20. package/dist/esm/ui/Badge/types.js.map +1 -0
  21. package/dist/esm/ui/Button/Button.js +10 -0
  22. package/dist/esm/ui/Button/Button.js.map +1 -0
  23. package/dist/esm/ui/Button/index.js +2 -0
  24. package/dist/esm/ui/Button/index.js.map +1 -0
  25. package/dist/esm/ui/Button/styles.css +63 -0
  26. package/dist/esm/ui/Button/types.js +12 -0
  27. package/dist/esm/ui/Button/types.js.map +1 -0
  28. package/dist/esm/ui/Card/Card.js +16 -0
  29. package/dist/esm/ui/Card/Card.js.map +1 -0
  30. package/dist/esm/ui/Card/common/Image/Image.js +14 -0
  31. package/dist/esm/ui/Card/common/Image/Image.js.map +1 -0
  32. package/dist/esm/ui/Card/common/Image/index.js +2 -0
  33. package/dist/esm/ui/Card/common/Image/index.js.map +1 -0
  34. package/dist/esm/ui/Card/common/Image/styles.css +7 -0
  35. package/dist/esm/ui/Card/common/Image/types.js +3 -0
  36. package/dist/esm/ui/Card/common/Image/types.js.map +1 -0
  37. package/dist/esm/ui/Card/common/Section/Section.js +13 -0
  38. package/dist/esm/ui/Card/common/Section/Section.js.map +1 -0
  39. package/dist/esm/ui/Card/common/Section/index.js +2 -0
  40. package/dist/esm/ui/Card/common/Section/index.js.map +1 -0
  41. package/dist/esm/ui/Card/common/Section/styles.css +6 -0
  42. package/dist/esm/ui/Card/common/Section/types.js +3 -0
  43. package/dist/esm/ui/Card/common/Section/types.js.map +1 -0
  44. package/dist/esm/ui/Card/common/ThumbnailSection/ThumbnailSection.js +14 -0
  45. package/dist/esm/ui/Card/common/ThumbnailSection/ThumbnailSection.js.map +1 -0
  46. package/dist/esm/ui/Card/common/ThumbnailSection/index.js +2 -0
  47. package/dist/esm/ui/Card/common/ThumbnailSection/index.js.map +1 -0
  48. package/dist/esm/ui/Card/common/ThumbnailSection/styles.css +11 -0
  49. package/dist/esm/ui/Card/common/ThumbnailSection/types.js +3 -0
  50. package/dist/esm/ui/Card/common/ThumbnailSection/types.js.map +1 -0
  51. package/dist/esm/ui/Card/common/index.js +4 -0
  52. package/dist/esm/ui/Card/common/index.js.map +1 -0
  53. package/dist/esm/ui/Card/index.js +3 -0
  54. package/dist/esm/ui/Card/index.js.map +1 -0
  55. package/dist/esm/ui/Card/styles.css +23 -0
  56. package/dist/esm/ui/Card/types.js +3 -0
  57. package/dist/esm/ui/Card/types.js.map +1 -0
  58. package/dist/esm/ui/Chip/Chip.js +15 -0
  59. package/dist/esm/ui/Chip/Chip.js.map +1 -0
  60. package/dist/esm/ui/Chip/index.js +4 -0
  61. package/dist/esm/ui/Chip/index.js.map +1 -0
  62. package/dist/esm/ui/Chip/styles.css +86 -0
  63. package/dist/esm/ui/Chip/types.js +2 -0
  64. package/dist/esm/ui/Chip/types.js.map +1 -0
  65. package/dist/esm/ui/Icon/Icon.js +15 -0
  66. package/dist/esm/ui/Icon/Icon.js.map +1 -0
  67. package/dist/esm/ui/Icon/index.js +4 -0
  68. package/dist/esm/ui/Icon/index.js.map +1 -0
  69. package/dist/esm/ui/Icon/styles.css +12 -0
  70. package/dist/esm/ui/Icon/types.js +3 -0
  71. package/dist/esm/ui/Icon/types.js.map +1 -0
  72. package/dist/esm/ui/Link/Link.js +15 -0
  73. package/dist/esm/ui/Link/Link.js.map +1 -0
  74. package/dist/esm/ui/Link/index.js +4 -0
  75. package/dist/esm/ui/Link/index.js.map +1 -0
  76. package/dist/esm/ui/Link/styles.css +25 -0
  77. package/dist/esm/ui/Link/types.js +3 -0
  78. package/dist/esm/ui/Link/types.js.map +1 -0
  79. package/dist/esm/ui/Rule/Rule.js +16 -0
  80. package/dist/esm/ui/Rule/Rule.js.map +1 -0
  81. package/dist/esm/ui/Rule/index.js +4 -0
  82. package/dist/esm/ui/Rule/index.js.map +1 -0
  83. package/dist/esm/ui/Rule/styles.css +16 -0
  84. package/dist/esm/ui/Rule/types.js +3 -0
  85. package/dist/esm/ui/Rule/types.js.map +1 -0
  86. package/dist/esm/ui/Section/Section.js +21 -0
  87. package/dist/esm/ui/Section/Section.js.map +1 -0
  88. package/dist/esm/ui/Section/constants.js +2 -0
  89. package/dist/esm/ui/Section/constants.js.map +1 -0
  90. package/dist/esm/ui/Section/index.js +4 -0
  91. package/dist/esm/ui/Section/index.js.map +1 -0
  92. package/dist/esm/ui/Section/styles.css +50 -0
  93. package/dist/esm/ui/Section/types.js +3 -0
  94. package/dist/esm/ui/Section/types.js.map +1 -0
  95. package/dist/esm/ui/SkipLink/SkipLink.js +20 -0
  96. package/dist/esm/ui/SkipLink/SkipLink.js.map +1 -0
  97. package/dist/esm/ui/SkipLink/index.js +4 -0
  98. package/dist/esm/ui/SkipLink/index.js.map +1 -0
  99. package/dist/esm/ui/SkipLink/styles.css +21 -0
  100. package/dist/esm/ui/SkipLink/types.js +3 -0
  101. package/dist/esm/ui/SkipLink/types.js.map +1 -0
  102. package/dist/esm/ui/Tooltip/Tooltip.js +18 -0
  103. package/dist/esm/ui/Tooltip/Tooltip.js.map +1 -0
  104. package/dist/esm/ui/Tooltip/common/TooltipArea/TooltipArea.js +40 -0
  105. package/dist/esm/ui/Tooltip/common/TooltipArea/TooltipArea.js.map +1 -0
  106. package/dist/esm/ui/Tooltip/common/TooltipArea/index.js +4 -0
  107. package/dist/esm/ui/Tooltip/common/TooltipArea/index.js.map +1 -0
  108. package/dist/esm/ui/Tooltip/common/TooltipArea/styles.css +13 -0
  109. package/dist/esm/ui/Tooltip/common/TooltipArea/types.js +2 -0
  110. package/dist/esm/ui/Tooltip/common/TooltipArea/types.js.map +1 -0
  111. package/dist/esm/ui/Tooltip/common/index.js +2 -0
  112. package/dist/esm/ui/Tooltip/common/index.js.map +1 -0
  113. package/dist/esm/ui/Tooltip/index.js +6 -0
  114. package/dist/esm/ui/Tooltip/index.js.map +1 -0
  115. package/dist/esm/ui/Tooltip/styles.css +122 -0
  116. package/dist/esm/ui/Tooltip/types.js +2 -0
  117. package/dist/esm/ui/Tooltip/types.js.map +1 -0
  118. package/dist/esm/ui/Tooltip/withTooltip.js +18 -0
  119. package/dist/esm/ui/Tooltip/withTooltip.js.map +1 -0
  120. package/dist/esm/ui/documentation/documentation/Layout/Layout.js +21 -0
  121. package/dist/esm/ui/documentation/documentation/Layout/Layout.js.map +1 -0
  122. package/dist/esm/ui/documentation/documentation/Layout/index.js +4 -0
  123. package/dist/esm/ui/documentation/documentation/Layout/index.js.map +1 -0
  124. package/dist/esm/ui/documentation/documentation/Layout/types.js +3 -0
  125. package/dist/esm/ui/documentation/documentation/Layout/types.js.map +1 -0
  126. package/dist/esm/ui/documentation/index.js +2 -0
  127. package/dist/esm/ui/documentation/index.js.map +1 -0
  128. package/dist/esm/ui/hooks/index.js +6 -0
  129. package/dist/esm/ui/hooks/index.js.map +1 -0
  130. package/dist/esm/ui/hooks/useDelayedToggle/index.js +3 -0
  131. package/dist/esm/ui/hooks/useDelayedToggle/index.js.map +1 -0
  132. package/dist/esm/ui/hooks/useDelayedToggle/types.js +2 -0
  133. package/dist/esm/ui/hooks/useDelayedToggle/types.js.map +1 -0
  134. package/dist/esm/ui/hooks/useDelayedToggle/useDelayedToggle.js +45 -0
  135. package/dist/esm/ui/hooks/useDelayedToggle/useDelayedToggle.js.map +1 -0
  136. package/dist/esm/ui/hooks/usePopup/index.js +3 -0
  137. package/dist/esm/ui/hooks/usePopup/index.js.map +1 -0
  138. package/dist/esm/ui/hooks/usePopup/types.js +2 -0
  139. package/dist/esm/ui/hooks/usePopup/types.js.map +1 -0
  140. package/dist/esm/ui/hooks/usePopup/usePopup.js +93 -0
  141. package/dist/esm/ui/hooks/usePopup/usePopup.js.map +1 -0
  142. package/dist/esm/ui/hooks/useResizeObserver/index.js +3 -0
  143. package/dist/esm/ui/hooks/useResizeObserver/index.js.map +1 -0
  144. package/dist/esm/ui/hooks/useResizeObserver/types.js +2 -0
  145. package/dist/esm/ui/hooks/useResizeObserver/types.js.map +1 -0
  146. package/dist/esm/ui/hooks/useResizeObserver/useResizeObserver.js +32 -0
  147. package/dist/esm/ui/hooks/useResizeObserver/useResizeObserver.js.map +1 -0
  148. package/dist/esm/ui/hooks/useWindowDimensions/index.js +3 -0
  149. package/dist/esm/ui/hooks/useWindowDimensions/index.js.map +1 -0
  150. package/dist/esm/ui/hooks/useWindowDimensions/types.js +2 -0
  151. package/dist/esm/ui/hooks/useWindowDimensions/types.js.map +1 -0
  152. package/dist/esm/ui/hooks/useWindowDimensions/useWindowDimensions.js +47 -0
  153. package/dist/esm/ui/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -0
  154. package/dist/esm/ui/hooks/useWindowFitment/index.js +3 -0
  155. package/dist/esm/ui/hooks/useWindowFitment/index.js.map +1 -0
  156. package/dist/esm/ui/hooks/useWindowFitment/types.js +2 -0
  157. package/dist/esm/ui/hooks/useWindowFitment/types.js.map +1 -0
  158. package/dist/esm/ui/hooks/useWindowFitment/useWindowFitment.js +221 -0
  159. package/dist/esm/ui/hooks/useWindowFitment/useWindowFitment.js.map +1 -0
  160. package/dist/esm/ui/index.js +11 -0
  161. package/dist/esm/ui/index.js.map +1 -0
  162. package/dist/types/index.d.ts +3 -0
  163. package/dist/types/index.d.ts.map +1 -0
  164. package/dist/types/lib/index.d.ts +2 -0
  165. package/dist/types/lib/index.d.ts.map +1 -0
  166. package/dist/types/lib/types/index.d.ts +2 -0
  167. package/dist/types/lib/types/index.d.ts.map +1 -0
  168. package/dist/types/lib/types/polymorphic.d.ts +24 -0
  169. package/dist/types/lib/types/polymorphic.d.ts.map +1 -0
  170. package/dist/types/storybook/decorators.d.ts +15 -0
  171. package/dist/types/storybook/decorators.d.ts.map +1 -0
  172. package/dist/types/ui/Badge/Badge.d.ts +11 -0
  173. package/dist/types/ui/Badge/Badge.d.ts.map +1 -0
  174. package/dist/types/ui/Badge/hooks/useBadge.d.ts +7 -0
  175. package/dist/types/ui/Badge/hooks/useBadge.d.ts.map +1 -0
  176. package/dist/types/ui/Badge/index.d.ts +3 -0
  177. package/dist/types/ui/Badge/index.d.ts.map +1 -0
  178. package/dist/types/ui/Badge/types.d.ts +42 -0
  179. package/dist/types/ui/Badge/types.d.ts.map +1 -0
  180. package/dist/types/ui/Button/Button.d.ts +6 -0
  181. package/dist/types/ui/Button/Button.d.ts.map +1 -0
  182. package/dist/types/ui/Button/index.d.ts +3 -0
  183. package/dist/types/ui/Button/index.d.ts.map +1 -0
  184. package/dist/types/ui/Button/types.d.ts +22 -0
  185. package/dist/types/ui/Button/types.d.ts.map +1 -0
  186. package/dist/types/ui/Card/Card.d.ts +24 -0
  187. package/dist/types/ui/Card/Card.d.ts.map +1 -0
  188. package/dist/types/ui/Card/common/Image/Image.d.ts +14 -0
  189. package/dist/types/ui/Card/common/Image/Image.d.ts.map +1 -0
  190. package/dist/types/ui/Card/common/Image/index.d.ts +3 -0
  191. package/dist/types/ui/Card/common/Image/index.d.ts.map +1 -0
  192. package/dist/types/ui/Card/common/Image/types.d.ts +5 -0
  193. package/dist/types/ui/Card/common/Image/types.d.ts.map +1 -0
  194. package/dist/types/ui/Card/common/Section/Section.d.ts +13 -0
  195. package/dist/types/ui/Card/common/Section/Section.d.ts.map +1 -0
  196. package/dist/types/ui/Card/common/Section/index.d.ts +3 -0
  197. package/dist/types/ui/Card/common/Section/index.d.ts.map +1 -0
  198. package/dist/types/ui/Card/common/Section/types.d.ts +6 -0
  199. package/dist/types/ui/Card/common/Section/types.d.ts.map +1 -0
  200. package/dist/types/ui/Card/common/ThumbnailSection/ThumbnailSection.d.ts +13 -0
  201. package/dist/types/ui/Card/common/ThumbnailSection/ThumbnailSection.d.ts.map +1 -0
  202. package/dist/types/ui/Card/common/ThumbnailSection/index.d.ts +3 -0
  203. package/dist/types/ui/Card/common/ThumbnailSection/index.d.ts.map +1 -0
  204. package/dist/types/ui/Card/common/ThumbnailSection/types.d.ts +12 -0
  205. package/dist/types/ui/Card/common/ThumbnailSection/types.d.ts.map +1 -0
  206. package/dist/types/ui/Card/common/index.d.ts +4 -0
  207. package/dist/types/ui/Card/common/index.d.ts.map +1 -0
  208. package/dist/types/ui/Card/index.d.ts +3 -0
  209. package/dist/types/ui/Card/index.d.ts.map +1 -0
  210. package/dist/types/ui/Card/types.d.ts +10 -0
  211. package/dist/types/ui/Card/types.d.ts.map +1 -0
  212. package/dist/types/ui/Chip/Chip.d.ts +10 -0
  213. package/dist/types/ui/Chip/Chip.d.ts.map +1 -0
  214. package/dist/types/ui/Chip/index.d.ts +3 -0
  215. package/dist/types/ui/Chip/index.d.ts.map +1 -0
  216. package/dist/types/ui/Chip/types.d.ts +27 -0
  217. package/dist/types/ui/Chip/types.d.ts.map +1 -0
  218. package/dist/types/ui/Icon/Icon.d.ts +13 -0
  219. package/dist/types/ui/Icon/Icon.d.ts.map +1 -0
  220. package/dist/types/ui/Icon/index.d.ts +3 -0
  221. package/dist/types/ui/Icon/index.d.ts.map +1 -0
  222. package/dist/types/ui/Icon/types.d.ts +13 -0
  223. package/dist/types/ui/Icon/types.d.ts.map +1 -0
  224. package/dist/types/ui/Link/Link.d.ts +10 -0
  225. package/dist/types/ui/Link/Link.d.ts.map +1 -0
  226. package/dist/types/ui/Link/index.d.ts +3 -0
  227. package/dist/types/ui/Link/index.d.ts.map +1 -0
  228. package/dist/types/ui/Link/types.d.ts +13 -0
  229. package/dist/types/ui/Link/types.d.ts.map +1 -0
  230. package/dist/types/ui/Rule/Rule.d.ts +12 -0
  231. package/dist/types/ui/Rule/Rule.d.ts.map +1 -0
  232. package/dist/types/ui/Rule/index.d.ts +3 -0
  233. package/dist/types/ui/Rule/index.d.ts.map +1 -0
  234. package/dist/types/ui/Rule/types.d.ts +11 -0
  235. package/dist/types/ui/Rule/types.d.ts.map +1 -0
  236. package/dist/types/ui/Section/Section.d.ts +12 -0
  237. package/dist/types/ui/Section/Section.d.ts.map +1 -0
  238. package/dist/types/ui/Section/constants.d.ts +2 -0
  239. package/dist/types/ui/Section/constants.d.ts.map +1 -0
  240. package/dist/types/ui/Section/index.d.ts +3 -0
  241. package/dist/types/ui/Section/index.d.ts.map +1 -0
  242. package/dist/types/ui/Section/types.d.ts +22 -0
  243. package/dist/types/ui/Section/types.d.ts.map +1 -0
  244. package/dist/types/ui/SkipLink/SkipLink.d.ts +16 -0
  245. package/dist/types/ui/SkipLink/SkipLink.d.ts.map +1 -0
  246. package/dist/types/ui/SkipLink/index.d.ts +3 -0
  247. package/dist/types/ui/SkipLink/index.d.ts.map +1 -0
  248. package/dist/types/ui/SkipLink/types.d.ts +16 -0
  249. package/dist/types/ui/SkipLink/types.d.ts.map +1 -0
  250. package/dist/types/ui/Tooltip/Tooltip.d.ts +12 -0
  251. package/dist/types/ui/Tooltip/Tooltip.d.ts.map +1 -0
  252. package/dist/types/ui/Tooltip/common/TooltipArea/TooltipArea.d.ts +10 -0
  253. package/dist/types/ui/Tooltip/common/TooltipArea/TooltipArea.d.ts.map +1 -0
  254. package/dist/types/ui/Tooltip/common/TooltipArea/index.d.ts +3 -0
  255. package/dist/types/ui/Tooltip/common/TooltipArea/index.d.ts.map +1 -0
  256. package/dist/types/ui/Tooltip/common/TooltipArea/types.d.ts +35 -0
  257. package/dist/types/ui/Tooltip/common/TooltipArea/types.d.ts.map +1 -0
  258. package/dist/types/ui/Tooltip/common/index.d.ts +2 -0
  259. package/dist/types/ui/Tooltip/common/index.d.ts.map +1 -0
  260. package/dist/types/ui/Tooltip/index.d.ts +5 -0
  261. package/dist/types/ui/Tooltip/index.d.ts.map +1 -0
  262. package/dist/types/ui/Tooltip/types.d.ts +16 -0
  263. package/dist/types/ui/Tooltip/types.d.ts.map +1 -0
  264. package/dist/types/ui/Tooltip/withTooltip.d.ts +11 -0
  265. package/dist/types/ui/Tooltip/withTooltip.d.ts.map +1 -0
  266. package/dist/types/ui/documentation/documentation/Layout/Layout.d.ts +10 -0
  267. package/dist/types/ui/documentation/documentation/Layout/Layout.d.ts.map +1 -0
  268. package/dist/types/ui/documentation/documentation/Layout/index.d.ts +3 -0
  269. package/dist/types/ui/documentation/documentation/Layout/index.d.ts.map +1 -0
  270. package/dist/types/ui/documentation/documentation/Layout/types.d.ts +8 -0
  271. package/dist/types/ui/documentation/documentation/Layout/types.d.ts.map +1 -0
  272. package/dist/types/ui/documentation/index.d.ts +2 -0
  273. package/dist/types/ui/documentation/index.d.ts.map +1 -0
  274. package/dist/types/ui/hooks/index.d.ts +6 -0
  275. package/dist/types/ui/hooks/index.d.ts.map +1 -0
  276. package/dist/types/ui/hooks/useDelayedToggle/index.d.ts +3 -0
  277. package/dist/types/ui/hooks/useDelayedToggle/index.d.ts.map +1 -0
  278. package/dist/types/ui/hooks/useDelayedToggle/types.d.ts +27 -0
  279. package/dist/types/ui/hooks/useDelayedToggle/types.d.ts.map +1 -0
  280. package/dist/types/ui/hooks/useDelayedToggle/useDelayedToggle.d.ts +13 -0
  281. package/dist/types/ui/hooks/useDelayedToggle/useDelayedToggle.d.ts.map +1 -0
  282. package/dist/types/ui/hooks/usePopup/index.d.ts +3 -0
  283. package/dist/types/ui/hooks/usePopup/index.d.ts.map +1 -0
  284. package/dist/types/ui/hooks/usePopup/types.d.ts +65 -0
  285. package/dist/types/ui/hooks/usePopup/types.d.ts.map +1 -0
  286. package/dist/types/ui/hooks/usePopup/usePopup.d.ts +19 -0
  287. package/dist/types/ui/hooks/usePopup/usePopup.d.ts.map +1 -0
  288. package/dist/types/ui/hooks/useResizeObserver/index.d.ts +3 -0
  289. package/dist/types/ui/hooks/useResizeObserver/index.d.ts.map +1 -0
  290. package/dist/types/ui/hooks/useResizeObserver/types.d.ts +7 -0
  291. package/dist/types/ui/hooks/useResizeObserver/types.d.ts.map +1 -0
  292. package/dist/types/ui/hooks/useResizeObserver/useResizeObserver.d.ts +8 -0
  293. package/dist/types/ui/hooks/useResizeObserver/useResizeObserver.d.ts.map +1 -0
  294. package/dist/types/ui/hooks/useWindowDimensions/index.d.ts +3 -0
  295. package/dist/types/ui/hooks/useWindowDimensions/index.d.ts.map +1 -0
  296. package/dist/types/ui/hooks/useWindowDimensions/types.d.ts +21 -0
  297. package/dist/types/ui/hooks/useWindowDimensions/types.d.ts.map +1 -0
  298. package/dist/types/ui/hooks/useWindowDimensions/useWindowDimensions.d.ts +6 -0
  299. package/dist/types/ui/hooks/useWindowDimensions/useWindowDimensions.d.ts.map +1 -0
  300. package/dist/types/ui/hooks/useWindowFitment/index.d.ts +3 -0
  301. package/dist/types/ui/hooks/useWindowFitment/index.d.ts.map +1 -0
  302. package/dist/types/ui/hooks/useWindowFitment/types.d.ts +73 -0
  303. package/dist/types/ui/hooks/useWindowFitment/types.d.ts.map +1 -0
  304. package/dist/types/ui/hooks/useWindowFitment/useWindowFitment.d.ts +4 -0
  305. package/dist/types/ui/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -0
  306. package/dist/types/ui/index.d.ts +11 -0
  307. package/dist/types/ui/index.d.ts.map +1 -0
  308. package/package.json +69 -0
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds icon";
4
+ /**
5
+ * Icon component that renders SVG icons from @canonical/ds-assets
6
+ * @param iconName - Name of the icon to render
7
+ * @param rootPath - Root path to the icons (default: /icons)
8
+ * @returns {React.ReactElement} - Rendered Icon SVG
9
+ * @implements syntax:core:component:icon:1.0.0
10
+ */
11
+ const Icon = ({ xmlns = "http://www.w3.org/2000/svg", viewBox = "0 0 16 16", icon, className, rootPath = "/icons", role = "img", ...props }) => {
12
+ return (_jsx("svg", { xmlns: xmlns, viewBox: viewBox, className: [componentCssClassName, className].filter(Boolean).join(" "), role: role, ...props, children: _jsx("use", { href: `${rootPath}/${icon}.svg#${icon}` }) }));
13
+ };
14
+ export default Icon;
15
+ //# sourceMappingURL=Icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/ui/Icon/Icon.tsx"],"names":[],"mappings":";AAKA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,KAAK,GAAG,4BAA4B,EACpC,OAAO,GAAG,WAAW,EACrB,IAAI,EACJ,SAAS,EACT,QAAQ,GAAG,QAAQ,EACnB,IAAI,GAAG,KAAK,EACZ,GAAG,KAAK,EACE,EAAgB,EAAE;IAC5B,OAAO,CACL,cACE,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,IAAI,EAAE,IAAI,KACN,KAAK,YAET,cAAK,IAAI,EAAE,GAAG,QAAQ,IAAI,IAAI,QAAQ,IAAI,EAAE,GAAI,GAC5C,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export { default as Icon } from "./Icon.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Icon/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+
3
+ .ds.icon {
4
+ position: relative;
5
+ display: inline-flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ vertical-align: middle;
9
+
10
+ height: var(--icon-size);
11
+ width: var(--icon-size);
12
+ }
@@ -0,0 +1,3 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Icon/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds link";
4
+ /**
5
+ * Link component that can be rendered as different elements while maintaining consistent styling
6
+ * @implements syntax:core:component:link:1.0.0
7
+ */
8
+ const Link = ({ as, className, children, appearance, ...props }) => {
9
+ const Component = as || "a";
10
+ return (_jsx(Component, { className: [componentCssClassName, className, appearance]
11
+ .filter(Boolean)
12
+ .join(" "), ...props, children: children }));
13
+ };
14
+ export default Link;
15
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../src/ui/Link/Link.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAqC,EAChD,EAAE,EACF,SAAS,EACT,QAAQ,EACR,UAAU,EACV,GAAG,KAAK,EACY,EAAgB,EAAE;IACtC,MAAM,SAAS,GAAG,EAAE,IAAI,GAAG,CAAC;IAE5B,OAAO,CACL,KAAC,SAAS,IACR,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,EAAE,UAAU,CAAC;aACtD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export { default as Link } from "./Link.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Link/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -0,0 +1,25 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+
3
+ .ds.link {
4
+ &.soft {
5
+ /*
6
+ Soft links are explicitly meant to use normal text color
7
+ TODO because <a> tag have their color set in the styles package, we need to set a specific color here.
8
+ Otherwise, we could use `currentColor` or only apply link color to non-soft links, which would allow the link to inherit color from parent.
9
+ We should confirm this approach is what we want.
10
+ */
11
+ color: var(--tmp-color-text-default);
12
+
13
+ &:hover {
14
+ color: var(--tmp-color-text-link-default);
15
+ }
16
+
17
+ &:visited {
18
+ color: var(--tmp-color-text-default);
19
+ }
20
+
21
+ &[aria-current="page"] {
22
+ font-weight: var(--link-soft-selected-font-weight);
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Link/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds rule";
4
+ /**
5
+ * A component that separates content into logical groups.
6
+ * @TODO implement fixed-width behavior after implementation of the Grid
7
+ * @returns {React.ReactElement} - Rendered Rule
8
+ * @implements syntax:core:component:rule:1.0.0
9
+ */
10
+ const Rule = ({ className, emphasis, ...props }) => {
11
+ return (_jsx("hr", { className: [componentCssClassName, emphasis, className]
12
+ .filter(Boolean)
13
+ .join(" "), ...props }));
14
+ };
15
+ export default Rule;
16
+ //# sourceMappingURL=Rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rule.js","sourceRoot":"","sources":["../../../../src/ui/Rule/Rule.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACE,EAAsB,EAAE;IAClC,OAAO,CACL,aACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,QAAQ,EAAE,SAAS,CAAC;aACpD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export { default as Rule } from "./Rule.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Rule/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+
3
+ .ds.rule {
4
+ background-color: var(
5
+ --modifier-separator-bar-color,
6
+ var(--rule-color-background)
7
+ );
8
+ border-width: var(--rule-border-width);
9
+ height: var(--modifier-separator-bar-height, var(--rule-height));
10
+ margin-block-start: var(--rule-margin-top);
11
+ /* global modifiers can change the height of the rule. Subtract the actual height of the rule from the target height to keep baseline alignment */
12
+ margin-block-end: calc(
13
+ var(--rule-height-with-margin) -
14
+ var(--modifier-separator-bar-height, var(--rule-height))
15
+ );
16
+ }
@@ -0,0 +1,3 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Rule/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds section";
4
+ /**
5
+ * The `<Section>` component groups related content.
6
+ * Sections can have varying visual spacing levels to organize information according to an information hierarchy.
7
+ *
8
+ * @implements syntax:core:component:section:1.0.0
9
+ */
10
+ const Section = ({ className, children, spacing, bordered = false, ...props }) => {
11
+ return (_jsx("section", { className: [
12
+ componentCssClassName,
13
+ bordered && "bordered",
14
+ spacing,
15
+ className,
16
+ ]
17
+ .filter(Boolean)
18
+ .join(" "), ...props, children: children }));
19
+ };
20
+ export default Section;
21
+ //# sourceMappingURL=Section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Section.js","sourceRoot":"","sources":["../../../../src/ui/Section/Section.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,EACf,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,GAAG,KAAK,EACK,EAAsB,EAAE;IACrC,OAAO,CACL,kBACE,SAAS,EAAE;YACT,qBAAqB;YACrB,QAAQ,IAAI,UAAU;YACtB,OAAO;YACP,SAAS;SACV;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,YAER,QAAQ,GACD,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const SECTION_SPACING = ["shallow", "deep", "hero"];
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/ui/Section/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export { default as Section } from "./Section.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Section/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,YAAY,CAAC"}
@@ -0,0 +1,50 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+
3
+ .ds.section {
4
+ --section-padding-bottom: var(--section-padding-bottom-spacing-default);
5
+
6
+ /*
7
+ Section top padding is the sum of padding applied by two props - `spacing` and `bordered`.
8
+ We namespace each padding type, then add them together in the final padding-top declaration.
9
+ */
10
+ --section-padding-top-spacing: var(--section-padding-top-spacing-default);
11
+ --section-padding-top-bordered: var(--section-padding-top-bordered-default);
12
+
13
+ &.bordered {
14
+ /* Top padding subtracts border height */
15
+ --section-padding-top-bordered: var(--section-padding-top-bordered-true);
16
+ border-top-color: var(--section-border-start-color);
17
+ border-top-style: var(--section-border-start-style);
18
+ border-top-width: var(--section-border-start-width);
19
+ }
20
+
21
+ /*
22
+ Spacing variants
23
+ Note that top padding is only defined for the hero variant in our core setup.
24
+ The top padding is still bound here in case users customize their tokens.
25
+ */
26
+ &.shallow {
27
+ --section-padding-bottom: var(--section-padding-bottom-spacing-shallow);
28
+ --section-padding-top-spacing: var(--section-padding-top-spacing-shallow);
29
+ }
30
+
31
+ &.deep {
32
+ --section-padding-bottom: var(--section-padding-bottom-spacing-deep);
33
+ --section-padding-top-spacing: var(--section-padding-top-spacing-deep);
34
+ /* TODO add responsiveness https://github.com/canonical/vanilla-framework/blob/6af35433368f82d76d8deb7effebca47b434ee76/scss/_patterns_section.scss#L16-L18 */
35
+ }
36
+
37
+ &.hero {
38
+ --section-padding-bottom: var(--section-padding-bottom-spacing-hero);
39
+ --section-padding-top-spacing: var(--section-padding-top-spacing-hero);
40
+
41
+ /* TODO add responsiveness https://github.com/canonical/vanilla-framework/blob/6af35433368f82d76d8deb7effebca47b434ee76/scss/_patterns_section.scss#L32-L34 */
42
+ }
43
+
44
+ padding-bottom: var(--section-padding-bottom);
45
+ /* Padding-top is applied by both the `spacing` prop and the `bordered` props */
46
+ padding-top: calc(
47
+ var(--section-padding-top-spacing) +
48
+ var(--section-padding-top-bordered)
49
+ );
50
+ }
@@ -0,0 +1,3 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Section/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds skip-link";
4
+ /**
5
+ * The `SkipLink` component provides a way for users to quickly navigate to the main content of a page.
6
+ * It is typically used by keyboard and screen reader users to bypass repetitive navigation links
7
+ * and other elements that appear at the top of the page, pursuant to [WCAG 2.1 Success Criterion 2.4.1](https://www.w3.org/WAI/WCAG21/Understanding/bypass-blocks.html).
8
+ *
9
+ * `SkipLink` should be placed near the top of your document body, before the `<main>` element.
10
+ * The `<main>` element should have a `tabindex` of `-1` to prevent it from receiving focus from the keyboard without using the skip link.
11
+ *
12
+ * @implements syntax:core:component:skiplink:1.0.0
13
+ */
14
+ const SkipLink = ({ className, children, mainId = "main", ...props }) => {
15
+ const href = `#${mainId}`;
16
+ const skipLinkContents = children || "Skip to main content";
17
+ return (_jsx("a", { className: [componentCssClassName, className].filter(Boolean).join(" "), href: href, tabIndex: 0, ...props, children: skipLinkContents }));
18
+ };
19
+ export default SkipLink;
20
+ //# sourceMappingURL=SkipLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkipLink.js","sourceRoot":"","sources":["../../../../src/ui/SkipLink/SkipLink.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACT,QAAQ,EACR,MAAM,GAAG,MAAM,EACf,GAAG,KAAK,EACM,EAAsB,EAAE;IACtC,MAAM,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;IAC1B,MAAM,gBAAgB,GAAG,QAAQ,IAAI,sBAAsB,CAAC;IAE5D,OAAO,CACL,YACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,CAAC,KACP,KAAK,YAER,gBAAgB,GACf,CACL,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.4 */
2
+ export { default as SkipLink } from "./SkipLink.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/SkipLink/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,cAAc,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.4 */
2
+
3
+ .ds.skip-link {
4
+ background: var(--skip-link-background);
5
+ color: var(--skip-link-color);
6
+ display: block;
7
+ inset-inline-start: var(--skip-link-inset-inline-start);
8
+ position: absolute;
9
+ top: var(--skip-link-top);
10
+
11
+ &:focus,
12
+ &:focus-visible {
13
+ inset-inline-start: var(--skip-link-focus-inset-inline-start);
14
+ outline-offset: var(--skip-link-outline-offset);
15
+ padding-block: var(--skip-link-focus-padding-block);
16
+ padding-inline: var(--skip-link-focus-padding-inline);
17
+ position: fixed;
18
+ top: var(--skip-link-focus-top);
19
+ z-index: var(--skip-link-focus-z-index);
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.4 */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/SkipLink/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds tooltip";
4
+ /**
5
+ * The Tooltip component is used to display a message.
6
+ * This component is just the "message" part of the tooltip, and has no interactivity or positioning logic. It is generally not consumed directly, but rather in one of two ways
7
+ * - The [TooltipArea](?path=/docs/tooltip-tooltiparea--docs) component
8
+ * - The [withTooltip](?path=/docs/tooltip-withtooltip--docs) HOC
9
+ */
10
+ const Tooltip = ({ id, children, className, style, ref, isOpen = false, zIndex, onPointerEnter, onFocus, }) => {
11
+ return (_jsx("div", { className: [componentCssClassName, className].filter(Boolean).join(" "), ref: ref, id: id, "aria-hidden": !isOpen, onPointerEnter: onPointerEnter, onFocus: onFocus, role: "tooltip", style: {
12
+ ...style,
13
+ visibility: isOpen ? "visible" : "hidden",
14
+ zIndex,
15
+ }, children: children }));
16
+ };
17
+ export default Tooltip;
18
+ //# sourceMappingURL=Tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/ui/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAGtB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,EACf,EAAE,EACF,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,EACH,MAAM,GAAG,KAAK,EACd,MAAM,EACN,cAAc,EACd,OAAO,GACM,EAAsB,EAAE;IACrC,OAAO,CACL,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,iBACO,CAAC,MAAM,EACpB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,SAAS,EACd,KAAK,EAAE;YACL,GAAG,KAAK;YACR,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YACzC,MAAM;SACP,YAEA,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { usePopup } from "../../../hooks/index.js";
3
+ import { Tooltip } from "../../index.js";
4
+ import "./styles.css";
5
+ import { createPortal } from "react-dom";
6
+ const componentCssClassName = "ds tooltip-area";
7
+ /**
8
+ * Wraps a target element with a tooltip.
9
+ * This component allows you to attach a tooltip to any JSX fragment.
10
+ */
11
+ const TooltipArea = ({ children, style, className, Message, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
12
+ const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, handleTriggerFocus, handleTriggerBlur, handleTriggerEnter, handleTriggerLeave, bestPosition, } = usePopup({ distance, autoFit, ...props });
13
+ const TooltipMessageElement = (_jsx(Tooltip, { id: popupId, className: [
14
+ bestPosition?.positionName,
15
+ messageElementClassName,
16
+ autoFit && "autofit",
17
+ ]
18
+ .filter(Boolean)
19
+ .join(" "), onPointerEnter: handleTriggerEnter, onFocus: handleTriggerFocus, ref: popupRef, style: {
20
+ ...messageElementStyle,
21
+ ...popupPositionStyle,
22
+ // @ts-expect-error allow binding arrow size to distance, as it is needed both in JS and CSS calculations
23
+ "--tooltip-spacing-arrow-size": distance,
24
+ ...(autoFit &&
25
+ bestPosition?.autoFitOffset && {
26
+ "--tooltip-arrow-offset-top": `${bestPosition?.autoFitOffset.top || 0}px`,
27
+ "--tooltip-arrow-offset-left": `${bestPosition?.autoFitOffset.left || 0}px`,
28
+ }),
29
+ }, isOpen: isOpen, children: Message }));
30
+ return (
31
+ // biome-ignore lint/a11y/noStaticElementInteractions: TODO this is kept as is to prevent breaking changes
32
+ _jsxs("span", { className: [componentCssClassName, className].filter(Boolean).join(" "), style: style, onFocus: handleTriggerFocus, onBlur: handleTriggerBlur, onPointerEnter: handleTriggerEnter, onPointerLeave: handleTriggerLeave, children: [_jsx("span", { id: targetElementId, style: targetElementStyle, className: ["target", targetElementClassName].filter(Boolean).join(" "), ref: targetRef, "aria-describedby": popupId, children: children }), typeof window !== "undefined"
33
+ ? // Portals allow the tooltip to be rendered outside the parent element
34
+ // This is helpful when the parent element is a scrollable container or has bounds that may be
35
+ // overflown by the tooltip message.
36
+ createPortal(TooltipMessageElement, parentElement || document.body)
37
+ : TooltipMessageElement] }));
38
+ };
39
+ export default TooltipArea;
40
+ //# sourceMappingURL=TooltipArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipArea.js","sourceRoot":"","sources":["../../../../../../src/ui/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,GAAG,KAAK,EACS,EAAgB,EAAE;IACnC,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,GACb,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAE9C,MAAM,qBAAqB,GAAG,CAC5B,KAAC,OAAO,IACN,EAAE,EAAE,OAAO,EACX,SAAS,EAAE;YACT,YAAY,EAAE,YAAY;YAC1B,uBAAuB;YACvB,OAAO,IAAI,SAAS;SACrB;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,cAAc,EAAE,kBAAkB,EAClC,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE;YACL,GAAG,mBAAmB;YACtB,GAAG,kBAAkB;YACrB,yGAAyG;YACzG,8BAA8B,EAAE,QAAQ;YACxC,GAAG,CAAC,OAAO;gBACT,YAAY,EAAE,aAAa,IAAI;gBAC7B,4BAA4B,EAAE,GAAG,YAAY,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,IAAI;gBACzE,6BAA6B,EAAE,GAAG,YAAY,EAAE,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI;aAC5E,CAAC;SACL,EACD,MAAM,EAAE,MAAM,YAEb,OAAO,GACA,CACX,CAAC;IAEF,OAAO;IACL,0GAA0G;IAC1G,gBACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,kBAAkB,EAClC,cAAc,EAAE,kBAAkB,aAElC,eACE,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,GAAG,EAAE,SAAS,sBACI,OAAO,YAExB,QAAQ,GACJ,EAIN,OAAO,MAAM,KAAK,WAAW;gBAC5B,CAAC,CAAC,sEAAsE;oBACtE,8FAA8F;oBAC9F,oCAAoC;oBACpC,YAAY,CAAC,qBAAqB,EAAE,aAAa,IAAI,QAAQ,CAAC,IAAI,CAAC;gBACrE,CAAC,CAAC,qBAAqB,IACpB,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.9.0-experimental.4 */
2
+ export { default as TooltipArea } from "./TooltipArea.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/Tooltip/common/TooltipArea/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,cAAc,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ .ds.tooltip-area {
2
+ position: relative;
3
+ & .target {
4
+ cursor: pointer;
5
+ position: relative;
6
+ display: inline-block;
7
+
8
+ & > * {
9
+ /* biome-ignore lint/complexity/noImportantStyles: The tooltip targets must have no margin in order for tooltip placements to work correctly */
10
+ margin: 0 !important;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/Tooltip/common/TooltipArea/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./TooltipArea/index.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/Tooltip/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /* @canonical/generator-ds 0.9.0-experimental.4 */
2
+ export * from "./common/index.js";
3
+ export { default as Tooltip } from "./Tooltip.js";
4
+ export * from "./types.js";
5
+ export { default as withTooltip } from "./withTooltip.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Tooltip/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,122 @@
1
+ /* @canonical/generator-ds 0.9.0-experimental.4 */
2
+
3
+ /* component variables
4
+ --tooltip-color-background: background color of the tooltip
5
+ --tooltip-color-background-hover: background color of the tooltip on hover
6
+ --tooltip-color-background-active: background color of the tooltip on active
7
+ --tooltip-color-text: text color of the tooltip
8
+ --tooltip-color-border: border color of the tooltip
9
+ --tooltip-color-border-hover: border color of the tooltip on hover
10
+ --tooltip-color-border-active: border color of the tooltip on active
11
+
12
+ --tooltip-margin-left: left margin of the tooltip
13
+ --tooltip-margin-bottom: bottom margin of the tooltip
14
+ --tooltip-padding-vertical: vertical padding of the tooltip
15
+ --tooltip-padding-horizontal: horizontal padding of the tooltip
16
+ --tooltip-font-size: font size of the tooltip
17
+ --tooltip-font-weight: font weight of the tooltip
18
+ --tooltip-line-height: line height of the tooltip
19
+
20
+ --tooltip-spacing-arrow-size: size of the arrow
21
+
22
+ --tooltip-arrow-offset-left: offset of the arrow from the left
23
+ --tooltip-arrow-offset-top: offset of the arrow from the top
24
+ */
25
+
26
+ .ds.tooltip {
27
+ --tooltip-spacing-arrow-middle: calc(50% - var(--tooltip-spacing-arrow-size));
28
+ --tooltip-spacing-arrow-edge: calc(-2 * var(--tooltip-spacing-arrow-size));
29
+ --tooltip-border-arrow-visible: var(--tooltip-spacing-arrow-size) solid
30
+ var(--tooltip-color-background);
31
+ --tooltip-border-arrow-hidden: var(--tooltip-spacing-arrow-size) solid
32
+ transparent;
33
+
34
+ color: var(
35
+ --modifier-color-text,
36
+ var(--tooltip-color-text, var(--color-text-default))
37
+ );
38
+ background-color: var(
39
+ --modifier-color,
40
+ var(--tooltip-color-background, var(--color-background-default))
41
+ );
42
+ border-color: var(
43
+ --modifier-color-border,
44
+ var(--tooltip-color-border, transparent)
45
+ );
46
+ border-style: solid;
47
+ border-radius: var(--tooltip-border-radius);
48
+ border-width: var(--tooltip-border-width, 1px);
49
+ font-size: var(--tooltip-font-size, var(--font-size-small));
50
+ font-weight: var(--tooltip-font-weight, var(--font-weight-default));
51
+ line-height: var(--tooltip-line-height, var(--line-height-small));
52
+ margin-block-end: var(--tooltip-margin-bottom, 0);
53
+ margin-inline-end: var(--tooltip-margin-left, 0);
54
+ padding-block: var(--tooltip-padding-vertical, 5px);
55
+ padding-inline: var(--tooltip-padding-horizontal, 10px);
56
+ white-space: pre;
57
+ text-align: left;
58
+ text-decoration: initial;
59
+ pointer-events: auto;
60
+ display: inline-block;
61
+ transition: opacity 0.1s ease-in-out;
62
+ position: fixed;
63
+ overflow: auto;
64
+
65
+ &[aria-hidden="true"] {
66
+ opacity: 0;
67
+ pointer-events: none;
68
+ visibility: hidden;
69
+ }
70
+
71
+ &[aria-hidden="false"] {
72
+ opacity: 1;
73
+ pointer-events: auto;
74
+ visibility: visible;
75
+ }
76
+
77
+ &.autofit {
78
+ &::before {
79
+ transform: translateX(var(--tooltip-arrow-offset-left))
80
+ translateY(var(--tooltip-arrow-offset-top));
81
+ }
82
+ }
83
+
84
+ /* triangle */
85
+ &::before {
86
+ content: "";
87
+ width: 0;
88
+ height: 0;
89
+ border: var(--tooltip-border-arrow-hidden);
90
+ position: absolute;
91
+ }
92
+
93
+ &.top::before {
94
+ border-top: var(--tooltip-border-arrow-visible);
95
+ bottom: var(--tooltip-spacing-arrow-edge);
96
+ }
97
+
98
+ &.right::before {
99
+ border-right: var(--tooltip-border-arrow-visible);
100
+ left: var(--tooltip-spacing-arrow-edge);
101
+ }
102
+
103
+ &.bottom::before {
104
+ border-bottom: var(--tooltip-border-arrow-visible);
105
+ top: var(--tooltip-spacing-arrow-edge);
106
+ }
107
+
108
+ &.left::before {
109
+ border-left: var(--tooltip-border-arrow-visible);
110
+ right: var(--tooltip-spacing-arrow-edge);
111
+ }
112
+
113
+ &.top::before,
114
+ &.bottom::before {
115
+ left: var(--tooltip-spacing-arrow-middle);
116
+ }
117
+
118
+ &.left::before,
119
+ &.right::before {
120
+ top: var(--tooltip-spacing-arrow-middle);
121
+ }
122
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Tooltip/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TooltipArea } from "./common/TooltipArea/index.js";
3
+ /**
4
+ * A higher-order component that wraps a component with a tooltip.
5
+ * @param Component The component function to wrap. If you need to use a Node instead of a function, use [`TooltipArea`](/?path=/docs/tooltip-withtooltip--docs) instead.
6
+ * @param Message The content of the tooltip
7
+ * @param popupProps The props to pass to the usePopup hook
8
+ */
9
+ const withTooltip = (Component, Message, popupProps = {}) => {
10
+ const WrappedComponent = (props, ref) => {
11
+ return (_jsx(TooltipArea, { Message: Message, ...popupProps, children: _jsx(Component, { ...props, ref: ref }) }));
12
+ };
13
+ // Set the displayName for easier debugging
14
+ WrappedComponent.displayName = `withTooltip(${Component.displayName || Component.name || "Component"})`;
15
+ return WrappedComponent;
16
+ };
17
+ export default withTooltip;
18
+ //# sourceMappingURL=withTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../src/ui/Tooltip/withTooltip.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAClB,SAAgC,EAChC,OAAkB,EAClB,aAA4B,EAAE,EAClB,EAAE;IACd,MAAM,gBAAgB,GAAG,CACvB,KAAa,EACb,GAA4B,EACN,EAAE;QACxB,OAAO,CACL,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,KAAM,UAAU,YAC3C,KAAC,SAAS,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,GACtB,CACf,CAAC;IACJ,CAAC,CAAC;IAEF,2CAA2C;IAC3C,gBAAgB,CAAC,WAAW,GAAG,eAC7B,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAC7C,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}