@hashicorp/mds-react 0.9.2 → 0.9.4

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 (452) hide show
  1. package/components/accordion/index.d.ts +1 -1
  2. package/components/accordion/index.js +9 -0
  3. package/components/accordion/index.js.map +1 -0
  4. package/components/accordion/item/button.js +44 -0
  5. package/components/accordion/item/button.js.map +1 -0
  6. package/components/accordion/item/index.d.ts +1 -1
  7. package/components/accordion/item/index.js +59 -0
  8. package/components/accordion/item/index.js.map +1 -0
  9. package/components/accordion/style.module.scss.js +24 -0
  10. package/components/accordion/style.module.scss.js.map +1 -0
  11. package/components/alert/alert.module.scss.js +29 -0
  12. package/components/alert/alert.module.scss.js.map +1 -0
  13. package/components/alert/icon.d.ts +2 -2
  14. package/components/alert/icon.js +34 -0
  15. package/components/alert/icon.js.map +1 -0
  16. package/components/alert/index.d.ts +6 -6
  17. package/components/alert/index.js +97 -0
  18. package/components/alert/index.js.map +1 -0
  19. package/components/badge/index.d.ts +1 -1
  20. package/components/badge/index.js +50 -0
  21. package/components/badge/index.js.map +1 -0
  22. package/components/badge/style.module.scss.js +22 -0
  23. package/components/badge/style.module.scss.js.map +1 -0
  24. package/components/badge-count/index.d.ts +1 -1
  25. package/components/badge-count/index.js +29 -0
  26. package/components/badge-count/index.js.map +1 -0
  27. package/components/badge-count/style.module.scss.js +15 -0
  28. package/components/badge-count/style.module.scss.js.map +1 -0
  29. package/components/breadcrumbs/index.d.ts +2 -2
  30. package/components/breadcrumbs/index.js +38 -0
  31. package/components/breadcrumbs/index.js.map +1 -0
  32. package/components/breadcrumbs/item/index.d.ts +1 -1
  33. package/components/breadcrumbs/item/index.js +32 -0
  34. package/components/breadcrumbs/item/index.js.map +1 -0
  35. package/components/breadcrumbs/style.module.scss.js +27 -0
  36. package/components/breadcrumbs/style.module.scss.js.map +1 -0
  37. package/components/breadcrumbs/truncation-button/index.d.ts +1 -1
  38. package/components/breadcrumbs/truncation-button/index.js +25 -0
  39. package/components/breadcrumbs/truncation-button/index.js.map +1 -0
  40. package/components/breadcrumbs/types/index.d.ts +1 -1
  41. package/components/button/index.d.ts +4 -3
  42. package/components/button/index.js +119 -0
  43. package/components/button/index.js.map +1 -0
  44. package/components/button/styles.module.scss.js +32 -0
  45. package/components/button/styles.module.scss.js.map +1 -0
  46. package/components/card/card-thumbnail/card-thumbnail.module.css.js +8 -0
  47. package/components/card/card-thumbnail/card-thumbnail.module.css.js.map +1 -0
  48. package/components/card/card-thumbnail/index.d.ts +1 -1
  49. package/components/card/card-thumbnail/index.js +23 -0
  50. package/components/card/card-thumbnail/index.js.map +1 -0
  51. package/components/card/index.d.ts +3 -2
  52. package/components/card/index.js +160 -0
  53. package/components/card/index.js.map +1 -0
  54. package/components/card/styles.module.css.js +29 -0
  55. package/components/card/styles.module.css.js.map +1 -0
  56. package/components/card/types.d.ts +4 -3
  57. package/components/code-block/code-block.module.scss.js +34 -0
  58. package/components/code-block/code-block.module.scss.js.map +1 -0
  59. package/components/code-block/code-lines/index.d.ts +1 -8
  60. package/components/code-block/code-lines/index.js +59 -0
  61. package/components/code-block/code-lines/index.js.map +1 -0
  62. package/components/code-block/code-lines/utils/split-html-into-lines.d.ts +1 -1
  63. package/components/code-block/code-lines/utils/split-html-into-lines.js +19 -0
  64. package/components/code-block/code-lines/utils/split-html-into-lines.js.map +1 -0
  65. package/components/code-block/code-lines/utils/split-jsx-into-lines.d.ts +1 -1
  66. package/components/code-block/code-lines/utils/split-jsx-into-lines.js +31 -0
  67. package/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -0
  68. package/components/code-block/hidden-copy-content/index.d.ts +3 -3
  69. package/components/code-block/hidden-copy-content/index.js +13 -0
  70. package/components/code-block/hidden-copy-content/index.js.map +1 -0
  71. package/components/code-block/index.d.ts +1 -1
  72. package/components/code-block/index.js +88 -0
  73. package/components/code-block/index.js.map +1 -0
  74. package/components/code-block/utils/parse-highlighted-lines.js +39 -0
  75. package/components/code-block/utils/parse-highlighted-lines.js.map +1 -0
  76. package/components/code-block/utils/process-snippet.js +20 -0
  77. package/components/code-block/utils/process-snippet.js.map +1 -0
  78. package/components/code-block/utils/shellwords.js +33 -0
  79. package/components/code-block/utils/shellwords.js.map +1 -0
  80. package/components/combo-box-primitive/index.d.ts +1 -0
  81. package/components/combo-box-primitive/index.js +302 -0
  82. package/components/combo-box-primitive/index.js.map +1 -0
  83. package/components/dialog-primitive/dialog.module.scss.js +12 -0
  84. package/components/dialog-primitive/dialog.module.scss.js.map +1 -0
  85. package/components/dialog-primitive/index.d.ts +1 -1
  86. package/components/dialog-primitive/index.js +15 -0
  87. package/components/dialog-primitive/index.js.map +1 -0
  88. package/components/disclosure-primitive/index.d.ts +1 -2
  89. package/components/disclosure-primitive/index.js +57 -0
  90. package/components/disclosure-primitive/index.js.map +1 -0
  91. package/components/disclosure-primitive/styles.module.css.js +7 -0
  92. package/components/disclosure-primitive/styles.module.css.js.map +1 -0
  93. package/components/disclosure-primitive/use-disclosure-primitive.d.ts +2 -2
  94. package/components/disclosure-primitive/use-disclosure-primitive.js +17 -0
  95. package/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -0
  96. package/components/dismiss-button/index.d.ts +1 -0
  97. package/components/dismiss-button/index.js +22 -0
  98. package/components/dismiss-button/index.js.map +1 -0
  99. package/components/dismiss-button/styles.module.scss.js +7 -0
  100. package/components/dismiss-button/styles.module.scss.js.map +1 -0
  101. package/components/dropdown/index.d.ts +6 -6
  102. package/components/dropdown/index.js +79 -0
  103. package/components/dropdown/index.js.map +1 -0
  104. package/components/dropdown/list-item/custom.d.ts +1 -1
  105. package/components/dropdown/list-item/custom.js +9 -0
  106. package/components/dropdown/list-item/custom.js.map +1 -0
  107. package/components/dropdown/list-item/index.d.ts +4 -4
  108. package/components/dropdown/list-item/index.js +14 -0
  109. package/components/dropdown/list-item/index.js.map +1 -0
  110. package/components/dropdown/list-item/interactive.d.ts +1 -1
  111. package/components/dropdown/list-item/interactive.js +49 -0
  112. package/components/dropdown/list-item/interactive.js.map +1 -0
  113. package/components/dropdown/list-item/separator.d.ts +1 -1
  114. package/components/dropdown/list-item/separator.js +17 -0
  115. package/components/dropdown/list-item/separator.js.map +1 -0
  116. package/components/dropdown/list-item/styles.module.css.js +26 -0
  117. package/components/dropdown/list-item/styles.module.css.js.map +1 -0
  118. package/components/dropdown/list-item/title.d.ts +1 -1
  119. package/components/dropdown/list-item/title.js +9 -0
  120. package/components/dropdown/list-item/title.js.map +1 -0
  121. package/components/dropdown/styles.module.css.js +24 -0
  122. package/components/dropdown/styles.module.css.js.map +1 -0
  123. package/components/dropdown/toggle-button/index.d.ts +2 -2
  124. package/components/dropdown/toggle-button/index.js +54 -0
  125. package/components/dropdown/toggle-button/index.js.map +1 -0
  126. package/components/dropdown/toggle-button/styles.module.scss.js +14 -0
  127. package/components/dropdown/toggle-button/styles.module.scss.js.map +1 -0
  128. package/components/flight-icon/flight-icon.module.css.js +12 -0
  129. package/components/flight-icon/flight-icon.module.css.js.map +1 -0
  130. package/components/flight-icon/index.d.ts +2 -2
  131. package/components/flight-icon/index.js +58 -0
  132. package/components/flight-icon/index.js.map +1 -0
  133. package/components/form/checkbox/form-checkbox.module.css.js +8 -0
  134. package/components/form/checkbox/form-checkbox.module.css.js.map +1 -0
  135. package/components/form/checkbox/index.d.ts +1 -1
  136. package/components/form/checkbox/index.js +109 -0
  137. package/components/form/checkbox/index.js.map +1 -0
  138. package/components/form/error/form-error.module.css.js +14 -0
  139. package/components/form/error/form-error.module.css.js.map +1 -0
  140. package/components/form/error/index.d.ts +1 -1
  141. package/components/form/error/index.js +22 -0
  142. package/components/form/error/index.js.map +1 -0
  143. package/components/form/field/form-field.module.css.js +17 -0
  144. package/components/form/field/form-field.module.css.js.map +1 -0
  145. package/components/form/field/index.d.ts +1 -1
  146. package/components/form/field/index.js +46 -0
  147. package/components/form/field/index.js.map +1 -0
  148. package/components/form/fieldset/form-fieldset.module.css.js +19 -0
  149. package/components/form/fieldset/form-fieldset.module.css.js.map +1 -0
  150. package/components/form/fieldset/index.d.ts +1 -1
  151. package/components/form/fieldset/index.js +65 -0
  152. package/components/form/fieldset/index.js.map +1 -0
  153. package/components/form/file-input/form-file-input.module.scss.js +7 -0
  154. package/components/form/file-input/form-file-input.module.scss.js.map +1 -0
  155. package/components/form/file-input/index.d.ts +1 -1
  156. package/components/form/file-input/index.js +68 -0
  157. package/components/form/file-input/index.js.map +1 -0
  158. package/components/form/helper-text/form-helper-text.module.css.js +7 -0
  159. package/components/form/helper-text/form-helper-text.module.css.js.map +1 -0
  160. package/components/form/helper-text/index.d.ts +1 -1
  161. package/components/form/helper-text/index.js +22 -0
  162. package/components/form/helper-text/index.js.map +1 -0
  163. package/components/form/indicator/form-indicator.module.css.js +8 -0
  164. package/components/form/indicator/form-indicator.module.css.js.map +1 -0
  165. package/components/form/indicator/index.js +23 -0
  166. package/components/form/indicator/index.js.map +1 -0
  167. package/components/form/label/form-label.module.css.js +10 -0
  168. package/components/form/label/form-label.module.css.js.map +1 -0
  169. package/components/form/label/index.d.ts +1 -1
  170. package/components/form/label/index.js +33 -0
  171. package/components/form/label/index.js.map +1 -0
  172. package/components/form/legend/form-legend.module.css.js +10 -0
  173. package/components/form/legend/form-legend.module.css.js.map +1 -0
  174. package/components/form/legend/index.d.ts +1 -1
  175. package/components/form/legend/index.js +19 -0
  176. package/components/form/legend/index.js.map +1 -0
  177. package/components/form/radio/form-radio.module.scss.js +8 -0
  178. package/components/form/radio/form-radio.module.scss.js.map +1 -0
  179. package/components/form/radio/index.d.ts +1 -1
  180. package/components/form/radio/index.js +100 -0
  181. package/components/form/radio/index.js.map +1 -0
  182. package/components/form/radio-card/description.js +10 -0
  183. package/components/form/radio-card/description.js.map +1 -0
  184. package/components/form/radio-card/form-radio-card.module.css.js +30 -0
  185. package/components/form/radio-card/form-radio-card.module.css.js.map +1 -0
  186. package/components/form/radio-card/group.d.ts +1 -1
  187. package/components/form/radio-card/group.js +31 -0
  188. package/components/form/radio-card/group.js.map +1 -0
  189. package/components/form/radio-card/index.d.ts +2 -2
  190. package/components/form/radio-card/index.js +67 -0
  191. package/components/form/radio-card/index.js.map +1 -0
  192. package/components/form/radio-card/label.js +10 -0
  193. package/components/form/radio-card/label.js.map +1 -0
  194. package/components/form/select/form-select.module.css.js +14 -0
  195. package/components/form/select/form-select.module.css.js.map +1 -0
  196. package/components/form/select/index.d.ts +1 -1
  197. package/components/form/select/index.js +79 -0
  198. package/components/form/select/index.js.map +1 -0
  199. package/components/form/super-select/form-super-select.module.css.js +22 -0
  200. package/components/form/super-select/form-super-select.module.css.js.map +1 -0
  201. package/components/form/super-select/index.d.ts +2 -2
  202. package/components/form/super-select/index.js +170 -0
  203. package/components/form/super-select/index.js.map +1 -0
  204. package/components/form/text-input/index.d.ts +1 -1
  205. package/components/form/text-input/index.js +91 -0
  206. package/components/form/text-input/index.js.map +1 -0
  207. package/components/form/text-input/styles.module.css.js +15 -0
  208. package/components/form/text-input/styles.module.css.js.map +1 -0
  209. package/components/form/textarea/form-textarea.module.css.js +14 -0
  210. package/components/form/textarea/form-textarea.module.css.js.map +1 -0
  211. package/components/form/textarea/index.d.ts +1 -1
  212. package/components/form/textarea/index.js +74 -0
  213. package/components/form/textarea/index.js.map +1 -0
  214. package/components/form/toggle/form-toggle.module.scss.js +12 -0
  215. package/components/form/toggle/form-toggle.module.scss.js.map +1 -0
  216. package/components/form/toggle/index.d.ts +1 -1
  217. package/components/form/toggle/index.js +102 -0
  218. package/components/form/toggle/index.js.map +1 -0
  219. package/components/hds/wrappers/tooltip.d.ts +3 -4
  220. package/components/hds/wrappers/tooltip.js +51 -0
  221. package/components/hds/wrappers/tooltip.js.map +1 -0
  222. package/components/icon-tile/index.d.ts +1 -1
  223. package/components/icon-tile/index.js +50 -0
  224. package/components/icon-tile/index.js.map +1 -0
  225. package/components/icon-tile/style.module.scss.js +29 -0
  226. package/components/icon-tile/style.module.scss.js.map +1 -0
  227. package/components/index.d.ts +1 -1
  228. package/components/index.js +116 -73
  229. package/components/index.js.map +1 -1
  230. package/components/inline-link/index.d.ts +1 -1
  231. package/components/inline-link/index.js +33 -0
  232. package/components/inline-link/index.js.map +1 -0
  233. package/components/inline-link/inline-link.module.css.js +11 -0
  234. package/components/inline-link/inline-link.module.css.js.map +1 -0
  235. package/components/interactive/index.d.ts +3 -4
  236. package/components/interactive/index.js +59 -0
  237. package/components/interactive/index.js.map +1 -0
  238. package/components/legacy-button/index.d.ts +3 -3
  239. package/components/legacy-button/index.js +65 -0
  240. package/components/legacy-button/index.js.map +1 -0
  241. package/components/legacy-button/types.d.ts +1 -1
  242. package/components/legacy-button/utils.d.ts +1 -1
  243. package/components/legacy-button/utils.js +39 -0
  244. package/components/legacy-button/utils.js.map +1 -0
  245. package/components/menu-primitive/index.d.ts +1 -1
  246. package/components/menu-primitive/index.js +68 -0
  247. package/components/menu-primitive/index.js.map +1 -0
  248. package/components/menu-primitive/styles.module.css.js +12 -0
  249. package/components/menu-primitive/styles.module.css.js.map +1 -0
  250. package/components/menu-primitive/use-menu-primitive.d.ts +2 -2
  251. package/components/menu-primitive/use-menu-primitive.js +17 -0
  252. package/components/menu-primitive/use-menu-primitive.js.map +1 -0
  253. package/components/modal/index.d.ts +1 -1
  254. package/components/modal/index.js +61 -0
  255. package/components/modal/index.js.map +1 -0
  256. package/components/modal/modal.module.css.js +8 -0
  257. package/components/modal/modal.module.css.js.map +1 -0
  258. package/components/modal/use-modal.d.ts +2 -2
  259. package/components/modal/use-modal.js +17 -0
  260. package/components/modal/use-modal.js.map +1 -0
  261. package/components/separator/index.d.ts +1 -1
  262. package/components/separator/index.js +15 -0
  263. package/components/separator/index.js.map +1 -0
  264. package/components/separator/separator.module.css.js +10 -0
  265. package/components/separator/separator.module.css.js.map +1 -0
  266. package/components/standalone-link/index.d.ts +2 -2
  267. package/components/standalone-link/index.js +54 -0
  268. package/components/standalone-link/index.js.map +1 -0
  269. package/components/standalone-link/styles.module.scss.js +17 -0
  270. package/components/standalone-link/styles.module.scss.js.map +1 -0
  271. package/components/table/index.d.ts +5 -5
  272. package/components/table/index.js +52 -0
  273. package/components/table/index.js.map +1 -0
  274. package/components/table/table.module.scss.js +33 -0
  275. package/components/table/table.module.scss.js.map +1 -0
  276. package/components/table/td.d.ts +2 -2
  277. package/components/table/td.js +28 -0
  278. package/components/table/td.js.map +1 -0
  279. package/components/table/th-button-tooltip.js +24 -0
  280. package/components/table/th-button-tooltip.js.map +1 -0
  281. package/components/table/th.d.ts +2 -2
  282. package/components/table/th.js +43 -0
  283. package/components/table/th.js.map +1 -0
  284. package/components/table/tr.d.ts +1 -1
  285. package/components/table/tr.js +9 -0
  286. package/components/table/tr.js.map +1 -0
  287. package/components/table/utils.js +28 -0
  288. package/components/table/utils.js.map +1 -0
  289. package/components/tabs/index.d.ts +3 -3
  290. package/components/tabs/index.js +117 -0
  291. package/components/tabs/index.js.map +1 -0
  292. package/components/tabs/tab-panel.d.ts +1 -1
  293. package/components/tabs/tab-panel.js +35 -0
  294. package/components/tabs/tab-panel.js.map +1 -0
  295. package/components/tabs/tab.d.ts +2 -2
  296. package/components/tabs/tab.js +70 -0
  297. package/components/tabs/tab.js.map +1 -0
  298. package/components/tabs/tabs.module.scss.js +22 -0
  299. package/components/tabs/tabs.module.scss.js.map +1 -0
  300. package/components/tabs/use-tabs-context.d.ts +2 -2
  301. package/components/tabs/use-tabs-context.js +16 -0
  302. package/components/tabs/use-tabs-context.js.map +1 -0
  303. package/components/text/index.d.ts +6 -6
  304. package/components/text/index.js +112 -0
  305. package/components/text/index.js.map +1 -0
  306. package/components/text/style.module.scss.js +9 -0
  307. package/components/text/style.module.scss.js.map +1 -0
  308. package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +62 -0
  309. package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -0
  310. package/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js +20 -0
  311. package/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js.map +1 -0
  312. package/components/visualizations/bar-chart/horizontal-chart/index.d.ts +1 -0
  313. package/components/visualizations/bar-chart/horizontal-chart/index.js +104 -0
  314. package/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -0
  315. package/components/visualizations/bar-chart/horizontal-chart/legend/index.js +13 -0
  316. package/components/visualizations/bar-chart/horizontal-chart/legend/index.js.map +1 -0
  317. package/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js +14 -0
  318. package/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js.map +1 -0
  319. package/components/visualizations/bar-chart/horizontal-chart/style.module.css.js +28 -0
  320. package/components/visualizations/bar-chart/horizontal-chart/style.module.css.js.map +1 -0
  321. package/components/visualizations/bar-chart/index.d.ts +1 -1
  322. package/components/visualizations/bar-chart/index.js +37 -0
  323. package/components/visualizations/bar-chart/index.js.map +1 -0
  324. package/components/visualizations/bar-chart/style.module.css.js +12 -0
  325. package/components/visualizations/bar-chart/style.module.css.js.map +1 -0
  326. package/components/visualizations/donut-chart/components/arc-tooltip/index.d.ts +2 -2
  327. package/components/visualizations/donut-chart/components/arc-tooltip/index.js +14 -0
  328. package/components/visualizations/donut-chart/components/arc-tooltip/index.js.map +1 -0
  329. package/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js +10 -0
  330. package/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js.map +1 -0
  331. package/components/visualizations/donut-chart/components/external-arc-label/index.d.ts +2 -2
  332. package/components/visualizations/donut-chart/components/external-arc-label/index.js +58 -0
  333. package/components/visualizations/donut-chart/components/external-arc-label/index.js.map +1 -0
  334. package/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js +16 -0
  335. package/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js.map +1 -0
  336. package/components/visualizations/donut-chart/components/internal-arc-label/index.d.ts +2 -2
  337. package/components/visualizations/donut-chart/components/internal-arc-label/index.js +42 -0
  338. package/components/visualizations/donut-chart/components/internal-arc-label/index.js.map +1 -0
  339. package/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js +14 -0
  340. package/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js.map +1 -0
  341. package/components/visualizations/donut-chart/index.d.ts +1 -1
  342. package/components/visualizations/donut-chart/index.js +90 -0
  343. package/components/visualizations/donut-chart/index.js.map +1 -0
  344. package/components/visualizations/donut-chart/styles.module.css.js +20 -0
  345. package/components/visualizations/donut-chart/styles.module.css.js.map +1 -0
  346. package/hooks/use-media-query/index.js +16 -0
  347. package/hooks/use-media-query/index.js.map +1 -0
  348. package/index.js +155 -101
  349. package/index.js.map +1 -1
  350. package/package.json +1 -1
  351. package/patterns/card/newsroom-card/index.d.ts +1 -1
  352. package/patterns/card/newsroom-card/index.js +26 -0
  353. package/patterns/card/newsroom-card/index.js.map +1 -0
  354. package/patterns/card/newsroom-card/style.module.css.js +8 -0
  355. package/patterns/card/newsroom-card/style.module.css.js.map +1 -0
  356. package/patterns/card/partner-card/index.d.ts +2 -2
  357. package/patterns/card/partner-card/index.js +42 -0
  358. package/patterns/card/partner-card/index.js.map +1 -0
  359. package/patterns/card/partner-card/style.module.css.js +12 -0
  360. package/patterns/card/partner-card/style.module.css.js.map +1 -0
  361. package/patterns/card/person-card/index.d.ts +1 -1
  362. package/patterns/card/person-card/index.js +52 -0
  363. package/patterns/card/person-card/index.js.map +1 -0
  364. package/patterns/card/person-card/style.module.css.js +12 -0
  365. package/patterns/card/person-card/style.module.css.js.map +1 -0
  366. package/patterns/card/primitives.d.ts +5 -5
  367. package/patterns/card/primitives.js +77 -0
  368. package/patterns/card/primitives.js.map +1 -0
  369. package/patterns/card/promo-card/index.d.ts +1 -1
  370. package/patterns/card/promo-card/index.js +36 -0
  371. package/patterns/card/promo-card/index.js.map +1 -0
  372. package/patterns/card/resource-card/index.d.ts +1 -1
  373. package/patterns/card/resource-card/index.js +26 -0
  374. package/patterns/card/resource-card/index.js.map +1 -0
  375. package/patterns/card/style.module.css.js +30 -0
  376. package/patterns/card/style.module.css.js.map +1 -0
  377. package/patterns/card/thumbnails/index.d.ts +1 -1
  378. package/patterns/card/thumbnails/index.js +25 -0
  379. package/patterns/card/thumbnails/index.js.map +1 -0
  380. package/patterns/card/types.d.ts +6 -6
  381. package/patterns/card/unified-card/index.d.ts +1 -1
  382. package/patterns/card/unified-card/index.js +37 -0
  383. package/patterns/card/unified-card/index.js.map +1 -0
  384. package/patterns/copy-button/clipboard.d.ts +1 -1
  385. package/patterns/copy-button/clipboard.js +78 -0
  386. package/patterns/copy-button/clipboard.js.map +1 -0
  387. package/patterns/copy-button/index.d.ts +1 -1
  388. package/patterns/copy-button/index.js +57 -0
  389. package/patterns/copy-button/index.js.map +1 -0
  390. package/patterns/copy-button/style.module.css.js +13 -0
  391. package/patterns/copy-button/style.module.css.js.map +1 -0
  392. package/patterns/index.js +32 -22
  393. package/patterns/index.js.map +1 -1
  394. package/patterns/layout/index.d.ts +20 -20
  395. package/patterns/layout/index.js +47 -0
  396. package/patterns/layout/index.js.map +1 -0
  397. package/patterns/layout/layout.module.css.js +20 -0
  398. package/patterns/layout/layout.module.css.js.map +1 -0
  399. package/patterns/product-badge/index.js +22 -0
  400. package/patterns/product-badge/index.js.map +1 -0
  401. package/patterns/product-badge/style.module.css.js +8 -0
  402. package/patterns/product-badge/style.module.css.js.map +1 -0
  403. package/patterns/product-logo/index.d.ts +15 -15
  404. package/patterns/product-logo/index.js +130 -0
  405. package/patterns/product-logo/index.js.map +1 -0
  406. package/patterns/product-logo/product-logo.module.css.js +13 -0
  407. package/patterns/product-logo/product-logo.module.css.js.map +1 -0
  408. package/patterns/related-content/index.d.ts +1 -1
  409. package/patterns/related-content/index.js +65 -0
  410. package/patterns/related-content/index.js.map +1 -0
  411. package/patterns/related-content/style.module.css.js +22 -0
  412. package/patterns/related-content/style.module.css.js.map +1 -0
  413. package/patterns/related-content/types.d.ts +1 -1
  414. package/style.css +1 -1
  415. package/styles/mixins/button.scss +1 -6
  416. package/utils/get-contrast-yiq.js +13 -0
  417. package/utils/get-contrast-yiq.js.map +1 -0
  418. package/utils/hooks/use-screen-size.js +10 -0
  419. package/utils/hooks/use-screen-size.js.map +1 -0
  420. package/utils/i18n/constants/index.js +98 -0
  421. package/utils/i18n/constants/index.js.map +1 -0
  422. package/utils/i18n/helpers/locale-provider.js +9 -0
  423. package/utils/i18n/helpers/locale-provider.js.map +1 -0
  424. package/utils/i18n/helpers/to-smart-sentence-case.js +12 -0
  425. package/utils/i18n/helpers/to-smart-sentence-case.js.map +1 -0
  426. package/utils/i18n/helpers/to-smart-title-case.js +10 -0
  427. package/utils/i18n/helpers/to-smart-title-case.js.map +1 -0
  428. package/utils/i18n/helpers/use-locale.js +14 -0
  429. package/utils/i18n/helpers/use-locale.js.map +1 -0
  430. package/utils/i18n/index.d.ts +1 -1
  431. package/utils/i18n/index.js +41 -0
  432. package/utils/i18n/index.js.map +1 -0
  433. package/utils/i18n/index2.js +33 -0
  434. package/utils/i18n/index2.js.map +1 -0
  435. package/utils/index.js +7 -7
  436. package/utils/make-normalizer/index.d.ts +6 -6
  437. package/utils/make-normalizer/index.js +34 -0
  438. package/utils/make-normalizer/index.js.map +1 -0
  439. package/utils/mds-context/index.d.ts +1 -1
  440. package/{index-DBjAbGt7.js → utils/mds-context/index.js} +20 -19
  441. package/utils/mds-context/index.js.map +1 -0
  442. package/index-B9mPJh9w.js +0 -579
  443. package/index-B9mPJh9w.js.map +0 -1
  444. package/index-BHBlMMNF.js +0 -16
  445. package/index-BHBlMMNF.js.map +0 -1
  446. package/index-C4GBbW3N.js +0 -3567
  447. package/index-C4GBbW3N.js.map +0 -1
  448. package/index-DBjAbGt7.js.map +0 -1
  449. package/index-WkGIywHj.js +0 -767
  450. package/index-WkGIywHj.js.map +0 -1
  451. package/use-screen-size-BOnkX_K-.js +0 -9
  452. package/use-screen-size-BOnkX_K-.js.map +0 -1
package/index-C4GBbW3N.js DELETED
@@ -1,3567 +0,0 @@
1
- import { jsx as o, Fragment as te, jsxs as g } from "react/jsx-runtime";
2
- import p from "classnames";
3
- import { createContext as de, useContext as ue, useState as k, useId as v, useEffect as F, useCallback as b, useMemo as V, useRef as A, Children as mn, forwardRef as ht, createElement as hn } from "react";
4
- import { h as T, T as X, d as gt, S as _t, n as gn, c as $e, I as ft } from "./index-WkGIywHj.js";
5
- import { u as _n } from "./index-DBjAbGt7.js";
6
- import { IconMoreHorizontal16 as fn } from "@hashicorp/flight-icons/svg-react/more-horizontal-16";
7
- import { IconAlertDiamondFill16 as yn } from "@hashicorp/flight-icons/svg-react/alert-diamond-fill-16";
8
- import bn from "react-focus-lock";
9
- import vn from "@tippyjs/react";
10
- import { followCursor as Nn } from "tippy.js";
11
- import "tippy.js/dist/svg-arrow.css";
12
- import wn from "react-wrap-balancer";
13
- import yt from "use-resize-observer";
14
- import { u as In } from "./index-BHBlMMNF.js";
15
- import { ResponsivePie as xn } from "@nivo/pie";
16
- import { animated as be } from "@react-spring/web";
17
- const Cn = "accordion__tWR7C", kn = "item__MYeus", Ln = "toggle__cD-PM", $n = "button__e63te", Tn = "icon__xZL-n", Sn = "content__RNHA7", R = {
18
- accordion: Cn,
19
- item: kn,
20
- "does-not-contain-interactive": "does-not-contain-interactive__9u5oz",
21
- "contains-interactive": "contains-interactive__7-Y60",
22
- toggle: Ln,
23
- button: $n,
24
- icon: Tn,
25
- "icon-rotate": "icon-rotate__OTQtF",
26
- "parent-does-not-contain-interactive": "parent-does-not-contain-interactive__H4GPb",
27
- "parent-contains-interactive": "parent-contains-interactive__FGVlz",
28
- "toggle-content": "toggle-content__6cjUu",
29
- content: Sn
30
- }, Ve = de(void 0);
31
- Ve.displayName = "DisclosurePrimitiveContext";
32
- function Me() {
33
- const e = ue(Ve);
34
- if (e === void 0)
35
- throw new Error(
36
- "useDisclosurePrimitive must be used within a DisclosurePrimitiveContext.Provider"
37
- );
38
- return e;
39
- }
40
- const En = {
41
- "disclosure-primitive": "disclosure-primitive__v-DS4"
42
- }, Bn = ({
43
- onClose: e,
44
- children: t,
45
- className: n,
46
- trackedIsOpen: s = !1,
47
- containsInteractive: r = !1,
48
- ariaLabel: a = "Toggle display",
49
- ...i
50
- }) => {
51
- const [d, l] = k(s), c = "content-" + v();
52
- F(() => {
53
- l(s);
54
- }, [s]);
55
- const u = b(() => {
56
- l(!1), e && e();
57
- }, [l, e]), h = b(() => {
58
- l((_) => !_);
59
- }, [l]), m = V(
60
- () => ({
61
- isOpen: d,
62
- onClickToggle: h,
63
- closeDisclosure: u,
64
- contentId: c,
65
- containsInteractive: r,
66
- ariaLabel: a
67
- }),
68
- [
69
- d,
70
- h,
71
- u,
72
- c,
73
- r,
74
- a
75
- ]
76
- );
77
- return /* @__PURE__ */ o(Ve.Provider, { value: m, children: /* @__PURE__ */ o(
78
- "div",
79
- {
80
- className: p(En["disclosure-primitive"], n),
81
- ...i,
82
- children: t
83
- }
84
- ) });
85
- }, An = ({ children: e }) => {
86
- const { isOpen: t } = Me();
87
- return t ? /* @__PURE__ */ o(te, { children: e }) : null;
88
- }, bt = { Provider: Bn, Content: An }, Pn = ({ anchorId: e, updateUrl: t }) => {
89
- const {
90
- onClickToggle: n,
91
- isOpen: s,
92
- contentId: r,
93
- containsInteractive: a,
94
- ariaLabel: i
95
- } = Me(), d = (l) => {
96
- n(l), !(!t || !e) && (s ? history.replaceState(null, "", window.location.pathname) : history.replaceState(null, "", `#${e}`));
97
- };
98
- return /* @__PURE__ */ o(
99
- "button",
100
- {
101
- type: "button",
102
- className: p(R.button, {
103
- [R["parent-contains-interactive"]]: a,
104
- [R["parent-does-not-contain-interactive"]]: !a
105
- }),
106
- onClick: d,
107
- "aria-controls": r,
108
- "aria-expanded": s,
109
- "aria-label": i,
110
- children: /* @__PURE__ */ o(
111
- T,
112
- {
113
- name: "chevron-down",
114
- size: 24,
115
- isInlineBlock: !1,
116
- className: p(R.icon, { [R["icon-rotate"]]: s })
117
- }
118
- )
119
- }
120
- );
121
- }, Fn = ({
122
- children: e,
123
- containsInteractive: t,
124
- isOpen: n,
125
- ariaLabel: s = "Toggle display",
126
- ...r
127
- }) => /* @__PURE__ */ o(
128
- bt.Provider,
129
- {
130
- className: p(R.item, {
131
- [R["contains-interactive"]]: t,
132
- [R["does-not-contain-interactive"]]: !t
133
- }),
134
- trackedIsOpen: n,
135
- containsInteractive: t,
136
- ariaLabel: s,
137
- ...r,
138
- children: e
139
- }
140
- );
141
- Fn.displayName = "AccordionItem";
142
- const On = ({
143
- children: e,
144
- anchorId: t,
145
- updateUrl: n
146
- }) => /* @__PURE__ */ g("div", { className: R.toggle, children: [
147
- /* @__PURE__ */ o(Pn, { anchorId: t ?? "", updateUrl: n }),
148
- /* @__PURE__ */ o("div", { className: p(R["toggle-content"]), children: /* @__PURE__ */ o(X.Body, { weight: "semibold", children: e }) })
149
- ] });
150
- On.displayName = "AccordionToggle";
151
- const Dn = ({ children: e }) => {
152
- const { contentId: t } = Me();
153
- return /* @__PURE__ */ o(bt.Content, { children: /* @__PURE__ */ o(
154
- "div",
155
- {
156
- className: p(
157
- R.content,
158
- "mds-typography-legacy-body-200 mds-foreground-primary"
159
- ),
160
- id: t,
161
- children: e
162
- }
163
- ) });
164
- };
165
- Dn.displayName = "AccordionContent";
166
- const zn = ({ children: e, className: t, ...n }) => /* @__PURE__ */ o("div", { className: p(R.accordion, t), ...n, children: e });
167
- zn.displayName = "Accordion";
168
- const Ie = {
169
- "badge-count": "badge-count__9xA6z",
170
- "size-small": "size-small__LxiPj",
171
- "size-medium": "size-medium__emKOI",
172
- "size-large": "size-large__M7RFP",
173
- "color-neutral": "color-neutral__j2CVd",
174
- "type-filled": "type-filled__tb7Yx",
175
- "type-inverted": "type-inverted__Oc-mV",
176
- "type-outlined": "type-outlined__V714E",
177
- "color-neutral-dark-mode": "color-neutral-dark-mode__LLW-g"
178
- }, He = ({
179
- text: e,
180
- size: t = "medium",
181
- type: n = "filled",
182
- color: s = "neutral",
183
- className: r,
184
- ...a
185
- }) => /* @__PURE__ */ o(
186
- "div",
187
- {
188
- className: p(
189
- Ie["badge-count"],
190
- Ie[`size-${t}`],
191
- Ie[`type-${n}`],
192
- Ie[`color-${s}`],
193
- r
194
- ),
195
- ...a,
196
- children: e
197
- }
198
- );
199
- He.displayName = "BadgeCount";
200
- const Rn = {
201
- "dismiss-button": "dismiss-button__Asa3H"
202
- }, vt = ({
203
- ariaLabel: e = "Dismiss",
204
- onClick: t,
205
- className: n
206
- }) => /* @__PURE__ */ o(
207
- "button",
208
- {
209
- className: p(Rn["dismiss-button"], n),
210
- type: "button",
211
- "aria-label": e,
212
- onClick: t,
213
- children: /* @__PURE__ */ o(T, { size: 16, name: "x" })
214
- }
215
- ), Vn = "alert__j7ZRS", Mn = "icon__vbZHd", Hn = "content__0FEM2", Gn = "text__qorMN", Wn = "description__PMywu", Kn = "actions__vQ07y", Un = "title__MWel2", M = {
216
- alert: Vn,
217
- icon: Mn,
218
- "type-compact": "type-compact__ptTlw",
219
- content: Hn,
220
- text: Gn,
221
- description: Wn,
222
- actions: Kn,
223
- "dismiss-button-wrapper": "dismiss-button-wrapper__vcfJ-",
224
- "type-page": "type-page__tP9-W",
225
- "type-inline": "type-inline__7sxYA",
226
- title: Un,
227
- "color-neutral": "color-neutral__x4pkI",
228
- "color-highlight": "color-highlight__64nTZ",
229
- "color-success": "color-success__UMfyG",
230
- "color-warning": "color-warning__V1hfX",
231
- "color-critical": "color-critical__3hs0B"
232
- }, Qe = {
233
- neutral: {
234
- compact: "info-fill",
235
- default: "info"
236
- },
237
- highlight: {
238
- compact: "info-fill",
239
- default: "info"
240
- },
241
- success: {
242
- compact: "check-circle-fill",
243
- default: "check-circle"
244
- },
245
- warning: {
246
- compact: "alert-triangle-fill",
247
- default: "alert-triangle"
248
- },
249
- critical: {
250
- compact: "alert-diamond-fill",
251
- default: "alert-diamond"
252
- }
253
- }, jn = ({ icon: e, type: t, color: n }) => {
254
- if (e === !1)
255
- return null;
256
- const s = t === "compact" ? Qe[n].compact : Qe[n].default, r = e ?? s;
257
- return /* @__PURE__ */ o("div", { className: M.icon, children: /* @__PURE__ */ o(T, { name: r, stretched: !0 }) });
258
- }, qn = ({
259
- type: e,
260
- color: t = "neutral",
261
- icon: n,
262
- onDismiss: s,
263
- title: r,
264
- description: a,
265
- children: i,
266
- role: d,
267
- className: l,
268
- ...c
269
- }) => {
270
- if (!r && !a)
271
- throw new Error(
272
- "Alert must include either a title or a description, or both"
273
- );
274
- const u = v();
275
- return /* @__PURE__ */ g(
276
- "div",
277
- {
278
- className: p(
279
- M.alert,
280
- M[`type-${e}`],
281
- M[`color-${t}`],
282
- l
283
- ),
284
- role: d,
285
- "aria-live": "polite",
286
- "aria-labelledby": u,
287
- ...c,
288
- children: [
289
- /* @__PURE__ */ o(jn, { icon: n, type: e, color: t }),
290
- /* @__PURE__ */ g("div", { className: M.content, children: [
291
- /* @__PURE__ */ g(
292
- "div",
293
- {
294
- className: p(
295
- M.text,
296
- e === "compact" ? "mds-typography-legacy-body-100" : "mds-typography-legacy-body-200"
297
- ),
298
- children: [
299
- r && /* @__PURE__ */ o(
300
- "div",
301
- {
302
- className: p(
303
- M.title,
304
- "mds-typography-font-weight-semibold"
305
- ),
306
- id: u,
307
- children: r
308
- }
309
- ),
310
- a && /* @__PURE__ */ o(
311
- "div",
312
- {
313
- className: p(
314
- M.description,
315
- "mds-typography-font-weight-regular mds-foreground-primary"
316
- ),
317
- id: r ? void 0 : u,
318
- children: a
319
- }
320
- )
321
- ]
322
- }
323
- ),
324
- i
325
- ] }),
326
- s && /* @__PURE__ */ o("div", { className: M["dismiss-button-wrapper"], children: /* @__PURE__ */ o(vt, { onClick: s }) })
327
- ]
328
- }
329
- );
330
- };
331
- qn.displayName = "Alert";
332
- const Zn = ({ children: e }) => /* @__PURE__ */ o("div", { className: M.actions, children: e });
333
- Zn.displayName = "AlertActions";
334
- const Yn = ({ ...e }) => /* @__PURE__ */ o(gt, { size: "small", ...e });
335
- Yn.displayName = "AlertButton";
336
- const Jn = ({
337
- ...e
338
- }) => /* @__PURE__ */ o(_t, { size: "small", ...e });
339
- Jn.displayName = "AlertStandaloneLink";
340
- const Ge = de(void 0);
341
- Ge.displayName = "MenuPrimitiveContext";
342
- function Te() {
343
- const e = ue(Ge);
344
- if (e === void 0)
345
- throw new Error(
346
- "useMenuPrimitive must be used within a MenuPrimitiveContext.Provider"
347
- );
348
- return e;
349
- }
350
- const Qn = "isOpen__Dbse-", Xn = "isClosed__HWTqi", Le = {
351
- "menu-primitive": "menu-primitive__EJFpE",
352
- "width-full": "width-full__35Qjo",
353
- isOpen: Qn,
354
- isClosed: Xn
355
- }, Nt = ({
356
- onClose: e,
357
- isFullWidth: t,
358
- children: n,
359
- className: s,
360
- ...r
361
- }) => {
362
- const [a, i] = k(!1), d = A(null), l = A(null), c = b(() => {
363
- i(!1), e && e();
364
- }, [i, e]), u = b(() => {
365
- i((y) => !y), l?.current?.focus();
366
- }, [l, i]), h = b(
367
- (y) => {
368
- d?.current?.contains(
369
- y.relatedTarget || document.activeElement
370
- ) || c();
371
- },
372
- [c]
373
- ), m = b(
374
- (y) => {
375
- y.key === "Escape" && (c(), l?.current?.querySelector("button")?.focus());
376
- },
377
- [c]
378
- ), _ = V(
379
- () => ({
380
- isOpen: a,
381
- onClickToggle: u,
382
- toggleRef: l,
383
- closeMenu: c
384
- }),
385
- [a, u, l, c]
386
- );
387
- return /* @__PURE__ */ o(Ge.Provider, { value: _, children: /* @__PURE__ */ o(
388
- "div",
389
- {
390
- className: p(
391
- Le["menu-primitive"],
392
- {
393
- [Le["width-full"]]: t
394
- },
395
- s
396
- ),
397
- onBlur: h,
398
- onKeyUp: m,
399
- ref: d,
400
- ...r,
401
- children: n
402
- }
403
- ) });
404
- }, wt = ({ children: e }) => {
405
- const { toggleRef: t } = Te();
406
- return /* @__PURE__ */ o("div", { className: "hds-menu-primitive__toggle", ref: t, children: e });
407
- }, It = ({ children: e }) => {
408
- const { isOpen: t } = Te();
409
- return /* @__PURE__ */ o("div", { className: t ? Le.isOpen : Le.isClosed, tabIndex: -1, children: e });
410
- }, eo = "breadcrumbs__qRWRC", to = "list__ex8fu", no = "sublist__sSjxU", oo = "item__vAjEk", so = "truncation__Kmsae", ro = "link__T7iXX", ao = "text__g0Z5V", io = "current__RtvDC", lo = "icon__QZYpF", O = {
411
- breadcrumbs: eo,
412
- list: to,
413
- "items-can-wrap": "items-can-wrap__vfE8u",
414
- sublist: no,
415
- item: oo,
416
- truncation: so,
417
- link: ro,
418
- text: ao,
419
- current: io,
420
- icon: lo,
421
- "truncation-button": "truncation-button__3eNF8",
422
- "truncation-content": "truncation-content__P-Vh1"
423
- }, Xe = ({ icon: e, text: t }) => /* @__PURE__ */ g(te, { children: [
424
- e && /* @__PURE__ */ o("div", { className: O.icon, children: e }),
425
- /* @__PURE__ */ o("span", { className: O.text, children: t })
426
- ] }), co = ({
427
- maxWidth: e,
428
- current: t,
429
- icon: n,
430
- text: s,
431
- url: r,
432
- ...a
433
- }) => {
434
- const i = _n();
435
- return /* @__PURE__ */ o(
436
- "li",
437
- {
438
- className: O.item,
439
- style: {
440
- ...e && { maxWidth: e }
441
- },
442
- ...a,
443
- children: t ? /* @__PURE__ */ o("div", { className: O.current, children: /* @__PURE__ */ o(Xe, { icon: n, text: s }) }) : /* @__PURE__ */ o(i, { className: O.link, href: r, children: /* @__PURE__ */ o(Xe, { icon: n, text: s }) })
444
- }
445
- );
446
- }, uo = ({
447
- ariaLabel: e = "show more"
448
- }) => {
449
- const { isOpen: t, onClickToggle: n } = Te();
450
- return /* @__PURE__ */ o(
451
- "button",
452
- {
453
- type: "button",
454
- className: O["truncation-button"],
455
- "aria-label": e,
456
- "aria-expanded": t,
457
- onClick: n,
458
- children: /* @__PURE__ */ o(fn, {})
459
- }
460
- );
461
- }, po = ({
462
- itemsCanWrap: e = !0,
463
- ariaLabel: t = "breadcrumbs",
464
- children: n,
465
- className: s,
466
- ...r
467
- }) => /* @__PURE__ */ o(
468
- "nav",
469
- {
470
- className: p(
471
- O.breadcrumbs,
472
- {
473
- [O["items-can-wrap"]]: e
474
- },
475
- s
476
- ),
477
- "aria-label": t,
478
- ...r,
479
- children: /* @__PURE__ */ o("ol", { className: O.list, children: n })
480
- }
481
- ), mo = ({
482
- ariaLabel: e,
483
- children: t,
484
- ...n
485
- }) => /* @__PURE__ */ o("li", { className: p(O.item, O.truncation), ...n, children: /* @__PURE__ */ g(Nt, { children: [
486
- /* @__PURE__ */ o(wt, { children: /* @__PURE__ */ o(uo, {}) }),
487
- /* @__PURE__ */ o(It, { children: /* @__PURE__ */ o("div", { className: O["truncation-content"], children: /* @__PURE__ */ o("ol", { className: O.sublist, children: t }) }) })
488
- ] }) }), Ti = { Root: po, Item: co, Truncation: mo };
489
- function ho(e) {
490
- if (typeof e > "u" || e === !1 || e === "")
491
- return [];
492
- if (typeof e != "string")
493
- throw new Error(
494
- `The highlight prop must be a string. Received a value of type "${typeof e}" instead.`
495
- );
496
- if (!/^[-,0-9\s]+$/.test(e))
497
- throw new Error(
498
- `The highlight prop must be a comma-separated list of single integers or ranges with a single dash between two integers. Found invalid characters: "${e}".`
499
- );
500
- return e.split(",").reduce((s, r) => s.concat(go(r)), []);
501
- }
502
- function go(e) {
503
- const t = e.split("-");
504
- if (t.length > 2)
505
- throw new Error(
506
- `Each comma-separated value in the highlight prop must be either a single integer, or a range with a single dash between two integers. Found a value with multiple dashes: "${e}".`
507
- );
508
- if (t.length == 1) {
509
- const c = parseInt(e);
510
- if (c !== c)
511
- throw new Error(
512
- `Each comma-separated value in the highlight prop must be either a single integer, or a range with a single dash between two integers. Found a value that parsed to NaN: "${e === "" ? "<empty string>" : e}".`
513
- );
514
- return [c];
515
- }
516
- const [s, r] = t.map((c) => parseInt(c));
517
- if (s !== s || r !== r)
518
- throw new Error(
519
- `Each comma-separated value in the highlight prop must be either a single integer, or a range with a single dash between two integers. Found a range that produced a NaN: "${e}".`
520
- );
521
- const d = r - s + 1;
522
- return [...Array(d).keys()].map((c) => c + s);
523
- }
524
- function _o(e) {
525
- const n = mn.toArray(e).map((r) => typeof r == "object" && "props" in r && r.props.className?.includes("empty-line") ? `
526
- ` : r);
527
- return n.reduce(
528
- (r, a, i) => {
529
- const d = i === n.length - 1, l = a === `
530
- `, c = a !== `
531
- `;
532
- l && r.consecutiveNewlines++;
533
- const u = l && d, h = r.consecutiveNewlines > 0;
534
- if ((c || u) && h) {
535
- r.currentLine.length > 0 && (r.lines.push(r.currentLine), r.currentLine = []);
536
- for (let _ = 1; _ < r.consecutiveNewlines; _++)
537
- r.lines.push("");
538
- r.consecutiveNewlines = 0;
539
- }
540
- return c && (r.currentLine.push(a), d && r.lines.push(r.currentLine)), r;
541
- },
542
- {
543
- lines: [],
544
- currentLine: [],
545
- consecutiveNewlines: 1
546
- // Start at 1 to handle leading newlines
547
- }
548
- ).lines;
549
- }
550
- const fo = '<span class="line"></span>';
551
- function yo(e) {
552
- const t = e.split(`
553
- `);
554
- return t.map((n, s) => s == t.length - 1 && n == "" ? null : /* @__PURE__ */ o(
555
- "span",
556
- {
557
- dangerouslySetInnerHTML: {
558
- __html: n === "" || n === fo ? "&nbsp;" : n
559
- }
560
- },
561
- s
562
- ));
563
- }
564
- const bo = "dark__aBMo7", vo = "token__aGMSy", No = "title__nX-Ny", wo = "description__-44hG", Io = "header__42Fek", xo = "body__pLFmP", Co = "code__J06se", C = {
565
- "code-block": "code-block__dOm6M",
566
- "line-highlight": "line-highlight__a84m6",
567
- dark: bo,
568
- "language-css": "language-css__8iYaN",
569
- token: vo,
570
- "language-javascript": "language-javascript__EWK5u",
571
- "language-markup": "language-markup__E7NSA",
572
- "language-html": "language-html__rLwMK",
573
- "is-standalone": "is-standalone__WLWxy",
574
- title: No,
575
- description: wo,
576
- header: Io,
577
- body: xo,
578
- code: Co,
579
- "copy-button": "copy-button__nMsTD",
580
- "line-highlight-first": "line-highlight-first__OMDUP",
581
- "line-highlight-last": "line-highlight-last__qC6nm",
582
- "line-numbers": "line-numbers__a9m-I",
583
- "line-numbers-rows": "line-numbers-rows__MjGTO",
584
- "line-of-code": "line-of-code__mDztA",
585
- "line-number": "line-number__-g7V-"
586
- }, ko = ({
587
- value: e,
588
- hasLineNumbers: t,
589
- highlightLines: n
590
- }) => {
591
- const s = ho(n), r = V(() => (typeof e == "string" ? yo(e) : _o(e)).map((d, l) => {
592
- const c = l + 1, u = s.indexOf(c) !== -1;
593
- return { children: d, highlight: u };
594
- }).map(({ highlight: d, ...l }, c, u) => {
595
- const h = c === 0 ? null : u[c - 1], m = c === u.length - 1 ? null : u[c + 1];
596
- return {
597
- ...l,
598
- highlight: d,
599
- highlightIsFirstInGroup: !h || !h.highlight,
600
- highlightIsLastInGroup: !m || !m.highlight
601
- };
602
- }), [e, s]);
603
- return /* @__PURE__ */ g(te, { children: [
604
- t ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: C["line-numbers-rows"], children: r.map((a, i) => /* @__PURE__ */ o(
605
- "span",
606
- {
607
- className: p(C["line-number"], {
608
- [C["line-highlight"]]: a.highlight,
609
- [C["line-highlight-first"]]: a.highlightIsFirstInGroup,
610
- [C["line-highlight-last"]]: a.highlightIsLastInGroup
611
- })
612
- },
613
- i
614
- )) }) : null,
615
- /* @__PURE__ */ o("span", { children: r.map((a, i) => /* @__PURE__ */ g(
616
- "span",
617
- {
618
- className: p(C["line-of-code"], {
619
- [C["line-highlight"]]: a.highlight,
620
- [C["line-highlight-first"]]: a.highlightIsFirstInGroup,
621
- [C["line-highlight-last"]]: a.highlightIsLastInGroup
622
- }),
623
- children: [
624
- a.children,
625
- `
626
- `
627
- ]
628
- },
629
- i
630
- )) })
631
- ] });
632
- }, Lo = ({ code: e }, t) => {
633
- const [n, s] = k(!1);
634
- return F(() => {
635
- s(!0);
636
- }, []), n ? /* @__PURE__ */ o("pre", { ref: t, style: { display: "none" }, children: typeof e == "string" ? /* @__PURE__ */ o("span", { dangerouslySetInnerHTML: { __html: e } }) : e }) : null;
637
- }, $o = ht(Lo), To = (e, t, n) => {
638
- let s = "";
639
- for (; e.length > 0; ) {
640
- const r = e.match(t);
641
- r && r.index != null && r[0] != null ? (s += e.slice(0, r.index), s += n(r), e = e.slice(r.index + r[0].length)) : (s += e, e = "");
642
- }
643
- return s;
644
- }, So = (e = "") => {
645
- const t = [];
646
- let n = "";
647
- return To(
648
- e,
649
- /\s*(?:([^\s\\'"]+)|'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/,
650
- (s) => {
651
- const [r, a, i, d, l, c, u] = s;
652
- if (c != null)
653
- throw new Error(`Unmatched quote: ${e}`);
654
- if (a)
655
- n += a;
656
- else {
657
- let h;
658
- i ? h = i : d ? h = d : l && (h = l), h && (n += h.replace(/\\(?=.)/, ""));
659
- }
660
- u != null && (t.push(n), n = "");
661
- }
662
- ), n && t.push(n), t;
663
- }, Eo = (e = "") => e.replace(/([^A-Za-z0-9_\-.,:/@\n])/g, "\\$1").replace(/\n/g, `'
664
- '`);
665
- function Bo(e) {
666
- return e.split(`
667
- `)[0].startsWith("$ ") ? Ao(e) : e;
668
- }
669
- function Ao(e) {
670
- const t = e.split(`
671
- `), n = t[0];
672
- if (n.endsWith("\\") || n.endsWith("EOF")) {
673
- const a = Eo(e).replace("\\$\\", "");
674
- return So(a).join(" ");
675
- }
676
- const r = /^\$ /;
677
- return t.filter((a) => a.match(r)).map((a) => a.replace(r, "")).join(`
678
- `);
679
- }
680
- const Po = ({
681
- title: e,
682
- description: t,
683
- language: n,
684
- value: s,
685
- isStandalone: r = !0,
686
- hasCopyButton: a,
687
- hasLineNumbers: i = !0,
688
- highlightLines: d,
689
- maxHeight: l = "auto",
690
- className: c
691
- }) => {
692
- const u = A(null), h = v();
693
- return /* @__PURE__ */ g(
694
- "div",
695
- {
696
- className: p(
697
- C["code-block"],
698
- C.dark,
699
- {
700
- [C[`language-${n}`]]: n,
701
- [C["is-standalone"]]: r,
702
- [C["line-numbers"]]: i
703
- },
704
- c
705
- ),
706
- children: [
707
- /* @__PURE__ */ g("div", { className: C.header, children: [
708
- e && /* @__PURE__ */ o(
709
- X.HDSBody,
710
- {
711
- size: "200",
712
- tag: "p",
713
- weight: "semibold",
714
- className: C.title,
715
- children: e
716
- }
717
- ),
718
- t && /* @__PURE__ */ o(X.HDSBody, { tag: "p", size: "100", className: C.description, children: t })
719
- ] }),
720
- /* @__PURE__ */ g("div", { className: C.body, children: [
721
- /* @__PURE__ */ o($o, { code: s, ref: u }),
722
- /* @__PURE__ */ o("pre", { className: C.code, id: h, style: { maxHeight: l }, children: /* @__PURE__ */ o("code", { children: /* @__PURE__ */ o(
723
- ko,
724
- {
725
- value: s,
726
- highlightLines: d,
727
- hasLineNumbers: i
728
- }
729
- ) }) }),
730
- a && /* @__PURE__ */ o(
731
- gn,
732
- {
733
- className: C["copy-button"],
734
- "aria-describedby": h,
735
- getTextFn: () => {
736
- const m = u.current?.textContent;
737
- if (!m)
738
- throw new Error(
739
- "`code-block` - Couldn't find text content to copy."
740
- );
741
- return Bo(m);
742
- },
743
- text: "Copy",
744
- isIconOnly: !0,
745
- size: "small"
746
- }
747
- )
748
- ] })
749
- ]
750
- }
751
- );
752
- };
753
- Po.displayName = "CodeBlock";
754
- const Fo = "text__t2BuD", ge = {
755
- "toggle-button": "toggle-button__0Aljq",
756
- "color-primary": "color-primary__gQeWN",
757
- "color-secondary": "color-secondary__PGdzj",
758
- "width-full": "width-full__K1gGu",
759
- text: Fo,
760
- "size-small": "size-small__-mqBv",
761
- "size-medium": "size-medium__A-yPf"
762
- }, xt = ({
763
- text: e,
764
- color: t = "primary",
765
- size: n = "medium",
766
- icon: s,
767
- isFullWidth: r,
768
- count: a,
769
- badge: i,
770
- badgeIcon: d,
771
- disabled: l,
772
- ...c
773
- }) => {
774
- const { isOpen: u, onClickToggle: h } = Te(), m = t === "primary" || l ? "filled" : "inverted", _ = n === "small" ? 12 : 16;
775
- return /* @__PURE__ */ o(wt, { children: /* @__PURE__ */ g(
776
- "button",
777
- {
778
- "aria-expanded": u,
779
- type: "button",
780
- className: p(
781
- ge["toggle-button"],
782
- ge[`size-${n}`],
783
- ge[`color-${t}`],
784
- {
785
- [ge["width-full"]]: r
786
- }
787
- ),
788
- onClick: h,
789
- disabled: l,
790
- ...c,
791
- children: [
792
- s && /* @__PURE__ */ o(T, { name: s, size: _ }),
793
- /* @__PURE__ */ o("div", { className: ge.text, children: e }),
794
- a && /* @__PURE__ */ o(He, { text: a, size: "small", type: m }),
795
- i && /* @__PURE__ */ o($e, { text: i, icon: d, size: "small", type: m }),
796
- /* @__PURE__ */ o(Oo, {})
797
- ]
798
- }
799
- ) });
800
- };
801
- xt.displayName = "Dropdown.ToggleButton";
802
- const Oo = () => /* @__PURE__ */ o(T, { name: "chevron-down", isInlineBlock: !1 }), Do = "interactive__IkSoP", zo = "custom__lrM-c", Ro = "leading__uGWjP", Vo = "trailing__46J03", Mo = "separator__cop56", Ho = "title__XkdBJ mds-typography-legacy-body-100 mds-typography-font-weight-semibold", x = {
803
- "list-item": "list-item__p6gnG",
804
- interactive: Do,
805
- "color-action": "color-action__zG8cO",
806
- "color-critical": "color-critical__3USEd",
807
- custom: zo,
808
- "interactive-icon": "interactive-icon__2sVuv",
809
- leading: Ro,
810
- trailing: Vo,
811
- "interactive-text": "interactive-text__9tKHU",
812
- "loading-wrapper": "loading-wrapper__RMG87",
813
- "text-regular": "text-regular__nmwqr mds-typography-legacy-body-100 mds-typography-font-weight-regular",
814
- "text-large": "text-large__gU2cx mds-typography-legacy-body-200 mds-typography-font-weight-medium",
815
- separator: Mo,
816
- title: Ho
817
- }, Ct = ({
818
- text: e,
819
- color: t = "action",
820
- icon: n,
821
- isLoading: s,
822
- trailingIcon: r,
823
- ...a
824
- }) => /* @__PURE__ */ o(
825
- "li",
826
- {
827
- className: p(x["list-item"], x.interactive, x[`color-${t}`]),
828
- children: s ? /* @__PURE__ */ g("div", { className: x["loading-wrapper"], children: [
829
- /* @__PURE__ */ o(
830
- T,
831
- {
832
- name: "loading",
833
- className: p(x["interactive-icon"], x.leading)
834
- }
835
- ),
836
- /* @__PURE__ */ o("div", { className: p(x["interactive-text"], x["text-regular"]), children: e })
837
- ] }) : /* @__PURE__ */ g(ft, { ...a, children: [
838
- n && /* @__PURE__ */ o(
839
- T,
840
- {
841
- name: n,
842
- className: p(x["interactive-icon"], x.leading)
843
- }
844
- ),
845
- /* @__PURE__ */ o("div", { className: p(x["interactive-text"], x["text-large"]), children: e }),
846
- r && /* @__PURE__ */ o(
847
- T,
848
- {
849
- name: r,
850
- className: p(x["interactive-icon"], x.trailing)
851
- }
852
- )
853
- ] })
854
- }
855
- );
856
- Ct.displayName = "Dropdown.ListItem.Interactive";
857
- const kt = ({ text: e, ...t }) => /* @__PURE__ */ o("li", { className: p(x["list-item"], x.title), ...t, children: e });
858
- kt.displayName = "Dropdown.ListItem.Title";
859
- const Lt = (e) => /* @__PURE__ */ o(
860
- "li",
861
- {
862
- className: p(x["list-item"], x.separator),
863
- "aria-hidden": "true",
864
- role: "separator",
865
- ...e
866
- }
867
- );
868
- Lt.displayName = "Dropdown.ListItem.Separator";
869
- const $t = ({ children: e }) => /* @__PURE__ */ o("li", { className: p(x["list-item"], x.custom), children: e });
870
- $t.displayName = "Dropdown.ListItem.Custom";
871
- const Go = {
872
- Interactive: Ct,
873
- Title: kt,
874
- Separator: Lt,
875
- Custom: $t
876
- }, Wo = "content__L3Jzb", Ko = "list__vHKnu", Uo = "header__FQALL", jo = "footer__X0WK4", U = {
877
- "width-full": "width-full__yhNyZ",
878
- content: Wo,
879
- "content-fixed-width": "content-fixed-width__QTWZ3",
880
- "content-position-bottom-right": "content-position-bottom-right__7p2zs",
881
- "content-position-right": "content-position-right__LV4dD",
882
- "content-position-bottom-left": "content-position-bottom-left__ihVMS",
883
- "content-position-left": "content-position-left__ICQX2",
884
- "content-position-top-right": "content-position-top-right__xbinW",
885
- "content-position-top-left": "content-position-top-left__AR6-v",
886
- list: Ko,
887
- header: Uo,
888
- footer: jo,
889
- "header-with-divider": "header-with-divider__hHDYL",
890
- "footer-with-divider": "footer-with-divider__TqV8J"
891
- }, Tt = ({
892
- isFullWidth: e,
893
- onClose: t,
894
- children: n,
895
- className: s,
896
- ...r
897
- }) => /* @__PURE__ */ o(
898
- Nt,
899
- {
900
- className: p(
901
- {
902
- [U["width-full"]]: e
903
- },
904
- s
905
- ),
906
- onClose: t,
907
- isFullWidth: e,
908
- ...r,
909
- children: n
910
- }
911
- ), St = ({
912
- listPosition: e = "bottom-right",
913
- width: t,
914
- height: n,
915
- children: s
916
- }) => /* @__PURE__ */ o(It, { children: /* @__PURE__ */ o(
917
- "div",
918
- {
919
- className: p(
920
- U.content,
921
- U[`content-position-${e}`],
922
- { [U["content-fixed-width"]]: !!t }
923
- ),
924
- style: { width: t, height: n },
925
- children: s
926
- }
927
- ) }), Et = ({ children: e }) => /* @__PURE__ */ o("ul", { className: U.list, children: e }), Bt = ({
928
- hasDivider: e,
929
- children: t,
930
- ...n
931
- }) => /* @__PURE__ */ o(
932
- "div",
933
- {
934
- className: p(U.header, {
935
- [U["header-with-divider"]]: e
936
- }),
937
- ...n,
938
- children: t
939
- }
940
- ), At = ({
941
- hasDivider: e,
942
- children: t,
943
- ...n
944
- }) => /* @__PURE__ */ o(
945
- "div",
946
- {
947
- className: p(U.footer, {
948
- [U["footer-with-divider"]]: e
949
- }),
950
- ...n,
951
- children: t
952
- }
953
- );
954
- Tt.displayName = "Dropdown.Root";
955
- St.displayName = "Dropdown.Content";
956
- Et.displayName = "Dropdown.List";
957
- Bt.displayName = "Dropdown.Header";
958
- At.displayName = "Dropdown.Footer";
959
- const Si = { Root: Tt, ToggleButton: xt, Content: St, List: Et, Header: Bt, Footer: At, ListItem: Go }, et = "en", qo = {
960
- en: /* @__PURE__ */ new Set([
961
- "a",
962
- "an",
963
- "and",
964
- "as",
965
- "at",
966
- "but",
967
- "by",
968
- "for",
969
- "in",
970
- "nor",
971
- "of",
972
- "on",
973
- "or",
974
- "so",
975
- "the",
976
- "to",
977
- "up",
978
- "yet"
979
- ]),
980
- de: /* @__PURE__ */ new Set(),
981
- // Capitalization rules in German don't suppress small words.
982
- es: /* @__PURE__ */ new Set([
983
- "el",
984
- "la",
985
- "los",
986
- "las",
987
- "un",
988
- "una",
989
- "unos",
990
- "unas",
991
- "y",
992
- "o",
993
- "pero",
994
- "de",
995
- "del",
996
- "al",
997
- "en",
998
- "por",
999
- "para",
1000
- "con"
1001
- ]),
1002
- fr: /* @__PURE__ */ new Set([
1003
- "le",
1004
- "la",
1005
- "les",
1006
- "un",
1007
- "une",
1008
- "et",
1009
- "de",
1010
- "du",
1011
- "des",
1012
- "en",
1013
- "à",
1014
- "au",
1015
- "aux",
1016
- "pour",
1017
- "avec"
1018
- ]),
1019
- ja: /* @__PURE__ */ new Set(),
1020
- // Japanese doesn't use title casing; characters are not case-sensitive
1021
- ko: /* @__PURE__ */ new Set(),
1022
- // Korean doesn't use casing
1023
- pt: /* @__PURE__ */ new Set([
1024
- "o",
1025
- "a",
1026
- "os",
1027
- "as",
1028
- "um",
1029
- "uma",
1030
- "uns",
1031
- "umas",
1032
- "e",
1033
- "ou",
1034
- "mas",
1035
- "de",
1036
- "do",
1037
- "da",
1038
- "dos",
1039
- "das",
1040
- "em",
1041
- "no",
1042
- "na",
1043
- "nos",
1044
- "nas",
1045
- "por",
1046
- "para",
1047
- "com"
1048
- ]),
1049
- id: /* @__PURE__ */ new Set()
1050
- // ! TODO Determine Indonesian's small word rules, and apply them here
1051
- }, Zo = de(
1052
- void 0
1053
- );
1054
- function Yo(e, t) {
1055
- if (t === "ja" || t === "ko")
1056
- return e;
1057
- const n = e.match(/^(\s*[\p{P}\p{Zs}]*)?(\p{L})(.*)$/u);
1058
- if (!n) return e;
1059
- const [, s, r, a] = n;
1060
- return (s ?? "") + r.toLocaleUpperCase(t) + a.toLocaleLowerCase(t);
1061
- }
1062
- function Jo(e, t) {
1063
- const n = qo[t], s = e.toLocaleLowerCase(t).split(/([\s\-:,.]+)/);
1064
- let r = !0;
1065
- return s.map((a) => /^[\s\-:,.]+$/.test(a) ? (/[:.!?]\s*$/.test(a) && (r = !0), a) : a.charAt(0).toLocaleUpperCase && (r || !n.has(a)) ? (r = !1, a.charAt(0).toLocaleUpperCase(t) + a.slice(1)) : a).join("");
1066
- }
1067
- let tt = !1;
1068
- function Qo() {
1069
- const e = ue(Zo)?.locale;
1070
- return !e && typeof window < "u" && !tt && (tt = !0, console.warn(
1071
- `[@web/utils] No <LocaleProvider> found. Defaulting to "${et}".`
1072
- )), e || et;
1073
- }
1074
- function nt(e, t) {
1075
- return t.split(".").reduce((n, s) => {
1076
- if (typeof n == "object" && n !== null && s in n)
1077
- return n[s];
1078
- }, e);
1079
- }
1080
- function Xo(e, t = "en") {
1081
- return function(s, r, a) {
1082
- const i = nt(e[r], s) ?? nt(e[t], s);
1083
- if (typeof i != "string") return "";
1084
- switch (a) {
1085
- case "title":
1086
- return Jo(i, r);
1087
- case "sentence":
1088
- return Yo(i, r);
1089
- case "upper":
1090
- return i.toLocaleUpperCase(r);
1091
- case "lower":
1092
- return i.toLocaleLowerCase(r);
1093
- case "none":
1094
- default:
1095
- return i;
1096
- }
1097
- };
1098
- }
1099
- const ot = Xo({
1100
- de: {
1101
- optional: "optional",
1102
- // "optional" is the same in German
1103
- required: "erforderlich"
1104
- },
1105
- en: {
1106
- optional: "optional",
1107
- required: "required"
1108
- },
1109
- es: {
1110
- optional: "opcional",
1111
- required: "obligatorio"
1112
- },
1113
- fr: {
1114
- optional: "facultatif",
1115
- required: "obligatoire"
1116
- },
1117
- id: {
1118
- // ! TODO Translate text to Indonesian
1119
- optional: "optional",
1120
- required: "required"
1121
- },
1122
- ja: {
1123
- optional: "任意",
1124
- required: "必須"
1125
- },
1126
- ko: {
1127
- optional: "선택 사항",
1128
- required: "필수"
1129
- },
1130
- pt: {
1131
- optional: "opcional",
1132
- required: "obrigatório"
1133
- }
1134
- }), es = "optional__xEN-m mds-typography-legacy-body-100 mds-typography-font-weight-regular", ts = {
1135
- optional: es
1136
- }, We = ({ isOptional: e, isRequired: t }) => {
1137
- const n = Qo(), s = e ? ts.optional : null;
1138
- return e ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: s, children: `(${ot("optional", n, "title")})` }) : t ? /* @__PURE__ */ o(
1139
- $e,
1140
- {
1141
- "aria-hidden": "true",
1142
- className: s,
1143
- size: "small",
1144
- text: ot("required", n, "title")
1145
- }
1146
- ) : null;
1147
- };
1148
- We.displayName = "Indicator";
1149
- const ns = "badges__fd5n1", os = "label__p8mfL mds-typography-legacy-body-200 mds-typography-font-weight-semibold", st = {
1150
- badges: ns,
1151
- label: os
1152
- }, Pt = ({
1153
- badgeText: e,
1154
- className: t,
1155
- controlId: n,
1156
- children: s,
1157
- isRequired: r,
1158
- isOptional: a,
1159
- ...i
1160
- }) => /* @__PURE__ */ g(
1161
- "label",
1162
- {
1163
- className: p(st.label, t),
1164
- htmlFor: n,
1165
- ...i,
1166
- children: [
1167
- /* @__PURE__ */ o("span", { children: s }),
1168
- a || r || e ? /* @__PURE__ */ g("span", { className: st.badges, children: [
1169
- e ? /* @__PURE__ */ o($e, { size: "small", text: e }) : null,
1170
- /* @__PURE__ */ o(We, { isRequired: r, isOptional: a })
1171
- ] }) : null
1172
- ]
1173
- }
1174
- );
1175
- Pt.displayName = "Label";
1176
- const ss = {
1177
- "helper-text": "helper-text__4mh4z mds-typography-legacy-body-100 mds-typography-font-weight-regular"
1178
- }, Ke = ({
1179
- children: e,
1180
- className: t,
1181
- controlId: n,
1182
- ...s
1183
- }) => /* @__PURE__ */ o(
1184
- "div",
1185
- {
1186
- className: p(ss["helper-text"], t),
1187
- id: n ? `helper-text-${n}` : void 0,
1188
- ...s,
1189
- children: e
1190
- }
1191
- );
1192
- Ke.displayName = "HelperText";
1193
- const rs = "error__UVBmH mds-typography-legacy-body-100 mds-typography-font-weight-medium", as = "icon__KOCmk", is = "content__tbSUM", ls = "message__-Ljv-", Ce = {
1194
- error: rs,
1195
- icon: as,
1196
- content: is,
1197
- message: ls
1198
- }, cs = ({ children: e, ...t }) => /* @__PURE__ */ o("p", { className: Ce.message, ...t, children: e }), Ue = ({ children: e, className: t, controlId: n, ...s }) => /* @__PURE__ */ g(
1199
- "div",
1200
- {
1201
- className: p(Ce.error, t),
1202
- id: n ? `error-${n}` : void 0,
1203
- ...s,
1204
- children: [
1205
- /* @__PURE__ */ o(yn, { className: Ce.icon }),
1206
- /* @__PURE__ */ o("div", { className: Ce.content, children: /* @__PURE__ */ o(cs, { children: e }) })
1207
- ]
1208
- }
1209
- );
1210
- Ue.displayName = "Error";
1211
- const ds = "vertical__Ond75", us = "label__yNHVo", ps = "control__fiVMP", ms = "flag__9bLjU", hs = "error__xwHck", _e = {
1212
- vertical: ds,
1213
- label: us,
1214
- control: ps,
1215
- "helper-text": "helper-text__4l6Tt",
1216
- flag: ms,
1217
- error: hs
1218
- }, j = ({
1219
- badgeText: e,
1220
- id: t,
1221
- isRequired: n,
1222
- isOptional: s,
1223
- label: r,
1224
- helperText: a,
1225
- error: i,
1226
- className: d,
1227
- layout: l,
1228
- children: c,
1229
- ...u
1230
- }) => /* @__PURE__ */ g(
1231
- "div",
1232
- {
1233
- className: p({ [_e[`${l}`]]: l }, d),
1234
- ...u,
1235
- children: [
1236
- r && /* @__PURE__ */ o(
1237
- Pt,
1238
- {
1239
- badgeText: e,
1240
- controlId: t,
1241
- isOptional: s,
1242
- isRequired: n,
1243
- className: _e.label,
1244
- children: r
1245
- }
1246
- ),
1247
- a && /* @__PURE__ */ o(Ke, { controlId: t, className: _e["helper-text"], children: a }),
1248
- /* @__PURE__ */ o("div", { className: _e.control, children: c }),
1249
- i && /* @__PURE__ */ o(Ue, { controlId: t, className: _e.error, children: i })
1250
- ]
1251
- }
1252
- );
1253
- j.displayName = "Field";
1254
- const gs = "legend__O8-rs mds-typography-legacy-body-200 mds-typography-font-weight-semibold", _s = "badge__rqzw5", rt = {
1255
- legend: gs,
1256
- badge: _s
1257
- }, Ft = ({
1258
- className: e,
1259
- isRequired: t,
1260
- isOptional: n,
1261
- children: s,
1262
- ...r
1263
- }) => /* @__PURE__ */ g("legend", { className: p(rt.legend, e), ...r, children: [
1264
- /* @__PURE__ */ o("span", { children: s }),
1265
- n || t ? /* @__PURE__ */ o("span", { className: rt.badge, children: /* @__PURE__ */ o(We, { isRequired: t, isOptional: n }) }) : null
1266
- ] });
1267
- Ft.displayName = "Legend";
1268
- const fs = "group__4-G8T", ys = "legend__Psn00", bs = "vertical__nU8G5", vs = "horizontal__nzPrB", Ns = "error__oiFxc", Z = {
1269
- group: fs,
1270
- legend: ys,
1271
- "has-legend": "has-legend__CnvEd",
1272
- vertical: bs,
1273
- "control-fields-wrapper": "control-fields-wrapper__ODpmr",
1274
- horizontal: vs,
1275
- "helper-text": "helper-text__rPBCK",
1276
- error: Ns
1277
- }, ve = ({
1278
- isRequired: e,
1279
- isOptional: t,
1280
- legend: n,
1281
- helperText: s,
1282
- error: r,
1283
- className: a,
1284
- layout: i,
1285
- children: d,
1286
- id: l,
1287
- testingKey: c,
1288
- ...u
1289
- }) => {
1290
- const h = v(), m = l ?? h;
1291
- return /* @__PURE__ */ g(
1292
- "fieldset",
1293
- {
1294
- className: p(Z.group, i ? Z[i] : null, a),
1295
- id: m,
1296
- "data-testid": c,
1297
- ...u,
1298
- children: [
1299
- n && /* @__PURE__ */ o(
1300
- Ft,
1301
- {
1302
- isOptional: t,
1303
- isRequired: e,
1304
- className: Z.legend,
1305
- children: n
1306
- }
1307
- ),
1308
- s && /* @__PURE__ */ o(
1309
- Ke,
1310
- {
1311
- controlId: `${m}-help`,
1312
- className: Z["helper-text"],
1313
- children: s
1314
- }
1315
- ),
1316
- /* @__PURE__ */ o(
1317
- "div",
1318
- {
1319
- className: p(Z["control-fields-wrapper"], {
1320
- [Z["has-legend"]]: n
1321
- }),
1322
- children: d
1323
- }
1324
- ),
1325
- r && /* @__PURE__ */ o(Ue, { controlId: `${m}-error`, className: Z.error, children: r })
1326
- ]
1327
- }
1328
- );
1329
- };
1330
- ve.displayName = "Fieldset";
1331
- const ws = "checkbox__7aEmD", Is = {
1332
- checkbox: ws
1333
- }, Ot = ({
1334
- id: e,
1335
- required: t,
1336
- field: n,
1337
- testingKey: s,
1338
- error: r
1339
- }) => {
1340
- const a = v();
1341
- return /* @__PURE__ */ o(
1342
- "input",
1343
- {
1344
- id: e ?? a,
1345
- type: "checkbox",
1346
- className: Is.checkbox,
1347
- required: t,
1348
- "aria-describedby": `${r ? "error" : "helper-text"}-${e}`,
1349
- "data-testid": s,
1350
- ...n
1351
- }
1352
- );
1353
- };
1354
- Ot.displayName = "CheckboxBase";
1355
- const Dt = ({
1356
- isInvalid: e,
1357
- isLoading: t,
1358
- isRequired: n,
1359
- isOptional: s,
1360
- id: r,
1361
- label: a,
1362
- helperText: i,
1363
- error: d,
1364
- field: l,
1365
- className: c,
1366
- testingKey: u,
1367
- ...h
1368
- }) => {
1369
- const m = v(), _ = r ?? m;
1370
- return /* @__PURE__ */ o(
1371
- j,
1372
- {
1373
- label: a,
1374
- helperText: i,
1375
- error: d,
1376
- isRequired: n,
1377
- isOptional: s,
1378
- id: _,
1379
- layout: "flag",
1380
- className: c,
1381
- children: /* @__PURE__ */ o(
1382
- Ot,
1383
- {
1384
- id: _,
1385
- required: n,
1386
- field: l,
1387
- testingKey: u,
1388
- error: d,
1389
- ...h
1390
- }
1391
- )
1392
- }
1393
- );
1394
- };
1395
- Dt.displayName = "CheckboxField";
1396
- const zt = ({
1397
- layout: e = "vertical",
1398
- legend: t,
1399
- helperText: n,
1400
- error: s,
1401
- isOptional: r,
1402
- isRequired: a,
1403
- children: i
1404
- }) => /* @__PURE__ */ o(
1405
- ve,
1406
- {
1407
- layout: e,
1408
- legend: t,
1409
- helperText: n,
1410
- error: s,
1411
- isOptional: r,
1412
- isRequired: a,
1413
- children: i
1414
- }
1415
- );
1416
- zt.displayName = "CheckboxGroupRoot";
1417
- const Rt = (e) => /* @__PURE__ */ o(
1418
- Dt,
1419
- {
1420
- className: e.className,
1421
- testingKey: e.testingKey,
1422
- ...e
1423
- }
1424
- );
1425
- Rt.displayName = "CheckboxGroupInner";
1426
- const Ei = {
1427
- Root: zt,
1428
- Inner: Rt
1429
- }, xs = {
1430
- "file-input": "file-input__kBoO-"
1431
- }, Vt = ({
1432
- isRequired: e,
1433
- className: t,
1434
- id: n,
1435
- field: s,
1436
- error: r,
1437
- ...a
1438
- }) => {
1439
- const i = v();
1440
- return /* @__PURE__ */ o(
1441
- "input",
1442
- {
1443
- type: "file",
1444
- required: e,
1445
- id: n ?? i,
1446
- className: xs["file-input"],
1447
- "aria-describedby": `${r ? "error" : "helper-text"}-${n}`,
1448
- ...s,
1449
- ...a
1450
- }
1451
- );
1452
- };
1453
- Vt.displayName = "FileInputBase";
1454
- const Cs = ({
1455
- id: e,
1456
- label: t,
1457
- helperText: n,
1458
- error: s,
1459
- field: r,
1460
- className: a,
1461
- isRequired: i,
1462
- isOptional: d,
1463
- ...l
1464
- }) => {
1465
- const c = v(), u = e ?? c;
1466
- return /* @__PURE__ */ o(
1467
- j,
1468
- {
1469
- label: t,
1470
- helperText: n,
1471
- error: s,
1472
- isRequired: i,
1473
- isOptional: d,
1474
- id: u,
1475
- layout: "vertical",
1476
- className: a,
1477
- children: /* @__PURE__ */ o(
1478
- Vt,
1479
- {
1480
- id: u,
1481
- isRequired: i,
1482
- field: r,
1483
- ...l
1484
- }
1485
- )
1486
- }
1487
- );
1488
- };
1489
- Cs.displayName = "FileInputField";
1490
- const ks = "radio__oZ3hf", Ls = {
1491
- radio: ks
1492
- }, je = ({
1493
- id: e,
1494
- required: t,
1495
- field: n,
1496
- className: s,
1497
- testingKey: r
1498
- }) => /* @__PURE__ */ o(
1499
- "input",
1500
- {
1501
- id: e,
1502
- type: "radio",
1503
- className: p(Ls.radio, s),
1504
- required: t,
1505
- "data-testid": r,
1506
- ...n
1507
- }
1508
- );
1509
- je.displayName = "RadioBase";
1510
- const Mt = ({
1511
- isInvalid: e,
1512
- isLoading: t,
1513
- isRequired: n,
1514
- isOptional: s,
1515
- id: r,
1516
- label: a,
1517
- helperText: i,
1518
- error: d,
1519
- field: l,
1520
- className: c,
1521
- testingKey: u,
1522
- ...h
1523
- }) => {
1524
- const m = v(), _ = r ?? m;
1525
- return /* @__PURE__ */ o(
1526
- j,
1527
- {
1528
- label: a,
1529
- helperText: i,
1530
- error: d,
1531
- isRequired: n,
1532
- isOptional: s,
1533
- id: _,
1534
- layout: "flag",
1535
- className: c,
1536
- children: /* @__PURE__ */ o(
1537
- je,
1538
- {
1539
- id: _,
1540
- required: n,
1541
- field: { ...l, "aria-describedby": `error-${r}` },
1542
- testingKey: u,
1543
- ...h
1544
- }
1545
- )
1546
- }
1547
- );
1548
- };
1549
- Mt.displayName = "RadioField";
1550
- const Ht = ({
1551
- layout: e = "vertical",
1552
- legend: t,
1553
- isOptional: n,
1554
- isRequired: s,
1555
- children: r
1556
- }) => /* @__PURE__ */ o(
1557
- ve,
1558
- {
1559
- layout: e,
1560
- legend: t,
1561
- isOptional: n,
1562
- isRequired: s,
1563
- children: r
1564
- }
1565
- );
1566
- Ht.displayName = "RadioGroupRoot";
1567
- const Gt = (e) => /* @__PURE__ */ o(
1568
- Mt,
1569
- {
1570
- ...e,
1571
- testingKey: e.testingKey,
1572
- className: e.className
1573
- }
1574
- );
1575
- Gt.displayName = "RadioGroupField";
1576
- const Bi = {
1577
- Root: Ht,
1578
- Field: Gt
1579
- }, $s = "control__0w6N4", Ts = "checked__v5wfQ", Ss = "disabled__h7JVb", Es = "content__IKiN7", Bs = "label__UR-sm", As = "description__s8FwT", Ps = "badges__klktk", S = {
1580
- "radio-cards": "radio-cards__C4la-",
1581
- "has-fluid-width": "has-fluid-width__rKqOq",
1582
- "has-fixed-width": "has-fixed-width__AAAPW",
1583
- "radio-card": "radio-card__JyN2Z",
1584
- control: $s,
1585
- checked: Ts,
1586
- "control-wrapper": "control-wrapper__00m5o",
1587
- disabled: Ss,
1588
- "align-left": "align-left__lqD3y",
1589
- "align-center": "align-center__ZMFAS",
1590
- "control-bottom": "control-bottom__UIViy",
1591
- "control-left": "control-left__1tHvm",
1592
- content: Es,
1593
- label: Bs,
1594
- description: As,
1595
- badges: Ps,
1596
- "icon-center": "icon-center__zJMDY"
1597
- }, Fs = ({
1598
- layout: e = "horizontal",
1599
- isRequired: t,
1600
- isOptional: n,
1601
- error: s,
1602
- legend: r,
1603
- helperText: a,
1604
- children: i,
1605
- ...d
1606
- }) => /* @__PURE__ */ o(
1607
- ve,
1608
- {
1609
- className: S["radio-cards"],
1610
- layout: e,
1611
- legend: r,
1612
- isOptional: n,
1613
- isRequired: t,
1614
- helperText: a,
1615
- error: s,
1616
- ...d,
1617
- children: i
1618
- }
1619
- );
1620
- Fs.displayName = "RadioCardGroup";
1621
- function Os({ label: e }) {
1622
- return /* @__PURE__ */ o(X.DisplayExpressive, { className: S.label, size: "200", weight: "bold", children: e });
1623
- }
1624
- function Ds({ description: e }) {
1625
- return /* @__PURE__ */ o(X.HDSBody, { className: S.description, size: "100", children: e });
1626
- }
1627
- const zs = "bottom", Rs = "left", Vs = ({
1628
- controlPosition: e = zs,
1629
- alignment: t = Rs,
1630
- maxWidth: n,
1631
- field: s,
1632
- icon: r,
1633
- label: a,
1634
- description: i,
1635
- badges: d,
1636
- children: l
1637
- }) => {
1638
- const c = v();
1639
- return /* @__PURE__ */ g(
1640
- "label",
1641
- {
1642
- htmlFor: c,
1643
- style: { maxWidth: n },
1644
- className: p(
1645
- S["radio-card"],
1646
- S[`control-${e}`],
1647
- S[`align-${t}`],
1648
- {
1649
- [S.checked]: s.checked,
1650
- [S.disabled]: s.disabled,
1651
- [S["has-fixed-width"]]: n,
1652
- [S["has-fluid-width"]]: !n
1653
- }
1654
- ),
1655
- children: [
1656
- /* @__PURE__ */ g("span", { className: S.content, children: [
1657
- r && /* @__PURE__ */ o(
1658
- T,
1659
- {
1660
- name: r,
1661
- size: 24,
1662
- isInlineBlock: !1,
1663
- className: p({
1664
- [S["icon-center"]]: t === "center"
1665
- })
1666
- }
1667
- ),
1668
- a && /* @__PURE__ */ o(Os, { label: a }),
1669
- d?.length ? /* @__PURE__ */ o("div", { className: S.badges, children: d.map((u) => /* @__PURE__ */ hn($e, { ...u, key: u.text })) }) : null,
1670
- i && /* @__PURE__ */ o(Ds, { description: i }),
1671
- l
1672
- ] }),
1673
- /* @__PURE__ */ o("span", { className: S["control-wrapper"], children: /* @__PURE__ */ o(je, { className: S.control, id: c, field: s }) })
1674
- ]
1675
- }
1676
- );
1677
- };
1678
- Vs.displayName = "RadioCard";
1679
- const Ms = "select__hODF3 mds-typography-font-weight-regular", Hs = "invalid__tTJro", Gs = "medium__XQMJY mds-typography-legacy-body-200", Ws = "large__t1lgT mds-typography-legacy-body-300", Ae = {
1680
- select: Ms,
1681
- invalid: Hs,
1682
- medium: Gs,
1683
- large: Ws
1684
- }, Ks = ({
1685
- isInvalid: e,
1686
- isLoading: t,
1687
- className: n,
1688
- id: s,
1689
- field: r,
1690
- children: a,
1691
- size: i,
1692
- error: d,
1693
- ...l
1694
- }) => /* @__PURE__ */ o(
1695
- "select",
1696
- {
1697
- id: s,
1698
- className: p(
1699
- Ae.select,
1700
- Ae[i],
1701
- {
1702
- [Ae.invalid]: e
1703
- },
1704
- n
1705
- ),
1706
- "aria-describedby": `${d ? "error" : "helper-text"}-${s}`,
1707
- ...r,
1708
- ...l,
1709
- children: a
1710
- }
1711
- ), Us = ({
1712
- isInvalid: e,
1713
- isLoading: t,
1714
- isRequired: n,
1715
- isOptional: s,
1716
- id: r,
1717
- label: a,
1718
- helperText: i,
1719
- error: d,
1720
- field: l,
1721
- children: c,
1722
- className: u,
1723
- size: h = "medium",
1724
- ...m
1725
- }) => {
1726
- const _ = v(), y = r ?? _;
1727
- return /* @__PURE__ */ o(
1728
- j,
1729
- {
1730
- label: a,
1731
- helperText: i,
1732
- error: d,
1733
- isRequired: n,
1734
- isOptional: s,
1735
- id: y,
1736
- layout: "vertical",
1737
- className: u,
1738
- children: /* @__PURE__ */ o(
1739
- Ks,
1740
- {
1741
- id: y,
1742
- isInvalid: e,
1743
- required: n,
1744
- field: l,
1745
- size: h,
1746
- ...m,
1747
- children: c
1748
- }
1749
- )
1750
- }
1751
- );
1752
- };
1753
- Us.displayName = "SelectField";
1754
- const js = "invalid__rrYph", qs = "loading__O7Vv0", xe = {
1755
- "text-input": "text-input__Xudum mds-typography-font-weight-regular",
1756
- "mock-hover": "mock-hover__-ItMX",
1757
- "mock-focus": "mock-focus__S6jof",
1758
- invalid: js,
1759
- loading: qs,
1760
- "size-medium": "size-medium__-UzIQ mds-typography-legacy-body-200",
1761
- "size-large": "size-large__Hceu2 mds-typography-legacy-body-300"
1762
- }, qe = ({
1763
- type: e,
1764
- isInvalid: t,
1765
- isLoading: n,
1766
- isRequired: s,
1767
- className: r,
1768
- id: a,
1769
- field: i,
1770
- size: d = "medium",
1771
- error: l,
1772
- ...c
1773
- }) => {
1774
- const u = v();
1775
- return /* @__PURE__ */ o(
1776
- "input",
1777
- {
1778
- id: a ?? u,
1779
- type: e,
1780
- className: p(
1781
- xe["text-input"],
1782
- xe[`size-${d}`],
1783
- {
1784
- [xe.invalid]: t,
1785
- [xe.loading]: n
1786
- },
1787
- r
1788
- ),
1789
- required: s,
1790
- "aria-describedby": `${l ? "error" : "helper-text"}-${a}`,
1791
- ...i,
1792
- ...c
1793
- }
1794
- );
1795
- };
1796
- qe.displayName = "TextInputBase";
1797
- const Zs = ({
1798
- badgeText: e,
1799
- type: t = "text",
1800
- isInvalid: n,
1801
- isLoading: s,
1802
- isRequired: r,
1803
- isOptional: a,
1804
- id: i,
1805
- label: d,
1806
- helperText: l,
1807
- error: c,
1808
- field: u,
1809
- className: h,
1810
- size: m = "medium",
1811
- ..._
1812
- }) => {
1813
- const y = v(), I = i ?? y;
1814
- return /* @__PURE__ */ o(
1815
- j,
1816
- {
1817
- label: d,
1818
- badgeText: e,
1819
- helperText: l,
1820
- error: c,
1821
- isRequired: r,
1822
- isOptional: a,
1823
- id: I,
1824
- layout: "vertical",
1825
- className: h,
1826
- children: /* @__PURE__ */ o(
1827
- qe,
1828
- {
1829
- id: I,
1830
- type: t,
1831
- isInvalid: n,
1832
- isLoading: s,
1833
- isRequired: r,
1834
- field: u,
1835
- size: m,
1836
- ..._
1837
- }
1838
- )
1839
- }
1840
- );
1841
- };
1842
- Zs.displayName = "TextInput";
1843
- const ke = (e, t) => `${e}__${t}`, Y = -1;
1844
- function Ys(e) {
1845
- const t = /* @__PURE__ */ new Map();
1846
- for (const [n, s] of Object.entries(e)) {
1847
- if (!s) continue;
1848
- const r = t.get(s) || [];
1849
- t.set(s, [...r, n]);
1850
- }
1851
- for (const [n, s] of t)
1852
- if (s.length > 1)
1853
- throw new Error(
1854
- `ComboBox: id '${n}' is duplicated in ${s.join(", ")}`
1855
- );
1856
- }
1857
- const Wt = de(null), pe = () => {
1858
- const e = ue(Wt);
1859
- if (!e)
1860
- throw new Error("useComboBox must be used within a ComboBoxProvider");
1861
- return e;
1862
- }, Js = ({
1863
- children: e,
1864
- keyboardFocusLoop: t = !0,
1865
- ids: n = {},
1866
- onChangeVFocusedOption: s,
1867
- onChangeSelectedOption: r
1868
- }) => {
1869
- Ys(n);
1870
- const a = A([]), i = A(/* @__PURE__ */ new Set()), [d, l] = k(null), [c, u] = k(Y), h = A(null), m = A(null), [_, y] = k(!1), I = A(null), H = ke("hashi-combo-box-toggle", v()), D = ke("hashi-combo-box-popover", v()), q = ke("hashi-combo-box-listbox", v()), ne = b(
1871
- (f) => {
1872
- l(f), r?.(f);
1873
- },
1874
- [r]
1875
- ), G = b(
1876
- (f) => {
1877
- u(f), s?.(a.current[f]);
1878
- },
1879
- [s]
1880
- ), me = A({
1881
- toggle: n.toggle ?? H,
1882
- popover: n.popover ?? D,
1883
- listbox: n.listbox ?? q
1884
- }), W = b(
1885
- (f) => {
1886
- G(f);
1887
- },
1888
- [G]
1889
- ), we = b(() => {
1890
- const f = a.current;
1891
- if (c === Y) return 0;
1892
- const L = c + 1, B = L >= f.length;
1893
- let se;
1894
- B && t ? (se = Y, y(!1)) : se = B ? c : L, W(se);
1895
- }, [t, c, W]), N = b(() => {
1896
- if (c === Y) return 0;
1897
- const f = c - 1, L = f < 0;
1898
- let B;
1899
- L && t ? (B = Y, y(!1)) : B = L ? c : f, W(B);
1900
- }, [t, c, W]), w = b(
1901
- (f) => {
1902
- const L = a.current.findIndex((B) => B.id === f.id);
1903
- if (L === -1) {
1904
- console.error("ComboBox: Item not found", f);
1905
- return;
1906
- }
1907
- G(L);
1908
- },
1909
- [G]
1910
- ), P = b(() => c === Y ? null : a.current[c] || null, [c]), oe = b(
1911
- (f) => {
1912
- if (a.current.findIndex((B) => B.id === f.id) === -1) {
1913
- console.error(
1914
- "ComboBox: Item not found, Selected item not updated",
1915
- f
1916
- );
1917
- return;
1918
- }
1919
- ne(f), y(!1);
1920
- },
1921
- [ne]
1922
- ), Se = b(() => d, [d]), Ee = b((f) => {
1923
- if (i.current.has(f.id)) {
1924
- const L = a.current.find((re) => re.id === f.id), Je = `Each ComboBox.Item must have a unique id.
1925
- Found items with duplicate ids: ${JSON.stringify({
1926
- existing: L,
1927
- attemptedToAdd: f
1928
- })}`;
1929
- throw Error(Je);
1930
- }
1931
- i.current.add(f.id), a.current.push(f);
1932
- }, []), he = b(() => a.current, []), dn = b((f) => {
1933
- i.current.delete(f.id), a.current = a.current.filter((L) => L.id !== f.id);
1934
- }, []);
1935
- F(() => {
1936
- _ && m.current?.focus();
1937
- }, [_, m, h]), F(() => {
1938
- const f = P(), L = I.current;
1939
- f && L && L.querySelector(
1940
- `[data-combo-box-item-id="${f.id}"]`
1941
- )?.scrollIntoView({ block: "nearest", behavior: "smooth" });
1942
- }, [P]);
1943
- const Be = b(() => {
1944
- y(!1), G(Y);
1945
- }, [G]), un = b(() => {
1946
- y(!0);
1947
- }, []), pn = (f) => {
1948
- const L = f.key === "ArrowDown" || f.key === "ArrowUp", B = f.key === " ", se = m.current !== null;
1949
- switch ((L || B && !se) && f.preventDefault(), f.key) {
1950
- case "Escape": {
1951
- Be();
1952
- break;
1953
- }
1954
- case "ArrowDown": {
1955
- const re = P() === null;
1956
- _ && re ? W(0) : we();
1957
- break;
1958
- }
1959
- case "ArrowUp": {
1960
- N();
1961
- break;
1962
- }
1963
- case "Enter": {
1964
- const re = P();
1965
- re && oe(re), Be();
1966
- break;
1967
- }
1968
- }
1969
- };
1970
- return /* @__PURE__ */ o(
1971
- Wt.Provider,
1972
- {
1973
- value: {
1974
- addItem: Ee,
1975
- selectItem: oe,
1976
- vFocus: w,
1977
- vFocusByIdx: W,
1978
- vFocusNext: we,
1979
- vFocusPrev: N,
1980
- getSelectedItem: Se,
1981
- getVFocusedItem: P,
1982
- getItems: he,
1983
- removeItem: dn,
1984
- searchInputRef: m,
1985
- toggleRef: h,
1986
- listRef: I,
1987
- isOpen: _,
1988
- closePopover: Be,
1989
- openPopover: un,
1990
- ids: me,
1991
- handleVFocusKeyboardControls: pn
1992
- },
1993
- children: e
1994
- }
1995
- );
1996
- }, Qs = ({
1997
- id: e,
1998
- value: t,
1999
- label: n,
2000
- children: s,
2001
- ...r
2002
- }) => {
2003
- const a = ke("hashi-combo-box-item", v()), i = e ?? a, { addItem: d, removeItem: l, getVFocusedItem: c, vFocus: u, selectItem: h } = pe();
2004
- F(() => (d({ id: i, value: t, label: n }), () => l({ id: i, value: t, label: n })), [d, i, l, t, n]);
2005
- const m = c()?.id === i;
2006
- return /* @__PURE__ */ o(
2007
- "li",
2008
- {
2009
- "data-combo-box-item-id": i,
2010
- role: "option",
2011
- "aria-selected": m,
2012
- "data-vfocused": m,
2013
- onClick: () => h({ id: i, value: t, label: n }),
2014
- onMouseEnter: () => u({ id: i, value: t, label: n }),
2015
- ...r,
2016
- children: s
2017
- }
2018
- );
2019
- }, Xs = ({ children: e, className: t }) => {
2020
- const {
2021
- toggleRef: n,
2022
- openPopover: s,
2023
- closePopover: r,
2024
- isOpen: a,
2025
- ids: i,
2026
- handleVFocusKeyboardControls: d,
2027
- searchInputRef: l
2028
- } = pe(), c = (m) => {
2029
- m.stopPropagation(), a ? r() : s();
2030
- }, u = (m) => {
2031
- if ((m.key === "Enter" || m.key === "ArrowDown" || m.key === " ") && a === !1) {
2032
- m.preventDefault(), s();
2033
- return;
2034
- }
2035
- !(l.current !== null) && a && d(m);
2036
- }, h = () => (m) => {
2037
- if (m.relatedTarget?.closest("[data-combo-box-popover]")) return;
2038
- l.current !== null || r();
2039
- };
2040
- return /* @__PURE__ */ o(
2041
- "div",
2042
- {
2043
- role: "combobox",
2044
- onClick: c,
2045
- onKeyDown: u,
2046
- tabIndex: 0,
2047
- ref: n,
2048
- "aria-haspopup": "listbox",
2049
- "aria-expanded": a,
2050
- "aria-controls": i.current.popover,
2051
- className: t,
2052
- onBlur: h(),
2053
- children: e
2054
- }
2055
- );
2056
- }, er = ({
2057
- placeholder: e = "Select an option"
2058
- }) => {
2059
- const { getSelectedItem: t } = pe();
2060
- return /* @__PURE__ */ o(te, { children: t()?.label ?? e });
2061
- }, tr = ({ children: e, className: t }) => {
2062
- const { isOpen: n, ids: s, closePopover: r } = pe();
2063
- return F(() => {
2064
- const a = (i) => {
2065
- !n || i.target.closest("[data-combo-box-popover]") || r();
2066
- };
2067
- return document.addEventListener("click", a), () => {
2068
- document.removeEventListener("click", a);
2069
- };
2070
- }, [n, r]), n ? /* @__PURE__ */ o("div", { id: s.current.popover, "data-combo-box-popover": !0, className: t, children: e }) : null;
2071
- }, nr = ({
2072
- label: e,
2073
- children: t,
2074
- className: n = "",
2075
- maxHeight: s,
2076
- onScroll: r
2077
- }) => {
2078
- const { ids: a, listRef: i } = pe();
2079
- return /* @__PURE__ */ o(
2080
- "ul",
2081
- {
2082
- id: a.current.listbox,
2083
- "aria-label": e,
2084
- role: "listbox",
2085
- tabIndex: -1,
2086
- ref: i,
2087
- className: n,
2088
- style: { maxHeight: s },
2089
- onScroll: r,
2090
- children: t
2091
- }
2092
- );
2093
- }, or = ({
2094
- placeholder: e = "Search",
2095
- value: t,
2096
- onChange: n,
2097
- onBlur: s
2098
- }) => {
2099
- const {
2100
- searchInputRef: r,
2101
- getVFocusedItem: a,
2102
- handleVFocusKeyboardControls: i,
2103
- closePopover: d
2104
- } = pe();
2105
- return /* @__PURE__ */ o(
2106
- qe,
2107
- {
2108
- field: {
2109
- type: "search",
2110
- ref: r,
2111
- autoComplete: "off",
2112
- "aria-haspopup": "listbox",
2113
- "aria-autocomplete": "list",
2114
- role: "combobox",
2115
- "aria-activedescendant": a()?.id ?? "",
2116
- placeholder: e,
2117
- value: t,
2118
- onChange: n,
2119
- onKeyDown: i,
2120
- onBlur: (l) => {
2121
- l.stopPropagation(), !l.relatedTarget?.closest(
2122
- "[data-combo-box-popover]"
2123
- ) && (d(), s?.());
2124
- }
2125
- }
2126
- }
2127
- );
2128
- }, ee = Object.freeze({
2129
- Root: Js,
2130
- Trigger: Xs,
2131
- Popover: tr,
2132
- SearchInput: or,
2133
- List: nr,
2134
- Item: Qs,
2135
- Value: er
2136
- }), sr = "root__yeZ3n", rr = "trigger__CTK51 mds-typography-font-weight-regular", ar = "popover__68RkH", ir = "list__jTTmL", lr = "option__LWP6l", E = {
2137
- root: sr,
2138
- trigger: rr,
2139
- "search-input-wrapper": "search-input-wrapper__JU5Rc",
2140
- popover: ar,
2141
- list: ir,
2142
- option: lr,
2143
- "option-text": "option-text__fWrXg mds-typography-font-weight-regular mds-typography-legacy-body-200",
2144
- "interactive-icon": "interactive-icon__vZiDi",
2145
- "interactive-icon-leading": "interactive-icon-leading__rsHgU",
2146
- "interactive-icon-trailing": "interactive-icon-trailing__oEWQo",
2147
- "interactive-loading-wrapper": "interactive-loading-wrapper__yVz-7"
2148
- }, cr = ({
2149
- children: e,
2150
- onChangeSelectedOption: t,
2151
- onChangeVFocusedOption: n
2152
- }) => /* @__PURE__ */ o(
2153
- ee.Root,
2154
- {
2155
- onChangeSelectedOption: t,
2156
- onChangeVFocusedOption: n,
2157
- children: /* @__PURE__ */ o("div", { className: E.root, children: e })
2158
- }
2159
- ), dr = ({ className: e }) => /* @__PURE__ */ o(ee.Trigger, { className: p(E.trigger, e), children: /* @__PURE__ */ o(ee.Value, {}) }), ur = ({ children: e }) => /* @__PURE__ */ o(ee.Popover, { className: E.popover, children: e }), pr = ({
2160
- placeholder: e = "Search",
2161
- value: t,
2162
- onChange: n,
2163
- onBlur: s
2164
- }) => /* @__PURE__ */ o("div", { className: E["search-input-wrapper"], children: /* @__PURE__ */ o(
2165
- ee.SearchInput,
2166
- {
2167
- placeholder: e,
2168
- value: t,
2169
- onChange: n,
2170
- onBlur: s
2171
- }
2172
- ) }), mr = ({
2173
- label: e,
2174
- children: t,
2175
- className: n,
2176
- maxHeight: s,
2177
- onScroll: r
2178
- }) => /* @__PURE__ */ o(
2179
- ee.List,
2180
- {
2181
- label: e,
2182
- className: p(E.list, n),
2183
- maxHeight: s,
2184
- onScroll: r,
2185
- children: t
2186
- }
2187
- ), hr = ({
2188
- value: e,
2189
- label: t,
2190
- isLoading: n,
2191
- icon: s,
2192
- className: r,
2193
- trailingIcon: a
2194
- }) => /* @__PURE__ */ o(
2195
- ee.Item,
2196
- {
2197
- value: e,
2198
- label: t,
2199
- className: p(E.option, r),
2200
- children: n ? /* @__PURE__ */ g("div", { className: E["interactive-loading-wrapper"], children: [
2201
- /* @__PURE__ */ o(
2202
- "div",
2203
- {
2204
- className: p(
2205
- E["interactive-icon"],
2206
- E["interactive-icon-leading"]
2207
- ),
2208
- children: /* @__PURE__ */ o(T, { name: "loading", isInlineBlock: !1 })
2209
- }
2210
- ),
2211
- /* @__PURE__ */ o("span", { className: E["option-text"], children: t })
2212
- ] }) : /* @__PURE__ */ g(te, { children: [
2213
- s && /* @__PURE__ */ o(
2214
- "span",
2215
- {
2216
- className: p(
2217
- E["interactive-icon"],
2218
- E["interactive-icon-leading"]
2219
- ),
2220
- children: /* @__PURE__ */ o(T, { name: s, isInlineBlock: !1 })
2221
- }
2222
- ),
2223
- /* @__PURE__ */ o("span", { className: E["option-text"], children: t }),
2224
- a && /* @__PURE__ */ o(
2225
- "span",
2226
- {
2227
- className: p(
2228
- E["interactive-icon"],
2229
- E["interactive-icon-trailing"]
2230
- ),
2231
- children: /* @__PURE__ */ o(T, { name: a, isInlineBlock: !1 })
2232
- }
2233
- )
2234
- ] })
2235
- }
2236
- ), ae = Object.freeze({
2237
- Root: cr,
2238
- Trigger: dr,
2239
- Popover: ur,
2240
- /**
2241
- * Note that this only acts as a view layer,
2242
- * it does not participate in the search logic.
2243
- * This is left for the consumer to implement.
2244
- */
2245
- SearchInput: pr,
2246
- List: mr,
2247
- Option: hr
2248
- }), gr = ({
2249
- label: e,
2250
- helperText: t,
2251
- error: n,
2252
- id: s,
2253
- searchProps: r,
2254
- options: a,
2255
- listLabel: i,
2256
- listHeight: d = "240px",
2257
- onScroll: l,
2258
- onChangeSelectedOption: c,
2259
- onChangeVFocusedOption: u,
2260
- onSearchBlur: h,
2261
- ...m
2262
- }) => {
2263
- const _ = v();
2264
- return /* @__PURE__ */ o(
2265
- j,
2266
- {
2267
- label: e,
2268
- helperText: t,
2269
- error: n,
2270
- id: s ?? _,
2271
- layout: "vertical",
2272
- ...m,
2273
- children: /* @__PURE__ */ g(
2274
- ae.Root,
2275
- {
2276
- onChangeSelectedOption: c,
2277
- onChangeVFocusedOption: u,
2278
- children: [
2279
- /* @__PURE__ */ o(ae.Trigger, {}),
2280
- /* @__PURE__ */ g(ae.Popover, { children: [
2281
- r && /* @__PURE__ */ o(
2282
- ae.SearchInput,
2283
- {
2284
- placeholder: r.placeholder,
2285
- value: r.value,
2286
- onChange: r.onChange,
2287
- onBlur: h
2288
- }
2289
- ),
2290
- /* @__PURE__ */ o(
2291
- ae.List,
2292
- {
2293
- label: i,
2294
- maxHeight: d,
2295
- onScroll: l,
2296
- children: a.map((I) => /* @__PURE__ */ o(ae.Option, { ...I }, I.value))
2297
- }
2298
- )
2299
- ] })
2300
- ]
2301
- }
2302
- )
2303
- }
2304
- );
2305
- };
2306
- gr.displayName = "SuperSelectField";
2307
- const _r = "textarea__3MZYV mds-typography-font-weight-regular", fr = "invalid__Q80EM", yr = "medium__G2gPs mds-typography-legacy-body-200", br = "large__0Y-7C mds-typography-legacy-body-300", Pe = {
2308
- textarea: _r,
2309
- invalid: fr,
2310
- medium: yr,
2311
- large: br
2312
- }, vr = ({
2313
- isInvalid: e,
2314
- isLoading: t,
2315
- className: n,
2316
- id: s,
2317
- field: r,
2318
- size: a,
2319
- error: i,
2320
- ...d
2321
- }) => /* @__PURE__ */ o(
2322
- "textarea",
2323
- {
2324
- id: s,
2325
- className: p(
2326
- Pe.textarea,
2327
- Pe[a],
2328
- {
2329
- [Pe.invalid]: e
2330
- },
2331
- n
2332
- ),
2333
- "aria-describedby": `${i ? "error" : "helper-text"}-${s}`,
2334
- ...r,
2335
- ...d
2336
- }
2337
- ), Nr = ({
2338
- isInvalid: e,
2339
- isLoading: t,
2340
- isRequired: n,
2341
- isOptional: s,
2342
- id: r,
2343
- label: a,
2344
- helperText: i,
2345
- error: d,
2346
- field: l,
2347
- size: c = "medium",
2348
- ...u
2349
- }) => {
2350
- const h = v(), m = r ?? h;
2351
- return /* @__PURE__ */ o(
2352
- j,
2353
- {
2354
- label: a,
2355
- helperText: i,
2356
- error: d,
2357
- isRequired: n,
2358
- isOptional: s,
2359
- id: m,
2360
- layout: "vertical",
2361
- children: /* @__PURE__ */ o(
2362
- vr,
2363
- {
2364
- id: m,
2365
- isInvalid: e,
2366
- isLoading: t,
2367
- required: n,
2368
- field: l,
2369
- size: c,
2370
- ...u
2371
- }
2372
- )
2373
- }
2374
- );
2375
- };
2376
- Nr.displayName = "TextAreaField";
2377
- const wr = "toggle__PmDvt", Ir = "control__GLB77", xr = "facade__-n7d2", Fe = {
2378
- toggle: wr,
2379
- control: Ir,
2380
- facade: xr
2381
- }, Kt = ({
2382
- id: e,
2383
- field: t,
2384
- toggleOnEnter: n,
2385
- testingKey: s,
2386
- error: r,
2387
- ...a
2388
- }) => {
2389
- const i = v(), d = e ?? i, l = (c) => {
2390
- c.key === "Enter" && (c.currentTarget.checked = !c.currentTarget.checked);
2391
- };
2392
- return /* @__PURE__ */ g("div", { className: Fe.toggle, children: [
2393
- /* @__PURE__ */ o(
2394
- "input",
2395
- {
2396
- id: d,
2397
- className: Fe.control,
2398
- type: "checkbox",
2399
- ...t,
2400
- ...a,
2401
- role: "switch",
2402
- "aria-describedby": `${r ? "error" : "helper-text"}-${e}`,
2403
- onKeyDown: n ? l : void 0,
2404
- "data-testid": s
2405
- }
2406
- ),
2407
- /* @__PURE__ */ o("div", { className: Fe.facade })
2408
- ] });
2409
- };
2410
- Kt.displayName = "ToggleBase";
2411
- const Ut = ({
2412
- isInvalid: e,
2413
- isRequired: t,
2414
- isOptional: n,
2415
- id: s,
2416
- label: r,
2417
- helperText: a,
2418
- error: i,
2419
- field: d,
2420
- className: l,
2421
- testingKey: c,
2422
- ...u
2423
- }) => {
2424
- const h = v(), m = s ?? h;
2425
- return /* @__PURE__ */ o(
2426
- j,
2427
- {
2428
- label: r,
2429
- helperText: a,
2430
- error: i,
2431
- isRequired: t,
2432
- isOptional: n,
2433
- id: m,
2434
- layout: "flag",
2435
- className: l,
2436
- children: /* @__PURE__ */ o(
2437
- Kt,
2438
- {
2439
- id: m,
2440
- field: d,
2441
- testingKey: c,
2442
- ...u
2443
- }
2444
- )
2445
- }
2446
- );
2447
- };
2448
- Ut.displayName = "ToggleField";
2449
- const jt = ({
2450
- layout: e = "vertical",
2451
- legend: t,
2452
- isOptional: n,
2453
- isRequired: s,
2454
- children: r
2455
- }) => /* @__PURE__ */ o(
2456
- ve,
2457
- {
2458
- layout: e,
2459
- legend: t,
2460
- isOptional: n,
2461
- isRequired: s,
2462
- children: r
2463
- }
2464
- );
2465
- jt.displayName = "ToggleGroupRoot";
2466
- const qt = (e) => /* @__PURE__ */ o(Ut, { ...e, className: e.className });
2467
- qt.displayName = "ToggleGroupField";
2468
- const Ai = {
2469
- Root: jt,
2470
- Field: qt
2471
- }, Cr = "icon__aQOfk", kr = "logo__3zBXv", Lr = "extra__5VSha", J = {
2472
- "icon-tile": "icon-tile__8Lxip",
2473
- icon: Cr,
2474
- logo: kr,
2475
- extra: Lr,
2476
- "size-small": "size-small__eKjTy",
2477
- "size-medium": "size-medium__Cpd2c",
2478
- "size-large": "size-large__0nIKA",
2479
- "type-logo": "type-logo__bXQnG",
2480
- "type-icon": "type-icon__DoyiK",
2481
- "color-neutral": "color-neutral__s-i4y",
2482
- "color-boundary": "color-boundary__TWXib",
2483
- "color-consul": "color-consul__qHXGr",
2484
- "color-hcp": "color-hcp__T1Cpx",
2485
- "color-nomad": "color-nomad__OPKVc",
2486
- "color-packer": "color-packer__VbjYn",
2487
- "color-terraform": "color-terraform__CzLAd",
2488
- "color-vagrant": "color-vagrant__GMAgE",
2489
- "color-vault": "color-vault__yHn5Z",
2490
- "color-vault-secrets": "color-vault-secrets__GiX0y",
2491
- "color-waypoint": "color-waypoint__YASrb"
2492
- }, $r = {
2493
- small: 12,
2494
- medium: 16,
2495
- large: 16
2496
- }, Tr = ({
2497
- size: e = "medium",
2498
- logo: t,
2499
- icon: n,
2500
- iconSecondary: s,
2501
- color: r = "neutral",
2502
- ...a
2503
- }) => {
2504
- const i = t ? `${t}-color` : n;
2505
- if (i) {
2506
- const d = e === "small" ? 16 : 24, l = t ? "logo" : "icon", c = t || r;
2507
- return /* @__PURE__ */ g(
2508
- "div",
2509
- {
2510
- className: p(
2511
- J["icon-tile"],
2512
- J[`type-${l}`],
2513
- J[`size-${e}`],
2514
- J[`color-${c}`]
2515
- ),
2516
- "aria-hidden": "true",
2517
- ...a,
2518
- children: [
2519
- /* @__PURE__ */ o("div", { className: t ? J.logo : J.icon, children: /* @__PURE__ */ o(T, { name: i, size: d, stretched: !0 }) }),
2520
- s && /* @__PURE__ */ o("div", { className: J.extra, children: /* @__PURE__ */ o(
2521
- T,
2522
- {
2523
- name: s,
2524
- size: $r[e],
2525
- color: "var(--mds-color-foreground-strong)"
2526
- }
2527
- ) })
2528
- ]
2529
- }
2530
- );
2531
- }
2532
- };
2533
- Tr.displayName = "IconTile";
2534
- const Sr = "icon__CPQmv", Oe = {
2535
- "link-inline": "link-inline__Wl8cA",
2536
- "color-primary": "color-primary__XlogH",
2537
- "color-secondary": "color-secondary__sf-Wg",
2538
- icon: Sr
2539
- }, Er = ({
2540
- text: e,
2541
- color: t = "primary",
2542
- icon: n,
2543
- iconPosition: s = "trailing",
2544
- className: r,
2545
- isHrefExternal: a,
2546
- ...i
2547
- }) => {
2548
- const d = n || !a ? n : "external-link", l = d && /* @__PURE__ */ o(T, { name: d, size: 16, className: Oe.icon });
2549
- return /* @__PURE__ */ g(
2550
- ft,
2551
- {
2552
- className: p(Oe["link-inline"], Oe[`color-${t}`], r),
2553
- ...i,
2554
- children: [
2555
- l && s === "leading" && l,
2556
- e,
2557
- l && s === "trailing" && l
2558
- ]
2559
- }
2560
- );
2561
- };
2562
- Er.displayName = "InlineLink";
2563
- function at(e) {
2564
- const t = e?.variant ? e.variant : "primary";
2565
- if (t === "primary")
2566
- switch (e?.brand) {
2567
- case "hashicorp":
2568
- return "primary";
2569
- case "boundary":
2570
- case "consul":
2571
- case "nomad":
2572
- case "packer":
2573
- case "terraform":
2574
- case "vagrant":
2575
- case "vault":
2576
- case "waypoint":
2577
- return e.brand;
2578
- case "neutral":
2579
- return "secondary-high-contrast";
2580
- default:
2581
- return "primary";
2582
- }
2583
- if (t === "secondary")
2584
- return "secondary";
2585
- if (t === "tertiary" || t === "tertiary-neutral" || t === "ghost")
2586
- return "tertiary";
2587
- throw new Error(
2588
- `Unable to determine HDS Button color from theme: ${JSON.stringify(e)}`
2589
- );
2590
- }
2591
- const it = {
2592
- inbound: "arrow-right",
2593
- outbound: "external-link",
2594
- download: "download",
2595
- anchor: "anchor"
2596
- }, ze = ht(
2597
- ({
2598
- locale: e,
2599
- text: t,
2600
- title: n,
2601
- url: s,
2602
- href: r,
2603
- linkType: a,
2604
- onClick: i,
2605
- external: d,
2606
- className: l,
2607
- size: c,
2608
- icon: u,
2609
- iconPosition: h = "trailing",
2610
- label: m,
2611
- disabled: _,
2612
- type: y,
2613
- theme: I,
2614
- ...H
2615
- }, D) => at(I) === "tertiary" ? /* @__PURE__ */ o(
2616
- _t,
2617
- {
2618
- text: t || n,
2619
- color: I?.background === "dark" ? "secondary-inverted" : "secondary",
2620
- href: s || r,
2621
- icon: a ? it[a] : u,
2622
- iconPosition: a ? "trailing" : h,
2623
- className: l,
2624
- onClick: i,
2625
- size: c,
2626
- isHrefExternal: a === "outbound" || d,
2627
- ref: D,
2628
- locale: e
2629
- }
2630
- ) : /* @__PURE__ */ o(
2631
- gt,
2632
- {
2633
- text: t || n,
2634
- href: s || r,
2635
- isHrefExternal: a === "outbound" || d,
2636
- color: at(I),
2637
- type: y,
2638
- icon: a ? it[a] : u,
2639
- iconPosition: a ? "trailing" : h,
2640
- onClick: i,
2641
- className: l,
2642
- size: c === "small" ? "medium" : "large",
2643
- "aria-label": m,
2644
- disabled: _,
2645
- ref: D,
2646
- locale: e,
2647
- ...H
2648
- }
2649
- )
2650
- );
2651
- ze.displayName = "MDSButton";
2652
- const Br = "wrapper__Hnt2o", Ar = "dismiss__hfQfE", Pr = "overlay__cUa2F", Re = {
2653
- wrapper: Br,
2654
- dismiss: Ar,
2655
- overlay: Pr
2656
- }, Fr = ({ className: e }) => /* @__PURE__ */ o("div", { className: p(Re.overlay, e) }), Or = ({ children: e, className: t, onDismiss: n, ...s }) => /* @__PURE__ */ g("dialog", { className: p(Re.wrapper, t), ...s, children: [
2657
- /* @__PURE__ */ o(vt, { onClick: n, className: Re.dismiss }),
2658
- e
2659
- ] }), lt = {
2660
- Overlay: Fr,
2661
- Wrapper: Or
2662
- }, Ze = de(
2663
- void 0
2664
- );
2665
- Ze.displayName = "ModalContext";
2666
- function Pi() {
2667
- const e = ue(Ze);
2668
- if (e === void 0)
2669
- throw new Error("useModal must be used within a ModalContext.Provider");
2670
- return e;
2671
- }
2672
- const Dr = "modal__Mao59", zr = {
2673
- modal: Dr
2674
- }, Rr = ({
2675
- onClose: e,
2676
- initialIsOpen: t = !1,
2677
- initialModalContent: n = null,
2678
- children: s
2679
- }) => {
2680
- const [r, a] = k(
2681
- n
2682
- ), [i, d] = k(t), l = b(() => {
2683
- d(!1), a(null), e && e();
2684
- }, [d, e]), c = b(
2685
- (h) => {
2686
- a(h), d(!0);
2687
- },
2688
- [d]
2689
- ), u = V(
2690
- () => ({
2691
- isOpen: i,
2692
- openModal: c,
2693
- modalContent: r,
2694
- closeModal: l
2695
- }),
2696
- [i, c, l, r]
2697
- );
2698
- return F(() => {
2699
- const h = (m) => {
2700
- m.key === "Escape" && i && l();
2701
- };
2702
- return i && window.addEventListener("keydown", h), () => {
2703
- i && window.removeEventListener("keydown", h);
2704
- };
2705
- }, [i, l]), /* @__PURE__ */ g(Ze.Provider, { value: u, children: [
2706
- s,
2707
- i && r && /* @__PURE__ */ g(te, { children: [
2708
- /* @__PURE__ */ o(bn, { children: /* @__PURE__ */ o(
2709
- lt.Wrapper,
2710
- {
2711
- onDismiss: l,
2712
- className: zr.modal,
2713
- open: i,
2714
- children: r
2715
- }
2716
- ) }),
2717
- /* @__PURE__ */ o(lt.Overlay, {})
2718
- ] })
2719
- ] });
2720
- };
2721
- Rr.displayName = "ModalProvider";
2722
- const Vr = "separator__Qz7bd", ct = {
2723
- separator: Vr,
2724
- "spacing-24": "spacing-24__5hcla",
2725
- "spacing-0": "spacing-0__W5NO0"
2726
- }, Mr = ({ spacing: e = "24", className: t, ...n }) => /* @__PURE__ */ o(
2727
- "hr",
2728
- {
2729
- className: p(ct.separator, ct[`spacing-${e}`], t),
2730
- ...n
2731
- }
2732
- );
2733
- Mr.displayName = "Separator";
2734
- const Zt = "medium", Hr = ["default", "medium", "short", "tall"], Fi = (e) => {
2735
- const t = e;
2736
- return Hr.includes(t) ? t : Zt;
2737
- }, Yt = "top", Gr = ["baseline", "middle", "top"], Oi = (e) => {
2738
- const t = e;
2739
- return Gr.includes(t) ? t : Yt;
2740
- }, Ye = "left", Wr = ["left", "center", "right"], Di = (e) => {
2741
- const t = e;
2742
- return Wr.includes(t) ? t : Ye;
2743
- }, Jt = "col", Kr = ["col", "row"], zi = (e) => {
2744
- const t = e;
2745
- return Kr.includes(t) ? t : Jt;
2746
- }, Ur = "table__tdU5g", jr = "striped__MBMc-", qr = "tbody__W5bOI", Zr = "tr__xeZno", Yr = "th__GQbKk", Jr = "td__WktB5", Qr = "content__Js-E8", Xr = "thead__3-vDU", $ = {
2747
- table: Ur,
2748
- "layout-fixed": "layout-fixed__9PpwJ",
2749
- striped: jr,
2750
- tbody: qr,
2751
- tr: Zr,
2752
- "density-short": "density-short__7tyZx",
2753
- "density-medium": "density-medium__nmuYV",
2754
- "density-tall": "density-tall__2N9i0",
2755
- "valign-top": "valign-top__SRqQY",
2756
- "valign-middle": "valign-middle__kSfMx",
2757
- "valign-baseline": "valign-baseline__UFJwd",
2758
- th: Yr,
2759
- td: Jr,
2760
- "align-center": "align-center__vOTTL",
2761
- content: Qr,
2762
- "align-right": "align-right__3vUHD",
2763
- thead: Xr,
2764
- "th-button": "th-button__drg-o",
2765
- "aria-label-hidden-segment": "aria-label-hidden-segment__oQhN8"
2766
- }, Qt = ({
2767
- align: e = Ye,
2768
- children: t,
2769
- className: n,
2770
- ...s
2771
- }) => /* @__PURE__ */ o(
2772
- "td",
2773
- {
2774
- className: p(
2775
- $.td,
2776
- $[`align-${e}`],
2777
- "mds-typography-legacy-body-200",
2778
- "mds-typography-font-weight-regular",
2779
- n
2780
- ),
2781
- ...s,
2782
- children: /* @__PURE__ */ o("div", { className: $.content, children: t })
2783
- }
2784
- );
2785
- Qt.displayName = "B.Td";
2786
- const dt = {
2787
- name: "hideOnEsc",
2788
- defaultValue: !0,
2789
- fn(e) {
2790
- function t(n) {
2791
- n.key === "Escape" && e.hide();
2792
- }
2793
- return {
2794
- onShow() {
2795
- document.addEventListener("keydown", t);
2796
- },
2797
- onHide() {
2798
- document.removeEventListener("keydown", t);
2799
- }
2800
- };
2801
- }
2802
- }, ea = ({ options: e = {}, children: t, text: n }) => {
2803
- const s = e.followCursor !== void 0 ? [dt, Nn] : [dt];
2804
- return /* @__PURE__ */ o(
2805
- vn,
2806
- {
2807
- theme: "hds",
2808
- arrow: `<svg
2809
- className="hds-tooltip-pointer"
2810
- width="16"
2811
- height="7"
2812
- viewBox="0 0 16 7"
2813
- xmlns="http://www.w3.org/2000/svg"
2814
- >
2815
- <path d="M0 7H16L9.11989 0.444571C8.49776 -0.148191 7.50224 -0.148191 6.88011 0.444572L0 7Z" />
2816
- </svg>`,
2817
- interactive: !0,
2818
- aria: {
2819
- content: "describedby"
2820
- },
2821
- plugins: s,
2822
- content: n,
2823
- ...e,
2824
- children: t
2825
- }
2826
- );
2827
- }, ta = ({ tooltip: e, labelId: t }) => {
2828
- const n = v();
2829
- return /* @__PURE__ */ o(ea, { text: e, children: /* @__PURE__ */ g(
2830
- "button",
2831
- {
2832
- type: "button",
2833
- className: $["th-button"],
2834
- "aria-labelledby": `${n} ${t}`,
2835
- children: [
2836
- /* @__PURE__ */ o("span", { id: n, className: $["aria-label-hidden-segment"], children: "More information for" }),
2837
- /* @__PURE__ */ o(T, { name: "info" })
2838
- ]
2839
- }
2840
- ) });
2841
- }, Xt = ({
2842
- align: e = Ye,
2843
- width: t,
2844
- scope: n = Jt,
2845
- tooltip: s,
2846
- isVisuallyHidden: r,
2847
- children: a,
2848
- className: i,
2849
- ...d
2850
- }) => {
2851
- const l = v();
2852
- let c;
2853
- return r ? c = /* @__PURE__ */ o("span", { className: "sr-only", children: a }) : s ? c = /* @__PURE__ */ g("div", { className: $.content, children: [
2854
- /* @__PURE__ */ o("span", { id: l, children: a }),
2855
- /* @__PURE__ */ o(ta, { tooltip: s, labelId: l })
2856
- ] }) : c = /* @__PURE__ */ o("div", { className: $.content, children: a }), /* @__PURE__ */ o(
2857
- "th",
2858
- {
2859
- className: p(
2860
- $.th,
2861
- $[`align-${e}`],
2862
- "mds-typography-legacy-body-200",
2863
- "mds-typography-font-weight-semibold",
2864
- i
2865
- ),
2866
- style: t ? { width: t, minWidth: t } : {},
2867
- ...d,
2868
- scope: n,
2869
- children: c
2870
- }
2871
- );
2872
- };
2873
- Xt.displayName = "H.TH";
2874
- const en = ({ children: e, className: t, ...n }) => /* @__PURE__ */ o("tr", { className: p($.tr, t), ...n, children: e });
2875
- en.displayName = "T.TR";
2876
- function tn({
2877
- caption: e,
2878
- density: t = Zt,
2879
- valign: n = Yt,
2880
- isStriped: s,
2881
- isFixedLayout: r,
2882
- children: a,
2883
- className: i,
2884
- ...d
2885
- }) {
2886
- return /* @__PURE__ */ g(
2887
- "table",
2888
- {
2889
- className: p(
2890
- $.table,
2891
- $[`density-${t}`],
2892
- $[`valign-${n}`],
2893
- {
2894
- [$.striped]: s,
2895
- [$["layout-fixed"]]: r
2896
- },
2897
- i
2898
- ),
2899
- ...d,
2900
- children: [
2901
- e && /* @__PURE__ */ o("caption", { className: "sr-only", children: e }),
2902
- a
2903
- ]
2904
- }
2905
- );
2906
- }
2907
- tn.displayName = "Table";
2908
- function nn({ children: e }) {
2909
- return /* @__PURE__ */ o("thead", { className: $.thead, children: e });
2910
- }
2911
- nn.displayName = "T.Head";
2912
- function on({ children: e }) {
2913
- return /* @__PURE__ */ o("tbody", { className: $.tbody, children: e });
2914
- }
2915
- on.displayName = "T.Body";
2916
- const Ri = { Root: tn, TR: en, THead: nn, TH: Xt, TBody: on, TD: Qt }, sn = de(
2917
- void 0
2918
- );
2919
- function Ne() {
2920
- const e = ue(sn);
2921
- if (e === void 0)
2922
- throw new Error("useTabsContext must be used within a TabsContext.Provider");
2923
- return e;
2924
- }
2925
- const na = "tablist__sKiEs", oa = "tab__qi523", sa = "primary__iGc9C", ra = "selected__SVr0E", aa = "indicator__OHxre", ia = "secondary__qlHsL", la = "panel__G8tI0", K = {
2926
- "tablist-wrapper": "tablist-wrapper__nF28e",
2927
- tablist: na,
2928
- tab: oa,
2929
- primary: sa,
2930
- selected: ra,
2931
- indicator: aa,
2932
- secondary: ia,
2933
- "tab-button": "tab-button__qI9wt",
2934
- panel: la
2935
- }, ca = ({ children: e, className: t, ...n }) => {
2936
- const { panelIds: s, tabIds: r, selectedTabIndex: a, panelNodes: i } = Ne(), d = "panel-" + v(), l = V(
2937
- () => s.indexOf(d),
2938
- [s, d]
2939
- ), c = V(
2940
- () => l > -1 ? r[l] : void 0,
2941
- [r, l]
2942
- ), u = V(
2943
- () => l === a,
2944
- [l, a]
2945
- );
2946
- return /* @__PURE__ */ o(
2947
- "section",
2948
- {
2949
- className: p(K.panel, t),
2950
- ...n,
2951
- role: "tabpanel",
2952
- "aria-labelledby": c,
2953
- id: d,
2954
- hidden: !u,
2955
- ref: (h) => i.current.push(h),
2956
- children: e
2957
- }
2958
- );
2959
- }, da = ({
2960
- count: e,
2961
- icon: t,
2962
- isSelected: n,
2963
- children: s,
2964
- className: r,
2965
- trackingKey: a,
2966
- tabIndicatorTheme: i = "primary",
2967
- ...d
2968
- }) => {
2969
- const { tabNodes: l, tabIds: c, selectedTabIndex: u, onClick: h, onKeyUp: m, size: _ } = Ne(), y = "tab-" + v(), I = V(() => c.indexOf(y), [c, y]), H = V(
2970
- () => I === u,
2971
- [I, u]
2972
- );
2973
- return /* @__PURE__ */ o(
2974
- "li",
2975
- {
2976
- className: p(
2977
- K.tab,
2978
- K[i],
2979
- {
2980
- [K.selected]: H
2981
- },
2982
- r
2983
- ),
2984
- ...d,
2985
- role: "presentation",
2986
- children: /* @__PURE__ */ g(
2987
- "button",
2988
- {
2989
- className: p(
2990
- K["tab-button"],
2991
- "mds-typography-font-weight-medium",
2992
- {
2993
- "mds-typography-legacy-body-200": _ === "medium",
2994
- "mds-typography-legacy-body-300": _ === "large"
2995
- }
2996
- ),
2997
- role: "tab",
2998
- type: "button",
2999
- id: y,
3000
- "aria-selected": H,
3001
- tabIndex: H ? void 0 : -1,
3002
- onClick: (D) => h(I, D),
3003
- onKeyUp: (D) => m(I, D),
3004
- "data-is-selected": n,
3005
- "data-analytics": a,
3006
- ref: (D) => l.current.push(D),
3007
- children: [
3008
- t && /* @__PURE__ */ o(T, { name: t, size: 16, role: "presentation" }),
3009
- s,
3010
- e && /* @__PURE__ */ o(He, { text: e, size: "small", role: "presentation" })
3011
- ]
3012
- }
3013
- )
3014
- }
3015
- );
3016
- }, ua = ({
3017
- children: e,
3018
- onClickTab: t,
3019
- initialSelectedTabIndex: n = 0,
3020
- size: s = "medium",
3021
- className: r,
3022
- ...a
3023
- }) => {
3024
- const [i, d] = k(
3025
- n
3026
- ), l = A([]), c = A([]), [u, h] = k([]), [m, _] = k([]), [y, I] = k(0), [H, D] = k(0), q = A(null), ne = b((N) => {
3027
- const w = l.current[N]?.parentNode;
3028
- w && w.scrollIntoView({
3029
- behavior: "smooth",
3030
- block: "nearest",
3031
- inline: "nearest"
3032
- });
3033
- }, []);
3034
- F(() => {
3035
- d(n);
3036
- }, [n]), F(() => {
3037
- const N = l.current[i]?.parentElement;
3038
- if (N && q.current) {
3039
- const w = N.offsetLeft, P = N.offsetWidth;
3040
- D(w), I(P), q.current.scrollTo({
3041
- left: w,
3042
- behavior: "smooth"
3043
- });
3044
- }
3045
- }, [l, i, ne, q]), F(() => {
3046
- h(l.current.map((P) => P.id));
3047
- let N = 0, w = 0;
3048
- if (l.current.forEach((P, oe) => {
3049
- P.hasAttribute("data-is-selected") && (N = oe, w++);
3050
- }), w > 1)
3051
- throw new Error("Only one tab may use isSelected argument");
3052
- d(N);
3053
- }, [l]), F(() => {
3054
- _(c.current.map((N) => N.id));
3055
- }, [c]);
3056
- const G = b(
3057
- (N, w) => {
3058
- d(N), ne(N), typeof t == "function" && t(w, N);
3059
- },
3060
- [t, ne]
3061
- ), me = b(
3062
- (N, w) => {
3063
- w.preventDefault(), l.current[N].focus();
3064
- },
3065
- []
3066
- ), W = b(
3067
- (N, w) => {
3068
- const P = "ArrowLeft", oe = "ArrowRight", Se = "Enter", Ee = " ";
3069
- if (w.key === oe) {
3070
- const he = (N + 1) % u.length;
3071
- me(he, w);
3072
- } else if (w.key === P) {
3073
- const he = (N + u.length - 1) % u.length;
3074
- me(he, w);
3075
- } else (w.key === Se || w.key === Ee) && d(N);
3076
- },
3077
- [me, u.length]
3078
- ), we = V(
3079
- () => ({
3080
- tabNodes: l,
3081
- tabIds: u,
3082
- panelNodes: c,
3083
- panelIds: m,
3084
- selectedTabIndex: i,
3085
- onClick: G,
3086
- onKeyUp: W,
3087
- size: s,
3088
- tabsListRef: q
3089
- }),
3090
- [
3091
- l,
3092
- u,
3093
- c,
3094
- m,
3095
- i,
3096
- G,
3097
- W,
3098
- s,
3099
- q
3100
- ]
3101
- );
3102
- return /* @__PURE__ */ o(sn.Provider, { value: we, children: /* @__PURE__ */ o(
3103
- "div",
3104
- {
3105
- className: p(K.tabs, r),
3106
- ...a,
3107
- style: {
3108
- "--indicator-left-pos": `${H}px`,
3109
- "--indicator-width": `${y}px`
3110
- },
3111
- children: e
3112
- }
3113
- ) });
3114
- }, pa = ({ children: e, className: t }) => {
3115
- const { tabsListRef: n } = Ne();
3116
- return /* @__PURE__ */ o("div", { className: p(K["tablist-wrapper"], t), children: /* @__PURE__ */ g("ul", { className: K.tablist, role: "tablist", ref: n, children: [
3117
- e,
3118
- /* @__PURE__ */ o("li", { className: K.indicator, role: "presentation" })
3119
- ] }) });
3120
- }, ce = { Provider: ua, TabList: pa, Panel: ca, Tab: da }, rn = (e) => (e.r * 299 + e.g * 587 + e.b * 114) / 1e3 >= 192 ? "dark" : "light", an = (e) => {
3121
- const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
3122
- return t ? {
3123
- r: parseInt(t[1], 16),
3124
- g: parseInt(t[2], 16),
3125
- b: parseInt(t[3], 16)
3126
- } : { r: 0, g: 0, b: 0 };
3127
- }, ma = "datasetValue__7Cgnp", ha = "datasetValueBar__XH-zW", ga = "datasetValuePercent__5-Ofn", _a = "offset__5sIB1", fa = "stackable__EL-7z", ya = "light__bf-WO", ba = "dark__grmLH", ie = {
3128
- datasetValue: ma,
3129
- datasetValueBar: ha,
3130
- datasetValuePercent: ga,
3131
- offset: _a,
3132
- stackable: fa,
3133
- light: ya,
3134
- dark: ba
3135
- };
3136
- function va({
3137
- value: e,
3138
- highestValue: t,
3139
- color: n,
3140
- stackable: s
3141
- }) {
3142
- const [r, a] = k(!1), { ref: i } = yt({
3143
- onResize: ({ width: c }) => {
3144
- e === 0 && (e = 0.5);
3145
- let u = 32;
3146
- e >= 10 && e <= 99 ? u = 40 : e >= 100 && (u = 48), c && c < u ? a(!0) : a(!1);
3147
- }
3148
- }), d = rn(an(n)), l = e / t * 100;
3149
- return /* @__PURE__ */ g(
3150
- "div",
3151
- {
3152
- ref: i,
3153
- className: p(ie.datasetValue, ie[d]),
3154
- style: {
3155
- "--width": l
3156
- },
3157
- children: [
3158
- /* @__PURE__ */ o(
3159
- "div",
3160
- {
3161
- className: ie.datasetValueBar,
3162
- style: {
3163
- "--bar-background": n
3164
- }
3165
- }
3166
- ),
3167
- /* @__PURE__ */ g(
3168
- X.Body,
3169
- {
3170
- tag: "span",
3171
- size: "200",
3172
- className: p(ie.datasetValuePercent, {
3173
- [ie.offset]: r,
3174
- [ie.stackable]: s
3175
- }),
3176
- children: [
3177
- e,
3178
- "%"
3179
- ]
3180
- }
3181
- )
3182
- ]
3183
- }
3184
- );
3185
- }
3186
- const Na = "keyWrapper__g36GJ", wa = "key__EbmRa", Ia = "dot__S1lki", xa = "name__L7cad mds-typography-body-200", fe = {
3187
- keyWrapper: Na,
3188
- key: wa,
3189
- dot: Ia,
3190
- name: xa
3191
- };
3192
- function Ca({ keys: e, className: t }) {
3193
- return /* @__PURE__ */ o("div", { className: p(fe.legend, t), children: /* @__PURE__ */ o("div", { className: fe.keyWrapper, children: e.map(({ label: n, color: s }) => /* @__PURE__ */ g("div", { className: fe.key, children: [
3194
- /* @__PURE__ */ o("div", { className: fe.dot, style: { background: s } }),
3195
- /* @__PURE__ */ o("span", { className: fe.name, children: n })
3196
- ] }, n)) }) });
3197
- }
3198
- const ka = "barChart__uC3IV", La = "chart__uI9kg", $a = "dataset__13eXi", Ta = "datasetLabel__HjzY7 mds-typography-body-200", Sa = "datasetValues__HZ-9o", Ea = "datasetValuesStacked__og5RC", Ba = "datasetTotal__0BJyu", Aa = "datasetTotalText__-0bYa", Pa = "datasetTotalPercent__vCmWD", Fa = "showAllButton__bY4-d", Oa = "legend__-b7yq", z = {
3199
- barChart: ka,
3200
- chart: La,
3201
- dataset: $a,
3202
- datasetLabel: Ta,
3203
- datasetValues: Sa,
3204
- datasetValuesStacked: Ea,
3205
- datasetTotal: Ba,
3206
- datasetTotalText: Aa,
3207
- datasetTotalPercent: Pa,
3208
- showAllButton: Fa,
3209
- legend: Oa
3210
- };
3211
- function Da({
3212
- categories: e,
3213
- datasets: t,
3214
- // Default this to virtually unlimited
3215
- maxInitialDatasets: n = 999,
3216
- stacked: s = !1
3217
- }) {
3218
- const r = In("(min-width: 560px)"), a = t.length > n, [i, d] = k(a), l = V(() => i ? t.slice(0, n) : t, [i, t, n]), c = V(() => {
3219
- let u = 0;
3220
- return t.forEach((h) => {
3221
- if (s) {
3222
- const m = ut(h.values);
3223
- r ? m > u && (u = m) : h.values.forEach(({ value: _ }) => {
3224
- _ > u && (u = _);
3225
- });
3226
- } else
3227
- h.values.forEach(({ value: m }) => {
3228
- m > u && (u = m);
3229
- });
3230
- }), u;
3231
- }, [t, r]);
3232
- return /* @__PURE__ */ g("div", { className: z.barChart, children: [
3233
- /* @__PURE__ */ o("div", { className: z.chart, children: l.map((u) => /* @__PURE__ */ g("div", { className: z.dataset, children: [
3234
- /* @__PURE__ */ o("div", { className: z.datasetLabel, children: /* @__PURE__ */ o(wn, { children: u.label }) }),
3235
- /* @__PURE__ */ g(
3236
- "div",
3237
- {
3238
- className: p(z.datasetValues, {
3239
- [z.datasetValuesStacked]: s
3240
- }),
3241
- children: [
3242
- u.values.map(({ value: h, color: m }, _) => /* @__PURE__ */ o(
3243
- va,
3244
- {
3245
- value: h,
3246
- highestValue: c,
3247
- color: m,
3248
- stackable: s
3249
- },
3250
- `dataset-${u.label}-${h}-${_}`
3251
- )),
3252
- s ? /* @__PURE__ */ o("div", { children: /* @__PURE__ */ g(X.Body, { size: "200", tag: "p", className: z.datasetTotal, children: [
3253
- /* @__PURE__ */ o("span", { className: z.datasetTotalText, children: "Total:" }),
3254
- /* @__PURE__ */ g("span", { className: z.datasetTotalPercent, children: [
3255
- u.total || ut(u.values),
3256
- "%"
3257
- ] })
3258
- ] }) }) : null
3259
- ]
3260
- }
3261
- )
3262
- ] }, u.label)) }),
3263
- a && (i ? /* @__PURE__ */ o(
3264
- ze,
3265
- {
3266
- className: z.showAllButton,
3267
- title: "Show all",
3268
- theme: {
3269
- brand: "neutral",
3270
- variant: "secondary",
3271
- background: "light"
3272
- },
3273
- onClick: () => d(!1)
3274
- }
3275
- ) : /* @__PURE__ */ o(
3276
- ze,
3277
- {
3278
- className: z.showAllButton,
3279
- title: "Show less",
3280
- theme: {
3281
- brand: "neutral",
3282
- variant: "secondary",
3283
- background: "light"
3284
- },
3285
- onClick: () => d(!0)
3286
- }
3287
- )),
3288
- e && e.length > 1 && /* @__PURE__ */ o(Ca, { className: z.legend, keys: e })
3289
- ] });
3290
- }
3291
- function ut(e) {
3292
- return e.reduce(
3293
- (n, s) => ({ value: n.value + s.value, color: "" }),
3294
- {
3295
- value: 0,
3296
- color: ""
3297
- }
3298
- ).value;
3299
- }
3300
- const za = "chartContainer__6A5KV", Ra = "multiple__rU9qF", Va = "caption__F3uLb", le = {
3301
- chartContainer: za,
3302
- multiple: Ra,
3303
- caption: Va
3304
- }, Ma = ({ data: e }) => /* @__PURE__ */ o("div", { className: le.root, children: e.length > 1 ? /* @__PURE__ */ g(ce.Provider, { size: "large", children: [
3305
- /* @__PURE__ */ o(ce.TabList, { children: e.map((t, n) => /* @__PURE__ */ o(ce.Tab, { className: le.tab, children: t.name }, n)) }),
3306
- /* @__PURE__ */ o(Ha, { data: e })
3307
- ] }) : /* @__PURE__ */ o(ln, { data: e }) });
3308
- Ma.displayName = "BarChart";
3309
- const Ha = ({ data: e }) => {
3310
- const { selectedTabIndex: t, tabIds: n } = Ne(), s = n[t];
3311
- return /* @__PURE__ */ o(ln, { tabId: s, data: e, chartIndex: t });
3312
- }, ln = ({ tabId: e, data: t, chartIndex: n = 0 }) => {
3313
- const s = t[n].name;
3314
- return /* @__PURE__ */ g(
3315
- "figure",
3316
- {
3317
- className: p(le.chartContainer, t.length > 1 && le.multiple),
3318
- id: s.toLowerCase(),
3319
- role: "tabpanel",
3320
- tabIndex: 0,
3321
- "aria-label": e ? void 0 : s,
3322
- "aria-labelledby": e || void 0,
3323
- children: [
3324
- /* @__PURE__ */ o(Da, { ...t[n] }),
3325
- /* @__PURE__ */ o("div", { className: le.chart, children: t[n].caption && /* @__PURE__ */ o("figcaption", { className: le.caption, children: t[n].caption }) })
3326
- ]
3327
- }
3328
- );
3329
- }, Ga = "container__BPIK5", Wa = "label__oFZK-", pt = {
3330
- container: Ga,
3331
- label: Wa
3332
- }, Ka = (e) => /* @__PURE__ */ o("div", { className: pt.container, children: /* @__PURE__ */ g("div", { className: pt.label, children: [
3333
- e.datum.label,
3334
- ": ",
3335
- /* @__PURE__ */ g("strong", { children: [
3336
- e.datum.value,
3337
- "%"
3338
- ] })
3339
- ] }) }), Ua = "containerWrapper__L6jJb", ja = "container__0ahUu", qa = "lockup__7l75G", Za = "value__AL9Ol", Ya = "label__oG0LT", ye = {
3340
- containerWrapper: Ua,
3341
- container: ja,
3342
- lockup: qa,
3343
- value: Za,
3344
- label: Ya
3345
- }, mt = 180, Ja = (e) => {
3346
- const t = A(null), [n, s] = k(0);
3347
- return F(() => {
3348
- t.current && s(t.current.offsetHeight);
3349
- }, []), /* @__PURE__ */ g(be.g, { opacity: e.style.opacity, children: [
3350
- /* @__PURE__ */ o(
3351
- be.path,
3352
- {
3353
- fill: "none",
3354
- d: e.style.path,
3355
- stroke: e.style.linkColor,
3356
- strokeWidth: e.style.thickness
3357
- }
3358
- ),
3359
- /* @__PURE__ */ o(
3360
- be.g,
3361
- {
3362
- transform: e.style.textPosition,
3363
- textAnchor: e.style.textAnchor,
3364
- className: ye.containerWrapper,
3365
- children: /* @__PURE__ */ o(
3366
- "g",
3367
- {
3368
- className: ye.container,
3369
- style: {
3370
- "--container-width": `${mt}px`,
3371
- "--container-height": `${n}px`
3372
- },
3373
- children: /* @__PURE__ */ o(
3374
- "foreignObject",
3375
- {
3376
- dominantBaseline: "central",
3377
- width: mt,
3378
- height: n,
3379
- children: /* @__PURE__ */ g("div", { ref: t, className: ye.lockup, children: [
3380
- /* @__PURE__ */ g("div", { className: ye.value, children: [
3381
- e.datum.value,
3382
- "%"
3383
- ] }),
3384
- /* @__PURE__ */ o("div", { className: ye.label, children: e.datum.label })
3385
- ] })
3386
- }
3387
- )
3388
- }
3389
- )
3390
- }
3391
- )
3392
- ] });
3393
- }, Qa = "container__zNSm3", Xa = "label__lanZz", ei = "light__cA0lL", ti = "dark__tX3sL", De = {
3394
- container: Qa,
3395
- label: Xa,
3396
- light: ei,
3397
- dark: ti
3398
- }, ni = (e) => {
3399
- const t = A(null), [n, s] = k(0), [r, a] = k(0);
3400
- F(() => {
3401
- t.current && (s(t.current.offsetWidth), a(t.current.offsetHeight));
3402
- }, []);
3403
- const i = rn(an(e.datum.color));
3404
- return /* @__PURE__ */ g(te, { children: [
3405
- /* @__PURE__ */ o("path", {}),
3406
- /* @__PURE__ */ o(be.g, { transform: e.style.transform, opacity: e.style.progress, children: /* @__PURE__ */ o(
3407
- "g",
3408
- {
3409
- className: De.container,
3410
- style: {
3411
- "--container-width": `${n}px`,
3412
- "--container-height": `${r}px`
3413
- },
3414
- children: /* @__PURE__ */ o(
3415
- be.foreignObject,
3416
- {
3417
- width: n,
3418
- height: r,
3419
- children: /* @__PURE__ */ o("div", { className: p(De.label, De[i]), children: /* @__PURE__ */ g("div", { ref: t, children: [
3420
- e.datum.value,
3421
- "%"
3422
- ] }) })
3423
- }
3424
- )
3425
- }
3426
- ) })
3427
- ] });
3428
- }, oi = "multiple__wNVrv", si = "chart__e2uI3", ri = "regular__ZEuW4", ai = "small__mxvr9", ii = "xsmall__XrerL", li = "legend__t7i7f", Q = {
3429
- "chart-container": "chart-container__uF6xN",
3430
- multiple: oi,
3431
- chart: si,
3432
- regular: ri,
3433
- small: ai,
3434
- xsmall: ii,
3435
- legend: li,
3436
- "legend-dot": "legend-dot__1ramU"
3437
- }, ci = (e) => e > 4 ? 24 : 16, di = (e) => e === "xsmall" ? { top: 10, right: 0, bottom: 10, left: 0 } : e === "small" ? { top: 10, right: 40, bottom: 20, left: 40 } : { top: 80, right: 210, bottom: 84, left: 210 }, ui = ({ data: e }) => e.length > 1 ? /* @__PURE__ */ g(ce.Provider, { size: "large", children: [
3438
- /* @__PURE__ */ o(ce.TabList, { children: e.map((t, n) => /* @__PURE__ */ o(ce.Tab, { className: Q.tab, children: t.groupName }, n)) }),
3439
- /* @__PURE__ */ o(pi, { data: e })
3440
- ] }) : /* @__PURE__ */ o(cn, { data: e });
3441
- ui.displayName = "DonutChart";
3442
- const pi = ({ data: e }) => {
3443
- const { selectedTabIndex: t, tabIds: n } = Ne(), s = n[t];
3444
- return /* @__PURE__ */ o(cn, { tabId: s, data: e, groupIndex: t });
3445
- }, cn = ({
3446
- tabId: e,
3447
- data: t,
3448
- groupIndex: n = 0
3449
- }) => {
3450
- const [s, r] = k("regular"), { ref: a } = yt({
3451
- onResize: ({ width: i }) => {
3452
- i && i < 360 ? r("xsmall") : i && i < 600 ? r("small") : r("regular");
3453
- }
3454
- });
3455
- return /* @__PURE__ */ g(
3456
- "figure",
3457
- {
3458
- className: p(
3459
- Q["chart-container"],
3460
- t.length > 1 && Q.multiple
3461
- ),
3462
- id: t[n].groupId,
3463
- role: "tabpanel",
3464
- tabIndex: 0,
3465
- "aria-label": e ? void 0 : t[n].groupName,
3466
- "aria-labelledby": e || void 0,
3467
- children: [
3468
- /* @__PURE__ */ g("div", { className: p(Q.chart, Q[s]), ref: a, children: [
3469
- /* @__PURE__ */ o(
3470
- xn,
3471
- {
3472
- data: t[n].groupData,
3473
- margin: di(s),
3474
- enableArcLabels: s !== "regular",
3475
- enableArcLinkLabels: s === "regular",
3476
- arcLabelsComponent: ni,
3477
- arcLinkLabelComponent: Ja,
3478
- arcLinkLabelsSkipAngle: ci(
3479
- t[n].groupData.length
3480
- ),
3481
- tooltip: Ka,
3482
- "aria-hidden": "true",
3483
- colors: { datum: "data.color" },
3484
- innerRadius: 0.5,
3485
- padAngle: 1,
3486
- cornerRadius: 8,
3487
- activeOuterRadiusOffset: 4,
3488
- arcLinkLabelsThickness: 1,
3489
- arcLinkLabelsOffset: 4,
3490
- arcLinkLabelsDiagonalLength: 28,
3491
- arcLinkLabelsStraightLength: 24,
3492
- arcLabelsSkipAngle: 16
3493
- }
3494
- ),
3495
- t[n].groupCaption && /* @__PURE__ */ o("figcaption", { children: t[n].groupCaption })
3496
- ] }),
3497
- s !== "regular" && /* @__PURE__ */ o("ul", { className: Q.legend, "aria-hidden": "true", children: t[n].groupData.map((i) => /* @__PURE__ */ g("li", { children: [
3498
- /* @__PURE__ */ o(
3499
- "span",
3500
- {
3501
- className: Q["legend-dot"],
3502
- style: { background: i.color }
3503
- }
3504
- ),
3505
- i.label
3506
- ] }, i.id)) })
3507
- ]
3508
- }
3509
- );
3510
- };
3511
- export {
3512
- ui as $,
3513
- zn as A,
3514
- He as B,
3515
- Po as C,
3516
- bt as D,
3517
- Ue as E,
3518
- j as F,
3519
- Ai as G,
3520
- Ke as H,
3521
- We as I,
3522
- Tr as J,
3523
- Er as K,
3524
- Pt as L,
3525
- ze as M,
3526
- Rr as N,
3527
- Pi as O,
3528
- Mr as P,
3529
- Ri as Q,
3530
- Bi as R,
3531
- Us as S,
3532
- Zs as T,
3533
- Fi as U,
3534
- Di as V,
3535
- zi as W,
3536
- Oi as X,
3537
- ce as Y,
3538
- Ne as Z,
3539
- Ma as _,
3540
- Dn as a,
3541
- Fn as b,
3542
- On as c,
3543
- qn as d,
3544
- Zn as e,
3545
- Yn as f,
3546
- Jn as g,
3547
- Ti as h,
3548
- Si as i,
3549
- Dt as j,
3550
- Ei as k,
3551
- Ot as l,
3552
- ve as m,
3553
- Cs as n,
3554
- Vt as o,
3555
- Ft as p,
3556
- je as q,
3557
- Mt as r,
3558
- Vs as s,
3559
- Fs as t,
3560
- Me as u,
3561
- gr as v,
3562
- qe as w,
3563
- Nr as x,
3564
- Ut as y,
3565
- Kt as z
3566
- };
3567
- //# sourceMappingURL=index-C4GBbW3N.js.map