@sikka/hawa 0.21.11-next → 0.21.13-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.
@@ -1,8 +1,11 @@
1
- export { Accordion, AccordionContent, AccordionTrigger } from '../chunk-TIP3WZV6.mjs';
1
+ export { Accordion, AccordionContent, AccordionTrigger } from '../chunk-SMZ7Z4DO.mjs';
2
+ import '../chunk-NFLMC26M.mjs';
3
+ import '../chunk-L55L4HKN.mjs';
4
+ import '../chunk-LZAC5DLW.mjs';
2
5
  import '../chunk-J5NJEHQU.mjs';
6
+ import '../chunk-C4CBXIG5.mjs';
3
7
  import '../chunk-PUQV6URH.mjs';
4
8
  import '../chunk-ENZDFGFY.mjs';
5
- import '../chunk-C4CBXIG5.mjs';
6
9
  import { cn } from '../chunk-TE3BKEXL.mjs';
7
10
  import * as React from 'react';
8
11
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
@@ -0,0 +1,53 @@
1
+ import { cn } from './chunk-TE3BKEXL.mjs';
2
+ import React from 'react';
3
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
4
+
5
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(
6
+ TooltipPrimitive.Content,
7
+ {
8
+ ref,
9
+ sideOffset,
10
+ className: cn(
11
+ "hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
12
+ className
13
+ ),
14
+ ...props
15
+ }
16
+ ));
17
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
18
+ var TooltipArrow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Arrow, { ref, className: cn(className), ...props }));
19
+ TooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;
20
+ var Tooltip = ({
21
+ side,
22
+ open,
23
+ content,
24
+ children,
25
+ defaultOpen,
26
+ onOpenChange,
27
+ triggerProps,
28
+ contentProps,
29
+ providerProps,
30
+ delayDuration = 300,
31
+ ...props
32
+ }) => {
33
+ return /* @__PURE__ */ React.createElement(
34
+ TooltipPrimitive.TooltipProvider,
35
+ {
36
+ delayDuration,
37
+ ...providerProps
38
+ },
39
+ /* @__PURE__ */ React.createElement(
40
+ TooltipPrimitive.Root,
41
+ {
42
+ open,
43
+ defaultOpen,
44
+ onOpenChange,
45
+ ...props
46
+ },
47
+ /* @__PURE__ */ React.createElement(TooltipPrimitive.Trigger, { ...triggerProps }, children),
48
+ /* @__PURE__ */ React.createElement(TooltipContent, { side, align: "center", ...contentProps }, content)
49
+ )
50
+ );
51
+ };
52
+
53
+ export { Tooltip };
@@ -0,0 +1,140 @@
1
+ import * as React from 'react';
2
+ import { useState } from 'react';
3
+
4
+ // components/hooks/useClipboard.ts
5
+ function useClipboard({ timeout = 2e3 } = {}) {
6
+ const [error, setError] = useState(null);
7
+ const [copied, setCopied] = useState(false);
8
+ const [copyTimeout, setCopyTimeout] = useState(null);
9
+ const handleCopyResult = (value) => {
10
+ clearTimeout(copyTimeout);
11
+ setCopyTimeout(setTimeout(() => setCopied(false), timeout));
12
+ setCopied(value);
13
+ };
14
+ const copy = (valueToCopy) => {
15
+ if ("clipboard" in navigator) {
16
+ navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch((err) => setError(err));
17
+ } else {
18
+ setError(new Error("useClipboard: navigator.clipboard is not supported"));
19
+ }
20
+ };
21
+ const reset = () => {
22
+ setCopied(false);
23
+ setError(null);
24
+ clearTimeout(copyTimeout);
25
+ };
26
+ return { copy, reset, error, copied };
27
+ }
28
+ var TOAST_LIMIT = 5;
29
+ var TOAST_REMOVE_DELAY = 1e5;
30
+ var count = 0;
31
+ function genId() {
32
+ count = (count + 1) % Number.MAX_VALUE;
33
+ return count.toString();
34
+ }
35
+ var toastTimeouts = /* @__PURE__ */ new Map();
36
+ var addToRemoveQueue = (toastId) => {
37
+ if (toastTimeouts.has(toastId)) {
38
+ return;
39
+ }
40
+ const timeout = setTimeout(() => {
41
+ toastTimeouts.delete(toastId);
42
+ dispatch({
43
+ type: "REMOVE_TOAST",
44
+ toastId
45
+ });
46
+ }, TOAST_REMOVE_DELAY);
47
+ toastTimeouts.set(toastId, timeout);
48
+ };
49
+ var reducer = (state, action) => {
50
+ switch (action.type) {
51
+ case "ADD_TOAST":
52
+ return {
53
+ ...state,
54
+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
55
+ };
56
+ case "UPDATE_TOAST":
57
+ return {
58
+ ...state,
59
+ toasts: state.toasts.map(
60
+ (t) => t.id === action.toast.id ? { ...t, ...action.toast } : t
61
+ )
62
+ };
63
+ case "DISMISS_TOAST": {
64
+ const { toastId } = action;
65
+ if (toastId) {
66
+ addToRemoveQueue(toastId);
67
+ } else {
68
+ state.toasts.forEach((toast2) => {
69
+ addToRemoveQueue(toast2.id);
70
+ });
71
+ }
72
+ return {
73
+ ...state,
74
+ toasts: state.toasts.map(
75
+ (t) => t.id === toastId || toastId === void 0 ? { ...t, open: false } : t
76
+ )
77
+ };
78
+ }
79
+ case "REMOVE_TOAST":
80
+ if (action.toastId === void 0) {
81
+ return { ...state, toasts: [] };
82
+ }
83
+ return {
84
+ ...state,
85
+ toasts: state.toasts.filter((t) => t.id !== action.toastId)
86
+ };
87
+ }
88
+ };
89
+ var listeners = [];
90
+ var memoryState = { toasts: [] };
91
+ function dispatch(action) {
92
+ memoryState = reducer(memoryState, action);
93
+ listeners.forEach((listener) => {
94
+ listener(memoryState);
95
+ });
96
+ }
97
+ function toast({ ...props }) {
98
+ const id = genId();
99
+ const update = (props2) => dispatch({
100
+ type: "UPDATE_TOAST",
101
+ toast: { ...props2, id }
102
+ });
103
+ const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
104
+ dispatch({
105
+ type: "ADD_TOAST",
106
+ toast: {
107
+ ...props,
108
+ id,
109
+ open: true,
110
+ onOpenChange: (open) => {
111
+ if (!open)
112
+ dismiss();
113
+ }
114
+ }
115
+ });
116
+ return {
117
+ id,
118
+ dismiss,
119
+ update
120
+ };
121
+ }
122
+ function useToast() {
123
+ const [state, setState] = React.useState(memoryState);
124
+ React.useEffect(() => {
125
+ listeners.push(setState);
126
+ return () => {
127
+ const index = listeners.indexOf(setState);
128
+ if (index > -1) {
129
+ listeners.splice(index, 1);
130
+ }
131
+ };
132
+ }, [state]);
133
+ return {
134
+ ...state,
135
+ toast,
136
+ dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId })
137
+ };
138
+ }
139
+
140
+ export { reducer, toast, useClipboard, useToast };
@@ -0,0 +1,155 @@
1
+ import { cn } from './chunk-TE3BKEXL.mjs';
2
+ import * as React from 'react';
3
+ import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
4
+ import { cva } from 'class-variance-authority';
5
+
6
+ var navigationMenuTriggerStyle = cva(
7
+ "hawa-group hawa-inline-flex hawa-h-10 hawa-w-max hawa-items-center hawa-gap-1 hawa-justify-center hawa-rounded-md hawa-bg-background hawa-px-4 hawa-py-2 hawa-text-sm hawa-font-medium hawa-transition-colors hover:hawa-bg-accent hover:hawa-text-accent-foreground focus:hawa-bg-accent focus:hawa-text-accent-foreground focus:hawa-outline-none disabled:hawa-pointer-events-none disabled:hawa-opacity-50 data-[active]:hawa-bg-accent/50 "
8
+ );
9
+ var NavigationMenuRoot = React.forwardRef(({ className, children, viewportClassNames, ...props }, ref) => /* @__PURE__ */ React.createElement(
10
+ NavigationMenuPrimitive.Root,
11
+ {
12
+ ref,
13
+ className: cn(
14
+ "hawa-relative hawa-z-10 hawa-flex hawa-flex-1 hawa-items-center hawa-justify-center",
15
+ // "hawa-max-w-max",
16
+ className
17
+ ),
18
+ ...props
19
+ },
20
+ children,
21
+ /* @__PURE__ */ React.createElement(NavigationMenuViewport, { className: viewportClassNames })
22
+ ));
23
+ var NavigationMenuList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
24
+ NavigationMenuPrimitive.List,
25
+ {
26
+ ref,
27
+ className: cn(
28
+ "hawa-group hawa-flex hawa-flex-1 hawa-list-none hawa-items-center hawa-justify-center hawa-gap-1",
29
+ className
30
+ ),
31
+ ...props
32
+ }
33
+ ));
34
+ var NavigationMenuTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
35
+ NavigationMenuPrimitive.Trigger,
36
+ {
37
+ ref,
38
+ className: cn(navigationMenuTriggerStyle(), "hawa-group", className),
39
+ ...props
40
+ },
41
+ children,
42
+ /* @__PURE__ */ React.createElement(
43
+ "svg",
44
+ {
45
+ "aria-label": "Chevron Icon",
46
+ xmlns: "http://www.w3.org/2000/svg",
47
+ width: "24",
48
+ height: "24",
49
+ viewBox: "0 0 24 24",
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: "2",
53
+ strokeLinecap: "round",
54
+ strokeLinejoin: "round",
55
+ "aria-hidden": "true",
56
+ className: "hawa-icon hawa-relative hawa-top-[1px] hawa-transition hawa-duration-200 group-data-[state=open]:hawa-rotate-180"
57
+ },
58
+ /* @__PURE__ */ React.createElement("path", { d: "m6 9 6 6 6-6" })
59
+ )
60
+ ));
61
+ var NavigationMenuContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
62
+ NavigationMenuPrimitive.Content,
63
+ {
64
+ ref,
65
+ className: cn(
66
+ "hawa-absolute hawa-left-0 hawa-top-0 hawa-w-full hawa-rounded ",
67
+ // "md:hawa-absolute md:hawa-w-auto hawa-left-0 hawa-top-0 ",
68
+ // animation
69
+ "data-[motion^=from-]:hawa-animate-in data-[motion^=to-]:hawa-animate-out data-[motion^=from-]:hawa-fade-in data-[motion^=to-]:hawa-fade-out data-[motion=from-end]:hawa-slide-in-from-right-52 data-[motion=from-start]:hawa-slide-in-from-left-52 data-[motion=to-end]:hawa-slide-out-to-right-52 data-[motion=to-start]:hawa-slide-out-to-left-52",
70
+ className
71
+ ),
72
+ ...props
73
+ }
74
+ ));
75
+ var StandardNavigationMenuItem = ({ icon, title, subtitle, ...linkProps }) => /* @__PURE__ */ React.createElement(NavigationMenuLink, { ...linkProps }, /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-max-w-md hawa-cursor-pointer hawa-flex-row hawa-items-center hawa-gap-4 hawa-rounded-inner hawa-p-4 hawa-py-2 hawa-transition-all hover:hawa-bg-muted" }, icon && icon, /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ React.createElement("h1", { className: "hawa-text-xl hawa-font-bold" }, title), /* @__PURE__ */ React.createElement("p", { className: "hawa-text-sm" }, subtitle))));
76
+ var NavigationMenuViewport = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
77
+ "div",
78
+ {
79
+ className: cn(
80
+ "hawa-absolute hawa-top-full hawa-flex hawa-w-full hawa-justify-center"
81
+ )
82
+ },
83
+ /* @__PURE__ */ React.createElement(
84
+ NavigationMenuPrimitive.Viewport,
85
+ {
86
+ className: cn(
87
+ "hawa-origin-top-center hawa-relative hawa-mt-1.5 hawa-w-full hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-90 ",
88
+ // hawa-h-[var(--radix-navigation-menu-viewport-height)]
89
+ // "md:hawa-w-[var(--radix-navigation-menu-viewport-width)]",
90
+ className
91
+ ),
92
+ style: {
93
+ height: "calc(var(--radix-navigation-menu-viewport-height) + 1px)"
94
+ },
95
+ ref,
96
+ ...props
97
+ }
98
+ )
99
+ ));
100
+ var NavigationMenuIndicator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
101
+ NavigationMenuPrimitive.Indicator,
102
+ {
103
+ ref,
104
+ className: cn(
105
+ "hawa-top-full hawa-z-[1] hawa-flex hawa-h-1.5 hawa-items-end hawa-justify-center hawa-overflow-hidden data-[state=visible]:hawa-animate-in data-[state=hidden]:hawa-animate-out data-[state=hidden]:hawa-fade-out data-[state=visible]:hawa-fade-in",
106
+ className
107
+ ),
108
+ ...props
109
+ },
110
+ /* @__PURE__ */ React.createElement("div", { className: "hawa-relative hawa-top-[60%] hawa-h-2 hawa-w-2 hawa-rotate-45 hawa-rounded-tl-sm hawa-bg-border hawa-shadow-md" })
111
+ ));
112
+ var NavigationMenu = ({
113
+ viewportClassNames,
114
+ rootClassNames,
115
+ triggerClassNames,
116
+ actionFirst,
117
+ ...props
118
+ }) => {
119
+ return /* @__PURE__ */ React.createElement(
120
+ NavigationMenuRoot,
121
+ {
122
+ dir: props.direction,
123
+ delayDuration: 0,
124
+ className: rootClassNames,
125
+ viewportClassNames
126
+ },
127
+ /* @__PURE__ */ React.createElement(NavigationMenuList, null, props.items.map((item, i) => /* @__PURE__ */ React.createElement(NavigationMenuItem, { key: i }, item.content ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(NavigationMenuTrigger, { className: cn(triggerClassNames) }, item.trigger), /* @__PURE__ */ React.createElement(NavigationMenuContent, null, item.content)) : /* @__PURE__ */ React.createElement(
128
+ NavigationMenuLink,
129
+ {
130
+ href: actionFirst ? void 0 : item.path,
131
+ onClick: () => {
132
+ if (item.action) {
133
+ item.action();
134
+ }
135
+ },
136
+ className: cn(
137
+ navigationMenuTriggerStyle(),
138
+ "hawa-cursor-pointer hawa-select-none",
139
+ triggerClassNames
140
+ )
141
+ },
142
+ item.trigger
143
+ ))))
144
+ );
145
+ };
146
+ var NavigationMenuItem = NavigationMenuPrimitive.Item;
147
+ var NavigationMenuLink = NavigationMenuPrimitive.Link;
148
+ NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
149
+ NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
150
+ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
151
+ NavigationMenuRoot.displayName = NavigationMenuPrimitive.Root.displayName;
152
+ NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
153
+ NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName;
154
+
155
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, StandardNavigationMenuItem, navigationMenuTriggerStyle };
@@ -0,0 +1,216 @@
1
+ import { useLayoutEffect, useEffect, useState, useRef } from 'react';
2
+ import AutoHeight from 'embla-carousel-auto-height';
3
+ import useEmblaCarousel from 'embla-carousel-react';
4
+
5
+ // components/hooks/useIsomorphicEffect.ts
6
+ var useIsomorphicEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
7
+ var useDialogCarousel = (options) => {
8
+ const [emblaRef, emblaApi] = useEmblaCarousel(
9
+ { loop: false, watchDrag: false, startIndex: 0, ...options },
10
+ [AutoHeight({ destroyHeight: "fit", active: true })]
11
+ );
12
+ const [canScrollPrev, setCanScrollPrev] = useState(false);
13
+ const checkCanScrollPrev = () => {
14
+ if (emblaApi) {
15
+ setCanScrollPrev(emblaApi.canScrollPrev());
16
+ }
17
+ };
18
+ const nextStep = () => {
19
+ if (emblaApi) {
20
+ console.log("going to NEXT \u{1F449}");
21
+ emblaApi.scrollNext();
22
+ }
23
+ };
24
+ const prevStep = () => {
25
+ if (emblaApi) {
26
+ console.log("going to BACK \u{1F448}");
27
+ emblaApi.scrollPrev();
28
+ }
29
+ };
30
+ useEffect(() => {
31
+ checkCanScrollPrev();
32
+ emblaApi && emblaApi.on("select", checkCanScrollPrev);
33
+ return () => {
34
+ emblaApi && emblaApi.off("select", checkCanScrollPrev);
35
+ };
36
+ }, [emblaApi]);
37
+ return {
38
+ emblaRef,
39
+ emblaApi,
40
+ nextStep,
41
+ prevStep,
42
+ canScrollPrev
43
+ };
44
+ };
45
+ var useMultiStepDialog = (initialStep, stepIds, setOpenDialog) => {
46
+ const [currentStep, setCurrentStep] = useState(initialStep);
47
+ const [dialogHeight, setDialogHeight] = useState(null);
48
+ const visibleStepRef = useRef(null);
49
+ useEffect(() => {
50
+ if (visibleStepRef.current) {
51
+ setDialogHeight(visibleStepRef.current.offsetHeight);
52
+ }
53
+ }, [currentStep, setOpenDialog]);
54
+ const handleNext = () => {
55
+ const currentIndex = stepIds.indexOf(currentStep);
56
+ if (currentIndex < stepIds.length - 1) {
57
+ setTimeout(() => {
58
+ setCurrentStep(stepIds[currentIndex + 1]);
59
+ }, 100);
60
+ }
61
+ };
62
+ const handleBack = () => {
63
+ const currentIndex = stepIds.indexOf(currentStep);
64
+ if (currentIndex > 0) {
65
+ setTimeout(() => {
66
+ setCurrentStep(stepIds[currentIndex - 1]);
67
+ }, 100);
68
+ }
69
+ };
70
+ return {
71
+ currentStep,
72
+ dialogHeight,
73
+ visibleStepRef,
74
+ handleNext,
75
+ handleBack
76
+ };
77
+ };
78
+ var useBreakpoint = () => {
79
+ const [breakpoint, setBreakpoint] = useState(null);
80
+ useEffect(() => {
81
+ if (typeof window !== "undefined") {
82
+ const resize = () => {
83
+ setBreakpoint(window.innerWidth);
84
+ };
85
+ resize();
86
+ window.addEventListener("resize", resize);
87
+ return () => {
88
+ window.removeEventListener("resize", resize);
89
+ };
90
+ }
91
+ }, []);
92
+ return breakpoint;
93
+ };
94
+ var useWindowSize = () => {
95
+ const [windowSize, setWindowSize] = useState({
96
+ width: void 0,
97
+ height: void 0
98
+ });
99
+ useEffect(() => {
100
+ function handleResize() {
101
+ setWindowSize({
102
+ width: window.innerWidth,
103
+ height: window.innerHeight
104
+ });
105
+ }
106
+ window.addEventListener("resize", handleResize);
107
+ handleResize();
108
+ return () => window.removeEventListener("resize", handleResize);
109
+ }, []);
110
+ return windowSize;
111
+ };
112
+ function containsRelatedTarget(event) {
113
+ if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
114
+ return event.currentTarget.contains(event.relatedTarget);
115
+ }
116
+ return false;
117
+ }
118
+ function useFocusWithin({
119
+ onBlur,
120
+ onFocus
121
+ } = {}) {
122
+ const ref = useRef(null);
123
+ const [focused, _setFocused] = useState(false);
124
+ const focusedRef = useRef(false);
125
+ const setFocused = (value) => {
126
+ _setFocused(value);
127
+ focusedRef.current = value;
128
+ };
129
+ const handleFocusIn = (event) => {
130
+ if (!focusedRef.current) {
131
+ setFocused(true);
132
+ onFocus == null ? void 0 : onFocus(event);
133
+ }
134
+ };
135
+ const handleFocusOut = (event) => {
136
+ if (focusedRef.current && !containsRelatedTarget(event)) {
137
+ setFocused(false);
138
+ onBlur == null ? void 0 : onBlur(event);
139
+ }
140
+ };
141
+ useEffect(() => {
142
+ if (ref.current) {
143
+ ref.current.addEventListener("focusin", handleFocusIn);
144
+ ref.current.addEventListener("focusout", handleFocusOut);
145
+ return () => {
146
+ var _a, _b;
147
+ (_a = ref.current) == null ? void 0 : _a.removeEventListener("focusin", handleFocusIn);
148
+ (_b = ref.current) == null ? void 0 : _b.removeEventListener("focusout", handleFocusOut);
149
+ };
150
+ }
151
+ return void 0;
152
+ }, [handleFocusIn, handleFocusOut]);
153
+ return { ref, focused };
154
+ }
155
+ function attachMediaListener(query, callback) {
156
+ try {
157
+ query.addEventListener("change", callback);
158
+ return () => query.removeEventListener("change", callback);
159
+ } catch (e) {
160
+ query.addListener(callback);
161
+ return () => query.removeListener(callback);
162
+ }
163
+ }
164
+ function getInitialValue(query, initialValue) {
165
+ if (typeof initialValue === "boolean") {
166
+ return initialValue;
167
+ }
168
+ if (typeof window !== "undefined" && "matchMedia" in window) {
169
+ return window.matchMedia(query).matches;
170
+ }
171
+ return false;
172
+ }
173
+ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
174
+ getInitialValueInEffect: true
175
+ }) {
176
+ const [matches, setMatches] = useState(
177
+ getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)
178
+ );
179
+ const queryRef = useRef();
180
+ useEffect(() => {
181
+ if ("matchMedia" in window) {
182
+ queryRef.current = window.matchMedia(query);
183
+ setMatches(queryRef.current.matches);
184
+ return attachMediaListener(
185
+ queryRef.current,
186
+ (event) => setMatches(event.matches)
187
+ );
188
+ }
189
+ return void 0;
190
+ }, [query]);
191
+ return matches;
192
+ }
193
+ function useTabs(initialTab = "") {
194
+ const [activeTab, setActiveTab] = useState(initialTab);
195
+ useEffect(() => {
196
+ const handleHashChange = () => {
197
+ const hash = window.location.hash.substring(1);
198
+ setActiveTab(hash || initialTab);
199
+ };
200
+ window.addEventListener("hashchange", handleHashChange);
201
+ handleHashChange();
202
+ return () => {
203
+ window.removeEventListener("hashchange", handleHashChange);
204
+ };
205
+ }, [initialTab]);
206
+ const handleTabChange = (index) => {
207
+ setActiveTab(index);
208
+ window.location.hash = index;
209
+ };
210
+ return {
211
+ activeTab,
212
+ handleTabChange
213
+ };
214
+ }
215
+
216
+ export { useBreakpoint, useDialogCarousel, useFocusWithin, useIsomorphicEffect, useMediaQuery, useMultiStepDialog, useTabs, useWindowSize };