@momentum-design/components 0.84.3 → 0.84.5
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 +2241 -2299
- 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.d.ts +7 -2
- package/dist/components/dialog/dialog.component.js +43 -33
- package/dist/components/dialog/dialog.constants.d.ts +1 -0
- package/dist/components/dialog/dialog.constants.js +1 -0
- 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 +239 -228
- 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 +3 -3
- package/dist/react/index.js +3 -3
- package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
- package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
- package/dist/utils/mixins/FocusTrapMixin.js +15 -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
@@ -29,7 +29,7 @@ import styles from './optgroup.styles';
|
|
29
29
|
*/
|
30
30
|
class OptGroup extends DataAriaLabelMixin(DisabledMixin(Component)) {
|
31
31
|
setDisabledForAllOptions() {
|
32
|
-
this.options.forEach(
|
32
|
+
this.options.forEach(element => {
|
33
33
|
if (this.disabled) {
|
34
34
|
element.setAttribute('disabled', '');
|
35
35
|
}
|
@@ -46,14 +46,17 @@ class OptGroup extends DataAriaLabelMixin(DisabledMixin(Component)) {
|
|
46
46
|
}
|
47
47
|
render() {
|
48
48
|
var _a;
|
49
|
-
const headerText = this.label
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
const headerText = this.label
|
50
|
+
? html `
|
51
|
+
<mdc-text
|
52
|
+
id="${HEADER_ID}"
|
53
|
+
part="header-text"
|
54
|
+
type="${TYPE.BODY_MIDSIZE_BOLD}"
|
55
|
+
tagname="${VALID_TEXT_TAGS.SPAN}"
|
56
|
+
>${this.label}</mdc-text
|
57
|
+
>
|
58
|
+
`
|
59
|
+
: nothing;
|
57
60
|
return html `
|
58
61
|
<div
|
59
62
|
role="${ROLE.GROUP}"
|
@@ -78,22 +78,22 @@ class Option extends FormInternalsMixin(ListItem) {
|
|
78
78
|
}
|
79
79
|
}
|
80
80
|
render() {
|
81
|
-
const prefixIconContent = this.prefixIcon
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
const prefixIconContent = this.prefixIcon
|
82
|
+
? html `
|
83
|
+
<div part="leading-icon">
|
84
|
+
<mdc-icon length-unit="rem" slot="leading-controls" name="${ifDefined(this.prefixIcon)}"></mdc-icon>
|
85
|
+
</div>
|
86
|
+
`
|
87
|
+
: nothing;
|
88
|
+
const selectedIcon = this.selected
|
89
|
+
? html ` <mdc-icon length-unit="rem" slot="trailing-controls" name="${SELECTED_ICON_NAME}"></mdc-icon> `
|
90
|
+
: nothing;
|
89
91
|
return html `
|
90
92
|
${prefixIconContent}
|
91
93
|
<div part="leading-text">
|
92
94
|
${this.getText('leading-text-primary-label', TYPE.BODY_MIDSIZE_REGULAR, this.label)}
|
93
95
|
</div>
|
94
|
-
<div part="trailing">
|
95
|
-
${selectedIcon}
|
96
|
-
</div>
|
96
|
+
<div part="trailing">${selectedIcon}</div>
|
97
97
|
<slot part="default-slot" @slotchange="${this.handleDefaultSlotChange}"></slot>
|
98
98
|
`;
|
99
99
|
}
|
@@ -469,7 +469,7 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
469
469
|
}
|
470
470
|
if (changedProperties.has('trigger')) {
|
471
471
|
const triggers = this.trigger.split(' ');
|
472
|
-
const validTriggers = triggers.filter(
|
472
|
+
const validTriggers = triggers.filter(trigger => Object.values(TRIGGER).includes(trigger));
|
473
473
|
this.setAttribute('trigger', validTriggers.length > 0 ? this.trigger : DEFAULTS.TRIGGER);
|
474
474
|
this.removeEventListeners();
|
475
475
|
this.setupTriggerListener();
|
@@ -483,9 +483,9 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
483
483
|
if (changedProperties.has('append-to')) {
|
484
484
|
this.utils.setupAppendTo();
|
485
485
|
}
|
486
|
-
if (changedProperties.has('interactive')
|
487
|
-
|
488
|
-
|
486
|
+
if (changedProperties.has('interactive') ||
|
487
|
+
changedProperties.has('aria-label') ||
|
488
|
+
changedProperties.has('aria-labelledby')) {
|
489
489
|
this.utils.setupAccessibility();
|
490
490
|
}
|
491
491
|
if (changedProperties.has('disableAriaExpanded')) {
|
@@ -13,7 +13,7 @@ export class PopoverUtils {
|
|
13
13
|
*/
|
14
14
|
setupDelay() {
|
15
15
|
try {
|
16
|
-
const [openDelay, closeDelay] = this.popover.delay.split(',').map(
|
16
|
+
const [openDelay, closeDelay] = this.popover.delay.split(',').map(delay => {
|
17
17
|
const parsed = parseInt(delay, 10);
|
18
18
|
if (Number.isNaN(parsed) || parsed < 0) {
|
19
19
|
throw new Error(`Invalid delay value: ${delay}`);
|
@@ -98,9 +98,8 @@ export class PopoverUtils {
|
|
98
98
|
}
|
99
99
|
if (this.popover.interactive) {
|
100
100
|
if (!this.popover.ariaLabel) {
|
101
|
-
this.popover.ariaLabel =
|
102
|
-
|| ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.textContent)
|
103
|
-
|| '';
|
101
|
+
this.popover.ariaLabel =
|
102
|
+
((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.ariaLabel) || ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.textContent) || '';
|
104
103
|
}
|
105
104
|
if (!this.popover.ariaLabelledby) {
|
106
105
|
this.popover.ariaLabelledby = ((_c = this.popover.triggerElement) === null || _c === void 0 ? void 0 : _c.id) || '';
|
@@ -77,13 +77,13 @@ declare class Presence extends Component {
|
|
77
77
|
*/
|
78
78
|
private get icon();
|
79
79
|
/**
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
* Handles the successful load of an icon.
|
81
|
+
* Sets the `currentIconType` property to match the `type` property.
|
82
|
+
*/
|
83
83
|
private handleOnLoad;
|
84
84
|
/**
|
85
85
|
* Handles an error that occurs when loading an icon.
|
86
|
-
|
86
|
+
*/
|
87
87
|
private handleOnError;
|
88
88
|
render(): import("lit-html").TemplateResult<1>;
|
89
89
|
static styles: Array<CSSResult>;
|
@@ -115,15 +115,15 @@ class Presence extends Component {
|
|
115
115
|
return iconName;
|
116
116
|
}
|
117
117
|
/**
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
* Handles the successful load of an icon.
|
119
|
+
* Sets the `currentIconType` property to match the `type` property.
|
120
|
+
*/
|
121
121
|
handleOnLoad() {
|
122
122
|
this.currentIconType = this.type;
|
123
123
|
}
|
124
124
|
/**
|
125
125
|
* Handles an error that occurs when loading an icon.
|
126
|
-
|
126
|
+
*/
|
127
127
|
handleOnError() {
|
128
128
|
if (this.onerror) {
|
129
129
|
this.onerror('There was a problem while fetching the icon. Please check the icon name and try again.');
|
@@ -10,12 +10,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { v4 as uuidv4 } from 'uuid';
|
13
|
-
import styles from './progressbar.styles';
|
14
13
|
import FormfieldWrapper from '../formfieldwrapper';
|
15
|
-
import { DEFAULTS, VARIANT } from './progressbar.constants';
|
16
14
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
17
15
|
import { VALIDATION } from '../formfieldwrapper/formfieldwrapper.constants';
|
18
16
|
import { ROLE } from '../../utils/roles';
|
17
|
+
import { DEFAULTS, VARIANT } from './progressbar.constants';
|
18
|
+
import styles from './progressbar.styles';
|
19
19
|
/**
|
20
20
|
* mdc-progressbar component visually represents a progress indicator, typically used to show
|
21
21
|
* the completion state of an ongoing process (e.g., loading, file upload, etc.).
|
@@ -141,8 +141,7 @@ class Progressbar extends DataAriaLabelMixin(FormfieldWrapper) {
|
|
141
141
|
? html `<span part="percentage">${this.clampedValue}%</span>`
|
142
142
|
: ''}
|
143
143
|
</div>
|
144
|
-
${this.renderProgressbar()}
|
145
|
-
${this.renderHelperText()}
|
144
|
+
${this.renderProgressbar()} ${this.renderHelperText()}
|
146
145
|
`}
|
147
146
|
`;
|
148
147
|
}
|
@@ -1,88 +1,94 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
import { hostFitContentStyles } from '../../utils/styles';
|
3
|
-
const styles = [
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
const styles = [
|
4
|
+
hostFitContentStyles,
|
5
|
+
css `
|
6
|
+
:host {
|
7
|
+
--mdc-progressbar-background-color: var(--mds-color-theme-control-indicator-inactive-normal);
|
8
|
+
--mdc-progressbar-active-background-color: var(--mds-color-theme-control-active-normal);
|
9
|
+
--mdc-progressbar-success-color: var(--mds-color-theme-indicator-stable);
|
10
|
+
--mdc-progressbar-error-color: var(--mds-color-theme-indicator-attention);
|
11
|
+
--mdc-progressbar-height: 0.25rem;
|
12
|
+
--mdc-progressbar-border: 0.5px solid transparent;
|
13
|
+
--mdc-progressbar-border-radius: var(--mdc-progressbar-height);
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
--mdc-progressbar-label-color: var(--mds-color-theme-text-primary-normal);
|
16
|
+
--mdc-progressbar-label-line-height: var(--mds-font-lineheight-body-midsize);
|
17
|
+
--mdc-progressbar-label-font-size: var(--mds-font-size-body-midsize);
|
18
|
+
--mdc-progressbar-label-font-weight: var(--mds-font-weight-regular);
|
19
|
+
--mdc-progressbar-help-text-color: var(--mds-color-theme-text-secondary-normal);
|
18
20
|
|
19
|
-
|
20
|
-
}
|
21
|
+
width: 100%;
|
22
|
+
}
|
21
23
|
|
22
|
-
:host::part(label-container) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
24
|
+
:host::part(label-container) {
|
25
|
+
display: flex;
|
26
|
+
justify-content: space-between;
|
27
|
+
width: 100%;
|
28
|
+
}
|
27
29
|
|
28
|
-
:host::part(inline-label-container) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
30
|
+
:host::part(inline-label-container) {
|
31
|
+
display: flex;
|
32
|
+
align-items: center;
|
33
|
+
gap: 0.5rem;
|
34
|
+
width: 100%;
|
35
|
+
}
|
34
36
|
|
35
|
-
:host::part(progress-container) {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
37
|
+
:host::part(progress-container) {
|
38
|
+
display: flex;
|
39
|
+
align-items: center;
|
40
|
+
width: 100%;
|
41
|
+
height: var(--mdc-progressbar-height);
|
42
|
+
}
|
41
43
|
|
42
|
-
:host::part(gap) {
|
43
|
-
|
44
|
-
}
|
44
|
+
:host::part(gap) {
|
45
|
+
gap: 0.25rem;
|
46
|
+
}
|
45
47
|
|
46
|
-
:host([variant=
|
47
|
-
|
48
|
-
}
|
48
|
+
:host([variant='inline'])::part(label) {
|
49
|
+
overflow: unset;
|
50
|
+
}
|
49
51
|
|
50
|
-
:host::part(progress-bar) {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
52
|
+
:host::part(progress-bar) {
|
53
|
+
height: 100%;
|
54
|
+
background-color: var(--mdc-progressbar-active-background-color);
|
55
|
+
border-radius: var(--mdc-progressbar-border-radius);
|
56
|
+
transition: width 0.3s ease-in-out;
|
57
|
+
}
|
56
58
|
|
57
|
-
:host::part(success) {
|
58
|
-
|
59
|
-
}
|
59
|
+
:host::part(success) {
|
60
|
+
background-color: var(--mdc-progressbar-success-color);
|
61
|
+
}
|
60
62
|
|
61
|
-
:host::part(error) {
|
62
|
-
|
63
|
-
}
|
63
|
+
:host::part(error) {
|
64
|
+
background-color: var(--mdc-progressbar-error-color);
|
65
|
+
}
|
64
66
|
|
65
|
-
:host::part(remaining) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}
|
67
|
+
:host::part(remaining) {
|
68
|
+
height: 100%;
|
69
|
+
flex-grow: 1;
|
70
|
+
background-color: var(--mdc-progressbar-background-color);
|
71
|
+
border-radius: var(--mdc-progressbar-border-radius);
|
72
|
+
}
|
71
73
|
|
72
|
-
:host::part(label-text),
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
:host::part(label-text),
|
75
|
+
:host::part(help-text),
|
76
|
+
:host::part(percentage) {
|
77
|
+
font-size: var(--mdc-progressbar-label-font-size);
|
78
|
+
font-weight: var(--mdc-progressbar-label-font-weight);
|
79
|
+
line-height: var(--mdc-progressbar-label-line-height);
|
80
|
+
}
|
77
81
|
|
78
|
-
:host([help-text-type=
|
79
|
-
|
80
|
-
}
|
82
|
+
:host([help-text-type='default'])::part(help-text) {
|
83
|
+
color: var(--mdc-progressbar-help-text-color);
|
84
|
+
}
|
81
85
|
|
82
|
-
@media (forced-colors: active) {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
87
|
-
|
86
|
+
@media (forced-colors: active) {
|
87
|
+
:host::part(progress-container),
|
88
|
+
:host::part(progress-bar) {
|
89
|
+
border: var(--mdc-progressbar-border);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
`,
|
93
|
+
];
|
88
94
|
export default styles;
|
@@ -30,10 +30,10 @@ const getProgressArc = (percentage) => {
|
|
30
30
|
}
|
31
31
|
const progressArc = (percentage / 100) * DEFAULTS.CIRCUMFERENCE - DEFAULTS.GAP_SIZE;
|
32
32
|
/** Ensure the progress arc is not negative due to gap size
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
* The 0.1% is a minimum threshold to ensure the arc is visible.
|
34
|
+
* This is especially useful for very small percentages.
|
35
|
+
* This is particularly important for accessibility and visual clarity.
|
36
|
+
*/
|
37
37
|
return Math.max(progressArc, 0.1 * percentage);
|
38
38
|
};
|
39
39
|
/**
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { html } from 'lit';
|
2
|
-
import styles from './progressspinner.styles';
|
3
2
|
import { Component } from '../../models';
|
4
3
|
import Progressbar from '../progressbar/progressbar.component';
|
5
|
-
import { DEFAULTS, ICON_NAME } from './progressspinner.constants';
|
6
|
-
import { getProgressArc, getProgressOffset, getRemainingArc, getRemainingOffset } from './progressspiner.utils';
|
7
4
|
import { ROLE } from '../../utils/roles';
|
5
|
+
import { getProgressArc, getProgressOffset, getRemainingArc, getRemainingOffset } from './progressspiner.utils';
|
6
|
+
import { DEFAULTS, ICON_NAME } from './progressspinner.constants';
|
7
|
+
import styles from './progressspinner.styles';
|
8
8
|
/**
|
9
9
|
* `mdc-progressspinner` is a customizable, circular progress indicator component.
|
10
10
|
* It visually represents the current completion state of a process, such as loading,
|
@@ -58,26 +58,26 @@ class Progressspinner extends Progressbar {
|
|
58
58
|
aria-valuemax="100"
|
59
59
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
60
60
|
>
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
61
|
+
<svg part="spinner-base">
|
62
|
+
<circle
|
63
|
+
part="spinner-track"
|
64
|
+
cx="24"
|
65
|
+
cy="24"
|
66
|
+
r="${DEFAULTS.RADIUS}"
|
67
|
+
stroke-width="${remainingArc === 0 ? 0 : DEFAULTS.STROKE_WIDTH}"
|
68
|
+
stroke-dasharray="${remainingArc} ${DEFAULTS.CIRCUMFERENCE}"
|
69
|
+
stroke-dashoffset="-${remainingOffset}"
|
70
|
+
/>
|
71
|
+
<circle
|
72
|
+
part="spinner-progress"
|
73
|
+
cx="24"
|
74
|
+
cy="24"
|
75
|
+
r="${DEFAULTS.RADIUS}"
|
76
|
+
stroke-width="${progressArc === 0 ? 0 : DEFAULTS.STROKE_WIDTH}"
|
77
|
+
stroke-dasharray="${progressArc} ${DEFAULTS.CIRCUMFERENCE}"
|
78
|
+
stroke-dashoffset="-${progressOffset}"
|
79
|
+
/>
|
80
|
+
</svg>
|
81
81
|
</div>
|
82
82
|
`;
|
83
83
|
}
|
@@ -88,12 +88,13 @@ class Progressspinner extends Progressbar {
|
|
88
88
|
renderErrorState() {
|
89
89
|
var _a;
|
90
90
|
return html `
|
91
|
-
<mdc-icon
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
91
|
+
<mdc-icon
|
92
|
+
part="error-icon"
|
93
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
94
|
+
name="${ICON_NAME.ERROR_LEGACY_FILLED}"
|
95
|
+
size="${DEFAULTS.ERROR_ICON_SIZE}"
|
96
|
+
length-unit="${DEFAULTS.ICON_LENGTH_UNIT}"
|
97
|
+
></mdc-icon>
|
97
98
|
`;
|
98
99
|
}
|
99
100
|
/**
|
@@ -103,12 +104,13 @@ class Progressspinner extends Progressbar {
|
|
103
104
|
renderSuccessState() {
|
104
105
|
var _a;
|
105
106
|
return html `
|
106
|
-
<mdc-icon
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
<mdc-icon
|
108
|
+
part="success-icon"
|
109
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
110
|
+
name="${ICON_NAME.CHECK_CIRCLE_BOLD}"
|
111
|
+
size="${DEFAULTS.SUCCESS_ICON_SIZE}"
|
112
|
+
length-unit="${DEFAULTS.ICON_LENGTH_UNIT}"
|
113
|
+
></mdc-icon>
|
112
114
|
`;
|
113
115
|
}
|
114
116
|
render() {
|
@@ -118,8 +120,7 @@ class Progressspinner extends Progressbar {
|
|
118
120
|
if (this.clampedValue === 100) {
|
119
121
|
return this.renderSuccessState();
|
120
122
|
}
|
121
|
-
return html `
|
122
|
-
${this.renderProgressSpinner()}`;
|
123
|
+
return html ` ${this.renderProgressSpinner()}`;
|
123
124
|
}
|
124
125
|
}
|
125
126
|
Progressspinner.styles = [...Component.styles, ...styles];
|
@@ -31,42 +31,42 @@ declare const Radio_base: import("../../utils/mixins/index.types").Constructor<i
|
|
31
31
|
*/
|
32
32
|
declare class Radio extends Radio_base implements AssociatedFormControl {
|
33
33
|
/**
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
* Determines whether the radio is selected or unselected.
|
35
|
+
*
|
36
|
+
* @default false
|
37
|
+
*/
|
38
38
|
checked: boolean;
|
39
39
|
/**
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
* Determines whether the radio is read-only.
|
41
|
+
*
|
42
|
+
* @default false
|
43
|
+
*/
|
44
44
|
readonly: boolean;
|
45
45
|
/**
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
* Automatically focus on the element when the page loads.
|
47
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
48
|
+
* @default false
|
49
|
+
*/
|
50
50
|
autofocus: boolean;
|
51
51
|
connectedCallback(): void;
|
52
52
|
firstUpdated(): void;
|
53
53
|
/**
|
54
|
-
|
55
|
-
|
54
|
+
* Returns all radios within the same group (name).
|
55
|
+
*/
|
56
56
|
private getAllRadiosWithinSameGroup;
|
57
57
|
/**
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
* The 'change' event does not bubble up through the shadow DOM as it was not composed.
|
59
|
+
* Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
|
60
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
|
61
|
+
*/
|
62
62
|
private dispatchChangeEvent;
|
63
63
|
/** @internal */
|
64
64
|
formResetCallback(): void;
|
65
65
|
/** @internal */
|
66
66
|
formStateRestoreCallback(state: string): void;
|
67
67
|
/**
|
68
|
-
|
69
|
-
|
68
|
+
* @internal
|
69
|
+
*/
|
70
70
|
setComponentValidity(isValid: boolean): void;
|
71
71
|
/**
|
72
72
|
* Sets the validity of the group of radios.
|
@@ -75,35 +75,35 @@ declare class Radio extends Radio_base implements AssociatedFormControl {
|
|
75
75
|
*/
|
76
76
|
private setGroupValidity;
|
77
77
|
/**
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
* Updates the form value to reflect the current state of the radio.
|
79
|
+
* If checked, the value is set to the user-provided value.
|
80
|
+
* If unchecked, the value is set to null.
|
81
|
+
*/
|
82
82
|
private setActualFormValue;
|
83
83
|
/**
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
* Handles the change event on the radio element.
|
85
|
+
* This will toggle the state of the radio element.
|
86
|
+
* Dispatches the change event.
|
87
|
+
*/
|
88
88
|
private handleChange;
|
89
89
|
/**
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
90
|
+
* Updates the state of the radio button at the specified index within the enabled radios.
|
91
|
+
* Focuses the radio button and triggers the change event if the radio button is not read-only.
|
92
|
+
*
|
93
|
+
* @param enabledRadios - An array of enabled radio buttons within the same group.
|
94
|
+
* @param index - The index of the radio button to be updated within the enabled radios array.
|
95
|
+
* @param event - The event that triggered the update.
|
96
|
+
*/
|
97
97
|
private updateRadio;
|
98
98
|
/**
|
99
|
-
|
100
|
-
|
99
|
+
* Handles the keydown event (Arrow Up/Down/Left/Right) on the radio element.
|
100
|
+
*/
|
101
101
|
private handleKeyDown;
|
102
102
|
/**
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
* Update tab index for all radios in the same group (name)
|
104
|
+
* If any radio group is checked, it will have a tab index of 0
|
105
|
+
* If no radio group is checked, the first enabled radio will have a tab index of 0
|
106
|
+
*/
|
107
107
|
private updateTabIndex;
|
108
108
|
update(changedProperties: PropertyValues): void;
|
109
109
|
private renderLabelAndHelperText;
|