@mintplayer/web-components 2.16.0 → 2.17.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/accordion/index.mjs +5 -5
- package/calendar/index.mjs +1 -1
- package/carousel/index.mjs +57 -143
- package/charts/core/index.mjs +30 -20
- package/charts/core/src/attributes.d.ts +18 -0
- package/charts/core/src/index.d.ts +2 -0
- package/charts/core/src/view-window.d.ts +46 -0
- package/charts/hierarchy/index.mjs +245 -256
- package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
- package/charts/sparkline/index.mjs +27 -26
- package/charts/trend/index.mjs +21 -20
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +1 -0
- package/chunks/attributes-L3eKsbdy.mjs +16 -0
- package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
- package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
- package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
- package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
- package/chunks/{mp-datatable-B7st6G-I.mjs → mp-datatable-eRpl7-2V.mjs} +173 -173
- package/chunks/{mp-datetime-picker.element-DsWA1AFs.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
- package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
- package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
- package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
- package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
- package/chunks/{mp-timepicker.element-CwaAAOcm.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
- package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
- package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
- package/chunks/{overlay-controller-DifgO6jT.mjs → overlay-controller-BHDagokg.mjs} +96 -92
- package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
- package/chunks/view-window-DGvFiDnW.mjs +263 -0
- package/code-snippet/index.mjs +70 -66
- package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
- package/custom-elements.json +65750 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/column-resize.d.ts +11 -0
- package/datatable/src/components/mp-datatable.d.ts +5 -0
- package/datepicker/index.mjs +10 -9
- package/datetime-picker/index.mjs +1 -1
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
- package/dock/index.mjs +430 -463
- package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
- package/dock/src/core/resize.d.ts +60 -0
- package/dropdown-menu/index.mjs +4 -2
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
- package/dropdown-menu/src/index.d.ts +1 -1
- package/dropdown-menu/src/types/dropdown.d.ts +14 -1
- package/dropdown-menu/src/types/index.d.ts +1 -1
- package/file-manager/index.mjs +63 -61
- package/file-manager/src/components/mp-file-manager.d.ts +4 -3
- package/multi-range/index.mjs +56 -50
- package/multi-range/src/mint-multi-range.element.d.ts +4 -10
- package/multi-range/src/pointer-geometry.d.ts +31 -0
- package/navbar/index.mjs +89 -439
- package/overlay/index.mjs +1 -1
- package/overlay/src/overlay-controller.d.ts +0 -14
- package/overlay/src/placement.d.ts +48 -0
- package/package.json +7 -1
- package/pagination/index.mjs +1 -1
- package/phone-input/index.mjs +44 -40
- package/phone-input/src/components/stack.d.ts +8 -0
- package/query-builder/index.mjs +418 -466
- package/query-builder/src/dnd/drag-controller.d.ts +12 -8
- package/query-builder/src/mp-query-builder.element.d.ts +5 -1
- package/query-builder/src/mp-query-condition.element.d.ts +1 -0
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +1 -1
- package/ribbon/index.mjs +477 -498
- package/ribbon/src/core/band-text-color.d.ts +10 -0
- package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
- package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
- package/ribbon/src/mp-ribbon.element.d.ts +0 -27
- package/scheduler/index.mjs +726 -711
- package/scheduler/src/components/mp-scheduler.d.ts +19 -3
- package/scheduler/src/drag/drag-manager.d.ts +1 -9
- package/scheduler/src/input/input-handler.d.ts +12 -2
- package/scheduler/src/utils/geometry.d.ts +39 -0
- package/scheduler/src/views/timeline-view.d.ts +0 -1
- package/scheduler-core/index.mjs +84 -71
- package/scheduler-core/src/services/resource.service.d.ts +0 -12
- package/scheduler-core/src/services/timeline.service.d.ts +0 -9
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +1 -0
- package/signature-pad/index.mjs +21 -23
- package/signature-pad/src/canvas-point.d.ts +26 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +16 -0
- package/splitter/src/managers/index.d.ts +1 -0
- package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
- package/swiper-core/index.mjs +2 -2
- package/theming/bs-theme-preboot.js +1 -0
- package/theming/color-mode.css +36 -0
- package/theming/index.d.ts +1 -0
- package/theming/index.mjs +327 -0
- package/theming/src/components/mp-theme-toggle.d.ts +71 -0
- package/theming/src/cookie.d.ts +31 -0
- package/theming/src/index.d.ts +5 -0
- package/theming/src/preboot.d.ts +1 -0
- package/theming/src/resolve.d.ts +36 -0
- package/theming/src/store.d.ts +27 -0
- package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
- package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
- package/theming/src/toggle-modes.d.ts +23 -0
- package/tile-manager/index.mjs +252 -211
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
- package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
- package/timeline/index.mjs +156 -164
- package/timeline/src/components/mp-timeline.d.ts +41 -7
- package/timepicker/index.mjs +7 -4
- package/timepicker/src/mp-time-list.element.d.ts +26 -0
- package/timepicker/src/mp-timepicker.element.d.ts +3 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +21 -9
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +6 -4
- package/chunks/color-DIeST-IS.mjs +0 -224
- package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
package/overlay/index.mjs
CHANGED
|
@@ -248,8 +248,6 @@ export declare class OverlayController implements ReactiveController {
|
|
|
248
248
|
* anchor re-enters the viewport.
|
|
249
249
|
*/
|
|
250
250
|
position(): void;
|
|
251
|
-
/** True when the anchor's bounding rect lies entirely outside the viewport. */
|
|
252
|
-
private isAnchorOffscreen;
|
|
253
251
|
/**
|
|
254
252
|
* Apply the configured `panelWidth` strategy to the panel element. Called
|
|
255
253
|
* from `position()` before measurement so the position-pair fit check
|
|
@@ -261,18 +259,6 @@ export declare class OverlayController implements ReactiveController {
|
|
|
261
259
|
*/
|
|
262
260
|
private applyPanelWidth;
|
|
263
261
|
private isRtl;
|
|
264
|
-
/**
|
|
265
|
-
* Compute the (left, top) at which `panel` should be placed for a single
|
|
266
|
-
* position candidate. The candidate identifies which corner of the anchor
|
|
267
|
-
* to align which corner of the panel to, plus optional pixel offsets.
|
|
268
|
-
*/
|
|
269
|
-
private placeFor;
|
|
270
|
-
private anchorXFor;
|
|
271
|
-
private anchorYFor;
|
|
272
|
-
private panelXOffsetFor;
|
|
273
|
-
private panelYOffsetFor;
|
|
274
|
-
private fitsInViewport;
|
|
275
|
-
private clampToViewport;
|
|
276
262
|
private currentStrategy;
|
|
277
263
|
/**
|
|
278
264
|
* Wire scroll + resize listeners according to the active strategy. Called
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { OverlayPosition } from './overlay-controller';
|
|
2
|
+
/** The parts of an anchor's bounding rect the placement reads. */
|
|
3
|
+
export interface AnchorBox {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PanelSize {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Viewport {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
/** Minimum distance kept between the panel and every viewport edge. */
|
|
19
|
+
margin: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Placement {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The (left, top) that aligns the candidate's panel corner with its anchor
|
|
27
|
+
* corner, plus the candidate's pixel offsets.
|
|
28
|
+
*/
|
|
29
|
+
export declare function placeFor(candidate: OverlayPosition, anchor: AnchorBox, panel: PanelSize, rtl: boolean): Placement;
|
|
30
|
+
/** True when the placed panel lies wholly inside the viewport's margins. */
|
|
31
|
+
export declare function fitsInViewport(placed: Placement, panel: PanelSize, viewport: Viewport): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Push a placement back inside the viewport's margins. A panel larger than
|
|
34
|
+
* the viewport pins to the start (top/left) margin.
|
|
35
|
+
*/
|
|
36
|
+
export declare function clampToViewport(placed: Placement, panel: PanelSize, viewport: Viewport): Placement;
|
|
37
|
+
/** True when the anchor's rect lies entirely outside the viewport. */
|
|
38
|
+
export declare function isAnchorOffscreen(rect: AnchorBox, viewport: Pick<Viewport, 'width' | 'height'>): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Walk (anchor x position) pairs in order and take the first placement that
|
|
41
|
+
* fits the viewport. When none fits, the last pair evaluated is the fallback.
|
|
42
|
+
* Either way the placement is clamped into the viewport. Null when there are
|
|
43
|
+
* no anchors or no positions to try.
|
|
44
|
+
*/
|
|
45
|
+
export declare function choosePlacement(anchors: readonly AnchorBox[], positions: readonly OverlayPosition[], panel: PanelSize, viewport: Viewport, rtl: boolean): {
|
|
46
|
+
anchorIndex: number;
|
|
47
|
+
placement: Placement;
|
|
48
|
+
} | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"./custom-elements.json": "./custom-elements.json",
|
|
27
27
|
"./package.json": "./package.json",
|
|
28
|
+
"./theming/bs-theme-preboot.js": "./theming/bs-theme-preboot.js",
|
|
29
|
+
"./theming/color-mode.css": "./theming/color-mode.css",
|
|
28
30
|
"./a11y": {
|
|
29
31
|
"types": "./a11y/index.d.ts",
|
|
30
32
|
"import": "./a11y/index.mjs"
|
|
@@ -181,6 +183,10 @@
|
|
|
181
183
|
"types": "./tab-control/index.d.ts",
|
|
182
184
|
"import": "./tab-control/index.mjs"
|
|
183
185
|
},
|
|
186
|
+
"./theming": {
|
|
187
|
+
"types": "./theming/index.d.ts",
|
|
188
|
+
"import": "./theming/index.mjs"
|
|
189
|
+
},
|
|
184
190
|
"./tile-manager": {
|
|
185
191
|
"types": "./tile-manager/index.d.ts",
|
|
186
192
|
"import": "./tile-manager/index.mjs"
|
package/pagination/index.mjs
CHANGED
package/phone-input/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { unsafeCSS as b, LitElement as p, nothing as h, html as v } from "lit";
|
|
|
2
2
|
import { createRef as f, ref as m } from "lit/directives/ref.js";
|
|
3
3
|
import { unsafeHTML as C } from "lit/directives/unsafe-html.js";
|
|
4
4
|
import "../chunks/mp-input-group-CQ55efCq.mjs";
|
|
5
|
-
import "../chunks/mp-select-
|
|
5
|
+
import "../chunks/mp-select-CgqYFvUj.mjs";
|
|
6
6
|
import { c as g, b as $, l as k } from "../chunks/validation-ChktfuxI.mjs";
|
|
7
7
|
import { l as R } from "../chunks/all-flags-BtYcfgjy.mjs";
|
|
8
|
-
import { H as
|
|
9
|
-
import { a as
|
|
8
|
+
import { H as q } from "../chunks/host-aria-WSGs7SPQ.mjs";
|
|
9
|
+
import { a as w, e as L } from "../chunks/error-text-B45eDAt1.mjs";
|
|
10
10
|
import { F as U } from "../chunks/form-associated-BR-fUvZ1.mjs";
|
|
11
11
|
import { f as A } from "../chunks/form-control.styles-C3j87Sn3.mjs";
|
|
12
12
|
import { i as S } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
|
|
@@ -68,41 +68,45 @@ mp-select[rich] ~ .addon .flag {
|
|
|
68
68
|
--mp-group-radius-bottom-end: 0;
|
|
69
69
|
}
|
|
70
70
|
}`), c = /\d/;
|
|
71
|
-
function _(
|
|
71
|
+
function _(o, t) {
|
|
72
72
|
let e = 0;
|
|
73
|
-
const s = Math.min(t,
|
|
74
|
-
for (let i = 0; i < s; i++) c.test(
|
|
73
|
+
const s = Math.min(t, o.length);
|
|
74
|
+
for (let i = 0; i < s; i++) c.test(o[i]) && e++;
|
|
75
75
|
return e;
|
|
76
76
|
}
|
|
77
|
-
function O(
|
|
77
|
+
function O(o, t) {
|
|
78
78
|
if (t <= 0) return 0;
|
|
79
79
|
let e = 0;
|
|
80
|
-
for (let s = 0; s <
|
|
81
|
-
if (c.test(
|
|
80
|
+
for (let s = 0; s < o.length; s++)
|
|
81
|
+
if (c.test(o[s]) && (e++, e === t))
|
|
82
82
|
return s + 1;
|
|
83
|
-
return
|
|
83
|
+
return o.length;
|
|
84
84
|
}
|
|
85
|
-
function x(
|
|
85
|
+
function x(o, t, e) {
|
|
86
86
|
let s = e === -1 ? t - 1 : t;
|
|
87
|
-
for (; s >= 0 && s <
|
|
88
|
-
if (c.test(
|
|
87
|
+
for (; s >= 0 && s < o.length; ) {
|
|
88
|
+
if (c.test(o[s])) return s;
|
|
89
89
|
s += e;
|
|
90
90
|
}
|
|
91
91
|
return -1;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
93
|
+
function a(o) {
|
|
94
|
+
return o.replace(/\D/g, "");
|
|
95
|
+
}
|
|
96
|
+
const T = 352;
|
|
97
|
+
function P(o) {
|
|
98
|
+
return o > 0 && o <= T;
|
|
95
99
|
}
|
|
96
100
|
let y = 0;
|
|
97
|
-
const
|
|
101
|
+
const I = (o) => o.replace(/[&<>"']/g, (t) => `&#${t.charCodeAt(0)};`);
|
|
98
102
|
class d extends U(p) {
|
|
99
103
|
constructor() {
|
|
100
|
-
super(...arguments), this._country = null, this._digits = "", this._rulesWanted = !1, this._rulesPending = Promise.resolve(), this._locale = null, this._preferred = [], this._only = null, this._placeholder = null, this._autocomplete = "tel-national", this._inputLabel = null, this._countryLabel = null, this._errorText = null, this._errorId = `mp-phone-input-${++y}-error`, this._dialId = `mp-phone-input-${y}-dial`, this._list = [], this._listKey = "", this._flagsRequested = !1, this._composing = !1, this._preEdit = null, this._inputRef = f(), this._selectRef = f(), this.hostAria = new
|
|
104
|
+
super(...arguments), this._country = null, this._digits = "", this._rulesWanted = !1, this._rulesPending = Promise.resolve(), this._locale = null, this._preferred = [], this._only = null, this._placeholder = null, this._autocomplete = "tel-national", this._inputLabel = null, this._countryLabel = null, this._errorText = null, this._errorId = `mp-phone-input-${++y}-error`, this._dialId = `mp-phone-input-${y}-dial`, this._list = [], this._listKey = "", this._flagsRequested = !1, this._composing = !1, this._preEdit = null, this._inputRef = f(), this._selectRef = f(), this.hostAria = new q(this, {
|
|
101
105
|
referenceTarget: () => this._inputRef.value ?? null,
|
|
102
|
-
describedByExtras: () =>
|
|
106
|
+
describedByExtras: () => w(this.renderRoot)
|
|
103
107
|
}), this.renderCountryOption = (t) => {
|
|
104
108
|
const e = this.countryList().find((i) => i.iso2 === t.value);
|
|
105
|
-
return e ? `<span class="flag-box" aria-hidden="true">${this._flags?.[e.iso2] ?? ""}</span><span class="rich-label" data-list-only>${
|
|
109
|
+
return e ? `<span class="flag-box" aria-hidden="true">${this._flags?.[e.iso2] ?? ""}</span><span class="rich-label" data-list-only>${I(e.name)}</span><span data-list-only>+${e.dialCode}</span><span data-closed-only>${e.iso2.toUpperCase()}</span>` : void 0;
|
|
106
110
|
}, this.onCountryPicked = (t) => {
|
|
107
111
|
t.stopPropagation();
|
|
108
112
|
const e = t.detail.value;
|
|
@@ -122,12 +126,12 @@ class d extends U(p) {
|
|
|
122
126
|
if (t.key !== "Backspace" && t.key !== "Delete") return;
|
|
123
127
|
const e = this._inputRef.value;
|
|
124
128
|
if (!e || e.selectionStart !== e.selectionEnd) return;
|
|
125
|
-
const s = e.selectionStart ?? 0, i = t.key === "Backspace" ? -1 : 1,
|
|
126
|
-
if (
|
|
129
|
+
const s = e.selectionStart ?? 0, i = t.key === "Backspace" ? -1 : 1, n = i === -1 ? e.value[s - 1] : e.value[s];
|
|
130
|
+
if (n === void 0 || /\d/.test(n)) return;
|
|
127
131
|
t.preventDefault();
|
|
128
132
|
const r = x(e.value, s, i);
|
|
129
133
|
if (r === -1) return;
|
|
130
|
-
const l = _(e.value, r), u =
|
|
134
|
+
const l = _(e.value, r), u = a(e.value);
|
|
131
135
|
this.#i(e, u.slice(0, l) + u.slice(l + 1), l);
|
|
132
136
|
}, this.onInput = () => {
|
|
133
137
|
const t = this._inputRef.value;
|
|
@@ -185,7 +189,7 @@ class d extends U(p) {
|
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
191
|
const s = g(e, this._only ?? void 0);
|
|
188
|
-
s ? (this._digits = s.nationalNumber, this.#t(s.country.iso2, { fromUser: !1 })) : this._digits =
|
|
192
|
+
s ? (this._digits = s.nationalNumber, this.#t(s.country.iso2, { fromUser: !1 })) : this._digits = a(e), this._digits && this.#e(), this.requestUpdate();
|
|
189
193
|
}
|
|
190
194
|
get dialCode() {
|
|
191
195
|
return this.countryList().find((t) => t.iso2 === this.country)?.dialCode ?? "";
|
|
@@ -322,8 +326,8 @@ class d extends U(p) {
|
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
328
|
connectedCallback() {
|
|
325
|
-
super.connectedCallback(), this.#
|
|
326
|
-
const e = t[t.length - 1]?.contentRect.width ?? 0, s = e
|
|
329
|
+
super.connectedCallback(), this.#a(), this._digits && this.#e(), typeof ResizeObserver < "u" && (this.#s ??= new ResizeObserver((t) => {
|
|
330
|
+
const e = t[t.length - 1]?.contentRect.width ?? 0, s = P(e);
|
|
327
331
|
this.renderRoot?.querySelector("mp-input-group")?.toggleAttribute("stacked", s);
|
|
328
332
|
}), this.#s.observe(this));
|
|
329
333
|
}
|
|
@@ -332,7 +336,7 @@ class d extends U(p) {
|
|
|
332
336
|
}
|
|
333
337
|
// ---- rendering ------------------------------------------------------------
|
|
334
338
|
render() {
|
|
335
|
-
const t = this.country, e = this.dialCode, s = this.effectiveDisabled, i = this.hasAttribute("invalid"),
|
|
339
|
+
const t = this.country, e = this.dialCode, s = this.effectiveDisabled, i = this.hasAttribute("invalid"), n = L(this._errorId, this._errorText, i), r = typeof n.id == "string" ? `${this._dialId} ${n.id}` : this._dialId, l = this.getAttribute("aria-label") ?? this._inputLabel ?? "Phone number", u = this._flags?.[t];
|
|
336
340
|
return v`
|
|
337
341
|
<mp-input-group>
|
|
338
342
|
<mp-select
|
|
@@ -370,7 +374,7 @@ class d extends U(p) {
|
|
|
370
374
|
aria-label=${l}
|
|
371
375
|
aria-invalid=${i ? "true" : h}
|
|
372
376
|
aria-required=${this.hasAttribute("required") ? "true" : h}
|
|
373
|
-
aria-errormessage=${
|
|
377
|
+
aria-errormessage=${n.id}
|
|
374
378
|
aria-describedby=${r}
|
|
375
379
|
@beforeinput=${this.onBeforeInput}
|
|
376
380
|
@keydown=${this.onKeydown}
|
|
@@ -380,7 +384,7 @@ class d extends U(p) {
|
|
|
380
384
|
@compositionend=${this.onCompositionEnd}
|
|
381
385
|
/>
|
|
382
386
|
</mp-input-group>
|
|
383
|
-
${
|
|
387
|
+
${n.node}
|
|
384
388
|
`;
|
|
385
389
|
}
|
|
386
390
|
updated() {
|
|
@@ -418,7 +422,7 @@ class d extends U(p) {
|
|
|
418
422
|
}
|
|
419
423
|
// ---- country + rules ------------------------------------------------------
|
|
420
424
|
#t(t, { fromUser: e }) {
|
|
421
|
-
!t || t === this._country || (this._country = t, this.getAttribute("country") !== t && this.setAttribute("country", t), this._rules = this._rules?.country === t ? this._rules : void 0, this._rulesWanted && this.#
|
|
425
|
+
!t || t === this._country || (this._country = t, this.getAttribute("country") !== t && this.setAttribute("country", t), this._rules = this._rules?.country === t ? this._rules : void 0, this._rulesWanted && this.#n(t), this.#a(), e && this.dispatchEvent(
|
|
422
426
|
new CustomEvent("country-change", {
|
|
423
427
|
detail: { country: t, dialCode: this.dialCode },
|
|
424
428
|
bubbles: !0,
|
|
@@ -427,7 +431,7 @@ class d extends U(p) {
|
|
|
427
431
|
), this.requestUpdate());
|
|
428
432
|
}
|
|
429
433
|
#e() {
|
|
430
|
-
this._rulesWanted || (this._rulesWanted = !0, this.#
|
|
434
|
+
this._rulesWanted || (this._rulesWanted = !0, this.#n(this.country));
|
|
431
435
|
}
|
|
432
436
|
/**
|
|
433
437
|
* `valid` is `undefined` until the selected country's rules have loaded, and
|
|
@@ -443,7 +447,7 @@ class d extends U(p) {
|
|
|
443
447
|
* see `getUpdateComplete`. Without an observable settle, the only way to
|
|
444
448
|
* wait for rules is to guess a timeout, which is what made D17 flaky.
|
|
445
449
|
*/
|
|
446
|
-
#
|
|
450
|
+
#n(t) {
|
|
447
451
|
this._rulesPending = k(t).then((e) => {
|
|
448
452
|
!e || this.country !== t || (this._rules = e, this.requestUpdate(), this.#r());
|
|
449
453
|
});
|
|
@@ -459,7 +463,7 @@ class d extends U(p) {
|
|
|
459
463
|
* one resolution, so a single `requestUpdate()` renders the addon flag and all
|
|
460
464
|
* 244 options together — no partial-fill pass, and no re-render per flag.
|
|
461
465
|
*/
|
|
462
|
-
#
|
|
466
|
+
#a() {
|
|
463
467
|
this._flagsRequested || (this._flagsRequested = !0, R().then((t) => {
|
|
464
468
|
this._flags = t, this.requestUpdate();
|
|
465
469
|
}));
|
|
@@ -467,28 +471,28 @@ class d extends U(p) {
|
|
|
467
471
|
#l(t, e, s) {
|
|
468
472
|
const i = g(e, this._only ?? void 0);
|
|
469
473
|
if (i) {
|
|
470
|
-
i.dialCode !== this.dialCode && this.#t(i.country.iso2, { fromUser: !0 }), this.#e(), this.#i(t, i.nationalNumber,
|
|
474
|
+
i.dialCode !== this.dialCode && this.#t(i.country.iso2, { fromUser: !0 }), this.#e(), this.#i(t, i.nationalNumber, a(i.nationalNumber).length);
|
|
471
475
|
return;
|
|
472
476
|
}
|
|
473
|
-
const
|
|
474
|
-
if (r &&
|
|
477
|
+
const n = a(e), r = this._preEdit;
|
|
478
|
+
if (r && n === a(r.value) && e !== r.value) {
|
|
475
479
|
t.value = r.value, t.setSelectionRange(r.start, r.start);
|
|
476
480
|
return;
|
|
477
481
|
}
|
|
478
|
-
if (r && this._rules &&
|
|
479
|
-
const l = this.formatted(
|
|
482
|
+
if (r && this._rules && n.length === a(r.value).length + 1 && this._rules.lengthProblem(n) === "TOO_LONG" && this._rules.lengthProblem(a(r.value)) !== "TOO_LONG") {
|
|
483
|
+
const l = this.formatted(a(r.value));
|
|
480
484
|
t.value = l, t.setSelectionRange(r.start, r.start);
|
|
481
485
|
return;
|
|
482
486
|
}
|
|
483
|
-
this.#i(t,
|
|
487
|
+
this.#i(t, n, _(e, s));
|
|
484
488
|
}
|
|
485
489
|
/** Rule 1: place the caret after the same DIGIT COUNT in the new formatting. */
|
|
486
490
|
#i(t, e, s) {
|
|
487
491
|
this._digits = e;
|
|
488
492
|
const i = this.formatted(e);
|
|
489
493
|
t.value = i;
|
|
490
|
-
const
|
|
491
|
-
t.setSelectionRange(
|
|
494
|
+
const n = O(i, s);
|
|
495
|
+
t.setSelectionRange(n, n), this._preEdit = { value: i, start: n }, this.requestUpdate(), this.#r();
|
|
492
496
|
}
|
|
493
497
|
#r() {
|
|
494
498
|
this.dispatchEvent(
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Matches the `@container (max-width: 22rem)` threshold in the stylesheet. */
|
|
2
|
+
export declare const STACK_THRESHOLD_PX = 352;
|
|
3
|
+
/**
|
|
4
|
+
* Whether the input group should pair its corners vertically at this host
|
|
5
|
+
* width. A width of 0 means "not measured yet" (no layout, a detached host,
|
|
6
|
+
* jsdom), not "narrow", so it never stacks.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isStackedWidth(width: number): boolean;
|