@krizaka/ui 3.2.0 → 3.3.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 (162) hide show
  1. package/dist/{chunk-I5RVM5CW.js → chunk-2FRWNSRO.js} +2 -6
  2. package/dist/chunk-2FRWNSRO.js.map +1 -0
  3. package/dist/chunk-BTMFZ66D.js +135 -0
  4. package/dist/chunk-BTMFZ66D.js.map +1 -0
  5. package/dist/chunk-C2BRIFJG.js +13 -0
  6. package/dist/chunk-C2BRIFJG.js.map +1 -0
  7. package/dist/chunk-KDXRYUD3.js +39 -0
  8. package/dist/chunk-KDXRYUD3.js.map +1 -0
  9. package/dist/{chunk-2PUDI7JS.js → chunk-ZKVQGXLD.js} +5 -3
  10. package/dist/{chunk-2PUDI7JS.js.map → chunk-ZKVQGXLD.js.map} +1 -1
  11. package/dist/command.js +1 -1
  12. package/dist/confirm-button.js +1 -1
  13. package/dist/data-table.js +3 -2
  14. package/dist/data-table.js.map +1 -1
  15. package/dist/date-picker.d.ts +3 -1
  16. package/dist/date-picker.js +13 -13
  17. package/dist/date-picker.js.map +1 -1
  18. package/dist/dropdown-menu.js +1 -1
  19. package/dist/filter-bar.js +3 -2
  20. package/dist/form.d.ts +23 -12
  21. package/dist/form.js +11 -47
  22. package/dist/form.js.map +1 -1
  23. package/dist/glow-card.js +1 -1
  24. package/dist/image-cropper.js +3 -1
  25. package/dist/image-cropper.js.map +1 -1
  26. package/dist/marquee.js +1 -1
  27. package/dist/native/form.d.ts +60 -15
  28. package/dist/native/form.js +103 -42
  29. package/dist/native/form.js.map +1 -1
  30. package/dist/native.d.ts +206 -2
  31. package/dist/native.js +1172 -541
  32. package/dist/native.js.map +1 -1
  33. package/dist/nav-bar.js +1 -1
  34. package/dist/popover.js +1 -1
  35. package/dist/radio-group.d.ts +66 -32
  36. package/dist/radio-group.js +54 -10
  37. package/dist/radio-group.js.map +1 -1
  38. package/dist/slider.d.ts +96 -35
  39. package/dist/slider.js +67 -13
  40. package/dist/slider.js.map +1 -1
  41. package/dist/terminal-replay.js +34 -60
  42. package/dist/terminal-replay.js.map +1 -1
  43. package/dist/toast.js +1 -1
  44. package/dist/tooltip.js +1 -1
  45. package/dist/video-player.js +3 -1
  46. package/dist/video-player.js.map +1 -1
  47. package/package.json +6 -6
  48. package/registry/combobox.json +225 -3
  49. package/registry/date-picker.json +16 -2
  50. package/registry/dialog.json +74 -3
  51. package/registry/examples/combobox/native/multiple.d.ts +4 -0
  52. package/registry/examples/combobox/native/multiple.dark.png +0 -0
  53. package/registry/examples/combobox/native/multiple.js +15 -0
  54. package/registry/examples/combobox/native/multiple.light.png +0 -0
  55. package/registry/examples/combobox/native/multiple.tsx +15 -0
  56. package/registry/examples/combobox/native/search.d.ts +4 -0
  57. package/registry/examples/combobox/native/search.dark.png +0 -0
  58. package/registry/examples/combobox/native/search.js +15 -0
  59. package/registry/examples/combobox/native/search.light.png +0 -0
  60. package/registry/examples/combobox/native/search.tsx +15 -0
  61. package/registry/examples/dialog/native/sheet.d.ts +4 -0
  62. package/registry/examples/dialog/native/sheet.dark.png +0 -0
  63. package/registry/examples/dialog/native/sheet.js +21 -0
  64. package/registry/examples/dialog/native/sheet.light.png +0 -0
  65. package/registry/examples/dialog/native/sheet.tsx +18 -0
  66. package/registry/examples/field/native/select.d.ts +4 -0
  67. package/registry/examples/field/native/select.dark.png +0 -0
  68. package/registry/examples/field/native/select.js +29 -0
  69. package/registry/examples/field/native/select.light.png +0 -0
  70. package/registry/examples/field/native/select.tsx +25 -0
  71. package/registry/examples/form/native/audience.dark.png +0 -0
  72. package/registry/examples/form/native/audience.light.png +0 -0
  73. package/registry/examples/form/native/profile.dark.png +0 -0
  74. package/registry/examples/form/native/profile.light.png +0 -0
  75. package/registry/examples/form/native/settings.dark.png +0 -0
  76. package/registry/examples/form/native/settings.light.png +0 -0
  77. package/registry/examples/form/native/sign-up.dark.png +0 -0
  78. package/registry/examples/form/native/sign-up.light.png +0 -0
  79. package/registry/examples/form/native/upload.dark.png +0 -0
  80. package/registry/examples/form/native/upload.light.png +0 -0
  81. package/registry/examples/radio-group/buttons.d.ts +4 -0
  82. package/registry/examples/radio-group/buttons.js +17 -0
  83. package/registry/examples/radio-group/buttons.tsx +21 -0
  84. package/registry/examples/radio-group/cards.js +1 -1
  85. package/registry/examples/radio-group/cards.tsx +2 -2
  86. package/registry/examples/radio-group/native/buttons.d.ts +4 -0
  87. package/registry/examples/radio-group/native/buttons.dark.png +0 -0
  88. package/registry/examples/radio-group/native/buttons.js +25 -0
  89. package/registry/examples/radio-group/native/buttons.light.png +0 -0
  90. package/registry/examples/radio-group/native/buttons.tsx +21 -0
  91. package/registry/examples/radio-group/native/cards.d.ts +4 -0
  92. package/registry/examples/radio-group/native/cards.dark.png +0 -0
  93. package/registry/examples/radio-group/native/cards.js +23 -0
  94. package/registry/examples/radio-group/native/cards.light.png +0 -0
  95. package/registry/examples/radio-group/native/cards.tsx +19 -0
  96. package/registry/examples/radio-group/native/list.d.ts +4 -0
  97. package/registry/examples/radio-group/native/list.dark.png +0 -0
  98. package/registry/examples/radio-group/native/list.js +24 -0
  99. package/registry/examples/radio-group/native/list.light.png +0 -0
  100. package/registry/examples/radio-group/native/list.tsx +20 -0
  101. package/registry/examples/radio-group/native/segmented.d.ts +4 -0
  102. package/registry/examples/radio-group/native/segmented.dark.png +0 -0
  103. package/registry/examples/radio-group/native/segmented.js +24 -0
  104. package/registry/examples/radio-group/native/segmented.light.png +0 -0
  105. package/registry/examples/radio-group/native/segmented.tsx +20 -0
  106. package/registry/examples/radio-group/segmented.d.ts +4 -0
  107. package/registry/examples/radio-group/segmented.js +15 -0
  108. package/registry/examples/radio-group/segmented.tsx +12 -0
  109. package/registry/examples/slider/floating.d.ts +4 -0
  110. package/registry/examples/slider/floating.js +11 -0
  111. package/registry/examples/slider/floating.tsx +12 -0
  112. package/registry/examples/slider/native/default.d.ts +4 -0
  113. package/registry/examples/slider/native/default.dark.png +0 -0
  114. package/registry/examples/slider/native/default.js +14 -0
  115. package/registry/examples/slider/native/default.light.png +0 -0
  116. package/registry/examples/slider/native/default.tsx +13 -0
  117. package/registry/examples/slider/native/range.d.ts +4 -0
  118. package/registry/examples/slider/native/range.dark.png +0 -0
  119. package/registry/examples/slider/native/range.js +12 -0
  120. package/registry/examples/slider/native/range.light.png +0 -0
  121. package/registry/examples/slider/native/range.tsx +11 -0
  122. package/registry/examples/slider/native/stepped.d.ts +4 -0
  123. package/registry/examples/slider/native/stepped.dark.png +0 -0
  124. package/registry/examples/slider/native/stepped.js +28 -0
  125. package/registry/examples/slider/native/stepped.light.png +0 -0
  126. package/registry/examples/slider/native/stepped.tsx +24 -0
  127. package/registry/examples/slider/native/vertical.d.ts +4 -0
  128. package/registry/examples/slider/native/vertical.dark.png +0 -0
  129. package/registry/examples/slider/native/vertical.js +16 -0
  130. package/registry/examples/slider/native/vertical.light.png +0 -0
  131. package/registry/examples/slider/native/vertical.tsx +13 -0
  132. package/registry/examples/slider/price-range.d.ts +4 -0
  133. package/registry/examples/slider/price-range.js +29 -0
  134. package/registry/examples/slider/price-range.tsx +27 -0
  135. package/registry/examples/slider/stepped.d.ts +4 -0
  136. package/registry/examples/slider/stepped.js +28 -0
  137. package/registry/examples/slider/stepped.tsx +24 -0
  138. package/registry/examples/slider/vertical.d.ts +4 -0
  139. package/registry/examples/slider/vertical.js +15 -0
  140. package/registry/examples/slider/vertical.tsx +14 -0
  141. package/registry/examples/switch/native/default.d.ts +4 -0
  142. package/registry/examples/switch/native/default.dark.png +0 -0
  143. package/registry/examples/switch/native/default.js +16 -0
  144. package/registry/examples/switch/native/default.light.png +0 -0
  145. package/registry/examples/switch/native/default.tsx +13 -0
  146. package/registry/examples/switch/native/settings.d.ts +4 -0
  147. package/registry/examples/switch/native/settings.dark.png +0 -0
  148. package/registry/examples/switch/native/settings.js +20 -0
  149. package/registry/examples/switch/native/settings.light.png +0 -0
  150. package/registry/examples/switch/native/settings.tsx +17 -0
  151. package/registry/field.json +15 -3
  152. package/registry/form.json +250 -42
  153. package/registry/index.json +24 -20
  154. package/registry/radio-group.json +227 -15
  155. package/registry/slider.json +314 -13
  156. package/registry/switch.json +115 -3
  157. package/registry/tabs.json +2 -2
  158. package/skills/choice-controls/SKILL.md +39 -0
  159. package/skills/form/SKILL.md +3 -0
  160. package/dist/chunk-I5RVM5CW.js.map +0 -1
  161. package/dist/chunk-RUPRYJ45.js +0 -82
  162. package/dist/chunk-RUPRYJ45.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/native/form.tsx","../../src/form/core.tsx","../../src/form/errors.ts","../../src/form/money.ts","../../src/date-picker/parts.ts"],"sourcesContent":["// React Native: the same forms as the web (`createKrizakaForm`, the same schemas, the same errors' keys), on the native\n// fields — TextField, Checkbox, DateField, Chip.Group, the system's Switch. A form is a View; Submit is the platform's\n// Button; a refused submit announces its first error. Thin adapters: a new native control changes one here, never a form.\nimport { type BrandId, Button, Checkbox as CheckboxControl, Chip, DateField as DateFieldControl, type DateFieldLabels, ProductMark, Spinner, TextField as TextFieldControl, type TextFieldProps as TextFieldControlProps, Txt, useTheme } from \"@krizaka/ui/native\";\nimport * as React from \"react\";\nimport { AccessibilityInfo, KeyboardAvoidingView, Platform, Pressable, ScrollView, type StyleProp, StyleSheet, Switch as SwitchControl, type TextInput, View, type ViewStyle } from \"react-native\";\n\nimport {\n type FieldCheck,\n firstVisibleError,\n FormContext,\n type FormContextValue,\n type KrizakaField,\n type KrizakaFieldArray,\n makeCreateKrizakaForm,\n useFormContext,\n useFormStatus,\n useFormValue,\n useKrizakaField,\n useKrizakaFieldArray,\n} from \"../form/core\";\nimport { formMessage } from \"../form/errors\";\nimport { currencySymbol, moneyInputText, parseMoney } from \"../form/money\";\n\ntype Base = {\n /** The field's name in the schema (typed by the form). */\n name: string;\n /** The visible label, passed translated (also the accessible name). */\n label: string;\n /** A help text under the control; the error takes its place when there is one. */\n hint?: string;\n /** Not available. */\n disabled?: boolean;\n /** Styles merged last, on the field. */\n style?: StyleProp<ViewStyle>;\n};\n\nexport type FormProps = {\n /** The fields, the error and the button. */\n children?: React.ReactNode;\n /** The form's accessible name (\"Create your account\"), passed translated. */\n \"aria-label\"?: string;\n /** The form is the screen's scrolling content: it moves above the keyboard (iOS), keeps the focused field in view, and\n * a tap on a button works while the keyboard is open. Give the form `flex: 1` room (a screen). */\n scroll?: boolean;\n /** Styles merged last, on the form's view — or its scrolled content (a column with a 16-pt gap by default). */\n style?: StyleProp<ViewStyle>;\n};\n\ntype ChainEntry = { key: string; focus: () => void; setLast: (last: boolean) => void };\ntype Chain = { register: (entry: ChainEntry) => () => void; next: (key: string) => void };\nconst ChainContext = React.createContext<Chain | null>(null);\n\n/** The return key walks the text fields in the order they appeared; the last one's sends the form. */\nfunction useChain(ctx: FormContextValue): Chain {\n const entries = React.useRef<ChainEntry[]>([]);\n return React.useMemo<Chain>(() => {\n const mark = () => entries.current.forEach((e, i) => e.setLast(i === entries.current.length - 1));\n return {\n register: (entry) => {\n entries.current = [...entries.current.filter((e) => e.key !== entry.key), entry];\n mark();\n return () => {\n entries.current = entries.current.filter((e) => e.key !== entry.key);\n mark();\n };\n },\n next: (key) => {\n const i = entries.current.findIndex((e) => e.key === key);\n const following = entries.current[i + 1];\n if (following) following.focus();\n else void submitAndAnnounce(ctx);\n },\n };\n }, [ctx]);\n}\n\n/** A text input of the form in the return-key chain: its ref, its return key (`next`, or `go` for the last), what it does. */\nfunction useChained(override: { returnKeyType?: unknown; onSubmitEditing?: unknown }) {\n const chain = React.useContext(ChainContext);\n const key = React.useId();\n const ref = React.useRef<TextInput>(null);\n const [last, setLast] = React.useState(false);\n React.useLayoutEffect(() => chain?.register({ key, focus: () => ref.current?.focus(), setLast }), [chain, key]);\n if (!chain || override.returnKeyType !== undefined || override.onSubmitEditing !== undefined) return { inputRef: ref };\n return {\n inputRef: ref,\n returnKeyType: last ? (\"go\" as const) : (\"next\" as const),\n submitBehavior: last ? (\"blurAndSubmit\" as const) : (\"submit\" as const),\n onSubmitEditing: () => chain.next(key),\n };\n}\n\nasync function submitAndAnnounce(ctx: FormContextValue) {\n if (await ctx.submit()) return;\n const message = firstVisibleError(ctx);\n if (message) AccessibilityInfo.announceForAccessibility(message);\n}\n\nfunction FormRoot({ value, children, style, scroll, \"aria-label\": label }: FormProps & { value: FormContextValue }) {\n const chain = useChain(value);\n const body = scroll ? (\n <KeyboardAvoidingView behavior={Platform.OS === \"ios\" ? \"padding\" : undefined} style={styles.screen}>\n <ScrollView role=\"form\" aria-label={label} keyboardShouldPersistTaps=\"handled\" automaticallyAdjustKeyboardInsets keyboardDismissMode=\"interactive\" contentContainerStyle={[styles.form, style]}>\n {children}\n </ScrollView>\n </KeyboardAvoidingView>\n ) : (\n <View role=\"form\" aria-label={label} style={[styles.form, style]}>\n {children}\n </View>\n );\n return (\n <FormContext.Provider value={value}>\n <ChainContext.Provider value={chain}>{body}</ChainContext.Provider>\n </FormContext.Provider>\n );\n}\n\nfunction Suggestion({ field }: { field: KrizakaField }) {\n const suggestion = field.errorDetail?.suggestion;\n if (!field.error || !suggestion) return null;\n return (\n <Pressable role=\"button\" onPress={() => field.setValue(suggestion.value)} hitSlop={8} style={styles.suggestion}>\n <Txt variant=\"label\" tone=\"accent\">\n {suggestion.label}\n </Txt>\n </Pressable>\n );\n}\n\nexport type SubmitProps = {\n /** The button's words, passed translated (\"Create my account\"). */\n label: string;\n /** The look. Default `primary`. */\n variant?: \"primary\" | \"gradient\" | \"secondary\" | \"outline\" | \"ghost\" | \"danger\";\n /** The product whose animated mark turns in the button while the form is sent (the brand's loader); the system's spinner otherwise. */\n brand?: BrandId;\n /** Styles merged last, on the button. */\n style?: StyleProp<ViewStyle>;\n};\n\n/** Sends the form: busy while it is sent (the product's mark turning, or a spinner); a refused submit announces its first error. */\nexport function Submit({ label, variant = \"primary\", brand, style }: SubmitProps) {\n const ctx = useFormContext();\n const { submitting } = useFormStatus();\n const mark = submitting && brand ? <ProductMark id={brand} size={18} animated /> : undefined;\n return <Button label={label} variant={variant} loading={submitting && !brand} disabled={submitting} aria-busy={submitting} icon={mark} style={style} onPress={() => void submitAndAnnounce(ctx)} />;\n}\n\nexport type FormErrorProps = {\n /** A headline above the message, passed translated. */\n title?: string;\n /** Styles merged last. */\n style?: StyleProp<ViewStyle>;\n};\n\n/** The whole form's error — a refusal that belongs to no field (a conflict, too many tries, no network). */\nexport function FormError({ title, style }: FormErrorProps) {\n const ctx = useFormContext();\n const { theme, radius } = useTheme();\n if (!ctx.error) return null;\n return (\n <View role=\"alert\" aria-live=\"assertive\" style={[styles.alert, { borderRadius: radius.lg, borderColor: theme.danger, backgroundColor: theme.dangerSoft }, style]}>\n {title ? <Txt variant=\"label\">{title}</Txt> : null}\n <Txt tone=\"secondary\">{formMessage(ctx.error, ctx.i18n)}</Txt>\n </View>\n );\n}\n\nexport type TextFieldProps = Base &\n Pick<TextFieldControlProps, \"secureTextEntry\" | \"keyboardType\" | \"autoComplete\" | \"autoCapitalize\" | \"autoCorrect\" | \"textContentType\" | \"returnKeyType\" | \"onSubmitEditing\" | \"placeholder\" | \"maxLength\" | \"inputRef\"> & {\n /** Cleans what is typed before it is stored (`(v) => v.toLowerCase()`). */\n transform?: (raw: string) => string;\n /** Checks the value on the server as it is typed (availability): an error key, or nothing when it is fine. */\n validateAsync?: FieldCheck<string>;\n /** The wait, in ms, before `validateAsync`. Default 350. */\n asyncDebounceMs?: number;\n /** The words once `validateAsync` accepted the value (\"@eric is free\"), passed translated. */\n availableHint?: string;\n /** The name of the wait while it checks (\"Checking\"), passed translated. */\n checkingLabel?: string;\n };\n\n/** A text field of the form: its label, the input, the hint or the error, an optional check on the server. */\nexport function TextField({ name, label, hint, disabled, style, transform, validateAsync, asyncDebounceMs, availableHint, checkingLabel = \"Checking\", ...input }: TextFieldProps) {\n const f = useKrizakaField<string>(name, { validateAsync, asyncDebounceMs });\n const chained = useChained(input);\n const { theme } = useTheme();\n const end = f.validating ? <Spinner size=\"sm\" label={checkingLabel} /> : f.available ? <Txt aria-hidden style={{ color: theme.successText }}>✓</Txt> : null;\n return (\n <View style={[styles.field, style]}>\n <TextFieldControl\n label={label}\n hint={f.available && availableHint ? (hint ? `${availableHint} · ${hint}` : availableHint) : hint}\n error={f.error}\n disabled={disabled}\n value={f.value ?? \"\"}\n onValueChange={(text) => f.setValue(transform ? transform(text) : text)}\n onBlur={f.onBlur}\n end={end}\n {...chained}\n {...input}\n />\n <Suggestion field={f} />\n </View>\n );\n}\n\nexport type TextAreaProps = Base & {\n /** An example, passed translated. */\n placeholder?: string;\n /** The most characters. */\n maxLength?: number;\n};\n\n/** A longer text of the form (a bio, a description, a report). */\nexport function TextArea({ name, label, hint, disabled, style, ...input }: TextAreaProps) {\n const f = useKrizakaField<string>(name);\n return <TextFieldControl multiline label={label} hint={hint} error={f.error} disabled={disabled} value={f.value ?? \"\"} onValueChange={(t) => f.setValue(t)} onBlur={f.onBlur} style={style} {...input} />;\n}\n\nexport type CheckboxProps = Omit<Base, \"label\" | \"hint\"> & {\n /** The words next to the box: text, or a `Txt` with links inside (then name it with `accessibleLabel`). */\n label: React.ReactNode;\n /** The accessible name when `label` is not plain text, passed translated. */\n accessibleLabel?: string;\n};\n\n/** A box of the form (`boolean`): terms to accept, an option. */\nexport function Checkbox({ name, label, accessibleLabel, disabled, style }: CheckboxProps) {\n const f = useKrizakaField<boolean>(name);\n return (\n <CheckboxControl\n label={accessibleLabel}\n checked={f.value === true}\n onCheckedChange={(c) => {\n f.setValue(c);\n f.onBlur();\n }}\n error={f.error}\n disabled={disabled}\n style={style}\n >\n {label}\n </CheckboxControl>\n );\n}\n\n/** An on/off setting of the form (`boolean`): its label and hint beside the system's switch. */\nexport function Switch({ name, label, hint, disabled, style }: Base) {\n const f = useKrizakaField<boolean>(name);\n const { theme } = useTheme();\n return (\n <View style={[styles.switchRow, style]}>\n <View style={styles.switchText}>\n <Txt variant=\"label\">{label}</Txt>\n {f.error ? (\n <Txt variant=\"caption\" tone=\"danger\" role=\"alert\">\n {f.error}\n </Txt>\n ) : hint ? (\n <Txt variant=\"caption\" tone=\"secondary\">\n {hint}\n </Txt>\n ) : null}\n </View>\n <SwitchControl\n aria-label={label}\n accessibilityHint={f.error ?? hint}\n value={f.value === true}\n disabled={disabled}\n onValueChange={(on) => {\n f.setValue(on);\n f.onBlur();\n }}\n trackColor={{ false: theme.surface3, true: theme.accent }}\n thumbColor={theme.textOnMedia}\n {...{ activeThumbColor: theme.textOnMedia }}\n ios_backgroundColor={theme.surface3}\n />\n </View>\n );\n}\n\n/** A choice of the form: the value stored and its words (passed translated). */\nexport type FormOption = { value: string; label: string; disabled?: boolean };\n\nexport type RadioGroupProps = Base & {\n /** The choices, as chips (one chosen). */\n options: readonly FormOption[];\n /** Scrolls the chips sideways instead of wrapping them (many choices). */\n scrollable?: boolean;\n};\n\n/** One choice among a few, as chips (a radio group). On native, `Select` is the same control. */\nexport function RadioGroup({ name, label, hint, disabled, style, options, scrollable }: RadioGroupProps) {\n const f = useKrizakaField<string>(name);\n return (\n <View style={[styles.field, style]}>\n <Txt variant=\"caption\" tone=\"secondary\" style={styles.groupLabel}>\n {label}\n </Txt>\n <Chip.Group\n type=\"single\"\n aria-label={label}\n value={f.value ?? \"\"}\n disabled={disabled}\n scrollable={scrollable}\n onValueChange={(v) => {\n f.setValue(v);\n f.onBlur();\n }}\n >\n {options.map((o) => (\n <Chip key={o.value} value={o.value} disabled={o.disabled}>\n {o.label}\n </Chip>\n ))}\n </Chip.Group>\n {f.error ? (\n <Txt variant=\"caption\" tone=\"danger\" role=\"alert\">\n {f.error}\n </Txt>\n ) : hint ? (\n <Txt variant=\"caption\" tone=\"secondary\">\n {hint}\n </Txt>\n ) : null}\n </View>\n );\n}\n\n/** One choice among several (the web's `<select>`): chips on native, scrolled sideways when they are many. */\nexport function Select(props: RadioGroupProps) {\n return <RadioGroup scrollable={props.options.length > 4} {...props} />;\n}\n\nexport type DateFieldProps = Base & {\n /** The names of the boxes (`day`, `month`, `year`), passed translated. */\n labels?: Partial<DateFieldLabels>;\n /** `bday` for a date of birth. */\n autoComplete?: \"bday\" | \"off\";\n};\n\n/** A date of the form (`YYYY-MM-DD`): day, month and year typed in the locale's order — the schema checks it. */\nexport function DateField({ name, label, hint, disabled, style, labels, autoComplete }: DateFieldProps) {\n const f = useKrizakaField<string>(name);\n const chained = useChained({});\n return <DateFieldControl {...chained} returnKeyType={chained.returnKeyType} label={label} hint={hint} error={f.error} disabled={disabled} style={style} labels={labels} autoComplete={autoComplete} locale={f.locale} value={f.value ?? \"\"} onValueChange={(v) => f.setValue(v)} onBlur={f.onBlur} />;\n}\n\nexport type MoneyProps = Base & {\n /** The currency (ISO 4217): its sign beside the amount, its decimals. */\n currency: string;\n /** An example of an amount, passed translated. */\n placeholder?: string;\n};\n\n/** An amount of the form, stored as integer minor units (cents), typed on the decimal keypad the locale's way. */\nexport function Money({ name, label, hint, disabled, style, currency, placeholder }: MoneyProps) {\n const f = useKrizakaField<number | null>(name);\n const [text, setText] = React.useState(() => moneyInputText(f.value, currency, f.locale));\n const [editing, setEditing] = React.useState(false);\n const chained = useChained({});\n return (\n <TextFieldControl\n {...chained}\n label={label}\n hint={hint}\n error={f.error}\n disabled={disabled}\n style={style}\n placeholder={placeholder}\n keyboardType=\"decimal-pad\"\n value={editing ? text : moneyInputText(f.value, currency, f.locale)}\n end={<Txt tone=\"secondary\">{currencySymbol(currency, f.locale)}</Txt>}\n onFocus={() => {\n setText(moneyInputText(f.value, currency, f.locale));\n setEditing(true);\n }}\n onValueChange={(next) => {\n setText(next);\n const units = parseMoney(next, currency, f.locale);\n f.setValue(units === undefined ? null : units === null ? Number.NaN : units);\n }}\n onBlur={() => {\n setEditing(false);\n f.onBlur();\n }}\n />\n );\n}\n\nexport type FormFieldProps<T = unknown> = {\n /** The field's name in the schema (typed by the form). */\n name: string;\n /** Checks the value on the server as it changes. */\n validateAsync?: FieldCheck<T>;\n /** The wait, in ms, before `validateAsync`. */\n asyncDebounceMs?: number;\n /** Draws the field: its value, setter, error (`useKrizakaField`). */\n children: (field: KrizakaField<T>) => React.ReactNode;\n};\n\n/** A field drawn by the app (a control the package does not have). */\nexport function FormField({ name, validateAsync, asyncDebounceMs, children }: FormFieldProps) {\n return <>{children(useKrizakaField(name, { validateAsync, asyncDebounceMs }))}</>;\n}\n\nexport type FieldArrayProps<T = unknown> = {\n /** The array's name in the schema (typed by the form). */\n name: string;\n /** Draws the items: `items`, `push`, `remove`, `move`, `fieldName(i, \"url\")`. */\n children: (array: KrizakaFieldArray<T>) => React.ReactNode;\n};\n\n/** A list of fields that grows and shrinks: each item's fields named `links[0].url`. */\nexport function FieldArray({ name, children }: FieldArrayProps) {\n return <>{children(useKrizakaFieldArray(name))}</>;\n}\n\nexport type WatchProps<T = unknown> = {\n /** The field to follow (typed by the form). */\n name: string;\n /** Draws from its current value. */\n children: (value: T) => React.ReactNode;\n};\n\n/** Renders from a field's current value (a part shown only when a choice is made). */\nexport function Watch({ name, children }: WatchProps) {\n return <>{children(useFormValue(name))}</>;\n}\n\nconst fields = { TextField, TextArea, Checkbox, Switch, RadioGroup, Select, DateField, Money, Field: FormField, FieldArray, Watch, Submit, FormError };\n\n/** A form, defined once — the same schema and defaults as the web (`packages/core` of a product) — on native fields. */\nexport const createKrizakaForm = makeCreateKrizakaForm(fields, FormRoot);\n\nexport { useFormContext, useFormStatus, useFormValue, useKrizakaField, useKrizakaFieldArray };\nexport type { FieldCheck, KrizakaField, KrizakaFieldArray };\nexport { isRealDate, latestBirthDate } from \"../date-picker/parts\";\nexport type { FormActionResult, FormOutput, FormSchema, FormValues, KrizakaFormFactory, KrizakaFormInstance } from \"../form/core\";\nexport { type FormFieldError, type FormI18n, formMessage, formMessages, type FormProblem } from \"../form/errors\";\n\nconst styles = StyleSheet.create({\n form: { gap: 16, alignSelf: \"stretch\" },\n screen: { flex: 1, alignSelf: \"stretch\" },\n field: { gap: 6, alignSelf: \"stretch\" },\n suggestion: { alignSelf: \"flex-start\", minHeight: 32, justifyContent: \"center\" },\n alert: { borderWidth: 1, padding: 12, gap: 4 },\n switchRow: { flexDirection: \"row\", alignItems: \"center\", justifyContent: \"space-between\", gap: 16, minHeight: 44 },\n switchText: { flex: 1, gap: 2 },\n groupLabel: { fontWeight: \"600\" },\n});\n","// Platform-neutral React (web and React Native): the engine of a Krizaka form, TanStack Form v1 behind the facade\n// (ADR-001: a product never imports @tanstack/*). A form = a Standard Schema (zod 4) + its default values; the schema\n// validates every change, an error shows once the person leaves the field or tries to send (and goes as soon as it is\n// fixed), a field may check a value on the server (debounced, aborted when the value changes), and a refusal of the\n// server (Problem Details `fields`) lands under its fields. The fields themselves are the platform's (web.tsx, native).\nimport { type AnyFieldApi, type AnyFormApi, type DeepKeys, type StandardSchemaV1, useField, useForm, useStore } from \"@tanstack/react-form\";\nimport * as React from \"react\";\n\nimport { type FormFieldError, type FormI18n, formMessage, type FormProblem, isFormProblem, issuesToFields, problemToErrors, type SchemaIssue } from \"./errors\";\n\n/** A schema the form validates with: any Standard Schema — zod 4 (`z.object`), valibot, arktype. */\nexport type FormSchema<Input = unknown, Output = Input> = StandardSchemaV1<Input, Output>;\n/** The values a form holds: the schema's input. */\nexport type FormValues<S> = S extends { readonly \"~standard\": { readonly types?: { readonly input: infer I } } } ? I : never;\n/** The values a form sends: the schema's output (zod transforms applied). */\nexport type FormOutput<S> = S extends { readonly \"~standard\": { readonly types?: { readonly output: infer O } } } ? O : never;\n/** A field's name: `email`, `address.city`, `links[0].url`. */\nexport type FieldName<V> = DeepKeys<V> & string;\n\n/** What a Server Action (or any submit) answers: done, or a refusal the form shows. */\nexport type FormActionResult<T = unknown> = { ok: true; data?: T } | { ok: false; problem: FormProblem };\n\n/** A value checked on the server as it is typed: an error (or its key), or nothing when the value is fine. */\nexport type FieldCheck<T = unknown> = (value: T, signal: AbortSignal) => Promise<FormFieldError | string | null | undefined> | FormFieldError | string | null | undefined;\n\nexport interface KrizakaFormDefinition<S extends FormSchema> {\n /** The schema of the values (zod 4): the same one the server parses with. */\n schema: S;\n /** The values at first: every field of the schema. */\n defaultValues: FormValues<S>;\n /** The words: the app's translate function, the key prefixes, the locale. */\n i18n?: FormI18n;\n}\n\nexport interface UseKrizakaFormOptions<S extends FormSchema, R = unknown> {\n /** Sends the values (the schema's output): a mutation of @krizaka/query, a Server Action. Throw a `KrizakaApiError` or\n * return `{ ok: false, problem }` to refuse: its `fields` go under their fields, the rest above the button. */\n onSubmit?: (values: FormOutput<S>) => R | Promise<R>;\n /** Called after a successful submit with what `onSubmit` returned (`data` of a `{ ok: true, data }`). */\n onSuccess?: (result: R extends FormActionResult<infer T> ? T | undefined : R) => void;\n /** Values that replace the definition's (a profile loaded from the server). */\n defaultValues?: FormValues<S>;\n /** Overrides the definition's words (the translate function of a hook). */\n i18n?: FormI18n;\n /** The server's codes that belong to a field (`{ UNDERAGE: \"dateOfBirth\", USERNAME_RESERVED: \"username\" }`): a refusal\n * with that code shows under the field, as `form.errors.<CODE>`, instead of above the button. */\n codeFields?: Readonly<Record<string, string>>;\n}\n\n/** The state of a form, for its fields and its button. */\nexport interface FormContextValue {\n /** TanStack's form, through the facade: never import @tanstack/* in a product. */\n readonly api: AnyFormApi;\n readonly i18n: FormI18n;\n /** The whole form's error (a refusal without a field), or null. */\n readonly error: FormFieldError | null;\n /** Sends the form: validates, focuses (web) or announces (native) the first error, else calls `onSubmit`. */\n readonly submit: () => Promise<boolean>;\n}\n\nexport const FormContext = React.createContext<FormContextValue | null>(null);\n\n/** The form around a field: inside `form.Form`. */\nexport function useFormContext(): FormContextValue {\n const ctx = React.useContext(FormContext);\n if (!ctx) throw new Error(\"A Krizaka form field must be inside its form's `form.Form`.\");\n return ctx;\n}\n\ntype StandardResult = { readonly value?: unknown; readonly issues?: readonly SchemaIssue[] };\n\nconst run = (schema: FormSchema, value: unknown) => schema[\"~standard\"].validate(value) as StandardResult | Promise<StandardResult>;\n\n/** The engine of a form: TanStack's form wired to the schema, the server's refusals and the submit. */\nexport function useKrizakaFormCore<S extends FormSchema, R>(definition: KrizakaFormDefinition<S>, options: UseKrizakaFormOptions<S, R> = {}): FormContextValue {\n const i18n = { ...definition.i18n, ...options.i18n };\n const latest = React.useRef({ options, i18n });\n // The latest options for the engine's callbacks (a submit, a change), which outlive the render that made them.\n React.useLayoutEffect(() => {\n latest.current = { options, i18n };\n });\n const [error, setError] = React.useState<FormFieldError | null>(null);\n const refused = React.useRef(false);\n\n const api = useForm({\n defaultValues: options.defaultValues ?? definition.defaultValues,\n validators: {\n // Every change: the schema, synchronously (an async refinement waits for the submit). Errors are computed for\n // every field; each field shows its own once the person left it or tried to send.\n onChange: ({ value }: { value: unknown }) => {\n const result = run(definition.schema, value);\n if (result instanceof Promise || !result.issues?.length) return undefined;\n const fields = issuesToFields(result.issues, latest.current.i18n.prefix);\n delete fields[\"\"];\n return { fields };\n },\n },\n onSubmit: async ({ value }: { value: unknown }) => {\n const parsed = await run(definition.schema, value);\n if (parsed.issues?.length) {\n apply({ fields: issuesToFields(parsed.issues, latest.current.i18n.prefix) as FormProblem[\"fields\"] });\n return;\n }\n let result: unknown;\n try {\n result = await latest.current.options.onSubmit?.(parsed.value as FormOutput<S>);\n } catch (thrown) {\n apply(isFormProblem(thrown) ? thrown : { code: \"server\" });\n return;\n }\n if (result && typeof result === \"object\" && \"ok\" in result && (result as FormActionResult).ok === false) {\n apply((result as unknown as { problem: FormProblem }).problem);\n return;\n }\n const data = result && typeof result === \"object\" && \"ok\" in result ? (result as { data?: unknown }).data : result;\n latest.current.options.onSuccess?.(data as never);\n },\n });\n\n const known = (name: string) => name in api.fieldInfo;\n function apply(problem: FormProblem) {\n refused.current = true;\n const { fields, form } = problemToErrors(problem, latest.current.i18n, known, latest.current.options.codeFields);\n for (const [name, fieldError] of Object.entries(fields)) {\n api.setFieldMeta(name as never, (meta) => ({ ...meta, isBlurred: true, errorMap: { ...meta.errorMap, onServer: fieldError } }));\n }\n setError(form);\n }\n\n const submit = React.useCallback(async () => {\n setError(null);\n refused.current = false;\n for (const name of Object.keys(api.fieldInfo)) {\n if ((api.getFieldMeta(name as never) as { errorMap?: Record<string, unknown> } | undefined)?.errorMap?.onServer) api.setFieldMeta(name as never, (meta) => ({ ...meta, errorMap: { ...meta.errorMap, onServer: undefined } }));\n }\n await api.handleSubmit();\n const state = api.state;\n return !refused.current && state.isSubmitSuccessful && state.isValid && !(Object.values(state.fieldMeta) as { errorMap?: Record<string, unknown> }[]).some((meta) => meta?.errorMap?.onServer);\n }, [api]);\n\n return React.useMemo(() => ({ api, i18n, error, submit }), [api, error, submit, i18n.t, i18n.prefix, i18n.apiPrefix, i18n.locale]); // eslint-disable-line react-hooks/exhaustive-deps\n}\n\nconst UNCHECKED = Symbol(\"unchecked\");\n\nexport interface FieldOptions<T> {\n /** Checks the value on the server as it is typed (a username's availability): debounced, aborted when it changes. */\n validateAsync?: FieldCheck<T>;\n /** The wait, in ms, between the last change and `validateAsync`. Default 350. */\n asyncDebounceMs?: number;\n}\n\n/** A field as its component draws it: the value, its setter, its error in words, its state. */\nexport interface KrizakaField<T = unknown> {\n /** The id of the control (`htmlFor` of its label). */\n readonly id: string;\n readonly name: string;\n readonly value: T;\n /** Sets the value (clears a refusal of the server on it). */\n setValue(value: T): void;\n /** Call when the control loses focus: from then on, its errors show. */\n readonly onBlur: () => void;\n /** The error to show, in words — only once it should show. */\n readonly error: string | undefined;\n /** The error itself, with its suggestion. */\n readonly errorDetail: FormFieldError | undefined;\n /** A check (`validateAsync`) is running. */\n readonly validating: boolean;\n /** The check passed for the current value. */\n readonly available: boolean;\n /** The ids of the hint and the error (`aria-describedby`). */\n readonly hintId: string;\n readonly errorId: string;\n /** The form's locale (numbers, money, dates). */\n readonly locale: string;\n /** TanStack's field, through the facade. */\n readonly api: AnyFieldApi;\n}\n\n/** Binds a field of the form around it (inside `form.Form`): what the platform's field components are made of. */\nexport function useKrizakaField<T = unknown>(name: string, options: FieldOptions<T> = {}): KrizakaField<T> {\n const ctx = useFormContext();\n const id = React.useId();\n const [checked, setChecked] = React.useState<unknown>(UNCHECKED);\n const check = options.validateAsync;\n const field = useField({\n form: ctx.api,\n name: name as never,\n ...(check\n ? {\n asyncDebounceMs: options.asyncDebounceMs ?? 350,\n validators: {\n onChangeAsyncDebounceMs: options.asyncDebounceMs ?? 350,\n onChangeAsync: async ({ value, signal }: { value: T; signal: AbortSignal }) => {\n const answer = await check(value, signal);\n if (signal.aborted) return undefined;\n if (!answer) {\n setChecked(value);\n return undefined;\n }\n setChecked(UNCHECKED);\n const error = typeof answer === \"string\" ? { key: answer } : answer;\n return { ...error, immediate: true, source: \"check\" } satisfies FormFieldError;\n },\n },\n }\n : {}),\n } as never) as unknown as AnyFieldApi;\n const attempts = useStore(ctx.api.store, (state: { submissionAttempts: number }) => state.submissionAttempts);\n const meta = field.state.meta;\n const map = meta.errorMap as Record<string, unknown>;\n const all = [map.onServer, map.onChange, map.onBlur, map.onSubmit, map.onMount].filter(Boolean) as (FormFieldError | string)[];\n const first = all[0];\n const detail = typeof first === \"string\" ? { key: first } : first;\n const visible = detail && (detail.immediate || detail.source === \"server\" || meta.isBlurred || attempts > 0) ? detail : undefined;\n const value = field.state.value as T;\n\n return {\n id,\n name,\n value,\n setValue: (next: T) => {\n if (map.onServer) ctx.api.setFieldMeta(name as never, (m: { errorMap: Record<string, unknown> }) => ({ ...m, errorMap: { ...m.errorMap, onServer: undefined } }) as never);\n field.handleChange(next as never);\n },\n onBlur: () => field.handleBlur(),\n error: visible ? formMessage(visible, ctx.i18n) : undefined,\n errorDetail: visible,\n validating: Boolean(meta.isValidating),\n available: Boolean(check) && checked !== UNCHECKED && Object.is(checked, value) && !meta.isValidating && all.length === 0,\n hintId: `${id}-hint`,\n errorId: `${id}-error`,\n locale: ctx.i18n.locale ?? \"en\",\n api: field,\n };\n}\n\n/** The array of a field array, with its operations (`form.FieldArray`). */\nexport interface KrizakaFieldArray<T = unknown> {\n readonly name: string;\n readonly items: readonly T[];\n /** Adds an item at the end. */\n readonly push: (item: T) => void;\n /** Removes the item at `index`. */\n readonly remove: (index: number) => void;\n /** Moves an item. */\n readonly move: (from: number, to: number) => void;\n /** The name of a sub-field of an item: `name(0, \"url\")` → `links[0].url`. */\n readonly fieldName: (index: number, key?: string) => string;\n /** The error of the array itself (too few, too many), in words, once it should show. */\n readonly error: string | undefined;\n}\n\n/** Binds an array of the form (a list of links, of tiers): its items and their operations. */\nexport function useKrizakaFieldArray<T = unknown>(name: string): KrizakaFieldArray<T> {\n const ctx = useFormContext();\n const field = useField({ form: ctx.api, name: name as never, mode: \"array\" } as never) as unknown as AnyFieldApi;\n const attempts = useStore(ctx.api.store, (state: { submissionAttempts: number }) => state.submissionAttempts);\n const map = field.state.meta.errorMap as Record<string, FormFieldError | undefined>;\n const first = map.onServer ?? map.onChange ?? map.onSubmit;\n return {\n name,\n items: (field.state.value as T[] | undefined) ?? [],\n push: (item) => field.pushValue(item as never),\n remove: (index) => void field.removeValue(index),\n move: (from, to) => field.moveValue(from, to),\n fieldName: (index, key) => `${name}[${index}]${key ? `.${key}` : \"\"}`,\n error: first && (attempts > 0 || first.source === \"server\" || field.state.meta.isDirty) ? formMessage(first, ctx.i18n) : undefined,\n };\n}\n\n/** The value of a field, kept up to date (`form.Watch`): show a part of the form only when a box is ticked. */\nexport function useFormValue<T = unknown>(name: string): T {\n const ctx = useFormContext();\n return useStore(ctx.api.store, (state: { values: unknown }) => getPath(state.values, name)) as T;\n}\n\n/** The state of the submit, for a button: sending, and whether the last try succeeded. */\nexport function useFormStatus(): { submitting: boolean; succeeded: boolean; attempts: number } {\n const ctx = useFormContext();\n const submitting = useStore(ctx.api.store, (s: { isSubmitting: boolean }) => s.isSubmitting);\n const succeeded = useStore(ctx.api.store, (s: { isSubmitSuccessful: boolean }) => s.isSubmitSuccessful);\n const attempts = useStore(ctx.api.store, (s: { submissionAttempts: number }) => s.submissionAttempts);\n return { submitting, succeeded: succeeded && !ctx.error, attempts };\n}\n\nfunction getPath(source: unknown, path: string): unknown {\n let current = source;\n for (const part of path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\")) {\n if (current === null || typeof current !== \"object\") return undefined;\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/** The first visible error of a form, in words (native: announced after a refused submit). */\nexport function firstVisibleError(ctx: FormContextValue): string | undefined {\n if (ctx.error) return formMessage(ctx.error, ctx.i18n);\n for (const meta of Object.values(ctx.api.state.fieldMeta) as { errorMap?: Record<string, FormFieldError | string | undefined> }[]) {\n const error = meta?.errorMap && Object.values(meta.errorMap).find(Boolean);\n if (error) return formMessage(error, ctx.i18n);\n }\n return undefined;\n}\n\n/** The platform's components, typed by the form's field names: `name` completes and is checked against the schema. */\nexport type BoundFields<C, N extends string> = {\n [K in keyof C]: C[K] extends (props: infer P) => infer R ? (P extends { name: string } ? (props: Omit<P, \"name\"> & { name: N }) => R : C[K]) : C[K];\n};\n\n/** A form in a component: its fields (typed by the schema), its submit and its state. */\nexport type KrizakaFormInstance<S extends FormSchema, C, RootProps> = BoundFields<C, FieldName<FormValues<S>>> & {\n /** The form element (web) or view (native): renders its fields and provides them the form. */\n Form: (props: RootProps) => React.ReactElement;\n /** Sends the form (what `Submit` does): `true` when it went through. */\n submit: () => Promise<boolean>;\n /** Back to the default values (or the given ones), errors cleared. */\n reset: (values?: FormValues<S>) => void;\n /** Sets a field's value from outside (a suggestion, a preset). */\n setValue: (name: FieldName<FormValues<S>>, value: unknown) => void;\n /** The values now. */\n getValues: () => FormValues<S>;\n /** The whole form's error (a refusal without a field), or null. */\n error: FormFieldError | null;\n /** TanStack's form, the escape hatch — never import @tanstack/* in a product. */\n api: AnyFormApi;\n};\n\n/** A form defined once (schema + defaults), used in components: `signUp.useForm({ onSubmit })`. */\nexport interface KrizakaFormFactory<S extends FormSchema, C, RootProps> {\n readonly schema: S;\n readonly defaultValues: FormValues<S>;\n /** The form in a component: `onSubmit` sends the values (a mutation), a thrown `KrizakaApiError` lands on the fields. */\n useForm<R = unknown>(options?: UseKrizakaFormOptions<S, R>): KrizakaFormInstance<S, C, RootProps>;\n /** The form sent by a Server Action: it receives the values and answers `{ ok: true, data }` or `{ ok: false, problem }`. */\n useFormWithAction<T = unknown>(action: (values: FormOutput<S>) => Promise<FormActionResult<T>>, options?: Omit<UseKrizakaFormOptions<S, FormActionResult<T>>, \"onSubmit\">): KrizakaFormInstance<S, C, RootProps>;\n}\n\n/** Builds a platform's `createKrizakaForm` from its field components and its root (web `<form>`, native `View`). */\nexport function makeCreateKrizakaForm<C extends object, RootProps extends object>(components: C, Root: (props: RootProps & { value: FormContextValue }) => React.ReactElement) {\n return function createKrizakaForm<S extends FormSchema>(definition: KrizakaFormDefinition<S>): KrizakaFormFactory<S, C, RootProps> {\n function useForm<R>(options?: UseKrizakaFormOptions<S, R>): KrizakaFormInstance<S, C, RootProps> {\n const ctx = useKrizakaFormCore(definition, options);\n // One `Form` for the life of the form (never remounted, so focus and fields stay): it reads the latest state from a\n // small store the hook updates.\n const [store] = React.useState(() => createStore(ctx));\n React.useLayoutEffect(() => store.set(ctx), [store, ctx]);\n const Form = React.useCallback((props: RootProps) => <Bound store={store} Root={Root} props={props} />, [store]);\n return React.useMemo(\n () =>\n ({\n ...components,\n Form,\n submit: ctx.submit,\n reset: (values?: FormValues<S>) => ctx.api.reset(values),\n setValue: (name: string, value: unknown) => ctx.api.setFieldValue(name as never, value as never),\n getValues: () => ctx.api.state.values as FormValues<S>,\n error: ctx.error,\n api: ctx.api,\n }) as unknown as KrizakaFormInstance<S, C, RootProps>,\n [ctx, Form],\n );\n }\n return {\n schema: definition.schema,\n defaultValues: definition.defaultValues,\n useForm,\n useFormWithAction: (action, options) => useForm({ ...options, onSubmit: action }),\n };\n };\n}\n\ntype Store<T> = { get: () => T; set: (value: T) => void; subscribe: (listener: () => void) => () => void };\n\nfunction createStore<T>(initial: T): Store<T> {\n let value = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => value,\n set: (next) => {\n if (Object.is(next, value)) return;\n value = next;\n listeners.forEach((listener) => listener());\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n\nfunction Bound<RootProps extends object>({ store, Root, props }: { store: Store<FormContextValue>; Root: (props: RootProps & { value: FormContextValue }) => React.ReactElement; props: RootProps }) {\n const value = React.useSyncExternalStore(store.subscribe, store.get, store.get);\n return <Root {...props} value={value} />;\n}\n","// Platform-neutral and server-safe: no React, no DOM, no React Native. The errors of a Krizaka form — a schema's issues,\n// a server's Problem Details, an availability check — as one shape, `FormFieldError`, whose words come from a key of the\n// app's catalogue (`form.errors.tooShort`), never from the validation engine's English.\n\n/** A value a message placeholder takes (`{minimum}`, `{suggestion}`). */\nexport type FormMessageValue = string | number;\n\n/** An error of a field or of the whole form: the key of its words in the app's catalogue, and what fills them in. */\nexport interface FormFieldError {\n /** The i18n key: `form.errors.required`, or the key a schema names (`z.string().min(3, \"signUp.username.short\")`). */\n key: string;\n /** The placeholders of the message (`{ minimum: 3 }`). */\n values?: Readonly<Record<string, FormMessageValue>>;\n /** The server's own words, in English: shown only when the catalogue has no message for the key. */\n message?: string;\n /** A value to offer instead (a free username): a button under the error sets it. Its label is passed translated. */\n suggestion?: { readonly label: string; readonly value: unknown };\n /** Shown at once, while the person types (an availability check), not only once they leave the field. */\n immediate?: boolean;\n /** Where it comes from: the schema (default), a field's check, or the server's answer (kept until the field changes). */\n source?: \"schema\" | \"check\" | \"server\";\n}\n\n/** The English defaults of the generic errors, by code — the words a form shows when the app's catalogue has none. */\nexport const formMessages: Readonly<Record<string, string>> = {\n required: \"This field is required.\",\n tooShort: \"Use at least {minimum} characters.\",\n tooLong: \"Use at most {maximum} characters.\",\n tooSmall: \"Enter {minimum} or more.\",\n tooBig: \"Enter {maximum} or less.\",\n tooFew: \"Choose at least {minimum}.\",\n tooMany: \"Choose at most {maximum}.\",\n invalidEmail: \"Enter an e-mail address, like name@example.com.\",\n invalidUrl: \"Enter a web address, like https://example.com.\",\n invalidDate: \"Enter a real date.\",\n invalidNumber: \"Enter a number.\",\n invalidFormat: \"Check the format of this field.\",\n invalidChoice: \"Choose one of the options.\",\n invalid: \"Check this field.\",\n // The whole form (a server's answer without fields): the codes of @krizaka/query's KrizakaApiError.\n network: \"No connection. Check your network and try again.\",\n \"rate-limited\": \"Too many tries. Wait a moment and try again.\",\n unauthorized: \"Your session has ended. Sign in again.\",\n forbidden: \"You are not allowed to do this.\",\n conflict: \"This was changed meanwhile. Reload and try again.\",\n \"validation-failed\": \"Some fields need your attention.\",\n unavailable: \"The service is unavailable for a moment. Try again shortly.\",\n server: \"Something went wrong on our side. Try again.\",\n};\n\n/** How a form finds its words: the app's translate function, and the prefixes of its keys. */\nexport interface FormI18n {\n /** The app's translate function (`(key, values) => t(key, values)`): a string, or `undefined` when the key is missing. */\n t?: (key: string, values?: Readonly<Record<string, FormMessageValue>>) => string | undefined;\n /** The prefix of the generic field errors. Default `form.errors` (→ `form.errors.tooShort`). */\n prefix?: string;\n /** The prefix of the server's codes for the whole form, as `KrizakaApiError.messageKey()`. Default `apiErrors`. */\n apiPrefix?: string;\n /** The locale of numbers, money and dates. Default `en`. */\n locale?: string;\n}\n\nconst KEY = /^[\\w-]+(\\.[\\w-]+)+$/;\n\nconst fill = (text: string, values?: Readonly<Record<string, FormMessageValue>>) =>\n values ? text.replace(/\\{(\\w+)\\}/g, (all, name: string) => (values[name] === undefined ? all : String(values[name]))) : text;\n\n/** The words of an error: the app's catalogue, else the English default of its code, else the server's words, else the key. */\nexport function formMessage(error: FormFieldError | string, i18n: FormI18n = {}): string {\n const e = typeof error === \"string\" ? { key: error } : error;\n const translated = i18n.t?.(e.key, e.values);\n if (translated && translated !== e.key) return translated;\n const code = e.key.slice(e.key.lastIndexOf(\".\") + 1);\n const fallback = formMessages[code];\n // The server's words beat a generic default (a refusal without a code), never a default for its own code.\n if (e.message && (code === \"invalid\" || !fallback)) return e.message;\n if (fallback && (e.key.startsWith(`${i18n.prefix ?? \"form.errors\"}.`) || e.key.startsWith(`${i18n.apiPrefix ?? \"apiErrors\"}.`))) return fill(fallback, e.values);\n return e.message ?? (KEY.test(e.key) ? fill(fallback ?? formMessages.invalid!, e.values) : e.key);\n}\n\n/** One issue of a Standard Schema (zod 4, valibot, arktype): zod adds its `code` and limits, read when present. */\nexport interface SchemaIssue {\n readonly message: string;\n readonly path?: ReadonlyArray<PropertyKey | { readonly key: PropertyKey }>;\n readonly code?: string;\n readonly minimum?: number | bigint;\n readonly maximum?: number | bigint;\n readonly origin?: string;\n readonly format?: string;\n readonly input?: unknown;\n readonly expected?: string;\n}\n\n/** A field's name from an issue's path, as the form writes it: `links[0].url`. */\nexport function pathName(path: SchemaIssue[\"path\"]): string {\n let name = \"\";\n for (const part of path ?? []) {\n const key = typeof part === \"object\" && part !== null ? part.key : part;\n if (typeof key === \"number\") name += `[${key}]`;\n else name += name ? `.${String(key)}` : String(key);\n }\n return name;\n}\n\nconst num = (value: number | bigint | undefined) => (value === undefined ? undefined : Number(value));\n\n/** The key and values of an issue: the schema's own key when it names one, else the generic code of what failed. */\nexport function issueError(issue: SchemaIssue, prefix = \"form.errors\"): FormFieldError {\n if (KEY.test(issue.message)) return { key: issue.message };\n const key = (code: string, values?: Record<string, FormMessageValue>) => ({ key: `${prefix}.${code}`, ...(values ? { values } : {}) });\n const collection = issue.origin === \"array\" || issue.origin === \"set\";\n switch (issue.code) {\n case \"invalid_type\":\n return issue.input === undefined || issue.input === null || issue.input === \"\" ? key(\"required\") : issue.expected === \"number\" ? key(\"invalidNumber\") : issue.expected === \"date\" ? key(\"invalidDate\") : key(\"invalid\");\n case \"too_small\": {\n const minimum = num(issue.minimum)!;\n if (issue.origin === \"string\") return minimum <= 1 ? key(\"required\") : key(\"tooShort\", { minimum });\n if (collection) return minimum <= 1 ? key(\"required\") : key(\"tooFew\", { minimum });\n return key(\"tooSmall\", { minimum });\n }\n case \"too_big\": {\n const maximum = num(issue.maximum)!;\n return issue.origin === \"string\" ? key(\"tooLong\", { maximum }) : collection ? key(\"tooMany\", { maximum }) : key(\"tooBig\", { maximum });\n }\n case \"invalid_format\":\n if (issue.format === \"email\") return key(\"invalidEmail\");\n if (issue.format === \"url\") return key(\"invalidUrl\");\n if (issue.format === \"date\" || issue.format === \"datetime\") return key(\"invalidDate\");\n return key(\"invalidFormat\");\n case \"invalid_value\":\n // `z.literal(true)`: a box that must be ticked.\n return issue.input === false || issue.input === undefined ? key(\"required\") : key(\"invalidChoice\");\n case \"invalid_union\":\n case \"invalid_key\":\n case \"invalid_element\":\n return key(\"invalidChoice\");\n default:\n return key(\"invalid\");\n }\n}\n\n/** The first error of each field of a schema's issues (an issue without a path is the whole form's: `\"\"`). */\nexport function issuesToFields(issues: readonly SchemaIssue[], prefix?: string): Record<string, FormFieldError> {\n const fields: Record<string, FormFieldError> = {};\n for (const issue of issues) {\n const name = pathName(issue.path);\n if (!(name in fields)) fields[name] = { ...issueError(issue, prefix), source: \"schema\" };\n }\n return fields;\n}\n\n/**\n * A refusal the form shows, serialisable (a Server Action returns it): the shape of `KrizakaApiError` of @krizaka/query —\n * a `KrizakaApiError` *is* a `FormProblem`. `fields` go under their fields, the rest above the submit button.\n */\nexport interface FormProblem {\n /** The HTTP status (0 when no response arrived). */\n status?: number;\n /** The stable code of the refusal (`rate-limited`, `conflict`, `ACCOUNT_EXISTS`): the key of its words. */\n code?: string;\n /** The server's sentence, in English: shown only when the catalogue has no message for the code. */\n detail?: string;\n /** The refused fields, by name: a server's `{ code, message }`, or an error the form already knows (`key`). */\n fields?: Readonly<Record<string, { code?: string; message: string } | FormFieldError | string>>;\n /** Epoch ms before which the same call is refused (a 429). */\n retryAt?: number;\n}\n\n/** True for what a form can read as a problem: a `KrizakaApiError`, a `FormProblem`, an `{ ok: false, problem }` result. */\nexport function isFormProblem(value: unknown): value is FormProblem {\n return typeof value === \"object\" && value !== null && (\"fields\" in value || \"code\" in value || \"status\" in value);\n}\n\n/** A problem as field errors (by name) and the whole form's error (or `null` when every refusal has its field). */\nexport function problemToErrors(\n problem: FormProblem,\n i18n: FormI18n = {},\n known?: (name: string) => boolean,\n codeFields: Readonly<Record<string, string>> = {},\n): { fields: Record<string, FormFieldError>; form: FormFieldError | null } {\n const prefix = i18n.prefix ?? \"form.errors\";\n const fields: Record<string, FormFieldError> = {};\n let unplaced = false;\n // A refusal named by a code that belongs to a field (`UNDERAGE` → `dateOfBirth`): under that field, in its words.\n const owner = problem.code ? codeFields[problem.code] : undefined;\n if (owner && (!known || known(owner)) && !problem.fields?.[owner]) {\n fields[owner] = { key: `${prefix}.${problem.code}`, ...(problem.detail ? { message: problem.detail } : {}), source: \"server\" };\n if (!problem.fields || Object.keys(problem.fields).length === 0) return { fields, form: null };\n }\n for (const [name, refusal] of Object.entries(problem.fields ?? {})) {\n if (known && !known(name)) {\n unplaced = true;\n continue;\n }\n const error: FormFieldError =\n typeof refusal === \"string\"\n ? { key: refusal }\n : \"key\" in refusal\n ? refusal\n : { key: refusal.code ? (KEY.test(refusal.code) ? refusal.code : `${prefix}.${refusal.code}`) : `${prefix}.invalid`, message: refusal.message };\n fields[name] = { ...error, source: \"server\" };\n }\n const placed = Object.keys(fields).length > 0;\n if (placed && !unplaced) return { fields, form: null };\n const code = problem.code ?? (problem.status === 0 ? \"network\" : problem.status && problem.status >= 500 ? \"server\" : \"invalid\");\n const retryIn = problem.retryAt ? Math.max(1, Math.ceil((problem.retryAt - Date.now()) / 1000)) : undefined;\n return {\n fields,\n form: { key: KEY.test(code) ? code : `${i18n.apiPrefix ?? \"apiErrors\"}.${code}`, ...(problem.detail ? { message: problem.detail } : {}), ...(retryIn ? { values: { seconds: retryIn } } : {}), source: \"server\" },\n };\n}\n","// Platform-neutral: an amount typed in a field ↔ integer minor units (cents), never a float on the way.\nimport { currencyDigits } from \"@krizaka/intl\";\n\n/** The decimal separator of a locale (`en` → `.`, `fr` → `,`). */\nexport function decimalSeparator(locale: string): string {\n return new Intl.NumberFormat(locale).formatToParts(1.5).find((p) => p.type === \"decimal\")?.value ?? \".\";\n}\n\n/** The currency's sign in a locale (`USD`, `en-US` → `$`; `EUR`, `fr` → `€`). */\nexport function currencySymbol(currency: string, locale: string): string {\n return new Intl.NumberFormat(locale, { style: \"currency\", currency }).formatToParts(0).find((p) => p.type === \"currency\")?.value ?? currency;\n}\n\n/**\n * An amount as typed (`12.5`, `12,50`, `1,234.56`, `1 234,56`) → integer minor units (`1250`). `undefined` when empty,\n * `null` when it is not an amount (letters, more decimals than the currency has).\n */\nexport function parseMoney(text: string, currency: string, locale = \"en\"): number | null | undefined {\n const digits = currencyDigits(currency);\n const t = text.replace(/[\\s\\u00a0\\u202f']/g, \"\");\n if (!t) return undefined;\n const negative = t.startsWith(\"-\");\n const body = negative ? t.slice(1) : t;\n if (!/^[\\d.,]+$/.test(body)) return null;\n let int = body;\n let frac = \"\";\n const last = Math.max(body.lastIndexOf(\".\"), body.lastIndexOf(\",\"));\n if (last >= 0) {\n const tail = body.slice(last + 1);\n // The last separator is the decimal one when it is the locale's, or when it is not followed by a group of three.\n if (body[last] === decimalSeparator(locale) || tail.length !== 3) {\n if (tail.length > digits || !/^\\d*$/.test(tail)) return null;\n int = body.slice(0, last);\n frac = tail;\n }\n }\n // What is left before the decimals: digits, grouped by three when separated (`1,234,567`).\n if (!/^(\\d*|\\d{1,3}([.,]\\d{3})+)$/.test(int)) return null;\n int = int.replace(/[.,]/g, \"\");\n if (!int && !frac) return null;\n const units = BigInt(int || \"0\") * 10n ** BigInt(digits) + BigInt((frac || \"\").padEnd(digits, \"0\") || \"0\");\n const value = Number(negative ? -units : units);\n return Number.isSafeInteger(value) ? value : null;\n}\n\n/** Minor units as the field writes them while editing (`1250`, `USD`, `fr` → `12,50`): no symbol, no grouping. */\nexport function moneyInputText(minorUnits: number | null | undefined, currency: string, locale = \"en\"): string {\n if (minorUnits === null || minorUnits === undefined || !Number.isFinite(minorUnits)) return \"\";\n const digits = currencyDigits(currency);\n const sign = minorUnits < 0 ? \"-\" : \"\";\n const abs = String(Math.abs(Math.trunc(minorUnits))).padStart(digits + 1, \"0\");\n return digits === 0 ? sign + abs : `${sign}${abs.slice(0, -digits)}${decimalSeparator(locale)}${abs.slice(-digits)}`;\n}\n","// Platform-neutral: a date typed as day, month and year (the native `DateField`, the form's `DateField entry=\"parts\"`).\n// Values are ISO calendar dates, `YYYY-MM-DD`, compared as strings.\n\n/** A part of a typed date. */\nexport type DatePart = \"day\" | \"month\" | \"year\";\n\n/** The digits of each part. */\nexport const DATE_PART_LENGTH: Readonly<Record<DatePart, number>> = { day: 2, month: 2, year: 4 };\n\n/** The order of day, month and year in a locale (`en-US` → month, day, year; `fr` → day, month, year). */\nexport function datePartsOrder(locale: string): DatePart[] {\n try {\n const parts = new Intl.DateTimeFormat(locale, { day: \"2-digit\", month: \"2-digit\", year: \"numeric\" }).formatToParts(new Date(2001, 10, 22));\n const order = parts.map((p) => p.type).filter((t): t is DatePart => t === \"day\" || t === \"month\" || t === \"year\");\n if (order.length === 3) return order;\n } catch {\n // An engine without Intl's parts: day, month, year.\n }\n return [\"day\", \"month\", \"year\"];\n}\n\n/** The ISO-ordered value of what was typed: `\"\"` when nothing is, `YYYY-MM-DD` otherwise (not necessarily a real date). */\nexport function composeDate(parts: Readonly<Record<DatePart, string>>): string {\n if (!parts.day && !parts.month && !parts.year) return \"\";\n const pad = (v: string) => (v.length === 1 ? `0${v}` : v);\n return `${parts.year}-${pad(parts.month)}-${pad(parts.day)}`;\n}\n\n/** The parts of a value (`\"\"` → three empty parts). */\nexport function splitDate(value: string | null | undefined): Record<DatePart, string> {\n const m = /^(\\d*)-(\\d*)-(\\d*)$/.exec(value ?? \"\");\n return m ? { year: m[1]!, month: m[2]!, day: m[3]! } : { day: \"\", month: \"\", year: \"\" };\n}\n\n/** True for a real calendar date written `YYYY-MM-DD` (not `2001-02-30`). */\nexport function isRealDate(value: string): boolean {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return false;\n const date = new Date(`${value}T00:00:00Z`);\n return !Number.isNaN(date.getTime()) && date.toISOString().slice(0, 10) === value;\n}\n\n/** The latest date of birth of someone `age` years old today (`YYYY-MM-DD`): an age gate's `max`, `value <= latestBirthDate(18)`. */\nexport function latestBirthDate(age: number, today = new Date()): string {\n return new Date(Date.UTC(today.getFullYear() - age, today.getMonth(), today.getDate())).toISOString().slice(0, 10);\n}\n\n// ─── Shared by the pickers, web and native (no DOM, no React) ───────────────────────────────────────────────────────\n\n/** The days of a month (`month` 1–12). */\nexport function daysInMonth(year: number, month: number): number {\n return new Date(Date.UTC(year, month, 0)).getUTCDate();\n}\n\n/** `2026-10-11` → `{ year: 2026, month: 10, day: 11 }` (no check: pair it with `isRealDate`). */\nexport function isoParts(iso: string): { year: number; month: number; day: number } {\n const [year = 0, month = 0, day = 0] = iso.split(\"-\").map(Number);\n return { year, month, day };\n}\n\n/** `{ 2026, 10, 11 }` → `2026-10-11`, the day kept inside the month (`2026-02-31` → `2026-02-28`). */\nexport function isoOf(year: number, month: number, day: number): string {\n const d = Math.min(Math.max(day, 1), daysInMonth(year, month));\n return `${String(year).padStart(4, \"0\")}-${String(month).padStart(2, \"0\")}-${String(d).padStart(2, \"0\")}`;\n}\n\n/** The ISO date of today on this device (or of the `Date` given). */\nexport function todayIso(now = new Date()): string {\n return isoOf(now.getFullYear(), now.getMonth() + 1, now.getDate());\n}\n\n/** The age in whole years on `today` of someone born on `birth` (both ISO). */\nexport function ageOn(birth: string, today: string = todayIso()): number {\n const b = isoParts(birth);\n const t = isoParts(today);\n return t.year - b.year - (t.month < b.month || (t.month === b.month && t.day < b.day) ? 1 : 0);\n}\n\n/** The month names of a locale, January first (`long` · `short` · `narrow`). */\nexport function monthNames(locale: string, style: \"long\" | \"short\" | \"narrow\" = \"long\"): string[] {\n const format = new Intl.DateTimeFormat(locale, { month: style, timeZone: \"UTC\" });\n return Array.from({ length: 12 }, (_, i) => format.format(new Date(Date.UTC(2001, i, 1))));\n}\n\n/** The years from `from` to `to`, both included, in that order (descending when `from > to`). */\nexport function yearRange(from: number, to: number): number[] {\n const step = from <= to ? 1 : -1;\n return Array.from({ length: Math.abs(to - from) + 1 }, (_, i) => from + i * step);\n}\n\n/** A time of day, `HH:mm` on 24 hours (`\"09:30\"`, `\"18:00\"`): the value of every time picker. */\nexport type TimeValue = string;\n\n/** `\"9:5\"` / `\"09:05\"` → minutes since midnight; `null` when it is not a time. */\nexport function timeToMinutes(value: string | null | undefined): number | null {\n const m = /^(\\d{1,2}):(\\d{1,2})$/.exec(value ?? \"\");\n if (!m) return null;\n const h = Number(m[1]);\n const min = Number(m[2]);\n return h < 24 && min < 60 ? h * 60 + min : null;\n}\n\n/** Minutes since midnight → `HH:mm`. */\nexport function minutesToTime(minutes: number): TimeValue {\n const m = ((Math.round(minutes) % 1440) + 1440) % 1440;\n return `${String(Math.floor(m / 60)).padStart(2, \"0\")}:${String(m % 60).padStart(2, \"0\")}`;\n}\n\n/** The slots of a day from `start` to `end` (excluded) every `step` minutes: `timeSlots(\"09:00\", \"12:00\", 30)`. */\nexport function timeSlots(start: TimeValue, end: TimeValue, step = 30): TimeValue[] {\n const a = timeToMinutes(start);\n const b = timeToMinutes(end);\n if (a === null || b === null || step <= 0) return [];\n const slots: TimeValue[] = [];\n for (let m = a; m < b; m += step) slots.push(minutesToTime(m));\n return slots;\n}\n\n/** True when the locale writes the time on 12 hours with a day period (`en-US` → true, `fr-CA` → false). */\nexport function uses12Hours(locale: string): boolean {\n try {\n const options = new Intl.DateTimeFormat(locale, { hour: \"numeric\" }).resolvedOptions() as Intl.ResolvedDateTimeFormatOptions & { hourCycle?: string };\n return options.hourCycle ? options.hourCycle === \"h12\" || options.hourCycle === \"h11\" : Boolean(options.hour12);\n } catch {\n return false;\n }\n}\n\n/** The day periods of a locale, morning first (`[\"AM\", \"PM\"]`, `[\"a.m.\", \"p.m.\"]`). */\nexport function dayPeriods(locale: string): [string, string] {\n const format = new Intl.DateTimeFormat(locale, { hour: \"numeric\", hour12: true, timeZone: \"UTC\" });\n const period = (h: number) => format.formatToParts(new Date(Date.UTC(2001, 0, 1, h))).find((p) => p.type === \"dayPeriod\")?.value ?? (h < 12 ? \"AM\" : \"PM\");\n return [period(9), period(15)];\n}\n\n/** A time written the locale's way (`\"18:30\"` → `\"6:30 PM\"` in en-US, `\"18 h 30\"` in fr-CA). */\nexport function formatTime(locale: string, value: TimeValue): string {\n const minutes = timeToMinutes(value);\n if (minutes === null) return \"\";\n return new Intl.DateTimeFormat(locale, { hour: \"numeric\", minute: \"2-digit\", timeZone: \"UTC\" }).format(new Date(Date.UTC(2001, 0, 1, 0, minutes)));\n}\n\n/** A local `Date` at midnight for an ISO date (for formatting). */\nexport const toLocalDate = (iso: string) => {\n const { year, month, day } = isoParts(iso);\n return new Date(year, month - 1, day);\n};\n/** The ISO date of a local `Date`. */\nexport const toIsoDate = (date: Date): string => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}-${String(date.getDate()).padStart(2, \"0\")}`;\n/** The ISO date `days` later (or earlier). */\nexport const addDays = (iso: string, days: number) => {\n const date = toLocalDate(iso);\n date.setDate(date.getDate() + days);\n return toIsoDate(date);\n};\n/** The ISO date `months` later (or earlier), the day kept inside the shorter months (`01-31` + 1 → `02-28`). */\nexport const addMonths = (iso: string, months: number) => {\n const { year, month, day } = isoParts(iso);\n const first = new Date(year, month - 1 + months, 1);\n return isoOf(first.getFullYear(), first.getMonth() + 1, day);\n};\n\n/** The first day of the week for a locale (0 = Sunday … 6 = Saturday), from `Intl.Locale` week info; Monday otherwise. */\nexport function weekStartOf(locale: string): number {\n try {\n const info = new Intl.Locale(locale) as Intl.Locale & { getWeekInfo?: () => { firstDay: number }; weekInfo?: { firstDay: number } };\n const firstDay = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;\n return firstDay ? firstDay % 7 : 1;\n } catch {\n return 1;\n }\n}\n\n/** The weeks of a month's grid (six at most), each seven ISO dates from the locale's first day of the week. */\nexport function monthGrid(month: string, weekStartsOn: number): string[][] {\n const first = `${month.slice(0, 7)}-01`;\n const lead = (toLocalDate(first).getDay() - weekStartsOn + 7) % 7;\n const start = addDays(first, -lead);\n const days = Array.from({ length: 42 }, (_, i) => addDays(start, i));\n return Array.from({ length: 6 }, (_, w) => days.slice(w * 7, w * 7 + 7)).filter((week, w) => w < 5 || week[0]!.slice(0, 7) === first.slice(0, 7));\n}\n"],"mappings":";AAGA,SAAuB,QAAQ,YAAY,iBAAiB,MAAM,aAAa,kBAAwC,aAAa,SAAS,aAAa,kBAAgE,KAAK,gBAAgB;AAC/O,YAAYA,YAAW;AACvB,SAAS,mBAAmB,sBAAsB,UAAU,WAAW,YAA4B,YAAY,UAAU,eAA+B,YAA4B;;;ACApL,SAAkF,UAAU,SAAS,gBAAgB;AACrH,YAAY,WAAW;;;ACkBhB,IAAM,eAAiD;AAAA,EAC5D,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,SAAS;AAAA;AAAA,EAET,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,WAAW;AAAA,EACX,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,aAAa;AAAA,EACb,QAAQ;AACV;AAcA,IAAM,MAAM;AAEZ,IAAM,OAAO,CAAC,MAAc,WAC1B,SAAS,KAAK,QAAQ,cAAc,CAAC,KAAK,SAAkB,OAAO,IAAI,MAAM,SAAY,MAAM,OAAO,OAAO,IAAI,CAAC,CAAE,IAAI;AAGnH,SAAS,YAAY,OAAgC,OAAiB,CAAC,GAAW;AACvF,QAAM,IAAI,OAAO,UAAU,WAAW,EAAE,KAAK,MAAM,IAAI;AACvD,QAAM,aAAa,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM;AAC3C,MAAI,cAAc,eAAe,EAAE,IAAK,QAAO;AAC/C,QAAM,OAAO,EAAE,IAAI,MAAM,EAAE,IAAI,YAAY,GAAG,IAAI,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AqB,IAAI,CAAC,GAAE;AACjD;AAUO,SAAS,MAAM,EAAE,MAAM,SAAS,GAAe;AACpD,SAAO,gBAAAA,KAAA,YAAG,mBAAS,aAAa,IAAI,CAAC,GAAE;AACzC;AAEA,IAAM,SAAS,EAAE,WAAW,UAAU,UAAU,QAAQ,YAAY,QAAQ,WAAW,OAAO,OAAO,WAAW,YAAY,OAAO,QAAQ,UAAU;AAG9I,IAAM,oBAAoB,sBAAsB,QAAQ,QAAQ;AAQvE,IAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,MAAM,EAAE,KAAK,IAAI,WAAW,UAAU;AAAA,EACtC,QAAQ,EAAE,MAAM,GAAG,WAAW,UAAU;AAAA,EACxC,OAAO,EAAE,KAAK,GAAG,WAAW,UAAU;AAAA,EACtC,YAAY,EAAE,WAAW,cAAc,WAAW,IAAI,gBAAgB,SAAS;AAAA,EAC/E,OAAO,EAAE,aAAa,GAAG,SAAS,IAAI,KAAK,EAAE;AAAA,EAC7C,WAAW,EAAE,eAAe,OAAO,YAAY,UAAU,gBAAgB,iBAAiB,KAAK,IAAI,WAAW,GAAG;AAAA,EACjH,YAAY,EAAE,MAAM,GAAG,KAAK,EAAE;AAAA,EAC9B,YAAY,EAAE,YAAY,MAAM;AAClC,CAAC;","names":["React","fields","fields","value","createKrizakaForm","useForm","jsx"]}
1
+ {"version":3,"sources":["../../src/native/form.tsx","../../src/form/core.tsx","../../src/form/errors.ts","../../src/form/money.ts","../../src/date-picker/parts.ts"],"sourcesContent":["// React Native: the same forms as the web (`createKrizakaForm`, the same schemas, the same errors' keys), on the native\n// fields — TextField, Checkbox, Switch, RadioGroup, Select, Combobox, DateWheel / DateField, Slider. A form is a View;\n// Submit is the platform's Button; a refused submit announces its first error. Thin adapters: a new native control\n// changes one here, never a form.\nimport {\n type BrandId,\n Button,\n Checkbox as CheckboxControl,\n Combobox as ComboboxControl,\n type ComboboxLabels,\n DateField as DateFieldControl,\n type DateFieldLabels,\n DateWheel,\n ProductMark,\n RadioGroup as RadioGroupControl,\n Select as SelectControl,\n Slider as SliderControl,\n type SliderValue,\n Spinner,\n Switch as SwitchControl,\n TextField as TextFieldControl,\n type TextFieldProps as TextFieldControlProps,\n Txt,\n useTheme,\n} from \"@krizaka/ui/native\";\nimport * as React from \"react\";\nimport { AccessibilityInfo, KeyboardAvoidingView, Platform, Pressable, ScrollView, type StyleProp, StyleSheet, type TextInput, View, type ViewStyle } from \"react-native\";\n\nimport {\n type FieldCheck,\n firstVisibleError,\n FormContext,\n type FormContextValue,\n type KrizakaField,\n type KrizakaFieldArray,\n makeCreateKrizakaForm,\n useFormContext,\n useFormStatus,\n useFormValue,\n useKrizakaField,\n useKrizakaFieldArray,\n} from \"../form/core\";\nimport { formMessage } from \"../form/errors\";\nimport { currencySymbol, moneyInputText, parseMoney } from \"../form/money\";\n\ntype Base = {\n /** The field's name in the schema (typed by the form). */\n name: string;\n /** The visible label, passed translated (also the accessible name). */\n label: string;\n /** A help text under the control; the error takes its place when there is one. */\n hint?: string;\n /** Not available. */\n disabled?: boolean;\n /** Styles merged last, on the field. */\n style?: StyleProp<ViewStyle>;\n};\n\nexport type FormProps = {\n /** The fields, the error and the button. */\n children?: React.ReactNode;\n /** The form's accessible name (\"Create your account\"), passed translated. */\n \"aria-label\"?: string;\n /** The form is the screen's scrolling content: it moves above the keyboard (iOS), keeps the focused field in view, and\n * a tap on a button works while the keyboard is open. Give the form `flex: 1` room (a screen). */\n scroll?: boolean;\n /** Styles merged last, on the form's view — or its scrolled content (a column with a 16-pt gap by default). */\n style?: StyleProp<ViewStyle>;\n};\n\ntype ChainEntry = { key: string; focus: () => void; setLast: (last: boolean) => void };\ntype Chain = { register: (entry: ChainEntry) => () => void; next: (key: string) => void };\nconst ChainContext = React.createContext<Chain | null>(null);\n\n/** The return key walks the text fields in the order they appeared; the last one's sends the form. */\nfunction useChain(ctx: FormContextValue): Chain {\n const entries = React.useRef<ChainEntry[]>([]);\n return React.useMemo<Chain>(() => {\n const mark = () => entries.current.forEach((e, i) => e.setLast(i === entries.current.length - 1));\n return {\n register: (entry) => {\n entries.current = [...entries.current.filter((e) => e.key !== entry.key), entry];\n mark();\n return () => {\n entries.current = entries.current.filter((e) => e.key !== entry.key);\n mark();\n };\n },\n next: (key) => {\n const i = entries.current.findIndex((e) => e.key === key);\n const following = entries.current[i + 1];\n if (following) following.focus();\n else void submitAndAnnounce(ctx);\n },\n };\n }, [ctx]);\n}\n\n/** A text input of the form in the return-key chain: its ref, its return key (`next`, or `go` for the last), what it does. */\nfunction useChained(override: { returnKeyType?: unknown; onSubmitEditing?: unknown }, skip = false) {\n const chain = React.useContext(ChainContext);\n const key = React.useId();\n const ref = React.useRef<TextInput>(null);\n const [last, setLast] = React.useState(false);\n // A control without a keyboard (wheels) is not in the chain: the return key skips it.\n React.useLayoutEffect(() => (skip ? undefined : chain?.register({ key, focus: () => ref.current?.focus(), setLast })), [chain, key, skip]);\n if (!chain || override.returnKeyType !== undefined || override.onSubmitEditing !== undefined) return { inputRef: ref };\n return {\n inputRef: ref,\n returnKeyType: last ? (\"go\" as const) : (\"next\" as const),\n submitBehavior: last ? (\"blurAndSubmit\" as const) : (\"submit\" as const),\n onSubmitEditing: () => chain.next(key),\n };\n}\n\nasync function submitAndAnnounce(ctx: FormContextValue) {\n if (await ctx.submit()) return;\n const message = firstVisibleError(ctx);\n if (message) AccessibilityInfo.announceForAccessibility(message);\n}\n\nfunction FormRoot({ value, children, style, scroll, \"aria-label\": label }: FormProps & { value: FormContextValue }) {\n const chain = useChain(value);\n const body = scroll ? (\n <KeyboardAvoidingView behavior={Platform.OS === \"ios\" ? \"padding\" : undefined} style={styles.screen}>\n <ScrollView role=\"form\" aria-label={label} keyboardShouldPersistTaps=\"handled\" automaticallyAdjustKeyboardInsets keyboardDismissMode=\"interactive\" contentContainerStyle={[styles.form, style]}>\n {children}\n </ScrollView>\n </KeyboardAvoidingView>\n ) : (\n <View role=\"form\" aria-label={label} style={[styles.form, style]}>\n {children}\n </View>\n );\n return (\n <FormContext.Provider value={value}>\n <ChainContext.Provider value={chain}>{body}</ChainContext.Provider>\n </FormContext.Provider>\n );\n}\n\nfunction Suggestion({ field }: { field: KrizakaField }) {\n const suggestion = field.errorDetail?.suggestion;\n if (!field.error || !suggestion) return null;\n return (\n <Pressable role=\"button\" onPress={() => field.setValue(suggestion.value)} hitSlop={8} style={styles.suggestion}>\n <Txt variant=\"label\" tone=\"accent\">\n {suggestion.label}\n </Txt>\n </Pressable>\n );\n}\n\nexport type SubmitProps = {\n /** The button's words, passed translated (\"Create my account\"). */\n label: string;\n /** The look. Default `primary`. */\n variant?: \"primary\" | \"gradient\" | \"secondary\" | \"outline\" | \"ghost\" | \"danger\";\n /** The product whose animated mark turns in the button while the form is sent (the brand's loader); the system's spinner otherwise. */\n brand?: BrandId;\n /** Styles merged last, on the button. */\n style?: StyleProp<ViewStyle>;\n};\n\n/** Sends the form: busy while it is sent (the product's mark turning, or a spinner); a refused submit announces its first error. */\nexport function Submit({ label, variant = \"primary\", brand, style }: SubmitProps) {\n const ctx = useFormContext();\n const { submitting } = useFormStatus();\n const mark = submitting && brand ? <ProductMark id={brand} size={18} animated /> : undefined;\n return <Button label={label} variant={variant} loading={submitting && !brand} disabled={submitting} aria-busy={submitting} icon={mark} style={style} onPress={() => void submitAndAnnounce(ctx)} />;\n}\n\nexport type FormErrorProps = {\n /** A headline above the message, passed translated. */\n title?: string;\n /** Styles merged last. */\n style?: StyleProp<ViewStyle>;\n};\n\n/** The whole form's error — a refusal that belongs to no field (a conflict, too many tries, no network). */\nexport function FormError({ title, style }: FormErrorProps) {\n const ctx = useFormContext();\n const { theme, radius } = useTheme();\n if (!ctx.error) return null;\n return (\n <View role=\"alert\" aria-live=\"assertive\" style={[styles.alert, { borderRadius: radius.lg, borderColor: theme.danger, backgroundColor: theme.dangerSoft }, style]}>\n {title ? <Txt variant=\"label\">{title}</Txt> : null}\n <Txt tone=\"secondary\">{formMessage(ctx.error, ctx.i18n)}</Txt>\n </View>\n );\n}\n\nexport type TextFieldProps = Base &\n Pick<TextFieldControlProps, \"secureTextEntry\" | \"keyboardType\" | \"autoComplete\" | \"autoCapitalize\" | \"autoCorrect\" | \"textContentType\" | \"returnKeyType\" | \"onSubmitEditing\" | \"placeholder\" | \"maxLength\" | \"inputRef\"> & {\n /** Cleans what is typed before it is stored (`(v) => v.toLowerCase()`). */\n transform?: (raw: string) => string;\n /** Checks the value on the server as it is typed (availability): an error key, or nothing when it is fine. */\n validateAsync?: FieldCheck<string>;\n /** The wait, in ms, before `validateAsync`. Default 350. */\n asyncDebounceMs?: number;\n /** The words once `validateAsync` accepted the value (\"@eric is free\"), passed translated. */\n availableHint?: string;\n /** The name of the wait while it checks (\"Checking\"), passed translated. */\n checkingLabel?: string;\n };\n\n/** A text field of the form: its label, the input, the hint or the error, an optional check on the server. */\nexport function TextField({ name, label, hint, disabled, style, transform, validateAsync, asyncDebounceMs, availableHint, checkingLabel = \"Checking\", ...input }: TextFieldProps) {\n const f = useKrizakaField<string>(name, { validateAsync, asyncDebounceMs });\n const chained = useChained(input);\n const { theme } = useTheme();\n const end = f.validating ? <Spinner size=\"sm\" label={checkingLabel} /> : f.available ? <Txt aria-hidden style={{ color: theme.successText }}>✓</Txt> : null;\n return (\n <View style={[styles.field, style]}>\n <TextFieldControl\n label={label}\n hint={f.available && availableHint ? (hint ? `${availableHint} · ${hint}` : availableHint) : hint}\n error={f.error}\n disabled={disabled}\n value={f.value ?? \"\"}\n onValueChange={(text) => f.setValue(transform ? transform(text) : text)}\n onBlur={f.onBlur}\n end={end}\n {...chained}\n {...input}\n />\n <Suggestion field={f} />\n </View>\n );\n}\n\nexport type TextAreaProps = Base & {\n /** An example, passed translated. */\n placeholder?: string;\n /** The most characters. */\n maxLength?: number;\n};\n\n/** A longer text of the form (a bio, a description, a report). */\nexport function TextArea({ name, label, hint, disabled, style, ...input }: TextAreaProps) {\n const f = useKrizakaField<string>(name);\n return <TextFieldControl multiline label={label} hint={hint} error={f.error} disabled={disabled} value={f.value ?? \"\"} onValueChange={(t) => f.setValue(t)} onBlur={f.onBlur} style={style} {...input} />;\n}\n\nexport type CheckboxProps = Omit<Base, \"label\" | \"hint\"> & {\n /** The words next to the box: text, or a `Txt` with links inside (then name it with `accessibleLabel`). */\n label: React.ReactNode;\n /** The accessible name when `label` is not plain text, passed translated. */\n accessibleLabel?: string;\n};\n\n/** A box of the form (`boolean`): terms to accept, an option. */\nexport function Checkbox({ name, label, accessibleLabel, disabled, style }: CheckboxProps) {\n const f = useKrizakaField<boolean>(name);\n return (\n <CheckboxControl\n label={accessibleLabel}\n checked={f.value === true}\n onCheckedChange={(c) => {\n f.setValue(c);\n f.onBlur();\n }}\n error={f.error}\n disabled={disabled}\n style={style}\n >\n {label}\n </CheckboxControl>\n );\n}\n\n/** An on/off setting of the form (`boolean`): a settings row — the label and its hint beside the switch, all pressable. */\nexport function Switch({ name, label, hint, disabled, style }: Base) {\n const f = useKrizakaField<boolean>(name);\n return (\n <SwitchControl\n label={label}\n description={hint}\n showLabel\n error={f.error}\n checked={f.value === true}\n disabled={disabled}\n style={style}\n onCheckedChange={(on) => {\n f.setValue(on);\n f.onBlur();\n }}\n />\n );\n}\n\n/** A choice of the form: the value stored and its words (passed translated), a line under them. */\nexport type FormOption = { value: string; label: string; description?: string; disabled?: boolean };\n\nfunction Caption({ field, hint }: { field: KrizakaField; hint?: string }) {\n if (field.error)\n return (\n <Txt variant=\"caption\" tone=\"danger\" role=\"alert\">\n {field.error}\n </Txt>\n );\n return hint ? (\n <Txt variant=\"caption\" tone=\"secondary\">\n {hint}\n </Txt>\n ) : null;\n}\n\nexport type RadioGroupProps = Base & {\n /** The choices, all visible (two to five). */\n options: readonly FormOption[];\n /** `list` (dots, default), `cards`, `buttons` (tactile keys) or `segmented` — the native `RadioGroup`'s looks. */\n variant?: \"list\" | \"cards\" | \"buttons\" | \"segmented\";\n};\n\n/** One choice among a few, all visible: the native `RadioGroup` (a haptic on each choice). */\nexport function RadioGroup({ name, label, hint, disabled, style, options, variant = \"list\" }: RadioGroupProps) {\n const f = useKrizakaField<string>(name);\n return (\n <View style={[styles.field, style]}>\n <Txt variant=\"caption\" tone=\"secondary\" style={styles.groupLabel}>\n {label}\n </Txt>\n <RadioGroupControl\n label={label}\n variant={variant}\n options={options}\n value={f.value ?? \"\"}\n disabled={disabled}\n onValueChange={(v) => {\n f.setValue(v);\n f.onBlur();\n }}\n />\n <Caption field={f} hint={hint} />\n </View>\n );\n}\n\nexport type SelectProps = Base & {\n /** The choices, in a sheet. */\n options: readonly FormOption[];\n /** Shown while nothing is chosen (\"Choose a category\"), passed translated. */\n placeholder?: string;\n};\n\n/** One choice among many (the web's `<select>`): a field that opens a sheet of options. */\nexport function Select({ name, label, hint, disabled, style, options, placeholder }: SelectProps) {\n const f = useKrizakaField<string>(name);\n return <SelectControl label={label} hint={hint} error={f.error} disabled={disabled} style={style} options={options} placeholder={placeholder} value={f.value ?? \"\"} onValueChange={(v) => f.setValue(v)} onBlur={f.onBlur} />;\n}\n\nexport type ComboboxProps = Base & {\n /** The options, filtered as the person types. */\n options?: readonly FormOption[];\n /** Fetches the options for a query (debounced, aborted by a newer one). */\n onSearch?: (query: string, signal: AbortSignal) => Promise<readonly FormOption[]>;\n /** Several values (`string[]`); one (`string`) by default. */\n multiple?: boolean;\n /** Shown while nothing is chosen, passed translated. */\n placeholder?: string;\n /** The words of the control, passed translated. */\n labels?: Partial<ComboboxLabels>;\n};\n\n/** A choice among many, searched in a sheet: one value (`string`) or several (`string[]`). */\nexport function Combobox({ name, label, hint, disabled, style, options, onSearch, multiple, placeholder, labels }: ComboboxProps) {\n const f = useKrizakaField<string | string[]>(name);\n return (\n <ComboboxControl\n label={label}\n hint={hint}\n error={f.error}\n disabled={disabled}\n style={style}\n options={options}\n onSearch={onSearch}\n multiple={multiple}\n placeholder={placeholder}\n labels={labels}\n value={f.value ?? (multiple ? [] : \"\")}\n onValueChange={(v) => f.setValue(v)}\n onBlur={f.onBlur}\n />\n );\n}\n\nexport type DateFieldProps = Base & {\n /** `wheel` (default: day, month and year as wheels) or `parts` (typed on the numeric keypad). */\n entry?: \"wheel\" | \"parts\";\n /** The earliest date (ISO) of the wheels. */\n min?: string;\n /** The latest date (ISO) of the wheels: `latestBirthDate(18)` for an age gate. */\n max?: string;\n /** The names of the wheels or boxes (`day`, `month`, `year`), passed translated. */\n labels?: Partial<DateFieldLabels>;\n /** `bday` for a date of birth: the wheels rest on 1 January 2000 until turned; typed boxes are autofilled. */\n autoComplete?: \"bday\" | \"off\";\n};\n\n/** A date of the form (`YYYY-MM-DD`): wheels in the locale's order (or day · month · year typed) — the schema checks it. */\nexport function DateField({ name, label, hint, disabled, style, labels, autoComplete, entry = \"wheel\", min, max }: DateFieldProps) {\n const f = useKrizakaField<string>(name);\n const chained = useChained({}, entry === \"wheel\");\n if (entry === \"wheel\")\n return (\n <DateWheel\n label={label}\n hint={hint}\n error={f.error}\n disabled={disabled}\n style={style}\n labels={labels}\n locale={f.locale}\n min={min}\n max={max}\n defaultView={autoComplete === \"bday\" ? \"2000-01-01\" : undefined}\n value={f.value ?? \"\"}\n onValueChange={(v) => {\n f.setValue(v);\n f.onBlur();\n }}\n />\n );\n return <DateFieldControl {...chained} returnKeyType={chained.returnKeyType} label={label} hint={hint} error={f.error} disabled={disabled} style={style} labels={labels} autoComplete={autoComplete} locale={f.locale} value={f.value ?? \"\"} onValueChange={(v) => f.setValue(v)} onBlur={f.onBlur} />;\n}\n\nexport type SliderProps = Base & {\n /** The lowest value. Default 0. */\n min?: number;\n /** The highest value. Default 100. */\n max?: number;\n /** The step. Default 1. */\n step?: number;\n /** The value as words (\"15 %\", \"3 min\"), shown and read. */\n formatValue?: (value: number) => string;\n /** For a range (`[number, number]`): each thumb's name, passed translated. */\n thumbLabels?: [string, string];\n /** A graduation per step (`true`) or at the values given. */\n ticks?: boolean | readonly number[];\n};\n\n/** A number (or a range) of the form, chosen by feel: a share, a volume, a price range. */\nexport function Slider({ name, label, hint, disabled, style, min, max, step, formatValue, thumbLabels, ticks }: SliderProps) {\n const f = useKrizakaField<SliderValue>(name);\n return (\n <View style={[styles.field, style]}>\n <SliderControl label={label} showLabel floatingValue value={f.value} min={min} max={max} step={step} disabled={disabled} formatValue={formatValue} thumbLabels={thumbLabels} ticks={ticks} onValueChange={(v) => f.setValue(v)} onValueCommit={() => f.onBlur()} />\n <Caption field={f} hint={hint} />\n </View>\n );\n}\n\nexport type MoneyProps = Base & {\n /** The currency (ISO 4217): its sign beside the amount, its decimals. */\n currency: string;\n /** An example of an amount, passed translated. */\n placeholder?: string;\n};\n\n/** An amount of the form, stored as integer minor units (cents), typed on the decimal keypad the locale's way. */\nexport function Money({ name, label, hint, disabled, style, currency, placeholder }: MoneyProps) {\n const f = useKrizakaField<number | null>(name);\n const [text, setText] = React.useState(() => moneyInputText(f.value, currency, f.locale));\n const [editing, setEditing] = React.useState(false);\n const chained = useChained({});\n return (\n <TextFieldControl\n {...chained}\n label={label}\n hint={hint}\n error={f.error}\n disabled={disabled}\n style={style}\n placeholder={placeholder}\n keyboardType=\"decimal-pad\"\n value={editing ? text : moneyInputText(f.value, currency, f.locale)}\n end={<Txt tone=\"secondary\">{currencySymbol(currency, f.locale)}</Txt>}\n onFocus={() => {\n setText(moneyInputText(f.value, currency, f.locale));\n setEditing(true);\n }}\n onValueChange={(next) => {\n setText(next);\n const units = parseMoney(next, currency, f.locale);\n f.setValue(units === undefined ? null : units === null ? Number.NaN : units);\n }}\n onBlur={() => {\n setEditing(false);\n f.onBlur();\n }}\n />\n );\n}\n\nexport type FormFieldProps<T = unknown> = {\n /** The field's name in the schema (typed by the form). */\n name: string;\n /** Checks the value on the server as it changes. */\n validateAsync?: FieldCheck<T>;\n /** The wait, in ms, before `validateAsync`. */\n asyncDebounceMs?: number;\n /** Draws the field: its value, setter, error (`useKrizakaField`). */\n children: (field: KrizakaField<T>) => React.ReactNode;\n};\n\n/** A field drawn by the app (a control the package does not have). */\nexport function FormField({ name, validateAsync, asyncDebounceMs, children }: FormFieldProps) {\n return <>{children(useKrizakaField(name, { validateAsync, asyncDebounceMs }))}</>;\n}\n\nexport type FieldArrayProps<T = unknown> = {\n /** The array's name in the schema (typed by the form). */\n name: string;\n /** Draws the items: `items`, `push`, `remove`, `move`, `fieldName(i, \"url\")`. */\n children: (array: KrizakaFieldArray<T>) => React.ReactNode;\n};\n\n/** A list of fields that grows and shrinks: each item's fields named `links[0].url`. */\nexport function FieldArray({ name, children }: FieldArrayProps) {\n return <>{children(useKrizakaFieldArray(name))}</>;\n}\n\nexport type WatchProps<T = unknown> = {\n /** The field to follow (typed by the form). */\n name: string;\n /** Draws from its current value. */\n children: (value: T) => React.ReactNode;\n};\n\n/** Renders from a field's current value (a part shown only when a choice is made). */\nexport function Watch({ name, children }: WatchProps) {\n return <>{children(useFormValue(name))}</>;\n}\n\nconst fields = { TextField, TextArea, Checkbox, Switch, RadioGroup, Select, Combobox, DateField, Money, Slider, Field: FormField, FieldArray, Watch, Submit, FormError };\n\n/** A form, defined once — the same schema and defaults as the web (`packages/core` of a product) — on native fields. */\nexport const createKrizakaForm = makeCreateKrizakaForm(fields, FormRoot);\n\nexport { useFormContext, useFormStatus, useFormValue, useKrizakaField, useKrizakaFieldArray };\nexport type { FieldCheck, KrizakaField, KrizakaFieldArray };\nexport { isRealDate, latestBirthDate } from \"../date-picker/parts\";\nexport type { FormActionResult, FormOutput, FormSchema, FormValues, KrizakaFormFactory, KrizakaFormInstance } from \"../form/core\";\nexport { type FormFieldError, type FormI18n, formMessage, formMessages, type FormProblem } from \"../form/errors\";\n\nconst styles = StyleSheet.create({\n form: { gap: 16, alignSelf: \"stretch\" },\n screen: { flex: 1, alignSelf: \"stretch\" },\n field: { gap: 6, alignSelf: \"stretch\" },\n suggestion: { alignSelf: \"flex-start\", minHeight: 32, justifyContent: \"center\" },\n alert: { borderWidth: 1, padding: 12, gap: 4 },\n groupLabel: { fontWeight: \"600\" },\n});\n","// Platform-neutral React (web and React Native): the engine of a Krizaka form, TanStack Form v1 behind the facade\n// (ADR-001: a product never imports @tanstack/*). A form = a Standard Schema (zod 4) + its default values; the schema\n// validates every change, an error shows once the person leaves the field or tries to send (and goes as soon as it is\n// fixed), a field may check a value on the server (debounced, aborted when the value changes), and a refusal of the\n// server (Problem Details `fields`) lands under its fields. The fields themselves are the platform's (web.tsx, native).\nimport { type AnyFieldApi, type AnyFormApi, type DeepKeys, type StandardSchemaV1, useField, useForm, useStore } from \"@tanstack/react-form\";\nimport * as React from \"react\";\n\nimport { type FormFieldError, type FormI18n, formMessage, type FormProblem, isFormProblem, issuesToFields, problemToErrors, type SchemaIssue } from \"./errors\";\n\n/** A schema the form validates with: any Standard Schema — zod 4 (`z.object`), valibot, arktype. */\nexport type FormSchema<Input = unknown, Output = Input> = StandardSchemaV1<Input, Output>;\n/** The values a form holds: the schema's input. */\nexport type FormValues<S> = S extends { readonly \"~standard\": { readonly types?: { readonly input: infer I } } } ? I : never;\n/** The values a form sends: the schema's output (zod transforms applied). */\nexport type FormOutput<S> = S extends { readonly \"~standard\": { readonly types?: { readonly output: infer O } } } ? O : never;\n/** A field's name: `email`, `address.city`, `links[0].url`. */\nexport type FieldName<V> = DeepKeys<V> & string;\n\n/** What a Server Action (or any submit) answers: done, or a refusal the form shows. */\nexport type FormActionResult<T = unknown> = { ok: true; data?: T } | { ok: false; problem: FormProblem };\n\n/** A value checked on the server as it is typed: an error (or its key), or nothing when the value is fine. */\nexport type FieldCheck<T = unknown> = (value: T, signal: AbortSignal) => Promise<FormFieldError | string | null | undefined> | FormFieldError | string | null | undefined;\n\nexport interface KrizakaFormDefinition<S extends FormSchema> {\n /** The schema of the values (zod 4): the same one the server parses with. */\n schema: S;\n /** The values at first: every field of the schema. */\n defaultValues: FormValues<S>;\n /** The words: the app's translate function, the key prefixes, the locale. */\n i18n?: FormI18n;\n}\n\nexport interface UseKrizakaFormOptions<S extends FormSchema, R = unknown> {\n /** Sends the values (the schema's output): a mutation of @krizaka/query, a Server Action. Throw a `KrizakaApiError` or\n * return `{ ok: false, problem }` to refuse: its `fields` go under their fields, the rest above the button. */\n onSubmit?: (values: FormOutput<S>) => R | Promise<R>;\n /** Called after a successful submit with what `onSubmit` returned (`data` of a `{ ok: true, data }`). */\n onSuccess?: (result: R extends FormActionResult<infer T> ? T | undefined : R) => void;\n /** Values that replace the definition's (a profile loaded from the server). */\n defaultValues?: FormValues<S>;\n /** Overrides the definition's words (the translate function of a hook). */\n i18n?: FormI18n;\n /** The server's codes that belong to a field (`{ UNDERAGE: \"dateOfBirth\", USERNAME_RESERVED: \"username\" }`): a refusal\n * with that code shows under the field, as `form.errors.<CODE>`, instead of above the button. */\n codeFields?: Readonly<Record<string, string>>;\n}\n\n/** The state of a form, for its fields and its button. */\nexport interface FormContextValue {\n /** TanStack's form, through the facade: never import @tanstack/* in a product. */\n readonly api: AnyFormApi;\n readonly i18n: FormI18n;\n /** The whole form's error (a refusal without a field), or null. */\n readonly error: FormFieldError | null;\n /** Sends the form: validates, focuses (web) or announces (native) the first error, else calls `onSubmit`. */\n readonly submit: () => Promise<boolean>;\n}\n\nexport const FormContext = React.createContext<FormContextValue | null>(null);\n\n/** The form around a field: inside `form.Form`. */\nexport function useFormContext(): FormContextValue {\n const ctx = React.useContext(FormContext);\n if (!ctx) throw new Error(\"A Krizaka form field must be inside its form's `form.Form`.\");\n return ctx;\n}\n\ntype StandardResult = { readonly value?: unknown; readonly issues?: readonly SchemaIssue[] };\n\nconst run = (schema: FormSchema, value: unknown) => schema[\"~standard\"].validate(value) as StandardResult | Promise<StandardResult>;\n\n/** The engine of a form: TanStack's form wired to the schema, the server's refusals and the submit. */\nexport function useKrizakaFormCore<S extends FormSchema, R>(definition: KrizakaFormDefinition<S>, options: UseKrizakaFormOptions<S, R> = {}): FormContextValue {\n const i18n = { ...definition.i18n, ...options.i18n };\n const latest = React.useRef({ options, i18n });\n // The latest options for the engine's callbacks (a submit, a change), which outlive the render that made them.\n React.useLayoutEffect(() => {\n latest.current = { options, i18n };\n });\n const [error, setError] = React.useState<FormFieldError | null>(null);\n const refused = React.useRef(false);\n\n const api = useForm({\n defaultValues: options.defaultValues ?? definition.defaultValues,\n validators: {\n // Every change: the schema, synchronously (an async refinement waits for the submit). Errors are computed for\n // every field; each field shows its own once the person left it or tried to send.\n onChange: ({ value }: { value: unknown }) => {\n const result = run(definition.schema, value);\n if (result instanceof Promise || !result.issues?.length) return undefined;\n const fields = issuesToFields(result.issues, latest.current.i18n.prefix);\n delete fields[\"\"];\n return { fields };\n },\n },\n onSubmit: async ({ value }: { value: unknown }) => {\n const parsed = await run(definition.schema, value);\n if (parsed.issues?.length) {\n apply({ fields: issuesToFields(parsed.issues, latest.current.i18n.prefix) as FormProblem[\"fields\"] });\n return;\n }\n let result: unknown;\n try {\n result = await latest.current.options.onSubmit?.(parsed.value as FormOutput<S>);\n } catch (thrown) {\n apply(isFormProblem(thrown) ? thrown : { code: \"server\" });\n return;\n }\n if (result && typeof result === \"object\" && \"ok\" in result && (result as FormActionResult).ok === false) {\n apply((result as unknown as { problem: FormProblem }).problem);\n return;\n }\n const data = result && typeof result === \"object\" && \"ok\" in result ? (result as { data?: unknown }).data : result;\n latest.current.options.onSuccess?.(data as never);\n },\n });\n\n const known = (name: string) => name in api.fieldInfo;\n function apply(problem: FormProblem) {\n refused.current = true;\n const { fields, form } = problemToErrors(problem, latest.current.i18n, known, latest.current.options.codeFields);\n for (const [name, fieldError] of Object.entries(fields)) {\n api.setFieldMeta(name as never, (meta) => ({ ...meta, isBlurred: true, errorMap: { ...meta.errorMap, onServer: fieldError } }));\n }\n setError(form);\n }\n\n const submit = React.useCallback(async () => {\n setError(null);\n refused.current = false;\n for (const name of Object.keys(api.fieldInfo)) {\n if ((api.getFieldMeta(name as never) as { errorMap?: Record<string, unknown> } | undefined)?.errorMap?.onServer) api.setFieldMeta(name as never, (meta) => ({ ...meta, errorMap: { ...meta.errorMap, onServer: undefined } }));\n }\n await api.handleSubmit();\n const state = api.state;\n return !refused.current && state.isSubmitSuccessful && state.isValid && !(Object.values(state.fieldMeta) as { errorMap?: Record<string, unknown> }[]).some((meta) => meta?.errorMap?.onServer);\n }, [api]);\n\n return React.useMemo(() => ({ api, i18n, error, submit }), [api, error, submit, i18n.t, i18n.prefix, i18n.apiPrefix, i18n.locale]); // eslint-disable-line react-hooks/exhaustive-deps\n}\n\nconst UNCHECKED = Symbol(\"unchecked\");\n\nexport interface FieldOptions<T> {\n /** Checks the value on the server as it is typed (a username's availability): debounced, aborted when it changes. */\n validateAsync?: FieldCheck<T>;\n /** The wait, in ms, between the last change and `validateAsync`. Default 350. */\n asyncDebounceMs?: number;\n}\n\n/** A field as its component draws it: the value, its setter, its error in words, its state. */\nexport interface KrizakaField<T = unknown> {\n /** The id of the control (`htmlFor` of its label). */\n readonly id: string;\n readonly name: string;\n readonly value: T;\n /** Sets the value (clears a refusal of the server on it). */\n setValue(value: T): void;\n /** Call when the control loses focus: from then on, its errors show. */\n readonly onBlur: () => void;\n /** The error to show, in words — only once it should show. */\n readonly error: string | undefined;\n /** The error itself, with its suggestion. */\n readonly errorDetail: FormFieldError | undefined;\n /** A check (`validateAsync`) is running. */\n readonly validating: boolean;\n /** The check passed for the current value. */\n readonly available: boolean;\n /** The ids of the hint and the error (`aria-describedby`). */\n readonly hintId: string;\n readonly errorId: string;\n /** The form's locale (numbers, money, dates). */\n readonly locale: string;\n /** TanStack's field, through the facade. */\n readonly api: AnyFieldApi;\n}\n\n/** Binds a field of the form around it (inside `form.Form`): what the platform's field components are made of. */\nexport function useKrizakaField<T = unknown>(name: string, options: FieldOptions<T> = {}): KrizakaField<T> {\n const ctx = useFormContext();\n const id = React.useId();\n const [checked, setChecked] = React.useState<unknown>(UNCHECKED);\n const check = options.validateAsync;\n const field = useField({\n form: ctx.api,\n name: name as never,\n ...(check\n ? {\n asyncDebounceMs: options.asyncDebounceMs ?? 350,\n validators: {\n onChangeAsyncDebounceMs: options.asyncDebounceMs ?? 350,\n onChangeAsync: async ({ value, signal }: { value: T; signal: AbortSignal }) => {\n const answer = await check(value, signal);\n if (signal.aborted) return undefined;\n if (!answer) {\n setChecked(value);\n return undefined;\n }\n setChecked(UNCHECKED);\n const error = typeof answer === \"string\" ? { key: answer } : answer;\n return { ...error, immediate: true, source: \"check\" } satisfies FormFieldError;\n },\n },\n }\n : {}),\n } as never) as unknown as AnyFieldApi;\n const attempts = useStore(ctx.api.store, (state: { submissionAttempts: number }) => state.submissionAttempts);\n const meta = field.state.meta;\n const map = meta.errorMap as Record<string, unknown>;\n const all = [map.onServer, map.onChange, map.onBlur, map.onSubmit, map.onMount].filter(Boolean) as (FormFieldError | string)[];\n const first = all[0];\n const detail = typeof first === \"string\" ? { key: first } : first;\n const visible = detail && (detail.immediate || detail.source === \"server\" || meta.isBlurred || attempts > 0) ? detail : undefined;\n const value = field.state.value as T;\n\n return {\n id,\n name,\n value,\n setValue: (next: T) => {\n if (map.onServer) ctx.api.setFieldMeta(name as never, (m: { errorMap: Record<string, unknown> }) => ({ ...m, errorMap: { ...m.errorMap, onServer: undefined } }) as never);\n field.handleChange(next as never);\n },\n onBlur: () => field.handleBlur(),\n error: visible ? formMessage(visible, ctx.i18n) : undefined,\n errorDetail: visible,\n validating: Boolean(meta.isValidating),\n available: Boolean(check) && checked !== UNCHECKED && Object.is(checked, value) && !meta.isValidating && all.length === 0,\n hintId: `${id}-hint`,\n errorId: `${id}-error`,\n locale: ctx.i18n.locale ?? \"en\",\n api: field,\n };\n}\n\n/** The array of a field array, with its operations (`form.FieldArray`). */\nexport interface KrizakaFieldArray<T = unknown> {\n readonly name: string;\n readonly items: readonly T[];\n /** Adds an item at the end. */\n readonly push: (item: T) => void;\n /** Removes the item at `index`. */\n readonly remove: (index: number) => void;\n /** Moves an item. */\n readonly move: (from: number, to: number) => void;\n /** The name of a sub-field of an item: `name(0, \"url\")` → `links[0].url`. */\n readonly fieldName: (index: number, key?: string) => string;\n /** The error of the array itself (too few, too many), in words, once it should show. */\n readonly error: string | undefined;\n}\n\n/** Binds an array of the form (a list of links, of tiers): its items and their operations. */\nexport function useKrizakaFieldArray<T = unknown>(name: string): KrizakaFieldArray<T> {\n const ctx = useFormContext();\n const field = useField({ form: ctx.api, name: name as never, mode: \"array\" } as never) as unknown as AnyFieldApi;\n const attempts = useStore(ctx.api.store, (state: { submissionAttempts: number }) => state.submissionAttempts);\n const map = field.state.meta.errorMap as Record<string, FormFieldError | undefined>;\n const first = map.onServer ?? map.onChange ?? map.onSubmit;\n return {\n name,\n items: (field.state.value as T[] | undefined) ?? [],\n push: (item) => field.pushValue(item as never),\n remove: (index) => void field.removeValue(index),\n move: (from, to) => field.moveValue(from, to),\n fieldName: (index, key) => `${name}[${index}]${key ? `.${key}` : \"\"}`,\n error: first && (attempts > 0 || first.source === \"server\" || field.state.meta.isDirty) ? formMessage(first, ctx.i18n) : undefined,\n };\n}\n\n/** The value of a field, kept up to date (`form.Watch`): show a part of the form only when a box is ticked. */\nexport function useFormValue<T = unknown>(name: string): T {\n const ctx = useFormContext();\n return useStore(ctx.api.store, (state: { values: unknown }) => getPath(state.values, name)) as T;\n}\n\n/** The state of the submit, for a button: sending, and whether the last try succeeded. */\nexport function useFormStatus(): { submitting: boolean; succeeded: boolean; attempts: number } {\n const ctx = useFormContext();\n const submitting = useStore(ctx.api.store, (s: { isSubmitting: boolean }) => s.isSubmitting);\n const succeeded = useStore(ctx.api.store, (s: { isSubmitSuccessful: boolean }) => s.isSubmitSuccessful);\n const attempts = useStore(ctx.api.store, (s: { submissionAttempts: number }) => s.submissionAttempts);\n return { submitting, succeeded: succeeded && !ctx.error, attempts };\n}\n\nfunction getPath(source: unknown, path: string): unknown {\n let current = source;\n for (const part of path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\")) {\n if (current === null || typeof current !== \"object\") return undefined;\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/** The first visible error of a form, in words (native: announced after a refused submit). */\nexport function firstVisibleError(ctx: FormContextValue): string | undefined {\n if (ctx.error) return formMessage(ctx.error, ctx.i18n);\n for (const meta of Object.values(ctx.api.state.fieldMeta) as { errorMap?: Record<string, FormFieldError | string | undefined> }[]) {\n const error = meta?.errorMap && Object.values(meta.errorMap).find(Boolean);\n if (error) return formMessage(error, ctx.i18n);\n }\n return undefined;\n}\n\n/** The platform's components, typed by the form's field names: `name` completes and is checked against the schema. */\nexport type BoundFields<C, N extends string> = {\n [K in keyof C]: C[K] extends (props: infer P) => infer R ? (P extends { name: string } ? (props: Omit<P, \"name\"> & { name: N }) => R : C[K]) : C[K];\n};\n\n/** A form in a component: its fields (typed by the schema), its submit and its state. */\nexport type KrizakaFormInstance<S extends FormSchema, C, RootProps> = BoundFields<C, FieldName<FormValues<S>>> & {\n /** The form element (web) or view (native): renders its fields and provides them the form. */\n Form: (props: RootProps) => React.ReactElement;\n /** Sends the form (what `Submit` does): `true` when it went through. */\n submit: () => Promise<boolean>;\n /** Back to the default values (or the given ones), errors cleared. */\n reset: (values?: FormValues<S>) => void;\n /** Sets a field's value from outside (a suggestion, a preset). */\n setValue: (name: FieldName<FormValues<S>>, value: unknown) => void;\n /** The values now. */\n getValues: () => FormValues<S>;\n /** The whole form's error (a refusal without a field), or null. */\n error: FormFieldError | null;\n /** TanStack's form, the escape hatch — never import @tanstack/* in a product. */\n api: AnyFormApi;\n};\n\n/** A form defined once (schema + defaults), used in components: `signUp.useForm({ onSubmit })`. */\nexport interface KrizakaFormFactory<S extends FormSchema, C, RootProps> {\n readonly schema: S;\n readonly defaultValues: FormValues<S>;\n /** The form in a component: `onSubmit` sends the values (a mutation), a thrown `KrizakaApiError` lands on the fields. */\n useForm<R = unknown>(options?: UseKrizakaFormOptions<S, R>): KrizakaFormInstance<S, C, RootProps>;\n /** The form sent by a Server Action: it receives the values and answers `{ ok: true, data }` or `{ ok: false, problem }`. */\n useFormWithAction<T = unknown>(action: (values: FormOutput<S>) => Promise<FormActionResult<T>>, options?: Omit<UseKrizakaFormOptions<S, FormActionResult<T>>, \"onSubmit\">): KrizakaFormInstance<S, C, RootProps>;\n}\n\n/** Builds a platform's `createKrizakaForm` from its field components and its root (web `<form>`, native `View`). */\nexport function makeCreateKrizakaForm<C extends object, RootProps extends object>(components: C, Root: (props: RootProps & { value: FormContextValue }) => React.ReactElement) {\n return function createKrizakaForm<S extends FormSchema>(definition: KrizakaFormDefinition<S>): KrizakaFormFactory<S, C, RootProps> {\n function useForm<R>(options?: UseKrizakaFormOptions<S, R>): KrizakaFormInstance<S, C, RootProps> {\n const ctx = useKrizakaFormCore(definition, options);\n // One `Form` for the life of the form (never remounted, so focus and fields stay): it reads the latest state from a\n // small store the hook updates.\n const [store] = React.useState(() => createStore(ctx));\n React.useLayoutEffect(() => store.set(ctx), [store, ctx]);\n const Form = React.useCallback((props: RootProps) => <Bound store={store} Root={Root} props={props} />, [store]);\n return React.useMemo(\n () =>\n ({\n ...components,\n Form,\n submit: ctx.submit,\n reset: (values?: FormValues<S>) => ctx.api.reset(values),\n setValue: (name: string, value: unknown) => ctx.api.setFieldValue(name as never, value as never),\n getValues: () => ctx.api.state.values as FormValues<S>,\n error: ctx.error,\n api: ctx.api,\n }) as unknown as KrizakaFormInstance<S, C, RootProps>,\n [ctx, Form],\n );\n }\n return {\n schema: definition.schema,\n defaultValues: definition.defaultValues,\n useForm,\n useFormWithAction: (action, options) => useForm({ ...options, onSubmit: action }),\n };\n };\n}\n\ntype Store<T> = { get: () => T; set: (value: T) => void; subscribe: (listener: () => void) => () => void };\n\nfunction createStore<T>(initial: T): Store<T> {\n let value = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => value,\n set: (next) => {\n if (Object.is(next, value)) return;\n value = next;\n listeners.forEach((listener) => listener());\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n\nfunction Bound<RootProps extends object>({ store, Root, props }: { store: Store<FormContextValue>; Root: (props: RootProps & { value: FormContextValue }) => React.ReactElement; props: RootProps }) {\n const value = React.useSyncExternalStore(store.subscribe, store.get, store.get);\n return <Root {...props} value={value} />;\n}\n","// Platform-neutral and server-safe: no React, no DOM, no React Native. The errors of a Krizaka form — a schema's issues,\n// a server's Problem Details, an availability check — as one shape, `FormFieldError`, whose words come from a key of the\n// app's catalogue (`form.errors.tooShort`), never from the validation engine's English.\n\n/** A value a message placeholder takes (`{minimum}`, `{suggestion}`). */\nexport type FormMessageValue = string | number;\n\n/** An error of a field or of the whole form: the key of its words in the app's catalogue, and what fills them in. */\nexport interface FormFieldError {\n /** The i18n key: `form.errors.required`, or the key a schema names (`z.string().min(3, \"signUp.username.short\")`). */\n key: string;\n /** The placeholders of the message (`{ minimum: 3 }`). */\n values?: Readonly<Record<string, FormMessageValue>>;\n /** The server's own words, in English: shown only when the catalogue has no message for the key. */\n message?: string;\n /** A value to offer instead (a free username): a button under the error sets it. Its label is passed translated. */\n suggestion?: { readonly label: string; readonly value: unknown };\n /** Shown at once, while the person types (an availability check), not only once they leave the field. */\n immediate?: boolean;\n /** Where it comes from: the schema (default), a field's check, or the server's answer (kept until the field changes). */\n source?: \"schema\" | \"check\" | \"server\";\n}\n\n/** The English defaults of the generic errors, by code — the words a form shows when the app's catalogue has none. */\nexport const formMessages: Readonly<Record<string, string>> = {\n required: \"This field is required.\",\n tooShort: \"Use at least {minimum} characters.\",\n tooLong: \"Use at most {maximum} characters.\",\n tooSmall: \"Enter {minimum} or more.\",\n tooBig: \"Enter {maximum} or less.\",\n tooFew: \"Choose at least {minimum}.\",\n tooMany: \"Choose at most {maximum}.\",\n invalidEmail: \"Enter an e-mail address, like name@example.com.\",\n invalidUrl: \"Enter a web address, like https://example.com.\",\n invalidDate: \"Enter a real date.\",\n invalidNumber: \"Enter a number.\",\n invalidFormat: \"Check the format of this field.\",\n invalidChoice: \"Choose one of the options.\",\n invalid: \"Check this field.\",\n // The whole form (a server's answer without fields): the codes of @krizaka/query's KrizakaApiError.\n network: \"No connection. Check your network and try again.\",\n \"rate-limited\": \"Too many tries. Wait a moment and try again.\",\n unauthorized: \"Your session has ended. Sign in again.\",\n forbidden: \"You are not allowed to do this.\",\n conflict: \"This was changed meanwhile. Reload and try again.\",\n \"validation-failed\": \"Some fields need your attention.\",\n unavailable: \"The service is unavailable for a moment. Try again shortly.\",\n server: \"Something went wrong on our side. Try again.\",\n};\n\n/** How a form finds its words: the app's translate function, and the prefixes of its keys. */\nexport interface FormI18n {\n /** The app's translate function (`(key, values) => t(key, values)`): a string, or `undefined` when the key is missing. */\n t?: (key: string, values?: Readonly<Record<string, FormMessageValue>>) => string | undefined;\n /** The prefix of the generic field errors. Default `form.errors` (→ `form.errors.tooShort`). */\n prefix?: string;\n /** The prefix of the server's codes for the whole form, as `KrizakaApiError.messageKey()`. Default `apiErrors`. */\n apiPrefix?: string;\n /** The locale of numbers, money and dates. Default `en`. */\n locale?: string;\n}\n\nconst KEY = /^[\\w-]+(\\.[\\w-]+)+$/;\n\nconst fill = (text: string, values?: Readonly<Record<string, FormMessageValue>>) =>\n values ? text.replace(/\\{(\\w+)\\}/g, (all, name: string) => (values[name] === undefined ? all : String(values[name]))) : text;\n\n/** The words of an error: the app's catalogue, else the English default of its code, else the server's words, else the key. */\nexport function formMessage(error: FormFieldError | string, i18n: FormI18n = {}): string {\n const e = typeof error === \"string\" ? { key: error } : error;\n const translated = i18n.t?.(e.key, e.values);\n if (translated && translated !== e.key) return translated;\n const code = e.key.slice(e.key.lastIndexOf(\".\") + 1);\n const fallback = formMessages[code];\n // The server's words beat a generic default (a refusal without a code), never a default for its own code.\n if (e.message && (code === \"invalid\" || !fallback)) return e.message;\n if (fallback && (e.key.startsWith(`${i18n.prefix ?? \"form.errors\"}.`) || e.key.startsWith(`${i18n.apiPrefix ?? \"apiErrors\"}.`))) return fill(fallback, e.values);\n return e.message ?? (KEY.test(e.key) ? fill(fallback ?? formMessages.invalid!, e.values) : e.key);\n}\n\n/** One issue of a Standard Schema (zod 4, valibot, arktype): zod adds its `code` and limits, read when present. */\nexport interface SchemaIssue {\n readonly message: string;\n readonly path?: ReadonlyArray<PropertyKey | { readonly key: PropertyKey }>;\n readonly code?: string;\n readonly minimum?: number | bigint;\n readonly maximum?: number | bigint;\n readonly origin?: string;\n readonly format?: string;\n readonly input?: unknown;\n readonly expected?: string;\n}\n\n/** A field's name from an issue's path, as the form writes it: `links[0].url`. */\nexport function pathName(path: SchemaIssue[\"path\"]): string {\n let name = \"\";\n for (const part of path ?? []) {\n const key = typeof part === \"object\" && part !== null ? part.key : part;\n if (typeof key === \"number\") name += `[${key}]`;\n else name += name ? `.${String(key)}` : String(key);\n }\n return name;\n}\n\nconst num = (value: number | bigint | undefined) => (value === undefined ? undefined : Number(value));\n\n/** The key and values of an issue: the schema's own key when it names one, else the generic code of what failed. */\nexport function issueError(issue: SchemaIssue, prefix = \"form.errors\"): FormFieldError {\n if (KEY.test(issue.message)) return { key: issue.message };\n const key = (code: string, values?: Record<string, FormMessageValue>) => ({ key: `${prefix}.${code}`, ...(values ? { values } : {}) });\n const collection = issue.origin === \"array\" || issue.origin === \"set\";\n switch (issue.code) {\n case \"invalid_type\":\n return issue.input === undefined || issue.input === null || issue.input === \"\" ? key(\"required\") : issue.expected === \"number\" ? key(\"invalidNumber\") : issue.expected === \"date\" ? key(\"invalidDate\") : key(\"invalid\");\n case \"too_small\": {\n const minimum = num(issue.minimum)!;\n if (issue.origin === \"string\") return minimum <= 1 ? key(\"required\") : key(\"tooShort\", { minimum });\n if (collection) return minimum <= 1 ? key(\"required\") : key(\"tooFew\", { minimum });\n return key(\"tooSmall\", { minimum });\n }\n case \"too_big\": {\n const maximum = num(issue.maximum)!;\n return issue.origin === \"string\" ? key(\"tooLong\", { maximum }) : collection ? key(\"tooMany\", { maximum }) : key(\"tooBig\", { maximum });\n }\n case \"invalid_format\":\n if (issue.format === \"email\") return key(\"invalidEmail\");\n if (issue.format === \"url\") return key(\"invalidUrl\");\n if (issue.format === \"date\" || issue.format === \"datetime\") return key(\"invalidDate\");\n return key(\"invalidFormat\");\n case \"invalid_value\":\n // `z.literal(true)`: a box that must be ticked.\n return issue.input === false || issue.input === undefined ? key(\"required\") : key(\"invalidChoice\");\n case \"invalid_union\":\n case \"invalid_key\":\n case \"invalid_element\":\n return key(\"invalidChoice\");\n default:\n return key(\"invalid\");\n }\n}\n\n/** The first error of each field of a schema's issues (an issue without a path is the whole form's: `\"\"`). */\nexport function issuesToFields(issues: readonly SchemaIssue[], prefix?: string): Record<string, FormFieldError> {\n const fields: Record<string, FormFieldError> = {};\n for (const issue of issues) {\n const name = pathName(issue.path);\n if (!(name in fields)) fields[name] = { ...issueError(issue, prefix), source: \"schema\" };\n }\n return fields;\n}\n\n/**\n * A refusal the form shows, serialisable (a Server Action returns it): the shape of `KrizakaApiError` of @krizaka/query —\n * a `KrizakaApiError` *is* a `FormProblem`. `fields` go under their fields, the rest above the submit button.\n */\nexport interface FormProblem {\n /** The HTTP status (0 when no response arrived). */\n status?: number;\n /** The stable code of the refusal (`rate-limited`, `conflict`, `ACCOUNT_EXISTS`): the key of its words. */\n code?: string;\n /** The server's sentence, in English: shown only when the catalogue has no message for the code. */\n detail?: string;\n /** The refused fields, by name: a server's `{ code, message }`, or an error the form already knows (`key`). */\n fields?: Readonly<Record<string, { code?: string; message: string } | FormFieldError | string>>;\n /** Epoch ms before which the same call is refused (a 429). */\n retryAt?: number;\n}\n\n/** True for what a form can read as a problem: a `KrizakaApiError`, a `FormProblem`, an `{ ok: false, problem }` result. */\nexport function isFormProblem(value: unknown): value is FormProblem {\n return typeof value === \"object\" && value !== null && (\"fields\" in value || \"code\" in value || \"status\" in value);\n}\n\n/** A problem as field errors (by name) and the whole form's error (or `null` when every refusal has its field). */\nexport function problemToErrors(\n problem: FormProblem,\n i18n: FormI18n = {},\n known?: (name: string) => boolean,\n codeFields: Readonly<Record<string, string>> = {},\n): { fields: Record<string, FormFieldError>; form: FormFieldError | null } {\n const prefix = i18n.prefix ?? \"form.errors\";\n const fields: Record<string, FormFieldError> = {};\n let unplaced = false;\n // A refusal named by a code that belongs to a field (`UNDERAGE` → `dateOfBirth`): under that field, in its words.\n const owner = problem.code ? codeFields[problem.code] : undefined;\n if (owner && (!known || known(owner)) && !problem.fields?.[owner]) {\n fields[owner] = { key: `${prefix}.${problem.code}`, ...(problem.detail ? { message: problem.detail } : {}), source: \"server\" };\n if (!problem.fields || Object.keys(problem.fields).length === 0) return { fields, form: null };\n }\n for (const [name, refusal] of Object.entries(problem.fields ?? {})) {\n if (known && !known(name)) {\n unplaced = true;\n continue;\n }\n const error: FormFieldError =\n typeof refusal === \"string\"\n ? { key: refusal }\n : \"key\" in refusal\n ? refusal\n : { key: refusal.code ? (KEY.test(refusal.code) ? refusal.code : `${prefix}.${refusal.code}`) : `${prefix}.invalid`, message: refusal.message };\n fields[name] = { ...error, source: \"server\" };\n }\n const placed = Object.keys(fields).length > 0;\n if (placed && !unplaced) return { fields, form: null };\n const code = problem.code ?? (problem.status === 0 ? \"network\" : problem.status && problem.status >= 500 ? \"server\" : \"invalid\");\n const retryIn = problem.retryAt ? Math.max(1, Math.ceil((problem.retryAt - Date.now()) / 1000)) : undefined;\n return {\n fields,\n form: { key: KEY.test(code) ? code : `${i18n.apiPrefix ?? \"apiErrors\"}.${code}`, ...(problem.detail ? { message: problem.detail } : {}), ...(retryIn ? { values: { seconds: retryIn } } : {}), source: \"server\" },\n };\n}\n","// Platform-neutral: an amount typed in a field ↔ integer minor units (cents), never a float on the way.\nimport { currencyDigits } from \"@krizaka/intl\";\n\n/** The decimal separator of a locale (`en` → `.`, `fr` → `,`). */\nexport function decimalSeparator(locale: string): string {\n return new Intl.NumberFormat(locale).formatToParts(1.5).find((p) => p.type === \"decimal\")?.value ?? \".\";\n}\n\n/** The currency's sign in a locale (`USD`, `en-US` → `$`; `EUR`, `fr` → `€`). */\nexport function currencySymbol(currency: string, locale: string): string {\n return new Intl.NumberFormat(locale, { style: \"currency\", currency }).formatToParts(0).find((p) => p.type === \"currency\")?.value ?? currency;\n}\n\n/**\n * An amount as typed (`12.5`, `12,50`, `1,234.56`, `1 234,56`) → integer minor units (`1250`). `undefined` when empty,\n * `null` when it is not an amount (letters, more decimals than the currency has).\n */\nexport function parseMoney(text: string, currency: string, locale = \"en\"): number | null | undefined {\n const digits = currencyDigits(currency);\n const t = text.replace(/[\\s\\u00a0\\u202f']/g, \"\");\n if (!t) return undefined;\n const negative = t.startsWith(\"-\");\n const body = negative ? t.slice(1) : t;\n if (!/^[\\d.,]+$/.test(body)) return null;\n let int = body;\n let frac = \"\";\n const last = Math.max(body.lastIndexOf(\".\"), body.lastIndexOf(\",\"));\n if (last >= 0) {\n const tail = body.slice(last + 1);\n // The last separator is the decimal one when it is the locale's, or when it is not followed by a group of three.\n if (body[last] === decimalSeparator(locale) || tail.length !== 3) {\n if (tail.length > digits || !/^\\d*$/.test(tail)) return null;\n int = body.slice(0, last);\n frac = tail;\n }\n }\n // What is left before the decimals: digits, grouped by three when separated (`1,234,567`).\n if (!/^(\\d*|\\d{1,3}([.,]\\d{3})+)$/.test(int)) return null;\n int = int.replace(/[.,]/g, \"\");\n if (!int && !frac) return null;\n const units = BigInt(int || \"0\") * 10n ** BigInt(digits) + BigInt((frac || \"\").padEnd(digits, \"0\") || \"0\");\n const value = Number(negative ? -units : units);\n return Number.isSafeInteger(value) ? value : null;\n}\n\n/** Minor units as the field writes them while editing (`1250`, `USD`, `fr` → `12,50`): no symbol, no grouping. */\nexport function moneyInputText(minorUnits: number | null | undefined, currency: string, locale = \"en\"): string {\n if (minorUnits === null || minorUnits === undefined || !Number.isFinite(minorUnits)) return \"\";\n const digits = currencyDigits(currency);\n const sign = minorUnits < 0 ? \"-\" : \"\";\n const abs = String(Math.abs(Math.trunc(minorUnits))).padStart(digits + 1, \"0\");\n return digits === 0 ? sign + abs : `${sign}${abs.slice(0, -digits)}${decimalSeparator(locale)}${abs.slice(-digits)}`;\n}\n","// Platform-neutral: a date typed as day, month and year (the native `DateField`, the form's `DateField entry=\"parts\"`).\n// Values are ISO calendar dates, `YYYY-MM-DD`, compared as strings.\n\n/** A part of a typed date. */\nexport type DatePart = \"day\" | \"month\" | \"year\";\n\n/** The digits of each part. */\nexport const DATE_PART_LENGTH: Readonly<Record<DatePart, number>> = { day: 2, month: 2, year: 4 };\n\n/** The order of day, month and year in a locale (`en-US` → month, day, year; `fr` → day, month, year). */\nexport function datePartsOrder(locale: string): DatePart[] {\n try {\n const parts = new Intl.DateTimeFormat(locale, { day: \"2-digit\", month: \"2-digit\", year: \"numeric\" }).formatToParts(new Date(2001, 10, 22));\n const order = parts.map((p) => p.type).filter((t): t is DatePart => t === \"day\" || t === \"month\" || t === \"year\");\n if (order.length === 3) return order;\n } catch {\n // An engine without Intl's parts: day, month, year.\n }\n return [\"day\", \"month\", \"year\"];\n}\n\n/** The ISO-ordered value of what was typed: `\"\"` when nothing is, `YYYY-MM-DD` otherwise (not necessarily a real date). */\nexport function composeDate(parts: Readonly<Record<DatePart, string>>): string {\n if (!parts.day && !parts.month && !parts.year) return \"\";\n const pad = (v: string) => (v.length === 1 ? `0${v}` : v);\n return `${parts.year}-${pad(parts.month)}-${pad(parts.day)}`;\n}\n\n/** The parts of a value (`\"\"` → three empty parts). */\nexport function splitDate(value: string | null | undefined): Record<DatePart, string> {\n const m = /^(\\d*)-(\\d*)-(\\d*)$/.exec(value ?? \"\");\n return m ? { year: m[1]!, month: m[2]!, day: m[3]! } : { day: \"\", month: \"\", year: \"\" };\n}\n\n/** True for a real calendar date written `YYYY-MM-DD` (not `2001-02-30`). */\nexport function isRealDate(value: string): boolean {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return false;\n const date = new Date(`${value}T00:00:00Z`);\n return !Number.isNaN(date.getTime()) && date.toISOString().slice(0, 10) === value;\n}\n\n/** The latest date of birth of someone `age` years old today (`YYYY-MM-DD`): an age gate's `max`, `value <= latestBirthDate(18)`. */\nexport function latestBirthDate(age: number, today = new Date()): string {\n return new Date(Date.UTC(today.getFullYear() - age, today.getMonth(), today.getDate())).toISOString().slice(0, 10);\n}\n\n// ─── Shared by the pickers, web and native (no DOM, no React) ───────────────────────────────────────────────────────\n\n/** The days of a month (`month` 1–12). */\nexport function daysInMonth(year: number, month: number): number {\n return new Date(Date.UTC(year, month, 0)).getUTCDate();\n}\n\n/** `2026-10-11` → `{ year: 2026, month: 10, day: 11 }` (no check: pair it with `isRealDate`). */\nexport function isoParts(iso: string): { year: number; month: number; day: number } {\n const [year = 0, month = 0, day = 0] = iso.split(\"-\").map(Number);\n return { year, month, day };\n}\n\n/** `{ 2026, 10, 11 }` → `2026-10-11`, the day kept inside the month (`2026-02-31` → `2026-02-28`). */\nexport function isoOf(year: number, month: number, day: number): string {\n const d = Math.min(Math.max(day, 1), daysInMonth(year, month));\n return `${String(year).padStart(4, \"0\")}-${String(month).padStart(2, \"0\")}-${String(d).padStart(2, \"0\")}`;\n}\n\n/** The ISO date of today on this device (or of the `Date` given). */\nexport function todayIso(now = new Date()): string {\n return isoOf(now.getFullYear(), now.getMonth() + 1, now.getDate());\n}\n\n/** The age in whole years on `today` of someone born on `birth` (both ISO). */\nexport function ageOn(birth: string, today: string = todayIso()): number {\n const b = isoParts(birth);\n const t = isoParts(today);\n return t.year - b.year - (t.month < b.month || (t.month === b.month && t.day < b.day) ? 1 : 0);\n}\n\n/** The month names of a locale, January first (`long` · `short` · `narrow`). */\nexport function monthNames(locale: string, style: \"long\" | \"short\" | \"narrow\" = \"long\"): string[] {\n const format = new Intl.DateTimeFormat(locale, { month: style, timeZone: \"UTC\" });\n return Array.from({ length: 12 }, (_, i) => format.format(new Date(Date.UTC(2001, i, 1))));\n}\n\n/** The years from `from` to `to`, both included, in that order (descending when `from > to`). */\nexport function yearRange(from: number, to: number): number[] {\n const step = from <= to ? 1 : -1;\n return Array.from({ length: Math.abs(to - from) + 1 }, (_, i) => from + i * step);\n}\n\n/** A time of day, `HH:mm` on 24 hours (`\"09:30\"`, `\"18:00\"`): the value of every time picker. */\nexport type TimeValue = string;\n\n/** `\"9:5\"` / `\"09:05\"` → minutes since midnight; `null` when it is not a time. */\nexport function timeToMinutes(value: string | null | undefined): number | null {\n const m = /^(\\d{1,2}):(\\d{1,2})$/.exec(value ?? \"\");\n if (!m) return null;\n const h = Number(m[1]);\n const min = Number(m[2]);\n return h < 24 && min < 60 ? h * 60 + min : null;\n}\n\n/** Minutes since midnight → `HH:mm`. */\nexport function minutesToTime(minutes: number): TimeValue {\n const m = ((Math.round(minutes) % 1440) + 1440) % 1440;\n return `${String(Math.floor(m / 60)).padStart(2, \"0\")}:${String(m % 60).padStart(2, \"0\")}`;\n}\n\n/** The slots of a day from `start` to `end` (excluded) every `step` minutes: `timeSlots(\"09:00\", \"12:00\", 30)`. */\nexport function timeSlots(start: TimeValue, end: TimeValue, step = 30): TimeValue[] {\n const a = timeToMinutes(start);\n const b = timeToMinutes(end);\n if (a === null || b === null || step <= 0) return [];\n const slots: TimeValue[] = [];\n for (let m = a; m < b; m += step) slots.push(minutesToTime(m));\n return slots;\n}\n\n/** True when the locale writes the time on 12 hours with a day period (`en-US` → true, `fr-CA` → false). */\nexport function uses12Hours(locale: string): boolean {\n try {\n const options = new Intl.DateTimeFormat(locale, { hour: \"numeric\" }).resolvedOptions() as Intl.ResolvedDateTimeFormatOptions & { hourCycle?: string };\n return options.hourCycle ? options.hourCycle === \"h12\" || options.hourCycle === \"h11\" : Boolean(options.hour12);\n } catch {\n return false;\n }\n}\n\n/** The day periods of a locale, morning first (`[\"AM\", \"PM\"]`, `[\"a.m.\", \"p.m.\"]`). */\nexport function dayPeriods(locale: string): [string, string] {\n const format = new Intl.DateTimeFormat(locale, { hour: \"numeric\", hour12: true, timeZone: \"UTC\" });\n const period = (h: number) => format.formatToParts(new Date(Date.UTC(2001, 0, 1, h))).find((p) => p.type === \"dayPeriod\")?.value ?? (h < 12 ? \"AM\" : \"PM\");\n return [period(9), period(15)];\n}\n\n/** A time written the locale's way (`\"18:30\"` → `\"6:30 PM\"` in en-US, `\"18 h 30\"` in fr-CA). */\nexport function formatTime(locale: string, value: TimeValue): string {\n const minutes = timeToMinutes(value);\n if (minutes === null) return \"\";\n return new Intl.DateTimeFormat(locale, { hour: \"numeric\", minute: \"2-digit\", timeZone: \"UTC\" }).format(new Date(Date.UTC(2001, 0, 1, 0, minutes)));\n}\n\n/** A local `Date` at midnight for an ISO date (for formatting). */\nexport const toLocalDate = (iso: string) => {\n const { year, month, day } = isoParts(iso);\n return new Date(year, month - 1, day);\n};\n/** The ISO date of a local `Date`. */\nexport const toIsoDate = (date: Date): string => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}-${String(date.getDate()).padStart(2, \"0\")}`;\n/** The ISO date `days` later (or earlier). */\nexport const addDays = (iso: string, days: number) => {\n const date = toLocalDate(iso);\n date.setDate(date.getDate() + days);\n return toIsoDate(date);\n};\n/** The ISO date `months` later (or earlier), the day kept inside the shorter months (`01-31` + 1 → `02-28`). */\nexport const addMonths = (iso: string, months: number) => {\n const { year, month, day } = isoParts(iso);\n const first = new Date(year, month - 1 + months, 1);\n return isoOf(first.getFullYear(), first.getMonth() + 1, day);\n};\n\n/** The first day of the week for a locale (0 = Sunday … 6 = Saturday), from `Intl.Locale` week info; Monday otherwise. */\nexport function weekStartOf(locale: string): number {\n try {\n const info = new Intl.Locale(locale) as Intl.Locale & { getWeekInfo?: () => { firstDay: number }; weekInfo?: { firstDay: number } };\n const firstDay = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;\n return firstDay ? firstDay % 7 : 1;\n } catch {\n return 1;\n }\n}\n\n/** The weeks of a month's grid (six at most), each seven ISO dates from the locale's first day of the week. */\nexport function monthGrid(month: string, weekStartsOn: number): string[][] {\n const first = `${month.slice(0, 7)}-01`;\n const lead = (toLocalDate(first).getDay() - weekStartsOn + 7) % 7;\n const start = addDays(first, -lead);\n const days = Array.from({ length: 42 }, (_, i) => addDays(start, i));\n return Array.from({ length: 6 }, (_, w) => days.slice(w * 7, w * 7 + 7)).filter((week, w) => w < 5 || week[0]!.slice(0, 7) === first.slice(0, 7));\n}\n"],"mappings":";AAIA;AAAA,EAEE;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EAEZ,aAAa;A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