@webority/ui-elements 0.37.0 → 0.38.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/dist/WuiAutocomplete-Comrnbmf.js +13 -0
- package/dist/WuiCommandPalette-CKna1GlO.js +2 -0
- package/dist/WuiConsentBanner-CFll7vxN.js +201 -0
- package/dist/WuiContextMenu-CBy0O4HT.js +1 -0
- package/dist/WuiCountrySelect-oLBUHvMM.js +1 -0
- package/dist/WuiDatePicker-nB1B3eWW.js +31 -0
- package/dist/WuiDateRange-Di5YE9mg.js +25 -0
- package/dist/WuiDock-BD2HgMmP.js +1 -0
- package/dist/WuiImageCrop-Cr3D2iPo.js +17 -0
- package/dist/WuiMultiSelect-BUw-7apM.js +25 -0
- package/dist/WuiOtp-BbO_75RB.js +14 -0
- package/dist/WuiPhone-GJglNelp.js +15 -0
- package/dist/WuiSelect-DvtN4qC2.js +14 -0
- package/dist/WuiSlider-Br6V2amU.js +49 -0
- package/dist/WuiSortable-Bd7Fz5Ox.js +1 -0
- package/dist/WuiTagInput-DzEZooIn.js +6 -0
- package/dist/WuiTimePicker-Bolpp93P.js +9 -0
- package/dist/WuiTour-DiKZEWeb.js +15 -0
- package/dist/WuiTree-SA0QU9AF.js +1 -0
- package/dist/WuiWizardStep-DIHxrXn9.js +1 -0
- package/dist/anchorOverlay-WcDeH46q.js +1 -0
- package/dist/calendarMath-BC2wGCD-.js +1 -0
- package/dist/countries-CvmZ2xpG.js +1 -0
- package/dist/elementBase-BlsR4tqa.js +1 -0
- package/dist/elements/autocomplete.js +1 -6
- package/dist/elements/command-palette.js +1 -6
- package/dist/elements/consent-banner.js +1 -6
- package/dist/elements/context-menu.js +1 -6
- package/dist/elements/country-select.js +1 -6
- package/dist/elements/date-range.js +1 -6
- package/dist/elements/datepicker.js +1 -6
- package/dist/elements/dock.js +1 -6
- package/dist/elements/image-crop.js +1 -6
- package/dist/elements/kanban.js +1 -6
- package/dist/elements/multiselect.js +1 -6
- package/dist/elements/otp.js +1 -6
- package/dist/elements/phone.js +1 -6
- package/dist/elements/select.js +1 -6
- package/dist/elements/slider.js +1 -6
- package/dist/elements/sortable.js +1 -6
- package/dist/elements/status-icon.js +1 -6
- package/dist/elements/taginput.js +1 -6
- package/dist/elements/timepicker.js +1 -6
- package/dist/elements/tour.js +1 -6
- package/dist/elements/tree.js +1 -6
- package/dist/elements/wizard.js +1 -5
- package/dist/examples.mobile.json-GS1_MGh9.js +1 -0
- package/dist/fileViewerImage-Y9QBn2Rj.js +6 -0
- package/dist/fileViewerMedia-CaJaVnjE.js +1 -0
- package/dist/fileViewerPdf-BN0zuehw.js +19 -0
- package/dist/fileViewerUi-DasgDsU-.js +1 -0
- package/dist/focusOrigin-2imUSs-u.js +1 -0
- package/dist/formMirror-BgY7zkC3.js +1 -0
- package/dist/formatters-BAE__8ye.js +1 -0
- package/dist/helpers.js +1 -5
- package/dist/iconGlyphs.g-CUm_mfze.js +1 -0
- package/dist/kanban-CdELdS3U.js +1 -0
- package/dist/listboxKeyNav-DMIvs9d6.js +1 -0
- package/dist/max-CNrKnpEj.js +17 -0
- package/dist/optionLabel-DsX2fhWs.js +1 -0
- package/dist/statusIcons-2X4iGkKL.js +10 -0
- package/dist/textMatch-wdY7XLIc.js +1 -0
- package/dist/themeTransition-lkmQm8FR.js +1 -0
- package/dist/tokenCommit-BKckxgtg.js +2 -0
- package/dist/ui-calendar.global.js +1 -1
- package/dist/ui-calendar.js +1 -9905
- package/dist/ui-chart.js +21 -34563
- package/dist/ui-chat-core.js +10 -347
- package/dist/ui-chat.js +10 -1066
- package/dist/ui-elements.global.js +52 -53
- package/dist/ui-elements.js +1 -692
- package/dist/ui-file-viewer.js +1 -311
- package/dist/ui-rich-text.js +193 -16887
- package/dist/wuiHttp-BC8co934.js +1 -0
- package/package.json +5 -7
- package/dist/WuiAutocomplete-ByxnwJNQ.js +0 -283
- package/dist/WuiCommandPalette-CtZ04JxZ.js +0 -130
- package/dist/WuiConsentBanner-oVe-jxCO.js +0 -399
- package/dist/WuiContextMenu-Bx_U2X3t.js +0 -211
- package/dist/WuiCountrySelect-CUAwKnL9.js +0 -28
- package/dist/WuiDatePicker-DkNbc-z7.js +0 -325
- package/dist/WuiDateRange-BocnVO6L.js +0 -233
- package/dist/WuiDock-BSDY9g8Q.js +0 -57
- package/dist/WuiImageCrop-1yaAONTk.js +0 -462
- package/dist/WuiMultiSelect-BrCGRNCt.js +0 -416
- package/dist/WuiOtp-D8-4Pqil.js +0 -128
- package/dist/WuiPhone-BvbhiP2r.js +0 -731
- package/dist/WuiSelect-BXrpiuXG.js +0 -214
- package/dist/WuiSlider-BcU0psYf.js +0 -256
- package/dist/WuiSortable-JjJqstSU.js +0 -280
- package/dist/WuiTagInput-D1ay3OcL.js +0 -158
- package/dist/WuiTimePicker-C7n-VFGt.js +0 -370
- package/dist/WuiTour-R5O9l--J.js +0 -205
- package/dist/WuiTree-DXP7pGeI.js +0 -393
- package/dist/WuiWizardStep-BU5w9_Ds.js +0 -221
- package/dist/anchorOverlay-DluGZ8ef.js +0 -23
- package/dist/calendarMath-BAF2Jkg_.js +0 -42
- package/dist/countries-B-M_LTgS.js +0 -1234
- package/dist/elementBase-Bg1xpvup.js +0 -9
- package/dist/examples.mobile.json-BMXTGiGC.js +0 -250
- package/dist/fileViewerImage-Dky4nQZS.js +0 -185
- package/dist/fileViewerMedia-DPk_YcvC.js +0 -133
- package/dist/fileViewerPdf-BnIsj-J-.js +0 -15799
- package/dist/fileViewerUi-R6hlcShk.js +0 -272
- package/dist/formMirror-jGf5M4gk.js +0 -29
- package/dist/formatters-DusKbTyV.js +0 -138
- package/dist/iconGlyphs.g-Cpg1BUHm.js +0 -215
- package/dist/kanban-BIiEMkTK.js +0 -985
- package/dist/listboxKeyNav-zts_8d5e.js +0 -36
- package/dist/max-BDKx469G.js +0 -14478
- package/dist/optionLabel-Dn-I7zyp.js +0 -16
- package/dist/statusIcons-C3zjycpa.js +0 -37
- package/dist/textMatch-DEUjlkdy.js +0 -27
- package/dist/themeTransition-BpCuMnjk.js +0 -589
- package/dist/tokenCommit-VWz-2jEf.js +0 -20
- package/dist/wuiHttp-oeHs7X_c.js +0 -118
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./elementBase-Bg1xpvup.js";
|
|
2
|
-
import { n as t } from "./formMirror-jGf5M4gk.js";
|
|
3
|
-
//#region src/WuiSortable.js
|
|
4
|
-
var n = /* @__PURE__ */ new Set(), r = ".wui-sortable-handle", i = "a[href],button,input,select,textarea,label,summary,[contenteditable='true'],[role='button'],[role='link']", a = 4, o = 8, s = 250, c = 48, l = 18, u = class extends e {
|
|
5
|
-
static get observedAttributes() {
|
|
6
|
-
return ["name", "disabled"];
|
|
7
|
-
}
|
|
8
|
-
constructor() {
|
|
9
|
-
super(), this._drag = null, this._kb = null, this._moving = !1, this.controlled = !1, this._observer = null, this._onPointerDown = this._onPointerDown.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onFocusOut = this._onFocusOut.bind(this), this._onDragStart = (e) => e.preventDefault(), this._onDocMove = this._onDocMove.bind(this), this._onDocUp = this._onDocUp.bind(this), this._onDocCancel = this._onDocCancel.bind(this), this._onDocKey = this._onDocKey.bind(this), this._onDocTouchMove = (e) => {
|
|
10
|
-
this._drag?.started && e.preventDefault();
|
|
11
|
-
}, this._onSelectStart = (e) => e.preventDefault(), this._scrollTick = this._scrollTick.bind(this);
|
|
12
|
-
}
|
|
13
|
-
connectedCallback() {
|
|
14
|
-
n.add(this), this.addEventListener("pointerdown", this._onPointerDown), this.addEventListener("keydown", this._onKeyDown), this.addEventListener("focusout", this._onFocusOut), this.addEventListener("dragstart", this._onDragStart), this._observer = new MutationObserver(() => this._syncMirrors()), this._observer.observe(this, { childList: !0 }), this._syncMirrors();
|
|
15
|
-
}
|
|
16
|
-
disconnectedCallback() {
|
|
17
|
-
n.delete(this), this.removeEventListener("pointerdown", this._onPointerDown), this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("focusout", this._onFocusOut), this.removeEventListener("dragstart", this._onDragStart), this._observer?.disconnect(), this._observer = null, this._abort();
|
|
18
|
-
}
|
|
19
|
-
attributeChangedCallback(e) {
|
|
20
|
-
e === "disabled" && this._abort(), this.isConnected && this._syncMirrors();
|
|
21
|
-
}
|
|
22
|
-
get order() {
|
|
23
|
-
return this._items().map((e) => e.getAttribute("data-id"));
|
|
24
|
-
}
|
|
25
|
-
set order(e) {
|
|
26
|
-
if (this._drag?.started || this._kb) return;
|
|
27
|
-
let t = this._items(), n = new Map(t.map((e) => [e.getAttribute("data-id"), e])), r = [];
|
|
28
|
-
for (let t of e ?? []) {
|
|
29
|
-
let e = n.get(String(t));
|
|
30
|
-
e && !r.includes(e) && r.push(e);
|
|
31
|
-
}
|
|
32
|
-
[...r, ...t.filter((e) => !r.includes(e))].forEach((e, t) => {
|
|
33
|
-
let n = this._items()[t];
|
|
34
|
-
n !== e && this.insertBefore(e, n);
|
|
35
|
-
}), this._syncMirrors();
|
|
36
|
-
}
|
|
37
|
-
_items() {
|
|
38
|
-
return [...this.querySelectorAll(":scope > [data-id]")];
|
|
39
|
-
}
|
|
40
|
-
_itemFrom(e) {
|
|
41
|
-
let t = e;
|
|
42
|
-
for (; t && t.parentElement !== this;) t = t.parentElement;
|
|
43
|
-
return t?.hasAttribute("data-id") ? t : null;
|
|
44
|
-
}
|
|
45
|
-
_itemDisabled(e) {
|
|
46
|
-
return e.hasAttribute("data-disabled");
|
|
47
|
-
}
|
|
48
|
-
_horizontal() {
|
|
49
|
-
return this.getAttribute("orientation") === "horizontal";
|
|
50
|
-
}
|
|
51
|
-
_syncMirrors() {
|
|
52
|
-
t(this, this.order);
|
|
53
|
-
}
|
|
54
|
-
_insertAt(e, t) {
|
|
55
|
-
let n = this._items();
|
|
56
|
-
if (n.indexOf(e) === t) return;
|
|
57
|
-
let r = n.filter((t) => t !== e), i = r[t] ?? null;
|
|
58
|
-
i ? this.insertBefore(e, i) : r.length > 0 ? r[r.length - 1].after(e) : this.appendChild(e);
|
|
59
|
-
}
|
|
60
|
-
_indexFor(e, t, n) {
|
|
61
|
-
let r = this._items().filter((t) => t !== e), i = this._horizontal();
|
|
62
|
-
for (let e = 0; e < r.length; e++) {
|
|
63
|
-
let a = r[e].getBoundingClientRect();
|
|
64
|
-
if (i ? n < a.top || n <= a.bottom && t < a.left + a.width / 2 : n < a.top + a.height / 2) return e;
|
|
65
|
-
}
|
|
66
|
-
return r.length;
|
|
67
|
-
}
|
|
68
|
-
_peers() {
|
|
69
|
-
let e = this.getAttribute("group");
|
|
70
|
-
return [...n].filter((t) => t === this || e && t.getAttribute("group") === e && !t.hasAttribute("disabled"));
|
|
71
|
-
}
|
|
72
|
-
_labelOf(e) {
|
|
73
|
-
return e.getAttribute("data-label") || e.textContent.replace(/\s+/g, " ").trim() || e.getAttribute("data-id");
|
|
74
|
-
}
|
|
75
|
-
_announce(e) {
|
|
76
|
-
let t = this.querySelector(":scope > .wui-sortable-live");
|
|
77
|
-
t || (t = document.createElement("div"), t.className = "wui-sortable-live", t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "true"), this.appendChild(t)), t.textContent = e;
|
|
78
|
-
}
|
|
79
|
-
_position(e) {
|
|
80
|
-
let t = this._items();
|
|
81
|
-
return `position ${t.indexOf(e) + 1} of ${t.length}`;
|
|
82
|
-
}
|
|
83
|
-
_onPointerDown(e) {
|
|
84
|
-
if (this._drag || this._kb || this.hasAttribute("disabled") || e.pointerType === "mouse" && e.button !== 0) return;
|
|
85
|
-
let t = this._itemFrom(e.target);
|
|
86
|
-
if (!t || this._itemDisabled(t)) return;
|
|
87
|
-
let n = t.querySelector(`:scope > ${r}`), c = !!n && n.contains(e.target);
|
|
88
|
-
if (this.hasAttribute("handle") && !c) return;
|
|
89
|
-
if (!c) {
|
|
90
|
-
let n = e.target.closest?.(i);
|
|
91
|
-
if (n && n !== t && t.contains(n)) return;
|
|
92
|
-
}
|
|
93
|
-
let l = e.pointerType === "touch" && !c, u = {
|
|
94
|
-
item: t,
|
|
95
|
-
pointerId: e.pointerId,
|
|
96
|
-
startX: e.clientX,
|
|
97
|
-
startY: e.clientY,
|
|
98
|
-
x: e.clientX,
|
|
99
|
-
y: e.clientY,
|
|
100
|
-
slop: e.pointerType === "touch" ? o : a,
|
|
101
|
-
ready: !l,
|
|
102
|
-
started: !1,
|
|
103
|
-
timer: null,
|
|
104
|
-
raf: 0,
|
|
105
|
-
list: this,
|
|
106
|
-
ghost: null
|
|
107
|
-
};
|
|
108
|
-
this._drag = u, l && (u.timer = setTimeout(() => {
|
|
109
|
-
u.timer = null, u.ready = !0, this._begin();
|
|
110
|
-
}, s)), document.addEventListener("pointermove", this._onDocMove), document.addEventListener("pointerup", this._onDocUp), document.addEventListener("pointercancel", this._onDocCancel), document.addEventListener("keydown", this._onDocKey, !0), document.addEventListener("touchmove", this._onDocTouchMove, { passive: !1 });
|
|
111
|
-
}
|
|
112
|
-
_onDocMove(e) {
|
|
113
|
-
let t = this._drag;
|
|
114
|
-
if (!(!t || e.pointerId !== t.pointerId)) {
|
|
115
|
-
if (t.x = e.clientX, t.y = e.clientY, !t.started) {
|
|
116
|
-
let e = Math.hypot(t.x - t.startX, t.y - t.startY);
|
|
117
|
-
if (!t.ready) {
|
|
118
|
-
e > t.slop && this._finish(!0);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (e < t.slop || (this._begin(), !this._drag?.started)) return;
|
|
122
|
-
}
|
|
123
|
-
e.preventDefault?.(), this._moveGhost(), this._update();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
_onDocUp(e) {
|
|
127
|
-
this._drag && e.pointerId === this._drag.pointerId && this._finish(!1);
|
|
128
|
-
}
|
|
129
|
-
_onDocCancel(e) {
|
|
130
|
-
this._drag && e.pointerId === this._drag.pointerId && this._finish(!0);
|
|
131
|
-
}
|
|
132
|
-
_onDocKey(e) {
|
|
133
|
-
e.key !== "Escape" || !this._drag || (e.preventDefault(), e.stopPropagation(), this._finish(!0));
|
|
134
|
-
}
|
|
135
|
-
_begin() {
|
|
136
|
-
let e = this._drag;
|
|
137
|
-
if (!e || e.started) return;
|
|
138
|
-
e.started = !0;
|
|
139
|
-
let t = e.item.getBoundingClientRect();
|
|
140
|
-
e.offsetX = e.startX - t.left, e.offsetY = e.startY - t.top, e.fromIndex = this._items().indexOf(e.item);
|
|
141
|
-
let n = e.item.cloneNode(!0);
|
|
142
|
-
for (let e of [n, ...n.querySelectorAll("[id],[data-id]")]) e.removeAttribute("id"), e.removeAttribute("data-id");
|
|
143
|
-
n.classList.add("wui-sortable-ghost"), n.setAttribute("aria-hidden", "true"), n.inert = !0, n.style.width = `${t.width}px`, n.style.height = `${t.height}px`, e.ghost = n, e.item.classList.add("wui-sortable-dragging"), document.body.appendChild(n), document.documentElement.classList.add("wui-sortable-active"), document.addEventListener("selectstart", this._onSelectStart), this._moveGhost(), e.raf = requestAnimationFrame(this._scrollTick), this._emit(this, "wui-sortable:start", { id: e.item.getAttribute("data-id") });
|
|
144
|
-
}
|
|
145
|
-
_moveGhost() {
|
|
146
|
-
let e = this._drag;
|
|
147
|
-
e?.ghost && (e.ghost.style.transform = `translate(${e.x - e.offsetX}px, ${e.y - e.offsetY}px)`);
|
|
148
|
-
}
|
|
149
|
-
_update() {
|
|
150
|
-
let e = this._drag;
|
|
151
|
-
if (!e?.started) return;
|
|
152
|
-
let t = e.list;
|
|
153
|
-
for (let n of this._peers()) {
|
|
154
|
-
let r = n.getBoundingClientRect();
|
|
155
|
-
if (e.x >= r.left && e.x <= r.right && e.y >= r.top && e.y <= r.bottom) {
|
|
156
|
-
t = n;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
let n = t._indexFor(e.item, e.x, e.y);
|
|
161
|
-
(t !== e.list || n !== t._items().indexOf(e.item)) && t._insertAt(e.item, n), e.list = t;
|
|
162
|
-
}
|
|
163
|
-
_scrollTick() {
|
|
164
|
-
let e = this._drag;
|
|
165
|
-
if (!e?.started) return;
|
|
166
|
-
let t = f(e.list), n = t ? t.getBoundingClientRect() : null, r = Math.max(n?.top ?? 0, 0), i = Math.min(n?.bottom ?? window.innerHeight, window.innerHeight), a = Math.max(n?.left ?? 0, 0), o = Math.min(n?.right ?? window.innerWidth, window.innerWidth), s = d(e.y, r, i), c = d(e.x, a, o);
|
|
167
|
-
(c || s) && (t ? (t.scrollTop += s, t.scrollLeft += c) : window.scrollBy(c, s), this._update()), e.raf = requestAnimationFrame(this._scrollTick);
|
|
168
|
-
}
|
|
169
|
-
_finish(e) {
|
|
170
|
-
let t = this._drag;
|
|
171
|
-
if (!t || (this._drag = null, clearTimeout(t.timer), cancelAnimationFrame(t.raf), document.removeEventListener("pointermove", this._onDocMove), document.removeEventListener("pointerup", this._onDocUp), document.removeEventListener("pointercancel", this._onDocCancel), document.removeEventListener("keydown", this._onDocKey, !0), document.removeEventListener("touchmove", this._onDocTouchMove), document.removeEventListener("selectstart", this._onSelectStart), !t.started)) return;
|
|
172
|
-
t.ghost?.remove(), document.documentElement.classList.remove("wui-sortable-active"), t.item.classList.remove("wui-sortable-dragging");
|
|
173
|
-
let n = t.item.getAttribute("data-id");
|
|
174
|
-
e ? (this._insertAt(t.item, t.fromIndex), this._syncMirrors(), t.list !== this && t.list._syncMirrors()) : this._settle(t.item, this, t.fromIndex, t.list), this._emit(this, "wui-sortable:end", {
|
|
175
|
-
id: n,
|
|
176
|
-
cancelled: e
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
_settle(e, t, n, r) {
|
|
180
|
-
let i = r._items().indexOf(e);
|
|
181
|
-
if (r === t && i === n) return;
|
|
182
|
-
let a = e.getAttribute("data-id"), o = r.order, s = r !== t, c = t.order;
|
|
183
|
-
s && (t.controlled || r.controlled) && t._insertAt(e, n), t._syncMirrors(), r._syncMirrors();
|
|
184
|
-
let l = r._labelOf(e), u = s && r.getAttribute("aria-label") ? ` to ${r.getAttribute("aria-label")}` : "", d = {
|
|
185
|
-
id: a,
|
|
186
|
-
fromIndex: n,
|
|
187
|
-
toIndex: i,
|
|
188
|
-
from: t,
|
|
189
|
-
to: r
|
|
190
|
-
};
|
|
191
|
-
s && this._emit(t, "wui-sortable:change", {
|
|
192
|
-
...d,
|
|
193
|
-
ids: c
|
|
194
|
-
}), this._emit(r, "wui-sortable:change", {
|
|
195
|
-
...d,
|
|
196
|
-
ids: o
|
|
197
|
-
}), r._announce(`${l} moved${u}, position ${i + 1} of ${o.length}.`);
|
|
198
|
-
}
|
|
199
|
-
_emit(e, t, n) {
|
|
200
|
-
e.dispatchEvent(new CustomEvent(t, {
|
|
201
|
-
bubbles: !0,
|
|
202
|
-
detail: n
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
_abort() {
|
|
206
|
-
this._drag && this._finish(!0), this._kb && this._dropKeyboard(!0);
|
|
207
|
-
}
|
|
208
|
-
_onKeyDown(e) {
|
|
209
|
-
if (this.hasAttribute("disabled")) return;
|
|
210
|
-
let t = e.target.closest?.(r), n = t && t.parentElement?.parentElement === this ? t.parentElement : null;
|
|
211
|
-
if (!n || this._itemDisabled(n) || this._drag) return;
|
|
212
|
-
let i = e.key;
|
|
213
|
-
if (!this._kb) {
|
|
214
|
-
if (i !== " " && i !== "Enter") return;
|
|
215
|
-
e.preventDefault(), this._liftKeyboard(n, t);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (this._kb.item === n) {
|
|
219
|
-
if (i === " " || i === "Enter") e.preventDefault(), this._dropKeyboard(!1);
|
|
220
|
-
else if (i === "Escape") e.preventDefault(), e.stopPropagation(), this._dropKeyboard(!0);
|
|
221
|
-
else if ([
|
|
222
|
-
"ArrowUp",
|
|
223
|
-
"ArrowLeft",
|
|
224
|
-
"ArrowDown",
|
|
225
|
-
"ArrowRight",
|
|
226
|
-
"Home",
|
|
227
|
-
"End"
|
|
228
|
-
].includes(i)) {
|
|
229
|
-
e.preventDefault();
|
|
230
|
-
let r = this._items(), a = r.indexOf(n), o = r.length - 1, s = i === "Home" ? 0 : i === "End" ? o : Math.max(0, Math.min(o, a + (i === "ArrowUp" || i === "ArrowLeft" ? -1 : 1)));
|
|
231
|
-
if (s === a) {
|
|
232
|
-
this._announce(`${this._labelOf(n)} is already ${a === 0 ? "first" : "last"}, ${this._position(n)}.`);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
this._moveFocused(() => this._insertAt(n, s), t), this._announce(`${this._labelOf(n)} moved to ${this._position(n)}.`);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
_onFocusOut(e) {
|
|
240
|
-
!this._kb || this._moving || e.relatedTarget && this._kb.handle.contains(e.relatedTarget) || this._dropKeyboard(!1);
|
|
241
|
-
}
|
|
242
|
-
_liftKeyboard(e, t) {
|
|
243
|
-
this._kb = {
|
|
244
|
-
item: e,
|
|
245
|
-
handle: t,
|
|
246
|
-
fromIndex: this._items().indexOf(e)
|
|
247
|
-
}, t.setAttribute("aria-pressed", "true"), this._announce(`${this._labelOf(e)} lifted, ${this._position(e)}. Use the arrow keys to move it, Space to drop it, Escape to cancel.`);
|
|
248
|
-
}
|
|
249
|
-
_dropKeyboard(e) {
|
|
250
|
-
let t = this._kb;
|
|
251
|
-
if (t) {
|
|
252
|
-
if (this._kb = null, t.handle.removeAttribute("aria-pressed"), e) {
|
|
253
|
-
this._moveFocused(() => this._insertAt(t.item, t.fromIndex), t.handle), this._announce(`Reorder cancelled. ${this._labelOf(t.item)} is back at ${this._position(t.item)}.`);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
if (this._items().indexOf(t.item) === t.fromIndex) {
|
|
257
|
-
this._announce(`${this._labelOf(t.item)} dropped, ${this._position(t.item)}.`);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
this._settle(t.item, this, t.fromIndex, this);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
_moveFocused(e, t) {
|
|
264
|
-
this._moving = !0;
|
|
265
|
-
let n = this.contains(document.activeElement);
|
|
266
|
-
e(), n && document.activeElement !== t && t.focus(), this._moving = !1;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
function d(e, t, n) {
|
|
270
|
-
return e < t + c ? -Math.ceil(l * Math.min(1, (t + c - e) / c)) : e > n - c ? Math.ceil(l * Math.min(1, (e - (n - c)) / c)) : 0;
|
|
271
|
-
}
|
|
272
|
-
function f(e) {
|
|
273
|
-
for (let t = e.parentElement; t && t !== document.body && t !== document.documentElement; t = t.parentElement) {
|
|
274
|
-
let e = getComputedStyle(t), n = /(auto|scroll)/.test(e.overflowY) && t.scrollHeight > t.clientHeight, r = /(auto|scroll)/.test(e.overflowX) && t.scrollWidth > t.clientWidth;
|
|
275
|
-
if (n || r) return t;
|
|
276
|
-
}
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
//#endregion
|
|
280
|
-
export { u as t };
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./elementBase-Bg1xpvup.js";
|
|
2
|
-
import { n as t } from "./formMirror-jGf5M4gk.js";
|
|
3
|
-
import { t as n } from "./iconGlyphs.g-Cpg1BUHm.js";
|
|
4
|
-
import { i as r, n as i, r as a, t as o } from "./tokenCommit-VWz-2jEf.js";
|
|
5
|
-
//#region src/WuiTagInput.js
|
|
6
|
-
var s = class extends e {
|
|
7
|
-
static formAssociated = !0;
|
|
8
|
-
_accessibleName() {
|
|
9
|
-
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
10
|
-
}
|
|
11
|
-
static get observedAttributes() {
|
|
12
|
-
return [
|
|
13
|
-
"placeholder",
|
|
14
|
-
"disabled",
|
|
15
|
-
"size",
|
|
16
|
-
"max-tags",
|
|
17
|
-
"aria-label",
|
|
18
|
-
"separators",
|
|
19
|
-
"allow-duplicates",
|
|
20
|
-
"aria-invalid"
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
constructor() {
|
|
24
|
-
super(), this._values = [], this._draftText = "";
|
|
25
|
-
try {
|
|
26
|
-
this._internals = this.attachInternals();
|
|
27
|
-
} catch {
|
|
28
|
-
this._internals = null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
connectedCallback() {
|
|
32
|
-
if (!this._rendered) {
|
|
33
|
-
if (!this._valuesInit && !this._values.length) {
|
|
34
|
-
let e = this.getAttribute("value");
|
|
35
|
-
if (e != null && e !== "") this._values = e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
36
|
-
else {
|
|
37
|
-
let e = [...this.querySelectorAll(":scope > wui-tag")].map((e) => e.textContent.trim());
|
|
38
|
-
e.length && (this._values = e.map(String));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
this._valuesInit = !0, this._defaultCaptured ||= (this._defaultValues = this._values.slice(), !0), this.render();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
this._wire();
|
|
45
|
-
}
|
|
46
|
-
formResetCallback() {
|
|
47
|
-
this.values = (this._defaultValues || []).slice(), this._draftText = "";
|
|
48
|
-
let e = this.querySelector("[data-input]");
|
|
49
|
-
e && (e.value = "");
|
|
50
|
-
}
|
|
51
|
-
attributeChangedCallback(e) {
|
|
52
|
-
if (e === "aria-invalid") {
|
|
53
|
-
this._syncInvalid();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (this._rendered) {
|
|
57
|
-
if (e === "separators" || e === "allow-duplicates") {
|
|
58
|
-
this._wire();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
this.render();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
_syncInvalid() {
|
|
65
|
-
let e = this.querySelector(".search-select-control");
|
|
66
|
-
e && (this.hasAttribute("aria-invalid") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
|
|
67
|
-
}
|
|
68
|
-
get values() {
|
|
69
|
-
return this._values.slice();
|
|
70
|
-
}
|
|
71
|
-
set values(e) {
|
|
72
|
-
this._values = Array.isArray(e) ? e.map(String) : [], t(this, this._values), this._rendered && this._renderControl();
|
|
73
|
-
}
|
|
74
|
-
render() {
|
|
75
|
-
let e = this.getAttribute("size"), n = e === "sm" ? " search-select-sm" : e === "lg" ? " search-select-lg" : "";
|
|
76
|
-
t(this, this._values), this.innerHTML = `
|
|
77
|
-
<div class="search-select${n}">
|
|
78
|
-
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
|
|
79
|
-
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input aria-label="${l(this._accessibleName())}" placeholder="${l(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/></div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>`, this._rendered = !0, t(this, this._values), this._renderControl(), this._wire();
|
|
82
|
-
}
|
|
83
|
-
_renderControl() {
|
|
84
|
-
let e = this.querySelector("[data-chips]");
|
|
85
|
-
if (e) {
|
|
86
|
-
for (let t of e.querySelectorAll(":scope > .chip")) t.remove();
|
|
87
|
-
this._values.length && e.querySelector("[data-input]").insertAdjacentHTML("beforebegin", this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${c(e)}</span><button type="button" class="chip-remove" data-remove="${l(e)}" aria-label="Remove ${l(e)}">${n("x")}</button></span>`).join(""));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
_wire() {
|
|
91
|
-
this._teardown();
|
|
92
|
-
let e = this.querySelector(".search-select-control"), n = this.querySelector("[data-input]");
|
|
93
|
-
if (!e || !n) return;
|
|
94
|
-
let s = () => this.hasAttribute("disabled"), c = (this.getAttribute("separators") || "enter,comma").split(",").map((e) => e.trim()), l = this.getAttribute("max-tags"), u = this.hasAttribute("allow-duplicates"), d = new Set(c.map(a).filter(Boolean)), f = () => {
|
|
95
|
-
t(this, this._values), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
96
|
-
}, p = (e) => {
|
|
97
|
-
let t = e.trim();
|
|
98
|
-
if (!t || l && this._values.length >= parseInt(l, 10)) return;
|
|
99
|
-
let n = u ? t : t.toLowerCase();
|
|
100
|
-
(!this._values.some((e) => u ? e === t : e.toLowerCase() === n) || u) && (this._values.push(t), this._renderControl(), f());
|
|
101
|
-
}, m = (e) => {
|
|
102
|
-
this._values = this._values.filter((t) => t !== e), this._renderControl(), f();
|
|
103
|
-
}, h = (e) => {
|
|
104
|
-
if (e.key === "Enter" && d.has("Enter")) {
|
|
105
|
-
e.preventDefault(), p(n.value), n.value = "";
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (e.key === "," && d.has(",")) {
|
|
109
|
-
e.preventDefault(), p(n.value.replace(/,+$/, "")), n.value = "";
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (e.key === " " && d.has(" ")) {
|
|
113
|
-
let t = n.value.trim();
|
|
114
|
-
t && (e.preventDefault(), p(t), n.value = "");
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (e.key === "Tab" && d.has("Tab")) {
|
|
118
|
-
e.preventDefault(), p(n.value), n.value = "";
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
e.key === "Backspace" && !n.value && this._values.length && (e.preventDefault(), m(this._values[this._values.length - 1])), e.key === "Escape" && (n.value = "");
|
|
122
|
-
}, g = (e) => {
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
let t = e.clipboardData.getData("text/plain"), a = [];
|
|
125
|
-
for (let e of c) {
|
|
126
|
-
let n = i(e) ?? e;
|
|
127
|
-
if (o(t, [n])) {
|
|
128
|
-
a.push(...r(t, [n]));
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
a.length || a.push(t.trim());
|
|
133
|
-
for (let e of a) if (p(e), l && this._values.length >= parseInt(l, 10)) break;
|
|
134
|
-
n.value = "";
|
|
135
|
-
};
|
|
136
|
-
this._onControlClick = (e) => {
|
|
137
|
-
if (s()) return;
|
|
138
|
-
let t = e.target.closest("[data-remove]");
|
|
139
|
-
if (t) {
|
|
140
|
-
e.stopPropagation(), m(t.dataset.remove), n.focus();
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
n.focus();
|
|
144
|
-
}, this._onInputKey = h, this._onInputPaste = g, e.addEventListener("click", this._onControlClick), n.addEventListener("keydown", this._onInputKey), n.addEventListener("paste", this._onInputPaste), this._onDocClick = (e) => {
|
|
145
|
-
this.contains(e.target) || n.blur();
|
|
146
|
-
}, document.addEventListener("click", this._onDocClick);
|
|
147
|
-
}
|
|
148
|
-
_teardown() {
|
|
149
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null);
|
|
150
|
-
let e = this.querySelector(".search-select-control"), t = this.querySelector("[data-input]");
|
|
151
|
-
e && this._onControlClick && e.removeEventListener("click", this._onControlClick), t && this._onInputKey && (t.removeEventListener("keydown", this._onInputKey), t.removeEventListener("paste", this._onInputPaste));
|
|
152
|
-
}
|
|
153
|
-
disconnectedCallback() {
|
|
154
|
-
this._teardown();
|
|
155
|
-
}
|
|
156
|
-
}, c = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), l = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
157
|
-
//#endregion
|
|
158
|
-
export { s as t };
|