@seanyeh77/ui 0.43.1 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (885) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/bundle.js +20 -20
  4. package/dist/components/AccentPicker/AccentPicker.d.ts +1 -0
  5. package/dist/components/AccentPicker/AccentPicker.js +92 -72
  6. package/dist/components/AccentPicker/AccentPicker.js.map +1 -1
  7. package/dist/components/ActionBar/ActionBar.d.ts +2 -0
  8. package/dist/components/ActionBar/ActionBar.js.map +1 -1
  9. package/dist/components/AiMark/AiMark.d.ts +1 -0
  10. package/dist/components/AiMark/AiMark.js.map +1 -1
  11. package/dist/components/Alert/Alert.d.ts +6 -3
  12. package/dist/components/Alert/Alert.js +18 -14
  13. package/dist/components/Alert/Alert.js.map +1 -1
  14. package/dist/components/AppShell/AppShell.d.ts +10 -4
  15. package/dist/components/AppShell/AppShell.js +30 -19
  16. package/dist/components/AppShell/AppShell.js.map +1 -1
  17. package/dist/components/Badge/Badge.d.ts +24 -7
  18. package/dist/components/Badge/Badge.js +78 -21
  19. package/dist/components/Badge/Badge.js.map +1 -1
  20. package/dist/components/BarChart/BarChart.d.ts +14 -1
  21. package/dist/components/BarChart/BarChart.js +88 -59
  22. package/dist/components/BarChart/BarChart.js.map +1 -1
  23. package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -0
  24. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  25. package/dist/components/Button/Button.d.ts +4 -1
  26. package/dist/components/Button/Button.js +17 -3
  27. package/dist/components/Button/Button.js.map +1 -1
  28. package/dist/components/Calendar/Calendar.d.ts +11 -2
  29. package/dist/components/Calendar/Calendar.js +16 -5
  30. package/dist/components/Calendar/Calendar.js.map +1 -1
  31. package/dist/components/Card/Card.d.ts +1 -0
  32. package/dist/components/Card/Card.js.map +1 -1
  33. package/dist/components/Checkbox/Checkbox.d.ts +24 -8
  34. package/dist/components/Checkbox/Checkbox.js +22 -9
  35. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  36. package/dist/components/CodeView/CodeView.d.ts +3 -0
  37. package/dist/components/CodeView/CodeView.js +6 -6
  38. package/dist/components/CodeView/CodeView.js.map +1 -1
  39. package/dist/components/CommandPalette/CommandPalette.d.ts +16 -4
  40. package/dist/components/CommandPalette/CommandPalette.js +38 -11
  41. package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
  42. package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +2 -3
  43. package/dist/components/ConsoleLayout/ConsoleLayout.js +4 -1
  44. package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -1
  45. package/dist/components/DangerZone/DangerZone.d.ts +3 -2
  46. package/dist/components/DangerZone/DangerZone.js +3 -2
  47. package/dist/components/DangerZone/DangerZone.js.map +1 -1
  48. package/dist/components/DataTable/DataTable.d.ts +16 -4
  49. package/dist/components/DataTable/DataTable.js +346 -208
  50. package/dist/components/DataTable/DataTable.js.map +1 -1
  51. package/dist/components/DataTable/SortButton.js +48 -5
  52. package/dist/components/DataTable/SortButton.js.map +1 -1
  53. package/dist/components/DataTable/filters.js +2 -1
  54. package/dist/components/DataTable/filters.js.map +1 -1
  55. package/dist/components/DataTable/parts.js +1 -1
  56. package/dist/components/DataTable/parts.js.map +1 -1
  57. package/dist/components/DataTable/types.d.ts +10 -3
  58. package/dist/components/DatePicker/DatePicker.d.ts +9 -7
  59. package/dist/components/DatePicker/DatePicker.js +16 -6
  60. package/dist/components/DatePicker/DatePicker.js.map +1 -1
  61. package/dist/components/DateRangePicker/DateRangePicker.d.ts +12 -7
  62. package/dist/components/DateRangePicker/DateRangePicker.js +81 -45
  63. package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
  64. package/dist/components/DetailList/DetailList.d.ts +2 -0
  65. package/dist/components/DetailList/DetailList.js.map +1 -1
  66. package/dist/components/Dialog/Dialog.d.ts +56 -20
  67. package/dist/components/Dialog/Dialog.js +46 -14
  68. package/dist/components/Dialog/Dialog.js.map +1 -1
  69. package/dist/components/Drawer/Drawer.d.ts +18 -5
  70. package/dist/components/Drawer/Drawer.js +87 -24
  71. package/dist/components/Drawer/Drawer.js.map +1 -1
  72. package/dist/components/EmptyState/EmptyState.d.ts +2 -2
  73. package/dist/components/EmptyState/EmptyState.js +3 -2
  74. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  75. package/dist/components/ErrorPage/ErrorPage.d.ts +4 -0
  76. package/dist/components/ErrorPage/ErrorPage.js +2 -1
  77. package/dist/components/ErrorPage/ErrorPage.js.map +1 -1
  78. package/dist/components/EventTimeline/EventTimeline.d.ts +23 -5
  79. package/dist/components/EventTimeline/EventTimeline.js +64 -20
  80. package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
  81. package/dist/components/FileUpload/FileUpload.d.ts +10 -2
  82. package/dist/components/FileUpload/FileUpload.js +5 -2
  83. package/dist/components/FileUpload/FileUpload.js.map +1 -1
  84. package/dist/components/FormGrid/FormGrid.d.ts +3 -1
  85. package/dist/components/FormGrid/FormGrid.js +5 -2
  86. package/dist/components/FormGrid/FormGrid.js.map +1 -1
  87. package/dist/components/Graph/Graph.d.ts +1 -0
  88. package/dist/components/Graph/Graph.js +8 -4
  89. package/dist/components/Graph/Graph.js.map +1 -1
  90. package/dist/components/Grid/Grid.d.ts +11 -4
  91. package/dist/components/Grid/Grid.js +14 -2
  92. package/dist/components/Grid/Grid.js.map +1 -1
  93. package/dist/components/IconButton/IconButton.d.ts +2 -1
  94. package/dist/components/IconButton/IconButton.js +10 -1
  95. package/dist/components/IconButton/IconButton.js.map +1 -1
  96. package/dist/components/InlineCode/InlineCode.d.ts +6 -0
  97. package/dist/components/InlineCode/InlineCode.js +10 -6
  98. package/dist/components/InlineCode/InlineCode.js.map +1 -1
  99. package/dist/components/KpiCard/KpiCard.d.ts +7 -3
  100. package/dist/components/KpiCard/KpiCard.js +40 -25
  101. package/dist/components/KpiCard/KpiCard.js.map +1 -1
  102. package/dist/components/LayerGraph/LayerGraph.d.ts +68 -23
  103. package/dist/components/LayerGraph/LayerGraph.js +178 -97
  104. package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
  105. package/dist/components/LineChart/LineChart.d.ts +10 -3
  106. package/dist/components/LineChart/LineChart.js +55 -23
  107. package/dist/components/LineChart/LineChart.js.map +1 -1
  108. package/dist/components/Link/Link.d.ts +17 -0
  109. package/dist/components/Link/Link.js +47 -0
  110. package/dist/components/Link/Link.js.map +1 -0
  111. package/dist/components/LoadingBar/LoadingBar.d.ts +1 -0
  112. package/dist/components/LoadingBar/LoadingBar.js.map +1 -1
  113. package/dist/components/LoginCard/LoginCard.d.ts +9 -3
  114. package/dist/components/LoginCard/LoginCard.js +99 -78
  115. package/dist/components/LoginCard/LoginCard.js.map +1 -1
  116. package/dist/components/Markdown/Markdown.d.ts +1 -0
  117. package/dist/components/Markdown/Markdown.js +20 -2
  118. package/dist/components/Markdown/Markdown.js.map +1 -1
  119. package/dist/components/Menu/Menu.d.ts +4 -2
  120. package/dist/components/Menu/Menu.js +43 -33
  121. package/dist/components/Menu/Menu.js.map +1 -1
  122. package/dist/components/Meter/Meter.d.ts +4 -0
  123. package/dist/components/Meter/Meter.js.map +1 -1
  124. package/dist/components/MobileTabBar/MobileTabBar.d.ts +3 -0
  125. package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -1
  126. package/dist/components/MultiSelect/MultiSelect.d.ts +7 -6
  127. package/dist/components/MultiSelect/MultiSelect.js +27 -9
  128. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  129. package/dist/components/NotificationBell/NotificationBell.d.ts +4 -0
  130. package/dist/components/NotificationBell/NotificationBell.js +4 -3
  131. package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
  132. package/dist/components/PageHeader/PageHeader.d.ts +34 -0
  133. package/dist/components/PageHeader/PageHeader.js +68 -0
  134. package/dist/components/PageHeader/PageHeader.js.map +1 -0
  135. package/dist/components/Popover/Popover.d.ts +11 -4
  136. package/dist/components/Popover/Popover.js +17 -7
  137. package/dist/components/Popover/Popover.js.map +1 -1
  138. package/dist/components/ProgressBar/ProgressBar.d.ts +2 -0
  139. package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
  140. package/dist/components/ProgressRing/ProgressRing.d.ts +1 -0
  141. package/dist/components/ProgressRing/ProgressRing.js.map +1 -1
  142. package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +5 -1
  143. package/dist/components/ProjectSwitcher/ProjectSwitcher.js +16 -3
  144. package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -1
  145. package/dist/components/RadioGroup/RadioGroup.d.ts +22 -5
  146. package/dist/components/RadioGroup/RadioGroup.js +48 -47
  147. package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
  148. package/dist/components/RelativeTime/RelativeTime.d.ts +10 -0
  149. package/dist/components/RelativeTime/RelativeTime.js +44 -0
  150. package/dist/components/RelativeTime/RelativeTime.js.map +1 -0
  151. package/dist/components/SearchField/SearchField.d.ts +2 -0
  152. package/dist/components/SearchField/SearchField.js.map +1 -1
  153. package/dist/components/Section/Section.d.ts +4 -0
  154. package/dist/components/Section/Section.js +8 -22
  155. package/dist/components/Section/Section.js.map +1 -1
  156. package/dist/components/SegmentedControl/SegmentedControl.d.ts +22 -9
  157. package/dist/components/SegmentedControl/SegmentedControl.js +20 -19
  158. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  159. package/dist/components/Select/Select.d.ts +7 -11
  160. package/dist/components/Select/Select.js +7 -3
  161. package/dist/components/Select/Select.js.map +1 -1
  162. package/dist/components/SettingsLayout/SettingsLayout.d.ts +33 -4
  163. package/dist/components/SettingsLayout/SettingsLayout.js +62 -14
  164. package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
  165. package/dist/components/SideNav/SideNav.d.ts +2 -0
  166. package/dist/components/SideNav/SideNav.js +3 -3
  167. package/dist/components/SideNav/SideNav.js.map +1 -1
  168. package/dist/components/SplitPane/SplitPane.d.ts +1 -0
  169. package/dist/components/SplitPane/SplitPane.js.map +1 -1
  170. package/dist/components/StatusBand/StatusBand.d.ts +1 -0
  171. package/dist/components/StatusBand/StatusBand.js.map +1 -1
  172. package/dist/components/Suggestion/Suggestion.d.ts +6 -0
  173. package/dist/components/Suggestion/Suggestion.js.map +1 -1
  174. package/dist/components/Switch/Switch.d.ts +13 -3
  175. package/dist/components/Switch/Switch.js +16 -7
  176. package/dist/components/Switch/Switch.js.map +1 -1
  177. package/dist/components/Tabs/Tabs.d.ts +8 -1
  178. package/dist/components/Tabs/Tabs.js +6 -3
  179. package/dist/components/Tabs/Tabs.js.map +1 -1
  180. package/dist/components/Tag/Tag.d.ts +15 -7
  181. package/dist/components/Tag/Tag.js +22 -10
  182. package/dist/components/Tag/Tag.js.map +1 -1
  183. package/dist/components/Term/Term.d.ts +8 -3
  184. package/dist/components/Term/Term.js +1 -1
  185. package/dist/components/Term/Term.js.map +1 -1
  186. package/dist/components/TextArea/TextArea.d.ts +6 -9
  187. package/dist/components/TextArea/TextArea.js +25 -12
  188. package/dist/components/TextArea/TextArea.js.map +1 -1
  189. package/dist/components/TextField/TextField.d.ts +8 -11
  190. package/dist/components/TextField/TextField.js +9 -7
  191. package/dist/components/TextField/TextField.js.map +1 -1
  192. package/dist/components/ThemePicker/ThemePicker.d.ts +1 -0
  193. package/dist/components/ThemePicker/ThemePicker.js +35 -34
  194. package/dist/components/ThemePicker/ThemePicker.js.map +1 -1
  195. package/dist/components/TimeControl/TimeControl.d.ts +1 -0
  196. package/dist/components/TimeControl/TimeControl.js.map +1 -1
  197. package/dist/components/Toast/Toast.d.ts +56 -3
  198. package/dist/components/Toast/Toast.js +191 -8
  199. package/dist/components/Toast/Toast.js.map +1 -1
  200. package/dist/components/TopBar/TopBar.d.ts +6 -2
  201. package/dist/components/TopBar/TopBar.js +7 -1
  202. package/dist/components/TopBar/TopBar.js.map +1 -1
  203. package/dist/components/Tour/Tour.d.ts +14 -3
  204. package/dist/components/Tour/Tour.js +26 -14
  205. package/dist/components/Tour/Tour.js.map +1 -1
  206. package/dist/components/TreeList/TreeList.d.ts +28 -4
  207. package/dist/components/TreeList/TreeList.js +32 -20
  208. package/dist/components/TreeList/TreeList.js.map +1 -1
  209. package/dist/components/Workbench/Workbench.d.ts +1 -0
  210. package/dist/components/Workbench/Workbench.js +24 -12
  211. package/dist/components/Workbench/Workbench.js.map +1 -1
  212. package/dist/components/ZoneMap/ZoneMap.d.ts +12 -2
  213. package/dist/components/ZoneMap/ZoneMap.js +13 -5
  214. package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
  215. package/dist/components/useFormErrors/useFormErrors.d.ts +20 -0
  216. package/dist/components/useFormErrors/useFormErrors.js +55 -0
  217. package/dist/components/useFormErrors/useFormErrors.js.map +1 -0
  218. package/dist/css/AccentPicker.css +1 -0
  219. package/dist/css/Alert.css +8 -19
  220. package/dist/css/AppShell.css +1 -0
  221. package/dist/css/Badge.css +19 -45
  222. package/dist/css/BarChart.css +21 -3
  223. package/dist/css/Button.css +6 -1
  224. package/dist/css/Card.css +8 -8
  225. package/dist/css/Checkbox.css +20 -0
  226. package/dist/css/CodeView.css +3 -2
  227. package/dist/css/DangerZone.css +5 -3
  228. package/dist/css/DataTable.css +303 -69
  229. package/dist/css/DatePicker.css +1 -0
  230. package/dist/css/DateRangePicker.css +24 -2
  231. package/dist/css/Drawer.css +31 -0
  232. package/dist/css/EmptyState.css +1 -0
  233. package/dist/css/ErrorPage.css +4 -1
  234. package/dist/css/EventTimeline.css +34 -5
  235. package/dist/css/FileUpload.css +1 -0
  236. package/dist/css/FormGrid.css +12 -3
  237. package/dist/css/Graph.css +9 -1
  238. package/dist/css/Grid.css +8 -0
  239. package/dist/css/KpiCard.css +13 -1
  240. package/dist/css/LayerGraph.css +40 -15
  241. package/dist/css/Link.css +23 -0
  242. package/dist/css/LoginCard.css +17 -11
  243. package/dist/css/Markdown.css +31 -2
  244. package/dist/css/Menu.css +0 -2
  245. package/dist/css/Meter.css +16 -0
  246. package/dist/css/MultiSelect.css +1 -0
  247. package/dist/css/NotificationBell.css +1 -0
  248. package/dist/css/PageHeader.css +50 -0
  249. package/dist/css/ProgressBar.css +12 -0
  250. package/dist/css/ProjectSwitcher.css +25 -23
  251. package/dist/css/RelativeTime.css +2 -0
  252. package/dist/css/SegmentedControl.css +38 -10
  253. package/dist/css/Select.css +1 -0
  254. package/dist/css/SettingsLayout.css +29 -8
  255. package/dist/css/SideNav.css +4 -1
  256. package/dist/css/Skeleton.css +22 -1
  257. package/dist/css/Suggestion.css +1 -1
  258. package/dist/css/Switch.css +27 -0
  259. package/dist/css/Tabs.css +8 -7
  260. package/dist/css/Tag.css +19 -12
  261. package/dist/css/Term.css +1 -1
  262. package/dist/css/TextArea.css +1 -0
  263. package/dist/css/TextField.css +1 -0
  264. package/dist/css/Toast.css +101 -4
  265. package/dist/css/TopBar.css +21 -2
  266. package/dist/css/Tour.css +1 -1
  267. package/dist/css/TreeList.css +7 -3
  268. package/dist/css/Workbench.css +13 -1
  269. package/dist/css/ZoneMap.css +0 -1
  270. package/dist/css/base.css +45 -0
  271. package/dist/css/end.css +119 -5
  272. package/dist/deprecated.d.ts +3 -0
  273. package/dist/deprecated.js +13 -0
  274. package/dist/deprecated.js.map +1 -0
  275. package/dist/fonts.css +2 -7543
  276. package/dist/format.d.ts +3 -1
  277. package/dist/format.js +15 -5
  278. package/dist/format.js.map +1 -1
  279. package/dist/generated/themeDefaults.d.ts +8 -0
  280. package/dist/generated/themeDefaults.js +35 -0
  281. package/dist/generated/themeDefaults.js.map +1 -0
  282. package/dist/i18n.d.ts +7 -2
  283. package/dist/i18n.js +65 -10
  284. package/dist/i18n.js.map +1 -1
  285. package/dist/icons/Icon.d.ts +3 -1
  286. package/dist/icons/Icon.js.map +1 -1
  287. package/dist/index.d.ts +23 -14
  288. package/dist/index.js +14 -8
  289. package/dist/internal/Field.d.ts +19 -0
  290. package/dist/internal/Field.js +13 -6
  291. package/dist/internal/Field.js.map +1 -1
  292. package/dist/internal/FloatingPanel.js +2 -1
  293. package/dist/internal/FloatingPanel.js.map +1 -1
  294. package/dist/internal/chart.d.ts +4 -0
  295. package/dist/internal/chart.js +89 -19
  296. package/dist/internal/chart.js.map +1 -1
  297. package/dist/internal/codeSpans.js +20 -0
  298. package/dist/internal/codeSpans.js.map +1 -0
  299. package/dist/internal/dev.js +9 -4
  300. package/dist/internal/dev.js.map +1 -1
  301. package/dist/internal/focus.js +27 -3
  302. package/dist/internal/focus.js.map +1 -1
  303. package/dist/internal/focusMain.js +6 -2
  304. package/dist/internal/focusMain.js.map +1 -1
  305. package/dist/internal/open.d.ts +14 -0
  306. package/dist/internal/open.js +28 -0
  307. package/dist/internal/open.js.map +1 -0
  308. package/dist/internal/roving.js +37 -0
  309. package/dist/internal/roving.js.map +1 -0
  310. package/dist/internal/shell.js +12 -0
  311. package/dist/internal/shell.js.map +1 -0
  312. package/dist/internal/stored.js +89 -0
  313. package/dist/internal/stored.js.map +1 -0
  314. package/dist/internal/tableTools.js +46 -4
  315. package/dist/internal/tableTools.js.map +1 -1
  316. package/dist/internal/util.js +8 -17
  317. package/dist/internal/util.js.map +1 -1
  318. package/dist/locale.d.ts +17 -0
  319. package/dist/locale.js +29 -0
  320. package/dist/locale.js.map +1 -0
  321. package/dist/styles.css +1296 -400
  322. package/dist/theme.d.ts +23 -5
  323. package/dist/theme.js +85 -25
  324. package/dist/theme.js.map +1 -1
  325. package/dist/tokens.css +3 -0
  326. package/docs/AccentPicker.md +3 -1
  327. package/docs/Alert.md +4 -3
  328. package/docs/AppShell.md +11 -10
  329. package/docs/Badge.md +26 -16
  330. package/docs/BarChart.md +7 -4
  331. package/docs/Button.md +4 -5
  332. package/docs/Calendar.md +2 -2
  333. package/docs/Card.md +9 -8
  334. package/docs/Checkbox.md +4 -1
  335. package/docs/CodeView.md +30 -43
  336. package/docs/CommandPalette.md +3 -2
  337. package/docs/ConsoleLayout.md +5 -5
  338. package/docs/DangerZone.md +3 -2
  339. package/docs/DataColors.md +2 -2
  340. package/docs/DataTable.md +29 -141
  341. package/docs/DatePicker.md +1 -0
  342. package/docs/DateRangePicker.md +3 -0
  343. package/docs/DetailList.md +9 -9
  344. package/docs/Dialog.md +8 -4
  345. package/docs/Drawer.md +7 -4
  346. package/docs/ErrorPage.md +1 -1
  347. package/docs/EventTimeline.md +23 -12
  348. package/docs/FileUpload.md +1 -1
  349. package/docs/FormGrid.md +2 -1
  350. package/docs/Format.md +5 -3
  351. package/docs/Graph.md +1 -1
  352. package/docs/Grid.md +5 -1
  353. package/docs/KpiCard.md +6 -4
  354. package/docs/LayerGraph.md +18 -53
  355. package/docs/LineChart.md +5 -3
  356. package/docs/Link.md +22 -0
  357. package/docs/LoginCard.md +7 -3
  358. package/docs/Markdown.md +3 -13
  359. package/docs/Menu.md +2 -0
  360. package/docs/Meter.md +1 -0
  361. package/docs/MultiSelect.md +2 -1
  362. package/docs/NotificationBell.md +1 -0
  363. package/docs/PageHeader.md +34 -0
  364. package/docs/Popover.md +3 -1
  365. package/docs/ProgressBar.md +3 -1
  366. package/docs/ProjectSwitcher.md +14 -14
  367. package/docs/RadioGroup.md +2 -0
  368. package/docs/RelativeTime.md +23 -0
  369. package/docs/Section.md +1 -1
  370. package/docs/SegmentedControl.md +9 -6
  371. package/docs/Select.md +2 -1
  372. package/docs/SettingsLayout.md +19 -4
  373. package/docs/SideNav.md +1 -1
  374. package/docs/Skeleton.md +2 -1
  375. package/docs/Switch.md +3 -1
  376. package/docs/Tabs.md +4 -3
  377. package/docs/Tag.md +9 -7
  378. package/docs/Term.md +3 -3
  379. package/docs/TextArea.md +2 -1
  380. package/docs/TextField.md +5 -3
  381. package/docs/ThemePicker.md +3 -1
  382. package/docs/Toast.md +17 -5
  383. package/docs/TopBar.md +8 -5
  384. package/docs/Tour.md +3 -2
  385. package/docs/TreeList.md +10 -37
  386. package/docs/Workbench.md +1 -48
  387. package/docs/ZoneMap.md +5 -5
  388. package/docs/agents.md +82 -0
  389. package/docs/code.md +2 -2
  390. package/docs/components.json +314 -0
  391. package/docs/data.md +9 -18
  392. package/docs/forms.md +6 -5
  393. package/docs/guidelines.md +39 -31
  394. package/docs/icons.md +9 -0
  395. package/docs/layout.md +16 -20
  396. package/docs/motion.md +31 -56
  397. package/docs/theme.md +15 -18
  398. package/docs/useFormErrors.md +35 -0
  399. package/package.json +8 -7
  400. package/dist/bundle.js.map +0 -1
  401. package/dist/fonts/LICENSE-OFL.txt +0 -93
  402. package/dist/fonts/geist-mono-cyrillic-400-normal.woff2 +0 -0
  403. package/dist/fonts/geist-mono-cyrillic-500-normal.woff2 +0 -0
  404. package/dist/fonts/geist-mono-cyrillic-600-normal.woff2 +0 -0
  405. package/dist/fonts/geist-mono-cyrillic-700-normal.woff2 +0 -0
  406. package/dist/fonts/geist-mono-cyrillic-ext-400-normal.woff2 +0 -0
  407. package/dist/fonts/geist-mono-cyrillic-ext-500-normal.woff2 +0 -0
  408. package/dist/fonts/geist-mono-cyrillic-ext-600-normal.woff2 +0 -0
  409. package/dist/fonts/geist-mono-cyrillic-ext-700-normal.woff2 +0 -0
  410. package/dist/fonts/geist-mono-latin-400-normal.woff2 +0 -0
  411. package/dist/fonts/geist-mono-latin-500-normal.woff2 +0 -0
  412. package/dist/fonts/geist-mono-latin-600-normal.woff2 +0 -0
  413. package/dist/fonts/geist-mono-latin-700-normal.woff2 +0 -0
  414. package/dist/fonts/geist-mono-latin-ext-400-normal.woff2 +0 -0
  415. package/dist/fonts/geist-mono-latin-ext-500-normal.woff2 +0 -0
  416. package/dist/fonts/geist-mono-latin-ext-600-normal.woff2 +0 -0
  417. package/dist/fonts/geist-mono-latin-ext-700-normal.woff2 +0 -0
  418. package/dist/fonts/geist-mono-symbols2-400-normal.woff2 +0 -0
  419. package/dist/fonts/geist-mono-symbols2-500-normal.woff2 +0 -0
  420. package/dist/fonts/geist-mono-symbols2-600-normal.woff2 +0 -0
  421. package/dist/fonts/geist-mono-symbols2-700-normal.woff2 +0 -0
  422. package/dist/fonts/geist-mono-vietnamese-400-normal.woff2 +0 -0
  423. package/dist/fonts/geist-mono-vietnamese-500-normal.woff2 +0 -0
  424. package/dist/fonts/geist-mono-vietnamese-600-normal.woff2 +0 -0
  425. package/dist/fonts/geist-mono-vietnamese-700-normal.woff2 +0 -0
  426. package/dist/fonts/inter-cyrillic-400-normal.woff2 +0 -0
  427. package/dist/fonts/inter-cyrillic-500-normal.woff2 +0 -0
  428. package/dist/fonts/inter-cyrillic-600-normal.woff2 +0 -0
  429. package/dist/fonts/inter-cyrillic-700-normal.woff2 +0 -0
  430. package/dist/fonts/inter-cyrillic-ext-400-normal.woff2 +0 -0
  431. package/dist/fonts/inter-cyrillic-ext-500-normal.woff2 +0 -0
  432. package/dist/fonts/inter-cyrillic-ext-600-normal.woff2 +0 -0
  433. package/dist/fonts/inter-cyrillic-ext-700-normal.woff2 +0 -0
  434. package/dist/fonts/inter-greek-400-normal.woff2 +0 -0
  435. package/dist/fonts/inter-greek-500-normal.woff2 +0 -0
  436. package/dist/fonts/inter-greek-600-normal.woff2 +0 -0
  437. package/dist/fonts/inter-greek-700-normal.woff2 +0 -0
  438. package/dist/fonts/inter-greek-ext-400-normal.woff2 +0 -0
  439. package/dist/fonts/inter-greek-ext-500-normal.woff2 +0 -0
  440. package/dist/fonts/inter-greek-ext-600-normal.woff2 +0 -0
  441. package/dist/fonts/inter-greek-ext-700-normal.woff2 +0 -0
  442. package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
  443. package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
  444. package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
  445. package/dist/fonts/inter-latin-700-normal.woff2 +0 -0
  446. package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
  447. package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
  448. package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
  449. package/dist/fonts/inter-latin-ext-700-normal.woff2 +0 -0
  450. package/dist/fonts/inter-vietnamese-400-normal.woff2 +0 -0
  451. package/dist/fonts/inter-vietnamese-500-normal.woff2 +0 -0
  452. package/dist/fonts/inter-vietnamese-600-normal.woff2 +0 -0
  453. package/dist/fonts/inter-vietnamese-700-normal.woff2 +0 -0
  454. package/dist/fonts/noto-sans-tc-0-400-normal.woff2 +0 -0
  455. package/dist/fonts/noto-sans-tc-0-500-normal.woff2 +0 -0
  456. package/dist/fonts/noto-sans-tc-0-600-normal.woff2 +0 -0
  457. package/dist/fonts/noto-sans-tc-0-700-normal.woff2 +0 -0
  458. package/dist/fonts/noto-sans-tc-1-400-normal.woff2 +0 -0
  459. package/dist/fonts/noto-sans-tc-1-500-normal.woff2 +0 -0
  460. package/dist/fonts/noto-sans-tc-1-600-normal.woff2 +0 -0
  461. package/dist/fonts/noto-sans-tc-1-700-normal.woff2 +0 -0
  462. package/dist/fonts/noto-sans-tc-10-400-normal.woff2 +0 -0
  463. package/dist/fonts/noto-sans-tc-10-500-normal.woff2 +0 -0
  464. package/dist/fonts/noto-sans-tc-10-600-normal.woff2 +0 -0
  465. package/dist/fonts/noto-sans-tc-10-700-normal.woff2 +0 -0
  466. package/dist/fonts/noto-sans-tc-101-400-normal.woff2 +0 -0
  467. package/dist/fonts/noto-sans-tc-101-500-normal.woff2 +0 -0
  468. package/dist/fonts/noto-sans-tc-101-600-normal.woff2 +0 -0
  469. package/dist/fonts/noto-sans-tc-101-700-normal.woff2 +0 -0
  470. package/dist/fonts/noto-sans-tc-102-400-normal.woff2 +0 -0
  471. package/dist/fonts/noto-sans-tc-102-500-normal.woff2 +0 -0
  472. package/dist/fonts/noto-sans-tc-102-600-normal.woff2 +0 -0
  473. package/dist/fonts/noto-sans-tc-102-700-normal.woff2 +0 -0
  474. package/dist/fonts/noto-sans-tc-103-400-normal.woff2 +0 -0
  475. package/dist/fonts/noto-sans-tc-103-500-normal.woff2 +0 -0
  476. package/dist/fonts/noto-sans-tc-103-600-normal.woff2 +0 -0
  477. package/dist/fonts/noto-sans-tc-103-700-normal.woff2 +0 -0
  478. package/dist/fonts/noto-sans-tc-104-400-normal.woff2 +0 -0
  479. package/dist/fonts/noto-sans-tc-104-500-normal.woff2 +0 -0
  480. package/dist/fonts/noto-sans-tc-104-600-normal.woff2 +0 -0
  481. package/dist/fonts/noto-sans-tc-104-700-normal.woff2 +0 -0
  482. package/dist/fonts/noto-sans-tc-105-400-normal.woff2 +0 -0
  483. package/dist/fonts/noto-sans-tc-105-500-normal.woff2 +0 -0
  484. package/dist/fonts/noto-sans-tc-105-600-normal.woff2 +0 -0
  485. package/dist/fonts/noto-sans-tc-105-700-normal.woff2 +0 -0
  486. package/dist/fonts/noto-sans-tc-106-400-normal.woff2 +0 -0
  487. package/dist/fonts/noto-sans-tc-106-500-normal.woff2 +0 -0
  488. package/dist/fonts/noto-sans-tc-106-600-normal.woff2 +0 -0
  489. package/dist/fonts/noto-sans-tc-106-700-normal.woff2 +0 -0
  490. package/dist/fonts/noto-sans-tc-107-400-normal.woff2 +0 -0
  491. package/dist/fonts/noto-sans-tc-107-500-normal.woff2 +0 -0
  492. package/dist/fonts/noto-sans-tc-107-600-normal.woff2 +0 -0
  493. package/dist/fonts/noto-sans-tc-107-700-normal.woff2 +0 -0
  494. package/dist/fonts/noto-sans-tc-108-400-normal.woff2 +0 -0
  495. package/dist/fonts/noto-sans-tc-108-500-normal.woff2 +0 -0
  496. package/dist/fonts/noto-sans-tc-108-600-normal.woff2 +0 -0
  497. package/dist/fonts/noto-sans-tc-108-700-normal.woff2 +0 -0
  498. package/dist/fonts/noto-sans-tc-109-400-normal.woff2 +0 -0
  499. package/dist/fonts/noto-sans-tc-109-500-normal.woff2 +0 -0
  500. package/dist/fonts/noto-sans-tc-109-600-normal.woff2 +0 -0
  501. package/dist/fonts/noto-sans-tc-109-700-normal.woff2 +0 -0
  502. package/dist/fonts/noto-sans-tc-11-400-normal.woff2 +0 -0
  503. package/dist/fonts/noto-sans-tc-11-500-normal.woff2 +0 -0
  504. package/dist/fonts/noto-sans-tc-11-600-normal.woff2 +0 -0
  505. package/dist/fonts/noto-sans-tc-11-700-normal.woff2 +0 -0
  506. package/dist/fonts/noto-sans-tc-110-400-normal.woff2 +0 -0
  507. package/dist/fonts/noto-sans-tc-110-500-normal.woff2 +0 -0
  508. package/dist/fonts/noto-sans-tc-110-600-normal.woff2 +0 -0
  509. package/dist/fonts/noto-sans-tc-110-700-normal.woff2 +0 -0
  510. package/dist/fonts/noto-sans-tc-111-400-normal.woff2 +0 -0
  511. package/dist/fonts/noto-sans-tc-111-500-normal.woff2 +0 -0
  512. package/dist/fonts/noto-sans-tc-111-600-normal.woff2 +0 -0
  513. package/dist/fonts/noto-sans-tc-111-700-normal.woff2 +0 -0
  514. package/dist/fonts/noto-sans-tc-112-400-normal.woff2 +0 -0
  515. package/dist/fonts/noto-sans-tc-112-500-normal.woff2 +0 -0
  516. package/dist/fonts/noto-sans-tc-112-600-normal.woff2 +0 -0
  517. package/dist/fonts/noto-sans-tc-112-700-normal.woff2 +0 -0
  518. package/dist/fonts/noto-sans-tc-113-400-normal.woff2 +0 -0
  519. package/dist/fonts/noto-sans-tc-113-500-normal.woff2 +0 -0
  520. package/dist/fonts/noto-sans-tc-113-600-normal.woff2 +0 -0
  521. package/dist/fonts/noto-sans-tc-113-700-normal.woff2 +0 -0
  522. package/dist/fonts/noto-sans-tc-114-400-normal.woff2 +0 -0
  523. package/dist/fonts/noto-sans-tc-114-500-normal.woff2 +0 -0
  524. package/dist/fonts/noto-sans-tc-114-600-normal.woff2 +0 -0
  525. package/dist/fonts/noto-sans-tc-114-700-normal.woff2 +0 -0
  526. package/dist/fonts/noto-sans-tc-115-400-normal.woff2 +0 -0
  527. package/dist/fonts/noto-sans-tc-115-500-normal.woff2 +0 -0
  528. package/dist/fonts/noto-sans-tc-115-600-normal.woff2 +0 -0
  529. package/dist/fonts/noto-sans-tc-115-700-normal.woff2 +0 -0
  530. package/dist/fonts/noto-sans-tc-116-400-normal.woff2 +0 -0
  531. package/dist/fonts/noto-sans-tc-116-500-normal.woff2 +0 -0
  532. package/dist/fonts/noto-sans-tc-116-600-normal.woff2 +0 -0
  533. package/dist/fonts/noto-sans-tc-116-700-normal.woff2 +0 -0
  534. package/dist/fonts/noto-sans-tc-117-400-normal.woff2 +0 -0
  535. package/dist/fonts/noto-sans-tc-117-500-normal.woff2 +0 -0
  536. package/dist/fonts/noto-sans-tc-117-600-normal.woff2 +0 -0
  537. package/dist/fonts/noto-sans-tc-117-700-normal.woff2 +0 -0
  538. package/dist/fonts/noto-sans-tc-118-400-normal.woff2 +0 -0
  539. package/dist/fonts/noto-sans-tc-118-500-normal.woff2 +0 -0
  540. package/dist/fonts/noto-sans-tc-118-600-normal.woff2 +0 -0
  541. package/dist/fonts/noto-sans-tc-118-700-normal.woff2 +0 -0
  542. package/dist/fonts/noto-sans-tc-119-400-normal.woff2 +0 -0
  543. package/dist/fonts/noto-sans-tc-119-500-normal.woff2 +0 -0
  544. package/dist/fonts/noto-sans-tc-119-600-normal.woff2 +0 -0
  545. package/dist/fonts/noto-sans-tc-119-700-normal.woff2 +0 -0
  546. package/dist/fonts/noto-sans-tc-12-400-normal.woff2 +0 -0
  547. package/dist/fonts/noto-sans-tc-12-500-normal.woff2 +0 -0
  548. package/dist/fonts/noto-sans-tc-12-600-normal.woff2 +0 -0
  549. package/dist/fonts/noto-sans-tc-12-700-normal.woff2 +0 -0
  550. package/dist/fonts/noto-sans-tc-120-400-normal.woff2 +0 -0
  551. package/dist/fonts/noto-sans-tc-120-500-normal.woff2 +0 -0
  552. package/dist/fonts/noto-sans-tc-120-600-normal.woff2 +0 -0
  553. package/dist/fonts/noto-sans-tc-120-700-normal.woff2 +0 -0
  554. package/dist/fonts/noto-sans-tc-121-400-normal.woff2 +0 -0
  555. package/dist/fonts/noto-sans-tc-121-500-normal.woff2 +0 -0
  556. package/dist/fonts/noto-sans-tc-121-600-normal.woff2 +0 -0
  557. package/dist/fonts/noto-sans-tc-121-700-normal.woff2 +0 -0
  558. package/dist/fonts/noto-sans-tc-122-400-normal.woff2 +0 -0
  559. package/dist/fonts/noto-sans-tc-122-500-normal.woff2 +0 -0
  560. package/dist/fonts/noto-sans-tc-122-600-normal.woff2 +0 -0
  561. package/dist/fonts/noto-sans-tc-122-700-normal.woff2 +0 -0
  562. package/dist/fonts/noto-sans-tc-123-400-normal.woff2 +0 -0
  563. package/dist/fonts/noto-sans-tc-123-500-normal.woff2 +0 -0
  564. package/dist/fonts/noto-sans-tc-123-600-normal.woff2 +0 -0
  565. package/dist/fonts/noto-sans-tc-123-700-normal.woff2 +0 -0
  566. package/dist/fonts/noto-sans-tc-2-400-normal.woff2 +0 -0
  567. package/dist/fonts/noto-sans-tc-2-500-normal.woff2 +0 -0
  568. package/dist/fonts/noto-sans-tc-2-600-normal.woff2 +0 -0
  569. package/dist/fonts/noto-sans-tc-2-700-normal.woff2 +0 -0
  570. package/dist/fonts/noto-sans-tc-23-400-normal.woff2 +0 -0
  571. package/dist/fonts/noto-sans-tc-23-500-normal.woff2 +0 -0
  572. package/dist/fonts/noto-sans-tc-23-600-normal.woff2 +0 -0
  573. package/dist/fonts/noto-sans-tc-23-700-normal.woff2 +0 -0
  574. package/dist/fonts/noto-sans-tc-24-400-normal.woff2 +0 -0
  575. package/dist/fonts/noto-sans-tc-24-500-normal.woff2 +0 -0
  576. package/dist/fonts/noto-sans-tc-24-600-normal.woff2 +0 -0
  577. package/dist/fonts/noto-sans-tc-24-700-normal.woff2 +0 -0
  578. package/dist/fonts/noto-sans-tc-25-400-normal.woff2 +0 -0
  579. package/dist/fonts/noto-sans-tc-25-500-normal.woff2 +0 -0
  580. package/dist/fonts/noto-sans-tc-25-600-normal.woff2 +0 -0
  581. package/dist/fonts/noto-sans-tc-25-700-normal.woff2 +0 -0
  582. package/dist/fonts/noto-sans-tc-26-400-normal.woff2 +0 -0
  583. package/dist/fonts/noto-sans-tc-26-500-normal.woff2 +0 -0
  584. package/dist/fonts/noto-sans-tc-26-600-normal.woff2 +0 -0
  585. package/dist/fonts/noto-sans-tc-26-700-normal.woff2 +0 -0
  586. package/dist/fonts/noto-sans-tc-27-400-normal.woff2 +0 -0
  587. package/dist/fonts/noto-sans-tc-27-500-normal.woff2 +0 -0
  588. package/dist/fonts/noto-sans-tc-27-600-normal.woff2 +0 -0
  589. package/dist/fonts/noto-sans-tc-27-700-normal.woff2 +0 -0
  590. package/dist/fonts/noto-sans-tc-28-400-normal.woff2 +0 -0
  591. package/dist/fonts/noto-sans-tc-28-500-normal.woff2 +0 -0
  592. package/dist/fonts/noto-sans-tc-28-600-normal.woff2 +0 -0
  593. package/dist/fonts/noto-sans-tc-28-700-normal.woff2 +0 -0
  594. package/dist/fonts/noto-sans-tc-29-400-normal.woff2 +0 -0
  595. package/dist/fonts/noto-sans-tc-29-500-normal.woff2 +0 -0
  596. package/dist/fonts/noto-sans-tc-29-600-normal.woff2 +0 -0
  597. package/dist/fonts/noto-sans-tc-29-700-normal.woff2 +0 -0
  598. package/dist/fonts/noto-sans-tc-30-400-normal.woff2 +0 -0
  599. package/dist/fonts/noto-sans-tc-30-500-normal.woff2 +0 -0
  600. package/dist/fonts/noto-sans-tc-30-600-normal.woff2 +0 -0
  601. package/dist/fonts/noto-sans-tc-30-700-normal.woff2 +0 -0
  602. package/dist/fonts/noto-sans-tc-31-400-normal.woff2 +0 -0
  603. package/dist/fonts/noto-sans-tc-31-500-normal.woff2 +0 -0
  604. package/dist/fonts/noto-sans-tc-31-600-normal.woff2 +0 -0
  605. package/dist/fonts/noto-sans-tc-31-700-normal.woff2 +0 -0
  606. package/dist/fonts/noto-sans-tc-32-400-normal.woff2 +0 -0
  607. package/dist/fonts/noto-sans-tc-32-500-normal.woff2 +0 -0
  608. package/dist/fonts/noto-sans-tc-32-600-normal.woff2 +0 -0
  609. package/dist/fonts/noto-sans-tc-32-700-normal.woff2 +0 -0
  610. package/dist/fonts/noto-sans-tc-33-400-normal.woff2 +0 -0
  611. package/dist/fonts/noto-sans-tc-33-500-normal.woff2 +0 -0
  612. package/dist/fonts/noto-sans-tc-33-600-normal.woff2 +0 -0
  613. package/dist/fonts/noto-sans-tc-33-700-normal.woff2 +0 -0
  614. package/dist/fonts/noto-sans-tc-34-400-normal.woff2 +0 -0
  615. package/dist/fonts/noto-sans-tc-34-500-normal.woff2 +0 -0
  616. package/dist/fonts/noto-sans-tc-34-600-normal.woff2 +0 -0
  617. package/dist/fonts/noto-sans-tc-34-700-normal.woff2 +0 -0
  618. package/dist/fonts/noto-sans-tc-35-400-normal.woff2 +0 -0
  619. package/dist/fonts/noto-sans-tc-35-500-normal.woff2 +0 -0
  620. package/dist/fonts/noto-sans-tc-35-600-normal.woff2 +0 -0
  621. package/dist/fonts/noto-sans-tc-35-700-normal.woff2 +0 -0
  622. package/dist/fonts/noto-sans-tc-36-400-normal.woff2 +0 -0
  623. package/dist/fonts/noto-sans-tc-36-500-normal.woff2 +0 -0
  624. package/dist/fonts/noto-sans-tc-36-600-normal.woff2 +0 -0
  625. package/dist/fonts/noto-sans-tc-36-700-normal.woff2 +0 -0
  626. package/dist/fonts/noto-sans-tc-37-400-normal.woff2 +0 -0
  627. package/dist/fonts/noto-sans-tc-37-500-normal.woff2 +0 -0
  628. package/dist/fonts/noto-sans-tc-37-600-normal.woff2 +0 -0
  629. package/dist/fonts/noto-sans-tc-37-700-normal.woff2 +0 -0
  630. package/dist/fonts/noto-sans-tc-38-400-normal.woff2 +0 -0
  631. package/dist/fonts/noto-sans-tc-38-500-normal.woff2 +0 -0
  632. package/dist/fonts/noto-sans-tc-38-600-normal.woff2 +0 -0
  633. package/dist/fonts/noto-sans-tc-38-700-normal.woff2 +0 -0
  634. package/dist/fonts/noto-sans-tc-39-400-normal.woff2 +0 -0
  635. package/dist/fonts/noto-sans-tc-39-500-normal.woff2 +0 -0
  636. package/dist/fonts/noto-sans-tc-39-600-normal.woff2 +0 -0
  637. package/dist/fonts/noto-sans-tc-39-700-normal.woff2 +0 -0
  638. package/dist/fonts/noto-sans-tc-4-400-normal.woff2 +0 -0
  639. package/dist/fonts/noto-sans-tc-4-500-normal.woff2 +0 -0
  640. package/dist/fonts/noto-sans-tc-4-600-normal.woff2 +0 -0
  641. package/dist/fonts/noto-sans-tc-4-700-normal.woff2 +0 -0
  642. package/dist/fonts/noto-sans-tc-40-400-normal.woff2 +0 -0
  643. package/dist/fonts/noto-sans-tc-40-500-normal.woff2 +0 -0
  644. package/dist/fonts/noto-sans-tc-40-600-normal.woff2 +0 -0
  645. package/dist/fonts/noto-sans-tc-40-700-normal.woff2 +0 -0
  646. package/dist/fonts/noto-sans-tc-41-400-normal.woff2 +0 -0
  647. package/dist/fonts/noto-sans-tc-41-500-normal.woff2 +0 -0
  648. package/dist/fonts/noto-sans-tc-41-600-normal.woff2 +0 -0
  649. package/dist/fonts/noto-sans-tc-41-700-normal.woff2 +0 -0
  650. package/dist/fonts/noto-sans-tc-42-400-normal.woff2 +0 -0
  651. package/dist/fonts/noto-sans-tc-42-500-normal.woff2 +0 -0
  652. package/dist/fonts/noto-sans-tc-42-600-normal.woff2 +0 -0
  653. package/dist/fonts/noto-sans-tc-42-700-normal.woff2 +0 -0
  654. package/dist/fonts/noto-sans-tc-43-400-normal.woff2 +0 -0
  655. package/dist/fonts/noto-sans-tc-43-500-normal.woff2 +0 -0
  656. package/dist/fonts/noto-sans-tc-43-600-normal.woff2 +0 -0
  657. package/dist/fonts/noto-sans-tc-43-700-normal.woff2 +0 -0
  658. package/dist/fonts/noto-sans-tc-44-400-normal.woff2 +0 -0
  659. package/dist/fonts/noto-sans-tc-44-500-normal.woff2 +0 -0
  660. package/dist/fonts/noto-sans-tc-44-600-normal.woff2 +0 -0
  661. package/dist/fonts/noto-sans-tc-44-700-normal.woff2 +0 -0
  662. package/dist/fonts/noto-sans-tc-45-400-normal.woff2 +0 -0
  663. package/dist/fonts/noto-sans-tc-45-500-normal.woff2 +0 -0
  664. package/dist/fonts/noto-sans-tc-45-600-normal.woff2 +0 -0
  665. package/dist/fonts/noto-sans-tc-45-700-normal.woff2 +0 -0
  666. package/dist/fonts/noto-sans-tc-46-400-normal.woff2 +0 -0
  667. package/dist/fonts/noto-sans-tc-46-500-normal.woff2 +0 -0
  668. package/dist/fonts/noto-sans-tc-46-600-normal.woff2 +0 -0
  669. package/dist/fonts/noto-sans-tc-46-700-normal.woff2 +0 -0
  670. package/dist/fonts/noto-sans-tc-47-400-normal.woff2 +0 -0
  671. package/dist/fonts/noto-sans-tc-47-500-normal.woff2 +0 -0
  672. package/dist/fonts/noto-sans-tc-47-600-normal.woff2 +0 -0
  673. package/dist/fonts/noto-sans-tc-47-700-normal.woff2 +0 -0
  674. package/dist/fonts/noto-sans-tc-48-400-normal.woff2 +0 -0
  675. package/dist/fonts/noto-sans-tc-48-500-normal.woff2 +0 -0
  676. package/dist/fonts/noto-sans-tc-48-600-normal.woff2 +0 -0
  677. package/dist/fonts/noto-sans-tc-48-700-normal.woff2 +0 -0
  678. package/dist/fonts/noto-sans-tc-49-400-normal.woff2 +0 -0
  679. package/dist/fonts/noto-sans-tc-49-500-normal.woff2 +0 -0
  680. package/dist/fonts/noto-sans-tc-49-600-normal.woff2 +0 -0
  681. package/dist/fonts/noto-sans-tc-49-700-normal.woff2 +0 -0
  682. package/dist/fonts/noto-sans-tc-50-400-normal.woff2 +0 -0
  683. package/dist/fonts/noto-sans-tc-50-500-normal.woff2 +0 -0
  684. package/dist/fonts/noto-sans-tc-50-600-normal.woff2 +0 -0
  685. package/dist/fonts/noto-sans-tc-50-700-normal.woff2 +0 -0
  686. package/dist/fonts/noto-sans-tc-51-400-normal.woff2 +0 -0
  687. package/dist/fonts/noto-sans-tc-51-500-normal.woff2 +0 -0
  688. package/dist/fonts/noto-sans-tc-51-600-normal.woff2 +0 -0
  689. package/dist/fonts/noto-sans-tc-51-700-normal.woff2 +0 -0
  690. package/dist/fonts/noto-sans-tc-52-400-normal.woff2 +0 -0
  691. package/dist/fonts/noto-sans-tc-52-500-normal.woff2 +0 -0
  692. package/dist/fonts/noto-sans-tc-52-600-normal.woff2 +0 -0
  693. package/dist/fonts/noto-sans-tc-52-700-normal.woff2 +0 -0
  694. package/dist/fonts/noto-sans-tc-53-400-normal.woff2 +0 -0
  695. package/dist/fonts/noto-sans-tc-53-500-normal.woff2 +0 -0
  696. package/dist/fonts/noto-sans-tc-53-600-normal.woff2 +0 -0
  697. package/dist/fonts/noto-sans-tc-53-700-normal.woff2 +0 -0
  698. package/dist/fonts/noto-sans-tc-54-400-normal.woff2 +0 -0
  699. package/dist/fonts/noto-sans-tc-54-500-normal.woff2 +0 -0
  700. package/dist/fonts/noto-sans-tc-54-600-normal.woff2 +0 -0
  701. package/dist/fonts/noto-sans-tc-54-700-normal.woff2 +0 -0
  702. package/dist/fonts/noto-sans-tc-55-400-normal.woff2 +0 -0
  703. package/dist/fonts/noto-sans-tc-55-500-normal.woff2 +0 -0
  704. package/dist/fonts/noto-sans-tc-55-600-normal.woff2 +0 -0
  705. package/dist/fonts/noto-sans-tc-55-700-normal.woff2 +0 -0
  706. package/dist/fonts/noto-sans-tc-56-400-normal.woff2 +0 -0
  707. package/dist/fonts/noto-sans-tc-56-500-normal.woff2 +0 -0
  708. package/dist/fonts/noto-sans-tc-56-600-normal.woff2 +0 -0
  709. package/dist/fonts/noto-sans-tc-56-700-normal.woff2 +0 -0
  710. package/dist/fonts/noto-sans-tc-57-400-normal.woff2 +0 -0
  711. package/dist/fonts/noto-sans-tc-57-500-normal.woff2 +0 -0
  712. package/dist/fonts/noto-sans-tc-57-600-normal.woff2 +0 -0
  713. package/dist/fonts/noto-sans-tc-57-700-normal.woff2 +0 -0
  714. package/dist/fonts/noto-sans-tc-58-400-normal.woff2 +0 -0
  715. package/dist/fonts/noto-sans-tc-58-500-normal.woff2 +0 -0
  716. package/dist/fonts/noto-sans-tc-58-600-normal.woff2 +0 -0
  717. package/dist/fonts/noto-sans-tc-58-700-normal.woff2 +0 -0
  718. package/dist/fonts/noto-sans-tc-59-400-normal.woff2 +0 -0
  719. package/dist/fonts/noto-sans-tc-59-500-normal.woff2 +0 -0
  720. package/dist/fonts/noto-sans-tc-59-600-normal.woff2 +0 -0
  721. package/dist/fonts/noto-sans-tc-59-700-normal.woff2 +0 -0
  722. package/dist/fonts/noto-sans-tc-60-400-normal.woff2 +0 -0
  723. package/dist/fonts/noto-sans-tc-60-500-normal.woff2 +0 -0
  724. package/dist/fonts/noto-sans-tc-60-600-normal.woff2 +0 -0
  725. package/dist/fonts/noto-sans-tc-60-700-normal.woff2 +0 -0
  726. package/dist/fonts/noto-sans-tc-61-400-normal.woff2 +0 -0
  727. package/dist/fonts/noto-sans-tc-61-500-normal.woff2 +0 -0
  728. package/dist/fonts/noto-sans-tc-61-600-normal.woff2 +0 -0
  729. package/dist/fonts/noto-sans-tc-61-700-normal.woff2 +0 -0
  730. package/dist/fonts/noto-sans-tc-62-400-normal.woff2 +0 -0
  731. package/dist/fonts/noto-sans-tc-62-500-normal.woff2 +0 -0
  732. package/dist/fonts/noto-sans-tc-62-600-normal.woff2 +0 -0
  733. package/dist/fonts/noto-sans-tc-62-700-normal.woff2 +0 -0
  734. package/dist/fonts/noto-sans-tc-63-400-normal.woff2 +0 -0
  735. package/dist/fonts/noto-sans-tc-63-500-normal.woff2 +0 -0
  736. package/dist/fonts/noto-sans-tc-63-600-normal.woff2 +0 -0
  737. package/dist/fonts/noto-sans-tc-63-700-normal.woff2 +0 -0
  738. package/dist/fonts/noto-sans-tc-64-400-normal.woff2 +0 -0
  739. package/dist/fonts/noto-sans-tc-64-500-normal.woff2 +0 -0
  740. package/dist/fonts/noto-sans-tc-64-600-normal.woff2 +0 -0
  741. package/dist/fonts/noto-sans-tc-64-700-normal.woff2 +0 -0
  742. package/dist/fonts/noto-sans-tc-65-400-normal.woff2 +0 -0
  743. package/dist/fonts/noto-sans-tc-65-500-normal.woff2 +0 -0
  744. package/dist/fonts/noto-sans-tc-65-600-normal.woff2 +0 -0
  745. package/dist/fonts/noto-sans-tc-65-700-normal.woff2 +0 -0
  746. package/dist/fonts/noto-sans-tc-66-400-normal.woff2 +0 -0
  747. package/dist/fonts/noto-sans-tc-66-500-normal.woff2 +0 -0
  748. package/dist/fonts/noto-sans-tc-66-600-normal.woff2 +0 -0
  749. package/dist/fonts/noto-sans-tc-66-700-normal.woff2 +0 -0
  750. package/dist/fonts/noto-sans-tc-67-400-normal.woff2 +0 -0
  751. package/dist/fonts/noto-sans-tc-67-500-normal.woff2 +0 -0
  752. package/dist/fonts/noto-sans-tc-67-600-normal.woff2 +0 -0
  753. package/dist/fonts/noto-sans-tc-67-700-normal.woff2 +0 -0
  754. package/dist/fonts/noto-sans-tc-68-400-normal.woff2 +0 -0
  755. package/dist/fonts/noto-sans-tc-68-500-normal.woff2 +0 -0
  756. package/dist/fonts/noto-sans-tc-68-600-normal.woff2 +0 -0
  757. package/dist/fonts/noto-sans-tc-68-700-normal.woff2 +0 -0
  758. package/dist/fonts/noto-sans-tc-69-400-normal.woff2 +0 -0
  759. package/dist/fonts/noto-sans-tc-69-500-normal.woff2 +0 -0
  760. package/dist/fonts/noto-sans-tc-69-600-normal.woff2 +0 -0
  761. package/dist/fonts/noto-sans-tc-69-700-normal.woff2 +0 -0
  762. package/dist/fonts/noto-sans-tc-70-400-normal.woff2 +0 -0
  763. package/dist/fonts/noto-sans-tc-70-500-normal.woff2 +0 -0
  764. package/dist/fonts/noto-sans-tc-70-600-normal.woff2 +0 -0
  765. package/dist/fonts/noto-sans-tc-70-700-normal.woff2 +0 -0
  766. package/dist/fonts/noto-sans-tc-71-400-normal.woff2 +0 -0
  767. package/dist/fonts/noto-sans-tc-71-500-normal.woff2 +0 -0
  768. package/dist/fonts/noto-sans-tc-71-600-normal.woff2 +0 -0
  769. package/dist/fonts/noto-sans-tc-71-700-normal.woff2 +0 -0
  770. package/dist/fonts/noto-sans-tc-72-400-normal.woff2 +0 -0
  771. package/dist/fonts/noto-sans-tc-72-500-normal.woff2 +0 -0
  772. package/dist/fonts/noto-sans-tc-72-600-normal.woff2 +0 -0
  773. package/dist/fonts/noto-sans-tc-72-700-normal.woff2 +0 -0
  774. package/dist/fonts/noto-sans-tc-73-400-normal.woff2 +0 -0
  775. package/dist/fonts/noto-sans-tc-73-500-normal.woff2 +0 -0
  776. package/dist/fonts/noto-sans-tc-73-600-normal.woff2 +0 -0
  777. package/dist/fonts/noto-sans-tc-73-700-normal.woff2 +0 -0
  778. package/dist/fonts/noto-sans-tc-74-400-normal.woff2 +0 -0
  779. package/dist/fonts/noto-sans-tc-74-500-normal.woff2 +0 -0
  780. package/dist/fonts/noto-sans-tc-74-600-normal.woff2 +0 -0
  781. package/dist/fonts/noto-sans-tc-74-700-normal.woff2 +0 -0
  782. package/dist/fonts/noto-sans-tc-75-400-normal.woff2 +0 -0
  783. package/dist/fonts/noto-sans-tc-75-500-normal.woff2 +0 -0
  784. package/dist/fonts/noto-sans-tc-75-600-normal.woff2 +0 -0
  785. package/dist/fonts/noto-sans-tc-75-700-normal.woff2 +0 -0
  786. package/dist/fonts/noto-sans-tc-76-400-normal.woff2 +0 -0
  787. package/dist/fonts/noto-sans-tc-76-500-normal.woff2 +0 -0
  788. package/dist/fonts/noto-sans-tc-76-600-normal.woff2 +0 -0
  789. package/dist/fonts/noto-sans-tc-76-700-normal.woff2 +0 -0
  790. package/dist/fonts/noto-sans-tc-77-400-normal.woff2 +0 -0
  791. package/dist/fonts/noto-sans-tc-77-500-normal.woff2 +0 -0
  792. package/dist/fonts/noto-sans-tc-77-600-normal.woff2 +0 -0
  793. package/dist/fonts/noto-sans-tc-77-700-normal.woff2 +0 -0
  794. package/dist/fonts/noto-sans-tc-78-400-normal.woff2 +0 -0
  795. package/dist/fonts/noto-sans-tc-78-500-normal.woff2 +0 -0
  796. package/dist/fonts/noto-sans-tc-78-600-normal.woff2 +0 -0
  797. package/dist/fonts/noto-sans-tc-78-700-normal.woff2 +0 -0
  798. package/dist/fonts/noto-sans-tc-79-400-normal.woff2 +0 -0
  799. package/dist/fonts/noto-sans-tc-79-500-normal.woff2 +0 -0
  800. package/dist/fonts/noto-sans-tc-79-600-normal.woff2 +0 -0
  801. package/dist/fonts/noto-sans-tc-79-700-normal.woff2 +0 -0
  802. package/dist/fonts/noto-sans-tc-80-400-normal.woff2 +0 -0
  803. package/dist/fonts/noto-sans-tc-80-500-normal.woff2 +0 -0
  804. package/dist/fonts/noto-sans-tc-80-600-normal.woff2 +0 -0
  805. package/dist/fonts/noto-sans-tc-80-700-normal.woff2 +0 -0
  806. package/dist/fonts/noto-sans-tc-81-400-normal.woff2 +0 -0
  807. package/dist/fonts/noto-sans-tc-81-500-normal.woff2 +0 -0
  808. package/dist/fonts/noto-sans-tc-81-600-normal.woff2 +0 -0
  809. package/dist/fonts/noto-sans-tc-81-700-normal.woff2 +0 -0
  810. package/dist/fonts/noto-sans-tc-82-400-normal.woff2 +0 -0
  811. package/dist/fonts/noto-sans-tc-82-500-normal.woff2 +0 -0
  812. package/dist/fonts/noto-sans-tc-82-600-normal.woff2 +0 -0
  813. package/dist/fonts/noto-sans-tc-82-700-normal.woff2 +0 -0
  814. package/dist/fonts/noto-sans-tc-83-400-normal.woff2 +0 -0
  815. package/dist/fonts/noto-sans-tc-83-500-normal.woff2 +0 -0
  816. package/dist/fonts/noto-sans-tc-83-600-normal.woff2 +0 -0
  817. package/dist/fonts/noto-sans-tc-83-700-normal.woff2 +0 -0
  818. package/dist/fonts/noto-sans-tc-84-400-normal.woff2 +0 -0
  819. package/dist/fonts/noto-sans-tc-84-500-normal.woff2 +0 -0
  820. package/dist/fonts/noto-sans-tc-84-600-normal.woff2 +0 -0
  821. package/dist/fonts/noto-sans-tc-84-700-normal.woff2 +0 -0
  822. package/dist/fonts/noto-sans-tc-85-400-normal.woff2 +0 -0
  823. package/dist/fonts/noto-sans-tc-85-500-normal.woff2 +0 -0
  824. package/dist/fonts/noto-sans-tc-85-600-normal.woff2 +0 -0
  825. package/dist/fonts/noto-sans-tc-85-700-normal.woff2 +0 -0
  826. package/dist/fonts/noto-sans-tc-86-400-normal.woff2 +0 -0
  827. package/dist/fonts/noto-sans-tc-86-500-normal.woff2 +0 -0
  828. package/dist/fonts/noto-sans-tc-86-600-normal.woff2 +0 -0
  829. package/dist/fonts/noto-sans-tc-86-700-normal.woff2 +0 -0
  830. package/dist/fonts/noto-sans-tc-87-400-normal.woff2 +0 -0
  831. package/dist/fonts/noto-sans-tc-87-500-normal.woff2 +0 -0
  832. package/dist/fonts/noto-sans-tc-87-600-normal.woff2 +0 -0
  833. package/dist/fonts/noto-sans-tc-87-700-normal.woff2 +0 -0
  834. package/dist/fonts/noto-sans-tc-88-400-normal.woff2 +0 -0
  835. package/dist/fonts/noto-sans-tc-88-500-normal.woff2 +0 -0
  836. package/dist/fonts/noto-sans-tc-88-600-normal.woff2 +0 -0
  837. package/dist/fonts/noto-sans-tc-88-700-normal.woff2 +0 -0
  838. package/dist/fonts/noto-sans-tc-89-400-normal.woff2 +0 -0
  839. package/dist/fonts/noto-sans-tc-89-500-normal.woff2 +0 -0
  840. package/dist/fonts/noto-sans-tc-89-600-normal.woff2 +0 -0
  841. package/dist/fonts/noto-sans-tc-89-700-normal.woff2 +0 -0
  842. package/dist/fonts/noto-sans-tc-90-400-normal.woff2 +0 -0
  843. package/dist/fonts/noto-sans-tc-90-500-normal.woff2 +0 -0
  844. package/dist/fonts/noto-sans-tc-90-600-normal.woff2 +0 -0
  845. package/dist/fonts/noto-sans-tc-90-700-normal.woff2 +0 -0
  846. package/dist/fonts/noto-sans-tc-91-400-normal.woff2 +0 -0
  847. package/dist/fonts/noto-sans-tc-91-500-normal.woff2 +0 -0
  848. package/dist/fonts/noto-sans-tc-91-600-normal.woff2 +0 -0
  849. package/dist/fonts/noto-sans-tc-91-700-normal.woff2 +0 -0
  850. package/dist/fonts/noto-sans-tc-92-400-normal.woff2 +0 -0
  851. package/dist/fonts/noto-sans-tc-92-500-normal.woff2 +0 -0
  852. package/dist/fonts/noto-sans-tc-92-600-normal.woff2 +0 -0
  853. package/dist/fonts/noto-sans-tc-92-700-normal.woff2 +0 -0
  854. package/dist/fonts/noto-sans-tc-93-400-normal.woff2 +0 -0
  855. package/dist/fonts/noto-sans-tc-93-500-normal.woff2 +0 -0
  856. package/dist/fonts/noto-sans-tc-93-600-normal.woff2 +0 -0
  857. package/dist/fonts/noto-sans-tc-93-700-normal.woff2 +0 -0
  858. package/dist/fonts/noto-sans-tc-94-400-normal.woff2 +0 -0
  859. package/dist/fonts/noto-sans-tc-94-500-normal.woff2 +0 -0
  860. package/dist/fonts/noto-sans-tc-94-600-normal.woff2 +0 -0
  861. package/dist/fonts/noto-sans-tc-94-700-normal.woff2 +0 -0
  862. package/dist/fonts/noto-sans-tc-95-400-normal.woff2 +0 -0
  863. package/dist/fonts/noto-sans-tc-95-500-normal.woff2 +0 -0
  864. package/dist/fonts/noto-sans-tc-95-600-normal.woff2 +0 -0
  865. package/dist/fonts/noto-sans-tc-95-700-normal.woff2 +0 -0
  866. package/dist/fonts/noto-sans-tc-96-400-normal.woff2 +0 -0
  867. package/dist/fonts/noto-sans-tc-96-500-normal.woff2 +0 -0
  868. package/dist/fonts/noto-sans-tc-96-600-normal.woff2 +0 -0
  869. package/dist/fonts/noto-sans-tc-96-700-normal.woff2 +0 -0
  870. package/dist/fonts/noto-sans-tc-cyrillic-400-normal.woff2 +0 -0
  871. package/dist/fonts/noto-sans-tc-cyrillic-500-normal.woff2 +0 -0
  872. package/dist/fonts/noto-sans-tc-cyrillic-600-normal.woff2 +0 -0
  873. package/dist/fonts/noto-sans-tc-cyrillic-700-normal.woff2 +0 -0
  874. package/dist/fonts/noto-sans-tc-latin-400-normal.woff2 +0 -0
  875. package/dist/fonts/noto-sans-tc-latin-500-normal.woff2 +0 -0
  876. package/dist/fonts/noto-sans-tc-latin-600-normal.woff2 +0 -0
  877. package/dist/fonts/noto-sans-tc-latin-700-normal.woff2 +0 -0
  878. package/dist/fonts/noto-sans-tc-latin-ext-400-normal.woff2 +0 -0
  879. package/dist/fonts/noto-sans-tc-latin-ext-500-normal.woff2 +0 -0
  880. package/dist/fonts/noto-sans-tc-latin-ext-600-normal.woff2 +0 -0
  881. package/dist/fonts/noto-sans-tc-latin-ext-700-normal.woff2 +0 -0
  882. package/dist/fonts/noto-sans-tc-vietnamese-400-normal.woff2 +0 -0
  883. package/dist/fonts/noto-sans-tc-vietnamese-500-normal.woff2 +0 -0
  884. package/dist/fonts/noto-sans-tc-vietnamese-600-normal.woff2 +0 -0
  885. package/dist/fonts/noto-sans-tc-vietnamese-700-normal.woff2 +0 -0
@@ -3,6 +3,7 @@ import { tr } from "../../i18n.js";
3
3
  import { IconOf } from "../../icons/Icon.js";
4
4
  import { cx } from "../../internal/util.js";
5
5
  import { Dialog } from "../Dialog/Dialog.js";
6
+ import { baseReason, useOpenState } from "../../internal/open.js";
6
7
  import { includeIcons } from "../../icons/store.js";
7
8
  import dots_three_default from "../../icons/ph/dots-three.js";
8
9
  import * as React from "react";
@@ -11,7 +12,12 @@ import { Menu } from "@base-ui/react/menu";
11
12
  // src/components/Menu/Menu.tsx
12
13
  includeIcons(dots_three_default);
13
14
  /** The ⋯ button and its list of actions. Danger items go last, in red, after a divider, and are confirmed. */
14
- function Menu$1({ items, label, icon = "dots-three", align = "end", triggerClassName }) {
15
+ function Menu$1({ items, label, icon = "dots-three", align = "end", triggerClassName, open: openProp, defaultOpen, onOpenChange }) {
16
+ const [open, setOpen] = useOpenState({
17
+ open: openProp,
18
+ defaultOpen,
19
+ onOpenChange
20
+ });
15
21
  const [asking, setAsking] = React.useState(null);
16
22
  const normal = items.filter((it) => !it.danger);
17
23
  const danger = items.filter((it) => !!it.danger);
@@ -29,39 +35,43 @@ function Menu$1({ items, label, icon = "dots-three", align = "end", triggerClass
29
35
  children: it.shortcut
30
36
  }) : null
31
37
  ] });
32
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
33
- className: cx("ui-iconbtn", "ui-menu-trigger", triggerClassName),
34
- "aria-label": label || tr("更多操作"),
35
- children: /* @__PURE__ */ jsx(IconOf, {
36
- icon,
37
- size: 20
38
- })
39
- }), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
40
- className: "ui-float",
41
- side: "bottom",
42
- align,
43
- sideOffset: 4,
44
- children: /* @__PURE__ */ jsxs(Menu.Popup, {
45
- className: "ui-menu",
46
- children: [
47
- normal.map((it, i) => /* @__PURE__ */ jsx(Menu.Item, {
48
- disabled: it.disabled,
49
- className: "ui-menu-item",
50
- onClick: () => it.onSelect?.(),
51
- children: row(it)
52
- }, i)),
53
- danger.length && normal.length ? /* @__PURE__ */ jsx(Menu.Separator, { className: "ui-menu-sep" }) : null,
54
- danger.map((it, i) => /* @__PURE__ */ jsx(Menu.Item, {
55
- disabled: it.disabled,
56
- className: "ui-menu-item is-danger",
57
- onClick: () => setAsking(it),
58
- children: row(it)
59
- }, "d" + i))
60
- ]
61
- })
62
- }) })] }), danger.length ? /* @__PURE__ */ jsx(Dialog, {
38
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Menu.Root, {
39
+ open,
40
+ onOpenChange: (next, details) => setOpen(next, baseReason(details?.reason)),
41
+ children: [/* @__PURE__ */ jsx(Menu.Trigger, {
42
+ className: cx("ui-iconbtn", "ui-menu-trigger", triggerClassName),
43
+ "aria-label": label || tr("更多操作"),
44
+ children: /* @__PURE__ */ jsx(IconOf, {
45
+ icon,
46
+ size: 20
47
+ })
48
+ }), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
49
+ className: "ui-float",
50
+ side: "bottom",
51
+ align,
52
+ sideOffset: 4,
53
+ children: /* @__PURE__ */ jsxs(Menu.Popup, {
54
+ className: "ui-menu",
55
+ children: [
56
+ normal.map((it, i) => /* @__PURE__ */ jsx(Menu.Item, {
57
+ disabled: it.disabled,
58
+ className: "ui-menu-item",
59
+ onClick: () => it.onSelect?.(),
60
+ children: row(it)
61
+ }, i)),
62
+ danger.length && normal.length ? /* @__PURE__ */ jsx(Menu.Separator, { className: "ui-menu-sep" }) : null,
63
+ danger.map((it, i) => /* @__PURE__ */ jsx(Menu.Item, {
64
+ disabled: it.disabled,
65
+ className: "ui-menu-item is-danger",
66
+ onClick: () => setAsking(it),
67
+ children: row(it)
68
+ }, "d" + i))
69
+ ]
70
+ })
71
+ }) })]
72
+ }), danger.length ? /* @__PURE__ */ jsx(Dialog, {
63
73
  open: !!asking,
64
- onClose: () => setAsking(null),
74
+ onOpenChange: (o) => !o && setAsking(null),
65
75
  title: asking ? asking.confirm?.title ?? tr("{label}?", { label: asking.label }) : "",
66
76
  tone: "danger",
67
77
  confirmLabel: asking?.confirm?.confirmLabel ?? asking?.label ?? "",
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","names":["phDotsThree","Menu","Base"],"sources":["../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as Base } from '@base-ui/react/menu';\nimport { tr } from '../../i18n';\nimport { IconOf, type IconSource } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { Dialog } from '../Dialog/Dialog';\nimport type { DangerConfirm } from '../Button/Button';\nimport { includeIcons } from '../../icons/store';\nimport phDotsThree from '../../icons/ph/dots-three';\n\nincludeIcons(phDotsThree);\n\ninterface MenuItemBase {\n /** A verb: 重新命名, 複製連結. */\n label: string;\n icon?: IconSource;\n /** Shown at the right, e.g. ⌘D. */\n shortcut?: string;\n disabled?: boolean;\n onSelect?: () => void;\n}\n\nexport type MenuItem =\n | (MenuItemBase & { danger?: false })\n | (MenuItemBase & {\n /** Red, last, after a divider. Must be confirmed: onSelect runs after the dialog. */\n danger: true;\n confirm: DangerConfirm;\n });\n\nexport interface MenuProps {\n items: MenuItem[];\n /** aria-label and tooltip of the ⋯ button. Default 「更多操作」. */\n label?: string;\n /** Default 'dots-three'. */\n icon?: IconSource;\n /** 'end' lines up right edges (default); flips when the menu would leave the window. */\n align?: 'end' | 'start';\n /** Extra class on the ⋯ button. */\n triggerClassName?: string;\n}\n\n/** The ⋯ button and its list of actions. Danger items go last, in red, after a divider, and are confirmed. */\nexport function Menu({ items, label, icon = 'dots-three', align = 'end', triggerClassName }: MenuProps) {\n const [asking, setAsking] = React.useState<Extract<MenuItem, { danger: true }> | null>(null);\n const normal = items.filter((it) => !it.danger);\n const danger = items.filter((it): it is Extract<MenuItem, { danger: true }> => !!it.danger);\n const row = (it: MenuItem) => (\n <>\n {it.icon ? <IconOf icon={it.icon} size={16} /> : <span className=\"ui-menu-noicon\" />}\n <span className=\"ui-menu-label\">{it.label}</span>\n {it.shortcut ? <kbd className=\"ui-menu-kbd\">{it.shortcut}</kbd> : null}\n </>\n );\n return (\n <>\n <Base.Root>\n <Base.Trigger className={cx('ui-iconbtn', 'ui-menu-trigger', triggerClassName)} aria-label={label || tr('更多操作')}>\n <IconOf icon={icon} size={20} />\n </Base.Trigger>\n <Base.Portal>\n <Base.Positioner className=\"ui-float\" side=\"bottom\" align={align} sideOffset={4}>\n <Base.Popup className=\"ui-menu\">\n {normal.map((it, i) => (\n <Base.Item key={i} disabled={it.disabled} className=\"ui-menu-item\" onClick={() => it.onSelect?.()}>\n {row(it)}\n </Base.Item>\n ))}\n {danger.length && normal.length ? <Base.Separator className=\"ui-menu-sep\" /> : null}\n {danger.map((it, i) => (\n <Base.Item key={'d' + i} disabled={it.disabled} className=\"ui-menu-item is-danger\" onClick={() => setAsking(it)}>\n {row(it)}\n </Base.Item>\n ))}\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n </Base.Root>\n {danger.length ? (\n <Dialog\n open={!!asking}\n onClose={() => setAsking(null)}\n title={asking ? (asking.confirm?.title ?? tr('{label}?', { label: asking.label })) : ''}\n tone=\"danger\"\n confirmLabel={asking?.confirm?.confirmLabel ?? asking?.label ?? ''}\n onConfirm={() => {\n const it = asking;\n setAsking(null);\n it?.onSelect?.();\n }}\n >\n {asking?.confirm?.body}\n </Dialog>\n ) : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AAUA,aAAaA,kBAAW;;AAiCxB,SAAgBC,OA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yB,UAAU,GAAG;KAAU,WAAU;KAAyB,eAAe,UAAU,EAAE;KAC3G,UAAA,IAAI,EAAE;IACE,GAFK,MAAM,CAEX,CACZ;GACS;;CACG,CAAA,EACN,CAAA,CACJ,EAAA,CAAA,GACV,OAAO,SACN,oBAAC,QAAD;EACE,MAAM,CAAC,CAAC;EACR,eAAe,UAAU,IAAI;EAC7B,OAAO,SAAU,OAAO,SAAS,SAAS,GAAG,YAAY,EAAE,OAAO,OAAO,MAAM,CAAC,IAAK;EACrF,MAAK;EACL,cAAc,QAAQ,SAAS,gBAAgB,QAAQ,SAAS;EAChE,iBAAiB;GACf,MAAM,KAAK;GACX,UAAU,IAAI;GACd,IAAI,WAAW;EACjB;EAEC,UAAA,QAAQ,SAAS;CACZ,CAAA,IACN,IACJ,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"Menu.js","names":["phDotsThree","Menu","Base"],"sources":["../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as Base } from '@base-ui/react/menu';\nimport { tr } from '../../i18n';\nimport { IconOf, type IconSource } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { Dialog } from '../Dialog/Dialog';\nimport type { DangerConfirm } from '../Button/Button';\nimport { baseReason, useOpenState, type OpenStateProps } from '../../internal/open';\nimport { includeIcons } from '../../icons/store';\nimport phDotsThree from '../../icons/ph/dots-three';\n\nincludeIcons(phDotsThree);\n\ninterface MenuItemBase {\n /** A verb: 重新命名, 複製連結. */\n label: string;\n icon?: IconSource;\n /** Shown at the right, e.g. ⌘D. */\n shortcut?: string;\n disabled?: boolean;\n onSelect?: () => void;\n}\n\nexport type MenuItem =\n | (MenuItemBase & { danger?: false })\n | (MenuItemBase & {\n /** Red, last, after a divider. Must be confirmed: onSelect runs after the dialog. */\n danger: true;\n confirm: DangerConfirm;\n });\n\nexport interface MenuProps extends OpenStateProps {\n /** The actions; danger ones go last, in red, and are confirmed. */\n items: MenuItem[];\n /** aria-label and tooltip of the ⋯ button. Default 「更多操作」. */\n label?: string;\n /** Default 'dots-three'. */\n icon?: IconSource;\n /** 'end' lines up right edges (default); flips when the menu would leave the window. */\n align?: 'end' | 'start';\n /** Extra class on the ⋯ button. */\n triggerClassName?: string;\n}\n\n/** The ⋯ button and its list of actions. Danger items go last, in red, after a divider, and are confirmed. */\nexport function Menu({ items, label, icon = 'dots-three', align = 'end', triggerClassName, open: openProp, defaultOpen, onOpenChange }: MenuProps) {\n const [open, setOpen] = useOpenState({ open: openProp, defaultOpen, onOpenChange });\n const [asking, setAsking] = React.useState<Extract<MenuItem, { danger: true }> | null>(null);\n const normal = items.filter((it) => !it.danger);\n const danger = items.filter((it): it is Extract<MenuItem, { danger: true }> => !!it.danger);\n const row = (it: MenuItem) => (\n <>\n {it.icon ? <IconOf icon={it.icon} size={16} /> : <span className=\"ui-menu-noicon\" />}\n <span className=\"ui-menu-label\">{it.label}</span>\n {it.shortcut ? <kbd className=\"ui-menu-kbd\">{it.shortcut}</kbd> : null}\n </>\n );\n return (\n <>\n <Base.Root open={open} onOpenChange={(next, details) => setOpen(next, baseReason(details?.reason))}>\n <Base.Trigger className={cx('ui-iconbtn', 'ui-menu-trigger', triggerClassName)} aria-label={label || tr('更多操作')}>\n <IconOf icon={icon} size={20} />\n </Base.Trigger>\n <Base.Portal>\n <Base.Positioner className=\"ui-float\" side=\"bottom\" align={align} sideOffset={4}>\n <Base.Popup className=\"ui-menu\">\n {normal.map((it, i) => (\n <Base.Item key={i} disabled={it.disabled} className=\"ui-menu-item\" onClick={() => it.onSelect?.()}>\n {row(it)}\n </Base.Item>\n ))}\n {danger.length && normal.length ? <Base.Separator className=\"ui-menu-sep\" /> : null}\n {danger.map((it, i) => (\n <Base.Item key={'d' + i} disabled={it.disabled} className=\"ui-menu-item is-danger\" onClick={() => setAsking(it)}>\n {row(it)}\n </Base.Item>\n ))}\n </Base.Popup>\n </Base.Positioner>\n </Base.Portal>\n </Base.Root>\n {danger.length ? (\n <Dialog\n open={!!asking}\n onOpenChange={(o) => !o && setAsking(null)}\n title={asking ? (asking.confirm?.title ?? tr('{label}?', { label: asking.label })) : ''}\n tone=\"danger\"\n confirmLabel={asking?.confirm?.confirmLabel ?? asking?.label ?? ''}\n onConfirm={() => {\n const it = asking;\n setAsking(null);\n it?.onSelect?.();\n }}\n >\n {asking?.confirm?.body}\n </Dialog>\n ) : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,aAAaA,kBAAW;;AAkCxB,SAAgBC,OAAK,EAAE,OAAO,OAAO,OAAO,cAAc,QAAQ,OAAO,kBAAkB,MAAM,UAAU,aAAa,gBAA2B;CACjJ,MAAM,CAAC,MAAM,WAAW,aAAa;EAAE,MAAM;EAAU;EAAa;CAAa,CAAC;CAClF,MAAM,CAAC,QAAQ,aAAa,MAAM,SAAqD,IAAI;CAC3F,MAAM,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG,MAAM;CAC9C,MAAM,SAAS,MAAM,QAAQ,OAAkD,CAAC,CAAC,GAAG,MAAM;CAC1F,MAAM,OAAO,OACX,qBAAA,UAAA,EAAA,UAAA;EACG,GAAG,OAAO,oBAAC,QAAD;GAAQ,MAAM,GAAG;GAAM,MAAM;EAAK,CAAA,IAAI,oBAAC,QAAD,EAAM,WAAU,iBAAkB,CAAA;EACnF,oBAAC,QAAD;GAAM,WAAU;GAAiB,UAAA,GAAG;EAAY,CAAA;EAC/C,GAAG,WAAW,oBAAC,OAAD;GAAK,WAAU;GAAe,UAAA,GAAG;EAAc,CAAA,IAAI;CAClE,EAAA,CAAA;CAEJ,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,qBAACC,KAAK,MAAN;EAAiB;EAAM,eAAe,MAAM,YAAY,QAAQ,MAAM,WAAW,SAAS,MAAM,CAAC;EAAjG,UAAA,CACE,oBAACA,KAAK,SAAN;GAAc,WAAW,GAAG,cAAc,mBAAmB,gBAAgB;GAAG,cAAY,SAAS,GAAG,MAAM;GAC5G,UAAA,oBAAC,QAAD;IAAc;IAAM,MAAM;GAAK,CAAA;EACnB,CAAA,GACd,oBAACA,KAAK,QAAN,EAAA,UACE,oBAACA,KAAK,YAAN;GAAiB,WAAU;GAAW,MAAK;GAAgB;GAAO,YAAY;GAC5E,UAAA,qBAACA,KAAK,OAAN;IAAY,WAAU;IAAtB,UAAA;KACG,OAAO,KAAK,IAAI,MACf,oBAACA,KAAK,MAAN;MAAmB,UAAU,GAAG;MAAU,WAAU;MAAe,eAAe,GAAG,WAAW;MAC7F,UAAA,IAAI,EAAE;KACE,GAFK,CAEL,CACZ;KACA,OAAO,UAAU,OAAO,SAAS,oBAACA,KAAK,WAAN,EAAgB,WAAU,cAAe,CAAA,IAAI;KAC9E,OAAO,KAAK,IAAI,MACf,oBAACA,KAAK,MAAN;MAAyB,UAAU,GAAG;MAAU,WAAU;MAAyB,eAAe,UAAU,EAAE;MAC3G,UAAA,IAAI,EAAE;KACE,GAFK,MAAM,CAEX,CACZ;IACS;;EACG,CAAA,EACN,CAAA,CACJ;CACV,CAAA,GAAA,OAAO,SACN,oBAAC,QAAD;EACE,MAAM,CAAC,CAAC;EACR,eAAe,MAAM,CAAC,KAAK,UAAU,IAAI;EACzC,OAAO,SAAU,OAAO,SAAS,SAAS,GAAG,YAAY,EAAE,OAAO,OAAO,MAAM,CAAC,IAAK;EACrF,MAAK;EACL,cAAc,QAAQ,SAAS,gBAAgB,QAAQ,SAAS;EAChE,iBAAiB;GACf,MAAM,KAAK;GACX,UAAU,IAAI;GACd,IAAI,WAAW;EACjB;EAEC,UAAA,QAAQ,SAAS;CACZ,CAAA,IACN,IACJ,EAAA,CAAA;AAEN"}
@@ -2,8 +2,11 @@ import * as React from "react";
2
2
  export interface MeterProps {
3
3
  /** What is measured, e.g. 「A 區進氣溫度」; also the name screen readers hear. */
4
4
  label: string;
5
+ /** The current value. */
5
6
  value: number;
7
+ /** The low end of the scale. */
6
8
  min: number;
9
+ /** The high end of the scale. */
7
10
  max: number;
8
11
  /** From this value on the state is 「⚠ 注意」 (warning). Higher values are worse. */
9
12
  warn?: number;
@@ -13,6 +16,7 @@ export interface MeterProps {
13
16
  unit?: string;
14
17
  /** Decimals of the value and marks. Default 0. */
15
18
  decimals?: number;
19
+ /** Extra class on the root element. */
16
20
  className?: string;
17
21
  }
18
22
  /** A value against its levels: an 8 px bar shaded normal, watch and over the limit, a dot at the value, and the value
@@ -1 +1 @@
1
- {"version":3,"file":"Meter.js","names":[],"sources":["../../../src/components/Meter/Meter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { format } from '../../format';\nimport { tr } from '../../i18n';\n\nexport interface MeterProps {\n /** What is measured, e.g. 「A 區進氣溫度」; also the name screen readers hear. */\n label: string;\n value: number;\n min: number;\n max: number;\n /** From this value on the state is 「⚠ 注意」 (warning). Higher values are worse. */\n warn?: number;\n /** From this value on the state is 「⚠ 超過上限」 (danger). */\n limit?: number;\n /** After the value, e.g. '°C' or '%'. */\n unit?: string;\n /** Decimals of the value and marks. Default 0. */\n decimals?: number;\n className?: string;\n}\n\n/** A value against its levels: an 8 px bar shaded normal, watch and over the limit, a dot at the value, and the value\n * with its state in words above. Meters stacked in a card line up: the state and the value end at the same places. */\nexport function Meter({ label, value, min, max, warn, limit, unit, decimals = 0, className }: MeterProps) {\n const span = max - min || 1;\n const pct = (v: number) => Math.max(0, Math.min(100, ((v - min) / span) * 100));\n const tone = limit != null && value >= limit ? 'danger' : warn != null && value >= warn ? 'warning' : 'success';\n const state = tone === 'danger' ? tr('⚠ 超過上限') : tone === 'warning' ? tr('⚠ 注意') : tr('正常');\n const num = (v: number) => format.number(v, decimals) + (unit ? ' ' + unit : '');\n // Marks keep the decimals they were given (27, 27.5), not the value's.\n const markNum = (v: number) => format.number(v, (String(v).split('.')[1] ?? '').length);\n const marksRef = React.useRef<HTMLDivElement>(null);\n const [stack, setStack] = React.useState(false);\n const w = warn != null ? pct(warn) : null;\n const l = limit != null ? pct(limit) : null;\n // Shaded stretches: normal up to warn, watch up to limit, over the limit after.\n const stops = [\n ['var(--meter-ok)', 0, w ?? l ?? 100],\n ...(w != null ? [['var(--meter-warn)', w, l ?? 100]] : []),\n ...(l != null ? [['var(--meter-over)', l, 100]] : []),\n ] as [string, number, number][];\n const marks = [\n ...(warn != null ? [{ v: warn, at: w as number, tone: 'warning', text: tr('注意 {v}', { v: markNum(warn) }) }] : []),\n ...(limit != null ? [{ v: limit, at: l as number, tone: 'danger', text: tr('上限 {v}', { v: markNum(limit) }) }] : []),\n ];\n // The watch label ends at its mark and the limit label starts at its own; when they still meet (marks close\n // together, or the limit near the end), the limit label moves to a second line.\n React.useLayoutEffect(() => {\n const box = marksRef.current;\n if (!box) return;\n const check = () => {\n const [a, b] = [...box.children].map((c) => c.getBoundingClientRect());\n setStack(!!a && !!b && a.right + 8 > b.left && a.left < b.right + 8);\n };\n check();\n const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(check) : null;\n ro?.observe(box);\n return () => ro?.disconnect();\n }, [warn, limit, min, max]);\n return (\n <div\n className={cx('ui-meter', className)}\n role=\"meter\"\n aria-label={label}\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuetext={num(value) + tr(',') + state.replace('⚠ ', '') + marks.map((m) => tr(',') + m.text).join('')}\n >\n <div className=\"ui-meter-head\" aria-hidden=\"true\">\n <span className=\"ui-meter-label\">{label}</span>\n <span className={'ui-meter-state is-' + tone}>{state}</span>\n <span className=\"ui-meter-value\">{num(value)}</span>\n </div>\n <div\n className=\"ui-meter-track\"\n aria-hidden=\"true\"\n style={{ background: `linear-gradient(90deg, ${stops.map(([c, a, b]) => `${c} ${a}% ${b}%`).join(', ')})` } as React.CSSProperties}\n >\n {marks.map((m) => (\n <span key={m.tone} className={'ui-meter-mark is-' + m.tone} style={{ left: m.at + '%' }} />\n ))}\n <span className={'ui-meter-dot is-' + tone} style={{ left: pct(value) + '%' }} />\n </div>\n {marks.length ? (\n <div ref={marksRef} className={cx('ui-meter-marks', stack && 'is-stacked')} aria-hidden=\"true\">\n {marks.map((m) => (\n <span\n key={m.tone}\n className={'is-' + m.tone}\n style={m.tone === 'warning' && marks.length > 1 ? { right: 100 - m.at + '%' } : m.at > 80 ? { right: 0 } : { left: m.at + '%' }}\n >\n {m.text}\n </span>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAgB,MAAM,EAAE,OAAO,OAAO,KAAK,KAAK,MAAM,OAAO,MAAM,WAAW,GAAG,aAAyB;CACxG,MAAM,OAAO,MAAM,OAAO;CAC1B,MAAM,OAAO,MAAc,KAAK,IAAI,GAAG,KAAK,IAAI,MAAO,IAAI,OAAO,OAAQ,GAAG,CAAC;CAC9E,MAAM,OAAO,SAAS,QAAQ,SAAS,QAAQ,WAAW,QAAQ,QAAQ,SAAS,OAAO,YAAY;CACtG,MAAM,QAAQ,SAAS,WAAW,GAAG,QAAQ,IAAI,SAAS,YAAY,GAAG,MAAM,IAAI,GAAG,IAAI;CAC1F,MAAM,OAAO,MAAc,OAAO,OAAO,GAAG,QAAQ,KAAK,OAAO,MAAM,OAAO;CAE7E,MAAM,WAAW,MAAc,OAAO,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI,MAAM;CACtF,MAAM,WAAW,MAAM,OAAuB,IAAI;CAClD,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,KAAK;CAC9C,MAAM,IAAI,QAAQ,OAAO,IAAI,IAAI,IAAI;CACrC,MAAM,IAAI,SAAS,OAAO,IAAI,KAAK,IAAI;CAEvC,MAAM,QAAQ;EACZ;GAAC;GAAmB;GAAG,KAAK,KAAK;EAAG;EACpC,GAAI,KAAK,OAAO,CAAC;GAAC;GAAqB;GAAG,KAAK;EAAG,CAAC,IAAI,CAAC;EACxD,GAAI,KAAK,OAAO,CAAC;GAAC;GAAqB;GAAG;EAAG,CAAC,IAAI,CAAC;CACrD;CACA,MAAM,QAAQ,CACZ,GAAI,QA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3D,oBAAC,QAAD;MAAM,WAAU;MAAkB,UAAA,IAAI,KAAK;KAAQ,CAAA;IAChD;;GACL,qBAAC,OAAD;IACE,WAAU;IACV,eAAY;IACZ,OAAO,EAAE,YAAY,0BAA0B,MAAM,KAAK,CAAC,GAAG,GAAG,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,GAAG;IAH5G,UAAA,CAKG,MAAM,KAAK,MACV,oBAAC,QAAD;KAAmB,WAAW,sBAAsB,EAAE;KAAM,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI;IAAI,GAA/E,EAAE,IAA6E,CAC3F,GACD,oBAAC,QAAD;KAAM,WAAW,qBAAqB;KAAM,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,IAAI;IAAI,CAAA,CAC7E;;GACJ,MAAM,SACL,oBAAC,OAAD;IAAK,KAAK;IAAU,WAAW,GAAG,kBAAkB,SAAS,YAAY;IAAG,eAAY;IACrF,UAAA,MAAM,KAAK,MACV,oBAAC,QAAD;KAEE,WAAW,QAAQ,EAAE;KACrB,OAAO,EAAE,SAAS,aAAa,MAAM,SAAS,IAAI,EAAE,OAAO,MAAM,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;KAE7H,UAAA,EAAE;IACC,GALC,EAAE,IAKH,CACP;GACE,CAAA,IACH;EACD;;AAET"}
1
+ {"version":3,"file":"Meter.js","names":[],"sources":["../../../src/components/Meter/Meter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { format } from '../../format';\nimport { tr } from '../../i18n';\n\nexport interface MeterProps {\n /** What is measured, e.g. 「A 區進氣溫度」; also the name screen readers hear. */\n label: string;\n /** The current value. */\n value: number;\n /** The low end of the scale. */\n min: number;\n /** The high end of the scale. */\n max: number;\n /** From this value on the state is 「⚠ 注意」 (warning). Higher values are worse. */\n warn?: number;\n /** From this value on the state is 「⚠ 超過上限」 (danger). */\n limit?: number;\n /** After the value, e.g. '°C' or '%'. */\n unit?: string;\n /** Decimals of the value and marks. Default 0. */\n decimals?: number;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** A value against its levels: an 8 px bar shaded normal, watch and over the limit, a dot at the value, and the value\n * with its state in words above. Meters stacked in a card line up: the state and the value end at the same places. */\nexport function Meter({ label, value, min, max, warn, limit, unit, decimals = 0, className }: MeterProps) {\n const span = max - min || 1;\n const pct = (v: number) => Math.max(0, Math.min(100, ((v - min) / span) * 100));\n const tone = limit != null && value >= limit ? 'danger' : warn != null && value >= warn ? 'warning' : 'success';\n const state = tone === 'danger' ? tr('⚠ 超過上限') : tone === 'warning' ? tr('⚠ 注意') : tr('正常');\n const num = (v: number) => format.number(v, decimals) + (unit ? ' ' + unit : '');\n // Marks keep the decimals they were given (27, 27.5), not the value's.\n const markNum = (v: number) => format.number(v, (String(v).split('.')[1] ?? '').length);\n const marksRef = React.useRef<HTMLDivElement>(null);\n const [stack, setStack] = React.useState(false);\n const w = warn != null ? pct(warn) : null;\n const l = limit != null ? pct(limit) : null;\n // Shaded stretches: normal up to warn, watch up to limit, over the limit after.\n const stops = [\n ['var(--meter-ok)', 0, w ?? l ?? 100],\n ...(w != null ? [['var(--meter-warn)', w, l ?? 100]] : []),\n ...(l != null ? [['var(--meter-over)', l, 100]] : []),\n ] as [string, number, number][];\n const marks = [\n ...(warn != null ? [{ v: warn, at: w as number, tone: 'warning', text: tr('注意 {v}', { v: markNum(warn) }) }] : []),\n ...(limit != null ? [{ v: limit, at: l as number, tone: 'danger', text: tr('上限 {v}', { v: markNum(limit) }) }] : []),\n ];\n // The watch label ends at its mark and the limit label starts at its own; when they still meet (marks close\n // together, or the limit near the end), the limit label moves to a second line.\n React.useLayoutEffect(() => {\n const box = marksRef.current;\n if (!box) return;\n const check = () => {\n const [a, b] = [...box.children].map((c) => c.getBoundingClientRect());\n setStack(!!a && !!b && a.right + 8 > b.left && a.left < b.right + 8);\n };\n check();\n const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(check) : null;\n ro?.observe(box);\n return () => ro?.disconnect();\n }, [warn, limit, min, max]);\n return (\n <div\n className={cx('ui-meter', className)}\n role=\"meter\"\n aria-label={label}\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuetext={num(value) + tr(',') + state.replace('⚠ ', '') + marks.map((m) => tr(',') + m.text).join('')}\n >\n <div className=\"ui-meter-head\" aria-hidden=\"true\">\n <span className=\"ui-meter-label\">{label}</span>\n <span className={'ui-meter-state is-' + tone}>{state}</span>\n <span className=\"ui-meter-value\">{num(value)}</span>\n </div>\n <div\n className=\"ui-meter-track\"\n aria-hidden=\"true\"\n style={{ background: `linear-gradient(90deg, ${stops.map(([c, a, b]) => `${c} ${a}% ${b}%`).join(', ')})` } as React.CSSProperties}\n >\n {marks.map((m) => (\n <span key={m.tone} className={'ui-meter-mark is-' + m.tone} style={{ left: m.at + '%' }} />\n ))}\n <span className={'ui-meter-dot is-' + tone} style={{ left: pct(value) + '%' }} />\n </div>\n {marks.length ? (\n <div ref={marksRef} className={cx('ui-meter-marks', stack && 'is-stacked')} aria-hidden=\"true\">\n {marks.map((m) => (\n <span\n key={m.tone}\n className={'is-' + m.tone}\n style={m.tone === 'warning' && marks.length > 1 ? { right: 100 - m.at + '%' } : m.at > 80 ? { right: 0 } : { left: m.at + '%' }}\n >\n {m.text}\n </span>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,MAAM,EAAE,OAAO,OAAO,KAAK,KAAK,MAAM,OAAO,MAAM,WAAW,GAAG,aAAyB;CACxG,MAAM,OAAO,MAAM,OAAO;CAC1B,MAAM,OAAO,MAAc,KAAK,IAAI,GAAG,KAAK,IAAI,MAAO,IAAI,OAAO,OAAQ,GAAG,CAAC;CAC9E,MAAM,OAAO,SAAS,QAAQ,SAAS,QAAQ,WAAW,QAAQ,QAAQ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AAI,IAAI;IAAI,CAAA,CAC7E;;GACJ,MAAM,SACL,oBAAC,OAAD;IAAK,KAAK;IAAU,WAAW,GAAG,kBAAkB,SAAS,YAAY;IAAG,eAAY;IACrF,UAAA,MAAM,KAAK,MACV,oBAAC,QAAD;KAEE,WAAW,QAAQ,EAAE;KACrB,OAAO,EAAE,SAAS,aAAa,MAAM,SAAS,IAAI,EAAE,OAAO,MAAM,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;KAE7H,UAAA,EAAE;IACC,GALC,EAAE,IAKH,CACP;GACE,CAAA,IACH;EACD;;AAET"}
@@ -8,13 +8,16 @@ export interface MobileTab {
8
8
  export interface MobileTabBarProps {
9
9
  /** 3 to 5 top-level pages. */
10
10
  items: MobileTab[];
11
+ /** The id of the selected tab. */
11
12
  value: string;
13
+ /** Called with the id of the tab the person picks. */
12
14
  onChange?: (id: string) => void;
13
15
  /** Default 「主要導覽」. */
14
16
  label?: string;
15
17
  /** Default true: an 11 px label under each icon (MA). false: icons only, each named by its aria-label, as in
16
18
  * photo apps, for a bar whose icons people already know. */
17
19
  labels?: boolean;
20
+ /** Extra class on the root element. */
18
21
  className?: string;
19
22
  }
20
23
  /** Bottom navigation on phones, in place of the sidebar. The pill slides like a droplet; the selected icon is filled. */
@@ -1 +1 @@
1
- {"version":3,"file":"MobileTabBar.js","names":[],"sources":["../../../src/components/MobileTabBar/MobileTabBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { IconOf, type IconSource } from '../../icons/Icon';\nimport { dropTransition } from '../../motion';\nimport { cx } from '../../internal/util';\n\nexport interface MobileTab {\n id: string;\n label: string;\n icon: IconSource;\n}\n\nexport interface MobileTabBarProps {\n /** 3 to 5 top-level pages. */\n items: MobileTab[];\n value: string;\n onChange?: (id: string) => void;\n /** Default 「主要導覽」. */\n label?: string;\n /** Default true: an 11 px label under each icon (MA). false: icons only, each named by its aria-label, as in\n * photo apps, for a bar whose icons people already know. */\n labels?: boolean;\n className?: string;\n}\n\n/** Bottom navigation on phones, in place of the sidebar. The pill slides like a droplet; the selected icon is filled. */\nexport function MobileTabBar({ items, value, onChange, label, labels = true, className }: MobileTabBarProps) {\n const idx = Math.max(\n 0,\n items.findIndex((t) => t.id === value),\n );\n const [forward, setForward] = React.useState(true);\n const w = 100 / Math.max(1, items.length);\n return (\n <nav className={cx('ui-tabbar', labels && 'has-labels', className)} aria-label={label || tr('主要導覽')}>\n <span\n className=\"ui-tabbar-pill\"\n aria-hidden=\"true\"\n style={{\n left: `calc(${idx * w + w / 2}% - 28px)`,\n right: `calc(${100 - idx * w - w / 2}% - 28px)`,\n transition: dropTransition('left', 'right', forward),\n }}\n />\n {items.map((t, i) => (\n <button\n key={t.id}\n type=\"button\"\n className={cx('ui-tabbar-item', i === idx && 'is-selected')}\n // With labels the text names the button; without, aria-label does.\n aria-label={labels ? undefined : t.label}\n aria-current={i === idx ? 'page' : undefined}\n onClick={() => {\n // The selected tab still reports a press: a tab like 「更多」 opens something each time.\n if (i !== idx) setForward(i > idx);\n onChange?.(t.id);\n }}\n >\n <IconOf icon={t.icon} size={22} filled={i === idx} />\n {labels ? <span className=\"ui-tabbar-label\">{t.label}</span> : null}\n </button>\n ))}\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,aAAa,EAAE,OAAO,OAAO,UAAU,OAAO,SAAS,MAAM,aAAgC;CAC3G,MAAM,MAAM,KAAK,IACf,GACA,MAAM,WAAW,MAAM,EAAE,OAAO,KAAK,CACvC;CACA,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,IAAI;CACjD,MAAM,IAAI,MAAM,KAAK,IAAI,GAAG,MAAM,MAAM;CACxC,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,aAAa,UAAU,cAAc,SAAS;EAAG,cAAY,SAAS,GAAG,MAAM;EAAlG,UAAA,CACE,oBAAC,QAAD;GACE,WAAU;GACV,eAAY;GACZ,OAAO;IACL,MAAM,QAAQ,MAAM,IAAI,IAAI,EAAE;IAC9B,OAAO,QAAQ,MAAM,MAAM,IAAI,IAAI,EAAE;IACrC,YAAY,eAAe,QAAQ,SAAS,OAAO;GACrD;EACD,CAAA,GACA,MAAM,KAAK,GAAG,MACb,qBAAC,UAAD;GAEE,MAAK;GACL,WAAW,GAAG,kBAAkB,MAAM,OAAO,aAAa;GAE1D,cAAY,SAAS,KAAA,IAAY,EAAE;GACnC,gBAAc,MAAM,MAAM,SAAS,KAAA;GACnC,eAAe;IAEb,IAAI,MAAM,KAAK,WAAW,IAAI,GAAG;IACjC,WAAW,EAAE,EAAE;GACjB;GAXF,UAAA,CAaE,oBAAC,QAAD;IAAQ,MAAM,EAAE;IAAM,MAAM;IAAI,QAAQ,MAAM;GAAM,CAAA,GACnD,SAAS,oBAAC,QAAD;IAAM,WAAU;IAAmB,UAAA,EAAE;GAAY,CAAA,IAAI,IACzD;EAdD,GAAA,EAAE,EAcD,CACT,CACE;;AAET"}
1
+ {"version":3,"file":"MobileTabBar.js","names":[],"sources":["../../../src/components/MobileTabBar/MobileTabBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { IconOf, type IconSource } from '../../icons/Icon';\nimport { dropTransition } from '../../motion';\nimport { cx } from '../../internal/util';\n\nexport interface MobileTab {\n id: string;\n label: string;\n icon: IconSource;\n}\n\nexport interface MobileTabBarProps {\n /** 3 to 5 top-level pages. */\n items: MobileTab[];\n /** The id of the selected tab. */\n value: string;\n /** Called with the id of the tab the person picks. */\n onChange?: (id: string) => void;\n /** Default 「主要導覽」. */\n label?: string;\n /** Default true: an 11 px label under each icon (MA). false: icons only, each named by its aria-label, as in\n * photo apps, for a bar whose icons people already know. */\n labels?: boolean;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** Bottom navigation on phones, in place of the sidebar. The pill slides like a droplet; the selected icon is filled. */\nexport function MobileTabBar({ items, value, onChange, label, labels = true, className }: MobileTabBarProps) {\n const idx = Math.max(\n 0,\n items.findIndex((t) => t.id === value),\n );\n const [forward, setForward] = React.useState(true);\n const w = 100 / Math.max(1, items.length);\n return (\n <nav className={cx('ui-tabbar', labels && 'has-labels', className)} aria-label={label || tr('主要導覽')}>\n <span\n className=\"ui-tabbar-pill\"\n aria-hidden=\"true\"\n style={{\n left: `calc(${idx * w + w / 2}% - 28px)`,\n right: `calc(${100 - idx * w - w / 2}% - 28px)`,\n transition: dropTransition('left', 'right', forward),\n }}\n />\n {items.map((t, i) => (\n <button\n key={t.id}\n type=\"button\"\n className={cx('ui-tabbar-item', i === idx && 'is-selected')}\n // With labels the text names the button; without, aria-label does.\n aria-label={labels ? undefined : t.label}\n aria-current={i === idx ? 'page' : undefined}\n onClick={() => {\n // The selected tab still reports a press: a tab like 「更多」 opens something each time.\n if (i !== idx) setForward(i > idx);\n onChange?.(t.id);\n }}\n >\n <IconOf icon={t.icon} size={22} filled={i === idx} />\n {labels ? <span className=\"ui-tabbar-label\">{t.label}</span> : null}\n </button>\n ))}\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;AA6BA,SAAgB,aAAa,EAAE,OAAO,OAAO,UAAU,OAAO,SAAS,MAAM,aAAgC;CAC3G,MAAM,MAAM,KAAK,IACf,GACA,MAAM,WAAW,MAAM,EAAE,OAAO,KAAK,CACvC;CACA,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,IAAI;CACjD,MAAM,IAAI,MAAM,KAAK,IAAI,GAAG,MAAM,MAAM;CACxC,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,aAAa,UAAU,cAAc,SAAS;EAAG,cAAY,SAAS,GAAG,MAAM;EAAlG,UAAA,CACE,oBAAC,QAAD;GACE,WAAU;GACV,eAAY;GACZ,OAAO;IACL,MAAM,QAAQ,MAAM,IAAI,IAAI,EAAE;IAC9B,OAAO,QAAQ,MAAM,MAAM,IAAI,IAAI,EAAE;IACrC,YAAY,eAAe,QAAQ,SAAS,OAAO;GACrD;EACD,CAAA,GACA,MAAM,KAAK,GAAG,MACb,qBAAC,UAAD;GAEE,MAAK;GACL,WAAW,GAAG,kBAAkB,MAAM,OAAO,aAAa;GAE1D,cAAY,SAAS,KAAA,IAAY,EAAE;GACnC,gBAAc,MAAM,MAAM,SAAS,KAAA;GACnC,eAAe;IAEb,IAAI,MAAM,KAAK,WAAW,IAAI,GAAG;IACjC,WAAW,EAAE,EAAE;GACjB;GAXF,UAAA,CAaE,oBAAC,QAAD;IAAQ,MAAM,EAAE;IAAM,MAAM;IAAI,QAAQ,MAAM;GAAM,CAAA,GACnD,SAAS,oBAAC,QAAD;IAAM,WAAU;IAAmB,UAAA,EAAE;GAAY,CAAA,IAAI,IACzD;EAdD,GAAA,EAAE,EAcD,CACT,CACE;;AAET"}
@@ -1,12 +1,15 @@
1
+ import { FieldProps } from "../../internal/Field.js";
1
2
  import * as React from "react";
2
3
  export interface MultiSelectOption {
3
4
  value: string;
4
5
  label: string;
5
6
  }
6
- export interface MultiSelectProps {
7
- label?: string;
7
+ export interface MultiSelectProps extends FieldProps {
8
+ /** The options, each { value, label }. */
8
9
  options: MultiSelectOption[];
10
+ /** The chosen values, in the order they were picked. */
9
11
  value: string[];
12
+ /** Receives every chosen value after a change. */
10
13
  onChange: (value: string[]) => void;
11
14
  /** Allow adding values that are not in options (Enter, or the 「新增」 row). */
12
15
  creatable?: boolean;
@@ -16,10 +19,8 @@ export interface MultiSelectProps {
16
19
  placeholder?: string;
17
20
  /** Default 「找不到符合的選項」. */
18
21
  emptyText?: string;
19
- /** The cause and the fix (「至少選一個標籤」). Red border, the warning icon and this line under the field, announced when
20
- * it appears. */
21
- error?: string;
22
+ /** Extra class on the root element. */
22
23
  className?: string;
23
24
  }
24
25
  /** Pick several options: chips inside the field, type to filter, Backspace removes the last chip. */
25
- export declare function MultiSelect({ label, options, value, onChange, creatable, maxChips, placeholder, emptyText, error, className }: MultiSelectProps): React.JSX.Element;
26
+ export declare function MultiSelect({ label, hideLabel, hint, error, required, disabled, name, options, value, onChange, creatable, maxChips, placeholder, emptyText, className }: MultiSelectProps): React.JSX.Element;
@@ -12,7 +12,7 @@ import { Combobox } from "@base-ui/react/combobox";
12
12
  includeIcons(x_default);
13
13
  const CREATE = "\0create:";
14
14
  /** Pick several options: chips inside the field, type to filter, Backspace removes the last chip. */
15
- function MultiSelect({ label, options, value, onChange, creatable, maxChips = 2, placeholder, emptyText, error, className }) {
15
+ function MultiSelect({ label, hideLabel, hint, error, required, disabled, name, options, value, onChange, creatable, maxChips = 2, placeholder, emptyText, className }) {
16
16
  const id = React.useId();
17
17
  const [query, setQuery] = React.useState("");
18
18
  const labels = React.useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);
@@ -27,14 +27,20 @@ function MultiSelect({ label, options, value, onChange, creatable, maxChips = 2,
27
27
  const shown = value.slice(0, maxChips);
28
28
  const more = value.length - shown.length;
29
29
  return /* @__PURE__ */ jsxs("div", {
30
- className: cx("ui-field", error && "has-error", className),
30
+ className: cx("ui-field", error && "has-error", disabled && "is-disabled", className),
31
31
  children: [
32
- label ? /* @__PURE__ */ jsx(FieldLabel, {
32
+ /* @__PURE__ */ jsx(FieldLabel, {
33
33
  htmlFor: id,
34
+ id: id + "-label",
35
+ required,
36
+ hidden: hideLabel,
34
37
  children: label
35
- }) : null,
38
+ }),
36
39
  /* @__PURE__ */ jsxs(Combobox.Root, {
37
40
  multiple: true,
41
+ name,
42
+ disabled,
43
+ required,
38
44
  autoHighlight: true,
39
45
  items,
40
46
  value,
@@ -62,16 +68,27 @@ function MultiSelect({ label, options, value, onChange, creatable, maxChips = 2,
62
68
  })
63
69
  })]
64
70
  }, v)),
65
- more > 0 ? /* @__PURE__ */ jsx("span", {
71
+ more > 0 ? /* @__PURE__ */ jsxs("span", {
66
72
  className: "ui-chip-more",
67
- title: value.slice(maxChips).map(labelOf).join("、"),
68
- children: "+" + more
73
+ title: value.slice(maxChips).map(labelOf).join(tr("、")),
74
+ children: [/* @__PURE__ */ jsx("span", {
75
+ "aria-hidden": "true",
76
+ children: "+" + more
77
+ }), /* @__PURE__ */ jsx("span", {
78
+ className: "ui-visually-hidden",
79
+ children: tr("另外 {n} 個:{list}", {
80
+ n: more,
81
+ list: value.slice(maxChips).map(labelOf).join(tr("、"))
82
+ })
83
+ })]
69
84
  }) : null,
70
85
  /* @__PURE__ */ jsx(Combobox.Input, {
71
86
  id,
87
+ "aria-labelledby": id + "-label",
72
88
  className: "ui-ms-input",
73
89
  "aria-invalid": error ? true : void 0,
74
- "aria-describedby": error ? id + "-err" : void 0,
90
+ "aria-required": required || void 0,
91
+ "aria-describedby": error || hint ? id + "-err" : void 0,
75
92
  placeholder: value.length ? "" : placeholder || tr("搜尋"),
76
93
  onKeyDown: (e) => {
77
94
  if (e.key === "Backspace" && !query && value.length) {
@@ -109,7 +126,8 @@ function MultiSelect({ label, options, value, onChange, creatable, maxChips = 2,
109
126
  }),
110
127
  /* @__PURE__ */ jsx(FieldMessage, {
111
128
  id: id + "-err",
112
- error
129
+ error,
130
+ hint
113
131
  })
114
132
  ]
115
133
  });
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.js","names":["phX"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Combobox } from '@base-ui/react/combobox';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { CheckMark, FieldErrorIcon, FieldLabel, FieldMessage } from '../../internal/Field';\nimport { includeIcons } from '../../icons/store';\nimport phX from '../../icons/ph/x';\n\nincludeIcons(phX);\n\nexport interface MultiSelectOption {\n value: string;\n label: string;\n}\n\nexport interface MultiSelectProps {\n label?: string;\n options: MultiSelectOption[];\n value: string[];\n onChange: (value: string[]) => void;\n /** Allow adding values that are not in options (Enter, or the 「新增」 row). */\n creatable?: boolean;\n /** Chips shown before 「+n」. Default 2. */\n maxChips?: number;\n /** Default 「搜尋」. */\n placeholder?: string;\n /** Default 「找不到符合的選項」. */\n emptyText?: string;\n /** The cause and the fix (「至少選一個標籤」). Red border, the warning icon and this line under the field, announced when\n * it appears. */\n error?: string;\n className?: string;\n}\n\nconst CREATE = '\\u0000create:';\n\n/** Pick several options: chips inside the field, type to filter, Backspace removes the last chip. */\nexport function MultiSelect({ label, options, value, onChange, creatable, maxChips = 2, placeholder, emptyText, error, className }: MultiSelectProps) {\n const id = React.useId();\n const [query, setQuery] = React.useState('');\n const labels = React.useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);\n const labelOf = (v: string) => (v.startsWith(CREATE) ? tr('新增「{q}」', { q: v.slice(CREATE.length) }) : (labels.get(v) ?? v));\n const q = query.trim();\n const exists = options.some((o) => o.label === q) || value.includes(q);\n const items = [...options.map((o) => o.value), ...value.filter((v) => !labels.has(v)), ...(creatable && q && !exists ? [CREATE + q] : [])];\n const shown = value.slice(0, maxChips);\n const more = value.length - shown.length;\n return (\n <div className={cx('ui-field', error && 'has-error', className)}>\n {label ? <FieldLabel htmlFor={id}>{label}</FieldLabel> : null}\n <Combobox.Root\n multiple\n autoHighlight\n items={items}\n value={value}\n inputValue={query}\n onInputValueChange={setQuery}\n itemToStringLabel={labelOf}\n onValueChange={(next: string[]) => {\n onChange(next.map((v) => (v.startsWith(CREATE) ? v.slice(CREATE.length) : v)));\n setQuery('');\n }}\n >\n <Combobox.InputGroup className={cx('ui-ms', error && 'is-invalid')}>\n <Combobox.Chips className=\"ui-ms-chips\">\n {shown.map((v) => (\n <Combobox.Chip key={v} className=\"ui-chip\" aria-label={labelOf(v)}>\n {labelOf(v)}\n <Combobox.ChipRemove className=\"ui-chip-x\" aria-label={tr('移除 {name}', { name: labelOf(v) })}>\n <Icon name=\"x\" size={12} />\n </Combobox.ChipRemove>\n </Combobox.Chip>\n ))}\n {more > 0 ? (\n <span className=\"ui-chip-more\" title={value.slice(maxChips).map(labelOf).join('、')}>\n {'+' + more}\n </span>\n ) : null}\n <Combobox.Input\n id={id}\n className=\"ui-ms-input\"\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? id + '-err' : undefined}\n placeholder={value.length ? '' : placeholder || tr('搜尋')}\n onKeyDown={(e) => {\n // Hidden chips (+n) still count: Backspace removes the last value, not the last visible chip.\n if (e.key === 'Backspace' && !query && value.length) {\n e.preventBaseUIHandler();\n onChange(value.slice(0, -1));\n }\n }}\n />\n </Combobox.Chips>\n {error ? <FieldErrorIcon inline /> : null}\n </Combobox.InputGroup>\n <Combobox.Portal>\n <Combobox.Positioner className=\"ui-float is-match\" align=\"start\" sideOffset={6}>\n <Combobox.Popup className=\"ui-select-menu ui-ms-menu\">\n <Combobox.Empty className=\"ui-select-empty\">{emptyText || tr('找不到符合的選項')}</Combobox.Empty>\n <Combobox.List>\n {(v: string) =>\n v.startsWith(CREATE) ? (\n <Combobox.Item key={v} value={v} className=\"ui-select-opt ui-ms-create\">\n {labelOf(v)}\n </Combobox.Item>\n ) : (\n <Combobox.Item key={v} value={v} className={cx('ui-select-opt', 'ui-ms-opt', value.includes(v) && 'is-on')}>\n <span className={cx('ui-check-box', value.includes(v) && 'is-on')} aria-hidden=\"true\">\n <CheckMark v={value.includes(v)} />\n </span>\n <span>{labelOf(v)}</span>\n </Combobox.Item>\n )\n }\n </Combobox.List>\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n <FieldMessage id={id + '-err'} error={error} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AASA,aAAaA,SAAG;AA0BhB,MAAM,SAAS;;AAGf,SAAgB,YAAY,EAAE,OAAO,SAAS,OAAO,UAAU,WAAW,WAAW,GAAG,aAAa,WAAW,OAAO,aAA+B;CACpJ,MAAM,KAAK,MAAM,MAAM;CACvB,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,EAAE;CAC3C,MAAM,SAAS,MAAM,cAAc,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;CAC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MAAM,SAAS,CAAC,KAAK,OAAO;QAAG,eAAY;QAC7E,UAAA,oBAAC,WAAD,EAAW,GAAG,MAAM,SAAS,CAAC,EAAI,CAAA;OAC9B,CAAA,GACN,oBAAC,QAAD,EAAA,UAAO,QAAQ,CAAC,EAAQ,CAAA,CACX;MALK,GAAA,CAKL,EAGN,CAAA,CACD;;IACG,CAAA,EACN,CAAA,CACJ;;GACf,oBAAC,cAAD;IAAc,IAAI,KAAK;IAAe;GAAQ,CAAA;EAC3C;;AAET"}
1
+ {"version":3,"file":"MultiSelect.js","names":["phX"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Combobox } from '@base-ui/react/combobox';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { CheckMark, FieldErrorIcon, FieldLabel, FieldMessage, type FieldProps } from '../../internal/Field';\nimport { includeIcons } from '../../icons/store';\nimport phX from '../../icons/ph/x';\n\nincludeIcons(phX);\n\nexport interface MultiSelectOption {\n value: string;\n label: string;\n}\n\nexport interface MultiSelectProps extends FieldProps {\n /** The options, each { value, label }. */\n options: MultiSelectOption[];\n /** The chosen values, in the order they were picked. */\n value: string[];\n /** Receives every chosen value after a change. */\n onChange: (value: string[]) => void;\n /** Allow adding values that are not in options (Enter, or the 「新增」 row). */\n creatable?: boolean;\n /** Chips shown before 「+n」. Default 2. */\n maxChips?: number;\n /** Default 「搜尋」. */\n placeholder?: string;\n /** Default 「找不到符合的選項」. */\n emptyText?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\nconst CREATE = '\\u0000create:';\n\n/** Pick several options: chips inside the field, type to filter, Backspace removes the last chip. */\nexport function MultiSelect({\n label,\n hideLabel,\n hint,\n error,\n required,\n disabled,\n name,\n options,\n value,\n onChange,\n creatable,\n maxChips = 2,\n placeholder,\n emptyText,\n className,\n}: MultiSelectProps) {\n const id = React.useId();\n const [query, setQuery] = React.useState('');\n const labels = React.useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);\n const labelOf = (v: string) => (v.startsWith(CREATE) ? tr('新增「{q}」', { q: v.slice(CREATE.length) }) : (labels.get(v) ?? v));\n const q = query.trim();\n const exists = options.some((o) => o.label === q) || value.includes(q);\n const items = [...options.map((o) => o.value), ...value.filter((v) => !labels.has(v)), ...(creatable && q && !exists ? [CREATE + q] : [])];\n const shown = value.slice(0, maxChips);\n const more = value.length - shown.length;\n return (\n <div className={cx('ui-field', error && 'has-error', disabled && 'is-disabled', className)}>\n <FieldLabel htmlFor={id} id={id + '-label'} required={required} hidden={hideLabel}>\n {label}\n </FieldLabel>\n <Combobox.Root\n multiple\n name={name}\n disabled={disabled}\n required={required}\n autoHighlight\n items={items}\n value={value}\n inputValue={query}\n onInputValueChange={setQuery}\n itemToStringLabel={labelOf}\n onValueChange={(next: string[]) => {\n onChange(next.map((v) => (v.startsWith(CREATE) ? v.slice(CREATE.length) : v)));\n setQuery('');\n }}\n >\n <Combobox.InputGroup className={cx('ui-ms', error && 'is-invalid')}>\n <Combobox.Chips className=\"ui-ms-chips\">\n {shown.map((v) => (\n <Combobox.Chip key={v} className=\"ui-chip\" aria-label={labelOf(v)}>\n {labelOf(v)}\n <Combobox.ChipRemove className=\"ui-chip-x\" aria-label={tr('移除 {name}', { name: labelOf(v) })}>\n <Icon name=\"x\" size={12} />\n </Combobox.ChipRemove>\n </Combobox.Chip>\n ))}\n {more > 0 ? (\n // Seen as 「+3」; read as 「另外 3 個:…」 with the names the chips leave out.\n <span className=\"ui-chip-more\" title={value.slice(maxChips).map(labelOf).join(tr('、'))}>\n <span aria-hidden=\"true\">{'+' + more}</span>\n <span className=\"ui-visually-hidden\">{tr('另外 {n} 個:{list}', { n: more, list: value.slice(maxChips).map(labelOf).join(tr('、')) })}</span>\n </span>\n ) : null}\n <Combobox.Input\n id={id}\n // Named by the label's id too: while the list is open the page around it is hidden from assistive\n // technology, and a <label for> outside no longer names the field.\n aria-labelledby={id + '-label'}\n className=\"ui-ms-input\"\n aria-invalid={error ? true : undefined}\n aria-required={required || undefined}\n aria-describedby={error || hint ? id + '-err' : undefined}\n placeholder={value.length ? '' : placeholder || tr('搜尋')}\n onKeyDown={(e) => {\n // Hidden chips (+n) still count: Backspace removes the last value, not the last visible chip.\n if (e.key === 'Backspace' && !query && value.length) {\n e.preventBaseUIHandler();\n onChange(value.slice(0, -1));\n }\n }}\n />\n </Combobox.Chips>\n {error ? <FieldErrorIcon inline /> : null}\n </Combobox.InputGroup>\n <Combobox.Portal>\n <Combobox.Positioner className=\"ui-float is-match\" align=\"start\" sideOffset={6}>\n <Combobox.Popup className=\"ui-select-menu ui-ms-menu\">\n <Combobox.Empty className=\"ui-select-empty\">{emptyText || tr('找不到符合的選項')}</Combobox.Empty>\n <Combobox.List>\n {(v: string) =>\n v.startsWith(CREATE) ? (\n <Combobox.Item key={v} value={v} className=\"ui-select-opt ui-ms-create\">\n {labelOf(v)}\n </Combobox.Item>\n ) : (\n <Combobox.Item key={v} value={v} className={cx('ui-select-opt', 'ui-ms-opt', value.includes(v) && 'is-on')}>\n <span className={cx('ui-check-box', value.includes(v) && 'is-on')} aria-hidden=\"true\">\n <CheckMark v={value.includes(v)} />\n </span>\n <span>{labelOf(v)}</span>\n </Combobox.Item>\n )\n }\n </Combobox.List>\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n <FieldMessage id={id + '-err'} error={error} hint={hint} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AASA,aAAaA,SAAG;AA0BhB,MAAM,SAAS;;AAGf,SAAgB,YAAY,EAC1B,OACA,WACA,MACA,OACA,UACA,UACA,MACA,SACA,OACA,UACA,WACA,WAAW,GACX,aACA,WACA,aACmB;CACnB,MAAM,KAAK,MAAM,MAAM;CACvB,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,EAAE;CAC3C,MAAM,SAAS,MAAM,cAAc,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC,EA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AS,OAAV;MAAgB,WAAU;MAA1B,UAAA,CACE,oBAAC,SAAS,OAAV;OAAgB,WAAU;OAAmB,UAAA,aAAa,GAAG,UAAU;MAAkB,CAAA,GACzF,oBAAC,SAAS,MAAV,EAAA,WACI,MACA,EAAE,WAAW,MAAM,IACjB,oBAAC,SAAS,MAAV;OAAuB,OAAO;OAAG,WAAU;OACxC,UAAA,QAAQ,CAAC;MACG,GAFK,CAEL,IAEf,qBAAC,SAAS,MAAV;OAAuB,OAAO;OAAG,WAAW,GAAG,iBAAiB,aAAa,MAAM,SAAS,CAAC,KAAK,OAAO;OAAzG,UAAA,CACE,oBAAC,QAAD;QAAM,WAAW,GAAG,gBAAgB,MAAM,SAAS,CAAC,KAAK,OAAO;QAAG,eAAY;QAC7E,UAAA,oBAAC,WAAD,EAAW,GAAG,MAAM,SAAS,CAAC,EAAI,CAAA;OAC9B,CAAA,GACN,oBAAC,QAAD,EAAA,UAAO,QAAQ,CAAC,EAAQ,CAAA,CACX;MALK,GAAA,CAKL,EAGN,CAAA,CACD;;IACG,CAAA,EACN,CAAA,CACJ;;GACf,oBAAC,cAAD;IAAc,IAAI,KAAK;IAAe;IAAa;GAAO,CAAA;EACvD;;AAET"}
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  export interface NotificationItem {
3
3
  id: string | number;
4
4
  title: string;
5
+ /** One line under the title; `backticks` are code. */
5
6
  body?: string;
6
7
  /** Relative within a week: format.relative(date). */
7
8
  time?: string;
@@ -10,8 +11,11 @@ export interface NotificationItem {
10
11
  read?: boolean;
11
12
  }
12
13
  export interface NotificationBellProps {
14
+ /** The notifications, newest first; unread ones count on the bell. */
13
15
  items: NotificationItem[];
16
+ /** Called with the notification the person opens. */
14
17
  onOpen?: (item: NotificationItem) => void;
18
+ /** Called by 「全部標為已讀」; without it the button is not shown. */
15
19
  onReadAll?: () => void;
16
20
  /** Default 「沒有通知」. */
17
21
  emptyText?: string;
@@ -5,6 +5,7 @@ import { cx } from "../../internal/util.js";
5
5
  import { FloatingPanel } from "../../internal/FloatingPanel.js";
6
6
  import { includeIcons } from "../../icons/store.js";
7
7
  import bell_default from "../../icons/ph/bell.js";
8
+ import { codeText } from "../InlineCode/InlineCode.js";
8
9
  import * as React from "react";
9
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
11
  // src/components/NotificationBell/NotificationBell.tsx
@@ -29,11 +30,11 @@ function NotificationBell({ items, onOpen, onReadAll, emptyText }) {
29
30
  align: "end",
30
31
  sideOffset: 8,
31
32
  className: "ui-noti",
32
- "aria-label": tr("通知"),
33
+ "aria-label": tr("通知中心"),
33
34
  trigger: /* @__PURE__ */ jsxs("button", {
34
35
  type: "button",
35
36
  className: cx("ui-iconbtn", "ui-bell", open && "is-open"),
36
- "aria-label": unread ? tr("通知,{n} 則未讀", { n: unread }) : tr("通知"),
37
+ "aria-label": unread ? tr("通知中心,{n} 則未讀", { n: unread }) : tr("通知中心"),
37
38
  children: [/* @__PURE__ */ jsx(Icon, { name: "bell" }), unread ? /* @__PURE__ */ jsx("span", {
38
39
  className: "ui-badge-count",
39
40
  "aria-hidden": "true",
@@ -75,7 +76,7 @@ function NotificationBell({ items, onOpen, onReadAll, emptyText }) {
75
76
  }),
76
77
  it.body ? /* @__PURE__ */ jsx("span", {
77
78
  className: "ui-noti-b",
78
- children: it.body
79
+ children: codeText(it.body)
79
80
  }) : null,
80
81
  it.time ? /* @__PURE__ */ jsx("span", {
81
82
  className: "ui-noti-time",
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationBell.js","names":["phBell"],"sources":["../../../src/components/NotificationBell/NotificationBell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { FloatingPanel } from '../../internal/FloatingPanel';\nimport { includeIcons } from '../../icons/store';\nimport phBell from '../../icons/ph/bell';\n\nincludeIcons(phBell);\n\nexport interface NotificationItem {\n id: string | number;\n title: string;\n body?: string;\n /** Relative within a week: format.relative(date). */\n time?: string;\n /** Group heading, e.g. 今天, 更早. Items must already be newest first. */\n group?: string;\n read?: boolean;\n}\n\nexport interface NotificationBellProps {\n items: NotificationItem[];\n onOpen?: (item: NotificationItem) => void;\n onReadAll?: () => void;\n /** Default 「沒有通知」. */\n emptyText?: string;\n}\n\n/** The bell in the top bar: a red count (99+ above 99) and a 360 px panel of notifications grouped by time. */\nexport function NotificationBell({ items, onOpen, onReadAll, emptyText }: NotificationBellProps) {\n const [open, setOpen] = React.useState(false);\n const unread = items.filter((it) => !it.read).length;\n const groups: { title: string; items: NotificationItem[] }[] = [];\n for (const it of items) {\n const g = it.group || '';\n const last = groups[groups.length - 1];\n if (!last || last.title !== g) groups.push({ title: g, items: [it] });\n else last.items.push(it);\n }\n return (\n <FloatingPanel\n open={open}\n onOpenChange={setOpen}\n align=\"end\"\n sideOffset={8}\n className=\"ui-noti\"\n aria-label={tr('通知')}\n trigger={\n <button\n type=\"button\"\n className={cx('ui-iconbtn', 'ui-bell', open && 'is-open')}\n aria-label={unread ? tr('通知,{n} 則未讀', { n: unread }) : tr('通知')}\n >\n <Icon name=\"bell\" />\n {unread ? (\n <span className=\"ui-badge-count\" aria-hidden=\"true\">\n {unread > 99 ? '99+' : unread}\n </span>\n ) : null}\n </button>\n }\n >\n <div className=\"ui-noti-head\">\n <div className=\"ui-noti-title\">{tr('通知')}</div>\n {unread && onReadAll ? (\n <button type=\"button\" className=\"ui-noti-readall\" onClick={onReadAll}>\n {tr('全部標為已讀')}\n </button>\n ) : null}\n </div>\n <div className=\"ui-noti-list\">\n {items.length ? (\n groups.map((g, gi) => (\n <React.Fragment key={gi}>\n {g.title ? <div className=\"ui-noti-group\">{g.title}</div> : null}\n {g.items.map((it) => (\n <button key={it.id} type=\"button\" className={cx('ui-noti-item', !it.read && 'is-unread')} onClick={() => onOpen?.(it)}>\n {/* A span's aria-label is not read: the state is hidden text instead, read first, 「未讀,標題」. */}\n {!it.read ? (\n <>\n <span className=\"ui-noti-dot\" aria-hidden=\"true\" />\n <span className=\"ui-visually-hidden\">{tr('未讀') + tr(',')}</span>\n </>\n ) : null}\n <span className=\"ui-noti-text\">\n <span className=\"ui-noti-t\">{it.title}</span>\n {it.body ? <span className=\"ui-noti-b\">{it.body}</span> : null}\n {it.time ? <span className=\"ui-noti-time\">{it.time}</span> : null}\n </span>\n </button>\n ))}\n </React.Fragment>\n ))\n ) : (\n <div className=\"ui-noti-empty\">{emptyText || tr('沒有通知')}</div>\n )}\n </div>\n </FloatingPanel>\n );\n}\n"],"mappings":";;;;;;;;;;AAQA,aAAaA,YAAM;;AAsBnB,SAAgB,iBAAiB,EAAE,OAAO,QAAQ,WAAW,aAAoC;CAC/F,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAC9C,MAAM,SAAyD,CAAC;CAChE,KAAK,MAAM,MAAM,OAAO;EACtB,MAAM,IAAI,GAAG,SAAS;EACtB,MAAM,OAAO,OAAO,OAAO,SAAS;EACpC,IAAI,CAAC,QAAQ,KAAK,UAAU,GAAG,OAAO,KAAK;GAAE,OAAO;GAAG,OAAO,CAAC,EAAE;EAAE,CAAC;OAC/D,KAAK,MAAM,KAAK,EAAE;CACzB;CACA,OACE,qBAAC,eAAD;EACQ;EACN,cAAc;EACd,OAAM;EACN,YAAY;EACZ,WAAU;EACV,cAAY,GAAG,IAAI;EACnB,SACE,qBAAC,UAAD;GACE,MAAK;GACL,WAAW,GAAG,cAAc,WAAW,QAAQ,SAAS;GACxD,cAAY,SAAS,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI;GAHhE,UAAA,CAKE,oBAAC,MAAD,EAAM,MAAK,OAAQ,CAAA,GAClB,SACC,oBAAC,QAAD;IAAM,WAAU;IAAiB,eAAY;IAC1C,UAAA,SAAS,KAAK,QAAQ;GACnB,CAAA,IACJ,IACE;;EAnBZ,UAAA,C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EnB"}
1
+ {"version":3,"file":"NotificationBell.js","names":["phBell"],"sources":["../../../src/components/NotificationBell/NotificationBell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { FloatingPanel } from '../../internal/FloatingPanel';\nimport { includeIcons } from '../../icons/store';\nimport phBell from '../../icons/ph/bell';\nimport { codeText } from '../InlineCode/InlineCode';\n\nincludeIcons(phBell);\n\nexport interface NotificationItem {\n id: string | number;\n title: string;\n /** One line under the title; `backticks` are code. */\n body?: string;\n /** Relative within a week: format.relative(date). */\n time?: string;\n /** Group heading, e.g. 今天, 更早. Items must already be newest first. */\n group?: string;\n read?: boolean;\n}\n\nexport interface NotificationBellProps {\n /** The notifications, newest first; unread ones count on the bell. */\n items: NotificationItem[];\n /** Called with the notification the person opens. */\n onOpen?: (item: NotificationItem) => void;\n /** Called by 「全部標為已讀」; without it the button is not shown. */\n onReadAll?: () => void;\n /** Default 「沒有通知」. */\n emptyText?: string;\n}\n\n/** The bell in the top bar: a red count (99+ above 99) and a 360 px panel of notifications grouped by time. */\nexport function NotificationBell({ items, onOpen, onReadAll, emptyText }: NotificationBellProps) {\n const [open, setOpen] = React.useState(false);\n const unread = items.filter((it) => !it.read).length;\n const groups: { title: string; items: NotificationItem[] }[] = [];\n for (const it of items) {\n const g = it.group || '';\n const last = groups[groups.length - 1];\n if (!last || last.title !== g) groups.push({ title: g, items: [it] });\n else last.items.push(it);\n }\n return (\n <FloatingPanel\n open={open}\n onOpenChange={setOpen}\n align=\"end\"\n sideOffset={8}\n className=\"ui-noti\"\n aria-label={tr('通知中心')}\n trigger={\n <button\n type=\"button\"\n className={cx('ui-iconbtn', 'ui-bell', open && 'is-open')}\n aria-label={unread ? tr('通知中心,{n} 則未讀', { n: unread }) : tr('通知中心')}\n >\n <Icon name=\"bell\" />\n {unread ? (\n <span className=\"ui-badge-count\" aria-hidden=\"true\">\n {unread > 99 ? '99+' : unread}\n </span>\n ) : null}\n </button>\n }\n >\n <div className=\"ui-noti-head\">\n <div className=\"ui-noti-title\">{tr('通知')}</div>\n {unread && onReadAll ? (\n <button type=\"button\" className=\"ui-noti-readall\" onClick={onReadAll}>\n {tr('全部標為已讀')}\n </button>\n ) : null}\n </div>\n <div className=\"ui-noti-list\">\n {items.length ? (\n groups.map((g, gi) => (\n <React.Fragment key={gi}>\n {g.title ? <div className=\"ui-noti-group\">{g.title}</div> : null}\n {g.items.map((it) => (\n <button key={it.id} type=\"button\" className={cx('ui-noti-item', !it.read && 'is-unread')} onClick={() => onOpen?.(it)}>\n {/* A span's aria-label is not read: the state is hidden text instead, read first, 「未讀,標題」. */}\n {!it.read ? (\n <>\n <span className=\"ui-noti-dot\" aria-hidden=\"true\" />\n <span className=\"ui-visually-hidden\">{tr('未讀') + tr(',')}</span>\n </>\n ) : null}\n <span className=\"ui-noti-text\">\n <span className=\"ui-noti-t\">{it.title}</span>\n {it.body ? <span className=\"ui-noti-b\">{codeText(it.body)}</span> : null}\n {it.time ? <span className=\"ui-noti-time\">{it.time}</span> : null}\n </span>\n </button>\n ))}\n </React.Fragment>\n ))\n ) : (\n <div className=\"ui-noti-empty\">{emptyText || tr('沒有通知')}</div>\n )}\n </div>\n </FloatingPanel>\n );\n}\n"],"mappings":";;;;;;;;;;;AASA,aAAaA,YAAM;;AA0BnB,SAAgB,iBAAiB,EAAE,OAAO,QAAQ,WAAW,aAAoC;CAC/F,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAC9C,MAAM,SAAyD,CAAC;CAChE,KAAK,MAAM,MAAM,OAAO;EACtB,MAAM,IAAI,GAAG,SAAS;EACtB,MAAM,OAAO,OAAO,OAAO,SAAS;EACpC,IAAI,CAAC,QAAQ,KAAK,UAAU,GAAG,OAAO,KAAK;GAAE,OAAO;GAAG,OAAO,CAAC,EAAE;EAAE,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,CAC/D,EAAA,CAAA,IACA,MACJ,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA;MACE,oBAAC,QAAD;OAAM,WAAU;OAAa,UAAA,GAAG;MAAY,CAAA;MAC3C,GAAG,OAAO,oBAAC,QAAD;OAAM,WAAU;OAAa,UAAA,SAAS,GAAG,IAAI;MAAQ,CAAA,IAAI;MACnE,GAAG,OAAO,oBAAC,QAAD;OAAM,WAAU;OAAgB,UAAA,GAAG;MAAW,CAAA,IAAI;KACzD;IACA,CAAA,CAAA;GAbK,GAAA,GAAG,EAaR,CACT,CACa,EAAA,GAlBK,EAkBL,CACjB,IAED,oBAAC,OAAD;IAAK,WAAU;IAAiB,UAAA,aAAa,GAAG,MAAM;GAAO,CAAA;EAE5D,CAAA,CACQ;;AAEnB"}
@@ -0,0 +1,34 @@
1
+ import { IconSource } from "../../icons/Icon.js";
2
+ import { MenuItem } from "../Menu/Menu.js";
3
+ import * as React from "react";
4
+ /** A button of the page header: a verb and an optional icon. */
5
+ export interface PageHeaderAction {
6
+ /** A verb: 編輯, 匯出, 出貨. */
7
+ label: string;
8
+ icon?: IconSource;
9
+ onClick?: () => void;
10
+ disabled?: boolean;
11
+ }
12
+ export interface PageHeaderProps {
13
+ /** The record's name, the page's one h1: 「訂單 #1024」. Leave it out when AppShell's top bar shows the title. */
14
+ title?: React.ReactNode;
15
+ /** First on the line under the title, the size of the facts beside it: a Badge, e.g. <Badge status="doing" />. */
16
+ status?: React.ReactNode;
17
+ /** Secondary facts after the status: 「建立於 2026/11/04(三)· 負責人 王小明」. */
18
+ meta?: React.ReactNode;
19
+ /** The page's one main action, a solid button at the right end. */
20
+ primary?: PageHeaderAction;
21
+ /** Other actions as outline buttons before it; on phones they go into the ⋯ menu. */
22
+ actions?: PageHeaderAction[];
23
+ /** Actions in the ⋯ menu at the very end, e.g. 刪除 (danger items are confirmed). */
24
+ more?: MenuItem[];
25
+ /** Texts: `more` is the name of the ⋯ button (default 「更多操作」). */
26
+ labels?: {
27
+ more?: string;
28
+ };
29
+ /** Extra class on the root element. */
30
+ className?: string;
31
+ }
32
+ /** The top of a detail page: the record's title (or none when the top bar has it), its status, one line of facts, and
33
+ * its actions: one primary, a few outline buttons, and the rest in ⋯. On phones only the primary stays a button. */
34
+ export declare function PageHeader({ title, status, meta, primary, actions, more, labels, className }: PageHeaderProps): React.JSX.Element;
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { tr } from "../../i18n.js";
3
+ import { cx, useNarrow } from "../../internal/util.js";
4
+ import { devWarn } from "../../internal/dev.js";
5
+ import { ShellTitle } from "../../internal/shell.js";
6
+ import { Button } from "../Button/Button.js";
7
+ import { Menu } from "../Menu/Menu.js";
8
+ import * as React from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ // src/components/PageHeader/PageHeader.tsx
11
+ /** The top of a detail page: the record's title (or none when the top bar has it), its status, one line of facts, and
12
+ * its actions: one primary, a few outline buttons, and the rest in ⋯. On phones only the primary stays a button. */
13
+ function PageHeader({ title, status, meta, primary, actions = [], more = [], labels, className }) {
14
+ const shell = React.useContext(ShellTitle);
15
+ const phone = useNarrow();
16
+ devWarn(title && shell.title, "PageHeader", "the page title shows twice: AppShell has `title` and PageHeader has `title`. On a detail page, leave AppShell `title` out and give the record name to PageHeader.");
17
+ devWarn(actions.length > 3, "PageHeader", `${actions.length} outline buttons crowd the header. Keep at most 3 in \`actions\` and put the rest in \`more\`.`);
18
+ const menu = [...phone ? actions.map((a) => ({
19
+ label: a.label,
20
+ icon: a.icon,
21
+ onSelect: a.onClick,
22
+ disabled: a.disabled
23
+ })) : [], ...more];
24
+ const hasActions = !!primary || !phone && actions.length > 0 || menu.length > 0;
25
+ return /* @__PURE__ */ jsxs("header", {
26
+ className: cx("ui-pagehead", className),
27
+ children: [/* @__PURE__ */ jsxs("div", {
28
+ className: "ui-pagehead-main",
29
+ children: [title ? /* @__PURE__ */ jsx("h1", {
30
+ className: "ui-pagehead-title",
31
+ children: title
32
+ }) : null, status || meta ? /* @__PURE__ */ jsxs("div", {
33
+ className: "ui-pagehead-meta",
34
+ children: [status ? /* @__PURE__ */ jsx("span", {
35
+ className: "ui-pagehead-status",
36
+ children: status
37
+ }) : null, meta ? /* @__PURE__ */ jsx("span", {
38
+ className: "ui-pagehead-facts",
39
+ children: meta
40
+ }) : null]
41
+ }) : null]
42
+ }), hasActions ? /* @__PURE__ */ jsxs("div", {
43
+ className: "ui-pagehead-actions",
44
+ children: [
45
+ phone ? null : actions.map((a) => /* @__PURE__ */ jsx(Button, {
46
+ icon: a.icon,
47
+ onClick: a.onClick,
48
+ disabled: a.disabled,
49
+ children: a.label
50
+ }, a.label)),
51
+ primary ? /* @__PURE__ */ jsx(Button, {
52
+ variant: "primary",
53
+ icon: primary.icon,
54
+ onClick: primary.onClick,
55
+ disabled: primary.disabled,
56
+ children: primary.label
57
+ }) : null,
58
+ menu.length ? /* @__PURE__ */ jsx(Menu, {
59
+ items: menu,
60
+ label: labels?.more || tr("更多操作")
61
+ }) : null
62
+ ]
63
+ }) : null]
64
+ });
65
+ }
66
+ export { PageHeader };
67
+
68
+ //# sourceMappingURL=PageHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeader.js","names":[],"sources":["../../../src/components/PageHeader/PageHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport type { IconSource } from '../../icons/Icon';\nimport { cx, useNarrow } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\nimport { ShellTitle } from '../../internal/shell';\nimport { Button } from '../Button/Button';\nimport { Menu, type MenuItem } from '../Menu/Menu';\n\n/** A button of the page header: a verb and an optional icon. */\nexport interface PageHeaderAction {\n /** A verb: 編輯, 匯出, 出貨. */\n label: string;\n icon?: IconSource;\n onClick?: () => void;\n disabled?: boolean;\n}\n\nexport interface PageHeaderProps {\n /** The record's name, the page's one h1: 「訂單 #1024」. Leave it out when AppShell's top bar shows the title. */\n title?: React.ReactNode;\n /** First on the line under the title, the size of the facts beside it: a Badge, e.g. <Badge status=\"doing\" />. */\n status?: React.ReactNode;\n /** Secondary facts after the status: 「建立於 2026/11/04(三)· 負責人 王小明」. */\n meta?: React.ReactNode;\n /** The page's one main action, a solid button at the right end. */\n primary?: PageHeaderAction;\n /** Other actions as outline buttons before it; on phones they go into the ⋯ menu. */\n actions?: PageHeaderAction[];\n /** Actions in the ⋯ menu at the very end, e.g. 刪除 (danger items are confirmed). */\n more?: MenuItem[];\n /** Texts: `more` is the name of the ⋯ button (default 「更多操作」). */\n labels?: { more?: string };\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** The top of a detail page: the record's title (or none when the top bar has it), its status, one line of facts, and\n * its actions: one primary, a few outline buttons, and the rest in ⋯. On phones only the primary stays a button. */\nexport function PageHeader({ title, status, meta, primary, actions = [], more = [], labels, className }: PageHeaderProps) {\n const shell = React.useContext(ShellTitle);\n const phone = useNarrow();\n devWarn(\n title && shell.title,\n 'PageHeader',\n 'the page title shows twice: AppShell has `title` and PageHeader has `title`. On a detail page, leave AppShell `title` out and give the record name to PageHeader.',\n );\n devWarn(actions.length > 3, 'PageHeader', `${actions.length} outline buttons crowd the header. Keep at most 3 in \\`actions\\` and put the rest in \\`more\\`.`);\n const folded: MenuItem[] = phone ? actions.map((a) => ({ label: a.label, icon: a.icon, onSelect: a.onClick, disabled: a.disabled })) : [];\n const menu = [...folded, ...more];\n const hasActions = !!primary || (!phone && actions.length > 0) || menu.length > 0;\n return (\n <header className={cx('ui-pagehead', className)}>\n <div className=\"ui-pagehead-main\">\n {title ? <h1 className=\"ui-pagehead-title\">{title}</h1> : null}\n {status || meta ? (\n <div className=\"ui-pagehead-meta\">\n {status ? <span className=\"ui-pagehead-status\">{status}</span> : null}\n {meta ? <span className=\"ui-pagehead-facts\">{meta}</span> : null}\n </div>\n ) : null}\n </div>\n {hasActions ? (\n <div className=\"ui-pagehead-actions\">\n {phone\n ? null\n : actions.map((a) => (\n <Button key={a.label} icon={a.icon} onClick={a.onClick} disabled={a.disabled}>\n {a.label}\n </Button>\n ))}\n {primary ? (\n <Button variant=\"primary\" icon={primary.icon} onClick={primary.onClick} disabled={primary.disabled}>\n {primary.label}\n </Button>\n ) : null}\n {menu.length ? <Menu items={menu} label={labels?.more || tr('更多操作')} /> : null}\n </div>\n ) : null}\n </header>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAuCA,SAAgB,WAAW,EAAE,OAAO,QAAQ,MAAM,SAAS,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,QAAQ,aAA8B;CACxH,MAAM,QAAQ,MAAM,WAAW,UAAU;CACzC,MAAM,QAAQ,UAAU;CACxB,QACE,SAAS,MAAM,OACf,cACA,mKACF;CACA,QAAQ,QAAQ,SAAS,GAAG,cAAc,GAAG,QAAQ,OAAO,+FAA+F;CAE3J,MAAM,OAAO,CAAC,GADa,QAAQ,QAAQ,KAAK,OAAO;EAAE,OAAO,EAAE;EAAO,MAAM,EAAE;EAAM,UAAU,EAAE;EAAS,UAAU,EAAE;CAAS,EAAE,IAAI,CAAC,GAC/G,GAAG,IAAI;CAChC,MAAM,aAAa,CAAC,CAAC,WAAY,CAAC,SAAS,QAAQ,SAAS,KAAM,KAAK,SAAS;CAChF,OACE,qBAAC,UAAD;EAAQ,WAAW,GAAG,eAAe,SAAS;EAA9C,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,QAAQ,oBAAC,MAAD;IAAI,WAAU;IAAqB,UAAA;GAAU,CAAA,IAAI,MACzD,UAAU,OACT,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,SAAS,oBAAC,QAAD;KAAM,WAAU;KAAsB,UAAA;IAAa,CAAA,IAAI,MAChE,OAAO,oBAAC,QAAD;KAAM,WAAU;KAAqB,UAAA;IAAW,CAAA,IAAI,IACzD;GACH,CAAA,IAAA,IACD;EACJ,CAAA,GAAA,aACC,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACG,QACG,OACA,QAAQ,KAAK,MACX,oBAAC,QA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