@dappworks/kit 0.4.129 → 0.4.130

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.
@@ -0,0 +1,104 @@
1
+ import { _ } from './chunk-MGU3KYGC.mjs';
2
+
3
+ // themes/default.json
4
+ var default_default = {
5
+ Modal: {
6
+ classNames: {
7
+ base: ""
8
+ }
9
+ },
10
+ InputWidget: {
11
+ classNames: {
12
+ inputWrapper: ""
13
+ }
14
+ },
15
+ TextareaWidget: {
16
+ classNames: {
17
+ inputWrapper: ""
18
+ }
19
+ },
20
+ DatePickerWidget: {
21
+ dateInputClassNames: {
22
+ inputWrapper: ""
23
+ }
24
+ },
25
+ SelectWidget: {
26
+ classNames: {
27
+ popoverContent: "rounded-lg shadow-md border dark:border-[#3e3e3e]"
28
+ }
29
+ },
30
+ MultipleSelectWidget: {
31
+ classNames: {
32
+ base: "w-full",
33
+ trigger: "min-h-12 py-1",
34
+ popoverContent: "rounded-lg shadow-md border dark:border-[#3e3e3e]"
35
+ }
36
+ },
37
+ CheckboxWidget: {
38
+ classNames: {
39
+ base: "m-0 flex items-center justify-start w-full cursor-pointer rounded-lg gap-2 p-[13px] bg-content2"
40
+ }
41
+ },
42
+ Card: {
43
+ className: ""
44
+ }
45
+ };
46
+
47
+ // themes/primary.json
48
+ var primary_default = {
49
+ Modal: {
50
+ classNames: {
51
+ base: "dark:bg-[#09090B] border dark:border-[#2c2c2c] rounded-lg shadow-md"
52
+ }
53
+ },
54
+ InputWidget: {
55
+ classNames: {
56
+ inputWrapper: "rounded-lg shadow-none border dark:border-[#2c2c2c] !bg-transparent data-[hover=true]:!bg-default-50 group-data-[focus=true]:!bg-transparent"
57
+ }
58
+ },
59
+ TextareaWidget: {
60
+ classNames: {
61
+ inputWrapper: "rounded-lg shadow-none border dark:border-[#2c2c2c] !bg-transparent data-[hover=true]:!bg-default-50 group-data-[focus=true]:!bg-transparent"
62
+ }
63
+ },
64
+ DatePickerWidget: {
65
+ dateInputClassNames: {
66
+ inputWrapper: "rounded-lg bg-transparent border dark:border-[#2c2c2c] hover:bg-default-50"
67
+ }
68
+ },
69
+ SelectWidget: {
70
+ classNames: {
71
+ trigger: "rounded-lg bg-transparent shadow-none border dark:border-[#2c2c2c] data-[hover=true]:bg-default-50",
72
+ popoverContent: "rounded-lg shadow-md border border-[#F4F4F5] dark:border-[#3e3e3e]"
73
+ }
74
+ },
75
+ MultipleSelectWidget: {
76
+ classNames: {
77
+ base: "w-full",
78
+ trigger: "min-h-12 py-1 rounded-lg bg-transparent shadow-none border dark:border-[#2c2c2c] data-[hover=true]:bg-default-50",
79
+ popoverContent: "rounded-lg shadow-md border dark:border-[#3e3e3e]"
80
+ }
81
+ },
82
+ CheckboxWidget: {
83
+ classNames: {
84
+ base: "m-0 flex items-center justify-start w-full cursor-pointer rounded-lg gap-2 p-[13px] bg-transparent border dark:border-[#2c2c2c]"
85
+ }
86
+ },
87
+ Card: {
88
+ className: "dark:bg-[#09090B]"
89
+ }
90
+ };
91
+
92
+ // themes/index.ts
93
+ var getStyle = (theme, key) => {
94
+ switch (theme) {
95
+ case "default":
96
+ return _.get(default_default, key);
97
+ case "primary":
98
+ return _.get(primary_default, key);
99
+ }
100
+ };
101
+
102
+ export { getStyle };
103
+ //# sourceMappingURL=out.js.map
104
+ //# sourceMappingURL=chunk-5SFAINN6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../themes/default.json","../themes/primary.json","../themes/index.ts"],"names":[],"mappings":";;;;;AAAA;AAAA,EACE,OAAS;AAAA,IACP,YAAc;AAAA,MACZ,MAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,aAAe;AAAA,IACb,YAAc;AAAA,MACZ,cAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,IAChB,YAAc;AAAA,MACZ,cAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,kBAAoB;AAAA,IAClB,qBAAuB;AAAA,MACrB,cAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,cAAgB;AAAA,IACd,YAAc;AAAA,MACZ,gBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,sBAAwB;AAAA,IACtB,YAAc;AAAA,MACZ,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,gBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,IAChB,YAAc;AAAA,MACZ,MAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,IACN,WAAa;AAAA,EACf;AACF;;;ACzCA;AAAA,EACE,OAAS;AAAA,IACP,YAAc;AAAA,MACZ,MAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,aAAe;AAAA,IACb,YAAc;AAAA,MACZ,cAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,IAChB,YAAc;AAAA,MACZ,cAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,kBAAoB;AAAA,IAClB,qBAAuB;AAAA,MACrB,cAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EACA,cAAgB;AAAA,IACd,YAAc;AAAA,MACZ,SAAW;AAAA,MACX,gBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,sBAAwB;AAAA,IACtB,YAAc;AAAA,MACZ,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,gBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,IAChB,YAAc;AAAA,MACZ,MAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,IACN,WAAa;AAAA,EACf;AACF;;;ACpCO,IAAM,WAAW,CAAC,OAAkB,QAAgB;AACzD,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO,EAAE,IAAI,iBAAc,GAAG;AAAA,IAChC,KAAK;AACH,aAAO,EAAE,IAAI,iBAAc,GAAG;AAAA,EAClC;AACF","sourcesContent":["{\n \"Modal\": {\n \"classNames\": {\n \"base\": \"\"\n }\n },\n \"InputWidget\": {\n \"classNames\": {\n \"inputWrapper\": \"\"\n }\n },\n \"TextareaWidget\": {\n \"classNames\": {\n \"inputWrapper\": \"\"\n }\n },\n \"DatePickerWidget\": {\n \"dateInputClassNames\": {\n \"inputWrapper\": \"\"\n }\n },\n \"SelectWidget\": {\n \"classNames\": {\n \"popoverContent\": \"rounded-lg shadow-md border dark:border-[#3e3e3e]\"\n }\n },\n \"MultipleSelectWidget\": {\n \"classNames\": {\n \"base\": \"w-full\",\n \"trigger\": \"min-h-12 py-1\",\n \"popoverContent\": \"rounded-lg shadow-md border dark:border-[#3e3e3e]\"\n }\n },\n \"CheckboxWidget\": {\n \"classNames\": {\n \"base\": \"m-0 flex items-center justify-start w-full cursor-pointer rounded-lg gap-2 p-[13px] bg-content2\"\n }\n },\n \"Card\": {\n \"className\": \"\"\n }\n}\n","{\n \"Modal\": {\n \"classNames\": {\n \"base\": \"dark:bg-[#09090B] border dark:border-[#2c2c2c] rounded-lg shadow-md\"\n }\n },\n \"InputWidget\": {\n \"classNames\": {\n \"inputWrapper\": \"rounded-lg shadow-none border dark:border-[#2c2c2c] !bg-transparent data-[hover=true]:!bg-default-50 group-data-[focus=true]:!bg-transparent\"\n }\n },\n \"TextareaWidget\": {\n \"classNames\": {\n \"inputWrapper\": \"rounded-lg shadow-none border dark:border-[#2c2c2c] !bg-transparent data-[hover=true]:!bg-default-50 group-data-[focus=true]:!bg-transparent\"\n }\n },\n \"DatePickerWidget\": {\n \"dateInputClassNames\": {\n \"inputWrapper\": \"rounded-lg bg-transparent border dark:border-[#2c2c2c] hover:bg-default-50\"\n }\n },\n \"SelectWidget\": {\n \"classNames\": {\n \"trigger\": \"rounded-lg bg-transparent shadow-none border dark:border-[#2c2c2c] data-[hover=true]:bg-default-50\",\n \"popoverContent\": \"rounded-lg shadow-md border border-[#F4F4F5] dark:border-[#3e3e3e]\"\n }\n },\n \"MultipleSelectWidget\": {\n \"classNames\": {\n \"base\": \"w-full\",\n \"trigger\": \"min-h-12 py-1 rounded-lg bg-transparent shadow-none border dark:border-[#2c2c2c] data-[hover=true]:bg-default-50\",\n \"popoverContent\": \"rounded-lg shadow-md border dark:border-[#3e3e3e]\"\n }\n },\n \"CheckboxWidget\": {\n \"classNames\": {\n \"base\": \"m-0 flex items-center justify-start w-full cursor-pointer rounded-lg gap-2 p-[13px] bg-transparent border dark:border-[#2c2c2c]\"\n }\n },\n \"Card\": {\n \"className\": \"dark:bg-[#09090B]\"\n }\n}\n","import { _ } from \"../lib/lodash\";\nimport defaultTheme from \"./default.json\";\nimport primaryTheme from \"./primary.json\";\n\nexport type ThemeType = \"default\" | \"primary\";\n\nexport const getStyle = (theme: ThemeType, key: string) => {\n switch (theme) {\n case \"default\":\n return _.get(defaultTheme, key);\n case \"primary\":\n return _.get(primaryTheme, key);\n }\n};\n"]}
package/dist/form.d.mts CHANGED
@@ -3,6 +3,7 @@ import { ButtonProps, TabsProps, CheckboxProps, SlotsToClasses, InputSlots, Inpu
3
3
  import { UiSchema, RJSFSchema, WidgetProps, Widget } from '@rjsf/utils';
4
4
  import * as _rjsf_validator_ajv8_lib_validator from '@rjsf/validator-ajv8/lib/validator';
5
5
  import Form, { IChangeEvent } from '@rjsf/core';
6
+ import { T as ThemeType } from './index-38be834f.js';
6
7
  import { EditorProps } from '@monaco-editor/react';
7
8
  import { S as Store, R as RootStore } from './root-766ae985.js';
8
9
  import EventEmitter from 'events';
@@ -115,6 +116,7 @@ type FormKey<T = FormDataType> = keyof T;
115
116
  type FormDataOfKey<T = FormDataType> = T[FormKey<T>];
116
117
  type JSONFormProps<T = FormDataType> = {
117
118
  className?: string;
119
+ theme?: ThemeType;
118
120
  formData: T;
119
121
  formConfig?: FormConfigType<T>;
120
122
  layoutConfig?: LayoutConfigType<T, LayoutType>;
@@ -304,6 +306,7 @@ declare class ComplexFormModalStore<T extends FormDataType> implements Store {
304
306
  layoutConfig?: LayoutConfigType<T, LayoutType>;
305
307
  className: string;
306
308
  classNames?: SlotsToClasses<ModalSlots>;
309
+ theme: ThemeType;
307
310
  modalSize: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | 'xs' | '3xl' | '4xl' | '5xl';
308
311
  scrollBehavior?: 'normal' | 'inside' | 'outside';
309
312
  isDismissable: boolean;
@@ -333,6 +336,7 @@ declare class FormModalStore<T = {
333
336
  form: JSONSchemaFormState<T>;
334
337
  className: string;
335
338
  classNames?: SlotsToClasses<ModalSlots>;
339
+ theme: ThemeType;
336
340
  modalSize: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | 'xs' | '3xl' | '4xl' | '5xl';
337
341
  scrollBehavior?: 'normal' | 'inside' | 'outside';
338
342
  closeOnOverlayClick: boolean;
@@ -345,17 +349,18 @@ declare class FormModalStore<T = {
345
349
  declare function getFormData<T = {
346
350
  [key: string]: any;
347
351
  }>(v: Partial<FormModalStore>): Promise<T>;
348
- declare function getFormState<T>({ data, metadata, onSet, onSubmit, }: {
352
+ declare function getFormState<T>({ data, metadata, onSet, onSubmit, theme, }: {
349
353
  data: T;
350
354
  metadata?: {
351
355
  [key: string]: any;
352
356
  } & Partial<JSONSchemaFormState<any>>;
353
357
  onSet?: (v: T, form: JSONSchemaFormState<T, UiSchema>) => T;
354
358
  onSubmit?: (data: T) => void;
359
+ theme: ThemeType;
355
360
  }): JSONSchemaFormState<T, UiSchema>;
356
361
  declare function getSimpleFormData<T>(data: T, metadata: {
357
362
  [key: string]: any;
358
- } & Partial<JSONSchemaFormState<any>>, config: Partial<FormModalStore>, onSet?: (v: T, form: JSONSchemaFormState<T, UiSchema>) => T): Promise<T>;
363
+ } & Partial<JSONSchemaFormState<any>>, config: Partial<FormModalStore>, onSet?: (v: T, form: JSONSchemaFormState<T, UiSchema>) => T, theme?: ThemeType): Promise<T>;
359
364
 
360
365
  type JSONViewType = {
361
366
  className?: string;
package/dist/form.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { getStyle } from './chunk-5SFAINN6.mjs';
1
2
  import { useStore } from './chunk-DZMNL4BZ.mjs';
2
3
  import { RootStore } from './chunk-HRWHDF2F.mjs';
3
4
  import { helper } from './chunk-Q3AD5RHQ.mjs';
@@ -27,22 +28,24 @@ function CheckboxWidget({
27
28
  }) {
28
29
  const {
29
30
  className,
30
- nextuiClassNames = {
31
- base: "m-0 flex items-center justify-start w-full cursor-pointer rounded-lg gap-2 p-[13px] bg-transparent border dark:border-[#2c2c2c]"
32
- },
31
+ nextuiClassNames,
33
32
  size = "sm",
34
33
  color = "primary",
35
34
  description,
36
35
  descriptionClassName
37
36
  } = options;
38
- const { validate } = uiSchema;
37
+ const { validate, theme } = uiSchema;
39
38
  const [errMsg, setErrMsg] = useState("");
40
39
  const isInvalid = !!errMsg;
40
+ const classNames = useMemo(() => {
41
+ const themeStyle = getStyle(theme || "default", "CheckboxWidget");
42
+ return __spreadValues(__spreadValues({}, themeStyle.classNames), nextuiClassNames);
43
+ }, [theme, nextuiClassNames]);
41
44
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
42
45
  Checkbox,
43
46
  {
44
47
  className: cn("w-full", className),
45
- classNames: nextuiClassNames,
48
+ classNames,
46
49
  defaultSelected: value,
47
50
  isDisabled: disabled,
48
51
  icon: /* @__PURE__ */ React7.createElement(Check, { className: "bg-white dark:bg-black" }),
@@ -69,9 +72,7 @@ function InputWidget(props) {
69
72
  const { onChange, options, label, value, required, disabled, uiSchema } = props;
70
73
  const {
71
74
  className,
72
- nextuiClassNames = {
73
- inputWrapper: "rounded-lg shadow-none border dark:border-[#2c2c2c] !bg-transparent data-[hover=true]:!bg-default-50 group-data-[focus=true]:!bg-transparent"
74
- },
75
+ nextuiClassNames,
75
76
  labelPlacement = "inside",
76
77
  size = "sm",
77
78
  inputType = "text",
@@ -82,14 +83,18 @@ function InputWidget(props) {
82
83
  endContent,
83
84
  description
84
85
  } = options;
85
- const { requiredErrMsg, validate } = uiSchema;
86
+ const { requiredErrMsg, validate, theme } = uiSchema;
86
87
  const placeholder = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder;
87
88
  const isFirstChecked = useRef(true);
89
+ const classNames = useMemo(() => {
90
+ const themeStyle = getStyle(theme || "default", "InputWidget");
91
+ return __spreadValues(__spreadValues({}, themeStyle.classNames), nextuiClassNames);
92
+ }, [theme, nextuiClassNames]);
88
93
  return /* @__PURE__ */ React7.createElement(
89
94
  Input,
90
95
  {
91
96
  className: cn("w-full", className),
92
- classNames: nextuiClassNames,
97
+ classNames,
93
98
  label,
94
99
  placeholder,
95
100
  value,
@@ -127,10 +132,7 @@ function SelectWidget(props) {
127
132
  const { onChange, options, label, value, required, disabled, uiSchema } = props;
128
133
  const {
129
134
  className,
130
- nextuiClassNames = {
131
- trigger: "rounded-lg bg-transparent shadow-none border dark:border-[#2c2c2c] data-[hover=true]:bg-default-50",
132
- popoverContent: "rounded-lg shadow-md border border-[#F4F4F5] dark:border-[#3e3e3e]"
133
- },
135
+ nextuiClassNames,
134
136
  listboxProps = {
135
137
  itemClasses: {
136
138
  base: [
@@ -153,8 +155,12 @@ function SelectWidget(props) {
153
155
  radius,
154
156
  description
155
157
  } = options;
156
- const { selectOptions = [], requiredErrMsg, validate } = uiSchema;
158
+ const { selectOptions = [], requiredErrMsg, validate, theme } = uiSchema;
157
159
  const placeholder = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder;
160
+ const classNames = useMemo(() => {
161
+ const themeStyle = getStyle(theme || "default", "MultipleSelectWidget");
162
+ return __spreadValues(__spreadValues({}, themeStyle.classNames), nextuiClassNames);
163
+ }, [theme, nextuiClassNames]);
158
164
  const [errMsg, setErrMsg] = useState("");
159
165
  const isInvalid = !!errMsg;
160
166
  const checkValue = useCallback((value2) => {
@@ -174,7 +180,7 @@ function SelectWidget(props) {
174
180
  {
175
181
  label: label == null ? void 0 : label.trim(),
176
182
  className: cn("w-full", className),
177
- classNames: nextuiClassNames,
183
+ classNames,
178
184
  labelPlacement,
179
185
  placeholder,
180
186
  size,
@@ -201,14 +207,10 @@ function SelectWidget(props) {
201
207
  function MultipleSelectWidget(props) {
202
208
  var _a;
203
209
  const { onChange, options, label, value, required, uiSchema = {} } = props;
204
- const { selectOptions = [], requiredErrMsg, validate } = uiSchema;
210
+ const { selectOptions = [], requiredErrMsg, validate, theme } = uiSchema;
205
211
  const {
206
212
  className,
207
- nextuiClassNames = {
208
- base: "w-full",
209
- trigger: "min-h-12 py-1 rounded-lg bg-transparent shadow-none border dark:border-[#2c2c2c] data-[hover=true]:bg-default-50",
210
- popoverContent: "rounded-lg shadow-md border dark:border-[#3e3e3e]"
211
- },
213
+ nextuiClassNames,
212
214
  labelPlacement = "inside",
213
215
  listboxProps = {},
214
216
  size = "sm",
@@ -220,6 +222,10 @@ function MultipleSelectWidget(props) {
220
222
  const selectedKeys = useMemo(() => {
221
223
  return value ? value.split(",") : [];
222
224
  }, [value]);
225
+ const classNames = useMemo(() => {
226
+ const themeStyle = getStyle(theme || "default", "MultipleSelectWidget");
227
+ return __spreadValues(__spreadValues({}, themeStyle.classNames), nextuiClassNames);
228
+ }, [theme, nextuiClassNames]);
223
229
  const [errMsg, setErrMsg] = useState("");
224
230
  const isInvalid = !!errMsg;
225
231
  const checkValue = useCallback((value2) => {
@@ -255,7 +261,7 @@ function MultipleSelectWidget(props) {
255
261
  checkValue(_v);
256
262
  },
257
263
  items: selectOptions,
258
- classNames: nextuiClassNames,
264
+ classNames,
259
265
  listboxProps: __spreadValues({
260
266
  itemClasses: {
261
267
  base: [
@@ -456,7 +462,7 @@ var JSONValue = class extends JSONSchemaValue {
456
462
  };
457
463
 
458
464
  // components/JSONForm/Layouts/format.tsx
459
- var getFormState = (props, formLayout = {}) => {
465
+ var getFormState = (props, formLayout = {}, theme = "default") => {
460
466
  const { formData, formConfig, onSet, onChange } = props;
461
467
  const formStates = {};
462
468
  Object.keys(formData).forEach((key) => {
@@ -514,6 +520,7 @@ var getFormState = (props, formLayout = {}) => {
514
520
  value[k] = JSON.stringify(v, null, 2);
515
521
  formConfigData[k]["ui:widget"] = EditorWidget;
516
522
  }
523
+ formConfigData[k]["theme"] = theme;
517
524
  return p;
518
525
  }, {});
519
526
  const schema = {
@@ -919,9 +926,10 @@ var grid_default = Grid;
919
926
 
920
927
  // components/JSONForm/Layouts/gridLayout.tsx
921
928
  var GridLayout = (props) => {
922
- const { layoutConfig, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
929
+ const { layoutConfig, onBatchSubmit, batchSubmitButtonProps, onReady, theme } = props;
923
930
  const _a = layoutConfig, { $type, $gridColumn } = _a, formLayout = __objRest(_a, ["$type", "$gridColumn"]);
924
- const formStates = getFormState(props, formLayout);
931
+ const formStates = getFormState(props, formLayout, theme);
932
+ const cardStyle = getStyle(theme || "default", "Card");
925
933
  useEffect(() => {
926
934
  if (formStates && onReady) {
927
935
  onReady(formStates);
@@ -930,7 +938,7 @@ var GridLayout = (props) => {
930
938
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(grid_default, { numItems: $gridColumn != null ? $gridColumn : 1, className: "gap-2" }, Object.keys(formStates).map((key) => {
931
939
  var _a2;
932
940
  const layout = formLayout[key];
933
- return /* @__PURE__ */ React7.createElement(col_default, { numColSpan: (_a2 = layout == null ? void 0 : layout.colSpan) != null ? _a2 : 1, key, id: `form-${key}` }, /* @__PURE__ */ React7.createElement(Card, { className: cn("h-full m-0 p-4 shadow-sm border dark:border-[#3e3e3e] dark:bg-[#09090B]", layout == null ? void 0 : layout.cardCss) }, /* @__PURE__ */ React7.createElement("div", { className: cn("mb-2 font-bold text-center", layout == null ? void 0 : layout.titleBoxCss) }, (layout == null ? void 0 : layout.title) || key), /* @__PURE__ */ React7.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React7.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps }), (layout == null ? void 0 : layout.customButtonProps) && /* @__PURE__ */ React7.createElement(CustomButton, { formKey: key, formState: formStates[key], buttonProps: layout.customButtonProps }))));
941
+ return /* @__PURE__ */ React7.createElement(col_default, { numColSpan: (_a2 = layout == null ? void 0 : layout.colSpan) != null ? _a2 : 1, key, id: `form-${key}` }, /* @__PURE__ */ React7.createElement(Card, { className: cn("h-full m-0 p-4 shadow-sm border dark:border-[#3e3e3e]", cardStyle.className, layout == null ? void 0 : layout.cardCss) }, /* @__PURE__ */ React7.createElement("div", { className: cn("mb-2 font-bold text-center", layout == null ? void 0 : layout.titleBoxCss) }, (layout == null ? void 0 : layout.title) || key), /* @__PURE__ */ React7.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React7.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps }), (layout == null ? void 0 : layout.customButtonProps) && /* @__PURE__ */ React7.createElement(CustomButton, { formKey: key, formState: formStates[key], buttonProps: layout.customButtonProps }))));
934
942
  })), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
935
943
  };
936
944
  var CollapsibleBox = ({ formKey, title, titleBoxCss, formState, submitButtonProps, customButtonProps }) => {
@@ -946,9 +954,9 @@ var CollapsibleBox = ({ formKey, title, titleBoxCss, formState, submitButtonProp
946
954
  ), /* @__PURE__ */ React7.createElement("div", { className: cn("mt-2", opened ? "block" : "hidden") }, /* @__PURE__ */ React7.createElement(JSONSchemaForm, { formState }, submitButtonProps && /* @__PURE__ */ React7.createElement(SubmitButton, { formKey, formState, buttonProps: submitButtonProps }), customButtonProps && /* @__PURE__ */ React7.createElement(CustomButton, { formKey, formState, buttonProps: customButtonProps }))));
947
955
  };
948
956
  var ListLayout = (props) => {
949
- const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
957
+ const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady, theme } = props;
950
958
  const _a = layoutConfig, formLayout = __objRest(_a, ["$type"]);
951
- const formStates = getFormState(props, formLayout);
959
+ const formStates = getFormState(props, formLayout, theme);
952
960
  useEffect(() => {
953
961
  if (formStates && onReady) {
954
962
  onReady(formStates);
@@ -972,9 +980,9 @@ var ListLayout = (props) => {
972
980
  }), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
973
981
  };
974
982
  var SimpleLayout = (props) => {
975
- const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
983
+ const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady, theme } = props;
976
984
  const _a = layoutConfig, formLayout = __objRest(_a, ["$type"]);
977
- const formStates = getFormState(props, formLayout);
985
+ const formStates = getFormState(props, formLayout, theme);
978
986
  useEffect(() => {
979
987
  if (formStates && onReady) {
980
988
  onReady(formStates);
@@ -986,7 +994,7 @@ var SimpleLayout = (props) => {
986
994
  })), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
987
995
  };
988
996
  var TabLayout = (props) => {
989
- const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
997
+ const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady, theme } = props;
990
998
  const _a = layoutConfig, {
991
999
  $type,
992
1000
  $tabsProps = {
@@ -996,7 +1004,7 @@ var TabLayout = (props) => {
996
1004
  "$type",
997
1005
  "$tabsProps"
998
1006
  ]);
999
- const formStates = useMemo(() => getFormState(props, formLayout), [props.formData, props.formConfig, props.layoutConfig]);
1007
+ const formStates = useMemo(() => getFormState(props, formLayout, theme), [props.formData, props.formConfig, props.layoutConfig]);
1000
1008
  const formKeys = Object.keys(formStates);
1001
1009
  const [selectedTab, setSelectedTab] = useState(formKeys[0] || "");
1002
1010
  useEffect(() => {
@@ -1067,14 +1075,18 @@ function TextareaWidget(props) {
1067
1075
  endContent,
1068
1076
  description
1069
1077
  } = options;
1070
- const { requiredErrMsg, validate } = uiSchema;
1078
+ const { requiredErrMsg, validate, theme } = uiSchema;
1071
1079
  const placeholder = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder;
1072
1080
  const isFirstChecked = useRef(true);
1081
+ const classNames = useMemo(() => {
1082
+ const themeStyle = getStyle(theme || "default", "InputWidget");
1083
+ return __spreadValues(__spreadValues({}, themeStyle.classNames), nextuiClassNames);
1084
+ }, [theme, nextuiClassNames]);
1073
1085
  return /* @__PURE__ */ React7.createElement(
1074
1086
  Textarea,
1075
1087
  {
1076
1088
  className: cn("w-full", className),
1077
- classNames: nextuiClassNames,
1089
+ classNames,
1078
1090
  label,
1079
1091
  placeholder,
1080
1092
  value,
@@ -1112,9 +1124,7 @@ function DatePickerWidget({ label, options, value, required, disabled, uiSchema,
1112
1124
  const {
1113
1125
  className,
1114
1126
  nextuiClassNames = { calendarContent: "min-w-fit" },
1115
- dateInputClassNames = {
1116
- inputWrapper: "rounded-lg bg-transparent border dark:border-[#2c2c2c] hover:bg-default-50"
1117
- },
1127
+ dateInputClassNames,
1118
1128
  labelPlacement = "inside",
1119
1129
  size = "sm",
1120
1130
  granularity = "day",
@@ -1123,8 +1133,12 @@ function DatePickerWidget({ label, options, value, required, disabled, uiSchema,
1123
1133
  variant
1124
1134
  } = options;
1125
1135
  const [date, setDate] = useState();
1126
- const { requiredErrMsg, validate } = uiSchema;
1136
+ const { requiredErrMsg, validate, theme } = uiSchema;
1127
1137
  const isFirstChecked = useRef(true);
1138
+ const dateInputStyle = useMemo(() => {
1139
+ const themeStyle = getStyle(theme || "default", "DatePickerWidget");
1140
+ return __spreadValues(__spreadValues({}, themeStyle.dateInputClassNames), dateInputClassNames);
1141
+ }, [theme, dateInputClassNames]);
1128
1142
  useEffect(() => {
1129
1143
  if (value) {
1130
1144
  try {
@@ -1142,7 +1156,7 @@ function DatePickerWidget({ label, options, value, required, disabled, uiSchema,
1142
1156
  showMonthAndYearPickers: true,
1143
1157
  className: cn("w-full", className),
1144
1158
  classNames: nextuiClassNames,
1145
- dateInputClassNames,
1159
+ dateInputClassNames: dateInputStyle,
1146
1160
  label,
1147
1161
  size,
1148
1162
  labelPlacement,
@@ -1225,6 +1239,7 @@ var JSONViewModal = observer(() => {
1225
1239
  /* @__PURE__ */ React7.createElement("div", { className: "z-50 fixed top-0 left-0 w-screen h-screen" }, /* @__PURE__ */ React7.createElement(Draggable, { handle: ".draggable-handle" }, /* @__PURE__ */ React7.createElement(ModalContent, null, complexFormModal.title && /* @__PURE__ */ React7.createElement(ModalHeader, { className: "flex flex-col gap-1 draggable-handle cursor-move" }, complexFormModal.title), /* @__PURE__ */ React7.createElement(ModalBody, { className: cn("max-h-[90vh] overflow-auto") }, /* @__PURE__ */ React7.createElement(
1226
1240
  JSONForm,
1227
1241
  {
1242
+ theme: complexFormModal.theme,
1228
1243
  formData,
1229
1244
  formConfig: complexFormModal.formConfig,
1230
1245
  layoutConfig,
@@ -1249,14 +1264,14 @@ var ComplexFormModalStore = class {
1249
1264
  this.isOpen = false;
1250
1265
  this.title = "";
1251
1266
  this.className = "";
1252
- this.classNames = {
1253
- base: "dark:bg-[#09090B] border dark:border-[#2c2c2c] rounded-lg shadow-md"
1254
- };
1267
+ this.theme = "default";
1255
1268
  this.modalSize = "md";
1256
1269
  this.scrollBehavior = "normal";
1257
1270
  this.isDismissable = true;
1258
1271
  this.event = new EventEmitter();
1259
- Object.assign(this, args);
1272
+ const modalStyle = getStyle((args == null ? void 0 : args.theme) || "default", "Modal");
1273
+ const classNames = __spreadValues(__spreadValues({}, modalStyle.classNames), args == null ? void 0 : args.classNames);
1274
+ Object.assign(this, args, { classNames });
1260
1275
  makeAutoObservable(this);
1261
1276
  }
1262
1277
  setData(v) {
@@ -1268,10 +1283,6 @@ var ComplexFormModalStore = class {
1268
1283
  this.formData = void 0;
1269
1284
  this.formConfig = void 0;
1270
1285
  this.layoutConfig = void 0;
1271
- this.className = "";
1272
- this.classNames = {
1273
- base: "dark:bg-[#09090B] border dark:border-[#2c2c2c] rounded-lg shadow-md"
1274
- };
1275
1286
  this.modalSize = "md";
1276
1287
  this.scrollBehavior = "normal";
1277
1288
  this.isDismissable = true;
@@ -1284,8 +1295,11 @@ var ComplexFormModalStore = class {
1284
1295
  };
1285
1296
  async function getComplexFormData(v) {
1286
1297
  return new Promise((resolve, reject) => {
1298
+ const modalStyle = getStyle((v == null ? void 0 : v.theme) || "default", "Modal");
1299
+ const classNames = __spreadValues(__spreadValues({}, modalStyle.classNames), v == null ? void 0 : v.classNames);
1287
1300
  const complexFormModal = RootStore.Get(ComplexFormModalStore);
1288
1301
  complexFormModal.setData(__spreadProps(__spreadValues({}, v), {
1302
+ classNames,
1289
1303
  isOpen: true
1290
1304
  }));
1291
1305
  complexFormModal.event.on("batchSubmit", (formData) => {
@@ -1338,14 +1352,14 @@ var FormModalStore = class {
1338
1352
  this.title = "";
1339
1353
  this.form = null;
1340
1354
  this.className = "";
1341
- this.classNames = {
1342
- base: "dark:bg-[#09090B] border dark:border-[#2c2c2c] rounded-lg shadow-md"
1343
- };
1355
+ this.theme = "default";
1344
1356
  this.modalSize = "md";
1345
1357
  this.scrollBehavior = "normal";
1346
1358
  this.closeOnOverlayClick = false;
1347
1359
  this.event = new EventEmitter();
1348
- Object.assign(this, args);
1360
+ const modalStyle = getStyle((args == null ? void 0 : args.theme) || "default", "Modal");
1361
+ const classNames = __spreadValues(__spreadValues({}, modalStyle.classNames), args == null ? void 0 : args.classNames);
1362
+ Object.assign(this, args, { classNames });
1349
1363
  makeAutoObservable(this);
1350
1364
  }
1351
1365
  setData(v) {
@@ -1355,10 +1369,6 @@ var FormModalStore = class {
1355
1369
  this.isOpen = false;
1356
1370
  this.title = "";
1357
1371
  this.form = null;
1358
- this.className = "";
1359
- this.classNames = {
1360
- base: "dark:bg-[#09090B] border dark:border-[#2c2c2c] rounded-lg shadow-md"
1361
- };
1362
1372
  this.modalSize = "md";
1363
1373
  this.scrollBehavior = "normal";
1364
1374
  this.closeOnOverlayClick = false;
@@ -1368,8 +1378,11 @@ var FormModalStore = class {
1368
1378
  };
1369
1379
  async function getFormData(v) {
1370
1380
  return new Promise((resolve, reject) => {
1381
+ const modalStyle = getStyle((v == null ? void 0 : v.theme) || "default", "Modal");
1382
+ const classNames = __spreadValues(__spreadValues({}, modalStyle.classNames), v == null ? void 0 : v.classNames);
1371
1383
  const formModal = RootStore.Get(FormModalStore);
1372
1384
  formModal.setData(__spreadProps(__spreadValues({}, v), {
1385
+ classNames,
1373
1386
  isOpen: true
1374
1387
  }));
1375
1388
  formModal.event.on("afterSubmit", (formData) => {
@@ -1390,7 +1403,8 @@ function getFormState2({
1390
1403
  data,
1391
1404
  metadata = {},
1392
1405
  onSet = (v, form) => v,
1393
- onSubmit
1406
+ onSubmit,
1407
+ theme = "default"
1394
1408
  }) {
1395
1409
  const value = {};
1396
1410
  const required = [];
@@ -1445,6 +1459,7 @@ function getFormState2({
1445
1459
  required.push(k);
1446
1460
  delete metadata[k].required;
1447
1461
  }
1462
+ metadata[k]["theme"] = theme;
1448
1463
  return p;
1449
1464
  }, {});
1450
1465
  const schema = {
@@ -1479,8 +1494,8 @@ function getFormState2({
1479
1494
  }
1480
1495
  async function getSimpleFormData(data, metadata = {}, config, onSet = (v, form) => {
1481
1496
  return v;
1482
- }) {
1483
- const form = getFormState2({ data, metadata, onSet });
1497
+ }, theme = "default") {
1498
+ const form = getFormState2({ data, metadata, onSet, theme });
1484
1499
  return getFormData(__spreadProps(__spreadValues({}, config), {
1485
1500
  //@ts-ignore
1486
1501
  form