@viasat/beam-styles 2.74.0 → 2.75.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.
@@ -4,6 +4,22 @@
4
4
 
5
5
  $calendarBaseClass: '#{constants.$prefix}calendar';
6
6
 
7
+ // No motion tokens exist in the token set, so the duration is local — the same
8
+ // approach dialog.module.scss takes with $dialog-motion-duration. The distance
9
+ // is a spacing token (0.5rem), so the slide scales with the root font size the
10
+ // way every other dimension in this lib does.
11
+ $monthMotionDuration: 0.25s;
12
+ $monthMotionOffset: tokens.$bm-sem-space-50;
13
+
14
+ // Tokens resolve to `var(--…)`, and `-var(…)` isn't valid CSS, so the reverse
15
+ // direction needs `calc` — the lib's precedent for negating one (button, card,
16
+ // combobox).
17
+ $monthMotionOffsetReverse: calc(0px - #{tokens.$bm-sem-space-50});
18
+
19
+ // Signed horizontal offset the entering month slides in from. Set per
20
+ // direction, and flipped again in RTL.
21
+ $monthEnterOffset: '--#{constants.$prefix}calendar-month-enter-offset';
22
+
7
23
  .#{$calendarBaseClass} {
8
24
  // The grid is a fixed 7 × 40px wide per Figma; without this the root block
9
25
  // would stretch to its container and leave the table floating inside it.
@@ -18,6 +34,27 @@ $calendarBaseClass: '#{constants.$prefix}calendar';
18
34
  @include mixins.visually-hidden;
19
35
  }
20
36
 
37
+ &__header {
38
+ display: flex;
39
+ align-items: center;
40
+ // The 40px arrow buttons on both sides are equal width, so space-between
41
+ // centres the label without any further rules.
42
+ justify-content: space-between;
43
+ block-size: tokens.$bm-sem-size-height-md;
44
+ }
45
+
46
+ // Flex reverses the arrows' positions under `dir="rtl"`, but the chevron
47
+ // artwork is direction-agnostic, so without this both arrows end up pointing
48
+ // inward at the label. Rotating the glyph is the breadcrumbs precedent.
49
+ [dir='rtl'] &__header .#{constants.$prefix}icon {
50
+ transform: rotate(180deg);
51
+ }
52
+
53
+ &__header-label {
54
+ font: tokens.$bm-sem-typo-label-md;
55
+ color: tokens.$bm-sem-color-text-primary;
56
+ }
57
+
21
58
  &__grid {
22
59
  // Suppresses the UA's default cell borders and 2px spacing. Row rhythm is
23
60
  // handled by cell padding below instead of `border-spacing`, which would
@@ -37,6 +74,44 @@ $calendarBaseClass: '#{constants.$prefix}calendar';
37
74
  text-align: center;
38
75
  }
39
76
 
77
+ // Month transition. Only the date rows animate — the weekday header doesn't
78
+ // change between months, so animating it would be noise. `data-nav-direction`
79
+ // is absent until the user navigates, so the first paint never animates.
80
+ //
81
+ // The direction is carried as a custom property rather than a second keyframe
82
+ // so there is exactly one `animation` declaration. That matters for RTL:
83
+ // `translateX` has no logical equivalent, so the sign has to be flipped by
84
+ // selector, and a `[dir='rtl'] &` override (0,3,0) would outrank the
85
+ // reduced-motion rule below and defeat it. Flipping a value instead of an
86
+ // animation-name keeps the two concerns from colliding.
87
+ &__dates[data-nav-direction] {
88
+ animation: #{$calendarBaseClass}-month-enter $monthMotionDuration ease-out;
89
+
90
+ // WCAG 2.3.3 — the month swaps instantly when the user asks for less
91
+ // motion. Nested here so it shares the rule's specificity and wins on order.
92
+ @media (prefers-reduced-motion: reduce) {
93
+ animation: none;
94
+ }
95
+ }
96
+
97
+ &__dates[data-nav-direction='next'] {
98
+ #{$monthEnterOffset}: #{$monthMotionOffset};
99
+ }
100
+
101
+ &__dates[data-nav-direction='previous'] {
102
+ #{$monthEnterOffset}: #{$monthMotionOffsetReverse};
103
+ }
104
+
105
+ // `[dir='rtl'] &` is this lib's dominant RTL precedent (breadcrumbs, slider,
106
+ // header).
107
+ [dir='rtl'] &__dates[data-nav-direction='next'] {
108
+ #{$monthEnterOffset}: #{$monthMotionOffsetReverse};
109
+ }
110
+
111
+ [dir='rtl'] &__dates[data-nav-direction='previous'] {
112
+ #{$monthEnterOffset}: #{$monthMotionOffset};
113
+ }
114
+
40
115
  &__date {
41
116
  padding: 0;
42
117
  }
@@ -89,3 +164,18 @@ $calendarBaseClass: '#{constants.$prefix}calendar';
89
164
  color: tokens.$bm-sem-color-text-secondary;
90
165
  }
91
166
  }
167
+
168
+ // The new month slides in from the side it came from: paging forward brings it
169
+ // in from the trailing edge, paging back from the leading edge. The offset
170
+ // falls back to 0 so a missing custom property degrades to a plain fade.
171
+ @keyframes #{$calendarBaseClass}-month-enter {
172
+ from {
173
+ opacity: 0;
174
+ transform: translateX(var(#{$monthEnterOffset}, 0));
175
+ }
176
+
177
+ to {
178
+ opacity: 1;
179
+ transform: none;
180
+ }
181
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-styles",
3
- "version": "2.74.0",
3
+ "version": "2.75.0",
4
4
  "description": "SCSS modules and component styles for the Beam Design System",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",
package/styles.css CHANGED
@@ -4952,6 +4952,19 @@
4952
4952
  clip: rect(0, 0, 0, 0);
4953
4953
  border: 0;
4954
4954
  }
4955
+ .bm-calendar__header {
4956
+ display: flex;
4957
+ align-items: center;
4958
+ justify-content: space-between;
4959
+ block-size: var(--bm-sem-size-height-md);
4960
+ }
4961
+ [dir=rtl] .bm-calendar__header .bm-icon {
4962
+ transform: rotate(180deg);
4963
+ }
4964
+ .bm-calendar__header-label {
4965
+ font: var(--bm-sem-typo-label-md);
4966
+ color: var(--bm-sem-color-text-primary);
4967
+ }
4955
4968
  .bm-calendar__grid {
4956
4969
  border-collapse: collapse;
4957
4970
  }
@@ -4963,6 +4976,26 @@
4963
4976
  color: var(--bm-sem-color-text-secondary);
4964
4977
  text-align: center;
4965
4978
  }
4979
+ .bm-calendar__dates[data-nav-direction] {
4980
+ animation: bm-calendar-month-enter 0.25s ease-out;
4981
+ }
4982
+ @media (prefers-reduced-motion: reduce) {
4983
+ .bm-calendar__dates[data-nav-direction] {
4984
+ animation: none;
4985
+ }
4986
+ }
4987
+ .bm-calendar__dates[data-nav-direction=next] {
4988
+ --bm-calendar-month-enter-offset: var(--bm-sem-space-50);
4989
+ }
4990
+ .bm-calendar__dates[data-nav-direction=previous] {
4991
+ --bm-calendar-month-enter-offset: calc(0px - var(--bm-sem-space-50));
4992
+ }
4993
+ [dir=rtl] .bm-calendar__dates[data-nav-direction=next] {
4994
+ --bm-calendar-month-enter-offset: calc(0px - var(--bm-sem-space-50));
4995
+ }
4996
+ [dir=rtl] .bm-calendar__dates[data-nav-direction=previous] {
4997
+ --bm-calendar-month-enter-offset: var(--bm-sem-space-50);
4998
+ }
4966
4999
  .bm-calendar__date {
4967
5000
  padding: 0;
4968
5001
  }
@@ -4989,6 +5022,16 @@
4989
5022
  color: var(--bm-sem-color-text-secondary);
4990
5023
  }
4991
5024
 
5025
+ @keyframes bm-calendar-month-enter {
5026
+ from {
5027
+ opacity: 0;
5028
+ transform: translateX(var(--bm-calendar-month-enter-offset, 0));
5029
+ }
5030
+ to {
5031
+ opacity: 1;
5032
+ transform: none;
5033
+ }
5034
+ }
4992
5035
  :root,
4993
5036
  :host,
4994
5037
  .bm-light,