material-inspired-component-library 2.0.0 → 2.0.1
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/CODE_OF_CONDUCT.md +128 -0
- package/components/badge/README.md +5 -5
- package/components/badge/index.scss +20 -27
- package/components/bottomsheet/README.md +29 -17
- package/components/bottomsheet/index.scss +23 -23
- package/components/bottomsheet/index.ts +25 -24
- package/components/button/README.md +1 -1
- package/components/dialog/README.md +9 -9
- package/components/navigationrail/README.md +6 -6
- package/components/sidesheet/README.md +32 -17
- package/components/sidesheet/index.scss +43 -47
- package/components/slider/README.md +5 -5
- package/dist/badge.css +1 -1
- package/dist/bottomsheet.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/sidesheet.css +1 -1
- package/docs/bottomsheet.html +58 -7
- package/docs/button.html +25 -25
- package/docs/index.html +5 -5
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/navigationrail.html +2 -2
- package/docs/sidesheet.html +22 -7
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
micl.hermana@proton.me.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
|
@@ -4,12 +4,12 @@ This component implements the the [Material Design 3 Expressive Badge](https://m
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
6
6
|
### HTML
|
|
7
|
-
To add a large badge, use a `<span>` element with the `micl-badge
|
|
7
|
+
To add a large badge, use a `<span>` element with the `micl-badge` class and add a short text inside. For a small badge, which is a simple dot, add the `micl-badge--small` class and leave the element empty.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
|
-
<span class="micl-badge
|
|
10
|
+
<span class="micl-badge">57</span>
|
|
11
11
|
|
|
12
|
-
<span class="micl-badge-small"></span>
|
|
12
|
+
<span class="micl-badge micl-badge--small"></span>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### CSS
|
|
@@ -33,7 +33,7 @@ Badges are typically placed on top of other elements, like icons. To anchor a ba
|
|
|
33
33
|
|
|
34
34
|
```HTML
|
|
35
35
|
<span class="material-symbols-outlined" style="anchor-name:--inbox">inbox</span>
|
|
36
|
-
<span class="micl-badge
|
|
36
|
+
<span class="micl-badge" style="position-anchor:--inbox">57</span>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
You can fine-tune the badge's position relative to its anchor using the following CSS variables:
|
|
@@ -57,7 +57,7 @@ You can customize the appearance of the Badge component by overriding its global
|
|
|
57
57
|
|
|
58
58
|
```HTML
|
|
59
59
|
<div style="--md-sys-badge-small-size:8px">
|
|
60
|
-
<span class="micl-badge-small"></span>
|
|
60
|
+
<span class="micl-badge micl-badge--small"></span>
|
|
61
61
|
</div>
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -27,42 +27,35 @@
|
|
|
27
27
|
--md-sys-badge-large-padding: 4px;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.micl-badge
|
|
30
|
+
.micl-badge {
|
|
31
31
|
--md-sys-badge-inline-offset: 0px;
|
|
32
32
|
--md-sys-badge-block-offset: 0px;
|
|
33
33
|
|
|
34
34
|
box-sizing: border-box;
|
|
35
35
|
position: fixed;
|
|
36
|
-
inline-size: var(--md-sys-badge-small-size);
|
|
37
|
-
block-size: var(--md-sys-badge-small-size);
|
|
38
36
|
inset: unset;
|
|
39
|
-
inset-block-start: calc(anchor(start) + var(--md-sys-badge-block-offset));
|
|
40
|
-
inset-inline-start: calc(anchor(end) - var(--md-sys-badge-small-size) - var(--md-sys-badge-inline-offset));
|
|
41
|
-
border-radius: calc(var(--md-sys-badge-small-size) / 2);
|
|
42
37
|
margin: 0;
|
|
43
|
-
padding: 0;
|
|
44
38
|
background-color: var(--md-sys-color-error);
|
|
45
39
|
color: var(--md-sys-color-on-error);
|
|
46
|
-
}
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
&.micl-badge--small {
|
|
42
|
+
inline-size: var(--md-sys-badge-small-size);
|
|
43
|
+
block-size: var(--md-sys-badge-small-size);
|
|
44
|
+
inset-block-start: calc(anchor(start) + var(--md-sys-badge-block-offset));
|
|
45
|
+
inset-inline-start: calc(anchor(end) - var(--md-sys-badge-small-size) - var(--md-sys-badge-inline-offset));
|
|
46
|
+
padding: 0;
|
|
47
|
+
border-radius: calc(var(--md-sys-badge-small-size) / 2);
|
|
48
|
+
}
|
|
49
|
+
&:not(.micl-badge--small) {
|
|
50
|
+
@include typography.label-small;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
inset-block-start: calc(anchor(start) - 2px + var(--md-sys-badge-block-offset));
|
|
62
|
-
inset-inline-start: calc(anchor(end) - 12px - var(--md-sys-badge-inline-offset));
|
|
63
|
-
margin: 0;
|
|
64
|
-
padding-inline: var(--md-sys-badge-large-padding);
|
|
65
|
-
border-radius: calc(var(--md-sys-badge-large-size) / 2);
|
|
66
|
-
background-color: var(--md-sys-color-error);
|
|
67
|
-
color: var(--md-sys-color-on-error);
|
|
52
|
+
inline-size: fit-content;
|
|
53
|
+
max-inline-size: 34px;
|
|
54
|
+
min-inline-size: var(--md-sys-badge-large-size);
|
|
55
|
+
block-size: var(--md-sys-badge-large-size);
|
|
56
|
+
inset-block-start: calc(anchor(start) - 2px + var(--md-sys-badge-block-offset));
|
|
57
|
+
inset-inline-start: calc(anchor(end) - 12px - var(--md-sys-badge-inline-offset));
|
|
58
|
+
padding-inline: var(--md-sys-badge-large-padding);
|
|
59
|
+
border-radius: calc(var(--md-sys-badge-large-size) / 2);
|
|
60
|
+
}
|
|
68
61
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Bottom sheet
|
|
2
|
-
This component implements the the [Material Design 3 Expressive Bottom sheet](https://m3.material.io/components/bottom-sheets/overview) design.
|
|
2
|
+
This component implements the the [Material Design 3 Expressive Bottom sheet](https://m3.material.io/components/bottom-sheets/overview) design. Bottom sheets show secondary content anchored to the bottom of the screen.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
6
6
|
### HTML
|
|
7
|
-
To create a standard bottom sheet, use the `<dialog>` element with the `popover` attribute.
|
|
7
|
+
To create a standard bottom sheet, use the `<dialog>` element with the `popover` attribute.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
|
-
<dialog id="mybottomsheet" class="micl-bottomsheet"
|
|
10
|
+
<dialog id="mybottomsheet" class="micl-bottomsheet" popover>
|
|
11
11
|
<div class="micl-bottomsheet__content">
|
|
12
12
|
...your content...
|
|
13
13
|
</div>
|
|
@@ -22,34 +22,50 @@ Import the bottom sheet styles into your project:
|
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
### JavaScript
|
|
25
|
-
This component requires JavaScript to support **
|
|
25
|
+
This component requires JavaScript to support **resizable** bottom sheets. The library will automatically initialize new components as they're added to the DOM.
|
|
26
26
|
|
|
27
27
|
```JavaScript
|
|
28
28
|
import micl from "material-inspired-component-library/dist/micl";
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
This will initialize any Bottom sheet component, including those that will be added to the DOM later on.
|
|
32
|
-
|
|
33
31
|
### Demo
|
|
34
32
|
A live example of the [Bottom sheet component](https://henkpb.github.io/micl/bottomsheet.html) is available for you to interact with.
|
|
35
33
|
|
|
36
34
|
## Variants
|
|
35
|
+
Setting the `popover` attribute to `manual` lets a bottom sheet co-exist and be interactive with the rest of the page.
|
|
36
|
+
|
|
37
|
+
```HTML
|
|
38
|
+
<dialog id="mybottomsheet" class="micl-bottomsheet" popover="manual">
|
|
39
|
+
<div class="micl-bottomsheet__content">
|
|
40
|
+
...your content...
|
|
41
|
+
</div>
|
|
42
|
+
</dialog>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Modal Bottom Sheet
|
|
37
46
|
A **modal** bottom sheet blocks access to the rest of the page and must be dismissed explicitly by the user. This is suitable for critical tasks or information that requires a user's full attention.
|
|
38
47
|
|
|
39
|
-
To create a modal bottom sheet, use the `<dialog>` element without the `popover` attribute.
|
|
48
|
+
To create a modal bottom sheet, use the `<dialog>` element without the `popover` attribute. Add the `closedby="any"` to allow the bottom sheet to be dismissed by a user clicking outside of it.
|
|
40
49
|
|
|
41
50
|
```HTML
|
|
42
|
-
<dialog id="mybottomsheet" class="micl-bottomsheet" closedby="
|
|
51
|
+
<dialog id="mybottomsheet" class="micl-bottomsheet" closedby="any">
|
|
43
52
|
<div class="micl-bottomsheet__content">
|
|
44
53
|
...your content...
|
|
45
54
|
</div>
|
|
46
55
|
</dialog>
|
|
47
56
|
```
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
To open or close a bottom sheet, add the markup of a button that is linked to the bottom sheet using the `popovertarget` attribute:
|
|
59
|
+
|
|
60
|
+
```HTML
|
|
61
|
+
<button type="button" popovertarget="mybottomsheet">Open Bottom Sheet</button>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Resizable Bottom Sheet
|
|
65
|
+
To create a **resizable** bottom sheet, include a heading and an optional drag-handle.
|
|
50
66
|
|
|
51
67
|
```HTML
|
|
52
|
-
<dialog id="mybottomsheet" class="micl-bottomsheet"
|
|
68
|
+
<dialog id="mybottomsheet" class="micl-bottomsheet" popover>
|
|
53
69
|
<div class="micl-bottomsheet__headline">
|
|
54
70
|
<button type="button" class="micl-bottomsheet__draghandle" aria-label="Drag handle"></button>
|
|
55
71
|
</div>
|
|
@@ -59,17 +75,13 @@ Include the bottom sheet heading (and optionally a drag-handle) to create a **re
|
|
|
59
75
|
</dialog>
|
|
60
76
|
```
|
|
61
77
|
|
|
62
|
-
The height
|
|
78
|
+
The initial height is determined by its content and capped at 50% of the screen's height. You can define specific preset heights by using the `data-miclsnapheights` attribute.
|
|
63
79
|
|
|
64
80
|
```HTML
|
|
65
|
-
<dialog data-
|
|
81
|
+
<dialog data-miclsnapheights="0,200,420" ...>
|
|
66
82
|
```
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```HTML
|
|
71
|
-
<button type="button" popovertarget="mybottomsheet">Open Bottom Sheet</button>
|
|
72
|
-
```
|
|
84
|
+
The value `0` is equivalent to closing the bottom sheet. When a user clicks the drag-handle, the bottom sheet toggles between these preset heights and its initial height. The bottom sheet will also snap to these preset heights as a user drags the heading.
|
|
73
85
|
|
|
74
86
|
## Compatibility
|
|
75
87
|
This component uses the Popover API, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API#api.htmlelement.popover) for details.
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
dialog.micl-bottomsheet {
|
|
28
28
|
--md-sys-bottomsheet-height: max-content;
|
|
29
29
|
--md-sys-bottomsheet-margin: 56px;
|
|
30
|
+
--md-sys-bottomsheet-margin-top: 72px;
|
|
30
31
|
--md-sys-bottomsheet-padding: 24px;
|
|
31
32
|
--md-sys-bottomsheet-handle-width: 32px;
|
|
32
33
|
--md-sys-bottomsheet-handle-height: 4px;
|
|
@@ -36,13 +37,12 @@ dialog.micl-bottomsheet {
|
|
|
36
37
|
|
|
37
38
|
box-sizing: border-box;
|
|
38
39
|
position: fixed;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
margin: 72px 0 0 0 ;
|
|
40
|
+
inset-block: auto 0;
|
|
41
|
+
block-size: 0;
|
|
42
|
+
max-block-size: 50vh;
|
|
43
|
+
inline-size: 100%;
|
|
44
|
+
min-inline-size: 100%;
|
|
45
|
+
margin: var(--md-sys-bottomsheet-margin-top) 0 0 0 ;
|
|
46
46
|
padding: 0;
|
|
47
47
|
border: none;
|
|
48
48
|
border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
|
|
@@ -55,26 +55,23 @@ dialog.micl-bottomsheet {
|
|
|
55
55
|
&:not(.micl-bottomsheet--resizing) {
|
|
56
56
|
transition:
|
|
57
57
|
opacity var(--md-sys-bottomsheet-motion-duration-reverse) motion.$md-sys-motion-easing-emphasized-accelerate,
|
|
58
|
-
|
|
58
|
+
block-size var(--md-sys-bottomsheet-motion-duration-reverse) var(--md-sys-bottomsheet-motion-spatial),
|
|
59
59
|
overlay var(--md-sys-bottomsheet-motion-duration-reverse) linear allow-discrete,
|
|
60
60
|
display var(--md-sys-bottomsheet-motion-duration-reverse) linear allow-discrete;
|
|
61
61
|
}
|
|
62
|
-
&.micl-bottomsheet--resizing .micl-bottomsheet__headline {
|
|
63
|
-
cursor: grabbing;
|
|
64
|
-
}
|
|
65
62
|
.micl-bottomsheet__headline {
|
|
66
63
|
box-sizing: border-box;
|
|
67
64
|
display: flex;
|
|
68
65
|
align-items: center;
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
inline-size: 100%;
|
|
67
|
+
block-size: var(--md-sys-target-size);
|
|
71
68
|
justify-content: center;
|
|
72
69
|
cursor: grab;
|
|
73
70
|
|
|
74
71
|
.micl-bottomsheet__draghandle {
|
|
75
72
|
box-sizing: content-box;
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
inline-size: var(--md-sys-bottomsheet-handle-width);
|
|
74
|
+
block-size: var(--md-sys-bottomsheet-handle-height);
|
|
78
75
|
padding: 16px calc((var(--md-sys-target-size) - var(--md-sys-bottomsheet-handle-width)) / 2);
|
|
79
76
|
border: none;
|
|
80
77
|
border-radius: var(--md-sys-shape-corner-small);
|
|
@@ -88,6 +85,9 @@ dialog.micl-bottomsheet {
|
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
}
|
|
88
|
+
&.micl-bottomsheet--resizing .micl-bottomsheet__headline {
|
|
89
|
+
cursor: grabbing;
|
|
90
|
+
}
|
|
91
91
|
|
|
92
92
|
.micl-bottomsheet__content {
|
|
93
93
|
padding: 0 var(--md-sys-bottomsheet-padding) var(--md-sys-bottomsheet-padding) var(--md-sys-bottomsheet-padding);
|
|
@@ -102,19 +102,19 @@ dialog.micl-bottomsheet {
|
|
|
102
102
|
}
|
|
103
103
|
&:popover-open,
|
|
104
104
|
&[open] {
|
|
105
|
-
|
|
106
|
-
opacity:
|
|
105
|
+
block-size: var(--md-sys-bottomsheet-height);
|
|
106
|
+
opacity: 100%;
|
|
107
107
|
// overflow-y: auto;
|
|
108
108
|
|
|
109
109
|
&:not(.micl-bottomsheet--resizing) {
|
|
110
110
|
transition:
|
|
111
111
|
opacity var(--md-sys-bottomsheet-motion-duration) motion.$md-sys-motion-easing-emphasized-decelerate,
|
|
112
|
-
|
|
112
|
+
block-size var(--md-sys-bottomsheet-motion-duration) var(--md-sys-bottomsheet-motion-spatial),
|
|
113
113
|
overlay var(--md-sys-bottomsheet-motion-duration) linear allow-discrete,
|
|
114
114
|
display var(--md-sys-bottomsheet-motion-duration) linear allow-discrete;
|
|
115
115
|
}
|
|
116
116
|
@starting-style {
|
|
117
|
-
|
|
117
|
+
block-size: 0;
|
|
118
118
|
opacity: 0;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -129,11 +129,11 @@ dialog.micl-bottomsheet {
|
|
|
129
129
|
|
|
130
130
|
@media (min-width: 641px) {
|
|
131
131
|
dialog.micl-bottomsheet {
|
|
132
|
-
|
|
133
|
-
max-
|
|
134
|
-
min-
|
|
132
|
+
inline-size: min(100vw - (2 * var(--md-sys-bottomsheet-margin)), 640px);
|
|
133
|
+
max-inline-size: 640px;
|
|
134
|
+
min-inline-size: min(100vw - (2 * var(--md-sys-bottomsheet-margin)), 640px);
|
|
135
135
|
inset-inline-start: calc(((100vw - min(100vw - (2 * var(--md-sys-bottomsheet-margin)), 640px)) / 2) - var(--md-sys-bottomsheet-margin));
|
|
136
136
|
margin: var(--md-sys-bottomsheet-margin);
|
|
137
|
-
margin-
|
|
137
|
+
margin-block-end: 0;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -23,19 +23,19 @@ export const bottomsheetSelector = 'dialog.micl-bottomsheet';
|
|
|
23
23
|
|
|
24
24
|
export default (() =>
|
|
25
25
|
{
|
|
26
|
-
var fitHeight = 0;
|
|
27
|
-
|
|
28
26
|
const getSnapHeights = (dialog: HTMLDialogElement): number[] =>
|
|
29
27
|
{
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
let fitHeight = parseInt(dialog.dataset.miclfitheight || '0', 10),
|
|
29
|
+
maxHeight = parseInt(window.getComputedStyle(dialog).getPropertyValue('max-block-size'), 10),
|
|
30
|
+
snapHeights = (dialog.dataset.miclsnapheights || '').split(',').map(Number).filter(
|
|
31
|
+
n => !isNaN(n) && (n >= 0) && (n <= maxHeight)
|
|
33
32
|
);
|
|
34
33
|
|
|
35
|
-
if (
|
|
36
|
-
fitHeight = dialog.getBoundingClientRect().height;
|
|
34
|
+
if (fitHeight < 1) {
|
|
35
|
+
fitHeight = Math.min(dialog.getBoundingClientRect().height, maxHeight);
|
|
36
|
+
dialog.dataset.miclfitheight = `${fitHeight}`;
|
|
37
37
|
}
|
|
38
|
-
return [...new Set(snapHeights.concat([fitHeight
|
|
38
|
+
return [...new Set(snapHeights.concat([fitHeight]).sort())];
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const getNextSnapHeight = (dialog: HTMLDialogElement, isResizing: boolean): number =>
|
|
@@ -58,14 +58,21 @@ export default (() =>
|
|
|
58
58
|
|
|
59
59
|
const setHeight = (dialog: HTMLDialogElement, value: number): void =>
|
|
60
60
|
{
|
|
61
|
-
|
|
61
|
+
if (value < 1) {
|
|
62
|
+
delete dialog.dataset.miclfitheight;
|
|
63
|
+
dialog.style.removeProperty('--md-sys-bottomsheet-height');
|
|
64
|
+
dialog[!dialog.popover ? 'close' : 'hidePopover']();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
dialog.style.setProperty('--md-sys-bottomsheet-height', `${value}px`);
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
return {
|
|
65
72
|
initialize: (element: HTMLDialogElement) =>
|
|
66
73
|
{
|
|
67
74
|
if (
|
|
68
|
-
!element.matches(
|
|
75
|
+
!element.matches(bottomsheetSelector)
|
|
69
76
|
|| element.dataset.miclinitialized
|
|
70
77
|
) {
|
|
71
78
|
return;
|
|
@@ -80,10 +87,7 @@ export default (() =>
|
|
|
80
87
|
|
|
81
88
|
draghandle?.addEventListener('click', () =>
|
|
82
89
|
{
|
|
83
|
-
|
|
84
|
-
if (nextSnapHeight > 4) {
|
|
85
|
-
setHeight(element, nextSnapHeight);
|
|
86
|
-
}
|
|
90
|
+
setHeight(element, getNextSnapHeight(element, false));
|
|
87
91
|
});
|
|
88
92
|
|
|
89
93
|
let isPreparing = false,
|
|
@@ -126,16 +130,11 @@ export default (() =>
|
|
|
126
130
|
if (currentMouseY < initialMouseY) {
|
|
127
131
|
setHeight(element, getNextSnapHeight(element, true));
|
|
128
132
|
}
|
|
133
|
+
else if (element.getBoundingClientRect().height < 48) {
|
|
134
|
+
setHeight(element, 0);
|
|
135
|
+
}
|
|
129
136
|
else {
|
|
130
|
-
|
|
131
|
-
if (!!element.popover) {
|
|
132
|
-
element.hidePopover();
|
|
133
|
-
}
|
|
134
|
-
setHeight(element, initialHeight);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
setHeight(element, getPreviousSnapHeight(element));
|
|
138
|
-
}
|
|
137
|
+
setHeight(element, getPreviousSnapHeight(element));
|
|
139
138
|
}
|
|
140
139
|
document.removeEventListener('mousemove', onMouseMove);
|
|
141
140
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -144,8 +143,10 @@ export default (() =>
|
|
|
144
143
|
},
|
|
145
144
|
cleanup: (element: HTMLDialogElement) =>
|
|
146
145
|
{
|
|
147
|
-
if (element.matches(
|
|
146
|
+
if (element.matches(bottomsheetSelector)) {
|
|
147
|
+
element.classList.remove('micl-bottomsheet--resizing');
|
|
148
148
|
delete element.dataset.miclinitialized;
|
|
149
|
+
delete element.dataset.miclfitheight;
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
};
|
|
@@ -66,7 +66,7 @@ To add a leading icon to a button, include an element with the `micl-button__ico
|
|
|
66
66
|
|
|
67
67
|
```HTML
|
|
68
68
|
<button type="button" class="micl-button-filled-m">
|
|
69
|
-
<span class="micl-button__icon material-symbols-outlined">save</span>
|
|
69
|
+
<span class="micl-button__icon material-symbols-outlined" aria-hidden="true">save</span>
|
|
70
70
|
Save
|
|
71
71
|
</button>
|
|
72
72
|
```
|
|
@@ -7,10 +7,10 @@ This component implements the the [Material Design 3 Expressive Dialog](https://
|
|
|
7
7
|
To create a basic dialog, use the `<dialog>` element with the `micl-dialog` class. You can open and close the dialog using JavaScript, or you can use a control element, such as a button, to open and close the dialog.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
|
-
<dialog id="mydialog" class="micl-dialog" closedby="any" popover>
|
|
10
|
+
<dialog id="mydialog" class="micl-dialog" closedby="any" popover aria-labelledby="mytitle" aria-describedby="mydesc">
|
|
11
11
|
<div class="micl-dialog__headline">
|
|
12
|
-
<h2>Basic dialog</h2>
|
|
13
|
-
<span class="micl-dialog__supporting-text">An example of a basic dialog</span>
|
|
12
|
+
<h2 id="mytitle">Basic dialog</h2>
|
|
13
|
+
<span id="mydesc" class="micl-dialog__supporting-text">An example of a basic dialog</span>
|
|
14
14
|
</div>
|
|
15
15
|
</dialog>
|
|
16
16
|
|
|
@@ -40,11 +40,11 @@ When dialogs with the `popover` attribute are opened, they animate from the cont
|
|
|
40
40
|
Removing the `popover` attribute creates a more intrusive **modal** dialog. This type of dialog requires the user to interact with its buttons or press the <kbd>Esc</kbd> key to close it.
|
|
41
41
|
|
|
42
42
|
```HTML
|
|
43
|
-
<dialog id="mydialog" class="micl-dialog" closedby="closerequest">
|
|
43
|
+
<dialog id="mydialog" class="micl-dialog" closedby="closerequest" aria-labelledby="mytitle" aria-describedby="mydesc">
|
|
44
44
|
<div class="micl-dialog__headline">
|
|
45
45
|
<span class="micl-dialog__icon material-symbols-outlined" aria-hidden="true">info</span>
|
|
46
|
-
<h2>Modal dialog</h2>
|
|
47
|
-
<span class="micl-dialog__supporting-text">An example of a modal dialog</span>
|
|
46
|
+
<h2 id="mytitle">Modal dialog</h2>
|
|
47
|
+
<span id="mydesc" class="micl-dialog__supporting-text">An example of a modal dialog</span>
|
|
48
48
|
</div>
|
|
49
49
|
<div class="micl-dialog__actions">
|
|
50
50
|
<form method="dialog">
|
|
@@ -90,15 +90,15 @@ A dialog typically consists of three main sections to organize its content:
|
|
|
90
90
|
A full-screen dialog covers the entire viewport, primarily on smaller screens. On screens wider than 560 pixels, a full-screen dialog behaves like a basic dialog. Use the `micl-dialog-fullscreen` class for this variant:
|
|
91
91
|
|
|
92
92
|
```HTML
|
|
93
|
-
<dialog id="mydialog" class="micl-dialog-fullscreen" closedby="none" popover>
|
|
93
|
+
<dialog id="mydialog" class="micl-dialog-fullscreen" closedby="none" popover aria-labelledby="mytitle" aria-describedby="mydesc">
|
|
94
94
|
<form method="dialog" class="micl-dialog__headline">
|
|
95
95
|
<button type="button" class="micl-iconbutton-s material-symbols-outlined" popovertarget="mydialog" aria-label="Close">close</button>
|
|
96
96
|
<span class="micl-dialog__icon material-symbols-outlined" aria-hidden="true">person</span>
|
|
97
|
-
<h2>Full-screen dialog</h2>
|
|
97
|
+
<h2 id="mytitle">Full-screen dialog</h2>
|
|
98
98
|
<button class="micl-button" value="dosave">Save</button>
|
|
99
99
|
</form>
|
|
100
100
|
<div class="micl-dialog__content">
|
|
101
|
-
<span class="micl-dialog__supporting-text">This dialog covers the whole screen.</span>
|
|
101
|
+
<span id="mydesc" class="micl-dialog__supporting-text">This dialog covers the whole screen.</span>
|
|
102
102
|
</div>
|
|
103
103
|
<form method="dialog" class="micl-dialog__actions">
|
|
104
104
|
<button type="button" class="micl-button" popovertarget="mydialog">Cancel</button>
|
|
@@ -82,12 +82,12 @@ Add the `popover` attribute to the navigation rail, and the `popovertarget` attr
|
|
|
82
82
|
</div>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
[!WARNING]
|
|
86
|
-
The **popover** navigation rail component adds CSS rules to the `<body>` element to properly resize the main content area when the navigation rail is collapsed. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
> [!WARNING]
|
|
86
|
+
> The **popover** navigation rail component adds CSS rules to the `<body>` element to properly resize the main content area when the navigation rail is collapsed. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
|
|
87
|
+
>
|
|
88
|
+
> ```CSS
|
|
89
|
+
> margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
|
|
90
|
+
> ```
|
|
91
91
|
|
|
92
92
|
### Modal navigation rail
|
|
93
93
|
|