@momentum-design/components 0.84.3 → 0.84.4
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.
- package/README.md +8 -3
- package/dist/browser/index.js +2233 -2291
- package/dist/browser/index.js.map +4 -4
- package/dist/components/alertchip/alertchip.component.d.ts +1 -1
- package/dist/components/alertchip/alertchip.component.js +2 -2
- package/dist/components/alertchip/alertchip.styles.js +22 -23
- package/dist/components/alertchip/alertchip.types.d.ts +1 -1
- package/dist/components/animation/animation.component.js +1 -1
- package/dist/components/animation/animation.styles.js +8 -5
- package/dist/components/appheader/appheader.component.js +12 -13
- package/dist/components/appheader/appheader.styles.js +0 -1
- package/dist/components/avatar/avatar.component.js +3 -16
- package/dist/components/avatar/avatar.constants.d.ts +1 -1
- package/dist/components/avatar/avatar.constants.js +1 -1
- package/dist/components/avatar/avatar.styles.js +129 -122
- package/dist/components/avatar/avatar.types.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.js +1 -1
- package/dist/components/avatarbutton/avatarbutton.component.d.ts +2 -2
- package/dist/components/avatarbutton/avatarbutton.component.js +2 -2
- package/dist/components/avatarbutton/avatarbutton.styles.js +34 -30
- package/dist/components/badge/badge.styles.js +9 -7
- package/dist/components/brandvisual/brandvisual.component.js +4 -4
- package/dist/components/bullet/bullet.component.d.ts +1 -1
- package/dist/components/bullet/bullet.component.js +2 -2
- package/dist/components/bullet/bullet.styles.js +3 -3
- package/dist/components/button/button.component.js +10 -4
- package/dist/components/button/button.utils.js +1 -1
- package/dist/components/buttongroup/buttongroup.component.js +1 -1
- package/dist/components/buttongroup/buttongroup.styles.js +68 -68
- package/dist/components/buttonlink/buttonlink.component.d.ts +5 -5
- package/dist/components/buttonlink/buttonlink.component.js +9 -9
- package/dist/components/buttonsimple/buttonsimple.component.js +2 -2
- package/dist/components/buttonsimple/buttonsimple.constants.d.ts +1 -1
- package/dist/components/buttonsimple/buttonsimple.constants.js +1 -1
- package/dist/components/buttonsimple/buttonsimple.styles.js +62 -57
- package/dist/components/card/card.component.d.ts +6 -6
- package/dist/components/card/card.component.js +15 -16
- package/dist/components/card/card.styles.js +24 -22
- package/dist/components/cardbutton/cardbutton.component.js +9 -12
- package/dist/components/cardbutton/cardbutton.styles.js +1 -1
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +6 -6
- package/dist/components/cardcheckbox/cardcheckbox.component.js +30 -29
- package/dist/components/cardcheckbox/cardcheckbox.styles.js +10 -10
- package/dist/components/cardradio/cardradio.component.d.ts +12 -12
- package/dist/components/cardradio/cardradio.component.js +27 -30
- package/dist/components/cardradio/cardradio.styles.js +8 -8
- package/dist/components/checkbox/checkbox.component.js +7 -9
- package/dist/components/checkbox/checkbox.styles.js +62 -60
- package/dist/components/chip/chip.component.d.ts +1 -1
- package/dist/components/chip/chip.component.js +6 -11
- package/dist/components/chip/chip.styles.js +4 -2
- package/dist/components/dialog/dialog.component.js +28 -29
- package/dist/components/dialog/dialog.styles.js +10 -12
- package/dist/components/divider/divider.component.js +6 -8
- package/dist/components/divider/divider.constants.d.ts +1 -1
- package/dist/components/divider/divider.constants.js +1 -1
- package/dist/components/divider/divider.styles.js +5 -20
- package/dist/components/filterchip/filterchip.styles.js +4 -2
- package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -4
- package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +19 -17
- package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +2 -1
- package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +4 -4
- package/dist/components/icon/icon.component.js +7 -7
- package/dist/components/icon/icon.utils.d.ts +1 -1
- package/dist/components/icon/icon.utils.js +7 -7
- package/dist/components/iconprovider/iconprovider.component.js +7 -7
- package/dist/components/input/input.component.d.ts +5 -5
- package/dist/components/input/input.component.js +64 -62
- package/dist/components/input/input.styles.js +128 -117
- package/dist/components/inputchip/inputchip.component.js +14 -19
- package/dist/components/inputchip/inputchip.styles.js +5 -3
- package/dist/components/link/link.component.d.ts +1 -1
- package/dist/components/link/link.component.js +4 -8
- package/dist/components/link/link.constants.d.ts +1 -1
- package/dist/components/link/link.constants.js +1 -1
- package/dist/components/link/link.styles.js +12 -12
- package/dist/components/linksimple/linksimple.component.js +2 -4
- package/dist/components/linksimple/linksimple.styles.js +59 -57
- package/dist/components/list/list.component.js +12 -9
- package/dist/components/listitem/listitem.component.js +15 -11
- package/dist/components/listitem/listitem.styles.js +11 -6
- package/dist/components/marker/marker.component.js +1 -1
- package/dist/components/marker/marker.styles.js +2 -2
- package/dist/components/menubar/menubar.component.d.ts +19 -19
- package/dist/components/menubar/menubar.component.js +19 -19
- package/dist/components/menuitem/menuitem.component.js +15 -15
- package/dist/components/menuitem/menuitem.styles.js +3 -2
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +4 -11
- package/dist/components/menuitemradio/menuitemradio.component.js +1 -1
- package/dist/components/menupopover/menupopover.component.js +11 -11
- package/dist/components/menupopover/menupopover.utils.d.ts +1 -1
- package/dist/components/menupopover/menupopover.utils.js +3 -8
- package/dist/components/navitem/navitem.component.js +11 -19
- package/dist/components/navitem/navitem.styles.js +147 -143
- package/dist/components/navitemlist/navitemlist.component.js +2 -2
- package/dist/components/optgroup/optgroup.component.js +12 -9
- package/dist/components/option/option.component.js +11 -11
- package/dist/components/option/option.styles.js +1 -1
- package/dist/components/popover/popover.component.js +4 -4
- package/dist/components/popover/popover.stack.js +1 -1
- package/dist/components/popover/popover.styles.js +0 -1
- package/dist/components/popover/popover.utils.js +3 -4
- package/dist/components/presence/presence.component.d.ts +4 -4
- package/dist/components/presence/presence.component.js +4 -4
- package/dist/components/progressbar/progressbar.component.js +3 -4
- package/dist/components/progressbar/progressbar.styles.js +77 -71
- package/dist/components/progressspinner/progressspiner.utils.js +4 -4
- package/dist/components/progressspinner/progressspinner.component.js +38 -37
- package/dist/components/progressspinner/progressspinner.styles.js +1 -1
- package/dist/components/radio/radio.component.d.ts +41 -41
- package/dist/components/radio/radio.component.js +84 -83
- package/dist/components/radio/radio.styles.js +77 -75
- package/dist/components/radiogroup/radiogroup.component.js +1 -1
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +2 -2
- package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -6
- package/dist/components/searchfield/searchfield.component.js +23 -17
- package/dist/components/searchfield/searchfield.styles.js +11 -13
- package/dist/components/select/select.component.js +20 -23
- package/dist/components/select/select.styles.js +9 -9
- package/dist/components/sidenavigation/sidenavigation.component.d.ts +6 -6
- package/dist/components/sidenavigation/sidenavigation.component.js +39 -29
- package/dist/components/sidenavigation/sidenavigation.context.js +5 -5
- package/dist/components/sidenavigation/sidenavigation.styles.js +53 -53
- package/dist/components/skeleton/skeleton.component.js +1 -4
- package/dist/components/skeleton/skeleton.constants.d.ts +1 -1
- package/dist/components/skeleton/skeleton.constants.js +1 -1
- package/dist/components/skeleton/skeleton.styles.js +4 -4
- package/dist/components/spinner/spinner.component.d.ts +7 -7
- package/dist/components/spinner/spinner.component.js +9 -9
- package/dist/components/spinner/spinner.styles.js +58 -53
- package/dist/components/staticcheckbox/staticcheckbox.component.js +10 -8
- package/dist/components/staticcheckbox/staticcheckbox.styles.js +52 -51
- package/dist/components/staticradio/staticradio.component.d.ts +8 -8
- package/dist/components/staticradio/staticradio.component.js +10 -11
- package/dist/components/staticradio/staticradio.styles.js +77 -75
- package/dist/components/statictoggle/statictoggle.component.d.ts +3 -3
- package/dist/components/statictoggle/statictoggle.component.js +3 -3
- package/dist/components/statictoggle/statictoggle.styles.js +71 -68
- package/dist/components/tab/tab.component.d.ts +1 -1
- package/dist/components/tab/tab.component.js +2 -2
- package/dist/components/tab/tab.styles.js +247 -245
- package/dist/components/tablist/tablist.component.js +11 -15
- package/dist/components/tablist/tablist.styles.js +27 -25
- package/dist/components/tablist/tablist.types.d.ts +1 -1
- package/dist/components/tablist/tablist.utils.js +4 -4
- package/dist/components/text/fonts.styles.js +49 -49
- package/dist/components/text/text.component.js +21 -11
- package/dist/components/text/text.types.d.ts +1 -1
- package/dist/components/textarea/textarea.component.d.ts +31 -31
- package/dist/components/textarea/textarea.component.js +54 -61
- package/dist/components/textarea/textarea.styles.js +123 -122
- package/dist/components/themeprovider/themeprovider.component.js +1 -1
- package/dist/components/themeprovider/themeprovider.styles.js +4 -4
- package/dist/components/toggle/toggle.component.d.ts +35 -35
- package/dist/components/toggle/toggle.component.js +62 -63
- package/dist/components/toggle/toggle.styles.js +77 -69
- package/dist/components/toggletip/toggletip.component.d.ts +7 -7
- package/dist/components/toggletip/toggletip.component.js +3 -2
- package/dist/components/tooltip/tooltip.component.js +1 -1
- package/dist/components/tooltip/tooltip.styles.js +0 -1
- package/dist/components/virtualizedlist/virtualizedlist.component.js +6 -14
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +1 -1
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +14 -11
- package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -4
- package/dist/custom-elements.json +514 -514
- package/dist/index.js +1 -0
- package/dist/models/component/index.d.ts +1 -1
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
- package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
- package/dist/utils/mixins/FocusTrapMixin.js +12 -12
- package/dist/utils/mixins/IconNameMixin.d.ts +1 -1
- package/dist/utils/mixins/MenuMixin.js +23 -23
- package/dist/utils/mixins/PreventScrollMixin.d.ts +1 -1
- package/dist/utils/styles/index.js +12 -12
- package/package.json +1 -1
@@ -10,13 +10,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
12
12
|
import { property, query } from 'lit/decorators.js';
|
13
|
-
import styles from './textarea.styles';
|
14
13
|
import FormfieldWrapper from '../formfieldwrapper';
|
15
14
|
import { DEFAULTS as FORMFIELD_DEFAULTS, VALIDATION } from '../formfieldwrapper/formfieldwrapper.constants';
|
16
15
|
import { AUTO_CAPITALIZE } from '../input/input.constants';
|
17
|
-
import { AUTO_COMPLETE, WRAP, DEFAULTS } from './textarea.constants';
|
18
16
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
19
17
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
18
|
+
import { AUTO_COMPLETE, WRAP, DEFAULTS } from './textarea.constants';
|
19
|
+
import styles from './textarea.styles';
|
20
20
|
/**
|
21
21
|
* mdc-textarea component, which is used to get the multi-line text input from the user.
|
22
22
|
* It contains:
|
@@ -114,13 +114,15 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
114
114
|
super.connectedCallback();
|
115
115
|
// Set the default value to the textarea field if the value is set through the text content directly
|
116
116
|
this.value = ((_a = this.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || this.value;
|
117
|
-
this.updateComplete
|
117
|
+
this.updateComplete
|
118
|
+
.then(() => {
|
118
119
|
if (this.textarea) {
|
119
120
|
this.textarea.checkValidity();
|
120
121
|
this.setTextareaValidity();
|
121
122
|
this.internals.setFormValue(this.textarea.value);
|
122
123
|
}
|
123
|
-
})
|
124
|
+
})
|
125
|
+
.catch(error => {
|
124
126
|
if (this.onerror) {
|
125
127
|
this.onerror(error);
|
126
128
|
}
|
@@ -130,10 +132,10 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
130
132
|
if (this.required && this.validationMessage && this.value === '') {
|
131
133
|
this.textarea.setCustomValidity(this.validationMessage);
|
132
134
|
}
|
133
|
-
else if (this.maxCharacterLimit
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
else if (this.maxCharacterLimit &&
|
136
|
+
this.value.length > this.maxCharacterLimit &&
|
137
|
+
this.helpTextType === VALIDATION.ERROR &&
|
138
|
+
this.helpText) {
|
137
139
|
// Set custom validity if the character limit is exceeded to stop form submission
|
138
140
|
// helptext and helptexttype will be set by the consumers.
|
139
141
|
this.textarea.setCustomValidity(this.helpText);
|
@@ -153,14 +155,16 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
153
155
|
this.value = state;
|
154
156
|
}
|
155
157
|
/**
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
158
|
+
* Handles the value change of the textarea field.
|
159
|
+
* Sets the form value and updates the validity of the textarea field.
|
160
|
+
* @returns void
|
161
|
+
*/
|
160
162
|
handleValueChange() {
|
161
|
-
this.updateComplete
|
163
|
+
this.updateComplete
|
164
|
+
.then(() => {
|
162
165
|
this.setTextareaValidity();
|
163
|
-
})
|
166
|
+
})
|
167
|
+
.catch(error => {
|
164
168
|
if (this.onerror) {
|
165
169
|
this.onerror(error);
|
166
170
|
}
|
@@ -174,24 +178,22 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
174
178
|
}
|
175
179
|
}
|
176
180
|
/**
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
* This function is called when the attribute changes.
|
182
|
+
* It updates the validity of the textarea field based on the textarea field's validity.
|
183
|
+
*
|
184
|
+
* @param name - attribute name
|
185
|
+
* @param old - old value
|
186
|
+
* @param value - new value
|
187
|
+
*/
|
184
188
|
attributeChangedCallback(name, old, value) {
|
185
189
|
super.attributeChangedCallback(name, old, value);
|
186
|
-
const validationRelatedAttributes = [
|
187
|
-
'maxlength',
|
188
|
-
'minlength',
|
189
|
-
'required',
|
190
|
-
];
|
190
|
+
const validationRelatedAttributes = ['maxlength', 'minlength', 'required'];
|
191
191
|
if (validationRelatedAttributes.includes(name)) {
|
192
|
-
this.updateComplete
|
192
|
+
this.updateComplete
|
193
|
+
.then(() => {
|
193
194
|
this.setTextareaValidity();
|
194
|
-
})
|
195
|
+
})
|
196
|
+
.catch(error => {
|
195
197
|
if (this.onerror) {
|
196
198
|
this.onerror(error);
|
197
199
|
}
|
@@ -199,9 +201,9 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
199
201
|
}
|
200
202
|
}
|
201
203
|
/**
|
202
|
-
|
203
|
-
|
204
|
-
|
204
|
+
* Dispatches the character overflow state change event.
|
205
|
+
* @returns void
|
206
|
+
*/
|
205
207
|
dispatchCharacterOverflowStateChangeEvent() {
|
206
208
|
this.dispatchEvent(new CustomEvent('limitexceeded', {
|
207
209
|
detail: {
|
@@ -217,7 +219,7 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
217
219
|
* Handles the character overflow state change.
|
218
220
|
* Dispatches the character overflow state change event if the character limit is exceeded or restored.
|
219
221
|
* @returns void
|
220
|
-
|
222
|
+
*/
|
221
223
|
handleCharacterOverflowStateChange() {
|
222
224
|
if (this.maxCharacterLimit) {
|
223
225
|
if (this.value.length > this.maxCharacterLimit && !this.characterLimitExceedingFired) {
|
@@ -231,24 +233,24 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
231
233
|
}
|
232
234
|
}
|
233
235
|
/**
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
236
|
+
* Updates the value of the textarea field.
|
237
|
+
* Sets the form value.
|
238
|
+
* @returns void
|
239
|
+
*/
|
238
240
|
updateValue() {
|
239
241
|
this.value = this.textarea.value;
|
240
242
|
this.internals.setFormValue(this.textarea.value);
|
241
243
|
}
|
242
244
|
/**
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
245
|
+
* Handles the change event of the textarea field.
|
246
|
+
* Updates the value and sets the validity of the textarea field.
|
247
|
+
*
|
248
|
+
* The 'change' event does not bubble up through the shadow DOM as it was not composed.
|
249
|
+
* Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
|
250
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
|
251
|
+
*
|
252
|
+
* @param event - Event which contains information about the value change.
|
253
|
+
*/
|
252
254
|
onChange(event) {
|
253
255
|
this.updateValue();
|
254
256
|
const EventConstructor = event.constructor;
|
@@ -259,12 +261,8 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
259
261
|
return nothing;
|
260
262
|
}
|
261
263
|
return html `
|
262
|
-
<mdc-text
|
263
|
-
|
264
|
-
tagname="span"
|
265
|
-
type=${DEFAULTS.CHARACTER_COUNTER_TYPE}
|
266
|
-
>
|
267
|
-
${this.value.length < 10 ? `0${this.value.length}` : this.value.length}/${this.maxCharacterLimit}
|
264
|
+
<mdc-text part="character-counter" tagname="span" type=${DEFAULTS.CHARACTER_COUNTER_TYPE}>
|
265
|
+
${this.value.length < 10 ? `0${this.value.length}` : this.value.length}/${this.maxCharacterLimit}
|
268
266
|
</mdc-text>
|
269
267
|
`;
|
270
268
|
}
|
@@ -272,12 +270,7 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
272
270
|
if (!this.helpText && !this.maxCharacterLimit) {
|
273
271
|
return nothing;
|
274
272
|
}
|
275
|
-
return html `
|
276
|
-
<div part="textarea-footer">
|
277
|
-
${this.renderHelperText()}
|
278
|
-
${this.renderCharacterCounter()}
|
279
|
-
</div>
|
280
|
-
`;
|
273
|
+
return html ` <div part="textarea-footer">${this.renderHelperText()} ${this.renderCharacterCounter()}</div> `;
|
281
274
|
}
|
282
275
|
render() {
|
283
276
|
var _a;
|
@@ -286,7 +279,7 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
286
279
|
<div class="textarea-container mdc-focus-ring" part="textarea-container">
|
287
280
|
<textarea
|
288
281
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
289
|
-
part=
|
282
|
+
part="textarea"
|
290
283
|
id="${this.id}"
|
291
284
|
name="${this.name}"
|
292
285
|
.value="${this.value}"
|
@@ -308,9 +301,9 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
308
301
|
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
309
302
|
aria-invalid="${this.helpTextType === 'error' ? 'true' : 'false'}"
|
310
303
|
></textarea>
|
311
|
-
|
312
|
-
|
313
|
-
|
304
|
+
</div>
|
305
|
+
${this.renderTextareaFooter()}
|
306
|
+
`;
|
314
307
|
}
|
315
308
|
}
|
316
309
|
Textarea.styles = [...FormfieldWrapper.styles, ...styles];
|
@@ -1,125 +1,126 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
import { hostFocusRingStyles } from '../../utils/styles';
|
3
|
-
const styles = [
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
3
|
+
const styles = [
|
4
|
+
css `
|
5
|
+
:host {
|
6
|
+
--mdc-textarea-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
7
|
+
--mdc-textarea-disabled-text-color: var(--mds-color-theme-text-primary-disabled);
|
8
|
+
--mdc-textarea-disabled-background-color: var(--mds-color-theme-background-input-disabled);
|
9
|
+
--mdc-textarea-text-color: var(--mds-color-theme-text-primary-normal);
|
10
|
+
--mdc-textarea-background-color: var(--mds-color-theme-background-primary-ghost);
|
11
|
+
--mdc-textarea-border-color: var(--mds-color-theme-outline-input-normal);
|
12
|
+
--mdc-textarea-text-secondary-normal: var(--mds-color-theme-text-secondary-normal);
|
13
|
+
--mdc-textarea-error-border-color: var(--mds-color-theme-text-error-normal);
|
14
|
+
--mdc-textarea-warning-border-color: var(--mds-color-theme-text-warning-normal);
|
15
|
+
--mdc-textarea-success-border-color: var(--mds-color-theme-text-success-normal);
|
16
|
+
--mdc-textarea-primary-border-color: var(--mds-color-theme-text-accent-normal);
|
17
|
+
--mdc-textarea-hover-background-color: var(--mds-color-theme-background-primary-hover);
|
18
|
+
--mdc-textarea-focused-background-color: var(--mds-color-theme-background-primary-ghost);
|
19
|
+
--mdc-textarea-focused-border-color: var(--mds-color-theme-outline-input-active);
|
20
|
+
--mdc-textarea-text-font-size: var(--mds-font-size-body-midsize);
|
21
|
+
--mdc-textarea-text-line-height: var(--mds-font-lineheight-body-midsize);
|
22
|
+
}
|
23
|
+
|
24
|
+
:host([disabled])::part(textarea),
|
25
|
+
:host([disabled])::part(textarea)::placeholder {
|
26
|
+
color: var(--mdc-input-disabled-text-color);
|
27
|
+
}
|
28
|
+
|
29
|
+
:host([disabled])::part(textarea-container),
|
30
|
+
:host([readonly])::part(textarea-container) {
|
31
|
+
border-color: var(--mdc-textarea-disabled-border-color);
|
32
|
+
background: var(--mdc-textarea-disabled-background-color);
|
33
|
+
}
|
34
|
+
|
35
|
+
:host([disabled][help-text-type='default'])::part(textarea-container),
|
36
|
+
:host([disabled][help-text-type='success'])::part(textarea-container),
|
37
|
+
:host([disabled][help-text-type='warning'])::part(textarea-container),
|
38
|
+
:host([disabled][help-text-type='error'])::part(textarea-container),
|
39
|
+
:host([disabled][help-text-type='priority'])::part(textarea-container) {
|
40
|
+
border-color: var(--mdc-textarea-disabled-border-color);
|
41
|
+
}
|
42
|
+
|
43
|
+
:host::part(textarea) {
|
44
|
+
min-height: 6.25rem;
|
45
|
+
color: var(--mdc-textarea-text-color);
|
46
|
+
font-family: inherit;
|
47
|
+
font-size: var(--mdc-textarea-text-font-size);
|
48
|
+
line-height: var(--mdc-textarea-text-line-height);
|
49
|
+
background-color: var(--mdc-textarea-background-color);
|
50
|
+
resize: none;
|
51
|
+
border: none;
|
52
|
+
outline: none;
|
53
|
+
box-sizing: border-box;
|
54
|
+
}
|
55
|
+
|
56
|
+
:host::part(textarea-container) {
|
57
|
+
display: flex;
|
58
|
+
border-radius: 0.5rem;
|
59
|
+
border: 0.0625rem solid var(--mdc-textarea-border-color);
|
60
|
+
overflow: hidden;
|
61
|
+
padding: 0.375rem 0.25rem 0.25rem 0.75rem;
|
62
|
+
}
|
63
|
+
|
64
|
+
:host(:dir(rtl))::part(textarea-container) {
|
65
|
+
padding: 0.375rem 0.75rem 0.25rem 0.25rem;
|
66
|
+
}
|
67
|
+
|
68
|
+
:host(:not([disabled]))::part(textarea-container):hover {
|
69
|
+
background-color: var(--mdc-textarea-hover-background-color);
|
70
|
+
}
|
71
|
+
|
72
|
+
:host(:not([disabled]))::part(textarea-container):active,
|
73
|
+
:host(:not([disabled]))::part(textarea-container):focus-within {
|
74
|
+
background-color: var(--mdc-textarea-focused-background-color);
|
75
|
+
border-color: var(--mdc-textarea-focused-border-color);
|
76
|
+
}
|
77
|
+
|
78
|
+
:host::part(textarea-footer) {
|
79
|
+
display: flex;
|
80
|
+
justify-content: space-between;
|
81
|
+
align-items: center;
|
82
|
+
width: 100%;
|
83
|
+
}
|
84
|
+
|
85
|
+
.textarea::placeholder {
|
86
|
+
color: var(--mdc-textarea-text-secondary-normal);
|
87
|
+
}
|
88
|
+
|
89
|
+
:host::part(character-counter) {
|
90
|
+
margin-left: auto;
|
91
|
+
color: var(--mdc-textarea-text-secondary-normal);
|
92
|
+
}
|
93
|
+
|
94
|
+
:host([help-text-type='error'])::part(character-counter) {
|
95
|
+
color: var(--mdc-textarea-error-border-color);
|
96
|
+
}
|
97
|
+
|
98
|
+
:host([disabled])::part(character-counter) {
|
99
|
+
color: var(--mds-color-theme-text-primary-disabled);
|
100
|
+
}
|
101
|
+
|
102
|
+
:host([help-text-type='error'])::part(textarea-container),
|
103
|
+
:host([help-text-type='error'])::part(textarea-container):focus-within {
|
104
|
+
border-color: var(--mdc-textarea-error-border-color);
|
105
|
+
}
|
106
|
+
:host([help-text-type='warning'])::part(textarea-container),
|
107
|
+
:host([help-text-type='warning'])::part(textarea-container):focus-within {
|
108
|
+
border-color: var(--mdc-textarea-warning-border-color);
|
109
|
+
}
|
110
|
+
:host([help-text-type='success'])::part(textarea-container),
|
111
|
+
:host([help-text-type='success'])::part(textarea-container):focus-within {
|
112
|
+
border-color: var(--mdc-textarea-success-border-color);
|
113
|
+
}
|
114
|
+
:host([help-text-type='priority'])::part(textarea-container),
|
115
|
+
:host([help-text-type='priority'])::part(textarea-container):focus-within {
|
116
|
+
border-color: var(--mdc-textarea-primary-border-color);
|
117
|
+
}
|
118
|
+
|
119
|
+
.hidden {
|
120
|
+
opacity: 0;
|
121
|
+
pointer-events: none;
|
122
|
+
}
|
123
|
+
`,
|
124
|
+
...hostFocusRingStyles(true),
|
125
|
+
];
|
125
126
|
export default styles;
|
@@ -8,8 +8,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
9
|
};
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
11
|
-
import { DEFAULTS } from './themeprovider.constants';
|
12
11
|
import { Provider } from '../../models';
|
12
|
+
import { DEFAULTS } from './themeprovider.constants';
|
13
13
|
import ThemeProviderContext from './themeprovider.context';
|
14
14
|
import styles from './themeprovider.styles';
|
15
15
|
/**
|
@@ -7,14 +7,14 @@ const styles = css `
|
|
7
7
|
/* adjusting Inter's letter spacing to better match the old CiscoSans */
|
8
8
|
--mdc-themeprovider-letter-spacing-adjustment: -0.25px;
|
9
9
|
/* Adjusting font feature settings for accessibility reasons */
|
10
|
-
--mdc-themeprovider-font-feature-settings:
|
10
|
+
--mdc-themeprovider-font-feature-settings: 'ss02' on;
|
11
11
|
|
12
12
|
/* Custom scrollbar variables */
|
13
13
|
--mdc-themeprovider-scrollbar-track-color: var(--mds-color-theme-background-secondary-normal);
|
14
14
|
--mdc-themeprovider-scrollbar-thumb-color: var(--mds-color-theme-scrollbar-button-normal);
|
15
15
|
--mdc-themeprovider-scrollbar-thumb-hover-color: var(--mds-color-theme-scrollbar-button-hover);
|
16
16
|
--mdc-themeprovider-scrollbar-thumb-active-color: var(--mds-color-theme-scrollbar-button-pressed);
|
17
|
-
|
17
|
+
|
18
18
|
color: var(--mdc-themeprovider-color-default);
|
19
19
|
font-family: var(--mdc-themeprovider-font-family);
|
20
20
|
font-weight: var(--mdc-themeprovider-font-weight);
|
@@ -22,8 +22,8 @@ const styles = css `
|
|
22
22
|
|
23
23
|
font-feature-settings: var(--mdc-themeprovider-font-feature-settings);
|
24
24
|
}
|
25
|
-
|
26
|
-
/** Scrollbar Theme for Chrome, Edge, and Firefox. This has limited support on other browsers.
|
25
|
+
|
26
|
+
/** Scrollbar Theme for Chrome, Edge, and Firefox. This has limited support on other browsers.
|
27
27
|
https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color for more details */
|
28
28
|
* {
|
29
29
|
scrollbar-color: var(--mdc-themeprovider-scrollbar-thumb-color) var(--mdc-themeprovider-scrollbar-track-color);
|
@@ -40,9 +40,9 @@ declare const Toggle_base: import("../../utils/mixins/index.types").Constructor<
|
|
40
40
|
*/
|
41
41
|
declare class Toggle extends Toggle_base implements AssociatedFormControl {
|
42
42
|
/**
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
* Determines whether the toggle is active or inactive.
|
44
|
+
* @default false
|
45
|
+
*/
|
46
46
|
checked: boolean;
|
47
47
|
/**
|
48
48
|
* Determines toggle size in rem (height is specified here).
|
@@ -52,55 +52,55 @@ declare class Toggle extends Toggle_base implements AssociatedFormControl {
|
|
52
52
|
*/
|
53
53
|
size: ToggleSize;
|
54
54
|
/**
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
* Automatically focus on the element when the page loads.
|
56
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
57
|
+
* @default false
|
58
|
+
*/
|
59
59
|
autofocus: boolean;
|
60
60
|
connectedCallback(): void;
|
61
61
|
/** @internal
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
* Resets the checkbox to its initial state.
|
63
|
+
* The checked property is set to false.
|
64
|
+
*/
|
65
65
|
formResetCallback(): void;
|
66
66
|
/** @internal */
|
67
67
|
formStateRestoreCallback(state: string): void;
|
68
68
|
/**
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
* Manages the required state of the checkbox.
|
70
|
+
* If the checkbox is not checked and the required property is set, then the checkbox is invalid.
|
71
|
+
* If the validationMessage is set, it will be used as the custom validity message.
|
72
|
+
* If the validationMessage is not set, it will clear the custom validity message.
|
73
|
+
*/
|
74
74
|
private manageRequired;
|
75
75
|
/**
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
* Updates the form value to reflect the current state of the toggle.
|
77
|
+
* If toggle is switched on, the value is set to either the user-provided value or 'isActive' if no value is provided.
|
78
|
+
* If toggle is switched off, the value is set to null.
|
79
|
+
*/
|
80
80
|
private setFormValue;
|
81
81
|
/**
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
* Toggles the state of the toggle element.
|
83
|
+
* If the element is not disabled, then the checked property is toggled.
|
84
|
+
*/
|
85
85
|
private toggleState;
|
86
86
|
/**
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
* Handles the keydown event on the toggle element.
|
88
|
+
* When the user presses Enter, the form is submitted.
|
89
|
+
* @param event - The keyboard event.
|
90
|
+
*/
|
91
91
|
private handleKeyDown;
|
92
92
|
/**
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
* Toggles the state of the toggle element.
|
94
|
+
* and dispatch the new change event.
|
95
|
+
*/
|
96
96
|
private handleChange;
|
97
97
|
/**
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
98
|
+
* Sets the size attribute for the toggle component.
|
99
|
+
* If the provided size is not included in the TOGGLE_SIZE,
|
100
|
+
* it defaults to the value specified in DEFAULTS.SIZE.
|
101
|
+
*
|
102
|
+
* @param size - The size to set.
|
103
|
+
*/
|
104
104
|
private setToggleSize;
|
105
105
|
update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
106
106
|
render(): import("lit-html").TemplateResult<1>;
|