@algodomain/smart-forms 0.1.6 → 0.1.8
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/{chunk-X75PSJXO.cjs → chunk-I5HYLSDJ.cjs} +93 -93
- package/dist/chunk-I5HYLSDJ.cjs.map +1 -0
- package/dist/{chunk-VDV7A7YZ.js → chunk-ONWU4O23.js} +5 -5
- package/dist/chunk-ONWU4O23.js.map +1 -0
- package/dist/{chunk-RHECLW3K.js → chunk-S4UZYPMB.js} +9 -3
- package/dist/chunk-S4UZYPMB.js.map +1 -0
- package/dist/{chunk-WIBCOQPP.cjs → chunk-VOLW7NZ4.cjs} +9 -2
- package/dist/chunk-VOLW7NZ4.cjs.map +1 -0
- package/dist/fields.cjs +101 -101
- package/dist/fields.js +4 -4
- package/dist/index.cjs +8934 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8818 -67
- package/dist/index.js.map +1 -1
- package/dist/opinionated.cjs +18 -18
- package/dist/opinionated.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-RHECLW3K.js.map +0 -1
- package/dist/chunk-VDV7A7YZ.js.map +0 -1
- package/dist/chunk-WIBCOQPP.cjs.map +0 -1
- package/dist/chunk-X75PSJXO.cjs.map +0 -1
package/dist/fields.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkI5HYLSDJ_cjs = require('./chunk-I5HYLSDJ.cjs');
|
|
4
|
+
var chunkVOLW7NZ4_cjs = require('./chunk-VOLW7NZ4.cjs');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -48,9 +48,9 @@ var SmartFileUpload = ({
|
|
|
48
48
|
disabled,
|
|
49
49
|
hidden
|
|
50
50
|
}) => {
|
|
51
|
-
const { formData, registerSubmitHook, unregisterSubmitHook } =
|
|
52
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
53
|
-
const fieldDetection =
|
|
51
|
+
const { formData, registerSubmitHook, unregisterSubmitHook } = chunkVOLW7NZ4_cjs.useSmartForm();
|
|
52
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkVOLW7NZ4_cjs.useFormField(field);
|
|
53
|
+
const fieldDetection = chunkVOLW7NZ4_cjs.useFieldDetection();
|
|
54
54
|
const hasRegistered = React2.useRef(false);
|
|
55
55
|
const hasSetDefault = React2.useRef(false);
|
|
56
56
|
const inputRef = React2.useRef(null);
|
|
@@ -186,24 +186,24 @@ var SmartFileUpload = ({
|
|
|
186
186
|
}
|
|
187
187
|
return () => unregisterSubmitHook(key);
|
|
188
188
|
}, [field, uploadApi, uploadOnSelect, registerSubmitHook, unregisterSubmitHook, value, multiple]);
|
|
189
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
189
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVOLW7NZ4_cjs.cn("flex-1 min-w-0", className), children: [
|
|
190
190
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
191
191
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
192
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
193
193
|
label,
|
|
194
194
|
" ",
|
|
195
195
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
196
196
|
] }),
|
|
197
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
198
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
199
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
199
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
200
200
|
] }) })
|
|
201
201
|
] }),
|
|
202
202
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
203
203
|
] }),
|
|
204
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVOLW7NZ4_cjs.cn("flex items-center gap-2", error && "text-destructive"), children: [
|
|
205
205
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
-
|
|
206
|
+
chunkVOLW7NZ4_cjs.Input,
|
|
207
207
|
{
|
|
208
208
|
ref: (el) => {
|
|
209
209
|
inputRef.current = el;
|
|
@@ -213,12 +213,12 @@ var SmartFileUpload = ({
|
|
|
213
213
|
accept,
|
|
214
214
|
multiple,
|
|
215
215
|
onChange: onInputChange,
|
|
216
|
-
className:
|
|
216
|
+
className: chunkVOLW7NZ4_cjs.cn(error && "border-destructive"),
|
|
217
217
|
"data-field": field,
|
|
218
218
|
disabled: isDisabled
|
|
219
219
|
}
|
|
220
220
|
),
|
|
221
|
-
(Array.isArray(value) ? value.length > 0 : !!value) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
221
|
+
(Array.isArray(value) ? value.length > 0 : !!value) && /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.Button, { type: "button", variant: "secondary", onClick: clearSelection, disabled: isDisabled, children: "Clear" })
|
|
222
222
|
] }),
|
|
223
223
|
normalizedFiles.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 text-sm text-muted-foreground", children: "No file selected" }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "mt-2 space-y-1", children: normalizedFiles.map((f, idx) => {
|
|
224
224
|
const isImage = f.type.startsWith("image/");
|
|
@@ -243,7 +243,7 @@ var SmartFileUpload = ({
|
|
|
243
243
|
] })
|
|
244
244
|
] }),
|
|
245
245
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
246
|
-
|
|
246
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
247
247
|
{
|
|
248
248
|
type: "button",
|
|
249
249
|
variant: "ghost",
|
|
@@ -279,7 +279,7 @@ function Slider({
|
|
|
279
279
|
value,
|
|
280
280
|
min,
|
|
281
281
|
max,
|
|
282
|
-
className:
|
|
282
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
283
283
|
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
284
284
|
className
|
|
285
285
|
),
|
|
@@ -289,14 +289,14 @@ function Slider({
|
|
|
289
289
|
SliderPrimitive__namespace.Track,
|
|
290
290
|
{
|
|
291
291
|
"data-slot": "slider-track",
|
|
292
|
-
className:
|
|
292
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
293
293
|
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
294
294
|
),
|
|
295
295
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
296
296
|
SliderPrimitive__namespace.Range,
|
|
297
297
|
{
|
|
298
298
|
"data-slot": "slider-range",
|
|
299
|
-
className:
|
|
299
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
300
300
|
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
301
301
|
)
|
|
302
302
|
}
|
|
@@ -332,9 +332,9 @@ var SmartSlider = ({
|
|
|
332
332
|
disabled,
|
|
333
333
|
hidden
|
|
334
334
|
}) => {
|
|
335
|
-
const { formData } =
|
|
336
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
337
|
-
const fieldDetection =
|
|
335
|
+
const { formData } = chunkVOLW7NZ4_cjs.useSmartForm();
|
|
336
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkVOLW7NZ4_cjs.useFormField(field);
|
|
337
|
+
const fieldDetection = chunkVOLW7NZ4_cjs.useFieldDetection();
|
|
338
338
|
const hasRegistered = React2.useRef(false);
|
|
339
339
|
const hasSetDefault = React2.useRef(false);
|
|
340
340
|
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
@@ -365,7 +365,7 @@ var SmartSlider = ({
|
|
|
365
365
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
366
366
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
367
367
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
368
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
368
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
369
369
|
label,
|
|
370
370
|
" ",
|
|
371
371
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" }),
|
|
@@ -375,9 +375,9 @@ var SmartSlider = ({
|
|
|
375
375
|
")"
|
|
376
376
|
] })
|
|
377
377
|
] }),
|
|
378
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
379
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
380
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
378
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
380
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
381
381
|
] }) })
|
|
382
382
|
] }),
|
|
383
383
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -427,10 +427,10 @@ var SmartDualRangeSlider = ({
|
|
|
427
427
|
disabled,
|
|
428
428
|
hidden
|
|
429
429
|
}) => {
|
|
430
|
-
const { formData } =
|
|
431
|
-
const minFormField =
|
|
432
|
-
const maxFormField =
|
|
433
|
-
const fieldDetection =
|
|
430
|
+
const { formData } = chunkVOLW7NZ4_cjs.useSmartForm();
|
|
431
|
+
const minFormField = chunkVOLW7NZ4_cjs.useFormField(minField);
|
|
432
|
+
const maxFormField = chunkVOLW7NZ4_cjs.useFormField(maxField);
|
|
433
|
+
const fieldDetection = chunkVOLW7NZ4_cjs.useFieldDetection();
|
|
434
434
|
const hasRegisteredMin = React2.useRef(false);
|
|
435
435
|
const hasRegisteredMax = React2.useRef(false);
|
|
436
436
|
const hasSetDefaultMin = React2.useRef(false);
|
|
@@ -479,14 +479,14 @@ var SmartDualRangeSlider = ({
|
|
|
479
479
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
480
480
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
481
481
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
482
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
482
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
483
483
|
label,
|
|
484
484
|
" ",
|
|
485
485
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
486
486
|
] }),
|
|
487
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
488
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
489
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
488
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
490
490
|
] }) })
|
|
491
491
|
] }),
|
|
492
492
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -568,7 +568,7 @@ var Tags = ({
|
|
|
568
568
|
TagsContext.Provider,
|
|
569
569
|
{
|
|
570
570
|
value: { value, setValue, open, onOpenChange, width, setWidth },
|
|
571
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.Popover, { onOpenChange, open, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVOLW7NZ4_cjs.cn("relative w-full", className), ref, children }) })
|
|
572
572
|
}
|
|
573
573
|
);
|
|
574
574
|
};
|
|
@@ -576,10 +576,10 @@ var TagsTrigger = ({
|
|
|
576
576
|
className,
|
|
577
577
|
children,
|
|
578
578
|
...props
|
|
579
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
-
|
|
579
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
581
581
|
{
|
|
582
|
-
className:
|
|
582
|
+
className: chunkVOLW7NZ4_cjs.cn("h-auto w-full justify-between p-2", className),
|
|
583
583
|
role: "combobox",
|
|
584
584
|
variant: "outline",
|
|
585
585
|
...props,
|
|
@@ -600,7 +600,7 @@ var TagsValue = ({
|
|
|
600
600
|
event.stopPropagation();
|
|
601
601
|
onRemove?.();
|
|
602
602
|
};
|
|
603
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
603
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(chunkI5HYLSDJ_cjs.Badge, { className: chunkVOLW7NZ4_cjs.cn("flex items-center gap-2", className), ...props, children: [
|
|
604
604
|
children,
|
|
605
605
|
onRemove && // biome-ignore lint/a11y/noStaticElementInteractions: "This is a clickable badge"
|
|
606
606
|
// biome-ignore lint/a11y/useKeyWithClickEvents: "This is a clickable badge"
|
|
@@ -621,27 +621,27 @@ var TagsContent = ({
|
|
|
621
621
|
}) => {
|
|
622
622
|
const { width } = useTagsContext();
|
|
623
623
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
624
|
-
|
|
624
|
+
chunkI5HYLSDJ_cjs.PopoverContent,
|
|
625
625
|
{
|
|
626
|
-
className:
|
|
626
|
+
className: chunkVOLW7NZ4_cjs.cn("p-0", className),
|
|
627
627
|
style: { width },
|
|
628
628
|
...props,
|
|
629
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
629
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.Command, { children })
|
|
630
630
|
}
|
|
631
631
|
);
|
|
632
632
|
};
|
|
633
|
-
var TagsInput = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
634
|
-
var TagsList = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
633
|
+
var TagsInput = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.CommandInput, { className: chunkVOLW7NZ4_cjs.cn("h-9", className), ...props });
|
|
634
|
+
var TagsList = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.CommandList, { className: chunkVOLW7NZ4_cjs.cn("max-h-[200px]", className), ...props });
|
|
635
635
|
var TagsEmpty = ({
|
|
636
636
|
children,
|
|
637
637
|
className,
|
|
638
638
|
...props
|
|
639
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
640
|
-
var TagsGroup =
|
|
639
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkI5HYLSDJ_cjs.CommandEmpty, { ...props, children: children ?? "No tags found." });
|
|
640
|
+
var TagsGroup = chunkI5HYLSDJ_cjs.CommandGroup;
|
|
641
641
|
var TagsItem = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
-
|
|
642
|
+
chunkI5HYLSDJ_cjs.CommandItem,
|
|
643
643
|
{
|
|
644
|
-
className:
|
|
644
|
+
className: chunkVOLW7NZ4_cjs.cn("cursor-pointer items-center justify-between", className),
|
|
645
645
|
...props
|
|
646
646
|
}
|
|
647
647
|
);
|
|
@@ -662,9 +662,9 @@ var SmartAutoSuggestTags = ({
|
|
|
662
662
|
disabled,
|
|
663
663
|
hidden
|
|
664
664
|
}) => {
|
|
665
|
-
const { formData } =
|
|
666
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
667
|
-
const fieldDetection =
|
|
665
|
+
const { formData } = chunkVOLW7NZ4_cjs.useSmartForm();
|
|
666
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkVOLW7NZ4_cjs.useFormField(field);
|
|
667
|
+
const fieldDetection = chunkVOLW7NZ4_cjs.useFieldDetection();
|
|
668
668
|
const hasRegistered = React2.useRef(false);
|
|
669
669
|
const hasSetDefault = React2.useRef(false);
|
|
670
670
|
const isDisabled = typeof disabled === "function" ? disabled(formData) : disabled || false;
|
|
@@ -733,7 +733,7 @@ var SmartAutoSuggestTags = ({
|
|
|
733
733
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
|
|
734
734
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
735
735
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
736
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
736
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
737
737
|
label,
|
|
738
738
|
" ",
|
|
739
739
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" }),
|
|
@@ -745,14 +745,14 @@ var SmartAutoSuggestTags = ({
|
|
|
745
745
|
")"
|
|
746
746
|
] })
|
|
747
747
|
] }),
|
|
748
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
750
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
749
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
750
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
751
751
|
] }) })
|
|
752
752
|
] }),
|
|
753
753
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
754
754
|
] }),
|
|
755
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: fieldRef, "data-field": field, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: fieldRef, "data-field": field, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVOLW7NZ4_cjs.cn(
|
|
756
756
|
"w-full rounded-md border border-input bg-background text-sm ring-offset-background",
|
|
757
757
|
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
758
758
|
error && "border-destructive focus-within:ring-destructive",
|
|
@@ -875,9 +875,9 @@ var SmartBasicRichTextbox = ({
|
|
|
875
875
|
disabled,
|
|
876
876
|
hidden
|
|
877
877
|
}) => {
|
|
878
|
-
const { formData } =
|
|
879
|
-
const { value, error, onChange, fieldRef, registerValidation } =
|
|
880
|
-
const fieldDetection =
|
|
878
|
+
const { formData } = chunkVOLW7NZ4_cjs.useSmartForm();
|
|
879
|
+
const { value, error, onChange, fieldRef, registerValidation } = chunkVOLW7NZ4_cjs.useFormField(field);
|
|
880
|
+
const fieldDetection = chunkVOLW7NZ4_cjs.useFieldDetection();
|
|
881
881
|
const hasRegistered = React2.useRef(false);
|
|
882
882
|
const hasSetDefault = React2.useRef(false);
|
|
883
883
|
const editorRef = React2.useRef(null);
|
|
@@ -968,17 +968,17 @@ var SmartBasicRichTextbox = ({
|
|
|
968
968
|
const handleBlur = () => {
|
|
969
969
|
setIsFocused(false);
|
|
970
970
|
};
|
|
971
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVOLW7NZ4_cjs.cn("flex-1 min-w-0", className), children: [
|
|
972
972
|
label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
|
|
973
973
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
974
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
|
|
975
975
|
label,
|
|
976
976
|
" ",
|
|
977
977
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
978
978
|
] }),
|
|
979
|
-
info && /* @__PURE__ */ jsxRuntime.jsx(
|
|
980
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
981
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
979
|
+
info && /* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
980
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
|
|
981
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
|
|
982
982
|
] }) })
|
|
983
983
|
] }),
|
|
984
984
|
subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
|
|
@@ -988,22 +988,22 @@ var SmartBasicRichTextbox = ({
|
|
|
988
988
|
{
|
|
989
989
|
ref: fieldRef,
|
|
990
990
|
"data-field": field,
|
|
991
|
-
className:
|
|
991
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
992
992
|
"w-full rounded-md border border-input bg-background",
|
|
993
993
|
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
994
994
|
error && "border-destructive focus-within:ring-destructive",
|
|
995
995
|
isDisabled && "cursor-not-allowed opacity-50"
|
|
996
996
|
),
|
|
997
997
|
children: [
|
|
998
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
999
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1000
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
|
-
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVOLW7NZ4_cjs.cn("flex items-center gap-0.5 p-1.5 border-b border-border bg-muted/30", isDisabled && "pointer-events-none"), children: [
|
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
1000
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
1002
1002
|
{
|
|
1003
1003
|
type: "button",
|
|
1004
1004
|
variant: "ghost",
|
|
1005
1005
|
size: "sm",
|
|
1006
|
-
className:
|
|
1006
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
1007
1007
|
"h-8 w-8 p-0 hover:bg-accent hover:text-accent-foreground",
|
|
1008
1008
|
activeFormats.bold && "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
1009
1009
|
),
|
|
@@ -1012,16 +1012,16 @@ var SmartBasicRichTextbox = ({
|
|
|
1012
1012
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { className: "h-4 w-4" })
|
|
1013
1013
|
}
|
|
1014
1014
|
) }),
|
|
1015
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Bold (Ctrl+B)" }) })
|
|
1016
1016
|
] }) }),
|
|
1017
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1018
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1019
|
-
|
|
1017
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
1018
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1019
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
1020
1020
|
{
|
|
1021
1021
|
type: "button",
|
|
1022
1022
|
variant: "ghost",
|
|
1023
1023
|
size: "sm",
|
|
1024
|
-
className:
|
|
1024
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
1025
1025
|
"h-8 w-8 p-0 hover:bg-accent hover:text-accent-foreground",
|
|
1026
1026
|
activeFormats.italic && "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
1027
1027
|
),
|
|
@@ -1030,16 +1030,16 @@ var SmartBasicRichTextbox = ({
|
|
|
1030
1030
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { className: "h-4 w-4" })
|
|
1031
1031
|
}
|
|
1032
1032
|
) }),
|
|
1033
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1033
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Italic (Ctrl+I)" }) })
|
|
1034
1034
|
] }) }),
|
|
1035
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1037
|
-
|
|
1035
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
1036
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1037
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
1038
1038
|
{
|
|
1039
1039
|
type: "button",
|
|
1040
1040
|
variant: "ghost",
|
|
1041
1041
|
size: "sm",
|
|
1042
|
-
className:
|
|
1042
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
1043
1043
|
"h-8 w-8 p-0 hover:bg-accent hover:text-accent-foreground",
|
|
1044
1044
|
activeFormats.underline && "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
1045
1045
|
),
|
|
@@ -1048,17 +1048,17 @@ var SmartBasicRichTextbox = ({
|
|
|
1048
1048
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Underline, { className: "h-4 w-4" })
|
|
1049
1049
|
}
|
|
1050
1050
|
) }),
|
|
1051
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1051
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Underline (Ctrl+U)" }) })
|
|
1052
1052
|
] }) }),
|
|
1053
1053
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
1054
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1055
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1056
|
-
|
|
1054
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
1055
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1056
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
1057
1057
|
{
|
|
1058
1058
|
type: "button",
|
|
1059
1059
|
variant: "ghost",
|
|
1060
1060
|
size: "sm",
|
|
1061
|
-
className:
|
|
1061
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
1062
1062
|
"h-8 w-8 p-0 hover:bg-accent hover:text-accent-foreground",
|
|
1063
1063
|
activeFormats.bulletList && "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
1064
1064
|
),
|
|
@@ -1067,16 +1067,16 @@ var SmartBasicRichTextbox = ({
|
|
|
1067
1067
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-4 w-4" })
|
|
1068
1068
|
}
|
|
1069
1069
|
) }),
|
|
1070
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1070
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Bullet List" }) })
|
|
1071
1071
|
] }) }),
|
|
1072
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1073
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1074
|
-
|
|
1072
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkVOLW7NZ4_cjs.Tooltip, { children: [
|
|
1073
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1074
|
+
chunkI5HYLSDJ_cjs.Button,
|
|
1075
1075
|
{
|
|
1076
1076
|
type: "button",
|
|
1077
1077
|
variant: "ghost",
|
|
1078
1078
|
size: "sm",
|
|
1079
|
-
className:
|
|
1079
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
1080
1080
|
"h-8 w-8 p-0 hover:bg-accent hover:text-accent-foreground",
|
|
1081
1081
|
activeFormats.numberedList && "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
1082
1082
|
),
|
|
@@ -1085,7 +1085,7 @@ var SmartBasicRichTextbox = ({
|
|
|
1085
1085
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "h-4 w-4" })
|
|
1086
1086
|
}
|
|
1087
1087
|
) }),
|
|
1088
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1088
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVOLW7NZ4_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Numbered List" }) })
|
|
1089
1089
|
] }) })
|
|
1090
1090
|
] }),
|
|
1091
1091
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1097,7 +1097,7 @@ var SmartBasicRichTextbox = ({
|
|
|
1097
1097
|
onKeyDown: handleKeyDown,
|
|
1098
1098
|
onFocus: handleFocus,
|
|
1099
1099
|
onBlur: handleBlur,
|
|
1100
|
-
className:
|
|
1100
|
+
className: chunkVOLW7NZ4_cjs.cn(
|
|
1101
1101
|
"w-full px-3 py-2 text-sm text-foreground",
|
|
1102
1102
|
"bg-background",
|
|
1103
1103
|
"focus:outline-none",
|
|
@@ -1129,43 +1129,43 @@ var SmartBasicRichTextbox = ({
|
|
|
1129
1129
|
|
|
1130
1130
|
Object.defineProperty(exports, "SmartCheckbox", {
|
|
1131
1131
|
enumerable: true,
|
|
1132
|
-
get: function () { return
|
|
1132
|
+
get: function () { return chunkI5HYLSDJ_cjs.SmartCheckbox; }
|
|
1133
1133
|
});
|
|
1134
1134
|
Object.defineProperty(exports, "SmartCombobox", {
|
|
1135
1135
|
enumerable: true,
|
|
1136
|
-
get: function () { return
|
|
1136
|
+
get: function () { return chunkI5HYLSDJ_cjs.SmartCombobox; }
|
|
1137
1137
|
});
|
|
1138
1138
|
Object.defineProperty(exports, "SmartDatePicker", {
|
|
1139
1139
|
enumerable: true,
|
|
1140
|
-
get: function () { return
|
|
1140
|
+
get: function () { return chunkI5HYLSDJ_cjs.SmartDatePicker; }
|
|
1141
1141
|
});
|
|
1142
1142
|
Object.defineProperty(exports, "SmartRadioGroup", {
|
|
1143
1143
|
enumerable: true,
|
|
1144
|
-
get: function () { return
|
|
1144
|
+
get: function () { return chunkI5HYLSDJ_cjs.SmartRadioGroup; }
|
|
1145
1145
|
});
|
|
1146
1146
|
Object.defineProperty(exports, "SmartSelect", {
|
|
1147
1147
|
enumerable: true,
|
|
1148
|
-
get: function () { return
|
|
1148
|
+
get: function () { return chunkI5HYLSDJ_cjs.SmartSelect; }
|
|
1149
1149
|
});
|
|
1150
1150
|
Object.defineProperty(exports, "SmartTags", {
|
|
1151
1151
|
enumerable: true,
|
|
1152
|
-
get: function () { return
|
|
1152
|
+
get: function () { return chunkI5HYLSDJ_cjs.SmartTags; }
|
|
1153
1153
|
});
|
|
1154
1154
|
Object.defineProperty(exports, "SmartFormProvider", {
|
|
1155
1155
|
enumerable: true,
|
|
1156
|
-
get: function () { return
|
|
1156
|
+
get: function () { return chunkVOLW7NZ4_cjs.SmartFormProvider; }
|
|
1157
1157
|
});
|
|
1158
1158
|
Object.defineProperty(exports, "SmartInput", {
|
|
1159
1159
|
enumerable: true,
|
|
1160
|
-
get: function () { return
|
|
1160
|
+
get: function () { return chunkVOLW7NZ4_cjs.SmartInput; }
|
|
1161
1161
|
});
|
|
1162
1162
|
Object.defineProperty(exports, "useFormField", {
|
|
1163
1163
|
enumerable: true,
|
|
1164
|
-
get: function () { return
|
|
1164
|
+
get: function () { return chunkVOLW7NZ4_cjs.useFormField; }
|
|
1165
1165
|
});
|
|
1166
1166
|
Object.defineProperty(exports, "useSmartForm", {
|
|
1167
1167
|
enumerable: true,
|
|
1168
|
-
get: function () { return
|
|
1168
|
+
get: function () { return chunkVOLW7NZ4_cjs.useSmartForm; }
|
|
1169
1169
|
});
|
|
1170
1170
|
exports.SmartAutoSuggestTags = SmartAutoSuggestTags;
|
|
1171
1171
|
exports.SmartBasicRichTextbox = SmartBasicRichTextbox;
|
package/dist/fields.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Button, CommandGroup, Popover, PopoverTrigger, Badge, PopoverContent, Command, CommandInput, CommandList, CommandEmpty, CommandItem } from './chunk-
|
|
2
|
-
export { SmartCheckbox, SmartCombobox, SmartDatePicker, SmartRadioGroup, SmartSelect, SmartTags } from './chunk-
|
|
3
|
-
import { useSmartForm, useFormField, useFieldDetection, cn, Label, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Input } from './chunk-
|
|
4
|
-
export { SmartFormProvider, SmartInput, useFormField, useSmartForm } from './chunk-
|
|
1
|
+
import { Button, CommandGroup, Popover, PopoverTrigger, Badge, PopoverContent, Command, CommandInput, CommandList, CommandEmpty, CommandItem } from './chunk-ONWU4O23.js';
|
|
2
|
+
export { SmartCheckbox, SmartCombobox, SmartDatePicker, SmartRadioGroup, SmartSelect, SmartTags } from './chunk-ONWU4O23.js';
|
|
3
|
+
import { useSmartForm, useFormField, useFieldDetection, cn, Label, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Input } from './chunk-S4UZYPMB.js';
|
|
4
|
+
export { SmartFormProvider, SmartInput, useFormField, useSmartForm } from './chunk-S4UZYPMB.js';
|
|
5
5
|
import * as React2 from 'react';
|
|
6
6
|
import { createContext, useRef, useEffect, useMemo, useState, useCallback, useContext } from 'react';
|
|
7
7
|
import { InfoIcon, PlusIcon, CheckIcon, Bold, Italic, Underline, List, ListOrdered, XIcon } from 'lucide-react';
|