material-inspired-component-library 6.0.2 → 6.0.3

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.
@@ -49,6 +49,9 @@
49
49
  transition: motion.$md-sys-motion-duration-medium4 rotate;
50
50
  transform-origin: 50% calc((var(--md-sys-select-line-height) / 2) - 1px);
51
51
  }
52
+ &:disabled::picker-icon {
53
+ color: rgb(from var(--md-sys-color-on-surface-variant) r g b/var(--md-sys-state-disabled-state-layer-opacity, 38%));
54
+ }
52
55
  &:open::picker-icon {
53
56
  rotate: 180deg;
54
57
  }
@@ -0,0 +1,78 @@
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
+ @use '../../foundations';
23
+
24
+ :root {
25
+ --md-comp-snackbar-margin: 24px;
26
+ }
27
+
28
+ .micl-snackbar {
29
+ position: fixed;
30
+ display: grid;
31
+ grid-template-rows: 0fr;
32
+ align-content: flex-end;
33
+ inset: auto;
34
+ inset-block-end: 24px;
35
+ inset-block-end: calc(var(--md-comp-snackbar-margin) + env(safe-area-inset-bottom));
36
+ inset-inline-start: 50%;
37
+ margin: 0;
38
+ padding: 0;
39
+ border: none;
40
+ background: transparent;
41
+ opacity: 0;
42
+ overflow: visible;
43
+ translate: -50% 0;
44
+ transition:
45
+ opacity 300ms ease-out,
46
+ grid-template-rows 0s linear 300ms,
47
+ display 300ms allow-discrete,
48
+ overlay 300ms allow-discrete;
49
+
50
+ &:popover-open {
51
+ grid-template-rows: 1fr;
52
+ opacity: 1;
53
+ transition:
54
+ grid-template-rows 300ms cubic-bezier(0.2, 0, 0, 1),
55
+ opacity 300ms ease-out;
56
+
57
+ @starting-style {
58
+ grid-template-rows: 0fr;
59
+ opacity: 0;
60
+ }
61
+ }
62
+
63
+ .micl-snackbar__inner {
64
+ min-block-size: 0;
65
+ min-inline-size: 300px;
66
+ border-radius: 8px;
67
+ background: darkgray;
68
+ color: white;
69
+ overflow: hidden;
70
+
71
+ .micl-snackbar__content {
72
+ display: flex;
73
+ padding: 16px;
74
+ justify-content: space-between;
75
+ align-items: center;
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,56 @@
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
+ export const snackbarSelector = '.micl-snackbar';
23
+
24
+ export default (() =>
25
+ {
26
+ return {
27
+ initialize: (element: HTMLElement): void =>
28
+ {
29
+ if (
30
+ !element.matches(snackbarSelector)
31
+ || element.dataset.miclinitialized
32
+ ) {
33
+ return;
34
+ }
35
+ element.dataset.miclinitialized = '1';
36
+
37
+ const delay = parseInt(element.dataset.micldelay || '0', 10);
38
+ if (!isNaN(delay) && delay > 0) {
39
+ element.addEventListener('toggle', event =>
40
+ {
41
+ let timeoutid = parseInt(element.dataset.micltimeoutid || '0', 10);
42
+ if (timeoutid > 0) {
43
+ clearTimeout(timeoutid);
44
+ delete element.dataset.micltimeoutid;
45
+ }
46
+
47
+ if ((event as ToggleEvent).oldState === 'closed') {
48
+ // The snackbar has just opened.
49
+ timeoutid = window.setTimeout(() => { element.hidePopover(); }, delay);
50
+ element.dataset.micltimeoutid = `${timeoutid}`;
51
+ }
52
+ });
53
+ }
54
+ }
55
+ };
56
+ })();
@@ -157,7 +157,7 @@ To enable built-in **form validation** for each step, use a `<form>` element as
157
157
  ```
158
158
 
159
159
  #### Step-Specific Action Buttons
160
- Action buttons can be made visible only on a specific step by using the `data-step` attribute, which specifies the step number (starting from 1). This is useful for replacing the default **Next** button with a content-specific action, like a **Submit** button on the final step.
160
+ Action buttons can be made visible only on a specific step by using the `data-step` attribute, which specifies the step number starting from the first step (step 1) or starting from the last step (step -1). This is useful for replacing the default **Next** button with a content-specific action, like a **Submit** button on the final step.
161
161
 
162
162
  In this example for a three-step stepper, the **Next** button is hidden on step 3, and the **Submit** button is shown instead:
163
163
 
@@ -112,12 +112,16 @@ export default (() =>
112
112
 
113
113
  const showHideElements = (stepper: HTMLElement, step: HTMLElement): void =>
114
114
  {
115
+ const nrsteps = stepper.querySelectorAll(STEP_SELECTOR).length;
115
116
  const selectedStep = getStepNumber(stepper, step);
116
117
 
117
118
  stepper.querySelectorAll<HTMLElement>('[data-step]').forEach(element =>
118
119
  {
119
- const shouldHide = element.dataset.step != `${selectedStep}`;
120
- element.classList.toggle('micl-hidden', shouldHide);
120
+ const stepnr = parseInt(element.dataset.step || '0', 10);
121
+ element.classList.toggle(
122
+ 'micl-hidden',
123
+ stepnr > 0 ? stepnr != selectedStep : nrsteps + stepnr + 1 != selectedStep
124
+ );
121
125
  });
122
126
  };
123
127
 
@@ -51,7 +51,7 @@
51
51
  width: fit-content;
52
52
  padding-inline: 4px;
53
53
  margin-block-start: calc((var(--md-sys-textfield-height) - var(--md-sys-typescale-body-large-line-height)) / 2);
54
- margin-inline-start: 12px;
54
+ margin-inline: 12px 4px;
55
55
  border-radius: 4px;
56
56
  background-color: inherit;
57
57
  color: var(--md-sys-color-on-surface-variant);
@@ -0,0 +1,5 @@
1
+ export declare const snackbarSelector = ".micl-snackbar";
2
+ declare const _default: {
3
+ initialize: (element: HTMLElement) => void;
4
+ };
5
+ export default _default;