@vonage/vivid 3.48.0 → 3.49.0-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/accordion/index.cjs +21 -0
  2. package/accordion-item/index.cjs +18 -0
  3. package/action-group/index.cjs +7 -0
  4. package/alert/index.cjs +30 -0
  5. package/appearance-ui/index.cjs +96 -0
  6. package/audio-player/index.cjs +34 -0
  7. package/avatar/index.cjs +11 -0
  8. package/badge/index.cjs +14 -0
  9. package/banner/index.cjs +29 -0
  10. package/breadcrumb/index.cjs +13 -0
  11. package/breadcrumb-item/index.cjs +22 -0
  12. package/button/index.cjs +25 -0
  13. package/calendar/index.cjs +9 -0
  14. package/calendar-event/index.cjs +9 -0
  15. package/card/index.cjs +14 -0
  16. package/checkbox/index.cjs +21 -0
  17. package/combobox/index.cjs +39 -0
  18. package/data-grid/index.cjs +18 -0
  19. package/date-picker/index.cjs +40 -0
  20. package/date-range-picker/index.cjs +40 -0
  21. package/dialog/index.cjs +31 -0
  22. package/divider/index.cjs +8 -0
  23. package/elevation/index.cjs +7 -0
  24. package/empty-state/index.cjs +12 -0
  25. package/fab/index.cjs +22 -0
  26. package/file-picker/index.cjs +30 -0
  27. package/focus/index.cjs +7 -0
  28. package/header/index.cjs +8 -0
  29. package/icon/index.cjs +10 -0
  30. package/index.cjs +296 -0
  31. package/layout/index.cjs +7 -0
  32. package/listbox/index.cjs +77 -0
  33. package/locales/en-GB.cjs +106 -0
  34. package/locales/en-US.cjs +106 -0
  35. package/locales/ja-JP.cjs +106 -0
  36. package/locales/zh-CN.cjs +106 -0
  37. package/menu/index.cjs +32 -0
  38. package/menu-item/index.cjs +22 -0
  39. package/nav/index.cjs +6 -0
  40. package/nav-disclosure/index.cjs +17 -0
  41. package/nav-item/index.cjs +22 -0
  42. package/note/index.cjs +16 -0
  43. package/number-field/index.cjs +33 -0
  44. package/option/index.cjs +23 -0
  45. package/package.json +20 -2
  46. package/pagination/index.cjs +28 -0
  47. package/popup/index.cjs +27 -0
  48. package/progress/index.cjs +9 -0
  49. package/progress-ring/index.cjs +9 -0
  50. package/radio/index.cjs +14 -0
  51. package/radio-group/index.cjs +14 -0
  52. package/select/index.cjs +38 -0
  53. package/selectable-box/index.cjs +25 -0
  54. package/shared/Reflector.cjs +67 -0
  55. package/shared/_has.cjs +62 -0
  56. package/shared/affix.cjs +64 -0
  57. package/shared/affix.js +8 -4
  58. package/shared/anchor.cjs +90 -0
  59. package/shared/anchored.cjs +78 -0
  60. package/shared/apply-mixins.cjs +25 -0
  61. package/shared/aria-global.cjs +74 -0
  62. package/shared/aria.cjs +11 -0
  63. package/shared/aria2.cjs +11 -0
  64. package/shared/base-progress.cjs +72 -0
  65. package/shared/breadcrumb-item.cjs +27 -0
  66. package/shared/button.cjs +202 -0
  67. package/shared/calendar-event.cjs +41 -0
  68. package/shared/children.cjs +61 -0
  69. package/shared/class-names.cjs +17 -0
  70. package/shared/definition.cjs +165 -0
  71. package/shared/definition10.cjs +102 -0
  72. package/shared/definition11.cjs +164 -0
  73. package/shared/definition11.js +38 -36
  74. package/shared/definition12.cjs +50 -0
  75. package/shared/definition13.cjs +779 -0
  76. package/shared/definition14.cjs +157 -0
  77. package/shared/definition15.cjs +249 -0
  78. package/shared/definition16.cjs +746 -0
  79. package/shared/definition17.cjs +1372 -0
  80. package/shared/definition18.cjs +175 -0
  81. package/shared/definition19.cjs +416 -0
  82. package/shared/definition2.cjs +232 -0
  83. package/shared/definition20.cjs +278 -0
  84. package/shared/definition21.cjs +83 -0
  85. package/shared/definition22.cjs +74 -0
  86. package/shared/definition23.cjs +106 -0
  87. package/shared/definition24.cjs +2392 -0
  88. package/shared/definition25.cjs +75 -0
  89. package/shared/definition26.cjs +39 -0
  90. package/shared/definition27.cjs +66 -0
  91. package/shared/definition28.cjs +849 -0
  92. package/shared/definition29.cjs +72 -0
  93. package/shared/definition3.cjs +72 -0
  94. package/shared/definition30.cjs +98 -0
  95. package/shared/definition31.cjs +37 -0
  96. package/shared/definition32.cjs +24 -0
  97. package/shared/definition33.cjs +64 -0
  98. package/shared/definition34.cjs +533 -0
  99. package/shared/definition35.cjs +295 -0
  100. package/shared/definition36.cjs +219 -0
  101. package/shared/definition37.cjs +109 -0
  102. package/shared/definition38.cjs +92 -0
  103. package/shared/definition39.cjs +448 -0
  104. package/shared/definition4.cjs +198 -0
  105. package/shared/definition40.cjs +49 -0
  106. package/shared/definition41.cjs +694 -0
  107. package/shared/definition42.cjs +152 -0
  108. package/shared/definition43.cjs +113 -0
  109. package/shared/definition44.cjs +607 -0
  110. package/shared/definition45.cjs +152 -0
  111. package/shared/definition46.cjs +166 -0
  112. package/shared/definition47.cjs +35 -0
  113. package/shared/definition48.cjs +98 -0
  114. package/shared/definition49.cjs +543 -0
  115. package/shared/definition5.cjs +199 -0
  116. package/shared/definition50.cjs +52 -0
  117. package/shared/definition51.cjs +150 -0
  118. package/shared/definition52.cjs +304 -0
  119. package/shared/definition53.cjs +309 -0
  120. package/shared/definition54.cjs +146 -0
  121. package/shared/definition55.cjs +128 -0
  122. package/shared/definition56.cjs +99 -0
  123. package/shared/definition57.cjs +310 -0
  124. package/shared/definition58.cjs +20 -0
  125. package/shared/definition59.cjs +51 -0
  126. package/shared/definition6.cjs +83 -0
  127. package/shared/definition60.cjs +1810 -0
  128. package/shared/definition7.cjs +72 -0
  129. package/shared/definition8.cjs +152 -0
  130. package/shared/definition9.cjs +69 -0
  131. package/shared/dialog-polyfill.esm.cjs +862 -0
  132. package/shared/direction.cjs +22 -0
  133. package/shared/dom.cjs +23 -0
  134. package/shared/enums.cjs +87 -0
  135. package/shared/focus.cjs +8 -0
  136. package/shared/focus2.cjs +11 -0
  137. package/shared/form-associated.cjs +470 -0
  138. package/shared/icon.cjs +237 -0
  139. package/shared/index.cjs +5061 -0
  140. package/shared/index2.cjs +231 -0
  141. package/shared/key-codes.cjs +115 -0
  142. package/shared/key-codes2.cjs +14 -0
  143. package/shared/listbox.cjs +1072 -0
  144. package/shared/localized.cjs +11 -0
  145. package/shared/numbers.cjs +38 -0
  146. package/shared/patterns/affix.d.ts +5 -1
  147. package/shared/presentationDate.cjs +6192 -0
  148. package/shared/radio.cjs +153 -0
  149. package/shared/ref.cjs +43 -0
  150. package/shared/repeat.cjs +767 -0
  151. package/shared/select.options.cjs +12 -0
  152. package/shared/slotted.cjs +123 -0
  153. package/shared/start-end.cjs +52 -0
  154. package/shared/strings.cjs +11 -0
  155. package/shared/text-anchor.cjs +33 -0
  156. package/shared/text-anchor.template.cjs +48 -0
  157. package/shared/text-field.cjs +5 -0
  158. package/shared/text-field2.cjs +228 -0
  159. package/shared/tree-item.cjs +154 -0
  160. package/shared/when.cjs +31 -0
  161. package/side-drawer/index.cjs +8 -0
  162. package/slider/index.cjs +16 -0
  163. package/split-button/index.cjs +20 -0
  164. package/styles/core/all.css +1 -1
  165. package/styles/core/theme.css +1 -1
  166. package/styles/core/typography.css +1 -1
  167. package/styles/tokens/theme-dark.css +4 -4
  168. package/styles/tokens/theme-light.css +4 -4
  169. package/styles/tokens/vivid-2-compat.css +1 -1
  170. package/switch/index.cjs +15 -0
  171. package/tab/index.cjs +17 -0
  172. package/tab-panel/index.cjs +6 -0
  173. package/tabs/index.cjs +24 -0
  174. package/tag/index.cjs +17 -0
  175. package/tag-group/index.cjs +7 -0
  176. package/text-anchor/index.cjs +24 -0
  177. package/text-area/index.cjs +25 -0
  178. package/text-field/index.cjs +27 -0
  179. package/toggletip/index.cjs +29 -0
  180. package/tooltip/index.cjs +29 -0
  181. package/tree-item/index.cjs +22 -0
  182. package/tree-view/index.cjs +14 -0
@@ -0,0 +1,304 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const definition = require('./definition26.cjs');
5
+ const definition$1 = require('./definition58.cjs');
6
+ require('./affix.cjs');
7
+ const index$1 = require('./index2.cjs');
8
+ const Reflector = require('./Reflector.cjs');
9
+ const textField = require('./text-field2.cjs');
10
+ const applyMixins = require('./apply-mixins.cjs');
11
+ const formAssociated = require('./form-associated.cjs');
12
+ const when = require('./when.cjs');
13
+ const ref = require('./ref.cjs');
14
+ const classNames = require('./class-names.cjs');
15
+
16
+ class _TextArea extends index.FoundationElement {
17
+ }
18
+ /**
19
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(TextArea:class)} component.
20
+ *
21
+ * @internal
22
+ */
23
+ class FormAssociatedTextArea extends formAssociated.FormAssociated(_TextArea) {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.proxy = document.createElement("textarea");
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Resize mode for a TextArea
32
+ * @public
33
+ */
34
+ const TextAreaResize = {
35
+ /**
36
+ * No resize.
37
+ */
38
+ none: "none",
39
+ /**
40
+ * Resize vertically and horizontally.
41
+ */
42
+ both: "both",
43
+ /**
44
+ * Resize horizontally.
45
+ */
46
+ horizontal: "horizontal",
47
+ /**
48
+ * Resize vertically.
49
+ */
50
+ vertical: "vertical",
51
+ };
52
+
53
+ /**
54
+ * A Text Area Custom HTML Element.
55
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea | <textarea> element }.
56
+ *
57
+ * @slot - The default slot for the label
58
+ * @csspart label - The label
59
+ * @csspart root - The element wrapping the control
60
+ * @csspart control - The textarea element
61
+ * @fires change - Emits a custom 'change' event when the textarea emits a change event
62
+ *
63
+ * @public
64
+ */
65
+ let TextArea$1 = class TextArea extends FormAssociatedTextArea {
66
+ constructor() {
67
+ super(...arguments);
68
+ /**
69
+ * The resize mode of the element.
70
+ * @public
71
+ * @remarks
72
+ * HTML Attribute: resize
73
+ */
74
+ this.resize = TextAreaResize.none;
75
+ /**
76
+ * Sizes the element horizontally by a number of character columns.
77
+ *
78
+ * @public
79
+ * @remarks
80
+ * HTML Attribute: cols
81
+ */
82
+ this.cols = 20;
83
+ /**
84
+ * @internal
85
+ */
86
+ this.handleTextInput = () => {
87
+ this.value = this.control.value;
88
+ };
89
+ }
90
+ readOnlyChanged() {
91
+ if (this.proxy instanceof HTMLTextAreaElement) {
92
+ this.proxy.readOnly = this.readOnly;
93
+ }
94
+ }
95
+ autofocusChanged() {
96
+ if (this.proxy instanceof HTMLTextAreaElement) {
97
+ this.proxy.autofocus = this.autofocus;
98
+ }
99
+ }
100
+ listChanged() {
101
+ if (this.proxy instanceof HTMLTextAreaElement) {
102
+ this.proxy.setAttribute("list", this.list);
103
+ }
104
+ }
105
+ maxlengthChanged() {
106
+ if (this.proxy instanceof HTMLTextAreaElement) {
107
+ this.proxy.maxLength = this.maxlength;
108
+ }
109
+ }
110
+ minlengthChanged() {
111
+ if (this.proxy instanceof HTMLTextAreaElement) {
112
+ this.proxy.minLength = this.minlength;
113
+ }
114
+ }
115
+ spellcheckChanged() {
116
+ if (this.proxy instanceof HTMLTextAreaElement) {
117
+ this.proxy.spellcheck = this.spellcheck;
118
+ }
119
+ }
120
+ /**
121
+ * Selects all the text in the text area
122
+ *
123
+ * @public
124
+ */
125
+ select() {
126
+ this.control.select();
127
+ /**
128
+ * The select event does not permeate the shadow DOM boundary.
129
+ * This fn effectively proxies the select event,
130
+ * emitting a `select` event whenever the internal
131
+ * control emits a `select` event
132
+ */
133
+ this.$emit("select");
134
+ }
135
+ /**
136
+ * Change event handler for inner control.
137
+ * @remarks
138
+ * "Change" events are not `composable` so they will not
139
+ * permeate the shadow DOM boundary. This fn effectively proxies
140
+ * the change event, emitting a `change` event whenever the internal
141
+ * control emits a `change` event
142
+ * @internal
143
+ */
144
+ handleChange() {
145
+ this.$emit("change");
146
+ }
147
+ /** {@inheritDoc (FormAssociated:interface).validate} */
148
+ validate() {
149
+ super.validate(this.control);
150
+ }
151
+ };
152
+ index.__decorate([
153
+ index.attr({ mode: "boolean" })
154
+ ], TextArea$1.prototype, "readOnly", void 0);
155
+ index.__decorate([
156
+ index.attr
157
+ ], TextArea$1.prototype, "resize", void 0);
158
+ index.__decorate([
159
+ index.attr({ mode: "boolean" })
160
+ ], TextArea$1.prototype, "autofocus", void 0);
161
+ index.__decorate([
162
+ index.attr({ attribute: "form" })
163
+ ], TextArea$1.prototype, "formId", void 0);
164
+ index.__decorate([
165
+ index.attr
166
+ ], TextArea$1.prototype, "list", void 0);
167
+ index.__decorate([
168
+ index.attr({ converter: index.nullableNumberConverter })
169
+ ], TextArea$1.prototype, "maxlength", void 0);
170
+ index.__decorate([
171
+ index.attr({ converter: index.nullableNumberConverter })
172
+ ], TextArea$1.prototype, "minlength", void 0);
173
+ index.__decorate([
174
+ index.attr
175
+ ], TextArea$1.prototype, "name", void 0);
176
+ index.__decorate([
177
+ index.attr
178
+ ], TextArea$1.prototype, "placeholder", void 0);
179
+ index.__decorate([
180
+ index.attr({ converter: index.nullableNumberConverter, mode: "fromView" })
181
+ ], TextArea$1.prototype, "cols", void 0);
182
+ index.__decorate([
183
+ index.attr({ converter: index.nullableNumberConverter, mode: "fromView" })
184
+ ], TextArea$1.prototype, "rows", void 0);
185
+ index.__decorate([
186
+ index.attr({ mode: "boolean" })
187
+ ], TextArea$1.prototype, "spellcheck", void 0);
188
+ index.__decorate([
189
+ index.observable
190
+ ], TextArea$1.prototype, "defaultSlottedNodes", void 0);
191
+ applyMixins.applyMixins(TextArea$1, textField.DelegatesARIATextbox);
192
+
193
+ const styles = ":host{display:inline-block}.base{display:inline-grid;grid-template-columns:1fr max-content;inline-size:100%;row-gap:4px}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--_connotation-color-backdrop);--_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(--_connotation-color-backdrop);--_appearance-color-outline: var(--_connotation-color-firm)}.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-backdrop: var(--vvd-text-area-success-backdrop, var(--vvd-color-success-50));--_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-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-backdrop: var(--vvd-text-area-alert-backdrop, var(--vvd-color-alert-50));--_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-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-backdrop: var(--vvd-text-area-accent-backdrop, var(--vvd-color-canvas));--_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-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;appearance:none;background-color:var(--_appearance-color-fill);border-radius:8px;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}.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{outline:2px solid var(--focus-stroke-color, currentColor);outline-offset:-2px}:host([resize=both]) .control{resize:both}:host([resize=horizontal]) .control{resize:horizontal}:host([resize=vertical]) .control{resize:vertical}\n";
194
+
195
+ var __defProp = Object.defineProperty;
196
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
197
+ var __decorateClass = (decorators, target, key, kind) => {
198
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
199
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
200
+ if (decorator = decorators[i])
201
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
202
+ if (kind && result)
203
+ __defProp(target, key, result);
204
+ return result;
205
+ };
206
+ let TextArea = class extends TextArea$1 {
207
+ #reflectToTextArea;
208
+ connectedCallback() {
209
+ super.connectedCallback();
210
+ this.#reflectToTextArea = new Reflector.Reflector(this, this.control);
211
+ this.#reflectToTextArea.property("value", "value", true);
212
+ }
213
+ disconnectedCallback() {
214
+ super.disconnectedCallback();
215
+ this.#reflectToTextArea.destroy();
216
+ }
217
+ };
218
+ __decorateClass([
219
+ index.attr
220
+ ], TextArea.prototype, "wrap", 2);
221
+ TextArea = __decorateClass([
222
+ index$1.errorText,
223
+ index$1.formElements
224
+ ], TextArea);
225
+ applyMixins.applyMixins(TextArea, index$1.FormElementCharCount, index$1.FormElementHelperText, index$1.FormElementSuccessText);
226
+
227
+ const getClasses = ({ value, errorValidationMessage, disabled, placeholder, readOnly, successText }) => classNames.classNames(
228
+ "base",
229
+ ["readonly", readOnly],
230
+ ["placeholder", Boolean(placeholder)],
231
+ ["disabled", disabled],
232
+ ["error", Boolean(errorValidationMessage)],
233
+ ["has-value", Boolean(value)],
234
+ ["success", !!successText]
235
+ );
236
+ function renderLabel() {
237
+ return index.html`
238
+ <label for="control" class="label">
239
+ ${(x) => x.label}
240
+ </label>`;
241
+ }
242
+ function renderCharCount() {
243
+ return index.html`
244
+ <span class="char-count">${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span>
245
+ `;
246
+ }
247
+ const TextAreaTemplate = (context) => {
248
+ return index.html`
249
+ <div class="${getClasses}">
250
+ ${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
251
+ ${when.when((x) => x.label, renderLabel())}
252
+ <textarea class="control" id="control"
253
+ ?autofocus="${(x) => x.autofocus}"
254
+ placeholder="${(x) => x.placeholder ? x.placeholder : null}"
255
+ name="${(x) => x.name ? x.name : null}"
256
+ minlength="${(x) => x.minlength ? x.minlength : null}"
257
+ maxlength="${(x) => x.maxlength ? x.maxlength : null}"
258
+ rows="${(x) => x.rows ? x.rows : null}"
259
+ cols="${(x) => x.cols ? x.cols : null}"
260
+ wrap="${(x) => x.wrap ? x.wrap : null}"
261
+ ?readonly="${(x) => x.readOnly}"
262
+ ?disabled="${(x) => x.disabled}"
263
+ ?required="${(x) => x.required}"
264
+ ?spellcheck="${(x) => x.spellcheck}"
265
+ aria-atomic="${(x) => x.ariaAtomic}"
266
+ aria-busy="${(x) => x.ariaBusy}"
267
+ aria-current="${(x) => x.ariaCurrent}"
268
+ aria-details="${(x) => x.ariaDetails}"
269
+ aria-disabled="${(x) => x.ariaDisabled}"
270
+ aria-errormessage="${(x) => x.ariaErrormessage}"
271
+ aria-haspopup="${(x) => x.ariaHaspopup}"
272
+ aria-hidden="${(x) => x.ariaHidden}"
273
+ aria-invalid="${(x) => x.ariaInvalid}"
274
+ aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
275
+ aria-label="${(x) => x.ariaLabel}"
276
+ aria-live="${(x) => x.ariaLive}"
277
+ aria-relevant="${(x) => x.ariaRelevant}"
278
+ aria-roledescription="${(x) => x.ariaRoledescription}"
279
+ @input="${(x) => x.handleTextInput()}"
280
+ @change="${(x) => x.handleChange()}"
281
+ ${ref.ref("control")}
282
+ >
283
+ </textarea>
284
+ ${when.when((x) => !x.successText && !x.errorValidationMessage && x.helperText?.length, index$1.getFeedbackTemplate("helper", context))}
285
+ ${when.when((x) => !x.successText && x.errorValidationMessage, index$1.getFeedbackTemplate("error", context))}
286
+ ${when.when((x) => x.successText, index$1.getFeedbackTemplate("success", context))}
287
+ </div>
288
+ `;
289
+ };
290
+
291
+ const textAreaDefinition = TextArea.compose({
292
+ baseName: "text-area",
293
+ template: TextAreaTemplate,
294
+ styles,
295
+ shadowOptions: {
296
+ delegatesFocus: true
297
+ }
298
+ });
299
+ const textAreaRegistries = [textAreaDefinition(), ...definition.iconRegistries, ...definition$1.focusRegistries];
300
+ const registerTextArea = index.registerFactory(textAreaRegistries);
301
+
302
+ exports.registerTextArea = registerTextArea;
303
+ exports.textAreaDefinition = textAreaDefinition;
304
+ exports.textAreaRegistries = textAreaRegistries;
@@ -0,0 +1,309 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const definition$1 = require('./definition58.cjs');
5
+ const definition = require('./definition26.cjs');
6
+ const affix = require('./affix.cjs');
7
+ const index$1 = require('./index2.cjs');
8
+ const Reflector = require('./Reflector.cjs');
9
+ const icon = require('./icon.cjs');
10
+ const textField = require('./text-field2.cjs');
11
+ const applyMixins = require('./apply-mixins.cjs');
12
+ const textField$1 = require('./text-field.cjs');
13
+ const focus = require('./focus2.cjs');
14
+ const when = require('./when.cjs');
15
+ const slotted = require('./slotted.cjs');
16
+ const classNames = require('./class-names.cjs');
17
+
18
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
19
+ // require the crypto API and do not support built-in fallback to lower quality random number
20
+ // generators (like Math.random()).
21
+ let getRandomValues;
22
+ const rnds8 = new Uint8Array(16);
23
+ function rng() {
24
+ // lazy load so that environments that need to polyfill have a chance to do so
25
+ if (!getRandomValues) {
26
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
27
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
28
+
29
+ if (!getRandomValues) {
30
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
31
+ }
32
+ }
33
+
34
+ return getRandomValues(rnds8);
35
+ }
36
+
37
+ /**
38
+ * Convert array of 16 byte values to UUID string format of the form:
39
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
40
+ */
41
+
42
+ const byteToHex = [];
43
+
44
+ for (let i = 0; i < 256; ++i) {
45
+ byteToHex.push((i + 0x100).toString(16).slice(1));
46
+ }
47
+
48
+ function unsafeStringify(arr, offset = 0) {
49
+ // Note: Be careful editing this code! It's been tuned for performance
50
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
51
+ 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]];
52
+ }
53
+
54
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
55
+ const native = {
56
+ randomUUID
57
+ };
58
+
59
+ function v4(options, buf, offset) {
60
+ if (native.randomUUID && !buf && !options) {
61
+ return native.randomUUID();
62
+ }
63
+
64
+ options = options || {};
65
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
66
+
67
+ rnds[6] = rnds[6] & 0x0f | 0x40;
68
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
69
+
70
+ if (buf) {
71
+ offset = offset || 0;
72
+
73
+ for (let i = 0; i < 16; ++i) {
74
+ buf[offset + i] = rnds[i];
75
+ }
76
+
77
+ return buf;
78
+ }
79
+
80
+ return unsafeStringify(rnds);
81
+ }
82
+
83
+ const generateRandomId = () => v4();
84
+
85
+ var __defProp = Object.defineProperty;
86
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
87
+ var __decorateClass = (decorators, target, key, kind) => {
88
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
89
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
90
+ if (decorator = decorators[i])
91
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
92
+ if (kind && result)
93
+ __defProp(target, key, result);
94
+ return result;
95
+ };
96
+ const safariWorkaroundClassName = "_vvd-3-text-field-safari-workaround";
97
+ const getSafariWorkaroundStyleSheet = icon.memoizeWith(() => "", () => {
98
+ const styleSheet = new CSSStyleSheet();
99
+ const supportsReplaceSync = "replaceSync" in styleSheet;
100
+ if (supportsReplaceSync) {
101
+ styleSheet.replaceSync(`
102
+ .${safariWorkaroundClassName}::placeholder {
103
+ opacity: 1 !important;
104
+ -webkit-text-fill-color: var(--_low-ink-color) !important;
105
+ }`);
106
+ }
107
+ return styleSheet;
108
+ });
109
+ const installSafariWorkaroundStyle = (forElement) => {
110
+ const root = forElement.getRootNode();
111
+ const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
112
+ const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
113
+ if (!supportsAdoptedStyleSheets) {
114
+ return;
115
+ }
116
+ if (!root.adoptedStyleSheets.includes(workaroundStyleSheet)) {
117
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, workaroundStyleSheet];
118
+ }
119
+ };
120
+ exports.TextField = class TextField extends textField.TextField {
121
+ constructor() {
122
+ super(...arguments);
123
+ /**
124
+ * @internal
125
+ */
126
+ this._labelEl = null;
127
+ }
128
+ /**
129
+ * @internal
130
+ */
131
+ labelChanged() {
132
+ if (this._labelEl) {
133
+ this.#handleLabelChange(this._labelEl);
134
+ }
135
+ }
136
+ #handleLabelChange(labelEl) {
137
+ if (!this.label) {
138
+ labelEl.remove();
139
+ } else {
140
+ labelEl.textContent = this.label;
141
+ if (!labelEl.isConnected) {
142
+ this.appendChild(labelEl);
143
+ }
144
+ }
145
+ }
146
+ #reflectToInput;
147
+ connectedCallback() {
148
+ super.connectedCallback();
149
+ if (!this.control) {
150
+ const uniqueId = this.id || generateRandomId();
151
+ const controlId = `vvd-text-field-control-${uniqueId}`;
152
+ const input = document.createElement("input");
153
+ input.slot = "_control";
154
+ input.id = controlId;
155
+ input.className = safariWorkaroundClassName;
156
+ this.control = input;
157
+ this.#reflectToInput = new Reflector.Reflector(this, input);
158
+ this.#reflectToInput.booleanAttribute("autofocus", "autofocus");
159
+ this.#reflectToInput.booleanAttribute("disabled", "disabled");
160
+ this.#reflectToInput.booleanAttribute("readOnly", "readonly");
161
+ this.#reflectToInput.booleanAttribute("required", "required");
162
+ this.#reflectToInput.booleanAttribute("spellcheck", "spellcheck");
163
+ this.#reflectToInput.attribute("list", "list");
164
+ this.#reflectToInput.attribute("maxlength", "maxlength");
165
+ this.#reflectToInput.attribute("minlength", "minlength");
166
+ this.#reflectToInput.attribute("pattern", "pattern");
167
+ this.#reflectToInput.attribute("placeholder", "placeholder");
168
+ this.#reflectToInput.attribute("size", "size");
169
+ this.#reflectToInput.attribute("autoComplete", "autocomplete");
170
+ this.#reflectToInput.attribute("type", "type");
171
+ this.#reflectToInput.attribute("ariaAtomic", "aria-atomic");
172
+ this.#reflectToInput.attribute("ariaBusy", "aria-busy");
173
+ this.#reflectToInput.attribute("ariaCurrent", "aria-current");
174
+ this.#reflectToInput.attribute("ariaDetails", "aria-details");
175
+ this.#reflectToInput.attribute("ariaDisabled", "aria-disabled");
176
+ this.#reflectToInput.attribute("ariaHaspopup", "aria-haspopup");
177
+ this.#reflectToInput.attribute("ariaHidden", "aria-hidden");
178
+ this.#reflectToInput.attribute("ariaInvalid", "aria-invalid");
179
+ this.#reflectToInput.attribute("ariaKeyshortcuts", "aria-keyshortcuts");
180
+ this.#reflectToInput.attribute("ariaLabel", "aria-label");
181
+ this.#reflectToInput.attribute("ariaLive", "aria-live");
182
+ this.#reflectToInput.attribute("ariaRelevant", "aria-relevant");
183
+ this.#reflectToInput.attribute("ariaRoledescription", "aria-roledescription");
184
+ this.#reflectToInput.property("value", "value", true);
185
+ input.addEventListener("input", () => {
186
+ this.handleTextInput();
187
+ });
188
+ input.addEventListener("change", () => {
189
+ this.handleChange();
190
+ });
191
+ input.addEventListener("blur", () => {
192
+ this.$emit("blur");
193
+ });
194
+ input.addEventListener("focus", () => {
195
+ this.$emit("focus");
196
+ });
197
+ this.appendChild(input);
198
+ const label = document.createElement("label");
199
+ label.slot = "_label";
200
+ label.htmlFor = controlId;
201
+ this._labelEl = label;
202
+ this.#handleLabelChange(label);
203
+ installSafariWorkaroundStyle(this);
204
+ }
205
+ }
206
+ disconnectedCallback() {
207
+ super.disconnectedCallback();
208
+ this.#reflectToInput.destroy();
209
+ }
210
+ focus() {
211
+ this.control?.focus();
212
+ }
213
+ };
214
+ __decorateClass([
215
+ index.attr
216
+ ], exports.TextField.prototype, "appearance", 2);
217
+ __decorateClass([
218
+ index.attr
219
+ ], exports.TextField.prototype, "shape", 2);
220
+ __decorateClass([
221
+ index.attr
222
+ ], exports.TextField.prototype, "autoComplete", 2);
223
+ __decorateClass([
224
+ index.observable
225
+ ], exports.TextField.prototype, "actionItemsSlottedContent", 2);
226
+ __decorateClass([
227
+ index.observable
228
+ ], exports.TextField.prototype, "leadingActionItemsSlottedContent", 2);
229
+ exports.TextField = __decorateClass([
230
+ index$1.errorText,
231
+ index$1.formElements
232
+ ], exports.TextField);
233
+ applyMixins.applyMixins(exports.TextField, affix.AffixIcon, index$1.FormElementCharCount, index$1.FormElementHelperText, index$1.FormElementSuccessText);
234
+
235
+ const getStateClasses = ({
236
+ errorValidationMessage,
237
+ disabled,
238
+ value,
239
+ readOnly,
240
+ placeholder,
241
+ appearance,
242
+ shape,
243
+ label,
244
+ successText,
245
+ actionItemsSlottedContent,
246
+ leadingActionItemsSlottedContent,
247
+ icon
248
+ }) => classNames.classNames(
249
+ ["error", Boolean(errorValidationMessage)],
250
+ ["disabled", disabled],
251
+ ["has-value", Boolean(value)],
252
+ ["readonly", readOnly],
253
+ ["placeholder", Boolean(placeholder)],
254
+ [`appearance-${appearance}`, Boolean(appearance)],
255
+ [`shape-${shape}`, Boolean(shape)],
256
+ ["no-label", !label],
257
+ ["has-icon", !!icon],
258
+ ["success", Boolean(successText)],
259
+ ["action-items", !!actionItemsSlottedContent?.length],
260
+ ["leading-action-items", !!leadingActionItemsSlottedContent?.length],
261
+ ["no-leading", !(leadingActionItemsSlottedContent?.length || icon)]
262
+ );
263
+ function renderCharCount() {
264
+ return index.html`
265
+ <span class="char-count">${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span>
266
+ `;
267
+ }
268
+ const TextfieldTemplate = (context) => {
269
+ const affixIconTemplate = affix.affixIconTemplateFactory(context);
270
+ const focusTemplate = focus.focusTemplateFactory(context);
271
+ return index.html`
272
+ <div class="base ${getStateClasses}">
273
+ ${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
274
+ <slot class="label" name="_label"></slot>
275
+ <div class="fieldset">
276
+ <div class="leading-items-wrapper">
277
+ <slot name="leading-action-items" ${slotted.slotted("leadingActionItemsSlottedContent")}></slot>
278
+ ${(x) => affixIconTemplate(x.icon)}
279
+ </div>
280
+
281
+ <div class="wrapper">
282
+ <slot class="control" name="_control"></slot>
283
+ ${() => focusTemplate}
284
+ </div>
285
+ <div class="action-items-wrapper">
286
+ <slot name="action-items" ${slotted.slotted("actionItemsSlottedContent")}></slot>
287
+ </div>
288
+
289
+ </div>
290
+ ${when.when((x) => !x.successText && !x.errorValidationMessage && x.helperText?.length, index$1.getFeedbackTemplate("helper", context))}
291
+ ${when.when((x) => !x.successText && x.errorValidationMessage, index$1.getFeedbackTemplate("error", context))}
292
+ ${when.when((x) => x.successText, index$1.getFeedbackTemplate("success", context))}
293
+ </div>`;
294
+ };
295
+
296
+ const textFieldDefinition = exports.TextField.compose({
297
+ baseName: "text-field",
298
+ template: TextfieldTemplate,
299
+ styles: textField$1.styles,
300
+ shadowOptions: {
301
+ delegatesFocus: true
302
+ }
303
+ });
304
+ const textFieldRegistries = [textFieldDefinition(), ...definition.iconRegistries, ...definition$1.focusRegistries];
305
+ const registerTextField = index.registerFactory(textFieldRegistries);
306
+
307
+ exports.registerTextField = registerTextField;
308
+ exports.textFieldDefinition = textFieldDefinition;
309
+ exports.textFieldRegistries = textFieldRegistries;