@krizaka/ui 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/README.md +1 -1
  2. package/dist/achievement.js +1 -1
  3. package/dist/action-bar.js +1 -1
  4. package/dist/app-shell.js +1 -1
  5. package/dist/argument-card.js +2 -2
  6. package/dist/card-grid.js +1 -1
  7. package/dist/card.js +1 -1
  8. package/dist/choice-grid.js +1 -1
  9. package/dist/{chunk-OGJI5X4W.js → chunk-2PUDI7JS.js} +2 -2
  10. package/dist/chunk-4LOMIQVX.js +21 -0
  11. package/dist/chunk-4LOMIQVX.js.map +1 -0
  12. package/dist/{chunk-K3SWZXYT.js → chunk-DGQMDJXK.js} +2 -2
  13. package/dist/chunk-G3ETON2A.js +22 -0
  14. package/dist/chunk-G3ETON2A.js.map +1 -0
  15. package/dist/chunk-I5RVM5CW.js +27 -0
  16. package/dist/chunk-I5RVM5CW.js.map +1 -0
  17. package/dist/chunk-IZ7MV6HM.js +26 -0
  18. package/dist/chunk-IZ7MV6HM.js.map +1 -0
  19. package/dist/chunk-ZNMFG62E.js +20 -0
  20. package/dist/chunk-ZNMFG62E.js.map +1 -0
  21. package/dist/cn.d.ts +9 -1
  22. package/dist/cn.js +5 -3
  23. package/dist/code-block.js +1 -1
  24. package/dist/command.js +1 -1
  25. package/dist/confirm-button.js +1 -1
  26. package/dist/continue-prompt.js +1 -1
  27. package/dist/cta-panel.js +1 -1
  28. package/dist/data-table.js +2 -2
  29. package/dist/date-picker.d.ts +650 -61
  30. package/dist/date-picker.js +918 -122
  31. package/dist/date-picker.js.map +1 -1
  32. package/dist/decision-list.js +1 -1
  33. package/dist/dropdown-menu.js +1 -1
  34. package/dist/error-page.js +1 -1
  35. package/dist/field.js +1 -1
  36. package/dist/filter-bar.js +2 -2
  37. package/dist/form/server.d.ts +96 -0
  38. package/dist/form/server.js +82 -0
  39. package/dist/form/server.js.map +1 -0
  40. package/dist/form.d.ts +503 -0
  41. package/dist/form.js +760 -0
  42. package/dist/form.js.map +1 -0
  43. package/dist/gallery-page.js +1 -1
  44. package/dist/glow-card.js +1 -1
  45. package/dist/goal-gauge.js +1 -1
  46. package/dist/how-it-works-page.js +1 -1
  47. package/dist/landscape.js +1 -1
  48. package/dist/link-card.js +1 -1
  49. package/dist/longform-page.js +1 -1
  50. package/dist/marquee.js +1 -1
  51. package/dist/mascot-quote.js +1 -1
  52. package/dist/motion.css +18 -1
  53. package/dist/native/form.d.ts +376 -0
  54. package/dist/native/form.js +650 -0
  55. package/dist/native/form.js.map +1 -0
  56. package/dist/native.d.ts +351 -3
  57. package/dist/native.js +1205 -399
  58. package/dist/native.js.map +1 -1
  59. package/dist/nav-bar.js +1 -1
  60. package/dist/page-hero.js +2 -2
  61. package/dist/page.js +2 -2
  62. package/dist/popover.js +1 -1
  63. package/dist/pricing-page.js +1 -1
  64. package/dist/product-page.js +1 -1
  65. package/dist/profile-card.js +1 -1
  66. package/dist/promise-card.js +1 -1
  67. package/dist/scroll-stage.js +1 -1
  68. package/dist/stage-banner.js +1 -1
  69. package/dist/terminal-replay.js +1 -1
  70. package/dist/toast.js +1 -1
  71. package/dist/toc.js +1 -1
  72. package/dist/tooltip.js +1 -1
  73. package/package.json +50 -7
  74. package/registry/achievement.json +1 -1
  75. package/registry/action-bar.json +1 -1
  76. package/registry/alert.json +1 -1
  77. package/registry/app-shell.json +1 -1
  78. package/registry/argument-card.json +1 -1
  79. package/registry/audio-player.json +1 -1
  80. package/registry/auth-layout.json +1 -1
  81. package/registry/avatar.json +1 -1
  82. package/registry/badge.json +1 -1
  83. package/registry/button.json +1 -1
  84. package/registry/card-grid.json +1 -1
  85. package/registry/card.json +1 -1
  86. package/registry/catalogue-page.json +1 -1
  87. package/registry/changelog-page.json +1 -1
  88. package/registry/checkbox.json +89 -4
  89. package/registry/chip-link.json +1 -1
  90. package/registry/chip.json +1 -1
  91. package/registry/choice-grid.json +1 -1
  92. package/registry/cn.json +1 -1
  93. package/registry/code-block.json +1 -1
  94. package/registry/combobox.json +1 -1
  95. package/registry/command.json +1 -1
  96. package/registry/component-page.json +1 -1
  97. package/registry/confirm-button.json +1 -1
  98. package/registry/contact-page.json +1 -1
  99. package/registry/continue-prompt.json +1 -1
  100. package/registry/countdown.json +1 -1
  101. package/registry/cta-panel.json +1 -1
  102. package/registry/dashboard-layout.json +1 -1
  103. package/registry/data-table.json +1 -1
  104. package/registry/date-picker.json +1811 -236
  105. package/registry/decision-list.json +1 -1
  106. package/registry/detail-layout.json +1 -1
  107. package/registry/dialog.json +1 -1
  108. package/registry/docs-article-page.json +1 -1
  109. package/registry/docs-hub-page.json +1 -1
  110. package/registry/docs-layout.json +1 -1
  111. package/registry/dropdown-menu.json +1 -1
  112. package/registry/empty-state.json +1 -1
  113. package/registry/error-page.json +1 -1
  114. package/registry/examples/checkbox/native/terms.d.ts +4 -0
  115. package/registry/examples/checkbox/native/terms.dark.png +0 -0
  116. package/registry/examples/checkbox/native/terms.js +26 -0
  117. package/registry/examples/checkbox/native/terms.light.png +0 -0
  118. package/registry/examples/checkbox/native/terms.tsx +28 -0
  119. package/registry/examples/date-picker/birth-date-wheel.d.ts +4 -0
  120. package/registry/examples/date-picker/birth-date-wheel.js +13 -0
  121. package/registry/examples/date-picker/birth-date-wheel.tsx +11 -0
  122. package/registry/examples/date-picker/birth-date.d.ts +4 -0
  123. package/registry/examples/date-picker/birth-date.js +25 -0
  124. package/registry/examples/date-picker/birth-date.tsx +21 -0
  125. package/registry/examples/date-picker/calendar.js +1 -1
  126. package/registry/examples/date-picker/calendar.tsx +2 -6
  127. package/registry/examples/date-picker/day-strip.d.ts +4 -0
  128. package/registry/examples/date-picker/day-strip.js +28 -0
  129. package/registry/examples/date-picker/day-strip.tsx +27 -0
  130. package/registry/examples/date-picker/month-year.d.ts +4 -0
  131. package/registry/examples/date-picker/month-year.js +13 -0
  132. package/registry/examples/date-picker/month-year.tsx +10 -0
  133. package/registry/examples/date-picker/native/birth-date-wheel.d.ts +4 -0
  134. package/registry/examples/date-picker/native/birth-date-wheel.dark.png +0 -0
  135. package/registry/examples/date-picker/native/birth-date-wheel.js +13 -0
  136. package/registry/examples/date-picker/native/birth-date-wheel.light.png +0 -0
  137. package/registry/examples/date-picker/native/birth-date-wheel.tsx +9 -0
  138. package/registry/examples/date-picker/native/birth-date.d.ts +4 -0
  139. package/registry/examples/date-picker/native/birth-date.dark.png +0 -0
  140. package/registry/examples/date-picker/native/birth-date.js +30 -0
  141. package/registry/examples/date-picker/native/birth-date.light.png +0 -0
  142. package/registry/examples/date-picker/native/birth-date.tsx +27 -0
  143. package/registry/examples/date-picker/native/calendar.d.ts +4 -0
  144. package/registry/examples/date-picker/native/calendar.dark.png +0 -0
  145. package/registry/examples/date-picker/native/calendar.js +13 -0
  146. package/registry/examples/date-picker/native/calendar.light.png +0 -0
  147. package/registry/examples/date-picker/native/calendar.tsx +8 -0
  148. package/registry/examples/date-picker/native/day-strip.d.ts +4 -0
  149. package/registry/examples/date-picker/native/day-strip.dark.png +0 -0
  150. package/registry/examples/date-picker/native/day-strip.js +29 -0
  151. package/registry/examples/date-picker/native/day-strip.light.png +0 -0
  152. package/registry/examples/date-picker/native/day-strip.tsx +26 -0
  153. package/registry/examples/date-picker/native/month-year.d.ts +4 -0
  154. package/registry/examples/date-picker/native/month-year.dark.png +0 -0
  155. package/registry/examples/date-picker/native/month-year.js +13 -0
  156. package/registry/examples/date-picker/native/month-year.light.png +0 -0
  157. package/registry/examples/date-picker/native/month-year.tsx +8 -0
  158. package/registry/examples/date-picker/native/time-slots.d.ts +4 -0
  159. package/registry/examples/date-picker/native/time-slots.dark.png +0 -0
  160. package/registry/examples/date-picker/native/time-slots.js +15 -0
  161. package/registry/examples/date-picker/native/time-slots.light.png +0 -0
  162. package/registry/examples/date-picker/native/time-slots.tsx +15 -0
  163. package/registry/examples/date-picker/native/time-wheel.d.ts +4 -0
  164. package/registry/examples/date-picker/native/time-wheel.dark.png +0 -0
  165. package/registry/examples/date-picker/native/time-wheel.js +13 -0
  166. package/registry/examples/date-picker/native/time-wheel.light.png +0 -0
  167. package/registry/examples/date-picker/native/time-wheel.tsx +8 -0
  168. package/registry/examples/date-picker/time-slots.d.ts +4 -0
  169. package/registry/examples/date-picker/time-slots.js +26 -0
  170. package/registry/examples/date-picker/time-slots.tsx +25 -0
  171. package/registry/examples/date-picker/time-wheel.d.ts +4 -0
  172. package/registry/examples/date-picker/time-wheel.js +13 -0
  173. package/registry/examples/date-picker/time-wheel.tsx +10 -0
  174. package/registry/examples/date-picker/wheel.d.ts +4 -0
  175. package/registry/examples/date-picker/wheel.js +14 -0
  176. package/registry/examples/date-picker/wheel.tsx +16 -0
  177. package/registry/examples/field/native/default.d.ts +4 -0
  178. package/registry/examples/field/native/default.dark.png +0 -0
  179. package/registry/examples/field/native/default.js +29 -0
  180. package/registry/examples/field/native/default.light.png +0 -0
  181. package/registry/examples/field/native/default.tsx +23 -0
  182. package/registry/examples/form/amount.d.ts +4 -0
  183. package/registry/examples/form/amount.js +30 -0
  184. package/registry/examples/form/amount.tsx +36 -0
  185. package/registry/examples/form/audience.d.ts +4 -0
  186. package/registry/examples/form/audience.js +29 -0
  187. package/registry/examples/form/audience.tsx +31 -0
  188. package/registry/examples/form/native/amount.d.ts +4 -0
  189. package/registry/examples/form/native/amount.dark.png +0 -0
  190. package/registry/examples/form/native/amount.js +26 -0
  191. package/registry/examples/form/native/amount.light.png +0 -0
  192. package/registry/examples/form/native/amount.tsx +30 -0
  193. package/registry/examples/form/native/audience.d.ts +4 -0
  194. package/registry/examples/form/native/audience.dark.png +0 -0
  195. package/registry/examples/form/native/audience.js +24 -0
  196. package/registry/examples/form/native/audience.light.png +0 -0
  197. package/registry/examples/form/native/audience.tsx +24 -0
  198. package/registry/examples/form/native/profile.d.ts +4 -0
  199. package/registry/examples/form/native/profile.dark.png +0 -0
  200. package/registry/examples/form/native/profile.js +33 -0
  201. package/registry/examples/form/native/profile.light.png +0 -0
  202. package/registry/examples/form/native/profile.tsx +36 -0
  203. package/registry/examples/form/native/settings.d.ts +4 -0
  204. package/registry/examples/form/native/settings.dark.png +0 -0
  205. package/registry/examples/form/native/settings.js +25 -0
  206. package/registry/examples/form/native/settings.light.png +0 -0
  207. package/registry/examples/form/native/settings.tsx +23 -0
  208. package/registry/examples/form/native/sign-up.d.ts +4 -0
  209. package/registry/examples/form/native/sign-up.dark.png +0 -0
  210. package/registry/examples/form/native/sign-up.js +38 -0
  211. package/registry/examples/form/native/sign-up.light.png +0 -0
  212. package/registry/examples/form/native/sign-up.tsx +34 -0
  213. package/registry/examples/form/native/upload.d.ts +4 -0
  214. package/registry/examples/form/native/upload.dark.png +0 -0
  215. package/registry/examples/form/native/upload.js +23 -0
  216. package/registry/examples/form/native/upload.light.png +0 -0
  217. package/registry/examples/form/native/upload.tsx +22 -0
  218. package/registry/examples/form/profile.d.ts +4 -0
  219. package/registry/examples/form/profile.js +35 -0
  220. package/registry/examples/form/profile.tsx +40 -0
  221. package/registry/examples/form/report.d.ts +4 -0
  222. package/registry/examples/form/report.js +30 -0
  223. package/registry/examples/form/report.tsx +30 -0
  224. package/registry/examples/form/settings.d.ts +4 -0
  225. package/registry/examples/form/settings.js +30 -0
  226. package/registry/examples/form/settings.tsx +31 -0
  227. package/registry/examples/form/sign-up.d.ts +4 -0
  228. package/registry/examples/form/sign-up.js +38 -0
  229. package/registry/examples/form/sign-up.tsx +37 -0
  230. package/registry/examples/form/upload.d.ts +4 -0
  231. package/registry/examples/form/upload.js +32 -0
  232. package/registry/examples/form/upload.tsx +32 -0
  233. package/registry/field.json +104 -4
  234. package/registry/file-upload.json +1 -1
  235. package/registry/filter-bar.json +1 -1
  236. package/registry/form.json +2940 -0
  237. package/registry/gallery-page.json +1 -1
  238. package/registry/glow-card.json +1 -1
  239. package/registry/goal-gauge.json +1 -1
  240. package/registry/how-it-works-page.json +1 -1
  241. package/registry/image-cropper.json +1 -1
  242. package/registry/index.json +43 -10
  243. package/registry/iso.json +1 -1
  244. package/registry/kbd.json +1 -1
  245. package/registry/landing-page.json +1 -1
  246. package/registry/landscape.json +1 -1
  247. package/registry/legal-page.json +1 -1
  248. package/registry/link-card.json +1 -1
  249. package/registry/loader.json +1 -1
  250. package/registry/longform-page.json +1 -1
  251. package/registry/marketing-layout.json +1 -1
  252. package/registry/marquee.json +1 -1
  253. package/registry/mascot-quote.json +1 -1
  254. package/registry/mascot-state.json +2 -2
  255. package/registry/mascots.json +2 -2
  256. package/registry/media-capture.json +1 -1
  257. package/registry/meter.json +1 -1
  258. package/registry/nav-bar.json +1 -1
  259. package/registry/number-ticker.json +1 -1
  260. package/registry/page-header.json +1 -1
  261. package/registry/page-hero.json +1 -1
  262. package/registry/page.json +1 -1
  263. package/registry/pagination.json +1 -1
  264. package/registry/pointer-light.json +1 -1
  265. package/registry/popover.json +1 -1
  266. package/registry/pricing-page.json +1 -1
  267. package/registry/product-page.json +1 -1
  268. package/registry/profile-card.json +1 -1
  269. package/registry/progress.json +1 -1
  270. package/registry/promise-card.json +1 -1
  271. package/registry/radio-group.json +1 -1
  272. package/registry/scroll-stage.json +1 -1
  273. package/registry/search-field.json +1 -1
  274. package/registry/section-backdrop.json +1 -1
  275. package/registry/separator.json +1 -1
  276. package/registry/settings-layout.json +1 -1
  277. package/registry/skeleton.json +1 -1
  278. package/registry/slider.json +1 -1
  279. package/registry/slot.json +1 -1
  280. package/registry/spinner.json +1 -1
  281. package/registry/split-view.json +1 -1
  282. package/registry/stage-banner.json +1 -1
  283. package/registry/stat.json +1 -1
  284. package/registry/status-page.json +1 -1
  285. package/registry/stepper.json +1 -1
  286. package/registry/switch.json +1 -1
  287. package/registry/tabs.json +1 -1
  288. package/registry/tag-input.json +1 -1
  289. package/registry/terminal-replay.json +1 -1
  290. package/registry/theme.json +8 -1
  291. package/registry/toast.json +1 -1
  292. package/registry/toc.json +1 -1
  293. package/registry/tooltip.json +1 -1
  294. package/registry/video-player.json +1 -1
  295. package/registry/video-trimmer.json +1 -1
  296. package/registry/virtual.json +1 -1
  297. package/skills/date-picker/SKILL.md +43 -0
  298. package/skills/form/SKILL.md +44 -0
  299. package/dist/chunk-2USC2YT6.js +0 -17
  300. package/dist/chunk-2USC2YT6.js.map +0 -1
  301. package/dist/chunk-5AXLA4LK.js +0 -13
  302. package/dist/chunk-5AXLA4LK.js.map +0 -1
  303. package/dist/chunk-FJDSLNXK.js +0 -11
  304. package/dist/chunk-FJDSLNXK.js.map +0 -1
  305. package/dist/chunk-KNBYZGSQ.js +0 -11
  306. package/dist/chunk-KNBYZGSQ.js.map +0 -1
  307. package/dist/chunk-VCAAHCHL.js +0 -17
  308. package/dist/chunk-VCAAHCHL.js.map +0 -1
  309. /package/dist/{chunk-OGJI5X4W.js.map → chunk-2PUDI7JS.js.map} +0 -0
  310. /package/dist/{chunk-K3SWZXYT.js.map → chunk-DGQMDJXK.js.map} +0 -0
@@ -0,0 +1,22 @@
1
+ import { createKrizakaForm } from "@krizaka/ui/native/form";
2
+ import { z } from "zod";
3
+
4
+ // What describes a video picked from the library (the picker is the app's: expo-image-picker): title, description, audience.
5
+ const upload = createKrizakaForm({
6
+ schema: z.object({ title: z.string().min(3).max(100), description: z.string().max(2000), visibility: z.enum(["public", "followers", "private"]) }),
7
+ defaultValues: { title: "Sunrise over Rysy", description: "", visibility: "public" as "public" | "followers" | "private" },
8
+ });
9
+ const VISIBILITY = [{ value: "public", label: "Everyone" }, { value: "followers", label: "Followers" }, { value: "private", label: "Only me" }];
10
+
11
+ // The details of an upload, then the button that publishes them with the file.
12
+ export default function NativeFormUpload() {
13
+ const form = upload.useForm({ onSubmit: (values) => new Promise((done) => setTimeout(() => done(values), 600)) });
14
+ return (
15
+ <form.Form aria-label="Publish a video" style={{ width: 312 }}>
16
+ <form.TextField name="title" label="Title" maxLength={100} />
17
+ <form.TextArea name="description" label="Description" placeholder="What happens in it?" />
18
+ <form.RadioGroup name="visibility" label="Who can watch" options={VISIBILITY} />
19
+ <form.Submit label="Publish" />
20
+ </form.Form>
21
+ );
22
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ // registry/examples/form/profile.tsx
4
+ import { KrizakaQueryProvider, useMutation } from "@krizaka/query";
5
+ import { Button } from "@krizaka/ui/button";
6
+ import { createKrizakaForm } from "@krizaka/ui/form";
7
+ import { z } from "zod";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ var profile = createKrizakaForm({
10
+ schema: z.object({ displayName: z.string().min(2).max(40), bio: z.string().max(160), categories: z.array(z.string()).min(1).max(3), tags: z.array(z.string()).max(10), links: z.array(z.object({ url: z.url() })).max(3) }),
11
+ defaultValues: { displayName: "Elena Varga", bio: "Night skies over the Tatras.", categories: ["travel"], tags: ["astro", "mountains"], links: [{ url: "https://elena.example" }] }
12
+ });
13
+ var CATEGORIES = [{ value: "travel", label: "Travel" }, { value: "music", label: "Music" }, { value: "science", label: "Science" }, { value: "sport", label: "Sport" }];
14
+ function ProfileForm() {
15
+ const mutation = useMutation({ mutationFn: (values) => new Promise((done) => setTimeout(() => done(values), 400)) });
16
+ const form = profile.useForm({ onSubmit: (values) => mutation.mutateAsync(values) });
17
+ return /* @__PURE__ */ jsxs(form.Form, { "aria-label": "Your profile", className: "flex w-96 flex-col gap-4", children: [
18
+ /* @__PURE__ */ jsx(form.TextField, { name: "displayName", label: "Display name", autoComplete: "name" }),
19
+ /* @__PURE__ */ jsx(form.TextArea, { name: "bio", label: "Bio", rows: 3, maxLength: 160, hint: "Up to 160 characters." }),
20
+ /* @__PURE__ */ jsx(form.Combobox, { name: "categories", label: "Categories", multiple: true, options: CATEGORIES, hint: "Up to three." }),
21
+ /* @__PURE__ */ jsx(form.TagInput, { name: "tags", label: "Tags", max: 10, normalize: (t) => t.toLowerCase().replace(/^#/, "") }),
22
+ /* @__PURE__ */ jsx(form.FieldArray, { name: "links", children: (links) => /* @__PURE__ */ jsxs("fieldset", { className: "flex flex-col gap-2", children: [
23
+ /* @__PURE__ */ jsx("legend", { className: "text-xs font-semibold text-fg-secondary", children: "Links" }),
24
+ links.items.map((_, i) => /* @__PURE__ */ jsx(form.TextField, { name: `links[${i}].url`, label: `Link ${i + 1}`, type: "url" }, i)),
25
+ links.items.length < 3 ? /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: () => links.push({ url: "" }), children: "Add a link" }) : null
26
+ ] }) }),
27
+ /* @__PURE__ */ jsx(form.Submit, { children: "Save the profile" })
28
+ ] });
29
+ }
30
+ function FormProfile() {
31
+ return /* @__PURE__ */ jsx(KrizakaQueryProvider, { children: /* @__PURE__ */ jsx(ProfileForm, {}) });
32
+ }
33
+ export {
34
+ FormProfile as default
35
+ };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+
3
+ import { KrizakaQueryProvider, useMutation } from "@krizaka/query";
4
+ import { Button } from "@krizaka/ui/button";
5
+ import { createKrizakaForm } from "@krizaka/ui/form";
6
+ import { z } from "zod";
7
+
8
+ const profile = createKrizakaForm({
9
+ schema: z.object({ displayName: z.string().min(2).max(40), bio: z.string().max(160), categories: z.array(z.string()).min(1).max(3), tags: z.array(z.string()).max(10), links: z.array(z.object({ url: z.url() })).max(3) }),
10
+ defaultValues: { displayName: "Elena Varga", bio: "Night skies over the Tatras.", categories: ["travel"], tags: ["astro", "mountains"], links: [{ url: "https://elena.example" }] },
11
+ });
12
+ const CATEGORIES = [{ value: "travel", label: "Travel" }, { value: "music", label: "Music" }, { value: "science", label: "Science" }, { value: "sport", label: "Sport" }];
13
+
14
+ function ProfileForm() {
15
+ const mutation = useMutation({ mutationFn: (values: unknown) => new Promise((done) => setTimeout(() => done(values), 400)) });
16
+ const form = profile.useForm({ onSubmit: (values) => mutation.mutateAsync(values) });
17
+ return (
18
+ <form.Form aria-label="Your profile" className="flex w-96 flex-col gap-4">
19
+ <form.TextField name="displayName" label="Display name" autoComplete="name" />
20
+ <form.TextArea name="bio" label="Bio" rows={3} maxLength={160} hint="Up to 160 characters." />
21
+ <form.Combobox name="categories" label="Categories" multiple options={CATEGORIES} hint="Up to three." />
22
+ <form.TagInput name="tags" label="Tags" max={10} normalize={(t) => t.toLowerCase().replace(/^#/, "")} />
23
+ <form.FieldArray name="links">
24
+ {(links) => (
25
+ <fieldset className="flex flex-col gap-2">
26
+ <legend className="text-xs font-semibold text-fg-secondary">Links</legend>
27
+ {links.items.map((_, i) => <form.TextField key={i} name={`links[${i}].url`} label={`Link ${i + 1}`} type="url" />)}
28
+ {links.items.length < 3 ? <Button type="button" size="sm" variant="ghost" onClick={() => links.push({ url: "" })}>Add a link</Button> : null}
29
+ </fieldset>
30
+ )}
31
+ </form.FieldArray>
32
+ <form.Submit>Save the profile</form.Submit>
33
+ </form.Form>
34
+ );
35
+ }
36
+
37
+ // A profile saved by a mutation of @krizaka/query: categories, tags, a list of links that grows.
38
+ export default function FormProfile() {
39
+ return <KrizakaQueryProvider><ProfileForm /></KrizakaQueryProvider>;
40
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+
3
+ // registry/examples/form/report.tsx
4
+ import { createKrizakaForm } from "@krizaka/ui/form";
5
+ import { z } from "zod";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var report = createKrizakaForm({
8
+ schema: z.object({ reason: z.enum(["spam", "harassment", "minor", "copyright", "other"], { message: "report.reason.required" }), details: z.string().max(500), block: z.boolean() }),
9
+ defaultValues: { reason: "", details: "", block: false },
10
+ i18n: { t: (key) => key === "report.reason.required" ? "Choose what is wrong." : void 0 }
11
+ });
12
+ var REASONS = [
13
+ { value: "spam", label: "Spam or a scam" },
14
+ { value: "harassment", label: "Harassment" },
15
+ { value: "minor", label: "It may involve a minor" },
16
+ { value: "copyright", label: "It uses my work" },
17
+ { value: "other", label: "Something else" }
18
+ ];
19
+ function FormReport() {
20
+ const form = report.useForm({ onSubmit: (values) => new Promise((done) => setTimeout(() => done(values), 400)) });
21
+ return /* @__PURE__ */ jsxs(form.Form, { "aria-label": "Report this video", className: "flex w-80 flex-col gap-4", children: [
22
+ /* @__PURE__ */ jsx(form.RadioGroup, { name: "reason", label: "What is wrong?", options: REASONS }),
23
+ /* @__PURE__ */ jsx(form.TextArea, { name: "details", label: "Details", hint: "Optional. What should our team look at?", rows: 3, maxLength: 500 }),
24
+ /* @__PURE__ */ jsx(form.Checkbox, { name: "block", label: "Also block this account" }),
25
+ /* @__PURE__ */ jsx(form.Submit, { variant: "danger", children: "Send the report" })
26
+ ] });
27
+ }
28
+ export {
29
+ FormReport as default
30
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+
3
+ import { createKrizakaForm } from "@krizaka/ui/form";
4
+ import { z } from "zod";
5
+
6
+ const report = createKrizakaForm({
7
+ schema: z.object({ reason: z.enum(["spam", "harassment", "minor", "copyright", "other"], { message: "report.reason.required" }), details: z.string().max(500), block: z.boolean() }),
8
+ defaultValues: { reason: "" as unknown as "spam", details: "", block: false },
9
+ i18n: { t: (key) => (key === "report.reason.required" ? "Choose what is wrong." : undefined) },
10
+ });
11
+ const REASONS = [
12
+ { value: "spam", label: "Spam or a scam" },
13
+ { value: "harassment", label: "Harassment" },
14
+ { value: "minor", label: "It may involve a minor" },
15
+ { value: "copyright", label: "It uses my work" },
16
+ { value: "other", label: "Something else" },
17
+ ];
18
+
19
+ // A report: one reason among a few, details, and blocking the account in the same step.
20
+ export default function FormReport() {
21
+ const form = report.useForm({ onSubmit: (values) => new Promise((done) => setTimeout(() => done(values), 400)) });
22
+ return (
23
+ <form.Form aria-label="Report this video" className="flex w-80 flex-col gap-4">
24
+ <form.RadioGroup name="reason" label="What is wrong?" options={REASONS} />
25
+ <form.TextArea name="details" label="Details" hint="Optional. What should our team look at?" rows={3} maxLength={500} />
26
+ <form.Checkbox name="block" label="Also block this account" />
27
+ <form.Submit variant="danger">Send the report</form.Submit>
28
+ </form.Form>
29
+ );
30
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+
3
+ // registry/examples/form/settings.tsx
4
+ import { createKrizakaForm } from "@krizaka/ui/form";
5
+ import { z } from "zod";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var settings = createKrizakaForm({
8
+ schema: z.object({ language: z.enum(["en", "fr", "es"]), emailDigest: z.boolean(), pushMessages: z.boolean(), autoplayVolume: z.number().min(0).max(100), quality: z.enum(["auto", "data-saver", "best"]) }),
9
+ defaultValues: { language: "en", emailDigest: true, pushMessages: false, autoplayVolume: 40, quality: "auto" }
10
+ });
11
+ var LANGUAGES = [{ value: "en", label: "English" }, { value: "fr", label: "Fran\xE7ais" }, { value: "es", label: "Espa\xF1ol" }];
12
+ var QUALITY = [{ value: "auto", label: "Automatic" }, { value: "data-saver", label: "Data saver" }, { value: "best", label: "Best" }];
13
+ async function saveSettings() {
14
+ await new Promise((done) => setTimeout(done, 400));
15
+ return { ok: true };
16
+ }
17
+ function FormSettings() {
18
+ const form = settings.useFormWithAction(saveSettings);
19
+ return /* @__PURE__ */ jsxs(form.Form, { "aria-label": "Settings", className: "flex w-96 flex-col gap-5", children: [
20
+ /* @__PURE__ */ jsx(form.Select, { name: "language", label: "Language", options: LANGUAGES }),
21
+ /* @__PURE__ */ jsx(form.Switch, { name: "emailDigest", label: "Weekly e-mail", hint: "What happened on your channel." }),
22
+ /* @__PURE__ */ jsx(form.Switch, { name: "pushMessages", label: "Message notifications" }),
23
+ /* @__PURE__ */ jsx(form.Slider, { name: "autoplayVolume", label: "Autoplay volume", step: 10, formatValue: (v) => `${v} %` }),
24
+ /* @__PURE__ */ jsx(form.RadioGroup, { name: "quality", label: "Video quality", options: QUALITY, orientation: "horizontal" }),
25
+ /* @__PURE__ */ jsx(form.Submit, { children: "Save the settings" })
26
+ ] });
27
+ }
28
+ export {
29
+ FormSettings as default
30
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import { createKrizakaForm, type FormActionResult } from "@krizaka/ui/form";
4
+ import { z } from "zod";
5
+
6
+ const settings = createKrizakaForm({
7
+ schema: z.object({ language: z.enum(["en", "fr", "es"]), emailDigest: z.boolean(), pushMessages: z.boolean(), autoplayVolume: z.number().min(0).max(100), quality: z.enum(["auto", "data-saver", "best"]) }),
8
+ defaultValues: { language: "en" as "en" | "fr" | "es", emailDigest: true, pushMessages: false, autoplayVolume: 40, quality: "auto" as "auto" | "data-saver" | "best" },
9
+ });
10
+ const LANGUAGES = [{ value: "en", label: "English" }, { value: "fr", label: "Français" }, { value: "es", label: "Español" }];
11
+ const QUALITY = [{ value: "auto", label: "Automatic" }, { value: "data-saver", label: "Data saver" }, { value: "best", label: "Best" }];
12
+ // What a Server Action answers (`"use server"` in the app): done, or a refusal the form shows.
13
+ async function saveSettings(): Promise<FormActionResult> {
14
+ await new Promise((done) => setTimeout(done, 400));
15
+ return { ok: true };
16
+ }
17
+
18
+ // Settings sent by a Server Action (`useFormWithAction`): switches, a menu, a slider, a choice.
19
+ export default function FormSettings() {
20
+ const form = settings.useFormWithAction(saveSettings);
21
+ return (
22
+ <form.Form aria-label="Settings" className="flex w-96 flex-col gap-5">
23
+ <form.Select name="language" label="Language" options={LANGUAGES} />
24
+ <form.Switch name="emailDigest" label="Weekly e-mail" hint="What happened on your channel." />
25
+ <form.Switch name="pushMessages" label="Message notifications" />
26
+ <form.Slider name="autoplayVolume" label="Autoplay volume" step={10} formatValue={(v) => `${v} %`} />
27
+ <form.RadioGroup name="quality" label="Video quality" options={QUALITY} orientation="horizontal" />
28
+ <form.Submit>Save the settings</form.Submit>
29
+ </form.Form>
30
+ );
31
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,38 @@
1
+ "use client";
2
+
3
+ // registry/examples/form/sign-up.tsx
4
+ import { KrizakaApiError } from "@krizaka/query";
5
+ import { createKrizakaForm, latestBirthDate } from "@krizaka/ui/form";
6
+ import { z } from "zod";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var signUp = createKrizakaForm({
9
+ schema: z.object({
10
+ email: z.email(),
11
+ username: z.string().min(3).max(30).regex(/^[a-z0-9_]+$/, "signUp.username.format"),
12
+ password: z.string().min(8),
13
+ dateOfBirth: z.iso.date().refine((d) => d <= latestBirthDate(18), "form.errors.UNDERAGE"),
14
+ acceptTerms: z.boolean().refine(Boolean, "signUp.terms.required")
15
+ }),
16
+ defaultValues: { email: "", username: "", password: "", dateOfBirth: "", acceptTerms: false }
17
+ });
18
+ var WORDS = { "signUp.username.format": "Lowercase letters, digits and _ only.", "signUp.username.taken": "This username is taken.", "signUp.terms.required": "Accept the terms to continue.", "form.errors.UNDERAGE": "You must be 18 or older.", "form.errors.BIRTH_DATE_INVALID": "Enter your real date of birth.", "form.errors.USERNAME_RESERVED": "This username is reserved.", "apiErrors.ACCOUNT_EXISTS": "This e-mail already has an account. Sign in instead." };
19
+ var taken = (u) => new Promise((done) => setTimeout(() => done(["eric", "elena"].includes(u)), 300));
20
+ var register = async (v) => {
21
+ if (v.username === "admin") throw new KrizakaApiError({ status: 400, code: "USERNAME_RESERVED" });
22
+ if (v.email.endsWith("@orochia.com")) throw new KrizakaApiError({ status: 409, code: "ACCOUNT_EXISTS" });
23
+ };
24
+ function FormSignUp() {
25
+ const form = signUp.useForm({ i18n: { t: (key) => WORDS[key] }, codeFields: { UNDERAGE: "dateOfBirth", BIRTH_DATE_INVALID: "dateOfBirth", USERNAME_RESERVED: "username" }, onSubmit: register });
26
+ return /* @__PURE__ */ jsxs(form.Form, { "aria-label": "Create your account", className: "flex w-80 flex-col gap-4", children: [
27
+ /* @__PURE__ */ jsx(form.TextField, { name: "email", label: "E-mail", type: "email", autoComplete: "email", hint: "We send a link to confirm it." }),
28
+ /* @__PURE__ */ jsx(form.TextField, { name: "username", label: "Username", start: "@", autoComplete: "username", transform: (v) => v.toLowerCase().replace(/\s+/g, "_"), availableHint: "Free", validateAsync: async (u) => await taken(u) ? { key: "signUp.username.taken", suggestion: { label: `Use @${u}_${u.length}`, value: `${u}_${u.length}` } } : null }),
29
+ /* @__PURE__ */ jsx(form.TextField, { name: "password", label: "Password", type: "password", autoComplete: "new-password", hint: "At least 8 characters." }),
30
+ /* @__PURE__ */ jsx(form.DateField, { name: "dateOfBirth", label: "Date of birth", entry: "parts", autoComplete: "bday", hint: "Private, never shown." }),
31
+ /* @__PURE__ */ jsx(form.Checkbox, { name: "acceptTerms", label: "I accept the terms and the privacy policy" }),
32
+ /* @__PURE__ */ jsx(form.FormError, {}),
33
+ /* @__PURE__ */ jsx(form.Submit, { children: "Create my account" })
34
+ ] });
35
+ }
36
+ export {
37
+ FormSignUp as default
38
+ };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+
3
+ import { KrizakaApiError } from "@krizaka/query";
4
+ import { createKrizakaForm, latestBirthDate } from "@krizaka/ui/form";
5
+ import { z } from "zod";
6
+
7
+ // The schema the sign-up API parses with: the same rules, the same keys. `signUp.*` are the app's own words.
8
+ const signUp = createKrizakaForm({
9
+ schema: z.object({
10
+ email: z.email(),
11
+ username: z.string().min(3).max(30).regex(/^[a-z0-9_]+$/, "signUp.username.format"),
12
+ password: z.string().min(8),
13
+ dateOfBirth: z.iso.date().refine((d) => d <= latestBirthDate(18), "form.errors.UNDERAGE"),
14
+ acceptTerms: z.boolean().refine(Boolean, "signUp.terms.required"),
15
+ }),
16
+ defaultValues: { email: "", username: "", password: "", dateOfBirth: "", acceptTerms: false },
17
+ });
18
+ const WORDS: Record<string, string> = { "signUp.username.format": "Lowercase letters, digits and _ only.", "signUp.username.taken": "This username is taken.", "signUp.terms.required": "Accept the terms to continue.", "form.errors.UNDERAGE": "You must be 18 or older.", "form.errors.BIRTH_DATE_INVALID": "Enter your real date of birth.", "form.errors.USERNAME_RESERVED": "This username is reserved.", "apiErrors.ACCOUNT_EXISTS": "This e-mail already has an account. Sign in instead." };
19
+ const taken = (u: string) => new Promise<boolean>((done) => setTimeout(() => done(["eric", "elena"].includes(u)), 300));
20
+ // The server's codes (Orochia's register API): the ones that belong to a field land under it, the others above the button.
21
+ const register = async (v: { email: string; username: string }) => { if (v.username === "admin") throw new KrizakaApiError({ status: 400, code: "USERNAME_RESERVED" }); if (v.email.endsWith("@orochia.com")) throw new KrizakaApiError({ status: 409, code: "ACCOUNT_EXISTS" }); };
22
+
23
+ // Orochia's sign-up: the username checked as it is typed (a free one offered), an 18+ birth date, the server's refusals in place.
24
+ export default function FormSignUp() {
25
+ const form = signUp.useForm({ i18n: { t: (key) => WORDS[key] }, codeFields: { UNDERAGE: "dateOfBirth", BIRTH_DATE_INVALID: "dateOfBirth", USERNAME_RESERVED: "username" }, onSubmit: register });
26
+ return (
27
+ <form.Form aria-label="Create your account" className="flex w-80 flex-col gap-4">
28
+ <form.TextField name="email" label="E-mail" type="email" autoComplete="email" hint="We send a link to confirm it." />
29
+ <form.TextField name="username" label="Username" start="@" autoComplete="username" transform={(v) => v.toLowerCase().replace(/\s+/g, "_")} availableHint="Free" validateAsync={async (u) => ((await taken(u)) ? { key: "signUp.username.taken", suggestion: { label: `Use @${u}_${u.length}`, value: `${u}_${u.length}` } } : null)} />
30
+ <form.TextField name="password" label="Password" type="password" autoComplete="new-password" hint="At least 8 characters." />
31
+ <form.DateField name="dateOfBirth" label="Date of birth" entry="parts" autoComplete="bday" hint="Private, never shown." />
32
+ <form.Checkbox name="acceptTerms" label="I accept the terms and the privacy policy" />
33
+ <form.FormError />
34
+ <form.Submit>Create my account</form.Submit>
35
+ </form.Form>
36
+ );
37
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ // registry/examples/form/upload.tsx
4
+ import { createKrizakaForm } from "@krizaka/ui/form";
5
+ import { z } from "zod";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var upload = createKrizakaForm({
8
+ schema: z.object({
9
+ video: z.array(z.instanceof(Blob)).length(1, "upload.video.required"),
10
+ title: z.string().min(3).max(100),
11
+ description: z.string().max(2e3),
12
+ tags: z.array(z.string()).max(10),
13
+ visibility: z.enum(["public", "followers", "private"])
14
+ }),
15
+ defaultValues: { video: [], title: "", description: "", tags: [], visibility: "public" },
16
+ i18n: { t: (key) => key === "upload.video.required" ? "Choose the video to publish." : void 0 }
17
+ });
18
+ var VISIBILITY = [{ value: "public", label: "Everyone" }, { value: "followers", label: "My followers" }, { value: "private", label: "Only me" }];
19
+ function FormUpload() {
20
+ const form = upload.useForm({ onSubmit: (values) => new Promise((done) => setTimeout(() => done(values), 600)) });
21
+ return /* @__PURE__ */ jsxs(form.Form, { "aria-label": "Publish a video", className: "flex w-96 flex-col gap-4", children: [
22
+ /* @__PURE__ */ jsx(form.FileUpload, { name: "video", label: "Video", title: "Drop your video here", browseLabel: "Choose a file", hint: "MP4 or MOV, up to 4 GB.", accept: "video/*", maxSize: 4 * 1024 ** 3, removeLabel: (file) => `Remove ${file}` }),
23
+ /* @__PURE__ */ jsx(form.TextField, { name: "title", label: "Title", maxLength: 100 }),
24
+ /* @__PURE__ */ jsx(form.TextArea, { name: "description", label: "Description", rows: 3 }),
25
+ /* @__PURE__ */ jsx(form.TagInput, { name: "tags", label: "Tags", max: 10, hint: "Up to 10, separated by commas." }),
26
+ /* @__PURE__ */ jsx(form.Select, { name: "visibility", label: "Who can watch", options: VISIBILITY }),
27
+ /* @__PURE__ */ jsx(form.Submit, { children: "Publish" })
28
+ ] });
29
+ }
30
+ export {
31
+ FormUpload as default
32
+ };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ import { createKrizakaForm } from "@krizaka/ui/form";
4
+ import { z } from "zod";
5
+
6
+ const upload = createKrizakaForm({
7
+ schema: z.object({
8
+ video: z.array(z.instanceof(Blob)).length(1, "upload.video.required"),
9
+ title: z.string().min(3).max(100),
10
+ description: z.string().max(2000),
11
+ tags: z.array(z.string()).max(10),
12
+ visibility: z.enum(["public", "followers", "private"]),
13
+ }),
14
+ defaultValues: { video: [] as Blob[], title: "", description: "", tags: [] as string[], visibility: "public" as const },
15
+ i18n: { t: (key) => (key === "upload.video.required" ? "Choose the video to publish." : undefined) },
16
+ });
17
+ const VISIBILITY = [{ value: "public", label: "Everyone" }, { value: "followers", label: "My followers" }, { value: "private", label: "Only me" }];
18
+
19
+ // A video and what describes it: the file, a title, a description, tags and who sees it — sent once, together.
20
+ export default function FormUpload() {
21
+ const form = upload.useForm({ onSubmit: (values) => new Promise((done) => setTimeout(() => done(values), 600)) });
22
+ return (
23
+ <form.Form aria-label="Publish a video" className="flex w-96 flex-col gap-4">
24
+ <form.FileUpload name="video" label="Video" title="Drop your video here" browseLabel="Choose a file" hint="MP4 or MOV, up to 4 GB." accept="video/*" maxSize={4 * 1024 ** 3} removeLabel={(file) => `Remove ${file}`} />
25
+ <form.TextField name="title" label="Title" maxLength={100} />
26
+ <form.TextArea name="description" label="Description" rows={3} />
27
+ <form.TagInput name="tags" label="Tags" max={10} hint="Up to 10, separated by commas." />
28
+ <form.Select name="visibility" label="Who can watch" options={VISIBILITY} />
29
+ <form.Submit>Publish</form.Submit>
30
+ </form.Form>
31
+ );
32
+ }
@@ -6,7 +6,7 @@
6
6
  "description": "A form field: a label, a hint and an error around an `Input`, a `Textarea` or a native `Select`.",
7
7
  "status": "stable",
8
8
  "category": "forms",
9
- "platforms": "web",
9
+ "platforms": "both",
10
10
  "whenToUse": [
11
11
  "For every text entry of a form: email, title, description, amount.",
12
12
  "`Select` for a choice among many options (a country): the platform's own menu, right on phones."
@@ -131,7 +131,107 @@
131
131
  }
132
132
  ]
133
133
  },
134
- "native": null,
134
+ "native": {
135
+ "entry": "@krizaka/ui/native",
136
+ "import": "import { TextField } from \"@krizaka/ui/native\";",
137
+ "differences": [
138
+ "One component, `TextField`: the label, the input, the hint or the error together (no `Field.*` parts, no `htmlFor`).",
139
+ "Every `TextInput` prop passes through (`secureTextEntry`, `keyboardType`, `autoComplete`, `returnKeyType`); `multiline` is the text area; `onValueChange` gives the text.",
140
+ "`end` holds an adornment (a spinner, a check, a show-password button); `inputRef` focuses the input. No `Select`: a choice is a `Chip.Group` or a screen."
141
+ ],
142
+ "props": [
143
+ {
144
+ "component": "TextField",
145
+ "description": "A text field for React Native: its label, the input (every `TextInput` prop: `secureTextEntry`, `keyboardType`,\n`autoComplete`, `returnKeyType`…), a hint or an error under it — the web `Field` + `Input`. `multiline` makes it a\ntext area.",
146
+ "props": [
147
+ {
148
+ "name": "label",
149
+ "type": "string",
150
+ "default": null,
151
+ "description": "The visible label above the input, passed translated (also its accessible name).",
152
+ "required": true
153
+ },
154
+ {
155
+ "name": "defaultValue",
156
+ "type": "string",
157
+ "default": null,
158
+ "description": "The text at first, uncontrolled.",
159
+ "required": false
160
+ },
161
+ {
162
+ "name": "disabled",
163
+ "type": "boolean",
164
+ "default": null,
165
+ "description": "Not available: dimmed, not focusable.",
166
+ "required": false
167
+ },
168
+ {
169
+ "name": "end",
170
+ "type": "ReactNode",
171
+ "default": null,
172
+ "description": "Something at the end of the input: a spinner while a value is checked, a check once it is, a show-password button.",
173
+ "required": false
174
+ },
175
+ {
176
+ "name": "error",
177
+ "type": "string",
178
+ "default": null,
179
+ "description": "An error under the input: a danger border and caption, read with it and announced. Replaces the hint.",
180
+ "required": false
181
+ },
182
+ {
183
+ "name": "hint",
184
+ "type": "string",
185
+ "default": null,
186
+ "description": "A help text under the input (\"At least 8 characters\"), read with it.",
187
+ "required": false
188
+ },
189
+ {
190
+ "name": "inputRef",
191
+ "type": "Ref<TextInput>",
192
+ "default": null,
193
+ "description": "The input itself, to focus it (`ref.current?.focus()`) or move to the next field.",
194
+ "required": false
195
+ },
196
+ {
197
+ "name": "onValueChange",
198
+ "type": "((text: string) => void)",
199
+ "default": null,
200
+ "description": "Called on every key with the text.",
201
+ "required": false
202
+ },
203
+ {
204
+ "name": "style",
205
+ "type": "StyleProp<ViewStyle>",
206
+ "default": null,
207
+ "description": "Styles merged last, on the field (label, input, caption).",
208
+ "required": false
209
+ },
210
+ {
211
+ "name": "value",
212
+ "type": "string",
213
+ "default": null,
214
+ "description": "The text (controlled).",
215
+ "required": false
216
+ }
217
+ ]
218
+ }
219
+ ],
220
+ "examples": [
221
+ {
222
+ "name": "default",
223
+ "title": "Sign-up fields",
224
+ "description": "E-mail and password: the right keyboards, autofill, a hint, then an error in place of the hint.",
225
+ "path": "examples/field/native/default.tsx",
226
+ "module": "@krizaka/ui/registry/examples/field/native/default",
227
+ "code": "import { TextField } from \"@krizaka/ui/native\";\nimport * as React from \"react\";\nimport { View } from \"react-native\";\n\n// The e-mail and the password of a sign-up: the right keyboards and autofill, a hint, then an error in its place.\nexport default function NativeFieldDefault() {\n const [email, setEmail] = React.useState(\"eric@example.com\");\n const [password, setPassword] = React.useState(\"hunter\");\n return (\n <View style={{ gap: 16, width: 296 }}>\n <TextField label=\"E-mail\" value={email} onValueChange={setEmail} keyboardType=\"email-address\" autoComplete=\"email\" autoCapitalize=\"none\" textContentType=\"emailAddress\" hint=\"We send a link to confirm it.\" />\n <TextField\n label=\"Password\"\n value={password}\n onValueChange={setPassword}\n secureTextEntry\n autoComplete=\"new-password\"\n textContentType=\"newPassword\"\n error={password.length < 8 ? \"Use at least 8 characters.\" : undefined}\n />\n </View>\n );\n}\n",
228
+ "screenshots": {
229
+ "dark": "examples/field/native/default.dark.png",
230
+ "light": "examples/field/native/default.light.png"
231
+ }
232
+ }
233
+ ]
234
+ },
135
235
  "files": [
136
236
  {
137
237
  "path": "field/field.tsx",
@@ -143,11 +243,11 @@
143
243
  },
144
244
  {
145
245
  "path": "field/meta.ts",
146
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Field\",\n summary: \"A form field: a label, a hint and an error around an `Input`, a `Textarea` or a native `Select`.\",\n status: \"stable\",\n category: \"forms\",\n platforms: \"web\",\n whenToUse: [\n \"For every text entry of a form: email, title, description, amount.\",\n \"`Select` for a choice among many options (a country): the platform's own menu, right on phones.\",\n ],\n whenNotToUse: [\n { when: \"To turn a setting on or off.\", use: \"switch\" },\n { when: \"To choose among two to five options that should all be visible.\", use: \"radio-group\" },\n { when: \"To pick a number in a range by feel.\", use: \"slider\" },\n ],\n bestPractices: [\n \"Always a visible `Field.Label`: a placeholder is an example, never the label.\",\n \"Put the hint before the error is possible (“We never share it”), the error after it is: what is wrong and how to fix it.\",\n \"Use the right `type` (`email`, `url`, `number`) and `autoComplete`: phones show the right keyboard.\",\n ],\n accessibility: {\n keyboard: [],\n notes: [\n \"Plain HTML wiring: `Field.Label htmlFor` = the control's `id`; hint and error ids in `aria-describedby`.\",\n \"`invalid` sets `aria-invalid` and `data-invalid` on the control.\",\n \"A disabled control is skipped by Tab: if the value matters, prefer `readOnly`.\",\n ],\n },\n related: [\"checkbox\", \"switch\", \"radio-group\", \"slider\"],\n web: {\n imports: [\"Field\", \"Input\", \"Textarea\", \"Select\"],\n examples: [\n { name: \"default\", title: \"Default\", description: \"A label, an input and a hint.\" },\n { name: \"invalid\", title: \"Invalid\", description: \"`invalid` and its error, read through `aria-describedby`.\" },\n { name: \"disabled\", title: \"Disabled\", description: \"Not editable.\" },\n { name: \"textarea\", title: \"Textarea\", description: \"A longer text.\" },\n { name: \"select\", title: \"Select\", description: \"A native select.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
246
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Field\",\n summary: \"A form field: a label, a hint and an error around an `Input`, a `Textarea` or a native `Select`.\",\n status: \"stable\",\n category: \"forms\",\n platforms: \"both\",\n whenToUse: [\n \"For every text entry of a form: email, title, description, amount.\",\n \"`Select` for a choice among many options (a country): the platform's own menu, right on phones.\",\n ],\n whenNotToUse: [\n { when: \"To turn a setting on or off.\", use: \"switch\" },\n { when: \"To choose among two to five options that should all be visible.\", use: \"radio-group\" },\n { when: \"To pick a number in a range by feel.\", use: \"slider\" },\n ],\n bestPractices: [\n \"Always a visible `Field.Label`: a placeholder is an example, never the label.\",\n \"Put the hint before the error is possible (“We never share it”), the error after it is: what is wrong and how to fix it.\",\n \"Use the right `type` (`email`, `url`, `number`) and `autoComplete`: phones show the right keyboard.\",\n ],\n accessibility: {\n keyboard: [],\n notes: [\n \"Plain HTML wiring: `Field.Label htmlFor` = the control's `id`; hint and error ids in `aria-describedby`.\",\n \"`invalid` sets `aria-invalid` and `data-invalid` on the control.\",\n \"A disabled control is skipped by Tab: if the value matters, prefer `readOnly`.\",\n ],\n },\n related: [\"checkbox\", \"switch\", \"radio-group\", \"slider\"],\n web: {\n imports: [\"Field\", \"Input\", \"Textarea\", \"Select\"],\n examples: [\n { name: \"default\", title: \"Default\", description: \"A label, an input and a hint.\" },\n { name: \"invalid\", title: \"Invalid\", description: \"`invalid` and its error, read through `aria-describedby`.\" },\n { name: \"disabled\", title: \"Disabled\", description: \"Not editable.\" },\n { name: \"textarea\", title: \"Textarea\", description: \"A longer text.\" },\n { name: \"select\", title: \"Select\", description: \"A native select.\" },\n ],\n },\n native: {\n imports: [\"TextField\"],\n differences: [\n \"One component, `TextField`: the label, the input, the hint or the error together (no `Field.*` parts, no `htmlFor`).\",\n \"Every `TextInput` prop passes through (`secureTextEntry`, `keyboardType`, `autoComplete`, `returnKeyType`); `multiline` is the text area; `onValueChange` gives the text.\",\n \"`end` holds an adornment (a spinner, a check, a show-password button); `inputRef` focuses the input. No `Select`: a choice is a `Chip.Group` or a screen.\",\n ],\n examples: [\n { name: \"default\", title: \"Sign-up fields\", description: \"E-mail and password: the right keyboards, autofill, a hint, then an error in place of the hint.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
147
247
  },
148
248
  {
149
249
  "path": "meta.ts",
150
- "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which krizaka.com renders as\n// /docs/ui/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"achievement\"\n | \"action-bar\"\n | \"alert\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"error-page\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"gallery-page\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"iso\"\n | \"kbd\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"media-capture\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"radio-group\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\n | \"skeleton\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"status-page\"\n | \"stepper\"\n | \"switch\"\n | \"tabs\"\n | \"tag-input\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"txt\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/** `stable`: its API only changes in a major. `beta`: it may still change in a minor. */\nexport type Status = \"stable\" | \"beta\";\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\nexport interface Example {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its phone\n * version thought out), copied as a starting point — at most 160 lines, listed on krizaka.com/docs/ui/templates.\n */\n readonly template?: boolean;\n}\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
250
+ "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which krizaka.com renders as\n// /docs/ui/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"achievement\"\n | \"action-bar\"\n | \"alert\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"error-page\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"form\"\n | \"gallery-page\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"iso\"\n | \"kbd\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"media-capture\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"radio-group\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\n | \"skeleton\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"status-page\"\n | \"stepper\"\n | \"switch\"\n | \"tabs\"\n | \"tag-input\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"txt\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/** `stable`: its API only changes in a major. `beta`: it may still change in a minor. */\nexport type Status = \"stable\" | \"beta\";\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\nexport interface Example {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its phone\n * version thought out), copied as a starting point — at most 160 lines, listed on krizaka.com/docs/ui/templates.\n */\n readonly template?: boolean;\n}\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
151
251
  }
152
252
  ],
153
253
  "dependencies": [