@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.
- package/dist/{chunk-I5RVM5CW.js → chunk-2FRWNSRO.js} +2 -6
- package/dist/chunk-2FRWNSRO.js.map +1 -0
- package/dist/chunk-BTMFZ66D.js +135 -0
- package/dist/chunk-BTMFZ66D.js.map +1 -0
- package/dist/chunk-C2BRIFJG.js +13 -0
- package/dist/chunk-C2BRIFJG.js.map +1 -0
- package/dist/chunk-KDXRYUD3.js +39 -0
- package/dist/chunk-KDXRYUD3.js.map +1 -0
- package/dist/{chunk-2PUDI7JS.js → chunk-ZKVQGXLD.js} +5 -3
- package/dist/{chunk-2PUDI7JS.js.map → chunk-ZKVQGXLD.js.map} +1 -1
- package/dist/command.js +1 -1
- package/dist/confirm-button.js +1 -1
- package/dist/data-table.js +3 -2
- package/dist/data-table.js.map +1 -1
- package/dist/date-picker.d.ts +3 -1
- package/dist/date-picker.js +13 -13
- package/dist/date-picker.js.map +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/filter-bar.js +3 -2
- package/dist/form.d.ts +23 -12
- package/dist/form.js +11 -47
- package/dist/form.js.map +1 -1
- package/dist/glow-card.js +1 -1
- package/dist/image-cropper.js +3 -1
- package/dist/image-cropper.js.map +1 -1
- package/dist/marquee.js +1 -1
- package/dist/native/form.d.ts +60 -15
- package/dist/native/form.js +103 -42
- package/dist/native/form.js.map +1 -1
- package/dist/native.d.ts +206 -2
- package/dist/native.js +1172 -541
- package/dist/native.js.map +1 -1
- package/dist/nav-bar.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/radio-group.d.ts +66 -32
- package/dist/radio-group.js +54 -10
- package/dist/radio-group.js.map +1 -1
- package/dist/slider.d.ts +96 -35
- package/dist/slider.js +67 -13
- package/dist/slider.js.map +1 -1
- package/dist/terminal-replay.js +34 -60
- package/dist/terminal-replay.js.map +1 -1
- package/dist/toast.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/video-player.js +3 -1
- package/dist/video-player.js.map +1 -1
- package/package.json +6 -6
- package/registry/combobox.json +225 -3
- package/registry/date-picker.json +16 -2
- package/registry/dialog.json +74 -3
- package/registry/examples/combobox/native/multiple.d.ts +4 -0
- package/registry/examples/combobox/native/multiple.dark.png +0 -0
- package/registry/examples/combobox/native/multiple.js +15 -0
- package/registry/examples/combobox/native/multiple.light.png +0 -0
- package/registry/examples/combobox/native/multiple.tsx +15 -0
- package/registry/examples/combobox/native/search.d.ts +4 -0
- package/registry/examples/combobox/native/search.dark.png +0 -0
- package/registry/examples/combobox/native/search.js +15 -0
- package/registry/examples/combobox/native/search.light.png +0 -0
- package/registry/examples/combobox/native/search.tsx +15 -0
- package/registry/examples/dialog/native/sheet.d.ts +4 -0
- package/registry/examples/dialog/native/sheet.dark.png +0 -0
- package/registry/examples/dialog/native/sheet.js +21 -0
- package/registry/examples/dialog/native/sheet.light.png +0 -0
- package/registry/examples/dialog/native/sheet.tsx +18 -0
- package/registry/examples/field/native/select.d.ts +4 -0
- package/registry/examples/field/native/select.dark.png +0 -0
- package/registry/examples/field/native/select.js +29 -0
- package/registry/examples/field/native/select.light.png +0 -0
- package/registry/examples/field/native/select.tsx +25 -0
- package/registry/examples/form/native/audience.dark.png +0 -0
- package/registry/examples/form/native/audience.light.png +0 -0
- package/registry/examples/form/native/profile.dark.png +0 -0
- package/registry/examples/form/native/profile.light.png +0 -0
- package/registry/examples/form/native/settings.dark.png +0 -0
- package/registry/examples/form/native/settings.light.png +0 -0
- package/registry/examples/form/native/sign-up.dark.png +0 -0
- package/registry/examples/form/native/sign-up.light.png +0 -0
- package/registry/examples/form/native/upload.dark.png +0 -0
- package/registry/examples/form/native/upload.light.png +0 -0
- package/registry/examples/radio-group/buttons.d.ts +4 -0
- package/registry/examples/radio-group/buttons.js +17 -0
- package/registry/examples/radio-group/buttons.tsx +21 -0
- package/registry/examples/radio-group/cards.js +1 -1
- package/registry/examples/radio-group/cards.tsx +2 -2
- package/registry/examples/radio-group/native/buttons.d.ts +4 -0
- package/registry/examples/radio-group/native/buttons.dark.png +0 -0
- package/registry/examples/radio-group/native/buttons.js +25 -0
- package/registry/examples/radio-group/native/buttons.light.png +0 -0
- package/registry/examples/radio-group/native/buttons.tsx +21 -0
- package/registry/examples/radio-group/native/cards.d.ts +4 -0
- package/registry/examples/radio-group/native/cards.dark.png +0 -0
- package/registry/examples/radio-group/native/cards.js +23 -0
- package/registry/examples/radio-group/native/cards.light.png +0 -0
- package/registry/examples/radio-group/native/cards.tsx +19 -0
- package/registry/examples/radio-group/native/list.d.ts +4 -0
- package/registry/examples/radio-group/native/list.dark.png +0 -0
- package/registry/examples/radio-group/native/list.js +24 -0
- package/registry/examples/radio-group/native/list.light.png +0 -0
- package/registry/examples/radio-group/native/list.tsx +20 -0
- package/registry/examples/radio-group/native/segmented.d.ts +4 -0
- package/registry/examples/radio-group/native/segmented.dark.png +0 -0
- package/registry/examples/radio-group/native/segmented.js +24 -0
- package/registry/examples/radio-group/native/segmented.light.png +0 -0
- package/registry/examples/radio-group/native/segmented.tsx +20 -0
- package/registry/examples/radio-group/segmented.d.ts +4 -0
- package/registry/examples/radio-group/segmented.js +15 -0
- package/registry/examples/radio-group/segmented.tsx +12 -0
- package/registry/examples/slider/floating.d.ts +4 -0
- package/registry/examples/slider/floating.js +11 -0
- package/registry/examples/slider/floating.tsx +12 -0
- package/registry/examples/slider/native/default.d.ts +4 -0
- package/registry/examples/slider/native/default.dark.png +0 -0
- package/registry/examples/slider/native/default.js +14 -0
- package/registry/examples/slider/native/default.light.png +0 -0
- package/registry/examples/slider/native/default.tsx +13 -0
- package/registry/examples/slider/native/range.d.ts +4 -0
- package/registry/examples/slider/native/range.dark.png +0 -0
- package/registry/examples/slider/native/range.js +12 -0
- package/registry/examples/slider/native/range.light.png +0 -0
- package/registry/examples/slider/native/range.tsx +11 -0
- package/registry/examples/slider/native/stepped.d.ts +4 -0
- package/registry/examples/slider/native/stepped.dark.png +0 -0
- package/registry/examples/slider/native/stepped.js +28 -0
- package/registry/examples/slider/native/stepped.light.png +0 -0
- package/registry/examples/slider/native/stepped.tsx +24 -0
- package/registry/examples/slider/native/vertical.d.ts +4 -0
- package/registry/examples/slider/native/vertical.dark.png +0 -0
- package/registry/examples/slider/native/vertical.js +16 -0
- package/registry/examples/slider/native/vertical.light.png +0 -0
- package/registry/examples/slider/native/vertical.tsx +13 -0
- package/registry/examples/slider/price-range.d.ts +4 -0
- package/registry/examples/slider/price-range.js +29 -0
- package/registry/examples/slider/price-range.tsx +27 -0
- package/registry/examples/slider/stepped.d.ts +4 -0
- package/registry/examples/slider/stepped.js +28 -0
- package/registry/examples/slider/stepped.tsx +24 -0
- package/registry/examples/slider/vertical.d.ts +4 -0
- package/registry/examples/slider/vertical.js +15 -0
- package/registry/examples/slider/vertical.tsx +14 -0
- package/registry/examples/switch/native/default.d.ts +4 -0
- package/registry/examples/switch/native/default.dark.png +0 -0
- package/registry/examples/switch/native/default.js +16 -0
- package/registry/examples/switch/native/default.light.png +0 -0
- package/registry/examples/switch/native/default.tsx +13 -0
- package/registry/examples/switch/native/settings.d.ts +4 -0
- package/registry/examples/switch/native/settings.dark.png +0 -0
- package/registry/examples/switch/native/settings.js +20 -0
- package/registry/examples/switch/native/settings.light.png +0 -0
- package/registry/examples/switch/native/settings.tsx +17 -0
- package/registry/field.json +15 -3
- package/registry/form.json +250 -42
- package/registry/index.json +24 -20
- package/registry/radio-group.json +227 -15
- package/registry/slider.json +314 -13
- package/registry/switch.json +115 -3
- package/registry/tabs.json +2 -2
- package/skills/choice-controls/SKILL.md +39 -0
- package/skills/form/SKILL.md +3 -0
- package/dist/chunk-I5RVM5CW.js.map +0 -1
- package/dist/chunk-RUPRYJ45.js +0 -82
- package/dist/chunk-RUPRYJ45.js.map +0 -1
package/dist/marquee.js
CHANGED
package/dist/native/form.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyFieldApi, StandardSchemaV1, DeepKeys, AnyFormApi } from '@tanstack/react-form';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { DateFieldLabels, BrandId, TextFieldProps as TextFieldProps$1 } from '@krizaka/ui/native';
|
|
3
|
+
import { ComboboxLabels, DateFieldLabels, BrandId, TextFieldProps as TextFieldProps$1 } from '@krizaka/ui/native';
|
|
4
4
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
5
5
|
|
|
6
6
|
/** A value a message placeholder takes (`{minimum}`, `{suggestion}`). */
|
|
@@ -294,32 +294,75 @@ type CheckboxProps = Omit<Base, "label" | "hint"> & {
|
|
|
294
294
|
};
|
|
295
295
|
/** A box of the form (`boolean`): terms to accept, an option. */
|
|
296
296
|
declare function Checkbox({ name, label, accessibleLabel, disabled, style }: CheckboxProps): React.JSX.Element;
|
|
297
|
-
/** An on/off setting of the form (`boolean`):
|
|
297
|
+
/** An on/off setting of the form (`boolean`): a settings row — the label and its hint beside the switch, all pressable. */
|
|
298
298
|
declare function Switch({ name, label, hint, disabled, style }: Base): React.JSX.Element;
|
|
299
|
-
/** A choice of the form: the value stored and its words (passed translated). */
|
|
299
|
+
/** A choice of the form: the value stored and its words (passed translated), a line under them. */
|
|
300
300
|
type FormOption = {
|
|
301
301
|
value: string;
|
|
302
302
|
label: string;
|
|
303
|
+
description?: string;
|
|
303
304
|
disabled?: boolean;
|
|
304
305
|
};
|
|
305
306
|
type RadioGroupProps = Base & {
|
|
306
|
-
/** The choices,
|
|
307
|
+
/** The choices, all visible (two to five). */
|
|
307
308
|
options: readonly FormOption[];
|
|
308
|
-
/**
|
|
309
|
-
|
|
309
|
+
/** `list` (dots, default), `cards`, `buttons` (tactile keys) or `segmented` — the native `RadioGroup`'s looks. */
|
|
310
|
+
variant?: "list" | "cards" | "buttons" | "segmented";
|
|
310
311
|
};
|
|
311
|
-
/** One choice among a few,
|
|
312
|
-
declare function RadioGroup({ name, label, hint, disabled, style, options,
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
/** One choice among a few, all visible: the native `RadioGroup` (a haptic on each choice). */
|
|
313
|
+
declare function RadioGroup({ name, label, hint, disabled, style, options, variant }: RadioGroupProps): React.JSX.Element;
|
|
314
|
+
type SelectProps = Base & {
|
|
315
|
+
/** The choices, in a sheet. */
|
|
316
|
+
options: readonly FormOption[];
|
|
317
|
+
/** Shown while nothing is chosen ("Choose a category"), passed translated. */
|
|
318
|
+
placeholder?: string;
|
|
319
|
+
};
|
|
320
|
+
/** One choice among many (the web's `<select>`): a field that opens a sheet of options. */
|
|
321
|
+
declare function Select({ name, label, hint, disabled, style, options, placeholder }: SelectProps): React.JSX.Element;
|
|
322
|
+
type ComboboxProps = Base & {
|
|
323
|
+
/** The options, filtered as the person types. */
|
|
324
|
+
options?: readonly FormOption[];
|
|
325
|
+
/** Fetches the options for a query (debounced, aborted by a newer one). */
|
|
326
|
+
onSearch?: (query: string, signal: AbortSignal) => Promise<readonly FormOption[]>;
|
|
327
|
+
/** Several values (`string[]`); one (`string`) by default. */
|
|
328
|
+
multiple?: boolean;
|
|
329
|
+
/** Shown while nothing is chosen, passed translated. */
|
|
330
|
+
placeholder?: string;
|
|
331
|
+
/** The words of the control, passed translated. */
|
|
332
|
+
labels?: Partial<ComboboxLabels>;
|
|
333
|
+
};
|
|
334
|
+
/** A choice among many, searched in a sheet: one value (`string`) or several (`string[]`). */
|
|
335
|
+
declare function Combobox({ name, label, hint, disabled, style, options, onSearch, multiple, placeholder, labels }: ComboboxProps): React.JSX.Element;
|
|
315
336
|
type DateFieldProps = Base & {
|
|
316
|
-
/**
|
|
337
|
+
/** `wheel` (default: day, month and year as wheels) or `parts` (typed on the numeric keypad). */
|
|
338
|
+
entry?: "wheel" | "parts";
|
|
339
|
+
/** The earliest date (ISO) of the wheels. */
|
|
340
|
+
min?: string;
|
|
341
|
+
/** The latest date (ISO) of the wheels: `latestBirthDate(18)` for an age gate. */
|
|
342
|
+
max?: string;
|
|
343
|
+
/** The names of the wheels or boxes (`day`, `month`, `year`), passed translated. */
|
|
317
344
|
labels?: Partial<DateFieldLabels>;
|
|
318
|
-
/** `bday` for a date of birth. */
|
|
345
|
+
/** `bday` for a date of birth: the wheels rest on 1 January 2000 until turned; typed boxes are autofilled. */
|
|
319
346
|
autoComplete?: "bday" | "off";
|
|
320
347
|
};
|
|
321
|
-
/** A date of the form (`YYYY-MM-DD`):
|
|
322
|
-
declare function DateField({ name, label, hint, disabled, style, labels, autoComplete }: DateFieldProps): React.JSX.Element;
|
|
348
|
+
/** A date of the form (`YYYY-MM-DD`): wheels in the locale's order (or day · month · year typed) — the schema checks it. */
|
|
349
|
+
declare function DateField({ name, label, hint, disabled, style, labels, autoComplete, entry, min, max }: DateFieldProps): React.JSX.Element;
|
|
350
|
+
type SliderProps = Base & {
|
|
351
|
+
/** The lowest value. Default 0. */
|
|
352
|
+
min?: number;
|
|
353
|
+
/** The highest value. Default 100. */
|
|
354
|
+
max?: number;
|
|
355
|
+
/** The step. Default 1. */
|
|
356
|
+
step?: number;
|
|
357
|
+
/** The value as words ("15 %", "3 min"), shown and read. */
|
|
358
|
+
formatValue?: (value: number) => string;
|
|
359
|
+
/** For a range (`[number, number]`): each thumb's name, passed translated. */
|
|
360
|
+
thumbLabels?: [string, string];
|
|
361
|
+
/** A graduation per step (`true`) or at the values given. */
|
|
362
|
+
ticks?: boolean | readonly number[];
|
|
363
|
+
};
|
|
364
|
+
/** A number (or a range) of the form, chosen by feel: a share, a volume, a price range. */
|
|
365
|
+
declare function Slider({ name, label, hint, disabled, style, min, max, step, formatValue, thumbLabels, ticks }: SliderProps): React.JSX.Element;
|
|
323
366
|
type MoneyProps = Base & {
|
|
324
367
|
/** The currency (ISO 4217): its sign beside the amount, its decimals. */
|
|
325
368
|
currency: string;
|
|
@@ -364,8 +407,10 @@ declare const createKrizakaForm: <S extends FormSchema>(definition: KrizakaFormD
|
|
|
364
407
|
Switch: typeof Switch;
|
|
365
408
|
RadioGroup: typeof RadioGroup;
|
|
366
409
|
Select: typeof Select;
|
|
410
|
+
Combobox: typeof Combobox;
|
|
367
411
|
DateField: typeof DateField;
|
|
368
412
|
Money: typeof Money;
|
|
413
|
+
Slider: typeof Slider;
|
|
369
414
|
Field: typeof FormField;
|
|
370
415
|
FieldArray: typeof FieldArray;
|
|
371
416
|
Watch: typeof Watch;
|
|
@@ -373,4 +418,4 @@ declare const createKrizakaForm: <S extends FormSchema>(definition: KrizakaFormD
|
|
|
373
418
|
FormError: typeof FormError;
|
|
374
419
|
}, FormProps>;
|
|
375
420
|
|
|
376
|
-
export { Checkbox, type CheckboxProps, DateField, type DateFieldProps, FieldArray, type FieldArrayProps, type FieldCheck, type FormActionResult, FormError, type FormErrorProps, FormField, type FormFieldError, type FormFieldProps, type FormI18n, type FormOption, type FormOutput, type FormProblem, type FormProps, type FormSchema, type FormValues, type KrizakaField, type KrizakaFieldArray, type KrizakaFormFactory, type KrizakaFormInstance, Money, type MoneyProps, RadioGroup, type RadioGroupProps, Select, Submit, type SubmitProps, Switch, TextArea, type TextAreaProps, TextField, type TextFieldProps, Watch, type WatchProps, createKrizakaForm, formMessage, formMessages, isRealDate, latestBirthDate, useFormContext, useFormStatus, useFormValue, useKrizakaField, useKrizakaFieldArray };
|
|
421
|
+
export { Checkbox, type CheckboxProps, Combobox, type ComboboxProps, DateField, type DateFieldProps, FieldArray, type FieldArrayProps, type FieldCheck, type FormActionResult, FormError, type FormErrorProps, FormField, type FormFieldError, type FormFieldProps, type FormI18n, type FormOption, type FormOutput, type FormProblem, type FormProps, type FormSchema, type FormValues, type KrizakaField, type KrizakaFieldArray, type KrizakaFormFactory, type KrizakaFormInstance, Money, type MoneyProps, RadioGroup, type RadioGroupProps, Select, type SelectProps, Slider, type SliderProps, Submit, type SubmitProps, Switch, TextArea, type TextAreaProps, TextField, type TextFieldProps, Watch, type WatchProps, createKrizakaForm, formMessage, formMessages, isRealDate, latestBirthDate, useFormContext, useFormStatus, useFormValue, useKrizakaField, useKrizakaFieldArray };
|
package/dist/native/form.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
// src/native/form.tsx
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Checkbox as CheckboxControl,
|
|
5
|
+
Combobox as ComboboxControl,
|
|
6
|
+
DateField as DateFieldControl,
|
|
7
|
+
DateWheel,
|
|
8
|
+
ProductMark,
|
|
9
|
+
RadioGroup as RadioGroupControl,
|
|
10
|
+
Select as SelectControl,
|
|
11
|
+
Slider as SliderControl,
|
|
12
|
+
Spinner,
|
|
13
|
+
Switch as SwitchControl,
|
|
14
|
+
TextField as TextFieldControl,
|
|
15
|
+
Txt,
|
|
16
|
+
useTheme
|
|
17
|
+
} from "@krizaka/ui/native";
|
|
3
18
|
import * as React2 from "react";
|
|
4
|
-
import { AccessibilityInfo, KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet,
|
|
19
|
+
import { AccessibilityInfo, KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet, View } from "react-native";
|
|
5
20
|
|
|
6
21
|
// src/form/core.tsx
|
|
7
22
|
import { useField, useForm, useStore } from "@tanstack/react-form";
|
|
@@ -420,12 +435,12 @@ function useChain(ctx) {
|
|
|
420
435
|
};
|
|
421
436
|
}, [ctx]);
|
|
422
437
|
}
|
|
423
|
-
function useChained(override) {
|
|
438
|
+
function useChained(override, skip = false) {
|
|
424
439
|
const chain = React2.useContext(ChainContext);
|
|
425
440
|
const key = React2.useId();
|
|
426
441
|
const ref = React2.useRef(null);
|
|
427
442
|
const [last, setLast] = React2.useState(false);
|
|
428
|
-
React2.useLayoutEffect(() => chain?.register({ key, focus: () => ref.current?.focus(), setLast }), [chain, key]);
|
|
443
|
+
React2.useLayoutEffect(() => skip ? void 0 : chain?.register({ key, focus: () => ref.current?.focus(), setLast }), [chain, key, skip]);
|
|
429
444
|
if (!chain || override.returnKeyType !== void 0 || override.onSubmitEditing !== void 0) return { inputRef: ref };
|
|
430
445
|
return {
|
|
431
446
|
inputRef: ref,
|
|
@@ -512,61 +527,107 @@ function Checkbox({ name, label, accessibleLabel, disabled, style }) {
|
|
|
512
527
|
}
|
|
513
528
|
function Switch({ name, label, hint, disabled, style }) {
|
|
514
529
|
const f = useKrizakaField(name);
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
onValueChange: (on) => {
|
|
529
|
-
f.setValue(on);
|
|
530
|
-
f.onBlur();
|
|
531
|
-
},
|
|
532
|
-
trackColor: { false: theme.surface3, true: theme.accent },
|
|
533
|
-
thumbColor: theme.textOnMedia,
|
|
534
|
-
...{ activeThumbColor: theme.textOnMedia },
|
|
535
|
-
ios_backgroundColor: theme.surface3
|
|
530
|
+
return /* @__PURE__ */ jsx2(
|
|
531
|
+
SwitchControl,
|
|
532
|
+
{
|
|
533
|
+
label,
|
|
534
|
+
description: hint,
|
|
535
|
+
showLabel: true,
|
|
536
|
+
error: f.error,
|
|
537
|
+
checked: f.value === true,
|
|
538
|
+
disabled,
|
|
539
|
+
style,
|
|
540
|
+
onCheckedChange: (on) => {
|
|
541
|
+
f.setValue(on);
|
|
542
|
+
f.onBlur();
|
|
536
543
|
}
|
|
537
|
-
|
|
538
|
-
|
|
544
|
+
}
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
function Caption({ field, hint }) {
|
|
548
|
+
if (field.error)
|
|
549
|
+
return /* @__PURE__ */ jsx2(Txt, { variant: "caption", tone: "danger", role: "alert", children: field.error });
|
|
550
|
+
return hint ? /* @__PURE__ */ jsx2(Txt, { variant: "caption", tone: "secondary", children: hint }) : null;
|
|
539
551
|
}
|
|
540
|
-
function RadioGroup({ name, label, hint, disabled, style, options,
|
|
552
|
+
function RadioGroup({ name, label, hint, disabled, style, options, variant = "list" }) {
|
|
541
553
|
const f = useKrizakaField(name);
|
|
542
554
|
return /* @__PURE__ */ jsxs(View, { style: [styles.field, style], children: [
|
|
543
555
|
/* @__PURE__ */ jsx2(Txt, { variant: "caption", tone: "secondary", style: styles.groupLabel, children: label }),
|
|
544
556
|
/* @__PURE__ */ jsx2(
|
|
545
|
-
|
|
557
|
+
RadioGroupControl,
|
|
546
558
|
{
|
|
547
|
-
|
|
548
|
-
|
|
559
|
+
label,
|
|
560
|
+
variant,
|
|
561
|
+
options,
|
|
549
562
|
value: f.value ?? "",
|
|
550
563
|
disabled,
|
|
551
|
-
scrollable,
|
|
552
564
|
onValueChange: (v) => {
|
|
553
565
|
f.setValue(v);
|
|
554
566
|
f.onBlur();
|
|
555
|
-
}
|
|
556
|
-
children: options.map((o) => /* @__PURE__ */ jsx2(Chip, { value: o.value, disabled: o.disabled, children: o.label }, o.value))
|
|
567
|
+
}
|
|
557
568
|
}
|
|
558
569
|
),
|
|
559
|
-
|
|
570
|
+
/* @__PURE__ */ jsx2(Caption, { field: f, hint })
|
|
560
571
|
] });
|
|
561
572
|
}
|
|
562
|
-
function Select(
|
|
563
|
-
|
|
573
|
+
function Select({ name, label, hint, disabled, style, options, placeholder }) {
|
|
574
|
+
const f = useKrizakaField(name);
|
|
575
|
+
return /* @__PURE__ */ jsx2(SelectControl, { label, hint, error: f.error, disabled, style, options, placeholder, value: f.value ?? "", onValueChange: (v) => f.setValue(v), onBlur: f.onBlur });
|
|
564
576
|
}
|
|
565
|
-
function
|
|
577
|
+
function Combobox({ name, label, hint, disabled, style, options, onSearch, multiple, placeholder, labels }) {
|
|
566
578
|
const f = useKrizakaField(name);
|
|
567
|
-
|
|
579
|
+
return /* @__PURE__ */ jsx2(
|
|
580
|
+
ComboboxControl,
|
|
581
|
+
{
|
|
582
|
+
label,
|
|
583
|
+
hint,
|
|
584
|
+
error: f.error,
|
|
585
|
+
disabled,
|
|
586
|
+
style,
|
|
587
|
+
options,
|
|
588
|
+
onSearch,
|
|
589
|
+
multiple,
|
|
590
|
+
placeholder,
|
|
591
|
+
labels,
|
|
592
|
+
value: f.value ?? (multiple ? [] : ""),
|
|
593
|
+
onValueChange: (v) => f.setValue(v),
|
|
594
|
+
onBlur: f.onBlur
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
function DateField({ name, label, hint, disabled, style, labels, autoComplete, entry = "wheel", min, max }) {
|
|
599
|
+
const f = useKrizakaField(name);
|
|
600
|
+
const chained = useChained({}, entry === "wheel");
|
|
601
|
+
if (entry === "wheel")
|
|
602
|
+
return /* @__PURE__ */ jsx2(
|
|
603
|
+
DateWheel,
|
|
604
|
+
{
|
|
605
|
+
label,
|
|
606
|
+
hint,
|
|
607
|
+
error: f.error,
|
|
608
|
+
disabled,
|
|
609
|
+
style,
|
|
610
|
+
labels,
|
|
611
|
+
locale: f.locale,
|
|
612
|
+
min,
|
|
613
|
+
max,
|
|
614
|
+
defaultView: autoComplete === "bday" ? "2000-01-01" : void 0,
|
|
615
|
+
value: f.value ?? "",
|
|
616
|
+
onValueChange: (v) => {
|
|
617
|
+
f.setValue(v);
|
|
618
|
+
f.onBlur();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
);
|
|
568
622
|
return /* @__PURE__ */ jsx2(DateFieldControl, { ...chained, returnKeyType: chained.returnKeyType, label, hint, error: f.error, disabled, style, labels, autoComplete, locale: f.locale, value: f.value ?? "", onValueChange: (v) => f.setValue(v), onBlur: f.onBlur });
|
|
569
623
|
}
|
|
624
|
+
function Slider({ name, label, hint, disabled, style, min, max, step, formatValue, thumbLabels, ticks }) {
|
|
625
|
+
const f = useKrizakaField(name);
|
|
626
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.field, style], children: [
|
|
627
|
+
/* @__PURE__ */ jsx2(SliderControl, { label, showLabel: true, floatingValue: true, value: f.value, min, max, step, disabled, formatValue, thumbLabels, ticks, onValueChange: (v) => f.setValue(v), onValueCommit: () => f.onBlur() }),
|
|
628
|
+
/* @__PURE__ */ jsx2(Caption, { field: f, hint })
|
|
629
|
+
] });
|
|
630
|
+
}
|
|
570
631
|
function Money({ name, label, hint, disabled, style, currency, placeholder }) {
|
|
571
632
|
const f = useKrizakaField(name);
|
|
572
633
|
const [text, setText] = React2.useState(() => moneyInputText(f.value, currency, f.locale));
|
|
@@ -610,7 +671,7 @@ function FieldArray({ name, children }) {
|
|
|
610
671
|
function Watch({ name, children }) {
|
|
611
672
|
return /* @__PURE__ */ jsx2(Fragment, { children: children(useFormValue(name)) });
|
|
612
673
|
}
|
|
613
|
-
var fields = { TextField, TextArea, Checkbox, Switch, RadioGroup, Select, DateField, Money, Field: FormField, FieldArray, Watch, Submit, FormError };
|
|
674
|
+
var fields = { TextField, TextArea, Checkbox, Switch, RadioGroup, Select, Combobox, DateField, Money, Slider, Field: FormField, FieldArray, Watch, Submit, FormError };
|
|
614
675
|
var createKrizakaForm = makeCreateKrizakaForm(fields, FormRoot);
|
|
615
676
|
var styles = StyleSheet.create({
|
|
616
677
|
form: { gap: 16, alignSelf: "stretch" },
|
|
@@ -618,12 +679,11 @@ var styles = StyleSheet.create({
|
|
|
618
679
|
field: { gap: 6, alignSelf: "stretch" },
|
|
619
680
|
suggestion: { alignSelf: "flex-start", minHeight: 32, justifyContent: "center" },
|
|
620
681
|
alert: { borderWidth: 1, padding: 12, gap: 4 },
|
|
621
|
-
switchRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: 16, minHeight: 44 },
|
|
622
|
-
switchText: { flex: 1, gap: 2 },
|
|
623
682
|
groupLabel: { fontWeight: "600" }
|
|
624
683
|
});
|
|
625
684
|
export {
|
|
626
685
|
Checkbox,
|
|
686
|
+
Combobox,
|
|
627
687
|
DateField,
|
|
628
688
|
FieldArray,
|
|
629
689
|
FormError,
|
|
@@ -631,6 +691,7 @@ export {
|
|
|
631
691
|
Money,
|
|
632
692
|
RadioGroup,
|
|
633
693
|
Select,
|
|
694
|
+
Slider,
|
|
634
695
|
Submit,
|
|
635
696
|
Switch,
|
|
636
697
|
TextArea,
|