@mintplayer/web-components 2.2.0 → 2.3.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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { ifDefined as
|
|
3
|
-
import { createRef as
|
|
4
|
-
|
|
1
|
+
import { unsafeCSS as h, LitElement as n, nothing as l, html as a } from "lit";
|
|
2
|
+
import { ifDefined as c } from "lit/directives/if-defined.js";
|
|
3
|
+
import { createRef as b, ref as m } from "lit/directives/ref.js";
|
|
4
|
+
import { i as p } from "./invalid-feedback.styles-he0JYrJm.mjs";
|
|
5
|
+
import { H as v } from "./host-aria-WSGs7SPQ.mjs";
|
|
6
|
+
import { F as f, a as _, e as g } from "./form-associated-axmc5sY0.mjs";
|
|
7
|
+
const k = h(`.form-select {
|
|
5
8
|
--bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
|
|
6
9
|
display: block;
|
|
7
10
|
width: 100%;
|
|
@@ -64,16 +67,20 @@ const b = o(`.form-select {
|
|
|
64
67
|
|
|
65
68
|
:host {
|
|
66
69
|
display: inline-block;
|
|
67
|
-
}`)
|
|
68
|
-
|
|
70
|
+
}`);
|
|
71
|
+
function x(o) {
|
|
72
|
+
return Array.isArray(o.options);
|
|
73
|
+
}
|
|
74
|
+
const u = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
75
|
+
let y = 0;
|
|
76
|
+
class q extends f(n) {
|
|
69
77
|
constructor() {
|
|
70
|
-
super(...arguments), this._size = "md", this._multiple = !1, this._numberVisible = null, this._disabled = !1, this._value = null, this._values = [], this._options = null, this._slotOptions = [], this._selectRef =
|
|
78
|
+
super(...arguments), this._size = "md", this._multiple = !1, this._numberVisible = null, this._disabled = !1, this._value = null, this._inputLabel = null, this._errorText = null, this._errorId = `mp-select-${++y}-error`, this._values = [], this._options = null, this._slotOptions = [], this._selectRef = b(), this._slotObserver = null, this.hostAria = new v(this, {
|
|
79
|
+
referenceTarget: () => this._selectRef.value ?? null,
|
|
80
|
+
describedByExtras: () => _(this.renderRoot)
|
|
81
|
+
}), this.onSlotChange = (e) => {
|
|
71
82
|
const s = e.target.assignedElements({ flatten: !0 });
|
|
72
|
-
this._slotOptions =
|
|
73
|
-
value: i.value,
|
|
74
|
-
label: i.textContent?.trim() ?? "",
|
|
75
|
-
disabled: i.disabled
|
|
76
|
-
})), this.observeSlottedMutations(s), this.requestUpdate();
|
|
83
|
+
this._slotOptions = this.collectSlotItems(s), this.observeSlottedMutations(s), this.requestUpdate();
|
|
77
84
|
}, this.onNativeChange = (e) => {
|
|
78
85
|
const t = e.target;
|
|
79
86
|
this._multiple ? (this._values = Array.from(t.selectedOptions).map((s) => s.value), this._value = this._values[0] ?? null) : (this._value = t.value || null, this._values = this._value == null ? [] : [this._value]), this.dispatchEvent(
|
|
@@ -86,11 +93,11 @@ class c extends r {
|
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
95
|
static {
|
|
89
|
-
this.styles = [
|
|
96
|
+
this.styles = [k, p];
|
|
90
97
|
}
|
|
91
98
|
static {
|
|
92
99
|
this.shadowRootOptions = {
|
|
93
|
-
...
|
|
100
|
+
...n.shadowRootOptions,
|
|
94
101
|
delegatesFocus: !0
|
|
95
102
|
};
|
|
96
103
|
}
|
|
@@ -101,15 +108,30 @@ class c extends r {
|
|
|
101
108
|
"multiple",
|
|
102
109
|
"number-visible",
|
|
103
110
|
"disabled",
|
|
111
|
+
// Observed, not just switched on: `attributeChangedCallback` already had
|
|
112
|
+
// cases for these two, but with the attributes absent from this list the
|
|
113
|
+
// callback never fired for them, so `aria-invalid`/`aria-required` were
|
|
114
|
+
// frozen at whatever the first render saw. A form mirrors validity *after*
|
|
115
|
+
// the control is touched, i.e. always later than that.
|
|
116
|
+
"invalid",
|
|
117
|
+
"required",
|
|
118
|
+
// Validation message rendered inside the shadow root and referenced by the
|
|
119
|
+
// inner <select>; shown only while `invalid` is also set.
|
|
120
|
+
"error-text",
|
|
104
121
|
"value",
|
|
105
|
-
"aria-label"
|
|
122
|
+
"aria-label",
|
|
123
|
+
"input-label",
|
|
124
|
+
// Watched so a consumer's reference can be re-resolved when it changes; the
|
|
125
|
+
// ids themselves resolve in the host's tree, never inside the shadow root.
|
|
126
|
+
"aria-labelledby",
|
|
127
|
+
"aria-describedby"
|
|
106
128
|
];
|
|
107
129
|
}
|
|
108
130
|
get size() {
|
|
109
131
|
return this._size;
|
|
110
132
|
}
|
|
111
133
|
set size(e) {
|
|
112
|
-
!
|
|
134
|
+
!u.has(e) || this._size === e || (this._size = e, this.requestUpdate());
|
|
113
135
|
}
|
|
114
136
|
get multiple() {
|
|
115
137
|
return this._multiple;
|
|
@@ -132,6 +154,42 @@ class c extends r {
|
|
|
132
154
|
const t = !!e;
|
|
133
155
|
this._disabled !== t && (this._disabled = t, this.reflectBoolean("disabled", t), this.requestUpdate());
|
|
134
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Accessible name for the inner `<select>`, as `inputLabel` / `input-label`.
|
|
159
|
+
*
|
|
160
|
+
* Named for where it lands rather than what it is: the value is written to the
|
|
161
|
+
* control *inside* the shadow root, not to the host. Plain `label` was rejected
|
|
162
|
+
* because `<option label>` and `<optgroup label>` are literally in play in this
|
|
163
|
+
* component's own markup, so `label` would read as one of those.
|
|
164
|
+
*
|
|
165
|
+
* This is the tier-1 naming path — always available, and the documented fallback
|
|
166
|
+
* where cross-root element references are not. `aria-labelledby` on the host is
|
|
167
|
+
* tier 2 and takes precedence, being a live reference rather than a copied
|
|
168
|
+
* string.
|
|
169
|
+
*/
|
|
170
|
+
get inputLabel() {
|
|
171
|
+
return this._inputLabel;
|
|
172
|
+
}
|
|
173
|
+
set inputLabel(e) {
|
|
174
|
+
const t = e ?? null;
|
|
175
|
+
this._inputLabel !== t && (this._inputLabel = t, this.requestUpdate());
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Validation message, as `errorText` / `error-text`. Rendered as a
|
|
179
|
+
* `.invalid-feedback` node inside the shadow root and referenced from the inner
|
|
180
|
+
* `<select>` by `aria-errormessage` **and** `aria-describedby`, but only while
|
|
181
|
+
* `invalid` is set — `aria-errormessage` is meaningless on a control that is not
|
|
182
|
+
* `aria-invalid`. Text rather than a node, for the same reason `inputLabel`
|
|
183
|
+
* exists: a consumer's own element is outside this shadow root, where an IDREF
|
|
184
|
+
* from the `<select>` cannot reach it.
|
|
185
|
+
*/
|
|
186
|
+
get errorText() {
|
|
187
|
+
return this._errorText;
|
|
188
|
+
}
|
|
189
|
+
set errorText(e) {
|
|
190
|
+
const t = e ?? null;
|
|
191
|
+
this._errorText !== t && (this._errorText = t, this.requestUpdate());
|
|
192
|
+
}
|
|
135
193
|
get value() {
|
|
136
194
|
return this._value;
|
|
137
195
|
}
|
|
@@ -155,7 +213,7 @@ class c extends r {
|
|
|
155
213
|
attributeChangedCallback(e, t, s) {
|
|
156
214
|
switch (super.attributeChangedCallback(e, t, s), e) {
|
|
157
215
|
case "size":
|
|
158
|
-
s &&
|
|
216
|
+
s && u.has(s) && (this._size = s, this.requestUpdate());
|
|
159
217
|
break;
|
|
160
218
|
case "multiple":
|
|
161
219
|
this._multiple = s !== null, this.requestUpdate();
|
|
@@ -166,39 +224,54 @@ class c extends r {
|
|
|
166
224
|
case "disabled":
|
|
167
225
|
this._disabled = s !== null, this.requestUpdate();
|
|
168
226
|
break;
|
|
227
|
+
case "invalid":
|
|
228
|
+
case "required":
|
|
229
|
+
this.requestUpdate();
|
|
230
|
+
break;
|
|
231
|
+
case "error-text":
|
|
232
|
+
this._errorText = s, this.requestUpdate();
|
|
233
|
+
break;
|
|
169
234
|
case "value":
|
|
170
235
|
this._value = s, this.requestUpdate();
|
|
171
236
|
break;
|
|
172
237
|
case "aria-label":
|
|
173
238
|
this.requestUpdate();
|
|
174
239
|
break;
|
|
240
|
+
case "input-label":
|
|
241
|
+
this._inputLabel = s, this.requestUpdate();
|
|
242
|
+
break;
|
|
243
|
+
case "aria-labelledby":
|
|
244
|
+
case "aria-describedby":
|
|
245
|
+
this.hostAria.syncReferences();
|
|
246
|
+
break;
|
|
175
247
|
}
|
|
176
248
|
}
|
|
177
249
|
disconnectedCallback() {
|
|
178
250
|
super.disconnectedCallback(), this._slotObserver?.disconnect(), this._slotObserver = null;
|
|
179
251
|
}
|
|
180
252
|
render() {
|
|
181
|
-
const e = this._options ?? this._slotOptions, t = this._size === "sm" || this._size === "lg" ? `form-select form-select-${this._size}` : "form-select", s = this.getAttribute("aria-label");
|
|
182
|
-
return
|
|
253
|
+
const e = this._options ?? this._slotOptions, t = this._size === "sm" || this._size === "lg" ? `form-select form-select-${this._size}` : "form-select", s = this.getAttribute("aria-label") ?? this._inputLabel, r = g(this._errorId, this._errorText, this.hasAttribute("invalid"));
|
|
254
|
+
return a`
|
|
183
255
|
<select
|
|
184
|
-
${
|
|
256
|
+
${m(this._selectRef)}
|
|
185
257
|
class=${t}
|
|
186
258
|
?multiple=${this._multiple}
|
|
187
259
|
?disabled=${this._disabled}
|
|
188
|
-
size=${
|
|
189
|
-
aria-label=${s ??
|
|
260
|
+
size=${c(this._numberVisible ?? void 0)}
|
|
261
|
+
aria-label=${s ?? l}
|
|
262
|
+
aria-invalid=${this.hasAttribute("invalid") ? "true" : l}
|
|
263
|
+
aria-required=${this.hasAttribute("required") ? "true" : l}
|
|
264
|
+
aria-errormessage=${r.id}
|
|
265
|
+
aria-describedby=${r.id}
|
|
190
266
|
@change=${this.onNativeChange}
|
|
191
267
|
>
|
|
192
268
|
${e.map(
|
|
193
|
-
(i) =>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
?selected=${this.isSelected(i.value)}
|
|
197
|
-
?disabled=${!!i.disabled}
|
|
198
|
-
>${i.label}</option>
|
|
199
|
-
`
|
|
269
|
+
(i) => x(i) ? a`<optgroup label=${i.label} ?disabled=${!!i.disabled}>
|
|
270
|
+
${i.options.map((d) => this.renderOption(d))}
|
|
271
|
+
</optgroup>` : this.renderOption(i)
|
|
200
272
|
)}
|
|
201
273
|
</select>
|
|
274
|
+
${r.node}
|
|
202
275
|
<slot hidden @slotchange=${this.onSlotChange}></slot>
|
|
203
276
|
`;
|
|
204
277
|
}
|
|
@@ -209,13 +282,50 @@ class c extends r {
|
|
|
209
282
|
// with `?selected`.
|
|
210
283
|
updated() {
|
|
211
284
|
const e = this._selectRef.value;
|
|
212
|
-
e && (this._multiple ? Array.from(e.options).forEach((t) => {
|
|
285
|
+
e && (this.hostAria.syncReferences(), this._multiple ? Array.from(e.options).forEach((t) => {
|
|
213
286
|
t.selected = this._values.includes(t.value);
|
|
214
|
-
}) : this._value != null && (e.value = this._value))
|
|
287
|
+
}) : this._value != null && (e.value = this._value), this.syncFormValue(), this.setFormValidity(
|
|
288
|
+
{ valueMissing: this.hasAttribute("required") && this._value == null && this._values.length === 0 },
|
|
289
|
+
"Please select an item."
|
|
290
|
+
));
|
|
291
|
+
}
|
|
292
|
+
renderOption(e) {
|
|
293
|
+
return a`
|
|
294
|
+
<option
|
|
295
|
+
value=${e.value}
|
|
296
|
+
?selected=${this.isSelected(e.value)}
|
|
297
|
+
?disabled=${!!e.disabled}
|
|
298
|
+
>${e.label}</option>
|
|
299
|
+
`;
|
|
215
300
|
}
|
|
216
301
|
isSelected(e) {
|
|
217
302
|
return this._multiple ? this._values.includes(e) : this._value === e;
|
|
218
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Mirror slotted <option>/<optgroup> children. Optgroups previously
|
|
306
|
+
* vanished WITH ALL THEIR OPTIONS (audit Critical): the filter kept only
|
|
307
|
+
* top-level OPTION tags, so anything grouped never reached the shadow
|
|
308
|
+
* <select>.
|
|
309
|
+
*/
|
|
310
|
+
collectSlotItems(e) {
|
|
311
|
+
const t = (s) => ({
|
|
312
|
+
value: s.value,
|
|
313
|
+
label: s.textContent?.trim() ?? "",
|
|
314
|
+
disabled: s.disabled
|
|
315
|
+
});
|
|
316
|
+
return e.flatMap((s) => {
|
|
317
|
+
if (s.tagName === "OPTION") return [t(s)];
|
|
318
|
+
if (s.tagName === "OPTGROUP") {
|
|
319
|
+
const r = s;
|
|
320
|
+
return [{
|
|
321
|
+
label: r.label,
|
|
322
|
+
disabled: r.disabled,
|
|
323
|
+
options: Array.from(r.querySelectorAll("option")).map(t)
|
|
324
|
+
}];
|
|
325
|
+
}
|
|
326
|
+
return [];
|
|
327
|
+
});
|
|
328
|
+
}
|
|
219
329
|
// Slotted `<option>` elements can have their `value` attribute or text
|
|
220
330
|
// content updated dynamically (e.g., the Angular `BsSelectOption`
|
|
221
331
|
// directive sets `value` from `[ngValue]` after the initial render). A
|
|
@@ -236,19 +346,32 @@ class c extends r {
|
|
|
236
346
|
}
|
|
237
347
|
refreshSlotOptions() {
|
|
238
348
|
const e = this.shadowRoot?.querySelector("slot");
|
|
239
|
-
|
|
240
|
-
const t = e.assignedElements({ flatten: !0 });
|
|
241
|
-
this._slotOptions = t.filter((s) => s.tagName === "OPTION").map((s) => ({
|
|
242
|
-
value: s.value,
|
|
243
|
-
label: s.textContent?.trim() ?? "",
|
|
244
|
-
disabled: s.disabled
|
|
245
|
-
})), this.requestUpdate();
|
|
349
|
+
e && (this._slotOptions = this.collectSlotItems(e.assignedElements({ flatten: !0 })), this.requestUpdate());
|
|
246
350
|
}
|
|
247
351
|
reflectBoolean(e, t) {
|
|
248
352
|
t ? this.setAttribute(e, "") : this.removeAttribute(e);
|
|
249
353
|
}
|
|
354
|
+
// ---- form association (FormAssociatedHost, Phase F) ----
|
|
355
|
+
formValue() {
|
|
356
|
+
if (this._multiple) {
|
|
357
|
+
const e = this.getAttribute("name");
|
|
358
|
+
if (!e || this._values.length === 0) return null;
|
|
359
|
+
const t = new FormData();
|
|
360
|
+
return this._values.forEach((s) => t.append(e, s)), t;
|
|
361
|
+
}
|
|
362
|
+
return this._value;
|
|
363
|
+
}
|
|
364
|
+
formReset() {
|
|
365
|
+
this._value = null, this._values = [], this.requestUpdate();
|
|
366
|
+
}
|
|
367
|
+
formRestore(e) {
|
|
368
|
+
typeof e == "string" && (this.value = e);
|
|
369
|
+
}
|
|
370
|
+
formValidityAnchor() {
|
|
371
|
+
return this._selectRef.value ?? null;
|
|
372
|
+
}
|
|
250
373
|
}
|
|
251
|
-
typeof customElements < "u" && !customElements.get("mp-select") && customElements.define("mp-select",
|
|
374
|
+
typeof customElements < "u" && !customElements.get("mp-select") && customElements.define("mp-select", q);
|
|
252
375
|
export {
|
|
253
|
-
|
|
376
|
+
q as M
|
|
254
377
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { unsafeCSS as S, LitElement as A, html as M } from "lit";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import "lit/directives/ref.js";
|
|
3
|
+
import { F as w } from "./focus-restore-DxuP1Oe2.mjs";
|
|
4
|
+
var b = /* @__PURE__ */ ((u) => (u.Idle = "idle", u.Resizing = "resizing", u))(b || {});
|
|
5
|
+
class R {
|
|
4
6
|
constructor(e) {
|
|
5
7
|
this.listeners = /* @__PURE__ */ new Set(), this.state = {
|
|
6
8
|
orientation: "horizontal",
|
|
@@ -63,19 +65,19 @@ class w {
|
|
|
63
65
|
return this.state.resizeOperation?.state === b.Resizing;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
function g(
|
|
67
|
-
const e = "touches" in
|
|
68
|
+
function g(u) {
|
|
69
|
+
const e = "touches" in u;
|
|
68
70
|
let i, t;
|
|
69
71
|
if (e) {
|
|
70
|
-
const s =
|
|
72
|
+
const s = u.touches[0] || u.changedTouches[0];
|
|
71
73
|
i = s.clientX, t = s.clientY;
|
|
72
74
|
} else
|
|
73
|
-
i =
|
|
75
|
+
i = u.clientX, t = u.clientY;
|
|
74
76
|
return {
|
|
75
77
|
clientX: i,
|
|
76
78
|
clientY: t,
|
|
77
79
|
point: { x: i, y: t },
|
|
78
|
-
originalEvent:
|
|
80
|
+
originalEvent: u,
|
|
79
81
|
isTouch: e
|
|
80
82
|
};
|
|
81
83
|
}
|
|
@@ -87,7 +89,7 @@ const E = /* @__PURE__ */ new Set([
|
|
|
87
89
|
"Home",
|
|
88
90
|
"End"
|
|
89
91
|
]);
|
|
90
|
-
class
|
|
92
|
+
class y {
|
|
91
93
|
constructor(e) {
|
|
92
94
|
this.isActive = !1, this.currentDividerIndex = -1, this.currentDividerElement = null, this.callbacks = e, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseUp = this.handleMouseUp.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this);
|
|
93
95
|
}
|
|
@@ -151,17 +153,17 @@ class P {
|
|
|
151
153
|
};
|
|
152
154
|
}
|
|
153
155
|
calculatePreviewSizes(e, i, t) {
|
|
154
|
-
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e,
|
|
155
|
-
let
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
|
|
156
|
+
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, d = t === "horizontal" ? i.x - s.x : i.y - s.y, h = [...n], r = n[a], z = n[o];
|
|
157
|
+
let p = r + d, l = z - d;
|
|
158
|
+
if (p < this.options.minPanelSize) {
|
|
159
|
+
const c = this.options.minPanelSize - p;
|
|
160
|
+
p = this.options.minPanelSize, l -= c;
|
|
159
161
|
}
|
|
160
162
|
if (l < this.options.minPanelSize) {
|
|
161
|
-
const
|
|
162
|
-
l = this.options.minPanelSize,
|
|
163
|
+
const c = this.options.minPanelSize - l;
|
|
164
|
+
l = this.options.minPanelSize, p -= c;
|
|
163
165
|
}
|
|
164
|
-
return
|
|
166
|
+
return p = Math.max(p, this.options.minPanelSize), l = Math.max(l, this.options.minPanelSize), h[a] = p, h[o] = l, h;
|
|
165
167
|
}
|
|
166
168
|
setMinPanelSize(e) {
|
|
167
169
|
this.options.minPanelSize = e;
|
|
@@ -170,7 +172,7 @@ class P {
|
|
|
170
172
|
return this.options.minPanelSize;
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
|
-
const
|
|
175
|
+
const L = S(`:host {
|
|
174
176
|
display: block;
|
|
175
177
|
width: 100%;
|
|
176
178
|
height: 100%;
|
|
@@ -312,10 +314,13 @@ const y = S(`:host {
|
|
|
312
314
|
transition: none !important;
|
|
313
315
|
}
|
|
314
316
|
}`);
|
|
315
|
-
let
|
|
316
|
-
class
|
|
317
|
+
let O = 0;
|
|
318
|
+
class C extends A {
|
|
317
319
|
constructor() {
|
|
318
|
-
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++
|
|
320
|
+
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++O}`, this.dividerFocusRestore = new w(() => this.shadowRoot, {
|
|
321
|
+
selector: ".divider",
|
|
322
|
+
keyOf: (e) => e.dataset.key ?? null
|
|
323
|
+
}), this.stateManager = new R(), this.resizeManager = new P(), this.inputHandler = new y({
|
|
319
324
|
onResizeStart: this.handleResizeStart.bind(this),
|
|
320
325
|
onResizeMove: this.handleResizeMove.bind(this),
|
|
321
326
|
onResizeEnd: this.handleResizeEnd.bind(this),
|
|
@@ -323,7 +328,7 @@ class O extends A {
|
|
|
323
328
|
});
|
|
324
329
|
}
|
|
325
330
|
static {
|
|
326
|
-
this.styles = [
|
|
331
|
+
this.styles = [L];
|
|
327
332
|
}
|
|
328
333
|
static get observedAttributes() {
|
|
329
334
|
return [
|
|
@@ -434,10 +439,12 @@ class O extends A {
|
|
|
434
439
|
if (s <= 0) return;
|
|
435
440
|
const n = this.resizeManager.getMinPanelSize();
|
|
436
441
|
this.dividers.forEach((a, o) => {
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
439
|
-
const r = Math.round(
|
|
442
|
+
const d = i[o], h = i[o + 1];
|
|
443
|
+
if (d === void 0 || h === void 0) return;
|
|
444
|
+
const r = Math.round(d / s * 100), z = Math.round(n / s * 100), p = d + h, l = Math.round((p - n) / s * 100);
|
|
440
445
|
a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(z)), a.setAttribute("aria-valuemax", String(l));
|
|
446
|
+
const c = Math.round(h / s * 100);
|
|
447
|
+
a.setAttribute("aria-valuetext", r + "% / " + c + "%");
|
|
441
448
|
});
|
|
442
449
|
}
|
|
443
450
|
updatePanelsFromSlot() {
|
|
@@ -446,15 +453,15 @@ class O extends A {
|
|
|
446
453
|
(n) => n instanceof HTMLElement
|
|
447
454
|
);
|
|
448
455
|
if (e.length === 0) return;
|
|
449
|
-
this.container.innerHTML = "", this.panelWrappers = [], this.dividers = [];
|
|
456
|
+
this.dividerFocusRestore.capture(), this.container.innerHTML = "", this.panelWrappers = [], this.dividers = [];
|
|
450
457
|
const i = e.length, t = this.orientation === "horizontal" ? "vertical" : "horizontal";
|
|
451
458
|
e.forEach((n, a) => {
|
|
452
459
|
const o = document.createElement("div");
|
|
453
460
|
o.className = "panel-wrapper flex-grow", o.id = `${this.instanceId}-panel-${a}`;
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
461
|
+
const d = document.createElement("slot"), h = `panel-${a}`;
|
|
462
|
+
if (d.name = h, n.slot = h, o.appendChild(d), this.panelWrappers.push(o), this.container.appendChild(o), a < i - 1) {
|
|
456
463
|
const r = document.createElement("div");
|
|
457
|
-
r.className = "divider", r.setAttribute("role", "separator"), r.setAttribute("aria-orientation", t), r.setAttribute("tabindex", "0"), r.setAttribute(
|
|
464
|
+
r.className = "divider", r.dataset.key = `divider-${a}`, r.setAttribute("role", "separator"), r.setAttribute("aria-orientation", t), r.setAttribute("tabindex", "0"), r.setAttribute(
|
|
458
465
|
"aria-controls",
|
|
459
466
|
`${this.instanceId}-panel-${a} ${this.instanceId}-panel-${a + 1}`
|
|
460
467
|
), r.setAttribute(
|
|
@@ -462,7 +469,7 @@ class O extends A {
|
|
|
462
469
|
`Resize between panel ${a + 1} and panel ${a + 2}`
|
|
463
470
|
), this.inputHandler.attachDividerListeners(r, a), this.dividers.push(r), this.container.appendChild(r);
|
|
464
471
|
}
|
|
465
|
-
});
|
|
472
|
+
}), this.dividerFocusRestore.restore();
|
|
466
473
|
const s = this.stateManager.getState().panelSizes;
|
|
467
474
|
if (s.length > 0 && s.length === this.panelWrappers.length) {
|
|
468
475
|
this.applyPanelSizes(s), requestAnimationFrame(() => this.handleContainerResize());
|
|
@@ -510,15 +517,15 @@ class O extends A {
|
|
|
510
517
|
const i = this.container.getBoundingClientRect(), t = this.orientation === "horizontal" ? i.width : i.height;
|
|
511
518
|
if (t <= 0) return;
|
|
512
519
|
const s = this.orientation === "horizontal" ? "width" : "height", n = this.dividers.reduce(
|
|
513
|
-
(l,
|
|
520
|
+
(l, c) => l + c.getBoundingClientRect()[s],
|
|
514
521
|
0
|
|
515
|
-
), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom",
|
|
516
|
-
const m = getComputedStyle(
|
|
522
|
+
), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom", d = this.panelWrappers.reduce((l, c) => {
|
|
523
|
+
const m = getComputedStyle(c);
|
|
517
524
|
return l + parseFloat(m[a]) + parseFloat(m[o]);
|
|
518
|
-
}, 0), h = Math.max(0, t - n -
|
|
525
|
+
}, 0), h = Math.max(0, t - n - d), r = e.reduce((l, c) => l + c, 0);
|
|
519
526
|
if (r <= 0 || Math.abs(h - r) < 1) return;
|
|
520
|
-
const z = h / r,
|
|
521
|
-
this.applyPanelSizes(
|
|
527
|
+
const z = h / r, p = e.map((l) => l * z);
|
|
528
|
+
this.applyPanelSizes(p), this.stateManager.setPanelSizes(p), this.updateDividerAriaValues();
|
|
522
529
|
}
|
|
523
530
|
updateContainerOrientation() {
|
|
524
531
|
if (!this.container) return;
|
|
@@ -592,18 +599,18 @@ class O extends A {
|
|
|
592
599
|
if (n.length !== this.panelWrappers.length) return;
|
|
593
600
|
const a = n[t], o = n[t + 1];
|
|
594
601
|
if (a === void 0 || o === void 0) return;
|
|
595
|
-
const
|
|
602
|
+
const d = this.container.getBoundingClientRect(), h = this.orientation === "horizontal" ? d.width : d.height;
|
|
596
603
|
if (h <= 0) return;
|
|
597
|
-
const r = this.resizeManager.getMinPanelSize(), z = this.orientation === "horizontal",
|
|
598
|
-
let
|
|
599
|
-
e ===
|
|
604
|
+
const r = this.resizeManager.getMinPanelSize(), z = this.orientation === "horizontal", p = z ? "ArrowRight" : "ArrowDown", l = z ? "ArrowLeft" : "ArrowUp";
|
|
605
|
+
let c = 0;
|
|
606
|
+
e === p ? c = 1 : e === l && (c = -1);
|
|
600
607
|
let m, v;
|
|
601
608
|
if (e === "Home")
|
|
602
609
|
m = r, v = a + o - r;
|
|
603
610
|
else if (e === "End")
|
|
604
611
|
m = a + o - r, v = r;
|
|
605
|
-
else if (
|
|
606
|
-
const f = (i ? 1 : 10) / 100 * h *
|
|
612
|
+
else if (c !== 0) {
|
|
613
|
+
const f = (i ? 1 : 10) / 100 * h * c;
|
|
607
614
|
m = a + f, v = o - f, m < r ? (m = r, v = a + o - r) : v < r && (v = r, m = a + o - r);
|
|
608
615
|
} else
|
|
609
616
|
return;
|
|
@@ -621,13 +628,13 @@ class O extends A {
|
|
|
621
628
|
});
|
|
622
629
|
}
|
|
623
630
|
}
|
|
624
|
-
typeof customElements < "u" && !customElements.get("mp-splitter") && customElements.define("mp-splitter",
|
|
631
|
+
typeof customElements < "u" && !customElements.get("mp-splitter") && customElements.define("mp-splitter", C);
|
|
625
632
|
export {
|
|
626
|
-
|
|
627
|
-
|
|
633
|
+
y as I,
|
|
634
|
+
C as M,
|
|
628
635
|
P as R,
|
|
629
|
-
|
|
636
|
+
R as S,
|
|
630
637
|
b as a,
|
|
631
638
|
g as n,
|
|
632
|
-
|
|
639
|
+
L as s
|
|
633
640
|
};
|