@panneau/ui 5.0.0-alpha.2 → 5.0.0-alpha.21

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 (398) hide show
  1. package/README.md +144 -15
  2. package/dist/alert/Alert.d.ts +2 -2
  3. package/dist/alert/Alert.js +108 -40
  4. package/dist/alert/Alert.js.map +1 -1
  5. package/dist/alert/tokens.d.ts +1 -1
  6. package/dist/alert/tokens.js.map +1 -1
  7. package/dist/badge/Badge.d.ts +1 -1
  8. package/dist/badge/Badge.js +34 -6
  9. package/dist/badge/Badge.js.map +1 -1
  10. package/dist/badge/tokens.d.ts +1 -1
  11. package/dist/badge/tokens.js.map +1 -1
  12. package/dist/button/Button.d.ts +20 -6
  13. package/dist/button/Button.d.ts.map +1 -1
  14. package/dist/button/Button.js +169 -22
  15. package/dist/button/Button.js.map +1 -1
  16. package/dist/button/LinkButton.d.ts +22 -0
  17. package/dist/button/LinkButton.d.ts.map +1 -0
  18. package/dist/button/LinkButton.js +113 -0
  19. package/dist/button/LinkButton.js.map +1 -0
  20. package/dist/button/tokens.d.ts +1 -1
  21. package/dist/button/tokens.js.map +1 -1
  22. package/dist/card/Card.js +76 -23
  23. package/dist/card/Card.js.map +1 -1
  24. package/dist/card/tokens.d.ts +1 -1
  25. package/dist/card/tokens.js.map +1 -1
  26. package/dist/checkbox/Checkbox.css +9 -9
  27. package/dist/checkbox/Checkbox.d.ts +1 -1
  28. package/dist/checkbox/Checkbox.js +87 -26
  29. package/dist/checkbox/Checkbox.js.map +1 -1
  30. package/dist/checkbox/Checkbox.module.js +3 -3
  31. package/dist/checkbox/Checkbox.module.js.map +1 -1
  32. package/dist/checkbox/ChoiceChrome.js +82 -21
  33. package/dist/checkbox/ChoiceChrome.js.map +1 -1
  34. package/dist/checkbox/tokens.d.ts +1 -1
  35. package/dist/checkbox/tokens.js.map +1 -1
  36. package/dist/combo-box/ComboBox.css +10 -0
  37. package/dist/combo-box/ComboBox.d.ts +7 -2
  38. package/dist/combo-box/ComboBox.d.ts.map +1 -1
  39. package/dist/combo-box/ComboBox.js +310 -78
  40. package/dist/combo-box/ComboBox.js.map +1 -1
  41. package/dist/combo-box/ComboBox.module.js +4 -2
  42. package/dist/combo-box/ComboBox.module.js.map +1 -1
  43. package/dist/command-palette/CommandPalette.css +299 -0
  44. package/dist/command-palette/CommandPalette.d.ts +37 -0
  45. package/dist/command-palette/CommandPalette.d.ts.map +1 -0
  46. package/dist/command-palette/CommandPalette.js +497 -0
  47. package/dist/command-palette/CommandPalette.js.map +1 -0
  48. package/dist/command-palette/CommandPalette.module.js +62 -0
  49. package/dist/command-palette/CommandPalette.module.js.map +1 -0
  50. package/dist/command-palette/match.d.ts +39 -0
  51. package/dist/command-palette/match.d.ts.map +1 -0
  52. package/dist/command-palette/match.js +44 -0
  53. package/dist/command-palette/match.js.map +1 -0
  54. package/dist/command-palette/tokens.d.ts +3 -0
  55. package/dist/command-palette/tokens.d.ts.map +1 -0
  56. package/dist/command-palette/tokens.js +23 -0
  57. package/dist/command-palette/tokens.js.map +1 -0
  58. package/dist/command-palette/useCommandShortcut.d.ts +12 -0
  59. package/dist/command-palette/useCommandShortcut.d.ts.map +1 -0
  60. package/dist/command-palette/useCommandShortcut.js +48 -0
  61. package/dist/command-palette/useCommandShortcut.js.map +1 -0
  62. package/dist/container/Container.js +48 -5
  63. package/dist/container/Container.js.map +1 -1
  64. package/dist/container/tokens.d.ts +1 -1
  65. package/dist/container/tokens.js.map +1 -1
  66. package/dist/date-picker/DatePicker.css +40 -0
  67. package/dist/date-picker/DatePicker.d.ts +3 -2
  68. package/dist/date-picker/DatePicker.d.ts.map +1 -1
  69. package/dist/date-picker/DatePicker.js +279 -72
  70. package/dist/date-picker/DatePicker.js.map +1 -1
  71. package/dist/date-picker/DatePicker.module.js +5 -1
  72. package/dist/date-picker/DatePicker.module.js.map +1 -1
  73. package/dist/date-picker/calendarTokens.d.ts +1 -1
  74. package/dist/date-picker/calendarTokens.js.map +1 -1
  75. package/dist/date-range-picker/DateRangePicker.css +37 -0
  76. package/dist/date-range-picker/DateRangePicker.d.ts +41 -0
  77. package/dist/date-range-picker/DateRangePicker.d.ts.map +1 -0
  78. package/dist/date-range-picker/DateRangePicker.js +438 -0
  79. package/dist/date-range-picker/DateRangePicker.js.map +1 -0
  80. package/dist/date-range-picker/DateRangePicker.module.js +20 -0
  81. package/dist/date-range-picker/DateRangePicker.module.js.map +1 -0
  82. package/dist/dialog/Dialog.css +41 -2
  83. package/dist/dialog/Dialog.d.ts +15 -3
  84. package/dist/dialog/Dialog.d.ts.map +1 -1
  85. package/dist/dialog/Dialog.js +161 -32
  86. package/dist/dialog/Dialog.js.map +1 -1
  87. package/dist/dialog/Dialog.module.js +10 -2
  88. package/dist/dialog/Dialog.module.js.map +1 -1
  89. package/dist/dialog/tokens.d.ts +1 -1
  90. package/dist/dialog/tokens.d.ts.map +1 -1
  91. package/dist/dialog/tokens.js +2 -0
  92. package/dist/dialog/tokens.js.map +1 -1
  93. package/dist/disclosure/Disclosure.js +132 -28
  94. package/dist/disclosure/Disclosure.js.map +1 -1
  95. package/dist/disclosure/tokens.d.ts +1 -1
  96. package/dist/disclosure/tokens.js.map +1 -1
  97. package/dist/divider/Divider.js +55 -11
  98. package/dist/divider/Divider.js.map +1 -1
  99. package/dist/divider/tokens.d.ts +1 -1
  100. package/dist/divider/tokens.js.map +1 -1
  101. package/dist/field/Field.css +26 -0
  102. package/dist/field/Field.module.js +6 -2
  103. package/dist/field/Field.module.js.map +1 -1
  104. package/dist/field/FieldParts.d.ts +1 -1
  105. package/dist/field/FieldParts.js +69 -15
  106. package/dist/field/FieldParts.js.map +1 -1
  107. package/dist/field/Fieldset.d.ts +6 -1
  108. package/dist/field/Fieldset.d.ts.map +1 -1
  109. package/dist/field/Fieldset.js +132 -33
  110. package/dist/field/Fieldset.js.map +1 -1
  111. package/dist/field/inputTokens.d.ts +1 -1
  112. package/dist/field/inputTokens.js.map +1 -1
  113. package/dist/field/tokens.d.ts +1 -1
  114. package/dist/field/tokens.js.map +1 -1
  115. package/dist/grid/Grid.d.ts +1 -1
  116. package/dist/grid/Grid.js +123 -14
  117. package/dist/grid/Grid.js.map +1 -1
  118. package/dist/grid/tokens.d.ts +1 -1
  119. package/dist/grid/tokens.js.map +1 -1
  120. package/dist/heading/Heading.js +41 -6
  121. package/dist/heading/Heading.js.map +1 -1
  122. package/dist/heading/tokens.d.ts +1 -1
  123. package/dist/heading/tokens.js.map +1 -1
  124. package/dist/icon/Icon.js +36 -11
  125. package/dist/icon/Icon.js.map +1 -1
  126. package/dist/icon/lucideIconLoader.d.ts +9 -0
  127. package/dist/icon/lucideIconLoader.d.ts.map +1 -0
  128. package/dist/icon/lucideIconLoader.js +22 -0
  129. package/dist/icon/lucideIconLoader.js.map +1 -0
  130. package/dist/icon/namedIcons.d.ts +16 -9
  131. package/dist/icon/namedIcons.d.ts.map +1 -1
  132. package/dist/icon/namedIcons.js +121 -46
  133. package/dist/icon/namedIcons.js.map +1 -1
  134. package/dist/icon-button/IconButton.d.ts +2 -2
  135. package/dist/icon-button/IconButton.js +70 -13
  136. package/dist/icon-button/IconButton.js.map +1 -1
  137. package/dist/index.d.ts +65 -52
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +19 -6
  140. package/dist/inline/Inline.d.ts +1 -1
  141. package/dist/inline/Inline.js +65 -7
  142. package/dist/inline/Inline.js.map +1 -1
  143. package/dist/inline/tokens.d.ts +1 -1
  144. package/dist/inline/tokens.js.map +1 -1
  145. package/dist/intl/usePanneauIntl.js.map +1 -1
  146. package/dist/layout/responsive.js.map +1 -1
  147. package/dist/line-chart/LineChart.css +84 -0
  148. package/dist/line-chart/LineChart.d.ts +26 -0
  149. package/dist/line-chart/LineChart.d.ts.map +1 -0
  150. package/dist/line-chart/LineChart.js +327 -0
  151. package/dist/line-chart/LineChart.js.map +1 -0
  152. package/dist/line-chart/LineChart.module.js +28 -0
  153. package/dist/line-chart/LineChart.module.js.map +1 -0
  154. package/dist/line-chart/tokens.d.ts +3 -0
  155. package/dist/line-chart/tokens.d.ts.map +1 -0
  156. package/dist/line-chart/tokens.js +19 -0
  157. package/dist/line-chart/tokens.js.map +1 -0
  158. package/dist/locales/index.js.map +1 -1
  159. package/dist/menu/Menu.css +84 -0
  160. package/dist/menu/Menu.d.ts +34 -7
  161. package/dist/menu/Menu.d.ts.map +1 -1
  162. package/dist/menu/Menu.js +243 -32
  163. package/dist/menu/Menu.js.map +1 -1
  164. package/dist/menu/Menu.module.js +22 -0
  165. package/dist/menu/Menu.module.js.map +1 -0
  166. package/dist/menu/tokens.d.ts +3 -0
  167. package/dist/menu/tokens.d.ts.map +1 -0
  168. package/dist/menu/tokens.js +31 -0
  169. package/dist/menu/tokens.js.map +1 -0
  170. package/dist/named-icons/index.d.ts +2 -0
  171. package/dist/named-icons/index.d.ts.map +1 -0
  172. package/dist/named-icons/index.js +1 -0
  173. package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js +136 -0
  174. package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js.map +1 -0
  175. package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +117 -0
  176. package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js.map +1 -0
  177. package/dist/node_modules/@internationalized/date/dist/private/conversion.js +116 -0
  178. package/dist/node_modules/@internationalized/date/dist/private/conversion.js.map +1 -0
  179. package/dist/node_modules/@internationalized/date/dist/private/manipulation.js +206 -0
  180. package/dist/node_modules/@internationalized/date/dist/private/manipulation.js.map +1 -0
  181. package/dist/node_modules/@internationalized/date/dist/private/queries.js +26 -0
  182. package/dist/node_modules/@internationalized/date/dist/private/queries.js.map +1 -0
  183. package/dist/node_modules/@internationalized/date/dist/private/string.js +19 -0
  184. package/dist/node_modules/@internationalized/date/dist/private/string.js.map +1 -0
  185. package/dist/node_modules/@internationalized/date/dist/private/utils.js +8 -0
  186. package/dist/node_modules/@internationalized/date/dist/private/utils.js.map +1 -0
  187. package/dist/number-input/NumberInput.css +18 -0
  188. package/dist/number-input/NumberInput.d.ts +1 -1
  189. package/dist/number-input/NumberInput.js +232 -60
  190. package/dist/number-input/NumberInput.js.map +1 -1
  191. package/dist/number-input/NumberInput.module.js +3 -1
  192. package/dist/number-input/NumberInput.module.js.map +1 -1
  193. package/dist/number-input/tokens.d.ts +1 -1
  194. package/dist/number-input/tokens.js.map +1 -1
  195. package/dist/pill-trigger/PillTrigger.css +104 -0
  196. package/dist/pill-trigger/PillTrigger.d.ts +20 -0
  197. package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
  198. package/dist/pill-trigger/PillTrigger.js +94 -0
  199. package/dist/pill-trigger/PillTrigger.js.map +1 -0
  200. package/dist/pill-trigger/PillTrigger.module.js +18 -0
  201. package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
  202. package/dist/pill-trigger/tokens.d.ts +3 -0
  203. package/dist/pill-trigger/tokens.d.ts.map +1 -0
  204. package/dist/pill-trigger/tokens.js +37 -0
  205. package/dist/pill-trigger/tokens.js.map +1 -0
  206. package/dist/popover/Popover.css +5 -0
  207. package/dist/popover/Popover.d.ts.map +1 -1
  208. package/dist/popover/Popover.js +116 -20
  209. package/dist/popover/Popover.js.map +1 -1
  210. package/dist/popover/Popover.module.js +4 -2
  211. package/dist/popover/Popover.module.js.map +1 -1
  212. package/dist/popover/tokens.d.ts +1 -1
  213. package/dist/popover/tokens.js.map +1 -1
  214. package/dist/prose/Prose.js +36 -5
  215. package/dist/prose/Prose.js.map +1 -1
  216. package/dist/prose/tokens.d.ts +1 -1
  217. package/dist/prose/tokens.js.map +1 -1
  218. package/dist/radio-group/RadioGroup.css +90 -0
  219. package/dist/radio-group/RadioGroup.d.ts +24 -5
  220. package/dist/radio-group/RadioGroup.d.ts.map +1 -1
  221. package/dist/radio-group/RadioGroup.js +214 -43
  222. package/dist/radio-group/RadioGroup.js.map +1 -1
  223. package/dist/radio-group/RadioGroup.module.js +12 -2
  224. package/dist/radio-group/RadioGroup.module.js.map +1 -1
  225. package/dist/radio-group/tokens.d.ts +2 -2
  226. package/dist/radio-group/tokens.d.ts.map +1 -1
  227. package/dist/radio-group/tokens.js +22 -2
  228. package/dist/radio-group/tokens.js.map +1 -1
  229. package/dist/root/PanneauRoot.css +24 -0
  230. package/dist/root/PanneauRoot.d.ts +40 -4
  231. package/dist/root/PanneauRoot.d.ts.map +1 -1
  232. package/dist/root/PanneauRoot.js +284 -82
  233. package/dist/root/PanneauRoot.js.map +1 -1
  234. package/dist/root/PanneauRoot.module.js.map +1 -1
  235. package/dist/root/ThemeScope.d.ts +1 -1
  236. package/dist/root/ThemeScope.d.ts.map +1 -1
  237. package/dist/root/ThemeScope.js +110 -27
  238. package/dist/root/ThemeScope.js.map +1 -1
  239. package/dist/segmented-control/SegmentedControl.css +83 -0
  240. package/dist/segmented-control/SegmentedControl.d.ts +35 -0
  241. package/dist/segmented-control/SegmentedControl.d.ts.map +1 -0
  242. package/dist/segmented-control/SegmentedControl.js +142 -0
  243. package/dist/segmented-control/SegmentedControl.js.map +1 -0
  244. package/dist/segmented-control/SegmentedControl.module.js +16 -0
  245. package/dist/segmented-control/SegmentedControl.module.js.map +1 -0
  246. package/dist/segmented-control/tokens.d.ts +3 -0
  247. package/dist/segmented-control/tokens.d.ts.map +1 -0
  248. package/dist/segmented-control/tokens.js +29 -0
  249. package/dist/segmented-control/tokens.js.map +1 -0
  250. package/dist/select/ListBox.css +75 -1
  251. package/dist/select/ListBox.module.js +9 -3
  252. package/dist/select/ListBox.module.js.map +1 -1
  253. package/dist/select/Select.d.ts +14 -1
  254. package/dist/select/Select.d.ts.map +1 -1
  255. package/dist/select/Select.js +335 -92
  256. package/dist/select/Select.js.map +1 -1
  257. package/dist/select/listBoxTokens.d.ts +1 -1
  258. package/dist/select/listBoxTokens.d.ts.map +1 -1
  259. package/dist/select/listBoxTokens.js +2 -0
  260. package/dist/select/listBoxTokens.js.map +1 -1
  261. package/dist/skeleton/LoadingRegion.d.ts +16 -0
  262. package/dist/skeleton/LoadingRegion.d.ts.map +1 -0
  263. package/dist/skeleton/LoadingRegion.js +65 -0
  264. package/dist/skeleton/LoadingRegion.js.map +1 -0
  265. package/dist/skeleton/Skeleton.css +62 -0
  266. package/dist/skeleton/Skeleton.d.ts +25 -0
  267. package/dist/skeleton/Skeleton.d.ts.map +1 -0
  268. package/dist/skeleton/Skeleton.js +106 -0
  269. package/dist/skeleton/Skeleton.js.map +1 -0
  270. package/dist/skeleton/Skeleton.module.js +22 -0
  271. package/dist/skeleton/Skeleton.module.js.map +1 -0
  272. package/dist/skeleton/tokens.d.ts +3 -0
  273. package/dist/skeleton/tokens.d.ts.map +1 -0
  274. package/dist/skeleton/tokens.js +15 -0
  275. package/dist/skeleton/tokens.js.map +1 -0
  276. package/dist/slider/Slider.css +84 -0
  277. package/dist/slider/Slider.d.ts +20 -0
  278. package/dist/slider/Slider.d.ts.map +1 -0
  279. package/dist/slider/Slider.js +248 -0
  280. package/dist/slider/Slider.js.map +1 -0
  281. package/dist/slider/Slider.module.js +20 -0
  282. package/dist/slider/Slider.module.js.map +1 -0
  283. package/dist/spinner/Spinner.js +49 -9
  284. package/dist/spinner/Spinner.js.map +1 -1
  285. package/dist/spinner/tokens.d.ts +1 -1
  286. package/dist/spinner/tokens.js.map +1 -1
  287. package/dist/stack/Stack.d.ts +1 -1
  288. package/dist/stack/Stack.js +60 -7
  289. package/dist/stack/Stack.js.map +1 -1
  290. package/dist/stack/tokens.d.ts +1 -1
  291. package/dist/stack/tokens.js.map +1 -1
  292. package/dist/stat/Stat.css +45 -0
  293. package/dist/stat/Stat.d.ts +27 -0
  294. package/dist/stat/Stat.d.ts.map +1 -0
  295. package/dist/stat/Stat.js +87 -0
  296. package/dist/stat/Stat.js.map +1 -0
  297. package/dist/stat/Stat.module.js +18 -0
  298. package/dist/stat/Stat.module.js.map +1 -0
  299. package/dist/stat/tokens.d.ts +3 -0
  300. package/dist/stat/tokens.d.ts.map +1 -0
  301. package/dist/stat/tokens.js +21 -0
  302. package/dist/stat/tokens.js.map +1 -0
  303. package/dist/switch/Switch.css +8 -8
  304. package/dist/switch/Switch.d.ts +1 -1
  305. package/dist/switch/Switch.js +69 -12
  306. package/dist/switch/Switch.js.map +1 -1
  307. package/dist/switch/Switch.module.js +3 -2
  308. package/dist/switch/Switch.module.js.map +1 -1
  309. package/dist/switch/tokens.d.ts +1 -1
  310. package/dist/switch/tokens.js.map +1 -1
  311. package/dist/tabs/Tabs.js +1 -1
  312. package/dist/tabs/Tabs.js.map +1 -1
  313. package/dist/tabs/tokens.d.ts +1 -1
  314. package/dist/tabs/tokens.js.map +1 -1
  315. package/dist/tags-input/TagsInput.css +60 -0
  316. package/dist/tags-input/TagsInput.d.ts +32 -0
  317. package/dist/tags-input/TagsInput.d.ts.map +1 -0
  318. package/dist/tags-input/TagsInput.js +316 -0
  319. package/dist/tags-input/TagsInput.js.map +1 -0
  320. package/dist/tags-input/TagsInput.module.js +20 -0
  321. package/dist/tags-input/TagsInput.module.js.map +1 -0
  322. package/dist/text/Text.d.ts +1 -1
  323. package/dist/text/Text.js +70 -5
  324. package/dist/text/Text.js.map +1 -1
  325. package/dist/text/tokens.d.ts +1 -1
  326. package/dist/text/tokens.js.map +1 -1
  327. package/dist/text-area/TextArea.css +1 -1
  328. package/dist/text-area/TextArea.d.ts +1 -1
  329. package/dist/text-area/TextArea.js +135 -28
  330. package/dist/text-area/TextArea.js.map +1 -1
  331. package/dist/text-area/TextArea.module.js +3 -3
  332. package/dist/text-area/TextArea.module.js.map +1 -1
  333. package/dist/text-input/TextInput.d.ts +7 -3
  334. package/dist/text-input/TextInput.d.ts.map +1 -1
  335. package/dist/text-input/TextInput.js +164 -47
  336. package/dist/text-input/TextInput.js.map +1 -1
  337. package/dist/theme/Tone.css +14 -0
  338. package/dist/theme/Tone.module.js +4 -2
  339. package/dist/theme/Tone.module.js.map +1 -1
  340. package/dist/theme/bootstrap.d.ts +2 -2
  341. package/dist/theme/bootstrap.d.ts.map +1 -1
  342. package/dist/theme/bootstrap.js +6 -0
  343. package/dist/theme/bootstrap.js.map +1 -1
  344. package/dist/theme/chartColors.js.map +1 -1
  345. package/dist/theme/checkTheme.d.ts +2 -2
  346. package/dist/theme/checkTheme.d.ts.map +1 -1
  347. package/dist/theme/checkTheme.js +24 -0
  348. package/dist/theme/checkTheme.js.map +1 -1
  349. package/dist/theme/cli.d.ts +2 -2
  350. package/dist/theme/cli.js.map +1 -1
  351. package/dist/theme/color.js.map +1 -1
  352. package/dist/theme/colorVision.d.ts +1 -1
  353. package/dist/theme/colorVision.js.map +1 -1
  354. package/dist/theme/componentTokens.js.map +1 -1
  355. package/dist/theme/components.d.ts +10 -3
  356. package/dist/theme/components.d.ts.map +1 -1
  357. package/dist/theme/components.js +14 -0
  358. package/dist/theme/components.js.map +1 -1
  359. package/dist/theme/defineTheme.d.ts +5 -5
  360. package/dist/theme/defineTheme.js.map +1 -1
  361. package/dist/theme/fonts.js.map +1 -1
  362. package/dist/theme/index.d.ts +12 -12
  363. package/dist/theme/index.js +1 -1
  364. package/dist/theme/semanticTokens.d.ts +1 -1
  365. package/dist/theme/semanticTokens.d.ts.map +1 -1
  366. package/dist/theme/semanticTokens.js +6 -0
  367. package/dist/theme/semanticTokens.js.map +1 -1
  368. package/dist/theme/theme.d.ts +2 -2
  369. package/dist/theme/theme.js.map +1 -1
  370. package/dist/theme/toneClass.d.ts +1 -1
  371. package/dist/theme/toneClass.js.map +1 -1
  372. package/dist/theme/tones.d.ts +15 -3
  373. package/dist/theme/tones.d.ts.map +1 -1
  374. package/dist/theme/tones.js +14 -2
  375. package/dist/theme/tones.js.map +1 -1
  376. package/dist/time-input/TimeInput.d.ts +1 -1
  377. package/dist/time-input/TimeInput.js +138 -31
  378. package/dist/time-input/TimeInput.js.map +1 -1
  379. package/dist/toast/Toast.css +131 -15
  380. package/dist/toast/Toast.d.ts +47 -10
  381. package/dist/toast/Toast.d.ts.map +1 -1
  382. package/dist/toast/Toast.js +191 -66
  383. package/dist/toast/Toast.js.map +1 -1
  384. package/dist/toast/Toast.module.js +5 -3
  385. package/dist/toast/Toast.module.js.map +1 -1
  386. package/dist/toast/tokens.d.ts +1 -1
  387. package/dist/toast/tokens.js +1 -1
  388. package/dist/toast/tokens.js.map +1 -1
  389. package/dist/tooltip/Tooltip.js +38 -8
  390. package/dist/tooltip/Tooltip.js.map +1 -1
  391. package/dist/tooltip/tokens.d.ts +1 -1
  392. package/dist/tooltip/tokens.js.map +1 -1
  393. package/dist/utils/cx.js.map +1 -1
  394. package/dist/utils/events.d.ts +4 -0
  395. package/dist/utils/events.d.ts.map +1 -0
  396. package/dist/utils/events.js +9 -0
  397. package/dist/utils/events.js.map +1 -0
  398. package/package.json +10 -5
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.js","names":[],"sources":["../../src/theme/fonts.ts"],"sourcesContent":["/** A font face of a theme, written as an `@font-face` rule. */\nexport type ThemeFontFace = {\n /** The family name that font tokens use: `'Geist'`. */\n family: string;\n /** The `src` descriptor: `url(/fonts/geist.woff2) format('woff2')`. */\n src: string;\n /** A weight or a range of a variable font: `400`, `400 700`. */\n weight?: string;\n /** `normal` or `italic`. */\n style?: string;\n /** Defaults to `swap`. */\n display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n unicodeRange?: string;\n};\n\n/** A hosted stylesheet that declares font faces: Google Fonts, Adobe Fonts, a site's own. */\nexport type ThemeFontStylesheet = {\n stylesheet: string;\n};\n\n/**\n * A font of a theme: a face, or a stylesheet that declares faces. `PanneauRoot` adds them to the\n * page once, however many roots use the theme. Font faces are global by nature, unlike tokens.\n */\nexport type ThemeFont = ThemeFontFace | ThemeFontStylesheet;\n\n/** Values that could break out of an `@font-face` rule, or out of the family name. */\nconst UNSAFE = /[{}<]/;\nconst UNSAFE_FAMILY = /[{}<;\"\\\\]/;\nconst UNSAFE_DESCRIPTOR = /[{}<;]/;\n\nfunction isFace(font: ThemeFont): font is ThemeFontFace {\n return 'family' in font && 'src' in font;\n}\n\n/**\n * The `@font-face` rules of the fonts of a theme. Faces with a value that could break out of the\n * rule are ignored: `{`, `}` or `<` anywhere, `;` outside of `src` (which can hold data URLs), and\n * quotes or backslashes in the family.\n */\nexport function getFontFaceCss(fonts: readonly ThemeFont[] = []): string {\n return fonts\n .filter(isFace)\n .filter(\n (face) =>\n !UNSAFE_FAMILY.test(face.family) &&\n !UNSAFE.test(face.src) &&\n [face.weight, face.style, face.display, face.unicodeRange].every(\n (value) => value === undefined || !UNSAFE_DESCRIPTOR.test(value),\n ),\n )\n .map((face) =>\n [\n `@font-face{font-family:\"${face.family}\";src:${face.src};`,\n face.weight !== undefined ? `font-weight:${face.weight};` : '',\n face.style !== undefined ? `font-style:${face.style};` : '',\n `font-display:${face.display ?? 'swap'};`,\n face.unicodeRange !== undefined ? `unicode-range:${face.unicodeRange};` : '',\n '}',\n ].join(''),\n )\n .join('');\n}\n\n/** The URLs of the font stylesheets of a theme, without duplicates. */\nexport function getFontStylesheets(fonts: readonly ThemeFont[] = []): string[] {\n return [\n ...new Set(\n fonts.flatMap((font) =>\n 'stylesheet' in font && typeof font.stylesheet === 'string'\n ? [font.stylesheet]\n : [],\n ),\n ),\n ];\n}\n"],"mappings":";;AA2BA,IAAM,SAAS;AACf,IAAM,gBAAgB;AACtB,IAAM,oBAAoB;AAE1B,SAAS,OAAO,MAAwC;CACpD,OAAO,YAAY,QAAQ,SAAS;AACxC;;;;;;AAOA,SAAgB,eAAe,QAA8B,CAAA,GAAY;CACrE,OAAO,MACF,OAAO,MAAM,CAAC,CACd,QACI,SACG,CAAC,cAAc,KAAK,KAAK,MAAM,KAC/B,CAAC,OAAO,KAAK,KAAK,GAAG,KACrB;EAAC,KAAK;EAAQ,KAAK;EAAO,KAAK;EAAS,KAAK;CAAY,CAAC,CAAC,OACtD,UAAU,UAAU,KAAA,KAAa,CAAC,kBAAkB,KAAK,KAAK,CACnE,CACR,CAAC,CACA,KAAK,SACF;EACI,2BAA2B,KAAK,OAAM,QAAS,KAAK,IAAG;EACvD,KAAK,WAAW,KAAA,IAAY,eAAe,KAAK,OAAM,KAAM;EAC5D,KAAK,UAAU,KAAA,IAAY,cAAc,KAAK,MAAK,KAAM;EACzD,gBAAgB,KAAK,WAAW,OAAM;EACtC,KAAK,iBAAiB,KAAA,IAAY,iBAAiB,KAAK,aAAY,KAAM;EAC1E;CAAG,CACN,CAAC,KAAK,EAAE,CACb,CAAC,CACA,KAAK,EAAE;AAChB;;AAGA,SAAgB,mBAAmB,QAA8B,CAAA,GAAc;CAC3E,OAAO,CACH,GAAG,IAAI,IACH,MAAM,SAAS,SACX,gBAAgB,QAAQ,OAAO,KAAK,eAAe,WAC7C,CAAC,KAAK,UAAU,IAChB,CAAA,CACV,CACJ,CAAC;AAET"}
1
+ {"version":3,"file":"fonts.js","names":["ThemeFontFace","family","src","weight","style","display","unicodeRange","ThemeFontStylesheet","stylesheet","ThemeFont","UNSAFE","UNSAFE_FAMILY","UNSAFE_DESCRIPTOR","isFace","font","getFontFaceCss","fonts","filter","face","test","every","value","undefined","map","join","getFontStylesheets","Set","flatMap"],"sources":["../../src/theme/fonts.ts"],"sourcesContent":["/** A font face of a theme, written as an `@font-face` rule. */\nexport type ThemeFontFace = {\n /** The family name that font tokens use: `'Geist'`. */\n family: string;\n /** The `src` descriptor: `url(/fonts/geist.woff2) format('woff2')`. */\n src: string;\n /** A weight or a range of a variable font: `400`, `400 700`. */\n weight?: string;\n /** `normal` or `italic`. */\n style?: string;\n /** Defaults to `swap`. */\n display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n unicodeRange?: string;\n};\n\n/** A hosted stylesheet that declares font faces: Google Fonts, Adobe Fonts, a site's own. */\nexport type ThemeFontStylesheet = {\n stylesheet: string;\n};\n\n/**\n * A font of a theme: a face, or a stylesheet that declares faces. `PanneauRoot` adds them to the\n * page once, however many roots use the theme. Font faces are global by nature, unlike tokens.\n */\nexport type ThemeFont = ThemeFontFace | ThemeFontStylesheet;\n\n/** Values that could break out of an `@font-face` rule, or out of the family name. */\nconst UNSAFE = /[{}<]/;\nconst UNSAFE_FAMILY = /[{}<;\"\\\\]/;\nconst UNSAFE_DESCRIPTOR = /[{}<;]/;\n\nfunction isFace(font: ThemeFont): font is ThemeFontFace {\n return 'family' in font && 'src' in font;\n}\n\n/**\n * The `@font-face` rules of the fonts of a theme. Faces with a value that could break out of the\n * rule are ignored: `{`, `}` or `<` anywhere, `;` outside of `src` (which can hold data URLs), and\n * quotes or backslashes in the family.\n */\nexport function getFontFaceCss(fonts: readonly ThemeFont[] = []): string {\n return fonts\n .filter(isFace)\n .filter(\n (face) =>\n !UNSAFE_FAMILY.test(face.family) &&\n !UNSAFE.test(face.src) &&\n [face.weight, face.style, face.display, face.unicodeRange].every(\n (value) => value === undefined || !UNSAFE_DESCRIPTOR.test(value),\n ),\n )\n .map((face) =>\n [\n `@font-face{font-family:\"${face.family}\";src:${face.src};`,\n face.weight !== undefined ? `font-weight:${face.weight};` : '',\n face.style !== undefined ? `font-style:${face.style};` : '',\n `font-display:${face.display ?? 'swap'};`,\n face.unicodeRange !== undefined ? `unicode-range:${face.unicodeRange};` : '',\n '}',\n ].join(''),\n )\n .join('');\n}\n\n/** The URLs of the font stylesheets of a theme, without duplicates. */\nexport function getFontStylesheets(fonts: readonly ThemeFont[] = []): string[] {\n return [\n ...new Set(\n fonts.flatMap((font) =>\n 'stylesheet' in font && typeof font.stylesheet === 'string'\n ? [font.stylesheet]\n : [],\n ),\n ),\n ];\n}\n"],"mappings":";;AA2BA,IAAMU,SAAS;AACf,IAAMC,gBAAgB;AACtB,IAAMC,oBAAoB;AAE1B,SAASC,OAAOC,MAAwC;CACpD,OAAO,YAAYA,QAAQ,SAASA;AACxC;;;;;;AAOA,SAAgBC,eAAeC,QAA8B,CAAA,GAAY;CACrE,OAAOA,MACFC,OAAOJ,MAAM,CAAC,CACdI,QACIC,SACG,CAACP,cAAcQ,KAAKD,KAAKjB,MAAM,KAC/B,CAACS,OAAOS,KAAKD,KAAKhB,GAAG,KACrB;EAACgB,KAAKf;EAAQe,KAAKd;EAAOc,KAAKb;EAASa,KAAKZ;CAAY,CAAC,CAACc,OACtDC,UAAUA,UAAUC,KAAAA,KAAa,CAACV,kBAAkBO,KAAKE,KAAK,CACnE,CACR,CAAC,CACAE,KAAKL,SACF;EACI,2BAA2BA,KAAKjB,OAAM,QAASiB,KAAKhB,IAAG;EACvDgB,KAAKf,WAAWmB,KAAAA,IAAY,eAAeJ,KAAKf,OAAM,KAAM;EAC5De,KAAKd,UAAUkB,KAAAA,IAAY,cAAcJ,KAAKd,MAAK,KAAM;EACzD,gBAAgBc,KAAKb,WAAW,OAAM;EACtCa,KAAKZ,iBAAiBgB,KAAAA,IAAY,iBAAiBJ,KAAKZ,aAAY,KAAM;EAC1E;CAAG,CACN,CAACkB,KAAK,EAAE,CACb,CAAC,CACAA,KAAK,EAAE;AAChB;;AAGA,SAAgBC,mBAAmBT,QAA8B,CAAA,GAAc;CAC3E,OAAO,CACH,GAAG,IAAIU,IACHV,MAAMW,SAASb,SACX,gBAAgBA,QAAQ,OAAOA,KAAKN,eAAe,WAC7C,CAACM,KAAKN,UAAU,IAChB,CAAA,CACV,CACJ,CAAC;AAET"}
@@ -1,13 +1,13 @@
1
- export { bootstrapTheme, bootstrapTone } from './bootstrap';
2
- export { CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, chartColors } from './chartColors';
3
- export { type ThemeContrastCheck, type ThemeReport, checkTheme } from './checkTheme';
4
- export { type ColorDifferenceCheck, type ColorVisionDeficiency, checkColorDifferences, } from './colorVision';
5
- export { type Rgb } from './color';
6
- export { type ComponentTokens, defineComponentTokens } from './componentTokens';
7
- export { type ComponentTokenName, componentTokens } from './components';
8
- export { type PaletteTokenName, type PanneauTokens, type ThemeDefinition, type ThemeTokens, type TokenName, defineTheme, findUnknownTokens, mergeThemes, } from './defineTheme';
9
- export { type ThemeFont, type ThemeFontFace, type ThemeFontStylesheet } from './fonts';
10
- export { SEMANTIC_TOKENS, type SemanticTokenName } from './semanticTokens';
11
- export { type ColorScheme, type Density, type Theme } from './theme';
12
- export { BUILT_IN_TONES, type PanneauTones, type Tone, type ToneInput, type ToneSurfaces, type ToneValues, deriveTone, toneClassName, } from './tones';
1
+ export { bootstrapTheme, bootstrapTone } from './bootstrap.js';
2
+ export { CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, chartColors } from './chartColors.js';
3
+ export { type ThemeContrastCheck, type ThemeReport, checkTheme } from './checkTheme.js';
4
+ export { type ColorDifferenceCheck, type ColorVisionDeficiency, checkColorDifferences, } from './colorVision.js';
5
+ export { type Rgb } from './color.js';
6
+ export { type ComponentTokens, defineComponentTokens } from './componentTokens.js';
7
+ export { type ComponentTokenName, componentTokens } from './components.js';
8
+ export { type PaletteTokenName, type PanneauTokens, type ThemeDefinition, type ThemeTokens, type TokenName, defineTheme, findUnknownTokens, mergeThemes, } from './defineTheme.js';
9
+ export { type ThemeFont, type ThemeFontFace, type ThemeFontStylesheet } from './fonts.js';
10
+ export { SEMANTIC_TOKENS, type SemanticTokenName } from './semanticTokens.js';
11
+ export { type ColorScheme, type Density, type Theme } from './theme.js';
12
+ export { BUILT_IN_TONES, type PanneauTones, type Tone, type ToneInput, type ToneSurfaces, type ToneValues, deriveTone, toneClassName, } from './tones.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { BUILT_IN_TONES, deriveTone, toneClassName } from "./tones.js";
2
- import { bootstrapTheme, bootstrapTone } from "./bootstrap.js";
3
2
  import { CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, chartColors } from "./chartColors.js";
3
+ import { bootstrapTheme, bootstrapTone } from "./bootstrap.js";
4
4
  import { checkColorDifferences } from "./colorVision.js";
5
5
  import { checkTheme } from "./checkTheme.js";
6
6
  import { defineComponentTokens } from "./componentTokens.js";
@@ -3,7 +3,7 @@
3
3
  * root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once
4
4
  * (decision 0024). A test keeps this list in sync with the stylesheet.
5
5
  */
6
- export declare const SEMANTIC_TOKENS: readonly ["panneau-color-bg", "panneau-color-surface", "panneau-color-surface-sunken", "panneau-color-surface-raised", "panneau-color-hover", "panneau-color-pressed", "panneau-color-backdrop", "panneau-color-text", "panneau-color-text-muted", "panneau-color-link", "panneau-color-border", "panneau-color-border-control", "panneau-color-accent", "panneau-color-accent-hover", "panneau-color-accent-text", "panneau-color-accent-subtle", "panneau-color-focus", "panneau-color-danger", "panneau-color-danger-subtle", "panneau-color-danger-border", "panneau-color-danger-solid", "panneau-color-danger-solid-hover", "panneau-color-danger-solid-text", "panneau-color-success", "panneau-color-success-subtle", "panneau-color-success-border", "panneau-color-success-solid", "panneau-color-success-solid-hover", "panneau-color-success-solid-text", "panneau-color-warning", "panneau-color-warning-subtle", "panneau-color-warning-border", "panneau-color-warning-solid", "panneau-color-warning-solid-hover", "panneau-color-warning-solid-text", "panneau-color-info", "panneau-color-info-subtle", "panneau-color-info-border", "panneau-color-info-solid", "panneau-color-info-solid-hover", "panneau-color-info-solid-text", "panneau-chart-categorical-1", "panneau-chart-categorical-2", "panneau-chart-categorical-3", "panneau-chart-categorical-4", "panneau-chart-categorical-5", "panneau-chart-categorical-6", "panneau-chart-categorical-7", "panneau-chart-categorical-8", "panneau-chart-sequential-1", "panneau-chart-sequential-2", "panneau-chart-sequential-3", "panneau-chart-sequential-4", "panneau-chart-sequential-5", "panneau-chart-diverging-negative", "panneau-chart-diverging-neutral", "panneau-chart-diverging-positive", "panneau-font-family-body", "panneau-font-family-heading", "panneau-font-family-display", "panneau-font-family-mono", "panneau-font-family", "panneau-font-numeric", "panneau-font-size-xs", "panneau-font-size-sm", "panneau-font-size-md", "panneau-font-size-lg", "panneau-font-size-xl", "panneau-font-size-control", "panneau-line-height", "panneau-line-height-tight", "panneau-font-weight-normal", "panneau-font-weight-medium", "panneau-font-weight-bold", "panneau-space-1", "panneau-space-2", "panneau-space-3", "panneau-space-4", "panneau-space-5", "panneau-space-6", "panneau-space-8", "panneau-space-10", "panneau-radius-sm", "panneau-radius-md", "panneau-radius-lg", "panneau-radius-full", "panneau-border-width", "panneau-shadow-sm", "panneau-shadow-md", "panneau-shadow-lg", "panneau-control-height", "panneau-control-height-sm", "panneau-control-padding-x", "panneau-row-padding-y", "panneau-focus-width", "panneau-duration", "panneau-z-overlay", "panneau-z-toast"];
6
+ export declare const SEMANTIC_TOKENS: readonly ["panneau-color-bg", "panneau-color-surface", "panneau-color-surface-sunken", "panneau-color-surface-raised", "panneau-color-hover", "panneau-color-pressed", "panneau-color-backdrop", "panneau-color-text", "panneau-color-text-muted", "panneau-color-link", "panneau-color-border", "panneau-color-border-control", "panneau-color-accent", "panneau-color-accent-hover", "panneau-color-accent-text", "panneau-color-accent-subtle", "panneau-color-focus", "panneau-color-danger", "panneau-color-danger-subtle", "panneau-color-danger-border", "panneau-color-danger-solid", "panneau-color-danger-solid-hover", "panneau-color-danger-solid-text", "panneau-color-success", "panneau-color-success-subtle", "panneau-color-success-border", "panneau-color-success-solid", "panneau-color-success-solid-hover", "panneau-color-success-solid-text", "panneau-color-warning", "panneau-color-warning-subtle", "panneau-color-warning-border", "panneau-color-warning-solid", "panneau-color-warning-solid-hover", "panneau-color-warning-solid-text", "panneau-color-info", "panneau-color-info-subtle", "panneau-color-info-border", "panneau-color-info-solid", "panneau-color-info-solid-hover", "panneau-color-info-solid-text", "panneau-color-muted", "panneau-color-muted-subtle", "panneau-color-muted-border", "panneau-color-muted-solid", "panneau-color-muted-solid-hover", "panneau-color-muted-solid-text", "panneau-chart-categorical-1", "panneau-chart-categorical-2", "panneau-chart-categorical-3", "panneau-chart-categorical-4", "panneau-chart-categorical-5", "panneau-chart-categorical-6", "panneau-chart-categorical-7", "panneau-chart-categorical-8", "panneau-chart-sequential-1", "panneau-chart-sequential-2", "panneau-chart-sequential-3", "panneau-chart-sequential-4", "panneau-chart-sequential-5", "panneau-chart-diverging-negative", "panneau-chart-diverging-neutral", "panneau-chart-diverging-positive", "panneau-font-family-body", "panneau-font-family-heading", "panneau-font-family-display", "panneau-font-family-mono", "panneau-font-family", "panneau-font-numeric", "panneau-font-size-xs", "panneau-font-size-sm", "panneau-font-size-md", "panneau-font-size-lg", "panneau-font-size-xl", "panneau-font-size-control", "panneau-line-height", "panneau-line-height-tight", "panneau-font-weight-normal", "panneau-font-weight-medium", "panneau-font-weight-bold", "panneau-space-1", "panneau-space-2", "panneau-space-3", "panneau-space-4", "panneau-space-5", "panneau-space-6", "panneau-space-8", "panneau-space-10", "panneau-radius-sm", "panneau-radius-md", "panneau-radius-lg", "panneau-radius-full", "panneau-border-width", "panneau-shadow-sm", "panneau-shadow-md", "panneau-shadow-lg", "panneau-control-height", "panneau-control-height-sm", "panneau-control-padding-x", "panneau-row-padding-y", "panneau-focus-width", "panneau-duration", "panneau-z-overlay", "panneau-z-toast"];
7
7
  /** The name of a semantic token, without the leading `--`. */
8
8
  export type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];
9
9
  //# sourceMappingURL=semanticTokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/theme/semanticTokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,4nFAmGlB,CAAC;AAEX,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/theme/semanticTokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,izFAyGlB,CAAC;AAEX,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -46,6 +46,12 @@ var SEMANTIC_TOKENS = [
46
46
  "panneau-color-info-solid",
47
47
  "panneau-color-info-solid-hover",
48
48
  "panneau-color-info-solid-text",
49
+ "panneau-color-muted",
50
+ "panneau-color-muted-subtle",
51
+ "panneau-color-muted-border",
52
+ "panneau-color-muted-solid",
53
+ "panneau-color-muted-solid-hover",
54
+ "panneau-color-muted-solid-text",
49
55
  "panneau-chart-categorical-1",
50
56
  "panneau-chart-categorical-2",
51
57
  "panneau-chart-categorical-3",
@@ -1 +1 @@
1
- {"version":3,"file":"semanticTokens.js","names":[],"sources":["../../src/theme/semanticTokens.ts"],"sourcesContent":["/**\n * The semantic tokens of Panneau, without the leading `--`: what the default theme defines on the\n * root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once\n * (decision 0024). A test keeps this list in sync with the stylesheet.\n */\nexport const SEMANTIC_TOKENS = [\n 'panneau-color-bg',\n 'panneau-color-surface',\n 'panneau-color-surface-sunken',\n 'panneau-color-surface-raised',\n 'panneau-color-hover',\n 'panneau-color-pressed',\n 'panneau-color-backdrop',\n 'panneau-color-text',\n 'panneau-color-text-muted',\n 'panneau-color-link',\n 'panneau-color-border',\n 'panneau-color-border-control',\n 'panneau-color-accent',\n 'panneau-color-accent-hover',\n 'panneau-color-accent-text',\n 'panneau-color-accent-subtle',\n 'panneau-color-focus',\n 'panneau-color-danger',\n 'panneau-color-danger-subtle',\n 'panneau-color-danger-border',\n 'panneau-color-danger-solid',\n 'panneau-color-danger-solid-hover',\n 'panneau-color-danger-solid-text',\n 'panneau-color-success',\n 'panneau-color-success-subtle',\n 'panneau-color-success-border',\n 'panneau-color-success-solid',\n 'panneau-color-success-solid-hover',\n 'panneau-color-success-solid-text',\n 'panneau-color-warning',\n 'panneau-color-warning-subtle',\n 'panneau-color-warning-border',\n 'panneau-color-warning-solid',\n 'panneau-color-warning-solid-hover',\n 'panneau-color-warning-solid-text',\n 'panneau-color-info',\n 'panneau-color-info-subtle',\n 'panneau-color-info-border',\n 'panneau-color-info-solid',\n 'panneau-color-info-solid-hover',\n 'panneau-color-info-solid-text',\n 'panneau-chart-categorical-1',\n 'panneau-chart-categorical-2',\n 'panneau-chart-categorical-3',\n 'panneau-chart-categorical-4',\n 'panneau-chart-categorical-5',\n 'panneau-chart-categorical-6',\n 'panneau-chart-categorical-7',\n 'panneau-chart-categorical-8',\n 'panneau-chart-sequential-1',\n 'panneau-chart-sequential-2',\n 'panneau-chart-sequential-3',\n 'panneau-chart-sequential-4',\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-neutral',\n 'panneau-chart-diverging-positive',\n 'panneau-font-family-body',\n 'panneau-font-family-heading',\n 'panneau-font-family-display',\n 'panneau-font-family-mono',\n 'panneau-font-family',\n 'panneau-font-numeric',\n 'panneau-font-size-xs',\n 'panneau-font-size-sm',\n 'panneau-font-size-md',\n 'panneau-font-size-lg',\n 'panneau-font-size-xl',\n 'panneau-font-size-control',\n 'panneau-line-height',\n 'panneau-line-height-tight',\n 'panneau-font-weight-normal',\n 'panneau-font-weight-medium',\n 'panneau-font-weight-bold',\n 'panneau-space-1',\n 'panneau-space-2',\n 'panneau-space-3',\n 'panneau-space-4',\n 'panneau-space-5',\n 'panneau-space-6',\n 'panneau-space-8',\n 'panneau-space-10',\n 'panneau-radius-sm',\n 'panneau-radius-md',\n 'panneau-radius-lg',\n 'panneau-radius-full',\n 'panneau-border-width',\n 'panneau-shadow-sm',\n 'panneau-shadow-md',\n 'panneau-shadow-lg',\n 'panneau-control-height',\n 'panneau-control-height-sm',\n 'panneau-control-padding-x',\n 'panneau-row-padding-y',\n 'panneau-focus-width',\n 'panneau-duration',\n 'panneau-z-overlay',\n 'panneau-z-toast',\n] as const;\n\n/** The name of a semantic token, without the leading `--`. */\nexport type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];\n"],"mappings":";;;;;;AAKA,IAAa,kBAAkB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAiB"}
1
+ {"version":3,"file":"semanticTokens.js","names":["SEMANTIC_TOKENS","const","SemanticTokenName"],"sources":["../../src/theme/semanticTokens.ts"],"sourcesContent":["/**\n * The semantic tokens of Panneau, without the leading `--`: what the default theme defines on the\n * root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once\n * (decision 0024). A test keeps this list in sync with the stylesheet.\n */\nexport const SEMANTIC_TOKENS = [\n 'panneau-color-bg',\n 'panneau-color-surface',\n 'panneau-color-surface-sunken',\n 'panneau-color-surface-raised',\n 'panneau-color-hover',\n 'panneau-color-pressed',\n 'panneau-color-backdrop',\n 'panneau-color-text',\n 'panneau-color-text-muted',\n 'panneau-color-link',\n 'panneau-color-border',\n 'panneau-color-border-control',\n 'panneau-color-accent',\n 'panneau-color-accent-hover',\n 'panneau-color-accent-text',\n 'panneau-color-accent-subtle',\n 'panneau-color-focus',\n 'panneau-color-danger',\n 'panneau-color-danger-subtle',\n 'panneau-color-danger-border',\n 'panneau-color-danger-solid',\n 'panneau-color-danger-solid-hover',\n 'panneau-color-danger-solid-text',\n 'panneau-color-success',\n 'panneau-color-success-subtle',\n 'panneau-color-success-border',\n 'panneau-color-success-solid',\n 'panneau-color-success-solid-hover',\n 'panneau-color-success-solid-text',\n 'panneau-color-warning',\n 'panneau-color-warning-subtle',\n 'panneau-color-warning-border',\n 'panneau-color-warning-solid',\n 'panneau-color-warning-solid-hover',\n 'panneau-color-warning-solid-text',\n 'panneau-color-info',\n 'panneau-color-info-subtle',\n 'panneau-color-info-border',\n 'panneau-color-info-solid',\n 'panneau-color-info-solid-hover',\n 'panneau-color-info-solid-text',\n 'panneau-color-muted',\n 'panneau-color-muted-subtle',\n 'panneau-color-muted-border',\n 'panneau-color-muted-solid',\n 'panneau-color-muted-solid-hover',\n 'panneau-color-muted-solid-text',\n 'panneau-chart-categorical-1',\n 'panneau-chart-categorical-2',\n 'panneau-chart-categorical-3',\n 'panneau-chart-categorical-4',\n 'panneau-chart-categorical-5',\n 'panneau-chart-categorical-6',\n 'panneau-chart-categorical-7',\n 'panneau-chart-categorical-8',\n 'panneau-chart-sequential-1',\n 'panneau-chart-sequential-2',\n 'panneau-chart-sequential-3',\n 'panneau-chart-sequential-4',\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-neutral',\n 'panneau-chart-diverging-positive',\n 'panneau-font-family-body',\n 'panneau-font-family-heading',\n 'panneau-font-family-display',\n 'panneau-font-family-mono',\n 'panneau-font-family',\n 'panneau-font-numeric',\n 'panneau-font-size-xs',\n 'panneau-font-size-sm',\n 'panneau-font-size-md',\n 'panneau-font-size-lg',\n 'panneau-font-size-xl',\n 'panneau-font-size-control',\n 'panneau-line-height',\n 'panneau-line-height-tight',\n 'panneau-font-weight-normal',\n 'panneau-font-weight-medium',\n 'panneau-font-weight-bold',\n 'panneau-space-1',\n 'panneau-space-2',\n 'panneau-space-3',\n 'panneau-space-4',\n 'panneau-space-5',\n 'panneau-space-6',\n 'panneau-space-8',\n 'panneau-space-10',\n 'panneau-radius-sm',\n 'panneau-radius-md',\n 'panneau-radius-lg',\n 'panneau-radius-full',\n 'panneau-border-width',\n 'panneau-shadow-sm',\n 'panneau-shadow-md',\n 'panneau-shadow-lg',\n 'panneau-control-height',\n 'panneau-control-height-sm',\n 'panneau-control-padding-x',\n 'panneau-row-padding-y',\n 'panneau-focus-width',\n 'panneau-duration',\n 'panneau-z-overlay',\n 'panneau-z-toast',\n] as const;\n\n/** The name of a semantic token, without the leading `--`. */\nexport type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];\n"],"mappings":";;;;;;AAKA,IAAaA,kBAAkB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAiB"}
@@ -1,5 +1,5 @@
1
- import type { ThemeFont } from './fonts';
2
- import { type ToneInput, type ToneSurfaces } from './tones';
1
+ import type { ThemeFont } from './fonts.js';
2
+ import { type ToneInput, type ToneSurfaces } from './tones.js';
3
3
  /**
4
4
  * A theme: design tokens, as CSS variables without the leading `--`, with optional overrides for
5
5
  * the dark scheme, raw palette colors, its own tones, and named variants of components (decision
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":[],"sources":["../../src/theme/theme.ts"],"sourcesContent":["import { parseColor } from './color';\nimport type { ThemeFont } from './fonts';\nimport {\n TONE_VARIABLES,\n type ToneInput,\n type ToneSurfaces,\n type ToneValues,\n resolveTone,\n toneClassName,\n} from './tones';\n\n/**\n * A theme: design tokens, as CSS variables without the leading `--`, with optional overrides for\n * the dark scheme, raw palette colors, its own tones, and named variants of components (decision\n * 0024). A theme is plain data: the `Theme` schema of `@panneau/protocol` validates it, and plugins\n * of `@panneau/core` register it. Write one with `defineTheme()` to check token names.\n *\n * It is a type rather than an interface so that it is assignable to the `Theme` of\n * `@panneau/protocol`, which accepts properties of later versions.\n */\nexport type Theme = {\n /** A name for theme pickers. */\n label?: string;\n /** Tokens of the light scheme, or of both schemes without `dark`: `{ 'panneau-color-accent': '#05f' }`. */\n tokens: Record<string, string>;\n /** Tokens that change in the dark scheme. */\n dark?: Record<string, string>;\n /**\n * Raw colors, written as `--panneau-palette-<name>`: tokens and tones use them with\n * `var(--panneau-palette-<name>)`, so that a theme names its brand colors once.\n */\n palette?: Record<string, string>;\n /**\n * Tones added or redefined by the theme: one color, from which Panneau derives the others,\n * or every value. Declare added tones in `PanneauTones` so that `tone=\"signal\"` type-checks.\n */\n tones?: Record<string, ToneInput>;\n /**\n * Named variants of components: token overrides that `<Badge variant=\"tag\">` applies through\n * its `panneau-badge-variant-tag` class. Declare them in `BadgeVariants` (and the like).\n */\n components?: Record<string, { variants?: Record<string, Record<string, string>> }>;\n /**\n * Tokens of each density, such as `panneau-control-height`: tokens set here change with the\n * density of the root, while the same tokens in `tokens` would apply to every density.\n */\n densities?: Partial<Record<Exclude<Density, 'auto'>, Record<string, string>>>;\n /**\n * Font faces and font stylesheets, which `PanneauRoot` adds to the page once. Font tokens\n * (`panneau-font-family-heading`) then use their families.\n */\n fonts?: ThemeFont[];\n};\n\n/** `auto` follows the system setting (`prefers-color-scheme`). */\nexport type ColorScheme = 'light' | 'dark' | 'auto';\n\n/**\n * How much room controls and rows take: `compact`, `comfortable`, or `touch`, with larger targets.\n * `auto` is `touch` on coarse pointers (touch screens) and `comfortable` otherwise.\n */\nexport type Density = 'compact' | 'comfortable' | 'touch' | 'auto';\n\nfunction declarations(tokens: Record<string, string>): string {\n return Object.entries(tokens)\n .filter(([name, value]) => /^[a-zA-Z0-9-_]+$/.test(name) && !/[{};<]/.test(value))\n .map(([name, value]) => `--${name}:${value};`)\n .join('');\n}\n\n/** A short, stable hash of a string, to scope the CSS of a theme. */\nexport function hashString(value: string): string {\n let hash = 5381;\n for (let index = 0; index < value.length; index += 1) {\n hash = (hash * 33) ^ value.charCodeAt(index);\n }\n return (hash >>> 0).toString(36);\n}\n\nconst NAME = /^[a-z0-9-]+$/;\n\nconst VARIABLE = /^var\\(--([a-zA-Z0-9_-]+)\\)$/;\n\n/** The palette of a theme, as variables: `{ 'panneau-palette-orange': '#f25c05' }`. */\nexport function paletteVariables(\n palette: Readonly<Record<string, string>> = {},\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(palette)\n .filter(([name]) => NAME.test(name))\n .map(([name, value]) => [`panneau-palette-${name}`, value]),\n );\n}\n\n/**\n * Follows `var(--name)` references through the given variables (tokens, palette colors), until a\n * value that is not one: `var(--panneau-palette-orange)` becomes `#f25c05`. A reference to a\n * variable that isn't given is returned as is.\n */\nexport function resolveReference(\n value: string,\n variables: Readonly<Record<string, string>>,\n): string {\n let current = value;\n for (let depth = 0; depth < 10; depth += 1) {\n const name = VARIABLE.exec(current.trim())?.[1];\n if (name === undefined || !Object.hasOwn(variables, name)) {\n return current;\n }\n current = variables[name] ?? current;\n }\n return current;\n}\n\nfunction toneDeclarations(values: ToneValues): string {\n return declarations(\n Object.fromEntries(\n (Object.keys(TONE_VARIABLES) as (keyof ToneValues)[]).map((key) => [\n TONE_VARIABLES[key],\n values[key],\n ]),\n ),\n );\n}\n\n/**\n * The surfaces of a theme in each scheme, when it sets ones Panneau can read: tones derived from\n * one color are made readable on them.\n */\nexport function themeSurfaces(theme: Theme): ToneSurfaces {\n const palette = paletteVariables(theme.palette);\n const surface = (tokens: Record<string, string>) => {\n const variables = { ...palette, ...tokens };\n const value = variables['panneau-color-surface'];\n return value !== undefined ? parseColor(resolveReference(value, variables)) : null;\n };\n const light = surface(theme.tokens);\n const dark =\n theme.dark?.['panneau-color-surface'] !== undefined\n ? surface({ ...theme.tokens, ...theme.dark })\n : null;\n return {\n ...(light !== null && { light }),\n ...(dark !== null && { dark }),\n };\n}\n\n/**\n * The rules of the densities of a theme. `auto` takes the comfortable values on fine pointers and\n * the touch ones on coarse pointers, like the default theme.\n */\nfunction densityCss(root: string, densities: Theme['densities'] = {}): string {\n const body = (density: Exclude<Density, 'auto'>) => declarations(densities[density] ?? {});\n const rule = (selector: string, css: string) => (css !== '' ? `${selector}{${css}}` : '');\n const media = (query: string, css: string) => (css !== '' ? `@media ${query}{${css}}` : '');\n const selector = (density: Density) => `${root}[data-density=\"${density}\"]`;\n return [\n rule(selector('compact'), body('compact')),\n rule(selector('comfortable'), body('comfortable')),\n media('not (pointer: coarse)', rule(selector('auto'), body('comfortable'))),\n rule(selector('touch'), body('touch')),\n media('(pointer: coarse)', rule(selector('auto'), body('touch'))),\n ].join('');\n}\n\n/**\n * The CSS of a theme, scoped to the roots that carry `data-panneau-theme=\"<scope>\"`: its palette and\n * tokens, its densities, its tones and the variants of components. Its rules are more specific than the default\n * tokens and the built-in tones, and dark overrides more specific than light ones. Token, tone,\n * component and variant names must be plain identifiers, and values can't contain `{`, `}`, `;` or\n * `<`: other entries are ignored.\n */\nexport function getThemeCss(theme: Theme, scope: string): string {\n const root = `[data-panneau-theme=\"${scope}\"]`;\n const dark = `${root}[data-color-scheme=\"dark\"]`;\n const auto = `${root}[data-color-scheme=\"auto\"]`;\n const light: string[] = [];\n const darkRules: string[] = [];\n const rule = (selector: string, body: string) => (body !== '' ? `${selector}{${body}}` : '');\n\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n light.push(rule(root, declarations({ ...palette, ...theme.tokens })));\n light.push(densityCss(root, theme.densities));\n if (theme.dark !== undefined) {\n darkRules.push(rule('§', declarations(theme.dark)));\n }\n Object.entries(theme.tones ?? {})\n .filter(([name]) => NAME.test(name))\n .forEach(([name, input]) => {\n // A tone from a palette color derives from the color itself.\n const values = resolveTone(\n typeof input === 'string' ? resolveReference(input, palette) : input,\n surfaces,\n );\n const selector = `.${toneClassName(name)}`;\n light.push(rule(`${root} ${selector}`, toneDeclarations(values.light)));\n darkRules.push(rule(`§ ${selector}`, toneDeclarations(values.dark)));\n });\n Object.entries(theme.components ?? {})\n .filter(([component]) => NAME.test(component))\n .forEach(([component, { variants = {} }]) => {\n Object.entries(variants)\n .filter(([name]) => NAME.test(name))\n .forEach(([name, tokens]) => {\n light.push(\n rule(`${root} .panneau-${component}-variant-${name}`, declarations(tokens)),\n );\n });\n });\n\n const darkCss = darkRules.filter(Boolean);\n return [\n ...light,\n ...darkCss.map((css) => css.replaceAll('§', dark)),\n darkCss.length > 0\n ? `@media (prefers-color-scheme: dark){${darkCss.map((css) => css.replaceAll('§', auto)).join('')}}`\n : '',\n ].join('');\n}\n"],"mappings":";;;AA+DA,SAAS,aAAa,QAAwC;CAC1D,OAAO,OAAO,QAAQ,MAAM,CAAC,CACxB,QAAQ,CAAC,MAAM,WAAW,mBAAmB,KAAK,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CACjF,KAAK,CAAC,MAAM,WAAW,KAAK,KAAI,GAAI,MAAK,EAAG,CAAC,CAC7C,KAAK,EAAE;AAChB;;AAGA,SAAgB,WAAW,OAAuB;CAC9C,IAAI,OAAO;CACX,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAC/C,OAAQ,OAAO,KAAM,MAAM,WAAW,KAAK;CAE/C,QAAQ,SAAS,EAAA,CAAG,SAAS,EAAE;AACnC;AAEA,IAAM,OAAO;AAEb,IAAM,WAAW;;AAGjB,SAAgB,iBACZ,UAA4C,CAAC,GACvB;CACtB,OAAO,OAAO,YACV,OAAO,QAAQ,OAAO,CAAC,CAClB,QAAQ,CAAC,UAAU,KAAK,KAAK,IAAI,CAAC,CAAC,CACnC,KAAK,CAAC,MAAM,WAAW,CAAC,mBAAmB,QAAQ,KAAK,CAAC,CAClE;AACJ;;;;;;AAOA,SAAgB,iBACZ,OACA,WACM;CACN,IAAI,UAAU;CACd,KAAK,IAAI,QAAQ,GAAG,QAAQ,IAAI,SAAS,GAAG;EACxC,MAAM,OAAO,SAAS,KAAK,QAAQ,KAAK,CAAC,CAAC,GAAG;EAC7C,IAAI,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CAAC,CAC7C,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,SAAS;EACzC,OAAO,QAAQ,QAAQ,CAAC,CACnB,QAAQ,CAAC,UAAU,KAAK,KAAK,IAAI,CAAC,CAAC,CACnC,SAAS,CAAC,MAAM,YAAY;GACzB,MAAM,KACF,KAAK,GAAG,KAAI,YAAa,UAAS,WAAY,QAAQ,aAAa,MAAM,CAAC,CAC9E;EACJ,CAAC;CACT,CAAC;CAEL,MAAM,UAAU,UAAU,OAAO,OAAO;CACxC,OAAO;EACH,GAAG;EACH,GAAG,QAAQ,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAC;EACjD,QAAQ,SAAS,IACX,uCAAuC,QAAQ,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAC,KAC/F;CAAE,CACX,CAAC,KAAK,EAAE;AACb"}
1
+ {"version":3,"file":"theme.js","names":["parseColor","ThemeFont","TONE_VARIABLES","ToneInput","ToneSurfaces","ToneValues","resolveTone","toneClassName","Theme","label","tokens","Record","dark","palette","tones","components","variants","densities","Partial","Exclude","Density","fonts","ColorScheme","declarations","Object","entries","filter","name","value","test","map","join","hashString","hash","index","length","charCodeAt","toString","NAME","VARIABLE","paletteVariables","Readonly","fromEntries","resolveReference","variables","current","depth","exec","trim","undefined","hasOwn","toneDeclarations","values","keys","key","themeSurfaces","theme","surface","light","densityCss","root","body","density","rule","selector","css","media","query","getThemeCss","scope","auto","darkRules","surfaces","push","forEach","input","component","darkCss","Boolean","replaceAll"],"sources":["../../src/theme/theme.ts"],"sourcesContent":["import { parseColor } from './color';\nimport type { ThemeFont } from './fonts';\nimport {\n TONE_VARIABLES,\n type ToneInput,\n type ToneSurfaces,\n type ToneValues,\n resolveTone,\n toneClassName,\n} from './tones';\n\n/**\n * A theme: design tokens, as CSS variables without the leading `--`, with optional overrides for\n * the dark scheme, raw palette colors, its own tones, and named variants of components (decision\n * 0024). A theme is plain data: the `Theme` schema of `@panneau/protocol` validates it, and plugins\n * of `@panneau/core` register it. Write one with `defineTheme()` to check token names.\n *\n * It is a type rather than an interface so that it is assignable to the `Theme` of\n * `@panneau/protocol`, which accepts properties of later versions.\n */\nexport type Theme = {\n /** A name for theme pickers. */\n label?: string;\n /** Tokens of the light scheme, or of both schemes without `dark`: `{ 'panneau-color-accent': '#05f' }`. */\n tokens: Record<string, string>;\n /** Tokens that change in the dark scheme. */\n dark?: Record<string, string>;\n /**\n * Raw colors, written as `--panneau-palette-<name>`: tokens and tones use them with\n * `var(--panneau-palette-<name>)`, so that a theme names its brand colors once.\n */\n palette?: Record<string, string>;\n /**\n * Tones added or redefined by the theme: one color, from which Panneau derives the others,\n * or every value. Declare added tones in `PanneauTones` so that `tone=\"signal\"` type-checks.\n */\n tones?: Record<string, ToneInput>;\n /**\n * Named variants of components: token overrides that `<Badge variant=\"tag\">` applies through\n * its `panneau-badge-variant-tag` class. Declare them in `BadgeVariants` (and the like).\n */\n components?: Record<string, { variants?: Record<string, Record<string, string>> }>;\n /**\n * Tokens of each density, such as `panneau-control-height`: tokens set here change with the\n * density of the root, while the same tokens in `tokens` would apply to every density.\n */\n densities?: Partial<Record<Exclude<Density, 'auto'>, Record<string, string>>>;\n /**\n * Font faces and font stylesheets, which `PanneauRoot` adds to the page once. Font tokens\n * (`panneau-font-family-heading`) then use their families.\n */\n fonts?: ThemeFont[];\n};\n\n/** `auto` follows the system setting (`prefers-color-scheme`). */\nexport type ColorScheme = 'light' | 'dark' | 'auto';\n\n/**\n * How much room controls and rows take: `compact`, `comfortable`, or `touch`, with larger targets.\n * `auto` is `touch` on coarse pointers (touch screens) and `comfortable` otherwise.\n */\nexport type Density = 'compact' | 'comfortable' | 'touch' | 'auto';\n\nfunction declarations(tokens: Record<string, string>): string {\n return Object.entries(tokens)\n .filter(([name, value]) => /^[a-zA-Z0-9-_]+$/.test(name) && !/[{};<]/.test(value))\n .map(([name, value]) => `--${name}:${value};`)\n .join('');\n}\n\n/** A short, stable hash of a string, to scope the CSS of a theme. */\nexport function hashString(value: string): string {\n let hash = 5381;\n for (let index = 0; index < value.length; index += 1) {\n hash = (hash * 33) ^ value.charCodeAt(index);\n }\n return (hash >>> 0).toString(36);\n}\n\nconst NAME = /^[a-z0-9-]+$/;\n\nconst VARIABLE = /^var\\(--([a-zA-Z0-9_-]+)\\)$/;\n\n/** The palette of a theme, as variables: `{ 'panneau-palette-orange': '#f25c05' }`. */\nexport function paletteVariables(\n palette: Readonly<Record<string, string>> = {},\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(palette)\n .filter(([name]) => NAME.test(name))\n .map(([name, value]) => [`panneau-palette-${name}`, value]),\n );\n}\n\n/**\n * Follows `var(--name)` references through the given variables (tokens, palette colors), until a\n * value that is not one: `var(--panneau-palette-orange)` becomes `#f25c05`. A reference to a\n * variable that isn't given is returned as is.\n */\nexport function resolveReference(\n value: string,\n variables: Readonly<Record<string, string>>,\n): string {\n let current = value;\n for (let depth = 0; depth < 10; depth += 1) {\n const name = VARIABLE.exec(current.trim())?.[1];\n if (name === undefined || !Object.hasOwn(variables, name)) {\n return current;\n }\n current = variables[name] ?? current;\n }\n return current;\n}\n\nfunction toneDeclarations(values: ToneValues): string {\n return declarations(\n Object.fromEntries(\n (Object.keys(TONE_VARIABLES) as (keyof ToneValues)[]).map((key) => [\n TONE_VARIABLES[key],\n values[key],\n ]),\n ),\n );\n}\n\n/**\n * The surfaces of a theme in each scheme, when it sets ones Panneau can read: tones derived from\n * one color are made readable on them.\n */\nexport function themeSurfaces(theme: Theme): ToneSurfaces {\n const palette = paletteVariables(theme.palette);\n const surface = (tokens: Record<string, string>) => {\n const variables = { ...palette, ...tokens };\n const value = variables['panneau-color-surface'];\n return value !== undefined ? parseColor(resolveReference(value, variables)) : null;\n };\n const light = surface(theme.tokens);\n const dark =\n theme.dark?.['panneau-color-surface'] !== undefined\n ? surface({ ...theme.tokens, ...theme.dark })\n : null;\n return {\n ...(light !== null && { light }),\n ...(dark !== null && { dark }),\n };\n}\n\n/**\n * The rules of the densities of a theme. `auto` takes the comfortable values on fine pointers and\n * the touch ones on coarse pointers, like the default theme.\n */\nfunction densityCss(root: string, densities: Theme['densities'] = {}): string {\n const body = (density: Exclude<Density, 'auto'>) => declarations(densities[density] ?? {});\n const rule = (selector: string, css: string) => (css !== '' ? `${selector}{${css}}` : '');\n const media = (query: string, css: string) => (css !== '' ? `@media ${query}{${css}}` : '');\n const selector = (density: Density) => `${root}[data-density=\"${density}\"]`;\n return [\n rule(selector('compact'), body('compact')),\n rule(selector('comfortable'), body('comfortable')),\n media('not (pointer: coarse)', rule(selector('auto'), body('comfortable'))),\n rule(selector('touch'), body('touch')),\n media('(pointer: coarse)', rule(selector('auto'), body('touch'))),\n ].join('');\n}\n\n/**\n * The CSS of a theme, scoped to the roots that carry `data-panneau-theme=\"<scope>\"`: its palette and\n * tokens, its densities, its tones and the variants of components. Its rules are more specific than the default\n * tokens and the built-in tones, and dark overrides more specific than light ones. Token, tone,\n * component and variant names must be plain identifiers, and values can't contain `{`, `}`, `;` or\n * `<`: other entries are ignored.\n */\nexport function getThemeCss(theme: Theme, scope: string): string {\n const root = `[data-panneau-theme=\"${scope}\"]`;\n const dark = `${root}[data-color-scheme=\"dark\"]`;\n const auto = `${root}[data-color-scheme=\"auto\"]`;\n const light: string[] = [];\n const darkRules: string[] = [];\n const rule = (selector: string, body: string) => (body !== '' ? `${selector}{${body}}` : '');\n\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n light.push(rule(root, declarations({ ...palette, ...theme.tokens })));\n light.push(densityCss(root, theme.densities));\n if (theme.dark !== undefined) {\n darkRules.push(rule('§', declarations(theme.dark)));\n }\n Object.entries(theme.tones ?? {})\n .filter(([name]) => NAME.test(name))\n .forEach(([name, input]) => {\n // A tone from a palette color derives from the color itself.\n const values = resolveTone(\n typeof input === 'string' ? resolveReference(input, palette) : input,\n surfaces,\n );\n const selector = `.${toneClassName(name)}`;\n light.push(rule(`${root} ${selector}`, toneDeclarations(values.light)));\n darkRules.push(rule(`§ ${selector}`, toneDeclarations(values.dark)));\n });\n Object.entries(theme.components ?? {})\n .filter(([component]) => NAME.test(component))\n .forEach(([component, { variants = {} }]) => {\n Object.entries(variants)\n .filter(([name]) => NAME.test(name))\n .forEach(([name, tokens]) => {\n light.push(\n rule(`${root} .panneau-${component}-variant-${name}`, declarations(tokens)),\n );\n });\n });\n\n const darkCss = darkRules.filter(Boolean);\n return [\n ...light,\n ...darkCss.map((css) => css.replaceAll('§', dark)),\n darkCss.length > 0\n ? `@media (prefers-color-scheme: dark){${darkCss.map((css) => css.replaceAll('§', auto)).join('')}}`\n : '',\n ].join('');\n}\n"],"mappings":";;;AA+DA,SAASuB,aAAab,QAAwC;CAC1D,OAAOc,OAAOC,QAAQf,MAAM,CAAC,CACxBgB,QAAQ,CAACC,MAAMC,WAAW,mBAAmBC,KAAKF,IAAI,KAAK,CAAC,SAASE,KAAKD,KAAK,CAAC,CAAC,CACjFE,KAAK,CAACH,MAAMC,WAAW,KAAKD,KAAI,GAAIC,MAAK,EAAG,CAAC,CAC7CG,KAAK,EAAE;AAChB;;AAGA,SAAgBC,WAAWJ,OAAuB;CAC9C,IAAIK,OAAO;CACX,KAAK,IAAIC,QAAQ,GAAGA,QAAQN,MAAMO,QAAQD,SAAS,GAC/CD,OAAQA,OAAO,KAAML,MAAMQ,WAAWF,KAAK;CAE/C,QAAQD,SAAS,EAAA,CAAGI,SAAS,EAAE;AACnC;AAEA,IAAMC,OAAO;AAEb,IAAMC,WAAW;;AAGjB,SAAgBC,iBACZ3B,UAA4C,CAAC,GACvB;CACtB,OAAOW,OAAOkB,YACVlB,OAAOC,QAAQZ,OAAO,CAAC,CAClBa,QAAQ,CAACC,UAAUW,KAAKT,KAAKF,IAAI,CAAC,CAAC,CACnCG,KAAK,CAACH,MAAMC,WAAW,CAAC,mBAAmBD,QAAQC,KAAK,CAAC,CAClE;AACJ;;;;;;AAOA,SAAgBe,iBACZf,OACAgB,WACM;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AKF,IAAI,CAAC,CAAC,CACnC+C,SAAS,CAAC/C,MAAMgD,WAAW;EAExB,MAAMvB,SAAS9C,YACX,OAAOqE,UAAU,WAAWhC,iBAAiBgC,OAAO9D,OAAO,IAAI8D,OAC/DH,QACJ;EACA,MAAMR,WAAW,IAAIzD,cAAcoB,IAAI;EACvC+B,MAAMe,KAAKV,KAAK,GAAGH,KAAI,GAAII,YAAYb,iBAAiBC,OAAOM,KAAK,CAAC,CAAC;EACtEa,UAAUE,KAAKV,KAAK,KAAKC,YAAYb,iBAAiBC,OAAOxC,IAAI,CAAC,CAAC;CACvE,CAAC;CACLY,OAAOC,QAAQ+B,MAAMzC,cAAc,CAAC,CAAC,CAAC,CACjCW,QAAQ,CAACkD,eAAetC,KAAKT,KAAK+C,SAAS,CAAC,CAAC,CAC7CF,SAAS,CAACE,WAAW,EAAE5D,WAAW,CAAC,SAAS;EACzCQ,OAAOC,QAAQT,QAAQ,CAAC,CACnBU,QAAQ,CAACC,UAAUW,KAAKT,KAAKF,IAAI,CAAC,CAAC,CACnC+C,SAAS,CAAC/C,MAAMjB,YAAY;GACzBgD,MAAMe,KACFV,KAAK,GAAGH,KAAI,YAAagB,UAAS,WAAYjD,QAAQJ,aAAab,MAAM,CAAC,CAC9E;EACJ,CAAC;CACT,CAAC;CAEL,MAAMmE,UAAUN,UAAU7C,OAAOoD,OAAO;CACxC,OAAO;EACH,GAAGpB;EACH,GAAGmB,QAAQ/C,KAAKmC,QAAQA,IAAIc,WAAW,KAAKnE,IAAI,CAAC;EACjDiE,QAAQ1C,SAAS,IACX,uCAAuC0C,QAAQ/C,KAAKmC,QAAQA,IAAIc,WAAW,KAAKT,IAAI,CAAC,CAAC,CAACvC,KAAK,EAAE,EAAC,KAC/F;CAAE,CACX,CAACA,KAAK,EAAE;AACb"}
@@ -1,4 +1,4 @@
1
- import { type Tone } from './tones';
1
+ import { type Tone } from './tones.js';
2
2
  /**
3
3
  * The class of a tone, `panneau-tone-<tone>`. The built-in tones come from `Tone.module.css`, whose
4
4
  * classes get the same stable names, so using it includes their CSS; a theme's own tones get their
@@ -1 +1 @@
1
- {"version":3,"file":"toneClass.js","names":["styles"],"sources":["../../src/theme/toneClass.ts"],"sourcesContent":["import styles from './Tone.module.css';\nimport { type Tone, toneClassName } from './tones';\n\n/**\n * The class of a tone, `panneau-tone-<tone>`. The built-in tones come from `Tone.module.css`, whose\n * classes get the same stable names, so using it includes their CSS; a theme's own tones get their\n * rules from the theme.\n */\nexport function toneClass(tone: Tone): string {\n return (Object.hasOwn(styles, tone) ? styles[tone] : undefined) ?? toneClassName(tone);\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,UAAU,MAAoB;CAC1C,QAAQ,OAAO,OAAOA,qBAAQ,IAAI,IAAIA,oBAAO,QAAQ,KAAA,MAAc,cAAc,IAAI;AACzF"}
1
+ {"version":3,"file":"toneClass.js","names":["styles","Tone","toneClassName","toneClass","tone","Object","hasOwn","undefined","styles"],"sources":["../../src/theme/toneClass.ts"],"sourcesContent":["import styles from './Tone.module.css';\nimport { type Tone, toneClassName } from './tones';\n\n/**\n * The class of a tone, `panneau-tone-<tone>`. The built-in tones come from `Tone.module.css`, whose\n * classes get the same stable names, so using it includes their CSS; a theme's own tones get their\n * rules from the theme.\n */\nexport function toneClass(tone: Tone): string {\n return (Object.hasOwn(styles, tone) ? styles[tone] : undefined) ?? toneClassName(tone);\n}\n"],"mappings":";;;;;;;;AAQA,SAAgBG,UAAUC,MAAoB;CAC1C,QAAQC,OAAOC,OAAON,qBAAQI,IAAI,IAAIJ,oBAAOI,QAAQG,KAAAA,MAAcL,cAAcE,IAAI;AACzF"}
@@ -1,4 +1,4 @@
1
- import { type Rgb } from './color';
1
+ import { type Rgb } from './color.js';
2
2
  /**
3
3
  * The tones that components accept (`tone="success"`), like Bootstrap's `$theme-colors`. A theme
4
4
  * adds its own; declare them here so that `tone="signal"` type-checks:
@@ -18,11 +18,23 @@ export interface PanneauTones {
18
18
  warning: true;
19
19
  danger: true;
20
20
  info: true;
21
+ muted: true;
21
22
  }
22
23
  /** A tone name: a built-in tone, or one declared in `PanneauTones`. */
23
24
  export type Tone = keyof PanneauTones & string;
24
- /** The tones Panneau defines, from the semantic tokens of the theme. */
25
- export declare const BUILT_IN_TONES: readonly ["neutral", "accent", "success", "warning", "danger", "info"];
25
+ /**
26
+ * The tones Panneau defines, from the semantic tokens of the theme. What each one means for a state
27
+ * is written once, in the protocol's docs ("Tones"):
28
+ *
29
+ * - `neutral`: not started, waiting, a category (Draft, Pending);
30
+ * - `info`: in progress or coming (In progress, Scheduled);
31
+ * - `success`: done, live, in good shape (Published, Paid);
32
+ * - `warning`: needs attention soon (Expires soon, Low stock);
33
+ * - `danger`: a problem to fix now (Failed, Overdue);
34
+ * - `muted`: over, no longer active (Archived, Cancelled);
35
+ * - `accent`: never a state, the main action of a screen.
36
+ */
37
+ export declare const BUILT_IN_TONES: readonly ["neutral", "accent", "success", "warning", "danger", "info", "muted"];
26
38
  /** The colors of a tone, as CSS values. */
27
39
  export type ToneValues = {
28
40
  /** Text and icons on surfaces: the outline, subtle and ghost appearances. */
@@ -1 +1 @@
1
- {"version":3,"file":"tones.d.ts","sourceRoot":"","sources":["../../src/theme/tones.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,GAAG,EAQX,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACd;AAED,uEAAuE;AACvE,MAAM,MAAM,IAAI,GAAG,MAAM,YAAY,GAAG,MAAM,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,cAAc,wEAOjB,CAAC;AAEX,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG;IACrB,6EAA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F;AACnF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAElE,6FAA6F;AAC7F,eAAO,MAAM,cAAc;;;CAA8B,CAAC;AAE1D,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,YAAiB,GAC5B;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAuDzC;AAED,qGAAqG;AACrG,wBAAgB,WAAW,CACvB,KAAK,EAAE,SAAS,EAChB,QAAQ,GAAE,YAAiB,GAC5B;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAMzC"}
@@ -1,13 +1,25 @@
1
1
  import { WHITE, contrastRatio, ensureContrast, mixColors, parseColor, readableTextColor, toHex } from "./color.js";
2
2
  //#region src/theme/tones.ts
3
- /** The tones Panneau defines, from the semantic tokens of the theme. */
3
+ /**
4
+ * The tones Panneau defines, from the semantic tokens of the theme. What each one means for a state
5
+ * is written once, in the protocol's docs ("Tones"):
6
+ *
7
+ * - `neutral`: not started, waiting, a category (Draft, Pending);
8
+ * - `info`: in progress or coming (In progress, Scheduled);
9
+ * - `success`: done, live, in good shape (Published, Paid);
10
+ * - `warning`: needs attention soon (Expires soon, Low stock);
11
+ * - `danger`: a problem to fix now (Failed, Overdue);
12
+ * - `muted`: over, no longer active (Archived, Cancelled);
13
+ * - `accent`: never a state, the main action of a screen.
14
+ */
4
15
  var BUILT_IN_TONES = [
5
16
  "neutral",
6
17
  "accent",
7
18
  "success",
8
19
  "warning",
9
20
  "danger",
10
- "info"
21
+ "info",
22
+ "muted"
11
23
  ];
12
24
  /** The local CSS variables of a tone, which components read. */
13
25
  var TONE_VARIABLES = {
@@ -1 +1 @@
1
- {"version":3,"file":"tones.js","names":[],"sources":["../../src/theme/tones.ts"],"sourcesContent":["import {\n type Rgb,\n WHITE,\n contrastRatio,\n ensureContrast,\n mixColors,\n parseColor,\n readableTextColor,\n toHex,\n} from './color';\n\n/**\n * The tones that components accept (`tone=\"success\"`), like Bootstrap's `$theme-colors`. A theme\n * adds its own; declare them here so that `tone=\"signal\"` type-checks:\n *\n * ```ts\n * declare module '@panneau/ui' {\n * interface PanneauTones {\n * signal: true;\n * }\n * }\n * ```\n */\nexport interface PanneauTones {\n neutral: true;\n accent: true;\n success: true;\n warning: true;\n danger: true;\n info: true;\n}\n\n/** A tone name: a built-in tone, or one declared in `PanneauTones`. */\nexport type Tone = keyof PanneauTones & string;\n\n/** The tones Panneau defines, from the semantic tokens of the theme. */\nexport const BUILT_IN_TONES = [\n 'neutral',\n 'accent',\n 'success',\n 'warning',\n 'danger',\n 'info',\n] as const;\n\n/** The colors of a tone, as CSS values. */\nexport type ToneValues = {\n /** Text and icons on surfaces: the outline, subtle and ghost appearances. */\n text: string;\n /** Background of the subtle appearance. */\n subtle: string;\n /** Border of the subtle appearance. */\n border: string;\n /** Border of the outline appearance. */\n outline: string;\n /** Background of the solid appearance. */\n solid: string;\n /** Background of the solid appearance on hover and press. */\n solidHover: string;\n /** Text on the solid appearance. */\n solidText: string;\n};\n\n/**\n * A tone of a theme: one color, from which Panneau derives the others (`'#f25c05'`), or every\n * value, with optional overrides for the dark scheme.\n */\nexport type ToneInput = string | (ToneValues & { dark?: Partial<ToneValues> });\n\n/** The local CSS variables of a tone, which components read. */\nexport const TONE_VARIABLES: Readonly<Record<keyof ToneValues, string>> = {\n text: 'panneau-tone-text',\n subtle: 'panneau-tone-subtle',\n border: 'panneau-tone-border',\n outline: 'panneau-tone-outline',\n solid: 'panneau-tone-solid',\n solidHover: 'panneau-tone-solid-hover',\n solidText: 'panneau-tone-solid-text',\n};\n\n/** The class that applies a tone: `panneau-tone-<tone>`. */\nexport function toneClassName(tone: string): string {\n return `panneau-tone-${tone}`;\n}\n\n/** Surfaces text must be readable on, in each scheme of the default theme. */\nconst SURFACES: Record<'light' | 'dark', Rgb> = { light: WHITE, dark: { r: 24, g: 24, b: 27 } };\n\n/** The surfaces of a theme, in each scheme, when it sets ones Panneau can read. */\nexport type ToneSurfaces = Partial<Record<'light' | 'dark', Rgb>>;\n\n/** How much of the tone's color the subtle background mixes into the surface, per scheme. */\nexport const SUBTLE_AMOUNTS = { light: 0.12, dark: 0.22 };\n\n/** Text must reach this contrast ratio (WCAG AA for normal text). */\nexport const MIN_CONTRAST_RATIO = 4.5;\n\n/**\n * The values of a tone, in both schemes, from one color: Panneau's `button-variant()` and\n * `color-contrast()`.\n *\n * - The solid background is the color, with white or black text, whichever reads better, and a\n * hover 15% darker (or lighter, when the text is black and darker would hurt it).\n * - The text color is the color, darkened (light scheme) or lightened (dark scheme) until it\n * reaches 4.5:1 against the subtle background, which is tinted, and so against the surface too.\n * - The subtle background and the border are mixed with the surface in CSS, so they follow the\n * surface of any theme.\n *\n * A color Panneau can't read (a CSS variable, a named color) is used as is, with `color-mix()` for\n * the hover and white text: `checkTheme()` reports it as unchecked.\n *\n * Text is made readable on the surfaces of the default theme, or on those given, which themes pass\n * so that a tone stays readable on their own surfaces.\n */\nexport function deriveTone(\n color: string,\n surfaces: ToneSurfaces = {},\n): { light: ToneValues; dark: ToneValues } {\n const subtle = (amount: number) =>\n `color-mix(in srgb, ${color} ${amount}%, var(--panneau-color-surface))`;\n const parsed = parseColor(color);\n if (parsed === null) {\n const values: ToneValues = {\n text: color,\n subtle: subtle(SUBTLE_AMOUNTS.light * 100),\n border: subtle(45),\n outline: color,\n solid: color,\n solidHover: `color-mix(in srgb, ${color}, #000 15%)`,\n solidText: '#fff',\n };\n return { light: values, dark: { ...values, subtle: subtle(SUBTLE_AMOUNTS.dark * 100) } };\n }\n const solidText = readableTextColor(parsed);\n const darker = mixColors(parsed, { r: 0, g: 0, b: 0 }, 0.15);\n const hover =\n contrastRatio(solidText, darker) >= contrastRatio(solidText, parsed)\n ? darker\n : mixColors(parsed, WHITE, 0.15);\n const solid = toHex(parsed);\n const shared = {\n solid,\n solidHover: toHex(hover),\n solidText: toHex(solidText),\n };\n // Readable on the subtle background, which is closer to the text color than the surface.\n const readable = (scheme: 'light' | 'dark') =>\n toHex(\n ensureContrast(\n parsed,\n mixColors(surfaces[scheme] ?? SURFACES[scheme], parsed, SUBTLE_AMOUNTS[scheme]),\n MIN_CONTRAST_RATIO,\n ),\n );\n const light = readable('light');\n const dark = readable('dark');\n return {\n light: {\n ...shared,\n text: light,\n outline: light,\n subtle: subtle(SUBTLE_AMOUNTS.light * 100),\n border: subtle(45),\n },\n dark: {\n ...shared,\n text: dark,\n outline: dark,\n subtle: subtle(SUBTLE_AMOUNTS.dark * 100),\n border: subtle(55),\n },\n };\n}\n\n/** The values of a tone input, in both schemes, derived on the given surfaces if it is one color. */\nexport function resolveTone(\n input: ToneInput,\n surfaces: ToneSurfaces = {},\n): { light: ToneValues; dark: ToneValues } {\n if (typeof input === 'string') {\n return deriveTone(input, surfaces);\n }\n const { dark, ...light } = input;\n return { light, dark: { ...light, ...dark } };\n}\n"],"mappings":";;;AAoCA,IAAa,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;AAAM;;AA4BV,IAAa,iBAA6D;CACtE,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,OAAO;CACP,YAAY;CACZ,WAAW;AACf;;AAGA,SAAgB,cAAc,MAAsB;CAChD,OAAO,gBAAgB;AAC3B;;AAGA,IAAM,WAA0C;CAAE,OAAO;CAAO,MAAM;EAAE,GAAG;EAAI,GAAG;EAAI,GAAG;CAAG;AAAE;;AAM9F,IAAa,iBAAiB;CAAE,OAAO;CAAM,MAAM;AAAK;;AAGxD,IAAa,qBAAqB;;;;;;;;;;;;;;;;;;AAmBlC,SAAgB,WACZ,OACA,WAAyB,CAAC,GACa;CACvC,MAAM,UAAU,WACZ,sBAAsB,MAAK,GAAI,OAAM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AO,GAAG;EAAK;CAAE;AAChD"}
1
+ {"version":3,"file":"tones.js","names":["Rgb","WHITE","contrastRatio","ensureContrast","mixColors","parseColor","readableTextColor","toHex","PanneauTones","neutral","accent","success","warning","danger","info","muted","Tone","BUILT_IN_TONES","const","ToneValues","text","subtle","border","outline","solid","solidHover","solidText","ToneInput","dark","Partial","TONE_VARIABLES","Readonly","Record","toneClassName","tone","SURFACES","light","r","g","b","ToneSurfaces","SUBTLE_AMOUNTS","MIN_CONTRAST_RATIO","deriveTone","color","surfaces","amount","parsed","values","darker","hover","shared","readable","scheme","resolveTone","input"],"sources":["../../src/theme/tones.ts"],"sourcesContent":["import {\n type Rgb,\n WHITE,\n contrastRatio,\n ensureContrast,\n mixColors,\n parseColor,\n readableTextColor,\n toHex,\n} from './color';\n\n/**\n * The tones that components accept (`tone=\"success\"`), like Bootstrap's `$theme-colors`. A theme\n * adds its own; declare them here so that `tone=\"signal\"` type-checks:\n *\n * ```ts\n * declare module '@panneau/ui' {\n * interface PanneauTones {\n * signal: true;\n * }\n * }\n * ```\n */\nexport interface PanneauTones {\n neutral: true;\n accent: true;\n success: true;\n warning: true;\n danger: true;\n info: true;\n muted: true;\n}\n\n/** A tone name: a built-in tone, or one declared in `PanneauTones`. */\nexport type Tone = keyof PanneauTones & string;\n\n/**\n * The tones Panneau defines, from the semantic tokens of the theme. What each one means for a state\n * is written once, in the protocol's docs (\"Tones\"):\n *\n * - `neutral`: not started, waiting, a category (Draft, Pending);\n * - `info`: in progress or coming (In progress, Scheduled);\n * - `success`: done, live, in good shape (Published, Paid);\n * - `warning`: needs attention soon (Expires soon, Low stock);\n * - `danger`: a problem to fix now (Failed, Overdue);\n * - `muted`: over, no longer active (Archived, Cancelled);\n * - `accent`: never a state, the main action of a screen.\n */\nexport const BUILT_IN_TONES = [\n 'neutral',\n 'accent',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'muted',\n] as const;\n\n/** The colors of a tone, as CSS values. */\nexport type ToneValues = {\n /** Text and icons on surfaces: the outline, subtle and ghost appearances. */\n text: string;\n /** Background of the subtle appearance. */\n subtle: string;\n /** Border of the subtle appearance. */\n border: string;\n /** Border of the outline appearance. */\n outline: string;\n /** Background of the solid appearance. */\n solid: string;\n /** Background of the solid appearance on hover and press. */\n solidHover: string;\n /** Text on the solid appearance. */\n solidText: string;\n};\n\n/**\n * A tone of a theme: one color, from which Panneau derives the others (`'#f25c05'`), or every\n * value, with optional overrides for the dark scheme.\n */\nexport type ToneInput = string | (ToneValues & { dark?: Partial<ToneValues> });\n\n/** The local CSS variables of a tone, which components read. */\nexport const TONE_VARIABLES: Readonly<Record<keyof ToneValues, string>> = {\n text: 'panneau-tone-text',\n subtle: 'panneau-tone-subtle',\n border: 'panneau-tone-border',\n outline: 'panneau-tone-outline',\n solid: 'panneau-tone-solid',\n solidHover: 'panneau-tone-solid-hover',\n solidText: 'panneau-tone-solid-text',\n};\n\n/** The class that applies a tone: `panneau-tone-<tone>`. */\nexport function toneClassName(tone: string): string {\n return `panneau-tone-${tone}`;\n}\n\n/** Surfaces text must be readable on, in each scheme of the default theme. */\nconst SURFACES: Record<'light' | 'dark', Rgb> = { light: WHITE, dark: { r: 24, g: 24, b: 27 } };\n\n/** The surfaces of a theme, in each scheme, when it sets ones Panneau can read. */\nexport type ToneSurfaces = Partial<Record<'light' | 'dark', Rgb>>;\n\n/** How much of the tone's color the subtle background mixes into the surface, per scheme. */\nexport const SUBTLE_AMOUNTS = { light: 0.12, dark: 0.22 };\n\n/** Text must reach this contrast ratio (WCAG AA for normal text). */\nexport const MIN_CONTRAST_RATIO = 4.5;\n\n/**\n * The values of a tone, in both schemes, from one color: Panneau's `button-variant()` and\n * `color-contrast()`.\n *\n * - The solid background is the color, with white or black text, whichever reads better, and a\n * hover 15% darker (or lighter, when the text is black and darker would hurt it).\n * - The text color is the color, darkened (light scheme) or lightened (dark scheme) until it\n * reaches 4.5:1 against the subtle background, which is tinted, and so against the surface too.\n * - The subtle background and the border are mixed with the surface in CSS, so they follow the\n * surface of any theme.\n *\n * A color Panneau can't read (a CSS variable, a named color) is used as is, with `color-mix()` for\n * the hover and white text: `checkTheme()` reports it as unchecked.\n *\n * Text is made readable on the surfaces of the default theme, or on those given, which themes pass\n * so that a tone stays readable on their own surfaces.\n */\nexport function deriveTone(\n color: string,\n surfaces: ToneSurfaces = {},\n): { light: ToneValues; dark: ToneValues } {\n const subtle = (amount: number) =>\n `color-mix(in srgb, ${color} ${amount}%, var(--panneau-color-surface))`;\n const parsed = parseColor(color);\n if (parsed === null) {\n const values: ToneValues = {\n text: color,\n subtle: subtle(SUBTLE_AMOUNTS.light * 100),\n border: subtle(45),\n outline: color,\n solid: color,\n solidHover: `color-mix(in srgb, ${color}, #000 15%)`,\n solidText: '#fff',\n };\n return { light: values, dark: { ...values, subtle: subtle(SUBTLE_AMOUNTS.dark * 100) } };\n }\n const solidText = readableTextColor(parsed);\n const darker = mixColors(parsed, { r: 0, g: 0, b: 0 }, 0.15);\n const hover =\n contrastRatio(solidText, darker) >= contrastRatio(solidText, parsed)\n ? darker\n : mixColors(parsed, WHITE, 0.15);\n const solid = toHex(parsed);\n const shared = {\n solid,\n solidHover: toHex(hover),\n solidText: toHex(solidText),\n };\n // Readable on the subtle background, which is closer to the text color than the surface.\n const readable = (scheme: 'light' | 'dark') =>\n toHex(\n ensureContrast(\n parsed,\n mixColors(surfaces[scheme] ?? SURFACES[scheme], parsed, SUBTLE_AMOUNTS[scheme]),\n MIN_CONTRAST_RATIO,\n ),\n );\n const light = readable('light');\n const dark = readable('dark');\n return {\n light: {\n ...shared,\n text: light,\n outline: light,\n subtle: subtle(SUBTLE_AMOUNTS.light * 100),\n border: subtle(45),\n },\n dark: {\n ...shared,\n text: dark,\n outline: dark,\n subtle: subtle(SUBTLE_AMOUNTS.dark * 100),\n border: subtle(55),\n },\n };\n}\n\n/** The values of a tone input, in both schemes, derived on the given surfaces if it is one color. */\nexport function resolveTone(\n input: ToneInput,\n surfaces: ToneSurfaces = {},\n): { light: ToneValues; dark: ToneValues } {\n if (typeof input === 'string') {\n return deriveTone(input, surfaces);\n }\n const { dark, ...light } = input;\n return { light, dark: { ...light, ...dark } };\n}\n"],"mappings":";;;;;;;;;;;;;;AAgDA,IAAaiB,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;AAAO;;AA4BX,IAAaa,iBAA6D;CACtEV,MAAM;CACNC,QAAQ;CACRC,QAAQ;CACRC,SAAS;CACTC,OAAO;CACPC,YAAY;CACZC,WAAW;AACf;;AAGA,SAAgBO,cAAcC,MAAsB;CAChD,OAAO,gBAAgBA;AAC3B;;AAGA,IAAMC,WAA0C;CAAEC,OAAOnC;CAAO2B,MAAM;EAAES,GAAG;EAAIC,GAAG;EAAIC,GAAG;CAAG;AAAE;;AAM9F,IAAaE,iBAAiB;CAAEL,OAAO;CAAMR,MAAM;AAAK;;AAGxD,IAAac,qBAAqB;;;;;;;;;;;;;;;;;;AAmBlC,SAAgBC,WACZC,OACAC,WAAyB,CAAC,GACa;CACvC,MAAMxB,UAAUyB,WACZ,sBAAsBF,MAAK,GAAIE,OAAM;CACzC,MAAMC,SAAS1C,WAAWuC,KAAK;CAC/B,IAAIG,WAAW,MAAM;EACjB,MAAMC,SAAqB;GACvB5B,MAAMwB;GACNvB,QAAQA,OAAOoB,eAAeL,QAAQ,GAAG;GACzCd,QAAQD,OAAO,EAAE;GACjBE,SAASqB;GACTpB,OAAOoB;GACPnB,YAAY,sBAAsBmB,MAAK;GACvClB,WAAW;EACf;EACA,OAAO;GAAEU,OAAOY;GAAQpB,MAAM;IAAE,GAAGoB;IAAQ3B,QAAQA,OAAOoB,eAAeb,OAAO,GAAG;GAAE;EAAE;CAC3F;CACA,MAAMF,YAAYpB,kBAAkByC,MAAM;CAC1C,MAAME,SAAS7C,UAAU2C,QAAQ;EAAEV,GAAG;EAAGC,GAAG;EAAGC,GAAG;CAAE,GAAG,GAAI;CAC3D,MAAMW,QACFhD,cAAcwB,WAAWuB,MAAM,KAAK/C,cAAcwB,WAAWqB,MAAM,IAC7DE,SACA7C,UAAU2C,QAAQ9C,OAAO,GAAI;CAEvC,MAAMkD,SAAS;EACX3B,OAFUjB,MAAMwC,MAEhBvB;EACAC,YAAYlB,MAAM2C,KAAK;EACvBxB,WAAWnB,MAAMmB,SAAS;CAC9B;CAEA,MAAM0B,YAAYC,WACd9C,MACIJ,eACI4C,QACA3C,UAAUyC,SAASQ,WAAWlB,SAASkB,SAASN,QAAQN,eAAeY,OAAO,GAC9EX,kBACJ,CACJ;CACJ,MAAMN,QAAQgB,SAAS,OAAO;CAC9B,MAAMxB,OAAOwB,SAAS,MAAM;CAC5B,OAAO;EACHhB,OAAO;GACH,GAAGe;GACH/B,MAAMgB;GACNb,SAASa;GACTf,QAAQA,OAAOoB,eAAeL,QAAQ,GAAG;GACzCd,QAAQD,OAAO,EAAE;EACrB;EACAO,MAAM;GACF,GAAGuB;GACH/B,MAAMQ;GACNL,SAASK;GACTP,QAAQA,OAAOoB,eAAeb,OAAO,GAAG;GACxCN,QAAQD,OAAO,EAAE;EACrB;CACJ;AACJ;;AAGA,SAAgBiC,YACZC,OACAV,WAAyB,CAAC,GACa;CACvC,IAAI,OAAOU,UAAU,UACjB,OAAOZ,WAAWY,OAAOV,QAAQ;CAErC,MAAM,EAAEjB,MAAM,GAAGQ,UAAUmB;CAC3B,OAAO;EAAEnB;EAAOR,MAAM;GAAE,GAAGQ;GAAO,GAAGR;EAAK;CAAE;AAChD"}
@@ -1,5 +1,5 @@
1
1
  import { type TimeFieldProps, type TimeValue } from 'react-aria-components';
2
- import { type FieldChromeProps } from '../field/FieldParts';
2
+ import { type FieldChromeProps } from '../field/FieldParts.js';
3
3
  export interface TimeInputProps extends Omit<TimeFieldProps<TimeValue>, 'className' | 'style' | 'children' | 'isInvalid' | 'validate'>, FieldChromeProps {
4
4
  controlClassName?: string;
5
5
  }
@@ -2,41 +2,148 @@ import { cx } from "../utils/cx.js";
2
2
  import Field_module_default from "../field/Field.module.js";
3
3
  import { FieldDescription, FieldErrors, FieldLabel } from "../field/FieldParts.js";
4
4
  import DatePicker_module_default from "../date-picker/DatePicker.module.js";
5
+ import { c } from "react/compiler-runtime";
5
6
  import { DateInput, DateSegment, TimeField } from "react-aria-components";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  //#region src/time-input/TimeInput.tsx
8
9
  /** A time of day, typed segment by segment in the format of the locale. */
9
- function TimeInput({ label, description, errors = [], isRequired, isReadOnly, className, labelClassName, descriptionClassName, errorsClassName, controlClassName, ...props }) {
10
- return /* @__PURE__ */ jsxs(TimeField, {
11
- ...props,
12
- isRequired,
13
- isReadOnly,
14
- isInvalid: errors.length > 0,
15
- validationBehavior: "aria",
16
- className: cx("panneau-time-input", Field_module_default.field, className),
17
- children: [
18
- /* @__PURE__ */ jsx(FieldLabel, {
19
- isRequired,
20
- className: labelClassName,
21
- children: label
22
- }),
23
- /* @__PURE__ */ jsx(DateInput, {
24
- className: cx(Field_module_default.control, DatePicker_module_default.input, controlClassName),
25
- "data-readonly": isReadOnly || void 0,
26
- children: (segment) => /* @__PURE__ */ jsx(DateSegment, {
27
- segment,
28
- className: DatePicker_module_default.segment
29
- })
30
- }),
31
- /* @__PURE__ */ jsx(FieldDescription, {
32
- className: descriptionClassName,
33
- children: description
34
- }),
35
- /* @__PURE__ */ jsx(FieldErrors, {
36
- errors,
37
- className: errorsClassName
38
- })
39
- ]
10
+ function TimeInput(t0) {
11
+ const $ = c(41);
12
+ let className;
13
+ let controlClassName;
14
+ let description;
15
+ let descriptionClassName;
16
+ let errorsClassName;
17
+ let isReadOnly;
18
+ let isRequired;
19
+ let label;
20
+ let labelClassName;
21
+ let props;
22
+ let t1;
23
+ if ($[0] !== t0) {
24
+ ({label, description, errors: t1, isRequired, isReadOnly, className, labelClassName, descriptionClassName, errorsClassName, controlClassName, ...props} = t0);
25
+ $[0] = t0;
26
+ $[1] = className;
27
+ $[2] = controlClassName;
28
+ $[3] = description;
29
+ $[4] = descriptionClassName;
30
+ $[5] = errorsClassName;
31
+ $[6] = isReadOnly;
32
+ $[7] = isRequired;
33
+ $[8] = label;
34
+ $[9] = labelClassName;
35
+ $[10] = props;
36
+ $[11] = t1;
37
+ } else {
38
+ className = $[1];
39
+ controlClassName = $[2];
40
+ description = $[3];
41
+ descriptionClassName = $[4];
42
+ errorsClassName = $[5];
43
+ isReadOnly = $[6];
44
+ isRequired = $[7];
45
+ label = $[8];
46
+ labelClassName = $[9];
47
+ props = $[10];
48
+ t1 = $[11];
49
+ }
50
+ let t2;
51
+ if ($[12] !== t1) {
52
+ t2 = t1 === void 0 ? [] : t1;
53
+ $[12] = t1;
54
+ $[13] = t2;
55
+ } else t2 = $[13];
56
+ const errors = t2;
57
+ const t3 = errors.length > 0;
58
+ let t4;
59
+ if ($[14] !== className) {
60
+ t4 = cx("panneau-time-input", Field_module_default.field, className);
61
+ $[14] = className;
62
+ $[15] = t4;
63
+ } else t4 = $[15];
64
+ let t5;
65
+ if ($[16] !== isRequired || $[17] !== label || $[18] !== labelClassName) {
66
+ t5 = /* @__PURE__ */ jsx(FieldLabel, {
67
+ isRequired,
68
+ className: labelClassName,
69
+ children: label
70
+ });
71
+ $[16] = isRequired;
72
+ $[17] = label;
73
+ $[18] = labelClassName;
74
+ $[19] = t5;
75
+ } else t5 = $[19];
76
+ let t6;
77
+ if ($[20] !== controlClassName) {
78
+ t6 = cx(Field_module_default.control, DatePicker_module_default.input, controlClassName);
79
+ $[20] = controlClassName;
80
+ $[21] = t6;
81
+ } else t6 = $[21];
82
+ const t7 = isReadOnly || void 0;
83
+ let t8;
84
+ if ($[22] !== t6 || $[23] !== t7) {
85
+ t8 = /* @__PURE__ */ jsx(DateInput, {
86
+ className: t6,
87
+ "data-readonly": t7,
88
+ children: _temp
89
+ });
90
+ $[22] = t6;
91
+ $[23] = t7;
92
+ $[24] = t8;
93
+ } else t8 = $[24];
94
+ let t9;
95
+ if ($[25] !== description || $[26] !== descriptionClassName) {
96
+ t9 = /* @__PURE__ */ jsx(FieldDescription, {
97
+ className: descriptionClassName,
98
+ children: description
99
+ });
100
+ $[25] = description;
101
+ $[26] = descriptionClassName;
102
+ $[27] = t9;
103
+ } else t9 = $[27];
104
+ let t10;
105
+ if ($[28] !== errors || $[29] !== errorsClassName) {
106
+ t10 = /* @__PURE__ */ jsx(FieldErrors, {
107
+ errors,
108
+ className: errorsClassName
109
+ });
110
+ $[28] = errors;
111
+ $[29] = errorsClassName;
112
+ $[30] = t10;
113
+ } else t10 = $[30];
114
+ let t11;
115
+ if ($[31] !== isReadOnly || $[32] !== isRequired || $[33] !== props || $[34] !== t10 || $[35] !== t3 || $[36] !== t4 || $[37] !== t5 || $[38] !== t8 || $[39] !== t9) {
116
+ t11 = /* @__PURE__ */ jsxs(TimeField, {
117
+ ...props,
118
+ isRequired,
119
+ isReadOnly,
120
+ isInvalid: t3,
121
+ validationBehavior: "aria",
122
+ className: t4,
123
+ children: [
124
+ t5,
125
+ t8,
126
+ t9,
127
+ t10
128
+ ]
129
+ });
130
+ $[31] = isReadOnly;
131
+ $[32] = isRequired;
132
+ $[33] = props;
133
+ $[34] = t10;
134
+ $[35] = t3;
135
+ $[36] = t4;
136
+ $[37] = t5;
137
+ $[38] = t8;
138
+ $[39] = t9;
139
+ $[40] = t11;
140
+ } else t11 = $[40];
141
+ return t11;
142
+ }
143
+ function _temp(segment) {
144
+ return /* @__PURE__ */ jsx(DateSegment, {
145
+ segment,
146
+ className: DatePicker_module_default.segment
40
147
  });
41
148
  }
42
149
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"TimeInput.js","names":["fieldStyles","datePickerStyles"],"sources":["../../src/time-input/TimeInput.tsx"],"sourcesContent":["import {\n DateInput,\n DateSegment,\n TimeField,\n type TimeFieldProps,\n type TimeValue,\n} from 'react-aria-components';\n\nimport datePickerStyles from '../date-picker/DatePicker.module.css';\nimport {\n type FieldChromeProps,\n FieldDescription,\n FieldErrors,\n FieldLabel,\n fieldStyles,\n} from '../field/FieldParts';\nimport { cx } from '../utils/cx';\n\nexport interface TimeInputProps\n extends\n Omit<\n TimeFieldProps<TimeValue>,\n 'className' | 'style' | 'children' | 'isInvalid' | 'validate'\n >,\n FieldChromeProps {\n controlClassName?: string;\n}\n\n/** A time of day, typed segment by segment in the format of the locale. */\nexport function TimeInput({\n label,\n description,\n errors = [],\n isRequired,\n isReadOnly,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n ...props\n}: TimeInputProps) {\n return (\n <TimeField\n {...props}\n isRequired={isRequired}\n isReadOnly={isReadOnly}\n isInvalid={errors.length > 0}\n validationBehavior=\"aria\"\n className={cx('panneau-time-input', fieldStyles.field, className)}\n >\n <FieldLabel isRequired={isRequired} className={labelClassName}>\n {label}\n </FieldLabel>\n <DateInput\n className={cx(fieldStyles.control, datePickerStyles.input, controlClassName)}\n data-readonly={isReadOnly || undefined}\n >\n {(segment) => (\n <DateSegment segment={segment} className={datePickerStyles.segment} />\n )}\n </DateInput>\n <FieldDescription className={descriptionClassName}>{description}</FieldDescription>\n <FieldErrors errors={errors} className={errorsClassName} />\n </TimeField>\n );\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,UAAU,EACtB,OACA,aACA,SAAS,CAAA,GACT,YACA,YACA,WACA,gBACA,sBACA,iBACA,kBACA,GAAG,SACY;CACf,OACI,qBAAC,WAAD;EACI,GAAI;EACQ;EACA;EACZ,WAAW,OAAO,SAAS;EAC3B,oBAAmB;EACnB,WAAW,GAAG,sBAAsBA,qBAAY,OAAO,SAAS;EANpE,UAAA;GAQI,oBAAC,YAAD;IAAwB;IAAY,WAAW;IAC1C,UAAA;GACO,CAAA;GACZ,oBAAC,WAAD;IACI,WAAW,GAAGA,qBAAY,SAASC,0BAAiB,OAAO,gBAAgB;IAC3E,iBAAe,cAAc,KAAA;IAE3B,WAAA,YACE,oBAAC,aAAD;KAAsB;KAAS,WAAWA,0BAAiB;IAAQ,CAAA;GAEhE,CAAA;GACX,oBAAC,kBAAD;IAAkB,WAAW;IAAuB,UAAA;GAA8B,CAAA;GAClF,oBAAC,aAAD;IAAqB;IAAQ,WAAW;GAAgB,CAAA;EACjD;;AAEnB"}
1
+ {"version":3,"file":"TimeInput.js","names":["DateInput","DateSegment","TimeField","TimeFieldProps","TimeValue","datePickerStyles","FieldChromeProps","FieldDescription","FieldErrors","FieldLabel","fieldStyles","cx","TimeInputProps","Omit","controlClassName","TimeInput","t0","$","_c","className","description","descriptionClassName","errorsClassName","isReadOnly","isRequired","label","labelClassName","props","t1","errors","t2","undefined","t3","length","t4","field","t5","t6","control","input","t7","t8","_temp","t9","t10","t11","segment","_c","fieldStyles","datePickerStyles"],"sources":["../../src/time-input/TimeInput.tsx"],"sourcesContent":["import {\n DateInput,\n DateSegment,\n TimeField,\n type TimeFieldProps,\n type TimeValue,\n} from 'react-aria-components';\n\nimport datePickerStyles from '../date-picker/DatePicker.module.css';\nimport {\n type FieldChromeProps,\n FieldDescription,\n FieldErrors,\n FieldLabel,\n fieldStyles,\n} from '../field/FieldParts';\nimport { cx } from '../utils/cx';\n\nexport interface TimeInputProps\n extends\n Omit<\n TimeFieldProps<TimeValue>,\n 'className' | 'style' | 'children' | 'isInvalid' | 'validate'\n >,\n FieldChromeProps {\n controlClassName?: string;\n}\n\n/** A time of day, typed segment by segment in the format of the locale. */\nexport function TimeInput({\n label,\n description,\n errors = [],\n isRequired,\n isReadOnly,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n ...props\n}: TimeInputProps) {\n return (\n <TimeField\n {...props}\n isRequired={isRequired}\n isReadOnly={isReadOnly}\n isInvalid={errors.length > 0}\n validationBehavior=\"aria\"\n className={cx('panneau-time-input', fieldStyles.field, className)}\n >\n <FieldLabel isRequired={isRequired} className={labelClassName}>\n {label}\n </FieldLabel>\n <DateInput\n className={cx(fieldStyles.control, datePickerStyles.input, controlClassName)}\n data-readonly={isReadOnly || undefined}\n >\n {(segment) => (\n <DateSegment segment={segment} className={datePickerStyles.segment} />\n )}\n </DateInput>\n <Field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