@sikka/hawa 0.16.0-next → 0.16.1-next

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 CHANGED
@@ -10,6 +10,7 @@ import * as SheetPrimitive from '@radix-ui/react-dialog';
10
10
  import { DialogProps } from '@radix-ui/react-dialog';
11
11
  import * as ToastPrimitives from '@radix-ui/react-toast';
12
12
  import * as PopoverPrimitive from '@radix-ui/react-popover';
13
+ import * as embla_carousel_react from 'embla-carousel-react';
13
14
  import { EmblaOptionsType } from 'embla-carousel-react';
14
15
  import { RowData, ColumnDef } from '@tanstack/react-table';
15
16
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
@@ -405,12 +406,18 @@ declare const DialogFooter: {
405
406
  ({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
406
407
  displayName: string;
407
408
  };
408
- interface DialogStepsProps {
409
+ interface DialogCarouselProps {
409
410
  activeStep: string;
410
411
  children: React$1.ReactNode;
411
412
  stepsApi?: any;
412
413
  stepsRef?: any;
413
414
  }
415
+ declare const DialogCarousel: React$1.FC<DialogCarouselProps>;
416
+ interface DialogStepsProps {
417
+ currentStep: string;
418
+ visibleStepRef: React$1.RefObject<HTMLDivElement>;
419
+ children: React$1.ReactNode;
420
+ }
414
421
  declare const DialogSteps: React$1.FC<DialogStepsProps>;
415
422
  interface DialogStepProps {
416
423
  id: string;
@@ -1741,6 +1748,22 @@ declare function useToast(): {
1741
1748
  toasts: ToasterToast[];
1742
1749
  };
1743
1750
 
1751
+ declare const useDialogCarousel: (initialStepId: any, stepIds: any) => {
1752
+ emblaRef: <ViewportElement extends HTMLElement>(instance: ViewportElement | null) => void;
1753
+ emblaApi: embla_carousel_react.EmblaCarouselType | undefined;
1754
+ currentStep: any;
1755
+ nextStep: () => void;
1756
+ prevStep: () => void;
1757
+ };
1758
+
1759
+ declare const useMultiStepDialog: (initialStep: any, stepIds: any[], setOpenDialog: any) => {
1760
+ currentStep: any;
1761
+ dialogHeight: null;
1762
+ visibleStepRef: React__default.MutableRefObject<any>;
1763
+ handleNext: () => void;
1764
+ handleBack: () => void;
1765
+ };
1766
+
1744
1767
  declare function useClipboard({ timeout }?: {
1745
1768
  timeout?: number | undefined;
1746
1769
  }): {
@@ -1777,4 +1800,4 @@ declare function useTabs(initialTab?: string): {
1777
1800
  handleTabChange: (index: any) => void;
1778
1801
  };
1779
1802
 
1780
- export { Accordion, AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, ActionCard, AdCard, Alert, Announcement, AppLanding, AppLayout, AppLayoutSidebarItemProps, AppStores, AppTabs, AppTopbar, Avatar, BackToTop, Badge, BadgedComponent, Breadcrumb, Button, ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CheckEmail, Checkbox, Chip, ChipColors, ChipTypes, CodeBlock, CodeConfirmation, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ComparingPlans, Copyrights, Count, DataTable, DestroyableCard, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPortal, DialogStep, DialogSteps, DialogTitle, DialogTrigger, DocsLayout, DocsSidebar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FeedbackEmoji, FeedbackForm, FeedbackRating, FileDropzone, FileUploader, HorizontalPricing, Input, InterfaceSettings, ItemCard, Label, LabelProps, LandingCard, LeadGenerator, LegalTexts, Loading, LoginForm, Logos, MenuItemType, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavMenuItem, Navbar, NavigationMenu, NavigationMenuLink, NewPasswordForm, NoPermission, NotFound, PhoneInput, PinInput, Popover, PopoverContent, PopoverTrigger, PricingCard, PricingPlans, Progress, ProgressCircle, Radio, RadioOptionsTypes, RegisterForm, ResetPasswordForm, ScrollArea, ScrollBar, ScrollIndicator, Select, SelectOptionProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarGroup, SidebarItem, SimpleTable, Skeleton, Slider, SortButton, SplitButton, Stats, StopPropagationWrapper, SubItem$1 as SubItem, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Testimonial, Textarea, TextareaProps, Toast$1 as Toast, ToastAction, ToastActionElement, ToastClose, ToastDescription, ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, Usage, UseFocusWithinOptions, UseMediaQueryOptions, UserReferralSource, buttonVariants, reducer, toast, useBreakpoint, useClipboard, useFocusWithin, useIsomorphicEffect, useMediaQuery, useTabs, useToast, useWindowSize };
1803
+ export { Accordion, AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, ActionCard, AdCard, Alert, Announcement, AppLanding, AppLayout, AppLayoutSidebarItemProps, AppStores, AppTabs, AppTopbar, Avatar, BackToTop, Badge, BadgedComponent, Breadcrumb, Button, ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CheckEmail, Checkbox, Chip, ChipColors, ChipTypes, CodeBlock, CodeConfirmation, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ComparingPlans, Copyrights, Count, DataTable, DestroyableCard, Dialog, DialogBody, DialogCarousel, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPortal, DialogStep, DialogSteps, DialogTitle, DialogTrigger, DocsLayout, DocsSidebar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FeedbackEmoji, FeedbackForm, FeedbackRating, FileDropzone, FileUploader, HorizontalPricing, Input, InterfaceSettings, ItemCard, Label, LabelProps, LandingCard, LeadGenerator, LegalTexts, Loading, LoginForm, Logos, MenuItemType, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavMenuItem, Navbar, NavigationMenu, NavigationMenuLink, NewPasswordForm, NoPermission, NotFound, PhoneInput, PinInput, Popover, PopoverContent, PopoverTrigger, PricingCard, PricingPlans, Progress, ProgressCircle, Radio, RadioOptionsTypes, RegisterForm, ResetPasswordForm, ScrollArea, ScrollBar, ScrollIndicator, Select, SelectOptionProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarGroup, SidebarItem, SimpleTable, Skeleton, Slider, SortButton, SplitButton, Stats, StopPropagationWrapper, SubItem$1 as SubItem, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Testimonial, Textarea, TextareaProps, Toast$1 as Toast, ToastAction, ToastActionElement, ToastClose, ToastDescription, ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, Usage, UseFocusWithinOptions, UseMediaQueryOptions, UserReferralSource, buttonVariants, reducer, toast, useBreakpoint, useClipboard, useDialogCarousel, useFocusWithin, useIsomorphicEffect, useMediaQuery, useMultiStepDialog, useTabs, useToast, useWindowSize };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import * as SheetPrimitive from '@radix-ui/react-dialog';
10
10
  import { DialogProps } from '@radix-ui/react-dialog';
11
11
  import * as ToastPrimitives from '@radix-ui/react-toast';
12
12
  import * as PopoverPrimitive from '@radix-ui/react-popover';
13
+ import * as embla_carousel_react from 'embla-carousel-react';
13
14
  import { EmblaOptionsType } from 'embla-carousel-react';
14
15
  import { RowData, ColumnDef } from '@tanstack/react-table';
15
16
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
@@ -405,12 +406,18 @@ declare const DialogFooter: {
405
406
  ({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
406
407
  displayName: string;
407
408
  };
408
- interface DialogStepsProps {
409
+ interface DialogCarouselProps {
409
410
  activeStep: string;
410
411
  children: React$1.ReactNode;
411
412
  stepsApi?: any;
412
413
  stepsRef?: any;
413
414
  }
415
+ declare const DialogCarousel: React$1.FC<DialogCarouselProps>;
416
+ interface DialogStepsProps {
417
+ currentStep: string;
418
+ visibleStepRef: React$1.RefObject<HTMLDivElement>;
419
+ children: React$1.ReactNode;
420
+ }
414
421
  declare const DialogSteps: React$1.FC<DialogStepsProps>;
415
422
  interface DialogStepProps {
416
423
  id: string;
@@ -1741,6 +1748,22 @@ declare function useToast(): {
1741
1748
  toasts: ToasterToast[];
1742
1749
  };
1743
1750
 
1751
+ declare const useDialogCarousel: (initialStepId: any, stepIds: any) => {
1752
+ emblaRef: <ViewportElement extends HTMLElement>(instance: ViewportElement | null) => void;
1753
+ emblaApi: embla_carousel_react.EmblaCarouselType | undefined;
1754
+ currentStep: any;
1755
+ nextStep: () => void;
1756
+ prevStep: () => void;
1757
+ };
1758
+
1759
+ declare const useMultiStepDialog: (initialStep: any, stepIds: any[], setOpenDialog: any) => {
1760
+ currentStep: any;
1761
+ dialogHeight: null;
1762
+ visibleStepRef: React__default.MutableRefObject<any>;
1763
+ handleNext: () => void;
1764
+ handleBack: () => void;
1765
+ };
1766
+
1744
1767
  declare function useClipboard({ timeout }?: {
1745
1768
  timeout?: number | undefined;
1746
1769
  }): {
@@ -1777,4 +1800,4 @@ declare function useTabs(initialTab?: string): {
1777
1800
  handleTabChange: (index: any) => void;
1778
1801
  };
1779
1802
 
1780
- export { Accordion, AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, ActionCard, AdCard, Alert, Announcement, AppLanding, AppLayout, AppLayoutSidebarItemProps, AppStores, AppTabs, AppTopbar, Avatar, BackToTop, Badge, BadgedComponent, Breadcrumb, Button, ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CheckEmail, Checkbox, Chip, ChipColors, ChipTypes, CodeBlock, CodeConfirmation, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ComparingPlans, Copyrights, Count, DataTable, DestroyableCard, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPortal, DialogStep, DialogSteps, DialogTitle, DialogTrigger, DocsLayout, DocsSidebar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FeedbackEmoji, FeedbackForm, FeedbackRating, FileDropzone, FileUploader, HorizontalPricing, Input, InterfaceSettings, ItemCard, Label, LabelProps, LandingCard, LeadGenerator, LegalTexts, Loading, LoginForm, Logos, MenuItemType, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavMenuItem, Navbar, NavigationMenu, NavigationMenuLink, NewPasswordForm, NoPermission, NotFound, PhoneInput, PinInput, Popover, PopoverContent, PopoverTrigger, PricingCard, PricingPlans, Progress, ProgressCircle, Radio, RadioOptionsTypes, RegisterForm, ResetPasswordForm, ScrollArea, ScrollBar, ScrollIndicator, Select, SelectOptionProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarGroup, SidebarItem, SimpleTable, Skeleton, Slider, SortButton, SplitButton, Stats, StopPropagationWrapper, SubItem$1 as SubItem, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Testimonial, Textarea, TextareaProps, Toast$1 as Toast, ToastAction, ToastActionElement, ToastClose, ToastDescription, ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, Usage, UseFocusWithinOptions, UseMediaQueryOptions, UserReferralSource, buttonVariants, reducer, toast, useBreakpoint, useClipboard, useFocusWithin, useIsomorphicEffect, useMediaQuery, useTabs, useToast, useWindowSize };
1803
+ export { Accordion, AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, ActionCard, AdCard, Alert, Announcement, AppLanding, AppLayout, AppLayoutSidebarItemProps, AppStores, AppTabs, AppTopbar, Avatar, BackToTop, Badge, BadgedComponent, Breadcrumb, Button, ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CheckEmail, Checkbox, Chip, ChipColors, ChipTypes, CodeBlock, CodeConfirmation, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ComparingPlans, Copyrights, Count, DataTable, DestroyableCard, Dialog, DialogBody, DialogCarousel, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPortal, DialogStep, DialogSteps, DialogTitle, DialogTrigger, DocsLayout, DocsSidebar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FeedbackEmoji, FeedbackForm, FeedbackRating, FileDropzone, FileUploader, HorizontalPricing, Input, InterfaceSettings, ItemCard, Label, LabelProps, LandingCard, LeadGenerator, LegalTexts, Loading, LoginForm, Logos, MenuItemType, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavMenuItem, Navbar, NavigationMenu, NavigationMenuLink, NewPasswordForm, NoPermission, NotFound, PhoneInput, PinInput, Popover, PopoverContent, PopoverTrigger, PricingCard, PricingPlans, Progress, ProgressCircle, Radio, RadioOptionsTypes, RegisterForm, ResetPasswordForm, ScrollArea, ScrollBar, ScrollIndicator, Select, SelectOptionProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarGroup, SidebarItem, SimpleTable, Skeleton, Slider, SortButton, SplitButton, Stats, StopPropagationWrapper, SubItem$1 as SubItem, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Testimonial, Textarea, TextareaProps, Toast$1 as Toast, ToastAction, ToastActionElement, ToastClose, ToastDescription, ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, Usage, UseFocusWithinOptions, UseMediaQueryOptions, UserReferralSource, buttonVariants, reducer, toast, useBreakpoint, useClipboard, useDialogCarousel, useFocusWithin, useIsomorphicEffect, useMediaQuery, useMultiStepDialog, useTabs, useToast, useWindowSize };
package/dist/index.js CHANGED
@@ -496,6 +496,9 @@ __export(components_exports, {
496
496
  DialogBody: function() {
497
497
  return DialogBody;
498
498
  },
499
+ DialogCarousel: function() {
500
+ return DialogCarousel;
501
+ },
499
502
  DialogContent: function() {
500
503
  return DialogContent;
501
504
  },
@@ -877,6 +880,9 @@ __export(components_exports, {
877
880
  useClipboard: function() {
878
881
  return useClipboard;
879
882
  },
883
+ useDialogCarousel: function() {
884
+ return useDialogCarousel;
885
+ },
880
886
  useFocusWithin: function() {
881
887
  return useFocusWithin;
882
888
  },
@@ -886,6 +892,9 @@ __export(components_exports, {
886
892
  useMediaQuery: function() {
887
893
  return useMediaQuery;
888
894
  },
895
+ useMultiStepDialog: function() {
896
+ return useMultiStepDialog;
897
+ },
889
898
  useTabs: function() {
890
899
  return useTabs;
891
900
  },
@@ -4192,7 +4201,7 @@ var DialogFooter = function(_param) /* @__PURE__ */ {
4192
4201
  className: cn("hawa-flex hawa-flex-col-reverse sm:hawa-flex-row sm:hawa-justify-end sm:hawa-gap-2", className)
4193
4202
  }, props));
4194
4203
  };
4195
- var DialogSteps = function(param) {
4204
+ var DialogCarousel = function(param) {
4196
4205
  var stepsApi = param.stepsApi, stepsRef = param.stepsRef, activeStep = param.activeStep, children = param.children;
4197
4206
  var _React25_useState = _sliced_to_array(React25.useState(0), 2), selectedIndex = _React25_useState[0], setSelectedIndex = _React25_useState[1];
4198
4207
  var steps = React25.Children.toArray(children);
@@ -4228,6 +4237,31 @@ var DialogSteps = function(param) {
4228
4237
  }, child);
4229
4238
  }))));
4230
4239
  };
4240
+ var DialogSteps = function(param) {
4241
+ var currentStep = param.currentStep, visibleStepRef = param.visibleStepRef, children = param.children;
4242
+ var _React25_useState = _sliced_to_array(React25.useState(null), 2), dialogHeight = _React25_useState[0], setDialogHeight = _React25_useState[1];
4243
+ React25.useEffect(function() {
4244
+ if (visibleStepRef.current) {
4245
+ setDialogHeight(visibleStepRef.current.offsetHeight);
4246
+ console.log("height is ", visibleStepRef.current.offsetHeight);
4247
+ }
4248
+ }, [
4249
+ currentStep,
4250
+ visibleStepRef
4251
+ ]);
4252
+ return /* @__PURE__ */ React25.createElement("div", {
4253
+ className: "hawa-relative hawa-overflow-clip",
4254
+ style: {
4255
+ height: dialogHeight || "fit-content",
4256
+ transition: "height 0.2s"
4257
+ }
4258
+ }, React25.Children.map(children, function(child, index) {
4259
+ return /* @__PURE__ */ React25.createElement("div", {
4260
+ ref: currentStep === "step-".concat(index + 1) ? visibleStepRef : null,
4261
+ className: cn(currentStep === "step-".concat(index + 1) ? "hawa-visible hawa-block" : "hawa-invisible hawa-hidden")
4262
+ }, child);
4263
+ }));
4264
+ };
4231
4265
  var DialogStep = function(param) {
4232
4266
  var id = param.id, children = param.children, className = param.className, stepRef = param.stepRef;
4233
4267
  return /* @__PURE__ */ React25.createElement("div", {
@@ -4242,9 +4276,10 @@ var DialogBody = function(param) {
4242
4276
  className: cn("hawa-py-6", className)
4243
4277
  }, children);
4244
4278
  };
4245
- DialogStep.displayName = "DialogStep";
4246
4279
  DialogBody.displayName = "DialogBody";
4280
+ DialogStep.displayName = "DialogStep";
4247
4281
  DialogSteps.displayName = "DialogSteps";
4282
+ DialogCarousel.displayName = "DialogCarousel";
4248
4283
  DialogHeader.displayName = "DialogHeader";
4249
4284
  DialogFooter.displayName = "DialogFooter";
4250
4285
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
@@ -10073,18 +10108,85 @@ var import_react70 = require("react");
10073
10108
  var import_react71 = require("react");
10074
10109
  // components/hooks/useCarousel.ts
10075
10110
  var import_react72 = require("react");
10076
- // components/hooks/useDialogSteps.ts
10111
+ // components/hooks/useDialogCarousel.ts
10077
10112
  var import_react73 = require("react");
10078
10113
  var import_embla_carousel_react2 = __toESM(require("embla-carousel-react"));
10079
10114
  var import_embla_carousel_auto_height = __toESM(require("embla-carousel-auto-height"));
10080
- // components/hooks/useWindowSize.ts
10115
+ var useDialogCarousel = function(initialStepId, stepIds) {
10116
+ var _ref = _sliced_to_array((0, import_embla_carousel_react2.default)({
10117
+ loop: false,
10118
+ watchDrag: false
10119
+ }, [
10120
+ (0, import_embla_carousel_auto_height.default)({
10121
+ destroyHeight: "fit",
10122
+ active: true
10123
+ })
10124
+ ]), 2), emblaRef = _ref[0], emblaApi = _ref[1];
10125
+ var _ref1 = _sliced_to_array((0, import_react73.useState)(initialStepId), 2), currentStep = _ref1[0], setCurrentStep = _ref1[1];
10126
+ var nextStep = function() {
10127
+ if (emblaApi) {
10128
+ emblaApi.scrollNext();
10129
+ }
10130
+ };
10131
+ var prevStep = function() {
10132
+ if (emblaApi) {
10133
+ emblaApi.scrollPrev();
10134
+ }
10135
+ };
10136
+ return {
10137
+ emblaRef: emblaRef,
10138
+ emblaApi: emblaApi,
10139
+ currentStep: currentStep,
10140
+ nextStep: nextStep,
10141
+ prevStep: prevStep
10142
+ };
10143
+ };
10144
+ // components/hooks/useDialogSteps.ts
10081
10145
  var import_react74 = require("react");
10146
+ var useMultiStepDialog = function(initialStep, stepIds, setOpenDialog) {
10147
+ var _ref = _sliced_to_array((0, import_react74.useState)(initialStep), 2), currentStep = _ref[0], setCurrentStep = _ref[1];
10148
+ var _ref1 = _sliced_to_array((0, import_react74.useState)(null), 2), dialogHeight = _ref1[0], setDialogHeight = _ref1[1];
10149
+ var visibleStepRef = (0, import_react74.useRef)(null);
10150
+ (0, import_react74.useEffect)(function() {
10151
+ if (visibleStepRef.current) {
10152
+ setDialogHeight(visibleStepRef.current.offsetHeight);
10153
+ }
10154
+ }, [
10155
+ currentStep,
10156
+ setOpenDialog
10157
+ ]);
10158
+ var handleNext = function() {
10159
+ var currentIndex = stepIds.indexOf(currentStep);
10160
+ if (currentIndex < stepIds.length - 1) {
10161
+ setTimeout(function() {
10162
+ setCurrentStep(stepIds[currentIndex + 1]);
10163
+ }, 100);
10164
+ }
10165
+ };
10166
+ var handleBack = function() {
10167
+ var currentIndex = stepIds.indexOf(currentStep);
10168
+ if (currentIndex > 0) {
10169
+ setTimeout(function() {
10170
+ setCurrentStep(stepIds[currentIndex - 1]);
10171
+ }, 100);
10172
+ }
10173
+ };
10174
+ return {
10175
+ currentStep: currentStep,
10176
+ dialogHeight: dialogHeight,
10177
+ visibleStepRef: visibleStepRef,
10178
+ handleNext: handleNext,
10179
+ handleBack: handleBack
10180
+ };
10181
+ };
10182
+ // components/hooks/useWindowSize.ts
10183
+ var import_react75 = require("react");
10082
10184
  var useWindowSize = function() {
10083
- var _ref = _sliced_to_array((0, import_react74.useState)({
10185
+ var _ref = _sliced_to_array((0, import_react75.useState)({
10084
10186
  width: void 0,
10085
10187
  height: void 0
10086
10188
  }), 2), windowSize = _ref[0], setWindowSize = _ref[1];
10087
- (0, import_react74.useEffect)(function() {
10189
+ (0, import_react75.useEffect)(function() {
10088
10190
  var handleResize = function handleResize() {
10089
10191
  setWindowSize({
10090
10192
  width: window.innerWidth,
@@ -10100,7 +10202,7 @@ var useWindowSize = function() {
10100
10202
  return windowSize;
10101
10203
  };
10102
10204
  // components/hooks/useFocusWithin.ts
10103
- var import_react75 = require("react");
10205
+ var import_react76 = require("react");
10104
10206
  function containsRelatedTarget(event) {
10105
10207
  if (_instanceof(event.currentTarget, HTMLElement) && _instanceof(event.relatedTarget, HTMLElement)) {
10106
10208
  return event.currentTarget.contains(event.relatedTarget);
@@ -10109,9 +10211,9 @@ function containsRelatedTarget(event) {
10109
10211
  }
10110
10212
  function useFocusWithin() {
10111
10213
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
10112
- var ref = (0, import_react75.useRef)(null);
10113
- var _ref1 = _sliced_to_array((0, import_react75.useState)(false), 2), focused = _ref1[0], _setFocused = _ref1[1];
10114
- var focusedRef = (0, import_react75.useRef)(false);
10214
+ var ref = (0, import_react76.useRef)(null);
10215
+ var _ref1 = _sliced_to_array((0, import_react76.useState)(false), 2), focused = _ref1[0], _setFocused = _ref1[1];
10216
+ var focusedRef = (0, import_react76.useRef)(false);
10115
10217
  var setFocused = function(value) {
10116
10218
  _setFocused(value);
10117
10219
  focusedRef.current = value;
@@ -10128,7 +10230,7 @@ function useFocusWithin() {
10128
10230
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
10129
10231
  }
10130
10232
  };
10131
- (0, import_react75.useEffect)(function() {
10233
+ (0, import_react76.useEffect)(function() {
10132
10234
  if (ref.current) {
10133
10235
  ref.current.addEventListener("focusin", handleFocusIn);
10134
10236
  ref.current.addEventListener("focusout", handleFocusOut);
@@ -10149,7 +10251,7 @@ function useFocusWithin() {
10149
10251
  };
10150
10252
  }
10151
10253
  // components/hooks/useMediaQuery.ts
10152
- var import_react76 = require("react");
10254
+ var import_react77 = require("react");
10153
10255
  function attachMediaListener(query, callback) {
10154
10256
  try {
10155
10257
  query.addEventListener("change", callback);
@@ -10176,9 +10278,9 @@ function useMediaQuery(query, initialValue) {
10176
10278
  var getInitialValueInEffect = (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
10177
10279
  getInitialValueInEffect: true
10178
10280
  }).getInitialValueInEffect;
10179
- var _ref = _sliced_to_array((0, import_react76.useState)(getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)), 2), matches = _ref[0], setMatches = _ref[1];
10180
- var queryRef = (0, import_react76.useRef)();
10181
- (0, import_react76.useEffect)(function() {
10281
+ var _ref = _sliced_to_array((0, import_react77.useState)(getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)), 2), matches = _ref[0], setMatches = _ref[1];
10282
+ var queryRef = (0, import_react77.useRef)();
10283
+ (0, import_react77.useEffect)(function() {
10182
10284
  if ("matchMedia" in window) {
10183
10285
  queryRef.current = window.matchMedia(query);
10184
10286
  setMatches(queryRef.current.matches);
@@ -10193,15 +10295,15 @@ function useMediaQuery(query, initialValue) {
10193
10295
  return matches;
10194
10296
  }
10195
10297
  // components/hooks/useScrollPosition.ts
10196
- var import_react77 = require("react");
10197
- // components/hooks/useTable.ts
10198
10298
  var import_react78 = require("react");
10199
- // components/hooks/useTabs.ts
10299
+ // components/hooks/useTable.ts
10200
10300
  var import_react79 = require("react");
10301
+ // components/hooks/useTabs.ts
10302
+ var import_react80 = require("react");
10201
10303
  function useTabs() {
10202
10304
  var initialTab = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
10203
- var _ref = _sliced_to_array((0, import_react79.useState)(initialTab), 2), activeTab = _ref[0], setActiveTab = _ref[1];
10204
- (0, import_react79.useEffect)(function() {
10305
+ var _ref = _sliced_to_array((0, import_react80.useState)(initialTab), 2), activeTab = _ref[0], setActiveTab = _ref[1];
10306
+ (0, import_react80.useEffect)(function() {
10205
10307
  var handleHashChange = function() {
10206
10308
  var hash = window.location.hash.substring(1);
10207
10309
  setActiveTab(hash || initialTab);
@@ -10275,6 +10377,7 @@ function useTabs() {
10275
10377
  DestroyableCard: DestroyableCard,
10276
10378
  Dialog: Dialog,
10277
10379
  DialogBody: DialogBody,
10380
+ DialogCarousel: DialogCarousel,
10278
10381
  DialogContent: DialogContent,
10279
10382
  DialogDescription: DialogDescription,
10280
10383
  DialogFooter: DialogFooter,
@@ -10402,9 +10505,11 @@ function useTabs() {
10402
10505
  toast: toast,
10403
10506
  useBreakpoint: useBreakpoint,
10404
10507
  useClipboard: useClipboard,
10508
+ useDialogCarousel: useDialogCarousel,
10405
10509
  useFocusWithin: useFocusWithin,
10406
10510
  useIsomorphicEffect: useIsomorphicEffect,
10407
10511
  useMediaQuery: useMediaQuery,
10512
+ useMultiStepDialog: useMultiStepDialog,
10408
10513
  useTabs: useTabs,
10409
10514
  useToast: useToast,
10410
10515
  useWindowSize: useWindowSize
package/dist/index.mjs CHANGED
@@ -3636,7 +3636,7 @@ var DialogFooter = ({
3636
3636
  ...props
3637
3637
  }
3638
3638
  );
3639
- var DialogSteps = ({
3639
+ var DialogCarousel = ({
3640
3640
  stepsApi,
3641
3641
  stepsRef,
3642
3642
  activeStep,
@@ -3676,6 +3676,39 @@ var DialogSteps = ({
3676
3676
  ))
3677
3677
  )));
3678
3678
  };
3679
+ var DialogSteps = ({
3680
+ currentStep,
3681
+ visibleStepRef,
3682
+ children
3683
+ }) => {
3684
+ const [dialogHeight, setDialogHeight] = React25.useState(null);
3685
+ React25.useEffect(() => {
3686
+ if (visibleStepRef.current) {
3687
+ setDialogHeight(visibleStepRef.current.offsetHeight);
3688
+ console.log("height is ", visibleStepRef.current.offsetHeight);
3689
+ }
3690
+ }, [currentStep, visibleStepRef]);
3691
+ return /* @__PURE__ */ React25.createElement(
3692
+ "div",
3693
+ {
3694
+ className: "hawa-relative hawa-overflow-clip",
3695
+ style: {
3696
+ height: dialogHeight || "fit-content",
3697
+ transition: "height 0.2s"
3698
+ }
3699
+ },
3700
+ React25.Children.map(children, (child, index) => /* @__PURE__ */ React25.createElement(
3701
+ "div",
3702
+ {
3703
+ ref: currentStep === `step-${index + 1}` ? visibleStepRef : null,
3704
+ className: cn(
3705
+ currentStep === `step-${index + 1}` ? "hawa-visible hawa-block" : "hawa-invisible hawa-hidden"
3706
+ )
3707
+ },
3708
+ child
3709
+ ))
3710
+ );
3711
+ };
3679
3712
  var DialogStep = ({
3680
3713
  id,
3681
3714
  children,
@@ -3695,9 +3728,10 @@ var DialogStep = ({
3695
3728
  var DialogBody = ({ children, className }) => {
3696
3729
  return /* @__PURE__ */ React25.createElement("div", { className: cn("hawa-py-6", className) }, children);
3697
3730
  };
3698
- DialogStep.displayName = "DialogStep";
3699
3731
  DialogBody.displayName = "DialogBody";
3732
+ DialogStep.displayName = "DialogStep";
3700
3733
  DialogSteps.displayName = "DialogSteps";
3734
+ DialogCarousel.displayName = "DialogCarousel";
3701
3735
  DialogHeader.displayName = "DialogHeader";
3702
3736
  DialogFooter.displayName = "DialogFooter";
3703
3737
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
@@ -10104,19 +10138,79 @@ import { useEffect as useEffect24, useRef as useRef14, useState as useState38 }
10104
10138
  // components/hooks/useCarousel.ts
10105
10139
  import { useState as useState39, useRef as useRef15 } from "react";
10106
10140
 
10107
- // components/hooks/useDialogSteps.ts
10141
+ // components/hooks/useDialogCarousel.ts
10108
10142
  import { useState as useState40 } from "react";
10109
10143
  import useEmblaCarousel2 from "embla-carousel-react";
10110
10144
  import AutoHeight from "embla-carousel-auto-height";
10145
+ var useDialogCarousel = (initialStepId, stepIds) => {
10146
+ const [emblaRef, emblaApi] = useEmblaCarousel2(
10147
+ { loop: false, watchDrag: false },
10148
+ [AutoHeight({ destroyHeight: "fit", active: true })]
10149
+ );
10150
+ const [currentStep, setCurrentStep] = useState40(initialStepId);
10151
+ const nextStep = () => {
10152
+ if (emblaApi) {
10153
+ emblaApi.scrollNext();
10154
+ }
10155
+ };
10156
+ const prevStep = () => {
10157
+ if (emblaApi) {
10158
+ emblaApi.scrollPrev();
10159
+ }
10160
+ };
10161
+ return {
10162
+ emblaRef,
10163
+ emblaApi,
10164
+ currentStep,
10165
+ nextStep,
10166
+ prevStep
10167
+ };
10168
+ };
10169
+
10170
+ // components/hooks/useDialogSteps.ts
10171
+ import { useState as useState41, useEffect as useEffect26, useRef as useRef16 } from "react";
10172
+ var useMultiStepDialog = (initialStep, stepIds, setOpenDialog) => {
10173
+ const [currentStep, setCurrentStep] = useState41(initialStep);
10174
+ const [dialogHeight, setDialogHeight] = useState41(null);
10175
+ const visibleStepRef = useRef16(null);
10176
+ useEffect26(() => {
10177
+ if (visibleStepRef.current) {
10178
+ setDialogHeight(visibleStepRef.current.offsetHeight);
10179
+ }
10180
+ }, [currentStep, setOpenDialog]);
10181
+ const handleNext = () => {
10182
+ const currentIndex = stepIds.indexOf(currentStep);
10183
+ if (currentIndex < stepIds.length - 1) {
10184
+ setTimeout(() => {
10185
+ setCurrentStep(stepIds[currentIndex + 1]);
10186
+ }, 100);
10187
+ }
10188
+ };
10189
+ const handleBack = () => {
10190
+ const currentIndex = stepIds.indexOf(currentStep);
10191
+ if (currentIndex > 0) {
10192
+ setTimeout(() => {
10193
+ setCurrentStep(stepIds[currentIndex - 1]);
10194
+ }, 100);
10195
+ }
10196
+ };
10197
+ return {
10198
+ currentStep,
10199
+ dialogHeight,
10200
+ visibleStepRef,
10201
+ handleNext,
10202
+ handleBack
10203
+ };
10204
+ };
10111
10205
 
10112
10206
  // components/hooks/useWindowSize.ts
10113
- import { useEffect as useEffect26, useState as useState41 } from "react";
10207
+ import { useEffect as useEffect27, useState as useState42 } from "react";
10114
10208
  var useWindowSize = () => {
10115
- const [windowSize, setWindowSize] = useState41({
10209
+ const [windowSize, setWindowSize] = useState42({
10116
10210
  width: void 0,
10117
10211
  height: void 0
10118
10212
  });
10119
- useEffect26(() => {
10213
+ useEffect27(() => {
10120
10214
  function handleResize() {
10121
10215
  setWindowSize({
10122
10216
  width: window.innerWidth,
@@ -10131,7 +10225,7 @@ var useWindowSize = () => {
10131
10225
  };
10132
10226
 
10133
10227
  // components/hooks/useFocusWithin.ts
10134
- import { useRef as useRef16, useState as useState42, useEffect as useEffect27 } from "react";
10228
+ import { useRef as useRef17, useState as useState43, useEffect as useEffect28 } from "react";
10135
10229
  function containsRelatedTarget(event) {
10136
10230
  if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
10137
10231
  return event.currentTarget.contains(event.relatedTarget);
@@ -10142,9 +10236,9 @@ function useFocusWithin({
10142
10236
  onBlur,
10143
10237
  onFocus
10144
10238
  } = {}) {
10145
- const ref = useRef16(null);
10146
- const [focused, _setFocused] = useState42(false);
10147
- const focusedRef = useRef16(false);
10239
+ const ref = useRef17(null);
10240
+ const [focused, _setFocused] = useState43(false);
10241
+ const focusedRef = useRef17(false);
10148
10242
  const setFocused = (value) => {
10149
10243
  _setFocused(value);
10150
10244
  focusedRef.current = value;
@@ -10161,7 +10255,7 @@ function useFocusWithin({
10161
10255
  onBlur?.(event);
10162
10256
  }
10163
10257
  };
10164
- useEffect27(() => {
10258
+ useEffect28(() => {
10165
10259
  if (ref.current) {
10166
10260
  ref.current.addEventListener("focusin", handleFocusIn);
10167
10261
  ref.current.addEventListener("focusout", handleFocusOut);
@@ -10176,7 +10270,7 @@ function useFocusWithin({
10176
10270
  }
10177
10271
 
10178
10272
  // components/hooks/useMediaQuery.ts
10179
- import { useState as useState43, useEffect as useEffect28, useRef as useRef17 } from "react";
10273
+ import { useState as useState44, useEffect as useEffect29, useRef as useRef18 } from "react";
10180
10274
  function attachMediaListener(query, callback) {
10181
10275
  try {
10182
10276
  query.addEventListener("change", callback);
@@ -10198,11 +10292,11 @@ function getInitialValue(query, initialValue) {
10198
10292
  function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
10199
10293
  getInitialValueInEffect: true
10200
10294
  }) {
10201
- const [matches, setMatches] = useState43(
10295
+ const [matches, setMatches] = useState44(
10202
10296
  getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)
10203
10297
  );
10204
- const queryRef = useRef17();
10205
- useEffect28(() => {
10298
+ const queryRef = useRef18();
10299
+ useEffect29(() => {
10206
10300
  if ("matchMedia" in window) {
10207
10301
  queryRef.current = window.matchMedia(query);
10208
10302
  setMatches(queryRef.current.matches);
@@ -10217,16 +10311,16 @@ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
10217
10311
  }
10218
10312
 
10219
10313
  // components/hooks/useScrollPosition.ts
10220
- import { useState as useState44, useEffect as useEffect29 } from "react";
10314
+ import { useState as useState45, useEffect as useEffect30 } from "react";
10221
10315
 
10222
10316
  // components/hooks/useTable.ts
10223
- import { useState as useState45, useEffect as useEffect30 } from "react";
10317
+ import { useState as useState46, useEffect as useEffect31 } from "react";
10224
10318
 
10225
10319
  // components/hooks/useTabs.ts
10226
- import { useEffect as useEffect31, useState as useState46 } from "react";
10320
+ import { useEffect as useEffect32, useState as useState47 } from "react";
10227
10321
  function useTabs(initialTab = "") {
10228
- const [activeTab, setActiveTab] = useState46(initialTab);
10229
- useEffect31(() => {
10322
+ const [activeTab, setActiveTab] = useState47(initialTab);
10323
+ useEffect32(() => {
10230
10324
  const handleHashChange = () => {
10231
10325
  const hash = window.location.hash.substring(1);
10232
10326
  setActiveTab(hash || initialTab);
@@ -10297,6 +10391,7 @@ export {
10297
10391
  DestroyableCard,
10298
10392
  Dialog,
10299
10393
  DialogBody,
10394
+ DialogCarousel,
10300
10395
  DialogContent,
10301
10396
  DialogDescription,
10302
10397
  DialogFooter,
@@ -10424,9 +10519,11 @@ export {
10424
10519
  toast,
10425
10520
  useBreakpoint,
10426
10521
  useClipboard,
10522
+ useDialogCarousel,
10427
10523
  useFocusWithin,
10428
10524
  useIsomorphicEffect,
10429
10525
  useMediaQuery,
10526
+ useMultiStepDialog,
10430
10527
  useTabs,
10431
10528
  useToast,
10432
10529
  useWindowSize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.16.0-next",
3
+ "version": "0.16.1-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {