inclusive-elements 0.2.2 → 0.3.1
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 +3 -1
- package/dist/inclusive-elements.js +123 -53
- package/dist/types/accordion/accordion.d.ts +6 -0
- package/dist/types/alerts/alerts.d.ts +1 -1
- package/dist/types/disclosure/disclosure.d.ts +14 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/tooltip/tooltip.d.ts +1 -0
- package/package.json +21 -16
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Basic interactive UI patterns like popup menus, tooltips, and modals are surpris
|
|
|
8
8
|
|
|
9
9
|
`inclusive-elements` provides those basic behaviors in the form of Custom Elements, without any of the cruft. They are:
|
|
10
10
|
|
|
11
|
-
- **🦮 Accessible.** Designed following the [
|
|
11
|
+
- **🦮 Accessible.** Designed following the [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/) so everyone can use them.
|
|
12
12
|
- **🌳 Lightweight.** 3kB gzipped with minimal dependencies. Less if you tree-shake only the elements you need.
|
|
13
13
|
- **🎨 Unstyled.** Easily integrate with your design bottom-up without having to fight defaults.
|
|
14
14
|
- **🚀 Easy to use.** Simple API, works with any framework that supports Custom Elements.
|
|
@@ -23,7 +23,9 @@ npm install inclusive-elements --save
|
|
|
23
23
|
|
|
24
24
|
Detailed descriptions and usage instructions are contained within each element:
|
|
25
25
|
|
|
26
|
+
- [Accordion](src/accordion)
|
|
26
27
|
- [Alerts](src/alerts)
|
|
28
|
+
- [Disclosure](src/disclosure)
|
|
27
29
|
- [Menu](src/menu)
|
|
28
30
|
- [Modal](src/modal)
|
|
29
31
|
- [Popup](src/popup)
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (o, r, t) => (
|
|
4
|
-
import { move as k, hello as h, goodbye as
|
|
5
|
-
import { isFocusable as
|
|
6
|
-
import { createFocusTrap as
|
|
7
|
-
import { autoUpdate as
|
|
8
|
-
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var D = (o, r, t) => r in o ? T(o, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[r] = t;
|
|
3
|
+
var s = (o, r, t) => (D(o, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { move as k, hello as h, goodbye as d, cancel as v } from "hello-goodbye";
|
|
5
|
+
import { isFocusable as H, focusable as A } from "tabbable";
|
|
6
|
+
import { createFocusTrap as O } from "focus-trap";
|
|
7
|
+
import { autoUpdate as M, computePosition as g, shift as L, flip as x, size as K } from "@floating-ui/dom";
|
|
8
|
+
class I extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
s(this, "onOpen", (t) => {
|
|
12
|
+
this.querySelectorAll(
|
|
13
|
+
":scope > ui-disclosure"
|
|
14
|
+
).forEach((e) => {
|
|
15
|
+
e.open = e === t.target, this.required && e.toggleAttribute("disabled", e === t.target);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
this.addEventListener("open", this.onOpen, { capture: !0 });
|
|
21
|
+
}
|
|
22
|
+
disconnectedCallback() {
|
|
23
|
+
this.removeEventListener("open", this.onOpen, { capture: !0 });
|
|
24
|
+
}
|
|
25
|
+
get required() {
|
|
26
|
+
return this.hasAttribute("required");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const w = class extends HTMLElement {
|
|
9
30
|
constructor() {
|
|
10
31
|
super();
|
|
11
32
|
s(this, "timeouts", /* @__PURE__ */ new Map());
|
|
@@ -29,7 +50,7 @@ const v = class extends HTMLElement {
|
|
|
29
50
|
this.append(t), h(t);
|
|
30
51
|
});
|
|
31
52
|
const n = Number(
|
|
32
|
-
e.duration !== void 0 ? e.duration : t.dataset.duration ||
|
|
53
|
+
e.duration !== void 0 ? e.duration : t.dataset.duration || w.duration
|
|
33
54
|
);
|
|
34
55
|
return n > 0 && (this.startTimeout(t, n), t.addEventListener("mouseenter", this.clearTimeout.bind(this, t)), t.addEventListener("focusin", this.clearTimeout.bind(this, t)), t.addEventListener(
|
|
35
56
|
"mouseleave",
|
|
@@ -49,7 +70,7 @@ const v = class extends HTMLElement {
|
|
|
49
70
|
return;
|
|
50
71
|
}
|
|
51
72
|
k(this.children, () => {
|
|
52
|
-
|
|
73
|
+
d(t, {
|
|
53
74
|
finish: () => this.removeChild(t)
|
|
54
75
|
});
|
|
55
76
|
}), this.clearTimeout(t);
|
|
@@ -83,9 +104,55 @@ const v = class extends HTMLElement {
|
|
|
83
104
|
this.timeouts.has(t) && clearTimeout(this.timeouts.get(t));
|
|
84
105
|
}
|
|
85
106
|
};
|
|
86
|
-
let
|
|
87
|
-
s(
|
|
88
|
-
|
|
107
|
+
let b = w;
|
|
108
|
+
s(b, "duration", 1e4);
|
|
109
|
+
function C(o) {
|
|
110
|
+
return o.altKey || o.ctrlKey || o.metaKey || o.shiftKey || o.button !== void 0 && o.button !== 0;
|
|
111
|
+
}
|
|
112
|
+
class P extends HTMLElement {
|
|
113
|
+
constructor() {
|
|
114
|
+
super(...arguments);
|
|
115
|
+
s(this, "onButtonClick", (t) => {
|
|
116
|
+
!C(t) && !this.disabled && (this.open = !this.open, t.preventDefault());
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
static get observedAttributes() {
|
|
120
|
+
return ["open"];
|
|
121
|
+
}
|
|
122
|
+
connectedCallback() {
|
|
123
|
+
this.content.hidden = !this.open, this.button.setAttribute("aria-expanded", String(this.open)), this.button.addEventListener("click", this.onButtonClick);
|
|
124
|
+
}
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
v(this.content), this.button.removeAttribute("aria-expanded"), this.button.removeEventListener("click", this.onButtonClick);
|
|
127
|
+
}
|
|
128
|
+
get open() {
|
|
129
|
+
return this.hasAttribute("open");
|
|
130
|
+
}
|
|
131
|
+
set open(t) {
|
|
132
|
+
t ? this.setAttribute("open", "") : this.removeAttribute("open");
|
|
133
|
+
}
|
|
134
|
+
get disabled() {
|
|
135
|
+
return this.hasAttribute("disabled");
|
|
136
|
+
}
|
|
137
|
+
attributeChangedCallback(t, e, i) {
|
|
138
|
+
t === "open" && (i !== null ? this.wasOpened() : this.wasClosed());
|
|
139
|
+
}
|
|
140
|
+
wasOpened() {
|
|
141
|
+
this.content.hidden && (this.content.hidden = !1, h(this.content), this.button.setAttribute("aria-expanded", "true"), this.dispatchEvent(new Event("open")));
|
|
142
|
+
}
|
|
143
|
+
wasClosed() {
|
|
144
|
+
this.content.hidden || (this.button.setAttribute("aria-expanded", "false"), d(this.content, {
|
|
145
|
+
finish: () => this.content.hidden = !0
|
|
146
|
+
}), this.dispatchEvent(new Event("close")));
|
|
147
|
+
}
|
|
148
|
+
get button() {
|
|
149
|
+
return this.querySelector("button, [role=button]");
|
|
150
|
+
}
|
|
151
|
+
get content() {
|
|
152
|
+
return this.children[1];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const y = class extends HTMLElement {
|
|
89
156
|
constructor() {
|
|
90
157
|
super(...arguments);
|
|
91
158
|
s(this, "search", "");
|
|
@@ -102,7 +169,7 @@ const w = class extends HTMLElement {
|
|
|
102
169
|
}
|
|
103
170
|
t.key.length > 1 || t.ctrlKey || t.metaKey || t.altKey || (this.search += t.key.toLowerCase(), t.preventDefault(), clearTimeout(this.searchTimeout), this.searchTimeout = window.setTimeout(() => {
|
|
104
171
|
this.search = "";
|
|
105
|
-
},
|
|
172
|
+
}, y.searchDelay), this.items.some((e) => {
|
|
106
173
|
var i;
|
|
107
174
|
return ((i = e.textContent) == null ? void 0 : i.trim().toLowerCase().indexOf(this.search)) === 0 ? (e.focus(), !0) : !1;
|
|
108
175
|
}));
|
|
@@ -120,7 +187,7 @@ const w = class extends HTMLElement {
|
|
|
120
187
|
get items() {
|
|
121
188
|
return Array.from(
|
|
122
189
|
this.querySelectorAll("[role^=menuitem]")
|
|
123
|
-
).filter((t) =>
|
|
190
|
+
).filter((t) => H(t));
|
|
124
191
|
}
|
|
125
192
|
navigate(t) {
|
|
126
193
|
var n;
|
|
@@ -129,9 +196,9 @@ const w = class extends HTMLElement {
|
|
|
129
196
|
i < 0 && (i = e.length - 1), i >= e.length && (i = 0), (n = e[i]) == null || n.focus();
|
|
130
197
|
}
|
|
131
198
|
};
|
|
132
|
-
let
|
|
133
|
-
s(
|
|
134
|
-
const
|
|
199
|
+
let f = y;
|
|
200
|
+
s(f, "searchDelay", 800);
|
|
201
|
+
const u = class extends HTMLElement {
|
|
135
202
|
constructor() {
|
|
136
203
|
super();
|
|
137
204
|
s(this, "focusTrap");
|
|
@@ -144,18 +211,19 @@ const c = class extends HTMLElement {
|
|
|
144
211
|
const e = this.attachShadow({ mode: "open" });
|
|
145
212
|
e.appendChild(t.content.cloneNode(!0)), this.backdrop.addEventListener("click", () => {
|
|
146
213
|
var i;
|
|
147
|
-
this.hasAttribute("static") ? (i =
|
|
148
|
-
}), this.focusTrap =
|
|
214
|
+
this.hasAttribute("static") ? (i = u.attention) == null || i.call(u, e.children[1]) : this.close();
|
|
215
|
+
}), this.focusTrap = O(this, {
|
|
149
216
|
escapeDeactivates: !1,
|
|
150
|
-
allowOutsideClick: !0
|
|
217
|
+
allowOutsideClick: !0,
|
|
218
|
+
preventScroll: !0
|
|
151
219
|
});
|
|
152
220
|
}
|
|
153
221
|
static get observedAttributes() {
|
|
154
222
|
return ["open"];
|
|
155
223
|
}
|
|
156
224
|
connectedCallback() {
|
|
157
|
-
var t, e, i, n, a,
|
|
158
|
-
this.connected = !0, (t = this.content) != null && t.hasAttribute("role") || (e = this.content) == null || e.setAttribute("role", "dialog"), (i = this.content) != null && i.hasAttribute("aria-modal") || (n = this.content) == null || n.setAttribute("aria-modal", "true"), (a = this.content) != null && a.hasAttribute("tabindex") || (
|
|
225
|
+
var t, e, i, n, a, E;
|
|
226
|
+
this.connected = !0, (t = this.content) != null && t.hasAttribute("role") || (e = this.content) == null || e.setAttribute("role", "dialog"), (i = this.content) != null && i.hasAttribute("aria-modal") || (n = this.content) == null || n.setAttribute("aria-modal", "true"), (a = this.content) != null && a.hasAttribute("tabindex") || (E = this.content) == null || E.setAttribute("tabindex", "-1"), this.addEventListener("keydown", (p) => {
|
|
159
227
|
p.key === "Escape" && this.open && (p.preventDefault(), p.stopPropagation(), this.close());
|
|
160
228
|
}), this.open && this.wasOpened();
|
|
161
229
|
}
|
|
@@ -183,7 +251,7 @@ const c = class extends HTMLElement {
|
|
|
183
251
|
}
|
|
184
252
|
wasClosed() {
|
|
185
253
|
var t;
|
|
186
|
-
(t = this.focusTrap) == null || t.deactivate(),
|
|
254
|
+
(t = this.focusTrap) == null || t.deactivate(), d(this, {
|
|
187
255
|
finish: () => this.hidden = !0
|
|
188
256
|
}), this.dispatchEvent(new Event("close"));
|
|
189
257
|
}
|
|
@@ -195,7 +263,7 @@ const c = class extends HTMLElement {
|
|
|
195
263
|
return this.firstElementChild;
|
|
196
264
|
}
|
|
197
265
|
};
|
|
198
|
-
let m =
|
|
266
|
+
let m = u;
|
|
199
267
|
s(m, "attention", (t) => t.animate(
|
|
200
268
|
[
|
|
201
269
|
{ transform: "scale(1)" },
|
|
@@ -204,15 +272,12 @@ s(m, "attention", (t) => t.animate(
|
|
|
204
272
|
],
|
|
205
273
|
300
|
|
206
274
|
));
|
|
207
|
-
function O(o) {
|
|
208
|
-
return o.altKey || o.ctrlKey || o.metaKey || o.shiftKey || o.button !== void 0 && o.button !== 0;
|
|
209
|
-
}
|
|
210
275
|
class $ extends HTMLElement {
|
|
211
276
|
constructor() {
|
|
212
277
|
super();
|
|
213
278
|
s(this, "cleanup");
|
|
214
279
|
s(this, "onButtonClick", (t) => {
|
|
215
|
-
!
|
|
280
|
+
!C(t) && !this.disabled && (this.open = !this.open, t.preventDefault());
|
|
216
281
|
});
|
|
217
282
|
s(this, "onButtonKeyDown", (t) => {
|
|
218
283
|
var e;
|
|
@@ -242,7 +307,7 @@ class $ extends HTMLElement {
|
|
|
242
307
|
}), this.button.addEventListener("click", this.onButtonClick), this.button.addEventListener("keydown", this.onButtonKeyDown), this.addEventListener("keydown", this.onKeyDown), this.addEventListener("focusout", this.onFocusOut), this.content.addEventListener("click", this.onContentClick);
|
|
243
308
|
}
|
|
244
309
|
disconnectedCallback() {
|
|
245
|
-
|
|
310
|
+
v(this.backdrop), v(this.content), this.button.removeAttribute("aria-expanded"), this.button.removeAttribute("aria-haspopup"), this.button.removeEventListener("click", this.onButtonClick), this.button.removeEventListener("keydown", this.onButtonKeyDown), this.removeEventListener("keydown", this.onKeyDown), this.removeEventListener("focusout", this.onFocusOut), this.content.removeEventListener("click", this.onContentClick);
|
|
246
311
|
}
|
|
247
312
|
get open() {
|
|
248
313
|
return this.hasAttribute("open");
|
|
@@ -259,16 +324,16 @@ class $ extends HTMLElement {
|
|
|
259
324
|
wasOpened() {
|
|
260
325
|
if (!this.content.hidden)
|
|
261
326
|
return;
|
|
262
|
-
this.content.hidden = !1, this.backdrop.hidden = !1, h(this.content), h(this.backdrop), this.button.setAttribute("aria-expanded", "true"), this.content.style.position = "absolute", this.cleanup =
|
|
327
|
+
this.content.hidden = !1, this.backdrop.hidden = !1, h(this.content), h(this.backdrop), this.button.setAttribute("aria-expanded", "true"), this.content.style.position = "absolute", this.cleanup = M(
|
|
263
328
|
this.button,
|
|
264
329
|
this.content,
|
|
265
330
|
() => {
|
|
266
|
-
|
|
331
|
+
g(this.button, this.content, {
|
|
267
332
|
placement: this.getAttribute("placement") || "bottom",
|
|
268
333
|
middleware: [
|
|
269
|
-
|
|
334
|
+
L(),
|
|
270
335
|
x(),
|
|
271
|
-
|
|
336
|
+
K({
|
|
272
337
|
apply: ({ availableWidth: e, availableHeight: i }) => {
|
|
273
338
|
Object.assign(this.content.style, {
|
|
274
339
|
maxWidth: "",
|
|
@@ -293,9 +358,9 @@ class $ extends HTMLElement {
|
|
|
293
358
|
}
|
|
294
359
|
wasClosed() {
|
|
295
360
|
var t;
|
|
296
|
-
this.content.hidden || (this.button.setAttribute("aria-expanded", "false"), (t = this.cleanup) == null || t.call(this),
|
|
361
|
+
this.content.hidden || (this.button.setAttribute("aria-expanded", "false"), (t = this.cleanup) == null || t.call(this), d(this.backdrop, {
|
|
297
362
|
finish: () => this.backdrop.hidden = !0
|
|
298
|
-
}),
|
|
363
|
+
}), d(this.content, {
|
|
299
364
|
finish: () => this.content.hidden = !0
|
|
300
365
|
}), this.dispatchEvent(new Event("close")));
|
|
301
366
|
}
|
|
@@ -304,13 +369,13 @@ class $ extends HTMLElement {
|
|
|
304
369
|
return (t = this.shadowRoot) == null ? void 0 : t.firstElementChild;
|
|
305
370
|
}
|
|
306
371
|
get button() {
|
|
307
|
-
return this.
|
|
372
|
+
return this.querySelector("button, [role=button]");
|
|
308
373
|
}
|
|
309
374
|
get content() {
|
|
310
375
|
return this.children[1];
|
|
311
376
|
}
|
|
312
377
|
}
|
|
313
|
-
class
|
|
378
|
+
class U extends HTMLElement {
|
|
314
379
|
constructor() {
|
|
315
380
|
super(...arguments);
|
|
316
381
|
s(this, "onInitialFocus", () => {
|
|
@@ -341,7 +406,7 @@ class P extends HTMLElement {
|
|
|
341
406
|
return A(this);
|
|
342
407
|
}
|
|
343
408
|
}
|
|
344
|
-
const
|
|
409
|
+
const l = class extends HTMLElement {
|
|
345
410
|
constructor() {
|
|
346
411
|
super(...arguments);
|
|
347
412
|
s(this, "parent");
|
|
@@ -353,12 +418,15 @@ const u = class extends HTMLElement {
|
|
|
353
418
|
s(this, "onFocus", this.show.bind(this));
|
|
354
419
|
s(this, "onMouseLeave", this.afterDelay.bind(this, this.hide));
|
|
355
420
|
s(this, "onBlur", this.hide.bind(this));
|
|
421
|
+
s(this, "onPointerUp", (t) => {
|
|
422
|
+
t.pointerType === "mouse" && this.hide();
|
|
423
|
+
});
|
|
356
424
|
s(this, "onKeyDown", (t) => {
|
|
357
425
|
t.key === "Escape" && this.hide();
|
|
358
426
|
});
|
|
359
427
|
}
|
|
360
428
|
connectedCallback() {
|
|
361
|
-
this.parent = this.parentNode, this.parent && (this.parent.addEventListener("mouseenter", this.onMouseEnter), this.parent.addEventListener("focus", this.onFocus), this.parent.addEventListener("mouseleave", this.onMouseLeave), this.parent.addEventListener("blur", this.onBlur), this.parent.addEventListener("
|
|
429
|
+
this.parent = this.parentNode, this.parent && (this.parent.addEventListener("mouseenter", this.onMouseEnter), this.parent.addEventListener("focus", this.onFocus), this.parent.addEventListener("touchstart", this.onFocus), this.parent.addEventListener("mouseleave", this.onMouseLeave), this.parent.addEventListener("blur", this.onBlur), this.parent.addEventListener("pointerup", this.onPointerUp), this.observer = new MutationObserver((t) => {
|
|
362
430
|
t.forEach((e) => {
|
|
363
431
|
e.attributeName === "disabled" && this.hide();
|
|
364
432
|
});
|
|
@@ -366,7 +434,7 @@ const u = class extends HTMLElement {
|
|
|
366
434
|
}
|
|
367
435
|
disconnectedCallback() {
|
|
368
436
|
var t;
|
|
369
|
-
this.tooltip && (this.tooltip.remove(), this.tooltip = void 0), this.parent && (this.parent.removeEventListener("mouseenter", this.onMouseEnter), this.parent.removeEventListener("focus", this.onFocus), this.parent.removeEventListener("mouseleave", this.onMouseLeave), this.parent.removeEventListener("blur", this.onBlur), this.parent.removeEventListener("
|
|
437
|
+
this.tooltip && (this.tooltip.remove(), this.tooltip = void 0), this.parent && (this.parent.removeEventListener("mouseenter", this.onMouseEnter), this.parent.removeEventListener("focus", this.onFocus), this.parent.removeEventListener("touchstart", this.onFocus), this.parent.removeEventListener("mouseleave", this.onMouseLeave), this.parent.removeEventListener("blur", this.onBlur), this.parent.removeEventListener("pointerup", this.onPointerUp), this.parent = void 0), document.removeEventListener("keydown", this.onKeyDown), document.removeEventListener("scroll", this.onBlur), (t = this.observer) == null || t.disconnect(), clearTimeout(this.timeout);
|
|
370
438
|
}
|
|
371
439
|
get disabled() {
|
|
372
440
|
return this.hasAttribute("disabled");
|
|
@@ -378,9 +446,9 @@ const u = class extends HTMLElement {
|
|
|
378
446
|
if (this.disabled)
|
|
379
447
|
return;
|
|
380
448
|
const t = this.createTooltip();
|
|
381
|
-
clearTimeout(this.timeout), this.showing || (t.hidden = !1, h(t), this.showing = !0), t.innerHTML !== this.innerHTML && (t.innerHTML = this.innerHTML), t.style.position = "absolute",
|
|
382
|
-
placement: this.getAttribute("placement") ||
|
|
383
|
-
middleware: [
|
|
449
|
+
clearTimeout(this.timeout), this.showing || (t.hidden = !1, h(t), this.showing = !0), t.innerHTML !== this.innerHTML && (t.innerHTML = this.innerHTML), t.style.position = "absolute", g(this.parent, t, {
|
|
450
|
+
placement: this.getAttribute("placement") || l.placement,
|
|
451
|
+
middleware: [L(), x()]
|
|
384
452
|
}).then(({ x: e, y: i, placement: n }) => {
|
|
385
453
|
Object.assign(t.style, {
|
|
386
454
|
left: `${e}px`,
|
|
@@ -389,7 +457,7 @@ const u = class extends HTMLElement {
|
|
|
389
457
|
});
|
|
390
458
|
}
|
|
391
459
|
hide() {
|
|
392
|
-
clearTimeout(this.timeout), this.showing && (this.showing = !1,
|
|
460
|
+
clearTimeout(this.timeout), this.showing && (this.showing = !1, d(this.tooltip, {
|
|
393
461
|
finish: () => {
|
|
394
462
|
this.tooltip && (this.tooltip.hidden = !0);
|
|
395
463
|
}
|
|
@@ -400,23 +468,25 @@ const u = class extends HTMLElement {
|
|
|
400
468
|
const e = parseInt(this.getAttribute("delay") || "");
|
|
401
469
|
this.timeout = window.setTimeout(
|
|
402
470
|
t.bind(this),
|
|
403
|
-
isNaN(e) ?
|
|
471
|
+
isNaN(e) ? l.delay : e
|
|
404
472
|
);
|
|
405
473
|
}
|
|
406
474
|
createTooltip() {
|
|
407
|
-
return this.tooltip || (this.tooltip = document.createElement("div"), this.tooltip.className = this.getAttribute("tooltip-class") ||
|
|
475
|
+
return this.tooltip || (this.tooltip = document.createElement("div"), this.tooltip.className = this.getAttribute("tooltip-class") || l.tooltipClass, this.tooltip.hidden = !0, this.tooltip.addEventListener("mouseenter", this.show.bind(this)), this.tooltip.addEventListener(
|
|
408
476
|
"mouseleave",
|
|
409
477
|
this.afterDelay.bind(this, this.hide)
|
|
410
478
|
), document.body.appendChild(this.tooltip)), this.tooltip;
|
|
411
479
|
}
|
|
412
480
|
};
|
|
413
|
-
let
|
|
414
|
-
s(
|
|
481
|
+
let c = l;
|
|
482
|
+
s(c, "delay", 100), s(c, "placement", "top"), s(c, "tooltipClass", "tooltip");
|
|
415
483
|
export {
|
|
416
|
-
|
|
417
|
-
b as
|
|
484
|
+
I as AccordionElement,
|
|
485
|
+
b as AlertsElement,
|
|
486
|
+
P as DisclosureElement,
|
|
487
|
+
f as MenuElement,
|
|
418
488
|
m as ModalElement,
|
|
419
489
|
$ as PopupElement,
|
|
420
|
-
|
|
421
|
-
|
|
490
|
+
U as ToolbarElement,
|
|
491
|
+
c as TooltipElement
|
|
422
492
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class DisclosureElement extends HTMLElement {
|
|
2
|
+
static get observedAttributes(): string[];
|
|
3
|
+
connectedCallback(): void;
|
|
4
|
+
disconnectedCallback(): void;
|
|
5
|
+
private onButtonClick;
|
|
6
|
+
get open(): boolean;
|
|
7
|
+
set open(val: boolean);
|
|
8
|
+
get disabled(): boolean;
|
|
9
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
10
|
+
private wasOpened;
|
|
11
|
+
private wasClosed;
|
|
12
|
+
private get button();
|
|
13
|
+
private get content();
|
|
14
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export { default as AccordionElement } from './accordion/accordion';
|
|
1
2
|
export { default as AlertsElement } from './alerts/alerts';
|
|
3
|
+
export { default as DisclosureElement } from './disclosure/disclosure';
|
|
2
4
|
export { default as MenuElement } from './menu/menu';
|
|
3
5
|
export { default as ModalElement } from './modal/modal';
|
|
4
6
|
export { default as PopupElement } from './popup/popup';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inclusive-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Accessible, lightweight, unstyled implementations of common UI controls.",
|
|
5
5
|
"module": "dist/inclusive-elements.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,30 +15,35 @@
|
|
|
15
15
|
"dev": "vite",
|
|
16
16
|
"build": "tsc --noEmit && vite build && tsc --emitDeclarationOnly",
|
|
17
17
|
"preview": "vite preview",
|
|
18
|
-
"release": "release-it
|
|
18
|
+
"release": "release-it"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@floating-ui/dom": "^1.
|
|
22
|
-
"focus-trap": "^6.
|
|
23
|
-
"hello-goodbye": "^0.1.
|
|
24
|
-
"tabbable": "^5.
|
|
21
|
+
"@floating-ui/dom": "^1.2.4",
|
|
22
|
+
"focus-trap": "^6.9.4",
|
|
23
|
+
"hello-goodbye": "^0.1.1",
|
|
24
|
+
"tabbable": "^5.3.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@release-it/
|
|
28
|
-
"prettier": "^2.
|
|
29
|
-
"release-it": "^
|
|
30
|
-
"typescript": "^
|
|
31
|
-
"vite": "^
|
|
27
|
+
"@release-it/conventional-changelog": "^5.1.1",
|
|
28
|
+
"prettier": "^2.8.4",
|
|
29
|
+
"release-it": "^15.9.0",
|
|
30
|
+
"typescript": "^5.0.2",
|
|
31
|
+
"vite": "^4.2.0"
|
|
32
32
|
},
|
|
33
33
|
"release-it": {
|
|
34
|
+
"git": {
|
|
35
|
+
"commitMessage": "release: v${version}",
|
|
36
|
+
"tagName": "v${version}"
|
|
37
|
+
},
|
|
34
38
|
"github": {
|
|
35
|
-
"release": true
|
|
39
|
+
"release": true,
|
|
40
|
+
"releaseName": "v${version}"
|
|
36
41
|
},
|
|
37
42
|
"plugins": {
|
|
38
|
-
"@release-it/
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
43
|
+
"@release-it/conventional-changelog": {
|
|
44
|
+
"preset": "conventionalcommits",
|
|
45
|
+
"infile": "CHANGELOG.md",
|
|
46
|
+
"header": "# Changelog"
|
|
42
47
|
}
|
|
43
48
|
},
|
|
44
49
|
"hooks": {
|