@sikka/hawa 0.23.9-next → 0.23.10-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 (38) hide show
  1. package/dist/DropdownMenu-jh4puuXw.d.ts +95 -0
  2. package/dist/DropdownMenu-vm2kRAhL.d.mts +95 -0
  3. package/dist/Radio-2ZwcMDWt.d.ts +74 -0
  4. package/dist/Radio-5ZANA8Vh.d.mts +74 -0
  5. package/dist/SimpleTable-EE4ejgUR.d.mts +97 -0
  6. package/dist/SimpleTable-vY1ziD-2.d.ts +97 -0
  7. package/dist/Toast-jAb16JQg.d.mts +23 -0
  8. package/dist/Toast-xcELwcIX.d.ts +23 -0
  9. package/dist/blocks/index.d.mts +480 -0
  10. package/dist/blocks/index.d.ts +480 -0
  11. package/dist/blocks/index.js +8119 -0
  12. package/dist/blocks/index.mjs +2535 -0
  13. package/dist/chunk-2R2QPJT7.mjs +7519 -0
  14. package/dist/chunk-343SRWR4.mjs +146 -0
  15. package/dist/chunk-FNVYY7ND.mjs +22 -0
  16. package/dist/commonTypes-CKtkuNFH.d.mts +11 -0
  17. package/dist/commonTypes-CKtkuNFH.d.ts +11 -0
  18. package/dist/elements/index.d.mts +715 -0
  19. package/dist/elements/index.d.ts +715 -0
  20. package/dist/elements/index.js +7719 -0
  21. package/dist/elements/index.mjs +285 -0
  22. package/dist/hooks/index.d.mts +107 -0
  23. package/dist/hooks/index.d.ts +107 -0
  24. package/dist/hooks/index.js +451 -0
  25. package/dist/hooks/index.mjs +254 -0
  26. package/dist/index.d.mts +1905 -0
  27. package/dist/index.d.ts +1905 -0
  28. package/dist/index.js +11987 -0
  29. package/dist/index.mjs +11760 -0
  30. package/dist/layout/index.d.mts +249 -0
  31. package/dist/layout/index.d.ts +249 -0
  32. package/dist/layout/index.js +4373 -0
  33. package/dist/layout/index.mjs +1381 -0
  34. package/dist/types/index.d.mts +115 -0
  35. package/dist/types/index.d.ts +115 -0
  36. package/dist/types/index.js +18 -0
  37. package/dist/types/index.mjs +0 -0
  38. package/package.json +1 -1
@@ -0,0 +1,146 @@
1
+ // components/hooks/useToast.ts
2
+ import * as React from "react";
3
+ var TOAST_LIMIT = 5;
4
+ var TOAST_REMOVE_DELAY = 1e5;
5
+ var count = 0;
6
+ function genId() {
7
+ count = (count + 1) % Number.MAX_VALUE;
8
+ return count.toString();
9
+ }
10
+ var toastTimeouts = /* @__PURE__ */ new Map();
11
+ var addToRemoveQueue = (toastId) => {
12
+ if (toastTimeouts.has(toastId)) {
13
+ return;
14
+ }
15
+ const timeout = setTimeout(() => {
16
+ toastTimeouts.delete(toastId);
17
+ dispatch({
18
+ type: "REMOVE_TOAST",
19
+ toastId
20
+ });
21
+ }, TOAST_REMOVE_DELAY);
22
+ toastTimeouts.set(toastId, timeout);
23
+ };
24
+ var reducer = (state, action) => {
25
+ switch (action.type) {
26
+ case "ADD_TOAST":
27
+ return {
28
+ ...state,
29
+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
30
+ };
31
+ case "UPDATE_TOAST":
32
+ return {
33
+ ...state,
34
+ toasts: state.toasts.map(
35
+ (t) => t.id === action.toast.id ? { ...t, ...action.toast } : t
36
+ )
37
+ };
38
+ case "DISMISS_TOAST": {
39
+ const { toastId } = action;
40
+ if (toastId) {
41
+ addToRemoveQueue(toastId);
42
+ } else {
43
+ state.toasts.forEach((toast2) => {
44
+ addToRemoveQueue(toast2.id);
45
+ });
46
+ }
47
+ return {
48
+ ...state,
49
+ toasts: state.toasts.map(
50
+ (t) => t.id === toastId || toastId === void 0 ? { ...t, open: false } : t
51
+ )
52
+ };
53
+ }
54
+ case "REMOVE_TOAST":
55
+ if (action.toastId === void 0) {
56
+ return { ...state, toasts: [] };
57
+ }
58
+ return {
59
+ ...state,
60
+ toasts: state.toasts.filter((t) => t.id !== action.toastId)
61
+ };
62
+ }
63
+ };
64
+ var listeners = [];
65
+ var memoryState = { toasts: [] };
66
+ function dispatch(action) {
67
+ memoryState = reducer(memoryState, action);
68
+ listeners.forEach((listener) => {
69
+ listener(memoryState);
70
+ });
71
+ }
72
+ function toast({ ...props }) {
73
+ const id = genId();
74
+ const update = (props2) => dispatch({
75
+ type: "UPDATE_TOAST",
76
+ toast: { ...props2, id }
77
+ });
78
+ const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
79
+ dispatch({
80
+ type: "ADD_TOAST",
81
+ toast: {
82
+ ...props,
83
+ id,
84
+ open: true,
85
+ onOpenChange: (open) => {
86
+ if (!open)
87
+ dismiss();
88
+ }
89
+ }
90
+ });
91
+ return {
92
+ id,
93
+ dismiss,
94
+ update
95
+ };
96
+ }
97
+ function useToast() {
98
+ const [state, setState] = React.useState(memoryState);
99
+ React.useEffect(() => {
100
+ listeners.push(setState);
101
+ return () => {
102
+ const index = listeners.indexOf(setState);
103
+ if (index > -1) {
104
+ listeners.splice(index, 1);
105
+ }
106
+ };
107
+ }, [state]);
108
+ return {
109
+ ...state,
110
+ toast,
111
+ dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId })
112
+ };
113
+ }
114
+
115
+ // components/hooks/useClipboard.ts
116
+ import { useState as useState2 } from "react";
117
+ function useClipboard({ timeout = 2e3 } = {}) {
118
+ const [error, setError] = useState2(null);
119
+ const [copied, setCopied] = useState2(false);
120
+ const [copyTimeout, setCopyTimeout] = useState2(null);
121
+ const handleCopyResult = (value) => {
122
+ clearTimeout(copyTimeout);
123
+ setCopyTimeout(setTimeout(() => setCopied(false), timeout));
124
+ setCopied(value);
125
+ };
126
+ const copy = (valueToCopy) => {
127
+ if ("clipboard" in navigator) {
128
+ navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch((err) => setError(err));
129
+ } else {
130
+ setError(new Error("useClipboard: navigator.clipboard is not supported"));
131
+ }
132
+ };
133
+ const reset = () => {
134
+ setCopied(false);
135
+ setError(null);
136
+ clearTimeout(copyTimeout);
137
+ };
138
+ return { copy, reset, error, copied };
139
+ }
140
+
141
+ export {
142
+ reducer,
143
+ toast,
144
+ useToast,
145
+ useClipboard
146
+ };
@@ -0,0 +1,22 @@
1
+ // components/hooks/useBreakpoint.ts
2
+ import { useState, useEffect } from "react";
3
+ var useBreakpoint = () => {
4
+ const [breakpoint, setBreakpoint] = useState(null);
5
+ useEffect(() => {
6
+ if (typeof window !== "undefined") {
7
+ const resize = () => {
8
+ setBreakpoint(window.innerWidth);
9
+ };
10
+ resize();
11
+ window.addEventListener("resize", resize);
12
+ return () => {
13
+ window.removeEventListener("resize", resize);
14
+ };
15
+ }
16
+ }, []);
17
+ return breakpoint;
18
+ };
19
+
20
+ export {
21
+ useBreakpoint
22
+ };
@@ -0,0 +1,11 @@
1
+ type DirectionType = "rtl" | "ltr";
2
+ type PositionType = "top" | "bottom" | "right" | "left";
3
+ type SeverityType = "info" | "warning" | "error" | "success" | "none";
4
+ type OrientationType = "vertical" | "horizontal";
5
+ type RadiusType = "full" | "inherit" | "none";
6
+ type RadioOptionType = {
7
+ label: string;
8
+ value: string;
9
+ };
10
+
11
+ export type { DirectionType as D, OrientationType as O, PositionType as P, RadiusType as R, SeverityType as S, RadioOptionType as a };
@@ -0,0 +1,11 @@
1
+ type DirectionType = "rtl" | "ltr";
2
+ type PositionType = "top" | "bottom" | "right" | "left";
3
+ type SeverityType = "info" | "warning" | "error" | "success" | "none";
4
+ type OrientationType = "vertical" | "horizontal";
5
+ type RadiusType = "full" | "inherit" | "none";
6
+ type RadioOptionType = {
7
+ label: string;
8
+ value: string;
9
+ };
10
+
11
+ export type { DirectionType as D, OrientationType as O, PositionType as P, RadiusType as R, SeverityType as S, RadioOptionType as a };