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.
Files changed (74) 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/client/component/field/field-list.d.ts +2 -0
  8. package/dist/types/client/component/field/field-with-state.d.ts +13 -0
  9. package/dist/types/client/component/field/field.d.ts +7 -0
  10. package/dist/types/client/component/form-content.d.ts +20 -0
  11. package/dist/types/client/component/form.d.ts +20 -0
  12. package/dist/types/client/component/guard/list-guard.d.ts +2 -0
  13. package/dist/types/client/component/guard/visibility-guard.d.ts +6 -0
  14. package/dist/types/client/component/input.d.ts +16 -0
  15. package/dist/types/client/component/slot/slot.d.ts +7 -0
  16. package/dist/types/client/hook/use-data-source.d.ts +3 -0
  17. package/dist/types/client/hook/use-fetch.d.ts +3 -0
  18. package/dist/types/client/hook/use-field-list.d.ts +2 -0
  19. package/dist/types/client/hook/use-form-action.d.ts +13 -0
  20. package/dist/types/client/hook/use-input.d.ts +2 -0
  21. package/dist/types/client/hook/use-schema.d.ts +2 -0
  22. package/dist/types/client/hook/use-store.d.ts +1 -0
  23. package/dist/types/client/hook/use-timeout.d.ts +1 -0
  24. package/dist/types/client/hook/use-value.d.ts +6 -0
  25. package/dist/types/client/index.d.ts +3 -0
  26. package/dist/types/client/lib/error-store.d.ts +7 -0
  27. package/dist/types/client/lib/source-store.d.ts +5 -0
  28. package/dist/types/client/lib/state-store.d.ts +5 -0
  29. package/dist/types/client/lib/store-helper.d.ts +26 -0
  30. package/dist/types/client/lib/value-store.d.ts +10 -0
  31. package/dist/types/component/chevron-icon.d.ts +3 -0
  32. package/dist/types/component/column.d.ts +5 -0
  33. package/dist/types/component/control.d.ts +5 -0
  34. package/dist/types/component/description.d.ts +3 -0
  35. package/dist/types/component/field/field-base.d.ts +12 -0
  36. package/dist/types/component/field/field-error.d.ts +5 -0
  37. package/dist/types/component/field/field-group.d.ts +8 -0
  38. package/dist/types/component/field/field-horizontal.d.ts +2 -0
  39. package/dist/types/component/field/field-list-item.d.ts +8 -0
  40. package/dist/types/component/field/field-list.d.ts +7 -0
  41. package/dist/types/component/field/field-set-advanced.d.ts +5 -0
  42. package/dist/types/component/field/field-set-base.d.ts +7 -0
  43. package/dist/types/component/field/field-set.d.ts +6 -0
  44. package/dist/types/component/field/field-vertical.d.ts +2 -0
  45. package/dist/types/component/field/field.d.ts +10 -0
  46. package/dist/types/component/form.d.ts +13 -0
  47. package/dist/types/component/formatted-description.d.ts +7 -0
  48. package/dist/types/component/group.d.ts +4 -0
  49. package/dist/types/component/input/input-base.d.ts +9 -0
  50. package/dist/types/component/input-group.d.ts +10 -0
  51. package/dist/types/component/input-label.d.ts +9 -0
  52. package/dist/types/component/label.d.ts +7 -0
  53. package/dist/types/component/legend.d.ts +4 -0
  54. package/dist/types/component/list.d.ts +5 -0
  55. package/dist/types/component/separator.d.ts +1 -0
  56. package/dist/types/component/slot/list-slot.d.ts +2 -0
  57. package/dist/types/component/slot/slot-base.d.ts +16 -0
  58. package/dist/types/component/slot/slot-create.d.ts +10 -0
  59. package/dist/types/component/slot/slot-list.d.ts +12 -0
  60. package/dist/types/component/slot/slot.d.ts +7 -0
  61. package/dist/types/config/index.d.ts +31 -0
  62. package/dist/types/lib/render-If-exists.d.ts +1 -0
  63. package/dist/types/lib/string.d.ts +1 -0
  64. package/dist/types/luna-core/src/helper/input.d.ts +1 -0
  65. package/dist/types/luna-core/src/type.d.ts +1 -0
  66. package/dist/types/luna-core/src/util/constant.d.ts +1 -0
  67. package/dist/types/luna-core/src/util/extract.d.ts +1 -0
  68. package/dist/types/luna-core/src/util/is-input.d.ts +1 -1
  69. package/dist/types/server/component/fallback.d.ts +7 -0
  70. package/dist/types/server/component/form.d.ts +13 -0
  71. package/dist/types/server/component/input.d.ts +13 -0
  72. package/dist/types/server/index.d.ts +4 -0
  73. package/dist/types/type.d.ts +29 -0
  74. 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;
@@ -32,6 +32,7 @@ export type Hideable = {
32
32
  export type Sections = Array<Section>;
33
33
  export type Value = string | number | readonly string[];
34
34
  export type Option = {
35
+ description?: string;
35
36
  label: string;
36
37
  value: string;
37
38
  };
@@ -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 Input;
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,7 @@
1
+ import type { Config } from '../../type';
2
+ import type { Sections } from '@luna-form/core';
3
+ export declare function Fallback(props: Readonly<{
4
+ children: React.ReactNode;
5
+ config: Config;
6
+ sections: Sections;
7
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -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,4 @@
1
+ import { Form } from './component/form';
2
+ import { Fallback } from './component/fallback';
3
+ export { Form, Fallback };
4
+ export type { Sections, Source } from '@luna-form/core';
@@ -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.32",
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.32"
36
+ "@luna-form/core": "0.0.33"
37
37
  },
38
38
  "license": "Apache-2.0",
39
39
  "repository": {