@seanyeh77/ui 0.41.0 → 0.43.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 (677) hide show
  1. package/README.md +32 -0
  2. package/dist/announce.d.ts +3 -0
  3. package/dist/announce.js +35 -0
  4. package/dist/announce.js.map +1 -0
  5. package/dist/bundle.js +24 -24
  6. package/dist/bundle.js.map +1 -1
  7. package/dist/components/AccentPicker/AccentPicker.d.ts +12 -0
  8. package/dist/components/AccentPicker/AccentPicker.js +99 -0
  9. package/dist/components/AccentPicker/AccentPicker.js.map +1 -0
  10. package/dist/components/ActionBar/ActionBar.d.ts +27 -0
  11. package/dist/components/ActionBar/ActionBar.js +62 -0
  12. package/dist/components/ActionBar/ActionBar.js.map +1 -0
  13. package/dist/components/AiMark/AiMark.d.ts +10 -0
  14. package/dist/components/AiMark/AiMark.js +21 -0
  15. package/dist/components/AiMark/AiMark.js.map +1 -0
  16. package/dist/components/Alert/Alert.d.ts +17 -0
  17. package/dist/components/Alert/Alert.js +59 -0
  18. package/dist/components/Alert/Alert.js.map +1 -0
  19. package/dist/components/AppShell/AppShell.d.ts +36 -0
  20. package/dist/components/AppShell/AppShell.js +198 -0
  21. package/dist/components/AppShell/AppShell.js.map +1 -0
  22. package/dist/components/Badge/Badge.d.ts +12 -0
  23. package/dist/components/Badge/Badge.js +58 -0
  24. package/dist/components/Badge/Badge.js.map +1 -0
  25. package/dist/components/BarChart/BarChart.d.ts +19 -0
  26. package/dist/components/BarChart/BarChart.js +78 -0
  27. package/dist/components/BarChart/BarChart.js.map +1 -0
  28. package/dist/components/Breadcrumb/Breadcrumb.d.ts +11 -0
  29. package/dist/components/Breadcrumb/Breadcrumb.js +29 -0
  30. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
  31. package/dist/components/Button/Button.d.ts +39 -0
  32. package/dist/components/Button/Button.js +55 -0
  33. package/dist/components/Button/Button.js.map +1 -0
  34. package/dist/components/Calendar/Calendar.d.ts +18 -0
  35. package/dist/components/Calendar/Calendar.js +129 -0
  36. package/dist/components/Calendar/Calendar.js.map +1 -0
  37. package/dist/components/Card/Card.d.ts +14 -0
  38. package/dist/components/Card/Card.js +33 -0
  39. package/dist/components/Card/Card.js.map +1 -0
  40. package/dist/components/Checkbox/Checkbox.d.ts +14 -0
  41. package/dist/components/Checkbox/Checkbox.js +27 -0
  42. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  43. package/dist/components/CodeView/CodeView.d.ts +111 -0
  44. package/dist/components/CodeView/CodeView.js +794 -0
  45. package/dist/components/CodeView/CodeView.js.map +1 -0
  46. package/dist/components/CodeView/tokens.d.ts +5 -0
  47. package/dist/components/CodeView/tokens.js +70 -0
  48. package/dist/components/CodeView/tokens.js.map +1 -0
  49. package/dist/components/CommandPalette/CommandPalette.d.ts +52 -0
  50. package/dist/components/CommandPalette/CommandPalette.js +250 -0
  51. package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
  52. package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +44 -0
  53. package/dist/components/ConsoleLayout/ConsoleLayout.js +123 -0
  54. package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -0
  55. package/dist/components/DangerZone/DangerZone.d.ts +16 -0
  56. package/dist/components/DangerZone/DangerZone.js +28 -0
  57. package/dist/components/DangerZone/DangerZone.js.map +1 -0
  58. package/dist/components/DataTable/DataTable.d.ts +99 -0
  59. package/dist/components/DataTable/DataTable.js +1272 -0
  60. package/dist/components/DataTable/DataTable.js.map +1 -0
  61. package/dist/components/DataTable/SortButton.js +228 -0
  62. package/dist/components/DataTable/SortButton.js.map +1 -0
  63. package/dist/components/DataTable/filters.js +147 -0
  64. package/dist/components/DataTable/filters.js.map +1 -0
  65. package/dist/components/DataTable/parts.js +383 -0
  66. package/dist/components/DataTable/parts.js.map +1 -0
  67. package/dist/components/DataTable/types.d.ts +85 -0
  68. package/dist/components/DatePicker/DatePicker.d.ts +15 -0
  69. package/dist/components/DatePicker/DatePicker.js +107 -0
  70. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  71. package/dist/components/DateRangePicker/DateRangePicker.d.ts +11 -0
  72. package/dist/components/DateRangePicker/DateRangePicker.js +91 -0
  73. package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -0
  74. package/dist/components/DetailList/DetailList.d.ts +17 -0
  75. package/dist/components/DetailList/DetailList.js +18 -0
  76. package/dist/components/DetailList/DetailList.js.map +1 -0
  77. package/dist/components/Dialog/Dialog.d.ts +30 -0
  78. package/dist/components/Dialog/Dialog.js +90 -0
  79. package/dist/components/Dialog/Dialog.js.map +1 -0
  80. package/dist/components/Drawer/Drawer.d.ts +20 -0
  81. package/dist/components/Drawer/Drawer.js +67 -0
  82. package/dist/components/Drawer/Drawer.js.map +1 -0
  83. package/dist/components/EmptyState/EmptyState.d.ts +15 -0
  84. package/dist/components/EmptyState/EmptyState.js +34 -0
  85. package/dist/components/EmptyState/EmptyState.js.map +1 -0
  86. package/dist/components/ErrorPage/ErrorPage.d.ts +14 -0
  87. package/dist/components/ErrorPage/ErrorPage.js +47 -0
  88. package/dist/components/ErrorPage/ErrorPage.js.map +1 -0
  89. package/dist/components/EventTimeline/EventTimeline.d.ts +19 -0
  90. package/dist/components/EventTimeline/EventTimeline.js +69 -0
  91. package/dist/components/EventTimeline/EventTimeline.js.map +1 -0
  92. package/dist/components/FileUpload/FileUpload.d.ts +27 -0
  93. package/dist/components/FileUpload/FileUpload.js +126 -0
  94. package/dist/components/FileUpload/FileUpload.js.map +1 -0
  95. package/dist/components/FormGrid/FormGrid.d.ts +7 -0
  96. package/dist/components/FormGrid/FormGrid.js +14 -0
  97. package/dist/components/FormGrid/FormGrid.js.map +1 -0
  98. package/dist/components/Graph/Graph.d.ts +18 -0
  99. package/dist/components/Graph/Graph.js +97 -0
  100. package/dist/components/Graph/Graph.js.map +1 -0
  101. package/dist/components/Grid/Grid.d.ts +16 -0
  102. package/dist/components/Grid/Grid.js +21 -0
  103. package/dist/components/Grid/Grid.js.map +1 -0
  104. package/dist/components/IconButton/IconButton.d.ts +32 -0
  105. package/dist/components/IconButton/IconButton.js +107 -0
  106. package/dist/components/IconButton/IconButton.js.map +1 -0
  107. package/dist/components/InlineCode/InlineCode.d.ts +46 -0
  108. package/dist/components/InlineCode/InlineCode.js +71 -0
  109. package/dist/components/InlineCode/InlineCode.js.map +1 -0
  110. package/dist/components/KpiCard/KpiCard.d.ts +38 -0
  111. package/dist/components/KpiCard/KpiCard.js +116 -0
  112. package/dist/components/KpiCard/KpiCard.js.map +1 -0
  113. package/dist/components/LayerGraph/LayerGraph.d.ts +117 -0
  114. package/dist/components/LayerGraph/LayerGraph.js +1648 -0
  115. package/dist/components/LayerGraph/LayerGraph.js.map +1 -0
  116. package/dist/components/LineChart/LineChart.d.ts +73 -0
  117. package/dist/components/LineChart/LineChart.js +337 -0
  118. package/dist/components/LineChart/LineChart.js.map +1 -0
  119. package/dist/components/LoadingBar/LoadingBar.d.ts +7 -0
  120. package/dist/components/LoadingBar/LoadingBar.js +18 -0
  121. package/dist/components/LoadingBar/LoadingBar.js.map +1 -0
  122. package/dist/components/LoginCard/LoginCard.d.ts +23 -0
  123. package/dist/components/LoginCard/LoginCard.js +117 -0
  124. package/dist/components/LoginCard/LoginCard.js.map +1 -0
  125. package/dist/components/Markdown/Markdown.d.ts +38 -0
  126. package/dist/components/Markdown/Markdown.js +719 -0
  127. package/dist/components/Markdown/Markdown.js.map +1 -0
  128. package/dist/components/Menu/Menu.d.ts +33 -0
  129. package/dist/components/Menu/Menu.js +78 -0
  130. package/dist/components/Menu/Menu.js.map +1 -0
  131. package/dist/components/Meter/Meter.d.ts +20 -0
  132. package/dist/components/Meter/Meter.js +120 -0
  133. package/dist/components/Meter/Meter.js.map +1 -0
  134. package/dist/components/MobileTabBar/MobileTabBar.d.ts +21 -0
  135. package/dist/components/MobileTabBar/MobileTabBar.js +47 -0
  136. package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -0
  137. package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
  138. package/dist/components/MultiSelect/MultiSelect.js +119 -0
  139. package/dist/components/MultiSelect/MultiSelect.js.map +1 -0
  140. package/dist/components/NotificationBell/NotificationBell.d.ts +20 -0
  141. package/dist/components/NotificationBell/NotificationBell.js +95 -0
  142. package/dist/components/NotificationBell/NotificationBell.js.map +1 -0
  143. package/dist/components/Popover/Popover.d.ts +20 -0
  144. package/dist/components/Popover/Popover.js +48 -0
  145. package/dist/components/Popover/Popover.js.map +1 -0
  146. package/dist/components/ProgressBar/ProgressBar.d.ts +10 -0
  147. package/dist/components/ProgressBar/ProgressBar.js +38 -0
  148. package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
  149. package/dist/components/ProgressRing/ProgressRing.d.ts +11 -0
  150. package/dist/components/ProgressRing/ProgressRing.js +53 -0
  151. package/dist/components/ProgressRing/ProgressRing.js.map +1 -0
  152. package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +25 -0
  153. package/dist/components/ProjectSwitcher/ProjectSwitcher.js +100 -0
  154. package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
  155. package/dist/components/RadioGroup/RadioGroup.d.ts +18 -0
  156. package/dist/components/RadioGroup/RadioGroup.js +63 -0
  157. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  158. package/dist/components/SearchField/SearchField.d.ts +9 -0
  159. package/dist/components/SearchField/SearchField.js +50 -0
  160. package/dist/components/SearchField/SearchField.js.map +1 -0
  161. package/dist/components/Section/Section.d.ts +50 -0
  162. package/dist/components/Section/Section.js +225 -0
  163. package/dist/components/Section/Section.js.map +1 -0
  164. package/dist/components/SegmentedControl/SegmentedControl.d.ts +23 -0
  165. package/dist/components/SegmentedControl/SegmentedControl.js +86 -0
  166. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
  167. package/dist/components/Select/Select.d.ts +31 -0
  168. package/dist/components/Select/Select.js +143 -0
  169. package/dist/components/Select/Select.js.map +1 -0
  170. package/dist/components/SettingsLayout/SettingsLayout.d.ts +27 -0
  171. package/dist/components/SettingsLayout/SettingsLayout.js +69 -0
  172. package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -0
  173. package/dist/components/SideNav/SideNav.d.ts +48 -0
  174. package/dist/components/SideNav/SideNav.js +225 -0
  175. package/dist/components/SideNav/SideNav.js.map +1 -0
  176. package/dist/components/Skeleton/Skeleton.d.ts +8 -0
  177. package/dist/components/Skeleton/Skeleton.js +17 -0
  178. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  179. package/dist/components/SplitPane/SplitPane.d.ts +23 -0
  180. package/dist/components/SplitPane/SplitPane.js +140 -0
  181. package/dist/components/SplitPane/SplitPane.js.map +1 -0
  182. package/dist/components/StatusBand/StatusBand.d.ts +31 -0
  183. package/dist/components/StatusBand/StatusBand.js +43 -0
  184. package/dist/components/StatusBand/StatusBand.js.map +1 -0
  185. package/dist/components/Suggestion/Suggestion.d.ts +22 -0
  186. package/dist/components/Suggestion/Suggestion.js +75 -0
  187. package/dist/components/Suggestion/Suggestion.js.map +1 -0
  188. package/dist/components/Switch/Switch.d.ts +11 -0
  189. package/dist/components/Switch/Switch.js +56 -0
  190. package/dist/components/Switch/Switch.js.map +1 -0
  191. package/dist/components/Tabs/Tabs.d.ts +23 -0
  192. package/dist/components/Tabs/Tabs.js +117 -0
  193. package/dist/components/Tabs/Tabs.js.map +1 -0
  194. package/dist/components/Tag/Tag.d.ts +13 -0
  195. package/dist/components/Tag/Tag.js +26 -0
  196. package/dist/components/Tag/Tag.js.map +1 -0
  197. package/dist/components/Term/Term.d.ts +34 -0
  198. package/dist/components/Term/Term.js +143 -0
  199. package/dist/components/Term/Term.js.map +1 -0
  200. package/dist/components/TextArea/TextArea.d.ts +15 -0
  201. package/dist/components/TextArea/TextArea.js +75 -0
  202. package/dist/components/TextArea/TextArea.js.map +1 -0
  203. package/dist/components/TextField/TextField.d.ts +15 -0
  204. package/dist/components/TextField/TextField.js +43 -0
  205. package/dist/components/TextField/TextField.js.map +1 -0
  206. package/dist/components/ThemePicker/ThemePicker.d.ts +13 -0
  207. package/dist/components/ThemePicker/ThemePicker.js +66 -0
  208. package/dist/components/ThemePicker/ThemePicker.js.map +1 -0
  209. package/dist/components/TimeControl/TimeControl.d.ts +19 -0
  210. package/dist/components/TimeControl/TimeControl.js +47 -0
  211. package/dist/components/TimeControl/TimeControl.js.map +1 -0
  212. package/dist/components/Toast/Toast.d.ts +10 -0
  213. package/dist/components/Toast/Toast.js +30 -0
  214. package/dist/components/Toast/Toast.js.map +1 -0
  215. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  216. package/dist/components/Tooltip/Tooltip.js +69 -0
  217. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  218. package/dist/components/TopBar/TopBar.d.ts +18 -0
  219. package/dist/components/TopBar/TopBar.js +59 -0
  220. package/dist/components/TopBar/TopBar.js.map +1 -0
  221. package/dist/components/Tour/Tour.d.ts +44 -0
  222. package/dist/components/Tour/Tour.js +440 -0
  223. package/dist/components/Tour/Tour.js.map +1 -0
  224. package/dist/components/TreeList/TreeList.d.ts +90 -0
  225. package/dist/components/TreeList/TreeList.js +594 -0
  226. package/dist/components/TreeList/TreeList.js.map +1 -0
  227. package/dist/components/TreeList/helpers.d.ts +2 -0
  228. package/dist/components/TreeList/helpers.js +104 -0
  229. package/dist/components/TreeList/helpers.js.map +1 -0
  230. package/dist/components/Workbench/Workbench.d.ts +100 -0
  231. package/dist/components/Workbench/Workbench.js +1142 -0
  232. package/dist/components/Workbench/Workbench.js.map +1 -0
  233. package/dist/components/ZoneMap/ZoneMap.d.ts +49 -0
  234. package/dist/components/ZoneMap/ZoneMap.js +89 -0
  235. package/dist/components/ZoneMap/ZoneMap.js.map +1 -0
  236. package/dist/css/AccentPicker.css +49 -0
  237. package/dist/css/ActionBar.css +36 -0
  238. package/dist/css/AiMark.css +14 -0
  239. package/dist/css/Alert.css +80 -0
  240. package/dist/css/AppShell.css +81 -0
  241. package/dist/css/Badge.css +68 -0
  242. package/dist/css/BarChart.css +66 -0
  243. package/dist/css/Breadcrumb.css +33 -0
  244. package/dist/css/Button.css +190 -0
  245. package/dist/css/Calendar.css +96 -0
  246. package/dist/css/Card.css +70 -0
  247. package/dist/css/Checkbox.css +38 -0
  248. package/dist/css/CodeView.css +302 -0
  249. package/dist/css/CommandPalette.css +232 -0
  250. package/dist/css/ConsoleLayout.css +131 -0
  251. package/dist/css/DangerZone.css +32 -0
  252. package/dist/css/DataTable.css +1195 -0
  253. package/dist/css/DatePicker.css +38 -0
  254. package/dist/css/DateRangePicker.css +70 -0
  255. package/dist/css/DetailList.css +69 -0
  256. package/dist/css/Dialog.css +3 -0
  257. package/dist/css/Drawer.css +90 -0
  258. package/dist/css/EmptyState.css +61 -0
  259. package/dist/css/ErrorPage.css +40 -0
  260. package/dist/css/EventTimeline.css +43 -0
  261. package/dist/css/FileUpload.css +92 -0
  262. package/dist/css/FormGrid.css +17 -0
  263. package/dist/css/Graph.css +99 -0
  264. package/dist/css/Grid.css +48 -0
  265. package/dist/css/IconButton.css +149 -0
  266. package/dist/css/InlineCode.css +92 -0
  267. package/dist/css/KpiCard.css +121 -0
  268. package/dist/css/LayerGraph.css +575 -0
  269. package/dist/css/LineChart.css +3 -0
  270. package/dist/css/LoadingBar.css +45 -0
  271. package/dist/css/LoginCard.css +65 -0
  272. package/dist/css/Markdown.css +266 -0
  273. package/dist/css/Menu.css +88 -0
  274. package/dist/css/Meter.css +110 -0
  275. package/dist/css/MobileTabBar.css +63 -0
  276. package/dist/css/MultiSelect.css +78 -0
  277. package/dist/css/NotificationBell.css +129 -0
  278. package/dist/css/Popover.css +57 -0
  279. package/dist/css/ProgressBar.css +42 -0
  280. package/dist/css/ProgressRing.css +19 -0
  281. package/dist/css/ProjectSwitcher.css +153 -0
  282. package/dist/css/RadioGroup.css +52 -0
  283. package/dist/css/SearchField.css +79 -0
  284. package/dist/css/Section.css +115 -0
  285. package/dist/css/SegmentedControl.css +67 -0
  286. package/dist/css/Select.css +136 -0
  287. package/dist/css/SettingsLayout.css +110 -0
  288. package/dist/css/SideNav.css +281 -0
  289. package/dist/css/Skeleton.css +19 -0
  290. package/dist/css/SplitPane.css +108 -0
  291. package/dist/css/StatusBand.css +23 -0
  292. package/dist/css/Suggestion.css +82 -0
  293. package/dist/css/Switch.css +46 -0
  294. package/dist/css/Tabs.css +91 -0
  295. package/dist/css/Tag.css +36 -0
  296. package/dist/css/Term.css +160 -0
  297. package/dist/css/TextArea.css +22 -0
  298. package/dist/css/TextField.css +2 -0
  299. package/dist/css/ThemePicker.css +70 -0
  300. package/dist/css/TimeControl.css +33 -0
  301. package/dist/css/Toast.css +47 -0
  302. package/dist/css/Tooltip.css +58 -0
  303. package/dist/css/TopBar.css +86 -0
  304. package/dist/css/Tour.css +90 -0
  305. package/dist/css/TreeList.css +532 -0
  306. package/dist/css/Workbench.css +652 -0
  307. package/dist/css/ZoneMap.css +203 -0
  308. package/dist/css/base.css +556 -0
  309. package/dist/css/end.css +273 -0
  310. package/dist/format-entry.d.ts +3 -0
  311. package/dist/format-entry.js +3 -0
  312. package/dist/format.d.ts +68 -2
  313. package/dist/format.js +237 -1
  314. package/dist/format.js.map +1 -0
  315. package/dist/i18n.d.ts +11 -0
  316. package/dist/{format-entry-CyChe8bk.js → i18n.js} +2 -235
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/icons/Icon.d.ts +24 -0
  319. package/dist/icons/Icon.js +66 -0
  320. package/dist/icons/Icon.js.map +1 -0
  321. package/dist/icons/Spinner.js +18 -0
  322. package/dist/icons/Spinner.js.map +1 -0
  323. package/dist/icons/all.js +212 -0
  324. package/dist/icons/all.js.map +1 -0
  325. package/dist/icons/map.d.ts +3 -0
  326. package/dist/icons/map.js +31 -0
  327. package/dist/icons/map.js.map +1 -0
  328. package/dist/icons/names.d.ts +253 -0
  329. package/dist/icons/names.js +153 -0
  330. package/dist/icons/names.js.map +1 -0
  331. package/dist/icons/ph/archive.d.ts +10 -0
  332. package/dist/icons/ph/archive.js +11 -0
  333. package/dist/icons/ph/archive.js.map +1 -0
  334. package/dist/icons/ph/arrow-down.d.ts +10 -0
  335. package/dist/icons/ph/arrow-down.js +11 -0
  336. package/dist/icons/ph/arrow-down.js.map +1 -0
  337. package/dist/icons/ph/arrow-left.d.ts +10 -0
  338. package/dist/icons/ph/arrow-left.js +11 -0
  339. package/dist/icons/ph/arrow-left.js.map +1 -0
  340. package/dist/icons/ph/arrow-right.d.ts +10 -0
  341. package/dist/icons/ph/arrow-right.js +11 -0
  342. package/dist/icons/ph/arrow-right.js.map +1 -0
  343. package/dist/icons/ph/arrow-square-out.d.ts +10 -0
  344. package/dist/icons/ph/arrow-square-out.js +11 -0
  345. package/dist/icons/ph/arrow-square-out.js.map +1 -0
  346. package/dist/icons/ph/arrow-u-up-left.d.ts +10 -0
  347. package/dist/icons/ph/arrow-u-up-left.js +11 -0
  348. package/dist/icons/ph/arrow-u-up-left.js.map +1 -0
  349. package/dist/icons/ph/arrow-u-up-right.d.ts +10 -0
  350. package/dist/icons/ph/arrow-u-up-right.js +11 -0
  351. package/dist/icons/ph/arrow-u-up-right.js.map +1 -0
  352. package/dist/icons/ph/arrow-up.d.ts +10 -0
  353. package/dist/icons/ph/arrow-up.js +11 -0
  354. package/dist/icons/ph/arrow-up.js.map +1 -0
  355. package/dist/icons/ph/arrows-clockwise.d.ts +10 -0
  356. package/dist/icons/ph/arrows-clockwise.js +11 -0
  357. package/dist/icons/ph/arrows-clockwise.js.map +1 -0
  358. package/dist/icons/ph/arrows-in-line-vertical.d.ts +10 -0
  359. package/dist/icons/ph/arrows-in-line-vertical.js +11 -0
  360. package/dist/icons/ph/arrows-in-line-vertical.js.map +1 -0
  361. package/dist/icons/ph/arrows-left-right.d.ts +10 -0
  362. package/dist/icons/ph/arrows-left-right.js +11 -0
  363. package/dist/icons/ph/arrows-left-right.js.map +1 -0
  364. package/dist/icons/ph/arrows-out-line-vertical.d.ts +10 -0
  365. package/dist/icons/ph/arrows-out-line-vertical.js +11 -0
  366. package/dist/icons/ph/arrows-out-line-vertical.js.map +1 -0
  367. package/dist/icons/ph/bell.d.ts +10 -0
  368. package/dist/icons/ph/bell.js +11 -0
  369. package/dist/icons/ph/bell.js.map +1 -0
  370. package/dist/icons/ph/brackets-curly.d.ts +10 -0
  371. package/dist/icons/ph/brackets-curly.js +11 -0
  372. package/dist/icons/ph/brackets-curly.js.map +1 -0
  373. package/dist/icons/ph/calendar-blank.d.ts +10 -0
  374. package/dist/icons/ph/calendar-blank.js +11 -0
  375. package/dist/icons/ph/calendar-blank.js.map +1 -0
  376. package/dist/icons/ph/caret-down.d.ts +10 -0
  377. package/dist/icons/ph/caret-down.js +11 -0
  378. package/dist/icons/ph/caret-down.js.map +1 -0
  379. package/dist/icons/ph/caret-left.d.ts +10 -0
  380. package/dist/icons/ph/caret-left.js +11 -0
  381. package/dist/icons/ph/caret-left.js.map +1 -0
  382. package/dist/icons/ph/caret-right.d.ts +10 -0
  383. package/dist/icons/ph/caret-right.js +11 -0
  384. package/dist/icons/ph/caret-right.js.map +1 -0
  385. package/dist/icons/ph/caret-up.d.ts +10 -0
  386. package/dist/icons/ph/caret-up.js +11 -0
  387. package/dist/icons/ph/caret-up.js.map +1 -0
  388. package/dist/icons/ph/chart-bar.d.ts +10 -0
  389. package/dist/icons/ph/chart-bar.js +11 -0
  390. package/dist/icons/ph/chart-bar.js.map +1 -0
  391. package/dist/icons/ph/chart-line.d.ts +10 -0
  392. package/dist/icons/ph/chart-line.js +11 -0
  393. package/dist/icons/ph/chart-line.js.map +1 -0
  394. package/dist/icons/ph/chart-pie.d.ts +10 -0
  395. package/dist/icons/ph/chart-pie.js +11 -0
  396. package/dist/icons/ph/chart-pie.js.map +1 -0
  397. package/dist/icons/ph/chat-centered.d.ts +10 -0
  398. package/dist/icons/ph/chat-centered.js +11 -0
  399. package/dist/icons/ph/chat-centered.js.map +1 -0
  400. package/dist/icons/ph/check-circle.d.ts +10 -0
  401. package/dist/icons/ph/check-circle.js +11 -0
  402. package/dist/icons/ph/check-circle.js.map +1 -0
  403. package/dist/icons/ph/check-square.d.ts +10 -0
  404. package/dist/icons/ph/check-square.js +11 -0
  405. package/dist/icons/ph/check-square.js.map +1 -0
  406. package/dist/icons/ph/check.d.ts +10 -0
  407. package/dist/icons/ph/check.js +11 -0
  408. package/dist/icons/ph/check.js.map +1 -0
  409. package/dist/icons/ph/circle-notch.d.ts +10 -0
  410. package/dist/icons/ph/circle-notch.js +11 -0
  411. package/dist/icons/ph/circle-notch.js.map +1 -0
  412. package/dist/icons/ph/clock.d.ts +10 -0
  413. package/dist/icons/ph/clock.js +11 -0
  414. package/dist/icons/ph/clock.js.map +1 -0
  415. package/dist/icons/ph/cloud.d.ts +10 -0
  416. package/dist/icons/ph/cloud.js +11 -0
  417. package/dist/icons/ph/cloud.js.map +1 -0
  418. package/dist/icons/ph/columns.d.ts +10 -0
  419. package/dist/icons/ph/columns.js +11 -0
  420. package/dist/icons/ph/columns.js.map +1 -0
  421. package/dist/icons/ph/command.d.ts +10 -0
  422. package/dist/icons/ph/command.js +11 -0
  423. package/dist/icons/ph/command.js.map +1 -0
  424. package/dist/icons/ph/copy.d.ts +10 -0
  425. package/dist/icons/ph/copy.js +11 -0
  426. package/dist/icons/ph/copy.js.map +1 -0
  427. package/dist/icons/ph/corners-in.d.ts +10 -0
  428. package/dist/icons/ph/corners-in.js +11 -0
  429. package/dist/icons/ph/corners-in.js.map +1 -0
  430. package/dist/icons/ph/corners-out.d.ts +10 -0
  431. package/dist/icons/ph/corners-out.js +11 -0
  432. package/dist/icons/ph/corners-out.js.map +1 -0
  433. package/dist/icons/ph/cpu.d.ts +10 -0
  434. package/dist/icons/ph/cpu.js +11 -0
  435. package/dist/icons/ph/cpu.js.map +1 -0
  436. package/dist/icons/ph/database.d.ts +10 -0
  437. package/dist/icons/ph/database.js +11 -0
  438. package/dist/icons/ph/database.js.map +1 -0
  439. package/dist/icons/ph/dots-six-vertical.d.ts +10 -0
  440. package/dist/icons/ph/dots-six-vertical.js +11 -0
  441. package/dist/icons/ph/dots-six-vertical.js.map +1 -0
  442. package/dist/icons/ph/dots-three-vertical.d.ts +10 -0
  443. package/dist/icons/ph/dots-three-vertical.js +11 -0
  444. package/dist/icons/ph/dots-three-vertical.js.map +1 -0
  445. package/dist/icons/ph/dots-three.d.ts +10 -0
  446. package/dist/icons/ph/dots-three.js +11 -0
  447. package/dist/icons/ph/dots-three.js.map +1 -0
  448. package/dist/icons/ph/download-simple.d.ts +10 -0
  449. package/dist/icons/ph/download-simple.js +11 -0
  450. package/dist/icons/ph/download-simple.js.map +1 -0
  451. package/dist/icons/ph/envelope-simple.d.ts +10 -0
  452. package/dist/icons/ph/envelope-simple.js +11 -0
  453. package/dist/icons/ph/envelope-simple.js.map +1 -0
  454. package/dist/icons/ph/eye-slash.d.ts +10 -0
  455. package/dist/icons/ph/eye-slash.js +11 -0
  456. package/dist/icons/ph/eye-slash.js.map +1 -0
  457. package/dist/icons/ph/eye.d.ts +10 -0
  458. package/dist/icons/ph/eye.js +11 -0
  459. package/dist/icons/ph/eye.js.map +1 -0
  460. package/dist/icons/ph/file-code.d.ts +10 -0
  461. package/dist/icons/ph/file-code.js +11 -0
  462. package/dist/icons/ph/file-code.js.map +1 -0
  463. package/dist/icons/ph/file-text.d.ts +10 -0
  464. package/dist/icons/ph/file-text.js +11 -0
  465. package/dist/icons/ph/file-text.js.map +1 -0
  466. package/dist/icons/ph/file.d.ts +10 -0
  467. package/dist/icons/ph/file.js +11 -0
  468. package/dist/icons/ph/file.js.map +1 -0
  469. package/dist/icons/ph/floppy-disk.d.ts +10 -0
  470. package/dist/icons/ph/floppy-disk.js +11 -0
  471. package/dist/icons/ph/floppy-disk.js.map +1 -0
  472. package/dist/icons/ph/folder-open.d.ts +10 -0
  473. package/dist/icons/ph/folder-open.js +11 -0
  474. package/dist/icons/ph/folder-open.js.map +1 -0
  475. package/dist/icons/ph/folder.d.ts +10 -0
  476. package/dist/icons/ph/folder.js +11 -0
  477. package/dist/icons/ph/folder.js.map +1 -0
  478. package/dist/icons/ph/function.d.ts +10 -0
  479. package/dist/icons/ph/function.js +11 -0
  480. package/dist/icons/ph/function.js.map +1 -0
  481. package/dist/icons/ph/funnel.d.ts +10 -0
  482. package/dist/icons/ph/funnel.js +11 -0
  483. package/dist/icons/ph/funnel.js.map +1 -0
  484. package/dist/icons/ph/gauge.d.ts +10 -0
  485. package/dist/icons/ph/gauge.js +11 -0
  486. package/dist/icons/ph/gauge.js.map +1 -0
  487. package/dist/icons/ph/gear.d.ts +10 -0
  488. package/dist/icons/ph/gear.js +11 -0
  489. package/dist/icons/ph/gear.js.map +1 -0
  490. package/dist/icons/ph/globe.d.ts +10 -0
  491. package/dist/icons/ph/globe.js +11 -0
  492. package/dist/icons/ph/globe.js.map +1 -0
  493. package/dist/icons/ph/hard-drives.d.ts +10 -0
  494. package/dist/icons/ph/hard-drives.js +11 -0
  495. package/dist/icons/ph/hard-drives.js.map +1 -0
  496. package/dist/icons/ph/hash.d.ts +10 -0
  497. package/dist/icons/ph/hash.js +11 -0
  498. package/dist/icons/ph/hash.js.map +1 -0
  499. package/dist/icons/ph/heart.d.ts +10 -0
  500. package/dist/icons/ph/heart.js +11 -0
  501. package/dist/icons/ph/heart.js.map +1 -0
  502. package/dist/icons/ph/house.d.ts +10 -0
  503. package/dist/icons/ph/house.js +11 -0
  504. package/dist/icons/ph/house.js.map +1 -0
  505. package/dist/icons/ph/image.d.ts +10 -0
  506. package/dist/icons/ph/image.js +11 -0
  507. package/dist/icons/ph/image.js.map +1 -0
  508. package/dist/icons/ph/info.d.ts +10 -0
  509. package/dist/icons/ph/info.js +11 -0
  510. package/dist/icons/ph/info.js.map +1 -0
  511. package/dist/icons/ph/key.d.ts +10 -0
  512. package/dist/icons/ph/key.js +11 -0
  513. package/dist/icons/ph/key.js.map +1 -0
  514. package/dist/icons/ph/keyboard.d.ts +10 -0
  515. package/dist/icons/ph/keyboard.js +11 -0
  516. package/dist/icons/ph/keyboard.js.map +1 -0
  517. package/dist/icons/ph/layout.d.ts +10 -0
  518. package/dist/icons/ph/layout.js +11 -0
  519. package/dist/icons/ph/layout.js.map +1 -0
  520. package/dist/icons/ph/link.d.ts +10 -0
  521. package/dist/icons/ph/link.js +11 -0
  522. package/dist/icons/ph/link.js.map +1 -0
  523. package/dist/icons/ph/list-bullets.d.ts +10 -0
  524. package/dist/icons/ph/list-bullets.js +11 -0
  525. package/dist/icons/ph/list-bullets.js.map +1 -0
  526. package/dist/icons/ph/list.d.ts +10 -0
  527. package/dist/icons/ph/list.js +11 -0
  528. package/dist/icons/ph/list.js.map +1 -0
  529. package/dist/icons/ph/lock.d.ts +10 -0
  530. package/dist/icons/ph/lock.js +11 -0
  531. package/dist/icons/ph/lock.js.map +1 -0
  532. package/dist/icons/ph/magnifying-glass.d.ts +10 -0
  533. package/dist/icons/ph/magnifying-glass.js +11 -0
  534. package/dist/icons/ph/magnifying-glass.js.map +1 -0
  535. package/dist/icons/ph/minus.d.ts +10 -0
  536. package/dist/icons/ph/minus.js +11 -0
  537. package/dist/icons/ph/minus.js.map +1 -0
  538. package/dist/icons/ph/monitor.d.ts +10 -0
  539. package/dist/icons/ph/monitor.js +11 -0
  540. package/dist/icons/ph/monitor.js.map +1 -0
  541. package/dist/icons/ph/moon.d.ts +10 -0
  542. package/dist/icons/ph/moon.js +11 -0
  543. package/dist/icons/ph/moon.js.map +1 -0
  544. package/dist/icons/ph/paper-plane-tilt.d.ts +10 -0
  545. package/dist/icons/ph/paper-plane-tilt.js +11 -0
  546. package/dist/icons/ph/paper-plane-tilt.js.map +1 -0
  547. package/dist/icons/ph/pencil-simple.d.ts +10 -0
  548. package/dist/icons/ph/pencil-simple.js +11 -0
  549. package/dist/icons/ph/pencil-simple.js.map +1 -0
  550. package/dist/icons/ph/plus.d.ts +10 -0
  551. package/dist/icons/ph/plus.js +11 -0
  552. package/dist/icons/ph/plus.js.map +1 -0
  553. package/dist/icons/ph/printer.d.ts +10 -0
  554. package/dist/icons/ph/printer.js +11 -0
  555. package/dist/icons/ph/printer.js.map +1 -0
  556. package/dist/icons/ph/pulse.d.ts +10 -0
  557. package/dist/icons/ph/pulse.js +11 -0
  558. package/dist/icons/ph/pulse.js.map +1 -0
  559. package/dist/icons/ph/push-pin.d.ts +10 -0
  560. package/dist/icons/ph/push-pin.js +11 -0
  561. package/dist/icons/ph/push-pin.js.map +1 -0
  562. package/dist/icons/ph/question.d.ts +10 -0
  563. package/dist/icons/ph/question.js +11 -0
  564. package/dist/icons/ph/question.js.map +1 -0
  565. package/dist/icons/ph/share-network.d.ts +10 -0
  566. package/dist/icons/ph/share-network.js +11 -0
  567. package/dist/icons/ph/share-network.js.map +1 -0
  568. package/dist/icons/ph/shield.d.ts +10 -0
  569. package/dist/icons/ph/shield.js +11 -0
  570. package/dist/icons/ph/shield.js.map +1 -0
  571. package/dist/icons/ph/sidebar-simple.d.ts +10 -0
  572. package/dist/icons/ph/sidebar-simple.js +11 -0
  573. package/dist/icons/ph/sidebar-simple.js.map +1 -0
  574. package/dist/icons/ph/sign-in.d.ts +10 -0
  575. package/dist/icons/ph/sign-in.js +11 -0
  576. package/dist/icons/ph/sign-in.js.map +1 -0
  577. package/dist/icons/ph/sign-out.d.ts +10 -0
  578. package/dist/icons/ph/sign-out.js +11 -0
  579. package/dist/icons/ph/sign-out.js.map +1 -0
  580. package/dist/icons/ph/sliders-horizontal.d.ts +10 -0
  581. package/dist/icons/ph/sliders-horizontal.js +11 -0
  582. package/dist/icons/ph/sliders-horizontal.js.map +1 -0
  583. package/dist/icons/ph/sort-ascending.d.ts +10 -0
  584. package/dist/icons/ph/sort-ascending.js +11 -0
  585. package/dist/icons/ph/sort-ascending.js.map +1 -0
  586. package/dist/icons/ph/sparkle.d.ts +10 -0
  587. package/dist/icons/ph/sparkle.js +11 -0
  588. package/dist/icons/ph/sparkle.js.map +1 -0
  589. package/dist/icons/ph/square.d.ts +10 -0
  590. package/dist/icons/ph/square.js +11 -0
  591. package/dist/icons/ph/square.js.map +1 -0
  592. package/dist/icons/ph/squares-four.d.ts +10 -0
  593. package/dist/icons/ph/squares-four.js +11 -0
  594. package/dist/icons/ph/squares-four.js.map +1 -0
  595. package/dist/icons/ph/stack.d.ts +10 -0
  596. package/dist/icons/ph/stack.js +11 -0
  597. package/dist/icons/ph/stack.js.map +1 -0
  598. package/dist/icons/ph/star.d.ts +10 -0
  599. package/dist/icons/ph/star.js +11 -0
  600. package/dist/icons/ph/star.js.map +1 -0
  601. package/dist/icons/ph/sun.d.ts +10 -0
  602. package/dist/icons/ph/sun.js +11 -0
  603. package/dist/icons/ph/sun.js.map +1 -0
  604. package/dist/icons/ph/tag.d.ts +10 -0
  605. package/dist/icons/ph/tag.js +11 -0
  606. package/dist/icons/ph/tag.js.map +1 -0
  607. package/dist/icons/ph/terminal-window.d.ts +10 -0
  608. package/dist/icons/ph/terminal-window.js +11 -0
  609. package/dist/icons/ph/terminal-window.js.map +1 -0
  610. package/dist/icons/ph/trash.d.ts +10 -0
  611. package/dist/icons/ph/trash.js +11 -0
  612. package/dist/icons/ph/trash.js.map +1 -0
  613. package/dist/icons/ph/trend-up.d.ts +10 -0
  614. package/dist/icons/ph/trend-up.js +11 -0
  615. package/dist/icons/ph/trend-up.js.map +1 -0
  616. package/dist/icons/ph/upload-simple.d.ts +10 -0
  617. package/dist/icons/ph/upload-simple.js +11 -0
  618. package/dist/icons/ph/upload-simple.js.map +1 -0
  619. package/dist/icons/ph/user.d.ts +10 -0
  620. package/dist/icons/ph/user.js +11 -0
  621. package/dist/icons/ph/user.js.map +1 -0
  622. package/dist/icons/ph/users.d.ts +10 -0
  623. package/dist/icons/ph/users.js +11 -0
  624. package/dist/icons/ph/users.js.map +1 -0
  625. package/dist/icons/ph/warning-circle.d.ts +10 -0
  626. package/dist/icons/ph/warning-circle.js +11 -0
  627. package/dist/icons/ph/warning-circle.js.map +1 -0
  628. package/dist/icons/ph/warning.d.ts +10 -0
  629. package/dist/icons/ph/warning.js +11 -0
  630. package/dist/icons/ph/warning.js.map +1 -0
  631. package/dist/icons/ph/x-circle.d.ts +10 -0
  632. package/dist/icons/ph/x-circle.js +11 -0
  633. package/dist/icons/ph/x-circle.js.map +1 -0
  634. package/dist/icons/ph/x.d.ts +10 -0
  635. package/dist/icons/ph/x.js +11 -0
  636. package/dist/icons/ph/x.js.map +1 -0
  637. package/dist/icons/store.d.ts +6 -0
  638. package/dist/icons/store.js +77 -0
  639. package/dist/icons/store.js.map +1 -0
  640. package/dist/index.d.ts +86 -2293
  641. package/dist/index.js +82 -13349
  642. package/dist/internal/Field.js +74 -0
  643. package/dist/internal/Field.js.map +1 -0
  644. package/dist/internal/FloatingPanel.js +41 -0
  645. package/dist/internal/FloatingPanel.js.map +1 -0
  646. package/dist/internal/chart.js +131 -0
  647. package/dist/internal/chart.js.map +1 -0
  648. package/dist/internal/dev.js +21 -0
  649. package/dist/internal/dev.js.map +1 -0
  650. package/dist/internal/focus.js +94 -0
  651. package/dist/internal/focus.js.map +1 -0
  652. package/dist/internal/focusMain.d.ts +4 -0
  653. package/dist/internal/focusMain.js +22 -0
  654. package/dist/internal/focusMain.js.map +1 -0
  655. package/dist/internal/scrollHint.js +78 -0
  656. package/dist/internal/scrollHint.js.map +1 -0
  657. package/dist/internal/tableTools.js +114 -0
  658. package/dist/internal/tableTools.js.map +1 -0
  659. package/dist/internal/terms.d.ts +18 -0
  660. package/dist/internal/terms.js +64 -0
  661. package/dist/internal/terms.js.map +1 -0
  662. package/dist/internal/util.js +107 -0
  663. package/dist/internal/util.js.map +1 -0
  664. package/dist/motion.d.ts +5 -0
  665. package/dist/motion.js +29 -0
  666. package/dist/motion.js.map +1 -0
  667. package/dist/styles.css +4280 -4265
  668. package/dist/theme.d.ts +20 -0
  669. package/dist/theme.js +210 -0
  670. package/dist/theme.js.map +1 -0
  671. package/dist/tokens.css +4 -0
  672. package/docs/guidelines.md +1 -0
  673. package/docs/theme.md +51 -0
  674. package/package.json +5 -4
  675. package/dist/format-entry-CgMBtkni.d.ts +0 -79
  676. package/dist/format-entry-CyChe8bk.js.map +0 -1
  677. package/dist/index.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import { CHECK, Icon } from "../icons/Icon.js";
3
+ import { cx } from "./util.js";
4
+ import { includeIcons } from "../icons/store.js";
5
+ import warning_circle_default from "../icons/ph/warning-circle.js";
6
+ import * as React from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ // src/internal/Field.tsx
9
+ includeIcons(warning_circle_default);
10
+ /** A field's label above it, with the red asterisk when required. A <label> when it names one input, otherwise a <span>. */
11
+ function FieldLabel({ htmlFor, id, required, children }) {
12
+ return /* @__PURE__ */ jsxs(htmlFor ? "label" : "span", {
13
+ htmlFor,
14
+ id,
15
+ className: "ui-field-label",
16
+ children: [children, required ? /* @__PURE__ */ jsx("span", {
17
+ className: "ui-req",
18
+ "aria-hidden": "true",
19
+ children: " *"
20
+ }) : null]
21
+ });
22
+ }
23
+ /** The mark inside a check box: a drawn check, a dash for 'mixed', or nothing. The check draws itself only when it
24
+ * turns on after mount, never when a list or menu opens with it already on. */
25
+ function CheckMark({ v }) {
26
+ const [prev, setPrev] = React.useState(v);
27
+ const [draw, setDraw] = React.useState(false);
28
+ if (prev !== v) {
29
+ setPrev(v);
30
+ setDraw(v === true);
31
+ }
32
+ if (v === "mixed") return /* @__PURE__ */ jsx("span", { className: "ui-check-dash" });
33
+ if (!v) return null;
34
+ return /* @__PURE__ */ jsx("svg", {
35
+ className: cx(draw && "ui-draw"),
36
+ width: 14,
37
+ height: 14,
38
+ viewBox: "0 0 24 24",
39
+ fill: "none",
40
+ stroke: "currentColor",
41
+ strokeWidth: 3.5,
42
+ strokeLinecap: "round",
43
+ strokeLinejoin: "round",
44
+ "aria-hidden": "true",
45
+ children: /* @__PURE__ */ jsx("path", { d: CHECK })
46
+ });
47
+ }
48
+ /** The error mark inside a field with an error: a red warning circle at the field's right end (TextField and every other
49
+ * field type, so an error always shows the red border and this icon). `inline` sits in a flex row before the field's
50
+ * own trailing button (show password, calendar, caret) instead of over the input. */
51
+ function FieldErrorIcon({ inline }) {
52
+ return /* @__PURE__ */ jsx(Icon, {
53
+ name: "warning-circle",
54
+ className: cx("ui-field-icon", inline && "is-inline")
55
+ });
56
+ }
57
+ /** The line under a field: the error (cause and fix) when there is one, otherwise the hint. The error is inserted only
58
+ * while there is one, keyed by its text: a new error is a new alert node, announced once; the hint never announces. */
59
+ function FieldMessage({ id, error, hint, className }) {
60
+ if (error) return /* @__PURE__ */ jsx("div", {
61
+ id,
62
+ className: cx("ui-field-error", className),
63
+ role: "alert",
64
+ children: error
65
+ }, error);
66
+ return hint ? /* @__PURE__ */ jsx("div", {
67
+ id,
68
+ className: cx("ui-field-hint", className),
69
+ children: hint
70
+ }) : null;
71
+ }
72
+ export { CheckMark, FieldErrorIcon, FieldLabel, FieldMessage };
73
+
74
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.js","names":["phWarningCircle"],"sources":["../../src/internal/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CHECK, Icon } from '../icons/Icon';\nimport { cx } from './util';\nimport { includeIcons } from '../icons/store';\nimport phWarningCircle from '../icons/ph/warning-circle';\n\nincludeIcons(phWarningCircle);\n\n/** A field's label above it, with the red asterisk when required. A <label> when it names one input, otherwise a <span>. */\nexport function FieldLabel({ htmlFor, id, required, children }: { htmlFor?: string; id?: string; required?: boolean; children: React.ReactNode }) {\n const Tag = htmlFor ? 'label' : 'span';\n return (\n <Tag htmlFor={htmlFor} id={id} className=\"ui-field-label\">\n {children}\n {required ? (\n <span className=\"ui-req\" aria-hidden=\"true\">\n {' *'}\n </span>\n ) : null}\n </Tag>\n );\n}\n\n/** The mark inside a check box: a drawn check, a dash for 'mixed', or nothing. The check draws itself only when it\n * turns on after mount, never when a list or menu opens with it already on. */\nexport function CheckMark({ v }: { v: boolean | 'mixed' }) {\n const [prev, setPrev] = React.useState(v);\n const [draw, setDraw] = React.useState(false);\n if (prev !== v) {\n setPrev(v);\n setDraw(v === true);\n }\n if (v === 'mixed') return <span className=\"ui-check-dash\" />;\n if (!v) return null;\n return (\n <svg\n className={cx(draw && 'ui-draw')}\n width={14}\n height={14}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d={CHECK} />\n </svg>\n );\n}\n\n/** The error mark inside a field with an error: a red warning circle at the field's right end (TextField and every other\n * field type, so an error always shows the red border and this icon). `inline` sits in a flex row before the field's\n * own trailing button (show password, calendar, caret) instead of over the input. */\nexport function FieldErrorIcon({ inline }: { inline?: boolean }) {\n return <Icon name=\"warning-circle\" className={cx('ui-field-icon', inline && 'is-inline')} />;\n}\n\n/** The line under a field: the error (cause and fix) when there is one, otherwise the hint. The error is inserted only\n * while there is one, keyed by its text: a new error is a new alert node, announced once; the hint never announces. */\nexport function FieldMessage({ id, error, hint, className }: { id: string; error?: string; hint?: React.ReactNode; className?: string }) {\n if (error)\n return (\n <div key={error} id={id} className={cx('ui-field-error', className)} role=\"alert\">\n {error}\n </div>\n );\n return hint ? (\n <div id={id} className={cx('ui-field-hint', className)}>\n {hint}\n </div>\n ) : null;\n}\n"],"mappings":";;;;;;;;AAMA,aAAaA,sBAAe;;AAG5B,SAAgB,WAAW,EAAE,SAAS,IAAI,UAAU,YAA8F;CAEhJ,OACE,qBAFU,UAAU,UAAU,QAE9B;EAAc;EAAa;EAAI,WAAU;EAAzC,UAAA,CACG,UACA,WACC,oBAAC,QAAD;GAAM,WAAU;GAAS,eAAY;GAClC,UAAA;EACG,CAAA,IACJ,IACD;;AAET;;;AAIA,SAAgB,UAAU,EAAE,KAA+B;CACzD,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,CAAC;CACxC,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,IAAI,SAAS,GAAG;EACd,QAAQ,CAAC;EACT,QAAQ,MAAM,IAAI;CACpB;CACA,IAAI,MAAM,SAAS,OAAO,oBAAC,QAAD,EAAM,WAAU,gBAAiB,CAAA;CAC3D,IAAI,CAAC,GAAG,OAAO;CACf,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,QAAQ,SAAS;EAC/B,OAAO;EACP,QAAQ;EACR,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAa;EACb,eAAc;EACd,gBAAe;EACf,eAAY;EAEZ,UAAA,oBAAC,QAAD,EAAM,GAAG,MAAQ,CAAA;CACd,CAAA;AAET;;;;AAKA,SAAgB,eAAe,EAAE,UAAgC;CAC/D,OAAO,oBAAC,MAAD;EAAM,MAAK;EAAiB,WAAW,GAAG,iBAAiB,UAAU,WAAW;CAAI,CAAA;AAC7F;;;AAIA,SAAgB,aAAa,EAAE,IAAI,OAAO,MAAM,aAAyF;CACvI,IAAI,OACF,OACE,oBAAC,OAAD;EAAqB;EAAI,WAAW,GAAG,kBAAkB,SAAS;EAAG,MAAK;EACvE,UAAA;CACE,GAFK,KAEL;CAET,OAAO,OACL,oBAAC,OAAD;EAAS;EAAI,WAAW,GAAG,iBAAiB,SAAS;EAClD,UAAA;CACE,CAAA,IACH;AACN"}
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Popover } from "@base-ui/react/popover";
5
+ // src/internal/FloatingPanel.tsx
6
+ /** A positioned panel next to its trigger: flips when there is no room, closes on Esc and outside press, returns focus. */
7
+ function FloatingPanel({ open, onOpenChange, trigger, side = "bottom", align = "start", sideOffset = 6, className, openOnHover, anchor, boundary, delay = 0, id, focusOnOpen = true, children, ...aria }) {
8
+ const within = boundary?.current ?? void 0;
9
+ return /* @__PURE__ */ jsxs(Popover.Root, {
10
+ open,
11
+ onOpenChange,
12
+ children: [/* @__PURE__ */ jsx(Popover.Trigger, {
13
+ render: trigger,
14
+ openOnHover,
15
+ delay,
16
+ closeDelay: 150
17
+ }), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
18
+ className: "ui-float",
19
+ side,
20
+ align,
21
+ sideOffset,
22
+ anchor,
23
+ collisionBoundary: within,
24
+ collisionPadding: within ? 0 : void 0,
25
+ collisionAvoidance: within ? {
26
+ side: "flip",
27
+ align: "shift"
28
+ } : void 0,
29
+ children: /* @__PURE__ */ jsx(Popover.Popup, {
30
+ id,
31
+ className,
32
+ "aria-label": aria["aria-label"],
33
+ initialFocus: focusOnOpen ? void 0 : false,
34
+ children
35
+ })
36
+ }) })]
37
+ });
38
+ }
39
+ export { FloatingPanel };
40
+
41
+ //# sourceMappingURL=FloatingPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingPanel.js","names":[],"sources":["../../src/internal/FloatingPanel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover } from '@base-ui/react/popover';\n\nexport interface FloatingPanelProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** The element that opens the panel; it must accept a ref (a native element or a component that passes ref on). */\n trigger: React.ReactElement;\n side?: 'top' | 'bottom';\n align?: 'start' | 'center' | 'end';\n sideOffset?: number;\n /** Class of the panel (it carries the look: .ui-datepop, .ui-noti …). */\n className?: string;\n /** Accessible name of the panel. */\n 'aria-label'?: string;\n /** Position against this element instead of the trigger (e.g. the whole field around a calendar button). */\n anchor?: React.RefObject<Element | null>;\n /** Open on hover as well as on press. */\n openOnHover?: boolean;\n /** Keeps the panel inside this element (shifting it sideways, then flipping), not just inside the window: a menu of\n * a table stays over the table instead of covering the panel beside it. */\n boundary?: React.RefObject<Element | null>;\n /** Hover delay before opening, in ms (with openOnHover). Default 0. */\n delay?: number;\n /** Id of the panel, for aria-describedby on the trigger. */\n id?: string;\n /** Move focus into the panel when it opens. Default true. */\n focusOnOpen?: boolean;\n children: React.ReactNode;\n}\n\n/** A positioned panel next to its trigger: flips when there is no room, closes on Esc and outside press, returns focus. */\nexport function FloatingPanel({\n open,\n onOpenChange,\n trigger,\n side = 'bottom',\n align = 'start',\n sideOffset = 6,\n className,\n openOnHover,\n anchor,\n boundary,\n delay = 0,\n id,\n focusOnOpen = true,\n children,\n ...aria\n}: FloatingPanelProps) {\n const within = boundary?.current ?? undefined;\n return (\n <Popover.Root open={open} onOpenChange={onOpenChange}>\n <Popover.Trigger render={trigger} openOnHover={openOnHover} delay={delay} closeDelay={150} />\n <Popover.Portal>\n <Popover.Positioner\n className=\"ui-float\"\n side={side}\n align={align}\n sideOffset={sideOffset}\n anchor={anchor}\n collisionBoundary={within}\n collisionPadding={within ? 0 : undefined}\n // Inside a boundary: slid sideways until it fits, rather than swapping its alignment.\n collisionAvoidance={within ? { side: 'flip', align: 'shift' } : undefined}\n >\n <Popover.Popup id={id} className={className} aria-label={aria['aria-label']} initialFocus={focusOnOpen ? undefined : false}>\n {children}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,cAAc,EAC5B,MACA,cACA,SACA,OAAO,UACP,QAAQ,SACR,aAAa,GACb,WACA,aACA,QACA,UACA,QAAQ,GACR,IACA,cAAc,MACd,UACA,GAAG,QACkB;CACrB,MAAM,SAAS,UAAU,WAAW,KAAA;CACpC,OACE,qBAAC,QAAQ,MAAT;EAAoB;EAAoB;EAAxC,UAAA,CACE,oBAAC,QAAQ,SAAT;GAAiB,QAAQ;GAAsB;GAAoB;GAAO,YAAY;EAAM,CAAA,GAC5F,oBAAC,QAAQ,QAAT,EAAA,UACE,oBAAC,QAAQ,YAAT;GACE,WAAU;GACJ;GACC;GACK;GACJ;GACR,mBAAmB;GACnB,kBAAkB,SAAS,IAAI,KAAA;GAE/B,oBAAoB,SAAS;IAAE,MAAM;IAAQ,OAAO;GAAQ,IAAI,KAAA;GAEhE,UAAA,oBAAC,QAAQ,OAAT;IAAmB;IAAe;IAAW,cAAY,KAAK;IAAe,cAAc,cAAc,KAAA,IAAY;IAClH;GACY,CAAA;EACG,CAAA,EACN,CAAA,CACJ;;AAElB"}
@@ -0,0 +1,131 @@
1
+ "use client";
2
+ import { format } from "../format.js";
3
+ import { reduced } from "./util.js";
4
+ import * as React from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/internal/chart.tsx
7
+ /** 0 → 1 with an ease-out over ms, restarted when target changes; 1 at once with reduced motion. */
8
+ function useCountUp(target, ms) {
9
+ const [t, setT] = React.useState(reduced() ? 1 : 0);
10
+ React.useEffect(() => {
11
+ if (reduced()) return;
12
+ let t0 = null;
13
+ let raf = 0;
14
+ const step = (now) => {
15
+ t0 ??= now;
16
+ const x = Math.min(1, (now - t0) / ms);
17
+ setT(1 - (1 - x) ** 3);
18
+ if (x < 1) raf = requestAnimationFrame(step);
19
+ };
20
+ raf = requestAnimationFrame(step);
21
+ return () => cancelAnimationFrame(raf);
22
+ }, [target, ms]);
23
+ return t;
24
+ }
25
+ /** Decimals the axis labels need so that ticks a step apart read differently (0.5, 1, 1.5). */
26
+ const tickDecimals = (top) => Math.min(3, (String(+(top / 4).toPrecision(6)).split(".")[1] ?? "").length);
27
+ /** A smooth SVG path (Catmull-Rom as cubic Béziers) through the points. */
28
+ function smoothPath(p) {
29
+ const f = (q) => q[0].toFixed(1) + "," + q[1].toFixed(1);
30
+ if (p.length < 2) return p.length ? "M" + f(p[0]) : "";
31
+ let d = "M" + f(p[0]);
32
+ for (let i = 0; i < p.length - 1; i++) {
33
+ const p0 = p[i - 1] || p[i];
34
+ const p1 = p[i];
35
+ const p2 = p[i + 1];
36
+ const p3 = p[i + 2] || p2;
37
+ d += ` C${f([p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6])} ${f([p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6])} ${f(p2)}`;
38
+ }
39
+ return d;
40
+ }
41
+ const CHART = [
42
+ "var(--chart-1)",
43
+ "var(--chart-2)",
44
+ "var(--chart-3)",
45
+ "var(--chart-4)"
46
+ ];
47
+ /** The color of series i. */
48
+ const seriesColor = (i) => CHART[i % CHART.length];
49
+ /** Grid lines at these fractions of the axis maximum. */
50
+ const TICKS = [
51
+ 0,
52
+ .25,
53
+ .5,
54
+ .75,
55
+ 1
56
+ ];
57
+ /** KPI cards are the only place that abbreviates large numbers (format rules). */
58
+ function kpiText(v, p, dec) {
59
+ const big = p.compact !== false && Math.abs(p.value) >= 1e4;
60
+ if (p.format === "money") return format.money(v, {
61
+ compact: big,
62
+ currency: p.currency,
63
+ like: p.value
64
+ });
65
+ if (p.format === "percent") return format.number(v, dec || 1);
66
+ return big ? format.compact(v, p.value) : format.number(v, dec);
67
+ }
68
+ /** Shrinks the KPI number (31 px down to 20 px) when the final value is wider than the card. */
69
+ function useFitText(ref, deps) {
70
+ React.useLayoutEffect(() => {
71
+ const el = ref.current;
72
+ if (!el) return;
73
+ const fit = () => {
74
+ el.style.fontSize = "";
75
+ const base = parseFloat(getComputedStyle(el).fontSize) || 31;
76
+ const sizer = el.querySelector(".ui-kpi-sizer");
77
+ const unit = el.querySelector(".ui-kpi-unit");
78
+ const need = (sizer ? sizer.scrollWidth : 0) + (unit ? unit.offsetWidth + 4 : 0);
79
+ const have = el.clientWidth;
80
+ const next = need > have && have > 0 ? Math.max(20, Math.floor(base * have / need)) : null;
81
+ el.style.fontSize = next ? next + "px" : "";
82
+ };
83
+ fit();
84
+ const ro = typeof ResizeObserver === "function" ? new ResizeObserver(fit) : null;
85
+ ro?.observe(el.parentNode || el);
86
+ return () => ro?.disconnect();
87
+ }, deps);
88
+ }
89
+ function ChartTip({ title, rows, style }) {
90
+ return /* @__PURE__ */ jsxs("div", {
91
+ className: "ui-chart-tip",
92
+ style,
93
+ children: [title ? /* @__PURE__ */ jsx("div", {
94
+ className: "ui-chart-tip-title",
95
+ children: title
96
+ }) : null, rows.map((r, i) => /* @__PURE__ */ jsxs("div", {
97
+ className: "ui-chart-tip-row",
98
+ children: [
99
+ r.color ? /* @__PURE__ */ jsx("span", {
100
+ className: "ui-chart-swatch",
101
+ style: { background: r.color }
102
+ }) : null,
103
+ /* @__PURE__ */ jsx("span", {
104
+ className: "ui-chart-tip-name",
105
+ children: r.name
106
+ }),
107
+ /* @__PURE__ */ jsx("span", {
108
+ className: "ui-chart-tip-val",
109
+ children: r.value
110
+ })
111
+ ]
112
+ }, i))]
113
+ });
114
+ }
115
+ /** Rounds an axis maximum up to 2, 4, 5, 8 or 10 times a power of ten. */
116
+ function niceMax(v) {
117
+ const e = 10 ** Math.floor(Math.log10(v || 1));
118
+ const n = Math.ceil(v / e);
119
+ return (n <= 2 ? 2 : n <= 4 ? 4 : n <= 5 ? 5 : n <= 8 ? 8 : 10) * e;
120
+ }
121
+ /** ← → (and Home, End) on a chart: the item to show next, or null for any other key. */
122
+ function chartKey(e, at, n) {
123
+ if (e.altKey || e.metaKey || e.ctrlKey || !n) return null;
124
+ const i = Math.max(0, at);
125
+ const to = e.key === "ArrowRight" ? Math.min(n - 1, i + 1) : e.key === "ArrowLeft" ? Math.max(0, i - 1) : e.key === "Home" ? 0 : e.key === "End" ? n - 1 : null;
126
+ if (to != null) e.preventDefault();
127
+ return to;
128
+ }
129
+ export { ChartTip, TICKS, chartKey, kpiText, niceMax, seriesColor, smoothPath, tickDecimals, useCountUp, useFitText };
130
+
131
+ //# sourceMappingURL=chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart.js","names":[],"sources":["../../src/internal/chart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { format } from '../format';\nimport { reduced } from './util';\nimport type { KpiCardProps } from '../components/KpiCard/KpiCard';\n\n/** 0 → 1 with an ease-out over ms, restarted when target changes; 1 at once with reduced motion. */\nexport function useCountUp(target: unknown, ms: number): number {\n const [t, setT] = React.useState(reduced() ? 1 : 0);\n React.useEffect(() => {\n if (reduced()) return;\n let t0: number | null = null;\n let raf = 0;\n const step = (now: number) => {\n t0 ??= now;\n const x = Math.min(1, (now - t0) / ms);\n setT(1 - (1 - x) ** 3);\n if (x < 1) raf = requestAnimationFrame(step);\n };\n raf = requestAnimationFrame(step);\n return () => cancelAnimationFrame(raf);\n }, [target, ms]);\n return t;\n}\n\n/** Decimals the axis labels need so that ticks a step apart read differently (0.5, 1, 1.5). */\nexport const tickDecimals = (top: number): number => Math.min(3, (String(+(top / 4).toPrecision(6)).split('.')[1] ?? '').length);\n\nexport type Point = [number, number];\n\n/** A smooth SVG path (Catmull-Rom as cubic Béziers) through the points. */\nexport function smoothPath(p: Point[]): string {\n const f = (q: Point) => q[0].toFixed(1) + ',' + q[1].toFixed(1);\n if (p.length < 2) return p.length ? 'M' + f(p[0]) : '';\n let d = 'M' + f(p[0]);\n for (let i = 0; i < p.length - 1; i++) {\n const p0 = p[i - 1] || p[i];\n const p1 = p[i];\n const p2 = p[i + 1];\n const p3 = p[i + 2] || p2;\n d += ` C${f([p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6])} ${f([p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6])} ${f(p2)}`;\n }\n return d;\n}\n\nconst CHART = ['var(--chart-1)', 'var(--chart-2)', 'var(--chart-3)', 'var(--chart-4)'];\n/** The color of series i. */\nexport const seriesColor = (i: number): string => CHART[i % CHART.length];\n/** Grid lines at these fractions of the axis maximum. */\nexport const TICKS = [0, 0.25, 0.5, 0.75, 1];\n\n/** KPI cards are the only place that abbreviates large numbers (format rules). */\nexport function kpiText(v: number, p: KpiCardProps, dec?: number): string {\n const big = p.compact !== false && Math.abs(p.value) >= 1e4;\n if (p.format === 'money') return format.money(v, { compact: big, currency: p.currency, like: p.value });\n if (p.format === 'percent') return format.number(v, dec || 1);\n return big ? format.compact(v, p.value) : format.number(v, dec);\n}\n\n/** Shrinks the KPI number (31 px down to 20 px) when the final value is wider than the card. */\nexport function useFitText(ref: React.RefObject<HTMLElement | null>, deps: React.DependencyList): void {\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const fit = () => {\n el.style.fontSize = '';\n const base = parseFloat(getComputedStyle(el).fontSize) || 31;\n const sizer = el.querySelector<HTMLElement>('.ui-kpi-sizer');\n const unit = el.querySelector<HTMLElement>('.ui-kpi-unit');\n const need = (sizer ? sizer.scrollWidth : 0) + (unit ? unit.offsetWidth + 4 : 0);\n const have = el.clientWidth;\n const next = need > have && have > 0 ? Math.max(20, Math.floor((base * have) / need)) : null;\n el.style.fontSize = next ? next + 'px' : '';\n };\n fit();\n const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(fit) : null;\n ro?.observe((el.parentNode as Element | null) || el);\n return () => ro?.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the caller lists what changes the text\n }, deps);\n}\n\ninterface ChartTipRow {\n name: React.ReactNode;\n value: React.ReactNode;\n color?: string;\n}\n\nexport function ChartTip({ title, rows, style }: { title?: React.ReactNode; rows: ChartTipRow[]; style?: React.CSSProperties }) {\n return (\n <div className=\"ui-chart-tip\" style={style}>\n {title ? <div className=\"ui-chart-tip-title\">{title}</div> : null}\n {rows.map((r, i) => (\n <div key={i} className=\"ui-chart-tip-row\">\n {r.color ? <span className=\"ui-chart-swatch\" style={{ background: r.color }} /> : null}\n <span className=\"ui-chart-tip-name\">{r.name}</span>\n <span className=\"ui-chart-tip-val\">{r.value}</span>\n </div>\n ))}\n </div>\n );\n}\n\n/** Rounds an axis maximum up to 2, 4, 5, 8 or 10 times a power of ten. */\nexport function niceMax(v: number): number {\n const e = 10 ** Math.floor(Math.log10(v || 1));\n const n = Math.ceil(v / e);\n return (n <= 2 ? 2 : n <= 4 ? 4 : n <= 5 ? 5 : n <= 8 ? 8 : 10) * e;\n}\n\n/** ← → (and Home, End) on a chart: the item to show next, or null for any other key. */\nexport function chartKey(e: React.KeyboardEvent, at: number, n: number): number | null {\n if (e.altKey || e.metaKey || e.ctrlKey || !n) return null;\n const i = Math.max(0, at);\n const to =\n e.key === 'ArrowRight' ? Math.min(n - 1, i + 1) : e.key === 'ArrowLeft' ? Math.max(0, i - 1) : e.key === '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IAAI,EAAE,QAAQ,QAAQ,IAAI,IAAI;CAClJ,IAAI,MAAM,MAAM,EAAE,eAAe;CACjC,OAAO;AACT"}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ // src/internal/dev.ts
3
+ const DEV = typeof __UI_DEV__ === "boolean" ? __UI_DEV__ : (() => {
4
+ try {
5
+ return process.env.NODE_ENV !== "production";
6
+ } catch {
7
+ return false;
8
+ }
9
+ })();
10
+ const seen = /* @__PURE__ */ new Set();
11
+ /** Logs once per message when cond is true. */
12
+ function devWarn(cond, component, message) {
13
+ if (!DEV || !cond) return;
14
+ const text = `[@seanyeh77/ui] ${component}: ${message}`;
15
+ if (seen.has(text)) return;
16
+ seen.add(text);
17
+ console.warn(text);
18
+ }
19
+ export { devWarn };
20
+
21
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","names":[],"sources":["../../src/internal/dev.ts"],"sourcesContent":["/* Development-only warnings for misuse an agent or a person is likely to make. Each message gives the\n cause and the fix. Off in production builds (the bundler replaces NODE_ENV); the single-file build (bundle.js) keeps them on. */\n\ndeclare const process: { env: { NODE_ENV?: string } };\ndeclare const __UI_DEV__: boolean | undefined;\n\n// Bundlers replace process.env.NODE_ENV; without a bundler there is no process, and the warnings stay off.\nconst DEV =\n typeof __UI_DEV__ === 'boolean'\n ? __UI_DEV__\n : (() => {\n try {\n return process.env.NODE_ENV !== 'production';\n } catch {\n return false;\n }\n })();\n\nconst seen = new Set<string>();\n\n/** Logs once per message when cond is true. */\nexport function devWarn(cond: unknown, component: string, message: string): void {\n if (!DEV || !cond) return;\n const text = `[@seanyeh77/ui] ${component}: ${message}`;\n if (seen.has(text)) return;\n seen.add(text);\n console.warn(text);\n}\n"],"mappings":";;AAOA,MAAM,MACJ,OAAO,eAAe,YAClB,oBACO;CACL,IAAI;EACF,OAAO,QAAQ,IAAI,aAAa;CAClC,QAAQ;EACN,OAAO;CACT;AACF,EAAA,CAAG;AAET,MAAM,uBAAO,IAAI,IAAY;;AAG7B,SAAgB,QAAQ,MAAe,WAAmB,SAAuB;CAC/E,IAAI,CAAC,OAAO,CAAC,MAAM;CACnB,MAAM,OAAO,mBAAmB,UAAU,IAAI;CAC9C,IAAI,KAAK,IAAI,IAAI,GAAG;CACpB,KAAK,IAAI,IAAI;CACb,QAAQ,KAAK,IAAI;AACnB"}
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { focusMain } from "./focusMain.js";
3
+ import * as React from "react";
4
+ // src/internal/focus.tsx
5
+ /** True when focus has fallen out of the page's content: nothing focused, or the body. */
6
+ const lost = () => !document.activeElement || document.activeElement === document.body;
7
+ /** For a dialog-like overlay opened by the open prop: remembers what had focus when it opened and gives focus back
8
+ * when it closes. When that element is gone (the app changed page), focus goes to the main content. */
9
+ function useReturnFocus(open) {
10
+ const opener = React.useRef(null);
11
+ const wasOpen = React.useRef(false);
12
+ React.useEffect(() => {
13
+ if (open && !wasOpen.current) {
14
+ const a = document.activeElement;
15
+ opener.current = a instanceof HTMLElement && a !== document.body ? a : null;
16
+ }
17
+ if (!open && wasOpen.current) {
18
+ const back = opener.current;
19
+ opener.current = null;
20
+ const held = document.activeElement;
21
+ const until = performance.now() + 2e3;
22
+ let frame = 0;
23
+ const look = () => {
24
+ if (lost()) {
25
+ if (back?.isConnected) back.focus();
26
+ else focusMain();
27
+ return;
28
+ }
29
+ const at = document.activeElement;
30
+ if (!(at === held || !!at?.closest("[data-ending-style]")) || performance.now() > until) return;
31
+ frame = requestAnimationFrame(look);
32
+ };
33
+ frame = requestAnimationFrame(look);
34
+ wasOpen.current = open;
35
+ return () => cancelAnimationFrame(frame);
36
+ }
37
+ wasOpen.current = open;
38
+ }, [open]);
39
+ }
40
+ const FOCUSABLE = "button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), [role=\"tab\"]";
41
+ /** When the focused control inside the container is removed or replaced (a button that turns into another), focus
42
+ * moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */
43
+ function useFocusRescue(ref, fallback) {
44
+ const fb = React.useRef(fallback);
45
+ React.useEffect(() => {
46
+ fb.current = fallback;
47
+ });
48
+ React.useEffect(() => {
49
+ const box = ref.current;
50
+ if (!box) return;
51
+ let last = null;
52
+ let index = -1;
53
+ const list = () => Array.from(box.querySelectorAll(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(":disabled"));
54
+ const onIn = (e) => {
55
+ if (!(e.target instanceof HTMLElement)) return;
56
+ last = e.target;
57
+ index = list().indexOf(last);
58
+ };
59
+ const rescue = () => {
60
+ const now = list();
61
+ const next = fb.current?.() ?? now[Math.min(index, now.length - 1)] ?? null;
62
+ last = null;
63
+ if (next) next.focus();
64
+ else focusMain();
65
+ };
66
+ let frame = 0;
67
+ const mo = new MutationObserver(() => {
68
+ if (!last || last.isConnected && !last.matches(":disabled")) return;
69
+ if (lost()) return rescue();
70
+ const dead = last;
71
+ cancelAnimationFrame(frame);
72
+ frame = requestAnimationFrame(() => {
73
+ frame = requestAnimationFrame(() => {
74
+ if (last === dead && (lost() || document.activeElement === dead)) rescue();
75
+ });
76
+ });
77
+ });
78
+ box.addEventListener("focusin", onIn);
79
+ mo.observe(box, {
80
+ childList: true,
81
+ subtree: true,
82
+ attributes: true,
83
+ attributeFilter: ["disabled"]
84
+ });
85
+ return () => {
86
+ box.removeEventListener("focusin", onIn);
87
+ mo.disconnect();
88
+ cancelAnimationFrame(frame);
89
+ };
90
+ }, [ref]);
91
+ }
92
+ export { useFocusRescue, useReturnFocus };
93
+
94
+ //# sourceMappingURL=focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus.js","names":[],"sources":["../../src/internal/focus.tsx"],"sourcesContent":["import * as React from 'react';\nimport { focusMain } from './focusMain';\n\n/** True when focus has fallen out of the page's content: nothing focused, or the body. */\nconst lost = () => !document.activeElement || document.activeElement === document.body;\n\n/** For a dialog-like overlay opened by the open prop: remembers what had focus when it opened and gives focus back\n * when it closes. When that element is gone (the app changed page), focus goes to the main content. */\nexport function useReturnFocus(open: boolean): void {\n const opener = React.useRef<HTMLElement | null>(null);\n const wasOpen = React.useRef(false);\n React.useEffect(() => {\n if (open && !wasOpen.current) {\n const a = document.activeElement;\n opener.current = a instanceof HTMLElement && a !== document.body ? a : null;\n }\n if (!open && wasOpen.current) {\n const back = opener.current;\n opener.current = null;\n // The overlay is removed only after its closing animation, and focus falls to the page then, not now: look every\n // frame (for 2 s at most) while focus stays where it was or inside a closing overlay. Fallen to the page: back to\n // the opener, else to the main content. Moved somewhere that stays (the overlay gave it back, or the app moved\n // it): left there.\n const held = document.activeElement;\n const until = performance.now() + 2000;\n let frame = 0;\n const look = () => {\n if (lost()) {\n if (back?.isConnected) back.focus();\n else focusMain();\n return;\n }\n // Still where it was, or on something in an overlay that is closing (both about to go): keep looking.\n const at = document.activeElement;\n const going = at === held || !!at?.closest('[data-ending-style]');\n if (!going || performance.now() > until) return;\n frame = requestAnimationFrame(look);\n };\n frame = requestAnimationFrame(look);\n wasOpen.current = open;\n return () => cancelAnimationFrame(frame);\n }\n wasOpen.current = open;\n }, [open]);\n}\n\nconst FOCUSABLE = 'button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), [role=\"tab\"]';\n\n/** When the focused control inside the container is removed or replaced (a button that turns into another), focus\n * moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */\nexport function useFocusRescue(ref: React.RefObject<HTMLElement | null>, fallback?: () => HTMLElement | null | undefined): void {\n const fb = React.useRef(fallback);\n React.useEffect(() => {\n fb.current = fallback;\n });\n React.useEffect(() => {\n const box = ref.current;\n if (!box) return;\n let last: HTMLElement | null = null;\n let index = -1;\n const list = () => Array.from(box.querySelectorAll<HTMLElement>(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(':disabled'));\n const onIn = (e: FocusEvent) => {\n if (!(e.target instanceof HTMLElement)) return;\n last = e.target;\n // The same list rescue() picks from (visible, enabled), so the index means the same place.\n index = list().indexOf(last);\n };\n const rescue = () => {\n const now = list();\n const next = fb.current?.() ?? now[Math.min(index, now.length - 1)] ?? null;\n last = null;\n if (next) next.focus();\n else focusMain();\n };\n let frame = 0;\n const mo = new MutationObserver(() => {\n // Gone, or still there but disabled (a disabled control drops focus too).\n if (!last || (last.isConnected && !last.matches(':disabled'))) return;\n if (lost()) return rescue();\n // The browser moves focus off a control it just disabled at its next rendering update, not at once: look again\n // then. Rescue when focus fell to the page, or still sits on the dead control; not when it went somewhere else.\n const dead = last;\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n frame = requestAnimationFrame(() => {\n if (last === dead && (lost() || document.activeElement === dead)) rescue();\n });\n });\n });\n box.addEventListener('focusin', onIn);\n mo.observe(box, { childList: true, subtree: true, attributes: true, attributeFilter: ['disabled'] });\n return () => {\n box.removeEventListener('focusin', onIn);\n mo.disconnect();\n cancelAnimationFrame(frame);\n };\n }, [ref]);\n}\n"],"mappings":";;;;;AAIA,MAAM,aAAa,CAAC,SAAS,iBAAiB,SAAS,kBAAkB,SAAS;;;AAIlF,SAAgB,eAAe,MAAqB;CAClD,MAAM,SAAS,MAAM,OAA2B,IAAI;CACpD,MAAM,UAAU,MAAM,OAAO,KAAK;CAClC,MAAM,gBAAgB;EACpB,IAAI,QAAQ,CAAC,QAAQ,SAAS;GAC5B,MAAM,IAAI,SAAS;GACnB,OAAO,UAAU,aAAa,eAAe,MAAM,SAAS,OAAO,IAAI;EACzE;EACA,IAAI,CAAC,QAAQ,QAAQ,SAAS;GAC5B,MAAM,OAAO,OAAO;GACpB,OAAO,UAAU;GAKjB,MAAM,OAAO,SAAS;GACtB,MAAM,QAAQ,YAAY,IAAI,IAAI;GAClC,IAAI,QAAQ;GACZ,MAAM,aAAa;IACjB,IAAI,KAAK,GAAG;KACV,IAAI,MAAM,aAAa,KAAK,MAAM;UAC7B,UAAU;KACf;IACF;IAEA,MAAM,KAAK,SAAS;IAEpB,IAAI,EADU,OAAO,QAAQ,CAAC,CAAC,I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AO;IAC3E,CAAC;GACH,CAAC;EACH,CAAC;EACD,IAAI,iBAAiB,WAAW,IAAI;EACpC,GAAG,QAAQ,KAAK;GAAE,WAAW;GAAM,SAAS;GAAM,YAAY;GAAM,iBAAiB,CAAC,UAAU;EAAE,CAAC;EACnG,aAAa;GACX,IAAI,oBAAoB,WAAW,IAAI;GACvC,GAAG,WAAW;GACd,qBAAqB,KAAK;EAC5B;CACF,GAAG,CAAC,GAAG,CAAC;AACV"}
@@ -0,0 +1,4 @@
1
+ /** Moves keyboard and screen-reader focus to the page's content: its first heading inside main (or the top bar's title),
2
+ * else main itself. Call it after the app changes page, e.g. when a CommandPalette result opens another page. The
3
+ * heading gets no focus ring: a 3 px accent bar on its left after a key press, nothing after a mouse or touch. */
4
+ export declare function focusMain(): void;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ // src/internal/focusMain.ts
3
+ let lastInput = "pointer";
4
+ if (typeof document !== "undefined") {
5
+ document.addEventListener("keydown", () => lastInput = "key", true);
6
+ document.addEventListener("pointerdown", () => lastInput = "pointer", true);
7
+ }
8
+ /** Moves keyboard and screen-reader focus to the page's content: its first heading inside main (or the top bar's title),
9
+ * else main itself. Call it after the app changes page, e.g. when a CommandPalette result opens another page. The
10
+ * heading gets no focus ring: a 3 px accent bar on its left after a key press, nothing after a mouse or touch. */
11
+ function focusMain() {
12
+ if (typeof document === "undefined") return;
13
+ const main = document.querySelector("main");
14
+ const target = main?.querySelector("h1, h2") ?? document.querySelector(".ui-topbar-title") ?? main;
15
+ if (!target) return;
16
+ if (target.tabIndex < 0 && !target.hasAttribute("tabindex")) target.setAttribute("tabindex", "-1");
17
+ target.setAttribute("data-ui-main-focus", lastInput);
18
+ target.focus({ preventScroll: false });
19
+ }
20
+ export { focusMain };
21
+
22
+ //# sourceMappingURL=focusMain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusMain.js","names":[],"sources":["../../src/internal/focusMain.ts"],"sourcesContent":["// How the person last acted: a key, or a pointer (mouse, pen, touch). The heading focusMain() moves to shows a bar on\n// its left only after a key: someone who changed page with a mouse sees no change.\nlet lastInput: 'key' | 'pointer' = 'pointer';\nif (typeof document !== 'undefined') {\n document.addEventListener('keydown', () => (lastInput = 'key'), true);\n document.addEventListener('pointerdown', () => (lastInput = 'pointer'), true);\n}\n\n/** Moves keyboard and screen-reader focus to the page's content: its first heading inside main (or the top bar's title),\n * else main itself. Call it after the app changes page, e.g. when a CommandPalette result opens another page. The\n * heading gets no focus ring: a 3 px accent bar on its left after a key press, nothing after a mouse or touch. */\nexport function focusMain(): void {\n if (typeof document === 'undefined') return;\n const main = document.querySelector<HTMLElement>('main');\n const target = main?.querySelector<HTMLElement>('h1, h2') ?? document.querySelector<HTMLElement>('.ui-topbar-title') ?? main;\n if (!target) return;\n if (target.tabIndex < 0 && !target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');\n target.setAttribute('data-ui-main-focus', lastInput);\n target.focus({ preventScroll: false });\n}\n"],"mappings":";;AAEA,IAAI,YAA+B;AACnC,IAAI,OAAO,aAAa,aAAa;CACnC,SAAS,iBAAiB,iBAAkB,YAAY,OAAQ,IAAI;CACpE,SAAS,iBAAiB,qBAAsB,YAAY,WAAY,IAAI;AAC9E;;;;AAKA,SAAgB,YAAkB;CAChC,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,OAAO,SAAS,cAA2B,MAAM;CACvD,MAAM,SAAS,MAAM,cAA2B,QAAQ,KAAK,SAAS,cAA2B,kBAAkB,KAAK;CACxH,IAAI,CAAC,QAAQ;CACb,IAAI,OAAO,WAAW,KAAK,CAAC,OAAO,aAAa,UAAU,GAAG,OAAO,aAAa,YAAY,IAAI;CACjG,OAAO,aAAa,sBAAsB,SAAS;CACnD,OAAO,MAAM,EAAE,eAAe,MAAM,CAAC;AACvC"}
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { Icon } from "../icons/Icon.js";
3
+ import { tr } from "../i18n.js";
4
+ import { cx, useMedia } from "./util.js";
5
+ import { includeIcons } from "../icons/store.js";
6
+ import arrow_right_default from "../icons/ph/arrow-right.js";
7
+ import * as React from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ // src/internal/scrollHint.tsx
10
+ includeIcons(arrow_right_default);
11
+ /** A box that may be wider than its container: whether it overflows, whether more is to the right, and whether the
12
+ * person has scrolled yet. Used by LayerGraph and DataTable for the right-edge fade and the 「左右滑動」 hint. */
13
+ function useScrollHint() {
14
+ const ref = React.useRef(null);
15
+ const [more, setMore] = React.useState(false);
16
+ const [scrolled, setScrolled] = React.useState(false);
17
+ const [overflows, setOverflows] = React.useState(false);
18
+ const measure = React.useCallback(() => {
19
+ const el = ref.current;
20
+ if (!el) return;
21
+ const wide = el.scrollWidth > el.clientWidth + 1;
22
+ setOverflows(wide);
23
+ setMore(wide && el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
24
+ }, []);
25
+ React.useLayoutEffect(() => {
26
+ const el = ref.current;
27
+ if (!el) return;
28
+ measure();
29
+ const ro = new ResizeObserver(measure);
30
+ ro.observe(el);
31
+ if (el.firstElementChild) ro.observe(el.firstElementChild);
32
+ let raf = 0;
33
+ const later = () => {
34
+ cancelAnimationFrame(raf);
35
+ raf = requestAnimationFrame(measure);
36
+ };
37
+ const mo = new MutationObserver(later);
38
+ mo.observe(el, {
39
+ childList: true,
40
+ subtree: true,
41
+ characterData: true
42
+ });
43
+ document.fonts?.ready.then(later).catch(() => {});
44
+ return () => {
45
+ ro.disconnect();
46
+ mo.disconnect();
47
+ cancelAnimationFrame(raf);
48
+ };
49
+ }, [measure]);
50
+ return {
51
+ ref,
52
+ more,
53
+ overflows,
54
+ scrolled,
55
+ onScroll: React.useCallback(() => {
56
+ const el = ref.current;
57
+ if (el && el.scrollLeft > 0) setScrolled(true);
58
+ measure();
59
+ }, [measure]),
60
+ measure
61
+ };
62
+ }
63
+ /** 「→ 左右滑動」 (touch) or 「→ 向右捲動」 (mouse, trackpad) under the box, right-aligned. Hidden after the first sideways
64
+ * scroll but keeps its line, so nothing below jumps. */
65
+ function ScrollHint({ show, done }) {
66
+ const touch = useMedia("(pointer: coarse)");
67
+ return show ? /* @__PURE__ */ jsxs("span", {
68
+ className: cx("ui-scroll-hint", done && "is-done"),
69
+ "aria-hidden": "true",
70
+ children: [/* @__PURE__ */ jsx(Icon, {
71
+ name: "arrow-right",
72
+ size: 14
73
+ }), touch ? tr("左右滑動") : tr("向右捲動")]
74
+ }) : null;
75
+ }
76
+ export { ScrollHint, useScrollHint };
77
+
78
+ //# sourceMappingURL=scrollHint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrollHint.js","names":["phArrowRight"],"sources":["../../src/internal/scrollHint.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Icon } from '../icons/Icon';\nimport { tr } from '../i18n';\nimport { cx, useMedia } from './util';\nimport { includeIcons } from '../icons/store';\nimport phArrowRight from '../icons/ph/arrow-right';\n\nincludeIcons(phArrowRight);\n\n/** A box that may be wider than its container: whether it overflows, whether more is to the right, and whether the\n * person has scrolled yet. Used by LayerGraph and DataTable for the right-edge fade and the 「左右滑動」 hint. */\nexport function useScrollHint<E extends HTMLElement = HTMLDivElement>() {\n const ref = React.useRef<E>(null);\n const [more, setMore] = React.useState(false);\n const [scrolled, setScrolled] = React.useState(false);\n const [overflows, setOverflows] = React.useState(false);\n const measure = React.useCallback(() => {\n const el = ref.current;\n if (!el) return;\n const wide = el.scrollWidth > el.clientWidth + 1;\n setOverflows(wide);\n setMore(wide && el.scrollLeft + el.clientWidth < el.scrollWidth - 1);\n }, []);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n measure();\n const ro = new ResizeObserver(measure);\n ro.observe(el);\n if (el.firstElementChild) ro.observe(el.firstElementChild);\n // Content that changes without resizing the box (a column hidden, rows replaced, text measured again) and web\n // fonts that load late change the scroll width too: measured again after each.\n let raf = 0;\n const later = () => {\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(measure);\n };\n const mo = new MutationObserver(later);\n mo.observe(el, { childList: true, subtree: true, characterData: true });\n document.fonts?.ready.then(later).catch(() => {});\n return () => {\n ro.disconnect();\n mo.disconnect();\n cancelAnimationFrame(raf);\n };\n }, [measure]);\n const onScroll = React.useCallback(() => {\n const el = ref.current;\n // Only a sideways scroll counts: a table also scrolls down.\n if (el && el.scrollLeft > 0) setScrolled(true);\n measure();\n }, [measure]);\n return { ref, more, overflows, scrolled, onScroll, measure };\n}\n\n/** 「→ 左右滑動」 (touch) or 「→ 向右捲動」 (mouse, trackpad) under the box, right-aligned. Hidden after the first sideways\n * scroll but keeps its line, so nothing below jumps. */\nexport function ScrollHint({ show, done }: { show: boolean; done: boolean }) {\n const touch = useMedia('(pointer: coarse)');\n return show ? (\n <span className={cx('ui-scroll-hint', done && 'is-done')} aria-hidden=\"true\">\n <Icon name=\"arrow-right\" size={14} />\n {touch ? tr('左右滑動') : tr('向右捲動')}\n </span>\n ) : null;\n}\n"],"mappings":";;;;;;;;;AAOA,aAAaA,mBAAY;;;AAIzB,SAAgB,gBAAwD;CACtE,MAAM,MAAM,MAAM,OAAU,IAAI;CAChC,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,CAAC,UAAU,eAAe,MAAM,SAAS,KAAK;CACpD,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,KAAK;CACtD,MAAM,UAAU,MAAM,kBAAkB;EACtC,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,IAAI;EACT,MAAM,OAAO,GAAG,cAAc,GAAG,cAAc;EAC/C,aAAa,IAAI;EACjB,QAAQ,QAAQ,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,CAAC;CACrE,GAAG,CAAC,CAAC;CACL,MAAM,sBAAsB;EAC1B,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,IAAI;EACT,QAAQ;EACR,MAAM,KAAK,IAAI,eAAe,OAAO;EACrC,GAAG,QAAQ,EAAE;EACb,IAAI,GAAG,mBAAmB,GAAG,QAAQ,GAA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