material-inspired-component-library 8.1.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -18
- package/components/README.md +1 -1
- package/components/accordion/README.md +6 -6
- package/components/alert/README.md +10 -10
- package/components/alert/index.scss +27 -52
- package/components/appbar/README.md +19 -6
- package/components/appbar/index.scss +40 -44
- package/components/badge/README.md +12 -10
- package/components/badge/index.scss +21 -25
- package/components/bottomsheet/README.md +26 -1
- package/components/bottomsheet/index.scss +58 -44
- package/components/button/README.md +70 -10
- package/components/button/_shared.scss +210 -0
- package/components/button/index.scss +75 -389
- package/components/card/README.md +97 -85
- package/components/card/index.scss +46 -65
- package/components/checkbox/README.md +25 -14
- package/{tools/shapes/check.mjs → components/checkbox/_label.scss} +37 -42
- package/components/checkbox/index.scss +66 -66
- package/components/chip/README.md +186 -0
- package/components/chip/index.scss +285 -0
- package/components/datepicker/README.md +79 -0
- package/components/datepicker/index.scss +346 -315
- package/components/dialog/README.md +20 -10
- package/components/dialog/index.scss +55 -66
- package/components/divider/README.md +16 -15
- package/components/divider/index.scss +9 -25
- package/components/iconbutton/README.md +63 -12
- package/components/iconbutton/index.scss +142 -303
- package/components/list/README.md +89 -156
- package/components/list/index.scss +34 -36
- package/components/menu/README.md +81 -155
- package/components/menu/index.scss +52 -58
- package/components/navigationbar/README.md +108 -0
- package/components/navigationbar/index.scss +185 -0
- package/components/navigationrail/README.md +62 -37
- package/components/navigationrail/_navitem.scss +96 -0
- package/components/navigationrail/index.scss +78 -132
- package/components/progressindicator/README.md +83 -47
- package/components/progressindicator/index.scss +622 -172
- package/components/radio/README.md +11 -9
- package/components/radio/index.scss +36 -33
- package/components/select/README.md +12 -7
- package/components/select/index.scss +26 -34
- package/components/shapes/README.md +3 -3
- package/components/shapes/index.scss +0 -1
- package/components/sidesheet/README.md +21 -9
- package/components/sidesheet/index.scss +38 -46
- package/components/slider/README.md +21 -0
- package/components/slider/index.scss +108 -139
- package/components/snackbar/README.md +32 -35
- package/components/snackbar/index.scss +10 -22
- package/components/stepper/README.md +14 -7
- package/components/stepper/index.scss +58 -39
- package/components/switch/README.md +22 -15
- package/components/switch/index.scss +68 -60
- package/components/textfield/README.md +48 -5
- package/components/textfield/index.scss +192 -248
- package/components/timepicker/README.md +53 -23
- package/components/timepicker/index.scss +110 -128
- package/dist/alert.css +1 -1
- package/dist/alert.js +1 -1
- package/dist/appbar.css +1 -1
- package/dist/appbar.js +1 -1
- package/dist/badge.css +1 -1
- package/dist/badge.js +1 -1
- package/dist/base.css +1 -0
- package/dist/base.js +1 -0
- package/dist/bottomsheet.css +1 -1
- package/dist/bottomsheet.js +1 -1
- package/dist/button.css +1 -1
- package/dist/button.js +1 -1
- package/dist/card.css +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip.css +1 -0
- package/dist/chip.js +1 -0
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/iconbutton/index.d.ts +2 -7
- package/dist/components/slider/index.d.ts +1 -1
- package/dist/components/textfield/index.d.ts +2 -2
- package/dist/datepicker.css +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/dialog.css +1 -1
- package/dist/dialog.js +1 -1
- package/dist/divider.css +1 -1
- package/dist/divider.js +1 -1
- package/dist/field.css +1 -0
- package/dist/field.js +1 -0
- package/dist/foundations/form/index.js +1 -1
- package/dist/foundations/runtime.d.ts +15 -0
- package/dist/foundations/runtime.js +1 -0
- package/dist/iconbutton.css +1 -1
- package/dist/iconbutton.js +1 -1
- package/dist/layout.css +1 -1
- package/dist/layout.js +1 -1
- package/dist/list.css +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.css +1 -1
- package/dist/menu.js +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.d.ts +14 -5
- package/dist/micl.js +1 -1
- package/dist/navigationbar.css +1 -0
- package/dist/navigationbar.js +1 -0
- package/dist/navigationrail.css +1 -1
- package/dist/navigationrail.js +1 -1
- package/dist/progressindicator.css +1 -1
- package/dist/progressindicator.js +1 -1
- package/dist/radio.css +1 -1
- package/dist/radio.js +1 -1
- package/dist/scrollbar.js +1 -1
- package/dist/select.css +1 -1
- package/dist/select.js +1 -1
- package/dist/shapes.css +1 -1
- package/dist/shapes.js +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/sidesheet.js +1 -1
- package/dist/slider.css +1 -1
- package/dist/slider.js +1 -1
- package/dist/snackbar.css +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/stepper.css +1 -1
- package/dist/stepper.js +1 -1
- package/dist/switch.css +1 -1
- package/dist/switch.js +1 -1
- package/dist/textfield.css +1 -1
- package/dist/textfield.js +1 -1
- package/dist/timepicker.css +1 -1
- package/dist/timepicker.js +1 -1
- package/foundations/_index.scss +35 -0
- package/foundations/{index.scss → base/index.scss} +21 -56
- package/foundations/field/index.scss +37 -0
- package/foundations/layout/index.scss +64 -65
- package/package.json +23 -9
- package/styles/statelayer.scss +20 -5
- package/styles.scss +5 -2
- package/.claude/settings.local.json +0 -14
- package/.editorconfig +0 -12
- package/.gitattributes +0 -9
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/CLAUDE.md +0 -53
- package/CODE_OF_CONDUCT.md +0 -128
- package/components/bottomsheet/index.ts +0 -153
- package/components/button/index.ts +0 -79
- package/components/checkbox/index.ts +0 -148
- package/components/datepicker/index.ts +0 -693
- package/components/iconbutton/index.ts +0 -77
- package/components/list/index.ts +0 -138
- package/components/menu/index.ts +0 -145
- package/components/navigationrail/index.ts +0 -87
- package/components/progressindicator/index.ts +0 -77
- package/components/slider/index.ts +0 -149
- package/components/snackbar/index.ts +0 -118
- package/components/stepper/index.ts +0 -248
- package/components/textfield/index.ts +0 -188
- package/components/timepicker/index.ts +0 -413
- package/dist/components/progressindicator/index.d.ts +0 -6
- package/dist/foundations.css +0 -1
- package/dist/foundations.js +0 -1
- package/docs/accordion.html +0 -344
- package/docs/alert.html +0 -177
- package/docs/bottomsheet.html +0 -240
- package/docs/button.html +0 -290
- package/docs/card-awards.webp +0 -0
- package/docs/card-cabinet.webp +0 -0
- package/docs/card-city.webp +0 -0
- package/docs/card-fingerprint.webp +0 -0
- package/docs/card-holiday.webp +0 -0
- package/docs/card-names.webp +0 -0
- package/docs/card.html +0 -159
- package/docs/checkbox.html +0 -147
- package/docs/datepicker.html +0 -274
- package/docs/dialog.html +0 -195
- package/docs/divider.html +0 -139
- package/docs/docs.css +0 -26
- package/docs/docs.js +0 -139
- package/docs/iconbutton.html +0 -329
- package/docs/index.html +0 -431
- package/docs/list.html +0 -310
- package/docs/menu.html +0 -574
- package/docs/micl.css +0 -1
- package/docs/micl.js +0 -1
- package/docs/navigationrail.html +0 -138
- package/docs/progressindicator.html +0 -288
- package/docs/radio.html +0 -123
- package/docs/select.html +0 -337
- package/docs/shapes.css +0 -1
- package/docs/shapes.html +0 -159
- package/docs/shapes.js +0 -1
- package/docs/sidesheet.html +0 -149
- package/docs/slider.html +0 -141
- package/docs/snackbar.html +0 -102
- package/docs/stepper.html +0 -319
- package/docs/switch.html +0 -196
- package/docs/textfield.html +0 -208
- package/docs/themes/airblue/dark-hc.css +0 -51
- package/docs/themes/airblue/dark-mc.css +0 -51
- package/docs/themes/airblue/dark.css +0 -51
- package/docs/themes/airblue/light-hc.css +0 -51
- package/docs/themes/airblue/light-mc.css +0 -51
- package/docs/themes/airblue/light.css +0 -51
- package/docs/themes/airblue/theme.css +0 -306
- package/docs/themes/barnred/dark-hc.css +0 -51
- package/docs/themes/barnred/dark-mc.css +0 -51
- package/docs/themes/barnred/dark.css +0 -51
- package/docs/themes/barnred/light-hc.css +0 -51
- package/docs/themes/barnred/light-mc.css +0 -51
- package/docs/themes/barnred/light.css +0 -51
- package/docs/themes/barnred/theme.css +0 -306
- package/docs/themes/citrine/dark-hc.css +0 -51
- package/docs/themes/citrine/dark-mc.css +0 -51
- package/docs/themes/citrine/dark.css +0 -51
- package/docs/themes/citrine/light-hc.css +0 -51
- package/docs/themes/citrine/light-mc.css +0 -51
- package/docs/themes/citrine/light.css +0 -51
- package/docs/themes/citrine/theme.css +0 -306
- package/docs/themes/gray/dark-hc.css +0 -51
- package/docs/themes/gray/dark-mc.css +0 -51
- package/docs/themes/gray/dark.css +0 -51
- package/docs/themes/gray/light-hc.css +0 -51
- package/docs/themes/gray/light-mc.css +0 -51
- package/docs/themes/gray/light.css +0 -51
- package/docs/themes/gray/theme.css +0 -306
- package/docs/themes/greenery/dark-hc.css +0 -51
- package/docs/themes/greenery/dark-mc.css +0 -51
- package/docs/themes/greenery/dark.css +0 -51
- package/docs/themes/greenery/light-hc.css +0 -51
- package/docs/themes/greenery/light-mc.css +0 -51
- package/docs/themes/greenery/light.css +0 -51
- package/docs/themes/greenery/theme.css +0 -306
- package/docs/themes/hermana/dark-hc.css +0 -51
- package/docs/themes/hermana/dark-mc.css +0 -51
- package/docs/themes/hermana/dark.css +0 -51
- package/docs/themes/hermana/light-hc.css +0 -51
- package/docs/themes/hermana/light-mc.css +0 -51
- package/docs/themes/hermana/light.css +0 -51
- package/docs/themes/hermana/theme.css +0 -306
- package/docs/themes/illuminating/dark-hc.css +0 -51
- package/docs/themes/illuminating/dark-mc.css +0 -51
- package/docs/themes/illuminating/dark.css +0 -51
- package/docs/themes/illuminating/light-hc.css +0 -51
- package/docs/themes/illuminating/light-mc.css +0 -51
- package/docs/themes/illuminating/light.css +0 -51
- package/docs/themes/illuminating/theme.css +0 -306
- package/docs/themes/magenta/dark-hc.css +0 -51
- package/docs/themes/magenta/dark-mc.css +0 -51
- package/docs/themes/magenta/dark.css +0 -51
- package/docs/themes/magenta/light-hc.css +0 -51
- package/docs/themes/magenta/light-mc.css +0 -51
- package/docs/themes/magenta/light.css +0 -51
- package/docs/themes/magenta/theme.css +0 -306
- package/docs/themes/mocha/dark-hc.css +0 -51
- package/docs/themes/mocha/dark-mc.css +0 -51
- package/docs/themes/mocha/dark.css +0 -51
- package/docs/themes/mocha/light-hc.css +0 -51
- package/docs/themes/mocha/light-mc.css +0 -51
- package/docs/themes/mocha/light.css +0 -51
- package/docs/themes/mocha/theme.css +0 -306
- package/docs/themes/olivegreen/dark-hc.css +0 -51
- package/docs/themes/olivegreen/dark-mc.css +0 -51
- package/docs/themes/olivegreen/dark.css +0 -51
- package/docs/themes/olivegreen/light-hc.css +0 -51
- package/docs/themes/olivegreen/light-mc.css +0 -51
- package/docs/themes/olivegreen/light.css +0 -51
- package/docs/themes/olivegreen/theme.css +0 -306
- package/docs/themes/peri/dark-hc.css +0 -51
- package/docs/themes/peri/dark-mc.css +0 -51
- package/docs/themes/peri/dark.css +0 -51
- package/docs/themes/peri/light-hc.css +0 -51
- package/docs/themes/peri/light-mc.css +0 -51
- package/docs/themes/peri/light.css +0 -51
- package/docs/themes/peri/theme.css +0 -306
- package/docs/timepicker.html +0 -160
- package/foundations/form/index.ts +0 -174
- package/foundations/layout/README.md +0 -127
- package/intl.d.ts +0 -9
- package/micl.ts +0 -221
- package/styles/README.md +0 -196
- package/tools/shapes/generate.mjs +0 -828
- package/tsconfig.json +0 -116
- package/webpack.config.js +0 -104
|
@@ -23,7 +23,7 @@ Or import all MICL styles:
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### JavaScript
|
|
26
|
-
This component requires JavaScript
|
|
26
|
+
This component requires JavaScript to support the **toggle logic**:
|
|
27
27
|
|
|
28
28
|
```JavaScript
|
|
29
29
|
import micl from "material-inspired-component-library/dist/micl";
|
|
@@ -40,7 +40,7 @@ Buttons come in **five sizes**: extra small (`xs`), small (`s`), medium (`m`), l
|
|
|
40
40
|
**Example: An extra-large text button**
|
|
41
41
|
|
|
42
42
|
```HTML
|
|
43
|
-
<button type="button" class="micl-button-text-xl>Save</button>
|
|
43
|
+
<button type="button" class="micl-button-text-xl">Save</button>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Material Design provides **five distinct styles**: `text`, `elevated`, `filled`, `tonal` and `outlined`. To use a style other than the `text` style used above, apply the corresponding class to the button:
|
|
@@ -56,9 +56,9 @@ By default, buttons have a **rounded shape**. For a more square-like appearance,
|
|
|
56
56
|
Adding the `disabled` boolean attribute to the button causes the button to be displayed in a disabled state.
|
|
57
57
|
|
|
58
58
|
### Toggle Button
|
|
59
|
-
A toggle button has two states: **on** (
|
|
60
|
-
- **Off state**: The button has the `micl-button--toggle` class
|
|
61
|
-
- **On state**: The button has
|
|
59
|
+
A toggle button has two states: **on** (pressed) and **off** (unpressed). To create one, add the `micl-button--toggle` class and an `aria-pressed` attribute.
|
|
60
|
+
- **Off state**: The button has the `micl-button--toggle` class and `aria-pressed="false"`.
|
|
61
|
+
- **On state**: The button has the `micl-button--toggle` class and `aria-pressed="true"`.
|
|
62
62
|
|
|
63
63
|
**Example: A selected toggle button**
|
|
64
64
|
|
|
@@ -66,13 +66,14 @@ A toggle button has two states: **on** (selected) and **off** (unselected). To c
|
|
|
66
66
|
<button
|
|
67
67
|
type="button"
|
|
68
68
|
id="id0"
|
|
69
|
-
class="micl-button-tonal-s micl-button--toggle
|
|
69
|
+
class="micl-button-tonal-s micl-button--toggle"
|
|
70
|
+
aria-pressed="true"
|
|
70
71
|
commandfor="id0"
|
|
71
72
|
command="--micl-toggle"
|
|
72
73
|
>Selected</button>
|
|
73
74
|
```
|
|
74
75
|
|
|
75
|
-
The self-targeting `command` property (`--micl-toggle`)
|
|
76
|
+
The self-targeting `command` property (`--micl-toggle`) flips `aria-pressed` whenever the user interacts with the button.
|
|
76
77
|
|
|
77
78
|
## Icons
|
|
78
79
|
To add a leading icon to a button, include an element with the `micl-button__icon` class inside the `<button>`:
|
|
@@ -84,14 +85,14 @@ To add a leading icon to a button, include an element with the `micl-button__ico
|
|
|
84
85
|
</button>
|
|
85
86
|
```
|
|
86
87
|
|
|
87
|
-
To use different icons for the **on** state and the **off** state in a toggle button, remove the icon name from the `micl-button__icon` element and add the `data-miclicon` (the name of the **
|
|
88
|
+
To use different icons for the **on** state and the **off** state in a toggle button, remove the icon name from the `micl-button__icon` element and add the `data-miclicon` (the name of the **off** icon) and `data-micliconselected` (the name of the **on** icon) attributes:
|
|
88
89
|
|
|
89
90
|
```HTML
|
|
90
91
|
...
|
|
91
92
|
<span
|
|
92
93
|
class="micl-button__icon material-symbols-outlined"
|
|
93
|
-
data-miclicon="
|
|
94
|
-
data-micliconselected="
|
|
94
|
+
data-miclicon="icon_for_off"
|
|
95
|
+
data-micliconselected="icon_for_on"
|
|
95
96
|
aria-hidden="true"
|
|
96
97
|
><span>
|
|
97
98
|
...
|
|
@@ -114,5 +115,64 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
|
|
|
114
115
|
</button>
|
|
115
116
|
```
|
|
116
117
|
|
|
118
|
+
## Theming
|
|
119
|
+
Each button style can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention. Note that the `selected-*` and `unselected-*` properties only apply to [toggle buttons](#toggle-button).
|
|
120
|
+
|
|
121
|
+
### Text
|
|
122
|
+
| Custom property | Meaning | Default |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `--md-comp-text-button-label-text-color` | Label & icon colour | `--md-sys-color-primary` |
|
|
125
|
+
| `--md-comp-text-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface-variant` |
|
|
126
|
+
| `--md-comp-text-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
127
|
+
|
|
128
|
+
### Elevated
|
|
129
|
+
| Custom property | Meaning | Default |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| `--md-comp-elevated-button-container-color` | Container background | `--md-sys-color-surface-container-low` |
|
|
132
|
+
| `--md-comp-elevated-button-container-elevation` | Container elevation (shadow) | `--md-sys-elevation-level1` |
|
|
133
|
+
| `--md-comp-elevated-button-label-text-color` | Label & icon colour | `--md-sys-color-primary` |
|
|
134
|
+
| `--md-comp-elevated-button-selected-container-color` | Container background when selected | `--md-sys-color-primary` |
|
|
135
|
+
| `--md-comp-elevated-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-on-primary` |
|
|
136
|
+
| `--md-comp-elevated-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
137
|
+
| `--md-comp-elevated-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
138
|
+
| `--md-comp-elevated-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface-variant` |
|
|
139
|
+
| `--md-comp-elevated-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
140
|
+
|
|
141
|
+
### Filled
|
|
142
|
+
| Custom property | Meaning | Default |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `--md-comp-filled-button-container-color` | Container background (also the selected state) | `--md-sys-color-primary` |
|
|
145
|
+
| `--md-comp-filled-button-label-text-color` | Label & icon colour (also the selected state) | `--md-sys-color-on-primary` |
|
|
146
|
+
| `--md-comp-filled-button-unselected-container-color` | Container background when an unselected toggle | `--md-sys-color-surface-container` |
|
|
147
|
+
| `--md-comp-filled-button-unselected-label-text-color` | Label & icon colour when an unselected toggle | `--md-sys-color-on-surface-variant` |
|
|
148
|
+
| `--md-comp-filled-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
149
|
+
| `--md-comp-filled-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
150
|
+
| `--md-comp-filled-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface-variant` |
|
|
151
|
+
| `--md-comp-filled-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
152
|
+
|
|
153
|
+
### Tonal
|
|
154
|
+
| Custom property | Meaning | Default |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| `--md-comp-filled-tonal-button-container-color` | Container background | `--md-sys-color-secondary-container` |
|
|
157
|
+
| `--md-comp-filled-tonal-button-label-text-color` | Label & icon colour | `--md-sys-color-on-secondary-container` |
|
|
158
|
+
| `--md-comp-filled-tonal-button-selected-container-color` | Container background when selected | `--md-sys-color-secondary` |
|
|
159
|
+
| `--md-comp-filled-tonal-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-on-secondary` |
|
|
160
|
+
| `--md-comp-filled-tonal-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
161
|
+
| `--md-comp-filled-tonal-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
162
|
+
| `--md-comp-filled-tonal-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface-variant` |
|
|
163
|
+
| `--md-comp-filled-tonal-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
164
|
+
|
|
165
|
+
### Outlined
|
|
166
|
+
| Custom property | Meaning | Default |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| `--md-comp-outlined-button-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
169
|
+
| `--md-comp-outlined-button-label-text-color` | Label & icon colour | `--md-sys-color-on-surface-variant` |
|
|
170
|
+
| `--md-comp-outlined-button-selected-container-color` | Container background when selected | `--md-sys-color-inverse-surface` |
|
|
171
|
+
| `--md-comp-outlined-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-inverse-on-surface` |
|
|
172
|
+
| `--md-comp-outlined-button-selected-disabled-container-color` | Container background when selected and disabled | `--md-sys-color-on-surface` |
|
|
173
|
+
| `--md-comp-outlined-button-selected-disabled-container-opacity` | Container opacity when selected and disabled | `10%` |
|
|
174
|
+
| `--md-comp-outlined-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface-variant` |
|
|
175
|
+
| `--md-comp-outlined-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
176
|
+
|
|
117
177
|
## Compatibility
|
|
118
178
|
This component utilizes relative RGB color values, which may not be fully supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#browser_compatibility) for details.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright © 2025 Hermana AS
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
|
|
22
|
+
// The shared foundation of the Button component: the state selectors and the
|
|
23
|
+
// %micl-button-* placeholders, which the Chip component extends as well.
|
|
24
|
+
|
|
25
|
+
@use '../../styles/elevation';
|
|
26
|
+
@use '../../styles/motion';
|
|
27
|
+
@use '../../styles/statelayer';
|
|
28
|
+
@use '../../styles/typography';
|
|
29
|
+
|
|
30
|
+
$disabled: ':is(:disabled, :has(input:disabled, > button:disabled))';
|
|
31
|
+
$enabled: ':not(:disabled, :has(input:disabled, > button:disabled))';
|
|
32
|
+
$focused: ':is(:focus-visible, :has(input:focus-visible))';
|
|
33
|
+
|
|
34
|
+
@include elevation.level(0);
|
|
35
|
+
@include elevation.level(1);
|
|
36
|
+
@include elevation.level(2);
|
|
37
|
+
|
|
38
|
+
@include statelayer.token('hover-state-layer-opacity');
|
|
39
|
+
@include statelayer.token('focus-state-layer-opacity');
|
|
40
|
+
@include statelayer.token('pressed-state-layer-opacity');
|
|
41
|
+
@include statelayer.token('disabled-state-layer-opacity');
|
|
42
|
+
@include statelayer.token('focus-indicator-thickness');
|
|
43
|
+
@include statelayer.token('ripple-opacity-factor');
|
|
44
|
+
@include statelayer.token('ripple-duration');
|
|
45
|
+
@include statelayer.property;
|
|
46
|
+
@include statelayer.keyframes;
|
|
47
|
+
|
|
48
|
+
@include typography.scale('label-large');
|
|
49
|
+
|
|
50
|
+
%micl-button-base {
|
|
51
|
+
--md-comp-button-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
52
|
+
--md-comp-button-motion-duration: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
53
|
+
--micl-ripple: 1;
|
|
54
|
+
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
position: relative;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
flex-shrink: 0;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
padding: 0;
|
|
62
|
+
border: none;
|
|
63
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
64
|
+
background-image:
|
|
65
|
+
radial-gradient(
|
|
66
|
+
circle at var(--micl-x, center) var(--micl-y, center),
|
|
67
|
+
transparent 0%,
|
|
68
|
+
rgb(from var(--statelayer-color) r g b / calc(var(--statelayer-opacity) * var(--md-sys-state-ripple-opacity-factor))) 10%,
|
|
69
|
+
transparent 10%
|
|
70
|
+
),
|
|
71
|
+
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
72
|
+
background-repeat: no-repeat;
|
|
73
|
+
background-position: var(--micl-x, center) var(--micl-y, center), 0 0;
|
|
74
|
+
background-size: 0%, 100%;
|
|
75
|
+
-webkit-tap-highlight-color: transparent;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
transition:
|
|
78
|
+
border-radius var(--md-comp-button-motion-duration) var(--md-comp-button-motion-effects),
|
|
79
|
+
box-shadow var(--md-comp-button-motion-duration) var(--md-comp-button-motion-effects),
|
|
80
|
+
background-size 0ms,
|
|
81
|
+
--statelayer-opacity var(--md-comp-button-motion-duration) linear;
|
|
82
|
+
|
|
83
|
+
&#{$disabled} {
|
|
84
|
+
cursor: default;
|
|
85
|
+
}
|
|
86
|
+
&#{$enabled} {
|
|
87
|
+
&:hover {
|
|
88
|
+
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
89
|
+
|
|
90
|
+
.micl-button__icon {
|
|
91
|
+
font-variation-settings: 'FILL' 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
&#{$focused} {
|
|
95
|
+
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
96
|
+
|
|
97
|
+
outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
|
|
98
|
+
outline-offset: 2px;
|
|
99
|
+
}
|
|
100
|
+
&:active {
|
|
101
|
+
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
102
|
+
}
|
|
103
|
+
&.micl-rippling {
|
|
104
|
+
animation: micl-ripple calc(var(--md-sys-state-ripple-duration) * 1.333);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.micl-button__icon {
|
|
108
|
+
font-variation-settings: 'FILL' 0;
|
|
109
|
+
transition: font-variation-settings var(--md-comp-button-motion-duration) linear;
|
|
110
|
+
}
|
|
111
|
+
&.micl-button--toggle:not([aria-pressed="true"]) .micl-button__icon::before {
|
|
112
|
+
content: attr(data-miclicon);
|
|
113
|
+
}
|
|
114
|
+
&.micl-button--toggle[aria-pressed="true"] .micl-button__icon::before {
|
|
115
|
+
content: attr(data-micliconselected);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Buttons smaller than the minimum touch target extend their interactive area with a
|
|
120
|
+
// transparent ::before overlay.
|
|
121
|
+
%micl-button-target {
|
|
122
|
+
&::before {
|
|
123
|
+
content: "";
|
|
124
|
+
position: absolute;
|
|
125
|
+
block-size: var(--md-sys-target-size, 48px);
|
|
126
|
+
inline-size: 100%;
|
|
127
|
+
min-inline-size: var(--md-sys-target-size, 48px);
|
|
128
|
+
inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
|
|
129
|
+
background-color: transparent;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
%micl-button-xs {
|
|
134
|
+
@include typography.label-large;
|
|
135
|
+
@extend %micl-button-target;
|
|
136
|
+
|
|
137
|
+
--micl-width: 32px;
|
|
138
|
+
--micl-height: 32px;
|
|
139
|
+
|
|
140
|
+
min-inline-size: var(--micl-width);
|
|
141
|
+
block-size: var(--micl-height);
|
|
142
|
+
min-block-size: var(--micl-height);
|
|
143
|
+
column-gap: 4px;
|
|
144
|
+
padding-inline: 12px;
|
|
145
|
+
|
|
146
|
+
.micl-button__icon {
|
|
147
|
+
font-size: 20px;
|
|
148
|
+
inline-size: 20px;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
%micl-button-elevated {
|
|
153
|
+
--statelayer-color: var(--md-sys-color-primary);
|
|
154
|
+
|
|
155
|
+
background-color: var(--md-comp-elevated-button-container-color, var(--md-sys-color-surface-container-low));
|
|
156
|
+
color: var(--md-comp-elevated-button-label-text-color, var(--md-sys-color-primary));
|
|
157
|
+
box-shadow: var(--md-comp-elevated-button-container-elevation, var(--md-sys-elevation-level1));
|
|
158
|
+
|
|
159
|
+
&#{$disabled} {
|
|
160
|
+
background-color: var(--md-comp-elevated-button-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-elevated-button-disabled-container-opacity, 10%)));
|
|
161
|
+
color: var(--md-comp-elevated-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface-variant) r g b / var(--md-comp-elevated-button-disabled-label-text-opacity, 38%)));
|
|
162
|
+
box-shadow: var(--md-sys-elevation-level0);
|
|
163
|
+
}
|
|
164
|
+
&#{$enabled} {
|
|
165
|
+
&:hover:not(:active) {
|
|
166
|
+
box-shadow: var(--md-sys-elevation-level2);
|
|
167
|
+
}
|
|
168
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
169
|
+
--statelayer-color: var(--md-sys-color-on-primary);
|
|
170
|
+
|
|
171
|
+
background-color: var(--md-comp-elevated-button-selected-container-color, var(--md-sys-color-primary));
|
|
172
|
+
color: var(--md-comp-elevated-button-selected-label-text-color, var(--md-sys-color-on-primary));
|
|
173
|
+
|
|
174
|
+
.micl-button__icon {
|
|
175
|
+
font-variation-settings: 'FILL' 1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
%micl-button-outlined {
|
|
182
|
+
--statelayer-color: var(--md-sys-color-on-surface-variant);
|
|
183
|
+
|
|
184
|
+
background-color: transparent;
|
|
185
|
+
color: var(--md-comp-outlined-button-label-text-color, var(--md-sys-color-on-surface-variant));
|
|
186
|
+
border: 1px solid var(--md-comp-outlined-button-outline-color, var(--md-sys-color-outline-variant));
|
|
187
|
+
|
|
188
|
+
&#{$disabled} {
|
|
189
|
+
background-color: transparent;
|
|
190
|
+
color: var(--md-comp-outlined-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface-variant) r g b / var(--md-comp-outlined-button-disabled-label-text-opacity, 38%)));
|
|
191
|
+
|
|
192
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
193
|
+
border: none;
|
|
194
|
+
background-color: var(--md-comp-outlined-button-selected-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-outlined-button-selected-disabled-container-opacity, 10%)));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
&#{$enabled} {
|
|
198
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
199
|
+
--statelayer-color: var(--md-sys-color-inverse-on-surface);
|
|
200
|
+
|
|
201
|
+
border: none;
|
|
202
|
+
background-color: var(--md-comp-outlined-button-selected-container-color, var(--md-sys-color-inverse-surface));
|
|
203
|
+
color: var(--md-comp-outlined-button-selected-label-text-color, var(--md-sys-color-inverse-on-surface));
|
|
204
|
+
|
|
205
|
+
.micl-button__icon {
|
|
206
|
+
font-variation-settings: 'FILL' 1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|