@smwb/ui-styles 2.3.0 → 2.4.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.
@@ -13,7 +13,7 @@
13
13
  display: flex;
14
14
  align-items: stretch;
15
15
  width: 100%;
16
- min-height: 56px;
16
+ min-height: @bottomBarHeight;
17
17
  }
18
18
 
19
19
  &__item {
@@ -3,6 +3,10 @@
3
3
  // sets it from its `offsetTop` prop and `AppLayout` publishes its sticky header's height as the
4
4
  // page default, so a panel starts below the header; with neither it is 0 and nothing moves.
5
5
  @sheetOffsetTop: var(--smui-sheet-offset-top, 0px);
6
+ // Gap between the bottom edge of the window and the bottom of the sheet and of its modal scrim. `BottomBar`
7
+ // publishes its height (with the safe-area inset) as the page default, so a panel stops above the bar; with the
8
+ // bar absent it is 0 and nothing moves.
9
+ @sheetOffsetBottom: var(--smui-bottom-bar-offset, 0px);
6
10
 
7
11
  background-color: var(--smui-surfaceBackground);
8
12
  position: fixed;
@@ -20,6 +24,11 @@
20
24
  display: flex;
21
25
  max-width: 100vw;
22
26
 
27
+ // A finger is dragging the panel (swipe to dismiss): it follows without easing.
28
+ &[data-smwb-swiping] {
29
+ transition: none;
30
+ }
31
+
23
32
  &__header {
24
33
  display: flex;
25
34
  justify-content: space-between;
@@ -121,10 +130,12 @@
121
130
 
122
131
  &.smwb-bottom {
123
132
  border-radius: @sheetBorderRadius @sheetBorderRadius 0 0;
124
- bottom: 0;
133
+ bottom: @sheetOffsetBottom;
125
134
  left: 0;
126
135
  width: 100%;
127
136
  height: var(--sizeProp);
137
+ // A tall panel stops at the top of the window (below any offset) instead of running past it by the bar's height.
138
+ max-height: calc(100% - @sheetOffsetTop - @sheetOffsetBottom);
128
139
  transform: translateY(100%);
129
140
  flex-direction: column;
130
141
  .smwb-sheet__header {
@@ -139,7 +150,7 @@
139
150
  width: 100%;
140
151
  height: var(--sizeProp);
141
152
  // A tall panel stops at the bottom of the window instead of running past it by the offset.
142
- max-height: calc(100% - @sheetOffsetTop);
153
+ max-height: calc(100% - @sheetOffsetTop - @sheetOffsetBottom);
143
154
  transform: translateY(-100%);
144
155
  flex-direction: column;
145
156
  .smwb-sheet__header {
@@ -151,7 +162,7 @@
151
162
  border-radius: 0 @sheetBorderRadius @sheetBorderRadius 0;
152
163
  top: @sheetOffsetTop;
153
164
  left: 0;
154
- height: calc(100% - @sheetOffsetTop);
165
+ height: calc(100% - @sheetOffsetTop - @sheetOffsetBottom);
155
166
  width: var(--sizeProp);
156
167
  transform: translateX(-100%);
157
168
  flex-direction: row-reverse;
@@ -166,7 +177,7 @@
166
177
  border-radius: @sheetBorderRadius 0 0 @sheetBorderRadius;
167
178
  top: @sheetOffsetTop;
168
179
  right: 0;
169
- height: calc(100% - @sheetOffsetTop);
180
+ height: calc(100% - @sheetOffsetTop - @sheetOffsetBottom);
170
181
  width: var(--sizeProp);
171
182
  transform: translateX(100%);
172
183
  .smwb-sheet__header {
@@ -180,7 +191,7 @@
180
191
  top: @sheetOffsetTop;
181
192
  left: 0;
182
193
  width: 100%;
183
- height: calc(100% - @sheetOffsetTop);
194
+ height: calc(100% - @sheetOffsetTop - @sheetOffsetBottom);
184
195
  display: flex;
185
196
  flex-direction: column;
186
197
  z-index: 100;
@@ -203,7 +214,7 @@
203
214
  .smwb-sheet {
204
215
  opacity: 1;
205
216
  &.smwb-bottom {
206
- transform: translateY(0);
217
+ transform: translateY(var(--smwb-sheet-swipe, 0px));
207
218
  &.smwb-expanded {
208
219
  height: 90%;
209
220
  }
@@ -221,7 +232,7 @@
221
232
  }
222
233
  }
223
234
  &.smwb-left {
224
- transform: translateX(0);
235
+ transform: translateX(var(--smwb-sheet-swipe, 0px));
225
236
  &.smwb-expanded {
226
237
  width: 90%;
227
238
  }
@@ -230,7 +241,7 @@
230
241
  }
231
242
  }
232
243
  &.smwb-right {
233
- transform: translateX(0);
244
+ transform: translateX(var(--smwb-sheet-swipe, 0px));
234
245
  &.smwb-expanded {
235
246
  width: 90%;
236
247
  }
@@ -4,6 +4,9 @@
4
4
  gap: @snackbarGap;
5
5
  position: fixed;
6
6
  z-index: 777;
7
+ // Gap above the window's bottom edge for a stack drawn at the bottom: `BottomBar` publishes its height as
8
+ // --smui-bottom-bar-offset, so the snackbars sit above the bar. With the variable unset it is 0 and nothing moves.
9
+ @snackbarsBottomOffset: var(--smui-bottom-bar-offset, 0px);
7
10
  &.smwb-top {
8
11
  top: 1rem;
9
12
  left: 50%;
@@ -18,17 +21,17 @@
18
21
  top: 1rem;
19
22
  }
20
23
  &.smwb-bottom {
21
- bottom: 1rem;
24
+ bottom: calc(1rem + @snackbarsBottomOffset);
22
25
  left: 50%;
23
26
  transform: translateX(-50%);
24
27
  }
25
28
  &.smwb-bottom-right {
26
29
  right: 1rem;
27
- bottom: 1rem;
30
+ bottom: calc(1rem + @snackbarsBottomOffset);
28
31
  }
29
32
  &.smwb-bottom-left {
30
33
  left: 1rem;
31
- bottom: 1rem;
34
+ bottom: calc(1rem + @snackbarsBottomOffset);
32
35
  }
33
36
  }
34
37
 
@@ -1,7 +1,34 @@
1
+ @stackDirections: row, row-reverse, column, column-reverse;
2
+
3
+ // `direction` given per breakpoint: one class per breakpoint and direction, base first and then
4
+ // the breakpoints in ascending order, so a wider one wins at the same specificity.
5
+ .stack-direction(@bp) {
6
+ each(@stackDirections, {
7
+ &--direction-@{bp}-@{value} {
8
+ flex-direction: @value;
9
+ }
10
+ });
11
+ }
12
+
1
13
  .smwb-stack {
2
14
  // layout is driven by inline flex props; this hook is for overrides
3
15
  min-width: 0;
4
16
 
17
+ .stack-direction(base);
18
+
19
+ .smui-media-up(sm; {
20
+ .stack-direction(sm);
21
+ });
22
+ .smui-media-up(md; {
23
+ .stack-direction(md);
24
+ });
25
+ .smui-media-up(lg; {
26
+ .stack-direction(lg);
27
+ });
28
+ .smui-media-up(xl; {
29
+ .stack-direction(xl);
30
+ });
31
+
5
32
  &__divider {
6
33
  display: flex;
7
34
  align-items: center;
@@ -142,6 +142,10 @@
142
142
  // this one carries dark ink instead of @onWarningColor. 5.5:1 on @warningColor.
143
143
  @badgeWarningColor: #1c1b1f;
144
144
 
145
+ // Height of the `BottomBar` row, without the safe-area inset it adds below; the bar publishes the sum as
146
+ // --smui-bottom-bar-offset.
147
+ @bottomBarHeight: 56px;
148
+
145
149
  @buttonGap: @smui-space-sm;
146
150
  @buttonPaddingSmall: @smui-space-xs 10px; // 10 off-grid
147
151
  @buttonPaddingMedium: 6px 14px; // off-grid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smwb/ui-styles",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Framework-agnostic LESS design tokens and component styles (smwb-*) shared by the @smwb UI libraries. Prebuilt aggregate CSS lives in @smwb/ui-css.",
5
5
  "license": "MIT",
6
6
  "sideEffects": [