@drivy/cobalt 0.36.1 → 0.37.1
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 +160 -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.1",
|
|
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
|
-
|
|
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: 48px;
|
|
16
8
|
|
|
17
9
|
@mixin start-range($color) {
|
|
18
10
|
background-image: linear-gradient(to right, transparent 50%, $color 50%);
|
|
@@ -23,40 +15,48 @@
|
|
|
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:
|
|
38
|
-
width:
|
|
26
|
+
height: var(--calendar-day-size);
|
|
27
|
+
width: var(--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
|
+
|
|
42
|
+
@include breakpoint($from: sm) {
|
|
43
|
+
--calendar-day-size: 42px;
|
|
44
|
+
}
|
|
45
|
+
|
|
49
46
|
&__months-container {
|
|
50
47
|
display: flex;
|
|
51
|
-
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
gap: spacing(md);
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
@include breakpoint($from: sm) {
|
|
53
|
+
flex-direction: row;
|
|
54
|
+
gap: spacing(sm);
|
|
55
|
+
}
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
&__month {
|
|
58
59
|
@include bg-color(secondary);
|
|
59
|
-
flex: 1;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&__month-header {
|
|
@@ -97,30 +97,53 @@
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
&__day {
|
|
100
|
+
@include text-color(base);
|
|
101
|
+
|
|
100
102
|
position: relative;
|
|
101
103
|
|
|
102
104
|
z-index: 1;
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
height: var(--calendar-day-size);
|
|
107
|
+
width: var(--calendar-day-size);
|
|
108
|
+
|
|
109
|
+
display: flex;
|
|
110
|
+
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: center;
|
|
105
113
|
|
|
106
114
|
box-sizing: border-box;
|
|
107
115
|
|
|
108
116
|
flex-basis: calc(100% / 7);
|
|
109
117
|
|
|
110
|
-
min-width: $calendar-start-end-size;
|
|
111
|
-
|
|
112
118
|
text-align: center;
|
|
113
119
|
|
|
114
120
|
font-size: 13px;
|
|
115
121
|
|
|
116
|
-
line-height:
|
|
122
|
+
line-height: var(--calendar-day-size);
|
|
117
123
|
|
|
118
|
-
|
|
124
|
+
font-weight: 600;
|
|
125
|
+
|
|
126
|
+
.cobalt-CalendarRangePicker__day-notification-container {
|
|
127
|
+
position: absolute;
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
position: relative;
|
|
129
|
+
bottom: 0;
|
|
122
130
|
|
|
123
|
-
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 18px;
|
|
133
|
+
|
|
134
|
+
display: flex;
|
|
135
|
+
|
|
136
|
+
justify-content: center;
|
|
137
|
+
align-items: center;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.cobalt-CalendarRangePicker__day-notification {
|
|
141
|
+
width: 4px;
|
|
142
|
+
height: 4px;
|
|
143
|
+
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
|
|
146
|
+
background-color: var(--c-navy-300);
|
|
124
147
|
}
|
|
125
148
|
|
|
126
149
|
&--today {
|
|
@@ -129,216 +152,130 @@
|
|
|
129
152
|
}
|
|
130
153
|
|
|
131
154
|
&--selected {
|
|
132
|
-
|
|
133
|
-
|
|
155
|
+
@include text-color(accent);
|
|
156
|
+
|
|
157
|
+
background-color: $calendar-range-day-color;
|
|
158
|
+
|
|
159
|
+
.cobalt-CalendarRangePicker__day-notification {
|
|
160
|
+
@include bg-color(accent);
|
|
134
161
|
}
|
|
135
162
|
}
|
|
136
163
|
|
|
137
164
|
&--disabled {
|
|
138
|
-
color
|
|
165
|
+
@include text-color(disabled);
|
|
139
166
|
|
|
140
|
-
|
|
167
|
+
text-decoration: line-through;
|
|
141
168
|
}
|
|
142
169
|
|
|
143
|
-
&--startDay,
|
|
144
|
-
&--endDay {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
font-weight: 600;
|
|
148
|
-
|
|
149
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
150
|
-
background-color: transparent;
|
|
151
|
-
}
|
|
170
|
+
&--startDay.cobalt-CalendarRangePicker__day--selected,
|
|
171
|
+
&--endDay.cobalt-CalendarRangePicker__day--selected {
|
|
172
|
+
background-color: transparent;
|
|
152
173
|
}
|
|
153
174
|
|
|
154
175
|
&--startDay:not(&--endDay).cobalt-CalendarRangePicker__day--range {
|
|
155
|
-
|
|
156
|
-
@include start-range($calendar-range-day-color);
|
|
157
|
-
}
|
|
176
|
+
@include start-range($calendar-range-day-color);
|
|
158
177
|
}
|
|
159
178
|
|
|
160
179
|
&--endDay:not(&--startDay).cobalt-CalendarRangePicker__day--range {
|
|
161
|
-
|
|
162
|
-
@include end-range($calendar-range-day-color);
|
|
163
|
-
}
|
|
180
|
+
@include end-range($calendar-range-day-color);
|
|
164
181
|
}
|
|
165
182
|
|
|
166
|
-
&--startDay
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
//Start day = end day
|
|
172
|
-
&--startDay.cobalt-CalendarRangePicker__day--endDay
|
|
173
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
174
|
-
@include start-end-day;
|
|
175
|
-
|
|
176
|
-
box-shadow:
|
|
177
|
-
var(--c-background-secondary) 0 0 0 2px,
|
|
178
|
-
var(--c-background-accent) 0 0 0 4px;
|
|
183
|
+
&--startDay:not(
|
|
184
|
+
&--endDay
|
|
185
|
+
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--invalid {
|
|
186
|
+
@include start-range($calendar-range-day-invalid-color);
|
|
179
187
|
}
|
|
180
188
|
|
|
181
|
-
|
|
182
|
-
&--startDay.cobalt-CalendarRangePicker__day--today:not(
|
|
183
|
-
&--endDay
|
|
184
|
-
).cobalt-CalendarRangePicker__day--subdued,
|
|
185
|
-
&--endDay.cobalt-CalendarRangePicker__day--today:not(
|
|
189
|
+
&--endDay:not(
|
|
186
190
|
&--startDay
|
|
187
|
-
).cobalt-CalendarRangePicker__day--
|
|
188
|
-
@include
|
|
189
|
-
font-weight: 600;
|
|
191
|
+
).cobalt-CalendarRangePicker__day--range.cobalt-CalendarRangePicker__day--invalid {
|
|
192
|
+
@include end-range($calendar-range-day-invalid-color);
|
|
190
193
|
}
|
|
191
194
|
|
|
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;
|
|
195
|
+
&--startDay:after,
|
|
196
|
+
&--endDay:after {
|
|
197
|
+
@include start-end-day;
|
|
198
|
+
background-color: $calendar-range-day-color;
|
|
201
199
|
}
|
|
202
200
|
|
|
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;
|
|
201
|
+
&--active:not(&--invalid) {
|
|
202
|
+
@include text-color(onAccent);
|
|
210
203
|
}
|
|
211
204
|
|
|
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: "";
|
|
205
|
+
&--active .cobalt-CalendarRangePicker__day-notification {
|
|
206
|
+
@include bg-color(primary);
|
|
229
207
|
}
|
|
230
208
|
|
|
231
|
-
&--
|
|
232
|
-
|
|
233
|
-
left: -10px;
|
|
234
|
-
|
|
235
|
-
border-right: crossMonthBorder($calendar-range-day-color);
|
|
209
|
+
&--active:not(&--invalid):after {
|
|
210
|
+
@include bg-color(accent);
|
|
236
211
|
}
|
|
237
212
|
|
|
238
|
-
&--
|
|
239
|
-
|
|
240
|
-
right: -10px;
|
|
213
|
+
&--invalid {
|
|
214
|
+
@include text-color(error);
|
|
241
215
|
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
216
|
+
background-color: $calendar-range-day-invalid-color;
|
|
245
217
|
|
|
246
|
-
|
|
247
|
-
&--selected {
|
|
248
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
218
|
+
&:after {
|
|
249
219
|
background-color: $calendar-range-day-invalid-color;
|
|
250
220
|
}
|
|
251
|
-
}
|
|
252
221
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
@include text-color(inversed);
|
|
256
|
-
background-color: $calendar-out-of-range-color;
|
|
222
|
+
.cobalt-CalendarRangePicker__day-notification {
|
|
223
|
+
@include bg-color(error);
|
|
257
224
|
}
|
|
258
225
|
}
|
|
259
226
|
|
|
260
|
-
&--
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
background-color: transparent;
|
|
227
|
+
&--endDay.cobalt-CalendarRangePicker__day--active.cobalt-CalendarRangePicker__day--invalid:not(
|
|
228
|
+
&--range
|
|
229
|
+
):not(&--startDay) {
|
|
230
|
+
&:after {
|
|
231
|
+
@include bg-color(primary);
|
|
266
232
|
}
|
|
267
233
|
}
|
|
268
234
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
235
|
+
&--endDay.cobalt-CalendarRangePicker__day--active.cobalt-CalendarRangePicker__day--invalid {
|
|
236
|
+
&:after {
|
|
237
|
+
@include border(error);
|
|
238
|
+
border-width: 2px;
|
|
273
239
|
}
|
|
274
240
|
}
|
|
275
241
|
|
|
276
|
-
//
|
|
277
|
-
&--startDay
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
.cobalt-CalendarRangePicker__day-inner {
|
|
281
|
-
@include start-range($calendar-out-of-range-color);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
242
|
+
//Start day = end day
|
|
243
|
+
&--startDay.cobalt-CalendarRangePicker__day--endDay {
|
|
244
|
+
&:before {
|
|
245
|
+
@include border(onAccent);
|
|
284
246
|
|
|
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
|
-
}
|
|
247
|
+
position: absolute;
|
|
291
248
|
|
|
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
|
-
}
|
|
249
|
+
z-index: 0;
|
|
300
250
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
&--endDay .cobalt-CalendarRangePicker__day-inner:after {
|
|
304
|
-
@include bg-color(error);
|
|
251
|
+
top: 2px;
|
|
252
|
+
left: 2px;
|
|
305
253
|
|
|
306
|
-
|
|
307
|
-
|
|
254
|
+
height: calc(100% - 4px);
|
|
255
|
+
width: calc(100% - 4px);
|
|
308
256
|
|
|
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
|
-
}
|
|
257
|
+
border-width: 2px;
|
|
316
258
|
|
|
317
|
-
|
|
318
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
319
|
-
border-right: crossMonthBorder($calendar-range-day-invalid-color);
|
|
320
|
-
}
|
|
259
|
+
box-sizing: border-box;
|
|
321
260
|
|
|
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
|
-
}
|
|
261
|
+
border-radius: 7px;
|
|
328
262
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
border-left: crossMonthBorder($calendar-range-day-invalid-color);
|
|
332
|
-
}
|
|
263
|
+
content: "";
|
|
264
|
+
}
|
|
333
265
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
.cobalt-CalendarRangePicker__day-inner:before {
|
|
338
|
-
border-left: crossMonthBorder($calendar-out-of-range-color);
|
|
266
|
+
&.cobalt-CalendarRangePicker__day--invalid:after {
|
|
267
|
+
background-color: $calendar-range-day-invalid-color;
|
|
268
|
+
}
|
|
339
269
|
}
|
|
340
270
|
}
|
|
341
271
|
|
|
272
|
+
&--isEditing
|
|
273
|
+
.cobalt-CalendarRangePicker__day:not(
|
|
274
|
+
.cobalt-CalendarRangePicker__day--disabled
|
|
275
|
+
) {
|
|
276
|
+
cursor: pointer;
|
|
277
|
+
}
|
|
278
|
+
|
|
342
279
|
&__message {
|
|
343
280
|
display: flex;
|
|
344
281
|
justify-content: center;
|
|
@@ -367,3 +304,40 @@
|
|
|
367
304
|
}
|
|
368
305
|
}
|
|
369
306
|
}
|
|
307
|
+
|
|
308
|
+
.tippy-box[data-theme~="range-picker"] {
|
|
309
|
+
@include border(base);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.tippy-box[data-theme~="range-picker"] .tippy-arrow:after {
|
|
313
|
+
position: absolute;
|
|
314
|
+
|
|
315
|
+
left: 0;
|
|
316
|
+
|
|
317
|
+
z-index: -1;
|
|
318
|
+
|
|
319
|
+
border-color: transparent;
|
|
320
|
+
border-style: solid;
|
|
321
|
+
|
|
322
|
+
color: color-var(stroke, base);
|
|
323
|
+
|
|
324
|
+
content: "";
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.tippy-box[data-theme~="range-picker"][data-placement^="top"]
|
|
328
|
+
> .tippy-arrow:after {
|
|
329
|
+
bottom: -9px;
|
|
330
|
+
|
|
331
|
+
border-width: 8px 8px 0;
|
|
332
|
+
border-top-color: initial;
|
|
333
|
+
transform-origin: center top;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.tippy-box[data-theme~="range-picker"][data-placement^="bottom"]
|
|
337
|
+
> .tippy-arrow:after {
|
|
338
|
+
top: -9px;
|
|
339
|
+
|
|
340
|
+
border-width: 0 8px 8px;
|
|
341
|
+
border-bottom-color: initial;
|
|
342
|
+
transform-origin: center bottom;
|
|
343
|
+
}
|
|
@@ -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;
|