@vonage/vivid 4.17.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/custom-elements.json +3903 -3860
  2. package/date-time-picker/index.cjs +5 -0
  3. package/date-time-picker/index.js +3 -0
  4. package/dial-pad/index.cjs +1 -1
  5. package/dial-pad/index.js +1 -1
  6. package/dialog/index.cjs +1 -1
  7. package/dialog/index.js +1 -1
  8. package/divider/index.cjs +1 -1
  9. package/divider/index.js +1 -1
  10. package/elevation/index.cjs +1 -1
  11. package/elevation/index.js +1 -1
  12. package/empty-state/index.cjs +1 -1
  13. package/empty-state/index.js +1 -1
  14. package/fab/index.cjs +1 -1
  15. package/fab/index.js +1 -1
  16. package/file-picker/index.cjs +1 -1
  17. package/file-picker/index.js +1 -1
  18. package/header/index.cjs +1 -1
  19. package/header/index.js +1 -1
  20. package/icon/index.cjs +1 -1
  21. package/icon/index.js +1 -1
  22. package/index.cjs +136 -133
  23. package/index.js +45 -44
  24. package/layout/index.cjs +1 -1
  25. package/layout/index.js +1 -1
  26. package/lib/action-group/action-group.d.ts +449 -3
  27. package/lib/banner/banner.d.ts +449 -3
  28. package/lib/breadcrumb-item/breadcrumb-item.d.ts +449 -1
  29. package/lib/checkbox/checkbox.d.ts +449 -4
  30. package/lib/components.d.ts +1 -0
  31. package/lib/date-picker/date-picker.d.ts +2182 -4
  32. package/lib/date-picker/date-picker.template.d.ts +2 -0
  33. package/lib/date-range-picker/date-range-picker.d.ts +1110 -4
  34. package/lib/date-range-picker/date-range-picker.template.d.ts +2 -0
  35. package/lib/date-time-picker/date-time-picker.d.ts +2175 -0
  36. package/lib/date-time-picker/date-time-picker.template.d.ts +2 -0
  37. package/lib/date-time-picker/definition.d.ts +1 -0
  38. package/lib/date-time-picker/locale.d.ts +9 -0
  39. package/lib/dialog/dialog.d.ts +449 -2
  40. package/lib/divider/divider.d.ts +448 -1
  41. package/lib/menu/menu.d.ts +446 -1
  42. package/lib/nav-disclosure/nav-disclosure.d.ts +449 -2
  43. package/lib/number-field/number-field.d.ts +450 -3
  44. package/lib/option/option.d.ts +1 -11
  45. package/lib/progress/progress.d.ts +449 -2
  46. package/lib/progress-ring/progress-ring.d.ts +449 -2
  47. package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +1 -0
  48. package/lib/rich-text-editor/rich-text-editor.d.ts +7 -4
  49. package/lib/select/select.d.ts +1 -5
  50. package/lib/selectable-box/selectable-box.d.ts +449 -2
  51. package/lib/slider/slider.d.ts +449 -3
  52. package/lib/split-button/split-button.d.ts +449 -3
  53. package/lib/switch/switch.d.ts +449 -2
  54. package/lib/tag-group/tag-group.d.ts +449 -2
  55. package/lib/text-anchor/text-anchor.d.ts +449 -1
  56. package/lib/text-area/text-area.d.ts +450 -3
  57. package/lib/text-field/text-field.d.ts +450 -7
  58. package/lib/time-picker/locale.d.ts +0 -2
  59. package/lib/time-picker/time-picker.d.ts +1053 -9
  60. package/lib/time-picker/time-picker.template.d.ts +2 -1
  61. package/locales/de-DE.cjs +29 -5
  62. package/locales/de-DE.js +29 -5
  63. package/locales/en-GB.cjs +29 -5
  64. package/locales/en-GB.js +29 -5
  65. package/locales/en-US.cjs +29 -5
  66. package/locales/en-US.js +29 -5
  67. package/locales/ja-JP.cjs +29 -5
  68. package/locales/ja-JP.js +29 -5
  69. package/locales/zh-CN.cjs +29 -5
  70. package/locales/zh-CN.js +29 -5
  71. package/menu/index.cjs +1 -1
  72. package/menu/index.js +1 -1
  73. package/menu-item/index.cjs +1 -1
  74. package/menu-item/index.js +1 -1
  75. package/nav/index.cjs +1 -1
  76. package/nav/index.js +1 -1
  77. package/nav-disclosure/index.cjs +1 -1
  78. package/nav-disclosure/index.js +1 -1
  79. package/nav-item/index.cjs +1 -1
  80. package/nav-item/index.js +1 -1
  81. package/note/index.cjs +1 -1
  82. package/note/index.js +1 -1
  83. package/number-field/index.cjs +1 -1
  84. package/number-field/index.js +1 -1
  85. package/option/index.cjs +1 -1
  86. package/option/index.js +1 -1
  87. package/package.json +1 -1
  88. package/pagination/index.cjs +1 -1
  89. package/pagination/index.js +1 -1
  90. package/popup/index.cjs +1 -1
  91. package/popup/index.js +1 -1
  92. package/progress/index.cjs +1 -1
  93. package/progress/index.js +1 -1
  94. package/progress-ring/index.cjs +1 -1
  95. package/progress-ring/index.js +1 -1
  96. package/radio/index.cjs +1 -1
  97. package/radio/index.js +1 -1
  98. package/radio-group/index.cjs +1 -1
  99. package/radio-group/index.js +1 -1
  100. package/range-slider/index.cjs +1 -1
  101. package/range-slider/index.js +1 -1
  102. package/rich-text-editor/index.cjs +1 -1
  103. package/rich-text-editor/index.js +1 -1
  104. package/searchable-select/index.cjs +1 -1
  105. package/searchable-select/index.js +1 -1
  106. package/select/index.cjs +1 -1
  107. package/select/index.js +1 -1
  108. package/selectable-box/index.cjs +1 -1
  109. package/selectable-box/index.js +1 -1
  110. package/shared/Reflector.cjs +71 -0
  111. package/shared/Reflector.js +69 -0
  112. package/shared/affix.cjs +1 -1
  113. package/shared/affix.js +1 -1
  114. package/shared/anchor.cjs +0 -10
  115. package/shared/anchor.js +0 -10
  116. package/shared/aria/delegates-aria.d.ts +454 -0
  117. package/shared/base-progress.js +1 -1
  118. package/shared/breadcrumb-item.cjs +2 -1
  119. package/shared/breadcrumb-item.js +2 -1
  120. package/shared/button.cjs +2 -13
  121. package/shared/button.js +2 -13
  122. package/shared/{presentationDate.cjs → calendar-picker.template.cjs} +730 -900
  123. package/shared/{presentationDate.js → calendar-picker.template.js} +672 -845
  124. package/shared/datetime/dateTimeStr.d.ts +6 -0
  125. package/shared/datetime/presentationDate.d.ts +4 -0
  126. package/shared/{date-picker/calendar → datetime}/presentationDateRange.d.ts +3 -3
  127. package/shared/datetime/presentationDateTime.d.ts +4 -0
  128. package/{lib/time-picker/time → shared/datetime}/time.d.ts +1 -0
  129. package/shared/definition.cjs +1 -1
  130. package/shared/definition.js +1 -1
  131. package/shared/definition11.cjs +8 -11
  132. package/shared/definition11.js +8 -11
  133. package/shared/definition14.cjs +2 -2
  134. package/shared/definition14.js +2 -2
  135. package/shared/definition15.cjs +3 -10
  136. package/shared/definition15.js +3 -10
  137. package/shared/definition16.cjs +29 -33
  138. package/shared/definition16.js +29 -33
  139. package/shared/definition17.cjs +1 -1
  140. package/shared/definition17.js +1 -1
  141. package/shared/definition18.cjs +56 -91
  142. package/shared/definition18.js +56 -91
  143. package/shared/definition19.cjs +68 -32
  144. package/shared/definition19.js +58 -22
  145. package/shared/definition20.cjs +253 -220
  146. package/shared/definition20.js +254 -220
  147. package/shared/definition21.cjs +200 -286
  148. package/shared/definition21.js +198 -284
  149. package/shared/definition22.cjs +302 -31
  150. package/shared/definition22.js +301 -30
  151. package/shared/definition23.cjs +37 -58
  152. package/shared/definition23.js +36 -57
  153. package/shared/definition24.cjs +50 -70
  154. package/shared/definition24.js +49 -69
  155. package/shared/definition25.cjs +75 -2475
  156. package/shared/definition25.js +74 -2475
  157. package/shared/definition26.cjs +2480 -50
  158. package/shared/definition26.js +2479 -48
  159. package/shared/definition27.cjs +53 -271
  160. package/shared/definition27.js +52 -269
  161. package/shared/definition28.cjs +271 -48
  162. package/shared/definition28.js +269 -47
  163. package/shared/definition29.cjs +37 -764
  164. package/shared/definition29.js +36 -758
  165. package/shared/definition3.cjs +2 -9
  166. package/shared/definition3.js +2 -9
  167. package/shared/definition30.cjs +739 -57
  168. package/shared/definition30.js +733 -56
  169. package/shared/definition31.cjs +93 -22
  170. package/shared/definition31.js +92 -21
  171. package/shared/definition32.cjs +28 -10
  172. package/shared/definition32.js +27 -9
  173. package/shared/definition33.cjs +10 -52
  174. package/shared/definition33.js +9 -51
  175. package/shared/definition34.cjs +30 -411
  176. package/shared/definition34.js +30 -412
  177. package/shared/definition35.cjs +422 -52
  178. package/shared/definition35.js +423 -53
  179. package/shared/definition36.cjs +53 -216
  180. package/shared/definition36.js +53 -215
  181. package/shared/definition37.cjs +201 -71
  182. package/shared/definition37.js +200 -70
  183. package/shared/definition38.cjs +53 -48
  184. package/shared/definition38.js +51 -46
  185. package/shared/definition39.cjs +57 -263
  186. package/shared/definition39.js +56 -262
  187. package/shared/definition4.cjs +2 -2
  188. package/shared/definition4.js +2 -2
  189. package/shared/definition40.cjs +220 -148
  190. package/shared/definition40.js +220 -148
  191. package/shared/definition41.cjs +143 -567
  192. package/shared/definition41.js +143 -568
  193. package/shared/definition42.cjs +596 -12573
  194. package/shared/definition42.js +596 -12573
  195. package/shared/definition43.cjs +13489 -1058
  196. package/shared/definition43.js +13489 -1059
  197. package/shared/definition44.cjs +936 -698
  198. package/shared/definition44.js +937 -698
  199. package/shared/definition45.cjs +850 -105
  200. package/shared/definition45.js +850 -104
  201. package/shared/definition46.cjs +110 -90
  202. package/shared/definition46.js +108 -88
  203. package/shared/definition47.cjs +88 -464
  204. package/shared/definition47.js +87 -463
  205. package/shared/definition48.cjs +457 -111
  206. package/shared/definition48.js +456 -110
  207. package/shared/definition49.cjs +103 -109
  208. package/shared/definition49.js +102 -108
  209. package/shared/definition5.cjs +3 -3
  210. package/shared/definition5.js +3 -3
  211. package/shared/definition50.cjs +136 -14
  212. package/shared/definition50.js +135 -13
  213. package/shared/definition51.cjs +16 -115
  214. package/shared/definition51.js +15 -114
  215. package/shared/definition52.cjs +79 -486
  216. package/shared/definition52.js +78 -485
  217. package/shared/definition53.cjs +503 -24
  218. package/shared/definition53.js +502 -23
  219. package/shared/definition54.cjs +23 -137
  220. package/shared/definition54.js +22 -136
  221. package/shared/definition55.cjs +96 -241
  222. package/shared/definition55.js +95 -241
  223. package/shared/definition56.cjs +261 -61
  224. package/shared/definition56.js +260 -60
  225. package/shared/definition57.cjs +419 -788
  226. package/shared/definition57.js +420 -789
  227. package/shared/definition58.cjs +27 -144
  228. package/shared/definition58.js +27 -143
  229. package/shared/definition59.cjs +83 -54
  230. package/shared/definition59.js +82 -53
  231. package/shared/definition6.cjs +1 -1
  232. package/shared/definition6.js +1 -1
  233. package/shared/definition60.cjs +80 -165
  234. package/shared/definition60.js +79 -163
  235. package/shared/definition61.cjs +143 -230
  236. package/shared/definition61.js +141 -229
  237. package/shared/definition62.cjs +233 -69344
  238. package/shared/definition62.js +232 -69343
  239. package/shared/definition63.cjs +69381 -28
  240. package/shared/definition63.js +69379 -26
  241. package/shared/definition64.cjs +28 -2168
  242. package/shared/definition64.js +27 -2166
  243. package/shared/definition65.cjs +2195 -0
  244. package/shared/definition65.js +2190 -0
  245. package/shared/definition7.cjs +1 -1
  246. package/shared/definition7.js +1 -1
  247. package/shared/definition8.cjs +3 -9
  248. package/shared/definition8.js +3 -9
  249. package/shared/definition9.cjs +1 -1
  250. package/shared/definition9.js +1 -1
  251. package/shared/delegates-aria.cjs +69 -0
  252. package/shared/delegates-aria.js +67 -0
  253. package/shared/form-associated.js +1 -1
  254. package/shared/form-elements.cjs +1 -1
  255. package/shared/form-elements.js +1 -1
  256. package/shared/foundation/anchor/anchor.d.ts +0 -8
  257. package/shared/foundation/button/button.d.ts +449 -7
  258. package/shared/foundation/listbox/listbox.d.ts +0 -9
  259. package/shared/listbox.cjs +4 -30
  260. package/shared/listbox.js +4 -30
  261. package/shared/localization/Locale.d.ts +6 -2
  262. package/shared/option.cjs +1 -38
  263. package/shared/option.js +1 -38
  264. package/shared/picker-field/locale.d.ts +4 -0
  265. package/shared/picker-field/mixins/calendar-picker.d.ts +558 -0
  266. package/shared/{date-picker/locale.d.ts → picker-field/mixins/calendar-picker.locale.d.ts} +1 -3
  267. package/shared/picker-field/mixins/calendar-picker.template.d.ts +555 -0
  268. package/shared/picker-field/mixins/calendar-segments/calendarGrid.d.ts +17 -0
  269. package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/monthPickerGrid.d.ts +3 -3
  270. package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/columns.d.ts +1 -1
  271. package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.d.ts +2 -2
  272. package/{lib/time-picker/time/picker.d.ts → shared/picker-field/mixins/inline-time-picker/picker-option.d.ts} +1 -1
  273. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1110 -0
  274. package/shared/picker-field/mixins/single-date-picker.d.ts +1626 -0
  275. package/shared/picker-field/mixins/single-value-picker.d.ts +518 -0
  276. package/shared/picker-field/mixins/time-selection-picker.d.ts +1053 -0
  277. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +1050 -0
  278. package/shared/picker-field/picker-field.d.ts +11 -0
  279. package/shared/picker-field/picker-field.form-associated.d.ts +11 -0
  280. package/shared/picker-field/picker-field.template.d.ts +7 -0
  281. package/shared/picker-field.template.cjs +315 -0
  282. package/shared/picker-field.template.js +310 -0
  283. package/shared/single-date-picker.cjs +46 -0
  284. package/shared/single-date-picker.js +44 -0
  285. package/shared/single-value-picker.cjs +77 -0
  286. package/shared/single-value-picker.js +75 -0
  287. package/shared/slider.template.cjs +3 -3
  288. package/shared/slider.template.js +3 -3
  289. package/shared/text-anchor.cjs +2 -1
  290. package/shared/text-anchor.js +2 -1
  291. package/shared/text-anchor.template.cjs +3 -5
  292. package/shared/text-anchor.template.js +3 -5
  293. package/shared/text-field.cjs +2 -555
  294. package/shared/text-field.js +2 -554
  295. package/shared/time-selection-picker.template.cjs +776 -0
  296. package/shared/time-selection-picker.template.js +767 -0
  297. package/shared/vivid-element.cjs +1 -1
  298. package/shared/vivid-element.js +1 -1
  299. package/side-drawer/index.cjs +1 -1
  300. package/side-drawer/index.js +1 -1
  301. package/slider/index.cjs +1 -1
  302. package/slider/index.js +1 -1
  303. package/split-button/index.cjs +1 -1
  304. package/split-button/index.js +1 -1
  305. package/styles/core/all.css +1 -1
  306. package/styles/core/theme.css +1 -1
  307. package/styles/core/typography.css +1 -1
  308. package/styles/tokens/theme-dark.css +4 -4
  309. package/styles/tokens/theme-light.css +4 -4
  310. package/styles/tokens/vivid-2-compat.css +1 -1
  311. package/switch/index.cjs +1 -1
  312. package/switch/index.js +1 -1
  313. package/tab/index.cjs +1 -1
  314. package/tab/index.js +1 -1
  315. package/tab-panel/index.cjs +1 -1
  316. package/tab-panel/index.js +1 -1
  317. package/tabs/index.cjs +1 -1
  318. package/tabs/index.js +1 -1
  319. package/tag/index.cjs +1 -1
  320. package/tag/index.js +1 -1
  321. package/tag-group/index.cjs +1 -1
  322. package/tag-group/index.js +1 -1
  323. package/text-anchor/index.cjs +1 -1
  324. package/text-anchor/index.js +1 -1
  325. package/text-area/index.cjs +1 -1
  326. package/text-area/index.js +1 -1
  327. package/text-field/index.cjs +1 -1
  328. package/text-field/index.js +1 -1
  329. package/time-picker/index.cjs +1 -1
  330. package/time-picker/index.js +1 -1
  331. package/toggletip/index.cjs +1 -1
  332. package/toggletip/index.js +1 -1
  333. package/tooltip/index.cjs +1 -1
  334. package/tooltip/index.js +1 -1
  335. package/tree-item/index.cjs +1 -1
  336. package/tree-item/index.js +1 -1
  337. package/tree-view/index.cjs +1 -1
  338. package/tree-view/index.js +1 -1
  339. package/video-player/index.cjs +1 -1
  340. package/video-player/index.js +1 -1
  341. package/vivid.api.json +105 -1152
  342. package/lib/time-picker/time-picker.form-associated.d.ts +0 -11
  343. package/shared/aria-global.cjs +0 -93
  344. package/shared/aria-global.js +0 -91
  345. package/shared/date-picker/calendar/calendarGrid.d.ts +0 -17
  346. package/shared/date-picker/calendar/presentationDate.d.ts +0 -4
  347. package/shared/date-picker/date-picker-base.d.ts +0 -21
  348. package/shared/date-picker/date-picker-base.form-associated.d.ts +0 -11
  349. package/shared/date-picker/date-picker-base.template.d.ts +0 -3
  350. package/shared/foundation/patterns/aria-global.d.ts +0 -21
  351. package/shared/foundation/patterns/index.d.ts +0 -1
  352. package/shared/text-field2.cjs +0 -5
  353. package/shared/text-field2.js +0 -3
  354. package/shared/trapped-focus.cjs +0 -35
  355. package/shared/trapped-focus.js +0 -33
  356. /package/shared/{date-picker/calendar → datetime}/dateRange.d.ts +0 -0
  357. /package/shared/{date-picker/calendar → datetime}/dateStr.d.ts +0 -0
  358. /package/shared/{date-picker/calendar → datetime}/month.d.ts +0 -0
  359. /package/{lib/time-picker/time → shared/datetime}/presentationTime.d.ts +0 -0
  360. /package/shared/{date-picker/calendar → datetime}/year.d.ts +0 -0
  361. /package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/segment.d.ts +0 -0
  362. /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/definition.d.ts +0 -0
  363. /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.template.d.ts +0 -0
@@ -1,149 +1,96 @@
1
1
  'use strict';
2
2
 
3
- const definition$2 = require('./definition56.cjs');
4
- const definition = require('./definition64.cjs');
5
- const definition$1 = require('./definition11.cjs');
3
+ const definition = require('./definition28.cjs');
6
4
  const vividElement = require('./vivid-element.cjs');
5
+ const Reflector = require('./Reflector.cjs');
7
6
  const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
8
- const index = require('./index.cjs');
7
+ const delegatesAria = require('./delegates-aria.cjs');
9
8
  const formAssociated = require('./form-associated.cjs');
10
- const trappedFocus = require('./trapped-focus.cjs');
11
9
  const formElements = require('./form-elements.cjs');
12
- const localized = require('./localized.cjs');
10
+ const affix = require('./affix.cjs');
13
11
  const textField = require('./text-field.cjs');
14
- const scrollIntoView = require('./scrollIntoView.cjs');
15
- const when = require('./when.cjs');
16
- const repeat = require('./repeat.cjs');
17
12
  const classNames = require('./class-names.cjs');
18
- const ref = require('./ref.cjs');
13
+ const when = require('./when.cjs');
19
14
  const slotted = require('./slotted.cjs');
20
15
 
21
- const styles$1 = ":host{display:inline-block}.base,.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;border-top:1px solid var(--vvd-color-neutral-200);gap:8px}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none}.time-pickers .picker:hover{overflow-y:auto}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:156px;content:\"\"}.time-pickers .picker:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: -2px;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))}.time-pickers .item{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .item{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.time-pickers .item: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}.time-pickers .item: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}.time-pickers .item:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item: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}.time-pickers .item: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}.time-pickers .item{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}";
16
+ const byteToHex = [];
17
+ for (let i = 0; i < 256; ++i) {
18
+ byteToHex.push((i + 0x100).toString(16).slice(1));
19
+ }
20
+ function unsafeStringify(arr, offset = 0) {
21
+ return (byteToHex[arr[offset + 0]] +
22
+ byteToHex[arr[offset + 1]] +
23
+ byteToHex[arr[offset + 2]] +
24
+ byteToHex[arr[offset + 3]] +
25
+ '-' +
26
+ byteToHex[arr[offset + 4]] +
27
+ byteToHex[arr[offset + 5]] +
28
+ '-' +
29
+ byteToHex[arr[offset + 6]] +
30
+ byteToHex[arr[offset + 7]] +
31
+ '-' +
32
+ byteToHex[arr[offset + 8]] +
33
+ byteToHex[arr[offset + 9]] +
34
+ '-' +
35
+ byteToHex[arr[offset + 10]] +
36
+ byteToHex[arr[offset + 11]] +
37
+ byteToHex[arr[offset + 12]] +
38
+ byteToHex[arr[offset + 13]] +
39
+ byteToHex[arr[offset + 14]] +
40
+ byteToHex[arr[offset + 15]]).toLowerCase();
41
+ }
42
+
43
+ let getRandomValues;
44
+ const rnds8 = new Uint8Array(16);
45
+ function rng() {
46
+ if (!getRandomValues) {
47
+ if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
48
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
49
+ }
50
+ getRandomValues = crypto.getRandomValues.bind(crypto);
51
+ }
52
+ return getRandomValues(rnds8);
53
+ }
54
+
55
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
56
+ const native = { randomUUID };
57
+
58
+ function v4(options, buf, offset) {
59
+ if (native.randomUUID && true && !options) {
60
+ return native.randomUUID();
61
+ }
62
+ options = options || {};
63
+ const rnds = options.random ?? options.rng?.() ?? rng();
64
+ if (rnds.length < 16) {
65
+ throw new Error('Random bytes length must be >= 16');
66
+ }
67
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
68
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
69
+ return unsafeStringify(rnds);
70
+ }
71
+
72
+ const generateRandomId = () => v4();
22
73
 
23
- class _TimePicker extends vividElement.VividElement {
74
+ class _TextField extends vividElement.VividElement {
24
75
  }
25
- class FormAssociatedTimePicker extends formAssociated.FormAssociated(_TimePicker) {
76
+ class FormAssociatedTextField extends formAssociated.FormAssociated(_TextField) {
26
77
  constructor() {
27
78
  super(...arguments);
28
79
  this.proxy = document.createElement("input");
29
80
  }
30
81
  }
31
82
 
32
- const isValidTimeStr = (timeStr) => {
33
- const parts = timeStr.split(":");
34
- if (parts.length !== 3) {
35
- return false;
36
- }
37
- const [hours, minutes, seconds] = parts;
38
- if (hours.length !== 2 || minutes.length !== 2 || seconds.length !== 2) {
39
- return false;
40
- }
41
- const hoursNum = parseInt(hours, 10);
42
- const minutesNum = parseInt(minutes, 10);
43
- const secondsNum = parseInt(seconds, 10);
44
- if (isNaN(hoursNum) || isNaN(minutesNum) || isNaN(secondsNum)) {
45
- return false;
46
- }
47
- if (hoursNum < 0 || hoursNum > 23) {
48
- return false;
49
- }
50
- if (minutesNum < 0 || minutesNum > 59) {
51
- return false;
52
- }
53
- if (secondsNum < 0 || secondsNum > 59) {
54
- return false;
55
- }
56
- return true;
57
- };
58
- const parseTimePart = (partStr) => Number.parseInt(partStr, 10);
59
- const formatTimePart = (part) => part.toString().padStart(2, "0");
60
- const parseTimeStr = (timeStr) => {
61
- const [hoursStr, minutesStr, secondsStr] = timeStr.split(":");
62
- const hours = parseTimePart(hoursStr);
63
- const minutes = parseTimePart(minutesStr);
64
- const seconds = parseTimePart(secondsStr);
65
- return {
66
- hourStr: hoursStr,
67
- hours,
68
- minuteStr: minutesStr,
69
- minutes,
70
- secondStr: secondsStr,
71
- seconds,
72
- meridiem: hours < 12 ? "AM" : "PM"
73
- };
74
- };
75
- const hoursAs12hClock = (hour) => hour % 12 || 12;
76
-
77
- const formatPresentationTime = (timeStr, includeSeconds, use12HourClock) => {
78
- const time = parseTimeStr(timeStr);
79
- const hoursStr = formatTimePart(
80
- use12HourClock ? hoursAs12hClock(time.hours) : time.hours
81
- );
82
- let result = `${hoursStr}:${time.minuteStr}`;
83
- if (includeSeconds) {
84
- result += `:${time.secondStr}`;
85
- }
86
- if (use12HourClock) {
87
- result += ` ${time.meridiem}`;
88
- }
89
- return result;
90
- };
91
- const isDigit = (char) => char >= "0" && char <= "9";
92
- const parsePresentationTime = (input, use12HourClock) => {
93
- const cleanedInput = input.toLowerCase();
94
- const numerals = [];
95
- let meridiem;
96
- for (let i = 0; i < cleanedInput.length; i++) {
97
- const char = cleanedInput[i];
98
- if (char === "a" && cleanedInput[i + 1] === "m") {
99
- i++;
100
- meridiem = "AM";
101
- }
102
- if (char === "p" && cleanedInput[i + 1] === "m") {
103
- i++;
104
- meridiem = "PM";
105
- }
106
- if (isDigit(char)) {
107
- let numeral = char;
108
- while (isDigit(cleanedInput[i + 1])) {
109
- i++;
110
- numeral += cleanedInput[i];
111
- }
112
- numerals.push(Number.parseInt(numeral, 10));
113
- }
114
- }
115
- if (numerals.length === 0 || numerals.length > 3) {
116
- throw new Error("Invalid time format");
117
- }
118
- if (meridiem && (numerals[0] < 1 || numerals[0] > 12)) {
119
- throw new Error("Invalid time format");
120
- }
121
- if (meridiem || use12HourClock) {
122
- if (numerals[0] === 12) {
123
- numerals[0] = 0;
124
- }
125
- }
126
- if (meridiem === "PM") {
127
- numerals[0] = numerals[0] + 12;
128
- }
129
- const [hours, minutes = 0, seconds = 0] = numerals;
130
- if (hours > 23 || minutes > 59 || seconds > 59) {
131
- throw new Error("Invalid value");
132
- }
133
- return [hours, minutes, seconds].map(formatTimePart).join(":");
134
- };
135
-
136
- var __defProp$1 = Object.defineProperty;
83
+ var __defProp = Object.defineProperty;
137
84
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
138
85
  var __typeError = (msg) => {
139
86
  throw TypeError(msg);
140
87
  };
141
- var __decorateClass$1 = (decorators, target, key, kind) => {
88
+ var __decorateClass = (decorators, target, key, kind) => {
142
89
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
143
90
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
144
91
  if (decorator = decorators[i])
145
92
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
146
- if (kind && result) __defProp$1(target, key, result);
93
+ if (kind && result) __defProp(target, key, result);
147
94
  return result;
148
95
  };
149
96
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
@@ -151,65 +98,55 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
151
98
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
152
99
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
153
100
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
154
- var _clockChangeHandler, _clockChangeObserver, _getFocusableEls, _TimePicker_instances, updateValueDueToUserInteraction_fn, _onFocusIn, _onFocusOut, _dismissOnClickOutside, openPopupIfPossible_fn;
155
- const ValidTimeFilter = {
156
- fromView: (value) => {
157
- if (value && isValidTimeStr(value)) {
158
- return value;
159
- }
160
- return "";
161
- },
162
- toView(value) {
163
- return value;
101
+ var _TextField_instances, handleLabelChange_fn, _reflectToInput, _helperTextMirrorEl, _helperTextSlotMutationObserver, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
102
+ const TextFieldType = {
103
+ /**
104
+ * A text TextField
105
+ */
106
+ text: "text"};
107
+ const safariWorkaroundClassName = "_vvd-3-text-field-safari-workaround";
108
+ const getSafariWorkaroundStyleSheet = definition.memoizeWith(
109
+ () => "",
110
+ () => {
111
+ const styleSheet = new CSSStyleSheet();
112
+ const supportsReplaceSync = "replaceSync" in styleSheet;
113
+ if (supportsReplaceSync) {
114
+ styleSheet.replaceSync(`
115
+ .${safariWorkaroundClassName}::placeholder {
116
+ opacity: 1 !important;
117
+ -webkit-text-fill-color: var(--_low-ink-color) !important;
118
+ }`);
119
+ }
120
+ return styleSheet;
121
+ }
122
+ );
123
+ const installSafariWorkaroundStyle = (forElement) => {
124
+ const root = forElement.getRootNode();
125
+ const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
126
+ const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
127
+ if (!supportsAdoptedStyleSheets) {
128
+ return;
129
+ }
130
+ if (!root.adoptedStyleSheets.includes(workaroundStyleSheet)) {
131
+ root.adoptedStyleSheets = [
132
+ ...root.adoptedStyleSheets,
133
+ workaroundStyleSheet
134
+ ];
164
135
  }
165
136
  };
166
- exports.TimePicker = class TimePicker extends FormAssociatedTimePicker {
137
+ exports.TextField = class TextField extends delegatesAria.DelegatesAria(FormAssociatedTextField) {
167
138
  constructor() {
168
- super();
169
- __privateAdd(this, _TimePicker_instances);
170
- this.readOnly = false;
171
- this.minutesStep = null;
172
- this.secondsStep = null;
173
- // Reformat the presentation value when the clock changes
174
- __privateAdd(this, _clockChangeHandler, {
175
- handleChange: () => {
176
- if (this.value) {
177
- this._presentationValue = formatPresentationTime(
178
- this.value,
179
- this._displaySeconds,
180
- this._use12hClock
181
- );
182
- }
183
- }
184
- });
185
- __privateAdd(this, _clockChangeObserver);
186
- __privateAdd(this, _getFocusableEls, () => this.shadowRoot.querySelectorAll(`
187
- #inline-time-picker,
188
- .dialog .vwc-button:not(:disabled)
189
- `));
190
- __privateAdd(this, _onFocusIn, () => {
191
- this.$emit("focus", void 0, { bubbles: false });
192
- });
193
- __privateAdd(this, _onFocusOut, () => {
194
- this.$emit("blur", void 0, { bubbles: false });
195
- });
196
- this._popupOpen = false;
197
- __privateAdd(this, _dismissOnClickOutside, (event) => {
198
- if (!this._popupOpen) {
199
- return;
200
- }
201
- const path = event.composedPath();
202
- const elementsToIgnoreClicksOn = [this._dialogEl, this._clockButtonEl];
203
- if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
204
- this._closePopup(false);
205
- }
206
- });
207
- this._presentationValue = "";
208
- this.value = "";
209
- this.min = "";
210
- this.max = "";
211
- this.proxy.type = "time";
212
- this.proxy.step = "1";
139
+ super(...arguments);
140
+ __privateAdd(this, _TextField_instances);
141
+ // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
142
+ this.type = TextFieldType.text;
143
+ /**
144
+ * @internal
145
+ */
146
+ this._labelEl = null;
147
+ __privateAdd(this, _reflectToInput);
148
+ __privateAdd(this, _helperTextMirrorEl);
149
+ __privateAdd(this, _helperTextSlotMutationObserver);
213
150
  }
214
151
  /**
215
152
  * @internal
@@ -223,718 +160,412 @@ exports.TimePicker = class TimePicker extends FormAssociatedTimePicker {
223
160
  /**
224
161
  * @internal
225
162
  */
226
- minChanged(_, newMin) {
163
+ autofocusChanged() {
227
164
  if (this.proxy instanceof HTMLInputElement) {
228
- this.proxy.min = newMin;
165
+ this.proxy.autofocus = this.autofocus;
229
166
  this.validate();
230
167
  }
231
168
  }
232
169
  /**
233
170
  * @internal
234
171
  */
235
- maxChanged(_, newMax) {
172
+ placeholderChanged() {
236
173
  if (this.proxy instanceof HTMLInputElement) {
237
- this.proxy.max = newMax;
238
- this.validate();
174
+ this.proxy.placeholder = this.placeholder;
239
175
  }
240
176
  }
241
- // --- Core ---
242
- /**
243
- * @internal
244
- */
245
- get _displaySeconds() {
246
- return this.secondsStep !== null;
247
- }
248
- get _use12hClock() {
249
- return this.clock ? this.clock === "12h" : this.locale.timePicker.defaultTo12HourClock;
250
- }
251
177
  /**
252
178
  * @internal
253
179
  */
254
- valueChanged(previous, next) {
255
- super.valueChanged(previous, next);
256
- if (this.value) {
257
- if (!isValidTimeStr(this.value)) {
258
- this.value = "";
259
- return;
260
- }
261
- this._presentationValue = formatPresentationTime(
262
- this.value,
263
- this._displaySeconds,
264
- this._use12hClock
265
- );
266
- } else {
267
- this._presentationValue = "";
180
+ typeChanged() {
181
+ if (this.proxy instanceof HTMLInputElement) {
182
+ this.proxy.type = this.type;
183
+ this.validate();
268
184
  }
269
185
  }
270
- connectedCallback() {
271
- super.connectedCallback();
272
- document.addEventListener("click", __privateGet(this, _dismissOnClickOutside));
273
- this.addEventListener("focusin", __privateGet(this, _onFocusIn));
274
- this.addEventListener("focusout", __privateGet(this, _onFocusOut));
275
- __privateSet(this, _clockChangeObserver, vividElement.Observable.binding(
276
- () => this._use12hClock,
277
- __privateGet(this, _clockChangeHandler)
278
- ));
279
- __privateGet(this, _clockChangeObserver).observe(this, vividElement.defaultExecutionContext);
280
- }
281
- disconnectedCallback() {
282
- super.disconnectedCallback();
283
- document.removeEventListener("click", __privateGet(this, _dismissOnClickOutside));
284
- this.removeEventListener("focusin", __privateGet(this, _onFocusIn));
285
- this.removeEventListener("focusout", __privateGet(this, _onFocusOut));
286
- __privateGet(this, _clockChangeObserver).disconnect();
287
- }
288
186
  /**
289
187
  * @internal
290
188
  */
291
- _closePopup(restoreFocusToTextField = true) {
292
- this._popupOpen = false;
293
- if (restoreFocusToTextField) {
294
- this._textFieldEl.focus();
189
+ listChanged() {
190
+ if (this.proxy instanceof HTMLInputElement) {
191
+ this.proxy.setAttribute("list", this.list);
192
+ this.validate();
295
193
  }
296
194
  }
297
195
  /**
298
- * On keydown anywhere in the time picker.
299
196
  * @internal
300
197
  */
301
- _onBaseKeyDown(event) {
302
- if (this._popupOpen && index.handleEscapeKeyAndStopPropogation(event)) {
303
- this._closePopup();
304
- return false;
305
- }
306
- if (this._trappedFocus(event, __privateGet(this, _getFocusableEls))) {
307
- return false;
198
+ maxlengthChanged() {
199
+ if (this.proxy instanceof HTMLInputElement) {
200
+ this.proxy.maxLength = this.maxlength;
201
+ this.validate();
308
202
  }
309
- return true;
310
203
  }
311
204
  /**
312
205
  * @internal
313
206
  */
314
- _presentationValueChanged() {
315
- this.dirtyValue = true;
316
- this.validate();
317
- }
318
- /**
319
- * @internal
320
- */
321
- get _textFieldPlaceholder() {
322
- let format = "hh:mm";
323
- if (this._displaySeconds) {
324
- format += ":ss";
325
- }
326
- if (this._use12hClock) {
327
- format += " aa";
207
+ minlengthChanged() {
208
+ if (this.proxy instanceof HTMLInputElement) {
209
+ this.proxy.minLength = this.minlength;
210
+ this.validate();
328
211
  }
329
- return format;
330
212
  }
331
213
  /**
332
214
  * @internal
333
215
  */
334
- _onTextFieldInput(event) {
335
- const textField = event.currentTarget;
336
- this._presentationValue = textField.value;
337
- }
338
- /**
339
- * @internal
340
- */
341
- _onTextFieldChange() {
342
- if (this._presentationValue === "") {
343
- __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
344
- return;
345
- }
346
- try {
347
- __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, parsePresentationTime(this._presentationValue, this._use12hClock));
348
- } catch (_) {
349
- return;
216
+ patternChanged() {
217
+ if (this.proxy instanceof HTMLInputElement) {
218
+ this.proxy.pattern = this.pattern;
219
+ this.validate();
350
220
  }
351
221
  }
352
- // --- Clock button ---
353
222
  /**
354
223
  * @internal
355
224
  */
356
- get _clockButtonLabel() {
357
- if (this.value) {
358
- return this.locale.timePicker.changeTimeLabel(
359
- formatPresentationTime(
360
- this.value,
361
- this._displaySeconds,
362
- this._use12hClock
363
- )
364
- );
225
+ sizeChanged() {
226
+ if (this.proxy instanceof HTMLInputElement) {
227
+ this.proxy.size = this.size;
365
228
  }
366
- return this.locale.timePicker.chooseTimeLabel;
367
229
  }
368
230
  /**
369
231
  * @internal
370
232
  */
371
- _onClockButtonClick() {
372
- if (this._popupOpen) {
373
- this._closePopup();
374
- } else {
375
- __privateMethod(this, _TimePicker_instances, openPopupIfPossible_fn).call(this);
376
- vividElement.DOM.processUpdates();
377
- this._inlineTimePickerEl.scrollSelectedOptionsToTop();
378
- __privateGet(this, _getFocusableEls).call(this)[0].focus();
233
+ spellcheckChanged() {
234
+ if (this.proxy instanceof HTMLInputElement) {
235
+ this.proxy.spellcheck = this.spellcheck;
379
236
  }
380
237
  }
381
- // --- Inline time picker ---
382
238
  /**
383
- * @internal
239
+ * Selects all the text in the text field
240
+ *
241
+ * @public
384
242
  */
385
- _onInlineTimePickerChange(event) {
386
- __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, event.detail);
243
+ select() {
244
+ this.control.select();
387
245
  }
388
246
  /**
247
+ * Handles the internal control's `input` event
389
248
  * @internal
390
249
  */
391
- _onInlineTimePickerLastColumnSelected() {
392
- this._closePopup();
250
+ handleTextInput() {
251
+ this.value = this.control.value;
393
252
  }
394
- // --- Dialog footer ---
395
253
  /**
254
+ * Change event handler for inner control.
255
+ * @remarks
256
+ * "Change" events are not `composable` so they will not
257
+ * permeate the shadow DOM boundary. This fn effectively proxies
258
+ * the change event, emitting a `change` event whenever the internal
259
+ * control emits a `change` event
396
260
  * @internal
397
261
  */
398
- _onOkClick() {
399
- this._closePopup();
262
+ handleChange() {
263
+ this.$emit("change");
400
264
  }
401
- /**
402
- * @internal
403
- */
404
- _onClearClick() {
405
- __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
406
- this._closePopup();
265
+ /** {@inheritDoc (FormAssociated:interface).validate} */
266
+ validate() {
267
+ super.validate(this.control);
407
268
  }
408
- // --- Validation ---
409
269
  /**
410
270
  * @internal
411
271
  */
412
- validate() {
413
- if (this.proxy) {
414
- this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
272
+ labelChanged() {
273
+ if (this._labelEl) {
274
+ __privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, this._labelEl);
415
275
  }
416
- super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
276
+ }
277
+ connectedCallback() {
278
+ super.connectedCallback();
279
+ this.proxy.setAttribute("type", this.type);
280
+ this.validate();
281
+ if (this.autofocus) {
282
+ vividElement.DOM.queueUpdate(() => {
283
+ this.focus();
284
+ });
285
+ }
286
+ if (!this.control) {
287
+ const uniqueId = this.id || generateRandomId();
288
+ const controlId = `vvd-text-field-control-${uniqueId}`;
289
+ const helperTextId = `vvd-text-field-helper-text-${uniqueId}`;
290
+ const input = document.createElement("input");
291
+ input.slot = "_control";
292
+ input.id = controlId;
293
+ input.className = safariWorkaroundClassName;
294
+ this.control = input;
295
+ input.addEventListener("input", () => {
296
+ this.handleTextInput();
297
+ });
298
+ input.addEventListener("change", () => {
299
+ this.handleChange();
300
+ });
301
+ input.addEventListener("blur", () => {
302
+ this.$emit("blur", void 0, { bubbles: false });
303
+ });
304
+ input.addEventListener("focus", () => {
305
+ this.$emit("focus", void 0, { bubbles: false });
306
+ });
307
+ this.appendChild(input);
308
+ const label = document.createElement("label");
309
+ label.slot = "_label";
310
+ label.htmlFor = controlId;
311
+ this._labelEl = label;
312
+ __privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, label);
313
+ __privateSet(this, _helperTextMirrorEl, document.createElement("div"));
314
+ __privateGet(this, _helperTextMirrorEl).id = helperTextId;
315
+ __privateGet(this, _helperTextMirrorEl).slot = "_mirrored-helper-text";
316
+ __privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
317
+ this.appendChild(__privateGet(this, _helperTextMirrorEl));
318
+ installSafariWorkaroundStyle(this);
319
+ }
320
+ __privateSet(this, _reflectToInput, new Reflector.Reflector(this, this.control));
321
+ __privateGet(this, _reflectToInput).booleanAttribute("autofocus", "autofocus");
322
+ __privateGet(this, _reflectToInput).booleanAttribute("disabled", "disabled");
323
+ __privateGet(this, _reflectToInput).booleanAttribute("readOnly", "readonly");
324
+ __privateGet(this, _reflectToInput).booleanAttribute("required", "required");
325
+ __privateGet(this, _reflectToInput).booleanAttribute("spellcheck", "spellcheck");
326
+ __privateGet(this, _reflectToInput).attribute("list", "list");
327
+ __privateGet(this, _reflectToInput).attribute("maxlength", "maxlength");
328
+ __privateGet(this, _reflectToInput).attribute("minlength", "minlength");
329
+ __privateGet(this, _reflectToInput).attribute("pattern", "pattern");
330
+ __privateGet(this, _reflectToInput).attribute("placeholder", "placeholder");
331
+ __privateGet(this, _reflectToInput).attribute("size", "size");
332
+ __privateGet(this, _reflectToInput).attribute("autoComplete", "autocomplete");
333
+ __privateGet(this, _reflectToInput).attribute("type", "type");
334
+ __privateGet(this, _reflectToInput).attribute("inputMode", "inputmode");
335
+ __privateGet(this, _reflectToInput).attribute("ariaAtomic", "aria-atomic");
336
+ __privateGet(this, _reflectToInput).attribute("ariaBusy", "aria-busy");
337
+ __privateGet(this, _reflectToInput).attribute("ariaCurrent", "aria-current");
338
+ __privateGet(this, _reflectToInput).attribute("ariaDisabled", "aria-disabled");
339
+ __privateGet(this, _reflectToInput).attribute("ariaHasPopup", "aria-haspopup");
340
+ __privateGet(this, _reflectToInput).attribute("ariaHidden", "aria-hidden");
341
+ __privateGet(this, _reflectToInput).attribute("ariaInvalid", "aria-invalid");
342
+ __privateGet(this, _reflectToInput).attribute("ariaKeyShortcuts", "aria-keyshortcuts");
343
+ __privateGet(this, _reflectToInput).attribute("ariaLabel", "aria-label");
344
+ __privateGet(this, _reflectToInput).attribute("ariaLive", "aria-live");
345
+ __privateGet(this, _reflectToInput).attribute("ariaRelevant", "aria-relevant");
346
+ __privateGet(this, _reflectToInput).attribute(
347
+ "ariaRoleDescription",
348
+ "aria-roledescription"
349
+ );
350
+ __privateGet(this, _reflectToInput).property("value", "value", true);
351
+ __privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
352
+ }
353
+ disconnectedCallback() {
354
+ super.disconnectedCallback();
355
+ __privateGet(this, _reflectToInput).destroy();
356
+ __privateSet(this, _reflectToInput, void 0);
357
+ __privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
358
+ }
359
+ focus() {
360
+ this.control?.focus();
417
361
  }
418
362
  /**
419
363
  * @internal
420
364
  */
421
- _getCustomValidationError() {
422
- if (this._isPresentationValueInvalid()) {
423
- return this.locale.timePicker.invalidTimeError;
424
- }
425
- return null;
365
+ helperTextChanged() {
366
+ __privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
426
367
  }
427
368
  /**
428
369
  * @internal
429
370
  */
430
- _isPresentationValueInvalid() {
431
- if (this._presentationValue === "") {
432
- return false;
433
- }
434
- try {
435
- parsePresentationTime(this._presentationValue, this._use12hClock);
436
- return false;
437
- } catch (_) {
438
- return true;
439
- }
371
+ _helperTextSlottedContentChanged() {
372
+ __privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
373
+ __privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
440
374
  }
441
375
  };
442
- _clockChangeHandler = new WeakMap();
443
- _clockChangeObserver = new WeakMap();
444
- _getFocusableEls = new WeakMap();
445
- _TimePicker_instances = new WeakSet();
446
- updateValueDueToUserInteraction_fn = function(newValue) {
447
- this.value = newValue;
448
- this.$emit("change");
449
- this.$emit("input");
450
- };
451
- _onFocusIn = new WeakMap();
452
- _onFocusOut = new WeakMap();
453
- _dismissOnClickOutside = new WeakMap();
454
- openPopupIfPossible_fn = function() {
455
- if (!this.readOnly) {
456
- this._popupOpen = true;
457
- }
458
- };
459
- __decorateClass$1([
460
- vividElement.attr({ attribute: "readonly", mode: "boolean" })
461
- ], exports.TimePicker.prototype, "readOnly", 2);
462
- __decorateClass$1([
463
- vividElement.attr({ attribute: "minutes-step", converter: vividElement.nullableNumberConverter })
464
- ], exports.TimePicker.prototype, "minutesStep", 2);
465
- __decorateClass$1([
466
- vividElement.attr({ attribute: "seconds-step", converter: vividElement.nullableNumberConverter })
467
- ], exports.TimePicker.prototype, "secondsStep", 2);
468
- __decorateClass$1([
469
- vividElement.attr
470
- ], exports.TimePicker.prototype, "clock", 2);
471
- __decorateClass$1([
472
- vividElement.attr({ converter: ValidTimeFilter })
473
- ], exports.TimePicker.prototype, "min", 2);
474
- __decorateClass$1([
475
- vividElement.attr({ converter: ValidTimeFilter })
476
- ], exports.TimePicker.prototype, "max", 2);
477
- __decorateClass$1([
478
- vividElement.volatile
479
- ], exports.TimePicker.prototype, "_use12hClock", 1);
480
- __decorateClass$1([
481
- vividElement.observable
482
- ], exports.TimePicker.prototype, "_popupOpen", 2);
483
- __decorateClass$1([
484
- vividElement.observable
485
- ], exports.TimePicker.prototype, "_presentationValue", 2);
486
- exports.TimePicker = __decorateClass$1([
487
- formElements.errorText,
488
- formElements.formElements
489
- ], exports.TimePicker);
490
- applyMixinsWithObservables.applyMixinsWithObservables(
491
- exports.TimePicker,
492
- localized.Localized,
493
- formElements.FormElementHelperText,
494
- trappedFocus.TrappedFocus
495
- );
496
-
497
- const fallsIntoMeridiem = (meridiem, hour) => meridiem === "AM" && hour < 12 || meridiem === "PM" && hour >= 12;
498
- const getHoursOptions = (min, max, forMeridiem) => {
499
- const result = [];
500
- const minHour = min ? parseTimeStr(min).hours : 0;
501
- const maxHour = max ? parseTimeStr(max).hours : 23;
502
- for (let i = minHour; i <= maxHour; i++) {
503
- if (forMeridiem && !fallsIntoMeridiem(forMeridiem, i)) {
504
- continue;
505
- }
506
- result.push({
507
- value: formatTimePart(i),
508
- label: formatTimePart(forMeridiem ? hoursAs12hClock(i) : i)
509
- });
510
- }
511
- return result;
512
- };
513
- const getMinutesOptions = (step, value, min, max) => {
514
- const result = [];
515
- let minMinute = 0;
516
- let maxMinute = 59;
517
- if (min) {
518
- const { hourStr: minHourStr, minutes: minMinutes } = parseTimeStr(min);
519
- if (value && parseTimeStr(value).hourStr === minHourStr) {
520
- minMinute = minMinutes;
521
- }
522
- }
523
- if (max) {
524
- const { hourStr: maxHourStr, minutes: maxMinutes } = parseTimeStr(max);
525
- if (value && parseTimeStr(value).hourStr === maxHourStr) {
526
- maxMinute = maxMinutes;
527
- }
528
- }
529
- for (let i = minMinute; i <= maxMinute; i += Math.max(1, step ?? 1)) {
530
- const minutes = formatTimePart(i);
531
- result.push({
532
- value: minutes,
533
- label: minutes
534
- });
535
- }
536
- return result;
537
- };
538
- const getSecondsOptions = (step, value, min, max) => {
539
- const result = [];
540
- let minSecond = 0;
541
- let maxSecond = 59;
542
- if (min) {
543
- const minTime = parseTimeStr(min);
544
- if (value && (parseTimeStr(value).hourStr === minTime.hourStr && parseTimeStr(value).minuteStr) === minTime.minuteStr) {
545
- minSecond = minTime.seconds;
546
- }
547
- }
548
- if (max) {
549
- const maxTime = parseTimeStr(max);
550
- if (value && (parseTimeStr(value).hourStr === maxTime.hourStr && parseTimeStr(value).minuteStr) === maxTime.minuteStr) {
551
- maxSecond = maxTime.seconds;
552
- }
553
- }
554
- for (let i = minSecond; i <= maxSecond; i += Math.max(1, step)) {
555
- const seconds = formatTimePart(i);
556
- result.push({
557
- value: seconds,
558
- label: seconds
559
- });
560
- }
561
- return result;
562
- };
563
- const getMeridiesOptions = (min, max) => {
564
- const result = [];
565
- const hideAM = min ? parseTimeStr(min).meridiem === "PM" : false;
566
- if (!hideAM) {
567
- result.push({
568
- value: "AM",
569
- label: "AM"
570
- });
571
- }
572
- const hidePM = max ? parseTimeStr(max).meridiem === "AM" : false;
573
- if (!hidePM) {
574
- result.push({
575
- value: "PM",
576
- label: "PM"
577
- });
578
- }
579
- return result;
580
- };
581
-
582
- const HoursColumn = {
583
- id: "hours",
584
- getLabel: (x) => x.locale.timePicker.hoursLabel,
585
- getOptions: (x) => getHoursOptions(
586
- x.min,
587
- x.max,
588
- x.clock === "12h" ? MeridiesColumn.getSelectedOptionValue(x) ?? MeridiesColumn.getOptions(x)[0].value : void 0
589
- ),
590
- getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).hourStr : void 0,
591
- updatedValue: (x, optionValue) => {
592
- if (x.value) {
593
- const { minuteStr, secondStr } = parseTimeStr(x.value);
594
- return `${optionValue}:${minuteStr}:${secondStr}`;
595
- } else {
596
- return `${optionValue}:00:00`;
597
- }
598
- }
599
- };
600
- const MinutesColumn = {
601
- id: "minutes",
602
- getLabel: (x) => x.locale.timePicker.minutesLabel,
603
- getOptions: (x) => getMinutesOptions(x.minutesStep, x.value, x.min, x.max),
604
- getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).minuteStr : void 0,
605
- updatedValue: (x, optionValue) => {
606
- if (x.value) {
607
- const { hourStr, secondStr } = parseTimeStr(x.value);
608
- return `${hourStr}:${optionValue}:${secondStr}`;
609
- } else {
610
- return `00:${optionValue}:00`;
611
- }
612
- }
613
- };
614
- const SecondsColumn = {
615
- id: "seconds",
616
- getLabel: (x) => x.locale.timePicker.secondsLabel,
617
- getOptions: (x) => getSecondsOptions(x.secondsStep, x.value, x.min, x.max),
618
- getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).secondStr : void 0,
619
- updatedValue: (x, optionValue) => {
620
- if (x.value) {
621
- const { hourStr, minuteStr } = parseTimeStr(x.value);
622
- return `${hourStr}:${minuteStr}:${optionValue}`;
623
- } else {
624
- return `00:00:${optionValue}`;
376
+ _TextField_instances = new WeakSet();
377
+ handleLabelChange_fn = function(labelEl) {
378
+ if (!this.label) {
379
+ labelEl.remove();
380
+ } else {
381
+ labelEl.textContent = this.label;
382
+ if (!labelEl.isConnected) {
383
+ this.appendChild(labelEl);
625
384
  }
626
385
  }
627
386
  };
628
- const MeridiesColumn = {
629
- id: "meridies",
630
- getLabel: (x) => x.locale.timePicker.meridiesLabel,
631
- getOptions: (x) => getMeridiesOptions(x.min, x.max),
632
- getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).meridiem : void 0,
633
- updatedValue: (x, optionValue) => {
634
- if (x.value) {
635
- const { hours, minuteStr, secondStr } = parseTimeStr(x.value);
636
- let adjustedHours = hours;
637
- if (optionValue === "AM" && hours >= 12) {
638
- adjustedHours -= 12;
639
- } else if (optionValue === "PM" && hours < 12) {
640
- adjustedHours += 12;
641
- }
642
- return `${formatTimePart(adjustedHours)}:${minuteStr}:${secondStr}`;
643
- } else {
644
- if (optionValue === "AM") {
645
- return "00:00:00";
646
- } else {
647
- return "12:00:00";
387
+ _reflectToInput = new WeakMap();
388
+ _helperTextMirrorEl = new WeakMap();
389
+ _helperTextSlotMutationObserver = new WeakMap();
390
+ updateHelperTextMutationObserver_fn = function() {
391
+ const usesHelperTextSlot = this._helperTextSlottedContent.length;
392
+ const shouldHaveMutationObserver = usesHelperTextSlot && this.isConnected;
393
+ if (shouldHaveMutationObserver && !__privateGet(this, _helperTextSlotMutationObserver)) {
394
+ __privateSet(this, _helperTextSlotMutationObserver, new MutationObserver((records) => {
395
+ if (records.some((record) => record.target !== __privateGet(this, _helperTextMirrorEl))) {
396
+ __privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
648
397
  }
649
- }
650
- }
651
- };
652
-
653
- const shouldDisplaySecondsPicker = (x) => x.secondsStep !== void 0;
654
- const shouldDisplay12hClock = (x) => x.clock === "12h";
655
- const onPickerOptionClick = (x, column, optionValue) => {
656
- emitChange(x, column.updatedValue(x, optionValue));
657
- scrollToOption(x, column.id, optionValue, "start");
658
- const nextPickerEl = x.shadowRoot.querySelector(
659
- `#${column.id} + .picker`
660
- );
661
- if (nextPickerEl) {
662
- nextPickerEl.focus();
663
- } else {
664
- x.$emit("last-column-selected", void 0, {
665
- bubbles: false
398
+ }));
399
+ __privateGet(this, _helperTextSlotMutationObserver).observe(this, {
400
+ subtree: true,
401
+ childList: true,
402
+ characterData: true
666
403
  });
667
404
  }
668
- };
669
- const onPickerKeyDown = (x, column, event) => {
670
- const options = column.getOptions(x);
671
- const selectedValue = column.getSelectedOptionValue(x);
672
- const offset = {
673
- ArrowUp: -1,
674
- ArrowDown: 1
675
- }[event.key];
676
- if (offset) {
677
- event.preventDefault();
678
- const index = options.findIndex((h) => h.value === selectedValue);
679
- const newRawIndex = index === -1 ? 0 : index + offset;
680
- const newIndex = (newRawIndex + options.length) % options.length;
681
- const newValue = options[newIndex].value;
682
- emitChange(x, column.updatedValue(x, newValue));
683
- scrollToOption(x, column.id, newValue, "nearest");
684
- }
685
- return true;
686
- };
687
- const scrollToOption = (x, picker, optionValue, position) => {
688
- const element = x.shadowRoot.querySelector(
689
- `#${picker}-${optionValue}`
690
- );
691
- if (!element) {
692
- return;
405
+ if (!shouldHaveMutationObserver && __privateGet(this, _helperTextSlotMutationObserver)) {
406
+ __privateGet(this, _helperTextSlotMutationObserver).disconnect();
407
+ __privateSet(this, _helperTextSlotMutationObserver, void 0);
693
408
  }
694
- scrollIntoView.scrollIntoView(element, element.parentElement, position);
695
409
  };
696
- const onBaseKeyDown = (x, event) => {
697
- if (event.key === "Tab") {
698
- const focusableElements = x.shadowRoot.querySelectorAll(".picker");
699
- const terminalElement = event.shiftKey ? focusableElements[0] : focusableElements[focusableElements.length - 1];
700
- if (x.shadowRoot.activeElement !== terminalElement) {
701
- trappedFocus.TrappedFocus.ignoreEvent(event);
702
- }
703
- }
704
- return true;
705
- };
706
- const emitChange = (x, time) => {
707
- x.$emit("change", time, { bubbles: false, composed: false });
708
- };
709
- const renderPicker = (column) => {
710
- return vividElement.html`<ul
711
- id="${column.id}"
712
- class="picker"
713
- role="listbox"
714
- tabindex="0"
715
- aria-label="${column.getLabel}"
716
- aria-activedescendant="${(x) => column.getSelectedOptionValue(x) ? `${column.id}-${column.getSelectedOptionValue(x)}` : void 0}"
717
- @keydown="${(x, c) => onPickerKeyDown(x, column, c.event)}"
718
- >
719
- ${repeat.repeat(
720
- (x) => column.getOptions(x),
721
- vividElement.html`<li
722
- id="${(x) => `${column.id}-${x.value}`}"
723
- class="${(x, c) => classNames.classNames("option", [
724
- "selected",
725
- column.getSelectedOptionValue(c.parent) === x.value
726
- ])}"
727
- aria-selected="${(x, c) => column.getSelectedOptionValue(c.parent) === x.value}"
728
- role="option"
729
- @click="${(x, c) => onPickerOptionClick(c.parent, column, x.value)}"
730
- >
731
- ${(x) => x.label}
732
- </li>`
733
- )}
734
- </ul>`;
735
- };
736
- const InlineTimePickerTemplate = () => {
737
- return vividElement.html`<div
738
- class="time-pickers"
739
- @keydown="${(x, { event }) => onBaseKeyDown(x, event)}"
740
- >
741
- ${renderPicker(HoursColumn)} ${renderPicker(MinutesColumn)}
742
- ${when.when(shouldDisplaySecondsPicker, renderPicker(SecondsColumn))}
743
- ${when.when(shouldDisplay12hClock, renderPicker(MeridiesColumn))}
744
- </div>`;
745
- };
746
-
747
- var __defProp = Object.defineProperty;
748
- var __decorateClass = (decorators, target, key, kind) => {
749
- var result = void 0 ;
750
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
751
- if (decorator = decorators[i])
752
- result = (decorator(target, key, result) ) || result;
753
- if (result) __defProp(target, key, result);
754
- return result;
755
- };
756
- class InlineTimePicker extends vividElement.VividElement {
757
- constructor() {
758
- super(...arguments);
759
- this.minutesStep = 1;
760
- this.clock = "24h";
761
- }
762
- valueChanged(_, newValue) {
763
- if (newValue !== void 0 && !isValidTimeStr(newValue)) {
764
- this.value = void 0;
765
- }
766
- }
767
- scrollSelectedOptionsToTop() {
768
- if (HoursColumn.getSelectedOptionValue(this)) {
769
- scrollToOption(
770
- this,
771
- "hours",
772
- HoursColumn.getSelectedOptionValue(this),
773
- "start"
774
- );
775
- }
776
- if (MinutesColumn.getSelectedOptionValue(this)) {
777
- scrollToOption(
778
- this,
779
- "minutes",
780
- MinutesColumn.getSelectedOptionValue(this),
781
- "start"
782
- );
783
- }
784
- if (shouldDisplaySecondsPicker(this) && SecondsColumn.getSelectedOptionValue(this)) {
785
- scrollToOption(
786
- this,
787
- "seconds",
788
- SecondsColumn.getSelectedOptionValue(this),
789
- "start"
790
- );
791
- }
792
- if (shouldDisplay12hClock(this) && MeridiesColumn.getSelectedOptionValue(this)) {
793
- scrollToOption(
794
- this,
795
- "meridies",
796
- MeridiesColumn.getSelectedOptionValue(this),
797
- "start"
410
+ updateMirroredHelperText_fn = function() {
411
+ let helperText = this.helperText ?? "";
412
+ if (this._helperTextSlottedContent?.length) {
413
+ helperText = this._helperTextSlottedContent.map((node) => node.innerText).join(" ");
414
+ }
415
+ if (__privateGet(this, _helperTextMirrorEl)) {
416
+ __privateGet(this, _helperTextMirrorEl).textContent = helperText;
417
+ if (helperText) {
418
+ this.control.setAttribute(
419
+ "aria-describedby",
420
+ __privateGet(this, _helperTextMirrorEl).id
798
421
  );
422
+ } else {
423
+ this.control.removeAttribute("aria-describedby");
799
424
  }
800
425
  }
801
- focus(options) {
802
- const firstFocusableElement = this.shadowRoot.querySelector(
803
- ".picker"
804
- );
805
- firstFocusableElement.focus(options);
806
- }
807
- }
426
+ };
808
427
  __decorateClass([
809
- vividElement.observable
810
- ], InlineTimePicker.prototype, "value");
428
+ vividElement.attr({ attribute: "readonly", mode: "boolean" })
429
+ ], exports.TextField.prototype, "readOnly", 2);
811
430
  __decorateClass([
812
- vividElement.observable
813
- ], InlineTimePicker.prototype, "minutesStep");
431
+ vividElement.attr({ mode: "boolean" })
432
+ ], exports.TextField.prototype, "autofocus", 2);
814
433
  __decorateClass([
815
- vividElement.observable
816
- ], InlineTimePicker.prototype, "secondsStep");
434
+ vividElement.attr
435
+ ], exports.TextField.prototype, "placeholder", 2);
817
436
  __decorateClass([
818
- vividElement.observable
819
- ], InlineTimePicker.prototype, "clock");
437
+ vividElement.attr
438
+ ], exports.TextField.prototype, "type", 2);
439
+ __decorateClass([
440
+ vividElement.attr
441
+ ], exports.TextField.prototype, "list", 2);
442
+ __decorateClass([
443
+ vividElement.attr({ converter: vividElement.nullableNumberConverter })
444
+ ], exports.TextField.prototype, "maxlength", 2);
445
+ __decorateClass([
446
+ vividElement.attr({ converter: vividElement.nullableNumberConverter })
447
+ ], exports.TextField.prototype, "minlength", 2);
448
+ __decorateClass([
449
+ vividElement.attr
450
+ ], exports.TextField.prototype, "pattern", 2);
451
+ __decorateClass([
452
+ vividElement.attr({ converter: vividElement.nullableNumberConverter })
453
+ ], exports.TextField.prototype, "size", 2);
454
+ __decorateClass([
455
+ vividElement.attr({ mode: "boolean" })
456
+ ], exports.TextField.prototype, "spellcheck", 2);
457
+ __decorateClass([
458
+ vividElement.attr
459
+ ], exports.TextField.prototype, "appearance", 2);
460
+ __decorateClass([
461
+ vividElement.attr
462
+ ], exports.TextField.prototype, "shape", 2);
463
+ __decorateClass([
464
+ vividElement.attr
465
+ ], exports.TextField.prototype, "autoComplete", 2);
466
+ __decorateClass([
467
+ vividElement.attr()
468
+ ], exports.TextField.prototype, "scale", 2);
469
+ __decorateClass([
470
+ vividElement.attr({ attribute: "inputmode" })
471
+ ], exports.TextField.prototype, "inputMode", 2);
820
472
  __decorateClass([
821
473
  vividElement.observable
822
- ], InlineTimePicker.prototype, "min");
474
+ ], exports.TextField.prototype, "actionItemsSlottedContent", 2);
823
475
  __decorateClass([
824
476
  vividElement.observable
825
- ], InlineTimePicker.prototype, "max");
826
- applyMixinsWithObservables.applyMixinsWithObservables(InlineTimePicker, localized.Localized);
477
+ ], exports.TextField.prototype, "leadingActionItemsSlottedContent", 2);
478
+ exports.TextField = __decorateClass([
479
+ formElements.errorText,
480
+ formElements.formElements
481
+ ], exports.TextField);
482
+ applyMixinsWithObservables.applyMixinsWithObservables(
483
+ exports.TextField,
484
+ affix.AffixIcon,
485
+ formElements.FormElementCharCount,
486
+ formElements.FormElementHelperText,
487
+ formElements.FormElementSuccessText
488
+ );
827
489
 
828
- const TimePickerTemplate = (context) => {
829
- const popupTag = context.tagFor(definition.Popup);
830
- const textFieldTag = context.tagFor(textField.TextField);
831
- const buttonTag = context.tagFor(definition$1.Button);
832
- const inlineTimePickerTag = context.tagFor(InlineTimePicker);
833
- return vividElement.html`<div class="base" @keydown="${(x, { event }) => x._onBaseKeyDown(event)}">
834
- <${textFieldTag} id="text-field"
835
- ${ref.ref("_textFieldEl")}
836
- class="control"
837
- label="${(x) => x.label}"
838
- helper-text="${(x) => x.helperText}"
839
- error-text="${(x) => x.errorValidationMessage}"
840
- placeholder="${(x) => x._textFieldPlaceholder}"
841
- current-value="${(x) => x._presentationValue}"
842
- ?disabled="${(x) => x.disabled}"
843
- ?readonly="${(x) => x.readOnly}"
844
- @input="${(x, c) => x._onTextFieldInput(c.event)}"
845
- @change="${(x) => x._onTextFieldChange()}"
490
+ const getStateClasses = ({
491
+ errorValidationMessage,
492
+ disabled,
493
+ value,
494
+ readOnly,
495
+ placeholder,
496
+ appearance,
497
+ shape,
498
+ label,
499
+ successText,
500
+ actionItemsSlottedContent,
501
+ leadingActionItemsSlottedContent,
502
+ icon,
503
+ scale
504
+ }) => classNames.classNames(
505
+ ["error", Boolean(errorValidationMessage)],
506
+ ["disabled", disabled],
507
+ ["has-value", Boolean(value)],
508
+ ["readonly", readOnly],
509
+ ["placeholder", Boolean(placeholder)],
510
+ [`appearance-${appearance}`, Boolean(appearance)],
511
+ [`shape-${shape}`, Boolean(shape)],
512
+ ["no-label", !label],
513
+ ["has-icon", !!icon],
514
+ ["success", Boolean(successText)],
515
+ ["action-items", !!actionItemsSlottedContent?.length],
516
+ ["leading-action-items", !!leadingActionItemsSlottedContent?.length],
517
+ ["no-leading", !(leadingActionItemsSlottedContent?.length || icon)],
518
+ [`size-${scale}`, Boolean(scale)]
519
+ );
520
+ function renderCharCount() {
521
+ return vividElement.html`
522
+ <span class="char-count"
523
+ >${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span
846
524
  >
847
- <slot
848
- slot="${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}"
849
- name="helper-text"
850
- ${slotted.slotted("_helperTextSlottedContent")}
851
- ></slot>
852
- <${buttonTag}
853
- id="clock-button"
854
- ${ref.ref("_clockButtonEl")}
855
- slot="action-items"
856
- size="condensed"
857
- icon="clock-line"
858
- appearance="ghost"
859
- ?disabled="${(x) => x.disabled || x.readOnly}"
860
- aria-label="${(x) => x._clockButtonLabel}"
861
- @click="${(x) => x._onClockButtonClick()}"
862
- ></${buttonTag}>
863
- </${textFieldTag}>
864
- <${popupTag}
865
- ?open="${(x) => x._popupOpen}"
866
- :anchor="${(x) => x._textFieldEl}"
867
- placement="bottom-start"
868
- class="popup">
869
- <div class="dialog" role="dialog" ${ref.ref(
870
- "_dialogEl"
871
- )} aria-modal="true" aria-label="${(x) => x.locale.timePicker.chooseTimeLabel}">
872
- <${inlineTimePickerTag}
873
- id="inline-time-picker"
874
- ${ref.ref("_inlineTimePickerEl")}
875
- :value="${(x) => x.value || void 0}"
876
- :clock="${(x) => x._use12hClock ? "12h" : "24h"}"
877
- :min="${(x) => x.min || void 0}"
878
- :max="${(x) => x.max || void 0}"
879
- :minutesStep="${(x) => x.minutesStep ?? 1}"
880
- :secondsStep="${(x) => x.secondsStep ?? void 0}"
881
- @change="${(x, c) => x._onInlineTimePickerChange(c.event)}"
882
- @last-column-selected="${(x) => x._onInlineTimePickerLastColumnSelected()}"
883
- >
884
- </${inlineTimePickerTag}>
885
- <div class="footer">
886
- <${buttonTag}
887
- class="vwc-button"
888
- size="condensed"
889
- label="${(x) => x.locale.timePicker.clearLabel}"
890
- @click="${(x) => x._onClearClick()}"
891
- ></${buttonTag}>
892
- <${buttonTag}
893
- class="vwc-button"
894
- size="condensed"
895
- appearance="filled"
896
- label="${(x) => x.locale.timePicker.okLabel}"
897
- @click="${(x) => x._onOkClick()}"
898
- ></${buttonTag}>
525
+ `;
526
+ }
527
+ const TextfieldTemplate = (context) => {
528
+ const affixIconTemplate = affix.affixIconTemplateFactory(context);
529
+ return vividElement.html` <div class="base ${getStateClasses}">
530
+ ${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
531
+ <slot class="label" name="_label"></slot>
532
+ <div class="fieldset">
533
+ <div class="leading-items-wrapper">
534
+ <slot
535
+ name="leading-action-items"
536
+ ${slotted.slotted("leadingActionItemsSlottedContent")}
537
+ ></slot>
538
+ ${(x) => affixIconTemplate(x.icon)}
539
+ </div>
540
+
541
+ <div class="wrapper">
542
+ <slot class="control" name="_control"></slot>
543
+ </div>
544
+ <div class="action-items-wrapper">
545
+ <slot
546
+ name="action-items"
547
+ ${slotted.slotted("actionItemsSlottedContent")}
548
+ ></slot>
899
549
  </div>
900
550
  </div>
901
- </${popupTag}>
902
- </div>`;
551
+ ${formElements.getFeedbackTemplate(context)}
552
+ </div>
553
+ <slot name="_mirrored-helper-text"></slot>`;
903
554
  };
904
555
 
905
- const styles = ":host{display:inline-block}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none}.time-pickers .picker:hover{overflow-y:auto}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:156px;content:\"\"}.time-pickers .picker:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: -2px;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))}.time-pickers .option{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .option{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.time-pickers .option: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}.time-pickers .option: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}.time-pickers .option:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .option: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}.time-pickers .option: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}.time-pickers .option{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}";
906
-
907
- const inlineTimePickerDefinition = vividElement.defineVividComponent(
908
- "inline-time-picker",
909
- InlineTimePicker,
910
- InlineTimePickerTemplate,
911
- [],
912
- {
913
- styles,
914
- shadowOptions: {
915
- delegatesFocus: true
916
- }
917
- }
918
- );
919
-
920
- const timePickerDefinition = vividElement.defineVividComponent(
921
- "time-picker",
922
- exports.TimePicker,
923
- TimePickerTemplate,
924
- [
925
- definition$2.textFieldDefinition,
926
- definition.popupDefinition,
927
- definition$1.buttonDefinition,
928
- inlineTimePickerDefinition
929
- ],
556
+ const textFieldDefinition = vividElement.defineVividComponent(
557
+ "text-field",
558
+ exports.TextField,
559
+ TextfieldTemplate,
560
+ [definition.iconDefinition],
930
561
  {
931
- styles: styles$1,
562
+ styles: textField.styles,
932
563
  shadowOptions: {
933
564
  delegatesFocus: true
934
565
  }
935
566
  }
936
567
  );
937
- const registerTimePicker = vividElement.createRegisterFunction(timePickerDefinition);
568
+ const registerTextField = vividElement.createRegisterFunction(textFieldDefinition);
938
569
 
939
- exports.registerTimePicker = registerTimePicker;
940
- exports.timePickerDefinition = timePickerDefinition;
570
+ exports.registerTextField = registerTextField;
571
+ exports.textFieldDefinition = textFieldDefinition;