@shortfuse/materialdesignweb 0.4.0 → 0.5.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.
Files changed (184) hide show
  1. package/.browserslistrc +2 -1
  2. package/.eslintrc.json +59 -8
  3. package/.stylelintrc.json +94 -49
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +1 -3
  6. package/adapters/datatable/column.js +27 -54
  7. package/adapters/datatable/index.js +69 -81
  8. package/adapters/dom/index.js +32 -47
  9. package/adapters/search/index.js +107 -133
  10. package/components/appbar/_spec.scss +77 -137
  11. package/components/banner/_spec.scss +28 -63
  12. package/components/bottomnav/_spec.scss +46 -54
  13. package/components/bottomnav/index.js +15 -20
  14. package/components/bottomnav/item.js +4 -5
  15. package/components/button/README.md +1 -1
  16. package/components/button/_spec.scss +43 -42
  17. package/components/button/_theme.scss +27 -50
  18. package/components/card/_spec.scss +61 -69
  19. package/components/chip/_spec.scss +21 -44
  20. package/components/chip/_theme.scss +79 -151
  21. package/components/chip/index.js +6 -4
  22. package/components/datatable/_spec.scss +36 -99
  23. package/components/datatable/_theme.scss +98 -124
  24. package/components/datatable/cell.js +1 -2
  25. package/components/datatable/columnheader.js +1 -2
  26. package/components/datatable/index.js +33 -47
  27. package/components/datatable/row.js +4 -5
  28. package/components/dialog/_spec.scss +53 -63
  29. package/components/dialog/_theme.scss +7 -0
  30. package/components/dialog/index.js +62 -88
  31. package/components/divider/_spec.scss +6 -8
  32. package/components/elevation/_spec.scss +1 -1
  33. package/components/fab/_spec.scss +30 -42
  34. package/components/fab/index.js +4 -8
  35. package/components/grid/_spec.scss +68 -211
  36. package/components/layout/_mixins.scss +0 -22
  37. package/components/layout/_spec.scss +267 -363
  38. package/components/layout/_theme.scss +10 -35
  39. package/components/layout/index.js +40 -50
  40. package/components/list/_spec.scss +57 -91
  41. package/components/list/_theme.scss +75 -84
  42. package/components/list/content.js +9 -13
  43. package/components/list/index.js +34 -38
  44. package/components/list/item.js +8 -11
  45. package/components/list/secondary.js +8 -9
  46. package/components/menu/_spec.scss +134 -167
  47. package/components/menu/index.js +45 -61
  48. package/components/menu/item.js +11 -19
  49. package/components/progress/_spec.scss +43 -34
  50. package/components/selection/_spec.scss +123 -133
  51. package/components/selection/_theme.scss +88 -120
  52. package/components/selection/index.js +9 -15
  53. package/components/selection/input.js +3 -5
  54. package/components/selection/radiogroup.js +8 -15
  55. package/components/slider/_spec.scss +23 -28
  56. package/components/snackbar/_spec.scss +17 -62
  57. package/components/snackbar/index.js +15 -21
  58. package/components/tab/_spec.scss +35 -50
  59. package/components/tab/content.js +33 -28
  60. package/components/tab/index.js +30 -33
  61. package/components/tab/item.js +4 -5
  62. package/components/tab/list.js +22 -36
  63. package/components/textfield/README.md +2 -2
  64. package/components/textfield/_spec.scss +241 -287
  65. package/components/textfield/_theme.scss +197 -232
  66. package/components/textfield/index.js +8 -16
  67. package/components/tooltip/_spec.scss +23 -26
  68. package/components/type/_spec.scss +19 -16
  69. package/core/_breakpoint.scss +33 -33
  70. package/core/_elevation.scss +40 -0
  71. package/core/_length.scss +0 -1
  72. package/core/_platform.scss +0 -22
  73. package/core/_type.scss +7 -6
  74. package/core/aria/button.js +4 -5
  75. package/core/aria/keyboard.js +1 -2
  76. package/core/aria/rovingtabindex.js +14 -17
  77. package/core/aria/tab.js +1 -2
  78. package/core/dom.js +18 -109
  79. package/core/overlay/_spec.scss +5 -8
  80. package/core/overlay/_theme.scss +126 -150
  81. package/core/overlay/index.js +19 -32
  82. package/core/ripple/_spec.scss +16 -17
  83. package/core/ripple/_theme.scss +13 -33
  84. package/core/ripple/index.js +36 -44
  85. package/core/theme/_aliases.scss +15 -0
  86. package/core/theme/_config.scss +8 -2
  87. package/core/theme/_functions.scss +22 -0
  88. package/core/theme/_palettes.scss +0 -1
  89. package/core/{color → theme}/_spec.scss +0 -0
  90. package/core/theme/_theme.scss +268 -0
  91. package/core/theme/index.scss +4 -0
  92. package/core/transition/index.js +73 -76
  93. package/docs/_flex.scss +7 -1
  94. package/docs/_menuoptions.js +2 -2
  95. package/docs/_partials/_appbar.eta +12 -14
  96. package/docs/_partials/_header.eta +41 -44
  97. package/docs/_sample-utils.js +15 -20
  98. package/docs/docs.scss +123 -87
  99. package/docs/framework.scss +26 -0
  100. package/docs/index.eta +2 -6
  101. package/docs/index.js +7 -0
  102. package/docs/pages/appbar.eta +22 -28
  103. package/docs/pages/bottomnav.js +17 -14
  104. package/docs/pages/button.js +10 -10
  105. package/docs/pages/card.js +20 -22
  106. package/docs/pages/chip.js +11 -13
  107. package/docs/pages/color.js +35 -36
  108. package/docs/pages/datatable.js +11 -15
  109. package/docs/pages/dialog.eta +9 -11
  110. package/docs/pages/dialog.js +6 -9
  111. package/docs/pages/dom.js +6 -9
  112. package/docs/pages/elevation.eta +10 -10
  113. package/docs/pages/fab.js +2 -3
  114. package/docs/pages/grid.js +5 -5
  115. package/docs/pages/list.js +1 -2
  116. package/docs/pages/menu.eta +17 -19
  117. package/docs/pages/menu.js +7 -11
  118. package/docs/pages/overlay.js +1 -2
  119. package/docs/pages/progress.eta +2 -2
  120. package/docs/pages/progress.js +1 -1
  121. package/docs/pages/ripple.js +1 -2
  122. package/docs/pages/search.eta +20 -24
  123. package/docs/pages/search.js +24 -41
  124. package/docs/pages/selection.eta +2 -6
  125. package/docs/pages/selection.js +3 -4
  126. package/docs/pages/snackbar.js +3 -4
  127. package/docs/pages/tab.eta +61 -75
  128. package/docs/pages/tab.js +16 -15
  129. package/docs/pages/textfield.eta +9 -8
  130. package/docs/pages/textfield.js +26 -23
  131. package/docs/pages/tooltip.eta +10 -12
  132. package/docs/pages/transition.js +5 -7
  133. package/docs/postrender.js +7 -5
  134. package/docs/pwa/pwa.eta +14 -16
  135. package/docs/pwa/pwa.js +19 -27
  136. package/docs/pwa/pwa.scss +12 -7
  137. package/docs/themes/theme-colored.scss +9 -11
  138. package/docs/themes/theme-default.scss +0 -14
  139. package/index.scss +27 -0
  140. package/jsconfig.json +7 -3
  141. package/package.json +26 -15
  142. package/tsconfig.json +16 -0
  143. package/{webpack.config.cjs → webpack.config.js} +105 -58
  144. package/components/template/_theme.scss +0 -27
  145. package/components/textfield/_mixins.scss +0 -52
  146. package/core/color/_theme.scss +0 -390
  147. package/core/color/index.scss +0 -2
  148. package/core/theme/_mixins.scss +0 -172
  149. package/core/theme/_variables.scss +0 -24
  150. package/docs/_mixins.pug +0 -155
  151. package/docs/pages/appbar.pug +0 -78
  152. package/docs/pages/bottomnav.pug +0 -137
  153. package/docs/pages/button.pug +0 -121
  154. package/docs/pages/card.pug +0 -74
  155. package/docs/pages/chip.pug +0 -91
  156. package/docs/pages/color.pug +0 -121
  157. package/docs/pages/datatable.pug +0 -283
  158. package/docs/pages/dialog.pug +0 -132
  159. package/docs/pages/dom.pug +0 -22
  160. package/docs/pages/elevation.pug +0 -25
  161. package/docs/pages/fab.pug +0 -66
  162. package/docs/pages/grid.pug +0 -95
  163. package/docs/pages/layout.pug +0 -7
  164. package/docs/pages/list.pug +0 -326
  165. package/docs/pages/menu.pug +0 -205
  166. package/docs/pages/overlay.pug +0 -55
  167. package/docs/pages/progress.pug +0 -16
  168. package/docs/pages/ripple.pug +0 -21
  169. package/docs/pages/search.pug +0 -165
  170. package/docs/pages/selection.pug +0 -74
  171. package/docs/pages/slider.pug +0 -17
  172. package/docs/pages/snackbar.pug +0 -60
  173. package/docs/pages/tab.pug +0 -304
  174. package/docs/pages/textfield.pug +0 -360
  175. package/docs/pages/tooltip.pug +0 -78
  176. package/docs/pages/transition.pug +0 -76
  177. package/docs/pages/type.pug +0 -29
  178. package/docs/pwa/_dialogs.pug +0 -96
  179. package/docs/pwa/_menus.pug +0 -11
  180. package/docs/pwa/pwa.pug +0 -325
  181. package/docs/spec.scss +0 -26
  182. package/docs/themes/_component-themes.scss +0 -26
  183. package/docs/themes/theme-colored-fallbacks.scss +0 -17
  184. package/docs/themes/theme-default-fallbacks.scss +0 -17
@@ -5,15 +5,13 @@
5
5
  @use '../../core/_platform.scss' as platform;
6
6
  @use '../../core/_type.scss' as type;
7
7
 
8
-
9
8
  // Guidelines state background is #616161, which is Gray 700
10
9
 
11
- $desktop-margin: dp(14) !default;
12
- $mobile-margin: dp(24) !default;
10
+ $desktop-margin: 14px !default;
11
+ $mobile-margin: 24px !default;
13
12
  $touch-fade-out-time: 1.5s !default;
14
13
  $touch-min-hold-time: 500ms !default;
15
14
 
16
-
17
15
  .mdw-tooltip__wrapper {
18
16
  position: relative;
19
17
  overflow: visible;
@@ -33,29 +31,30 @@ $touch-min-hold-time: 500ms !default;
33
31
 
34
32
  position: absolute;
35
33
 
36
- top: 100%;
37
- left: 50%;
34
+ inset-block-start: 100%;
35
+ inset-inline-start: 50%;
38
36
  align-items: center;
39
37
  flex-direction: column;
40
38
  justify-content: center;
41
39
 
42
- width: auto;
43
- padding: dp(6) dp(8);
44
-
40
+ inline-size: auto;
41
+ padding: 6px 8px;
42
+
43
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
45
44
  cursor: none;
46
-
45
+ pointer-events: none;
46
+
47
47
  transition-duration: motion.$fadeOutDuration;
48
48
  transition-property: opacity;
49
49
  transition-timing-function: motion.$accelerateEasing;
50
-
50
+
51
51
  opacity: 0;
52
- pointer-events: none;
53
52
  // Default Alignment is Center
54
-
53
+
55
54
  transform: translateX(-50%) translateY($desktop-margin);
56
55
  z-index: 8;
57
56
 
58
- border-radius: dp(4);
57
+ border-radius: 4px;
59
58
 
60
59
  line-height: 1;
61
60
  white-space: nowrap;
@@ -66,20 +65,18 @@ $touch-min-hold-time: 500ms !default;
66
65
  .mdw-tooltip__wrapper > .mdw-tooltip__target:not([tabindex="-1"]):focus ~ & {
67
66
  transition-duration: motion.$fadeInDuration;
68
67
  transition-timing-function: motion.$accelerateEasing;
69
-
68
+
70
69
  opacity: 0.9;
71
70
  }
72
71
 
73
72
  &[mdw-align="start"],
74
73
  :root[dir="rtl"] &[mdw-align="end"] {
75
- right: auto;
76
- left: 0;
74
+ inset-inline: 0 auto;
77
75
  }
78
76
 
79
77
  &[mdw-align="end"],
80
78
  :root[dir="rtl"] &[mdw-align="start"] {
81
- right: 0;
82
- left: auto;
79
+ inset-inline: auto 0;
83
80
  }
84
81
 
85
82
  &[mdw-align="start"],
@@ -91,8 +88,8 @@ $touch-min-hold-time: 500ms !default;
91
88
  &[mdw-position="end"],
92
89
  &[mdw-position="left"],
93
90
  &[mdw-position="right"] {
94
- top: 50%;
95
- left: 0;
91
+ inset-block-start: 50%;
92
+ inset-inline-start: 0;
96
93
  }
97
94
 
98
95
  &[mdw-position="start"],
@@ -110,7 +107,7 @@ $touch-min-hold-time: 500ms !default;
110
107
  }
111
108
 
112
109
  &[mdw-position="top"] {
113
- top: 0;
110
+ inset-block-start: 0;
114
111
 
115
112
  transform: translateX(-50%) translateY(-100%) translateY(-$desktop-margin);
116
113
 
@@ -119,18 +116,18 @@ $touch-min-hold-time: 500ms !default;
119
116
  transform: translateY(-100%) translateY(-$desktop-margin);
120
117
  }
121
118
  }
122
-
119
+
123
120
  }
124
121
 
125
122
  // Button position fix
126
123
  .mdw-tooltip__wrapper > .mdw-button[mdw-icon] ~ .mdw-tooltip {
127
124
  &:not([mdw-position]) {
128
125
  // Bottom
129
- margin-top: dp(-8);
126
+ margin-block-start: -8px;
130
127
  }
131
128
 
132
129
  &[mdw-position="top"] {
133
- margin-top: dp(8);
130
+ margin-block-start: 8px;
134
131
  }
135
132
  }
136
133
 
@@ -144,7 +141,7 @@ $touch-min-hold-time: 500ms !default;
144
141
 
145
142
  @include platform.ifHasTouch() {
146
143
  .mdw-tooltip {
147
- padding: dp(10) dp(16);
144
+ padding: 10px 16px;
148
145
 
149
146
  transition-delay: $touch-min-hold-time;
150
147
 
@@ -7,7 +7,6 @@
7
7
  // 4 dp/sp baselines
8
8
  $baselines: (4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64) !default;
9
9
 
10
-
11
10
  h1.mdw-type,
12
11
  h2.mdw-type,
13
12
  h3.mdw-type,
@@ -21,6 +20,7 @@ p.mdw-type {
21
20
  p.mdw-type {
22
21
  -ms-hyphens: auto;
23
22
  -webkit-hyphens: auto;
23
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
24
24
  hyphens: auto;
25
25
  }
26
26
 
@@ -86,7 +86,6 @@ p.mdw-type,
86
86
 
87
87
  // MD-2014 Typography
88
88
 
89
-
90
89
  .mdw-type[mdw-style|="display"] {
91
90
  font-weight: type.$weightRegular;
92
91
  font-size: sp(34);
@@ -140,53 +139,57 @@ p.mdw-type,
140
139
  }
141
140
 
142
141
  .mdw-type[mdw-texttop-top]::before {
143
- display: inline-block;
144
142
  content: '';
145
143
 
146
- height: 1em;
144
+ display: inline-block;
145
+
146
+ block-size: 1em;
147
147
  }
148
148
 
149
149
  .mdw-type[mdw-baseline-top]::before {
150
- display: inline-block;
151
150
  content: '';
151
+
152
+ display: inline-block;
152
153
  }
153
154
 
154
155
  .mdw-type[mdw-baseline-next],
155
156
  .mdw-type[mdw-baseline-bottom] {
156
157
  &::after {
157
- display: inline-block;
158
158
  content: '';
159
159
 
160
- min-height: dp(1); // Safari workaround
160
+ display: inline-block;
161
+
162
+ min-block-size: 1px; // Safari workaround
161
163
  }
162
164
  }
163
165
 
164
166
  .mdw-type[mdw-baseline-next] {
165
167
  & + .mdw-type::before {
166
- display: inline-block;
167
168
  content: '';
169
+
170
+ display: inline-block;
168
171
  }
169
172
  }
170
173
 
171
174
  @each $bl in $baselines {
172
175
  .mdw-type[mdw-texttop-top="#{$bl}dp"] {
173
176
  &::before {
174
- margin-top: dp($bl);
177
+ margin-block-start: dp($bl);
175
178
  }
176
179
  }
177
180
  .mdw-type[mdw-texttop-top="#{$bl}"] {
178
181
  &::before {
179
- margin-top: sp($bl);
182
+ margin-block-start: sp($bl);
180
183
  }
181
184
  }
182
185
  .mdw-type[mdw-baseline-top="#{$bl}dp"] {
183
186
  &::before {
184
- height: dp($bl);
187
+ block-size: dp($bl);
185
188
  }
186
189
  }
187
190
  .mdw-type[mdw-baseline-top="#{$bl}"] {
188
191
  &::before {
189
- height: sp($bl);
192
+ block-size: sp($bl);
190
193
  }
191
194
  }
192
195
  .mdw-type[mdw-baseline-bottom="#{$bl}dp"] {
@@ -200,25 +203,25 @@ p.mdw-type,
200
203
  }
201
204
  }
202
205
  .mdw-type[mdw-baseline-next="#{$bl}dp"] {
203
- margin-bottom: dp(-$bl);
206
+ margin-block-end: dp(-$bl);
204
207
 
205
208
  &::after {
206
209
  vertical-align: dp(-$bl);
207
210
  }
208
211
 
209
212
  & + .mdw-type::before {
210
- height: dp($bl);
213
+ block-size: dp($bl);
211
214
  }
212
215
  }
213
216
  .mdw-type[mdw-baseline-next="#{$bl}"] {
214
- margin-bottom: sp(-$bl);
217
+ margin-block-end: sp(-$bl);
215
218
 
216
219
  &::after {
217
220
  vertical-align: sp(-$bl);
218
221
  }
219
222
 
220
223
  & + .mdw-type::before {
221
- height: sp($bl);
224
+ block-size: sp($bl);
222
225
  }
223
226
  }
224
227
  }
@@ -2,29 +2,29 @@
2
2
 
3
3
  @use "./_length.scss" as *;
4
4
 
5
- $portraitSmallHandset: dp(0) !default;
6
- $portraitMediumHandset: dp(360) !default;
7
- $portraitLargeHandset: dp(400) !default;
8
- $portraitSmallTablet: dp(600) !default;
9
- $portraitLargeTablet: dp(720) !default;
10
- $portraitDesktop: dp(960) !default;
11
-
12
- $landscapeSmallHandset: dp(480) !default;
13
- $landscapeMediumHandset: dp(600) !default;
14
- $landscapeLargeHandset: dp(720) !default;
15
- $landscapeSmallTablet: dp(960) !default;
16
- $landscapeLargeTablet: dp(1024) !default;
17
- $landscapeDesktop: dp(1440) !default;
18
-
19
- $windowXSmall: dp(0) !default;
20
- $windowSmall: dp(600) !default;
21
- $windowMedium: dp(1024) !default;
22
- $windowLarge: dp(1440) !default;
23
- $windowXLarge: dp(1920) !default;
24
-
25
- $columns4: dp(0) !default;
26
- $columns8: dp(600) !default;
27
- $columns12: dp(840) !default;
5
+ $portraitSmallHandset: 0 !default;
6
+ $portraitMediumHandset: 360px !default;
7
+ $portraitLargeHandset: 400px !default;
8
+ $portraitSmallTablet: 600px !default;
9
+ $portraitLargeTablet: 720px !default;
10
+ $portraitDesktop: 960px !default;
11
+
12
+ $landscapeSmallHandset: 480px !default;
13
+ $landscapeMediumHandset: 600px !default;
14
+ $landscapeLargeHandset: 720px !default;
15
+ $landscapeSmallTablet: 960px !default;
16
+ $landscapeLargeTablet: 1024px !default;
17
+ $landscapeDesktop: 1440px !default;
18
+
19
+ $windowXSmall: 0 !default;
20
+ $windowSmall: 600px !default;
21
+ $windowMedium: 1024px !default;
22
+ $windowLarge: 1440px !default;
23
+ $windowXLarge: 1920px !default;
24
+
25
+ $columns4: 0 !default;
26
+ $columns8: 600px !default;
27
+ $columns12: 840px !default;
28
28
 
29
29
  // Column-count based mixins
30
30
 
@@ -62,8 +62,8 @@ $columns12: dp(840) !default;
62
62
 
63
63
  @mixin has16DPMargin {
64
64
  @media
65
- (orientation:portrait) and (max-width: dp(599)),
66
- (orientation:landscape) and (max-height: dp(599)) {
65
+ (orientation:portrait) and (max-width: 599px),
66
+ (orientation:landscape) and (max-height: 599px) {
67
67
  @content;
68
68
  }
69
69
  }
@@ -145,13 +145,13 @@ $columns12: dp(840) !default;
145
145
 
146
146
  @mixin isMobileDevicePortrait {
147
147
  @media (max-device-width: #{$portraitSmallTablet - 1})
148
- and (max-device-aspect-ratio: 1/1) {
148
+ and (max-device-aspect-ratio: 1 / 1) {
149
149
  @content;
150
150
  }
151
151
  }
152
152
  @mixin isMobileDeviceLandscape {
153
153
  @media (max-device-width: #{$landscapeSmallTablet - 1})
154
- and (min-device-aspect-ratio: 1/1) {
154
+ and (min-device-aspect-ratio: 1 / 1) {
155
155
  @content;
156
156
  }
157
157
  }
@@ -159,9 +159,9 @@ $columns12: dp(840) !default;
159
159
  @mixin isMobileDevice {
160
160
  @media
161
161
  (max-device-width: #{$portraitSmallTablet - 1})
162
- and (max-device-aspect-ratio: 1/1),
162
+ and (max-device-aspect-ratio: 1 / 1),
163
163
  (max-device-width: #{$landscapeSmallTablet - 1})
164
- and (min-device-aspect-ratio: 1/1) {
164
+ and (min-device-aspect-ratio: 1 / 1) {
165
165
  @content;
166
166
  }
167
167
  }
@@ -170,10 +170,10 @@ $columns12: dp(840) !default;
170
170
  @media
171
171
  (min-width: $portraitSmallTablet)
172
172
  and (max-device-width: #{$portraitDesktop - 1})
173
- and (max-device-aspect-ratio: 1/1),
173
+ and (max-device-aspect-ratio: 1 / 1),
174
174
  (min-width: $landscapeSmallTablet)
175
175
  and (max-device-width: #{$landscapeDesktop - 1})
176
- and (min-device-aspect-ratio: 1/1) {
176
+ and (min-device-aspect-ratio: 1 / 1) {
177
177
  @content;
178
178
  }
179
179
  }
@@ -181,9 +181,9 @@ $columns12: dp(840) !default;
181
181
  @mixin maxTabletDevice {
182
182
  @media
183
183
  (max-device-width: #{$portraitDesktop - 1})
184
- and (max-device-aspect-ratio: 1/1),
184
+ and (max-device-aspect-ratio: 1 / 1),
185
185
  (max-device-width: #{$landscapeDesktop - 1})
186
- and (min-device-aspect-ratio: 1/1) {
186
+ and (min-device-aspect-ratio: 1 / 1) {
187
187
  @content;
188
188
  }
189
189
  }
@@ -1,3 +1,5 @@
1
+ @use 'sass:map';
2
+ @use 'sass:string';
1
3
 
2
4
  // https://material.io/archive/guidelines/resources/shadows.html#shadows-sketch
3
5
  $shadowValues: (
@@ -29,6 +31,44 @@ $filterValues: (
29
31
  24: "drop-shadow(0 22.12px 12.0px rgba(0,0,0,0.26)) drop-shadow(0 0 16.00px rgba(0,0,0,0.08))",
30
32
  ) !default;
31
33
 
34
+ // https://material.io/design/color/dark-theme.html#properties
35
+ $dark-theme-filter: (
36
+ 0: "none",
37
+ 1: "brightness(1.05)",
38
+ 2: "brightness(1.07)",
39
+ 3: "brightness(1.08)",
40
+ 4: "brightness(1.09)",
41
+ 6: "brightness(1.11)",
42
+ 8: "brightness(1.12)",
43
+ 9: "brightness(1.13)",
44
+ 12: "brightness(1.14)",
45
+ 16: "brightness(1.15)",
46
+ 24: "brightness(1.16)"
47
+ ) !default;
48
+
49
+ // https://material.io/design/color/dark-theme.html#properties
50
+ $dark-theme-opacity: (
51
+ 0: 0,
52
+ 1: 0.05,
53
+ 2: 0.07,
54
+ 3: 0.08,
55
+ 4: 0.09,
56
+ 6: 0.11,
57
+ 8: 0.12,
58
+ 9: 0.13,
59
+ 12: 0.14,
60
+ 16: 0.15,
61
+ 24: 0.16,
62
+ ) !default;
63
+
64
+ @mixin boxShadowMixin($dp) {
65
+ box-shadow: #{string.unquote(map.get($shadowValues, $dp))};
66
+
67
+ &::before {
68
+ --mdw-overlay__base-opacity: var(--mdw-overlay__base-opacity-elevation_#{$dp});
69
+ }
70
+ }
71
+
32
72
  @function boxShadow($dp) {
33
73
  @return unquote(map-get($shadowValues, $dp));
34
74
  }
package/core/_length.scss CHANGED
@@ -3,7 +3,6 @@
3
3
  @function dp($multiplier) {
4
4
  @return $multiplier * 1px;
5
5
  }
6
-
7
6
  @function sp($multiplier) {
8
7
  @return math.div($multiplier,16.0) * 1rem;
9
8
  }
@@ -10,25 +10,3 @@
10
10
  @content;
11
11
  }
12
12
  }
13
-
14
- // Browser specific mixins
15
- @mixin ifIE {
16
- @media all\0 {
17
- @content;
18
- }
19
- }
20
-
21
- @mixin ifEdge {
22
- @supports (-ms-ime-align:auto) {
23
- @content;
24
- }
25
- }
26
-
27
- @mixin ifMS {
28
- @include ifIE {
29
- @content;
30
- }
31
- @include ifEdge {
32
- @content;
33
- }
34
- }
package/core/_type.scss CHANGED
@@ -1,3 +1,4 @@
1
+ @use 'sass:map';
1
2
  @use './_length.scss' as *;
2
3
 
3
4
  $weightThin: 100 !default;
@@ -90,9 +91,9 @@ $types: (
90
91
  ) !default;
91
92
 
92
93
  @mixin addRules($type) {
93
- $rules: map-get($types, $type);
94
- @each $key in map-keys($rules) {
95
- #{$key}: map-get($rules, $key);
94
+ $rules: map.get($types, $type);
95
+ @each $key in map.keys($rules) {
96
+ #{$key}: map.get($rules, $key);
96
97
  }
97
98
  }
98
99
 
@@ -102,7 +103,7 @@ $types: (
102
103
 
103
104
  display: inline-block;
104
105
 
105
- height: dp($dp);
106
+ block-size: dp($dp);
106
107
  }
107
108
  }
108
109
 
@@ -121,7 +122,7 @@ $types: (
121
122
 
122
123
  display: inline-block;
123
124
 
124
- height: 1em;
125
- margin-top: dp($dp);
125
+ block-size: 1em;
126
+ margin-block-start: dp($dp);
126
127
  }
127
128
  }
@@ -8,8 +8,7 @@ function onKeyDown(event) {
8
8
  if (event.key !== 'Enter' && event.key !== 'Spacebar' && event.key !== ' ') {
9
9
  return;
10
10
  }
11
- /** @type {HTMLElement} */
12
- const buttonElement = (event.currentTarget);
11
+ const buttonElement = /** @type {HTMLElement} */ (event.currentTarget);
13
12
  if (!buttonElement) {
14
13
  return;
15
14
  }
@@ -29,13 +28,13 @@ function onKeyDown(event) {
29
28
  */
30
29
  export function attach(element) {
31
30
  element.setAttribute('role', 'button');
32
- if (element instanceof HTMLButtonElement === false
31
+ if (!(element instanceof HTMLButtonElement)
33
32
  && !element.hasAttribute('tabindex')) {
34
33
  element.setAttribute('tabindex', '0');
35
34
  }
36
35
  element.setAttribute('mdw-aria-button-js', '');
37
- if (element instanceof HTMLButtonElement === false
38
- && element instanceof HTMLInputElement === false) {
36
+ if (!(element instanceof HTMLButtonElement)
37
+ && !(element instanceof HTMLInputElement)) {
39
38
  element.addEventListener('keydown', onKeyDown);
40
39
  }
41
40
  }
@@ -18,8 +18,7 @@ export const ENTER_KEY = 'mdw:keyboard-enterkey';
18
18
  * @return {void}
19
19
  */
20
20
  function onKeyDownHandler(event) {
21
- /** @type {Element} */
22
- const element = (event.currentTarget);
21
+ const element = /** @type {Element} */ (event.currentTarget);
23
22
  const detail = {
24
23
  ctrlKey: event.ctrlKey,
25
24
  shiftKey: event.shiftKey,
@@ -2,8 +2,6 @@
2
2
 
3
3
  import {
4
4
  dispatchDomEvent,
5
- iterateArrayLike,
6
- iterateSomeOfArrayLike,
7
5
  } from '../dom.js';
8
6
 
9
7
  export const TABINDEX_ZEROED = 'mdw:rovingtabindex-tabindexzeroed';
@@ -13,8 +11,7 @@ export const TABINDEX_ZEROED = 'mdw:rovingtabindex-tabindexzeroed';
13
11
  * @return {void}
14
12
  */
15
13
  function onChildFocus(event) {
16
- /** @type {Element} */
17
- const child = (event.currentTarget);
14
+ const child = /** @type {Element} */ (event.currentTarget);
18
15
  if (child.getAttribute('tabindex') === '0') {
19
16
  return;
20
17
  }
@@ -23,19 +20,19 @@ function onChildFocus(event) {
23
20
  }
24
21
 
25
22
  /**
26
- * @param {ArrayLike<Element>} items
23
+ * @param {Iterable<Element>} items
27
24
  * @param {Element[]} [excludeItems]
28
25
  * @return {void}
29
26
  */
30
27
  export function removeTabIndex(items, excludeItems = []) {
31
- iterateArrayLike(items, (item) => {
32
- if (excludeItems.indexOf(item) !== -1) {
33
- return;
28
+ for (const item of items) {
29
+ if (excludeItems.includes(item)) {
30
+ continue;
34
31
  }
35
32
  if (item.hasAttribute('tabindex')) {
36
33
  item.setAttribute('tabindex', '-1');
37
34
  }
38
- });
35
+ }
39
36
  }
40
37
 
41
38
  /**
@@ -45,14 +42,14 @@ export function removeTabIndex(items, excludeItems = []) {
45
42
  function attemptFocus(element) {
46
43
  try {
47
44
  element.focus();
48
- } catch (e) {
45
+ } catch {
49
46
  // Ignore error.
50
47
  }
51
48
  return document.activeElement === element;
52
49
  }
53
50
 
54
51
  /**
55
- * @param {ArrayLike<HTMLElement>} list
52
+ * @param {Iterable<HTMLElement>} list
56
53
  * @param {Element} [current]
57
54
  * @param {boolean} [loop=true]
58
55
  * @param {boolean} [reverse]
@@ -61,7 +58,7 @@ function attemptFocus(element) {
61
58
  export function selectNext(list, current = null, loop = true, reverse = false) {
62
59
  let foundCurrent = false;
63
60
 
64
- const iterateResult = iterateSomeOfArrayLike(list, (item, index, array) => {
61
+ const iterateResult = [...list].some((item, index, array) => {
65
62
  const candidate = reverse ? (array[array.length - 1 - index]) : item;
66
63
  if (!foundCurrent) {
67
64
  if (current) {
@@ -93,7 +90,7 @@ export function selectNext(list, current = null, loop = true, reverse = false) {
93
90
  }
94
91
  return;
95
92
  }
96
- iterateSomeOfArrayLike(list, (item, index, array) => {
93
+ [...list].some((item, index, array) => {
97
94
  const candidate = reverse ? (array[array.length - 1 - index]) : item;
98
95
  if (!candidate.hasAttribute('tabindex')) {
99
96
  return false;
@@ -112,7 +109,7 @@ export function selectNext(list, current = null, loop = true, reverse = false) {
112
109
 
113
110
  /**
114
111
  * Alias for selectNext(list, current, true);
115
- * @param {ArrayLike<HTMLElement>} list
112
+ * @param {Iterable<HTMLElement>} list
116
113
  * @param {Element} [current]
117
114
  * @param {boolean} [loop=true]
118
115
  * @return {void}
@@ -141,7 +138,7 @@ export function detach(element) {
141
138
  }
142
139
 
143
140
  /**
144
- * @param {ArrayLike<Element>} items
141
+ * @param {Iterable<Element>} items
145
142
  * @param {boolean} [focusableWhenDisabled=true]
146
143
  * @return {void}
147
144
  */
@@ -152,7 +149,7 @@ export function setupTabIndexes(items, focusableWhenDisabled = true) {
152
149
  let currentTabIndexChild = null;
153
150
  /** @type {Element} */
154
151
  let firstFocusableChild = null;
155
- iterateArrayLike(items, (child) => {
152
+ for (const child of items) {
156
153
  if (!currentlyFocusedChild && document.activeElement === child) {
157
154
  currentlyFocusedChild = child;
158
155
  } else if (!currentTabIndexChild && child.getAttribute('tabindex') === '0') {
@@ -165,7 +162,7 @@ export function setupTabIndexes(items, focusableWhenDisabled = true) {
165
162
  child.setAttribute('tabindex', '-1');
166
163
  }
167
164
  attach(child);
168
- });
165
+ }
169
166
  if (currentlyFocusedChild) {
170
167
  currentlyFocusedChild.setAttribute('tabindex', '0');
171
168
  } else if (currentTabIndexChild) {
package/core/aria/tab.js CHANGED
@@ -26,8 +26,7 @@ function onKeyDown(event) {
26
26
  if (event.key !== 'Enter' && event.key !== 'Spacebar' && event.key !== ' ') {
27
27
  return;
28
28
  }
29
- /** @type {HTMLElement} */
30
- const element = (event.currentTarget);
29
+ const element = /** @type {HTMLElement} */ (event.currentTarget);
31
30
  if (!element) {
32
31
  return;
33
32
  }