shadcn-zod-formkit 1.24.0 → 1.26.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 CHANGED
@@ -294,9 +294,11 @@ var InputTypes = /* @__PURE__ */ ((InputTypes2) => {
294
294
  InputTypes2["COMBOBOX"] = "COMBO_BOX";
295
295
  InputTypes2["SORTABLE_LIST"] = "sortable_list";
296
296
  InputTypes2["REPEATER_TABS"] = "repeater_tabs";
297
+ InputTypes2["STRING_LIST"] = "string_list";
297
298
  return InputTypes2;
298
299
  })(InputTypes || {});
299
300
  var inputFieldComp = [
301
+ "string_list" /* STRING_LIST */,
300
302
  "repeater_tabs" /* REPEATER_TABS */,
301
303
  "sortable_list" /* SORTABLE_LIST */,
302
304
  "COMBO_BOX" /* COMBOBOX */,
@@ -967,7 +969,54 @@ function Separator({
967
969
  }
968
970
  );
969
971
  }
970
- classVarianceAuthority.cva(
972
+ function FieldSet({ className, ...props }) {
973
+ return /* @__PURE__ */ jsxRuntime.jsx(
974
+ "fieldset",
975
+ {
976
+ "data-slot": "field-set",
977
+ className: cn(
978
+ "flex flex-col gap-6",
979
+ "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
980
+ className
981
+ ),
982
+ ...props
983
+ }
984
+ );
985
+ }
986
+ function FieldLegend({
987
+ className,
988
+ variant = "legend",
989
+ ...props
990
+ }) {
991
+ return /* @__PURE__ */ jsxRuntime.jsx(
992
+ "legend",
993
+ {
994
+ "data-slot": "field-legend",
995
+ "data-variant": variant,
996
+ className: cn(
997
+ "mb-3 font-medium",
998
+ "data-[variant=legend]:text-base",
999
+ "data-[variant=label]:text-sm",
1000
+ className
1001
+ ),
1002
+ ...props
1003
+ }
1004
+ );
1005
+ }
1006
+ function FieldGroup({ className, ...props }) {
1007
+ return /* @__PURE__ */ jsxRuntime.jsx(
1008
+ "div",
1009
+ {
1010
+ "data-slot": "field-group",
1011
+ className: cn(
1012
+ "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
1013
+ className
1014
+ ),
1015
+ ...props
1016
+ }
1017
+ );
1018
+ }
1019
+ var fieldVariants = classVarianceAuthority.cva(
971
1020
  "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
972
1021
  {
973
1022
  variants: {
@@ -990,6 +1039,147 @@ classVarianceAuthority.cva(
990
1039
  }
991
1040
  }
992
1041
  );
1042
+ function Field({
1043
+ className,
1044
+ orientation = "vertical",
1045
+ ...props
1046
+ }) {
1047
+ return /* @__PURE__ */ jsxRuntime.jsx(
1048
+ "div",
1049
+ {
1050
+ role: "group",
1051
+ "data-slot": "field",
1052
+ "data-orientation": orientation,
1053
+ className: cn(fieldVariants({ orientation }), className),
1054
+ ...props
1055
+ }
1056
+ );
1057
+ }
1058
+ function FieldContent({ className, ...props }) {
1059
+ return /* @__PURE__ */ jsxRuntime.jsx(
1060
+ "div",
1061
+ {
1062
+ "data-slot": "field-content",
1063
+ className: cn(
1064
+ "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
1065
+ className
1066
+ ),
1067
+ ...props
1068
+ }
1069
+ );
1070
+ }
1071
+ function FieldLabel({
1072
+ className,
1073
+ ...props
1074
+ }) {
1075
+ return /* @__PURE__ */ jsxRuntime.jsx(
1076
+ Label,
1077
+ {
1078
+ "data-slot": "field-label",
1079
+ className: cn(
1080
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
1081
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
1082
+ "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
1083
+ className
1084
+ ),
1085
+ ...props
1086
+ }
1087
+ );
1088
+ }
1089
+ function FieldTitle({ className, ...props }) {
1090
+ return /* @__PURE__ */ jsxRuntime.jsx(
1091
+ "div",
1092
+ {
1093
+ "data-slot": "field-label",
1094
+ className: cn(
1095
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
1096
+ className
1097
+ ),
1098
+ ...props
1099
+ }
1100
+ );
1101
+ }
1102
+ function FieldDescription({ className, ...props }) {
1103
+ return /* @__PURE__ */ jsxRuntime.jsx(
1104
+ "p",
1105
+ {
1106
+ "data-slot": "field-description",
1107
+ className: cn(
1108
+ "text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
1109
+ "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
1110
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
1111
+ className
1112
+ ),
1113
+ ...props
1114
+ }
1115
+ );
1116
+ }
1117
+ function FieldSeparator({
1118
+ children,
1119
+ className,
1120
+ ...props
1121
+ }) {
1122
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1123
+ "div",
1124
+ {
1125
+ "data-slot": "field-separator",
1126
+ "data-content": !!children,
1127
+ className: cn(
1128
+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
1129
+ className
1130
+ ),
1131
+ ...props,
1132
+ children: [
1133
+ /* @__PURE__ */ jsxRuntime.jsx(Separator, { className: "absolute inset-0 top-1/2" }),
1134
+ children && /* @__PURE__ */ jsxRuntime.jsx(
1135
+ "span",
1136
+ {
1137
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
1138
+ "data-slot": "field-separator-content",
1139
+ children
1140
+ }
1141
+ )
1142
+ ]
1143
+ }
1144
+ );
1145
+ }
1146
+ function FieldError({
1147
+ className,
1148
+ children,
1149
+ errors,
1150
+ ...props
1151
+ }) {
1152
+ const content = React3.useMemo(() => {
1153
+ if (children) {
1154
+ return children;
1155
+ }
1156
+ if (!errors?.length) {
1157
+ return null;
1158
+ }
1159
+ const uniqueErrors = [
1160
+ ...new Map(errors.map((error) => [error?.message, error])).values()
1161
+ ];
1162
+ if (uniqueErrors?.length == 1) {
1163
+ return uniqueErrors[0]?.message;
1164
+ }
1165
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
1166
+ (error, index) => error?.message && /* @__PURE__ */ jsxRuntime.jsx("li", { children: error.message }, index)
1167
+ ) });
1168
+ }, [children, errors]);
1169
+ if (!content) {
1170
+ return null;
1171
+ }
1172
+ return /* @__PURE__ */ jsxRuntime.jsx(
1173
+ "div",
1174
+ {
1175
+ role: "alert",
1176
+ "data-slot": "field-error",
1177
+ className: cn("text-destructive text-sm font-normal", className),
1178
+ ...props,
1179
+ children: content
1180
+ }
1181
+ );
1182
+ }
993
1183
  var Form = reactHookForm.FormProvider;
994
1184
  var FormFieldContext = React3__namespace.createContext(
995
1185
  {}
@@ -1181,7 +1371,7 @@ function InputGroupAddon({
1181
1371
  }
1182
1372
  );
1183
1373
  }
1184
- classVarianceAuthority.cva(
1374
+ var inputGroupButtonVariants = classVarianceAuthority.cva(
1185
1375
  "text-sm shadow-none flex gap-2 items-center",
1186
1376
  {
1187
1377
  variants: {
@@ -1197,6 +1387,24 @@ classVarianceAuthority.cva(
1197
1387
  }
1198
1388
  }
1199
1389
  );
1390
+ function InputGroupButton({
1391
+ className,
1392
+ type = "button",
1393
+ variant = "ghost",
1394
+ size = "xs",
1395
+ ...props
1396
+ }) {
1397
+ return /* @__PURE__ */ jsxRuntime.jsx(
1398
+ Button,
1399
+ {
1400
+ type,
1401
+ "data-size": size,
1402
+ variant,
1403
+ className: cn(inputGroupButtonVariants({ size }), className),
1404
+ ...props
1405
+ }
1406
+ );
1407
+ }
1200
1408
  function InputGroupText({ className, ...props }) {
1201
1409
  return /* @__PURE__ */ jsxRuntime.jsx(
1202
1410
  "span",
@@ -1225,6 +1433,22 @@ function InputGroupInput({
1225
1433
  }
1226
1434
  );
1227
1435
  }
1436
+ function InputGroupTextarea({
1437
+ className,
1438
+ ...props
1439
+ }) {
1440
+ return /* @__PURE__ */ jsxRuntime.jsx(
1441
+ Textarea,
1442
+ {
1443
+ "data-slot": "input-group-control",
1444
+ className: cn(
1445
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
1446
+ className
1447
+ ),
1448
+ ...props
1449
+ }
1450
+ );
1451
+ }
1228
1452
  function InputOTP({
1229
1453
  className,
1230
1454
  containerClassName,
@@ -1823,6 +2047,41 @@ function ButtonGroup({
1823
2047
  }
1824
2048
  );
1825
2049
  }
2050
+ function ButtonGroupText({
2051
+ className,
2052
+ asChild = false,
2053
+ ...props
2054
+ }) {
2055
+ const Comp = asChild ? reactSlot.Slot : "div";
2056
+ return /* @__PURE__ */ jsxRuntime.jsx(
2057
+ Comp,
2058
+ {
2059
+ className: cn(
2060
+ "bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
2061
+ className
2062
+ ),
2063
+ ...props
2064
+ }
2065
+ );
2066
+ }
2067
+ function ButtonGroupSeparator({
2068
+ className,
2069
+ orientation = "vertical",
2070
+ ...props
2071
+ }) {
2072
+ return /* @__PURE__ */ jsxRuntime.jsx(
2073
+ Separator,
2074
+ {
2075
+ "data-slot": "button-group-separator",
2076
+ orientation,
2077
+ className: cn(
2078
+ "bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
2079
+ className
2080
+ ),
2081
+ ...props
2082
+ }
2083
+ );
2084
+ }
1826
2085
  var ButtonGroupInput = class extends BaseInput {
1827
2086
  render() {
1828
2087
  const { input, form, isSubmitting } = this;
@@ -1850,7 +2109,7 @@ var FieldButtonGroup = ({ input, form, isSubmitting, className = "w-full flex-1"
1850
2109
  disabled: isSubmitting,
1851
2110
  children: option.label ?? option.name
1852
2111
  },
1853
- key
2112
+ `${input.name}-${key}-btn-g`
1854
2113
  )) });
1855
2114
  };
1856
2115
  var CheckListInput = class extends BaseInput {
@@ -2026,6 +2285,29 @@ function Command({
2026
2285
  }
2027
2286
  );
2028
2287
  }
2288
+ function CommandDialog({
2289
+ title = "Command Palette",
2290
+ description = "Search for a command to run...",
2291
+ children,
2292
+ className,
2293
+ showCloseButton = true,
2294
+ ...props
2295
+ }) {
2296
+ return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { ...props, children: [
2297
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "sr-only", children: [
2298
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
2299
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: description })
2300
+ ] }),
2301
+ /* @__PURE__ */ jsxRuntime.jsx(
2302
+ DialogContent,
2303
+ {
2304
+ className: cn("overflow-hidden p-0", className),
2305
+ showCloseButton,
2306
+ children: /* @__PURE__ */ jsxRuntime.jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children })
2307
+ }
2308
+ )
2309
+ ] });
2310
+ }
2029
2311
  function CommandInput({
2030
2312
  className,
2031
2313
  ...props
@@ -2096,6 +2378,19 @@ function CommandGroup({
2096
2378
  }
2097
2379
  );
2098
2380
  }
2381
+ function CommandSeparator({
2382
+ className,
2383
+ ...props
2384
+ }) {
2385
+ return /* @__PURE__ */ jsxRuntime.jsx(
2386
+ cmdk.Command.Separator,
2387
+ {
2388
+ "data-slot": "command-separator",
2389
+ className: cn("bg-border -mx-1 h-px", className),
2390
+ ...props
2391
+ }
2392
+ );
2393
+ }
2099
2394
  function CommandItem({
2100
2395
  className,
2101
2396
  ...props
@@ -2112,6 +2407,22 @@ function CommandItem({
2112
2407
  }
2113
2408
  );
2114
2409
  }
2410
+ function CommandShortcut({
2411
+ className,
2412
+ ...props
2413
+ }) {
2414
+ return /* @__PURE__ */ jsxRuntime.jsx(
2415
+ "span",
2416
+ {
2417
+ "data-slot": "command-shortcut",
2418
+ className: cn(
2419
+ "text-muted-foreground ml-auto text-xs tracking-widest",
2420
+ className
2421
+ ),
2422
+ ...props
2423
+ }
2424
+ );
2425
+ }
2115
2426
  var ComboboxInput = class extends BaseInput {
2116
2427
  render() {
2117
2428
  const { input, form, isSubmitting } = this;
@@ -4220,7 +4531,7 @@ var FieldKeyValueList = ({ form, input, isSubmitting }) => {
4220
4531
  return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
4221
4532
  /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
4222
4533
  /* @__PURE__ */ jsxRuntime.jsx(FormMessage, {}),
4223
- /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 shadow-lg rounded-xl p-3 bg-white", children: [
4534
+ /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 rounded-xl p-3 ", children: [
4224
4535
  pairs.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "No pairs have been added yet." }),
4225
4536
  pairs.map((pair, index) => /* @__PURE__ */ jsxRuntime.jsxs(
4226
4537
  "div",
@@ -4330,7 +4641,7 @@ var FieldMultiSelect = ({ form, input, isSubmitting }) => {
4330
4641
  const option = lista.find(
4331
4642
  (item) => getValue(item).toString() === val
4332
4643
  );
4333
- return /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", children: option?.name ?? val }, val);
4644
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", children: option?.name ?? val }, `${input.name}-${val}-ms`);
4334
4645
  }) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: input.placeHolder ?? "Selecciona..." }),
4335
4646
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 opacity-50" })
4336
4647
  ]
@@ -4363,7 +4674,7 @@ var FieldMultiSelect = ({ form, input, isSubmitting }) => {
4363
4674
  item.name
4364
4675
  ]
4365
4676
  },
4366
- value
4677
+ `${value}-ms`
4367
4678
  );
4368
4679
  }) })
4369
4680
  ] })
@@ -4901,7 +5212,7 @@ var FieldSelect = ({ form, input, isSubmitting }) => {
4901
5212
  }
4902
5213
  ) }) }),
4903
5214
  /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
4904
- lista.map((item) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: getValue(item), children: item.name }, item.id)),
5215
+ lista.map((item) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: getValue(item), children: item.name }, `${input.name}-${item.id}-s`)),
4905
5216
  lista.length === 0 && !loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-sm text-muted-foreground", children: "No hay opciones disponibles" })
4906
5217
  ] })
4907
5218
  ]
@@ -5198,6 +5509,102 @@ function SortableWrapper({
5198
5509
  }
5199
5510
  );
5200
5511
  }
5512
+ var StringValueListInput = class extends BaseInput {
5513
+ render() {
5514
+ const { input, form, isSubmitting } = this;
5515
+ return /* @__PURE__ */ jsxRuntime.jsx(
5516
+ FieldStringValueList,
5517
+ {
5518
+ input,
5519
+ form,
5520
+ isSubmitting
5521
+ }
5522
+ );
5523
+ }
5524
+ };
5525
+ var FieldStringValueList = ({ form, input, isSubmitting }) => {
5526
+ const fieldName = input.name;
5527
+ React3.useEffect(() => {
5528
+ const current = form.getValues(fieldName);
5529
+ if (!Array.isArray(current)) {
5530
+ form.setValue(fieldName, []);
5531
+ }
5532
+ }, [form, fieldName]);
5533
+ const handleAddItem = () => {
5534
+ const current = form.getValues(fieldName) || [];
5535
+ form.setValue(fieldName, [...current, ""]);
5536
+ };
5537
+ const handleRemoveItem = (index) => {
5538
+ const current = form.getValues(fieldName) || [];
5539
+ const updated = current.filter((_, i) => i !== index);
5540
+ form.setValue(fieldName, updated);
5541
+ };
5542
+ const handleChange = (index, newValue) => {
5543
+ const current = form.getValues(fieldName) || [];
5544
+ const updated = current.map(
5545
+ (item, i) => i === index ? newValue : item
5546
+ );
5547
+ form.setValue(fieldName, updated);
5548
+ };
5549
+ return /* @__PURE__ */ jsxRuntime.jsx(
5550
+ FormField,
5551
+ {
5552
+ control: form.control,
5553
+ name: fieldName,
5554
+ render: () => {
5555
+ const items = form.watch(fieldName) || [];
5556
+ return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
5557
+ /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
5558
+ /* @__PURE__ */ jsxRuntime.jsx(FormMessage, {}),
5559
+ /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 rounded-xl ", children: [
5560
+ items.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "No items have been added yet." }),
5561
+ items.map((value, index) => /* @__PURE__ */ jsxRuntime.jsxs(
5562
+ "div",
5563
+ {
5564
+ className: "flex gap-2 items-center",
5565
+ children: [
5566
+ /* @__PURE__ */ jsxRuntime.jsx(
5567
+ Input,
5568
+ {
5569
+ placeholder: `Item ${index + 1}`,
5570
+ value,
5571
+ disabled: isSubmitting,
5572
+ onChange: (e) => handleChange(index, e.target.value)
5573
+ }
5574
+ ),
5575
+ input.isRemovebleOption && /* @__PURE__ */ jsxRuntime.jsx(
5576
+ Button,
5577
+ {
5578
+ type: "button",
5579
+ variant: "destructive",
5580
+ size: "icon",
5581
+ onClick: () => handleRemoveItem(index),
5582
+ disabled: isSubmitting,
5583
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: 18 })
5584
+ }
5585
+ )
5586
+ ]
5587
+ },
5588
+ index
5589
+ )),
5590
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
5591
+ Button,
5592
+ {
5593
+ type: "button",
5594
+ variant: "outline",
5595
+ size: "sm",
5596
+ onClick: handleAddItem,
5597
+ disabled: isSubmitting,
5598
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { size: 18, className: "mr-1" })
5599
+ }
5600
+ ) })
5601
+ ] }) }),
5602
+ input.description && /* @__PURE__ */ jsxRuntime.jsx(FormDescription, { children: input.description })
5603
+ ] });
5604
+ }
5605
+ }
5606
+ );
5607
+ };
5201
5608
  var SwitchInput = class extends BaseInput {
5202
5609
  render() {
5203
5610
  const { input, form, isSubmitting } = this;
@@ -5509,6 +5916,7 @@ var inputMap = {
5509
5916
  ["COMBO_BOX" /* COMBOBOX */]: ComboboxInput,
5510
5917
  ["sortable_list" /* SORTABLE_LIST */]: SortableListInput,
5511
5918
  ["repeater_tabs" /* REPEATER_TABS */]: RepeaterTabsInput,
5919
+ ["string_list" /* STRING_LIST */]: StringValueListInput,
5512
5920
  //ToDos: ============================================================
5513
5921
  ["slider" /* SLIDER */]: SliderInput,
5514
5922
  //ToDo: // PENDIENTE ... VISUALMENTE NO SE VE BIEN.!!!
@@ -5986,9 +6394,126 @@ var InputList = ({ handleAddInput, inputsTypes }) => {
5986
6394
  );
5987
6395
  }) });
5988
6396
  };
6397
+ var GenericFilter = ({
6398
+ filters = [],
6399
+ pagination,
6400
+ autoSubmit = false,
6401
+ defaultValues = {},
6402
+ initPage = 1,
6403
+ initLimit = 10,
6404
+ rangeLimit = [10, 25, 50, 100],
6405
+ onChange,
6406
+ withSearch = true,
6407
+ withInitDate = true,
6408
+ withEndDate = true,
6409
+ withActive = true,
6410
+ withLimit = true,
6411
+ wrapInCard = true
6412
+ }) => {
6413
+ const record = {
6414
+ page: initPage,
6415
+ limit: initLimit,
6416
+ ...defaultValues
6417
+ };
6418
+ const [values, setValues] = React3.useState(record);
6419
+ const isFirstRender = React3.useRef(true);
6420
+ React3.useEffect(() => {
6421
+ if (isFirstRender.current) {
6422
+ isFirstRender.current = false;
6423
+ return;
6424
+ }
6425
+ }, [values]);
6426
+ const handleChange = (name, value) => {
6427
+ setValues((prev) => ({ ...prev, [name]: value }));
6428
+ if (autoSubmit && onChange) onChange({ ...values, [name]: value });
6429
+ };
6430
+ const baseFields = [
6431
+ ...withSearch ? [
6432
+ {
6433
+ name: "search",
6434
+ label: "Buscar",
6435
+ inputType: "text_group" /* TEXT_GROUP */,
6436
+ inputGroupConfig: { iconsLeft: [lucideReact.Search] },
6437
+ onChange: (value) => handleChange("search", value)
6438
+ }
6439
+ ] : [],
6440
+ ...withInitDate ? [
6441
+ {
6442
+ name: "initDate",
6443
+ label: "Fecha de Inicio",
6444
+ inputType: "date" /* DATE */,
6445
+ onChange: (value) => handleChange("initDate", value)
6446
+ }
6447
+ ] : [],
6448
+ ...withEndDate ? [
6449
+ {
6450
+ name: "endDate",
6451
+ label: "Fecha Final",
6452
+ inputType: "date" /* DATE */,
6453
+ onChange: (value) => handleChange("endDate", value)
6454
+ }
6455
+ ] : [],
6456
+ ...withActive ? [
6457
+ {
6458
+ wrapInCard: true,
6459
+ name: "active",
6460
+ label: "",
6461
+ inputType: "button_group" /* BUTTON_GROUP */,
6462
+ description: "Estado",
6463
+ listConfig: {
6464
+ list: [
6465
+ { id: 1, name: "Activo", value: true },
6466
+ { id: 2, name: "Inactivo", value: false },
6467
+ { id: 3, name: "Todos", value: void 0 }
6468
+ ],
6469
+ onOptionChange: (item) => {
6470
+ if (Array.isArray(item) && item[0]) handleChange("active", item[0].value);
6471
+ else if (item && "value" in item) handleChange("active", item.value);
6472
+ }
6473
+ }
6474
+ }
6475
+ ] : [],
6476
+ ...withLimit ? [
6477
+ {
6478
+ name: "limit",
6479
+ label: "L\xEDmite por p\xE1gina",
6480
+ inputType: "select" /* SELECT */,
6481
+ listConfig: {
6482
+ list: rangeLimit.map((num) => ({
6483
+ value: String(num),
6484
+ id: num,
6485
+ name: String(num)
6486
+ })),
6487
+ onOptionChange: (item) => handleChange("limit", Number(item?.value ?? 10))
6488
+ }
6489
+ }
6490
+ ] : []
6491
+ ];
6492
+ const fieldsConfig = [
6493
+ ...filters,
6494
+ baseFields
6495
+ ];
6496
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col md:flex-row md:items-end gap-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
6497
+ DynamicForm,
6498
+ {
6499
+ withCard: wrapInCard,
6500
+ withSubmitBtn: !autoSubmit,
6501
+ formTitle: "",
6502
+ submitBtnLabel: "Buscar",
6503
+ fields: fieldsConfig,
6504
+ record: values,
6505
+ showFormHeader: false,
6506
+ onSubmit: ({ data }) => {
6507
+ if (onChange && !autoSubmit) onChange(data);
6508
+ }
6509
+ }
6510
+ ) }) });
6511
+ };
5989
6512
 
5990
6513
  exports.Accordion = Accordion;
5991
6514
  exports.AccordionContent = AccordionContent;
6515
+ exports.AccordionGroupedSwitchInput = AccordionGroupedSwitchInput;
6516
+ exports.AccordionGroupedSwitches = AccordionGroupedSwitches;
5992
6517
  exports.AccordionItem = AccordionItem;
5993
6518
  exports.AccordionTrigger = AccordionTrigger;
5994
6519
  exports.Alert = Alert;
@@ -5997,6 +6522,10 @@ exports.AlertTitle = AlertTitle;
5997
6522
  exports.Badge = Badge;
5998
6523
  exports.BaseInput = BaseInput;
5999
6524
  exports.Button = Button;
6525
+ exports.ButtonGroup = ButtonGroup;
6526
+ exports.ButtonGroupInput = ButtonGroupInput;
6527
+ exports.ButtonGroupSeparator = ButtonGroupSeparator;
6528
+ exports.ButtonGroupText = ButtonGroupText;
6000
6529
  exports.Calendar = Calendar;
6001
6530
  exports.CalendarDayButton = CalendarDayButton;
6002
6531
  exports.Card = Card;
@@ -6008,10 +6537,23 @@ exports.CardHeader = CardHeader;
6008
6537
  exports.CardTitle = CardTitle;
6009
6538
  exports.CheckListInput = CheckListInput;
6010
6539
  exports.Checkbox = Checkbox;
6540
+ exports.CheckboxInput = CheckboxInput;
6011
6541
  exports.ColorCnInput = ColorCnInput;
6012
6542
  exports.ColorInput = ColorInput;
6543
+ exports.ComboboxInput = ComboboxInput;
6544
+ exports.Command = Command;
6545
+ exports.CommandDialog = CommandDialog;
6546
+ exports.CommandEmpty = CommandEmpty;
6547
+ exports.CommandGroup = CommandGroup;
6548
+ exports.CommandInput = CommandInput;
6549
+ exports.CommandItem = CommandItem;
6550
+ exports.CommandList = CommandList;
6551
+ exports.CommandSeparator = CommandSeparator;
6552
+ exports.CommandShortcut = CommandShortcut;
6553
+ exports.CurrencyInput = CurrencyInput;
6013
6554
  exports.CustomAlert = CustomAlert;
6014
6555
  exports.DateInput = DateInput;
6556
+ exports.DateTimeInput = DateTimeInput;
6015
6557
  exports.Dialog = Dialog;
6016
6558
  exports.DialogClose = DialogClose;
6017
6559
  exports.DialogContent = DialogContent;
@@ -6024,32 +6566,69 @@ exports.DialogTitle = DialogTitle;
6024
6566
  exports.DialogTrigger = DialogTrigger;
6025
6567
  exports.DynamicForm = DynamicForm;
6026
6568
  exports.DynamicFormExample = DynamicFormExample;
6569
+ exports.Field = Field;
6570
+ exports.FieldButtonGroup = FieldButtonGroup;
6571
+ exports.FieldContent = FieldContent;
6572
+ exports.FieldCurrency = FieldCurrency;
6573
+ exports.FieldDateTimeInput = FieldDateTimeInput;
6574
+ exports.FieldDescription = FieldDescription;
6575
+ exports.FieldError = FieldError;
6576
+ exports.FieldFileMultiUpload = FieldFileMultiUpload;
6577
+ exports.FieldGroup = FieldGroup;
6578
+ exports.FieldKeyValueList = FieldKeyValueList;
6579
+ exports.FieldLabel = FieldLabel;
6580
+ exports.FieldLegend = FieldLegend;
6581
+ exports.FieldRepeater = FieldRepeater;
6582
+ exports.FieldSeparator = FieldSeparator;
6583
+ exports.FieldSet = FieldSet;
6584
+ exports.FieldSimpleCheckList = FieldSimpleCheckList;
6585
+ exports.FieldSlider = FieldSlider;
6586
+ exports.FieldStringValueList = FieldStringValueList;
6587
+ exports.FieldTextGroup = FieldTextGroup;
6588
+ exports.FieldTimeInput = FieldTimeInput;
6589
+ exports.FieldTitle = FieldTitle;
6027
6590
  exports.FileInput = FileInput;
6591
+ exports.FileMultiUploadInput = FileMultiUploadInput;
6028
6592
  exports.Form = Form;
6029
6593
  exports.FormControl = FormControl;
6030
6594
  exports.FormDescription = FormDescription;
6031
6595
  exports.FormErrorsAlert = FormErrorsAlert;
6032
6596
  exports.FormField = FormField;
6597
+ exports.FormFieldsGrid = FormFieldsGrid;
6033
6598
  exports.FormItem = FormItem;
6034
6599
  exports.FormLabel = FormLabel;
6035
6600
  exports.FormMessage = FormMessage;
6601
+ exports.GenericFilter = GenericFilter;
6036
6602
  exports.GroupedSwitchInput = GroupedSwitchInput;
6037
6603
  exports.GroupedSwitches = GroupedSwitches;
6038
6604
  exports.Input = Input;
6039
6605
  exports.InputFactory = InputFactory;
6606
+ exports.InputGroup = InputGroup;
6607
+ exports.InputGroupAddon = InputGroupAddon;
6608
+ exports.InputGroupButton = InputGroupButton;
6609
+ exports.InputGroupInput = InputGroupInput;
6610
+ exports.InputGroupText = InputGroupText;
6611
+ exports.InputGroupTextarea = InputGroupTextarea;
6040
6612
  exports.InputList = InputList;
6041
6613
  exports.InputOTP = InputOTP;
6042
6614
  exports.InputOTPGroup = InputOTPGroup;
6043
6615
  exports.InputOTPSeparator = InputOTPSeparator;
6044
6616
  exports.InputOTPSlot = InputOTPSlot;
6045
6617
  exports.InputTypes = InputTypes;
6618
+ exports.KeyValueListInput = KeyValueListInput;
6046
6619
  exports.Label = Label;
6620
+ exports.MultiSelectInput = MultiSelectInput;
6047
6621
  exports.NumberInput = NumberInput;
6048
6622
  exports.OTPInput = OTPInput2;
6049
6623
  exports.Popover = Popover;
6050
6624
  exports.PopoverAnchor = PopoverAnchor;
6051
6625
  exports.PopoverContent = PopoverContent;
6052
6626
  exports.PopoverTrigger = PopoverTrigger;
6627
+ exports.RadioGroup = RadioGroup;
6628
+ exports.RadioGroupInput = RadioGroupInput;
6629
+ exports.RadioGroupItem = RadioGroupItem;
6630
+ exports.RepeaterInput = RepeaterInput;
6631
+ exports.RepeaterTabsInput = RepeaterTabsInput;
6053
6632
  exports.ResizableHandle = ResizableHandle;
6054
6633
  exports.ResizablePanel = ResizablePanel;
6055
6634
  exports.ResizablePanelGroup = ResizablePanelGroup;
@@ -6067,18 +6646,31 @@ exports.SelectSeparator = SelectSeparator;
6067
6646
  exports.SelectTrigger = SelectTrigger;
6068
6647
  exports.SelectValue = SelectValue;
6069
6648
  exports.Separator = Separator;
6649
+ exports.SimpleCheckListInput = SimpleCheckListInput;
6650
+ exports.Slider = Slider;
6651
+ exports.SliderInput = SliderInput;
6652
+ exports.SortableListInput = SortableListInput;
6653
+ exports.StringValueListInput = StringValueListInput;
6070
6654
  exports.Switch = Switch;
6071
6655
  exports.SwitchInput = SwitchInput;
6656
+ exports.Tabs = Tabs;
6657
+ exports.TabsContent = TabsContent;
6658
+ exports.TabsList = TabsList;
6659
+ exports.TabsTrigger = TabsTrigger;
6660
+ exports.TagInput = TagInput;
6072
6661
  exports.TextAreaInput = TextAreaInput;
6073
6662
  exports.TextInput = TextInput;
6663
+ exports.TextInputGroup = TextInputGroup;
6074
6664
  exports.TextInputType = TextInputType;
6075
6665
  exports.Textarea = Textarea;
6666
+ exports.TimeInput = TimeInput;
6076
6667
  exports.Toaster = Toaster;
6077
6668
  exports.Tooltip = Tooltip;
6078
6669
  exports.TooltipContent = TooltipContent;
6079
6670
  exports.TooltipProvider = TooltipProvider;
6080
6671
  exports.TooltipTrigger = TooltipTrigger;
6081
6672
  exports.badgeVariants = badgeVariants;
6673
+ exports.buttonGroupVariants = buttonGroupVariants;
6082
6674
  exports.buttonVariants = buttonVariants;
6083
6675
  exports.cn = cn;
6084
6676
  exports.entitiesToGroupedOption = entitiesToGroupedOption;