@mintplayer/web-components 2.9.0 → 2.10.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { unsafeCSS as i, LitElement as
|
|
2
|
-
const
|
|
1
|
+
import { unsafeCSS as i, LitElement as s, html as a } from "lit";
|
|
2
|
+
const d = i(`:host {
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
5
5
|
|
|
@@ -61,10 +61,10 @@ slot {
|
|
|
61
61
|
--mp-group-radius-end: 0;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
::slotted(
|
|
65
|
-
::slotted(mp-phone-input) {
|
|
64
|
+
::slotted(:not(.addon):not([data-addon]):not(button):not(span):not(label)) {
|
|
66
65
|
flex: 1 1 auto;
|
|
67
|
-
|
|
66
|
+
width: 1%;
|
|
67
|
+
min-width: var(--mp-group-min-item-width, 6rem);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
::slotted(:focus),
|
|
@@ -101,6 +101,7 @@ slot {
|
|
|
101
101
|
white-space: nowrap;
|
|
102
102
|
background-color: var(--bs-tertiary-bg);
|
|
103
103
|
border: var(--bs-border-width) solid var(--bs-border-color);
|
|
104
|
+
border-radius: var(--bs-border-radius);
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
:host([stacked]:dir(ltr)) ::slotted(.addon:not(:last-child)) {
|
|
@@ -133,10 +134,10 @@ slot {
|
|
|
133
134
|
border-top-right-radius: 0 !important;
|
|
134
135
|
border-bottom-left-radius: var(--bs-border-radius) !important;
|
|
135
136
|
border-bottom-right-radius: var(--bs-border-radius) !important;
|
|
136
|
-
}`),
|
|
137
|
-
class
|
|
137
|
+
}`), n = /* @__PURE__ */ new Set(["sm", "lg"]);
|
|
138
|
+
class e extends s {
|
|
138
139
|
static {
|
|
139
|
-
this.styles =
|
|
140
|
+
this.styles = d;
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
142
143
|
* Deliberately NOT `delegatesFocus`. Measured in spike S5: it changes neither
|
|
@@ -159,14 +160,14 @@ class l extends o {
|
|
|
159
160
|
set size(t) {
|
|
160
161
|
t === "md" ? this.removeAttribute("size") : this.setAttribute("size", t);
|
|
161
162
|
}
|
|
162
|
-
attributeChangedCallback(t,
|
|
163
|
-
super.attributeChangedCallback(t,
|
|
163
|
+
attributeChangedCallback(t, o, r) {
|
|
164
|
+
super.attributeChangedCallback(t, o, r), t === "size" ? this.#r() : this.#t();
|
|
164
165
|
}
|
|
165
166
|
connectedCallback() {
|
|
166
167
|
super.connectedCallback(), this.#t();
|
|
167
168
|
}
|
|
168
169
|
render() {
|
|
169
|
-
return
|
|
170
|
+
return a`<div class="input-group" part="group"><slot @slotchange=${this.#o}></slot></div>`;
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
172
173
|
* A group is only a `group` once it has a name — an unnamed one is decorative
|
|
@@ -177,17 +178,29 @@ class l extends o {
|
|
|
177
178
|
const t = this.hasAttribute("aria-label") || this.hasAttribute("aria-labelledby");
|
|
178
179
|
t && !this.hasAttribute("role") ? this.setAttribute("role", "group") : !t && this.getAttribute("role") === "group" && this.removeAttribute("role");
|
|
179
180
|
}
|
|
180
|
-
#
|
|
181
|
+
#o() {
|
|
181
182
|
this.#r();
|
|
182
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* The control to size for a given slotted child.
|
|
186
|
+
*
|
|
187
|
+
* A framework wrapper is not the control: Angular slots `<bs-select>`, whose
|
|
188
|
+
* `mp-select` lives one level in, and writing the attribute on the wrapper reaches
|
|
189
|
+
* nothing — a signal input does not observe a runtime `setAttribute`, and the
|
|
190
|
+
* wrapper forwards only `aria-*`. React and Vue root at the `mp-*` tag, so there
|
|
191
|
+
* the child already IS the control. Descending covers both without the group
|
|
192
|
+
* knowing which framework it is in (PRD §14.5).
|
|
193
|
+
*/
|
|
194
|
+
static #e(t) {
|
|
195
|
+
return t.tagName.startsWith("MP-") ? t : [...t.children].find((o) => o.tagName.startsWith("MP-"));
|
|
196
|
+
}
|
|
183
197
|
#r() {
|
|
184
|
-
const t = this.size;
|
|
185
|
-
|
|
186
|
-
t !== "md" ? r.setAttribute("size", t) :
|
|
187
|
-
});
|
|
198
|
+
const t = this.size, o = [...this.children].map((r) => e.#e(r)).filter((r) => r !== void 0);
|
|
199
|
+
for (const r of o)
|
|
200
|
+
t !== "md" ? r.setAttribute("size", t) : n.has(r.getAttribute("size") ?? "") && r.removeAttribute("size");
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
|
-
typeof customElements < "u" && !customElements.get("mp-input-group") && customElements.define("mp-input-group",
|
|
203
|
+
typeof customElements < "u" && !customElements.get("mp-input-group") && customElements.define("mp-input-group", e);
|
|
191
204
|
export {
|
|
192
|
-
|
|
205
|
+
e as M
|
|
193
206
|
};
|
package/input-group/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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": {
|
package/phone-input/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { unsafeCSS as y, 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
|
-
import "../chunks/mp-input-group-
|
|
4
|
+
import "../chunks/mp-input-group-CQ55efCq.mjs";
|
|
5
5
|
import "../chunks/mp-select-lHP00OBH.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
8
|
import { H as q } from "../chunks/host-aria-WSGs7SPQ.mjs";
|
|
9
|
-
import { a as
|
|
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-BOTBdmvg.mjs";
|
|
12
12
|
import { i as S } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
|
|
@@ -22,6 +22,7 @@ const E = y(`:host {
|
|
|
22
22
|
mp-select {
|
|
23
23
|
flex: 0 0 auto !important;
|
|
24
24
|
width: auto !important;
|
|
25
|
+
min-width: 0 !important;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
@supports not (appearance: base-select) {
|
|
@@ -98,7 +99,7 @@ class d extends U(p) {
|
|
|
98
99
|
constructor() {
|
|
99
100
|
super(...arguments), this._country = null, this._digits = "", this._rulesWanted = !1, 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-${++b}-error`, this._dialId = `mp-phone-input-${b}-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, {
|
|
100
101
|
referenceTarget: () => this._inputRef.value ?? null,
|
|
101
|
-
describedByExtras: () =>
|
|
102
|
+
describedByExtras: () => w(this.renderRoot)
|
|
102
103
|
}), this.renderCountryOption = (t) => {
|
|
103
104
|
const e = this.countryList().find((i) => i.iso2 === t.value);
|
|
104
105
|
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;
|
|
@@ -331,7 +332,7 @@ class d extends U(p) {
|
|
|
331
332
|
}
|
|
332
333
|
// ---- rendering ------------------------------------------------------------
|
|
333
334
|
render() {
|
|
334
|
-
const t = this.country, e = this.dialCode, s = this.effectiveDisabled, i = this.hasAttribute("invalid"), o =
|
|
335
|
+
const t = this.country, e = this.dialCode, s = this.effectiveDisabled, i = this.hasAttribute("invalid"), o = L(this._errorId, this._errorText, i), r = typeof o.id == "string" ? `${this._dialId} ${o.id}` : this._dialId, l = this.getAttribute("aria-label") ?? this._inputLabel ?? "Phone number", u = this._flags?.[t];
|
|
335
336
|
return v`
|
|
336
337
|
<mp-input-group>
|
|
337
338
|
<mp-select
|