@homebound/beam 2.137.2 → 2.137.5
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/dist/components/ButtonDatePicker.d.ts +1 -1
- package/dist/components/ButtonDatePicker.js +1 -1
- package/dist/components/internal/DatePicker/DatePicker.css +315 -0
- package/dist/components/internal/{DatePicker.d.ts → DatePicker/DatePicker.d.ts} +3 -3
- package/dist/components/internal/DatePicker/DatePicker.js +24 -0
- package/dist/components/internal/{DatePickerOverlay.d.ts → DatePicker/DatePickerOverlay.d.ts} +0 -0
- package/dist/components/internal/DatePicker/DatePickerOverlay.js +17 -0
- package/dist/components/internal/DatePicker/Day.d.ts +3 -0
- package/dist/components/internal/DatePicker/Day.js +40 -0
- package/dist/components/internal/DatePicker/Header.d.ts +2 -0
- package/dist/components/internal/DatePicker/Header.js +14 -0
- package/dist/components/internal/DatePicker/WeekHeader.d.ts +1 -0
- package/dist/components/internal/DatePicker/WeekHeader.js +16 -0
- package/dist/components/internal/DatePicker/index.d.ts +2 -0
- package/dist/components/internal/DatePicker/index.js +14 -0
- package/dist/components/internal/index.d.ts +1 -0
- package/dist/components/internal/index.js +1 -0
- package/dist/inputs/DateField.d.ts +2 -2
- package/dist/inputs/DateField.js +14 -7
- package/package.json +4 -4
- package/dist/components/internal/DatePicker.css +0 -186
- package/dist/components/internal/DatePicker.js +0 -57
- package/dist/components/internal/DatePickerOverlay.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatePickerProps } from "./internal/DatePicker";
|
|
1
|
+
import { DatePickerProps } from "./internal/DatePicker/DatePicker";
|
|
2
2
|
import { OverlayTriggerProps } from "./internal/OverlayTrigger";
|
|
3
3
|
interface ButtonDatePickerProps extends DatePickerProps, Pick<OverlayTriggerProps, "trigger" | "placement" | "disabled" | "tooltip"> {
|
|
4
4
|
defaultOpen?: boolean;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_aria_1 = require("react-aria");
|
|
7
7
|
const react_stately_1 = require("react-stately");
|
|
8
|
-
const DatePickerOverlay_1 = require("./internal/DatePickerOverlay");
|
|
8
|
+
const DatePickerOverlay_1 = require("./internal/DatePicker/DatePickerOverlay");
|
|
9
9
|
const OverlayTrigger_1 = require("./internal/OverlayTrigger");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const defaultTestId_1 = require("../utils/defaultTestId");
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Modified by Beam (40 -> 32) */
|
|
3
|
+
--rdp-cell-size: 32px;
|
|
4
|
+
/* Modified by Beam (#0000ff -> LightBlue700) */
|
|
5
|
+
--rdp-accent-color: rgba(3,105,161,1);
|
|
6
|
+
--rdp-background-color: #e7edff;
|
|
7
|
+
/* Switch to dark colors for dark themes */
|
|
8
|
+
--rdp-accent-color-dark: #3003e1;
|
|
9
|
+
--rdp-background-color-dark: #180270;
|
|
10
|
+
/* Outline border for focused elements */
|
|
11
|
+
--rdp-outline: 2px solid var(--rdp-accent-color);
|
|
12
|
+
/* Outline border for focused and selected elements */
|
|
13
|
+
/* Modified by Beam (rgba(0, 0, 0, 0.75) -> LightBlue700) */
|
|
14
|
+
--rdp-outline-selected: 2px solid rgba(3,105,161,1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.rdp {
|
|
18
|
+
/* Modified by Beam (1em -> 16px) */
|
|
19
|
+
margin: 16px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Hide elements for devices that are not screen readers */
|
|
23
|
+
.rdp-vhidden {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
padding: 0;
|
|
26
|
+
margin: 0;
|
|
27
|
+
background: transparent;
|
|
28
|
+
border: 0;
|
|
29
|
+
-moz-appearance: none;
|
|
30
|
+
-webkit-appearance: none;
|
|
31
|
+
appearance: none;
|
|
32
|
+
position: absolute !important;
|
|
33
|
+
top: 0;
|
|
34
|
+
width: 1px !important;
|
|
35
|
+
height: 1px !important;
|
|
36
|
+
padding: 0 !important;
|
|
37
|
+
overflow: hidden !important;
|
|
38
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
39
|
+
border: 0 !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Buttons */
|
|
43
|
+
.rdp-button_reset {
|
|
44
|
+
appearance: none;
|
|
45
|
+
position: relative;
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
cursor: default;
|
|
49
|
+
color: inherit;
|
|
50
|
+
outline: none;
|
|
51
|
+
background: none;
|
|
52
|
+
font: inherit;
|
|
53
|
+
|
|
54
|
+
-moz-appearance: none;
|
|
55
|
+
-webkit-appearance: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rdp-button {
|
|
59
|
+
border: 2px solid transparent;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rdp-button[aria-disabled='true'] {
|
|
63
|
+
opacity: 0.25;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.rdp-button:not([aria-disabled='true']) {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.rdp-button:focus,
|
|
72
|
+
.rdp-button:active {
|
|
73
|
+
color: inherit;
|
|
74
|
+
border: var(--rdp-outline);
|
|
75
|
+
background-color: var(--rdp-background-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.rdp-button:hover:not([aria-disabled='true']) {
|
|
79
|
+
background-color: var(--rdp-background-color);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rdp-months {
|
|
83
|
+
display: flex;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.rdp-month {
|
|
87
|
+
margin: 0 1em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.rdp-month:first-child {
|
|
91
|
+
margin-left: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rdp-month:last-child {
|
|
95
|
+
margin-right: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rdp-table {
|
|
99
|
+
margin: 0;
|
|
100
|
+
max-width: calc(var(--rdp-cell-size) * 7);
|
|
101
|
+
border-collapse: collapse;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.rdp-with_weeknumber .rdp-table {
|
|
105
|
+
max-width: calc(var(--rdp-cell-size) * 8);
|
|
106
|
+
border-collapse: collapse;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.rdp-caption {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
padding: 0;
|
|
114
|
+
text-align: left;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.rdp-multiple_months .rdp-caption {
|
|
118
|
+
position: relative;
|
|
119
|
+
display: block;
|
|
120
|
+
text-align: center;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.rdp-caption_dropdowns {
|
|
124
|
+
position: relative;
|
|
125
|
+
display: inline-flex;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.rdp-caption_label {
|
|
129
|
+
position: relative;
|
|
130
|
+
z-index: 1;
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
margin: 0;
|
|
134
|
+
padding: 0 0.25em;
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
color: currentColor;
|
|
137
|
+
border: 0;
|
|
138
|
+
border: 2px solid transparent;
|
|
139
|
+
font-family: inherit;
|
|
140
|
+
font-size: 140%;
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.rdp-nav {
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.rdp-multiple_months .rdp-caption_start .rdp-nav {
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 50%;
|
|
151
|
+
left: 0;
|
|
152
|
+
transform: translateY(-50%);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.rdp-multiple_months .rdp-caption_end .rdp-nav {
|
|
156
|
+
position: absolute;
|
|
157
|
+
top: 50%;
|
|
158
|
+
right: 0;
|
|
159
|
+
transform: translateY(-50%);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.rdp-nav_button {
|
|
163
|
+
display: inline-flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
width: var(--rdp-cell-size);
|
|
167
|
+
height: var(--rdp-cell-size);
|
|
168
|
+
padding: 0.25em;
|
|
169
|
+
border-radius: 100%;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* ---------- */
|
|
173
|
+
/* Dropdowns */
|
|
174
|
+
/* ---------- */
|
|
175
|
+
|
|
176
|
+
.rdp-dropdown_year,
|
|
177
|
+
.rdp-dropdown_month {
|
|
178
|
+
position: relative;
|
|
179
|
+
display: inline-flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.rdp-dropdown {
|
|
184
|
+
appearance: none;
|
|
185
|
+
position: absolute;
|
|
186
|
+
z-index: 2;
|
|
187
|
+
top: 0;
|
|
188
|
+
bottom: 0;
|
|
189
|
+
left: 0;
|
|
190
|
+
width: 100%;
|
|
191
|
+
margin: 0;
|
|
192
|
+
padding: 0;
|
|
193
|
+
cursor: inherit;
|
|
194
|
+
opacity: 0;
|
|
195
|
+
border: none;
|
|
196
|
+
background-color: transparent;
|
|
197
|
+
font-family: inherit;
|
|
198
|
+
font-size: inherit;
|
|
199
|
+
line-height: inherit;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.rdp-dropdown[disabled] {
|
|
203
|
+
opacity: unset;
|
|
204
|
+
color: unset;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.rdp-dropdown:focus:not([disabled]) + .rdp-caption_label,
|
|
208
|
+
.rdp-dropdown:active:not([disabled]) + .rdp-caption_label {
|
|
209
|
+
border: var(--rdp-outline);
|
|
210
|
+
border-radius: 6px;
|
|
211
|
+
background-color: var(--rdp-background-color);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.rdp-dropdown_icon {
|
|
215
|
+
margin: 0 0 0 5px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.rdp-head {
|
|
219
|
+
border: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.rdp-head_row,
|
|
223
|
+
.rdp-row {
|
|
224
|
+
height: 100%;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.rdp-head_cell {
|
|
228
|
+
vertical-align: middle;
|
|
229
|
+
text-transform: uppercase;
|
|
230
|
+
font-size: 0.75em;
|
|
231
|
+
font-weight: 700;
|
|
232
|
+
text-align: center;
|
|
233
|
+
height: 100%;
|
|
234
|
+
height: var(--rdp-cell-size);
|
|
235
|
+
padding: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.rdp-tbody {
|
|
239
|
+
border: 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.rdp-tfoot {
|
|
243
|
+
margin: 0.5em;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.rdp-cell {
|
|
247
|
+
width: var(--rdp-cell-size);
|
|
248
|
+
height: 100%;
|
|
249
|
+
height: var(--rdp-cell-size);
|
|
250
|
+
padding: 0;
|
|
251
|
+
text-align: center;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.rdp-weeknumber {
|
|
255
|
+
font-size: 0.75em;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.rdp-weeknumber,
|
|
259
|
+
.rdp-day {
|
|
260
|
+
display: flex;
|
|
261
|
+
overflow: hidden;
|
|
262
|
+
align-items: center;
|
|
263
|
+
justify-content: center;
|
|
264
|
+
box-sizing: border-box;
|
|
265
|
+
width: var(--rdp-cell-size);
|
|
266
|
+
max-width: var(--rdp-cell-size);
|
|
267
|
+
height: var(--rdp-cell-size);
|
|
268
|
+
margin: 0;
|
|
269
|
+
border: 2px solid transparent;
|
|
270
|
+
border-radius: 100%;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.rdp-day_today:not(.rdp-day_outside) {
|
|
274
|
+
font-weight: bold;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.rdp-day_selected:not([aria-disabled='true']),
|
|
278
|
+
.rdp-day_selected:focus:not([aria-disabled='true']),
|
|
279
|
+
.rdp-day_selected:active:not([aria-disabled='true']),
|
|
280
|
+
.rdp-day_selected:hover:not([aria-disabled='true']) {
|
|
281
|
+
color: white;
|
|
282
|
+
background-color: var(--rdp-accent-color);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.rdp-day_selected:focus:not([aria-disabled='true']) {
|
|
286
|
+
border: var(--rdp-outline-selected);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.rdp:not([dir='rtl']) .rdp-day_range_start:not(.rdp-day_range_end) {
|
|
290
|
+
border-top-right-radius: 0;
|
|
291
|
+
border-bottom-right-radius: 0;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.rdp:not([dir='rtl']) .rdp-day_range_end:not(.rdp-day_range_start) {
|
|
295
|
+
border-top-left-radius: 0;
|
|
296
|
+
border-bottom-left-radius: 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.rdp[dir='rtl'] .rdp-day_range_start:not(.rdp-day_range_end) {
|
|
300
|
+
border-top-left-radius: 0;
|
|
301
|
+
border-bottom-left-radius: 0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.rdp[dir='rtl'] .rdp-day_range_end:not(.rdp-day_range_start) {
|
|
305
|
+
border-top-right-radius: 0;
|
|
306
|
+
border-bottom-right-radius: 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.rdp-day_range_end.rdp-day_range_start {
|
|
310
|
+
border-radius: 100%;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.rdp-day_range_middle {
|
|
314
|
+
border-radius: 0;
|
|
315
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Matcher } from "react-day-picker";
|
|
2
2
|
import "./DatePicker.css";
|
|
3
3
|
export interface DatePickerProps {
|
|
4
4
|
value?: Date;
|
|
5
5
|
onSelect: (value: Date) => void;
|
|
6
|
-
disabledDays?:
|
|
7
|
-
dottedDays?:
|
|
6
|
+
disabledDays?: Matcher | Matcher[];
|
|
7
|
+
dottedDays?: Matcher[];
|
|
8
8
|
}
|
|
9
9
|
export declare function DatePicker(props: DatePickerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatePicker = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_day_picker_1 = require("react-day-picker");
|
|
6
|
+
const Day_1 = require("./Day");
|
|
7
|
+
const Header_1 = require("./Header");
|
|
8
|
+
const WeekHeader_1 = require("./WeekHeader");
|
|
9
|
+
const Css_1 = require("../../../Css");
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
require("./DatePicker.css");
|
|
12
|
+
function DatePicker(props) {
|
|
13
|
+
const { value, onSelect, disabledDays, dottedDays } = props;
|
|
14
|
+
const tid = (0, utils_1.useTestIds)(props, "datePicker");
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.dib.bgWhite.xs.$ }, tid, { children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { components: { Caption: Header_1.Header, Head: WeekHeader_1.WeekHeader, Day: Day_1.Day },
|
|
16
|
+
// DatePicker only allows for a single date to be `selected` (per our props) though DayPicker expects an array of dates
|
|
17
|
+
selected: value ? [value] : [], defaultMonth: value !== null && value !== void 0 ? value : new Date(), onDayClick: (day, modifiers) => {
|
|
18
|
+
if (modifiers.disabled)
|
|
19
|
+
return;
|
|
20
|
+
// Set the day value
|
|
21
|
+
onSelect(day);
|
|
22
|
+
}, disabled: disabledDays, modifiers: { indicatorDot: dottedDays !== null && dottedDays !== void 0 ? dottedDays : [] } }, void 0) }), void 0));
|
|
23
|
+
}
|
|
24
|
+
exports.DatePicker = DatePicker;
|
package/dist/components/internal/{DatePickerOverlay.d.ts → DatePicker/DatePickerOverlay.d.ts}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatePickerOverlay = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const DatePicker_1 = require("./DatePicker");
|
|
6
|
+
const Css_1 = require("../../../Css");
|
|
7
|
+
// Small wrapper around DatePicker to provide necessary styling and state handling when displayed as an overlay.
|
|
8
|
+
function DatePickerOverlay({ overlayProps, state, ...datePickerProps }) {
|
|
9
|
+
return (
|
|
10
|
+
// Adds `tabIndex` so clicking within the DatePicker will provide a `e.relatedTarget` on blur and focus events.
|
|
11
|
+
// This allows for components such as the DateField to conditionally trigger their 'onBlur' prop. E.g. If the user leaves the field to interact with the DatePicker, then don't call onBlur
|
|
12
|
+
(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.br4.bshModal.$ }, overlayProps, { tabIndex: 0 }, { children: (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, Object.assign({}, datePickerProps, { onSelect: (d) => {
|
|
13
|
+
datePickerProps.onSelect(d);
|
|
14
|
+
state.close();
|
|
15
|
+
} }), void 0) }), void 0));
|
|
16
|
+
}
|
|
17
|
+
exports.DatePickerOverlay = DatePickerOverlay;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Day = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_day_picker_1 = require("react-day-picker");
|
|
7
|
+
const Css_1 = require("../../../Css");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
/** Follows the same pattern as defined by the React-Day-Picker 'Day' component, plus sprinkling our own styling */
|
|
10
|
+
function Day(props) {
|
|
11
|
+
// Was hoping we could pass the `datePicker` testid through, but was breaking something.
|
|
12
|
+
const tid = (0, utils_1.useTestIds)(props, "datePickerDay");
|
|
13
|
+
const buttonRef = (0, react_1.useRef)(null);
|
|
14
|
+
const { isHidden, isButton, activeModifiers, buttonProps, divProps } = (0, react_day_picker_1.useDayRender)(props.date, props.displayMonth, buttonRef);
|
|
15
|
+
if (isHidden) {
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
|
|
17
|
+
}
|
|
18
|
+
if (!isButton) {
|
|
19
|
+
return (0, jsx_runtime_1.jsx)("div", Object.assign({}, divProps), void 0);
|
|
20
|
+
}
|
|
21
|
+
const { className, children, ...otherProps } = buttonProps;
|
|
22
|
+
const { selected = false, indicatorDot = false, disabled = false, today = false } = activeModifiers;
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("button", Object.assign({}, otherProps, { ref: buttonRef, type: "button", css: {
|
|
24
|
+
...Css_1.Css.overflowHidden.pbPx(4).if(disabled).cursorNotAllowed.$,
|
|
25
|
+
// Do not apply interaction styles for disabled or already selected days.
|
|
26
|
+
...(!selected &&
|
|
27
|
+
!disabled && {
|
|
28
|
+
"&:hover:not(:active) > div": Css_1.Css.bgGray100.$,
|
|
29
|
+
"&:active > div": Css_1.Css.bgGray400.$,
|
|
30
|
+
}),
|
|
31
|
+
} }, tid, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: {
|
|
32
|
+
...Css_1.Css.relative.br4.df.aic.jcc.wPx(28).hPx(30).mtPx(2).br4.$,
|
|
33
|
+
...(selected && Css_1.Css.white.bgLightBlue700.$),
|
|
34
|
+
...(disabled && Css_1.Css.gray500.$),
|
|
35
|
+
...(today && Css_1.Css.bgGray100.$),
|
|
36
|
+
} }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.mtPx(-2).$ }, { children: children }), void 0), indicatorDot && ((0, jsx_runtime_1.jsx)("div", Object.assign({
|
|
37
|
+
// Using `absolute` position as to not change the placement of the day's number when this is introduced
|
|
38
|
+
css: Css_1.Css.absolute.bottomPx(4).wPx(4).hPx(4).bgLightBlue700.br4.if(selected).bgWhite.$ }, tid.indicatorDot), void 0))] }), void 0) }), void 0));
|
|
39
|
+
}
|
|
40
|
+
exports.Day = Day;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const date_fns_1 = require("date-fns");
|
|
6
|
+
const react_day_picker_1 = require("react-day-picker");
|
|
7
|
+
const IconButton_1 = require("../../IconButton");
|
|
8
|
+
const Css_1 = require("../../../Css");
|
|
9
|
+
function Header(props) {
|
|
10
|
+
const { displayMonth } = props;
|
|
11
|
+
const { goToMonth } = (0, react_day_picker_1.useNavigation)();
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.jcsb.aic.mlPx(12).mrPx(2).hPx(32).$ }, { children: [(0, jsx_runtime_1.jsx)("h1", Object.assign({ css: Css_1.Css.base.$ }, { children: (0, date_fns_1.format)(displayMonth, "MMMM yyyy") }), void 0), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { color: Css_1.Palette.Gray700, icon: "chevronLeft", onClick: () => goToMonth((0, date_fns_1.addMonths)(displayMonth, -1)) }, void 0), (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { color: Css_1.Palette.Gray700, icon: "chevronRight", onClick: () => goToMonth((0, date_fns_1.addMonths)(displayMonth, 1)) }, void 0)] }, void 0)] }), void 0));
|
|
13
|
+
}
|
|
14
|
+
exports.Header = Header;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function WeekHeader(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeekHeader = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const date_fns_1 = require("date-fns");
|
|
6
|
+
const Css_1 = require("../../../Css");
|
|
7
|
+
function WeekHeader() {
|
|
8
|
+
const start = (0, date_fns_1.startOfWeek)(new Date());
|
|
9
|
+
const days = [];
|
|
10
|
+
for (let i = 0; i < 7; i++) {
|
|
11
|
+
days.push((0, date_fns_1.addDays)(start, i));
|
|
12
|
+
}
|
|
13
|
+
// Copies the existing structure and classes defined by React-Day-Picker. Adds in Beam styling and formatting.
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("thead", Object.assign({ className: "rdp-head" }, { children: (0, jsx_runtime_1.jsx)("tr", Object.assign({ className: "rdp-head_row" }, { children: days.map((day) => ((0, jsx_runtime_1.jsxs)("th", Object.assign({ scope: "col", css: Css_1.Css.p1.pbPx(12).xs.gray400.$ }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ "aria-hidden": "true" }, { children: (0, date_fns_1.format)(day, "EEEEE") }), void 0), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "rdp-vhidden" }, { children: (0, date_fns_1.format)(day, "EEEE") }), void 0)] }), (0, date_fns_1.format)(day, "EEEE")))) }), void 0) }), void 0));
|
|
15
|
+
}
|
|
16
|
+
exports.WeekHeader = WeekHeader;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./DatePicker"), exports);
|
|
14
|
+
__exportStar(require("./DatePickerOverlay"), exports);
|
|
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./DatePicker"), exports);
|
|
13
14
|
__exportStar(require("./Menu"), exports);
|
|
14
15
|
__exportStar(require("./MenuItem"), exports);
|
|
15
16
|
__exportStar(require("./MenuSection"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Matcher } from "react-day-picker";
|
|
3
3
|
import { TextFieldBaseProps } from "./TextFieldBase";
|
|
4
4
|
export interface DateFieldProps extends Pick<TextFieldBaseProps<{}>, "borderless" | "visuallyDisabled" | "hideLabel" | "compact"> {
|
|
5
5
|
value: Date | undefined;
|
|
@@ -25,7 +25,7 @@ export interface DateFieldProps extends Pick<TextFieldBaseProps<{}>, "borderless
|
|
|
25
25
|
* Set custom logic for individual dates or date ranges to be disabled in the picker
|
|
26
26
|
* exposed from `react-day-picker`: https://react-day-picker.js.org/api/DayPicker#modifiers
|
|
27
27
|
*/
|
|
28
|
-
disabledDays?:
|
|
28
|
+
disabledDays?: Matcher | Matcher[];
|
|
29
29
|
onEnter?: VoidFunction;
|
|
30
30
|
defaultOpen?: boolean;
|
|
31
31
|
}
|
package/dist/inputs/DateField.js
CHANGED
|
@@ -5,11 +5,10 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
5
5
|
const date_fns_1 = require("date-fns");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const react_aria_1 = require("react-aria");
|
|
8
|
-
const react_day_picker_1 = require("react-day-picker");
|
|
9
8
|
const react_stately_1 = require("react-stately");
|
|
10
9
|
const components_1 = require("../components");
|
|
11
10
|
const internal_1 = require("../components/internal");
|
|
12
|
-
const DatePickerOverlay_1 = require("../components/internal/DatePickerOverlay");
|
|
11
|
+
const DatePickerOverlay_1 = require("../components/internal/DatePicker/DatePickerOverlay");
|
|
13
12
|
const Css_1 = require("../Css");
|
|
14
13
|
const TextFieldBase_1 = require("./TextFieldBase");
|
|
15
14
|
const utils_1 = require("../utils");
|
|
@@ -20,19 +19,22 @@ function DateField(props) {
|
|
|
20
19
|
const inputWrapRef = (0, react_1.useRef)(null);
|
|
21
20
|
const buttonRef = (0, react_1.useRef)(null);
|
|
22
21
|
const overlayRef = (0, react_1.useRef)(null);
|
|
23
|
-
// Local focus state
|
|
22
|
+
// Local focus state to conditionally call onBlur when the date picker closes.
|
|
23
|
+
// E.g. If the picker closes due to focus going back to the input field then don't call onBlur. Also used to avoid updating WIP values
|
|
24
24
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
25
25
|
const dateFormat = getDateFormat(format);
|
|
26
26
|
const [inputValue, setInputValue] = (0, react_1.useState)(value ? formatDate(value, dateFormat) : "");
|
|
27
27
|
const tid = (0, utils_1.useTestIds)(props, (0, defaultTestId_1.defaultTestId)(label));
|
|
28
28
|
const isDisabled = !!disabled;
|
|
29
29
|
const isReadOnly = !!readOnly;
|
|
30
|
+
// Handle case where the input value is updated from outside the component.
|
|
30
31
|
(0, react_1.useEffect)(() => {
|
|
31
32
|
// Avoid updating any WIP values.
|
|
32
33
|
if (!isFocused) {
|
|
33
34
|
setInputValue(value ? formatDate(value, dateFormat) : "");
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps - Do not include `isFocused`, we don't want to update the internal `inputValue` back to `value` just because focus state changes
|
|
37
|
+
}, [value, dateFormat]);
|
|
36
38
|
const textFieldProps = {
|
|
37
39
|
...others,
|
|
38
40
|
label,
|
|
@@ -70,10 +72,15 @@ function DateField(props) {
|
|
|
70
72
|
(overlayRef.current && overlayRef.current.contains(e.relatedTarget))) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
75
|
+
const parsedDate = parseDate(inputValue, dateFormats.short);
|
|
73
76
|
// If the user leaves the input and has an invalid date, reset to previous value.
|
|
74
|
-
if (!
|
|
77
|
+
if (!parsedDate) {
|
|
75
78
|
setInputValue(value ? formatDate(value, dateFormat) : "");
|
|
76
79
|
}
|
|
80
|
+
else if (dateFormat !== dateFormats.short) {
|
|
81
|
+
// Or if we need to reset the dateFormat back from `short` to whatever the user specified
|
|
82
|
+
setInputValue(formatDate(parsedDate, dateFormat));
|
|
83
|
+
}
|
|
77
84
|
state.close();
|
|
78
85
|
(0, utils_1.maybeCall)(onBlur);
|
|
79
86
|
},
|
|
@@ -106,7 +113,7 @@ function DateField(props) {
|
|
|
106
113
|
// If showing the short date format, "01/01/20", so set size to 8. If medium (Wed, Nov 23) use 10 characters (leaving out the `,` character in the count because it is so small)
|
|
107
114
|
// Otherwise the long format can be `undefined`.
|
|
108
115
|
// Setting the size attribute only impacts the fields when displayed in a container that doesn't allow the field to grow to its max width, such as in an inline container.
|
|
109
|
-
// TODO: figure this out... seems weird to have now that we support multiple dates....
|
|
116
|
+
// TODO: figure this out... seems weird to have now that we support multiple dates formats....
|
|
110
117
|
// How do other applications handle this defined sizing? Appears they use hard coded widths depending on format, which is similar here (using `size` instead of css `width`).
|
|
111
118
|
// But would also need to allow for the input to be `fullWidth`, which is basically also what we're accomplishing here... so maybe fine?
|
|
112
119
|
const inputSize = format === "short" ? 8 : format === "medium" ? 10 : undefined;
|
|
@@ -156,7 +163,7 @@ function parseDate(str, format) {
|
|
|
156
163
|
return undefined;
|
|
157
164
|
}
|
|
158
165
|
const parsed = (0, date_fns_1.parse)(str, format, new Date());
|
|
159
|
-
if (!
|
|
166
|
+
if (!(0, date_fns_1.isDate)(parsed)) {
|
|
160
167
|
return undefined;
|
|
161
168
|
}
|
|
162
169
|
return parsed;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebound/beam",
|
|
3
|
-
"version": "2.137.
|
|
3
|
+
"version": "2.137.5",
|
|
4
4
|
"author": "Homebound",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"format": "prettier --loglevel warn --write \"**/*.{ts,tsx,css,md}\""
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@homebound/form-state": "2.15.
|
|
35
|
+
"@homebound/form-state": "^2.15.2",
|
|
36
36
|
"@internationalized/number": "^3.0.3",
|
|
37
37
|
"@react-aria/utils": "^3.11.3",
|
|
38
38
|
"@react-hook/resize-observer": "^1.2.2",
|
|
39
39
|
"change-case": "^4.1.2",
|
|
40
|
-
"date-fns": "^2.
|
|
40
|
+
"date-fns": "^2.28.0",
|
|
41
41
|
"dompurify": "^2.3.0",
|
|
42
42
|
"fast-deep-equal": "^3.1.3",
|
|
43
43
|
"framer-motion": "^4.1.11",
|
|
44
44
|
"memoize-one": "^5.2.1",
|
|
45
45
|
"react-aria": "^3.14.1",
|
|
46
|
-
"react-day-picker": "^
|
|
46
|
+
"react-day-picker": "^8.0.6",
|
|
47
47
|
"react-popper": "^2.2.5",
|
|
48
48
|
"react-router": "^5.2.0",
|
|
49
49
|
"react-router-dom": "^5.2.0",
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
We don't usually do BEM/css files, but this is copy/pasted from react-day-picker
|
|
3
|
-
with most of our local changes being deletions. Most CSS additions we do via truss
|
|
4
|
-
in the DateField.tsx file, but doing deletions here means we can do avoid using
|
|
5
|
-
`important!` for things we want to override.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
.DayPicker {
|
|
9
|
-
display: inline-block;
|
|
10
|
-
font-size: 1rem;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.DayPicker-wrapper {
|
|
14
|
-
position: relative;
|
|
15
|
-
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
padding-bottom: 1em;
|
|
18
|
-
-webkit-user-select: none;
|
|
19
|
-
-moz-user-select: none;
|
|
20
|
-
-ms-user-select: none;
|
|
21
|
-
user-select: none;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.DayPicker-Months {
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-wrap: wrap;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.DayPicker-Month {
|
|
31
|
-
display: table;
|
|
32
|
-
margin: 0 1em;
|
|
33
|
-
margin-top: 1em;
|
|
34
|
-
border-spacing: 0;
|
|
35
|
-
border-collapse: collapse;
|
|
36
|
-
-webkit-user-select: none;
|
|
37
|
-
-moz-user-select: none;
|
|
38
|
-
-ms-user-select: none;
|
|
39
|
-
user-select: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.DayPicker-NavBar {
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.DayPicker-NavButton {
|
|
46
|
-
position: absolute;
|
|
47
|
-
top: 1em;
|
|
48
|
-
right: 1.5em;
|
|
49
|
-
left: auto;
|
|
50
|
-
|
|
51
|
-
display: inline-block;
|
|
52
|
-
margin-top: 2px;
|
|
53
|
-
width: 1.25em;
|
|
54
|
-
height: 1.25em;
|
|
55
|
-
background-position: center;
|
|
56
|
-
background-size: 50%;
|
|
57
|
-
background-repeat: no-repeat;
|
|
58
|
-
color: #8b9898;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.DayPicker-NavButton:hover {
|
|
63
|
-
opacity: 0.8;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.DayPicker-NavButton--interactionDisabled {
|
|
67
|
-
display: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.DayPicker-Caption {
|
|
71
|
-
display: table-caption;
|
|
72
|
-
margin-bottom: 0.5em;
|
|
73
|
-
padding: 0 0.5em;
|
|
74
|
-
text-align: left;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.DayPicker-Weekdays {
|
|
78
|
-
display: table-header-group;
|
|
79
|
-
margin-top: 1em;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.DayPicker-WeekdaysRow {
|
|
83
|
-
display: table-row;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.DayPicker-Weekday {
|
|
87
|
-
display: table-cell;
|
|
88
|
-
padding: 0.5em;
|
|
89
|
-
color: #8b9898;
|
|
90
|
-
text-align: center;
|
|
91
|
-
font-size: 0.875em;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.DayPicker-Weekday abbr[title] {
|
|
95
|
-
border-bottom: none;
|
|
96
|
-
text-decoration: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.DayPicker-Body {
|
|
100
|
-
display: table-row-group;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.DayPicker-Week {
|
|
104
|
-
display: table-row;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.DayPicker-Day {
|
|
108
|
-
display: table-cell;
|
|
109
|
-
padding: 0.5em;
|
|
110
|
-
border-radius: 50%;
|
|
111
|
-
vertical-align: middle;
|
|
112
|
-
text-align: center;
|
|
113
|
-
cursor: pointer;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.DayPicker-WeekNumber {
|
|
117
|
-
display: table-cell;
|
|
118
|
-
padding: 0.5em;
|
|
119
|
-
min-width: 1em;
|
|
120
|
-
border-right: 1px solid #eaecec;
|
|
121
|
-
color: #8b9898;
|
|
122
|
-
vertical-align: middle;
|
|
123
|
-
text-align: right;
|
|
124
|
-
font-size: 0.75em;
|
|
125
|
-
cursor: pointer;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.DayPicker--interactionDisabled .DayPicker-Day {
|
|
129
|
-
cursor: default;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.DayPicker-Footer {
|
|
133
|
-
padding-top: 0.5em;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.DayPicker-TodayButton {
|
|
137
|
-
border: none;
|
|
138
|
-
background-color: transparent;
|
|
139
|
-
background-image: none;
|
|
140
|
-
box-shadow: none;
|
|
141
|
-
color: #4a90e2;
|
|
142
|
-
font-size: 0.875em;
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/* Default modifiers */
|
|
147
|
-
|
|
148
|
-
.DayPicker-Day--outside {
|
|
149
|
-
color: #8b9898;
|
|
150
|
-
cursor: default;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.DayPicker-Day--disabled {
|
|
154
|
-
color: #dce0e0;
|
|
155
|
-
cursor: default;
|
|
156
|
-
/* background-color: #eff1f1; */
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* Example modifiers */
|
|
160
|
-
|
|
161
|
-
.DayPicker-Day--sunday {
|
|
162
|
-
background-color: #f7f8f8;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.DayPicker-Day--sunday:not(.DayPicker-Day--today) {
|
|
166
|
-
color: #dce0e0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/* DayPickerInput */
|
|
170
|
-
|
|
171
|
-
.DayPickerInput {
|
|
172
|
-
display: inline-block;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.DayPickerInput-OverlayWrapper {
|
|
176
|
-
position: relative;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.DayPickerInput-Overlay {
|
|
180
|
-
position: absolute;
|
|
181
|
-
left: 0;
|
|
182
|
-
z-index: 1;
|
|
183
|
-
|
|
184
|
-
background: white;
|
|
185
|
-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
|
|
186
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DatePicker = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
8
|
-
const react_day_picker_1 = __importDefault(require("react-day-picker"));
|
|
9
|
-
const index_1 = require("../index");
|
|
10
|
-
const Css_1 = require("../../Css");
|
|
11
|
-
const utils_1 = require("../../utils");
|
|
12
|
-
require("./DatePicker.css");
|
|
13
|
-
function DatePicker(props) {
|
|
14
|
-
const { value, onSelect, disabledDays, dottedDays } = props;
|
|
15
|
-
const tid = (0, utils_1.useTestIds)(props, "datePicker");
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
|
|
17
|
-
...Css_1.Css.dib.bgWhite.xs.$,
|
|
18
|
-
// The S / M / T / W ... heading
|
|
19
|
-
"& .DayPicker-Weekday": Css_1.Css.pPx(8).xs.gray400.important.$,
|
|
20
|
-
// Un-collapse the borders so we can hover each cell
|
|
21
|
-
"& .DayPicker-Month": Css_1.Css.add({ borderCollapse: "separate" }).$,
|
|
22
|
-
// // Make the boxes smaller, this ends up being 32x32 which matches figma
|
|
23
|
-
"& .DayPicker-Day": Css_1.Css.px1.ptPx(6).pbPx(10).xs.ba.bWhite.br4.relative.$,
|
|
24
|
-
// For today, use a background
|
|
25
|
-
"& .DayPicker-Day--today": Css_1.Css.bgGray100.$,
|
|
26
|
-
// For selected, use a background - `--outside` modifier is set on placeholder days not within the viewed month
|
|
27
|
-
"& .DayPicker-Day--selected:not(.DayPicker-Day--outside)": Css_1.Css.bgLightBlue700.white.$,
|
|
28
|
-
// For pressed
|
|
29
|
-
"& .DayPicker-Day:active": Css_1.Css.bgGray400.$,
|
|
30
|
-
// Make the month title, i.e. "May 2021", match figma; pyPx nudge matches the NavbarElement nudging
|
|
31
|
-
"& .DayPicker-Caption > div": Css_1.Css.base.pyPx(2).$,
|
|
32
|
-
// For days that are disabled via `disabledDays`,
|
|
33
|
-
"& .DayPicker-Day--disabled": Css_1.Css.cursorNotAllowed.$,
|
|
34
|
-
// Override `.DayPicker-Day:active` background when the day is disabled
|
|
35
|
-
"& .DayPicker-Day--disabled:active": Css_1.Css.bgWhite.$,
|
|
36
|
-
// Display dottedDays using positioned pseudo elements.
|
|
37
|
-
"& .DayPicker-Day--indicatorDot": Css_1.Css.addIn("&:after", Css_1.Css.wPx(4).hPx(4).br4.absolute.bottomPx(5).left("calc(50% - 2px)").bgLightBlue700.add("content", "''").$).$,
|
|
38
|
-
// Update dottedDays color if day is "selected"
|
|
39
|
-
"& .DayPicker-Day--selected.DayPicker-Day--indicatorDot": Css_1.Css.addIn("&:after", Css_1.Css.bgWhite.$).$,
|
|
40
|
-
} }, tid, { children: (0, jsx_runtime_1.jsx)(react_day_picker_1.default, { navbarElement: NavbarElement, weekdayElement: Weekday, selectedDays: [value], initialMonth: value !== null && value !== void 0 ? value : new Date(), onDayClick: (day, modifiers) => {
|
|
41
|
-
if (modifiers.disabled)
|
|
42
|
-
return;
|
|
43
|
-
// Set the day value
|
|
44
|
-
onSelect(day);
|
|
45
|
-
}, disabledDays: disabledDays, modifiers: { indicatorDot: dottedDays } }, void 0) }), void 0));
|
|
46
|
-
}
|
|
47
|
-
exports.DatePicker = DatePicker;
|
|
48
|
-
/** Customize the prev/next button to be our SVG icons. */
|
|
49
|
-
function NavbarElement(props) {
|
|
50
|
-
const { showPreviousButton, showNextButton, onPreviousClick, onNextClick, classNames } = props;
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: classNames.navBar }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.absolute.top(2).right(6.5).$ }, { children: (0, jsx_runtime_1.jsx)(index_1.IconButton, { color: Css_1.Palette.Gray700, disabled: !showPreviousButton, icon: "chevronLeft", onClick: () => onPreviousClick() }, void 0) }), void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.absolute.top(2).right(3).$ }, { children: (0, jsx_runtime_1.jsx)(index_1.IconButton, { color: Css_1.Palette.Gray700, disabled: !showNextButton, icon: "chevronRight", onClick: () => onNextClick() }, void 0) }), void 0)] }), void 0));
|
|
52
|
-
}
|
|
53
|
-
/** Customize the weekday names to be only the first letter. */
|
|
54
|
-
function Weekday({ weekday, className, localeUtils, locale }) {
|
|
55
|
-
const weekdayName = localeUtils.formatWeekdayLong(weekday, locale);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: className, title: weekdayName }, { children: weekdayName.slice(0, 1) }), void 0));
|
|
57
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DatePickerOverlay = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const DatePicker_1 = require("./DatePicker");
|
|
6
|
-
const Css_1 = require("../../Css");
|
|
7
|
-
// Small wrapper around DatePicker to provide necessary styling and state handling when displayed as an overlay.
|
|
8
|
-
function DatePickerOverlay({ overlayProps, state, ...datePickerProps }) {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.br4.bshModal.$ }, overlayProps, { children: (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, Object.assign({}, datePickerProps, { onSelect: (d) => {
|
|
10
|
-
datePickerProps.onSelect(d);
|
|
11
|
-
state.close();
|
|
12
|
-
} }), void 0) }), void 0));
|
|
13
|
-
}
|
|
14
|
-
exports.DatePickerOverlay = DatePickerOverlay;
|