@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
@@ -28,5 +28,5 @@ interface Args {
|
|
28
28
|
* @returns Response string from the fetch
|
29
29
|
* @throws Error if the response is not ok
|
30
30
|
*/
|
31
|
-
declare const svgFetch: ({ url, name, fileExtension, cacheStrategy, cacheName, renewSignal
|
31
|
+
declare const svgFetch: ({ url, name, fileExtension, cacheStrategy, cacheName, renewSignal }: Args) => Promise<string>;
|
32
32
|
export { svgFetch };
|
@@ -6,7 +6,7 @@ import { iconsCache } from '../../utils/icon-cache';
|
|
6
6
|
* @returns Promise<Response> - The response from the fetch
|
7
7
|
* @throws Error if the response is not ok
|
8
8
|
*/
|
9
|
-
const fetchIcon = async (request) => fetch(request).then(
|
9
|
+
const fetchIcon = async (request) => fetch(request).then(response => {
|
10
10
|
if (!response.ok) {
|
11
11
|
throw new Error('There was a problem while fetching the icon!');
|
12
12
|
}
|
@@ -33,7 +33,7 @@ const fetchIcon = async (request) => fetch(request).then((response) => {
|
|
33
33
|
* @returns Response string from the fetch
|
34
34
|
* @throws Error if the response is not ok
|
35
35
|
*/
|
36
|
-
const svgFetch = async ({ url, name, fileExtension, cacheStrategy, cacheName, renewSignal
|
36
|
+
const svgFetch = async ({ url, name, fileExtension, cacheStrategy, cacheName, renewSignal }) => {
|
37
37
|
// abort the previous fetch request if it is still pending
|
38
38
|
// and create a new signal
|
39
39
|
const signal = renewSignal();
|
@@ -43,11 +43,11 @@ const svgFetch = async ({ url, name, fileExtension, cacheStrategy, cacheName, re
|
|
43
43
|
// if there is no cache defined (cacheName and cacheStrategy properly set),
|
44
44
|
// fetch the icon and return the response
|
45
45
|
if (!cacheName || !cacheStrategy || !['in-memory-cache', 'web-cache-api'].includes(cacheStrategy)) {
|
46
|
-
return fetchIcon(request).then(
|
46
|
+
return fetchIcon(request).then(response => response.text());
|
47
47
|
}
|
48
|
-
return iconsCache(cacheName, cacheStrategy).then(
|
48
|
+
return iconsCache(cacheName, cacheStrategy).then(iconsCache => iconsCache
|
49
49
|
.get(request)
|
50
|
-
.then(
|
50
|
+
.then(responseFromCache => {
|
51
51
|
// **If entry in cache, return**
|
52
52
|
if (responseFromCache) {
|
53
53
|
return responseFromCache;
|
@@ -56,7 +56,7 @@ const svgFetch = async ({ url, name, fileExtension, cacheStrategy, cacheName, re
|
|
56
56
|
// Both fetchIcon() and iconsCache.set() "consume" the request,
|
57
57
|
// so we need to make a copy.
|
58
58
|
// (see https://developer.mozilla.org/en-US/docs/Web/API/Request/clone)
|
59
|
-
return fetchIcon(request.clone()).then(
|
59
|
+
return fetchIcon(request.clone()).then(response => {
|
60
60
|
var _a;
|
61
61
|
// This avoids caching responses that we know are errors
|
62
62
|
// (i.e. HTTP status code of 4xx or 5xx).
|
@@ -68,7 +68,7 @@ const svgFetch = async ({ url, name, fileExtension, cacheStrategy, cacheName, re
|
|
68
68
|
return response.text();
|
69
69
|
});
|
70
70
|
})
|
71
|
-
.catch(
|
71
|
+
.catch(error => {
|
72
72
|
// Note that a HTTP error response (e.g. 404) will NOT trigger
|
73
73
|
// an exception.
|
74
74
|
// It will return a normal response object that has the appropriate
|
@@ -110,13 +110,13 @@ class IconProvider extends Provider {
|
|
110
110
|
}
|
111
111
|
}
|
112
112
|
updateContext() {
|
113
|
-
if (this.context.value.fileExtension !== this.fileExtension
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
113
|
+
if (this.context.value.fileExtension !== this.fileExtension ||
|
114
|
+
this.context.value.iconSet !== this.iconSet ||
|
115
|
+
this.context.value.url !== this.url ||
|
116
|
+
this.context.value.lengthUnit !== this.lengthUnit ||
|
117
|
+
this.context.value.size !== this.size ||
|
118
|
+
this.context.value.cacheName !== this.cacheName ||
|
119
|
+
this.context.value.cacheStrategy !== this.cacheStrategy) {
|
120
120
|
this.updateValuesInContext();
|
121
121
|
this.context.updateObservers();
|
122
122
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { CSSResult, nothing, PropertyValueMap } from 'lit';
|
2
2
|
import FormfieldWrapper from '../formfieldwrapper';
|
3
3
|
import type { IconNames } from '../icon/icon.types';
|
4
|
-
import type { AutoCapitalizeType, AutoCompleteType, InputType } from './input.types';
|
5
4
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
5
|
+
import type { AutoCapitalizeType, AutoCompleteType, InputType } from './input.types';
|
6
6
|
declare const Input_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
7
7
|
/**
|
8
8
|
* mdc-input is a component that allows users to input text.
|
@@ -164,10 +164,10 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
164
164
|
*/
|
165
165
|
private onChange;
|
166
166
|
/**
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
* Handles the keydown event of the input field.
|
168
|
+
* If the key pressed is 'Enter', it submits the form.
|
169
|
+
* @param event - Keyboard event
|
170
|
+
*/
|
171
171
|
protected handleKeyDown(event: KeyboardEvent): void;
|
172
172
|
/**
|
173
173
|
* Renders the leading icon before the input field.
|
@@ -10,12 +10,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
13
|
-
import styles from './input.styles';
|
14
13
|
import FormfieldWrapper from '../formfieldwrapper';
|
15
|
-
import { AUTO_CAPITALIZE, AUTO_COMPLETE, DEFAULTS, PREFIX_TEXT_OPTIONS } from './input.constants';
|
16
14
|
import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
|
17
15
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
18
16
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
17
|
+
import { AUTO_CAPITALIZE, AUTO_COMPLETE, DEFAULTS, PREFIX_TEXT_OPTIONS } from './input.constants';
|
18
|
+
import styles from './input.styles';
|
19
19
|
/**
|
20
20
|
* mdc-input is a component that allows users to input text.
|
21
21
|
* It contains:
|
@@ -97,13 +97,15 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
97
97
|
}
|
98
98
|
connectedCallback() {
|
99
99
|
super.connectedCallback();
|
100
|
-
this.updateComplete
|
100
|
+
this.updateComplete
|
101
|
+
.then(() => {
|
101
102
|
if (this.inputElement) {
|
102
103
|
this.inputElement.checkValidity();
|
103
104
|
this.setInputValidity();
|
104
105
|
this.internals.setFormValue(this.inputElement.value);
|
105
106
|
}
|
106
|
-
})
|
107
|
+
})
|
108
|
+
.catch(error => {
|
107
109
|
if (this.onerror) {
|
108
110
|
this.onerror(error);
|
109
111
|
}
|
@@ -124,9 +126,11 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
124
126
|
* @returns void
|
125
127
|
*/
|
126
128
|
handleValueChange() {
|
127
|
-
this.updateComplete
|
129
|
+
this.updateComplete
|
130
|
+
.then(() => {
|
128
131
|
this.setInputValidity();
|
129
|
-
})
|
132
|
+
})
|
133
|
+
.catch(error => {
|
130
134
|
if (this.onerror) {
|
131
135
|
this.onerror(error);
|
132
136
|
}
|
@@ -157,16 +161,13 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
157
161
|
*/
|
158
162
|
attributeChangedCallback(name, old, value) {
|
159
163
|
super.attributeChangedCallback(name, old, value);
|
160
|
-
const validationRelatedAttributes = [
|
161
|
-
'maxlength',
|
162
|
-
'minlength',
|
163
|
-
'pattern',
|
164
|
-
'required',
|
165
|
-
];
|
164
|
+
const validationRelatedAttributes = ['maxlength', 'minlength', 'pattern', 'required'];
|
166
165
|
if (validationRelatedAttributes.includes(name)) {
|
167
|
-
this.updateComplete
|
166
|
+
this.updateComplete
|
167
|
+
.then(() => {
|
168
168
|
this.setInputValidity();
|
169
|
-
})
|
169
|
+
})
|
170
|
+
.catch(error => {
|
170
171
|
if (this.onerror) {
|
171
172
|
this.onerror(error);
|
172
173
|
}
|
@@ -208,10 +209,10 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
208
209
|
this.dispatchEvent(new EventConstructor(event.type, event));
|
209
210
|
}
|
210
211
|
/**
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
212
|
+
* Handles the keydown event of the input field.
|
213
|
+
* If the key pressed is 'Enter', it submits the form.
|
214
|
+
* @param event - Keyboard event
|
215
|
+
*/
|
215
216
|
handleKeyDown(event) {
|
216
217
|
var _a;
|
217
218
|
if (event.key === 'Enter') {
|
@@ -229,12 +230,13 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
229
230
|
return nothing;
|
230
231
|
}
|
231
232
|
return html `
|
232
|
-
<mdc-icon
|
233
|
-
class="leading-icon"
|
233
|
+
<mdc-icon
|
234
|
+
class="leading-icon"
|
234
235
|
part="leading-icon"
|
235
|
-
name=${this.leadingIcon}
|
236
|
-
size="${DEFAULTS.ICON_SIZE_VALUE}"
|
237
|
-
length-unit="${DEFAULTS.ICON_SIZE_UNIT}"
|
236
|
+
name=${this.leadingIcon}
|
237
|
+
size="${DEFAULTS.ICON_SIZE_VALUE}"
|
238
|
+
length-unit="${DEFAULTS.ICON_SIZE_UNIT}"
|
239
|
+
>
|
238
240
|
</mdc-icon>
|
239
241
|
`;
|
240
242
|
}
|
@@ -253,9 +255,9 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
253
255
|
return nothing;
|
254
256
|
}
|
255
257
|
return html `
|
256
|
-
<mdc-text
|
257
|
-
class="prefix-text"
|
258
|
-
tagname="${DEFAULTS.PREFIX_TEXT_TAG}"
|
258
|
+
<mdc-text
|
259
|
+
class="prefix-text"
|
260
|
+
tagname="${DEFAULTS.PREFIX_TEXT_TAG}"
|
259
261
|
type="${DEFAULTS.PREFIX_TEXT_TYPE}"
|
260
262
|
aria-hidden="true"
|
261
263
|
>
|
@@ -282,11 +284,11 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
282
284
|
return nothing;
|
283
285
|
}
|
284
286
|
return html `
|
285
|
-
<mdc-button
|
286
|
-
part=
|
287
|
-
class=
|
288
|
-
prefix-icon=
|
289
|
-
variant=
|
287
|
+
<mdc-button
|
288
|
+
part="trailing-button"
|
289
|
+
class="own-focus-ring ${!showBtn ? 'hidden' : ''}"
|
290
|
+
prefix-icon="${DEFAULTS.CLEAR_BUTTON_ICON}"
|
291
|
+
variant="${DEFAULTS.CLEAR_BUTTON_VARIANT}"
|
290
292
|
size="${DEFAULTS.CLEAR_BUTTON_SIZE}"
|
291
293
|
aria-label="${this.clearAriaLabel}"
|
292
294
|
@click=${this.clearInputText}
|
@@ -297,43 +299,43 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
297
299
|
renderInputElement(type, hidePlaceholder = false) {
|
298
300
|
var _a;
|
299
301
|
const placeholderText = hidePlaceholder ? '' : this.placeholder;
|
300
|
-
return html `<input
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
302
|
+
return html `<input
|
303
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
304
|
+
class="input"
|
305
|
+
part="input"
|
306
|
+
id="${this.id}"
|
307
|
+
name="${this.name}"
|
308
|
+
.value="${this.value}"
|
309
|
+
?disabled="${this.disabled}"
|
310
|
+
?readonly="${this.readonly}"
|
311
|
+
?required="${this.required}"
|
312
|
+
type="${type}"
|
313
|
+
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
314
|
+
aria-invalid="${this.helpTextType === 'error' ? 'true' : 'false'}"
|
315
|
+
placeholder=${ifDefined(placeholderText)}
|
316
|
+
minlength=${ifDefined(this.minlength)}
|
317
|
+
maxlength=${ifDefined(this.maxlength)}
|
318
|
+
autocapitalize=${this.autocapitalize}
|
319
|
+
autocomplete=${this.autocomplete}
|
320
|
+
?autofocus="${this.autofocus}"
|
321
|
+
dirname=${ifDefined(this.dirname)}
|
322
|
+
pattern=${ifDefined(this.pattern)}
|
323
|
+
list=${ifDefined(this.list)}
|
324
|
+
size=${ifDefined(this.size)}
|
325
|
+
@input=${this.onInput}
|
326
|
+
@change=${this.onChange}
|
327
|
+
@keydown=${this.handleKeyDown}
|
328
|
+
/>`;
|
327
329
|
}
|
328
330
|
render() {
|
329
331
|
return html `
|
330
332
|
${this.renderLabel()}
|
331
333
|
<div class="input-container mdc-focus-ring" part="input-container">
|
332
334
|
<slot name="input-leading-icon">${this.renderLeadingIcon()}</slot>
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
335
|
+
<div class="input-section" part="input-section">
|
336
|
+
<slot name="input-prefix-text">${this.renderPrefixText()}</slot>
|
337
|
+
<slot name="input">${this.renderInputElement(DEFAULTS.INPUT_TYPE)}</slot>
|
338
|
+
</div>
|
337
339
|
<slot name="trailing-button">${this.renderTrailingButton()}</slot>
|
338
340
|
</div>
|
339
341
|
${this.helpText ? this.renderHelperText() : nothing}
|
@@ -1,120 +1,131 @@
|
|
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
|
-
|
3
|
+
const styles = [
|
4
|
+
css `
|
5
|
+
:host {
|
6
|
+
--mdc-input-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
7
|
+
--mdc-input-disabled-text-color: var(--mds-color-theme-text-primary-disabled);
|
8
|
+
--mdc-input-disabled-background-color: var(--mds-color-theme-background-input-disabled);
|
9
|
+
--mdc-input-border-color: var(--mds-color-theme-outline-input-normal);
|
10
|
+
--mdc-input-text-color: var(--mds-color-theme-text-primary-normal);
|
11
|
+
--mdc-input-background-color: var(--mds-color-theme-background-primary-ghost);
|
12
|
+
--mdc-input-selection-background-color: var(--mds-color-theme-background-accent-active);
|
13
|
+
--mdc-input-selection-text-color: var(--mds-color-theme-inverted-text-primary-normal);
|
14
|
+
--mdc-input-support-text-color: var(--mds-color-theme-text-secondary-normal);
|
15
|
+
--mdc-input-hover-background-color: var(--mds-color-theme-background-primary-hover);
|
16
|
+
--mdc-input-focused-background-color: var(--mds-color-theme-background-primary-ghost);
|
17
|
+
--mdc-input-focused-border-color: var(--mds-color-theme-outline-input-active);
|
18
|
+
--mdc-input-error-border-color: var(--mds-color-theme-text-error-normal);
|
19
|
+
--mdc-input-warning-border-color: var(--mds-color-theme-text-warning-normal);
|
20
|
+
--mdc-input-success-border-color: var(--mds-color-theme-text-success-normal);
|
21
|
+
--mdc-input-primary-border-color: var(--mds-color-theme-text-accent-normal);
|
22
|
+
}
|
23
|
+
|
24
|
+
:host,
|
25
|
+
.input-container,
|
26
|
+
.input-section,
|
27
|
+
.input {
|
28
|
+
width: 100%;
|
29
|
+
}
|
30
|
+
|
31
|
+
input {
|
32
|
+
font-family: inherit;
|
33
|
+
}
|
34
|
+
|
35
|
+
:host([readonly]) .leading-icon {
|
36
|
+
color: var(--mdc-input-support-text-color);
|
37
|
+
}
|
38
|
+
|
39
|
+
:host([disabled]) .input,
|
40
|
+
:host([disabled]) .input::placeholder,
|
41
|
+
:host([disabled]) .prefix-text {
|
42
|
+
color: var(--mdc-input-disabled-text-color);
|
43
|
+
}
|
44
|
+
|
45
|
+
:host([disabled]) .input-container,
|
46
|
+
:host([readonly]) .input-container,
|
47
|
+
:host([disabled][help-text-type='default']) .input-container,
|
48
|
+
:host([disabled][help-text-type='success']) .input-container,
|
49
|
+
:host([disabled][help-text-type='warning']) .input-container,
|
50
|
+
:host([disabled][help-text-type='error']) .input-container,
|
51
|
+
:host([disabled][help-text-type='priority']) .input-container {
|
52
|
+
border-color: var(--mdc-input-disabled-border-color);
|
53
|
+
background: var(--mdc-input-disabled-background-color);
|
54
|
+
}
|
55
|
+
|
56
|
+
.leading-icon {
|
57
|
+
aspect-ratio: 1;
|
58
|
+
}
|
59
|
+
|
60
|
+
.input-container {
|
61
|
+
height: 2rem;
|
62
|
+
border-radius: 0.5rem;
|
63
|
+
border: 0.0625rem solid var(--mdc-input-border-color);
|
64
|
+
display: flex;
|
65
|
+
align-items: center;
|
66
|
+
gap: 0.375rem;
|
67
|
+
padding: 0.34375rem 0.375rem 0.34375rem 0.75rem;
|
68
|
+
min-width: 3.25rem;
|
69
|
+
}
|
70
|
+
|
71
|
+
.input-section {
|
72
|
+
display: flex;
|
73
|
+
gap: 0.25rem;
|
74
|
+
}
|
75
|
+
|
76
|
+
.input {
|
77
|
+
border: none;
|
78
|
+
color: var(--mdc-input-text-color);
|
79
|
+
background-color: var(--mdc-input-background-color);
|
80
|
+
outline: none;
|
81
|
+
}
|
82
|
+
|
83
|
+
.input::selection {
|
84
|
+
background-color: var(--mdc-input-selection-background-color);
|
85
|
+
color: var(--mdc-input-selection-text-color);
|
86
|
+
}
|
87
|
+
|
88
|
+
.prefix-text {
|
89
|
+
color: var(--mdc-input-support-text-color);
|
90
|
+
white-space: nowrap; // restrict prefix text to be in one line
|
91
|
+
}
|
92
|
+
|
93
|
+
:host(:not([disabled])) .input-container:hover {
|
94
|
+
background-color: var(--mdc-input-hover-background-color);
|
95
|
+
}
|
96
|
+
|
97
|
+
:host(:not([disabled])) .input-container:active,
|
98
|
+
:host(:not([disabled])) .input-container:focus-within {
|
99
|
+
background-color: var(--mdc-input-focused-background-color);
|
100
|
+
border-color: var(--mdc-input-focused-border-color);
|
101
|
+
}
|
102
|
+
|
103
|
+
.input::placeholder {
|
104
|
+
color: var(--mdc-input-support-text-color);
|
105
|
+
}
|
106
|
+
|
107
|
+
:host([help-text-type='error']) .input-container,
|
108
|
+
:host([help-text-type='error']) .input-container:focus-within {
|
109
|
+
border-color: var(--mdc-input-error-border-color);
|
110
|
+
}
|
111
|
+
:host([help-text-type='warning']) .input-container,
|
112
|
+
:host([help-text-type='warning']) .input-container:focus-within {
|
113
|
+
border-color: var(--mdc-input-warning-border-color);
|
114
|
+
}
|
115
|
+
:host([help-text-type='success']) .input-container,
|
116
|
+
:host([help-text-type='success']) .input-container:focus-within {
|
117
|
+
border-color: var(--mdc-input-success-border-color);
|
118
|
+
}
|
119
|
+
:host([help-text-type='priority']) .input-container,
|
120
|
+
:host([help-text-type='priority']) input-container:focus-within {
|
121
|
+
border-color: var(--mdc-input-primary-border-color);
|
122
|
+
}
|
123
|
+
|
124
|
+
.hidden {
|
125
|
+
opacity: 0;
|
126
|
+
pointer-events: none;
|
127
|
+
}
|
128
|
+
`,
|
129
|
+
...hostFocusRingStyles(true),
|
130
|
+
];
|
120
131
|
export default styles;
|
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
|
-
import styles from './inputchip.styles';
|
13
12
|
import { Component } from '../../models';
|
14
13
|
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
15
14
|
import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
|
15
|
+
import styles from './inputchip.styles';
|
16
16
|
import { DEFAULTS } from './inputchip.constants';
|
17
17
|
/**
|
18
18
|
* mdc-inputchip component is an interactive chip that consumers can use to represent an input.
|
@@ -62,12 +62,7 @@ class InputChip extends IconNameMixin(DisabledMixin(Component)) {
|
|
62
62
|
renderIcon() {
|
63
63
|
if (!this.iconName)
|
64
64
|
return nothing;
|
65
|
-
return html `
|
66
|
-
<mdc-icon
|
67
|
-
name="${this.iconName}"
|
68
|
-
length-unit="rem"
|
69
|
-
size="1"></mdc-icon>
|
70
|
-
`;
|
65
|
+
return html ` <mdc-icon name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
71
66
|
}
|
72
67
|
/**
|
73
68
|
* Handles the behavior of the close button on click event.
|
@@ -78,18 +73,18 @@ class InputChip extends IconNameMixin(DisabledMixin(Component)) {
|
|
78
73
|
}
|
79
74
|
render() {
|
80
75
|
return html `
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
76
|
+
${this.renderIcon()}
|
77
|
+
<mdc-text part="label" type="${DEFAULTS.TEXT_TYPE}" tagname="${DEFAULTS.TAG_NAME}">${this.label}</mdc-text>
|
78
|
+
<mdc-button
|
79
|
+
?disabled="${this.disabled}"
|
80
|
+
variant="tertiary"
|
81
|
+
part="close-icon"
|
82
|
+
aria-label="${this.clearAriaLabel}"
|
83
|
+
prefix-icon="${DEFAULTS.CLOSE_ICON}"
|
84
|
+
size="20"
|
85
|
+
@click="${this.handleClose}"
|
86
|
+
></mdc-button>
|
87
|
+
`;
|
93
88
|
}
|
94
89
|
}
|
95
90
|
InputChip.styles = [...Component.styles, ...styles];
|
@@ -17,13 +17,15 @@ const styles = css `
|
|
17
17
|
border-color: var(--mdc-chip-border-color);
|
18
18
|
background-color: var(--mdc-chip-background-color);
|
19
19
|
}
|
20
|
-
|
21
|
-
:host([error]){
|
20
|
+
|
21
|
+
:host([error]) {
|
22
22
|
--mdc-chip-border-color: var(--mds-color-theme-outline-cancel-normal);
|
23
23
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-error-normal);
|
24
24
|
}
|
25
25
|
|
26
|
-
:host([disabled]),
|
26
|
+
:host([disabled]),
|
27
|
+
:host([disabled]:hover),
|
28
|
+
:host([disabled]:active) {
|
27
29
|
--mdc-chip-border-color: var(--mds-color-theme-common-outline-primary-disabled);
|
28
30
|
--mdc-chip-background-color: var(--mds-color-theme-background-primary-disabled);
|
29
31
|
--mdc-chip-color: var(--mds-color-theme-text-primary-disabled);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CSSResult } from 'lit';
|
2
|
-
import type { LinkSize } from './link.types';
|
3
2
|
import Linksimple from '../linksimple/linksimple.component';
|
3
|
+
import type { LinkSize } from './link.types';
|
4
4
|
declare const Link_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Linksimple;
|
5
5
|
/**
|
6
6
|
* `mdc-link` component can be used to navigate to a different page
|