@vonage/vivid 4.12.0 → 4.12.1

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.
Files changed (85) hide show
  1. package/custom-elements.json +851 -60
  2. package/lib/accordion/accordion.d.ts +21 -2
  3. package/lib/accordion-item/accordion-item.d.ts +6 -2
  4. package/lib/calendar/calendar.d.ts +1 -1
  5. package/lib/date-picker/date-picker.d.ts +1 -0
  6. package/lib/radio/radio.d.ts +12 -2
  7. package/lib/radio/radio.form-associated.d.ts +10 -0
  8. package/lib/radio-group/radio-group.d.ts +20 -2
  9. package/lib/tab/tab.d.ts +3 -2
  10. package/lib/tab-panel/tab-panel.d.ts +2 -2
  11. package/lib/tabs/tabs.d.ts +30 -9
  12. package/package.json +1 -1
  13. package/shared/date-picker/date-picker-base.d.ts +1 -0
  14. package/shared/definition.cjs +29 -72
  15. package/shared/definition.js +30 -73
  16. package/shared/definition16.cjs +1 -2
  17. package/shared/definition16.js +1 -2
  18. package/shared/definition17.cjs +2 -2
  19. package/shared/definition17.js +2 -2
  20. package/shared/definition18.cjs +6 -1
  21. package/shared/definition18.js +6 -1
  22. package/shared/definition19.cjs +17 -8
  23. package/shared/definition19.js +17 -8
  24. package/shared/definition2.cjs +154 -187
  25. package/shared/definition2.js +157 -190
  26. package/shared/definition20.cjs +1 -1
  27. package/shared/definition20.js +1 -1
  28. package/shared/definition29.cjs +2 -2
  29. package/shared/definition29.js +2 -2
  30. package/shared/definition35.cjs +1 -1
  31. package/shared/definition35.js +1 -1
  32. package/shared/definition40.cjs +226 -399
  33. package/shared/definition40.js +229 -402
  34. package/shared/definition42.cjs +3 -2
  35. package/shared/definition42.js +3 -2
  36. package/shared/definition43.cjs +1 -0
  37. package/shared/definition43.js +1 -0
  38. package/shared/definition44.cjs +1 -1
  39. package/shared/definition44.js +1 -1
  40. package/shared/definition47.cjs +3 -2
  41. package/shared/definition47.js +3 -2
  42. package/shared/definition49.cjs +1 -1
  43. package/shared/definition49.js +1 -1
  44. package/shared/definition5.cjs +1 -1
  45. package/shared/definition5.js +1 -1
  46. package/shared/definition50.cjs +1 -11
  47. package/shared/definition50.js +1 -11
  48. package/shared/definition51.cjs +4 -14
  49. package/shared/definition51.js +5 -15
  50. package/shared/definition52.cjs +269 -19
  51. package/shared/definition52.js +273 -23
  52. package/shared/definition57.cjs +26 -4
  53. package/shared/definition57.js +27 -5
  54. package/shared/definition61.cjs +1 -1
  55. package/shared/definition61.js +1 -1
  56. package/shared/definition62.cjs +17 -8
  57. package/shared/definition62.js +17 -8
  58. package/shared/form-associated.cjs +1 -1
  59. package/shared/form-associated.js +1 -1
  60. package/shared/icon.cjs +1 -1
  61. package/shared/icon.js +1 -1
  62. package/shared/index.cjs +1 -0
  63. package/shared/index.js +1 -1
  64. package/shared/key-codes.cjs +1 -94
  65. package/shared/key-codes.js +2 -89
  66. package/shared/key-codes2.cjs +87 -1
  67. package/shared/key-codes2.js +83 -2
  68. package/shared/listbox.cjs +6 -7
  69. package/shared/listbox.js +3 -4
  70. package/shared/numbers.cjs +0 -12
  71. package/shared/numbers.js +1 -12
  72. package/shared/presentationDate.cjs +14 -0
  73. package/shared/presentationDate.js +15 -1
  74. package/shared/radio.cjs +92 -117
  75. package/shared/radio.js +93 -118
  76. package/shared/slider.template.cjs +2 -15
  77. package/shared/slider.template.js +2 -14
  78. package/shared/strings.cjs +26 -0
  79. package/shared/strings.js +25 -1
  80. package/styles/core/all.css +1 -1
  81. package/styles/core/theme.css +1 -1
  82. package/styles/core/typography.css +1 -1
  83. package/styles/tokens/theme-dark.css +4 -4
  84. package/styles/tokens/theme-light.css +4 -4
  85. package/styles/tokens/vivid-2-compat.css +1 -1
@@ -1,404 +1,9 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
- import { D as Direction, g as getDirection } from './direction.js';
3
- import { h as keyArrowRight, i as keyArrowLeft, A as ArrowKeys, e as keyArrowUp, f as keyArrowDown, k as keyEnter } from './key-codes.js';
1
+ import { F as FoundationElement, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { f as keyArrowRight, e as keyArrowLeft, d as keyArrowUp, c as keyArrowDown, g as keyEnter } from './key-codes.js';
3
+ import { O as Orientation } from './aria.js';
4
4
  import { R as Radio } from './radio.js';
5
5
  import { s as slotted, e as elements } from './slotted.js';
6
6
  import { w as when } from './when.js';
7
- import { O as Orientation$1 } from './aria.js';
8
-
9
- /**
10
- * Standard orientation values
11
- */
12
- const Orientation = {
13
- horizontal: "horizontal",
14
- vertical: "vertical",
15
- };
16
-
17
- /**
18
- * An Radio Group Custom HTML Element.
19
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radiogroup | ARIA radiogroup }.
20
- *
21
- * @slot label - The slot for the label
22
- * @slot - The default slot for radio buttons
23
- * @csspart positioning-region - The positioning region for laying out the radios
24
- * @fires change - Fires a custom 'change' event when the value changes
25
- *
26
- * @public
27
- */
28
- let RadioGroup$1 = class RadioGroup extends FoundationElement {
29
- constructor() {
30
- super(...arguments);
31
- /**
32
- * The orientation of the group
33
- *
34
- * @public
35
- * @remarks
36
- * HTML Attribute: orientation
37
- */
38
- this.orientation = Orientation.horizontal;
39
- this.radioChangeHandler = (e) => {
40
- const changedRadio = e.target;
41
- if (changedRadio.checked) {
42
- this.slottedRadioButtons.forEach((radio) => {
43
- if (radio !== changedRadio) {
44
- radio.checked = false;
45
- if (!this.isInsideFoundationToolbar) {
46
- radio.setAttribute("tabindex", "-1");
47
- }
48
- }
49
- });
50
- this.selectedRadio = changedRadio;
51
- this.value = changedRadio.value;
52
- changedRadio.setAttribute("tabindex", "0");
53
- this.focusedRadio = changedRadio;
54
- }
55
- e.stopPropagation();
56
- };
57
- this.moveToRadioByIndex = (group, index) => {
58
- const radio = group[index];
59
- if (!this.isInsideToolbar) {
60
- radio.setAttribute("tabindex", "0");
61
- if (radio.readOnly) {
62
- this.slottedRadioButtons.forEach((nextRadio) => {
63
- if (nextRadio !== radio) {
64
- nextRadio.setAttribute("tabindex", "-1");
65
- }
66
- });
67
- }
68
- else {
69
- radio.checked = true;
70
- this.selectedRadio = radio;
71
- }
72
- }
73
- this.focusedRadio = radio;
74
- radio.focus();
75
- };
76
- this.moveRightOffGroup = () => {
77
- var _a;
78
- (_a = this.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
79
- };
80
- this.moveLeftOffGroup = () => {
81
- var _a;
82
- (_a = this.previousElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
83
- };
84
- /**
85
- * @internal
86
- */
87
- this.focusOutHandler = (e) => {
88
- const group = this.slottedRadioButtons;
89
- const radio = e.target;
90
- const index = radio !== null ? group.indexOf(radio) : 0;
91
- const focusedIndex = this.focusedRadio
92
- ? group.indexOf(this.focusedRadio)
93
- : -1;
94
- if ((focusedIndex === 0 && index === focusedIndex) ||
95
- (focusedIndex === group.length - 1 && focusedIndex === index)) {
96
- if (!this.selectedRadio) {
97
- this.focusedRadio = group[0];
98
- this.focusedRadio.setAttribute("tabindex", "0");
99
- group.forEach((nextRadio) => {
100
- if (nextRadio !== this.focusedRadio) {
101
- nextRadio.setAttribute("tabindex", "-1");
102
- }
103
- });
104
- }
105
- else {
106
- this.focusedRadio = this.selectedRadio;
107
- if (!this.isInsideFoundationToolbar) {
108
- this.selectedRadio.setAttribute("tabindex", "0");
109
- group.forEach((nextRadio) => {
110
- if (nextRadio !== this.selectedRadio) {
111
- nextRadio.setAttribute("tabindex", "-1");
112
- }
113
- });
114
- }
115
- }
116
- }
117
- return true;
118
- };
119
- /**
120
- * @internal
121
- */
122
- this.clickHandler = (e) => {
123
- const radio = e.target;
124
- if (radio) {
125
- const group = this.slottedRadioButtons;
126
- if (radio.checked || group.indexOf(radio) === 0) {
127
- radio.setAttribute("tabindex", "0");
128
- this.selectedRadio = radio;
129
- }
130
- else {
131
- radio.setAttribute("tabindex", "-1");
132
- this.selectedRadio = null;
133
- }
134
- this.focusedRadio = radio;
135
- }
136
- e.preventDefault();
137
- };
138
- this.shouldMoveOffGroupToTheRight = (index, group, key) => {
139
- return index === group.length && this.isInsideToolbar && key === keyArrowRight;
140
- };
141
- this.shouldMoveOffGroupToTheLeft = (group, key) => {
142
- const index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
143
- return index < 0 && this.isInsideToolbar && key === keyArrowLeft;
144
- };
145
- this.checkFocusedRadio = () => {
146
- if (this.focusedRadio !== null &&
147
- !this.focusedRadio.readOnly &&
148
- !this.focusedRadio.checked) {
149
- this.focusedRadio.checked = true;
150
- this.focusedRadio.setAttribute("tabindex", "0");
151
- this.focusedRadio.focus();
152
- this.selectedRadio = this.focusedRadio;
153
- }
154
- };
155
- this.moveRight = (e) => {
156
- const group = this.slottedRadioButtons;
157
- let index = 0;
158
- index = this.focusedRadio ? group.indexOf(this.focusedRadio) + 1 : 1;
159
- if (this.shouldMoveOffGroupToTheRight(index, group, e.key)) {
160
- this.moveRightOffGroup();
161
- return;
162
- }
163
- else if (index === group.length) {
164
- index = 0;
165
- }
166
- /* looping to get to next radio that is not disabled */
167
- /* matching native radio/radiogroup which does not select an item if there is only 1 in the group */
168
- while (index < group.length && group.length > 1) {
169
- if (!group[index].disabled) {
170
- this.moveToRadioByIndex(group, index);
171
- break;
172
- }
173
- else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
174
- break;
175
- }
176
- else if (index + 1 >= group.length) {
177
- if (this.isInsideToolbar) {
178
- break;
179
- }
180
- else {
181
- index = 0;
182
- }
183
- }
184
- else {
185
- index += 1;
186
- }
187
- }
188
- };
189
- this.moveLeft = (e) => {
190
- const group = this.slottedRadioButtons;
191
- let index = 0;
192
- index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
193
- index = index < 0 ? group.length - 1 : index;
194
- if (this.shouldMoveOffGroupToTheLeft(group, e.key)) {
195
- this.moveLeftOffGroup();
196
- return;
197
- }
198
- /* looping to get to next radio that is not disabled */
199
- while (index >= 0 && group.length > 1) {
200
- if (!group[index].disabled) {
201
- this.moveToRadioByIndex(group, index);
202
- break;
203
- }
204
- else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
205
- break;
206
- }
207
- else if (index - 1 < 0) {
208
- index = group.length - 1;
209
- }
210
- else {
211
- index -= 1;
212
- }
213
- }
214
- };
215
- /**
216
- * keyboard handling per https://w3c.github.io/aria-practices/#for-radio-groups-not-contained-in-a-toolbar
217
- * navigation is different when there is an ancestor with role='toolbar'
218
- *
219
- * @internal
220
- */
221
- this.keydownHandler = (e) => {
222
- const key = e.key;
223
- if (key in ArrowKeys && this.isInsideFoundationToolbar) {
224
- return true;
225
- }
226
- switch (key) {
227
- case keyEnter: {
228
- this.checkFocusedRadio();
229
- break;
230
- }
231
- case keyArrowRight:
232
- case keyArrowDown: {
233
- if (this.direction === Direction.ltr) {
234
- this.moveRight(e);
235
- }
236
- else {
237
- this.moveLeft(e);
238
- }
239
- break;
240
- }
241
- case keyArrowLeft:
242
- case keyArrowUp: {
243
- if (this.direction === Direction.ltr) {
244
- this.moveLeft(e);
245
- }
246
- else {
247
- this.moveRight(e);
248
- }
249
- break;
250
- }
251
- default: {
252
- return true;
253
- }
254
- }
255
- };
256
- }
257
- readOnlyChanged() {
258
- if (this.slottedRadioButtons !== undefined) {
259
- this.slottedRadioButtons.forEach((radio) => {
260
- if (this.readOnly) {
261
- radio.readOnly = true;
262
- }
263
- else {
264
- radio.readOnly = false;
265
- }
266
- });
267
- }
268
- }
269
- disabledChanged() {
270
- if (this.slottedRadioButtons !== undefined) {
271
- this.slottedRadioButtons.forEach((radio) => {
272
- if (this.disabled) {
273
- radio.disabled = true;
274
- }
275
- else {
276
- radio.disabled = false;
277
- }
278
- });
279
- }
280
- }
281
- nameChanged() {
282
- if (this.slottedRadioButtons) {
283
- this.slottedRadioButtons.forEach((radio) => {
284
- radio.setAttribute("name", this.name);
285
- });
286
- }
287
- }
288
- valueChanged() {
289
- if (this.slottedRadioButtons) {
290
- this.slottedRadioButtons.forEach((radio) => {
291
- if (radio.value === this.value) {
292
- radio.checked = true;
293
- this.selectedRadio = radio;
294
- }
295
- });
296
- }
297
- this.$emit("change");
298
- }
299
- slottedRadioButtonsChanged(oldValue, newValue) {
300
- if (this.slottedRadioButtons && this.slottedRadioButtons.length > 0) {
301
- this.setupRadioButtons();
302
- }
303
- }
304
- get parentToolbar() {
305
- return this.closest('[role="toolbar"]');
306
- }
307
- get isInsideToolbar() {
308
- var _a;
309
- return ((_a = this.parentToolbar) !== null && _a !== void 0 ? _a : false);
310
- }
311
- get isInsideFoundationToolbar() {
312
- var _a;
313
- return !!((_a = this.parentToolbar) === null || _a === void 0 ? void 0 : _a["$fastController"]);
314
- }
315
- /**
316
- * @internal
317
- */
318
- connectedCallback() {
319
- super.connectedCallback();
320
- this.direction = getDirection(this);
321
- this.setupRadioButtons();
322
- }
323
- disconnectedCallback() {
324
- this.slottedRadioButtons.forEach((radio) => {
325
- radio.removeEventListener("change", this.radioChangeHandler);
326
- });
327
- }
328
- setupRadioButtons() {
329
- const checkedRadios = this.slottedRadioButtons.filter((radio) => {
330
- return radio.hasAttribute("checked");
331
- });
332
- const numberOfCheckedRadios = checkedRadios ? checkedRadios.length : 0;
333
- if (numberOfCheckedRadios > 1) {
334
- const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
335
- lastCheckedRadio.checked = true;
336
- }
337
- let foundMatchingVal = false;
338
- this.slottedRadioButtons.forEach((radio) => {
339
- if (this.name !== undefined) {
340
- radio.setAttribute("name", this.name);
341
- }
342
- if (this.disabled) {
343
- radio.disabled = true;
344
- }
345
- if (this.readOnly) {
346
- radio.readOnly = true;
347
- }
348
- if (this.value && this.value === radio.value) {
349
- this.selectedRadio = radio;
350
- this.focusedRadio = radio;
351
- radio.checked = true;
352
- radio.setAttribute("tabindex", "0");
353
- foundMatchingVal = true;
354
- }
355
- else {
356
- if (!this.isInsideFoundationToolbar) {
357
- radio.setAttribute("tabindex", "-1");
358
- }
359
- radio.checked = false;
360
- }
361
- radio.addEventListener("change", this.radioChangeHandler);
362
- });
363
- if (this.value === undefined && this.slottedRadioButtons.length > 0) {
364
- const checkedRadios = this.slottedRadioButtons.filter((radio) => {
365
- return radio.hasAttribute("checked");
366
- });
367
- const numberOfCheckedRadios = checkedRadios !== null ? checkedRadios.length : 0;
368
- if (numberOfCheckedRadios > 0 && !foundMatchingVal) {
369
- const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
370
- lastCheckedRadio.checked = true;
371
- this.focusedRadio = lastCheckedRadio;
372
- lastCheckedRadio.setAttribute("tabindex", "0");
373
- }
374
- else {
375
- this.slottedRadioButtons[0].setAttribute("tabindex", "0");
376
- this.focusedRadio = this.slottedRadioButtons[0];
377
- }
378
- }
379
- }
380
- };
381
- __decorate([
382
- attr({ attribute: "readonly", mode: "boolean" })
383
- ], RadioGroup$1.prototype, "readOnly", void 0);
384
- __decorate([
385
- attr({ attribute: "disabled", mode: "boolean" })
386
- ], RadioGroup$1.prototype, "disabled", void 0);
387
- __decorate([
388
- attr
389
- ], RadioGroup$1.prototype, "name", void 0);
390
- __decorate([
391
- attr
392
- ], RadioGroup$1.prototype, "value", void 0);
393
- __decorate([
394
- attr
395
- ], RadioGroup$1.prototype, "orientation", void 0);
396
- __decorate([
397
- observable
398
- ], RadioGroup$1.prototype, "childItems", void 0);
399
- __decorate([
400
- observable
401
- ], RadioGroup$1.prototype, "slottedRadioButtons", void 0);
402
7
 
403
8
  const styles = ".positioning-region{display:flex;flex-wrap:wrap;gap:8px}.positioning-region.vertical{flex-direction:column}label+.positioning-region{margin-block-start:8px}label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}";
404
9
 
@@ -411,11 +16,234 @@ var __decorateClass = (decorators, target, key, kind) => {
411
16
  if (result) __defProp(target, key, result);
412
17
  return result;
413
18
  };
414
- class RadioGroup extends RadioGroup$1 {
19
+ class RadioGroup extends FoundationElement {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.orientation = // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
23
+ Orientation.horizontal;
24
+ this.slottedRadioButtons = [];
25
+ this.radioChangeHandler = (e) => {
26
+ const changedRadio = e.target;
27
+ if (changedRadio.checked) {
28
+ this.slottedRadioButtons.forEach((radio) => {
29
+ if (radio !== changedRadio) {
30
+ radio.checked = false;
31
+ }
32
+ });
33
+ this.value = changedRadio.value;
34
+ this.#setTabRovingTarget(changedRadio);
35
+ }
36
+ e.stopPropagation();
37
+ };
38
+ this.moveToRadioByIndex = (group, index) => {
39
+ const radio = group[index];
40
+ if (!this.isInsideToolbar && !radio.readOnly) {
41
+ radio.checked = true;
42
+ }
43
+ radio.focus();
44
+ };
45
+ this.moveRightOffGroup = () => {
46
+ this.nextElementSibling?.focus();
47
+ };
48
+ this.moveLeftOffGroup = () => {
49
+ this.previousElementSibling?.focus();
50
+ };
51
+ this.moveRight = (e) => {
52
+ const radio = e.target;
53
+ const group = this.#focusableRadioButtons;
54
+ let index = 0;
55
+ index = group.indexOf(radio) + 1;
56
+ if (index === group.length && this.isInsideToolbar && e.key === keyArrowRight) {
57
+ this.moveRightOffGroup();
58
+ return;
59
+ }
60
+ if (index === group.length) {
61
+ index = 0;
62
+ }
63
+ this.moveToRadioByIndex(group, index);
64
+ };
65
+ this.moveLeft = (e) => {
66
+ const radio = e.target;
67
+ const group = this.#focusableRadioButtons;
68
+ let index = group.indexOf(radio) - 1;
69
+ if (this.isInsideToolbar && e.key === keyArrowLeft && index < 0) {
70
+ this.moveLeftOffGroup();
71
+ return;
72
+ }
73
+ index = index < 0 ? group.length - 1 : index;
74
+ this.moveToRadioByIndex(group, index);
75
+ };
76
+ /**
77
+ * keyboard handling per https://w3c.github.io/aria-practices/#for-radio-groups-not-contained-in-a-toolbar
78
+ * navigation is different when there is an ancestor with role='toolbar'
79
+ *
80
+ * @internal
81
+ */
82
+ this.keydownHandler = (e) => {
83
+ switch (e.key) {
84
+ case keyEnter:
85
+ this.checkFocusedRadio(e.target);
86
+ break;
87
+ case keyArrowRight:
88
+ case keyArrowDown:
89
+ this.moveRight(e);
90
+ break;
91
+ case keyArrowLeft:
92
+ case keyArrowUp:
93
+ this.moveLeft(e);
94
+ break;
95
+ default:
96
+ return true;
97
+ }
98
+ };
99
+ }
100
+ /**
101
+ * @internal
102
+ */
103
+ readOnlyChanged() {
104
+ this.slottedRadioButtons.forEach((radio) => {
105
+ if (this.readOnly) {
106
+ radio.readOnly = true;
107
+ } else {
108
+ radio.readOnly = false;
109
+ }
110
+ });
111
+ }
112
+ /**
113
+ * @internal
114
+ */
115
+ disabledChanged() {
116
+ this.slottedRadioButtons.forEach((radio) => {
117
+ if (this.disabled) {
118
+ radio.disabled = true;
119
+ } else {
120
+ radio.disabled = false;
121
+ }
122
+ });
123
+ }
124
+ nameChanged() {
125
+ this.slottedRadioButtons.forEach((radio) => {
126
+ radio.setAttribute("name", this.name);
127
+ });
128
+ }
129
+ /**
130
+ * @internal
131
+ */
132
+ valueChanged() {
133
+ this.slottedRadioButtons.forEach((radio) => {
134
+ if (radio.value === this.value) {
135
+ radio.checked = true;
136
+ }
137
+ });
138
+ this.$emit("change");
139
+ }
140
+ get #focusableRadioButtons() {
141
+ return this.slottedRadioButtons.filter((radio) => !radio.disabled);
142
+ }
143
+ /**
144
+ * @internal
145
+ */
146
+ slottedRadioButtonsChanged() {
147
+ if (this.slottedRadioButtons && this.slottedRadioButtons.length > 0) {
148
+ this.setupRadioButtons();
149
+ }
150
+ }
151
+ get isInsideToolbar() {
152
+ return !!this.closest('[role="toolbar"]');
153
+ }
154
+ /**
155
+ * @internal
156
+ */
157
+ connectedCallback() {
158
+ super.connectedCallback();
159
+ this.setupRadioButtons();
160
+ }
161
+ disconnectedCallback() {
162
+ this.slottedRadioButtons.forEach((radio) => {
163
+ radio.removeEventListener(
164
+ "change",
165
+ this.radioChangeHandler
166
+ );
167
+ });
168
+ }
169
+ setupRadioButtons() {
170
+ let foundMatchingVal = false;
171
+ for (const radio of this.slottedRadioButtons) {
172
+ if (this.name !== void 0) {
173
+ radio.setAttribute("name", this.name);
174
+ }
175
+ if (this.disabled) {
176
+ radio.disabled = true;
177
+ }
178
+ if (this.readOnly) {
179
+ radio.readOnly = true;
180
+ }
181
+ if (this.value && this.value === radio.value) {
182
+ radio.checked = true;
183
+ this.#setTabRovingTarget(radio);
184
+ foundMatchingVal = true;
185
+ } else {
186
+ radio.checked = false;
187
+ }
188
+ radio.addEventListener(
189
+ "change",
190
+ this.radioChangeHandler
191
+ );
192
+ }
193
+ if (this.value === void 0 && this.slottedRadioButtons.length > 0) {
194
+ const checkedRadios = this.slottedRadioButtons.filter(
195
+ (radio) => radio.hasAttribute("checked")
196
+ );
197
+ if (checkedRadios.length > 0 && !foundMatchingVal) {
198
+ const lastCheckedRadio = checkedRadios[checkedRadios.length - 1];
199
+ lastCheckedRadio.checked = true;
200
+ this.#setTabRovingTarget(lastCheckedRadio);
201
+ } else {
202
+ this.#setTabRovingTarget(this.slottedRadioButtons[0]);
203
+ }
204
+ }
205
+ }
206
+ /**
207
+ * @internal
208
+ */
209
+ focusInHandler(e) {
210
+ this.#setTabRovingTarget(e.target);
211
+ }
212
+ #setTabRovingTarget(radio) {
213
+ radio.setAttribute("tabindex", "0");
214
+ for (const slottedRadio of this.slottedRadioButtons) {
215
+ if (slottedRadio !== radio) {
216
+ slottedRadio.setAttribute("tabindex", "-1");
217
+ }
218
+ }
219
+ }
220
+ checkFocusedRadio(target) {
221
+ if (!target.readOnly) {
222
+ target.checked = true;
223
+ }
224
+ }
415
225
  }
416
226
  __decorateClass([
417
227
  attr
418
228
  ], RadioGroup.prototype, "label");
229
+ __decorateClass([
230
+ attr({ attribute: "readonly", mode: "boolean" })
231
+ ], RadioGroup.prototype, "readOnly");
232
+ __decorateClass([
233
+ attr({ attribute: "disabled", mode: "boolean" })
234
+ ], RadioGroup.prototype, "disabled");
235
+ __decorateClass([
236
+ attr
237
+ ], RadioGroup.prototype, "name");
238
+ __decorateClass([
239
+ attr
240
+ ], RadioGroup.prototype, "value");
241
+ __decorateClass([
242
+ attr
243
+ ], RadioGroup.prototype, "orientation");
244
+ __decorateClass([
245
+ observable
246
+ ], RadioGroup.prototype, "slottedRadioButtons");
419
247
 
420
248
  const RadioGroupTemplate = (context) => {
421
249
  return html`
@@ -424,9 +252,8 @@ const RadioGroupTemplate = (context) => {
424
252
  aria-disabled="${(x) => x.disabled}"
425
253
  aria-readonly="${(x) => x.readOnly}"
426
254
  aria-orientation="${(x) => x.orientation}"
427
- @click="${(x, c) => x.clickHandler(c.event)}"
428
255
  @keydown="${(x, c) => x.keydownHandler(c.event)}"
429
- @focusout="${(x, c) => x.focusOutHandler(c.event)}"
256
+ @focusin="${(x, c) => x.focusInHandler(c.event)}"
430
257
  >
431
258
  ${when(
432
259
  (x) => x.label,
@@ -434,7 +261,7 @@ const RadioGroupTemplate = (context) => {
434
261
  )}
435
262
 
436
263
  <div
437
- class="positioning-region ${(x) => x.orientation === Orientation$1.horizontal ? "horizontal" : "vertical"}"
264
+ class="positioning-region ${(x) => x.orientation === Orientation.horizontal ? "horizontal" : "vertical"}"
438
265
  >
439
266
  <slot
440
267
  ${slotted({
@@ -2,12 +2,13 @@
2
2
 
3
3
  const index = require('./index.cjs');
4
4
  const definition = require('./definition64.cjs');
5
- const keyCodes = require('./key-codes2.cjs');
5
+ const keyCodes = require('./key-codes.cjs');
6
6
  const formAssociated = require('./form-associated.cjs');
7
7
  const slider_template = require('./slider.template.cjs');
8
8
  const aria = require('./aria.cjs');
9
9
  const applyMixins = require('./apply-mixins.cjs');
10
10
  const localized = require('./localized.cjs');
11
+ const numbers = require('./numbers.cjs');
11
12
  const formElements = require('./form-elements.cjs');
12
13
  const ref = require('./ref.cjs');
13
14
  const when = require('./when.cjs');
@@ -382,7 +383,7 @@ calculateValueFromMouseEvent_fn = function(e) {
382
383
  return slider_template.lerp(this.min, this.max, slider_template.inverseLerp(minPos, maxPos, valuePos));
383
384
  };
384
385
  roundToNearestStep_fn = function(thumb, value) {
385
- return slider_template.limit(
386
+ return numbers.limit(
386
387
  __privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].min,
387
388
  __privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].max,
388
389
  slider_template.roundToStepValue(value - this.min, this.step) + this.min
@@ -1,11 +1,12 @@
1
1
  import { F as FoundationElement, o as observable, a as attr, n as nullableNumberConverter, h as html, r as registerFactory } from './index.js';
2
2
  import { P as Popup, a as PlacementStrategy, p as popupRegistries } from './definition64.js';
3
- import { c as keyHome, d as keyEnd, f as keyArrowUp, k as keyArrowLeft, e as keyArrowDown, a as keyArrowRight } from './key-codes2.js';
3
+ import { b as keyHome, a as keyEnd, d as keyArrowUp, e as keyArrowLeft, c as keyArrowDown, f as keyArrowRight } from './key-codes.js';
4
4
  import { F as FormAssociated } from './form-associated.js';
5
- import { i as inverseLerp, l as lerp, a as limit, r as roundToStepValue, g as getMarkersTemplate } from './slider.template.js';
5
+ import { i as inverseLerp, l as lerp, r as roundToStepValue, g as getMarkersTemplate } from './slider.template.js';
6
6
  import { O as Orientation } from './aria.js';
7
7
  import { a as applyMixins } from './apply-mixins.js';
8
8
  import { L as Localized } from './localized.js';
9
+ import { l as limit } from './numbers.js';
9
10
  import { f as formElements } from './form-elements.js';
10
11
  import { r as ref } from './ref.js';
11
12
  import { w as when } from './when.js';