shadcn-zod-formkit 1.25.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 +499 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +289 -13
- package/dist/index.d.ts +289 -13
- package/dist/index.mjs +435 -11
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.26.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.25.0.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -969,7 +969,54 @@ function Separator({
|
|
|
969
969
|
}
|
|
970
970
|
);
|
|
971
971
|
}
|
|
972
|
-
|
|
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(
|
|
973
1020
|
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
974
1021
|
{
|
|
975
1022
|
variants: {
|
|
@@ -992,6 +1039,147 @@ classVarianceAuthority.cva(
|
|
|
992
1039
|
}
|
|
993
1040
|
}
|
|
994
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
|
+
}
|
|
995
1183
|
var Form = reactHookForm.FormProvider;
|
|
996
1184
|
var FormFieldContext = React3__namespace.createContext(
|
|
997
1185
|
{}
|
|
@@ -1183,7 +1371,7 @@ function InputGroupAddon({
|
|
|
1183
1371
|
}
|
|
1184
1372
|
);
|
|
1185
1373
|
}
|
|
1186
|
-
classVarianceAuthority.cva(
|
|
1374
|
+
var inputGroupButtonVariants = classVarianceAuthority.cva(
|
|
1187
1375
|
"text-sm shadow-none flex gap-2 items-center",
|
|
1188
1376
|
{
|
|
1189
1377
|
variants: {
|
|
@@ -1199,6 +1387,24 @@ classVarianceAuthority.cva(
|
|
|
1199
1387
|
}
|
|
1200
1388
|
}
|
|
1201
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
|
+
}
|
|
1202
1408
|
function InputGroupText({ className, ...props }) {
|
|
1203
1409
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1204
1410
|
"span",
|
|
@@ -1227,6 +1433,22 @@ function InputGroupInput({
|
|
|
1227
1433
|
}
|
|
1228
1434
|
);
|
|
1229
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
|
+
}
|
|
1230
1452
|
function InputOTP({
|
|
1231
1453
|
className,
|
|
1232
1454
|
containerClassName,
|
|
@@ -1825,6 +2047,41 @@ function ButtonGroup({
|
|
|
1825
2047
|
}
|
|
1826
2048
|
);
|
|
1827
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
|
+
}
|
|
1828
2085
|
var ButtonGroupInput = class extends BaseInput {
|
|
1829
2086
|
render() {
|
|
1830
2087
|
const { input, form, isSubmitting } = this;
|
|
@@ -1852,7 +2109,7 @@ var FieldButtonGroup = ({ input, form, isSubmitting, className = "w-full flex-1"
|
|
|
1852
2109
|
disabled: isSubmitting,
|
|
1853
2110
|
children: option.label ?? option.name
|
|
1854
2111
|
},
|
|
1855
|
-
key
|
|
2112
|
+
`${input.name}-${key}-btn-g`
|
|
1856
2113
|
)) });
|
|
1857
2114
|
};
|
|
1858
2115
|
var CheckListInput = class extends BaseInput {
|
|
@@ -2028,6 +2285,29 @@ function Command({
|
|
|
2028
2285
|
}
|
|
2029
2286
|
);
|
|
2030
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
|
+
}
|
|
2031
2311
|
function CommandInput({
|
|
2032
2312
|
className,
|
|
2033
2313
|
...props
|
|
@@ -2098,6 +2378,19 @@ function CommandGroup({
|
|
|
2098
2378
|
}
|
|
2099
2379
|
);
|
|
2100
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
|
+
}
|
|
2101
2394
|
function CommandItem({
|
|
2102
2395
|
className,
|
|
2103
2396
|
...props
|
|
@@ -2114,6 +2407,22 @@ function CommandItem({
|
|
|
2114
2407
|
}
|
|
2115
2408
|
);
|
|
2116
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
|
+
}
|
|
2117
2426
|
var ComboboxInput = class extends BaseInput {
|
|
2118
2427
|
render() {
|
|
2119
2428
|
const { input, form, isSubmitting } = this;
|
|
@@ -4332,7 +4641,7 @@ var FieldMultiSelect = ({ form, input, isSubmitting }) => {
|
|
|
4332
4641
|
const option = lista.find(
|
|
4333
4642
|
(item) => getValue(item).toString() === val
|
|
4334
4643
|
);
|
|
4335
|
-
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`);
|
|
4336
4645
|
}) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: input.placeHolder ?? "Selecciona..." }),
|
|
4337
4646
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 opacity-50" })
|
|
4338
4647
|
]
|
|
@@ -4365,7 +4674,7 @@ var FieldMultiSelect = ({ form, input, isSubmitting }) => {
|
|
|
4365
4674
|
item.name
|
|
4366
4675
|
]
|
|
4367
4676
|
},
|
|
4368
|
-
value
|
|
4677
|
+
`${value}-ms`
|
|
4369
4678
|
);
|
|
4370
4679
|
}) })
|
|
4371
4680
|
] })
|
|
@@ -4903,7 +5212,7 @@ var FieldSelect = ({ form, input, isSubmitting }) => {
|
|
|
4903
5212
|
}
|
|
4904
5213
|
) }) }),
|
|
4905
5214
|
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
|
|
4906
|
-
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`)),
|
|
4907
5216
|
lista.length === 0 && !loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-sm text-muted-foreground", children: "No hay opciones disponibles" })
|
|
4908
5217
|
] })
|
|
4909
5218
|
]
|
|
@@ -6085,9 +6394,126 @@ var InputList = ({ handleAddInput, inputsTypes }) => {
|
|
|
6085
6394
|
);
|
|
6086
6395
|
}) });
|
|
6087
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
|
+
};
|
|
6088
6512
|
|
|
6089
6513
|
exports.Accordion = Accordion;
|
|
6090
6514
|
exports.AccordionContent = AccordionContent;
|
|
6515
|
+
exports.AccordionGroupedSwitchInput = AccordionGroupedSwitchInput;
|
|
6516
|
+
exports.AccordionGroupedSwitches = AccordionGroupedSwitches;
|
|
6091
6517
|
exports.AccordionItem = AccordionItem;
|
|
6092
6518
|
exports.AccordionTrigger = AccordionTrigger;
|
|
6093
6519
|
exports.Alert = Alert;
|
|
@@ -6096,6 +6522,10 @@ exports.AlertTitle = AlertTitle;
|
|
|
6096
6522
|
exports.Badge = Badge;
|
|
6097
6523
|
exports.BaseInput = BaseInput;
|
|
6098
6524
|
exports.Button = Button;
|
|
6525
|
+
exports.ButtonGroup = ButtonGroup;
|
|
6526
|
+
exports.ButtonGroupInput = ButtonGroupInput;
|
|
6527
|
+
exports.ButtonGroupSeparator = ButtonGroupSeparator;
|
|
6528
|
+
exports.ButtonGroupText = ButtonGroupText;
|
|
6099
6529
|
exports.Calendar = Calendar;
|
|
6100
6530
|
exports.CalendarDayButton = CalendarDayButton;
|
|
6101
6531
|
exports.Card = Card;
|
|
@@ -6107,10 +6537,23 @@ exports.CardHeader = CardHeader;
|
|
|
6107
6537
|
exports.CardTitle = CardTitle;
|
|
6108
6538
|
exports.CheckListInput = CheckListInput;
|
|
6109
6539
|
exports.Checkbox = Checkbox;
|
|
6540
|
+
exports.CheckboxInput = CheckboxInput;
|
|
6110
6541
|
exports.ColorCnInput = ColorCnInput;
|
|
6111
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;
|
|
6112
6554
|
exports.CustomAlert = CustomAlert;
|
|
6113
6555
|
exports.DateInput = DateInput;
|
|
6556
|
+
exports.DateTimeInput = DateTimeInput;
|
|
6114
6557
|
exports.Dialog = Dialog;
|
|
6115
6558
|
exports.DialogClose = DialogClose;
|
|
6116
6559
|
exports.DialogContent = DialogContent;
|
|
@@ -6123,32 +6566,69 @@ exports.DialogTitle = DialogTitle;
|
|
|
6123
6566
|
exports.DialogTrigger = DialogTrigger;
|
|
6124
6567
|
exports.DynamicForm = DynamicForm;
|
|
6125
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;
|
|
6126
6590
|
exports.FileInput = FileInput;
|
|
6591
|
+
exports.FileMultiUploadInput = FileMultiUploadInput;
|
|
6127
6592
|
exports.Form = Form;
|
|
6128
6593
|
exports.FormControl = FormControl;
|
|
6129
6594
|
exports.FormDescription = FormDescription;
|
|
6130
6595
|
exports.FormErrorsAlert = FormErrorsAlert;
|
|
6131
6596
|
exports.FormField = FormField;
|
|
6597
|
+
exports.FormFieldsGrid = FormFieldsGrid;
|
|
6132
6598
|
exports.FormItem = FormItem;
|
|
6133
6599
|
exports.FormLabel = FormLabel;
|
|
6134
6600
|
exports.FormMessage = FormMessage;
|
|
6601
|
+
exports.GenericFilter = GenericFilter;
|
|
6135
6602
|
exports.GroupedSwitchInput = GroupedSwitchInput;
|
|
6136
6603
|
exports.GroupedSwitches = GroupedSwitches;
|
|
6137
6604
|
exports.Input = Input;
|
|
6138
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;
|
|
6139
6612
|
exports.InputList = InputList;
|
|
6140
6613
|
exports.InputOTP = InputOTP;
|
|
6141
6614
|
exports.InputOTPGroup = InputOTPGroup;
|
|
6142
6615
|
exports.InputOTPSeparator = InputOTPSeparator;
|
|
6143
6616
|
exports.InputOTPSlot = InputOTPSlot;
|
|
6144
6617
|
exports.InputTypes = InputTypes;
|
|
6618
|
+
exports.KeyValueListInput = KeyValueListInput;
|
|
6145
6619
|
exports.Label = Label;
|
|
6620
|
+
exports.MultiSelectInput = MultiSelectInput;
|
|
6146
6621
|
exports.NumberInput = NumberInput;
|
|
6147
6622
|
exports.OTPInput = OTPInput2;
|
|
6148
6623
|
exports.Popover = Popover;
|
|
6149
6624
|
exports.PopoverAnchor = PopoverAnchor;
|
|
6150
6625
|
exports.PopoverContent = PopoverContent;
|
|
6151
6626
|
exports.PopoverTrigger = PopoverTrigger;
|
|
6627
|
+
exports.RadioGroup = RadioGroup;
|
|
6628
|
+
exports.RadioGroupInput = RadioGroupInput;
|
|
6629
|
+
exports.RadioGroupItem = RadioGroupItem;
|
|
6630
|
+
exports.RepeaterInput = RepeaterInput;
|
|
6631
|
+
exports.RepeaterTabsInput = RepeaterTabsInput;
|
|
6152
6632
|
exports.ResizableHandle = ResizableHandle;
|
|
6153
6633
|
exports.ResizablePanel = ResizablePanel;
|
|
6154
6634
|
exports.ResizablePanelGroup = ResizablePanelGroup;
|
|
@@ -6166,18 +6646,31 @@ exports.SelectSeparator = SelectSeparator;
|
|
|
6166
6646
|
exports.SelectTrigger = SelectTrigger;
|
|
6167
6647
|
exports.SelectValue = SelectValue;
|
|
6168
6648
|
exports.Separator = Separator;
|
|
6649
|
+
exports.SimpleCheckListInput = SimpleCheckListInput;
|
|
6650
|
+
exports.Slider = Slider;
|
|
6651
|
+
exports.SliderInput = SliderInput;
|
|
6652
|
+
exports.SortableListInput = SortableListInput;
|
|
6653
|
+
exports.StringValueListInput = StringValueListInput;
|
|
6169
6654
|
exports.Switch = Switch;
|
|
6170
6655
|
exports.SwitchInput = SwitchInput;
|
|
6656
|
+
exports.Tabs = Tabs;
|
|
6657
|
+
exports.TabsContent = TabsContent;
|
|
6658
|
+
exports.TabsList = TabsList;
|
|
6659
|
+
exports.TabsTrigger = TabsTrigger;
|
|
6660
|
+
exports.TagInput = TagInput;
|
|
6171
6661
|
exports.TextAreaInput = TextAreaInput;
|
|
6172
6662
|
exports.TextInput = TextInput;
|
|
6663
|
+
exports.TextInputGroup = TextInputGroup;
|
|
6173
6664
|
exports.TextInputType = TextInputType;
|
|
6174
6665
|
exports.Textarea = Textarea;
|
|
6666
|
+
exports.TimeInput = TimeInput;
|
|
6175
6667
|
exports.Toaster = Toaster;
|
|
6176
6668
|
exports.Tooltip = Tooltip;
|
|
6177
6669
|
exports.TooltipContent = TooltipContent;
|
|
6178
6670
|
exports.TooltipProvider = TooltipProvider;
|
|
6179
6671
|
exports.TooltipTrigger = TooltipTrigger;
|
|
6180
6672
|
exports.badgeVariants = badgeVariants;
|
|
6673
|
+
exports.buttonGroupVariants = buttonGroupVariants;
|
|
6181
6674
|
exports.buttonVariants = buttonVariants;
|
|
6182
6675
|
exports.cn = cn;
|
|
6183
6676
|
exports.entitiesToGroupedOption = entitiesToGroupedOption;
|