@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
@@ -0,0 +1,11 @@
1
+ import { FormElementHelperText, Localized, TrappedFocus } from '../patterns';
2
+ import { FormAssociatedPickerField } from './picker-field.form-associated';
3
+ export declare abstract class PickerField extends FormAssociatedPickerField {
4
+ #private;
5
+ initialValue: string;
6
+ currentValue: string;
7
+ readOnly: boolean;
8
+ constructor();
9
+ }
10
+ export interface PickerField extends Localized, FormElementHelperText, TrappedFocus {
11
+ }
@@ -0,0 +1,11 @@
1
+ import { FormAssociated } from '../foundation/form-associated/form-associated';
2
+ import { VividElement } from '../foundation/vivid-element/vivid-element';
3
+ declare class _PickerField extends VividElement {
4
+ }
5
+ interface _PickerField extends FormAssociated {
6
+ }
7
+ declare const FormAssociatedPickerField_base: typeof _PickerField;
8
+ export declare class FormAssociatedPickerField extends FormAssociatedPickerField_base {
9
+ proxy: HTMLInputElement;
10
+ }
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type ViewTemplate } from '@microsoft/fast-element';
2
+ import type { VividElementDefinitionContext } from '../design-system/defineVividComponent';
3
+ import { PickerField } from './picker-field';
4
+ export declare const PickerFieldTemplate: (context: VividElementDefinitionContext, popupContentTemplate: ViewTemplate, { withSeparator, padded }: {
5
+ withSeparator: boolean;
6
+ padded: boolean;
7
+ }) => ViewTemplate<PickerField, any>;
@@ -0,0 +1,315 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
5
+ const formAssociated = require('./form-associated.cjs');
6
+ const vividElement = require('./vivid-element.cjs');
7
+ const formElements = require('./form-elements.cjs');
8
+ const localized = require('./localized.cjs');
9
+ const definition = require('./definition65.cjs');
10
+ const definition$1 = require('./definition57.cjs');
11
+ const definition$2 = require('./definition11.cjs');
12
+ const ref = require('./ref.cjs');
13
+ const slotted = require('./slotted.cjs');
14
+ const classNames = require('./class-names.cjs');
15
+
16
+ class TrappedFocus {
17
+ static {
18
+ this.ignoredEvents = /* @__PURE__ */ new WeakSet();
19
+ }
20
+ static ignoreEvent(event) {
21
+ this.ignoredEvents.add(event);
22
+ }
23
+ /**
24
+ * @returns Whether focus was trapped.
25
+ * @internal
26
+ */
27
+ _trappedFocus(event, getFocusableEls) {
28
+ if (!TrappedFocus.ignoredEvents.has(event) && event.key === "Tab") {
29
+ const focusableEls = getFocusableEls();
30
+ const firstFocusableEl = focusableEls[0];
31
+ const lastFocusableEl = focusableEls[focusableEls.length - 1];
32
+ if (event.shiftKey) {
33
+ if (this.shadowRoot.activeElement === firstFocusableEl) {
34
+ lastFocusableEl.focus();
35
+ return true;
36
+ }
37
+ } else {
38
+ if (this.shadowRoot.activeElement === lastFocusableEl) {
39
+ firstFocusableEl.focus();
40
+ return true;
41
+ }
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+ }
47
+
48
+ const pickerFieldStyles = ":host{display:inline-block}.base{display:inline-block;inline-size:100%}.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog--padded{padding:12px;gap:12px}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;gap:8px}.dialog .footer--with-separator{border-top:1px solid var(--vvd-color-neutral-200)}";
49
+
50
+ class _PickerField extends vividElement.VividElement {
51
+ }
52
+ class FormAssociatedPickerField extends formAssociated.FormAssociated(_PickerField) {
53
+ constructor() {
54
+ super(...arguments);
55
+ this.proxy = document.createElement("input");
56
+ }
57
+ }
58
+
59
+ var __defProp = Object.defineProperty;
60
+ var __decorateClass = (decorators, target, key, kind) => {
61
+ var result = void 0 ;
62
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
63
+ if (decorator = decorators[i])
64
+ result = (decorator(target, key, result) ) || result;
65
+ if (result) __defProp(target, key, result);
66
+ return result;
67
+ };
68
+ class PickerField extends FormAssociatedPickerField {
69
+ // --- Core ---
70
+ constructor() {
71
+ super();
72
+ this.readOnly = false;
73
+ this.#onFocusIn = () => {
74
+ this.$emit("focus", void 0, { bubbles: false });
75
+ };
76
+ this.#onFocusOut = () => {
77
+ this.$emit("blur", void 0, { bubbles: false });
78
+ };
79
+ // Reformat the presentation value when the locale changes
80
+ this.#localeChangeHandler = {
81
+ handleChange: () => {
82
+ this._updatePresentationValue();
83
+ }
84
+ };
85
+ this._popupOpen = false;
86
+ this.#dismissOnClickOutside = (event) => {
87
+ if (!this._popupOpen) {
88
+ return;
89
+ }
90
+ const path = event.composedPath();
91
+ const elementsToIgnoreClicksOn = [this._dialogEl, this._pickerButtonEl];
92
+ if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
93
+ this._closePopup(false);
94
+ }
95
+ };
96
+ this._presentationValue = "";
97
+ this.value = "";
98
+ }
99
+ /**
100
+ * @internal
101
+ */
102
+ readOnlyChanged() {
103
+ if (this.proxy instanceof HTMLInputElement) {
104
+ this.proxy.readOnly = this.readOnly;
105
+ this.validate();
106
+ }
107
+ }
108
+ /**
109
+ * @internal
110
+ */
111
+ connectedCallback() {
112
+ super.connectedCallback();
113
+ document.addEventListener("click", this.#dismissOnClickOutside);
114
+ this.addEventListener("focusin", this.#onFocusIn);
115
+ this.addEventListener("focusout", this.#onFocusOut);
116
+ this.#startObservingLocaleChanges();
117
+ }
118
+ /**
119
+ * @internal
120
+ */
121
+ disconnectedCallback() {
122
+ super.disconnectedCallback();
123
+ document.removeEventListener("click", this.#dismissOnClickOutside);
124
+ this.removeEventListener("focusin", this.#onFocusIn);
125
+ this.removeEventListener("focusout", this.#onFocusOut);
126
+ this.#stopObservingLocaleChanges();
127
+ }
128
+ #onFocusIn;
129
+ #onFocusOut;
130
+ /**
131
+ * @internal
132
+ */
133
+ validate() {
134
+ if (this.proxy) {
135
+ this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
136
+ }
137
+ super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
138
+ }
139
+ #localeChangeHandler;
140
+ #localeChangeObserver;
141
+ #startObservingLocaleChanges() {
142
+ this.#localeChangeObserver = vividElement.Observable.binding(
143
+ () => this.locale,
144
+ this.#localeChangeHandler
145
+ );
146
+ this.#localeChangeObserver.observe(this, vividElement.defaultExecutionContext);
147
+ }
148
+ #stopObservingLocaleChanges() {
149
+ this.#localeChangeObserver.disconnect();
150
+ }
151
+ #dismissOnClickOutside;
152
+ #openPopupIfPossible() {
153
+ if (!this.readOnly) {
154
+ this._popupOpen = true;
155
+ }
156
+ }
157
+ /**
158
+ * @internal
159
+ */
160
+ _closePopup(restoreFocusToTextField = true) {
161
+ this._popupOpen = false;
162
+ if (restoreFocusToTextField) {
163
+ this._textFieldEl.focus();
164
+ }
165
+ }
166
+ /**
167
+ * On keydown anywhere in the picker.
168
+ * @internal
169
+ */
170
+ _onBaseKeyDown(event) {
171
+ if (this._popupOpen && index.handleEscapeKeyAndStopPropogation(event)) {
172
+ this._closePopup();
173
+ return false;
174
+ }
175
+ if (this._trappedFocus(event, () => this._focusableElsWithinDialog())) {
176
+ return false;
177
+ }
178
+ return true;
179
+ }
180
+ /**
181
+ * @internal
182
+ */
183
+ _presentationValueChanged() {
184
+ this.dirtyValue = true;
185
+ this.validate();
186
+ }
187
+ /**
188
+ * @internal
189
+ */
190
+ _onTextFieldInput(event) {
191
+ const textField = event.currentTarget;
192
+ this._presentationValue = textField.value;
193
+ }
194
+ /**
195
+ * @internal
196
+ */
197
+ _onPickerButtonClick() {
198
+ if (this._popupOpen) {
199
+ this._closePopup();
200
+ } else {
201
+ this.#openPopupIfPossible();
202
+ }
203
+ }
204
+ // --- Dialog footer ---
205
+ /**
206
+ * @internal
207
+ */
208
+ _onOkClick() {
209
+ this._closePopup();
210
+ }
211
+ /**
212
+ * @internal
213
+ */
214
+ _onClearClick() {
215
+ this._closePopup();
216
+ this.$emit("clear-click");
217
+ }
218
+ }
219
+ __decorateClass([
220
+ vividElement.attr({ attribute: "value" })
221
+ ], PickerField.prototype, "initialValue");
222
+ __decorateClass([
223
+ vividElement.attr({ attribute: "current-value" })
224
+ ], PickerField.prototype, "currentValue");
225
+ __decorateClass([
226
+ vividElement.attr({ attribute: "readonly", mode: "boolean" })
227
+ ], PickerField.prototype, "readOnly");
228
+ __decorateClass([
229
+ vividElement.observable
230
+ ], PickerField.prototype, "_popupOpen");
231
+ __decorateClass([
232
+ vividElement.observable
233
+ ], PickerField.prototype, "_presentationValue");
234
+ applyMixinsWithObservables.applyMixinsWithObservables(
235
+ PickerField,
236
+ localized.Localized,
237
+ formElements.FormElementHelperText,
238
+ TrappedFocus
239
+ );
240
+
241
+ const PickerFieldTemplate = (context, popupContentTemplate, { withSeparator, padded }) => {
242
+ const popupTag = context.tagFor(definition.Popup);
243
+ const textFieldTag = context.tagFor(definition$1.TextField);
244
+ const buttonTag = context.tagFor(definition$2.Button);
245
+ return vividElement.html`
246
+ <div class='base' @keydown='${(x, { event }) => x._onBaseKeyDown(event)}'>
247
+ <${textFieldTag} id='text-field'
248
+ ${ref.ref("_textFieldEl")}
249
+ class='control'
250
+ label='${(x) => x.label}'
251
+ helper-text='${(x) => x.helperText}'
252
+ error-text='${(x) => x.errorValidationMessage}'
253
+ placeholder='${(x) => x._textFieldPlaceholder}'
254
+ size='${(x) => x._textFieldSize}'
255
+ current-value='${(x) => x._presentationValue}'
256
+ ?disabled='${(x) => x.disabled}'
257
+ ?readonly='${(x) => x.readOnly}'
258
+ @input='${(x, c) => x._onTextFieldInput(c.event)}'
259
+ @change='${(x) => x._onTextFieldChange()}'
260
+ >
261
+ <slot
262
+ slot='${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}'
263
+ name='helper-text'
264
+ ${slotted.slotted("_helperTextSlottedContent")}
265
+ ></slot>
266
+ <${buttonTag}
267
+ id='picker-button'
268
+ ${ref.ref("_pickerButtonEl")}
269
+ slot='action-items'
270
+ size='condensed'
271
+ icon='${(x) => x._pickerButtonIcon}'
272
+ appearance='ghost'
273
+ ?disabled='${(x) => x.disabled || x.readOnly}'
274
+ aria-label='${(x) => x._pickerButtonLabel}'
275
+ @click='${(x) => x._onPickerButtonClick()}'
276
+ ></${buttonTag}>
277
+ </${textFieldTag}>
278
+ <${popupTag}
279
+ ?open='${(x) => x._popupOpen}'
280
+ :anchor='${(x) => x._textFieldEl}'
281
+ placement='bottom-start'
282
+ class='popup'>
283
+ <div class="${() => classNames.classNames("dialog", [
284
+ "dialog--padded",
285
+ padded
286
+ ])}" role='dialog' ${ref.ref(
287
+ "_dialogEl"
288
+ )} aria-modal='true' aria-label='${(x) => x._dialogLabel}'>
289
+ ${() => popupContentTemplate}
290
+ <div class="${() => classNames.classNames("footer", ["footer--with-separator", withSeparator])}">
291
+ <${buttonTag}
292
+ tabindex='3'
293
+ class='vwc-button'
294
+ size='condensed'
295
+ label='${(x) => x.locale.pickerField.clearLabel}'
296
+ @click='${(x) => x._onClearClick()}'
297
+ ></${buttonTag}>
298
+ <${buttonTag}
299
+ tabindex='3'
300
+ class='vwc-button'
301
+ size='condensed'
302
+ appearance='filled'
303
+ label='${(x) => x.locale.pickerField.okLabel}'
304
+ @click='${(x) => x._onOkClick()}'
305
+ ></${buttonTag}>
306
+ </div>
307
+ </div>
308
+ </${popupTag}>
309
+ </div>`;
310
+ };
311
+
312
+ exports.PickerField = PickerField;
313
+ exports.PickerFieldTemplate = PickerFieldTemplate;
314
+ exports.TrappedFocus = TrappedFocus;
315
+ exports.pickerFieldStyles = pickerFieldStyles;
@@ -0,0 +1,310 @@
1
+ import { h as handleEscapeKeyAndStopPropogation } from './index.js';
2
+ import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
3
+ import { F as FormAssociated } from './form-associated.js';
4
+ import { V as VividElement, O as Observable, i as defaultExecutionContext, a as attr, o as observable, h as html } from './vivid-element.js';
5
+ import { a as FormElementHelperText } from './form-elements.js';
6
+ import { L as Localized } from './localized.js';
7
+ import { P as Popup } from './definition65.js';
8
+ import { T as TextField } from './definition57.js';
9
+ import { B as Button } from './definition11.js';
10
+ import { r as ref } from './ref.js';
11
+ import { s as slotted } from './slotted.js';
12
+ import { c as classNames } from './class-names.js';
13
+
14
+ class TrappedFocus {
15
+ static {
16
+ this.ignoredEvents = /* @__PURE__ */ new WeakSet();
17
+ }
18
+ static ignoreEvent(event) {
19
+ this.ignoredEvents.add(event);
20
+ }
21
+ /**
22
+ * @returns Whether focus was trapped.
23
+ * @internal
24
+ */
25
+ _trappedFocus(event, getFocusableEls) {
26
+ if (!TrappedFocus.ignoredEvents.has(event) && event.key === "Tab") {
27
+ const focusableEls = getFocusableEls();
28
+ const firstFocusableEl = focusableEls[0];
29
+ const lastFocusableEl = focusableEls[focusableEls.length - 1];
30
+ if (event.shiftKey) {
31
+ if (this.shadowRoot.activeElement === firstFocusableEl) {
32
+ lastFocusableEl.focus();
33
+ return true;
34
+ }
35
+ } else {
36
+ if (this.shadowRoot.activeElement === lastFocusableEl) {
37
+ firstFocusableEl.focus();
38
+ return true;
39
+ }
40
+ }
41
+ }
42
+ return false;
43
+ }
44
+ }
45
+
46
+ const pickerFieldStyles = ":host{display:inline-block}.base{display:inline-block;inline-size:100%}.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog--padded{padding:12px;gap:12px}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;gap:8px}.dialog .footer--with-separator{border-top:1px solid var(--vvd-color-neutral-200)}";
47
+
48
+ class _PickerField extends VividElement {
49
+ }
50
+ class FormAssociatedPickerField extends FormAssociated(_PickerField) {
51
+ constructor() {
52
+ super(...arguments);
53
+ this.proxy = document.createElement("input");
54
+ }
55
+ }
56
+
57
+ var __defProp = Object.defineProperty;
58
+ var __decorateClass = (decorators, target, key, kind) => {
59
+ var result = void 0 ;
60
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
61
+ if (decorator = decorators[i])
62
+ result = (decorator(target, key, result) ) || result;
63
+ if (result) __defProp(target, key, result);
64
+ return result;
65
+ };
66
+ class PickerField extends FormAssociatedPickerField {
67
+ // --- Core ---
68
+ constructor() {
69
+ super();
70
+ this.readOnly = false;
71
+ this.#onFocusIn = () => {
72
+ this.$emit("focus", void 0, { bubbles: false });
73
+ };
74
+ this.#onFocusOut = () => {
75
+ this.$emit("blur", void 0, { bubbles: false });
76
+ };
77
+ // Reformat the presentation value when the locale changes
78
+ this.#localeChangeHandler = {
79
+ handleChange: () => {
80
+ this._updatePresentationValue();
81
+ }
82
+ };
83
+ this._popupOpen = false;
84
+ this.#dismissOnClickOutside = (event) => {
85
+ if (!this._popupOpen) {
86
+ return;
87
+ }
88
+ const path = event.composedPath();
89
+ const elementsToIgnoreClicksOn = [this._dialogEl, this._pickerButtonEl];
90
+ if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
91
+ this._closePopup(false);
92
+ }
93
+ };
94
+ this._presentationValue = "";
95
+ this.value = "";
96
+ }
97
+ /**
98
+ * @internal
99
+ */
100
+ readOnlyChanged() {
101
+ if (this.proxy instanceof HTMLInputElement) {
102
+ this.proxy.readOnly = this.readOnly;
103
+ this.validate();
104
+ }
105
+ }
106
+ /**
107
+ * @internal
108
+ */
109
+ connectedCallback() {
110
+ super.connectedCallback();
111
+ document.addEventListener("click", this.#dismissOnClickOutside);
112
+ this.addEventListener("focusin", this.#onFocusIn);
113
+ this.addEventListener("focusout", this.#onFocusOut);
114
+ this.#startObservingLocaleChanges();
115
+ }
116
+ /**
117
+ * @internal
118
+ */
119
+ disconnectedCallback() {
120
+ super.disconnectedCallback();
121
+ document.removeEventListener("click", this.#dismissOnClickOutside);
122
+ this.removeEventListener("focusin", this.#onFocusIn);
123
+ this.removeEventListener("focusout", this.#onFocusOut);
124
+ this.#stopObservingLocaleChanges();
125
+ }
126
+ #onFocusIn;
127
+ #onFocusOut;
128
+ /**
129
+ * @internal
130
+ */
131
+ validate() {
132
+ if (this.proxy) {
133
+ this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
134
+ }
135
+ super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
136
+ }
137
+ #localeChangeHandler;
138
+ #localeChangeObserver;
139
+ #startObservingLocaleChanges() {
140
+ this.#localeChangeObserver = Observable.binding(
141
+ () => this.locale,
142
+ this.#localeChangeHandler
143
+ );
144
+ this.#localeChangeObserver.observe(this, defaultExecutionContext);
145
+ }
146
+ #stopObservingLocaleChanges() {
147
+ this.#localeChangeObserver.disconnect();
148
+ }
149
+ #dismissOnClickOutside;
150
+ #openPopupIfPossible() {
151
+ if (!this.readOnly) {
152
+ this._popupOpen = true;
153
+ }
154
+ }
155
+ /**
156
+ * @internal
157
+ */
158
+ _closePopup(restoreFocusToTextField = true) {
159
+ this._popupOpen = false;
160
+ if (restoreFocusToTextField) {
161
+ this._textFieldEl.focus();
162
+ }
163
+ }
164
+ /**
165
+ * On keydown anywhere in the picker.
166
+ * @internal
167
+ */
168
+ _onBaseKeyDown(event) {
169
+ if (this._popupOpen && handleEscapeKeyAndStopPropogation(event)) {
170
+ this._closePopup();
171
+ return false;
172
+ }
173
+ if (this._trappedFocus(event, () => this._focusableElsWithinDialog())) {
174
+ return false;
175
+ }
176
+ return true;
177
+ }
178
+ /**
179
+ * @internal
180
+ */
181
+ _presentationValueChanged() {
182
+ this.dirtyValue = true;
183
+ this.validate();
184
+ }
185
+ /**
186
+ * @internal
187
+ */
188
+ _onTextFieldInput(event) {
189
+ const textField = event.currentTarget;
190
+ this._presentationValue = textField.value;
191
+ }
192
+ /**
193
+ * @internal
194
+ */
195
+ _onPickerButtonClick() {
196
+ if (this._popupOpen) {
197
+ this._closePopup();
198
+ } else {
199
+ this.#openPopupIfPossible();
200
+ }
201
+ }
202
+ // --- Dialog footer ---
203
+ /**
204
+ * @internal
205
+ */
206
+ _onOkClick() {
207
+ this._closePopup();
208
+ }
209
+ /**
210
+ * @internal
211
+ */
212
+ _onClearClick() {
213
+ this._closePopup();
214
+ this.$emit("clear-click");
215
+ }
216
+ }
217
+ __decorateClass([
218
+ attr({ attribute: "value" })
219
+ ], PickerField.prototype, "initialValue");
220
+ __decorateClass([
221
+ attr({ attribute: "current-value" })
222
+ ], PickerField.prototype, "currentValue");
223
+ __decorateClass([
224
+ attr({ attribute: "readonly", mode: "boolean" })
225
+ ], PickerField.prototype, "readOnly");
226
+ __decorateClass([
227
+ observable
228
+ ], PickerField.prototype, "_popupOpen");
229
+ __decorateClass([
230
+ observable
231
+ ], PickerField.prototype, "_presentationValue");
232
+ applyMixinsWithObservables(
233
+ PickerField,
234
+ Localized,
235
+ FormElementHelperText,
236
+ TrappedFocus
237
+ );
238
+
239
+ const PickerFieldTemplate = (context, popupContentTemplate, { withSeparator, padded }) => {
240
+ const popupTag = context.tagFor(Popup);
241
+ const textFieldTag = context.tagFor(TextField);
242
+ const buttonTag = context.tagFor(Button);
243
+ return html`
244
+ <div class='base' @keydown='${(x, { event }) => x._onBaseKeyDown(event)}'>
245
+ <${textFieldTag} id='text-field'
246
+ ${ref("_textFieldEl")}
247
+ class='control'
248
+ label='${(x) => x.label}'
249
+ helper-text='${(x) => x.helperText}'
250
+ error-text='${(x) => x.errorValidationMessage}'
251
+ placeholder='${(x) => x._textFieldPlaceholder}'
252
+ size='${(x) => x._textFieldSize}'
253
+ current-value='${(x) => x._presentationValue}'
254
+ ?disabled='${(x) => x.disabled}'
255
+ ?readonly='${(x) => x.readOnly}'
256
+ @input='${(x, c) => x._onTextFieldInput(c.event)}'
257
+ @change='${(x) => x._onTextFieldChange()}'
258
+ >
259
+ <slot
260
+ slot='${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}'
261
+ name='helper-text'
262
+ ${slotted("_helperTextSlottedContent")}
263
+ ></slot>
264
+ <${buttonTag}
265
+ id='picker-button'
266
+ ${ref("_pickerButtonEl")}
267
+ slot='action-items'
268
+ size='condensed'
269
+ icon='${(x) => x._pickerButtonIcon}'
270
+ appearance='ghost'
271
+ ?disabled='${(x) => x.disabled || x.readOnly}'
272
+ aria-label='${(x) => x._pickerButtonLabel}'
273
+ @click='${(x) => x._onPickerButtonClick()}'
274
+ ></${buttonTag}>
275
+ </${textFieldTag}>
276
+ <${popupTag}
277
+ ?open='${(x) => x._popupOpen}'
278
+ :anchor='${(x) => x._textFieldEl}'
279
+ placement='bottom-start'
280
+ class='popup'>
281
+ <div class="${() => classNames("dialog", [
282
+ "dialog--padded",
283
+ padded
284
+ ])}" role='dialog' ${ref(
285
+ "_dialogEl"
286
+ )} aria-modal='true' aria-label='${(x) => x._dialogLabel}'>
287
+ ${() => popupContentTemplate}
288
+ <div class="${() => classNames("footer", ["footer--with-separator", withSeparator])}">
289
+ <${buttonTag}
290
+ tabindex='3'
291
+ class='vwc-button'
292
+ size='condensed'
293
+ label='${(x) => x.locale.pickerField.clearLabel}'
294
+ @click='${(x) => x._onClearClick()}'
295
+ ></${buttonTag}>
296
+ <${buttonTag}
297
+ tabindex='3'
298
+ class='vwc-button'
299
+ size='condensed'
300
+ appearance='filled'
301
+ label='${(x) => x.locale.pickerField.okLabel}'
302
+ @click='${(x) => x._onOkClick()}'
303
+ ></${buttonTag}>
304
+ </div>
305
+ </div>
306
+ </${popupTag}>
307
+ </div>`;
308
+ };
309
+
310
+ export { PickerFieldTemplate as P, TrappedFocus as T, PickerField as a, pickerFieldStyles as p };
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ const SingleDatePickerMixin = (Base) => {
4
+ class SingleDatePicker extends Base {
5
+ /**
6
+ * @internal
7
+ */
8
+ valueChanged(previous, next) {
9
+ super.valueChanged(previous, next);
10
+ if (this.value) {
11
+ this._adjustSelectedMonthToEnsureVisibilityOf(this._dateValue());
12
+ }
13
+ }
14
+ /**
15
+ * @internal
16
+ */
17
+ _onDateClick(date) {
18
+ this._updateValueDueToUserInteraction(this._withUpdatedDate(date));
19
+ }
20
+ /**
21
+ * @internal
22
+ */
23
+ _isDateSelected(date) {
24
+ return date === this._dateValue();
25
+ }
26
+ /**
27
+ * @internal
28
+ */
29
+ _isDateAriaSelected(date) {
30
+ return this._isDateSelected(date);
31
+ }
32
+ /**
33
+ * @internal
34
+ */
35
+ _getSelectedDates() {
36
+ const dates = [];
37
+ if (this.value) {
38
+ dates.push(this._dateValue());
39
+ }
40
+ return dates;
41
+ }
42
+ }
43
+ return SingleDatePicker;
44
+ };
45
+
46
+ exports.SingleDatePickerMixin = SingleDatePickerMixin;