react-luna-form 0.0.4 → 0.0.6

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 (89) hide show
  1. package/dist/client/cjs/index.js +1 -1
  2. package/dist/client/esm/index.js +1 -1
  3. package/dist/config/cjs/index.js +1 -1
  4. package/dist/config/esm/index.js +1 -1
  5. package/dist/server/cjs/index.js +1 -1
  6. package/dist/server/esm/index.js +1 -1
  7. package/dist/types/{config → luna-core/src}/fetcher.d.ts +1 -1
  8. package/dist/types/luna-core/src/handle/proxy-event.d.ts +5 -0
  9. package/dist/types/luna-core/src/handle/source-event.d.ts +2 -0
  10. package/dist/types/luna-core/src/handle/value-event.d.ts +2 -0
  11. package/dist/types/luna-core/src/helper/input.d.ts +41 -0
  12. package/dist/types/luna-core/src/index.d.ts +19 -0
  13. package/dist/types/{type.d.ts → luna-core/src/type.d.ts} +61 -25
  14. package/dist/types/luna-core/src/util/build.d.ts +5 -0
  15. package/dist/types/{util → luna-core/src/util}/constant.d.ts +19 -4
  16. package/dist/types/{util → luna-core/src/util}/extract.d.ts +9 -1
  17. package/dist/types/luna-core/src/util/is-input.d.ts +17 -0
  18. package/dist/types/luna-core/src/util/is-type.d.ts +6 -0
  19. package/dist/types/luna-core/src/util/prepare.d.ts +4 -0
  20. package/dist/types/luna-core/src/util/schema.d.ts +14 -0
  21. package/dist/types/luna-core/src/util/source.d.ts +2 -0
  22. package/dist/types/luna-core/src/util/string.d.ts +7 -0
  23. package/dist/types/luna-core/src/util/stringify.d.ts +1 -0
  24. package/dist/types/luna-core/src/util/url.d.ts +10 -0
  25. package/dist/types/luna-react/src/client/component/form.d.ts +14 -0
  26. package/dist/types/{client → luna-react/src/client}/component/input.d.ts +4 -5
  27. package/dist/types/{component/slot → luna-react/src/client/component}/slot.d.ts +2 -1
  28. package/dist/types/{client/component/wrapper/field.d.ts → luna-react/src/client/component/wrapper/index.d.ts} +1 -2
  29. package/dist/types/luna-react/src/client/hook/use-data-source.d.ts +3 -0
  30. package/dist/types/luna-react/src/client/hook/use-fetch.d.ts +3 -0
  31. package/dist/types/luna-react/src/client/hook/use-form-action.d.ts +14 -0
  32. package/dist/types/{client/hook/useInput.d.ts → luna-react/src/client/hook/use-input.d.ts} +1 -1
  33. package/dist/types/{client/hook/useSchema.d.ts → luna-react/src/client/hook/use-schema.d.ts} +1 -1
  34. package/dist/types/luna-react/src/client/hook/use-store.d.ts +1 -0
  35. package/dist/types/luna-react/src/client/hook/use-timeout.d.ts +1 -0
  36. package/dist/types/{client → luna-react/src/client}/index.d.ts +1 -1
  37. package/dist/types/luna-react/src/client/lib/error-store.d.ts +10 -0
  38. package/dist/types/luna-react/src/client/lib/source-store.d.ts +8 -0
  39. package/dist/types/luna-react/src/client/lib/store-helper.d.ts +21 -0
  40. package/dist/types/luna-react/src/client/lib/value-store.d.ts +13 -0
  41. package/dist/types/{component → luna-react/src/component}/column.d.ts +1 -2
  42. package/dist/types/{component → luna-react/src/component}/description.d.ts +1 -1
  43. package/dist/types/luna-react/src/component/field/field-base.d.ts +10 -0
  44. package/dist/types/{component → luna-react/src/component/field}/field-error.d.ts +1 -1
  45. package/dist/types/luna-react/src/component/field/field-group.d.ts +8 -0
  46. package/dist/types/luna-react/src/component/field/field-horizontal.d.ts +6 -0
  47. package/dist/types/{component → luna-react/src/component/field}/field-set.d.ts +2 -2
  48. package/dist/types/luna-react/src/component/field/field-vertical.d.ts +6 -0
  49. package/dist/types/{component → luna-react/src/component/field}/field.d.ts +2 -2
  50. package/dist/types/{component → luna-react/src/component}/form.d.ts +4 -1
  51. package/dist/types/luna-react/src/component/formatted-description.d.ts +3 -0
  52. package/dist/types/{component → luna-react/src/component}/group.d.ts +1 -0
  53. package/dist/types/{component → luna-react/src/component}/input/input-attributes.d.ts +1 -1
  54. package/dist/types/{component → luna-react/src/component}/input/input-base.d.ts +2 -2
  55. package/dist/types/{component → luna-react/src/component}/input/input-common.d.ts +1 -1
  56. package/dist/types/{component → luna-react/src/component}/input/input-option-select.d.ts +1 -1
  57. package/dist/types/luna-react/src/component/input-group.d.ts +5 -0
  58. package/dist/types/luna-react/src/component/input-label.d.ts +5 -0
  59. package/dist/types/{component → luna-react/src/component}/label.d.ts +2 -2
  60. package/dist/types/{component → luna-react/src/component}/slot/slot-base.d.ts +3 -3
  61. package/dist/types/{client/component → luna-react/src/component/slot}/slot.d.ts +2 -2
  62. package/dist/types/luna-react/src/config/index.d.ts +28 -0
  63. package/dist/types/luna-react/src/lib/render-If-exists.d.ts +1 -0
  64. package/dist/types/luna-react/src/lib/string.d.ts +1 -0
  65. package/dist/types/{server → luna-react/src/server}/component/fallback.d.ts +2 -1
  66. package/dist/types/{client → luna-react/src/server}/component/form.d.ts +3 -2
  67. package/dist/types/{server → luna-react/src/server}/component/input.d.ts +3 -2
  68. package/dist/types/{server → luna-react/src/server}/index.d.ts +1 -1
  69. package/dist/types/luna-react/src/type.d.ts +16 -0
  70. package/package.json +6 -4
  71. package/dist/types/client/component/wrapper/column.d.ts +0 -5
  72. package/dist/types/client/hook/useDataSource.d.ts +0 -2
  73. package/dist/types/client/hook/useFormAction.d.ts +0 -2
  74. package/dist/types/client/lib/error-store.d.ts +0 -7
  75. package/dist/types/config/index.d.ts +0 -9
  76. package/dist/types/server/component/form.d.ts +0 -9
  77. package/dist/types/util/build.d.ts +0 -4
  78. package/dist/types/util/helper/input.d.ts +0 -11
  79. package/dist/types/util/is-input.d.ts +0 -13
  80. package/dist/types/util/is-type.d.ts +0 -3
  81. package/dist/types/util/prepare.d.ts +0 -3
  82. package/dist/types/util/schema.d.ts +0 -12
  83. /package/dist/types/{util → luna-core/src/util}/attributes.d.ts +0 -0
  84. /package/dist/types/{util → luna-core/src/util}/column.d.ts +0 -0
  85. /package/dist/types/{util → luna-core/src/util}/date.d.ts +0 -0
  86. /package/dist/types/{client → luna-react/src/client}/component/wrapper/with-error.d.ts +0 -0
  87. /package/dist/types/{component → luna-react/src/component}/control.d.ts +0 -0
  88. /package/dist/types/{component → luna-react/src/component}/legend.d.ts +0 -0
  89. /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",
4
- "description": "A React library for building forms based on JSON Schema",
3
+ "version": "0.0.6",
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.7",
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.25"
34
+ "eslint-plugin-react-refresh": "0.4.26",
35
+ "@luna-form/core": "0.0.6"
34
36
  },
35
37
  "license": "Apache-2.0",
36
38
  "repository": {
@@ -1,5 +0,0 @@
1
- export declare const Column: (props: Readonly<Omit<Readonly<{
2
- children?: React.ReactNode;
3
- column?: import("../../../type").Column;
4
- errors?: Record<string, string[]>;
5
- }>, "errors">>) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import type { Config, DataSource, Nullable } from '../../type';
2
- export declare function useDataSource<T>(dataSource: Nullable<DataSource | T[]> | undefined, config: Config, disabled?: boolean): [Nullable<T[]>];
@@ -1,2 +0,0 @@
1
- import type { Schemas } from '../../type';
2
- export declare function useFormAction(getSchema: () => Schemas, action?: (formData: FormData) => Promise<void> | void): readonly [(formData: FormData) => Promise<void>];
@@ -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;
@@ -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,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,13 +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): slot is Column;
9
- export declare function isField(slot: Field | Column): 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;
@@ -1,3 +0,0 @@
1
- import type { Value } from '../type';
2
- export declare function isObject<T>(value: unknown): value is Record<string, T>;
3
- export declare function isValue(value: unknown): value is Value;
@@ -1,3 +0,0 @@
1
- import type { Base, Nullable } from '../type';
2
- export declare function prepare<T extends Base>(base?: readonly T[]): any[];
3
- export declare function entries<T>(values?: Nullable<Record<string, T>>): [key: string, value: T][];
@@ -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>>;