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