@konstructio/ui 0.0.12-alpha.1 → 0.0.12-alpha.10
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/dist/{Combination-BQYb0Gw7.js → Combination-b348x__d.js} +24 -24
- package/dist/Modal-B-E9uaA6.js +922 -0
- package/dist/components/Alert/Alert.js +58 -0
- package/dist/components/Alert/Alert.variants.js +77 -0
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Autocomplete/Autocomplete.variants.js +0 -1
- package/dist/components/Autocomplete/components/List/List.js +3 -3
- package/dist/components/Breadcrumb/Breadcrumb.js +3 -3
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +18 -15
- package/dist/components/Breadcrumb/components/Item/Item.js +4 -4
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Card/Card.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +5 -5
- package/dist/components/Command/Command.js +32 -0
- package/dist/components/Command/Command.variants.js +97 -0
- package/dist/components/Command/components/Command.js +8 -0
- package/dist/components/Command/components/CommandEmpty.js +15 -0
- package/dist/components/Command/components/CommandGroup.js +19 -0
- package/dist/components/Command/components/CommandInput.js +84 -0
- package/dist/components/Command/components/CommandItem.js +29 -0
- package/dist/components/Command/components/CommandList.js +16 -0
- package/dist/components/Command/components/CommandSeparator.js +16 -0
- package/dist/components/Command/components/CommandShortcut.js +19 -0
- package/dist/components/Command/components/DialogContent.js +31 -0
- package/dist/components/Command/components/DialogOverlay.js +19 -0
- package/dist/components/Command/components/index.js +20 -0
- package/dist/components/Command/contexts/Command.context.js +13 -0
- package/dist/components/Command/contexts/Command.provider.js +24 -0
- package/dist/components/Command/contexts/index.js +6 -0
- package/dist/components/Divider/Divider.js +10 -0
- package/dist/components/Divider/Divider.variants.js +14 -0
- package/dist/components/Dropdown/Dropdown.variants.js +22 -3
- package/dist/components/Dropdown/components/List/List.variants.js +4 -4
- package/dist/components/Dropdown/components/ListItem/ListItem.js +19 -18
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
- package/dist/components/Dropdown/components/Wrapper.js +88 -57
- package/dist/components/Input/Input.js +112 -67
- package/dist/components/Input/Input.variants.js +5 -6
- package/dist/components/Loading/Loading.js +109 -0
- package/dist/components/Loading/Loading.variants.js +19 -0
- package/dist/components/Modal/Modal.js +3 -3
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -5
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +3 -3
- package/dist/components/Radio/Radio.js +4 -4
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +4 -4
- package/dist/components/Sidebar/Sidebar.variants.js +2 -1
- package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -15
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +2 -2
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +6 -5
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +3 -3
- package/dist/components/Slider/Slider.js +14 -14
- package/dist/components/Switch/Switch.js +17 -17
- package/dist/components/Tag/Tag.js +17 -5
- package/dist/components/Tag/Tag.variants.js +11 -1
- package/dist/components/TagSelect/TagSelect.js +6 -71
- package/dist/components/TagSelect/TagSelect.variants.js +29 -50
- package/dist/components/TagSelect/components/Item/Item.js +23 -0
- package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
- package/dist/components/TagSelect/components/List/List.js +13 -0
- package/dist/components/TagSelect/components/List/List.variants.js +37 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
- package/dist/components/TagSelect/components/index.js +8 -0
- package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
- package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
- package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
- package/dist/components/TagSelect/contexts/index.js +6 -0
- package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
- package/dist/components/TextArea/TextArea.js +28 -22
- package/dist/components/TextArea/TextArea.variants.js +0 -1
- package/dist/components/Toast/Toast.js +143 -130
- package/dist/components/Toast/Toast.variants.js +2 -3
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Typography/Typography.js +31 -0
- package/dist/components/Typography/Typography.variants.js +63 -0
- package/dist/components/index.js +61 -53
- package/dist/{index-BxeV34ij.js → index-4ecjw_Aj.js} +1 -1
- package/dist/index-B_6_jmOO.js +68 -0
- package/dist/{index-BBjak_0p.js → index-BbsJ0VIJ.js} +2 -2
- package/dist/{index-CJsYodgi.js → index-BzaHYXkt.js} +9 -9
- package/dist/{index-KEdwcThH.js → index-CbTU3cnP.js} +1 -1
- package/dist/{index-8vgf-x5i.js → index-Cva-e5M4.js} +2 -2
- package/dist/index-CzSBQN5S.js +432 -0
- package/dist/index-D7QNmo_D.js +422 -0
- package/dist/index-DUA6Y_AE.js +126 -0
- package/dist/{index-CoqDsznq.js → index-D_76wh4w.js} +3 -3
- package/dist/{index-D4Q2rMby.js → index-Dj1pom3_.js} +2 -2
- package/dist/index-DyKo5ZJT.js +446 -0
- package/dist/index.d.ts +61 -7
- package/dist/index.js +76 -68
- package/dist/package.json +36 -35
- package/dist/plugins/konstruct.js +34 -31
- package/dist/plugins/utils/animation.styles.js +162 -0
- package/dist/plugins/utils/index.js +7 -0
- package/dist/styles.css +1 -1
- package/dist/{useBreadcrumb-CojbXFVD.js → useBreadcrumb-BsIeMoR1.js} +47 -47
- package/dist/utils/index.js +320 -322
- package/package.json +36 -35
- package/dist/Modal-W2GbkC_F.js +0 -906
- package/dist/index-1GLoikpT.js +0 -19134
- package/dist/index-BVppSRDQ.js +0 -551
- package/dist/index-DoOsnuB6.js +0 -72
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { u as Ee, d as j, a as he, c as ye, b as _, e as De } from "./index-Cva-e5M4.js";
|
|
3
|
+
import { u as S, S as be } from "./index-B_6_jmOO.js";
|
|
4
|
+
import { P as Ce, D as Ae } from "./index-D_76wh4w.js";
|
|
5
|
+
import { P as N } from "./index-D7QNmo_D.js";
|
|
6
|
+
import { jsx as f, jsxs as q, Fragment as B } from "react/jsx-runtime";
|
|
7
|
+
import { P as W } from "./index-Dj1pom3_.js";
|
|
8
|
+
import { R as Re } from "./Combination-b348x__d.js";
|
|
9
|
+
var Ne = i.useId || (() => {
|
|
10
|
+
}), Oe = 0;
|
|
11
|
+
function M(e) {
|
|
12
|
+
const [n, t] = i.useState(Ne());
|
|
13
|
+
return Ee(() => {
|
|
14
|
+
t((o) => o ?? String(Oe++));
|
|
15
|
+
}, [e]), n ? `radix-${n}` : "";
|
|
16
|
+
}
|
|
17
|
+
var x = "focusScope.autoFocusOnMount", w = "focusScope.autoFocusOnUnmount", V = { bubbles: !1, cancelable: !0 }, _e = "FocusScope", Q = i.forwardRef((e, n) => {
|
|
18
|
+
const {
|
|
19
|
+
loop: t = !1,
|
|
20
|
+
trapped: o = !1,
|
|
21
|
+
onMountAutoFocus: a,
|
|
22
|
+
onUnmountAutoFocus: r,
|
|
23
|
+
...c
|
|
24
|
+
} = e, [s, g] = i.useState(null), m = j(a), h = j(r), u = i.useRef(null), d = S(n, (l) => g(l)), p = i.useRef({
|
|
25
|
+
paused: !1,
|
|
26
|
+
pause() {
|
|
27
|
+
this.paused = !0;
|
|
28
|
+
},
|
|
29
|
+
resume() {
|
|
30
|
+
this.paused = !1;
|
|
31
|
+
}
|
|
32
|
+
}).current;
|
|
33
|
+
i.useEffect(() => {
|
|
34
|
+
if (o) {
|
|
35
|
+
let l = function(D) {
|
|
36
|
+
if (p.paused || !s) return;
|
|
37
|
+
const y = D.target;
|
|
38
|
+
s.contains(y) ? u.current = y : C(u.current, { select: !0 });
|
|
39
|
+
}, b = function(D) {
|
|
40
|
+
if (p.paused || !s) return;
|
|
41
|
+
const y = D.relatedTarget;
|
|
42
|
+
y !== null && (s.contains(y) || C(u.current, { select: !0 }));
|
|
43
|
+
}, v = function(D) {
|
|
44
|
+
if (document.activeElement === document.body)
|
|
45
|
+
for (const H of D)
|
|
46
|
+
H.removedNodes.length > 0 && C(s);
|
|
47
|
+
};
|
|
48
|
+
document.addEventListener("focusin", l), document.addEventListener("focusout", b);
|
|
49
|
+
const O = new MutationObserver(v);
|
|
50
|
+
return s && O.observe(s, { childList: !0, subtree: !0 }), () => {
|
|
51
|
+
document.removeEventListener("focusin", l), document.removeEventListener("focusout", b), O.disconnect();
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}, [o, s, p.paused]), i.useEffect(() => {
|
|
55
|
+
if (s) {
|
|
56
|
+
Z.add(p);
|
|
57
|
+
const l = document.activeElement;
|
|
58
|
+
if (!s.contains(l)) {
|
|
59
|
+
const v = new CustomEvent(x, V);
|
|
60
|
+
s.addEventListener(x, m), s.dispatchEvent(v), v.defaultPrevented || (Ie(Me(X(s)), { select: !0 }), document.activeElement === l && C(s));
|
|
61
|
+
}
|
|
62
|
+
return () => {
|
|
63
|
+
s.removeEventListener(x, m), setTimeout(() => {
|
|
64
|
+
const v = new CustomEvent(w, V);
|
|
65
|
+
s.addEventListener(w, h), s.dispatchEvent(v), v.defaultPrevented || C(l ?? document.body, { select: !0 }), s.removeEventListener(w, h), Z.remove(p);
|
|
66
|
+
}, 0);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}, [s, m, h, p]);
|
|
70
|
+
const I = i.useCallback(
|
|
71
|
+
(l) => {
|
|
72
|
+
if (!t && !o || p.paused) return;
|
|
73
|
+
const b = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, v = document.activeElement;
|
|
74
|
+
if (b && v) {
|
|
75
|
+
const O = l.currentTarget, [D, y] = Pe(O);
|
|
76
|
+
D && y ? !l.shiftKey && v === y ? (l.preventDefault(), t && C(D, { select: !0 })) : l.shiftKey && v === D && (l.preventDefault(), t && C(y, { select: !0 })) : v === O && l.preventDefault();
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
[t, o, p.paused]
|
|
80
|
+
);
|
|
81
|
+
return /* @__PURE__ */ f(N.div, { tabIndex: -1, ...c, ref: d, onKeyDown: I });
|
|
82
|
+
});
|
|
83
|
+
Q.displayName = _e;
|
|
84
|
+
function Ie(e, { select: n = !1 } = {}) {
|
|
85
|
+
const t = document.activeElement;
|
|
86
|
+
for (const o of e)
|
|
87
|
+
if (C(o, { select: n }), document.activeElement !== t) return;
|
|
88
|
+
}
|
|
89
|
+
function Pe(e) {
|
|
90
|
+
const n = X(e), t = Y(n, e), o = Y(n.reverse(), e);
|
|
91
|
+
return [t, o];
|
|
92
|
+
}
|
|
93
|
+
function X(e) {
|
|
94
|
+
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
95
|
+
acceptNode: (o) => {
|
|
96
|
+
const a = o.tagName === "INPUT" && o.type === "hidden";
|
|
97
|
+
return o.disabled || o.hidden || a ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
101
|
+
return n;
|
|
102
|
+
}
|
|
103
|
+
function Y(e, n) {
|
|
104
|
+
for (const t of e)
|
|
105
|
+
if (!Te(t, { upTo: n })) return t;
|
|
106
|
+
}
|
|
107
|
+
function Te(e, { upTo: n }) {
|
|
108
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
109
|
+
for (; e; ) {
|
|
110
|
+
if (n !== void 0 && e === n) return !1;
|
|
111
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
112
|
+
e = e.parentElement;
|
|
113
|
+
}
|
|
114
|
+
return !1;
|
|
115
|
+
}
|
|
116
|
+
function Fe(e) {
|
|
117
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
118
|
+
}
|
|
119
|
+
function C(e, { select: n = !1 } = {}) {
|
|
120
|
+
if (e && e.focus) {
|
|
121
|
+
const t = document.activeElement;
|
|
122
|
+
e.focus({ preventScroll: !0 }), e !== t && Fe(e) && n && e.select();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var Z = Se();
|
|
126
|
+
function Se() {
|
|
127
|
+
let e = [];
|
|
128
|
+
return {
|
|
129
|
+
add(n) {
|
|
130
|
+
const t = e[0];
|
|
131
|
+
n !== t && (t == null || t.pause()), e = z(e, n), e.unshift(n);
|
|
132
|
+
},
|
|
133
|
+
remove(n) {
|
|
134
|
+
var t;
|
|
135
|
+
e = z(e, n), (t = e[0]) == null || t.resume();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function z(e, n) {
|
|
140
|
+
const t = [...e], o = t.indexOf(n);
|
|
141
|
+
return o !== -1 && t.splice(o, 1), t;
|
|
142
|
+
}
|
|
143
|
+
function Me(e) {
|
|
144
|
+
return e.filter((n) => n.tagName !== "A");
|
|
145
|
+
}
|
|
146
|
+
var L = 0;
|
|
147
|
+
function xe() {
|
|
148
|
+
i.useEffect(() => {
|
|
149
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
150
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? J()), document.body.insertAdjacentElement("beforeend", e[1] ?? J()), L++, () => {
|
|
151
|
+
L === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((n) => n.remove()), L--;
|
|
152
|
+
};
|
|
153
|
+
}, []);
|
|
154
|
+
}
|
|
155
|
+
function J() {
|
|
156
|
+
const e = document.createElement("span");
|
|
157
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
158
|
+
}
|
|
159
|
+
var we = function(e) {
|
|
160
|
+
if (typeof document > "u")
|
|
161
|
+
return null;
|
|
162
|
+
var n = Array.isArray(e) ? e[0] : e;
|
|
163
|
+
return n.ownerDocument.body;
|
|
164
|
+
}, R = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), T = {}, k = 0, ee = function(e) {
|
|
165
|
+
return e && (e.host || ee(e.parentNode));
|
|
166
|
+
}, Le = function(e, n) {
|
|
167
|
+
return n.map(function(t) {
|
|
168
|
+
if (e.contains(t))
|
|
169
|
+
return t;
|
|
170
|
+
var o = ee(t);
|
|
171
|
+
return o && e.contains(o) ? o : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
|
|
172
|
+
}).filter(function(t) {
|
|
173
|
+
return !!t;
|
|
174
|
+
});
|
|
175
|
+
}, ke = function(e, n, t, o) {
|
|
176
|
+
var a = Le(n, Array.isArray(e) ? e : [e]);
|
|
177
|
+
T[t] || (T[t] = /* @__PURE__ */ new WeakMap());
|
|
178
|
+
var r = T[t], c = [], s = /* @__PURE__ */ new Set(), g = new Set(a), m = function(u) {
|
|
179
|
+
!u || s.has(u) || (s.add(u), m(u.parentNode));
|
|
180
|
+
};
|
|
181
|
+
a.forEach(m);
|
|
182
|
+
var h = function(u) {
|
|
183
|
+
!u || g.has(u) || Array.prototype.forEach.call(u.children, function(d) {
|
|
184
|
+
if (s.has(d))
|
|
185
|
+
h(d);
|
|
186
|
+
else
|
|
187
|
+
try {
|
|
188
|
+
var p = d.getAttribute(o), I = p !== null && p !== "false", l = (R.get(d) || 0) + 1, b = (r.get(d) || 0) + 1;
|
|
189
|
+
R.set(d, l), r.set(d, b), c.push(d), l === 1 && I && P.set(d, !0), b === 1 && d.setAttribute(t, "true"), I || d.setAttribute(o, "true");
|
|
190
|
+
} catch (v) {
|
|
191
|
+
console.error("aria-hidden: cannot operate on ", d, v);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
return h(n), s.clear(), k++, function() {
|
|
196
|
+
c.forEach(function(u) {
|
|
197
|
+
var d = R.get(u) - 1, p = r.get(u) - 1;
|
|
198
|
+
R.set(u, d), r.set(u, p), d || (P.has(u) || u.removeAttribute(o), P.delete(u)), p || u.removeAttribute(t);
|
|
199
|
+
}), k--, k || (R = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), T = {});
|
|
200
|
+
};
|
|
201
|
+
}, We = function(e, n, t) {
|
|
202
|
+
t === void 0 && (t = "data-aria-hidden");
|
|
203
|
+
var o = Array.from(Array.isArray(e) ? e : [e]), a = we(e);
|
|
204
|
+
return a ? (o.push.apply(o, Array.from(a.querySelectorAll("[aria-live]"))), ke(o, a, t, "aria-hidden")) : function() {
|
|
205
|
+
return null;
|
|
206
|
+
};
|
|
207
|
+
}, U = "Dialog", [te, et] = ye(U), [Ue, E] = te(U), ne = (e) => {
|
|
208
|
+
const {
|
|
209
|
+
__scopeDialog: n,
|
|
210
|
+
children: t,
|
|
211
|
+
open: o,
|
|
212
|
+
defaultOpen: a,
|
|
213
|
+
onOpenChange: r,
|
|
214
|
+
modal: c = !0
|
|
215
|
+
} = e, s = i.useRef(null), g = i.useRef(null), [m = !1, h] = he({
|
|
216
|
+
prop: o,
|
|
217
|
+
defaultProp: a,
|
|
218
|
+
onChange: r
|
|
219
|
+
});
|
|
220
|
+
return /* @__PURE__ */ f(
|
|
221
|
+
Ue,
|
|
222
|
+
{
|
|
223
|
+
scope: n,
|
|
224
|
+
triggerRef: s,
|
|
225
|
+
contentRef: g,
|
|
226
|
+
contentId: M(),
|
|
227
|
+
titleId: M(),
|
|
228
|
+
descriptionId: M(),
|
|
229
|
+
open: m,
|
|
230
|
+
onOpenChange: h,
|
|
231
|
+
onOpenToggle: i.useCallback(() => h((u) => !u), [h]),
|
|
232
|
+
modal: c,
|
|
233
|
+
children: t
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
ne.displayName = U;
|
|
238
|
+
var oe = "DialogTrigger", re = i.forwardRef(
|
|
239
|
+
(e, n) => {
|
|
240
|
+
const { __scopeDialog: t, ...o } = e, a = E(oe, t), r = S(n, a.triggerRef);
|
|
241
|
+
return /* @__PURE__ */ f(
|
|
242
|
+
N.button,
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
"aria-haspopup": "dialog",
|
|
246
|
+
"aria-expanded": a.open,
|
|
247
|
+
"aria-controls": a.contentId,
|
|
248
|
+
"data-state": $(a.open),
|
|
249
|
+
...o,
|
|
250
|
+
ref: r,
|
|
251
|
+
onClick: _(e.onClick, a.onOpenToggle)
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
re.displayName = oe;
|
|
257
|
+
var K = "DialogPortal", [Ke, ae] = te(K, {
|
|
258
|
+
forceMount: void 0
|
|
259
|
+
}), se = (e) => {
|
|
260
|
+
const { __scopeDialog: n, forceMount: t, children: o, container: a } = e, r = E(K, n);
|
|
261
|
+
return /* @__PURE__ */ f(Ke, { scope: n, forceMount: t, children: i.Children.map(o, (c) => /* @__PURE__ */ f(W, { present: t || r.open, children: /* @__PURE__ */ f(Ce, { asChild: !0, container: a, children: c }) })) });
|
|
262
|
+
};
|
|
263
|
+
se.displayName = K;
|
|
264
|
+
var F = "DialogOverlay", ie = i.forwardRef(
|
|
265
|
+
(e, n) => {
|
|
266
|
+
const t = ae(F, e.__scopeDialog), { forceMount: o = t.forceMount, ...a } = e, r = E(F, e.__scopeDialog);
|
|
267
|
+
return r.modal ? /* @__PURE__ */ f(W, { present: o || r.open, children: /* @__PURE__ */ f(Ge, { ...a, ref: n }) }) : null;
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
ie.displayName = F;
|
|
271
|
+
var Ge = i.forwardRef(
|
|
272
|
+
(e, n) => {
|
|
273
|
+
const { __scopeDialog: t, ...o } = e, a = E(F, t);
|
|
274
|
+
return (
|
|
275
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
276
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
277
|
+
/* @__PURE__ */ f(Re, { as: be, allowPinchZoom: !0, shards: [a.contentRef], children: /* @__PURE__ */ f(
|
|
278
|
+
N.div,
|
|
279
|
+
{
|
|
280
|
+
"data-state": $(a.open),
|
|
281
|
+
...o,
|
|
282
|
+
ref: n,
|
|
283
|
+
style: { pointerEvents: "auto", ...o.style }
|
|
284
|
+
}
|
|
285
|
+
) })
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
), A = "DialogContent", ce = i.forwardRef(
|
|
289
|
+
(e, n) => {
|
|
290
|
+
const t = ae(A, e.__scopeDialog), { forceMount: o = t.forceMount, ...a } = e, r = E(A, e.__scopeDialog);
|
|
291
|
+
return /* @__PURE__ */ f(W, { present: o || r.open, children: r.modal ? /* @__PURE__ */ f($e, { ...a, ref: n }) : /* @__PURE__ */ f(He, { ...a, ref: n }) });
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
ce.displayName = A;
|
|
295
|
+
var $e = i.forwardRef(
|
|
296
|
+
(e, n) => {
|
|
297
|
+
const t = E(A, e.__scopeDialog), o = i.useRef(null), a = S(n, t.contentRef, o);
|
|
298
|
+
return i.useEffect(() => {
|
|
299
|
+
const r = o.current;
|
|
300
|
+
if (r) return We(r);
|
|
301
|
+
}, []), /* @__PURE__ */ f(
|
|
302
|
+
ue,
|
|
303
|
+
{
|
|
304
|
+
...e,
|
|
305
|
+
ref: a,
|
|
306
|
+
trapFocus: t.open,
|
|
307
|
+
disableOutsidePointerEvents: !0,
|
|
308
|
+
onCloseAutoFocus: _(e.onCloseAutoFocus, (r) => {
|
|
309
|
+
var c;
|
|
310
|
+
r.preventDefault(), (c = t.triggerRef.current) == null || c.focus();
|
|
311
|
+
}),
|
|
312
|
+
onPointerDownOutside: _(e.onPointerDownOutside, (r) => {
|
|
313
|
+
const c = r.detail.originalEvent, s = c.button === 0 && c.ctrlKey === !0;
|
|
314
|
+
(c.button === 2 || s) && r.preventDefault();
|
|
315
|
+
}),
|
|
316
|
+
onFocusOutside: _(
|
|
317
|
+
e.onFocusOutside,
|
|
318
|
+
(r) => r.preventDefault()
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
), He = i.forwardRef(
|
|
324
|
+
(e, n) => {
|
|
325
|
+
const t = E(A, e.__scopeDialog), o = i.useRef(!1), a = i.useRef(!1);
|
|
326
|
+
return /* @__PURE__ */ f(
|
|
327
|
+
ue,
|
|
328
|
+
{
|
|
329
|
+
...e,
|
|
330
|
+
ref: n,
|
|
331
|
+
trapFocus: !1,
|
|
332
|
+
disableOutsidePointerEvents: !1,
|
|
333
|
+
onCloseAutoFocus: (r) => {
|
|
334
|
+
var c, s;
|
|
335
|
+
(c = e.onCloseAutoFocus) == null || c.call(e, r), r.defaultPrevented || (o.current || (s = t.triggerRef.current) == null || s.focus(), r.preventDefault()), o.current = !1, a.current = !1;
|
|
336
|
+
},
|
|
337
|
+
onInteractOutside: (r) => {
|
|
338
|
+
var g, m;
|
|
339
|
+
(g = e.onInteractOutside) == null || g.call(e, r), r.defaultPrevented || (o.current = !0, r.detail.originalEvent.type === "pointerdown" && (a.current = !0));
|
|
340
|
+
const c = r.target;
|
|
341
|
+
((m = t.triggerRef.current) == null ? void 0 : m.contains(c)) && r.preventDefault(), r.detail.originalEvent.type === "focusin" && a.current && r.preventDefault();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
), ue = i.forwardRef(
|
|
347
|
+
(e, n) => {
|
|
348
|
+
const { __scopeDialog: t, trapFocus: o, onOpenAutoFocus: a, onCloseAutoFocus: r, ...c } = e, s = E(A, t), g = i.useRef(null), m = S(n, g);
|
|
349
|
+
return xe(), /* @__PURE__ */ q(B, { children: [
|
|
350
|
+
/* @__PURE__ */ f(
|
|
351
|
+
Q,
|
|
352
|
+
{
|
|
353
|
+
asChild: !0,
|
|
354
|
+
loop: !0,
|
|
355
|
+
trapped: o,
|
|
356
|
+
onMountAutoFocus: a,
|
|
357
|
+
onUnmountAutoFocus: r,
|
|
358
|
+
children: /* @__PURE__ */ f(
|
|
359
|
+
Ae,
|
|
360
|
+
{
|
|
361
|
+
role: "dialog",
|
|
362
|
+
id: s.contentId,
|
|
363
|
+
"aria-describedby": s.descriptionId,
|
|
364
|
+
"aria-labelledby": s.titleId,
|
|
365
|
+
"data-state": $(s.open),
|
|
366
|
+
...c,
|
|
367
|
+
ref: m,
|
|
368
|
+
onDismiss: () => s.onOpenChange(!1)
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
/* @__PURE__ */ q(B, { children: [
|
|
374
|
+
/* @__PURE__ */ f(je, { titleId: s.titleId }),
|
|
375
|
+
/* @__PURE__ */ f(Be, { contentRef: g, descriptionId: s.descriptionId })
|
|
376
|
+
] })
|
|
377
|
+
] });
|
|
378
|
+
}
|
|
379
|
+
), G = "DialogTitle", le = i.forwardRef(
|
|
380
|
+
(e, n) => {
|
|
381
|
+
const { __scopeDialog: t, ...o } = e, a = E(G, t);
|
|
382
|
+
return /* @__PURE__ */ f(N.h2, { id: a.titleId, ...o, ref: n });
|
|
383
|
+
}
|
|
384
|
+
);
|
|
385
|
+
le.displayName = G;
|
|
386
|
+
var fe = "DialogDescription", de = i.forwardRef(
|
|
387
|
+
(e, n) => {
|
|
388
|
+
const { __scopeDialog: t, ...o } = e, a = E(fe, t);
|
|
389
|
+
return /* @__PURE__ */ f(N.p, { id: a.descriptionId, ...o, ref: n });
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
de.displayName = fe;
|
|
393
|
+
var pe = "DialogClose", ve = i.forwardRef(
|
|
394
|
+
(e, n) => {
|
|
395
|
+
const { __scopeDialog: t, ...o } = e, a = E(pe, t);
|
|
396
|
+
return /* @__PURE__ */ f(
|
|
397
|
+
N.button,
|
|
398
|
+
{
|
|
399
|
+
type: "button",
|
|
400
|
+
...o,
|
|
401
|
+
ref: n,
|
|
402
|
+
onClick: _(e.onClick, () => a.onOpenChange(!1))
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
ve.displayName = pe;
|
|
408
|
+
function $(e) {
|
|
409
|
+
return e ? "open" : "closed";
|
|
410
|
+
}
|
|
411
|
+
var me = "DialogTitleWarning", [tt, ge] = De(me, {
|
|
412
|
+
contentName: A,
|
|
413
|
+
titleName: G,
|
|
414
|
+
docsSlug: "dialog"
|
|
415
|
+
}), je = ({ titleId: e }) => {
|
|
416
|
+
const n = ge(me), t = `\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.
|
|
417
|
+
|
|
418
|
+
If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
419
|
+
|
|
420
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;
|
|
421
|
+
return i.useEffect(() => {
|
|
422
|
+
e && (document.getElementById(e) || console.error(t));
|
|
423
|
+
}, [t, e]), null;
|
|
424
|
+
}, qe = "DialogDescriptionWarning", Be = ({ contentRef: e, descriptionId: n }) => {
|
|
425
|
+
const o = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ge(qe).contentName}}.`;
|
|
426
|
+
return i.useEffect(() => {
|
|
427
|
+
var r;
|
|
428
|
+
const a = (r = e.current) == null ? void 0 : r.getAttribute("aria-describedby");
|
|
429
|
+
n && a && (document.getElementById(n) || console.warn(o));
|
|
430
|
+
}, [o, e, n]), null;
|
|
431
|
+
}, nt = ne, ot = re, rt = se, at = ie, st = ce, it = le, ct = de, ut = ve;
|
|
432
|
+
export {
|
|
433
|
+
st as C,
|
|
434
|
+
le as D,
|
|
435
|
+
at as O,
|
|
436
|
+
rt as P,
|
|
437
|
+
nt as R,
|
|
438
|
+
it as T,
|
|
439
|
+
tt as W,
|
|
440
|
+
se as a,
|
|
441
|
+
ut as b,
|
|
442
|
+
et as c,
|
|
443
|
+
ct as d,
|
|
444
|
+
ot as e,
|
|
445
|
+
M as u
|
|
446
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Config } from 'tailwindcss/types/config';
|
|
|
4
4
|
import { Context } from 'react';
|
|
5
5
|
import { FC } from 'react';
|
|
6
6
|
import { ForwardRefExoticComponent } from 'react';
|
|
7
|
+
import { FunctionComponent } from 'react';
|
|
7
8
|
import { HTMLAttributes } from 'react';
|
|
8
9
|
import { HtmlHTMLAttributes } from 'react';
|
|
9
10
|
import { InputHTMLAttributes } from 'react';
|
|
@@ -14,6 +15,8 @@ import { RefAttributes } from 'react';
|
|
|
14
15
|
import { SliderProps } from '@radix-ui/react-slider';
|
|
15
16
|
import { VariantProps } from 'class-variance-authority';
|
|
16
17
|
|
|
18
|
+
export declare const Alert: FC<AlertProps>;
|
|
19
|
+
|
|
17
20
|
export declare const AlertDialog: FC<AlertDialogProps>;
|
|
18
21
|
|
|
19
22
|
declare interface AlertDialogProps extends PropsWithChildren, VariantProps<typeof buttonAlertDialogVariants> {
|
|
@@ -29,6 +32,19 @@ declare interface AlertDialogProps extends PropsWithChildren, VariantProps<typeo
|
|
|
29
32
|
onConfirm?: () => void;
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
declare interface AlertProps extends VariantProps<typeof alertVariants> {
|
|
36
|
+
dismissible?: boolean;
|
|
37
|
+
content: string | ReactNode;
|
|
38
|
+
isVisible?: boolean;
|
|
39
|
+
showCloseButton?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare const alertVariants: (props?: ({
|
|
43
|
+
theme?: "kubefirst" | "colony" | "civo" | null | undefined;
|
|
44
|
+
type?: "sucess" | "info" | "warning" | "danger" | null | undefined;
|
|
45
|
+
isVisible?: boolean | null | undefined;
|
|
46
|
+
} & ClassProp) | undefined) => string;
|
|
47
|
+
|
|
32
48
|
export declare const Autocomplete: ForwardRefExoticComponent<AutocompleteProps & RefAttributes<HTMLInputElement>>;
|
|
33
49
|
|
|
34
50
|
declare interface AutocompleteProps extends VariantProps<typeof autocompleteVariants> {
|
|
@@ -73,7 +89,7 @@ declare interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
declare const buttonVariants: (props?: ({
|
|
76
|
-
variant?: "
|
|
92
|
+
variant?: "danger" | "circle" | "text" | "primary" | "secondary" | null | undefined;
|
|
77
93
|
version?: "default" | "alternate" | null | undefined;
|
|
78
94
|
theme?: "kubefirst" | "colony" | "civo" | null | undefined;
|
|
79
95
|
disabled?: boolean | null | undefined;
|
|
@@ -114,6 +130,8 @@ declare const checkboxVariants: (props?: ({
|
|
|
114
130
|
checked?: boolean | null | undefined;
|
|
115
131
|
} & ClassProp) | undefined) => string;
|
|
116
132
|
|
|
133
|
+
export declare const Divider: FunctionComponent<HTMLAttributes<HTMLDivElement>>;
|
|
134
|
+
|
|
117
135
|
export declare const Dropdown: FC<DropdownProps>;
|
|
118
136
|
|
|
119
137
|
declare interface DropdownProps extends VariantProps<typeof dropdownVariants> {
|
|
@@ -123,6 +141,8 @@ declare interface DropdownProps extends VariantProps<typeof dropdownVariants> {
|
|
|
123
141
|
options: Option_3[];
|
|
124
142
|
placeholder?: string;
|
|
125
143
|
onChange?: (value: Option_3) => void;
|
|
144
|
+
labelClassName?: string;
|
|
145
|
+
required?: boolean;
|
|
126
146
|
}
|
|
127
147
|
|
|
128
148
|
declare const dropdownVariants: (props?: ({
|
|
@@ -139,17 +159,18 @@ declare const footerVariants: (props?: ({
|
|
|
139
159
|
theme?: "kubefirst" | "colony" | "civo" | null | undefined;
|
|
140
160
|
} & ClassProp) | undefined) => string;
|
|
141
161
|
|
|
162
|
+
declare type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
163
|
+
|
|
142
164
|
export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
|
|
143
165
|
|
|
144
166
|
declare interface InputProps extends InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
|
|
145
|
-
label?: string;
|
|
167
|
+
label?: string | ReactNode;
|
|
146
168
|
labelClassName?: string;
|
|
147
169
|
error?: string;
|
|
148
|
-
onClickIcon?: () => void;
|
|
149
170
|
}
|
|
150
171
|
|
|
151
172
|
declare const inputVariants: (props?: ({
|
|
152
|
-
variant?: "
|
|
173
|
+
variant?: "error" | "default" | null | undefined;
|
|
153
174
|
theme?: "kubefirst" | "colony" | "civo" | null | undefined;
|
|
154
175
|
} & ClassProp) | undefined) => string;
|
|
155
176
|
|
|
@@ -158,6 +179,14 @@ export declare const konstructPlugin: {
|
|
|
158
179
|
config?: Partial<Config>;
|
|
159
180
|
};
|
|
160
181
|
|
|
182
|
+
export declare const Loading: FunctionComponent<LoadingProps>;
|
|
183
|
+
|
|
184
|
+
declare type LoadingProps = InputHTMLAttributes<SVGSVGElement> & VariantProps<typeof loadingVariants>;
|
|
185
|
+
|
|
186
|
+
declare const loadingVariants: (props?: ({
|
|
187
|
+
theme?: "kubefirst" | "colony" | "civo" | null | undefined;
|
|
188
|
+
} & ClassProp) | undefined) => string;
|
|
189
|
+
|
|
161
190
|
export declare const Logo: FC<LogoProps>;
|
|
162
191
|
|
|
163
192
|
declare interface LogoProps extends PropsWithChildren, VariantProps<typeof logoVariants> {
|
|
@@ -183,6 +212,8 @@ declare type ModalChildProps = {
|
|
|
183
212
|
declare interface ModalProps extends PropsWithChildren, VariantProps<typeof modalVariants> {
|
|
184
213
|
className?: string;
|
|
185
214
|
buttonCloseClassName?: string;
|
|
215
|
+
isOpen?: boolean;
|
|
216
|
+
onClose?: () => void;
|
|
186
217
|
}
|
|
187
218
|
|
|
188
219
|
declare const modalVariants: (props?: ({
|
|
@@ -431,8 +462,14 @@ declare const switchVariants: (props?: ({
|
|
|
431
462
|
export declare const Tag: FC<TagProps>;
|
|
432
463
|
|
|
433
464
|
declare type TagProps = {
|
|
434
|
-
label: string;
|
|
435
465
|
color?: 'gray' | 'cyan' | 'gold' | 'green' | 'light blue' | 'lime' | 'pink' | 'purple' | 'emerald' | 'fuscia' | 'indigo' | 'light-orange' | 'dark-sky-blue' | 'mistery';
|
|
466
|
+
id: string | number;
|
|
467
|
+
label: string;
|
|
468
|
+
rightIcon?: ReactNode;
|
|
469
|
+
leftIcon?: ReactNode;
|
|
470
|
+
className?: string;
|
|
471
|
+
'data-value'?: string;
|
|
472
|
+
isSelected?: boolean;
|
|
436
473
|
};
|
|
437
474
|
|
|
438
475
|
export declare const TagSelect: FC<TagSelectProps>;
|
|
@@ -442,6 +479,9 @@ declare interface TagSelectProps extends VariantProps<typeof tagSelectVariants>
|
|
|
442
479
|
options: TagProps[];
|
|
443
480
|
name?: string;
|
|
444
481
|
placeholder?: string;
|
|
482
|
+
labelClassName?: string;
|
|
483
|
+
wrapperClassName?: string;
|
|
484
|
+
multiselect?: boolean;
|
|
445
485
|
}
|
|
446
486
|
|
|
447
487
|
declare const tagSelectVariants: (props?: ({
|
|
@@ -452,10 +492,9 @@ export declare const TextArea: FC<TextAreaProps>;
|
|
|
452
492
|
|
|
453
493
|
declare interface TextAreaProps extends InputHTMLAttributes<HTMLTextAreaElement>, VariantProps<typeof textAreaVariants> {
|
|
454
494
|
rows?: number;
|
|
455
|
-
label?: string;
|
|
495
|
+
label?: string | ReactNode;
|
|
456
496
|
name?: string;
|
|
457
497
|
initialValue?: string;
|
|
458
|
-
onChange?: () => void;
|
|
459
498
|
}
|
|
460
499
|
|
|
461
500
|
declare const textAreaVariants: (props?: ({
|
|
@@ -492,6 +531,9 @@ declare interface ToastProps extends PropsWithChildren, VariantProps<typeof toas
|
|
|
492
531
|
showCloseButton?: boolean;
|
|
493
532
|
title: string | ReactNode;
|
|
494
533
|
titleClassName?: string;
|
|
534
|
+
open: boolean;
|
|
535
|
+
setOpen: (open: boolean) => void;
|
|
536
|
+
closeButtonClassName?: string;
|
|
495
537
|
}
|
|
496
538
|
|
|
497
539
|
declare const toastVariants: (props?: ({
|
|
@@ -511,6 +553,18 @@ declare const tooltipVariants: (props?: ({
|
|
|
511
553
|
position?: "left" | "right" | "top" | "bottom" | null | undefined;
|
|
512
554
|
} & ClassProp) | undefined) => string;
|
|
513
555
|
|
|
556
|
+
export declare const Typography: FunctionComponent<TypographyProps>;
|
|
557
|
+
|
|
558
|
+
declare interface TypographyProps extends InputHTMLAttributes<HTMLParagraphElement>, VariantProps<typeof typographyVariants> {
|
|
559
|
+
children: ReactNode;
|
|
560
|
+
component?: HeadingTag | 'p' | 'span';
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
declare const typographyVariants: (props?: ({
|
|
564
|
+
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "tooltip" | "subtitle1" | "subtitle2" | "subtitle3" | "labelLarge" | "labelMedium" | "labelSmall" | "buttonSmall" | "body1" | "body2" | "body3" | null | undefined;
|
|
565
|
+
theme?: "kubefirst" | "colony" | "civo" | null | undefined;
|
|
566
|
+
} & ClassProp) | undefined) => string;
|
|
567
|
+
|
|
514
568
|
export declare const useTheme: () => ThemeProps;
|
|
515
569
|
|
|
516
570
|
export declare const useToggle: (initialState?: boolean) => [boolean, (value?: boolean) => void];
|