kitzo 2.3.6 → 2.3.8
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/README.md +39 -258
- package/dist/fns.d.ts +3 -0
- package/dist/fns.js +4 -0
- package/dist/functions/copy/copy.js +23 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +14 -0
- package/dist/react/components/toast/Toaster.js +71 -0
- package/dist/react/components/toast/helpers/addToastStyles.js +259 -0
- package/dist/react/components/toast/helpers/createToast.js +45 -0
- package/dist/react/components/toast/helpers/listenar.js +14 -0
- package/dist/react/components/toast/helpers/manageToasts/addToasts.js +12 -0
- package/dist/react/components/toast/helpers/manageToasts/dismissToasts.js +17 -0
- package/dist/react/components/toast/helpers/manageToasts/manageToasts.js +9 -0
- package/dist/react/components/toast/helpers/manageToasts/timers.js +39 -0
- package/dist/react/components/toast/helpers/manageToasts/updateToasts.js +10 -0
- package/dist/react/components/toast/helpers/triggerToasts.js +99 -0
- package/dist/react/components/toast/partials/Svgs.js +98 -0
- package/dist/react/components/toast/partials/Toast.js +54 -0
- package/dist/react/components/toast/partials/ToastContainer.js +59 -0
- package/dist/react/components/tooltip/Tooltip.js +67 -0
- package/dist/react/components/tooltip/helpers/addTooltipStyles.js +230 -0
- package/dist/react/components/tooltip/helpers/getAnimationProperties.js +12 -0
- package/dist/react/components/tooltip/helpers/getPositionClass.js +27 -0
- package/dist/react/components/tooltip/partials/TooltipWrapper.js +29 -0
- package/dist/react/hooks/useCopy.js +38 -0
- package/dist/react/hooks/useDebounce.js +16 -0
- package/dist/react/hooks/useWindowSize.js +26 -0
- package/package.json +73 -77
- package/dist/functions/index.js +0 -36
- package/dist/functions/index.js.map +0 -1
- package/dist/functions/types.d.ts +0 -2
- package/dist/react/index.js +0 -1086
- package/dist/react/index.js.map +0 -1
- package/dist/react/types/hooks.d.ts +0 -34
- package/dist/react/types/toast.d.ts +0 -60
- package/dist/react/types/tooltip.d.ts +0 -55
- package/dist/react/types.d.ts +0 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as d, useLayoutEffect as b } from "react";
|
|
3
|
+
import h from "./Toast.js";
|
|
4
|
+
function v({
|
|
5
|
+
t,
|
|
6
|
+
animateTransformOrigin: f,
|
|
7
|
+
containerPosition: l,
|
|
8
|
+
updateOffsets: r
|
|
9
|
+
}) {
|
|
10
|
+
const s = d(null);
|
|
11
|
+
b(() => {
|
|
12
|
+
const e = s.current;
|
|
13
|
+
if (!e) return;
|
|
14
|
+
const a = new ResizeObserver(() => {
|
|
15
|
+
const p = e.offsetHeight;
|
|
16
|
+
e.style.setProperty("--toast-height", `${p}px`), r();
|
|
17
|
+
});
|
|
18
|
+
return a.observe(e), () => a.disconnect();
|
|
19
|
+
}, [r]);
|
|
20
|
+
const m = [
|
|
21
|
+
"top-left",
|
|
22
|
+
"top-center",
|
|
23
|
+
"top-right",
|
|
24
|
+
"bottom-left",
|
|
25
|
+
"bottom-center",
|
|
26
|
+
"bottom-right"
|
|
27
|
+
], i = t.position || l, o = m.includes(i) ? i : "top-center", n = o.includes("bottom"), u = typeof t.animateTransformOrigin == "boolean" ? t.animateTransformOrigin : f;
|
|
28
|
+
return /* @__PURE__ */ c(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
ref: s,
|
|
32
|
+
"data-toast-container": !0,
|
|
33
|
+
"data-toast-position": o,
|
|
34
|
+
style: {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
zIndex: t.zIndex,
|
|
37
|
+
left: 0,
|
|
38
|
+
right: 0,
|
|
39
|
+
transition: "transform 180ms",
|
|
40
|
+
display: "flex",
|
|
41
|
+
justifyContent: o.includes("left") ? "flex-start" : o.includes("center") ? "center" : "flex-end",
|
|
42
|
+
top: n ? "auto" : 0,
|
|
43
|
+
bottom: n ? 0 : "auto",
|
|
44
|
+
transform: `translateY(calc(var(--toast-offset-y, 0px) * ${n ? -1 : 1}))`
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ c(
|
|
47
|
+
h,
|
|
48
|
+
{
|
|
49
|
+
t,
|
|
50
|
+
position: o,
|
|
51
|
+
shouldAnimateTransformOrigin: u
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
v as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs as d, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import y from "./helpers/addTooltipStyles.js";
|
|
3
|
+
import D from "./helpers/getPositionClass.js";
|
|
4
|
+
import b from "./partials/TooltipWrapper.js";
|
|
5
|
+
import T from "./helpers/getAnimationProperties.js";
|
|
6
|
+
const x = () => window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
7
|
+
function H(n) {
|
|
8
|
+
const {
|
|
9
|
+
content: r,
|
|
10
|
+
children: t,
|
|
11
|
+
position: c = "top",
|
|
12
|
+
// arrowStyle = {},
|
|
13
|
+
animation: i = !0,
|
|
14
|
+
isHidden: s = !1,
|
|
15
|
+
offset: m = 8,
|
|
16
|
+
// arrow = false,
|
|
17
|
+
smartHover: l = !0,
|
|
18
|
+
hideOnTouch: f = !0
|
|
19
|
+
} = n;
|
|
20
|
+
let { isDark: o } = n;
|
|
21
|
+
if (typeof s == "boolean" && s || r == null)
|
|
22
|
+
return t;
|
|
23
|
+
const e = {
|
|
24
|
+
offset: isNaN(Number(m)) ? 8 : Number(m),
|
|
25
|
+
// arrow: typeof arrow === 'boolean' ? arrow : false,
|
|
26
|
+
smartHover: typeof l == "boolean" ? l : !0,
|
|
27
|
+
hideOnTouch: typeof f == "boolean" ? f : !0
|
|
28
|
+
};
|
|
29
|
+
if (window.matchMedia("(pointer: coarse)").matches && e.hideOnTouch) return t;
|
|
30
|
+
const p = D(c), u = !!i, a = T(
|
|
31
|
+
i === !0 ? {} : i
|
|
32
|
+
);
|
|
33
|
+
return o = typeof o == "boolean" ? o : x(), y(), /* @__PURE__ */ d(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
style: {
|
|
37
|
+
position: "relative",
|
|
38
|
+
width: "fit-content",
|
|
39
|
+
"--offset": Math.max(0, e.offset),
|
|
40
|
+
"--startDuration": Math.max(
|
|
41
|
+
0,
|
|
42
|
+
a.startDuration
|
|
43
|
+
),
|
|
44
|
+
"--endDuration": Math.max(0, a.endDuration),
|
|
45
|
+
"--startDelay": Math.max(0, a.startDelay),
|
|
46
|
+
"--endDelay": Math.max(0, a.endDelay)
|
|
47
|
+
// '--arrow-color': arrowStyle?.['--arrow-color'],
|
|
48
|
+
// '--arrow-size': arrowStyle?.['--arrow-size'],
|
|
49
|
+
},
|
|
50
|
+
className: `kitzo-tooltip-root ${o ? "tooltip-theme-dark" : ""} ${e.smartHover ? "smart-hover" : ""} ${u ? "animate-tooltip" : ""}`,
|
|
51
|
+
children: [
|
|
52
|
+
t,
|
|
53
|
+
/* @__PURE__ */ h(
|
|
54
|
+
b,
|
|
55
|
+
{
|
|
56
|
+
content: r,
|
|
57
|
+
positionClass: p,
|
|
58
|
+
finalOptions: e
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
H as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
const o = `/* Default styling */
|
|
2
|
+
.kitzo-tooltip-root {
|
|
3
|
+
--bg-clr: hsl(0, 0%, 15%);
|
|
4
|
+
--text-clr: hsl(0, 0%, 95%);
|
|
5
|
+
|
|
6
|
+
--transition-startDuration: calc(var(--startDuration) * 1ms);
|
|
7
|
+
--transition-endDuration: calc(var(--endDuration) * 1ms);
|
|
8
|
+
--transition-startDelay: calc(var(--startDelay) * 1ms);
|
|
9
|
+
--transition-endDelay: calc(var(--endDelay) * 1ms);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.kitzo-tooltip-root.tooltip-theme-dark {
|
|
13
|
+
--bg-clr: hsl(0, 0%, 95%);
|
|
14
|
+
--text-clr: hsl(0, 0%, 15%);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.kitzo-tooltip-content-default-style {
|
|
18
|
+
font-family:
|
|
19
|
+
inherit,
|
|
20
|
+
system-ui,
|
|
21
|
+
-apple-system,
|
|
22
|
+
BlinkMacSystemFont,
|
|
23
|
+
'Segoe UI',
|
|
24
|
+
Roboto,
|
|
25
|
+
Oxygen,
|
|
26
|
+
Ubuntu,
|
|
27
|
+
Cantarell,
|
|
28
|
+
'Open Sans',
|
|
29
|
+
'Helvetica Neue',
|
|
30
|
+
sans-serif;
|
|
31
|
+
font-size: 0.875rem;
|
|
32
|
+
background-color: var(--bg-clr);
|
|
33
|
+
color: var(--text-clr);
|
|
34
|
+
padding-block: 0.25rem;
|
|
35
|
+
padding-inline: 0.5rem;
|
|
36
|
+
border-radius: 0.325rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Tooltip positioning */
|
|
40
|
+
.kitzo-tooltip-wrapper {
|
|
41
|
+
--tooltip-offset: calc(var(--offset) * 1px + 1px);
|
|
42
|
+
opacity: 0;
|
|
43
|
+
transition-property: opacity;
|
|
44
|
+
transition-delay: calc(
|
|
45
|
+
var(--transition-endDuration) + var(--transition-endDelay)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.kitzo-tooltip-root:hover .kitzo-tooltip-wrapper {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
transition-delay: 0ms;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Top */
|
|
55
|
+
.kitzo-tooltip-wrapper.top {
|
|
56
|
+
bottom: 100%;
|
|
57
|
+
padding-block-end: var(--tooltip-offset);
|
|
58
|
+
}
|
|
59
|
+
.kitzo-tooltip-wrapper.top {
|
|
60
|
+
left: 50%;
|
|
61
|
+
translate: -50% 0;
|
|
62
|
+
}
|
|
63
|
+
.kitzo-tooltip-wrapper.top.start {
|
|
64
|
+
left: 0;
|
|
65
|
+
translate: 0 0;
|
|
66
|
+
}
|
|
67
|
+
.kitzo-tooltip-wrapper.top.end {
|
|
68
|
+
right: 0;
|
|
69
|
+
translate: 0 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Right */
|
|
73
|
+
.kitzo-tooltip-wrapper.right {
|
|
74
|
+
left: 100%;
|
|
75
|
+
padding-inline-start: var(--tooltip-offset);
|
|
76
|
+
}
|
|
77
|
+
.kitzo-tooltip-wrapper.right {
|
|
78
|
+
top: 50%;
|
|
79
|
+
translate: 0 -50%;
|
|
80
|
+
}
|
|
81
|
+
.kitzo-tooltip-wrapper.right.start {
|
|
82
|
+
top: 0;
|
|
83
|
+
translate: 0 0;
|
|
84
|
+
}
|
|
85
|
+
.kitzo-tooltip-wrapper.right.end {
|
|
86
|
+
top: 100%;
|
|
87
|
+
translate: 0 -100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Bottom */
|
|
91
|
+
.kitzo-tooltip-wrapper.bottom {
|
|
92
|
+
top: 100%;
|
|
93
|
+
padding-block-start: var(--tooltip-offset);
|
|
94
|
+
}
|
|
95
|
+
.kitzo-tooltip-wrapper.bottom {
|
|
96
|
+
left: 50%;
|
|
97
|
+
translate: -50% 0;
|
|
98
|
+
}
|
|
99
|
+
.kitzo-tooltip-wrapper.bottom.start {
|
|
100
|
+
left: 0;
|
|
101
|
+
translate: 0 0;
|
|
102
|
+
}
|
|
103
|
+
.kitzo-tooltip-wrapper.bottom.end {
|
|
104
|
+
left: 100%;
|
|
105
|
+
translate: -100% 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Left */
|
|
109
|
+
.kitzo-tooltip-wrapper.left {
|
|
110
|
+
right: 100%;
|
|
111
|
+
padding-inline-end: var(--tooltip-offset);
|
|
112
|
+
}
|
|
113
|
+
.kitzo-tooltip-wrapper.left {
|
|
114
|
+
top: 50%;
|
|
115
|
+
translate: 0 -50%;
|
|
116
|
+
}
|
|
117
|
+
.kitzo-tooltip-wrapper.left.start {
|
|
118
|
+
top: 0;
|
|
119
|
+
translate: 0 0;
|
|
120
|
+
}
|
|
121
|
+
.kitzo-tooltip-wrapper.left.end {
|
|
122
|
+
top: 100%;
|
|
123
|
+
translate: 0 -100%;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Tooltip transitions */
|
|
127
|
+
.kitzo-tooltip-root.animate-tooltip {
|
|
128
|
+
.kitzo-tooltip-content {
|
|
129
|
+
text-rendering: optimizeLegibility;
|
|
130
|
+
-webkit-font-smoothing: antialiased;
|
|
131
|
+
-moz-osx-font-smoothing: grayscale;
|
|
132
|
+
backface-visibility: hidden;
|
|
133
|
+
contain: layout paint;
|
|
134
|
+
|
|
135
|
+
transition:
|
|
136
|
+
transform var(--transition-endDuration) var(--transition-endDelay),
|
|
137
|
+
opacity var(--transition-endDuration) var(--transition-endDelay);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.kitzo-tooltip-content {
|
|
142
|
+
transform: scale(0.8);
|
|
143
|
+
opacity: 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.kitzo-tooltip-content.top {
|
|
147
|
+
transform-origin: bottom;
|
|
148
|
+
}
|
|
149
|
+
.kitzo-tooltip-content.right {
|
|
150
|
+
transform-origin: left;
|
|
151
|
+
}
|
|
152
|
+
.kitzo-tooltip-content.bottom {
|
|
153
|
+
transform-origin: top;
|
|
154
|
+
}
|
|
155
|
+
.kitzo-tooltip-content.left {
|
|
156
|
+
transform-origin: right;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.kitzo-tooltip-root.animate-tooltip:hover {
|
|
160
|
+
.kitzo-tooltip-content {
|
|
161
|
+
transition:
|
|
162
|
+
transform var(--transition-startDuration) var(--transition-startDelay),
|
|
163
|
+
opacity var(--transition-startDuration) var(--transition-startDelay);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
.kitzo-tooltip-root:hover {
|
|
167
|
+
.kitzo-tooltip-content {
|
|
168
|
+
transform: scale(1);
|
|
169
|
+
opacity: 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* smart hover persistence feature */
|
|
174
|
+
.kitzo-tooltip-root {
|
|
175
|
+
.kitzo-tooltip-wrapper {
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
.kitzo-tooltip-root.smart-hover:hover {
|
|
180
|
+
.kitzo-tooltip-wrapper {
|
|
181
|
+
pointer-events: all;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Arrow */
|
|
186
|
+
.kitzo-tooltip-content.tooltip-arrow {
|
|
187
|
+
--effective-size: calc(var(--arrow-size, 6) * 1px);
|
|
188
|
+
--effective-color: var(--arrow-color, var(--bg-clr));
|
|
189
|
+
|
|
190
|
+
position: relative;
|
|
191
|
+
}
|
|
192
|
+
.kitzo-tooltip-content.tooltip-arrow::before {
|
|
193
|
+
content: '';
|
|
194
|
+
position: absolute;
|
|
195
|
+
z-index: -1;
|
|
196
|
+
border: var(--effective-size) solid transparent;
|
|
197
|
+
}
|
|
198
|
+
.kitzo-tooltip-content.tooltip-arrow.top::before {
|
|
199
|
+
left: 50%;
|
|
200
|
+
translate: -50% 0;
|
|
201
|
+
top: calc(100% - 1px);
|
|
202
|
+
border-top: var(--effective-size) solid var(--effective-color);
|
|
203
|
+
}
|
|
204
|
+
.kitzo-tooltip-content.tooltip-arrow.right::before {
|
|
205
|
+
top: 50%;
|
|
206
|
+
translate: 0 -50%;
|
|
207
|
+
right: calc(100% - 1px);
|
|
208
|
+
border-right: var(--effective-size) solid var(--effective-color);
|
|
209
|
+
}
|
|
210
|
+
.kitzo-tooltip-content.tooltip-arrow.bottom::before {
|
|
211
|
+
left: 50%;
|
|
212
|
+
translate: -50% 0;
|
|
213
|
+
bottom: calc(100% - 1px);
|
|
214
|
+
border-bottom: var(--effective-size) solid var(--effective-color);
|
|
215
|
+
}
|
|
216
|
+
.kitzo-tooltip-content.tooltip-arrow.left::before {
|
|
217
|
+
top: 50%;
|
|
218
|
+
translate: 0 -50%;
|
|
219
|
+
left: calc(100% - 1px);
|
|
220
|
+
border-left: var(--effective-size) solid var(--effective-color);
|
|
221
|
+
}`;
|
|
222
|
+
function i() {
|
|
223
|
+
if (!document.getElementById("kitzo-tooltip-styles")) {
|
|
224
|
+
const t = document.createElement("style");
|
|
225
|
+
t.id = "kitzo-tooltip-styles", t.textContent = o, document.head.appendChild(t);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export {
|
|
229
|
+
i as default
|
|
230
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function c(e) {
|
|
2
|
+
const a = e?.startDelay, n = e?.endDelay, t = e?.delay ?? 0, f = e?.startDuration, D = e?.endDuration, r = e?.duration ?? 110;
|
|
3
|
+
return {
|
|
4
|
+
startDelay: a ?? t,
|
|
5
|
+
endDelay: n ?? t,
|
|
6
|
+
startDuration: f ?? r,
|
|
7
|
+
endDuration: D ?? r
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
c as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const s = [
|
|
2
|
+
"top-start",
|
|
3
|
+
"top",
|
|
4
|
+
"top-end",
|
|
5
|
+
"right-start",
|
|
6
|
+
"right",
|
|
7
|
+
"right-end",
|
|
8
|
+
"bottom-start",
|
|
9
|
+
"bottom",
|
|
10
|
+
"bottom-end",
|
|
11
|
+
"left-start",
|
|
12
|
+
"left",
|
|
13
|
+
"left-end"
|
|
14
|
+
];
|
|
15
|
+
function n(t = "") {
|
|
16
|
+
t = typeof t == "string" ? t.trim().toLowerCase() : "top";
|
|
17
|
+
const e = s.find((o) => o === t);
|
|
18
|
+
if (!e) return "top";
|
|
19
|
+
if (e.includes("-")) {
|
|
20
|
+
const [o, r] = e.split("-");
|
|
21
|
+
return `${o} ${r}`;
|
|
22
|
+
} else
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
n as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e, Fragment as i } from "react/jsx-runtime";
|
|
2
|
+
function l({
|
|
3
|
+
content: t,
|
|
4
|
+
positionClass: o,
|
|
5
|
+
finalOptions: r
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ e(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
style: {
|
|
11
|
+
position: "absolute",
|
|
12
|
+
whiteSpace: "pre-wrap",
|
|
13
|
+
width: "max-content"
|
|
14
|
+
},
|
|
15
|
+
tabIndex: -1,
|
|
16
|
+
className: `kitzo-tooltip-wrapper ${o}`,
|
|
17
|
+
children: /* @__PURE__ */ e(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
className: `kitzo-tooltip-content ${o} ${r.arrow ? "tooltip-arrow" : ""}`,
|
|
21
|
+
children: typeof t == "string" || typeof t == "number" ? /* @__PURE__ */ e("div", { className: "kitzo-tooltip-content-default-style", children: t }) : /* @__PURE__ */ e(i, { children: t })
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
l as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState as u, useRef as i, useCallback as p, useEffect as m } from "react";
|
|
2
|
+
import d from "../../functions/copy/copy.js";
|
|
3
|
+
function g(a = {}) {
|
|
4
|
+
const { resetDelay: s = 500 } = a, [r, e] = u("standby"), [f, c] = u(null), t = i(null), n = i(!1), l = p(
|
|
5
|
+
async (y) => {
|
|
6
|
+
if (!n.current) {
|
|
7
|
+
t.current && clearTimeout(t.current);
|
|
8
|
+
try {
|
|
9
|
+
n.current = !0, c(null), e("copying"), await d(y), e("copied");
|
|
10
|
+
} catch (o) {
|
|
11
|
+
c(o instanceof Error ? o : new Error(String(o))), e("error");
|
|
12
|
+
} finally {
|
|
13
|
+
t.current = setTimeout(
|
|
14
|
+
() => {
|
|
15
|
+
n.current = !1, e("standby");
|
|
16
|
+
},
|
|
17
|
+
Math.max(s, 500)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
[s]
|
|
23
|
+
);
|
|
24
|
+
return m(() => () => {
|
|
25
|
+
t.current && clearTimeout(t.current);
|
|
26
|
+
}, []), {
|
|
27
|
+
copy: l,
|
|
28
|
+
status: r,
|
|
29
|
+
error: f,
|
|
30
|
+
isCopying: r === "copying",
|
|
31
|
+
isCopied: r === "copied",
|
|
32
|
+
isError: r === "error",
|
|
33
|
+
isStandby: r === "standby"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
g as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState as r, useEffect as c } from "react";
|
|
2
|
+
function f(e, t) {
|
|
3
|
+
t ??= 500;
|
|
4
|
+
const [u, o] = r(e);
|
|
5
|
+
return c(() => {
|
|
6
|
+
const n = setTimeout(() => {
|
|
7
|
+
o(e);
|
|
8
|
+
}, t);
|
|
9
|
+
return () => {
|
|
10
|
+
clearTimeout(n);
|
|
11
|
+
};
|
|
12
|
+
}, [e, t]), u;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
f as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState as u, useRef as c, useEffect as d } from "react";
|
|
2
|
+
function w(i = {}) {
|
|
3
|
+
const { updateDelay: n = 30 } = i, [r, o] = u({
|
|
4
|
+
screenWidth: window.innerWidth,
|
|
5
|
+
screenHeight: window.innerHeight
|
|
6
|
+
}), e = c(null);
|
|
7
|
+
return d(() => {
|
|
8
|
+
function t() {
|
|
9
|
+
e.current && clearTimeout(e.current), e.current = setTimeout(
|
|
10
|
+
() => {
|
|
11
|
+
o({
|
|
12
|
+
screenWidth: window.innerWidth,
|
|
13
|
+
screenHeight: window.innerHeight
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
Math.max(0, +n)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return typeof window < "u" && window.addEventListener("resize", t), () => {
|
|
20
|
+
e.current && clearTimeout(e.current), window.removeEventListener("resize", t);
|
|
21
|
+
};
|
|
22
|
+
}, [n]), r;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
w as default
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,77 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "kitzo",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "A lightweight React micro-utility.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"scripts": {
|
|
23
|
-
"dev": "vite",
|
|
24
|
-
"build": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"@eslint/js": "^9.39.2",
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"eslint": "^
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"vite": "^
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
"react": ">=19",
|
|
75
|
-
"react-dom": ">=19"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "kitzo",
|
|
3
|
+
"version": "2.3.8",
|
|
4
|
+
"description": "A lightweight React micro-utility.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./fns": {
|
|
17
|
+
"types": "./dist/fns.d.ts",
|
|
18
|
+
"import": "./dist/fns.js",
|
|
19
|
+
"default": "./dist/fns.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "tsc -b && vite build",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"preview": "vite preview"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"kitzo",
|
|
30
|
+
"components",
|
|
31
|
+
"toast",
|
|
32
|
+
"tooltip",
|
|
33
|
+
"hooks",
|
|
34
|
+
"function",
|
|
35
|
+
"micro-utility",
|
|
36
|
+
"ui",
|
|
37
|
+
"react",
|
|
38
|
+
"reactjs"
|
|
39
|
+
],
|
|
40
|
+
"author": "Riyad",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/riyad-96/kitzo.git"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/riyad-96/kitzo#readme",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": ">=19",
|
|
49
|
+
"react-dom": ">=19"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.39.2",
|
|
53
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
54
|
+
"@types/node": "^25.0.6",
|
|
55
|
+
"@types/react": "^19.2.8",
|
|
56
|
+
"@types/react-dom": "^19.2.3",
|
|
57
|
+
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
58
|
+
"daisyui": "^5.5.14",
|
|
59
|
+
"eslint": "^9.39.2",
|
|
60
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
61
|
+
"eslint-plugin-react-refresh": "^0.4.26",
|
|
62
|
+
"globals": "^17.0.0",
|
|
63
|
+
"prettier": "^3.7.4",
|
|
64
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
65
|
+
"react": "^19.2.3",
|
|
66
|
+
"react-dom": "^19.2.3",
|
|
67
|
+
"tailwindcss": "^4.1.18",
|
|
68
|
+
"typescript": "~5.9.3",
|
|
69
|
+
"typescript-eslint": "^8.52.0",
|
|
70
|
+
"vite": "^7.3.1",
|
|
71
|
+
"vite-plugin-dts": "^4.5.4"
|
|
72
|
+
}
|
|
73
|
+
}
|