@momentum-design/components 0.32.0 → 0.33.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.
@@ -0,0 +1,432 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { html, nothing } from 'lit';
11
+ import { ifDefined } from 'lit/directives/if-defined.js';
12
+ import { property, query } from 'lit/decorators.js';
13
+ import styles from './textarea.styles';
14
+ import FormfieldWrapper from '../formfieldwrapper';
15
+ import { DEFAULTS as FORMFIELD_DEFAULTS, VALIDATION } from '../formfieldwrapper/formfieldwrapper.constants';
16
+ import { AUTO_CAPITALIZE } from '../input/input.constants';
17
+ import { AUTO_COMPLETE, WRAP, DEFAULTS } from './textarea.constants';
18
+ import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
19
+ import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
20
+ /**
21
+ * mdc-textarea component, which is used to get the multi-line text input from the user.
22
+ * It contains:
23
+ * - label: It is the title of the textarea field.
24
+ * - required-label: A string depicting that the textarea field is required.
25
+ * - Textarea: It is the multi-line text input field.
26
+ * - helper-text: It is the text that provides additional information about the textarea field.
27
+ * - max-character-limit: It is the text that shows the character count of the textarea field.
28
+ * - clear-button: A boolean value when marked to true represents a button that can
29
+ * clear the text value within the textarea field.
30
+ * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information
31
+ * about the textarea field based on the validation state.
32
+ * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.
33
+ * This event exposes 3 properties:
34
+ * - currentCharacterCount - the current number of characters in the textarea field,
35
+ * - maxCharacterLimit - the maximum number of characters allowed in the textarea field,
36
+ * - value - the current value of the textarea field,
37
+ *
38
+ * **Note**: Consumers must set the help-text-type with 'error' and
39
+ * help-text attribute with the error message using limitexceeded event.
40
+ * The same help-text value will be used for the validation message to be displayed.
41
+ *
42
+ * @tagname mdc-textarea
43
+ *
44
+ * @event input - (React: onInput) This event is dispatched when the value of the textarea field changes (every press).
45
+ * @event change - (React: onChange) This event is dispatched when the value of the textarea field changes (on blur).
46
+ * @event focus - (React: onFocus) This event is dispatched when the textarea receives focus.
47
+ * @event blur - (React: onBlur) This event is dispatched when the textarea loses focus.
48
+ * @event limitexceeded - (React: onLimitExceeded) This event is dispatched once when the character limit
49
+ * exceeds or restored.
50
+ *
51
+ *
52
+ * @dependency mdc-icon
53
+ * @dependency mdc-text
54
+ * @dependency mdc-button
55
+ *
56
+ * @cssproperty --mdc-textarea-disabled-border-color - Border color for the textarea container when disabled
57
+ * @cssproperty --mdc-textarea-disabled-text-color - Text color for the textarea field when disabled
58
+ * @cssproperty --mdc-textarea-disabled-background-color - Background color for the textarea field when disabled
59
+ * @cssproperty --mdc-textarea-text-color - Text color for the textarea field
60
+ * @cssproperty --mdc-textarea-background-color - Background color for the textarea field
61
+ * @cssproperty --mdc-textarea-border-color - Border color for the textarea field
62
+ * @cssproperty --mdc-textarea-text-secondary-normal - Text color for the character counter
63
+ * @cssproperty --mdc-textarea-error-border-color - Border color for the error related help text
64
+ * @cssproperty --mdc-textarea-warning-border-color - Border color for the warning related help text
65
+ * @cssproperty --mdc-textarea-success-border-color - Border color for the success related help text
66
+ * @cssproperty --mdc-textarea-primary-border-color - Border color for the priority related help text
67
+ * @cssproperty --mdc-textarea-hover-background-color - Background color for the textarea container when hover
68
+ * @cssproperty --mdc-textarea-focused-background-color - Background color for the textarea container when focused
69
+ * @cssproperty --mdc-textarea-focused-border-color - Border color for the textarea container when focused
70
+ */
71
+ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
72
+ get textarea() {
73
+ return this.inputElement;
74
+ }
75
+ constructor() {
76
+ var _a;
77
+ super();
78
+ /**
79
+ * readonly attribute of the textarea field. If true, the textarea field is read-only.
80
+ * @default false
81
+ */
82
+ this.readonly = false;
83
+ /**
84
+ * The rows attribute specifies the visible number of lines in a text area.
85
+ * @default 5
86
+ */
87
+ this.rows = DEFAULTS.ROWS;
88
+ /**
89
+ * The cols attribute specifies the visible number of lines in a text area.
90
+ * @default 40
91
+ */
92
+ this.cols = DEFAULTS.COLS;
93
+ /**
94
+ * The wrap attribute specifies how the text in a text area is to be wrapped when submitted in a form.
95
+ * @default 'soft'
96
+ */
97
+ this.wrap = WRAP.SOFT;
98
+ /**
99
+ * The autocapitalize attribute of the textarea field.
100
+ * @default 'off'
101
+ */
102
+ this.autocapitalize = AUTO_CAPITALIZE.OFF;
103
+ /**
104
+ * The autocomplete attribute of the textarea field.
105
+ * @default 'off'
106
+ */
107
+ this.autocomplete = AUTO_COMPLETE.OFF;
108
+ /**
109
+ * If true, the textarea field is focused when the component is rendered.
110
+ * @default false
111
+ */
112
+ this.autofocus = false;
113
+ /**
114
+ * The clear button when set to true, shows a clear button that clears the textarea field.
115
+ * @default false
116
+ */
117
+ this.clearButton = false;
118
+ /**
119
+ * Aria label for the clear button. If clear button is set to true, this label is used for the clear button.
120
+ * @default ''
121
+ */
122
+ this.clearAriaLabel = '';
123
+ this.characterLimitExceedingFired = false;
124
+ // Set the default value to the textarea field if the value is set through the text content directly
125
+ this.value = ((_a = this.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || this.value;
126
+ }
127
+ connectedCallback() {
128
+ super.connectedCallback();
129
+ this.updateComplete.then(() => {
130
+ if (this.textarea) {
131
+ this.textarea.checkValidity();
132
+ this.setTextareaValidity();
133
+ this.internals.setFormValue(this.textarea.value);
134
+ }
135
+ }).catch((error) => {
136
+ if (this.onerror) {
137
+ this.onerror(error);
138
+ }
139
+ });
140
+ }
141
+ setTextareaValidity() {
142
+ if (this.requiredLabel && this.validationMessage && this.value === '') {
143
+ this.textarea.setCustomValidity(this.validationMessage);
144
+ }
145
+ else if (this.maxCharacterLimit
146
+ && this.value.length > this.maxCharacterLimit
147
+ && this.helpTextType === VALIDATION.ERROR
148
+ && this.helpText) {
149
+ // Set custom validity if the character limit is exceeded to stop form submission
150
+ // helptext and helptexttype will be set by the consumers.
151
+ this.textarea.setCustomValidity(this.helpText);
152
+ }
153
+ else {
154
+ this.textarea.setCustomValidity('');
155
+ }
156
+ this.setValidity();
157
+ }
158
+ /** @internal */
159
+ formResetCallback() {
160
+ this.value = '';
161
+ this.requestUpdate();
162
+ }
163
+ /** @internal */
164
+ formStateRestoreCallback(state) {
165
+ this.value = state;
166
+ }
167
+ /**
168
+ * Handles the value change of the textarea field.
169
+ * Sets the form value and updates the validity of the textarea field.
170
+ * @returns void
171
+ */
172
+ handleValueChange() {
173
+ this.updateComplete.then(() => {
174
+ this.setTextareaValidity();
175
+ }).catch((error) => {
176
+ if (this.onerror) {
177
+ this.onerror(error);
178
+ }
179
+ });
180
+ }
181
+ updated(changedProperties) {
182
+ super.updated(changedProperties);
183
+ if (changedProperties.has('value')) {
184
+ this.handleValueChange();
185
+ this.handleCharacterOverflowStateChange();
186
+ }
187
+ }
188
+ /**
189
+ * This function is called when the attribute changes.
190
+ * It updates the validity of the textarea field based on the textarea field's validity.
191
+ *
192
+ * @param name - attribute name
193
+ * @param old - old value
194
+ * @param value - new value
195
+ */
196
+ attributeChangedCallback(name, old, value) {
197
+ super.attributeChangedCallback(name, old, value);
198
+ const validationRelatedAttributes = [
199
+ 'maxlength',
200
+ 'minlength',
201
+ 'required',
202
+ ];
203
+ if (validationRelatedAttributes.includes(name)) {
204
+ this.updateComplete.then(() => {
205
+ this.setTextareaValidity();
206
+ }).catch((error) => {
207
+ if (this.onerror) {
208
+ this.onerror(error);
209
+ }
210
+ });
211
+ }
212
+ }
213
+ /**
214
+ * Dispatches the character overflow state change event.
215
+ * @returns void
216
+ */
217
+ dispatchCharacterOverflowStateChangeEvent() {
218
+ this.dispatchEvent(new CustomEvent('limitexceeded', {
219
+ detail: {
220
+ currentCharacterCount: this.value.length,
221
+ maxCharacterLimit: this.maxCharacterLimit,
222
+ value: this.value,
223
+ },
224
+ bubbles: true,
225
+ composed: true,
226
+ }));
227
+ }
228
+ /**
229
+ * Handles the character overflow state change.
230
+ * Dispatches the character overflow state change event if the character limit is exceeded or restored.
231
+ * @returns void
232
+ */
233
+ handleCharacterOverflowStateChange() {
234
+ if (this.maxCharacterLimit) {
235
+ if (this.value.length > this.maxCharacterLimit && !this.characterLimitExceedingFired) {
236
+ this.dispatchCharacterOverflowStateChangeEvent();
237
+ this.characterLimitExceedingFired = true;
238
+ }
239
+ else if (this.value.length <= this.maxCharacterLimit && this.characterLimitExceedingFired) {
240
+ this.dispatchCharacterOverflowStateChangeEvent();
241
+ this.characterLimitExceedingFired = false;
242
+ }
243
+ }
244
+ }
245
+ /**
246
+ * Updates the value of the textarea field.
247
+ * Sets the form value.
248
+ * @returns void
249
+ */
250
+ updateValue() {
251
+ this.value = this.textarea.value;
252
+ this.internals.setFormValue(this.textarea.value);
253
+ }
254
+ /**
255
+ * Handles the change event of the textarea field.
256
+ * Updates the value and sets the validity of the textarea field.
257
+ *
258
+ * The 'change' event does not bubble up through the shadow DOM as it was not composed.
259
+ * Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
260
+ * Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
261
+ *
262
+ * @param event - Event which contains information about the value change.
263
+ */
264
+ onChange(event) {
265
+ this.updateValue();
266
+ const EventConstructor = event.constructor;
267
+ this.dispatchEvent(new EventConstructor(event.type, event));
268
+ }
269
+ /**
270
+ * Handles the keydown event of the textarea field.
271
+ * Clears the textarea field when the 'Enter' key is pressed.
272
+ * @param event - Keyboard event
273
+ * @returns void
274
+ */
275
+ handleKeyDown(event) {
276
+ if (['Enter'].includes(event.key)) {
277
+ event.preventDefault();
278
+ this.clearInputText();
279
+ }
280
+ }
281
+ /**
282
+ * Clears the textarea field.
283
+ * @returns void
284
+ */
285
+ clearInputText() {
286
+ this.value = '';
287
+ this.textarea.focus();
288
+ }
289
+ /**
290
+ * Renders the clear button to clear the textarea field if the clearButton is set to true.
291
+ * @returns void
292
+ */
293
+ renderClearButton() {
294
+ if (!this.clearButton) {
295
+ return nothing;
296
+ }
297
+ return html `
298
+ <mdc-button
299
+ part='clear-button'
300
+ class='own-focus-ring ${!this.value ? 'hidden' : ''}'
301
+ prefix-icon='${DEFAULTS.CLEAR_BUTTON_ICON}'
302
+ variant='${DEFAULTS.CLEAR_BUTTON_VARIANT}'
303
+ size="${DEFAULTS.CLEAR_BUTTON_SIZE}"
304
+ aria-label="${this.clearAriaLabel}"
305
+ ?disabled=${this.disabled || this.readonly || !this.value}
306
+ @click=${this.clearInputText}
307
+ @keydown=${this.handleKeyDown}
308
+ ></mdc-button>
309
+ `;
310
+ }
311
+ renderCharacterCounter() {
312
+ if (!this.maxCharacterLimit) {
313
+ return nothing;
314
+ }
315
+ return html `
316
+ <mdc-text
317
+ part="character-counter"
318
+ tagname="span"
319
+ type=${DEFAULTS.CHARACTER_COUNTER_TYPE}
320
+ >
321
+ ${this.value.length < 10 ? `0${this.value.length}` : this.value.length}/${this.maxCharacterLimit}
322
+ </mdc-text>
323
+ `;
324
+ }
325
+ renderTextareaFooter() {
326
+ if (!this.helpText && !this.maxCharacterLimit) {
327
+ return nothing;
328
+ }
329
+ return html `
330
+ <div part="textarea-footer">
331
+ ${this.renderHelperText()}
332
+ ${this.renderCharacterCounter()}
333
+ </div>
334
+ `;
335
+ }
336
+ render() {
337
+ var _a;
338
+ return html `
339
+ ${this.renderLabel()}
340
+ <div class="textarea-container mdc-focus-ring" part="textarea-container">
341
+ <textarea
342
+ aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
343
+ part='textarea'
344
+ id="${this.id}"
345
+ name="${this.name}"
346
+ .value="${this.value}"
347
+ ?disabled="${this.disabled}"
348
+ ?readonly="${this.readonly}"
349
+ ?required="${!!this.requiredLabel}"
350
+ placeholder=${ifDefined(this.placeholder)}
351
+ rows=${ifDefined(this.rows)}
352
+ cols=${ifDefined(this.cols)}
353
+ wrap=${ifDefined(this.wrap)}
354
+ ?autofocus="${this.autofocus}"
355
+ autocapitalize=${this.autocapitalize}
356
+ autocomplete=${this.autocomplete}
357
+ minlength=${ifDefined(this.minlength)}
358
+ maxlength=${ifDefined(this.maxlength)}
359
+ dirname=${ifDefined(this.dirname)}
360
+ @input=${this.updateValue}
361
+ @change=${this.onChange}
362
+ aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
363
+ aria-invalid="${this.helpTextType === 'error' ? 'true' : 'false'}"
364
+ ></textarea>
365
+ ${this.renderClearButton()}
366
+ </div>
367
+ ${this.renderTextareaFooter()}
368
+ `;
369
+ }
370
+ }
371
+ Textarea.styles = [...FormfieldWrapper.styles, ...styles];
372
+ __decorate([
373
+ property({ type: String }),
374
+ __metadata("design:type", String)
375
+ ], Textarea.prototype, "placeholder", void 0);
376
+ __decorate([
377
+ property({ type: Boolean }),
378
+ __metadata("design:type", Object)
379
+ ], Textarea.prototype, "readonly", void 0);
380
+ __decorate([
381
+ property({ type: Number }),
382
+ __metadata("design:type", Object)
383
+ ], Textarea.prototype, "rows", void 0);
384
+ __decorate([
385
+ property({ type: Number }),
386
+ __metadata("design:type", Object)
387
+ ], Textarea.prototype, "cols", void 0);
388
+ __decorate([
389
+ property({ type: String }),
390
+ __metadata("design:type", String)
391
+ ], Textarea.prototype, "wrap", void 0);
392
+ __decorate([
393
+ property({ type: String }),
394
+ __metadata("design:type", String)
395
+ ], Textarea.prototype, "autocapitalize", void 0);
396
+ __decorate([
397
+ property({ type: String }),
398
+ __metadata("design:type", String)
399
+ ], Textarea.prototype, "autocomplete", void 0);
400
+ __decorate([
401
+ property({ type: Boolean }),
402
+ __metadata("design:type", Boolean)
403
+ ], Textarea.prototype, "autofocus", void 0);
404
+ __decorate([
405
+ property({ type: String }),
406
+ __metadata("design:type", String)
407
+ ], Textarea.prototype, "dirname", void 0);
408
+ __decorate([
409
+ property({ type: Number }),
410
+ __metadata("design:type", Number)
411
+ ], Textarea.prototype, "maxlength", void 0);
412
+ __decorate([
413
+ property({ type: Number }),
414
+ __metadata("design:type", Number)
415
+ ], Textarea.prototype, "minlength", void 0);
416
+ __decorate([
417
+ property({ type: Boolean, attribute: 'clear-button' }),
418
+ __metadata("design:type", Object)
419
+ ], Textarea.prototype, "clearButton", void 0);
420
+ __decorate([
421
+ property({ type: String, attribute: 'clear-aria-label' }),
422
+ __metadata("design:type", Object)
423
+ ], Textarea.prototype, "clearAriaLabel", void 0);
424
+ __decorate([
425
+ property({ type: Number, attribute: 'max-character-limit' }),
426
+ __metadata("design:type", Number)
427
+ ], Textarea.prototype, "maxCharacterLimit", void 0);
428
+ __decorate([
429
+ query('textarea'),
430
+ __metadata("design:type", HTMLTextAreaElement)
431
+ ], Textarea.prototype, "inputElement", void 0);
432
+ export default Textarea;
@@ -0,0 +1,21 @@
1
+ declare const TAG_NAME: "mdc-textarea";
2
+ declare const WRAP: {
3
+ readonly HARD: "hard";
4
+ readonly SOFT: "soft";
5
+ };
6
+ declare const AUTO_COMPLETE: {
7
+ readonly OFF: "off";
8
+ readonly ON: "on";
9
+ };
10
+ declare const DEFAULTS: {
11
+ ICON_SIZE_VALUE: number;
12
+ ICON_SIZE_UNIT: string;
13
+ CLEAR_BUTTON_ICON: "cancel-bold";
14
+ CLEAR_BUTTON_VARIANT: "tertiary";
15
+ CLEAR_BUTTON_SIZE: 20;
16
+ CHARACTER_COUNTER_TYPE: "body-midsize-regular";
17
+ ROWS: number;
18
+ COLS: number;
19
+ WRAP: "soft";
20
+ };
21
+ export { TAG_NAME, WRAP, AUTO_COMPLETE, DEFAULTS };
@@ -0,0 +1,25 @@
1
+ import utils from '../../utils/tag-name';
2
+ import { TYPE as FONT_TYPE } from '../text/text.constants';
3
+ import { BUTTON_VARIANTS, ICON_BUTTON_SIZES } from '../button/button.constants';
4
+ const TAG_NAME = utils.constructTagName('textarea');
5
+ const CLEAR_BUTTON_ICON = 'cancel-bold';
6
+ const WRAP = {
7
+ HARD: 'hard',
8
+ SOFT: 'soft',
9
+ };
10
+ const AUTO_COMPLETE = {
11
+ OFF: 'off',
12
+ ON: 'on',
13
+ };
14
+ const DEFAULTS = {
15
+ ICON_SIZE_VALUE: 1,
16
+ ICON_SIZE_UNIT: 'rem',
17
+ CLEAR_BUTTON_ICON,
18
+ CLEAR_BUTTON_VARIANT: BUTTON_VARIANTS.TERTIARY,
19
+ CLEAR_BUTTON_SIZE: ICON_BUTTON_SIZES[20],
20
+ CHARACTER_COUNTER_TYPE: FONT_TYPE.BODY_MIDSIZE_REGULAR,
21
+ ROWS: 5,
22
+ COLS: 40,
23
+ WRAP: WRAP.SOFT,
24
+ };
25
+ export { TAG_NAME, WRAP, AUTO_COMPLETE, DEFAULTS };
@@ -0,0 +1,2 @@
1
+ declare const styles: import("lit").CSSResult[];
2
+ export default styles;
@@ -0,0 +1,122 @@
1
+ import { css } from 'lit';
2
+ import { hostFocusRingStyles } from '../../utils/styles';
3
+ const styles = [css `
4
+ :host {
5
+ --mdc-textarea-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
6
+ --mdc-textarea-disabled-text-color: var(--mds-color-theme-text-primary-disabled);
7
+ --mdc-textarea-disabled-background-color: var(--mds-color-theme-background-primary-disabled);
8
+ --mdc-textarea-text-color: var(--mds-color-theme-text-primary-normal);
9
+ --mdc-textarea-background-color: var(--mds-color-theme-background-primary-ghost);
10
+ --mdc-textarea-border-color: var(--mds-color-theme-outline-input-normal);
11
+ --mdc-textarea-text-secondary-normal : var(--mds-color-theme-text-secondary-normal);
12
+ --mdc-textarea-error-border-color: var(--mds-color-theme-text-error-normal);
13
+ --mdc-textarea-warning-border-color: var(--mds-color-theme-text-warning-normal);
14
+ --mdc-textarea-success-border-color: var(--mds-color-theme-text-success-normal);
15
+ --mdc-textarea-primary-border-color: var(--mds-color-theme-text-accent-normal);
16
+ --mdc-textarea-hover-background-color: var(--mds-color-theme-background-primary-hover);
17
+ --mdc-textarea-focused-background-color: var(--mds-color-theme-background-primary-active);
18
+ --mdc-textarea-focused-border-color: var(--mds-color-theme-outline-input-active);
19
+ --mdc-textarea-text-font-size: var(--mds-font-size-body-midsize);
20
+ --mdc-textarea-text-line-height: var(--mds-font-lineheight-body-midsize);
21
+ }
22
+
23
+ :host([disabled])::part(textarea),
24
+ :host([disabled])::part(textarea)::placeholder{
25
+ color: var(--mdc-input-disabled-text-color);
26
+ }
27
+
28
+ :host([disabled])::part(textarea),
29
+ :host([readonly])::part(textarea){
30
+ border-color: var(--mdc-textarea-disabled-border-color);
31
+ background: var(--mdc-textarea-disabled-background-color);
32
+ }
33
+
34
+ :host([disabled][help-text-type="default"])::part(textarea-container),
35
+ :host([disabled][help-text-type="success"])::part(textarea-container),
36
+ :host([disabled][help-text-type="warning"])::part(textarea-container),
37
+ :host([disabled][help-text-type="error"])::part(textarea-container),
38
+ :host([disabled][help-text-type="priority"])::part(textarea-container){
39
+ border-color: var(--mdc-textarea-disabled-border-color);
40
+ }
41
+
42
+ :host::part(textarea){
43
+ min-height: 6.25rem;
44
+ color: var(--mdc-textarea-text-color);
45
+ font-family: inherit;
46
+ font-size: var(--mdc-textarea-text-font-size);
47
+ line-height: var(--mdc-textarea-text-line-height);
48
+ background-color: var(--mdc-textarea-background-color);
49
+ resize: none;
50
+ border: none;
51
+ outline: none;
52
+ box-sizing: border-box;
53
+ }
54
+
55
+
56
+ :host::part(textarea-container) {
57
+ display: flex;
58
+ gap: 0.5rem;
59
+ border-radius: 0.5rem;
60
+ border: 0.0625rem solid var(--mdc-textarea-border-color);
61
+ overflow: hidden;
62
+ padding: 0.375rem 0.25rem 0.25rem 0.75rem;
63
+ }
64
+
65
+ :host(:not([disabled]))::part(textarea-container):hover{
66
+ background-color: var(--mdc-textarea-hover-background-color);
67
+ }
68
+
69
+ :host(:not([disabled]))::part(textarea-container):active,
70
+ :host(:not([disabled]))::part(textarea-container):focus-within{
71
+ background-color: var(--mdc-textarea-focused-background-color);
72
+ border-color: var(--mdc-textarea-focused-border-color);
73
+ }
74
+
75
+ :host::part(textarea-footer) {
76
+ display: flex;
77
+ justify-content: space-between;
78
+ align-items: center;
79
+ width: 100%;
80
+ }
81
+
82
+ .textarea::placeholder{
83
+ color: var(--mdc-textarea-text-secondary-normal);
84
+ }
85
+
86
+ :host::part(character-counter){
87
+ margin-left: auto;
88
+ color: var(--mdc-textarea-text-secondary-normal);
89
+ }
90
+
91
+ :host([help-text-type="error"])::part(character-counter) {
92
+ color: var(--mdc-textarea-error-border-color);
93
+ }
94
+
95
+ :host([disabled])::part(character-counter){
96
+ color: var(--mds-color-theme-text-primary-disabled);
97
+ }
98
+
99
+ :host([help-text-type="error"])::part(textarea-container),
100
+ :host([help-text-type="error"])::part(textarea-container):focus-within {
101
+ border-color: var(--mdc-textarea-error-border-color);
102
+ }
103
+ :host([help-text-type="warning"])::part(textarea-container),
104
+ :host([help-text-type="warning"])::part(textarea-container):focus-within {
105
+ border-color: var(--mdc-textarea-warning-border-color);
106
+ }
107
+ :host([help-text-type="success"])::part(textarea-container),
108
+ :host([help-text-type="success"])::part(textarea-container):focus-within {
109
+ border-color: var(--mdc-textarea-success-border-color);
110
+ }
111
+ :host([help-text-type="priority"])::part(textarea-container),
112
+ :host([help-text-type="priority"])::part(textarea-container):focus-within {
113
+ border-color: var(--mdc-textarea-primary-border-color);
114
+ }
115
+
116
+ .hidden {
117
+ opacity: 0;
118
+ pointer-events: none;
119
+ }
120
+
121
+ `, ...hostFocusRingStyles(true)];
122
+ export default styles;
@@ -0,0 +1,5 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { AUTO_COMPLETE, WRAP } from './textarea.constants';
3
+ type WrapType = ValueOf<typeof WRAP>;
4
+ type AutoCompleteType = ValueOf<typeof AUTO_COMPLETE>;
5
+ export { WrapType, AutoCompleteType };
@@ -0,0 +1 @@
1
+ export {};