@vonage/vivid 3.51.0 → 3.53.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 (340) hide show
  1. package/README.md +1 -1
  2. package/accordion/index.cjs +1 -1
  3. package/accordion/index.js +1 -1
  4. package/accordion-item/index.cjs +1 -1
  5. package/accordion-item/index.js +1 -1
  6. package/alert/index.cjs +3 -3
  7. package/alert/index.js +3 -3
  8. package/appearance-ui/index.cjs +19 -11
  9. package/appearance-ui/index.js +19 -11
  10. package/audio-player/index.cjs +4 -3
  11. package/audio-player/index.js +4 -3
  12. package/avatar/index.cjs +1 -1
  13. package/avatar/index.js +1 -1
  14. package/badge/index.cjs +1 -1
  15. package/badge/index.js +1 -1
  16. package/banner/index.cjs +2 -2
  17. package/banner/index.js +2 -2
  18. package/breadcrumb-item/index.cjs +1 -1
  19. package/breadcrumb-item/index.js +1 -1
  20. package/button/index.cjs +2 -2
  21. package/button/index.js +2 -2
  22. package/card/index.cjs +2 -2
  23. package/card/index.js +2 -2
  24. package/checkbox/index.cjs +3 -2
  25. package/checkbox/index.js +3 -2
  26. package/combobox/index.cjs +5 -8
  27. package/combobox/index.js +5 -8
  28. package/custom-elements.json +2310 -769
  29. package/data-grid/index.cjs +1 -1
  30. package/data-grid/index.js +1 -1
  31. package/date-picker/index.cjs +7 -9
  32. package/date-picker/index.js +7 -9
  33. package/date-range-picker/index.cjs +7 -9
  34. package/date-range-picker/index.js +7 -9
  35. package/dial-pad/index.cjs +33 -0
  36. package/dial-pad/index.js +31 -0
  37. package/dialog/index.cjs +4 -4
  38. package/dialog/index.js +4 -4
  39. package/divider/index.cjs +1 -1
  40. package/divider/index.js +1 -1
  41. package/elevation/index.cjs +1 -1
  42. package/elevation/index.js +1 -1
  43. package/empty-state/index.cjs +2 -2
  44. package/empty-state/index.js +2 -2
  45. package/fab/index.cjs +2 -2
  46. package/fab/index.js +2 -2
  47. package/file-picker/index.cjs +4 -5
  48. package/file-picker/index.js +4 -5
  49. package/header/index.cjs +2 -2
  50. package/header/index.js +2 -2
  51. package/icon/index.cjs +1 -1
  52. package/icon/index.js +1 -1
  53. package/index.cjs +135 -123
  54. package/index.js +48 -46
  55. package/layout/index.cjs +1 -1
  56. package/layout/index.js +1 -1
  57. package/lib/avatar/definition.d.ts +1 -1
  58. package/lib/button/button.d.ts +1 -0
  59. package/lib/button/definition.d.ts +1 -1
  60. package/lib/calendar-event/definition.d.ts +1 -1
  61. package/lib/components.d.ts +3 -0
  62. package/lib/dial-pad/definition.d.ts +3 -0
  63. package/lib/dial-pad/dial-pad.d.ts +14 -0
  64. package/lib/dial-pad/dial-pad.template.d.ts +4 -0
  65. package/lib/dial-pad/locale.d.ts +18 -0
  66. package/lib/enums.d.ts +6 -0
  67. package/lib/layout/definition.d.ts +1 -1
  68. package/lib/menu-item/menu-item.d.ts +3 -0
  69. package/lib/range-slider/definition.d.ts +3 -0
  70. package/lib/range-slider/locale.d.ts +4 -0
  71. package/lib/range-slider/range-slider.d.ts +32 -0
  72. package/lib/range-slider/range-slider.form-associated.d.ts +10 -0
  73. package/lib/range-slider/range-slider.template.d.ts +4 -0
  74. package/lib/range-slider/utils/lerp.d.ts +2 -0
  75. package/lib/range-slider/utils/roundToStepValue.d.ts +1 -0
  76. package/lib/slider/slider.template.d.ts +1 -0
  77. package/lib/split-button/definition.d.ts +1 -1
  78. package/lib/text-anchor/definition.d.ts +1 -0
  79. package/lib/text-anchor/text-anchor.d.ts +5 -0
  80. package/lib/video-player/definition.d.ts +3 -0
  81. package/lib/video-player/locale.d.ts +1 -0
  82. package/lib/video-player/video-player.d.ts +17 -0
  83. package/lib/video-player/video-player.template.d.ts +4 -0
  84. package/listbox/index.cjs +25 -24
  85. package/listbox/index.js +25 -24
  86. package/locales/en-GB.cjs +34 -0
  87. package/locales/en-GB.js +34 -0
  88. package/locales/en-US.cjs +202 -0
  89. package/locales/en-US.js +202 -0
  90. package/locales/ja-JP.cjs +202 -1
  91. package/locales/ja-JP.js +202 -1
  92. package/locales/zh-CN.cjs +203 -0
  93. package/locales/zh-CN.js +203 -0
  94. package/menu/index.cjs +7 -7
  95. package/menu/index.js +7 -7
  96. package/menu-item/index.cjs +4 -4
  97. package/menu-item/index.js +4 -4
  98. package/nav/index.cjs +1 -1
  99. package/nav/index.js +1 -1
  100. package/nav-disclosure/index.cjs +2 -2
  101. package/nav-disclosure/index.js +2 -2
  102. package/nav-item/index.cjs +2 -2
  103. package/nav-item/index.js +2 -2
  104. package/note/index.cjs +2 -2
  105. package/note/index.js +2 -2
  106. package/number-field/index.cjs +5 -6
  107. package/number-field/index.js +5 -6
  108. package/option/index.cjs +2 -2
  109. package/option/index.js +2 -2
  110. package/package.json +34 -34
  111. package/pagination/index.cjs +3 -3
  112. package/pagination/index.js +3 -3
  113. package/popup/index.cjs +4 -4
  114. package/popup/index.js +4 -4
  115. package/progress/index.cjs +1 -1
  116. package/progress/index.js +1 -1
  117. package/progress-ring/index.cjs +1 -1
  118. package/progress-ring/index.js +1 -1
  119. package/radio/index.cjs +1 -1
  120. package/radio/index.js +1 -1
  121. package/radio-group/index.cjs +1 -1
  122. package/radio-group/index.js +1 -1
  123. package/range-slider/index.cjs +22 -0
  124. package/range-slider/index.js +20 -0
  125. package/select/index.cjs +7 -6
  126. package/select/index.js +7 -6
  127. package/selectable-box/index.cjs +5 -4
  128. package/selectable-box/index.js +5 -4
  129. package/shared/Reflector.cjs +5 -1
  130. package/shared/Reflector.js +5 -1
  131. package/shared/affix.cjs +11 -4
  132. package/shared/affix.js +12 -4
  133. package/shared/anchored.cjs +8 -2
  134. package/shared/anchored.js +8 -2
  135. package/shared/applyMixinsWithObservables.cjs +15 -0
  136. package/shared/applyMixinsWithObservables.js +13 -0
  137. package/shared/definition.cjs +9 -4
  138. package/shared/definition.js +9 -4
  139. package/shared/definition10.cjs +5 -5
  140. package/shared/definition10.js +5 -5
  141. package/shared/definition11.cjs +77 -49
  142. package/shared/definition11.js +78 -50
  143. package/shared/definition12.cjs +12 -14
  144. package/shared/definition12.js +12 -14
  145. package/shared/definition13.cjs +118 -75
  146. package/shared/definition13.js +118 -75
  147. package/shared/definition14.cjs +34 -33
  148. package/shared/definition14.js +34 -33
  149. package/shared/definition15.cjs +24 -12
  150. package/shared/definition15.js +24 -12
  151. package/shared/definition16.cjs +38 -43
  152. package/shared/definition16.js +38 -43
  153. package/shared/definition17.cjs +126 -66
  154. package/shared/definition17.js +127 -67
  155. package/shared/definition18.cjs +31 -15
  156. package/shared/definition18.js +31 -15
  157. package/shared/definition19.cjs +117 -81
  158. package/shared/definition19.js +117 -81
  159. package/shared/definition2.cjs +10 -5
  160. package/shared/definition2.js +10 -5
  161. package/shared/definition20.cjs +187 -227
  162. package/shared/definition20.js +183 -223
  163. package/shared/definition21.cjs +262 -69
  164. package/shared/definition21.js +261 -67
  165. package/shared/definition22.cjs +66 -61
  166. package/shared/definition22.js +64 -60
  167. package/shared/definition23.cjs +42 -77
  168. package/shared/definition23.js +41 -76
  169. package/shared/definition24.cjs +65 -2350
  170. package/shared/definition24.js +64 -2349
  171. package/shared/definition25.cjs +2402 -48
  172. package/shared/definition25.js +2401 -47
  173. package/shared/definition26.cjs +62 -28
  174. package/shared/definition26.js +61 -27
  175. package/shared/definition27.cjs +28 -54
  176. package/shared/definition27.js +27 -53
  177. package/shared/definition28.cjs +39 -819
  178. package/shared/definition28.js +38 -817
  179. package/shared/definition29.cjs +893 -54
  180. package/shared/definition29.js +893 -55
  181. package/shared/definition3.cjs +7 -10
  182. package/shared/definition3.js +7 -10
  183. package/shared/definition30.cjs +69 -85
  184. package/shared/definition30.js +68 -84
  185. package/shared/definition31.cjs +86 -23
  186. package/shared/definition31.js +86 -23
  187. package/shared/definition32.cjs +24 -14
  188. package/shared/definition32.js +23 -13
  189. package/shared/definition33.cjs +11 -53
  190. package/shared/definition33.js +10 -52
  191. package/shared/definition34.cjs +28 -500
  192. package/shared/definition34.js +28 -500
  193. package/shared/definition35.cjs +447 -194
  194. package/shared/definition35.js +447 -192
  195. package/shared/definition36.cjs +258 -188
  196. package/shared/definition36.js +255 -187
  197. package/shared/definition37.cjs +204 -78
  198. package/shared/definition37.js +203 -76
  199. package/shared/definition38.cjs +55 -51
  200. package/shared/definition38.js +52 -49
  201. package/shared/definition39.cjs +65 -423
  202. package/shared/definition39.js +64 -422
  203. package/shared/definition4.cjs +24 -12
  204. package/shared/definition4.js +24 -12
  205. package/shared/definition40.cjs +447 -35
  206. package/shared/definition40.js +444 -32
  207. package/shared/definition41.cjs +35 -678
  208. package/shared/definition41.js +34 -677
  209. package/shared/definition42.cjs +544 -99
  210. package/shared/definition42.js +543 -98
  211. package/shared/definition43.cjs +696 -77
  212. package/shared/definition43.js +695 -76
  213. package/shared/definition44.cjs +113 -563
  214. package/shared/definition44.js +112 -561
  215. package/shared/definition45.cjs +77 -117
  216. package/shared/definition45.js +75 -115
  217. package/shared/definition46.cjs +474 -86
  218. package/shared/definition46.js +474 -87
  219. package/shared/definition47.cjs +140 -23
  220. package/shared/definition47.js +139 -22
  221. package/shared/definition48.cjs +132 -57
  222. package/shared/definition48.js +131 -56
  223. package/shared/definition49.cjs +18 -524
  224. package/shared/definition49.js +17 -523
  225. package/shared/definition5.cjs +20 -17
  226. package/shared/definition5.js +20 -17
  227. package/shared/definition50.cjs +73 -25
  228. package/shared/definition50.js +72 -24
  229. package/shared/definition51.cjs +506 -99
  230. package/shared/definition51.js +505 -99
  231. package/shared/definition52.cjs +29 -277
  232. package/shared/definition52.js +28 -276
  233. package/shared/definition53.cjs +97 -256
  234. package/shared/definition53.js +97 -255
  235. package/shared/definition54.cjs +287 -769
  236. package/shared/definition54.js +287 -769
  237. package/shared/definition55.cjs +305 -105
  238. package/shared/definition55.js +304 -104
  239. package/shared/definition56.cjs +841 -81
  240. package/shared/definition56.js +840 -80
  241. package/shared/definition57.cjs +153 -69
  242. package/shared/definition57.js +152 -68
  243. package/shared/definition58.cjs +138 -299
  244. package/shared/definition58.js +137 -298
  245. package/shared/definition59.cjs +72 -27
  246. package/shared/definition59.js +71 -26
  247. package/shared/definition6.cjs +4 -5
  248. package/shared/definition6.js +4 -5
  249. package/shared/definition60.cjs +279 -1780
  250. package/shared/definition60.js +278 -1779
  251. package/shared/definition61.cjs +65870 -11
  252. package/shared/definition61.js +65869 -11
  253. package/shared/definition62.cjs +50 -0
  254. package/shared/definition62.js +46 -0
  255. package/shared/definition63.cjs +1828 -0
  256. package/shared/definition63.js +1824 -0
  257. package/shared/definition7.cjs +8 -6
  258. package/shared/definition7.js +8 -6
  259. package/shared/definition8.cjs +27 -20
  260. package/shared/definition8.js +27 -20
  261. package/shared/definition9.cjs +7 -10
  262. package/shared/definition9.js +7 -10
  263. package/shared/enums.cjs +8 -0
  264. package/shared/enums.js +8 -1
  265. package/shared/icon.cjs +7 -2
  266. package/shared/icon.js +7 -2
  267. package/shared/index2.cjs +67 -38
  268. package/shared/index2.js +67 -38
  269. package/shared/key-codes2.cjs +8 -0
  270. package/shared/key-codes2.js +5 -1
  271. package/shared/listbox.cjs +1 -1
  272. package/shared/listbox.js +1 -1
  273. package/shared/localization/Locale.d.ts +6 -0
  274. package/shared/patterns/form-elements/form-elements.d.ts +2 -3
  275. package/shared/patterns/index.d.ts +0 -1
  276. package/shared/presentationDate.cjs +140 -81
  277. package/shared/presentationDate.js +140 -81
  278. package/shared/slider.template.cjs +71 -0
  279. package/shared/slider.template.js +67 -0
  280. package/shared/text-anchor.cjs +6 -0
  281. package/shared/text-anchor.js +6 -0
  282. package/shared/text-anchor.template.cjs +33 -33
  283. package/shared/text-anchor.template.js +33 -33
  284. package/shared/text-field.cjs +1 -1
  285. package/shared/text-field.js +1 -1
  286. package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
  287. package/side-drawer/index.cjs +1 -1
  288. package/side-drawer/index.js +1 -1
  289. package/slider/index.cjs +2 -1
  290. package/slider/index.js +2 -1
  291. package/split-button/index.cjs +2 -2
  292. package/split-button/index.js +2 -2
  293. package/style.css +1 -0
  294. package/styles/core/all.css +1 -1
  295. package/styles/core/theme.css +1 -1
  296. package/styles/core/typography.css +1 -1
  297. package/styles/fonts/spezia-variable.css +39 -13
  298. package/styles/tokens/theme-dark.css +4 -4
  299. package/styles/tokens/theme-light.css +4 -4
  300. package/styles/tokens/vivid-2-compat.css +4 -2
  301. package/switch/index.cjs +2 -2
  302. package/switch/index.js +2 -2
  303. package/tab/index.cjs +2 -2
  304. package/tab/index.js +2 -2
  305. package/tab-panel/index.cjs +1 -1
  306. package/tab-panel/index.js +1 -1
  307. package/tabs/index.cjs +4 -4
  308. package/tabs/index.js +4 -4
  309. package/tag/index.cjs +2 -2
  310. package/tag/index.js +2 -2
  311. package/tag-group/index.cjs +1 -1
  312. package/tag-group/index.js +1 -1
  313. package/text-area/index.cjs +4 -3
  314. package/text-area/index.js +4 -3
  315. package/text-field/index.cjs +4 -6
  316. package/text-field/index.js +4 -6
  317. package/time-picker/index.cjs +8 -10
  318. package/time-picker/index.js +8 -10
  319. package/toggletip/index.cjs +5 -5
  320. package/toggletip/index.js +5 -5
  321. package/tooltip/index.cjs +5 -5
  322. package/tooltip/index.js +5 -5
  323. package/tree-item/index.cjs +2 -2
  324. package/tree-item/index.js +2 -2
  325. package/tree-view/index.cjs +1 -1
  326. package/tree-view/index.js +1 -1
  327. package/video-player/index.cjs +17 -0
  328. package/video-player/index.js +15 -0
  329. package/vivid.api.json +428 -1
  330. package/focus/index.cjs +0 -7
  331. package/focus/index.js +0 -5
  332. package/lib/focus/definition.d.ts +0 -3
  333. package/lib/focus/focus.d.ts +0 -3
  334. package/lib/focus/focus.template.d.ts +0 -4
  335. package/lib/popup/popup.d.ts +0 -21
  336. package/shared/focus.cjs +0 -8
  337. package/shared/focus.js +0 -6
  338. package/shared/focus2.cjs +0 -11
  339. package/shared/focus2.js +0 -9
  340. package/shared/patterns/focus.d.ts +0 -3
@@ -1,217 +1,196 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition$1 = require('./definition53.cjs');
5
- const definition = require('./definition60.cjs');
6
- const definition$2 = require('./definition11.cjs');
4
+ const definition = require('./definition27.cjs');
7
5
  require('./affix.cjs');
8
6
  const index$1 = require('./index2.cjs');
9
- const localized = require('./localized.cjs');
10
- const trappedFocus = require('./trapped-focus.cjs');
11
- const formAssociated = require('./form-associated.cjs');
7
+ const Reflector = require('./Reflector.cjs');
8
+ const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
9
+ const textField = require('./text-field2.cjs');
12
10
  const applyMixins = require('./apply-mixins.cjs');
13
- const ref = require('./ref.cjs');
11
+ const formAssociated = require('./form-associated.cjs');
14
12
  const when = require('./when.cjs');
15
- const repeat = require('./repeat.cjs');
13
+ const ref = require('./ref.cjs');
16
14
  const classNames = require('./class-names.cjs');
17
15
 
18
- const styles = ":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;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;flex-direction:column;padding:0;margin:0;border-radius:4px;gap:4px;inline-size:50px;list-style:none;overflow-x:hidden;overflow-y:hidden;scrollbar-width:thin}.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{display:flex;flex-shrink:0;align-items:center;justify-content:center;background-color:var(--_appearance-color-fill);block-size:28px;border-radius:4px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}.time-pickers .item{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, 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-primary);--_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-primary);--_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-primary);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected,[aria-current]):where(:not(:disabled,.disabled)){--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected,[aria-current]):where(:hover,.hover):where(:not(:disabled,.disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-pale);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected,[aria-current]):where(:disabled,.disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}\n";
19
-
20
- class _TimePicker extends index.FoundationElement {
16
+ class _TextArea extends index.FoundationElement {
21
17
  }
22
- class FormAssociatedTimePicker extends formAssociated.FormAssociated(_TimePicker) {
23
- constructor() {
24
- super(...arguments);
25
- this.proxy = document.createElement("input");
26
- }
18
+ /**
19
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(TextArea:class)} component.
20
+ *
21
+ * @internal
22
+ */
23
+ class FormAssociatedTextArea extends formAssociated.FormAssociated(_TextArea) {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.proxy = document.createElement("textarea");
27
+ }
27
28
  }
28
29
 
29
- const isValidTimeStr = (timeStr) => {
30
- const parts = timeStr.split(":");
31
- if (parts.length !== 3) {
32
- return false;
33
- }
34
- const [hours, minutes, seconds] = parts;
35
- if (hours.length !== 2 || minutes.length !== 2 || seconds.length !== 2) {
36
- return false;
37
- }
38
- const hoursNum = parseInt(hours, 10);
39
- const minutesNum = parseInt(minutes, 10);
40
- const secondsNum = parseInt(seconds, 10);
41
- if (isNaN(hoursNum) || isNaN(minutesNum) || isNaN(secondsNum)) {
42
- return false;
43
- }
44
- if (hoursNum < 0 || hoursNum > 23) {
45
- return false;
46
- }
47
- if (minutesNum < 0 || minutesNum > 59) {
48
- return false;
49
- }
50
- if (secondsNum < 0 || secondsNum > 59) {
51
- return false;
52
- }
53
- return true;
54
- };
55
- const parseTimePart = (partStr) => Number.parseInt(partStr, 10);
56
- const formatTimePart = (part) => part.toString().padStart(2, "0");
57
- const parseTimeStr = (timeStr) => {
58
- const [hoursStr, minutesStr, secondsStr] = timeStr.split(":");
59
- const hours = parseTimePart(hoursStr);
60
- const minutes = parseTimePart(minutesStr);
61
- const seconds = parseTimePart(secondsStr);
62
- return {
63
- hourStr: hoursStr,
64
- hours,
65
- minuteStr: minutesStr,
66
- minutes,
67
- secondStr: secondsStr,
68
- seconds,
69
- meridiem: hours < 12 ? "AM" : "PM"
70
- };
30
+ /**
31
+ * Resize mode for a TextArea
32
+ * @public
33
+ */
34
+ const TextAreaResize = {
35
+ /**
36
+ * No resize.
37
+ */
38
+ none: "none",
39
+ /**
40
+ * Resize vertically and horizontally.
41
+ */
42
+ both: "both",
43
+ /**
44
+ * Resize horizontally.
45
+ */
46
+ horizontal: "horizontal",
47
+ /**
48
+ * Resize vertically.
49
+ */
50
+ vertical: "vertical",
71
51
  };
72
- const hoursAs12hClock = (hour) => hour % 12 || 12;
73
52
 
74
- const formatPresentationTime = (timeStr, includeSeconds, use12HourClock) => {
75
- const time = parseTimeStr(timeStr);
76
- const hoursStr = formatTimePart(use12HourClock ? hoursAs12hClock(time.hours) : time.hours);
77
- let result = `${hoursStr}:${time.minuteStr}`;
78
- if (includeSeconds) {
79
- result += `:${time.secondStr}`;
80
- }
81
- if (use12HourClock) {
82
- result += ` ${time.meridiem}`;
83
- }
84
- return result;
85
- };
86
- const isDigit = (char) => char >= "0" && char <= "9";
87
- const parsePresentationTime = (input, use12HourClock) => {
88
- const cleanedInput = input.toLowerCase();
89
- const numerals = [];
90
- let meridiem;
91
- for (let i = 0; i < cleanedInput.length; i++) {
92
- const char = cleanedInput[i];
93
- if (char === "a" && cleanedInput[i + 1] === "m") {
94
- i++;
95
- meridiem = "AM";
96
- }
97
- if (char === "p" && cleanedInput[i + 1] === "m") {
98
- i++;
99
- meridiem = "PM";
100
- }
101
- if (isDigit(char)) {
102
- let numeral = char;
103
- while (isDigit(cleanedInput[i + 1])) {
104
- i++;
105
- numeral += cleanedInput[i];
106
- }
107
- numerals.push(Number.parseInt(numeral, 10));
53
+ /**
54
+ * A Text Area Custom HTML Element.
55
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea | <textarea> element }.
56
+ *
57
+ * @slot - The default slot for the label
58
+ * @csspart label - The label
59
+ * @csspart root - The element wrapping the control
60
+ * @csspart control - The textarea element
61
+ * @fires change - Emits a custom 'change' event when the textarea emits a change event
62
+ *
63
+ * @public
64
+ */
65
+ let TextArea$1 = class TextArea extends FormAssociatedTextArea {
66
+ constructor() {
67
+ super(...arguments);
68
+ /**
69
+ * The resize mode of the element.
70
+ * @public
71
+ * @remarks
72
+ * HTML Attribute: resize
73
+ */
74
+ this.resize = TextAreaResize.none;
75
+ /**
76
+ * Sizes the element horizontally by a number of character columns.
77
+ *
78
+ * @public
79
+ * @remarks
80
+ * HTML Attribute: cols
81
+ */
82
+ this.cols = 20;
83
+ /**
84
+ * @internal
85
+ */
86
+ this.handleTextInput = () => {
87
+ this.value = this.control.value;
88
+ };
89
+ }
90
+ readOnlyChanged() {
91
+ if (this.proxy instanceof HTMLTextAreaElement) {
92
+ this.proxy.readOnly = this.readOnly;
93
+ }
108
94
  }
109
- }
110
- if (numerals.length === 0 || numerals.length > 3) {
111
- throw new Error("Invalid time format");
112
- }
113
- if (meridiem && (numerals[0] < 1 || numerals[0] > 12)) {
114
- throw new Error("Invalid time format");
115
- }
116
- if (meridiem || use12HourClock) {
117
- if (numerals[0] === 12) {
118
- numerals[0] = 0;
95
+ autofocusChanged() {
96
+ if (this.proxy instanceof HTMLTextAreaElement) {
97
+ this.proxy.autofocus = this.autofocus;
98
+ }
119
99
  }
120
- }
121
- if (meridiem === "PM") {
122
- numerals[0] = numerals[0] + 12;
123
- }
124
- const [hours, minutes = 0, seconds = 0] = numerals;
125
- if (hours > 23 || minutes > 59 || seconds > 59) {
126
- throw new Error("Invalid value");
127
- }
128
- return [hours, minutes, seconds].map(formatTimePart).join(":");
129
- };
130
-
131
- const fallsIntoMeridiem = (meridiem, hour) => meridiem === "AM" && hour < 12 || meridiem === "PM" && hour >= 12;
132
- const getHoursOptions = (min, max, forMeridiem) => {
133
- const result = [];
134
- const minHour = min ? parseTimeStr(min).hours : 0;
135
- const maxHour = max ? parseTimeStr(max).hours : 23;
136
- for (let i = minHour; i <= maxHour; i++) {
137
- if (forMeridiem && !fallsIntoMeridiem(forMeridiem, i)) {
138
- continue;
100
+ listChanged() {
101
+ if (this.proxy instanceof HTMLTextAreaElement) {
102
+ this.proxy.setAttribute("list", this.list);
103
+ }
139
104
  }
140
- result.push({
141
- value: formatTimePart(i),
142
- label: formatTimePart(forMeridiem ? hoursAs12hClock(i) : i)
143
- });
144
- }
145
- return result;
146
- };
147
- const getMinutesOptions = (step, value, min, max) => {
148
- const result = [];
149
- let minMinute = 0;
150
- let maxMinute = 59;
151
- if (min) {
152
- const { hourStr: minHourStr, minutes: minMinutes } = parseTimeStr(min);
153
- if (value && parseTimeStr(value).hourStr === minHourStr) {
154
- minMinute = minMinutes;
105
+ maxlengthChanged() {
106
+ if (this.proxy instanceof HTMLTextAreaElement) {
107
+ this.proxy.maxLength = this.maxlength;
108
+ }
155
109
  }
156
- }
157
- if (max) {
158
- const { hourStr: maxHourStr, minutes: maxMinutes } = parseTimeStr(max);
159
- if (value && parseTimeStr(value).hourStr === maxHourStr) {
160
- maxMinute = maxMinutes;
110
+ minlengthChanged() {
111
+ if (this.proxy instanceof HTMLTextAreaElement) {
112
+ this.proxy.minLength = this.minlength;
113
+ }
161
114
  }
162
- }
163
- for (let i = minMinute; i <= maxMinute; i += Math.max(1, step ?? 1)) {
164
- const minutes = formatTimePart(i);
165
- result.push({
166
- value: minutes,
167
- label: minutes
168
- });
169
- }
170
- return result;
171
- };
172
- const getSecondsOptions = (step, value, min, max) => {
173
- const result = [];
174
- let minSecond = 0;
175
- let maxSecond = 59;
176
- if (min) {
177
- const minTime = parseTimeStr(min);
178
- if (value && (parseTimeStr(value).hourStr === minTime.hourStr && parseTimeStr(value).minuteStr) === minTime.minuteStr) {
179
- minSecond = minTime.seconds;
115
+ spellcheckChanged() {
116
+ if (this.proxy instanceof HTMLTextAreaElement) {
117
+ this.proxy.spellcheck = this.spellcheck;
118
+ }
180
119
  }
181
- }
182
- if (max) {
183
- const maxTime = parseTimeStr(max);
184
- if (value && (parseTimeStr(value).hourStr === maxTime.hourStr && parseTimeStr(value).minuteStr) === maxTime.minuteStr) {
185
- maxSecond = maxTime.seconds;
120
+ /**
121
+ * Selects all the text in the text area
122
+ *
123
+ * @public
124
+ */
125
+ select() {
126
+ this.control.select();
127
+ /**
128
+ * The select event does not permeate the shadow DOM boundary.
129
+ * This fn effectively proxies the select event,
130
+ * emitting a `select` event whenever the internal
131
+ * control emits a `select` event
132
+ */
133
+ this.$emit("select");
134
+ }
135
+ /**
136
+ * Change event handler for inner control.
137
+ * @remarks
138
+ * "Change" events are not `composable` so they will not
139
+ * permeate the shadow DOM boundary. This fn effectively proxies
140
+ * the change event, emitting a `change` event whenever the internal
141
+ * control emits a `change` event
142
+ * @internal
143
+ */
144
+ handleChange() {
145
+ this.$emit("change");
146
+ }
147
+ /** {@inheritDoc (FormAssociated:interface).validate} */
148
+ validate() {
149
+ super.validate(this.control);
186
150
  }
187
- }
188
- for (let i = minSecond; i <= maxSecond; i += Math.max(1, step)) {
189
- const seconds = formatTimePart(i);
190
- result.push({
191
- value: seconds,
192
- label: seconds
193
- });
194
- }
195
- return result;
196
- };
197
- const getMeridiesOptions = (min, max) => {
198
- const result = [];
199
- const hideAM = min ? parseTimeStr(min).meridiem === "PM" : false;
200
- if (!hideAM) {
201
- result.push({
202
- value: "AM",
203
- label: "AM"
204
- });
205
- }
206
- const hidePM = max ? parseTimeStr(max).meridiem === "AM" : false;
207
- if (!hidePM) {
208
- result.push({
209
- value: "PM",
210
- label: "PM"
211
- });
212
- }
213
- return result;
214
151
  };
152
+ index.__decorate([
153
+ index.attr({ mode: "boolean" })
154
+ ], TextArea$1.prototype, "readOnly", void 0);
155
+ index.__decorate([
156
+ index.attr
157
+ ], TextArea$1.prototype, "resize", void 0);
158
+ index.__decorate([
159
+ index.attr({ mode: "boolean" })
160
+ ], TextArea$1.prototype, "autofocus", void 0);
161
+ index.__decorate([
162
+ index.attr({ attribute: "form" })
163
+ ], TextArea$1.prototype, "formId", void 0);
164
+ index.__decorate([
165
+ index.attr
166
+ ], TextArea$1.prototype, "list", void 0);
167
+ index.__decorate([
168
+ index.attr({ converter: index.nullableNumberConverter })
169
+ ], TextArea$1.prototype, "maxlength", void 0);
170
+ index.__decorate([
171
+ index.attr({ converter: index.nullableNumberConverter })
172
+ ], TextArea$1.prototype, "minlength", void 0);
173
+ index.__decorate([
174
+ index.attr
175
+ ], TextArea$1.prototype, "name", void 0);
176
+ index.__decorate([
177
+ index.attr
178
+ ], TextArea$1.prototype, "placeholder", void 0);
179
+ index.__decorate([
180
+ index.attr({ converter: index.nullableNumberConverter, mode: "fromView" })
181
+ ], TextArea$1.prototype, "cols", void 0);
182
+ index.__decorate([
183
+ index.attr({ converter: index.nullableNumberConverter, mode: "fromView" })
184
+ ], TextArea$1.prototype, "rows", void 0);
185
+ index.__decorate([
186
+ index.attr({ mode: "boolean" })
187
+ ], TextArea$1.prototype, "spellcheck", void 0);
188
+ index.__decorate([
189
+ index.observable
190
+ ], TextArea$1.prototype, "defaultSlottedNodes", void 0);
191
+ applyMixins.applyMixins(TextArea$1, textField.DelegatesARIATextbox);
192
+
193
+ const styles = ":host{display:inline-block}.base{display:inline-grid;grid-template-columns:1fr max-content;inline-size:100%;row-gap:4px}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base.connotation-success{--_connotation-color-primary: var(--vvd-text-area-success-primary, var(--vvd-color-success-500));--_connotation-color-primary-text: var(--vvd-text-area-success-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-area-success-primary-increment, var(--vvd-color-success-600));--_connotation-color-intermediate: var(--vvd-text-area-success-intermediate, var(--vvd-color-success-500));--_connotation-color-firm: var(--vvd-text-area-success-firm, var(--vvd-color-success-600));--_connotation-color-fierce: var(--vvd-text-area-success-fierce, var(--vvd-color-success-700));--_connotation-color-faint: var(--vvd-text-area-success-faint, var(--vvd-color-success-50));--_connotation-color-soft: var(--vvd-text-area-success-soft, var(--vvd-color-success-100))}.base.connotation-alert{--_connotation-color-primary: var(--vvd-text-area-alert-primary, var(--vvd-color-alert-500));--_connotation-color-primary-text: var(--vvd-text-area-alert-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-area-alert-primary-increment, var(--vvd-color-alert-600));--_connotation-color-intermediate: var(--vvd-text-area-alert-intermediate, var(--vvd-color-alert-500));--_connotation-color-firm: var(--vvd-text-area-alert-firm, var(--vvd-color-alert-600));--_connotation-color-fierce: var(--vvd-text-area-alert-fierce, var(--vvd-color-alert-700));--_connotation-color-faint: var(--vvd-text-area-alert-faint, var(--vvd-color-alert-50));--_connotation-color-soft: var(--vvd-text-area-alert-soft, var(--vvd-color-alert-100))}.base:not(.connotation-success,.connotation-alert){--_connotation-color-primary: var(--vvd-text-area-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-text-area-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-area-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-text-area-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-text-area-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-text-area-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-text-area-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-text-area-accent-soft, var(--vvd-color-neutral-100))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){--_low-ink-color: var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color: var(--_appearance-color-text);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base);grid-column:1/2;grid-row:1;line-height:20px}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base);grid-column:2/-1}.control{padding:8px 16px;border:0 none;border-radius:8px;appearance:none;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);grid-column:1/-1;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));resize:none;transition:box-shadow .2s,background-color .2s,color .2s}@supports selector(::-webkit-resizer){.control::-webkit-resizer{background-image:linear-gradient(315deg,transparent 0,transparent 2px,var(--vvd-color-canvas-text) 2px,var(--vvd-color-canvas-text) 3px,transparent 3px,transparent 5px,var(--vvd-color-canvas-text) 5px,var(--vvd-color-canvas-text) 6px,transparent 6px,transparent 8px,transparent 100%);background-repeat:no-repeat;background-size:10px 10px;block-size:10px;inline-size:10px}}.control:disabled{opacity:1;pointer-events:none;-webkit-text-fill-color:var(--_appearance-color-text)}.control::placeholder,.control:disabled::placeholder{opacity:1;pointer-events:none;-webkit-text-fill-color:var(--_low-ink-color)}.control:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}:host([resize=both]) .control{resize:both}:host([resize=horizontal]) .control{resize:horizontal}:host([resize=vertical]) .control{resize:vertical}\n";
215
194
 
216
195
  var __defProp = Object.defineProperty;
217
196
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -224,601 +203,140 @@ var __decorateClass = (decorators, target, key, kind) => {
224
203
  __defProp(target, key, result);
225
204
  return result;
226
205
  };
227
- const ValidTimeFilter = {
228
- fromView: (value) => {
229
- if (value && isValidTimeStr(value)) {
230
- return value;
231
- }
232
- return "";
233
- },
234
- toView(value) {
235
- return value;
236
- }
206
+ var __accessCheck = (obj, member, msg) => {
207
+ if (!member.has(obj))
208
+ throw TypeError("Cannot " + msg);
209
+ };
210
+ var __privateGet = (obj, member, getter) => {
211
+ __accessCheck(obj, member, "read from private field");
212
+ return getter ? getter.call(obj) : member.get(obj);
213
+ };
214
+ var __privateAdd = (obj, member, value) => {
215
+ if (member.has(obj))
216
+ throw TypeError("Cannot add the same private member more than once");
217
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
237
218
  };
238
- let TimePicker = class extends FormAssociatedTimePicker {
219
+ var __privateSet = (obj, member, value, setter) => {
220
+ __accessCheck(obj, member, "write to private field");
221
+ setter ? setter.call(obj, value) : member.set(obj, value);
222
+ return value;
223
+ };
224
+ var _reflectToTextArea;
225
+ let TextArea = class extends TextArea$1 {
239
226
  constructor() {
240
- super();
241
- this.readOnly = false;
242
- this.minutesStep = null;
243
- this.secondsStep = null;
244
- this.#getFocusableEls = () => this.shadowRoot.querySelectorAll(`
245
- .dialog [tabindex="0"],
246
- .dialog .vwc-button:not(:disabled)
247
- `);
248
- this.#onFocusIn = () => {
249
- this.$emit("focus", void 0, { bubbles: false });
250
- };
251
- this.#onFocusOut = () => {
252
- this.$emit("blur", void 0, { bubbles: false });
253
- };
254
- this._popupOpen = false;
255
- this.#dismissOnClickOutside = (event) => {
256
- if (!this._popupOpen) {
257
- return;
258
- }
259
- const path = event.composedPath();
260
- const elementsToIgnoreClicksOn = [this._dialogEl, this._clockButtonEl];
261
- if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
262
- this._closePopup(false);
263
- }
264
- };
265
- this._presentationValue = "";
266
- this.value = "";
267
- this.min = "";
268
- this.max = "";
269
- this.proxy.type = "time";
270
- this.proxy.step = "1";
271
- }
272
- /**
273
- * @internal
274
- */
275
- readOnlyChanged() {
276
- if (this.proxy instanceof HTMLInputElement) {
277
- this.proxy.readOnly = this.readOnly;
278
- this.validate();
279
- }
280
- }
281
- /**
282
- * @internal
283
- */
284
- minChanged(_, newMin) {
285
- if (this.proxy instanceof HTMLInputElement) {
286
- this.proxy.min = newMin;
287
- this.validate();
288
- }
289
- }
290
- /**
291
- * @internal
292
- */
293
- maxChanged(_, newMax) {
294
- if (this.proxy instanceof HTMLInputElement) {
295
- this.proxy.max = newMax;
296
- this.validate();
297
- }
298
- }
299
- // --- Core ---
300
- /**
301
- * @internal
302
- */
303
- get _displaySeconds() {
304
- return this.secondsStep !== null;
305
- }
306
- /**
307
- * @internal
308
- */
309
- get _use12hClock() {
310
- return this.clock ? this.clock === "12h" : this.locale.timePicker.defaultTo12HourClock;
311
- }
312
- #getFocusableEls;
313
- /**
314
- * @internal
315
- */
316
- valueChanged(previous, next) {
317
- super.valueChanged(previous, next);
318
- if (this.value) {
319
- if (!isValidTimeStr(this.value)) {
320
- this.value = "";
321
- return;
322
- }
323
- this._presentationValue = formatPresentationTime(
324
- this.value,
325
- this._displaySeconds,
326
- this._use12hClock
327
- );
328
- } else {
329
- this._presentationValue = "";
330
- }
331
- }
332
- #updateValueDueToUserInteraction(newValue) {
333
- this.value = newValue;
334
- this.$emit("change");
335
- this.$emit("input");
227
+ super(...arguments);
228
+ __privateAdd(this, _reflectToTextArea, void 0);
336
229
  }
337
230
  connectedCallback() {
338
231
  super.connectedCallback();
339
- document.addEventListener("click", this.#dismissOnClickOutside);
340
- this.addEventListener("focusin", this.#onFocusIn);
341
- this.addEventListener("focusout", this.#onFocusOut);
232
+ __privateSet(this, _reflectToTextArea, new Reflector.Reflector(this, this.control));
233
+ __privateGet(this, _reflectToTextArea).property("value", "value", true);
342
234
  }
343
235
  disconnectedCallback() {
344
236
  super.disconnectedCallback();
345
- document.removeEventListener("click", this.#dismissOnClickOutside);
346
- this.removeEventListener("focusin", this.#onFocusIn);
347
- this.removeEventListener("focusout", this.#onFocusOut);
348
- }
349
- #onFocusIn;
350
- #onFocusOut;
351
- #dismissOnClickOutside;
352
- #openPopupIfPossible() {
353
- if (!this.readOnly) {
354
- this._popupOpen = true;
355
- }
356
- }
357
- /**
358
- * @internal
359
- */
360
- _closePopup(restoreFocusToTextField = true) {
361
- this._popupOpen = false;
362
- if (restoreFocusToTextField) {
363
- this._textFieldEl.focus();
364
- }
365
- }
366
- /**
367
- * On keydown anywhere in the time picker.
368
- * @internal
369
- */
370
- _onBaseKeyDown(event) {
371
- if (event.key === "Escape") {
372
- this._closePopup();
373
- return false;
374
- }
375
- if (this._trappedFocus(event, this.#getFocusableEls)) {
376
- return false;
377
- }
378
- return true;
379
- }
380
- /**
381
- * @internal
382
- */
383
- _presentationValueChanged() {
384
- this.dirtyValue = true;
385
- this.validate();
386
- }
387
- /**
388
- * @internal
389
- */
390
- get _textFieldPlaceholder() {
391
- let format = "hh:mm";
392
- if (this._displaySeconds) {
393
- format += ":ss";
394
- }
395
- if (this._use12hClock) {
396
- format += " aa";
397
- }
398
- return format;
399
- }
400
- /**
401
- * @internal
402
- */
403
- _onTextFieldInput(event) {
404
- const textField = event.currentTarget;
405
- this._presentationValue = textField.value;
406
- }
407
- /**
408
- * @internal
409
- */
410
- _onTextFieldChange() {
411
- if (this._presentationValue === "") {
412
- this.#updateValueDueToUserInteraction("");
413
- return;
414
- }
415
- try {
416
- this.#updateValueDueToUserInteraction(
417
- parsePresentationTime(this._presentationValue, this._use12hClock)
418
- );
419
- } catch (_) {
420
- return;
421
- }
422
- }
423
- // --- Clock button ---
424
- /**
425
- * @internal
426
- */
427
- get _clockButtonLabel() {
428
- if (this.value) {
429
- return this.locale.timePicker.changeTimeLabel(formatPresentationTime(this.value, this._displaySeconds, this._use12hClock));
430
- }
431
- return this.locale.timePicker.chooseTimeLabel;
432
- }
433
- /**
434
- * @internal
435
- */
436
- _onClockButtonClick() {
437
- if (this._popupOpen) {
438
- this._closePopup();
439
- } else {
440
- this.#openPopupIfPossible();
441
- index.DOM.processUpdates();
442
- if (this._selectedHour) {
443
- this.#scrollToItem("hours", this._selectedHour, "start");
444
- }
445
- if (this._selectedMinute) {
446
- this.#scrollToItem("minutes", this._selectedMinute, "start");
447
- }
448
- if (this._displaySeconds && this._selectedSecond) {
449
- this.#scrollToItem("seconds", this._selectedSecond, "start");
450
- }
451
- if (this._use12hClock && this._selectedMeridiem) {
452
- this.#scrollToItem("meridies", this._selectedMeridiem, "start");
453
- }
454
- this.#getFocusableEls()[0].focus();
455
- }
456
- }
457
- // --- Pickers ---
458
- /**
459
- * @internal
460
- */
461
- get _hours() {
462
- return getHoursOptions(this.min, this.max, this._use12hClock ? this._selectedMeridiem ?? this._meridies[0].value : void 0);
463
- }
464
- /**
465
- * @internal
466
- */
467
- get _selectedHour() {
468
- return this.value ? parseTimeStr(this.value).hourStr : void 0;
469
- }
470
- /**
471
- * @internal
472
- */
473
- set _selectedHour(value) {
474
- if (this.value) {
475
- const { minuteStr, secondStr } = parseTimeStr(this.value);
476
- this.value = `${value}:${minuteStr}:${secondStr}`;
477
- } else {
478
- this.value = `${value}:00:00`;
479
- }
480
- }
481
- /**
482
- * @internal
483
- */
484
- get _minutes() {
485
- return getMinutesOptions(this.minutesStep, this.value, this.min, this.max);
486
- }
487
- /**
488
- * @internal
489
- */
490
- get _selectedMinute() {
491
- return this.value ? parseTimeStr(this.value).minuteStr : void 0;
492
- }
493
- /**
494
- * @internal
495
- */
496
- set _selectedMinute(value) {
497
- if (this.value) {
498
- const { hourStr, secondStr } = parseTimeStr(this.value);
499
- this.value = `${hourStr}:${value}:${secondStr}`;
500
- } else {
501
- this.value = `00:${value}:00`;
502
- }
503
- }
504
- /**
505
- * @internal
506
- */
507
- get _seconds() {
508
- return getSecondsOptions(this.secondsStep, this.value, this.min, this.max);
509
- }
510
- /**
511
- * @internal
512
- */
513
- get _selectedSecond() {
514
- return this.value ? parseTimeStr(this.value).secondStr : void 0;
515
- }
516
- /**
517
- * @internal
518
- */
519
- set _selectedSecond(value) {
520
- if (this.value) {
521
- const { hourStr, minuteStr } = parseTimeStr(this.value);
522
- this.value = `${hourStr}:${minuteStr}:${value}`;
523
- } else {
524
- this.value = `00:00:${value}`;
525
- }
526
- }
527
- /**
528
- * @internal
529
- */
530
- get _meridies() {
531
- return getMeridiesOptions(this.min, this.max);
532
- }
533
- /**
534
- * @internal
535
- */
536
- get _selectedMeridiem() {
537
- return this.value ? parseTimeStr(this.value).meridiem : void 0;
538
- }
539
- /**
540
- * @internal
541
- */
542
- set _selectedMeridiem(value) {
543
- if (this.value) {
544
- const { hours, minuteStr, secondStr } = parseTimeStr(this.value);
545
- let adjustedHours = hours;
546
- if (value === "AM" && hours >= 12) {
547
- adjustedHours -= 12;
548
- } else if (value === "PM" && hours < 12) {
549
- adjustedHours += 12;
550
- }
551
- this.value = `${formatTimePart(adjustedHours)}:${minuteStr}:${secondStr}`;
552
- } else {
553
- if (value === "AM") {
554
- this.value = "00:00:00";
555
- } else {
556
- this.value = "12:00:00";
557
- }
558
- }
559
- }
560
- /**
561
- * @internal
562
- */
563
- _onPickerKeyDown(picker, options, selectedValue, setSelectedValue, event) {
564
- const offset = {
565
- ArrowUp: -1,
566
- ArrowDown: 1
567
- }[event.key];
568
- if (offset) {
569
- event.preventDefault();
570
- const index = options.findIndex((h) => h.value === selectedValue);
571
- const newRawIndex = index === -1 ? 0 : index + offset;
572
- const newIndex = (newRawIndex + options.length) % options.length;
573
- const newValue = options[newIndex].value;
574
- setSelectedValue(newValue);
575
- this.#scrollToItem(picker, newValue, "nearest");
576
- this.#updateValueDueToUserInteraction(this.value);
577
- }
578
- return true;
579
- }
580
- #scrollToItem(picker, selectedValue, position) {
581
- const element = this.shadowRoot.querySelector(`#${picker}-${selectedValue}`);
582
- if (!element) {
583
- return;
584
- }
585
- const parent = element.parentElement;
586
- switch (position) {
587
- case "start":
588
- parent.scrollTop = element.offsetTop;
589
- break;
590
- case "nearest":
591
- if (element.offsetTop < parent.scrollTop) {
592
- parent.scrollTop = element.offsetTop;
593
- }
594
- if (element.offsetTop + element.offsetHeight > parent.scrollTop + parent.offsetHeight) {
595
- parent.scrollTop = element.offsetTop + element.offsetHeight - parent.offsetHeight;
596
- }
597
- break;
598
- }
599
- }
600
- /**
601
- * @internal
602
- */
603
- _onPickerItemClick(picker, setSelectedValue, value) {
604
- setSelectedValue(value);
605
- this.#scrollToItem(picker, value, "start");
606
- this.#updateValueDueToUserInteraction(this.value);
607
- const nextPickerEl = this.shadowRoot.querySelector(`#${picker} + .picker`);
608
- if (nextPickerEl) {
609
- nextPickerEl.focus();
610
- } else {
611
- this._closePopup();
612
- }
613
- }
614
- // --- Dialog footer ---
615
- /**
616
- * @internal
617
- */
618
- _onOkClick() {
619
- this._closePopup();
620
- }
621
- /**
622
- * @internal
623
- */
624
- _onClearClick() {
625
- this.#updateValueDueToUserInteraction("");
626
- this._closePopup();
627
- }
628
- // --- Validation ---
629
- /**
630
- * @internal
631
- */
632
- validate() {
633
- if (this.proxy) {
634
- this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
635
- }
636
- super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
637
- }
638
- /**
639
- * @internal
640
- */
641
- _getCustomValidationError() {
642
- if (this._isPresentationValueInvalid()) {
643
- return this.locale.timePicker.invalidTimeError;
644
- }
645
- return null;
646
- }
647
- /**
648
- * @internal
649
- */
650
- _isPresentationValueInvalid() {
651
- if (this._presentationValue === "") {
652
- return false;
653
- }
654
- try {
655
- parsePresentationTime(this._presentationValue, this._use12hClock);
656
- return false;
657
- } catch (_) {
658
- return true;
659
- }
237
+ __privateGet(this, _reflectToTextArea).destroy();
660
238
  }
661
239
  };
662
- __decorateClass([
663
- index.attr({ attribute: "readonly", mode: "boolean" })
664
- ], TimePicker.prototype, "readOnly", 2);
665
- __decorateClass([
666
- index.attr({ attribute: "minutes-step", converter: index.nullableNumberConverter })
667
- ], TimePicker.prototype, "minutesStep", 2);
668
- __decorateClass([
669
- index.attr({ attribute: "seconds-step", converter: index.nullableNumberConverter })
670
- ], TimePicker.prototype, "secondsStep", 2);
240
+ _reflectToTextArea = new WeakMap();
671
241
  __decorateClass([
672
242
  index.attr
673
- ], TimePicker.prototype, "clock", 2);
674
- __decorateClass([
675
- index.attr({ converter: ValidTimeFilter })
676
- ], TimePicker.prototype, "min", 2);
677
- __decorateClass([
678
- index.attr({ converter: ValidTimeFilter })
679
- ], TimePicker.prototype, "max", 2);
680
- __decorateClass([
681
- index.observable
682
- ], TimePicker.prototype, "_popupOpen", 2);
683
- __decorateClass([
684
- index.observable
685
- ], TimePicker.prototype, "_presentationValue", 2);
686
- TimePicker = __decorateClass([
243
+ ], TextArea.prototype, "wrap", 2);
244
+ TextArea = __decorateClass([
687
245
  index$1.errorText,
688
246
  index$1.formElements
689
- ], TimePicker);
690
- applyMixins.applyMixins(TimePicker, localized.Localized, index$1.FormElementHelperText, trappedFocus.TrappedFocus);
247
+ ], TextArea);
248
+ applyMixinsWithObservables.applyMixinsWithObservables(
249
+ TextArea,
250
+ index$1.FormElementCharCount,
251
+ index$1.FormElementHelperText,
252
+ index$1.FormElementSuccessText
253
+ );
691
254
 
692
- const renderPicker = (id, getLabel, getSelected, setSelected, getOptions) => {
255
+ const getClasses = ({
256
+ value,
257
+ errorValidationMessage,
258
+ disabled,
259
+ placeholder,
260
+ readOnly,
261
+ successText
262
+ }) => classNames.classNames(
263
+ "base",
264
+ ["readonly", readOnly],
265
+ ["placeholder", Boolean(placeholder)],
266
+ ["disabled", disabled],
267
+ ["error", Boolean(errorValidationMessage)],
268
+ ["has-value", Boolean(value)],
269
+ ["success", !!successText]
270
+ );
271
+ function renderLabel() {
272
+ return index.html` <label for="control" class="label">
273
+ ${(x) => x.label}
274
+ </label>`;
275
+ }
276
+ function renderCharCount() {
693
277
  return index.html`
694
- <ul
695
- id="${id}"
696
- class="picker"
697
- role="listbox"
698
- tabindex="0"
699
- aria-label="${getLabel}"
700
- aria-activedescendant="${(x) => getSelected(x) ? `${id}-${getSelected(x)}` : void 0}"
701
- @keydown="${(x, c) => x._onPickerKeyDown(id, getOptions(x), getSelected(x), setSelected(x), c.event)}"
278
+ <span class="char-count"
279
+ >${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span
702
280
  >
703
- ${repeat.repeat(
704
- getOptions,
705
- index.html`
706
- <li
707
- id="${(x) => `${id}-${x.value}`}"
708
- class="${(x, c) => classNames.classNames("item", [
709
- "selected",
710
- getSelected(c.parent) === x.value
711
- ])}"
712
- role="option"
713
- aria-selected="${(x, c) => getSelected(c.parent) === x.value}"
714
- @click="${(x, c) => c.parent._onPickerItemClick(id, setSelected(c.parent), x.value)}"
715
- >
716
- ${(x) => x.label}
717
- </li>
718
- `
719
- )}
720
- </ul>
721
281
  `;
722
- };
723
- const TimePickerTemplate = (context, _) => {
724
- const popupTag = context.tagFor(definition.Popup);
725
- const textFieldTag = context.tagFor(definition$1.TextField);
726
- const buttonTag = context.tagFor(definition$2.Button);
727
- return index.html`<div class="base" @keydown="${(x, { event }) => x._onBaseKeyDown(event)}">
728
- <${textFieldTag} id="text-field"
729
- ${ref.ref("_textFieldEl")}
730
- class="control"
731
- label="${(x) => x.label}"
732
- helper-text="${(x) => x.helperText}"
733
- error-text="${(x) => x.errorValidationMessage}"
734
- placeholder="${(x) => x._textFieldPlaceholder}"
735
- current-value="${(x) => x._presentationValue}"
736
- ?disabled="${(x) => x.disabled}"
737
- ?readonly="${(x) => x.readOnly}"
738
- @input="${(x, c) => x._onTextFieldInput(c.event)}"
739
- @change="${(x) => x._onTextFieldChange()}"
740
- >
741
- <${buttonTag}
742
- id="clock-button"
743
- ${ref.ref("_clockButtonEl")}
744
- slot="action-items"
745
- size="condensed"
746
- icon="clock-line"
747
- appearance="ghost"
748
- ?disabled="${(x) => x.disabled || x.readOnly}"
749
- aria-label="${(x) => x._clockButtonLabel}"
750
- @click="${(x) => x._onClockButtonClick()}"
751
- ></${buttonTag}>
752
- </${textFieldTag}>
753
- <${popupTag}
754
- ?open="${(x) => x._popupOpen}"
755
- :anchor="${(x) => x._textFieldEl}"
756
- placement="bottom-start"
757
- class="popup">
758
- <div class="dialog" role="dialog" ${ref.ref(
759
- "_dialogEl"
760
- )} aria-modal="true" aria-label="${(x) => x.locale.timePicker.chooseTimeLabel}">
761
- <div class="time-pickers">
762
- ${renderPicker(
763
- "hours",
764
- (x) => x.locale.timePicker.hoursLabel,
765
- (x) => x._selectedHour,
766
- (x) => (v) => x._selectedHour = v,
767
- (x) => x._hours
768
- )}
769
- ${renderPicker(
770
- "minutes",
771
- (x) => x.locale.timePicker.minutesLabel,
772
- (x) => x._selectedMinute,
773
- (x) => (v) => x._selectedMinute = v,
774
- (x) => x._minutes
775
- )}
776
- ${when.when((x) => x._displaySeconds, renderPicker(
777
- "seconds",
778
- (x) => x.locale.timePicker.secondsLabel,
779
- (x) => x._selectedSecond,
780
- (x) => (v) => x._selectedSecond = v,
781
- (x) => x._seconds
782
- ))}
783
- ${when.when((x) => x._use12hClock, renderPicker(
784
- "meridies",
785
- (x) => x.locale.timePicker.meridiesLabel,
786
- (x) => x._selectedMeridiem,
787
- (x) => (v) => x._selectedMeridiem = v,
788
- (x) => x._meridies
789
- ))}
790
- </div>
791
- <div class="footer">
792
- <${buttonTag}
793
- class="vwc-button"
794
- size="condensed"
795
- label="${(x) => x.locale.timePicker.clearLabel}"
796
- @click="${(x) => x._onClearClick()}"
797
- ></${buttonTag}>
798
- <${buttonTag}
799
- class="vwc-button"
800
- size="condensed"
801
- appearance="filled"
802
- label="${(x) => x.locale.timePicker.okLabel}"
803
- @click="${(x) => x._onOkClick()}"
804
- ></${buttonTag}>
805
- </div>
806
- </div>
807
- </${popupTag}>
808
- </div>`;
282
+ }
283
+ const TextAreaTemplate = (context) => {
284
+ return index.html`
285
+ <div class="${getClasses}">
286
+ ${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
287
+ ${when.when((x) => x.label, renderLabel())}
288
+ <textarea
289
+ class="control"
290
+ id="control"
291
+ ?autofocus="${(x) => x.autofocus}"
292
+ placeholder="${(x) => x.placeholder ? x.placeholder : null}"
293
+ name="${(x) => x.name ? x.name : null}"
294
+ minlength="${(x) => x.minlength ? x.minlength : null}"
295
+ maxlength="${(x) => x.maxlength ? x.maxlength : null}"
296
+ rows="${(x) => x.rows ? x.rows : null}"
297
+ cols="${(x) => x.cols ? x.cols : null}"
298
+ wrap="${(x) => x.wrap ? x.wrap : null}"
299
+ ?readonly="${(x) => x.readOnly}"
300
+ ?disabled="${(x) => x.disabled}"
301
+ ?required="${(x) => x.required}"
302
+ ?spellcheck="${(x) => x.spellcheck}"
303
+ aria-atomic="${(x) => x.ariaAtomic}"
304
+ aria-busy="${(x) => x.ariaBusy}"
305
+ aria-current="${(x) => x.ariaCurrent}"
306
+ aria-details="${(x) => x.ariaDetails}"
307
+ aria-disabled="${(x) => x.ariaDisabled}"
308
+ aria-errormessage="${(x) => x.ariaErrormessage}"
309
+ aria-haspopup="${(x) => x.ariaHaspopup}"
310
+ aria-hidden="${(x) => x.ariaHidden}"
311
+ aria-invalid="${(x) => x.ariaInvalid}"
312
+ aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
313
+ aria-label="${(x) => x.ariaLabel}"
314
+ aria-live="${(x) => x.ariaLive}"
315
+ aria-relevant="${(x) => x.ariaRelevant}"
316
+ aria-roledescription="${(x) => x.ariaRoledescription}"
317
+ @input="${(x) => x.handleTextInput()}"
318
+ @change="${(x) => x.handleChange()}"
319
+ ${ref.ref("control")}
320
+ >
321
+ </textarea>
322
+ ${index$1.getFeedbackTemplate(context)}
323
+ </div>
324
+ `;
809
325
  };
810
326
 
811
- const timePickerDefinition = TimePicker.compose({
812
- baseName: "time-picker",
813
- template: TimePickerTemplate,
814
- styles,
815
- shadowOptions: {
816
- delegatesFocus: true
817
- }
818
- });
819
- const timePickerRegistries = [timePickerDefinition(), ...definition$1.textFieldRegistries, ...definition.popupRegistries, ...definition$2.buttonRegistries];
820
- const registerTimePicker = index.registerFactory(timePickerRegistries);
327
+ const textAreaDefinition = TextArea.compose(
328
+ {
329
+ baseName: "text-area",
330
+ template: TextAreaTemplate,
331
+ styles,
332
+ shadowOptions: {
333
+ delegatesFocus: true
334
+ }
335
+ }
336
+ );
337
+ const textAreaRegistries = [textAreaDefinition(), ...definition.iconRegistries];
338
+ const registerTextArea = index.registerFactory(textAreaRegistries);
821
339
 
822
- exports.registerTimePicker = registerTimePicker;
823
- exports.timePickerDefinition = timePickerDefinition;
824
- exports.timePickerRegistries = timePickerRegistries;
340
+ exports.registerTextArea = registerTextArea;
341
+ exports.textAreaDefinition = textAreaDefinition;
342
+ exports.textAreaRegistries = textAreaRegistries;