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