@hashicorp/mds-react 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/LICENSE +336 -0
  2. package/README.md +109 -0
  3. package/dist/components/accordion/index.d.ts +14 -0
  4. package/dist/components/accordion/index.js +9 -0
  5. package/dist/components/accordion/index.js.map +1 -0
  6. package/dist/components/accordion/item/button.d.ts +6 -0
  7. package/dist/components/accordion/item/button.js +44 -0
  8. package/dist/components/accordion/item/button.js.map +1 -0
  9. package/dist/components/accordion/item/index.d.ts +24 -0
  10. package/dist/components/accordion/item/index.js +59 -0
  11. package/dist/components/accordion/item/index.js.map +1 -0
  12. package/dist/components/accordion/style.module.scss +110 -0
  13. package/dist/components/accordion/style.module.scss.js +24 -0
  14. package/dist/components/accordion/style.module.scss.js.map +1 -0
  15. package/dist/components/alert/alert.module.scss +229 -0
  16. package/dist/components/alert/alert.module.scss.js +29 -0
  17. package/dist/components/alert/alert.module.scss.js.map +1 -0
  18. package/dist/components/alert/icon.d.ts +9 -0
  19. package/dist/components/alert/icon.js +34 -0
  20. package/dist/components/alert/icon.js.map +1 -0
  21. package/dist/components/alert/index.d.ts +62 -0
  22. package/dist/components/alert/index.js +97 -0
  23. package/dist/components/alert/index.js.map +1 -0
  24. package/dist/components/badge/index.d.ts +30 -0
  25. package/dist/components/badge/index.js +50 -0
  26. package/dist/components/badge/index.js.map +1 -0
  27. package/dist/components/badge/style.module.scss +130 -0
  28. package/dist/components/badge/style.module.scss.js +22 -0
  29. package/dist/components/badge/style.module.scss.js.map +1 -0
  30. package/dist/components/badge-count/index.d.ts +16 -0
  31. package/dist/components/badge-count/index.js +29 -0
  32. package/dist/components/badge-count/index.js.map +1 -0
  33. package/dist/components/badge-count/style.module.scss +108 -0
  34. package/dist/components/badge-count/style.module.scss.js +15 -0
  35. package/dist/components/badge-count/style.module.scss.js.map +1 -0
  36. package/dist/components/breadcrumbs/index.d.ts +7 -0
  37. package/dist/components/breadcrumbs/index.js +38 -0
  38. package/dist/components/breadcrumbs/index.js.map +1 -0
  39. package/dist/components/breadcrumbs/item/index.d.ts +2 -0
  40. package/dist/components/breadcrumbs/item/index.js +32 -0
  41. package/dist/components/breadcrumbs/item/index.js.map +1 -0
  42. package/dist/components/breadcrumbs/style.module.scss +183 -0
  43. package/dist/components/breadcrumbs/style.module.scss.js +27 -0
  44. package/dist/components/breadcrumbs/style.module.scss.js.map +1 -0
  45. package/dist/components/breadcrumbs/truncation-button/index.d.ts +3 -0
  46. package/dist/components/breadcrumbs/truncation-button/index.js +25 -0
  47. package/dist/components/breadcrumbs/truncation-button/index.js.map +1 -0
  48. package/dist/components/breadcrumbs/types/index.d.ts +51 -0
  49. package/dist/components/button/index.d.ts +31 -0
  50. package/dist/components/button/index.js +119 -0
  51. package/dist/components/button/index.js.map +1 -0
  52. package/dist/components/button/styles.module.scss +221 -0
  53. package/dist/components/button/styles.module.scss.js +32 -0
  54. package/dist/components/button/styles.module.scss.js.map +1 -0
  55. package/dist/components/card/card-thumbnail/card-thumbnail.module.css +10 -0
  56. package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js +8 -0
  57. package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js.map +1 -0
  58. package/dist/components/card/card-thumbnail/index.d.ts +2 -0
  59. package/dist/components/card/card-thumbnail/index.js +23 -0
  60. package/dist/components/card/card-thumbnail/index.js.map +1 -0
  61. package/dist/components/card/index.d.ts +3 -0
  62. package/dist/components/card/index.js +157 -0
  63. package/dist/components/card/index.js.map +1 -0
  64. package/dist/components/card/styles.module.css +98 -0
  65. package/dist/components/card/styles.module.css.js +29 -0
  66. package/dist/components/card/styles.module.css.js.map +1 -0
  67. package/dist/components/card/types.d.ts +52 -0
  68. package/dist/components/code-block/code-block.module.scss +511 -0
  69. package/dist/components/code-block/code-block.module.scss.js +34 -0
  70. package/dist/components/code-block/code-block.module.scss.js.map +1 -0
  71. package/dist/components/code-block/code-lines/index.d.ts +12 -0
  72. package/dist/components/code-block/code-lines/index.js +59 -0
  73. package/dist/components/code-block/code-lines/index.js.map +1 -0
  74. package/dist/components/code-block/code-lines/utils/split-html-into-lines.d.ts +19 -0
  75. package/dist/components/code-block/code-lines/utils/split-html-into-lines.js +19 -0
  76. package/dist/components/code-block/code-lines/utils/split-html-into-lines.js.map +1 -0
  77. package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.d.ts +21 -0
  78. package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js +31 -0
  79. package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -0
  80. package/dist/components/code-block/hidden-copy-content/index.d.ts +5 -0
  81. package/dist/components/code-block/hidden-copy-content/index.js +13 -0
  82. package/dist/components/code-block/hidden-copy-content/index.js.map +1 -0
  83. package/dist/components/code-block/index.d.ts +55 -0
  84. package/dist/components/code-block/index.js +88 -0
  85. package/dist/components/code-block/index.js.map +1 -0
  86. package/dist/components/code-block/utils/parse-highlighted-lines.d.ts +2 -0
  87. package/dist/components/code-block/utils/parse-highlighted-lines.js +39 -0
  88. package/dist/components/code-block/utils/parse-highlighted-lines.js.map +1 -0
  89. package/dist/components/code-block/utils/process-snippet.d.ts +12 -0
  90. package/dist/components/code-block/utils/process-snippet.js +20 -0
  91. package/dist/components/code-block/utils/process-snippet.js.map +1 -0
  92. package/dist/components/code-block/utils/shellwords.d.ts +14 -0
  93. package/dist/components/code-block/utils/shellwords.js +33 -0
  94. package/dist/components/code-block/utils/shellwords.js.map +1 -0
  95. package/dist/components/combo-box-primitive/index.d.ts +69 -0
  96. package/dist/components/combo-box-primitive/index.js +302 -0
  97. package/dist/components/combo-box-primitive/index.js.map +1 -0
  98. package/dist/components/dialog-primitive/dialog.module.scss +38 -0
  99. package/dist/components/dialog-primitive/dialog.module.scss.js +12 -0
  100. package/dist/components/dialog-primitive/dialog.module.scss.js.map +1 -0
  101. package/dist/components/dialog-primitive/index.d.ts +12 -0
  102. package/dist/components/dialog-primitive/index.js +15 -0
  103. package/dist/components/dialog-primitive/index.js.map +1 -0
  104. package/dist/components/disclosure-primitive/index.d.ts +19 -0
  105. package/dist/components/disclosure-primitive/index.js +57 -0
  106. package/dist/components/disclosure-primitive/index.js.map +1 -0
  107. package/dist/components/disclosure-primitive/styles.module.css +3 -0
  108. package/dist/components/disclosure-primitive/styles.module.css.js +7 -0
  109. package/dist/components/disclosure-primitive/styles.module.css.js.map +1 -0
  110. package/dist/components/disclosure-primitive/use-disclosure-primitive.d.ts +11 -0
  111. package/dist/components/disclosure-primitive/use-disclosure-primitive.js +17 -0
  112. package/dist/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -0
  113. package/dist/components/dismiss-button/index.d.ts +9 -0
  114. package/dist/components/dismiss-button/index.js +22 -0
  115. package/dist/components/dismiss-button/index.js.map +1 -0
  116. package/dist/components/dismiss-button/styles.module.scss +31 -0
  117. package/dist/components/dismiss-button/styles.module.scss.js +7 -0
  118. package/dist/components/dismiss-button/styles.module.scss.js.map +1 -0
  119. package/dist/components/dropdown/index.d.ts +72 -0
  120. package/dist/components/dropdown/index.js +79 -0
  121. package/dist/components/dropdown/index.js.map +1 -0
  122. package/dist/components/dropdown/list-item/custom.d.ts +10 -0
  123. package/dist/components/dropdown/list-item/custom.js +9 -0
  124. package/dist/components/dropdown/list-item/custom.js.map +1 -0
  125. package/dist/components/dropdown/list-item/index.d.ts +19 -0
  126. package/dist/components/dropdown/list-item/index.js +14 -0
  127. package/dist/components/dropdown/list-item/index.js.map +1 -0
  128. package/dist/components/dropdown/list-item/interactive.d.ts +29 -0
  129. package/dist/components/dropdown/list-item/interactive.js +49 -0
  130. package/dist/components/dropdown/list-item/interactive.js.map +1 -0
  131. package/dist/components/dropdown/list-item/separator.d.ts +8 -0
  132. package/dist/components/dropdown/list-item/separator.js +17 -0
  133. package/dist/components/dropdown/list-item/separator.js.map +1 -0
  134. package/dist/components/dropdown/list-item/styles.module.css +222 -0
  135. package/dist/components/dropdown/list-item/styles.module.css.js +26 -0
  136. package/dist/components/dropdown/list-item/styles.module.css.js.map +1 -0
  137. package/dist/components/dropdown/list-item/title.d.ts +10 -0
  138. package/dist/components/dropdown/list-item/title.js +9 -0
  139. package/dist/components/dropdown/list-item/title.js.map +1 -0
  140. package/dist/components/dropdown/styles.module.css +74 -0
  141. package/dist/components/dropdown/styles.module.css.js +24 -0
  142. package/dist/components/dropdown/styles.module.css.js.map +1 -0
  143. package/dist/components/dropdown/toggle-button/index.d.ts +30 -0
  144. package/dist/components/dropdown/toggle-button/index.js +54 -0
  145. package/dist/components/dropdown/toggle-button/index.js.map +1 -0
  146. package/dist/components/dropdown/toggle-button/styles.module.scss +54 -0
  147. package/dist/components/dropdown/toggle-button/styles.module.scss.js +14 -0
  148. package/dist/components/dropdown/toggle-button/styles.module.scss.js.map +1 -0
  149. package/dist/components/flight-icon/flight-icon.module.css +31 -0
  150. package/dist/components/flight-icon/flight-icon.module.css.js +12 -0
  151. package/dist/components/flight-icon/flight-icon.module.css.js.map +1 -0
  152. package/dist/components/flight-icon/index.d.ts +44 -0
  153. package/dist/components/flight-icon/index.js +58 -0
  154. package/dist/components/flight-icon/index.js.map +1 -0
  155. package/dist/components/form/checkbox/form-checkbox.module.css +88 -0
  156. package/dist/components/form/checkbox/form-checkbox.module.css.js +8 -0
  157. package/dist/components/form/checkbox/form-checkbox.module.css.js.map +1 -0
  158. package/dist/components/form/checkbox/index.d.ts +45 -0
  159. package/dist/components/form/checkbox/index.js +109 -0
  160. package/dist/components/form/checkbox/index.js.map +1 -0
  161. package/dist/components/form/error/form-error.module.css +23 -0
  162. package/dist/components/form/error/form-error.module.css.js +14 -0
  163. package/dist/components/form/error/form-error.module.css.js.map +1 -0
  164. package/dist/components/form/error/index.d.ts +16 -0
  165. package/dist/components/form/error/index.js +22 -0
  166. package/dist/components/form/error/index.js.map +1 -0
  167. package/dist/components/form/field/form-field.module.css +79 -0
  168. package/dist/components/form/field/form-field.module.css.js +17 -0
  169. package/dist/components/form/field/form-field.module.css.js.map +1 -0
  170. package/dist/components/form/field/index.d.ts +19 -0
  171. package/dist/components/form/field/index.js +46 -0
  172. package/dist/components/form/field/index.js.map +1 -0
  173. package/dist/components/form/fieldset/form-fieldset.module.css +48 -0
  174. package/dist/components/form/fieldset/form-fieldset.module.css.js +19 -0
  175. package/dist/components/form/fieldset/form-fieldset.module.css.js.map +1 -0
  176. package/dist/components/form/fieldset/index.d.ts +19 -0
  177. package/dist/components/form/fieldset/index.js +65 -0
  178. package/dist/components/form/fieldset/index.js.map +1 -0
  179. package/dist/components/form/file-input/form-file-input.module.scss +81 -0
  180. package/dist/components/form/file-input/form-file-input.module.scss.js +7 -0
  181. package/dist/components/form/file-input/form-file-input.module.scss.js.map +1 -0
  182. package/dist/components/form/file-input/index.d.ts +27 -0
  183. package/dist/components/form/file-input/index.js +68 -0
  184. package/dist/components/form/file-input/index.js.map +1 -0
  185. package/dist/components/form/helper-text/form-helper-text.module.css +10 -0
  186. package/dist/components/form/helper-text/form-helper-text.module.css.js +7 -0
  187. package/dist/components/form/helper-text/form-helper-text.module.css.js.map +1 -0
  188. package/dist/components/form/helper-text/index.d.ts +11 -0
  189. package/dist/components/form/helper-text/index.js +22 -0
  190. package/dist/components/form/helper-text/index.js.map +1 -0
  191. package/dist/components/form/indicator/form-indicator.module.css +10 -0
  192. package/dist/components/form/indicator/form-indicator.module.css.js +8 -0
  193. package/dist/components/form/indicator/form-indicator.module.css.js.map +1 -0
  194. package/dist/components/form/indicator/index.d.ts +9 -0
  195. package/dist/components/form/indicator/index.js +22 -0
  196. package/dist/components/form/indicator/index.js.map +1 -0
  197. package/dist/components/form/label/form-label.module.css +15 -0
  198. package/dist/components/form/label/form-label.module.css.js +10 -0
  199. package/dist/components/form/label/form-label.module.css.js.map +1 -0
  200. package/dist/components/form/label/index.d.ts +14 -0
  201. package/dist/components/form/label/index.js +33 -0
  202. package/dist/components/form/label/index.js.map +1 -0
  203. package/dist/components/form/legend/form-legend.module.css +17 -0
  204. package/dist/components/form/legend/form-legend.module.css.js +10 -0
  205. package/dist/components/form/legend/form-legend.module.css.js.map +1 -0
  206. package/dist/components/form/legend/index.d.ts +12 -0
  207. package/dist/components/form/legend/index.js +19 -0
  208. package/dist/components/form/legend/index.js.map +1 -0
  209. package/dist/components/form/radio/form-radio.module.scss +74 -0
  210. package/dist/components/form/radio/form-radio.module.scss.js +8 -0
  211. package/dist/components/form/radio/form-radio.module.scss.js.map +1 -0
  212. package/dist/components/form/radio/index.d.ts +44 -0
  213. package/dist/components/form/radio/index.js +100 -0
  214. package/dist/components/form/radio/index.js.map +1 -0
  215. package/dist/components/form/radio-card/description.d.ts +3 -0
  216. package/dist/components/form/radio-card/description.js +10 -0
  217. package/dist/components/form/radio-card/description.js.map +1 -0
  218. package/dist/components/form/radio-card/form-radio-card.module.css +153 -0
  219. package/dist/components/form/radio-card/form-radio-card.module.css.js +30 -0
  220. package/dist/components/form/radio-card/form-radio-card.module.css.js.map +1 -0
  221. package/dist/components/form/radio-card/group.d.ts +11 -0
  222. package/dist/components/form/radio-card/group.js +31 -0
  223. package/dist/components/form/radio-card/group.js.map +1 -0
  224. package/dist/components/form/radio-card/index.d.ts +48 -0
  225. package/dist/components/form/radio-card/index.js +67 -0
  226. package/dist/components/form/radio-card/index.js.map +1 -0
  227. package/dist/components/form/radio-card/label.d.ts +3 -0
  228. package/dist/components/form/radio-card/label.js +10 -0
  229. package/dist/components/form/radio-card/label.js.map +1 -0
  230. package/dist/components/form/select/form-select.module.css +89 -0
  231. package/dist/components/form/select/form-select.module.css.js +14 -0
  232. package/dist/components/form/select/form-select.module.css.js.map +1 -0
  233. package/dist/components/form/select/index.d.ts +21 -0
  234. package/dist/components/form/select/index.js +79 -0
  235. package/dist/components/form/select/index.js.map +1 -0
  236. package/dist/components/form/super-select/form-super-select.module.css +155 -0
  237. package/dist/components/form/super-select/form-super-select.module.css.js +22 -0
  238. package/dist/components/form/super-select/form-super-select.module.css.js.map +1 -0
  239. package/dist/components/form/super-select/index.d.ts +55 -0
  240. package/dist/components/form/super-select/index.js +170 -0
  241. package/dist/components/form/super-select/index.js.map +1 -0
  242. package/dist/components/form/text-input/index.d.ts +98 -0
  243. package/dist/components/form/text-input/index.js +91 -0
  244. package/dist/components/form/text-input/index.js.map +1 -0
  245. package/dist/components/form/text-input/styles.module.css +158 -0
  246. package/dist/components/form/text-input/styles.module.css.js +15 -0
  247. package/dist/components/form/text-input/styles.module.css.js.map +1 -0
  248. package/dist/components/form/textarea/form-textarea.module.css +88 -0
  249. package/dist/components/form/textarea/form-textarea.module.css.js +14 -0
  250. package/dist/components/form/textarea/form-textarea.module.css.js.map +1 -0
  251. package/dist/components/form/textarea/index.d.ts +19 -0
  252. package/dist/components/form/textarea/index.js +74 -0
  253. package/dist/components/form/textarea/index.js.map +1 -0
  254. package/dist/components/form/toggle/form-toggle.module.scss +164 -0
  255. package/dist/components/form/toggle/form-toggle.module.scss.js +12 -0
  256. package/dist/components/form/toggle/form-toggle.module.scss.js.map +1 -0
  257. package/dist/components/form/toggle/index.d.ts +78 -0
  258. package/dist/components/form/toggle/index.js +102 -0
  259. package/dist/components/form/toggle/index.js.map +1 -0
  260. package/dist/components/hds/wrappers/tooltip.d.ts +13 -0
  261. package/dist/components/hds/wrappers/tooltip.js +51 -0
  262. package/dist/components/hds/wrappers/tooltip.js.map +1 -0
  263. package/dist/components/icon-tile/index.d.ts +21 -0
  264. package/dist/components/icon-tile/index.js +50 -0
  265. package/dist/components/icon-tile/index.js.map +1 -0
  266. package/dist/components/icon-tile/style.module.scss +136 -0
  267. package/dist/components/icon-tile/style.module.scss.js +29 -0
  268. package/dist/components/icon-tile/style.module.scss.js.map +1 -0
  269. package/dist/components/index.d.ts +60 -0
  270. package/dist/components/index.js +119 -0
  271. package/dist/components/index.js.map +1 -0
  272. package/dist/components/inline-link/index.d.ts +40 -0
  273. package/dist/components/inline-link/index.js +33 -0
  274. package/dist/components/inline-link/index.js.map +1 -0
  275. package/dist/components/inline-link/inline-link.module.css +49 -0
  276. package/dist/components/inline-link/inline-link.module.css.js +11 -0
  277. package/dist/components/inline-link/inline-link.module.css.js.map +1 -0
  278. package/dist/components/interactive/index.d.ts +26 -0
  279. package/dist/components/interactive/index.js +59 -0
  280. package/dist/components/interactive/index.js.map +1 -0
  281. package/dist/components/legacy-button/index.d.ts +5 -0
  282. package/dist/components/legacy-button/index.js +65 -0
  283. package/dist/components/legacy-button/index.js.map +1 -0
  284. package/dist/components/legacy-button/types.d.ts +37 -0
  285. package/dist/components/legacy-button/utils.d.ts +9 -0
  286. package/dist/components/legacy-button/utils.js +39 -0
  287. package/dist/components/legacy-button/utils.js.map +1 -0
  288. package/dist/components/menu-primitive/index.d.ts +14 -0
  289. package/dist/components/menu-primitive/index.js +68 -0
  290. package/dist/components/menu-primitive/index.js.map +1 -0
  291. package/dist/components/menu-primitive/styles.module.css +16 -0
  292. package/dist/components/menu-primitive/styles.module.css.js +12 -0
  293. package/dist/components/menu-primitive/styles.module.css.js.map +1 -0
  294. package/dist/components/menu-primitive/use-menu-primitive.d.ts +9 -0
  295. package/dist/components/menu-primitive/use-menu-primitive.js +17 -0
  296. package/dist/components/menu-primitive/use-menu-primitive.js.map +1 -0
  297. package/dist/components/modal/index.d.ts +13 -0
  298. package/dist/components/modal/index.js +61 -0
  299. package/dist/components/modal/index.js.map +1 -0
  300. package/dist/components/modal/modal.module.css +22 -0
  301. package/dist/components/modal/modal.module.css.js +8 -0
  302. package/dist/components/modal/modal.module.css.js.map +1 -0
  303. package/dist/components/modal/use-modal.d.ts +8 -0
  304. package/dist/components/modal/use-modal.js +17 -0
  305. package/dist/components/modal/use-modal.js.map +1 -0
  306. package/dist/components/separator/index.d.ts +10 -0
  307. package/dist/components/separator/index.js +15 -0
  308. package/dist/components/separator/index.js.map +1 -0
  309. package/dist/components/separator/separator.module.css +15 -0
  310. package/dist/components/separator/separator.module.css.js +10 -0
  311. package/dist/components/separator/separator.module.css.js.map +1 -0
  312. package/dist/components/standalone-link/index.d.ts +23 -0
  313. package/dist/components/standalone-link/index.js +54 -0
  314. package/dist/components/standalone-link/index.js.map +1 -0
  315. package/dist/components/standalone-link/styles.module.scss +166 -0
  316. package/dist/components/standalone-link/styles.module.scss.js +17 -0
  317. package/dist/components/standalone-link/styles.module.scss.js.map +1 -0
  318. package/dist/components/table/index.d.ts +58 -0
  319. package/dist/components/table/index.js +52 -0
  320. package/dist/components/table/index.js.map +1 -0
  321. package/dist/components/table/table.module.scss +192 -0
  322. package/dist/components/table/table.module.scss.js +33 -0
  323. package/dist/components/table/table.module.scss.js.map +1 -0
  324. package/dist/components/table/td.d.ts +17 -0
  325. package/dist/components/table/td.js +28 -0
  326. package/dist/components/table/td.js.map +1 -0
  327. package/dist/components/table/th-button-tooltip.d.ts +6 -0
  328. package/dist/components/table/th-button-tooltip.js +24 -0
  329. package/dist/components/table/th-button-tooltip.js.map +1 -0
  330. package/dist/components/table/th.d.ts +34 -0
  331. package/dist/components/table/th.js +43 -0
  332. package/dist/components/table/th.js.map +1 -0
  333. package/dist/components/table/tr.d.ts +12 -0
  334. package/dist/components/table/tr.js +9 -0
  335. package/dist/components/table/tr.js.map +1 -0
  336. package/dist/components/table/utils.d.ts +16 -0
  337. package/dist/components/table/utils.js +28 -0
  338. package/dist/components/table/utils.js.map +1 -0
  339. package/dist/components/tabs/index.d.ts +21 -0
  340. package/dist/components/tabs/index.js +117 -0
  341. package/dist/components/tabs/index.js.map +1 -0
  342. package/dist/components/tabs/tab-panel.d.ts +5 -0
  343. package/dist/components/tabs/tab-panel.js +35 -0
  344. package/dist/components/tabs/tab-panel.js.map +1 -0
  345. package/dist/components/tabs/tab.d.ts +24 -0
  346. package/dist/components/tabs/tab.js +70 -0
  347. package/dist/components/tabs/tab.js.map +1 -0
  348. package/dist/components/tabs/tabs.module.scss +163 -0
  349. package/dist/components/tabs/tabs.module.scss.js +22 -0
  350. package/dist/components/tabs/tabs.module.scss.js.map +1 -0
  351. package/dist/components/tabs/use-tabs-context.d.ts +15 -0
  352. package/dist/components/tabs/use-tabs-context.js +16 -0
  353. package/dist/components/tabs/use-tabs-context.js.map +1 -0
  354. package/dist/components/text/index.d.ts +44 -0
  355. package/dist/components/text/index.js +112 -0
  356. package/dist/components/text/index.js.map +1 -0
  357. package/dist/components/text/style.module.scss +11 -0
  358. package/dist/components/text/style.module.scss.js +9 -0
  359. package/dist/components/text/style.module.scss.js.map +1 -0
  360. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.d.ts +8 -0
  361. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +62 -0
  362. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -0
  363. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css +76 -0
  364. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js +20 -0
  365. package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js.map +1 -0
  366. package/dist/components/visualizations/bar-chart/horizontal-chart/index.d.ts +44 -0
  367. package/dist/components/visualizations/bar-chart/horizontal-chart/index.js +104 -0
  368. package/dist/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -0
  369. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.d.ts +10 -0
  370. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js +13 -0
  371. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js.map +1 -0
  372. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css +29 -0
  373. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js +14 -0
  374. package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js.map +1 -0
  375. package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css +76 -0
  376. package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js +28 -0
  377. package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js.map +1 -0
  378. package/dist/components/visualizations/bar-chart/index.d.ts +13 -0
  379. package/dist/components/visualizations/bar-chart/index.js +37 -0
  380. package/dist/components/visualizations/bar-chart/index.js.map +1 -0
  381. package/dist/components/visualizations/bar-chart/style.module.css +39 -0
  382. package/dist/components/visualizations/bar-chart/style.module.css.js +12 -0
  383. package/dist/components/visualizations/bar-chart/style.module.css.js.map +1 -0
  384. package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.d.ts +3 -0
  385. package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js +14 -0
  386. package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js.map +1 -0
  387. package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css +14 -0
  388. package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js +10 -0
  389. package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js.map +1 -0
  390. package/dist/components/visualizations/donut-chart/components/external-arc-label/index.d.ts +3 -0
  391. package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js +58 -0
  392. package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js.map +1 -0
  393. package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css +32 -0
  394. package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js +16 -0
  395. package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js.map +1 -0
  396. package/dist/components/visualizations/donut-chart/components/index.d.ts +3 -0
  397. package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.d.ts +3 -0
  398. package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js +42 -0
  399. package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js.map +1 -0
  400. package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css +20 -0
  401. package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js +14 -0
  402. package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js.map +1 -0
  403. package/dist/components/visualizations/donut-chart/index.d.ts +10 -0
  404. package/dist/components/visualizations/donut-chart/index.js +90 -0
  405. package/dist/components/visualizations/donut-chart/index.js.map +1 -0
  406. package/dist/components/visualizations/donut-chart/styles.module.css +73 -0
  407. package/dist/components/visualizations/donut-chart/styles.module.css.js +20 -0
  408. package/dist/components/visualizations/donut-chart/styles.module.css.js.map +1 -0
  409. package/dist/components/visualizations/donut-chart/types.d.ts +16 -0
  410. package/dist/hooks/use-media-query/index.js +16 -0
  411. package/dist/hooks/use-media-query/index.js.map +1 -0
  412. package/dist/index.d.ts +3 -0
  413. package/dist/index.js +158 -0
  414. package/dist/index.js.map +1 -0
  415. package/dist/patterns/card/index.d.ts +5 -0
  416. package/dist/patterns/card/newsroom-card/index.d.ts +15 -0
  417. package/dist/patterns/card/newsroom-card/index.js +26 -0
  418. package/dist/patterns/card/newsroom-card/index.js.map +1 -0
  419. package/dist/patterns/card/newsroom-card/style.module.css +12 -0
  420. package/dist/patterns/card/newsroom-card/style.module.css.js +8 -0
  421. package/dist/patterns/card/newsroom-card/style.module.css.js.map +1 -0
  422. package/dist/patterns/card/partner-card/index.d.ts +18 -0
  423. package/dist/patterns/card/partner-card/index.js +42 -0
  424. package/dist/patterns/card/partner-card/index.js.map +1 -0
  425. package/dist/patterns/card/partner-card/style.module.css +24 -0
  426. package/dist/patterns/card/partner-card/style.module.css.js +12 -0
  427. package/dist/patterns/card/partner-card/style.module.css.js.map +1 -0
  428. package/dist/patterns/card/person-card/index.d.ts +15 -0
  429. package/dist/patterns/card/person-card/index.js +52 -0
  430. package/dist/patterns/card/person-card/index.js.map +1 -0
  431. package/dist/patterns/card/person-card/style.module.css +28 -0
  432. package/dist/patterns/card/person-card/style.module.css.js +12 -0
  433. package/dist/patterns/card/person-card/style.module.css.js.map +1 -0
  434. package/dist/patterns/card/primitives.d.ts +37 -0
  435. package/dist/patterns/card/primitives.js +77 -0
  436. package/dist/patterns/card/primitives.js.map +1 -0
  437. package/dist/patterns/card/promo-card/index.d.ts +18 -0
  438. package/dist/patterns/card/promo-card/index.js +36 -0
  439. package/dist/patterns/card/promo-card/index.js.map +1 -0
  440. package/dist/patterns/card/resource-card/index.d.ts +16 -0
  441. package/dist/patterns/card/resource-card/index.js +26 -0
  442. package/dist/patterns/card/resource-card/index.js.map +1 -0
  443. package/dist/patterns/card/style.module.css +121 -0
  444. package/dist/patterns/card/style.module.css.js +30 -0
  445. package/dist/patterns/card/style.module.css.js.map +1 -0
  446. package/dist/patterns/card/thumbnails/index.d.ts +13 -0
  447. package/dist/patterns/card/thumbnails/index.js +25 -0
  448. package/dist/patterns/card/thumbnails/index.js.map +1 -0
  449. package/dist/patterns/card/types.d.ts +41 -0
  450. package/dist/patterns/card/unified-card/index.d.ts +10 -0
  451. package/dist/patterns/card/unified-card/index.js +37 -0
  452. package/dist/patterns/card/unified-card/index.js.map +1 -0
  453. package/dist/patterns/copy-button/clipboard.d.ts +16 -0
  454. package/dist/patterns/copy-button/clipboard.js +78 -0
  455. package/dist/patterns/copy-button/clipboard.js.map +1 -0
  456. package/dist/patterns/copy-button/index.d.ts +19 -0
  457. package/dist/patterns/copy-button/index.js +57 -0
  458. package/dist/patterns/copy-button/index.js.map +1 -0
  459. package/dist/patterns/copy-button/style.module.css +23 -0
  460. package/dist/patterns/copy-button/style.module.css.js +13 -0
  461. package/dist/patterns/copy-button/style.module.css.js.map +1 -0
  462. package/dist/patterns/index.d.ts +15 -0
  463. package/dist/patterns/index.js +35 -0
  464. package/dist/patterns/index.js.map +1 -0
  465. package/dist/patterns/layout/index.d.ts +69 -0
  466. package/dist/patterns/layout/index.js +47 -0
  467. package/dist/patterns/layout/index.js.map +1 -0
  468. package/dist/patterns/layout/layout.module.css +72 -0
  469. package/dist/patterns/layout/layout.module.css.js +20 -0
  470. package/dist/patterns/layout/layout.module.css.js.map +1 -0
  471. package/dist/patterns/product-badge/index.d.ts +11 -0
  472. package/dist/patterns/product-badge/index.js +22 -0
  473. package/dist/patterns/product-badge/index.js.map +1 -0
  474. package/dist/patterns/product-badge/style.module.css +3 -0
  475. package/dist/patterns/product-badge/style.module.css.js +8 -0
  476. package/dist/patterns/product-badge/style.module.css.js.map +1 -0
  477. package/dist/patterns/product-logo/index.d.ts +48 -0
  478. package/dist/patterns/product-logo/index.js +130 -0
  479. package/dist/patterns/product-logo/index.js.map +1 -0
  480. package/dist/patterns/product-logo/product-logo.module.css +24 -0
  481. package/dist/patterns/product-logo/product-logo.module.css.js +13 -0
  482. package/dist/patterns/product-logo/product-logo.module.css.js.map +1 -0
  483. package/dist/patterns/related-content/index.d.ts +6 -0
  484. package/dist/patterns/related-content/index.js +65 -0
  485. package/dist/patterns/related-content/index.js.map +1 -0
  486. package/dist/patterns/related-content/style.module.css +74 -0
  487. package/dist/patterns/related-content/style.module.css.js +22 -0
  488. package/dist/patterns/related-content/style.module.css.js.map +1 -0
  489. package/dist/patterns/related-content/types.d.ts +14 -0
  490. package/dist/style.css +1 -0
  491. package/dist/styles/mixins/button.scss +284 -0
  492. package/dist/styles/mixins/focus-ring.scss +75 -0
  493. package/dist/utils/get-contrast-yiq.d.ts +20 -0
  494. package/dist/utils/get-contrast-yiq.js +13 -0
  495. package/dist/utils/get-contrast-yiq.js.map +1 -0
  496. package/dist/utils/hooks/use-screen-size.d.ts +5 -0
  497. package/dist/utils/hooks/use-screen-size.js +10 -0
  498. package/dist/utils/hooks/use-screen-size.js.map +1 -0
  499. package/dist/utils/i18n/index.d.ts +1 -0
  500. package/dist/utils/i18n/index.js +41 -0
  501. package/dist/utils/i18n/index.js.map +1 -0
  502. package/dist/utils/index.d.ts +3 -0
  503. package/dist/utils/index.js +10 -0
  504. package/dist/utils/index.js.map +1 -0
  505. package/dist/utils/make-normalizer/index.d.ts +30 -0
  506. package/dist/utils/make-normalizer/index.js +34 -0
  507. package/dist/utils/make-normalizer/index.js.map +1 -0
  508. package/dist/utils/mds-context/index.d.ts +59 -0
  509. package/dist/utils/mds-context/index.js +85 -0
  510. package/dist/utils/mds-context/index.js.map +1 -0
  511. package/package.json +113 -0
@@ -0,0 +1,511 @@
1
+ //
2
+ // CODE-BLOCK
3
+ //
4
+
5
+ @use 'styles/mixins/focus-ring' as *;
6
+
7
+ // CODE-BLOCK PARENT/WRAPPER
8
+ .code-block {
9
+ --code-block-code-padding: 16px;
10
+
11
+ position: relative;
12
+ color: var(--code-block-color-foreground-primary);
13
+ background-color: var(--code-block-color-surface-primary);
14
+ border: 1px solid var(--code-block-color-border-strong);
15
+
16
+ pre,
17
+ code {
18
+ line-height: 1.4286;
19
+ white-space: pre;
20
+ text-align: left;
21
+ text-shadow: none;
22
+ word-wrap: normal;
23
+ word-break: normal;
24
+ word-spacing: normal;
25
+ tab-size: 4;
26
+ hyphens: none;
27
+
28
+ @media print {
29
+ text-shadow: none;
30
+ }
31
+ }
32
+
33
+ @media print {
34
+ .line-highlight {
35
+ /*
36
+ * This will prevent browsers from replacing the background color with white.
37
+ * It's necessary because the element is layered on top of the displayed code.
38
+ */
39
+ -webkit-print-color-adjust: exact;
40
+ print-color-adjust: exact;
41
+ }
42
+ }
43
+ }
44
+
45
+ .dark {
46
+ // COLORS
47
+
48
+ // Descriptive color names:
49
+
50
+ --code-block-color-blue: #2d8eff;
51
+ --code-block-color-cyan: #32fff7;
52
+ --code-block-color-green: #86ff13;
53
+ --code-block-color-orange: #ffa800;
54
+ --code-block-color-purple: #c76cff;
55
+ --code-block-color-red: #ff3b20;
56
+
57
+ // Semantic color names:
58
+
59
+ // Base UI colors:
60
+ --code-block-color-foreground-primary: #d5d7db;
61
+ --code-block-color-foreground-faint: #b2b6bd;
62
+ --code-block-color-surface-primary: #0d0e12;
63
+ --code-block-color-surface-faint: #15181e;
64
+ // status ----
65
+ --code-block-color-foreground-success: #009241;
66
+ --code-block-color-foreground-critical: #ef3016;
67
+ // interactive ---
68
+ --code-block-color-foreground-interactive: #dedfe3;
69
+ --code-block-color-foreground-interactive-hover: #fff;
70
+ --code-block-color-foreground-interactive-active: #f1f2f3;
71
+ --code-block-color-surface-interactive-active: #2b303c;
72
+ // actions ---
73
+ --code-block-color-foreground-action: #2b89ff;
74
+ --code-block-color-foreground-action-hover: #389aff;
75
+ --code-block-color-foreground-action-active: #4ca1ff;
76
+ // borders
77
+ --code-block-color-border-strong: rgba(178, 182, 189, 40%); // #b2b6bd66
78
+ --code-block-color-border-primary: rgba(178, 182, 189, 20%); // #b2b6bd33
79
+ // selection
80
+ --code-block-color-foreground-selection: #0d0e12;
81
+ --code-block-color-surface-selection: #86ff13;
82
+
83
+ // CodeBlock UI:
84
+ // lines of code - highlighted ----
85
+ --code-block-color-line-highlight: rgba(0, 74, 222, 20%);
86
+ --code-block-color-line-highlight-border: #1555d4;
87
+
88
+ // Syntax highlighting tokens:
89
+ // general ----
90
+ --code-block-color-token: var(--code-block-color-foreground-primary);
91
+ // specific ----
92
+ --code-block-color-atrule: var(--code-block-color-blue);
93
+ --code-block-color-code-block-attr-name: var(--code-block-color-blue);
94
+ --code-block-color-attr-value: var(--code-block-color-blue);
95
+ --code-block-color-boolean: var(--code-block-color-purple);
96
+ --code-block-color-builtin: var(--code-block-color-orange);
97
+ --code-block-color-char: var(--code-block-color-orange);
98
+ --code-block-color-class-name: var(--code-block-color-blue);
99
+ --code-block-color-comment: var(--code-block-color-foreground-faint);
100
+ --code-block-color-control: var(--code-block-color-cyan);
101
+ --code-block-color-constant: var(--code-block-color-purple);
102
+ --code-block-color-deleted: var(--code-block-color-red);
103
+ --code-block-color-entity: var(--code-block-color-green);
104
+ --code-block-color-function: var(--code-block-color-blue);
105
+ --code-block-color-important: var(--code-block-color-red);
106
+ --code-block-color-keyword: var(--code-block-color-green);
107
+ --code-block-color-namespace: var(--code-block-color-red);
108
+ --code-block-color-number: var(--code-block-color-purple);
109
+ --code-block-color-operator: var(--code-block-color-cyan);
110
+ --code-block-color-prolog: var(--code-block-color-foreground-primary);
111
+ --code-block-color-property: var(--code-block-color-blue);
112
+ --code-block-color-punctuation: var(--code-block-color-foreground-primary);
113
+ --code-block-color-regex: var(--code-block-color-orange);
114
+ --code-block-color-script: var(--code-block-color-foreground-primary);
115
+ --code-block-color-selector: var(--code-block-color-green);
116
+ --code-block-color-string: var(--code-block-color-orange);
117
+ --code-block-color-symbol: var(--code-block-color-orange);
118
+ --code-block-color-tag: var(--code-block-color-green);
119
+ --code-block-color-url: var(--code-block-color-cyan);
120
+ // language-scoped:
121
+ // css ----
122
+ --code-block-color-lang-css: var(--code-block-color-purple);
123
+ --code-block-color-lang-css-token: var(--code-block-color-green);
124
+ --code-block-color-lang-css-atrule: var(--code-block-color-purple);
125
+ --code-block-color-lang-css-entity: var(--code-block-color-blue);
126
+ --code-block-color-lang-css-function: var(--code-block-color-cyan);
127
+ --code-block-color-lang-css-property: var(--code-block-color-cyan);
128
+ --code-block-color-lang-css-punctuation: var(--code-block-color-orange);
129
+ --code-block-color-lang-css-not-atrule: var(
130
+ --code-block-color-foreground-primary
131
+ );
132
+ --code-block-color-lang-css-selector: var(--code-block-color-blue);
133
+ --code-block-color-lang-css-url: var(--code-block-color-orange);
134
+ // javascript ----
135
+ --code-block-color-lang-js-constant: var(--code-block-color-orange);
136
+ // markup/html ----
137
+ --code-block-color-lang-markup-attr-value: var(--code-block-color-yellow);
138
+ --code-block-color-lang-markup-entity-named: var(--code-block-color-purple);
139
+ --code-block-color-lang-markup-entity-not-named: var(
140
+ --code-block-color-green
141
+ );
142
+ }
143
+
144
+ // Syntax highlighting ----
145
+ // General
146
+ .code-block {
147
+ // Common tokens
148
+ :global(.token.bold) {
149
+ font-weight: bold;
150
+ }
151
+ :global(.token.italic) {
152
+ font-style: italic;
153
+ }
154
+
155
+ // General tokens
156
+ :global(.token) {
157
+ color: var(--code-block-color-token);
158
+ }
159
+
160
+ :global(.token.atrule) {
161
+ color: var(--code-block-color-atrule);
162
+ }
163
+ :global(.token.attr-name) {
164
+ color: var(--code-block-color-attr-name);
165
+ }
166
+ :global(.token.attr-value) {
167
+ color: var(--code-block-color-attr-value);
168
+ }
169
+ :global(.token.boolean) {
170
+ color: var(--code-block-color-boolean);
171
+ }
172
+ :global(.token.builtin) {
173
+ color: var(--code-block-color-builtin);
174
+ }
175
+ :global(.token.char) {
176
+ color: var(--code-block-color-char);
177
+ }
178
+ :global(.token.class-name) {
179
+ color: var(--code-block-color-class-name);
180
+ }
181
+ :global(.token.comment) {
182
+ color: var(--code-block-color-comment);
183
+ }
184
+ :global(.token.constant) {
185
+ color: var(--code-block-color-constant);
186
+ }
187
+ :global(.token.deleted) {
188
+ color: var(--code-block-color-deleted);
189
+ }
190
+ :global(.token.entity) {
191
+ color: var(--code-block-color-entity);
192
+ }
193
+ :global(.token.function) {
194
+ color: var(--code-block-color-function);
195
+ }
196
+ :global(.token.important) {
197
+ color: var(--code-block-color-important);
198
+ }
199
+ :global(.token.keyword) {
200
+ color: var(--code-block-color-keyword);
201
+ }
202
+ :global(.token.namespace) {
203
+ color: var(--code-block-color-namespace);
204
+ }
205
+ :global(.token.number) {
206
+ color: var(--code-block-color-number);
207
+ }
208
+ :global(.token.operator) {
209
+ color: var(--code-block-color-operator);
210
+ }
211
+ :global(.token.punctuation) {
212
+ color: var(--code-block-color-punctuation);
213
+ }
214
+ :global(.token.prolog) {
215
+ color: var(--code-block-color-prolog);
216
+ }
217
+ :global(.token.property) {
218
+ color: var(--code-block-color-property);
219
+ }
220
+ :global(.token.regex) {
221
+ color: var(--code-block-color-regex);
222
+ }
223
+ :global(.token.script) {
224
+ color: var(--code-block-color-script);
225
+ }
226
+ :global(.token.selector) {
227
+ color: var(--code-block-color-selector);
228
+ }
229
+ :global(.token.string) {
230
+ color: var(--code-block-color-string);
231
+ }
232
+ :global(.token.symbol) {
233
+ color: var(--code-block-color-symbol);
234
+ }
235
+ :global(.token.tag) {
236
+ color: var(--code-block-color-tag);
237
+ }
238
+ :global(.token.url) {
239
+ color: var(--code-block-color-url);
240
+ }
241
+ :global(.token.variable) {
242
+ color: var(--code-block-color-comment);
243
+ }
244
+ }
245
+ // Language-specific
246
+ .language-css {
247
+ color: var(--code-block-color-lang-css);
248
+
249
+ .token {
250
+ color: var(--code-block-color-lang-css-token);
251
+ }
252
+ :global(.token.atrule) {
253
+ color: var(--code-block-color-lang-css-atrule);
254
+ }
255
+ :global(.token.rule:not(.atrule)) {
256
+ color: var(--code-block-color-lang-css-not-atrule);
257
+ }
258
+ :global(.token.entity) {
259
+ color: var(--code-block-color-lang-css-entity);
260
+ }
261
+ :global(.token.function) {
262
+ color: var(--code-block-color-lang-css-function);
263
+ }
264
+ :global(.token.property) {
265
+ color: var(--code-block-color-lang-css-property);
266
+ }
267
+ :global(.token.punctuation) {
268
+ color: var(--code-block-color-lang-css-punctuatione);
269
+ }
270
+ :global(.token.selector) {
271
+ color: var(--code-block-color-lang-css-selector);
272
+ }
273
+ :global(.token.url) {
274
+ color: var(--code-block-color-lang-css-url);
275
+ }
276
+ }
277
+ .language-javascript {
278
+ :global(.token.constant) {
279
+ color: var(--code-block-color-lang-js-constant);
280
+ }
281
+ }
282
+ .language-markup,
283
+ .language-html {
284
+ :global(.token.attr-value) {
285
+ color: var(--code-block-color-lang-markup-attr-value);
286
+ }
287
+ :global(.token.entity.named-entity) {
288
+ color: var(--code-block-color-lang-markup-entity-named);
289
+ }
290
+ :global(.token.entity:not(.named-entity)) {
291
+ color: var(--code-block-color-lang-markup-entity-not-named);
292
+ }
293
+ }
294
+
295
+ // isStandalone
296
+ .is-standalone {
297
+ border-radius: 6px;
298
+ }
299
+
300
+ // CHILD COMPONENTS / ELEMENTS
301
+
302
+ // Header (contains title & description)
303
+
304
+ .title {
305
+ color: var(--code-block-color-foreground-primary);
306
+ }
307
+
308
+ .description {
309
+ color: var(--code-block-color-foreground-faint);
310
+ }
311
+
312
+ .header {
313
+ display: flex;
314
+ flex-direction: column;
315
+ gap: 4px;
316
+ padding: 8px var(--code-block-code-padding);
317
+ background-color: var(--code-block-color-surface-faint);
318
+ border-bottom: 1px solid var(--code-block-color-border-primary);
319
+ border-top-left-radius: inherit;
320
+ border-top-right-radius: inherit;
321
+
322
+ &:empty {
323
+ display: none;
324
+ }
325
+
326
+ // we add very basic styling for elements that may be yielded in the "title"/"description" elements
327
+
328
+ strong {
329
+ font-weight: var(--mds-typography-font-weight-semibold);
330
+ }
331
+
332
+ code,
333
+ pre {
334
+ display: inline;
335
+ font-size: 0.9em; // as discussed with designers, we reduce the size for optical/visual balance
336
+ font-family: var(--mds-typography-font-stack-mono);
337
+ line-height: 1em;
338
+ }
339
+
340
+ a {
341
+ color: var(--code-block-color-foreground-action);
342
+
343
+ &:focus,
344
+ &:focus-visible {
345
+ text-decoration: none;
346
+ outline: 2px solid var(--mds-color-focus-action-internal);
347
+ outline-offset: 1px;
348
+ }
349
+
350
+ &:hover {
351
+ color: var(--mds-color-foreground-action-hover);
352
+ }
353
+
354
+ &:active {
355
+ color: var(--mds-color-foreground-action-active);
356
+ }
357
+ }
358
+ }
359
+
360
+ .body {
361
+ position: relative;
362
+ border-radius: inherit;
363
+ }
364
+
365
+ // Code
366
+ .code {
367
+ @include hds-focus-ring-basic();
368
+ display: block;
369
+ margin: 0;
370
+ padding: var(--code-block-code-padding) 0;
371
+ overflow: auto;
372
+ font-size: 0.8125rem;
373
+ font-family: var(--mds-typography-font-stack-mono);
374
+ border-radius: inherit;
375
+
376
+ ::selection {
377
+ color: var(--code-block-color-foreground-selection);
378
+ background-color: var(--code-block-color-surface-selection);
379
+ }
380
+ }
381
+
382
+ // CopyButton
383
+ .copy-button {
384
+ --copy-button-token-idle: var(--code-block-color-foreground-primary);
385
+ --copy-button-token-success: var(--code-block-color-foreground-success);
386
+ --copy-button-token-error: var(--code-block-color-foreground-success);
387
+
388
+ position: absolute !important;
389
+ top: 11px; // 12px -1px accounting for border
390
+ right: 12px; // 12px -1px accounting for border
391
+ // Overriding default colors must have !important due to style modules
392
+ color: var(--code-block-color-foreground-primary) !important;
393
+ background-color: var(--code-block-color-surface-faint) !important;
394
+ border: 1px solid var(--code-block-color-border-strong) !important;
395
+
396
+ &:hover {
397
+ background-color: var(--code-block-color-surface-primary) !important;
398
+ border-color: var(--code-block-color-border-strong) !important;
399
+ }
400
+
401
+ &:active {
402
+ background-color: var(
403
+ --code-block-color-surface-interactive-active
404
+ ) !important;
405
+ }
406
+
407
+ &:focus,
408
+ &:focus-visible {
409
+ background-color: var(--code-block-color-surface-faint) !important;
410
+ }
411
+ }
412
+
413
+ // Highlighted Lines
414
+ .line-highlight {
415
+ right: 0;
416
+ left: 0;
417
+ margin-top: 0px;
418
+ background-color: var(--code-block-color-line-highlight);
419
+ border: solid var(--code-block-color-line-highlight-border);
420
+ border-width: 0 0 0 4px;
421
+ mix-blend-mode: screen;
422
+ pointer-events: none;
423
+
424
+ // Enable the top border if this is the first line in a group of lines
425
+ &.line-highlight-first {
426
+ border-top-width: 1px;
427
+ }
428
+
429
+ // Enable the bottom border if this is the last line in a group of lines
430
+ &.line-highlight-last {
431
+ border-bottom-width: 1px;
432
+ }
433
+ }
434
+
435
+ .line-numbers {
436
+ counter-reset: linenumber;
437
+
438
+ .code {
439
+ position: relative;
440
+ padding-left: 49px;
441
+ }
442
+
443
+ .line-numbers-rows {
444
+ position: absolute;
445
+ top: 0;
446
+ left: 0;
447
+ min-width: 49px;
448
+ min-height: 100%;
449
+ padding: var(--code-block-code-padding) 0;
450
+ border-right: 1px solid var(--code-block-color-border-primary);
451
+ user-select: none;
452
+ pointer-events: none;
453
+
454
+ > span {
455
+ display: block;
456
+ counter-increment: linenumber;
457
+
458
+ &::before {
459
+ display: block;
460
+ padding-right: var(--code-block-code-padding);
461
+ text-align: right;
462
+ content: counter(linenumber);
463
+ }
464
+ }
465
+ }
466
+
467
+ .line-of-code.line-highlight {
468
+ // This disables the thicker left border on highlighted lines.
469
+ border-width: 0;
470
+
471
+ // This resets the left padding to the original value.
472
+ padding-left: var(--mds-spacing-05);
473
+ }
474
+ }
475
+
476
+ .line-of-code {
477
+ // Lines of code are <span> elements which are inline by default, but
478
+ // we want them to take up the full width of the code block.
479
+ display: block;
480
+
481
+ // When we're rendering line numbers, we need to add padding to the
482
+ // left of lines of code to make room for the line numbers.
483
+ padding-left: var(--mds-spacing-05);
484
+
485
+ &.line-highlight {
486
+ // This accounts for the 4px margin on the left side so the content
487
+ // does not get moved by the margin.
488
+ padding-left: var(--mds-spacing-04);
489
+
490
+ // Enable the top border if this is the first line in a group of lines
491
+ &.line-highlight-first {
492
+ border-top-width: 1px;
493
+ }
494
+
495
+ // Enable the bottom border if this is the last line in a group of lines
496
+ &.line-highlight-last {
497
+ border-bottom-width: 1px;
498
+ }
499
+ }
500
+
501
+ & > span {
502
+ padding-right: var(--mds-spacing-09);
503
+ }
504
+ }
505
+
506
+ .line-number {
507
+ // Line numbers are <span> elements which are inline by default, but we
508
+ // want them to behave like block elements.
509
+ display: block;
510
+ color: #999;
511
+ }
@@ -0,0 +1,34 @@
1
+ const e = "dark__aBMo7", n = "token__aGMSy", t = "title__nX-Ny", i = "description__-44hG", _ = "header__42Fek", a = "body__pLFmP", l = "code__J06se", o = {
2
+ "code-block": "code-block__dOm6M",
3
+ "line-highlight": "line-highlight__a84m6",
4
+ dark: e,
5
+ "language-css": "language-css__8iYaN",
6
+ token: n,
7
+ "language-javascript": "language-javascript__EWK5u",
8
+ "language-markup": "language-markup__E7NSA",
9
+ "language-html": "language-html__rLwMK",
10
+ "is-standalone": "is-standalone__WLWxy",
11
+ title: t,
12
+ description: i,
13
+ header: _,
14
+ body: a,
15
+ code: l,
16
+ "copy-button": "copy-button__nMsTD",
17
+ "line-highlight-first": "line-highlight-first__OMDUP",
18
+ "line-highlight-last": "line-highlight-last__qC6nm",
19
+ "line-numbers": "line-numbers__a9m-I",
20
+ "line-numbers-rows": "line-numbers-rows__MjGTO",
21
+ "line-of-code": "line-of-code__mDztA",
22
+ "line-number": "line-number__-g7V-"
23
+ };
24
+ export {
25
+ a as body,
26
+ l as code,
27
+ e as dark,
28
+ o as default,
29
+ i as description,
30
+ _ as header,
31
+ t as title,
32
+ n as token
33
+ };
34
+ //# sourceMappingURL=code-block.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ interface CodeLinesProps {
3
+ value: ReactNode;
4
+ hasLineNumbers?: boolean;
5
+ highlightLines?: string;
6
+ }
7
+ /**
8
+ * Render the provided code into separate line elements,
9
+ * accounting for all provided options.
10
+ */
11
+ declare const CodeLines: ({ value, hasLineNumbers: lineNumbers, highlightLines: highlight, }: CodeLinesProps) => import("react/jsx-runtime").JSX.Element;
12
+ export { CodeLines };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsxs as c, Fragment as L, jsx as e } from "react/jsx-runtime";
3
+ import { useMemo as d } from "react";
4
+ import u from "classnames";
5
+ import G from "../utils/parse-highlighted-lines.js";
6
+ import N from "./utils/split-jsx-into-lines.js";
7
+ import b from "./utils/split-html-into-lines.js";
8
+ import h from "../code-block.module.scss.js";
9
+ const S = ({
10
+ value: n,
11
+ hasLineNumbers: I,
12
+ highlightLines: f
13
+ }) => {
14
+ const o = G(f), m = d(() => (typeof n == "string" ? b(n) : N(n)).map((g, l) => {
15
+ const t = l + 1, s = o.indexOf(t) !== -1;
16
+ return { children: g, highlight: s };
17
+ }).map(({ highlight: g, ...l }, t, s) => {
18
+ const p = t === 0 ? null : s[t - 1], a = t === s.length - 1 ? null : s[t + 1];
19
+ return {
20
+ ...l,
21
+ highlight: g,
22
+ highlightIsFirstInGroup: !p || !p.highlight,
23
+ highlightIsLastInGroup: !a || !a.highlight
24
+ };
25
+ }), [n, o]);
26
+ return /* @__PURE__ */ c(L, { children: [
27
+ I ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: h["line-numbers-rows"], children: m.map((i, r) => /* @__PURE__ */ e(
28
+ "span",
29
+ {
30
+ className: u(h["line-number"], {
31
+ [h["line-highlight"]]: i.highlight,
32
+ [h["line-highlight-first"]]: i.highlightIsFirstInGroup,
33
+ [h["line-highlight-last"]]: i.highlightIsLastInGroup
34
+ })
35
+ },
36
+ r
37
+ )) }) : null,
38
+ /* @__PURE__ */ e("span", { children: m.map((i, r) => /* @__PURE__ */ c(
39
+ "span",
40
+ {
41
+ className: u(h["line-of-code"], {
42
+ [h["line-highlight"]]: i.highlight,
43
+ [h["line-highlight-first"]]: i.highlightIsFirstInGroup,
44
+ [h["line-highlight-last"]]: i.highlightIsLastInGroup
45
+ }),
46
+ children: [
47
+ i.children,
48
+ `
49
+ `
50
+ ]
51
+ },
52
+ r
53
+ )) })
54
+ ] });
55
+ };
56
+ export {
57
+ S as CodeLines
58
+ };
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/code-block/code-lines/index.tsx"],"sourcesContent":["'use client'\n\n/**\n * Note: lines of code are expected to be stable. If we need to work with\n * dynamic code blocks in the future, we could assign random unique IDs\n * to each line during the `linesOfCode` `useMemo` function.\n *\n * For now, we disable react/no-array-index key for the entire file.\n */\n/* eslint-disable react/no-array-index-key */\n\nimport { useMemo, type ReactNode } from 'react'\nimport classNames from 'classnames'\nimport parseHighlightedLines from '../utils/parse-highlighted-lines'\nimport splitJsxIntoLines from './utils/split-jsx-into-lines'\nimport splitHtmlIntoLines from './utils/split-html-into-lines'\nimport s from '../code-block.module.scss'\n\ninterface CodeLinesProps {\n\tvalue: ReactNode\n\thasLineNumbers?: boolean\n\thighlightLines?: string\n}\n\n/**\n * Render the provided code into separate line elements,\n * accounting for all provided options.\n */\nconst CodeLines = ({\n\tvalue,\n\thasLineNumbers: lineNumbers,\n\thighlightLines: highlight,\n}: CodeLinesProps) => {\n\t// Parse out an array of integers representing which lines to highlight\n\tconst highlightedLines = parseHighlightedLines(highlight) as number[]\n\n\t/**\n\t * Split the incoming code into lines.\n\t * We need to do this in order to render each line of code in a\n\t * separate element, which is necessary for features such as highlighting\n\t * specific lines and allowing code to wrap.\n\t */\n\tconst linesOfCode = useMemo(() => {\n\t\tconst isHtmlString = typeof value === 'string'\n\t\tconst lineElements = isHtmlString\n\t\t\t? splitHtmlIntoLines(value)\n\t\t\t: splitJsxIntoLines(value)\n\t\treturn lineElements\n\t\t\t.map((children, index) => {\n\t\t\t\tconst number = index + 1\n\t\t\t\tconst highlight = highlightedLines.indexOf(number) !== -1\n\t\t\t\treturn { children, highlight }\n\t\t\t})\n\t\t\t.map(({ highlight, ...rest }, index, lines) => {\n\t\t\t\t// Add properties to help with highlighting adjacent lines of code,\n\t\t\t\t// in which case we want to apply a border to the first and last lines,\n\t\t\t\t// but not the lines in the middle of the group.\n\t\t\t\tconst prevLine = index === 0 ? null : lines[index - 1]\n\t\t\t\tconst nextLine = index === lines.length - 1 ? null : lines[index + 1]\n\t\t\t\treturn {\n\t\t\t\t\t...rest,\n\t\t\t\t\thighlight,\n\t\t\t\t\thighlightIsFirstInGroup: !prevLine || !prevLine.highlight,\n\t\t\t\t\thighlightIsLastInGroup: !nextLine || !nextLine.highlight,\n\t\t\t\t}\n\t\t\t})\n\t}, [value, highlightedLines])\n\n\t/**\n\t * For overflowing code, we use a two-column layout.\n\t * The first column contains line numbers, and is effectively fixed.\n\t * The second column contains the lines themselves, and is an overflow\n\t * container to allow extra long lines to scroll as needed.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{lineNumbers ? (\n\t\t\t\t<span aria-hidden=\"true\" className={s['line-numbers-rows']}>\n\t\t\t\t\t{linesOfCode.map((line, idx) => (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\tclassName={classNames(s['line-number'], {\n\t\t\t\t\t\t\t\t[s['line-highlight']]: line.highlight,\n\t\t\t\t\t\t\t\t[s['line-highlight-first']]: line.highlightIsFirstInGroup,\n\t\t\t\t\t\t\t\t[s['line-highlight-last']]: line.highlightIsLastInGroup,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t<span>\n\t\t\t\t{linesOfCode.map((line, idx) => (\n\t\t\t\t\t<span\n\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\tclassName={classNames(s['line-of-code'], {\n\t\t\t\t\t\t\t[s['line-highlight']]: line.highlight,\n\t\t\t\t\t\t\t[s['line-highlight-first']]: line.highlightIsFirstInGroup,\n\t\t\t\t\t\t\t[s['line-highlight-last']]: line.highlightIsLastInGroup,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{line.children}\n\t\t\t\t\t\t{/* We are _not_ rendering our lines as block elements, so we need\n\t\t\t\t\t\t to add a trailing newline to all lines. As well, trailing\n\t\t\t\t\t\t\t\tnewlines are necessary for some browsers (FireFox)\n\t\t\t\t\t\t to preserve whitespace during select-and-copy of code */}\n\t\t\t\t\t\t{'\\n'}\n\t\t\t\t\t</span>\n\t\t\t\t))}\n\t\t\t</span>\n\t\t</>\n\t)\n}\n\nexport { CodeLines }\n"],"names":["CodeLines","value","lineNumbers","highlight","highlightedLines","parseHighlightedLines","useMemo","splitHtmlIntoLines","splitJsxIntoLines","children","index","number","highlight2","rest","prevLine","lines","nextLine","jsxs","Fragment","jsx","s","linesOfCode","line","idx","classNames"],"mappings":";;;;;;;;AA4BmB,MAClBA,IAAA,CAAA;AAAA,EACA,OAAAC;AAAA,EACA,gBAAgBC;AAAA,EACjB,gBAAsBC;AAErB;AAQA,QAAMC,IAAcC,EAAcF,CAAA,OAC3BG,EAAe,OACA,OAAAL,KAClB,WAGcM,EAAUN,CAAA,IAAAO,EAAAP,CAAA,GACV,KAAQQ,GAAAC,MAAA;AACvB,UAAMP,IAAAA,IAAY,OACCC,UAAUO,CAAA,MAAA;AAC7B,aACO,UAAAF,GAAAN,WAAAA;EAIP,CAAA,EAAA,IAAA,CAAM,EAAA,WAAWS,GAAc,GAAAC,EAAO,GAAAH,SAAe;AACrD,UAAMI,IAAWJ,MAAU,IAAA,OAAMK,MAAa,CAAO,GACrDC,IAAON,MAAAK,EAAA,SAAA,IAAA,OAAAA,EAAAL,IAAA,CAAA;AAAA,WACH;AAAA,MACH,GAAAG;AAAA,MACA,WAAAD;AAAA,MACA,yBAAyB,MAAa,GAAS;AAAA,MAChD,wBAAA,CAAAI,KAAA,CAAAA,EAAA;AAAA,IACA;AAAA,EACH,CAAG,QASF,CAAA;AACE,SAAA,gBAAAC,EAAAC,GACC,EAAA,UAAK;AAAA,IAEJhB,IAAC,gBAAAiB,EAAA,QAAA,EAAA,eAAA,QAAA,WAAAC,EAAA,mBAAA,GAAA,UAAAC,EAAA,IAAA,CAAAC,GAAAC,MAAA,gBAAAJ;AAAA,MAAA;AAAA,MAAA;AAAA,QAEwC,WACpCK,EAAiBJ,EAAA,aAAQ,GAAA;AAAA,UAC5B,CAACA,EAAE,gBAAA,CAAA,GAAAE,EAAuB;AAAA,UAC1B,CAACF,EAAE,sBAAsB,CAAA,KAAQ;AAAA,UACjC,CAAAA,EAAA,qBAAA,CAAA,GAAAE,EAAA;AAAA,QAAA,CAAA;AAAA,MALI;AAAA;IASL,CAAA,EAAA,CAAA,IAAA;AAAA,IAGD,gBAAAH,EAAA,QAAA,EAAA,UAAAE,EAAA,IAAA,CAAAC,GAAAC,MAAA,gBAAAN;AAAA,MAAA;AAAA,MAAA;AAAA,QAEyC,WACrCO,EAAiBJ,EAAA,cAAQ,GAAA;AAAA,UAC5B,CAACA,EAAE,gBAAA,CAAA,GAAAE,EAAuB;AAAA,UAC1B,CAACF,EAAE,sBAAsB,CAAA,KAAQ;AAAA,UACjC,CAAAA,EAAA,qBAAA,CAAA,GAAAE,EAAA;AAAA,QAEA;QAAA,UAAK;AAAA,UAKLA,EAAA;AAAA,UAAA;AAAA;AAAA,QAAA;AAAA,MAZI;AAAA,MAcNC;AAAA,KAEH,EAAA,CAAA;AAAA,EAEF,EAAA,CAAA;;"}
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Given a string of HTML, split it on newlines,
4
+ * and return an array of React <span> elements,
5
+ * each of which will contain a single line.
6
+ *
7
+ * Note that HTML tokens should not be multi-line,
8
+ * ie, all newline characters should be surfaced
9
+ * to the top level rather than nested in syntax
10
+ * highlighting tokens (otherwise the line-by-line
11
+ * markup we render would be invalid). We have
12
+ * a rehype plugin we use with our highlightString()
13
+ * utility to ensure newlines are surfaced in this way.
14
+ *
15
+ * @param {string} codeHtml String of HTML
16
+ * @returns Array of JSX <span> elements
17
+ */
18
+ declare function splitHtmlIntoLines(codeHtml: string): (ReactNode | null)[];
19
+ export default splitHtmlIntoLines;
@@ -0,0 +1,19 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const r = '<span class="line"></span>';
3
+ function p(t) {
4
+ const s = t.split(`
5
+ `);
6
+ return s.map((n, i) => i == s.length - 1 && n == "" ? null : /* @__PURE__ */ e(
7
+ "span",
8
+ {
9
+ dangerouslySetInnerHTML: {
10
+ __html: n === "" || n === r ? "&nbsp;" : n
11
+ }
12
+ },
13
+ i
14
+ ));
15
+ }
16
+ export {
17
+ p as default
18
+ };
19
+ //# sourceMappingURL=split-html-into-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-html-into-lines.js","sources":["../../../../../src/components/code-block/code-lines/utils/split-html-into-lines.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nconst SHIKI_BLANK_LINE = '<span class=\"line\"></span>'\n/**\n * Given a string of HTML, split it on newlines,\n * and return an array of React <span> elements,\n * each of which will contain a single line.\n *\n * Note that HTML tokens should not be multi-line,\n * ie, all newline characters should be surfaced\n * to the top level rather than nested in syntax\n * highlighting tokens (otherwise the line-by-line\n * markup we render would be invalid). We have\n * a rehype plugin we use with our highlightString()\n * utility to ensure newlines are surfaced in this way.\n *\n * @param {string} codeHtml String of HTML\n * @returns Array of JSX <span> elements\n */\nfunction splitHtmlIntoLines(codeHtml: string): (ReactNode | null)[] {\n\tconst lineParts = codeHtml.split('\\n')\n\treturn lineParts.map((lineHtml, stableIdx) => {\n\t\t// Cut trailing newlines\n\t\tconst isLastLine = stableIdx == lineParts.length - 1\n\t\tconst isTrailingNewline = isLastLine && lineHtml == ''\n\t\tif (isTrailingNewline) return null\n\t\t// Otherwise, render the line\n\t\treturn (\n\t\t\t<span\n\t\t\t\t// This array is stable, so we can use index as key\n\t\t\t\t// eslint-disable-next-line react/no-array-index-key\n\t\t\t\tkey={stableIdx}\n\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t__html:\n\t\t\t\t\t\tlineHtml === '' || lineHtml === SHIKI_BLANK_LINE\n\t\t\t\t\t\t\t? '&nbsp;'\n\t\t\t\t\t\t\t: lineHtml,\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t})\n}\n\nexport default splitHtmlIntoLines\n"],"names":["SHIKI_BLANK_LINE","splitHtmlIntoLines","codeHtml","lineParts","lineHtml","stableIdx","jsx"],"mappings":";AAEA,MAAMA,IAAmB;AAiBzB,SAASC,EAAmBC,GAAwC;AACnE,QAAMC,IAAYD,EAAS,MAAM;AAAA,CAAI;AACrC,SAAOC,EAAU,IAAI,CAACC,GAAUC,MAEZA,KAAaF,EAAU,SAAS,KACXC,KAAY,KACtB,OAG7B,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MAIA,yBAAyB;AAAA,QACxB,QACCF,MAAa,MAAMA,MAAaJ,IAC7B,WACAI;AAAA,MAAA;AAAA,IACL;AAAA,IANKC;AAAA,EAAA,CASP;AACF;"}