@alepha/ui 0.36.0 → 0.37.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 (288) hide show
  1. package/dist/account/$pageAccount.d.ts +1 -1
  2. package/dist/account/$pageAccount.d.ts.map +1 -1
  3. package/dist/account/$pageAccount.js.map +1 -1
  4. package/dist/account/AccountDisplay.d.ts +13 -0
  5. package/dist/account/AccountDisplay.d.ts.map +1 -0
  6. package/dist/account/AccountDisplay.js +48 -0
  7. package/dist/account/AccountDisplay.js.map +1 -0
  8. package/dist/account/AccountProfile.d.ts.map +1 -1
  9. package/dist/account/AccountProfile.js +14 -10
  10. package/dist/account/AccountProfile.js.map +1 -1
  11. package/dist/account/AccountRouter.d.ts +6 -6
  12. package/dist/account/AccountRouter.d.ts.map +1 -1
  13. package/dist/account/index.d.ts +5 -0
  14. package/dist/account/index.d.ts.map +1 -1
  15. package/dist/account/index.js +2 -1
  16. package/dist/admin/$pageAdmin.d.ts +1 -1
  17. package/dist/admin/$pageAdmin.d.ts.map +1 -1
  18. package/dist/admin/$pageAdmin.js.map +1 -1
  19. package/dist/admin/AdminAudits.js.map +1 -1
  20. package/dist/admin/AdminJobDetail.js.map +1 -1
  21. package/dist/admin/AdminJobs.js.map +1 -1
  22. package/dist/admin/AdminNotifications.js.map +1 -1
  23. package/dist/admin/AdminRouter.d.ts +14 -14
  24. package/dist/admin/AdminRouter.d.ts.map +1 -1
  25. package/dist/admin/AdminUserDetail.js.map +1 -1
  26. package/dist/admin/AdminUsers.js.map +1 -1
  27. package/dist/admin/ParameterHistoryItem.js.map +1 -1
  28. package/dist/ai/AiChat.d.ts +26 -39
  29. package/dist/ai/AiChat.d.ts.map +1 -1
  30. package/dist/ai/AiChat.js +65 -123
  31. package/dist/ai/AiChat.js.map +1 -1
  32. package/dist/ai/AiChatDock.d.ts +23 -0
  33. package/dist/ai/AiChatDock.d.ts.map +1 -0
  34. package/dist/ai/AiChatDock.js +90 -0
  35. package/dist/ai/AiChatDock.js.map +1 -0
  36. package/dist/ai/AiChatDockSlot.d.ts +15 -0
  37. package/dist/ai/AiChatDockSlot.d.ts.map +1 -0
  38. package/dist/ai/AiChatDockSlot.js +20 -0
  39. package/dist/ai/AiChatDockSlot.js.map +1 -0
  40. package/dist/ai/AiChatLauncher.d.ts +17 -0
  41. package/dist/ai/AiChatLauncher.d.ts.map +1 -0
  42. package/dist/ai/AiChatLauncher.js +42 -0
  43. package/dist/ai/AiChatLauncher.js.map +1 -0
  44. package/dist/ai/AiChatMessage.d.ts +7 -1
  45. package/dist/ai/AiChatMessage.d.ts.map +1 -1
  46. package/dist/ai/AiChatMessage.js +27 -7
  47. package/dist/ai/AiChatMessage.js.map +1 -1
  48. package/dist/ai/AiChatPanel.d.ts +71 -0
  49. package/dist/ai/AiChatPanel.d.ts.map +1 -0
  50. package/dist/ai/AiChatPanel.js +143 -0
  51. package/dist/ai/AiChatPanel.js.map +1 -0
  52. package/dist/ai/index.d.ts +8 -4
  53. package/dist/ai/index.d.ts.map +1 -1
  54. package/dist/ai/index.js +5 -1
  55. package/dist/ai/useAiChat.d.ts +17 -0
  56. package/dist/ai/useAiChat.d.ts.map +1 -1
  57. package/dist/ai/useAiChat.js +38 -17
  58. package/dist/ai/useAiChat.js.map +1 -1
  59. package/dist/auth/AuthLogin.d.ts +9 -0
  60. package/dist/auth/AuthLogin.d.ts.map +1 -1
  61. package/dist/auth/AuthLogin.js +2 -2
  62. package/dist/auth/AuthLogin.js.map +1 -1
  63. package/dist/auth/AuthRegister.d.ts +4 -1
  64. package/dist/auth/AuthRegister.d.ts.map +1 -1
  65. package/dist/auth/AuthRegister.js +1 -1
  66. package/dist/auth/AuthRegister.js.map +1 -1
  67. package/dist/auth/AuthResetPassword.d.ts +8 -0
  68. package/dist/auth/AuthResetPassword.d.ts.map +1 -1
  69. package/dist/auth/AuthResetPassword.js +2 -2
  70. package/dist/auth/AuthResetPassword.js.map +1 -1
  71. package/dist/auth/AuthRouter.d.ts +4 -4
  72. package/dist/auth/AuthRouter.d.ts.map +1 -1
  73. package/dist/core/Badge.d.ts.map +1 -1
  74. package/dist/core/Badge.js +7 -3
  75. package/dist/core/Badge.js.map +1 -1
  76. package/dist/core/Collapsible.d.ts +50 -0
  77. package/dist/core/Collapsible.d.ts.map +1 -0
  78. package/dist/core/Collapsible.js +70 -0
  79. package/dist/core/Collapsible.js.map +1 -0
  80. package/dist/core/Combobox.d.ts +7 -1
  81. package/dist/core/Combobox.d.ts.map +1 -1
  82. package/dist/core/Combobox.js +2 -2
  83. package/dist/core/Combobox.js.map +1 -1
  84. package/dist/core/PaneRail.d.ts +24 -7
  85. package/dist/core/PaneRail.d.ts.map +1 -1
  86. package/dist/core/PaneRail.js +24 -19
  87. package/dist/core/PaneRail.js.map +1 -1
  88. package/dist/core/Stepper.d.ts +36 -0
  89. package/dist/core/Stepper.d.ts.map +1 -0
  90. package/dist/core/Stepper.js +54 -0
  91. package/dist/core/Stepper.js.map +1 -0
  92. package/dist/core/index.d.ts +2 -0
  93. package/dist/core/index.d.ts.map +1 -1
  94. package/dist/core/index.js +3 -1
  95. package/dist/core/useToast.js +13 -13
  96. package/dist/core/useToast.js.map +1 -1
  97. package/dist/form/AutoForm.d.ts.map +1 -1
  98. package/dist/form/AutoForm.js +29 -0
  99. package/dist/form/AutoForm.js.map +1 -1
  100. package/dist/form/AutoFormErrorPopover.js +13 -3
  101. package/dist/form/AutoFormErrorPopover.js.map +1 -1
  102. package/dist/form/Control.d.ts +14 -1
  103. package/dist/form/Control.d.ts.map +1 -1
  104. package/dist/form/Control.js +12 -2
  105. package/dist/form/Control.js.map +1 -1
  106. package/dist/form/ControlDate.d.ts.map +1 -1
  107. package/dist/form/ControlDate.js +3 -0
  108. package/dist/form/ControlDate.js.map +1 -1
  109. package/dist/form/ControlDateRange.d.ts +12 -1
  110. package/dist/form/ControlDateRange.d.ts.map +1 -1
  111. package/dist/form/ControlDateRange.js +11 -1
  112. package/dist/form/ControlDateRange.js.map +1 -1
  113. package/dist/form/ControlNumber.d.ts.map +1 -1
  114. package/dist/form/ControlNumber.js +2 -0
  115. package/dist/form/ControlNumber.js.map +1 -1
  116. package/dist/form/ControlObject.d.ts.map +1 -1
  117. package/dist/form/ControlObject.js +15 -1
  118. package/dist/form/ControlObject.js.map +1 -1
  119. package/dist/form/ControlPassword.d.ts +4 -0
  120. package/dist/form/ControlPassword.d.ts.map +1 -1
  121. package/dist/form/ControlPassword.js +1 -0
  122. package/dist/form/ControlPassword.js.map +1 -1
  123. package/dist/form/ControlSelect.d.ts +23 -1
  124. package/dist/form/ControlSelect.d.ts.map +1 -1
  125. package/dist/form/ControlSelect.js +5 -0
  126. package/dist/form/ControlSelect.js.map +1 -1
  127. package/dist/form/ControlSelectCombobox.d.ts +11 -1
  128. package/dist/form/ControlSelectCombobox.d.ts.map +1 -1
  129. package/dist/form/ControlSelectCombobox.js +9 -1
  130. package/dist/form/ControlSelectCombobox.js.map +1 -1
  131. package/dist/form/ControlUpload.d.ts.map +1 -1
  132. package/dist/form/ControlUpload.js +1 -0
  133. package/dist/form/ControlUpload.js.map +1 -1
  134. package/dist/form/FormField.d.ts +5 -0
  135. package/dist/form/FormField.d.ts.map +1 -1
  136. package/dist/form/FormField.js +7 -0
  137. package/dist/form/FormField.js.map +1 -1
  138. package/dist/i18n/fr/uiFr.d.ts.map +1 -1
  139. package/dist/i18n/fr/uiFr.js +15 -0
  140. package/dist/i18n/fr/uiFr.js.map +1 -1
  141. package/dist/shell/$pageNav.d.ts +2 -2
  142. package/dist/shell/$pageNav.d.ts.map +1 -1
  143. package/dist/shell/$pageNav.js.map +1 -1
  144. package/dist/shell/AppShell.d.ts +6 -0
  145. package/dist/shell/AppShell.d.ts.map +1 -1
  146. package/dist/shell/AppShell.js +31 -27
  147. package/dist/shell/AppShell.js.map +1 -1
  148. package/dist/shell/ButtonSettings.d.ts +6 -2
  149. package/dist/shell/ButtonSettings.d.ts.map +1 -1
  150. package/dist/shell/ButtonSettings.js +17 -3
  151. package/dist/shell/ButtonSettings.js.map +1 -1
  152. package/dist/shell/ButtonSettingsVisionMenuItem.d.ts +16 -0
  153. package/dist/shell/ButtonSettingsVisionMenuItem.d.ts.map +1 -0
  154. package/dist/shell/ButtonSettingsVisionMenuItem.js +24 -0
  155. package/dist/shell/ButtonSettingsVisionMenuItem.js.map +1 -0
  156. package/dist/shell/ButtonVision.d.ts +28 -0
  157. package/dist/shell/ButtonVision.d.ts.map +1 -0
  158. package/dist/shell/ButtonVision.js +46 -0
  159. package/dist/shell/ButtonVision.js.map +1 -0
  160. package/dist/shell/index.d.ts +6 -3
  161. package/dist/shell/index.d.ts.map +1 -1
  162. package/dist/shell/index.js +2 -1
  163. package/dist/styles.css +57 -0
  164. package/dist/table/DataTable.d.ts.map +1 -1
  165. package/dist/table/DataTable.js +29 -4
  166. package/dist/table/DataTable.js.map +1 -1
  167. package/dist/table/DataTableColumnPicker.d.ts.map +1 -1
  168. package/dist/table/DataTableColumnPicker.js +1 -0
  169. package/dist/table/DataTableColumnPicker.js.map +1 -1
  170. package/dist/table/DataTableFilterBar.d.ts +1 -1
  171. package/dist/table/DataTableFilterBar.d.ts.map +1 -1
  172. package/dist/table/DataTableFilterBar.js +5 -108
  173. package/dist/table/DataTableFilterBar.js.map +1 -1
  174. package/dist/table/DataTableHeaderFilter.d.ts +51 -0
  175. package/dist/table/DataTableHeaderFilter.d.ts.map +1 -0
  176. package/dist/table/DataTableHeaderFilter.js +113 -0
  177. package/dist/table/DataTableHeaderFilter.js.map +1 -0
  178. package/dist/table/DataTableHeaderRow.d.ts +7 -0
  179. package/dist/table/DataTableHeaderRow.d.ts.map +1 -1
  180. package/dist/table/DataTableHeaderRow.js +92 -74
  181. package/dist/table/DataTableHeaderRow.js.map +1 -1
  182. package/dist/table/DataTableTabs.d.ts +42 -0
  183. package/dist/table/DataTableTabs.d.ts.map +1 -0
  184. package/dist/table/DataTableTabs.js +55 -0
  185. package/dist/table/DataTableTabs.js.map +1 -0
  186. package/dist/table/dataTableBaseProps.d.ts +12 -0
  187. package/dist/table/dataTableBaseProps.d.ts.map +1 -1
  188. package/dist/table/dataTablePersistence.d.ts.map +1 -1
  189. package/dist/table/dataTablePersistence.js +4 -2
  190. package/dist/table/dataTablePersistence.js.map +1 -1
  191. package/dist/table/dataTableTypes.d.ts +18 -0
  192. package/dist/table/dataTableTypes.d.ts.map +1 -1
  193. package/dist/table/index.d.ts +5 -2
  194. package/dist/table/index.d.ts.map +1 -1
  195. package/dist/table/index.js +2 -1
  196. package/dist/table/useDataTableColumns.d.ts.map +1 -1
  197. package/dist/table/useDataTableColumns.js +1 -0
  198. package/dist/table/useDataTableColumns.js.map +1 -1
  199. package/dist/table/useDataTableFilterModel.d.ts +110 -0
  200. package/dist/table/useDataTableFilterModel.d.ts.map +1 -0
  201. package/dist/table/useDataTableFilterModel.js +154 -0
  202. package/dist/table/useDataTableFilterModel.js.map +1 -0
  203. package/docs/packages-alepha-ui-account.md +4 -0
  204. package/docs/packages-alepha-ui-ai.md +5 -5
  205. package/docs/packages-alepha-ui-shell.md +4 -3
  206. package/docs/packages-alepha-ui-table.md +4 -2
  207. package/package.json +8 -8
  208. package/src/account/$pageAccount.tsx +5 -4
  209. package/src/account/AccountDisplay.tsx +58 -0
  210. package/src/account/AccountProfile.tsx +30 -42
  211. package/src/account/__tests__/AccountProfile.browser.spec.tsx +141 -0
  212. package/src/account/__tests__/AccountRecoveryCodes.browser.spec.tsx +1 -1
  213. package/src/account/index.ts +5 -0
  214. package/src/admin/$pageAdmin.tsx +5 -4
  215. package/src/admin/AdminAudits.tsx +1 -1
  216. package/src/admin/AdminJobDetail.tsx +1 -1
  217. package/src/admin/AdminJobs.tsx +1 -1
  218. package/src/admin/AdminNotifications.tsx +1 -1
  219. package/src/admin/AdminUserDetail.tsx +1 -1
  220. package/src/admin/AdminUsers.tsx +1 -1
  221. package/src/admin/ParameterHistoryItem.tsx +1 -1
  222. package/src/admin/__tests__/AdminFilesUsageCard.browser.spec.tsx +17 -9
  223. package/src/ai/AiChat.tsx +94 -183
  224. package/src/ai/AiChatDock.tsx +129 -0
  225. package/src/ai/AiChatDockSlot.tsx +23 -0
  226. package/src/ai/AiChatLauncher.tsx +58 -0
  227. package/src/ai/AiChatMessage.tsx +48 -9
  228. package/src/ai/AiChatPanel.tsx +252 -0
  229. package/src/ai/__tests__/AiChat.browser.spec.tsx +197 -5
  230. package/src/ai/index.ts +8 -4
  231. package/src/ai/useAiChat.ts +80 -14
  232. package/src/auth/AuthLogin.tsx +19 -4
  233. package/src/auth/AuthRegister.tsx +6 -3
  234. package/src/auth/AuthResetPassword.tsx +18 -8
  235. package/src/auth/__tests__/AuthCancel.browser.spec.tsx +129 -0
  236. package/src/core/Badge.tsx +7 -3
  237. package/src/core/Collapsible.tsx +95 -0
  238. package/src/core/Combobox.tsx +11 -3
  239. package/src/core/PaneRail.tsx +36 -20
  240. package/src/core/Stepper.tsx +118 -0
  241. package/src/core/__tests__/Badge.browser.spec.tsx +5 -5
  242. package/src/core/__tests__/Collapsible.browser.spec.tsx +88 -0
  243. package/src/core/__tests__/PaneRail.browser.spec.tsx +48 -0
  244. package/src/core/__tests__/Stepper.browser.spec.tsx +39 -0
  245. package/src/core/__tests__/primitiveSlots.spec.ts +7 -0
  246. package/src/core/index.ts +15 -0
  247. package/src/form/AutoForm.tsx +32 -0
  248. package/src/form/AutoFormErrorPopover.tsx +27 -6
  249. package/src/form/Control.tsx +22 -0
  250. package/src/form/ControlDate.tsx +3 -0
  251. package/src/form/ControlDateRange.tsx +87 -58
  252. package/src/form/ControlNumber.tsx +2 -0
  253. package/src/form/ControlObject.tsx +20 -1
  254. package/src/form/ControlPassword.tsx +5 -0
  255. package/src/form/ControlSelect.tsx +32 -1
  256. package/src/form/ControlSelectCombobox.tsx +82 -56
  257. package/src/form/ControlUpload.tsx +1 -0
  258. package/src/form/FormField.tsx +23 -1
  259. package/src/form/__tests__/ControlFieldErrors.browser.spec.tsx +253 -0
  260. package/src/form/__tests__/ControlValidateMode.browser.spec.tsx +217 -0
  261. package/src/form/__tests__/ControlVariantErrors.browser.spec.tsx +133 -0
  262. package/src/i18n/fr/uiFr.ts +19 -1
  263. package/src/markdown/css.d.ts +11 -0
  264. package/src/shell/$pageNav.tsx +6 -4
  265. package/src/shell/AppShell.tsx +7 -0
  266. package/src/shell/ButtonSettings.tsx +20 -5
  267. package/src/shell/ButtonSettingsVisionMenuItem.tsx +40 -0
  268. package/src/shell/ButtonVision.tsx +73 -0
  269. package/src/shell/__tests__/ButtonSettings.browser.spec.tsx +42 -2
  270. package/src/shell/__tests__/ButtonVision.browser.spec.tsx +73 -0
  271. package/src/shell/__tests__/visionTokens.spec.ts +104 -0
  272. package/src/shell/index.ts +6 -3
  273. package/src/styles.css +57 -0
  274. package/src/table/DataTable.tsx +52 -4
  275. package/src/table/DataTableColumnPicker.tsx +3 -0
  276. package/src/table/DataTableFilterBar.tsx +18 -191
  277. package/src/table/DataTableHeaderFilter.tsx +156 -0
  278. package/src/table/DataTableHeaderRow.tsx +78 -40
  279. package/src/table/DataTableTabs.tsx +114 -0
  280. package/src/table/__tests__/DataTableHeaderFilter.browser.spec.tsx +174 -0
  281. package/src/table/__tests__/DataTableStaleColumns.browser.spec.tsx +80 -0
  282. package/src/table/__tests__/DataTableTabs.browser.spec.tsx +72 -0
  283. package/src/table/dataTableBaseProps.ts +12 -0
  284. package/src/table/dataTablePersistence.ts +11 -5
  285. package/src/table/dataTableTypes.ts +18 -0
  286. package/src/table/index.ts +9 -2
  287. package/src/table/useDataTableColumns.ts +1 -0
  288. package/src/table/useDataTableFilterModel.tsx +240 -0
@@ -1 +1 @@
1
- {"version":3,"file":"AuthResetPassword.js","names":[],"sources":["../../src/auth/AuthResetPassword.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { AlephaError, SchemaValidationError, z } from \"alepha\";\nimport type {\n PasswordResetIntentResponse,\n RealmConfig,\n UserController,\n} from \"alepha/api/users\";\nimport { resetPasswordRequestSchema } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useForm, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport { AlertCircle, CheckCircle2, Info } from \"lucide-react\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\n\nimport { Alert, AlertDescription } from \"../core/Alert.tsx\";\nimport { Button } from \"../core/Button.tsx\";\nimport { Card, CardContent } from \"../core/Card.tsx\";\nimport { Label } from \"../core/Label.tsx\";\nimport { Control } from \"../form/Control.tsx\";\nimport { iconFor } from \"../form/iconHint.tsx\";\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from \"../otp/InputOTP.tsx\";\nimport { safeRedirect } from \"./safeRedirect.ts\";\nimport {\n TurnstileWidget,\n type TurnstileWidgetHandle,\n} from \"./TurnstileWidget.tsx\";\n\nexport interface AuthResetPasswordProps {\n /**\n * Realm configuration (controls verification channel and password rules).\n */\n realmConfig: RealmConfig;\n /**\n * Route to the login page, used after a successful reset.\n */\n loginPath?: string;\n /**\n * Custom logo node, rendered above the form. When provided, it replaces\n * the default `settings.logoUrl` <img>. Use this to inject a branded\n * component (e.g. with light/dark variants or an animation).\n */\n logo?: ReactNode;\n}\n\ntype Step = \"email\" | \"code\" | \"password\" | \"success\";\n\ninterface State {\n step: Step;\n intent?: PasswordResetIntentResponse;\n email?: string;\n code?: string;\n}\n\nexport const AuthResetPassword = (props: AuthResetPasswordProps) => {\n const router = useRouter();\n const { tr } = useI18n();\n const userCtrl = useClient<UserController>();\n const [state, setState] = useState<State>({ step: \"email\" });\n const [error, setError] = useState<string | null>(null);\n const [submitting, setSubmitting] = useState(false);\n const [code, setCode] = useState(\"\");\n const redirect = safeRedirect(router.query.redirect);\n\n const settings = props.realmConfig.settings;\n const allowed = settings?.resetPasswordAllowed !== false;\n // Keep BOTH realm and the post-auth redirect on the \"back to sign in\"\n // links so a reset started mid-flow (OIDC continuation) resumes after\n // login. Mirrors auth-login / auth-register.\n const realmBit = props.realmConfig.realmName\n ? `realm=${encodeURIComponent(props.realmConfig.realmName)}`\n : \"\";\n const redirectBit =\n typeof router.query.redirect === \"string\" && router.query.redirect\n ? `redirect=${encodeURIComponent(router.query.redirect)}`\n : \"\";\n const linkQ = [realmBit, redirectBit].filter(Boolean).join(\"&\");\n const realmQuery = linkQ ? `?${linkQ}` : \"\";\n\n /**\n * Captcha, mirroring the registration screen.\n *\n * `createPasswordResetIntent` rejects a request with no token whenever the\n * realm sets `captchaRequired` — it sends mail in our name, so it is gated\n * exactly like registration. Without a widget here the screen could not\n * satisfy that gate at all and every reset answered 400.\n */\n const captchaSiteKey = props.realmConfig.captchaSiteKey;\n const [captchaToken, setCaptchaToken] = useState<string | undefined>();\n const captchaRef = useRef<TurnstileWidgetHandle | null>(null);\n /*\n * The handler reads the token the widget issued last through a ref, so a\n * submit never posts a token captured by an earlier render. Same shape as\n * `AuthRegister.tsx`.\n */\n const captchaTokenRef = useRef<string | undefined>(undefined);\n useEffect(() => {\n captchaTokenRef.current = captchaToken;\n }, [captchaToken]);\n\n /**\n * Turnstile tokens are single-use, and both the first send and every resend\n * hit the same gated endpoint. Drop the spent token and re-arm the widget\n * so the next request carries a fresh one rather than a replay the server\n * will refuse.\n */\n const consumeCaptcha = () => {\n if (!captchaSiteKey) return;\n setCaptchaToken(undefined);\n captchaRef.current?.reset();\n };\n\n const emailForm = useForm({\n schema: resetPasswordRequestSchema,\n // Handled here: every error this form throws is rendered by the page itself,\n // under its field or in the alert above the form. Without an `onError`,\n // a mounted `ActionErrorToaster` toasted the same sentence a second time.\n onError: () => {},\n handler: async (data) => {\n setError(null);\n try {\n const intent = await userCtrl.createPasswordResetIntent({\n query: { userRealmName: props.realmConfig.realmName },\n body: {\n email: data.email,\n captchaToken: captchaSiteKey ? captchaTokenRef.current : undefined,\n },\n });\n setState({ step: \"code\", intent, email: data.email });\n } finally {\n consumeCaptcha();\n }\n },\n });\n\n const passwordForm = useForm(\n {\n schema: z.object({\n password: z.string().min(8),\n confirmPassword: z.string().min(8),\n }),\n // Handled here: every error this form throws is rendered by the page itself,\n // under its field or in the alert above the form. Without an `onError`,\n // a mounted `ActionErrorToaster` toasted the same sentence a second time.\n onError: () => {},\n handler: async (data) => {\n if (data.password !== data.confirmPassword) {\n throw new AlephaError(\n tr(\"auth.reset.passwordsMismatch\", {\n default: \"Passwords do not match\",\n }),\n );\n }\n if (!state.intent || !state.code) {\n throw new AlephaError(\n tr(\"auth.reset.invalidState\", { default: \"Invalid reset state\" }),\n );\n }\n await userCtrl.completePasswordReset({\n body: {\n intentId: state.intent.intentId,\n code: state.code,\n newPassword: data.password,\n },\n });\n setState({ step: \"success\" });\n },\n },\n [state.intent, state.code],\n );\n\n const emailState = useFormState(emailForm, [\"loading\", \"error\"]);\n const passwordState = useFormState(passwordForm, [\"loading\", \"error\"]);\n const emailSubmitting = emailState.loading;\n const passwordSubmitting = passwordState.loading;\n // A handler that throws (mismatched passwords, a wrong code, a refused\n // captcha) lands in the form's error state, not in `error`; reading only\n // `loading` showed nothing at all after a failed submit.\n const submitError = [passwordState.error, emailState.error].find(\n (err) => err && !(err instanceof SchemaValidationError),\n )?.message;\n\n const handleCodeSubmit = () => {\n if (code.length === 6) {\n setState((s) => ({ ...s, step: \"password\", code }));\n }\n };\n\n const handleResend = async () => {\n if (!state.email) return;\n setSubmitting(true);\n setError(null);\n try {\n const intent = await userCtrl.createPasswordResetIntent({\n query: { userRealmName: props.realmConfig.realmName },\n body: {\n email: state.email,\n captchaToken: captchaSiteKey ? captchaTokenRef.current : undefined,\n },\n });\n setState((s) => ({ ...s, intent }));\n } catch (e) {\n setError(\n e instanceof Error\n ? e.message\n : tr(\"auth.reset.resendFailed\", {\n default: \"Failed to resend code\",\n }),\n );\n } finally {\n setSubmitting(false);\n consumeCaptcha();\n }\n };\n\n return (\n <div className=\"flex min-h-svh flex-1 items-center justify-center p-6\">\n <div className=\"flex w-full max-w-sm flex-col items-center gap-4\">\n {props.logo ??\n (settings?.logoUrl ? (\n <img\n src={settings.logoUrl}\n alt={settings.displayName || props.realmConfig.realmName}\n className=\"bg-muted size-16 rounded-xl border object-cover shadow-sm\"\n />\n ) : null)}\n <Card className=\"w-full\">\n <CardContent className=\"flex flex-col gap-4\">\n {(error ?? submitError) && (\n <Alert variant=\"destructive\">\n <AlertCircle className=\"size-4\" />\n <AlertDescription>{error ?? submitError}</AlertDescription>\n </Alert>\n )}\n {!allowed ? (\n <>\n <Alert>\n <AlertCircle className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.reset.disabled\", {\n default:\n \"Password reset is not available. Please contact your administrator.\",\n })}\n </AlertDescription>\n </Alert>\n <Button\n render={\n <a\n href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`}\n />\n }\n >\n {tr(\"auth.reset.backToSignIn\", {\n default: \"Back to sign in\",\n })}\n </Button>\n </>\n ) : state.step === \"email\" ? (\n <form {...emailForm.props} className=\"flex flex-col gap-4\">\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.reset.title\", { default: \"Reset password\" })}\n </h2>\n <p className=\"text-muted-foreground text-sm\">\n {tr(\"auth.reset.emailHint\", {\n default: \"Enter your email address to reset your password\",\n })}\n </p>\n <Control\n label={tr(\"auth.reset.email\", { default: \"Email\" })}\n input={emailForm.input.email}\n icon={iconFor(\"email\")}\n />\n {captchaSiteKey && (\n <TurnstileWidget\n ref={captchaRef}\n siteKey={captchaSiteKey}\n onToken={setCaptchaToken}\n className=\"flex justify-center\"\n />\n )}\n <Button\n type=\"submit\"\n loading={emailSubmitting}\n disabled={!!captchaSiteKey && !captchaToken}\n >\n {tr(\"auth.reset.sendCode\", {\n default: \"Send verification code\",\n })}\n </Button>\n </form>\n ) : state.step === \"code\" ? (\n <div className=\"flex flex-col gap-4\">\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.reset.title\", { default: \"Reset password\" })}\n </h2>\n <Alert>\n <Info className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.reset.codeSent\", {\n default: \"We've sent a verification code to your email.\",\n })}\n </AlertDescription>\n </Alert>\n <div className=\"flex flex-col items-center gap-2\">\n <Label htmlFor=\"code\">\n {tr(\"auth.reset.codeLabel\", {\n default: \"Enter the 6-digit code\",\n })}\n </Label>\n <InputOTP\n id=\"code\"\n maxLength={6}\n\n value={code}\n onChange={(value) => setCode(value.replace(/\\D/g, \"\"))}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n <Button onClick={handleCodeSubmit} disabled={code.length !== 6}>\n {tr(\"auth.reset.continue\", { default: \"Continue\" })}\n </Button>\n {/* Resend calls the same gated endpoint as the first send,\n and the token that got us here is already spent — so this\n step needs its own challenge rather than reusing one. */}\n {captchaSiteKey && (\n <TurnstileWidget\n ref={captchaRef}\n siteKey={captchaSiteKey}\n onToken={setCaptchaToken}\n className=\"flex justify-center\"\n />\n )}\n <Button\n variant=\"minimal\"\n onClick={handleResend}\n loading={submitting}\n disabled={!!captchaSiteKey && !captchaToken}\n >\n {tr(\"auth.reset.resend\", { default: \"Resend code\" })}\n </Button>\n </div>\n ) : state.step === \"password\" ? (\n <form {...passwordForm.props} className=\"flex flex-col gap-4\">\n {/* Hidden identifier so password managers know which saved\n credential the new password belongs to. Without it,\n Safari/Chrome won't offer to update the existing entry. */}\n {state.email && (\n <input\n type=\"text\"\n name=\"username\"\n autoComplete=\"username\"\n value={state.email}\n readOnly\n hidden\n />\n )}\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.reset.title\", { default: \"Reset password\" })}\n </h2>\n <p className=\"text-muted-foreground text-sm\">\n {tr(\"auth.reset.newPasswordHint\", {\n default: \"Create your new password\",\n })}\n </p>\n <Control\n label={tr(\"auth.reset.newPassword\", {\n default: \"New password\",\n })}\n input={passwordForm.input.password}\n password\n autoComplete=\"new-password\"\n />\n <Control\n label={tr(\"auth.reset.confirmPassword\", {\n default: \"Confirm password\",\n })}\n input={passwordForm.input.confirmPassword}\n password\n autoComplete=\"new-password\"\n />\n <Button type=\"submit\" loading={passwordSubmitting}>\n {tr(\"auth.reset.setPassword\", {\n default: \"Set new password\",\n })}\n </Button>\n </form>\n ) : (\n <>\n <Alert>\n <CheckCircle2 className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.reset.success\", {\n default: \"Your password has been reset successfully.\",\n })}\n </AlertDescription>\n </Alert>\n <Button\n render={\n <a\n href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`}\n />\n }\n >\n {tr(\"auth.reset.backToSignIn\", {\n default: \"Back to sign in\",\n })}\n </Button>\n </>\n )}\n </CardContent>\n </Card>\n <Button\n variant=\"minimal\"\n nativeButton={false}\n render={<a href={redirect} />}\n >\n {tr(\"auth.reset.cancel\", { default: \"Cancel\" })}\n </Button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyDA,MAAa,qBAAqB,UAAkC;CAClE,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,WAAW,UAA0B;CAC3C,MAAM,CAAC,OAAO,YAAY,SAAgB,EAAE,MAAM,QAAQ,CAAC;CAC3D,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CACnC,MAAM,WAAW,aAAa,OAAO,MAAM,QAAQ;CAEnD,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,UAAU,UAAU,yBAAyB;CAWnD,MAAM,QAAQ,CAPG,MAAM,YAAY,YAC/B,SAAS,mBAAmB,MAAM,YAAY,SAAS,MACvD,IAEF,OAAO,OAAO,MAAM,aAAa,YAAY,OAAO,MAAM,WACtD,YAAY,mBAAmB,OAAO,MAAM,QAAQ,MACpD,EAC8B,CAAC,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C,QAAD;KACE,SAAQ;KACR,cAAc;KACd,QAAQ,oBAAC,KAAD,EAAG,MAAM,SAAW,CAAA;KAE3B,UAAA,GAAG,qBAAqB,EAAE,SAAS,SAAS,CAAC;IACxC,CAAA;GACL;;CACF,CAAA;AAET"}
1
+ {"version":3,"file":"AuthResetPassword.js","names":[],"sources":["../../src/auth/AuthResetPassword.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { AlephaError, SchemaValidationError, z } from \"alepha\";\nimport type {\n PasswordResetIntentResponse,\n RealmConfig,\n UserController,\n} from \"alepha/api/users\";\nimport { resetPasswordRequestSchema } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useForm, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport { AlertCircle, CheckCircle2, Info } from \"lucide-react\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\n\nimport { Alert, AlertDescription } from \"../core/Alert.tsx\";\nimport { Button } from \"../core/Button.tsx\";\nimport { Card, CardContent } from \"../core/Card.tsx\";\nimport { Label } from \"../core/Label.tsx\";\nimport { Control } from \"../form/Control.tsx\";\nimport { iconFor } from \"../form/iconHint.tsx\";\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from \"../otp/InputOTP.tsx\";\nimport { safeRedirect } from \"./safeRedirect.ts\";\nimport {\n TurnstileWidget,\n type TurnstileWidgetHandle,\n} from \"./TurnstileWidget.tsx\";\n\nexport interface AuthResetPasswordProps {\n /**\n * Realm configuration (controls verification channel and password rules).\n */\n realmConfig: RealmConfig;\n /**\n * Route to the login page, used after a successful reset.\n */\n loginPath?: string;\n /**\n * Custom logo node, rendered above the form. When provided, it replaces\n * the default `settings.logoUrl` <img>. Use this to inject a branded\n * component (e.g. with light/dark variants or an animation).\n */\n logo?: ReactNode;\n /**\n * Where the \"Cancel\" link under the form leads. Defaults to the\n * `?redirect=` target of the URL, else \"/\".\n *\n * Pass `false` to hide the link, for an application where every page\n * needs an account: there the default only leads back to sign-in.\n */\n cancelPath?: string | false;\n}\n\ntype Step = \"email\" | \"code\" | \"password\" | \"success\";\n\ninterface State {\n step: Step;\n intent?: PasswordResetIntentResponse;\n email?: string;\n code?: string;\n}\n\nexport const AuthResetPassword = (props: AuthResetPasswordProps) => {\n const router = useRouter<any>();\n const { tr } = useI18n();\n const userCtrl = useClient<UserController>();\n const [state, setState] = useState<State>({ step: \"email\" });\n const [error, setError] = useState<string | null>(null);\n const [submitting, setSubmitting] = useState(false);\n const [code, setCode] = useState(\"\");\n const redirect = safeRedirect(router.query.redirect);\n\n const settings = props.realmConfig.settings;\n const allowed = settings?.resetPasswordAllowed !== false;\n // Keep BOTH realm and the post-auth redirect on the \"back to sign in\"\n // links so a reset started mid-flow (OIDC continuation) resumes after\n // login. Mirrors auth-login / auth-register.\n const realmBit = props.realmConfig.realmName\n ? `realm=${encodeURIComponent(props.realmConfig.realmName)}`\n : \"\";\n const redirectBit =\n typeof router.query.redirect === \"string\" && router.query.redirect\n ? `redirect=${encodeURIComponent(router.query.redirect)}`\n : \"\";\n const linkQ = [realmBit, redirectBit].filter(Boolean).join(\"&\");\n const realmQuery = linkQ ? `?${linkQ}` : \"\";\n\n /**\n * Captcha, mirroring the registration screen.\n *\n * `createPasswordResetIntent` rejects a request with no token whenever the\n * realm sets `captchaRequired` — it sends mail in our name, so it is gated\n * exactly like registration. Without a widget here the screen could not\n * satisfy that gate at all and every reset answered 400.\n */\n const captchaSiteKey = props.realmConfig.captchaSiteKey;\n const [captchaToken, setCaptchaToken] = useState<string | undefined>();\n const captchaRef = useRef<TurnstileWidgetHandle | null>(null);\n /*\n * The handler reads the token the widget issued last through a ref, so a\n * submit never posts a token captured by an earlier render. Same shape as\n * `AuthRegister.tsx`.\n */\n const captchaTokenRef = useRef<string | undefined>(undefined);\n useEffect(() => {\n captchaTokenRef.current = captchaToken;\n }, [captchaToken]);\n\n /**\n * Turnstile tokens are single-use, and both the first send and every resend\n * hit the same gated endpoint. Drop the spent token and re-arm the widget\n * so the next request carries a fresh one rather than a replay the server\n * will refuse.\n */\n const consumeCaptcha = () => {\n if (!captchaSiteKey) return;\n setCaptchaToken(undefined);\n captchaRef.current?.reset();\n };\n\n const emailForm = useForm({\n schema: resetPasswordRequestSchema,\n // Handled here: every error this form throws is rendered by the page itself,\n // under its field or in the alert above the form. Without an `onError`,\n // a mounted `ActionErrorToaster` toasted the same sentence a second time.\n onError: () => {},\n handler: async (data) => {\n setError(null);\n try {\n const intent = await userCtrl.createPasswordResetIntent({\n query: { userRealmName: props.realmConfig.realmName },\n body: {\n email: data.email,\n captchaToken: captchaSiteKey ? captchaTokenRef.current : undefined,\n },\n });\n setState({ step: \"code\", intent, email: data.email });\n } finally {\n consumeCaptcha();\n }\n },\n });\n\n const passwordForm = useForm(\n {\n schema: z.object({\n password: z.string().min(8),\n confirmPassword: z.string().min(8),\n }),\n // Handled here: every error this form throws is rendered by the page itself,\n // under its field or in the alert above the form. Without an `onError`,\n // a mounted `ActionErrorToaster` toasted the same sentence a second time.\n onError: () => {},\n handler: async (data) => {\n if (data.password !== data.confirmPassword) {\n throw new AlephaError(\n tr(\"auth.reset.passwordsMismatch\", {\n default: \"Passwords do not match\",\n }),\n );\n }\n if (!state.intent || !state.code) {\n throw new AlephaError(\n tr(\"auth.reset.invalidState\", { default: \"Invalid reset state\" }),\n );\n }\n await userCtrl.completePasswordReset({\n body: {\n intentId: state.intent.intentId,\n code: state.code,\n newPassword: data.password,\n },\n });\n setState({ step: \"success\" });\n },\n },\n [state.intent, state.code],\n );\n\n const emailState = useFormState(emailForm, [\"loading\", \"error\"]);\n const passwordState = useFormState(passwordForm, [\"loading\", \"error\"]);\n const emailSubmitting = emailState.loading;\n const passwordSubmitting = passwordState.loading;\n // A handler that throws (mismatched passwords, a wrong code, a refused\n // captcha) lands in the form's error state, not in `error`; reading only\n // `loading` showed nothing at all after a failed submit.\n const submitError = [passwordState.error, emailState.error].find(\n (err) => err && !(err instanceof SchemaValidationError),\n )?.message;\n\n const handleCodeSubmit = () => {\n if (code.length === 6) {\n setState((s) => ({ ...s, step: \"password\", code }));\n }\n };\n\n const handleResend = async () => {\n if (!state.email) return;\n setSubmitting(true);\n setError(null);\n try {\n const intent = await userCtrl.createPasswordResetIntent({\n query: { userRealmName: props.realmConfig.realmName },\n body: {\n email: state.email,\n captchaToken: captchaSiteKey ? captchaTokenRef.current : undefined,\n },\n });\n setState((s) => ({ ...s, intent }));\n } catch (e) {\n setError(\n e instanceof Error\n ? e.message\n : tr(\"auth.reset.resendFailed\", {\n default: \"Failed to resend code\",\n }),\n );\n } finally {\n setSubmitting(false);\n consumeCaptcha();\n }\n };\n\n return (\n <div className=\"flex min-h-svh flex-1 items-center justify-center p-6\">\n <div className=\"flex w-full max-w-sm flex-col items-center gap-4\">\n {props.logo ??\n (settings?.logoUrl ? (\n <img\n src={settings.logoUrl}\n alt={settings.displayName || props.realmConfig.realmName}\n className=\"bg-muted size-16 rounded-xl border object-cover shadow-sm\"\n />\n ) : null)}\n <Card className=\"w-full\">\n <CardContent className=\"flex flex-col gap-4\">\n {(error ?? submitError) && (\n <Alert variant=\"destructive\">\n <AlertCircle className=\"size-4\" />\n <AlertDescription>{error ?? submitError}</AlertDescription>\n </Alert>\n )}\n {!allowed ? (\n <>\n <Alert>\n <AlertCircle className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.reset.disabled\", {\n default:\n \"Password reset is not available. Please contact your administrator.\",\n })}\n </AlertDescription>\n </Alert>\n <Button\n render={\n <a\n href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`}\n />\n }\n >\n {tr(\"auth.reset.backToSignIn\", {\n default: \"Back to sign in\",\n })}\n </Button>\n </>\n ) : state.step === \"email\" ? (\n <form {...emailForm.props} className=\"flex flex-col gap-4\">\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.reset.title\", { default: \"Reset password\" })}\n </h2>\n <p className=\"text-muted-foreground text-sm\">\n {tr(\"auth.reset.emailHint\", {\n default: \"Enter your email address to reset your password\",\n })}\n </p>\n <Control\n label={tr(\"auth.reset.email\", { default: \"Email\" })}\n input={emailForm.input.email}\n icon={iconFor(\"email\")}\n />\n {captchaSiteKey && (\n <TurnstileWidget\n ref={captchaRef}\n siteKey={captchaSiteKey}\n onToken={setCaptchaToken}\n className=\"flex justify-center\"\n />\n )}\n <Button\n type=\"submit\"\n loading={emailSubmitting}\n disabled={!!captchaSiteKey && !captchaToken}\n >\n {tr(\"auth.reset.sendCode\", {\n default: \"Send verification code\",\n })}\n </Button>\n </form>\n ) : state.step === \"code\" ? (\n <div className=\"flex flex-col gap-4\">\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.reset.title\", { default: \"Reset password\" })}\n </h2>\n <Alert>\n <Info className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.reset.codeSent\", {\n default: \"We've sent a verification code to your email.\",\n })}\n </AlertDescription>\n </Alert>\n <div className=\"flex flex-col items-center gap-2\">\n <Label htmlFor=\"code\">\n {tr(\"auth.reset.codeLabel\", {\n default: \"Enter the 6-digit code\",\n })}\n </Label>\n <InputOTP\n id=\"code\"\n maxLength={6}\n\n value={code}\n onChange={(value) => setCode(value.replace(/\\D/g, \"\"))}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n <Button onClick={handleCodeSubmit} disabled={code.length !== 6}>\n {tr(\"auth.reset.continue\", { default: \"Continue\" })}\n </Button>\n {/* Resend calls the same gated endpoint as the first send,\n and the token that got us here is already spent — so this\n step needs its own challenge rather than reusing one. */}\n {captchaSiteKey && (\n <TurnstileWidget\n ref={captchaRef}\n siteKey={captchaSiteKey}\n onToken={setCaptchaToken}\n className=\"flex justify-center\"\n />\n )}\n <Button\n variant=\"minimal\"\n onClick={handleResend}\n loading={submitting}\n disabled={!!captchaSiteKey && !captchaToken}\n >\n {tr(\"auth.reset.resend\", { default: \"Resend code\" })}\n </Button>\n </div>\n ) : state.step === \"password\" ? (\n <form {...passwordForm.props} className=\"flex flex-col gap-4\">\n {/* Hidden identifier so password managers know which saved\n credential the new password belongs to. Without it,\n Safari/Chrome won't offer to update the existing entry. */}\n {state.email && (\n <input\n type=\"text\"\n name=\"username\"\n autoComplete=\"username\"\n value={state.email}\n readOnly\n hidden\n />\n )}\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.reset.title\", { default: \"Reset password\" })}\n </h2>\n <p className=\"text-muted-foreground text-sm\">\n {tr(\"auth.reset.newPasswordHint\", {\n default: \"Create your new password\",\n })}\n </p>\n <Control\n label={tr(\"auth.reset.newPassword\", {\n default: \"New password\",\n })}\n input={passwordForm.input.password}\n password\n autoComplete=\"new-password\"\n />\n <Control\n label={tr(\"auth.reset.confirmPassword\", {\n default: \"Confirm password\",\n })}\n input={passwordForm.input.confirmPassword}\n password\n autoComplete=\"new-password\"\n />\n <Button type=\"submit\" loading={passwordSubmitting}>\n {tr(\"auth.reset.setPassword\", {\n default: \"Set new password\",\n })}\n </Button>\n </form>\n ) : (\n <>\n <Alert>\n <CheckCircle2 className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.reset.success\", {\n default: \"Your password has been reset successfully.\",\n })}\n </AlertDescription>\n </Alert>\n <Button\n render={\n <a\n href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`}\n />\n }\n >\n {tr(\"auth.reset.backToSignIn\", {\n default: \"Back to sign in\",\n })}\n </Button>\n </>\n )}\n </CardContent>\n </Card>\n {props.cancelPath !== false && (\n <Button\n variant=\"minimal\"\n nativeButton={false}\n render={<a href={props.cancelPath ?? redirect} />}\n >\n {tr(\"auth.reset.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiEA,MAAa,qBAAqB,UAAkC;C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O,aAAa,MAAM;SAC1B,UAAA;SACA,cAAa;QACd,CAAA;QACD,oBAAC,QAAD;SAAQ,MAAK;SAAS,SAAS;SAC5B,UAAA,GAAG,0BAA0B,EAC5B,SAAS,mBACX,CAAC;QACK,CAAA;OACJ;MAEN,CAAA,IAAA,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,cAAD,EAAc,WAAU,SAAU,CAAA,GAClC,oBAAC,kBAAD,EAAA,UACG,GAAG,sBAAsB,EACxB,SAAS,6CACX,CAAC,EACe,CAAA,CACb,EAAA,CAAA,GACP,oBAAC,QAAD;OACE,QACE,oBAAC,KAAD,EACE,MAAM,GAAG,MAAM,aAAa,gBAAgB,aAC7C,CAAA;OAGF,UAAA,GAAG,2BAA2B,EAC7B,SAAS,kBACX,CAAC;MACK,CAAA,CACR,EAAA,CAAA,CAEO;;IACT,CAAA;IACL,MAAM,eAAe,SACpB,oBAAC,QAAD;KACE,SAAQ;KACR,cAAc;KACd,QAAQ,oBAAC,KAAD,EAAG,MAAM,MAAM,cAAc,SAAW,CAAA;KAE/C,UAAA,GAAG,qBAAqB,EAAE,SAAS,SAAS,CAAC;IACxC,CAAA;GAEP;;CACF,CAAA;AAET"}
@@ -157,7 +157,7 @@ export declare class AuthRouter {
157
157
  }[];
158
158
  captchaSiteKey?: string | undefined;
159
159
  };
160
- }, import("alepha/react/router").TPropsParentDefault>;
160
+ }, import("alepha/react/router").TPropsParentDefault, "login">;
161
161
  register: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, {
162
162
  realmConfig: {
163
163
  settings: {
@@ -206,7 +206,7 @@ export declare class AuthRouter {
206
206
  }[];
207
207
  captchaSiteKey?: string | undefined;
208
208
  };
209
- }, import("alepha/react/router").TPropsParentDefault>;
209
+ }, import("alepha/react/router").TPropsParentDefault, "register">;
210
210
  resetPassword: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, {
211
211
  realmConfig: {
212
212
  settings: {
@@ -255,11 +255,11 @@ export declare class AuthRouter {
255
255
  }[];
256
256
  captchaSiteKey?: string | undefined;
257
257
  };
258
- }, import("alepha/react/router").TPropsParentDefault>;
258
+ }, import("alepha/react/router").TPropsParentDefault, "resetPassword">;
259
259
  /**
260
260
  * Reached from a link in an email, so it takes its `email` and `token` from the
261
261
  * query string rather than from any state the browser already holds.
262
262
  */
263
- verifyEmail: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, any, import("alepha/react/router").TPropsParentDefault>;
263
+ verifyEmail: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, any, import("alepha/react/router").TPropsParentDefault, "verifyEmail">;
264
264
  }
265
265
  //# sourceMappingURL=AuthRouter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthRouter.d.ts","sourceRoot":"","sources":["../../src/auth/AuthRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBAAa,UAAU;IACrB,SAAS,CAAC,QAAQ,CAAC,QAAQ,mEAA8B;IAEzD;;;OAGG;IACH,SAAS,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAEhB;IAEH;;;;OAIG;IACH,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAYF;IAEH,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAYL;IAEH,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAWV;IAEH;;;OAGG;IACH,WAAW,sJAKR;CACJ"}
1
+ {"version":3,"file":"AuthRouter.d.ts","sourceRoot":"","sources":["../../src/auth/AuthRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBAAa,UAAU;IACrB,SAAS,CAAC,QAAQ,CAAC,QAAQ,mEAA8B;IAEzD;;;OAGG;IACH,SAAS,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAEhB;IAEH;;;;OAIG;IACH,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEAYF;IAEH,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEAYL;IAEH,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAWV;IAEH;;;OAGG;IACH,WAAW,qKAKR;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/core/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;;8EAmFlB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,GACvD,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAErC,QAAA,MAAM,KAAK,UAAW,UAAU,+FAiB/B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/core/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;;8EAuFlB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,GACvD,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAErC,QAAA,MAAM,KAAK,UAAW,UAAU,+FAiB/B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
@@ -41,6 +41,10 @@ const badgeVariants = cva("group/badge focus-visible:border-ring focus-visible:r
41
41
  * would fight them: before this was enforced, a `default` badge given a
42
42
  * tone lost its primary fill to the tone's wash, since tailwind-merge
43
43
  * keeps the last `bg-*`.
44
+ *
45
+ * success, warning and danger paint from the signal tokens, not fixed
46
+ * Tailwind hues, so colour-blind mode (`:root.cvd`) repaints them.
47
+ * info stays blue: blue is already safe under every common deficiency.
44
48
  */
45
49
  tone: {
46
50
  neutral: "",
@@ -64,17 +68,17 @@ const badgeVariants = cva("group/badge focus-visible:border-ring focus-visible:r
64
68
  {
65
69
  variant: "tint",
66
70
  tone: "success",
67
- class: "border-emerald-500/40 bg-emerald-500/15"
71
+ class: "border-success/40 bg-success/15"
68
72
  },
69
73
  {
70
74
  variant: "tint",
71
75
  tone: "warning",
72
- class: "border-amber-500/40 bg-amber-500/15"
76
+ class: "border-warning/40 bg-warning/15"
73
77
  },
74
78
  {
75
79
  variant: "tint",
76
80
  tone: "danger",
77
- class: "border-red-500/40 bg-red-500/15"
81
+ class: "border-danger/40 bg-danger/15"
78
82
  }
79
83
  ],
80
84
  defaultVariants: { variant: "default" }
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":[],"sources":["../../src/core/Badge.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils.ts\";\n\nconst badgeVariants = cva(\n \"group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-danger aria-invalid:ring-danger/20 dark:aria-invalid:ring-danger/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n secondary:\n \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n destructive:\n \"bg-danger/10 text-danger-text focus-visible:ring-danger/20 dark:bg-danger/20 dark:focus-visible:ring-danger/40 [a]:hover:bg-danger/20\",\n outline:\n \"border-border text-foreground [a]:hover:bg-hover [a]:hover:text-muted-foreground\",\n /**\n * Status chip: the label and the icon stay body text, and the only\n * coloured parts are a near-transparent fill and its border.\n *\n * The caller supplies the hue, because a status palette belongs to\n * the app rather than to the design system:\n * `<Badge variant=\"tint\" className=\"border-blue-500/40 bg-blue-500/15\">`.\n *\n * Distinct from `destructive`, which tints the TEXT as well. That\n * reads as an alarm, which is right for an error and wrong for a\n * neutral fact like \"In progress\": at chip size, coloured text on a\n * coloured ground is also the pairing that fails contrast first.\n */\n tint: \"text-foreground border\",\n ghost: \"hover:bg-hover hover:text-muted-foreground dark:hover:bg-hover\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n /**\n * The hue of a `tint` badge: a near-transparent fill and a matching\n * border, with the label left as body text.\n *\n * Semantic names rather than colours, so a consumer states what a\n * status MEANS and the system decides how that looks. Lore maps its\n * quest statuses and priorities onto these; anything else mapping the\n * same meanings lands on the same chip without restating the hex.\n *\n * Applied only with `variant=\"tint\"`, through `compoundVariants`\n * below. The other variants paint their own background, and a tone\n * would fight them: before this was enforced, a `default` badge given a\n * tone lost its primary fill to the tone's wash, since tailwind-merge\n * keeps the last `bg-*`.\n */\n tone: {\n neutral: \"\",\n info: \"\",\n success: \"\",\n warning: \"\",\n danger: \"\",\n },\n },\n compoundVariants: [\n {\n variant: \"tint\",\n tone: \"neutral\",\n class: \"border-border bg-muted text-muted-foreground\",\n },\n {\n variant: \"tint\",\n tone: \"info\",\n class: \"border-blue-500/40 bg-blue-500/15\",\n },\n {\n variant: \"tint\",\n tone: \"success\",\n class: \"border-emerald-500/40 bg-emerald-500/15\",\n },\n {\n variant: \"tint\",\n tone: \"warning\",\n class: \"border-amber-500/40 bg-amber-500/15\",\n },\n {\n variant: \"tint\",\n tone: \"danger\",\n class: \"border-red-500/40 bg-red-500/15\",\n },\n ],\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport type BadgeProps = useRender.ComponentProps<\"span\"> &\n VariantProps<typeof badgeVariants>;\n\nconst Badge = (props: BadgeProps) => {\n const { className, variant = \"default\", tone, render, ...rest } = props;\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(\n {\n className: cn(badgeVariants({ variant, tone }), className),\n },\n rest,\n ),\n render,\n state: {\n slot: \"badge\",\n variant,\n tone,\n },\n });\n};\n\n/**\n * The semantic hues a `tint` badge can wear.\n *\n * Exported because consumers map their own vocabulary onto it (Lore points\n * quest priorities, quest statuses and epic statuses at these names) and\n * every one of those maps needs a type for its record. Derived from the\n * variant rather than retyped, so adding a tone below cannot leave a\n * consumer's map silently incomplete.\n */\nexport type BadgeTone = NonNullable<VariantProps<typeof badgeVariants>[\"tone\"]>;\n\nexport { Badge, badgeVariants };\n"],"mappings":";;;;;AAMA,MAAM,gBAAgB,IACpB,+dACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,WACE;GACF,aACE;GACF,SACE;;;;;;;;;;;;;;GAcF,MAAM;GACN,OAAO;GACP,MAAM;EACR;;;;;;;;;;;;;;;;EAgBA,MAAM;GACJ,SAAS;GACT,MAAM;GACN,SAAS;GACT,SAAS;GACT,QAAQ;EACV;CACF;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;AAKA,MAAM,SAAS,UAAsB;CACnC,MAAM,EAAE,WAAW,UAAU,WAAW,MAAM,QAAQ,GAAG,SAAS;CAClE,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GAAG,cAAc;GAAE;GAAS;EAAK,CAAC,GAAG,SAAS,EAC3D,GACA,IACF;EACA;EACA,OAAO;GACL,MAAM;GACN;GACA;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"Badge.js","names":[],"sources":["../../src/core/Badge.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils.ts\";\n\nconst badgeVariants = cva(\n \"group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-danger aria-invalid:ring-danger/20 dark:aria-invalid:ring-danger/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n secondary:\n \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n destructive:\n \"bg-danger/10 text-danger-text focus-visible:ring-danger/20 dark:bg-danger/20 dark:focus-visible:ring-danger/40 [a]:hover:bg-danger/20\",\n outline:\n \"border-border text-foreground [a]:hover:bg-hover [a]:hover:text-muted-foreground\",\n /**\n * Status chip: the label and the icon stay body text, and the only\n * coloured parts are a near-transparent fill and its border.\n *\n * The caller supplies the hue, because a status palette belongs to\n * the app rather than to the design system:\n * `<Badge variant=\"tint\" className=\"border-blue-500/40 bg-blue-500/15\">`.\n *\n * Distinct from `destructive`, which tints the TEXT as well. That\n * reads as an alarm, which is right for an error and wrong for a\n * neutral fact like \"In progress\": at chip size, coloured text on a\n * coloured ground is also the pairing that fails contrast first.\n */\n tint: \"text-foreground border\",\n ghost: \"hover:bg-hover hover:text-muted-foreground dark:hover:bg-hover\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n /**\n * The hue of a `tint` badge: a near-transparent fill and a matching\n * border, with the label left as body text.\n *\n * Semantic names rather than colours, so a consumer states what a\n * status MEANS and the system decides how that looks. Lore maps its\n * quest statuses and priorities onto these; anything else mapping the\n * same meanings lands on the same chip without restating the hex.\n *\n * Applied only with `variant=\"tint\"`, through `compoundVariants`\n * below. The other variants paint their own background, and a tone\n * would fight them: before this was enforced, a `default` badge given a\n * tone lost its primary fill to the tone's wash, since tailwind-merge\n * keeps the last `bg-*`.\n *\n * success, warning and danger paint from the signal tokens, not fixed\n * Tailwind hues, so colour-blind mode (`:root.cvd`) repaints them.\n * info stays blue: blue is already safe under every common deficiency.\n */\n tone: {\n neutral: \"\",\n info: \"\",\n success: \"\",\n warning: \"\",\n danger: \"\",\n },\n },\n compoundVariants: [\n {\n variant: \"tint\",\n tone: \"neutral\",\n class: \"border-border bg-muted text-muted-foreground\",\n },\n {\n variant: \"tint\",\n tone: \"info\",\n class: \"border-blue-500/40 bg-blue-500/15\",\n },\n {\n variant: \"tint\",\n tone: \"success\",\n class: \"border-success/40 bg-success/15\",\n },\n {\n variant: \"tint\",\n tone: \"warning\",\n class: \"border-warning/40 bg-warning/15\",\n },\n {\n variant: \"tint\",\n tone: \"danger\",\n class: \"border-danger/40 bg-danger/15\",\n },\n ],\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport type BadgeProps = useRender.ComponentProps<\"span\"> &\n VariantProps<typeof badgeVariants>;\n\nconst Badge = (props: BadgeProps) => {\n const { className, variant = \"default\", tone, render, ...rest } = props;\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(\n {\n className: cn(badgeVariants({ variant, tone }), className),\n },\n rest,\n ),\n render,\n state: {\n slot: \"badge\",\n variant,\n tone,\n },\n });\n};\n\n/**\n * The semantic hues a `tint` badge can wear.\n *\n * Exported because consumers map their own vocabulary onto it (Lore points\n * quest priorities, quest statuses and epic statuses at these names) and\n * every one of those maps needs a type for its record. Derived from the\n * variant rather than retyped, so adding a tone below cannot leave a\n * consumer's map silently incomplete.\n */\nexport type BadgeTone = NonNullable<VariantProps<typeof badgeVariants>[\"tone\"]>;\n\nexport { Badge, badgeVariants };\n"],"mappings":";;;;;AAMA,MAAM,gBAAgB,IACpB,+dACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,WACE;GACF,aACE;GACF,SACE;;;;;;;;;;;;;;GAcF,MAAM;GACN,OAAO;GACP,MAAM;EACR;;;;;;;;;;;;;;;;;;;;EAoBA,MAAM;GACJ,SAAS;GACT,MAAM;GACN,SAAS;GACT,SAAS;GACT,QAAQ;EACV;CACF;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;AAKA,MAAM,SAAS,UAAsB;CACnC,MAAM,EAAE,WAAW,UAAU,WAAW,MAAM,QAAQ,GAAG,SAAS;CAClE,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GAAG,cAAc;GAAE;GAAS;EAAK,CAAC,GAAG,SAAS,EAC3D,GACA,IACF;EACA;EACA,OAAO;GACL,MAAM;GACN;GACA;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,50 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
2
+ export type CollapsibleProps = CollapsiblePrimitive.Root.Props;
3
+ /**
4
+ * A disclosure: a trigger that opens and closes a panel, its height
5
+ * animated. Uncontrolled with `defaultOpen`, controlled with `open` and
6
+ * `onOpenChange`.
7
+ *
8
+ * ```tsx
9
+ * <Collapsible>
10
+ * <CollapsibleTrigger chevron>Advanced options</CollapsibleTrigger>
11
+ * <CollapsiblePanel>...</CollapsiblePanel>
12
+ * </Collapsible>
13
+ * ```
14
+ *
15
+ * The root and the panel carry `data-open` or `data-closed`, and the trigger
16
+ * `data-panel-open` while the panel is open, for the caller's own styles.
17
+ */
18
+ declare const Collapsible: (props: CollapsibleProps) => import("react").JSX.Element;
19
+ export interface CollapsibleTriggerProps extends CollapsiblePrimitive.Trigger.Props {
20
+ /**
21
+ * Draw a chevron after the children, pointing down while closed and up
22
+ * while open. Defaults to `false`.
23
+ */
24
+ chevron?: boolean;
25
+ }
26
+ /**
27
+ * The button that opens and closes the panel. It carries `aria-expanded` and
28
+ * `aria-controls`. Its own styles are minimal (a row of its children, a focus
29
+ * ring): pass `render={<Button variant="ghost" />}` for a button look.
30
+ */
31
+ declare const CollapsibleTrigger: (props: CollapsibleTriggerProps) => import("react").JSX.Element;
32
+ export type CollapsiblePanelProps = CollapsiblePrimitive.Panel.Props;
33
+ /**
34
+ * The panel the trigger opens. Its height runs from 0 to its content's
35
+ * through `--collapsible-panel-height`, which Base UI measures, and the
36
+ * transition is dropped under `prefers-reduced-motion`.
37
+ *
38
+ * Closed, it is not rendered, so nothing in it can take focus; on the server
39
+ * it renders open or not at all, per `defaultOpen`, and opens at its natural
40
+ * height, with no animation on the first paint. `keepMounted` keeps it in the
41
+ * DOM while closed (hidden), and `hiddenUntilFound` lets the browser's page
42
+ * search find and open it.
43
+ *
44
+ * It clips its content while it moves (`overflow-hidden`): give the content
45
+ * its own padding rather than the panel, so the height runs to the padding's
46
+ * edge too.
47
+ */
48
+ declare const CollapsiblePanel: (props: CollapsiblePanelProps) => import("react").JSX.Element;
49
+ export { Collapsible, CollapsiblePanel, CollapsibleTrigger };
50
+ //# sourceMappingURL=Collapsible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/core/Collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKjF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;AAE/D;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,WAAW,UAAW,gBAAgB,gCAE3C,CAAC;AAEF,MAAM,WAAW,uBACf,SAAQ,oBAAoB,CAAC,OAAO,CAAC,KAAK;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,UAAW,uBAAuB,gCAqBzD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC;AAErE;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,gBAAgB,UAAW,qBAAqB,gCAYrD,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { cn } from "./utils.js";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
5
+ // src/core/Collapsible.tsx
6
+ /**
7
+ * A disclosure: a trigger that opens and closes a panel, its height
8
+ * animated. Uncontrolled with `defaultOpen`, controlled with `open` and
9
+ * `onOpenChange`.
10
+ *
11
+ * ```tsx
12
+ * <Collapsible>
13
+ * <CollapsibleTrigger chevron>Advanced options</CollapsibleTrigger>
14
+ * <CollapsiblePanel>...</CollapsiblePanel>
15
+ * </Collapsible>
16
+ * ```
17
+ *
18
+ * The root and the panel carry `data-open` or `data-closed`, and the trigger
19
+ * `data-panel-open` while the panel is open, for the caller's own styles.
20
+ */
21
+ const Collapsible = (props) => {
22
+ return /* @__PURE__ */ jsx(Collapsible$1.Root, {
23
+ "data-slot": "collapsible",
24
+ ...props
25
+ });
26
+ };
27
+ /**
28
+ * The button that opens and closes the panel. It carries `aria-expanded` and
29
+ * `aria-controls`. Its own styles are minimal (a row of its children, a focus
30
+ * ring): pass `render={<Button variant="ghost" />}` for a button look.
31
+ */
32
+ const CollapsibleTrigger = (props) => {
33
+ const { className, chevron = false, children, ...rest } = props;
34
+ return /* @__PURE__ */ jsxs(Collapsible$1.Trigger, {
35
+ "data-slot": "collapsible-trigger",
36
+ className: cn("group/collapsible-trigger focus-visible:ring-ring/50 inline-flex items-center gap-1.5 rounded-md text-sm font-medium outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50", className),
37
+ ...rest,
38
+ children: [children, chevron && /* @__PURE__ */ jsx(ChevronDownIcon, {
39
+ "aria-hidden": true,
40
+ "data-slot": "collapsible-chevron",
41
+ className: "text-muted-foreground size-4 shrink-0 transition-transform duration-200 group-data-[panel-open]/collapsible-trigger:rotate-180 motion-reduce:transition-none"
42
+ })]
43
+ });
44
+ };
45
+ /**
46
+ * The panel the trigger opens. Its height runs from 0 to its content's
47
+ * through `--collapsible-panel-height`, which Base UI measures, and the
48
+ * transition is dropped under `prefers-reduced-motion`.
49
+ *
50
+ * Closed, it is not rendered, so nothing in it can take focus; on the server
51
+ * it renders open or not at all, per `defaultOpen`, and opens at its natural
52
+ * height, with no animation on the first paint. `keepMounted` keeps it in the
53
+ * DOM while closed (hidden), and `hiddenUntilFound` lets the browser's page
54
+ * search find and open it.
55
+ *
56
+ * It clips its content while it moves (`overflow-hidden`): give the content
57
+ * its own padding rather than the panel, so the height runs to the padding's
58
+ * edge too.
59
+ */
60
+ const CollapsiblePanel = (props) => {
61
+ const { className, ...rest } = props;
62
+ return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
63
+ "data-slot": "collapsible-panel",
64
+ className: cn("h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none", className),
65
+ ...rest
66
+ });
67
+ };
68
+ export { Collapsible, CollapsiblePanel, CollapsibleTrigger };
69
+
70
+ //# sourceMappingURL=Collapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Collapsible.js","names":["CollapsiblePrimitive"],"sources":["../../src/core/Collapsible.tsx"],"sourcesContent":["import { Collapsible as CollapsiblePrimitive } from \"@base-ui/react/collapsible\";\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { cn } from \"./utils.ts\";\n\nexport type CollapsibleProps = CollapsiblePrimitive.Root.Props;\n\n/**\n * A disclosure: a trigger that opens and closes a panel, its height\n * animated. Uncontrolled with `defaultOpen`, controlled with `open` and\n * `onOpenChange`.\n *\n * ```tsx\n * <Collapsible>\n * <CollapsibleTrigger chevron>Advanced options</CollapsibleTrigger>\n * <CollapsiblePanel>...</CollapsiblePanel>\n * </Collapsible>\n * ```\n *\n * The root and the panel carry `data-open` or `data-closed`, and the trigger\n * `data-panel-open` while the panel is open, for the caller's own styles.\n */\nconst Collapsible = (props: CollapsibleProps) => {\n return <CollapsiblePrimitive.Root data-slot=\"collapsible\" {...props} />;\n};\n\nexport interface CollapsibleTriggerProps\n extends CollapsiblePrimitive.Trigger.Props {\n /**\n * Draw a chevron after the children, pointing down while closed and up\n * while open. Defaults to `false`.\n */\n chevron?: boolean;\n}\n\n/**\n * The button that opens and closes the panel. It carries `aria-expanded` and\n * `aria-controls`. Its own styles are minimal (a row of its children, a focus\n * ring): pass `render={<Button variant=\"ghost\" />}` for a button look.\n */\nconst CollapsibleTrigger = (props: CollapsibleTriggerProps) => {\n const { className, chevron = false, children, ...rest } = props;\n return (\n <CollapsiblePrimitive.Trigger\n data-slot=\"collapsible-trigger\"\n className={cn(\n \"group/collapsible-trigger focus-visible:ring-ring/50 inline-flex items-center gap-1.5 rounded-md text-sm font-medium outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n >\n {children}\n {chevron && (\n <ChevronDownIcon\n aria-hidden\n data-slot=\"collapsible-chevron\"\n className=\"text-muted-foreground size-4 shrink-0 transition-transform duration-200 group-data-[panel-open]/collapsible-trigger:rotate-180 motion-reduce:transition-none\"\n />\n )}\n </CollapsiblePrimitive.Trigger>\n );\n};\n\nexport type CollapsiblePanelProps = CollapsiblePrimitive.Panel.Props;\n\n/**\n * The panel the trigger opens. Its height runs from 0 to its content's\n * through `--collapsible-panel-height`, which Base UI measures, and the\n * transition is dropped under `prefers-reduced-motion`.\n *\n * Closed, it is not rendered, so nothing in it can take focus; on the server\n * it renders open or not at all, per `defaultOpen`, and opens at its natural\n * height, with no animation on the first paint. `keepMounted` keeps it in the\n * DOM while closed (hidden), and `hiddenUntilFound` lets the browser's page\n * search find and open it.\n *\n * It clips its content while it moves (`overflow-hidden`): give the content\n * its own padding rather than the panel, so the height runs to the padding's\n * edge too.\n */\nconst CollapsiblePanel = (props: CollapsiblePanelProps) => {\n const { className, ...rest } = props;\n return (\n <CollapsiblePrimitive.Panel\n data-slot=\"collapsible-panel\"\n className={cn(\n \"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport { Collapsible, CollapsiblePanel, CollapsibleTrigger };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,eAAe,UAA4B;CAC/C,OAAO,oBAACA,cAAqB,MAAtB;EAA2B,aAAU;EAAc,GAAI;CAAQ,CAAA;AACxE;;;;;;AAgBA,MAAM,sBAAsB,UAAmC;CAC7D,MAAM,EAAE,WAAW,UAAU,OAAO,UAAU,GAAG,SAAS;CAC1D,OACE,qBAACA,cAAqB,SAAtB;EACE,aAAU;EACV,WAAW,GACT,2MACA,SACF;EACA,GAAI;EANN,UAAA,CAQG,UACA,WACC,oBAAC,iBAAD;GACE,eAAA;GACA,aAAU;GACV,WAAU;EACX,CAAA,CAEyB;;AAElC;;;;;;;;;;;;;;;;AAmBA,MAAM,oBAAoB,UAAiC;CACzD,MAAM,EAAE,WAAW,GAAG,SAAS;CAC/B,OACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACV,WAAW,GACT,wKACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
@@ -3,7 +3,13 @@ import * as React from "react";
3
3
  declare const Combobox: typeof ComboboxPrimitive.Root;
4
4
  export type ComboboxValueProps = ComboboxPrimitive.Value.Props;
5
5
  declare const ComboboxValue: (props: ComboboxValueProps) => React.JSX.Element;
6
- export type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props;
6
+ export type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props & {
7
+ /**
8
+ * Draw the trailing caret. Defaults to true; off for a trigger that is not
9
+ * a field, such as a table header's funnel button.
10
+ */
11
+ chevron?: boolean;
12
+ };
7
13
  declare const ComboboxTrigger: (props: ComboboxTriggerProps) => React.JSX.Element;
8
14
  export type ComboboxClearProps = ComboboxPrimitive.Clear.Props;
9
15
  export type ComboboxInputProps = ComboboxPrimitive.Input.Props & {
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../src/core/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO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E,QAAA,MAAM,kBAAkB,UAAW,uBAAuB,sBASzD,CAAC;AAEF,iBAAS,iBAAiB,2CAEzB;AAED,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,GAClB,CAAC"}
@@ -14,12 +14,12 @@ const ComboboxValue = (props) => {
14
14
  });
15
15
  };
16
16
  const ComboboxTrigger = (props) => {
17
- const { className, children, ...rest } = props;
17
+ const { className, children, chevron = true, ...rest } = props;
18
18
  return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
19
19
  "data-slot": "combobox-trigger",
20
20
  className: cn("[&_svg:not([class*='size-'])]:size-4", className),
21
21
  ...rest,
22
- children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4" })]
22
+ children: [children, chevron && /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4" })]
23
23
  });
24
24
  };
25
25
  const ComboboxClear = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.js","names":["ComboboxPrimitive"],"sources":["../../src/core/Combobox.tsx"],"sourcesContent":["import { Combobox as ComboboxPrimitive } from \"@base-ui/react\";\nimport { CheckIcon, ChevronDownIcon, XIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"./Button.tsx\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./InputGroup.tsx\";\nimport { cn } from \"./utils.ts\";\n\nconst Combobox = ComboboxPrimitive.Root;\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props;\n\nconst ComboboxValue = (props: ComboboxValueProps) => {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n};\n\nexport type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props;\n\nconst ComboboxTrigger = (props: ComboboxTriggerProps) => {\n const { className, children, ...rest } = props;\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...rest}\n >\n {children}\n <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4\" />\n </ComboboxPrimitive.Trigger>\n );\n};\n\nexport type ComboboxClearProps = ComboboxPrimitive.Clear.Props;\n\nconst ComboboxClear = (props: ComboboxClearProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"minimal\" size=\"icon-xs\" />}\n className={cn(className)}\n {...rest}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n );\n};\n\nexport type ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean;\n showClear?: boolean;\n};\n\nconst ComboboxInput = (props: ComboboxInputProps) => {\n const {\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...rest\n } = props;\n return (\n <InputGroup className={cn(\"w-auto\", className)}>\n <ComboboxPrimitive.Input\n render={<InputGroupInput disabled={disabled} />}\n {...rest}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"minimal\"\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n};\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >;\n\nconst ComboboxContent = (props: ComboboxContentProps) => {\n const {\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n ...rest\n } = props;\n return (\n <ComboboxPrimitive.Portal>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n \"group/combobox-content bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:border-border/30 *:data-[slot=input-group]:bg-input/30 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg shadow-md ring-1 duration-100 data-[chips=true]:min-w-(--anchor-width) *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none\",\n className,\n )}\n {...rest}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n};\n\nexport type ComboboxListProps = ComboboxPrimitive.List.Props;\n\nconst ComboboxList = (props: ComboboxListProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n \"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport type ComboboxItemProps = ComboboxPrimitive.Item.Props;\n\nconst ComboboxItem = (props: ComboboxItemProps) => {\n const { className, children, ...rest } = props;\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...rest}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n};\n\nexport type ComboboxGroupProps = ComboboxPrimitive.Group.Props;\n\nconst ComboboxGroup = (props: ComboboxGroupProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(className)}\n {...rest}\n />\n );\n};\n\nexport type ComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props;\n\nconst ComboboxLabel = (props: ComboboxLabelProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...rest}\n />\n );\n};\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props;\n\nconst ComboboxCollection = (props: ComboboxCollectionProps) => {\n return (\n <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n );\n};\n\nexport type ComboboxEmptyProps = ComboboxPrimitive.Empty.Props;\n\nconst ComboboxEmpty = (props: ComboboxEmptyProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport type ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props;\n\nconst ComboboxSeparator = (props: ComboboxSeparatorProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...rest}\n />\n );\n};\n\nexport type ComboboxChipsProps = React.ComponentPropsWithRef<\n typeof ComboboxPrimitive.Chips\n> &\n ComboboxPrimitive.Chips.Props;\n\nconst ComboboxChips = (props: ComboboxChipsProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n \"border-border focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:border-danger has-aria-invalid:ring-danger/20 dark:bg-input/30 dark:has-aria-invalid:border-danger/50 dark:has-aria-invalid:ring-danger/40 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean;\n};\n\nconst ComboboxChip = (props: ComboboxChipProps) => {\n const { className, children, showRemove = true, ...rest } = props;\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0\",\n className,\n )}\n {...rest}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"minimal\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n );\n};\n\nexport type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props;\n\nconst ComboboxChipsInput = (props: ComboboxChipsInputProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...rest}\n />\n );\n};\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null);\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,WAAWA,WAAkB;AAInC,MAAM,iBAAiB,UAA8B;CACnD,OAAO,oBAACA,WAAkB,OAAnB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAIA,MAAM,mBAAmB,UAAgC;CACvD,MAAM,EAAE,WAAW,UAAU,GAAG,SAAS;CACzC,OACE,qBAACA,WAAkB,SAAnB;EACE,aAAU;EACV,WAAW,GAAG,wCAAwC,SAAS;EAC/D,GAAI;EAHN,UAAA,CAKG,UACD,oBAAC,iBAAD,EAAiB,WAAU,mDAAoD,CAAA,CACtD;;AAE/B;AAIA,MAAM,iBAAiB,UAA8B;CACnD,MAAM,EAAE,WAAW,GAAG,SAAS;CAC/B,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,QAAQ,oBAAC,kBAAD;GAAkB,SAAQ;GAAU,MAAK;EAAW,CAAA;EAC5D,WAAW,GAAG,SAAS;EACvB,GAAI;EAEJ,UAAA,oBAAC,OAAD,EAAO,WAAU,sBAAuB,CAAA;CACjB,CAAA;AAE7B;AAOA,MAAM,iBAAi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,YAAnB;GACE,QAAQ,oBAAC,QAAD;IAAQ,SAAQ;IAAU,MAAK;GAAW,CAAA;GAClD,WAAU;GACV,aAAU;GAEV,UAAA,oBAAC,OAAD,EAAO,WAAU,sBAAuB,CAAA;EACZ,CAAA,CAEV;;AAE5B;AAIA,MAAM,sBAAsB,UAAmC;CAC7D,MAAM,EAAE,WAAW,GAAG,SAAS;CAC/B,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GAAG,gCAAgC,SAAS;EACvD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,oBAAoB;CAC3B,OAAO,MAAM,OAA8B,IAAI;AACjD"}
1
+ {"version":3,"file":"Combobox.js","names":["ComboboxPrimitive"],"sources":["../../src/core/Combobox.tsx"],"sourcesContent":["import { Combobox as ComboboxPrimitive } from \"@base-ui/react\";\nimport { CheckIcon, ChevronDownIcon, XIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"./Button.tsx\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./InputGroup.tsx\";\nimport { cn } from \"./utils.ts\";\n\nconst Combobox = ComboboxPrimitive.Root;\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props;\n\nconst ComboboxValue = (props: ComboboxValueProps) => {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n};\n\nexport type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props & {\n /**\n * Draw the trailing caret. Defaults to true; off for a trigger that is not\n * a field, such as a table header's funnel button.\n */\n chevron?: boolean;\n};\n\nconst ComboboxTrigger = (props: ComboboxTriggerProps) => {\n const { className, children, chevron = true, ...rest } = props;\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...rest}\n >\n {children}\n {chevron && (\n <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4\" />\n )}\n </ComboboxPrimitive.Trigger>\n );\n};\n\nexport type ComboboxClearProps = ComboboxPrimitive.Clear.Props;\n\nconst ComboboxClear = (props: ComboboxClearProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"minimal\" size=\"icon-xs\" />}\n className={cn(className)}\n {...rest}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n );\n};\n\nexport type ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean;\n showClear?: boolean;\n};\n\nconst ComboboxInput = (props: ComboboxInputProps) => {\n const {\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...rest\n } = props;\n return (\n <InputGroup className={cn(\"w-auto\", className)}>\n <ComboboxPrimitive.Input\n render={<InputGroupInput disabled={disabled} />}\n {...rest}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"minimal\"\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n};\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >;\n\nconst ComboboxContent = (props: ComboboxContentProps) => {\n const {\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n ...rest\n } = props;\n return (\n <ComboboxPrimitive.Portal>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n \"group/combobox-content bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:border-border/30 *:data-[slot=input-group]:bg-input/30 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg shadow-md ring-1 duration-100 data-[chips=true]:min-w-(--anchor-width) *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none\",\n className,\n )}\n {...rest}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n};\n\nexport type ComboboxListProps = ComboboxPrimitive.List.Props;\n\nconst ComboboxList = (props: ComboboxListProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n \"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport type ComboboxItemProps = ComboboxPrimitive.Item.Props;\n\nconst ComboboxItem = (props: ComboboxItemProps) => {\n const { className, children, ...rest } = props;\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...rest}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n};\n\nexport type ComboboxGroupProps = ComboboxPrimitive.Group.Props;\n\nconst ComboboxGroup = (props: ComboboxGroupProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(className)}\n {...rest}\n />\n );\n};\n\nexport type ComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props;\n\nconst ComboboxLabel = (props: ComboboxLabelProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...rest}\n />\n );\n};\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props;\n\nconst ComboboxCollection = (props: ComboboxCollectionProps) => {\n return (\n <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n );\n};\n\nexport type ComboboxEmptyProps = ComboboxPrimitive.Empty.Props;\n\nconst ComboboxEmpty = (props: ComboboxEmptyProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport type ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props;\n\nconst ComboboxSeparator = (props: ComboboxSeparatorProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...rest}\n />\n );\n};\n\nexport type ComboboxChipsProps = React.ComponentPropsWithRef<\n typeof ComboboxPrimitive.Chips\n> &\n ComboboxPrimitive.Chips.Props;\n\nconst ComboboxChips = (props: ComboboxChipsProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n \"border-border focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:border-danger has-aria-invalid:ring-danger/20 dark:bg-input/30 dark:has-aria-invalid:border-danger/50 dark:has-aria-invalid:ring-danger/40 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1\",\n className,\n )}\n {...rest}\n />\n );\n};\n\nexport type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean;\n};\n\nconst ComboboxChip = (props: ComboboxChipProps) => {\n const { className, children, showRemove = true, ...rest } = props;\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0\",\n className,\n )}\n {...rest}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"minimal\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n );\n};\n\nexport type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props;\n\nconst ComboboxChipsInput = (props: ComboboxChipsInputProps) => {\n const { className, ...rest } = props;\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...rest}\n />\n );\n};\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null);\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,WAAWA,WAAkB;AAInC,MAAM,iBAAiB,UAA8B;CACnD,OAAO,oBAACA,WAAkB,OAAnB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAUA,MAAM,mBAAmB,UAAgC;CACvD,MAAM,EAAE,WAAW,UAAU,UAAU,MAAM,GAAG,SAAS;CACzD,OACE,qBAACA,WAAkB,SAAnB;EACE,aAAU;EACV,WAAW,GAAG,wCAAwC,SAAS;EAC/D,GAAI;EAHN,UAAA,CAKG,UACA,WACC,oBAAC,iBAAD,EAAiB,WAAU,mDAAoD,CAAA,CAExD;;AAE/B;AAIA,MAAM,iBAAiB,UAA8B;CACnD,MAAM,EAAE,WAAW,GAAG,SAAS;CAC/B,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,QAAQ,oBAAC,kBAAD;GAAkB,SAAQ;GAAU,MAAK;EAAW,CAAA;EAC5D,WAAW,GAAG,SAAS;EACvB,GAAI;EAEJ,UAAA,oBAAC,OAAD,EAAO,WAAU,sBAAuB,CAAA;CACjB,CAAA;AAE7B;AAOA,MAAM,iBAAiB,UAA8B;CACnD,MAAM,EACJ,WACA,UACA,WAAW,OACX,cAAc,MACd,YAAY,OACZ,GAAG,SACD;CACJ,OACE,qBAAC,YAAD;EAAY,WAAW,GAAG,UAAU,SAAS;EAA7C,UAAA;GACE,oBAACA,WAAkB,OAAnB;IACE,QAAQ,oBAAC,iBAAD,EAA2B,SAAW,CAAA;IAC9C,G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G,SAAS;CAC/B,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GAAG,gCAAgC,SAAS;EACvD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,oBAAoB;CAC3B,OAAO,MAAM,OAA8B,IAAI;AACjD"}
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  export interface PaneRailProps {
2
3
  /**
3
4
  * The edge of the layout the collapsed pane sits on. It picks the icon and
@@ -9,22 +10,38 @@ export interface PaneRailProps {
9
10
  */
10
11
  label: string;
11
12
  onExpand: () => void;
13
+ /**
14
+ * The pane's own icon, at the top of the strip. Given one, the rail names
15
+ * WHAT it reopens, and the open-panel arrow moves to the strip's foot so
16
+ * the strip still says it opens something. Without one the arrow is the
17
+ * only mark, at the top.
18
+ */
19
+ icon?: ReactNode;
20
+ /**
21
+ * Shown under the top icon: a count badge, say. Not separately
22
+ * actionable, since the whole strip is the button.
23
+ */
24
+ children?: ReactNode;
12
25
  className?: string;
26
+ "data-testid"?: string;
13
27
  }
14
28
  /**
15
- * What a collapsible pane leaves behind once it is closed: a 36px strip with
16
- * the one button that brings it back.
29
+ * What a collapsible pane leaves behind once it is closed: a 36px strip that
30
+ * is, all of it, the button that brings the pane back.
17
31
  *
18
32
  * A pane closed with a click has to say how to reopen it. Collapsing to
19
33
  * nothing strands the reader: the only routes back left are a keyboard
20
34
  * shortcut and a menu that does not advertise itself, for a pane they just
21
35
  * closed with a click.
22
36
  *
23
- * It moved from Lore into the kit with #Q2265, so the admin Parameters
24
- * History panel and Lore's folio tree and inspector share one strip. Lore's
25
- * Quest Log rail is deliberately not built on it: there the whole rail is
26
- * the button and it carries a count badge, which makes it a different
27
- * control rather than a variant of this one.
37
+ * The whole strip is the hit area, hover included, rather than a small
38
+ * button at its top: the strip has no other use, and a 28px target inside a
39
+ * full-height column reads as broken when a click below it does nothing.
40
+ *
41
+ * It moved from Lore into the kit with #Q2265 and became one full-height
42
+ * button with #Q3206, so the admin Parameters History panel, Lore's folio
43
+ * tree and inspector, and Lore's Quest Log (`icon` plus a count as
44
+ * `children`) share one strip and cannot drift apart.
28
45
  *
29
46
  * ⚠️ Render it only where the pane would otherwise be a COLUMN. Where a
30
47
  * layout stacks its panes or turns one into an overlay, a strip frees no
@@ -1 +1 @@
1
- {"version":3,"file":"PaneRail.d.ts","sourceRoot":"","sources":["../../src/core/PaneRail.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,UAAW,aAAa,gCAsB5C,CAAC"}
1
+ {"version":3,"file":"PaneRail.d.ts","sourceRoot":"","sources":["../../src/core/PaneRail.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,UAAW,aAAa,gCAqB5C,CAAC"}
@@ -1,38 +1,43 @@
1
1
  import { cn } from "./utils.js";
2
2
  import { PanelLeftOpen, PanelRightOpen } from "lucide-react";
3
- import { jsx } from "react/jsx-runtime";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
4
  // src/core/PaneRail.tsx
5
5
  /**
6
- * What a collapsible pane leaves behind once it is closed: a 36px strip with
7
- * the one button that brings it back.
6
+ * What a collapsible pane leaves behind once it is closed: a 36px strip that
7
+ * is, all of it, the button that brings the pane back.
8
8
  *
9
9
  * A pane closed with a click has to say how to reopen it. Collapsing to
10
10
  * nothing strands the reader: the only routes back left are a keyboard
11
11
  * shortcut and a menu that does not advertise itself, for a pane they just
12
12
  * closed with a click.
13
13
  *
14
- * It moved from Lore into the kit with #Q2265, so the admin Parameters
15
- * History panel and Lore's folio tree and inspector share one strip. Lore's
16
- * Quest Log rail is deliberately not built on it: there the whole rail is
17
- * the button and it carries a count badge, which makes it a different
18
- * control rather than a variant of this one.
14
+ * The whole strip is the hit area, hover included, rather than a small
15
+ * button at its top: the strip has no other use, and a 28px target inside a
16
+ * full-height column reads as broken when a click below it does nothing.
17
+ *
18
+ * It moved from Lore into the kit with #Q2265 and became one full-height
19
+ * button with #Q3206, so the admin Parameters History panel, Lore's folio
20
+ * tree and inspector, and Lore's Quest Log (`icon` plus a count as
21
+ * `children`) share one strip and cannot drift apart.
19
22
  *
20
23
  * ⚠️ Render it only where the pane would otherwise be a COLUMN. Where a
21
24
  * layout stacks its panes or turns one into an overlay, a strip frees no
22
25
  * width and only changes the default layout.
23
26
  */
24
27
  const PaneRail = (props) => {
25
- const Icon = props.side === "left" ? PanelLeftOpen : PanelRightOpen;
26
- return /* @__PURE__ */ jsx("div", {
27
- className: cn("border-border flex w-9 flex-none flex-col items-center pt-1.5", props.side === "left" ? "border-r" : "border-l", props.className),
28
- children: /* @__PURE__ */ jsx("button", {
29
- type: "button",
30
- onClick: props.onExpand,
31
- "aria-label": props.label,
32
- title: props.label,
33
- className: "text-muted-foreground hover:text-foreground hover:bg-hover flex size-7 items-center justify-center rounded-md transition-colors",
34
- children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
35
- })
28
+ const Arrow = props.side === "left" ? PanelLeftOpen : PanelRightOpen;
29
+ return /* @__PURE__ */ jsxs("button", {
30
+ type: "button",
31
+ onClick: props.onExpand,
32
+ "aria-label": props.label,
33
+ title: props.label,
34
+ "data-testid": props["data-testid"],
35
+ className: cn("border-border text-muted-foreground hover:text-foreground hover:bg-hover focus-visible:ring-ring/50 flex w-9 flex-none cursor-pointer flex-col items-center gap-2 pt-3 transition-colors outline-none focus-visible:ring-3 focus-visible:ring-inset", props.side === "left" ? "border-r" : "border-l", props.className),
36
+ children: [
37
+ props.icon ?? /* @__PURE__ */ jsx(Arrow, { className: "size-4 shrink-0" }),
38
+ props.children,
39
+ props.icon && /* @__PURE__ */ jsx(Arrow, { className: "mt-auto mb-3 size-3.5 shrink-0" })
40
+ ]
36
41
  });
37
42
  };
38
43
  export { PaneRail };