@drivy/cobalt 0.36.0 → 0.37.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/cjs/tokens/theme.js +8 -2
- package/cjs/tokens/theme.js.map +1 -1
- package/components/Calendar/CalendarRangePicker/CalendarRangePicker.js +29 -11
- package/components/Calendar/CalendarRangePicker/CalendarRangePicker.js.map +1 -1
- package/components/Calendar/CalendarRangePicker/CalendarRangePickerDay.js +21 -17
- package/components/Calendar/CalendarRangePicker/CalendarRangePickerDay.js.map +1 -1
- package/components/Calendar/CalendarRangePicker/CalendarRangePickerMonth.js +155 -39
- package/components/Calendar/CalendarRangePicker/CalendarRangePickerMonth.js.map +1 -1
- package/components/Calendar/CalendarRangePicker/DayTooltip.js +23 -0
- package/components/Calendar/CalendarRangePicker/DayTooltip.js.map +1 -0
- package/components/Calendar/utils.js +6 -4
- package/components/Calendar/utils.js.map +1 -1
- package/package.json +2 -2
- package/styles/components/Calendar/CalendarRangePicker/index.scss +156 -186
- package/styles/core/_colors-map.scss +8 -2
- package/styles/core/default-theme.scss +6 -0
- package/styles/core/theme.scss +12 -0
- package/tokens/theme.js +8 -2
- package/tokens/theme.js.map +1 -1
- package/types/components/Calendar/CalendarRangePicker/CalendarRangePicker.d.ts +22 -5
- package/types/components/Calendar/CalendarRangePicker/CalendarRangePickerDay.d.ts +8 -8
- package/types/components/Calendar/CalendarRangePicker/CalendarRangePickerMonth.d.ts +9 -4
- package/types/components/Calendar/CalendarRangePicker/DayTooltip.d.ts +21 -0
- package/types/components/Calendar/utils.d.ts +2 -2
- package/types/tokens/index.d.ts +6 -0
- package/utilities.css +30 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/Calendar/utils.ts"],"sourcesContent":["import setISODay from \"date-fns/setISODay\"\nimport startOfMonth from \"date-fns/startOfMonth\"\nimport getDay from \"date-fns/getDay\"\nimport endOfMonth from \"date-fns/endOfMonth\"\nimport eachDayOfInterval from \"date-fns/eachDayOfInterval\"\n\nexport const getWeekDays = () => {\n const now = new Date().setHours(0, 0, 0, 0)\n return [...Array(7).keys()].map((index) => setISODay(now, index +
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/Calendar/utils.ts"],"sourcesContent":["import setISODay from \"date-fns/setISODay\"\nimport startOfMonth from \"date-fns/startOfMonth\"\nimport getDay from \"date-fns/getDay\"\nimport endOfMonth from \"date-fns/endOfMonth\"\nimport eachDayOfInterval from \"date-fns/eachDayOfInterval\"\n\nexport const getWeekDays = (isSundayFirstDayOfWeek = false) => {\n const extraIndex = isSundayFirstDayOfWeek ? 0 : 1\n const now = new Date().setHours(0, 0, 0, 0)\n return [...Array(7).keys()].map((index) => setISODay(now, index + extraIndex))\n}\n\nexport const getMonthDaysByWeeks = (\n monthDate: Date,\n isSundayFirstDayOfWeek = false\n): Date[][] => {\n const extraOffset = isSundayFirstDayOfWeek ? 0 : 1\n const firstDayOfMonth = startOfMonth(monthDate)\n const firstDayOfMonthOffset = getDay(firstDayOfMonth) - extraOffset\n const lastDayOfMonth = endOfMonth(monthDate)\n const days = eachDayOfInterval({\n start: firstDayOfMonth,\n end: lastDayOfMonth,\n })\n\n return days.reduce((acc: Date[][], day, index) => {\n if (index === 0 || (index + firstDayOfMonthOffset) % 7 === 0) {\n acc.push([])\n }\n acc[acc.length - 1].push(day)\n return acc\n }, [])\n}\n"],"names":[],"mappings":";;;;;;MAMa,WAAW,GAAG,CAAC,sBAAsB,GAAG,KAAK,KAAI;IAC5D,MAAM,UAAU,GAAG,sBAAsB,GAAG,CAAC,GAAG,CAAC,CAAA;AACjD,IAAA,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3C,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,CAAC,CAAC,CAAA;AAChF,EAAC;AAEY,MAAA,mBAAmB,GAAG,CACjC,SAAe,EACf,sBAAsB,GAAG,KAAK,KAClB;IACZ,MAAM,WAAW,GAAG,sBAAsB,GAAG,CAAC,GAAG,CAAC,CAAA;AAClD,IAAA,MAAM,eAAe,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;IAC/C,MAAM,qBAAqB,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,WAAW,CAAA;AACnE,IAAA,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC7B,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,GAAG,EAAE,cAAc;AACpB,KAAA,CAAC,CAAA;IAEF,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,GAAG,EAAE,KAAK,KAAI;AAC/C,QAAA,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,qBAAqB,IAAI,CAAC,KAAK,CAAC,EAAE;AAC5D,YAAA,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACb,SAAA;AACD,QAAA,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC7B,QAAA,OAAO,GAAG,CAAA;KACX,EAAE,EAAE,CAAC,CAAA;AACR;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drivy/cobalt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Opinionated design system for Drivy's projects.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"storybook:build": "storybook build",
|
|
122
122
|
"build:icons": "./scripts/buildIcons.sh",
|
|
123
123
|
"build:illustrations": "./scripts/buildIllustrations.sh",
|
|
124
|
-
"build:theme": "ts-node-esm ./scripts/buildThemeCSSVariables.
|
|
124
|
+
"build:theme": "ts-node-esm ./scripts/buildThemeCSSVariables.mts",
|
|
125
125
|
"test": "jest",
|
|
126
126
|
"percy": "storybook build && percy-storybook --widths=320,1280",
|
|
127
127
|
"typecheck": "tsc",
|
|
@@ -3,16 +3,8 @@
|
|
|
3
3
|
.cobalt-CalendarRangePicker {
|
|
4
4
|
$calendar-range-day-color: var(--c-background-accentAlt);
|
|
5
5
|
$calendar-range-day-invalid-color: var(--c-background-errorAlt);
|
|
6
|
-
$calendar-out-of-range-color: var(--c-background-error);
|
|
7
6
|
|
|
8
|
-
$calendar-day-
|
|
9
|
-
$calendar-day-padding: 6px;
|
|
10
|
-
$calendar-day-size: $calendar-day-inner-height + ($calendar-day-padding * 2);
|
|
11
|
-
$calendar-start-end-size: $calendar-day-inner-height + 8px;
|
|
12
|
-
|
|
13
|
-
@function crossMonthBorder($color) {
|
|
14
|
-
@return 10px solid $color;
|
|
15
|
-
}
|
|
7
|
+
$calendar-day-size: 42px;
|
|
16
8
|
|
|
17
9
|
@mixin start-range($color) {
|
|
18
10
|
background-image: linear-gradient(to right, transparent 50%, $color 50%);
|
|
@@ -23,40 +15,44 @@
|
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
@mixin start-end-day {
|
|
26
|
-
@include bg-color(accent);
|
|
27
|
-
@include text-color(inversed);
|
|
28
|
-
|
|
29
18
|
position: absolute;
|
|
30
19
|
z-index: -1;
|
|
31
|
-
top:
|
|
20
|
+
top: 0;
|
|
32
21
|
left: 0;
|
|
33
22
|
right: 0;
|
|
34
23
|
|
|
35
24
|
margin: auto;
|
|
36
25
|
|
|
37
|
-
height: $calendar-
|
|
38
|
-
width: $calendar-
|
|
26
|
+
height: $calendar-day-size;
|
|
27
|
+
width: $calendar-day-size;
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
box-sizing: border-box;
|
|
41
30
|
|
|
42
|
-
|
|
31
|
+
content: "";
|
|
43
32
|
|
|
44
|
-
|
|
33
|
+
border-radius: 8px;
|
|
45
34
|
}
|
|
46
35
|
|
|
47
36
|
position: relative;
|
|
48
37
|
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: flex-start;
|
|
41
|
+
|
|
49
42
|
&__months-container {
|
|
50
43
|
display: flex;
|
|
51
|
-
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
gap: spacing(md);
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
@include breakpoint($from: sm) {
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
gap: spacing(sm);
|
|
51
|
+
}
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
&__month {
|
|
58
55
|
@include bg-color(secondary);
|
|
59
|
-
flex: 1;
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
&__month-header {
|
|
@@ -97,30 +93,53 @@
|
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
&__day {
|
|
96
|
+
@include text-color(base);
|
|
97
|
+
|
|
100
98
|
position: relative;
|
|
101
99
|
|
|
102
100
|
z-index: 1;
|
|
103
101
|
|
|
104
|
-
|
|
102
|
+
height: $calendar-day-size;
|
|
103
|
+
width: $calendar-day-size;
|
|
104
|
+
|
|
105
|
+
display: flex;
|
|
106
|
+
|
|
107
|
+
justify-content: center;
|
|
108
|
+
align-items: center;
|
|
105
109
|
|
|
106
110
|
box-sizing: border-box;
|
|
107
111
|
|
|
108
112
|
flex-basis: calc(100% / 7);
|
|
109
113
|
|
|
110
|
-
min-width: $calendar-start-end-size;
|
|
111
|
-
|
|
112
114
|
text-align: center;
|
|
113
115
|
|
|
114
116
|
font-size: 13px;
|
|
115
117
|
|
|
116
|
-
line-height: $calendar-day-
|
|
118
|
+
line-height: $calendar-day-size;
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
|
|
122
|
+
.cobalt-CalendarRangePicker__day-notification-container {
|
|
123
|
+
position: absolute;
|
|
124
|
+
|
|
125
|
+
bottom: 0;
|
|
126
|
+
|
|
127
|
+
width: 100%;
|
|
128
|
+
height: 18px;
|
|
129
|
+
|
|
130
|
+
display: flex;
|
|
131
|
+
|
|
132
|
+
justify-content: center;
|
|
133
|
+
align-items: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.cobalt-CalendarRangePicker__day-notification {
|
|
137
|
+
width: 4px;
|
|
138
|
+
height: 4px;
|
|
119
139
|
|
|
120
|
-
|
|
121
|
-
position: relative;
|
|
140
|
+
border-radius: 50%;
|
|
122
141
|
|
|
123
|
-
|
|
142
|
+
background-color: var(--c-navy-300);
|
|
124
143
|
}
|
|
125
144
|
|
|
126
145
|
&--today {
|
|
@@ -129,216 +148,130 @@
|
|
|
129
148
|
}
|
|
130
149
|
|
|
131
150
|
&--selected {
|
|
132
|
-
|
|
133
|
-
|
|
151
|
+
@include text-color(accent);
|
|
152
|
+
|
|
153
|
+
background-color: $calendar-range-day-color;
|
|
154
|
+
|
|
155
|
+
.cobalt-CalendarRangePicker__day-notification {
|
|
156
|
+
@include bg-color(accent);
|
|
134
157
|
}
|
|
135
158
|
}
|
|
136
159
|
|
|
137
160
|
&--disabled {
|
|
138
|
-
color
|
|
161
|
+
@include text-color(disabled);
|
|
139
162
|
|
|
140
|
-
|
|
163
|
+
text-decoration: line-through;
|
|
141
164
|
}
|
|
142
165
|
|
|
143
|
-
&--startDay,
|
|
144
|
-
&--endDay {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
font-weight: 600;
|
|
148
|
-
|
|
149
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
150
|
-
background-color: transparent;
|
|
151
|
-
}
|
|
166
|
+
&--startDay.cobalt-CalendarRangePicker__day--selected,
|
|
167
|
+
&--endDay.cobalt-CalendarRangePicker__day--selected {
|
|
168
|
+
background-color: transparent;
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
&--startDay:not(&--endDay).cobalt-CalendarRangePicker__day--range {
|
|
155
|
-
|
|
156
|
-
@include start-range($calendar-range-day-color);
|
|
157
|
-
}
|
|
172
|
+
@include start-range($calendar-range-day-color);
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
&--endDay:not(&--startDay).cobalt-CalendarRangePicker__day--range {
|
|
161
|
-
|
|
162
|
-
@include end-range($calendar-range-day-color);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&--startDay .cobalt-CalendarRangePicker__day-inner:after,
|
|
167
|
-
&--endDay .cobalt-CalendarRangePicker__day-inner:after {
|
|
168
|
-
@include start-end-day;
|
|
176
|
+
@include end-range($calendar-range-day-color);
|
|
169
177
|
}
|
|
170
178
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
.cobalt-CalendarRangePicker__day-
|
|
174
|
-
@include start-
|
|
175
|
-
|
|
176
|
-
box-shadow:
|
|
177
|
-
var(--c-background-secondary) 0 0 0 2px,
|
|
178
|
-
var(--c-background-accent) 0 0 0 4px;
|
|
179
|
+
&--startDay:not(
|
|
180
|
+
&--endDay
|
|
181
|
+
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--invalid {
|
|
182
|
+
@include start-range($calendar-range-day-invalid-color);
|
|
179
183
|
}
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
&--startDay.cobalt-CalendarRangePicker__day--today:not(
|
|
183
|
-
&--endDay
|
|
184
|
-
).cobalt-CalendarRangePicker__day--subdued,
|
|
185
|
-
&--endDay.cobalt-CalendarRangePicker__day--today:not(
|
|
185
|
+
&--endDay:not(
|
|
186
186
|
&--startDay
|
|
187
|
-
).cobalt-CalendarRangePicker__day--
|
|
188
|
-
@include
|
|
189
|
-
font-weight: 600;
|
|
187
|
+
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--invalid {
|
|
188
|
+
@include end-range($calendar-range-day-invalid-color);
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
|
|
193
|
-
&--
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
&--endDay:not(&--startDay):not(
|
|
197
|
-
&--today
|
|
198
|
-
).cobalt-CalendarRangePicker__day--subdued {
|
|
199
|
-
@include text-color(base);
|
|
200
|
-
font-weight: inherit;
|
|
191
|
+
&--startDay:after,
|
|
192
|
+
&--endDay:after {
|
|
193
|
+
@include start-end-day;
|
|
194
|
+
background-color: $calendar-range-day-color;
|
|
201
195
|
}
|
|
202
196
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
.cobalt-CalendarRangePicker__day-inner:after,
|
|
206
|
-
&--endDay:not(&--startDay).cobalt-CalendarRangePicker__day--subdued
|
|
207
|
-
.cobalt-CalendarRangePicker__day-inner:after {
|
|
208
|
-
background: $calendar-range-day-color;
|
|
209
|
-
box-shadow: none;
|
|
197
|
+
&--active:not(&--invalid) {
|
|
198
|
+
@include text-color(onAccent);
|
|
210
199
|
}
|
|
211
200
|
|
|
212
|
-
&--
|
|
213
|
-
|
|
214
|
-
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--firstOfMonth
|
|
215
|
-
.cobalt-CalendarRangePicker__day-inner:before,
|
|
216
|
-
&--selected:not(
|
|
217
|
-
&--endDay
|
|
218
|
-
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--lastOfMonth
|
|
219
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
220
|
-
position: absolute;
|
|
221
|
-
|
|
222
|
-
height: 0;
|
|
223
|
-
width: 0;
|
|
224
|
-
|
|
225
|
-
border-top: 12px solid transparent;
|
|
226
|
-
border-bottom: 12px solid transparent;
|
|
227
|
-
|
|
228
|
-
content: "";
|
|
201
|
+
&--active .cobalt-CalendarRangePicker__day-notification {
|
|
202
|
+
@include bg-color(primary);
|
|
229
203
|
}
|
|
230
204
|
|
|
231
|
-
&--
|
|
232
|
-
|
|
233
|
-
left: -10px;
|
|
234
|
-
|
|
235
|
-
border-right: crossMonthBorder($calendar-range-day-color);
|
|
205
|
+
&--active:not(&--invalid):after {
|
|
206
|
+
@include bg-color(accent);
|
|
236
207
|
}
|
|
237
208
|
|
|
238
|
-
&--
|
|
239
|
-
|
|
240
|
-
right: -10px;
|
|
209
|
+
&--invalid {
|
|
210
|
+
@include text-color(error);
|
|
241
211
|
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
212
|
+
background-color: $calendar-range-day-invalid-color;
|
|
245
213
|
|
|
246
|
-
|
|
247
|
-
&--selected {
|
|
248
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
214
|
+
&:after {
|
|
249
215
|
background-color: $calendar-range-day-invalid-color;
|
|
250
216
|
}
|
|
251
|
-
}
|
|
252
217
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
@include text-color(inversed);
|
|
256
|
-
background-color: $calendar-out-of-range-color;
|
|
218
|
+
.cobalt-CalendarRangePicker__day-notification {
|
|
219
|
+
@include bg-color(error);
|
|
257
220
|
}
|
|
258
221
|
}
|
|
259
222
|
|
|
260
|
-
&--
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
background-color: transparent;
|
|
223
|
+
&--endDay.cobalt-CalendarRangePicker__day--active.cobalt-CalendarRangePicker__day--invalid:not(
|
|
224
|
+
&--range
|
|
225
|
+
):not(&--startDay) {
|
|
226
|
+
&:after {
|
|
227
|
+
@include bg-color(primary);
|
|
266
228
|
}
|
|
267
229
|
}
|
|
268
230
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
231
|
+
&--endDay.cobalt-CalendarRangePicker__day--active.cobalt-CalendarRangePicker__day--invalid {
|
|
232
|
+
&:after {
|
|
233
|
+
@include border(error);
|
|
234
|
+
border-width: 2px;
|
|
273
235
|
}
|
|
274
236
|
}
|
|
275
237
|
|
|
276
|
-
//
|
|
277
|
-
&--startDay
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
281
|
-
@include start-range($calendar-out-of-range-color);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
238
|
+
//Start day = end day
|
|
239
|
+
&--startDay.cobalt-CalendarRangePicker__day--endDay {
|
|
240
|
+
&:before {
|
|
241
|
+
@include border(onAccent);
|
|
284
242
|
|
|
285
|
-
|
|
286
|
-
&--endDay:not(&--startDay).cobalt-CalendarRangePicker__day--range {
|
|
287
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
288
|
-
@include end-range($calendar-range-day-invalid-color);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
243
|
+
position: absolute;
|
|
291
244
|
|
|
292
|
-
|
|
293
|
-
&--endDay:not(
|
|
294
|
-
&--startDay
|
|
295
|
-
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--invalid {
|
|
296
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
297
|
-
@include end-range($calendar-out-of-range-color);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
245
|
+
z-index: 0;
|
|
300
246
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
&--endDay .cobalt-CalendarRangePicker__day-inner:after {
|
|
304
|
-
@include bg-color(error);
|
|
247
|
+
top: 2px;
|
|
248
|
+
left: 2px;
|
|
305
249
|
|
|
306
|
-
|
|
307
|
-
|
|
250
|
+
height: calc(100% - 4px);
|
|
251
|
+
width: calc(100% - 4px);
|
|
308
252
|
|
|
309
|
-
|
|
310
|
-
&--startDay:not(&--endDay).cobalt-CalendarRangePicker__day--subdued
|
|
311
|
-
.cobalt-CalendarRangePicker__day-inner:after,
|
|
312
|
-
&--endDay:not(&--startDay).cobalt-CalendarRangePicker__day--subdued
|
|
313
|
-
.cobalt-CalendarRangePicker__day-inner:after {
|
|
314
|
-
background: $calendar-range-day-invalid-color;
|
|
315
|
-
}
|
|
253
|
+
border-width: 2px;
|
|
316
254
|
|
|
317
|
-
|
|
318
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
319
|
-
border-right: crossMonthBorder($calendar-range-day-invalid-color);
|
|
320
|
-
}
|
|
255
|
+
box-sizing: border-box;
|
|
321
256
|
|
|
322
|
-
|
|
323
|
-
&--startDay
|
|
324
|
-
).cobalt-CalendarRangePicker__day--invalid.cobalt-CalendarRangePicker__day--firstOfMonth
|
|
325
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
326
|
-
border-right: crossMonthBorder($calendar-out-of-range-color);
|
|
327
|
-
}
|
|
257
|
+
border-radius: 7px;
|
|
328
258
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
border-left: crossMonthBorder($calendar-range-day-invalid-color);
|
|
332
|
-
}
|
|
259
|
+
content: "";
|
|
260
|
+
}
|
|
333
261
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
338
|
-
border-left: crossMonthBorder($calendar-out-of-range-color);
|
|
262
|
+
&.cobalt-CalendarRangePicker__day--invalid:after {
|
|
263
|
+
background-color: $calendar-range-day-invalid-color;
|
|
264
|
+
}
|
|
339
265
|
}
|
|
340
266
|
}
|
|
341
267
|
|
|
268
|
+
&--isEditing
|
|
269
|
+
.cobalt-CalendarRangePicker__day:not(
|
|
270
|
+
.cobalt-CalendarRangePicker__day--disabled
|
|
271
|
+
) {
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
}
|
|
274
|
+
|
|
342
275
|
&__message {
|
|
343
276
|
display: flex;
|
|
344
277
|
justify-content: center;
|
|
@@ -367,3 +300,40 @@
|
|
|
367
300
|
}
|
|
368
301
|
}
|
|
369
302
|
}
|
|
303
|
+
|
|
304
|
+
.tippy-box[data-theme~="range-picker"] {
|
|
305
|
+
@include border(base);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.tippy-box[data-theme~="range-picker"] .tippy-arrow:after {
|
|
309
|
+
position: absolute;
|
|
310
|
+
|
|
311
|
+
left: 0;
|
|
312
|
+
|
|
313
|
+
z-index: -1;
|
|
314
|
+
|
|
315
|
+
border-color: transparent;
|
|
316
|
+
border-style: solid;
|
|
317
|
+
|
|
318
|
+
color: color-var(stroke, base);
|
|
319
|
+
|
|
320
|
+
content: "";
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.tippy-box[data-theme~="range-picker"][data-placement^="top"]
|
|
324
|
+
> .tippy-arrow:after {
|
|
325
|
+
bottom: -9px;
|
|
326
|
+
|
|
327
|
+
border-width: 8px 8px 0;
|
|
328
|
+
border-top-color: initial;
|
|
329
|
+
transform-origin: center top;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.tippy-box[data-theme~="range-picker"][data-placement^="bottom"]
|
|
333
|
+
> .tippy-arrow:after {
|
|
334
|
+
top: -9px;
|
|
335
|
+
|
|
336
|
+
border-width: 0 8px 8px;
|
|
337
|
+
border-bottom-color: initial;
|
|
338
|
+
transform-origin: center bottom;
|
|
339
|
+
}
|
|
@@ -77,7 +77,11 @@ $theme-colors-map: (
|
|
|
77
77
|
connectAlt: var(--c-text-connectAlt),
|
|
78
78
|
driver: var(--c-text-driver),
|
|
79
79
|
owner: var(--c-text-owner),
|
|
80
|
-
inversed: var(--c-text-inversed)
|
|
80
|
+
inversed: var(--c-text-inversed),
|
|
81
|
+
disabled: var(--c-text-disabled),
|
|
82
|
+
onAccent: var(--c-text-onAccent),
|
|
83
|
+
onError: var(--c-text-onError),
|
|
84
|
+
onSuccess: var(--c-text-onSuccess)
|
|
81
85
|
),
|
|
82
86
|
buttonBackground: (
|
|
83
87
|
selected: var(--c-buttonBackground-selected),
|
|
@@ -228,7 +232,9 @@ $theme-colors-map: (
|
|
|
228
232
|
error: var(--c-stroke-error),
|
|
229
233
|
errorAlt: var(--c-stroke-errorAlt),
|
|
230
234
|
success: var(--c-stroke-success),
|
|
231
|
-
successAlt: var(--c-stroke-successAlt)
|
|
235
|
+
successAlt: var(--c-stroke-successAlt),
|
|
236
|
+
onAccent: var(--c-stroke-onAccent),
|
|
237
|
+
onError: var(--c-stroke-onError)
|
|
232
238
|
),
|
|
233
239
|
fill: (
|
|
234
240
|
base: var(--c-fill-base),
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
--c-text-driver: var(--c-navy-700);
|
|
58
58
|
--c-text-owner: var(--c-white);
|
|
59
59
|
--c-text-inversed: var(--c-white);
|
|
60
|
+
--c-text-disabled: var(--c-navy-200);
|
|
61
|
+
--c-text-onAccent: var(--c-white);
|
|
62
|
+
--c-text-onError: var(--c-white);
|
|
63
|
+
--c-text-onSuccess: var(--c-white);
|
|
60
64
|
--c-buttonBackground-selected: var(--c-purple-100);
|
|
61
65
|
--c-buttonBackground-destructiveInteractive: var(--c-red-100);
|
|
62
66
|
--c-buttonBackground-destructiveInteractive--hover: var(--c-red-120);
|
|
@@ -154,6 +158,8 @@
|
|
|
154
158
|
--c-stroke-errorAlt: var(--c-red-500);
|
|
155
159
|
--c-stroke-success: var(--c-green-500);
|
|
156
160
|
--c-stroke-successAlt: var(--c-green-500);
|
|
161
|
+
--c-stroke-onAccent: var(--c-white);
|
|
162
|
+
--c-stroke-onError: var(--c-white);
|
|
157
163
|
--c-fill-base: var(--c-navy-500);
|
|
158
164
|
--c-fill-secondary: var(--c-yellow-500);
|
|
159
165
|
--c-fill-subdued: var(--c-navy-100);
|
package/styles/core/theme.scss
CHANGED
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
--c-text-driver: var(--c-navy-700);
|
|
58
58
|
--c-text-owner: var(--c-white);
|
|
59
59
|
--c-text-inversed: var(--c-white);
|
|
60
|
+
--c-text-disabled: var(--c-navy-200);
|
|
61
|
+
--c-text-onAccent: var(--c-white);
|
|
62
|
+
--c-text-onError: var(--c-white);
|
|
63
|
+
--c-text-onSuccess: var(--c-white);
|
|
60
64
|
--c-buttonBackground-selected: var(--c-purple-100);
|
|
61
65
|
--c-buttonBackground-destructiveInteractive: var(--c-red-100);
|
|
62
66
|
--c-buttonBackground-destructiveInteractive--hover: var(--c-red-120);
|
|
@@ -154,6 +158,8 @@
|
|
|
154
158
|
--c-stroke-errorAlt: var(--c-red-500);
|
|
155
159
|
--c-stroke-success: var(--c-green-500);
|
|
156
160
|
--c-stroke-successAlt: var(--c-green-500);
|
|
161
|
+
--c-stroke-onAccent: var(--c-white);
|
|
162
|
+
--c-stroke-onError: var(--c-white);
|
|
157
163
|
--c-fill-base: var(--c-navy-500);
|
|
158
164
|
--c-fill-secondary: var(--c-yellow-500);
|
|
159
165
|
--c-fill-subdued: var(--c-navy-100);
|
|
@@ -221,6 +227,10 @@
|
|
|
221
227
|
--c-text-driver: var(--c-navy-700);
|
|
222
228
|
--c-text-owner: var(--c-grey-100);
|
|
223
229
|
--c-text-inversed: var(--c-white);
|
|
230
|
+
--c-text-disabled: var(--c-navy-200);
|
|
231
|
+
--c-text-onAccent: var(--c-white);
|
|
232
|
+
--c-text-onError: var(--c-white);
|
|
233
|
+
--c-text-onSuccess: var(--c-white);
|
|
224
234
|
--c-buttonBackground-selected: var(--c-purpleDeep-900);
|
|
225
235
|
--c-buttonBackground-destructiveInteractive: var(--c-red-900);
|
|
226
236
|
--c-buttonBackground-destructiveInteractive--hover: var(--c-red-900);
|
|
@@ -318,6 +328,8 @@
|
|
|
318
328
|
--c-stroke-errorAlt: var(--c-red-200);
|
|
319
329
|
--c-stroke-success: var(--c-green-700);
|
|
320
330
|
--c-stroke-successAlt: var(--c-green-700);
|
|
331
|
+
--c-stroke-onAccent: var(--c-white);
|
|
332
|
+
--c-stroke-onError: var(--c-white);
|
|
321
333
|
--c-fill-base: var(--c-grey-100);
|
|
322
334
|
--c-fill-secondary: var(--c-yellow-500);
|
|
323
335
|
--c-fill-subdued: var(--c-black-50);
|
package/tokens/theme.js
CHANGED
|
@@ -72,7 +72,11 @@ const text = {
|
|
|
72
72
|
connectAlt: "turquoise/turquoise.900/turquoise.50",
|
|
73
73
|
driver: "graphite/navy.700/navy.700",
|
|
74
74
|
owner: "white/white/grey.100",
|
|
75
|
-
inversed: "white/white/white"
|
|
75
|
+
inversed: "white/white/white",
|
|
76
|
+
disabled: "navy.200/navy.200/navy.200",
|
|
77
|
+
onAccent: "white/white/white",
|
|
78
|
+
onError: "white/white/white",
|
|
79
|
+
onSuccess: "white/white/white"
|
|
76
80
|
};
|
|
77
81
|
const buttonBackground = {
|
|
78
82
|
selected: "indigo/purple.100/purpleDeep.900",
|
|
@@ -223,7 +227,9 @@ const stroke = {
|
|
|
223
227
|
error: "red/red.500/red.200",
|
|
224
228
|
errorAlt: "red/red.500/red.200",
|
|
225
229
|
success: "green/green.500/green.700",
|
|
226
|
-
successAlt: "green/green.500/green.700"
|
|
230
|
+
successAlt: "green/green.500/green.700",
|
|
231
|
+
onAccent: "white/white/white",
|
|
232
|
+
onError: "white/white/white"
|
|
227
233
|
};
|
|
228
234
|
const fill = {
|
|
229
235
|
base: "graphite/navy.500/grey.100",
|
package/tokens/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FormElementStatus } from "../../Form/form";
|
|
3
|
-
|
|
3
|
+
export interface RangeConstraintInterface {
|
|
4
|
+
value: number;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RangeConstraintsInterface {
|
|
8
|
+
min?: RangeConstraintInterface;
|
|
9
|
+
max?: RangeConstraintInterface;
|
|
10
|
+
}
|
|
11
|
+
export interface DayStatusInterface {
|
|
12
|
+
isRangeExceeded?: boolean;
|
|
13
|
+
isRangeTooShort?: boolean;
|
|
14
|
+
isCustomInvalid?: boolean;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type CalendarRangePickerPropsType = {
|
|
4
18
|
numberOfMonths?: number;
|
|
5
19
|
firstMonthDate?: Date;
|
|
6
|
-
|
|
20
|
+
rangeConstraints?: RangeConstraintsInterface;
|
|
7
21
|
firstAvailableDate?: Date;
|
|
8
22
|
lastAvailableDate?: Date;
|
|
9
23
|
isEditingStartDate: boolean;
|
|
10
24
|
isEditingEndDate: boolean;
|
|
11
25
|
startDate: Date | undefined;
|
|
12
26
|
endDate: Date | undefined;
|
|
27
|
+
isDayDisabledFn?: (day: Date) => boolean;
|
|
28
|
+
hasDayNotificationFn?: (day: Date) => boolean;
|
|
29
|
+
isDayInvalidForSelectionFn?: (day: Date) => boolean;
|
|
30
|
+
isSundayFirstDayOfWeek?: boolean;
|
|
13
31
|
hint?: {
|
|
14
32
|
status?: FormElementStatus;
|
|
15
33
|
html: string;
|
|
16
34
|
};
|
|
17
|
-
onChangeDate?: (date: Date,
|
|
35
|
+
onChangeDate?: (date: Date, status: DayStatusInterface) => boolean;
|
|
18
36
|
onLeaveDate?: (date: Date) => void;
|
|
19
37
|
onSelectDate?: (date: Date, isOutOfRange: boolean) => void;
|
|
20
38
|
locale?: Record<string, unknown>;
|
|
21
39
|
};
|
|
22
|
-
export declare function CalendarRangePicker({
|
|
23
|
-
export {};
|
|
40
|
+
export declare function CalendarRangePicker({ rangeConstraints, firstMonthDate, numberOfMonths, hint, firstAvailableDate, lastAvailableDate, isEditingStartDate, isEditingEndDate, startDate, endDate, onChangeDate, onLeaveDate, onSelectDate, isDayDisabledFn, hasDayNotificationFn, isDayInvalidForSelectionFn, isSundayFirstDayOfWeek, locale, }: CalendarRangePickerPropsType): React.JSX.Element;
|