kku-ui 0.2.55 → 0.9.9
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 +8 -8
- package/lib/es/common/hooks/index.d.ts +0 -4
- package/lib/es/components/index.d.ts +6 -5
- package/lib/es/components/ui/actions/button/KButton.d.ts +12 -0
- package/lib/es/components/ui/actions/button-group/KButtonGroup.d.ts +12 -0
- package/lib/es/components/ui/actions/index.d.ts +3 -0
- package/lib/es/components/ui/actions/switch/KSwitch.d.ts +6 -0
- package/lib/es/components/ui/data-display/accordion/KAccordion.d.ts +17 -0
- package/lib/es/components/ui/data-display/bottom-sheet/KBottomSheet.d.ts +39 -0
- package/lib/es/components/ui/data-display/dropdown-menu/KDropdownMenu.d.ts +55 -0
- package/lib/es/components/ui/data-display/index.d.ts +3 -0
- package/lib/es/components/ui/feedback/dialog/KDialog.d.ts +39 -0
- package/lib/es/components/ui/feedback/index.d.ts +5 -0
- package/lib/es/components/ui/feedback/popover/KPopover.d.ts +15 -0
- package/lib/es/components/ui/feedback/skeleton/KSkeleton.d.ts +9 -0
- package/lib/es/components/ui/feedback/spinner/KSpinner.d.ts +6 -0
- package/lib/es/components/ui/feedback/toast/KToast.d.ts +10 -0
- package/lib/es/components/ui/foundation/icon/KIcon.d.ts +19 -0
- package/lib/es/components/ui/foundation/icon/index.d.ts +1 -0
- package/lib/es/components/ui/input/index.d.ts +2 -0
- package/lib/es/components/ui/input/select/KSelect.d.ts +38 -0
- package/lib/es/components/ui/input/textfield/KTextField.d.ts +19 -0
- package/lib/es/components/ui/layout/aspect-ratio/KAspectRatio.d.ts +6 -0
- package/lib/es/components/ui/layout/index.d.ts +1 -0
- package/lib/es/index.d.ts +0 -1
- package/lib/es/lib/utils.d.ts +2 -0
- package/lib/hooks.js +39 -0
- package/lib/index.css +1 -1
- package/lib/index.js +11843 -0
- package/lib/index.js.br +0 -0
- package/lib/index.js.gz +0 -0
- package/package.json +24 -8
- package/lib/es/common/hooks/useDropdownPosition.d.ts +0 -16
- package/lib/es/common/hooks/useEscapeKey.d.ts +0 -2
- package/lib/es/common/hooks/useRipple/useRipple.d.ts +0 -5
- package/lib/es/common/hooks/useSafePortalContainer.d.ts +0 -1
- package/lib/es/common/util/keyboard.d.ts +0 -2
- package/lib/es/common/util/lodashUtil.d.ts +0 -4
- package/lib/es/common/util/style.d.ts +0 -5
- package/lib/es/components/actions/button/KButton.d.ts +0 -3
- package/lib/es/components/actions/button/KButton.interface.d.ts +0 -18
- package/lib/es/components/actions/button/index.d.ts +0 -2
- package/lib/es/components/actions/button-group/KButtonGroup.d.ts +0 -6
- package/lib/es/components/actions/button-group/KButtonGroup.interface.d.ts +0 -8
- package/lib/es/components/actions/button-group/index.d.ts +0 -2
- package/lib/es/components/actions/index.d.ts +0 -5
- package/lib/es/components/actions/switch/KSwitch.d.ts +0 -3
- package/lib/es/components/actions/switch/KSwitch.interface.d.ts +0 -8
- package/lib/es/components/actions/switch/index.d.ts +0 -2
- package/lib/es/components/actions/toggle-button/KToggleButton.d.ts +0 -4
- package/lib/es/components/actions/toggle-button/KToggleButton.interface.d.ts +0 -4
- package/lib/es/components/actions/toggle-button/index.d.ts +0 -2
- package/lib/es/components/actions/toggle-button-group/KToggleButtonGroup.d.ts +0 -6
- package/lib/es/components/actions/toggle-button-group/KToggleButtonGroup.interface.d.ts +0 -9
- package/lib/es/components/actions/toggle-button-group/index.d.ts +0 -2
- package/lib/es/components/data-display/accordion/KAccordion.d.ts +0 -6
- package/lib/es/components/data-display/accordion/KAccordion.interface.d.ts +0 -9
- package/lib/es/components/data-display/accordion/index.d.ts +0 -2
- package/lib/es/components/data-display/dropdown/KDropdown.context.d.ts +0 -3
- package/lib/es/components/data-display/dropdown/KDropdown.d.ts +0 -10
- package/lib/es/components/data-display/dropdown/KDropdown.interface.d.ts +0 -45
- package/lib/es/components/data-display/dropdown/KDropdownContent.d.ts +0 -3
- package/lib/es/components/data-display/dropdown/KDropdownTrigger.d.ts +0 -3
- package/lib/es/components/data-display/dropdown/index.d.ts +0 -2
- package/lib/es/components/data-display/index.d.ts +0 -4
- package/lib/es/components/data-display/menu/KMenu.d.ts +0 -12
- package/lib/es/components/data-display/menu/KMenu.interface.d.ts +0 -19
- package/lib/es/components/data-display/menu/KMenuItem.d.ts +0 -3
- package/lib/es/components/data-display/menu/KMenuItemDivider.d.ts +0 -3
- package/lib/es/components/data-display/menu/KMenuItemSelectable.d.ts +0 -3
- package/lib/es/components/data-display/menu/index.d.ts +0 -2
- package/lib/es/components/data-display/skeleton/KSkeleton.d.ts +0 -6
- package/lib/es/components/data-display/skeleton/KSkeleton.interface.d.ts +0 -8
- package/lib/es/components/data-display/skeleton/index.d.ts +0 -2
- package/lib/es/components/feedback/backdrop/KBackdrop.d.ts +0 -6
- package/lib/es/components/feedback/backdrop/KBackdrop.motion.d.ts +0 -3
- package/lib/es/components/feedback/backdrop/index.d.ts +0 -2
- package/lib/es/components/feedback/index.d.ts +0 -3
- package/lib/es/components/feedback/modal/KModal.context.d.ts +0 -3
- package/lib/es/components/feedback/modal/KModal.d.ts +0 -12
- package/lib/es/components/feedback/modal/KModal.interface.d.ts +0 -35
- package/lib/es/components/feedback/modal/KModal.motion.d.ts +0 -2
- package/lib/es/components/feedback/modal/KModalContent.d.ts +0 -3
- package/lib/es/components/feedback/modal/KModalFooter.d.ts +0 -3
- package/lib/es/components/feedback/modal/KModalHeader.d.ts +0 -3
- package/lib/es/components/feedback/modal/index.d.ts +0 -2
- package/lib/es/components/feedback/spinner/KSpinner.d.ts +0 -3
- package/lib/es/components/feedback/spinner/index.d.ts +0 -2
- package/lib/es/components/foundations/icon/KIcon.d.ts +0 -3
- package/lib/es/components/foundations/icon/KIcon.interface.d.ts +0 -14
- package/lib/es/components/foundations/icon/index.d.ts +0 -2
- package/lib/es/components/foundations/index.d.ts +0 -1
- package/lib/es/components/input/index.d.ts +0 -2
- package/lib/es/components/input/select/KSelect.d.ts +0 -3
- package/lib/es/components/input/select/KSelect.interface.d.ts +0 -37
- package/lib/es/components/input/select/index.d.ts +0 -2
- package/lib/es/components/input/textfield/KTextField.d.ts +0 -3
- package/lib/es/components/input/textfield/KTextField.interface.d.ts +0 -26
- package/lib/es/components/input/textfield/index.d.ts +0 -2
- package/lib/es/core/accordion/Accordion.context.d.ts +0 -3
- package/lib/es/core/accordion/Accordion.d.ts +0 -10
- package/lib/es/core/accordion/Accordion.interface.d.ts +0 -21
- package/lib/es/core/accordion/AccordionContent.d.ts +0 -6
- package/lib/es/core/accordion/AccordionSummary.d.ts +0 -6
- package/lib/es/core/accordion/index.d.ts +0 -2
- package/lib/es/core/button/Button.d.ts +0 -3
- package/lib/es/core/button/Button.interface.d.ts +0 -4
- package/lib/es/core/button/index.d.ts +0 -2
- package/lib/es/core/index.d.ts +0 -7
- package/lib/es/core/menu/Menu.d.ts +0 -3
- package/lib/es/core/menu/Menu.interface.d.ts +0 -11
- package/lib/es/core/menu/index.d.ts +0 -2
- package/lib/es/core/menu-item/MenuItem.d.ts +0 -3
- package/lib/es/core/menu-item/MenuItem.interface.d.ts +0 -12
- package/lib/es/core/menu-item/index.d.ts +0 -2
- package/lib/es/core/switch/Switch.d.ts +0 -3
- package/lib/es/core/switch/Switch.interface.d.ts +0 -6
- package/lib/es/core/switch/index.d.ts +0 -2
- package/lib/es/core/text-field/TextField.d.ts +0 -3
- package/lib/es/core/text-field/TextField.interface.d.ts +0 -4
- package/lib/es/core/text-field/index.d.ts +0 -2
- package/lib/es/core/transition/Transition.d.ts +0 -6
- package/lib/es/core/transition/Transition.interface.d.ts +0 -9
- package/lib/es/core/transition/index.d.ts +0 -2
- package/lib/es/hooks.js +0 -22
- package/lib/es/index.js +0 -7313
- package/lib/es/index.js.br +0 -0
- package/lib/es/index.js.gz +0 -0
- package/lib/useEscapeKey-BH1YNl0p.js +0 -158
- package/lib/useEscapeKey-BH1YNl0p.js.br +0 -0
- package/lib/useEscapeKey-BH1YNl0p.js.gz +0 -0
package/lib/es/index.js.br
DELETED
|
Binary file
|
package/lib/es/index.js.gz
DELETED
|
Binary file
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { useRef as I, useId as B, useMemo as P, useEffect as g, useState as $, useCallback as q } from "react";
|
|
2
|
-
import { uniqueId as A } from "lodash-es";
|
|
3
|
-
const M = { uniqueId: A }, z = (t, n) => {
|
|
4
|
-
Object.entries(n).forEach(([o, p]) => {
|
|
5
|
-
t.style.setProperty(o, p);
|
|
6
|
-
});
|
|
7
|
-
}, E = { setStyleElement: z }, D = "span", k = "k-ripple", N = "ripple-effect", C = 400, v = 240;
|
|
8
|
-
function K(t) {
|
|
9
|
-
const n = I(null);
|
|
10
|
-
return { register: (s) => {
|
|
11
|
-
if (s.type.includes("key")) {
|
|
12
|
-
const u = s;
|
|
13
|
-
if (u.key !== "Enter" && u.key !== " " || s.target.getElementsByClassName(k)?.length > 0) return;
|
|
14
|
-
}
|
|
15
|
-
const r = M.uniqueId("k-ripple-");
|
|
16
|
-
n.current = new Promise((u) => {
|
|
17
|
-
const { x: w, y: d, width: m, height: h } = t.current.getBoundingClientRect(), {
|
|
18
|
-
// Default values for Keyboard event
|
|
19
|
-
clientX: e = w + m / 2,
|
|
20
|
-
clientY: b = d + h / 2
|
|
21
|
-
} = s, l = Math.sqrt(m * m + h * h), a = document.createElement(D);
|
|
22
|
-
a.classList.add(k), a.classList.add(r);
|
|
23
|
-
const f = (window.getComputedStyle(t.current).color || "rgb(0, 0, 0)").match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
24
|
-
let y = "rgba(0, 0, 0, 0.1)";
|
|
25
|
-
if (f) {
|
|
26
|
-
const [, x, S, T] = f;
|
|
27
|
-
y = `rgba(${x}, ${S}, ${T}, 0.4)`;
|
|
28
|
-
}
|
|
29
|
-
const L = {
|
|
30
|
-
top: `${(b - d - l) / h * 100}%`,
|
|
31
|
-
left: `${(e - w - l) / m * 100}%`,
|
|
32
|
-
width: `${l * 2}px`,
|
|
33
|
-
height: `${l * 2}px`,
|
|
34
|
-
animation: `${C / 1e3}s ${N} ease`,
|
|
35
|
-
background: y
|
|
36
|
-
};
|
|
37
|
-
E.setStyleElement(a, L), t.current.append(a), setTimeout(() => {
|
|
38
|
-
u(r);
|
|
39
|
-
}, C);
|
|
40
|
-
});
|
|
41
|
-
}, remove: () => {
|
|
42
|
-
n.current?.then((s) => {
|
|
43
|
-
const r = t.current?.getElementsByClassName(s), u = r?.[0];
|
|
44
|
-
u && u instanceof HTMLElement && (E.setStyleElement(u, {
|
|
45
|
-
animation: `${v / 1e3}s ripple-hide-effect ease`
|
|
46
|
-
}), setTimeout(() => {
|
|
47
|
-
r[0]?.remove();
|
|
48
|
-
}, v));
|
|
49
|
-
});
|
|
50
|
-
} };
|
|
51
|
-
}
|
|
52
|
-
function j(t) {
|
|
53
|
-
const n = B().replace(/[^a-zA-Z0-9-_]/g, "");
|
|
54
|
-
return P(() => `${t}-${n}`, [n, t]);
|
|
55
|
-
}
|
|
56
|
-
function H(t, n, o) {
|
|
57
|
-
g(() => {
|
|
58
|
-
const p = (s) => {
|
|
59
|
-
if (t.current && !t.current.contains(s.target)) {
|
|
60
|
-
if (!o) {
|
|
61
|
-
n();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
o.current && !o.current.contains(s.target) && n();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return setTimeout(() => {
|
|
68
|
-
window.addEventListener("mousedown", p);
|
|
69
|
-
}, 0), () => {
|
|
70
|
-
window.removeEventListener("mousedown", p);
|
|
71
|
-
};
|
|
72
|
-
}, [t]);
|
|
73
|
-
}
|
|
74
|
-
function U({
|
|
75
|
-
triggerRef: t,
|
|
76
|
-
contentRef: n,
|
|
77
|
-
position: o,
|
|
78
|
-
open: p,
|
|
79
|
-
offset: s = { x: 0, y: 0 },
|
|
80
|
-
gap: r = 0
|
|
81
|
-
}) {
|
|
82
|
-
const [u, w] = $({ top: 0, left: 0 });
|
|
83
|
-
return g(() => {
|
|
84
|
-
const d = () => {
|
|
85
|
-
const m = t.current, h = n.current;
|
|
86
|
-
if (!m || !h) return;
|
|
87
|
-
const e = m.getBoundingClientRect(), b = h.getBoundingClientRect(), l = b.width, a = b.height;
|
|
88
|
-
let i = 0, c = 0;
|
|
89
|
-
switch (o) {
|
|
90
|
-
case "top-start":
|
|
91
|
-
i = e.top - a - r, c = e.left;
|
|
92
|
-
break;
|
|
93
|
-
case "top":
|
|
94
|
-
i = e.top - a - r, c = e.left + e.width / 2 - l / 2;
|
|
95
|
-
break;
|
|
96
|
-
case "top-end":
|
|
97
|
-
i = e.top - a - r, c = e.right - l;
|
|
98
|
-
break;
|
|
99
|
-
case "bottom-start":
|
|
100
|
-
i = e.bottom + r, c = e.left;
|
|
101
|
-
break;
|
|
102
|
-
case "bottom":
|
|
103
|
-
i = e.bottom + r, c = e.left + e.width / 2 - l / 2;
|
|
104
|
-
break;
|
|
105
|
-
case "bottom-end":
|
|
106
|
-
i = e.bottom + r, c = e.right - l;
|
|
107
|
-
break;
|
|
108
|
-
case "left-start":
|
|
109
|
-
i = e.top, c = e.left - l - r;
|
|
110
|
-
break;
|
|
111
|
-
case "left":
|
|
112
|
-
i = e.top + e.height / 2 - a / 2, c = e.left - l - r;
|
|
113
|
-
break;
|
|
114
|
-
case "left-end":
|
|
115
|
-
i = e.bottom - a, c = e.left - l - r;
|
|
116
|
-
break;
|
|
117
|
-
case "right-start":
|
|
118
|
-
i = e.top, c = e.right + r;
|
|
119
|
-
break;
|
|
120
|
-
case "right":
|
|
121
|
-
i = e.top + e.height / 2 - a / 2, c = e.right + r;
|
|
122
|
-
break;
|
|
123
|
-
case "right-end":
|
|
124
|
-
i = e.bottom - a, c = e.right + r;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
w({
|
|
128
|
-
top: i + s.y,
|
|
129
|
-
left: c + s.x
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
return d(), window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
|
|
133
|
-
window.removeEventListener("scroll", d, !0), window.removeEventListener("resize", d);
|
|
134
|
-
};
|
|
135
|
-
}, [t, n, o, p, s.x, s.y, r]), u;
|
|
136
|
-
}
|
|
137
|
-
function X(t) {
|
|
138
|
-
const [n, o] = $(null);
|
|
139
|
-
return g(() => {
|
|
140
|
-
o(t || document.body);
|
|
141
|
-
}, []), n;
|
|
142
|
-
}
|
|
143
|
-
const Y = (t) => {
|
|
144
|
-
const n = q((o) => {
|
|
145
|
-
o.key === "Escape" && (o.preventDefault(), t?.());
|
|
146
|
-
}, [t]);
|
|
147
|
-
g(() => (window.addEventListener("keydown", n), () => {
|
|
148
|
-
window.removeEventListener("keydown", n);
|
|
149
|
-
}), [n]);
|
|
150
|
-
};
|
|
151
|
-
export {
|
|
152
|
-
K as a,
|
|
153
|
-
H as b,
|
|
154
|
-
U as c,
|
|
155
|
-
X as d,
|
|
156
|
-
Y as e,
|
|
157
|
-
j as u
|
|
158
|
-
};
|
|
Binary file
|
|
Binary file
|