@zendeskgarden/react-datepickers 9.0.0-next.9 → 9.1.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/dist/esm/elements/DatePicker/DatePicker.js +19 -15
- package/dist/esm/elements/DatePicker/components/Calendar.js +12 -12
- package/dist/esm/elements/DatePicker/components/MonthSelector.js +4 -4
- package/dist/esm/elements/DatePickerRange/components/Calendar.js +1 -1
- package/dist/esm/elements/DatePickerRange/components/Month.js +26 -26
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-left-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-right-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledCalendar.js +4 -6
- package/dist/esm/styled/StyledCalendarItem.js +8 -10
- package/dist/esm/styled/StyledDatePicker.js +19 -14
- package/dist/esm/styled/StyledDay.js +71 -33
- package/dist/esm/styled/StyledDayLabel.js +4 -6
- package/dist/esm/styled/StyledHeader.js +4 -6
- package/dist/esm/styled/StyledHeaderLabel.js +4 -6
- package/dist/esm/styled/StyledHeaderPaddle.js +45 -15
- package/dist/esm/styled/StyledHighlight.js +26 -23
- package/dist/esm/styled/StyledMenu.js +2 -5
- package/dist/esm/styled/StyledMenuWrapper.js +8 -9
- package/dist/esm/styled/StyledRangeCalendar.js +3 -5
- package/dist/index.cjs.js +248 -184
- package/dist/typings/elements/DatePicker/utils/date-picker-reducer.d.ts +4 -4
- package/dist/typings/elements/DatePicker/utils/useDatePickerContext.d.ts +0 -1
- package/dist/typings/elements/DatePickerRange/DatePickerRange.d.ts +4 -2
- package/dist/typings/elements/DatePickerRange/utils/date-picker-range-reducer.d.ts +4 -4
- package/dist/typings/styled/StyledCalendar.d.ts +3 -2
- package/dist/typings/styled/StyledCalendarItem.d.ts +4 -3
- package/dist/typings/styled/StyledDatePicker.d.ts +3 -2
- package/dist/typings/styled/StyledDay.d.ts +5 -5
- package/dist/typings/styled/StyledDayLabel.d.ts +3 -2
- package/dist/typings/styled/StyledHeader.d.ts +3 -2
- package/dist/typings/styled/StyledHeaderLabel.d.ts +3 -2
- package/dist/typings/styled/StyledHeaderPaddle.d.ts +7 -4
- package/dist/typings/styled/StyledHighlight.d.ts +5 -4
- package/dist/typings/styled/StyledMenuWrapper.d.ts +4 -4
- package/dist/typings/styled/StyledRangeCalendar.d.ts +2 -1
- package/dist/typings/types/index.d.ts +2 -0
- package/package.json +7 -7
package/dist/index.cjs.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var React = require('react');
|
|
10
|
+
var reactDom$1 = require('react-dom');
|
|
10
11
|
var PropTypes = require('prop-types');
|
|
11
12
|
var reactMergeRefs = require('react-merge-refs');
|
|
12
13
|
var styled = require('styled-components');
|
|
@@ -62,134 +63,157 @@ const PLACEMENT = ['auto', ...reactTheming.PLACEMENT];
|
|
|
62
63
|
const COMPONENT_ID$b = 'datepickers.menu';
|
|
63
64
|
const StyledMenu = styled__default.default.div.attrs({
|
|
64
65
|
'data-garden-id': COMPONENT_ID$b,
|
|
65
|
-
'data-garden-version': '9.
|
|
66
|
+
'data-garden-version': '9.1.0'
|
|
66
67
|
}).withConfig({
|
|
67
68
|
displayName: "StyledMenu",
|
|
68
69
|
componentId: "sc-1npbkk0-0"
|
|
69
70
|
})(["", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props));
|
|
70
|
-
StyledMenu.defaultProps = {
|
|
71
|
-
theme: reactTheming.DEFAULT_THEME
|
|
72
|
-
};
|
|
73
71
|
|
|
74
72
|
const COMPONENT_ID$a = 'datepickers.menu_wrapper';
|
|
75
73
|
const StyledMenuWrapper = styled__default.default.div.attrs(props => ({
|
|
76
|
-
|
|
74
|
+
'data-garden-id': COMPONENT_ID$a,
|
|
75
|
+
'data-garden-version': '9.1.0',
|
|
76
|
+
className: props.$isAnimated && 'is-animated'
|
|
77
77
|
})).withConfig({
|
|
78
78
|
displayName: "StyledMenuWrapper",
|
|
79
79
|
componentId: "sc-6fowoz-0"
|
|
80
|
-
})(["top:0;left:0;", ";", ";"], props => reactTheming.menuStyles(reactTheming.getMenuPosition(props
|
|
80
|
+
})(["top:0;left:0;", ";", ";"], props => reactTheming.menuStyles(reactTheming.getMenuPosition(props.$placement), {
|
|
81
81
|
theme: props.theme,
|
|
82
|
-
hidden: props
|
|
82
|
+
hidden: props['aria-hidden'],
|
|
83
83
|
margin: `${props.theme.space.base}px`,
|
|
84
|
-
zIndex: props
|
|
85
|
-
animationModifier: props
|
|
84
|
+
zIndex: props.$zIndex,
|
|
85
|
+
animationModifier: props.$isAnimated ? '.is-animated' : undefined
|
|
86
86
|
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
87
|
-
StyledMenuWrapper.defaultProps = {
|
|
88
|
-
theme: reactTheming.DEFAULT_THEME
|
|
89
|
-
};
|
|
90
87
|
|
|
91
88
|
const COMPONENT_ID$9 = 'datepickers.datepicker';
|
|
92
|
-
const
|
|
89
|
+
const sizeStyles$4 = _ref => {
|
|
93
90
|
let {
|
|
94
|
-
isCompact,
|
|
91
|
+
$isCompact,
|
|
95
92
|
theme
|
|
96
93
|
} = _ref;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
const margin = theme.space.base * ($isCompact ? 4 : 5);
|
|
95
|
+
return styled.css(["margin:", "px;"], margin);
|
|
96
|
+
};
|
|
97
|
+
const colorStyles$3 = _ref2 => {
|
|
98
|
+
let {
|
|
99
|
+
theme
|
|
100
|
+
} = _ref2;
|
|
101
|
+
const foreground = reactTheming.getColor({
|
|
102
|
+
variable: 'foreground.default',
|
|
103
|
+
theme
|
|
104
|
+
});
|
|
105
|
+
return styled.css(["background-color:transparent;color:", ";"], foreground);
|
|
102
106
|
};
|
|
103
107
|
const StyledDatePicker = styled__default.default.div.attrs({
|
|
104
|
-
'data-garden-id': COMPONENT_ID$9
|
|
108
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
109
|
+
'data-garden-version': '9.1.0'
|
|
105
110
|
}).withConfig({
|
|
106
111
|
displayName: "StyledDatePicker",
|
|
107
112
|
componentId: "sc-15hwqzh-0"
|
|
108
|
-
})(["direction:", ";", "
|
|
109
|
-
StyledDatePicker.defaultProps = {
|
|
110
|
-
theme: reactTheming.DEFAULT_THEME
|
|
111
|
-
};
|
|
113
|
+
})(["direction:", ";", " ", " ", ";"], p => p.theme.rtl && 'rtl', sizeStyles$4, colorStyles$3, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
112
114
|
|
|
113
115
|
const COMPONENT_ID$8 = 'datepickers.range_calendar';
|
|
114
116
|
const StyledRangeCalendar = styled__default.default.div.attrs({
|
|
115
|
-
'data-garden-id': COMPONENT_ID$8
|
|
117
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
118
|
+
'data-garden-version': '9.1.0'
|
|
116
119
|
}).withConfig({
|
|
117
120
|
displayName: "StyledRangeCalendar",
|
|
118
121
|
componentId: "sc-1og46sy-0"
|
|
119
122
|
})(["display:flex;overflow:auto;", "{margin:0;", "}", ";"], StyledDatePicker, props => props.theme.rtl ? `&:last-of-type {margin-right: ${props.theme.space.base * 5}px}` : `&:first-of-type {margin-right: ${props.theme.space.base * 5}px}`, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
120
|
-
StyledRangeCalendar.defaultProps = {
|
|
121
|
-
theme: reactTheming.DEFAULT_THEME
|
|
122
|
-
};
|
|
123
123
|
|
|
124
124
|
const COMPONENT_ID$7 = 'datepickers.header';
|
|
125
125
|
const StyledHeader = styled__default.default.div.attrs({
|
|
126
|
-
'data-garden-id': COMPONENT_ID$7
|
|
126
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
127
|
+
'data-garden-version': '9.1.0'
|
|
127
128
|
}).withConfig({
|
|
128
129
|
displayName: "StyledHeader",
|
|
129
130
|
componentId: "sc-upq318-0"
|
|
130
|
-
})(["display:flex;width:", "px;", ";"], props => props
|
|
131
|
-
StyledHeader.defaultProps = {
|
|
132
|
-
theme: reactTheming.DEFAULT_THEME
|
|
133
|
-
};
|
|
131
|
+
})(["display:flex;width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
134
132
|
|
|
135
|
-
const
|
|
133
|
+
const sizeStyles$3 = _ref => {
|
|
136
134
|
let {
|
|
137
|
-
isCompact,
|
|
135
|
+
$isCompact,
|
|
138
136
|
theme
|
|
139
137
|
} = _ref;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
return styled.css(["width:", "px;height:", "px;"], size, size);
|
|
138
|
+
const iconSize = theme.iconSizes.md;
|
|
139
|
+
const size = theme.space.base * ($isCompact ? 8 : 10);
|
|
140
|
+
return styled.css(["width:", "px;height:", "px;svg{width:", ";height:", ";}"], size, size, iconSize, iconSize);
|
|
145
141
|
};
|
|
146
|
-
const
|
|
142
|
+
const colorStyles$2 = _ref2 => {
|
|
147
143
|
let {
|
|
148
144
|
theme
|
|
149
145
|
} = _ref2;
|
|
150
|
-
|
|
146
|
+
const foreground = reactTheming.getColor({
|
|
147
|
+
variable: 'foreground.subtle',
|
|
148
|
+
theme
|
|
149
|
+
});
|
|
150
|
+
const foregroundHover = reactTheming.getColor({
|
|
151
|
+
variable: 'foreground.subtle',
|
|
152
|
+
light: {
|
|
153
|
+
offset: 100
|
|
154
|
+
},
|
|
155
|
+
dark: {
|
|
156
|
+
offset: -100
|
|
157
|
+
},
|
|
158
|
+
theme
|
|
159
|
+
});
|
|
160
|
+
const backgroundHover = reactTheming.getColor({
|
|
161
|
+
variable: 'background.primaryEmphasis',
|
|
162
|
+
theme,
|
|
163
|
+
transparency: theme.opacity[100]
|
|
164
|
+
});
|
|
165
|
+
const foregroundActive = reactTheming.getColor({
|
|
166
|
+
variable: 'foreground.subtle',
|
|
167
|
+
light: {
|
|
168
|
+
offset: 200
|
|
169
|
+
},
|
|
170
|
+
dark: {
|
|
171
|
+
offset: -200
|
|
172
|
+
},
|
|
173
|
+
theme
|
|
174
|
+
});
|
|
175
|
+
const backgroundActive = reactTheming.getColor({
|
|
176
|
+
variable: 'background.primaryEmphasis',
|
|
177
|
+
theme,
|
|
178
|
+
transparency: theme.opacity[200]
|
|
179
|
+
});
|
|
180
|
+
return styled.css(["color:", ";:hover{background-color:", ";color:", ";}:active{background-color:", ";color:", ";}"], foreground, backgroundHover, foregroundHover, backgroundActive, foregroundActive);
|
|
151
181
|
};
|
|
152
182
|
const COMPONENT_ID$6 = 'datepickers.header_paddle';
|
|
153
183
|
const StyledHeaderPaddle = styled__default.default.div.attrs({
|
|
154
|
-
'data-garden-id': COMPONENT_ID$6
|
|
184
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
185
|
+
'data-garden-version': '9.1.0'
|
|
155
186
|
}).withConfig({
|
|
156
187
|
displayName: "StyledHeaderPaddle",
|
|
157
188
|
componentId: "sc-2oqh0g-0"
|
|
158
|
-
})(["display:flex;align-items:center;justify-content:center;transform:", ";
|
|
159
|
-
StyledHeaderPaddle.defaultProps = {
|
|
160
|
-
theme: reactTheming.DEFAULT_THEME
|
|
161
|
-
};
|
|
189
|
+
})(["display:flex;align-items:center;justify-content:center;transform:", ";border-radius:50%;cursor:pointer;&[aria-hidden]{visibility:hidden;}", " ", " ", ";"], props => props.theme.rtl && 'rotate(180deg)', sizeStyles$3, colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
162
190
|
|
|
163
191
|
const COMPONENT_ID$5 = 'datepickers.header_label';
|
|
164
192
|
const StyledHeaderLabel = styled__default.default.div.attrs({
|
|
165
|
-
'data-garden-id': COMPONENT_ID$5
|
|
193
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
194
|
+
'data-garden-version': '9.1.0'
|
|
166
195
|
}).withConfig({
|
|
167
196
|
displayName: "StyledHeaderLabel",
|
|
168
197
|
componentId: "sc-1ryf5ub-0"
|
|
169
|
-
})(["display:flex;flex-grow:1;align-items:center;justify-content:center;font-size:", ";font-weight:", ";", ";"], props => props
|
|
170
|
-
StyledHeaderLabel.defaultProps = {
|
|
171
|
-
theme: reactTheming.DEFAULT_THEME
|
|
172
|
-
};
|
|
198
|
+
})(["display:flex;flex-grow:1;align-items:center;justify-content:center;font-size:", ";font-weight:", ";", ";"], props => props.$isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
173
199
|
|
|
174
200
|
const COMPONENT_ID$4 = 'datepickers.calendar';
|
|
175
201
|
const StyledCalendar = styled__default.default.div.attrs({
|
|
176
|
-
'data-garden-id': COMPONENT_ID$4
|
|
202
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
203
|
+
'data-garden-version': '9.1.0'
|
|
177
204
|
}).withConfig({
|
|
178
205
|
displayName: "StyledCalendar",
|
|
179
206
|
componentId: "sc-g5hoe8-0"
|
|
180
|
-
})(["width:", "px;", ";"], props => props
|
|
181
|
-
StyledCalendar.defaultProps = {
|
|
182
|
-
theme: reactTheming.DEFAULT_THEME
|
|
183
|
-
};
|
|
207
|
+
})(["width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
184
208
|
|
|
185
209
|
const COMPONENT_ID$3 = 'datepickers.calendar_item';
|
|
186
|
-
const
|
|
210
|
+
const sizeStyles$2 = _ref => {
|
|
187
211
|
let {
|
|
188
|
-
isCompact,
|
|
212
|
+
$isCompact,
|
|
189
213
|
theme
|
|
190
214
|
} = _ref;
|
|
191
215
|
let size;
|
|
192
|
-
if (isCompact) {
|
|
216
|
+
if ($isCompact) {
|
|
193
217
|
size = `${theme.space.base * 8}px`;
|
|
194
218
|
} else {
|
|
195
219
|
size = `${theme.space.base * 10}px`;
|
|
@@ -197,109 +221,146 @@ const retrieveSize = _ref => {
|
|
|
197
221
|
return styled.css(["width:", ";height:", ";"], size, size);
|
|
198
222
|
};
|
|
199
223
|
const StyledCalendarItem = styled__default.default.div.attrs({
|
|
200
|
-
'data-garden-id': COMPONENT_ID$3
|
|
224
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
225
|
+
'data-garden-version': '9.1.0'
|
|
201
226
|
}).withConfig({
|
|
202
227
|
displayName: "StyledCalendarItem",
|
|
203
228
|
componentId: "sc-143w8wb-0"
|
|
204
|
-
})(["display:inline-block;position:relative;vertical-align:top;", " ", ";"],
|
|
205
|
-
StyledCalendarItem.defaultProps = {
|
|
206
|
-
theme: reactTheming.DEFAULT_THEME
|
|
207
|
-
};
|
|
229
|
+
})(["display:inline-block;position:relative;vertical-align:top;", " ", ";"], sizeStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
208
230
|
|
|
209
231
|
const COMPONENT_ID$2 = 'datepickers.day_label';
|
|
210
232
|
const StyledDayLabel = styled__default.default.div.attrs({
|
|
211
|
-
'data-garden-id': COMPONENT_ID$2
|
|
233
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
234
|
+
'data-garden-version': '9.1.0'
|
|
212
235
|
}).withConfig({
|
|
213
236
|
displayName: "StyledDayLabel",
|
|
214
237
|
componentId: "sc-9bh1p7-0"
|
|
215
|
-
})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:", ";font-weight:", ";", ";"], props => props
|
|
216
|
-
StyledDayLabel.defaultProps = {
|
|
217
|
-
theme: reactTheming.DEFAULT_THEME
|
|
218
|
-
};
|
|
238
|
+
})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:", ";font-weight:", ";", ";"], props => props.$isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
219
239
|
|
|
220
240
|
const COMPONENT_ID$1 = 'datepickers.highlight';
|
|
221
|
-
const
|
|
241
|
+
const sizeStyles$1 = _ref => {
|
|
222
242
|
let {
|
|
223
243
|
theme,
|
|
224
|
-
isEnd,
|
|
225
|
-
isStart
|
|
244
|
+
$isEnd,
|
|
245
|
+
$isStart
|
|
226
246
|
} = _ref;
|
|
227
|
-
|
|
228
|
-
const
|
|
247
|
+
let borderRadius;
|
|
248
|
+
const startValue = '0 50% 50% 0;';
|
|
249
|
+
const endValue = '50% 0 0 50%;';
|
|
229
250
|
if (theme.rtl) {
|
|
230
|
-
if (isStart) {
|
|
231
|
-
|
|
232
|
-
} else if (isEnd) {
|
|
233
|
-
|
|
251
|
+
if ($isStart) {
|
|
252
|
+
borderRadius = startValue;
|
|
253
|
+
} else if ($isEnd) {
|
|
254
|
+
borderRadius = endValue;
|
|
234
255
|
}
|
|
235
256
|
}
|
|
236
|
-
if (isStart) {
|
|
237
|
-
|
|
238
|
-
} else if (isEnd) {
|
|
239
|
-
|
|
257
|
+
if ($isStart) {
|
|
258
|
+
borderRadius = endValue;
|
|
259
|
+
} else if ($isEnd) {
|
|
260
|
+
borderRadius = startValue;
|
|
240
261
|
}
|
|
241
|
-
return
|
|
262
|
+
return styled.css(["border-radius:", ";width:100%;height:100%;"], borderRadius);
|
|
242
263
|
};
|
|
243
|
-
const
|
|
264
|
+
const colorStyles$1 = _ref2 => {
|
|
244
265
|
let {
|
|
245
|
-
isHighlighted,
|
|
266
|
+
$isHighlighted,
|
|
246
267
|
theme
|
|
247
268
|
} = _ref2;
|
|
248
|
-
return styled.css(["background-color:", ";"], isHighlighted && reactTheming.
|
|
269
|
+
return styled.css(["background-color:", ";"], $isHighlighted && reactTheming.getColor({
|
|
270
|
+
variable: 'background.primaryEmphasis',
|
|
271
|
+
transparency: theme.opacity[100],
|
|
272
|
+
theme
|
|
273
|
+
}));
|
|
249
274
|
};
|
|
250
275
|
const StyledHighlight = styled__default.default.div.attrs({
|
|
251
|
-
'data-garden-id': COMPONENT_ID$1
|
|
276
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
277
|
+
'data-garden-version': '9.1.0'
|
|
252
278
|
}).withConfig({
|
|
253
279
|
displayName: "StyledHighlight",
|
|
254
280
|
componentId: "sc-16vr32x-0"
|
|
255
|
-
})(["position:absolute;top:0;left:0;
|
|
256
|
-
StyledHighlight.defaultProps = {
|
|
257
|
-
theme: reactTheming.DEFAULT_THEME
|
|
258
|
-
};
|
|
281
|
+
})(["position:absolute;top:0;left:0;", " ", " ", ";"], sizeStyles$1, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
259
282
|
|
|
260
|
-
const
|
|
283
|
+
const sizeStyles = () => {
|
|
284
|
+
return styled.css(["border-radius:50%;width:100%;height:100%;"]);
|
|
285
|
+
};
|
|
286
|
+
const colorStyles = _ref => {
|
|
261
287
|
let {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
theme
|
|
288
|
+
$isToday,
|
|
289
|
+
$isPreviousMonth,
|
|
290
|
+
theme,
|
|
291
|
+
...props
|
|
267
292
|
} = _ref;
|
|
293
|
+
const isSelected = props['aria-selected'];
|
|
294
|
+
const isDisabled = props['aria-disabled'];
|
|
268
295
|
let backgroundColor = 'inherit';
|
|
269
|
-
let
|
|
296
|
+
let foreground;
|
|
297
|
+
const backgroundHover = reactTheming.getColor({
|
|
298
|
+
variable: 'background.primaryEmphasis',
|
|
299
|
+
theme,
|
|
300
|
+
transparency: theme.opacity[100]
|
|
301
|
+
});
|
|
302
|
+
const foregroundHover = !$isToday && reactTheming.getColor({
|
|
303
|
+
variable: 'foreground.primary',
|
|
304
|
+
light: {
|
|
305
|
+
offset: 100
|
|
306
|
+
},
|
|
307
|
+
dark: {
|
|
308
|
+
offset: -100
|
|
309
|
+
},
|
|
310
|
+
theme
|
|
311
|
+
});
|
|
312
|
+
const backgroundActive = reactTheming.getColor({
|
|
313
|
+
variable: 'background.primaryEmphasis',
|
|
314
|
+
theme,
|
|
315
|
+
transparency: theme.opacity[200]
|
|
316
|
+
});
|
|
317
|
+
const foregroundActive = !$isToday && reactTheming.getColor({
|
|
318
|
+
variable: 'foreground.primary',
|
|
319
|
+
light: {
|
|
320
|
+
offset: 200
|
|
321
|
+
},
|
|
322
|
+
dark: {
|
|
323
|
+
offset: -200
|
|
324
|
+
},
|
|
325
|
+
theme
|
|
326
|
+
});
|
|
270
327
|
if (isSelected && !isDisabled) {
|
|
271
|
-
backgroundColor = reactTheming.
|
|
272
|
-
|
|
328
|
+
backgroundColor = reactTheming.getColor({
|
|
329
|
+
variable: 'background.primaryEmphasis',
|
|
330
|
+
theme
|
|
331
|
+
});
|
|
332
|
+
foreground = reactTheming.getColor({
|
|
333
|
+
variable: 'foreground.onEmphasis',
|
|
334
|
+
theme
|
|
335
|
+
});
|
|
273
336
|
} else if (isDisabled) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
337
|
+
foreground = reactTheming.getColor({
|
|
338
|
+
variable: 'foreground.disabled',
|
|
339
|
+
theme
|
|
340
|
+
});
|
|
341
|
+
} else if ($isToday) {
|
|
342
|
+
foreground = 'inherit';
|
|
343
|
+
} else if ($isPreviousMonth) {
|
|
344
|
+
foreground = reactTheming.getColor({
|
|
345
|
+
variable: 'foreground.subtle',
|
|
346
|
+
theme
|
|
347
|
+
});
|
|
348
|
+
} else {
|
|
349
|
+
foreground = reactTheming.getColor({
|
|
350
|
+
variable: 'foreground.primary',
|
|
351
|
+
theme
|
|
352
|
+
});
|
|
279
353
|
}
|
|
280
|
-
return styled.css(["background-color:", ";color:", ";", ""], backgroundColor,
|
|
281
|
-
:hover {
|
|
282
|
-
background-color: ${reactTheming.getColorV8('primaryHue', 600, theme, 0.08)};
|
|
283
|
-
color: ${reactTheming.getColorV8('primaryHue', 800, theme)};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
:active {
|
|
287
|
-
background-color: ${reactTheming.getColorV8('primaryHue', 600, theme, 0.2)};
|
|
288
|
-
color: ${reactTheming.getColorV8('primaryHue', 800, theme)};
|
|
289
|
-
}
|
|
290
|
-
`);
|
|
354
|
+
return styled.css(["background-color:", ";color:", ";&:not([aria-disabled]):not([aria-selected]):hover{background-color:", ";color:", ";}&:not([aria-disabled]):not([aria-selected]):active{background-color:", ";color:", ";}"], backgroundColor, foreground, backgroundHover, foregroundHover, backgroundActive, foregroundActive);
|
|
291
355
|
};
|
|
292
356
|
const COMPONENT_ID = 'datepickers.day';
|
|
293
|
-
const StyledDay = styled__default.default.div.attrs(
|
|
357
|
+
const StyledDay = styled__default.default.div.attrs({
|
|
294
358
|
'data-garden-id': COMPONENT_ID,
|
|
295
|
-
'
|
|
296
|
-
})
|
|
359
|
+
'data-garden-version': '9.1.0'
|
|
360
|
+
}).withConfig({
|
|
297
361
|
displayName: "StyledDay",
|
|
298
362
|
componentId: "sc-v42uk5-0"
|
|
299
|
-
})(["display:flex;position:absolute;align-items:center;justify-content:center;
|
|
300
|
-
StyledDay.defaultProps = {
|
|
301
|
-
theme: reactTheming.DEFAULT_THEME
|
|
302
|
-
};
|
|
363
|
+
})(["display:flex;position:absolute;align-items:center;justify-content:center;cursor:", ";font-size:", ";font-weight:", ";", " ", " ", ";"], props => props['aria-disabled'] ? 'inherit' : 'pointer', props => props.$isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.$isToday && !props['aria-disabled'] ? props.theme.fontWeights.semibold : 'inherit', sizeStyles, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
303
364
|
|
|
304
365
|
const DatePickerContext = React.createContext(undefined);
|
|
305
366
|
const useDatePickerContext$1 = () => {
|
|
@@ -388,7 +449,7 @@ function getStartOfWeek(locale) {
|
|
|
388
449
|
}
|
|
389
450
|
|
|
390
451
|
var _path$1;
|
|
391
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
452
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
392
453
|
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
393
454
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
394
455
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -404,7 +465,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
404
465
|
};
|
|
405
466
|
|
|
406
467
|
var _path;
|
|
407
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
468
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
408
469
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
409
470
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
410
471
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -436,18 +497,18 @@ const MonthSelector = _ref => {
|
|
|
436
497
|
return formatter.format(date);
|
|
437
498
|
}, [locale]);
|
|
438
499
|
return React__namespace.default.createElement(StyledHeader, {
|
|
439
|
-
isCompact: isCompact
|
|
500
|
+
$isCompact: isCompact
|
|
440
501
|
}, React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
441
|
-
isCompact: isCompact,
|
|
502
|
+
$isCompact: isCompact,
|
|
442
503
|
onClick: () => {
|
|
443
504
|
dispatch({
|
|
444
505
|
type: 'PREVIEW_PREVIOUS_MONTH'
|
|
445
506
|
});
|
|
446
507
|
}
|
|
447
508
|
}, React__namespace.default.createElement(SvgChevronLeftStroke, null)), React__namespace.default.createElement(StyledHeaderLabel, {
|
|
448
|
-
isCompact: isCompact
|
|
509
|
+
$isCompact: isCompact
|
|
449
510
|
}, headerLabelFormatter(state.previewDate)), React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
450
|
-
isCompact: isCompact,
|
|
511
|
+
$isCompact: isCompact,
|
|
451
512
|
onClick: () => {
|
|
452
513
|
dispatch({
|
|
453
514
|
type: 'PREVIEW_NEXT_MONTH'
|
|
@@ -491,15 +552,15 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
491
552
|
const formattedDayLabel = dayLabelFormatter(date);
|
|
492
553
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
493
554
|
key: `day-label-${formattedDayLabel}`,
|
|
494
|
-
isCompact: isCompact
|
|
555
|
+
$isCompact: isCompact
|
|
495
556
|
}, React__namespace.default.createElement(StyledDayLabel, {
|
|
496
|
-
isCompact: isCompact
|
|
557
|
+
$isCompact: isCompact
|
|
497
558
|
}, formattedDayLabel));
|
|
498
559
|
});
|
|
499
560
|
const items = eachDayOfInterval.eachDayOfInterval({
|
|
500
561
|
start: startDate,
|
|
501
562
|
end: endDate
|
|
502
|
-
}).map(
|
|
563
|
+
}).map(date => {
|
|
503
564
|
const formattedDayLabel = getDate.getDate(date);
|
|
504
565
|
const isCurrentDate = isToday.isToday(date);
|
|
505
566
|
const isPreviousMonth = !isSameMonth.isSameMonth(date, state.previewDate);
|
|
@@ -512,14 +573,14 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
512
573
|
isDisabled = isDisabled || isAfter.isAfter(date, maxValue) && !isSameDay.isSameDay(date, maxValue);
|
|
513
574
|
}
|
|
514
575
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
515
|
-
key:
|
|
516
|
-
isCompact: isCompact
|
|
576
|
+
key: date.toISOString(),
|
|
577
|
+
$isCompact: isCompact
|
|
517
578
|
}, React__namespace.default.createElement(StyledDay, {
|
|
518
|
-
isToday: isCurrentDate,
|
|
519
|
-
isPreviousMonth: isPreviousMonth,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
579
|
+
$isToday: isCurrentDate,
|
|
580
|
+
$isPreviousMonth: isPreviousMonth,
|
|
581
|
+
$isCompact: isCompact,
|
|
582
|
+
"aria-selected": isSelected || undefined,
|
|
583
|
+
"aria-disabled": isDisabled || undefined,
|
|
523
584
|
onClick: () => {
|
|
524
585
|
if (!isDisabled) {
|
|
525
586
|
dispatch({
|
|
@@ -532,7 +593,7 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
532
593
|
});
|
|
533
594
|
return React__namespace.default.createElement(StyledDatePicker, {
|
|
534
595
|
ref: ref,
|
|
535
|
-
isCompact: isCompact,
|
|
596
|
+
$isCompact: isCompact,
|
|
536
597
|
onMouseDown: e => {
|
|
537
598
|
e.preventDefault();
|
|
538
599
|
}
|
|
@@ -540,7 +601,7 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
540
601
|
locale: locale,
|
|
541
602
|
isCompact: isCompact
|
|
542
603
|
}), React__namespace.default.createElement(StyledCalendar, {
|
|
543
|
-
isCompact: isCompact
|
|
604
|
+
$isCompact: isCompact
|
|
544
605
|
}, dayLabels, items));
|
|
545
606
|
});
|
|
546
607
|
Calendar$1.displayName = 'Calendar';
|
|
@@ -786,6 +847,7 @@ Input.displayName = 'Input';
|
|
|
786
847
|
const PLACEMENT_DEFAULT = 'bottom-start';
|
|
787
848
|
const DatePicker = React.forwardRef((props, calendarRef) => {
|
|
788
849
|
const {
|
|
850
|
+
appendToNode,
|
|
789
851
|
children,
|
|
790
852
|
placement: _placement,
|
|
791
853
|
zIndex,
|
|
@@ -870,24 +932,16 @@ const DatePicker = React.forwardRef((props, calendarRef) => {
|
|
|
870
932
|
type: 'CONTROLLED_LOCALE_CHANGE'
|
|
871
933
|
});
|
|
872
934
|
}, [locale]);
|
|
873
|
-
|
|
874
|
-
element: Child,
|
|
875
|
-
dispatch: dispatch,
|
|
876
|
-
state: state,
|
|
877
|
-
refKey: refKey,
|
|
878
|
-
ref: reactMergeRefs.mergeRefs([triggerRef, Child.ref ? Child.ref : null])
|
|
879
|
-
}), React__namespace.default.createElement(DatePickerContext.Provider, {
|
|
880
|
-
value: contextValue
|
|
881
|
-
}, React__namespace.default.createElement(StyledMenuWrapper, {
|
|
935
|
+
const Node = React__namespace.default.createElement(StyledMenuWrapper, {
|
|
882
936
|
ref: floatingRef,
|
|
883
937
|
style: {
|
|
884
938
|
transform
|
|
885
939
|
},
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
}, (state.isOpen || isVisible) && React__namespace.default.createElement(StyledMenu, menuProps, React__namespace.default.createElement(Calendar$1, {
|
|
940
|
+
$isAnimated: !!isAnimated && (state.isOpen || isVisible),
|
|
941
|
+
$placement: placement,
|
|
942
|
+
$zIndex: zIndex,
|
|
943
|
+
"aria-hidden": !state.isOpen || undefined
|
|
944
|
+
}, !!(state.isOpen || isVisible) && React__namespace.default.createElement(StyledMenu, menuProps, React__namespace.default.createElement(Calendar$1, {
|
|
891
945
|
ref: calendarRef,
|
|
892
946
|
isCompact: isCompact,
|
|
893
947
|
value: value,
|
|
@@ -895,10 +949,20 @@ const DatePicker = React.forwardRef((props, calendarRef) => {
|
|
|
895
949
|
maxValue: maxValue,
|
|
896
950
|
locale: locale,
|
|
897
951
|
weekStartsOn: weekStartsOn
|
|
898
|
-
})))
|
|
952
|
+
})));
|
|
953
|
+
return React__namespace.default.createElement(React__namespace.default.Fragment, null, React__namespace.default.createElement(Input, {
|
|
954
|
+
element: Child,
|
|
955
|
+
dispatch: dispatch,
|
|
956
|
+
state: state,
|
|
957
|
+
refKey: refKey,
|
|
958
|
+
ref: reactMergeRefs.mergeRefs([triggerRef, Child.ref ? Child.ref : null])
|
|
959
|
+
}), React__namespace.default.createElement(DatePickerContext.Provider, {
|
|
960
|
+
value: contextValue
|
|
961
|
+
}, appendToNode ? reactDom$1.createPortal(Node, appendToNode) : Node));
|
|
899
962
|
});
|
|
900
963
|
DatePicker.displayName = 'DatePicker';
|
|
901
964
|
DatePicker.propTypes = {
|
|
965
|
+
appendToNode: PropTypes__default.default.any,
|
|
902
966
|
value: PropTypes__default.default.any,
|
|
903
967
|
onChange: PropTypes__default.default.any,
|
|
904
968
|
formatDate: PropTypes__default.default.func,
|
|
@@ -1410,26 +1474,26 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1410
1474
|
const formattedDayLabel = dayLabelFormatter(date);
|
|
1411
1475
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
1412
1476
|
key: `day-label-${formattedDayLabel}`,
|
|
1413
|
-
isCompact: isCompact
|
|
1477
|
+
$isCompact: isCompact
|
|
1414
1478
|
}, React__namespace.default.createElement(StyledDayLabel, {
|
|
1415
|
-
isCompact: isCompact
|
|
1479
|
+
$isCompact: isCompact
|
|
1416
1480
|
}, formattedDayLabel));
|
|
1417
1481
|
});
|
|
1418
1482
|
const items = eachDayOfInterval.eachDayOfInterval({
|
|
1419
1483
|
start: startDate,
|
|
1420
1484
|
end: endDate
|
|
1421
|
-
}).map(
|
|
1485
|
+
}).map(date => {
|
|
1422
1486
|
const formattedDayLabel = dayFormatter(date);
|
|
1423
1487
|
const isCurrentDate = isToday.isToday(date);
|
|
1424
1488
|
const isPreviousMonth = !isSameMonth.isSameMonth(date, displayDate);
|
|
1425
1489
|
if (isPreviousMonth) {
|
|
1426
1490
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
1427
|
-
key:
|
|
1428
|
-
isCompact: isCompact
|
|
1491
|
+
key: date.toISOString(),
|
|
1492
|
+
$isCompact: isCompact
|
|
1429
1493
|
}, React__namespace.default.createElement(StyledDay, {
|
|
1430
|
-
isCompact: isCompact,
|
|
1431
|
-
isPreviousMonth: true,
|
|
1432
|
-
|
|
1494
|
+
$isCompact: isCompact,
|
|
1495
|
+
$isPreviousMonth: true,
|
|
1496
|
+
"aria-disabled": true
|
|
1433
1497
|
}, "\xA0"));
|
|
1434
1498
|
}
|
|
1435
1499
|
let isSelected = false;
|
|
@@ -1472,18 +1536,18 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1472
1536
|
}
|
|
1473
1537
|
}
|
|
1474
1538
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
1475
|
-
key:
|
|
1476
|
-
isCompact: isCompact
|
|
1539
|
+
key: date.toISOString(),
|
|
1540
|
+
$isCompact: isCompact
|
|
1477
1541
|
}, React__namespace.default.createElement(StyledHighlight, {
|
|
1478
|
-
isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
|
|
1479
|
-
isStart: !isInvalidDateRange && isHighlightStart,
|
|
1480
|
-
isEnd: !isInvalidDateRange && isHighlightEnd
|
|
1542
|
+
$isHighlighted: !isInvalidDateRange && !!isHighlighted && !isDisabled,
|
|
1543
|
+
$isStart: !isInvalidDateRange && isHighlightStart,
|
|
1544
|
+
$isEnd: !isInvalidDateRange && isHighlightEnd
|
|
1481
1545
|
}), React__namespace.default.createElement(StyledDay, {
|
|
1482
|
-
isToday: isCurrentDate,
|
|
1483
|
-
isPreviousMonth: isPreviousMonth,
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
isCompact: isCompact,
|
|
1546
|
+
$isToday: isCurrentDate,
|
|
1547
|
+
$isPreviousMonth: isPreviousMonth,
|
|
1548
|
+
"aria-selected": !isInvalidDateRange && isSelected || undefined,
|
|
1549
|
+
"aria-disabled": isDisabled || undefined,
|
|
1550
|
+
$isCompact: isCompact,
|
|
1487
1551
|
onClick: () => {
|
|
1488
1552
|
if (!isDisabled) {
|
|
1489
1553
|
dispatch({
|
|
@@ -1553,32 +1617,32 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1553
1617
|
});
|
|
1554
1618
|
return React__namespace.default.createElement(StyledDatePicker, {
|
|
1555
1619
|
ref: ref,
|
|
1556
|
-
isCompact: isCompact,
|
|
1620
|
+
$isCompact: isCompact,
|
|
1557
1621
|
onMouseDown: e => {
|
|
1558
1622
|
e.preventDefault();
|
|
1559
1623
|
}
|
|
1560
1624
|
}, React__namespace.default.createElement(StyledHeader, {
|
|
1561
|
-
isCompact: isCompact
|
|
1625
|
+
$isCompact: isCompact
|
|
1562
1626
|
}, React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
1563
|
-
isCompact: isCompact,
|
|
1627
|
+
$isCompact: isCompact,
|
|
1564
1628
|
onClick: () => {
|
|
1565
1629
|
dispatch({
|
|
1566
1630
|
type: 'PREVIEW_PREVIOUS_MONTH'
|
|
1567
1631
|
});
|
|
1568
1632
|
},
|
|
1569
|
-
|
|
1633
|
+
"aria-hidden": isPreviousHidden || undefined
|
|
1570
1634
|
}, React__namespace.default.createElement(SvgChevronLeftStroke, null)), React__namespace.default.createElement(StyledHeaderLabel, {
|
|
1571
|
-
isCompact: isCompact
|
|
1635
|
+
$isCompact: isCompact
|
|
1572
1636
|
}, headerLabelFormatter(displayDate)), React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
1573
|
-
isCompact: isCompact,
|
|
1574
|
-
|
|
1637
|
+
$isCompact: isCompact,
|
|
1638
|
+
"aria-hidden": isNextHidden || undefined,
|
|
1575
1639
|
onClick: () => {
|
|
1576
1640
|
dispatch({
|
|
1577
1641
|
type: 'PREVIEW_NEXT_MONTH'
|
|
1578
1642
|
});
|
|
1579
1643
|
}
|
|
1580
1644
|
}, React__namespace.default.createElement(SvgChevronRightStroke, null))), React__namespace.default.createElement(StyledCalendar, {
|
|
1581
|
-
isCompact: isCompact,
|
|
1645
|
+
$isCompact: isCompact,
|
|
1582
1646
|
onMouseLeave: () => {
|
|
1583
1647
|
dispatch({
|
|
1584
1648
|
type: 'HOVER_DATE',
|
|
@@ -1596,7 +1660,7 @@ const Calendar = React.forwardRef((props, ref) => {
|
|
|
1596
1660
|
return React__namespace.default.createElement(StyledRangeCalendar, Object.assign({
|
|
1597
1661
|
ref: ref,
|
|
1598
1662
|
"data-garden-id": "datepickers.range",
|
|
1599
|
-
"data-garden-version": '9.
|
|
1663
|
+
"data-garden-version": '9.1.0'
|
|
1600
1664
|
}, props), React__namespace.default.createElement(Month, {
|
|
1601
1665
|
displayDate: state.previewDate,
|
|
1602
1666
|
isNextHidden: true
|