react-luna-form 0.0.87 → 0.0.89
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 +1 -1
- package/dist/client/cjs/index.js +1 -1
- package/dist/client/esm/index.js +1 -1
- package/dist/config/cjs/index.js +1 -1
- package/dist/config/esm/index.js +1 -1
- package/dist/schema/cjs/index.js +1 -1
- package/dist/schema/esm/index.js +1 -1
- package/dist/server/cjs/index.js +1 -1
- package/dist/server/esm/index.js +1 -1
- package/dist/types/luna-core/handle/source-event.d.ts +2 -1
- package/dist/types/luna-core/handle/value-event.d.ts +2 -1
- package/dist/types/luna-core/helper/input.d.ts +16 -7
- package/dist/types/luna-core/type.d.ts +15 -4
- package/dist/types/luna-core/util/build.d.ts +20 -1
- package/dist/types/luna-core/util/constant.d.ts +4 -0
- package/dist/types/luna-core/util/date.d.ts +147 -6
- package/dist/types/luna-core/util/format.d.ts +11 -0
- package/dist/types/luna-core/util/is-input.d.ts +3 -2
- package/dist/types/luna-core/util/list.d.ts +3 -1
- package/dist/types/luna-core/util/pattern.d.ts +28 -0
- package/dist/types/luna-core/util/prepare.d.ts +3 -2
- package/dist/types/luna-core/util/schema.d.ts +4 -3
- package/dist/types/luna-core/util/string.d.ts +7 -0
- package/dist/types/luna-react/src/client/component/field/field-list-preview-item.d.ts +3 -3
- package/dist/types/luna-react/src/client/component/field/field-preview-item.d.ts +4 -2
- package/dist/types/luna-react/src/client/component/field/field-preview-value.d.ts +4 -1
- package/dist/types/luna-react/src/client/component/field/field-preview.d.ts +2 -2
- package/dist/types/luna-react/src/client/component/formatted-description.d.ts +2 -2
- package/dist/types/luna-react/src/client/component/guard/list-guard.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/input-strategies.d.ts +9 -1
- package/dist/types/luna-react/src/client/component/slot/slot.d.ts +1 -2
- package/dist/types/luna-react/src/client/hook/use-input-core.d.ts +2 -2
- package/dist/types/luna-react/src/component/column.d.ts +2 -2
- package/dist/types/luna-react/src/component/description.d.ts +2 -2
- package/dist/types/luna-react/src/component/field/field-list.d.ts +2 -3
- package/dist/types/luna-react/src/component/field/field.d.ts +3 -3
- package/dist/types/luna-react/src/component/field-description.d.ts +2 -2
- package/dist/types/luna-react/src/component/form.d.ts +1 -0
- package/dist/types/luna-react/src/component/input/input-base.d.ts +3 -3
- package/dist/types/luna-react/src/component/input-group.d.ts +2 -2
- package/dist/types/luna-react/src/component/input-label.d.ts +2 -2
- package/dist/types/luna-react/src/component/slot/list-slot.d.ts +1 -1
- package/dist/types/luna-react/src/component/slot/slot-base.d.ts +2 -3
- package/dist/types/luna-react/src/component/slot/slot-create.d.ts +2 -3
- package/dist/types/luna-react/src/component/slot/slot-list.d.ts +2 -3
- package/dist/types/luna-react/src/component/slot/slot.d.ts +1 -2
- package/dist/types/luna-react/src/config/index.d.ts +1 -0
- package/dist/types/luna-react/src/server/component/input.d.ts +2 -2
- package/dist/types/luna-react/src/server/component/slot.d.ts +1 -2
- package/dist/types/luna-react/src/type.d.ts +2 -1
- package/docs/events/change.md +4 -1
- package/docs/fields/custom-inputs.md +153 -4
- package/docs/fields/data-source.md +5 -3
- package/docs/fields/input.md +195 -4
- package/docs/fields/list.md +2 -1
- package/docs/fields/specialized-selectors.md +51 -12
- package/docs/forms/submit.md +6 -8
- package/docs/index.md +2 -1
- package/docs/interpolation/format-filters.md +28 -29
- package/docs/interpolation/overview.md +44 -14
- package/docs/setup.md +22 -17
- package/docs/structure/definition.md +45 -6
- package/docs/validation/overview.md +14 -11
- package/package.json +3 -3
- package/dist/types/luna-react/src/client/hook/use-format.d.ts +0 -5
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DATA_FORMAT, DATA_MODE, DATA_RESERVED, MAX, MIN } from './constant';
|
|
2
|
+
import type { Locale } from 'date-fns';
|
|
3
|
+
import type { Date as DateField, DateFormat, Input, Select, Time, TimeFormat, TimezoneGroup } from '../type';
|
|
4
|
+
/**
|
|
5
|
+
* The language a form writes its months, days, numbers, dates and dictionary
|
|
6
|
+
* in: its `lang`, as a canonical tag, and English without one, for one that is
|
|
7
|
+
* no tag, or for one the runtime knows no language for. It is the one reading
|
|
8
|
+
* of the language, so everything the form writes agrees on it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toLocale(locale?: string): string;
|
|
11
|
+
/** The base language of a form's language: `es` for `es-CO`. */
|
|
12
|
+
export declare function baseLanguage(locale?: string): string;
|
|
2
13
|
export declare function getMonth(locale?: string): {
|
|
3
14
|
value: string;
|
|
4
15
|
label: string;
|
|
@@ -11,13 +22,143 @@ export declare function getYear(min: number, max: number): Array<{
|
|
|
11
22
|
value: string;
|
|
12
23
|
label: string;
|
|
13
24
|
}>;
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
export type YearLimits = Readonly<{
|
|
26
|
+
max?: number;
|
|
27
|
+
min?: number;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* The first and the last year a year select offers, both included: whole
|
|
31
|
+
* numbers, the way an `input/number` takes its bounds, or a `$ref` the host
|
|
32
|
+
* resolved to one. The library keeps no clock, so "this year" is the host's to
|
|
33
|
+
* say, through `context`, and a field without both bounds offers no year.
|
|
34
|
+
*
|
|
35
|
+
* Read once for the options the component is handed and for the schema that
|
|
36
|
+
* checks a year, so the two cannot disagree. It takes an `Input` as well,
|
|
37
|
+
* which is what the schema sees every field as.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildYearLimits(field: Input | Select): YearLimits;
|
|
40
|
+
/**
|
|
41
|
+
* The zone a timezone select suggests, as its definition gives it in
|
|
42
|
+
* `advanced.suggested`: the host knows it -- a profile, a cookie, a header --
|
|
43
|
+
* and passes it through `context`, so the server and the browser suggest the
|
|
44
|
+
* same one. It is read as the name the runtime gives it, and a value that is no
|
|
45
|
+
* zone suggests nothing, which a development build names.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildSuggestedZone(field: Select): string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* An instant as the host gives it in `context.now`: an ISO date, time and
|
|
50
|
+
* offset, such as `2026-10-05T19:30:00-05:00` or `2026-10-06T00:30:00Z`.
|
|
51
|
+
* Without its offset a time would be read in this machine's zone, which is the
|
|
52
|
+
* clock the form keeps no more, so anything else is no instant.
|
|
53
|
+
*/
|
|
54
|
+
export declare function readInstant(text?: string): Date | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Every zone this engine knows, grouped by region, with the one the host
|
|
57
|
+
* suggests first. Labelled for the instant the host gives, `context.now`: the
|
|
58
|
+
* offset a zone has, and the name it goes by, both depend on it, so without one
|
|
59
|
+
* a zone goes by its city. Nothing here reads this machine's clock or zone.
|
|
60
|
+
*
|
|
61
|
+
* Built once while the zone and the instant hold: a timezone select builds its
|
|
62
|
+
* options on every render, and there are hundreds of zones. Frozen, since every
|
|
63
|
+
* form that asks shares it, on a server every request. `suggested` is a zone's
|
|
64
|
+
* name as the runtime gives it, as `buildSuggestedZone` reads it. Sorted in
|
|
65
|
+
* English, the language of the labels, so no machine's collation orders it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getTimezones(suggested?: string, now?: string): readonly TimezoneGroup[];
|
|
18
68
|
export declare function toNativeDate(value: string, fromFormat: DateFormat): string;
|
|
19
69
|
export declare function toNativeTime(value: string, fromFormat: TimeFormat): string;
|
|
20
70
|
export declare function fromNativeTime(native: string, toFormat?: TimeFormat): string;
|
|
21
|
-
export declare function
|
|
71
|
+
export declare function displayDate(value: string, format: DateFormat, lang?: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* The date-fns locale for a language, by its base: `es-CO` writes Spanish
|
|
74
|
+
* names. English for a language the library does not ship.
|
|
75
|
+
*/
|
|
76
|
+
export declare function dateFnsLocale(lang?: string): Locale | undefined;
|
|
22
77
|
export declare function getTimeFormat(field: Time): TimeFormat;
|
|
23
78
|
export declare function getDateFormat(field: DateField): DateFormat;
|
|
79
|
+
export type DateLimits = Readonly<{
|
|
80
|
+
max?: string;
|
|
81
|
+
min?: string;
|
|
82
|
+
reserved: readonly string[];
|
|
83
|
+
unreadable: boolean;
|
|
84
|
+
}>;
|
|
85
|
+
type DateBound = 'max' | 'min';
|
|
86
|
+
export type DateIssue = Readonly<{
|
|
87
|
+
issue: DateBound;
|
|
88
|
+
limit: string;
|
|
89
|
+
}> | Readonly<{
|
|
90
|
+
issue: 'range';
|
|
91
|
+
}> | Readonly<{
|
|
92
|
+
issue: 'reserved';
|
|
93
|
+
}> | Readonly<{
|
|
94
|
+
issue: 'unreadable';
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* The days a date field allows: the first and the last, both included, and
|
|
98
|
+
* the ones nobody may pick. Read once for the props its component is handed and
|
|
99
|
+
* for the schema that checks it, so the two cannot disagree.
|
|
100
|
+
*
|
|
101
|
+
* It is the one place the limits are read, on the server and in the browser, so
|
|
102
|
+
* it is where one that limits nothing is named for whoever wrote the form.
|
|
103
|
+
*/
|
|
104
|
+
export declare function buildDateLimits(field: DateField): DateLimits;
|
|
105
|
+
export declare function isUnreadableLength<T>(length: unknown, read: Readonly<{
|
|
106
|
+
max?: T;
|
|
107
|
+
min?: T;
|
|
108
|
+
}>): boolean;
|
|
109
|
+
export declare function checkDay(day: string, limits: DateLimits): DateIssue | null;
|
|
110
|
+
/**
|
|
111
|
+
* A range as the form holds it, `[from, to]`, with `''` for an end nobody
|
|
112
|
+
* picked: the pair a calendar emits or the two hidden inputs a form submits,
|
|
113
|
+
* and one text alone as the first end. Anything else -- numbers, an object, a
|
|
114
|
+
* list of more than two -- is no range, and comes back `undefined`, so it is
|
|
115
|
+
* held back for what it is instead of being taken for a range nobody picked.
|
|
116
|
+
*/
|
|
117
|
+
export declare function toRange(value: unknown): [string, string] | undefined;
|
|
118
|
+
export declare function checkRange(from: string, to: string, limits: DateLimits): DateIssue | null;
|
|
119
|
+
export type BoundRules = Readonly<{
|
|
120
|
+
beyond: 'above' | 'after';
|
|
121
|
+
disordered: string;
|
|
122
|
+
kind: string;
|
|
123
|
+
lost: string;
|
|
124
|
+
needsBoth: boolean;
|
|
125
|
+
}>;
|
|
126
|
+
export declare function describeBounds<T extends number | string>(name: string, length: unknown, limits: Readonly<{
|
|
127
|
+
max?: T;
|
|
128
|
+
min?: T;
|
|
129
|
+
}>, rules: BoundRules): string[];
|
|
130
|
+
export type DateProps = Readonly<{
|
|
131
|
+
format: DateFormat;
|
|
132
|
+
lang: string;
|
|
133
|
+
max?: string;
|
|
134
|
+
min?: string;
|
|
135
|
+
mode: 'range' | 'single';
|
|
136
|
+
reserved: readonly string[];
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* What a date component reads back from the props the form gave it: the format
|
|
140
|
+
* to show a day in, whether it picks one day or a range, the first and the last
|
|
141
|
+
* day it may offer, and the days it may not, all as `yyyy-MM-dd`.
|
|
142
|
+
*
|
|
143
|
+
* The form writes a date field's rules as attributes, so a native input and a
|
|
144
|
+
* calendar from any library can both carry them; this is the other half, and
|
|
145
|
+
* it lives here so an adapter never decodes an attribute the form chose how
|
|
146
|
+
* to encode.
|
|
147
|
+
*/
|
|
148
|
+
export declare function readDateProps(props: Readonly<{
|
|
149
|
+
[DATA_FORMAT]?: string;
|
|
150
|
+
[DATA_MODE]?: string;
|
|
151
|
+
[DATA_RESERVED]?: string;
|
|
152
|
+
[MAX]?: string;
|
|
153
|
+
[MIN]?: string;
|
|
154
|
+
lang?: string;
|
|
155
|
+
}>): DateProps;
|
|
156
|
+
/**
|
|
157
|
+
* What a reader worked out for a key, kept while it is among the last `limit`
|
|
158
|
+
* keys read, the one read longest ago dropped first: what a component reads on
|
|
159
|
+
* every render is worked out once while its input holds, whatever other forms
|
|
160
|
+
* read between, and a server that sees a new input on every request holds no
|
|
161
|
+
* more than that.
|
|
162
|
+
*/
|
|
163
|
+
export declare function remember<T>(cache: Map<string, T>, key: string, compute: () => T, limit: number): T;
|
|
164
|
+
export {};
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
export type FormatContext = {
|
|
2
2
|
locale?: string;
|
|
3
|
+
now?: string;
|
|
3
4
|
};
|
|
4
5
|
export type FormatFilter = (value: unknown, args: string[], ctx: FormatContext) => string;
|
|
6
|
+
/**
|
|
7
|
+
* `context.now`, the one key of the host's `context` the library reads on its
|
|
8
|
+
* own: the instant a relative date is measured from and a time zone's offset is
|
|
9
|
+
* given for. The library keeps no clock, so without it there is no "now".
|
|
10
|
+
*
|
|
11
|
+
* Only an ISO date, time and offset is an instant. A `Date`, a timestamp or a
|
|
12
|
+
* time without its offset is none, and a development build names it once for
|
|
13
|
+
* the context that carries it, since nothing on the form says so otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readNow(context?: Record<string, unknown>): string | undefined;
|
|
5
16
|
export declare const formatFilters: Record<string, FormatFilter>;
|
|
6
17
|
export declare function applyFormatFilter(value: unknown, expression: string, ctx: FormatContext): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Chips, Column, Field, Input, List, Nullable, Select, Time } from '../type';
|
|
1
|
+
import type { Chips, Column, Date as DateField, Field, Input, List, Nullable, Select, Time } from '../type';
|
|
2
2
|
export declare const isSelectActive: (field: Field) => boolean;
|
|
3
3
|
export declare const isSelectDay: (field: Field) => boolean;
|
|
4
4
|
export declare const isSelectMonth: (field: Field) => boolean;
|
|
@@ -6,8 +6,9 @@ export declare const isSelectYear: (field: Field) => boolean;
|
|
|
6
6
|
export declare const isSelectTimezone: (field: Field) => boolean;
|
|
7
7
|
export declare const isChipsDays: (field: Field) => boolean;
|
|
8
8
|
export declare const isChipsMonths: (field: Field) => boolean;
|
|
9
|
-
export declare const isDate: (field: Field) => field is
|
|
9
|
+
export declare const isDate: (field: Field) => field is DateField;
|
|
10
10
|
export declare const isTime: (field: Field) => field is Time;
|
|
11
|
+
export declare function isDateRange(field: Field): boolean;
|
|
11
12
|
export declare const isCheckbox: (field: Field) => field is Input;
|
|
12
13
|
export declare const isChips: (field: Field) => field is Chips;
|
|
13
14
|
export declare const isRadio: (field: Field) => field is Select;
|
|
@@ -4,7 +4,9 @@ import type { AnyField, Field, Fields, List, Nullable } from '../type';
|
|
|
4
4
|
*
|
|
5
5
|
* The defaults are here rather than at each reading, because they are read at
|
|
6
6
|
* mount, on every add and remove, and on assignment -- four chances for one of
|
|
7
|
-
* them to say a list shows one row by default and another to say none.
|
|
7
|
+
* them to say a list shows one row by default and another to say none. A bound
|
|
8
|
+
* that is no number keeps its default: the schema, which reads the bounds the
|
|
9
|
+
* same way, holds such a list back.
|
|
8
10
|
*/
|
|
9
11
|
export declare function getListBounds(list: List): {
|
|
10
12
|
min: number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an authored pattern can do to the thread that runs it.
|
|
3
|
+
*
|
|
4
|
+
* A pattern that can split the same text between its repetitions in more than
|
|
5
|
+
* one way backtracks exponentially on a value that almost matches: `^(a+)+$`
|
|
6
|
+
* holds the thread for seconds on thirty characters, a tab's or a server's.
|
|
7
|
+
* Only the ambiguity is dangerous. `^[a-z]+(-[a-z]+)*$` repeats a group with a
|
|
8
|
+
* quantifier inside it as well, and runs in linear time, because every
|
|
9
|
+
* repetition opens with a `-` that the one before cannot close with.
|
|
10
|
+
*
|
|
11
|
+
* So the question asked of each repeated group is not whether it nests a
|
|
12
|
+
* quantifier but whether its repetitions can overlap: whether the group can
|
|
13
|
+
* open with a character it can also close with, and then either holds an
|
|
14
|
+
* unbounded quantifier or offers alternatives that open alike. That is
|
|
15
|
+
* `(a+)+`, `(\w+\s?)+` and `(a|a)+`, and not `(-[a-z]+)*`, `(,\d+)*` or
|
|
16
|
+
* `(ab+c)+`.
|
|
17
|
+
*
|
|
18
|
+
* It is a reading of the source, not a proof. Characters are reasoned about as
|
|
19
|
+
* ASCII, with everything beyond it counted as one more symbol, and what the
|
|
20
|
+
* reader cannot tell apart it reads as any character: it would rather refuse
|
|
21
|
+
* a safe pattern than run a catastrophic one. Quadratic patterns are not its
|
|
22
|
+
* concern; they need very long values to hurt.
|
|
23
|
+
*
|
|
24
|
+
* Every term works out what it can open and close with as it is read, once,
|
|
25
|
+
* so reading a pattern costs time in proportion to its length, however it
|
|
26
|
+
* nests.
|
|
27
|
+
*/
|
|
28
|
+
export declare function backtracksCatastrophically(source: string, flags?: string): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Definition, Filterable, Nullable } from '../type';
|
|
2
|
-
export declare function prepare<T extends Filterable>(base?: readonly T[], definition?: Definition): T[];
|
|
3
|
-
export declare function resolveRefs(base: unknown, definition?: Definition,
|
|
2
|
+
export declare function prepare<T extends Filterable>(base?: readonly T[], definition?: Definition, context?: Record<string, unknown>): T[];
|
|
3
|
+
export declare function resolveRefs(base: unknown, definition?: Definition, context?: Record<string, unknown>): unknown;
|
|
4
|
+
export declare function refOf(value: unknown): string | undefined;
|
|
4
5
|
export declare function entries<T>(values?: Nullable<Record<string, T>>): [key: string, value: T][];
|
|
@@ -3,14 +3,15 @@ import type { CustomValidation, Definition, Field, Input, Schemas, Sections, Zod
|
|
|
3
3
|
export declare function buildSchema(schemas: Schemas, fields?: Field[], translations?: Record<string, string>): ZodSchema;
|
|
4
4
|
export declare function flatten(error: z.ZodError<Record<string, unknown>>): Record<string, string[]>;
|
|
5
5
|
export declare function getSchema(input: Input, translations?: Record<string, string>): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6
|
-
export declare function getEmail(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodPipe<z.ZodString, z.ZodEmail>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodEmail>, z.ZodLiteral<"">]>>>;
|
|
7
|
-
export declare function getText(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodCoercedString<unknown>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodCoercedString<unknown
|
|
6
|
+
export declare function getEmail(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodString>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodUnion<[z.ZodLiteral<"">, z.ZodString]>>>> | z.ZodPreprocess<z.ZodPipe<z.ZodString, z.ZodEmail>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodEmail>, z.ZodLiteral<"">]>>>;
|
|
7
|
+
export declare function getText(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodString>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodUnion<[z.ZodLiteral<"">, z.ZodString]>>>>;
|
|
8
8
|
export declare function getNumber(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>, unknown>;
|
|
9
9
|
export declare function getYearSchema(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>, unknown>;
|
|
10
10
|
export declare function getMonthSchema(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>, unknown>;
|
|
11
|
+
export declare function getDateSchema(field: Field, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<[string, string], unknown, z.core.$ZodTypeInternals<[string, string], unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<[string, string], unknown, z.core.$ZodTypeInternals<[string, string], unknown>>>, unknown> | z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>, unknown>;
|
|
11
12
|
export declare function applyCustomValidation(schema: ZodSchema, fields?: Field[], translations?: Record<string, string>): ZodSchema;
|
|
12
13
|
export declare function validateCustom(value: unknown, rules: CustomValidation | Array<CustomValidation>, getValue: (name: string) => unknown, translations?: Record<string, string>): string[];
|
|
13
|
-
export declare function buildFormSchema(sections: Sections, translations?: Record<string, string>, definition?: Definition): z.ZodType;
|
|
14
|
+
export declare function buildFormSchema(sections: Sections, translations?: Record<string, string>, definition?: Definition, context?: Record<string, unknown>): z.ZodType;
|
|
14
15
|
export declare function collectIssues(error: z.ZodError): Array<{
|
|
15
16
|
path: string;
|
|
16
17
|
message: string;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export type InterpolateOptions = {
|
|
2
2
|
locale?: string;
|
|
3
|
+
now?: string;
|
|
3
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* What text the form renders is formatted with: the form's language, its
|
|
7
|
+
* `lang`, and the instant the host gave in `context`. A label and a
|
|
8
|
+
* description format the same value the same way because they ask here.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderOptions(lang?: string, context?: Record<string, unknown>): InterpolateOptions;
|
|
4
11
|
/**
|
|
5
12
|
* Replaces placeholders in the format {key} with values from the provided object.
|
|
6
13
|
* Supports nested objects using dot notation (e.g., {user.id}) and pipe filters
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type Localization } from '../../../../../luna-core/index';
|
|
1
2
|
import type { List, Nullable, PreviewItem } from '../../../../../luna-core/index';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
|
-
export declare function FieldListPreviewItem({ canRemove, children, field, index, isMultiField, itemKey, label,
|
|
4
|
+
export declare function FieldListPreviewItem({ canRemove, children, field, index, isMultiField, itemKey, label, localization, onRemove, previewBadge, previewLabel, previewTags, value, }: {
|
|
4
5
|
canRemove: boolean;
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
field: List;
|
|
@@ -8,11 +9,10 @@ export declare function FieldListPreviewItem({ canRemove, children, field, index
|
|
|
8
9
|
isMultiField: boolean;
|
|
9
10
|
itemKey: string | number;
|
|
10
11
|
label: string;
|
|
11
|
-
|
|
12
|
+
localization?: Localization;
|
|
12
13
|
onRemove: (index: number) => void;
|
|
13
14
|
previewBadge?: PreviewItem;
|
|
14
15
|
previewLabel?: PreviewItem;
|
|
15
16
|
previewTags?: PreviewItem[];
|
|
16
|
-
translations?: Record<string, string>;
|
|
17
17
|
value?: Nullable<Record<string, unknown> | unknown[]>;
|
|
18
18
|
}): import("react").JSX.Element;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type Option } from '../../../../../luna-core/index';
|
|
2
|
-
export declare function FieldPreviewItem({ className, initialValue, name, options, separator, staticLabel, }: Readonly<{
|
|
1
|
+
import { type DateFormat, type Option } from '../../../../../luna-core/index';
|
|
2
|
+
export declare function FieldPreviewItem({ className, dateFormat, initialValue, lang, name, options, separator, staticLabel, }: Readonly<{
|
|
3
3
|
className?: string;
|
|
4
|
+
dateFormat?: DateFormat;
|
|
4
5
|
initialValue?: unknown;
|
|
6
|
+
lang?: string;
|
|
5
7
|
name?: string;
|
|
6
8
|
options?: Array<Option | string>;
|
|
7
9
|
separator?: boolean;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type DateFormat } from '../../../../../luna-core/index';
|
|
2
|
+
export declare function FieldPreviewValue({ children, dateFormat, initialValue, lang, name, }: Readonly<{
|
|
2
3
|
children: (value: string) => React.ReactNode;
|
|
4
|
+
dateFormat?: DateFormat;
|
|
3
5
|
initialValue?: unknown;
|
|
6
|
+
lang?: string;
|
|
4
7
|
name: string;
|
|
5
8
|
}>): import("react").JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { type Localization } from '../../../../../luna-core/index';
|
|
1
2
|
import type { Fields, PreviewItem } from '../../../../../luna-core/index';
|
|
2
3
|
type PreviewProps = Readonly<{
|
|
3
4
|
className?: string;
|
|
4
5
|
fields?: Fields;
|
|
5
6
|
label?: string;
|
|
6
|
-
|
|
7
|
+
localization?: Localization;
|
|
7
8
|
name: string;
|
|
8
9
|
previews: PreviewItem | PreviewItem[];
|
|
9
|
-
translations?: Record<string, string>;
|
|
10
10
|
value?: Record<string, unknown> | unknown[] | null;
|
|
11
11
|
}>;
|
|
12
12
|
export declare function FieldPreview(props: PreviewProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type Description as DescriptionType } from '../../../../luna-core/index';
|
|
1
|
+
import { type Description as DescriptionType, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
import type { Config } from '../../type';
|
|
3
3
|
export declare function FormattedDescription(props: Readonly<{
|
|
4
4
|
config?: Config;
|
|
5
5
|
context?: Record<string, unknown>;
|
|
6
|
+
localization?: Localization;
|
|
6
7
|
text?: DescriptionType;
|
|
7
|
-
translations?: Record<string, string>;
|
|
8
8
|
value?: unknown;
|
|
9
9
|
}>): import("react").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ListProps } from '../../../component/field/field-list';
|
|
2
|
-
export declare function ListGuard({ children, field,
|
|
2
|
+
export declare function ListGuard({ children, field, onValueChange, localization, value, }: ListProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { Config } from '../../type';
|
|
2
2
|
import type { DataSource, Field, Nullable, Value } from '../../../../luna-core/index';
|
|
3
|
+
/**
|
|
4
|
+
* What a held value is when the change events run at mount, which has to be
|
|
5
|
+
* what a change hands them later: a form reopened on saved data reveals what it
|
|
6
|
+
* revealed when it was filled in. An array travels as one -- a `chips` field's
|
|
7
|
+
* selections, the two days of a range -- since `String()` on it joins them into
|
|
8
|
+
* "a,b", which answers to no option, no `when` and no day. Anything else is the
|
|
9
|
+
* text it would have been typed as.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toChangeValue(value: unknown): Value;
|
|
3
12
|
/**
|
|
4
13
|
* What the input pipeline reads off a change, and all it reads: the new value.
|
|
5
14
|
*
|
|
@@ -38,5 +47,4 @@ export type InputStrategies = Readonly<{
|
|
|
38
47
|
}>) => void;
|
|
39
48
|
buildInitialSelected: (defaultValue: unknown, data: Nullable<unknown[]>, entity: string | undefined) => unknown;
|
|
40
49
|
isInitialReady: (field: Field, defaultValue: unknown, data: Nullable<unknown[]>) => boolean;
|
|
41
|
-
useExtraProps?: (field: Field) => Record<string, unknown> | undefined;
|
|
42
50
|
}>;
|
|
@@ -4,12 +4,11 @@ export declare const Slot: (props: Readonly<{
|
|
|
4
4
|
context?: Record<string, unknown>;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
fields?: import('../../../../../luna-core/index').Fields;
|
|
7
|
-
lang?: string;
|
|
8
7
|
onValueChange?: (input: {
|
|
9
8
|
name: string;
|
|
10
9
|
value: unknown;
|
|
11
10
|
}) => void;
|
|
12
11
|
style?: import('../../../../../luna-core/index').Style;
|
|
13
|
-
|
|
12
|
+
localization?: import('../../../../../luna-core/index').Localization;
|
|
14
13
|
value?: import('../../../../../luna-core/index').Nullable<Record<string, unknown>>;
|
|
15
14
|
}>) => import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type CommonProps, type DataAttributes, type DataSource, type Field, type Schema, type Value } from '../../../../luna-core/index';
|
|
1
|
+
import { type AriaAttributes, type CommonProps, type DataAttributes, type DataSource, type Field, type Schema, type Value, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
import type { Config, InputChange } from '../../type';
|
|
3
3
|
export type InputCoreProps = Readonly<{
|
|
4
4
|
ariaAttributes?: AriaAttributes;
|
|
@@ -9,13 +9,13 @@ export type InputCoreProps = Readonly<{
|
|
|
9
9
|
field: Field;
|
|
10
10
|
getField: (name: string) => Field | undefined;
|
|
11
11
|
horizontal?: boolean;
|
|
12
|
+
localization?: Localization;
|
|
12
13
|
onRegister: (name: string, schema: Schema, field: Field) => void;
|
|
13
14
|
onUnmount: (name: string, options?: {
|
|
14
15
|
keepValue?: boolean;
|
|
15
16
|
}) => void;
|
|
16
17
|
onValueChange?: (input: InputChange) => void;
|
|
17
18
|
readOnly?: boolean;
|
|
18
|
-
translations?: Record<string, string>;
|
|
19
19
|
}>;
|
|
20
20
|
export declare function useInputCore(props: InputCoreProps, deps: Readonly<{
|
|
21
21
|
setSource: (target: string, source?: DataSource) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DescriptionTextProps } from './description';
|
|
2
|
-
import { type Column } from '../../../luna-core/index';
|
|
2
|
+
import { type Column, type Localization } from '../../../luna-core/index';
|
|
3
3
|
import type { Config } from '../type';
|
|
4
4
|
export declare function Column(props: Readonly<{
|
|
5
5
|
children?: React.ReactNode;
|
|
@@ -7,5 +7,5 @@ export declare function Column(props: Readonly<{
|
|
|
7
7
|
config?: Config;
|
|
8
8
|
context?: Record<string, unknown>;
|
|
9
9
|
description?: React.ComponentType<DescriptionTextProps>;
|
|
10
|
-
|
|
10
|
+
localization?: Localization;
|
|
11
11
|
}>): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Description as DescriptionType } from '../../../luna-core/index';
|
|
1
|
+
import { type Description as DescriptionType, type Localization } from '../../../luna-core/index';
|
|
2
2
|
import type { Config } from '../type';
|
|
3
3
|
export declare function Description(props: Readonly<{
|
|
4
4
|
children: string | React.ReactNode;
|
|
@@ -7,7 +7,7 @@ export declare function Description(props: Readonly<{
|
|
|
7
7
|
export type DescriptionTextProps = Readonly<{
|
|
8
8
|
config?: Config;
|
|
9
9
|
context?: Record<string, unknown>;
|
|
10
|
+
localization?: Localization;
|
|
10
11
|
text?: DescriptionType;
|
|
11
|
-
translations?: Record<string, string>;
|
|
12
12
|
}>;
|
|
13
13
|
export declare function DescriptionText(props: DescriptionTextProps): import("react").JSX.Element | null;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { type List, type Nullable } from '../../../../luna-core/index';
|
|
1
|
+
import { type List, type Nullable, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
export type ListProps = Readonly<{
|
|
3
3
|
children: (index: number) => React.ReactNode;
|
|
4
4
|
field: List;
|
|
5
|
-
lang?: string;
|
|
6
5
|
onValueChange?: (input: {
|
|
7
6
|
name: string;
|
|
8
7
|
value: unknown;
|
|
9
8
|
}) => void;
|
|
10
|
-
|
|
9
|
+
localization?: Localization;
|
|
11
10
|
value?: Nullable<Record<string, unknown>>;
|
|
12
11
|
}>;
|
|
13
12
|
export declare function FieldList(props: ListProps): import("react").JSX.Element[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type Field, type Style } from '../../../../luna-core/index';
|
|
1
|
+
import { type Field, type Style, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
import type { Children } from '../../type';
|
|
3
3
|
export type FieldProps = Readonly<{
|
|
4
4
|
children: Children;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
errors?: string[];
|
|
7
7
|
field: Field;
|
|
8
|
-
|
|
8
|
+
now?: string;
|
|
9
9
|
style?: Style;
|
|
10
|
-
|
|
10
|
+
localization?: Localization;
|
|
11
11
|
}>;
|
|
12
12
|
export declare function Field(props: FieldProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Config } from '../type';
|
|
2
|
-
import type { Field } from '../../../luna-core/index';
|
|
2
|
+
import type { Field, Localization } from '../../../luna-core/index';
|
|
3
3
|
export type DescriptionProps = Readonly<{
|
|
4
4
|
config?: Config;
|
|
5
5
|
context?: Record<string, unknown>;
|
|
6
6
|
field: Field;
|
|
7
|
-
|
|
7
|
+
localization?: Localization;
|
|
8
8
|
}>;
|
|
9
9
|
export declare function StaticDescription(props: DescriptionProps): import("react").JSX.Element;
|
|
@@ -15,6 +15,7 @@ export declare function Form(props: Readonly<{
|
|
|
15
15
|
action?: (formData: FormData) => void;
|
|
16
16
|
children: Slot;
|
|
17
17
|
config: Config;
|
|
18
|
+
context?: Record<string, unknown>;
|
|
18
19
|
control?: Control;
|
|
19
20
|
definition?: Definition;
|
|
20
21
|
fieldSet?: React.ComponentType<React.ComponentProps<typeof StaticFieldSet>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Field } from '../../../../luna-core/index';
|
|
1
|
+
import { type Field, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
import type { Children } from '../../type';
|
|
3
3
|
export declare function InputBase(props: Readonly<{
|
|
4
4
|
children: Children;
|
|
@@ -6,7 +6,7 @@ export declare function InputBase(props: Readonly<{
|
|
|
6
6
|
errors?: string[];
|
|
7
7
|
field: Field;
|
|
8
8
|
horizontal?: boolean;
|
|
9
|
-
|
|
9
|
+
localization?: Localization;
|
|
10
|
+
now?: string;
|
|
10
11
|
readOnly?: boolean;
|
|
11
|
-
translations?: Record<string, string>;
|
|
12
12
|
}>): import("react").ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DescriptionProps } from './field-description';
|
|
2
2
|
import type { Config } from '../type';
|
|
3
|
-
import type { Field } from '../../../luna-core/index';
|
|
3
|
+
import type { Field, Localization } from '../../../luna-core/index';
|
|
4
4
|
export declare function InputGroup(props: Readonly<{
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
config?: Config;
|
|
@@ -8,5 +8,5 @@ export declare function InputGroup(props: Readonly<{
|
|
|
8
8
|
description?: React.ComponentType<DescriptionProps>;
|
|
9
9
|
field: Field;
|
|
10
10
|
horizontal?: boolean;
|
|
11
|
-
|
|
11
|
+
localization?: Localization;
|
|
12
12
|
}>): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DescriptionProps } from './field-description';
|
|
2
|
-
import { type Field } from '../../../luna-core/index';
|
|
2
|
+
import { type Field, type Localization } from '../../../luna-core/index';
|
|
3
3
|
import type { Config } from '../type';
|
|
4
4
|
export declare function InputLabel(props: Readonly<{
|
|
5
5
|
config?: Config;
|
|
@@ -7,5 +7,5 @@ export declare function InputLabel(props: Readonly<{
|
|
|
7
7
|
description?: React.ComponentType<DescriptionProps>;
|
|
8
8
|
field: Field;
|
|
9
9
|
horizontal?: boolean;
|
|
10
|
-
|
|
10
|
+
localization?: Localization;
|
|
11
11
|
}>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ListProps } from '../field/field-list';
|
|
2
|
-
export declare function ListSlot({ children, field,
|
|
2
|
+
export declare function ListSlot({ children, field, localization, value }: ListProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Fields, type Nullable, type Style } from '../../../../luna-core/index';
|
|
1
|
+
import { type Fields, type Nullable, type Style, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
import type { DescriptionTextProps } from '../description';
|
|
3
3
|
import type { Children, Config } from '../../type';
|
|
4
4
|
import type { FieldProps } from '../field/field';
|
|
@@ -15,12 +15,11 @@ export declare function SlotBase(props: Readonly<{
|
|
|
15
15
|
context?: Record<string, unknown>;
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
fields?: Fields;
|
|
18
|
-
lang?: string;
|
|
19
18
|
onValueChange?: (input: {
|
|
20
19
|
name: string;
|
|
21
20
|
value: unknown;
|
|
22
21
|
}) => void;
|
|
23
22
|
style?: Style;
|
|
24
|
-
|
|
23
|
+
localization?: Localization;
|
|
25
24
|
value?: Nullable<Record<string, unknown>>;
|
|
26
25
|
}>): import("react").JSX.Element[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Children, Config } from '../../type';
|
|
2
|
-
import type { Fields, Nullable, Style } from '../../../../luna-core/index';
|
|
2
|
+
import type { Fields, Localization, Nullable, Style } from '../../../../luna-core/index';
|
|
3
3
|
import type { SlotComponents } from './slot-base';
|
|
4
4
|
export declare function createSlot(components: SlotComponents): (props: Readonly<{
|
|
5
5
|
children: Children;
|
|
@@ -7,12 +7,11 @@ export declare function createSlot(components: SlotComponents): (props: Readonly
|
|
|
7
7
|
context?: Record<string, unknown>;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
fields?: Fields;
|
|
10
|
-
lang?: string;
|
|
11
10
|
onValueChange?: (input: {
|
|
12
11
|
name: string;
|
|
13
12
|
value: unknown;
|
|
14
13
|
}) => void;
|
|
15
14
|
style?: Style;
|
|
16
|
-
|
|
15
|
+
localization?: Localization;
|
|
17
16
|
value?: Nullable<Record<string, unknown>>;
|
|
18
17
|
}>) => import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type List, type Nullable, type Style } from '../../../../luna-core/index';
|
|
1
|
+
import { type List, type Nullable, type Style, type Localization } from '../../../../luna-core/index';
|
|
2
2
|
import { type SlotComponents } from './slot-base';
|
|
3
3
|
import type { Children, Config } from '../../type';
|
|
4
4
|
export declare function SlotList(props: Readonly<{
|
|
@@ -9,12 +9,11 @@ export declare function SlotList(props: Readonly<{
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
field: List;
|
|
11
11
|
index: number;
|
|
12
|
-
lang?: string;
|
|
13
12
|
onValueChange?: (input: {
|
|
14
13
|
name: string;
|
|
15
14
|
value: unknown;
|
|
16
15
|
}) => void;
|
|
17
16
|
style?: Style;
|
|
18
|
-
|
|
17
|
+
localization?: Localization;
|
|
19
18
|
value?: Nullable<Record<string, unknown>>;
|
|
20
19
|
}>): import("react").JSX.Element;
|