@algodomain/smart-forms 0.1.3 → 0.1.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/{SmartTags-DPqw9PG1.d.cts → SmartTags-DEpmTDF5.d.cts} +30 -17
- package/dist/{SmartTags-DPqw9PG1.d.ts → SmartTags-DEpmTDF5.d.ts} +30 -17
- package/dist/{chunk-CT6GW6PK.js → chunk-BNQNL7GF.js} +625 -145
- package/dist/chunk-BNQNL7GF.js.map +1 -0
- package/dist/{chunk-3L7TKJIB.js → chunk-RHECLW3K.js} +68 -4
- package/dist/chunk-RHECLW3K.js.map +1 -0
- package/dist/{chunk-TJ6EFR2O.cjs → chunk-VGP3HY5Y.cjs} +729 -239
- package/dist/chunk-VGP3HY5Y.cjs.map +1 -0
- package/dist/{chunk-MBC5TYXA.cjs → chunk-WIBCOQPP.cjs} +68 -4
- package/dist/chunk-WIBCOQPP.cjs.map +1 -0
- package/dist/fields.cjs +162 -479
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.d.cts +3 -23
- package/dist/fields.d.ts +3 -23
- package/dist/fields.js +9 -329
- package/dist/fields.js.map +1 -1
- package/dist/index.cjs +34 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/opinionated.cjs +18 -18
- package/dist/opinionated.js +2 -2
- package/package.json +4 -2
- package/dist/chunk-3L7TKJIB.js.map +0 -1
- package/dist/chunk-CT6GW6PK.js.map +0 -1
- package/dist/chunk-MBC5TYXA.cjs.map +0 -1
- package/dist/chunk-TJ6EFR2O.cjs.map +0 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkWIBCOQPP_cjs = require('./chunk-WIBCOQPP.cjs');
|
|
4
|
+
var React6 = require('react');
|
|
5
5
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
9
9
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
10
|
-
var
|
|
10
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
11
11
|
var reactSlot = require('@radix-ui/react-slot');
|
|
12
12
|
var classVarianceAuthority = require('class-variance-authority');
|
|
13
|
+
var cmdk = require('cmdk');
|
|
14
|
+
var dateFns = require('date-fns');
|
|
13
15
|
var reactDayPicker = require('react-day-picker');
|
|
14
|
-
var
|
|
16
|
+
var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
17
|
+
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
15
18
|
|
|
16
19
|
function _interopNamespace(e) {
|
|
17
20
|
if (e && e.__esModule) return e;
|
|
@@ -31,11 +34,13 @@ function _interopNamespace(e) {
|
|
|
31
34
|
return Object.freeze(n);
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
var
|
|
37
|
+
var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
|
|
35
38
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
36
39
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
37
40
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
38
41
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
42
|
+
var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
|
|
43
|
+
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
39
44
|
|
|
40
45
|
function Checkbox({
|
|
41
46
|
className,
|
|
@@ -45,7 +50,7 @@ function Checkbox({
|
|
|
45
50
|
CheckboxPrimitive__namespace.Root,
|
|
46
51
|
{
|
|
47
52
|
"data-slot": "checkbox",
|
|
48
|
-
className:
|
|
53
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
49
54
|
"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
55
|
className
|
|
51
56
|
),
|
|
@@ -73,26 +78,26 @@ var SmartCheckbox = ({
|
|
|
73
78
|
disabled,
|
|
74
79
|
hidden
|
|
75
80
|
}) => {
|
|
76
|
-
const { formData } =
|
|
77
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
78
|
-
const fieldDetection =
|
|
79
|
-
const hasRegistered =
|
|
80
|
-
const hasSetDefault =
|
|
81
|
+
const { formData } = chunkWIBCOQPP_cjs.useSmartForm();
|
|
82
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkWIBCOQPP_cjs.useFormField(field);
|
|
83
|
+
const fieldDetection = chunkWIBCOQPP_cjs.useFieldDetection();
|
|
84
|
+
const hasRegistered = React6.useRef(false);
|
|
85
|
+
const hasSetDefault = React6.useRef(false);
|
|
81
86
|
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
82
87
|
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
83
88
|
if (isHidden) return null;
|
|
84
|
-
|
|
89
|
+
React6.useEffect(() => {
|
|
85
90
|
if (validation && !hasRegistered.current) {
|
|
86
91
|
hasRegistered.current = true;
|
|
87
92
|
registerValidation(field, validation);
|
|
88
93
|
}
|
|
89
94
|
}, [validation, field, registerValidation]);
|
|
90
|
-
|
|
95
|
+
React6.useEffect(() => {
|
|
91
96
|
if (fieldDetection?.registerField) {
|
|
92
97
|
fieldDetection.registerField(field);
|
|
93
98
|
}
|
|
94
99
|
}, [field, fieldDetection]);
|
|
95
|
-
|
|
100
|
+
React6.useEffect(() => {
|
|
96
101
|
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
97
102
|
onChange(defaultValue);
|
|
98
103
|
hasSetDefault.current = true;
|
|
@@ -114,15 +119,15 @@ var SmartCheckbox = ({
|
|
|
114
119
|
disabled: isDisabled
|
|
115
120
|
}
|
|
116
121
|
),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { htmlFor: `${field}-checkbox`, className: "text-sm font-normal cursor-pointer", children: [
|
|
118
123
|
label || field,
|
|
119
124
|
" ",
|
|
120
125
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
121
126
|
] })
|
|
122
127
|
] }),
|
|
123
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
128
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Tooltip, { children: [
|
|
129
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
126
131
|
] }) })
|
|
127
132
|
] }),
|
|
128
133
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground ml-6", children: subLabel })
|
|
@@ -138,7 +143,7 @@ function RadioGroup({
|
|
|
138
143
|
RadioGroupPrimitive__namespace.Root,
|
|
139
144
|
{
|
|
140
145
|
"data-slot": "radio-group",
|
|
141
|
-
className:
|
|
146
|
+
className: chunkWIBCOQPP_cjs.cn("grid gap-3", className),
|
|
142
147
|
...props
|
|
143
148
|
}
|
|
144
149
|
);
|
|
@@ -151,7 +156,7 @@ function RadioGroupItem({
|
|
|
151
156
|
RadioGroupPrimitive__namespace.Item,
|
|
152
157
|
{
|
|
153
158
|
"data-slot": "radio-group-item",
|
|
154
|
-
className:
|
|
159
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
155
160
|
"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",
|
|
156
161
|
className
|
|
157
162
|
),
|
|
@@ -182,26 +187,26 @@ var SmartRadioGroup = ({
|
|
|
182
187
|
disabled,
|
|
183
188
|
hidden
|
|
184
189
|
}) => {
|
|
185
|
-
const { formData } =
|
|
186
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
187
|
-
const fieldDetection =
|
|
188
|
-
const hasRegistered =
|
|
189
|
-
const hasSetDefault =
|
|
190
|
+
const { formData } = chunkWIBCOQPP_cjs.useSmartForm();
|
|
191
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkWIBCOQPP_cjs.useFormField(field);
|
|
192
|
+
const fieldDetection = chunkWIBCOQPP_cjs.useFieldDetection();
|
|
193
|
+
const hasRegistered = React6.useRef(false);
|
|
194
|
+
const hasSetDefault = React6.useRef(false);
|
|
190
195
|
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
191
196
|
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
192
197
|
if (isHidden) return null;
|
|
193
|
-
|
|
198
|
+
React6.useEffect(() => {
|
|
194
199
|
if (validation && !hasRegistered.current) {
|
|
195
200
|
hasRegistered.current = true;
|
|
196
201
|
registerValidation(field, validation);
|
|
197
202
|
}
|
|
198
203
|
}, [validation, field, registerValidation]);
|
|
199
|
-
|
|
204
|
+
React6.useEffect(() => {
|
|
200
205
|
if (fieldDetection?.registerField) {
|
|
201
206
|
fieldDetection.registerField(field);
|
|
202
207
|
}
|
|
203
208
|
}, [field, fieldDetection]);
|
|
204
|
-
|
|
209
|
+
React6.useEffect(() => {
|
|
205
210
|
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
206
211
|
onChange(defaultValue);
|
|
207
212
|
hasSetDefault.current = true;
|
|
@@ -210,14 +215,14 @@ var SmartRadioGroup = ({
|
|
|
210
215
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
211
216
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
212
217
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
213
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
214
219
|
label,
|
|
215
220
|
" ",
|
|
216
221
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
217
222
|
] }),
|
|
218
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
223
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Tooltip, { children: [
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
221
226
|
] }) })
|
|
222
227
|
] }),
|
|
223
228
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -241,7 +246,7 @@ var SmartRadioGroup = ({
|
|
|
241
246
|
}
|
|
242
247
|
),
|
|
243
248
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
244
|
-
|
|
249
|
+
chunkWIBCOQPP_cjs.Label,
|
|
245
250
|
{
|
|
246
251
|
htmlFor: `${field}-${option.value}`,
|
|
247
252
|
className: "text-sm font-normal cursor-pointer",
|
|
@@ -275,7 +280,7 @@ function SelectTrigger({
|
|
|
275
280
|
{
|
|
276
281
|
"data-slot": "select-trigger",
|
|
277
282
|
"data-size": size,
|
|
278
|
-
className:
|
|
283
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
279
284
|
"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",
|
|
280
285
|
className
|
|
281
286
|
),
|
|
@@ -297,7 +302,7 @@ function SelectContent({
|
|
|
297
302
|
SelectPrimitive__namespace.Content,
|
|
298
303
|
{
|
|
299
304
|
"data-slot": "select-content",
|
|
300
|
-
className:
|
|
305
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
301
306
|
"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",
|
|
302
307
|
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",
|
|
303
308
|
className
|
|
@@ -309,7 +314,7 @@ function SelectContent({
|
|
|
309
314
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
310
315
|
SelectPrimitive__namespace.Viewport,
|
|
311
316
|
{
|
|
312
|
-
className:
|
|
317
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
313
318
|
"p-1",
|
|
314
319
|
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
315
320
|
),
|
|
@@ -330,7 +335,7 @@ function SelectItem({
|
|
|
330
335
|
SelectPrimitive__namespace.Item,
|
|
331
336
|
{
|
|
332
337
|
"data-slot": "select-item",
|
|
333
|
-
className:
|
|
338
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
334
339
|
"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",
|
|
335
340
|
className
|
|
336
341
|
),
|
|
@@ -350,7 +355,7 @@ function SelectScrollUpButton({
|
|
|
350
355
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
351
356
|
{
|
|
352
357
|
"data-slot": "select-scroll-up-button",
|
|
353
|
-
className:
|
|
358
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
354
359
|
"flex cursor-default items-center justify-center py-1",
|
|
355
360
|
className
|
|
356
361
|
),
|
|
@@ -367,7 +372,7 @@ function SelectScrollDownButton({
|
|
|
367
372
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
368
373
|
{
|
|
369
374
|
"data-slot": "select-scroll-down-button",
|
|
370
|
-
className:
|
|
375
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
371
376
|
"flex cursor-default items-center justify-center py-1",
|
|
372
377
|
className
|
|
373
378
|
),
|
|
@@ -390,26 +395,26 @@ var SmartSelect = ({
|
|
|
390
395
|
disabled,
|
|
391
396
|
hidden
|
|
392
397
|
}) => {
|
|
393
|
-
const { formData } =
|
|
394
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
395
|
-
const fieldDetection =
|
|
396
|
-
const hasRegistered =
|
|
397
|
-
const hasSetDefault =
|
|
398
|
+
const { formData } = chunkWIBCOQPP_cjs.useSmartForm();
|
|
399
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkWIBCOQPP_cjs.useFormField(field);
|
|
400
|
+
const fieldDetection = chunkWIBCOQPP_cjs.useFieldDetection();
|
|
401
|
+
const hasRegistered = React6.useRef(false);
|
|
402
|
+
const hasSetDefault = React6.useRef(false);
|
|
398
403
|
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
399
404
|
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
400
405
|
if (isHidden) return null;
|
|
401
|
-
|
|
406
|
+
React6.useEffect(() => {
|
|
402
407
|
if (validation && !hasRegistered.current) {
|
|
403
408
|
hasRegistered.current = true;
|
|
404
409
|
registerValidation(field, validation);
|
|
405
410
|
}
|
|
406
411
|
}, [validation, field, registerValidation]);
|
|
407
|
-
|
|
412
|
+
React6.useEffect(() => {
|
|
408
413
|
if (fieldDetection?.registerField) {
|
|
409
414
|
fieldDetection.registerField(field);
|
|
410
415
|
}
|
|
411
416
|
}, [field, fieldDetection]);
|
|
412
|
-
|
|
417
|
+
React6.useEffect(() => {
|
|
413
418
|
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
414
419
|
onChange(defaultValue);
|
|
415
420
|
hasSetDefault.current = true;
|
|
@@ -418,14 +423,14 @@ var SmartSelect = ({
|
|
|
418
423
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
419
424
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
420
425
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
421
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
422
427
|
label,
|
|
423
428
|
" ",
|
|
424
429
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
425
430
|
] }),
|
|
426
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
431
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Tooltip, { children: [
|
|
432
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
433
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
429
434
|
] }) })
|
|
430
435
|
] }),
|
|
431
436
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -453,6 +458,36 @@ var SmartSelect = ({
|
|
|
453
458
|
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
|
|
454
459
|
] });
|
|
455
460
|
};
|
|
461
|
+
function Popover({
|
|
462
|
+
...props
|
|
463
|
+
}) {
|
|
464
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
|
|
465
|
+
}
|
|
466
|
+
function PopoverTrigger({
|
|
467
|
+
...props
|
|
468
|
+
}) {
|
|
469
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
470
|
+
}
|
|
471
|
+
function PopoverContent({
|
|
472
|
+
className,
|
|
473
|
+
align = "center",
|
|
474
|
+
sideOffset = 4,
|
|
475
|
+
...props
|
|
476
|
+
}) {
|
|
477
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
478
|
+
PopoverPrimitive__namespace.Content,
|
|
479
|
+
{
|
|
480
|
+
"data-slot": "popover-content",
|
|
481
|
+
align,
|
|
482
|
+
sideOffset,
|
|
483
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
484
|
+
"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",
|
|
485
|
+
className
|
|
486
|
+
),
|
|
487
|
+
...props
|
|
488
|
+
}
|
|
489
|
+
) });
|
|
490
|
+
}
|
|
456
491
|
var buttonVariants = classVarianceAuthority.cva(
|
|
457
492
|
"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",
|
|
458
493
|
{
|
|
@@ -490,11 +525,328 @@ function Button({
|
|
|
490
525
|
Comp,
|
|
491
526
|
{
|
|
492
527
|
"data-slot": "button",
|
|
493
|
-
className:
|
|
528
|
+
className: chunkWIBCOQPP_cjs.cn(buttonVariants({ variant, size, className })),
|
|
529
|
+
...props
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
function Command({
|
|
534
|
+
className,
|
|
535
|
+
...props
|
|
536
|
+
}) {
|
|
537
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
538
|
+
cmdk.Command,
|
|
539
|
+
{
|
|
540
|
+
"data-slot": "command",
|
|
541
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
542
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
543
|
+
className
|
|
544
|
+
),
|
|
545
|
+
...props
|
|
546
|
+
}
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
function CommandInput({
|
|
550
|
+
className,
|
|
551
|
+
...props
|
|
552
|
+
}) {
|
|
553
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
554
|
+
"div",
|
|
555
|
+
{
|
|
556
|
+
"data-slot": "command-input-wrapper",
|
|
557
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
558
|
+
children: [
|
|
559
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
560
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
561
|
+
cmdk.Command.Input,
|
|
562
|
+
{
|
|
563
|
+
"data-slot": "command-input",
|
|
564
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
565
|
+
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
566
|
+
className
|
|
567
|
+
),
|
|
568
|
+
...props
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
]
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
function CommandList({
|
|
576
|
+
className,
|
|
577
|
+
...props
|
|
578
|
+
}) {
|
|
579
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
+
cmdk.Command.List,
|
|
581
|
+
{
|
|
582
|
+
"data-slot": "command-list",
|
|
583
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
584
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
585
|
+
className
|
|
586
|
+
),
|
|
587
|
+
...props
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
function CommandEmpty({
|
|
592
|
+
...props
|
|
593
|
+
}) {
|
|
594
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
595
|
+
cmdk.Command.Empty,
|
|
596
|
+
{
|
|
597
|
+
"data-slot": "command-empty",
|
|
598
|
+
className: "py-6 text-center text-sm",
|
|
599
|
+
...props
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
function CommandGroup({
|
|
604
|
+
className,
|
|
605
|
+
...props
|
|
606
|
+
}) {
|
|
607
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
608
|
+
cmdk.Command.Group,
|
|
609
|
+
{
|
|
610
|
+
"data-slot": "command-group",
|
|
611
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
612
|
+
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
613
|
+
className
|
|
614
|
+
),
|
|
494
615
|
...props
|
|
495
616
|
}
|
|
496
617
|
);
|
|
497
618
|
}
|
|
619
|
+
function CommandItem({
|
|
620
|
+
className,
|
|
621
|
+
...props
|
|
622
|
+
}) {
|
|
623
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
624
|
+
cmdk.Command.Item,
|
|
625
|
+
{
|
|
626
|
+
"data-slot": "command-item",
|
|
627
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
628
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
629
|
+
className
|
|
630
|
+
),
|
|
631
|
+
...props
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
var badgeVariants = classVarianceAuthority.cva(
|
|
636
|
+
"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",
|
|
637
|
+
{
|
|
638
|
+
variants: {
|
|
639
|
+
variant: {
|
|
640
|
+
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
641
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
642
|
+
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
643
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
defaultVariants: {
|
|
647
|
+
variant: "default"
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
function Badge({
|
|
652
|
+
className,
|
|
653
|
+
variant,
|
|
654
|
+
asChild = false,
|
|
655
|
+
...props
|
|
656
|
+
}) {
|
|
657
|
+
const Comp = asChild ? reactSlot.Slot : "span";
|
|
658
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
659
|
+
Comp,
|
|
660
|
+
{
|
|
661
|
+
"data-slot": "badge",
|
|
662
|
+
className: chunkWIBCOQPP_cjs.cn(badgeVariants({ variant }), className),
|
|
663
|
+
...props
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
function Combobox({
|
|
668
|
+
options,
|
|
669
|
+
value = "",
|
|
670
|
+
onChange,
|
|
671
|
+
placeholder = "Select option...",
|
|
672
|
+
searchPlaceholder = "Search...",
|
|
673
|
+
noResultsText = "No results found.",
|
|
674
|
+
width = "100%",
|
|
675
|
+
isDisabled = false,
|
|
676
|
+
allowCustom = false
|
|
677
|
+
}) {
|
|
678
|
+
const [open, setOpen] = React6__namespace.default.useState(false);
|
|
679
|
+
const [searchValue, setSearchValue] = React6.useState("");
|
|
680
|
+
const containerStyles = {
|
|
681
|
+
width
|
|
682
|
+
};
|
|
683
|
+
const combinedOptions = allowCustom ? [
|
|
684
|
+
...options,
|
|
685
|
+
...searchValue && !options.some(
|
|
686
|
+
(opt) => opt.label.toLowerCase() === searchValue.toLowerCase()
|
|
687
|
+
) ? [
|
|
688
|
+
{
|
|
689
|
+
value: searchValue.toLowerCase().replace(/\s+/g, "-"),
|
|
690
|
+
label: searchValue
|
|
691
|
+
}
|
|
692
|
+
] : []
|
|
693
|
+
] : options;
|
|
694
|
+
const filteredOptions = combinedOptions.filter(
|
|
695
|
+
(option) => option.label.toLowerCase().includes(searchValue.toLowerCase())
|
|
696
|
+
);
|
|
697
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: containerStyles, children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
698
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
699
|
+
Button,
|
|
700
|
+
{
|
|
701
|
+
variant: "outline",
|
|
702
|
+
role: "combobox",
|
|
703
|
+
"aria-expanded": open,
|
|
704
|
+
style: containerStyles,
|
|
705
|
+
className: `flex items-center justify-between relative ${isDisabled ? "cursor-not-allowed opacity-50" : ""}`,
|
|
706
|
+
disabled: isDisabled,
|
|
707
|
+
children: [
|
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 text-left", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate", children: value ? combinedOptions.find((option) => option.value === value)?.label || value : placeholder }) }),
|
|
709
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 flex-shrink-0 opacity-50" })
|
|
710
|
+
]
|
|
711
|
+
}
|
|
712
|
+
) }),
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { className: "w-full", children: [
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
715
|
+
CommandInput,
|
|
716
|
+
{
|
|
717
|
+
value: searchValue,
|
|
718
|
+
onValueChange: setSearchValue,
|
|
719
|
+
placeholder: searchPlaceholder,
|
|
720
|
+
className: "h-9"
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandList, { children: filteredOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { className: "max-h-[200px] overflow-y-auto", children: filteredOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
724
|
+
CommandItem,
|
|
725
|
+
{
|
|
726
|
+
value: option.value,
|
|
727
|
+
onSelect: (currentValue) => {
|
|
728
|
+
onChange(currentValue === value ? "" : currentValue);
|
|
729
|
+
setOpen(false);
|
|
730
|
+
setSearchValue("");
|
|
731
|
+
},
|
|
732
|
+
className: "flex items-center",
|
|
733
|
+
style: { width: "100%" },
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center w-full min-w-0", children: [
|
|
736
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
737
|
+
lucideReact.Check,
|
|
738
|
+
{
|
|
739
|
+
className: `mr-2 h-4 w-4 flex-shrink-0 ${value === option.value ? "opacity-100" : "opacity-0"}`
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate flex-1", children: option.label })
|
|
743
|
+
] }),
|
|
744
|
+
option.badge && /* @__PURE__ */ jsxRuntime.jsx(
|
|
745
|
+
Badge,
|
|
746
|
+
{
|
|
747
|
+
variant: "outline",
|
|
748
|
+
className: "ml-2 text-[10px] px-2 py-0 h-5 font-normal",
|
|
749
|
+
children: option.badge
|
|
750
|
+
}
|
|
751
|
+
)
|
|
752
|
+
]
|
|
753
|
+
},
|
|
754
|
+
option.value
|
|
755
|
+
)) }) : /* @__PURE__ */ jsxRuntime.jsxs(CommandEmpty, { children: [
|
|
756
|
+
allowCustom && searchValue && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
757
|
+
Button,
|
|
758
|
+
{
|
|
759
|
+
variant: "ghost",
|
|
760
|
+
className: "w-full justify-start",
|
|
761
|
+
onClick: () => {
|
|
762
|
+
const newOption = {
|
|
763
|
+
value: searchValue.toLowerCase().replace(/\s+/g, "-")};
|
|
764
|
+
onChange(newOption.value);
|
|
765
|
+
setOpen(false);
|
|
766
|
+
setSearchValue("");
|
|
767
|
+
},
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "mr-2 h-4 w-4" }),
|
|
770
|
+
'Add "',
|
|
771
|
+
searchValue,
|
|
772
|
+
'" as a new option'
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
!searchValue && noResultsText
|
|
777
|
+
] }) })
|
|
778
|
+
] }) })
|
|
779
|
+
] }) });
|
|
780
|
+
}
|
|
781
|
+
var SmartCombobox = ({
|
|
782
|
+
field,
|
|
783
|
+
label,
|
|
784
|
+
options,
|
|
785
|
+
className = "",
|
|
786
|
+
placeholder,
|
|
787
|
+
allowCustom = false,
|
|
788
|
+
validation,
|
|
789
|
+
required = false,
|
|
790
|
+
defaultValue,
|
|
791
|
+
info,
|
|
792
|
+
subLabel,
|
|
793
|
+
disabled,
|
|
794
|
+
hidden
|
|
795
|
+
}) => {
|
|
796
|
+
const { formData } = chunkWIBCOQPP_cjs.useSmartForm();
|
|
797
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkWIBCOQPP_cjs.useFormField(field);
|
|
798
|
+
const fieldDetection = chunkWIBCOQPP_cjs.useFieldDetection();
|
|
799
|
+
const hasRegistered = React6.useRef(false);
|
|
800
|
+
const hasSetDefault = React6.useRef(false);
|
|
801
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
802
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
803
|
+
if (isHidden) return null;
|
|
804
|
+
React6.useEffect(() => {
|
|
805
|
+
if (validation && !hasRegistered.current) {
|
|
806
|
+
hasRegistered.current = true;
|
|
807
|
+
registerValidation(field, validation);
|
|
808
|
+
}
|
|
809
|
+
}, [validation, field, registerValidation]);
|
|
810
|
+
React6.useEffect(() => {
|
|
811
|
+
if (fieldDetection?.registerField) {
|
|
812
|
+
fieldDetection.registerField(field);
|
|
813
|
+
}
|
|
814
|
+
}, [field, fieldDetection]);
|
|
815
|
+
React6.useEffect(() => {
|
|
816
|
+
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
817
|
+
onChange(defaultValue);
|
|
818
|
+
hasSetDefault.current = true;
|
|
819
|
+
}
|
|
820
|
+
}, [defaultValue, value, onChange]);
|
|
821
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
822
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
823
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
824
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
825
|
+
label,
|
|
826
|
+
" ",
|
|
827
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
828
|
+
] }),
|
|
829
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Tooltip, { children: [
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
831
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
832
|
+
] }) })
|
|
833
|
+
] }),
|
|
834
|
+
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
835
|
+
] }),
|
|
836
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: fieldRef, "data-field": field, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
837
|
+
Combobox,
|
|
838
|
+
{
|
|
839
|
+
options: (options || []).map((o) => ({ value: o.value, label: o.label })),
|
|
840
|
+
value: value || "",
|
|
841
|
+
onChange: (newValue) => onChange(newValue),
|
|
842
|
+
placeholder: placeholder || (label ? `Select ${label.toLowerCase()}` : `Select ${field}`),
|
|
843
|
+
allowCustom,
|
|
844
|
+
isDisabled
|
|
845
|
+
}
|
|
846
|
+
) }),
|
|
847
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
|
|
848
|
+
] });
|
|
849
|
+
};
|
|
498
850
|
function Calendar({
|
|
499
851
|
className,
|
|
500
852
|
classNames,
|
|
@@ -510,7 +862,7 @@ function Calendar({
|
|
|
510
862
|
reactDayPicker.DayPicker,
|
|
511
863
|
{
|
|
512
864
|
showOutsideDays,
|
|
513
|
-
className:
|
|
865
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
514
866
|
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
515
867
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
516
868
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
@@ -522,85 +874,85 @@ function Calendar({
|
|
|
522
874
|
...formatters
|
|
523
875
|
},
|
|
524
876
|
classNames: {
|
|
525
|
-
root:
|
|
526
|
-
months:
|
|
877
|
+
root: chunkWIBCOQPP_cjs.cn("w-fit", defaultClassNames.root),
|
|
878
|
+
months: chunkWIBCOQPP_cjs.cn(
|
|
527
879
|
"flex gap-4 flex-col md:flex-row relative",
|
|
528
880
|
defaultClassNames.months
|
|
529
881
|
),
|
|
530
|
-
month:
|
|
531
|
-
nav:
|
|
882
|
+
month: chunkWIBCOQPP_cjs.cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
883
|
+
nav: chunkWIBCOQPP_cjs.cn(
|
|
532
884
|
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
533
885
|
defaultClassNames.nav
|
|
534
886
|
),
|
|
535
|
-
button_previous:
|
|
887
|
+
button_previous: chunkWIBCOQPP_cjs.cn(
|
|
536
888
|
buttonVariants({ variant: buttonVariant }),
|
|
537
889
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
538
890
|
defaultClassNames.button_previous
|
|
539
891
|
),
|
|
540
|
-
button_next:
|
|
892
|
+
button_next: chunkWIBCOQPP_cjs.cn(
|
|
541
893
|
buttonVariants({ variant: buttonVariant }),
|
|
542
894
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
543
895
|
defaultClassNames.button_next
|
|
544
896
|
),
|
|
545
|
-
month_caption:
|
|
897
|
+
month_caption: chunkWIBCOQPP_cjs.cn(
|
|
546
898
|
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
547
899
|
defaultClassNames.month_caption
|
|
548
900
|
),
|
|
549
|
-
dropdowns:
|
|
901
|
+
dropdowns: chunkWIBCOQPP_cjs.cn(
|
|
550
902
|
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
551
903
|
defaultClassNames.dropdowns
|
|
552
904
|
),
|
|
553
|
-
dropdown_root:
|
|
905
|
+
dropdown_root: chunkWIBCOQPP_cjs.cn(
|
|
554
906
|
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
555
907
|
defaultClassNames.dropdown_root
|
|
556
908
|
),
|
|
557
|
-
dropdown:
|
|
909
|
+
dropdown: chunkWIBCOQPP_cjs.cn(
|
|
558
910
|
"absolute bg-popover inset-0 opacity-0",
|
|
559
911
|
defaultClassNames.dropdown
|
|
560
912
|
),
|
|
561
|
-
caption_label:
|
|
913
|
+
caption_label: chunkWIBCOQPP_cjs.cn(
|
|
562
914
|
"select-none font-medium",
|
|
563
915
|
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",
|
|
564
916
|
defaultClassNames.caption_label
|
|
565
917
|
),
|
|
566
918
|
table: "w-full border-collapse",
|
|
567
|
-
weekdays:
|
|
568
|
-
weekday:
|
|
919
|
+
weekdays: chunkWIBCOQPP_cjs.cn("flex", defaultClassNames.weekdays),
|
|
920
|
+
weekday: chunkWIBCOQPP_cjs.cn(
|
|
569
921
|
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
570
922
|
defaultClassNames.weekday
|
|
571
923
|
),
|
|
572
|
-
week:
|
|
573
|
-
week_number_header:
|
|
924
|
+
week: chunkWIBCOQPP_cjs.cn("flex w-full mt-2", defaultClassNames.week),
|
|
925
|
+
week_number_header: chunkWIBCOQPP_cjs.cn(
|
|
574
926
|
"select-none w-(--cell-size)",
|
|
575
927
|
defaultClassNames.week_number_header
|
|
576
928
|
),
|
|
577
|
-
week_number:
|
|
929
|
+
week_number: chunkWIBCOQPP_cjs.cn(
|
|
578
930
|
"text-[0.8rem] select-none text-muted-foreground",
|
|
579
931
|
defaultClassNames.week_number
|
|
580
932
|
),
|
|
581
|
-
day:
|
|
933
|
+
day: chunkWIBCOQPP_cjs.cn(
|
|
582
934
|
"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",
|
|
583
935
|
defaultClassNames.day
|
|
584
936
|
),
|
|
585
|
-
range_start:
|
|
937
|
+
range_start: chunkWIBCOQPP_cjs.cn(
|
|
586
938
|
"rounded-l-md bg-accent",
|
|
587
939
|
defaultClassNames.range_start
|
|
588
940
|
),
|
|
589
|
-
range_middle:
|
|
590
|
-
range_end:
|
|
591
|
-
today:
|
|
941
|
+
range_middle: chunkWIBCOQPP_cjs.cn("rounded-none", defaultClassNames.range_middle),
|
|
942
|
+
range_end: chunkWIBCOQPP_cjs.cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
943
|
+
today: chunkWIBCOQPP_cjs.cn(
|
|
592
944
|
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
593
945
|
defaultClassNames.today
|
|
594
946
|
),
|
|
595
|
-
outside:
|
|
947
|
+
outside: chunkWIBCOQPP_cjs.cn(
|
|
596
948
|
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
597
949
|
defaultClassNames.outside
|
|
598
950
|
),
|
|
599
|
-
disabled:
|
|
951
|
+
disabled: chunkWIBCOQPP_cjs.cn(
|
|
600
952
|
"text-muted-foreground opacity-50",
|
|
601
953
|
defaultClassNames.disabled
|
|
602
954
|
),
|
|
603
|
-
hidden:
|
|
955
|
+
hidden: chunkWIBCOQPP_cjs.cn("invisible", defaultClassNames.hidden),
|
|
604
956
|
...classNames
|
|
605
957
|
},
|
|
606
958
|
components: {
|
|
@@ -610,25 +962,25 @@ function Calendar({
|
|
|
610
962
|
{
|
|
611
963
|
"data-slot": "calendar",
|
|
612
964
|
ref: rootRef,
|
|
613
|
-
className:
|
|
965
|
+
className: chunkWIBCOQPP_cjs.cn(className2),
|
|
614
966
|
...props2
|
|
615
967
|
}
|
|
616
968
|
);
|
|
617
969
|
},
|
|
618
970
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
619
971
|
if (orientation === "left") {
|
|
620
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className:
|
|
972
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: chunkWIBCOQPP_cjs.cn("size-4", className2), ...props2 });
|
|
621
973
|
}
|
|
622
974
|
if (orientation === "right") {
|
|
623
975
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
624
976
|
lucideReact.ChevronRightIcon,
|
|
625
977
|
{
|
|
626
|
-
className:
|
|
978
|
+
className: chunkWIBCOQPP_cjs.cn("size-4", className2),
|
|
627
979
|
...props2
|
|
628
980
|
}
|
|
629
981
|
);
|
|
630
982
|
}
|
|
631
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className:
|
|
983
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: chunkWIBCOQPP_cjs.cn("size-4", className2), ...props2 });
|
|
632
984
|
},
|
|
633
985
|
DayButton: CalendarDayButton,
|
|
634
986
|
WeekNumber: ({ children, ...props2 }) => {
|
|
@@ -647,8 +999,8 @@ function CalendarDayButton({
|
|
|
647
999
|
...props
|
|
648
1000
|
}) {
|
|
649
1001
|
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
650
|
-
const ref =
|
|
651
|
-
|
|
1002
|
+
const ref = React6__namespace.useRef(null);
|
|
1003
|
+
React6__namespace.useEffect(() => {
|
|
652
1004
|
if (modifiers.focused) ref.current?.focus();
|
|
653
1005
|
}, [modifiers.focused]);
|
|
654
1006
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -662,7 +1014,7 @@ function CalendarDayButton({
|
|
|
662
1014
|
"data-range-start": modifiers.range_start,
|
|
663
1015
|
"data-range-end": modifiers.range_end,
|
|
664
1016
|
"data-range-middle": modifiers.range_middle,
|
|
665
|
-
className:
|
|
1017
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
666
1018
|
"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",
|
|
667
1019
|
defaultClassNames.day,
|
|
668
1020
|
className
|
|
@@ -671,165 +1023,295 @@ function CalendarDayButton({
|
|
|
671
1023
|
}
|
|
672
1024
|
);
|
|
673
1025
|
}
|
|
674
|
-
function
|
|
1026
|
+
function Collapsible({
|
|
675
1027
|
...props
|
|
676
1028
|
}) {
|
|
677
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Root, { "data-slot": "collapsible", ...props });
|
|
678
1030
|
}
|
|
679
|
-
function
|
|
1031
|
+
function CollapsibleTrigger2({
|
|
680
1032
|
...props
|
|
681
1033
|
}) {
|
|
682
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
|
+
CollapsiblePrimitive__namespace.CollapsibleTrigger,
|
|
1036
|
+
{
|
|
1037
|
+
"data-slot": "collapsible-trigger",
|
|
1038
|
+
...props
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
683
1041
|
}
|
|
684
|
-
function
|
|
1042
|
+
function CollapsibleContent2({
|
|
1043
|
+
...props
|
|
1044
|
+
}) {
|
|
1045
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
CollapsiblePrimitive__namespace.CollapsibleContent,
|
|
1047
|
+
{
|
|
1048
|
+
"data-slot": "collapsible-content",
|
|
1049
|
+
...props
|
|
1050
|
+
}
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
function ScrollArea({
|
|
685
1054
|
className,
|
|
686
|
-
|
|
687
|
-
sideOffset = 4,
|
|
1055
|
+
children,
|
|
688
1056
|
...props
|
|
689
1057
|
}) {
|
|
690
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
691
|
-
|
|
1058
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1059
|
+
ScrollAreaPrimitive__namespace.Root,
|
|
692
1060
|
{
|
|
693
|
-
"data-slot": "
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
1061
|
+
"data-slot": "scroll-area",
|
|
1062
|
+
className: chunkWIBCOQPP_cjs.cn("relative", className),
|
|
1063
|
+
...props,
|
|
1064
|
+
children: [
|
|
1065
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1066
|
+
ScrollAreaPrimitive__namespace.Viewport,
|
|
1067
|
+
{
|
|
1068
|
+
"data-slot": "scroll-area-viewport",
|
|
1069
|
+
className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
|
|
1070
|
+
children
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, {}),
|
|
1074
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
|
|
1075
|
+
]
|
|
1076
|
+
}
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
function ScrollBar({
|
|
1080
|
+
className,
|
|
1081
|
+
orientation = "vertical",
|
|
1082
|
+
...props
|
|
1083
|
+
}) {
|
|
1084
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1085
|
+
ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
|
|
1086
|
+
{
|
|
1087
|
+
"data-slot": "scroll-area-scrollbar",
|
|
1088
|
+
orientation,
|
|
1089
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
1090
|
+
"flex touch-none p-px transition-colors select-none",
|
|
1091
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
|
|
1092
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
|
|
698
1093
|
className
|
|
699
1094
|
),
|
|
700
|
-
...props
|
|
1095
|
+
...props,
|
|
1096
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1097
|
+
ScrollAreaPrimitive__namespace.ScrollAreaThumb,
|
|
1098
|
+
{
|
|
1099
|
+
"data-slot": "scroll-area-thumb",
|
|
1100
|
+
className: "bg-border relative flex-1 rounded-full"
|
|
1101
|
+
}
|
|
1102
|
+
)
|
|
701
1103
|
}
|
|
702
|
-
)
|
|
1104
|
+
);
|
|
703
1105
|
}
|
|
704
1106
|
var SmartDatePicker = ({
|
|
705
1107
|
field,
|
|
706
1108
|
label,
|
|
707
|
-
className
|
|
708
|
-
|
|
709
|
-
validation,
|
|
710
|
-
required = false,
|
|
711
|
-
allowPast = true,
|
|
712
|
-
allowFuture = true,
|
|
713
|
-
valueAsString = true,
|
|
714
|
-
minDate,
|
|
715
|
-
maxDate,
|
|
716
|
-
defaultValue,
|
|
717
|
-
info,
|
|
718
|
-
subLabel,
|
|
719
|
-
disabled,
|
|
720
|
-
hidden
|
|
1109
|
+
className,
|
|
1110
|
+
...props
|
|
721
1111
|
}) => {
|
|
722
|
-
const
|
|
723
|
-
const
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
-
const
|
|
727
|
-
const
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
if (validation && !hasRegistered.current) {
|
|
739
|
-
hasRegistered.current = true;
|
|
740
|
-
registerValidation(field, validation);
|
|
741
|
-
}
|
|
742
|
-
}, [validation, field, registerValidation]);
|
|
743
|
-
React4.useEffect(() => {
|
|
744
|
-
if (fieldDetection?.registerField) {
|
|
745
|
-
fieldDetection.registerField(field);
|
|
746
|
-
}
|
|
747
|
-
}, [field, fieldDetection]);
|
|
748
|
-
React4.useEffect(() => {
|
|
749
|
-
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
750
|
-
onChange(defaultValue);
|
|
751
|
-
hasSetDefault.current = true;
|
|
1112
|
+
const today = /* @__PURE__ */ new Date();
|
|
1113
|
+
const [month, setMonth] = React6.useState(today);
|
|
1114
|
+
const [date, setDate] = React6.useState(today);
|
|
1115
|
+
const [isYearView, setIsYearView] = React6.useState(false);
|
|
1116
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
1117
|
+
const startDate = new Date(1980, 6);
|
|
1118
|
+
const endDate = new Date(2030, 6);
|
|
1119
|
+
const years = dateFns.eachYearOfInterval({
|
|
1120
|
+
start: dateFns.startOfYear(startDate),
|
|
1121
|
+
end: dateFns.endOfYear(endDate)
|
|
1122
|
+
});
|
|
1123
|
+
const handleDateSelect = (selectedDate) => {
|
|
1124
|
+
setDate(selectedDate);
|
|
1125
|
+
if (selectedDate) {
|
|
1126
|
+
setIsOpen(false);
|
|
1127
|
+
setIsYearView(false);
|
|
752
1128
|
}
|
|
753
|
-
}, [defaultValue, value, onChange]);
|
|
754
|
-
const today = React4.useMemo(() => /* @__PURE__ */ new Date(), []);
|
|
755
|
-
const disabledMatcher = (date) => {
|
|
756
|
-
if (!allowPast) {
|
|
757
|
-
const startOfToday = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
758
|
-
if (date < startOfToday) return true;
|
|
759
|
-
}
|
|
760
|
-
if (!allowFuture) {
|
|
761
|
-
const startOfTomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
|
|
762
|
-
if (date >= startOfTomorrow) return true;
|
|
763
|
-
}
|
|
764
|
-
if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
765
|
-
if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
766
|
-
return false;
|
|
767
|
-
};
|
|
768
|
-
const handleSelect = (selected) => {
|
|
769
|
-
if (!selected) {
|
|
770
|
-
onChange(void 0);
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
if (valueAsString) {
|
|
774
|
-
const iso = dateFns.format(selected, "yyyy-MM-dd");
|
|
775
|
-
onChange(iso);
|
|
776
|
-
} else {
|
|
777
|
-
onChange(selected);
|
|
778
|
-
}
|
|
779
|
-
setOpen(false);
|
|
780
1129
|
};
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
1130
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[280px]", children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
1131
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
|
+
chunkWIBCOQPP_cjs.SmartInput,
|
|
1133
|
+
{
|
|
1134
|
+
field,
|
|
1135
|
+
label,
|
|
1136
|
+
syncValue: date,
|
|
1137
|
+
type: "date",
|
|
1138
|
+
className: `${className ?? ""} cursor-pointer`,
|
|
1139
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "size-4" }),
|
|
1140
|
+
iconPosition: "right",
|
|
1141
|
+
...props
|
|
1142
|
+
}
|
|
1143
|
+
) }) }),
|
|
1144
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1145
|
+
Calendar,
|
|
1146
|
+
{
|
|
1147
|
+
mode: "single",
|
|
1148
|
+
selected: date,
|
|
1149
|
+
onSelect: handleDateSelect,
|
|
1150
|
+
month,
|
|
1151
|
+
onMonthChange: setMonth,
|
|
1152
|
+
defaultMonth: /* @__PURE__ */ new Date(),
|
|
1153
|
+
startMonth: startDate,
|
|
1154
|
+
endMonth: endDate,
|
|
1155
|
+
className: "overflow-hidden rounded-md p-2",
|
|
1156
|
+
classNames: {
|
|
1157
|
+
month_caption: "ml-2.5 mr-20 justify-start",
|
|
1158
|
+
nav: "flex absolute w-fit right-0 items-center"
|
|
1159
|
+
},
|
|
1160
|
+
components: {
|
|
1161
|
+
CaptionLabel: (props2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1162
|
+
CaptionLabel,
|
|
1163
|
+
{
|
|
1164
|
+
isYearView,
|
|
1165
|
+
setIsYearView,
|
|
1166
|
+
...props2
|
|
1167
|
+
}
|
|
810
1168
|
),
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
1169
|
+
MonthGrid: (props2) => {
|
|
1170
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1171
|
+
MonthGrid,
|
|
1172
|
+
{
|
|
1173
|
+
className: props2.className,
|
|
1174
|
+
isYearView,
|
|
1175
|
+
setIsYearView,
|
|
1176
|
+
startDate,
|
|
1177
|
+
endDate,
|
|
1178
|
+
years,
|
|
1179
|
+
currentYear: month.getFullYear(),
|
|
1180
|
+
currentMonth: month.getMonth(),
|
|
1181
|
+
onMonthSelect: (selectedMonth) => {
|
|
1182
|
+
setMonth(selectedMonth);
|
|
1183
|
+
setIsYearView(false);
|
|
1184
|
+
},
|
|
1185
|
+
children: props2.children
|
|
1186
|
+
}
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
817
1189
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1190
|
+
}
|
|
1191
|
+
) })
|
|
1192
|
+
] }) });
|
|
1193
|
+
};
|
|
1194
|
+
function MonthGrid({
|
|
1195
|
+
className,
|
|
1196
|
+
children,
|
|
1197
|
+
isYearView,
|
|
1198
|
+
startDate,
|
|
1199
|
+
endDate,
|
|
1200
|
+
years,
|
|
1201
|
+
currentYear,
|
|
1202
|
+
currentMonth,
|
|
1203
|
+
onMonthSelect
|
|
1204
|
+
}) {
|
|
1205
|
+
const currentYearRef = React6.useRef(null);
|
|
1206
|
+
const currentMonthButtonRef = React6.useRef(null);
|
|
1207
|
+
const scrollAreaRef = React6.useRef(null);
|
|
1208
|
+
React6.useEffect(() => {
|
|
1209
|
+
if (isYearView && currentYearRef.current && scrollAreaRef.current) {
|
|
1210
|
+
const viewport = scrollAreaRef.current.querySelector(
|
|
1211
|
+
"[data-radix-scroll-area-viewport]"
|
|
1212
|
+
);
|
|
1213
|
+
if (viewport) {
|
|
1214
|
+
const yearTop = currentYearRef.current.offsetTop;
|
|
1215
|
+
viewport.scrollTop = yearTop;
|
|
1216
|
+
}
|
|
1217
|
+
setTimeout(() => {
|
|
1218
|
+
currentMonthButtonRef.current?.focus();
|
|
1219
|
+
}, 100);
|
|
1220
|
+
}
|
|
1221
|
+
}, [isYearView]);
|
|
1222
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
1223
|
+
/* @__PURE__ */ jsxRuntime.jsx("table", { className, children }),
|
|
1224
|
+
isYearView && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background absolute inset-0 z-20 -mx-2 -mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { ref: scrollAreaRef, className: "h-full", children: years.map((year) => {
|
|
1225
|
+
const months = dateFns.eachMonthOfInterval({
|
|
1226
|
+
start: dateFns.startOfYear(year),
|
|
1227
|
+
end: dateFns.endOfYear(year)
|
|
1228
|
+
});
|
|
1229
|
+
const isCurrentYear = year.getFullYear() === currentYear;
|
|
1230
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1231
|
+
"div",
|
|
821
1232
|
{
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
1233
|
+
ref: isCurrentYear ? currentYearRef : void 0,
|
|
1234
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1235
|
+
CollapsibleYear,
|
|
1236
|
+
{
|
|
1237
|
+
title: year.getFullYear().toString(),
|
|
1238
|
+
open: isCurrentYear,
|
|
1239
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-2", children: months.map((month) => {
|
|
1240
|
+
const isDisabled = dateFns.isBefore(month, startDate) || dateFns.isAfter(month, endDate);
|
|
1241
|
+
const isCurrentMonth = month.getMonth() === currentMonth && year.getFullYear() === currentYear;
|
|
1242
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1243
|
+
"button",
|
|
1244
|
+
{
|
|
1245
|
+
ref: isCurrentMonth ? currentMonthButtonRef : void 0,
|
|
1246
|
+
className: `inline-flex h-7 items-center justify-center rounded-md px-3 text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 ${isCurrentMonth ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground"}`,
|
|
1247
|
+
disabled: isDisabled,
|
|
1248
|
+
onClick: () => onMonthSelect(month),
|
|
1249
|
+
children: dateFns.format(month, "MMM")
|
|
1250
|
+
},
|
|
1251
|
+
month.getTime()
|
|
1252
|
+
);
|
|
1253
|
+
}) })
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
},
|
|
1257
|
+
year.getFullYear()
|
|
1258
|
+
);
|
|
1259
|
+
}) }) })
|
|
831
1260
|
] });
|
|
832
|
-
}
|
|
1261
|
+
}
|
|
1262
|
+
function CaptionLabel({
|
|
1263
|
+
children,
|
|
1264
|
+
isYearView,
|
|
1265
|
+
setIsYearView
|
|
1266
|
+
}) {
|
|
1267
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1268
|
+
Button,
|
|
1269
|
+
{
|
|
1270
|
+
className: "data-[state=open]:text-muted-foreground/80 -ms-2 flex items-center gap-2 text-sm font-medium hover:bg-transparent [&[data-state=open]>svg]:rotate-180",
|
|
1271
|
+
variant: "ghost",
|
|
1272
|
+
size: "sm",
|
|
1273
|
+
onClick: () => setIsYearView((prev) => !prev),
|
|
1274
|
+
"data-state": isYearView ? "open" : "closed",
|
|
1275
|
+
children: [
|
|
1276
|
+
children,
|
|
1277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1278
|
+
lucideReact.ChevronDownIcon,
|
|
1279
|
+
{
|
|
1280
|
+
className: "text-muted-foreground/80 shrink-0 transition-transform duration-200",
|
|
1281
|
+
"aria-hidden": "true"
|
|
1282
|
+
}
|
|
1283
|
+
)
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
function CollapsibleYear({
|
|
1289
|
+
title,
|
|
1290
|
+
children,
|
|
1291
|
+
open
|
|
1292
|
+
}) {
|
|
1293
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { className: "border-t px-2 py-1.5", defaultOpen: open, children: [
|
|
1294
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1295
|
+
Button,
|
|
1296
|
+
{
|
|
1297
|
+
className: "flex w-full justify-start gap-2 text-sm font-medium hover:bg-transparent [&[data-state=open]>svg]:rotate-180",
|
|
1298
|
+
variant: "ghost",
|
|
1299
|
+
size: "sm",
|
|
1300
|
+
children: [
|
|
1301
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1302
|
+
lucideReact.ChevronDownIcon,
|
|
1303
|
+
{
|
|
1304
|
+
className: "text-muted-foreground/80 shrink-0 transition-transform duration-200",
|
|
1305
|
+
"aria-hidden": "true"
|
|
1306
|
+
}
|
|
1307
|
+
),
|
|
1308
|
+
title
|
|
1309
|
+
]
|
|
1310
|
+
}
|
|
1311
|
+
) }),
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { className: "data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down overflow-hidden px-3 py-1 text-sm transition-all", children })
|
|
1313
|
+
] });
|
|
1314
|
+
}
|
|
833
1315
|
var SmartTags = ({
|
|
834
1316
|
field,
|
|
835
1317
|
label,
|
|
@@ -849,36 +1331,36 @@ var SmartTags = ({
|
|
|
849
1331
|
info,
|
|
850
1332
|
subLabel
|
|
851
1333
|
}) => {
|
|
852
|
-
const { formData } =
|
|
853
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
854
|
-
const fieldDetection =
|
|
855
|
-
const hasRegistered =
|
|
856
|
-
const hasSetDefault =
|
|
1334
|
+
const { formData } = chunkWIBCOQPP_cjs.useSmartForm();
|
|
1335
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkWIBCOQPP_cjs.useFormField(field);
|
|
1336
|
+
const fieldDetection = chunkWIBCOQPP_cjs.useFieldDetection();
|
|
1337
|
+
const hasRegistered = React6.useRef(false);
|
|
1338
|
+
const hasSetDefault = React6.useRef(false);
|
|
857
1339
|
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
858
1340
|
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
859
1341
|
if (isHidden) return null;
|
|
860
|
-
const [tags, setTags] =
|
|
861
|
-
const [inputValue, setInputValue] =
|
|
862
|
-
const inputRef =
|
|
863
|
-
|
|
1342
|
+
const [tags, setTags] = React6.useState([]);
|
|
1343
|
+
const [inputValue, setInputValue] = React6.useState("");
|
|
1344
|
+
const inputRef = React6.useRef(null);
|
|
1345
|
+
React6.useEffect(() => {
|
|
864
1346
|
if (validation && !hasRegistered.current) {
|
|
865
1347
|
hasRegistered.current = true;
|
|
866
1348
|
registerValidation(field, validation);
|
|
867
1349
|
}
|
|
868
1350
|
}, [validation, field, registerValidation]);
|
|
869
|
-
|
|
1351
|
+
React6.useEffect(() => {
|
|
870
1352
|
if (fieldDetection?.registerField) {
|
|
871
1353
|
fieldDetection.registerField(field);
|
|
872
1354
|
}
|
|
873
1355
|
}, [field, fieldDetection]);
|
|
874
|
-
|
|
1356
|
+
React6.useEffect(() => {
|
|
875
1357
|
if (defaultValue !== void 0 && !hasSetDefault.current && (!value || Array.isArray(value) && value.length === 0)) {
|
|
876
1358
|
setTags(defaultValue);
|
|
877
1359
|
onChange(defaultValue);
|
|
878
1360
|
hasSetDefault.current = true;
|
|
879
1361
|
}
|
|
880
1362
|
}, [defaultValue, value, onChange]);
|
|
881
|
-
|
|
1363
|
+
React6.useEffect(() => {
|
|
882
1364
|
if (Array.isArray(value)) {
|
|
883
1365
|
setTags(value);
|
|
884
1366
|
}
|
|
@@ -923,7 +1405,7 @@ var SmartTags = ({
|
|
|
923
1405
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
924
1406
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
925
1407
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
926
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1408
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
927
1409
|
label,
|
|
928
1410
|
" ",
|
|
929
1411
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" }),
|
|
@@ -935,9 +1417,9 @@ var SmartTags = ({
|
|
|
935
1417
|
")"
|
|
936
1418
|
] })
|
|
937
1419
|
] }),
|
|
938
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
939
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
940
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1420
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Tooltip, { children: [
|
|
1421
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
1422
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkWIBCOQPP_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
941
1423
|
] }) })
|
|
942
1424
|
] }),
|
|
943
1425
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -946,7 +1428,7 @@ var SmartTags = ({
|
|
|
946
1428
|
"div",
|
|
947
1429
|
{
|
|
948
1430
|
ref: fieldRef,
|
|
949
|
-
className:
|
|
1431
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
950
1432
|
"min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
|
|
951
1433
|
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
952
1434
|
"flex flex-wrap items-center gap-2 cursor-text",
|
|
@@ -982,7 +1464,7 @@ var SmartTags = ({
|
|
|
982
1464
|
`${tagText}-${index}`
|
|
983
1465
|
)),
|
|
984
1466
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
985
|
-
|
|
1467
|
+
chunkWIBCOQPP_cjs.Input,
|
|
986
1468
|
{
|
|
987
1469
|
ref: inputRef,
|
|
988
1470
|
type: "text",
|
|
@@ -1002,14 +1484,22 @@ var SmartTags = ({
|
|
|
1002
1484
|
] });
|
|
1003
1485
|
};
|
|
1004
1486
|
|
|
1487
|
+
exports.Badge = Badge;
|
|
1005
1488
|
exports.Button = Button;
|
|
1489
|
+
exports.Command = Command;
|
|
1490
|
+
exports.CommandEmpty = CommandEmpty;
|
|
1491
|
+
exports.CommandGroup = CommandGroup;
|
|
1492
|
+
exports.CommandInput = CommandInput;
|
|
1493
|
+
exports.CommandItem = CommandItem;
|
|
1494
|
+
exports.CommandList = CommandList;
|
|
1006
1495
|
exports.Popover = Popover;
|
|
1007
1496
|
exports.PopoverContent = PopoverContent;
|
|
1008
1497
|
exports.PopoverTrigger = PopoverTrigger;
|
|
1009
1498
|
exports.SmartCheckbox = SmartCheckbox;
|
|
1499
|
+
exports.SmartCombobox = SmartCombobox;
|
|
1010
1500
|
exports.SmartDatePicker = SmartDatePicker;
|
|
1011
1501
|
exports.SmartRadioGroup = SmartRadioGroup;
|
|
1012
1502
|
exports.SmartSelect = SmartSelect;
|
|
1013
1503
|
exports.SmartTags = SmartTags;
|
|
1014
|
-
//# sourceMappingURL=chunk-
|
|
1015
|
-
//# sourceMappingURL=chunk-
|
|
1504
|
+
//# sourceMappingURL=chunk-VGP3HY5Y.cjs.map
|
|
1505
|
+
//# sourceMappingURL=chunk-VGP3HY5Y.cjs.map
|