@vonage/vivid 4.14.0 → 4.14.2

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 (218) hide show
  1. package/custom-elements.json +152 -197
  2. package/lib/divider/divider.d.ts +1 -1
  3. package/lib/divider/divider.template.d.ts +1 -1
  4. package/lib/elevation/elevation.d.ts +1 -0
  5. package/lib/radio/radio.form-associated.d.ts +2 -0
  6. package/lib/tabs/tabs.d.ts +0 -5
  7. package/lib/text-anchor/text-anchor.d.ts +2 -2
  8. package/lib/tree-item/tree-item.d.ts +2 -2
  9. package/lib/tree-view/tree-view.d.ts +2 -2
  10. package/package.json +1 -1
  11. package/shared/affix.cjs +8 -8
  12. package/shared/affix.js +2 -2
  13. package/shared/anchor.cjs +10 -10
  14. package/shared/anchor.js +1 -1
  15. package/shared/anchored.cjs +6 -6
  16. package/shared/anchored.js +1 -1
  17. package/shared/apply-mixins.cjs +3 -3
  18. package/shared/apply-mixins.js +1 -1
  19. package/shared/apply-mixins2.cjs +3 -3
  20. package/shared/apply-mixins2.js +1 -1
  21. package/shared/applyMixinsWithObservables.cjs +3 -3
  22. package/shared/applyMixinsWithObservables.js +1 -1
  23. package/shared/aria-global.cjs +20 -20
  24. package/shared/aria-global.js +1 -1
  25. package/shared/base-progress.cjs +7 -8
  26. package/shared/base-progress.js +2 -3
  27. package/shared/breadcrumb-item.cjs +2 -3
  28. package/shared/breadcrumb-item.js +1 -2
  29. package/shared/button.cjs +10 -11
  30. package/shared/button.js +1 -2
  31. package/shared/calendar-event.cjs +7 -8
  32. package/shared/calendar-event.js +1 -2
  33. package/shared/children.cjs +2 -2
  34. package/shared/children.js +1 -1
  35. package/shared/definition.cjs +14 -15
  36. package/shared/definition.js +2 -3
  37. package/shared/definition10.cjs +5 -6
  38. package/shared/definition10.js +1 -2
  39. package/shared/definition11.cjs +29 -29
  40. package/shared/definition11.js +2 -2
  41. package/shared/definition12.cjs +6 -6
  42. package/shared/definition12.js +1 -1
  43. package/shared/definition13.cjs +13 -14
  44. package/shared/definition13.js +1 -2
  45. package/shared/definition14.cjs +23 -24
  46. package/shared/definition14.js +1 -2
  47. package/shared/definition15.cjs +15 -16
  48. package/shared/definition15.js +1 -2
  49. package/shared/definition16.cjs +21 -21
  50. package/shared/definition16.js +5 -5
  51. package/shared/definition17.cjs +62 -61
  52. package/shared/definition17.js +10 -9
  53. package/shared/definition18.cjs +4 -4
  54. package/shared/definition18.js +1 -1
  55. package/shared/definition19.cjs +12 -12
  56. package/shared/definition19.js +1 -1
  57. package/shared/definition2.cjs +6 -7
  58. package/shared/definition2.js +1 -2
  59. package/shared/definition20.cjs +20 -21
  60. package/shared/definition20.js +1 -2
  61. package/shared/definition21.cjs +27 -28
  62. package/shared/definition21.js +3 -4
  63. package/shared/definition22.cjs +7 -7
  64. package/shared/definition22.js +3 -3
  65. package/shared/definition23.cjs +10 -11
  66. package/shared/definition23.js +1 -2
  67. package/shared/definition24.cjs +8 -8
  68. package/shared/definition24.js +3 -3
  69. package/shared/definition25.cjs +13 -14
  70. package/shared/definition25.js +1 -2
  71. package/shared/definition26.cjs +5 -6
  72. package/shared/definition26.js +1 -2
  73. package/shared/definition27.cjs +12 -13
  74. package/shared/definition27.js +2 -3
  75. package/shared/definition28.cjs +9 -10
  76. package/shared/definition28.js +2 -3
  77. package/shared/definition29.cjs +44 -45
  78. package/shared/definition29.js +3 -4
  79. package/shared/definition3.cjs +8 -9
  80. package/shared/definition3.js +1 -2
  81. package/shared/definition30.cjs +9 -10
  82. package/shared/definition30.js +2 -3
  83. package/shared/definition31.cjs +5 -5
  84. package/shared/definition31.js +2 -2
  85. package/shared/definition32.cjs +3 -4
  86. package/shared/definition32.js +1 -2
  87. package/shared/definition33.cjs +6 -7
  88. package/shared/definition33.js +2 -3
  89. package/shared/definition34.cjs +112 -45
  90. package/shared/definition34.js +73 -6
  91. package/shared/definition35.cjs +9 -209
  92. package/shared/definition35.js +4 -202
  93. package/shared/definition36.cjs +15 -16
  94. package/shared/definition36.js +1 -2
  95. package/shared/definition37.cjs +9 -9
  96. package/shared/definition37.js +1 -1
  97. package/shared/definition38.cjs +10 -10
  98. package/shared/definition38.js +1 -1
  99. package/shared/definition39.cjs +12 -13
  100. package/shared/definition39.js +1 -2
  101. package/shared/definition4.cjs +19 -20
  102. package/shared/definition4.js +2 -3
  103. package/shared/definition40.cjs +61 -13
  104. package/shared/definition40.js +52 -4
  105. package/shared/definition41.cjs +29 -30
  106. package/shared/definition41.js +1 -2
  107. package/shared/definition42.cjs +52 -53
  108. package/shared/definition42.js +3 -4
  109. package/shared/definition43.cjs +40 -40
  110. package/shared/definition43.js +6 -6
  111. package/shared/definition44.cjs +14 -15
  112. package/shared/definition44.js +1 -2
  113. package/shared/definition45.cjs +9 -10
  114. package/shared/definition45.js +1 -2
  115. package/shared/definition46.cjs +26 -27
  116. package/shared/definition46.js +1 -2
  117. package/shared/definition47.cjs +17 -18
  118. package/shared/definition47.js +2 -3
  119. package/shared/definition48.cjs +9 -10
  120. package/shared/definition48.js +1 -2
  121. package/shared/definition49.cjs +3 -4
  122. package/shared/definition49.js +1 -2
  123. package/shared/definition5.cjs +30 -31
  124. package/shared/definition5.js +1 -2
  125. package/shared/definition50.cjs +12 -13
  126. package/shared/definition50.js +2 -3
  127. package/shared/definition51.cjs +109 -72
  128. package/shared/definition51.js +78 -41
  129. package/shared/definition52.cjs +4 -5
  130. package/shared/definition52.js +1 -2
  131. package/shared/definition53.cjs +15 -16
  132. package/shared/definition53.js +2 -3
  133. package/shared/definition54.cjs +20 -21
  134. package/shared/definition54.js +1 -2
  135. package/shared/definition55.cjs +5 -5
  136. package/shared/definition55.js +1 -1
  137. package/shared/definition56.cjs +18 -19
  138. package/shared/definition56.js +1 -2
  139. package/shared/definition57.cjs +10 -11
  140. package/shared/definition57.js +1 -2
  141. package/shared/definition58.cjs +7 -8
  142. package/shared/definition58.js +1 -2
  143. package/shared/definition59.cjs +16 -17
  144. package/shared/definition59.js +3 -4
  145. package/shared/definition6.cjs +11 -12
  146. package/shared/definition6.js +1 -2
  147. package/shared/definition60.cjs +9 -10
  148. package/shared/definition60.js +2 -3
  149. package/shared/definition61.cjs +27 -30
  150. package/shared/definition61.js +17 -20
  151. package/shared/definition62.cjs +12 -9
  152. package/shared/definition62.js +8 -5
  153. package/shared/definition63.cjs +13 -14
  154. package/shared/definition63.js +1 -2
  155. package/shared/definition7.cjs +9 -10
  156. package/shared/definition7.js +2 -3
  157. package/shared/definition8.cjs +14 -15
  158. package/shared/definition8.js +2 -3
  159. package/shared/definition9.cjs +7 -7
  160. package/shared/definition9.js +1 -1
  161. package/shared/form-associated.cjs +14 -14
  162. package/shared/form-associated.js +1 -1
  163. package/shared/form-associated2.cjs +10 -10
  164. package/shared/form-associated2.js +1 -1
  165. package/shared/form-elements.cjs +13 -13
  166. package/shared/form-elements.js +1 -1
  167. package/shared/foundation/progress/base-progress.d.ts +2 -2
  168. package/shared/foundation-element.cjs +11 -11
  169. package/shared/foundation-element.js +1 -1
  170. package/shared/key-codes2.cjs +0 -56
  171. package/shared/key-codes2.js +1 -53
  172. package/shared/listbox.cjs +15 -16
  173. package/shared/listbox.js +2 -3
  174. package/shared/localized.cjs +2 -2
  175. package/shared/localized.js +1 -1
  176. package/shared/option.cjs +205 -0
  177. package/shared/option.js +202 -0
  178. package/shared/presentationDate.cjs +42 -43
  179. package/shared/presentationDate.js +1 -2
  180. package/shared/ref.cjs +2 -2
  181. package/shared/ref.js +1 -1
  182. package/shared/repeat.cjs +15 -15
  183. package/shared/repeat.js +1 -1
  184. package/shared/slider.template.cjs +4 -4
  185. package/shared/slider.template.js +1 -1
  186. package/shared/slotted.cjs +4 -4
  187. package/shared/slotted.js +1 -1
  188. package/shared/start-end.cjs +52 -0
  189. package/shared/start-end.js +50 -0
  190. package/shared/text-anchor.cjs +5 -6
  191. package/shared/text-anchor.js +3 -4
  192. package/shared/text-anchor.template.cjs +2 -2
  193. package/shared/text-anchor.template.js +1 -1
  194. package/shared/text-field2.cjs +23 -24
  195. package/shared/text-field2.js +2 -3
  196. package/shared/vivid-element.cjs +2610 -2
  197. package/shared/vivid-element.js +2591 -2
  198. package/styles/core/all.css +40 -1
  199. package/styles/core/theme.css +40 -1
  200. package/styles/core/typography.css +1 -1
  201. package/styles/tokens/theme-dark.css +25 -4
  202. package/styles/tokens/theme-light.css +25 -4
  203. package/styles/tokens/vivid-2-compat.css +1 -1
  204. package/text-anchor/index.cjs +3 -3
  205. package/text-anchor/index.js +1 -1
  206. package/lib/listbox/definition.d.ts +0 -2
  207. package/lib/listbox/listbox.d.ts +0 -14
  208. package/lib/listbox/listbox.template.d.ts +0 -2
  209. package/listbox/index.cjs +0 -54
  210. package/listbox/index.js +0 -52
  211. package/shared/aria-global2.cjs +0 -75
  212. package/shared/aria-global2.js +0 -73
  213. package/shared/defineVividComponent.cjs +0 -2612
  214. package/shared/defineVividComponent.js +0 -2592
  215. package/shared/listbox2.cjs +0 -1268
  216. package/shared/listbox2.js +0 -1265
  217. package/shared/strings2.cjs +0 -37
  218. package/shared/strings2.js +0 -33
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const defineVividComponent = require('./defineVividComponent.cjs');
3
+ const vividElement = require('./vivid-element.cjs');
4
4
  const baseProgress = require('./base-progress.cjs');
5
5
  const when = require('./when.cjs');
6
6
  const classNames = require('./class-names.cjs');
@@ -24,16 +24,16 @@ class Progress extends baseProgress.BaseProgress {
24
24
  }
25
25
  }
26
26
  __decorateClass([
27
- defineVividComponent.attr({ attribute: "aria-label" })
27
+ vividElement.attr({ attribute: "aria-label" })
28
28
  ], Progress.prototype, "ariaLabel");
29
29
  __decorateClass([
30
- defineVividComponent.attr()
30
+ vividElement.attr()
31
31
  ], Progress.prototype, "shape");
32
32
  __decorateClass([
33
- defineVividComponent.attr()
33
+ vividElement.attr()
34
34
  ], Progress.prototype, "connotation");
35
35
  __decorateClass([
36
- defineVividComponent.attr({ mode: "boolean" })
36
+ vividElement.attr({ mode: "boolean" })
37
37
  ], Progress.prototype, "reverse");
38
38
 
39
39
  const getClasses = ({ connotation, shape, reverse, paused }) => classNames.classNames(
@@ -44,18 +44,18 @@ const getClasses = ({ connotation, shape, reverse, paused }) => classNames.class
44
44
  ["paused", Boolean(paused)]
45
45
  );
46
46
  function determinate() {
47
- return defineVividComponent.html` <span
47
+ return vividElement.html` <span
48
48
  class="determinate"
49
49
  style="width: ${(x) => x.percentComplete}%"
50
50
  ></span>`;
51
51
  }
52
52
  function indeterminate() {
53
- return defineVividComponent.html` <span class="indeterminate" name="indeterminate">
53
+ return vividElement.html` <span class="indeterminate" name="indeterminate">
54
54
  <span class="indicator-1"></span>
55
55
  <span class="indicator-2"></span>
56
56
  </span>`;
57
57
  }
58
- const ProgressTemplate = defineVividComponent.html`<template
58
+ const ProgressTemplate = vividElement.html`<template
59
59
  role="${(x) => x.ariaLabel ? "presentation" : null}"
60
60
  >
61
61
  <div
@@ -73,7 +73,7 @@ const ProgressTemplate = defineVividComponent.html`<template
73
73
  </div>
74
74
  </template>`;
75
75
 
76
- const progressDefinition = defineVividComponent.defineVividComponent(
76
+ const progressDefinition = vividElement.defineVividComponent(
77
77
  "progress",
78
78
  Progress,
79
79
  ProgressTemplate,
@@ -82,7 +82,7 @@ const progressDefinition = defineVividComponent.defineVividComponent(
82
82
  styles
83
83
  }
84
84
  );
85
- const registerProgress = defineVividComponent.createRegisterFunction(progressDefinition);
85
+ const registerProgress = vividElement.createRegisterFunction(progressDefinition);
86
86
 
87
87
  exports.progressDefinition = progressDefinition;
88
88
  exports.registerProgress = registerProgress;
@@ -1,4 +1,4 @@
1
- import { a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './defineVividComponent.js';
1
+ import { a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
2
2
  import { B as BaseProgress } from './base-progress.js';
3
3
  import { w as when } from './when.js';
4
4
  import { c as classNames } from './class-names.js';
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const defineVividComponent = require('./defineVividComponent.cjs');
3
+ const vividElement = require('./vivid-element.cjs');
4
4
  const definition = require('./definition40.cjs');
5
5
  const keyCodes = require('./key-codes.cjs');
6
- const vividElement = require('./vivid-element.cjs');
7
6
  const aria = require('./aria.cjs');
8
7
  const slotted = require('./slotted.cjs');
9
8
  const when = require('./when.cjs');
@@ -227,29 +226,29 @@ class RadioGroup extends vividElement.VividElement {
227
226
  }
228
227
  }
229
228
  __decorateClass([
230
- defineVividComponent.attr
229
+ vividElement.attr
231
230
  ], RadioGroup.prototype, "label");
232
231
  __decorateClass([
233
- defineVividComponent.attr({ attribute: "readonly", mode: "boolean" })
232
+ vividElement.attr({ attribute: "readonly", mode: "boolean" })
234
233
  ], RadioGroup.prototype, "readOnly");
235
234
  __decorateClass([
236
- defineVividComponent.attr({ attribute: "disabled", mode: "boolean" })
235
+ vividElement.attr({ attribute: "disabled", mode: "boolean" })
237
236
  ], RadioGroup.prototype, "disabled");
238
237
  __decorateClass([
239
- defineVividComponent.attr
238
+ vividElement.attr
240
239
  ], RadioGroup.prototype, "name");
241
240
  __decorateClass([
242
- defineVividComponent.attr
241
+ vividElement.attr
243
242
  ], RadioGroup.prototype, "value");
244
243
  __decorateClass([
245
- defineVividComponent.attr
244
+ vividElement.attr
246
245
  ], RadioGroup.prototype, "orientation");
247
246
  __decorateClass([
248
- defineVividComponent.observable
247
+ vividElement.observable
249
248
  ], RadioGroup.prototype, "slottedRadioButtons");
250
249
 
251
250
  const RadioGroupTemplate = (context) => {
252
- return defineVividComponent.html`
251
+ return vividElement.html`
253
252
  <template
254
253
  role="radiogroup"
255
254
  aria-disabled="${(x) => x.disabled}"
@@ -260,7 +259,7 @@ const RadioGroupTemplate = (context) => {
260
259
  >
261
260
  ${when.when(
262
261
  (x) => x.label,
263
- defineVividComponent.html`<label>${(x) => x.label}</label>`
262
+ vividElement.html`<label>${(x) => x.label}</label>`
264
263
  )}
265
264
 
266
265
  <div
@@ -277,7 +276,7 @@ const RadioGroupTemplate = (context) => {
277
276
  `;
278
277
  };
279
278
 
280
- const radioGroupDefinition = defineVividComponent.defineVividComponent(
279
+ const radioGroupDefinition = vividElement.defineVividComponent(
281
280
  "radio-group",
282
281
  RadioGroup,
283
282
  RadioGroupTemplate,
@@ -286,7 +285,7 @@ const radioGroupDefinition = defineVividComponent.defineVividComponent(
286
285
  styles
287
286
  }
288
287
  );
289
- const registerRadioGroup = defineVividComponent.createRegisterFunction(radioGroupDefinition);
288
+ const registerRadioGroup = vividElement.createRegisterFunction(radioGroupDefinition);
290
289
 
291
290
  exports.radioGroupDefinition = radioGroupDefinition;
292
291
  exports.registerRadioGroup = registerRadioGroup;
@@ -1,7 +1,6 @@
1
- import { a as attr, o as observable, h as html, d as defineVividComponent, f as createRegisterFunction } from './defineVividComponent.js';
1
+ import { V as VividElement, a as attr, o as observable, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
2
2
  import { R as Radio, r as radioDefinition } from './definition40.js';
3
3
  import { i as keyArrowRight, h as keyArrowLeft, e as keyArrowUp, f as keyArrowDown, k as keyEnter } from './key-codes.js';
4
- import { V as VividElement } from './vivid-element.js';
5
4
  import { O as Orientation } from './aria.js';
6
5
  import { s as slotted, e as elements } from './slotted.js';
7
6
  import { w as when } from './when.js';
@@ -2,13 +2,12 @@
2
2
 
3
3
  const definition$1 = require('./definition11.cjs');
4
4
  const definition = require('./definition62.cjs');
5
- const defineVividComponent = require('./defineVividComponent.cjs');
5
+ const vividElement = require('./vivid-element.cjs');
6
6
  const definition$2 = require('./definition27.cjs');
7
7
  const enums = require('./enums.cjs');
8
8
  const affix = require('./affix.cjs');
9
9
  const applyMixins = require('./apply-mixins.cjs');
10
10
  const index = require('./index.cjs');
11
- const vividElement = require('./vivid-element.cjs');
12
11
  const localized = require('./localized.cjs');
13
12
  const when = require('./when.cjs');
14
13
  const classNames = require('./class-names.cjs');
@@ -106,37 +105,37 @@ class Alert extends vividElement.VividElement {
106
105
  #onTransitionEnd;
107
106
  }
108
107
  __decorateClass([
109
- defineVividComponent.attr({ attribute: "dismiss-button-aria-label" })
108
+ vividElement.attr({ attribute: "dismiss-button-aria-label" })
110
109
  ], Alert.prototype, "dismissButtonAriaLabel");
111
110
  __decorateClass([
112
- defineVividComponent.attr({ mode: "boolean" })
111
+ vividElement.attr({ mode: "boolean" })
113
112
  ], Alert.prototype, "removable");
114
113
  __decorateClass([
115
- defineVividComponent.attr({ mode: "fromView" })
114
+ vividElement.attr({ mode: "fromView" })
116
115
  ], Alert.prototype, "placement");
117
116
  __decorateClass([
118
- defineVividComponent.attr
117
+ vividElement.attr
119
118
  ], Alert.prototype, "headline");
120
119
  __decorateClass([
121
- defineVividComponent.attr
120
+ vividElement.attr
122
121
  ], Alert.prototype, "text");
123
122
  __decorateClass([
124
- defineVividComponent.attr
123
+ vividElement.attr
125
124
  ], Alert.prototype, "icon");
126
125
  __decorateClass([
127
- defineVividComponent.attr({
126
+ vividElement.attr({
128
127
  mode: "fromView",
129
- converter: defineVividComponent.nullableNumberConverter
128
+ converter: vividElement.nullableNumberConverter
130
129
  })
131
130
  ], Alert.prototype, "timeoutms");
132
131
  __decorateClass([
133
- defineVividComponent.attr
132
+ vividElement.attr
134
133
  ], Alert.prototype, "connotation");
135
134
  __decorateClass([
136
- defineVividComponent.attr
135
+ vividElement.attr
137
136
  ], Alert.prototype, "strategy");
138
137
  __decorateClass([
139
- defineVividComponent.attr({ mode: "boolean" })
138
+ vividElement.attr({ mode: "boolean" })
140
139
  ], Alert.prototype, "open");
141
140
  applyMixins.applyMixins(Alert, affix.AffixIcon);
142
141
  applyMixins.applyMixins(Alert, localized.Localized);
@@ -150,10 +149,10 @@ const getControlClasses = ({ open, placement, strategy }) => classNames.classNam
150
149
  );
151
150
  function renderIcon(context) {
152
151
  const affixIconTemplate = affix.affixIconTemplateFactory(context);
153
- return defineVividComponent.html`${(x) => affixIconTemplate(x.conditionedIcon, affix.IconWrapper.Slot)}`;
152
+ return vividElement.html`${(x) => affixIconTemplate(x.conditionedIcon, affix.IconWrapper.Slot)}`;
154
153
  }
155
154
  function renderDismissButton(buttonTag) {
156
- return defineVividComponent.html`
155
+ return vividElement.html`
157
156
  <${buttonTag}
158
157
  aria-label="${(x) => x.dismissButtonAriaLabel || x.locale.alert.dismissButtonLabel}"
159
158
  size="condensed"
@@ -165,7 +164,7 @@ function renderDismissButton(buttonTag) {
165
164
  const AlertTemplate = (context) => {
166
165
  const elevationTag = context.tagFor(definition.Elevation);
167
166
  const buttonTag = context.tagFor(definition$1.Button);
168
- return defineVividComponent.html`
167
+ return vividElement.html`
169
168
  <${elevationTag} class="elevation" dp='8' exportparts="vvd-theme-alternate">
170
169
  <div
171
170
  class="${getControlClasses}"
@@ -177,9 +176,9 @@ const AlertTemplate = (context) => {
177
176
  <div class="alert-text">
178
177
  ${when.when(
179
178
  (x) => x.headline,
180
- defineVividComponent.html`<header class="headline">${(x) => x.headline}</header>`
179
+ vividElement.html`<header class="headline">${(x) => x.headline}</header>`
181
180
  )}
182
- ${when.when((x) => x.text, defineVividComponent.html`<div class="main-text">${(x) => x.text}</div>`)}
181
+ ${when.when((x) => x.text, vividElement.html`<div class="main-text">${(x) => x.text}</div>`)}
183
182
  <slot name="main"></slot>
184
183
  </div>
185
184
  <slot class="action-items" name="action-items"></slot>
@@ -190,7 +189,7 @@ const AlertTemplate = (context) => {
190
189
  `;
191
190
  };
192
191
 
193
- const alertDefinition = defineVividComponent.defineVividComponent(
192
+ const alertDefinition = vividElement.defineVividComponent(
194
193
  "alert",
195
194
  Alert,
196
195
  AlertTemplate,
@@ -199,7 +198,7 @@ const alertDefinition = defineVividComponent.defineVividComponent(
199
198
  styles
200
199
  }
201
200
  );
202
- const registerAlert = defineVividComponent.createRegisterFunction(alertDefinition);
201
+ const registerAlert = vividElement.createRegisterFunction(alertDefinition);
203
202
 
204
203
  exports.alertDefinition = alertDefinition;
205
204
  exports.registerAlert = registerAlert;
@@ -1,12 +1,11 @@
1
1
  import { B as Button, b as buttonDefinition } from './definition11.js';
2
2
  import { E as Elevation, e as elevationDefinition } from './definition62.js';
3
- import { a as attr, n as nullableNumberConverter, h as html, d as defineVividComponent, f as createRegisterFunction } from './defineVividComponent.js';
3
+ import { V as VividElement, a as attr, n as nullableNumberConverter, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
4
4
  import { i as iconDefinition } from './definition27.js';
5
5
  import { C as Connotation } from './enums.js';
6
- import { A as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
6
+ import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
7
7
  import { a as applyMixins } from './apply-mixins.js';
8
8
  import { h as handleEscapeKeyAndStopPropogation } from './index.js';
9
- import { V as VividElement } from './vivid-element.js';
10
9
  import { L as Localized } from './localized.js';
11
10
  import { w as when } from './when.js';
12
11
  import { c as classNames } from './class-names.js';
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const defineVividComponent = require('./defineVividComponent.cjs');
4
- const formAssociated = require('./form-associated.cjs');
5
3
  const vividElement = require('./vivid-element.cjs');
4
+ const formAssociated = require('./form-associated.cjs');
6
5
  const keyCodes = require('./key-codes.cjs');
7
6
  const when = require('./when.cjs');
8
7
  const classNames = require('./class-names.cjs');
@@ -15,7 +14,45 @@ class FormAssociatedRadio extends formAssociated.CheckableFormAssociated(_Radio)
15
14
  constructor() {
16
15
  super(...arguments);
17
16
  this.proxy = document.createElement("input");
17
+ this.#validateValueMissingWithSiblings = () => {
18
+ const siblings = this.#radioSiblings;
19
+ if (siblings && siblings.length > 1) {
20
+ const isSiblingChecked = siblings.some((x) => x.checked);
21
+ if (isSiblingChecked) {
22
+ this.setValidity({ valueMissing: false });
23
+ }
24
+ }
25
+ };
26
+ this.#syncSiblingsRequiredValidationStatus = () => {
27
+ if (this.elementInternals && !this.validity.valueMissing) {
28
+ const siblings = this.#radioSiblings;
29
+ if (siblings && siblings.length > 1) {
30
+ siblings.forEach((x) => {
31
+ x.elementInternals.setValidity({ valueMissing: false });
32
+ });
33
+ }
34
+ }
35
+ };
36
+ this.validate = (anchor) => {
37
+ super.validate(anchor);
38
+ if (this.validity.valueMissing) {
39
+ this.#validateValueMissingWithSiblings();
40
+ } else {
41
+ this.#syncSiblingsRequiredValidationStatus();
42
+ }
43
+ };
18
44
  }
45
+ get #radioSiblings() {
46
+ const siblings = this.parentElement?.querySelectorAll(
47
+ `${this.tagName.toLocaleLowerCase()}[name="${this.name}"]`
48
+ );
49
+ if (siblings) {
50
+ return Array.from(siblings);
51
+ }
52
+ return [];
53
+ }
54
+ #validateValueMissingWithSiblings;
55
+ #syncSiblingsRequiredValidationStatus;
19
56
  }
20
57
 
21
58
  var __defProp = Object.defineProperty;
@@ -53,6 +90,7 @@ class Radio extends FormAssociatedRadio {
53
90
  return true;
54
91
  };
55
92
  this.proxy.setAttribute("type", "radio");
93
+ this.proxy.setAttribute("name", this.name);
56
94
  }
57
95
  // Map to proxy element
58
96
  /**
@@ -74,12 +112,22 @@ class Radio extends FormAssociatedRadio {
74
112
  }
75
113
  }
76
114
  }
115
+ /**
116
+ * @internal
117
+ */
118
+ nameChanged(previous, next) {
119
+ if (super.nameChanged) {
120
+ super.nameChanged(previous, next);
121
+ }
122
+ next !== null ? this.proxy.setAttribute("name", this.name) : this.proxy.removeAttribute("name");
123
+ vividElement.DOM.queueUpdate(this.validate);
124
+ }
77
125
  /**
78
126
  * @internal
79
127
  */
80
128
  connectedCallback() {
81
129
  super.connectedCallback();
82
- this.validate();
130
+ vividElement.DOM.queueUpdate(this.validate);
83
131
  if (this.parentElement.getAttribute("role") !== "radiogroup" && this.getAttribute("tabindex") === null) {
84
132
  if (!this.disabled) {
85
133
  this.setAttribute("tabindex", "0");
@@ -110,22 +158,22 @@ class Radio extends FormAssociatedRadio {
110
158
  }
111
159
  }
112
160
  __decorateClass([
113
- defineVividComponent.attr({ attribute: "aria-label" })
161
+ vividElement.attr({ attribute: "aria-label" })
114
162
  ], Radio.prototype, "ariaLabel");
115
163
  __decorateClass([
116
- defineVividComponent.attr
164
+ vividElement.attr
117
165
  ], Radio.prototype, "label");
118
166
  __decorateClass([
119
- defineVividComponent.attr
167
+ vividElement.attr
120
168
  ], Radio.prototype, "connotation");
121
169
  __decorateClass([
122
- defineVividComponent.attr({ attribute: "readonly", mode: "boolean" })
170
+ vividElement.attr({ attribute: "readonly", mode: "boolean" })
123
171
  ], Radio.prototype, "readOnly");
124
172
  __decorateClass([
125
- defineVividComponent.observable
173
+ vividElement.attr
126
174
  ], Radio.prototype, "name");
127
175
  __decorateClass([
128
- defineVividComponent.observable
176
+ vividElement.observable
129
177
  ], Radio.prototype, "defaultSlottedNodes");
130
178
 
131
179
  const getClasses = ({ connotation, checked, readOnly, disabled }) => classNames.classNames(
@@ -135,7 +183,7 @@ const getClasses = ({ connotation, checked, readOnly, disabled }) => classNames.
135
183
  ["readonly", Boolean(readOnly)],
136
184
  ["disabled", Boolean(disabled)]
137
185
  );
138
- const RadioTemplate = defineVividComponent.html`<template
186
+ const RadioTemplate = vividElement.html`<template
139
187
  role="${(x) => x.ariaLabel ? "presentation" : null}"
140
188
  >
141
189
  <div
@@ -151,12 +199,12 @@ const RadioTemplate = defineVividComponent.html`<template
151
199
  <div class="control"></div>
152
200
  ${when.when(
153
201
  (x) => x.label,
154
- defineVividComponent.html`<label class="label">${(x) => x.label}</label>`
202
+ vividElement.html`<label class="label">${(x) => x.label}</label>`
155
203
  )}
156
204
  </div>
157
205
  </template>`;
158
206
 
159
- const radioDefinition = defineVividComponent.defineVividComponent(
207
+ const radioDefinition = vividElement.defineVividComponent(
160
208
  "radio",
161
209
  Radio,
162
210
  RadioTemplate,
@@ -165,7 +213,7 @@ const radioDefinition = defineVividComponent.defineVividComponent(
165
213
  styles
166
214
  }
167
215
  );
168
- const registerRadio = defineVividComponent.createRegisterFunction(radioDefinition);
216
+ const registerRadio = vividElement.createRegisterFunction(radioDefinition);
169
217
 
170
218
  exports.Radio = Radio;
171
219
  exports.radioDefinition = radioDefinition;
@@ -1,6 +1,5 @@
1
- import { a as attr, o as observable, h as html, d as defineVividComponent, f as createRegisterFunction } from './defineVividComponent.js';
1
+ import { V as VividElement, D as DOM, a as attr, o as observable, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
2
2
  import { C as CheckableFormAssociated } from './form-associated.js';
3
- import { V as VividElement } from './vivid-element.js';
4
3
  import { a as keySpace } from './key-codes.js';
5
4
  import { w as when } from './when.js';
6
5
  import { c as classNames } from './class-names.js';
@@ -13,7 +12,45 @@ class FormAssociatedRadio extends CheckableFormAssociated(_Radio) {
13
12
  constructor() {
14
13
  super(...arguments);
15
14
  this.proxy = document.createElement("input");
15
+ this.#validateValueMissingWithSiblings = () => {
16
+ const siblings = this.#radioSiblings;
17
+ if (siblings && siblings.length > 1) {
18
+ const isSiblingChecked = siblings.some((x) => x.checked);
19
+ if (isSiblingChecked) {
20
+ this.setValidity({ valueMissing: false });
21
+ }
22
+ }
23
+ };
24
+ this.#syncSiblingsRequiredValidationStatus = () => {
25
+ if (this.elementInternals && !this.validity.valueMissing) {
26
+ const siblings = this.#radioSiblings;
27
+ if (siblings && siblings.length > 1) {
28
+ siblings.forEach((x) => {
29
+ x.elementInternals.setValidity({ valueMissing: false });
30
+ });
31
+ }
32
+ }
33
+ };
34
+ this.validate = (anchor) => {
35
+ super.validate(anchor);
36
+ if (this.validity.valueMissing) {
37
+ this.#validateValueMissingWithSiblings();
38
+ } else {
39
+ this.#syncSiblingsRequiredValidationStatus();
40
+ }
41
+ };
42
+ }
43
+ get #radioSiblings() {
44
+ const siblings = this.parentElement?.querySelectorAll(
45
+ `${this.tagName.toLocaleLowerCase()}[name="${this.name}"]`
46
+ );
47
+ if (siblings) {
48
+ return Array.from(siblings);
49
+ }
50
+ return [];
16
51
  }
52
+ #validateValueMissingWithSiblings;
53
+ #syncSiblingsRequiredValidationStatus;
17
54
  }
18
55
 
19
56
  var __defProp = Object.defineProperty;
@@ -51,6 +88,7 @@ class Radio extends FormAssociatedRadio {
51
88
  return true;
52
89
  };
53
90
  this.proxy.setAttribute("type", "radio");
91
+ this.proxy.setAttribute("name", this.name);
54
92
  }
55
93
  // Map to proxy element
56
94
  /**
@@ -72,12 +110,22 @@ class Radio extends FormAssociatedRadio {
72
110
  }
73
111
  }
74
112
  }
113
+ /**
114
+ * @internal
115
+ */
116
+ nameChanged(previous, next) {
117
+ if (super.nameChanged) {
118
+ super.nameChanged(previous, next);
119
+ }
120
+ next !== null ? this.proxy.setAttribute("name", this.name) : this.proxy.removeAttribute("name");
121
+ DOM.queueUpdate(this.validate);
122
+ }
75
123
  /**
76
124
  * @internal
77
125
  */
78
126
  connectedCallback() {
79
127
  super.connectedCallback();
80
- this.validate();
128
+ DOM.queueUpdate(this.validate);
81
129
  if (this.parentElement.getAttribute("role") !== "radiogroup" && this.getAttribute("tabindex") === null) {
82
130
  if (!this.disabled) {
83
131
  this.setAttribute("tabindex", "0");
@@ -120,7 +168,7 @@ __decorateClass([
120
168
  attr({ attribute: "readonly", mode: "boolean" })
121
169
  ], Radio.prototype, "readOnly");
122
170
  __decorateClass([
123
- observable
171
+ attr
124
172
  ], Radio.prototype, "name");
125
173
  __decorateClass([
126
174
  observable