@momentum-design/components 0.120.14 → 0.120.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/browser/index.js +428 -282
  2. package/dist/browser/index.js.map +3 -3
  3. package/dist/components/checkbox/checkbox.component.d.ts +1 -1
  4. package/dist/components/checkbox/checkbox.component.js +8 -2
  5. package/dist/components/checkbox/checkbox.styles.js +62 -40
  6. package/dist/components/combobox/combobox.component.d.ts +0 -5
  7. package/dist/components/combobox/combobox.component.js +0 -9
  8. package/dist/components/formfieldwrapper/formfieldwrapper.component.d.ts +10 -0
  9. package/dist/components/formfieldwrapper/formfieldwrapper.component.js +21 -1
  10. package/dist/components/input/input.component.d.ts +0 -4
  11. package/dist/components/input/input.component.js +0 -8
  12. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +2 -0
  13. package/dist/components/menuitemradio/menuitemradio.component.js +1 -0
  14. package/dist/components/radio/radio.component.d.ts +0 -6
  15. package/dist/components/radio/radio.component.js +5 -11
  16. package/dist/components/radio/radio.styles.js +70 -34
  17. package/dist/components/select/select.component.d.ts +0 -13
  18. package/dist/components/select/select.component.js +0 -13
  19. package/dist/components/staticcheckbox/staticcheckbox.component.d.ts +13 -1
  20. package/dist/components/staticcheckbox/staticcheckbox.component.js +21 -1
  21. package/dist/components/staticcheckbox/staticcheckbox.styles.js +30 -7
  22. package/dist/components/staticradio/staticradio.component.d.ts +7 -1
  23. package/dist/components/staticradio/staticradio.component.js +11 -1
  24. package/dist/components/staticradio/staticradio.styles.js +16 -9
  25. package/dist/components/statictoggle/statictoggle.component.d.ts +13 -1
  26. package/dist/components/statictoggle/statictoggle.component.js +21 -1
  27. package/dist/components/statictoggle/statictoggle.styles.js +24 -4
  28. package/dist/components/textarea/textarea.component.d.ts +0 -5
  29. package/dist/components/textarea/textarea.component.js +0 -9
  30. package/dist/components/toggle/toggle.component.d.ts +1 -1
  31. package/dist/components/toggle/toggle.component.js +9 -3
  32. package/dist/components/toggle/toggle.styles.js +47 -20
  33. package/dist/custom-elements.json +876 -178
  34. package/dist/react/staticcheckbox/index.d.ts +1 -1
  35. package/dist/react/staticcheckbox/index.js +1 -1
  36. package/dist/react/staticradio/index.d.ts +1 -1
  37. package/dist/react/staticradio/index.js +1 -1
  38. package/dist/react/statictoggle/index.d.ts +1 -1
  39. package/dist/react/statictoggle/index.js +1 -1
  40. package/package.json +1 -1
@@ -16,7 +16,7 @@ import { ICON_NAME } from './staticcheckbox.constants';
16
16
  /**
17
17
  * This is a decorative component that is styled to look as a checkbox.
18
18
  *
19
- * It has 3 properties - checked, indeterminate and disabled.
19
+ * It has 5 properties - checked, indeterminate, disabled, readonly and soft-disabled.
20
20
  *
21
21
  * We are using the same styling that has been created for the `mdc-checkbox` component.
22
22
  *
@@ -54,6 +54,18 @@ class StaticCheckbox extends DisabledMixin(Component) {
54
54
  * @default false
55
55
  */
56
56
  this.indeterminate = false;
57
+ /**
58
+ * Determines whether the checkbox is read-only.
59
+ *
60
+ * @default false
61
+ */
62
+ this.readonly = false;
63
+ /**
64
+ * Determines whether the checkbox is soft-disabled.
65
+ *
66
+ * @default false
67
+ */
68
+ this.softDisabled = false;
57
69
  }
58
70
  render() {
59
71
  const checkboxIconContent = this.checked || this.indeterminate
@@ -79,4 +91,12 @@ __decorate([
79
91
  property({ type: Boolean, reflect: true }),
80
92
  __metadata("design:type", Object)
81
93
  ], StaticCheckbox.prototype, "indeterminate", void 0);
94
+ __decorate([
95
+ property({ type: Boolean, reflect: true }),
96
+ __metadata("design:type", Object)
97
+ ], StaticCheckbox.prototype, "readonly", void 0);
98
+ __decorate([
99
+ property({ type: Boolean, attribute: 'soft-disabled', reflect: true }),
100
+ __metadata("design:type", Object)
101
+ ], StaticCheckbox.prototype, "softDisabled", void 0);
82
102
  export default StaticCheckbox;
@@ -13,22 +13,33 @@ const styles = [
13
13
  --mdc-staticcheckbox-icon-color: var(--mds-color-theme-inverted-text-primary-normal);
14
14
  --mdc-staticcheckbox-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
15
15
  --mdc-staticcheckbox-disabled-checked-icon-color: var(--mds-color-theme-control-active-disabled);
16
+ --mdc-staticcheckbox-readonly-border-color: var(--mds-color-theme-outline-primary-normal);
17
+ --mdc-staticcheckbox-text-normal-color: var(--mds-color-theme-text-primary-normal);
16
18
  }
17
19
 
18
20
  :host([checked])::part(icon-container),
19
21
  :host([indeterminate])::part(icon-container) {
20
- background: var(--mdc-staticcheckbox-checked-background-color);
22
+ background-color: var(--mdc-staticcheckbox-checked-background-color);
21
23
  border-color: transparent;
22
24
  }
23
25
 
24
- :host([disabled])::part(icon-container) {
26
+ :host([disabled])::part(icon-container),
27
+ :host([soft-disabled])::part(icon-container),
28
+ :host([disabled][readonly])::part(icon-container),
29
+ :host([soft-disabled][readonly])::part(icon-container) {
25
30
  border-color: var(--mdc-staticcheckbox-disabled-border-color);
26
- background: var(--mdc-staticcheckbox-disabled-background-color);
31
+ background-color: var(--mdc-staticcheckbox-disabled-background-color);
27
32
  }
28
33
 
29
34
  :host([disabled][checked])::part(icon-container),
30
- :host([disabled][indeterminate])::part(icon-container) {
31
- background: var(--mdc-staticcheckbox-disabled-checked-icon-color);
35
+ :host([disabled][indeterminate])::part(icon-container),
36
+ :host([soft-disabled][checked])::part(icon-container),
37
+ :host([soft-disabled][indeterminate])::part(icon-container),
38
+ :host([disabled][readonly][checked])::part(icon-container),
39
+ :host([disabled][readonly][indeterminate])::part(icon-container),
40
+ :host([soft-disabled][readonly][checked])::part(icon-container),
41
+ :host([soft-disabled][readonly][indeterminate])::part(icon-container) {
42
+ background-color: var(--mdc-staticcheckbox-disabled-checked-icon-color);
32
43
  border: 0.0625rem solid var(--mdc-staticcheckbox-disabled-border-color);
33
44
  }
34
45
 
@@ -36,20 +47,32 @@ const styles = [
36
47
  display: flex;
37
48
  align-items: center;
38
49
  border: 0.0625rem solid var(--mdc-staticcheckbox-icon-border-color);
39
- background: var(--mdc-staticcheckbox-icon-background-color);
50
+ background-color: var(--mdc-staticcheckbox-icon-background-color);
40
51
  width: 1rem;
41
52
  height: 1rem;
42
53
  border-radius: 0.125rem;
43
54
  }
44
55
 
56
+ :host([readonly])::part(icon-container) {
57
+ border-color: var(--mdc-staticcheckbox-readonly-border-color);
58
+ background-color: unset;
59
+ }
60
+
45
61
  :host::part(checkbox-icon) {
46
62
  --mdc-icon-fill-color: var(--mdc-staticcheckbox-icon-color);
47
63
  }
48
64
 
49
- :host([disabled])::part(checkbox-icon) {
65
+ :host([disabled])::part(checkbox-icon),
66
+ :host([soft-disabled])::part(checkbox-icon),
67
+ :host([disabled][readonly])::part(checkbox-icon),
68
+ :host([soft-disabled][readonly])::part(checkbox-icon) {
50
69
  --mdc-icon-fill-color: var(--mdc-staticcheckbox-disabled-icon-color);
51
70
  }
52
71
 
72
+ :host([readonly])::part(checkbox-icon) {
73
+ --mdc-icon-fill-color: var(--mdc-staticcheckbox-text-normal-color);
74
+ }
75
+
53
76
  /* High Contrast Mode */
54
77
  @media (forced-colors: active) {
55
78
  :host([checked])::part(icon-container),
@@ -3,7 +3,7 @@ import { Component } from '../../models';
3
3
  declare const StaticRadio_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
4
4
  /**
5
5
  * This is a decorative component that is styled to look as a radio.
6
- * It has 2 properties - checked and disabled.
6
+ * It has 4 properties - checked, disabled, readonly and soft-disabled.
7
7
  *
8
8
  * We are using the same styling that has been created for the `mdc-radio` component.
9
9
  *
@@ -39,6 +39,12 @@ declare class StaticRadio extends StaticRadio_base {
39
39
  * @default false
40
40
  */
41
41
  readonly: boolean;
42
+ /**
43
+ * Determines whether the radio is soft-disabled.
44
+ *
45
+ * @default false
46
+ */
47
+ softDisabled: boolean;
42
48
  render(): import("lit-html").TemplateResult<1>;
43
49
  static styles: Array<CSSResult>;
44
50
  }
@@ -14,7 +14,7 @@ import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
14
14
  import styles from './staticradio.styles';
15
15
  /**
16
16
  * This is a decorative component that is styled to look as a radio.
17
- * It has 2 properties - checked and disabled.
17
+ * It has 4 properties - checked, disabled, readonly and soft-disabled.
18
18
  *
19
19
  * We are using the same styling that has been created for the `mdc-radio` component.
20
20
  *
@@ -52,6 +52,12 @@ class StaticRadio extends DisabledMixin(Component) {
52
52
  * @default false
53
53
  */
54
54
  this.readonly = false;
55
+ /**
56
+ * Determines whether the radio is soft-disabled.
57
+ *
58
+ * @default false
59
+ */
60
+ this.softDisabled = false;
55
61
  }
56
62
  render() {
57
63
  return html ` <slot></slot>
@@ -67,4 +73,8 @@ __decorate([
67
73
  property({ type: Boolean, reflect: true }),
68
74
  __metadata("design:type", Object)
69
75
  ], StaticRadio.prototype, "readonly", void 0);
76
+ __decorate([
77
+ property({ type: Boolean, attribute: 'soft-disabled', reflect: true }),
78
+ __metadata("design:type", Object)
79
+ ], StaticRadio.prototype, "softDisabled", void 0);
70
80
  export default StaticRadio;
@@ -10,6 +10,7 @@ const styles = [
10
10
  border-radius: 50%;
11
11
 
12
12
  --mdc-staticradio-inner-circle-size: 0.375rem;
13
+ --mdc-staticradio-text-normal-color: var(--mds-color-theme-text-primary-normal);
13
14
  --mdc-staticradio-text-disabled-color: var(--mds-color-theme-text-primary-disabled);
14
15
  --mdc-staticradio-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
15
16
  --mdc-staticradio-normal-border-color: var(--mds-color-theme-outline-input-normal);
@@ -28,20 +29,26 @@ const styles = [
28
29
  }
29
30
 
30
31
  :host([disabled])::part(radio-icon),
31
- :host([disabled][readonly])::part(radio-icon) {
32
+ :host([soft-disabled])::part(radio-icon),
33
+ :host([disabled][readonly])::part(radio-icon),
34
+ :host([soft-disabled][readonly])::part(radio-icon) {
32
35
  border-color: var(--mdc-staticradio-disabled-border-color);
33
- background: var(--mdc-staticradio-control-inactive-disabled-background);
36
+ background-color: var(--mdc-staticradio-control-inactive-disabled-background);
34
37
  }
35
38
 
36
39
  :host([disabled][checked])::part(radio-icon),
37
- :host([disabled][readonly][checked])::part(radio-icon) {
40
+ :host([soft-disabled][checked])::part(radio-icon),
41
+ :host([disabled][readonly][checked])::part(radio-icon),
42
+ :host([soft-disabled][readonly][checked])::part(radio-icon) {
38
43
  border: var(--mdc-staticradio-control-active-disabled-background);
39
- background: var(--mdc-staticradio-control-active-disabled-background);
44
+ background-color: var(--mdc-staticradio-control-active-disabled-background);
40
45
  }
41
46
 
42
47
  :host([disabled][checked]) .radio-icon:after,
43
- :host([disabled][readonly][checked]) .radio-icon:after {
44
- background: var(--mdc-staticradio-inner-circle-disabled-background);
48
+ :host([soft-disabled][checked]) .radio-icon:after,
49
+ :host([disabled][readonly][checked]) .radio-icon:after,
50
+ :host([soft-disabled][readonly][checked]) .radio-icon:after {
51
+ background-color: var(--mdc-staticradio-inner-circle-disabled-background);
45
52
  }
46
53
 
47
54
  :host::part(radio-icon) {
@@ -68,12 +75,12 @@ const styles = [
68
75
  width: var(--mdc-staticradio-inner-circle-size);
69
76
  height: var(--mdc-staticradio-inner-circle-size);
70
77
  border-radius: 50%;
71
- background: var(--mdc-staticradio-inner-circle-normal-background);
78
+ background-color: var(--mdc-staticradio-inner-circle-normal-background);
72
79
  }
73
80
 
74
81
  :host([readonly])::part(radio-icon) {
75
82
  border-color: var(--mdc-staticradio-normal-border-color);
76
- background-color: var(--mdc-staticradio-control-inactive-color);
83
+ background-color: unset;
77
84
  }
78
85
 
79
86
  :host([readonly][checked])::part(radio-icon) {
@@ -81,7 +88,7 @@ const styles = [
81
88
  }
82
89
 
83
90
  :host([readonly][checked]) .radio-icon:after {
84
- background-color: var(--mdc-staticradio-text-disabled-color);
91
+ background-color: var(--mdc-staticradio-text-normal-color);
85
92
  }
86
93
  `,
87
94
  ];
@@ -4,7 +4,7 @@ import type { ToggleSize } from './statictoggle.types';
4
4
  declare const StaticToggle_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
5
5
  /**
6
6
  * This is a decorative component that is styled to look as a toggle. <br/>
7
- * It has 3 properties - checked, size and disabled. <br/>
7
+ * It has 5 properties - checked, size, disabled, readonly and soft-disabled. <br/>
8
8
  * We are using the same styling that has been created for the `mdc-toggle` component.
9
9
  *
10
10
  * @dependency mdc-icon
@@ -47,6 +47,18 @@ declare class StaticToggle extends StaticToggle_base {
47
47
  * @default default
48
48
  */
49
49
  size: ToggleSize;
50
+ /**
51
+ * Determines whether the toggle is read-only.
52
+ *
53
+ * @default false
54
+ */
55
+ readonly: boolean;
56
+ /**
57
+ * Determines whether the toggle is soft-disabled.
58
+ *
59
+ * @default false
60
+ */
61
+ softDisabled: boolean;
50
62
  render(): import("lit-html").TemplateResult<1>;
51
63
  static styles: Array<CSSResult>;
52
64
  }
@@ -15,7 +15,7 @@ import { DEFAULTS, ICON_NAME, ICON_SIZE_IN_REM } from './statictoggle.constants'
15
15
  import styles from './statictoggle.styles';
16
16
  /**
17
17
  * This is a decorative component that is styled to look as a toggle. <br/>
18
- * It has 3 properties - checked, size and disabled. <br/>
18
+ * It has 5 properties - checked, size, disabled, readonly and soft-disabled. <br/>
19
19
  * We are using the same styling that has been created for the `mdc-toggle` component.
20
20
  *
21
21
  * @dependency mdc-icon
@@ -60,6 +60,18 @@ class StaticToggle extends DisabledMixin(Component) {
60
60
  * @default default
61
61
  */
62
62
  this.size = DEFAULTS.SIZE;
63
+ /**
64
+ * Determines whether the toggle is read-only.
65
+ *
66
+ * @default false
67
+ */
68
+ this.readonly = false;
69
+ /**
70
+ * Determines whether the toggle is soft-disabled.
71
+ *
72
+ * @default false
73
+ */
74
+ this.softDisabled = false;
63
75
  }
64
76
  render() {
65
77
  return html `
@@ -84,4 +96,12 @@ __decorate([
84
96
  property({ type: String, reflect: true }),
85
97
  __metadata("design:type", String)
86
98
  ], StaticToggle.prototype, "size", void 0);
99
+ __decorate([
100
+ property({ type: Boolean, reflect: true }),
101
+ __metadata("design:type", Object)
102
+ ], StaticToggle.prototype, "readonly", void 0);
103
+ __decorate([
104
+ property({ type: Boolean, attribute: 'soft-disabled', reflect: true }),
105
+ __metadata("design:type", Object)
106
+ ], StaticToggle.prototype, "softDisabled", void 0);
87
107
  export default StaticToggle;
@@ -9,6 +9,7 @@ const styles = [
9
9
  --mdc-statictoggle-border-radius: 0.75rem;
10
10
  --mdc-statictoggle-border-radius-compact: 0.5rem;
11
11
  --mdc-statictoggle-border: 1px solid var(--mds-color-theme-outline-input-normal);
12
+ --mdc-statictoggle-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
12
13
 
13
14
  --mdc-statictoggle-inactive-rest-color: var(--mds-color-theme-control-inactive-normal);
14
15
  --mdc-statictoggle-inactive-disabled-color: var(--mds-color-theme-control-inactive-disabled);
@@ -26,7 +27,7 @@ const styles = [
26
27
  :host::part(slider) {
27
28
  width: var(--mdc-statictoggle-width);
28
29
  height: var(--mdc-statictoggle-height);
29
- background: var(--mdc-statictoggle-inactive-rest-color);
30
+ background-color: var(--mdc-statictoggle-inactive-rest-color);
30
31
  border-radius: var(--mdc-statictoggle-border-radius);
31
32
  border: var(--mdc-statictoggle-border);
32
33
  display: flex;
@@ -56,7 +57,10 @@ const styles = [
56
57
  border-radius: 50%;
57
58
  }
58
59
 
59
- :host([disabled])::part(toggle-icon) {
60
+ :host([disabled])::part(toggle-icon),
61
+ :host([soft-disabled])::part(toggle-icon),
62
+ :host([disabled][readonly])::part(toggle-icon),
63
+ :host([soft-disabled][readonly])::part(toggle-icon) {
60
64
  --mdc-icon-fill-color: var(--mdc-statictoggle-icon-color-disabled);
61
65
  background-color: var(--mdc-statictoggle-icon-background-color-disabled);
62
66
  }
@@ -65,12 +69,28 @@ const styles = [
65
69
  padding: 0.125rem;
66
70
  }
67
71
 
68
- :host([disabled])::part(slider) {
72
+ :host([disabled])::part(slider),
73
+ :host([soft-disabled])::part(slider),
74
+ :host([readonly])::part(slider) {
69
75
  background-color: var(--mdc-statictoggle-inactive-disabled-color);
76
+ border-color: var(--mdc-statictoggle-disabled-border-color);
70
77
  }
71
78
 
72
- :host([disabled][checked])::part(slider) {
79
+ :host([disabled][checked])::part(slider),
80
+ :host([soft-disabled][checked])::part(slider),
81
+ :host([disabled][readonly][checked])::part(slider),
82
+ :host([soft-disabled][readonly][checked])::part(slider) {
73
83
  background-color: var(--mdc-statictoggle-active-disabled-color);
84
+ border-color: transparent;
85
+ }
86
+
87
+ :host([readonly])::part(toggle-icon) {
88
+ background-color: var(--mdc-statictoggle-icon-background-color-normal);
89
+ }
90
+
91
+ :host([disabled][readonly])::part(slider),
92
+ :host([soft-disabled][readonly])::part(slider) {
93
+ background-color: var(--mdc-statictoggle-inactive-disabled-color);
74
94
  }
75
95
 
76
96
  /* High Contrast Mode */
@@ -70,11 +70,6 @@ declare class Textarea extends Textarea_base {
70
70
  * The placeholder text that is displayed when the textarea field is empty.
71
71
  */
72
72
  placeholder?: string;
73
- /**
74
- * readonly attribute of the textarea field. If true, the textarea field is read-only.
75
- * @default false
76
- */
77
- readonly: boolean;
78
73
  /**
79
74
  * The rows attribute specifies the visible number of lines in a text area.
80
75
  * @default 5
@@ -83,11 +83,6 @@ import styles from './textarea.styles';
83
83
  class Textarea extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
84
84
  constructor() {
85
85
  super(...arguments);
86
- /**
87
- * readonly attribute of the textarea field. If true, the textarea field is read-only.
88
- * @default false
89
- */
90
- this.readonly = false;
91
86
  /**
92
87
  * The rows attribute specifies the visible number of lines in a text area.
93
88
  * @default 5
@@ -328,10 +323,6 @@ __decorate([
328
323
  property({ type: String }),
329
324
  __metadata("design:type", String)
330
325
  ], Textarea.prototype, "placeholder", void 0);
331
- __decorate([
332
- property({ type: Boolean }),
333
- __metadata("design:type", Object)
334
- ], Textarea.prototype, "readonly", void 0);
335
326
  __decorate([
336
327
  property({ type: Number }),
337
328
  __metadata("design:type", Number)
@@ -83,7 +83,7 @@ declare class Toggle extends Toggle_base implements AssociatedFormControl {
83
83
  private setFormValue;
84
84
  /**
85
85
  * Toggles the state of the toggle element.
86
- * If the element is not disabled, then the checked property is toggled.
86
+ * If the element is not disabled, soft-disabled, or readonly, then the checked property is toggled.
87
87
  */
88
88
  private toggleState;
89
89
  /**
@@ -80,7 +80,7 @@ class Toggle extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin
80
80
  }
81
81
  connectedCallback() {
82
82
  super.connectedCallback();
83
- // Toggle does not contain helpTextType property.
83
+ // Toggle does not contain helpTextType property.
84
84
  this.helpTextType = undefined;
85
85
  }
86
86
  firstUpdated(_changedProperties) {
@@ -143,10 +143,10 @@ class Toggle extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin
143
143
  }
144
144
  /**
145
145
  * Toggles the state of the toggle element.
146
- * If the element is not disabled, then the checked property is toggled.
146
+ * If the element is not disabled, soft-disabled, or readonly, then the checked property is toggled.
147
147
  */
148
148
  toggleState() {
149
- if (!this.disabled) {
149
+ if (!this.disabled && !this.softDisabled && !this.readonly) {
150
150
  this.checked = !this.checked;
151
151
  }
152
152
  }
@@ -157,6 +157,9 @@ class Toggle extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin
157
157
  */
158
158
  handleKeyDown(event) {
159
159
  var _a;
160
+ if ((this.readonly || this.softDisabled) && event.key === KEYS.SPACE) {
161
+ event.preventDefault();
162
+ }
160
163
  if (event.key === KEYS.ENTER) {
161
164
  (_a = this.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
162
165
  }
@@ -195,6 +198,8 @@ class Toggle extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin
195
198
  <mdc-statictoggle
196
199
  ?checked="${this.checked}"
197
200
  ?disabled="${this.disabled}"
201
+ ?readonly="${this.readonly}"
202
+ ?soft-disabled="${this.softDisabled}"
198
203
  size="${this.size}"
199
204
  class="mdc-focus-ring"
200
205
  part="container"
@@ -210,6 +215,7 @@ class Toggle extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin
210
215
  .checked="${this.checked}"
211
216
  aria-checked="${this.checked}"
212
217
  .disabled="${this.disabled}"
218
+ ?readonly="${this.readonly}"
213
219
  aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
214
220
  aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
215
221
  tabindex="${this.disabled ? -1 : 0}"
@@ -3,6 +3,7 @@ import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
3
3
  const styles = [
4
4
  hostFitContentStyles,
5
5
  css `
6
+ /* Base styles and CSS custom properties */
6
7
  :host {
7
8
  --mdc-toggle-width: 3rem;
8
9
  --mdc-toggle-height: 1.5rem;
@@ -18,6 +19,7 @@ const styles = [
18
19
  --mdc-toggle-inactive-pressed-color: var(--mds-color-theme-control-inactive-pressed);
19
20
  }
20
21
 
22
+ /* Grid layout for labeled toggles */
21
23
  :host([label]),
22
24
  :host([help-text]) {
23
25
  display: grid;
@@ -32,6 +34,12 @@ const styles = [
32
34
  row-gap: 0rem;
33
35
  }
34
36
 
37
+ :host::part(label-text),
38
+ :host::part(help-text-container) {
39
+ grid-column: 2;
40
+ }
41
+
42
+ /* Component structure and layout */
35
43
  :host::part(toggle-input) {
36
44
  margin: 0;
37
45
  padding: 0;
@@ -43,16 +51,6 @@ const styles = [
43
51
  height: var(--mdc-toggle-height);
44
52
  }
45
53
 
46
- :host::part(label-text),
47
- :host::part(help-text-container) {
48
- grid-column: 2;
49
- }
50
-
51
- :host::part(label),
52
- :host::part(toggle-input) {
53
- cursor: pointer;
54
- }
55
-
56
54
  :host::part(label) {
57
55
  word-break: break-word;
58
56
  white-space: normal;
@@ -61,33 +59,62 @@ const styles = [
61
59
  line-height: var(--mds-font-apps-body-midsize-regular-line-height);
62
60
  }
63
61
 
64
- :host([disabled])::part(label),
65
- :host([disabled])::part(toggle-input) {
66
- cursor: default;
67
- }
68
-
69
62
  :host::part(help-text) {
70
63
  color: var(--mdc-toggle-help-text-color);
71
64
  }
72
65
 
73
- :host(:hover:not([disabled]))::part(container) {
66
+ /* Default interactive states */
67
+ :host::part(label),
68
+ :host::part(toggle-input) {
69
+ cursor: pointer;
70
+ }
71
+
72
+ :host(:hover)::part(container) {
74
73
  background-color: var(--mdc-toggle-inactive-hover-color);
75
74
  }
76
75
 
77
- :host(:active:not([disabled]))::part(container) {
76
+ :host(:active)::part(container) {
78
77
  background-color: var(--mdc-toggle-inactive-pressed-color);
79
78
  }
80
79
 
81
- :host(:hover:not([disabled])[checked])::part(container) {
80
+ :host([checked]:hover)::part(container) {
82
81
  background-color: var(--mdc-toggle-active-hover-color);
83
82
  }
84
83
 
85
- :host(:active:not([disabled])[checked])::part(container) {
84
+ :host([checked]:active)::part(container) {
86
85
  background-color: var(--mdc-toggle-active-pressed-color);
87
86
  }
88
87
 
88
+ /* Readonly state - disables pointer events */
89
+ :host([readonly]),
90
+ :host([soft-disabled]) {
91
+ pointer-events: none;
92
+ }
93
+
94
+ /* Disabled states override interactive styles */
95
+ :host([disabled])::part(label),
96
+ :host([disabled])::part(toggle-input),
97
+ :host([soft-disabled])::part(label),
98
+ :host([soft-disabled])::part(toggle-input) {
99
+ cursor: default;
100
+ }
101
+
102
+ :host([disabled]:hover)::part(container),
103
+ :host([disabled]:active)::part(container),
104
+ :host([disabled][checked]:hover)::part(container),
105
+ :host([disabled][checked]:active)::part(container),
106
+ :host([soft-disabled]:hover)::part(container),
107
+ :host([soft-disabled]:active)::part(container),
108
+ :host([soft-disabled][checked]:hover)::part(container),
109
+ :host([soft-disabled][checked]:active)::part(container) {
110
+ background-color: unset;
111
+ }
112
+
89
113
  :host([disabled])::part(label-text),
90
- :host([disabled])::part(help-text) {
114
+ :host([disabled])::part(help-text),
115
+ :host([soft-disabled])::part(label),
116
+ :host([soft-disabled])::part(label-text),
117
+ :host([soft-disabled])::part(help-text) {
91
118
  color: var(--mdc-toggle-label-color-disabled);
92
119
  }
93
120
  `,