react-luna-form 0.0.71 → 0.0.73
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/client/cjs/index.js +1 -1
- package/dist/client/esm/index.js +1 -1
- package/dist/schema/cjs/index.js +1 -1
- package/dist/schema/esm/index.js +1 -1
- package/dist/types/luna-core/fetcher.d.ts +2 -0
- package/dist/types/luna-core/handle/proxy-event.d.ts +6 -0
- package/dist/types/luna-core/handle/source-event.d.ts +2 -0
- package/dist/types/luna-core/handle/state-event.d.ts +2 -0
- package/dist/types/luna-core/handle/value-event.d.ts +5 -0
- package/dist/types/luna-core/helper/input.d.ts +61 -0
- package/dist/types/luna-core/index.d.ts +28 -0
- package/dist/types/luna-core/type.d.ts +267 -0
- package/dist/types/luna-core/util/attributes.d.ts +6 -0
- package/dist/types/luna-core/util/build.d.ts +6 -0
- package/dist/types/luna-core/util/column.d.ts +2 -0
- package/dist/types/luna-core/util/condition.d.ts +2 -0
- package/dist/types/luna-core/util/constant.d.ts +53 -0
- package/dist/types/luna-core/util/date.d.ts +23 -0
- package/dist/types/luna-core/util/extract.d.ts +16 -0
- package/dist/types/luna-core/util/format.d.ts +6 -0
- package/dist/types/luna-core/util/is-input.d.ts +26 -0
- package/dist/types/luna-core/util/is-type.d.ts +7 -0
- package/dist/types/luna-core/util/list.d.ts +5 -0
- package/dist/types/luna-core/util/logger.d.ts +5 -0
- package/dist/types/luna-core/util/operator.d.ts +1 -0
- package/dist/types/luna-core/util/path.d.ts +1 -0
- package/dist/types/luna-core/util/prepare.d.ts +4 -0
- package/dist/types/luna-core/util/schema.d.ts +21 -0
- package/dist/types/luna-core/util/source.d.ts +2 -0
- package/dist/types/luna-core/util/string.d.ts +12 -0
- package/dist/types/luna-core/util/stringify.d.ts +1 -0
- package/dist/types/luna-core/util/style.d.ts +6 -0
- package/dist/types/luna-core/util/transform.d.ts +2 -0
- package/dist/types/luna-core/util/translate.d.ts +1 -0
- package/dist/types/luna-core/util/url.d.ts +10 -0
- package/dist/types/luna-react/src/client/component/field/field-list-preview-item.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/field/field-preview-item.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/field/field-preview.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/field/field.d.ts +2 -2
- package/dist/types/luna-react/src/client/component/form-content.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/form.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/guard/visibility-guard.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/input-selectable.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/input-strategies.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/slot/slot.d.ts +3 -3
- package/dist/types/luna-react/src/client/hook/use-data-source.d.ts +2 -2
- package/dist/types/luna-react/src/client/hook/use-fetch.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-field-list.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-form-action.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-format.d.ts +3 -3
- package/dist/types/luna-react/src/client/hook/use-input-core.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-input.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-schema.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-value.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-write-only-source.d.ts +1 -1
- package/dist/types/luna-react/src/client/index.d.ts +1 -1
- package/dist/types/luna-react/src/client/lib/source-store.d.ts +1 -1
- package/dist/types/luna-react/src/client/lib/state-store.d.ts +1 -1
- package/dist/types/luna-react/src/component/column.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-error.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-group.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-list.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-set-advanced.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-set.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field.d.ts +1 -1
- package/dist/types/luna-react/src/component/field-description.d.ts +1 -1
- package/dist/types/luna-react/src/component/form.d.ts +1 -1
- package/dist/types/luna-react/src/component/formatted-description.d.ts +1 -1
- package/dist/types/luna-react/src/component/input/input-base.d.ts +1 -1
- package/dist/types/luna-react/src/component/input-group.d.ts +1 -1
- package/dist/types/luna-react/src/component/input-label.d.ts +1 -1
- package/dist/types/luna-react/src/component/label.d.ts +1 -1
- package/dist/types/luna-react/src/component/list.d.ts +1 -1
- package/dist/types/luna-react/src/component/slot/slot-base.d.ts +1 -1
- package/dist/types/luna-react/src/component/slot/slot-create.d.ts +1 -1
- package/dist/types/luna-react/src/component/slot/slot-list.d.ts +1 -1
- package/dist/types/luna-react/src/component/slot/slot.d.ts +3 -3
- package/dist/types/luna-react/src/config/index.d.ts +1 -1
- package/dist/types/luna-react/src/schema/index.d.ts +2 -2
- package/dist/types/luna-react/src/server/component/fallback.d.ts +1 -1
- package/dist/types/luna-react/src/server/component/form.d.ts +1 -1
- package/dist/types/luna-react/src/server/component/input.d.ts +1 -1
- package/dist/types/luna-react/src/server/index.d.ts +1 -1
- package/dist/types/luna-react/src/type.d.ts +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import type { core, z, ZodObject } from 'zod';
|
|
2
|
+
export type Schema = z.ZodTypeAny;
|
|
3
|
+
export type Schemas = Record<string, Schema>;
|
|
4
|
+
export type ZodSchema = ZodObject<{
|
|
5
|
+
[x: string]: Schema;
|
|
6
|
+
}, core.$strip>;
|
|
7
|
+
export type Nullable<T> = T | null;
|
|
8
|
+
export type DataAttributes = Record<string, string | number | boolean>;
|
|
9
|
+
export type AriaAttributes = Record<string, string | number | boolean>;
|
|
10
|
+
export type Description = string | {
|
|
11
|
+
collapsed?: boolean;
|
|
12
|
+
message: string;
|
|
13
|
+
title: string;
|
|
14
|
+
};
|
|
15
|
+
export type TimeFormat = 'HH:mm' | 'HH:mm:ss' | 'hh:mm a' | 'hh:mm:ss a';
|
|
16
|
+
export type DateFormat = 'yyyy-MM-dd' | 'MM/dd/yyyy' | 'dd/MM/yyyy' | 'MMMM d, yyyy';
|
|
17
|
+
export type DataSource = {
|
|
18
|
+
body?: BodyInit | Record<string, unknown>;
|
|
19
|
+
cache?: RequestCache;
|
|
20
|
+
headers?: HeadersInit;
|
|
21
|
+
method?: string;
|
|
22
|
+
namespace?: string;
|
|
23
|
+
url: string;
|
|
24
|
+
};
|
|
25
|
+
export type Source = {
|
|
26
|
+
[key: string]: DataSource | Array<unknown>;
|
|
27
|
+
};
|
|
28
|
+
export type Definition = Record<string, unknown>;
|
|
29
|
+
export type Orderable = {
|
|
30
|
+
order?: number;
|
|
31
|
+
};
|
|
32
|
+
export type Hideable = {
|
|
33
|
+
hidden?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type Sections = Section[];
|
|
36
|
+
export type Multiple = readonly (string | number | boolean)[];
|
|
37
|
+
export type Value = string | number | boolean | Multiple;
|
|
38
|
+
export type Option = {
|
|
39
|
+
description?: string;
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
};
|
|
43
|
+
export type OptionGroup = {
|
|
44
|
+
items: Option[];
|
|
45
|
+
label: string;
|
|
46
|
+
};
|
|
47
|
+
export type PreviewItem = string | {
|
|
48
|
+
field?: string;
|
|
49
|
+
label?: string;
|
|
50
|
+
when?: string | string[] | Condition;
|
|
51
|
+
};
|
|
52
|
+
export type List = {
|
|
53
|
+
advanced?: {
|
|
54
|
+
title?: string;
|
|
55
|
+
action?: string;
|
|
56
|
+
collapsed?: boolean;
|
|
57
|
+
length?: Length<number>;
|
|
58
|
+
preview?: {
|
|
59
|
+
label?: PreviewItem;
|
|
60
|
+
tags?: PreviewItem[];
|
|
61
|
+
badge?: PreviewItem;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
description?: string;
|
|
65
|
+
fields: Array<AnyField | Column>;
|
|
66
|
+
label?: string;
|
|
67
|
+
name: string;
|
|
68
|
+
type: 'list' | (string & {});
|
|
69
|
+
validation?: {
|
|
70
|
+
length?: Length<string>;
|
|
71
|
+
};
|
|
72
|
+
} & Base;
|
|
73
|
+
export type AnyField = Field | Input | Select | Chips | Date | Time;
|
|
74
|
+
export type Fields = Array<AnyField | Column | List>;
|
|
75
|
+
export type Base = Orderable & Hideable;
|
|
76
|
+
export type CommonProps = {
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
id?: string;
|
|
79
|
+
name?: string;
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
required?: boolean;
|
|
82
|
+
};
|
|
83
|
+
export type Section = {
|
|
84
|
+
advanced?: {
|
|
85
|
+
collapsible?: boolean;
|
|
86
|
+
compact?: boolean;
|
|
87
|
+
separator?: boolean;
|
|
88
|
+
};
|
|
89
|
+
description?: string;
|
|
90
|
+
fields?: Fields;
|
|
91
|
+
id?: string | number;
|
|
92
|
+
title?: string;
|
|
93
|
+
} & Base;
|
|
94
|
+
export type Column = {
|
|
95
|
+
advanced?: {
|
|
96
|
+
cols?: number;
|
|
97
|
+
};
|
|
98
|
+
description?: Description;
|
|
99
|
+
fields: Array<AnyField>;
|
|
100
|
+
type: 'column' | (string & {});
|
|
101
|
+
} & Base;
|
|
102
|
+
export type Operator = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists' | 'empty' | 'truthy';
|
|
103
|
+
export type Condition = {
|
|
104
|
+
field?: string;
|
|
105
|
+
operator?: Operator;
|
|
106
|
+
value: string | number | string[];
|
|
107
|
+
};
|
|
108
|
+
export type CustomValidation = {
|
|
109
|
+
field: string;
|
|
110
|
+
message?: string;
|
|
111
|
+
operator?: Operator;
|
|
112
|
+
};
|
|
113
|
+
export type FieldState = {
|
|
114
|
+
description?: Description;
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
hidden?: boolean;
|
|
117
|
+
};
|
|
118
|
+
export type ActionEvent<T> = {
|
|
119
|
+
action: T;
|
|
120
|
+
};
|
|
121
|
+
export type SourceEvent = ActionEvent<'source'> & {
|
|
122
|
+
source: DataSource;
|
|
123
|
+
target: string;
|
|
124
|
+
};
|
|
125
|
+
export type ValueEvent = ActionEvent<'value'> & {
|
|
126
|
+
onlyIfTargetEmpty?: boolean;
|
|
127
|
+
value: Record<string, Value | Array<Record<string, unknown>>>;
|
|
128
|
+
};
|
|
129
|
+
export type StateEvent = ActionEvent<'state'> & {
|
|
130
|
+
state: FieldState;
|
|
131
|
+
target: string | string[];
|
|
132
|
+
when?: string | string[] | Condition;
|
|
133
|
+
};
|
|
134
|
+
export type ChangeEvent = Array<SourceEvent | ValueEvent | StateEvent>;
|
|
135
|
+
export type WhenRule = {
|
|
136
|
+
field: string;
|
|
137
|
+
operator?: Operator;
|
|
138
|
+
value?: string | number | boolean | Array<string | number>;
|
|
139
|
+
message?: string;
|
|
140
|
+
};
|
|
141
|
+
export type PatternRule = {
|
|
142
|
+
regex: string;
|
|
143
|
+
flags?: string;
|
|
144
|
+
message?: string;
|
|
145
|
+
allowInterpolation?: boolean;
|
|
146
|
+
};
|
|
147
|
+
export type WhenClause = WhenRule | WhenRule[] | {
|
|
148
|
+
all?: WhenRule[];
|
|
149
|
+
any?: WhenRule[];
|
|
150
|
+
};
|
|
151
|
+
export type AssertRule = {
|
|
152
|
+
when?: WhenClause;
|
|
153
|
+
assert: 'required' | 'minItems' | 'maxItems' | 'pattern' | 'oneOf' | 'min' | 'max';
|
|
154
|
+
value?: string | number | Array<string | number> | PatternRule;
|
|
155
|
+
message: string;
|
|
156
|
+
};
|
|
157
|
+
export type Validation = {
|
|
158
|
+
custom?: CustomValidation | Array<CustomValidation>;
|
|
159
|
+
email?: string;
|
|
160
|
+
length?: Length<string>;
|
|
161
|
+
required?: string;
|
|
162
|
+
requiredWhen?: WhenRule | Array<WhenRule>;
|
|
163
|
+
pattern?: PatternRule;
|
|
164
|
+
rules?: Array<AssertRule>;
|
|
165
|
+
};
|
|
166
|
+
export type Field = CommonProps & {
|
|
167
|
+
advanced?: {
|
|
168
|
+
aria?: AriaAttributes;
|
|
169
|
+
autocomplete?: string;
|
|
170
|
+
cols?: number;
|
|
171
|
+
data?: DataAttributes;
|
|
172
|
+
entity?: string;
|
|
173
|
+
horizontal?: boolean;
|
|
174
|
+
reverse?: boolean;
|
|
175
|
+
};
|
|
176
|
+
defaultValue?: Value;
|
|
177
|
+
event?: {
|
|
178
|
+
change?: ChangeEvent;
|
|
179
|
+
};
|
|
180
|
+
description?: Description;
|
|
181
|
+
fields?: never;
|
|
182
|
+
label?: string;
|
|
183
|
+
name: string;
|
|
184
|
+
readonly?: boolean;
|
|
185
|
+
type: string;
|
|
186
|
+
validation?: Validation;
|
|
187
|
+
} & Base;
|
|
188
|
+
export type Length<T> = {
|
|
189
|
+
max?: T;
|
|
190
|
+
min?: T;
|
|
191
|
+
};
|
|
192
|
+
export type Transform = 'lowercase' | 'uppercase' | 'remove-space' | 'remove-accent';
|
|
193
|
+
export type Input = Field & {
|
|
194
|
+
advanced?: {
|
|
195
|
+
length?: Length<number>;
|
|
196
|
+
transform?: Transform | Transform[];
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
export type Select = Field & {
|
|
200
|
+
advanced?: {
|
|
201
|
+
autocomplete?: never;
|
|
202
|
+
length?: Length<number | string>;
|
|
203
|
+
options?: Option;
|
|
204
|
+
preselected?: boolean;
|
|
205
|
+
};
|
|
206
|
+
source?: DataSource | Array<unknown>;
|
|
207
|
+
};
|
|
208
|
+
export type Chips = Select & {
|
|
209
|
+
advanced?: {
|
|
210
|
+
multiple?: boolean;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
type TemporalField<T> = Field & {
|
|
214
|
+
advanced?: {
|
|
215
|
+
format?: T;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
export type Date = TemporalField<DateFormat>;
|
|
219
|
+
export type Time = TemporalField<TimeFormat>;
|
|
220
|
+
export type Environment = {
|
|
221
|
+
[key: string]: Value;
|
|
222
|
+
};
|
|
223
|
+
export type Protocol = 'http' | 'https';
|
|
224
|
+
export type RemotePattern = {
|
|
225
|
+
hostname?: string;
|
|
226
|
+
port?: number;
|
|
227
|
+
protocol?: Protocol;
|
|
228
|
+
};
|
|
229
|
+
export type FormStateError = {
|
|
230
|
+
description?: string;
|
|
231
|
+
details?: Nullable<Record<string, string[]> | string[]>;
|
|
232
|
+
title: string;
|
|
233
|
+
};
|
|
234
|
+
export type BaseConfig<T> = {
|
|
235
|
+
env?: Environment;
|
|
236
|
+
fetcher: {
|
|
237
|
+
provider: <T>(dataSource: DataSource) => Promise<T>;
|
|
238
|
+
remotePatterns?: Array<RemotePattern>;
|
|
239
|
+
};
|
|
240
|
+
inputs: {
|
|
241
|
+
[key: string]: T;
|
|
242
|
+
};
|
|
243
|
+
style?: Style;
|
|
244
|
+
validation: {
|
|
245
|
+
blur?: boolean;
|
|
246
|
+
change?: boolean;
|
|
247
|
+
showError?: boolean;
|
|
248
|
+
submit?: boolean;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
export type Style = {
|
|
252
|
+
compact?: boolean;
|
|
253
|
+
horizontal?: boolean;
|
|
254
|
+
showOptionalLabel?: boolean;
|
|
255
|
+
};
|
|
256
|
+
export type Filterable = Base & {
|
|
257
|
+
fields?: Filterable[];
|
|
258
|
+
};
|
|
259
|
+
export type TimezoneItem = {
|
|
260
|
+
label: string;
|
|
261
|
+
value: string;
|
|
262
|
+
};
|
|
263
|
+
export type TimezoneGroup = {
|
|
264
|
+
items: TimezoneItem[];
|
|
265
|
+
label: string;
|
|
266
|
+
};
|
|
267
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Field } from '../type';
|
|
2
|
+
export declare function getPrefixedAttributes(prefix: string, record?: Record<string, string | number | boolean>): Record<string, string | number | boolean>;
|
|
3
|
+
export declare function getAriaAttributes(record?: Record<string, string | number | boolean>): Record<string, string | number | boolean>;
|
|
4
|
+
export declare function getDataAttributes(record?: Record<string, string | number | boolean>): Record<string, string | number | boolean>;
|
|
5
|
+
export declare function buildAriaAttributes(field: Field, errors?: string[]): Record<string, string | number | boolean>;
|
|
6
|
+
export declare function buildDataAttributes(field: Field): Record<string, string | number | boolean>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Field, Nullable } from '../type';
|
|
2
|
+
export declare function buildOptions(field: Field, values?: Nullable<Record<string, unknown>>): Record<string, unknown>[] | undefined;
|
|
3
|
+
export declare function buildOrientation(field: Field): boolean;
|
|
4
|
+
export declare function buildReverse(field: Field): boolean;
|
|
5
|
+
export declare function buildDisabled(field: Field, disabled?: boolean): boolean;
|
|
6
|
+
export declare function buildSource(field: Field): import("..").DataSource | unknown[] | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const INPUT = "input";
|
|
2
|
+
export declare const INPUT_DATE = "input/date";
|
|
3
|
+
export declare const INPUT_EMAIL = "input/email";
|
|
4
|
+
export declare const INPUT_NUMBER = "input/number";
|
|
5
|
+
export declare const INPUT_PASSWORD = "input/password";
|
|
6
|
+
export declare const INPUT_TEL = "input/tel";
|
|
7
|
+
export declare const INPUT_TEXT = "input/text";
|
|
8
|
+
export declare const INPUT_TIME = "input/time";
|
|
9
|
+
export declare const INPUTS: string[];
|
|
10
|
+
export declare const TEXTAREA = "textarea";
|
|
11
|
+
export declare const RADIO = "radio";
|
|
12
|
+
export declare const CHECKBOX = "checkbox";
|
|
13
|
+
export declare const LIST = "list";
|
|
14
|
+
export declare const DATA_TABLE = "data-table";
|
|
15
|
+
export declare const SELECT = "select";
|
|
16
|
+
export declare const SELECT_ACTIVE = "select/active";
|
|
17
|
+
export declare const SELECT_DAY = "select/day";
|
|
18
|
+
export declare const SELECT_MONTH = "select/month";
|
|
19
|
+
export declare const SELECT_TIMEZONE = "select/timezone";
|
|
20
|
+
export declare const SELECT_YEAR = "select/year";
|
|
21
|
+
export declare const SELECTS: string[];
|
|
22
|
+
export declare const CHIPS = "chips";
|
|
23
|
+
export declare const CHIPS_DAYS = "chips/day";
|
|
24
|
+
export declare const CHIPS_MONTHS = "chips/month";
|
|
25
|
+
export declare const COLUMN = "column";
|
|
26
|
+
export declare const DESCRIPTION = "description";
|
|
27
|
+
export declare const FIELDS = "fields";
|
|
28
|
+
export declare const LABEL = "label";
|
|
29
|
+
export declare const VALUE = "value";
|
|
30
|
+
export declare const OPTIONS = "options";
|
|
31
|
+
export declare const TYPE_EMAIL = "email";
|
|
32
|
+
export declare const TYPE_NUMBER = "number";
|
|
33
|
+
export declare const TYPE_PASSWORD = "password";
|
|
34
|
+
export declare const TYPE_TEL = "tel";
|
|
35
|
+
export declare const TYPE_TEXT = "text";
|
|
36
|
+
export declare const ARIA_ERROR_MESSAGE = "aria-errormessage";
|
|
37
|
+
export declare const ARIA_INVALID = "aria-invalid";
|
|
38
|
+
export declare const DATA_INVALID = "data-invalid";
|
|
39
|
+
export declare const DATA_READONLY = "data-readonly";
|
|
40
|
+
export declare const PREFIX_ARIA = "aria";
|
|
41
|
+
export declare const PREFIX_DATA = "data";
|
|
42
|
+
export declare const MAX = "max";
|
|
43
|
+
export declare const MAX_LENGTH = "maxLength";
|
|
44
|
+
export declare const MIN = "min";
|
|
45
|
+
export declare const MIN_LENGTH = "minLength";
|
|
46
|
+
export declare const $REF = "$ref";
|
|
47
|
+
export declare const SET = "set";
|
|
48
|
+
export declare const SOURCE = "source";
|
|
49
|
+
export declare const STATE = "state";
|
|
50
|
+
export declare const COMMON_URL = "http://luna.internal";
|
|
51
|
+
export declare const HIDDEN = "hidden";
|
|
52
|
+
export declare const TYPE = "type";
|
|
53
|
+
export declare const TIMEZONE_REGIONS: Record<string, string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Date as DateField, DateFormat, Time, TimeFormat, TimezoneGroup } from '../type';
|
|
2
|
+
export declare function getMonth(): {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare function getWeekDays(): {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
export declare function getYear(min: number, max: number): Array<{
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function getCurrentYear(): number;
|
|
15
|
+
export declare function getUserTimezone(): string;
|
|
16
|
+
export declare function getTimezones(): TimezoneGroup[];
|
|
17
|
+
export declare function getConvert(value: string | number, current?: number): number;
|
|
18
|
+
export declare function toNativeDate(value: string, fromFormat: DateFormat): string;
|
|
19
|
+
export declare function toNativeTime(value: string, fromFormat: TimeFormat): string;
|
|
20
|
+
export declare function fromNativeTime(native: string, toFormat?: TimeFormat): string;
|
|
21
|
+
export declare function fromNativeDate(native: string, toFormat?: DateFormat): string;
|
|
22
|
+
export declare function getTimeFormat(field: Time): TimeFormat;
|
|
23
|
+
export declare function getDateFormat(field: DateField): DateFormat;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Nullable, Option, Value } from '../type';
|
|
2
|
+
export declare function getEntity<T>(selected: string, collection?: Nullable<T[]>, entity?: string): NonNullable<T> | {
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function getCurrentValue<T>(value: T, entity?: string): Value | undefined;
|
|
6
|
+
export declare function getValue<T>(value: Record<string, T>, namespace?: string): T | undefined;
|
|
7
|
+
export declare function getArray<T>(value: Record<string, T> | T[], namespace?: string): Nullable<T[]>;
|
|
8
|
+
export declare function extract<T>(value: Record<string, T>, namespace?: string): T | null;
|
|
9
|
+
export declare function toOptions<T>(data: T[], options?: Option): (T | {
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
})[];
|
|
14
|
+
export declare function getType(value?: string): string;
|
|
15
|
+
export declare function getFormData(formData: FormData): Record<string, unknown>;
|
|
16
|
+
export declare function unflatten(data: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type FormatContext = {
|
|
2
|
+
locale?: string;
|
|
3
|
+
};
|
|
4
|
+
export type FormatFilter = (value: unknown, args: string[], ctx: FormatContext) => string;
|
|
5
|
+
export declare const formatFilters: Record<string, FormatFilter>;
|
|
6
|
+
export declare function applyFormatFilter(value: unknown, expression: string, ctx: FormatContext): string | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Chips, Column, Field, Input, List, Nullable, Select, Time } from '../type';
|
|
2
|
+
export declare const isSelectActive: (field: Field) => boolean;
|
|
3
|
+
export declare const isSelectDay: (field: Field) => boolean;
|
|
4
|
+
export declare const isSelectMonth: (field: Field) => boolean;
|
|
5
|
+
export declare const isSelectYear: (field: Field) => boolean;
|
|
6
|
+
export declare const isSelectTimezone: (field: Field) => boolean;
|
|
7
|
+
export declare const isChipsDays: (field: Field) => boolean;
|
|
8
|
+
export declare const isChipsMonths: (field: Field) => boolean;
|
|
9
|
+
export declare const isDate: (field: Field) => field is Field;
|
|
10
|
+
export declare const isTime: (field: Field) => field is Time;
|
|
11
|
+
export declare const isCheckbox: (field: Field) => field is Input;
|
|
12
|
+
export declare const isChips: (field: Field) => field is Chips;
|
|
13
|
+
export declare const isRadio: (field: Field) => field is Select;
|
|
14
|
+
export declare const isInput: (field: Field) => field is Input;
|
|
15
|
+
export declare const isSelect: (field: Field) => field is Select;
|
|
16
|
+
export declare const isTextArea: (field: Field) => field is Input;
|
|
17
|
+
export declare const isText: (field: Field) => field is Input;
|
|
18
|
+
export declare const isEmail: (field: Field) => field is Input;
|
|
19
|
+
export declare const isNumber: (field: Field) => field is Input;
|
|
20
|
+
export declare function isClickable(field: Field): boolean;
|
|
21
|
+
export declare function isList(slot: Field | Column | List): slot is List;
|
|
22
|
+
export declare function isColumn(slot: Field | Column | List): slot is Column;
|
|
23
|
+
export declare function isField(slot: Field | Column | List): slot is Field;
|
|
24
|
+
export declare function isOptions(field: Field): field is Select;
|
|
25
|
+
export declare function isTextable(field: Field): boolean;
|
|
26
|
+
export declare function isValidValue<T>(value?: Nullable<T>): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DataSource, Value } from '../type';
|
|
2
|
+
export declare function isObject<T>(value: unknown): value is Record<string, T>;
|
|
3
|
+
export declare function isEmpty(value: unknown): boolean;
|
|
4
|
+
export declare function isValue(value: unknown): value is Value;
|
|
5
|
+
export declare function isString(value: unknown): value is string;
|
|
6
|
+
export declare function isDataSource(value: unknown): value is DataSource;
|
|
7
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Column, Field, List, Nullable } from '../type';
|
|
2
|
+
export declare function isMultiFieldList(list: List): boolean;
|
|
3
|
+
export declare function getInitialList(list: List, value?: Nullable<Record<string, unknown>>): number[];
|
|
4
|
+
export declare function getLabel(list: List): string;
|
|
5
|
+
export declare function flattenListFields(fields: Array<Field | Column>): Record<string, Field>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const operators: Record<string, (current: unknown, value: unknown) => boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveTarget(target: string, name: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Definition, Filterable, Nullable } from '../type';
|
|
2
|
+
export declare function prepare<T extends Filterable>(base?: readonly T[], definition?: Definition): any[];
|
|
3
|
+
export declare function resolveRefs(base: unknown, definition?: Definition, cache?: Map<object, unknown>, visited?: WeakSet<object>): unknown;
|
|
4
|
+
export declare function entries<T>(values?: Nullable<Record<string, T>>): [key: string, value: T][];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CustomValidation, Definition, Field, Input, Schemas, Sections, ZodSchema } from '../type';
|
|
3
|
+
export declare function buildSchema(schemas: Schemas, fields?: Field[], translations?: Record<string, string>): ZodSchema;
|
|
4
|
+
export declare function flatten(error: z.ZodError<Record<string, unknown>>): Record<string, string[]>;
|
|
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>> | z.ZodNullable<z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodEmail>, z.ZodLiteral<"">]>>;
|
|
7
|
+
export declare function getBoolean(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodPreprocess<z.ZodCoercedBoolean<unknown>>> | z.ZodNullable<z.ZodPreprocess<z.ZodCoercedBoolean<unknown>>>;
|
|
8
|
+
export declare function getRadio(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodCoercedString<unknown>> | z.ZodNullable<z.ZodUnion<[z.ZodCoercedString<unknown>, z.ZodLiteral<"">]>>;
|
|
9
|
+
export declare function getText(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodCoercedString<unknown>> | z.ZodNullable<z.ZodCoercedString<unknown>>;
|
|
10
|
+
export declare function getNumber(input: Input, translations?: Record<string, string>): z.ZodNullable<z.ZodCoercedNumber<unknown>> | z.ZodPreprocess<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
export declare function getYearSchema(input: Input, translations?: Record<string, string>): z.ZodNullable<z.ZodCoercedNumber<unknown>> | z.ZodPreprocess<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
export declare function getMonthSchema(input: Input, translations?: Record<string, string>): z.ZodCoercedNumber<unknown> | z.ZodNullable<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
export declare function applyCustomValidation(schema: ZodSchema, fields?: Field[], translations?: Record<string, string>): ZodSchema;
|
|
14
|
+
export declare function validateCustom(value: unknown, rules: CustomValidation | Array<CustomValidation>, getValue: (name: string) => unknown, translations?: Record<string, string>): string[];
|
|
15
|
+
export declare function getArraySchema(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodArray<z.ZodString>>;
|
|
16
|
+
export declare function buildFormSchema(sections: Sections, translations?: Record<string, string>, definition?: Definition): z.ZodType;
|
|
17
|
+
export declare function collectIssues(error: z.ZodError): Array<{
|
|
18
|
+
path: string;
|
|
19
|
+
message: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function applyDeclarativeRules<T extends z.ZodType>(schema: T, fields?: Field[], translations?: Record<string, string>): T;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type InterpolateOptions = {
|
|
2
|
+
locale?: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Replaces placeholders in the format {key} with values from the provided object.
|
|
6
|
+
* Supports nested objects using dot notation (e.g., {user.id}) and pipe filters
|
|
7
|
+
* (e.g., {price | currency:USD}).
|
|
8
|
+
*/
|
|
9
|
+
export declare function interpolate<T>(template: T, values?: Record<string, unknown>, options?: InterpolateOptions): T;
|
|
10
|
+
export declare function interpolateIfNeeded<T>(template: T, values?: Record<string, unknown>, options?: InterpolateOptions): T;
|
|
11
|
+
export declare function isInterpolated(template: unknown): boolean;
|
|
12
|
+
export declare function formatMarkdown<K>(text?: string, callback?: (index: number, url: string, text?: string) => K): (string | K)[] | string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stringify<T>(body: T): string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function translate(key?: string, dictionary?: Record<string, string>): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RemotePattern } from '../type';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a URL against a list of allowed remote patterns.
|
|
4
|
+
* Internal URLs are allowed by default.
|
|
5
|
+
* If patterns is undefined, all URLs are allowed.
|
|
6
|
+
* If patterns is an empty array, all external URLs are blocked.
|
|
7
|
+
*/
|
|
8
|
+
export declare function matchRemotePattern(urlStr: string, patterns?: RemotePattern[]): boolean;
|
|
9
|
+
export declare function isExternalUrl(url: string): boolean;
|
|
10
|
+
export declare function mergeUrl(baseUrl: string, targetUrl: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { List, Nullable, PreviewItem } from '
|
|
1
|
+
import type { List, Nullable, PreviewItem } from '../../../../../luna-core/index';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
export declare function FieldListPreviewItem({ canRemove, children, field, index, isMultiField, itemKey, label, onRemove, previewBadge, previewLabel, previewTags, translations, value, }: {
|
|
4
4
|
canRemove: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Option } from '
|
|
1
|
+
import { type Option } from '../../../../../luna-core/index';
|
|
2
2
|
export declare function FieldPreviewItem({ className, initialValue, name, options, separator, staticLabel, }: Readonly<{
|
|
3
3
|
className?: string;
|
|
4
4
|
initialValue?: unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Column, Field, PreviewItem } from '
|
|
1
|
+
import type { Column, Field, PreviewItem } from '../../../../../luna-core/index';
|
|
2
2
|
export declare function FieldPreview({ className, fields, label, name, previews, translations, value, }: Readonly<{
|
|
3
3
|
className?: string;
|
|
4
4
|
fields?: Array<Field | Column>;
|
|
@@ -2,6 +2,6 @@ export declare const Field: (props: Readonly<Readonly<Readonly<{
|
|
|
2
2
|
children: import("../../../type").Children;
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
errors?: Record<string, string[]>;
|
|
5
|
-
field: import(
|
|
6
|
-
style?: import(
|
|
5
|
+
field: import('../../../../../luna-core/index').Field;
|
|
6
|
+
style?: import('../../../../../luna-core/index').Style;
|
|
7
7
|
}>>>) => import("react").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FormState } from '../hook/use-form-action';
|
|
2
2
|
import type { Config, Control } from '../../type';
|
|
3
|
-
import type { Definition, Nullable, Sections, ZodSchema } from '
|
|
3
|
+
import type { Definition, Nullable, Sections, ZodSchema } from '../../../../luna-core/index';
|
|
4
4
|
export declare function FormContent<T extends Record<string, unknown> = Record<string, unknown>, F = Record<string, unknown>>(props: Readonly<{
|
|
5
5
|
advanced?: {
|
|
6
6
|
step?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config, Control } from '../../type';
|
|
2
|
-
import type { Definition, Nullable, Sections, ZodSchema } from '
|
|
2
|
+
import type { Definition, Nullable, Sections, ZodSchema } from '../../../../luna-core/index';
|
|
3
3
|
import type { FormState } from '../hook/use-form-action';
|
|
4
4
|
export declare function Form<T extends Record<string, unknown> = Record<string, unknown>, F = Record<string, unknown>>(props: Readonly<{
|
|
5
5
|
advanced?: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Field } from '
|
|
1
|
+
import type { Field } from '../../../../luna-core/index';
|
|
2
2
|
export declare function isEmptySelectChange(field: Field, inputValue: string): boolean;
|
|
3
3
|
export declare const InputSelectable: (props: import("../hook/use-input-core").InputCoreProps) => import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config } from '../../type';
|
|
2
|
-
import type { DataSource, Field, Nullable } from '
|
|
2
|
+
import type { DataSource, Field, Nullable } from '../../../../luna-core/index';
|
|
3
3
|
export type InputStrategies = Readonly<{
|
|
4
4
|
useSource: (field: Field, config: Config, value?: Nullable<Record<string, unknown>>) => {
|
|
5
5
|
data: Nullable<unknown[]>;
|
|
@@ -3,12 +3,12 @@ export declare const Slot: (props: Readonly<{
|
|
|
3
3
|
config: import("../../../type").Config;
|
|
4
4
|
context?: Record<string, unknown>;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
fields?: import(
|
|
6
|
+
fields?: import('../../../../../luna-core/index').Fields;
|
|
7
7
|
onValueChange?: (input: {
|
|
8
8
|
name: string;
|
|
9
9
|
value: unknown;
|
|
10
10
|
}) => void;
|
|
11
|
-
style?: import(
|
|
11
|
+
style?: import('../../../../../luna-core/index').Style;
|
|
12
12
|
translations?: Record<string, string>;
|
|
13
|
-
value?: import(
|
|
13
|
+
value?: import('../../../../../luna-core/index').Nullable<Record<string, unknown>>;
|
|
14
14
|
}>) => import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type Field, type Nullable } from '
|
|
1
|
+
import { type Field, type Nullable } from '../../../../luna-core/index';
|
|
2
2
|
import type { Config } from '../../type';
|
|
3
|
-
export declare function useDataSource(field: Field, config: Config, value?: Nullable<Record<string, unknown>>): readonly [Nullable<unknown[]>, (target: string, value: import(
|
|
3
|
+
export declare function useDataSource(field: Field, config: Config, value?: Nullable<Record<string, unknown>>): readonly [Nullable<unknown[]>, (target: string, value: import('../../../../luna-core/index').DataSource | undefined) => void];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type DataSource, type Nullable } from '
|
|
1
|
+
import { type DataSource, type Nullable } from '../../../../luna-core/index';
|
|
2
2
|
import type { Config } from '../../type';
|
|
3
3
|
export declare function useFetch<T>(dataSource: Nullable<DataSource | T[]> | undefined, config: Config, disabled?: boolean): Nullable<T[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type List, type Nullable } from '
|
|
1
|
+
import { type List, type Nullable } from '../../../../luna-core/index';
|
|
2
2
|
import { type TranslateListPath } from '../context/list-path-context';
|
|
3
3
|
export declare function useFieldList(field: List, value?: Nullable<Record<string, unknown>>, onValueChange?: (input: {
|
|
4
4
|
name: string;
|