@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
@@ -7,7 +7,17 @@
7
7
  @use '../../core/_platform.scss' as platform;
8
8
  @use '../../core/_type.scss' as type;
9
9
 
10
- $unit-width: dp(56) !default;
10
+ $unit-width: 56px !default;
11
+
12
+ :root {
13
+ --mdw-menu__transform-origin-inline-start: left;
14
+ --mdw-menu__transform-origin-inline-end: right;
15
+
16
+ &[dir="rtl"] {
17
+ --mdw-menu__transform-origin-inline-start: right;
18
+ --mdw-menu__transform-origin-inline-end: left;
19
+ }
20
+ }
11
21
 
12
22
  /* @deprecated */
13
23
  .mdw-menu__wrapper {
@@ -17,29 +27,30 @@ $unit-width: dp(56) !default;
17
27
 
18
28
  .mdw-menu__close {
19
29
  position: fixed;
20
- top: 0;
21
- left: 0;
30
+ inset-block: 0 auto;
31
+ inset-inline: 0 auto;
22
32
 
23
- height: 100%;
24
- width: 100%;
33
+ block-size: 100%;
34
+ inline-size: 100%;
25
35
 
26
36
  cursor: default;
27
37
 
28
38
  pointer-events: inherit;
39
+
29
40
  z-index: 8;
30
41
  }
31
42
 
32
43
  .mdw-menu {
44
+ --mdw-menu__transform-origin-x: var(--mdw-menu__transform-origin-inline-start); // Normal
45
+ --mdw-menu__transform-origin-y: top; // Down
33
46
  display: block;
34
47
  position: absolute;
35
48
 
36
49
  // Default position is bottom
37
50
  // Default direction is start
38
51
 
39
- top: 100%;
40
- right: auto;
41
- bottom: auto;
42
- left: 0;
52
+ inset-block: 100% auto;
53
+ inset-inline: auto 0;
43
54
 
44
55
  // Hide scrollbar
45
56
  -ms-overflow-style: none;
@@ -47,177 +58,104 @@ $unit-width: dp(56) !default;
47
58
  // Scroll mask
48
59
  overscroll-behavior: none;
49
60
  overscroll-behavior: contain;
50
- -ms-scroll-chaining: none;
51
61
  scrollbar-width: none;
52
62
 
63
+ pointer-events: none;
64
+
53
65
  transition-duration: motion.$fadeOutDuration;
54
66
  transition-property: none;
55
67
  transition-timing-function: motion.$decelerateEasing;
56
68
 
57
- pointer-events: none;
58
- transform-origin: left top;
69
+ transform-origin: var(--mdw-menu__transform-origin-x) var(--mdw-menu__transform-origin-y);
59
70
  // visibility: visible;
60
71
 
61
- :root[dir="rtl"] & {
62
- right: 0;
63
- left: auto;
64
-
65
- transform-origin: right top;
66
- }
67
-
68
72
  &::after {
73
+ content: '';
74
+
69
75
  display: block;
70
76
 
71
- height: 200%;
72
- width: 200%;
73
- content: '';
77
+ block-size: 200%;
78
+ inline-size: 200%;
74
79
  }
75
80
 
76
81
  &::-webkit-scrollbar {
77
82
  display: none;
78
83
  }
79
84
 
80
- &[aria-hidden="false"],
81
- &[id]:target {
82
-
83
-
84
- pointer-events: auto;
85
-
86
- .mdw-menu__popup {
87
- // Instant on desktop
88
- transition-delay: 0s;
89
- transition-duration: 0s;
90
- transition-property: box-shadow, opacity, transform;
91
- transition-timing-function: motion.$accelerateEasing;
92
-
93
- opacity: 1;
94
- transform: scale(1);
95
-
96
- visibility: visible;
97
-
98
- box-shadow: elevation.boxShadow(8);
99
- @include breakpoint.maxTabletDevice {
100
- transition-duration: motion.$expandDuration;
101
- }
102
- }
103
-
85
+ /** Vertical Position */
86
+ &[mdw-position~="top"] {
87
+ inset-block: 0 auto;
104
88
  }
105
89
 
106
- &[mdw-position~="top"] {
107
- top: 0;
90
+ &[mdw-position~="bottom"] {
91
+ inset-block: auto 0;
108
92
  }
109
93
 
110
94
  &[mdw-position~="vcenter"] {
111
- top: 50%;
95
+ inset-block: 50% auto;
112
96
  }
113
97
 
114
- &[mdw-position~="hcenter"] {
115
- left: 50%;
98
+ /** Horizontal Position */
99
+ &[mdw-position~="start"] {
100
+ inset-inline: auto 100%;
116
101
  }
117
102
 
118
- &[mdw-position~="right"],
119
103
  &[mdw-position~="end"] {
120
- right: auto;
121
- left: 100%;
122
-
123
- :root[dir="rtl"] & {
124
- right: 100%;
125
- left: auto;
126
- }
104
+ inset-inline: 100% auto;
127
105
  }
128
106
 
129
- &[mdw-direction~="reverse"],
130
- &[mdw-direction~="rtl"] {
107
+ &[mdw-position~="left"] {
108
+ /* stylelint-disable-next-line liberty/use-logical-spec */
131
109
  right: 100%;
110
+ /* stylelint-disable-next-line liberty/use-logical-spec */
132
111
  left: auto;
112
+ }
133
113
 
134
- transform-origin: right top;
135
-
136
- :root[dir="rtl"] & {
137
- right: auto;
138
- left: 100%;
139
-
140
- transform-origin: left top;
141
- }
114
+ &[mdw-position~="right"] {
115
+ /* stylelint-disable-next-line liberty/use-logical-spec */
116
+ right: auto;
117
+ left: 100%;
118
+ }
142
119
 
143
- &[mdw-position~="right"],
144
- &[mdw-position~="end"] {
145
- right: 0;
146
- left: auto;
120
+ &[mdw-position~="hcenter"] {
121
+ inset-inline: 50% auto;
122
+ }
147
123
 
148
- :root[dir="rtl"] & {
149
- right: auto;
150
- left: 0;
151
- }
152
- }
124
+ /** Vertical Direction */
125
+ &[mdw-direction~="down"] {
126
+ // --mdw-menu__transform-origin-y: top;
153
127
  }
154
128
 
155
129
  &[mdw-direction~="up"] {
156
- top: auto;
157
- bottom: 0;
158
-
159
- transform-origin: left bottom;
160
-
161
- :root[dir="rtl"] & {
162
- transform-origin: right bottom;
163
- }
130
+ --mdw-menu__transform-origin-y: bottom;
131
+ }
164
132
 
165
- &[mdw-position~="top"] {
166
- bottom: 100%;
167
- }
133
+ /** Horizontal Direction */
134
+ &[mdw-direction~="normal"] {
135
+ // --mdw-menu__transform-origin-x: var(--mdw-menu__transform-origin-inline-start);
136
+ }
168
137
 
169
- &[mdw-position~="vcenter"] {
170
- bottom: 50%;
171
- }
138
+ &[mdw-direction~="reverse"] {
139
+ --mdw-menu__transform-origin-x: var(--mdw-menu__transform-origin-inline-end);
140
+ }
172
141
 
173
- &[mdw-direction~="reverse"],
174
- &[mdw-direction~="rtl"] {
175
- transform-origin: right bottom;
142
+ &[mdw-direction~="ltr"] {
143
+ --mdw-menu__transform-origin-x: left;
144
+ }
176
145
 
177
- :root[dir="rtl"] & {
178
- transform-origin: left bottom;
179
- }
180
- }
146
+ &[mdw-direction~="rtl"] {
147
+ --mdw-menu__transform-origin-x: right;
181
148
  }
149
+
182
150
  @for $i from 3 to 8 {
183
151
  &[mdw-width-units="#{$i}"] {
184
152
  .mdw-menu__popup {
185
- width: #{$unit-width * $i};
153
+ inline-size: #{$unit-width * $i};
186
154
  }
187
155
  }
188
156
  }
189
157
  }
190
158
 
191
- .mdw-menu[mdw-menu-js] {
192
- position: fixed;
193
- top: 0;
194
- right: auto;
195
- bottom: auto;
196
- left: 0;
197
- overflow-y: scroll;
198
-
199
- height: 100%;
200
- width: 100%;
201
- margin: 0;
202
-
203
- cursor: default;
204
-
205
- z-index: 8;
206
-
207
- :root[dir="rtl"] & {
208
- right: 0;
209
- left: auto;
210
- }
211
-
212
- .mdw-menu__close {
213
- display: none;
214
- }
215
-
216
- .mdw-menu__popup {
217
- margin: 0;
218
- }
219
- }
220
-
221
159
  .mdw-menu__item-group {
222
160
  display: flex;
223
161
  flex-direction: column;
@@ -226,10 +164,7 @@ $unit-width: dp(56) !default;
226
164
  .mdw-menu__popup {
227
165
  display: inline-flex;
228
166
  position: absolute;
229
- top: inherit;
230
- right: inherit;
231
- bottom: inherit;
232
- left: inherit;
167
+ inset: inherit;
233
168
  flex-direction: column;
234
169
  -ms-overflow-style: -ms-autohiding-scrollbar;
235
170
  overflow-y: auto;
@@ -237,15 +172,14 @@ $unit-width: dp(56) !default;
237
172
  overscroll-behavior: contain;
238
173
  -ms-scroll-chaining: none;
239
174
 
240
- max-height: 50vh;
241
- min-width: $unit-width * 2;
242
- max-width: $unit-width * 7;
243
- margin-right: dp(8);
244
- margin-left: dp(8);
245
- padding-top: dp(8);
246
- padding-bottom: dp(8);
175
+ max-block-size: 50vh;
176
+ min-inline-size: $unit-width * 2;
177
+ max-inline-size: $unit-width * 7;
178
+ margin-inline: 8px;
179
+ padding-block: 8px;
247
180
 
248
181
  outline: none;
182
+ pointer-events: inherit;
249
183
 
250
184
  transition-delay: 0s, 0s, motion.$fadeOutDuration, motion.$fadeOutDuration;
251
185
  transition-duration: motion.$fadeOutDuration;
@@ -253,15 +187,37 @@ $unit-width: dp(56) !default;
253
187
  transition-timing-function: motion.$accelerateEasing;
254
188
 
255
189
  opacity: 0;
256
- pointer-events: inherit;
257
190
  transform: scale(0);
258
191
  transform-origin: inherit;
259
192
  z-index: 8;
260
193
 
261
- border-radius: dp(4);
194
+ border-radius: 4px;
262
195
  box-shadow: elevation.boxShadow(0);
263
196
  }
264
197
 
198
+ .mdw-menu[mdw-menu-js] {
199
+ position: fixed;
200
+ inset-block: 0 auto;
201
+ inset-inline: 0 auto;
202
+ overflow-y: scroll;
203
+
204
+ block-size: 100%;
205
+ inline-size: 100%;
206
+ margin: 0;
207
+
208
+ cursor: default;
209
+
210
+ z-index: 8;
211
+
212
+ .mdw-menu__close {
213
+ display: none;
214
+ }
215
+
216
+ .mdw-menu__popup {
217
+ margin: 0;
218
+ }
219
+ }
220
+
265
221
  .mdw-menu__text {
266
222
  overflow-x: hidden;
267
223
 
@@ -274,16 +230,16 @@ $unit-width: dp(56) !default;
274
230
  .mdw-menu__icon,
275
231
  .mdw-menu__check,
276
232
  .mdw-menu__radio {
277
- min-width: dp(40);
233
+ min-inline-size: 40px;
278
234
  }
279
235
 
280
236
  .mdw-menu__check,
281
237
  .mdw-menu__radio {
238
+ visibility: hidden;
239
+
282
240
  &[aria-hidden="true"] {
283
241
  display: none;
284
242
  }
285
-
286
- visibility: hidden;
287
243
 
288
244
  .mdw-menu__item[aria-checked="true"] & {
289
245
  visibility: visible;
@@ -291,9 +247,8 @@ $unit-width: dp(56) !default;
291
247
  }
292
248
 
293
249
  .mdw-menu__popup > .mdw-divider {
294
- height: dp(1);
295
- margin-top: dp(7);
296
- margin-bottom: dp(8);
250
+ block-size: 1px;
251
+ margin-block: 7px 8px;
297
252
  }
298
253
 
299
254
  .mdw-menu__item {
@@ -306,10 +261,8 @@ $unit-width: dp(56) !default;
306
261
 
307
262
  box-sizing: border-box;
308
263
 
309
-
310
- min-height: dp(48);
311
- padding-right: dp(16);
312
- padding-left: dp(16);
264
+ min-block-size: 48px;
265
+ padding-inline: 16px;
313
266
 
314
267
  cursor: pointer;
315
268
  outline: none;
@@ -322,6 +275,7 @@ $unit-width: dp(56) !default;
322
275
  z-index: 0;
323
276
 
324
277
  &[aria-disabled="true"] {
278
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
325
279
  cursor: not-allowed;
326
280
  }
327
281
  }
@@ -330,33 +284,46 @@ $unit-width: dp(56) !default;
330
284
  .mdw-menu[mdw-dense]:not([mdw-dense="never"]),
331
285
  .mdw-menu[mdw-dropdown] {
332
286
  .mdw-menu__item {
333
- min-height: dp(32);
334
- padding-right: dp(24);
335
- padding-left: dp(24);
287
+ min-block-size: 32px;
288
+ padding-inline: 24px;
336
289
  }
337
290
  }
291
+
338
292
  @include platform.ifNoTouch() {
339
293
  .mdw-menu:not([mdw-dense="never"]) {
340
294
  .mdw-menu__item {
341
- min-height: dp(32);
342
- padding-right: dp(24);
343
- padding-left: dp(24);
295
+ min-block-size: 32px;
296
+ padding-inline: 24px;
344
297
  }
345
298
  }
346
299
  }
347
300
 
348
301
  .mdw-menu__info {
349
- padding-right: 0;
350
- padding-left: dp(16);
302
+ padding-inline: 16px 0;
351
303
 
352
- text-align: right;
353
304
  text-align: end;
305
+ }
354
306
 
355
- :root[dir="rtl"] & {
356
- padding-right: dp(16);
357
- padding-left: 0;
307
+ .mdw-menu[aria-hidden="false"],
308
+ .mdw-menu[id]:target {
309
+ pointer-events: auto;
358
310
 
359
- text-align: left;
360
- text-align: end;
311
+ .mdw-menu__popup {
312
+ // Instant on desktop
313
+ transition-delay: 0s;
314
+ transition-duration: 0s;
315
+ transition-property: box-shadow, opacity, transform;
316
+ transition-timing-function: motion.$accelerateEasing;
317
+
318
+ opacity: 1;
319
+ transform: scale(1);
320
+
321
+ visibility: visible;
322
+
323
+ box-shadow: elevation.boxShadow(8);
324
+ @include breakpoint.maxTabletDevice {
325
+ transition-duration: motion.$expandDuration;
326
+ }
361
327
  }
328
+
362
329
  }