@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
@@ -2,20 +2,203 @@
2
2
  import { Icon } from "../../icons/Icon.js";
3
3
  import { includeIcons } from "../../icons/store.js";
4
4
  import check_default from "../../icons/ph/check.js";
5
+ import info_default from "../../icons/ph/info.js";
6
+ import warning_default from "../../icons/ph/warning.js";
7
+ import warning_circle_default from "../../icons/ph/warning-circle.js";
8
+ import x_default from "../../icons/ph/x.js";
9
+ import { codeText } from "../InlineCode/InlineCode.js";
10
+ import { tr } from "../../i18n.js";
11
+ import { IS_MAC, cx } from "../../internal/util.js";
12
+ import * as React from "react";
5
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
+ import { Toast } from "@base-ui/react/toast";
6
15
  // src/components/Toast/Toast.tsx
7
- includeIcons(check_default);
8
- /** A short confirmation at the bottom right. The caller shows it for 3 s. */
9
- function Toast({ children, actionLabel, onAction }) {
16
+ includeIcons(check_default, info_default, warning_default, warning_circle_default, x_default);
17
+ const TONE_ICON = {
18
+ neutral: null,
19
+ info: "info",
20
+ success: "check",
21
+ warning: "warning",
22
+ danger: "warning-circle"
23
+ };
24
+ /** How long a toast stays, in ms: a plain message 3 s; one with an action 10 s, paused while the pointer or focus is on
25
+ * the toasts (WCAG 2.2.1). */
26
+ const TOAST_DURATION = {
27
+ plain: 3e3,
28
+ action: 1e4
29
+ };
30
+ const manager = Toast.createToastManager();
31
+ let liveViews = 0;
32
+ let pending = [];
33
+ const flushPending = () => {
34
+ if (!liveViews || !pending.length) return;
35
+ const list = pending;
36
+ pending = [];
37
+ for (const t of list) manager.add(t);
38
+ };
39
+ /** Shows a short message at the bottom right (bottom centre on phones, above the tab bar). Needs a Toaster on the
40
+ * page: AppShell has one; without AppShell, put one <Toaster /> on the page. Returns the toast's id for
41
+ * toast.close(id). */
42
+ function toast(message, options = {}) {
43
+ const tone = options.tone ?? "success";
44
+ const id = options.id ?? `ui-toast-${++toastSeq}`;
45
+ const t = {
46
+ id,
47
+ title: message,
48
+ timeout: options.action ? TOAST_DURATION.action : TOAST_DURATION.plain,
49
+ priority: tone === "danger" ? "high" : "low",
50
+ data: {
51
+ tone,
52
+ action: options.action
53
+ }
54
+ };
55
+ if (liveViews) return manager.add(t);
56
+ pending = [...pending.filter((x) => x.id !== t.id), t];
57
+ return id;
58
+ }
59
+ let toastSeq = 0;
60
+ /** Closes one toast, or every toast without an id. */
61
+ toast.close = (id) => {
62
+ pending = id === void 0 ? [] : pending.filter((x) => x.id !== id);
63
+ manager.close(id);
64
+ };
65
+ /** toast() and toast.close() from a component. */
66
+ function useToast() {
67
+ return React.useMemo(() => ({
68
+ toast,
69
+ close: toast.close
70
+ }), []);
71
+ }
72
+ const undoKey = IS_MAC ? "⌘Z" : "Ctrl Z";
73
+ /** Typing in a field: Ctrl Z belongs to the field. */
74
+ const typing = (t) => t instanceof HTMLElement && (t.isContentEditable || !!t.closest("input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]"));
75
+ let pageToasters = 0;
76
+ let autoToasters = [];
77
+ const toasterListeners = /* @__PURE__ */ new Set();
78
+ const emitToasters = () => toasterListeners.forEach((f) => f());
79
+ const subscribeToasters = (f) => {
80
+ toasterListeners.add(f);
81
+ return () => toasterListeners.delete(f);
82
+ };
83
+ /** Where toast() messages appear. AppShell renders one by itself, so a page inside AppShell needs none; put one on
84
+ * the page (or the app root) only without AppShell. Stacks the newest at the bottom; a persistent polite live region
85
+ * reads each one; F6 moves focus to the toasts. */
86
+ function Toaster({ label }) {
87
+ React.useLayoutEffect(() => {
88
+ pageToasters++;
89
+ emitToasters();
90
+ return () => {
91
+ pageToasters--;
92
+ emitToasters();
93
+ };
94
+ }, []);
95
+ return /* @__PURE__ */ jsx(ToasterView, { label });
96
+ }
97
+ /** AppShell's Toaster: shown only when the page has no <Toaster /> of its own and no other automatic one is shown. */
98
+ function AutoToaster() {
99
+ const [me] = React.useState(() => ({}));
100
+ React.useLayoutEffect(() => {
101
+ autoToasters = [...autoToasters, me];
102
+ emitToasters();
103
+ return () => {
104
+ autoToasters = autoToasters.filter((x) => x !== me);
105
+ emitToasters();
106
+ };
107
+ }, [me]);
108
+ return React.useSyncExternalStore(subscribeToasters, () => pageToasters === 0 && autoToasters[0] === me, () => false) ? /* @__PURE__ */ jsx(ToasterView, {}) : null;
109
+ }
110
+ function ToasterView({ label }) {
111
+ return /* @__PURE__ */ jsx(Toast.Provider, {
112
+ toastManager: manager,
113
+ children: /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, {
114
+ className: "ui-toaster",
115
+ "aria-label": label || tr("通知"),
116
+ children: /* @__PURE__ */ jsx(ToastList, {})
117
+ }) })
118
+ });
119
+ }
120
+ function ToastList() {
121
+ const { toasts, close } = Toast.useToastManager();
122
+ React.useEffect(() => {
123
+ liveViews++;
124
+ Promise.resolve().then(flushPending);
125
+ return () => {
126
+ liveViews--;
127
+ };
128
+ }, []);
129
+ const live = React.useRef(toasts);
130
+ React.useLayoutEffect(() => {
131
+ live.current = toasts;
132
+ });
133
+ React.useEffect(() => {
134
+ const onKey = (e) => {
135
+ if (e.key.toLowerCase() !== "z" || e.shiftKey || e.altKey || !(IS_MAC ? e.metaKey : e.ctrlKey)) return;
136
+ if (typing(e.target)) return;
137
+ const t = live.current.find((x) => x.transitionStatus !== "ending" && x.data?.action?.undo);
138
+ if (!t?.data?.action) return;
139
+ e.preventDefault();
140
+ t.data.action.onAction();
141
+ close(t.id);
142
+ };
143
+ document.addEventListener("keydown", onKey);
144
+ return () => document.removeEventListener("keydown", onKey);
145
+ }, [close]);
146
+ return toasts.map((t) => {
147
+ const tone = t.data?.tone ?? "success";
148
+ const action = t.data?.action;
149
+ const icon = TONE_ICON[tone];
150
+ return /* @__PURE__ */ jsxs(Toast.Root, {
151
+ toast: t,
152
+ className: cx("ui-toast", "is-" + tone),
153
+ children: [
154
+ icon ? /* @__PURE__ */ jsx(Icon, {
155
+ name: icon,
156
+ className: "ui-toast-icon"
157
+ }) : null,
158
+ /* @__PURE__ */ jsx(Toast.Title, {
159
+ className: "ui-toast-text",
160
+ children: codeText(t.title)
161
+ }),
162
+ action ? /* @__PURE__ */ jsxs(Toast.Action, {
163
+ className: "ui-toast-action",
164
+ "aria-keyshortcuts": action.undo ? IS_MAC ? "Meta+Z" : "Control+Z" : void 0,
165
+ onClick: () => {
166
+ action.onAction();
167
+ close(t.id);
168
+ },
169
+ children: [action.label, action.undo ? /* @__PURE__ */ jsx("kbd", {
170
+ className: "ui-toast-kbd",
171
+ children: undoKey
172
+ }) : null]
173
+ }) : null,
174
+ /* @__PURE__ */ jsx(Toast.Close, {
175
+ className: "ui-toast-close",
176
+ "aria-label": tr("關閉通知"),
177
+ children: /* @__PURE__ */ jsx(Icon, {
178
+ name: "x",
179
+ size: 16
180
+ })
181
+ })
182
+ ]
183
+ }, t.id);
184
+ });
185
+ }
186
+ /** The toast card alone, for a custom place or a preview. Pages show messages with toast() and <Toaster />, which
187
+ * time, stack and announce them. */
188
+ function Toast$1({ children, tone = "success", actionLabel, onAction, className }) {
189
+ const icon = TONE_ICON[tone];
10
190
  return /* @__PURE__ */ jsxs("div", {
11
- className: "ui-toast",
191
+ className: cx("ui-toast", "is-" + tone, className),
12
192
  role: "status",
13
193
  children: [
14
- /* @__PURE__ */ jsx(Icon, {
15
- name: "check",
194
+ icon ? /* @__PURE__ */ jsx(Icon, {
195
+ name: icon,
16
196
  className: "ui-toast-icon"
197
+ }) : null,
198
+ /* @__PURE__ */ jsx("span", {
199
+ className: "ui-toast-text",
200
+ children: codeText(children)
17
201
  }),
18
- /* @__PURE__ */ jsx("span", { children }),
19
202
  actionLabel ? /* @__PURE__ */ jsx("button", {
20
203
  type: "button",
21
204
  className: "ui-toast-action",
@@ -25,6 +208,6 @@ function Toast({ children, actionLabel, onAction }) {
25
208
  ]
26
209
  });
27
210
  }
28
- export { Toast };
211
+ export { AutoToaster, TOAST_DURATION, Toast$1 as Toast, Toaster, toast, useToast };
29
212
 
30
213
  //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","names":["phCheck"],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { Icon } from '../../icons/Icon';\nimport { includeIcons } from '../../icons/store';\nimport phCheck from '../../icons/ph/check';\n\nincludeIcons(phCheck);\n\nexport interface ToastProps {\n /** What happened, in the past tense: 「已刪除 3 筆」. */\n children?: React.ReactNode;\n /** Usually 「復原」. */\n actionLabel?: string;\n onAction?: () => void;\n}\n\n/** A short confirmation at the bottom right. The caller shows it for 3 s. */\nexport function Toast({ children, actionLabel, onAction }: ToastProps) {\n return (\n <div className=\"ui-toast\" role=\"status\">\n <Icon name=\"check\" className=\"ui-toast-icon\" />\n <span>{children}</span>\n {actionLabel ? (\n <button type=\"button\" className=\"ui-toast-action\" onClick={onAction}>\n {actionLabel}\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAKA,aAAaA,aAAO;;AAWpB,SAAgB,MAAM,EAAE,UAAU,aAAa,YAAwB;CACrE,OACE,qBAAC,OAAD;EAAK,WAAU;EAAW,MAAK;EAA/B,UAAA;GACE,oBAAC,MAAD;IAAM,MAAK;IAAQ,WAAU;GAAiB,CAAA;GAC9C,oBAAC,QAAD,EAAO,SAAe,CAAA;GACrB,cACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAkB,SAAS;IACxD,UAAA;GACK,CAAA,IACN;EACD;;AAET"}
1
+ {"version":3,"file":"Toast.js","names":["phCheck","phInfo","phWarning","phWarningCircle","phX","Base","Toast"],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Toast as Base } from '@base-ui/react/toast';\nimport { Icon, type IconName } from '../../icons/Icon';\nimport { includeIcons } from '../../icons/store';\nimport phCheck from '../../icons/ph/check';\nimport phInfo from '../../icons/ph/info';\nimport phWarning from '../../icons/ph/warning';\nimport phWarningCircle from '../../icons/ph/warning-circle';\nimport phX from '../../icons/ph/x';\nimport { codeText } from '../InlineCode/InlineCode';\nimport { tr } from '../../i18n';\nimport { cx, IS_MAC } from '../../internal/util';\n\nincludeIcons(phCheck, phInfo, phWarning, phWarningCircle, phX);\n\n/** The meaning of a toast: its icon and color. */\nexport type ToastTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\nconst TONE_ICON: Record<ToastTone, IconName | null> = {\n neutral: null,\n info: 'info',\n success: 'check',\n warning: 'warning',\n danger: 'warning-circle',\n};\n\n/** How long a toast stays, in ms: a plain message 3 s; one with an action 10 s, paused while the pointer or focus is on\n * the toasts (WCAG 2.2.1). */\nexport const TOAST_DURATION = { plain: 3000, action: 10000 } as const;\n\n/** The one button of a toast. */\nexport interface ToastAction {\n /** A verb; usually 「復原」. */\n label: string;\n /** Runs once; the toast closes. */\n onAction: () => void;\n /** This action undoes what the toast reports: Ctrl Z (⌘Z on a Mac) runs it while the toast is shown, and the button\n * shows that key. Not while typing in a field, where Ctrl Z undoes the typing. */\n undo?: boolean;\n}\n\nexport interface ToastOptions {\n /** Default 'success' (a check): something was done. 'danger' is read at once (role=\"alert\"). */\n tone?: ToastTone;\n /** One button, usually 復原. A toast with an action stays 10 s instead of 3 s. */\n action?: ToastAction;\n /** Shows the toast in place of the one with the same id, restarting its time (「已刪除 3 筆」 → 「已刪除 4 筆」). */\n id?: string;\n}\n\ninterface ToastData {\n tone: ToastTone;\n action?: ToastAction;\n}\n\nconst manager = Base.createToastManager<ToastData>();\ntype AddOptions = Parameters<typeof manager.add>[0];\n\n// The manager only tells Toasters that are already listening. A toast() called before any Toaster is on the page (the\n// first render, or an effect that runs before AppShell's Toaster has subscribed) waits here and shows once one is.\nlet liveViews = 0;\nlet pending: AddOptions[] = [];\nconst flushPending = () => {\n if (!liveViews || !pending.length) return;\n const list = pending;\n pending = [];\n for (const t of list) manager.add(t);\n};\n\n/** Shows a short message at the bottom right (bottom centre on phones, above the tab bar). Needs a Toaster on the\n * page: AppShell has one; without AppShell, put one <Toaster /> on the page. Returns the toast's id for\n * toast.close(id). */\nexport function toast(message: React.ReactNode, options: ToastOptions = {}): string {\n const tone = options.tone ?? 'success';\n const id = options.id ?? `ui-toast-${++toastSeq}`;\n const t: AddOptions = {\n id,\n title: message,\n timeout: options.action ? TOAST_DURATION.action : TOAST_DURATION.plain,\n priority: tone === 'danger' ? 'high' : 'low',\n data: { tone, action: options.action },\n };\n if (liveViews) return manager.add(t);\n pending = [...pending.filter((x) => x.id !== t.id), t];\n return id;\n}\nlet toastSeq = 0;\n/** Closes one toast, or every toast without an id. */\ntoast.close = (id?: string) => {\n pending = id === undefined ? [] : pending.filter((x) => x.id !== id);\n manager.close(id);\n};\n\n/** toast() and toast.close() from a component. */\nexport function useToast() {\n return React.useMemo(() => ({ toast, close: toast.close }), []);\n}\n\nconst undoKey = IS_MAC ? '⌘Z' : 'Ctrl Z';\n\n/** Typing in a field: Ctrl Z belongs to the field. */\nconst typing = (t: EventTarget | null) =>\n t instanceof HTMLElement && (t.isContentEditable || !!t.closest('input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]'));\n\nexport interface ToasterProps {\n /** Name of the toast region for screen readers. Default 「通知」. */\n label?: string;\n}\n\n// Who shows the toasts: every <Toaster /> on the page, and the automatic ones (AppShell's). An automatic one renders\n// only while no <Toaster /> is mounted and it is the first automatic one, so toasts never show twice.\nlet pageToasters = 0;\nlet autoToasters: object[] = [];\nconst toasterListeners = new Set<() => void>();\nconst emitToasters = () => toasterListeners.forEach((f) => f());\nconst subscribeToasters = (f: () => void) => {\n toasterListeners.add(f);\n return () => toasterListeners.delete(f);\n};\n\n/** Where toast() messages appear. AppShell renders one by itself, so a page inside AppShell needs none; put one on\n * the page (or the app root) only without AppShell. Stacks the newest at the bottom; a persistent polite live region\n * reads each one; F6 moves focus to the toasts. */\nexport function Toaster({ label }: ToasterProps) {\n React.useLayoutEffect(() => {\n pageToasters++;\n emitToasters();\n return () => {\n pageToasters--;\n emitToasters();\n };\n }, []);\n return <ToasterView label={label} />;\n}\n\n/** AppShell's Toaster: shown only when the page has no <Toaster /> of its own and no other automatic one is shown. */\nexport function AutoToaster() {\n const [me] = React.useState(() => ({}));\n React.useLayoutEffect(() => {\n autoToasters = [...autoToasters, me];\n emitToasters();\n return () => {\n autoToasters = autoToasters.filter((x) => x !== me);\n emitToasters();\n };\n }, [me]);\n const show = React.useSyncExternalStore(\n subscribeToasters,\n () => pageToasters === 0 && autoToasters[0] === me,\n () => false,\n );\n return show ? <ToasterView /> : null;\n}\n\nfunction ToasterView({ label }: ToasterProps) {\n return (\n <Base.Provider toastManager={manager}>\n <Base.Portal>\n <Base.Viewport className=\"ui-toaster\" aria-label={label || tr('通知')}>\n <ToastList />\n </Base.Viewport>\n </Base.Portal>\n </Base.Provider>\n );\n}\n\nfunction ToastList() {\n const { toasts, close } = Base.useToastManager<ToastData>();\n // Counted while shown; waiting toasts are added after this commit, once the Provider above has subscribed.\n React.useEffect(() => {\n liveViews++;\n void Promise.resolve().then(flushPending);\n return () => {\n liveViews--;\n };\n }, []);\n // Ctrl Z (⌘Z) undoes through the newest toast that offers it.\n const live = React.useRef(toasts);\n React.useLayoutEffect(() => {\n live.current = toasts;\n });\n React.useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key.toLowerCase() !== 'z' || e.shiftKey || e.altKey || !(IS_MAC ? e.metaKey : e.ctrlKey)) return;\n if (typing(e.target)) return;\n const t = live.current.find((x) => x.transitionStatus !== 'ending' && x.data?.action?.undo);\n if (!t?.data?.action) return;\n e.preventDefault();\n t.data.action.onAction();\n close(t.id);\n };\n document.addEventListener('keydown', onKey);\n return () => document.removeEventListener('keydown', onKey);\n }, [close]);\n return toasts.map((t) => {\n const tone = t.data?.tone ?? 'success';\n const action = t.data?.action;\n const icon = TONE_ICON[tone];\n return (\n <Base.Root key={t.id} toast={t} className={cx('ui-toast', 'is-' + tone)}>\n {icon ? <Icon name={icon} className=\"ui-toast-icon\" /> : null}\n <Base.Title className=\"ui-toast-text\">{codeText(t.title)}</Base.Title>\n {action ? (\n <Base.Action\n className=\"ui-toast-action\"\n aria-keyshortcuts={action.undo ? (IS_MAC ? 'Meta+Z' : 'Control+Z') : undefined}\n onClick={() => {\n action.onAction();\n close(t.id);\n }}\n >\n {action.label}\n {action.undo ? <kbd className=\"ui-toast-kbd\">{undoKey}</kbd> : null}\n </Base.Action>\n ) : null}\n <Base.Close className=\"ui-toast-close\" aria-label={tr('關閉通知')}>\n <Icon name=\"x\" size={16} />\n </Base.Close>\n </Base.Root>\n );\n });\n}\n\nexport interface ToastProps {\n /** What happened, in the past tense: 「已刪除 3 筆」; in a string, `backticks` are code. */\n children?: React.ReactNode;\n /** Default 'success'. */\n tone?: ToastTone;\n /** Usually 「復原」. */\n actionLabel?: string;\n /** Runs on the action button. */\n onAction?: () => void;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** The toast card alone, for a custom place or a preview. Pages show messages with toast() and <Toaster />, which\n * time, stack and announce them. */\nexport function Toast({ children, tone = 'success', actionLabel, onAction, className }: ToastProps) {\n const icon = TONE_ICON[tone];\n return (\n <div className={cx('ui-toast', 'is-' + tone, className)} role=\"status\">\n {icon ? <Icon name={icon} className=\"ui-toast-icon\" /> : null}\n <span className=\"ui-toast-text\">{codeText(children)}</span>\n {actionLabel ? (\n <button type=\"button\" className=\"ui-toast-action\" onClick={onAction}>\n {actionLabel}\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,aAAaA,eAASC,cAAQC,iBAAWC,wBAAiBC,SAAG;AAK7D,MAAM,YAAgD;CACpD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;;AAIA,MAAa,iBAAiB;CAAE,OAA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AAW,aAAa,UAAU,aAAyB;CAClG,MAAM,OAAO,UAAU;CACvB,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,QAAQ,MAAM,SAAS;EAAG,MAAK;EAA9D,UAAA;GACG,OAAO,oBAAC,MAAD;IAAM,MAAM;IAAM,WAAU;GAAiB,CAAA,IAAI;GACzD,oBAAC,QAAD;IAAM,WAAU;IAAiB,UAAA,SAAS,QAAQ;GAAQ,CAAA;GACzD,cACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAkB,SAAS;IACxD,UAAA;GACK,CAAA,IACN;EACD;;AAET"}
@@ -3,6 +3,9 @@ import * as React from "react";
3
3
  export interface TopBarProps {
4
4
  /** The page title, shown once: either here or as the page's own heading. */
5
5
  title?: string;
6
+ /** Right after the title, e.g. a Tag 「示範資料」 with the info icon: the size of the title. */
7
+ tags?: React.ReactNode;
8
+ /** @deprecated A breadcrumb goes at the top of the content: put `<Breadcrumb items={…} />` first in the page. */
6
9
  breadcrumb?: BreadcrumbItem[];
7
10
  /** Opens search (CommandPalette). false hides the search entry. */
8
11
  onSearch?: (() => void) | false;
@@ -10,9 +13,10 @@ export interface TopBarProps {
10
13
  searchLabel?: string;
11
14
  /** Right side: NotificationBell, ProjectSwitcher, the account menu. */
12
15
  children?: React.ReactNode;
13
- /** A menu button at the left that opens the navigation (AppShell from 600 to 1024 px). */
16
+ /** A menu button at the left that opens the navigation (AppShell from 600 to 1023 px). */
14
17
  onMenu?: () => void;
18
+ /** Extra class on the root element. */
15
19
  className?: string;
16
20
  }
17
21
  /** The bar at the top of a dashboard page: title or breadcrumb on the left, search and tools on the right. */
18
- export declare function TopBar({ title, breadcrumb, onSearch, searchLabel, children, onMenu, className }: TopBarProps): React.JSX.Element;
22
+ export declare function TopBar({ title, tags, breadcrumb, onSearch, searchLabel, children, onMenu, className }: TopBarProps): React.JSX.Element;
@@ -2,6 +2,7 @@
2
2
  import { tr } from "../../i18n.js";
3
3
  import { Icon } from "../../icons/Icon.js";
4
4
  import { IS_MAC, SHORTCUT, TOUCH_ONLY, cx, useMedia } from "../../internal/util.js";
5
+ import { devWarn } from "../../internal/dev.js";
5
6
  import { Breadcrumb } from "../Breadcrumb/Breadcrumb.js";
6
7
  import { IconButton } from "../IconButton/IconButton.js";
7
8
  import { includeIcons } from "../../icons/store.js";
@@ -11,8 +12,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  // src/components/TopBar/TopBar.tsx
12
13
  includeIcons(list_bullets_default, magnifying_glass_default);
13
14
  /** The bar at the top of a dashboard page: title or breadcrumb on the left, search and tools on the right. */
14
- function TopBar({ title, breadcrumb, onSearch, searchLabel, children, onMenu, className }) {
15
+ function TopBar({ title, tags, breadcrumb, onSearch, searchLabel, children, onMenu, className }) {
15
16
  const touch = useMedia(TOUCH_ONLY);
17
+ devWarn(breadcrumb, "TopBar", "`breadcrumb` is deprecated: a breadcrumb in the top bar repeats the page title. Put <Breadcrumb items={…} /> first in the page content instead.");
16
18
  return /* @__PURE__ */ jsxs("header", {
17
19
  className: cx("ui-topbar", className),
18
20
  children: [
@@ -26,6 +28,10 @@ function TopBar({ title, breadcrumb, onSearch, searchLabel, children, onMenu, cl
26
28
  className: "ui-topbar-title",
27
29
  children: title
28
30
  }) : null,
31
+ tags ? /* @__PURE__ */ jsx("div", {
32
+ className: "ui-topbar-tags",
33
+ children: tags
34
+ }) : null,
29
35
  breadcrumb ? /* @__PURE__ */ jsx(Breadcrumb, { items: breadcrumb }) : null,
30
36
  /* @__PURE__ */ jsxs("div", {
31
37
  className: "ui-topbar-end",
@@ -1 +1 @@
1
- {"version":3,"file":"TopBar.js","names":["phListBullets","phMagnifyingGlass"],"sources":["../../../src/components/TopBar/TopBar.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { IS_MAC, SHORTCUT, TOUCH_ONLY, cx, useMedia } from '../../internal/util';\nimport { Breadcrumb, type BreadcrumbItem } from '../Breadcrumb/Breadcrumb';\nimport { IconButton } from '../IconButton/IconButton';\nimport { includeIcons } from '../../icons/store';\nimport phListBullets from '../../icons/ph/list-bullets';\nimport phMagnifyingGlass from '../../icons/ph/magnifying-glass';\n\nincludeIcons(phListBullets, phMagnifyingGlass);\n\nexport interface TopBarProps {\n /** The page title, shown once: either here or as the page's own heading. */\n title?: string;\n breadcrumb?: BreadcrumbItem[];\n /** Opens search (CommandPalette). false hides the search entry. */\n onSearch?: (() => void) | false;\n /** Default 「搜尋」. */\n searchLabel?: string;\n /** Right side: NotificationBell, ProjectSwitcher, the account menu. */\n children?: React.ReactNode;\n /** A menu button at the left that opens the navigation (AppShell from 600 to 1024 px). */\n onMenu?: () => void;\n className?: string;\n}\n\n/** The bar at the top of a dashboard page: title or breadcrumb on the left, search and tools on the right. */\nexport function TopBar({ title, breadcrumb, onSearch, searchLabel, children, onMenu, className }: TopBarProps) {\n const touch = useMedia(TOUCH_ONLY);\n return (\n <header className={cx('ui-topbar', className)}>\n {onMenu ? <IconButton className=\"ui-topbar-menu\" icon=\"list-bullets\" label={tr('開啟導覽')} onClick={onMenu} /> : null}\n {title ? <h1 className=\"ui-topbar-title\">{title}</h1> : null}\n {breadcrumb ? <Breadcrumb items={breadcrumb} /> : null}\n <div className=\"ui-topbar-end\">\n {onSearch !== false ? (\n <>\n <button type=\"button\" className=\"ui-search\" data-tour=\"search\" onClick={onSearch} aria-keyshortcuts={IS_MAC ? 'Meta+K' : 'Control+K'}>\n <Icon name=\"magnifying-glass\" size={16} />\n <span>{searchLabel || tr('搜尋')}</span>\n {/* No keyboard on a touch screen: no shortcut to show. */}\n {touch ? null : <kbd>{SHORTCUT}</kbd>}\n </button>\n <IconButton\n className=\"ui-search-icon\"\n data-tour=\"search\"\n icon=\"magnifying-glass\"\n label={touch ? tr('搜尋') : tr('搜尋({k})', { k: SHORTCUT })}\n onClick={onSearch}\n />\n </>\n ) : null}\n {children}\n </div>\n </header>\n );\n}\n"],"mappings":";;;;;;;;;;;AAUA,aAAaA,sBAAeC,wBAAiB;;AAkB7C,SAAgB,OAAO,EAAE,OAAO,YAAY,UAAU,aAAa,UAAU,QAAQ,aAA0B;CAC7G,MAAM,QAAQ,SAAS,UAAU;CACjC,OACE,qBAAC,UAAD;EAAQ,WAAW,GAAG,aAAa,SAAS;EAA5C,UAAA;GACG,SAAS,oBAAC,YAAD;IAAY,WAAU;IAAiB,MAAK;IAAe,OAAO,GAAG,MAAM;IAAG,SAAS;GAAS,CAAA,IAAI;GAC7G,QAAQ,oBAAC,MAAD;IAAI,WAAU;IAAmB,UAAA;GAAU,CAAA,IAAI;GACvD,aAAa,oBAAC,YAAD,EAAY,OAAO,WAAa,CAAA,IAAI;GAClD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,aAAa,QACZ,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,UAAD;KAAQ,MAAK;KAAS,WAAU;KAAY,aAAU;KAAS,SAAS;KAAU,qBAAmB,SAAS,WAAW;KAAzH,UAAA;MACE,oBAAC,MAAD;OAAM,MAAK;OAAmB,MAAM;MAAK,CAAA;MACzC,oBAAC,QAAD,EAAA,UAAO,eAAe,GAAG,IAAI,EAAQ,CAAA;MAEpC,QAAQ,OAAO,oBAAC,OAAD,EAAA,UAAM,SAAc,CAAA;KAC9B;IACR,CAAA,GAAA,oBAAC,YAAD;KACE,WAAU;KACV,aAAU;KACV,MAAK;KACL,OAAO,QAAQ,GAAG,IAAI,IAAI,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;KACvD,SAAS;IACV,CAAA,CACD,EAAA,CAAA,IACA,MACH,QACE;;EACC;;AAEZ"}
1
+ {"version":3,"file":"TopBar.js","names":["phListBullets","phMagnifyingGlass"],"sources":["../../../src/components/TopBar/TopBar.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { IS_MAC, SHORTCUT, TOUCH_ONLY, cx, useMedia } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\nimport { Breadcrumb, type BreadcrumbItem } from '../Breadcrumb/Breadcrumb';\nimport { IconButton } from '../IconButton/IconButton';\nimport { includeIcons } from '../../icons/store';\nimport phListBullets from '../../icons/ph/list-bullets';\nimport phMagnifyingGlass from '../../icons/ph/magnifying-glass';\n\nincludeIcons(phListBullets, phMagnifyingGlass);\n\nexport interface TopBarProps {\n /** The page title, shown once: either here or as the page's own heading. */\n title?: string;\n /** Right after the title, e.g. a Tag 「示範資料」 with the info icon: the size of the title. */\n tags?: React.ReactNode;\n /** @deprecated A breadcrumb goes at the top of the content: put `<Breadcrumb items={…} />` first in the page. */\n breadcrumb?: BreadcrumbItem[];\n /** Opens search (CommandPalette). false hides the search entry. */\n onSearch?: (() => void) | false;\n /** Default 「搜尋」. */\n searchLabel?: string;\n /** Right side: NotificationBell, ProjectSwitcher, the account menu. */\n children?: React.ReactNode;\n /** A menu button at the left that opens the navigation (AppShell from 600 to 1023 px). */\n onMenu?: () => void;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** The bar at the top of a dashboard page: title or breadcrumb on the left, search and tools on the right. */\nexport function TopBar({ title, tags, breadcrumb, onSearch, searchLabel, children, onMenu, className }: TopBarProps) {\n const touch = useMedia(TOUCH_ONLY);\n devWarn(\n breadcrumb,\n 'TopBar',\n '`breadcrumb` is deprecated: a breadcrumb in the top bar repeats the page title. Put <Breadcrumb items={…} /> first in the page content instead.',\n );\n return (\n <header className={cx('ui-topbar', className)}>\n {onMenu ? <IconButton className=\"ui-topbar-menu\" icon=\"list-bullets\" label={tr('開啟導覽')} onClick={onMenu} /> : null}\n {title ? <h1 className=\"ui-topbar-title\">{title}</h1> : null}\n {tags ? <div className=\"ui-topbar-tags\">{tags}</div> : null}\n {breadcrumb ? <Breadcrumb items={breadcrumb} /> : null}\n <div className=\"ui-topbar-end\">\n {onSearch !== false ? (\n <>\n <button type=\"button\" className=\"ui-search\" data-tour=\"search\" onClick={onSearch} aria-keyshortcuts={IS_MAC ? 'Meta+K' : 'Control+K'}>\n <Icon name=\"magnifying-glass\" size={16} />\n <span>{searchLabel || tr('搜尋')}</span>\n {/* No keyboard on a touch screen: no shortcut to show. */}\n {touch ? null : <kbd>{SHORTCUT}</kbd>}\n </button>\n <IconButton\n className=\"ui-search-icon\"\n data-tour=\"search\"\n icon=\"magnifying-glass\"\n label={touch ? tr('搜尋') : tr('搜尋({k})', { k: SHORTCUT })}\n onClick={onSearch}\n />\n </>\n ) : null}\n {children}\n </div>\n </header>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,aAAaA,sBAAeC,wBAAiB;;AAsB7C,SAAgB,OAAO,EAAE,OAAO,MAAM,YAAY,UAAU,aAAa,UAAU,QAAQ,aAA0B;CACnH,MAAM,QAAQ,SAAS,UAAU;CACjC,QACE,YACA,UACA,iJACF;CACA,OACE,qBAAC,UAAD;EAAQ,WAAW,GAAG,aAAa,SAAS;EAA5C,UAAA;GACG,SAAS,oBAAC,YAAD;IAAY,WAAU;IAAiB,MAAK;IAAe,OAAO,GAAG,MAAM;IAAG,SAAS;GAAS,CAAA,IAAI;GAC7G,QAAQ,oBAAC,MAAD;IAAI,WAAU;IAAmB,UAAA;GAAU,CAAA,IAAI;GACvD,OAAO,oBAAC,OAAD;IAAK,WAAU;IAAkB,UAAA;GAAU,CAAA,IAAI;GACtD,aAAa,oBAAC,YAAD,EAAY,OAAO,WAAa,CAAA,IAAI;GAClD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,aAAa,QACZ,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,UAAD;KAAQ,MAAK;KAAS,WAAU;KAAY,aAAU;KAAS,SAAS;KAAU,qBAAmB,SAAS,WAAW;KAAzH,UAAA;MACE,oBAAC,MAAD;OAAM,MAAK;OAAmB,MAAM;MAAK,CAAA;MACzC,oBAAC,QAAD,EAAA,UAAO,eAAe,GAAG,IAAI,EAAQ,CAAA;MAEpC,QAAQ,OAAO,oBAAC,OAAD,EAAA,UAAM,SAAc,CAAA;KAC9B;IACR,CAAA,GAAA,oBAAC,YAAD;KACE,WAAU;KACV,aAAU;KACV,MAAK;KACL,OAAO,QAAQ,GAAG,IAAI,IAAI,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;KACvD,SAAS;IACV,CAAA,CACD,EAAA,CAAA,IACA,MACH,QACE;;EACC;;AAEZ"}
@@ -19,21 +19,32 @@ export interface TourStep {
19
19
  keepVisible?: TourStep['target'] | TourStep['target'][];
20
20
  }
21
21
  export interface TourProps {
22
- open: boolean;
22
+ /** Controlled: shown while true (useTour's `open`). */
23
+ open?: boolean;
24
+ /** Uncontrolled: whether it starts open. */
25
+ defaultOpen?: boolean;
26
+ /** Called with false and why it ended: 'done' (完成 on the last step) or 'skip' (略過 or Esc). Pass useTour's
27
+ * `onOpenChange`. */
28
+ onOpenChange?: (open: boolean, reason?: 'done' | 'skip') => void;
29
+ /** The steps, 3 to 5, in order. */
23
30
  steps: TourStep[];
31
+ /** @deprecated use onOpenChange: called with why the tour ended. */
24
32
  onClose?: (reason: 'done' | 'skip') => void;
25
33
  /** 「略過」 and Esc end the tour early. Default true. */
26
34
  skippable?: boolean;
27
35
  /** Controlled step index. */
28
36
  step?: number;
37
+ /** Called with the new step index (from 0) when the person moves on or back. */
29
38
  onStepChange?: (index: number) => void;
30
39
  }
31
- /** Opens the tour once per browser: { open, start, close, seen, hint }. Pass close to Tour's onClose; start() shows
40
+ /** Opens the tour once per browser: { open, onOpenChange, start, close, seen, hint }. Pass open and onOpenChange to Tour; start() shows
32
41
  * it again. hint(text) gives IconButton's `hint` for the button that starts the tour: a page that uses it shows the dot
33
42
  * and the bubble instead of opening the tour by itself. 「開始」 starts the tour; × and finishing it hide the hint for
34
43
  * good (the same record as seen). */
35
44
  export declare function useTour(key: string): {
36
45
  open: boolean;
46
+ /** Tour's onOpenChange: closing records the tour as seen. */
47
+ onOpenChange: (next: boolean) => void;
37
48
  start: () => void;
38
49
  close: () => void;
39
50
  seen: boolean;
@@ -41,4 +52,4 @@ export declare function useTour(key: string): {
41
52
  hint: (text: string, action?: string) => IconButtonHint | undefined;
42
53
  };
43
54
  /** The first-use walkthrough: the page goes dark except the part being introduced, with a card beside it. */
44
- export declare function Tour({ open, steps, onClose, skippable, step: controlled, onStepChange }: TourProps): React.JSX.Element | null;
55
+ export declare function Tour({ open: openProp, defaultOpen, onOpenChange, steps, onClose, skippable, step: controlled, onStepChange }: TourProps): React.JSX.Element | null;
@@ -4,35 +4,38 @@ import { CodeText } from "../InlineCode/InlineCode.js";
4
4
  import { Button } from "../Button/Button.js";
5
5
  import { tr } from "../../i18n.js";
6
6
  import { announce } from "../../announce.js";
7
- import { cx, resizeObserver, seenOnly, store } from "../../internal/util.js";
7
+ import { cx, resizeObserver, seenOnly } from "../../internal/util.js";
8
+ import { readStored, useStored } from "../../internal/stored.js";
8
9
  import { devWarn } from "../../internal/dev.js";
10
+ import { useOpenState } from "../../internal/open.js";
9
11
  import * as React from "react";
10
12
  import { jsx, jsxs } from "react/jsx-runtime";
11
13
  import { Popover } from "@base-ui/react/popover";
12
14
  // src/components/Tour/Tour.tsx
13
15
  const TOUR_KEY = "ui-tour:";
14
- /** Opens the tour once per browser: { open, start, close, seen, hint }. Pass close to Tour's onClose; start() shows
16
+ const seenOnce = (raw) => !!raw;
17
+ /** Opens the tour once per browser: { open, onOpenChange, start, close, seen, hint }. Pass open and onOpenChange to Tour; start() shows
15
18
  * it again. hint(text) gives IconButton's `hint` for the button that starts the tour: a page that uses it shows the dot
16
19
  * and the bubble instead of opening the tour by itself. 「開始」 starts the tour; × and finishing it hide the hint for
17
20
  * good (the same record as seen). */
18
21
  function useTour(key) {
19
- const [seen, setSeen] = React.useState(() => !!store(TOUR_KEY + key));
22
+ const [seen, setSeen] = useStored(TOUR_KEY + key, seenOnce, false, (v) => v ? "1" : null);
20
23
  const [open, setOpen] = React.useState(false);
21
24
  const hinted = React.useRef(false);
22
25
  React.useLayoutEffect(() => {
23
- if (!store(TOUR_KEY + key) && !hinted.current) setOpen(true);
26
+ if (!readStored(TOUR_KEY + key) && !hinted.current) setOpen(true);
24
27
  }, [key]);
25
- const remember = () => {
26
- store(TOUR_KEY + key, "1");
27
- setSeen(true);
28
+ const remember = () => setSeen(true);
29
+ const close = () => {
30
+ remember();
31
+ setOpen(false);
28
32
  };
29
33
  return {
30
34
  open,
35
+ /** Tour's onOpenChange: closing records the tour as seen. */
36
+ onOpenChange: (next) => next ? setOpen(true) : close(),
31
37
  start: () => setOpen(true),
32
- close: () => {
33
- remember();
34
- setOpen(false);
35
- },
38
+ close,
36
39
  seen,
37
40
  /** IconButton's `hint` for the button that starts this tour, or undefined once seen or while the tour is open. */
38
41
  hint: (text, action) => {
@@ -165,7 +168,13 @@ function placeCard(rect, cardH, prefer, area_, cardW = 320, keep = []) {
165
168
  };
166
169
  }
167
170
  /** The first-use walkthrough: the page goes dark except the part being introduced, with a card beside it. */
168
- function Tour({ open, steps, onClose, skippable = true, step: controlled, onStepChange }) {
171
+ function Tour({ open: openProp, defaultOpen, onOpenChange, steps, onClose, skippable = true, step: controlled, onStepChange }) {
172
+ devWarn(!!onClose, "Tour", "onClose is deprecated: pass onOpenChange (useTour gives tour.onOpenChange). It still works for now.");
173
+ const [open, setOpen] = useOpenState({
174
+ open: openProp,
175
+ defaultOpen,
176
+ onOpenChange
177
+ });
169
178
  const [inner, setInner] = React.useState(0);
170
179
  const i = Math.max(0, Math.min(steps.length - 1, controlled ?? inner));
171
180
  const step = steps[i];
@@ -183,7 +192,10 @@ function Tour({ open, steps, onClose, skippable = true, step: controlled, onStep
183
192
  onStepChange?.(n);
184
193
  if (controlled == null) setInner(n);
185
194
  };
186
- const end = (why) => onClose?.(why);
195
+ const end = (why) => {
196
+ setOpen(false, why);
197
+ onClose?.(why);
198
+ };
187
199
  useReturnFocus(open);
188
200
  const shownStep = React.useRef(-1);
189
201
  React.useEffect(() => {
@@ -235,7 +247,7 @@ function Tour({ open, steps, onClose, skippable = true, step: controlled, onStep
235
247
  if (!open || !hasStep) return;
236
248
  let el = findTarget(target);
237
249
  const tall = (el?.getBoundingClientRect().height ?? 0) > window.innerHeight;
238
- devWarn(el && el.getBoundingClientRect().height > window.innerHeight * .7, "Tour", `第 ${i + 1} 步的目標「${target}」比視窗的 70% 高,說明卡只能蓋住它的一部分。請把 data-tour 放在較小的元素上,例如要說明的那張卡片或那一列,而不是整頁。`);
250
+ devWarn(el && el.getBoundingClientRect().height > window.innerHeight * .7, "Tour", `the target "${target}" of step ${i + 1} is taller than 70% of the window, so the card has to cover part of it. Put data-tour on a smaller element, such as the card or row the step explains, not the whole page.`);
239
251
  if (el instanceof HTMLElement && narrowNow()) {
240
252
  const keep = el.style.scrollMarginTop;
241
253
  el.style.scrollMarginTop = bounds(el).top + edge() + pad + "px";
@@ -1 +1 @@
1
- {"version":3,"file":"Tour.js","names":[],"sources":["../../../src/components/Tour/Tour.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReturnFocus } from '../../internal/focus';\nimport { Popover } from '@base-ui/react/popover';\nimport { CodeText } from '../InlineCode/InlineCode';\nimport { Button } from '../Button/Button';\nimport { tr } from '../../i18n';\nimport { announce } from '../../announce';\nimport { cx, seenOnly, store, resizeObserver } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\nimport type { IconButtonHint } from '../IconButton/IconButton';\n\nexport interface TourStep {\n /** A data-tour name ('search' matches [data-tour=\"search\"]), a CSS selector (first visible match), a ref or an element.\n * Leave it out for a step in the middle of the screen. */\n target?: string | React.RefObject<Element | null> | Element;\n /** Names the part: 「搜尋」. */\n title: string;\n /** What it does, 1 short sentence; `backticks` are code. */\n text: string;\n /** Default 'bottom'. The card goes below, above, right or left of the target, the first side where it fits in the\n * window and covers neither the target nor `keepVisible` ('top' tries above first). With no such side the page\n * scrolls to make room; failing that, the side that covers the least of the target. */\n side?: 'bottom' | 'top';\n /** Space around the highlighted part in px. Default 6. */\n padding?: number;\n /** Parts the card must not cover either, e.g. the table the step talks about under a highlighted summary: same forms\n * as target. The card then goes to the next side that leaves them visible. */\n keepVisible?: TourStep['target'] | TourStep['target'][];\n}\n\nexport interface TourProps {\n open: boolean;\n steps: TourStep[];\n onClose?: (reason: 'done' | 'skip') => void;\n /** 「略過」 and Esc end the tour early. Default true. */\n skippable?: boolean;\n /** Controlled step index. */\n step?: number;\n onStepChange?: (index: number) => void;\n}\n\nconst TOUR_KEY = 'ui-tour:';\n\n/** Opens the tour once per browser: { open, start, close, seen, hint }. Pass close to Tour's onClose; start() shows\n * it again. hint(text) gives IconButton's `hint` for the button that starts the tour: a page that uses it shows the dot\n * and the bubble instead of opening the tour by itself. 「開始」 starts the tour; × and finishing it hide the hint for\n * good (the same record as seen). */\nexport function useTour(key: string) {\n const [seen, setSeen] = React.useState(() => !!store(TOUR_KEY + key));\n const [open, setOpen] = React.useState(false);\n // hint() is called while the page renders; the tour opens by itself after that render only when it was not.\n const hinted = React.useRef(false);\n React.useLayoutEffect(() => {\n // Known only after the page rendered: whether it uses hint().\n if (!store(TOUR_KEY + key) && !hinted.current) setOpen(true);\n }, [key]);\n const remember = () => {\n store(TOUR_KEY + key, '1');\n setSeen(true);\n };\n return {\n open,\n start: () => setOpen(true),\n close: () => {\n remember();\n setOpen(false);\n },\n seen,\n /** IconButton's `hint` for the button that starts this tour, or undefined once seen or while the tour is open. */\n hint: (text: string, action?: string): IconButtonHint | undefined => {\n hinted.current = true;\n if (seen || open) return undefined;\n return { text, action, onAction: () => setOpen(true), onDismiss: remember };\n },\n };\n}\n\nfunction findTarget(t: TourStep['target']): Element | null {\n if (!t) return null;\n if (typeof t === 'string') {\n const sel = /^[\\w-]+$/.test(t) && !/^(html|body|main|nav|header|footer|section|aside)$/.test(t) ? `[data-tour=\"${t}\"]` : t;\n return Array.from(document.querySelectorAll(sel)).find((e) => e.getClientRects().length > 0) ?? null;\n }\n return t instanceof Element ? t : t.current;\n}\n\ninterface Box {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\nconst GAP = 12;\n\n/** The space kept between the card and the window edges: the --space-3 token. */\nfunction edge() {\n return parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--space-3')) || 12;\n}\n\nconst narrowNow = () => typeof window !== 'undefined' && window.innerWidth < 600;\n\n/** The part of the window between a phone's fixed top bar and bottom tab bar (when the target is not one of them):\n * the card stays inside it and never covers either bar. The whole window elsewhere. */\nfunction bounds(target: Element | null): { top: number; bottom: number } {\n const vh = typeof window === 'undefined' ? 0 : window.innerHeight;\n if (!narrowNow()) return { top: 0, bottom: vh };\n let top = 0;\n let bottom = vh;\n const head = document.querySelector('.ui-shell-top');\n const bar = document.querySelector('.ui-tabbar');\n if (head && !(target && head.contains(target))) {\n const r = head.getBoundingClientRect();\n if (r.height && r.bottom > 0 && r.bottom < vh / 2) top = r.bottom;\n }\n if (bar && !(target && bar.contains(target))) {\n const r = bar.getBoundingClientRect();\n if (r.height && r.top > vh / 2 && r.top < vh) bottom = r.top;\n }\n return { top, bottom };\n}\n\ntype Side = 'bottom' | 'top' | 'right' | 'left';\nconst area = (a: Box, b: Box) =>\n Math.max(0, Math.min(a.left + a.width, b.left + b.width) - Math.max(a.left, b.left)) *\n Math.max(0, Math.min(a.top + a.height, b.top + b.height) - Math.max(a.top, b.top));\n\n/** Where the card goes for a highlighted box. Below, above, right, left (above first with side 'top'): the first\n * where the card fits inside the window and covers neither the target nor the parts the step keeps visible. When\n * none does (after the tour scrolled to make room, see makeRoom), the one that covers the least of the target, then\n * of those parts. Returns the card's box: it is placed at that box's top-left corner. */\nfunction placeCard(rect: Box | null, cardH: number, prefer: 'bottom' | 'top', area_?: { top: number; bottom: number }, cardW = 320, keep: Box[] = []) {\n const margin = typeof document === 'undefined' ? 12 : edge();\n const vw = typeof window === 'undefined' ? 0 : window.innerWidth;\n const vh = area_?.bottom ?? (typeof window === 'undefined' ? 0 : window.innerHeight);\n const vt = area_?.top ?? 0;\n if (!rect) {\n // No target: centered in the window.\n const box = { left: (vw - cardW) / 2, top: Math.max(vt + margin, (vt + vh) / 2 - cardH / 2), width: cardW, height: cardH };\n return { mode: 'center', box, fits: true };\n }\n const clampX = (x: number) => Math.max(margin, Math.min(vw - margin - cardW, x));\n const clampY = (y: number) => Math.max(vt + margin, Math.min(vh - margin - cardH, y));\n const midX = rect.left + rect.width / 2 - cardW / 2;\n const midY = rect.top + rect.height / 2 - cardH / 2;\n const at: Record<Side, { left: number; top: number }> = {\n bottom: { left: midX, top: rect.top + rect.height + GAP },\n top: { left: midX, top: rect.top - GAP - cardH },\n right: { left: rect.left + rect.width + GAP, top: midY },\n left: { left: rect.left - GAP - cardW, top: midY },\n };\n const order: Side[] = prefer === 'top' ? ['top', 'bottom', 'right', 'left'] : ['bottom', 'top', 'right', 'left'];\n const options = order.map((side) => {\n const want = at[side];\n // Along the target's edge the card may shift to stay inside the window; away from it, it must not.\n const box = { left: clampX(want.left), top: clampY(want.top), width: cardW, height: cardH };\n const inside = side === 'bottom' || side === 'top' ? box.top === want.top : box.left === want.left;\n const onTarget = area(box, rect);\n const onKept = keep.reduce((n, k) => n + area(box, k), 0);\n return { mode: side, box, fits: inside && !onTarget && !onKept, onTarget, onKept };\n });\n const best = options.find((o) => o.fits) ?? [...options].sort((x, y) => x.onTarget - y.onTarget || x.onKept - y.onKept)[0];\n return { mode: best.mode, box: best.box, fits: best.fits };\n}\n\n/** The first-use walkthrough: the page goes dark except the part being introduced, with a card beside it. */\nexport function Tour({ open, steps, onClose, skippable = true, step: controlled, onStepChange }: TourProps) {\n const [inner, setInner] = React.useState(0);\n const i = Math.max(0, Math.min(steps.length - 1, controlled ?? inner));\n const step = steps[i];\n const [rect, setRect] = React.useState<Box | null>(null);\n const [kept, setKept] = React.useState<Box[]>([]);\n const next = React.useRef<HTMLButtonElement>(null);\n const [cardH, setCardH] = React.useState(0);\n const [cardW, setCardW] = React.useState(320);\n const [wasOpen, setWasOpen] = React.useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open && controlled == null) setInner(0);\n }\n const go = (n: number) => {\n onStepChange?.(n);\n if (controlled == null) setInner(n);\n };\n const end = (why: 'done' | 'skip') => onClose?.(why);\n useReturnFocus(open);\n // A new step after 下一步 or 上一步: its count, title and text are read (focus stays on the button, which does not read\n // them). The first step is read as the dialog opens.\n const shownStep = React.useRef(-1);\n React.useEffect(() => {\n if (!open || !step) {\n shownStep.current = -1;\n return;\n }\n if (shownStep.current !== -1 && shownStep.current !== i)\n announce(tr('第 {a} 步,共 {b} 步', { a: i + 1, b: steps.length }) + tr('。') + step.title + tr('。') + step.text.replace(/`/g, ''));\n shownStep.current = i;\n }, [open, i, step, steps.length]);\n const cardEl = React.useRef<HTMLDivElement | null>(null);\n // Tab and Shift+Tab go round the card's buttons only. Base UI's popover leaves focus guards around the card (no\n // name) that let Tab reach the page; focus that gets out anyway (a click on the dimmed page) comes back to 下一步.\n const tabbables = () =>\n Array.from(\n cardEl.current?.querySelectorAll<HTMLElement>('button:not(:disabled), a[href], input:not(:disabled), [tabindex]:not([tabindex=\"-1\"])') ?? [],\n ).filter((e) => e.getClientRects().length > 0);\n const onTab = (e: React.KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) return;\n const list = tabbables();\n if (!list.length) return;\n e.preventDefault();\n const at = list.indexOf(document.activeElement as HTMLElement);\n const to = at < 0 ? 0 : (at + (e.shiftKey ? -1 : 1) + list.length) % list.length;\n list[to].focus();\n };\n React.useEffect(() => {\n if (!open) return;\n const back = (e: FocusEvent) => {\n const box = cardEl.current;\n if (!box || !(e.target instanceof Node) || box.contains(e.target)) return;\n (next.current ?? tabbables()[0])?.focus();\n };\n document.addEventListener('focusin', back);\n return () => document.removeEventListener('focusin', back);\n }, [open]);\n\n // Follow the target while it moves (scrolling, layout changes).\n // Depends on the step's fields, not the object: inline steps arrays are new on every render.\n const target = step?.target;\n const pad = step?.padding ?? 6;\n // keepVisible as one stable value for the effect below (an inline array is new on every render).\n const keepList = step?.keepVisible == null ? [] : Array.isArray(step.keepVisible) ? step.keepVisible : [step.keepVisible];\n const keepKey = keepList.map((k) => (typeof k === 'string' ? k : '#')).join('|');\n const keepRef = React.useRef(keepList);\n React.useLayoutEffect(() => {\n keepRef.current = keepList;\n });\n const hasStep = !!step;\n React.useEffect(() => {\n if (!open || !hasStep) return;\n // A selector is looked up again until it appears (the target may render later), then kept.\n let el = findTarget(target);\n // Bring the target into view first; one taller than the window shows from its top. On a phone the target goes\n // to the top, just under the top bar, so the card fits below it instead of covering it. The jump is instant: the\n // modal's scroll lock stops a smooth scroll halfway; the spotlight's own transition shows the move.\n const tall = (el?.getBoundingClientRect().height ?? 0) > window.innerHeight;\n // A target as tall as the window leaves no room beside it: the card has to cover part of it.\n devWarn(\n el && el.getBoundingClientRect().height > window.innerHeight * 0.7,\n 'Tour',\n `第 ${i + 1} 步的目標「${target}」比視窗的 70% 高,說明卡只能蓋住它的一部分。請把 data-tour 放在較小的元素上,例如要說明的那張卡片或那一列,而不是整頁。`,\n );\n if (el instanceof HTMLElement && narrowNow()) {\n const keep = el.style.scrollMarginTop;\n el.style.scrollMarginTop = bounds(el).top + edge() + pad + 'px';\n el.scrollIntoView?.({ block: 'start', behavior: 'auto' });\n el.style.scrollMarginTop = keep;\n } else el?.scrollIntoView?.({ block: tall ? 'start' : 'center', behavior: 'auto' });\n let raf = 0;\n let last = '';\n const tick = () => {\n if (!el?.isConnected) el = findTarget(target);\n const r = el?.getBoundingClientRect();\n let v: Box | null = null;\n if (r && r.width) {\n const l = Math.max(3, r.left - pad);\n const t = Math.max(3, r.top - pad);\n v = {\n left: l,\n top: t,\n width: Math.max(0, Math.min(window.innerWidth - 3, r.right + pad) - l),\n height: Math.max(0, Math.min(window.innerHeight - 3, r.bottom + pad) - t),\n };\n }\n const ks: Box[] = [];\n for (const kt of keepRef.current) {\n const kr = findTarget(kt)?.getBoundingClientRect();\n if (kr && kr.width) ks.push({ left: kr.left, top: kr.top, width: kr.width, height: kr.height });\n }\n const k = JSON.stringify([v, ks]);\n if (k !== last) {\n last = k;\n setRect(v);\n setKept(ks);\n }\n raf = requestAnimationFrame(tick);\n };\n tick();\n return () => cancelAnimationFrame(raf);\n }, [open, hasStep, i, target, pad, keepKey]);\n\n // The card's height decides where it fits. The popup mounts after the first render (in a portal), so it is measured\n // through a callback ref when it appears, and again on every resize.\n const observer = React.useRef<ResizeObserver | null>(null);\n const card = React.useCallback((el: HTMLDivElement | null) => {\n cardEl.current = el;\n observer.current?.disconnect();\n observer.current = null;\n if (!el) return;\n const measure = () => {\n setCardH(el.offsetHeight);\n setCardW(el.offsetWidth);\n };\n measure();\n observer.current = resizeObserver(measure);\n observer.current?.observe(el);\n }, []);\n\n // Make room for the card (per step, again when its height changes: its width, and so its height, depends on where it\n // goes): with no room above or below the target, the page\n // scrolls so the target's top sits just under the window's top when the target and the card fit together, card\n // below; when they do not (a target taller than the window), so the card fits above the target. The card then\n // covers no part of the target.\n const measured = cardH > 0;\n React.useEffect(() => {\n if (!open || !hasStep || !measured) return;\n const el = findTarget(target);\n if (!(el instanceof HTMLElement)) return;\n const ar = bounds(el);\n const m = edge();\n const r = el.getBoundingClientRect();\n const top = r.top - pad;\n const bottom = r.bottom + pad;\n // A side already fits: nothing to do.\n const spot = { left: r.left - pad, top, width: r.width + 2 * pad, height: bottom - top };\n if (placeCard(spot, cardH, step?.side ?? 'bottom', ar, cardW, kept).fits) return;\n const together = bottom - top + GAP + cardH + 2 * m <= ar.bottom - ar.top;\n const want = together ? ar.top + m + pad : ar.top + m + cardH + GAP + pad;\n // The nearest box that scrolls (AppShell's main), else the window, moves by exactly the difference.\n let box: HTMLElement | null = el.parentElement;\n while (box && !(/(auto|scroll)/.test(getComputedStyle(box).overflowY) && box.scrollHeight > box.clientHeight)) box = box.parentElement;\n const dy = r.top - want;\n if (box) box.scrollBy({ top: dy, behavior: 'auto' });\n else window.scrollBy({ top: dy, behavior: 'auto' });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- kept moves with every scroll; the room is made once per step\n }, [open, hasStep, i, target, pad, measured, cardH]);\n\n const room = open && step ? bounds(findTarget(step.target)) : undefined;\n const place = placeCard(rect, cardH, step?.side ?? 'bottom', room, cardW, kept);\n // The card's top-left corner: a point the popup hangs from (side bottom, aligned at its start).\n const ax = place.box.left;\n const ay = place.box.top;\n const anchor = React.useMemo(() => ({ getBoundingClientRect: () => new DOMRect(ax, ay, 0, 0) }), [ax, ay]);\n if (!open || !step) return null;\n const lastStep = i === steps.length - 1;\n return (\n <Popover.Root\n open\n modal\n onOpenChange={(_, details) => {\n if (details.reason === 'escape-key' && skippable) end('skip');\n }}\n >\n <Popover.Portal>\n <div className=\"ui-tour-layer\">\n <div className={cx('ui-tour-block', !rect && 'is-dim')} />\n {rect ? <div className=\"ui-tour-spot\" aria-hidden=\"true\" style={rect} /> : null}\n </div>\n <Popover.Positioner\n className=\"ui-float ui-tour-float\"\n anchor={anchor}\n side=\"bottom\"\n align=\"start\"\n sideOffset={0}\n // Where the card goes is worked out above (placeCard), already inside the window.\n collisionAvoidance={{ side: 'none', align: 'none', fallbackAxisSide: 'none' }}\n >\n <Popover.Popup ref={card} key={i} className=\"ui-tour-card\" data-placement={place.mode} initialFocus={next} onKeyDown={onTab}>\n {/* Taller than the window (phones): this part scrolls, the buttons stay at the bottom. */}\n <div className=\"ui-tour-body\">\n <div className=\"ui-tour-count\">\n {/* Shown 「1 / 5」, drawn by CSS; read and copied as 「第 1 步,共 5 步」, not 「1 斜線 5」. */}\n <span aria-hidden=\"true\">{seenOnly(tr('{n} / {total}', { n: '\\u0001', total: '\\u0002' }), [String(i + 1), String(steps.length)])}</span>\n <span className=\"ui-visually-hidden\">{tr('第 {a} 步,共 {b} 步', { a: i + 1, b: steps.length })}</span>\n </div>\n <Popover.Title className=\"ui-tour-title\">{step.title}</Popover.Title>\n <CodeText as=\"div\" className=\"ui-tour-text\" text={step.text} />\n </div>\n <div className=\"ui-tour-actions\">\n {skippable && !lastStep ? (\n <button type=\"button\" className=\"ui-link-btn is-muted\" onClick={() => end('skip')}>\n {tr('略過')}\n </button>\n ) : null}\n <span className=\"ui-tour-gap\" />\n {i > 0 ? <Button onClick={() => go(i - 1)}>{tr('上一步')}</Button> : null}\n <Button ref={next} variant=\"primary\" onClick={() => (lastStep ? end('done') : go(i + 1))}>\n {lastStep ? tr('完成') : tr('下一步')}\n </Button>\n </div>\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAyCA,MAAM,WAAW;;;;;AAMjB,SAAgB,QAAQ,KAAa;CACnC,MAAM,CAAC,MAAM,WAAW,MAAM,eAAe,CAAC,CAAC,MAAM,WAAW,GAAG,CAAC;CACpE,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAE5C,MAAM,SAAS,MAAM,OAAO,KAAK;CACjC,MAAM,sBAAsB;EAE1B,IAAI,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,SAAS,QAAQ,IAAI;CAC7D,GAAG,CAAC,GAAG,CAAC;CACR,MAAM,iBAAiB;EACrB,MAAM,WAAW,KAAK,GAAG;EACzB,QAAQ,IAAI;CACd;CACA,OAAO;EACL;EACA,aAAa,QAAQ,IAAI;EACzB,aAAa;GACX,SAAS;GACT,QAAQ,KAAK;EACf;EACA;;EAEA,OAAO,MAAc,WAAgD;GACnE,OAAO,UAAU;GACjB,IAAI,QAAQ,MAAM,OAAO,KAAA;GACzB,OAAO;IAAE;IAAM;IAAQ,gBAAgB,QAAQ,IAAI;IAAG,WAAW;GAAS;EAC5E;CACF;AACF;AAEA,SAAS,WAAW,GAAuC;CACzD,IAAI,CAAC,GAAG,OAAO;CACf,IAAI,OAAO,MAAM,UAAU;EACzB,MAAM,MAAM,WAAW,KAAK,CAAC,KAAK,CAAC,qDAAqD,KAAK,CAAC,IAAI,eAAe,EAAE,MAAM;EACzH,OAAO,MAAM,KAAK,SAAS,iBAAiB,GAAG,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,eAAe,CAAC,CAAC,SAAS,CAAC,KAAK;CAClG;CACA,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,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACG,aAAa,CAAC,WACb,oBAAC,UAAD;OAAQ,MAAK;OAAS,WAAU;OAAuB,eAAe,IAAI,MAAM;OAC7E,UAAA,GAAG,IAAI;MACF,CAAA,IACN;MACJ,oBAAC,QAAD,EAAM,WAAU,cAAe,CAAA;MAC9B,IAAI,IAAI,oBAAC,QAAD;OAAQ,eAAe,GAAG,IAAI,CAAC;OAAI,UAAA,GAAG,KAAK;MAAU,CAAA,IAAI;MAClE,oBAAC,QAAD;OAAQ,KAAK;OAAM,SAAQ;OAAU,eAAgB,WAAW,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC;OACnF,UAAA,WAAW,GAAG,IAAI,IAAI,GAAG,KAAK;MACzB,CAAA;KACL;IACQ,CAAA,CAAA;GAvBgB,GAAA,CAuBhB;EACG,CAAA,CACN,EAAA,CAAA;CACJ,CAAA;AAElB"}
1
+ {"version":3,"file":"Tour.js","names":[],"sources":["../../../src/components/Tour/Tour.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReturnFocus } from '../../internal/focus';\nimport { Popover } from '@base-ui/react/popover';\nimport { CodeText } from '../InlineCode/InlineCode';\nimport { Button } from '../Button/Button';\nimport { tr } from '../../i18n';\nimport { announce } from '../../announce';\nimport { cx, seenOnly, resizeObserver } from '../../internal/util';\nimport { readStored, useStored } from '../../internal/stored';\nimport { devWarn } from '../../internal/dev';\nimport { useOpenState } from '../../internal/open';\nimport type { IconButtonHint } from '../IconButton/IconButton';\n\nexport interface TourStep {\n /** A data-tour name ('search' matches [data-tour=\"search\"]), a CSS selector (first visible match), a ref or an element.\n * Leave it out for a step in the middle of the screen. */\n target?: string | React.RefObject<Element | null> | Element;\n /** Names the part: 「搜尋」. */\n title: string;\n /** What it does, 1 short sentence; `backticks` are code. */\n text: string;\n /** Default 'bottom'. The card goes below, above, right or left of the target, the first side where it fits in the\n * window and covers neither the target nor `keepVisible` ('top' tries above first). With no such side the page\n * scrolls to make room; failing that, the side that covers the least of the target. */\n side?: 'bottom' | 'top';\n /** Space around the highlighted part in px. Default 6. */\n padding?: number;\n /** Parts the card must not cover either, e.g. the table the step talks about under a highlighted summary: same forms\n * as target. The card then goes to the next side that leaves them visible. */\n keepVisible?: TourStep['target'] | TourStep['target'][];\n}\n\nexport interface TourProps {\n /** Controlled: shown while true (useTour's `open`). */\n open?: boolean;\n /** Uncontrolled: whether it starts open. */\n defaultOpen?: boolean;\n /** Called with false and why it ended: 'done' (完成 on the last step) or 'skip' (略過 or Esc). Pass useTour's\n * `onOpenChange`. */\n onOpenChange?: (open: boolean, reason?: 'done' | 'skip') => void;\n /** The steps, 3 to 5, in order. */\n steps: TourStep[];\n /** @deprecated use onOpenChange: called with why the tour ended. */\n onClose?: (reason: 'done' | 'skip') => void;\n /** 「略過」 and Esc end the tour early. Default true. */\n skippable?: boolean;\n /** Controlled step index. */\n step?: number;\n /** Called with the new step index (from 0) when the person moves on or back. */\n onStepChange?: (index: number) => void;\n}\n\nconst TOUR_KEY = 'ui-tour:';\nconst seenOnce = (raw: string) => !!raw;\n\n/** Opens the tour once per browser: { open, onOpenChange, start, close, seen, hint }. Pass open and onOpenChange to Tour; start() shows\n * it again. hint(text) gives IconButton's `hint` for the button that starts the tour: a page that uses it shows the dot\n * and the bubble instead of opening the tour by itself. 「開始」 starts the tour; × and finishing it hide the hint for\n * good (the same record as seen). */\nexport function useTour(key: string) {\n // Not seen on the server and the first browser render, then the stored record.\n const [seen, setSeen] = useStored(TOUR_KEY + key, seenOnce, false, (v) => (v ? '1' : null));\n const [open, setOpen] = React.useState(false);\n // hint() is called while the page renders; the tour opens by itself after that render only when it was not.\n const hinted = React.useRef(false);\n React.useLayoutEffect(() => {\n // Known only after the page rendered: whether it uses hint().\n if (!readStored(TOUR_KEY + key) && !hinted.current) setOpen(true);\n }, [key]);\n const remember = () => setSeen(true);\n const close = () => {\n remember();\n setOpen(false);\n };\n return {\n open,\n /** Tour's onOpenChange: closing records the tour as seen. */\n onOpenChange: (next: boolean) => (next ? setOpen(true) : close()),\n start: () => setOpen(true),\n close,\n seen,\n /** IconButton's `hint` for the button that starts this tour, or undefined once seen or while the tour is open. */\n hint: (text: string, action?: string): IconButtonHint | undefined => {\n hinted.current = true;\n if (seen || open) return undefined;\n return { text, action, onAction: () => setOpen(true), onDismiss: remember };\n },\n };\n}\n\nfunction findTarget(t: TourStep['target']): Element | null {\n if (!t) return null;\n if (typeof t === 'string') {\n const sel = /^[\\w-]+$/.test(t) && !/^(html|body|main|nav|header|footer|section|aside)$/.test(t) ? `[data-tour=\"${t}\"]` : t;\n return Array.from(document.querySelectorAll(sel)).find((e) => e.getClientRects().length > 0) ?? null;\n }\n return t instanceof Element ? t : t.current;\n}\n\ninterface Box {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\nconst GAP = 12;\n\n/** The space kept between the card and the window edges: the --space-3 token. */\nfunction edge() {\n return parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--space-3')) || 12;\n}\n\nconst narrowNow = () => typeof window !== 'undefined' && window.innerWidth < 600;\n\n/** The part of the window between a phone's fixed top bar and bottom tab bar (when the target is not one of them):\n * the card stays inside it and never covers either bar. The whole window elsewhere. */\nfunction bounds(target: Element | null): { top: number; bottom: number } {\n const vh = typeof window === 'undefined' ? 0 : window.innerHeight;\n if (!narrowNow()) return { top: 0, bottom: vh };\n let top = 0;\n let bottom = vh;\n const head = document.querySelector('.ui-shell-top');\n const bar = document.querySelector('.ui-tabbar');\n if (head && !(target && head.contains(target))) {\n const r = head.getBoundingClientRect();\n if (r.height && r.bottom > 0 && r.bottom < vh / 2) top = r.bottom;\n }\n if (bar && !(target && bar.contains(target))) {\n const r = bar.getBoundingClientRect();\n if (r.height && r.top > vh / 2 && r.top < vh) bottom = r.top;\n }\n return { top, bottom };\n}\n\ntype Side = 'bottom' | 'top' | 'right' | 'left';\nconst area = (a: Box, b: Box) =>\n Math.max(0, Math.min(a.left + a.width, b.left + b.width) - Math.max(a.left, b.left)) *\n Math.max(0, Math.min(a.top + a.height, b.top + b.height) - Math.max(a.top, b.top));\n\n/** Where the card goes for a highlighted box. Below, above, right, left (above first with side 'top'): the first\n * where the card fits inside the window and covers neither the target nor the parts the step keeps visible. When\n * none does (after the tour scrolled to make room, see makeRoom), the one that covers the least of the target, then\n * of those parts. Returns the card's box: it is placed at that box's top-left corner. */\nfunction placeCard(rect: Box | null, cardH: number, prefer: 'bottom' | 'top', area_?: { top: number; bottom: number }, cardW = 320, keep: Box[] = []) {\n const margin = typeof document === 'undefined' ? 12 : edge();\n const vw = typeof window === 'undefined' ? 0 : window.innerWidth;\n const vh = area_?.bottom ?? (typeof window === 'undefined' ? 0 : window.innerHeight);\n const vt = area_?.top ?? 0;\n if (!rect) {\n // No target: centered in the window.\n const box = { left: (vw - cardW) / 2, top: Math.max(vt + margin, (vt + vh) / 2 - cardH / 2), width: cardW, height: cardH };\n return { mode: 'center', box, fits: true };\n }\n const clampX = (x: number) => Math.max(margin, Math.min(vw - margin - cardW, x));\n const clampY = (y: number) => Math.max(vt + margin, Math.min(vh - margin - cardH, y));\n const midX = rect.left + rect.width / 2 - cardW / 2;\n const midY = rect.top + rect.height / 2 - cardH / 2;\n const at: Record<Side, { left: number; top: number }> = {\n bottom: { left: midX, top: rect.top + rect.height + GAP },\n top: { left: midX, top: rect.top - GAP - cardH },\n right: { left: rect.left + rect.width + GAP, top: midY },\n left: { left: rect.left - GAP - cardW, top: midY },\n };\n const order: Side[] = prefer === 'top' ? ['top', 'bottom', 'right', 'left'] : ['bottom', 'top', 'right', 'left'];\n const options = order.map((side) => {\n const want = at[side];\n // Along the target's edge the card may shift to stay inside the window; away from it, it must not.\n const box = { left: clampX(want.left), top: clampY(want.top), width: cardW, height: cardH };\n const inside = side === 'bottom' || side === 'top' ? box.top === want.top : box.left === want.left;\n const onTarget = area(box, rect);\n const onKept = keep.reduce((n, k) => n + area(box, k), 0);\n return { mode: side, box, fits: inside && !onTarget && !onKept, onTarget, onKept };\n });\n const best = options.find((o) => o.fits) ?? [...options].sort((x, y) => x.onTarget - y.onTarget || x.onKept - y.onKept)[0];\n return { mode: best.mode, box: best.box, fits: best.fits };\n}\n\n/** The first-use walkthrough: the page goes dark except the part being introduced, with a card beside it. */\nexport function Tour({ open: openProp, defaultOpen, onOpenChange, steps, onClose, skippable = true, step: controlled, onStepChange }: TourProps) {\n devWarn(!!onClose, 'Tour', 'onClose is deprecated: pass onOpenChange (useTour gives tour.onOpenChange). It still works for now.');\n const [open, setOpen] = useOpenState({ open: openProp, defaultOpen, onOpenChange: onOpenChange as (o: boolean, r?: string) => void });\n const [inner, setInner] = React.useState(0);\n const i = Math.max(0, Math.min(steps.length - 1, controlled ?? inner));\n const step = steps[i];\n const [rect, setRect] = React.useState<Box | null>(null);\n const [kept, setKept] = React.useState<Box[]>([]);\n const next = React.useRef<HTMLButtonElement>(null);\n const [cardH, setCardH] = React.useState(0);\n const [cardW, setCardW] = React.useState(320);\n const [wasOpen, setWasOpen] = React.useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open && controlled == null) setInner(0);\n }\n const go = (n: number) => {\n onStepChange?.(n);\n if (controlled == null) setInner(n);\n };\n const end = (why: 'done' | 'skip') => {\n setOpen(false, why);\n onClose?.(why);\n };\n useReturnFocus(open);\n // A new step after 下一步 or 上一步: its count, title and text are read (focus stays on the button, which does not read\n // them). The first step is read as the dialog opens.\n const shownStep = React.useRef(-1);\n React.useEffect(() => {\n if (!open || !step) {\n shownStep.current = -1;\n return;\n }\n if (shownStep.current !== -1 && shownStep.current !== i)\n announce(tr('第 {a} 步,共 {b} 步', { a: i + 1, b: steps.length }) + tr('。') + step.title + tr('。') + step.text.replace(/`/g, ''));\n shownStep.current = i;\n }, [open, i, step, steps.length]);\n const cardEl = React.useRef<HTMLDivElement | null>(null);\n // Tab and Shift+Tab go round the card's buttons only. Base UI's popover leaves focus guards around the card (no\n // name) that let Tab reach the page; focus that gets out anyway (a click on the dimmed page) comes back to 下一步.\n const tabbables = () =>\n Array.from(\n cardEl.current?.querySelectorAll<HTMLElement>('button:not(:disabled), a[href], input:not(:disabled), [tabindex]:not([tabindex=\"-1\"])') ?? [],\n ).filter((e) => e.getClientRects().length > 0);\n const onTab = (e: React.KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) return;\n const list = tabbables();\n if (!list.length) return;\n e.preventDefault();\n const at = list.indexOf(document.activeElement as HTMLElement);\n const to = at < 0 ? 0 : (at + (e.shiftKey ? -1 : 1) + list.length) % list.length;\n list[to].focus();\n };\n React.useEffect(() => {\n if (!open) return;\n const back = (e: FocusEvent) => {\n const box = cardEl.current;\n if (!box || !(e.target instanceof Node) || box.contains(e.target)) return;\n (next.current ?? tabbables()[0])?.focus();\n };\n document.addEventListener('focusin', back);\n return () => document.removeEventListener('focusin', back);\n }, [open]);\n\n // Follow the target while it moves (scrolling, layout changes).\n // Depends on the step's fields, not the object: inline steps arrays are new on every render.\n const target = step?.target;\n const pad = step?.padding ?? 6;\n // keepVisible as one stable value for the effect below (an inline array is new on every render).\n const keepList = step?.keepVisible == null ? [] : Array.isArray(step.keepVisible) ? step.keepVisible : [step.keepVisible];\n const keepKey = keepList.map((k) => (typeof k === 'string' ? k : '#')).join('|');\n const keepRef = React.useRef(keepList);\n React.useLayoutEffect(() => {\n keepRef.current = keepList;\n });\n const hasStep = !!step;\n React.useEffect(() => {\n if (!open || !hasStep) return;\n // A selector is looked up again until it appears (the target may render later), then kept.\n let el = findTarget(target);\n // Bring the target into view first; one taller than the window shows from its top. On a phone the target goes\n // to the top, just under the top bar, so the card fits below it instead of covering it. The jump is instant: the\n // modal's scroll lock stops a smooth scroll halfway; the spotlight's own transition shows the move.\n const tall = (el?.getBoundingClientRect().height ?? 0) > window.innerHeight;\n // A target as tall as the window leaves no room beside it: the card has to cover part of it.\n devWarn(\n el && el.getBoundingClientRect().height > window.innerHeight * 0.7,\n 'Tour',\n `the target \"${target}\" of step ${i + 1} is taller than 70% of the window, so the card has to cover part of it. Put data-tour on a smaller element, such as the card or row the step explains, not the whole page.`,\n );\n if (el instanceof HTMLElement && narrowNow()) {\n const keep = el.style.scrollMarginTop;\n el.style.scrollMarginTop = bounds(el).top + edge() + pad + 'px';\n el.scrollIntoView?.({ block: 'start', behavior: 'auto' });\n el.style.scrollMarginTop = keep;\n } else el?.scrollIntoView?.({ block: tall ? 'start' : 'center', behavior: 'auto' });\n let raf = 0;\n let last = '';\n const tick = () => {\n if (!el?.isConnected) el = findTarget(target);\n const r = el?.getBoundingClientRect();\n let v: Box | null = null;\n if (r && r.width) {\n const l = Math.max(3, r.left - pad);\n const t = Math.max(3, r.top - pad);\n v = {\n left: l,\n top: t,\n width: Math.max(0, Math.min(window.innerWidth - 3, r.right + pad) - l),\n height: Math.max(0, Math.min(window.innerHeight - 3, r.bottom + pad) - t),\n };\n }\n const ks: Box[] = [];\n for (const kt of keepRef.current) {\n const kr = findTarget(kt)?.getBoundingClientRect();\n if (kr && kr.width) ks.push({ left: kr.left, top: kr.top, width: kr.width, height: kr.height });\n }\n const k = JSON.stringify([v, ks]);\n if (k !== last) {\n last = k;\n setRect(v);\n setKept(ks);\n }\n raf = requestAnimationFrame(tick);\n };\n tick();\n return () => cancelAnimationFrame(raf);\n }, [open, hasStep, i, target, pad, keepKey]);\n\n // The card's height decides where it fits. The popup mounts after the first render (in a portal), so it is measured\n // through a callback ref when it appears, and again on every resize.\n const observer = React.useRef<ResizeObserver | null>(null);\n const card = React.useCallback((el: HTMLDivElement | null) => {\n cardEl.current = el;\n observer.current?.disconnect();\n observer.current = null;\n if (!el) return;\n const measure = () => {\n setCardH(el.offsetHeight);\n setCardW(el.offsetWidth);\n };\n measure();\n observer.current = resizeObserver(measure);\n observer.current?.observe(el);\n }, []);\n\n // Make room for the card (per step, again when its height changes: its width, and so its height, depends on where it\n // goes): with no room above or below the target, the page\n // scrolls so the target's top sits just under the window's top when the target and the card fit together, card\n // below; when they do not (a target taller than the window), so the card fits above the target. The card then\n // covers no part of the target.\n const measured = cardH > 0;\n React.useEffect(() => {\n if (!open || !hasStep || !measured) return;\n const el = findTarget(target);\n if (!(el instanceof HTMLElement)) return;\n const ar = bounds(el);\n const m = edge();\n const r = el.getBoundingClientRect();\n const top = r.top - pad;\n const bottom = r.bottom + pad;\n // A side already fits: nothing to do.\n const spot = { left: r.left - pad, top, width: r.width + 2 * pad, height: bottom - top };\n if (placeCard(spot, cardH, step?.side ?? 'bottom', ar, cardW, kept).fits) return;\n const together = bottom - top + GAP + cardH + 2 * m <= ar.bottom - ar.top;\n const want = together ? ar.top + m + pad : ar.top + m + cardH + GAP + pad;\n // The nearest box that scrolls (AppShell's main), else the window, moves by exactly the difference.\n let box: HTMLElement | null = el.parentElement;\n while (box && !(/(auto|scroll)/.test(getComputedStyle(box).overflowY) && box.scrollHeight > box.clientHeight)) box = box.parentElement;\n const dy = r.top - want;\n if (box) box.scrollBy({ top: dy, behavior: 'auto' });\n else window.scrollBy({ top: dy, behavior: 'auto' });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- kept moves with every scroll; the room is made once per step\n }, [open, hasStep, i, target, pad, measured, cardH]);\n\n const room = open && step ? bounds(findTarget(step.target)) : undefined;\n const place = placeCard(rect, cardH, step?.side ?? 'bottom', room, cardW, kept);\n // The card's top-left corner: a point the popup hangs from (side bottom, aligned at its start).\n const ax = place.box.left;\n const ay = place.box.top;\n const anchor = React.useMemo(() => ({ getBoundingClientRect: () => new DOMRect(ax, ay, 0, 0) }), [ax, ay]);\n if (!open || !step) return null;\n const lastStep = i === steps.length - 1;\n return (\n <Popover.Root\n open\n modal\n onOpenChange={(_, details) => {\n if (details.reason === 'escape-key' && skippable) end('skip');\n }}\n >\n <Popover.Portal>\n <div className=\"ui-tour-layer\">\n <div className={cx('ui-tour-block', !rect && 'is-dim')} />\n {rect ? <div className=\"ui-tour-spot\" aria-hidden=\"true\" style={rect} /> : null}\n </div>\n <Popover.Positioner\n className=\"ui-float ui-tour-float\"\n anchor={anchor}\n side=\"bottom\"\n align=\"start\"\n sideOffset={0}\n // Where the card goes is worked out above (placeCard), already inside the window.\n collisionAvoidance={{ side: 'none', align: 'none', fallbackAxisSide: 'none' }}\n >\n <Popover.Popup ref={card} key={i} className=\"ui-tour-card\" data-placement={place.mode} initialFocus={next} onKeyDown={onTab}>\n {/* Taller than the window (phones): this part scrolls, the buttons stay at the bottom. */}\n <div className=\"ui-tour-body\">\n <div className=\"ui-tour-count\">\n {/* Shown 「1 / 5」, drawn by CSS; read and copied as 「第 1 步,共 5 步」, not 「1 斜線 5」. */}\n <span aria-hidden=\"true\">{seenOnly(tr('{n} / {total}', { n: '\\u0001', total: '\\u0002' }), [String(i + 1), String(steps.length)])}</span>\n <span className=\"ui-visually-hidden\">{tr('第 {a} 步,共 {b} 步', { a: i + 1, b: steps.length })}</span>\n </div>\n <Popover.Title className=\"ui-tour-title\">{step.title}</Popover.Title>\n <CodeText as=\"div\" className=\"ui-tour-text\" text={step.text} />\n </div>\n <div className=\"ui-tour-actions\">\n {skippable && !lastStep ? (\n <button type=\"button\" className=\"ui-link-btn is-muted\" onClick={() => end('skip')}>\n {tr('略過')}\n </button>\n ) : null}\n <span className=\"ui-tour-gap\" />\n {i > 0 ? <Button onClick={() => go(i - 1)}>{tr('上一步')}</Button> : null}\n <Button ref={next} variant=\"primary\" onClick={() => (lastStep ? end('done') : go(i + 1))}>\n {lastStep ? tr('完成') : tr('下一步')}\n </Button>\n </div>\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoDA,MAAM,WAAW;AACjB,MAAM,YAAY,QAAgB,CAAC,CAAC;;;;;AAMpC,SAAgB,QAAQ,KAAa;CAEnC,MAAM,CAAC,MAAM,WAAW,UAAU,WAAW,KAAK,UAAU,QAAQ,MAAO,IAAI,MAAM,IAAK;CAC1F,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAE5C,MAAM,SAAS,MAAM,OAAO,KAAK;CACjC,MAAM,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