@hashicorp/mds-react 0.9.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 (511) hide show
  1. package/LICENSE +336 -0
  2. package/README.md +109 -0
  3. package/dist/components/accordion/index.d.ts +14 -0
  4. package/dist/components/accordion/index.js +9 -0
  5. package/dist/components/accordion/index.js.map +1 -0
  6. package/dist/components/accordion/item/button.d.ts +6 -0
  7. package/dist/components/accordion/item/button.js +44 -0
  8. package/dist/components/accordion/item/button.js.map +1 -0
  9. package/dist/components/accordion/item/index.d.ts +24 -0
  10. package/dist/components/accordion/item/index.js +59 -0
  11. package/dist/components/accordion/item/index.js.map +1 -0
  12. package/dist/components/accordion/style.module.scss +110 -0
  13. package/dist/components/accordion/style.module.scss.js +24 -0
  14. package/dist/components/accordion/style.module.scss.js.map +1 -0
  15. package/dist/components/alert/alert.module.scss +229 -0
  16. package/dist/components/alert/alert.module.scss.js +29 -0
  17. package/dist/components/alert/alert.module.scss.js.map +1 -0
  18. package/dist/components/alert/icon.d.ts +9 -0
  19. package/dist/components/alert/icon.js +34 -0
  20. package/dist/components/alert/icon.js.map +1 -0
  21. package/dist/components/alert/index.d.ts +62 -0
  22. package/dist/components/alert/index.js +97 -0
  23. package/dist/components/alert/index.js.map +1 -0
  24. package/dist/components/badge/index.d.ts +30 -0
  25. package/dist/components/badge/index.js +50 -0
  26. package/dist/components/badge/index.js.map +1 -0
  27. package/dist/components/badge/style.module.scss +130 -0
  28. package/dist/components/badge/style.module.scss.js +22 -0
  29. package/dist/components/badge/style.module.scss.js.map +1 -0
  30. package/dist/components/badge-count/index.d.ts +16 -0
  31. package/dist/components/badge-count/index.js +29 -0
  32. package/dist/components/badge-count/index.js.map +1 -0
  33. package/dist/components/badge-count/style.module.scss +108 -0
  34. package/dist/components/badge-count/style.module.scss.js +15 -0
  35. package/dist/components/badge-count/style.module.scss.js.map +1 -0
  36. package/dist/components/breadcrumbs/index.d.ts +7 -0
  37. package/dist/components/breadcrumbs/index.js +38 -0
  38. package/dist/components/breadcrumbs/index.js.map +1 -0
  39. package/dist/components/breadcrumbs/item/index.d.ts +2 -0
  40. package/dist/components/breadcrumbs/item/index.js +32 -0
  41. package/dist/components/breadcrumbs/item/index.js.map +1 -0
  42. package/dist/components/breadcrumbs/style.module.scss +183 -0
  43. package/dist/components/breadcrumbs/style.module.scss.js +27 -0
  44. package/dist/components/breadcrumbs/style.module.scss.js.map +1 -0
  45. package/dist/components/breadcrumbs/truncation-button/index.d.ts +3 -0
  46. package/dist/components/breadcrumbs/truncation-button/index.js +25 -0
  47. package/dist/components/breadcrumbs/truncation-button/index.js.map +1 -0
  48. package/dist/components/breadcrumbs/types/index.d.ts +51 -0
  49. package/dist/components/button/index.d.ts +31 -0
  50. package/dist/components/button/index.js +119 -0
  51. package/dist/components/button/index.js.map +1 -0
  52. package/dist/components/button/styles.module.scss +221 -0
  53. package/dist/components/button/styles.module.scss.js +32 -0
  54. package/dist/components/button/styles.module.scss.js.map +1 -0
  55. package/dist/components/card/card-thumbnail/card-thumbnail.module.css +10 -0
  56. package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js +8 -0
  57. package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js.map +1 -0
  58. package/dist/components/card/card-thumbnail/index.d.ts +2 -0
  59. package/dist/components/card/card-thumbnail/index.js +23 -0
  60. package/dist/components/card/card-thumbnail/index.js.map +1 -0
  61. package/dist/components/card/index.d.ts +3 -0
  62. package/dist/components/card/index.js +157 -0
  63. package/dist/components/card/index.js.map +1 -0
  64. package/dist/components/card/styles.module.css +98 -0
  65. package/dist/components/card/styles.module.css.js +29 -0
  66. package/dist/components/card/styles.module.css.js.map +1 -0
  67. package/dist/components/card/types.d.ts +52 -0
  68. package/dist/components/code-block/code-block.module.scss +511 -0
  69. package/dist/components/code-block/code-block.module.scss.js +34 -0
  70. package/dist/components/code-block/code-block.module.scss.js.map +1 -0
  71. package/dist/components/code-block/code-lines/index.d.ts +12 -0
  72. package/dist/components/code-block/code-lines/index.js +59 -0
  73. package/dist/components/code-block/code-lines/index.js.map +1 -0
  74. package/dist/components/code-block/code-lines/utils/split-html-into-lines.d.ts +19 -0
  75. package/dist/components/code-block/code-lines/utils/split-html-into-lines.js +19 -0
  76. package/dist/components/code-block/code-lines/utils/split-html-into-lines.js.map +1 -0
  77. package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.d.ts +21 -0
  78. package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js +31 -0
  79. package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -0
  80. package/dist/components/code-block/hidden-copy-content/index.d.ts +5 -0
  81. package/dist/components/code-block/hidden-copy-content/index.js +13 -0
  82. package/dist/components/code-block/hidden-copy-content/index.js.map +1 -0
  83. package/dist/components/code-block/index.d.ts +55 -0
  84. package/dist/components/code-block/index.js +88 -0
  85. package/dist/components/code-block/index.js.map +1 -0
  86. package/dist/components/code-block/utils/parse-highlighted-lines.d.ts +2 -0
  87. package/dist/components/code-block/utils/parse-highlighted-lines.js +39 -0
  88. package/dist/components/code-block/utils/parse-highlighted-lines.js.map +1 -0
  89. package/dist/components/code-block/utils/process-snippet.d.ts +12 -0
  90. package/dist/components/code-block/utils/process-snippet.js +20 -0
  91. package/dist/components/code-block/utils/process-snippet.js.map +1 -0
  92. package/dist/components/code-block/utils/shellwords.d.ts +14 -0
  93. package/dist/components/code-block/utils/shellwords.js +33 -0
  94. package/dist/components/code-block/utils/shellwords.js.map +1 -0
  95. package/dist/components/combo-box-primitive/index.d.ts +69 -0
  96. package/dist/components/combo-box-primitive/index.js +302 -0
  97. package/dist/components/combo-box-primitive/index.js.map +1 -0
  98. package/dist/components/dialog-primitive/dialog.module.scss +38 -0
  99. package/dist/components/dialog-primitive/dialog.module.scss.js +12 -0
  100. package/dist/components/dialog-primitive/dialog.module.scss.js.map +1 -0
  101. package/dist/components/dialog-primitive/index.d.ts +12 -0
  102. package/dist/components/dialog-primitive/index.js +15 -0
  103. package/dist/components/dialog-primitive/index.js.map +1 -0
  104. package/dist/components/disclosure-primitive/index.d.ts +19 -0
  105. package/dist/components/disclosure-primitive/index.js +57 -0
  106. package/dist/components/disclosure-primitive/index.js.map +1 -0
  107. package/dist/components/disclosure-primitive/styles.module.css +3 -0
  108. package/dist/components/disclosure-primitive/styles.module.css.js +7 -0
  109. package/dist/components/disclosure-primitive/styles.module.css.js.map +1 -0
  110. package/dist/components/disclosure-primitive/use-disclosure-primitive.d.ts +11 -0
  111. package/dist/components/disclosure-primitive/use-disclosure-primitive.js +17 -0
  112. package/dist/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -0
  113. package/dist/components/dismiss-button/index.d.ts +9 -0
  114. package/dist/components/dismiss-button/index.js +22 -0
  115. package/dist/components/dismiss-button/index.js.map +1 -0
  116. package/dist/components/dismiss-button/styles.module.scss +31 -0
  117. package/dist/components/dismiss-button/styles.module.scss.js +7 -0
  118. package/dist/components/dismiss-button/styles.module.scss.js.map +1 -0
  119. package/dist/components/dropdown/index.d.ts +72 -0
  120. package/dist/components/dropdown/index.js +79 -0
  121. package/dist/components/dropdown/index.js.map +1 -0
  122. package/dist/components/dropdown/list-item/custom.d.ts +10 -0
  123. package/dist/components/dropdown/list-item/custom.js +9 -0
  124. package/dist/components/dropdown/list-item/custom.js.map +1 -0
  125. package/dist/components/dropdown/list-item/index.d.ts +19 -0
  126. package/dist/components/dropdown/list-item/index.js +14 -0
  127. package/dist/components/dropdown/list-item/index.js.map +1 -0
  128. package/dist/components/dropdown/list-item/interactive.d.ts +29 -0
  129. package/dist/components/dropdown/list-item/interactive.js +49 -0
  130. package/dist/components/dropdown/list-item/interactive.js.map +1 -0
  131. package/dist/components/dropdown/list-item/separator.d.ts +8 -0
  132. package/dist/components/dropdown/list-item/separator.js +17 -0
  133. package/dist/components/dropdown/list-item/separator.js.map +1 -0
  134. package/dist/components/dropdown/list-item/styles.module.css +222 -0
  135. package/dist/components/dropdown/list-item/styles.module.css.js +26 -0
  136. package/dist/components/dropdown/list-item/styles.module.css.js.map +1 -0
  137. package/dist/components/dropdown/list-item/title.d.ts +10 -0
  138. package/dist/components/dropdown/list-item/title.js +9 -0
  139. package/dist/components/dropdown/list-item/title.js.map +1 -0
  140. package/dist/components/dropdown/styles.module.css +74 -0
  141. package/dist/components/dropdown/styles.module.css.js +24 -0
  142. package/dist/components/dropdown/styles.module.css.js.map +1 -0
  143. package/dist/components/dropdown/toggle-button/index.d.ts +30 -0
  144. package/dist/components/dropdown/toggle-button/index.js +54 -0
  145. package/dist/components/dropdown/toggle-button/index.js.map +1 -0
  146. package/dist/components/dropdown/toggle-button/styles.module.scss +54 -0
  147. package/dist/components/dropdown/toggle-button/styles.module.scss.js +14 -0
  148. package/dist/components/dropdown/toggle-button/styles.module.scss.js.map +1 -0
  149. package/dist/components/flight-icon/flight-icon.module.css +31 -0
  150. package/dist/components/flight-icon/flight-icon.module.css.js +12 -0
  151. package/dist/components/flight-icon/flight-icon.module.css.js.map +1 -0
  152. package/dist/components/flight-icon/index.d.ts +44 -0
  153. package/dist/components/flight-icon/index.js +58 -0
  154. package/dist/components/flight-icon/index.js.map +1 -0
  155. package/dist/components/form/checkbox/form-checkbox.module.css +88 -0
  156. package/dist/components/form/checkbox/form-checkbox.module.css.js +8 -0
  157. package/dist/components/form/checkbox/form-checkbox.module.css.js.map +1 -0
  158. package/dist/components/form/checkbox/index.d.ts +45 -0
  159. package/dist/components/form/checkbox/index.js +109 -0
  160. package/dist/components/form/checkbox/index.js.map +1 -0
  161. package/dist/components/form/error/form-error.module.css +23 -0
  162. package/dist/components/form/error/form-error.module.css.js +14 -0
  163. package/dist/components/form/error/form-error.module.css.js.map +1 -0
  164. package/dist/components/form/error/index.d.ts +16 -0
  165. package/dist/components/form/error/index.js +22 -0
  166. package/dist/components/form/error/index.js.map +1 -0
  167. package/dist/components/form/field/form-field.module.css +79 -0
  168. package/dist/components/form/field/form-field.module.css.js +17 -0
  169. package/dist/components/form/field/form-field.module.css.js.map +1 -0
  170. package/dist/components/form/field/index.d.ts +19 -0
  171. package/dist/components/form/field/index.js +46 -0
  172. package/dist/components/form/field/index.js.map +1 -0
  173. package/dist/components/form/fieldset/form-fieldset.module.css +48 -0
  174. package/dist/components/form/fieldset/form-fieldset.module.css.js +19 -0
  175. package/dist/components/form/fieldset/form-fieldset.module.css.js.map +1 -0
  176. package/dist/components/form/fieldset/index.d.ts +19 -0
  177. package/dist/components/form/fieldset/index.js +65 -0
  178. package/dist/components/form/fieldset/index.js.map +1 -0
  179. package/dist/components/form/file-input/form-file-input.module.scss +81 -0
  180. package/dist/components/form/file-input/form-file-input.module.scss.js +7 -0
  181. package/dist/components/form/file-input/form-file-input.module.scss.js.map +1 -0
  182. package/dist/components/form/file-input/index.d.ts +27 -0
  183. package/dist/components/form/file-input/index.js +68 -0
  184. package/dist/components/form/file-input/index.js.map +1 -0
  185. package/dist/components/form/helper-text/form-helper-text.module.css +10 -0
  186. package/dist/components/form/helper-text/form-helper-text.module.css.js +7 -0
  187. package/dist/components/form/helper-text/form-helper-text.module.css.js.map +1 -0
  188. package/dist/components/form/helper-text/index.d.ts +11 -0
  189. package/dist/components/form/helper-text/index.js +22 -0
  190. package/dist/components/form/helper-text/index.js.map +1 -0
  191. package/dist/components/form/indicator/form-indicator.module.css +10 -0
  192. package/dist/components/form/indicator/form-indicator.module.css.js +8 -0
  193. package/dist/components/form/indicator/form-indicator.module.css.js.map +1 -0
  194. package/dist/components/form/indicator/index.d.ts +9 -0
  195. package/dist/components/form/indicator/index.js +22 -0
  196. package/dist/components/form/indicator/index.js.map +1 -0
  197. package/dist/components/form/label/form-label.module.css +15 -0
  198. package/dist/components/form/label/form-label.module.css.js +10 -0
  199. package/dist/components/form/label/form-label.module.css.js.map +1 -0
  200. package/dist/components/form/label/index.d.ts +14 -0
  201. package/dist/components/form/label/index.js +33 -0
  202. package/dist/components/form/label/index.js.map +1 -0
  203. package/dist/components/form/legend/form-legend.module.css +17 -0
  204. package/dist/components/form/legend/form-legend.module.css.js +10 -0
  205. package/dist/components/form/legend/form-legend.module.css.js.map +1 -0
  206. package/dist/components/form/legend/index.d.ts +12 -0
  207. package/dist/components/form/legend/index.js +19 -0
  208. package/dist/components/form/legend/index.js.map +1 -0
  209. package/dist/components/form/radio/form-radio.module.scss +74 -0
  210. package/dist/components/form/radio/form-radio.module.scss.js +8 -0
  211. package/dist/components/form/radio/form-radio.module.scss.js.map +1 -0
  212. package/dist/components/form/radio/index.d.ts +44 -0
  213. package/dist/components/form/radio/index.js +100 -0
  214. package/dist/components/form/radio/index.js.map +1 -0
  215. package/dist/components/form/radio-card/description.d.ts +3 -0
  216. package/dist/components/form/radio-card/description.js +10 -0
  217. package/dist/components/form/radio-card/description.js.map +1 -0
  218. package/dist/components/form/radio-card/form-radio-card.module.css +153 -0
  219. package/dist/components/form/radio-card/form-radio-card.module.css.js +30 -0
  220. package/dist/components/form/radio-card/form-radio-card.module.css.js.map +1 -0
  221. package/dist/components/form/radio-card/group.d.ts +11 -0
  222. package/dist/components/form/radio-card/group.js +31 -0
  223. package/dist/components/form/radio-card/group.js.map +1 -0
  224. package/dist/components/form/radio-card/index.d.ts +48 -0
  225. package/dist/components/form/radio-card/index.js +67 -0
  226. package/dist/components/form/radio-card/index.js.map +1 -0
  227. package/dist/components/form/radio-card/label.d.ts +3 -0
  228. package/dist/components/form/radio-card/label.js +10 -0
  229. package/dist/components/form/radio-card/label.js.map +1 -0
  230. package/dist/components/form/select/form-select.module.css +89 -0
  231. package/dist/components/form/select/form-select.module.css.js +14 -0
  232. package/dist/components/form/select/form-select.module.css.js.map +1 -0
  233. package/dist/components/form/select/index.d.ts +21 -0
  234. package/dist/components/form/select/index.js +79 -0
  235. package/dist/components/form/select/index.js.map +1 -0
  236. package/dist/components/form/super-select/form-super-select.module.css +155 -0
  237. package/dist/components/form/super-select/form-super-select.module.css.js +22 -0
  238. package/dist/components/form/super-select/form-super-select.module.css.js.map +1 -0
  239. package/dist/components/form/super-select/index.d.ts +55 -0
  240. package/dist/components/form/super-select/index.js +170 -0
  241. package/dist/components/form/super-select/index.js.map +1 -0
  242. package/dist/components/form/text-input/index.d.ts +98 -0
  243. package/dist/components/form/text-input/index.js +91 -0
  244. package/dist/components/form/text-input/index.js.map +1 -0
  245. package/dist/components/form/text-input/styles.module.css +158 -0
  246. package/dist/components/form/text-input/styles.module.css.js +15 -0
  247. package/dist/components/form/text-input/styles.module.css.js.map +1 -0
  248. package/dist/components/form/textarea/form-textarea.module.css +88 -0
  249. package/dist/components/form/textarea/form-textarea.module.css.js +14 -0
  250. package/dist/components/form/textarea/form-textarea.module.css.js.map +1 -0
  251. package/dist/components/form/textarea/index.d.ts +19 -0
  252. package/dist/components/form/textarea/index.js +74 -0
  253. package/dist/components/form/textarea/index.js.map +1 -0
  254. package/dist/components/form/toggle/form-toggle.module.scss +164 -0
  255. package/dist/components/form/toggle/form-toggle.module.scss.js +12 -0
  256. package/dist/components/form/toggle/form-toggle.module.scss.js.map +1 -0
  257. package/dist/components/form/toggle/index.d.ts +78 -0
  258. package/dist/components/form/toggle/index.js +102 -0
  259. package/dist/components/form/toggle/index.js.map +1 -0
  260. package/dist/components/hds/wrappers/tooltip.d.ts +13 -0
  261. package/dist/components/hds/wrappers/tooltip.js +51 -0
  262. package/dist/components/hds/wrappers/tooltip.js.map +1 -0
  263. package/dist/components/icon-tile/index.d.ts +21 -0
  264. package/dist/components/icon-tile/index.js +50 -0
  265. package/dist/components/icon-tile/index.js.map +1 -0
  266. package/dist/components/icon-tile/style.module.scss +136 -0
  267. package/dist/components/icon-tile/style.module.scss.js +29 -0
  268. package/dist/components/icon-tile/style.module.scss.js.map +1 -0
  269. package/dist/components/index.d.ts +60 -0
  270. package/dist/components/index.js +119 -0
  271. package/dist/components/index.js.map +1 -0
  272. package/dist/components/inline-link/index.d.ts +40 -0
  273. package/dist/components/inline-link/index.js +33 -0
  274. package/dist/components/inline-link/index.js.map +1 -0
  275. package/dist/components/inline-link/inline-link.module.css +49 -0
  276. package/dist/components/inline-link/inline-link.module.css.js +11 -0
  277. package/dist/components/inline-link/inline-link.module.css.js.map +1 -0
  278. package/dist/components/interactive/index.d.ts +26 -0
  279. package/dist/components/interactive/index.js +59 -0
  280. package/dist/components/interactive/index.js.map +1 -0
  281. package/dist/components/legacy-button/index.d.ts +5 -0
  282. package/dist/components/legacy-button/index.js +65 -0
  283. package/dist/components/legacy-button/index.js.map +1 -0
  284. package/dist/components/legacy-button/types.d.ts +37 -0
  285. package/dist/components/legacy-button/utils.d.ts +9 -0
  286. package/dist/components/legacy-button/utils.js +39 -0
  287. package/dist/components/legacy-button/utils.js.map +1 -0
  288. package/dist/components/menu-primitive/index.d.ts +14 -0
  289. package/dist/components/menu-primitive/index.js +68 -0
  290. package/dist/components/menu-primitive/index.js.map +1 -0
  291. package/dist/components/menu-primitive/styles.module.css +16 -0
  292. package/dist/components/menu-primitive/styles.module.css.js +12 -0
  293. package/dist/components/menu-primitive/styles.module.css.js.map +1 -0
  294. package/dist/components/menu-primitive/use-menu-primitive.d.ts +9 -0
  295. package/dist/components/menu-primitive/use-menu-primitive.js +17 -0
  296. package/dist/components/menu-primitive/use-menu-primitive.js.map +1 -0
  297. package/dist/components/modal/index.d.ts +13 -0
  298. package/dist/components/modal/index.js +61 -0
  299. package/dist/components/modal/index.js.map +1 -0
  300. package/dist/components/modal/modal.module.css +22 -0
  301. package/dist/components/modal/modal.module.css.js +8 -0
  302. package/dist/components/modal/modal.module.css.js.map +1 -0
  303. package/dist/components/modal/use-modal.d.ts +8 -0
  304. package/dist/components/modal/use-modal.js +17 -0
  305. package/dist/components/modal/use-modal.js.map +1 -0
  306. package/dist/components/separator/index.d.ts +10 -0
  307. package/dist/components/separator/index.js +15 -0
  308. package/dist/components/separator/index.js.map +1 -0
  309. package/dist/components/separator/separator.module.css +15 -0
  310. package/dist/components/separator/separator.module.css.js +10 -0
  311. package/dist/components/separator/separator.module.css.js.map +1 -0
  312. package/dist/components/standalone-link/index.d.ts +23 -0
  313. package/dist/components/standalone-link/index.js +54 -0
  314. package/dist/components/standalone-link/index.js.map +1 -0
  315. package/dist/components/standalone-link/styles.module.scss +166 -0
  316. package/dist/components/standalone-link/styles.module.scss.js +17 -0
  317. package/dist/components/standalone-link/styles.module.scss.js.map +1 -0
  318. package/dist/components/table/index.d.ts +58 -0
  319. package/dist/components/table/index.js +52 -0
  320. package/dist/components/table/index.js.map +1 -0
  321. package/dist/components/table/table.module.scss +192 -0
  322. package/dist/components/table/table.module.scss.js +33 -0
  323. package/dist/components/table/table.module.scss.js.map +1 -0
  324. package/dist/components/table/td.d.ts +17 -0
  325. package/dist/components/table/td.js +28 -0
  326. package/dist/components/table/td.js.map +1 -0
  327. package/dist/components/table/th-button-tooltip.d.ts +6 -0
  328. package/dist/components/table/th-button-tooltip.js +24 -0
  329. package/dist/components/table/th-button-tooltip.js.map +1 -0
  330. package/dist/components/table/th.d.ts +34 -0
  331. package/dist/components/table/th.js +43 -0
  332. package/dist/components/table/th.js.map +1 -0
  333. package/dist/components/table/tr.d.ts +12 -0
  334. package/dist/components/table/tr.js +9 -0
  335. package/dist/components/table/tr.js.map +1 -0
  336. package/dist/components/table/utils.d.ts +16 -0
  337. package/dist/components/table/utils.js +28 -0
  338. package/dist/components/table/utils.js.map +1 -0
  339. package/dist/components/tabs/index.d.ts +21 -0
  340. package/dist/components/tabs/index.js +117 -0
  341. package/dist/components/tabs/index.js.map +1 -0
  342. package/dist/components/tabs/tab-panel.d.ts +5 -0
  343. package/dist/components/tabs/tab-panel.js +35 -0
  344. package/dist/components/tabs/tab-panel.js.map +1 -0
  345. package/dist/components/tabs/tab.d.ts +24 -0
  346. package/dist/components/tabs/tab.js +70 -0
  347. package/dist/components/tabs/tab.js.map +1 -0
  348. package/dist/components/tabs/tabs.module.scss +163 -0
  349. package/dist/components/tabs/tabs.module.scss.js +22 -0
  350. package/dist/components/tabs/tabs.module.scss.js.map +1 -0
  351. package/dist/components/tabs/use-tabs-context.d.ts +15 -0
  352. package/dist/components/tabs/use-tabs-context.js +16 -0
  353. package/dist/components/tabs/use-tabs-context.js.map +1 -0
  354. package/dist/components/text/index.d.ts +44 -0
  355. package/dist/components/text/index.js +112 -0
  356. package/dist/components/text/index.js.map +1 -0
  357. package/dist/components/text/style.module.scss +11 -0
  358. package/dist/components/text/style.module.scss.js +9 -0
  359. package/dist/components/text/style.module.scss.js.map +1 -0
  360. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.d.ts +8 -0
  361. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +62 -0
  362. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -0
  363. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css +76 -0
  364. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js +20 -0
  365. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js.map +1 -0
  366. package/dist/components/visualizations/bar-chart/horizontal-chart/index.d.ts +44 -0
  367. package/dist/components/visualizations/bar-chart/horizontal-chart/index.js +104 -0
  368. package/dist/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -0
  369. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.d.ts +10 -0
  370. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js +13 -0
  371. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js.map +1 -0
  372. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css +29 -0
  373. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js +14 -0
  374. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js.map +1 -0
  375. package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css +76 -0
  376. package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js +28 -0
  377. package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js.map +1 -0
  378. package/dist/components/visualizations/bar-chart/index.d.ts +13 -0
  379. package/dist/components/visualizations/bar-chart/index.js +37 -0
  380. package/dist/components/visualizations/bar-chart/index.js.map +1 -0
  381. package/dist/components/visualizations/bar-chart/style.module.css +39 -0
  382. package/dist/components/visualizations/bar-chart/style.module.css.js +12 -0
  383. package/dist/components/visualizations/bar-chart/style.module.css.js.map +1 -0
  384. package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.d.ts +3 -0
  385. package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js +14 -0
  386. package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js.map +1 -0
  387. package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css +14 -0
  388. package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js +10 -0
  389. package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js.map +1 -0
  390. package/dist/components/visualizations/donut-chart/components/external-arc-label/index.d.ts +3 -0
  391. package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js +58 -0
  392. package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js.map +1 -0
  393. package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css +32 -0
  394. package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js +16 -0
  395. package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js.map +1 -0
  396. package/dist/components/visualizations/donut-chart/components/index.d.ts +3 -0
  397. package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.d.ts +3 -0
  398. package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js +42 -0
  399. package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js.map +1 -0
  400. package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css +20 -0
  401. package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js +14 -0
  402. package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js.map +1 -0
  403. package/dist/components/visualizations/donut-chart/index.d.ts +10 -0
  404. package/dist/components/visualizations/donut-chart/index.js +90 -0
  405. package/dist/components/visualizations/donut-chart/index.js.map +1 -0
  406. package/dist/components/visualizations/donut-chart/styles.module.css +73 -0
  407. package/dist/components/visualizations/donut-chart/styles.module.css.js +20 -0
  408. package/dist/components/visualizations/donut-chart/styles.module.css.js.map +1 -0
  409. package/dist/components/visualizations/donut-chart/types.d.ts +16 -0
  410. package/dist/hooks/use-media-query/index.js +16 -0
  411. package/dist/hooks/use-media-query/index.js.map +1 -0
  412. package/dist/index.d.ts +3 -0
  413. package/dist/index.js +158 -0
  414. package/dist/index.js.map +1 -0
  415. package/dist/patterns/card/index.d.ts +5 -0
  416. package/dist/patterns/card/newsroom-card/index.d.ts +15 -0
  417. package/dist/patterns/card/newsroom-card/index.js +26 -0
  418. package/dist/patterns/card/newsroom-card/index.js.map +1 -0
  419. package/dist/patterns/card/newsroom-card/style.module.css +12 -0
  420. package/dist/patterns/card/newsroom-card/style.module.css.js +8 -0
  421. package/dist/patterns/card/newsroom-card/style.module.css.js.map +1 -0
  422. package/dist/patterns/card/partner-card/index.d.ts +18 -0
  423. package/dist/patterns/card/partner-card/index.js +42 -0
  424. package/dist/patterns/card/partner-card/index.js.map +1 -0
  425. package/dist/patterns/card/partner-card/style.module.css +24 -0
  426. package/dist/patterns/card/partner-card/style.module.css.js +12 -0
  427. package/dist/patterns/card/partner-card/style.module.css.js.map +1 -0
  428. package/dist/patterns/card/person-card/index.d.ts +15 -0
  429. package/dist/patterns/card/person-card/index.js +52 -0
  430. package/dist/patterns/card/person-card/index.js.map +1 -0
  431. package/dist/patterns/card/person-card/style.module.css +28 -0
  432. package/dist/patterns/card/person-card/style.module.css.js +12 -0
  433. package/dist/patterns/card/person-card/style.module.css.js.map +1 -0
  434. package/dist/patterns/card/primitives.d.ts +37 -0
  435. package/dist/patterns/card/primitives.js +77 -0
  436. package/dist/patterns/card/primitives.js.map +1 -0
  437. package/dist/patterns/card/promo-card/index.d.ts +18 -0
  438. package/dist/patterns/card/promo-card/index.js +36 -0
  439. package/dist/patterns/card/promo-card/index.js.map +1 -0
  440. package/dist/patterns/card/resource-card/index.d.ts +16 -0
  441. package/dist/patterns/card/resource-card/index.js +26 -0
  442. package/dist/patterns/card/resource-card/index.js.map +1 -0
  443. package/dist/patterns/card/style.module.css +121 -0
  444. package/dist/patterns/card/style.module.css.js +30 -0
  445. package/dist/patterns/card/style.module.css.js.map +1 -0
  446. package/dist/patterns/card/thumbnails/index.d.ts +13 -0
  447. package/dist/patterns/card/thumbnails/index.js +25 -0
  448. package/dist/patterns/card/thumbnails/index.js.map +1 -0
  449. package/dist/patterns/card/types.d.ts +41 -0
  450. package/dist/patterns/card/unified-card/index.d.ts +10 -0
  451. package/dist/patterns/card/unified-card/index.js +37 -0
  452. package/dist/patterns/card/unified-card/index.js.map +1 -0
  453. package/dist/patterns/copy-button/clipboard.d.ts +16 -0
  454. package/dist/patterns/copy-button/clipboard.js +78 -0
  455. package/dist/patterns/copy-button/clipboard.js.map +1 -0
  456. package/dist/patterns/copy-button/index.d.ts +19 -0
  457. package/dist/patterns/copy-button/index.js +57 -0
  458. package/dist/patterns/copy-button/index.js.map +1 -0
  459. package/dist/patterns/copy-button/style.module.css +23 -0
  460. package/dist/patterns/copy-button/style.module.css.js +13 -0
  461. package/dist/patterns/copy-button/style.module.css.js.map +1 -0
  462. package/dist/patterns/index.d.ts +15 -0
  463. package/dist/patterns/index.js +35 -0
  464. package/dist/patterns/index.js.map +1 -0
  465. package/dist/patterns/layout/index.d.ts +69 -0
  466. package/dist/patterns/layout/index.js +47 -0
  467. package/dist/patterns/layout/index.js.map +1 -0
  468. package/dist/patterns/layout/layout.module.css +72 -0
  469. package/dist/patterns/layout/layout.module.css.js +20 -0
  470. package/dist/patterns/layout/layout.module.css.js.map +1 -0
  471. package/dist/patterns/product-badge/index.d.ts +11 -0
  472. package/dist/patterns/product-badge/index.js +22 -0
  473. package/dist/patterns/product-badge/index.js.map +1 -0
  474. package/dist/patterns/product-badge/style.module.css +3 -0
  475. package/dist/patterns/product-badge/style.module.css.js +8 -0
  476. package/dist/patterns/product-badge/style.module.css.js.map +1 -0
  477. package/dist/patterns/product-logo/index.d.ts +48 -0
  478. package/dist/patterns/product-logo/index.js +130 -0
  479. package/dist/patterns/product-logo/index.js.map +1 -0
  480. package/dist/patterns/product-logo/product-logo.module.css +24 -0
  481. package/dist/patterns/product-logo/product-logo.module.css.js +13 -0
  482. package/dist/patterns/product-logo/product-logo.module.css.js.map +1 -0
  483. package/dist/patterns/related-content/index.d.ts +6 -0
  484. package/dist/patterns/related-content/index.js +65 -0
  485. package/dist/patterns/related-content/index.js.map +1 -0
  486. package/dist/patterns/related-content/style.module.css +74 -0
  487. package/dist/patterns/related-content/style.module.css.js +22 -0
  488. package/dist/patterns/related-content/style.module.css.js.map +1 -0
  489. package/dist/patterns/related-content/types.d.ts +14 -0
  490. package/dist/style.css +1 -0
  491. package/dist/styles/mixins/button.scss +284 -0
  492. package/dist/styles/mixins/focus-ring.scss +75 -0
  493. package/dist/utils/get-contrast-yiq.d.ts +20 -0
  494. package/dist/utils/get-contrast-yiq.js +13 -0
  495. package/dist/utils/get-contrast-yiq.js.map +1 -0
  496. package/dist/utils/hooks/use-screen-size.d.ts +5 -0
  497. package/dist/utils/hooks/use-screen-size.js +10 -0
  498. package/dist/utils/hooks/use-screen-size.js.map +1 -0
  499. package/dist/utils/i18n/index.d.ts +1 -0
  500. package/dist/utils/i18n/index.js +41 -0
  501. package/dist/utils/i18n/index.js.map +1 -0
  502. package/dist/utils/index.d.ts +3 -0
  503. package/dist/utils/index.js +10 -0
  504. package/dist/utils/index.js.map +1 -0
  505. package/dist/utils/make-normalizer/index.d.ts +30 -0
  506. package/dist/utils/make-normalizer/index.js +34 -0
  507. package/dist/utils/make-normalizer/index.js.map +1 -0
  508. package/dist/utils/mds-context/index.d.ts +59 -0
  509. package/dist/utils/mds-context/index.js +85 -0
  510. package/dist/utils/mds-context/index.js.map +1 -0
  511. package/package.json +113 -0
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as b } from "react/jsx-runtime";
3
+ import { useId as f, useMemo as o } from "react";
4
+ import u from "classnames";
5
+ import { useTabsContext as I } from "./use-tabs-context.js";
6
+ import x from "./tabs.module.scss.js";
7
+ const y = ({ children: r, className: d, ...l }) => {
8
+ const { panelIds: n, tabIds: t, selectedTabIndex: a, panelNodes: c } = I(), s = "panel-" + f(), e = o(
9
+ () => n.indexOf(s),
10
+ [n, s]
11
+ ), i = o(
12
+ () => e > -1 ? t[e] : void 0,
13
+ [t, e]
14
+ ), m = o(
15
+ () => e === a,
16
+ [e, a]
17
+ );
18
+ return /* @__PURE__ */ b(
19
+ "section",
20
+ {
21
+ className: u(x.panel, d),
22
+ ...l,
23
+ role: "tabpanel",
24
+ "aria-labelledby": i,
25
+ id: s,
26
+ hidden: !m,
27
+ ref: (p) => c.current.push(p),
28
+ children: r
29
+ }
30
+ );
31
+ };
32
+ export {
33
+ y as TabPanel
34
+ };
35
+ //# sourceMappingURL=tab-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tab-panel.js","sources":["../../../src/components/tabs/tab-panel.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo, type HTMLAttributes } from 'react'\nimport classNames from 'classnames'\nimport { useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\ntype TabPanelProps = HTMLAttributes<HTMLDivElement>\n\nconst TabPanel = ({ children, className, ...rest }: TabPanelProps) => {\n\tconst { panelIds, tabIds, selectedTabIndex, panelNodes } = useTabsContext()\n\tconst panelId = 'panel-' + useId()\n\n\tconst nodeIndex = useMemo(\n\t\t() => panelIds.indexOf(panelId),\n\t\t[panelIds, panelId]\n\t)\n\n\tconst tabId = useMemo(\n\t\t() => (nodeIndex > -1 ? tabIds[nodeIndex] : undefined),\n\t\t[tabIds, nodeIndex]\n\t)\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex]\n\t)\n\n\treturn (\n\t\t<section\n\t\t\tclassName={classNames(s.panel, className)}\n\t\t\t{...rest}\n\t\t\trole=\"tabpanel\"\n\t\t\taria-labelledby={tabId}\n\t\t\tid={panelId}\n\t\t\thidden={!isSelected}\n\t\t\tref={(el: HTMLDivElement) => panelNodes.current.push(el)}\n\t\t>\n\t\t\t{children}\n\t\t</section>\n\t)\n}\n\nexport type { TabPanelProps }\nexport { TabPanel }\n"],"names":["TabPanel","children","className","rest","panelIds","tabIds","panelNodes","useTabsContext","panelId","useId","useMemo","tabId","nodeIndex","isSelected","selectedTabIndex","jsx","classNames","s","el"],"mappings":";;;;;;AAUC,MAAAA,IAAQ,CAAA,EAAU,UAAAC,GAAQ,WAAAC,GAAA,GAAAC,EAAkB,MAAA;AAC5C,QAAM,EAAA,UAAAC,GAAU,QAAAC,wBAAiB,YAAAC,EAAA,IAAAC,EAAA,GAE3BC,IAAA,WAAYC,EAAA,OACFC;AAAA,IACf,MAACN,EAAU,QAAOI,CAAA;AAAA,IACnB,CAAAJ,GAAAI,CAAA;AAAA,EAEA,GACCG,IAAOD;AAAA,IACP,MAACE,IAAiB,KAAAP,EAAAO,CAAA,IAAA;AAAA,IACnB,CAAAP,GAAAO,CAAA;AAAA,EAEA,GACCC,IAAMH;AAAA,IACN,MAACE,MAAWE;AAAA,IACb,CAAAF,GAAAE,CAAA;AAAA,EAEA;AACC,SAAC,gBAAAC;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGC,EAAAC,EAAA,OAAAf,CAAA;AAAA,MACJ,GAAAC;AAAA,MACA,MAAA;AAAA,MACA,mBAAIQ;AAAA,MACJ,IAAAH;AAAA,MACA,QAAM,CAAAK;AAAA,MAEL,KAAA,CAAAK,MAAAZ,EAAA,QAAA,KAAAY,CAAA;AAAA,MAAA,UAAAjB;AAAA,IACF;AAAA,EAEF;;"}
@@ -0,0 +1,24 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { FlightIconName } from '../flight-icon';
3
+ interface TabProps extends HTMLAttributes<HTMLLIElement> {
4
+ tabIndicatorTheme?: 'primary' | 'secondary';
5
+ /**
6
+ * Displays a count indicator in the tab. Accepts the text value that should go in Badge Count. (optional)
7
+ */
8
+ count?: string;
9
+ /**
10
+ * Displays an icon in the tab. (optional)
11
+ */
12
+ icon?: FlightIconName;
13
+ /**
14
+ * Customizes the initial tab to display when the page is loaded. The first tab is selected on page load by default. (optional)
15
+ */
16
+ isSelected?: boolean;
17
+ /**
18
+ * Used to append analytics and tracking related data attributes to any interactive element internal to this component.
19
+ */
20
+ trackingKey?: string;
21
+ }
22
+ declare const Tab: ({ count, icon, isSelected: isInitialTab, children, className, trackingKey, tabIndicatorTheme, ...rest }: TabProps) => import("react/jsx-runtime").JSX.Element;
23
+ export type { TabProps };
24
+ export { Tab };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { jsx as r, jsxs as N } from "react/jsx-runtime";
3
+ import c from "classnames";
4
+ import { BadgeCount as z } from "../badge-count/index.js";
5
+ import { useId as T, useMemo as p } from "react";
6
+ import { useTabsContext as j } from "./use-tabs-context.js";
7
+ import { FlightIcon as k } from "../flight-icon/index.js";
8
+ import o from "./tabs.module.scss.js";
9
+ const M = ({
10
+ count: n,
11
+ icon: i,
12
+ isSelected: b,
13
+ children: y,
14
+ className: u,
15
+ trackingKey: f,
16
+ tabIndicatorTheme: g = "primary",
17
+ ...x
18
+ }) => {
19
+ const { tabNodes: h, tabIds: d, selectedTabIndex: m, onClick: I, onKeyUp: C, size: l } = j(), s = "tab-" + T(), t = p(() => d.indexOf(s), [d, s]), a = p(
20
+ () => t === m,
21
+ [t, m]
22
+ );
23
+ return /* @__PURE__ */ r(
24
+ "li",
25
+ {
26
+ className: c(
27
+ o.tab,
28
+ o[g],
29
+ {
30
+ [o.selected]: a
31
+ },
32
+ u
33
+ ),
34
+ ...x,
35
+ role: "presentation",
36
+ children: /* @__PURE__ */ N(
37
+ "button",
38
+ {
39
+ className: c(
40
+ o["tab-button"],
41
+ "mds-typography-font-weight-medium",
42
+ {
43
+ "mds-typography-legacy-body-200": l === "medium",
44
+ "mds-typography-legacy-body-300": l === "large"
45
+ }
46
+ ),
47
+ role: "tab",
48
+ type: "button",
49
+ id: s,
50
+ "aria-selected": a,
51
+ tabIndex: a ? void 0 : -1,
52
+ onClick: (e) => I(t, e),
53
+ onKeyUp: (e) => C(t, e),
54
+ "data-is-selected": b,
55
+ "data-analytics": f,
56
+ ref: (e) => h.current.push(e),
57
+ children: [
58
+ i && /* @__PURE__ */ r(k, { name: i, size: 16, role: "presentation" }),
59
+ y,
60
+ n && /* @__PURE__ */ r(z, { text: n, size: "small", role: "presentation" })
61
+ ]
62
+ }
63
+ )
64
+ }
65
+ );
66
+ };
67
+ export {
68
+ M as Tab
69
+ };
70
+ //# sourceMappingURL=tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tab.js","sources":["../../../src/components/tabs/tab.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport { BadgeCount } from '../badge-count'\nimport { useId, type HTMLAttributes, useMemo } from 'react'\nimport { useTabsContext } from './use-tabs-context'\nimport type { FlightIconName } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\nimport s from './tabs.module.scss'\n\ninterface TabProps extends HTMLAttributes<HTMLLIElement> {\n\ttabIndicatorTheme?: 'primary' | 'secondary'\n\t/**\n\t * Displays a count indicator in the tab. Accepts the text value that should go in Badge Count. (optional)\n\t */\n\tcount?: string\n\t/**\n\t * Displays an icon in the tab. (optional)\n\t */\n\ticon?: FlightIconName\n\t/**\n\t * Customizes the initial tab to display when the page is loaded. The first tab is selected on page load by default. (optional)\n\t */\n\tisSelected?: boolean\n\t/**\n\t * Used to append analytics and tracking related data attributes to any interactive element internal to this component.\n\t */\n\ttrackingKey?: string\n}\n\nconst Tab = ({\n\tcount,\n\ticon,\n\tisSelected: isInitialTab,\n\tchildren,\n\tclassName,\n\ttrackingKey,\n\ttabIndicatorTheme = 'primary',\n\t...rest\n}: TabProps) => {\n\tconst { tabNodes, tabIds, selectedTabIndex, onClick, onKeyUp, size } =\n\t\tuseTabsContext()\n\tconst tabId = 'tab-' + useId()\n\n\tconst nodeIndex = useMemo(() => tabIds.indexOf(tabId), [tabIds, tabId])\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex]\n\t)\n\n\treturn (\n\t\t<li\n\t\t\tclassName={classNames(\n\t\t\t\ts.tab,\n\t\t\t\ts[tabIndicatorTheme],\n\t\t\t\t{\n\t\t\t\t\t[s.selected]: isSelected,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...rest}\n\t\t\trole=\"presentation\"\n\t\t>\n\t\t\t<button\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['tab-button'],\n\t\t\t\t\t'mds-typography-font-weight-medium',\n\t\t\t\t\t{\n\t\t\t\t\t\t['mds-typography-legacy-body-200']: size === 'medium',\n\t\t\t\t\t\t['mds-typography-legacy-body-300']: size === 'large',\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t\trole=\"tab\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tid={tabId}\n\t\t\t\taria-selected={isSelected}\n\t\t\t\ttabIndex={!isSelected ? -1 : undefined}\n\t\t\t\tonClick={(e) => onClick(nodeIndex, e)}\n\t\t\t\tonKeyUp={(e) => onKeyUp(nodeIndex, e)}\n\t\t\t\tdata-is-selected={isInitialTab}\n\t\t\t\tdata-analytics={trackingKey}\n\t\t\t\tref={(el: HTMLButtonElement) => tabNodes.current.push(el)}\n\t\t\t>\n\t\t\t\t{icon && <FlightIcon name={icon} size={16} role=\"presentation\" />}\n\n\t\t\t\t{children}\n\n\t\t\t\t{count && <BadgeCount text={count} size=\"small\" role=\"presentation\" />}\n\t\t\t</button>\n\t\t</li>\n\t)\n}\n\nexport type { TabProps }\nexport { Tab }\n"],"names":["Tab","count","icon","isInitialTab","children","className","trackingKey","tabIndicatorTheme","rest","tabNodes","tabIds","onClick","onKeyUp","size","useTabsContext","tabId","nodeIndex","useMemo","isSelected","selectedTabIndex","jsx","classNames","s","jsxs","el","FlightIcon","BadgeCount"],"mappings":";;;;;;;;AA8Ba,MACZA,IAAA,CAAA;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAG;AAAA,EACJ,GAAAC;AACC;AAEA,QAAM,EAAA,UAAAC,GAAQ,QAAAC,wBAAe,SAAAC,GAAA,SAAAC,GAAA,MAAAC,EAAA,IAAAC,EAAA,GAEvBC,IAAA,WAAoB,GAEpBC,IAAAC,EAAa,MAAAP,EAAA,QAAAK,CAAA,GAAA,CAAAL,GAAAK,CAAA,CAAA,GAClBG,IAAMD;AAAA,IACN,MAACD,MAAWG;AAAA,IACb,CAAAH,GAAAG,CAAA;AAAA,EAEA;AACC,SAAC,gBAAAC;AAAA,IAAA;AAAA,IAAA;AAAA,MACW,WACRC;AAAA,QACFC,EAAE;AAAA,QACFA,EAAAf,CAAA;AAAA,QAAA;AAAA,UAEA,CAAAe,EAAA,QAAA,GAAAJ;AAAA,QACA;AAAA,QACDb;AAAA,MACC;AAAA,MACD,GAAAG;AAAA,MAEA,MAAA;AAAA,MAAA,UAAC,gBAAAe;AAAA,QAAA;AAAA,QAAA;AAAA,UACW,WACRF;AAAA,YACFC,EAAA,YAAA;AAAA,YACA;AAAA,YAAA;AAAA,cAEE,kCAAmCT,MAAS;AAAA,cAAA,kCAAAA,MAAA;AAAA,YAE/C;AAAA,UACA;AAAA,UACA,MAAK;AAAA,UACL,MAAI;AAAA,UACJ,IAAAE;AAAA,UACA;UACA,UAAUG,IAAc,SAAA;AAAA,UACxB,SAAS,CAAC,MAAMP,EAAQK,GAAW,CAAC;AAAA,UACpC,SAAA,CAAA,MAAAJ,EAAkBI,GAAA,CAAA;AAAA,UAClB,oBAAgBb;AAAA,UAChB,kBAAgCG;AAAA,UAE/B,YAAAG,EAAA,QAAA,KAAAe,CAAA;AAAA,UAAA,UAAA;AAAA,YAEAtB,KAAA,gBAAAkB,EAAAK,GAAA,EAAA,MAAAvB,GAAA,MAAA,IAAA,MAAA,eAAA,CAAA;AAAA,YAEAE;AAAA,YAAmEH,KAAA,gBAAAmB,EAAAM,GAAA,EAAA,MAAAzB,GAAA,MAAA,SAAA,MAAA,eAAA,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACrE;AAAA,IACD;AAAA,EAEF;;"}
@@ -0,0 +1,163 @@
1
+ @use 'styles/mixins/focus-ring' as *;
2
+
3
+ .tablist-wrapper {
4
+ position: relative;
5
+
6
+ // bottom gray border:
7
+ &::before {
8
+ position: absolute;
9
+ right: 0;
10
+ bottom: calc(
11
+ (var(--mds-tabs-indicator-height) - var(--mds-tabs-divider-height)) /
12
+ 2
13
+ );
14
+ left: 0;
15
+ display: block;
16
+ border-top: var(--mds-tabs-divider-height) solid
17
+ var(--mds-color-border-primary);
18
+ content: '';
19
+ }
20
+ }
21
+
22
+ .tablist {
23
+ position: relative;
24
+ display: flex;
25
+ margin: 0;
26
+ padding: 0;
27
+ overflow-x: auto;
28
+ -webkit-overflow-scrolling: touch;
29
+ }
30
+
31
+ .tab {
32
+ position: relative;
33
+ display: flex;
34
+ align-items: center;
35
+ height: var(--mds-tabs-tab-height-medium);
36
+ margin: 0;
37
+ padding: var(--mds-tabs-tab-padding-vertical)
38
+ var(--mds-tabs-tab-padding-horizontal-medium);
39
+ white-space: nowrap;
40
+ text-decoration: none;
41
+ list-style: none;
42
+
43
+ &.primary {
44
+ color: var(
45
+ --mds-accent-tab-color-foreground,
46
+ var(--mds-color-foreground-primary)
47
+ );
48
+
49
+ &:hover {
50
+ color: var(
51
+ --mds-accent-tab-color-foreground-hover,
52
+ var(
53
+ --mds-accent-tab-color-foreground,
54
+ var(--mds-color-foreground-action)
55
+ )
56
+ );
57
+ }
58
+
59
+ &.selected {
60
+ color: var(
61
+ --mds-accent-tab-selected-color-foreground,
62
+ var(
63
+ --mds-accent-tab-color-foreground,
64
+ var(--mds-color-foreground-action)
65
+ )
66
+ );
67
+
68
+ &:hover {
69
+ color: var(
70
+ --mds-accent-tab-selected-color-foreground-hover,
71
+ var(
72
+ --mds-accent-tab-selected-color-foreground,
73
+ var(
74
+ --mds-accent-tab-color-foreground,
75
+ var(--mds-color-foreground-action-hover)
76
+ )
77
+ )
78
+ );
79
+
80
+ & ~ .indicator {
81
+ background: var(
82
+ --mds-accent-tab-indicator-color,
83
+ var(--mds-color-foreground-action-hover)
84
+ );
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ &.secondary {
91
+ color: var(--mds-color-foreground-faint);
92
+
93
+ &:hover {
94
+ color: var(--mds-color-foreground-strong);
95
+ }
96
+
97
+ &.selected {
98
+ color: var(--mds-color-foreground-strong);
99
+ }
100
+
101
+ & ~ .indicator {
102
+ background: var(
103
+ --mds-accent-tab-indicator-color,
104
+ var(--mds-color-foreground-strong)
105
+ );
106
+ }
107
+ }
108
+ }
109
+
110
+ .tab-button {
111
+ @include hds-focus-ring-with-pseudo-element(
112
+ $top: var(--mds-tabs-tab-focus-inset),
113
+ $right: var(--mds-tabs-tab-focus-inset),
114
+ $bottom: var(--mds-tabs-tab-focus-inset),
115
+ $left: var(--mds-tabs-tab-focus-inset)
116
+ );
117
+ position: static;
118
+ display: flex;
119
+ gap: var(--mds-tabs-tab-gutter);
120
+ align-items: center;
121
+ padding: 0;
122
+ color: inherit;
123
+ background-color: transparent;
124
+ border: none;
125
+ border-radius: var(--mds-tabs-tab-border-radius);
126
+ cursor: pointer;
127
+
128
+ // Expand click target area
129
+ &::after {
130
+ position: absolute;
131
+ content: '';
132
+ inset: 0;
133
+ }
134
+ }
135
+
136
+ .indicator {
137
+ position: absolute;
138
+ right: 0;
139
+ bottom: 0;
140
+ // notice: this custom prop is set dynamically via JavaScript
141
+ left: var(--indicator-left-pos);
142
+ z-index: 10;
143
+ display: block;
144
+ // notice: this custom prop is set dynamically via JavaScript
145
+ width: var(--indicator-width);
146
+ height: var(--mds-tabs-indicator-height);
147
+ background: var(
148
+ --mds-accent-tab-indicator-color,
149
+ var(--mds-color-foreground-action)
150
+ );
151
+ border-radius: var(--mds-tabs-indicator-height);
152
+
153
+ @media screen and (prefers-reduced-motion: no-preference) {
154
+ transition-timing-function: var(--mds-tabs-indicator-transition-function);
155
+ transition-duration: var(--mds-tabs-indicator-transition-duration);
156
+ transition-property: left, width;
157
+ }
158
+ }
159
+
160
+ // Prevent consumers from accidentally overriding default styling of HTML “hidden” attribute
161
+ .panel[hidden] {
162
+ display: none;
163
+ }
@@ -0,0 +1,22 @@
1
+ const t = "tablist__sKiEs", a = "tab__qi523", s = "primary__iGc9C", e = "selected__SVr0E", n = "indicator__OHxre", r = "secondary__qlHsL", c = "panel__G8tI0", _ = {
2
+ "tablist-wrapper": "tablist-wrapper__nF28e",
3
+ tablist: t,
4
+ tab: a,
5
+ primary: s,
6
+ selected: e,
7
+ indicator: n,
8
+ secondary: r,
9
+ "tab-button": "tab-button__qI9wt",
10
+ panel: c
11
+ };
12
+ export {
13
+ _ as default,
14
+ n as indicator,
15
+ c as panel,
16
+ s as primary,
17
+ r as secondary,
18
+ e as selected,
19
+ a as tab,
20
+ t as tablist
21
+ };
22
+ //# sourceMappingURL=tabs.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -0,0 +1,15 @@
1
+ import { MutableRefObject, MouseEvent, KeyboardEvent } from 'react';
2
+ interface TabsContextState {
3
+ tabNodes: MutableRefObject<Array<HTMLButtonElement>>;
4
+ panelNodes: MutableRefObject<Array<HTMLDivElement>>;
5
+ tabIds: Array<string>;
6
+ panelIds: Array<string>;
7
+ selectedTabIndex: number;
8
+ onClick: (tabIndex: number, event: MouseEvent<HTMLButtonElement>) => void;
9
+ onKeyUp: (tabIndex: number, event: KeyboardEvent<HTMLButtonElement>) => void;
10
+ size: 'medium' | 'large';
11
+ tabsListRef: MutableRefObject<HTMLUListElement | null>;
12
+ }
13
+ export declare const TabsContext: import('react').Context<TabsContextState | undefined>;
14
+ export declare function useTabsContext(): TabsContextState;
15
+ export {};
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { createContext as e, useContext as o } from "react";
3
+ const n = e(
4
+ void 0
5
+ );
6
+ function s() {
7
+ const t = o(n);
8
+ if (t === void 0)
9
+ throw new Error("useTabsContext must be used within a TabsContext.Provider");
10
+ return t;
11
+ }
12
+ export {
13
+ n as TabsContext,
14
+ s as useTabsContext
15
+ };
16
+ //# sourceMappingURL=use-tabs-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-tabs-context.js","sources":["../../../src/components/tabs/use-tabs-context.ts"],"sourcesContent":["'use client'\n\nimport {\n\ttype MutableRefObject,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\tcreateContext,\n\tuseContext,\n} from 'react'\n\ninterface TabsContextState {\n\ttabNodes: MutableRefObject<Array<HTMLButtonElement>>\n\tpanelNodes: MutableRefObject<Array<HTMLDivElement>>\n\ttabIds: Array<string>\n\tpanelIds: Array<string>\n\tselectedTabIndex: number\n\tonClick: (tabIndex: number, event: MouseEvent<HTMLButtonElement>) => void\n\tonKeyUp: (tabIndex: number, event: KeyboardEvent<HTMLButtonElement>) => void\n\tsize: 'medium' | 'large'\n\ttabsListRef: MutableRefObject<HTMLUListElement | null>\n}\n\nexport const TabsContext = createContext<TabsContextState | undefined>(\n\tundefined\n)\n\nexport function useTabsContext(): TabsContextState {\n\tconst context = useContext(TabsContext)\n\tif (context === undefined) {\n\t\tthrow new Error('useTabsContext must be used within a TabsContext.Provider')\n\t}\n\treturn context\n}\n"],"names":["TabsContext","createContext","useTabsContext","context","useContext"],"mappings":";;AAsB2B,MAC1BA,IAAAC;AAAA,EACD;AAEO;AACN,SAAMC,IAAU;AAChB,QAAIC,IAAYC,EAAWJ,CAAA;AAC1B,MAAAG,MAAU;AACX,UAAA,IAAA,MAAA,2DAAA;AAED,SAAAA;;"}
@@ -0,0 +1,44 @@
1
+ import { ComponentPropsWithRef, ElementType } from 'react';
2
+ declare const TEXT_COLORS: readonly ["primary", "strong", "faint", "disabled", "high-contrast", "action", "action-hover", "action-active", "highlight", "highlight-on-surface", "highlight-high-contrast", "success", "success-on-surface", "success-high-contrast", "warning", "warning-on-surface", "warning-high-contrast", "critical", "critical-on-surface", "critical-high-contrast"];
3
+ declare const TEXT_GROUPS: readonly ["hds-body", "code", "body", "display-expressive", "label"];
4
+ declare const TEXT_SIZES: readonly ["100", "200", "300", "400", "500", "600", "700", "800"];
5
+ declare const TEXT_WEIGHTS: readonly ["regular", "medium", "semibold", "bold"];
6
+ type TextColor = (typeof TEXT_COLORS)[number];
7
+ type TextWeight = (typeof TEXT_WEIGHTS)[number];
8
+ type TextGroup = (typeof TEXT_GROUPS)[number];
9
+ type TextSize = (typeof TEXT_SIZES)[number];
10
+ type HexColor = string & {
11
+ hexish?: unknown;
12
+ };
13
+ interface BaseTextProps<T extends ElementType> {
14
+ tag?: T;
15
+ size?: TextSize;
16
+ weight?: TextWeight;
17
+ align?: 'left' | 'center' | 'right';
18
+ color?: TextColor | HexColor;
19
+ className?: string;
20
+ }
21
+ interface TextImplProps<T extends ElementType> extends BaseTextProps<T> {
22
+ group: TextGroup;
23
+ }
24
+ interface BodyProps<T extends ElementType> extends BaseTextProps<T> {
25
+ size?: '200' | '300' | '400';
26
+ }
27
+ interface DisplayExpressiveProps<T extends ElementType> extends BaseTextProps<T> {
28
+ size?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800';
29
+ }
30
+ type LabelProps<T extends ElementType> = Omit<BaseTextProps<T>, 'size'>;
31
+ interface HDSBodyProps<T extends ElementType> extends BaseTextProps<T> {
32
+ size?: '100' | '200' | '300';
33
+ }
34
+ interface CodeProps<T extends ElementType> extends BaseTextProps<T> {
35
+ size?: '100' | '200' | '300';
36
+ }
37
+ declare const Text: {
38
+ Body: <T extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, ...rest }: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
39
+ DisplayExpressive: <T_2 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, ...rest }: DisplayExpressiveProps<T_2> & Omit<ComponentPropsWithRef<T_2>, keyof DisplayExpressiveProps<T_2>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
40
+ Label: <T_3 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>(props: LabelProps<T_3> & Omit<ComponentPropsWithRef<T_3>, "className" | "color" | "tag" | "weight" | "align">) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
41
+ HDSBody: <T_4 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, weight, ...rest }: HDSBodyProps<T_4> & Omit<ComponentPropsWithRef<T_4>, keyof HDSBodyProps<T_4>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
42
+ Code: <T_5 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, weight, ...rest }: CodeProps<T_5> & Omit<ComponentPropsWithRef<T_5>, keyof CodeProps<T_5>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
43
+ };
44
+ export { Text, TEXT_COLORS, TEXT_WEIGHTS };
@@ -0,0 +1,112 @@
1
+ import { jsx as y } from "react/jsx-runtime";
2
+ import l from "classnames";
3
+ import { createElement as e } from "react";
4
+ import m from "./style.module.scss.js";
5
+ const b = [
6
+ "primary",
7
+ "strong",
8
+ "faint",
9
+ "disabled",
10
+ "high-contrast",
11
+ "action",
12
+ "action-hover",
13
+ "action-active",
14
+ "highlight",
15
+ "highlight-on-surface",
16
+ "highlight-high-contrast",
17
+ "success",
18
+ "success-on-surface",
19
+ "success-high-contrast",
20
+ "warning",
21
+ "warning-on-surface",
22
+ "warning-high-contrast",
23
+ "critical",
24
+ "critical-on-surface",
25
+ "critical-high-contrast"
26
+ ], B = ["regular", "medium", "semibold", "bold"];
27
+ function f(r, o) {
28
+ return {
29
+ "hds-body": `mds-typography-legacy-body-${o}`,
30
+ code: `mds-typography-code-${o}`,
31
+ "display-expressive": `mds-typography-display-expressive-${o}`,
32
+ label: "mds-typography-label",
33
+ body: `mds-typography-body-${o}`
34
+ }[r];
35
+ }
36
+ const n = ({
37
+ tag: r,
38
+ group: o,
39
+ size: s = "200",
40
+ weight: a,
41
+ align: c,
42
+ color: t,
43
+ children: p,
44
+ className: g,
45
+ ...d
46
+ }) => {
47
+ const h = r ?? "span", u = f(o, s), i = b.includes(t);
48
+ return /* @__PURE__ */ y(
49
+ h,
50
+ {
51
+ className: l(
52
+ u,
53
+ {
54
+ [m[`align-${c}`]]: c,
55
+ [`mds-typography-font-weight-${a}`]: a,
56
+ [`mds-foreground-${t}`]: t && i
57
+ },
58
+ g
59
+ ),
60
+ style: t && !i ? { color: t } : {},
61
+ ...d,
62
+ children: p
63
+ }
64
+ );
65
+ }, T = ({
66
+ size: r = "300",
67
+ ...o
68
+ }) => e(n, {
69
+ ...o,
70
+ size: r,
71
+ group: "body"
72
+ }), x = ({
73
+ size: r = "200",
74
+ ...o
75
+ }) => e(n, {
76
+ ...o,
77
+ size: r,
78
+ group: "display-expressive"
79
+ }), v = (r) => e(n, {
80
+ ...r,
81
+ group: "label"
82
+ }), $ = ({
83
+ size: r = "200",
84
+ weight: o = "regular",
85
+ ...s
86
+ }) => e(n, {
87
+ ...s,
88
+ size: r,
89
+ weight: o,
90
+ group: "hds-body"
91
+ }), E = ({
92
+ size: r = "200",
93
+ weight: o = "regular",
94
+ ...s
95
+ }) => e(n, {
96
+ ...s,
97
+ size: r,
98
+ weight: o,
99
+ group: "code"
100
+ }), D = {
101
+ Body: T,
102
+ DisplayExpressive: x,
103
+ Label: v,
104
+ HDSBody: $,
105
+ Code: E
106
+ };
107
+ export {
108
+ b as TEXT_COLORS,
109
+ B as TEXT_WEIGHTS,
110
+ D as Text
111
+ };
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport {\n\tcreateElement,\n\ttype ComponentPropsWithRef,\n\ttype ElementType,\n} from 'react'\nimport s from './style.module.scss'\n\nconst TEXT_COLORS = [\n\t'primary',\n\t'strong',\n\t'faint',\n\t'disabled',\n\t'high-contrast',\n\t'action',\n\t'action-hover',\n\t'action-active',\n\t'highlight',\n\t'highlight-on-surface',\n\t'highlight-high-contrast',\n\t'success',\n\t'success-on-surface',\n\t'success-high-contrast',\n\t'warning',\n\t'warning-on-surface',\n\t'warning-high-contrast',\n\t'critical',\n\t'critical-on-surface',\n\t'critical-high-contrast',\n] as const\n\nconst TEXT_GROUPS = [\n\t'hds-body',\n\t'code',\n\t'body',\n\t'display-expressive',\n\t'label',\n] as const\n\nconst TEXT_SIZES = [\n\t'100',\n\t'200',\n\t'300',\n\t'400',\n\t'500',\n\t'600',\n\t'700',\n\t'800',\n] as const\n\nconst TEXT_WEIGHTS = ['regular', 'medium', 'semibold', 'bold'] as const\n\ntype TextColor = (typeof TEXT_COLORS)[number]\ntype TextWeight = (typeof TEXT_WEIGHTS)[number]\ntype TextGroup = (typeof TEXT_GROUPS)[number]\ntype TextSize = (typeof TEXT_SIZES)[number]\n\n// small typescript hack to support autocomplete and arbitrary strings\ntype HexColor = string & { hexish?: unknown }\n\ninterface BaseTextProps<T extends ElementType> {\n\ttag?: T\n\tsize?: TextSize\n\tweight?: TextWeight\n\talign?: 'left' | 'center' | 'right'\n\tcolor?: TextColor | HexColor\n\tclassName?: string\n}\n\ninterface TextImplProps<T extends ElementType> extends BaseTextProps<T> {\n\tgroup: TextGroup\n}\n\nfunction getTypographyToken(group: TextGroup, size: TextSize): string {\n\tconst groupToTokenMap: Record<TextGroup, string> = {\n\t\t'hds-body': `mds-typography-legacy-body-${size}`,\n\t\tcode: `mds-typography-code-${size}`,\n\t\t'display-expressive': `mds-typography-display-expressive-${size}`,\n\t\tlabel: `mds-typography-label`,\n\t\tbody: `mds-typography-body-${size}`,\n\t}\n\n\treturn groupToTokenMap[group]\n}\n\nconst TextImpl = <T extends ElementType = 'span'>({\n\ttag,\n\tgroup,\n\tsize = '200',\n\tweight,\n\talign,\n\tcolor,\n\tchildren,\n\tclassName,\n\t...rest\n}: TextImplProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof TextImplProps<T>>) => {\n\tconst Component = tag ?? 'span'\n\tconst variant = getTypographyToken(group, size)\n\n\tconst usesPredefinedColor = TEXT_COLORS.includes(color as TextColor)\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classNames(\n\t\t\t\tvariant,\n\t\t\t\t{\n\t\t\t\t\t[s[`align-${align}`]]: align,\n\t\t\t\t\t[`mds-typography-font-weight-${weight}`]: weight,\n\t\t\t\t\t[`mds-foreground-${color}`]: color && usesPredefinedColor,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={color && !usesPredefinedColor ? { color } : {}}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t)\n}\n\ninterface BodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '200' | '300' | '400'\n}\n\nconst Body = <T extends ElementType>({\n\tsize = '300',\n\t...rest\n}: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'body',\n\t})\n}\n\ninterface DisplayExpressiveProps<T extends ElementType>\n\textends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800'\n}\n\nconst DisplayExpressive = <T extends ElementType>({\n\tsize = '200',\n\t...rest\n}: DisplayExpressiveProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof DisplayExpressiveProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'display-expressive',\n\t})\n}\n\ntype LabelProps<T extends ElementType> = Omit<BaseTextProps<T>, 'size'>\n\nconst Label = <T extends ElementType>(\n\tprops: LabelProps<T> & Omit<ComponentPropsWithRef<T>, keyof LabelProps<T>>\n) => {\n\treturn createElement(TextImpl, {\n\t\t...props,\n\t\tgroup: 'label',\n\t})\n}\n\ninterface HDSBodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst HDSBody = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: HDSBodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof HDSBodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'hds-body',\n\t})\n}\n\ninterface CodeProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst Code = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: CodeProps<T> & Omit<ComponentPropsWithRef<T>, keyof CodeProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'code',\n\t})\n}\n\nconst Text = {\n\tBody,\n\tDisplayExpressive,\n\tLabel,\n\tHDSBody,\n\tCode,\n}\n\nexport { Text, TEXT_COLORS, TEXT_WEIGHTS }\n"],"names":["TEXT_COLORS","TEXT_WEIGHTS","getTypographyToken","group","size","TextImpl","tag","weight","align","color","children","className","rest","Component","variant","usesPredefinedColor","jsx","classNames","s","Body","createElement","DisplayExpressive","Label","props","HDSBody","Code","Text"],"mappings":";;;;AAQA,MAAMA,IAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAqBMC,IAAe,CAAC,WAAW,UAAU,YAAY,MAAM;AAuB7D,SAASC,EAAmBC,GAAkBC,GAAwB;AASrE,SARmD;AAAA,IAClD,YAAY,8BAA8BA,CAAI;AAAA,IAC9C,MAAM,uBAAuBA,CAAI;AAAA,IACjC,sBAAsB,qCAAqCA,CAAI;AAAA,IAC/D,OAAO;AAAA,IACP,MAAM,uBAAuBA,CAAI;AAAA,EAAA,EAGXD,CAAK;AAC7B;AAEA,MAAME,IAAW,CAAiC;AAAA,EACjD,KAAAC;AAAA,EACA,OAAAH;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAG;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAC4D;AAC3D,QAAMC,IAAYP,KAAO,QACnBQ,IAAUZ,EAAmBC,GAAOC,CAAI,GAExCW,IAAsBf,EAAY,SAASS,CAAkB;AAEnE,SACC,gBAAAO;AAAA,IAACH;AAAA,IAAA;AAAA,MACA,WAAWI;AAAA,QACVH;AAAA,QACA;AAAA,UACC,CAACI,EAAE,SAASV,CAAK,EAAE,CAAC,GAAGA;AAAA,UACvB,CAAC,8BAA8BD,CAAM,EAAE,GAAGA;AAAA,UAC1C,CAAC,kBAAkBE,CAAK,EAAE,GAAGA,KAASM;AAAA,QAAA;AAAA,QAEvCJ;AAAA,MAAA;AAAA,MAED,OAAOF,KAAS,CAACM,IAAsB,EAAE,OAAAN,EAAA,IAAU,CAAA;AAAA,MAClD,GAAGG;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGJ,GAMMS,IAAO,CAAwB;AAAA,EACpC,MAAAf,IAAO;AAAA,EACP,GAAGQ;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAQIiB,IAAoB,CAAwB;AAAA,EACjD,MAAAjB,IAAO;AAAA,EACP,GAAGQ;AACJ,MAEQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAKIkB,IAAQ,CACbC,MAEOH,EAAcf,GAAU;AAAA,EAC9B,GAAGkB;AAAA,EACH,OAAO;AAAA,CACP,GAOIC,IAAU,CAAwB;AAAA,EACvC,MAAApB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAOIkB,IAAO,CAAwB;AAAA,EACpC,MAAArB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAGImB,IAAO;AAAA,EACZ,MAAAP;AAAA,EACA,mBAAAE;AAAA,EACA,OAAAC;AAAA,EACA,SAAAE;AAAA,EACA,MAAAC;AACD;"}
@@ -0,0 +1,11 @@
1
+ .align-left {
2
+ text-align: left;
3
+ }
4
+
5
+ .align-center {
6
+ text-align: center;
7
+ }
8
+
9
+ .align-right {
10
+ text-align: right;
11
+ }
@@ -0,0 +1,9 @@
1
+ const l = {
2
+ "align-left": "align-left__Twy3l",
3
+ "align-center": "align-center__iK1pm",
4
+ "align-right": "align-right__YgPRT"
5
+ };
6
+ export {
7
+ l as default
8
+ };
9
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -0,0 +1,8 @@
1
+ interface DatasetValueProps {
2
+ value: number;
3
+ highestValue: number;
4
+ color: string;
5
+ stackable: boolean;
6
+ }
7
+ export default function DatasetValue({ value, highestValue, color, stackable, }: DatasetValueProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { jsxs as f, jsx as u } from "react/jsx-runtime";
3
+ import { useState as g } from "react";
4
+ import i from "classnames";
5
+ import h from "use-resize-observer";
6
+ import { getContrastYIQ as b, hexToRgb as x } from "../../../../../utils/get-contrast-yiq.js";
7
+ import { Text as V } from "../../../../text/index.js";
8
+ import s from "./style.module.css.js";
9
+ function j({
10
+ value: e,
11
+ highestValue: l,
12
+ color: a,
13
+ stackable: m
14
+ }) {
15
+ const [n, r] = g(!1), { ref: c } = h({
16
+ onResize: ({ width: o }) => {
17
+ e === 0 && (e = 0.5);
18
+ let t = 32;
19
+ e >= 10 && e <= 99 ? t = 40 : e >= 100 && (t = 48), o && o < t ? r(!0) : r(!1);
20
+ }
21
+ }), d = b(x(a)), p = e / l * 100;
22
+ return /* @__PURE__ */ f(
23
+ "div",
24
+ {
25
+ ref: c,
26
+ className: i(s.datasetValue, s[d]),
27
+ style: {
28
+ "--width": p
29
+ },
30
+ children: [
31
+ /* @__PURE__ */ u(
32
+ "div",
33
+ {
34
+ className: s.datasetValueBar,
35
+ style: {
36
+ "--bar-background": a
37
+ }
38
+ }
39
+ ),
40
+ /* @__PURE__ */ f(
41
+ V.Body,
42
+ {
43
+ tag: "span",
44
+ size: "200",
45
+ className: i(s.datasetValuePercent, {
46
+ [s.offset]: n,
47
+ [s.stackable]: m
48
+ }),
49
+ children: [
50
+ e,
51
+ "%"
52
+ ]
53
+ }
54
+ )
55
+ ]
56
+ }
57
+ );
58
+ }
59
+ export {
60
+ j as default
61
+ };
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.tsx"],"sourcesContent":["'use client'\n\nimport { useState } from 'react'\nimport classNames from 'classnames'\nimport useResizeObserver from 'use-resize-observer'\nimport { getContrastYIQ, hexToRgb } from '../../../../../utils/get-contrast-yiq'\nimport { Text } from '../../../../../components/text'\nimport s from './style.module.css'\n\ninterface DatasetValueProps {\n\tvalue: number\n\thighestValue: number\n\tcolor: string\n\tstackable: boolean\n}\n\nexport default function DatasetValue({\n\tvalue,\n\thighestValue,\n\tcolor,\n\tstackable,\n}: DatasetValueProps) {\n\tconst [valueIsOffset, setValueIsOffset] = useState(false)\n\tconst { ref } = useResizeObserver<HTMLDivElement>({\n\t\tonResize: ({ width }) => {\n\t\t\t// If the value is 0, we want to show a 0.5% bar\n\t\t\tif (value === 0) {\n\t\t\t\tvalue = 0.5\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The logic below determines the threshold (in `px`)\n\t\t\t * a bar's width needs to reach for the value to be offset\n\t\t\t * by moving it to the right of the bar.\n\t\t\t *\n\t\t\t * The default below is for single-digit values.\n\t\t\t */\n\t\t\tlet offsetThreshold = 32\n\n\t\t\tif (value >= 10 && value <= 99) {\n\t\t\t\t// Offset threshold for 2 digit values\n\t\t\t\toffsetThreshold = 40\n\t\t\t} else if (value >= 100) {\n\t\t\t\t// Offset threshold for 3+ digit values\n\t\t\t\toffsetThreshold = 48\n\t\t\t}\n\n\t\t\tif (width && width < offsetThreshold) {\n\t\t\t\tsetValueIsOffset(true)\n\t\t\t} else {\n\t\t\t\tsetValueIsOffset(false)\n\t\t\t}\n\t\t},\n\t})\n\n\tconst valueColor = getContrastYIQ(hexToRgb(color))\n\n\t/**\n\t * The actual width of the bar, however, should be\n\t * a percentage of the highest value in the chart\n\t */\n\tconst percentageOfHighest = (value / highestValue) * 100\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames(s.datasetValue, s[valueColor])}\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\t'--width': percentageOfHighest,\n\t\t\t\t} as React.CSSProperties\n\t\t\t}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={s.datasetValueBar}\n\t\t\t\tstyle={\n\t\t\t\t\t{\n\t\t\t\t\t\t'--bar-background': color,\n\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Text.Body\n\t\t\t\ttag=\"span\"\n\t\t\t\tsize=\"200\"\n\t\t\t\tclassName={classNames(s.datasetValuePercent, {\n\t\t\t\t\t[s.offset]: valueIsOffset,\n\t\t\t\t\t[s.stackable]: stackable,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{value}%\n\t\t\t</Text.Body>\n\t\t</div>\n\t)\n}\n"],"names":["DatasetValue","value","highestValue","color","stackable","valueIsOffset","useState","useResizeObserver","offsetThreshold","width","setValueIsOffset","valueColor","getContrastYIQ","jsxs","ref","classNames","percentageOfHighest","jsx","Text"],"mappings":";;;;;;;;AAgBqC,SACpCA,EAAA;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AAAA,EACD,WAAAC;AACC,GAAA;AACA,QAAM,CAAAC,IAA4C,IAAAC,EAAA,EAAA,YACvC,IAAGC,EAAY;AAAA,IAExB,UAAI,YAAa,MAAA;AAChB,MAAAN,MAAQ,MACTA,IAAA;AAWA,UAAIO,IAAe;AAElB,MAAAP,KAAA,WAAkB,KACnBO,IAAoB,KAEnBP,KAAkB,QACnBO,IAAA,KAGCC,KAAAA,IAAiBD,IAClBE,EAAO,EAAA,IAEPA,EAAA,EAAA;AAAA,IAED;AAAA,EAED,CAAA,GAMMC,IAAAC,IAA+BT,CAAA,QAGpCF,IAAAC,IAAA;AAAA,SAAC,gBAAAW;AAAA,IAAA;AAAA,IAAA;AAAA,MAEA,KAAAC;AAAA,MACA,WACCC,EAAA,EAAA,cAAA,EAAAJ,CAAA,CAAA;AAAA,MAAA;QAEA,WAAAK;AAAA,MAGD;AAAA,MAAA,UAAA;AAAA,QAAC,gBAAAC;AAAA,UAAA;AAAA,UAAA;AAAA,YAEA,WACC,EAAA;AAAA,YAAA;cACqB,oBAAAd;AAAA,YACrB;AAAA,UAEF;AAAA,QAAA;AAAA,QACM,gBAAAU;AAAA,UAALK,EAAA;AAAA,UAAA;AAAA,YAEA;YACA;YAA6C,WACnCH,EAAG,EAAA,qBAAA;AAAA,cACZ,CAAC,EAAE,MAAA,GAASV;AAAA,cACZ,CAAA,EAAA,SAAA,GAAAD;AAAA,YAEA;YAAA,UAAA;AAAA,cAAMH;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACR;AAAA,MAAA;AAAA,IACD;AAAA,EAEF;;"}