@algodomain/smart-forms 0.1.2 → 0.1.3
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/LICENSE +3 -0
- package/README.md +243 -0
- package/dist/{SmartFormProvider-DyJoDBjQ.d.cts → SmartFormProvider-BdyRQakk.d.cts} +1 -0
- package/dist/{SmartFormProvider-DyJoDBjQ.d.ts → SmartFormProvider-BdyRQakk.d.ts} +1 -0
- package/dist/{SmartTags-HmvmCJPT.d.cts → SmartTags-DPqw9PG1.d.cts} +12 -1
- package/dist/{SmartTags-HmvmCJPT.d.ts → SmartTags-DPqw9PG1.d.ts} +12 -1
- package/dist/{chunk-5LRBJEZW.js → chunk-3L7TKJIB.js} +15 -6
- package/dist/chunk-3L7TKJIB.js.map +1 -0
- package/dist/{chunk-KDPN4CHW.js → chunk-CT6GW6PK.js} +44 -11
- package/dist/chunk-CT6GW6PK.js.map +1 -0
- package/dist/{chunk-4H5U5IHH.cjs → chunk-MBC5TYXA.cjs} +15 -6
- package/dist/chunk-MBC5TYXA.cjs.map +1 -0
- package/dist/{chunk-CJ55WKPC.cjs → chunk-TJ6EFR2O.cjs} +120 -87
- package/dist/chunk-TJ6EFR2O.cjs.map +1 -0
- package/dist/fields.cjs +172 -124
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.d.cts +14 -2
- package/dist/fields.d.ts +14 -2
- package/dist/fields.js +70 -22
- package/dist/fields.js.map +1 -1
- package/dist/index.cjs +36 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/opinionated.cjs +18 -18
- package/dist/opinionated.d.cts +1 -1
- package/dist/opinionated.d.ts +1 -1
- package/dist/opinionated.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4H5U5IHH.cjs.map +0 -1
- package/dist/chunk-5LRBJEZW.js.map +0 -1
- package/dist/chunk-CJ55WKPC.cjs.map +0 -1
- package/dist/chunk-KDPN4CHW.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMBC5TYXA_cjs = require('./chunk-MBC5TYXA.cjs');
|
|
4
4
|
var React4 = require('react');
|
|
5
5
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
@@ -45,7 +45,7 @@ function Checkbox({
|
|
|
45
45
|
CheckboxPrimitive__namespace.Root,
|
|
46
46
|
{
|
|
47
47
|
"data-slot": "checkbox",
|
|
48
|
-
className:
|
|
48
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
49
49
|
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
50
50
|
className
|
|
51
51
|
),
|
|
@@ -69,12 +69,18 @@ var SmartCheckbox = ({
|
|
|
69
69
|
required = false,
|
|
70
70
|
defaultValue,
|
|
71
71
|
info,
|
|
72
|
-
subLabel
|
|
72
|
+
subLabel,
|
|
73
|
+
disabled,
|
|
74
|
+
hidden
|
|
73
75
|
}) => {
|
|
74
|
-
const {
|
|
75
|
-
const
|
|
76
|
+
const { formData } = chunkMBC5TYXA_cjs.useSmartForm();
|
|
77
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkMBC5TYXA_cjs.useFormField(field);
|
|
78
|
+
const fieldDetection = chunkMBC5TYXA_cjs.useFieldDetection();
|
|
76
79
|
const hasRegistered = React4.useRef(false);
|
|
77
80
|
const hasSetDefault = React4.useRef(false);
|
|
81
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
82
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
83
|
+
if (isHidden) return null;
|
|
78
84
|
React4.useEffect(() => {
|
|
79
85
|
if (validation && !hasRegistered.current) {
|
|
80
86
|
hasRegistered.current = true;
|
|
@@ -104,18 +110,19 @@ var SmartCheckbox = ({
|
|
|
104
110
|
onCheckedChange: (checked) => onChange(!!checked),
|
|
105
111
|
className: error ? "border-destructive" : "",
|
|
106
112
|
"data-field": field,
|
|
107
|
-
id: `${field}-checkbox
|
|
113
|
+
id: `${field}-checkbox`,
|
|
114
|
+
disabled: isDisabled
|
|
108
115
|
}
|
|
109
116
|
),
|
|
110
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Label, { htmlFor: `${field}-checkbox`, className: "text-sm font-normal cursor-pointer", children: [
|
|
111
118
|
label || field,
|
|
112
119
|
" ",
|
|
113
120
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
114
121
|
] })
|
|
115
122
|
] }),
|
|
116
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Tooltip, { children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
119
126
|
] }) })
|
|
120
127
|
] }),
|
|
121
128
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground ml-6", children: subLabel })
|
|
@@ -131,7 +138,7 @@ function RadioGroup({
|
|
|
131
138
|
RadioGroupPrimitive__namespace.Root,
|
|
132
139
|
{
|
|
133
140
|
"data-slot": "radio-group",
|
|
134
|
-
className:
|
|
141
|
+
className: chunkMBC5TYXA_cjs.cn("grid gap-3", className),
|
|
135
142
|
...props
|
|
136
143
|
}
|
|
137
144
|
);
|
|
@@ -144,7 +151,7 @@ function RadioGroupItem({
|
|
|
144
151
|
RadioGroupPrimitive__namespace.Item,
|
|
145
152
|
{
|
|
146
153
|
"data-slot": "radio-group-item",
|
|
147
|
-
className:
|
|
154
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
148
155
|
"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
149
156
|
className
|
|
150
157
|
),
|
|
@@ -171,12 +178,18 @@ var SmartRadioGroup = ({
|
|
|
171
178
|
required = false,
|
|
172
179
|
defaultValue,
|
|
173
180
|
info,
|
|
174
|
-
subLabel
|
|
181
|
+
subLabel,
|
|
182
|
+
disabled,
|
|
183
|
+
hidden
|
|
175
184
|
}) => {
|
|
176
|
-
const {
|
|
177
|
-
const
|
|
185
|
+
const { formData } = chunkMBC5TYXA_cjs.useSmartForm();
|
|
186
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkMBC5TYXA_cjs.useFormField(field);
|
|
187
|
+
const fieldDetection = chunkMBC5TYXA_cjs.useFieldDetection();
|
|
178
188
|
const hasRegistered = React4.useRef(false);
|
|
179
189
|
const hasSetDefault = React4.useRef(false);
|
|
190
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
191
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
192
|
+
if (isHidden) return null;
|
|
180
193
|
React4.useEffect(() => {
|
|
181
194
|
if (validation && !hasRegistered.current) {
|
|
182
195
|
hasRegistered.current = true;
|
|
@@ -197,14 +210,14 @@ var SmartRadioGroup = ({
|
|
|
197
210
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
198
211
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
199
212
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
200
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
201
214
|
label,
|
|
202
215
|
" ",
|
|
203
216
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
204
217
|
] }),
|
|
205
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
207
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
218
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Tooltip, { children: [
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
208
221
|
] }) })
|
|
209
222
|
] }),
|
|
210
223
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -218,6 +231,7 @@ var SmartRadioGroup = ({
|
|
|
218
231
|
ref: fieldRef,
|
|
219
232
|
"data-field": field,
|
|
220
233
|
name: name || field,
|
|
234
|
+
disabled: isDisabled,
|
|
221
235
|
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
222
236
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
223
237
|
RadioGroupItem,
|
|
@@ -227,7 +241,7 @@ var SmartRadioGroup = ({
|
|
|
227
241
|
}
|
|
228
242
|
),
|
|
229
243
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
-
|
|
244
|
+
chunkMBC5TYXA_cjs.Label,
|
|
231
245
|
{
|
|
232
246
|
htmlFor: `${field}-${option.value}`,
|
|
233
247
|
className: "text-sm font-normal cursor-pointer",
|
|
@@ -261,7 +275,7 @@ function SelectTrigger({
|
|
|
261
275
|
{
|
|
262
276
|
"data-slot": "select-trigger",
|
|
263
277
|
"data-size": size,
|
|
264
|
-
className:
|
|
278
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
265
279
|
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
266
280
|
className
|
|
267
281
|
),
|
|
@@ -283,7 +297,7 @@ function SelectContent({
|
|
|
283
297
|
SelectPrimitive__namespace.Content,
|
|
284
298
|
{
|
|
285
299
|
"data-slot": "select-content",
|
|
286
|
-
className:
|
|
300
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
287
301
|
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
288
302
|
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
289
303
|
className
|
|
@@ -295,7 +309,7 @@ function SelectContent({
|
|
|
295
309
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
296
310
|
SelectPrimitive__namespace.Viewport,
|
|
297
311
|
{
|
|
298
|
-
className:
|
|
312
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
299
313
|
"p-1",
|
|
300
314
|
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
301
315
|
),
|
|
@@ -316,7 +330,7 @@ function SelectItem({
|
|
|
316
330
|
SelectPrimitive__namespace.Item,
|
|
317
331
|
{
|
|
318
332
|
"data-slot": "select-item",
|
|
319
|
-
className:
|
|
333
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
320
334
|
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
321
335
|
className
|
|
322
336
|
),
|
|
@@ -336,7 +350,7 @@ function SelectScrollUpButton({
|
|
|
336
350
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
337
351
|
{
|
|
338
352
|
"data-slot": "select-scroll-up-button",
|
|
339
|
-
className:
|
|
353
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
340
354
|
"flex cursor-default items-center justify-center py-1",
|
|
341
355
|
className
|
|
342
356
|
),
|
|
@@ -353,7 +367,7 @@ function SelectScrollDownButton({
|
|
|
353
367
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
354
368
|
{
|
|
355
369
|
"data-slot": "select-scroll-down-button",
|
|
356
|
-
className:
|
|
370
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
357
371
|
"flex cursor-default items-center justify-center py-1",
|
|
358
372
|
className
|
|
359
373
|
),
|
|
@@ -372,12 +386,18 @@ var SmartSelect = ({
|
|
|
372
386
|
required = false,
|
|
373
387
|
defaultValue,
|
|
374
388
|
info,
|
|
375
|
-
subLabel
|
|
389
|
+
subLabel,
|
|
390
|
+
disabled,
|
|
391
|
+
hidden
|
|
376
392
|
}) => {
|
|
377
|
-
const {
|
|
378
|
-
const
|
|
393
|
+
const { formData } = chunkMBC5TYXA_cjs.useSmartForm();
|
|
394
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkMBC5TYXA_cjs.useFormField(field);
|
|
395
|
+
const fieldDetection = chunkMBC5TYXA_cjs.useFieldDetection();
|
|
379
396
|
const hasRegistered = React4.useRef(false);
|
|
380
397
|
const hasSetDefault = React4.useRef(false);
|
|
398
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
399
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
400
|
+
if (isHidden) return null;
|
|
381
401
|
React4.useEffect(() => {
|
|
382
402
|
if (validation && !hasRegistered.current) {
|
|
383
403
|
hasRegistered.current = true;
|
|
@@ -398,14 +418,14 @@ var SmartSelect = ({
|
|
|
398
418
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
399
419
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
400
420
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
401
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
402
422
|
label,
|
|
403
423
|
" ",
|
|
404
424
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
405
425
|
] }),
|
|
406
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
407
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
408
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
426
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Tooltip, { children: [
|
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
428
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
409
429
|
] }) })
|
|
410
430
|
] }),
|
|
411
431
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -422,6 +442,7 @@ var SmartSelect = ({
|
|
|
422
442
|
ref: fieldRef,
|
|
423
443
|
className: `w-full ${error ? "border-destructive" : ""} ${className}`,
|
|
424
444
|
"data-field": field,
|
|
445
|
+
disabled: isDisabled,
|
|
425
446
|
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: placeholder || `Select ${label || field}` })
|
|
426
447
|
}
|
|
427
448
|
),
|
|
@@ -469,7 +490,7 @@ function Button({
|
|
|
469
490
|
Comp,
|
|
470
491
|
{
|
|
471
492
|
"data-slot": "button",
|
|
472
|
-
className:
|
|
493
|
+
className: chunkMBC5TYXA_cjs.cn(buttonVariants({ variant, size, className })),
|
|
473
494
|
...props
|
|
474
495
|
}
|
|
475
496
|
);
|
|
@@ -489,7 +510,7 @@ function Calendar({
|
|
|
489
510
|
reactDayPicker.DayPicker,
|
|
490
511
|
{
|
|
491
512
|
showOutsideDays,
|
|
492
|
-
className:
|
|
513
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
493
514
|
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
494
515
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
495
516
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
@@ -501,85 +522,85 @@ function Calendar({
|
|
|
501
522
|
...formatters
|
|
502
523
|
},
|
|
503
524
|
classNames: {
|
|
504
|
-
root:
|
|
505
|
-
months:
|
|
525
|
+
root: chunkMBC5TYXA_cjs.cn("w-fit", defaultClassNames.root),
|
|
526
|
+
months: chunkMBC5TYXA_cjs.cn(
|
|
506
527
|
"flex gap-4 flex-col md:flex-row relative",
|
|
507
528
|
defaultClassNames.months
|
|
508
529
|
),
|
|
509
|
-
month:
|
|
510
|
-
nav:
|
|
530
|
+
month: chunkMBC5TYXA_cjs.cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
531
|
+
nav: chunkMBC5TYXA_cjs.cn(
|
|
511
532
|
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
512
533
|
defaultClassNames.nav
|
|
513
534
|
),
|
|
514
|
-
button_previous:
|
|
535
|
+
button_previous: chunkMBC5TYXA_cjs.cn(
|
|
515
536
|
buttonVariants({ variant: buttonVariant }),
|
|
516
537
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
517
538
|
defaultClassNames.button_previous
|
|
518
539
|
),
|
|
519
|
-
button_next:
|
|
540
|
+
button_next: chunkMBC5TYXA_cjs.cn(
|
|
520
541
|
buttonVariants({ variant: buttonVariant }),
|
|
521
542
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
522
543
|
defaultClassNames.button_next
|
|
523
544
|
),
|
|
524
|
-
month_caption:
|
|
545
|
+
month_caption: chunkMBC5TYXA_cjs.cn(
|
|
525
546
|
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
526
547
|
defaultClassNames.month_caption
|
|
527
548
|
),
|
|
528
|
-
dropdowns:
|
|
549
|
+
dropdowns: chunkMBC5TYXA_cjs.cn(
|
|
529
550
|
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
530
551
|
defaultClassNames.dropdowns
|
|
531
552
|
),
|
|
532
|
-
dropdown_root:
|
|
553
|
+
dropdown_root: chunkMBC5TYXA_cjs.cn(
|
|
533
554
|
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
534
555
|
defaultClassNames.dropdown_root
|
|
535
556
|
),
|
|
536
|
-
dropdown:
|
|
557
|
+
dropdown: chunkMBC5TYXA_cjs.cn(
|
|
537
558
|
"absolute bg-popover inset-0 opacity-0",
|
|
538
559
|
defaultClassNames.dropdown
|
|
539
560
|
),
|
|
540
|
-
caption_label:
|
|
561
|
+
caption_label: chunkMBC5TYXA_cjs.cn(
|
|
541
562
|
"select-none font-medium",
|
|
542
563
|
captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
543
564
|
defaultClassNames.caption_label
|
|
544
565
|
),
|
|
545
566
|
table: "w-full border-collapse",
|
|
546
|
-
weekdays:
|
|
547
|
-
weekday:
|
|
567
|
+
weekdays: chunkMBC5TYXA_cjs.cn("flex", defaultClassNames.weekdays),
|
|
568
|
+
weekday: chunkMBC5TYXA_cjs.cn(
|
|
548
569
|
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
549
570
|
defaultClassNames.weekday
|
|
550
571
|
),
|
|
551
|
-
week:
|
|
552
|
-
week_number_header:
|
|
572
|
+
week: chunkMBC5TYXA_cjs.cn("flex w-full mt-2", defaultClassNames.week),
|
|
573
|
+
week_number_header: chunkMBC5TYXA_cjs.cn(
|
|
553
574
|
"select-none w-(--cell-size)",
|
|
554
575
|
defaultClassNames.week_number_header
|
|
555
576
|
),
|
|
556
|
-
week_number:
|
|
577
|
+
week_number: chunkMBC5TYXA_cjs.cn(
|
|
557
578
|
"text-[0.8rem] select-none text-muted-foreground",
|
|
558
579
|
defaultClassNames.week_number
|
|
559
580
|
),
|
|
560
|
-
day:
|
|
581
|
+
day: chunkMBC5TYXA_cjs.cn(
|
|
561
582
|
"relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
562
583
|
defaultClassNames.day
|
|
563
584
|
),
|
|
564
|
-
range_start:
|
|
585
|
+
range_start: chunkMBC5TYXA_cjs.cn(
|
|
565
586
|
"rounded-l-md bg-accent",
|
|
566
587
|
defaultClassNames.range_start
|
|
567
588
|
),
|
|
568
|
-
range_middle:
|
|
569
|
-
range_end:
|
|
570
|
-
today:
|
|
589
|
+
range_middle: chunkMBC5TYXA_cjs.cn("rounded-none", defaultClassNames.range_middle),
|
|
590
|
+
range_end: chunkMBC5TYXA_cjs.cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
591
|
+
today: chunkMBC5TYXA_cjs.cn(
|
|
571
592
|
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
572
593
|
defaultClassNames.today
|
|
573
594
|
),
|
|
574
|
-
outside:
|
|
595
|
+
outside: chunkMBC5TYXA_cjs.cn(
|
|
575
596
|
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
576
597
|
defaultClassNames.outside
|
|
577
598
|
),
|
|
578
|
-
disabled:
|
|
599
|
+
disabled: chunkMBC5TYXA_cjs.cn(
|
|
579
600
|
"text-muted-foreground opacity-50",
|
|
580
601
|
defaultClassNames.disabled
|
|
581
602
|
),
|
|
582
|
-
hidden:
|
|
603
|
+
hidden: chunkMBC5TYXA_cjs.cn("invisible", defaultClassNames.hidden),
|
|
583
604
|
...classNames
|
|
584
605
|
},
|
|
585
606
|
components: {
|
|
@@ -589,25 +610,25 @@ function Calendar({
|
|
|
589
610
|
{
|
|
590
611
|
"data-slot": "calendar",
|
|
591
612
|
ref: rootRef,
|
|
592
|
-
className:
|
|
613
|
+
className: chunkMBC5TYXA_cjs.cn(className2),
|
|
593
614
|
...props2
|
|
594
615
|
}
|
|
595
616
|
);
|
|
596
617
|
},
|
|
597
618
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
598
619
|
if (orientation === "left") {
|
|
599
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className:
|
|
620
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: chunkMBC5TYXA_cjs.cn("size-4", className2), ...props2 });
|
|
600
621
|
}
|
|
601
622
|
if (orientation === "right") {
|
|
602
623
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
603
624
|
lucideReact.ChevronRightIcon,
|
|
604
625
|
{
|
|
605
|
-
className:
|
|
626
|
+
className: chunkMBC5TYXA_cjs.cn("size-4", className2),
|
|
606
627
|
...props2
|
|
607
628
|
}
|
|
608
629
|
);
|
|
609
630
|
}
|
|
610
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className:
|
|
631
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: chunkMBC5TYXA_cjs.cn("size-4", className2), ...props2 });
|
|
611
632
|
},
|
|
612
633
|
DayButton: CalendarDayButton,
|
|
613
634
|
WeekNumber: ({ children, ...props2 }) => {
|
|
@@ -641,7 +662,7 @@ function CalendarDayButton({
|
|
|
641
662
|
"data-range-start": modifiers.range_start,
|
|
642
663
|
"data-range-end": modifiers.range_end,
|
|
643
664
|
"data-range-middle": modifiers.range_middle,
|
|
644
|
-
className:
|
|
665
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
645
666
|
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
646
667
|
defaultClassNames.day,
|
|
647
668
|
className
|
|
@@ -672,7 +693,7 @@ function PopoverContent({
|
|
|
672
693
|
"data-slot": "popover-content",
|
|
673
694
|
align,
|
|
674
695
|
sideOffset,
|
|
675
|
-
className:
|
|
696
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
676
697
|
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
677
698
|
className
|
|
678
699
|
),
|
|
@@ -694,12 +715,18 @@ var SmartDatePicker = ({
|
|
|
694
715
|
maxDate,
|
|
695
716
|
defaultValue,
|
|
696
717
|
info,
|
|
697
|
-
subLabel
|
|
718
|
+
subLabel,
|
|
719
|
+
disabled,
|
|
720
|
+
hidden
|
|
698
721
|
}) => {
|
|
699
|
-
const {
|
|
700
|
-
const
|
|
722
|
+
const { formData } = chunkMBC5TYXA_cjs.useSmartForm();
|
|
723
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkMBC5TYXA_cjs.useFormField(field);
|
|
724
|
+
const fieldDetection = chunkMBC5TYXA_cjs.useFieldDetection();
|
|
701
725
|
const hasRegistered = React4.useRef(false);
|
|
702
726
|
const hasSetDefault = React4.useRef(false);
|
|
727
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
728
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
729
|
+
if (isHidden) return null;
|
|
703
730
|
const parsedValue = React4.useMemo(() => {
|
|
704
731
|
if (!value) return void 0;
|
|
705
732
|
if (value instanceof Date) return value;
|
|
@@ -755,17 +782,17 @@ var SmartDatePicker = ({
|
|
|
755
782
|
if (!parsedValue) return placeholder || `Select ${label || field}`;
|
|
756
783
|
return dateFns.format(parsedValue, "dd/MM/yyyy");
|
|
757
784
|
}, [parsedValue, placeholder, label, field]);
|
|
758
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
785
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkMBC5TYXA_cjs.cn("flex-1 min-w-0", className), children: [
|
|
759
786
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
760
787
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
761
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
788
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
762
789
|
label,
|
|
763
790
|
" ",
|
|
764
791
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
765
792
|
] }),
|
|
766
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
767
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
793
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Tooltip, { children: [
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
795
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
769
796
|
] }) })
|
|
770
797
|
] }),
|
|
771
798
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -776,12 +803,13 @@ var SmartDatePicker = ({
|
|
|
776
803
|
{
|
|
777
804
|
ref: fieldRef,
|
|
778
805
|
variant: "outline",
|
|
779
|
-
className:
|
|
806
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
780
807
|
"w-full justify-start text-left font-normal",
|
|
781
808
|
!parsedValue && "text-muted-foreground",
|
|
782
809
|
error && "border-destructive"
|
|
783
810
|
),
|
|
784
811
|
"data-field": field,
|
|
812
|
+
disabled: isDisabled,
|
|
785
813
|
children: [
|
|
786
814
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
|
|
787
815
|
buttonText
|
|
@@ -815,15 +843,20 @@ var SmartTags = ({
|
|
|
815
843
|
minLength,
|
|
816
844
|
allowDuplicates = false,
|
|
817
845
|
disabled = false,
|
|
846
|
+
hidden = false,
|
|
818
847
|
onTagAdd,
|
|
819
848
|
onTagRemove,
|
|
820
849
|
info,
|
|
821
850
|
subLabel
|
|
822
851
|
}) => {
|
|
823
|
-
const {
|
|
824
|
-
const
|
|
852
|
+
const { formData } = chunkMBC5TYXA_cjs.useSmartForm();
|
|
853
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkMBC5TYXA_cjs.useFormField(field);
|
|
854
|
+
const fieldDetection = chunkMBC5TYXA_cjs.useFieldDetection();
|
|
825
855
|
const hasRegistered = React4.useRef(false);
|
|
826
856
|
const hasSetDefault = React4.useRef(false);
|
|
857
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
858
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
859
|
+
if (isHidden) return null;
|
|
827
860
|
const [tags, setTags] = React4.useState([]);
|
|
828
861
|
const [inputValue, setInputValue] = React4.useState("");
|
|
829
862
|
const inputRef = React4.useRef(null);
|
|
@@ -890,7 +923,7 @@ var SmartTags = ({
|
|
|
890
923
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
891
924
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
892
925
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
893
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
926
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
894
927
|
label,
|
|
895
928
|
" ",
|
|
896
929
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" }),
|
|
@@ -902,9 +935,9 @@ var SmartTags = ({
|
|
|
902
935
|
")"
|
|
903
936
|
] })
|
|
904
937
|
] }),
|
|
905
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
906
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
907
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
938
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkMBC5TYXA_cjs.Tooltip, { children: [
|
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
940
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMBC5TYXA_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
908
941
|
] }) })
|
|
909
942
|
] }),
|
|
910
943
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -913,12 +946,12 @@ var SmartTags = ({
|
|
|
913
946
|
"div",
|
|
914
947
|
{
|
|
915
948
|
ref: fieldRef,
|
|
916
|
-
className:
|
|
949
|
+
className: chunkMBC5TYXA_cjs.cn(
|
|
917
950
|
"min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
|
|
918
951
|
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
919
952
|
"flex flex-wrap items-center gap-2 cursor-text",
|
|
920
953
|
error && "border-destructive focus-within:ring-destructive",
|
|
921
|
-
|
|
954
|
+
isDisabled && "cursor-not-allowed opacity-50"
|
|
922
955
|
),
|
|
923
956
|
"data-field": field,
|
|
924
957
|
onClick: () => inputRef.current?.focus(),
|
|
@@ -940,7 +973,7 @@ var SmartTags = ({
|
|
|
940
973
|
e.stopPropagation();
|
|
941
974
|
removeTag(tagText);
|
|
942
975
|
},
|
|
943
|
-
disabled,
|
|
976
|
+
disabled: isDisabled,
|
|
944
977
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
|
|
945
978
|
}
|
|
946
979
|
)
|
|
@@ -949,7 +982,7 @@ var SmartTags = ({
|
|
|
949
982
|
`${tagText}-${index}`
|
|
950
983
|
)),
|
|
951
984
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
952
|
-
|
|
985
|
+
chunkMBC5TYXA_cjs.Input,
|
|
953
986
|
{
|
|
954
987
|
ref: inputRef,
|
|
955
988
|
type: "text",
|
|
@@ -958,7 +991,7 @@ var SmartTags = ({
|
|
|
958
991
|
onKeyDown: handleKeyDown,
|
|
959
992
|
placeholder: tags.length === 0 ? placeholder : "",
|
|
960
993
|
className: "flex-1 min-w-[120px] border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 p-0 h-auto",
|
|
961
|
-
disabled,
|
|
994
|
+
disabled: isDisabled,
|
|
962
995
|
maxLength
|
|
963
996
|
}
|
|
964
997
|
)
|
|
@@ -978,5 +1011,5 @@ exports.SmartDatePicker = SmartDatePicker;
|
|
|
978
1011
|
exports.SmartRadioGroup = SmartRadioGroup;
|
|
979
1012
|
exports.SmartSelect = SmartSelect;
|
|
980
1013
|
exports.SmartTags = SmartTags;
|
|
981
|
-
//# sourceMappingURL=chunk-
|
|
982
|
-
//# sourceMappingURL=chunk-
|
|
1014
|
+
//# sourceMappingURL=chunk-TJ6EFR2O.cjs.map
|
|
1015
|
+
//# sourceMappingURL=chunk-TJ6EFR2O.cjs.map
|