react-luna-form 0.0.43 → 0.0.45

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.
Files changed (30) hide show
  1. package/dist/client/cjs/index.js +1 -1
  2. package/dist/client/esm/index.js +3366 -1
  3. package/dist/config/esm/index.js +227 -1
  4. package/dist/server/cjs/index.js +1 -1
  5. package/dist/server/esm/index.js +1799 -1
  6. package/dist/types/luna-react/src/client/component/field/field-preview-item.d.ts +4 -0
  7. package/dist/types/luna-react/src/client/component/field/field-preview.d.ts +4 -0
  8. package/dist/types/luna-react/src/client/component/form-content.d.ts +3 -0
  9. package/dist/types/luna-react/src/client/component/form.d.ts +3 -0
  10. package/dist/types/luna-react/src/client/component/slot/slot.d.ts +3 -0
  11. package/dist/types/luna-react/src/client/context/keep-value-context.d.ts +1 -0
  12. package/dist/types/luna-react/src/client/hook/use-input-core.d.ts +3 -1
  13. package/dist/types/luna-react/src/client/hook/use-input.d.ts +3 -1
  14. package/dist/types/luna-react/src/client/hook/use-schema.d.ts +3 -1
  15. package/dist/types/luna-react/src/client/hook/use-store.d.ts +3 -1
  16. package/dist/types/luna-react/src/client/lib/persistence-context.d.ts +4 -0
  17. package/dist/types/luna-react/src/component/collapsible.d.ts +4 -0
  18. package/dist/types/luna-react/src/component/column.d.ts +4 -0
  19. package/dist/types/luna-react/src/component/field/field-list-item.d.ts +3 -0
  20. package/dist/types/luna-react/src/component/field/field-set-base.d.ts +1 -0
  21. package/dist/types/luna-react/src/component/field/field-set.d.ts +4 -0
  22. package/dist/types/luna-react/src/component/form.d.ts +3 -0
  23. package/dist/types/luna-react/src/component/formatted-description.d.ts +2 -1
  24. package/dist/types/luna-react/src/component/legend.d.ts +2 -1
  25. package/dist/types/luna-react/src/component/slot/slot-base.d.ts +4 -1
  26. package/dist/types/luna-react/src/component/slot/slot-create.d.ts +4 -1
  27. package/dist/types/luna-react/src/component/slot/slot-list.d.ts +4 -1
  28. package/dist/types/luna-react/src/component/slot/slot.d.ts +3 -0
  29. package/dist/types/luna-react/src/server/component/form.d.ts +3 -0
  30. package/package.json +2 -2
@@ -0,0 +1,4 @@
1
+ export declare function FieldPreviewItem({ name, separator, }: Readonly<{
2
+ name: string;
3
+ separator?: boolean;
4
+ }>): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ export declare function FieldPreview({ name, previews, }: Readonly<{
2
+ name: string;
3
+ previews: string[];
4
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,9 @@ import { type FormState } from '../hook/use-form-action';
2
2
  import type { Config, Control } from '../../type';
3
3
  import type { Definition, Nullable, Sections, ZodSchema } from '@luna-form/core';
4
4
  export declare function FormContent<T extends Record<string, unknown> = Record<string, unknown>, F = Record<string, unknown>>(props: Readonly<{
5
+ advanced?: {
6
+ step?: boolean;
7
+ };
5
8
  action?: (formData: F, schema?: ZodSchema) => Promise<FormState<T>>;
6
9
  children?: Control;
7
10
  config: Config;
@@ -2,6 +2,9 @@ import type { Config, Control } from '../../type';
2
2
  import type { Definition, Nullable, Sections, ZodSchema } from '@luna-form/core';
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
+ advanced?: {
6
+ step?: boolean;
7
+ };
5
8
  action?: (formData: F, schema?: ZodSchema) => Promise<FormState<T>>;
6
9
  children?: Control;
7
10
  config: Config;
@@ -1,7 +1,10 @@
1
1
  export declare const Slot: (props: Readonly<{
2
2
  children: import("../../../type").Children;
3
+ config: import("../../../type").Config;
4
+ context?: Record<string, unknown>;
3
5
  disabled?: boolean;
4
6
  fields?: import("@luna-form/core").Fields;
5
7
  style?: import("@luna-form/core").Style;
8
+ translations?: Record<string, string>;
6
9
  value?: import("@luna-form/core").Nullable<Record<string, unknown>>;
7
10
  }>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const KeepValueContext: import("react").Context<boolean>;
@@ -9,7 +9,9 @@ export type InputCoreProps = Readonly<{
9
9
  field: Field;
10
10
  horizontal?: boolean;
11
11
  onMount: (name: string, schema: Schema, field: Field) => void;
12
- onUnmount: (name: string) => void;
12
+ onUnmount: (name: string, options?: {
13
+ keepValue?: boolean;
14
+ }) => void;
13
15
  onValueChange?: (input: InputChange) => void;
14
16
  translations?: Record<string, string>;
15
17
  value?: Nullable<Record<string, unknown>>;
@@ -1,2 +1,4 @@
1
1
  import type { Field, Schema } from '@luna-form/core';
2
- export declare function useInput(field: Field, onMount: (name: string, schema: Schema, field: Field) => void, onUnmount: (name: string) => void, translations?: Record<string, string>): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
2
+ export declare function useInput(field: Field, onMount: (name: string, schema: Schema, field: Field) => void, onUnmount: (name: string, options?: {
3
+ keepValue?: boolean;
4
+ }) => void, translations?: Record<string, string>): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
@@ -1,2 +1,4 @@
1
1
  import type { Field, Schema, Schemas } from '@luna-form/core';
2
- export declare function useSchema(): readonly [() => readonly [Schemas, Field[]], (name: string, schema: Schema, field: Field) => void, (name: string) => void];
2
+ export declare function useSchema(): readonly [() => readonly [Schemas, Field[]], (name: string, schema: Schema, field: Field) => void, (name: string, options?: {
3
+ keepValue?: boolean;
4
+ }) => void];
@@ -1 +1,3 @@
1
- export declare function useStore(): (names: string | string[]) => void;
1
+ export declare function useStore(): (names: string | string[], options?: {
2
+ keepValue?: boolean;
3
+ }) => void;
@@ -0,0 +1,4 @@
1
+ export type PersistenceContextValue = {
2
+ isDeleting: boolean;
3
+ };
4
+ export declare const PersistenceContext: import("react").Context<PersistenceContextValue>;
@@ -0,0 +1,4 @@
1
+ export declare function Collapsible({ children, visible, }: Readonly<{
2
+ children: React.ReactNode;
3
+ visible?: boolean;
4
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,9 @@
1
1
  import { type Column } from '@luna-form/core';
2
+ import type { Config } from '../type';
2
3
  export declare function Column(props: Readonly<{
3
4
  children?: React.ReactNode;
4
5
  column?: Column;
6
+ config?: Config;
7
+ context?: Record<string, unknown>;
8
+ translations?: Record<string, string>;
5
9
  }>): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,11 @@
1
1
  export declare function FieldListItem(props: Readonly<{
2
2
  canRemove?: boolean;
3
3
  children: React.ReactNode;
4
+ collapsed?: boolean;
5
+ collapsible?: boolean;
4
6
  index: number;
5
7
  isMultiField: boolean;
6
8
  label: string;
7
9
  onRemove?: (index: number) => void;
10
+ preview?: React.ReactNode;
8
11
  }>): import("react/jsx-runtime").JSX.Element;
@@ -3,5 +3,6 @@ export declare function FieldSetBase(props: Readonly<{
3
3
  description?: string;
4
4
  empty?: boolean;
5
5
  id?: string;
6
+ step?: number;
6
7
  title?: string;
7
8
  }>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,10 @@
1
1
  import { type Section, type Style } from '@luna-form/core';
2
2
  export declare function FieldSet(props: Readonly<{
3
+ advanced?: {
4
+ step?: boolean;
5
+ };
3
6
  children?: React.ReactNode;
4
7
  section: Section;
8
+ step?: number;
5
9
  style?: Style;
6
10
  }>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,9 @@
1
1
  import { type Definition, type Sections } from '@luna-form/core';
2
2
  import type { Config, Control, Slot } from '../type';
3
3
  export declare function Form(props: Readonly<{
4
+ advanced?: {
5
+ step?: boolean;
6
+ };
4
7
  action?: (formData: FormData) => void;
5
8
  children: Slot;
6
9
  config: Config;
@@ -1,7 +1,8 @@
1
+ import { type Description as DescriptionType } from '@luna-form/core';
1
2
  import type { Config } from '../type';
2
3
  export declare function FormattedDescription(props: Readonly<{
3
4
  config?: Config;
4
5
  context?: Record<string, unknown>;
5
- text?: string;
6
+ text?: DescriptionType;
6
7
  translations?: Record<string, string>;
7
8
  }>): import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  export declare function Legend(props: Readonly<{
2
- title?: string;
3
2
  description?: string;
3
+ step?: number;
4
+ title?: string;
4
5
  }>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { type Fields, type Nullable, type Style } from '@luna-form/core';
2
- import type { Children } from '../../type';
2
+ import type { Children, Config } from '../../type';
3
3
  import type { FieldProps } from '../field/field';
4
4
  import type { ListProps } from '../field/field-list';
5
5
  export type SlotComponents = {
@@ -9,8 +9,11 @@ export type SlotComponents = {
9
9
  export declare function SlotBase(props: Readonly<{
10
10
  children: Children;
11
11
  components: SlotComponents;
12
+ config: Config;
13
+ context?: Record<string, unknown>;
12
14
  disabled?: boolean;
13
15
  fields?: Fields;
14
16
  style?: Style;
17
+ translations?: Record<string, string>;
15
18
  value?: Nullable<Record<string, unknown>>;
16
19
  }>): import("react/jsx-runtime").JSX.Element[];
@@ -1,10 +1,13 @@
1
- import type { Children } from '../../type';
1
+ import type { Children, Config } from '../../type';
2
2
  import type { Fields, Nullable, Style } from '@luna-form/core';
3
3
  import type { SlotComponents } from './slot-base';
4
4
  export declare function createSlot(components: SlotComponents): (props: Readonly<{
5
5
  children: Children;
6
+ config: Config;
7
+ context?: Record<string, unknown>;
6
8
  disabled?: boolean;
7
9
  fields?: Fields;
8
10
  style?: Style;
11
+ translations?: Record<string, string>;
9
12
  value?: Nullable<Record<string, unknown>>;
10
13
  }>) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,15 @@
1
1
  import { type List, type Nullable, type Style } from '@luna-form/core';
2
2
  import { type SlotComponents } from './slot-base';
3
- import type { Children } from '../../type';
3
+ import type { Children, Config } from '../../type';
4
4
  export declare function SlotList(props: Readonly<{
5
5
  children: Children;
6
6
  components: SlotComponents;
7
+ config: Config;
8
+ context?: Record<string, unknown>;
7
9
  disabled?: boolean;
8
10
  field: List;
9
11
  index: number;
10
12
  style?: Style;
13
+ translations?: Record<string, string>;
11
14
  value?: Nullable<Record<string, unknown>>;
12
15
  }>): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,10 @@
1
1
  export declare const Slot: (props: Readonly<{
2
2
  children: import("../../type").Children;
3
+ config: import("../../type").Config;
4
+ context?: Record<string, unknown>;
3
5
  disabled?: boolean;
4
6
  fields?: import("@luna-form/core").Fields;
5
7
  style?: import("@luna-form/core").Style;
8
+ translations?: Record<string, string>;
6
9
  value?: import("@luna-form/core").Nullable<Record<string, unknown>>;
7
10
  }>) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,9 @@
1
1
  import type { Config } from '../../type';
2
2
  import type { Definition, Sections } from '@luna-form/core';
3
3
  export declare function Form(props: Readonly<{
4
+ advanced?: {
5
+ step?: boolean;
6
+ };
4
7
  children?: React.ReactNode;
5
8
  config: Config;
6
9
  context?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luna-form",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
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",
@@ -34,7 +34,7 @@
34
34
  "eslint-plugin-react": "7.37.5",
35
35
  "eslint-plugin-react-hooks": "7.1.1",
36
36
  "eslint-plugin-react-refresh": "0.5.2",
37
- "@luna-form/core": "0.0.43"
37
+ "@luna-form/core": "0.0.45"
38
38
  },
39
39
  "license": "Apache-2.0",
40
40
  "repository": {