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

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
package/README.md CHANGED
@@ -15,11 +15,12 @@ import { Button, PanneauRoot, TextInput, bootstrapTheme } from '@panneau/ui';
15
15
  </PanneauRoot>;
16
16
  ```
17
17
 
18
- | Export | Content |
19
- | --------------------- | ------------------------------------------------------------------------------------------------------- |
20
- | `@panneau/ui` | `PanneauRoot`, themes, the primitives, `Icon`, `getNamedIcon()`, `useToast()`, `usePanneauIntl()` |
21
- | `@panneau/ui/theme` | Themes as data, without components or CSS, for Node: `defineTheme()`, `checkTheme()`, `bootstrapTheme`… |
22
- | `@panneau/ui/locales` | Deprecated: the UI messages by locale, `en` and `fr`. Use `@panneau/intl` |
18
+ | Export | Content |
19
+ | ------------------------- | ------------------------------------------------------------------------------------------------------- |
20
+ | `@panneau/ui` | `PanneauRoot`, themes, the primitives, `Icon`, `getNamedIcon()`, `useToast()`, `usePanneauIntl()` |
21
+ | `@panneau/ui/named-icons` | `lucideIconLoader`: loads any Lucide icon by name, for `PanneauRoot`'s `iconLoader` |
22
+ | `@panneau/ui/theme` | Themes as data, without components or CSS, for Node: `defineTheme()`, `checkTheme()`, `bootstrapTheme`… |
23
+ | `@panneau/ui/locales` | Deprecated: the UI messages by locale, `en` and `fr`. Use `@panneau/intl` |
23
24
 
24
25
  ## Root, tokens and themes
25
26
 
@@ -72,7 +73,7 @@ Every component reads its own tokens, `--panneau-<component>-<token>`, which def
72
73
 
73
74
  ### Tones and appearances
74
75
 
75
- Components with a color take a `tone`, like Bootstrap's theme colors: `neutral`, `accent`, `success`, `warning`, `danger` and `info` are built in. `Button`, `Badge` and `Alert` also take an `appearance` (`solid`, `outline`, `subtle`, and `ghost` for buttons):
76
+ Components with a color take a `tone`, like Bootstrap's theme colors: `neutral`, `accent`, `success`, `warning`, `danger`, `info` and `muted` are built in. What each one means for a state (`muted` is what is over: Archived, Cancelled) is written once, in [the tones of the protocol](../../docs/protocol.md#tones): follow it, so that a user learns the colors once. `Button`, `Badge` and `Alert` also take an `appearance` (`solid`, `outline`, `subtle`, and `ghost` for buttons):
76
77
 
77
78
  ```tsx
78
79
  <Button tone="accent">Save</Button>
@@ -244,6 +245,17 @@ Charts (dashboard widgets, reports) use only the chart tokens of the theme, in b
244
245
 
245
246
  Each default categorical color reaches 3:1 against the surface (WCAG non-text contrast), and the eight stay distinct for people with protanopia, deuteranopia or tritanopia: a test checks it. `checkTheme()` runs the same checks on the chart colors a theme sets, and `checkColorDifferences(colors)` on any palette.
246
247
 
248
+ `Stat` and `LineChart` are the charts of the dashboard ([decision 0064](../../docs/decisions/0064-dashboard-widgets.md)):
249
+
250
+ ```tsx
251
+ <Stat label="Overdue" value={3} help="Since Monday" tone="danger" href="/entries?filter[late]=1" />
252
+ <LineChart label="Entries per day" points={[{ label: 'Oct 5', value: 4 }, { label: 'Oct 6', value: 8 }]} />
253
+ ```
254
+
255
+ - `Stat` shows a number for the locale (`format` takes the options of `Intl.NumberFormat`), what it counts above it and its help under it. A `tone` colors the number only when it calls for attention: the help says why.
256
+ - `LineChart` draws a line and the area under it on a categorical chart color (`color`, from 0), with the top of its scale and its first and last labels. The plot is hidden from assistive technologies, which read the values in a table.
257
+ - Both draw a skeleton of their shape while their `value` or `points` are `undefined`.
258
+
247
259
  ### Checking a theme
248
260
 
249
261
  `checkTheme(theme)` reports what a theme makes hard to read: text tokens against backgrounds (4.5:1), control borders and chart colors (3:1), the text of each tone on the surface and on its subtle background, and categorical chart colors that look alike with a color vision deficiency. The `panneau-check-theme` command runs it on a JSON theme or on an export of a module, and exits with 1 when a check fails, for CI:
@@ -287,30 +299,147 @@ Class names are stable and readable, without a hash, like Bootstrap's: target th
287
299
 
288
300
  The theme model is described in [decision 0024](../../docs/decisions/0024-theme-model.md).
289
301
 
302
+ ### Content Security Policy
303
+
304
+ Panneau runs under a strict Content Security Policy: it never needs `'unsafe-eval'` or inline scripts. For styles:
305
+
306
+ - **CSS Modules** are files of the packages, that the project's bundler serves as its other stylesheets (`style-src 'self'`).
307
+ - **Themes and fonts** are `<style>` elements (and a `<link>` for each font stylesheet) that `PanneauRoot` writes from the theme. With a policy without `'unsafe-inline'`, give them the page's nonce: `<PanneauRoot nonce={nonce}>`, or `nonce` of `<Panneau>` and `createPanneauApp()`. Without it, Panneau reads the nonce where React Aria does: `<meta property="csp-nonce" content="…">`, then `__webpack_nonce__`. The default theme writes no `<style>`.
308
+ - **React Aria** adds one `<style>` (`react-aria-pressable-style`) with the same nonce.
309
+ - **Inline `style` attributes** that components set (widths of progress bars, positions of popovers) go through the CSSOM, which `style-src` doesn't block.
310
+
311
+ ```html
312
+ <meta property="csp-nonce" content="{{ $nonce }}" />
313
+ ```
314
+
315
+ ```text
316
+ Content-Security-Policy: default-src 'self'; style-src 'self' 'nonce-{{ $nonce }}'; img-src 'self' data: https:
317
+ ```
318
+
290
319
  ## Primitives
291
320
 
292
- `Heading`, `Text`, `Prose`, `Stack`, `Inline`, `Grid`, `Container`, `Divider`, `Button`, `IconButton`, `TextInput`, `TextArea`, `NumberInput`, `Select` (single or multiple), `ComboBox`, `Checkbox`, `Switch`, `RadioGroup`, `DatePicker`, `TimeInput`, `Fieldset`, `Dialog`, `Popover`, `Menu`, `Tabs`, `Tooltip`, toasts (`useToast()`), `Alert`, `Badge`, `Spinner`, `Card`, `Disclosure` and `Icon`.
321
+ `Heading`, `Text`, `Prose`, `Stack`, `Inline`, `Grid`, `Container`, `Divider`, `Button`, `IconButton`, `TextInput`, `TextArea`, `NumberInput`, `Slider`, `TagsInput`, `Select` (single or multiple), `ComboBox`, `Checkbox`, `Switch`, `RadioGroup`, `SegmentedControl`, `DatePicker`, `TimeInput`, `Fieldset`, `Dialog`, `Popover`, `Menu`, `PillTrigger`, `Tabs`, `Tooltip`, toasts (`useToast()`), `Alert`, `Badge`, `Spinner`, `Skeleton`, `LoadingRegion`, `Card`, `Disclosure` and `Icon`.
293
322
 
294
323
  - Every component accepts `className`, and `xxxClassName` props for its inner elements (`labelClassName`, `inputClassName`…).
295
324
  - Labelled controls take `label`, `description` and `errors` (a list of messages: any message makes the control invalid and describes it).
296
- - They work on phones: larger touch targets on touch screens, dialogs as bottom sheets, scrolling tabs.
325
+ - They work on phones: larger touch targets on touch screens, dialogs as bottom sheets (or the whole screen, with `fullScreenOnPhone`), scrolling tabs.
326
+
327
+ ### Rich choices
328
+
329
+ Picking one item among a few rich ones, such as an account (an avatar, a name, a handle), a plan or a template, takes a menu or radio cards.
330
+
331
+ - **`Menu`** groups its items in `MenuSection`s, whose `title` is a small muted eyebrow that labels the group, and takes a `footer`: a short note under the items, after a line, which describes the menu and can't be focused. With `selectionMode` (`single` or `multiple`) and `selectedKeys`, its items are radio or checkbox items, and the selected ones have a check at their end and a sunken background.
332
+ - **`MenuItem`** takes a leading `media` (an avatar or an image) instead of an `icon`: larger when the item has a `description`, and clipped to a circle by default (`--panneau-menu-media-radius`).
333
+ - **`PillTrigger`** is a compact rounded button that shows the current value, with an optional leading `media` and a chevron, for a `MenuTrigger` or a `PopoverTrigger`. Its accessible name is its value: give it an `aria-label` that contains the value when the value alone doesn't say what it picks.
334
+
335
+ ```tsx
336
+ <MenuTrigger>
337
+ <PillTrigger size="sm" media={<Avatar user={account} />}>
338
+ {account.name}
339
+ </PillTrigger>
340
+ <Menu
341
+ aria-label="Accounts"
342
+ selectionMode="single"
343
+ selectedKeys={[account.id]}
344
+ onSelectionChange={(keys) => keys !== 'all' && onChange([...keys][0])}
345
+ footer="Only this step changes."
346
+ >
347
+ <MenuSection title="Publish on">
348
+ {accounts.map((item) => (
349
+ <MenuItem
350
+ key={item.id}
351
+ id={item.id}
352
+ media={<Avatar user={item} />}
353
+ description={item.handle}
354
+ >
355
+ {item.name}
356
+ </MenuItem>
357
+ ))}
358
+ </MenuSection>
359
+ </Menu>
360
+ </MenuTrigger>
361
+ ```
362
+
363
+ - **`RadioGroup`** with `appearance="cards"` shows its options as bordered cards in a grid of `columns` (2 by default): each card has the radio, the option's `media`, its label and its description, and the selected card has a stronger border. The grid is a size container of its own, and becomes a single column when it is narrower than 28rem. Keyboard and focus work as in a list of radios.
364
+
365
+ ```tsx
366
+ <RadioGroup
367
+ label="Publish on"
368
+ appearance="cards"
369
+ options={accounts.map((item) => ({
370
+ value: item.id,
371
+ label: item.name,
372
+ description: item.handle,
373
+ media: <Avatar user={item} />,
374
+ }))}
375
+ value={accountId}
376
+ onChange={setAccountId}
377
+ />
378
+ ```
379
+
380
+ ### Loading
381
+
382
+ Content that loads shows a skeleton of its shape, never a spinner in its place ([decision 0034](../../docs/decisions/0034-skeletons-while-content-loads.md)). Spinners are for operations in progress (`Button` `isPending`) and lookups inside a control (`ComboBox` `isLoading`).
383
+
384
+ - `Skeleton` is a block of the shape to come: a line of text (`lines` for several, the last one shorter), a `rect` with a `width`, a `height` or an `aspectRatio`, or a `circle`. It is `aria-hidden`, pulses unless the user prefers reduced motion, and reads the `skeleton` component tokens (`color`, `radius`, `duration`).
385
+ - `LoadingRegion` goes around the skeleton, in place of the content: it has `aria-busy="true"`, and a status message says once that the content loads (`label`, "Loading…" by default).
386
+
387
+ ```tsx
388
+ function ArticleCard({ article }: { article: Article | undefined }) {
389
+ if (article === undefined) {
390
+ return (
391
+ <LoadingRegion label="Loading the article…">
392
+ <Skeleton shape="rect" aspectRatio="16 / 9" />
393
+ <Skeleton lines={3} />
394
+ </LoadingRegion>
395
+ );
396
+ }
397
+ return <ArticleView article={article} />;
398
+ }
399
+ ```
400
+
401
+ A skeleton never replaces content already shown: while it is fetched again, it stays, dimmed, with `aria-busy`, as in lists.
402
+
403
+ ### Toasts
404
+
405
+ `useToast().show(content, options)` shows a toast in the region of the closest `PanneauRoot` ([decision 0062](../../docs/decisions/0062-toasts.md)):
406
+
407
+ ```tsx
408
+ const toasts = useToast();
409
+ toasts.show(
410
+ { title: '3 entries archived', tone: 'success', action: { label: 'Undo', onAction: undo } },
411
+ { key: 'archive' },
412
+ );
413
+ ```
414
+
415
+ - **Only when the page doesn't already say it.** A toast for what happened out of sight (a run that finished, a change made from a menu), for what can be undone, and for an error that has no place in the page (the network, a logout that failed). No toast where the page shows the result: a form says "Saved" in its footer, an error of a field stays on it, and a run that starts shows in the runs button of the shell.
416
+ - **Name the thing, and offer the next step**: what was done to what ("“Spring contest” saved", "3 entries archived"), and an `action` that leads to the result ("Open", "Download") or undoes it ("Undo").
417
+ - **One per thing**: a toast with the `key` of one already shown replaces it. At most three show at once; the older ones fold behind the newest and unfold on hover or focus.
418
+ - **Timeouts that match what the toast holds** (`getToastTimeout()`): about 5 seconds, longer for a longer text, about 10 seconds with an action, none for an error (`danger`). Timers pause while the region is hovered or focused. `timeout` sets another, `null` none.
419
+ - **Quiet**: a success has the neutral look with its icon; only warnings and errors color the edge.
420
+ - **At the bottom, centered**, above what sticks to the bottom of the page: such an element calls `useToastOffset(ref)`, as the footer of a form does. `PanneauRoot`'s `toastPlacement` puts them at `bottom-end` or `top-end` instead. On a phone, they take the whole width.
297
421
 
298
422
  ## Icons
299
423
 
300
424
  Components take icons as components: any Lucide icon (`icon={Pencil}`), or a component with the same props.
301
425
 
302
- Definitions name their icons (`"icon": "send"`, a name of [lucide.dev/icons](https://lucide.dev/icons)). `getNamedIcon(name)` turns a name into an icon component that goes wherever an icon component goes:
426
+ Definitions name their icons (`"icon": "send"`, a name of [lucide.dev/icons](https://lucide.dev/icons)). `getNamedIcon(name)` turns a name into an icon component that goes wherever an icon component goes, and loads it with the `iconLoader` of `PanneauRoot`:
303
427
 
304
428
  ```tsx
305
- import { Button, getNamedIcon } from '@panneau/ui';
429
+ import { Button, PanneauRoot, getNamedIcon } from '@panneau/ui';
430
+ import { lucideIconLoader } from '@panneau/ui/named-icons';
306
431
 
307
- <Button icon={getNamedIcon('send')}>Send</Button>;
432
+ <PanneauRoot iconLoader={lucideIconLoader}>
433
+ <Button icon={getNamedIcon('send')}>Send</Button>
434
+ </PanneauRoot>;
308
435
  ```
309
436
 
310
- - It loads that one icon the first time it renders, through Lucide's dynamic imports, and renders an empty space of the same size until then. The list of names is loaded on demand too: the whole set is never in the bundle, but bundlers emit one small chunk per icon.
311
- - It returns the same component for the same name. A name Lucide doesn't have renders nothing, with a warning in the console.
312
- - `loadNamedIcon(name)` loads an icon ahead of time, and resolves with its component (or `null`).
313
- - **Vite apps, in development:** add `optimizeDeps: { exclude: ['lucide-react/dynamicIconImports.mjs'] }` to the Vite config. When Vite optimizes it together with `lucide-react`, it splits `lucide-react` into one chunk per icon (about 1,900 requests on every page load). Production builds are not affected.
437
+ - **Loading icons by name is opt-in.** `lucideIconLoader` loads any Lucide icon, one chunk per icon the first time it renders, but bundlers emit a chunk for every Lucide icon (about 1,900) and the map of them in the runtime of every page. So it lives in its own entry point, `@panneau/ui/named-icons`: apps that only pass icon components (`icon={Send}`, `actionIcons`) don't pay for it.
438
+ - An app can instead load only the icons its definitions use: `iconLoader={(name) => Promise.resolve(({ send: Send, archive: Archive })[name] ?? null)}`.
439
+ - Without a loader, a named icon renders an empty space of the same size, with one warning in the console.
440
+ - `getNamedIcon()` returns the same component for the same name, renders an empty space while the icon loads, and nothing for a name the loader doesn't know (with a warning).
441
+ - `loadNamedIcon(name, loader)` loads an icon ahead of time, and resolves with its component (or `null`).
442
+ - **Vite apps, in development:** with `lucideIconLoader`, add `optimizeDeps: { exclude: ['lucide-react/dynamicIconImports.mjs'] }` to the Vite config. When Vite optimizes it together with `lucide-react`, it splits `lucide-react` into one chunk per icon (about 1,900 requests on every page load). Production builds are not affected.
314
443
 
315
444
  ## Messages
316
445
 
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode, Ref } from 'react';
2
- import { type IconComponent } from '../icon/Icon';
3
- import type { Tone } from '../theme/tones';
2
+ import { type IconComponent } from '../icon/Icon.js';
3
+ import type { Tone } from '../theme/tones.js';
4
4
  /** @deprecated Use `Tone`. */
5
5
  export type AlertTone = Tone;
6
6
  /** How an alert uses its tone. */
@@ -5,6 +5,7 @@ import { usePanneauIntl } from "../intl/usePanneauIntl.js";
5
5
  import { toneClass } from "../theme/toneClass.js";
6
6
  import { IconButton } from "../icon-button/IconButton.js";
7
7
  import Alert_module_default from "./Alert.module.js";
8
+ import { c } from "react/compiler-runtime";
8
9
  import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from "lucide-react";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  //#region src/alert/Alert.tsx
@@ -16,48 +17,115 @@ var TONE_ICONS = {
16
17
  info: Info
17
18
  };
18
19
  /** A message inside the page: an error summary, a warning, a confirmation. */
19
- function Alert({ tone = "neutral", appearance = "subtle", variant, title, children, icon, actions, onDismiss, role, id, tabIndex, ref, className, titleClassName, bodyClassName }) {
20
+ function Alert(t0) {
21
+ const $ = c(31);
22
+ const { tone: t1, appearance: t2, variant, title, children, icon, actions, onDismiss, role, id, tabIndex, ref, className, titleClassName, bodyClassName } = t0;
23
+ const tone = t1 === void 0 ? "neutral" : t1;
24
+ const appearance = t2 === void 0 ? "subtle" : t2;
20
25
  const intl = usePanneauIntl();
21
26
  const shown = icon === void 0 ? TONE_ICONS[tone] ?? Info : icon;
22
- return /* @__PURE__ */ jsxs("div", {
23
- ref,
24
- id,
25
- role,
26
- tabIndex,
27
- className: cx("panneau-alert", Alert_module_default.alert, toneClass(tone), Alert_module_default[appearance], variant !== void 0 && `panneau-alert-variant-${variant}`, className),
28
- children: [
29
- shown !== null ? /* @__PURE__ */ jsx(Icon, {
30
- icon: shown,
31
- size: "lg",
32
- className: Alert_module_default.icon
33
- }) : null,
34
- /* @__PURE__ */ jsxs("div", {
35
- className: Alert_module_default.content,
36
- children: [
37
- title !== void 0 && title !== null ? /* @__PURE__ */ jsx("div", {
38
- className: cx(Alert_module_default.title, titleClassName),
39
- children: title
40
- }) : null,
41
- children !== void 0 && children !== null ? /* @__PURE__ */ jsx("div", {
42
- className: cx(Alert_module_default.body, bodyClassName),
43
- children
44
- }) : null,
45
- actions !== void 0 && actions !== null ? /* @__PURE__ */ jsx("div", {
46
- className: Alert_module_default.actions,
47
- children: actions
48
- }) : null
49
- ]
50
- }),
51
- onDismiss !== void 0 ? /* @__PURE__ */ jsx(IconButton, {
52
- icon: X,
53
- size: "sm",
54
- label: intl.formatMessage(messages.close),
55
- showTooltip: false,
56
- onPress: onDismiss,
57
- className: Alert_module_default.dismiss
58
- }) : null
59
- ]
60
- });
27
+ let t3;
28
+ if ($[0] !== appearance || $[1] !== className || $[2] !== tone || $[3] !== variant) {
29
+ t3 = cx("panneau-alert", Alert_module_default.alert, toneClass(tone), Alert_module_default[appearance], variant !== void 0 && `panneau-alert-variant-${variant}`, className);
30
+ $[0] = appearance;
31
+ $[1] = className;
32
+ $[2] = tone;
33
+ $[3] = variant;
34
+ $[4] = t3;
35
+ } else t3 = $[4];
36
+ let t4;
37
+ if ($[5] !== shown) {
38
+ t4 = shown !== null ? /* @__PURE__ */ jsx(Icon, {
39
+ icon: shown,
40
+ size: "lg",
41
+ className: Alert_module_default.icon
42
+ }) : null;
43
+ $[5] = shown;
44
+ $[6] = t4;
45
+ } else t4 = $[6];
46
+ let t5;
47
+ if ($[7] !== title || $[8] !== titleClassName) {
48
+ t5 = title !== void 0 && title !== null ? /* @__PURE__ */ jsx("div", {
49
+ className: cx(Alert_module_default.title, titleClassName),
50
+ children: title
51
+ }) : null;
52
+ $[7] = title;
53
+ $[8] = titleClassName;
54
+ $[9] = t5;
55
+ } else t5 = $[9];
56
+ let t6;
57
+ if ($[10] !== bodyClassName || $[11] !== children) {
58
+ t6 = children !== void 0 && children !== null ? /* @__PURE__ */ jsx("div", {
59
+ className: cx(Alert_module_default.body, bodyClassName),
60
+ children
61
+ }) : null;
62
+ $[10] = bodyClassName;
63
+ $[11] = children;
64
+ $[12] = t6;
65
+ } else t6 = $[12];
66
+ let t7;
67
+ if ($[13] !== actions) {
68
+ t7 = actions !== void 0 && actions !== null ? /* @__PURE__ */ jsx("div", {
69
+ className: Alert_module_default.actions,
70
+ children: actions
71
+ }) : null;
72
+ $[13] = actions;
73
+ $[14] = t7;
74
+ } else t7 = $[14];
75
+ let t8;
76
+ if ($[15] !== t5 || $[16] !== t6 || $[17] !== t7) {
77
+ t8 = /* @__PURE__ */ jsxs("div", {
78
+ className: Alert_module_default.content,
79
+ children: [
80
+ t5,
81
+ t6,
82
+ t7
83
+ ]
84
+ });
85
+ $[15] = t5;
86
+ $[16] = t6;
87
+ $[17] = t7;
88
+ $[18] = t8;
89
+ } else t8 = $[18];
90
+ let t9;
91
+ if ($[19] !== intl || $[20] !== onDismiss) {
92
+ t9 = onDismiss !== void 0 ? /* @__PURE__ */ jsx(IconButton, {
93
+ icon: X,
94
+ size: "sm",
95
+ label: intl.formatMessage(messages.close),
96
+ showTooltip: false,
97
+ onPress: onDismiss,
98
+ className: Alert_module_default.dismiss
99
+ }) : null;
100
+ $[19] = intl;
101
+ $[20] = onDismiss;
102
+ $[21] = t9;
103
+ } else t9 = $[21];
104
+ let t10;
105
+ if ($[22] !== id || $[23] !== ref || $[24] !== role || $[25] !== t3 || $[26] !== t4 || $[27] !== t8 || $[28] !== t9 || $[29] !== tabIndex) {
106
+ t10 = /* @__PURE__ */ jsxs("div", {
107
+ ref,
108
+ id,
109
+ role,
110
+ tabIndex,
111
+ className: t3,
112
+ children: [
113
+ t4,
114
+ t8,
115
+ t9
116
+ ]
117
+ });
118
+ $[22] = id;
119
+ $[23] = ref;
120
+ $[24] = role;
121
+ $[25] = t3;
122
+ $[26] = t4;
123
+ $[27] = t8;
124
+ $[28] = t9;
125
+ $[29] = tabIndex;
126
+ $[30] = t10;
127
+ } else t10 = $[30];
128
+ return t10;
61
129
  }
62
130
  //#endregion
63
131
  export { Alert };
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","names":["styles"],"sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from 'lucide-react';\nimport type { ReactNode, Ref } from 'react';\n\nimport { IconButton } from '../icon-button/IconButton';\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Alert.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type AlertTone = Tone;\n\n/** How an alert uses its tone. */\nexport type AlertAppearance = 'subtle' | 'outline' | 'solid';\n\n/**\n * Named variants of `Alert`, registered by a theme (`components.alert.variants`). Declare them\n * here so that `variant=\"banner\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface AlertVariants {}\n\nconst TONE_ICONS: Partial<Record<Tone, IconComponent>> = {\n neutral: Info,\n success: CircleCheck,\n danger: CircleAlert,\n warning: TriangleAlert,\n info: Info,\n};\n\nexport interface AlertProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: AlertAppearance;\n /** A named variant of the theme. */\n variant?: keyof AlertVariants & string;\n title?: ReactNode;\n children?: ReactNode;\n /** Replaces the icon of the tone (an info icon for tones added by a theme). `null` hides it. */\n icon?: IconComponent | null;\n /** Buttons under the message. */\n actions?: ReactNode;\n /** Shows a close button. */\n onDismiss?: () => void;\n /**\n * `alert` announces the message as soon as it appears, for errors that need attention.\n * `status` announces it politely. Without a role, it is only read in place.\n */\n role?: 'alert' | 'status';\n id?: string;\n /** Makes the alert focusable, to move focus to it (an error summary). */\n tabIndex?: number;\n ref?: Ref<HTMLDivElement>;\n className?: string;\n titleClassName?: string;\n bodyClassName?: string;\n}\n\n/** A message inside the page: an error summary, a warning, a confirmation. */\nexport function Alert({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n title,\n children,\n icon,\n actions,\n onDismiss,\n role,\n id,\n tabIndex,\n ref,\n className,\n titleClassName,\n bodyClassName,\n}: AlertProps) {\n const intl = usePanneauIntl();\n const shown = icon === undefined ? (TONE_ICONS[tone] ?? Info) : icon;\n return (\n <div\n ref={ref}\n id={id}\n role={role}\n tabIndex={tabIndex}\n className={cx(\n 'panneau-alert',\n styles.alert,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-alert-variant-${variant}`,\n className,\n )}\n >\n {shown !== null ? <Icon icon={shown} size=\"lg\" className={styles.icon} /> : null}\n <div className={styles.content}>\n {title !== undefined && title !== null ? (\n <div className={cx(styles.title, titleClassName)}>{title}</div>\n ) : null}\n {children !== undefined && children !== null ? (\n <div className={cx(styles.body, bodyClassName)}>{children}</div>\n ) : null}\n {actions !== undefined && actions !== null ? (\n <div className={styles.actions}>{actions}</div>\n ) : null}\n </div>\n {onDismiss !== undefined ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={intl.formatMessage(messages.close)}\n showTooltip={false}\n onPress={onDismiss}\n className={styles.dismiss}\n />\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAyBA,IAAM,aAAmD;CACrD,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,MAAM;AACV;;AAgCA,SAAgB,MAAM,EAClB,OAAO,WACP,aAAa,UACb,SACA,OACA,UACA,MACA,SACA,WACA,MACA,IACA,UACA,KACA,WACA,gBACA,iBACW;CACX,MAAM,OAAO,eAAe;CAC5B,MAAM,QAAQ,SAAS,KAAA,IAAa,WAAW,SAAS,OAAQ;CAChE,OACI,qBAAC,OAAD;EACS;EACD;EACE;EACI;EACV,WAAW,GACP,iBACAA,qBAAO,OACP,UAAU,IAAI,GACdA,qBAAO,aACP,YAAY,KAAA,KAAa,yBAAyB,WAClD,SACJ;EAZJ,UAAA;GAcK,UAAU,OAAO,oBAAC,MAAD;IAAM,MAAM;IAAO,MAAK;IAAK,WAAWA,qBAAO;GAAK,CAAA,IAAM;GAC5E,qBAAC,OAAD;IAAK,WAAWA,qBAAO;IAAvB,UAAA;KACK,UAAU,KAAA,KAAa,UAAU,OAC9B,oBAAC,OAAD;MAAK,WAAW,GAAGA,qBAAO,OAAO,cAAc;MAAI,UAAA;KAAW,CAAA,IAC9D;KACH,aAAa,KAAA,KAAa,aAAa,OACpC,oBAAC,OAAD;MAAK,WAAW,GAAGA,qBAAO,MAAM,aAAa;MAAI;KAAc,CAAA,IAC/D;KACH,YAAY,KAAA,KAAa,YAAY,OAClC,oBAAC,OAAD;MAAK,WAAWA,qBAAO;MAAU,UAAA;KAAa,CAAA,IAC9C;IACH;;GACJ,cAAc,KAAA,IACX,oBAAC,YAAD;IACI,MAAM;IACN,MAAK;IACL,OAAO,KAAK,cAAc,SAAS,KAAK;IACxC,aAAa;IACb,SAAS;IACT,WAAWA,qBAAO;GAAQ,CAAA,IAE9B;EACH;;AAEb"}
1
+ {"version":3,"file":"Alert.js","names":["CircleAlert","CircleCheck","Info","TriangleAlert","X","ReactNode","Ref","IconButton","Icon","IconComponent","messages","usePanneauIntl","toneClass","Tone","cx","styles","AlertTone","AlertAppearance","AlertVariants","TONE_ICONS","Partial","Record","neutral","success","danger","warning","info","AlertProps","tone","appearance","variant","title","children","icon","actions","onDismiss","role","id","tabIndex","ref","HTMLDivElement","className","titleClassName","bodyClassName","Alert","t0","$","_c","t1","t2","undefined","intl","shown","t3","alert","t4","t5","t6","body","t7","t8","content","t9","formatMessage","close","dismiss","t10","_c","styles"],"sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from 'lucide-react';\nimport type { ReactNode, Ref } from 'react';\n\nimport { IconButton } from '../icon-button/IconButton';\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Alert.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type AlertTone = Tone;\n\n/** How an alert uses its tone. */\nexport type AlertAppearance = 'subtle' | 'outline' | 'solid';\n\n/**\n * Named variants of `Alert`, registered by a theme (`components.alert.variants`). Declare them\n * here so that `variant=\"banner\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface AlertVariants {}\n\nconst TONE_ICONS: Partial<Record<Tone, IconComponent>> = {\n neutral: Info,\n success: CircleCheck,\n danger: CircleAlert,\n warning: TriangleAlert,\n info: Info,\n};\n\nexport interface AlertProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: AlertAppearance;\n /** A named variant of the theme. */\n variant?: keyof AlertVariants & string;\n title?: ReactNode;\n children?: ReactNode;\n /** Replaces the icon of the tone (an info icon for tones added by a theme). `null` hides it. */\n icon?: IconComponent | null;\n /** Buttons under the message. */\n actions?: ReactNode;\n /** Shows a close button. */\n onDismiss?: () => void;\n /**\n * `alert` announces the message as soon as it appears, for errors that need attention.\n * `status` announces it politely. Without a role, it is only read in place.\n */\n role?: 'alert' | 'status';\n id?: string;\n /** Makes the alert focusable, to move focus to it (an error summary). */\n tabIndex?: number;\n ref?: Ref<HTMLDivElement>;\n className?: string;\n titleClassName?: string;\n bodyClassName?: string;\n}\n\n/** A message inside the page: an error summary, a warning, a confirmation. */\nexport function Alert({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n title,\n children,\n icon,\n actions,\n onDismiss,\n role,\n id,\n tabIndex,\n ref,\n className,\n titleClassName,\n bodyClassName,\n}: AlertProps) {\n const intl = usePanneauIntl();\n const shown = icon === undefined ? (TONE_ICONS[tone] ?? Info) : icon;\n return (\n <div\n ref={ref}\n id={id}\n role={role}\n tabIndex={tabIndex}\n className={cx(\n 'panneau-alert',\n styles.alert,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-alert-variant-${variant}`,\n className,\n )}\n >\n {shown !== null ? <Icon icon={shown} size=\"lg\" className={styles.icon} /> : null}\n <div className={styles.content}>\n {title !== undefined && title !== null ? (\n <div className={cx(styles.title, titleClassName)}>{title}</div>\n ) : null}\n {children !== undefined && children !== null ? (\n <div className={cx(styles.body, bodyClassName)}>{children}</div>\n ) : null}\n {actions !== undefined && actions !== null ? (\n <div className={styles.actions}>{actions}</div>\n ) : null}\n </div>\n {onDismiss !== undefined ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={intl.formatMessage(messages.close)}\n showTooltip={false}\n onPress={onDismiss}\n className={styles.dismiss}\n />\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAyBA,IAAMmB,aAAmD;CACrDG,SAASpB;CACTqB,SAAStB;CACTuB,QAAQxB;CACRyB,SAAStB;CACTuB,MAAMxB;AACV;;AAgCA,SAAO0C,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAnB,MAAAoB,IAAAnB,YAAAoB,IAAAnB,SAAAC,OAAAC,UAAAC,MAAAC,SAAAC,WAAAC,MAAAC,IAAAC,UAAAC,KAAAE,WAAAC,gBAAAC,kBAAAE;CAClB,MAAAjB,OAAAoB,OAAAE,KAAAA,IAAA,YAAAF;CACA,MAAAnB,aAAAoB,OAAAC,KAAAA,IAAA,WAAAD;CAeA,MAAAE,OAAaxC,eAAe;CAC5B,MAAAyC,QAAcnB,SAASiB,KAAAA,IAAa/B,WAAWS,SAAX1B,OAAtB+B;CAAuD,IAAAoB;CAAA,IAAAP,EAAA,OAAAjB,cAAAiB,EAAA,OAAAL,aAAAK,EAAA,OAAAlB,QAAAkB,EAAA,OAAAhB,SAAA;EAOlDuB,KAAAvC,GACP,iBACAC,qBAAMuC,OACN1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  /** Tokens of Alert. */
2
- export declare const alertTokens: import("..").ComponentTokens<"alert", "panneau-alert-radius" | "panneau-alert-gap" | "panneau-alert-padding-y" | "panneau-alert-padding-x" | "panneau-alert-border-width" | "panneau-alert-title-font-weight">;
2
+ export declare const alertTokens: import("../index.js").ComponentTokens<"alert", "panneau-alert-radius" | "panneau-alert-gap" | "panneau-alert-padding-y" | "panneau-alert-padding-x" | "panneau-alert-border-width" | "panneau-alert-title-font-weight">;
3
3
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","names":[],"sources":["../../src/alert/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Alert. */\nexport const alertTokens = defineComponentTokens('alert', {\n /** Space between the icon, the content and the dismiss button. */\n gap: 'var(--panneau-space-3)',\n /** Vertical padding. */\n 'padding-y': 'var(--panneau-space-3)',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-4)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius. */\n radius: 'var(--panneau-radius-md)',\n /** Font weight of the title. */\n 'title-font-weight': 'var(--panneau-font-weight-bold)',\n});\n"],"mappings":";;;AAGA,IAAa,cAAc,sBAAsB,SAAS;;CAEtD,KAAK;;CAEL,aAAa;;CAEb,aAAa;;CAEb,gBAAgB;;CAEhB,QAAQ;;CAER,qBAAqB;AACzB,CAAC"}
1
+ {"version":3,"file":"tokens.js","names":["defineComponentTokens","alertTokens","gap","radius"],"sources":["../../src/alert/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Alert. */\nexport const alertTokens = defineComponentTokens('alert', {\n /** Space between the icon, the content and the dismiss button. */\n gap: 'var(--panneau-space-3)',\n /** Vertical padding. */\n 'padding-y': 'var(--panneau-space-3)',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-4)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius. */\n radius: 'var(--panneau-radius-md)',\n /** Font weight of the title. */\n 'title-font-weight': 'var(--panneau-font-weight-bold)',\n});\n"],"mappings":";;;AAGA,IAAaC,cAAcD,sBAAsB,SAAS;;CAEtDE,KAAK;;CAEL,aAAa;;CAEb,aAAa;;CAEb,gBAAgB;;CAEhBC,QAAQ;;CAER,qBAAqB;AACzB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { Tone } from '../theme/tones';
2
+ import type { Tone } from '../theme/tones.js';
3
3
  /** @deprecated Use `Tone`. */
4
4
  export type BadgeTone = Tone;
5
5
  /** How a badge uses its tone. */
@@ -1,20 +1,48 @@
1
1
  import { cx } from "../utils/cx.js";
2
2
  import { toneClass } from "../theme/toneClass.js";
3
3
  import Badge_module_default from "./Badge.module.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
6
  //#region src/badge/Badge.tsx
6
7
  /** A short status or a count. */
7
- function Badge({ tone = "neutral", appearance = "subtle", variant, children, label, className }) {
8
- return /* @__PURE__ */ jsx("span", {
9
- className: cx("panneau-badge", Badge_module_default.badge, toneClass(tone), Badge_module_default[appearance], variant !== void 0 && `panneau-badge-variant-${variant}`, className),
10
- children: label !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
8
+ function Badge(t0) {
9
+ const $ = c(11);
10
+ const { tone: t1, appearance: t2, variant, children, label, className } = t0;
11
+ const tone = t1 === void 0 ? "neutral" : t1;
12
+ const appearance = t2 === void 0 ? "subtle" : t2;
13
+ let t3;
14
+ if ($[0] !== appearance || $[1] !== className || $[2] !== tone || $[3] !== variant) {
15
+ t3 = cx("panneau-badge", Badge_module_default.badge, toneClass(tone), Badge_module_default[appearance], variant !== void 0 && `panneau-badge-variant-${variant}`, className);
16
+ $[0] = appearance;
17
+ $[1] = className;
18
+ $[2] = tone;
19
+ $[3] = variant;
20
+ $[4] = t3;
21
+ } else t3 = $[4];
22
+ let t4;
23
+ if ($[5] !== children || $[6] !== label) {
24
+ t4 = label !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
11
25
  "aria-hidden": "true",
12
26
  children
13
27
  }), /* @__PURE__ */ jsx("span", {
14
28
  className: Badge_module_default.visuallyHidden,
15
29
  children: label
16
- })] }) : children
17
- });
30
+ })] }) : children;
31
+ $[5] = children;
32
+ $[6] = label;
33
+ $[7] = t4;
34
+ } else t4 = $[7];
35
+ let t5;
36
+ if ($[8] !== t3 || $[9] !== t4) {
37
+ t5 = /* @__PURE__ */ jsx("span", {
38
+ className: t3,
39
+ children: t4
40
+ });
41
+ $[8] = t3;
42
+ $[9] = t4;
43
+ $[10] = t5;
44
+ } else t5 = $[10];
45
+ return t5;
18
46
  }
19
47
  //#endregion
20
48
  export { Badge };
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":["styles","_Fragment"],"sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Badge.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type BadgeTone = Tone;\n\n/** How a badge uses its tone. */\nexport type BadgeAppearance = 'subtle' | 'solid' | 'outline';\n\n/**\n * Named variants of `Badge`, registered by a theme (`components.badge.variants`). Declare them\n * here so that `variant=\"tag\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface BadgeVariants {}\n\nexport interface BadgeProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: BadgeAppearance;\n /** A named variant of the theme. */\n variant?: keyof BadgeVariants & string;\n children?: ReactNode;\n /**\n * Accessible text, when the visible content isn't enough on its own (a count of errors: \"2\n * errors\"). The visible content is then hidden from assistive technologies.\n */\n label?: string;\n className?: string;\n}\n\n/** A short status or a count. */\nexport function Badge({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n children,\n label,\n className,\n}: BadgeProps) {\n return (\n <span\n className={cx(\n 'panneau-badge',\n styles.badge,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-badge-variant-${variant}`,\n className,\n )}\n >\n {label !== undefined ? (\n <>\n <span aria-hidden=\"true\">{children}</span>\n <span className={styles.visuallyHidden}>{label}</span>\n </>\n ) : (\n children\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;AAqCA,SAAgB,MAAM,EAClB,OAAO,WACP,aAAa,UACb,SACA,UACA,OACA,aACW;CACX,OACI,oBAAC,QAAD;EACI,WAAW,GACP,iBACAA,qBAAO,OACP,UAAU,IAAI,GACdA,qBAAO,aACP,YAAY,KAAA,KAAa,yBAAyB,WAClD,SACJ;EAEC,UAAA,UAAU,KAAA,IACP,qBAAAC,UAAA,EAAA,UAAA,CACI,oBAAC,QAAD;GAAM,eAAY;GAAQ;EAAe,CAAA,GACzC,oBAAC,QAAD;GAAM,WAAWD,qBAAO;GAAiB,UAAA;EAAY,CAAA,CACzD,EAAA,CAAA,IAEA;CAEF,CAAA;AAEd"}
1
+ {"version":3,"file":"Badge.js","names":["ReactNode","toneClass","Tone","cx","styles","BadgeTone","BadgeAppearance","BadgeVariants","BadgeProps","tone","appearance","variant","children","label","className","Badge","t0","$","_c","t1","t2","undefined","t3","badge","t4","visuallyHidden","t5","_c","styles","_Fragment"],"sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Badge.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type BadgeTone = Tone;\n\n/** How a badge uses its tone. */\nexport type BadgeAppearance = 'subtle' | 'solid' | 'outline';\n\n/**\n * Named variants of `Badge`, registered by a theme (`components.badge.variants`). Declare them\n * here so that `variant=\"tag\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface BadgeVariants {}\n\nexport interface BadgeProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: BadgeAppearance;\n /** A named variant of the theme. */\n variant?: keyof BadgeVariants & string;\n children?: ReactNode;\n /**\n * Accessible text, when the visible content isn't enough on its own (a count of errors: \"2\n * errors\"). The visible content is then hidden from assistive technologies.\n */\n label?: string;\n className?: string;\n}\n\n/** A short status or a count. */\nexport function Badge({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n children,\n label,\n className,\n}: BadgeProps) {\n return (\n <span\n className={cx(\n 'panneau-badge',\n styles.badge,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-badge-variant-${variant}`,\n className,\n )}\n >\n {label !== undefined ? (\n <>\n <span aria-hidden=\"true\">{children}</span>\n <span className={styles.visuallyHidden}>{label}</span>\n </>\n ) : (\n children\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;;AAqCA,SAAOe,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAT,MAAAU,IAAAT,YAAAU,IAAAT,SAAAC,UAAAC,OAAAC,cAAAE;CAClB,MAAAP,OAAAU,OAAAE,KAAAA,IAAA,YAAAF;CACA,MAAAT,aAAAU,OAAAC,KAAAA,IAAA,WAAAD;CAAqB,IAAAE;CAAA,IAAAL,EAAA,OAAAP,cAAAO,EAAA,OAAAH,aAAAG,EAAA,OAAAR,QAAAQ,EAAA,OAAAN,SAAA;EAQFW,KAAAnB,GACP,iBACAC,qBAAMmB,OACNtB,UAAUQ,IAAI,GACdL,qBAAOM,aACPC,YAAYU,KAAAA,KAAZ,yBAAkDV,WAClDG,SACJ;EAACG,EAAA,KAAAP;EAAAO,EAAA,KAAAH;EAAAG,EAAA,KAAAR;EAAAQ,EAAA,KAAAN;EAAAM,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAL,YAAAK,EAAA,OAAAJ,OAAA;EAEAW,KAAAX,UAAUQ,KAAAA,IAAV,qBAAAQ,UAAA,EAAA,UAAA,CAEO,oBAAA,QAAA;GAAkB,eAAA;GAAQjB;EAAgB,CAAA,GAC1C,oBAAA,QAAA;GAAiB,WAAAR,qBAAMqB;GAAkBZ,UAAAA;EAAa,CAAA,CAAA,EAAA,CAAA,IAH7DD;EAOAK,EAAA,KAAAL;EAAAK,EAAA,KAAAJ;EAAAI,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,OAAAK,MAAAL,EAAA,OAAAO,IAAA;EAjBLE,KAAA,oBAAA,QAAA;GACe,WAAAJ;GASVE,UAAAA;EAQE,CAAA;EAAAP,EAAA,KAAAK;EAAAL,EAAA,KAAAO;EAAAP,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAlBPS;AAkBO"}
@@ -1,3 +1,3 @@
1
1
  /** Tokens of Badge. */
2
- export declare const badgeTokens: import("..").ComponentTokens<"badge", "panneau-badge-height" | "panneau-badge-radius" | "panneau-badge-gap" | "panneau-badge-padding-x" | "panneau-badge-border-width" | "panneau-badge-font-size" | "panneau-badge-font-weight">;
2
+ export declare const badgeTokens: import("../index.js").ComponentTokens<"badge", "panneau-badge-height" | "panneau-badge-radius" | "panneau-badge-gap" | "panneau-badge-padding-x" | "panneau-badge-border-width" | "panneau-badge-font-size" | "panneau-badge-font-weight">;
3
3
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","names":[],"sources":["../../src/badge/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Badge. */\nexport const badgeTokens = defineComponentTokens('badge', {\n /** Space between an icon and the text. */\n gap: 'var(--panneau-space-1)',\n /** Height, and minimum width. */\n height: '1.25rem',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-2)',\n /** Font size. */\n 'font-size': 'var(--panneau-font-size-xs)',\n /** Font weight. */\n 'font-weight': 'var(--panneau-font-weight-medium)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius: a pill by default. */\n radius: 'var(--panneau-radius-full)',\n});\n"],"mappings":";;;AAGA,IAAa,cAAc,sBAAsB,SAAS;;CAEtD,KAAK;;CAEL,QAAQ;;CAER,aAAa;;CAEb,aAAa;;CAEb,eAAe;;CAEf,gBAAgB;;CAEhB,QAAQ;AACZ,CAAC"}
1
+ {"version":3,"file":"tokens.js","names":["defineComponentTokens","badgeTokens","gap","height","radius"],"sources":["../../src/badge/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Badge. */\nexport const badgeTokens = defineComponentTokens('badge', {\n /** Space between an icon and the text. */\n gap: 'var(--panneau-space-1)',\n /** Height, and minimum width. */\n height: '1.25rem',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-2)',\n /** Font size. */\n 'font-size': 'var(--panneau-font-size-xs)',\n /** Font weight. */\n 'font-weight': 'var(--panneau-font-weight-medium)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius: a pill by default. */\n radius: 'var(--panneau-radius-full)',\n});\n"],"mappings":";;;AAGA,IAAaC,cAAcD,sBAAsB,SAAS;;CAEtDE,KAAK;;CAELC,QAAQ;;CAER,aAAa;;CAEb,aAAa;;CAEb,eAAe;;CAEf,gBAAgB;;CAEhBC,QAAQ;AACZ,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { CSSProperties, ReactNode } from 'react';
2
2
  import { type ButtonProps as AriaButtonProps } from 'react-aria-components';
3
- import { type IconComponent } from '../icon/Icon';
4
- import type { Tone } from '../theme/tones';
5
- import styles from './Button.module.css';
3
+ import { type IconComponent } from '../icon/Icon.js';
4
+ import type { Tone } from '../theme/tones.js';
5
+ declare const styles: Readonly<Record<string, string>>;
6
6
  /** How a button uses its tone, like Bootstrap's `.btn-*` and `.btn-outline-*`. */
7
7
  export type ButtonAppearance = 'solid' | 'outline' | 'subtle' | 'ghost';
8
8
  /**
@@ -26,7 +26,8 @@ export interface ButtonVariants {
26
26
  * @deprecated Use `tone` and `appearance`.
27
27
  */
28
28
  export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
29
- export interface ButtonProps extends Omit<AriaButtonProps, 'className' | 'style' | 'children'> {
29
+ /** The look of a button, shared by `Button` and `LinkButton`. */
30
+ export interface ButtonStyleProps {
30
31
  /** Defaults to `neutral`. */
31
32
  tone?: Tone;
32
33
  /** Defaults to `outline` for the neutral tone, and `solid` for the others. */
@@ -40,14 +41,27 @@ export interface ButtonProps extends Omit<AriaButtonProps, 'className' | 'style'
40
41
  iconEnd?: IconComponent;
41
42
  /** Takes the full width of its container. */
42
43
  fullWidth?: boolean;
44
+ }
45
+ export interface ButtonProps extends ButtonStyleProps, Omit<AriaButtonProps, 'className' | 'style' | 'children'> {
46
+ /** The keys that do what the button does, such as `Control+Enter`. */
47
+ 'aria-keyshortcuts'?: string;
43
48
  children?: ReactNode;
44
49
  className?: string;
45
50
  style?: CSSProperties;
46
51
  }
52
+ /** The class names of a button from its style props, for `Button` and `LinkButton`. */
53
+ export declare function getButtonClassName({ tone, appearance, variant, size, fullWidth, className, }: Pick<ButtonStyleProps, 'tone' | 'appearance' | 'variant' | 'size' | 'fullWidth'> & {
54
+ className?: string | undefined;
55
+ }): string;
56
+ /** The icons and label of a button. */
57
+ export declare function ButtonContent({ icon, iconEnd, size, children, }: Pick<ButtonStyleProps, 'icon' | 'iconEnd' | 'size'> & {
58
+ children?: ReactNode;
59
+ }): import("react").JSX.Element;
47
60
  /**
48
61
  * A button. With `isPending`, it shows a spinner, keeps its size and focus, and ignores presses
49
- * while assistive technologies announce the pending state.
62
+ * while assistive technologies announce the pending state. `aria-keyshortcuts` gives the keys
63
+ * that do what it does.
50
64
  */
51
- export declare function Button({ tone, appearance, variant, size, icon, iconEnd, fullWidth, isPending, children, className, ...props }: ButtonProps): import("react").JSX.Element;
65
+ export declare function Button({ tone, appearance, variant, size, icon, iconEnd, fullWidth, isPending, children, className, 'aria-keyshortcuts': keyShortcuts, render, ...props }: ButtonProps): import("react").JSX.Element;
52
66
  export { styles as buttonStyles };
53
67
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAwB,KAAK,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExE;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAazE,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;IAC1F,6BAA6B;IAC7B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,8EAA8E;IAC9E,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,mFAAmF;IACnF,OAAO,CAAC,EAAE,aAAa,GAAG,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC;IAC1D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,aAAa,CAAC;IAC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