@vonage/vivid 3.40.0 → 3.42.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 (161) hide show
  1. package/accordion/index.js +2 -2
  2. package/accordion-item/index.js +2 -2
  3. package/alert/index.js +6 -5
  4. package/audio-player/index.js +33 -0
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +8 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +4 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +4 -3
  14. package/checkbox/index.js +3 -3
  15. package/combobox/index.js +8 -8
  16. package/custom-elements.json +438 -41
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +9 -9
  19. package/date-range-picker/index.js +8 -8
  20. package/dialog/index.js +6 -6
  21. package/divider/index.js +1 -1
  22. package/elevation/index.js +1 -1
  23. package/empty-state/index.js +2 -2
  24. package/fab/index.js +3 -3
  25. package/file-picker/index.js +5 -5
  26. package/focus/index.js +1 -1
  27. package/header/index.js +2 -2
  28. package/icon/index.js +1 -1
  29. package/index.js +57 -56
  30. package/layout/index.js +1 -1
  31. package/lib/alert/alert.d.ts +3 -1
  32. package/lib/alert/locale.d.ts +3 -0
  33. package/lib/audio-player/audio-player.d.ts +17 -0
  34. package/lib/audio-player/audio-player.template.d.ts +4 -0
  35. package/lib/audio-player/definition.d.ts +4 -0
  36. package/lib/audio-player/locale.d.ts +5 -0
  37. package/lib/banner/banner.d.ts +3 -1
  38. package/lib/banner/locale.d.ts +3 -0
  39. package/lib/card/card.d.ts +3 -0
  40. package/lib/card/card.template.d.ts +1 -1
  41. package/lib/card/definition.d.ts +1 -0
  42. package/lib/checkbox/checkbox.d.ts +1 -0
  43. package/lib/components.d.ts +1 -0
  44. package/lib/enums.d.ts +2 -1
  45. package/lib/selectable-box/selectable-box.d.ts +2 -2
  46. package/lib/split-button/locale.d.ts +3 -0
  47. package/lib/split-button/split-button.d.ts +4 -2
  48. package/listbox/index.js +4 -4
  49. package/locales/en-GB.js +14 -0
  50. package/locales/en-US.js +14 -0
  51. package/locales/ja-JP.js +14 -0
  52. package/locales/zh-CN.js +14 -0
  53. package/menu/index.js +8 -8
  54. package/menu-item/index.js +3 -3
  55. package/nav/index.js +1 -1
  56. package/nav-disclosure/index.js +3 -3
  57. package/nav-item/index.js +3 -3
  58. package/note/index.js +2 -2
  59. package/number-field/index.js +6 -6
  60. package/option/index.js +3 -3
  61. package/package.json +1 -1
  62. package/pagination/index.js +5 -5
  63. package/popup/index.js +6 -6
  64. package/progress/index.js +1 -1
  65. package/progress-ring/index.js +1 -1
  66. package/radio/index.js +2 -2
  67. package/radio-group/index.js +2 -2
  68. package/select/index.js +8 -8
  69. package/selectable-box/index.js +5 -5
  70. package/shared/definition.js +3 -3
  71. package/shared/definition10.js +90 -159
  72. package/shared/definition11.js +151 -29
  73. package/shared/definition12.js +37 -766
  74. package/shared/definition13.js +747 -106
  75. package/shared/definition14.js +121 -198
  76. package/shared/definition15.js +167 -664
  77. package/shared/definition16.js +576 -1137
  78. package/shared/definition17.js +1278 -143
  79. package/shared/definition18.js +68 -306
  80. package/shared/definition19.js +359 -217
  81. package/shared/definition2.js +1 -1
  82. package/shared/definition20.js +259 -67
  83. package/shared/definition21.js +66 -58
  84. package/shared/definition22.js +43 -84
  85. package/shared/definition23.js +76 -2353
  86. package/shared/definition24.js +2362 -45
  87. package/shared/definition25.js +63 -27
  88. package/shared/definition26.js +24 -51
  89. package/shared/definition27.js +36 -822
  90. package/shared/definition28.js +837 -49
  91. package/shared/definition29.js +52 -89
  92. package/shared/definition3.js +1 -1
  93. package/shared/definition30.js +88 -24
  94. package/shared/definition31.js +25 -12
  95. package/shared/definition32.js +12 -52
  96. package/shared/definition33.js +28 -502
  97. package/shared/definition34.js +442 -197
  98. package/shared/definition35.js +260 -186
  99. package/shared/definition36.js +186 -75
  100. package/shared/definition37.js +70 -54
  101. package/shared/definition38.js +65 -421
  102. package/shared/definition39.js +437 -38
  103. package/shared/definition4.js +43 -16
  104. package/shared/definition40.js +32 -680
  105. package/shared/definition41.js +654 -105
  106. package/shared/definition42.js +117 -78
  107. package/shared/definition43.js +74 -567
  108. package/shared/definition44.js +567 -98
  109. package/shared/definition45.js +110 -135
  110. package/shared/definition46.js +153 -17
  111. package/shared/definition47.js +16 -79
  112. package/shared/definition48.js +53 -475
  113. package/shared/definition49.js +502 -25
  114. package/shared/definition5.js +160 -44
  115. package/shared/definition50.js +22 -121
  116. package/shared/definition51.js +113 -271
  117. package/shared/definition52.js +249 -243
  118. package/shared/definition53.js +270 -109
  119. package/shared/definition54.js +84 -74
  120. package/shared/definition55.js +114 -69
  121. package/shared/definition56.js +81 -292
  122. package/shared/definition57.js +302 -13
  123. package/shared/definition58.js +11 -41
  124. package/shared/definition59.js +20 -154
  125. package/shared/definition6.js +43 -33
  126. package/shared/definition60.js +181 -0
  127. package/shared/definition7.js +39 -106
  128. package/shared/definition8.js +122 -38
  129. package/shared/definition9.js +56 -89
  130. package/shared/enums.js +1 -0
  131. package/shared/icon.js +2 -2
  132. package/shared/index.js +1 -1
  133. package/shared/index2.js +1 -1
  134. package/shared/listbox.js +1 -1
  135. package/shared/localization/Locale.d.ts +8 -0
  136. package/shared/patterns/form-elements/form-elements.d.ts +6 -6
  137. package/shared/presentationDate.js +10 -8
  138. package/shared/text-field.js +1 -1
  139. package/side-drawer/index.js +1 -1
  140. package/slider/index.js +3 -3
  141. package/split-button/index.js +6 -3
  142. package/style.css +329 -242
  143. package/styles/core/all.css +31 -25
  144. package/styles/core/theme.css +1 -1
  145. package/styles/core/typography.css +31 -25
  146. package/styles/tokens/theme-dark.css +4 -4
  147. package/styles/tokens/theme-light.css +4 -4
  148. package/styles/tokens/vivid-2-compat.css +1 -1
  149. package/switch/index.js +3 -3
  150. package/tab/index.js +3 -3
  151. package/tab-panel/index.js +1 -1
  152. package/tabs/index.js +5 -5
  153. package/tag/index.js +3 -3
  154. package/tag-group/index.js +1 -1
  155. package/text-area/index.js +3 -3
  156. package/text-field/index.js +3 -3
  157. package/toggletip/index.js +7 -7
  158. package/tooltip/index.js +7 -7
  159. package/tree-item/index.js +3 -3
  160. package/tree-view/index.js +1 -1
  161. package/vivid.api.json +270 -1
@@ -1,83 +1,194 @@
1
- import { a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
- import { f as focusRegistries } from './definition57.js';
3
- import { a as iconRegistries } from './definition25.js';
4
- import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.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 './definition26.js';
3
+ import { f as focusRegistries } from './definition58.js';
4
+ import './affix.js';
5
5
  import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, g as getFeedbackTemplate } from './index2.js';
6
6
  import { R as Reflector } from './Reflector.js';
7
- import { T as TextField$1 } from './text-field2.js';
7
+ import { D as DelegatesARIATextbox } from './text-field2.js';
8
8
  import { a as applyMixins } from './apply-mixins.js';
9
- import { s as styles } from './text-field.js';
10
- import { f as focusTemplateFactory } from './focus2.js';
9
+ import { F as FormAssociated } from './form-associated.js';
11
10
  import { w as when } from './when.js';
12
- import { s as slotted } from './slotted.js';
11
+ import { r as ref } from './ref.js';
13
12
  import { c as classNames } from './class-names.js';
14
13
 
15
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
16
- // require the crypto API and do not support built-in fallback to lower quality random number
17
- // generators (like Math.random()).
18
- let getRandomValues;
19
- const rnds8 = new Uint8Array(16);
20
- function rng() {
21
- // lazy load so that environments that need to polyfill have a chance to do so
22
- if (!getRandomValues) {
23
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
24
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
25
-
26
- if (!getRandomValues) {
27
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
28
- }
29
- }
30
-
31
- return getRandomValues(rnds8);
14
+ class _TextArea extends FoundationElement {
32
15
  }
33
-
34
16
  /**
35
- * Convert array of 16 byte values to UUID string format of the form:
36
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
17
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(TextArea:class)} component.
18
+ *
19
+ * @internal
37
20
  */
38
-
39
- const byteToHex = [];
40
-
41
- for (let i = 0; i < 256; ++i) {
42
- byteToHex.push((i + 0x100).toString(16).slice(1));
43
- }
44
-
45
- function unsafeStringify(arr, offset = 0) {
46
- // Note: Be careful editing this code! It's been tuned for performance
47
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
48
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
21
+ class FormAssociatedTextArea extends FormAssociated(_TextArea) {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.proxy = document.createElement("textarea");
25
+ }
49
26
  }
50
27
 
51
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
52
- const native = {
53
- randomUUID
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",
54
49
  };
55
50
 
56
- function v4(options, buf, offset) {
57
- if (native.randomUUID && !buf && !options) {
58
- return native.randomUUID();
59
- }
60
-
61
- options = options || {};
62
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
63
-
64
- rnds[6] = rnds[6] & 0x0f | 0x40;
65
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
66
-
67
- if (buf) {
68
- offset = offset || 0;
69
-
70
- for (let i = 0; i < 16; ++i) {
71
- buf[offset + i] = rnds[i];
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
+ };
72
87
  }
88
+ readOnlyChanged() {
89
+ if (this.proxy instanceof HTMLTextAreaElement) {
90
+ this.proxy.readOnly = this.readOnly;
91
+ }
92
+ }
93
+ autofocusChanged() {
94
+ if (this.proxy instanceof HTMLTextAreaElement) {
95
+ this.proxy.autofocus = this.autofocus;
96
+ }
97
+ }
98
+ listChanged() {
99
+ if (this.proxy instanceof HTMLTextAreaElement) {
100
+ this.proxy.setAttribute("list", this.list);
101
+ }
102
+ }
103
+ maxlengthChanged() {
104
+ if (this.proxy instanceof HTMLTextAreaElement) {
105
+ this.proxy.maxLength = this.maxlength;
106
+ }
107
+ }
108
+ minlengthChanged() {
109
+ if (this.proxy instanceof HTMLTextAreaElement) {
110
+ this.proxy.minLength = this.minlength;
111
+ }
112
+ }
113
+ spellcheckChanged() {
114
+ if (this.proxy instanceof HTMLTextAreaElement) {
115
+ this.proxy.spellcheck = this.spellcheck;
116
+ }
117
+ }
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);
148
+ }
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);
73
190
 
74
- return buf;
75
- }
76
-
77
- return unsafeStringify(rnds);
78
- }
79
-
80
- const generateRandomId = () => v4();
191
+ const styles = "/**\n * Do not edit directly\n * Generated on Thu, 30 Nov 2023 11:42:28 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-grid;\n grid-template-columns: 1fr max-content;\n inline-size: 100%;\n row-gap: 4px;\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-600);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.connotation-success {\n /* @cssprop [--vvd-text-area-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-text-area-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-text-area-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-text-area-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-text-area-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-text-area-success-intermediate, var(--vvd-color-success-500));\n /* @cssprop [--vvd-text-area-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-text-area-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-text-area-success-faint=var(--vvd-color-success-50)] */\n --_connotation-color-faint: var(--vvd-text-area-success-faint, var(--vvd-color-success-50));\n /* @cssprop [--vvd-text-area-success-soft=var(--vvd-color-success-100)] */\n --_connotation-color-soft: var(--vvd-text-area-success-soft, var(--vvd-color-success-100));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-text-area-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-text-area-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-text-area-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-text-area-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-text-area-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-text-area-alert-intermediate, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-text-area-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-text-area-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-text-area-alert-faint=var(--vvd-color-alert-50)] */\n --_connotation-color-faint: var(--vvd-text-area-alert-faint, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-text-area-alert-soft=var(--vvd-color-alert-100)] */\n --_connotation-color-soft: var(--vvd-text-area-alert-soft, var(--vvd-color-alert-100));\n}\n.base:not(.connotation-success, .connotation-alert) {\n /* @cssprop [--vvd-text-area-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-text-area-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-text-area-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-text-area-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-text-area-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-text-area-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-text-area-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-text-area-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-text-area-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-text-area-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-text-area-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-text-area-accent-soft, var(--vvd-color-neutral-100));\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-600);\n}\n.base.disabled {\n --_low-ink-color: var(--_appearance-color-text);\n cursor: not-allowed;\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n contain: inline-size;\n font: var(--vvd-typography-base);\n grid-column: 1/2;\n grid-row: 1;\n line-height: 20px;\n}\n\n.char-count {\n color: var(--_low-ink-color);\n font: var(--vvd-typography-base);\n grid-column: 2/-1;\n}\n\n.control {\n padding: 8px 16px;\n border: 0 none;\n appearance: none; /* for box-shadow visibility on IOS */\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n grid-column: 1/-1;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n resize: none;\n transition: box-shadow 0.2s, background-color 0.2s, color 0.2s;\n}\n.control:disabled {\n opacity: 1; /* 2. correct opacity on iOS */\n pointer-events: none;\n -webkit-text-fill-color: var(--_appearance-color-text); /* 1. sets text fill to current `color` for safari */\n}\n.control::placeholder, .control:disabled::placeholder {\n opacity: 1; /* 2. correct opacity on iOS */\n pointer-events: none;\n -webkit-text-fill-color: var(--_low-ink-color); /* 1. sets text fill to current `color` for safari */\n}\n.control:focus {\n outline: 2px solid var(--focus-stroke-color, currentColor);\n outline-offset: -2px;\n}\n:host([resize=both]) .control {\n resize: both;\n}\n:host([resize=horizontal]) .control {\n resize: horizontal;\n}\n:host([resize=vertical]) .control {\n resize: vertical;\n}";
81
192
 
82
193
  var __defProp = Object.defineProperty;
83
194
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -90,210 +201,105 @@ var __decorateClass = (decorators, target, key, kind) => {
90
201
  __defProp(target, key, result);
91
202
  return result;
92
203
  };
93
- const safariWorkaroundClassName = "_vvd-3-text-field-safari-workaround";
94
- const safariWorkaroundStyleSheet = new CSSStyleSheet();
95
- safariWorkaroundStyleSheet.replaceSync(`
96
- .${safariWorkaroundClassName}::placeholder {
97
- opacity: 1 !important;
98
- -webkit-text-fill-color: var(--_low-ink-color) !important;
99
- }`);
100
- const installSafariWorkaroundStyle = (forElement) => {
101
- const root = forElement.getRootNode();
102
- if (!root.adoptedStyleSheets.includes(safariWorkaroundStyleSheet)) {
103
- root.adoptedStyleSheets = [...root.adoptedStyleSheets, safariWorkaroundStyleSheet];
104
- }
105
- };
106
- let TextField = class extends TextField$1 {
107
- constructor() {
108
- super(...arguments);
109
- /**
110
- * @internal
111
- */
112
- this._labelEl = null;
113
- }
114
- /**
115
- * @internal
116
- */
117
- labelChanged() {
118
- if (this._labelEl) {
119
- this.#handleLabelChange(this._labelEl);
120
- }
121
- }
122
- #handleLabelChange(labelEl) {
123
- if (!this.label) {
124
- labelEl.remove();
125
- } else {
126
- labelEl.textContent = this.label;
127
- if (!labelEl.isConnected) {
128
- this.appendChild(labelEl);
129
- }
130
- }
131
- }
132
- #reflectToInput;
204
+ let TextArea = class extends TextArea$1 {
205
+ #reflectToTextArea;
133
206
  connectedCallback() {
134
207
  super.connectedCallback();
135
- if (!this.control) {
136
- const uniqueId = this.id || generateRandomId();
137
- const controlId = `vvd-text-field-control-${uniqueId}`;
138
- const input = document.createElement("input");
139
- input.slot = "_control";
140
- input.id = controlId;
141
- input.className = safariWorkaroundClassName;
142
- this.control = input;
143
- this.#reflectToInput = new Reflector(this, input);
144
- this.#reflectToInput.booleanAttribute("autofocus", "autofocus");
145
- this.#reflectToInput.booleanAttribute("disabled", "disabled");
146
- this.#reflectToInput.booleanAttribute("readOnly", "readonly");
147
- this.#reflectToInput.booleanAttribute("required", "required");
148
- this.#reflectToInput.booleanAttribute("spellcheck", "spellcheck");
149
- this.#reflectToInput.attribute("list", "list");
150
- this.#reflectToInput.attribute("maxlength", "maxlength");
151
- this.#reflectToInput.attribute("minlength", "minlength");
152
- this.#reflectToInput.attribute("pattern", "pattern");
153
- this.#reflectToInput.attribute("placeholder", "placeholder");
154
- this.#reflectToInput.attribute("size", "size");
155
- this.#reflectToInput.attribute("autoComplete", "autocomplete");
156
- this.#reflectToInput.attribute("type", "type");
157
- this.#reflectToInput.attribute("ariaAtomic", "aria-atomic");
158
- this.#reflectToInput.attribute("ariaBusy", "aria-busy");
159
- this.#reflectToInput.attribute("ariaControls", "aria-controls");
160
- this.#reflectToInput.attribute("ariaCurrent", "aria-current");
161
- this.#reflectToInput.attribute("ariaDescribedby", "aria-describedby");
162
- this.#reflectToInput.attribute("ariaDetails", "aria-details");
163
- this.#reflectToInput.attribute("ariaDisabled", "aria-disabled");
164
- this.#reflectToInput.attribute("ariaErrormessage", "aria-errormessage");
165
- this.#reflectToInput.attribute("ariaFlowto", "aria-flowto");
166
- this.#reflectToInput.attribute("ariaHaspopup", "aria-haspopup");
167
- this.#reflectToInput.attribute("ariaHidden", "aria-hidden");
168
- this.#reflectToInput.attribute("ariaInvalid", "aria-invalid");
169
- this.#reflectToInput.attribute("ariaKeyshortcuts", "aria-keyshortcuts");
170
- this.#reflectToInput.attribute("ariaLabel", "aria-label");
171
- this.#reflectToInput.attribute("ariaLabelledby", "aria-labelledby");
172
- this.#reflectToInput.attribute("ariaLive", "aria-live");
173
- this.#reflectToInput.attribute("ariaOwns", "aria-owns");
174
- this.#reflectToInput.attribute("ariaRelevant", "aria-relevant");
175
- this.#reflectToInput.attribute("ariaRoledescription", "aria-roledescription");
176
- this.#reflectToInput.property("value", "value", true);
177
- input.addEventListener("input", () => {
178
- this.handleTextInput();
179
- });
180
- input.addEventListener("change", () => {
181
- this.handleChange();
182
- });
183
- input.addEventListener("blur", () => {
184
- this.$emit("blur");
185
- });
186
- input.addEventListener("focus", () => {
187
- this.$emit("focus");
188
- });
189
- this.appendChild(input);
190
- const label = document.createElement("label");
191
- label.slot = "_label";
192
- label.htmlFor = controlId;
193
- this._labelEl = label;
194
- this.#handleLabelChange(label);
195
- installSafariWorkaroundStyle(this);
196
- }
208
+ this.#reflectToTextArea = new Reflector(this, this.control);
209
+ this.#reflectToTextArea.property("value", "value", true);
197
210
  }
198
211
  disconnectedCallback() {
199
212
  super.disconnectedCallback();
200
- this.#reflectToInput.destroy();
201
- }
202
- focus() {
203
- this.control?.focus();
213
+ this.#reflectToTextArea.destroy();
204
214
  }
205
215
  };
206
216
  __decorateClass([
207
217
  attr
208
- ], TextField.prototype, "appearance", 2);
209
- __decorateClass([
210
- attr
211
- ], TextField.prototype, "shape", 2);
212
- __decorateClass([
213
- attr
214
- ], TextField.prototype, "autoComplete", 2);
215
- __decorateClass([
216
- observable
217
- ], TextField.prototype, "actionItemsSlottedContent", 2);
218
- __decorateClass([
219
- observable
220
- ], TextField.prototype, "leadingActionItemsSlottedContent", 2);
221
- TextField = __decorateClass([
218
+ ], TextArea.prototype, "wrap", 2);
219
+ TextArea = __decorateClass([
222
220
  errorText,
223
221
  formElements
224
- ], TextField);
225
- applyMixins(TextField, AffixIcon, FormElementCharCount, FormElementHelperText, FormElementSuccessText);
222
+ ], TextArea);
223
+ applyMixins(TextArea, FormElementCharCount, FormElementHelperText, FormElementSuccessText);
226
224
 
227
- const getStateClasses = ({
228
- errorValidationMessage,
229
- disabled,
230
- value,
231
- readOnly,
232
- placeholder,
233
- appearance,
234
- shape,
235
- label,
236
- successText,
237
- actionItemsSlottedContent,
238
- leadingActionItemsSlottedContent,
239
- icon
240
- }) => classNames(
241
- ["error connotation-alert", Boolean(errorValidationMessage)],
242
- ["disabled", disabled],
243
- ["has-value", Boolean(value)],
225
+ const getClasses = ({ value, errorValidationMessage, disabled, placeholder, readOnly, successText }) => classNames(
226
+ "base",
244
227
  ["readonly", readOnly],
245
228
  ["placeholder", Boolean(placeholder)],
246
- [`appearance-${appearance}`, Boolean(appearance)],
247
- [`shape-${shape}`, Boolean(shape)],
248
- ["no-label", !label],
249
- ["has-icon", !!icon],
250
- ["success connotation-success", Boolean(successText)],
251
- ["action-items", !!actionItemsSlottedContent?.length],
252
- ["leading-action-items", !!leadingActionItemsSlottedContent?.length],
253
- ["no-leading", !(leadingActionItemsSlottedContent?.length || icon)]
229
+ ["disabled", disabled],
230
+ ["error connotation-alert", Boolean(errorValidationMessage)],
231
+ ["has-value", Boolean(value)],
232
+ ["success connotation-success", !!successText]
254
233
  );
234
+ function renderLabel() {
235
+ return html`
236
+ <label for="control" class="label">
237
+ ${(x) => x.label}
238
+ </label>`;
239
+ }
255
240
  function renderCharCount() {
256
241
  return html`
257
242
  <span class="char-count">${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span>
258
243
  `;
259
244
  }
260
- const TextfieldTemplate = (context) => {
261
- const affixIconTemplate = affixIconTemplateFactory(context);
262
- const focusTemplate = focusTemplateFactory(context);
245
+ const TextAreaTemplate = (context) => {
263
246
  return html`
264
- <div class="base ${getStateClasses}">
265
- ${when((x) => x.charCount && x.maxlength, renderCharCount())}
266
- <slot class="label" name="_label"></slot>
267
- <div class="fieldset">
268
- <div class="leading-items-wrapper">
269
- <slot name="leading-action-items" ${slotted("leadingActionItemsSlottedContent")}></slot>
270
- ${(x) => affixIconTemplate(x.icon)}
271
- </div>
272
-
273
- <div class="wrapper">
274
- <slot class="control" name="_control"></slot>
275
- ${() => focusTemplate}
276
- </div>
277
- <div class="action-items-wrapper">
278
- <slot name="action-items" ${slotted("actionItemsSlottedContent")}></slot>
279
- </div>
280
-
281
- </div>
282
- ${when((x) => !x.successText && !x.errorValidationMessage && x.helperText?.length, getFeedbackTemplate("helper", context))}
283
- ${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
284
- ${when((x) => x.successText, getFeedbackTemplate("success", context))}
285
- </div>`;
247
+ <div class="${getClasses}">
248
+ ${when((x) => x.charCount && x.maxlength, renderCharCount())}
249
+ ${when((x) => x.label, renderLabel())}
250
+ <textarea class="control" id="control"
251
+ ?autofocus="${(x) => x.autofocus}"
252
+ placeholder="${(x) => x.placeholder ? x.placeholder : null}"
253
+ name="${(x) => x.name ? x.name : null}"
254
+ minlength="${(x) => x.minlength ? x.minlength : null}"
255
+ maxlength="${(x) => x.maxlength ? x.maxlength : null}"
256
+ rows="${(x) => x.rows ? x.rows : null}"
257
+ cols="${(x) => x.cols ? x.cols : null}"
258
+ wrap="${(x) => x.wrap ? x.wrap : null}"
259
+ ?readonly="${(x) => x.readOnly}"
260
+ ?disabled="${(x) => x.disabled}"
261
+ ?required="${(x) => x.required}"
262
+ ?spellcheck="${(x) => x.spellcheck}"
263
+ aria-atomic="${(x) => x.ariaAtomic}"
264
+ aria-busy="${(x) => x.ariaBusy}"
265
+ aria-controls="${(x) => x.ariaControls}"
266
+ aria-current="${(x) => x.ariaCurrent}"
267
+ aria-describedby="${(x) => x.ariaDescribedby}"
268
+ aria-details="${(x) => x.ariaDetails}"
269
+ aria-disabled="${(x) => x.ariaDisabled}"
270
+ aria-errormessage="${(x) => x.ariaErrormessage}"
271
+ aria-flowto="${(x) => x.ariaFlowto}"
272
+ aria-haspopup="${(x) => x.ariaHaspopup}"
273
+ aria-hidden="${(x) => x.ariaHidden}"
274
+ aria-invalid="${(x) => x.ariaInvalid}"
275
+ aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
276
+ aria-label="${(x) => x.ariaLabel}"
277
+ aria-labelledby="${(x) => x.ariaLabelledby}"
278
+ aria-live="${(x) => x.ariaLive}"
279
+ aria-owns="${(x) => x.ariaOwns}"
280
+ aria-relevant="${(x) => x.ariaRelevant}"
281
+ aria-roledescription="${(x) => x.ariaRoledescription}"
282
+ @input="${(x) => x.handleTextInput()}"
283
+ @change="${(x) => x.handleChange()}"
284
+ ${ref("control")}
285
+ >
286
+ </textarea>
287
+ ${when((x) => !x.successText && !x.errorValidationMessage && x.helperText?.length, getFeedbackTemplate("helper", context))}
288
+ ${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
289
+ ${when((x) => x.successText, getFeedbackTemplate("success", context))}
290
+ </div>
291
+ `;
286
292
  };
287
293
 
288
- const textFieldDefinition = TextField.compose({
289
- baseName: "text-field",
290
- template: TextfieldTemplate,
294
+ const textAreaDefinition = TextArea.compose({
295
+ baseName: "text-area",
296
+ template: TextAreaTemplate,
291
297
  styles,
292
298
  shadowOptions: {
293
299
  delegatesFocus: true
294
300
  }
295
301
  });
296
- const textFieldRegistries = [textFieldDefinition(), ...iconRegistries, ...focusRegistries];
297
- const registerTextField = registerFactory(textFieldRegistries);
302
+ const textAreaRegistries = [textAreaDefinition(), ...iconRegistries, ...focusRegistries];
303
+ const registerTextArea = registerFactory(textAreaRegistries);
298
304
 
299
- export { TextField as T, textFieldRegistries as a, registerTextField as r, textFieldDefinition as t };
305
+ export { textAreaRegistries as a, registerTextArea as r, textAreaDefinition as t };