@guardian/stand 0.0.40 → 0.0.42

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 (856) hide show
  1. package/README.md +1 -1
  2. package/dist/AlertBanner.cjs +5 -9
  3. package/dist/AlertBanner.d.cts +5 -0
  4. package/dist/AlertBanner.d.ts +5 -0
  5. package/dist/AlertBanner.js +3 -2
  6. package/dist/Avatar.cjs +5 -9
  7. package/dist/Avatar.d.cts +5 -0
  8. package/dist/Avatar.d.ts +5 -0
  9. package/dist/Avatar.js +3 -2
  10. package/dist/AvatarButton.cjs +3 -7
  11. package/dist/AvatarButton.d.cts +4 -0
  12. package/dist/AvatarButton.d.ts +4 -0
  13. package/dist/AvatarButton.js +2 -1
  14. package/dist/AvatarLink.cjs +3 -7
  15. package/dist/AvatarLink.d.cts +4 -0
  16. package/dist/AvatarLink.d.ts +4 -0
  17. package/dist/AvatarLink.js +2 -1
  18. package/dist/Button.cjs +5 -9
  19. package/dist/Button.d.cts +5 -0
  20. package/dist/Button.d.ts +5 -0
  21. package/dist/Button.js +3 -2
  22. package/dist/Byline.cjs +5 -9
  23. package/dist/Byline.d.cts +5 -0
  24. package/dist/Byline.d.ts +5 -0
  25. package/dist/Byline.js +3 -2
  26. package/dist/Checkbox.cjs +7 -11
  27. package/dist/Checkbox.d.cts +6 -0
  28. package/dist/Checkbox.d.ts +6 -0
  29. package/dist/Checkbox.js +4 -3
  30. package/dist/DatePicker.cjs +5 -9
  31. package/dist/DatePicker.d.cts +5 -0
  32. package/dist/DatePicker.d.ts +5 -0
  33. package/dist/DatePicker.js +3 -2
  34. package/dist/Favicon.cjs +5 -9
  35. package/dist/Favicon.d.cts +5 -0
  36. package/dist/Favicon.d.ts +5 -0
  37. package/dist/Favicon.js +3 -2
  38. package/dist/Form.cjs +3 -7
  39. package/dist/Form.d.cts +2 -0
  40. package/dist/Form.d.ts +2 -0
  41. package/dist/Form.js +2 -1
  42. package/dist/Grid.cjs +6 -10
  43. package/dist/Grid.d.cts +5 -0
  44. package/dist/Grid.d.ts +5 -0
  45. package/dist/Grid.js +3 -2
  46. package/dist/Icon.cjs +5 -9
  47. package/dist/Icon.d.cts +5 -0
  48. package/dist/Icon.d.ts +5 -0
  49. package/dist/Icon.js +3 -2
  50. package/dist/IconButton.cjs +3 -7
  51. package/dist/IconButton.d.cts +4 -0
  52. package/dist/IconButton.d.ts +4 -0
  53. package/dist/IconButton.js +2 -1
  54. package/dist/IconLinkButton.cjs +3 -7
  55. package/dist/IconLinkButton.d.cts +4 -0
  56. package/dist/IconLinkButton.d.ts +4 -0
  57. package/dist/IconLinkButton.js +2 -1
  58. package/dist/InlineMessage.cjs +5 -9
  59. package/dist/InlineMessage.d.cts +5 -0
  60. package/dist/InlineMessage.d.ts +5 -0
  61. package/dist/InlineMessage.js +3 -2
  62. package/dist/IntendedAudienceSignifier.cjs +5 -9
  63. package/dist/IntendedAudienceSignifier.d.cts +5 -0
  64. package/dist/IntendedAudienceSignifier.d.ts +5 -0
  65. package/dist/IntendedAudienceSignifier.js +3 -2
  66. package/dist/Layout.cjs +5 -9
  67. package/dist/Layout.d.cts +5 -0
  68. package/dist/Layout.d.ts +5 -0
  69. package/dist/Layout.js +3 -2
  70. package/dist/Link.cjs +5 -9
  71. package/dist/Link.d.cts +5 -0
  72. package/dist/Link.d.ts +5 -0
  73. package/dist/Link.js +3 -2
  74. package/dist/LinkButton.cjs +3 -7
  75. package/dist/LinkButton.d.cts +4 -0
  76. package/dist/LinkButton.d.ts +4 -0
  77. package/dist/LinkButton.js +2 -1
  78. package/dist/Menu.cjs +9 -13
  79. package/dist/Menu.d.cts +5 -0
  80. package/dist/Menu.d.ts +5 -0
  81. package/dist/Menu.js +3 -2
  82. package/dist/RadioGroup.cjs +6 -10
  83. package/dist/RadioGroup.d.cts +5 -0
  84. package/dist/RadioGroup.d.ts +5 -0
  85. package/dist/RadioGroup.js +3 -2
  86. package/dist/Select.cjs +6 -10
  87. package/dist/Select.d.cts +5 -0
  88. package/dist/Select.d.ts +5 -0
  89. package/dist/Select.js +3 -2
  90. package/dist/TagPicker.cjs +11 -15
  91. package/dist/TagPicker.d.cts +6 -0
  92. package/dist/TagPicker.d.ts +6 -0
  93. package/dist/TagPicker.js +6 -5
  94. package/dist/TextArea.cjs +5 -9
  95. package/dist/TextArea.d.cts +5 -0
  96. package/dist/TextArea.d.ts +5 -0
  97. package/dist/TextArea.js +3 -2
  98. package/dist/TextInput.cjs +5 -9
  99. package/dist/TextInput.d.cts +5 -0
  100. package/dist/TextInput.d.ts +5 -0
  101. package/dist/TextInput.js +3 -2
  102. package/dist/TopBar.cjs +13 -17
  103. package/dist/TopBar.d.cts +14 -0
  104. package/dist/TopBar.d.ts +14 -0
  105. package/dist/TopBar.js +6 -5
  106. package/dist/Typography.cjs +5 -9
  107. package/dist/Typography.d.cts +5 -0
  108. package/dist/Typography.d.ts +5 -0
  109. package/dist/Typography.js +3 -2
  110. package/dist/UserMenu.cjs +5 -9
  111. package/dist/UserMenu.d.cts +3 -0
  112. package/dist/UserMenu.d.ts +3 -0
  113. package/dist/UserMenu.js +3 -2
  114. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  115. package/dist/components/AlertBanner/AlertBanner.cjs +39 -62
  116. package/dist/components/AlertBanner/AlertBanner.d.cts +16 -0
  117. package/dist/components/AlertBanner/AlertBanner.d.ts +16 -0
  118. package/dist/components/AlertBanner/AlertBanner.js +37 -26
  119. package/dist/components/AlertBanner/styles.cjs +10 -11
  120. package/dist/components/AlertBanner/styles.d.cts +8 -0
  121. package/dist/components/AlertBanner/styles.d.ts +8 -0
  122. package/dist/components/AlertBanner/styles.js +7 -7
  123. package/dist/components/AlertBanner/types.d.cts +31 -0
  124. package/dist/components/AlertBanner/types.d.ts +31 -0
  125. package/dist/components/Avatar/Avatar.cjs +34 -53
  126. package/dist/components/Avatar/Avatar.d.cts +15 -0
  127. package/dist/components/Avatar/Avatar.d.ts +15 -0
  128. package/dist/components/Avatar/Avatar.js +32 -22
  129. package/dist/components/Avatar/styles.cjs +10 -11
  130. package/dist/components/Avatar/styles.d.cts +9 -0
  131. package/dist/components/Avatar/styles.d.ts +9 -0
  132. package/dist/components/Avatar/styles.js +6 -6
  133. package/dist/components/Avatar/types.cjs +12 -13
  134. package/dist/components/Avatar/types.d.cts +47 -0
  135. package/dist/components/Avatar/types.d.ts +47 -0
  136. package/dist/components/Avatar/types.js +12 -11
  137. package/dist/components/AvatarButton/AvatarButton.cjs +16 -11
  138. package/dist/components/AvatarButton/AvatarButton.d.cts +6 -0
  139. package/dist/components/AvatarButton/AvatarButton.d.ts +6 -0
  140. package/dist/components/AvatarButton/AvatarButton.js +15 -9
  141. package/dist/components/AvatarButton/styles.cjs +7 -8
  142. package/dist/components/AvatarButton/styles.d.cts +7 -0
  143. package/dist/components/AvatarButton/styles.d.ts +7 -0
  144. package/dist/components/AvatarButton/styles.js +5 -5
  145. package/dist/components/AvatarButton/types.d.cts +7 -0
  146. package/dist/components/AvatarButton/types.d.ts +7 -0
  147. package/dist/components/AvatarLink/AvatarLink.cjs +16 -11
  148. package/dist/components/AvatarLink/AvatarLink.d.cts +6 -0
  149. package/dist/components/AvatarLink/AvatarLink.d.ts +6 -0
  150. package/dist/components/AvatarLink/AvatarLink.js +15 -9
  151. package/dist/components/AvatarLink/styles.cjs +7 -8
  152. package/dist/components/AvatarLink/styles.d.cts +7 -0
  153. package/dist/components/AvatarLink/styles.d.ts +7 -0
  154. package/dist/components/AvatarLink/styles.js +5 -5
  155. package/dist/components/AvatarLink/types.d.cts +7 -0
  156. package/dist/components/AvatarLink/types.d.ts +7 -0
  157. package/dist/components/Button/Button.cjs +22 -33
  158. package/dist/components/Button/Button.d.cts +13 -0
  159. package/dist/components/Button/Button.d.ts +13 -0
  160. package/dist/components/Button/Button.js +22 -15
  161. package/dist/components/Button/styles.cjs +11 -12
  162. package/dist/components/Button/styles.d.cts +9 -0
  163. package/dist/components/Button/styles.d.ts +9 -0
  164. package/dist/components/Button/styles.js +6 -6
  165. package/dist/components/Button/types.d.cts +22 -0
  166. package/dist/components/Button/types.d.ts +22 -0
  167. package/dist/components/Byline/Byline.cjs +333 -366
  168. package/dist/components/Byline/Byline.d.cts +87 -0
  169. package/dist/{types/components → components}/Byline/Byline.d.ts +30 -26
  170. package/dist/components/Byline/Byline.js +331 -270
  171. package/dist/components/Byline/Preview.cjs +32 -42
  172. package/dist/components/Byline/Preview.js +31 -23
  173. package/dist/components/Byline/lib.cjs +152 -216
  174. package/dist/components/Byline/lib.d.cts +23 -0
  175. package/dist/components/Byline/lib.d.ts +24 -0
  176. package/dist/components/Byline/lib.js +153 -163
  177. package/dist/components/Byline/placeholder.cjs +15 -24
  178. package/dist/components/Byline/placeholder.js +14 -22
  179. package/dist/components/Byline/plugins.cjs +89 -120
  180. package/dist/components/Byline/plugins.js +87 -110
  181. package/dist/components/Byline/schema.cjs +45 -65
  182. package/dist/components/Byline/schema.js +45 -58
  183. package/dist/components/Byline/styles.cjs +19 -20
  184. package/dist/components/Byline/styles.js +13 -13
  185. package/dist/components/Byline/theme.d.cts +7 -0
  186. package/dist/components/Byline/theme.d.ts +7 -0
  187. package/dist/components/Checkbox/Checkbox.cjs +33 -52
  188. package/dist/components/Checkbox/Checkbox.d.cts +13 -0
  189. package/dist/components/Checkbox/Checkbox.d.ts +13 -0
  190. package/dist/components/Checkbox/Checkbox.js +33 -16
  191. package/dist/components/Checkbox/CheckboxGroup.cjs +30 -33
  192. package/dist/components/Checkbox/CheckboxGroup.d.cts +10 -0
  193. package/dist/components/Checkbox/CheckboxGroup.d.ts +10 -0
  194. package/dist/components/Checkbox/CheckboxGroup.js +29 -25
  195. package/dist/components/Checkbox/styles.cjs +13 -17
  196. package/dist/components/Checkbox/styles.d.cts +9 -0
  197. package/dist/components/Checkbox/styles.d.ts +9 -0
  198. package/dist/components/Checkbox/styles.js +8 -8
  199. package/dist/components/Checkbox/types.d.cts +15 -0
  200. package/dist/components/Checkbox/types.d.ts +15 -0
  201. package/dist/components/DatePicker/DatePicker.cjs +156 -149
  202. package/dist/components/DatePicker/DatePicker.d.cts +12 -0
  203. package/dist/components/DatePicker/DatePicker.d.ts +12 -0
  204. package/dist/components/DatePicker/DatePicker.js +160 -114
  205. package/dist/components/DatePicker/styles.cjs +15 -20
  206. package/dist/components/DatePicker/styles.d.cts +8 -0
  207. package/dist/components/DatePicker/styles.d.ts +8 -0
  208. package/dist/components/DatePicker/styles.js +11 -11
  209. package/dist/components/DatePicker/types.d.cts +23 -0
  210. package/dist/components/DatePicker/types.d.ts +23 -0
  211. package/dist/components/Favicon/Favicon.cjs +40 -44
  212. package/dist/components/Favicon/Favicon.d.cts +6 -0
  213. package/dist/components/Favicon/Favicon.d.ts +6 -0
  214. package/dist/components/Favicon/Favicon.js +39 -27
  215. package/dist/components/Favicon/styles.cjs +11 -12
  216. package/dist/components/Favicon/styles.d.cts +9 -0
  217. package/dist/components/Favicon/styles.d.ts +9 -0
  218. package/dist/components/Favicon/styles.js +7 -7
  219. package/dist/components/Favicon/types.d.cts +41 -0
  220. package/dist/components/Favicon/types.d.ts +41 -0
  221. package/dist/components/Form/Form.cjs +35 -45
  222. package/dist/components/Form/Form.js +33 -14
  223. package/dist/components/Form/styles.cjs +16 -24
  224. package/dist/components/Form/styles.d.cts +8 -0
  225. package/dist/components/Form/styles.d.ts +8 -0
  226. package/dist/components/Form/styles.js +8 -8
  227. package/dist/components/Form/types.cjs +13 -10
  228. package/dist/components/Form/types.d.cts +38 -0
  229. package/dist/components/Form/types.d.ts +38 -0
  230. package/dist/components/Form/types.js +12 -8
  231. package/dist/components/Grid/Grid.cjs +21 -33
  232. package/dist/components/Grid/Grid.d.cts +20 -0
  233. package/dist/components/Grid/Grid.d.ts +20 -0
  234. package/dist/components/Grid/Grid.js +18 -9
  235. package/dist/components/Grid/styles.cjs +65 -55
  236. package/dist/components/Grid/styles.d.cts +9 -0
  237. package/dist/components/Grid/styles.d.ts +9 -0
  238. package/dist/components/Grid/styles.js +56 -33
  239. package/dist/components/Grid/types.d.cts +29 -0
  240. package/dist/components/Grid/types.d.ts +29 -0
  241. package/dist/components/Icon/Icon.cjs +34 -41
  242. package/dist/components/Icon/Icon.d.cts +15 -0
  243. package/dist/components/Icon/Icon.d.ts +15 -0
  244. package/dist/components/Icon/Icon.js +32 -13
  245. package/dist/components/Icon/Styles.cjs +22 -0
  246. package/dist/components/Icon/Styles.d.cts +7 -0
  247. package/dist/components/Icon/Styles.d.ts +7 -0
  248. package/dist/components/Icon/{styles.js → Styles.js} +6 -6
  249. package/dist/components/Icon/types.d.cts +31 -0
  250. package/dist/components/Icon/types.d.ts +31 -0
  251. package/dist/components/IconButton/IconButton.cjs +30 -43
  252. package/dist/components/IconButton/IconButton.d.cts +14 -0
  253. package/dist/components/IconButton/IconButton.d.ts +14 -0
  254. package/dist/components/IconButton/IconButton.js +28 -23
  255. package/dist/components/IconButton/styles.cjs +5 -7
  256. package/dist/components/IconButton/styles.d.cts +6 -0
  257. package/dist/components/IconButton/styles.d.ts +6 -0
  258. package/dist/components/IconButton/styles.js +3 -3
  259. package/dist/components/IconButton/types.d.cts +31 -0
  260. package/dist/components/IconButton/types.d.ts +31 -0
  261. package/dist/components/IconLinkButton/IconLinkButton.cjs +30 -40
  262. package/dist/components/IconLinkButton/IconLinkButton.d.cts +14 -0
  263. package/dist/components/IconLinkButton/IconLinkButton.d.ts +14 -0
  264. package/dist/components/IconLinkButton/IconLinkButton.js +28 -20
  265. package/dist/components/IconLinkButton/styles.cjs +5 -7
  266. package/dist/components/IconLinkButton/styles.d.cts +6 -0
  267. package/dist/components/IconLinkButton/styles.d.ts +6 -0
  268. package/dist/components/IconLinkButton/styles.js +3 -3
  269. package/dist/components/IconLinkButton/types.d.cts +31 -0
  270. package/dist/components/IconLinkButton/types.d.ts +31 -0
  271. package/dist/components/InlineMessage/InlineMessage.cjs +34 -62
  272. package/dist/components/InlineMessage/InlineMessage.d.cts +15 -0
  273. package/dist/components/InlineMessage/InlineMessage.d.ts +15 -0
  274. package/dist/components/InlineMessage/InlineMessage.js +32 -24
  275. package/dist/components/InlineMessage/styles.cjs +8 -9
  276. package/dist/components/InlineMessage/styles.d.cts +9 -0
  277. package/dist/components/InlineMessage/styles.d.ts +9 -0
  278. package/dist/components/InlineMessage/styles.js +6 -6
  279. package/dist/components/InlineMessage/types.d.cts +25 -0
  280. package/dist/components/InlineMessage/types.d.ts +25 -0
  281. package/dist/components/IntendedAudienceSignifier/FlagIcons.cjs +113 -112
  282. package/dist/components/IntendedAudienceSignifier/FlagIcons.js +112 -8
  283. package/dist/components/IntendedAudienceSignifier/IntendedAudienceSignifier.cjs +55 -92
  284. package/dist/components/IntendedAudienceSignifier/IntendedAudienceSignifier.d.cts +13 -0
  285. package/dist/components/IntendedAudienceSignifier/IntendedAudienceSignifier.d.ts +13 -0
  286. package/dist/components/IntendedAudienceSignifier/IntendedAudienceSignifier.js +54 -61
  287. package/dist/components/IntendedAudienceSignifier/styles.cjs +9 -10
  288. package/dist/components/IntendedAudienceSignifier/styles.d.cts +8 -0
  289. package/dist/components/IntendedAudienceSignifier/styles.d.ts +8 -0
  290. package/dist/components/IntendedAudienceSignifier/styles.js +4 -4
  291. package/dist/components/IntendedAudienceSignifier/types.d.cts +11 -0
  292. package/dist/components/IntendedAudienceSignifier/types.d.ts +11 -0
  293. package/dist/components/Layout/Layout.cjs +85 -71
  294. package/dist/components/Layout/Layout.d.cts +14 -0
  295. package/dist/components/Layout/Layout.d.ts +14 -0
  296. package/dist/components/Layout/Layout.js +79 -21
  297. package/dist/components/Layout/styles.cjs +26 -29
  298. package/dist/components/Layout/styles.d.cts +13 -0
  299. package/dist/components/Layout/styles.d.ts +13 -0
  300. package/dist/components/Layout/styles.js +16 -18
  301. package/dist/components/Layout/types.d.cts +34 -0
  302. package/dist/components/Layout/types.d.ts +34 -0
  303. package/dist/components/Link/Link.cjs +21 -35
  304. package/dist/components/Link/Link.d.cts +13 -0
  305. package/dist/components/Link/Link.d.ts +13 -0
  306. package/dist/components/Link/Link.js +21 -16
  307. package/dist/components/Link/styles.cjs +7 -8
  308. package/dist/components/Link/styles.d.cts +9 -0
  309. package/dist/components/Link/styles.d.ts +9 -0
  310. package/dist/components/Link/styles.js +5 -5
  311. package/dist/components/Link/types.d.cts +15 -0
  312. package/dist/components/Link/types.d.ts +15 -0
  313. package/dist/components/LinkButton/LinkButton.cjs +22 -33
  314. package/dist/components/LinkButton/LinkButton.d.cts +13 -0
  315. package/dist/components/LinkButton/LinkButton.d.ts +13 -0
  316. package/dist/components/LinkButton/LinkButton.js +20 -13
  317. package/dist/components/LinkButton/Styles.cjs +7 -0
  318. package/dist/components/LinkButton/Styles.d.cts +6 -0
  319. package/dist/components/LinkButton/Styles.d.ts +6 -0
  320. package/dist/components/LinkButton/{styles.js → Styles.js} +3 -3
  321. package/dist/components/LinkButton/types.d.cts +22 -0
  322. package/dist/components/LinkButton/types.d.ts +22 -0
  323. package/dist/components/Menu/Menu.cjs +119 -186
  324. package/dist/components/Menu/Menu.d.cts +41 -0
  325. package/dist/components/Menu/Menu.d.ts +41 -0
  326. package/dist/components/Menu/Menu.js +117 -61
  327. package/dist/components/Menu/styles.cjs +24 -25
  328. package/dist/components/Menu/styles.d.cts +17 -0
  329. package/dist/components/Menu/styles.d.ts +17 -0
  330. package/dist/components/Menu/styles.js +5 -5
  331. package/dist/components/Menu/types.d.cts +67 -0
  332. package/dist/components/Menu/types.d.ts +67 -0
  333. package/dist/components/RadioGroup/RadioGroup.cjs +44 -61
  334. package/dist/components/RadioGroup/RadioGroup.d.cts +19 -0
  335. package/dist/components/RadioGroup/RadioGroup.d.ts +19 -0
  336. package/dist/components/RadioGroup/RadioGroup.js +43 -29
  337. package/dist/components/RadioGroup/styles.cjs +11 -12
  338. package/dist/components/RadioGroup/styles.d.cts +8 -0
  339. package/dist/components/RadioGroup/styles.d.ts +8 -0
  340. package/dist/components/RadioGroup/styles.js +8 -8
  341. package/dist/components/RadioGroup/types.d.cts +14 -0
  342. package/dist/components/RadioGroup/types.d.ts +14 -0
  343. package/dist/components/Select/Select.cjs +43 -51
  344. package/dist/components/Select/Select.d.cts +15 -0
  345. package/dist/components/Select/Select.d.ts +15 -0
  346. package/dist/components/Select/Select.js +43 -35
  347. package/dist/components/Select/styles.cjs +13 -14
  348. package/dist/components/Select/styles.d.cts +9 -0
  349. package/dist/components/Select/styles.d.ts +9 -0
  350. package/dist/components/Select/styles.js +9 -9
  351. package/dist/components/Select/types.d.cts +10 -0
  352. package/dist/components/Select/types.d.ts +10 -0
  353. package/dist/components/TagPicker/Autocomplete.cjs +146 -102
  354. package/dist/components/TagPicker/Autocomplete.d.cts +134 -0
  355. package/dist/{types/components → components}/TagPicker/Autocomplete.d.ts +49 -32
  356. package/dist/components/TagPicker/Autocomplete.js +145 -21
  357. package/dist/components/TagPicker/TagAutocomplete.cjs +116 -37
  358. package/dist/components/TagPicker/TagAutocomplete.d.cts +144 -0
  359. package/dist/{types/components → components}/TagPicker/TagAutocomplete.d.ts +46 -30
  360. package/dist/components/TagPicker/TagAutocomplete.js +114 -5
  361. package/dist/components/TagPicker/TagTable.cjs +212 -188
  362. package/dist/components/TagPicker/TagTable.d.cts +143 -0
  363. package/dist/{types/components → components}/TagPicker/TagTable.d.ts +54 -37
  364. package/dist/components/TagPicker/TagTable.js +210 -75
  365. package/dist/components/TagPicker/styles.cjs +29 -30
  366. package/dist/components/TagPicker/styles.js +26 -26
  367. package/dist/components/TagPicker/types.d.cts +11 -0
  368. package/dist/components/TagPicker/types.d.ts +11 -0
  369. package/dist/components/TextArea/TextArea.cjs +23 -33
  370. package/dist/components/TextArea/TextArea.d.cts +12 -0
  371. package/dist/components/TextArea/TextArea.d.ts +12 -0
  372. package/dist/components/TextArea/TextArea.js +23 -11
  373. package/dist/components/TextArea/styles.cjs +10 -11
  374. package/dist/components/TextArea/styles.d.cts +8 -0
  375. package/dist/components/TextArea/styles.d.ts +8 -0
  376. package/dist/components/TextArea/styles.js +6 -6
  377. package/dist/components/TextArea/types.d.cts +11 -0
  378. package/dist/components/TextArea/types.d.ts +11 -0
  379. package/dist/components/TextInput/TextInput.cjs +23 -33
  380. package/dist/components/TextInput/TextInput.d.cts +12 -0
  381. package/dist/components/TextInput/TextInput.d.ts +12 -0
  382. package/dist/components/TextInput/TextInput.js +21 -9
  383. package/dist/components/TextInput/styles.cjs +10 -11
  384. package/dist/components/TextInput/styles.d.cts +8 -0
  385. package/dist/components/TextInput/styles.d.ts +8 -0
  386. package/dist/components/TextInput/styles.js +6 -6
  387. package/dist/components/TextInput/types.d.cts +11 -0
  388. package/dist/components/TextInput/types.d.ts +11 -0
  389. package/dist/components/TopBar/TopBar.cjs +150 -223
  390. package/dist/components/TopBar/TopBar.d.cts +28 -0
  391. package/dist/components/TopBar/TopBar.d.ts +28 -0
  392. package/dist/components/TopBar/TopBar.js +143 -101
  393. package/dist/components/TopBar/TopBarItem/TopBarItem.cjs +13 -30
  394. package/dist/components/TopBar/TopBarItem/TopBarItem.d.cts +15 -0
  395. package/dist/components/TopBar/TopBarItem/TopBarItem.d.ts +15 -0
  396. package/dist/components/TopBar/TopBarItem/TopBarItem.js +11 -10
  397. package/dist/components/TopBar/TopBarItem/styles.cjs +9 -10
  398. package/dist/components/TopBar/TopBarItem/styles.d.cts +9 -0
  399. package/dist/components/TopBar/TopBarItem/styles.d.ts +9 -0
  400. package/dist/components/TopBar/TopBarItem/styles.js +5 -5
  401. package/dist/components/TopBar/TopBarItem/types.d.cts +23 -0
  402. package/dist/components/TopBar/TopBarItem/types.d.ts +23 -0
  403. package/dist/components/TopBar/TopBarNavigation/TopBarNavigation.cjs +68 -83
  404. package/dist/components/TopBar/TopBarNavigation/TopBarNavigation.d.cts +21 -0
  405. package/dist/components/TopBar/TopBarNavigation/TopBarNavigation.d.ts +21 -0
  406. package/dist/components/TopBar/TopBarNavigation/TopBarNavigation.js +66 -21
  407. package/dist/components/TopBar/TopBarNavigation/styles.cjs +19 -20
  408. package/dist/components/TopBar/TopBarNavigation/styles.d.cts +9 -0
  409. package/dist/components/TopBar/TopBarNavigation/styles.d.ts +9 -0
  410. package/dist/components/TopBar/TopBarNavigation/styles.js +8 -8
  411. package/dist/components/TopBar/TopBarNavigation/types.d.cts +53 -0
  412. package/dist/components/TopBar/TopBarNavigation/types.d.ts +53 -0
  413. package/dist/components/TopBar/TopBarToolName/TopBarToolName.cjs +65 -89
  414. package/dist/components/TopBar/TopBarToolName/TopBarToolName.d.cts +10 -0
  415. package/dist/components/TopBar/TopBarToolName/TopBarToolName.d.ts +10 -0
  416. package/dist/components/TopBar/TopBarToolName/TopBarToolName.js +62 -24
  417. package/dist/components/TopBar/TopBarToolName/styles.cjs +28 -33
  418. package/dist/components/TopBar/TopBarToolName/styles.d.cts +9 -0
  419. package/dist/components/TopBar/TopBarToolName/styles.d.ts +9 -0
  420. package/dist/components/TopBar/TopBarToolName/styles.js +15 -15
  421. package/dist/components/TopBar/TopBarToolName/types.d.cts +44 -0
  422. package/dist/components/TopBar/TopBarToolName/types.d.ts +44 -0
  423. package/dist/components/TopBar/styles.cjs +18 -22
  424. package/dist/components/TopBar/styles.d.cts +9 -0
  425. package/dist/components/TopBar/styles.d.ts +9 -0
  426. package/dist/components/TopBar/styles.js +10 -10
  427. package/dist/components/TopBar/types.d.cts +16 -0
  428. package/dist/components/TopBar/types.d.ts +16 -0
  429. package/dist/components/Typography/Typography.cjs +11 -24
  430. package/dist/components/Typography/Typography.d.cts +17 -0
  431. package/dist/components/Typography/Typography.d.ts +17 -0
  432. package/dist/components/Typography/Typography.js +9 -10
  433. package/dist/components/Typography/styles.cjs +10 -11
  434. package/dist/components/Typography/styles.d.cts +9 -0
  435. package/dist/components/Typography/styles.d.ts +9 -0
  436. package/dist/components/Typography/styles.js +6 -6
  437. package/dist/components/Typography/types.d.cts +18 -0
  438. package/dist/components/Typography/types.d.ts +18 -0
  439. package/dist/components/UserMenu/PreferenceRadioGroup.cjs +34 -51
  440. package/dist/components/UserMenu/PreferenceRadioGroup.js +32 -16
  441. package/dist/components/UserMenu/TitleText.cjs +35 -26
  442. package/dist/components/UserMenu/TitleText.js +33 -19
  443. package/dist/components/UserMenu/UserMenu.cjs +51 -58
  444. package/dist/components/UserMenu/UserMenu.d.cts +30 -0
  445. package/dist/components/UserMenu/UserMenu.d.ts +30 -0
  446. package/dist/components/UserMenu/UserMenu.js +49 -8
  447. package/dist/components/UserMenu/defaultOptions.cjs +101 -0
  448. package/dist/components/UserMenu/defaultOptions.js +99 -0
  449. package/dist/components/UserMenu/model.d.cts +13 -0
  450. package/dist/components/UserMenu/model.d.ts +13 -0
  451. package/dist/components/UserMenu/styles.cjs +18 -19
  452. package/dist/components/UserMenu/styles.js +17 -17
  453. package/dist/components/UserMenu/types.d.cts +8 -0
  454. package/dist/components/UserMenu/types.d.ts +8 -0
  455. package/dist/fonts/materialSymbolsTypes.d.cts +5 -0
  456. package/dist/fonts/materialSymbolsTypes.d.ts +5 -0
  457. package/dist/index.cjs +71 -75
  458. package/dist/index.d.cts +36 -0
  459. package/dist/index.d.ts +36 -0
  460. package/dist/index.js +36 -35
  461. package/dist/styleD/build/typescript/base/colors.cjs +143 -141
  462. package/dist/styleD/build/typescript/base/colors.d.cts +147 -0
  463. package/dist/styleD/build/typescript/base/colors.d.ts +147 -0
  464. package/dist/styleD/build/typescript/base/colors.js +143 -139
  465. package/dist/styleD/build/typescript/base/radius.cjs +11 -9
  466. package/dist/styleD/build/typescript/base/radius.d.cts +15 -0
  467. package/dist/styleD/build/typescript/base/radius.d.ts +15 -0
  468. package/dist/styleD/build/typescript/base/radius.js +11 -7
  469. package/dist/styleD/build/typescript/base/sizing.cjs +25 -23
  470. package/dist/styleD/build/typescript/base/sizing.d.cts +29 -0
  471. package/dist/styleD/build/typescript/base/sizing.d.ts +29 -0
  472. package/dist/styleD/build/typescript/base/sizing.js +25 -21
  473. package/dist/styleD/build/typescript/base/spacing.cjs +39 -37
  474. package/dist/styleD/build/typescript/base/spacing.d.cts +43 -0
  475. package/dist/styleD/build/typescript/base/spacing.d.ts +43 -0
  476. package/dist/styleD/build/typescript/base/spacing.js +39 -35
  477. package/dist/styleD/build/typescript/base/typography.cjs +78 -78
  478. package/dist/styleD/build/typescript/base/typography.d.cts +84 -0
  479. package/dist/styleD/build/typescript/base/typography.d.ts +84 -0
  480. package/dist/styleD/build/typescript/base/typography.js +78 -76
  481. package/dist/styleD/build/typescript/component/alertBanner.cjs +37 -45
  482. package/dist/styleD/build/typescript/component/alertBanner.d.cts +51 -0
  483. package/dist/styleD/build/typescript/component/alertBanner.d.ts +51 -0
  484. package/dist/styleD/build/typescript/component/alertBanner.js +37 -43
  485. package/dist/styleD/build/typescript/component/autocomplete.cjs +31 -29
  486. package/dist/styleD/build/typescript/component/autocomplete.d.cts +35 -0
  487. package/dist/styleD/build/typescript/component/autocomplete.d.ts +35 -0
  488. package/dist/styleD/build/typescript/component/autocomplete.js +31 -27
  489. package/dist/styleD/build/typescript/component/avatar.cjs +124 -168
  490. package/dist/styleD/build/typescript/component/avatar.d.cts +174 -0
  491. package/dist/styleD/build/typescript/component/avatar.d.ts +174 -0
  492. package/dist/styleD/build/typescript/component/avatar.js +124 -166
  493. package/dist/styleD/build/typescript/component/button.cjs +323 -395
  494. package/dist/styleD/build/typescript/component/button.d.cts +401 -0
  495. package/dist/styleD/build/typescript/component/button.d.ts +401 -0
  496. package/dist/styleD/build/typescript/component/button.js +323 -393
  497. package/dist/styleD/build/typescript/component/byline.cjs +41 -39
  498. package/dist/styleD/build/typescript/component/byline.d.cts +45 -0
  499. package/dist/styleD/build/typescript/component/byline.d.ts +45 -0
  500. package/dist/styleD/build/typescript/component/byline.js +41 -37
  501. package/dist/styleD/build/typescript/component/checkbox.cjs +87 -97
  502. package/dist/styleD/build/typescript/component/checkbox.d.cts +103 -0
  503. package/dist/styleD/build/typescript/component/checkbox.d.ts +103 -0
  504. package/dist/styleD/build/typescript/component/checkbox.js +87 -95
  505. package/dist/styleD/build/typescript/component/datePicker.cjs +146 -182
  506. package/dist/styleD/build/typescript/component/datePicker.d.cts +188 -0
  507. package/dist/styleD/build/typescript/component/datePicker.d.ts +188 -0
  508. package/dist/styleD/build/typescript/component/datePicker.js +146 -180
  509. package/dist/styleD/build/typescript/component/favicon.cjs +19 -17
  510. package/dist/styleD/build/typescript/component/favicon.d.cts +23 -0
  511. package/dist/styleD/build/typescript/component/favicon.d.ts +23 -0
  512. package/dist/styleD/build/typescript/component/favicon.js +19 -15
  513. package/dist/styleD/build/typescript/component/form.cjs +38 -50
  514. package/dist/styleD/build/typescript/component/form.d.cts +54 -0
  515. package/dist/styleD/build/typescript/component/form.d.ts +54 -0
  516. package/dist/styleD/build/typescript/component/form.js +38 -48
  517. package/dist/styleD/build/typescript/component/grid.cjs +28 -26
  518. package/dist/styleD/build/typescript/component/grid.d.cts +32 -0
  519. package/dist/styleD/build/typescript/component/grid.d.ts +32 -0
  520. package/dist/styleD/build/typescript/component/grid.js +28 -24
  521. package/dist/styleD/build/typescript/component/icon.cjs +12 -16
  522. package/dist/styleD/build/typescript/component/icon.d.cts +22 -0
  523. package/dist/styleD/build/typescript/component/icon.d.ts +22 -0
  524. package/dist/styleD/build/typescript/component/icon.js +12 -14
  525. package/dist/styleD/build/typescript/component/inlineMessage.cjs +22 -26
  526. package/dist/styleD/build/typescript/component/inlineMessage.d.cts +32 -0
  527. package/dist/styleD/build/typescript/component/inlineMessage.d.ts +32 -0
  528. package/dist/styleD/build/typescript/component/inlineMessage.js +22 -24
  529. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.cjs +31 -29
  530. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.d.cts +35 -0
  531. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.d.ts +35 -0
  532. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.js +31 -27
  533. package/dist/styleD/build/typescript/component/layout.cjs +43 -47
  534. package/dist/styleD/build/typescript/component/layout.d.cts +53 -0
  535. package/dist/styleD/build/typescript/component/layout.d.ts +53 -0
  536. package/dist/styleD/build/typescript/component/layout.js +43 -45
  537. package/dist/styleD/build/typescript/component/link.cjs +15 -23
  538. package/dist/styleD/build/typescript/component/link.d.cts +27 -0
  539. package/dist/styleD/build/typescript/component/link.d.ts +27 -0
  540. package/dist/styleD/build/typescript/component/link.js +15 -21
  541. package/dist/styleD/build/typescript/component/menu.cjs +130 -142
  542. package/dist/styleD/build/typescript/component/menu.d.cts +148 -0
  543. package/dist/styleD/build/typescript/component/menu.d.ts +148 -0
  544. package/dist/styleD/build/typescript/component/menu.js +130 -140
  545. package/dist/styleD/build/typescript/component/radioGroup.cjs +74 -82
  546. package/dist/styleD/build/typescript/component/radioGroup.d.cts +88 -0
  547. package/dist/styleD/build/typescript/component/radioGroup.d.ts +88 -0
  548. package/dist/styleD/build/typescript/component/radioGroup.js +74 -80
  549. package/dist/styleD/build/typescript/component/select.cjs +63 -67
  550. package/dist/styleD/build/typescript/component/select.d.cts +71 -0
  551. package/dist/styleD/build/typescript/component/select.d.ts +71 -0
  552. package/dist/styleD/build/typescript/component/select.js +63 -65
  553. package/dist/styleD/build/typescript/component/tagTable.cjs +52 -50
  554. package/dist/styleD/build/typescript/component/tagTable.d.cts +56 -0
  555. package/dist/styleD/build/typescript/component/tagTable.d.ts +56 -0
  556. package/dist/styleD/build/typescript/component/tagTable.js +52 -48
  557. package/dist/styleD/build/typescript/component/textArea.cjs +39 -45
  558. package/dist/styleD/build/typescript/component/textArea.d.cts +51 -0
  559. package/dist/styleD/build/typescript/component/textArea.d.ts +51 -0
  560. package/dist/styleD/build/typescript/component/textArea.js +39 -43
  561. package/dist/styleD/build/typescript/component/textInput.cjs +44 -46
  562. package/dist/styleD/build/typescript/component/textInput.d.cts +52 -0
  563. package/dist/styleD/build/typescript/component/textInput.d.ts +52 -0
  564. package/dist/styleD/build/typescript/component/textInput.js +44 -44
  565. package/dist/styleD/build/typescript/component/topBar.cjs +166 -192
  566. package/dist/styleD/build/typescript/component/topBar.d.cts +198 -0
  567. package/dist/styleD/build/typescript/component/topBar.d.ts +198 -0
  568. package/dist/styleD/build/typescript/component/topBar.js +166 -190
  569. package/dist/styleD/build/typescript/component/typography.cjs +6 -6
  570. package/dist/styleD/build/typescript/component/typography.d.cts +10 -0
  571. package/dist/styleD/build/typescript/component/typography.d.ts +10 -0
  572. package/dist/styleD/build/typescript/component/typography.js +6 -4
  573. package/dist/styleD/build/typescript/component/userMenu.cjs +36 -34
  574. package/dist/styleD/build/typescript/component/userMenu.d.cts +40 -0
  575. package/dist/styleD/build/typescript/component/userMenu.d.ts +40 -0
  576. package/dist/styleD/build/typescript/component/userMenu.js +36 -32
  577. package/dist/styleD/build/typescript/semantic/breakpoints.cjs +8 -6
  578. package/dist/styleD/build/typescript/semantic/breakpoints.d.cts +12 -0
  579. package/dist/styleD/build/typescript/semantic/breakpoints.d.ts +12 -0
  580. package/dist/styleD/build/typescript/semantic/breakpoints.js +8 -4
  581. package/dist/styleD/build/typescript/semantic/colors.cjs +82 -80
  582. package/dist/styleD/build/typescript/semantic/colors.d.cts +86 -0
  583. package/dist/styleD/build/typescript/semantic/colors.d.ts +86 -0
  584. package/dist/styleD/build/typescript/semantic/colors.js +82 -78
  585. package/dist/styleD/build/typescript/semantic/grid.cjs +20 -18
  586. package/dist/styleD/build/typescript/semantic/grid.d.cts +24 -0
  587. package/dist/styleD/build/typescript/semantic/grid.d.ts +24 -0
  588. package/dist/styleD/build/typescript/semantic/grid.js +20 -16
  589. package/dist/styleD/build/typescript/semantic/shadow.cjs +6 -6
  590. package/dist/styleD/build/typescript/semantic/shadow.d.cts +10 -0
  591. package/dist/styleD/build/typescript/semantic/shadow.d.ts +10 -0
  592. package/dist/styleD/build/typescript/semantic/shadow.js +6 -4
  593. package/dist/styleD/build/typescript/semantic/sizing.cjs +28 -28
  594. package/dist/styleD/build/typescript/semantic/sizing.d.cts +34 -0
  595. package/dist/styleD/build/typescript/semantic/sizing.d.ts +34 -0
  596. package/dist/styleD/build/typescript/semantic/sizing.js +28 -26
  597. package/dist/styleD/build/typescript/semantic/typography.cjs +380 -378
  598. package/dist/styleD/build/typescript/semantic/typography.d.cts +384 -0
  599. package/dist/styleD/build/typescript/semantic/typography.d.ts +384 -0
  600. package/dist/styleD/build/typescript/semantic/typography.js +380 -376
  601. package/dist/styleD/utils/semantic/mq.cjs +48 -31
  602. package/dist/styleD/utils/semantic/mq.d.cts +56 -0
  603. package/dist/{types/styleD → styleD}/utils/semantic/mq.d.ts +18 -14
  604. package/dist/styleD/utils/semantic/mq.js +48 -21
  605. package/dist/styleD/utils/semantic/typography.cjs +10 -11
  606. package/dist/styleD/utils/semantic/typography.d.cts +12 -0
  607. package/dist/styleD/utils/semantic/typography.d.ts +12 -0
  608. package/dist/styleD/utils/semantic/typography.js +9 -9
  609. package/dist/util/mergeDeep.cjs +11 -15
  610. package/dist/util/mergeDeep.js +11 -13
  611. package/dist/util/reset.cjs +4 -10
  612. package/dist/util/reset.d.cts +4 -0
  613. package/dist/util/reset.d.ts +4 -0
  614. package/dist/util/reset.js +4 -8
  615. package/dist/util/reset2.cjs +8 -0
  616. package/dist/util/reset2.js +8 -0
  617. package/dist/util/types.d.cts +34 -0
  618. package/dist/util/types.d.ts +34 -0
  619. package/dist/util/useResize.cjs +24 -31
  620. package/dist/util/useResize.js +22 -28
  621. package/dist/utils.cjs +10 -14
  622. package/dist/utils.d.cts +4 -0
  623. package/dist/utils.d.ts +4 -0
  624. package/dist/utils.js +4 -3
  625. package/package.json +278 -131
  626. package/dist/components/Icon/styles.cjs +0 -27
  627. package/dist/components/LinkButton/styles.cjs +0 -9
  628. package/dist/components/UserMenu/default-options.cjs +0 -109
  629. package/dist/components/UserMenu/default-options.js +0 -105
  630. package/dist/types/AlertBanner.d.ts +0 -19
  631. package/dist/types/Avatar.d.ts +0 -19
  632. package/dist/types/AvatarButton.d.ts +0 -18
  633. package/dist/types/AvatarLink.d.ts +0 -18
  634. package/dist/types/Button.d.ts +0 -20
  635. package/dist/types/Byline.d.ts +0 -25
  636. package/dist/types/Checkbox.d.ts +0 -21
  637. package/dist/types/DatePicker.d.ts +0 -21
  638. package/dist/types/Favicon.d.ts +0 -19
  639. package/dist/types/Form.d.ts +0 -8
  640. package/dist/types/Grid.d.ts +0 -20
  641. package/dist/types/Icon.d.ts +0 -27
  642. package/dist/types/IconButton.d.ts +0 -20
  643. package/dist/types/IconLinkButton.d.ts +0 -20
  644. package/dist/types/InlineMessage.d.ts +0 -19
  645. package/dist/types/IntendedAudienceSignifier.d.ts +0 -19
  646. package/dist/types/Layout.d.ts +0 -20
  647. package/dist/types/Link.d.ts +0 -19
  648. package/dist/types/LinkButton.d.ts +0 -20
  649. package/dist/types/Menu.d.ts +0 -20
  650. package/dist/types/RadioGroup.d.ts +0 -20
  651. package/dist/types/Select.d.ts +0 -20
  652. package/dist/types/TagPicker.d.ts +0 -22
  653. package/dist/types/TextArea.d.ts +0 -20
  654. package/dist/types/TextInput.d.ts +0 -20
  655. package/dist/types/TopBar.d.ts +0 -29
  656. package/dist/types/Typography.d.ts +0 -19
  657. package/dist/types/UserMenu.d.ts +0 -18
  658. package/dist/types/components/AlertBanner/AlertBanner.d.ts +0 -2
  659. package/dist/types/components/AlertBanner/sandbox.d.ts +0 -5
  660. package/dist/types/components/AlertBanner/styles.d.ts +0 -9
  661. package/dist/types/components/AlertBanner/types.d.ts +0 -27
  662. package/dist/types/components/Avatar/Avatar.d.ts +0 -2
  663. package/dist/types/components/Avatar/sandbox.d.ts +0 -5
  664. package/dist/types/components/Avatar/styles.d.ts +0 -9
  665. package/dist/types/components/Avatar/types.d.ts +0 -45
  666. package/dist/types/components/AvatarButton/AvatarButton.d.ts +0 -2
  667. package/dist/types/components/AvatarButton/sandbox.d.ts +0 -5
  668. package/dist/types/components/AvatarButton/styles.d.ts +0 -6
  669. package/dist/types/components/AvatarButton/types.d.ts +0 -3
  670. package/dist/types/components/AvatarLink/AvatarLink.d.ts +0 -2
  671. package/dist/types/components/AvatarLink/sandbox.d.ts +0 -5
  672. package/dist/types/components/AvatarLink/styles.d.ts +0 -6
  673. package/dist/types/components/AvatarLink/types.d.ts +0 -3
  674. package/dist/types/components/Button/Button.d.ts +0 -2
  675. package/dist/types/components/Button/sandbox.d.ts +0 -5
  676. package/dist/types/components/Button/styles.d.ts +0 -8
  677. package/dist/types/components/Button/types.d.ts +0 -18
  678. package/dist/types/components/Byline/Preview.d.ts +0 -4
  679. package/dist/types/components/Byline/contributors-fixture.d.ts +0 -1
  680. package/dist/types/components/Byline/lib.d.ts +0 -48
  681. package/dist/types/components/Byline/lib.test.d.ts +0 -1
  682. package/dist/types/components/Byline/placeholder.d.ts +0 -2
  683. package/dist/types/components/Byline/plugins.d.ts +0 -4
  684. package/dist/types/components/Byline/schema.d.ts +0 -2
  685. package/dist/types/components/Byline/styles.d.ts +0 -13
  686. package/dist/types/components/Byline/theme.d.ts +0 -3
  687. package/dist/types/components/Checkbox/Checkbox.d.ts +0 -2
  688. package/dist/types/components/Checkbox/CheckboxGroup.d.ts +0 -2
  689. package/dist/types/components/Checkbox/CheckboxGroupSandbox.d.ts +0 -5
  690. package/dist/types/components/Checkbox/CheckboxSandbox.d.ts +0 -5
  691. package/dist/types/components/Checkbox/styles.d.ts +0 -10
  692. package/dist/types/components/Checkbox/types.d.ts +0 -11
  693. package/dist/types/components/DatePicker/DatePicker.d.ts +0 -2
  694. package/dist/types/components/DatePicker/sandbox.d.ts +0 -2
  695. package/dist/types/components/DatePicker/styles.d.ts +0 -11
  696. package/dist/types/components/DatePicker/types.d.ts +0 -21
  697. package/dist/types/components/Favicon/Favicon.d.ts +0 -2
  698. package/dist/types/components/Favicon/sandbox.d.ts +0 -5
  699. package/dist/types/components/Favicon/styles.d.ts +0 -9
  700. package/dist/types/components/Favicon/types.d.ts +0 -38
  701. package/dist/types/components/Form/Form.d.ts +0 -5
  702. package/dist/types/components/Form/styles.d.ts +0 -13
  703. package/dist/types/components/Form/types.d.ts +0 -40
  704. package/dist/types/components/Grid/Grid.d.ts +0 -3
  705. package/dist/types/components/Grid/sandbox.d.ts +0 -5
  706. package/dist/types/components/Grid/styles.d.ts +0 -11
  707. package/dist/types/components/Grid/styles.test.d.ts +0 -1
  708. package/dist/types/components/Grid/types.d.ts +0 -25
  709. package/dist/types/components/Icon/Icon.d.ts +0 -2
  710. package/dist/types/components/Icon/sandbox.d.ts +0 -5
  711. package/dist/types/components/Icon/styles.d.ts +0 -9
  712. package/dist/types/components/Icon/types.d.ts +0 -28
  713. package/dist/types/components/IconButton/IconButton.d.ts +0 -2
  714. package/dist/types/components/IconButton/sandbox.d.ts +0 -5
  715. package/dist/types/components/IconButton/styles.d.ts +0 -398
  716. package/dist/types/components/IconButton/types.d.ts +0 -26
  717. package/dist/types/components/IconLinkButton/IconLinkButton.d.ts +0 -2
  718. package/dist/types/components/IconLinkButton/sandbox.d.ts +0 -5
  719. package/dist/types/components/IconLinkButton/styles.d.ts +0 -398
  720. package/dist/types/components/IconLinkButton/types.d.ts +0 -26
  721. package/dist/types/components/InlineMessage/InlineMessage.d.ts +0 -2
  722. package/dist/types/components/InlineMessage/sandbox.d.ts +0 -5
  723. package/dist/types/components/InlineMessage/styles.d.ts +0 -9
  724. package/dist/types/components/InlineMessage/types.d.ts +0 -21
  725. package/dist/types/components/IntendedAudienceSignifier/FlagIcons.d.ts +0 -5
  726. package/dist/types/components/IntendedAudienceSignifier/IntendedAudienceSignifier.d.ts +0 -2
  727. package/dist/types/components/IntendedAudienceSignifier/sandbox.d.ts +0 -5
  728. package/dist/types/components/IntendedAudienceSignifier/styles.d.ts +0 -8
  729. package/dist/types/components/IntendedAudienceSignifier/types.d.ts +0 -8
  730. package/dist/types/components/Layout/Layout.d.ts +0 -11
  731. package/dist/types/components/Layout/sandbox.d.ts +0 -5
  732. package/dist/types/components/Layout/styles.d.ts +0 -19
  733. package/dist/types/components/Layout/types.d.ts +0 -30
  734. package/dist/types/components/Link/Link.d.ts +0 -2
  735. package/dist/types/components/Link/sandbox.d.ts +0 -5
  736. package/dist/types/components/Link/styles.d.ts +0 -7
  737. package/dist/types/components/Link/types.d.ts +0 -11
  738. package/dist/types/components/LinkButton/LinkButton.d.ts +0 -2
  739. package/dist/types/components/LinkButton/sandbox.d.ts +0 -5
  740. package/dist/types/components/LinkButton/styles.d.ts +0 -398
  741. package/dist/types/components/LinkButton/types.d.ts +0 -18
  742. package/dist/types/components/Menu/Menu.d.ts +0 -7
  743. package/dist/types/components/Menu/sandbox.d.ts +0 -5
  744. package/dist/types/components/Menu/styles.d.ts +0 -28
  745. package/dist/types/components/Menu/types.d.ts +0 -63
  746. package/dist/types/components/RadioGroup/RadioGroup.d.ts +0 -3
  747. package/dist/types/components/RadioGroup/sandbox.d.ts +0 -5
  748. package/dist/types/components/RadioGroup/styles.d.ts +0 -9
  749. package/dist/types/components/RadioGroup/types.d.ts +0 -10
  750. package/dist/types/components/Select/Select.d.ts +0 -3
  751. package/dist/types/components/Select/sandbox.d.ts +0 -5
  752. package/dist/types/components/Select/styles.d.ts +0 -10
  753. package/dist/types/components/Select/types.d.ts +0 -9
  754. package/dist/types/components/TagPicker/example-tags.d.ts +0 -2
  755. package/dist/types/components/TagPicker/styles.d.ts +0 -16
  756. package/dist/types/components/TagPicker/types.d.ts +0 -64
  757. package/dist/types/components/TextArea/TextArea.d.ts +0 -2
  758. package/dist/types/components/TextArea/sandbox.d.ts +0 -5
  759. package/dist/types/components/TextArea/styles.d.ts +0 -7
  760. package/dist/types/components/TextArea/types.d.ts +0 -7
  761. package/dist/types/components/TextInput/TextInput.d.ts +0 -2
  762. package/dist/types/components/TextInput/sandbox.d.ts +0 -5
  763. package/dist/types/components/TextInput/styles.d.ts +0 -7
  764. package/dist/types/components/TextInput/types.d.ts +0 -7
  765. package/dist/types/components/TopBar/TopBar.d.ts +0 -11
  766. package/dist/types/components/TopBar/TopBarItem/TopBarItem.d.ts +0 -2
  767. package/dist/types/components/TopBar/TopBarItem/sandbox.d.ts +0 -5
  768. package/dist/types/components/TopBar/TopBarItem/styles.d.ts +0 -8
  769. package/dist/types/components/TopBar/TopBarItem/types.d.ts +0 -19
  770. package/dist/types/components/TopBar/TopBarNavigation/TopBarNavigation.d.ts +0 -2
  771. package/dist/types/components/TopBar/TopBarNavigation/sandbox.d.ts +0 -5
  772. package/dist/types/components/TopBar/TopBarNavigation/styles.d.ts +0 -12
  773. package/dist/types/components/TopBar/TopBarNavigation/types.d.ts +0 -49
  774. package/dist/types/components/TopBar/TopBarToolName/TopBarToolName.d.ts +0 -2
  775. package/dist/types/components/TopBar/TopBarToolName/sandbox.d.ts +0 -5
  776. package/dist/types/components/TopBar/TopBarToolName/styles.d.ts +0 -16
  777. package/dist/types/components/TopBar/TopBarToolName/types.d.ts +0 -40
  778. package/dist/types/components/TopBar/sandbox.d.ts +0 -5
  779. package/dist/types/components/TopBar/styles.d.ts +0 -15
  780. package/dist/types/components/TopBar/types.d.ts +0 -12
  781. package/dist/types/components/Typography/Typography.d.ts +0 -6
  782. package/dist/types/components/Typography/sandbox.d.ts +0 -5
  783. package/dist/types/components/Typography/styles.d.ts +0 -8
  784. package/dist/types/components/Typography/types.d.ts +0 -14
  785. package/dist/types/components/UserMenu/PreferenceRadioGroup.d.ts +0 -15
  786. package/dist/types/components/UserMenu/TitleText.d.ts +0 -6
  787. package/dist/types/components/UserMenu/UserMenu.d.ts +0 -17
  788. package/dist/types/components/UserMenu/default-options.d.ts +0 -5
  789. package/dist/types/components/UserMenu/model.d.ts +0 -9
  790. package/dist/types/components/UserMenu/styles.d.ts +0 -9
  791. package/dist/types/components/UserMenu/theme.d.ts +0 -3
  792. package/dist/types/components/UserMenu/types.d.ts +0 -5
  793. package/dist/types/fonts/material-symbols-types.d.ts +0 -3853
  794. package/dist/types/index.d.ts +0 -86
  795. package/dist/types/styleD/build/typescript/base/colors.d.ts +0 -144
  796. package/dist/types/styleD/build/typescript/base/radius.d.ts +0 -12
  797. package/dist/types/styleD/build/typescript/base/sizing.d.ts +0 -26
  798. package/dist/types/styleD/build/typescript/base/spacing.d.ts +0 -40
  799. package/dist/types/styleD/build/typescript/base/typography.d.ts +0 -81
  800. package/dist/types/styleD/build/typescript/component/alertBanner.d.ts +0 -48
  801. package/dist/types/styleD/build/typescript/component/autocomplete.d.ts +0 -32
  802. package/dist/types/styleD/build/typescript/component/avatar.d.ts +0 -171
  803. package/dist/types/styleD/build/typescript/component/button.d.ts +0 -398
  804. package/dist/types/styleD/build/typescript/component/byline.d.ts +0 -42
  805. package/dist/types/styleD/build/typescript/component/checkbox.d.ts +0 -100
  806. package/dist/types/styleD/build/typescript/component/datePicker.d.ts +0 -185
  807. package/dist/types/styleD/build/typescript/component/favicon.d.ts +0 -20
  808. package/dist/types/styleD/build/typescript/component/form.d.ts +0 -51
  809. package/dist/types/styleD/build/typescript/component/grid.d.ts +0 -29
  810. package/dist/types/styleD/build/typescript/component/icon.d.ts +0 -19
  811. package/dist/types/styleD/build/typescript/component/inlineMessage.d.ts +0 -29
  812. package/dist/types/styleD/build/typescript/component/intendedAudienceSignifier.d.ts +0 -32
  813. package/dist/types/styleD/build/typescript/component/layout.d.ts +0 -50
  814. package/dist/types/styleD/build/typescript/component/link.d.ts +0 -24
  815. package/dist/types/styleD/build/typescript/component/menu.d.ts +0 -145
  816. package/dist/types/styleD/build/typescript/component/radioGroup.d.ts +0 -85
  817. package/dist/types/styleD/build/typescript/component/select.d.ts +0 -68
  818. package/dist/types/styleD/build/typescript/component/tagTable.d.ts +0 -53
  819. package/dist/types/styleD/build/typescript/component/templateComponent.d.ts +0 -10
  820. package/dist/types/styleD/build/typescript/component/textArea.d.ts +0 -48
  821. package/dist/types/styleD/build/typescript/component/textInput.d.ts +0 -49
  822. package/dist/types/styleD/build/typescript/component/topBar.d.ts +0 -195
  823. package/dist/types/styleD/build/typescript/component/typography.d.ts +0 -7
  824. package/dist/types/styleD/build/typescript/component/userMenu.d.ts +0 -37
  825. package/dist/types/styleD/build/typescript/semantic/breakpoints.d.ts +0 -9
  826. package/dist/types/styleD/build/typescript/semantic/colors.d.ts +0 -83
  827. package/dist/types/styleD/build/typescript/semantic/grid.d.ts +0 -21
  828. package/dist/types/styleD/build/typescript/semantic/shadow.d.ts +0 -7
  829. package/dist/types/styleD/build/typescript/semantic/sizing.d.ts +0 -31
  830. package/dist/types/styleD/build/typescript/semantic/typography.d.ts +0 -381
  831. package/dist/types/styleD/stories/base/Radius.d.ts +0 -1
  832. package/dist/types/styleD/stories/base/Sizing.d.ts +0 -1
  833. package/dist/types/styleD/stories/base/Spacing.d.ts +0 -1
  834. package/dist/types/styleD/stories/base/Typography.d.ts +0 -1
  835. package/dist/types/styleD/stories/base/storybookColorPalette.d.ts +0 -19
  836. package/dist/types/styleD/stories/semantic/Breakpoints.d.ts +0 -15
  837. package/dist/types/styleD/stories/semantic/Shadow.d.ts +0 -1
  838. package/dist/types/styleD/stories/semantic/Sizing.d.ts +0 -1
  839. package/dist/types/styleD/stories/semantic/TypographyPresets.d.ts +0 -1
  840. package/dist/types/styleD/utils/semantic/mq.test.d.ts +0 -1
  841. package/dist/types/styleD/utils/semantic/typography.d.ts +0 -9
  842. package/dist/types/styleD/utils/semantic/typography.test.d.ts +0 -1
  843. package/dist/types/templates/component/TemplateComponent.d.ts +0 -2
  844. package/dist/types/templates/component/sandbox.d.ts +0 -5
  845. package/dist/types/templates/component/styles.d.ts +0 -7
  846. package/dist/types/templates/component/types.d.ts +0 -5
  847. package/dist/types/util/mergeDeep.d.ts +0 -1
  848. package/dist/types/util/reset.d.ts +0 -1
  849. package/dist/types/util/storybook/sandbox/Sandbox.d.ts +0 -14
  850. package/dist/types/util/storybook/styles.d.ts +0 -1
  851. package/dist/types/util/types.d.ts +0 -34
  852. package/dist/types/util/useResize.d.ts +0 -1
  853. package/dist/types/utils.d.ts +0 -8
  854. package/dist/util/reset.css.cjs +0 -5
  855. package/dist/util/reset.css.js +0 -3
  856. /package/dist/fonts/{material-symbols-types.ts → materialSymbolsTypes.ts} +0 -0
@@ -1,368 +1,335 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('@emotion/react/jsx-runtime');
4
- var prosemirrorInvisibles = require('@guardian/prosemirror-invisibles');
5
- var prosemirrorDropcursor = require('prosemirror-dropcursor');
6
- var prosemirrorHistory = require('prosemirror-history');
7
- var prosemirrorState = require('prosemirror-state');
8
- var prosemirrorView = require('prosemirror-view');
9
- var React = require('react');
10
- var lib = require('./lib.cjs');
11
- var placeholder = require('./placeholder.cjs');
12
- var plugins = require('./plugins.cjs');
13
- var Preview = require('./Preview.cjs');
14
- var schema = require('./schema.cjs');
15
- var styles = require('./styles.cjs');
16
-
17
- const Byline = ({
18
- theme,
19
- allowUntaggedContributors,
20
- contributorLimit,
21
- enablePreview,
22
- placeholder: placeholder$1,
23
- initialValue,
24
- readOnly,
25
- handleSave,
26
- searchContributors,
27
- onBlur
28
- }) => {
29
- const editorRef = React.useRef(null);
30
- const viewRef = React.useRef(null);
31
- const dropdownRef = React.useRef(null);
32
- const [currentText, setCurrentText] = React.useState("");
33
- const [currentOptionIndex, setCurrentOptionIndex] = React.useState(0);
34
- const [taggedContributors, setTaggedContributors] = React.useState([]);
35
- const [currentDoc, setCurrentDoc] = React.useState(null);
36
- const [showDropdown, setShowDropdown] = React.useState(false);
37
- const isTypingFromStartRange = React.useRef(
38
- void 0
39
- );
40
- const trackTypingFromStart = (tr) => {
41
- const isCursorSelection = tr.selection.from === tr.selection.to;
42
- const currentPosition = tr.selection.from;
43
- const hasChanges = tr.steps.length > 0;
44
- if (!isCursorSelection) {
45
- isTypingFromStartRange.current = void 0;
46
- return;
47
- }
48
- if (!isTypingFromStartRange.current && currentPosition === 1 && hasChanges) {
49
- isTypingFromStartRange.current = {
50
- start: 1,
51
- maxReached: 1,
52
- lastPosition: 1
53
- };
54
- return;
55
- }
56
- if (isTypingFromStartRange.current) {
57
- const { start, maxReached, lastPosition } = isTypingFromStartRange.current;
58
- const isWithinRange = currentPosition >= start && currentPosition <= maxReached;
59
- const isExtendingRange = hasChanges && currentPosition === maxReached + 1;
60
- if (isWithinRange || isExtendingRange) {
61
- if (hasChanges) {
62
- const positionDelta = currentPosition - lastPosition;
63
- if (positionDelta < 0) {
64
- isTypingFromStartRange.current.maxReached = maxReached - 1;
65
- } else if (positionDelta > 0) {
66
- isTypingFromStartRange.current.maxReached = maxReached + 1;
67
- }
68
- isTypingFromStartRange.current.lastPosition = currentPosition;
69
- }
70
- return;
71
- }
72
- }
73
- isTypingFromStartRange.current = void 0;
74
- };
75
- const getShouldShowDropdown = (view, selectedText) => {
76
- if (readOnly) {
77
- return false;
78
- }
79
- const showDropdownBasedOnProps = !!searchContributors || !!allowUntaggedContributors;
80
- if (lib.hasHitContributorLimit(view.state.doc, contributorLimit)) {
81
- return false;
82
- }
83
- return selectedText.trim() !== "" && showDropdownBasedOnProps;
84
- };
85
- const [enterHit, setEnterHit] = React.useState(false);
86
- const checkDropdownVisibility = () => {
87
- if (dropdownRef.current?.checkVisibility) {
88
- return dropdownRef.current.checkVisibility();
89
- } else {
90
- return dropdownRef.current?.offsetParent !== null;
91
- }
92
- };
93
- React.useEffect(() => {
94
- if (!editorRef.current) {
95
- return;
96
- }
97
- const initialDoc = lib.convertBylineModelToNode(initialValue);
98
- const state = prosemirrorState.EditorState.create({
99
- schema: schema.bylineEditorSchema,
100
- plugins: [
101
- prosemirrorDropcursor.dropCursor(),
102
- plugins.clipboardPlugin(allowUntaggedContributors, contributorLimit),
103
- prosemirrorHistory.history(),
104
- plugins.keybindings(),
105
- prosemirrorInvisibles.createInvisiblesPlugin([prosemirrorInvisibles.space, prosemirrorInvisibles.nbSpace], {
106
- displayLineEndSelection: true,
107
- shouldShowInvisibles: true
108
- }),
109
- plugins.bylinePlugin(),
110
- placeholder.createPlaceholderPlugin(placeholder$1 ?? "Enter a byline...")
111
- ],
112
- doc: initialDoc
113
- });
114
- setCurrentDoc(initialDoc);
115
- viewRef.current = new prosemirrorView.EditorView(editorRef.current, {
116
- state,
117
- editable: () => !readOnly,
118
- attributes: {
119
- role: "combobox",
120
- "aria-label": "byline",
121
- "aria-controls": "byline-dropdown",
122
- "aria-expanded": "false",
123
- "data-testid": "byline-input",
124
- ...readOnly && { "aria-readonly": "true" }
125
- },
126
- handleDOMEvents: {
127
- keydown: (view, event) => {
128
- if (readOnly) {
129
- return false;
130
- }
131
- if (event.key === "Escape") {
132
- setShowDropdown(false);
133
- return true;
134
- }
135
- if (event.key === "ArrowDown") {
136
- if (checkDropdownVisibility()) {
137
- event.preventDefault();
138
- setCurrentOptionIndex((currentOptionIndex2) => {
139
- return currentOptionIndex2 + 1;
140
- });
141
- return true;
142
- }
143
- return false;
144
- }
145
- if (event.key === "ArrowUp") {
146
- if (checkDropdownVisibility()) {
147
- event.preventDefault();
148
- setCurrentOptionIndex((currentOptionIndex2) => {
149
- return currentOptionIndex2 - 1;
150
- });
151
- return true;
152
- }
153
- return false;
154
- }
155
- if (event.key === "Enter") {
156
- if (checkDropdownVisibility()) {
157
- event.preventDefault();
158
- setEnterHit(true);
159
- }
160
- return false;
161
- }
162
- return false;
163
- },
164
- blur: (_view, event) => {
165
- if (readOnly) {
166
- return false;
167
- }
168
- if (!dropdownRef.current?.contains(event.relatedTarget)) {
169
- setShowDropdown(false);
170
- }
171
- return false;
172
- }
173
- },
174
- dispatchTransaction(tr) {
175
- if (readOnly) {
176
- if (tr.docChanged) {
177
- return;
178
- }
179
- if (viewRef.current) {
180
- const newState = viewRef.current.state.apply(tr);
181
- viewRef.current.updateState(newState);
182
- }
183
- return;
184
- }
185
- if (viewRef.current?.hasFocus()) {
186
- trackTypingFromStart(tr);
187
- const newState = viewRef.current.state.apply(tr);
188
- viewRef.current.updateState(newState);
189
- const { selectedText } = lib.getCurrentText(
190
- newState.doc,
191
- newState.selection.from,
192
- newState.selection.to,
193
- isTypingFromStartRange.current
194
- );
195
- setCurrentText(selectedText);
196
- const shouldShowDropdown = getShouldShowDropdown(
197
- viewRef.current,
198
- selectedText
199
- );
200
- if (shouldShowDropdown && searchContributors) {
201
- void searchContributors(selectedText).then((contributors) => {
202
- setTaggedContributors(contributors);
203
- }).catch((error) => {
204
- console.error("Error fetching tagged contributors:", error);
205
- setTaggedContributors([]);
206
- });
207
- } else {
208
- setTaggedContributors([]);
209
- }
210
- setShowDropdown(shouldShowDropdown);
211
- if (tr.docChanged) {
212
- setCurrentDoc(newState.doc);
213
- handleSave(lib.convertNodeToBylineModel(newState.doc));
214
- }
215
- }
216
- }
217
- });
218
- return () => {
219
- viewRef.current?.destroy();
220
- };
221
- }, []);
222
- React.useEffect(() => {
223
- const numberOfOptions = taggedContributors.length + (allowUntaggedContributors ? 1 : 0);
224
- if (numberOfOptions) {
225
- if (currentOptionIndex < 0) {
226
- setCurrentOptionIndex(numberOfOptions - 1);
227
- } else {
228
- setCurrentOptionIndex(currentOptionIndex % numberOfOptions);
229
- }
230
- }
231
- if (showDropdown) {
232
- const editor = document.querySelector("[role=combobox]");
233
- editor?.setAttribute(
234
- "aria-activedescendant",
235
- `contributor-option-${currentOptionIndex}`
236
- );
237
- editor?.setAttribute("aria-expanded", "true");
238
- }
239
- }, [
240
- currentOptionIndex,
241
- showDropdown,
242
- taggedContributors.length,
243
- allowUntaggedContributors
244
- ]);
245
- React.useEffect(() => {
246
- if (showDropdown && currentOptionIndex >= 0) {
247
- const selectedOption = document.getElementById(
248
- `contributor-option-${currentOptionIndex}`
249
- );
250
- if (selectedOption && dropdownRef.current) {
251
- selectedOption.scrollIntoView({
252
- behavior: "smooth",
253
- block: "nearest"
254
- });
255
- }
256
- }
257
- }, [currentOptionIndex, showDropdown]);
258
- React.useEffect(() => {
259
- if (enterHit) {
260
- if (allowUntaggedContributors && currentOptionIndex === taggedContributors.length) {
261
- lib.addUntaggedContributor(
262
- viewRef,
263
- setShowDropdown,
264
- contributorLimit,
265
- isTypingFromStartRange.current
266
- );
267
- } else {
268
- const contributorToAdd = taggedContributors[currentOptionIndex];
269
- if (contributorToAdd) {
270
- lib.addTaggedContributor(
271
- contributorToAdd,
272
- viewRef,
273
- setShowDropdown,
274
- contributorLimit,
275
- isTypingFromStartRange.current
276
- );
277
- }
278
- }
279
- setEnterHit(false);
280
- }
281
- }, [
282
- currentOptionIndex,
283
- enterHit,
284
- taggedContributors,
285
- contributorLimit,
286
- allowUntaggedContributors
287
- ]);
288
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.bylineContainerStyles, children: [
289
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.bylineEditorStyles(theme), ref: editorRef, onBlur }),
290
- /* @__PURE__ */ jsxRuntime.jsx(
291
- "div",
292
- {
293
- ref: dropdownRef,
294
- tabIndex: 0,
295
- css: styles.dropdownContainerStyles(
296
- showDropdown && // show the dropdown if there are tagged contributors to select or untagged contributors are allowed
297
- (taggedContributors.length > 0 || !!allowUntaggedContributors),
298
- theme?.dropdown
299
- ),
300
- children: /* @__PURE__ */ jsxRuntime.jsxs("ul", { id: "byline-dropdown", role: "listbox", css: styles.dropdownUlStyles, children: [
301
- taggedContributors.map((contributor, i) => /* @__PURE__ */ jsxRuntime.jsx(
302
- "li",
303
- {
304
- id: `contributor-option-${i}`,
305
- role: "option",
306
- "aria-selected": i === currentOptionIndex,
307
- css: [
308
- styles.dropdownLiStyles(theme?.dropdown),
309
- i === currentOptionIndex && styles.selectedDropdownLiStyles(theme?.dropdown)
310
- ],
311
- onMouseMove: () => {
312
- if (currentOptionIndex !== i) {
313
- setCurrentOptionIndex(i);
314
- }
315
- },
316
- onMouseDown: (e) => {
317
- e.preventDefault();
318
- lib.addTaggedContributor(
319
- contributor,
320
- viewRef,
321
- setShowDropdown,
322
- contributorLimit,
323
- isTypingFromStartRange.current
324
- );
325
- },
326
- children: contributor.internalLabel ?? contributor.label
327
- },
328
- contributor.tagId
329
- )),
330
- allowUntaggedContributors && /* @__PURE__ */ jsxRuntime.jsxs(
331
- "li",
332
- {
333
- role: "option",
334
- id: `contributor-option-${taggedContributors.length}`,
335
- "aria-selected": currentOptionIndex === taggedContributors.length,
336
- css: [
337
- styles.dropdownLiStyles(theme?.dropdown),
338
- currentOptionIndex === taggedContributors.length && styles.selectedDropdownLiStyles(theme?.dropdown)
339
- ],
340
- onMouseMove: () => {
341
- if (currentOptionIndex !== taggedContributors.length) {
342
- setCurrentOptionIndex(taggedContributors.length);
343
- }
344
- },
345
- onMouseDown: (e) => {
346
- e.preventDefault();
347
- lib.addUntaggedContributor(
348
- viewRef,
349
- setShowDropdown,
350
- contributorLimit,
351
- isTypingFromStartRange.current
352
- );
353
- },
354
- children: [
355
- 'Add "',
356
- currentText,
357
- '" as untagged contributor'
358
- ]
359
- }
360
- )
361
- ] })
362
- }
363
- ),
364
- enablePreview && /* @__PURE__ */ jsxRuntime.jsx(Preview.Preview, { doc: currentDoc })
365
- ] });
1
+ require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_schema = require("./schema.cjs");
3
+ const require_lib = require("./lib.cjs");
4
+ const require_placeholder = require("./placeholder.cjs");
5
+ const require_plugins = require("./plugins.cjs");
6
+ const require_styles = require("./styles.cjs");
7
+ const require_Preview = require("./Preview.cjs");
8
+ let react = require("react");
9
+ let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
10
+ let _guardian_prosemirror_invisibles = require("@guardian/prosemirror-invisibles");
11
+ let prosemirror_dropcursor = require("prosemirror-dropcursor");
12
+ let prosemirror_history = require("prosemirror-history");
13
+ let prosemirror_state = require("prosemirror-state");
14
+ let prosemirror_view = require("prosemirror-view");
15
+ //#region src/components/Byline/Byline.tsx
16
+ /**
17
+ * ## Byline
18
+ *
19
+ * *Status: Production*
20
+ *
21
+ * A flexible byline editor component built in ProseMirror and React with usability and accessibility in mind.
22
+ *
23
+ * **Peer dependencies:**
24
+ *
25
+ * You'll need to install the following peer dependencies in your project to use the `Byline` component:
26
+ * - `@guardian/prosemirror-invisibles`
27
+ * - `prosemirror-dropcursor`
28
+ * - `prosemirror-history`
29
+ * - `prosemirror-keymap`
30
+ * - `prosemirror-model`
31
+ * - `prosemirror-state`
32
+ * - `prosemirror-view`
33
+ *
34
+ * See the `peerDependencies` section of `package.json` for compatible versions to install.
35
+ *
36
+ * #### Usage
37
+ *
38
+ * ```tsx
39
+ * import type { BylineModel } from '@guardian/stand';
40
+ * import { Byline } from '@guardian/stand';
41
+ *
42
+ * const Component = () => {
43
+ * const bylineModel: BylineModel = {
44
+ * // ...set up your byline model here
45
+ * };
46
+ * ...
47
+ * return (
48
+ * <>
49
+ * ...
50
+ * <Byline initialValue={bylineModel} />
51
+ * ...
52
+ * </>
53
+ * );
54
+ * };
55
+ * ```
56
+ *
57
+ * By itself the `Byline` component is just the editor UI.
58
+ * You will need to set up the ProseMirror editor state, schema, and plugins to get a fully functioning byline editor.
59
+ * See the props and example below for a more complete implementation.
60
+ * The `BylineModel` type defines the structure of the byline data which is agnostic from any other data structure. You must convert to/from this model when integrating with your application's data structures.
61
+ *
62
+ * #### Props
63
+ *
64
+ * See {@link BylineProps} for the full list of props, usage example can be seen in Storybook.
65
+ *
66
+ * #### Example
67
+ *
68
+ * The `ContentByline` component in `flexible-frontend` has a detailed example of how to use the `Byline` component from Stand.
69
+ * See [ContentByline.tsx](https://github.com/guardian/flexible-content/blob/1d537615a18ae24a4a5410a3f945b2b9db1dbb47/flexible-frontend/src/app/components/furniture/content-byline/ContentByline.tsx#L72-L205).
70
+ */
71
+ const Byline = ({ theme, allowUntaggedContributors, contributorLimit, enablePreview, placeholder, initialValue, readOnly, handleSave, searchContributors, onBlur }) => {
72
+ const editorRef = (0, react.useRef)(null);
73
+ const viewRef = (0, react.useRef)(null);
74
+ const dropdownRef = (0, react.useRef)(null);
75
+ const [currentText, setCurrentText] = (0, react.useState)("");
76
+ const [currentOptionIndex, setCurrentOptionIndex] = (0, react.useState)(0);
77
+ const [taggedContributors, setTaggedContributors] = (0, react.useState)([]);
78
+ const [currentDoc, setCurrentDoc] = (0, react.useState)(null);
79
+ const [showDropdown, setShowDropdown] = (0, react.useState)(false);
80
+ const isTypingFromStartRange = (0, react.useRef)(void 0);
81
+ const trackTypingFromStart = (tr) => {
82
+ const isCursorSelection = tr.selection.from === tr.selection.to;
83
+ const currentPosition = tr.selection.from;
84
+ const hasChanges = tr.steps.length > 0;
85
+ if (!isCursorSelection) {
86
+ isTypingFromStartRange.current = void 0;
87
+ return;
88
+ }
89
+ if (!isTypingFromStartRange.current && currentPosition === 1 && hasChanges) {
90
+ isTypingFromStartRange.current = {
91
+ start: 1,
92
+ maxReached: 1,
93
+ lastPosition: 1
94
+ };
95
+ return;
96
+ }
97
+ if (isTypingFromStartRange.current) {
98
+ const { start, maxReached, lastPosition } = isTypingFromStartRange.current;
99
+ const isWithinRange = currentPosition >= start && currentPosition <= maxReached;
100
+ const isExtendingRange = hasChanges && currentPosition === maxReached + 1;
101
+ if (isWithinRange || isExtendingRange) {
102
+ if (hasChanges) {
103
+ const positionDelta = currentPosition - lastPosition;
104
+ if (positionDelta < 0) isTypingFromStartRange.current.maxReached = maxReached - 1;
105
+ else if (positionDelta > 0) isTypingFromStartRange.current.maxReached = maxReached + 1;
106
+ isTypingFromStartRange.current.lastPosition = currentPosition;
107
+ }
108
+ return;
109
+ }
110
+ }
111
+ isTypingFromStartRange.current = void 0;
112
+ };
113
+ const getShouldShowDropdown = (view, selectedText) => {
114
+ if (readOnly) return false;
115
+ /**
116
+ * Determines whether to hide or show the contributor dropdown based on component props,
117
+ * and should be used in combination with the selected/current text when calling setShowDropdown
118
+ * The logic evaluates to true when either:
119
+ * - There are search contributors available OR
120
+ * - Untagged contributors are allowed
121
+ * - The document state is under any contributor limit
122
+ * - The selected text is not empty
123
+ */
124
+ const showDropdownBasedOnProps = !!searchContributors || !!allowUntaggedContributors;
125
+ if (require_lib.hasHitContributorLimit(view.state.doc, contributorLimit)) return false;
126
+ return selectedText.trim() !== "" && showDropdownBasedOnProps;
127
+ };
128
+ const [enterHit, setEnterHit] = (0, react.useState)(false);
129
+ const checkDropdownVisibility = () => {
130
+ if (dropdownRef.current?.checkVisibility) return dropdownRef.current.checkVisibility();
131
+ else return dropdownRef.current?.offsetParent !== null;
132
+ };
133
+ (0, react.useEffect)(() => {
134
+ if (!editorRef.current) return;
135
+ const initialDoc = require_lib.convertBylineModelToNode(initialValue);
136
+ const state = prosemirror_state.EditorState.create({
137
+ schema: require_schema.bylineEditorSchema,
138
+ plugins: [
139
+ (0, prosemirror_dropcursor.dropCursor)(),
140
+ require_plugins.clipboardPlugin(allowUntaggedContributors, contributorLimit),
141
+ (0, prosemirror_history.history)(),
142
+ require_plugins.keybindings(),
143
+ (0, _guardian_prosemirror_invisibles.createInvisiblesPlugin)([_guardian_prosemirror_invisibles.space, _guardian_prosemirror_invisibles.nbSpace], {
144
+ displayLineEndSelection: true,
145
+ shouldShowInvisibles: true
146
+ }),
147
+ require_plugins.bylinePlugin(),
148
+ require_placeholder.createPlaceholderPlugin(placeholder ?? "Enter a byline...")
149
+ ],
150
+ doc: initialDoc
151
+ });
152
+ setCurrentDoc(initialDoc);
153
+ viewRef.current = new prosemirror_view.EditorView(editorRef.current, {
154
+ state,
155
+ editable: () => !readOnly,
156
+ attributes: {
157
+ role: "combobox",
158
+ "aria-label": "byline",
159
+ "aria-controls": "byline-dropdown",
160
+ "aria-expanded": "false",
161
+ "data-testid": "byline-input",
162
+ ...readOnly && { "aria-readonly": "true" }
163
+ },
164
+ handleDOMEvents: {
165
+ keydown: (view, event) => {
166
+ if (readOnly) return false;
167
+ if (event.key === "Escape") {
168
+ setShowDropdown(false);
169
+ return true;
170
+ }
171
+ if (event.key === "ArrowDown") {
172
+ if (checkDropdownVisibility()) {
173
+ event.preventDefault();
174
+ setCurrentOptionIndex((currentOptionIndex) => {
175
+ return currentOptionIndex + 1;
176
+ });
177
+ return true;
178
+ }
179
+ return false;
180
+ }
181
+ if (event.key === "ArrowUp") {
182
+ if (checkDropdownVisibility()) {
183
+ event.preventDefault();
184
+ setCurrentOptionIndex((currentOptionIndex) => {
185
+ return currentOptionIndex - 1;
186
+ });
187
+ return true;
188
+ }
189
+ return false;
190
+ }
191
+ if (event.key === "Enter") {
192
+ if (checkDropdownVisibility()) {
193
+ event.preventDefault();
194
+ setEnterHit(true);
195
+ }
196
+ return false;
197
+ }
198
+ return false;
199
+ },
200
+ blur: (_view, event) => {
201
+ if (readOnly) return false;
202
+ if (!dropdownRef.current?.contains(event.relatedTarget)) setShowDropdown(false);
203
+ return false;
204
+ }
205
+ },
206
+ dispatchTransaction(tr) {
207
+ if (readOnly) {
208
+ if (tr.docChanged) return;
209
+ if (viewRef.current) {
210
+ const newState = viewRef.current.state.apply(tr);
211
+ viewRef.current.updateState(newState);
212
+ }
213
+ return;
214
+ }
215
+ if (viewRef.current?.hasFocus()) {
216
+ trackTypingFromStart(tr);
217
+ const newState = viewRef.current.state.apply(tr);
218
+ viewRef.current.updateState(newState);
219
+ const { selectedText } = require_lib.getCurrentText(newState.doc, newState.selection.from, newState.selection.to, isTypingFromStartRange.current);
220
+ setCurrentText(selectedText);
221
+ const shouldShowDropdown = getShouldShowDropdown(viewRef.current, selectedText);
222
+ if (shouldShowDropdown && searchContributors) searchContributors(selectedText).then((contributors) => {
223
+ setTaggedContributors(contributors);
224
+ }).catch((error) => {
225
+ console.error("Error fetching tagged contributors:", error);
226
+ setTaggedContributors([]);
227
+ });
228
+ else setTaggedContributors([]);
229
+ setShowDropdown(shouldShowDropdown);
230
+ if (tr.docChanged) {
231
+ setCurrentDoc(newState.doc);
232
+ handleSave(require_lib.convertNodeToBylineModel(newState.doc));
233
+ }
234
+ }
235
+ }
236
+ });
237
+ return () => {
238
+ viewRef.current?.destroy();
239
+ };
240
+ }, []);
241
+ (0, react.useEffect)(() => {
242
+ const numberOfOptions = taggedContributors.length + (allowUntaggedContributors ? 1 : 0);
243
+ if (numberOfOptions) if (currentOptionIndex < 0) setCurrentOptionIndex(numberOfOptions - 1);
244
+ else setCurrentOptionIndex(currentOptionIndex % numberOfOptions);
245
+ if (showDropdown) {
246
+ const editor = document.querySelector("[role=combobox]");
247
+ editor?.setAttribute("aria-activedescendant", `contributor-option-${currentOptionIndex}`);
248
+ editor?.setAttribute("aria-expanded", "true");
249
+ }
250
+ }, [
251
+ currentOptionIndex,
252
+ showDropdown,
253
+ taggedContributors.length,
254
+ allowUntaggedContributors
255
+ ]);
256
+ (0, react.useEffect)(() => {
257
+ if (showDropdown && currentOptionIndex >= 0) {
258
+ const selectedOption = document.getElementById(`contributor-option-${currentOptionIndex}`);
259
+ if (selectedOption && dropdownRef.current) selectedOption.scrollIntoView({
260
+ behavior: "smooth",
261
+ block: "nearest"
262
+ });
263
+ }
264
+ }, [currentOptionIndex, showDropdown]);
265
+ (0, react.useEffect)(() => {
266
+ if (enterHit) {
267
+ if (allowUntaggedContributors && currentOptionIndex === taggedContributors.length) require_lib.addUntaggedContributor(viewRef, setShowDropdown, contributorLimit, isTypingFromStartRange.current);
268
+ else {
269
+ const contributorToAdd = taggedContributors[currentOptionIndex];
270
+ if (contributorToAdd) require_lib.addTaggedContributor(contributorToAdd, viewRef, setShowDropdown, contributorLimit, isTypingFromStartRange.current);
271
+ }
272
+ setEnterHit(false);
273
+ }
274
+ }, [
275
+ currentOptionIndex,
276
+ enterHit,
277
+ taggedContributors,
278
+ contributorLimit,
279
+ allowUntaggedContributors
280
+ ]);
281
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
282
+ css: require_styles.bylineContainerStyles,
283
+ children: [
284
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
285
+ css: require_styles.bylineEditorStyles(theme),
286
+ ref: editorRef,
287
+ onBlur
288
+ }),
289
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
290
+ ref: dropdownRef,
291
+ tabIndex: 0,
292
+ css: require_styles.dropdownContainerStyles(showDropdown && (taggedContributors.length > 0 || !!allowUntaggedContributors), theme?.dropdown),
293
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("ul", {
294
+ id: "byline-dropdown",
295
+ role: "listbox",
296
+ css: require_styles.dropdownUlStyles,
297
+ children: [taggedContributors.map((contributor, i) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("li", {
298
+ id: `contributor-option-${i}`,
299
+ role: "option",
300
+ "aria-selected": i === currentOptionIndex,
301
+ css: [require_styles.dropdownLiStyles(theme?.dropdown), i === currentOptionIndex && require_styles.selectedDropdownLiStyles(theme?.dropdown)],
302
+ onMouseMove: () => {
303
+ if (currentOptionIndex !== i) setCurrentOptionIndex(i);
304
+ },
305
+ onMouseDown: (e) => {
306
+ e.preventDefault();
307
+ require_lib.addTaggedContributor(contributor, viewRef, setShowDropdown, contributorLimit, isTypingFromStartRange.current);
308
+ },
309
+ children: contributor.internalLabel ?? contributor.label
310
+ }, contributor.tagId)), allowUntaggedContributors && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("li", {
311
+ role: "option",
312
+ id: `contributor-option-${taggedContributors.length}`,
313
+ "aria-selected": currentOptionIndex === taggedContributors.length,
314
+ css: [require_styles.dropdownLiStyles(theme?.dropdown), currentOptionIndex === taggedContributors.length && require_styles.selectedDropdownLiStyles(theme?.dropdown)],
315
+ onMouseMove: () => {
316
+ if (currentOptionIndex !== taggedContributors.length) setCurrentOptionIndex(taggedContributors.length);
317
+ },
318
+ onMouseDown: (e) => {
319
+ e.preventDefault();
320
+ require_lib.addUntaggedContributor(viewRef, setShowDropdown, contributorLimit, isTypingFromStartRange.current);
321
+ },
322
+ children: [
323
+ "Add \"",
324
+ currentText,
325
+ "\" as untagged contributor"
326
+ ]
327
+ })]
328
+ })
329
+ }),
330
+ enablePreview && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Preview.Preview, { doc: currentDoc })
331
+ ]
332
+ });
366
333
  };
367
-
334
+ //#endregion
368
335
  exports.Byline = Byline;