react-luna-form 0.0.32 → 0.0.33
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/client/component/field/field-list.d.ts +2 -0
- package/dist/types/client/component/field/field-with-state.d.ts +13 -0
- package/dist/types/client/component/field/field.d.ts +7 -0
- package/dist/types/client/component/form-content.d.ts +20 -0
- package/dist/types/client/component/form.d.ts +20 -0
- package/dist/types/client/component/guard/list-guard.d.ts +2 -0
- package/dist/types/client/component/guard/visibility-guard.d.ts +6 -0
- package/dist/types/client/component/input.d.ts +16 -0
- package/dist/types/client/component/slot/slot.d.ts +7 -0
- package/dist/types/client/hook/use-data-source.d.ts +3 -0
- package/dist/types/client/hook/use-fetch.d.ts +3 -0
- package/dist/types/client/hook/use-field-list.d.ts +2 -0
- package/dist/types/client/hook/use-form-action.d.ts +13 -0
- package/dist/types/client/hook/use-input.d.ts +2 -0
- package/dist/types/client/hook/use-schema.d.ts +2 -0
- package/dist/types/client/hook/use-store.d.ts +1 -0
- package/dist/types/client/hook/use-timeout.d.ts +1 -0
- package/dist/types/client/hook/use-value.d.ts +6 -0
- package/dist/types/client/index.d.ts +3 -0
- package/dist/types/client/lib/error-store.d.ts +7 -0
- package/dist/types/client/lib/source-store.d.ts +5 -0
- package/dist/types/client/lib/state-store.d.ts +5 -0
- package/dist/types/client/lib/store-helper.d.ts +26 -0
- package/dist/types/client/lib/value-store.d.ts +10 -0
- package/dist/types/component/chevron-icon.d.ts +3 -0
- package/dist/types/component/column.d.ts +5 -0
- package/dist/types/component/control.d.ts +5 -0
- package/dist/types/component/description.d.ts +3 -0
- package/dist/types/component/field/field-base.d.ts +12 -0
- package/dist/types/component/field/field-error.d.ts +5 -0
- package/dist/types/component/field/field-group.d.ts +8 -0
- package/dist/types/component/field/field-horizontal.d.ts +2 -0
- package/dist/types/component/field/field-list-item.d.ts +8 -0
- package/dist/types/component/field/field-list.d.ts +7 -0
- package/dist/types/component/field/field-set-advanced.d.ts +5 -0
- package/dist/types/component/field/field-set-base.d.ts +7 -0
- package/dist/types/component/field/field-set.d.ts +6 -0
- package/dist/types/component/field/field-vertical.d.ts +2 -0
- package/dist/types/component/field/field.d.ts +10 -0
- package/dist/types/component/form.d.ts +13 -0
- package/dist/types/component/formatted-description.d.ts +7 -0
- package/dist/types/component/group.d.ts +4 -0
- package/dist/types/component/input/input-base.d.ts +9 -0
- package/dist/types/component/input-group.d.ts +10 -0
- package/dist/types/component/input-label.d.ts +9 -0
- package/dist/types/component/label.d.ts +7 -0
- package/dist/types/component/legend.d.ts +4 -0
- package/dist/types/component/list.d.ts +5 -0
- package/dist/types/component/separator.d.ts +1 -0
- package/dist/types/component/slot/list-slot.d.ts +2 -0
- package/dist/types/component/slot/slot-base.d.ts +16 -0
- package/dist/types/component/slot/slot-create.d.ts +10 -0
- package/dist/types/component/slot/slot-list.d.ts +12 -0
- package/dist/types/component/slot/slot.d.ts +7 -0
- package/dist/types/config/index.d.ts +31 -0
- package/dist/types/lib/render-If-exists.d.ts +1 -0
- package/dist/types/lib/string.d.ts +1 -0
- package/dist/types/luna-core/src/helper/input.d.ts +1 -0
- package/dist/types/luna-core/src/type.d.ts +1 -0
- package/dist/types/luna-core/src/util/constant.d.ts +1 -0
- package/dist/types/luna-core/src/util/extract.d.ts +1 -0
- package/dist/types/luna-core/src/util/is-input.d.ts +1 -1
- package/dist/types/server/component/fallback.d.ts +7 -0
- package/dist/types/server/component/form.d.ts +13 -0
- package/dist/types/server/component/input.d.ts +13 -0
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/type.d.ts +29 -0
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Environment, type Protocol } from '@luna-form/core';
|
|
2
|
+
import type { AlertProps, Config, InputConfig } from '../type';
|
|
3
|
+
export declare function defineConfig<T extends React.ElementType>(options: Readonly<{
|
|
4
|
+
alert?: React.ComponentType<AlertProps>;
|
|
5
|
+
env?: Environment;
|
|
6
|
+
fetcher?: {
|
|
7
|
+
remotePatterns?: Array<{
|
|
8
|
+
hostname?: string;
|
|
9
|
+
port?: number;
|
|
10
|
+
protocol?: Protocol;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
inputs: Array<InputConfig<T>>;
|
|
14
|
+
style?: {
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
horizontal?: boolean;
|
|
17
|
+
showOptionalLabel?: boolean;
|
|
18
|
+
};
|
|
19
|
+
validation?: {
|
|
20
|
+
blur?: boolean;
|
|
21
|
+
change?: boolean;
|
|
22
|
+
showError?: boolean;
|
|
23
|
+
submit?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}>): Config;
|
|
26
|
+
export declare const defineCheckbox: (input: any) => InputConfig<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
27
|
+
export declare const defineInput: (input: any) => InputConfig<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
28
|
+
export declare const defineRadio: (input: any) => InputConfig<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
29
|
+
export declare const defineSelect: (input: any) => InputConfig<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
30
|
+
export declare const defineTextArea: (input: any) => InputConfig<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
31
|
+
export declare function defineCustomInput<T extends React.ElementType>(types: string | string[], input: React.ComponentProps<T>): InputConfig<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderIfExists<T>(value: T | undefined | null, render: (value: T) => React.ReactNode): React.ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatMarkdown(text?: string): React.ReactNode;
|
|
@@ -16,6 +16,7 @@ export declare function mergeOptionsProps(field: Field, commonProps: CommonProps
|
|
|
16
16
|
};
|
|
17
17
|
export declare function getPreselectedValue(field: Field, commonProps: CommonProps, value?: Value): any;
|
|
18
18
|
export declare function getOptions<T>(field: Field, data?: Nullable<T[]>): (T | {
|
|
19
|
+
description?: string | undefined;
|
|
19
20
|
label: string;
|
|
20
21
|
value: string;
|
|
21
22
|
})[] | null | undefined;
|
|
@@ -15,6 +15,7 @@ export declare const SELECT_MONTH = "select/month";
|
|
|
15
15
|
export declare const SELECT_YEAR = "select/year";
|
|
16
16
|
export declare const SELECTS: string[];
|
|
17
17
|
export declare const COLUMN = "column";
|
|
18
|
+
export declare const DESCRIPTION = "description";
|
|
18
19
|
export declare const FIELDS = "fields";
|
|
19
20
|
export declare const LABEL = "label";
|
|
20
21
|
export declare const VALUE = "value";
|
|
@@ -7,6 +7,7 @@ export declare function getValue<T>(value: Record<string, T>, namespace?: string
|
|
|
7
7
|
export declare function getArray<T>(value: Record<string, T> | T[], namespace?: string): Nullable<T[]>;
|
|
8
8
|
export declare function extract<T>(value: Record<string, T>, namespace?: string): T | null;
|
|
9
9
|
export declare function toOptions<T>(data: T[], options?: Option): (T | {
|
|
10
|
+
description?: string | undefined;
|
|
10
11
|
label: string;
|
|
11
12
|
value: string;
|
|
12
13
|
})[];
|
|
@@ -13,6 +13,6 @@ export declare function isClickable(field: Field): boolean;
|
|
|
13
13
|
export declare function isList(slot: Field | Column | List): slot is List;
|
|
14
14
|
export declare function isColumn(slot: Field | Column | List): slot is Column;
|
|
15
15
|
export declare function isField(slot: Field | Column | List): slot is Field;
|
|
16
|
-
export declare function isOptions(field: Field): field is
|
|
16
|
+
export declare function isOptions(field: Field): field is Select;
|
|
17
17
|
export declare function isTextable(field: Field): boolean;
|
|
18
18
|
export declare function isValidValue<T>(value?: Nullable<T>): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Config } from '../../type';
|
|
2
|
+
import type { Definition, Sections } from '@luna-form/core';
|
|
3
|
+
export declare function Form(props: Readonly<{
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
config: Config;
|
|
6
|
+
context?: Record<string, unknown>;
|
|
7
|
+
definition?: Definition;
|
|
8
|
+
lang?: string;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
sections: Sections;
|
|
11
|
+
translations?: Record<string, Record<string, string>>;
|
|
12
|
+
value?: Record<string, unknown>;
|
|
13
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AriaAttributes, type CommonProps, type DataAttributes, type Field } from '@luna-form/core';
|
|
2
|
+
import type { Config } from '../../type';
|
|
3
|
+
export declare function Input(props: Readonly<{
|
|
4
|
+
ariaAttributes?: AriaAttributes;
|
|
5
|
+
commonProps: CommonProps;
|
|
6
|
+
config: Config;
|
|
7
|
+
context?: Record<string, unknown>;
|
|
8
|
+
dataAttributes?: DataAttributes;
|
|
9
|
+
field: Field;
|
|
10
|
+
horizontal?: boolean;
|
|
11
|
+
translations?: Record<string, string>;
|
|
12
|
+
value?: Record<string, unknown>;
|
|
13
|
+
}>): import("react").ReactNode;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AriaAttributes, BaseConfig, CommonProps, DataAttributes, Field, Fields, FormStateError } from '@luna-form/core';
|
|
2
|
+
export type Slot = (props: {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
fields?: Fields;
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
export type Control = ((props: {
|
|
7
|
+
isPending?: boolean;
|
|
8
|
+
}) => React.ReactNode) | React.ReactNode;
|
|
9
|
+
export type Children = (props: {
|
|
10
|
+
ariaAttributes?: AriaAttributes;
|
|
11
|
+
commonProps: CommonProps;
|
|
12
|
+
dataAttributes?: DataAttributes;
|
|
13
|
+
field: Field;
|
|
14
|
+
horizontal?: boolean;
|
|
15
|
+
}) => React.ReactNode;
|
|
16
|
+
export type InputConfig<T extends React.ElementType> = {
|
|
17
|
+
types: string | string[];
|
|
18
|
+
input: React.ComponentProps<T>;
|
|
19
|
+
};
|
|
20
|
+
export type AlertProps = Readonly<FormStateError>;
|
|
21
|
+
export type Config = BaseConfig<React.ComponentProps<React.ElementType>> & {
|
|
22
|
+
alert?: React.ComponentType<AlertProps>;
|
|
23
|
+
};
|
|
24
|
+
export type InputChange = {
|
|
25
|
+
data?: DataAttributes;
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-luna-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"eslint-plugin-react": "7.37.5",
|
|
34
34
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
35
35
|
"eslint-plugin-react-refresh": "0.5.2",
|
|
36
|
-
"@luna-form/core": "0.0.
|
|
36
|
+
"@luna-form/core": "0.0.33"
|
|
37
37
|
},
|
|
38
38
|
"license": "Apache-2.0",
|
|
39
39
|
"repository": {
|