@vonage/vivid 5.16.0 → 5.17.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 (317) hide show
  1. package/accordion/index.cjs +1 -1
  2. package/accordion/index.js +1 -1
  3. package/accordion-item/index.cjs +1 -1
  4. package/accordion-item/index.js +1 -1
  5. package/action-group/index.cjs +3 -3
  6. package/action-group/index.js +5 -5
  7. package/alert/index.cjs +3 -3
  8. package/alert/index.js +17 -17
  9. package/audio-player/index.cjs +16 -16
  10. package/audio-player/index.js +27 -27
  11. package/avatar/index.cjs +2 -2
  12. package/avatar/index.js +6 -6
  13. package/badge/index.cjs +2 -2
  14. package/badge/index.js +6 -6
  15. package/banner/index.cjs +3 -3
  16. package/banner/index.js +15 -15
  17. package/bundled/base-color-picker.cjs +2 -2
  18. package/bundled/base-color-picker.js +5 -5
  19. package/bundled/button.cjs +1 -1
  20. package/bundled/button.js +2 -2
  21. package/bundled/calendar-picker.template.cjs +2 -2
  22. package/bundled/calendar-picker.template.js +498 -498
  23. package/bundled/definition10.cjs +18 -30
  24. package/bundled/definition10.js +53 -155
  25. package/bundled/definition11.cjs +10 -19
  26. package/bundled/definition11.js +25 -74
  27. package/bundled/definition12.cjs +72 -18
  28. package/bundled/definition12.js +171 -107
  29. package/bundled/definition13.cjs +18 -17
  30. package/bundled/definition13.js +45 -65
  31. package/bundled/definition14.cjs +5 -10
  32. package/bundled/definition14.js +9 -27
  33. package/bundled/definition15.cjs +17 -71
  34. package/bundled/definition15.js +64 -181
  35. package/bundled/definition16.cjs +12 -4
  36. package/bundled/definition16.js +79 -14
  37. package/bundled/definition17.cjs +19 -13
  38. package/bundled/definition17.js +119 -70
  39. package/bundled/definition18.cjs +87 -12
  40. package/bundled/definition18.js +409 -52
  41. package/bundled/definition19.cjs +5 -87
  42. package/bundled/definition19.js +14 -422
  43. package/bundled/definition2.cjs +3 -3
  44. package/bundled/definition2.js +27 -27
  45. package/bundled/definition20.cjs +30 -5
  46. package/bundled/definition20.js +159 -9
  47. package/bundled/definition21.cjs +28 -19
  48. package/bundled/definition21.js +164 -47
  49. package/bundled/definition22.cjs +38 -23
  50. package/bundled/definition22.js +64 -82
  51. package/bundled/definition3.cjs +1 -1
  52. package/bundled/definition3.js +15 -15
  53. package/bundled/definition4.cjs +23 -38
  54. package/bundled/definition4.js +82 -64
  55. package/bundled/definition5.cjs +2 -2
  56. package/bundled/definition5.js +5 -5
  57. package/bundled/definition6.cjs +2 -2
  58. package/bundled/definition6.js +24 -24
  59. package/bundled/definition9.cjs +12 -30
  60. package/bundled/definition9.js +55 -148
  61. package/bundled/divider.cjs +1 -1
  62. package/bundled/divider.js +5 -5
  63. package/bundled/listbox.cjs +1 -1
  64. package/bundled/listbox.js +1 -1
  65. package/bundled/mixins.cjs +4 -4
  66. package/bundled/mixins.js +43 -43
  67. package/bundled/picker-field.template.cjs +7 -7
  68. package/bundled/picker-field.template.js +14 -14
  69. package/bundled/slider.template.cjs +7 -7
  70. package/bundled/slider.template.js +12 -12
  71. package/bundled/slottable-request.cjs +1 -1
  72. package/bundled/slottable-request.js +8 -38
  73. package/bundled/time-selection-picker.template.cjs +4 -4
  74. package/bundled/time-selection-picker.template.js +35 -35
  75. package/bundled/vivid-element.cjs +1 -1
  76. package/bundled/vivid-element.js +1 -1
  77. package/calendar/index.cjs +11 -11
  78. package/calendar/index.js +30 -237
  79. package/calendar-event/index.cjs +3 -3
  80. package/calendar-event/index.js +4 -4
  81. package/card/index.cjs +14 -11
  82. package/card/index.js +16 -13
  83. package/checkbox/index.cjs +1 -1
  84. package/checkbox/index.js +1 -1
  85. package/color-picker/definition.cjs +1 -1
  86. package/color-picker/definition.js +1 -1
  87. package/color-picker/index.cjs +6 -6
  88. package/color-picker/index.js +24 -24
  89. package/combobox/definition.cjs +1 -1
  90. package/combobox/definition.js +1 -1
  91. package/combobox/index.cjs +9 -8
  92. package/combobox/index.js +32 -28
  93. package/contextual-help/definition.cjs +1 -1
  94. package/contextual-help/definition.js +1 -1
  95. package/contextual-help/index.cjs +1 -1
  96. package/contextual-help/index.js +1 -1
  97. package/custom-elements.json +1027 -615
  98. package/data-grid/definition.js +1 -1
  99. package/data-grid/index.cjs +17 -17
  100. package/data-grid/index.js +261 -264
  101. package/date-picker/index.cjs +1 -1
  102. package/date-picker/index.js +12 -12
  103. package/date-range-picker/index.cjs +1 -1
  104. package/date-range-picker/index.js +7 -7
  105. package/date-time-picker/index.cjs +4 -4
  106. package/date-time-picker/index.js +24 -24
  107. package/dial-pad/index.cjs +3 -2
  108. package/dial-pad/index.js +6 -5
  109. package/dialog/index.cjs +4 -4
  110. package/dialog/index.js +5 -5
  111. package/divider/index.cjs +1 -1
  112. package/divider/index.js +1 -1
  113. package/fab/index.cjs +3 -3
  114. package/fab/index.js +8 -8
  115. package/file-picker/index.cjs +16 -13
  116. package/file-picker/index.js +31 -28
  117. package/header/index.cjs +4 -4
  118. package/header/index.js +5 -5
  119. package/index.cjs +24 -21
  120. package/index.js +11 -11
  121. package/lib/combobox/combobox.d.ts +0 -3
  122. package/lib/date-time-picker/date-time-picker.d.ts +0 -4
  123. package/lib/dial-pad/dial-pad.d.ts +6 -2
  124. package/lib/dialog/dialog.d.ts +0 -1
  125. package/lib/menu/menu.d.ts +0 -1
  126. package/lib/option/option.d.ts +0 -1
  127. package/lib/rich-text-editor/rte/exports.d.ts +1 -0
  128. package/lib/rich-text-editor/rte/features/alignment.d.ts +1 -1
  129. package/lib/rich-text-editor/rte/features/character-count.d.ts +21 -0
  130. package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +1 -1
  131. package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
  132. package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
  133. package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
  134. package/lib/rich-text-editor/rte/public-interface.d.ts +6 -0
  135. package/lib/searchable-select/option-tag.d.ts +0 -1
  136. package/lib/table/definition.d.ts +2 -1
  137. package/lib/table/table-header-cell.d.ts +3 -0
  138. package/lib/table/table-sorting-button.d.ts +415 -0
  139. package/lib/table/table-sorting-button.template.d.ts +3 -0
  140. package/locales/de-DE.cjs +4 -178
  141. package/locales/de-DE.js +2 -179
  142. package/locales/en-GB.cjs +4 -9
  143. package/locales/en-GB.js +2 -10
  144. package/locales/en-US.cjs +268 -2
  145. package/locales/en-US.js +265 -1
  146. package/locales/ja-JP.cjs +4 -171
  147. package/locales/ja-JP.js +2 -172
  148. package/locales/zh-CN.cjs +4 -172
  149. package/locales/zh-CN.js +2 -173
  150. package/menu/index.cjs +1 -1
  151. package/menu/index.js +1 -1
  152. package/menu-item/index.cjs +1 -1
  153. package/menu-item/index.js +1 -1
  154. package/nav-disclosure/index.cjs +3 -3
  155. package/nav-disclosure/index.js +8 -8
  156. package/nav-item/index.cjs +1 -1
  157. package/nav-item/index.js +7 -7
  158. package/note/index.cjs +2 -2
  159. package/note/index.js +6 -6
  160. package/number-field/index.cjs +4 -4
  161. package/number-field/index.js +31 -31
  162. package/option/definition.cjs +1 -1
  163. package/option/definition.js +1 -1
  164. package/option/index.cjs +1 -1
  165. package/option/index.js +1 -1
  166. package/package.json +7 -8
  167. package/pagination/index.cjs +3 -3
  168. package/pagination/index.js +15 -15
  169. package/popover/index.cjs +4 -4
  170. package/popover/index.js +5 -5
  171. package/progress/index.cjs +2 -2
  172. package/progress/index.js +5 -5
  173. package/radio/index.cjs +1 -1
  174. package/radio/index.js +1 -1
  175. package/radio-group/index.cjs +4 -4
  176. package/radio-group/index.js +10 -10
  177. package/range-slider/index.cjs +4 -4
  178. package/range-slider/index.js +17 -17
  179. package/rich-text-editor/definition.cjs +1 -0
  180. package/rich-text-editor/definition.js +2 -2
  181. package/rich-text-editor/index.cjs +13 -13
  182. package/rich-text-editor/index.js +1886 -1829
  183. package/rich-text-view/index.cjs +1 -1
  184. package/rich-text-view/index.js +8 -8
  185. package/searchable-select/index.cjs +12 -12
  186. package/searchable-select/index.js +25 -25
  187. package/select/index.cjs +1 -1
  188. package/select/index.js +1 -1
  189. package/selectable-box/index.cjs +7 -7
  190. package/selectable-box/index.js +11 -11
  191. package/shared/foundation/test-utilities/fixture.d.ts +1 -1
  192. package/shared/patterns/linkable.d.ts +1 -1
  193. package/simple-color-picker/index.cjs +3 -3
  194. package/simple-color-picker/index.js +10 -10
  195. package/split-button/index.cjs +5 -5
  196. package/split-button/index.js +10 -10
  197. package/status/index.cjs +2 -2
  198. package/status/index.js +12 -12
  199. package/switch/index.cjs +3 -3
  200. package/switch/index.js +5 -5
  201. package/tab/index.cjs +1 -1
  202. package/tab/index.js +1 -1
  203. package/tab-panel/index.cjs +1 -1
  204. package/tab-panel/index.js +1 -1
  205. package/table/definition.cjs +17 -14
  206. package/table/definition.js +3 -2
  207. package/table/index.cjs +19 -10
  208. package/table/index.js +69 -21
  209. package/tabs/index.cjs +2 -2
  210. package/tabs/index.js +4 -4
  211. package/tag/index.cjs +7 -7
  212. package/tag/index.js +9 -9
  213. package/tag-group/index.cjs +3 -3
  214. package/tag-group/index.js +5 -5
  215. package/text-area/index.cjs +2 -2
  216. package/text-area/index.js +12 -12
  217. package/text-field/definition.cjs +1 -1
  218. package/text-field/definition.js +1 -1
  219. package/text-field/index.cjs +1 -1
  220. package/text-field/index.js +1 -1
  221. package/time-picker/index.cjs +1 -1
  222. package/time-picker/index.js +1 -1
  223. package/toggletip/definition.cjs +1 -1
  224. package/toggletip/definition.js +1 -1
  225. package/toggletip/index.cjs +1 -1
  226. package/toggletip/index.js +1 -1
  227. package/tooltip/definition.cjs +1 -1
  228. package/tooltip/definition.js +1 -1
  229. package/tooltip/index.cjs +1 -1
  230. package/tooltip/index.js +1 -1
  231. package/tree-item/index.cjs +1 -1
  232. package/tree-item/index.js +1 -1
  233. package/tree-view/index.cjs +3 -3
  234. package/tree-view/index.js +17 -17
  235. package/unbundled/button.cjs +2 -2
  236. package/unbundled/button.js +2 -2
  237. package/unbundled/calendar-picker.template.cjs +4347 -9
  238. package/unbundled/calendar-picker.template.js +4345 -7
  239. package/unbundled/chunk.cjs +0 -22
  240. package/unbundled/definition13.cjs +1 -8
  241. package/unbundled/definition13.js +1 -8
  242. package/unbundled/definition14.cjs +2 -2
  243. package/unbundled/definition14.js +2 -2
  244. package/unbundled/definition2.cjs +1 -1
  245. package/unbundled/definition2.js +1 -1
  246. package/unbundled/definition21.cjs +1 -2
  247. package/unbundled/definition21.js +1 -2
  248. package/unbundled/definition22.cjs +7 -2
  249. package/unbundled/definition22.js +7 -2
  250. package/unbundled/definition24.cjs +98 -979
  251. package/unbundled/definition24.js +93 -974
  252. package/unbundled/definition25.cjs +37 -322
  253. package/unbundled/definition25.js +33 -318
  254. package/unbundled/definition26.cjs +317 -91
  255. package/unbundled/definition26.js +313 -87
  256. package/unbundled/definition27.cjs +94 -192
  257. package/unbundled/definition27.js +91 -183
  258. package/unbundled/definition28.cjs +387 -395
  259. package/unbundled/definition28.js +387 -395
  260. package/unbundled/definition29.cjs +189 -110
  261. package/unbundled/definition29.js +180 -107
  262. package/unbundled/definition30.cjs +520 -36
  263. package/unbundled/definition30.js +519 -35
  264. package/unbundled/definition32.cjs +477 -477
  265. package/unbundled/definition32.js +475 -475
  266. package/unbundled/definition33.cjs +87 -2
  267. package/unbundled/definition33.js +77 -4
  268. package/unbundled/definition35.cjs +2 -2
  269. package/unbundled/definition35.js +2 -2
  270. package/unbundled/definition36.cjs +1 -1
  271. package/unbundled/definition36.js +1 -1
  272. package/unbundled/definition37.cjs +6 -2
  273. package/unbundled/definition37.js +6 -2
  274. package/unbundled/definition38.cjs +7 -5
  275. package/unbundled/definition38.js +7 -5
  276. package/unbundled/definition39.cjs +1 -0
  277. package/unbundled/definition39.js +1 -0
  278. package/unbundled/definition42.cjs +22 -11
  279. package/unbundled/definition42.js +22 -11
  280. package/unbundled/definition49.cjs +3 -3
  281. package/unbundled/definition49.js +3 -3
  282. package/unbundled/definition56.cjs +437 -9506
  283. package/unbundled/definition56.js +340 -9415
  284. package/unbundled/definition57.cjs +5 -5
  285. package/unbundled/definition57.js +5 -5
  286. package/unbundled/definition58.cjs +4 -3
  287. package/unbundled/definition58.js +2 -1
  288. package/unbundled/definition59.cjs +4 -3
  289. package/unbundled/definition59.js +4 -3
  290. package/unbundled/definition62.cjs +2 -2
  291. package/unbundled/definition62.js +2 -2
  292. package/unbundled/definition64.cjs +1 -1
  293. package/unbundled/definition64.js +1 -1
  294. package/unbundled/definition71.cjs +2 -2
  295. package/unbundled/definition71.js +2 -2
  296. package/unbundled/definition72.cjs +1 -2
  297. package/unbundled/definition72.js +1 -2
  298. package/unbundled/definition75.cjs +3 -51711
  299. package/unbundled/definition75.js +1 -51711
  300. package/unbundled/listbox.cjs +1 -1
  301. package/unbundled/listbox.js +1 -1
  302. package/unbundled/localized.cjs +2 -2
  303. package/unbundled/localized.js +1 -1
  304. package/unbundled/picker-field.template.cjs +1 -1
  305. package/unbundled/picker-field.template.js +1 -1
  306. package/unbundled/slottable-request.cjs +2 -3168
  307. package/unbundled/slottable-request.js +3 -3097
  308. package/unbundled/time-selection-picker.template.cjs +1 -1
  309. package/unbundled/time-selection-picker.template.js +1 -1
  310. package/unbundled/vivid-element.cjs +1 -1
  311. package/unbundled/vivid-element.js +1 -1
  312. package/video-player/index.cjs +3 -3
  313. package/video-player/index.js +9 -9
  314. package/vivid.api.json +220 -282
  315. package/unbundled/chunk.js +0 -33
  316. package/unbundled/en-US.cjs +0 -447
  317. package/unbundled/en-US.js +0 -443
@@ -1,119 +1,345 @@
1
1
  import { o as defineVividComponent, s as createRegisterFunction, t as VividElement } from "./vivid-element.js";
2
+ import { n as visuallyHiddenDefinition } from "./definition.js";
3
+ import { t as iconDefinition } from "./definition2.js";
2
4
  import { t as __decorate } from "./decorate.js";
3
- import { t as handleEscapeKeyAndStopPropogation } from "./dialog.js";
4
- import { i as Popup, t as popupDefinition } from "./definition10.js";
5
- import { n as anchorSlotTemplateFactory, t as Anchored } from "./anchored.js";
6
- import { attr, html } from "@microsoft/fast-element";
5
+ import { a as affixIconTemplateFactory, t as AffixIcon } from "./affix.js";
6
+ import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
7
+ import { n as FormAssociated } from "./form-associated.js";
8
+ import { t as FormElement } from "./form-element.js";
9
+ import { t as WithSuccessText } from "./with-success-text.js";
10
+ import { t as WithErrorText } from "./with-error-text.js";
11
+ import { t as WithContextualHelp } from "./with-contextual-help.js";
12
+ import { t as WithCharCount } from "./char-count.js";
13
+ import { a as feedbackMessageDefinition, i as renderInLightDOM, n as WithLightDOMFeedback, r as generateRandomId } from "./mixins.js";
14
+ import { t as contextualHelpDefinition } from "./definition25.js";
15
+ import { t as text_field_default } from "./text-field.js";
16
+ import { ElementStyles, Updates, attr, html, nullableNumberConverter, observable, ref, slotted, when } from "@microsoft/fast-element";
7
17
  import { classNames } from "@microsoft/fast-web-utilities";
8
- //#region src/lib/tooltip/tooltip.ts
18
+ //#region src/lib/text-field/text-field.ts
9
19
  /**
20
+ * Text field sub-types
10
21
  * @public
11
- * @component tooltip
12
- * @slot anchor - Used to set the anchor element for the tooltip.
13
- * @testSelector byText byText
14
- * @testQuery open open true
15
- * @testQuery closed open false
16
22
  */
17
- var Tooltip = class extends Anchored(VividElement) {
23
+ var TextFieldType = {
24
+ email: "email",
25
+ password: "password",
26
+ tel: "tel",
27
+ text: "text",
28
+ url: "url"
29
+ };
30
+ var safariWorkaroundStyles = new ElementStyles([`
31
+ ._vvd-3-text-field-safari-workaround::placeholder {
32
+ opacity: 1 !important;
33
+ -webkit-text-fill-color: var(--_low-ink-color) !important;
34
+ }
35
+ `]);
36
+ var installSafariWorkaroundStyleIfNeeded = (forElement) => {
37
+ const root = forElement.getRootNode();
38
+ if (!safariWorkaroundStyles.isAttachedTo(root)) safariWorkaroundStyles.addStylesTo(root);
39
+ };
40
+ /**
41
+ * Base class for text-field
42
+ *
43
+ * @public
44
+ * @component text-field
45
+ * @slot leading-action-items - Used to add action items to the start of the text-field.
46
+ * @slot action-items - Used to add action items to the end of the text-field.
47
+ * @slot helper-text - Describes how to use the text-field. Alternative to the `helper-text` attribute.
48
+ * @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value has changed
49
+ * @event {CustomEvent<undefined>} change - Fires a custom 'change' event when the value has changed
50
+ * @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
51
+ * @testAction fill fill #control
52
+ * @testAction clear clear #control
53
+ * @testAction blur blur #control
54
+ * @testRef control light input[slot="_control"]
55
+ */
56
+ var TextField = class extends WithContextualHelp(WithLightDOMFeedback(WithCharCount(WithErrorText(WithSuccessText(FormElement(AffixIcon(DelegatesAria(FormAssociated(VividElement))))))))) {
18
57
  constructor(..._args) {
19
58
  super(..._args);
20
- this.open = false;
59
+ this.proxy = document.createElement("input");
60
+ this.type = TextFieldType.text;
21
61
  }
22
- connectedCallback() {
23
- super.connectedCallback();
24
- this.#updateListeners();
62
+ /**
63
+ * @internal
64
+ */
65
+ readOnlyChanged() {
66
+ /* v8 ignore if -- @preserve */
67
+ if (this.proxy instanceof HTMLInputElement) {
68
+ this.proxy.readOnly = this.readOnly;
69
+ this.validate();
70
+ }
71
+ }
72
+ /**
73
+ * @internal
74
+ */
75
+ autofocusChanged() {
76
+ /* v8 ignore if -- @preserve */
77
+ if (this.proxy instanceof HTMLInputElement) {
78
+ this.proxy.autofocus = this.autofocus;
79
+ this.validate();
80
+ }
81
+ }
82
+ /**
83
+ * @internal
84
+ */
85
+ placeholderChanged() {
86
+ /* v8 ignore if -- @preserve */
87
+ if (this.proxy instanceof HTMLInputElement) this.proxy.placeholder = this.placeholder;
88
+ }
89
+ /**
90
+ * @internal
91
+ */
92
+ typeChanged() {
93
+ /* v8 ignore if -- @preserve */
94
+ if (this.proxy instanceof HTMLInputElement) {
95
+ this.proxy.type = this.type;
96
+ this.validate();
97
+ }
98
+ }
99
+ /**
100
+ * @internal
101
+ */
102
+ listChanged() {
103
+ /* v8 ignore if -- @preserve */
104
+ if (this.proxy instanceof HTMLInputElement) {
105
+ this.proxy.setAttribute("list", this.list);
106
+ this.validate();
107
+ }
108
+ }
109
+ /**
110
+ * @internal
111
+ */
112
+ maxlengthChanged() {
113
+ /* v8 ignore if -- @preserve */
114
+ if (this.proxy instanceof HTMLInputElement) {
115
+ this.proxy.maxLength = this.maxlength;
116
+ this.validate();
117
+ }
118
+ }
119
+ /**
120
+ * @internal
121
+ */
122
+ minlengthChanged() {
123
+ /* v8 ignore if -- @preserve */
124
+ if (this.proxy instanceof HTMLInputElement) {
125
+ this.proxy.minLength = this.minlength;
126
+ this.validate();
127
+ }
128
+ }
129
+ /**
130
+ * @internal
131
+ */
132
+ patternChanged() {
133
+ /* v8 ignore if -- @preserve */
134
+ if (this.proxy instanceof HTMLInputElement) {
135
+ this.proxy.pattern = this.pattern;
136
+ this.validate();
137
+ }
138
+ }
139
+ /**
140
+ * @internal
141
+ */
142
+ sizeChanged() {
143
+ /* v8 ignore if -- @preserve */
144
+ if (this.proxy instanceof HTMLInputElement) this.proxy.size = this.size;
25
145
  }
26
- disconnectedCallback() {
27
- super.disconnectedCallback();
28
- this.#updateListeners();
146
+ /**
147
+ * @internal
148
+ */
149
+ spellcheckChanged() {
150
+ /* v8 ignore if -- @preserve */
151
+ if (this.proxy instanceof HTMLInputElement) this.proxy.spellcheck = this.spellcheck;
29
152
  }
30
153
  /**
31
154
  * @internal
32
155
  */
33
- _anchorElChanged(oldValue, newValue) {
34
- if (oldValue) this.#cleanupAnchor(oldValue);
35
- if (newValue) this.#setupAnchor(newValue);
36
- }
37
- #setupAnchor(a) {
38
- a.addEventListener("mouseover", this.#show);
39
- a.addEventListener("mouseout", this.#hide);
40
- a.addEventListener("focusin", this.#show);
41
- a.addEventListener("focusout", this.#hide);
42
- a.setAttribute("aria-haspopup", "true");
43
- a.setAttribute("aria-expanded", String(this.open));
44
- }
45
- #cleanupAnchor(a) {
46
- a.removeEventListener("mouseover", this.#show);
47
- a.removeEventListener("mouseout", this.#hide);
48
- a.removeEventListener("focusin", this.#show);
49
- a.removeEventListener("focusout", this.#hide);
50
- a.removeAttribute("aria-haspopup");
51
- a.removeAttribute("aria-expanded");
52
- }
53
- #show = () => {
54
- this.open = true;
55
- this.#updateAnchorExpanded();
56
- };
57
- #hide = () => {
58
- this.open = false;
59
- this.#updateAnchorExpanded();
60
- };
61
- #updateAnchorExpanded() {
62
- if (this._anchorEl) this._anchorEl.setAttribute("aria-expanded", String(this.open));
63
- }
64
- #updateListeners() {
65
- document.removeEventListener("keydown", this.#closeOnEscape);
66
- if (this.open && this.isConnected) document.addEventListener("keydown", this.#closeOnEscape);
67
- }
68
- #closeOnEscape = (e) => {
69
- /* v8 ignore else -- @preserve */
70
- if (e.key === "Escape") this.#hide();
71
- };
156
+ valueChanged(previous, next) {
157
+ super.valueChanged(previous, next);
158
+ this._updateControlValueIfNeeded();
159
+ if (this.charCount && this.maxlength) this._updateCharCountRemaining();
160
+ }
72
161
  /**
162
+ * Update the controls value only if it is actually different from the actual value.
163
+ * This is important as to not reset the browser's "dirtiness" flag on the input, which is used for min/maxlength
164
+ * constraints.
73
165
  * @internal
74
166
  */
75
- openChanged(oldValue) {
76
- if (oldValue === void 0) return;
77
- this.#updateListeners();
167
+ _updateControlValueIfNeeded() {
168
+ if (this.control && this.control.value !== this.value) this.control.value = this.value;
169
+ }
170
+ /**
171
+ * Selects all the text in the text field
172
+ *
173
+ * @public
174
+ */
175
+ select() {
176
+ this.control.select();
177
+ }
178
+ /**
179
+ * Handles the internal control's `input` event
180
+ * @internal
181
+ */
182
+ handleTextInput(event) {
183
+ this.value = this.control.value;
184
+ event.stopPropagation();
185
+ this.$emit("input");
186
+ }
187
+ /**
188
+ * Change event handler for inner control.
189
+ * @remarks
190
+ * "Change" events are not `composable` so they will not
191
+ * permeate the shadow DOM boundary. This fn effectively proxies
192
+ * the change event, emitting a `change` event whenever the internal
193
+ * control emits a `change` event
194
+ * @internal
195
+ */
196
+ handleChange() {
197
+ this.$emit("change");
198
+ }
199
+ /** {@inheritDoc (FormAssociated:interface).validate} */
200
+ validate() {
201
+ super.validate(this.control);
202
+ }
203
+ connectedCallback() {
204
+ super.connectedCallback();
205
+ this.proxy.setAttribute("type", this.type);
206
+ this.validate();
207
+ if (this.autofocus) Updates.enqueue(() => {
208
+ this.focus();
209
+ });
210
+ this._updateControlValueIfNeeded();
211
+ installSafariWorkaroundStyleIfNeeded(this);
212
+ this._renderCharCountRemaining();
213
+ }
214
+ focus() {
215
+ this.control?.focus();
216
+ }
217
+ #randomId = generateRandomId();
218
+ /**
219
+ * @internal
220
+ */
221
+ get _uniqueId() {
222
+ return this.id || this.#randomId;
78
223
  }
79
224
  };
80
- __decorate([attr], Tooltip.prototype, "text", void 0);
81
- __decorate([attr({ mode: "fromView" })], Tooltip.prototype, "placement", void 0);
82
- __decorate([attr({ mode: "boolean" })], Tooltip.prototype, "open", void 0);
225
+ __decorate([attr({
226
+ attribute: "readonly",
227
+ mode: "boolean"
228
+ })], TextField.prototype, "readOnly", void 0);
229
+ __decorate([attr({ mode: "boolean" })], TextField.prototype, "autofocus", void 0);
230
+ __decorate([attr], TextField.prototype, "placeholder", void 0);
231
+ __decorate([attr], TextField.prototype, "type", void 0);
232
+ __decorate([attr], TextField.prototype, "list", void 0);
233
+ __decorate([attr({ converter: nullableNumberConverter })], TextField.prototype, "maxlength", void 0);
234
+ __decorate([attr({ converter: nullableNumberConverter })], TextField.prototype, "minlength", void 0);
235
+ __decorate([attr], TextField.prototype, "pattern", void 0);
236
+ __decorate([attr({ converter: nullableNumberConverter })], TextField.prototype, "size", void 0);
237
+ __decorate([attr({ mode: "boolean" })], TextField.prototype, "spellcheck", void 0);
238
+ __decorate([attr], TextField.prototype, "appearance", void 0);
239
+ __decorate([attr], TextField.prototype, "shape", void 0);
240
+ __decorate([attr], TextField.prototype, "autoComplete", void 0);
241
+ __decorate([attr()], TextField.prototype, "scale", void 0);
242
+ __decorate([attr({ attribute: "inputmode" })], TextField.prototype, "inputMode", void 0);
243
+ __decorate([observable], TextField.prototype, "actionItemsSlottedContent", void 0);
244
+ __decorate([observable], TextField.prototype, "leadingActionItemsSlottedContent", void 0);
83
245
  //#endregion
84
- //#region src/lib/tooltip/tooltip.scss?inline
85
- var tooltip_default = ":host :host{display:var(--_popup-display,inline)}:host :host([slotted-anchor]){--_popup-display:contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size,auto);box-sizing:border-box;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size,30ch);padding:8px 12px}";
86
- //#endregion
87
- //#region src/lib/tooltip/tooltip.template.ts
88
- var getClasses = ({ open }) => classNames("control", ["open", Boolean(open)]);
89
- var TooltipTemplate = (context) => {
90
- const popupTag = context.tagFor(Popup);
246
+ //#region src/lib/text-field/text-field.template.ts
247
+ var getControlId = (id) => `vvd-text-field-control-${id}`;
248
+ var getStateClasses = ({ errorValidationMessage, disabled, value, readOnly, placeholder, appearance, shape, label, successText, actionItemsSlottedContent, leadingActionItemsSlottedContent, icon, scale }) => classNames(["error", Boolean(errorValidationMessage)], ["disabled", disabled], ["has-value", Boolean(value)], ["readonly", readOnly], ["placeholder", Boolean(placeholder)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ["no-label", !label], ["has-icon", !!icon], ["success", Boolean(successText)], ["action-items", !!actionItemsSlottedContent?.length], ["leading-action-items", !!leadingActionItemsSlottedContent?.length], ["no-leading", !(leadingActionItemsSlottedContent?.length || icon)], [`size-${scale}`, Boolean(scale)]);
249
+ var TextfieldTemplate = (context) => {
250
+ const affixIconTemplate = affixIconTemplateFactory(context);
91
251
  return html`
92
- ${anchorSlotTemplateFactory()}
93
- <${popupTag} class="${getClasses}" arrow alternate
94
- :placement=${(x) => x.placement}
95
- :anchor="${(x) => x._anchorEl}"
96
- :open="${(x) => x.open}"
97
- @keydown="${(x, c) => {
98
- if (x.open && handleEscapeKeyAndStopPropogation(c.event)) x.open = false;
252
+ <div class="base ${getStateClasses}">
253
+ ${when((x) => x.charCount && x.maxlength, (x) => x._getCharCountTemplate(context))}
254
+ <div
255
+ class="label-wrapper"
256
+ ?hidden=${(x) => !x.label && !x._hasContextualHelp}
257
+ >
258
+ <slot class="label" name="_label"></slot>
259
+ <slot
260
+ name="contextual-help"
261
+ ${slotted("_contextualHelpSlottedContent")}
262
+ ></slot>
263
+ </div>
264
+ ${renderInLightDOM(html`
265
+ ${when((x) => x.label, html`
266
+ <label slot="_label" for="${(x) => getControlId(x._uniqueId)}">
267
+ ${(x) => x.label}
268
+ </label>
269
+ `)}
270
+ `)}
271
+ <div class="fieldset">
272
+ <div class="leading-items-wrapper">
273
+ <slot
274
+ name="leading-action-items"
275
+ ${slotted("leadingActionItemsSlottedContent")}
276
+ ></slot>
277
+ ${(x) => affixIconTemplate(x.icon)}
278
+ </div>
279
+ <div class="wrapper">
280
+ <slot class="control" name="_control"></slot>
281
+ ${renderInLightDOM(html`<input
282
+ slot="_control"
283
+ id="${(x) => getControlId(x._uniqueId)}"
284
+ class="_vvd-3-text-field-safari-workaround"
285
+ @input="${(x, c) => x.handleTextInput(c.event)}"
286
+ @change="${(x) => x.handleChange()}"
287
+ @blur="${(x) => {
288
+ x.$emit("blur", void 0, { bubbles: false });
289
+ }}"
290
+ @focus="${(x) => {
291
+ x.$emit("focus", void 0, { bubbles: false });
99
292
  }}"
100
- exportparts="vvd-theme-alternate">
101
- <div part="vvd-theme-alternate" class="tooltip" role="tooltip">
102
- ${(x) => x.text}
103
- </div>
104
- </${popupTag}>`;
293
+ ?autofocus="${(x) => x.autofocus}"
294
+ ?disabled="${(x) => x.disabled}"
295
+ ?readonly="${(x) => x.readOnly}"
296
+ ?required="${(x) => x.required}"
297
+ ?spellcheck="${(x) => x.spellcheck}"
298
+ list="${(x) => x.list}"
299
+ maxlength="${(x) => x.maxlength}"
300
+ minlength="${(x) => x.minlength}"
301
+ pattern="${(x) => x.pattern}"
302
+ placeholder="${(x) => x.placeholder}"
303
+ size="${(x) => x.size}"
304
+ autocomplete="${(x) => x.autoComplete}"
305
+ type="${(x) => x.type}"
306
+ inputmode="${(x) => x.inputMode}"
307
+ aria-describedby="${(x) => x._feedbackDescribedBy} ${(x) => x.charCount && x.maxlength ? x._charCountDescribedBy : null}"
308
+ value="${(x) => x.initialValue}"
309
+ ${delegateAria()}
310
+ ${ref("control")}
311
+ />`)}
312
+ </div>
313
+ <div class="action-items-wrapper">
314
+ <slot
315
+ name="action-items"
316
+ ${slotted("actionItemsSlottedContent")}
317
+ ></slot>
318
+ </div>
319
+ </div>
320
+ ${(x) => x._getFeedbackTemplate(context)}
321
+ </div>
322
+ `;
105
323
  };
106
324
  //#endregion
107
- //#region src/lib/tooltip/definition.ts
325
+ //#region src/lib/text-field/definition.ts
108
326
  /**
109
327
  * @internal
110
328
  */
111
- var tooltipDefinition = defineVividComponent("tooltip", Tooltip, TooltipTemplate, [popupDefinition], { styles: tooltip_default });
329
+ var textFieldDefinition = defineVividComponent("text-field", TextField, TextfieldTemplate, [
330
+ iconDefinition,
331
+ feedbackMessageDefinition,
332
+ visuallyHiddenDefinition,
333
+ contextualHelpDefinition
334
+ ], {
335
+ styles: text_field_default,
336
+ shadowOptions: { delegatesFocus: true }
337
+ });
112
338
  /**
113
- * Registers the tooltip elements with the design system.
339
+ * Registers the text-field elements with the design system.
114
340
  *
115
341
  * @param prefix - the prefix to use for the component name
116
342
  */
117
- var registerTooltip = createRegisterFunction(tooltipDefinition);
343
+ var registerTextField = createRegisterFunction(textFieldDefinition);
118
344
  //#endregion
119
- export { tooltipDefinition as n, Tooltip as r, registerTooltip as t };
345
+ export { textFieldDefinition as n, TextField as r, registerTextField as t };