@zag-js/radio-group 0.1.8 → 0.1.10

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.
@@ -0,0 +1,59 @@
1
+ // ../../utilities/dom/src/query.ts
2
+ function isDocument(el) {
3
+ return el.nodeType === Node.DOCUMENT_NODE;
4
+ }
5
+ function isWindow(value) {
6
+ return value?.toString() === "[object Window]";
7
+ }
8
+ function getDocument(el) {
9
+ if (isWindow(el))
10
+ return el.document;
11
+ if (isDocument(el))
12
+ return el;
13
+ return el?.ownerDocument ?? document;
14
+ }
15
+ function getWindow(el) {
16
+ return el?.ownerDocument.defaultView ?? window;
17
+ }
18
+ function defineDomHelpers(helpers) {
19
+ const dom2 = {
20
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
21
+ getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
22
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
23
+ getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
24
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
25
+ };
26
+ return {
27
+ ...dom2,
28
+ ...helpers
29
+ };
30
+ }
31
+
32
+ // ../../utilities/dom/src/nodelist.ts
33
+ function queryAll(root, selector) {
34
+ return Array.from(root?.querySelectorAll(selector) ?? []);
35
+ }
36
+
37
+ // src/radio-group.dom.ts
38
+ var dom = defineDomHelpers({
39
+ getRootId: (ctx) => ctx.ids?.root ?? `radio-group:${ctx.id}`,
40
+ getLabelId: (ctx) => ctx.ids?.label ?? `radio-group:${ctx.id}:label`,
41
+ getRadioId: (ctx, value) => ctx.ids?.radio?.(value) ?? `radio-group:${ctx.id}:radio:${value}`,
42
+ getRadioInputId: (ctx, value) => ctx.ids?.radioInput?.(value) ?? `radio-group:${ctx.id}:radio:input:${value}`,
43
+ getRadioControlId: (ctx, value) => ctx.ids?.radioControl?.(value) ?? `radio-group:${ctx.id}:radio:control:${value}`,
44
+ getRadioLabelId: (ctx, value) => ctx.ids?.radioLabel?.(value) ?? `radio-group:${ctx.id}:radio:label:${value}`,
45
+ getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
46
+ getRadioInputEl: (ctx, value) => dom.getById(ctx, dom.getRadioInputId(ctx, value)),
47
+ getFirstEnabledInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled)"),
48
+ getFirstEnabledAndCheckedInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled):checked"),
49
+ getInputEls: (ctx) => {
50
+ const ownerId = CSS.escape(dom.getRootId(ctx));
51
+ const selector = `input[type=radio][data-ownedby='${ownerId}']:not([disabled])`;
52
+ return queryAll(dom.getRootEl(ctx), selector);
53
+ }
54
+ });
55
+
56
+ export {
57
+ getWindow,
58
+ dom
59
+ };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MGLN5L3R.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-WSYVDFNO.mjs";
6
+ } from "./chunk-CYVZAWTC.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -64,7 +64,7 @@ function connect(state, send, normalize) {
64
64
  return;
65
65
  }
66
66
  const firstEnabledInput = dom.getFirstEnabledInputEl(state.context);
67
- firstEnabledInput == null ? void 0 : firstEnabledInput.focus();
67
+ firstEnabledInput?.focus();
68
68
  };
69
69
  return {
70
70
  value: state.context.value,
@@ -77,7 +77,7 @@ function connect(state, send, normalize) {
77
77
  const inputEls = dom.getInputEls(state.context);
78
78
  const radioInputIsFocused = inputEls.some((el) => el === focusedElement);
79
79
  if (radioInputIsFocused)
80
- focusedElement == null ? void 0 : focusedElement.blur();
80
+ focusedElement?.blur();
81
81
  },
82
82
  rootProps: normalize.element({
83
83
  ...parts.root.attrs,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  dom,
3
3
  getWindow
4
- } from "./chunk-WSYVDFNO.mjs";
4
+ } from "./chunk-CYVZAWTC.mjs";
5
5
 
6
6
  // src/radio-group.machine.ts
7
7
  import { createMachine } from "@zag-js/core";
@@ -38,20 +38,18 @@ function observeAttributes(node, attributes, fn) {
38
38
 
39
39
  // ../../utilities/form-utils/src/input-event.ts
40
40
  function getDescriptor(el, options) {
41
- var _a;
42
41
  const { type, property = "value" } = options;
43
42
  const proto = getWindow(el)[type].prototype;
44
- return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
43
+ return Object.getOwnPropertyDescriptor(proto, property) ?? {};
45
44
  }
46
45
  function dispatchInputCheckedEvent(el, checked) {
47
- var _a;
48
46
  if (!el)
49
47
  return;
50
48
  const win = getWindow(el);
51
49
  if (!(el instanceof win.HTMLInputElement))
52
50
  return;
53
51
  const desc = getDescriptor(el, { type: "HTMLInputElement", property: "checked" });
54
- (_a = desc.set) == null ? void 0 : _a.call(el, checked);
52
+ desc.set?.call(el, checked);
55
53
  const event = new win.Event("click", { bubbles: true });
56
54
  el.dispatchEvent(event);
57
55
  }
@@ -70,13 +68,13 @@ function trackFormReset(el, callback) {
70
68
  if (!el)
71
69
  return;
72
70
  const form = getClosestForm(el);
73
- form == null ? void 0 : form.addEventListener("reset", callback, { passive: true });
71
+ form?.addEventListener("reset", callback, { passive: true });
74
72
  return () => {
75
- form == null ? void 0 : form.removeEventListener("reset", callback);
73
+ form?.removeEventListener("reset", callback);
76
74
  };
77
75
  }
78
76
  function trackFieldsetDisabled(el, callback) {
79
- const fieldset = el == null ? void 0 : el.closest("fieldset");
77
+ const fieldset = el?.closest("fieldset");
80
78
  if (!fieldset)
81
79
  return;
82
80
  callback(fieldset.disabled);
@@ -94,7 +92,7 @@ function trackFormControl(el, options) {
94
92
  })
95
93
  ];
96
94
  return () => {
97
- cleanups.forEach((cleanup) => cleanup == null ? void 0 : cleanup());
95
+ cleanups.forEach((cleanup) => cleanup?.());
98
96
  };
99
97
  }
100
98
 
@@ -104,7 +102,7 @@ function machine(userContext) {
104
102
  return createMachine(
105
103
  {
106
104
  id: "radio",
107
- initial: "unknown",
105
+ initial: "idle",
108
106
  context: {
109
107
  value: null,
110
108
  initialValue: null,
@@ -131,14 +129,9 @@ function machine(userContext) {
131
129
  watch: {
132
130
  value: ["dispatchChangeEvent", "invokeOnChange"]
133
131
  },
132
+ entry: ["checkValue"],
134
133
  states: {
135
- unknown: {
136
- on: {
137
- SETUP: {
138
- actions: "checkValue"
139
- }
140
- }
141
- }
134
+ idle: {}
142
135
  }
143
136
  },
144
137
  {
@@ -171,15 +164,12 @@ function machine(userContext) {
171
164
  ctx2.focusedId = evt.value;
172
165
  },
173
166
  invokeOnChange(ctx2, evt) {
174
- var _a;
175
- (_a = ctx2.onChange) == null ? void 0 : _a.call(ctx2, { value: evt.value });
167
+ ctx2.onChange?.({ value: evt.value });
176
168
  },
177
169
  dispatchChangeEvent(ctx2, evt) {
178
170
  if (!evt.manual)
179
171
  return;
180
172
  const el = dom.getRadioInputEl(ctx2, evt.value);
181
- if (!el)
182
- return;
183
173
  dispatchInputCheckedEvent(el, !!evt.value);
184
174
  }
185
175
  }
package/dist/index.js CHANGED
@@ -64,31 +64,23 @@ function isDocument(el) {
64
64
  return el.nodeType === Node.DOCUMENT_NODE;
65
65
  }
66
66
  function isWindow(value) {
67
- return (value == null ? void 0 : value.toString()) === "[object Window]";
67
+ return value?.toString() === "[object Window]";
68
68
  }
69
69
  function getDocument(el) {
70
- var _a;
71
70
  if (isWindow(el))
72
71
  return el.document;
73
72
  if (isDocument(el))
74
73
  return el;
75
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
74
+ return el?.ownerDocument ?? document;
76
75
  }
77
76
  function getWindow(el) {
78
- var _a;
79
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
77
+ return el?.ownerDocument.defaultView ?? window;
80
78
  }
81
79
  function defineDomHelpers(helpers) {
82
80
  const dom2 = {
83
- getRootNode: (ctx) => {
84
- var _a, _b;
85
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
86
- },
81
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
87
82
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
88
- getWin: (ctx) => {
89
- var _a;
90
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
91
- },
83
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
92
84
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
93
85
  getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
94
86
  };
@@ -117,8 +109,7 @@ function observeAttributes(node, attributes, fn) {
117
109
 
118
110
  // ../../utilities/dom/src/nodelist.ts
119
111
  function queryAll(root, selector) {
120
- var _a;
121
- return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
112
+ return Array.from(root?.querySelectorAll(selector) ?? []);
122
113
  }
123
114
 
124
115
  // ../../utilities/dom/src/visually-hidden.ts
@@ -137,40 +128,16 @@ var visuallyHiddenStyle = {
137
128
 
138
129
  // src/radio-group.dom.ts
139
130
  var dom = defineDomHelpers({
140
- getRootId: (ctx) => {
141
- var _a, _b;
142
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `radio-group:${ctx.id}`;
143
- },
144
- getLabelId: (ctx) => {
145
- var _a, _b;
146
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `radio-group:${ctx.id}:label`;
147
- },
148
- getRadioId: (ctx, value) => {
149
- var _a, _b, _c;
150
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radio) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:${value}`;
151
- },
152
- getRadioInputId: (ctx, value) => {
153
- var _a, _b, _c;
154
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioInput) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:input:${value}`;
155
- },
156
- getRadioControlId: (ctx, value) => {
157
- var _a, _b, _c;
158
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioControl) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:control:${value}`;
159
- },
160
- getRadioLabelId: (ctx, value) => {
161
- var _a, _b, _c;
162
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioLabel) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:label:${value}`;
163
- },
131
+ getRootId: (ctx) => ctx.ids?.root ?? `radio-group:${ctx.id}`,
132
+ getLabelId: (ctx) => ctx.ids?.label ?? `radio-group:${ctx.id}:label`,
133
+ getRadioId: (ctx, value) => ctx.ids?.radio?.(value) ?? `radio-group:${ctx.id}:radio:${value}`,
134
+ getRadioInputId: (ctx, value) => ctx.ids?.radioInput?.(value) ?? `radio-group:${ctx.id}:radio:input:${value}`,
135
+ getRadioControlId: (ctx, value) => ctx.ids?.radioControl?.(value) ?? `radio-group:${ctx.id}:radio:control:${value}`,
136
+ getRadioLabelId: (ctx, value) => ctx.ids?.radioLabel?.(value) ?? `radio-group:${ctx.id}:radio:label:${value}`,
164
137
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
165
138
  getRadioInputEl: (ctx, value) => dom.getById(ctx, dom.getRadioInputId(ctx, value)),
166
- getFirstEnabledInputEl: (ctx) => {
167
- var _a;
168
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled)");
169
- },
170
- getFirstEnabledAndCheckedInputEl: (ctx) => {
171
- var _a;
172
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled):checked");
173
- },
139
+ getFirstEnabledInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled)"),
140
+ getFirstEnabledAndCheckedInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled):checked"),
174
141
  getInputEls: (ctx) => {
175
142
  const ownerId = CSS.escape(dom.getRootId(ctx));
176
143
  const selector = `input[type=radio][data-ownedby='${ownerId}']:not([disabled])`;
@@ -215,7 +182,7 @@ function connect(state, send, normalize) {
215
182
  return;
216
183
  }
217
184
  const firstEnabledInput = dom.getFirstEnabledInputEl(state.context);
218
- firstEnabledInput == null ? void 0 : firstEnabledInput.focus();
185
+ firstEnabledInput?.focus();
219
186
  };
220
187
  return {
221
188
  value: state.context.value,
@@ -228,7 +195,7 @@ function connect(state, send, normalize) {
228
195
  const inputEls = dom.getInputEls(state.context);
229
196
  const radioInputIsFocused = inputEls.some((el) => el === focusedElement);
230
197
  if (radioInputIsFocused)
231
- focusedElement == null ? void 0 : focusedElement.blur();
198
+ focusedElement?.blur();
232
199
  },
233
200
  rootProps: normalize.element({
234
201
  ...parts.root.attrs,
@@ -348,20 +315,18 @@ var import_core = require("@zag-js/core");
348
315
 
349
316
  // ../../utilities/form-utils/src/input-event.ts
350
317
  function getDescriptor(el, options) {
351
- var _a;
352
318
  const { type, property = "value" } = options;
353
319
  const proto = getWindow(el)[type].prototype;
354
- return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
320
+ return Object.getOwnPropertyDescriptor(proto, property) ?? {};
355
321
  }
356
322
  function dispatchInputCheckedEvent(el, checked) {
357
- var _a;
358
323
  if (!el)
359
324
  return;
360
325
  const win = getWindow(el);
361
326
  if (!(el instanceof win.HTMLInputElement))
362
327
  return;
363
328
  const desc = getDescriptor(el, { type: "HTMLInputElement", property: "checked" });
364
- (_a = desc.set) == null ? void 0 : _a.call(el, checked);
329
+ desc.set?.call(el, checked);
365
330
  const event = new win.Event("click", { bubbles: true });
366
331
  el.dispatchEvent(event);
367
332
  }
@@ -380,13 +345,13 @@ function trackFormReset(el, callback) {
380
345
  if (!el)
381
346
  return;
382
347
  const form = getClosestForm(el);
383
- form == null ? void 0 : form.addEventListener("reset", callback, { passive: true });
348
+ form?.addEventListener("reset", callback, { passive: true });
384
349
  return () => {
385
- form == null ? void 0 : form.removeEventListener("reset", callback);
350
+ form?.removeEventListener("reset", callback);
386
351
  };
387
352
  }
388
353
  function trackFieldsetDisabled(el, callback) {
389
- const fieldset = el == null ? void 0 : el.closest("fieldset");
354
+ const fieldset = el?.closest("fieldset");
390
355
  if (!fieldset)
391
356
  return;
392
357
  callback(fieldset.disabled);
@@ -404,7 +369,7 @@ function trackFormControl(el, options) {
404
369
  })
405
370
  ];
406
371
  return () => {
407
- cleanups.forEach((cleanup) => cleanup == null ? void 0 : cleanup());
372
+ cleanups.forEach((cleanup) => cleanup?.());
408
373
  };
409
374
  }
410
375
 
@@ -414,7 +379,7 @@ function machine(userContext) {
414
379
  return (0, import_core.createMachine)(
415
380
  {
416
381
  id: "radio",
417
- initial: "unknown",
382
+ initial: "idle",
418
383
  context: {
419
384
  value: null,
420
385
  initialValue: null,
@@ -441,14 +406,9 @@ function machine(userContext) {
441
406
  watch: {
442
407
  value: ["dispatchChangeEvent", "invokeOnChange"]
443
408
  },
409
+ entry: ["checkValue"],
444
410
  states: {
445
- unknown: {
446
- on: {
447
- SETUP: {
448
- actions: "checkValue"
449
- }
450
- }
451
- }
411
+ idle: {}
452
412
  }
453
413
  },
454
414
  {
@@ -481,15 +441,12 @@ function machine(userContext) {
481
441
  ctx2.focusedId = evt.value;
482
442
  },
483
443
  invokeOnChange(ctx2, evt) {
484
- var _a;
485
- (_a = ctx2.onChange) == null ? void 0 : _a.call(ctx2, { value: evt.value });
444
+ ctx2.onChange?.({ value: evt.value });
486
445
  },
487
446
  dispatchChangeEvent(ctx2, evt) {
488
447
  if (!evt.manual)
489
448
  return;
490
449
  const el = dom.getRadioInputEl(ctx2, evt.value);
491
- if (!el)
492
- return;
493
450
  dispatchInputCheckedEvent(el, !!evt.value);
494
451
  }
495
452
  }
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-FMPH6XGK.mjs";
3
+ } from "./chunk-F57UWPRI.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-MGLN5L3R.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-JED7REAH.mjs";
10
- import "./chunk-WSYVDFNO.mjs";
9
+ } from "./chunk-IKYBQJIH.mjs";
10
+ import "./chunk-CYVZAWTC.mjs";
11
11
  export {
12
12
  anatomy,
13
13
  connect,
@@ -37,27 +37,20 @@ function isDocument(el) {
37
37
  return el.nodeType === Node.DOCUMENT_NODE;
38
38
  }
39
39
  function isWindow(value) {
40
- return (value == null ? void 0 : value.toString()) === "[object Window]";
40
+ return value?.toString() === "[object Window]";
41
41
  }
42
42
  function getDocument(el) {
43
- var _a;
44
43
  if (isWindow(el))
45
44
  return el.document;
46
45
  if (isDocument(el))
47
46
  return el;
48
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
47
+ return el?.ownerDocument ?? document;
49
48
  }
50
49
  function defineDomHelpers(helpers) {
51
50
  const dom2 = {
52
- getRootNode: (ctx) => {
53
- var _a, _b;
54
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
55
- },
51
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
56
52
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
57
- getWin: (ctx) => {
58
- var _a;
59
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
60
- },
53
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
61
54
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
62
55
  getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
63
56
  };
@@ -69,8 +62,7 @@ function defineDomHelpers(helpers) {
69
62
 
70
63
  // ../../utilities/dom/src/nodelist.ts
71
64
  function queryAll(root, selector) {
72
- var _a;
73
- return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
65
+ return Array.from(root?.querySelectorAll(selector) ?? []);
74
66
  }
75
67
 
76
68
  // ../../utilities/dom/src/visually-hidden.ts
@@ -101,40 +93,16 @@ var parts = anatomy.build();
101
93
 
102
94
  // src/radio-group.dom.ts
103
95
  var dom = defineDomHelpers({
104
- getRootId: (ctx) => {
105
- var _a, _b;
106
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `radio-group:${ctx.id}`;
107
- },
108
- getLabelId: (ctx) => {
109
- var _a, _b;
110
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `radio-group:${ctx.id}:label`;
111
- },
112
- getRadioId: (ctx, value) => {
113
- var _a, _b, _c;
114
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radio) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:${value}`;
115
- },
116
- getRadioInputId: (ctx, value) => {
117
- var _a, _b, _c;
118
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioInput) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:input:${value}`;
119
- },
120
- getRadioControlId: (ctx, value) => {
121
- var _a, _b, _c;
122
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioControl) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:control:${value}`;
123
- },
124
- getRadioLabelId: (ctx, value) => {
125
- var _a, _b, _c;
126
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioLabel) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:label:${value}`;
127
- },
96
+ getRootId: (ctx) => ctx.ids?.root ?? `radio-group:${ctx.id}`,
97
+ getLabelId: (ctx) => ctx.ids?.label ?? `radio-group:${ctx.id}:label`,
98
+ getRadioId: (ctx, value) => ctx.ids?.radio?.(value) ?? `radio-group:${ctx.id}:radio:${value}`,
99
+ getRadioInputId: (ctx, value) => ctx.ids?.radioInput?.(value) ?? `radio-group:${ctx.id}:radio:input:${value}`,
100
+ getRadioControlId: (ctx, value) => ctx.ids?.radioControl?.(value) ?? `radio-group:${ctx.id}:radio:control:${value}`,
101
+ getRadioLabelId: (ctx, value) => ctx.ids?.radioLabel?.(value) ?? `radio-group:${ctx.id}:radio:label:${value}`,
128
102
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
129
103
  getRadioInputEl: (ctx, value) => dom.getById(ctx, dom.getRadioInputId(ctx, value)),
130
- getFirstEnabledInputEl: (ctx) => {
131
- var _a;
132
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled)");
133
- },
134
- getFirstEnabledAndCheckedInputEl: (ctx) => {
135
- var _a;
136
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled):checked");
137
- },
104
+ getFirstEnabledInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled)"),
105
+ getFirstEnabledAndCheckedInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled):checked"),
138
106
  getInputEls: (ctx) => {
139
107
  const ownerId = CSS.escape(dom.getRootId(ctx));
140
108
  const selector = `input[type=radio][data-ownedby='${ownerId}']:not([disabled])`;
@@ -179,7 +147,7 @@ function connect(state, send, normalize) {
179
147
  return;
180
148
  }
181
149
  const firstEnabledInput = dom.getFirstEnabledInputEl(state.context);
182
- firstEnabledInput == null ? void 0 : firstEnabledInput.focus();
150
+ firstEnabledInput?.focus();
183
151
  };
184
152
  return {
185
153
  value: state.context.value,
@@ -192,7 +160,7 @@ function connect(state, send, normalize) {
192
160
  const inputEls = dom.getInputEls(state.context);
193
161
  const radioInputIsFocused = inputEls.some((el) => el === focusedElement);
194
162
  if (radioInputIsFocused)
195
- focusedElement == null ? void 0 : focusedElement.blur();
163
+ focusedElement?.blur();
196
164
  },
197
165
  rootProps: normalize.element({
198
166
  ...parts.root.attrs,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-FMPH6XGK.mjs";
3
+ } from "./chunk-F57UWPRI.mjs";
4
4
  import "./chunk-MGLN5L3R.mjs";
5
- import "./chunk-WSYVDFNO.mjs";
5
+ import "./chunk-CYVZAWTC.mjs";
6
6
  export {
7
7
  connect
8
8
  };
@@ -29,27 +29,20 @@ function isDocument(el) {
29
29
  return el.nodeType === Node.DOCUMENT_NODE;
30
30
  }
31
31
  function isWindow(value) {
32
- return (value == null ? void 0 : value.toString()) === "[object Window]";
32
+ return value?.toString() === "[object Window]";
33
33
  }
34
34
  function getDocument(el) {
35
- var _a;
36
35
  if (isWindow(el))
37
36
  return el.document;
38
37
  if (isDocument(el))
39
38
  return el;
40
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
39
+ return el?.ownerDocument ?? document;
41
40
  }
42
41
  function defineDomHelpers(helpers) {
43
42
  const dom2 = {
44
- getRootNode: (ctx) => {
45
- var _a, _b;
46
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
47
- },
43
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
48
44
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
49
- getWin: (ctx) => {
50
- var _a;
51
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
52
- },
45
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
53
46
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
54
47
  getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
55
48
  };
@@ -61,46 +54,21 @@ function defineDomHelpers(helpers) {
61
54
 
62
55
  // ../../utilities/dom/src/nodelist.ts
63
56
  function queryAll(root, selector) {
64
- var _a;
65
- return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
57
+ return Array.from(root?.querySelectorAll(selector) ?? []);
66
58
  }
67
59
 
68
60
  // src/radio-group.dom.ts
69
61
  var dom = defineDomHelpers({
70
- getRootId: (ctx) => {
71
- var _a, _b;
72
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `radio-group:${ctx.id}`;
73
- },
74
- getLabelId: (ctx) => {
75
- var _a, _b;
76
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `radio-group:${ctx.id}:label`;
77
- },
78
- getRadioId: (ctx, value) => {
79
- var _a, _b, _c;
80
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radio) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:${value}`;
81
- },
82
- getRadioInputId: (ctx, value) => {
83
- var _a, _b, _c;
84
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioInput) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:input:${value}`;
85
- },
86
- getRadioControlId: (ctx, value) => {
87
- var _a, _b, _c;
88
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioControl) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:control:${value}`;
89
- },
90
- getRadioLabelId: (ctx, value) => {
91
- var _a, _b, _c;
92
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioLabel) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:label:${value}`;
93
- },
62
+ getRootId: (ctx) => ctx.ids?.root ?? `radio-group:${ctx.id}`,
63
+ getLabelId: (ctx) => ctx.ids?.label ?? `radio-group:${ctx.id}:label`,
64
+ getRadioId: (ctx, value) => ctx.ids?.radio?.(value) ?? `radio-group:${ctx.id}:radio:${value}`,
65
+ getRadioInputId: (ctx, value) => ctx.ids?.radioInput?.(value) ?? `radio-group:${ctx.id}:radio:input:${value}`,
66
+ getRadioControlId: (ctx, value) => ctx.ids?.radioControl?.(value) ?? `radio-group:${ctx.id}:radio:control:${value}`,
67
+ getRadioLabelId: (ctx, value) => ctx.ids?.radioLabel?.(value) ?? `radio-group:${ctx.id}:radio:label:${value}`,
94
68
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
95
69
  getRadioInputEl: (ctx, value) => dom.getById(ctx, dom.getRadioInputId(ctx, value)),
96
- getFirstEnabledInputEl: (ctx) => {
97
- var _a;
98
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled)");
99
- },
100
- getFirstEnabledAndCheckedInputEl: (ctx) => {
101
- var _a;
102
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled):checked");
103
- },
70
+ getFirstEnabledInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled)"),
71
+ getFirstEnabledAndCheckedInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled):checked"),
104
72
  getInputEls: (ctx) => {
105
73
  const ownerId = CSS.escape(dom.getRootId(ctx));
106
74
  const selector = `input[type=radio][data-ownedby='${ownerId}']:not([disabled])`;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-WSYVDFNO.mjs";
3
+ } from "./chunk-CYVZAWTC.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -43,31 +43,23 @@ function isDocument(el) {
43
43
  return el.nodeType === Node.DOCUMENT_NODE;
44
44
  }
45
45
  function isWindow(value) {
46
- return (value == null ? void 0 : value.toString()) === "[object Window]";
46
+ return value?.toString() === "[object Window]";
47
47
  }
48
48
  function getDocument(el) {
49
- var _a;
50
49
  if (isWindow(el))
51
50
  return el.document;
52
51
  if (isDocument(el))
53
52
  return el;
54
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
53
+ return el?.ownerDocument ?? document;
55
54
  }
56
55
  function getWindow(el) {
57
- var _a;
58
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
56
+ return el?.ownerDocument.defaultView ?? window;
59
57
  }
60
58
  function defineDomHelpers(helpers) {
61
59
  const dom2 = {
62
- getRootNode: (ctx) => {
63
- var _a, _b;
64
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
65
- },
60
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
66
61
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
67
- getWin: (ctx) => {
68
- var _a;
69
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
70
- },
62
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
71
63
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
72
64
  getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
73
65
  };
@@ -96,26 +88,23 @@ function observeAttributes(node, attributes, fn) {
96
88
 
97
89
  // ../../utilities/dom/src/nodelist.ts
98
90
  function queryAll(root, selector) {
99
- var _a;
100
- return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
91
+ return Array.from(root?.querySelectorAll(selector) ?? []);
101
92
  }
102
93
 
103
94
  // ../../utilities/form-utils/src/input-event.ts
104
95
  function getDescriptor(el, options) {
105
- var _a;
106
96
  const { type, property = "value" } = options;
107
97
  const proto = getWindow(el)[type].prototype;
108
- return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
98
+ return Object.getOwnPropertyDescriptor(proto, property) ?? {};
109
99
  }
110
100
  function dispatchInputCheckedEvent(el, checked) {
111
- var _a;
112
101
  if (!el)
113
102
  return;
114
103
  const win = getWindow(el);
115
104
  if (!(el instanceof win.HTMLInputElement))
116
105
  return;
117
106
  const desc = getDescriptor(el, { type: "HTMLInputElement", property: "checked" });
118
- (_a = desc.set) == null ? void 0 : _a.call(el, checked);
107
+ desc.set?.call(el, checked);
119
108
  const event = new win.Event("click", { bubbles: true });
120
109
  el.dispatchEvent(event);
121
110
  }
@@ -134,13 +123,13 @@ function trackFormReset(el, callback) {
134
123
  if (!el)
135
124
  return;
136
125
  const form = getClosestForm(el);
137
- form == null ? void 0 : form.addEventListener("reset", callback, { passive: true });
126
+ form?.addEventListener("reset", callback, { passive: true });
138
127
  return () => {
139
- form == null ? void 0 : form.removeEventListener("reset", callback);
128
+ form?.removeEventListener("reset", callback);
140
129
  };
141
130
  }
142
131
  function trackFieldsetDisabled(el, callback) {
143
- const fieldset = el == null ? void 0 : el.closest("fieldset");
132
+ const fieldset = el?.closest("fieldset");
144
133
  if (!fieldset)
145
134
  return;
146
135
  callback(fieldset.disabled);
@@ -158,46 +147,22 @@ function trackFormControl(el, options) {
158
147
  })
159
148
  ];
160
149
  return () => {
161
- cleanups.forEach((cleanup) => cleanup == null ? void 0 : cleanup());
150
+ cleanups.forEach((cleanup) => cleanup?.());
162
151
  };
163
152
  }
164
153
 
165
154
  // src/radio-group.dom.ts
166
155
  var dom = defineDomHelpers({
167
- getRootId: (ctx) => {
168
- var _a, _b;
169
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `radio-group:${ctx.id}`;
170
- },
171
- getLabelId: (ctx) => {
172
- var _a, _b;
173
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `radio-group:${ctx.id}:label`;
174
- },
175
- getRadioId: (ctx, value) => {
176
- var _a, _b, _c;
177
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radio) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:${value}`;
178
- },
179
- getRadioInputId: (ctx, value) => {
180
- var _a, _b, _c;
181
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioInput) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:input:${value}`;
182
- },
183
- getRadioControlId: (ctx, value) => {
184
- var _a, _b, _c;
185
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioControl) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:control:${value}`;
186
- },
187
- getRadioLabelId: (ctx, value) => {
188
- var _a, _b, _c;
189
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioLabel) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:label:${value}`;
190
- },
156
+ getRootId: (ctx) => ctx.ids?.root ?? `radio-group:${ctx.id}`,
157
+ getLabelId: (ctx) => ctx.ids?.label ?? `radio-group:${ctx.id}:label`,
158
+ getRadioId: (ctx, value) => ctx.ids?.radio?.(value) ?? `radio-group:${ctx.id}:radio:${value}`,
159
+ getRadioInputId: (ctx, value) => ctx.ids?.radioInput?.(value) ?? `radio-group:${ctx.id}:radio:input:${value}`,
160
+ getRadioControlId: (ctx, value) => ctx.ids?.radioControl?.(value) ?? `radio-group:${ctx.id}:radio:control:${value}`,
161
+ getRadioLabelId: (ctx, value) => ctx.ids?.radioLabel?.(value) ?? `radio-group:${ctx.id}:radio:label:${value}`,
191
162
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
192
163
  getRadioInputEl: (ctx, value) => dom.getById(ctx, dom.getRadioInputId(ctx, value)),
193
- getFirstEnabledInputEl: (ctx) => {
194
- var _a;
195
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled)");
196
- },
197
- getFirstEnabledAndCheckedInputEl: (ctx) => {
198
- var _a;
199
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled):checked");
200
- },
164
+ getFirstEnabledInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled)"),
165
+ getFirstEnabledAndCheckedInputEl: (ctx) => dom.getRootEl(ctx)?.querySelector("input:not(:disabled):checked"),
201
166
  getInputEls: (ctx) => {
202
167
  const ownerId = CSS.escape(dom.getRootId(ctx));
203
168
  const selector = `input[type=radio][data-ownedby='${ownerId}']:not([disabled])`;
@@ -211,7 +176,7 @@ function machine(userContext) {
211
176
  return (0, import_core.createMachine)(
212
177
  {
213
178
  id: "radio",
214
- initial: "unknown",
179
+ initial: "idle",
215
180
  context: {
216
181
  value: null,
217
182
  initialValue: null,
@@ -238,14 +203,9 @@ function machine(userContext) {
238
203
  watch: {
239
204
  value: ["dispatchChangeEvent", "invokeOnChange"]
240
205
  },
206
+ entry: ["checkValue"],
241
207
  states: {
242
- unknown: {
243
- on: {
244
- SETUP: {
245
- actions: "checkValue"
246
- }
247
- }
248
- }
208
+ idle: {}
249
209
  }
250
210
  },
251
211
  {
@@ -278,15 +238,12 @@ function machine(userContext) {
278
238
  ctx2.focusedId = evt.value;
279
239
  },
280
240
  invokeOnChange(ctx2, evt) {
281
- var _a;
282
- (_a = ctx2.onChange) == null ? void 0 : _a.call(ctx2, { value: evt.value });
241
+ ctx2.onChange?.({ value: evt.value });
283
242
  },
284
243
  dispatchChangeEvent(ctx2, evt) {
285
244
  if (!evt.manual)
286
245
  return;
287
246
  const el = dom.getRadioInputEl(ctx2, evt.value);
288
- if (!el)
289
- return;
290
247
  dispatchInputCheckedEvent(el, !!evt.value);
291
248
  }
292
249
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-JED7REAH.mjs";
4
- import "./chunk-WSYVDFNO.mjs";
3
+ } from "./chunk-IKYBQJIH.mjs";
4
+ import "./chunk-CYVZAWTC.mjs";
5
5
  export {
6
6
  machine
7
7
  };
@@ -52,7 +52,7 @@ type UserDefinedContext = RequiredBy<PublicContext, "id">;
52
52
  type ComputedContext = Readonly<{}>;
53
53
  type MachineContext = PublicContext & PrivateContext & ComputedContext;
54
54
  type MachineState = {
55
- value: "unknown";
55
+ value: "idle";
56
56
  };
57
57
  type State = StateMachine.State<MachineContext, MachineState>;
58
58
  type Send = StateMachine.Send<StateMachine.AnyEventObject>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/radio-group",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Core logic for the radio group widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,15 +27,15 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/anatomy": "0.1.3",
31
- "@zag-js/core": "0.2.5",
32
- "@zag-js/types": "0.3.3"
30
+ "@zag-js/anatomy": "0.1.4",
31
+ "@zag-js/core": "0.2.7",
32
+ "@zag-js/types": "0.3.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "clean-package": "2.2.0",
36
- "@zag-js/dom-utils": "0.2.3",
37
- "@zag-js/form-utils": "0.2.3",
38
- "@zag-js/utils": "0.3.2"
36
+ "@zag-js/dom-utils": "0.2.4",
37
+ "@zag-js/form-utils": "0.2.4",
38
+ "@zag-js/utils": "0.3.3"
39
39
  },
40
40
  "clean-package": "../../../clean-package.config.json",
41
41
  "main": "dist/index.js",
@@ -1,92 +0,0 @@
1
- // ../../utilities/dom/src/query.ts
2
- function isDocument(el) {
3
- return el.nodeType === Node.DOCUMENT_NODE;
4
- }
5
- function isWindow(value) {
6
- return (value == null ? void 0 : value.toString()) === "[object Window]";
7
- }
8
- function getDocument(el) {
9
- var _a;
10
- if (isWindow(el))
11
- return el.document;
12
- if (isDocument(el))
13
- return el;
14
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
15
- }
16
- function getWindow(el) {
17
- var _a;
18
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
19
- }
20
- function defineDomHelpers(helpers) {
21
- const dom2 = {
22
- getRootNode: (ctx) => {
23
- var _a, _b;
24
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
25
- },
26
- getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
27
- getWin: (ctx) => {
28
- var _a;
29
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
30
- },
31
- getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
32
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
33
- };
34
- return {
35
- ...dom2,
36
- ...helpers
37
- };
38
- }
39
-
40
- // ../../utilities/dom/src/nodelist.ts
41
- function queryAll(root, selector) {
42
- var _a;
43
- return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
44
- }
45
-
46
- // src/radio-group.dom.ts
47
- var dom = defineDomHelpers({
48
- getRootId: (ctx) => {
49
- var _a, _b;
50
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `radio-group:${ctx.id}`;
51
- },
52
- getLabelId: (ctx) => {
53
- var _a, _b;
54
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `radio-group:${ctx.id}:label`;
55
- },
56
- getRadioId: (ctx, value) => {
57
- var _a, _b, _c;
58
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radio) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:${value}`;
59
- },
60
- getRadioInputId: (ctx, value) => {
61
- var _a, _b, _c;
62
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioInput) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:input:${value}`;
63
- },
64
- getRadioControlId: (ctx, value) => {
65
- var _a, _b, _c;
66
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioControl) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:control:${value}`;
67
- },
68
- getRadioLabelId: (ctx, value) => {
69
- var _a, _b, _c;
70
- return (_c = (_b = (_a = ctx.ids) == null ? void 0 : _a.radioLabel) == null ? void 0 : _b.call(_a, value)) != null ? _c : `radio-group:${ctx.id}:radio:label:${value}`;
71
- },
72
- getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
73
- getRadioInputEl: (ctx, value) => dom.getById(ctx, dom.getRadioInputId(ctx, value)),
74
- getFirstEnabledInputEl: (ctx) => {
75
- var _a;
76
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled)");
77
- },
78
- getFirstEnabledAndCheckedInputEl: (ctx) => {
79
- var _a;
80
- return (_a = dom.getRootEl(ctx)) == null ? void 0 : _a.querySelector("input:not(:disabled):checked");
81
- },
82
- getInputEls: (ctx) => {
83
- const ownerId = CSS.escape(dom.getRootId(ctx));
84
- const selector = `input[type=radio][data-ownedby='${ownerId}']:not([disabled])`;
85
- return queryAll(dom.getRootEl(ctx), selector);
86
- }
87
- });
88
-
89
- export {
90
- getWindow,
91
- dom
92
- };