@algodomain/smart-forms 0.1.2 → 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/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-DEpmTDF5.d.cts} +42 -18
- package/dist/{SmartTags-HmvmCJPT.d.ts → SmartTags-DEpmTDF5.d.ts} +42 -18
- package/dist/{chunk-KDPN4CHW.js → chunk-BNQNL7GF.js} +658 -145
- package/dist/chunk-BNQNL7GF.js.map +1 -0
- package/dist/{chunk-5LRBJEZW.js → chunk-RHECLW3K.js} +80 -7
- package/dist/chunk-RHECLW3K.js.map +1 -0
- package/dist/{chunk-CJ55WKPC.cjs → chunk-VGP3HY5Y.cjs} +758 -235
- package/dist/chunk-VGP3HY5Y.cjs.map +1 -0
- package/dist/{chunk-4H5U5IHH.cjs → chunk-WIBCOQPP.cjs} +80 -7
- package/dist/chunk-WIBCOQPP.cjs.map +1 -0
- package/dist/fields.cjs +212 -481
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.d.cts +14 -22
- package/dist/fields.d.ts +14 -22
- package/dist/fields.js +66 -338
- package/dist/fields.js.map +1 -1
- package/dist/index.cjs +42 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +17 -9
- 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 +4 -2
- 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,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
|
),
|
|
@@ -69,24 +74,30 @@ var SmartCheckbox = ({
|
|
|
69
74
|
required = false,
|
|
70
75
|
defaultValue,
|
|
71
76
|
info,
|
|
72
|
-
subLabel
|
|
77
|
+
subLabel,
|
|
78
|
+
disabled,
|
|
79
|
+
hidden
|
|
73
80
|
}) => {
|
|
74
|
-
const {
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
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);
|
|
86
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
87
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
88
|
+
if (isHidden) return null;
|
|
89
|
+
React6.useEffect(() => {
|
|
79
90
|
if (validation && !hasRegistered.current) {
|
|
80
91
|
hasRegistered.current = true;
|
|
81
92
|
registerValidation(field, validation);
|
|
82
93
|
}
|
|
83
94
|
}, [validation, field, registerValidation]);
|
|
84
|
-
|
|
95
|
+
React6.useEffect(() => {
|
|
85
96
|
if (fieldDetection?.registerField) {
|
|
86
97
|
fieldDetection.registerField(field);
|
|
87
98
|
}
|
|
88
99
|
}, [field, fieldDetection]);
|
|
89
|
-
|
|
100
|
+
React6.useEffect(() => {
|
|
90
101
|
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
91
102
|
onChange(defaultValue);
|
|
92
103
|
hasSetDefault.current = true;
|
|
@@ -104,18 +115,19 @@ var SmartCheckbox = ({
|
|
|
104
115
|
onCheckedChange: (checked) => onChange(!!checked),
|
|
105
116
|
className: error ? "border-destructive" : "",
|
|
106
117
|
"data-field": field,
|
|
107
|
-
id: `${field}-checkbox
|
|
118
|
+
id: `${field}-checkbox`,
|
|
119
|
+
disabled: isDisabled
|
|
108
120
|
}
|
|
109
121
|
),
|
|
110
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { htmlFor: `${field}-checkbox`, className: "text-sm font-normal cursor-pointer", children: [
|
|
111
123
|
label || field,
|
|
112
124
|
" ",
|
|
113
125
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
114
126
|
] })
|
|
115
127
|
] }),
|
|
116
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
/* @__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 }) })
|
|
119
131
|
] }) })
|
|
120
132
|
] }),
|
|
121
133
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground ml-6", children: subLabel })
|
|
@@ -131,7 +143,7 @@ function RadioGroup({
|
|
|
131
143
|
RadioGroupPrimitive__namespace.Root,
|
|
132
144
|
{
|
|
133
145
|
"data-slot": "radio-group",
|
|
134
|
-
className:
|
|
146
|
+
className: chunkWIBCOQPP_cjs.cn("grid gap-3", className),
|
|
135
147
|
...props
|
|
136
148
|
}
|
|
137
149
|
);
|
|
@@ -144,7 +156,7 @@ function RadioGroupItem({
|
|
|
144
156
|
RadioGroupPrimitive__namespace.Item,
|
|
145
157
|
{
|
|
146
158
|
"data-slot": "radio-group-item",
|
|
147
|
-
className:
|
|
159
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
148
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",
|
|
149
161
|
className
|
|
150
162
|
),
|
|
@@ -171,24 +183,30 @@ var SmartRadioGroup = ({
|
|
|
171
183
|
required = false,
|
|
172
184
|
defaultValue,
|
|
173
185
|
info,
|
|
174
|
-
subLabel
|
|
186
|
+
subLabel,
|
|
187
|
+
disabled,
|
|
188
|
+
hidden
|
|
175
189
|
}) => {
|
|
176
|
-
const {
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
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);
|
|
195
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
196
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
197
|
+
if (isHidden) return null;
|
|
198
|
+
React6.useEffect(() => {
|
|
181
199
|
if (validation && !hasRegistered.current) {
|
|
182
200
|
hasRegistered.current = true;
|
|
183
201
|
registerValidation(field, validation);
|
|
184
202
|
}
|
|
185
203
|
}, [validation, field, registerValidation]);
|
|
186
|
-
|
|
204
|
+
React6.useEffect(() => {
|
|
187
205
|
if (fieldDetection?.registerField) {
|
|
188
206
|
fieldDetection.registerField(field);
|
|
189
207
|
}
|
|
190
208
|
}, [field, fieldDetection]);
|
|
191
|
-
|
|
209
|
+
React6.useEffect(() => {
|
|
192
210
|
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
193
211
|
onChange(defaultValue);
|
|
194
212
|
hasSetDefault.current = true;
|
|
@@ -197,14 +215,14 @@ var SmartRadioGroup = ({
|
|
|
197
215
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
198
216
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
199
217
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
200
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
201
219
|
label,
|
|
202
220
|
" ",
|
|
203
221
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
204
222
|
] }),
|
|
205
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
207
|
-
/* @__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 }) })
|
|
208
226
|
] }) })
|
|
209
227
|
] }),
|
|
210
228
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -218,6 +236,7 @@ var SmartRadioGroup = ({
|
|
|
218
236
|
ref: fieldRef,
|
|
219
237
|
"data-field": field,
|
|
220
238
|
name: name || field,
|
|
239
|
+
disabled: isDisabled,
|
|
221
240
|
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
222
241
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
223
242
|
RadioGroupItem,
|
|
@@ -227,7 +246,7 @@ var SmartRadioGroup = ({
|
|
|
227
246
|
}
|
|
228
247
|
),
|
|
229
248
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
-
|
|
249
|
+
chunkWIBCOQPP_cjs.Label,
|
|
231
250
|
{
|
|
232
251
|
htmlFor: `${field}-${option.value}`,
|
|
233
252
|
className: "text-sm font-normal cursor-pointer",
|
|
@@ -261,7 +280,7 @@ function SelectTrigger({
|
|
|
261
280
|
{
|
|
262
281
|
"data-slot": "select-trigger",
|
|
263
282
|
"data-size": size,
|
|
264
|
-
className:
|
|
283
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
265
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",
|
|
266
285
|
className
|
|
267
286
|
),
|
|
@@ -283,7 +302,7 @@ function SelectContent({
|
|
|
283
302
|
SelectPrimitive__namespace.Content,
|
|
284
303
|
{
|
|
285
304
|
"data-slot": "select-content",
|
|
286
|
-
className:
|
|
305
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
287
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",
|
|
288
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",
|
|
289
308
|
className
|
|
@@ -295,7 +314,7 @@ function SelectContent({
|
|
|
295
314
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
296
315
|
SelectPrimitive__namespace.Viewport,
|
|
297
316
|
{
|
|
298
|
-
className:
|
|
317
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
299
318
|
"p-1",
|
|
300
319
|
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
301
320
|
),
|
|
@@ -316,7 +335,7 @@ function SelectItem({
|
|
|
316
335
|
SelectPrimitive__namespace.Item,
|
|
317
336
|
{
|
|
318
337
|
"data-slot": "select-item",
|
|
319
|
-
className:
|
|
338
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
320
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",
|
|
321
340
|
className
|
|
322
341
|
),
|
|
@@ -336,7 +355,7 @@ function SelectScrollUpButton({
|
|
|
336
355
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
337
356
|
{
|
|
338
357
|
"data-slot": "select-scroll-up-button",
|
|
339
|
-
className:
|
|
358
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
340
359
|
"flex cursor-default items-center justify-center py-1",
|
|
341
360
|
className
|
|
342
361
|
),
|
|
@@ -353,7 +372,7 @@ function SelectScrollDownButton({
|
|
|
353
372
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
354
373
|
{
|
|
355
374
|
"data-slot": "select-scroll-down-button",
|
|
356
|
-
className:
|
|
375
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
357
376
|
"flex cursor-default items-center justify-center py-1",
|
|
358
377
|
className
|
|
359
378
|
),
|
|
@@ -372,24 +391,30 @@ var SmartSelect = ({
|
|
|
372
391
|
required = false,
|
|
373
392
|
defaultValue,
|
|
374
393
|
info,
|
|
375
|
-
subLabel
|
|
394
|
+
subLabel,
|
|
395
|
+
disabled,
|
|
396
|
+
hidden
|
|
376
397
|
}) => {
|
|
377
|
-
const {
|
|
378
|
-
const
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
|
|
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);
|
|
403
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
404
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
405
|
+
if (isHidden) return null;
|
|
406
|
+
React6.useEffect(() => {
|
|
382
407
|
if (validation && !hasRegistered.current) {
|
|
383
408
|
hasRegistered.current = true;
|
|
384
409
|
registerValidation(field, validation);
|
|
385
410
|
}
|
|
386
411
|
}, [validation, field, registerValidation]);
|
|
387
|
-
|
|
412
|
+
React6.useEffect(() => {
|
|
388
413
|
if (fieldDetection?.registerField) {
|
|
389
414
|
fieldDetection.registerField(field);
|
|
390
415
|
}
|
|
391
416
|
}, [field, fieldDetection]);
|
|
392
|
-
|
|
417
|
+
React6.useEffect(() => {
|
|
393
418
|
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
394
419
|
onChange(defaultValue);
|
|
395
420
|
hasSetDefault.current = true;
|
|
@@ -398,14 +423,14 @@ var SmartSelect = ({
|
|
|
398
423
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
399
424
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
400
425
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
401
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
402
427
|
label,
|
|
403
428
|
" ",
|
|
404
429
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
405
430
|
] }),
|
|
406
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
407
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
408
|
-
/* @__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 }) })
|
|
409
434
|
] }) })
|
|
410
435
|
] }),
|
|
411
436
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -422,6 +447,7 @@ var SmartSelect = ({
|
|
|
422
447
|
ref: fieldRef,
|
|
423
448
|
className: `w-full ${error ? "border-destructive" : ""} ${className}`,
|
|
424
449
|
"data-field": field,
|
|
450
|
+
disabled: isDisabled,
|
|
425
451
|
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: placeholder || `Select ${label || field}` })
|
|
426
452
|
}
|
|
427
453
|
),
|
|
@@ -432,6 +458,36 @@ var SmartSelect = ({
|
|
|
432
458
|
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
|
|
433
459
|
] });
|
|
434
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
|
+
}
|
|
435
491
|
var buttonVariants = classVarianceAuthority.cva(
|
|
436
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",
|
|
437
493
|
{
|
|
@@ -469,11 +525,328 @@ function Button({
|
|
|
469
525
|
Comp,
|
|
470
526
|
{
|
|
471
527
|
"data-slot": "button",
|
|
472
|
-
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
|
+
),
|
|
615
|
+
...props
|
|
616
|
+
}
|
|
617
|
+
);
|
|
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
|
+
),
|
|
473
631
|
...props
|
|
474
632
|
}
|
|
475
633
|
);
|
|
476
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
|
+
};
|
|
477
850
|
function Calendar({
|
|
478
851
|
className,
|
|
479
852
|
classNames,
|
|
@@ -489,7 +862,7 @@ function Calendar({
|
|
|
489
862
|
reactDayPicker.DayPicker,
|
|
490
863
|
{
|
|
491
864
|
showOutsideDays,
|
|
492
|
-
className:
|
|
865
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
493
866
|
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
494
867
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
495
868
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
@@ -501,85 +874,85 @@ function Calendar({
|
|
|
501
874
|
...formatters
|
|
502
875
|
},
|
|
503
876
|
classNames: {
|
|
504
|
-
root:
|
|
505
|
-
months:
|
|
877
|
+
root: chunkWIBCOQPP_cjs.cn("w-fit", defaultClassNames.root),
|
|
878
|
+
months: chunkWIBCOQPP_cjs.cn(
|
|
506
879
|
"flex gap-4 flex-col md:flex-row relative",
|
|
507
880
|
defaultClassNames.months
|
|
508
881
|
),
|
|
509
|
-
month:
|
|
510
|
-
nav:
|
|
882
|
+
month: chunkWIBCOQPP_cjs.cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
883
|
+
nav: chunkWIBCOQPP_cjs.cn(
|
|
511
884
|
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
512
885
|
defaultClassNames.nav
|
|
513
886
|
),
|
|
514
|
-
button_previous:
|
|
887
|
+
button_previous: chunkWIBCOQPP_cjs.cn(
|
|
515
888
|
buttonVariants({ variant: buttonVariant }),
|
|
516
889
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
517
890
|
defaultClassNames.button_previous
|
|
518
891
|
),
|
|
519
|
-
button_next:
|
|
892
|
+
button_next: chunkWIBCOQPP_cjs.cn(
|
|
520
893
|
buttonVariants({ variant: buttonVariant }),
|
|
521
894
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
522
895
|
defaultClassNames.button_next
|
|
523
896
|
),
|
|
524
|
-
month_caption:
|
|
897
|
+
month_caption: chunkWIBCOQPP_cjs.cn(
|
|
525
898
|
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
526
899
|
defaultClassNames.month_caption
|
|
527
900
|
),
|
|
528
|
-
dropdowns:
|
|
901
|
+
dropdowns: chunkWIBCOQPP_cjs.cn(
|
|
529
902
|
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
530
903
|
defaultClassNames.dropdowns
|
|
531
904
|
),
|
|
532
|
-
dropdown_root:
|
|
905
|
+
dropdown_root: chunkWIBCOQPP_cjs.cn(
|
|
533
906
|
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
534
907
|
defaultClassNames.dropdown_root
|
|
535
908
|
),
|
|
536
|
-
dropdown:
|
|
909
|
+
dropdown: chunkWIBCOQPP_cjs.cn(
|
|
537
910
|
"absolute bg-popover inset-0 opacity-0",
|
|
538
911
|
defaultClassNames.dropdown
|
|
539
912
|
),
|
|
540
|
-
caption_label:
|
|
913
|
+
caption_label: chunkWIBCOQPP_cjs.cn(
|
|
541
914
|
"select-none font-medium",
|
|
542
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",
|
|
543
916
|
defaultClassNames.caption_label
|
|
544
917
|
),
|
|
545
918
|
table: "w-full border-collapse",
|
|
546
|
-
weekdays:
|
|
547
|
-
weekday:
|
|
919
|
+
weekdays: chunkWIBCOQPP_cjs.cn("flex", defaultClassNames.weekdays),
|
|
920
|
+
weekday: chunkWIBCOQPP_cjs.cn(
|
|
548
921
|
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
549
922
|
defaultClassNames.weekday
|
|
550
923
|
),
|
|
551
|
-
week:
|
|
552
|
-
week_number_header:
|
|
924
|
+
week: chunkWIBCOQPP_cjs.cn("flex w-full mt-2", defaultClassNames.week),
|
|
925
|
+
week_number_header: chunkWIBCOQPP_cjs.cn(
|
|
553
926
|
"select-none w-(--cell-size)",
|
|
554
927
|
defaultClassNames.week_number_header
|
|
555
928
|
),
|
|
556
|
-
week_number:
|
|
929
|
+
week_number: chunkWIBCOQPP_cjs.cn(
|
|
557
930
|
"text-[0.8rem] select-none text-muted-foreground",
|
|
558
931
|
defaultClassNames.week_number
|
|
559
932
|
),
|
|
560
|
-
day:
|
|
933
|
+
day: chunkWIBCOQPP_cjs.cn(
|
|
561
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",
|
|
562
935
|
defaultClassNames.day
|
|
563
936
|
),
|
|
564
|
-
range_start:
|
|
937
|
+
range_start: chunkWIBCOQPP_cjs.cn(
|
|
565
938
|
"rounded-l-md bg-accent",
|
|
566
939
|
defaultClassNames.range_start
|
|
567
940
|
),
|
|
568
|
-
range_middle:
|
|
569
|
-
range_end:
|
|
570
|
-
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(
|
|
571
944
|
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
572
945
|
defaultClassNames.today
|
|
573
946
|
),
|
|
574
|
-
outside:
|
|
947
|
+
outside: chunkWIBCOQPP_cjs.cn(
|
|
575
948
|
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
576
949
|
defaultClassNames.outside
|
|
577
950
|
),
|
|
578
|
-
disabled:
|
|
951
|
+
disabled: chunkWIBCOQPP_cjs.cn(
|
|
579
952
|
"text-muted-foreground opacity-50",
|
|
580
953
|
defaultClassNames.disabled
|
|
581
954
|
),
|
|
582
|
-
hidden:
|
|
955
|
+
hidden: chunkWIBCOQPP_cjs.cn("invisible", defaultClassNames.hidden),
|
|
583
956
|
...classNames
|
|
584
957
|
},
|
|
585
958
|
components: {
|
|
@@ -589,25 +962,25 @@ function Calendar({
|
|
|
589
962
|
{
|
|
590
963
|
"data-slot": "calendar",
|
|
591
964
|
ref: rootRef,
|
|
592
|
-
className:
|
|
965
|
+
className: chunkWIBCOQPP_cjs.cn(className2),
|
|
593
966
|
...props2
|
|
594
967
|
}
|
|
595
968
|
);
|
|
596
969
|
},
|
|
597
970
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
598
971
|
if (orientation === "left") {
|
|
599
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className:
|
|
972
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: chunkWIBCOQPP_cjs.cn("size-4", className2), ...props2 });
|
|
600
973
|
}
|
|
601
974
|
if (orientation === "right") {
|
|
602
975
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
603
976
|
lucideReact.ChevronRightIcon,
|
|
604
977
|
{
|
|
605
|
-
className:
|
|
978
|
+
className: chunkWIBCOQPP_cjs.cn("size-4", className2),
|
|
606
979
|
...props2
|
|
607
980
|
}
|
|
608
981
|
);
|
|
609
982
|
}
|
|
610
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className:
|
|
983
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: chunkWIBCOQPP_cjs.cn("size-4", className2), ...props2 });
|
|
611
984
|
},
|
|
612
985
|
DayButton: CalendarDayButton,
|
|
613
986
|
WeekNumber: ({ children, ...props2 }) => {
|
|
@@ -626,8 +999,8 @@ function CalendarDayButton({
|
|
|
626
999
|
...props
|
|
627
1000
|
}) {
|
|
628
1001
|
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
629
|
-
const ref =
|
|
630
|
-
|
|
1002
|
+
const ref = React6__namespace.useRef(null);
|
|
1003
|
+
React6__namespace.useEffect(() => {
|
|
631
1004
|
if (modifiers.focused) ref.current?.focus();
|
|
632
1005
|
}, [modifiers.focused]);
|
|
633
1006
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -641,7 +1014,7 @@ function CalendarDayButton({
|
|
|
641
1014
|
"data-range-start": modifiers.range_start,
|
|
642
1015
|
"data-range-end": modifiers.range_end,
|
|
643
1016
|
"data-range-middle": modifiers.range_middle,
|
|
644
|
-
className:
|
|
1017
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
645
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",
|
|
646
1019
|
defaultClassNames.day,
|
|
647
1020
|
className
|
|
@@ -650,158 +1023,295 @@ function CalendarDayButton({
|
|
|
650
1023
|
}
|
|
651
1024
|
);
|
|
652
1025
|
}
|
|
653
|
-
function
|
|
1026
|
+
function Collapsible({
|
|
654
1027
|
...props
|
|
655
1028
|
}) {
|
|
656
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Root, { "data-slot": "collapsible", ...props });
|
|
657
1030
|
}
|
|
658
|
-
function
|
|
1031
|
+
function CollapsibleTrigger2({
|
|
659
1032
|
...props
|
|
660
1033
|
}) {
|
|
661
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
|
+
CollapsiblePrimitive__namespace.CollapsibleTrigger,
|
|
1036
|
+
{
|
|
1037
|
+
"data-slot": "collapsible-trigger",
|
|
1038
|
+
...props
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
662
1041
|
}
|
|
663
|
-
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({
|
|
664
1054
|
className,
|
|
665
|
-
|
|
666
|
-
sideOffset = 4,
|
|
1055
|
+
children,
|
|
667
1056
|
...props
|
|
668
1057
|
}) {
|
|
669
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
670
|
-
|
|
1058
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1059
|
+
ScrollAreaPrimitive__namespace.Root,
|
|
671
1060
|
{
|
|
672
|
-
"data-slot": "
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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",
|
|
677
1093
|
className
|
|
678
1094
|
),
|
|
679
|
-
...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
|
+
)
|
|
680
1103
|
}
|
|
681
|
-
)
|
|
1104
|
+
);
|
|
682
1105
|
}
|
|
683
1106
|
var SmartDatePicker = ({
|
|
684
1107
|
field,
|
|
685
1108
|
label,
|
|
686
|
-
className
|
|
687
|
-
|
|
688
|
-
validation,
|
|
689
|
-
required = false,
|
|
690
|
-
allowPast = true,
|
|
691
|
-
allowFuture = true,
|
|
692
|
-
valueAsString = true,
|
|
693
|
-
minDate,
|
|
694
|
-
maxDate,
|
|
695
|
-
defaultValue,
|
|
696
|
-
info,
|
|
697
|
-
subLabel
|
|
1109
|
+
className,
|
|
1110
|
+
...props
|
|
698
1111
|
}) => {
|
|
699
|
-
const
|
|
700
|
-
const
|
|
701
|
-
const
|
|
702
|
-
const
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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);
|
|
714
1128
|
}
|
|
715
|
-
}, [validation, field, registerValidation]);
|
|
716
|
-
React4.useEffect(() => {
|
|
717
|
-
if (fieldDetection?.registerField) {
|
|
718
|
-
fieldDetection.registerField(field);
|
|
719
|
-
}
|
|
720
|
-
}, [field, fieldDetection]);
|
|
721
|
-
React4.useEffect(() => {
|
|
722
|
-
if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
|
|
723
|
-
onChange(defaultValue);
|
|
724
|
-
hasSetDefault.current = true;
|
|
725
|
-
}
|
|
726
|
-
}, [defaultValue, value, onChange]);
|
|
727
|
-
const today = React4.useMemo(() => /* @__PURE__ */ new Date(), []);
|
|
728
|
-
const disabledMatcher = (date) => {
|
|
729
|
-
if (!allowPast) {
|
|
730
|
-
const startOfToday = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
731
|
-
if (date < startOfToday) return true;
|
|
732
|
-
}
|
|
733
|
-
if (!allowFuture) {
|
|
734
|
-
const startOfTomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
|
|
735
|
-
if (date >= startOfTomorrow) return true;
|
|
736
|
-
}
|
|
737
|
-
if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
738
|
-
if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
739
|
-
return false;
|
|
740
1129
|
};
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
className: chunk4H5U5IHH_cjs.cn(
|
|
780
|
-
"w-full justify-start text-left font-normal",
|
|
781
|
-
!parsedValue && "text-muted-foreground",
|
|
782
|
-
error && "border-destructive"
|
|
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
|
+
}
|
|
783
1168
|
),
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
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
|
+
}
|
|
789
1189
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
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",
|
|
793
1232
|
{
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
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
|
+
}) }) })
|
|
803
1260
|
] });
|
|
804
|
-
}
|
|
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
|
+
}
|
|
805
1315
|
var SmartTags = ({
|
|
806
1316
|
field,
|
|
807
1317
|
label,
|
|
@@ -815,37 +1325,42 @@ var SmartTags = ({
|
|
|
815
1325
|
minLength,
|
|
816
1326
|
allowDuplicates = false,
|
|
817
1327
|
disabled = false,
|
|
1328
|
+
hidden = false,
|
|
818
1329
|
onTagAdd,
|
|
819
1330
|
onTagRemove,
|
|
820
1331
|
info,
|
|
821
1332
|
subLabel
|
|
822
1333
|
}) => {
|
|
823
|
-
const {
|
|
824
|
-
const
|
|
825
|
-
const
|
|
826
|
-
const
|
|
827
|
-
const
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
|
|
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);
|
|
1339
|
+
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
1340
|
+
const isHidden = typeof hidden === "function" ? hidden(formData) : hidden || false;
|
|
1341
|
+
if (isHidden) return null;
|
|
1342
|
+
const [tags, setTags] = React6.useState([]);
|
|
1343
|
+
const [inputValue, setInputValue] = React6.useState("");
|
|
1344
|
+
const inputRef = React6.useRef(null);
|
|
1345
|
+
React6.useEffect(() => {
|
|
831
1346
|
if (validation && !hasRegistered.current) {
|
|
832
1347
|
hasRegistered.current = true;
|
|
833
1348
|
registerValidation(field, validation);
|
|
834
1349
|
}
|
|
835
1350
|
}, [validation, field, registerValidation]);
|
|
836
|
-
|
|
1351
|
+
React6.useEffect(() => {
|
|
837
1352
|
if (fieldDetection?.registerField) {
|
|
838
1353
|
fieldDetection.registerField(field);
|
|
839
1354
|
}
|
|
840
1355
|
}, [field, fieldDetection]);
|
|
841
|
-
|
|
1356
|
+
React6.useEffect(() => {
|
|
842
1357
|
if (defaultValue !== void 0 && !hasSetDefault.current && (!value || Array.isArray(value) && value.length === 0)) {
|
|
843
1358
|
setTags(defaultValue);
|
|
844
1359
|
onChange(defaultValue);
|
|
845
1360
|
hasSetDefault.current = true;
|
|
846
1361
|
}
|
|
847
1362
|
}, [defaultValue, value, onChange]);
|
|
848
|
-
|
|
1363
|
+
React6.useEffect(() => {
|
|
849
1364
|
if (Array.isArray(value)) {
|
|
850
1365
|
setTags(value);
|
|
851
1366
|
}
|
|
@@ -890,7 +1405,7 @@ var SmartTags = ({
|
|
|
890
1405
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
891
1406
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
892
1407
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
893
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1408
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkWIBCOQPP_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
894
1409
|
label,
|
|
895
1410
|
" ",
|
|
896
1411
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" }),
|
|
@@ -902,9 +1417,9 @@ var SmartTags = ({
|
|
|
902
1417
|
")"
|
|
903
1418
|
] })
|
|
904
1419
|
] }),
|
|
905
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
906
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
907
|
-
/* @__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 }) })
|
|
908
1423
|
] }) })
|
|
909
1424
|
] }),
|
|
910
1425
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -913,12 +1428,12 @@ var SmartTags = ({
|
|
|
913
1428
|
"div",
|
|
914
1429
|
{
|
|
915
1430
|
ref: fieldRef,
|
|
916
|
-
className:
|
|
1431
|
+
className: chunkWIBCOQPP_cjs.cn(
|
|
917
1432
|
"min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
|
|
918
1433
|
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
919
1434
|
"flex flex-wrap items-center gap-2 cursor-text",
|
|
920
1435
|
error && "border-destructive focus-within:ring-destructive",
|
|
921
|
-
|
|
1436
|
+
isDisabled && "cursor-not-allowed opacity-50"
|
|
922
1437
|
),
|
|
923
1438
|
"data-field": field,
|
|
924
1439
|
onClick: () => inputRef.current?.focus(),
|
|
@@ -940,7 +1455,7 @@ var SmartTags = ({
|
|
|
940
1455
|
e.stopPropagation();
|
|
941
1456
|
removeTag(tagText);
|
|
942
1457
|
},
|
|
943
|
-
disabled,
|
|
1458
|
+
disabled: isDisabled,
|
|
944
1459
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
|
|
945
1460
|
}
|
|
946
1461
|
)
|
|
@@ -949,7 +1464,7 @@ var SmartTags = ({
|
|
|
949
1464
|
`${tagText}-${index}`
|
|
950
1465
|
)),
|
|
951
1466
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
952
|
-
|
|
1467
|
+
chunkWIBCOQPP_cjs.Input,
|
|
953
1468
|
{
|
|
954
1469
|
ref: inputRef,
|
|
955
1470
|
type: "text",
|
|
@@ -958,7 +1473,7 @@ var SmartTags = ({
|
|
|
958
1473
|
onKeyDown: handleKeyDown,
|
|
959
1474
|
placeholder: tags.length === 0 ? placeholder : "",
|
|
960
1475
|
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,
|
|
1476
|
+
disabled: isDisabled,
|
|
962
1477
|
maxLength
|
|
963
1478
|
}
|
|
964
1479
|
)
|
|
@@ -969,14 +1484,22 @@ var SmartTags = ({
|
|
|
969
1484
|
] });
|
|
970
1485
|
};
|
|
971
1486
|
|
|
1487
|
+
exports.Badge = Badge;
|
|
972
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;
|
|
973
1495
|
exports.Popover = Popover;
|
|
974
1496
|
exports.PopoverContent = PopoverContent;
|
|
975
1497
|
exports.PopoverTrigger = PopoverTrigger;
|
|
976
1498
|
exports.SmartCheckbox = SmartCheckbox;
|
|
1499
|
+
exports.SmartCombobox = SmartCombobox;
|
|
977
1500
|
exports.SmartDatePicker = SmartDatePicker;
|
|
978
1501
|
exports.SmartRadioGroup = SmartRadioGroup;
|
|
979
1502
|
exports.SmartSelect = SmartSelect;
|
|
980
1503
|
exports.SmartTags = SmartTags;
|
|
981
|
-
//# sourceMappingURL=chunk-
|
|
982
|
-
//# sourceMappingURL=chunk-
|
|
1504
|
+
//# sourceMappingURL=chunk-VGP3HY5Y.cjs.map
|
|
1505
|
+
//# sourceMappingURL=chunk-VGP3HY5Y.cjs.map
|