@krizaka/ui 3.44.0 → 3.46.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.
package/README.md CHANGED
@@ -181,7 +181,7 @@ light or a product's — is a set of tokens.
181
181
  | `@krizaka/ui/section-backdrop` | `SectionBackdrop` (`as`, `direction` down·up, `dome`, `grid`, `media` blurred for depth of field, `animated`): a page section on the brand's section gradient — see `@krizaka/tokens` BRAND.md, "Visual language" | server |
182
182
  | `@krizaka/ui/mascots` | `Mascot` (`bird` falcon·owl·duck·flamingo·pigeon·lovebird·crane, `mood` welcome·thinking·success·empty·error, `tone` brand·own, `size`, `animated`, `title`), `MASCOT_BIRDS`, `MASCOT_MOODS`: the Krizaka flock, in the host brand's accent — one bird at a moment that matters (onboarding, a long wait, a success, an empty list, an error); native `Mascot` in `/native` | client |
183
183
  | `@krizaka/ui/iso` | the isometric kit: `IsoHub` (a hero driven by data: `layers`, `dome`, `satellites`, `highlight`), `IsoScene`, `IsoPrism`, `IsoStack`, `IsoDome`, `IsoTile`, `IsoLink`, `IsoNode`, `IsoLabel`, the projection helpers — static SVG animated by motion.css | server |
184
- | `@krizaka/ui/motion` | `MotionObserver` (reveal, off-screen pause, settle, spotlight, magnetism) and `RotatingWord` (no layout shift) | client |
184
+ | `@krizaka/ui/motion` | `MotionObserver` (reveal, off-screen pause, settle, spotlight, magnetism) `RotatingWord` (no layout shift), `PageTransition` (wrap the root layout's children once: the page cross-fades through React's ViewTransition, instant under reduced motion) and the view-transition helpers | client |
185
185
  | `@krizaka/ui/pagination` | `Pagination` (pages: `page`, `pageCount`, `onPageChange` or `getHref` for links; cursor: `hasPrevious`/`hasNext`, `onPrevious`/`onNext`; `status`, `pageSize` + `pageSizeOptions`, `siblings`, `boundaries`, `labels`; folds into "Page 3 of 12" in a narrow container), `pageRange` | server |
186
186
  | `@krizaka/ui/data-table` | **v2, on TanStack Table v9** (never imported by a product): `DataTable` (`rows`, `columns` with `header`, `cell`, `value`, `sortable`, `filter` text·facet·range + `options`, `groupable` + `aggregate`, `align`, `width`, `card`, `hideable`; `caption`, `sort`, `filters`, `selected` + `selectable`, `groupBy`, `columnVisibility`, `expanded` + `renderDetail` / `getSubRows`, `page` + `pageSize` / `pageSizeOptions`, each controlled or `default*`; `pinning`, `resizing`, `manual` sorting·filtering·pagination + `rowCount` + `onStateChange` (server mode), `virtualized`, `loading`, `empty`, `error`, `layout` auto·table·cards, `density`, `toolbar`, `footer`, `labels`), the toolbar `DataTableFilters` · `DataTableColumnsMenu` · `DataTableExport`, `useDataTable()` (the TanStack instance), `dataTableCsv` | client |
187
187
  | `@krizaka/ui/virtual` | On TanStack Virtual v3: `VirtualList` (own region or `scroll="window"`, measured items, `onEndReached`, `ref.scrollToIndex`), `VirtualGrid` (columns that fit the width), `useVirtualizer` / `useWindowVirtualizer` through the facade | client |
package/dist/form.d.ts CHANGED
@@ -213,6 +213,34 @@ interface KrizakaFieldArray<T = unknown> {
213
213
  declare function useKrizakaFieldArray<T = unknown>(name: string): KrizakaFieldArray<T>;
214
214
  /** The value of a field, kept up to date (`form.Watch`): show a part of the form only when a box is ticked. */
215
215
  declare function useFormValue<T = unknown>(name: string): T;
216
+ type FormFieldProps<T = unknown> = {
217
+ /** The field's name in the schema (typed by the form). */
218
+ name: string;
219
+ /** Checks the value on the server as it changes. */
220
+ validateAsync?: FieldCheck<T>;
221
+ /** The wait, in ms, before `validateAsync`. */
222
+ asyncDebounceMs?: number;
223
+ /** Draws the field: its value, setter, error (and the ids, on the web) (`useKrizakaField`). */
224
+ children: (field: KrizakaField<T>) => React.ReactNode;
225
+ };
226
+ /** A field drawn by the app (a control the package does not have): the form's value and errors, any markup. */
227
+ declare function FormField({ name, validateAsync, asyncDebounceMs, children }: FormFieldProps): React.JSX.Element;
228
+ type FieldArrayProps<T = unknown> = {
229
+ /** The array's name in the schema (typed by the form). */
230
+ name: string;
231
+ /** Draws the items: `items`, `push`, `remove`, `move`, `fieldName(i, "url")` for the fields of an item. */
232
+ children: (array: KrizakaFieldArray<T>) => React.ReactNode;
233
+ };
234
+ /** A list of fields that grows and shrinks (links, tiers, guests): each item's fields named `links[0].url`. */
235
+ declare function FieldArray({ name, children }: FieldArrayProps): React.JSX.Element;
236
+ type WatchProps<T = unknown> = {
237
+ /** The field to follow (typed by the form). */
238
+ name: string;
239
+ /** Draws from its current value: show a part of the form only when a choice is made. */
240
+ children: (value: T) => React.ReactNode;
241
+ };
242
+ /** Renders from a field's current value (a part shown only when a choice is made, a total). */
243
+ declare function Watch({ name, children }: WatchProps): React.JSX.Element;
216
244
  /** The state of the submit, for a button: sending, and whether the last try succeeded. */
217
245
  declare function useFormStatus(): {
218
246
  submitting: boolean;
@@ -451,34 +479,6 @@ type SliderProps = Base & {
451
479
  };
452
480
  /** A number (or a range) of the form, chosen by feel: a share, a volume, a price range — the value floats while it is touched. */
453
481
  declare function Slider({ name, label, hint, disabled, className, min, max, step, formatValue, thumbLabels, ticks, marks }: SliderProps): React.JSX.Element;
454
- type FormFieldProps<T = unknown> = {
455
- /** The field's name in the schema (typed by the form). */
456
- name: string;
457
- /** Checks the value on the server as it changes. */
458
- validateAsync?: FieldCheck<T>;
459
- /** The wait, in ms, before `validateAsync`. */
460
- asyncDebounceMs?: number;
461
- /** Draws the field: its value, setter, error and ids (`useKrizakaField`). */
462
- children: (field: KrizakaField<T>) => React.ReactNode;
463
- };
464
- /** A field drawn by the app (a control the package does not have): the form's value, errors and ids, any markup. */
465
- declare function FormField({ name, validateAsync, asyncDebounceMs, children }: FormFieldProps): React.JSX.Element;
466
- type FieldArrayProps<T = unknown> = {
467
- /** The array's name in the schema (typed by the form). */
468
- name: string;
469
- /** Draws the items: `items`, `push`, `remove`, `move`, `fieldName(i, "url")` for the fields of an item. */
470
- children: (array: KrizakaFieldArray<T>) => React.ReactNode;
471
- };
472
- /** A list of fields that grows and shrinks (links, tiers, guests): each item's fields named `links[0].url`. */
473
- declare function FieldArray({ name, children }: FieldArrayProps): React.JSX.Element;
474
- type WatchProps<T = unknown> = {
475
- /** The field to follow (typed by the form). */
476
- name: string;
477
- /** Draws from its current value: show a part of the form only when a box is ticked. */
478
- children: (value: T) => React.ReactNode;
479
- };
480
- /** Renders from a field's current value (a part shown only when a box is ticked, a total). */
481
- declare function Watch({ name, children }: WatchProps): React.JSX.Element;
482
482
  /**
483
483
  * A form, defined once: its schema (zod 4) and default values — the same schema the server parses with. In a component,
484
484
  * `signUp.useForm({ onSubmit })` gives the form and its fields, typed by the schema: `<form.Form>`, `<form.TextField
package/dist/form.js CHANGED
@@ -147,7 +147,7 @@ function problemToErrors(problem, i18n = {}, known, codeFields = {}) {
147
147
  }
148
148
 
149
149
  // src/form/core.tsx
150
- import { jsx } from "react/jsx-runtime";
150
+ import { Fragment, jsx } from "react/jsx-runtime";
151
151
  var FormContext = React.createContext(null);
152
152
  function useFormContext() {
153
153
  const ctx = React.useContext(FormContext);
@@ -292,6 +292,15 @@ function useFormValue(name) {
292
292
  const ctx = useFormContext();
293
293
  return useStore(ctx.api.store, (state) => getPath(state.values, name));
294
294
  }
295
+ function FormField({ name, validateAsync, asyncDebounceMs, children }) {
296
+ return /* @__PURE__ */ jsx(Fragment, { children: children(useKrizakaField(name, { validateAsync, asyncDebounceMs })) });
297
+ }
298
+ function FieldArray({ name, children }) {
299
+ return /* @__PURE__ */ jsx(Fragment, { children: children(useKrizakaFieldArray(name)) });
300
+ }
301
+ function Watch({ name, children }) {
302
+ return /* @__PURE__ */ jsx(Fragment, { children: children(useFormValue(name)) });
303
+ }
295
304
  function useFormStatus() {
296
305
  const ctx = useFormContext();
297
306
  const submitting = useStore(ctx.api.store, (s) => s.isSubmitting);
@@ -412,14 +421,14 @@ import { Spinner } from "@krizaka/ui/spinner";
412
421
  import { Switch as SwitchControl } from "@krizaka/ui/switch";
413
422
  import { TagInput as TagInputControl } from "@krizaka/ui/tag-input";
414
423
  import * as React2 from "react";
415
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
424
+ import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
416
425
  var ids = (f, hint) => [hint && !f.error ? f.hintId : null, f.error ? f.errorId : null].filter(Boolean).join(" ") || void 0;
417
426
  function Caption({ field, hint, ok }) {
418
427
  const suggestion = field.errorDetail?.suggestion;
419
428
  if (field.error)
420
429
  return /* @__PURE__ */ jsx2(Field.Error, { id: field.errorId, children: /* @__PURE__ */ jsxs("span", { children: [
421
430
  field.error,
422
- suggestion ? /* @__PURE__ */ jsxs(Fragment, { children: [
431
+ suggestion ? /* @__PURE__ */ jsxs(Fragment2, { children: [
423
432
  " ",
424
433
  /* @__PURE__ */ jsx2("button", { type: "button", className: "font-semibold text-accent-text underline underline-offset-2", onClick: () => field.setValue(suggestion.value), children: suggestion.label })
425
434
  ] }) : null
@@ -669,15 +678,6 @@ function Slider({ name, label, hint, disabled, className, min, max, step, format
669
678
  /* @__PURE__ */ jsx2(Caption, { field: f, hint })
670
679
  ] });
671
680
  }
672
- function FormField({ name, validateAsync, asyncDebounceMs, children }) {
673
- return /* @__PURE__ */ jsx2(Fragment, { children: children(useKrizakaField(name, { validateAsync, asyncDebounceMs })) });
674
- }
675
- function FieldArray({ name, children }) {
676
- return /* @__PURE__ */ jsx2(Fragment, { children: children(useKrizakaFieldArray(name)) });
677
- }
678
- function Watch({ name, children }) {
679
- return /* @__PURE__ */ jsx2(Fragment, { children: children(useFormValue(name)) });
680
- }
681
681
  var fields = { TextField, TextArea, Checkbox, Switch, RadioGroup, Select, Combobox, DateField, TagInput, FileUpload, Money, Slider, Field: FormField, FieldArray, Watch, Submit, FormError };
682
682
  var createKrizakaForm = makeCreateKrizakaForm(fields, FormRoot);
683
683
  function useFormWithAction(form, ...args) {