agnosticui-core 2.0.0-alpha.19 → 2.0.0-alpha.20

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 +1 @@
1
- {"version":3,"file":"_Radio.d.ts","sourceRoot":"","sources":["../../../../src/components/Radio/core/_Radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAUrD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC;AAG1E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC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AOlC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;IASV,YAAY;IASZ,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAaxD,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,aAAa;IAgErB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,YAAY;IA0CpB,OAAO,CAAC,yBAAyB;IAgBjC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAoB5B;;OAEG;IACH,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IASlB,MAAM;CA+DhB"}
@@ -1,16 +1,16 @@
1
1
  import { LitElement as p, css as b, nothing as c, html as h } from "lit";
2
2
  import { n as s } from "../../../property-CemaeiRl.js";
3
- import { formControlStyles as f } from "../../../shared/form-control-styles.js";
4
- import { createFormControlIds as v, buildAriaDescribedBy as w } from "../../../shared/form-control-utils.js";
3
+ import { formControlStyles as v } from "../../../shared/form-control-styles.js";
4
+ import { createFormControlIds as f, buildAriaDescribedBy as w } from "../../../shared/form-control-utils.js";
5
5
  import { FaceMixin as m } from "../../../shared/face-mixin.js";
6
- var y = Object.defineProperty, d = (u, e, a, t) => {
7
- for (var r = void 0, i = u.length - 1, l; i >= 0; i--)
8
- (l = u[i]) && (r = l(e, a, r) || r);
9
- return r && y(e, a, r), r;
6
+ var y = Object.defineProperty, d = (g, r, e, a) => {
7
+ for (var t = void 0, i = g.length - 1, l; i >= 0; i--)
8
+ (l = g[i]) && (t = l(r, e, t) || t);
9
+ return t && y(r, e, t), t;
10
10
  }, n;
11
11
  const o = (n = class extends m(p) {
12
12
  constructor() {
13
- super(...arguments), this.value = "", this.checked = !1, this.disabled = !1, this.size = "medium", this.theme = "primary", this.labelText = "", this.labelPosition = "end", this.label = "", this.labelHidden = !1, this.noLabel = !1, this.required = !1, this.invalid = !1, this.errorMessage = "", this.helpText = "", this._ids = v("ag-radio");
13
+ super(...arguments), this.value = "", this.checked = !1, this.disabled = !1, this.size = "medium", this.theme = "primary", this.labelText = "", this.labelPosition = "end", this.label = "", this.labelHidden = !1, this.noLabel = !1, this.required = !1, this.invalid = !1, this.errorMessage = "", this.helpText = "", this._ids = f("ag-radio");
14
14
  }
15
15
  // ─── FACE ─────────────────────────────────────────────────────────────────
16
16
  /**
@@ -29,17 +29,9 @@ const o = (n = class extends m(p) {
29
29
  */
30
30
  _isGroupChecked() {
31
31
  if (this.checked) return !0;
32
- let e = this.getRootNode();
33
- for (; e && "host" in e; ) {
34
- const t = e.host?.getRootNode();
35
- if (t && t !== e)
36
- e = t;
37
- else
38
- break;
39
- }
40
- const a = e instanceof Document ? e : document;
41
- return Array.from(a.querySelectorAll(`ag-radio[name="${this.name}"]`)).some(
42
- (t) => t.checked
32
+ const r = this.getRootNode();
33
+ return Array.from(r.querySelectorAll(`ag-radio[name="${this.name}"]`)).some(
34
+ (e) => e.checked
43
35
  );
44
36
  }
45
37
  /**
@@ -84,28 +76,28 @@ const o = (n = class extends m(p) {
84
76
  firstUpdated() {
85
77
  this.inputRef = this.shadowRoot?.querySelector(".radio-input"), this._syncFormValue(), this._syncValidity(), this._syncStates();
86
78
  }
87
- updated(e) {
88
- super.updated(e), e.has("checked") && (this._syncFormValue(), this._syncValidity(), this._syncStates());
79
+ updated(r) {
80
+ super.updated(r), r.has("checked") && (this._syncFormValue(), this._syncValidity(), this._syncStates());
89
81
  }
90
- handleClick(e) {
91
- this.onClick && this.onClick(e);
82
+ handleClick(r) {
83
+ this.onClick && this.onClick(r);
92
84
  }
93
- handleKeyDown(e) {
94
- if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key))
85
+ handleKeyDown(r) {
86
+ if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(r.key))
95
87
  return;
96
- e.preventDefault();
97
- const a = this.getRadiosInGroup();
98
- if (a.length === 0) return;
99
- const t = a.indexOf(this);
100
- if (t === -1) return;
101
- let r;
102
- e.key === "Home" ? r = 0 : e.key === "End" ? r = a.length - 1 : e.key === "ArrowDown" || e.key === "ArrowRight" ? r = (t + 1) % a.length : r = (t - 1 + a.length) % a.length;
103
- const i = a[r];
88
+ r.preventDefault();
89
+ const e = this.getRadiosInGroup();
90
+ if (e.length === 0) return;
91
+ const a = e.indexOf(this);
92
+ if (a === -1) return;
93
+ let t;
94
+ r.key === "Home" ? t = 0 : r.key === "End" ? t = e.length - 1 : r.key === "ArrowDown" || r.key === "ArrowRight" ? t = (a + 1) % e.length : t = (a - 1 + e.length) % e.length;
95
+ const i = e[t];
104
96
  if (i && !i.disabled) {
105
97
  const l = i.shadowRoot?.querySelector(".radio-input");
106
98
  if (l) {
107
99
  l.focus(), i.checked = !0, i.uncheckOtherRadiosInGroup();
108
- const g = new CustomEvent(
100
+ const u = new CustomEvent(
109
101
  "change",
110
102
  {
111
103
  detail: {
@@ -117,31 +109,23 @@ const o = (n = class extends m(p) {
117
109
  composed: !0
118
110
  }
119
111
  );
120
- i.dispatchEvent(g), i.onChange && i.onChange(g);
112
+ i.dispatchEvent(u), i.onChange && i.onChange(u);
121
113
  }
122
114
  }
123
115
  }
124
116
  getRadiosInGroup() {
125
117
  if (!this.name) return [];
126
- let e = this.getRootNode();
127
- for (; e && "host" in e; ) {
128
- const r = e.host?.getRootNode();
129
- if (r && r !== e)
130
- e = r;
131
- else
132
- break;
133
- }
134
- const t = (e instanceof Document ? e : document).querySelectorAll(`ag-radio[name="${this.name}"]`);
135
- return Array.from(t).filter((r) => r instanceof n && !r.disabled);
118
+ const e = this.getRootNode().querySelectorAll(`ag-radio[name="${this.name}"]`);
119
+ return Array.from(e).filter((a) => a instanceof n && !a.disabled);
136
120
  }
137
- handleChange(e) {
121
+ handleChange(r) {
138
122
  if (this.disabled) {
139
- e.preventDefault();
123
+ r.preventDefault();
140
124
  return;
141
125
  }
142
- const a = e.target, t = this.checked;
143
- this.checked = a.checked, this._syncFormValue(), this._syncValidity(), this._syncStates(), this.checked && !t && this.name && this.uncheckOtherRadiosInGroup();
144
- const r = new CustomEvent(
126
+ const e = r.target, a = this.checked;
127
+ this.checked = e.checked, this._syncFormValue(), this._syncValidity(), this._syncStates(), this.checked && !a && this.name && this.uncheckOtherRadiosInGroup();
128
+ const t = new CustomEvent(
145
129
  "change",
146
130
  {
147
131
  detail: {
@@ -153,19 +137,11 @@ const o = (n = class extends m(p) {
153
137
  composed: !0
154
138
  }
155
139
  );
156
- this.dispatchEvent(r), this.onChange && this.onChange(r);
140
+ this.dispatchEvent(t), this.onChange && this.onChange(t);
157
141
  }
158
142
  uncheckOtherRadiosInGroup() {
159
- let e = this.getRootNode();
160
- for (; e && "host" in e; ) {
161
- const r = e.host?.getRootNode();
162
- if (r && r !== e)
163
- e = r;
164
- else
165
- break;
166
- }
167
- (e instanceof Document ? e : document).querySelectorAll(`ag-radio[name="${this.name}"]`).forEach((r) => {
168
- r !== this && r instanceof n && (r.checked = !1, r._syncValidity(), r._syncStates());
143
+ this.getRootNode().querySelectorAll(`ag-radio[name="${this.name}"]`).forEach((a) => {
144
+ a !== this && a instanceof n && (a.checked = !1, a._syncValidity(), a._syncStates());
169
145
  });
170
146
  }
171
147
  /**
@@ -227,18 +203,18 @@ const o = (n = class extends m(p) {
227
203
  });
228
204
  }
229
205
  render() {
230
- const e = `
206
+ const r = `
231
207
  radio-wrapper
232
208
  ${this.labelPosition === "start" ? "radio-wrapper--label-start" : ""}
233
- `, a = `
209
+ `, e = `
234
210
  radio-indicator
235
211
  radio-indicator--${this.size}
236
212
  radio-indicator--${this.theme}
237
- `, t = `
213
+ `, a = `
238
214
  radio-label
239
215
  radio-label--${this.size}
240
- `, r = this._getAriaDescribedBy(), i = h`
241
- <label class=${e.trim()} part="ag-radio-wrapper">
216
+ `, t = this._getAriaDescribedBy(), i = h`
217
+ <label class=${r.trim()} part="ag-radio-wrapper">
242
218
  <input
243
219
  type="radio"
244
220
  id="${this._ids.inputId}"
@@ -251,14 +227,14 @@ const o = (n = class extends m(p) {
251
227
  ?required=${this.required}
252
228
  aria-required="${this.required ? "true" : "false"}"
253
229
  aria-invalid="${this.invalid ? "true" : "false"}"
254
- aria-describedby="${r || c}"
230
+ aria-describedby="${t || c}"
255
231
  @click=${this.handleClick}
256
232
  @change=${this.handleChange}
257
233
  @keydown=${this.handleKeyDown}
258
234
  aria-checked=${this.checked ? "true" : "false"}
259
235
  />
260
- <span class=${a.trim()} part="ag-radio-indicator"></span>
261
- <span class=${t.trim()} part="ag-radio-label">
236
+ <span class=${e.trim()} part="ag-radio-indicator"></span>
237
+ <span class=${a.trim()} part="ag-radio-label">
262
238
  ${this.labelText ? this.labelText : h`<slot></slot>`}
263
239
  </span>
264
240
  </label>
@@ -273,7 +249,7 @@ const o = (n = class extends m(p) {
273
249
  ` : i;
274
250
  }
275
251
  }, n.styles = [
276
- f,
252
+ v,
277
253
  b`
278
254
  :host {
279
255
  display: inline-block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agnosticui-core",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.20",
4
4
  "author": "AgnosticUI",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -362,17 +362,13 @@ export class AgRadio extends FaceMixin(LitElement) implements RadioProps {
362
362
  */
363
363
  private _isGroupChecked(): boolean {
364
364
  if (this.checked) return true;
365
- let root: Node = this.getRootNode();
366
- while (root && 'host' in root) {
367
- const parent = (root as ShadowRoot).host?.getRootNode();
368
- if (parent && parent !== root) {
369
- root = parent;
370
- } else {
371
- break;
372
- }
373
- }
374
- const doc = root instanceof Document ? root : document;
375
- return Array.from(doc.querySelectorAll(`ag-radio[name="${this.name}"]`)).some(
365
+ // Query from the immediate root node. If the radios live inside a shadow root
366
+ // (e.g. a Lit host component), getRootNode() returns that shadow root and
367
+ // querySelectorAll can reach them. If they're in the document's light DOM
368
+ // (React/Vue), getRootNode() returns the document. Traversing all the way up
369
+ // to document would bypass shadow roots and miss the siblings.
370
+ const root = this.getRootNode() as Document | ShadowRoot;
371
+ return Array.from(root.querySelectorAll(`ag-radio[name="${this.name}"]`)).some(
376
372
  (el) => (el as AgRadio).checked
377
373
  );
378
374
  }
@@ -524,22 +520,8 @@ export class AgRadio extends FaceMixin(LitElement) implements RadioProps {
524
520
 
525
521
  private getRadiosInGroup(): AgRadio[] {
526
522
  if (!this.name) return [];
527
-
528
- // Find the root document (traverse up from shadow roots if needed)
529
- let root: Node = this.getRootNode();
530
- while (root && 'host' in root) {
531
- const parent = (root as ShadowRoot).host?.getRootNode();
532
- if (parent && parent !== root) {
533
- root = parent;
534
- } else {
535
- break;
536
- }
537
- }
538
-
539
- const doc = root instanceof Document ? root : document;
540
- const allRadios = doc.querySelectorAll(`ag-radio[name="${this.name}"]`);
541
-
542
- // Filter to only enabled radios and return as array
523
+ const root = this.getRootNode() as Document | ShadowRoot;
524
+ const allRadios = root.querySelectorAll(`ag-radio[name="${this.name}"]`);
543
525
  return Array.from(allRadios).filter((radio): radio is AgRadio => {
544
526
  return radio instanceof AgRadio && !radio.disabled;
545
527
  });
@@ -588,19 +570,8 @@ export class AgRadio extends FaceMixin(LitElement) implements RadioProps {
588
570
  }
589
571
 
590
572
  private uncheckOtherRadiosInGroup() {
591
- // Find the root document (traverse up from shadow roots if needed)
592
- let root: Node = this.getRootNode();
593
- while (root && 'host' in root) {
594
- const parent = (root as ShadowRoot).host?.getRootNode();
595
- if (parent && parent !== root) {
596
- root = parent;
597
- } else {
598
- break;
599
- }
600
- }
601
-
602
- const doc = root instanceof Document ? root : document;
603
- const allRadios = doc.querySelectorAll(`ag-radio[name="${this.name}"]`);
573
+ const root = this.getRootNode() as Document | ShadowRoot;
574
+ const allRadios = root.querySelectorAll(`ag-radio[name="${this.name}"]`);
604
575
 
605
576
  allRadios.forEach((radio) => {
606
577
  if (radio !== this && radio instanceof AgRadio) {