@dappworks/kit 0.4.88 → 0.4.90

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/form.mjs CHANGED
@@ -2,10 +2,10 @@ import { useStore } from './chunk-DZMNL4BZ.mjs';
2
2
  import { RootStore } from './chunk-HRWHDF2F.mjs';
3
3
  import { helper } from './chunk-XAIZMT2F.mjs';
4
4
  import { _ } from './chunk-MGU3KYGC.mjs';
5
- import { cn } from './chunk-WYGQ3Y4R.mjs';
5
+ import { cn } from './chunk-TMFAGW4V.mjs';
6
6
  import { __objRest, __spreadValues, __spreadProps } from './chunk-6F7H4PAA.mjs';
7
- import React6, { useEffect, useMemo, useState, useCallback, useRef, createRef } from 'react';
8
- import { Modal, ModalContent, ModalHeader, ModalBody, Checkbox, Input, Select, SelectItem, Button, Textarea, DatePicker, Card, Tabs, Tab } from '@nextui-org/react';
7
+ import React7, { useEffect, useMemo, useState, useCallback, useRef, createRef } from 'react';
8
+ import { Modal, ModalContent, ModalHeader, ModalBody, Checkbox, Input, Select, SelectItem, Button, Textarea, DatePicker, Chip, Card, Tabs, Tab } from '@nextui-org/react';
9
9
  import { Check, ChevronUp, ChevronDown } from 'lucide-react';
10
10
  import MonacoEditor from '@monaco-editor/react';
11
11
  import validator from '@rjsf/validator-ajv8';
@@ -29,7 +29,7 @@ function CheckboxWidget({
29
29
  const { validate } = uiSchema;
30
30
  const [errMsg, setErrMsg] = useState("");
31
31
  const isInvalid = !!errMsg;
32
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
32
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
33
33
  Checkbox,
34
34
  {
35
35
  className: cn("w-full", className),
@@ -38,7 +38,7 @@ function CheckboxWidget({
38
38
  },
39
39
  defaultSelected: value,
40
40
  isDisabled: disabled,
41
- icon: /* @__PURE__ */ React6.createElement(Check, { className: "bg-white dark:bg-black" }),
41
+ icon: /* @__PURE__ */ React7.createElement(Check, { className: "bg-white dark:bg-black" }),
42
42
  color,
43
43
  size,
44
44
  onChange: (e) => {
@@ -55,13 +55,15 @@ function CheckboxWidget({
55
55
  }
56
56
  },
57
57
  label
58
- ), description && /* @__PURE__ */ React6.createElement("div", { className: cn("mt-1 text-xs text-[#A1A1A9] dark:text-[#717179]", descriptionClassName) }, description), isInvalid && /* @__PURE__ */ React6.createElement("div", { className: "mt-2 text-xs text-[#DF3562]" }, errMsg));
58
+ ), description && /* @__PURE__ */ React7.createElement("div", { className: cn("mt-1 text-xs text-[#A1A1A9] dark:text-[#717179]", descriptionClassName) }, description), isInvalid && /* @__PURE__ */ React7.createElement("div", { className: "mt-2 text-xs text-[#DF3562]" }, errMsg));
59
59
  }
60
60
  function InputWidget(props) {
61
+ var _a;
61
62
  const { onChange, options, label, value, required, disabled, uiSchema } = props;
62
- const { className, nextuiClassNames, labelPlacement = "inside", size = "sm", inputType = "text", placeholder, color, variant, radius, startContent, endContent, description } = options;
63
+ const { className, nextuiClassNames, labelPlacement = "inside", size = "sm", inputType = "text", color, variant, radius, startContent, endContent, description } = options;
63
64
  const { requiredErrMsg, validate } = uiSchema;
64
- return /* @__PURE__ */ React6.createElement(
65
+ const placeholder = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder;
66
+ return /* @__PURE__ */ React7.createElement(
65
67
  Input,
66
68
  {
67
69
  className: cn("w-full", className),
@@ -95,6 +97,7 @@ function InputWidget(props) {
95
97
  );
96
98
  }
97
99
  function SelectWidget(props) {
100
+ var _a;
98
101
  const { onChange, options, label, value, required, disabled, uiSchema } = props;
99
102
  const {
100
103
  className,
@@ -118,13 +121,13 @@ function SelectWidget(props) {
118
121
  },
119
122
  labelPlacement = "inside",
120
123
  size = "sm",
121
- placeholder = "Select an option",
122
124
  color,
123
125
  variant,
124
126
  radius,
125
127
  description
126
128
  } = options;
127
129
  const { selectOptions = [], requiredErrMsg, validate } = uiSchema;
130
+ const placeholder = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder;
128
131
  const [errMsg, setErrMsg] = useState("");
129
132
  const isInvalid = !!errMsg;
130
133
  const checkValue = useCallback((value2) => {
@@ -139,7 +142,7 @@ function SelectWidget(props) {
139
142
  }
140
143
  setErrMsg("");
141
144
  }, []);
142
- return /* @__PURE__ */ React6.createElement(
145
+ return /* @__PURE__ */ React7.createElement(
143
146
  Select,
144
147
  {
145
148
  label: label == null ? void 0 : label.trim(),
@@ -165,9 +168,82 @@ function SelectWidget(props) {
165
168
  checkValue(_v);
166
169
  }
167
170
  },
168
- selectOptions.map((item) => /* @__PURE__ */ React6.createElement(SelectItem, { key: item.value, value: item.value }, item.label))
171
+ selectOptions.map((item) => /* @__PURE__ */ React7.createElement(SelectItem, { key: item.value, value: item.value }, item.label))
172
+ );
173
+ }
174
+ function MultipleSelectWidget(props) {
175
+ var _a;
176
+ const { onChange, options, label, value, required, uiSchema = {} } = props;
177
+ const { selectOptions = [], requiredErrMsg, validate } = uiSchema;
178
+ const { className, labelPlacement = "inside", size = "sm", color, description, renderValue = DefaultRenderValue } = options;
179
+ const placeholder = ((_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder) || "Select an option";
180
+ const selectedKeys = useMemo(() => {
181
+ return value ? value.split(",") : [];
182
+ }, [value]);
183
+ const [errMsg, setErrMsg] = useState("");
184
+ const isInvalid = !!errMsg;
185
+ const checkValue = useCallback((value2) => {
186
+ if (!value2 && required) {
187
+ setErrMsg(requiredErrMsg || "This field is required");
188
+ return;
189
+ }
190
+ if (validate) {
191
+ const errMsg2 = validate(value2);
192
+ setErrMsg(errMsg2);
193
+ return;
194
+ }
195
+ setErrMsg("");
196
+ }, []);
197
+ return /* @__PURE__ */ React7.createElement(
198
+ Select,
199
+ {
200
+ className: cn("w-full", className),
201
+ label,
202
+ isMultiline: true,
203
+ selectionMode: "multiple",
204
+ labelPlacement,
205
+ size,
206
+ placeholder,
207
+ selectedKeys,
208
+ isRequired: required,
209
+ color: isInvalid ? "danger" : color,
210
+ errorMessage: isInvalid && errMsg,
211
+ onSelectionChange: (v) => {
212
+ const keys = Array.from(v);
213
+ const _v = keys.join(",");
214
+ onChange(_v);
215
+ checkValue(_v);
216
+ },
217
+ items: selectOptions,
218
+ classNames: {
219
+ base: "w-full",
220
+ trigger: "min-h-12 py-1",
221
+ popoverContent: "rounded-lg shadow-md border dark:border-[#3e3e3e]"
222
+ },
223
+ listboxProps: {
224
+ itemClasses: {
225
+ base: [
226
+ "rounded-lg",
227
+ "text-default-500",
228
+ "transition-opacity",
229
+ "data-[hover=true]:text-foreground",
230
+ "data-[hover=true]:bg-default-100",
231
+ "dark:data-[hover=true]:bg-default-50",
232
+ "data-[selectable=true]:focus:bg-default-50",
233
+ "data-[pressed=true]:opacity-70",
234
+ "data-[focus-visible=true]:ring-default-500"
235
+ ]
236
+ }
237
+ },
238
+ description,
239
+ renderValue
240
+ },
241
+ selectOptions.map((item) => /* @__PURE__ */ React7.createElement(SelectItem, { key: item.value, textValue: item.label }, item.label))
169
242
  );
170
243
  }
244
+ function DefaultRenderValue(items) {
245
+ return /* @__PURE__ */ React7.createElement("div", { className: "flex flex-wrap gap-2" }, items.map((item) => /* @__PURE__ */ React7.createElement(Chip, { color: "secondary", size: "sm", key: item.key }, item.textValue)));
246
+ }
171
247
  var EditorWidget = ({ label, options = {}, value, required, uiSchema, disabled, onChange }) => {
172
248
  const { editorHeight = "200px", readOnly = false, language = "json", jsonStrSpace, languageSelectorOptions = [], description, descriptionClassName, errMsgClassName, onChangeLanguage, onRun, onMount } = options;
173
249
  const { requiredErrMsg, validate } = uiSchema;
@@ -190,14 +266,14 @@ var EditorWidget = ({ label, options = {}, value, required, uiSchema, disabled,
190
266
  setErrMsg("");
191
267
  }, 1e3)
192
268
  ).current;
193
- return /* @__PURE__ */ React6.createElement("div", { className: "flex flex-col relative" }, /* @__PURE__ */ React6.createElement("div", { className: cn("flex justify-between items-center", { "mb-[10px]": label.trim() || showLanguageSelector }) }, label && /* @__PURE__ */ React6.createElement(
269
+ return /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col relative" }, /* @__PURE__ */ React7.createElement("div", { className: cn("flex justify-between items-center", { "mb-[10px]": label.trim() || showLanguageSelector }) }, label && /* @__PURE__ */ React7.createElement(
194
270
  "label",
195
271
  {
196
272
  className: "mr-2 flex items-center text-sm"
197
273
  },
198
274
  label,
199
- required && /* @__PURE__ */ React6.createElement("span", { className: "font-bold text-red-600" }, "*")
200
- ), showLanguageSelector && /* @__PURE__ */ React6.createElement(
275
+ required && /* @__PURE__ */ React7.createElement("span", { className: "font-bold text-red-600" }, "*")
276
+ ), showLanguageSelector && /* @__PURE__ */ React7.createElement(
201
277
  "select",
202
278
  {
203
279
  className: "w-full p-3 text-sm rounded-md bg-[#F4F4F5] dark:bg-[#27272A]",
@@ -209,9 +285,9 @@ var EditorWidget = ({ label, options = {}, value, required, uiSchema, disabled,
209
285
  }
210
286
  },
211
287
  languageSelectorOptions.map((item) => {
212
- return /* @__PURE__ */ React6.createElement("option", { key: item.value, value: item.value }, item.label);
288
+ return /* @__PURE__ */ React7.createElement("option", { key: item.value, value: item.value }, item.label);
213
289
  })
214
- )), description && /* @__PURE__ */ React6.createElement("div", { className: cn("mb-2 text-xs text-[#A1A1A9] dark:text-[#717179]", descriptionClassName) }, description), /* @__PURE__ */ React6.createElement("div", { className: "rounded-lg overflow-hidden relative" }, /* @__PURE__ */ React6.createElement(
290
+ )), description && /* @__PURE__ */ React7.createElement("div", { className: cn("mb-2 text-xs text-[#A1A1A9] dark:text-[#717179]", descriptionClassName) }, description), /* @__PURE__ */ React7.createElement("div", { className: "rounded-lg overflow-hidden relative" }, /* @__PURE__ */ React7.createElement(
215
291
  MonacoEditor,
216
292
  {
217
293
  options: { readOnly: readOnly || disabled, minimap: { enabled: false } },
@@ -231,7 +307,7 @@ var EditorWidget = ({ label, options = {}, value, required, uiSchema, disabled,
231
307
  }
232
308
  }
233
309
  }
234
- )), isInvalid && /* @__PURE__ */ React6.createElement("div", { className: cn("mt-2 text-xs text-[#DF3562]", errMsgClassName) }, errMsg), onRun && /* @__PURE__ */ React6.createElement(
310
+ )), isInvalid && /* @__PURE__ */ React7.createElement("div", { className: cn("mt-2 text-xs text-[#DF3562]", errMsgClassName) }, errMsg), onRun && /* @__PURE__ */ React7.createElement(
235
311
  Button,
236
312
  {
237
313
  className: "absolute bottom-2 right-4",
@@ -343,7 +419,7 @@ var getFormState = (props, formLayout = {}) => {
343
419
  const value = {};
344
420
  const required = [];
345
421
  const properties = Object.entries(metadata).reduce((p, c) => {
346
- var _a2, _b, _c;
422
+ var _a2, _b, _c, _d;
347
423
  const [k, v] = c;
348
424
  const type = typeof v;
349
425
  p[k] = {
@@ -361,7 +437,11 @@ var getFormState = (props, formLayout = {}) => {
361
437
  }
362
438
  if (type === "string" || type === "number") {
363
439
  if ((_c = formConfigData[k]) == null ? void 0 : _c.selectOptions) {
364
- formConfigData[k]["ui:widget"] = SelectWidget;
440
+ if ((_d = formConfigData[k]) == null ? void 0 : _d.isMultipleSelect) {
441
+ formConfigData[k]["ui:widget"] = MultipleSelectWidget;
442
+ } else {
443
+ formConfigData[k]["ui:widget"] = SelectWidget;
444
+ }
365
445
  } else {
366
446
  if (!formConfigData[k]["ui:widget"]) {
367
447
  formConfigData[k]["ui:widget"] = InputWidget;
@@ -437,7 +517,7 @@ var getFormState = (props, formLayout = {}) => {
437
517
  var BatchSubmitButton = ({ formStates, onSubmit, buttonProps }) => {
438
518
  const _a = buttonProps || {}, { className, onClick, children, isLoading, onBatchSubmit } = _a, rest = __objRest(_a, ["className", "onClick", "children", "isLoading", "onBatchSubmit"]);
439
519
  const [loading, setLoading] = useState(false);
440
- return /* @__PURE__ */ React6.createElement(
520
+ return /* @__PURE__ */ React7.createElement(
441
521
  Button,
442
522
  __spreadValues({
443
523
  className: cn("mt-4 ml-auto", className),
@@ -488,7 +568,7 @@ var BatchSubmitButton = ({ formStates, onSubmit, buttonProps }) => {
488
568
  var SubmitButton = ({ formKey, formState, buttonProps }) => {
489
569
  const _a = buttonProps || {}, { className, onClick, children, isLoading, onAfterSubmit } = _a, rest = __objRest(_a, ["className", "onClick", "children", "isLoading", "onAfterSubmit"]);
490
570
  const [loading, setLoading] = useState(false);
491
- return /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(
571
+ return /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(
492
572
  Button,
493
573
  __spreadValues({
494
574
  className: cn("mt-4 ml-auto", className),
@@ -529,10 +609,10 @@ var SubmitButton = ({ formKey, formState, buttonProps }) => {
529
609
  ));
530
610
  };
531
611
  var CustomButton = ({ formKey, formState, buttonProps }) => {
532
- return /* @__PURE__ */ React6.createElement("div", { className: "w-full flex gap-2" }, buttonProps.map((i, index) => {
612
+ return /* @__PURE__ */ React7.createElement("div", { className: "w-full flex gap-2" }, buttonProps.map((i, index) => {
533
613
  const [loading, setLoading] = useState(false);
534
614
  const _a = i, { className, onClick, title } = _a, rest = __objRest(_a, ["className", "onClick", "title"]);
535
- return /* @__PURE__ */ React6.createElement(
615
+ return /* @__PURE__ */ React7.createElement(
536
616
  Button,
537
617
  __spreadValues({
538
618
  className: cn("mt-4", className),
@@ -560,51 +640,51 @@ function FieldTemplate(props) {
560
640
  const isDateTime = uiSchema && uiSchema["ui:widget"] === "date-time";
561
641
  const isTime = uiSchema && uiSchema["ui:widget"] === "time";
562
642
  const showLabel = isDate || isDateTime || isTime;
563
- return /* @__PURE__ */ React6.createElement("div", { className: cn(classNames) }, showLabel && /* @__PURE__ */ React6.createElement("label", { htmlFor: id, className: cn("flex items-center h-8") }, /* @__PURE__ */ React6.createElement("span", { className: "text-sm" }, label), required && /* @__PURE__ */ React6.createElement("span", { className: "font-bold text-red-600" }, "*")), children);
643
+ return /* @__PURE__ */ React7.createElement("div", { className: cn(classNames) }, showLabel && /* @__PURE__ */ React7.createElement("label", { htmlFor: id, className: cn("flex items-center h-8") }, /* @__PURE__ */ React7.createElement("span", { className: "text-sm" }, label), required && /* @__PURE__ */ React7.createElement("span", { className: "font-bold text-red-600" }, "*")), children);
564
644
  }
565
645
  var renderLayout = (layout, fields, n = 1) => {
566
646
  n++;
567
647
  return layout.map((item, index) => {
568
648
  if (Array.isArray(item)) {
569
649
  const even = (n & 1) === 0;
570
- return /* @__PURE__ */ React6.createElement("div", { key: index, className: cn("w-full flex justify-between items-center space-x-2", even ? "flex-row items-start" : "flex-col") }, renderLayout(item, fields, n));
650
+ return /* @__PURE__ */ React7.createElement("div", { key: index, className: cn("w-full flex justify-between items-center space-x-2", even ? "flex-row items-start" : "flex-col") }, renderLayout(item, fields, n));
571
651
  } else {
572
- return /* @__PURE__ */ React6.createElement("div", { className: "w-full", key: index }, fields[item]);
652
+ return /* @__PURE__ */ React7.createElement("div", { className: "w-full", key: index }, fields[item]);
573
653
  }
574
654
  });
575
655
  };
576
656
  var ObjectFieldTemplate = ({ title, idSchema: { $id }, properties, uiSchema: { layout } }) => {
577
657
  const [opened, setOpened] = useState(false);
578
658
  const fields = Object.fromEntries(properties.map((item) => [item.name, item.content]));
579
- return /* @__PURE__ */ React6.createElement("div", { className: "w-full space-y-2.5" }, $id === "root" ? layout ? renderLayout(layout, fields) : properties.map((element) => {
580
- return /* @__PURE__ */ React6.createElement("div", { key: element.content.key }, element.content);
581
- }) : /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
659
+ return /* @__PURE__ */ React7.createElement("div", { className: "w-full space-y-2.5" }, $id === "root" ? layout ? renderLayout(layout, fields) : properties.map((element) => {
660
+ return /* @__PURE__ */ React7.createElement("div", { key: element.content.key }, element.content);
661
+ }) : /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
582
662
  "div",
583
663
  {
584
664
  className: "mt-5 mb-[10px] flex justify-between items-center cursor-pointer border-t-[1px solid #E5E5EA] py-[5px] hover:bg-[#F2F2F7] dark:hover:bg-gray-900",
585
665
  onClick: () => setOpened((o) => !o)
586
666
  },
587
- /* @__PURE__ */ React6.createElement("div", { className: "text-gray-900 dark:text-gray-100 font-bold text-base" }, title),
588
- opened ? /* @__PURE__ */ React6.createElement(ChevronUp, null) : /* @__PURE__ */ React6.createElement(ChevronDown, null)
589
- ), /* @__PURE__ */ React6.createElement("div", { className: cn("mt-2 space-y-2.5", opened ? "block" : "hidden") }, layout ? renderLayout(layout, fields) : properties.map((element) => {
590
- return /* @__PURE__ */ React6.createElement("div", { key: element.content.key }, element.content);
667
+ /* @__PURE__ */ React7.createElement("div", { className: "text-gray-900 dark:text-gray-100 font-bold text-base" }, title),
668
+ opened ? /* @__PURE__ */ React7.createElement(ChevronUp, null) : /* @__PURE__ */ React7.createElement(ChevronDown, null)
669
+ ), /* @__PURE__ */ React7.createElement("div", { className: cn("mt-2 space-y-2.5", opened ? "block" : "hidden") }, layout ? renderLayout(layout, fields) : properties.map((element) => {
670
+ return /* @__PURE__ */ React7.createElement("div", { key: element.content.key }, element.content);
591
671
  }))));
592
672
  };
593
673
  var ErrorListTemplate = ({ errors }) => {
594
- return /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", { className: "font-bold" }, "Errors"), /* @__PURE__ */ React6.createElement("div", { className: "mt-[10px]" }, errors.map((error) => /* @__PURE__ */ React6.createElement("div", { className: "mb-[10px]", color: "red", key: error.property }, error.stack))));
674
+ return /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement("div", { className: "font-bold" }, "Errors"), /* @__PURE__ */ React7.createElement("div", { className: "mt-[10px]" }, errors.map((error) => /* @__PURE__ */ React7.createElement("div", { className: "mb-[10px]", color: "red", key: error.property }, error.stack))));
595
675
  };
596
676
  var SubmitButton2 = ({ uiSchema }) => {
597
677
  const { submitText, norender, props: submitButtonProps = {} } = Utils.getSubmitButtonOptions(uiSchema);
598
678
  if (norender) {
599
679
  return null;
600
680
  }
601
- return /* @__PURE__ */ React6.createElement("div", { className: "flex justify-end mt-4" }, /* @__PURE__ */ React6.createElement(Button, { type: "submit", color: "primary", size: "sm" }, submitText));
681
+ return /* @__PURE__ */ React7.createElement("div", { className: "flex justify-end mt-4" }, /* @__PURE__ */ React7.createElement(Button, { type: "submit", color: "primary", size: "sm" }, submitText));
602
682
  };
603
683
  var JSONSchemaForm = observer(({ children, formState }) => {
604
684
  var _a;
605
685
  if (!((_a = formState == null ? void 0 : formState.dynamicData) == null ? void 0 : _a.ready))
606
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null);
607
- return /* @__PURE__ */ React6.createElement(
686
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
687
+ return /* @__PURE__ */ React7.createElement(
608
688
  Form,
609
689
  {
610
690
  showErrorList: "bottom",
@@ -751,7 +831,7 @@ var colSpanLg = {
751
831
  };
752
832
 
753
833
  // components/ui/grid/col.tsx
754
- var Col = React6.forwardRef((props, ref) => {
834
+ var Col = React7.forwardRef((props, ref) => {
755
835
  const _a = props, { numColSpan = 1, numColSpanSm, numColSpanMd, numColSpanLg, children, className } = _a, other = __objRest(_a, ["numColSpan", "numColSpanSm", "numColSpanMd", "numColSpanLg", "children", "className"]);
756
836
  const getColSpan = (numColSpan2, colSpanMapping) => {
757
837
  if (!numColSpan2)
@@ -767,7 +847,7 @@ var Col = React6.forwardRef((props, ref) => {
767
847
  const spanLg = getColSpan(numColSpanLg, colSpanLg);
768
848
  return cn(spanBase, spanSm, spanMd, spanLg);
769
849
  };
770
- return /* @__PURE__ */ React6.createElement("div", __spreadValues({ ref, className: cn(getColSpanClassNames(), className) }, other), children);
850
+ return /* @__PURE__ */ React7.createElement("div", __spreadValues({ ref, className: cn(getColSpanClassNames(), className) }, other), children);
771
851
  });
772
852
  Col.displayName = "Col";
773
853
  var col_default = Col;
@@ -778,14 +858,14 @@ var getGridCols = (numCols, gridColsMapping) => {
778
858
  return "";
779
859
  return gridColsMapping[numCols];
780
860
  };
781
- var Grid = React6.forwardRef((props, ref) => {
861
+ var Grid = React7.forwardRef((props, ref) => {
782
862
  const _a = props, { numItems = 1, numItemsSm, numItemsMd, numItemsLg, children, className } = _a, other = __objRest(_a, ["numItems", "numItemsSm", "numItemsMd", "numItemsLg", "children", "className"]);
783
863
  const colsBase = getGridCols(numItems, gridCols);
784
864
  const colsSm = getGridCols(numItemsSm, gridColsSm);
785
865
  const colsMd = getGridCols(numItemsMd, gridColsMd);
786
866
  const colsLg = getGridCols(numItemsLg, gridColsLg);
787
867
  const colClassNames = cn(colsBase, colsSm, colsMd, colsLg);
788
- return /* @__PURE__ */ React6.createElement("div", __spreadValues({ ref, className: cn("grid", colClassNames, className) }, other), children);
868
+ return /* @__PURE__ */ React7.createElement("div", __spreadValues({ ref, className: cn("grid", colClassNames, className) }, other), children);
789
869
  });
790
870
  Grid.displayName = "Grid";
791
871
  var grid_default = Grid;
@@ -800,23 +880,23 @@ var GridLayout = (props) => {
800
880
  onReady(formStates);
801
881
  }
802
882
  }, [formStates]);
803
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(grid_default, { numItems: $gridColumn != null ? $gridColumn : 1, className: "gap-2" }, Object.keys(formStates).map((key) => {
883
+ 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) => {
804
884
  var _a2;
805
885
  const layout = formLayout[key];
806
- return /* @__PURE__ */ React6.createElement(col_default, { numColSpan: (_a2 = layout == null ? void 0 : layout.colSpan) != null ? _a2 : 1, key, id: `form-${key}` }, /* @__PURE__ */ React6.createElement(Card, { className: cn("h-full m-0 p-4 shadow-sm border dark:border-[#3e3e3e]", layout == null ? void 0 : layout.cardCss) }, /* @__PURE__ */ React6.createElement("div", { className: cn("mb-2 font-bold text-center", layout == null ? void 0 : layout.titleBoxCss) }, (layout == null ? void 0 : layout.title) || key), /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps }), (layout == null ? void 0 : layout.customButtonProps) && /* @__PURE__ */ React6.createElement(CustomButton, { formKey: key, formState: formStates[key], buttonProps: layout.customButtonProps }))));
807
- })), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
886
+ 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]", 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 }))));
887
+ })), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
808
888
  };
809
889
  var CollapsibleBox = ({ formKey, title, titleBoxCss, formState, submitButtonProps, customButtonProps }) => {
810
890
  const [opened, setOpened] = useState(true);
811
- return /* @__PURE__ */ React6.createElement("div", { id: `form-${formKey}` }, /* @__PURE__ */ React6.createElement(
891
+ return /* @__PURE__ */ React7.createElement("div", { id: `form-${formKey}` }, /* @__PURE__ */ React7.createElement(
812
892
  "div",
813
893
  {
814
894
  className: "mt-5 mb-[10px] flex justify-between items-center cursor-pointer border-t-[1px solid #E5E5EA] py-[5px] hover:bg-[#F2F2F7] dark:hover:bg-gray-900",
815
895
  onClick: () => setOpened((o) => !o)
816
896
  },
817
- /* @__PURE__ */ React6.createElement("div", { className: cn("text-gray-900 dark:text-gray-100 font-bold text-base", titleBoxCss) }, title),
818
- opened ? /* @__PURE__ */ React6.createElement(ChevronUp, null) : /* @__PURE__ */ React6.createElement(ChevronDown, null)
819
- ), /* @__PURE__ */ React6.createElement("div", { className: cn("mt-2", opened ? "block" : "hidden") }, /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState }, submitButtonProps && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey, formState, buttonProps: submitButtonProps }), customButtonProps && /* @__PURE__ */ React6.createElement(CustomButton, { formKey, formState, buttonProps: customButtonProps }))));
897
+ /* @__PURE__ */ React7.createElement("div", { className: cn("text-gray-900 dark:text-gray-100 font-bold text-base", titleBoxCss) }, title),
898
+ opened ? /* @__PURE__ */ React7.createElement(ChevronUp, null) : /* @__PURE__ */ React7.createElement(ChevronDown, null)
899
+ ), /* @__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 }))));
820
900
  };
821
901
  var ListLayout = (props) => {
822
902
  const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
@@ -827,10 +907,10 @@ var ListLayout = (props) => {
827
907
  onReady(formStates);
828
908
  }
829
909
  }, [formStates]);
830
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, Object.keys(formStates).map((key) => {
910
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, Object.keys(formStates).map((key) => {
831
911
  const layout = formLayout[key];
832
912
  const formState = formStates[key];
833
- return /* @__PURE__ */ React6.createElement(
913
+ return /* @__PURE__ */ React7.createElement(
834
914
  CollapsibleBox,
835
915
  {
836
916
  key,
@@ -842,7 +922,7 @@ var ListLayout = (props) => {
842
922
  customButtonProps: layout == null ? void 0 : layout.customButtonProps
843
923
  }
844
924
  );
845
- }), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
925
+ }), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
846
926
  };
847
927
  var SimpleLayout = (props) => {
848
928
  const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
@@ -853,10 +933,10 @@ var SimpleLayout = (props) => {
853
933
  onReady(formStates);
854
934
  }
855
935
  }, [formStates]);
856
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("div", { className: "space-y-2" }, Object.keys(formStates).map((key) => {
936
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("div", { className: "space-y-2" }, Object.keys(formStates).map((key) => {
857
937
  const layout = formLayout[key];
858
- return /* @__PURE__ */ React6.createElement("div", { key, id: `form-${key}` }, /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps })));
859
- })), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
938
+ return /* @__PURE__ */ React7.createElement("div", { key, id: `form-${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 })));
939
+ })), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
860
940
  };
861
941
  var TabLayout = (props) => {
862
942
  const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
@@ -877,7 +957,7 @@ var TabLayout = (props) => {
877
957
  onReady(formStates);
878
958
  }
879
959
  }, [formStates]);
880
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
960
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
881
961
  Tabs,
882
962
  __spreadProps(__spreadValues({}, $tabsProps), {
883
963
  selectedKey: selectedTab,
@@ -887,20 +967,20 @@ var TabLayout = (props) => {
887
967
  }),
888
968
  formKeys.map((key) => {
889
969
  const layout = formLayout[key];
890
- return /* @__PURE__ */ React6.createElement(Tab, { id: `form-${key}-tab-menu`, key, title: /* @__PURE__ */ React6.createElement("div", { className: layout == null ? void 0 : layout.titleBoxCss }, (layout == null ? void 0 : layout.title) || key) });
970
+ return /* @__PURE__ */ React7.createElement(Tab, { id: `form-${key}-tab-menu`, key, title: /* @__PURE__ */ React7.createElement("div", { className: layout == null ? void 0 : layout.titleBoxCss }, (layout == null ? void 0 : layout.title) || key) });
891
971
  })
892
972
  ), formKeys.map((key) => {
893
973
  const layout = formLayout[key];
894
- return /* @__PURE__ */ React6.createElement(
974
+ return /* @__PURE__ */ React7.createElement(
895
975
  "div",
896
976
  {
897
977
  key,
898
978
  id: `form-${key}-tab-content`,
899
979
  className: cn("mt-4", selectedTab === key ? "" : "hidden")
900
980
  },
901
- /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps }), (layout == null ? void 0 : layout.customButtonProps) && /* @__PURE__ */ React6.createElement(CustomButton, { formKey: key, formState: formStates[key], buttonProps: layout.customButtonProps }))
981
+ /* @__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 }))
902
982
  );
903
- }), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
983
+ }), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React7.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React7.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
904
984
  };
905
985
 
906
986
  // components/JSONForm/index.tsx
@@ -914,18 +994,20 @@ var JSONForm = (props) => {
914
994
  var _a;
915
995
  const type = ((_a = props.layoutConfig) == null ? void 0 : _a.$type) || "SimpleLayout";
916
996
  const Component = components[type];
917
- return /* @__PURE__ */ React6.createElement(
997
+ return /* @__PURE__ */ React7.createElement(
918
998
  "div",
919
999
  { className: props.className },
920
1000
  // @ts-ignore
921
- /* @__PURE__ */ React6.createElement(Component, __spreadValues({}, props))
1001
+ /* @__PURE__ */ React7.createElement(Component, __spreadValues({}, props))
922
1002
  );
923
1003
  };
924
1004
  function TextareaWidget(props) {
1005
+ var _a;
925
1006
  const { onChange, options, label, value, required, disabled, uiSchema } = props;
926
- const { className, nextuiClassNames, labelPlacement = "inside", size = "md", minRows = 3, maxRows = 8, placeholder, color, variant, radius, startContent, endContent, description } = options;
1007
+ const { className, nextuiClassNames, labelPlacement = "inside", size = "md", minRows = 3, maxRows = 8, color, variant, radius, startContent, endContent, description } = options;
927
1008
  const { requiredErrMsg, validate } = uiSchema;
928
- return /* @__PURE__ */ React6.createElement(
1009
+ const placeholder = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.placeholder;
1010
+ return /* @__PURE__ */ React7.createElement(
929
1011
  Textarea,
930
1012
  {
931
1013
  className: cn("w-full", className),
@@ -974,7 +1056,7 @@ function DatePickerWidget({ label, options, value, required, disabled, uiSchema,
974
1056
  }
975
1057
  }
976
1058
  }, [value]);
977
- return /* @__PURE__ */ React6.createElement(
1059
+ return /* @__PURE__ */ React7.createElement(
978
1060
  DatePicker,
979
1061
  {
980
1062
  showMonthAndYearPickers: true,
@@ -1039,7 +1121,7 @@ var JSONViewModal = observer(() => {
1039
1121
  }
1040
1122
  });
1041
1123
  }
1042
- return /* @__PURE__ */ React6.createElement(
1124
+ return /* @__PURE__ */ React7.createElement(
1043
1125
  Modal,
1044
1126
  {
1045
1127
  className: complexFormModal.className,
@@ -1054,7 +1136,7 @@ var JSONViewModal = observer(() => {
1054
1136
  }
1055
1137
  }
1056
1138
  },
1057
- /* @__PURE__ */ React6.createElement("div", { className: "z-50 fixed top-0 left-0 w-screen h-screen" }, /* @__PURE__ */ React6.createElement(Draggable, { handle: ".draggable-handle" }, /* @__PURE__ */ React6.createElement(ModalContent, null, complexFormModal.title && /* @__PURE__ */ React6.createElement(ModalHeader, { className: "flex flex-col gap-1 draggable-handle cursor-move" }, complexFormModal.title), /* @__PURE__ */ React6.createElement(ModalBody, { className: cn("max-h-[90vh] overflow-auto") }, /* @__PURE__ */ React6.createElement(
1139
+ /* @__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(
1058
1140
  JSONForm,
1059
1141
  {
1060
1142
  formData,
@@ -1077,7 +1159,7 @@ var Provider_default = JSONViewModal;
1077
1159
  var ComplexFormModalStore = class {
1078
1160
  constructor(args) {
1079
1161
  this.sid = "ComplexFormModalStore";
1080
- this.provider = () => /* @__PURE__ */ React6.createElement(Provider_default, null);
1162
+ this.provider = () => /* @__PURE__ */ React7.createElement(Provider_default, null);
1081
1163
  this.isOpen = false;
1082
1164
  this.title = "";
1083
1165
  this.className = "";
@@ -1136,7 +1218,7 @@ var JSONFormModal = observer(() => {
1136
1218
  if (!form) {
1137
1219
  return null;
1138
1220
  }
1139
- return /* @__PURE__ */ React6.createElement(
1221
+ return /* @__PURE__ */ React7.createElement(
1140
1222
  Modal,
1141
1223
  {
1142
1224
  className: formModal.className,
@@ -1151,7 +1233,7 @@ var JSONFormModal = observer(() => {
1151
1233
  }
1152
1234
  }
1153
1235
  },
1154
- /* @__PURE__ */ React6.createElement("div", { className: "z-50 fixed top-0 left-0 w-screen h-screen flex items-center justify-center" }, /* @__PURE__ */ React6.createElement(Draggable, { handle: ".draggable-handle" }, /* @__PURE__ */ React6.createElement(ModalContent, null, formModal.title && /* @__PURE__ */ React6.createElement(ModalHeader, { className: "flex flex-col gap-1 draggable-handle cursor-move" }, formModal.title), /* @__PURE__ */ React6.createElement(ModalBody, { className: "max-h-[90vh] overflow-auto" }, /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: form })))))
1236
+ /* @__PURE__ */ React7.createElement("div", { className: "z-50 fixed top-0 left-0 w-screen h-screen flex items-center justify-center" }, /* @__PURE__ */ React7.createElement(Draggable, { handle: ".draggable-handle" }, /* @__PURE__ */ React7.createElement(ModalContent, null, formModal.title && /* @__PURE__ */ React7.createElement(ModalHeader, { className: "flex flex-col gap-1 draggable-handle cursor-move" }, formModal.title), /* @__PURE__ */ React7.createElement(ModalBody, { className: "max-h-[90vh] overflow-auto" }, /* @__PURE__ */ React7.createElement(JSONSchemaForm, { formState: form })))))
1155
1237
  );
1156
1238
  });
1157
1239
  var Provider_default2 = JSONFormModal;
@@ -1160,7 +1242,7 @@ var Provider_default2 = JSONFormModal;
1160
1242
  var FormModalStore = class {
1161
1243
  constructor(args) {
1162
1244
  this.sid = "FormModalStore";
1163
- this.provider = () => /* @__PURE__ */ React6.createElement(Provider_default2, null);
1245
+ this.provider = () => /* @__PURE__ */ React7.createElement(Provider_default2, null);
1164
1246
  this.isOpen = false;
1165
1247
  this.title = "";
1166
1248
  this.form = null;
@@ -1315,7 +1397,7 @@ var _JSONViewPlugin = class _JSONViewPlugin {
1315
1397
  this.JSONView = {
1316
1398
  Test: {
1317
1399
  name: "Test",
1318
- render: () => /* @__PURE__ */ React6.createElement("div", null, "Test")
1400
+ render: () => /* @__PURE__ */ React7.createElement("div", null, "Test")
1319
1401
  }
1320
1402
  };
1321
1403
  }
@@ -1333,7 +1415,7 @@ var _JSONViewPlugin = class _JSONViewPlugin {
1333
1415
  };
1334
1416
  _JSONViewPlugin.JSONView = (props) => {
1335
1417
  const jsonviewplugin = RootStore.Get(_JSONViewPlugin);
1336
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, Object.keys(props.uiConfigs).map((key) => {
1418
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, Object.keys(props.uiConfigs).map((key) => {
1337
1419
  const config = props.uiConfigs[key];
1338
1420
  const data = _.get(props.datas, key);
1339
1421
  const Component = jsonviewplugin.JSONView[config.type].render;
@@ -1345,11 +1427,11 @@ _JSONViewPlugin.JSONView = (props) => {
1345
1427
  });
1346
1428
  }
1347
1429
  });
1348
- return /* @__PURE__ */ React6.createElement(Component, { key, data, uiConfig: config });
1430
+ return /* @__PURE__ */ React7.createElement(Component, { key, data, uiConfig: config });
1349
1431
  }));
1350
1432
  };
1351
1433
  var JSONViewPlugin = _JSONViewPlugin;
1352
1434
 
1353
- export { CheckboxWidget, ComplexFormModalStore, DatePickerWidget, EditorWidget, FormModalStore, InputWidget, JSONForm, JSONSchemaForm, JSONViewPlugin, SelectWidget, TextareaWidget, getComplexFormData, getFormData, getFormState2 as getFormState, getSimpleFormData };
1435
+ export { CheckboxWidget, ComplexFormModalStore, DatePickerWidget, EditorWidget, FormModalStore, InputWidget, JSONForm, JSONSchemaForm, JSONViewPlugin, MultipleSelectWidget, SelectWidget, TextareaWidget, getComplexFormData, getFormData, getFormState2 as getFormState, getSimpleFormData };
1354
1436
  //# sourceMappingURL=out.js.map
1355
1437
  //# sourceMappingURL=form.mjs.map