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