@passui/react 0.1.46 → 0.2.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 (429) hide show
  1. package/README.md +29 -109
  2. package/THIRD_PARTY_NOTICES.md +29 -0
  3. package/dist/accordion.d.ts +15 -0
  4. package/dist/accordion.js +93 -0
  5. package/dist/alert-dialog.d.ts +26 -0
  6. package/dist/alert-dialog.js +142 -0
  7. package/dist/alert.d.ts +10 -0
  8. package/dist/alert.js +28 -0
  9. package/dist/{types/src/components/ambient/ambient.d.ts → ambient.d.ts} +4 -4
  10. package/dist/ambient.js +22 -0
  11. package/dist/{types/src/appearance → appearance}/platform.d.ts +3 -3
  12. package/dist/appearance/platform.js +43 -0
  13. package/dist/appearance/theme.d.ts +71 -0
  14. package/dist/appearance/theme.js +236 -0
  15. package/dist/appearance.d.ts +3 -0
  16. package/dist/appearance.js +3 -0
  17. package/dist/{types/src/components/aspect-ratio/aspect-ratio.d.ts → aspect-ratio.d.ts} +4 -4
  18. package/dist/aspect-ratio.js +17 -0
  19. package/dist/avatar.d.ts +5 -0
  20. package/dist/avatar.js +43 -0
  21. package/dist/badge.d.ts +8 -0
  22. package/dist/badge.js +21 -0
  23. package/dist/breadcrumb.d.ts +13 -0
  24. package/dist/breadcrumb.js +63 -0
  25. package/dist/button-group.d.ts +5 -0
  26. package/dist/button-group.js +14 -0
  27. package/dist/button.d.ts +21 -0
  28. package/dist/button.js +58 -0
  29. package/dist/calendar.d.ts +35 -0
  30. package/dist/calendar.js +225 -0
  31. package/dist/card.d.ts +9 -0
  32. package/dist/card.js +54 -0
  33. package/dist/chart.d.ts +30 -0
  34. package/dist/chart.js +226 -0
  35. package/dist/checkbox.d.ts +13 -0
  36. package/dist/checkbox.js +53 -0
  37. package/dist/{types/src/lib/clipboard.d.ts → clipboard.d.ts} +1 -1
  38. package/dist/clipboard.js +16 -0
  39. package/dist/cn.d.ts +2 -0
  40. package/dist/cn.js +10 -0
  41. package/dist/code-block.d.ts +34 -0
  42. package/dist/code-block.js +87 -0
  43. package/dist/collapsible.d.ts +13 -0
  44. package/dist/collapsible.js +49 -0
  45. package/dist/combobox.d.ts +25 -0
  46. package/dist/combobox.js +112 -0
  47. package/dist/command.d.ts +22 -0
  48. package/dist/command.js +129 -0
  49. package/dist/components/toast/toast-store.d.ts +60 -0
  50. package/dist/components/toast/toast-store.js +96 -0
  51. package/dist/{types/src/components → components}/toast/toaster.d.ts +4 -4
  52. package/dist/components/toast/toaster.js +345 -0
  53. package/dist/context-menu.d.ts +2 -0
  54. package/dist/context-menu.js +2 -0
  55. package/dist/conversation.d.ts +48 -0
  56. package/dist/conversation.js +202 -0
  57. package/dist/date-time-picker.d.ts +50 -0
  58. package/dist/date-time-picker.js +235 -0
  59. package/dist/date.d.ts +50 -0
  60. package/dist/date.js +77 -0
  61. package/dist/dialog.d.ts +21 -0
  62. package/dist/dialog.js +113 -0
  63. package/dist/drawer.d.ts +30 -0
  64. package/dist/drawer.js +140 -0
  65. package/dist/dropdown-menu.d.ts +56 -0
  66. package/dist/dropdown-menu.js +295 -0
  67. package/dist/empty.d.ts +11 -0
  68. package/dist/empty.js +51 -0
  69. package/dist/field.d.ts +16 -0
  70. package/dist/field.js +47 -0
  71. package/{src/hooks/scroll/minimize-decision.ts → dist/hooks/scroll/minimize-decision.js} +3 -5
  72. package/dist/{types/src/hooks → hooks}/use-anchored-placement.d.ts +2 -2
  73. package/dist/hooks/use-anchored-placement.js +33 -0
  74. package/dist/{types/src/hooks → hooks}/use-minimize-on-scroll.d.ts +1 -1
  75. package/dist/hooks/use-minimize-on-scroll.js +59 -0
  76. package/dist/{types/src/hooks → hooks}/use-visual-viewport.d.ts +2 -2
  77. package/{src/hooks/use-visual-viewport.ts → dist/hooks/use-visual-viewport.js} +20 -35
  78. package/dist/hooks/viewport/types.d.ts +7 -0
  79. package/dist/hooks/viewport/viewport-metrics.js +13 -0
  80. package/dist/index.d.ts +84 -0
  81. package/dist/index.js +80 -0
  82. package/dist/input-group.d.ts +17 -0
  83. package/dist/input-group.js +55 -0
  84. package/dist/input-otp.d.ts +13 -0
  85. package/dist/input-otp.js +36 -0
  86. package/dist/input.d.ts +4 -0
  87. package/dist/input.js +14 -0
  88. package/dist/item.d.ts +49 -0
  89. package/dist/item.js +142 -0
  90. package/dist/kbd.d.ts +4 -0
  91. package/dist/kbd.js +86 -0
  92. package/dist/label.d.ts +3 -0
  93. package/dist/label.js +12 -0
  94. package/dist/labeled-content.d.ts +24 -0
  95. package/dist/labeled-content.js +41 -0
  96. package/dist/{types/src/lib/language.d.ts → language.d.ts} +1 -1
  97. package/dist/language.js +11 -0
  98. package/dist/layout.d.ts +24 -0
  99. package/dist/layout.js +36 -0
  100. package/dist/{types/src/lib → lib}/anchored-placement.d.ts +27 -27
  101. package/dist/lib/anchored-placement.js +42 -0
  102. package/dist/lib/calendar-month.js +90 -0
  103. package/dist/lib/cx.js +6 -0
  104. package/dist/lib/drawer.math.js +29 -0
  105. package/dist/lib/floating-layers.d.ts +3 -0
  106. package/dist/lib/floating-layers.js +25 -0
  107. package/dist/{types/src/lib → lib}/haptics.d.ts +1 -1
  108. package/dist/lib/haptics.js +13 -0
  109. package/dist/lib/liquid-step.js +33 -0
  110. package/dist/lib/page-scale.js +58 -0
  111. package/dist/lib/portal.js +12 -0
  112. package/dist/lib/presence.js +53 -0
  113. package/dist/lib/range-value.js +25 -0
  114. package/dist/lib/render.d.ts +8 -0
  115. package/dist/lib/render.js +42 -0
  116. package/dist/lib/rolling-digit.js +83 -0
  117. package/dist/{types/src/lib → lib}/screen-edges.d.ts +5 -5
  118. package/dist/lib/screen-edges.js +30 -0
  119. package/dist/lib/swipe-touch-action.js +34 -0
  120. package/dist/lib/visual-viewport.js +27 -0
  121. package/dist/lib/water-drop.js +412 -0
  122. package/dist/lib/wheel.js +125 -0
  123. package/dist/list.d.ts +26 -0
  124. package/dist/list.js +80 -0
  125. package/dist/locales.d.ts +18 -0
  126. package/dist/locales.js +36 -0
  127. package/dist/marker.d.ts +13 -0
  128. package/dist/marker.js +33 -0
  129. package/dist/motion/transitions.d.ts +170 -0
  130. package/dist/motion/transitions.js +156 -0
  131. package/dist/pagination.d.ts +30 -0
  132. package/dist/pagination.js +117 -0
  133. package/dist/popover.d.ts +26 -0
  134. package/dist/popover.js +101 -0
  135. package/dist/progress.d.ts +9 -0
  136. package/dist/progress.js +24 -0
  137. package/dist/questionnaire.d.ts +46 -0
  138. package/dist/questionnaire.js +133 -0
  139. package/dist/radio-group.d.ts +21 -0
  140. package/dist/radio-group.js +67 -0
  141. package/dist/search-field.d.ts +18 -0
  142. package/dist/search-field.js +45 -0
  143. package/dist/segmented-control.d.ts +16 -0
  144. package/dist/segmented-control.js +25 -0
  145. package/dist/select.d.ts +24 -0
  146. package/dist/select.js +107 -0
  147. package/dist/separator.d.ts +9 -0
  148. package/dist/separator.js +17 -0
  149. package/dist/{types/src/lib/shapes.d.ts → shapes.d.ts} +2 -2
  150. package/dist/shapes.js +65 -0
  151. package/dist/sheet.d.ts +24 -0
  152. package/dist/sheet.js +141 -0
  153. package/dist/sidebar.d.ts +32 -0
  154. package/dist/sidebar.js +85 -0
  155. package/dist/skeleton.d.ts +3 -0
  156. package/dist/skeleton.js +13 -0
  157. package/dist/slider.d.ts +9 -0
  158. package/dist/slider.js +42 -0
  159. package/dist/slosh-slider.d.ts +21 -0
  160. package/dist/slosh-slider.js +205 -0
  161. package/dist/spinner.d.ts +3 -0
  162. package/dist/spinner.js +20 -0
  163. package/dist/stat-tile.d.ts +20 -0
  164. package/dist/stat-tile.js +53 -0
  165. package/dist/stepper.d.ts +22 -0
  166. package/dist/stepper.js +98 -0
  167. package/dist/swatch-picker.d.ts +22 -0
  168. package/dist/swatch-picker.js +70 -0
  169. package/dist/switch.d.ts +10 -0
  170. package/dist/switch.js +44 -0
  171. package/dist/tab-bar.d.ts +15 -0
  172. package/dist/tab-bar.js +34 -0
  173. package/dist/{types/src/components/table/table.d.ts → table.d.ts} +3 -3
  174. package/dist/table.js +93 -0
  175. package/dist/tabs.d.ts +32 -0
  176. package/dist/tabs.js +131 -0
  177. package/dist/text.d.ts +25 -0
  178. package/dist/text.js +44 -0
  179. package/dist/textarea.d.ts +3 -0
  180. package/dist/textarea.js +13 -0
  181. package/dist/toast.d.ts +3 -0
  182. package/dist/toast.js +3 -0
  183. package/dist/toggle-group.d.ts +20 -0
  184. package/dist/toggle-group.js +68 -0
  185. package/dist/toggle.d.ts +24 -0
  186. package/dist/toggle.js +37 -0
  187. package/dist/tokens.d.ts +1 -0
  188. package/dist/tooltip.d.ts +21 -0
  189. package/dist/tooltip.js +61 -0
  190. package/dist/trace.d.ts +14 -0
  191. package/dist/trace.js +54 -0
  192. package/dist/{types/src/hooks/use-dismiss.d.ts → use-dismiss.d.ts} +3 -3
  193. package/dist/use-dismiss.js +38 -0
  194. package/dist/{types/src/hooks/use-media-query.d.ts → use-media-query.d.ts} +12 -12
  195. package/dist/use-media-query.js +56 -0
  196. package/dist/use-os.d.ts +12 -0
  197. package/dist/use-os.js +17 -0
  198. package/dist/wake-slider.d.ts +15 -0
  199. package/dist/wake-slider.js +174 -0
  200. package/package.json +122 -253
  201. package/src/styles/code-block.css +4 -0
  202. package/src/styles/globals.css +5 -0
  203. package/src/styles/motion-controls.css +10 -0
  204. package/src/styles/page-scale.css +27 -0
  205. package/src/styles/styles.css +4 -2
  206. package/dist/types/src/appearance/index.d.ts +0 -2
  207. package/dist/types/src/appearance/theme.d.ts +0 -71
  208. package/dist/types/src/components/accordion/accordion.d.ts +0 -23
  209. package/dist/types/src/components/ambient/index.d.ts +0 -1
  210. package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +0 -19
  211. package/dist/types/src/components/button/button-styles.d.ts +0 -12
  212. package/dist/types/src/components/button/button.d.ts +0 -32
  213. package/dist/types/src/components/button/icon-button.d.ts +0 -10
  214. package/dist/types/src/components/button/pending-spinner.d.ts +0 -5
  215. package/dist/types/src/components/button/use-pending-indicator.d.ts +0 -2
  216. package/dist/types/src/components/chip/chip.d.ts +0 -10
  217. package/dist/types/src/components/code-block/code-block.d.ts +0 -13
  218. package/dist/types/src/components/combo-box/combo-box.d.ts +0 -9
  219. package/dist/types/src/components/command/command.d.ts +0 -18
  220. package/dist/types/src/components/compact-date-picker/calendar-month.d.ts +0 -25
  221. package/dist/types/src/components/compact-date-picker/compact-date-picker.d.ts +0 -30
  222. package/dist/types/src/components/compact-time-picker/compact-time-picker.d.ts +0 -29
  223. package/dist/types/src/components/compact-time-picker/time-value.d.ts +0 -18
  224. package/dist/types/src/components/content-unavailable-view/content-unavailable-view.d.ts +0 -12
  225. package/dist/types/src/components/content-view/content-view.d.ts +0 -51
  226. package/dist/types/src/components/content-view/index.d.ts +0 -1
  227. package/dist/types/src/components/context-menu/conceal-menu-source.d.ts +0 -2
  228. package/dist/types/src/components/context-menu/context-menu-host.d.ts +0 -2
  229. package/dist/types/src/components/context-menu/context-menu-store.d.ts +0 -62
  230. package/dist/types/src/components/context-menu/menu-navigation.d.ts +0 -6
  231. package/dist/types/src/components/context-menu/menu-position.d.ts +0 -21
  232. package/dist/types/src/components/context-menu/menu-reveal.d.ts +0 -26
  233. package/dist/types/src/components/context-menu/use-context-menu.d.ts +0 -14
  234. package/dist/types/src/components/conversation/conversation.d.ts +0 -48
  235. package/dist/types/src/components/conversation/index.d.ts +0 -1
  236. package/dist/types/src/components/date-picker/date-picker.d.ts +0 -19
  237. package/dist/types/src/components/date-picker/date-value.d.ts +0 -2
  238. package/dist/types/src/components/dialog/dialog-host.d.ts +0 -6
  239. package/dist/types/src/components/dialog/dialog-store.d.ts +0 -23
  240. package/dist/types/src/components/dialog/dialog.d.ts +0 -33
  241. package/dist/types/src/components/dialog/index.d.ts +0 -1
  242. package/dist/types/src/components/disclosure-group/disclosure-group.d.ts +0 -18
  243. package/dist/types/src/components/divider/divider.d.ts +0 -9
  244. package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +0 -15
  245. package/dist/types/src/components/keyboard-shortcut/keyboard-shortcut.d.ts +0 -8
  246. package/dist/types/src/components/labeled-content/labeled-content.d.ts +0 -22
  247. package/dist/types/src/components/locale-switcher/index.d.ts +0 -1
  248. package/dist/types/src/components/locale-switcher/locale-switcher.d.ts +0 -13
  249. package/dist/types/src/components/menu/menu.d.ts +0 -16
  250. package/dist/types/src/components/morph/index.d.ts +0 -2
  251. package/dist/types/src/components/morph/morph.d.ts +0 -32
  252. package/dist/types/src/components/morph/use-morph-disclosure.d.ts +0 -13
  253. package/dist/types/src/components/one-time-code/one-time-code.d.ts +0 -26
  254. package/dist/types/src/components/picker/picker-trigger.d.ts +0 -3
  255. package/dist/types/src/components/picker/picker.d.ts +0 -46
  256. package/dist/types/src/components/popover/anchored-surface.d.ts +0 -17
  257. package/dist/types/src/components/popover/index.d.ts +0 -41
  258. package/dist/types/src/components/popover/popover-content.d.ts +0 -32
  259. package/dist/types/src/components/popover/popover-fit.d.ts +0 -21
  260. package/dist/types/src/components/popover/popover-root.d.ts +0 -22
  261. package/dist/types/src/components/popover/popover-trigger.d.ts +0 -23
  262. package/dist/types/src/components/profile-image/profile-image.d.ts +0 -9
  263. package/dist/types/src/components/progress-view/progress-view.d.ts +0 -13
  264. package/dist/types/src/components/progress-view/use-liquid-progress.d.ts +0 -3
  265. package/dist/types/src/components/radio-group/radio-group.d.ts +0 -20
  266. package/dist/types/src/components/search-field/expanding-search-field.d.ts +0 -5
  267. package/dist/types/src/components/search-field/search-field.d.ts +0 -9
  268. package/dist/types/src/components/search-list/search-list.d.ts +0 -22
  269. package/dist/types/src/components/section/section.d.ts +0 -18
  270. package/dist/types/src/components/secure-field/secure-field.d.ts +0 -4
  271. package/dist/types/src/components/segmented-control/segmented-control.d.ts +0 -25
  272. package/dist/types/src/components/sheet/modal-environment.d.ts +0 -2
  273. package/dist/types/src/components/sheet/sheet-portal.d.ts +0 -5
  274. package/dist/types/src/components/sheet/sheet.d.ts +0 -26
  275. package/dist/types/src/components/sheet/use-sheet-focus.d.ts +0 -3
  276. package/dist/types/src/components/sidebar/sidebar.d.ts +0 -24
  277. package/dist/types/src/components/skeleton/skeleton.d.ts +0 -9
  278. package/dist/types/src/components/slider/slider.d.ts +0 -17
  279. package/dist/types/src/components/slosh-slider/liquid-step.d.ts +0 -6
  280. package/dist/types/src/components/slosh-slider/slosh-slider.d.ts +0 -21
  281. package/dist/types/src/components/stat-tile/index.d.ts +0 -1
  282. package/dist/types/src/components/stat-tile/stat-tile.d.ts +0 -20
  283. package/dist/types/src/components/status-indicator/status-indicator.d.ts +0 -17
  284. package/dist/types/src/components/stepper/rolling-digit.d.ts +0 -11
  285. package/dist/types/src/components/stepper/stepper.d.ts +0 -22
  286. package/dist/types/src/components/swatch-picker/swatch-picker.d.ts +0 -22
  287. package/dist/types/src/components/tab-bar/tab-bar.d.ts +0 -43
  288. package/dist/types/src/components/tab-view/tab-view.d.ts +0 -27
  289. package/dist/types/src/components/text-editor/text-editor.d.ts +0 -9
  290. package/dist/types/src/components/text-field/text-field.d.ts +0 -33
  291. package/dist/types/src/components/toast/toast-store.d.ts +0 -52
  292. package/dist/types/src/components/toggle/toggle.d.ts +0 -22
  293. package/dist/types/src/components/tooltip/tooltip-host.d.ts +0 -7
  294. package/dist/types/src/components/view-controller/index.d.ts +0 -1
  295. package/dist/types/src/components/view-controller/view-controller.d.ts +0 -21
  296. package/dist/types/src/components/wake-slider/wake-slider.d.ts +0 -15
  297. package/dist/types/src/hooks/scroll/minimize-decision.d.ts +0 -2
  298. package/dist/types/src/hooks/use-anchored-disclosure.d.ts +0 -9
  299. package/dist/types/src/hooks/use-floating-dismiss.d.ts +0 -3
  300. package/dist/types/src/hooks/viewport/types.d.ts +0 -19
  301. package/dist/types/src/hooks/viewport/viewport-metrics.d.ts +0 -3
  302. package/dist/types/src/icons/icons.d.ts +0 -616
  303. package/dist/types/src/index.d.ts +0 -73
  304. package/dist/types/src/lib/class-names.d.ts +0 -2
  305. package/dist/types/src/lib/date.d.ts +0 -50
  306. package/dist/types/src/lib/floating-layers.d.ts +0 -8
  307. package/dist/types/src/lib/range-value.d.ts +0 -4
  308. package/dist/types/src/machines/popover.machine.d.ts +0 -30
  309. package/dist/types/src/motion/transitions.d.ts +0 -170
  310. package/src/appearance/index.ts +0 -2
  311. package/src/appearance/platform.tsx +0 -102
  312. package/src/appearance/theme.tsx +0 -467
  313. package/src/components/accordion/accordion.tsx +0 -70
  314. package/src/components/ambient/ambient.tsx +0 -35
  315. package/src/components/ambient/index.ts +0 -1
  316. package/src/components/aspect-ratio/aspect-ratio.tsx +0 -27
  317. package/src/components/breadcrumb/breadcrumb.tsx +0 -73
  318. package/src/components/button/button-styles.ts +0 -49
  319. package/src/components/button/button.tsx +0 -107
  320. package/src/components/button/icon-button.tsx +0 -33
  321. package/src/components/button/pending-spinner.tsx +0 -14
  322. package/src/components/button/use-pending-indicator.ts +0 -22
  323. package/src/components/chip/chip.tsx +0 -45
  324. package/src/components/code-block/code-block.tsx +0 -48
  325. package/src/components/combo-box/combo-box.tsx +0 -13
  326. package/src/components/command/command.tsx +0 -149
  327. package/src/components/compact-date-picker/calendar-month.ts +0 -109
  328. package/src/components/compact-date-picker/compact-date-picker.tsx +0 -337
  329. package/src/components/compact-time-picker/compact-time-picker.tsx +0 -321
  330. package/src/components/compact-time-picker/time-value.ts +0 -58
  331. package/src/components/content-unavailable-view/content-unavailable-view.tsx +0 -78
  332. package/src/components/content-view/content-view.tsx +0 -215
  333. package/src/components/content-view/index.ts +0 -1
  334. package/src/components/context-menu/conceal-menu-source.ts +0 -30
  335. package/src/components/context-menu/context-menu-host.tsx +0 -459
  336. package/src/components/context-menu/context-menu-store.ts +0 -167
  337. package/src/components/context-menu/menu-navigation.ts +0 -36
  338. package/src/components/context-menu/menu-position.ts +0 -38
  339. package/src/components/context-menu/menu-reveal.ts +0 -42
  340. package/src/components/context-menu/use-context-menu.ts +0 -73
  341. package/src/components/conversation/conversation.tsx +0 -309
  342. package/src/components/conversation/index.ts +0 -1
  343. package/src/components/date-picker/date-picker.tsx +0 -106
  344. package/src/components/date-picker/date-value.ts +0 -22
  345. package/src/components/dialog/dialog-host.tsx +0 -119
  346. package/src/components/dialog/dialog-store.ts +0 -66
  347. package/src/components/dialog/dialog.tsx +0 -211
  348. package/src/components/dialog/index.ts +0 -1
  349. package/src/components/disclosure-group/disclosure-group.tsx +0 -108
  350. package/src/components/divider/divider.tsx +0 -33
  351. package/src/components/inline-disclosure/inline-disclosure.tsx +0 -53
  352. package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +0 -32
  353. package/src/components/labeled-content/labeled-content.tsx +0 -84
  354. package/src/components/locale-switcher/index.ts +0 -1
  355. package/src/components/locale-switcher/locale-switcher.tsx +0 -311
  356. package/src/components/menu/menu.tsx +0 -85
  357. package/src/components/morph/index.ts +0 -2
  358. package/src/components/morph/morph.tsx +0 -258
  359. package/src/components/morph/use-morph-disclosure.ts +0 -27
  360. package/src/components/one-time-code/one-time-code.tsx +0 -234
  361. package/src/components/picker/picker-trigger.ts +0 -22
  362. package/src/components/picker/picker.tsx +0 -404
  363. package/src/components/popover/anchored-surface.tsx +0 -264
  364. package/src/components/popover/index.ts +0 -50
  365. package/src/components/popover/popover-content.tsx +0 -334
  366. package/src/components/popover/popover-fit.ts +0 -74
  367. package/src/components/popover/popover-root.tsx +0 -97
  368. package/src/components/popover/popover-trigger.tsx +0 -71
  369. package/src/components/profile-image/profile-image.tsx +0 -96
  370. package/src/components/progress-view/progress-view.tsx +0 -72
  371. package/src/components/progress-view/use-liquid-progress.ts +0 -43
  372. package/src/components/radio-group/radio-group.tsx +0 -86
  373. package/src/components/search-field/expanding-search-field.tsx +0 -197
  374. package/src/components/search-field/search-field.tsx +0 -66
  375. package/src/components/search-list/search-list.tsx +0 -276
  376. package/src/components/section/section.tsx +0 -75
  377. package/src/components/secure-field/secure-field.tsx +0 -8
  378. package/src/components/segmented-control/segmented-control.tsx +0 -157
  379. package/src/components/sheet/modal-environment.ts +0 -82
  380. package/src/components/sheet/sheet-portal.tsx +0 -62
  381. package/src/components/sheet/sheet.tsx +0 -165
  382. package/src/components/sheet/use-sheet-focus.ts +0 -109
  383. package/src/components/sidebar/sidebar.tsx +0 -102
  384. package/src/components/skeleton/skeleton.tsx +0 -38
  385. package/src/components/slider/slider.tsx +0 -134
  386. package/src/components/slosh-slider/liquid-step.ts +0 -43
  387. package/src/components/slosh-slider/slosh-slider.tsx +0 -294
  388. package/src/components/stat-tile/index.ts +0 -1
  389. package/src/components/stat-tile/stat-tile.tsx +0 -90
  390. package/src/components/status-indicator/status-indicator.tsx +0 -54
  391. package/src/components/stepper/rolling-digit.tsx +0 -91
  392. package/src/components/stepper/stepper.tsx +0 -136
  393. package/src/components/swatch-picker/swatch-picker.tsx +0 -138
  394. package/src/components/tab-bar/tab-bar.tsx +0 -182
  395. package/src/components/tab-view/tab-view.tsx +0 -155
  396. package/src/components/table/table.tsx +0 -151
  397. package/src/components/text-editor/text-editor.tsx +0 -42
  398. package/src/components/text-field/text-field.tsx +0 -200
  399. package/src/components/toast/toast-store.ts +0 -164
  400. package/src/components/toast/toaster.tsx +0 -407
  401. package/src/components/toggle/toggle.tsx +0 -320
  402. package/src/components/tooltip/tooltip-host.tsx +0 -178
  403. package/src/components/view-controller/index.ts +0 -1
  404. package/src/components/view-controller/view-controller.tsx +0 -75
  405. package/src/components/wake-slider/wake-slider.tsx +0 -260
  406. package/src/hooks/use-anchored-disclosure.ts +0 -23
  407. package/src/hooks/use-anchored-placement.ts +0 -40
  408. package/src/hooks/use-dismiss.ts +0 -44
  409. package/src/hooks/use-floating-dismiss.ts +0 -30
  410. package/src/hooks/use-media-query.ts +0 -94
  411. package/src/hooks/use-minimize-on-scroll.ts +0 -77
  412. package/src/hooks/viewport/types.ts +0 -19
  413. package/src/hooks/viewport/viewport-metrics.ts +0 -19
  414. package/src/icons/icons.tsx +0 -458
  415. package/src/index.ts +0 -107
  416. package/src/lib/anchored-placement.ts +0 -91
  417. package/src/lib/class-names.ts +0 -21
  418. package/src/lib/clipboard.ts +0 -15
  419. package/src/lib/date.ts +0 -86
  420. package/src/lib/floating-layers.ts +0 -53
  421. package/src/lib/haptics.ts +0 -23
  422. package/src/lib/language.ts +0 -16
  423. package/src/lib/range-value.ts +0 -38
  424. package/src/lib/screen-edges.ts +0 -44
  425. package/src/lib/shapes.ts +0 -59
  426. package/src/machines/popover.machine.ts +0 -51
  427. package/src/motion/transitions.ts +0 -97
  428. package/src/tokens.ts +0 -1
  429. /package/dist/{types/src/tokens.d.ts → tokens.js} +0 -0
@@ -0,0 +1,345 @@
1
+ import { cn } from "../../cn.js";
2
+ import { spring } from "../../motion/transitions.js";
3
+ import { getToasts, subscribeToasts, toast, toastLimits } from "./toast-store.js";
4
+ import { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { CheckIcon } from "@passui/icons/check";
7
+ import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
+ import { CloseIcon } from "@passui/icons/close";
9
+ // src/components/toast/toaster.tsx
10
+ const PILL = {
11
+ sm: 32,
12
+ md: 40,
13
+ lg: 48
14
+ };
15
+ const contentClasses = {
16
+ sm: "absolute top-0 left-0 flex w-max max-w-[min(420px,calc(100vw-24px))] items-start gap-2 py-2 pr-3 pl-2 text-on-inverse",
17
+ md: "absolute top-0 left-0 flex w-max max-w-[min(420px,calc(100vw-24px))] items-start gap-2.5 py-[10px] pr-4 pl-[10px] text-on-inverse",
18
+ lg: "absolute top-0 left-0 flex w-max max-w-[min(420px,calc(100vw-24px))] items-start gap-3 py-3 pr-5 pl-3 text-on-inverse"
19
+ };
20
+ const titleClasses = {
21
+ sm: "text-footnote leading-4 font-semibold",
22
+ md: "text-subheadline leading-5 font-semibold",
23
+ lg: "text-body leading-6 font-semibold"
24
+ };
25
+ const descriptionClasses = {
26
+ sm: "text-caption2 leading-snug text-on-inverse/70",
27
+ md: "text-footnote leading-snug text-on-inverse/70",
28
+ lg: "text-subheadline leading-snug text-on-inverse/70"
29
+ };
30
+ const actionClasses = {
31
+ sm: "ml-1 shrink-0 self-center rounded-full bg-on-inverse/12 px-2.5 py-0.5 text-caption2 font-semibold text-on-inverse transition-colors hover:bg-on-inverse/20",
32
+ md: "ml-1 shrink-0 self-center rounded-full bg-on-inverse/12 px-3 py-1 text-footnote font-semibold text-on-inverse transition-colors hover:bg-on-inverse/20",
33
+ lg: "ml-1 shrink-0 self-center rounded-full bg-on-inverse/12 px-3.5 py-1.5 text-subheadline font-semibold text-on-inverse transition-colors hover:bg-on-inverse/20"
34
+ };
35
+ const toneIconClasses = {
36
+ sm: "flex size-4 shrink-0 items-center justify-center rounded-full",
37
+ md: "flex size-5 shrink-0 items-center justify-center rounded-full",
38
+ lg: "flex size-6 shrink-0 items-center justify-center rounded-full"
39
+ };
40
+ const EMPTY = [];
41
+ /** A little loose, so the body overshoots and settles like a drop of honey. */
42
+ const BODY_SPRING = {
43
+ type: "spring",
44
+ stiffness: 260,
45
+ damping: 19,
46
+ mass: .9
47
+ };
48
+ /**
49
+ * Toasts drop from the top centre like an island: a small pill carrying the
50
+ * icon, out of which the message flows. Both shapes sit under an SVG "goo"
51
+ * filter, so where they meet looks liquid while they grow, morph between
52
+ * states and shrink away. Text is drawn above the filter to stay crisp.
53
+ */
54
+ function Toaster({ className, label = "Notifications" }) {
55
+ const toasts = useSyncExternalStore(subscribeToasts, getToasts, () => EMPTY);
56
+ const filterId = useId();
57
+ const reducedMotion = useReducedMotion();
58
+ const [hovered, setHovered] = useState(false);
59
+ const visible = toasts.slice(0, toastLimits.visible);
60
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(GooFilter, { id: filterId }), /* @__PURE__ */ jsx("section", {
61
+ "aria-label": label,
62
+ "aria-live": "polite",
63
+ className: cn("pointer-events-none fixed inset-x-0 top-[max(10px,env(safe-area-inset-top))] z-[60] flex justify-center px-3", className),
64
+ children: /* @__PURE__ */ jsx("ol", {
65
+ className: "relative flex w-full max-w-[420px] flex-col items-center",
66
+ onMouseEnter: () => setHovered(true),
67
+ onMouseLeave: () => setHovered(false),
68
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
69
+ initial: false,
70
+ children: visible.map((item, index) => /* @__PURE__ */ jsx(ToastItem, {
71
+ toast: item,
72
+ index,
73
+ expanded: hovered,
74
+ paused: hovered,
75
+ filterId,
76
+ reducedMotion: Boolean(reducedMotion)
77
+ }, item.id))
78
+ })
79
+ })
80
+ })] });
81
+ }
82
+ function GooFilter({ id }) {
83
+ return /* @__PURE__ */ jsx("svg", {
84
+ "aria-hidden": "true",
85
+ className: "pointer-events-none absolute size-0",
86
+ children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", {
87
+ id,
88
+ children: [
89
+ /* @__PURE__ */ jsx("feGaussianBlur", {
90
+ in: "SourceGraphic",
91
+ stdDeviation: "7",
92
+ result: "blur"
93
+ }),
94
+ /* @__PURE__ */ jsx("feColorMatrix", {
95
+ in: "blur",
96
+ mode: "matrix",
97
+ values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 22 -10",
98
+ result: "goo"
99
+ }),
100
+ /* @__PURE__ */ jsx("feComposite", {
101
+ in: "SourceGraphic",
102
+ in2: "goo",
103
+ operator: "atop"
104
+ })
105
+ ]
106
+ }) })
107
+ });
108
+ }
109
+ function ToastItem({ toast: toast$1, index, expanded, paused, filterId, reducedMotion }) {
110
+ const pill = PILL[toast$1.size];
111
+ const content = useRef(null);
112
+ const [size, setSize] = useState({
113
+ width: pill,
114
+ height: pill
115
+ });
116
+ const [open, setOpen] = useState(false);
117
+ useEffect(() => {
118
+ const timer = setTimeout(() => setOpen(true), reducedMotion ? 0 : 140);
119
+ return () => clearTimeout(timer);
120
+ }, [reducedMotion]);
121
+ useLayoutEffect(() => {
122
+ const element = content.current;
123
+ if (!element) return;
124
+ const measure = () => setSize({
125
+ width: Math.ceil(element.offsetWidth),
126
+ height: Math.ceil(element.offsetHeight)
127
+ });
128
+ measure();
129
+ const observer = new ResizeObserver(measure);
130
+ observer.observe(element);
131
+ return () => observer.disconnect();
132
+ }, []);
133
+ useEffect(() => {
134
+ if (toast$1.duration === null || paused) return;
135
+ const timer = setTimeout(() => toast.dismiss(toast$1.id), toast$1.duration);
136
+ return () => clearTimeout(timer);
137
+ }, [
138
+ toast$1.id,
139
+ toast$1.duration,
140
+ paused
141
+ ]);
142
+ const width = open ? size.width : pill;
143
+ const height = open ? size.height : pill;
144
+ const stacked = !expanded && index > 0;
145
+ return /* @__PURE__ */ jsx(motion.li, {
146
+ layout: !reducedMotion,
147
+ className: "pointer-events-none absolute inset-x-0 top-0 flex justify-center",
148
+ style: { zIndex: 10 - index },
149
+ initial: reducedMotion ? false : {
150
+ opacity: 0,
151
+ y: -24,
152
+ scale: .6
153
+ },
154
+ animate: {
155
+ opacity: stacked ? 1 - index * .25 : 1,
156
+ y: stacked ? index * 9 : index * (pill + 14) + index * 6,
157
+ scale: stacked ? 1 - index * .05 : 1
158
+ },
159
+ exit: reducedMotion ? { opacity: 0 } : {
160
+ opacity: 0,
161
+ y: -18,
162
+ scale: .6,
163
+ transition: spring.snappy
164
+ },
165
+ transition: reducedMotion ? { duration: 0 } : spring.bouncy,
166
+ drag: reducedMotion ? false : "y",
167
+ dragConstraints: {
168
+ top: 0,
169
+ bottom: 0
170
+ },
171
+ dragElastic: {
172
+ top: .6,
173
+ bottom: .1
174
+ },
175
+ onDragEnd: (_, info) => {
176
+ if (info.offset.y < -30 || info.velocity.y < -300) toast.dismiss(toast$1.id);
177
+ },
178
+ children: /* @__PURE__ */ jsxs(motion.div, {
179
+ role: "status",
180
+ className: "pointer-events-auto relative",
181
+ initial: {
182
+ width: pill,
183
+ height: pill
184
+ },
185
+ animate: {
186
+ width,
187
+ height
188
+ },
189
+ transition: reducedMotion ? { duration: 0 } : BODY_SPRING,
190
+ children: [/* @__PURE__ */ jsxs("div", {
191
+ "aria-hidden": "true",
192
+ className: "absolute -inset-3",
193
+ style: { filter: reducedMotion ? void 0 : `url(#${filterId})` },
194
+ children: [/* @__PURE__ */ jsx(motion.span, {
195
+ className: "bg-inverse absolute top-3 left-3 rounded-full shadow-xl",
196
+ style: {
197
+ width: pill,
198
+ height: pill
199
+ },
200
+ animate: { scale: open ? 1 : 1.06 },
201
+ transition: reducedMotion ? { duration: 0 } : spring.bouncy
202
+ }), /* @__PURE__ */ jsx(motion.span, {
203
+ className: "bg-inverse absolute top-3 left-3",
204
+ initial: {
205
+ width: pill,
206
+ height: pill,
207
+ borderRadius: pill / 2
208
+ },
209
+ animate: {
210
+ width,
211
+ height,
212
+ borderRadius: Math.min(pill / 2, height / 2, 22)
213
+ },
214
+ transition: reducedMotion ? { duration: 0 } : BODY_SPRING
215
+ })]
216
+ }), /* @__PURE__ */ jsxs(motion.div, {
217
+ ref: content,
218
+ className: contentClasses[toast$1.size],
219
+ style: { minHeight: pill },
220
+ animate: { opacity: open ? 1 : 0 },
221
+ transition: reducedMotion ? { duration: 0 } : {
222
+ duration: open ? .22 : .1,
223
+ delay: open ? .08 : 0
224
+ },
225
+ children: [
226
+ /* @__PURE__ */ jsx(ToneIcon, {
227
+ tone: toast$1.tone,
228
+ size: toast$1.size,
229
+ reducedMotion
230
+ }),
231
+ /* @__PURE__ */ jsxs("div", {
232
+ className: "flex min-w-0 flex-col py-px",
233
+ children: [/* @__PURE__ */ jsx(AnimatePresence, {
234
+ mode: "popLayout",
235
+ initial: false,
236
+ children: /* @__PURE__ */ jsx(motion.span, {
237
+ className: titleClasses[toast$1.size],
238
+ initial: reducedMotion ? false : {
239
+ opacity: 0,
240
+ y: 6,
241
+ filter: "blur(4px)"
242
+ },
243
+ animate: {
244
+ opacity: 1,
245
+ y: 0,
246
+ filter: "blur(0px)"
247
+ },
248
+ exit: reducedMotion ? { opacity: 0 } : {
249
+ opacity: 0,
250
+ y: -6,
251
+ filter: "blur(4px)"
252
+ },
253
+ transition: reducedMotion ? { duration: 0 } : spring.snappy,
254
+ children: toast$1.title
255
+ }, toast$1.title)
256
+ }), toast$1.description && /* @__PURE__ */ jsx("span", {
257
+ className: descriptionClasses[toast$1.size],
258
+ children: toast$1.description
259
+ })]
260
+ }),
261
+ toast$1.action && /* @__PURE__ */ jsx("button", {
262
+ type: "button",
263
+ onClick: () => {
264
+ toast$1.action?.onClick();
265
+ toast.dismiss(toast$1.id);
266
+ },
267
+ className: actionClasses[toast$1.size],
268
+ children: toast$1.action.label
269
+ })
270
+ ]
271
+ })]
272
+ })
273
+ });
274
+ }
275
+ const toneColors = {
276
+ neutral: "bg-transparent",
277
+ success: "bg-success text-white",
278
+ error: "bg-danger text-white",
279
+ loading: "bg-on-inverse/15 text-on-inverse"
280
+ };
281
+ function ToneIcon({ tone, size, reducedMotion }) {
282
+ return /* @__PURE__ */ jsx(AnimatePresence, {
283
+ mode: "popLayout",
284
+ initial: false,
285
+ children: /* @__PURE__ */ jsxs(motion.span, {
286
+ className: cn(toneIconClasses[size], toneColors[tone]),
287
+ initial: reducedMotion ? false : {
288
+ scale: .3,
289
+ opacity: 0,
290
+ rotate: -40
291
+ },
292
+ animate: {
293
+ scale: 1,
294
+ opacity: 1,
295
+ rotate: 0
296
+ },
297
+ exit: {
298
+ scale: .3,
299
+ opacity: 0
300
+ },
301
+ transition: reducedMotion ? { duration: 0 } : spring.bouncy,
302
+ children: [
303
+ tone === "success" && /* @__PURE__ */ jsx(CheckIcon, {
304
+ size: 13,
305
+ strokeWidth: 3
306
+ }),
307
+ tone === "error" && /* @__PURE__ */ jsx(CloseIcon, {
308
+ size: 12,
309
+ strokeWidth: 3
310
+ }),
311
+ tone === "neutral" && /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-[#EE8A2A]" }),
312
+ tone === "loading" && /* @__PURE__ */ jsx(Spinner, { reducedMotion })
313
+ ]
314
+ }, tone)
315
+ });
316
+ }
317
+ function Spinner({ reducedMotion }) {
318
+ return /* @__PURE__ */ jsxs(motion.svg, {
319
+ viewBox: "0 0 20 20",
320
+ className: "size-4",
321
+ animate: reducedMotion ? void 0 : { rotate: 360 },
322
+ transition: {
323
+ repeat: Number.POSITIVE_INFINITY,
324
+ duration: .8,
325
+ ease: "linear"
326
+ },
327
+ "aria-hidden": "true",
328
+ children: [/* @__PURE__ */ jsx("circle", {
329
+ cx: "10",
330
+ cy: "10",
331
+ r: "7",
332
+ fill: "none",
333
+ stroke: "currentColor",
334
+ strokeOpacity: "0.25",
335
+ strokeWidth: "2.4"
336
+ }), /* @__PURE__ */ jsx("path", {
337
+ d: "M10 3a7 7 0 0 1 7 7",
338
+ fill: "none",
339
+ stroke: "currentColor",
340
+ strokeWidth: "2.4",
341
+ strokeLinecap: "round"
342
+ })]
343
+ });
344
+ }
345
+ export { Toaster };
@@ -0,0 +1,2 @@
1
+ import { ContextMenu, ContextMenuTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger } from "./dropdown-menu.js";
2
+ export { ContextMenu, DropdownMenuCheckboxItem as ContextMenuCheckboxItem, DropdownMenuContent as ContextMenuContent, DropdownMenuGroup as ContextMenuGroup, DropdownMenuItem as ContextMenuItem, DropdownMenuLabel as ContextMenuLabel, DropdownMenuRadioGroup as ContextMenuRadioGroup, DropdownMenuRadioItem as ContextMenuRadioItem, DropdownMenuSeparator as ContextMenuSeparator, DropdownMenuShortcut as ContextMenuShortcut, DropdownMenuSub as ContextMenuSub, DropdownMenuSubContent as ContextMenuSubContent, DropdownMenuSubTrigger as ContextMenuSubTrigger, ContextMenuTrigger };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { ContextMenu, DropdownMenuCheckboxItem as ContextMenuCheckboxItem, DropdownMenuContent as ContextMenuContent, DropdownMenuGroup as ContextMenuGroup, DropdownMenuItem as ContextMenuItem, DropdownMenuLabel as ContextMenuLabel, DropdownMenuRadioGroup as ContextMenuRadioGroup, DropdownMenuRadioItem as ContextMenuRadioItem, DropdownMenuSeparator as ContextMenuSeparator, DropdownMenuShortcut as ContextMenuShortcut, DropdownMenuSub as ContextMenuSub, DropdownMenuSubContent as ContextMenuSubContent, DropdownMenuSubTrigger as ContextMenuSubTrigger, ContextMenuTrigger } from "./dropdown-menu.js";
@@ -0,0 +1,48 @@
1
+ import { ReactNode } from "react";
2
+ export type ConversationMessage = {
3
+ id: string;
4
+ body: string;
5
+ /** Written by whoever is looking: drawn on the right. */
6
+ mine: boolean;
7
+ author?: string;
8
+ /** Shown beside the other side's messages, like their avatar. */
9
+ avatar?: ReactNode;
10
+ createdAt: string;
11
+ };
12
+ export type ConversationSize = "sm" | "md" | "lg";
13
+ /**
14
+ * A thread of plain-text messages like Messages on iPhone: a day line when
15
+ * the date changes, back-to-back messages from one side grouped under one
16
+ * name, theirs on the left with an avatar, yours on the right.
17
+ */
18
+ declare function Messages({ messages, locale, size }: {
19
+ messages: ConversationMessage[];
20
+ /** For day names and times; the reader's own by default. */
21
+ locale?: string;
22
+ /** Bubble, avatar, author and time scale. @default "md" */
23
+ size?: ConversationSize;
24
+ }): import("react").JSX.Element;
25
+ type ComposerProps = {
26
+ onSend: (body: string) => Promise<unknown>;
27
+ pending?: boolean;
28
+ maxLength: number;
29
+ placeholder: string;
30
+ /** Extra controls under the field, like a status picker. */
31
+ actions?: ReactNode;
32
+ /** Names the round Send button for screen readers. */
33
+ sendLabel: string;
34
+ /**
35
+ * Words for the characters left, shown near the limit, such as
36
+ * (count) => `${count} left`. Without it, just the number shows.
37
+ */
38
+ remaining?: (count: number) => string;
39
+ /** Surface, textarea, send button and counter scale. @default "md" */
40
+ size?: ConversationSize;
41
+ };
42
+ /** A reply field with a round send button; Ctrl/Cmd+Enter sends, and it clears only once the send worked. */
43
+ declare function Composer({ onSend, pending, maxLength, placeholder, actions, sendLabel, remaining, size }: ComposerProps): import("react").JSX.Element;
44
+ export declare const Conversation: {
45
+ Messages: typeof Messages;
46
+ Composer: typeof Composer;
47
+ };
48
+ export {};
@@ -0,0 +1,202 @@
1
+ import { cx } from "./lib/cx.js";
2
+ import { formatTime } from "./date.js";
3
+ import { Button } from "./button.js";
4
+ import { useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { SendIcon } from "@passui/icons";
7
+ // src/components/conversation.tsx
8
+ const avatarSizes = {
9
+ sm: "size-6",
10
+ md: "size-7",
11
+ lg: "size-8"
12
+ };
13
+ const bubbleClasses = {
14
+ sm: "rounded-3xl px-3 py-1.5 text-footnote leading-snug",
15
+ md: "rounded-4xl px-3.5 py-2 text-subheadline leading-snug",
16
+ lg: "rounded-5xl px-4 py-2.5 text-body leading-snug"
17
+ };
18
+ const bubbleTails = {
19
+ sm: "rounded-br-sm",
20
+ md: "rounded-br-md",
21
+ lg: "rounded-br-lg"
22
+ };
23
+ const bubbleTailsOther = {
24
+ sm: "rounded-bl-sm",
25
+ md: "rounded-bl-md",
26
+ lg: "rounded-bl-lg"
27
+ };
28
+ const authorText = {
29
+ sm: "px-3 text-caption2 text-label-secondary",
30
+ md: "px-3 text-caption2 text-label-secondary",
31
+ lg: "px-3.5 text-caption text-label-secondary"
32
+ };
33
+ const timeText = {
34
+ sm: "px-3 text-caption2 text-label-secondary tabular-nums",
35
+ md: "px-3 text-caption2 text-label-secondary tabular-nums",
36
+ lg: "px-3.5 text-caption text-label-secondary tabular-nums"
37
+ };
38
+ /** Indent that lines a theirs-side timestamp up with its bubble, past the avatar column. */
39
+ const timeIndent = {
40
+ sm: "ms-8",
41
+ md: "ms-9",
42
+ lg: "ms-10"
43
+ };
44
+ const dayMargins = {
45
+ sm: "my-3",
46
+ md: "my-4",
47
+ lg: "my-5"
48
+ };
49
+ const composerSurfaces = {
50
+ sm: "flex items-end gap-2 rounded-[1.25rem] border border-separator bg-elevated p-0.5 pl-3.5 transition-colors focus-within:border-accent-text/60",
51
+ md: "flex items-end gap-2 rounded-3xl border border-separator bg-elevated p-0.5 pl-4 transition-colors focus-within:border-accent-text/60",
52
+ lg: "flex items-end gap-2 rounded-3xl border border-separator bg-elevated p-1 pl-5 transition-colors focus-within:border-accent-text/60"
53
+ };
54
+ const textareaClasses = {
55
+ sm: "field-sizing-content max-h-48 min-h-8 flex-1 resize-none bg-transparent py-[7px] text-footnote text-label outline-none placeholder:text-label-secondary",
56
+ md: "field-sizing-content max-h-48 min-h-9 flex-1 resize-none bg-transparent py-2 text-subheadline text-label outline-none placeholder:text-label-secondary",
57
+ lg: "field-sizing-content max-h-48 min-h-10 flex-1 resize-none bg-transparent py-[9px] text-body text-label outline-none placeholder:text-label-secondary"
58
+ };
59
+ const sendButtonClasses = {
60
+ sm: "size-8! shrink-0",
61
+ md: "size-9! shrink-0",
62
+ lg: "size-10! shrink-0"
63
+ };
64
+ const sendIconSizes = {
65
+ sm: 16,
66
+ md: 18,
67
+ lg: 20
68
+ };
69
+ const counterText = {
70
+ sm: "text-caption2 text-label-secondary tabular-nums",
71
+ md: "text-caption2 text-label-secondary tabular-nums",
72
+ lg: "text-caption text-label-secondary tabular-nums"
73
+ };
74
+ const GROUP_GAP_MS = 3e5;
75
+ function dayLabel(iso, locale) {
76
+ const date = new Date(iso);
77
+ const today = /* @__PURE__ */ new Date();
78
+ const yesterday = /* @__PURE__ */ new Date();
79
+ yesterday.setDate(today.getDate() - 1);
80
+ const offset = date.toDateString() === today.toDateString() ? 0 : date.toDateString() === yesterday.toDateString() ? -1 : null;
81
+ if (offset === null) return date.toLocaleDateString(locale, {
82
+ weekday: "long",
83
+ month: "long",
84
+ day: "numeric"
85
+ });
86
+ const word = new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(offset, "day");
87
+ return word.charAt(0).toLocaleUpperCase(locale) + word.slice(1);
88
+ }
89
+ const clock = (iso, locale) => new Date(iso).toLocaleTimeString(locale, {
90
+ hour: "numeric",
91
+ minute: "2-digit"
92
+ });
93
+ /**
94
+ * A thread of plain-text messages like Messages on iPhone: a day line when
95
+ * the date changes, back-to-back messages from one side grouped under one
96
+ * name, theirs on the left with an avatar, yours on the right.
97
+ */
98
+ function Messages({ messages, locale, size = "md" }) {
99
+ return /* @__PURE__ */ jsx("ol", {
100
+ "data-slot": "conversation-messages",
101
+ "data-not-typeset": true,
102
+ className: "flex flex-col",
103
+ children: messages.map((message, index) => {
104
+ const prev = messages[index - 1];
105
+ const next = messages[index + 1];
106
+ const newDay = !prev || new Date(prev.createdAt).toDateString() !== new Date(message.createdAt).toDateString();
107
+ const startsGroup = newDay || prev.mine !== message.mine || new Date(message.createdAt).getTime() - new Date(prev.createdAt).getTime() > GROUP_GAP_MS;
108
+ const endsGroup = !next || next.mine !== message.mine || new Date(next.createdAt).getTime() - new Date(message.createdAt).getTime() > GROUP_GAP_MS;
109
+ return /* @__PURE__ */ jsxs("li", {
110
+ className: "flex flex-col",
111
+ children: [
112
+ newDay && /* @__PURE__ */ jsx("span", {
113
+ suppressHydrationWarning: true,
114
+ className: cx(dayMargins[size], "text-caption2 text-label-secondary text-center font-medium"),
115
+ children: dayLabel(message.createdAt, locale)
116
+ }),
117
+ /* @__PURE__ */ jsxs("div", {
118
+ className: cx("flex items-end gap-2", message.mine ? "justify-end" : "justify-start", startsGroup ? "mt-3" : "mt-0.5"),
119
+ children: [!message.mine && /* @__PURE__ */ jsx("span", {
120
+ className: cx("flex shrink-0 items-center justify-center", avatarSizes[size]),
121
+ children: endsGroup && message.avatar
122
+ }), /* @__PURE__ */ jsxs("div", {
123
+ className: cx("flex max-w-[78%] flex-col gap-0.5", message.mine ? "items-end" : "items-start"),
124
+ children: [startsGroup && message.author && /* @__PURE__ */ jsx("span", {
125
+ className: authorText[size],
126
+ children: message.author
127
+ }), /* @__PURE__ */ jsx("p", {
128
+ suppressHydrationWarning: true,
129
+ title: formatTime(message.createdAt),
130
+ className: cx(bubbleClasses[size], "wrap-break-word whitespace-pre-wrap", message.mine ? "bg-inverse text-on-inverse" : "bg-fill text-label", endsGroup && (message.mine ? bubbleTails[size] : bubbleTailsOther[size])),
131
+ children: message.body
132
+ })]
133
+ })]
134
+ }),
135
+ endsGroup && /* @__PURE__ */ jsx("time", {
136
+ suppressHydrationWarning: true,
137
+ dateTime: message.createdAt,
138
+ className: cx("mt-1", timeText[size], message.mine ? "self-end" : timeIndent[size]),
139
+ children: clock(message.createdAt, locale)
140
+ })
141
+ ]
142
+ }, message.id);
143
+ })
144
+ });
145
+ }
146
+ /** A reply field with a round send button; Ctrl/Cmd+Enter sends, and it clears only once the send worked. */
147
+ function Composer({ onSend, pending = false, maxLength, placeholder, actions, sendLabel, remaining, size = "md" }) {
148
+ const [body, setBody] = useState("");
149
+ const ready = body.trim().length > 0 && !pending;
150
+ const send = async () => {
151
+ if (!ready) return;
152
+ await onSend(body.trim());
153
+ setBody("");
154
+ };
155
+ return /* @__PURE__ */ jsxs("form", {
156
+ "data-slot": "conversation-composer",
157
+ "data-not-typeset": true,
158
+ className: "flex flex-col gap-2",
159
+ onSubmit: (event) => {
160
+ event.preventDefault();
161
+ send();
162
+ },
163
+ children: [/* @__PURE__ */ jsxs("div", {
164
+ className: composerSurfaces[size],
165
+ children: [/* @__PURE__ */ jsx("textarea", {
166
+ value: body,
167
+ onChange: (event) => setBody(event.target.value),
168
+ onKeyDown: (event) => {
169
+ if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
170
+ event.preventDefault();
171
+ send();
172
+ }
173
+ },
174
+ maxLength,
175
+ placeholder,
176
+ rows: 1,
177
+ className: textareaClasses[size]
178
+ }), /* @__PURE__ */ jsx(Button, {
179
+ type: "submit",
180
+ size: "icon-xs",
181
+ disabled: !ready,
182
+ "aria-label": sendLabel,
183
+ className: cx("active:scale-[0.92]", sendButtonClasses[size]),
184
+ children: /* @__PURE__ */ jsx(SendIcon, {
185
+ size: sendIconSizes[size],
186
+ strokeWidth: 2.5
187
+ })
188
+ })]
189
+ }), /* @__PURE__ */ jsxs("div", {
190
+ className: "flex min-h-6 items-center gap-2 px-1",
191
+ children: [actions, /* @__PURE__ */ jsx("span", {
192
+ className: cx("ml-auto", counterText[size]),
193
+ children: body.length > maxLength * .8 && (remaining?.(maxLength - body.length) ?? maxLength - body.length)
194
+ })]
195
+ })]
196
+ });
197
+ }
198
+ const Conversation = {
199
+ Messages,
200
+ Composer
201
+ };
202
+ export { Conversation };
@@ -0,0 +1,50 @@
1
+ import { DateRange } from "./calendar.js";
2
+ interface Base {
3
+ /** Names the button and the panel for assistive technology. */
4
+ label: string;
5
+ locale: string;
6
+ /** Shown when nothing is chosen. */
7
+ placeholder?: string;
8
+ min?: string;
9
+ max?: string;
10
+ /** Minutes offered in the time columns. Default 5. */
11
+ minuteStep?: number;
12
+ labels: {
13
+ previousMonth: string;
14
+ nextMonth: string;
15
+ hour: string;
16
+ minute: string;
17
+ period: string;
18
+ };
19
+ disabled?: boolean;
20
+ className?: string;
21
+ }
22
+ export type DateTimePickerProps = Base & ({
23
+ mode?: "date";
24
+ value: string;
25
+ onValueChange: (value: string) => void;
26
+ } | {
27
+ mode: "time";
28
+ value: string;
29
+ onValueChange: (value: string) => void;
30
+ } | {
31
+ mode: "datetime";
32
+ /** `YYYY-MM-DDTHH:MM`, or "". */
33
+ value: string;
34
+ onValueChange: (value: string) => void;
35
+ } | {
36
+ mode: "range";
37
+ value: DateRange;
38
+ onValueChange: (value: DateRange) => void;
39
+ });
40
+ /**
41
+ * One picker for dates, times, both together, and ranges, the way Apple's
42
+ * compact DatePicker works: a chip for the date, a chip for the time, each
43
+ * opening its own panel. The date panel is a calendar whose month title opens
44
+ * month and year wheels, so a far date is one flick and not a hundred taps.
45
+ * The time panel is hour, minute and period wheels. Values are plain strings
46
+ * (`YYYY-MM-DD`, `HH:MM`, `YYYY-MM-DDTHH:MM`) or a `{ from, to }` range, so
47
+ * they go straight to a form or an API.
48
+ */
49
+ export declare function DateTimePicker(props: DateTimePickerProps): import("react").JSX.Element;
50
+ export type { DateRange };