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