@vonage/vivid 4.24.0 → 4.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (392) hide show
  1. package/custom-elements.json +12314 -4711
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +112 -150
  5. package/index.js +37 -35
  6. package/lib/accordion-item/accordion-item.d.ts +6 -0
  7. package/lib/action-group/action-group.d.ts +6 -0
  8. package/lib/alert/alert.d.ts +20 -0
  9. package/lib/audio-player/audio-player.d.ts +6 -0
  10. package/lib/badge/badge.d.ts +9 -1
  11. package/lib/banner/banner.d.ts +25 -0
  12. package/lib/breadcrumb/breadcrumb.d.ts +6 -0
  13. package/lib/breadcrumb-item/breadcrumb-item.d.ts +63 -7
  14. package/lib/button/button.d.ts +732 -7
  15. package/lib/button/locale.d.ts +3 -0
  16. package/lib/calendar-event/calendar-event.d.ts +6 -0
  17. package/lib/card/card.d.ts +394 -2
  18. package/lib/card/card.template.d.ts +2 -1
  19. package/lib/checkbox/checkbox.d.ts +1822 -5
  20. package/lib/combobox/combobox.d.ts +1827 -20
  21. package/lib/data-grid/data-grid-cell.d.ts +339 -1
  22. package/lib/data-grid/locale.d.ts +5 -0
  23. package/lib/date-picker/date-picker.d.ts +1676 -207
  24. package/lib/date-range-picker/date-range-picker.d.ts +840 -107
  25. package/lib/date-time-picker/date-time-picker.d.ts +1678 -209
  26. package/lib/dial-pad/dial-pad.d.ts +8 -0
  27. package/lib/dialog/dialog.d.ts +12 -0
  28. package/lib/divider/divider.d.ts +6 -0
  29. package/lib/fab/fab.d.ts +6 -0
  30. package/lib/file-picker/file-picker.d.ts +1508 -30
  31. package/lib/header/header.d.ts +6 -0
  32. package/lib/icon/icon.d.ts +1 -0
  33. package/lib/icon/icon.template.d.ts +2 -1
  34. package/lib/menu/menu.d.ts +16 -7
  35. package/lib/menu/name.d.ts +1 -0
  36. package/lib/menu-item/menu-item.d.ts +14 -2
  37. package/lib/nav/nav.d.ts +6 -0
  38. package/lib/nav-disclosure/nav-disclosure.d.ts +13 -0
  39. package/lib/nav-item/nav-item.d.ts +405 -3
  40. package/lib/note/note.d.ts +6 -0
  41. package/lib/number-field/number-field.d.ts +1857 -36
  42. package/lib/option/option.d.ts +12 -0
  43. package/lib/progress/progress.d.ts +6 -0
  44. package/lib/progress-ring/progress-ring.d.ts +6 -0
  45. package/lib/radio/radio.d.ts +1137 -4
  46. package/lib/radio-group/radio-group.d.ts +20 -2
  47. package/lib/range-slider/range-slider.d.ts +752 -5
  48. package/lib/rich-text-editor/definition.d.ts +2 -2
  49. package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +3 -1
  50. package/lib/rich-text-editor/locale.d.ts +1 -0
  51. package/lib/rich-text-editor/menubar/menubar.d.ts +6 -0
  52. package/lib/rich-text-editor/rich-text-editor.d.ts +352 -2
  53. package/lib/searchable-select/option-tag.d.ts +6 -0
  54. package/lib/searchable-select/searchable-select.d.ts +1857 -36
  55. package/lib/select/select.d.ts +1843 -28
  56. package/lib/selectable-box/selectable-box.d.ts +6 -0
  57. package/lib/slider/slider.d.ts +384 -2
  58. package/lib/split-button/split-button.d.ts +18 -0
  59. package/lib/switch/switch.d.ts +386 -3
  60. package/lib/tab/tab.d.ts +18 -1
  61. package/lib/tab-panel/tab-panel.d.ts +6 -0
  62. package/lib/tag/tag.d.ts +12 -0
  63. package/lib/tag-group/tag-group.d.ts +6 -0
  64. package/lib/text-area/text-area.d.ts +2174 -19
  65. package/lib/text-field/text-field.d.ts +2195 -31
  66. package/lib/time-picker/time-picker.d.ts +839 -106
  67. package/lib/toggletip/toggletip.d.ts +10 -4
  68. package/lib/tooltip/tooltip.d.ts +10 -4
  69. package/lib/tree-item/tree-item.d.ts +12 -0
  70. package/lib/tree-view/tree-view.d.ts +6 -0
  71. package/lib/video-player/video-player.d.ts +6 -0
  72. package/lib/visually-hidden/definition.d.ts +4 -0
  73. package/lib/visually-hidden/visually-hidden.d.ts +3 -0
  74. package/lib/visually-hidden/visually-hidden.template.d.ts +3 -0
  75. package/locales/de-DE.cjs +33 -1
  76. package/locales/de-DE.js +33 -1
  77. package/locales/en-GB.cjs +33 -1
  78. package/locales/en-GB.js +33 -1
  79. package/locales/en-US.cjs +33 -1
  80. package/locales/en-US.js +33 -1
  81. package/locales/ja-JP.cjs +33 -1
  82. package/locales/ja-JP.js +33 -1
  83. package/locales/zh-CN.cjs +33 -1
  84. package/locales/zh-CN.js +33 -1
  85. package/menu/index.cjs +1 -1
  86. package/menu/index.js +1 -1
  87. package/nav/index.cjs +1 -1
  88. package/nav/index.js +1 -1
  89. package/nav-disclosure/index.cjs +1 -1
  90. package/nav-disclosure/index.js +1 -1
  91. package/nav-item/index.cjs +1 -1
  92. package/nav-item/index.js +1 -1
  93. package/note/index.cjs +1 -1
  94. package/note/index.js +1 -1
  95. package/number-field/index.cjs +1 -1
  96. package/number-field/index.js +1 -1
  97. package/option/index.cjs +1 -1
  98. package/option/index.js +1 -1
  99. package/package.json +1 -1
  100. package/pagination/index.cjs +1 -1
  101. package/pagination/index.js +1 -1
  102. package/popup/index.cjs +1 -1
  103. package/popup/index.js +1 -1
  104. package/progress/index.cjs +1 -1
  105. package/progress/index.js +1 -1
  106. package/progress-ring/index.cjs +1 -1
  107. package/progress-ring/index.js +1 -1
  108. package/radio/index.cjs +1 -1
  109. package/radio/index.js +1 -1
  110. package/radio-group/index.cjs +1 -1
  111. package/radio-group/index.js +1 -1
  112. package/range-slider/index.cjs +1 -1
  113. package/range-slider/index.js +1 -1
  114. package/rich-text-editor/index.cjs +1 -1
  115. package/rich-text-editor/index.js +1 -1
  116. package/searchable-select/index.cjs +1 -1
  117. package/searchable-select/index.js +1 -1
  118. package/select/index.cjs +1 -1
  119. package/select/index.js +1 -1
  120. package/selectable-box/index.cjs +1 -1
  121. package/selectable-box/index.js +1 -1
  122. package/shared/affix.cjs +13 -7
  123. package/shared/affix.js +13 -8
  124. package/shared/aria/delegates-aria.d.ts +6 -0
  125. package/shared/aria/host-semantics.d.ts +6 -0
  126. package/shared/breadcrumb-item.cjs +2 -5
  127. package/shared/breadcrumb-item.js +2 -5
  128. package/shared/button.cjs +13 -11
  129. package/shared/button.js +13 -11
  130. package/shared/calendar-picker.template.cjs +3 -3
  131. package/shared/calendar-picker.template.js +1 -1
  132. package/shared/char-count.cjs +92 -0
  133. package/shared/char-count.js +90 -0
  134. package/shared/definition.js +1 -1
  135. package/shared/definition10.js +1 -1
  136. package/shared/definition11.cjs +27 -44
  137. package/shared/definition11.js +28 -45
  138. package/shared/definition12.js +1 -1
  139. package/shared/definition13.js +1 -1
  140. package/shared/definition14.cjs +53 -22
  141. package/shared/definition14.js +54 -23
  142. package/shared/definition15.cjs +31 -36
  143. package/shared/definition15.js +30 -36
  144. package/shared/definition16.cjs +43 -63
  145. package/shared/definition16.js +42 -63
  146. package/shared/definition17.cjs +8 -4
  147. package/shared/definition17.js +8 -4
  148. package/shared/definition18.cjs +10 -14
  149. package/shared/definition18.js +9 -14
  150. package/shared/definition19.cjs +85 -100
  151. package/shared/definition19.js +75 -91
  152. package/shared/definition2.js +1 -1
  153. package/shared/definition20.cjs +15 -20
  154. package/shared/definition20.js +14 -20
  155. package/shared/definition21.cjs +22 -3
  156. package/shared/definition21.js +23 -4
  157. package/shared/definition22.cjs +4 -4
  158. package/shared/definition22.js +5 -5
  159. package/shared/definition23.cjs +5 -38
  160. package/shared/definition23.js +5 -37
  161. package/shared/definition24.cjs +2 -7
  162. package/shared/definition24.js +3 -8
  163. package/shared/definition25.js +1 -1
  164. package/shared/definition26.cjs +157 -171
  165. package/shared/definition26.js +156 -171
  166. package/shared/definition27.cjs +1 -1
  167. package/shared/definition27.js +2 -2
  168. package/shared/definition28.cjs +32 -17
  169. package/shared/definition28.js +33 -18
  170. package/shared/definition29.js +1 -1
  171. package/shared/definition3.js +1 -1
  172. package/shared/definition30.cjs +96 -482
  173. package/shared/definition30.js +99 -482
  174. package/shared/definition31.cjs +334 -57
  175. package/shared/definition31.js +333 -56
  176. package/shared/definition32.cjs +104 -19
  177. package/shared/definition32.js +105 -20
  178. package/shared/definition33.cjs +67 -15
  179. package/shared/definition33.js +66 -14
  180. package/shared/definition34.cjs +15 -50
  181. package/shared/definition34.js +14 -49
  182. package/shared/definition35.cjs +28 -397
  183. package/shared/definition35.js +27 -397
  184. package/shared/definition36.cjs +404 -54
  185. package/shared/definition36.js +404 -55
  186. package/shared/definition37.cjs +57 -234
  187. package/shared/definition37.js +57 -233
  188. package/shared/definition38.cjs +221 -66
  189. package/shared/definition38.js +220 -65
  190. package/shared/definition39.cjs +52 -44
  191. package/shared/definition39.js +51 -43
  192. package/shared/definition4.cjs +31 -24
  193. package/shared/definition4.js +33 -26
  194. package/shared/definition40.cjs +56 -266
  195. package/shared/definition40.js +55 -265
  196. package/shared/definition41.cjs +285 -142
  197. package/shared/definition41.js +285 -142
  198. package/shared/definition42.cjs +156 -564
  199. package/shared/definition42.js +156 -565
  200. package/shared/definition43.cjs +554 -14378
  201. package/shared/definition43.js +553 -14377
  202. package/shared/definition44.cjs +14418 -1155
  203. package/shared/definition44.js +14417 -1156
  204. package/shared/definition45.cjs +1049 -677
  205. package/shared/definition45.js +1050 -678
  206. package/shared/definition46.cjs +848 -113
  207. package/shared/definition46.js +847 -112
  208. package/shared/definition47.cjs +125 -90
  209. package/shared/definition47.js +124 -89
  210. package/shared/definition48.cjs +88 -455
  211. package/shared/definition48.js +87 -454
  212. package/shared/definition49.cjs +466 -109
  213. package/shared/definition49.js +466 -109
  214. package/shared/definition5.cjs +8 -7
  215. package/shared/definition5.js +6 -5
  216. package/shared/definition50.cjs +106 -106
  217. package/shared/definition50.js +105 -105
  218. package/shared/definition51.cjs +136 -15
  219. package/shared/definition51.js +135 -14
  220. package/shared/definition52.cjs +16 -115
  221. package/shared/definition52.js +15 -114
  222. package/shared/definition53.cjs +78 -412
  223. package/shared/definition53.js +77 -410
  224. package/shared/definition54.cjs +445 -23
  225. package/shared/definition54.js +443 -22
  226. package/shared/definition55.cjs +22 -136
  227. package/shared/definition55.js +21 -135
  228. package/shared/definition56.cjs +95 -291
  229. package/shared/definition56.js +95 -292
  230. package/shared/definition57.cjs +192 -480
  231. package/shared/definition57.js +190 -479
  232. package/shared/definition58.cjs +411 -24
  233. package/shared/definition58.js +410 -24
  234. package/shared/definition59.cjs +27 -144
  235. package/shared/definition59.js +27 -143
  236. package/shared/definition6.js +1 -1
  237. package/shared/definition60.cjs +83 -54
  238. package/shared/definition60.js +82 -53
  239. package/shared/definition61.cjs +78 -166
  240. package/shared/definition61.js +77 -164
  241. package/shared/definition62.cjs +143 -232
  242. package/shared/definition62.js +141 -231
  243. package/shared/definition63.cjs +234 -69417
  244. package/shared/definition63.js +233 -69416
  245. package/shared/definition64.cjs +69454 -28
  246. package/shared/definition64.js +69453 -27
  247. package/shared/definition65.cjs +28 -2168
  248. package/shared/definition65.js +27 -2166
  249. package/shared/definition66.cjs +27 -0
  250. package/shared/definition66.js +23 -0
  251. package/shared/definition67.cjs +2195 -0
  252. package/shared/definition67.js +2190 -0
  253. package/shared/definition7.cjs +11 -2
  254. package/shared/definition7.js +12 -3
  255. package/shared/definition8.cjs +24 -11
  256. package/shared/definition8.js +26 -13
  257. package/shared/definition9.cjs +1 -2
  258. package/shared/definition9.js +2 -3
  259. package/shared/delegates-aria.js +1 -1
  260. package/shared/deprecation/replaced-props.d.ts +20 -0
  261. package/shared/divider.cjs +41 -0
  262. package/shared/divider.js +38 -0
  263. package/shared/feedback/feedback-message.d.ts +345 -0
  264. package/shared/feedback/locale.d.ts +4 -0
  265. package/{lib/text-anchor/text-anchor.d.ts → shared/feedback/mixins.d.ts} +62 -39
  266. package/shared/form-associated.cjs +124 -100
  267. package/shared/form-associated.js +125 -101
  268. package/shared/form-element.cjs +84 -0
  269. package/shared/form-element.js +82 -0
  270. package/shared/foundation/button/button.d.ts +378 -2
  271. package/shared/foundation/form-associated/form-associated.d.ts +753 -49
  272. package/shared/foundation/listbox/listbox.d.ts +1 -1
  273. package/shared/foundation/vivid-element/vivid-element.d.ts +14 -0
  274. package/shared/host-semantics.js +1 -1
  275. package/shared/key-codes.js +1 -1
  276. package/shared/linkable.cjs +70 -0
  277. package/shared/linkable.js +68 -0
  278. package/shared/localization/Locale.d.ts +14 -0
  279. package/shared/mixins.cjs +306 -0
  280. package/shared/mixins.js +300 -0
  281. package/shared/patterns/affix.d.ts +16 -1
  282. package/shared/patterns/anchored.d.ts +20 -8
  283. package/shared/patterns/char-count/char-count.d.ts +351 -0
  284. package/shared/patterns/char-count/index.d.ts +1 -0
  285. package/shared/patterns/char-count/locale.d.ts +4 -0
  286. package/shared/patterns/form-elements/form-element.d.ts +744 -0
  287. package/shared/patterns/form-elements/index.d.ts +3 -1
  288. package/shared/patterns/form-elements/with-error-text.d.ts +1122 -0
  289. package/shared/patterns/form-elements/with-success-text.d.ts +341 -0
  290. package/shared/patterns/index.d.ts +2 -0
  291. package/shared/patterns/linkable.d.ts +394 -0
  292. package/shared/patterns/localized.d.ts +6 -0
  293. package/shared/patterns/trapped-focus.d.ts +6 -0
  294. package/shared/picker-field/mixins/calendar-picker.d.ts +420 -52
  295. package/shared/picker-field/mixins/calendar-picker.template.d.ts +420 -52
  296. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +6 -0
  297. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +843 -107
  298. package/shared/picker-field/mixins/single-date-picker.d.ts +1259 -155
  299. package/shared/picker-field/mixins/single-value-picker.d.ts +417 -49
  300. package/shared/picker-field/mixins/time-selection-picker.d.ts +842 -106
  301. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +839 -103
  302. package/shared/picker-field/picker-field.d.ts +1491 -15
  303. package/shared/picker-field.template.cjs +13 -22
  304. package/shared/picker-field.template.js +14 -23
  305. package/shared/repeat.js +1 -1
  306. package/shared/slider.template.cjs +1 -1
  307. package/shared/slider.template.js +1 -1
  308. package/shared/time-selection-picker.template.cjs +10 -15
  309. package/shared/time-selection-picker.template.js +10 -16
  310. package/shared/vivid-element.cjs +53 -4
  311. package/shared/vivid-element.js +53 -3
  312. package/shared/with-error-text.cjs +56 -0
  313. package/shared/with-error-text.js +54 -0
  314. package/shared/with-success-text.cjs +23 -0
  315. package/shared/with-success-text.js +21 -0
  316. package/side-drawer/index.cjs +1 -1
  317. package/side-drawer/index.js +1 -1
  318. package/slider/index.cjs +1 -1
  319. package/slider/index.js +1 -1
  320. package/split-button/index.cjs +1 -1
  321. package/split-button/index.js +1 -1
  322. package/styles/core/all.css +1 -1
  323. package/styles/core/theme.css +1 -1
  324. package/styles/core/typography.css +1 -1
  325. package/styles/tokens/theme-dark.css +4 -4
  326. package/styles/tokens/theme-light.css +4 -4
  327. package/styles/tokens/vivid-2-compat.css +1 -1
  328. package/switch/index.cjs +1 -1
  329. package/switch/index.js +1 -1
  330. package/tab/index.cjs +1 -1
  331. package/tab/index.js +1 -1
  332. package/tab-panel/index.cjs +1 -1
  333. package/tab-panel/index.js +1 -1
  334. package/tabs/index.cjs +1 -1
  335. package/tabs/index.js +1 -1
  336. package/tag/index.cjs +1 -1
  337. package/tag/index.js +1 -1
  338. package/tag-group/index.cjs +1 -1
  339. package/tag-group/index.js +1 -1
  340. package/text-area/index.cjs +1 -1
  341. package/text-area/index.js +1 -1
  342. package/text-field/index.cjs +1 -1
  343. package/text-field/index.js +1 -1
  344. package/time-picker/index.cjs +1 -1
  345. package/time-picker/index.js +1 -1
  346. package/toggletip/index.cjs +1 -1
  347. package/toggletip/index.js +1 -1
  348. package/tooltip/index.cjs +1 -1
  349. package/tooltip/index.js +1 -1
  350. package/tree-item/index.cjs +1 -1
  351. package/tree-item/index.js +1 -1
  352. package/tree-view/index.cjs +1 -1
  353. package/tree-view/index.js +1 -1
  354. package/video-player/index.cjs +1 -1
  355. package/video-player/index.js +1 -1
  356. package/visually-hidden/index.cjs +5 -0
  357. package/visually-hidden/index.js +3 -0
  358. package/vivid.api.json +744 -1490
  359. package/lib/checkbox/checkbox.form-associated.d.ts +0 -11
  360. package/lib/file-picker/file-picker.form-associated.d.ts +0 -11
  361. package/lib/number-field/number-field.form-associated.d.ts +0 -11
  362. package/lib/radio/radio.form-associated.d.ts +0 -13
  363. package/lib/range-slider/range-slider.form-associated.d.ts +0 -11
  364. package/lib/searchable-select/searchable-select.form-associated.d.ts +0 -11
  365. package/lib/select/select.form-associated.d.ts +0 -11
  366. package/lib/slider/slider.form-associated.d.ts +0 -11
  367. package/lib/switch/switch.form-associated.d.ts +0 -11
  368. package/lib/text-anchor/definition.d.ts +0 -2
  369. package/lib/text-anchor/text-anchor.template.d.ts +0 -3
  370. package/lib/text-area/text-area.form-associated.d.ts +0 -11
  371. package/lib/text-field/text-field.form-associated.d.ts +0 -11
  372. package/shared/anchor.cjs +0 -49
  373. package/shared/anchor.js +0 -47
  374. package/shared/apply-mixins.cjs +0 -23
  375. package/shared/apply-mixins.js +0 -21
  376. package/shared/applyMixinsWithObservables.cjs +0 -15
  377. package/shared/applyMixinsWithObservables.js +0 -13
  378. package/shared/direction.cjs +0 -17
  379. package/shared/direction.js +0 -15
  380. package/shared/form-elements.cjs +0 -209
  381. package/shared/form-elements.js +0 -202
  382. package/shared/foundation/anchor/anchor.d.ts +0 -11
  383. package/shared/foundation/utilities/apply-mixins.d.ts +0 -1
  384. package/shared/patterns/form-elements/form-elements.d.ts +0 -58
  385. package/shared/picker-field/picker-field.form-associated.d.ts +0 -11
  386. package/shared/text-anchor.cjs +0 -38
  387. package/shared/text-anchor.js +0 -36
  388. package/shared/text-anchor.template.cjs +0 -35
  389. package/shared/text-anchor.template.js +0 -33
  390. package/shared/utils/applyMixinsWithObservables.d.ts +0 -1
  391. package/text-anchor/index.cjs +0 -17
  392. package/text-anchor/index.js +0 -15
@@ -1,638 +1,230 @@
1
1
  'use strict';
2
2
 
3
- const definition = require('./definition65.cjs');
4
3
  const vividElement = require('./vivid-element.cjs');
5
- const keyCodes = require('./key-codes.cjs');
6
4
  const formAssociated = require('./form-associated.cjs');
7
- const slider_template = require('./slider.template.cjs');
8
- const localized = require('./localized.cjs');
9
- const aria = require('./aria.cjs');
10
- const numbers = require('./numbers.cjs');
11
- const formElements = require('./form-elements.cjs');
5
+ const withErrorText = require('./with-error-text.cjs');
6
+ const formElement = require('./form-element.cjs');
7
+ const keyCodes = require('./key-codes.cjs');
12
8
  const classNames = require('./class-names.cjs');
13
- const ref = require('./ref.cjs');
14
9
  const when = require('./when.cjs');
15
10
 
16
- const styles = ":host{display:inline-block}:host(:not([orientation=vertical])){inline-size:100%}:host([orientation=vertical]){block-size:100%;min-block-size:calc(var(--_thumb-interaction-indicator-size) * 5)}:host([disabled]){cursor:not-allowed}.control.connotation-cta{--_connotation-color-primary: var(--vvd-slider-cta-primary, var(--vvd-color-cta-500))}.control:not(.connotation-cta){--_connotation-color-primary: var(--vvd-slider-accent-primary, var(--vvd-color-canvas-text))}.control{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control{--_thumb-size: 12px;--_thumb-interaction-indicator-size: 36px;--_track-start-inset-inline-start: 0;--_track-start-inset-block-start: 0;cursor:pointer;outline:none;user-select:none}.control .positioning-region{position:relative}.control .track{position:absolute;border-radius:4px;background:var(--_track-background-color)}.control .track-start{position:absolute;border-radius:inherit;background:var(--_track-start-background-color);block-size:100%;inset-inline-start:var(--_track-start-inset-inline-start)}.control.horizontal{block-size:var(--_thumb-interaction-indicator-size);inline-size:calc(100% - var(--_thumb-size));margin-inline-start:calc(var(--_thumb-size) / 2);min-inline-size:var(--_thumb-size)}.control.horizontal .track{top:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);right:0;left:0;block-size:2px}:host([markers]) .control.horizontal .track-start{--_track-start-inset-inline-start: 1px;border-bottom-left-radius:0;border-top-left-radius:0}.control.horizontal .track .mark{position:absolute;block-size:6px;inline-size:100%;inset-block-start:-2px;inset-inline-start:0}.control.vertical{margin-top:calc(var(--_thumb-interaction-indicator-size) / 2);block-size:calc(100% - var(--_thumb-interaction-indicator-size));inline-size:var(--_thumb-interaction-indicator-size);min-block-size:var(--_thumb-interaction-indicator-size)}.control.vertical .positioning-region{block-size:100%}.control.vertical .track{left:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);block-size:100%;inline-size:2px}.control.vertical .track .mark{position:absolute;block-size:100%;inline-size:6px;inset-block-start:0;inset-inline-start:-2px}.control.vertical .track-start{block-size:auto;inline-size:100%;inset-block-start:var(--_track-start-inset-block-start)}:host([markers]) .control.vertical .track-start{--_track-start-inset-block-start: 1px;border-radius:0}.control.disabled{--_track-background-color: var(--vvd-color-neutral-100);--_track-start-background-color: var(--vvd-color-neutral-300);pointer-events:none}.control:not(.disabled){--_track-background-color: var(--vvd-color-neutral-300);--_track-start-background-color: var(--_appearance-color-fill)}.control:not(.disabled) .mark{color:var(--vvd-color-neutral-950)}.control.disabled .mark{color:var(--_track-start-background-color)}.thumb-container{position:absolute;border-radius:50%;block-size:var(--_thumb-interaction-indicator-size);cursor:inherit;inline-size:var(--_thumb-interaction-indicator-size);outline:none;touch-action:none}.thumb-container.focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--_thumb-interaction-indicator-alpha: .05;border-radius:50%}.control.horizontal .thumb-container{transform:translate(calc(var(--_thumb-interaction-indicator-size) / 2))}.control.vertical .thumb-container{transform:translateY(calc(var(--_thumb-interaction-indicator-size) / 2))}.control:not(.disabled) .thumb-container:hover{--_thumb-interaction-indicator-alpha: .12}.control:not(.disabled) .thumb-container:active{--_thumb-interaction-indicator-alpha: .25}.thumb-container:before{position:absolute;display:block;border-radius:inherit;background-color:var(--_track-start-background-color);block-size:var(--_thumb-interaction-indicator-size);content:\"\";inline-size:var(--_thumb-interaction-indicator-size);opacity:var(--_thumb-interaction-indicator-alpha, 0);transition:opacity .2s ease-out 0s}.thumb-container:after{position:absolute;display:block;border-radius:inherit;background-color:var(--_track-start-background-color);block-size:var(--_thumb-size);content:\"\";inline-size:var(--_thumb-size);inset:calc((var(--_thumb-interaction-indicator-size) - var(--_thumb-size)) / 2)}.popup{pointer-events:none}.tooltip{width:auto;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}:host([internal-part]) .thumb-container{opacity:0;transition:opacity .2s ease}:host([internal-part]) .control.horizontal .track{top:16px;block-size:4px;overflow:hidden}:host([internal-part]) .control:hover .thumb-container,:host([internal-part]) .control:focus .thumb-container{opacity:1}.control{--_track-start-inset-inline-start: auto;--_track-start-inset-block-start: auto}:host([markers]) .control.horizontal .track-start,:host([markers]) .control.vertical .track-start{--_track-start-inset-inline-start: auto;--_track-start-inset-block-start: auto}";
17
-
18
- class _RangeSlider extends vividElement.VividElement {
19
- }
20
- class FormAssociatedRangeSlider extends formAssociated.FormAssociated(_RangeSlider) {
21
- constructor() {
22
- super(...arguments);
23
- this.proxy = document.createElement("input");
24
- }
25
- }
11
+ const styles = ":host(:focus-visible){outline:none}:host([disabled]){cursor:not-allowed}.base.connotation-cta{--_connotation-color-primary: var(--vvd-radio-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-radio-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-radio-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-intermediate: var(--vvd-radio-cta-intermediate, var(--vvd-color-cta-500));--_connotation-color-firm: var(--vvd-radio-cta-firm, var(--vvd-color-cta-600));--_connotation-color-fierce: var(--vvd-radio-cta-fierce, var(--vvd-color-cta-700))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-radio-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-radio-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-radio-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-radio-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-radio-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-radio-accent-fierce, var(--vvd-color-neutral-700))}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-500)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.base:where(.checked,:checked):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: var(--_connotation-color-primary)}.base:where(.checked,:checked):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: var(--_connotation-color-primary-increment)}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base{display:inline-flex;align-items:center;cursor:pointer;gap:8px}@supports (user-select: none){.base{user-select:none}}.base.disabled{pointer-events:none}.control{position:relative;flex-shrink:0;border-radius:50%;block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 2px var(--_appearance-color-outline);inline-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base:not(.checked) .control{background-color:var(--_appearance-color-fill)}.control:after{position:absolute;border-radius:inherit;background-color:var(--_appearance-color-outline);content:\"\";inset:5px;opacity:1;transition:opacity .2s}.base:not(.checked) .control:after{opacity:0}:host(:focus-visible) .control{--focus-stroke-gap-color: transparent;position:relative}:host(:focus-visible) .control:before{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));position:absolute;display:block;border-radius:var(--focus-border-radius, inherit);block-size:calc(100% + var(--focus-block-size-addition, 4px));content:\"\";inline-size:calc(100% + var(--focus-block-size-addition, 4px));inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}label{color:var(--vvd-color-canvas-text);cursor:pointer;font:var(--vvd-typography-base)}";
26
12
 
27
13
  var __defProp = Object.defineProperty;
28
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
29
- var __typeError = (msg) => {
30
- throw TypeError(msg);
31
- };
32
14
  var __decorateClass = (decorators, target, key, kind) => {
33
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
15
+ var result = void 0 ;
34
16
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
35
17
  if (decorator = decorators[i])
36
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
37
- if (kind && result) __defProp(target, key, result);
18
+ result = (decorator(target, key, result) ) || result;
19
+ if (result) __defProp(target, key, result);
38
20
  return result;
39
21
  };
40
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
41
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
42
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
43
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
44
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
45
- var _isInternalValueUpdate, _RangeSlider_instances, updateValues_fn, applyStep_fn, updateFormValue_fn, thumbs_get, thumbConstraints_get, getThumbId_fn, getThumbIdFromEvent_fn, updateThumbPositions_fn, thumbTrackEndOffset_fn, calculateValueFromMouseEvent_fn, roundToNearestStep_fn, _isNonVisibleFocus, focusThumbNonVisibly_fn, registerThumbListeners_fn, unregisterThumbListeners_fn, _onThumbFocus, _onThumbBlur, _onMouseOver, _onMouseOut, _onThumbMousedown, _onThumbKeydown, registerDragHandlers_fn, unregisterDragListeners_fn, _onDragMove, _onDragEnd;
46
- const Direction = {
47
- Increment: 1,
48
- Decrement: -1
49
- };
50
- exports.RangeSlider = class RangeSlider extends localized.Localized(FormAssociatedRangeSlider) {
22
+ class Radio extends withErrorText.WithErrorText(
23
+ formElement.FormElement(formAssociated.CheckableFormAssociated(vividElement.VividElement))
24
+ ) {
51
25
  constructor() {
52
- super(...arguments);
53
- __privateAdd(this, _RangeSlider_instances);
54
- // --- Start & end values ---
55
- __privateAdd(this, _isInternalValueUpdate, false);
56
- this.start = "";
57
- this.end = "";
58
- this.min = 0;
59
- this.max = 10;
60
- this.step = 1;
61
- this.orientation = aria.Orientation.horizontal;
62
- this.ariaStartLabel = null;
63
- this.ariaEndLabel = null;
64
- this.markers = false;
65
- this.pin = false;
66
- this.valueTextFormatter = (value) => parseFloat(value).toLocaleString(this.locale.lang);
67
- // --- Thumbs ---
26
+ super();
27
+ this.ariaLabel = null;
68
28
  /**
29
+ * The element's value to be included in form submission when checked.
30
+ * Default to "on" to reach parity with input[type="radio"]
31
+ *
69
32
  * @internal
70
33
  */
71
- this._trackEl = null;
34
+ this.initialValue = "on";
35
+ this.defaultSlottedNodes = [];
72
36
  /**
73
37
  * @internal
74
38
  */
75
- this._startThumbEl = null;
39
+ this.keypressHandler = (e) => {
40
+ switch (e.key) {
41
+ case keyCodes.keySpace:
42
+ if (!this.checked && !this.readOnly) {
43
+ this.checked = true;
44
+ }
45
+ return;
46
+ }
47
+ return true;
48
+ };
76
49
  /**
77
50
  * @internal
78
51
  */
79
- this._endThumbEl = null;
80
- this._draggingThumb = false;
81
- this._visiblyFocusedThumb = null;
82
- this._hoveredThumb = null;
83
- this._startThumbCss = "";
84
- this._endThumbCss = "";
85
- this._selectedRangeCss = "";
86
- __privateAdd(this, _isNonVisibleFocus, false);
87
- __privateAdd(this, _onThumbFocus, (e) => {
88
- if (!__privateGet(this, _isNonVisibleFocus)) {
89
- this._visiblyFocusedThumb = __privateMethod(this, _RangeSlider_instances, getThumbIdFromEvent_fn).call(this, e);
90
- }
91
- });
92
- __privateAdd(this, _onThumbBlur, () => {
93
- this._visiblyFocusedThumb = null;
94
- });
95
- __privateAdd(this, _onMouseOver, (e) => {
96
- this._hoveredThumb = __privateMethod(this, _RangeSlider_instances, getThumbIdFromEvent_fn).call(this, e);
97
- });
98
- __privateAdd(this, _onMouseOut, () => {
99
- this._hoveredThumb = null;
100
- });
101
- __privateAdd(this, _onThumbMousedown, (event) => {
102
- if (this.disabled || event.defaultPrevented) {
103
- return;
104
- }
105
- let target = event.target;
106
- if (target === this._endThumbEl && this.startAsNumber === this.max && this.endAsNumber === this.max) {
107
- target = this._startThumbEl;
108
- }
109
- __privateMethod(this, _RangeSlider_instances, focusThumbNonVisibly_fn).call(this, target);
110
- this._draggingThumb = __privateMethod(this, _RangeSlider_instances, getThumbId_fn).call(this, target);
111
- __privateMethod(this, _RangeSlider_instances, registerDragHandlers_fn).call(this);
112
- });
113
- __privateAdd(this, _onThumbKeydown, (e) => {
114
- const thumb = __privateMethod(this, _RangeSlider_instances, getThumbIdFromEvent_fn).call(this, e);
115
- this._visiblyFocusedThumb = thumb;
116
- if (e.key === keyCodes.keyHome) {
117
- e.preventDefault();
118
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, { [thumb]: `${__privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].min}` });
119
- } else if (e.key === keyCodes.keyEnd) {
120
- e.preventDefault();
121
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, { [thumb]: `${__privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].max}` });
122
- } else if (!e.shiftKey) {
123
- switch (e.key) {
124
- case keyCodes.keyArrowRight:
125
- case keyCodes.keyArrowDown:
126
- e.preventDefault();
127
- __privateMethod(this, _RangeSlider_instances, applyStep_fn).call(this, thumb, Direction.Increment);
128
- break;
129
- case keyCodes.keyArrowLeft:
130
- case keyCodes.keyArrowUp:
131
- e.preventDefault();
132
- __privateMethod(this, _RangeSlider_instances, applyStep_fn).call(this, thumb, Direction.Decrement);
133
- break;
52
+ this.proxy = document.createElement("input");
53
+ this.#validateValueMissingWithSiblings = () => {
54
+ const siblings = this.#radioSiblings;
55
+ const group = this.#radioGroup;
56
+ if (siblings && siblings.length > 1) {
57
+ const isSiblingChecked = siblings.some((x) => x.checked);
58
+ if (isSiblingChecked) {
59
+ this.setValidity({ valueMissing: false });
60
+ this.errorValidationMessage = "";
61
+ if (group) group.errorValidationMessage = "";
134
62
  }
135
63
  }
136
- });
137
- __privateAdd(this, _onDragMove, (e) => {
138
- if (this.disabled || e.defaultPrevented || !this._draggingThumb) {
139
- return;
64
+ };
65
+ this.#syncSiblingsRequiredValidationStatus = () => {
66
+ if (this.elementInternals && !this.validity.valueMissing) {
67
+ const siblings = this.#radioSiblings;
68
+ const group = this.#radioGroup;
69
+ if (siblings && siblings.length > 1) {
70
+ siblings.forEach((x) => {
71
+ x.elementInternals.setValidity({ valueMissing: false });
72
+ x.errorValidationMessage = "";
73
+ if (group) group.errorValidationMessage = "";
74
+ });
75
+ }
140
76
  }
141
- const sourceEvent = "TouchEvent" in window && e instanceof TouchEvent ? e.touches[0] : e;
142
- const value = __privateMethod(this, _RangeSlider_instances, calculateValueFromMouseEvent_fn).call(this, sourceEvent);
143
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
144
- [this._draggingThumb]: `${__privateMethod(this, _RangeSlider_instances, roundToNearestStep_fn).call(this, this._draggingThumb, value)}`
145
- });
146
- });
147
- __privateAdd(this, _onDragEnd, () => {
148
- this._draggingThumb = false;
149
- __privateMethod(this, _RangeSlider_instances, unregisterDragListeners_fn).call(this);
150
- });
151
- }
152
- /**
153
- * @internal
154
- */
155
- startChanged() {
156
- this.currentStart = this.start;
157
- if (!__privateGet(this, _isInternalValueUpdate)) {
158
- this.dirtyValue = true;
159
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
160
- }
161
- if (this.$fastController.isConnected) {
162
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
163
- }
164
- }
165
- /**
166
- * @internal
167
- */
168
- initialStartChanged(_, newValue) {
169
- if (newValue && !this.dirtyValue) {
170
- this.start = newValue;
171
- this.dirtyValue = false;
172
- }
173
- }
174
- /**
175
- * @internal
176
- */
177
- currentStartChanged() {
178
- this.start = this.currentStart;
179
- }
180
- /**
181
- * The start property, typed as a number.
182
- *
183
- * @public
184
- */
185
- get startAsNumber() {
186
- return parseFloat(this.start);
187
- }
188
- set startAsNumber(next) {
189
- this.start = next.toString();
190
- }
191
- /**
192
- * @internal
193
- */
194
- endChanged() {
195
- this.currentEnd = this.end;
196
- if (!__privateGet(this, _isInternalValueUpdate)) {
197
- this.dirtyValue = true;
198
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
199
- }
200
- if (this.$fastController.isConnected) {
201
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
202
- }
77
+ };
78
+ this.proxy.setAttribute("type", "radio");
79
+ this.proxy.setAttribute("name", this.name);
80
+ this.checked = this.defaultChecked;
81
+ this.dirtyChecked = false;
203
82
  }
83
+ // Map to proxy element
204
84
  /**
205
85
  * @internal
206
86
  */
207
- initialEndChanged(_, newValue) {
208
- if (newValue && !this.dirtyValue) {
209
- this.end = newValue;
210
- this.dirtyValue = false;
87
+ readOnlyChanged() {
88
+ if (this.proxy instanceof HTMLInputElement) {
89
+ this.proxy.readOnly = this.readOnly;
211
90
  }
212
91
  }
213
92
  /**
214
93
  * @internal
215
94
  */
216
- currentEndChanged() {
217
- this.end = this.currentEnd;
218
- }
219
- /**
220
- * The end property, typed as a number.
221
- *
222
- * @public
223
- */
224
- get endAsNumber() {
225
- return parseFloat(this.end);
226
- }
227
- set endAsNumber(next) {
228
- this.end = next.toString();
229
- }
230
- /**
231
- * @internal
232
- */
233
- orientationChanged() {
234
- if (this.$fastController.isConnected) {
235
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
95
+ defaultCheckedChanged() {
96
+ if (this.$fastController.isConnected && !this.dirtyChecked) {
97
+ if (!this.isInsideRadioGroup()) {
98
+ this.checked = this.defaultChecked;
99
+ this.dirtyChecked = false;
100
+ }
236
101
  }
237
102
  }
238
- // --- Form handling ---
239
103
  /**
240
104
  * @internal
241
105
  */
242
106
  nameChanged(previous, next) {
243
107
  super.nameChanged(previous, next);
244
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
245
- }
246
- formResetCallback() {
247
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
248
- start: this.initialStart ?? this.min.toString(),
249
- end: this.initialEnd ?? this.max.toString()
250
- });
251
- super.formResetCallback();
108
+ next !== null ? this.proxy.setAttribute("name", this.name) : this.proxy.removeAttribute("name");
109
+ vividElement.DOM.queueUpdate(this.validate);
252
110
  }
253
111
  /**
254
112
  * @internal
255
113
  */
256
- _isThumbPopupOpen(thumb) {
257
- return this._visiblyFocusedThumb === thumb || this._hoveredThumb === thumb || this._draggingThumb === thumb;
258
- }
259
- // --- Lifecycle ---
260
114
  connectedCallback() {
261
115
  super.connectedCallback();
262
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
263
- start: this.start || this.initialStart || this.min.toString(),
264
- end: this.end || this.initialEnd || this.max.toString()
265
- }, false);
266
- __privateMethod(this, _RangeSlider_instances, registerThumbListeners_fn).call(this);
267
- __privateMethod(this, _RangeSlider_instances, updateThumbPositions_fn).call(this);
116
+ vividElement.DOM.queueUpdate(this.validate);
117
+ if (this.parentElement.getAttribute("role") !== "radiogroup" && this.getAttribute("tabindex") === null) {
118
+ if (!this.disabled) {
119
+ this.setAttribute("tabindex", "0");
120
+ }
121
+ }
122
+ if (this.defaultChecked) {
123
+ if (!this.dirtyChecked) {
124
+ if (!this.isInsideRadioGroup()) {
125
+ this.checked = this.defaultChecked;
126
+ this.dirtyChecked = false;
127
+ }
128
+ }
129
+ }
268
130
  }
269
- disconnectedCallback() {
270
- super.disconnectedCallback();
271
- __privateMethod(this, _RangeSlider_instances, unregisterThumbListeners_fn).call(this);
272
- __privateMethod(this, _RangeSlider_instances, unregisterDragListeners_fn).call(this);
131
+ isInsideRadioGroup() {
132
+ const parent = this.closest(
133
+ "[role=radiogroup]"
134
+ );
135
+ return parent !== null;
273
136
  }
274
137
  /**
275
138
  * @internal
276
139
  */
277
- _onMouseDown(e) {
278
- if (this.disabled || this._draggingThumb) {
279
- return;
140
+ clickHandler(_) {
141
+ if (!this.disabled && !this.readOnly && !this.checked) {
142
+ this.checked = true;
280
143
  }
281
- const value = __privateMethod(this, _RangeSlider_instances, calculateValueFromMouseEvent_fn).call(this, e);
282
- const startDistance = Math.abs(value - Number(this.start));
283
- const endDistance = Math.abs(value - Number(this.end));
284
- const thumb = startDistance < endDistance || startDistance === endDistance && value < Number(this.start) ? "start" : "end";
285
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
286
- [thumb]: `${__privateMethod(this, _RangeSlider_instances, roundToNearestStep_fn).call(this, thumb, value)}`
287
- });
288
- this._draggingThumb = thumb;
289
- __privateMethod(this, _RangeSlider_instances, focusThumbNonVisibly_fn).call(this, __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb]);
290
- __privateMethod(this, _RangeSlider_instances, registerDragHandlers_fn).call(this);
291
- }
292
- };
293
- _isInternalValueUpdate = new WeakMap();
294
- _RangeSlider_instances = new WeakSet();
295
- updateValues_fn = function({ start, end }, emitEvents = true) {
296
- if (start === this.start) {
297
- start = void 0;
298
- }
299
- if (end === this.end) {
300
- end = void 0;
301
- }
302
- if (start === void 0 && end === void 0) {
303
- return;
304
144
  }
305
- __privateSet(this, _isInternalValueUpdate, true);
306
- if (start !== void 0) {
307
- this.start = start;
308
- }
309
- if (end !== void 0) {
310
- this.end = end;
311
- }
312
- __privateSet(this, _isInternalValueUpdate, false);
313
- if (emitEvents) {
314
- if (start !== void 0) {
315
- this.$emit("input:start");
316
- }
317
- if (end !== void 0) {
318
- this.$emit("input:end");
145
+ get #radioSiblings() {
146
+ const siblings = this.parentElement?.querySelectorAll(
147
+ `${this.tagName.toLocaleLowerCase()}[name="${this.name}"]`
148
+ );
149
+ if (siblings) {
150
+ return Array.from(siblings);
319
151
  }
320
- this.$emit("input");
321
- this.$emit("change");
322
- this.dirtyValue = true;
152
+ return [];
323
153
  }
324
- __privateMethod(this, _RangeSlider_instances, updateFormValue_fn).call(this);
325
- };
326
- applyStep_fn = function(thumb, direction) {
327
- __privateMethod(this, _RangeSlider_instances, updateValues_fn).call(this, {
328
- [thumb]: __privateMethod(this, _RangeSlider_instances, roundToNearestStep_fn).call(this, thumb, Number(this[thumb]) + direction * this.step).toString()
329
- });
330
- };
331
- updateFormValue_fn = function() {
332
- if (!this.name) {
333
- this.setFormValue(null);
334
- } else {
335
- const formData = new FormData();
336
- formData.append(this.name, this.start);
337
- formData.append(this.name, this.end);
338
- this.setFormValue(formData);
339
- }
340
- };
341
- thumbs_get = function() {
342
- return {
343
- start: this._startThumbEl,
344
- end: this._endThumbEl
345
- };
346
- };
347
- thumbConstraints_get = function() {
348
- return {
349
- start: { min: this.min, max: this.endAsNumber },
350
- end: { min: this.startAsNumber, max: this.max }
351
- };
352
- };
353
- getThumbId_fn = function(thumb) {
354
- return thumb === this._startThumbEl ? "start" : "end";
355
- };
356
- getThumbIdFromEvent_fn = function(e) {
357
- return __privateMethod(this, _RangeSlider_instances, getThumbId_fn).call(this, e.target);
358
- };
359
- updateThumbPositions_fn = function() {
360
- const startOffsetPct = __privateMethod(this, _RangeSlider_instances, thumbTrackEndOffset_fn).call(this, this.startAsNumber);
361
- const endOffsetPct = __privateMethod(this, _RangeSlider_instances, thumbTrackEndOffset_fn).call(this, this.endAsNumber);
362
- const [dirProp, dimProp] = this.orientation === aria.Orientation.horizontal ? ["right", "width"] : ["bottom", "height"];
363
- const transition = `transition: ${this._draggingThumb ? "none" : "all 0.2s ease"};`;
364
- this._startThumbCss = `${dirProp}: ${startOffsetPct}%; ${transition}`;
365
- this._endThumbCss = `${dirProp}: ${endOffsetPct}%; ${transition}`;
366
- this._selectedRangeCss = `${dirProp}: ${endOffsetPct}%; ${dimProp}: ${startOffsetPct - endOffsetPct}%; ${transition}`;
367
- };
368
- thumbTrackEndOffset_fn = function(value) {
369
- return (1 - slider_template.inverseLerp(this.min, this.max, value)) * 100;
370
- };
371
- calculateValueFromMouseEvent_fn = function(e) {
372
- const trackClientRect = this._trackEl.getBoundingClientRect();
373
- const [minPos, maxPos, valuePos] = this.orientation === aria.Orientation.horizontal ? [
374
- this._trackEl.clientLeft,
375
- this._trackEl.clientWidth,
376
- e.pageX - document.documentElement.scrollLeft - this.getBoundingClientRect().left
377
- ] : [
378
- trackClientRect.top,
379
- trackClientRect.bottom,
380
- e.pageY - document.documentElement.scrollTop
381
- ];
382
- return slider_template.lerp(this.min, this.max, slider_template.inverseLerp(minPos, maxPos, valuePos));
383
- };
384
- roundToNearestStep_fn = function(thumb, value) {
385
- return numbers.limit(
386
- __privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].min,
387
- __privateGet(this, _RangeSlider_instances, thumbConstraints_get)[thumb].max,
388
- slider_template.roundToStepValue(value - this.min, this.step) + this.min
389
- );
390
- };
391
- _isNonVisibleFocus = new WeakMap();
392
- focusThumbNonVisibly_fn = function(thumb) {
393
- __privateSet(this, _isNonVisibleFocus, true);
394
- thumb.focus();
395
- __privateSet(this, _isNonVisibleFocus, false);
396
- };
397
- // --- Event handling ---
398
- registerThumbListeners_fn = function() {
399
- for (const thumb of ["start", "end"]) {
400
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("keydown", __privateGet(this, _onThumbKeydown));
401
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener(
402
- "mousedown",
403
- __privateGet(this, _onThumbMousedown),
404
- { passive: true }
405
- );
406
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener(
407
- "touchstart",
408
- __privateGet(this, _onThumbMousedown),
409
- { passive: true }
154
+ get #radioGroup() {
155
+ const parentGroup = this.closest(
156
+ `${this.tagName.toLocaleLowerCase()}-group[name="${this.name}"]`
410
157
  );
411
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("mouseover", __privateGet(this, _onMouseOver), {
412
- passive: true
413
- });
414
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("mouseout", __privateGet(this, _onMouseOut), {
415
- passive: true
416
- });
417
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("focus", __privateGet(this, _onThumbFocus));
418
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].addEventListener("blur", __privateGet(this, _onThumbBlur));
158
+ if (parentGroup) {
159
+ return parentGroup;
160
+ }
161
+ return null;
419
162
  }
420
- };
421
- unregisterThumbListeners_fn = function() {
422
- for (const thumb of ["start", "end"]) {
423
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("keydown", __privateGet(this, _onThumbKeydown));
424
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener(
425
- "mousedown",
426
- __privateGet(this, _onThumbMousedown)
427
- );
428
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener(
429
- "touchstart",
430
- __privateGet(this, _onThumbMousedown)
431
- );
432
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("mouseover", __privateGet(this, _onMouseOver));
433
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("mouseout", __privateGet(this, _onMouseOut));
434
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("focus", __privateGet(this, _onThumbFocus));
435
- __privateGet(this, _RangeSlider_instances, thumbs_get)[thumb].removeEventListener("blur", __privateGet(this, _onThumbBlur));
163
+ #validateValueMissingWithSiblings;
164
+ #syncSiblingsRequiredValidationStatus;
165
+ /**
166
+ * @internal
167
+ */
168
+ validate(anchor) {
169
+ super.validate(anchor);
170
+ if (this.proxy) {
171
+ this.errorValidationMessage = this.validationMessage || "";
172
+ if (this.validity.valueMissing) {
173
+ this.#validateValueMissingWithSiblings();
174
+ } else {
175
+ this.#syncSiblingsRequiredValidationStatus();
176
+ }
177
+ }
436
178
  }
437
- };
438
- _onThumbFocus = new WeakMap();
439
- _onThumbBlur = new WeakMap();
440
- _onMouseOver = new WeakMap();
441
- _onMouseOut = new WeakMap();
442
- _onThumbMousedown = new WeakMap();
443
- _onThumbKeydown = new WeakMap();
444
- registerDragHandlers_fn = function() {
445
- window.addEventListener("mousemove", __privateGet(this, _onDragMove), { passive: true });
446
- window.addEventListener("touchmove", __privateGet(this, _onDragMove), { passive: true });
447
- window.addEventListener("mouseup", __privateGet(this, _onDragEnd));
448
- window.addEventListener("touchend", __privateGet(this, _onDragEnd));
449
- window.document.addEventListener("mouseleave", __privateGet(this, _onDragEnd));
450
- };
451
- unregisterDragListeners_fn = function() {
452
- window.removeEventListener("mouseup", __privateGet(this, _onDragEnd));
453
- window.document.removeEventListener("mouseleave", __privateGet(this, _onDragEnd));
454
- window.removeEventListener("mousemove", __privateGet(this, _onDragMove));
455
- window.removeEventListener("touchmove", __privateGet(this, _onDragMove));
456
- window.removeEventListener("touchend", __privateGet(this, _onDragEnd));
457
- };
458
- _onDragMove = new WeakMap();
459
- _onDragEnd = new WeakMap();
460
- __decorateClass([
461
- vividElement.observable
462
- ], exports.RangeSlider.prototype, "start", 2);
463
- __decorateClass([
464
- vividElement.attr({ mode: "fromView", attribute: "start" })
465
- ], exports.RangeSlider.prototype, "initialStart", 2);
466
- __decorateClass([
467
- vividElement.attr({ attribute: "current-start" })
468
- ], exports.RangeSlider.prototype, "currentStart", 2);
469
- __decorateClass([
470
- vividElement.observable
471
- ], exports.RangeSlider.prototype, "end", 2);
472
- __decorateClass([
473
- vividElement.attr({ mode: "fromView", attribute: "end" })
474
- ], exports.RangeSlider.prototype, "initialEnd", 2);
475
- __decorateClass([
476
- vividElement.attr({ attribute: "current-end" })
477
- ], exports.RangeSlider.prototype, "currentEnd", 2);
478
- __decorateClass([
479
- vividElement.attr({ converter: vividElement.nullableNumberConverter })
480
- ], exports.RangeSlider.prototype, "min", 2);
481
- __decorateClass([
482
- vividElement.attr({ converter: vividElement.nullableNumberConverter })
483
- ], exports.RangeSlider.prototype, "max", 2);
484
- __decorateClass([
485
- vividElement.attr({ converter: slider_template.defaultToOneConverter })
486
- ], exports.RangeSlider.prototype, "step", 2);
487
- __decorateClass([
488
- vividElement.attr
489
- ], exports.RangeSlider.prototype, "orientation", 2);
490
- __decorateClass([
491
- vividElement.attr({ attribute: "aria-start-label" })
492
- ], exports.RangeSlider.prototype, "ariaStartLabel", 2);
493
- __decorateClass([
494
- vividElement.attr({ attribute: "aria-end-label" })
495
- ], exports.RangeSlider.prototype, "ariaEndLabel", 2);
179
+ }
496
180
  __decorateClass([
497
- vividElement.attr({ mode: "boolean" })
498
- ], exports.RangeSlider.prototype, "markers", 2);
181
+ vividElement.attr({ attribute: "aria-label" })
182
+ ], Radio.prototype, "ariaLabel");
499
183
  __decorateClass([
500
184
  vividElement.attr
501
- ], exports.RangeSlider.prototype, "connotation", 2);
185
+ ], Radio.prototype, "connotation");
502
186
  __decorateClass([
503
- vividElement.attr({ mode: "boolean" })
504
- ], exports.RangeSlider.prototype, "pin", 2);
187
+ vividElement.attr({ attribute: "readonly", mode: "boolean" })
188
+ ], Radio.prototype, "readOnly");
505
189
  __decorateClass([
506
190
  vividElement.observable
507
- ], exports.RangeSlider.prototype, "valueTextFormatter", 2);
508
- __decorateClass([
509
- vividElement.observable
510
- ], exports.RangeSlider.prototype, "_draggingThumb", 2);
511
- __decorateClass([
512
- vividElement.observable
513
- ], exports.RangeSlider.prototype, "_visiblyFocusedThumb", 2);
514
- __decorateClass([
515
- vividElement.observable
516
- ], exports.RangeSlider.prototype, "_hoveredThumb", 2);
517
- __decorateClass([
518
- vividElement.observable
519
- ], exports.RangeSlider.prototype, "_startThumbCss", 2);
520
- __decorateClass([
521
- vividElement.observable
522
- ], exports.RangeSlider.prototype, "_endThumbCss", 2);
523
- __decorateClass([
524
- vividElement.observable
525
- ], exports.RangeSlider.prototype, "_selectedRangeCss", 2);
526
- exports.RangeSlider = __decorateClass([
527
- formElements.formElements
528
- ], exports.RangeSlider);
191
+ ], Radio.prototype, "defaultSlottedNodes");
529
192
 
530
- const getClasses = ({ disabled, connotation }) => classNames.classNames(
531
- "control",
532
- ["disabled", Boolean(disabled)],
533
- [`connotation-${connotation}`, Boolean(connotation)]
193
+ const getClasses = ({ connotation, checked, readOnly, disabled }) => classNames.classNames(
194
+ "base",
195
+ [`connotation-${connotation}`, Boolean(connotation)],
196
+ ["checked", Boolean(checked)],
197
+ ["readonly", Boolean(readOnly)],
198
+ ["disabled", Boolean(disabled)]
534
199
  );
535
- const getThumbClassesFor = (thumb) => ({ _visiblyFocusedThumb }) => classNames.classNames("thumb-container", [
536
- "focus-visible",
537
- _visiblyFocusedThumb === thumb
538
- ]);
539
- const RangeSliderTemplate = (context) => {
540
- const popupTag = context.tagFor(definition.Popup);
541
- return vividElement.html` <template
542
- @mousedown="${(x, c) => x._onMouseDown(c.event)}"
543
- >
544
- <div class="${getClasses} ${(x) => x.orientation}">
545
- <div class="positioning-region">
546
- <div ${ref.ref("_trackEl")} class="track">
547
- <div class="track-start" style="${(x) => x._selectedRangeCss}"></div>
548
- ${when.when(
549
- (x) => x.markers,
550
- vividElement.html`${(x) => slider_template.getMarkersTemplate(
551
- x.orientation === aria.Orientation.horizontal,
552
- Math.floor((x.max - x.min) / x.step)
553
- )}`
554
- )}
555
- </div>
556
- <div
557
- ${ref.ref("_startThumbEl")}
558
- class="${getThumbClassesFor("start")}"
559
- style="${(x) => x._startThumbCss}"
560
- role="slider"
561
- tabindex="${(x) => x.disabled ? null : 0}"
562
- aria-label="${(x) => x.ariaStartLabel || x.locale.rangeSlider.startThumbLabel}"
563
- aria-valuetext="${(x) => x.valueTextFormatter(x.start)}"
564
- aria-valuenow="${(x) => x.start}"
565
- aria-valuemin="${(x) => x.min}"
566
- aria-valuemax="${(x) => x.end}"
567
- aria-disabled="${(x) => x.disabled}"
568
- aria-orientation="${(x) => x.orientation}"
569
- ></div>
570
- ${when.when(
571
- (x) => x.pin,
572
- vividElement.html`<${popupTag}
573
- class="popup"
574
- arrow
575
- alternate
576
- :anchor="${(x) => x._startThumbEl}"
577
- :open=${(x) => x._isThumbPopupOpen("start")}
578
- :placementStrategy=${(x) => x.orientation === aria.Orientation.horizontal ? definition.PlacementStrategy.AutoPlacementHorizontal : definition.PlacementStrategy.AutoPlacementVertical}
579
- animation-frame
580
- exportparts="vvd-theme-alternate"
581
- aria-hidden="true"
582
- >
583
- <div class="tooltip">${(x) => x.valueTextFormatter(x.start)}</div>
584
- </${popupTag}>`
585
- )}
586
- <div
587
- ${ref.ref("_endThumbEl")}
588
- class="${getThumbClassesFor("end")}"
589
- style="${(x) => x._endThumbCss}"
590
- role="slider"
591
- tabindex="${(x) => x.disabled ? null : 0}"
592
- aria-label="${(x) => x.ariaEndLabel || x.locale.rangeSlider.endThumbLabel}"
593
- aria-valuetext="${(x) => x.valueTextFormatter(x.end)}"
594
- aria-valuenow="${(x) => x.end}"
595
- aria-valuemin="${(x) => x.start}"
596
- aria-valuemax="${(x) => x.max}"
597
- aria-disabled="${(x) => x.disabled}"
598
- aria-orientation="${(x) => x.orientation}"
599
- ></div>
600
- ${when.when(
601
- (x) => x.pin,
602
- vividElement.html`<${popupTag}
603
- class="popup"
604
- arrow
605
- alternate
606
- :anchor="${(x) => x._endThumbEl}"
607
- :open=${(x) => x._isThumbPopupOpen("end")}
608
- :placementStrategy=${(x) => x.orientation === aria.Orientation.horizontal ? definition.PlacementStrategy.AutoPlacementHorizontal : definition.PlacementStrategy.AutoPlacementVertical}
609
- animation-frame
610
- exportparts="vvd-theme-alternate"
611
- aria-hidden="true"
612
- >
613
- <div class="tooltip">${(x) => x.valueTextFormatter(x.end)}</div>
614
- </${popupTag}>`
615
- )}
616
- </div>
617
- </div>
618
- </template>`;
619
- };
200
+ const RadioTemplate = vividElement.html`<template
201
+ aria-checked="${(x) => x.checked}"
202
+ aria-disabled="${(x) => x.disabled}"
203
+ aria-required="${(x) => x.required}"
204
+ @keypress="${(x, c) => x.keypressHandler(c.event)}"
205
+ @click="${(x, c) => x.clickHandler(c.event)}"
206
+ role="radio"
207
+ >
208
+ <div class="${getClasses}">
209
+ <div class="control"></div>
210
+ ${when.when(
211
+ (x) => x.label,
212
+ vividElement.html`<label class="label">${(x) => x.label}</label>`
213
+ )}
214
+ </div>
215
+ </template>`;
620
216
 
621
- const rangeSliderDefinition = vividElement.defineVividComponent(
622
- "range-slider",
623
- exports.RangeSlider,
624
- RangeSliderTemplate,
625
- [definition.popupDefinition],
217
+ const radioDefinition = vividElement.defineVividComponent(
218
+ "radio",
219
+ Radio,
220
+ RadioTemplate,
221
+ [],
626
222
  {
627
- styles,
628
- shadowOptions: {
629
- delegatesFocus: true
630
- }
223
+ styles
631
224
  }
632
225
  );
633
- const registerRangeSlider = vividElement.createRegisterFunction(
634
- rangeSliderDefinition
635
- );
226
+ const registerRadio = vividElement.createRegisterFunction(radioDefinition);
636
227
 
637
- exports.rangeSliderDefinition = rangeSliderDefinition;
638
- exports.registerRangeSlider = registerRangeSlider;
228
+ exports.Radio = Radio;
229
+ exports.radioDefinition = radioDefinition;
230
+ exports.registerRadio = registerRadio;