@apo100l/ace-ui-kit 0.0.2 → 0.2.0
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 +58 -5
- package/dist/ace-compat.css +1 -1
- package/dist/ace-compat.js +189 -0
- package/dist/ace-compat.js.map +1 -0
- package/dist/ace-ui-kit.css +1 -1
- package/dist/ace-ui-kit.js +312 -8
- package/dist/ace-ui-kit.js.map +1 -1
- package/dist/compat.d.ts +14 -0
- package/dist/icons.svg +58 -0
- package/dist/index.d.ts +7 -0
- package/dist/js/compat/ace.d.ts +2 -0
- package/dist/js/compat/bootstrap.d.ts +9 -0
- package/dist/js/dialog.d.ts +3 -0
- package/dist/js/file.d.ts +1 -0
- package/dist/js/icon.d.ts +13 -0
- package/dist/js/init.d.ts +4 -2
- package/dist/js/menu.d.ts +1 -0
- package/dist/js/sidebar.d.ts +1 -0
- package/dist/js/stepper.d.ts +2 -0
- package/dist/js/tabs.d.ts +3 -0
- package/dist/js/toast.d.ts +16 -0
- package/dist/js/tooltip.d.ts +1 -0
- package/package.json +20 -7
- package/src/icons/icons.json +311 -0
- package/src/scss/_breakpoints.scss +32 -0
- package/src/scss/_tokens.scss +175 -33
- package/src/scss/compat/_base.scss +144 -0
- package/src/scss/compat/_buttons.scss +100 -0
- package/src/scss/compat/_feedback.scss +187 -0
- package/src/scss/compat/_forms.scss +232 -0
- package/src/scss/compat/_grid.scss +107 -0
- package/src/scss/compat/_layout.scss +427 -0
- package/src/scss/compat/_navigation.scss +159 -0
- package/src/scss/compat/_plugins.scss +105 -0
- package/src/scss/compat/_tables.scss +105 -0
- package/src/scss/compat/_utilities.scss +160 -0
- package/src/scss/compat/_widgets.scss +126 -0
- package/src/scss/compat/index.scss +18 -10
- package/src/scss/components/_alert.scss +21 -22
- package/src/scss/components/_badge.scss +48 -0
- package/src/scss/components/_button.scss +34 -33
- package/src/scss/components/_card.scss +66 -0
- package/src/scss/components/_feedback.scss +219 -0
- package/src/scss/components/_form.scss +336 -0
- package/src/scss/components/_icon.scss +29 -0
- package/src/scss/components/_overlay.scss +174 -0
- package/src/scss/components/_shell.scss +326 -0
- package/src/scss/components/_table.scss +301 -0
- package/src/scss/components/_tabs.scss +56 -0
- package/src/scss/index.scss +10 -0
- package/src/scss/mixins/_alert.scss +65 -0
- package/src/scss/mixins/_badge.scss +59 -0
- package/src/scss/mixins/_button.scss +102 -0
- package/src/scss/mixins/_card.scss +40 -0
- package/src/scss/mixins/_form.scss +76 -0
- package/src/scss/mixins/_menu.scss +53 -0
- package/src/scss/mixins/_table.scss +23 -0
package/dist/ace-ui-kit.js
CHANGED
|
@@ -1,16 +1,320 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
let T = !1;
|
|
2
|
+
function P(e) {
|
|
3
|
+
e.open || (e.showModal(), document.documentElement.classList.add("ak-dialog-open"));
|
|
4
|
+
}
|
|
5
|
+
function D(e, t) {
|
|
6
|
+
e.open && e.close(t);
|
|
7
|
+
}
|
|
8
|
+
function U() {
|
|
9
|
+
const e = document.querySelector("dialog.ak-dialog[open]");
|
|
10
|
+
document.documentElement.classList.toggle("ak-dialog-open", !!e);
|
|
11
|
+
}
|
|
12
|
+
function V() {
|
|
13
|
+
T || (T = !0, document.addEventListener("click", (e) => {
|
|
14
|
+
const t = e.target instanceof Element ? e.target : null;
|
|
15
|
+
if (!t) return;
|
|
16
|
+
const n = t.closest("[data-ak-dialog-open]");
|
|
17
|
+
if (n) {
|
|
18
|
+
const i = document.getElementById(n.dataset.akDialogOpen ?? "");
|
|
19
|
+
i instanceof HTMLDialogElement && (e.preventDefault(), P(i));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const o = t.closest("[data-ak-dialog-close]");
|
|
23
|
+
if (o) {
|
|
24
|
+
const i = o.closest("dialog");
|
|
25
|
+
i && D(i, o.dataset.akDialogClose || void 0);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (t instanceof HTMLDialogElement && t.open && t.classList.contains("ak-dialog") && !t.hasAttribute("data-ak-static")) {
|
|
29
|
+
const i = t.getBoundingClientRect(), { clientX: a, clientY: s } = e;
|
|
30
|
+
(a < i.left || a > i.right || s < i.top || s > i.bottom) && D(t, "cancel");
|
|
31
|
+
}
|
|
32
|
+
}), document.addEventListener("close", U, !0));
|
|
33
|
+
}
|
|
34
|
+
const $ = "akBound";
|
|
35
|
+
function j(e = document) {
|
|
36
|
+
e.querySelectorAll("[data-ak-dismiss]").forEach((t) => {
|
|
37
|
+
t.dataset[$] || (t.dataset[$] = "1", t.addEventListener("click", () => {
|
|
5
38
|
t.closest("[data-ak-dismissible], .ak-alert")?.remove();
|
|
6
39
|
}));
|
|
7
40
|
});
|
|
8
41
|
}
|
|
9
|
-
|
|
10
|
-
|
|
42
|
+
let C = !1;
|
|
43
|
+
const X = (e) => e < 1024 ? `${e} Б` : e < 1048576 ? `${(e / 1024).toFixed(0)} КБ` : `${(e / 1048576).toFixed(1).replace(".", ",")} МБ`;
|
|
44
|
+
function Y(e, t) {
|
|
45
|
+
const n = e.querySelector(".ak-file__list");
|
|
46
|
+
if (!n) return;
|
|
47
|
+
const o = Number(t.dataset.maxSize) || 1 / 0;
|
|
48
|
+
n.replaceChildren(
|
|
49
|
+
...[...t.files ?? []].map((a) => {
|
|
50
|
+
const s = document.createElement("span");
|
|
51
|
+
s.className = "ak-file__item";
|
|
52
|
+
const l = a.size > o;
|
|
53
|
+
return s.toggleAttribute("data-invalid", l), s.textContent = `${a.name} · ${X(a.size)}${l ? " — больше допустимого" : ""}`, s;
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
const i = [...t.files ?? []].some((a) => a.size > o);
|
|
57
|
+
t.setCustomValidity(i ? "Файл больше допустимого размера" : ""), e.toggleAttribute("data-has-files", !!t.files?.length);
|
|
58
|
+
}
|
|
59
|
+
function G() {
|
|
60
|
+
if (C) return;
|
|
61
|
+
C = !0, document.addEventListener("change", (t) => {
|
|
62
|
+
const n = t.target;
|
|
63
|
+
if (!(n instanceof HTMLInputElement) || n.type !== "file") return;
|
|
64
|
+
const o = n.closest(".ak-file");
|
|
65
|
+
o && Y(o, n);
|
|
66
|
+
});
|
|
67
|
+
const e = (t) => t.target?.closest?.(".ak-file") ?? null;
|
|
68
|
+
document.addEventListener("dragover", (t) => {
|
|
69
|
+
const n = e(t);
|
|
70
|
+
n && (t.preventDefault(), n.setAttribute("data-dragover", ""));
|
|
71
|
+
}), document.addEventListener("dragleave", (t) => {
|
|
72
|
+
const n = e(t);
|
|
73
|
+
n && !n.contains(t.relatedTarget) && n.removeAttribute("data-dragover");
|
|
74
|
+
}), document.addEventListener("drop", (t) => {
|
|
75
|
+
const n = e(t);
|
|
76
|
+
if (!n) return;
|
|
77
|
+
t.preventDefault(), n.removeAttribute("data-dragover");
|
|
78
|
+
const o = n.querySelector('input[type="file"]'), i = t.dataTransfer?.files;
|
|
79
|
+
if (!o || !i?.length || o.disabled) return;
|
|
80
|
+
const a = new DataTransfer();
|
|
81
|
+
[...i].slice(0, o.multiple ? void 0 : 1).forEach((s) => a.items.add(s)), o.files = a.files, o.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
let q = !1;
|
|
85
|
+
const v = '.ak-menu__item:not(:disabled):not([aria-disabled="true"])', K = typeof CSS < "u" && CSS.supports?.("position-area", "block-end");
|
|
86
|
+
function J(e) {
|
|
87
|
+
return e.id ? document.querySelector(`[popovertarget="${CSS.escape(e.id)}"]`) : null;
|
|
88
|
+
}
|
|
89
|
+
function Q(e, t) {
|
|
90
|
+
const n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
91
|
+
let a = e.classList.contains("ak-menu--end") ? n.right - o.width : n.left;
|
|
92
|
+
a = Math.max(8, Math.min(a, window.innerWidth - o.width - 8));
|
|
93
|
+
let s = n.bottom + 4;
|
|
94
|
+
s + o.height > window.innerHeight - 8 && n.top - o.height - 4 > 8 && (s = n.top - o.height - 4), e.style.position = "fixed", e.style.left = `${Math.round(a)}px`, e.style.top = `${Math.round(s)}px`, e.style.margin = "0";
|
|
95
|
+
}
|
|
96
|
+
function Z() {
|
|
97
|
+
q || (q = !0, document.addEventListener(
|
|
98
|
+
"toggle",
|
|
99
|
+
(e) => {
|
|
100
|
+
const t = e.target;
|
|
101
|
+
if (!(t instanceof HTMLElement) || !t.classList.contains("ak-menu")) return;
|
|
102
|
+
const n = e.newState === "open", o = J(t);
|
|
103
|
+
o?.setAttribute("aria-expanded", String(n)), n && (o && !K && Q(t, o), t.querySelector(v)?.focus());
|
|
104
|
+
},
|
|
105
|
+
!0
|
|
106
|
+
), document.addEventListener("keydown", (e) => {
|
|
107
|
+
const t = e.target?.closest?.(".ak-menu:popover-open");
|
|
108
|
+
if (!t) return;
|
|
109
|
+
const n = [...t.querySelectorAll(v)];
|
|
110
|
+
if (!n.length) return;
|
|
111
|
+
const o = n.indexOf(document.activeElement);
|
|
112
|
+
let i = -1;
|
|
113
|
+
e.key === "ArrowDown" ? i = (o + 1) % n.length : e.key === "ArrowUp" ? i = (o - 1 + n.length) % n.length : e.key === "Home" ? i = 0 : e.key === "End" ? i = n.length - 1 : e.key === "Tab" && t.hidePopover(), i >= 0 && (e.preventDefault(), n[i].focus());
|
|
114
|
+
}), document.addEventListener("click", (e) => {
|
|
115
|
+
e.target?.closest?.(v)?.closest(".ak-menu:popover-open")?.hidePopover();
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
let M = !1;
|
|
119
|
+
function y(e, t) {
|
|
120
|
+
e.toggleAttribute("data-sidebar-open", t), e.querySelectorAll("[data-ak-sidebar-toggle]").forEach((n) => n.setAttribute("aria-expanded", String(t)));
|
|
121
|
+
}
|
|
122
|
+
function tt() {
|
|
123
|
+
M || (M = !0, document.addEventListener("click", (e) => {
|
|
124
|
+
const t = e.target instanceof Element ? e.target : null, n = t?.closest("[data-ak-sidebar-toggle]"), o = t?.closest(".ak-app");
|
|
125
|
+
if (o) {
|
|
126
|
+
if (n) {
|
|
127
|
+
y(o, !o.hasAttribute("data-sidebar-open"));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
o.hasAttribute("data-sidebar-open") && !t?.closest(".ak-sidebar") && y(o, !1);
|
|
131
|
+
}
|
|
132
|
+
}), document.addEventListener("keydown", (e) => {
|
|
133
|
+
if (e.key !== "Escape") return;
|
|
134
|
+
const t = document.querySelector(".ak-app[data-sidebar-open]");
|
|
135
|
+
t && (y(t, !1), t.querySelector("[data-ak-sidebar-toggle]")?.focus());
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
let N = !1;
|
|
139
|
+
const f = (e, t) => {
|
|
140
|
+
const n = Number(e);
|
|
141
|
+
return e !== "" && Number.isFinite(n) ? n : t;
|
|
142
|
+
};
|
|
143
|
+
function _(e) {
|
|
144
|
+
const t = e.querySelector("input");
|
|
145
|
+
if (!t) return;
|
|
146
|
+
const n = f(t.value, 0);
|
|
147
|
+
e.querySelectorAll("[data-ak-step]").forEach((o) => {
|
|
148
|
+
const i = Number(o.dataset.akStep);
|
|
149
|
+
o.disabled = t.disabled || (i < 0 ? n <= f(t.min, -1 / 0) : n >= f(t.max, 1 / 0));
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function et(e, t) {
|
|
153
|
+
const n = f(e.step, 1) || 1, o = Math.min(f(e.max, 1 / 0), Math.max(f(e.min, -1 / 0), f(e.value, 0) + t * n)), i = (String(n).split(".")[1] ?? "").length;
|
|
154
|
+
e.value = o.toFixed(i), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
155
|
+
}
|
|
156
|
+
function nt(e = document) {
|
|
157
|
+
e.querySelectorAll(".ak-stepper").forEach(_), !N && (N = !0, document.addEventListener("click", (t) => {
|
|
158
|
+
const n = t.target?.closest?.(".ak-stepper [data-ak-step]"), o = n?.closest(".ak-stepper"), i = o?.querySelector("input");
|
|
159
|
+
!n || !o || !i || (t.preventDefault(), et(i, Number(n.dataset.akStep) || 1));
|
|
160
|
+
}), document.addEventListener("input", (t) => {
|
|
161
|
+
const n = t.target?.closest?.(".ak-stepper");
|
|
162
|
+
n && _(n);
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
let B = !1;
|
|
166
|
+
function A(e) {
|
|
167
|
+
return [...e.querySelectorAll(':scope > [role="tab"]')];
|
|
168
|
+
}
|
|
169
|
+
function I(e, t = !1) {
|
|
170
|
+
const n = e.closest('[role="tablist"]');
|
|
171
|
+
if (!(!n || e.getAttribute("aria-disabled") === "true")) {
|
|
172
|
+
for (const o of A(n)) {
|
|
173
|
+
const i = o === e;
|
|
174
|
+
o.setAttribute("aria-selected", String(i)), o.tabIndex = i ? 0 : -1;
|
|
175
|
+
const a = document.getElementById(o.getAttribute("aria-controls") ?? "");
|
|
176
|
+
a && (a.hidden = !i, a.hasAttribute("tabindex") || (a.tabIndex = 0));
|
|
177
|
+
}
|
|
178
|
+
t && e.focus(), n.dispatchEvent(new CustomEvent("ak:tab-change", { bubbles: !0, detail: { tab: e } }));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function ot(e = document) {
|
|
182
|
+
e.querySelectorAll('[role="tablist"]').forEach((t) => {
|
|
183
|
+
const n = A(t), o = n.find((i) => i.getAttribute("aria-selected") === "true") ?? n[0];
|
|
184
|
+
n.forEach((i) => i.tabIndex = i === o ? 0 : -1);
|
|
185
|
+
}), !B && (B = !0, document.addEventListener("click", (t) => {
|
|
186
|
+
const n = t.target?.closest?.('[role="tablist"] > [role="tab"]');
|
|
187
|
+
n && I(n);
|
|
188
|
+
}), document.addEventListener("keydown", (t) => {
|
|
189
|
+
const n = t.target?.closest?.('[role="tablist"] > [role="tab"]');
|
|
190
|
+
if (!n) return;
|
|
191
|
+
const o = A(n.parentElement).filter((s) => s.getAttribute("aria-disabled") !== "true"), i = o.indexOf(n);
|
|
192
|
+
let a;
|
|
193
|
+
t.key === "ArrowRight" ? a = o[(i + 1) % o.length] : t.key === "ArrowLeft" ? a = o[(i - 1 + o.length) % o.length] : t.key === "Home" ? a = o[0] : t.key === "End" && (a = o[o.length - 1]), a && (t.preventDefault(), I(a, !0));
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
const it = 4;
|
|
197
|
+
let u = null;
|
|
198
|
+
function at() {
|
|
199
|
+
return u?.isConnected || (u = document.createElement("section"), u.className = "ak-toaster", u.setAttribute("aria-label", "Уведомления"), document.body.append(u)), u;
|
|
200
|
+
}
|
|
201
|
+
function st(e, { tone: t = "neutral", duration: n, action: o } = {}) {
|
|
202
|
+
const i = at(), a = document.createElement("div");
|
|
203
|
+
a.className = `ak-toast ak-toast--${t}`, a.setAttribute("role", t === "negative" ? "alert" : "status"), a.setAttribute("aria-live", t === "negative" ? "assertive" : "polite");
|
|
204
|
+
const s = document.createElement("p");
|
|
205
|
+
if (s.className = "ak-toast__text", s.textContent = e, a.append(s), o) {
|
|
206
|
+
const d = document.createElement("button");
|
|
207
|
+
d.type = "button", d.className = "ak-toast__action", d.textContent = o.label, d.addEventListener("click", () => {
|
|
208
|
+
o.onClick(), b();
|
|
209
|
+
}), a.append(d);
|
|
210
|
+
}
|
|
211
|
+
const l = document.createElement("button");
|
|
212
|
+
l.type = "button", l.className = "ak-toast__close", l.setAttribute("aria-label", "Закрыть"), l.textContent = "×", l.addEventListener("click", () => b()), a.append(l), i.append(a);
|
|
213
|
+
const w = i.querySelectorAll(".ak-toast:not([data-leaving])");
|
|
214
|
+
w.length > it && w[0]._close?.(), requestAnimationFrame(() => requestAnimationFrame(() => a.setAttribute("data-shown", "")));
|
|
215
|
+
const L = n ?? (t === "negative" ? 0 : 5e3);
|
|
216
|
+
let E = L, S = 0, p = 0;
|
|
217
|
+
const g = () => {
|
|
218
|
+
p && (clearTimeout(p), p = 0, E -= Date.now() - S);
|
|
219
|
+
}, h = () => {
|
|
220
|
+
!L || p || E <= 0 || document.hidden || (S = Date.now(), p = window.setTimeout(b, E));
|
|
221
|
+
}, x = () => document.hidden ? g() : h();
|
|
222
|
+
a.addEventListener("mouseenter", g), a.addEventListener("mouseleave", h), a.addEventListener("focusin", g), a.addEventListener("focusout", h), document.addEventListener("visibilitychange", x), h();
|
|
223
|
+
function b() {
|
|
224
|
+
if (a.hasAttribute("data-leaving")) return;
|
|
225
|
+
g(), document.removeEventListener("visibilitychange", x), a.setAttribute("data-leaving", ""), a.removeAttribute("data-shown");
|
|
226
|
+
const d = () => a.remove();
|
|
227
|
+
a.addEventListener("transitionend", d, { once: !0 }), window.setTimeout(d, 400);
|
|
228
|
+
}
|
|
229
|
+
return a._close = b, { close: b };
|
|
230
|
+
}
|
|
231
|
+
function rt(e = document) {
|
|
232
|
+
e.querySelectorAll("[data-ak-toast]:not([data-ak-bound])").forEach((t) => {
|
|
233
|
+
t.setAttribute("data-ak-bound", "");
|
|
234
|
+
const n = (t instanceof HTMLTemplateElement ? t.content.textContent : t.textContent)?.trim();
|
|
235
|
+
if (!n) return;
|
|
236
|
+
const o = t.dataset.akToast || "neutral", i = t.dataset.akDuration ? Number(t.dataset.akDuration) : void 0;
|
|
237
|
+
st(n, { tone: o, duration: i }), t instanceof HTMLTemplateElement || (t.hidden = !0);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
const lt = 500, ct = 400;
|
|
241
|
+
let H = !1, c = null, r = null, k = 0, R = 0;
|
|
242
|
+
function dt() {
|
|
243
|
+
return c?.isConnected || (c = document.createElement("div"), c.className = "ak-tooltip", c.id = "ak-tooltip", c.setAttribute("role", "tooltip"), document.body.append(c)), c;
|
|
244
|
+
}
|
|
245
|
+
function ut(e) {
|
|
246
|
+
return (e.dataset.akTooltip || e.getAttribute("aria-label") || e.getAttribute("title") || "").trim();
|
|
247
|
+
}
|
|
248
|
+
function ft(e, t) {
|
|
249
|
+
const n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
250
|
+
let i = n.top - o.height - 6, a = "top";
|
|
251
|
+
i < 8 && (i = n.bottom + 6, a = "bottom");
|
|
252
|
+
const s = Math.max(8, Math.min(n.left + n.width / 2 - o.width / 2, window.innerWidth - o.width - 8));
|
|
253
|
+
t.style.top = `${Math.round(i)}px`, t.style.left = `${Math.round(s)}px`, t.dataset.side = a;
|
|
254
|
+
}
|
|
255
|
+
function O(e, t) {
|
|
256
|
+
const n = ut(e);
|
|
257
|
+
if (!n) return;
|
|
258
|
+
const o = dt();
|
|
259
|
+
r = e, o.textContent = n, o.toggleAttribute("data-instant", t), o.setAttribute("data-open", ""), ft(e, o);
|
|
260
|
+
const i = e.getAttribute("aria-describedby") ?? "";
|
|
261
|
+
i.split(" ").includes(o.id) || e.setAttribute("aria-describedby", `${i} ${o.id}`.trim());
|
|
262
|
+
}
|
|
263
|
+
function m() {
|
|
264
|
+
if (clearTimeout(k), k = 0, !r) return;
|
|
265
|
+
const e = (r.getAttribute("aria-describedby") ?? "").split(" ").filter((t) => t && t !== "ak-tooltip");
|
|
266
|
+
e.length ? r.setAttribute("aria-describedby", e.join(" ")) : r.removeAttribute("aria-describedby"), r = null, c?.removeAttribute("data-open"), R = Date.now();
|
|
267
|
+
}
|
|
268
|
+
function z(e, t) {
|
|
269
|
+
if (r === e) return;
|
|
270
|
+
clearTimeout(k);
|
|
271
|
+
const n = !!r || Date.now() - R < ct;
|
|
272
|
+
r && m(), t || n ? O(e, n) : k = window.setTimeout(() => O(e, !1), lt);
|
|
273
|
+
}
|
|
274
|
+
function mt() {
|
|
275
|
+
if (H) return;
|
|
276
|
+
H = !0;
|
|
277
|
+
const e = (t) => t.target?.closest?.("[data-ak-tooltip]") ?? null;
|
|
278
|
+
document.addEventListener("pointerover", (t) => {
|
|
279
|
+
if (t.pointerType === "touch") return;
|
|
280
|
+
const n = e(t);
|
|
281
|
+
n && z(n, !1);
|
|
282
|
+
}), document.addEventListener("pointerout", (t) => {
|
|
283
|
+
const n = e(t);
|
|
284
|
+
n && !n.contains(t.relatedTarget) && m();
|
|
285
|
+
}), document.addEventListener("focusin", (t) => {
|
|
286
|
+
const n = e(t);
|
|
287
|
+
n && n.matches(":focus-visible") && z(n, !0);
|
|
288
|
+
}), document.addEventListener("focusout", (t) => {
|
|
289
|
+
e(t) && m();
|
|
290
|
+
}), document.addEventListener("keydown", (t) => {
|
|
291
|
+
t.key === "Escape" && r && m();
|
|
292
|
+
}), window.addEventListener("scroll", m, { passive: !0, capture: !0 }), document.addEventListener("pointerdown", m);
|
|
293
|
+
}
|
|
294
|
+
function pt({ root: e = document } = {}) {
|
|
295
|
+
V(), Z(), tt(), mt(), G(), ot(e), nt(e), j(e), rt(e);
|
|
296
|
+
}
|
|
297
|
+
const F = "http://www.w3.org/2000/svg";
|
|
298
|
+
let W = "";
|
|
299
|
+
function bt(e) {
|
|
300
|
+
W = e;
|
|
301
|
+
}
|
|
302
|
+
function gt(e, { size: t, label: n, className: o } = {}) {
|
|
303
|
+
const i = document.createElementNS(F, "svg");
|
|
304
|
+
i.setAttribute("class", ["ak-icon", t && `ak-icon--${t}`, o].filter(Boolean).join(" ")), n ? (i.setAttribute("role", "img"), i.setAttribute("aria-label", n)) : i.setAttribute("aria-hidden", "true"), i.setAttribute("focusable", "false");
|
|
305
|
+
const a = document.createElementNS(F, "use");
|
|
306
|
+
return a.setAttribute("href", `${W}#${e}`), i.append(a), i;
|
|
11
307
|
}
|
|
12
308
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
309
|
+
D as closeDialog,
|
|
310
|
+
j as dismissible,
|
|
311
|
+
gt as icon,
|
|
312
|
+
pt as init,
|
|
313
|
+
P as openDialog,
|
|
314
|
+
I as selectTab,
|
|
315
|
+
bt as setIconSprite,
|
|
316
|
+
et as stepBy,
|
|
317
|
+
st as toast,
|
|
318
|
+
rt as toastsFromDom
|
|
15
319
|
};
|
|
16
320
|
//# sourceMappingURL=ace-ui-kit.js.map
|
package/dist/ace-ui-kit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ace-ui-kit.js","sources":["../src/js/dismissible.ts","../src/js/init.ts"],"sourcesContent":["const BOUND = 'akBound';\n\n/**\n * `<div class=\"ak-alert\"><button data-ak-dismiss>…</button></div>` —\n * removes the closest `[data-ak-dismissible]` (or `.ak-alert`) when the trigger is clicked.\n */\nexport function dismissible(root: ParentNode = document): void {\n root.querySelectorAll<HTMLElement>('[data-ak-dismiss]').forEach((trigger) => {\n if (trigger.dataset[BOUND]) return;\n trigger.dataset[BOUND] = '1';\n trigger.addEventListener('click', () => {\n trigger.closest('[data-ak-dismissible], .ak-alert')?.remove();\n });\n });\n}\n","import { dismissible } from './dismissible';\n\nexport interface InitOptions {\n /** Root to scan for `data-ak-*` behaviours. Defaults to `document`. */\n root?: ParentNode;\n}\n\n/**\n * Wires every declarative `data-ak-*` behaviour inside `root`.\n * Safe to call repeatedly (e.g. after injecting HTML): each behaviour marks nodes it has bound.\n */\nexport function init({ root = document }: InitOptions = {}): void {\n dismissible(root);\n}\n"],"names":["BOUND","dismissible","root","trigger","init"],"mappings":"AAAA,MAAMA,IAAQ;AAMP,SAASC,EAAYC,IAAmB,UAAgB;AAC7D,EAAAA,EAAK,iBAA8B,mBAAmB,EAAE,QAAQ,CAACC,MAAY;AAC3E,IAAIA,EAAQ,QAAQH,CAAK,MACzBG,EAAQ,QAAQH,CAAK,IAAI,KACzBG,EAAQ,iBAAiB,SAAS,MAAM;AACtC,MAAAA,EAAQ,QAAQ,kCAAkC,GAAG,OAAA;AAAA,IACvD,CAAC;AAAA,EACH,CAAC;AACH;ACHO,SAASC,EAAK,EAAE,MAAAF,IAAO,SAAA,IAA0B,CAAA,GAAU;AAChE,EAAAD,EAAYC,CAAI;AAClB;"}
|
|
1
|
+
{"version":3,"file":"ace-ui-kit.js","sources":["../src/js/dialog.ts","../src/js/dismissible.ts","../src/js/file.ts","../src/js/menu.ts","../src/js/sidebar.ts","../src/js/stepper.ts","../src/js/tabs.ts","../src/js/toast.ts","../src/js/tooltip.ts","../src/js/init.ts","../src/js/icon.ts"],"sourcesContent":["// Native <dialog> wiring. The platform gives focus trap, Escape and focus return; the kit adds:\n// [data-ak-dialog-open=\"id\"] opens #id as a modal\n// [data-ak-dialog-close] closes the closest dialog (form[method=dialog] buttons work natively)\n// click on the backdrop closes, unless the dialog has data-ak-static\n// The page under an open dialog stops scrolling (html.ak-dialog-open).\n\nlet bound = false;\n\nexport function openDialog(dialog: HTMLDialogElement): void {\n if (dialog.open) return;\n dialog.showModal();\n document.documentElement.classList.add('ak-dialog-open');\n}\n\nexport function closeDialog(dialog: HTMLDialogElement, returnValue?: string): void {\n if (dialog.open) dialog.close(returnValue);\n}\n\nfunction syncScrollLock(): void {\n const anyOpen = document.querySelector('dialog.ak-dialog[open]');\n document.documentElement.classList.toggle('ak-dialog-open', Boolean(anyOpen));\n}\n\nexport function dialogs(): void {\n if (bound) return;\n bound = true;\n\n document.addEventListener('click', (event) => {\n const target = event.target instanceof Element ? event.target : null;\n if (!target) return;\n\n const opener = target.closest<HTMLElement>('[data-ak-dialog-open]');\n if (opener) {\n const dialog = document.getElementById(opener.dataset.akDialogOpen ?? '');\n if (dialog instanceof HTMLDialogElement) {\n event.preventDefault();\n openDialog(dialog);\n }\n return;\n }\n\n const closer = target.closest<HTMLElement>('[data-ak-dialog-close]');\n if (closer) {\n const dialog = closer.closest('dialog');\n if (dialog) closeDialog(dialog, closer.dataset.akDialogClose || undefined);\n return;\n }\n\n // a click whose target is the <dialog> itself landed on the backdrop (content sits in children)\n if (target instanceof HTMLDialogElement && target.open && target.classList.contains('ak-dialog') && !target.hasAttribute('data-ak-static')) {\n const r = target.getBoundingClientRect();\n const { clientX: x, clientY: y } = event as MouseEvent;\n if (x < r.left || x > r.right || y < r.top || y > r.bottom) closeDialog(target, 'cancel');\n }\n });\n\n // 'close' doesn't bubble: capture it to release the scroll lock\n document.addEventListener('close', syncScrollLock, true);\n}\n","const BOUND = 'akBound';\n\n/**\n * `<div class=\"ak-alert\"><button data-ak-dismiss>…</button></div>` —\n * removes the closest `[data-ak-dismissible]` (or `.ak-alert`) when the trigger is clicked.\n */\nexport function dismissible(root: ParentNode = document): void {\n root.querySelectorAll<HTMLElement>('[data-ak-dismiss]').forEach((trigger) => {\n if (trigger.dataset[BOUND]) return;\n trigger.dataset[BOUND] = '1';\n trigger.addEventListener('click', () => {\n trigger.closest('[data-ak-dismissible], .ak-alert')?.remove();\n });\n });\n}\n","// .ak-file — a native <input type=\"file\"> as a drop zone:\n// <label class=\"ak-file\">\n// <input type=\"file\" accept=\".pdf,.docx\" multiple aria-describedby=\"doc-hint\">\n// <span class=\"ak-file__prompt\">Перетащите файлы или <u>выберите</u></span>\n// <span class=\"ak-file__list\" aria-live=\"polite\"></span>\n// </label>\n// <p class=\"ak-hint\" id=\"doc-hint\">PDF или DOCX, до 10 МБ</p>\n// The input stays the real control (keyboard, forms, validation). The kit adds the drag-over state and\n// lists the chosen files with their sizes; data-max-size (bytes) marks files over the limit.\n\nlet bound = false;\n\nconst formatSize = (bytes: number): string =>\n bytes < 1024 ? `${bytes} Б` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} КБ` : `${(bytes / 1048576).toFixed(1).replace('.', ',')} МБ`;\n\nfunction render(zone: HTMLElement, input: HTMLInputElement): void {\n const list = zone.querySelector<HTMLElement>('.ak-file__list');\n if (!list) return;\n const max = Number(input.dataset.maxSize) || Infinity;\n list.replaceChildren(\n ...[...(input.files ?? [])].map((file) => {\n const item = document.createElement('span');\n item.className = 'ak-file__item';\n const tooBig = file.size > max;\n item.toggleAttribute('data-invalid', tooBig);\n item.textContent = `${file.name} · ${formatSize(file.size)}${tooBig ? ' — больше допустимого' : ''}`;\n return item;\n })\n );\n const invalid = [...(input.files ?? [])].some((f) => f.size > max);\n input.setCustomValidity(invalid ? 'Файл больше допустимого размера' : '');\n zone.toggleAttribute('data-has-files', Boolean(input.files?.length));\n}\n\nexport function files(): void {\n if (bound) return;\n bound = true;\n\n document.addEventListener('change', (e) => {\n const input = e.target;\n if (!(input instanceof HTMLInputElement) || input.type !== 'file') return;\n const zone = input.closest<HTMLElement>('.ak-file');\n if (zone) render(zone, input);\n });\n\n const zoneOf = (e: Event) => (e.target as Element | null)?.closest?.<HTMLElement>('.ak-file') ?? null;\n document.addEventListener('dragover', (e) => {\n const zone = zoneOf(e);\n if (!zone) return;\n e.preventDefault();\n zone.setAttribute('data-dragover', '');\n });\n document.addEventListener('dragleave', (e) => {\n const zone = zoneOf(e);\n if (zone && !zone.contains((e as DragEvent).relatedTarget as Node | null)) zone.removeAttribute('data-dragover');\n });\n document.addEventListener('drop', (e) => {\n const zone = zoneOf(e);\n if (!zone) return;\n e.preventDefault();\n zone.removeAttribute('data-dragover');\n const input = zone.querySelector<HTMLInputElement>('input[type=\"file\"]');\n const dropped = (e as DragEvent).dataTransfer?.files;\n if (!input || !dropped?.length || input.disabled) return;\n const dt = new DataTransfer();\n [...dropped].slice(0, input.multiple ? undefined : 1).forEach((f) => dt.items.add(f));\n input.files = dt.files;\n input.dispatchEvent(new Event('change', { bubbles: true }));\n });\n}\n","// Menus on the Popover API: <button popovertarget=\"m\"> + <div class=\"ak-menu\" id=\"m\" popover role=\"menu\">.\n// The platform handles open/close, light dismiss, Escape and focus return. The kit adds:\n// - the trigger's aria-expanded;\n// - focus on the first item when the menu opens, arrow keys / Home / End between items;\n// - placement under the trigger where CSS anchor positioning is not supported.\n\nlet bound = false;\n\nconst ITEMS = '.ak-menu__item:not(:disabled):not([aria-disabled=\"true\"])';\nconst supportsAnchor = typeof CSS !== 'undefined' && CSS.supports?.('position-area', 'block-end');\n\nfunction triggerOf(menu: HTMLElement): HTMLElement | null {\n return menu.id ? document.querySelector<HTMLElement>(`[popovertarget=\"${CSS.escape(menu.id)}\"]`) : null;\n}\n\nfunction place(menu: HTMLElement, trigger: HTMLElement): void {\n const r = trigger.getBoundingClientRect();\n const m = menu.getBoundingClientRect();\n const alignEnd = menu.classList.contains('ak-menu--end');\n let left = alignEnd ? r.right - m.width : r.left;\n left = Math.max(8, Math.min(left, window.innerWidth - m.width - 8));\n let top = r.bottom + 4;\n if (top + m.height > window.innerHeight - 8 && r.top - m.height - 4 > 8) top = r.top - m.height - 4;\n menu.style.position = 'fixed';\n menu.style.left = `${Math.round(left)}px`;\n menu.style.top = `${Math.round(top)}px`;\n menu.style.margin = '0';\n}\n\nexport function menus(): void {\n if (bound) return;\n bound = true;\n\n // 'toggle' doesn't bubble: capture it\n document.addEventListener(\n 'toggle',\n (event) => {\n const menu = event.target;\n if (!(menu instanceof HTMLElement) || !menu.classList.contains('ak-menu')) return;\n const open = (event as ToggleEvent).newState === 'open';\n const trigger = triggerOf(menu);\n trigger?.setAttribute('aria-expanded', String(open));\n if (!open) return;\n if (trigger && !supportsAnchor) place(menu, trigger);\n menu.querySelector<HTMLElement>(ITEMS)?.focus();\n },\n true\n );\n\n document.addEventListener('keydown', (event) => {\n const menu = (event.target as Element | null)?.closest?.<HTMLElement>('.ak-menu:popover-open');\n if (!menu) return;\n const items = [...menu.querySelectorAll<HTMLElement>(ITEMS)];\n if (!items.length) return;\n const i = items.indexOf(document.activeElement as HTMLElement);\n let next = -1;\n if (event.key === 'ArrowDown') next = (i + 1) % items.length;\n else if (event.key === 'ArrowUp') next = (i - 1 + items.length) % items.length;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = items.length - 1;\n else if (event.key === 'Tab') menu.hidePopover();\n if (next >= 0) {\n event.preventDefault();\n items[next].focus();\n }\n });\n\n // choosing an item closes the menu (links navigate anyway; buttons run their action)\n document.addEventListener('click', (event) => {\n const item = (event.target as Element | null)?.closest?.<HTMLElement>(ITEMS);\n item?.closest<HTMLElement>('.ak-menu:popover-open')?.hidePopover();\n });\n}\n","// Narrow screens: [data-ak-sidebar-toggle] opens/closes the sidebar drawer (.ak-app[data-sidebar-open]).\n// Escape or a click outside closes it; the toggle carries aria-expanded.\n\nlet bound = false;\n\nfunction setOpen(app: HTMLElement, open: boolean): void {\n app.toggleAttribute('data-sidebar-open', open);\n app.querySelectorAll('[data-ak-sidebar-toggle]').forEach((t) => t.setAttribute('aria-expanded', String(open)));\n}\n\nexport function sidebar(): void {\n if (bound) return;\n bound = true;\n\n document.addEventListener('click', (event) => {\n const target = event.target instanceof Element ? event.target : null;\n const toggle = target?.closest('[data-ak-sidebar-toggle]');\n const app = target?.closest<HTMLElement>('.ak-app');\n if (!app) return;\n if (toggle) {\n setOpen(app, !app.hasAttribute('data-sidebar-open'));\n return;\n }\n if (app.hasAttribute('data-sidebar-open') && !target?.closest('.ak-sidebar')) setOpen(app, false);\n });\n\n document.addEventListener('keydown', (event) => {\n if (event.key !== 'Escape') return;\n const app = document.querySelector<HTMLElement>('.ak-app[data-sidebar-open]');\n if (!app) return;\n setOpen(app, false);\n app.querySelector<HTMLElement>('[data-ak-sidebar-toggle]')?.focus();\n });\n}\n","// .ak-stepper > [data-ak-step=\"-1\"] + input[type=number] + [data-ak-step=\"1\"]\n// Steps by the input's step, clamps to min/max, fires `input` + `change`. Buttons at a bound get disabled.\n\nlet bound = false;\n\nconst num = (value: string, fallback: number): number => {\n const n = Number(value);\n return value !== '' && Number.isFinite(n) ? n : fallback;\n};\n\nfunction sync(stepper: Element): void {\n const input = stepper.querySelector<HTMLInputElement>('input');\n if (!input) return;\n const value = num(input.value, 0);\n stepper.querySelectorAll<HTMLButtonElement>('[data-ak-step]').forEach((btn) => {\n const dir = Number(btn.dataset.akStep);\n btn.disabled = input.disabled || (dir < 0 ? value <= num(input.min, -Infinity) : value >= num(input.max, Infinity));\n });\n}\n\nexport function stepBy(input: HTMLInputElement, direction: number): void {\n const step = num(input.step, 1) || 1;\n const next = Math.min(num(input.max, Infinity), Math.max(num(input.min, -Infinity), num(input.value, 0) + direction * step));\n // keep the step's precision (0.1 + 0.2 …)\n const decimals = (String(step).split('.')[1] ?? '').length;\n input.value = next.toFixed(decimals);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n}\n\nexport function steppers(root: ParentNode = document): void {\n root.querySelectorAll('.ak-stepper').forEach(sync);\n if (bound) return;\n bound = true;\n\n document.addEventListener('click', (event) => {\n const btn = (event.target as Element | null)?.closest?.<HTMLButtonElement>('.ak-stepper [data-ak-step]');\n const stepper = btn?.closest('.ak-stepper');\n const input = stepper?.querySelector<HTMLInputElement>('input');\n if (!btn || !stepper || !input) return;\n event.preventDefault();\n stepBy(input, Number(btn.dataset.akStep) || 1);\n });\n\n document.addEventListener('input', (event) => {\n const stepper = (event.target as Element | null)?.closest?.('.ak-stepper');\n if (stepper) sync(stepper);\n });\n}\n","// WAI-ARIA tabs: [role=tablist] > [role=tab][aria-controls] + [role=tabpanel]. Click, ←/→, Home/End.\n// Automatic activation (focus selects), roving tabindex. Emits `ak:tab-change` on the tablist.\n\nlet bound = false;\n\nfunction tabsOf(list: Element): HTMLElement[] {\n return [...list.querySelectorAll<HTMLElement>(':scope > [role=\"tab\"]')];\n}\n\nexport function selectTab(tab: HTMLElement, focus = false): void {\n const list = tab.closest('[role=\"tablist\"]');\n if (!list || tab.getAttribute('aria-disabled') === 'true') return;\n for (const t of tabsOf(list)) {\n const selected = t === tab;\n t.setAttribute('aria-selected', String(selected));\n t.tabIndex = selected ? 0 : -1;\n const panel = document.getElementById(t.getAttribute('aria-controls') ?? '');\n if (panel) {\n panel.hidden = !selected;\n if (!panel.hasAttribute('tabindex')) panel.tabIndex = 0;\n }\n }\n if (focus) tab.focus();\n list.dispatchEvent(new CustomEvent('ak:tab-change', { bubbles: true, detail: { tab } }));\n}\n\n/** Sets roving tabindex on tab lists inside root; binds the delegated handlers once. */\nexport function tabs(root: ParentNode = document): void {\n root.querySelectorAll('[role=\"tablist\"]').forEach((list) => {\n const all = tabsOf(list);\n const current = all.find((t) => t.getAttribute('aria-selected') === 'true') ?? all[0];\n all.forEach((t) => (t.tabIndex = t === current ? 0 : -1));\n });\n if (bound) return;\n bound = true;\n\n document.addEventListener('click', (event) => {\n const tab = (event.target as Element | null)?.closest?.<HTMLElement>('[role=\"tablist\"] > [role=\"tab\"]');\n if (tab) selectTab(tab);\n });\n\n document.addEventListener('keydown', (event) => {\n const tab = (event.target as Element | null)?.closest?.<HTMLElement>('[role=\"tablist\"] > [role=\"tab\"]');\n if (!tab) return;\n const all = tabsOf(tab.parentElement!).filter((t) => t.getAttribute('aria-disabled') !== 'true');\n const i = all.indexOf(tab);\n let next: HTMLElement | undefined;\n if (event.key === 'ArrowRight') next = all[(i + 1) % all.length];\n else if (event.key === 'ArrowLeft') next = all[(i - 1 + all.length) % all.length];\n else if (event.key === 'Home') next = all[0];\n else if (event.key === 'End') next = all[all.length - 1];\n if (next) {\n event.preventDefault();\n selectTab(next, true);\n }\n });\n}\n","// Toasts — short confirmations of something the user just did (\"Страница сохранена\").\n// Errors that need action stay inline (ak-alert) next to what failed; a toast is for the outcome.\n//\n// toast('Страница сохранена')\n// toast('Не удалось отправить', { tone: 'negative', action: { label: 'Повторить', onClick } })\n//\n// Server flash messages: render <template data-ak-toast=\"positive\">Вход выполнен</template> (or any\n// element with data-ak-toast) and init() turns each into a toast once.\n//\n// Behaviour (Sonner principles): one region at the bottom right, newest at the bottom; enter and exit\n// from the same side; timers pause while hovered/focused and while the tab is hidden; negative toasts\n// stay until closed; CSS transitions (interruptible), no keyframes.\n\nexport type ToastTone = 'neutral' | 'positive' | 'negative' | 'warning' | 'info';\n\nexport interface ToastOptions {\n tone?: ToastTone;\n /** ms; 0 = until closed. Default 5000, negative 0. */\n duration?: number;\n action?: { label: string; onClick: () => void };\n}\n\nexport interface ToastHandle {\n close(): void;\n}\n\nconst MAX = 4;\nlet region: HTMLElement | null = null;\n\nfunction getRegion(): HTMLElement {\n if (region?.isConnected) return region;\n region = document.createElement('section');\n region.className = 'ak-toaster';\n region.setAttribute('aria-label', 'Уведомления');\n document.body.append(region);\n return region;\n}\n\nexport function toast(message: string, { tone = 'neutral', duration, action }: ToastOptions = {}): ToastHandle {\n const host = getRegion();\n const el = document.createElement('div');\n el.className = `ak-toast ak-toast--${tone}`;\n // errors interrupt; everything else waits for a pause in speech\n el.setAttribute('role', tone === 'negative' ? 'alert' : 'status');\n el.setAttribute('aria-live', tone === 'negative' ? 'assertive' : 'polite');\n\n const text = document.createElement('p');\n text.className = 'ak-toast__text';\n text.textContent = message;\n el.append(text);\n\n if (action) {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.className = 'ak-toast__action';\n btn.textContent = action.label;\n btn.addEventListener('click', () => {\n action.onClick();\n close();\n });\n el.append(btn);\n }\n\n const x = document.createElement('button');\n x.type = 'button';\n x.className = 'ak-toast__close';\n x.setAttribute('aria-label', 'Закрыть');\n x.textContent = '×';\n x.addEventListener('click', () => close());\n el.append(x);\n\n host.append(el);\n // trim the oldest beyond the limit\n const all = host.querySelectorAll('.ak-toast:not([data-leaving])');\n if (all.length > MAX) (all[0] as HTMLElement & { _close?: () => void })._close?.();\n\n // enter on the next frame so the transition runs from the starting state\n requestAnimationFrame(() => requestAnimationFrame(() => el.setAttribute('data-shown', '')));\n\n const total = duration ?? (tone === 'negative' ? 0 : 5000);\n let remaining = total;\n let started = 0;\n let timer = 0;\n const pause = () => {\n if (!timer) return;\n clearTimeout(timer);\n timer = 0;\n remaining -= Date.now() - started;\n };\n const resume = () => {\n if (!total || timer || remaining <= 0 || document.hidden) return;\n started = Date.now();\n timer = window.setTimeout(close, remaining);\n };\n const onVisibility = () => (document.hidden ? pause() : resume());\n\n el.addEventListener('mouseenter', pause);\n el.addEventListener('mouseleave', resume);\n el.addEventListener('focusin', pause);\n el.addEventListener('focusout', resume);\n document.addEventListener('visibilitychange', onVisibility);\n resume();\n\n function close(): void {\n if (el.hasAttribute('data-leaving')) return;\n pause();\n document.removeEventListener('visibilitychange', onVisibility);\n el.setAttribute('data-leaving', '');\n el.removeAttribute('data-shown');\n const done = () => el.remove();\n el.addEventListener('transitionend', done, { once: true });\n window.setTimeout(done, 400); // reduced motion / no transition\n }\n (el as HTMLElement & { _close?: () => void })._close = close;\n return { close };\n}\n\n/** Turns server-rendered [data-ak-toast] elements (flash messages) into toasts, once each. */\nexport function toastsFromDom(root: ParentNode = document): void {\n root.querySelectorAll<HTMLElement>('[data-ak-toast]:not([data-ak-bound])').forEach((el) => {\n el.setAttribute('data-ak-bound', '');\n const text = (el instanceof HTMLTemplateElement ? el.content.textContent : el.textContent)?.trim();\n if (!text) return;\n const tone = (el.dataset.akToast || 'neutral') as ToastTone;\n const duration = el.dataset.akDuration ? Number(el.dataset.akDuration) : undefined;\n toast(text, { tone, duration });\n if (!(el instanceof HTMLTemplateElement)) el.hidden = true;\n });\n}\n","// Tooltips for controls whose meaning isn't written on them (icon-only buttons):\n// <button class=\"ak-btn ak-btn--icon\" aria-label=\"Копировать\" data-ak-tooltip>…</button>\n// data-ak-tooltip=\"Текст\" — or empty to reuse aria-label / title.\n// One shared bubble, above the control (flips below near the top edge). Shown on hover after 500 ms\n// and instantly on focus; once one is open, neighbours open instantly with no animation (skip delay).\n// Hidden on leave, blur, Escape, scroll. The control gets aria-describedby while it is shown.\n// A tooltip never holds the only copy of important information and never anything interactive.\n\nconst SHOW_DELAY = 500;\nconst SKIP_WINDOW = 400;\n\nlet bound = false;\nlet bubble: HTMLElement | null = null;\nlet current: HTMLElement | null = null;\nlet showTimer = 0;\nlet lastHidden = 0;\n\nfunction getBubble(): HTMLElement {\n if (bubble?.isConnected) return bubble;\n bubble = document.createElement('div');\n bubble.className = 'ak-tooltip';\n bubble.id = 'ak-tooltip';\n bubble.setAttribute('role', 'tooltip');\n document.body.append(bubble);\n return bubble;\n}\n\nfunction textFor(el: HTMLElement): string {\n return (el.dataset.akTooltip || el.getAttribute('aria-label') || el.getAttribute('title') || '').trim();\n}\n\nfunction position(target: HTMLElement, tip: HTMLElement): void {\n const r = target.getBoundingClientRect();\n const t = tip.getBoundingClientRect();\n let top = r.top - t.height - 6;\n let side = 'top';\n if (top < 8) {\n top = r.bottom + 6;\n side = 'bottom';\n }\n const left = Math.max(8, Math.min(r.left + r.width / 2 - t.width / 2, window.innerWidth - t.width - 8));\n tip.style.top = `${Math.round(top)}px`;\n tip.style.left = `${Math.round(left)}px`;\n tip.dataset.side = side;\n}\n\nfunction show(target: HTMLElement, instant: boolean): void {\n const text = textFor(target);\n if (!text) return;\n const tip = getBubble();\n current = target;\n tip.textContent = text;\n tip.toggleAttribute('data-instant', instant);\n tip.setAttribute('data-open', '');\n position(target, tip);\n const described = target.getAttribute('aria-describedby') ?? '';\n if (!described.split(' ').includes(tip.id)) target.setAttribute('aria-describedby', `${described} ${tip.id}`.trim());\n}\n\nfunction hide(): void {\n clearTimeout(showTimer);\n showTimer = 0;\n if (!current) return;\n const described = (current.getAttribute('aria-describedby') ?? '').split(' ').filter((id) => id && id !== 'ak-tooltip');\n if (described.length) current.setAttribute('aria-describedby', described.join(' '));\n else current.removeAttribute('aria-describedby');\n current = null;\n bubble?.removeAttribute('data-open');\n lastHidden = Date.now();\n}\n\nfunction schedule(target: HTMLElement, viaFocus: boolean): void {\n if (current === target) return;\n clearTimeout(showTimer);\n const warm = Boolean(current) || Date.now() - lastHidden < SKIP_WINDOW;\n if (current) hide();\n if (viaFocus || warm) show(target, warm);\n else showTimer = window.setTimeout(() => show(target, false), SHOW_DELAY);\n}\n\nexport function tooltips(): void {\n if (bound) return;\n bound = true;\n\n const find = (e: Event) => (e.target as Element | null)?.closest?.<HTMLElement>('[data-ak-tooltip]') ?? null;\n\n document.addEventListener('pointerover', (e) => {\n if ((e as PointerEvent).pointerType === 'touch') return;\n const el = find(e);\n if (el) schedule(el, false);\n });\n document.addEventListener('pointerout', (e) => {\n const el = find(e);\n if (el && !el.contains((e as PointerEvent).relatedTarget as Node | null)) hide();\n });\n document.addEventListener('focusin', (e) => {\n const el = find(e);\n if (el && el.matches(':focus-visible')) schedule(el, true);\n });\n document.addEventListener('focusout', (e) => {\n if (find(e)) hide();\n });\n document.addEventListener('keydown', (e) => {\n if (e.key === 'Escape' && current) hide();\n });\n window.addEventListener('scroll', hide, { passive: true, capture: true });\n // hide when a click starts an action\n document.addEventListener('pointerdown', hide);\n}\n","import { dialogs } from './dialog';\nimport { dismissible } from './dismissible';\nimport { files } from './file';\nimport { menus } from './menu';\nimport { sidebar } from './sidebar';\nimport { steppers } from './stepper';\nimport { tabs } from './tabs';\nimport { toastsFromDom } from './toast';\nimport { tooltips } from './tooltip';\n\nexport interface InitOptions {\n /** Root to scan for `data-ak-*` behaviours. Defaults to `document`. */\n root?: ParentNode;\n}\n\n/**\n * Wires every kit behaviour: dialogs, menus, tabs, steppers, tooltips, file drop zones, the sidebar\n * drawer, dismissible alerts, and shows server-rendered [data-ak-toast] messages.\n * Handlers are delegated and bound once; calling again (e.g. after injecting HTML) only prepares the\n * new markup inside `root` (roving tabindex, stepper bounds, close buttons).\n */\nexport function init({ root = document }: InitOptions = {}): void {\n dialogs();\n menus();\n sidebar();\n tooltips();\n files();\n tabs(root);\n steppers(root);\n dismissible(root);\n toastsFromDom(root);\n}\n","const SVG_NS = 'http://www.w3.org/2000/svg';\n\nlet spriteUrl = '';\n\n/**\n * Where the icon sprite is served from (the host copies `@apo100l/ace-ui-kit/icons.svg`\n * to its public folder, or imports it with `?url` in Vite). Call once at startup.\n */\nexport function setIconSprite(url: string): void {\n spriteUrl = url;\n}\n\nexport interface IconOptions {\n size?: 'sm' | 'lg';\n /** Accessible name. Without it the icon is decorative (aria-hidden). */\n label?: string;\n className?: string;\n}\n\n/** Creates `<svg class=\"ak-icon\"><use href=\"sprite#name\"/></svg>`. Names: src/icons/icons.json. */\nexport function icon(name: string, { size, label, className }: IconOptions = {}): SVGSVGElement {\n const svg = document.createElementNS(SVG_NS, 'svg');\n svg.setAttribute('class', ['ak-icon', size && `ak-icon--${size}`, className].filter(Boolean).join(' '));\n if (label) {\n svg.setAttribute('role', 'img');\n svg.setAttribute('aria-label', label);\n } else {\n svg.setAttribute('aria-hidden', 'true');\n }\n svg.setAttribute('focusable', 'false');\n const use = document.createElementNS(SVG_NS, 'use');\n use.setAttribute('href', `${spriteUrl}#${name}`);\n svg.append(use);\n return svg;\n}\n"],"names":["bound","openDialog","dialog","closeDialog","returnValue","syncScrollLock","anyOpen","dialogs","event","target","opener","closer","r","x","y","BOUND","dismissible","root","trigger","formatSize","bytes","render","zone","input","list","max","file","item","tooBig","invalid","f","files","e","zoneOf","dropped","dt","ITEMS","supportsAnchor","triggerOf","menu","place","m","left","top","menus","open","items","i","next","setOpen","app","t","sidebar","toggle","num","value","fallback","sync","stepper","btn","dir","stepBy","direction","step","decimals","steppers","tabsOf","selectTab","tab","focus","selected","panel","tabs","all","current","MAX","region","getRegion","toast","message","tone","duration","action","host","el","text","close","total","remaining","started","timer","pause","resume","onVisibility","done","toastsFromDom","SHOW_DELAY","SKIP_WINDOW","bubble","showTimer","lastHidden","getBubble","textFor","position","tip","side","show","instant","described","hide","id","schedule","viaFocus","warm","tooltips","find","init","SVG_NS","spriteUrl","setIconSprite","url","icon","name","size","label","className","svg","use"],"mappings":"AAMA,IAAIA,IAAQ;AAEL,SAASC,EAAWC,GAAiC;AAC1D,EAAIA,EAAO,SACXA,EAAO,UAAA,GACP,SAAS,gBAAgB,UAAU,IAAI,gBAAgB;AACzD;AAEO,SAASC,EAAYD,GAA2BE,GAA4B;AACjF,EAAIF,EAAO,QAAMA,EAAO,MAAME,CAAW;AAC3C;AAEA,SAASC,IAAuB;AAC9B,QAAMC,IAAU,SAAS,cAAc,wBAAwB;AAC/D,WAAS,gBAAgB,UAAU,OAAO,kBAAkB,EAAQA,CAAQ;AAC9E;AAEO,SAASC,IAAgB;AAC9B,EAAIP,MACJA,IAAQ,IAER,SAAS,iBAAiB,SAAS,CAACQ,MAAU;AAC5C,UAAMC,IAASD,EAAM,kBAAkB,UAAUA,EAAM,SAAS;AAChE,QAAI,CAACC,EAAQ;AAEb,UAAMC,IAASD,EAAO,QAAqB,uBAAuB;AAClE,QAAIC,GAAQ;AACV,YAAMR,IAAS,SAAS,eAAeQ,EAAO,QAAQ,gBAAgB,EAAE;AACxE,MAAIR,aAAkB,sBACpBM,EAAM,eAAA,GACNP,EAAWC,CAAM;AAEnB;AAAA,IAC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IAAII,CAAI,EAAE,GAC/CI,EAAI,OAAOC,CAAG,GACPD;AACT;"}
|
package/dist/compat.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './scss/compat/index.scss';
|
|
2
|
+
export { bindAce } from './js/compat/ace';
|
|
3
|
+
export { bindBootstrap, hasBootstrapJs, hideModal, showModal, showTab, toggleDropdown, upgradeTriggers } from './js/compat/bootstrap';
|
|
4
|
+
export interface CompatOptions {
|
|
5
|
+
/** Replace bootstrap.js: dropdown / modal / tab / alert dismiss + jQuery shims. Default true. */
|
|
6
|
+
bootstrap?: boolean;
|
|
7
|
+
/** Ace layout behaviours: sidebar collapse, nav-list submenus, spinners. Default false. */
|
|
8
|
+
ace?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Call after DOM ready. Handlers are delegated and bound once; calling again (e.g. after injecting
|
|
12
|
+
* HTML) only upgrades the new markup: keyboard access for <a> triggers, spinners.
|
|
13
|
+
*/
|
|
14
|
+
export declare function initCompat({ bootstrap, ace }?: CompatOptions, root?: ParentNode): void;
|
package/dist/icons.svg
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Generated by scripts/icons/build-sprite.mjs from lucide-static v1.84.0 (ISC). Do not edit. -->
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
3
|
+
<symbol id="arrow-up-down" viewBox="0 0 24 24"><path d="m21 16-4 4-4-4" /><path d="M17 20V4" /><path d="m3 8 4-4 4 4" /><path d="M7 4v16" /></symbol>
|
|
4
|
+
<symbol id="building" viewBox="0 0 24 24"><path d="M12 10h.01" /><path d="M12 14h.01" /><path d="M12 6h.01" /><path d="M16 10h.01" /><path d="M16 14h.01" /><path d="M16 6h.01" /><path d="M8 10h.01" /><path d="M8 14h.01" /><path d="M8 6h.01" /><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3" /><rect x="4" y="2" width="16" height="20" rx="2" /></symbol>
|
|
5
|
+
<symbol id="calendar" viewBox="0 0 24 24"><path d="M8 2v3" /><path d="M16 2v3" /><rect x="3" y="3" width="18" height="18" rx="2" /><path d="M3 9h18" /></symbol>
|
|
6
|
+
<symbol id="calendar-x" viewBox="0 0 24 24"><path d="M8 2v3" /><path d="M16 2v3" /><rect x="3" y="3" width="18" height="18" rx="2" /><path d="M3 9h18" /><path d="m14 13-4 4" /><path d="m10 13 4 4" /></symbol>
|
|
7
|
+
<symbol id="check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></symbol>
|
|
8
|
+
<symbol id="chevron-down" viewBox="0 0 24 24"><path d="m6 9 6 6 6-6" /></symbol>
|
|
9
|
+
<symbol id="chevron-up" viewBox="0 0 24 24"><path d="m18 15-6-6-6 6" /></symbol>
|
|
10
|
+
<symbol id="chevrons-left" viewBox="0 0 24 24"><path d="m11 17-5-5 5-5" /><path d="m18 17-5-5 5-5" /></symbol>
|
|
11
|
+
<symbol id="chevrons-right" viewBox="0 0 24 24"><path d="m6 17 5-5-5-5" /><path d="m13 17 5-5-5-5" /></symbol>
|
|
12
|
+
<symbol id="circle-alert" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><line x1="12" x2="12" y1="8" y2="12" /><line x1="12" x2="12.01" y1="16" y2="16" /></symbol>
|
|
13
|
+
<symbol id="circle-check" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="m16 9-5.5 5.5L8 12" /></symbol>
|
|
14
|
+
<symbol id="circle-x" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="m15 9-6 6" /><path d="m9 9 6 6" /></symbol>
|
|
15
|
+
<symbol id="clipboard-list" viewBox="0 0 24 24"><rect width="8" height="4" x="8" y="2" rx="1" ry="1" /><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" /><path d="M12 11h4" /><path d="M12 16h4" /><path d="M8 11h.01" /><path d="M8 16h.01" /></symbol>
|
|
16
|
+
<symbol id="copy" viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" /></symbol>
|
|
17
|
+
<symbol id="download" viewBox="0 0 24 24"><path d="M12 15V3" /><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><path d="m7 10 5 5 5-5" /></symbol>
|
|
18
|
+
<symbol id="ellipsis" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" /></symbol>
|
|
19
|
+
<symbol id="ellipsis-vertical" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1" /><circle cx="12" cy="5" r="1" /><circle cx="12" cy="19" r="1" /></symbol>
|
|
20
|
+
<symbol id="eraser" viewBox="0 0 24 24"><path d="M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21" /><path d="m5.082 11.09 8.828 8.828" /></symbol>
|
|
21
|
+
<symbol id="external-link" viewBox="0 0 24 24"><path d="M15 3h6v6" /><path d="M10 14 21 3" /><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /></symbol>
|
|
22
|
+
<symbol id="eye" viewBox="0 0 24 24"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" /><circle cx="12" cy="12" r="3" /></symbol>
|
|
23
|
+
<symbol id="eye-off" viewBox="0 0 24 24"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" /><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" /><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" /><path d="m2 2 20 20" /></symbol>
|
|
24
|
+
<symbol id="file" viewBox="0 0 24 24"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /></symbol>
|
|
25
|
+
<symbol id="file-image" viewBox="0 0 24 24"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /><circle cx="10" cy="12" r="2" /><path d="m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22" /></symbol>
|
|
26
|
+
<symbol id="file-spreadsheet" viewBox="0 0 24 24"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /><path d="M8 13h2" /><path d="M14 13h2" /><path d="M8 17h2" /><path d="M14 17h2" /></symbol>
|
|
27
|
+
<symbol id="file-text" viewBox="0 0 24 24"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /><path d="M10 9H8" /><path d="M16 13H8" /><path d="M16 17H8" /></symbol>
|
|
28
|
+
<symbol id="filter" viewBox="0 0 24 24"><path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" /></symbol>
|
|
29
|
+
<symbol id="grip-vertical" viewBox="0 0 24 24"><circle cx="9" cy="12" r="1" /><circle cx="9" cy="5" r="1" /><circle cx="9" cy="19" r="1" /><circle cx="15" cy="12" r="1" /><circle cx="15" cy="5" r="1" /><circle cx="15" cy="19" r="1" /></symbol>
|
|
30
|
+
<symbol id="house" viewBox="0 0 24 24"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" /><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /></symbol>
|
|
31
|
+
<symbol id="image" viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" /><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" /></symbol>
|
|
32
|
+
<symbol id="info" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" /></symbol>
|
|
33
|
+
<symbol id="key" viewBox="0 0 24 24"><path d="m2 21 9.6-9.6" /><path d="m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19" /><circle cx="15.5" cy="7.5" r="5.5" /></symbol>
|
|
34
|
+
<symbol id="layout-dashboard" viewBox="0 0 24 24"><rect width="7" height="9" x="3" y="3" rx="1" /><rect width="7" height="5" x="14" y="3" rx="1" /><rect width="7" height="9" x="14" y="12" rx="1" /><rect width="7" height="5" x="3" y="16" rx="1" /></symbol>
|
|
35
|
+
<symbol id="list" viewBox="0 0 24 24"><path d="M3 5h.01" /><path d="M3 12h.01" /><path d="M3 19h.01" /><path d="M8 5h13" /><path d="M8 12h13" /><path d="M8 19h13" /></symbol>
|
|
36
|
+
<symbol id="lock" viewBox="0 0 24 24"><rect width="18" height="11" x="3" y="11" rx="2" ry="2" /><path d="M7 11V7a5 5 0 0 1 10 0v4" /></symbol>
|
|
37
|
+
<symbol id="log-out" viewBox="0 0 24 24"><path d="m16 17 5-5-5-5" /><path d="M21 12H9" /><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /></symbol>
|
|
38
|
+
<symbol id="map-pin" viewBox="0 0 24 24"><path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" /><circle cx="12" cy="10" r="3" /></symbol>
|
|
39
|
+
<symbol id="menu" viewBox="0 0 24 24"><path d="M4 5h16" /><path d="M4 12h16" /><path d="M4 19h16" /></symbol>
|
|
40
|
+
<symbol id="minus" viewBox="0 0 24 24"><path d="M5 12h14" /></symbol>
|
|
41
|
+
<symbol id="pencil" viewBox="0 0 24 24"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" /></symbol>
|
|
42
|
+
<symbol id="phone" viewBox="0 0 24 24"><path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" /></symbol>
|
|
43
|
+
<symbol id="plus" viewBox="0 0 24 24"><path d="M5 12h14" /><path d="M12 5v14" /></symbol>
|
|
44
|
+
<symbol id="refresh-cw" viewBox="0 0 24 24"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" /><path d="M21 3v5h-5" /><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" /><path d="M8 16H3v5" /></symbol>
|
|
45
|
+
<symbol id="russian-ruble" viewBox="0 0 24 24"><path d="M4 16h6" /><path d="M7 20V5a1 1 0 011-1h6a4 4 0 010 8H4" /></symbol>
|
|
46
|
+
<symbol id="save" viewBox="0 0 24 24"><path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" /><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7" /><path d="M7 3v4a1 1 0 0 0 1 1h7" /></symbol>
|
|
47
|
+
<symbol id="search" viewBox="0 0 24 24"><path d="m21 21-4.34-4.34" /><circle cx="11" cy="11" r="8" /></symbol>
|
|
48
|
+
<symbol id="send" viewBox="0 0 24 24"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z" /><path d="m21.854 2.147-10.94 10.939" /></symbol>
|
|
49
|
+
<symbol id="settings" viewBox="0 0 24 24"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /><circle cx="12" cy="12" r="3" /></symbol>
|
|
50
|
+
<symbol id="square-pen" viewBox="0 0 24 24"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" /><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" /></symbol>
|
|
51
|
+
<symbol id="table" viewBox="0 0 24 24"><path d="M12 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" /></symbol>
|
|
52
|
+
<symbol id="trash-2" viewBox="0 0 24 24"><path d="M10 11v6" /><path d="M14 11v6" /><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /><path d="M3 6h18" /><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></symbol>
|
|
53
|
+
<symbol id="triangle-alert" viewBox="0 0 24 24"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path d="M12 9v4" /><path d="M12 17h.01" /></symbol>
|
|
54
|
+
<symbol id="upload" viewBox="0 0 24 24"><path d="M12 3v12" /><path d="m17 8-5-5-5 5" /><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /></symbol>
|
|
55
|
+
<symbol id="user" viewBox="0 0 24 24"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /><circle cx="12" cy="7" r="4" /></symbol>
|
|
56
|
+
<symbol id="users" viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /><path d="M16 3.128a4 4 0 0 1 0 7.744" /><path d="M22 21v-2a4 4 0 0 0-3-3.87" /><circle cx="9" cy="7" r="4" /></symbol>
|
|
57
|
+
<symbol id="x" viewBox="0 0 24 24"><path d="M18 6 6 18" /><path d="m6 6 12 12" /></symbol>
|
|
58
|
+
</svg>
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,10 @@ import './scss/index.scss';
|
|
|
2
2
|
export { init } from './js/init';
|
|
3
3
|
export type { InitOptions } from './js/init';
|
|
4
4
|
export { dismissible } from './js/dismissible';
|
|
5
|
+
export { closeDialog, openDialog } from './js/dialog';
|
|
6
|
+
export { selectTab } from './js/tabs';
|
|
7
|
+
export { stepBy } from './js/stepper';
|
|
8
|
+
export { toast, toastsFromDom } from './js/toast';
|
|
9
|
+
export type { ToastHandle, ToastOptions, ToastTone } from './js/toast';
|
|
10
|
+
export { icon, setIconSprite } from './js/icon';
|
|
11
|
+
export type { IconOptions } from './js/icon';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** True when real bootstrap.js is on the page — then the compat layer must not bind its own handlers. */
|
|
2
|
+
export declare const hasBootstrapJs: () => boolean;
|
|
3
|
+
export declare function toggleDropdown(toggle: HTMLElement, force?: boolean): void;
|
|
4
|
+
export declare function showModal(modal: HTMLElement, relatedTarget?: HTMLElement | null): void;
|
|
5
|
+
export declare function hideModal(modal: HTMLElement): void;
|
|
6
|
+
export declare function showTab(toggle: HTMLElement): void;
|
|
7
|
+
export declare function upgradeTriggers(root?: ParentNode): void;
|
|
8
|
+
/** Binds the delegated handlers once per document. Returns false when bootstrap.js is present. */
|
|
9
|
+
export declare function bindBootstrap(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function files(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the icon sprite is served from (the host copies `@apo100l/ace-ui-kit/icons.svg`
|
|
3
|
+
* to its public folder, or imports it with `?url` in Vite). Call once at startup.
|
|
4
|
+
*/
|
|
5
|
+
export declare function setIconSprite(url: string): void;
|
|
6
|
+
export interface IconOptions {
|
|
7
|
+
size?: 'sm' | 'lg';
|
|
8
|
+
/** Accessible name. Without it the icon is decorative (aria-hidden). */
|
|
9
|
+
label?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Creates `<svg class="ak-icon"><use href="sprite#name"/></svg>`. Names: src/icons/icons.json. */
|
|
13
|
+
export declare function icon(name: string, { size, label, className }?: IconOptions): SVGSVGElement;
|
package/dist/js/init.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export interface InitOptions {
|
|
|
3
3
|
root?: ParentNode;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* Wires every
|
|
7
|
-
*
|
|
6
|
+
* Wires every kit behaviour: dialogs, menus, tabs, steppers, tooltips, file drop zones, the sidebar
|
|
7
|
+
* drawer, dismissible alerts, and shows server-rendered [data-ak-toast] messages.
|
|
8
|
+
* Handlers are delegated and bound once; calling again (e.g. after injecting HTML) only prepares the
|
|
9
|
+
* new markup inside `root` (roving tabindex, stepper bounds, close buttons).
|
|
8
10
|
*/
|
|
9
11
|
export declare function init({ root }?: InitOptions): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function menus(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sidebar(): void;
|