@facter/ds-core 1.3.1 → 1.4.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.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 { Controller, FormProvider as FormProvider$1 } from 'react-hook-form';
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, isRequired]
3002
+ [name, id, error]
3018
3003
  );
3019
3004
  return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value, children });
3020
3005
  }
@@ -3578,7 +3563,7 @@ function FormRoot({
3578
3563
  className,
3579
3564
  ...props
3580
3565
  }) {
3581
- return /* @__PURE__ */ jsx(FormProvider, { form, children: /* @__PURE__ */ jsx(
3566
+ return /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
3582
3567
  "form",
3583
3568
  {
3584
3569
  onSubmit: form.handleSubmit(onSubmit, onError),
@@ -6794,39 +6779,47 @@ function WizardNavigation({
6794
6779
  const {
6795
6780
  isFirstStep,
6796
6781
  isLastStep,
6782
+ currentStep,
6797
6783
  goToNextStep,
6798
6784
  goToPrevStep,
6799
6785
  form
6800
6786
  } = useWizardContext();
6801
6787
  const isSubmitting = form.formState.isSubmitting;
6802
6788
  const shouldShowCancel = showCancel ?? isFirstStep;
6803
- const handleNext = useCallback(async () => {
6789
+ const handleNext = useCallback(async (e) => {
6790
+ e.preventDefault();
6791
+ e.stopPropagation();
6804
6792
  await goToNextStep();
6805
6793
  }, [goToNextStep]);
6806
- const handlePrev = useCallback(() => {
6794
+ const handlePrev = useCallback((e) => {
6795
+ e.preventDefault();
6796
+ e.stopPropagation();
6807
6797
  goToPrevStep();
6808
6798
  }, [goToPrevStep]);
6809
- const handleCancel = useCallback(() => {
6799
+ const handleCancel = useCallback((e) => {
6800
+ e.preventDefault();
6801
+ e.stopPropagation();
6810
6802
  onCancel?.();
6811
6803
  }, [onCancel]);
6812
6804
  return /* @__PURE__ */ jsxs(
6813
6805
  "div",
6814
6806
  {
6815
6807
  className: cn(
6816
- "flex items-center justify-between gap-3 pt-4 border-t border-border",
6808
+ "grid grid-cols-2 gap-3 pt-4 border-t border-border",
6817
6809
  className
6818
6810
  ),
6819
6811
  children: [
6820
- /* @__PURE__ */ jsx("div", { className: "flex-1", children: shouldShowCancel && onCancel ? /* @__PURE__ */ jsx(
6812
+ shouldShowCancel && onCancel ? /* @__PURE__ */ jsx(
6821
6813
  Button,
6822
6814
  {
6823
6815
  type: "button",
6824
6816
  variant: "outline",
6825
6817
  onClick: handleCancel,
6826
6818
  disabled: isSubmitting,
6827
- className: "w-full sm:w-auto",
6819
+ className: "w-full",
6828
6820
  children: cancelLabel
6829
- }
6821
+ },
6822
+ "cancel"
6830
6823
  ) : !isFirstStep ? /* @__PURE__ */ jsx(
6831
6824
  Button,
6832
6825
  {
@@ -6834,43 +6827,34 @@ function WizardNavigation({
6834
6827
  variant: "outline",
6835
6828
  onClick: handlePrev,
6836
6829
  disabled: isSubmitting,
6837
- className: "w-full sm:w-auto",
6830
+ className: "w-full",
6838
6831
  children: prevLabel
6839
- }
6840
- ) : /* @__PURE__ */ jsx("div", {}) }),
6841
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6842
- !isFirstStep && shouldShowCancel && /* @__PURE__ */ jsx(
6843
- Button,
6844
- {
6845
- type: "button",
6846
- variant: "outline",
6847
- onClick: handlePrev,
6848
- disabled: isSubmitting,
6849
- children: prevLabel
6850
- }
6851
- ),
6852
- isLastStep ? /* @__PURE__ */ jsx(
6853
- Button,
6854
- {
6855
- type: "submit",
6856
- disabled: submitDisabled || isSubmitting,
6857
- className: "min-w-[120px]",
6858
- children: isSubmitting ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
6859
- /* @__PURE__ */ jsx(Loader, { variant: "spinner" }),
6860
- loadingLabel
6861
- ] }) : submitLabel
6862
- }
6863
- ) : /* @__PURE__ */ jsx(
6864
- Button,
6865
- {
6866
- type: "button",
6867
- onClick: handleNext,
6868
- disabled: isSubmitting,
6869
- className: "min-w-[120px]",
6870
- children: nextLabel
6871
- }
6872
- )
6873
- ] })
6832
+ },
6833
+ "prev"
6834
+ ) : /* @__PURE__ */ jsx("div", {}),
6835
+ isLastStep ? /* @__PURE__ */ jsx(
6836
+ Button,
6837
+ {
6838
+ type: "submit",
6839
+ disabled: submitDisabled || isSubmitting,
6840
+ className: "w-full",
6841
+ children: isSubmitting ? /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-center gap-2", children: [
6842
+ /* @__PURE__ */ jsx(Loader, { variant: "spinner" }),
6843
+ loadingLabel
6844
+ ] }) : submitLabel
6845
+ },
6846
+ `submit-step-${currentStep}`
6847
+ ) : /* @__PURE__ */ jsx(
6848
+ Button,
6849
+ {
6850
+ type: "button",
6851
+ onClick: handleNext,
6852
+ disabled: isSubmitting,
6853
+ className: "w-full",
6854
+ children: nextLabel
6855
+ },
6856
+ `next-step-${currentStep}`
6857
+ )
6874
6858
  ]
6875
6859
  }
6876
6860
  );
@@ -6940,7 +6924,7 @@ function WizardRoot({
6940
6924
  onComplete,
6941
6925
  validateOnNext,
6942
6926
  allowJumpToStep,
6943
- children: /* @__PURE__ */ jsx(FormProvider$1, { ...form, children: /* @__PURE__ */ jsx(
6927
+ children: /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
6944
6928
  "form",
6945
6929
  {
6946
6930
  onSubmit: form.handleSubmit(handleSubmit),
@@ -7106,6 +7090,6 @@ var THEME_INFO = {
7106
7090
  }
7107
7091
  };
7108
7092
 
7109
- 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, FormProvider, 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, useFormContext, useFormFieldContext, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme, useWizardContext, useWizardContextOptional };
7093
+ 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 };
7110
7094
  //# sourceMappingURL=index.mjs.map
7111
7095
  //# sourceMappingURL=index.mjs.map