@politiet/sheriff-web-components 1.1.0 → 1.3.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 (44) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/sds-button/sds-button.d.ts +5 -0
  6. package/dist/sds-button/sds-button.d.ts.map +1 -1
  7. package/dist/sds-button/sds-button.js +19 -0
  8. package/dist/sds-button/sds-button.js.map +1 -1
  9. package/dist/sds-button/sds-button.spec.js +36 -0
  10. package/dist/sds-button/sds-button.spec.js.map +1 -1
  11. package/dist/sds-button/sds-button.styles.d.ts.map +1 -1
  12. package/dist/sds-button/sds-button.styles.js +11 -7
  13. package/dist/sds-button/sds-button.styles.js.map +1 -1
  14. package/dist/sds-checkbox-group/sds-checkbox-group.d.ts.map +1 -1
  15. package/dist/sds-checkbox-group/sds-checkbox-group.js +3 -13
  16. package/dist/sds-checkbox-group/sds-checkbox-group.js.map +1 -1
  17. package/dist/sds-radio-group/sds-radio-group.d.ts.map +1 -1
  18. package/dist/sds-radio-group/sds-radio-group.js +3 -13
  19. package/dist/sds-radio-group/sds-radio-group.js.map +1 -1
  20. package/dist/sds-textarea/sds-textarea.d.ts +77 -0
  21. package/dist/sds-textarea/sds-textarea.d.ts.map +1 -0
  22. package/dist/sds-textarea/sds-textarea.js +240 -0
  23. package/dist/sds-textarea/sds-textarea.js.map +1 -0
  24. package/dist/sds-textarea/sds-textarea.spec.d.ts +2 -0
  25. package/dist/sds-textarea/sds-textarea.spec.d.ts.map +1 -0
  26. package/dist/sds-textarea/sds-textarea.spec.js +171 -0
  27. package/dist/sds-textarea/sds-textarea.spec.js.map +1 -0
  28. package/dist/sds-textarea/sds-textarea.styles.d.ts +2 -0
  29. package/dist/sds-textarea/sds-textarea.styles.d.ts.map +1 -0
  30. package/dist/sds-textarea/sds-textarea.styles.js +118 -0
  31. package/dist/sds-textarea/sds-textarea.styles.js.map +1 -0
  32. package/dist/sds-textfield/sds-textfield.d.ts.map +1 -1
  33. package/dist/sds-textfield/sds-textfield.js +2 -12
  34. package/dist/sds-textfield/sds-textfield.js.map +1 -1
  35. package/dist/sheriff-web-components.js +589 -241
  36. package/dist/utils/renderErrorMessage.d.ts +3 -0
  37. package/dist/utils/renderErrorMessage.d.ts.map +1 -0
  38. package/dist/utils/renderErrorMessage.js +9 -0
  39. package/dist/utils/renderErrorMessage.js.map +1 -0
  40. package/dist/utils/types.d.ts +2 -0
  41. package/dist/utils/types.d.ts.map +1 -0
  42. package/dist/utils/types.js +2 -0
  43. package/dist/utils/types.js.map +1 -0
  44. package/package.json +1 -1
@@ -0,0 +1,240 @@
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
+ import { LitElement, html, nothing } from 'lit';
8
+ import { property, query } from 'lit/decorators.js';
9
+ import { classMap } from 'lit/directives/class-map.js';
10
+ import { ifDefined } from 'lit/directives/if-defined.js';
11
+ import { guardedCustomElement } from '../utils/guarded-custom-element';
12
+ import { styles } from './sds-textarea.styles';
13
+ import '../sds-icon/sds-icon';
14
+ let SDSTextArea = class SDSTextArea extends LitElement {
15
+ constructor() {
16
+ super();
17
+ this.disabled = false;
18
+ this.readOnly = false;
19
+ this.required = false;
20
+ this._defaultValue = '';
21
+ this._handleInputChange = (event) => {
22
+ event.stopImmediatePropagation();
23
+ if (!this.disabled) {
24
+ const currentValue = event.target.value;
25
+ this.value = currentValue;
26
+ this.internals.setFormValue(currentValue === '' ? null : currentValue);
27
+ this.updateValidity();
28
+ this.dispatchEvent(new CustomEvent(event.type, { bubbles: true, composed: true }));
29
+ }
30
+ };
31
+ this._handleSelect = (event) => {
32
+ event.stopImmediatePropagation();
33
+ if (!this.disabled) {
34
+ this.dispatchEvent(new CustomEvent('select', { bubbles: true, composed: true }));
35
+ }
36
+ };
37
+ this._handleFocus = (event) => {
38
+ event.stopImmediatePropagation();
39
+ this.dispatchEvent(new CustomEvent('focus', { bubbles: true, composed: true }));
40
+ };
41
+ this._handleBlur = (event) => {
42
+ event.stopImmediatePropagation();
43
+ this.updateValidity();
44
+ this.dispatchEvent(new CustomEvent('blur', { bubbles: true, composed: true }));
45
+ };
46
+ this.internals = this.attachInternals();
47
+ this.attachShadow({ mode: 'open', delegatesFocus: true });
48
+ }
49
+ connectedCallback() {
50
+ super.connectedCallback();
51
+ this._defaultValue = this.value ?? '';
52
+ }
53
+ updateValidity() {
54
+ if (this.control.checkValidity()) {
55
+ this.internals.setValidity({});
56
+ }
57
+ else {
58
+ this.internals.setValidity({ customError: true }, this.control.validationMessage, this.control);
59
+ }
60
+ }
61
+ renderCharacterCounter() {
62
+ if (this.counter === undefined)
63
+ return nothing;
64
+ const currentLength = this.value?.length || 0;
65
+ const isOverCounter = currentLength > this.counter;
66
+ if (isOverCounter) {
67
+ return html `<p class="sds-textarea__character-counter sds-textarea__character-counter--error">
68
+ Du har ${currentLength - this.counter} tegn for mye
69
+ </p>`;
70
+ }
71
+ return html `<p class="sds-textarea__character-counter">Du har ${this.counter - currentLength} tegn igjen</p>`;
72
+ }
73
+ formResetCallback() {
74
+ this.control.value = this._defaultValue;
75
+ this.internals.setFormValue(this._defaultValue === '' ? null : this._defaultValue);
76
+ this.value = this._defaultValue;
77
+ this.updateValidity();
78
+ }
79
+ select() {
80
+ if (!this.disabled)
81
+ this.control.select();
82
+ }
83
+ type() {
84
+ return 'textarea';
85
+ }
86
+ focus() {
87
+ if (!this.disabled)
88
+ this.control.focus();
89
+ }
90
+ blur() {
91
+ if (!this.disabled)
92
+ this.control.blur();
93
+ }
94
+ click() {
95
+ if (!this.disabled)
96
+ this.control.click();
97
+ }
98
+ get selectionStart() {
99
+ return this.control ? this.control.selectionStart : null;
100
+ }
101
+ set selectionStart(value) {
102
+ if (this.control && value !== null) {
103
+ this.control.selectionStart = value;
104
+ }
105
+ }
106
+ get selectionEnd() {
107
+ return this.control ? this.control.selectionEnd : null;
108
+ }
109
+ set selectionEnd(value) {
110
+ if (this.control && value !== null) {
111
+ this.control.selectionEnd = value;
112
+ }
113
+ }
114
+ setSelectionRange(start, end, direction) {
115
+ if (this.control) {
116
+ this.control.setSelectionRange(start, end, direction);
117
+ }
118
+ }
119
+ checkValidity() {
120
+ return this.control.checkValidity();
121
+ }
122
+ reportValidity() {
123
+ return this.control.reportValidity();
124
+ }
125
+ setCustomValidity(message) {
126
+ this.control.setCustomValidity(message);
127
+ this.updateValidity();
128
+ }
129
+ render() {
130
+ const textareaClasses = {
131
+ 'sds-textarea': true,
132
+ 'sds-textarea--error': Boolean(this.errorMessage),
133
+ 'sds-textarea--disabled': Boolean(this.disabled),
134
+ 'sds-textarea--readonly': Boolean(this.readOnly),
135
+ };
136
+ return html `
137
+ <div class="${classMap(textareaClasses)}">
138
+ ${this.label
139
+ ? html `<label for="sds-textarea" class="sds-textarea__label">${this.label}</label>`
140
+ : nothing}
141
+ ${this.helpText ? html `<p class="sds-textarea__help-text">${this.helpText}</p>` : nothing}
142
+ <div class="sds-textarea__input-container">
143
+ <textarea
144
+ class="sds-textarea__input"
145
+ id="sds-textarea"
146
+ ?disabled="${this.disabled}"
147
+ ?readonly="${this.readOnly}"
148
+ placeholder="${ifDefined(this.placeholder)}"
149
+ .value="${this.value ?? ''}"
150
+ .autocomplete="${this.autocomplete}"
151
+ name="${ifDefined(this.name)}"
152
+ ?required="${this.required}"
153
+ rows="${ifDefined(this.rows)}"
154
+ cols="${ifDefined(this.cols)}"
155
+ wrap="${ifDefined(this.wrap)}"
156
+ minlength="${ifDefined(this.minlength)}"
157
+ maxlength="${ifDefined(this.maxlength)}"
158
+ @input="${this._handleInputChange}"
159
+ @change="${this._handleInputChange}"
160
+ @select="${this._handleSelect}"
161
+ @focus="${this._handleFocus}"
162
+ @blur="${this._handleBlur}"
163
+ ></textarea>
164
+ </div>
165
+ ${this.renderCharacterCounter()}
166
+ ${this.errorMessage
167
+ ? html `<p class="sds-textarea__error-message">
168
+ <sds-icon
169
+ name="warning-material-filled"
170
+ size="m"
171
+ color="${!this.disabled
172
+ ? `var(--sds-color-semantic-icon-critical)`
173
+ : `var(--sds-color-semantic-icon-disabled)`}"
174
+ ></sds-icon>
175
+ ${this.errorMessage}
176
+ </p>`
177
+ : nothing}
178
+ </div>
179
+ `;
180
+ }
181
+ };
182
+ // Styling
183
+ SDSTextArea.styles = [styles];
184
+ SDSTextArea.formAssociated = true;
185
+ __decorate([
186
+ property({ type: String })
187
+ ], SDSTextArea.prototype, "value", void 0);
188
+ __decorate([
189
+ property({ type: String, reflect: true })
190
+ ], SDSTextArea.prototype, "name", void 0);
191
+ __decorate([
192
+ property({ type: String, reflect: true })
193
+ ], SDSTextArea.prototype, "label", void 0);
194
+ __decorate([
195
+ property({ type: String, reflect: true })
196
+ ], SDSTextArea.prototype, "placeholder", void 0);
197
+ __decorate([
198
+ property({ type: String, attribute: 'help-text', reflect: true })
199
+ ], SDSTextArea.prototype, "helpText", void 0);
200
+ __decorate([
201
+ property({ type: String, attribute: 'error-message', reflect: true })
202
+ ], SDSTextArea.prototype, "errorMessage", void 0);
203
+ __decorate([
204
+ property({ type: Boolean, reflect: true })
205
+ ], SDSTextArea.prototype, "disabled", void 0);
206
+ __decorate([
207
+ property({ type: Boolean, attribute: 'readonly', reflect: true })
208
+ ], SDSTextArea.prototype, "readOnly", void 0);
209
+ __decorate([
210
+ property({ type: String, reflect: true })
211
+ ], SDSTextArea.prototype, "autocomplete", void 0);
212
+ __decorate([
213
+ property({ type: Boolean, reflect: true })
214
+ ], SDSTextArea.prototype, "required", void 0);
215
+ __decorate([
216
+ property({ type: Number, reflect: true })
217
+ ], SDSTextArea.prototype, "rows", void 0);
218
+ __decorate([
219
+ property({ type: Number, reflect: true })
220
+ ], SDSTextArea.prototype, "cols", void 0);
221
+ __decorate([
222
+ property({ type: String, reflect: true })
223
+ ], SDSTextArea.prototype, "wrap", void 0);
224
+ __decorate([
225
+ property({ type: Number, reflect: true })
226
+ ], SDSTextArea.prototype, "minlength", void 0);
227
+ __decorate([
228
+ property({ type: Number, reflect: true })
229
+ ], SDSTextArea.prototype, "maxlength", void 0);
230
+ __decorate([
231
+ property({ type: Number, reflect: true })
232
+ ], SDSTextArea.prototype, "counter", void 0);
233
+ __decorate([
234
+ query('#sds-textarea')
235
+ ], SDSTextArea.prototype, "control", void 0);
236
+ SDSTextArea = __decorate([
237
+ guardedCustomElement('sds-textarea')
238
+ ], SDSTextArea);
239
+ export { SDSTextArea };
240
+ //# sourceMappingURL=sds-textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sds-textarea.js","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,sBAAsB,CAAC;AA2BvB,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IA4B1C;QACC,KAAK,EAAE,CAAC;QAnBmC,aAAQ,GAAY,KAAK,CAAC;QACH,aAAQ,GAAY,KAAK,C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,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAEpC;IAAvB,KAAK,CAAC,eAAe,CAAC;4CAA+B;AArB1C,WAAW;IADvB,oBAAoB,CAAC,cAAc,CAAC;GACxB,WAAW,CAiNvB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-textarea.styles';\n\nimport '../sds-icon/sds-icon';\n\nexport interface SDSTextAreaProps {\n\tvalue?: string;\n\tname?: string;\n\tlabel?: string;\n\tplaceholder?: string;\n\t'help-text'?: string;\n\t'error-message'?: string;\n\tdisabled?: boolean;\n\treadonly?: boolean;\n\tautocomplete?: HTMLTextAreaElement['autocomplete'];\n\trequired?: boolean;\n\trows?: number;\n\tcols?: number;\n\twrap?: 'hard' | 'soft' | 'off';\n\tminlength?: number;\n\tmaxlength?: number;\n\tcounter?: number;\n\tonInput?: (event: Event) => void;\n\tonChange?: (event: Event) => void;\n\tonSelect?: (event: Event) => void;\n\tonFocus?: (event: Event) => void;\n\tonBlur?: (event: Event) => void;\n}\n\n@guardedCustomElement('sds-textarea')\nexport class SDSTextArea extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t@property({ type: String }) value?: string;\n\t@property({ type: String, reflect: true }) name?: string;\n\t@property({ type: String, reflect: true }) label?: string;\n\t@property({ type: String, reflect: true }) placeholder?: string;\n\t@property({ type: String, attribute: 'help-text', reflect: true }) helpText?: string;\n\t@property({ type: String, attribute: 'error-message', reflect: true }) errorMessage?: string;\n\t@property({ type: Boolean, reflect: true }) disabled: boolean = false;\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: boolean = false;\n\t@property({ type: String, reflect: true }) autocomplete?: HTMLTextAreaElement['autocomplete'];\n\t@property({ type: Boolean, reflect: true }) required: boolean = false;\n\t@property({ type: Number, reflect: true }) rows?: number;\n\t@property({ type: Number, reflect: true }) cols?: number;\n\t@property({ type: String, reflect: true }) wrap?: 'hard' | 'soft';\n\t@property({ type: Number, reflect: true }) minlength?: number;\n\t@property({ type: Number, reflect: true }) maxlength?: number;\n\t@property({ type: Number, reflect: true }) counter?: number;\n\n\t@query('#sds-textarea') control!: HTMLTextAreaElement;\n\n\tstatic formAssociated = true;\n\tpublic readonly internals: ElementInternals;\n\n\tprivate _defaultValue: string = '';\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.internals = this.attachInternals();\n\t\tthis.attachShadow({ mode: 'open', delegatesFocus: true });\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis._defaultValue = this.value ?? '';\n\t}\n\n\tprivate updateValidity() {\n\t\tif (this.control.checkValidity()) {\n\t\t\tthis.internals.setValidity({});\n\t\t} else {\n\t\t\tthis.internals.setValidity({ customError: true }, this.control.validationMessage, this.control);\n\t\t}\n\t}\n\n\tprivate renderCharacterCounter() {\n\t\tif (this.counter === undefined) return nothing;\n\n\t\tconst currentLength = this.value?.length || 0;\n\t\tconst isOverCounter = currentLength > this.counter;\n\n\t\tif (isOverCounter) {\n\t\t\treturn html`<p class=\"sds-textarea__character-counter sds-textarea__character-counter--error\">\n\t\t\t\tDu har ${currentLength - this.counter} tegn for mye\n\t\t\t</p>`;\n\t\t}\n\n\t\treturn html`<p class=\"sds-textarea__character-counter\">Du har ${this.counter - currentLength} tegn igjen</p>`;\n\t}\n\n\tprivate readonly _handleInputChange = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tconst currentValue = (event.target as HTMLTextAreaElement).value;\n\t\t\tthis.value = currentValue;\n\t\t\tthis.internals.setFormValue(currentValue === '' ? null : currentValue);\n\t\t\tthis.updateValidity();\n\t\t\tthis.dispatchEvent(new CustomEvent(event.type, { bubbles: true, composed: true }));\n\t\t}\n\t};\n\n\tprivate readonly _handleSelect = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchEvent(new CustomEvent('select', { bubbles: true, composed: true }));\n\t\t}\n\t};\n\n\tprivate readonly _handleFocus = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(new CustomEvent('focus', { bubbles: true, composed: true }));\n\t};\n\n\tprivate readonly _handleBlur = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.updateValidity();\n\t\tthis.dispatchEvent(new CustomEvent('blur', { bubbles: true, composed: true }));\n\t};\n\n\tformResetCallback() {\n\t\tthis.control.value = this._defaultValue;\n\t\tthis.internals.setFormValue(this._defaultValue === '' ? null : this._defaultValue);\n\t\tthis.value = this._defaultValue;\n\t\tthis.updateValidity();\n\t}\n\n\tselect(): void {\n\t\tif (!this.disabled) this.control.select();\n\t}\n\n\ttype(): string {\n\t\treturn 'textarea';\n\t}\n\n\toverride focus(): void {\n\t\tif (!this.disabled) this.control.focus();\n\t}\n\n\toverride blur(): void {\n\t\tif (!this.disabled) this.control.blur();\n\t}\n\n\toverride click(): void {\n\t\tif (!this.disabled) this.control.click();\n\t}\n\n\tget selectionStart(): number | null {\n\t\treturn this.control ? this.control.selectionStart : null;\n\t}\n\n\tset selectionStart(value: number | null) {\n\t\tif (this.control && value !== null) {\n\t\t\tthis.control.selectionStart = value;\n\t\t}\n\t}\n\n\tget selectionEnd(): number | null {\n\t\treturn this.control ? this.control.selectionEnd : null;\n\t}\n\tset selectionEnd(value: number | null) {\n\t\tif (this.control && value !== null) {\n\t\t\tthis.control.selectionEnd = value;\n\t\t}\n\t}\n\n\tsetSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void {\n\t\tif (this.control) {\n\t\t\tthis.control.setSelectionRange(start, end, direction);\n\t\t}\n\t}\n\n\tcheckValidity(): boolean {\n\t\treturn this.control.checkValidity();\n\t}\n\n\treportValidity(): boolean {\n\t\treturn this.control.reportValidity();\n\t}\n\n\tsetCustomValidity(message: string): void {\n\t\tthis.control.setCustomValidity(message);\n\t\tthis.updateValidity();\n\t}\n\n\toverride render() {\n\t\tconst textareaClasses = {\n\t\t\t'sds-textarea': true,\n\t\t\t'sds-textarea--error': Boolean(this.errorMessage),\n\t\t\t'sds-textarea--disabled': Boolean(this.disabled),\n\t\t\t'sds-textarea--readonly': Boolean(this.readOnly),\n\t\t};\n\n\t\treturn html`\n\t\t\t<div class=\"${classMap(textareaClasses)}\">\n\t\t\t\t${this.label\n\t\t\t\t\t? html`<label for=\"sds-textarea\" class=\"sds-textarea__label\">${this.label}</label>`\n\t\t\t\t\t: nothing}\n\t\t\t\t${this.helpText ? html`<p class=\"sds-textarea__help-text\">${this.helpText}</p>` : nothing}\n\t\t\t\t<div class=\"sds-textarea__input-container\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tclass=\"sds-textarea__input\"\n\t\t\t\t\t\tid=\"sds-textarea\"\n\t\t\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t\t\tplaceholder=\"${ifDefined(this.placeholder)}\"\n\t\t\t\t\t\t.value=\"${this.value ?? ''}\"\n\t\t\t\t\t\t.autocomplete=\"${this.autocomplete}\"\n\t\t\t\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t\t\t\t?required=\"${this.required}\"\n\t\t\t\t\t\trows=\"${ifDefined(this.rows)}\"\n\t\t\t\t\t\tcols=\"${ifDefined(this.cols)}\"\n\t\t\t\t\t\twrap=\"${ifDefined(this.wrap)}\"\n\t\t\t\t\t\tminlength=\"${ifDefined(this.minlength)}\"\n\t\t\t\t\t\tmaxlength=\"${ifDefined(this.maxlength)}\"\n\t\t\t\t\t\t@input=\"${this._handleInputChange}\"\n\t\t\t\t\t\t@change=\"${this._handleInputChange}\"\n\t\t\t\t\t\t@select=\"${this._handleSelect}\"\n\t\t\t\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t\t\t\t@blur=\"${this._handleBlur}\"\n\t\t\t\t\t></textarea>\n\t\t\t\t</div>\n\t\t\t\t${this.renderCharacterCounter()}\n\t\t\t\t${this.errorMessage\n\t\t\t\t\t? html`<p class=\"sds-textarea__error-message\">\n\t\t\t\t\t\t\t<sds-icon\n\t\t\t\t\t\t\t\tname=\"warning-material-filled\"\n\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\tcolor=\"${!this.disabled\n\t\t\t\t\t\t\t\t\t? `var(--sds-color-semantic-icon-critical)`\n\t\t\t\t\t\t\t\t\t: `var(--sds-color-semantic-icon-disabled)`}\"\n\t\t\t\t\t\t\t></sds-icon>\n\t\t\t\t\t\t\t${this.errorMessage}\n\t\t\t\t\t\t</p>`\n\t\t\t\t\t: nothing}\n\t\t\t</div>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-textarea': SDSTextArea;\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sds-textarea.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sds-textarea.spec.d.ts","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,171 @@
1
+ import { test } from '@playwright/test';
2
+ import { onFormSubmitCallback } from '../playwright-util/form';
3
+ import { expect } from '../playwright-util/custom-matchers';
4
+ const pageUrl = 'iframe.html?viewMode=docs&id=test-textarea--docs';
5
+ const textareaIds = [
6
+ 'with-maxlength',
7
+ 'with-min-max',
8
+ 'without-maxlength',
9
+ 'with-error',
10
+ 'with-value',
11
+ 'readonly',
12
+ 'required',
13
+ 'autocomplete-off',
14
+ 'autocomplete-on',
15
+ ];
16
+ test.describe('textarea-component', () => {
17
+ test.beforeEach(async ({ page }) => {
18
+ await page.goto(pageUrl);
19
+ });
20
+ test('visibility', async ({ page }) => {
21
+ for (const id of textareaIds) {
22
+ await expect(page.locator(`#${id}`)).toBeVisible();
23
+ }
24
+ });
25
+ test('initial states', async ({ page }) => {
26
+ // Check that textarea with value has the correct initial value
27
+ const withValue = page.locator('#with-value');
28
+ await expect(withValue).toHaveValue('Initial text');
29
+ // Check that disabled textarea is disabled
30
+ const disabled = page.locator('#disabled');
31
+ await expect(disabled).toHaveAttribute('disabled', '');
32
+ const readonly = page.locator('#readonly');
33
+ await expect(readonly).toHaveAttribute('readonly', '');
34
+ });
35
+ test('character counter visibility', async ({ page }) => {
36
+ // Character counter should be visible for textareas with maxlength
37
+ const withMaxlength = page.locator('#with-maxlength');
38
+ const withMaxlengthCounter = withMaxlength.locator('.sds-textarea__character-counter');
39
+ await expect(withMaxlengthCounter).toBeVisible();
40
+ // Character counter should not be visible for textareas without maxlength
41
+ const withoutMaxlength = page.locator('#without-maxlength');
42
+ const withoutMaxlengthCounter = withoutMaxlength.locator('.sds-textarea__character-counter');
43
+ await expect(withoutMaxlengthCounter).not.toBeVisible();
44
+ // Character counter should be visible for textarea with initial value
45
+ const withValue = page.locator('#with-value');
46
+ const withValueCounter = withValue.locator('.sds-textarea__character-counter');
47
+ await expect(withValueCounter).toBeVisible();
48
+ await expect(withValueCounter).toHaveText('Du har 8 tegn igjen');
49
+ });
50
+ test('character counter updates on input', async ({ page }) => {
51
+ const textarea = page.locator('#with-maxlength');
52
+ const counter = page.locator('#with-maxlength').locator('.sds-textarea__character-counter');
53
+ // Initial state
54
+ await expect(counter).toHaveText('Du har 10 tegn igjen');
55
+ // Type some text
56
+ await textarea.pressSequentially('Hello');
57
+ await expect(counter).toHaveText('Du har 5 tegn igjen');
58
+ // Type more text
59
+ await textarea.pressSequentially('Hello World');
60
+ await expect(counter).toHaveText('Du har 0 tegn igjen');
61
+ });
62
+ test('form-submission', async ({ page }) => {
63
+ const getFormData = await onFormSubmitCallback(page, 'textarea-form');
64
+ // Fill in some textareas
65
+ await page.locator('#with-maxlength').pressSequentially('Test');
66
+ await page.locator('#with-min-max').pressSequentially('Test input');
67
+ await page.locator('#submit-button').click();
68
+ await expect.poll(async () => (await getFormData()) !== null, 'Form data not received').toBeTruthy();
69
+ const formData = await getFormData();
70
+ expect(formData).toMatchObject({
71
+ 'with-maxlength': 'Test',
72
+ 'with-min-max': 'Test input',
73
+ });
74
+ });
75
+ test('form-reset', async ({ page }) => {
76
+ // Change values
77
+ await page.locator('#with-maxlength').pressSequentially('Changed text');
78
+ await page.locator('#with-value').pressSequentially('New value');
79
+ // Reset the form
80
+ await page.locator('#reset-button').click();
81
+ // Check that values are reset
82
+ await expect(page.locator('#with-maxlength')).toHaveValue('');
83
+ await expect(page.locator('#with-value')).toHaveValue('Initial text');
84
+ // Check that character counters are reset
85
+ await expect(page.locator('#with-maxlength').locator('.sds-textarea__character-counter')).toHaveText('Du har 10 tegn igjen');
86
+ await expect(page.locator('#with-value').locator('.sds-textarea__character-counter')).toHaveText('Du har 8 tegn igjen');
87
+ });
88
+ test('focus', async ({ page }) => {
89
+ for (const id of textareaIds) {
90
+ if (id === 'disabled')
91
+ continue; // Skip disabled textarea
92
+ // Prepare for focus test by adding a parent div for consistent screenshots
93
+ await page.evaluate((id) => {
94
+ const element = document.getElementById(id);
95
+ if (element) {
96
+ const parentDiv = document.createElement('div');
97
+ parentDiv.style.padding = '10px';
98
+ parentDiv.style.backgroundColor = 'white';
99
+ element.parentNode?.insertBefore(parentDiv, element);
100
+ parentDiv.appendChild(element);
101
+ }
102
+ }, id);
103
+ // Focus the textarea
104
+ await page.locator(`#${id}`).focus();
105
+ // Verify focus state
106
+ const isFocused = await page.evaluate((id) => {
107
+ const element = document.getElementById(id);
108
+ return element === document.activeElement;
109
+ }, id);
110
+ expect(isFocused).toBeTruthy();
111
+ }
112
+ });
113
+ test('minlength', async ({ page }) => {
114
+ const textarea = page.locator('#with-min-max');
115
+ // Text shorter than minlength (5) → invalid
116
+ await textarea.pressSequentially('abc');
117
+ const isValidShort = await textarea.evaluate((el) => el.checkValidity());
118
+ expect(isValidShort).toBe(false);
119
+ // Text exactly at minlength (5) → valid
120
+ await page.goto(pageUrl);
121
+ await textarea.pressSequentially('abcde');
122
+ const isValidExact = await textarea.evaluate((el) => el.checkValidity());
123
+ expect(isValidExact).toBe(true);
124
+ // Text longer than minlength (5) → valid
125
+ await page.goto(pageUrl);
126
+ await textarea.pressSequentially('abcdefg');
127
+ const isValidLong = await textarea.evaluate((el) => el.checkValidity());
128
+ expect(isValidLong).toBe(true);
129
+ });
130
+ test('maxlength', async ({ page }) => {
131
+ const longStringToType = 'abcdefghijklmnop';
132
+ const textarea = page.locator('#with-maxlength');
133
+ // Type in string longer than the 10 character maxlength
134
+ await textarea.pressSequentially(longStringToType);
135
+ await expect(textarea).toHaveValue(longStringToType.substring(0, 10));
136
+ });
137
+ test('required', async ({ page }) => {
138
+ const textarea = page.locator('#required');
139
+ // No value → invalid
140
+ let isValid = await textarea.evaluate((el) => el.checkValidity());
141
+ expect(isValid).toBe(false);
142
+ // Has value → valid
143
+ await page.goto(pageUrl);
144
+ await textarea.pressSequentially('abc');
145
+ isValid = await textarea.evaluate((el) => el.checkValidity());
146
+ expect(isValid).toBe(true);
147
+ });
148
+ test('readonly', async ({ page }) => {
149
+ const textarea = page.locator('#readonly');
150
+ await textarea.pressSequentially('abc');
151
+ await expect(textarea).toHaveValue('Cannot be changed');
152
+ });
153
+ test('autocomplete on/off', async ({ page }) => {
154
+ const textareas = [
155
+ { id: 'autocomplete-off', expected: 'off' },
156
+ { id: 'autocomplete-on', expected: 'on' },
157
+ ];
158
+ for (const { id, expected } of textareas) {
159
+ const host = page.locator(`#${id}`);
160
+ // Check host element attribute
161
+ await expect(host).toHaveAttribute('autocomplete', expected);
162
+ // Check shadow DOM textarea element
163
+ const shadowDomTextarea = await host.evaluate((el) => {
164
+ const textarea = el.shadowRoot?.querySelector('textarea');
165
+ return textarea?.autocomplete ?? null;
166
+ });
167
+ expect(shadowDomTextarea).toBe(expected);
168
+ }
169
+ });
170
+ });
171
+ //# sourceMappingURL=sds-textarea.spec.js.map
@@ -0,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E,EAAE,CAAC,CAAC;YAEpC,+BAA+B;YAC/B,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YAE7D,oCAAoC;YACpC,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAe,EAAE,EAAE;gBACjE,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,UAAU,CAA+B,CAAC;gBACxF,OAAO,QAAQ,EAAE,YAAY,IAAI,IAAI,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { onFormSubmitCallback } from '../playwright-util/form';\nimport { expect } from '../playwright-util/custom-matchers';\n\nconst pageUrl = 'iframe.html?viewMode=docs&id=test-textarea--docs';\nconst textareaIds = [\n\t'with-maxlength',\n\t'with-min-max',\n\t'without-maxlength',\n\t'with-error',\n\t'with-value',\n\t'readonly',\n\t'required',\n\t'autocomplete-off',\n\t'autocomplete-on',\n];\n\ntest.describe('textarea-component', () => {\n\ttest.beforeEach(async ({ page }) => {\n\t\tawait page.goto(pageUrl);\n\t});\n\n\ttest('visibility', async ({ page }) => {\n\t\tfor (const id of textareaIds) {\n\t\t\tawait expect(page.locator(`#${id}`)).toBeVisible();\n\t\t}\n\t});\n\n\ttest('initial states', async ({ page }) => {\n\t\t// Check that textarea with value has the correct initial value\n\t\tconst withValue = page.locator('#with-value');\n\t\tawait expect(withValue).toHaveValue('Initial text');\n\n\t\t// Check that disabled textarea is disabled\n\t\tconst disabled = page.locator('#disabled');\n\t\tawait expect(disabled).toHaveAttribute('disabled', '');\n\n\t\tconst readonly = page.locator('#readonly');\n\t\tawait expect(readonly).toHaveAttribute('readonly', '');\n\t});\n\n\ttest('character counter visibility', async ({ page }) => {\n\t\t// Character counter should be visible for textareas with maxlength\n\t\tconst withMaxlength = page.locator('#with-maxlength');\n\t\tconst withMaxlengthCounter = withMaxlength.locator('.sds-textarea__character-counter');\n\t\tawait expect(withMaxlengthCounter).toBeVisible();\n\n\t\t// Character counter should not be visible for textareas without maxlength\n\t\tconst withoutMaxlength = page.locator('#without-maxlength');\n\t\tconst withoutMaxlengthCounter = withoutMaxlength.locator('.sds-textarea__character-counter');\n\t\tawait expect(withoutMaxlengthCounter).not.toBeVisible();\n\n\t\t// Character counter should be visible for textarea with initial value\n\t\tconst withValue = page.locator('#with-value');\n\t\tconst withValueCounter = withValue.locator('.sds-textarea__character-counter');\n\t\tawait expect(withValueCounter).toBeVisible();\n\t\tawait expect(withValueCounter).toHaveText('Du har 8 tegn igjen');\n\t});\n\n\ttest('character counter updates on input', async ({ page }) => {\n\t\tconst textarea = page.locator('#with-maxlength');\n\t\tconst counter = page.locator('#with-maxlength').locator('.sds-textarea__character-counter');\n\n\t\t// Initial state\n\t\tawait expect(counter).toHaveText('Du har 10 tegn igjen');\n\n\t\t// Type some text\n\t\tawait textarea.pressSequentially('Hello');\n\t\tawait expect(counter).toHaveText('Du har 5 tegn igjen');\n\n\t\t// Type more text\n\t\tawait textarea.pressSequentially('Hello World');\n\t\tawait expect(counter).toHaveText('Du har 0 tegn igjen');\n\t});\n\n\ttest('form-submission', async ({ page }) => {\n\t\tconst getFormData = await onFormSubmitCallback(page, 'textarea-form');\n\n\t\t// Fill in some textareas\n\t\tawait page.locator('#with-maxlength').pressSequentially('Test');\n\t\tawait page.locator('#with-min-max').pressSequentially('Test input');\n\n\t\tawait page.locator('#submit-button').click();\n\n\t\tawait expect.poll(async () => (await getFormData()) !== null, 'Form data not received').toBeTruthy();\n\t\tconst formData = await getFormData();\n\n\t\texpect(formData).toMatchObject({\n\t\t\t'with-maxlength': 'Test',\n\t\t\t'with-min-max': 'Test input',\n\t\t});\n\t});\n\n\ttest('form-reset', async ({ page }) => {\n\t\t// Change values\n\t\tawait page.locator('#with-maxlength').pressSequentially('Changed text');\n\t\tawait page.locator('#with-value').pressSequentially('New value');\n\n\t\t// Reset the form\n\t\tawait page.locator('#reset-button').click();\n\n\t\t// Check that values are reset\n\t\tawait expect(page.locator('#with-maxlength')).toHaveValue('');\n\t\tawait expect(page.locator('#with-value')).toHaveValue('Initial text');\n\n\t\t// Check that character counters are reset\n\t\tawait expect(page.locator('#with-maxlength').locator('.sds-textarea__character-counter')).toHaveText(\n\t\t\t'Du har 10 tegn igjen'\n\t\t);\n\t\tawait expect(page.locator('#with-value').locator('.sds-textarea__character-counter')).toHaveText(\n\t\t\t'Du har 8 tegn igjen'\n\t\t);\n\t});\n\n\ttest('focus', async ({ page }) => {\n\t\tfor (const id of textareaIds) {\n\t\t\tif (id === 'disabled') continue; // Skip disabled textarea\n\n\t\t\t// Prepare for focus test by adding a parent div for consistent screenshots\n\t\t\tawait page.evaluate((id) => {\n\t\t\t\tconst element = document.getElementById(id);\n\t\t\t\tif (element) {\n\t\t\t\t\tconst parentDiv = document.createElement('div');\n\t\t\t\t\tparentDiv.style.padding = '10px';\n\t\t\t\t\tparentDiv.style.backgroundColor = 'white';\n\t\t\t\t\telement.parentNode?.insertBefore(parentDiv, element);\n\t\t\t\t\tparentDiv.appendChild(element);\n\t\t\t\t}\n\t\t\t}, id);\n\n\t\t\t// Focus the textarea\n\t\t\tawait page.locator(`#${id}`).focus();\n\n\t\t\t// Verify focus state\n\t\t\tconst isFocused = await page.evaluate((id) => {\n\t\t\t\tconst element = document.getElementById(id);\n\t\t\t\treturn element === document.activeElement;\n\t\t\t}, id);\n\n\t\t\texpect(isFocused).toBeTruthy();\n\t\t}\n\t});\n\n\ttest('minlength', async ({ page }) => {\n\t\tconst textarea = page.locator('#with-min-max');\n\n\t\t// Text shorter than minlength (5) → invalid\n\t\tawait textarea.pressSequentially('abc');\n\t\tconst isValidShort = await textarea.evaluate((el: HTMLTextAreaElement) => el.checkValidity());\n\t\texpect(isValidShort).toBe(false);\n\n\t\t// Text exactly at minlength (5) → valid\n\t\tawait page.goto(pageUrl);\n\t\tawait textarea.pressSequentially('abcde');\n\t\tconst isValidExact = await textarea.evaluate((el: HTMLTextAreaElement) => el.checkValidity());\n\t\texpect(isValidExact).toBe(true);\n\n\t\t// Text longer than minlength (5) → valid\n\t\tawait page.goto(pageUrl);\n\t\tawait textarea.pressSequentially('abcdefg');\n\t\tconst isValidLong = await textarea.evaluate((el: HTMLTextAreaElement) => el.checkValidity());\n\t\texpect(isValidLong).toBe(true);\n\t});\n\n\ttest('maxlength', async ({ page }) => {\n\t\tconst longStringToType = 'abcdefghijklmnop';\n\t\tconst textarea = page.locator('#with-maxlength');\n\n\t\t// Type in string longer than the 10 character maxlength\n\t\tawait textarea.pressSequentially(longStringToType);\n\t\tawait expect(textarea).toHaveValue(longStringToType.substring(0, 10));\n\t});\n\n\ttest('required', async ({ page }) => {\n\t\tconst textarea = page.locator('#required');\n\n\t\t// No value → invalid\n\t\tlet isValid = await textarea.evaluate((el: HTMLTextAreaElement) => el.checkValidity());\n\t\texpect(isValid).toBe(false);\n\n\t\t// Has value → valid\n\t\tawait page.goto(pageUrl);\n\t\tawait textarea.pressSequentially('abc');\n\t\tisValid = await textarea.evaluate((el: HTMLTextAreaElement) => el.checkValidity());\n\t\texpect(isValid).toBe(true);\n\t});\n\n\ttest('readonly', async ({ page }) => {\n\t\tconst textarea = page.locator('#readonly');\n\t\tawait textarea.pressSequentially('abc');\n\t\tawait expect(textarea).toHaveValue('Cannot be changed');\n\t});\n\n\ttest('autocomplete on/off', async ({ page }) => {\n\t\tconst textareas = [\n\t\t\t{ id: 'autocomplete-off', expected: 'off' },\n\t\t\t{ id: 'autocomplete-on', expected: 'on' },\n\t\t];\n\n\t\tfor (const { id, expected } of textareas) {\n\t\t\tconst host = page.locator(`#${id}`);\n\n\t\t\t// Check host element attribute\n\t\t\tawait expect(host).toHaveAttribute('autocomplete', expected);\n\n\t\t\t// Check shadow DOM textarea element\n\t\t\tconst shadowDomTextarea = await host.evaluate((el: HTMLElement) => {\n\t\t\t\tconst textarea = el.shadowRoot?.querySelector('textarea') as HTMLTextAreaElement | null;\n\t\t\t\treturn textarea?.autocomplete ?? null;\n\t\t\t});\n\t\t\texpect(shadowDomTextarea).toBe(expected);\n\t\t}\n\t});\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=sds-textarea.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sds-textarea.styles.d.ts","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAmHlB,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ all: unset;
5
+ display: block;
6
+ text-align: start;
7
+ }
8
+
9
+ .sds-textarea {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 0.25rem;
13
+ font-family: var(--sds-typography-font-family);
14
+
15
+ .sds-textarea__input-container {
16
+ max-width: var(--sds-typography-max-line-width);
17
+ position: relative;
18
+ }
19
+
20
+ .sds-textarea__input {
21
+ box-sizing: border-box;
22
+ color: var(--sds-color-semantic-text-default);
23
+ padding: 0.75rem 1rem;
24
+ line-height: 1.25rem;
25
+ font-size: 1rem;
26
+ justify-content: flex-end;
27
+ border-radius: var(--sds-radius-4);
28
+ border: 1px solid var(--sds-color-semantic-border-default);
29
+ background: var(--sds-color-semantic-surface-default);
30
+ max-width: var(--sds-typography-max-line-width);
31
+ width: 100%;
32
+ min-height: 6rem;
33
+ resize: vertical;
34
+ font-family: var(--sds-typography-font-family);
35
+
36
+ &:hover {
37
+ border-color: var(--sds-color-semantic-border-strong);
38
+ }
39
+
40
+ &:focus {
41
+ outline: 2px solid var(--sds-color-semantic-border-focus);
42
+ outline-offset: 1px;
43
+ }
44
+
45
+ &:active {
46
+ border-color: var(--sds-color-semantic-border-action);
47
+ outline: none;
48
+ }
49
+ }
50
+
51
+ .sds-textarea__label {
52
+ color: var(--sds-color-semantic-text-default);
53
+ display: block;
54
+ font-size: 1rem;
55
+ font-weight: 500;
56
+ line-height: 1.5rem;
57
+ max-width: var(--sds-typography-max-line-width);
58
+ }
59
+
60
+ .sds-textarea__help-text,
61
+ .sds-textarea__character-counter {
62
+ color: var(--sds-color-semantic-text-subtle);
63
+ font-size: 1rem;
64
+ font-weight: 400;
65
+ line-height: 1.25rem;
66
+ margin: 0;
67
+ max-width: var(--sds-typography-max-line-width);
68
+ }
69
+
70
+ .sds-textarea__character-counter--error {
71
+ color: var(--sds-color-semantic-text-warning);
72
+ }
73
+
74
+ .sds-textarea__error-message {
75
+ margin: 0;
76
+ max-width: var(--sds-typography-max-line-width);
77
+ align-items: flex-start;
78
+ color: var(--sds-color-semantic-text-default);
79
+ display: flex;
80
+ line-height: 1.5rem;
81
+ gap: 0.25rem;
82
+ }
83
+ }
84
+
85
+ .sds-textarea--error {
86
+ color: var(--sds-color-semantic-text-default);
87
+ line-height: 1.5rem;
88
+
89
+ .sds-textarea__input,
90
+ .sds-textarea__input:hover {
91
+ border-color: var(--sds-color-semantic-border-critical);
92
+ }
93
+ }
94
+
95
+ .sds-textarea--disabled {
96
+ pointer-events: none;
97
+
98
+ .sds-textarea__label,
99
+ .sds-textarea__help-text,
100
+ .sds-textarea__character-counter,
101
+ .sds-textarea__error-message,
102
+ .sds-textarea__input {
103
+ color: var(--sds-color-semantic-text-disabled);
104
+ }
105
+
106
+ .sds-textarea__input {
107
+ border: 1px solid var(--sds-color-semantic-border-disabled);
108
+ resize: none;
109
+ }
110
+ }
111
+
112
+ .sds-textarea--readonly {
113
+ .sds-textarea__input {
114
+ resize: none;
115
+ }
116
+ }
117
+ `;
118
+ //# sourceMappingURL=sds-textarea.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sds-textarea.styles.js","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\tall: unset;\n\t\tdisplay: block;\n\t\ttext-align: start;\n\t}\n\n\t.sds-textarea {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 0.25rem;\n\t\tfont-family: var(--sds-typography-font-family);\n\n\t\t.sds-textarea__input-container {\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t\tposition: relative;\n\t\t}\n\n\t\t.sds-textarea__input {\n\t\t\tbox-sizing: border-box;\n\t\t\tcolor: var(--sds-color-semantic-text-default);\n\t\t\tpadding: 0.75rem 1rem;\n\t\t\tline-height: 1.25rem;\n\t\t\tfont-size: 1rem;\n\t\t\tjustify-content: flex-end;\n\t\t\tborder-radius: var(--sds-radius-4);\n\t\t\tborder: 1px solid var(--sds-color-semantic-border-default);\n\t\t\tbackground: var(--sds-color-semantic-surface-default);\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t\twidth: 100%;\n\t\t\tmin-height: 6rem;\n\t\t\tresize: vertical;\n\t\t\tfont-family: var(--sds-typography-font-family);\n\n\t\t\t&:hover {\n\t\t\t\tborder-color: var(--sds-color-semantic-border-strong);\n\t\t\t}\n\n\t\t\t&:focus {\n\t\t\t\toutline: 2px solid var(--sds-color-semantic-border-focus);\n\t\t\t\toutline-offset: 1px;\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tborder-color: var(--sds-color-semantic-border-action);\n\t\t\t\toutline: none;\n\t\t\t}\n\t\t}\n\n\t\t.sds-textarea__label {\n\t\t\tcolor: var(--sds-color-semantic-text-default);\n\t\t\tdisplay: block;\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 500;\n\t\t\tline-height: 1.5rem;\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t}\n\n\t\t.sds-textarea__help-text,\n\t\t.sds-textarea__character-counter {\n\t\t\tcolor: var(--sds-color-semantic-text-subtle);\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 400;\n\t\t\tline-height: 1.25rem;\n\t\t\tmargin: 0;\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t}\n\n\t\t.sds-textarea__character-counter--error {\n\t\t\tcolor: var(--sds-color-semantic-text-warning);\n\t\t}\n\n\t\t.sds-textarea__error-message {\n\t\t\tmargin: 0;\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t\talign-items: flex-start;\n\t\t\tcolor: var(--sds-color-semantic-text-default);\n\t\t\tdisplay: flex;\n\t\t\tline-height: 1.5rem;\n\t\t\tgap: 0.25rem;\n\t\t}\n\t}\n\n\t.sds-textarea--error {\n\t\tcolor: var(--sds-color-semantic-text-default);\n\t\tline-height: 1.5rem;\n\n\t\t.sds-textarea__input,\n\t\t.sds-textarea__input:hover {\n\t\t\tborder-color: var(--sds-color-semantic-border-critical);\n\t\t}\n\t}\n\n\t.sds-textarea--disabled {\n\t\tpointer-events: none;\n\n\t\t.sds-textarea__label,\n\t\t.sds-textarea__help-text,\n\t\t.sds-textarea__character-counter,\n\t\t.sds-textarea__error-message,\n\t\t.sds-textarea__input {\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t}\n\n\t\t.sds-textarea__input {\n\t\t\tborder: 1px solid var(--sds-color-semantic-border-disabled);\n\t\t\tresize: none;\n\t\t}\n\t}\n\n\t.sds-textarea--readonly {\n\t\t.sds-textarea__input {\n\t\t\tresize: none;\n\t\t}\n\t}\n`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sds-textfield.d.ts","sourceRoot":"","sources":["../../src/sds-textfield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