@viasat/beam-styles 2.26.1 → 2.28.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.
@@ -6,17 +6,23 @@
6
6
  @import '@viasat/beam-tokens/components/Panel';
7
7
 
8
8
  $panelBaseClass: '#{constants.$prefix}panel';
9
+ $panelOffsetXVar: '--#{constants.$prefix}comp-panel-offset-x';
10
+ $panelOffsetYVar: '--#{constants.$prefix}comp-panel-offset-y';
9
11
  $panel-transition-duration: 0.4s;
10
- $panel-width: 20rem; // TO DO: Temporary fixed width, to be mapped to spec props later
11
12
  $panel-max-height: 90dvh;
12
13
  $panel-full-height: 100dvh;
13
14
 
15
+ $panel-sizes: (
16
+ 'sm': tokens.$bm-comp-panel-size-sm,
17
+ 'md': tokens.$bm-comp-panel-size-md,
18
+ 'lg': tokens.$bm-comp-panel-size-lg,
19
+ 'full': 100%,
20
+ );
21
+
14
22
  .#{$panelBaseClass} {
15
23
  display: flex;
16
24
  flex-direction: column;
17
25
 
18
- width: $panel-width;
19
-
20
26
  background-color: tokens.$bm-sem-color-surface-01;
21
27
 
22
28
  &--inline {
@@ -60,10 +66,52 @@ $panel-full-height: 100dvh;
60
66
  &.#{$panelBaseClass}--position-full {
61
67
  inset: 0;
62
68
  }
69
+
70
+ &.#{$panelBaseClass}--floating {
71
+ border-radius: tokens.$bm-comp-panel-radius;
72
+
73
+ $floating-positions: (
74
+ 'start': (
75
+ 'x': ('left',),
76
+ 'y': ('top', 'bottom'),
77
+ ),
78
+ 'end': (
79
+ 'x': ('right',),
80
+ 'y': ('top', 'bottom'),
81
+ ),
82
+ 'bottom': (
83
+ 'x': ('left', 'right'),
84
+ 'y': ('bottom',),
85
+ ),
86
+ );
87
+
88
+ @each $position, $axes in $floating-positions {
89
+ &.#{$panelBaseClass}--position-#{$position} {
90
+ @each $edge in map.get($axes, 'x') {
91
+ #{$edge}: var(#{$panelOffsetXVar}, 1rem);
92
+ }
93
+
94
+ @each $edge in map.get($axes, 'y') {
95
+ #{$edge}: var(#{$panelOffsetYVar}, 1rem);
96
+ }
97
+
98
+ @if $position == 'bottom' {
99
+ width: auto;
100
+ }
101
+ }
102
+ }
103
+
104
+ &.#{$panelBaseClass}--position-full {
105
+ inset: var(#{$panelOffsetYVar}, 1rem) var(#{$panelOffsetXVar}, 1rem);
106
+ width: auto;
107
+ }
108
+ }
63
109
  }
64
110
 
65
- &--size-full {
66
- width: 100%;
111
+ @each $size, $width in $panel-sizes {
112
+ &--size-#{$size} {
113
+ width: $width;
114
+ }
67
115
  }
68
116
 
69
117
  // Applies to both inline and overlay bottom panels:
@@ -222,6 +270,54 @@ $panel-full-height: 100dvh;
222
270
  right: 0;
223
271
  }
224
272
  }
273
+
274
+ &__resize-handle {
275
+ position: absolute;
276
+ opacity: 0;
277
+ z-index: 100;
278
+ transition: opacity 0.2s ease-in-out;
279
+
280
+ @media (prefers-reduced-motion: reduce) {
281
+ transition: none;
282
+ }
283
+
284
+ &:hover,
285
+ &:active {
286
+ opacity: 1;
287
+ }
288
+ }
289
+
290
+ // Inline resizable: aside fills animated wrapper width
291
+ &--inline#{&}--resizable {
292
+ width: 100%;
293
+ }
294
+ }
295
+
296
+ $panelResizeHandleSize: 0.75rem;
297
+
298
+ $resize-handle-positions: (
299
+ 'start': (cursor: col-resize, size-prop: width, stretch: inset-block, placement: inset-inline-end, border-side: inline-end),
300
+ 'end': (cursor: col-resize, size-prop: width, stretch: inset-block, placement: inset-inline-start, border-side: inline-start),
301
+ 'bottom': (cursor: row-resize, size-prop: height, stretch: inset-inline, placement: inset-block-start, border-side: block-start),
302
+ );
303
+
304
+ @each $pos, $cfg in $resize-handle-positions {
305
+ .#{$panelBaseClass}--resizable.#{$panelBaseClass}--position-#{$pos} {
306
+ .#{$panelBaseClass}__resize-handle {
307
+ cursor: map.get($cfg, cursor);
308
+ #{map.get($cfg, size-prop)}: $panelResizeHandleSize;
309
+ #{map.get($cfg, stretch)}: 0;
310
+ #{map.get($cfg, placement)}: 0;
311
+ border-#{map.get($cfg, border-side)}-width: tokens.$bm-sem-border-width-md;
312
+ border-#{map.get($cfg, border-side)}-style: solid;
313
+ border-#{map.get($cfg, border-side)}-color: tokens.$bm-sem-color-border-selected;
314
+
315
+ &:hover,
316
+ &:active {
317
+ border-#{map.get($cfg, border-side)}-width: tokens.$bm-sem-border-width-lg;
318
+ }
319
+ }
320
+ }
225
321
  }
226
322
 
227
323
  @mixin panel-slide($prop, $hidden, $visible, $duration: $panel-transition-duration) {
@@ -260,9 +356,11 @@ $panel-full-height: 100dvh;
260
356
  transition: width $panel-transition-duration ease-in;
261
357
  }
262
358
 
263
- &[data-status='open'] {
264
- width: $panel-width;
265
- transition: width $panel-transition-duration ease-out;
359
+ @each $size, $width in $panel-sizes {
360
+ &--size-#{$size}[data-status='open'] {
361
+ width: $width;
362
+ transition: width $panel-transition-duration ease-out;
363
+ }
266
364
  }
267
365
 
268
366
  &[data-position='bottom'][data-status] {
@@ -281,9 +379,6 @@ $panel-full-height: 100dvh;
281
379
  transition: transform $panel-transition-duration ease-out;
282
380
  }
283
381
 
284
- &--full[data-status='open'] {
285
- width: 100%;
286
- }
287
382
  }
288
383
 
289
384
  .#{$panelBaseClass}__inline-wrapper-content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-styles",
3
- "version": "2.26.1",
3
+ "version": "2.28.0",
4
4
  "description": "SCSS modules and component styles for the Beam Design System",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",