@facter/ds-core 1.3.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +85 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -67
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,8 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
|
15
15
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
16
16
|
import { toast as toast$1, Toaster as Toaster$1 } from 'sonner';
|
|
17
17
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
18
|
-
import {
|
|
18
|
+
import { FormProvider, useFormContext, Controller } from 'react-hook-form';
|
|
19
|
+
export { FormProvider, useFormContext } from 'react-hook-form';
|
|
19
20
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
20
21
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
21
22
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -2975,21 +2976,6 @@ var Textarea = React48.memo(
|
|
|
2975
2976
|
)
|
|
2976
2977
|
);
|
|
2977
2978
|
Textarea.displayName = "Textarea";
|
|
2978
|
-
var FormContext = React48.createContext(null);
|
|
2979
|
-
function useFormContext() {
|
|
2980
|
-
const context = React48.useContext(FormContext);
|
|
2981
|
-
if (!context) {
|
|
2982
|
-
throw new Error("useFormContext must be used within a Form provider");
|
|
2983
|
-
}
|
|
2984
|
-
return context.form;
|
|
2985
|
-
}
|
|
2986
|
-
function FormProvider({
|
|
2987
|
-
form,
|
|
2988
|
-
children
|
|
2989
|
-
}) {
|
|
2990
|
-
const value = React48.useMemo(() => ({ form }), [form]);
|
|
2991
|
-
return /* @__PURE__ */ jsx(FormContext.Provider, { value, children });
|
|
2992
|
-
}
|
|
2993
2979
|
var FormFieldContext = React48.createContext(null);
|
|
2994
2980
|
function useFormFieldContext() {
|
|
2995
2981
|
const context = React48.useContext(FormFieldContext);
|
|
@@ -3006,15 +2992,14 @@ function FormFieldProvider({ name, children }) {
|
|
|
3006
2992
|
const id = React48.useId();
|
|
3007
2993
|
const fieldState = form.getFieldState(name, form.formState);
|
|
3008
2994
|
const error = fieldState.error?.message;
|
|
3009
|
-
const isRequired = false;
|
|
3010
2995
|
const value = React48.useMemo(
|
|
3011
2996
|
() => ({
|
|
3012
2997
|
name,
|
|
3013
2998
|
id,
|
|
3014
2999
|
error,
|
|
3015
|
-
isRequired
|
|
3000
|
+
isRequired: false
|
|
3016
3001
|
}),
|
|
3017
|
-
[name, id, error
|
|
3002
|
+
[name, id, error]
|
|
3018
3003
|
);
|
|
3019
3004
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value, children });
|
|
3020
3005
|
}
|
|
@@ -3409,6 +3394,38 @@ function FormSwitch({
|
|
|
3409
3394
|
) });
|
|
3410
3395
|
}
|
|
3411
3396
|
FormSwitch.displayName = "Form.Switch";
|
|
3397
|
+
var colorStyles = {
|
|
3398
|
+
default: {
|
|
3399
|
+
border: "border-primary",
|
|
3400
|
+
bg: "bg-primary/5",
|
|
3401
|
+
text: "text-primary",
|
|
3402
|
+
radio: "border-primary text-primary"
|
|
3403
|
+
},
|
|
3404
|
+
destructive: {
|
|
3405
|
+
border: "border-red-500",
|
|
3406
|
+
bg: "bg-red-500/10",
|
|
3407
|
+
text: "text-red-600",
|
|
3408
|
+
radio: "border-red-500 text-red-500"
|
|
3409
|
+
},
|
|
3410
|
+
warning: {
|
|
3411
|
+
border: "border-amber-500",
|
|
3412
|
+
bg: "bg-amber-500/10",
|
|
3413
|
+
text: "text-amber-600",
|
|
3414
|
+
radio: "border-amber-500 text-amber-500"
|
|
3415
|
+
},
|
|
3416
|
+
success: {
|
|
3417
|
+
border: "border-green-500",
|
|
3418
|
+
bg: "bg-green-500/10",
|
|
3419
|
+
text: "text-green-600",
|
|
3420
|
+
radio: "border-green-500 text-green-500"
|
|
3421
|
+
},
|
|
3422
|
+
info: {
|
|
3423
|
+
border: "border-blue-500",
|
|
3424
|
+
bg: "bg-blue-500/10",
|
|
3425
|
+
text: "text-blue-600",
|
|
3426
|
+
radio: "border-blue-500 text-blue-500"
|
|
3427
|
+
}
|
|
3428
|
+
};
|
|
3412
3429
|
function FormRadioGroup({
|
|
3413
3430
|
name,
|
|
3414
3431
|
label,
|
|
@@ -3448,12 +3465,14 @@ function FormRadioGroup({
|
|
|
3448
3465
|
children: options.map((option) => {
|
|
3449
3466
|
const optionId = `${name}-${option.value}`;
|
|
3450
3467
|
const isSelected = field.value === option.value;
|
|
3468
|
+
const color = option.color || "default";
|
|
3469
|
+
const styles = colorStyles[color];
|
|
3451
3470
|
return /* @__PURE__ */ jsxs(
|
|
3452
3471
|
"div",
|
|
3453
3472
|
{
|
|
3454
3473
|
className: cn(
|
|
3455
3474
|
"flex items-center gap-3 border-2 py-2 px-4 rounded-lg transition-colors cursor-pointer",
|
|
3456
|
-
isSelected ?
|
|
3475
|
+
isSelected ? cn(styles.border, styles.bg) : "border-border hover:border-muted-foreground/50",
|
|
3457
3476
|
option.disabled && "opacity-50 cursor-not-allowed"
|
|
3458
3477
|
),
|
|
3459
3478
|
onClick: () => {
|
|
@@ -3469,7 +3488,8 @@ function FormRadioGroup({
|
|
|
3469
3488
|
value: option.value,
|
|
3470
3489
|
disabled: option.disabled,
|
|
3471
3490
|
className: cn(
|
|
3472
|
-
"aspect-square h-4 w-4 rounded-full border
|
|
3491
|
+
"aspect-square h-4 w-4 rounded-full border",
|
|
3492
|
+
isSelected ? styles.radio : "border-border text-muted-foreground",
|
|
3473
3493
|
"ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
3474
3494
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
3475
3495
|
),
|
|
@@ -3483,7 +3503,7 @@ function FormRadioGroup({
|
|
|
3483
3503
|
htmlFor: optionId,
|
|
3484
3504
|
className: cn(
|
|
3485
3505
|
"text-sm font-medium leading-none cursor-pointer",
|
|
3486
|
-
isSelected &&
|
|
3506
|
+
isSelected && styles.text,
|
|
3487
3507
|
option.disabled && "cursor-not-allowed"
|
|
3488
3508
|
),
|
|
3489
3509
|
children: option.label
|
|
@@ -3578,7 +3598,7 @@ function FormRoot({
|
|
|
3578
3598
|
className,
|
|
3579
3599
|
...props
|
|
3580
3600
|
}) {
|
|
3581
|
-
return /* @__PURE__ */ jsx(FormProvider, { form, children: /* @__PURE__ */ jsx(
|
|
3601
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
|
|
3582
3602
|
"form",
|
|
3583
3603
|
{
|
|
3584
3604
|
onSubmit: form.handleSubmit(onSubmit, onError),
|
|
@@ -6820,18 +6840,18 @@ function WizardNavigation({
|
|
|
6820
6840
|
"div",
|
|
6821
6841
|
{
|
|
6822
6842
|
className: cn(
|
|
6823
|
-
"
|
|
6843
|
+
"grid grid-cols-2 gap-3 pt-4 border-t border-border",
|
|
6824
6844
|
className
|
|
6825
6845
|
),
|
|
6826
6846
|
children: [
|
|
6827
|
-
|
|
6847
|
+
shouldShowCancel && onCancel ? /* @__PURE__ */ jsx(
|
|
6828
6848
|
Button,
|
|
6829
6849
|
{
|
|
6830
6850
|
type: "button",
|
|
6831
6851
|
variant: "outline",
|
|
6832
6852
|
onClick: handleCancel,
|
|
6833
6853
|
disabled: isSubmitting,
|
|
6834
|
-
className: "w-full
|
|
6854
|
+
className: "w-full",
|
|
6835
6855
|
children: cancelLabel
|
|
6836
6856
|
},
|
|
6837
6857
|
"cancel"
|
|
@@ -6842,47 +6862,34 @@ function WizardNavigation({
|
|
|
6842
6862
|
variant: "outline",
|
|
6843
6863
|
onClick: handlePrev,
|
|
6844
6864
|
disabled: isSubmitting,
|
|
6845
|
-
className: "w-full
|
|
6865
|
+
className: "w-full",
|
|
6846
6866
|
children: prevLabel
|
|
6847
6867
|
},
|
|
6848
|
-
"prev
|
|
6849
|
-
) : /* @__PURE__ */ jsx("div", {})
|
|
6850
|
-
/* @__PURE__ */
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
}
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
`submit-step-${currentStep}`
|
|
6874
|
-
) : /* @__PURE__ */ jsx(
|
|
6875
|
-
Button,
|
|
6876
|
-
{
|
|
6877
|
-
type: "button",
|
|
6878
|
-
onClick: handleNext,
|
|
6879
|
-
disabled: isSubmitting,
|
|
6880
|
-
className: "min-w-[120px]",
|
|
6881
|
-
children: nextLabel
|
|
6882
|
-
},
|
|
6883
|
-
`next-step-${currentStep}`
|
|
6884
|
-
)
|
|
6885
|
-
] })
|
|
6868
|
+
"prev"
|
|
6869
|
+
) : /* @__PURE__ */ jsx("div", {}),
|
|
6870
|
+
isLastStep ? /* @__PURE__ */ jsx(
|
|
6871
|
+
Button,
|
|
6872
|
+
{
|
|
6873
|
+
type: "submit",
|
|
6874
|
+
disabled: submitDisabled || isSubmitting,
|
|
6875
|
+
className: "w-full",
|
|
6876
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
6877
|
+
/* @__PURE__ */ jsx(Loader, { variant: "spinner" }),
|
|
6878
|
+
loadingLabel
|
|
6879
|
+
] }) : submitLabel
|
|
6880
|
+
},
|
|
6881
|
+
`submit-step-${currentStep}`
|
|
6882
|
+
) : /* @__PURE__ */ jsx(
|
|
6883
|
+
Button,
|
|
6884
|
+
{
|
|
6885
|
+
type: "button",
|
|
6886
|
+
onClick: handleNext,
|
|
6887
|
+
disabled: isSubmitting,
|
|
6888
|
+
className: "w-full",
|
|
6889
|
+
children: nextLabel
|
|
6890
|
+
},
|
|
6891
|
+
`next-step-${currentStep}`
|
|
6892
|
+
)
|
|
6886
6893
|
]
|
|
6887
6894
|
}
|
|
6888
6895
|
);
|
|
@@ -6952,7 +6959,7 @@ function WizardRoot({
|
|
|
6952
6959
|
onComplete,
|
|
6953
6960
|
validateOnNext,
|
|
6954
6961
|
allowJumpToStep,
|
|
6955
|
-
children: /* @__PURE__ */ jsx(FormProvider
|
|
6962
|
+
children: /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
|
|
6956
6963
|
"form",
|
|
6957
6964
|
{
|
|
6958
6965
|
onSubmit: form.handleSubmit(handleSubmit),
|
|
@@ -7118,6 +7125,6 @@ var THEME_INFO = {
|
|
|
7118
7125
|
}
|
|
7119
7126
|
};
|
|
7120
7127
|
|
|
7121
|
-
export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel,
|
|
7128
|
+
export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, Kanban, Loader, LoaderProvider, Logo, MobileNav, MobileNavItem, Navbar, NavbarCompanyProfile, NavbarNotification, NavbarUserMenu, Popover, PopoverContent, PopoverTrigger, RippleBackground, RippleEffect, RippleWrapper, ScrollArea, ScrollBar, SectionHeader, SectionHeaderActions, SectionHeaderBadge, SectionHeaderContent, SectionHeaderIcon, SectionHeaderRoot, SectionHeaderSubtitle, SectionHeaderTitle, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Separator3 as Separator, Sidebar, Skeleton, Sparkline, Switch, THEME_INFO, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Wizard, WizardContent, WizardNavigation, WizardPanel, WizardProgress, WizardProvider, WizardStepConnector, WizardStepIndicator, WizardSteps, cn, loader, toast, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormFieldContext, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme, useWizardContext, useWizardContextOptional };
|
|
7122
7129
|
//# sourceMappingURL=index.mjs.map
|
|
7123
7130
|
//# sourceMappingURL=index.mjs.map
|