@sikka/hawa 0.30.25-next → 0.30.27-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.
Files changed (86) hide show
  1. package/dist/blocks/index.js +345 -211
  2. package/dist/blocks/index.mjs +3 -2
  3. package/dist/blocks/misc/index.js +289 -155
  4. package/dist/blocks/misc/index.mjs +212 -76
  5. package/dist/blocks/pricing/index.mjs +1 -1
  6. package/dist/chunk-R2SKHHDK.mjs +411 -0
  7. package/dist/{chunk-7LAUVLVZ.mjs → chunk-SW7UK35T.mjs} +123 -63
  8. package/dist/{chunk-H7ZADF2Z.mjs → chunk-UDCDD66A.mjs} +8 -0
  9. package/dist/combobox/index.js.map +1 -1
  10. package/dist/combobox/index.mjs.map +1 -1
  11. package/dist/commonTypes-LrR8QrYP.d.mts +5 -0
  12. package/dist/commonTypes-LrR8QrYP.d.ts +5 -0
  13. package/dist/commonTypes-MeUyaBib.d.mts +5 -0
  14. package/dist/commonTypes-MeUyaBib.d.ts +5 -0
  15. package/dist/elements/index.d.mts +5 -1
  16. package/dist/elements/index.d.ts +5 -1
  17. package/dist/elements/index.js +431 -294
  18. package/dist/elements/index.mjs +9 -5
  19. package/dist/floatBox/index.d.mts +14 -0
  20. package/dist/floatBox/index.d.ts +14 -0
  21. package/dist/floatBox/index.js +97 -0
  22. package/dist/floatBox/index.js.map +1 -0
  23. package/dist/floatBox/index.mjs +61 -0
  24. package/dist/floatBox/index.mjs.map +1 -0
  25. package/dist/hooks/index.d.mts +12 -2
  26. package/dist/hooks/index.d.ts +12 -2
  27. package/dist/hooks/index.js +36 -0
  28. package/dist/hooks/index.mjs +16 -340
  29. package/dist/index.css +101 -56
  30. package/dist/index.d.mts +15 -1
  31. package/dist/index.d.ts +15 -1
  32. package/dist/index.js +7860 -7765
  33. package/dist/index.mjs +1529 -1437
  34. package/dist/input/index.d.mts +2 -1
  35. package/dist/input/index.d.ts +2 -1
  36. package/dist/label/index.d.mts +1 -2
  37. package/dist/label/index.d.ts +1 -2
  38. package/dist/layout/index.mjs +3 -4
  39. package/dist/passwordInput/index.js.map +1 -1
  40. package/dist/passwordInput/index.mjs.map +1 -1
  41. package/dist/phoneInput/index.d.mts +2 -1
  42. package/dist/phoneInput/index.d.ts +2 -1
  43. package/dist/popover/index.d.mts +3 -1
  44. package/dist/popover/index.d.ts +3 -1
  45. package/dist/popover/index.js +6 -0
  46. package/dist/popover/index.js.map +1 -1
  47. package/dist/popover/index.mjs +4 -0
  48. package/dist/popover/index.mjs.map +1 -1
  49. package/dist/progress/index.d.mts +8 -1
  50. package/dist/progress/index.d.ts +8 -1
  51. package/dist/radio/index.d.mts +9 -1
  52. package/dist/radio/index.d.ts +9 -1
  53. package/dist/scrollArea/index.d.mts +1 -1
  54. package/dist/scrollArea/index.d.ts +1 -1
  55. package/dist/separator/index.d.mts +1 -1
  56. package/dist/separator/index.d.ts +1 -1
  57. package/dist/signature/index.d.mts +1 -2
  58. package/dist/signature/index.d.ts +1 -2
  59. package/dist/simpleTable/index.d.mts +1 -1
  60. package/dist/simpleTable/index.d.ts +1 -1
  61. package/dist/switch/index.d.mts +2 -1
  62. package/dist/switch/index.d.ts +2 -1
  63. package/dist/tabs/index.d.mts +3 -1
  64. package/dist/tabs/index.d.ts +3 -1
  65. package/dist/tabs/index.js +172 -38
  66. package/dist/tabs/index.js.map +1 -1
  67. package/dist/tabs/index.mjs +172 -38
  68. package/dist/tabs/index.mjs.map +1 -1
  69. package/dist/textarea/index.d.mts +1 -1
  70. package/dist/textarea/index.d.ts +1 -1
  71. package/dist/toast/index.d.mts +1 -1
  72. package/dist/toast/index.d.ts +1 -1
  73. package/dist/toaster/index.d.mts +22 -4
  74. package/dist/toaster/index.d.ts +22 -4
  75. package/dist/tooltip/index.d.mts +3 -4
  76. package/dist/tooltip/index.d.ts +3 -4
  77. package/package.json +8 -8
  78. package/dist/Label-9FHRF7Ex.d.mts +0 -14
  79. package/dist/Label-9FHRF7Ex.d.ts +0 -14
  80. package/dist/chunk-4OOSUQZG.mjs +0 -12
  81. package/dist/chunk-57SB6MBG.mjs +0 -31
  82. package/dist/commonTypes-3k5cNB1s.d.mts +0 -4
  83. package/dist/commonTypes-3k5cNB1s.d.ts +0 -4
  84. package/dist/commonTypes-PBumfOBg.d.mts +0 -3
  85. package/dist/commonTypes-PBumfOBg.d.ts +0 -3
  86. /package/dist/{chunk-CVOMHXJK.mjs → chunk-BXGDHNAY.mjs} +0 -0
@@ -1,346 +1,21 @@
1
1
  "use client";
2
2
  import {
3
- useBreakpoint
4
- } from "../chunk-H7ZADF2Z.mjs";
3
+ reducer,
4
+ toast,
5
+ useClipboard,
6
+ useDialogCarousel,
7
+ useFocusWithin,
8
+ useIsomorphicEffect,
9
+ useMeasureDirty,
10
+ useMediaQuery,
11
+ useMultiStepDialog,
12
+ useTabs,
13
+ useToast,
14
+ useWindowSize
15
+ } from "../chunk-R2SKHHDK.mjs";
5
16
  import {
6
- useClipboard
7
- } from "../chunk-57SB6MBG.mjs";
8
- import "../chunk-4OOSUQZG.mjs";
9
-
10
- // hooks/useIsomorphicEffect.ts
11
- import { useEffect, useLayoutEffect } from "react";
12
- var useIsomorphicEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
13
-
14
- // hooks/useDiscloser.ts
15
- import { useState } from "react";
16
-
17
- // hooks/useHover.ts
18
- import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
19
-
20
- // hooks/useToast.ts
21
- import * as React3 from "react";
22
- var TOAST_LIMIT = 5;
23
- var TOAST_REMOVE_DELAY = 1e5;
24
- var count = 0;
25
- function genId() {
26
- count = (count + 1) % Number.MAX_VALUE;
27
- return count.toString();
28
- }
29
- var toastTimeouts = /* @__PURE__ */ new Map();
30
- var addToRemoveQueue = (toastId) => {
31
- if (toastTimeouts.has(toastId)) {
32
- return;
33
- }
34
- const timeout = setTimeout(() => {
35
- toastTimeouts.delete(toastId);
36
- dispatch({ type: "REMOVE_TOAST", toastId });
37
- }, TOAST_REMOVE_DELAY);
38
- toastTimeouts.set(toastId, timeout);
39
- };
40
- var reducer = (state, action) => {
41
- switch (action.type) {
42
- case "ADD_TOAST":
43
- return {
44
- ...state,
45
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
46
- };
47
- case "UPDATE_TOAST":
48
- return {
49
- ...state,
50
- toasts: state.toasts.map(
51
- (t) => t.id === action.toast.id ? { ...t, ...action.toast } : t
52
- )
53
- };
54
- case "DISMISS_TOAST": {
55
- const { toastId } = action;
56
- if (toastId) {
57
- addToRemoveQueue(toastId);
58
- } else {
59
- state.toasts.forEach((toast2) => {
60
- addToRemoveQueue(toast2.id);
61
- });
62
- }
63
- return {
64
- ...state,
65
- toasts: state.toasts.map(
66
- (t) => t.id === toastId || toastId === void 0 ? { ...t, open: false } : t
67
- )
68
- };
69
- }
70
- case "REMOVE_TOAST":
71
- if (action.toastId === void 0) {
72
- return { ...state, toasts: [] };
73
- }
74
- return {
75
- ...state,
76
- toasts: state.toasts.filter((t) => t.id !== action.toastId)
77
- };
78
- }
79
- };
80
- var listeners = [];
81
- var memoryState = { toasts: [] };
82
- function dispatch(action) {
83
- memoryState = reducer(memoryState, action);
84
- listeners.forEach((listener) => {
85
- listener(memoryState);
86
- });
87
- }
88
- function toast({ ...props }) {
89
- const id = genId();
90
- const update = (props2) => dispatch({ type: "UPDATE_TOAST", toast: { ...props2, id } });
91
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
92
- dispatch({
93
- type: "ADD_TOAST",
94
- toast: {
95
- ...props,
96
- id,
97
- open: true,
98
- onOpenChange: (open) => {
99
- if (!open)
100
- dismiss();
101
- }
102
- }
103
- });
104
- return { id, dismiss, update };
105
- }
106
- function useToast() {
107
- const [state, setState] = React3.useState(memoryState);
108
- React3.useEffect(() => {
109
- listeners.push(setState);
110
- return () => {
111
- const index = listeners.indexOf(setState);
112
- if (index > -1) {
113
- listeners.splice(index, 1);
114
- }
115
- };
116
- }, [state]);
117
- return {
118
- ...state,
119
- toast,
120
- dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId })
121
- };
122
- }
123
-
124
- // hooks/useCarousel.ts
125
- import { useState as useState4, useRef as useRef2 } from "react";
126
-
127
- // hooks/useDialogCarousel.ts
128
- import { useEffect as useEffect4, useState as useState5 } from "react";
129
- import AutoHeight from "embla-carousel-auto-height";
130
- import useEmblaCarousel from "embla-carousel-react";
131
- var useDialogCarousel = (options) => {
132
- const [emblaRef, emblaApi] = useEmblaCarousel(
133
- { loop: false, watchDrag: false, startIndex: 0, ...options },
134
- [AutoHeight({ destroyHeight: "fit", active: true })]
135
- );
136
- const [canScrollPrev, setCanScrollPrev] = useState5(false);
137
- const checkCanScrollPrev = () => {
138
- if (emblaApi) {
139
- setCanScrollPrev(emblaApi.canScrollPrev());
140
- }
141
- };
142
- const nextStep = () => {
143
- if (emblaApi) {
144
- console.log("going to NEXT \u{1F449}");
145
- emblaApi.scrollNext();
146
- }
147
- };
148
- const prevStep = () => {
149
- if (emblaApi) {
150
- console.log("going to BACK \u{1F448}");
151
- emblaApi.scrollPrev();
152
- }
153
- };
154
- useEffect4(() => {
155
- checkCanScrollPrev();
156
- emblaApi && emblaApi.on("select", checkCanScrollPrev);
157
- return () => {
158
- emblaApi && emblaApi.off("select", checkCanScrollPrev);
159
- };
160
- }, [emblaApi]);
161
- return {
162
- emblaRef,
163
- emblaApi,
164
- nextStep,
165
- prevStep,
166
- canScrollPrev
167
- };
168
- };
169
-
170
- // hooks/useDialogSteps.ts
171
- import { useState as useState6, useEffect as useEffect5, useRef as useRef3 } from "react";
172
- var useMultiStepDialog = (initialStep, stepIds, setOpenDialog) => {
173
- const [currentStep, setCurrentStep] = useState6(initialStep);
174
- const [dialogHeight, setDialogHeight] = useState6(null);
175
- const visibleStepRef = useRef3(null);
176
- useEffect5(() => {
177
- if (visibleStepRef.current) {
178
- setDialogHeight(visibleStepRef.current.offsetHeight);
179
- }
180
- }, [currentStep, setOpenDialog]);
181
- const handleNext = () => {
182
- const currentIndex = stepIds.indexOf(currentStep);
183
- if (currentIndex < stepIds.length - 1) {
184
- setTimeout(() => {
185
- setCurrentStep(stepIds[currentIndex + 1]);
186
- }, 100);
187
- }
188
- };
189
- const handleBack = () => {
190
- const currentIndex = stepIds.indexOf(currentStep);
191
- if (currentIndex > 0) {
192
- setTimeout(() => {
193
- setCurrentStep(stepIds[currentIndex - 1]);
194
- }, 100);
195
- }
196
- };
197
- return {
198
- currentStep,
199
- dialogHeight,
200
- visibleStepRef,
201
- handleNext,
202
- handleBack
203
- };
204
- };
205
-
206
- // hooks/useWindowSize.ts
207
- import { useEffect as useEffect6, useState as useState7 } from "react";
208
- var useWindowSize = () => {
209
- const [windowSize, setWindowSize] = useState7({
210
- width: void 0,
211
- height: void 0
212
- });
213
- useEffect6(() => {
214
- function handleResize() {
215
- setWindowSize({
216
- width: window.innerWidth,
217
- height: window.innerHeight
218
- });
219
- }
220
- window.addEventListener("resize", handleResize);
221
- handleResize();
222
- return () => window.removeEventListener("resize", handleResize);
223
- }, []);
224
- return windowSize;
225
- };
226
-
227
- // hooks/useFocusWithin.ts
228
- import { useRef as useRef4, useState as useState8, useEffect as useEffect7 } from "react";
229
- function containsRelatedTarget(event) {
230
- if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
231
- return event.currentTarget.contains(event.relatedTarget);
232
- }
233
- return false;
234
- }
235
- function useFocusWithin({
236
- onBlur,
237
- onFocus
238
- } = {}) {
239
- const ref = useRef4(null);
240
- const [focused, _setFocused] = useState8(false);
241
- const focusedRef = useRef4(false);
242
- const setFocused = (value) => {
243
- _setFocused(value);
244
- focusedRef.current = value;
245
- };
246
- const handleFocusIn = (event) => {
247
- if (!focusedRef.current) {
248
- setFocused(true);
249
- onFocus == null ? void 0 : onFocus(event);
250
- }
251
- };
252
- const handleFocusOut = (event) => {
253
- if (focusedRef.current && !containsRelatedTarget(event)) {
254
- setFocused(false);
255
- onBlur == null ? void 0 : onBlur(event);
256
- }
257
- };
258
- useEffect7(() => {
259
- if (ref.current) {
260
- ref.current.addEventListener("focusin", handleFocusIn);
261
- ref.current.addEventListener("focusout", handleFocusOut);
262
- return () => {
263
- var _a, _b;
264
- (_a = ref.current) == null ? void 0 : _a.removeEventListener("focusin", handleFocusIn);
265
- (_b = ref.current) == null ? void 0 : _b.removeEventListener("focusout", handleFocusOut);
266
- };
267
- }
268
- return void 0;
269
- }, [handleFocusIn, handleFocusOut]);
270
- return { ref, focused };
271
- }
272
-
273
- // hooks/useMediaQuery.ts
274
- import { useState as useState9, useEffect as useEffect8, useRef as useRef5 } from "react";
275
- function attachMediaListener(query, callback) {
276
- try {
277
- query.addEventListener("change", callback);
278
- return () => query.removeEventListener("change", callback);
279
- } catch (e) {
280
- query.addListener(callback);
281
- return () => query.removeListener(callback);
282
- }
283
- }
284
- function getInitialValue(query, initialValue) {
285
- if (typeof initialValue === "boolean") {
286
- return initialValue;
287
- }
288
- if (typeof window !== "undefined" && "matchMedia" in window) {
289
- return window.matchMedia(query).matches;
290
- }
291
- return false;
292
- }
293
- function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
294
- getInitialValueInEffect: true
295
- }) {
296
- const [matches, setMatches] = useState9(
297
- getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)
298
- );
299
- const queryRef = useRef5();
300
- useEffect8(() => {
301
- if ("matchMedia" in window) {
302
- queryRef.current = window.matchMedia(query);
303
- setMatches(queryRef.current.matches);
304
- return attachMediaListener(
305
- queryRef.current,
306
- (event) => setMatches(event.matches)
307
- );
308
- }
309
- return void 0;
310
- }, [query]);
311
- return matches;
312
- }
313
-
314
- // hooks/useScrollPosition.ts
315
- import { useState as useState10, useEffect as useEffect9 } from "react";
316
-
317
- // hooks/useTable.ts
318
- import { useState as useState11, useEffect as useEffect10 } from "react";
319
-
320
- // hooks/useTabs.ts
321
- import { useEffect as useEffect11, useState as useState12 } from "react";
322
- function useTabs(initialTab = "") {
323
- const [activeTab, setActiveTab] = useState12(initialTab);
324
- useEffect11(() => {
325
- const handleHashChange = () => {
326
- const hash = window.location.hash.substring(1);
327
- setActiveTab(hash || initialTab);
328
- };
329
- window.addEventListener("hashchange", handleHashChange);
330
- handleHashChange();
331
- return () => {
332
- window.removeEventListener("hashchange", handleHashChange);
333
- };
334
- }, [initialTab]);
335
- const handleTabChange = (index) => {
336
- setActiveTab(index);
337
- window.location.hash = index;
338
- };
339
- return {
340
- activeTab,
341
- handleTabChange
342
- };
343
- }
17
+ useBreakpoint
18
+ } from "../chunk-UDCDD66A.mjs";
344
19
  export {
345
20
  reducer,
346
21
  toast,
@@ -349,6 +24,7 @@ export {
349
24
  useDialogCarousel,
350
25
  useFocusWithin,
351
26
  useIsomorphicEffect,
27
+ useMeasureDirty,
352
28
  useMediaQuery,
353
29
  useMultiStepDialog,
354
30
  useTabs,