react-luna-form 0.0.3 → 0.0.5
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/config/cjs/index.js +1 -1
- package/dist/config/esm/index.js +1 -1
- package/dist/server/cjs/index.js +1 -1
- package/dist/server/esm/index.js +1 -1
- package/dist/types/{config → luna-core/src}/fetcher.d.ts +1 -1
- package/dist/types/luna-core/src/handle/proxy-event.d.ts +5 -0
- package/dist/types/luna-core/src/handle/source-event.d.ts +2 -0
- package/dist/types/luna-core/src/handle/value-event.d.ts +2 -0
- package/dist/types/luna-core/src/helper/input.d.ts +41 -0
- package/dist/types/luna-core/src/index.d.ts +19 -0
- package/dist/types/luna-core/src/type.d.ts +145 -0
- package/dist/types/luna-core/src/util/build.d.ts +5 -0
- package/dist/types/{util → luna-core/src/util}/constant.d.ts +19 -4
- package/dist/types/luna-core/src/util/extract.d.ts +14 -0
- package/dist/types/luna-core/src/util/is-input.d.ts +17 -0
- package/dist/types/luna-core/src/util/is-type.d.ts +6 -0
- package/dist/types/luna-core/src/util/prepare.d.ts +4 -0
- package/dist/types/luna-core/src/util/schema.d.ts +14 -0
- package/dist/types/luna-core/src/util/source.d.ts +2 -0
- package/dist/types/luna-core/src/util/string.d.ts +7 -0
- package/dist/types/luna-core/src/util/stringify.d.ts +1 -0
- package/dist/types/luna-core/src/util/url.d.ts +10 -0
- package/dist/types/luna-react/src/client/component/form.d.ts +14 -0
- package/dist/types/{client → luna-react/src/client}/component/input.d.ts +4 -5
- package/dist/types/{component/slot → luna-react/src/client/component}/slot.d.ts +2 -1
- package/dist/types/{client/component/wrapper/field.d.ts → luna-react/src/client/component/wrapper/index.d.ts} +1 -2
- package/dist/types/luna-react/src/client/hook/use-data-source.d.ts +3 -0
- package/dist/types/luna-react/src/client/hook/use-fetch.d.ts +3 -0
- package/dist/types/luna-react/src/client/hook/use-form-action.d.ts +14 -0
- package/dist/types/{client/hook/useInput.d.ts → luna-react/src/client/hook/use-input.d.ts} +1 -1
- package/dist/types/{client/hook/useSchema.d.ts → luna-react/src/client/hook/use-schema.d.ts} +1 -1
- package/dist/types/luna-react/src/client/hook/use-store.d.ts +1 -0
- package/dist/types/luna-react/src/client/hook/use-timeout.d.ts +1 -0
- package/dist/types/{client → luna-react/src/client}/index.d.ts +1 -1
- package/dist/types/luna-react/src/client/lib/error-store.d.ts +10 -0
- package/dist/types/luna-react/src/client/lib/source-store.d.ts +8 -0
- package/dist/types/luna-react/src/client/lib/store-helper.d.ts +21 -0
- package/dist/types/luna-react/src/client/lib/value-store.d.ts +13 -0
- package/dist/types/{component → luna-react/src/component}/column.d.ts +2 -3
- package/dist/types/{component → luna-react/src/component}/description.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-base.d.ts +10 -0
- package/dist/types/{component → luna-react/src/component/field}/field-error.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-group.d.ts +8 -0
- package/dist/types/luna-react/src/component/field/field-horizontal.d.ts +6 -0
- package/dist/types/{component → luna-react/src/component/field}/field-set.d.ts +2 -2
- package/dist/types/luna-react/src/component/field/field-vertical.d.ts +6 -0
- package/dist/types/{component → luna-react/src/component/field}/field.d.ts +2 -2
- package/dist/types/{component → luna-react/src/component}/form.d.ts +4 -1
- package/dist/types/luna-react/src/component/formatted-description.d.ts +3 -0
- package/dist/types/{component → luna-react/src/component}/group.d.ts +1 -0
- package/dist/types/{component → luna-react/src/component}/input/input-attributes.d.ts +1 -1
- package/dist/types/{component → luna-react/src/component}/input/input-base.d.ts +2 -2
- package/dist/types/{component → luna-react/src/component}/input/input-common.d.ts +1 -1
- package/dist/types/{component → luna-react/src/component}/input/input-option-select.d.ts +1 -1
- package/dist/types/luna-react/src/component/input-group.d.ts +5 -0
- package/dist/types/luna-react/src/component/input-label.d.ts +5 -0
- package/dist/types/{component → luna-react/src/component}/label.d.ts +2 -2
- package/dist/types/{component → luna-react/src/component}/slot/slot-base.d.ts +3 -3
- package/dist/types/{client/component → luna-react/src/component/slot}/slot.d.ts +2 -2
- package/dist/types/luna-react/src/config/index.d.ts +28 -0
- package/dist/types/luna-react/src/lib/render-If-exists.d.ts +1 -0
- package/dist/types/luna-react/src/lib/string.d.ts +1 -0
- package/dist/types/{server → luna-react/src/server}/component/fallback.d.ts +2 -1
- package/dist/types/{client → luna-react/src/server}/component/form.d.ts +3 -2
- package/dist/types/{server → luna-react/src/server}/component/input.d.ts +3 -2
- package/dist/types/{server → luna-react/src/server}/index.d.ts +1 -1
- package/dist/types/luna-react/src/type.d.ts +16 -0
- package/package.json +6 -4
- package/dist/types/client/component/wrapper/column.d.ts +0 -5
- package/dist/types/client/hook/useDataSource.d.ts +0 -2
- package/dist/types/client/hook/useFormAction.d.ts +0 -2
- package/dist/types/client/lib/error-store.d.ts +0 -7
- package/dist/types/config/index.d.ts +0 -9
- package/dist/types/server/component/form.d.ts +0 -9
- package/dist/types/type.d.ts +0 -114
- package/dist/types/util/build.d.ts +0 -4
- package/dist/types/util/extract.d.ts +0 -5
- package/dist/types/util/helper/input.d.ts +0 -11
- package/dist/types/util/is-input.d.ts +0 -14
- package/dist/types/util/is-type.d.ts +0 -3
- package/dist/types/util/prepare.d.ts +0 -3
- package/dist/types/util/schema.d.ts +0 -12
- /package/dist/types/{util → luna-core/src/util}/attributes.d.ts +0 -0
- /package/dist/types/{util → luna-core/src/util}/column.d.ts +0 -0
- /package/dist/types/{util → luna-core/src/util}/date.d.ts +0 -0
- /package/dist/types/{client → luna-react/src/client}/component/wrapper/with-error.d.ts +0 -0
- /package/dist/types/{component → luna-react/src/component}/control.d.ts +0 -0
- /package/dist/types/{component → luna-react/src/component}/legend.d.ts +0 -0
- /package/dist/types/{component → luna-react/src/component}/separator.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-luna-form",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A React library for building forms based on JSON
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "A React library for building forms based on JSON",
|
|
5
5
|
"main": "./dist/client/cjs/index.js",
|
|
6
6
|
"module": "./dist/client/esm/index.js",
|
|
7
7
|
"types": "./dist/types/client/index.d.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
+
"fast-equals": "^6.0.0",
|
|
20
21
|
"jotai": "^2.0.0",
|
|
21
22
|
"jotai-family": "^1.0.0",
|
|
22
23
|
"react": "^18.2.0 || ^19.0.0",
|
|
@@ -26,11 +27,12 @@
|
|
|
26
27
|
"zod": "^4.0.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@types/react": "19.2.
|
|
30
|
+
"@types/react": "19.2.8",
|
|
30
31
|
"@types/react-dom": "19.2.3",
|
|
31
32
|
"eslint-plugin-react": "7.37.5",
|
|
32
33
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
33
|
-
"eslint-plugin-react-refresh": "0.4.
|
|
34
|
+
"eslint-plugin-react-refresh": "0.4.26",
|
|
35
|
+
"@luna-form/core": "0.0.5"
|
|
34
36
|
},
|
|
35
37
|
"license": "Apache-2.0",
|
|
36
38
|
"repository": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const inputErrorAtom: import("jotai").PrimitiveAtom<Record<string, string[]>> & {
|
|
2
|
-
init: Record<string, string[]>;
|
|
3
|
-
};
|
|
4
|
-
export declare const reportInputErrorAtom: import("jotai-family").AtomFamily<string, import("jotai").WritableAtom<string[], [errors: string[]], void>>;
|
|
5
|
-
export declare const reportErrorAtom: import("jotai").WritableAtom<null, [error: Record<string, string[]>], void> & {
|
|
6
|
-
init: null;
|
|
7
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Config, DataSource, Environment, InputConfig } from '../type';
|
|
2
|
-
export declare function defineConfig<T extends React.ElementType>(options: Readonly<{
|
|
3
|
-
env?: Environment;
|
|
4
|
-
fetcher?: <T>(dataSource: DataSource) => Promise<T>;
|
|
5
|
-
inputs: Array<InputConfig<T>>;
|
|
6
|
-
}>): Config;
|
|
7
|
-
export declare function defineInput<T extends React.ElementType>(input: React.ComponentProps<T>): InputConfig<T>;
|
|
8
|
-
export declare function defineTextArea<T extends React.ElementType>(input: React.ComponentProps<T>): InputConfig<T>;
|
|
9
|
-
export declare function defineSelect<T extends React.ElementType>(input: React.ComponentProps<T>): InputConfig<T>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Sections, Config, Source } from '../../type';
|
|
2
|
-
export declare function Form(props: Readonly<{
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
config: Config;
|
|
5
|
-
readOnly?: boolean;
|
|
6
|
-
sections: Sections;
|
|
7
|
-
source?: Source;
|
|
8
|
-
value?: Record<string, unknown>;
|
|
9
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
package/dist/types/type.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
export type Nullable<T> = T | null;
|
|
3
|
-
export type Orderable = {
|
|
4
|
-
order?: number;
|
|
5
|
-
};
|
|
6
|
-
export type Hideable = {
|
|
7
|
-
hidden?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type Sections = Section[];
|
|
10
|
-
export type Value = string | number | readonly string[];
|
|
11
|
-
export type Fields = Array<Field | Column<Field>>;
|
|
12
|
-
export type Base = Orderable & Hideable;
|
|
13
|
-
export type Section = {
|
|
14
|
-
description?: string;
|
|
15
|
-
fields?: Fields;
|
|
16
|
-
separator?: boolean;
|
|
17
|
-
title?: string;
|
|
18
|
-
} & Base;
|
|
19
|
-
export type DataSource = {
|
|
20
|
-
url: string;
|
|
21
|
-
body?: BodyInit | Record<string, unknown>;
|
|
22
|
-
cache?: RequestCache;
|
|
23
|
-
headers?: HeadersInit;
|
|
24
|
-
method?: string;
|
|
25
|
-
namespace?: string;
|
|
26
|
-
};
|
|
27
|
-
export type Source = {
|
|
28
|
-
[key: string]: DataSource | Array<unknown>;
|
|
29
|
-
};
|
|
30
|
-
export type Column<T> = {
|
|
31
|
-
advanced?: {
|
|
32
|
-
cols?: number;
|
|
33
|
-
};
|
|
34
|
-
fields?: T[];
|
|
35
|
-
type: 'column';
|
|
36
|
-
} & Base;
|
|
37
|
-
export type DataAttributes = {
|
|
38
|
-
[key: `data-${string}`]: string | number | boolean;
|
|
39
|
-
};
|
|
40
|
-
export type AriaAttributes = {
|
|
41
|
-
[key: `aria-${string}`]: string | number | boolean;
|
|
42
|
-
};
|
|
43
|
-
export type CommonProps = {
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
id?: string;
|
|
46
|
-
name?: string;
|
|
47
|
-
placeholder?: string;
|
|
48
|
-
required?: boolean;
|
|
49
|
-
};
|
|
50
|
-
export type Field = CommonProps & {
|
|
51
|
-
advanced?: {
|
|
52
|
-
aria?: AriaAttributes;
|
|
53
|
-
cols?: number;
|
|
54
|
-
data?: DataAttributes;
|
|
55
|
-
};
|
|
56
|
-
description?: string;
|
|
57
|
-
fields?: never;
|
|
58
|
-
label?: string;
|
|
59
|
-
name: string;
|
|
60
|
-
readonly?: boolean;
|
|
61
|
-
type: string;
|
|
62
|
-
validation?: {
|
|
63
|
-
required?: string;
|
|
64
|
-
length?: {
|
|
65
|
-
max?: string;
|
|
66
|
-
min?: string;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
} & Base;
|
|
70
|
-
export type Input = Field & {
|
|
71
|
-
advanced?: {
|
|
72
|
-
autocomplete?: string;
|
|
73
|
-
length?: {
|
|
74
|
-
max?: number;
|
|
75
|
-
min?: number;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
export type Select = Field & {
|
|
80
|
-
advanced?: {
|
|
81
|
-
length?: {
|
|
82
|
-
min?: number | string;
|
|
83
|
-
max?: number | string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
export type Slot = (props: {
|
|
88
|
-
disabled?: boolean;
|
|
89
|
-
fields?: Fields;
|
|
90
|
-
withinColumn?: boolean;
|
|
91
|
-
}) => React.ReactNode;
|
|
92
|
-
export type Children = (props: {
|
|
93
|
-
ariaAttributes?: AriaAttributes;
|
|
94
|
-
commonProps: CommonProps;
|
|
95
|
-
dataAttributes?: DataAttributes;
|
|
96
|
-
field: Field;
|
|
97
|
-
withinColumn?: boolean;
|
|
98
|
-
}) => React.ReactNode;
|
|
99
|
-
export type Schema = z.ZodTypeAny;
|
|
100
|
-
export type Schemas = Record<string, Schema>;
|
|
101
|
-
export type Environment = {
|
|
102
|
-
[key: string]: Value;
|
|
103
|
-
};
|
|
104
|
-
export type InputConfig<T extends React.ElementType> = {
|
|
105
|
-
types: string | string[];
|
|
106
|
-
input: React.ComponentProps<T>;
|
|
107
|
-
};
|
|
108
|
-
export type Config = {
|
|
109
|
-
env?: Environment;
|
|
110
|
-
inputs: {
|
|
111
|
-
[key: string]: React.ComponentProps<React.ElementType>;
|
|
112
|
-
};
|
|
113
|
-
fetcher: <T>(dataSource: DataSource) => Promise<T>;
|
|
114
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Field, Source } from '../type';
|
|
2
|
-
export declare function buildOptions(field: Field, values?: Record<string, unknown>): Record<string, unknown>[] | undefined;
|
|
3
|
-
export declare function buildSource(field: Field, source?: Source): import("../type").DataSource | unknown[] | undefined;
|
|
4
|
-
export declare function buildFormData(form: Record<string, unknown>): FormData;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Nullable, Value } from '../type';
|
|
2
|
-
export declare function getCurrentValue<T>(value: T, entity?: string): Value | undefined;
|
|
3
|
-
export declare function getValue<T>(value: Record<string, T>, namespace?: string): T | undefined;
|
|
4
|
-
export declare function getArray<T>(value: Record<string, T> | T[], namespace?: string): Nullable<T[]>;
|
|
5
|
-
export declare function extract<T>(value: Record<string, T>, namespace?: string): T | null;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CommonProps, DataSource, Field, Nullable, Source } from '../../type';
|
|
2
|
-
export declare function resolveSource(field: Field, value?: Record<string, unknown>, source?: Source): DataSource | unknown[] | undefined;
|
|
3
|
-
export declare function getValue(field: Field, value?: Record<string, unknown>): import("../../type").Value | undefined;
|
|
4
|
-
export declare function mergeCommonProps(field: Field, commonProps: CommonProps, options?: Nullable<DataSource | unknown[]>): CommonProps | {
|
|
5
|
-
options: unknown[];
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
id?: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Column, Field, Input, Select } from '../type';
|
|
2
|
-
export declare function isSelectMonth(field: Field): boolean;
|
|
3
|
-
export declare function isSelectYear(field: Field): boolean;
|
|
4
|
-
export declare function isOptions(field: Field): field is Input;
|
|
5
|
-
export declare const isInput: (field: Field) => field is Input;
|
|
6
|
-
export declare const isRadio: (field: Field) => field is Select;
|
|
7
|
-
export declare const isSelect: (field: Field) => field is Select;
|
|
8
|
-
export declare function isColumn(slot: Field | Column<Field>): slot is Column<Field>;
|
|
9
|
-
export declare function isField(slot: Field | Column<Field>): slot is Field;
|
|
10
|
-
export declare function isTextArea(field: Field): field is Input;
|
|
11
|
-
export declare function isText(field: Field): field is Input;
|
|
12
|
-
export declare function isNumber(field: Field): field is Input;
|
|
13
|
-
export declare function isEmail(field: Field): field is Input;
|
|
14
|
-
export declare function getType(value?: string): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Input, Schemas } from '../type';
|
|
3
|
-
export declare function buildSchema(schemas: Schemas): z.ZodObject<{
|
|
4
|
-
[x: string]: import("../type").Schema;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
export declare function flatten(error: z.ZodError<Record<string, unknown>>): Record<string, string[]>;
|
|
7
|
-
export declare function getSchema(input: Input): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
8
|
-
export declare function getEmail(input: Input): z.ZodEmail | z.ZodNullable<z.ZodUnion<[z.ZodEmail, z.ZodLiteral<"">]>>;
|
|
9
|
-
export declare function getText(input: Input): z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodCoercedString<unknown>> | z.ZodNullable<z.ZodCoercedString<unknown>>;
|
|
10
|
-
export declare function getNumber(input: Input): z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodCoercedNumber<unknown>> | z.ZodNullable<z.ZodCoercedNumber<unknown>>;
|
|
11
|
-
export declare function getYear(input: Input): z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodCoercedNumber<unknown>> | z.ZodNullable<z.ZodCoercedNumber<unknown>>;
|
|
12
|
-
export declare function getMonth(input: Input): z.ZodCoercedNumber<unknown> | z.ZodNullable<z.ZodCoercedNumber<unknown>>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|