shadcn-zod-formkit 3.5.4 → 3.7.0
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/index.cjs +150 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.mjs +151 -120
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-3.7.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-3.5.4.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -9229,7 +9229,7 @@ var require_leaflet_src = __commonJS({
|
|
|
9229
9229
|
// Amount of pixels to pan when pressing an arrow key.
|
|
9230
9230
|
keyboardPanDelta: 80
|
|
9231
9231
|
});
|
|
9232
|
-
var
|
|
9232
|
+
var Keyboard3 = Handler.extend({
|
|
9233
9233
|
keyCodes: {
|
|
9234
9234
|
left: [37],
|
|
9235
9235
|
right: [39],
|
|
@@ -9347,7 +9347,7 @@ var require_leaflet_src = __commonJS({
|
|
|
9347
9347
|
stop(e);
|
|
9348
9348
|
}
|
|
9349
9349
|
});
|
|
9350
|
-
Map2.addInitHook("addHandler", "keyboard",
|
|
9350
|
+
Map2.addInitHook("addHandler", "keyboard", Keyboard3);
|
|
9351
9351
|
Map2.mergeOptions({
|
|
9352
9352
|
// @section Mouse wheel options
|
|
9353
9353
|
// @option scrollWheelZoom: Boolean|String = true
|
|
@@ -9565,7 +9565,7 @@ var require_leaflet_src = __commonJS({
|
|
|
9565
9565
|
Map2.BoxZoom = BoxZoom;
|
|
9566
9566
|
Map2.DoubleClickZoom = DoubleClickZoom;
|
|
9567
9567
|
Map2.Drag = Drag;
|
|
9568
|
-
Map2.Keyboard =
|
|
9568
|
+
Map2.Keyboard = Keyboard3;
|
|
9569
9569
|
Map2.ScrollWheelZoom = ScrollWheelZoom;
|
|
9570
9570
|
Map2.TapHold = TapHold;
|
|
9571
9571
|
Map2.TouchZoom = TouchZoom;
|
|
@@ -10132,11 +10132,10 @@ var useKeyboardStore = zustand.create((set, get) => ({
|
|
|
10132
10132
|
currentInputField: null,
|
|
10133
10133
|
setCurrentInputField(inputField) {
|
|
10134
10134
|
set({ currentInputField: inputField });
|
|
10135
|
-
console.log("Current Input Field set to:", inputField);
|
|
10136
10135
|
},
|
|
10137
10136
|
isOpen: false,
|
|
10138
|
-
setIsOpen() {
|
|
10139
|
-
set({ isOpen: !get().isOpen });
|
|
10137
|
+
setIsOpen(open) {
|
|
10138
|
+
set({ isOpen: open ?? !get().isOpen });
|
|
10140
10139
|
},
|
|
10141
10140
|
registerInput: (id, initialValue = "") => set((state) => ({
|
|
10142
10141
|
inputs: {
|
|
@@ -10155,7 +10154,6 @@ var useKeyboardStore = zustand.create((set, get) => ({
|
|
|
10155
10154
|
if (currentInputField && currentInputField.field) {
|
|
10156
10155
|
currentInputField.field.value += char;
|
|
10157
10156
|
set({ currentInputField });
|
|
10158
|
-
console.log("Updated currentInputField value:", state.currentInputField?.field?.value);
|
|
10159
10157
|
}
|
|
10160
10158
|
if (!state.activeInput) return state;
|
|
10161
10159
|
const current = state.inputs[state.activeInput] || "";
|
|
@@ -10167,8 +10165,14 @@ var useKeyboardStore = zustand.create((set, get) => ({
|
|
|
10167
10165
|
};
|
|
10168
10166
|
}),
|
|
10169
10167
|
backspace: () => set((state) => {
|
|
10168
|
+
let currentInputField = state.currentInputField;
|
|
10169
|
+
if (currentInputField && currentInputField.field) {
|
|
10170
|
+
currentInputField.field.value = currentInputField.field.value.slice(0, -1);
|
|
10171
|
+
set({ currentInputField });
|
|
10172
|
+
}
|
|
10170
10173
|
if (!state.activeInput) return state;
|
|
10171
10174
|
const current = state.inputs[state.activeInput] || "";
|
|
10175
|
+
console.log("RUN BACKSPACE - current value:", current);
|
|
10172
10176
|
return {
|
|
10173
10177
|
inputs: {
|
|
10174
10178
|
...state.inputs,
|
|
@@ -10201,8 +10205,54 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10201
10205
|
const [shiftMode, setShiftMode] = React3.useState("off");
|
|
10202
10206
|
const [mode, setMode] = React3.useState("letters");
|
|
10203
10207
|
const lastShiftPress = React3.useRef(0);
|
|
10204
|
-
const { currentInputField, write } = useKeyboardStore();
|
|
10208
|
+
const { currentInputField, write, setIsOpen, backspace } = useKeyboardStore();
|
|
10205
10209
|
const isUpper = shiftMode !== "off";
|
|
10210
|
+
React3.useEffect(() => {
|
|
10211
|
+
const handleKeyDown = (e) => {
|
|
10212
|
+
if (!currentInputField) return;
|
|
10213
|
+
const key = e.key;
|
|
10214
|
+
if (key === "Enter") {
|
|
10215
|
+
e.preventDefault();
|
|
10216
|
+
onEnter?.();
|
|
10217
|
+
return;
|
|
10218
|
+
}
|
|
10219
|
+
console.log("\u{1F680} ~ handleKeyDown ~ key:", key);
|
|
10220
|
+
if (key === "Backspace") {
|
|
10221
|
+
backspace();
|
|
10222
|
+
e.preventDefault();
|
|
10223
|
+
onDelete?.();
|
|
10224
|
+
return;
|
|
10225
|
+
}
|
|
10226
|
+
if (key === " ") {
|
|
10227
|
+
e.preventDefault();
|
|
10228
|
+
handleKey(" ");
|
|
10229
|
+
return;
|
|
10230
|
+
}
|
|
10231
|
+
if (key === "Shift") {
|
|
10232
|
+
handleShift();
|
|
10233
|
+
return;
|
|
10234
|
+
}
|
|
10235
|
+
if (key === "CapsLock") {
|
|
10236
|
+
handleCaps();
|
|
10237
|
+
return;
|
|
10238
|
+
}
|
|
10239
|
+
if (key === "Tab") {
|
|
10240
|
+
e.preventDefault();
|
|
10241
|
+
return;
|
|
10242
|
+
}
|
|
10243
|
+
if (key === "Escape") {
|
|
10244
|
+
setIsOpen(false);
|
|
10245
|
+
return;
|
|
10246
|
+
}
|
|
10247
|
+
if (key.length === 1) {
|
|
10248
|
+
handleKey(key);
|
|
10249
|
+
}
|
|
10250
|
+
};
|
|
10251
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
10252
|
+
return () => {
|
|
10253
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
10254
|
+
};
|
|
10255
|
+
}, [currentInputField, shiftMode]);
|
|
10206
10256
|
const handleShift = () => {
|
|
10207
10257
|
const now = Date.now();
|
|
10208
10258
|
if (now - lastShiftPress.current < 300) {
|
|
@@ -10217,15 +10267,18 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10217
10267
|
const output = isUpper ? key.toUpperCase() : key;
|
|
10218
10268
|
onKeyPress?.(output);
|
|
10219
10269
|
write(output);
|
|
10220
|
-
if (shiftMode === "once")
|
|
10221
|
-
setShiftMode("off");
|
|
10222
|
-
}
|
|
10270
|
+
if (shiftMode === "once") setShiftMode("off");
|
|
10223
10271
|
};
|
|
10224
10272
|
const handleCaps = () => {
|
|
10225
10273
|
setShiftMode((prev) => prev === "caps" ? "off" : "caps");
|
|
10226
10274
|
};
|
|
10227
10275
|
const shiftLabel = shiftMode === "caps" ? lucideReact.ArrowBigUpDash : lucideReact.ArrowBigUp;
|
|
10228
10276
|
const shiftActive = shiftMode !== "off";
|
|
10277
|
+
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.jsxs("span", { children: [
|
|
10278
|
+
" ",
|
|
10279
|
+
currentInputField.field?.value,
|
|
10280
|
+
" "
|
|
10281
|
+
] }) }) });
|
|
10229
10282
|
if (mode === "symbols") {
|
|
10230
10283
|
const keys = [
|
|
10231
10284
|
["!", "@", "#", "$", "%", "^", "&", "*", "(", ")"],
|
|
@@ -10237,32 +10290,31 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10237
10290
|
onClick: () => handleKey(k)
|
|
10238
10291
|
}))
|
|
10239
10292
|
);
|
|
10240
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
[
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10293
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full flex flex-col", children: [
|
|
10294
|
+
textField,
|
|
10295
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10296
|
+
KeyboardBuilder,
|
|
10297
|
+
{
|
|
10298
|
+
className: "w-full h-full",
|
|
10299
|
+
keyFontSize: keyFontSize3,
|
|
10300
|
+
keys: [
|
|
10301
|
+
...keys,
|
|
10302
|
+
[
|
|
10303
|
+
{ label: "ABC", onClick: () => setMode("letters"), className: "flex-[2]" },
|
|
10304
|
+
{ label: " ", onClick: () => handleKey(" "), className: "flex-[4]" },
|
|
10305
|
+
{ label: "Enter", onClick: onEnter, className: "flex-[2] bg-green-200 " }
|
|
10306
|
+
]
|
|
10251
10307
|
]
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10308
|
+
}
|
|
10309
|
+
)
|
|
10310
|
+
] });
|
|
10255
10311
|
}
|
|
10256
10312
|
const fila1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"].map((l) => letter(l, isUpper, handleKey));
|
|
10257
10313
|
const fila2 = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"].map((l) => letter(l, isUpper, handleKey));
|
|
10258
10314
|
const fila3 = ["a", "s", "d", "f", "g", "h", "j", "k", "l"].map((l) => letter(l, isUpper, handleKey));
|
|
10259
10315
|
const fila4 = ["z", "x", "c", "v", "b", "n", "m"].map((l) => letter(l, isUpper, handleKey));
|
|
10260
10316
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full flex flex-col", children: [
|
|
10261
|
-
|
|
10262
|
-
" ",
|
|
10263
|
-
currentInputField.field?.value,
|
|
10264
|
-
" "
|
|
10265
|
-
] }) }),
|
|
10317
|
+
textField,
|
|
10266
10318
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10267
10319
|
KeyboardBuilder,
|
|
10268
10320
|
{
|
|
@@ -10271,6 +10323,7 @@ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2
|
|
|
10271
10323
|
keys: [
|
|
10272
10324
|
[
|
|
10273
10325
|
{ label: "esc", onClick: () => {
|
|
10326
|
+
setIsOpen(false);
|
|
10274
10327
|
}, className: "bg-red-200" },
|
|
10275
10328
|
...fila1
|
|
10276
10329
|
],
|
|
@@ -13161,64 +13214,28 @@ var CurrencyInput = class extends BaseInput {
|
|
|
13161
13214
|
}
|
|
13162
13215
|
};
|
|
13163
13216
|
var FieldCurrency = ({ form, input, isSubmitting }) => {
|
|
13164
|
-
const
|
|
13165
|
-
|
|
13166
|
-
const
|
|
13217
|
+
const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
|
|
13218
|
+
const setCurrentInputField = useKeyboardStore((state) => state.setCurrentInputField);
|
|
13219
|
+
const withKeyboard = input.withKeyboard;
|
|
13220
|
+
const autoValidate = input.inputGroupConfig?.autoValidIcons;
|
|
13167
13221
|
const iconValidState = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheck, { style: { color: "#00bf3e" } });
|
|
13168
13222
|
const iconInvalidState = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleX, { style: { color: "#ff8080" } });
|
|
13169
13223
|
const iconLoadingState = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
|
|
13170
|
-
const [isValid, setIsValid] = React3.useState(() => {
|
|
13171
|
-
const value = form.getValues(input.name);
|
|
13172
|
-
const fieldState = form.getFieldState(input.name);
|
|
13173
|
-
return !fieldState.error && value !== void 0 && value !== "";
|
|
13174
|
-
});
|
|
13175
|
-
const defaultCurrencyFormat = {
|
|
13176
|
-
style: "currency",
|
|
13177
|
-
currency: "USD",
|
|
13178
|
-
minimumFractionDigits: 2,
|
|
13179
|
-
maximumFractionDigits: 2
|
|
13180
|
-
};
|
|
13181
|
-
const mask = input?.mask;
|
|
13182
|
-
const currencyFormat = input?.currencyFormat ?? defaultCurrencyFormat;
|
|
13183
|
-
const [rawValue, setRawValue] = React3.useState(form.getValues(input.name) ?? "");
|
|
13184
13224
|
const formatter = React3.useMemo(() => {
|
|
13185
|
-
return new Intl.NumberFormat("es-DO",
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13225
|
+
return new Intl.NumberFormat("es-DO", {
|
|
13226
|
+
style: "currency",
|
|
13227
|
+
currency: input?.currencyFormat?.currency ?? "USD",
|
|
13228
|
+
minimumFractionDigits: 2,
|
|
13229
|
+
maximumFractionDigits: 2
|
|
13230
|
+
});
|
|
13231
|
+
}, [input?.currencyFormat]);
|
|
13232
|
+
const parseValue = (val) => {
|
|
13233
|
+
const numeric = parseFloat(val.replace(/[^0-9.-]/g, ""));
|
|
13189
13234
|
return isNaN(numeric) ? null : numeric;
|
|
13190
13235
|
};
|
|
13191
|
-
const formatValue = (
|
|
13192
|
-
if (
|
|
13193
|
-
|
|
13194
|
-
if (isNaN(numeric)) return "";
|
|
13195
|
-
if (typeof mask === "string") {
|
|
13196
|
-
return mask.replace(/0+(?:[.,]0+)?/, formatter.format(numeric).replace(/[^\d.,]/g, ""));
|
|
13197
|
-
}
|
|
13198
|
-
if (mask instanceof RegExp) {
|
|
13199
|
-
const valid = mask.test(value);
|
|
13200
|
-
return valid ? value : rawValue;
|
|
13201
|
-
}
|
|
13202
|
-
return formatter.format(numeric);
|
|
13203
|
-
};
|
|
13204
|
-
const handleKeyDown = (e) => {
|
|
13205
|
-
const allowedKeys = [
|
|
13206
|
-
"Backspace",
|
|
13207
|
-
"Delete",
|
|
13208
|
-
"Tab",
|
|
13209
|
-
"ArrowLeft",
|
|
13210
|
-
"ArrowRight",
|
|
13211
|
-
"Home",
|
|
13212
|
-
"End"
|
|
13213
|
-
];
|
|
13214
|
-
if (allowedKeys.includes(e.key)) return;
|
|
13215
|
-
if (!/^[0-9.]$/.test(e.key)) {
|
|
13216
|
-
e.preventDefault();
|
|
13217
|
-
return;
|
|
13218
|
-
}
|
|
13219
|
-
if (e.key === "." && rawValue.includes(".")) {
|
|
13220
|
-
e.preventDefault();
|
|
13221
|
-
}
|
|
13236
|
+
const formatValue = (val) => {
|
|
13237
|
+
if (val === null || val === void 0) return "";
|
|
13238
|
+
return formatter.format(val);
|
|
13222
13239
|
};
|
|
13223
13240
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13224
13241
|
FormField,
|
|
@@ -13226,44 +13243,55 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
|
|
|
13226
13243
|
control: form.control,
|
|
13227
13244
|
name: input.name,
|
|
13228
13245
|
render: ({ field, fieldState }) => {
|
|
13229
|
-
const
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13246
|
+
const [displayValue, setDisplayValue] = React3.useState(() => {
|
|
13247
|
+
return field.value ? formatValue(field.value) : "";
|
|
13248
|
+
});
|
|
13249
|
+
const isValid = !fieldState.error && field.value !== void 0 && field.value !== "";
|
|
13250
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: `${input.withLateralLabel ? "flex items-center gap-2" : ""} ${input.className}`, children: [
|
|
13251
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { className: `${input.withLateralLabel ? "w-32 text-right" : ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
13233
13252
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
13234
|
-
/* @__PURE__ */ jsxRuntime.
|
|
13235
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: "$" }),
|
|
13236
|
-
input.inputGroupConfig?.textLeft && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: input.inputGroupConfig.textLeft })
|
|
13237
|
-
] }),
|
|
13253
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: "$" }) }),
|
|
13238
13254
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13239
13255
|
InputGroupInput,
|
|
13240
13256
|
{
|
|
13241
|
-
|
|
13257
|
+
ref: field.ref,
|
|
13258
|
+
name: field.name,
|
|
13242
13259
|
disabled: input.disabled || isSubmitting,
|
|
13243
|
-
placeholder:
|
|
13260
|
+
placeholder: "0.00",
|
|
13244
13261
|
inputMode: "decimal",
|
|
13245
|
-
value:
|
|
13246
|
-
|
|
13262
|
+
value: displayValue,
|
|
13263
|
+
onFocus: (e) => {
|
|
13264
|
+
const raw = field.value ? String(field.value) : "";
|
|
13265
|
+
setDisplayValue(raw);
|
|
13266
|
+
setCurrentInputField({ input, field });
|
|
13267
|
+
},
|
|
13247
13268
|
onChange: (e) => {
|
|
13248
|
-
const
|
|
13249
|
-
|
|
13250
|
-
const parsed = parseValue(
|
|
13251
|
-
|
|
13269
|
+
const val = e.target.value;
|
|
13270
|
+
setDisplayValue(val);
|
|
13271
|
+
const parsed = parseValue(val);
|
|
13272
|
+
field.onChange(parsed);
|
|
13252
13273
|
handleOnChage(parsed, input, field);
|
|
13253
13274
|
},
|
|
13254
|
-
onBlur: (
|
|
13255
|
-
const formatted = formatValue(
|
|
13256
|
-
|
|
13257
|
-
},
|
|
13258
|
-
onFocus: (e) => {
|
|
13259
|
-
const numeric = e.target.value.replace(/[^0-9.-]/g, "");
|
|
13260
|
-
setRawValue(numeric);
|
|
13275
|
+
onBlur: () => {
|
|
13276
|
+
const formatted = formatValue(field.value);
|
|
13277
|
+
setDisplayValue(formatted);
|
|
13261
13278
|
}
|
|
13262
13279
|
}
|
|
13263
13280
|
),
|
|
13264
13281
|
/* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
13265
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: currencyFormat
|
|
13266
|
-
|
|
13282
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: input?.currencyFormat?.currency ?? "USD" }),
|
|
13283
|
+
withKeyboard && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13284
|
+
"button",
|
|
13285
|
+
{
|
|
13286
|
+
type: "button",
|
|
13287
|
+
className: "text-2xl",
|
|
13288
|
+
onClick: () => {
|
|
13289
|
+
setIsOpen();
|
|
13290
|
+
setCurrentInputField({ input, field });
|
|
13291
|
+
},
|
|
13292
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Keyboard, {})
|
|
13293
|
+
}
|
|
13294
|
+
),
|
|
13267
13295
|
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
|
|
13268
13296
|
] })
|
|
13269
13297
|
] }) }),
|
|
@@ -13603,9 +13631,9 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
13603
13631
|
name: input.name,
|
|
13604
13632
|
render: ({ field }) => {
|
|
13605
13633
|
setIsValid(isValidField(input, form));
|
|
13606
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className
|
|
13607
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
13608
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { className:
|
|
13634
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: `${input.withLateralLabel ? "flex items-center gap-2 flex-row" : ""} ${input.className}`, children: [
|
|
13635
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { className: `${input.withLateralLabel ? "text-right" : ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
13636
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { className: `shadow-lg ${input.withLateralLabel ? " text-right" : ""}`, children: CustomInputGroup({
|
|
13609
13637
|
input,
|
|
13610
13638
|
isSubmitting,
|
|
13611
13639
|
field,
|
|
@@ -13646,7 +13674,7 @@ var CustomInputGroup = ({
|
|
|
13646
13674
|
const [showPassword, setShowPassword] = React3.useState(false);
|
|
13647
13675
|
const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
|
|
13648
13676
|
const isNumberField = input.keyboardType === "number" /* NUMBER */;
|
|
13649
|
-
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
|
|
13677
|
+
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField || withKeyboard;
|
|
13650
13678
|
const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
|
|
13651
13679
|
const setCurrentInputField = useKeyboardStore((state) => state.setCurrentInputField);
|
|
13652
13680
|
const applyMask = (value2, mask) => {
|
|
@@ -13728,6 +13756,7 @@ var CustomInputGroup = ({
|
|
|
13728
13756
|
onChange(e);
|
|
13729
13757
|
}
|
|
13730
13758
|
let value2 = e.target.value;
|
|
13759
|
+
console.log("Valor raw del input:", value2);
|
|
13731
13760
|
if (isNumberField) {
|
|
13732
13761
|
const numConfig = input.inputNumberConfig;
|
|
13733
13762
|
const cleanValue = value2.replace(/[^\d.-]/g, "");
|
|
@@ -14887,12 +14916,12 @@ function FieldTextArea({ form, input, isSubmitting }) {
|
|
|
14887
14916
|
{
|
|
14888
14917
|
control: form.control,
|
|
14889
14918
|
name: input.name,
|
|
14890
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className:
|
|
14891
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
14919
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: `shadow-lg ${input.withLateralLabel ? "flex items-center gap-2" : ""} ${input.className}`, children: [
|
|
14920
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { className: `${input.withLateralLabel ? "w-32 text-right" : ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
14892
14921
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14893
14922
|
Textarea,
|
|
14894
14923
|
{
|
|
14895
|
-
className: "min-w-[260px]
|
|
14924
|
+
className: "min-w-[260px]",
|
|
14896
14925
|
placeholder: input.placeHolder,
|
|
14897
14926
|
...field,
|
|
14898
14927
|
onChange: (event) => {
|
|
@@ -16620,7 +16649,8 @@ var FormFieldsGrid = ({
|
|
|
16620
16649
|
isPending,
|
|
16621
16650
|
readOnly,
|
|
16622
16651
|
className = "",
|
|
16623
|
-
gap = "gap-2"
|
|
16652
|
+
gap = "gap-2",
|
|
16653
|
+
py = "py-1"
|
|
16624
16654
|
}) => {
|
|
16625
16655
|
const values = form.watch();
|
|
16626
16656
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-full grid grid-cols-1 ${gap} ${className}`, children: fields.map((inputOrGroup, idx) => {
|
|
@@ -16632,7 +16662,7 @@ var FormFieldsGrid = ({
|
|
|
16632
16662
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16633
16663
|
"div",
|
|
16634
16664
|
{
|
|
16635
|
-
className:
|
|
16665
|
+
className: `w-full flex flex-row items-start gap-4 ${py}`,
|
|
16636
16666
|
children: visibleFields.map((field, subIdx) => {
|
|
16637
16667
|
const fieldCopy2 = {
|
|
16638
16668
|
...field,
|
|
@@ -16933,7 +16963,8 @@ var DynamicForm = ({
|
|
|
16933
16963
|
{
|
|
16934
16964
|
fields,
|
|
16935
16965
|
form,
|
|
16936
|
-
readOnly
|
|
16966
|
+
readOnly,
|
|
16967
|
+
gap: "gap-1"
|
|
16937
16968
|
}
|
|
16938
16969
|
),
|
|
16939
16970
|
children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-2 w-full h-full", children })
|
|
@@ -16985,7 +17016,7 @@ var DynamicForm = ({
|
|
|
16985
17016
|
formSubTitle && /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: formSubTitle })
|
|
16986
17017
|
] })
|
|
16987
17018
|
] }),
|
|
16988
|
-
childrenHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-
|
|
17019
|
+
childrenHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-1 w-full h-full", children: childrenHeader })
|
|
16989
17020
|
] }),
|
|
16990
17021
|
withErrorsAlert && errorAlertPosition === "up" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
16991
17022
|
FormErrorsAlert,
|
|
@@ -17021,7 +17052,7 @@ var FormWrapper = ({ form, handleSubmit, children, readOnly, debug, isWrapInWiza
|
|
|
17021
17052
|
"form",
|
|
17022
17053
|
{
|
|
17023
17054
|
onSubmit: form.handleSubmit(handleSubmit),
|
|
17024
|
-
className: `flex flex-col gap-
|
|
17055
|
+
className: `flex flex-col gap-1 ${readOnly ? "opacity-70 pointer-events-none select-none" : ""}`,
|
|
17025
17056
|
children: [
|
|
17026
17057
|
children,
|
|
17027
17058
|
debug && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "mt-4 p-3 bg-muted text-xs rounded", children: JSON.stringify(allValues, null, 2) })
|