shadcn-zod-formkit 3.8.0 → 3.8.1
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/README.md +9 -3
- package/dist/index.cjs +224 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +19 -14
- package/dist/index.d.ts +19 -14
- package/dist/index.mjs +225 -185
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-3.8.1.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-3.8.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
# React Dynamic Form Maker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **v3.5.4** · Next.js & React Client Components
|
|
4
4
|
|
|
5
|
-
📦 A React library for creating **dynamic forms** with **Zod validations**, supporting
|
|
5
|
+
📦 A React library for creating **dynamic forms** with **Zod validations**, supporting 40+ input types: text, number, email, switch, color, date, select, file, OTP, location, repeater, keyboard integration, and many more.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -1134,6 +1134,12 @@ MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
|
1134
1134
|
|
|
1135
1135
|
---
|
|
1136
1136
|
|
|
1137
|
+
## 📚 Documentation
|
|
1138
|
+
|
|
1139
|
+
- [Quick Start](docs/QUICK_START.md) — Run the example app and test features
|
|
1140
|
+
- [Testing Guide](docs/TESTING_GUIDE.md) — Testing conventions and setup
|
|
1141
|
+
- [Roadmap & Upcoming Improvements](docs/PROXIMAS_MEJORAS.md) — Planned features and known issues
|
|
1142
|
+
|
|
1137
1143
|
## 🔗 Links
|
|
1138
1144
|
|
|
1139
1145
|
- [GitHub Repository](https://github.com/NativoLink/shadcn-zod-formkit)
|
package/dist/index.cjs
CHANGED
|
@@ -10216,12 +10216,36 @@ var useKeyboardStore = zustand.create((set, get) => ({
|
|
|
10216
10216
|
}
|
|
10217
10217
|
}))
|
|
10218
10218
|
}));
|
|
10219
|
+
|
|
10220
|
+
// src/components/custom/form/inputs/base/definitions.ts
|
|
10221
|
+
var flattenFields = (fields, onAnyFieldChange) => {
|
|
10222
|
+
const result = [];
|
|
10223
|
+
for (const field of fields) {
|
|
10224
|
+
if (Array.isArray(field)) {
|
|
10225
|
+
result.push(...flattenFields(field));
|
|
10226
|
+
} else if (field.fields) {
|
|
10227
|
+
result.push(...flattenFields(field.fields));
|
|
10228
|
+
} else {
|
|
10229
|
+
if (onAnyFieldChange) field.onAnyFieldChange = (data) => onAnyFieldChange(data);
|
|
10230
|
+
result.push(field);
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
return result;
|
|
10234
|
+
};
|
|
10235
|
+
var TextInputType = /* @__PURE__ */ ((TextInputType3) => {
|
|
10236
|
+
TextInputType3["DEFAULT"] = "default";
|
|
10237
|
+
TextInputType3["NUMBER"] = "number";
|
|
10238
|
+
TextInputType3["EMAIL"] = "email";
|
|
10239
|
+
TextInputType3["PHONE"] = "phone";
|
|
10240
|
+
TextInputType3["PASSWORD"] = "password";
|
|
10241
|
+
return TextInputType3;
|
|
10242
|
+
})(TextInputType || {});
|
|
10219
10243
|
var QwertyKeyboard = class extends BaseKeyboard {
|
|
10220
|
-
render() {
|
|
10244
|
+
render(input) {
|
|
10221
10245
|
return /* @__PURE__ */ jsxRuntime.jsx(KeyboardQwerty, {});
|
|
10222
10246
|
}
|
|
10223
10247
|
};
|
|
10224
|
-
var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2xl", onDelete }) => {
|
|
10248
|
+
var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2xl", onDelete, input }) => {
|
|
10225
10249
|
const [shiftMode, setShiftMode] = React3.useState("off");
|
|
10226
10250
|
const [mode, setMode] = React3.useState("letters");
|
|
10227
10251
|
const lastShiftPress = React3.useRef(0);
|
|
@@ -10292,11 +10316,7 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10292
10316
|
};
|
|
10293
10317
|
const shiftLabel = shiftMode === "caps" ? lucideReact.ArrowBigUpDash : lucideReact.ArrowBigUp;
|
|
10294
10318
|
const shiftActive = shiftMode !== "off";
|
|
10295
|
-
const textField = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: currentInputField && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 h-full min-h-16 flex-1 flex flex-row text-2xl font-bold justify-center text-center items-center gap-2 rounded-xl border-2 transition-all outline-none border-amber-400 bg-amber-50 ", children: /* @__PURE__ */ jsxRuntime.
|
|
10296
|
-
" ",
|
|
10297
|
-
currentInputField.field?.value,
|
|
10298
|
-
" "
|
|
10299
|
-
] }) }) });
|
|
10319
|
+
const textField = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: currentInputField && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 h-full min-h-16 flex-1 flex flex-row text-2xl font-bold justify-center text-center items-center gap-2 rounded-xl border-2 transition-all outline-none border-amber-400 bg-amber-50 ", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: currentInputField.input && currentInputField.input.keyboardType == "password" /* PASSWORD */ ? "\u2022".repeat(currentInputField.field?.value.toString().length) : currentInputField.field?.value || "" }) }) });
|
|
10300
10320
|
if (mode === "symbols") {
|
|
10301
10321
|
const keys = [
|
|
10302
10322
|
["!", "@", "#", "$", "%", "^", "&", "*", "(", ")"],
|
|
@@ -10343,7 +10363,10 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10343
10363
|
{ label: "esc", onClick: () => {
|
|
10344
10364
|
setIsOpen(false);
|
|
10345
10365
|
}, className: "bg-red-200" },
|
|
10346
|
-
...fila1
|
|
10366
|
+
...fila1,
|
|
10367
|
+
{ label: "delete", icons: [lucideReact.DeleteIcon], onClick: () => {
|
|
10368
|
+
backspace();
|
|
10369
|
+
}, className: "bg-red-200 text-xs" }
|
|
10347
10370
|
],
|
|
10348
10371
|
[
|
|
10349
10372
|
{ label: "tab", onClick: () => {
|
|
@@ -10378,30 +10401,6 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10378
10401
|
)
|
|
10379
10402
|
] });
|
|
10380
10403
|
};
|
|
10381
|
-
|
|
10382
|
-
// src/components/custom/form/inputs/base/definitions.ts
|
|
10383
|
-
var flattenFields = (fields, onAnyFieldChange) => {
|
|
10384
|
-
const result = [];
|
|
10385
|
-
for (const field of fields) {
|
|
10386
|
-
if (Array.isArray(field)) {
|
|
10387
|
-
result.push(...flattenFields(field));
|
|
10388
|
-
} else if (field.fields) {
|
|
10389
|
-
result.push(...flattenFields(field.fields));
|
|
10390
|
-
} else {
|
|
10391
|
-
if (onAnyFieldChange) field.onAnyFieldChange = (data) => onAnyFieldChange(data);
|
|
10392
|
-
result.push(field);
|
|
10393
|
-
}
|
|
10394
|
-
}
|
|
10395
|
-
return result;
|
|
10396
|
-
};
|
|
10397
|
-
var TextInputType = /* @__PURE__ */ ((TextInputType2) => {
|
|
10398
|
-
TextInputType2["DEFAULT"] = "default";
|
|
10399
|
-
TextInputType2["NUMBER"] = "number";
|
|
10400
|
-
TextInputType2["EMAIL"] = "email";
|
|
10401
|
-
TextInputType2["PHONE"] = "phone";
|
|
10402
|
-
TextInputType2["PASSWORD"] = "password";
|
|
10403
|
-
return TextInputType2;
|
|
10404
|
-
})(TextInputType || {});
|
|
10405
10404
|
var keyboardMap = {
|
|
10406
10405
|
["qwerty" /* QWERTY */]: QwertyKeyboard,
|
|
10407
10406
|
["qwerty_not_chars" /* QWERTY_NOT_CHARS */]: QwertyKeyboard,
|
|
@@ -10490,52 +10489,52 @@ var isValidField = (input, form, defaultValue) => {
|
|
|
10490
10489
|
};
|
|
10491
10490
|
|
|
10492
10491
|
// src/components/custom/form/inputs/base/input-types.ts
|
|
10493
|
-
var InputTypes = /* @__PURE__ */ ((
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
return
|
|
10492
|
+
var InputTypes = /* @__PURE__ */ ((InputTypes3) => {
|
|
10493
|
+
InputTypes3["HIDDEN"] = "hidden";
|
|
10494
|
+
InputTypes3["TEXT"] = "text";
|
|
10495
|
+
InputTypes3["TEXT_GROUP"] = "text_group";
|
|
10496
|
+
InputTypes3["NUMBER"] = "number";
|
|
10497
|
+
InputTypes3["SWITCH"] = "switch";
|
|
10498
|
+
InputTypes3["CHECKBOX"] = "checkbox";
|
|
10499
|
+
InputTypes3["SELECT"] = "select";
|
|
10500
|
+
InputTypes3["SIMPLE_CHECK_LIST"] = "siple_checklist";
|
|
10501
|
+
InputTypes3["CHECK_LIST"] = "checklist";
|
|
10502
|
+
InputTypes3["GROUPED_SWITCH_LIST"] = "grouped_switchlist";
|
|
10503
|
+
InputTypes3["ACCORDION_GROUPED_SWITCH_LIST"] = "accordion_grouped_switchlist";
|
|
10504
|
+
InputTypes3["DATE"] = "date";
|
|
10505
|
+
InputTypes3["TEXTAREA"] = "textarea";
|
|
10506
|
+
InputTypes3["FILE"] = "file";
|
|
10507
|
+
InputTypes3["OTP"] = "otp";
|
|
10508
|
+
InputTypes3["FORM"] = "form";
|
|
10509
|
+
InputTypes3["COLOR"] = "color";
|
|
10510
|
+
InputTypes3["RADIO_GROUP"] = "radio_group";
|
|
10511
|
+
InputTypes3["TAGS"] = "tags";
|
|
10512
|
+
InputTypes3["DATE_TIME"] = "date_time";
|
|
10513
|
+
InputTypes3["TIME"] = "time";
|
|
10514
|
+
InputTypes3["FILE_MULTI_UPLOAD"] = "file_multi_upload";
|
|
10515
|
+
InputTypes3["SLIDER"] = "slider";
|
|
10516
|
+
InputTypes3["BUTTON_GROUP"] = "button_group";
|
|
10517
|
+
InputTypes3["CURRENCY"] = "currency";
|
|
10518
|
+
InputTypes3["KEY_VALUE"] = "key_value";
|
|
10519
|
+
InputTypes3["REPEATER"] = "repeater";
|
|
10520
|
+
InputTypes3["MULTI_SELECT"] = "multi_select";
|
|
10521
|
+
InputTypes3["COMBOBOX"] = "COMBO_BOX";
|
|
10522
|
+
InputTypes3["SORTABLE_LIST"] = "sortable_list";
|
|
10523
|
+
InputTypes3["REPEATER_TABS"] = "repeater_tabs";
|
|
10524
|
+
InputTypes3["STRING_LIST"] = "string_list";
|
|
10525
|
+
InputTypes3["RATING"] = "rating";
|
|
10526
|
+
InputTypes3["PHONE"] = "phone";
|
|
10527
|
+
InputTypes3["URL"] = "url";
|
|
10528
|
+
InputTypes3["PASSWORD"] = "password";
|
|
10529
|
+
InputTypes3["AUTOCOMPLETE"] = "autocomplete";
|
|
10530
|
+
InputTypes3["EMAIL"] = "email";
|
|
10531
|
+
InputTypes3["SEARCH"] = "search";
|
|
10532
|
+
InputTypes3["LOCATION_PICKER"] = "location_picker";
|
|
10533
|
+
InputTypes3["DATE_RANGE"] = "date_range";
|
|
10534
|
+
InputTypes3["COUNTRY_SELECT"] = "country_select";
|
|
10535
|
+
InputTypes3["RANGE"] = "range";
|
|
10536
|
+
InputTypes3["FILE_UPLOAD"] = "file_upload";
|
|
10537
|
+
return InputTypes3;
|
|
10539
10538
|
})(InputTypes || {});
|
|
10540
10539
|
var inputFieldComp = [
|
|
10541
10540
|
"string_list" /* STRING_LIST */,
|
|
@@ -10579,7 +10578,12 @@ var inputFieldComp = [
|
|
|
10579
10578
|
// ✨ New input types (v1.36.0)
|
|
10580
10579
|
"email" /* EMAIL */,
|
|
10581
10580
|
"search" /* SEARCH */,
|
|
10582
|
-
"location_picker" /* LOCATION_PICKER
|
|
10581
|
+
"location_picker" /* LOCATION_PICKER */,
|
|
10582
|
+
"date_range" /* DATE_RANGE */,
|
|
10583
|
+
"country_select" /* COUNTRY_SELECT */,
|
|
10584
|
+
"range" /* RANGE */,
|
|
10585
|
+
// ✨ New input types (v1.37.0)
|
|
10586
|
+
"file_upload" /* FILE_UPLOAD */
|
|
10583
10587
|
];
|
|
10584
10588
|
function Accordion({
|
|
10585
10589
|
...props
|
|
@@ -13634,7 +13638,7 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
|
|
|
13634
13638
|
);
|
|
13635
13639
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: formField });
|
|
13636
13640
|
};
|
|
13637
|
-
var FakeInput = ({ input, field, form, isValid, isSubmitting }) => {
|
|
13641
|
+
var FakeInput = ({ input, field, form, isValid, isSubmitting, isPasswordField, showPassword = false, setShowPassword }) => {
|
|
13638
13642
|
const ref = React3.useRef(null);
|
|
13639
13643
|
const {
|
|
13640
13644
|
setCurrentInputField,
|
|
@@ -13644,8 +13648,6 @@ var FakeInput = ({ input, field, form, isValid, isSubmitting }) => {
|
|
|
13644
13648
|
currentInputField
|
|
13645
13649
|
} = useKeyboardStore();
|
|
13646
13650
|
const [isFocused, setIsFocused] = React3.useState(false);
|
|
13647
|
-
const [showPassword, setShowPassword] = React3.useState(false);
|
|
13648
|
-
const isPasswordField = input.keyboardType === "password" /* PASSWORD */ || input.inputType == "password" /* PASSWORD */;
|
|
13649
13651
|
input.zodType ? true : false;
|
|
13650
13652
|
const value = input?.value ?? field?.value ?? "";
|
|
13651
13653
|
const handleFocus = () => {
|
|
@@ -13708,7 +13710,7 @@ var FakeInput = ({ input, field, form, isValid, isSubmitting }) => {
|
|
|
13708
13710
|
{
|
|
13709
13711
|
variant: "ghost",
|
|
13710
13712
|
type: "button",
|
|
13711
|
-
onClick: () => setShowPassword(!showPassword),
|
|
13713
|
+
onClick: () => setShowPassword ? setShowPassword(!showPassword) : {},
|
|
13712
13714
|
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
|
|
13713
13715
|
}
|
|
13714
13716
|
),
|
|
@@ -13766,6 +13768,10 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
13766
13768
|
);
|
|
13767
13769
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: formField });
|
|
13768
13770
|
};
|
|
13771
|
+
var applyInputFilter = (value, filter) => {
|
|
13772
|
+
if (!filter) return value;
|
|
13773
|
+
return value.split("").filter(filter).join("");
|
|
13774
|
+
};
|
|
13769
13775
|
var CustomInputGroup = ({
|
|
13770
13776
|
value,
|
|
13771
13777
|
input,
|
|
@@ -13790,25 +13796,6 @@ var CustomInputGroup = ({
|
|
|
13790
13796
|
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField || withKeyboard;
|
|
13791
13797
|
const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
|
|
13792
13798
|
const setCurrentInputField = useKeyboardStore((state) => state.setCurrentInputField);
|
|
13793
|
-
const applyMask = (value2, mask) => {
|
|
13794
|
-
if (!mask) return value2;
|
|
13795
|
-
if (typeof mask === "string") {
|
|
13796
|
-
let result = "";
|
|
13797
|
-
let valueIndex = 0;
|
|
13798
|
-
for (let i = 0; i < mask.length && valueIndex < value2.length; i++) {
|
|
13799
|
-
if (mask[i] === "#") {
|
|
13800
|
-
result += value2[valueIndex++];
|
|
13801
|
-
} else {
|
|
13802
|
-
result += mask[i];
|
|
13803
|
-
}
|
|
13804
|
-
}
|
|
13805
|
-
return result;
|
|
13806
|
-
} else if (mask instanceof RegExp) {
|
|
13807
|
-
const matches = value2.match(mask);
|
|
13808
|
-
return matches ? matches.join("") : value2;
|
|
13809
|
-
}
|
|
13810
|
-
return value2;
|
|
13811
|
-
};
|
|
13812
13799
|
const formatNumber = (value2, config) => {
|
|
13813
13800
|
if (!config || value2 === "") return value2;
|
|
13814
13801
|
let numValue = parseFloat(value2);
|
|
@@ -13847,87 +13834,84 @@ var CustomInputGroup = ({
|
|
|
13847
13834
|
return value2;
|
|
13848
13835
|
}
|
|
13849
13836
|
};
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
)
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13837
|
+
let fieldType = isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text";
|
|
13838
|
+
if (input.isFakeInput) fieldType = "hidden";
|
|
13839
|
+
const inputGroupClass = input.isFakeInput ? fieldType : "";
|
|
13840
|
+
React3.useEffect(() => {
|
|
13841
|
+
if (!input.isFakeInput) return;
|
|
13842
|
+
handleOnChage(field?.value, input, field);
|
|
13843
|
+
}, [field?.value]);
|
|
13844
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13845
|
+
input.isFakeInput && /* @__PURE__ */ jsxRuntime.jsx(FakeInput, { input, field, form, setShowPassword, isPasswordField, showPassword }),
|
|
13846
|
+
/* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { className: cn(input.classNameGroupInput ?? "h-10", inputGroupClass), children: [
|
|
13847
|
+
(iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { children: [
|
|
13848
|
+
textLeft && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textLeft }),
|
|
13849
|
+
iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20 }, index))
|
|
13850
|
+
] }),
|
|
13851
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13852
|
+
InputGroupInput,
|
|
13853
|
+
{
|
|
13854
|
+
className: input.classNameInput ?? "h-full text-xl font-semibold",
|
|
13855
|
+
placeholder: input.placeHolder,
|
|
13856
|
+
disabled: input.disabled || isSubmitting,
|
|
13857
|
+
onBlur: field?.onBlur,
|
|
13858
|
+
onFocus: () => setCurrentInputField({ input, field }),
|
|
13859
|
+
name: field?.name,
|
|
13860
|
+
ref: field?.ref,
|
|
13861
|
+
type: fieldType,
|
|
13862
|
+
value: field?.value ?? value ?? "",
|
|
13863
|
+
onChange: (e) => {
|
|
13864
|
+
let value2 = e.target.value;
|
|
13865
|
+
console.log("\u{1F680} ~ CustomInputGroup ~ value:", value2);
|
|
13866
|
+
console.log("Valor raw del input:", value2);
|
|
13867
|
+
if (isNumberField) {
|
|
13868
|
+
const numConfig = input.inputNumberConfig;
|
|
13869
|
+
const cleanValue = value2.replace(/[^\d.-]/g, "");
|
|
13870
|
+
const numValue = cleanValue === "" ? "" : Number(cleanValue);
|
|
13871
|
+
if (numConfig?.formatOnInput) {
|
|
13872
|
+
value2 = formatNumber(cleanValue, numConfig);
|
|
13873
|
+
} else {
|
|
13874
|
+
value2 = numValue;
|
|
13875
|
+
}
|
|
13889
13876
|
} else {
|
|
13890
|
-
|
|
13877
|
+
let processedValue = value2;
|
|
13878
|
+
value2 = applyTransform(processedValue, input.transform);
|
|
13891
13879
|
}
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
value2 = applyTransform(processedValue, input.transform);
|
|
13880
|
+
field?.onChange(value2);
|
|
13881
|
+
isValidField(input, form);
|
|
13882
|
+
handleOnChage(value2, input, field);
|
|
13896
13883
|
}
|
|
13897
|
-
field?.onChange(value2);
|
|
13898
|
-
isValidField(input, form);
|
|
13899
|
-
handleOnChage(value2, input, field);
|
|
13900
|
-
}
|
|
13901
|
-
}
|
|
13902
|
-
),
|
|
13903
|
-
showInputGroupAddons && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
13904
|
-
infoTooltip && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
13905
|
-
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: 20 }) }),
|
|
13906
|
-
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: infoTooltip }) })
|
|
13907
|
-
] }),
|
|
13908
|
-
textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
|
|
13909
|
-
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20 }, index)),
|
|
13910
|
-
isPasswordField && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13911
|
-
"button",
|
|
13912
|
-
{
|
|
13913
|
-
type: "button",
|
|
13914
|
-
onClick: () => setShowPassword(!showPassword),
|
|
13915
|
-
className: "p-1",
|
|
13916
|
-
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
|
|
13917
13884
|
}
|
|
13918
13885
|
),
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13886
|
+
showInputGroupAddons && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
13887
|
+
infoTooltip && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
13888
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: 20 }) }),
|
|
13889
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: infoTooltip }) })
|
|
13890
|
+
] }),
|
|
13891
|
+
textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
|
|
13892
|
+
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20 }, index)),
|
|
13893
|
+
isPasswordField && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13894
|
+
"button",
|
|
13895
|
+
{
|
|
13896
|
+
type: "button",
|
|
13897
|
+
onClick: () => setShowPassword(!showPassword),
|
|
13898
|
+
className: "p-1",
|
|
13899
|
+
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
|
|
13900
|
+
}
|
|
13901
|
+
),
|
|
13902
|
+
withKeyboard && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13903
|
+
"button",
|
|
13904
|
+
{
|
|
13905
|
+
type: "button",
|
|
13906
|
+
className: "text-2xl",
|
|
13907
|
+
onClick: () => {
|
|
13908
|
+
setIsOpen();
|
|
13909
|
+
setCurrentInputField({ input, field });
|
|
13910
|
+
},
|
|
13911
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Keyboard, {})
|
|
13912
|
+
}
|
|
13913
|
+
)
|
|
13914
|
+
] })
|
|
13931
13915
|
] })
|
|
13932
13916
|
] });
|
|
13933
13917
|
};
|
|
@@ -15088,12 +15072,12 @@ var FieldText = ({ input, form, isSubmitting }) => {
|
|
|
15088
15072
|
return value;
|
|
15089
15073
|
};
|
|
15090
15074
|
const applyTransform = (value) => {
|
|
15091
|
-
input.inputGroupConfig?.transform || input.transform;
|
|
15075
|
+
const transform = input.inputGroupConfig?.transform || input.transform;
|
|
15092
15076
|
if (!input.inputGroupConfig?.transform) return value;
|
|
15093
15077
|
if (typeof input.transform === "function") {
|
|
15094
15078
|
return input.transform(value);
|
|
15095
15079
|
}
|
|
15096
|
-
switch (
|
|
15080
|
+
switch (transform) {
|
|
15097
15081
|
case "uppercase":
|
|
15098
15082
|
return value.toUpperCase();
|
|
15099
15083
|
case "lowercase":
|
|
@@ -15753,6 +15737,63 @@ function EmailInputComponent({
|
|
|
15753
15737
|
] }) })
|
|
15754
15738
|
] }) });
|
|
15755
15739
|
}
|
|
15740
|
+
var SearchInputClass = class extends BaseInput {
|
|
15741
|
+
render() {
|
|
15742
|
+
const { input, form, isSubmitting } = this;
|
|
15743
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldSearch, { form, input, isSubmitting });
|
|
15744
|
+
}
|
|
15745
|
+
};
|
|
15746
|
+
var FieldSearch = ({ input, form, isSubmitting }) => {
|
|
15747
|
+
const debounceRef = React3.useRef();
|
|
15748
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15749
|
+
FormField,
|
|
15750
|
+
{
|
|
15751
|
+
control: form.control,
|
|
15752
|
+
name: input.name,
|
|
15753
|
+
render: ({ field }) => {
|
|
15754
|
+
const handleChange = (e) => {
|
|
15755
|
+
const value = e.target.value;
|
|
15756
|
+
field.onChange(value);
|
|
15757
|
+
if (input.debounce) {
|
|
15758
|
+
clearTimeout(debounceRef.current);
|
|
15759
|
+
debounceRef.current = setTimeout(() => {
|
|
15760
|
+
handleOnChage(value, input, field);
|
|
15761
|
+
}, input.debounce);
|
|
15762
|
+
} else {
|
|
15763
|
+
handleOnChage(value, input, field);
|
|
15764
|
+
}
|
|
15765
|
+
};
|
|
15766
|
+
const handleClear = () => {
|
|
15767
|
+
field.onChange("");
|
|
15768
|
+
handleOnChage("", input, field);
|
|
15769
|
+
};
|
|
15770
|
+
const hasValue = Boolean(field.value);
|
|
15771
|
+
const isDisabled = input.disabled || isSubmitting;
|
|
15772
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
|
|
15773
|
+
input.label && /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
15774
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
15775
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15776
|
+
InputGroupInput,
|
|
15777
|
+
{
|
|
15778
|
+
type: "search",
|
|
15779
|
+
placeholder: input.placeHolder,
|
|
15780
|
+
disabled: isDisabled,
|
|
15781
|
+
value: field.value ?? "",
|
|
15782
|
+
onChange: handleChange,
|
|
15783
|
+
onBlur: field.onBlur,
|
|
15784
|
+
name: field.name,
|
|
15785
|
+
ref: field.ref
|
|
15786
|
+
}
|
|
15787
|
+
),
|
|
15788
|
+
hasValue && !isDisabled && /* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: handleClear, "aria-label": "Clear search", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 16 }) }) })
|
|
15789
|
+
] }) }),
|
|
15790
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
|
|
15791
|
+
] });
|
|
15792
|
+
}
|
|
15793
|
+
},
|
|
15794
|
+
input.name
|
|
15795
|
+
);
|
|
15796
|
+
};
|
|
15756
15797
|
var MapComponent2 = React3.lazy(() => Promise.resolve().then(() => (init_map_component(), map_component_exports)));
|
|
15757
15798
|
var LocationPickerInput = class extends BaseInput {
|
|
15758
15799
|
render() {
|
|
@@ -16637,8 +16678,7 @@ var inputMap = {
|
|
|
16637
16678
|
["autocomplete" /* AUTOCOMPLETE */]: AutocompleteInput,
|
|
16638
16679
|
// ✨ New input types (v1.36.0)
|
|
16639
16680
|
["email" /* EMAIL */]: EmailInput,
|
|
16640
|
-
["search" /* SEARCH */]:
|
|
16641
|
-
// SearchInput component is currently a function component
|
|
16681
|
+
["search" /* SEARCH */]: SearchInputClass,
|
|
16642
16682
|
["location_picker" /* LOCATION_PICKER */]: LocationPickerInput,
|
|
16643
16683
|
["date_range" /* DATE_RANGE */]: DateRangeInput,
|
|
16644
16684
|
["country_select" /* COUNTRY_SELECT */]: CountrySelectInput,
|
|
@@ -17789,6 +17829,7 @@ exports.TooltipProvider = TooltipProvider;
|
|
|
17789
17829
|
exports.TooltipTrigger = TooltipTrigger;
|
|
17790
17830
|
exports.WizardForm = WizardForm;
|
|
17791
17831
|
exports.applyCase = applyCase;
|
|
17832
|
+
exports.applyInputFilter = applyInputFilter;
|
|
17792
17833
|
exports.badgeVariants = badgeVariants;
|
|
17793
17834
|
exports.buttonGroupVariants = buttonGroupVariants;
|
|
17794
17835
|
exports.buttonVariants = buttonVariants;
|
|
@@ -17803,6 +17844,7 @@ exports.getDynamicSchema = getDynamicSchema;
|
|
|
17803
17844
|
exports.getFieldLabel = getFieldLabel;
|
|
17804
17845
|
exports.handleOnChage = handleOnChage;
|
|
17805
17846
|
exports.inputFieldComp = inputFieldComp;
|
|
17847
|
+
exports.inputMap = inputMap;
|
|
17806
17848
|
exports.isValidField = isValidField;
|
|
17807
17849
|
exports.letter = letter;
|
|
17808
17850
|
exports.mockFields = mockFields;
|