shadcn-zod-formkit 3.4.0 → 3.5.4

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 CHANGED
@@ -6,9 +6,11 @@ var lucideReact = require('lucide-react');
6
6
  var reactIcons = require('@radix-ui/react-icons');
7
7
  var classVarianceAuthority = require('class-variance-authority');
8
8
  var tailwindMerge = require('tailwind-merge');
9
+ var reactSlot = require('@radix-ui/react-slot');
10
+ var zustand = require('zustand');
9
11
  var reactHookForm = require('react-hook-form');
10
12
  var AccordionPrimitive = require('@radix-ui/react-accordion');
11
- var reactSlot = require('@radix-ui/react-slot');
13
+ var radixUi = require('radix-ui');
12
14
  var SeparatorPrimitive = require('@radix-ui/react-separator');
13
15
  var reactDayPicker = require('react-day-picker');
14
16
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
@@ -23,7 +25,6 @@ var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
23
25
  var ResizablePrimitive = require('react-resizable-panels');
24
26
  var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
25
27
  var SelectPrimitive = require('@radix-ui/react-select');
26
- var radixUi = require('radix-ui');
27
28
  var SliderPrimitive = require('@radix-ui/react-slider');
28
29
  var nextThemes = require('next-themes');
29
30
  var sonner = require('sonner');
@@ -31,7 +32,6 @@ var SwitchPrimitive = require('@radix-ui/react-switch');
31
32
  var TabsPrimitive = require('@radix-ui/react-tabs');
32
33
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
33
34
  var dateFns = require('date-fns');
34
- var zustand = require('zustand');
35
35
  var core = require('@dnd-kit/core');
36
36
  var sortable = require('@dnd-kit/sortable');
37
37
  var utilities = require('@dnd-kit/utilities');
@@ -9868,6 +9868,486 @@ var CustomAlert = ({
9868
9868
  }
9869
9869
  );
9870
9870
  };
9871
+ var buttonVariants = classVarianceAuthority.cva(
9872
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
9873
+ {
9874
+ variants: {
9875
+ variant: {
9876
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
9877
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
9878
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
9879
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
9880
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
9881
+ link: "text-primary underline-offset-4 hover:underline"
9882
+ },
9883
+ size: {
9884
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
9885
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
9886
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
9887
+ icon: "size-9",
9888
+ "icon-sm": "size-8",
9889
+ "icon-lg": "size-10"
9890
+ }
9891
+ },
9892
+ defaultVariants: {
9893
+ variant: "default",
9894
+ size: "default"
9895
+ }
9896
+ }
9897
+ );
9898
+ function Button({
9899
+ className,
9900
+ variant = "default",
9901
+ size = "default",
9902
+ asChild = false,
9903
+ ...props
9904
+ }) {
9905
+ const Comp = asChild ? reactSlot.Slot : "button";
9906
+ return /* @__PURE__ */ jsxRuntime.jsx(
9907
+ Comp,
9908
+ {
9909
+ "data-slot": "button",
9910
+ "data-variant": variant,
9911
+ "data-size": size,
9912
+ className: cn(buttonVariants({ variant, size, className })),
9913
+ ...props
9914
+ }
9915
+ );
9916
+ }
9917
+ function normalizeBorder(border, defaultWidth = 4) {
9918
+ if (!border) return null;
9919
+ if (typeof border === "string") {
9920
+ return { width: defaultWidth, color: border };
9921
+ }
9922
+ return { width: border.width ?? defaultWidth, color: border.color };
9923
+ }
9924
+ function generateBorderShadows(borders) {
9925
+ if (!borders) return "none";
9926
+ const shadows = [];
9927
+ const allBorder = normalizeBorder(borders.all);
9928
+ const left = normalizeBorder(borders.left) ?? allBorder;
9929
+ const right = normalizeBorder(borders.right) ?? allBorder;
9930
+ const top = normalizeBorder(borders.top) ?? allBorder;
9931
+ const bottom = normalizeBorder(borders.bottom) ?? allBorder;
9932
+ if (left?.color) {
9933
+ shadows.push(`inset ${left.width}px 0 0 0 ${left.color}`);
9934
+ }
9935
+ if (right?.color) {
9936
+ shadows.push(`inset -${right.width}px 0 0 0 ${right.color}`);
9937
+ }
9938
+ if (top?.color) {
9939
+ shadows.push(`inset 0 ${top.width}px 0 0 ${top.color}`);
9940
+ }
9941
+ if (bottom?.color) {
9942
+ shadows.push(`inset 0 -${bottom.width}px 0 0 ${bottom.color}`);
9943
+ }
9944
+ return shadows.length > 0 ? shadows.join(", ") : "none";
9945
+ }
9946
+ var Key = ({
9947
+ label,
9948
+ onClick,
9949
+ onDoubleClick,
9950
+ style,
9951
+ disabled = false,
9952
+ className,
9953
+ shortcut,
9954
+ children,
9955
+ withLabel = true,
9956
+ isActive = false,
9957
+ fontSize = "text-sm",
9958
+ icons,
9959
+ borders,
9960
+ // iconSize = 72,
9961
+ iconClassName = "w-8 h-8"
9962
+ }) => {
9963
+ let content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9964
+ withLabel && label,
9965
+ shortcut && ` (${shortcut})`
9966
+ ] });
9967
+ if (children) content = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
9968
+ const borderShadow = generateBorderShadows(borders);
9969
+ const hasBorders = borders && borderShadow !== "none";
9970
+ return /* @__PURE__ */ jsxRuntime.jsx(
9971
+ Button,
9972
+ {
9973
+ disabled,
9974
+ onDoubleClick,
9975
+ onClick: (e) => onClick?.(label ?? e.currentTarget.textContent ?? ""),
9976
+ style: {
9977
+ ...style,
9978
+ ...hasBorders && { boxShadow: borderShadow }
9979
+ },
9980
+ className: cn(
9981
+ // Base
9982
+ "shadow-md shadow-black/20",
9983
+ "flex flex-1 items-center justify-center rounded-lg h-full w-full",
9984
+ "font-mono font-bold transition-all duration-100",
9985
+ "active:scale-95",
9986
+ fontSize,
9987
+ // Estados base (soft UI)
9988
+ "border border-(--color-border)",
9989
+ "bg-(--color-secondary-soft) text-(--color-foreground)",
9990
+ // Hover
9991
+ "hover:bg-(--color-accent-soft)",
9992
+ // Active click (presionado)
9993
+ "active:bg-(--color-primary) active:text-(--color-primary-foreground)",
9994
+ // Estado activo (seleccionado)
9995
+ isActive && "bg-(--color-primary) text-(--color-primary-foreground) border-(--color-primary)",
9996
+ // Backspace especial
9997
+ // label === '⌫' &&
9998
+ // 'bg-(--color-destructive) text-white hover:opacity-90',
9999
+ // Overflow hidden para que los bordes respeten el border-radius
10000
+ "overflow-hidden",
10001
+ className
10002
+ ),
10003
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center items-center", children: [
10004
+ icons && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row justify-center text-3xl", children: icons.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(
10005
+ IconComponent,
10006
+ {
10007
+ className: iconClassName
10008
+ },
10009
+ index
10010
+ )) }),
10011
+ content
10012
+ ] })
10013
+ }
10014
+ );
10015
+ };
10016
+ var applyCase = (label, upper) => {
10017
+ if (!label || label.length !== 1 || !/[a-z]/.test(label)) return label;
10018
+ return upper ? label.toUpperCase() : label;
10019
+ };
10020
+ var letter = (l, isUpper, handleKey) => ({
10021
+ label: applyCase(l, isUpper),
10022
+ onClick: handleKey,
10023
+ className: "flex-1"
10024
+ });
10025
+
10026
+ // src/components/custom/keyboard/keyboard-base.tsx
10027
+ var BaseKeyboard = class {
10028
+ constructor() {
10029
+ }
10030
+ };
10031
+ var KeyboardBuilder = ({
10032
+ keys,
10033
+ withCard = false,
10034
+ className,
10035
+ keyFontSize: keyFontSize3
10036
+ }) => {
10037
+ const keyMap = React3.useMemo(() => {
10038
+ const map = /* @__PURE__ */ new Map();
10039
+ keys?.forEach((row) => {
10040
+ row.forEach((k) => {
10041
+ if (k.shortcut) {
10042
+ map.set(k.shortcut.toLowerCase(), k);
10043
+ }
10044
+ });
10045
+ });
10046
+ return map;
10047
+ }, [keys]);
10048
+ const triggerKey = React3.useCallback((pressedKey) => {
10049
+ const key = keyMap.get(pressedKey.toLowerCase());
10050
+ if (key && !key.disabled) {
10051
+ key.onClick?.(pressedKey);
10052
+ const keyboardEvent = new KeyboardEvent("keydown", {
10053
+ key: pressedKey,
10054
+ bubbles: true
10055
+ });
10056
+ window.dispatchEvent(keyboardEvent);
10057
+ }
10058
+ }, [keyMap]);
10059
+ React3.useEffect(() => {
10060
+ const handleKeyDown = (event) => {
10061
+ const active = document.activeElement;
10062
+ if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement || active && active.getAttribute("contenteditable") === "true") {
10063
+ console.log("\u{1F680} ~ Ignorando tecla porque el foco est\xE1 en un input:", event.key);
10064
+ return;
10065
+ }
10066
+ triggerKey(event.key);
10067
+ event.preventDefault();
10068
+ };
10069
+ window.addEventListener("keydown", handleKeyDown);
10070
+ return () => {
10071
+ window.removeEventListener("keydown", handleKeyDown);
10072
+ };
10073
+ }, [triggerKey]);
10074
+ const content = /* @__PURE__ */ jsxRuntime.jsx(
10075
+ "div",
10076
+ {
10077
+ className: cn(
10078
+ `flex-1 grid grid-rows-${keys?.length} h-full`,
10079
+ className
10080
+ ),
10081
+ children: keys?.map((row, ri) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 p-1 h-full", children: row.map((key, indx) => {
10082
+ const handleClick = () => {
10083
+ triggerKey(key.label ?? "");
10084
+ key.onClick?.(key.label ?? "");
10085
+ if (!key.shortcut) return;
10086
+ triggerKey(key.shortcut);
10087
+ };
10088
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10089
+ key.label == "" && !key.icons?.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${key.className}` }, indx),
10090
+ (key.label != "" || key.icons?.length) && /* @__PURE__ */ jsxRuntime.jsx(
10091
+ Key,
10092
+ {
10093
+ borders: {
10094
+ left: key.disabled ? "grey" : "",
10095
+ bottom: key.disabled ? "grey" : ""
10096
+ },
10097
+ label: key.label,
10098
+ onClick: handleClick,
10099
+ shortcut: key.shortcut,
10100
+ icons: key.icons,
10101
+ className: `${key.className} ${key.disabled ? "bg-muted-foreground h-full" : "h-full"}`,
10102
+ iconClassName: key.iconClassName,
10103
+ iconSize: key.iconSize,
10104
+ fontSize: keyFontSize3,
10105
+ isActive: key.isActive,
10106
+ disabled: key.disabled,
10107
+ children: key.children
10108
+ },
10109
+ indx
10110
+ )
10111
+ ] });
10112
+ }) }, ri))
10113
+ }
10114
+ );
10115
+ if (!withCard) return content;
10116
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full h-full m-0.5 p-1", className), children: content });
10117
+ };
10118
+
10119
+ // src/components/custom/keyboard/keyboard-types.ts
10120
+ var KeyboardTypes = /* @__PURE__ */ ((KeyboardTypes2) => {
10121
+ KeyboardTypes2["QWERTY"] = "qwerty";
10122
+ KeyboardTypes2["NUMBER"] = "number";
10123
+ KeyboardTypes2["QWERTY_NOT_CHARS"] = "qwerty_not_chars";
10124
+ return KeyboardTypes2;
10125
+ })(KeyboardTypes || {});
10126
+
10127
+ // src/components/custom/keyboard/providers/keyboard.store.ts
10128
+ var useKeyboardStore = zustand.create((set, get) => ({
10129
+ activeInput: null,
10130
+ inputs: {},
10131
+ type: "qwerty" /* QWERTY */,
10132
+ currentInputField: null,
10133
+ setCurrentInputField(inputField) {
10134
+ set({ currentInputField: inputField });
10135
+ console.log("Current Input Field set to:", inputField);
10136
+ },
10137
+ isOpen: false,
10138
+ setIsOpen() {
10139
+ set({ isOpen: !get().isOpen });
10140
+ },
10141
+ registerInput: (id, initialValue = "") => set((state) => ({
10142
+ inputs: {
10143
+ ...state.inputs,
10144
+ [id]: initialValue
10145
+ }
10146
+ })),
10147
+ unregisterInput: (id) => set((state) => {
10148
+ const newInputs = { ...state.inputs };
10149
+ delete newInputs[id];
10150
+ return { inputs: newInputs };
10151
+ }),
10152
+ focusInput: (id) => set({ activeInput: id }),
10153
+ write: (char) => set((state) => {
10154
+ let currentInputField = state.currentInputField;
10155
+ if (currentInputField && currentInputField.field) {
10156
+ currentInputField.field.value += char;
10157
+ set({ currentInputField });
10158
+ console.log("Updated currentInputField value:", state.currentInputField?.field?.value);
10159
+ }
10160
+ if (!state.activeInput) return state;
10161
+ const current = state.inputs[state.activeInput] || "";
10162
+ return {
10163
+ inputs: {
10164
+ ...state.inputs,
10165
+ [state.activeInput]: current + char
10166
+ }
10167
+ };
10168
+ }),
10169
+ backspace: () => set((state) => {
10170
+ if (!state.activeInput) return state;
10171
+ const current = state.inputs[state.activeInput] || "";
10172
+ return {
10173
+ inputs: {
10174
+ ...state.inputs,
10175
+ [state.activeInput]: current.slice(0, -1)
10176
+ }
10177
+ };
10178
+ }),
10179
+ clear: () => set((state) => {
10180
+ if (!state.activeInput) return state;
10181
+ return {
10182
+ inputs: {
10183
+ ...state.inputs,
10184
+ [state.activeInput]: ""
10185
+ }
10186
+ };
10187
+ }),
10188
+ setValue: (id, value) => set((state) => ({
10189
+ inputs: {
10190
+ ...state.inputs,
10191
+ [id]: value
10192
+ }
10193
+ }))
10194
+ }));
10195
+ var QwertyKeyboard = class extends BaseKeyboard {
10196
+ render() {
10197
+ return /* @__PURE__ */ jsxRuntime.jsx(KeyboardQwerty, {});
10198
+ }
10199
+ };
10200
+ var KeyboardQwerty = ({ onKeyPress, onEnter, keyFontSize: keyFontSize3 = "text-2xl", onDelete }) => {
10201
+ const [shiftMode, setShiftMode] = React3.useState("off");
10202
+ const [mode, setMode] = React3.useState("letters");
10203
+ const lastShiftPress = React3.useRef(0);
10204
+ const { currentInputField, write } = useKeyboardStore();
10205
+ const isUpper = shiftMode !== "off";
10206
+ const handleShift = () => {
10207
+ const now = Date.now();
10208
+ if (now - lastShiftPress.current < 300) {
10209
+ setShiftMode((prev) => prev === "caps" ? "off" : "caps");
10210
+ } else {
10211
+ setShiftMode((prev) => prev === "once" ? "off" : "once");
10212
+ }
10213
+ lastShiftPress.current = now;
10214
+ };
10215
+ const handleKey = (key) => {
10216
+ console.log("Key pressed:", key);
10217
+ const output = isUpper ? key.toUpperCase() : key;
10218
+ onKeyPress?.(output);
10219
+ write(output);
10220
+ if (shiftMode === "once") {
10221
+ setShiftMode("off");
10222
+ }
10223
+ };
10224
+ const handleCaps = () => {
10225
+ setShiftMode((prev) => prev === "caps" ? "off" : "caps");
10226
+ };
10227
+ const shiftLabel = shiftMode === "caps" ? lucideReact.ArrowBigUpDash : lucideReact.ArrowBigUp;
10228
+ const shiftActive = shiftMode !== "off";
10229
+ if (mode === "symbols") {
10230
+ const keys = [
10231
+ ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")"],
10232
+ ["~", "`", "|", "\\", "/", "{", "}", "[", "]"],
10233
+ ["+", "=", "<", ">", "?", "'", '"', ":", ";"]
10234
+ ].map(
10235
+ (row) => row.map((k) => ({
10236
+ label: k,
10237
+ onClick: () => handleKey(k)
10238
+ }))
10239
+ );
10240
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
10241
+ KeyboardBuilder,
10242
+ {
10243
+ className: "w-full h-full",
10244
+ keyFontSize: keyFontSize3,
10245
+ keys: [
10246
+ ...keys,
10247
+ [
10248
+ { label: "ABC", onClick: () => setMode("letters"), className: "flex-[2]" },
10249
+ { label: " ", onClick: () => handleKey(" "), className: "flex-[4]" },
10250
+ { label: "Enter", onClick: onEnter, className: "flex-[2] bg-green-200 " }
10251
+ ]
10252
+ ]
10253
+ }
10254
+ ) });
10255
+ }
10256
+ const fila1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"].map((l) => letter(l, isUpper, handleKey));
10257
+ const fila2 = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"].map((l) => letter(l, isUpper, handleKey));
10258
+ const fila3 = ["a", "s", "d", "f", "g", "h", "j", "k", "l"].map((l) => letter(l, isUpper, handleKey));
10259
+ const fila4 = ["z", "x", "c", "v", "b", "n", "m"].map((l) => letter(l, isUpper, handleKey));
10260
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full flex flex-col", children: [
10261
+ currentInputField && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 h-full 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: [
10262
+ " ",
10263
+ currentInputField.field?.value,
10264
+ " "
10265
+ ] }) }),
10266
+ /* @__PURE__ */ jsxRuntime.jsx(
10267
+ KeyboardBuilder,
10268
+ {
10269
+ className: "w-full h-full flex-3",
10270
+ keyFontSize: keyFontSize3,
10271
+ keys: [
10272
+ [
10273
+ { label: "esc", onClick: () => {
10274
+ }, className: "bg-red-200" },
10275
+ ...fila1
10276
+ ],
10277
+ [
10278
+ { label: "tab", onClick: () => {
10279
+ } },
10280
+ ...fila2
10281
+ // { icons:[Delete], onClick: backspace, className: 'text-xs' },
10282
+ ],
10283
+ [
10284
+ { label: "caps", onClick: handleCaps },
10285
+ ...fila3
10286
+ ],
10287
+ [
10288
+ {
10289
+ label: "",
10290
+ icons: [shiftLabel],
10291
+ onClick: handleShift,
10292
+ className: "flex-1",
10293
+ isActive: shiftActive
10294
+ },
10295
+ ...fila4,
10296
+ { label: ".", onClick: () => handleKey(".") },
10297
+ { label: "-", onClick: () => handleKey("-") },
10298
+ { label: "_", onClick: () => handleKey("_") }
10299
+ ],
10300
+ [
10301
+ { label: "?123", onClick: () => setMode("symbols"), className: "flex-[2]" },
10302
+ { label: " ", onClick: () => handleKey(" "), className: "flex-[4]" },
10303
+ { label: "Enter", onClick: onEnter, className: "flex-[2] bg-green-200" }
10304
+ ]
10305
+ ]
10306
+ }
10307
+ )
10308
+ ] });
10309
+ };
10310
+
10311
+ // src/components/custom/form/inputs/base/definitions.ts
10312
+ var flattenFields = (fields, onAnyFieldChange) => {
10313
+ const result = [];
10314
+ for (const field of fields) {
10315
+ if (Array.isArray(field)) {
10316
+ result.push(...flattenFields(field));
10317
+ } else if (field.fields) {
10318
+ result.push(...flattenFields(field.fields));
10319
+ } else {
10320
+ if (onAnyFieldChange) field.onAnyFieldChange = (data) => onAnyFieldChange(data);
10321
+ result.push(field);
10322
+ }
10323
+ }
10324
+ return result;
10325
+ };
10326
+ var TextInputType = /* @__PURE__ */ ((TextInputType2) => {
10327
+ TextInputType2["DEFAULT"] = "default";
10328
+ TextInputType2["NUMBER"] = "number";
10329
+ TextInputType2["EMAIL"] = "email";
10330
+ TextInputType2["PHONE"] = "phone";
10331
+ TextInputType2["PASSWORD"] = "password";
10332
+ return TextInputType2;
10333
+ })(TextInputType || {});
10334
+ var keyboardMap = {
10335
+ ["qwerty" /* QWERTY */]: QwertyKeyboard,
10336
+ ["qwerty_not_chars" /* QWERTY_NOT_CHARS */]: QwertyKeyboard,
10337
+ ["number" /* NUMBER */]: QwertyKeyboard
10338
+ };
10339
+ var KeyboardFactory = class {
10340
+ static create(typeKeyboard, input) {
10341
+ const inputKbType = input?.keyboardType;
10342
+ let keyboardType = typeKeyboard ?? "qwerty" /* QWERTY */;
10343
+ if (inputKbType) {
10344
+ if (inputKbType == "number" /* NUMBER */) keyboardType = "number" /* NUMBER */;
10345
+ }
10346
+ const keyboardClass = keyboardMap[keyboardType] ?? QwertyKeyboard;
10347
+ const instance = new keyboardClass();
10348
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: instance.render() });
10349
+ }
10350
+ };
9871
10351
 
9872
10352
  // src/components/custom/form/input-errors.ts
9873
10353
  var validationMessages = {
@@ -9938,30 +10418,6 @@ var isValidField = (input, form, defaultValue) => {
9938
10418
  return !fieldState.error && value !== void 0 && value !== "";
9939
10419
  };
9940
10420
 
9941
- // src/components/custom/form/inputs/base/definitions.ts
9942
- var flattenFields = (fields, onAnyFieldChange) => {
9943
- const result = [];
9944
- for (const field of fields) {
9945
- if (Array.isArray(field)) {
9946
- result.push(...flattenFields(field));
9947
- } else if (field.fields) {
9948
- result.push(...flattenFields(field.fields));
9949
- } else {
9950
- if (onAnyFieldChange) field.onAnyFieldChange = (data) => onAnyFieldChange(data);
9951
- result.push(field);
9952
- }
9953
- }
9954
- return result;
9955
- };
9956
- var TextInputType = /* @__PURE__ */ ((TextInputType2) => {
9957
- TextInputType2["DEFAULT"] = "default";
9958
- TextInputType2["NUMBER"] = "number";
9959
- TextInputType2["EMAIL"] = "email";
9960
- TextInputType2["PHONE"] = "phone";
9961
- TextInputType2["PASSWORD"] = "password";
9962
- return TextInputType2;
9963
- })(TextInputType || {});
9964
-
9965
10421
  // src/components/custom/form/inputs/base/input-types.ts
9966
10422
  var InputTypes = /* @__PURE__ */ ((InputTypes2) => {
9967
10423
  InputTypes2["HIDDEN"] = "hidden";
@@ -10108,7 +10564,166 @@ function AccordionContent({
10108
10564
  }
10109
10565
  );
10110
10566
  }
10111
- var badgeVariants = classVarianceAuthority.cva(
10567
+ function AlertDialog({
10568
+ ...props
10569
+ }) {
10570
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Root, { "data-slot": "alert-dialog", ...props });
10571
+ }
10572
+ function AlertDialogTrigger({
10573
+ ...props
10574
+ }) {
10575
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
10576
+ }
10577
+ function AlertDialogPortal({
10578
+ ...props
10579
+ }) {
10580
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Portal, { "data-slot": "alert-dialog-portal", ...props });
10581
+ }
10582
+ function AlertDialogOverlay({
10583
+ className,
10584
+ ...props
10585
+ }) {
10586
+ return /* @__PURE__ */ jsxRuntime.jsx(
10587
+ radixUi.AlertDialog.Overlay,
10588
+ {
10589
+ "data-slot": "alert-dialog-overlay",
10590
+ className: cn(
10591
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
10592
+ className
10593
+ ),
10594
+ ...props
10595
+ }
10596
+ );
10597
+ }
10598
+ function AlertDialogContent({
10599
+ className,
10600
+ size = "default",
10601
+ ...props
10602
+ }) {
10603
+ return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
10604
+ /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
10605
+ /* @__PURE__ */ jsxRuntime.jsx(
10606
+ radixUi.AlertDialog.Content,
10607
+ {
10608
+ "data-slot": "alert-dialog-content",
10609
+ "data-size": size,
10610
+ className: cn(
10611
+ "group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
10612
+ className
10613
+ ),
10614
+ ...props
10615
+ }
10616
+ )
10617
+ ] });
10618
+ }
10619
+ function AlertDialogHeader({
10620
+ className,
10621
+ ...props
10622
+ }) {
10623
+ return /* @__PURE__ */ jsxRuntime.jsx(
10624
+ "div",
10625
+ {
10626
+ "data-slot": "alert-dialog-header",
10627
+ className: cn(
10628
+ "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
10629
+ className
10630
+ ),
10631
+ ...props
10632
+ }
10633
+ );
10634
+ }
10635
+ function AlertDialogFooter({
10636
+ className,
10637
+ ...props
10638
+ }) {
10639
+ return /* @__PURE__ */ jsxRuntime.jsx(
10640
+ "div",
10641
+ {
10642
+ "data-slot": "alert-dialog-footer",
10643
+ className: cn(
10644
+ "flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
10645
+ className
10646
+ ),
10647
+ ...props
10648
+ }
10649
+ );
10650
+ }
10651
+ function AlertDialogTitle({
10652
+ className,
10653
+ ...props
10654
+ }) {
10655
+ return /* @__PURE__ */ jsxRuntime.jsx(
10656
+ radixUi.AlertDialog.Title,
10657
+ {
10658
+ "data-slot": "alert-dialog-title",
10659
+ className: cn(
10660
+ "text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
10661
+ className
10662
+ ),
10663
+ ...props
10664
+ }
10665
+ );
10666
+ }
10667
+ function AlertDialogDescription({
10668
+ className,
10669
+ ...props
10670
+ }) {
10671
+ return /* @__PURE__ */ jsxRuntime.jsx(
10672
+ radixUi.AlertDialog.Description,
10673
+ {
10674
+ "data-slot": "alert-dialog-description",
10675
+ className: cn("text-sm text-muted-foreground", className),
10676
+ ...props
10677
+ }
10678
+ );
10679
+ }
10680
+ function AlertDialogMedia({
10681
+ className,
10682
+ ...props
10683
+ }) {
10684
+ return /* @__PURE__ */ jsxRuntime.jsx(
10685
+ "div",
10686
+ {
10687
+ "data-slot": "alert-dialog-media",
10688
+ className: cn(
10689
+ "mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
10690
+ className
10691
+ ),
10692
+ ...props
10693
+ }
10694
+ );
10695
+ }
10696
+ function AlertDialogAction({
10697
+ className,
10698
+ variant = "default",
10699
+ size = "default",
10700
+ ...props
10701
+ }) {
10702
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10703
+ radixUi.AlertDialog.Action,
10704
+ {
10705
+ "data-slot": "alert-dialog-action",
10706
+ className: cn(className),
10707
+ ...props
10708
+ }
10709
+ ) });
10710
+ }
10711
+ function AlertDialogCancel({
10712
+ className,
10713
+ variant = "outline",
10714
+ size = "default",
10715
+ ...props
10716
+ }) {
10717
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10718
+ radixUi.AlertDialog.Cancel,
10719
+ {
10720
+ "data-slot": "alert-dialog-cancel",
10721
+ className: cn(className),
10722
+ ...props
10723
+ }
10724
+ ) });
10725
+ }
10726
+ var badgeVariants = classVarianceAuthority.cva(
10112
10727
  "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
10113
10728
  {
10114
10729
  variants: {
@@ -10225,52 +10840,6 @@ function ButtonGroupSeparator({
10225
10840
  }
10226
10841
  );
10227
10842
  }
10228
- var buttonVariants = classVarianceAuthority.cva(
10229
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
10230
- {
10231
- variants: {
10232
- variant: {
10233
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
10234
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
10235
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
10236
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
10237
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
10238
- link: "text-primary underline-offset-4 hover:underline"
10239
- },
10240
- size: {
10241
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
10242
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
10243
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
10244
- icon: "size-9",
10245
- "icon-sm": "size-8",
10246
- "icon-lg": "size-10"
10247
- }
10248
- },
10249
- defaultVariants: {
10250
- variant: "default",
10251
- size: "default"
10252
- }
10253
- }
10254
- );
10255
- function Button({
10256
- className,
10257
- variant = "default",
10258
- size = "default",
10259
- asChild = false,
10260
- ...props
10261
- }) {
10262
- const Comp = asChild ? reactSlot.Slot : "button";
10263
- return /* @__PURE__ */ jsxRuntime.jsx(
10264
- Comp,
10265
- {
10266
- "data-slot": "button",
10267
- "data-variant": variant,
10268
- "data-size": size,
10269
- className: cn(buttonVariants({ variant, size, className })),
10270
- ...props
10271
- }
10272
- );
10273
- }
10274
10843
  function Calendar({
10275
10844
  className,
10276
10845
  classNames,
@@ -11748,7 +12317,7 @@ function SheetOverlay({
11748
12317
  {
11749
12318
  "data-slot": "sheet-overlay",
11750
12319
  className: cn(
11751
- "fixed inset-0 z-50 bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
12320
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
11752
12321
  className
11753
12322
  ),
11754
12323
  ...props
@@ -11768,29 +12337,21 @@ function SheetContent({
11768
12337
  radixUi.Dialog.Content,
11769
12338
  {
11770
12339
  "data-slot": "sheet-content",
11771
- "data-side": side,
11772
12340
  className: cn(
11773
- "fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",
12341
+ "fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
12342
+ side === "right" && "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
12343
+ side === "left" && "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
12344
+ side === "top" && "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
12345
+ side === "bottom" && "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
11774
12346
  className
11775
12347
  ),
11776
12348
  ...props,
11777
12349
  children: [
11778
12350
  children,
11779
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Close, { "data-slot": "sheet-close", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
11780
- Button,
11781
- {
11782
- variant: "ghost",
11783
- className: "absolute top-3 right-3",
11784
- size: "icon-sm",
11785
- children: [
11786
- /* @__PURE__ */ jsxRuntime.jsx(
11787
- lucideReact.XIcon,
11788
- {}
11789
- ),
11790
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
11791
- ]
11792
- }
11793
- ) })
12351
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
12352
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4" }),
12353
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
12354
+ ] })
11794
12355
  ]
11795
12356
  }
11796
12357
  )
@@ -11801,7 +12362,7 @@ function SheetHeader({ className, ...props }) {
11801
12362
  "div",
11802
12363
  {
11803
12364
  "data-slot": "sheet-header",
11804
- className: cn("flex flex-col gap-0.5 p-4", className),
12365
+ className: cn("flex flex-col gap-1.5 p-4", className),
11805
12366
  ...props
11806
12367
  }
11807
12368
  );
@@ -11824,10 +12385,7 @@ function SheetTitle({
11824
12385
  radixUi.Dialog.Title,
11825
12386
  {
11826
12387
  "data-slot": "sheet-title",
11827
- className: cn(
11828
- "font-heading text-base font-medium text-foreground",
11829
- className
11830
- ),
12388
+ className: cn("font-semibold text-foreground", className),
11831
12389
  ...props
11832
12390
  }
11833
12391
  );
@@ -13030,61 +13588,6 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
13030
13588
  );
13031
13589
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: formField });
13032
13590
  };
13033
- var useKeyboardStore = zustand.create((set, get) => ({
13034
- activeInput: null,
13035
- inputs: {},
13036
- isOpen: false,
13037
- setIsOpen() {
13038
- set({ isOpen: !get().isOpen });
13039
- },
13040
- registerInput: (id, initialValue = "") => set((state) => ({
13041
- inputs: {
13042
- ...state.inputs,
13043
- [id]: initialValue
13044
- }
13045
- })),
13046
- unregisterInput: (id) => set((state) => {
13047
- const newInputs = { ...state.inputs };
13048
- delete newInputs[id];
13049
- return { inputs: newInputs };
13050
- }),
13051
- focusInput: (id) => set({ activeInput: id }),
13052
- write: (char) => set((state) => {
13053
- if (!state.activeInput) return state;
13054
- const current = state.inputs[state.activeInput] || "";
13055
- return {
13056
- inputs: {
13057
- ...state.inputs,
13058
- [state.activeInput]: current + char
13059
- }
13060
- };
13061
- }),
13062
- backspace: () => set((state) => {
13063
- if (!state.activeInput) return state;
13064
- const current = state.inputs[state.activeInput] || "";
13065
- return {
13066
- inputs: {
13067
- ...state.inputs,
13068
- [state.activeInput]: current.slice(0, -1)
13069
- }
13070
- };
13071
- }),
13072
- clear: () => set((state) => {
13073
- if (!state.activeInput) return state;
13074
- return {
13075
- inputs: {
13076
- ...state.inputs,
13077
- [state.activeInput]: ""
13078
- }
13079
- };
13080
- }),
13081
- setValue: (id, value) => set((state) => ({
13082
- inputs: {
13083
- ...state.inputs,
13084
- [id]: value
13085
- }
13086
- }))
13087
- }));
13088
13591
  var TextInputGroup = class extends BaseInput {
13089
13592
  render() {
13090
13593
  const { input, form, isSubmitting } = this;
@@ -13145,6 +13648,7 @@ var CustomInputGroup = ({
13145
13648
  const isNumberField = input.keyboardType === "number" /* NUMBER */;
13146
13649
  const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
13147
13650
  const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
13651
+ const setCurrentInputField = useKeyboardStore((state) => state.setCurrentInputField);
13148
13652
  const applyMask = (value2, mask) => {
13149
13653
  if (!mask) return value2;
13150
13654
  if (typeof mask === "string") {
@@ -13214,6 +13718,7 @@ var CustomInputGroup = ({
13214
13718
  placeholder: input.placeHolder,
13215
13719
  disabled: input.disabled || isSubmitting,
13216
13720
  onBlur: field?.onBlur,
13721
+ onFocus: () => setCurrentInputField({ input, field }),
13217
13722
  name: field?.name,
13218
13723
  ref: field?.ref,
13219
13724
  type: isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text",
@@ -13259,7 +13764,18 @@ var CustomInputGroup = ({
13259
13764
  children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
13260
13765
  }
13261
13766
  ),
13262
- withKeyboard && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "text-2xl", onClick: setIsOpen, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Keyboard, {}) }),
13767
+ withKeyboard && /* @__PURE__ */ jsxRuntime.jsx(
13768
+ "button",
13769
+ {
13770
+ type: "button",
13771
+ className: "text-2xl",
13772
+ onClick: () => {
13773
+ setIsOpen();
13774
+ setCurrentInputField({ input, field });
13775
+ },
13776
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Keyboard, {})
13777
+ }
13778
+ ),
13263
13779
  autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid ? iconValidState : iconInvalidState })
13264
13780
  ] })
13265
13781
  ] });
@@ -16155,6 +16671,167 @@ var FormFieldsGrid = ({
16155
16671
  );
16156
16672
  }) });
16157
16673
  };
16674
+ var CustomSheet = ({ title = "", children, childrenHeader, isOpen, className, side = "bottom" }) => {
16675
+ const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
16676
+ const storeIsOpen = useKeyboardStore((state) => state.isOpen);
16677
+ const controlledIsOpen = typeof isOpen === "boolean" ? isOpen : storeIsOpen;
16678
+ return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: controlledIsOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(SheetContent, { side, children: [
16679
+ /* @__PURE__ */ jsxRuntime.jsxs(SheetHeader, { children: [
16680
+ /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: title }),
16681
+ /* @__PURE__ */ jsxRuntime.jsxs(SheetDescription, { children: [
16682
+ childrenHeader,
16683
+ children
16684
+ ] })
16685
+ ] }),
16686
+ /* @__PURE__ */ jsxRuntime.jsx(SheetFooter, {})
16687
+ ] }) });
16688
+ };
16689
+ var DynamicDialog = ({
16690
+ trigger,
16691
+ title = "Are you absolutely sure?",
16692
+ description = "This action cannot be undone.",
16693
+ cancelText = "Cancel",
16694
+ actionText = "Confirmar",
16695
+ className = "bg-red-600 text-white font-bold",
16696
+ variant = "info",
16697
+ onAction,
16698
+ children,
16699
+ listBtnConfig = [],
16700
+ btnGroupDirection = "flex-end",
16701
+ submitBtnClass = "h-16",
16702
+ iconSize = "w-16 h-16",
16703
+ btnHeightClass = "h-16",
16704
+ showActionBtn = true
16705
+ }) => {
16706
+ const getVariantStyles = () => {
16707
+ switch (variant) {
16708
+ case "info":
16709
+ return {
16710
+ container: "!bg-blue-100 !text-blue-800 dark:!bg-blue-900 dark:!text-blue-200",
16711
+ border: "!border-blue-500/30 dark:!border-blue-300/30",
16712
+ media: "bg-blue-500/10 dark:bg-blue-300/10",
16713
+ action: "text-blue-200 bg-blue-500 dark:bg-blue-300",
16714
+ icon: "text-blue-500 dark:text-blue-300",
16715
+ iconNode: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleWarning, { className: iconSize })
16716
+ };
16717
+ case "warning":
16718
+ return {
16719
+ container: "!bg-yellow-100 !text-yellow-800 dark:!bg-yellow-900 dark:!text-yellow-200",
16720
+ border: "!border-yellow-500/30 dark:!border-yellow-300/30",
16721
+ media: "bg-yellow-500/10 dark:bg-yellow-300/10",
16722
+ action: "text-yellow-200 bg-yellow-500 dark:bg-yellow-300",
16723
+ icon: "text-yellow-500 dark:text-yellow-300",
16724
+ iconNode: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlert, { className: iconSize })
16725
+ };
16726
+ case "error":
16727
+ case "delete":
16728
+ return {
16729
+ container: "!bg-red-100 !text-red-800 dark:!bg-red-900 dark:!text-red-200",
16730
+ border: "!border-red-500/30 dark:!border-red-300/30",
16731
+ media: "bg-red-500/10 dark:bg-red-300/10",
16732
+ action: "text-red-200 bg-red-500 dark:bg-red-300",
16733
+ icon: "text-red-500 dark:text-red-300",
16734
+ iconNode: variant === "delete" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2Icon, { className: iconSize }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.OctagonX, { className: iconSize })
16735
+ };
16736
+ case "success":
16737
+ return {
16738
+ container: "!bg-green-100 !text-green-800 dark:!bg-green-900 dark:!text-green-200",
16739
+ border: "!border-green-500/30 dark:!border-green-300/30",
16740
+ media: "bg-green-500/10 dark:bg-green-300/10",
16741
+ action: "text-green-200 bg-green-500 dark:bg-green-300",
16742
+ icon: "text-green-500 dark:text-green-300",
16743
+ iconNode: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheck, { className: iconSize })
16744
+ };
16745
+ case "confirm":
16746
+ return {
16747
+ container: "!bg-purple-100 !text-purple-800 dark:!bg-purple-900 dark:!text-purple-200",
16748
+ border: "!border-purple-500/30 dark:!border-purple-300/30",
16749
+ media: "bg-purple-500/10 dark:bg-purple-300/10",
16750
+ action: "text-purple-200 bg-purple-500 dark:bg-purple-300",
16751
+ icon: "text-purple-500 dark:text-purple-300",
16752
+ iconNode: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleQuestionMark, { className: iconSize })
16753
+ };
16754
+ }
16755
+ };
16756
+ const styles = getVariantStyles();
16757
+ console.log("onAction", onAction);
16758
+ return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialog, { children: [
16759
+ /* @__PURE__ */ jsxRuntime.jsx(AlertDialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", children: "Show Dialog" }) }),
16760
+ /* @__PURE__ */ jsxRuntime.jsxs(
16761
+ AlertDialogContent,
16762
+ {
16763
+ className: cn(
16764
+ "w-50 h-fit font-mono border-x-8",
16765
+ styles.container,
16766
+ styles.border
16767
+ ),
16768
+ children: [
16769
+ /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogHeader, { className: "justify-center w-full text-center", children: [
16770
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
16771
+ AlertDialogMedia,
16772
+ {
16773
+ className: cn(
16774
+ styles.media,
16775
+ "rounded-full flex items-center justify-center",
16776
+ iconSize
16777
+ // 🔥 ahora controla también el contenedor
16778
+ ),
16779
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.icon, children: styles.iconNode })
16780
+ }
16781
+ ) }),
16782
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AlertDialogTitle, { className: "text-2xl", children: title }) }),
16783
+ /* @__PURE__ */ jsxRuntime.jsx(AlertDialogDescription, { className: "text-xl text-center", children: description })
16784
+ ] }),
16785
+ children,
16786
+ /* @__PURE__ */ jsxRuntime.jsx(AlertDialogFooter, { children: /* @__PURE__ */ jsxRuntime.jsxs(
16787
+ ButtonGroup,
16788
+ {
16789
+ className: "flex w-full",
16790
+ style: {
16791
+ justifyContent: btnGroupDirection,
16792
+ alignItems: "center"
16793
+ },
16794
+ children: [
16795
+ /* @__PURE__ */ jsxRuntime.jsx(AlertDialogCancel, { className: cn("flex-1", btnHeightClass), children: cancelText }),
16796
+ listBtnConfig.map((btn, key) => /* @__PURE__ */ jsxRuntime.jsx(
16797
+ Button,
16798
+ {
16799
+ type: btn.btnType,
16800
+ size: "lg",
16801
+ className: cn(btnHeightClass, submitBtnClass),
16802
+ variant: btn.variant,
16803
+ onClick: btn.onClick,
16804
+ disabled: btn.disabled,
16805
+ children: btn.label
16806
+ },
16807
+ key
16808
+ )),
16809
+ onAction && showActionBtn && /* @__PURE__ */ jsxRuntime.jsx(
16810
+ AlertDialogAction,
16811
+ {
16812
+ onClick: (e) => {
16813
+ e.preventDefault();
16814
+ if (onAction) {
16815
+ onAction();
16816
+ }
16817
+ },
16818
+ className: cn(
16819
+ "flex-1",
16820
+ btnHeightClass,
16821
+ className,
16822
+ styles.action
16823
+ ),
16824
+ children: actionText
16825
+ }
16826
+ )
16827
+ ]
16828
+ }
16829
+ ) })
16830
+ ]
16831
+ }
16832
+ )
16833
+ ] });
16834
+ };
16158
16835
  var DynamicForm = ({
16159
16836
  formTitle,
16160
16837
  formSubTitle,
@@ -16183,9 +16860,13 @@ var DynamicForm = ({
16183
16860
  isWrapInWizard = false,
16184
16861
  totalSteps = 0,
16185
16862
  currentStep = 1,
16186
- submitBtnIcon = lucideReact.Save
16863
+ submitBtnIcon = lucideReact.Save,
16864
+ dialogTitle = "\xBFEst\xE1s seguro?",
16865
+ dialogDescription = "Esta acci\xF3n no se puede deshacer. \xBFDeseas continuar?",
16866
+ withConfirmDialog = false
16187
16867
  }) => {
16188
16868
  const [isPending, startTransition] = React3.useTransition();
16869
+ const currentInputField = useKeyboardStore((state) => state.currentInputField);
16189
16870
  const schema = React3.useMemo(() => {
16190
16871
  const allFields = flattenFields(fields, onAnyFieldChange);
16191
16872
  return getDynamicSchema(allFields, extraValidations);
@@ -16214,7 +16895,38 @@ var DynamicForm = ({
16214
16895
  const resp = { data, form };
16215
16896
  onClick(resp);
16216
16897
  };
16898
+ const withConfirm = /* @__PURE__ */ jsxRuntime.jsx(
16899
+ DynamicDialog,
16900
+ {
16901
+ trigger: /* @__PURE__ */ jsxRuntime.jsxs(
16902
+ Button,
16903
+ {
16904
+ variant: "secondary",
16905
+ size: "lg",
16906
+ type: "button",
16907
+ disabled: isPending,
16908
+ className: "flex items-center gap-3 w-full h-16 px-4 py-3 text-sm hover:bg-zinc-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
16909
+ children: [
16910
+ submitBtnLabel,
16911
+ (totalSteps == 0 || totalSteps == currentStep) && submitBtnIcon && React3__namespace.default.createElement(submitBtnIcon, { className: "h-5 w-5 mr-2" })
16912
+ ]
16913
+ }
16914
+ ),
16915
+ title: dialogTitle,
16916
+ description: dialogDescription,
16917
+ cancelText: "Cancelar",
16918
+ actionText: submitBtnLabel ?? "Procesar",
16919
+ variant: "warning",
16920
+ onAction: onClick ? handleClick : void 0
16921
+ }
16922
+ );
16217
16923
  const formBody = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16924
+ /* @__PURE__ */ jsxRuntime.jsx(
16925
+ CustomSheet,
16926
+ {
16927
+ children: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: KeyboardFactory.create(currentInputField?.input.keyboard ?? "qwerty" /* QWERTY */) })
16928
+ }
16929
+ ),
16218
16930
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full grid grid-cols-1", children: [
16219
16931
  /* @__PURE__ */ jsxRuntime.jsx(
16220
16932
  FormFieldsGrid,
@@ -16245,7 +16957,7 @@ var DynamicForm = ({
16245
16957
  },
16246
16958
  key
16247
16959
  )),
16248
- !readOnly && withSubmitBtn && /* @__PURE__ */ jsxRuntime.jsx(
16960
+ !readOnly && withSubmitBtn && (withConfirmDialog ? withConfirm : /* @__PURE__ */ jsxRuntime.jsx(
16249
16961
  Button,
16250
16962
  {
16251
16963
  type: onClick ? "button" : "submit",
@@ -16261,7 +16973,7 @@ var DynamicForm = ({
16261
16973
  (totalSteps == 0 || totalSteps == currentStep) && submitBtnIcon && React3__namespace.default.createElement(submitBtnIcon, { className: "h-5 w-5 mr-2" })
16262
16974
  ] })
16263
16975
  }
16264
- )
16976
+ ))
16265
16977
  ] })
16266
16978
  ] });
16267
16979
  const formContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -16539,18 +17251,6 @@ var InputList = ({ handleAddInput, inputsTypes }) => {
16539
17251
  );
16540
17252
  }) });
16541
17253
  };
16542
- var CustomSheet = ({ title = "", children, childrenHeader, isOpen, className, side = "bottom" }) => {
16543
- const setIsOpen = useKeyboardStore((state) => state.setIsOpen);
16544
- const storeIsOpen = useKeyboardStore((state) => state.isOpen);
16545
- const controlledIsOpen = typeof isOpen === "boolean" ? isOpen : storeIsOpen;
16546
- return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: controlledIsOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(SheetContent, { side, children: [
16547
- /* @__PURE__ */ jsxRuntime.jsxs(SheetHeader, { children: [
16548
- /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: title }),
16549
- /* @__PURE__ */ jsxRuntime.jsx(SheetDescription, { children: childrenHeader })
16550
- ] }),
16551
- /* @__PURE__ */ jsxRuntime.jsx(SheetFooter, { children })
16552
- ] }) });
16553
- };
16554
17254
  var GenericFilter = ({
16555
17255
  filters = [],
16556
17256
  pagination,
@@ -16777,6 +17477,7 @@ exports.AlertDescription = AlertDescription;
16777
17477
  exports.AlertTitle = AlertTitle;
16778
17478
  exports.Badge = Badge;
16779
17479
  exports.BaseInput = BaseInput;
17480
+ exports.BaseKeyboard = BaseKeyboard;
16780
17481
  exports.Button = Button;
16781
17482
  exports.ButtonGroup = ButtonGroup;
16782
17483
  exports.ButtonGroupInput = ButtonGroupInput;
@@ -16873,7 +17574,12 @@ exports.InputOTPGroup = InputOTPGroup;
16873
17574
  exports.InputOTPSeparator = InputOTPSeparator;
16874
17575
  exports.InputOTPSlot = InputOTPSlot;
16875
17576
  exports.InputTypes = InputTypes;
17577
+ exports.Key = Key;
16876
17578
  exports.KeyValueListInput = KeyValueListInput;
17579
+ exports.KeyboardBuilder = KeyboardBuilder;
17580
+ exports.KeyboardFactory = KeyboardFactory;
17581
+ exports.KeyboardQwerty = KeyboardQwerty;
17582
+ exports.KeyboardTypes = KeyboardTypes;
16877
17583
  exports.Label = Label;
16878
17584
  exports.MultiSelectInput = MultiSelectInput;
16879
17585
  exports.NumberInput = NumberInput;
@@ -16882,6 +17588,7 @@ exports.Popover = Popover;
16882
17588
  exports.PopoverAnchor = PopoverAnchor;
16883
17589
  exports.PopoverContent = PopoverContent;
16884
17590
  exports.PopoverTrigger = PopoverTrigger;
17591
+ exports.QwertyKeyboard = QwertyKeyboard;
16885
17592
  exports.RadioGroup = RadioGroup;
16886
17593
  exports.RadioGroupInput = RadioGroupInput;
16887
17594
  exports.RadioGroupItem = RadioGroupItem;
@@ -16928,6 +17635,7 @@ exports.TooltipContent = TooltipContent;
16928
17635
  exports.TooltipProvider = TooltipProvider;
16929
17636
  exports.TooltipTrigger = TooltipTrigger;
16930
17637
  exports.WizardForm = WizardForm;
17638
+ exports.applyCase = applyCase;
16931
17639
  exports.badgeVariants = badgeVariants;
16932
17640
  exports.buttonGroupVariants = buttonGroupVariants;
16933
17641
  exports.buttonVariants = buttonVariants;
@@ -16943,10 +17651,12 @@ exports.getFieldLabel = getFieldLabel;
16943
17651
  exports.handleOnChage = handleOnChage;
16944
17652
  exports.inputFieldComp = inputFieldComp;
16945
17653
  exports.isValidField = isValidField;
17654
+ exports.letter = letter;
16946
17655
  exports.mockFields = mockFields;
16947
17656
  exports.useDynamicForm = useDynamicForm;
16948
17657
  exports.useFormField = useFormField;
16949
17658
  exports.useFormPersist = useFormPersist;
17659
+ exports.useKeyboardStore = useKeyboardStore;
16950
17660
  exports.validationMessages = validationMessages;
16951
17661
  //# sourceMappingURL=index.cjs.map
16952
17662
  //# sourceMappingURL=index.cjs.map