@vonage/vivid 4.16.2 → 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 (447) hide show
  1. package/custom-elements.json +8857 -5894
  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 +198 -87
  23. package/index.js +66 -60
  24. package/layout/index.cjs +1 -1
  25. package/layout/index.js +1 -1
  26. package/lib/accordion/definition.d.ts +2 -0
  27. package/lib/accordion-item/definition.d.ts +2 -0
  28. package/lib/action-group/action-group.d.ts +449 -3
  29. package/lib/action-group/definition.d.ts +2 -0
  30. package/lib/alert/definition.d.ts +2 -0
  31. package/lib/audio-player/definition.d.ts +2 -0
  32. package/lib/avatar/definition.d.ts +2 -0
  33. package/lib/badge/definition.d.ts +2 -0
  34. package/lib/banner/banner.d.ts +449 -3
  35. package/lib/banner/definition.d.ts +2 -0
  36. package/lib/breadcrumb/definition.d.ts +2 -0
  37. package/lib/breadcrumb-item/breadcrumb-item.d.ts +449 -1
  38. package/lib/breadcrumb-item/definition.d.ts +2 -0
  39. package/lib/button/definition.d.ts +2 -0
  40. package/lib/calendar/calendar.d.ts +2 -0
  41. package/lib/calendar/definition.d.ts +2 -0
  42. package/lib/calendar-event/definition.d.ts +2 -0
  43. package/lib/card/definition.d.ts +2 -0
  44. package/lib/checkbox/checkbox.d.ts +449 -4
  45. package/lib/checkbox/definition.d.ts +2 -0
  46. package/lib/combobox/definition.d.ts +2 -0
  47. package/lib/components.d.ts +2 -0
  48. package/lib/data-grid/definition.d.ts +4 -0
  49. package/lib/date-picker/date-picker.d.ts +2182 -4
  50. package/lib/date-picker/date-picker.template.d.ts +2 -0
  51. package/lib/date-picker/definition.d.ts +2 -0
  52. package/lib/date-range-picker/date-range-picker.d.ts +1110 -4
  53. package/lib/date-range-picker/date-range-picker.template.d.ts +2 -0
  54. package/lib/date-range-picker/definition.d.ts +2 -0
  55. package/lib/date-time-picker/date-time-picker.d.ts +2175 -0
  56. package/lib/date-time-picker/date-time-picker.template.d.ts +2 -0
  57. package/lib/date-time-picker/definition.d.ts +1 -0
  58. package/lib/date-time-picker/locale.d.ts +9 -0
  59. package/lib/dial-pad/definition.d.ts +2 -0
  60. package/lib/dialog/definition.d.ts +2 -0
  61. package/lib/dialog/dialog.d.ts +449 -2
  62. package/lib/divider/definition.d.ts +2 -0
  63. package/lib/divider/divider.d.ts +448 -1
  64. package/lib/empty-state/definition.d.ts +2 -0
  65. package/lib/enums.d.ts +6 -0
  66. package/lib/fab/definition.d.ts +2 -0
  67. package/lib/file-picker/definition.d.ts +2 -0
  68. package/lib/header/definition.d.ts +2 -0
  69. package/lib/icon/definition.d.ts +2 -0
  70. package/lib/layout/definition.d.ts +2 -0
  71. package/lib/menu/definition.d.ts +2 -0
  72. package/lib/menu/menu.d.ts +900 -5
  73. package/lib/menu-item/definition.d.ts +2 -0
  74. package/lib/nav/definition.d.ts +2 -0
  75. package/lib/nav-disclosure/definition.d.ts +2 -0
  76. package/lib/nav-disclosure/nav-disclosure.d.ts +449 -2
  77. package/lib/nav-item/definition.d.ts +2 -0
  78. package/lib/note/definition.d.ts +2 -0
  79. package/lib/number-field/definition.d.ts +2 -0
  80. package/lib/number-field/number-field.d.ts +450 -3
  81. package/lib/option/definition.d.ts +2 -0
  82. package/lib/option/option.d.ts +1 -11
  83. package/lib/pagination/definition.d.ts +2 -0
  84. package/lib/popup/definition.d.ts +0 -1
  85. package/lib/popup/popup.d.ts +25 -0
  86. package/lib/progress/definition.d.ts +2 -0
  87. package/lib/progress/progress.d.ts +449 -2
  88. package/lib/progress-ring/definition.d.ts +2 -0
  89. package/lib/progress-ring/progress-ring.d.ts +449 -2
  90. package/lib/radio/definition.d.ts +2 -0
  91. package/lib/radio-group/definition.d.ts +2 -0
  92. package/lib/range-slider/definition.d.ts +2 -0
  93. package/lib/rich-text-editor/definition.d.ts +2 -0
  94. package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +2 -0
  95. package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +8 -0
  96. package/lib/rich-text-editor/rich-text-editor.d.ts +16 -0
  97. package/lib/rich-text-editor/rich-text-editor.template.d.ts +4 -0
  98. package/lib/searchable-select/definition.d.ts +2 -0
  99. package/lib/select/definition.d.ts +2 -0
  100. package/lib/select/select.d.ts +1 -5
  101. package/lib/selectable-box/definition.d.ts +2 -0
  102. package/lib/selectable-box/selectable-box.d.ts +449 -2
  103. package/lib/side-drawer/definition.d.ts +2 -0
  104. package/lib/slider/definition.d.ts +2 -0
  105. package/lib/slider/slider.d.ts +449 -3
  106. package/lib/split-button/definition.d.ts +2 -0
  107. package/lib/split-button/split-button.d.ts +449 -3
  108. package/lib/switch/definition.d.ts +2 -0
  109. package/lib/switch/switch.d.ts +449 -2
  110. package/lib/tab/definition.d.ts +2 -0
  111. package/lib/tab-panel/definition.d.ts +2 -0
  112. package/lib/tabs/definition.d.ts +2 -0
  113. package/lib/tag/definition.d.ts +2 -0
  114. package/lib/tag-group/definition.d.ts +2 -0
  115. package/lib/tag-group/tag-group.d.ts +449 -2
  116. package/lib/text-anchor/text-anchor.d.ts +449 -1
  117. package/lib/text-area/definition.d.ts +2 -0
  118. package/lib/text-area/text-area.d.ts +450 -3
  119. package/lib/text-field/definition.d.ts +2 -0
  120. package/lib/text-field/text-field.d.ts +450 -7
  121. package/lib/time-picker/definition.d.ts +2 -0
  122. package/lib/time-picker/locale.d.ts +0 -2
  123. package/lib/time-picker/time-picker.d.ts +1053 -9
  124. package/lib/time-picker/time-picker.template.d.ts +2 -2
  125. package/lib/toggletip/definition.d.ts +2 -0
  126. package/lib/toggletip/toggletip.d.ts +454 -4
  127. package/lib/tooltip/definition.d.ts +2 -0
  128. package/lib/tooltip/tooltip.d.ts +454 -4
  129. package/lib/tree-item/definition.d.ts +2 -0
  130. package/lib/tree-view/definition.d.ts +2 -0
  131. package/lib/video-player/definition.d.ts +2 -0
  132. package/locales/de-DE.cjs +29 -5
  133. package/locales/de-DE.js +29 -5
  134. package/locales/en-GB.cjs +29 -5
  135. package/locales/en-GB.js +29 -5
  136. package/locales/en-US.cjs +29 -5
  137. package/locales/en-US.js +29 -5
  138. package/locales/ja-JP.cjs +29 -5
  139. package/locales/ja-JP.js +29 -5
  140. package/locales/zh-CN.cjs +29 -5
  141. package/locales/zh-CN.js +29 -5
  142. package/menu/index.cjs +1 -1
  143. package/menu/index.js +1 -1
  144. package/menu-item/index.cjs +1 -1
  145. package/menu-item/index.js +1 -1
  146. package/nav/index.cjs +1 -1
  147. package/nav/index.js +1 -1
  148. package/nav-disclosure/index.cjs +1 -1
  149. package/nav-disclosure/index.js +1 -1
  150. package/nav-item/index.cjs +1 -1
  151. package/nav-item/index.js +1 -1
  152. package/note/index.cjs +1 -1
  153. package/note/index.js +1 -1
  154. package/number-field/index.cjs +1 -1
  155. package/number-field/index.js +1 -1
  156. package/option/index.cjs +1 -1
  157. package/option/index.js +1 -1
  158. package/package.json +7 -2
  159. package/pagination/index.cjs +1 -1
  160. package/pagination/index.js +1 -1
  161. package/popup/index.cjs +1 -1
  162. package/popup/index.js +1 -1
  163. package/progress/index.cjs +1 -1
  164. package/progress/index.js +1 -1
  165. package/progress-ring/index.cjs +1 -1
  166. package/progress-ring/index.js +1 -1
  167. package/radio/index.cjs +1 -1
  168. package/radio/index.js +1 -1
  169. package/radio-group/index.cjs +1 -1
  170. package/radio-group/index.js +1 -1
  171. package/range-slider/index.cjs +1 -1
  172. package/range-slider/index.js +1 -1
  173. package/rich-text-editor/index.cjs +5 -0
  174. package/rich-text-editor/index.js +3 -0
  175. package/searchable-select/index.cjs +1 -1
  176. package/searchable-select/index.js +1 -1
  177. package/select/index.cjs +1 -1
  178. package/select/index.js +1 -1
  179. package/selectable-box/index.cjs +1 -1
  180. package/selectable-box/index.js +1 -1
  181. package/shared/Reflector.cjs +71 -0
  182. package/shared/Reflector.js +69 -0
  183. package/shared/affix.cjs +2 -4
  184. package/shared/affix.js +3 -5
  185. package/shared/anchor.cjs +0 -10
  186. package/shared/anchor.js +0 -10
  187. package/shared/anchored.cjs +12 -9
  188. package/shared/anchored.js +13 -10
  189. package/shared/aria/delegates-aria.d.ts +454 -0
  190. package/shared/base-progress.js +1 -1
  191. package/shared/breadcrumb-item.cjs +2 -1
  192. package/shared/breadcrumb-item.js +2 -1
  193. package/shared/button.cjs +2 -13
  194. package/shared/button.js +2 -13
  195. package/shared/{presentationDate.cjs → calendar-picker.template.cjs} +681 -853
  196. package/shared/{presentationDate.js → calendar-picker.template.js} +673 -848
  197. package/shared/datetime/dateTimeStr.d.ts +6 -0
  198. package/shared/datetime/presentationDate.d.ts +4 -0
  199. package/shared/{date-picker/calendar → datetime}/presentationDateRange.d.ts +3 -3
  200. package/shared/datetime/presentationDateTime.d.ts +4 -0
  201. package/{lib/time-picker/time → shared/datetime}/time.d.ts +1 -0
  202. package/shared/definition.cjs +1 -1
  203. package/shared/definition.js +2 -2
  204. package/shared/definition10.cjs +1 -0
  205. package/shared/definition10.js +2 -2
  206. package/shared/definition11.cjs +9 -12
  207. package/shared/definition11.js +10 -13
  208. package/shared/definition12.cjs +1 -1
  209. package/shared/definition12.js +2 -2
  210. package/shared/definition13.cjs +15 -2
  211. package/shared/definition13.js +16 -4
  212. package/shared/definition14.cjs +4 -3
  213. package/shared/definition14.js +5 -5
  214. package/shared/definition15.cjs +4 -11
  215. package/shared/definition15.js +5 -12
  216. package/shared/definition16.cjs +44 -48
  217. package/shared/definition16.js +32 -36
  218. package/shared/definition17.cjs +4 -1
  219. package/shared/definition17.js +3 -3
  220. package/shared/definition18.cjs +59 -94
  221. package/shared/definition18.js +58 -93
  222. package/shared/definition19.cjs +79 -43
  223. package/shared/definition19.js +60 -24
  224. package/shared/definition2.cjs +1 -0
  225. package/shared/definition2.js +2 -2
  226. package/shared/definition20.cjs +253 -219
  227. package/shared/definition20.js +254 -220
  228. package/shared/definition21.cjs +201 -286
  229. package/shared/definition21.js +199 -285
  230. package/shared/definition22.cjs +302 -31
  231. package/shared/definition22.js +301 -30
  232. package/shared/definition23.cjs +37 -57
  233. package/shared/definition23.js +36 -57
  234. package/shared/definition24.cjs +50 -69
  235. package/shared/definition24.js +49 -69
  236. package/shared/definition25.cjs +75 -2475
  237. package/shared/definition25.js +74 -2475
  238. package/shared/definition26.cjs +2480 -49
  239. package/shared/definition26.js +2480 -49
  240. package/shared/definition27.cjs +53 -271
  241. package/shared/definition27.js +52 -269
  242. package/shared/definition28.cjs +271 -47
  243. package/shared/definition28.js +269 -47
  244. package/shared/definition29.cjs +37 -772
  245. package/shared/definition29.js +36 -767
  246. package/shared/definition3.cjs +3 -9
  247. package/shared/definition3.js +4 -11
  248. package/shared/definition30.cjs +739 -56
  249. package/shared/definition30.js +733 -56
  250. package/shared/definition31.cjs +93 -21
  251. package/shared/definition31.js +92 -21
  252. package/shared/definition32.cjs +28 -9
  253. package/shared/definition32.js +27 -9
  254. package/shared/definition33.cjs +10 -51
  255. package/shared/definition33.js +9 -51
  256. package/shared/definition34.cjs +31 -412
  257. package/shared/definition34.js +31 -413
  258. package/shared/definition35.cjs +423 -53
  259. package/shared/definition35.js +424 -54
  260. package/shared/definition36.cjs +53 -215
  261. package/shared/definition36.js +53 -215
  262. package/shared/definition37.cjs +202 -72
  263. package/shared/definition37.js +201 -71
  264. package/shared/definition38.cjs +54 -48
  265. package/shared/definition38.js +53 -48
  266. package/shared/definition39.cjs +57 -262
  267. package/shared/definition39.js +56 -262
  268. package/shared/definition4.cjs +4 -3
  269. package/shared/definition4.js +5 -5
  270. package/shared/definition40.cjs +220 -148
  271. package/shared/definition40.js +220 -148
  272. package/shared/definition41.cjs +144 -568
  273. package/shared/definition41.js +144 -569
  274. package/shared/definition42.cjs +476 -967
  275. package/shared/definition42.js +477 -969
  276. package/shared/definition43.cjs +13508 -851
  277. package/shared/definition43.js +13508 -851
  278. package/shared/definition44.cjs +1111 -103
  279. package/shared/definition44.js +1112 -103
  280. package/shared/definition45.cjs +849 -80
  281. package/shared/definition45.js +849 -80
  282. package/shared/definition46.cjs +108 -464
  283. package/shared/definition46.js +107 -463
  284. package/shared/definition47.cjs +96 -118
  285. package/shared/definition47.js +95 -118
  286. package/shared/definition48.cjs +430 -82
  287. package/shared/definition48.js +430 -83
  288. package/shared/definition49.cjs +135 -15
  289. package/shared/definition49.js +134 -15
  290. package/shared/definition5.cjs +5 -4
  291. package/shared/definition5.js +6 -6
  292. package/shared/definition50.cjs +109 -85
  293. package/shared/definition50.js +108 -85
  294. package/shared/definition51.cjs +14 -519
  295. package/shared/definition51.js +13 -519
  296. package/shared/definition52.cjs +96 -23
  297. package/shared/definition52.js +95 -23
  298. package/shared/definition53.cjs +480 -99
  299. package/shared/definition53.js +479 -99
  300. package/shared/definition54.cjs +24 -296
  301. package/shared/definition54.js +23 -296
  302. package/shared/definition55.cjs +126 -69
  303. package/shared/definition55.js +125 -69
  304. package/shared/definition56.cjs +186 -775
  305. package/shared/definition56.js +187 -776
  306. package/shared/definition57.cjs +511 -107
  307. package/shared/definition57.js +511 -107
  308. package/shared/definition58.cjs +27 -128
  309. package/shared/definition58.js +27 -128
  310. package/shared/definition59.cjs +106 -162
  311. package/shared/definition59.js +105 -160
  312. package/shared/definition6.cjs +3 -2
  313. package/shared/definition6.js +4 -4
  314. package/shared/definition60.cjs +81 -252
  315. package/shared/definition60.js +80 -252
  316. package/shared/definition61.cjs +156 -70156
  317. package/shared/definition61.js +154 -70156
  318. package/shared/definition62.cjs +271 -29
  319. package/shared/definition62.js +270 -28
  320. package/shared/definition63.cjs +69236 -2018
  321. package/shared/definition63.js +69235 -2016
  322. package/shared/definition64.cjs +55 -0
  323. package/shared/definition64.js +51 -0
  324. package/shared/definition65.cjs +2195 -0
  325. package/shared/definition65.js +2190 -0
  326. package/shared/definition7.cjs +3 -2
  327. package/shared/definition7.js +4 -4
  328. package/shared/definition8.cjs +5 -10
  329. package/shared/definition8.js +6 -12
  330. package/shared/definition9.cjs +2 -2
  331. package/shared/definition9.js +3 -3
  332. package/shared/delegates-aria.cjs +69 -0
  333. package/shared/delegates-aria.js +67 -0
  334. package/shared/enums.cjs +8 -0
  335. package/shared/enums.js +8 -1
  336. package/shared/form-elements.cjs +8 -8
  337. package/shared/form-elements.js +9 -9
  338. package/shared/foundation/anchor/anchor.d.ts +0 -8
  339. package/shared/foundation/button/button.d.ts +449 -7
  340. package/shared/foundation/listbox/listbox.d.ts +0 -9
  341. package/shared/foundation/vivid-element/vivid-element.d.ts +1 -0
  342. package/shared/listbox.cjs +4 -30
  343. package/shared/listbox.js +4 -30
  344. package/shared/localization/Locale.d.ts +6 -2
  345. package/shared/option.cjs +1 -38
  346. package/shared/option.js +1 -38
  347. package/shared/patterns/anchored.d.ts +891 -10
  348. package/shared/patterns/trapped-focus.d.ts +2 -0
  349. package/shared/picker-field/locale.d.ts +4 -0
  350. package/shared/picker-field/mixins/calendar-picker.d.ts +558 -0
  351. package/shared/{date-picker/locale.d.ts → picker-field/mixins/calendar-picker.locale.d.ts} +1 -3
  352. package/shared/picker-field/mixins/calendar-picker.template.d.ts +555 -0
  353. package/shared/picker-field/mixins/calendar-segments/calendarGrid.d.ts +17 -0
  354. package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/monthPickerGrid.d.ts +3 -3
  355. package/shared/picker-field/mixins/inline-time-picker/columns.d.ts +13 -0
  356. package/shared/picker-field/mixins/inline-time-picker/definition.d.ts +1 -0
  357. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +15 -0
  358. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.template.d.ts +5 -0
  359. package/{lib/time-picker/time/picker.d.ts → shared/picker-field/mixins/inline-time-picker/picker-option.d.ts} +1 -1
  360. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1110 -0
  361. package/shared/picker-field/mixins/single-date-picker.d.ts +1626 -0
  362. package/shared/picker-field/mixins/single-value-picker.d.ts +518 -0
  363. package/shared/picker-field/mixins/time-selection-picker.d.ts +1053 -0
  364. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +1050 -0
  365. package/shared/picker-field/picker-field.d.ts +11 -0
  366. package/shared/picker-field/picker-field.form-associated.d.ts +11 -0
  367. package/shared/picker-field/picker-field.template.d.ts +7 -0
  368. package/shared/picker-field.template.cjs +315 -0
  369. package/shared/picker-field.template.js +310 -0
  370. package/shared/single-date-picker.cjs +46 -0
  371. package/shared/single-date-picker.js +44 -0
  372. package/shared/single-value-picker.cjs +77 -0
  373. package/shared/single-value-picker.js +75 -0
  374. package/shared/slider.template.cjs +6 -6
  375. package/shared/slider.template.js +6 -6
  376. package/shared/text-anchor.cjs +2 -1
  377. package/shared/text-anchor.js +2 -1
  378. package/shared/text-anchor.template.cjs +5 -7
  379. package/shared/text-anchor.template.js +5 -7
  380. package/shared/time-selection-picker.template.cjs +776 -0
  381. package/shared/time-selection-picker.template.js +767 -0
  382. package/shared/utils/mixins.d.ts +3 -0
  383. package/shared/vivid-element.cjs +3 -0
  384. package/shared/vivid-element.js +4 -1
  385. package/side-drawer/index.cjs +1 -1
  386. package/side-drawer/index.js +1 -1
  387. package/slider/index.cjs +1 -1
  388. package/slider/index.js +1 -1
  389. package/split-button/index.cjs +1 -1
  390. package/split-button/index.js +1 -1
  391. package/styles/core/all.css +1 -1
  392. package/styles/core/theme.css +1 -1
  393. package/styles/core/typography.css +1 -1
  394. package/styles/tokens/theme-dark.css +4 -4
  395. package/styles/tokens/theme-light.css +4 -4
  396. package/styles/tokens/vivid-2-compat.css +1 -1
  397. package/switch/index.cjs +1 -1
  398. package/switch/index.js +1 -1
  399. package/tab/index.cjs +1 -1
  400. package/tab/index.js +1 -1
  401. package/tab-panel/index.cjs +1 -1
  402. package/tab-panel/index.js +1 -1
  403. package/tabs/index.cjs +1 -1
  404. package/tabs/index.js +1 -1
  405. package/tag/index.cjs +1 -1
  406. package/tag/index.js +1 -1
  407. package/tag-group/index.cjs +1 -1
  408. package/tag-group/index.js +1 -1
  409. package/text-anchor/index.cjs +1 -1
  410. package/text-anchor/index.js +2 -2
  411. package/text-area/index.cjs +1 -1
  412. package/text-area/index.js +1 -1
  413. package/text-field/index.cjs +1 -1
  414. package/text-field/index.js +1 -1
  415. package/time-picker/index.cjs +1 -1
  416. package/time-picker/index.js +1 -1
  417. package/toggletip/index.cjs +1 -1
  418. package/toggletip/index.js +1 -1
  419. package/tooltip/index.cjs +1 -1
  420. package/tooltip/index.js +1 -1
  421. package/tree-item/index.cjs +1 -1
  422. package/tree-item/index.js +1 -1
  423. package/tree-view/index.cjs +1 -1
  424. package/tree-view/index.js +1 -1
  425. package/video-player/index.cjs +1 -1
  426. package/video-player/index.js +1 -1
  427. package/vivid.api.json +21748 -1
  428. package/lib/time-picker/time-picker.form-associated.d.ts +0 -11
  429. package/shared/aria-global.cjs +0 -93
  430. package/shared/aria-global.js +0 -91
  431. package/shared/date-picker/calendar/calendarGrid.d.ts +0 -17
  432. package/shared/date-picker/calendar/presentationDate.d.ts +0 -4
  433. package/shared/date-picker/date-picker-base.d.ts +0 -21
  434. package/shared/date-picker/date-picker-base.form-associated.d.ts +0 -11
  435. package/shared/date-picker/date-picker-base.template.d.ts +0 -3
  436. package/shared/foundation/patterns/aria-global.d.ts +0 -21
  437. package/shared/foundation/patterns/index.d.ts +0 -1
  438. package/shared/text-field2.cjs +0 -575
  439. package/shared/text-field2.js +0 -572
  440. package/shared/trapped-focus.cjs +0 -29
  441. package/shared/trapped-focus.js +0 -27
  442. /package/shared/{date-picker/calendar → datetime}/dateRange.d.ts +0 -0
  443. /package/shared/{date-picker/calendar → datetime}/dateStr.d.ts +0 -0
  444. /package/shared/{date-picker/calendar → datetime}/month.d.ts +0 -0
  445. /package/{lib/time-picker/time → shared/datetime}/presentationTime.d.ts +0 -0
  446. /package/shared/{date-picker/calendar → datetime}/year.d.ts +0 -0
  447. /package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/segment.d.ts +0 -0
@@ -1,23 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const definition$1 = require('./definition11.cjs');
4
- const definition = require('./definition63.cjs');
5
- const textField = require('./text-field2.cjs');
6
- const definition$2 = require('./definition22.cjs');
7
3
  const vividElement = require('./vivid-element.cjs');
8
- const ref = require('./ref.cjs');
9
- const slotted = require('./slotted.cjs');
4
+ const definition$1 = require('./definition23.cjs');
5
+ const definition = require('./definition11.cjs');
10
6
  const repeat = require('./repeat.cjs');
11
7
  const when = require('./when.cjs');
12
8
  const classNames = require('./class-names.cjs');
13
- const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
14
- const index = require('./index.cjs');
15
- const formAssociated = require('./form-associated.cjs');
16
- const trappedFocus = require('./trapped-focus.cjs');
17
- const formElements = require('./form-elements.cjs');
18
- const localized = require('./localized.cjs');
19
9
 
20
- const styles = ":host{display:inline-block}.base{display:inline-block;inline-size:100%}.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column;padding:12px;gap:12px}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;gap:8px}.segments{display:flex;gap:24px}.segment{display:flex;flex-direction:column;gap:12px}.segment .header{display:flex;align-items:center;padding-block:8px}.segment .title{display:flex;flex-grow:1;justify-content:center}.segment .title-action{border-radius:8px;block-size:24px;font:var(--vvd-typography-base-extended);padding-inline:8px}.calendar{display:flex;flex-direction:column;margin-top:8px;gap:4px}.calendar .calendar-separator{margin-inline:10px}.calendar .calendar-weekdays{display:flex;justify-content:center}.calendar .calendar-weekday{display:inline-flex;align-items:center;justify-content:center;block-size:16px;font:var(--vvd-typography-base-condensed);inline-size:40px}.calendar .calendar-week{display:flex;justify-content:center}.calendar .calendar-day{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;aspect-ratio:1/1;block-size:28px;font:var(--vvd-typography-base);margin-inline:6px;--focus-inset: -2px}.calendar .calendar-day.start,.calendar .calendar-day.end{border:2px solid var(--vvd-color-cta-50);background-color:var(--vvd-color-cta-200)}.calendar .calendar-day:before,.calendar .calendar-day:after{position:absolute;z-index:-1;display:block;width:20px;height:28px}.calendar .calendar-day:before{right:50%}.calendar .calendar-day:after{left:50%}.calendar .calendar-day.range:before,.calendar .calendar-day.range:after{background-color:var(--vvd-color-cta-50)}.calendar .calendar-day.range:not(.start):before,.calendar .calendar-day.range:not(.end):after{content:\"\"}.calendar .calendar-day.outside-month,.calendar .calendar-day:disabled{color:var(--vvd-color-neutral-400)}.months-separator{margin-inline:-12px}.month-grid{display:flex;flex-direction:column;gap:34px}.month-grid .months-row{display:flex;justify-content:center;gap:29px}.month-grid .month{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;aspect-ratio:1/1;block-size:48px;font:var(--vvd-typography-base-extended);text-transform:uppercase}.month-grid .month:disabled{color:var(--vvd-color-neutral-400)}.button{--_connotation-color-primary: var(--vvd-date-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-date-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-date-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-date-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-date-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-date-picker-accent-pale, var(--vvd-color-neutral-300))}.button{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.button:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.button:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.button:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.button:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.button:where(.selected):where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.button{position:relative;padding:0;border:none;background-color:var(--_appearance-color-fill);color:var(--_appearance-color-text);cursor:pointer}.button:focus-visible{--focus-stroke-gap-color: transparent;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));color:var(--vvd-color-canvas-text)}.button.current{border:1px solid var(--vvd-color-neutral-200)}.button:disabled{cursor:not-allowed}";
10
+ const calendarStyles = ".segments{display:inline-flex;gap:24px}.segment{display:flex;flex-direction:column;gap:12px}.segment .header{display:flex;align-items:center;padding-block:8px}.segment .title{display:flex;flex-grow:1;justify-content:center}.segment .title-action{border-radius:8px;block-size:24px;font:var(--vvd-typography-base-extended);padding-inline:8px}.calendar{display:flex;flex-direction:column;margin-top:8px;gap:4px}.calendar .calendar-separator{margin-inline:10px}.calendar .calendar-weekdays{display:flex;justify-content:center}.calendar .calendar-weekday{display:inline-flex;align-items:center;justify-content:center;block-size:16px;font:var(--vvd-typography-base-condensed);inline-size:40px}.calendar .calendar-week{display:flex;justify-content:center}.calendar .calendar-day{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;aspect-ratio:1/1;block-size:28px;font:var(--vvd-typography-base);margin-inline:6px;--focus-inset: -2px}.calendar .calendar-day.start,.calendar .calendar-day.end{border:2px solid var(--vvd-color-cta-50);background-color:var(--vvd-color-cta-200)}.calendar .calendar-day:before,.calendar .calendar-day:after{position:absolute;z-index:-1;display:block;width:20px;height:28px}.calendar .calendar-day:before{right:50%}.calendar .calendar-day:after{left:50%}.calendar .calendar-day.range:before,.calendar .calendar-day.range:after{background-color:var(--vvd-color-cta-50)}.calendar .calendar-day.range:not(.start):before,.calendar .calendar-day.range:not(.end):after{content:\"\"}.calendar .calendar-day.outside-month,.calendar .calendar-day:disabled{color:var(--vvd-color-neutral-400)}.months-separator{margin-inline:-12px}.month-grid{display:flex;flex-direction:column;gap:34px}.month-grid .months-row{display:flex;justify-content:center;gap:29px}.month-grid .month{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;aspect-ratio:1/1;block-size:48px;font:var(--vvd-typography-base-extended);text-transform:uppercase}.month-grid .month:disabled{color:var(--vvd-color-neutral-400)}.button{--_connotation-color-primary: var(--vvd-date-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-date-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-date-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-date-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-date-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-date-picker-accent-pale, var(--vvd-color-neutral-300))}.button{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.button:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.button:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.button:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.button:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.button:where(.selected):where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.button{position:relative;padding:0;border:none;background-color:var(--_appearance-color-fill);color:var(--_appearance-color-text);cursor:pointer}.button:focus-visible{--focus-stroke-gap-color: transparent;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));color:var(--vvd-color-canvas-text)}.button.current{border:1px solid var(--vvd-color-neutral-200)}.button:disabled{cursor:not-allowed}";
21
11
 
22
12
  /**
23
13
  * @name toDate
@@ -1539,8 +1529,6 @@ const lightFormatters = {
1539
1529
  };
1540
1530
 
1541
1531
  const dayPeriodEnum = {
1542
- am: "am",
1543
- pm: "pm",
1544
1532
  midnight: "midnight",
1545
1533
  noon: "noon",
1546
1534
  morning: "morning",
@@ -5480,7 +5468,7 @@ function cleanEscapedString(input) {
5480
5468
  return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
5481
5469
  }
5482
5470
 
5483
- const formatDateStr = (date) => formatISO(date, { representation: "date" });
5471
+ const formatDateStr = (date) => formatISO(date, { });
5484
5472
  const currentDateStr = (now = /* @__PURE__ */ new Date()) => formatDateStr(now);
5485
5473
  const parseDateStr = (dateStr) => {
5486
5474
  const [year, month, day] = dateStr.split("-");
@@ -5507,6 +5495,15 @@ const isValidDateStr = (string) => {
5507
5495
  return hasThreeComponents(components) && allComponentsAreNumbers(components) && isValidDate(components);
5508
5496
  };
5509
5497
 
5498
+ const formatPresentationDate = (dateStr, locale) => {
5499
+ const date = parseDateStr(dateStr);
5500
+ return format(date, locale.dateFormat);
5501
+ };
5502
+ const parsePresentationDate = (presentationDate, locale) => {
5503
+ const date = parse(presentationDate, locale.dateFormat, /* @__PURE__ */ new Date());
5504
+ return formatDateStr(date);
5505
+ };
5506
+
5510
5507
  const getCurrentMonth = (now = /* @__PURE__ */ new Date()) => ({
5511
5508
  month: now.getMonth(),
5512
5509
  year: now.getFullYear()
@@ -5524,36 +5521,564 @@ const compareMonths = (a, b) => a.year === b.year ? a.month - b.month : a.year -
5524
5521
  const areMonthsEqual = (a, b) => compareMonths(a, b) === 0;
5525
5522
  const monthToStr = ({ month, year }) => `${year.toString().padStart(4, "0")}-${(month + 1).toString().padStart(2, "0")}`;
5526
5523
 
5524
+ const yearOfDate = (dateStr) => {
5525
+ const date = parseDateStr(dateStr);
5526
+ return date.getFullYear();
5527
+ };
5528
+
5529
+ const MonthsPerRow = 4;
5530
+ const buildMonthPickerGrid = (year, locale) => {
5531
+ const grid = [];
5532
+ let row = [];
5533
+ for (let i = 0; i < 12; i++) {
5534
+ const month = { month: i, year };
5535
+ row.push({
5536
+ label: locale.months.shorthand[i],
5537
+ monthName: locale.months.name[i],
5538
+ month
5539
+ });
5540
+ if (row.length === MonthsPerRow) {
5541
+ grid.push(row);
5542
+ row = [];
5543
+ }
5544
+ }
5545
+ return grid;
5546
+ };
5547
+
5548
+ const getWeekdays = (locale) => {
5549
+ const firstDayOfWeek = locale.firstDayOfWeek;
5550
+ const localeWeekdayToNative = (day) => (day + firstDayOfWeek) % 7;
5551
+ const days = [];
5552
+ for (let i = 0; i < 7; i++) {
5553
+ days.push({
5554
+ name: locale.weekdays.name[localeWeekdayToNative(i)],
5555
+ shortName: locale.weekdays.shorthand[localeWeekdayToNative(i)]
5556
+ });
5557
+ }
5558
+ return days;
5559
+ };
5560
+ const gridDate = (date, isOutsideMonth2) => ({
5561
+ date: formatDateStr(date),
5562
+ label: `${date.getDate()}`,
5563
+ isOutsideMonth: isOutsideMonth2
5564
+ });
5565
+ function isOutsideMonth(dayIndexInMonth, daysInMonth) {
5566
+ return dayIndexInMonth < 0 || dayIndexInMonth >= daysInMonth;
5567
+ }
5568
+ const buildDateGrid = ({ month, year }, getDay) => {
5569
+ const grid = [];
5570
+ const firstDay = new Date(year, month, 1);
5571
+ const lastDay = new Date(year, month + 1, 0);
5572
+ const firstDayInWeek = getDay(firstDay);
5573
+ const daysInMonth = lastDay.getDate();
5574
+ const daysOutsideMonthInLastWeek = 7 - getDay(lastDay);
5575
+ const totalDaysInCalendar = daysInMonth + firstDayInWeek + daysOutsideMonthInLastWeek;
5576
+ let week = [];
5577
+ for (let i = 0; i < totalDaysInCalendar; i++) {
5578
+ const dayIndexInMonth = i - firstDayInWeek;
5579
+ week.push(
5580
+ gridDate(
5581
+ addDays$1(firstDay, dayIndexInMonth),
5582
+ isOutsideMonth(dayIndexInMonth, daysInMonth)
5583
+ )
5584
+ );
5585
+ if (week.length === 7) {
5586
+ grid.push(week);
5587
+ week = [];
5588
+ }
5589
+ }
5590
+ return grid;
5591
+ };
5592
+ const buildCalendarGrid = (month, locale) => {
5593
+ const { firstDayOfWeek } = locale;
5594
+ const getShiftedDay = (date) => (date.getDay() - firstDayOfWeek + 7) % 7;
5595
+ return {
5596
+ weekdays: getWeekdays(locale),
5597
+ grid: buildDateGrid(month, getShiftedDay)
5598
+ };
5599
+ };
5600
+
5601
+ var __defProp$1 = Object.defineProperty;
5602
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5603
+ var __decorateClass$1 = (decorators, target, key, kind) => {
5604
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5605
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
5606
+ if (decorator = decorators[i])
5607
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5608
+ if (kind && result) __defProp$1(target, key, result);
5609
+ return result;
5610
+ };
5611
+ const CalendarPicker = (Base) => {
5612
+ class CalendarPickerElement extends Base {
5613
+ // --- Core ---
5614
+ constructor(...args) {
5615
+ super(...args);
5616
+ this._selectedMonth = getCurrentMonth();
5617
+ /**
5618
+ * Today's date.
5619
+ * @internal
5620
+ */
5621
+ this._currentDate = currentDateStr();
5622
+ /**
5623
+ * Today's month.
5624
+ * @internal
5625
+ */
5626
+ this._currentMonth = getCurrentMonth();
5627
+ this._numCalendars = 1;
5628
+ // --- Date picker ---
5629
+ /**
5630
+ * @internal
5631
+ */
5632
+ this._hideDatesOutsideMonth = false;
5633
+ this._lastFocussedDate = null;
5634
+ this._monthPickerYear = null;
5635
+ this._lastFocussedMonth = null;
5636
+ this.value = "";
5637
+ }
5638
+ /**
5639
+ * @internal
5640
+ */
5641
+ _adjustSelectedMonthToEnsureVisibilityOf(date) {
5642
+ const month = monthOfDate(date);
5643
+ const firstDisplayedMonth = this._selectedMonth;
5644
+ const lastDisplayedMonth = addMonths(
5645
+ this._selectedMonth,
5646
+ this._numCalendars - 1
5647
+ );
5648
+ if (compareMonths(month, firstDisplayedMonth) < 0) {
5649
+ this._selectedMonth = month;
5650
+ return true;
5651
+ } else if (compareMonths(month, lastDisplayedMonth) > 0) {
5652
+ this._selectedMonth = addMonths(month, 1 - this._numCalendars);
5653
+ return true;
5654
+ }
5655
+ return false;
5656
+ }
5657
+ /**
5658
+ * @internal
5659
+ */
5660
+ _isDateInValidRange(date) {
5661
+ return (!this._resolvedMinDate || compareDateStr(date, this._resolvedMinDate) >= 0) && (!this._resolvedMaxDate || compareDateStr(date, this._resolvedMaxDate) <= 0);
5662
+ }
5663
+ #isMonthAfterValidRange(month) {
5664
+ return this._resolvedMaxDate && compareMonths(month, monthOfDate(this._resolvedMaxDate)) > 0;
5665
+ }
5666
+ #isMonthBeforeValidRange(month) {
5667
+ return this._resolvedMinDate && compareMonths(month, monthOfDate(this._resolvedMinDate)) < 0;
5668
+ }
5669
+ /**
5670
+ * @internal
5671
+ */
5672
+ _isMonthInValidRange(month) {
5673
+ return !(this.#isMonthBeforeValidRange(month) || this.#isMonthAfterValidRange(month));
5674
+ }
5675
+ /**
5676
+ * @internal
5677
+ */
5678
+ _closePopup(restoreFocusToTextField = true) {
5679
+ super._closePopup(restoreFocusToTextField);
5680
+ this._monthPickerYear = null;
5681
+ }
5682
+ /**
5683
+ * @internal
5684
+ */
5685
+ _onPickerButtonClick() {
5686
+ super._onPickerButtonClick();
5687
+ if (this._popupOpen) {
5688
+ vividElement.DOM.processUpdates();
5689
+ const tabbableDate = this._tabbableDate;
5690
+ if (tabbableDate)
5691
+ this.shadowRoot.querySelector(
5692
+ `[data-date="${tabbableDate}"]`
5693
+ ).focus();
5694
+ }
5695
+ }
5696
+ // --- Calendar header ---
5697
+ /**
5698
+ * @internal
5699
+ */
5700
+ _onTitleActionClick() {
5701
+ if (this._inMonthPicker) {
5702
+ this._monthPickerYear = null;
5703
+ } else {
5704
+ this._monthPickerYear = this._selectedMonth.year;
5705
+ }
5706
+ }
5707
+ get _isPrevYearDisabled() {
5708
+ const currentYear = this._inMonthPicker ? this._monthPickerYear : this._selectedMonth.year;
5709
+ const prevYear = currentYear - 1;
5710
+ return this._resolvedMinDate && prevYear < yearOfDate(this._resolvedMinDate);
5711
+ }
5712
+ /**
5713
+ * @internal
5714
+ */
5715
+ _onPrevYearClick() {
5716
+ if (this._inMonthPicker) {
5717
+ this._monthPickerYear = this._monthPickerYear - 1;
5718
+ } else {
5719
+ this._selectedMonth = {
5720
+ year: this._selectedMonth.year - 1,
5721
+ month: this._selectedMonth.month
5722
+ };
5723
+ }
5724
+ }
5725
+ get _isNextYearDisabled() {
5726
+ const currentYear = this._inMonthPicker ? this._monthPickerYear : this._selectedMonth.year;
5727
+ const nextYear = currentYear + 1;
5728
+ return this._resolvedMaxDate && nextYear > yearOfDate(this._resolvedMaxDate);
5729
+ }
5730
+ /**
5731
+ * @internal
5732
+ */
5733
+ _onNextYearClick() {
5734
+ if (this._inMonthPicker) {
5735
+ this._monthPickerYear = this._monthPickerYear + 1;
5736
+ } else {
5737
+ this._selectedMonth = {
5738
+ year: this._selectedMonth.year + 1,
5739
+ month: this._selectedMonth.month
5740
+ };
5741
+ }
5742
+ }
5743
+ /**
5744
+ * @internal
5745
+ */
5746
+ get _isPrevMonthDisabled() {
5747
+ return this.#isMonthBeforeValidRange(addMonths(this._selectedMonth, -1));
5748
+ }
5749
+ /**
5750
+ * @internal
5751
+ */
5752
+ _onPrevMonthClick() {
5753
+ this._selectedMonth = addMonths(this._selectedMonth, -1);
5754
+ }
5755
+ /**
5756
+ * @internal
5757
+ */
5758
+ get _isNextMonthDisabled() {
5759
+ return this.#isMonthAfterValidRange(addMonths(this._selectedMonth, 1));
5760
+ }
5761
+ /**
5762
+ * @internal
5763
+ */
5764
+ _onNextMonthClick() {
5765
+ this._selectedMonth = addMonths(this._selectedMonth, 1);
5766
+ }
5767
+ /**
5768
+ * @internal
5769
+ */
5770
+ get _segments() {
5771
+ const segments = [];
5772
+ if (this._inMonthPicker) {
5773
+ segments.push({
5774
+ id: 0,
5775
+ type: "month-picker",
5776
+ title: `${this._monthPickerYear}`,
5777
+ titleClickable: true,
5778
+ prevYearButton: true,
5779
+ nextYearButton: true,
5780
+ months: buildMonthPickerGrid(
5781
+ this._monthPickerYear,
5782
+ this.locale.calendarPicker
5783
+ )
5784
+ });
5785
+ } else {
5786
+ for (let i = 0; i < this._numCalendars; i++) {
5787
+ const month = addMonths(this._selectedMonth, i);
5788
+ const isSingle = this._numCalendars === 1;
5789
+ const isFirst = i === 0;
5790
+ const isLast = i === this._numCalendars - 1;
5791
+ segments.push({
5792
+ id: i,
5793
+ type: "calendar",
5794
+ title: `${this.locale.calendarPicker.months.name[month.month]} ${month.year}`,
5795
+ titleClickable: isSingle,
5796
+ prevYearButton: isFirst && isSingle,
5797
+ prevMonthButton: isFirst,
5798
+ nextMonthButton: isLast,
5799
+ nextYearButton: isLast && isSingle,
5800
+ calendar: buildCalendarGrid(month, this.locale.calendarPicker)
5801
+ });
5802
+ }
5803
+ }
5804
+ return segments;
5805
+ }
5806
+ /**
5807
+ * @internal
5808
+ */
5809
+ _isDateSelected(_) {
5810
+ return false;
5811
+ }
5812
+ /**
5813
+ * @internal
5814
+ * @private
5815
+ */
5816
+ _isDateInSelectedRange(_) {
5817
+ return false;
5818
+ }
5819
+ /**
5820
+ * @internal
5821
+ */
5822
+ _isDateRangeStart(_) {
5823
+ return false;
5824
+ }
5825
+ /**
5826
+ * @internal
5827
+ */
5828
+ _isDateRangeEnd(_) {
5829
+ return false;
5830
+ }
5831
+ /**
5832
+ * @internal
5833
+ */
5834
+ _onDateMouseEnter(_) {
5835
+ }
5836
+ /**
5837
+ * @internal
5838
+ */
5839
+ _onDateMouseLeave(_) {
5840
+ }
5841
+ /**
5842
+ * Handle keydown on a date in the calendar.
5843
+ * @internal
5844
+ */
5845
+ _onDateKeydown(date, event) {
5846
+ let newDate = null;
5847
+ if (event.key === "ArrowUp") {
5848
+ newDate = addDays(date, -7);
5849
+ } else if (event.key === "ArrowDown") {
5850
+ newDate = addDays(date, 7);
5851
+ } else if (event.key === "ArrowLeft") {
5852
+ newDate = addDays(date, -1);
5853
+ } else if (event.key === "ArrowRight") {
5854
+ newDate = addDays(date, 1);
5855
+ }
5856
+ if (newDate && this._isDateInValidRange(newDate)) {
5857
+ if (this._adjustSelectedMonthToEnsureVisibilityOf(newDate)) {
5858
+ vividElement.DOM.processUpdates();
5859
+ }
5860
+ this._dialogEl.querySelector(
5861
+ `[data-date="${newDate}"]`
5862
+ ).focus();
5863
+ return false;
5864
+ }
5865
+ return true;
5866
+ }
5867
+ /**
5868
+ * @internal
5869
+ */
5870
+ _onDateFocus(date) {
5871
+ this._lastFocussedDate = date;
5872
+ }
5873
+ get _tabbableDate() {
5874
+ const datesInSegments = this._segments.filter(
5875
+ (segment) => segment.type === "calendar"
5876
+ ).flatMap((segment) => segment.calendar.grid.flat().map((d) => d.date));
5877
+ const candidates = [
5878
+ this._lastFocussedDate,
5879
+ ...this._getSelectedDates(),
5880
+ currentDateStr(),
5881
+ ...datesInSegments
5882
+ ];
5883
+ const firstVisibleMonth = this._selectedMonth;
5884
+ const lastVisibleMonth = addMonths(
5885
+ this._selectedMonth,
5886
+ this._numCalendars - 1
5887
+ );
5888
+ return candidates.find(
5889
+ (date) => date && compareMonths(monthOfDate(date), firstVisibleMonth) >= 0 && compareMonths(monthOfDate(date), lastVisibleMonth) <= 0 && this._isDateInValidRange(date)
5890
+ ) ?? null;
5891
+ }
5892
+ /**
5893
+ * @internal
5894
+ */
5895
+ get _inMonthPicker() {
5896
+ return this._monthPickerYear !== null;
5897
+ }
5898
+ /**
5899
+ * Handle month selected in the month picker.
5900
+ * @internal
5901
+ */
5902
+ _onMonthClick(month) {
5903
+ this._selectedMonth = month;
5904
+ this._monthPickerYear = null;
5905
+ }
5906
+ /**
5907
+ * Handle keydown on a month in the month picker.
5908
+ * @internal
5909
+ */
5910
+ _onMonthKeydown(month, event) {
5911
+ let newMonth = null;
5912
+ if (event.key === "ArrowUp") {
5913
+ newMonth = addMonths(month, -4);
5914
+ } else if (event.key === "ArrowDown") {
5915
+ newMonth = addMonths(month, MonthsPerRow);
5916
+ } else if (event.key === "ArrowLeft") {
5917
+ newMonth = addMonths(month, -1);
5918
+ } else if (event.key === "ArrowRight") {
5919
+ newMonth = addMonths(month, 1);
5920
+ }
5921
+ if (newMonth && this._isMonthInValidRange(newMonth)) {
5922
+ if (newMonth.year !== this._monthPickerYear) {
5923
+ this._monthPickerYear = newMonth.year;
5924
+ vividElement.DOM.processUpdates();
5925
+ }
5926
+ this._dialogEl.querySelector(
5927
+ `[data-month="${monthToStr(newMonth)}"]`
5928
+ ).focus();
5929
+ return false;
5930
+ }
5931
+ return true;
5932
+ }
5933
+ /**
5934
+ * @internal
5935
+ */
5936
+ _onMonthFocus(month) {
5937
+ this._lastFocussedMonth = month;
5938
+ }
5939
+ get _tabbableMonth() {
5940
+ const monthsInSegments = this._segments.filter(
5941
+ (segments) => segments.type === "month-picker"
5942
+ ).flatMap((segment) => segment.months.flat().map((c) => c.month));
5943
+ const candidates = [
5944
+ this._lastFocussedMonth,
5945
+ this._selectedMonth,
5946
+ getCurrentMonth(),
5947
+ ...monthsInSegments
5948
+ ];
5949
+ return candidates.find(
5950
+ (month) => month && month.year === this._monthPickerYear && this._isMonthInValidRange(month)
5951
+ ) ?? null;
5952
+ }
5953
+ }
5954
+ __decorateClass$1([
5955
+ vividElement.observable
5956
+ ], CalendarPickerElement.prototype, "_selectedMonth", 2);
5957
+ __decorateClass$1([
5958
+ vividElement.volatile
5959
+ ], CalendarPickerElement.prototype, "_isPrevYearDisabled", 1);
5960
+ __decorateClass$1([
5961
+ vividElement.volatile
5962
+ ], CalendarPickerElement.prototype, "_isNextYearDisabled", 1);
5963
+ __decorateClass$1([
5964
+ vividElement.observable
5965
+ ], CalendarPickerElement.prototype, "_numCalendars", 2);
5966
+ __decorateClass$1([
5967
+ vividElement.observable
5968
+ ], CalendarPickerElement.prototype, "_lastFocussedDate", 2);
5969
+ __decorateClass$1([
5970
+ vividElement.volatile
5971
+ ], CalendarPickerElement.prototype, "_tabbableDate", 1);
5972
+ __decorateClass$1([
5973
+ vividElement.observable
5974
+ ], CalendarPickerElement.prototype, "_monthPickerYear", 2);
5975
+ __decorateClass$1([
5976
+ vividElement.observable
5977
+ ], CalendarPickerElement.prototype, "_lastFocussedMonth", 2);
5978
+ __decorateClass$1([
5979
+ vividElement.volatile
5980
+ ], CalendarPickerElement.prototype, "_tabbableMonth", 1);
5981
+ return CalendarPickerElement;
5982
+ };
5983
+
5984
+ var __defProp = Object.defineProperty;
5985
+ var __decorateClass = (decorators, target, key, kind) => {
5986
+ var result = void 0 ;
5987
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
5988
+ if (decorator = decorators[i])
5989
+ result = (decorator(target, key, result) ) || result;
5990
+ if (result) __defProp(target, key, result);
5991
+ return result;
5992
+ };
5993
+ const ValidDateFilter = {
5994
+ fromView: (value) => {
5995
+ if (value && isValidDateStr(value)) {
5996
+ return value;
5997
+ }
5998
+ return "";
5999
+ },
6000
+ toView(value) {
6001
+ return value;
6002
+ }
6003
+ };
6004
+ const MinMaxCalendarPicker = (SuperClass) => {
6005
+ class MinMaxDatePickerElement extends SuperClass {
6006
+ /**
6007
+ * @internal
6008
+ */
6009
+ minChanged(_, newMin) {
6010
+ if (this.proxy instanceof HTMLInputElement) {
6011
+ this.proxy.min = newMin;
6012
+ this.validate();
6013
+ }
6014
+ }
6015
+ /**
6016
+ * @internal
6017
+ */
6018
+ get _resolvedMinDate() {
6019
+ return this.min;
6020
+ }
6021
+ /**
6022
+ * @internal
6023
+ */
6024
+ maxChanged(_, newMax) {
6025
+ if (this.proxy instanceof HTMLInputElement) {
6026
+ this.proxy.max = newMax;
6027
+ this.validate();
6028
+ }
6029
+ }
6030
+ /**
6031
+ * The latest accepted date.
6032
+ * @internal
6033
+ */
6034
+ get _resolvedMaxDate() {
6035
+ return this.max;
6036
+ }
6037
+ constructor(...args) {
6038
+ super(...args);
6039
+ this.min = "";
6040
+ this.max = "";
6041
+ }
6042
+ }
6043
+ __decorateClass([
6044
+ vividElement.attr({ converter: ValidDateFilter })
6045
+ ], MinMaxDatePickerElement.prototype, "min");
6046
+ __decorateClass([
6047
+ vividElement.attr({ converter: ValidDateFilter })
6048
+ ], MinMaxDatePickerElement.prototype, "max");
6049
+ return MinMaxDatePickerElement;
6050
+ };
6051
+
5527
6052
  function renderDialogHeader(context) {
5528
- const buttonTag = context.tagFor(definition$1.Button);
5529
- return vividElement.html`<div class="header">
6053
+ const buttonTag = context.tagFor(definition.Button);
6054
+ return vividElement.html` <div class="header">
5530
6055
  ${when.when(
5531
6056
  (x) => x.prevYearButton,
5532
6057
  vividElement.html`
5533
6058
  <${buttonTag}
5534
- tabindex="1"
5535
- class="vwc-button"
5536
- size="super-condensed"
5537
- icon="${(_, c) => c.parent._inMonthPicker ? "chevron-left-line" : "double-chevron-left-line"}"
5538
- aria-label="${(_, c) => c.parent.locale.datePicker.prevYearLabel}"
5539
- ?disabled="${(_, c) => c.parent._isPrevYearDisabled}"
5540
- @click="${(_, c) => c.parent._onPrevYearClick()}"
6059
+ tabindex='1'
6060
+ class='vwc-button'
6061
+ size='super-condensed'
6062
+ icon='${(_, c) => c.parent._inMonthPicker ? "chevron-left-line" : "double-chevron-left-line"}'
6063
+ aria-label='${(_, c) => c.parent.locale.calendarPicker.prevYearLabel}'
6064
+ ?disabled='${(_, c) => c.parent._isPrevYearDisabled}'
6065
+ @click='${(_, c) => c.parent._onPrevYearClick()}'
5541
6066
  ></${buttonTag}>
5542
- `
6067
+ `
5543
6068
  )}
5544
6069
  ${when.when(
5545
6070
  (x) => x.prevMonthButton,
5546
6071
  vividElement.html`
5547
6072
  <${buttonTag}
5548
- tabindex="1"
5549
- class="vwc-button"
5550
- size="super-condensed"
5551
- icon="chevron-left-line"
5552
- aria-label="${(_, c) => c.parent.locale.datePicker.prevMonthLabel}"
5553
- ?disabled="${(_, c) => c.parent._isPrevMonthDisabled}"
5554
- @click="${(_, c) => c.parent._onPrevMonthClick()}"
6073
+ tabindex='1'
6074
+ class='vwc-button'
6075
+ size='super-condensed'
6076
+ icon='chevron-left-line'
6077
+ aria-label='${(_, c) => c.parent.locale.calendarPicker.prevMonthLabel}'
6078
+ ?disabled='${(_, c) => c.parent._isPrevMonthDisabled}'
6079
+ @click='${(_, c) => c.parent._onPrevMonthClick()}'
5555
6080
  ></${buttonTag}>
5556
- `
6081
+ `
5557
6082
  )}
5558
6083
  <div class="title">
5559
6084
  ${when.when(
@@ -5587,70 +6112,71 @@ function renderDialogHeader(context) {
5587
6112
  ${when.when(
5588
6113
  (x) => x.nextMonthButton,
5589
6114
  vividElement.html`
5590
- <${buttonTag}
5591
- tabindex="1"
5592
- class="vwc-button"
5593
- size="super-condensed"
5594
- icon="chevron-right-line"
5595
- aria-label="${(_, c) => c.parent.locale.datePicker.nextMonthLabel}"
5596
- ?disabled="${(_, c) => c.parent._isNextMonthDisabled}"
5597
- @click="${(_, c) => c.parent._onNextMonthClick()}"
5598
- ></${buttonTag}>
5599
- `
6115
+ <${buttonTag}
6116
+ tabindex='1'
6117
+ class='vwc-button'
6118
+ size='super-condensed'
6119
+ icon='chevron-right-line'
6120
+ aria-label='${(_, c) => c.parent.locale.calendarPicker.nextMonthLabel}'
6121
+ ?disabled='${(_, c) => c.parent._isNextMonthDisabled}'
6122
+ @click='${(_, c) => c.parent._onNextMonthClick()}'
6123
+ ></${buttonTag}>
6124
+ `
5600
6125
  )}
5601
6126
  ${when.when(
5602
6127
  (x) => x.nextYearButton,
5603
6128
  vividElement.html`
5604
- <${buttonTag}
5605
- tabindex="1"
5606
- class="vwc-button"
5607
- size="super-condensed"
5608
- icon="${(_, c) => c.parent._inMonthPicker ? "chevron-right-line" : "double-chevron-right-line"}"
5609
- aria-label="${(_, c) => c.parent.locale.datePicker.nextYearLabel}"
5610
- ?disabled="${(_, c) => c.parent._isNextYearDisabled}"
5611
- @click="${(_, c) => c.parent._onNextYearClick()}"
5612
- ></${buttonTag}>
5613
- `
6129
+ <${buttonTag}
6130
+ tabindex='1'
6131
+ class='vwc-button'
6132
+ size='super-condensed'
6133
+ icon='${(_, c) => c.parent._inMonthPicker ? "chevron-right-line" : "double-chevron-right-line"}'
6134
+ aria-label='${(_, c) => c.parent.locale.calendarPicker.nextYearLabel}'
6135
+ ?disabled='${(_, c) => c.parent._isNextYearDisabled}'
6136
+ @click='${(_, c) => c.parent._onNextYearClick()}'
6137
+ ></${buttonTag}>
6138
+ `
5614
6139
  )}
5615
6140
  </div>`;
5616
6141
  }
5617
6142
  function renderCalendarGrid(context) {
5618
- const dividerTag = context.tagFor(definition$2.Divider);
5619
- return vividElement.html`<div
5620
- class="calendar"
5621
- role="grid"
5622
- aria-labelledby="${(x) => `grid-label-${x.id}`}"
5623
- >
5624
- <div class="calendar-weekdays" role="row">
5625
- ${repeat.repeat(
6143
+ const dividerTag = context.tagFor(definition$1.Divider);
6144
+ return vividElement.html`
6145
+ <div
6146
+ class='calendar'
6147
+ role='grid'
6148
+ aria-labelledby='${(x) => `grid-label-${x.id}`}'
6149
+ >
6150
+ <div class='calendar-weekdays' role='row'>
6151
+ ${repeat.repeat(
5626
6152
  (x) => x.calendar.weekdays,
5627
6153
  vividElement.html`
5628
- <div
5629
- class="calendar-weekday"
5630
- role="columnheader"
5631
- aria-label="${(x) => x.name}"
5632
- >
5633
- ${(x) => x.shortName}
5634
- </div>
5635
- `
6154
+ <div
6155
+ class="calendar-weekday"
6156
+ role="columnheader"
6157
+ aria-label="${(x) => x.name}"
6158
+ >
6159
+ ${(x) => x.shortName}
6160
+ </div>
6161
+ `
5636
6162
  )}
5637
- </div>
5638
- <${dividerTag} class="calendar-separator" role="presentation"></${dividerTag}>
5639
- ${repeat.repeat(
6163
+ </div>
6164
+ <${dividerTag} class='calendar-separator' role='presentation'></${dividerTag}>
6165
+ ${repeat.repeat(
5640
6166
  (x) => x.calendar.grid,
5641
6167
  vividElement.html` <div class="calendar-week" role="row">
5642
- ${repeat.repeat(
6168
+ ${repeat.repeat(
5643
6169
  (x) => x,
5644
6170
  vividElement.html`
5645
- ${when.when(
6171
+ ${when.when(
5646
6172
  (x, c) => c.parentContext.parentContext.parent._hideDatesOutsideMonth && x.isOutsideMonth,
5647
6173
  vividElement.html`<div class="calendar-day"></div>`
5648
6174
  )}
5649
- ${when.when(
6175
+ ${when.when(
5650
6176
  (x, c) => !c.parentContext.parentContext.parent._hideDatesOutsideMonth || !x.isOutsideMonth,
5651
6177
  vividElement.html` <span role="gridcell">
5652
- <button
5653
- class="${(x, c) => classNames.classNames(
6178
+ <button
6179
+ class="${(x, c) => classNames.classNames(
5654
6180
  "calendar-day",
5655
6181
  "button",
5656
6182
  [
@@ -5659,7 +6185,9 @@ function renderCalendarGrid(context) {
5659
6185
  ],
5660
6186
  [
5661
6187
  "selected",
5662
- c.parentContext.parentContext.parent._isDateSelected(x.date)
6188
+ c.parentContext.parentContext.parent._isDateSelected(
6189
+ x.date
6190
+ )
5663
6191
  ],
5664
6192
  [
5665
6193
  "range",
@@ -5675,57 +6203,69 @@ function renderCalendarGrid(context) {
5675
6203
  ],
5676
6204
  [
5677
6205
  "end",
5678
- c.parentContext.parentContext.parent._isDateRangeEnd(x.date)
6206
+ c.parentContext.parentContext.parent._isDateRangeEnd(
6207
+ x.date
6208
+ )
5679
6209
  ],
5680
6210
  ["outside-month", x.isOutsideMonth]
5681
6211
  )}"
5682
- ?disabled="${(x, c) => !c.parentContext.parentContext.parent._isDateInValidRange(
6212
+ ?disabled="${(x, c) => !c.parentContext.parentContext.parent._isDateInValidRange(
6213
+ x.date
6214
+ )}"
6215
+ tabindex="${(x, c) => x.date === c.parentContext.parentContext.parent._tabbableDate ? 2 : -1}"
6216
+ aria-selected="${(x, c) => c.parentContext.parentContext.parent._isDateAriaSelected(
6217
+ x.date
6218
+ )}"
6219
+ data-date="${(x) => x.date}"
6220
+ @click="${(x, c) => c.parentContext.parentContext.parent._onDateClick(
6221
+ x.date
6222
+ )}"
6223
+ @focus="${(x, c) => c.parentContext.parentContext.parent._onDateFocus(
6224
+ x.date
6225
+ )}"
6226
+ @mouseenter="${(x, c) => c.parentContext.parentContext.parent._onDateMouseEnter(
6227
+ x.date
6228
+ )}"
6229
+ @mouseleave="${(x, c) => c.parentContext.parentContext.parent._onDateMouseLeave(
5683
6230
  x.date
5684
6231
  )}"
5685
- tabindex="${(x, c) => x.date === c.parentContext.parentContext.parent._tabbableDate ? 2 : -1}"
5686
- aria-selected="${(x, c) => c.parentContext.parentContext.parent._isDateAriaSelected(x.date)}"
5687
- data-date="${(x) => x.date}"
5688
- @click="${(x, c) => c.parentContext.parentContext.parent._onDateClick(x.date)}"
5689
- @focus="${(x, c) => c.parentContext.parentContext.parent._onDateFocus(x.date)}"
5690
- @mouseenter="${(x, c) => c.parentContext.parentContext.parent._onDateMouseEnter(x.date)}"
5691
- @mouseleave="${(x, c) => c.parentContext.parentContext.parent._onDateMouseLeave(x.date)}"
5692
- @keydown="${(x, c) => c.parentContext.parentContext.parent._onDateKeydown(
6232
+ @keydown="${(x, c) => c.parentContext.parentContext.parent._onDateKeydown(
5693
6233
  x.date,
5694
6234
  c.event
5695
6235
  )}"
5696
- >
5697
- ${(x) => x.label}
5698
- </button>
5699
- </span>`
6236
+ >
6237
+ ${(x) => x.label}
6238
+ </button>
6239
+ </span>`
5700
6240
  )}
5701
- </div>
5702
- `
6241
+ </div>
6242
+ `
5703
6243
  )}
5704
- </div>`
6244
+ </div>`
5705
6245
  )}`;
5706
6246
  }
5707
6247
  function renderMonthPickerGrid(context) {
5708
- const dividerTag = context.tagFor(definition$2.Divider);
6248
+ const dividerTag = context.tagFor(definition$1.Divider);
5709
6249
  return vividElement.html`
5710
6250
  <${dividerTag}
5711
- class="months-separator"
5712
- role="presentation"
6251
+ class='months-separator'
6252
+ role='presentation'
5713
6253
  ></${dividerTag}>
5714
6254
  <div
5715
- class="month-grid"
5716
- role="grid"
5717
- aria-labelledby="grid-label"
5718
- >
5719
- ${repeat.repeat(
6255
+ class='month-grid'
6256
+ role='grid'
6257
+ aria-labelledby='grid-label'
6258
+ >
6259
+ ${repeat.repeat(
5720
6260
  (x) => x.months,
5721
6261
  vividElement.html`
5722
- <div class="months-row" role="row">
5723
- ${repeat.repeat(
6262
+ <div class="months-row" role="row">
6263
+ ${repeat.repeat(
5724
6264
  (x) => x,
5725
6265
  vividElement.html`
5726
- <span role="gridcell">
5727
- <button
5728
- class="${(x, c) => classNames.classNames(
6266
+ <span role="gridcell">
6267
+ <button
6268
+ class="${(x, c) => classNames.classNames(
5729
6269
  "month",
5730
6270
  "button",
5731
6271
  [
@@ -5743,780 +6283,68 @@ function renderMonthPickerGrid(context) {
5743
6283
  )
5744
6284
  ]
5745
6285
  )}"
5746
- tabindex="${(x, c) => c.parentContext.parentContext.parent._tabbableMonth && areMonthsEqual(
6286
+ tabindex="${(x, c) => c.parentContext.parentContext.parent._tabbableMonth && areMonthsEqual(
5747
6287
  x.month,
5748
6288
  c.parentContext.parentContext.parent._tabbableMonth
5749
6289
  ) ? 2 : -1}"
5750
- aria-label="${(x) => x.monthName}"
5751
- aria-selected="${(x, c) => areMonthsEqual(
6290
+ aria-label="${(x) => x.monthName}"
6291
+ aria-selected="${(x, c) => areMonthsEqual(
5752
6292
  x.month,
5753
6293
  c.parentContext.parentContext.parent._selectedMonth
5754
6294
  )}"
5755
- data-month="${(x) => monthToStr(x.month)}"
5756
- ?disabled="${(x, c) => !c.parentContext.parentContext.parent._isMonthInValidRange(
6295
+ data-month="${(x) => monthToStr(x.month)}"
6296
+ ?disabled="${(x, c) => !c.parentContext.parentContext.parent._isMonthInValidRange(
5757
6297
  x.month
5758
6298
  )}"
5759
- @click="${(x, c) => c.parentContext.parentContext.parent._onMonthClick(
6299
+ @click="${(x, c) => c.parentContext.parentContext.parent._onMonthClick(
5760
6300
  x.month
5761
6301
  )}"
5762
- @focus="${(x, c) => c.parentContext.parentContext.parent._onMonthFocus(
6302
+ @focus="${(x, c) => c.parentContext.parentContext.parent._onMonthFocus(
5763
6303
  x.month
5764
6304
  )}"
5765
- @keydown="${(x, c) => c.parentContext.parentContext.parent._onMonthKeydown(
6305
+ @keydown="${(x, c) => c.parentContext.parentContext.parent._onMonthKeydown(
5766
6306
  x.month,
5767
6307
  c.event
5768
6308
  )}"
5769
- >
5770
- ${(x) => x.label}
5771
- </button>
5772
- </span>
5773
- `
6309
+ >
6310
+ ${(x) => x.label}
6311
+ </button>
6312
+ </span>
6313
+ `
5774
6314
  )}
5775
- </div>
5776
- `
6315
+ </div>
6316
+ `
5777
6317
  )}
5778
- </div>`;
6318
+ </div>`;
5779
6319
  }
5780
- const DatePickerBaseTemplate = (context) => {
5781
- const popupTag = context.tagFor(definition.Popup);
5782
- const textFieldTag = context.tagFor(textField.TextField);
5783
- const buttonTag = context.tagFor(definition$1.Button);
5784
- return vividElement.html`<div class="base" @keydown="${(x, { event }) => x._onBaseKeyDown(event)}">
5785
- <${textFieldTag} id="text-field"
5786
- ${ref.ref("_textFieldEl")}
5787
- class="control"
5788
- label="${(x) => x.label}"
5789
- helper-text="${(x) => x.helperText}"
5790
- error-text="${(x) => x.errorValidationMessage}"
5791
- placeholder="${(x) => x._textFieldPlaceholder}"
5792
- size="${(x) => x._textFieldSize}"
5793
- current-value="${(x) => x._presentationValue}"
5794
- ?disabled="${(x) => x.disabled}"
5795
- ?readonly="${(x) => x.readOnly}"
5796
- @input="${(x, c) => x._onTextFieldInput(c.event)}"
5797
- @change="${(x) => x._onTextFieldChange()}"
5798
- >
5799
- <slot
5800
- slot="${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}"
5801
- name="helper-text"
5802
- ${slotted.slotted("_helperTextSlottedContent")}
5803
- ></slot>
5804
- <${buttonTag}
5805
- id="calendar-button"
5806
- ${ref.ref("_calendarButtonEl")}
5807
- slot="action-items"
5808
- size="condensed"
5809
- icon="calendar-line"
5810
- appearance="ghost"
5811
- ?disabled="${(x) => x.disabled || x.readOnly}"
5812
- aria-label="${(x) => x._calendarButtonLabel}"
5813
- @click="${(x) => x._onCalendarButtonClick()}"
5814
- ></${buttonTag}>
5815
- </${textFieldTag}>
5816
- <${popupTag}
5817
- ?open="${(x) => x._popupOpen}"
5818
- :anchor="${(x) => x._textFieldEl}"
5819
- placement="bottom-start"
5820
- class="popup">
5821
- <div class="dialog" role="dialog" ${ref.ref(
5822
- "_dialogEl"
5823
- )} aria-modal="true" aria-label="${(x) => x.locale.datePicker.chooseDateLabel}">
5824
- <div class="segments">
5825
- ${repeat.repeat(
6320
+ const CalendarPickerTemplate = (context) => {
6321
+ return vividElement.html`
6322
+ <div class="segments">
6323
+ ${repeat.repeat(
5826
6324
  (x) => x._segments,
5827
6325
  vividElement.html` <div class="segment">
5828
- ${renderDialogHeader(context)}
5829
- ${when.when(
6326
+ ${renderDialogHeader(context)}
6327
+ ${when.when(
5830
6328
  (x) => x.type === "month-picker",
5831
6329
  vividElement.html`${renderMonthPickerGrid(context)}`
5832
6330
  )}
5833
- ${when.when(
6331
+ ${when.when(
5834
6332
  (x) => x.type === "calendar",
5835
6333
  vividElement.html`${renderCalendarGrid(context)}`
5836
6334
  )}
5837
- </div>`
6335
+ </div>`
5838
6336
  )}
5839
- </div>
5840
- <div class="footer">
5841
- <${buttonTag}
5842
- tabindex="3"
5843
- class="vwc-button"
5844
- size="condensed"
5845
- label="${(x) => x.locale.datePicker.clearLabel}"
5846
- @click="${(x) => x._onClearClick()},
5847
- ${(x) => x.$emit("clear-click")}"
5848
- ></${buttonTag}>
5849
- <${buttonTag}
5850
- tabindex="3"
5851
- class="vwc-button"
5852
- size="condensed"
5853
- appearance="filled"
5854
- label="${(x) => x.locale.datePicker.okLabel}"
5855
- @click="${(x) => x._onOkClick()}"
5856
- ></${buttonTag}>
5857
- </div>
5858
- </div>
5859
- </${popupTag}>
5860
- </div>`;
5861
- };
5862
-
5863
- const getWeekdays = (locale) => {
5864
- const firstDayOfWeek = locale.firstDayOfWeek;
5865
- const localeWeekdayToNative = (day) => (day + firstDayOfWeek) % 7;
5866
- const days = [];
5867
- for (let i = 0; i < 7; i++) {
5868
- days.push({
5869
- name: locale.weekdays.name[localeWeekdayToNative(i)],
5870
- shortName: locale.weekdays.shorthand[localeWeekdayToNative(i)]
5871
- });
5872
- }
5873
- return days;
5874
- };
5875
- const gridDate = (date, isOutsideMonth2) => ({
5876
- date: formatDateStr(date),
5877
- label: `${date.getDate()}`,
5878
- isOutsideMonth: isOutsideMonth2
5879
- });
5880
- function isOutsideMonth(dayIndexInMonth, daysInMonth) {
5881
- return dayIndexInMonth < 0 || dayIndexInMonth >= daysInMonth;
5882
- }
5883
- const buildDateGrid = ({ month, year }, getDay) => {
5884
- const grid = [];
5885
- const firstDay = new Date(year, month, 1);
5886
- const lastDay = new Date(year, month + 1, 0);
5887
- const firstDayInWeek = getDay(firstDay);
5888
- const daysInMonth = lastDay.getDate();
5889
- const daysOutsideMonthInLastWeek = 7 - getDay(lastDay);
5890
- const totalDaysInCalendar = daysInMonth + firstDayInWeek + daysOutsideMonthInLastWeek;
5891
- let week = [];
5892
- for (let i = 0; i < totalDaysInCalendar; i++) {
5893
- const dayIndexInMonth = i - firstDayInWeek;
5894
- week.push(
5895
- gridDate(
5896
- addDays$1(firstDay, dayIndexInMonth),
5897
- isOutsideMonth(dayIndexInMonth, daysInMonth)
5898
- )
5899
- );
5900
- if (week.length === 7) {
5901
- grid.push(week);
5902
- week = [];
5903
- }
5904
- }
5905
- return grid;
5906
- };
5907
- const buildCalendarGrid = (month, locale) => {
5908
- const { firstDayOfWeek } = locale;
5909
- const getShiftedDay = (date) => (date.getDay() - firstDayOfWeek + 7) % 7;
5910
- return {
5911
- weekdays: getWeekdays(locale),
5912
- grid: buildDateGrid(month, getShiftedDay)
5913
- };
5914
- };
5915
-
5916
- const MonthsPerRow = 4;
5917
- const buildMonthPickerGrid = (year, locale) => {
5918
- const grid = [];
5919
- let row = [];
5920
- for (let i = 0; i < 12; i++) {
5921
- const month = { month: i, year };
5922
- row.push({
5923
- label: locale.months.shorthand[i],
5924
- monthName: locale.months.name[i],
5925
- month
5926
- });
5927
- if (row.length === MonthsPerRow) {
5928
- grid.push(row);
5929
- row = [];
5930
- }
5931
- }
5932
- return grid;
5933
- };
5934
-
5935
- const yearOfDate = (dateStr) => {
5936
- const date = parseDateStr(dateStr);
5937
- return date.getFullYear();
5938
- };
5939
-
5940
- class _DatePickerBase extends vividElement.VividElement {
5941
- }
5942
- class FormAssociatedDatePickerBase extends formAssociated.FormAssociated(
5943
- _DatePickerBase
5944
- ) {
5945
- constructor() {
5946
- super(...arguments);
5947
- this.proxy = document.createElement("input");
5948
- }
5949
- }
5950
-
5951
- var __defProp = Object.defineProperty;
5952
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5953
- var __decorateClass = (decorators, target, key, kind) => {
5954
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5955
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
5956
- if (decorator = decorators[i])
5957
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5958
- if (kind && result) __defProp(target, key, result);
5959
- return result;
5960
- };
5961
- const ValidDateFilter = {
5962
- fromView: (value) => {
5963
- if (value && isValidDateStr(value)) {
5964
- return value;
5965
- }
5966
- return "";
5967
- },
5968
- toView(value) {
5969
- return value;
5970
- }
5971
- };
5972
- class DatePickerBase extends FormAssociatedDatePickerBase {
5973
- // --- Core ---
5974
- constructor() {
5975
- super();
5976
- this.readOnly = false;
5977
- this._selectedMonth = getCurrentMonth();
5978
- /**
5979
- * Today's date.
5980
- * @internal
5981
- */
5982
- this._currentDate = currentDateStr();
5983
- /**
5984
- * Today's month.
5985
- * @internal
5986
- */
5987
- this._currentMonth = getCurrentMonth();
5988
- this.#onFocusIn = () => {
5989
- this.$emit("focus", void 0, { bubbles: false });
5990
- };
5991
- this.#onFocusOut = () => {
5992
- this.$emit("blur", void 0, { bubbles: false });
5993
- };
5994
- // Reformat the presentation value when the locale changes
5995
- this.#localeChangeHandler = {
5996
- handleChange: () => {
5997
- this._updatePresentationValue();
5998
- }
5999
- };
6000
- this._popupOpen = false;
6001
- this.#dismissOnClickOutside = (event) => {
6002
- if (!this._popupOpen) {
6003
- return;
6004
- }
6005
- const path = event.composedPath();
6006
- const elementsToIgnoreClicksOn = [this._dialogEl, this._calendarButtonEl];
6007
- if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
6008
- this._closePopup(false);
6009
- }
6010
- };
6011
- this._presentationValue = "";
6012
- this._numCalendars = 1;
6013
- /**
6014
- * @internal
6015
- */
6016
- this._hideDatesOutsideMonth = false;
6017
- this._lastFocussedDate = null;
6018
- this._monthPickerYear = null;
6019
- this._lastFocussedMonth = null;
6020
- this.value = "";
6021
- this.min = "";
6022
- this.max = "";
6023
- }
6024
- /**
6025
- * @internal
6026
- */
6027
- minChanged(_, newMin) {
6028
- if (this.proxy instanceof HTMLInputElement) {
6029
- this.proxy.min = newMin;
6030
- this.validate();
6031
- }
6032
- }
6033
- /**
6034
- * @internal
6035
- */
6036
- maxChanged(_, newMax) {
6037
- if (this.proxy instanceof HTMLInputElement) {
6038
- this.proxy.max = newMax;
6039
- this.validate();
6040
- }
6041
- }
6042
- /**
6043
- * @internal
6044
- */
6045
- readOnlyChanged() {
6046
- if (this.proxy instanceof HTMLInputElement) {
6047
- this.proxy.readOnly = this.readOnly;
6048
- this.validate();
6049
- }
6050
- }
6051
- _adjustSelectedMonthToEnsureVisibilityOf(date) {
6052
- const month = monthOfDate(date);
6053
- const firstDisplayedMonth = this._selectedMonth;
6054
- const lastDisplayedMonth = addMonths(
6055
- this._selectedMonth,
6056
- this._numCalendars - 1
6057
- );
6058
- if (compareMonths(month, firstDisplayedMonth) < 0) {
6059
- this._selectedMonth = month;
6060
- return true;
6061
- } else if (compareMonths(month, lastDisplayedMonth) > 0) {
6062
- this._selectedMonth = addMonths(month, 1 - this._numCalendars);
6063
- return true;
6064
- }
6065
- return false;
6066
- }
6067
- /**
6068
- * @internal
6069
- */
6070
- _isDateInValidRange(date) {
6071
- return (!this.min || compareDateStr(date, this.min) >= 0) && (!this.max || compareDateStr(date, this.max) <= 0);
6072
- }
6073
- #isMonthAfterValidRange(month) {
6074
- return this.max && compareMonths(month, monthOfDate(this.max)) > 0;
6075
- }
6076
- #isMonthBeforeValidRange(month) {
6077
- return this.min && compareMonths(month, monthOfDate(this.min)) < 0;
6078
- }
6079
- /**
6080
- * @internal
6081
- */
6082
- _isMonthInValidRange(month) {
6083
- return !(this.#isMonthBeforeValidRange(month) || this.#isMonthAfterValidRange(month));
6084
- }
6085
- connectedCallback() {
6086
- super.connectedCallback();
6087
- document.addEventListener("click", this.#dismissOnClickOutside);
6088
- this.addEventListener("focusin", this.#onFocusIn);
6089
- this.addEventListener("focusout", this.#onFocusOut);
6090
- this.#localeChangeObserver = vividElement.Observable.binding(
6091
- () => this.locale,
6092
- this.#localeChangeHandler
6093
- );
6094
- this.#localeChangeObserver.observe(this, vividElement.defaultExecutionContext);
6095
- }
6096
- disconnectedCallback() {
6097
- super.disconnectedCallback();
6098
- document.removeEventListener("click", this.#dismissOnClickOutside);
6099
- this.removeEventListener("focusin", this.#onFocusIn);
6100
- this.removeEventListener("focusout", this.#onFocusOut);
6101
- this.#localeChangeObserver.disconnect();
6102
- }
6103
- #onFocusIn;
6104
- #onFocusOut;
6105
- /**
6106
- * @internal
6107
- */
6108
- validate() {
6109
- if (this.proxy) {
6110
- this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
6111
- }
6112
- super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
6113
- }
6114
- #localeChangeHandler;
6115
- #localeChangeObserver;
6116
- #dismissOnClickOutside;
6117
- #openPopupIfPossible() {
6118
- if (!this.readOnly) {
6119
- this._popupOpen = true;
6120
- }
6121
- }
6122
- /**
6123
- * @internal
6124
- */
6125
- _closePopup(restoreFocusToTextField = true) {
6126
- this._popupOpen = false;
6127
- this._monthPickerYear = null;
6128
- if (restoreFocusToTextField) {
6129
- this._textFieldEl.focus();
6130
- }
6131
- }
6132
- /**
6133
- * On keydown anywhere in the date picker.
6134
- * @internal
6135
- */
6136
- _onBaseKeyDown(event) {
6137
- if (this._popupOpen && index.handleEscapeKeyAndStopPropogation(event)) {
6138
- this._closePopup();
6139
- return false;
6140
- }
6141
- if (this._trappedFocus(
6142
- event,
6143
- () => this.shadowRoot.querySelectorAll(`
6144
- .dialog .button:not(:disabled),
6145
- .dialog .vwc-button:not(:disabled)
6146
- `)
6147
- )) {
6148
- return false;
6149
- }
6150
- return true;
6151
- }
6152
- /**
6153
- * @internal
6154
- */
6155
- _presentationValueChanged() {
6156
- this.dirtyValue = true;
6157
- this.validate();
6158
- }
6159
- /**
6160
- * @internal
6161
- */
6162
- _onTextFieldInput(event) {
6163
- const textField = event.currentTarget;
6164
- this._presentationValue = textField.value;
6165
- }
6166
- /**
6167
- * @internal
6168
- */
6169
- _onCalendarButtonClick() {
6170
- if (this._popupOpen) {
6171
- this._closePopup();
6172
- } else {
6173
- this.#openPopupIfPossible();
6174
- vividElement.DOM.processUpdates();
6175
- const tabbableDate = this._tabbableDate;
6176
- if (tabbableDate)
6177
- this.shadowRoot.querySelector(
6178
- `[data-date="${tabbableDate}"]`
6179
- ).focus();
6180
- }
6181
- }
6182
- // --- Dialog header ---
6183
- /**
6184
- * @internal
6185
- */
6186
- _onTitleActionClick() {
6187
- if (this._inMonthPicker) {
6188
- this._monthPickerYear = null;
6189
- } else {
6190
- this._monthPickerYear = this._selectedMonth.year;
6191
- }
6192
- }
6193
- get _isPrevYearDisabled() {
6194
- const currentYear = this._inMonthPicker ? this._monthPickerYear : this._selectedMonth.year;
6195
- const prevYear = currentYear - 1;
6196
- return this.min && prevYear < yearOfDate(this.min);
6197
- }
6198
- /**
6199
- * @internal
6200
- */
6201
- _onPrevYearClick() {
6202
- if (this._inMonthPicker) {
6203
- this._monthPickerYear = this._monthPickerYear - 1;
6204
- } else {
6205
- this._selectedMonth = {
6206
- year: this._selectedMonth.year - 1,
6207
- month: this._selectedMonth.month
6208
- };
6209
- }
6210
- }
6211
- get _isNextYearDisabled() {
6212
- const currentYear = this._inMonthPicker ? this._monthPickerYear : this._selectedMonth.year;
6213
- const nextYear = currentYear + 1;
6214
- return this.max && nextYear > yearOfDate(this.max);
6215
- }
6216
- /**
6217
- * @internal
6218
- */
6219
- _onNextYearClick() {
6220
- if (this._inMonthPicker) {
6221
- this._monthPickerYear = this._monthPickerYear + 1;
6222
- } else {
6223
- this._selectedMonth = {
6224
- year: this._selectedMonth.year + 1,
6225
- month: this._selectedMonth.month
6226
- };
6227
- }
6228
- }
6229
- /**
6230
- * @internal
6231
- */
6232
- get _isPrevMonthDisabled() {
6233
- return this.#isMonthBeforeValidRange(addMonths(this._selectedMonth, -1));
6234
- }
6235
- /**
6236
- * @internal
6237
- */
6238
- _onPrevMonthClick() {
6239
- this._selectedMonth = addMonths(this._selectedMonth, -1);
6240
- }
6241
- /**
6242
- * @internal
6243
- */
6244
- get _isNextMonthDisabled() {
6245
- return this.#isMonthAfterValidRange(addMonths(this._selectedMonth, 1));
6246
- }
6247
- /**
6248
- * @internal
6249
- */
6250
- _onNextMonthClick() {
6251
- this._selectedMonth = addMonths(this._selectedMonth, 1);
6252
- }
6253
- /**
6254
- * @internal
6255
- */
6256
- get _segments() {
6257
- const segments = [];
6258
- if (this._inMonthPicker) {
6259
- segments.push({
6260
- id: 0,
6261
- type: "month-picker",
6262
- title: `${this._monthPickerYear}`,
6263
- titleClickable: true,
6264
- prevYearButton: true,
6265
- nextYearButton: true,
6266
- months: buildMonthPickerGrid(
6267
- this._monthPickerYear,
6268
- this.locale.datePicker
6269
- )
6270
- });
6271
- } else {
6272
- for (let i = 0; i < this._numCalendars; i++) {
6273
- const month = addMonths(this._selectedMonth, i);
6274
- const isSingle = this._numCalendars === 1;
6275
- const isFirst = i === 0;
6276
- const isLast = i === this._numCalendars - 1;
6277
- segments.push({
6278
- id: i,
6279
- type: "calendar",
6280
- title: `${this.locale.datePicker.months.name[month.month]} ${month.year}`,
6281
- titleClickable: isSingle,
6282
- prevYearButton: isFirst && isSingle,
6283
- prevMonthButton: isFirst,
6284
- nextMonthButton: isLast,
6285
- nextYearButton: isLast && isSingle,
6286
- calendar: buildCalendarGrid(month, this.locale.datePicker)
6287
- });
6288
- }
6289
- }
6290
- return segments;
6291
- }
6292
- /**
6293
- * @internal
6294
- */
6295
- _isDateSelected(_) {
6296
- return false;
6297
- }
6298
- /**
6299
- * @internal
6300
- */
6301
- _isDateInSelectedRange(_) {
6302
- return false;
6303
- }
6304
- /**
6305
- * @internal
6306
- */
6307
- _isDateRangeStart(_) {
6308
- return false;
6309
- }
6310
- /**
6311
- * @internal
6312
- */
6313
- _isDateRangeEnd(_) {
6314
- return false;
6315
- }
6316
- /**
6317
- * @internal
6318
- */
6319
- _onDateMouseEnter(_) {
6320
- }
6321
- /**
6322
- * @internal
6323
- */
6324
- _onDateMouseLeave(_) {
6325
- }
6326
- /**
6327
- * Handle keydown on a date in the calendar.
6328
- * @internal
6329
- */
6330
- _onDateKeydown(date, event) {
6331
- let newDate = null;
6332
- if (event.key === "ArrowUp") {
6333
- newDate = addDays(date, -7);
6334
- } else if (event.key === "ArrowDown") {
6335
- newDate = addDays(date, 7);
6336
- } else if (event.key === "ArrowLeft") {
6337
- newDate = addDays(date, -1);
6338
- } else if (event.key === "ArrowRight") {
6339
- newDate = addDays(date, 1);
6340
- }
6341
- if (newDate && this._isDateInValidRange(newDate)) {
6342
- if (this._adjustSelectedMonthToEnsureVisibilityOf(newDate)) {
6343
- vividElement.DOM.processUpdates();
6344
- }
6345
- this._dialogEl.querySelector(
6346
- `[data-date="${newDate}"]`
6347
- ).focus();
6348
- return false;
6349
- }
6350
- return true;
6351
- }
6352
- /**
6353
- * @internal
6354
- */
6355
- _onDateFocus(date) {
6356
- this._lastFocussedDate = date;
6357
- }
6358
- get _tabbableDate() {
6359
- const datesInSegments = this._segments.filter(
6360
- (segment) => segment.type === "calendar"
6361
- ).flatMap((segment) => segment.calendar.grid.flat().map((d) => d.date));
6362
- const candidates = [
6363
- this._lastFocussedDate,
6364
- ...this._getSelectedDates(),
6365
- currentDateStr(),
6366
- ...datesInSegments
6367
- ];
6368
- const firstVisibleMonth = this._selectedMonth;
6369
- const lastVisibleMonth = addMonths(
6370
- this._selectedMonth,
6371
- this._numCalendars - 1
6372
- );
6373
- return candidates.find(
6374
- (date) => date && compareMonths(monthOfDate(date), firstVisibleMonth) >= 0 && compareMonths(monthOfDate(date), lastVisibleMonth) <= 0 && this._isDateInValidRange(date)
6375
- ) ?? null;
6376
- }
6377
- /**
6378
- * @internal
6379
- */
6380
- get _inMonthPicker() {
6381
- return this._monthPickerYear !== null;
6382
- }
6383
- /**
6384
- * Handle month selected in the month picker.
6385
- * @internal
6386
- */
6387
- _onMonthClick(month) {
6388
- this._selectedMonth = month;
6389
- this._monthPickerYear = null;
6390
- }
6391
- /**
6392
- * Handle keydown on a month in the month picker.
6393
- * @internal
6394
- */
6395
- _onMonthKeydown(month, event) {
6396
- let newMonth = null;
6397
- if (event.key === "ArrowUp") {
6398
- newMonth = addMonths(month, -MonthsPerRow);
6399
- } else if (event.key === "ArrowDown") {
6400
- newMonth = addMonths(month, MonthsPerRow);
6401
- } else if (event.key === "ArrowLeft") {
6402
- newMonth = addMonths(month, -1);
6403
- } else if (event.key === "ArrowRight") {
6404
- newMonth = addMonths(month, 1);
6405
- }
6406
- if (newMonth && this._isMonthInValidRange(newMonth)) {
6407
- if (newMonth.year !== this._monthPickerYear) {
6408
- this._monthPickerYear = newMonth.year;
6409
- vividElement.DOM.processUpdates();
6410
- }
6411
- this._dialogEl.querySelector(
6412
- `[data-month="${monthToStr(newMonth)}"]`
6413
- ).focus();
6414
- return false;
6415
- }
6416
- return true;
6417
- }
6418
- /**
6419
- * @internal
6420
- */
6421
- _onMonthFocus(month) {
6422
- this._lastFocussedMonth = month;
6423
- }
6424
- get _tabbableMonth() {
6425
- const monthsInSegments = this._segments.filter(
6426
- (segments) => segments.type === "month-picker"
6427
- ).flatMap((segment) => segment.months.flat().map((c) => c.month));
6428
- const candidates = [
6429
- this._lastFocussedMonth,
6430
- this._selectedMonth,
6431
- getCurrentMonth(),
6432
- ...monthsInSegments
6433
- ];
6434
- return candidates.find(
6435
- (month) => month && month.year === this._monthPickerYear && this._isMonthInValidRange(month)
6436
- ) ?? null;
6437
- }
6438
- // --- Dialog footer ---
6439
- /**
6440
- * @internal
6441
- */
6442
- _onOkClick() {
6443
- this._closePopup();
6444
- }
6445
- /**
6446
- * @internal
6447
- */
6448
- _onClearClick() {
6449
- this._closePopup();
6450
- }
6451
- }
6452
- __decorateClass([
6453
- vividElement.attr({ converter: ValidDateFilter })
6454
- ], DatePickerBase.prototype, "min", 2);
6455
- __decorateClass([
6456
- vividElement.attr({ converter: ValidDateFilter })
6457
- ], DatePickerBase.prototype, "max", 2);
6458
- __decorateClass([
6459
- vividElement.attr({ attribute: "value" })
6460
- ], DatePickerBase.prototype, "initialValue", 2);
6461
- __decorateClass([
6462
- vividElement.attr({ attribute: "current-value" })
6463
- ], DatePickerBase.prototype, "currentValue", 2);
6464
- __decorateClass([
6465
- vividElement.attr({ attribute: "readonly", mode: "boolean" })
6466
- ], DatePickerBase.prototype, "readOnly", 2);
6467
- __decorateClass([
6468
- vividElement.observable
6469
- ], DatePickerBase.prototype, "_selectedMonth", 2);
6470
- __decorateClass([
6471
- vividElement.observable
6472
- ], DatePickerBase.prototype, "_popupOpen", 2);
6473
- __decorateClass([
6474
- vividElement.observable
6475
- ], DatePickerBase.prototype, "_presentationValue", 2);
6476
- __decorateClass([
6477
- vividElement.volatile
6478
- ], DatePickerBase.prototype, "_isPrevYearDisabled", 1);
6479
- __decorateClass([
6480
- vividElement.volatile
6481
- ], DatePickerBase.prototype, "_isNextYearDisabled", 1);
6482
- __decorateClass([
6483
- vividElement.observable
6484
- ], DatePickerBase.prototype, "_numCalendars", 2);
6485
- __decorateClass([
6486
- vividElement.observable
6487
- ], DatePickerBase.prototype, "_lastFocussedDate", 2);
6488
- __decorateClass([
6489
- vividElement.volatile
6490
- ], DatePickerBase.prototype, "_tabbableDate", 1);
6491
- __decorateClass([
6492
- vividElement.observable
6493
- ], DatePickerBase.prototype, "_monthPickerYear", 2);
6494
- __decorateClass([
6495
- vividElement.observable
6496
- ], DatePickerBase.prototype, "_lastFocussedMonth", 2);
6497
- __decorateClass([
6498
- vividElement.volatile
6499
- ], DatePickerBase.prototype, "_tabbableMonth", 1);
6500
- applyMixinsWithObservables.applyMixinsWithObservables(
6501
- DatePickerBase,
6502
- localized.Localized,
6503
- formElements.FormElementHelperText,
6504
- trappedFocus.TrappedFocus
6505
- );
6506
-
6507
- const formatPresentationDate = (dateStr, locale) => {
6508
- const date = parseDateStr(dateStr);
6509
- return format(date, locale.dateFormat);
6510
- };
6511
- const parsePresentationDate = (presentationDate, locale) => {
6512
- const date = parse(presentationDate, locale.dateFormat, /* @__PURE__ */ new Date());
6513
- return formatDateStr(date);
6337
+ </div>
6338
+ `;
6514
6339
  };
6515
6340
 
6516
- exports.DatePickerBase = DatePickerBase;
6517
- exports.DatePickerBaseTemplate = DatePickerBaseTemplate;
6341
+ exports.CalendarPicker = CalendarPicker;
6342
+ exports.CalendarPickerTemplate = CalendarPickerTemplate;
6343
+ exports.MinMaxCalendarPicker = MinMaxCalendarPicker;
6344
+ exports.ValidDateFilter = ValidDateFilter;
6345
+ exports.calendarStyles = calendarStyles;
6518
6346
  exports.compareDateStr = compareDateStr;
6347
+ exports.currentDateStr = currentDateStr;
6519
6348
  exports.formatPresentationDate = formatPresentationDate;
6520
6349
  exports.isValidDateStr = isValidDateStr;
6521
6350
  exports.parsePresentationDate = parsePresentationDate;
6522
- exports.styles = styles;