@viasat/beam-styles 2.73.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.
- package/components/calendar.module.scss +181 -0
- package/components/index.scss +1 -0
- package/package.json +1 -1
- package/styles.css +93 -0
- package/styles.css.map +1 -1
- package/styles.min.css +1 -1
- package/styles.min.css.map +1 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
@use '../utils/constants.scss';
|
|
2
|
+
@use '../utils/mixins.scss' as mixins;
|
|
3
|
+
@use '../utils/tokens.scss' as tokens;
|
|
4
|
+
|
|
5
|
+
$calendarBaseClass: '#{constants.$prefix}calendar';
|
|
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
|
+
|
|
23
|
+
.#{$calendarBaseClass} {
|
|
24
|
+
// The grid is a fixed 7 × 40px wide per Figma; without this the root block
|
|
25
|
+
// would stretch to its container and leave the table floating inside it.
|
|
26
|
+
inline-size: fit-content;
|
|
27
|
+
|
|
28
|
+
// Announced but not drawn: the column's full weekday name, and each cell's
|
|
29
|
+
// full date. Both are cases where the visible text is an abbreviation and the
|
|
30
|
+
// spoken text needs to be the whole thing. This needs a real rule — an
|
|
31
|
+
// undeclared class resolves to undefined in the CSS-module build, and the
|
|
32
|
+
// text would render on screen instead of being hidden.
|
|
33
|
+
&__visually-hidden {
|
|
34
|
+
@include mixins.visually-hidden;
|
|
35
|
+
}
|
|
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
|
+
|
|
58
|
+
&__grid {
|
|
59
|
+
// Suppresses the UA's default cell borders and 2px spacing. Row rhythm is
|
|
60
|
+
// handled by cell padding below instead of `border-spacing`, which would
|
|
61
|
+
// also add space above the first row and below the last.
|
|
62
|
+
border-collapse: collapse;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__day {
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
// Figma binds the cell's width to the same `height/md` token it uses for
|
|
68
|
+
// the 40px date cells, so the columns line up between header and grid.
|
|
69
|
+
inline-size: tokens.$bm-sem-size-height-md;
|
|
70
|
+
block-size: tokens.$bm-sem-size-height-sm;
|
|
71
|
+
|
|
72
|
+
font: tokens.$bm-sem-typo-label-xs;
|
|
73
|
+
color: tokens.$bm-sem-color-text-secondary;
|
|
74
|
+
text-align: center;
|
|
75
|
+
}
|
|
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
|
+
|
|
115
|
+
&__date {
|
|
116
|
+
padding: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 4px between week rows, with no leading or trailing gap.
|
|
120
|
+
//
|
|
121
|
+
// Structure-dependent: this relies on `<td>` being a direct child of `<tr>`
|
|
122
|
+
// and on the rows being direct siblings. Audit it before inserting any
|
|
123
|
+
// wrapper element into the grid (see AGENTS.md).
|
|
124
|
+
&__week + &__week > &__date {
|
|
125
|
+
padding-block-start: tokens.$bm-sem-space-25;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// The 40px round cell body. A `<span>` in C-1 — nothing is selectable yet, so
|
|
129
|
+
// the cell is text rather than a control — and a `<button>` again from C-3,
|
|
130
|
+
// which is why the name and the `position: relative` the state layer needs
|
|
131
|
+
// both stay put.
|
|
132
|
+
&__date-button {
|
|
133
|
+
position: relative;
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
|
|
139
|
+
inline-size: tokens.$bm-sem-size-height-md;
|
|
140
|
+
block-size: tokens.$bm-sem-size-height-md;
|
|
141
|
+
padding: 0;
|
|
142
|
+
|
|
143
|
+
border: none;
|
|
144
|
+
border-radius: tokens.$bm-sem-radius-round;
|
|
145
|
+
background-color: transparent;
|
|
146
|
+
|
|
147
|
+
font: tokens.$bm-sem-typo-body-sm;
|
|
148
|
+
color: tokens.$bm-sem-color-text-primary;
|
|
149
|
+
|
|
150
|
+
// Nothing is selectable until C-3; the state layer is muted in the TSX for
|
|
151
|
+
// the same reason. No `:hover` / `:focus-visible` rules here either — those
|
|
152
|
+
// belong to the state layer, per .claude/rules/accessibility.md.
|
|
153
|
+
cursor: default;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Adjacent-month days.
|
|
157
|
+
//
|
|
158
|
+
// UNCONFIRMED BY DESIGN: Figma currently renders `outsideMonth` cells blank
|
|
159
|
+
// (i.e. `showOutsideDays={false}`), while the C-1 acceptance criteria call for
|
|
160
|
+
// dimmed dates. `text/secondary` is used rather than the disabled treatment
|
|
161
|
+
// because these days become selectable (C-3) and focusable (C-10), so the
|
|
162
|
+
// disabled look would signal the wrong affordance.
|
|
163
|
+
&__date[data-outside-month='true'] &__date-button {
|
|
164
|
+
color: tokens.$bm-sem-color-text-secondary;
|
|
165
|
+
}
|
|
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/components/index.scss
CHANGED
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -4939,6 +4939,99 @@
|
|
|
4939
4939
|
.bm-button--fluid {
|
|
4940
4940
|
width: 100%;
|
|
4941
4941
|
}
|
|
4942
|
+
.bm-calendar {
|
|
4943
|
+
inline-size: fit-content;
|
|
4944
|
+
}
|
|
4945
|
+
.bm-calendar__visually-hidden {
|
|
4946
|
+
position: absolute;
|
|
4947
|
+
width: 1px;
|
|
4948
|
+
height: 1px;
|
|
4949
|
+
margin: -1px;
|
|
4950
|
+
padding: 0;
|
|
4951
|
+
overflow: hidden;
|
|
4952
|
+
clip: rect(0, 0, 0, 0);
|
|
4953
|
+
border: 0;
|
|
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
|
+
}
|
|
4968
|
+
.bm-calendar__grid {
|
|
4969
|
+
border-collapse: collapse;
|
|
4970
|
+
}
|
|
4971
|
+
.bm-calendar__day {
|
|
4972
|
+
box-sizing: border-box;
|
|
4973
|
+
inline-size: var(--bm-sem-size-height-md);
|
|
4974
|
+
block-size: var(--bm-sem-size-height-sm);
|
|
4975
|
+
font: var(--bm-sem-typo-label-xs);
|
|
4976
|
+
color: var(--bm-sem-color-text-secondary);
|
|
4977
|
+
text-align: center;
|
|
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
|
+
}
|
|
4999
|
+
.bm-calendar__date {
|
|
5000
|
+
padding: 0;
|
|
5001
|
+
}
|
|
5002
|
+
.bm-calendar__week + .bm-calendar__week > .bm-calendar__date {
|
|
5003
|
+
padding-block-start: var(--bm-sem-space-25);
|
|
5004
|
+
}
|
|
5005
|
+
.bm-calendar__date-button {
|
|
5006
|
+
position: relative;
|
|
5007
|
+
box-sizing: border-box;
|
|
5008
|
+
display: flex;
|
|
5009
|
+
align-items: center;
|
|
5010
|
+
justify-content: center;
|
|
5011
|
+
inline-size: var(--bm-sem-size-height-md);
|
|
5012
|
+
block-size: var(--bm-sem-size-height-md);
|
|
5013
|
+
padding: 0;
|
|
5014
|
+
border: none;
|
|
5015
|
+
border-radius: var(--bm-sem-radius-round);
|
|
5016
|
+
background-color: transparent;
|
|
5017
|
+
font: var(--bm-sem-typo-body-sm);
|
|
5018
|
+
color: var(--bm-sem-color-text-primary);
|
|
5019
|
+
cursor: default;
|
|
5020
|
+
}
|
|
5021
|
+
.bm-calendar__date[data-outside-month=true] .bm-calendar__date-button {
|
|
5022
|
+
color: var(--bm-sem-color-text-secondary);
|
|
5023
|
+
}
|
|
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
|
+
}
|
|
4942
5035
|
:root,
|
|
4943
5036
|
:host,
|
|
4944
5037
|
.bm-light,
|