@zendeskgarden/react-datepickers 9.0.0-next.2 → 9.0.0-next.21
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/README.md +2 -2
- package/dist/esm/elements/DatePicker/DatePicker.js +169 -0
- package/dist/esm/elements/DatePicker/components/Calendar.js +125 -0
- package/dist/esm/elements/DatePicker/components/Input.js +75 -0
- package/dist/esm/elements/DatePicker/components/MonthSelector.js +61 -0
- package/dist/esm/elements/DatePicker/utils/date-picker-reducer.js +187 -0
- package/dist/esm/elements/DatePicker/utils/useDatePickerContext.js +14 -0
- package/dist/esm/elements/DatePickerRange/DatePickerRange.js +101 -0
- package/dist/esm/elements/DatePickerRange/components/Calendar.js +42 -0
- package/dist/esm/elements/DatePickerRange/components/End.js +79 -0
- package/dist/esm/elements/DatePickerRange/components/Month.js +270 -0
- package/dist/esm/elements/DatePickerRange/components/Start.js +79 -0
- package/dist/esm/elements/DatePickerRange/utils/date-picker-range-reducer.js +319 -0
- package/dist/esm/elements/DatePickerRange/utils/useDatePickerRangeContext.js +14 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-left-stroke.svg.js +25 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-right-stroke.svg.js +25 -0
- package/dist/esm/styled/StyledCalendar.js +22 -0
- package/dist/esm/styled/StyledCalendarItem.js +35 -0
- package/dist/esm/styled/StyledDatePicker.js +40 -0
- package/dist/esm/styled/StyledDay.js +95 -0
- package/dist/esm/styled/StyledDayLabel.js +22 -0
- package/dist/esm/styled/StyledHeader.js +22 -0
- package/dist/esm/styled/StyledHeaderLabel.js +22 -0
- package/dist/esm/styled/StyledHeaderPaddle.js +71 -0
- package/dist/esm/styled/StyledHighlight.js +56 -0
- package/dist/esm/styled/StyledMenu.js +22 -0
- package/dist/esm/styled/StyledMenuWrapper.js +29 -0
- package/dist/esm/styled/StyledRangeCalendar.js +23 -0
- package/dist/esm/types/index.js +12 -0
- package/dist/esm/utils/calendar-utils.js +88 -0
- package/dist/index.cjs.js +240 -156
- package/dist/typings/elements/DatePicker/utils/date-picker-reducer.d.ts +4 -4
- 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/package.json +8 -8
- package/dist/index.esm.js +0 -1683
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -63,7 +62,7 @@ const PLACEMENT = ['auto', ...reactTheming.PLACEMENT];
|
|
|
63
62
|
const COMPONENT_ID$b = 'datepickers.menu';
|
|
64
63
|
const StyledMenu = styled__default.default.div.attrs({
|
|
65
64
|
'data-garden-id': COMPONENT_ID$b,
|
|
66
|
-
'data-garden-version': '9.0.0-next.
|
|
65
|
+
'data-garden-version': '9.0.0-next.21'
|
|
67
66
|
}).withConfig({
|
|
68
67
|
displayName: "StyledMenu",
|
|
69
68
|
componentId: "sc-1npbkk0-0"
|
|
@@ -74,46 +73,57 @@ StyledMenu.defaultProps = {
|
|
|
74
73
|
|
|
75
74
|
const COMPONENT_ID$a = 'datepickers.menu_wrapper';
|
|
76
75
|
const StyledMenuWrapper = styled__default.default.div.attrs(props => ({
|
|
77
|
-
|
|
76
|
+
'data-garden-id': COMPONENT_ID$a,
|
|
77
|
+
'data-garden-version': '9.0.0-next.21',
|
|
78
|
+
className: props.$isAnimated && 'is-animated'
|
|
78
79
|
})).withConfig({
|
|
79
80
|
displayName: "StyledMenuWrapper",
|
|
80
81
|
componentId: "sc-6fowoz-0"
|
|
81
|
-
})(["top:0;left:0;", ";", ";"], props => reactTheming.menuStyles(reactTheming.getMenuPosition(props
|
|
82
|
+
})(["top:0;left:0;", ";", ";"], props => reactTheming.menuStyles(reactTheming.getMenuPosition(props.$placement), {
|
|
82
83
|
theme: props.theme,
|
|
83
|
-
hidden: props
|
|
84
|
+
hidden: props['aria-hidden'],
|
|
84
85
|
margin: `${props.theme.space.base}px`,
|
|
85
|
-
zIndex: props
|
|
86
|
-
animationModifier: props
|
|
86
|
+
zIndex: props.$zIndex,
|
|
87
|
+
animationModifier: props.$isAnimated ? '.is-animated' : undefined
|
|
87
88
|
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
88
89
|
StyledMenuWrapper.defaultProps = {
|
|
89
90
|
theme: reactTheming.DEFAULT_THEME
|
|
90
91
|
};
|
|
91
92
|
|
|
92
93
|
const COMPONENT_ID$9 = 'datepickers.datepicker';
|
|
93
|
-
const
|
|
94
|
+
const sizeStyles$4 = _ref => {
|
|
94
95
|
let {
|
|
95
|
-
isCompact,
|
|
96
|
+
$isCompact,
|
|
96
97
|
theme
|
|
97
98
|
} = _ref;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
const margin = theme.space.base * ($isCompact ? 4 : 5);
|
|
100
|
+
return styled.css(["margin:", "px;"], margin);
|
|
101
|
+
};
|
|
102
|
+
const colorStyles$3 = _ref2 => {
|
|
103
|
+
let {
|
|
104
|
+
theme
|
|
105
|
+
} = _ref2;
|
|
106
|
+
const foreground = reactTheming.getColor({
|
|
107
|
+
variable: 'foreground.default',
|
|
108
|
+
theme
|
|
109
|
+
});
|
|
110
|
+
return styled.css(["background-color:transparent;color:", ";"], foreground);
|
|
103
111
|
};
|
|
104
112
|
const StyledDatePicker = styled__default.default.div.attrs({
|
|
105
|
-
'data-garden-id': COMPONENT_ID$9
|
|
113
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
114
|
+
'data-garden-version': '9.0.0-next.21'
|
|
106
115
|
}).withConfig({
|
|
107
116
|
displayName: "StyledDatePicker",
|
|
108
117
|
componentId: "sc-15hwqzh-0"
|
|
109
|
-
})(["direction:", ";", "
|
|
118
|
+
})(["direction:", ";", " ", " ", ";"], p => p.theme.rtl && 'rtl', sizeStyles$4, colorStyles$3, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
110
119
|
StyledDatePicker.defaultProps = {
|
|
111
120
|
theme: reactTheming.DEFAULT_THEME
|
|
112
121
|
};
|
|
113
122
|
|
|
114
123
|
const COMPONENT_ID$8 = 'datepickers.range_calendar';
|
|
115
124
|
const StyledRangeCalendar = styled__default.default.div.attrs({
|
|
116
|
-
'data-garden-id': COMPONENT_ID$8
|
|
125
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
126
|
+
'data-garden-version': '9.0.0-next.21'
|
|
117
127
|
}).withConfig({
|
|
118
128
|
displayName: "StyledRangeCalendar",
|
|
119
129
|
componentId: "sc-1og46sy-0"
|
|
@@ -124,73 +134,109 @@ StyledRangeCalendar.defaultProps = {
|
|
|
124
134
|
|
|
125
135
|
const COMPONENT_ID$7 = 'datepickers.header';
|
|
126
136
|
const StyledHeader = styled__default.default.div.attrs({
|
|
127
|
-
'data-garden-id': COMPONENT_ID$7
|
|
137
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
138
|
+
'data-garden-version': '9.0.0-next.21'
|
|
128
139
|
}).withConfig({
|
|
129
140
|
displayName: "StyledHeader",
|
|
130
141
|
componentId: "sc-upq318-0"
|
|
131
|
-
})(["display:flex;width:", "px;", ";"], props => props
|
|
142
|
+
})(["display:flex;width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
132
143
|
StyledHeader.defaultProps = {
|
|
133
144
|
theme: reactTheming.DEFAULT_THEME
|
|
134
145
|
};
|
|
135
146
|
|
|
136
|
-
const
|
|
147
|
+
const sizeStyles$3 = _ref => {
|
|
137
148
|
let {
|
|
138
|
-
isCompact,
|
|
149
|
+
$isCompact,
|
|
139
150
|
theme
|
|
140
151
|
} = _ref;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
return styled.css(["width:", "px;height:", "px;"], size, size);
|
|
152
|
+
const iconSize = theme.iconSizes.md;
|
|
153
|
+
const size = theme.space.base * ($isCompact ? 8 : 10);
|
|
154
|
+
return styled.css(["width:", "px;height:", "px;svg{width:", ";height:", ";}"], size, size, iconSize, iconSize);
|
|
146
155
|
};
|
|
147
|
-
const
|
|
156
|
+
const colorStyles$2 = _ref2 => {
|
|
148
157
|
let {
|
|
149
158
|
theme
|
|
150
159
|
} = _ref2;
|
|
151
|
-
|
|
160
|
+
const foreground = reactTheming.getColor({
|
|
161
|
+
variable: 'foreground.subtle',
|
|
162
|
+
theme
|
|
163
|
+
});
|
|
164
|
+
const foregroundHover = reactTheming.getColor({
|
|
165
|
+
variable: 'foreground.subtle',
|
|
166
|
+
light: {
|
|
167
|
+
offset: 100
|
|
168
|
+
},
|
|
169
|
+
dark: {
|
|
170
|
+
offset: -100
|
|
171
|
+
},
|
|
172
|
+
theme
|
|
173
|
+
});
|
|
174
|
+
const backgroundHover = reactTheming.getColor({
|
|
175
|
+
variable: 'background.primaryEmphasis',
|
|
176
|
+
theme,
|
|
177
|
+
transparency: theme.opacity[100]
|
|
178
|
+
});
|
|
179
|
+
const foregroundActive = reactTheming.getColor({
|
|
180
|
+
variable: 'foreground.subtle',
|
|
181
|
+
light: {
|
|
182
|
+
offset: 200
|
|
183
|
+
},
|
|
184
|
+
dark: {
|
|
185
|
+
offset: -200
|
|
186
|
+
},
|
|
187
|
+
theme
|
|
188
|
+
});
|
|
189
|
+
const backgroundActive = reactTheming.getColor({
|
|
190
|
+
variable: 'background.primaryEmphasis',
|
|
191
|
+
theme,
|
|
192
|
+
transparency: theme.opacity[200]
|
|
193
|
+
});
|
|
194
|
+
return styled.css(["color:", ";:hover{background-color:", ";color:", ";}:active{background-color:", ";color:", ";}"], foreground, backgroundHover, foregroundHover, backgroundActive, foregroundActive);
|
|
152
195
|
};
|
|
153
196
|
const COMPONENT_ID$6 = 'datepickers.header_paddle';
|
|
154
197
|
const StyledHeaderPaddle = styled__default.default.div.attrs({
|
|
155
|
-
'data-garden-id': COMPONENT_ID$6
|
|
198
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
199
|
+
'data-garden-version': '9.0.0-next.21'
|
|
156
200
|
}).withConfig({
|
|
157
201
|
displayName: "StyledHeaderPaddle",
|
|
158
202
|
componentId: "sc-2oqh0g-0"
|
|
159
|
-
})(["display:flex;align-items:center;justify-content:center;transform:", ";
|
|
203
|
+
})(["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));
|
|
160
204
|
StyledHeaderPaddle.defaultProps = {
|
|
161
205
|
theme: reactTheming.DEFAULT_THEME
|
|
162
206
|
};
|
|
163
207
|
|
|
164
208
|
const COMPONENT_ID$5 = 'datepickers.header_label';
|
|
165
209
|
const StyledHeaderLabel = styled__default.default.div.attrs({
|
|
166
|
-
'data-garden-id': COMPONENT_ID$5
|
|
210
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
211
|
+
'data-garden-version': '9.0.0-next.21'
|
|
167
212
|
}).withConfig({
|
|
168
213
|
displayName: "StyledHeaderLabel",
|
|
169
214
|
componentId: "sc-1ryf5ub-0"
|
|
170
|
-
})(["display:flex;flex-grow:1;align-items:center;justify-content:center;font-size:", ";font-weight:", ";", ";"], props => props
|
|
215
|
+
})(["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));
|
|
171
216
|
StyledHeaderLabel.defaultProps = {
|
|
172
217
|
theme: reactTheming.DEFAULT_THEME
|
|
173
218
|
};
|
|
174
219
|
|
|
175
220
|
const COMPONENT_ID$4 = 'datepickers.calendar';
|
|
176
221
|
const StyledCalendar = styled__default.default.div.attrs({
|
|
177
|
-
'data-garden-id': COMPONENT_ID$4
|
|
222
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
223
|
+
'data-garden-version': '9.0.0-next.21'
|
|
178
224
|
}).withConfig({
|
|
179
225
|
displayName: "StyledCalendar",
|
|
180
226
|
componentId: "sc-g5hoe8-0"
|
|
181
|
-
})(["width:", "px;", ";"], props => props
|
|
227
|
+
})(["width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
182
228
|
StyledCalendar.defaultProps = {
|
|
183
229
|
theme: reactTheming.DEFAULT_THEME
|
|
184
230
|
};
|
|
185
231
|
|
|
186
232
|
const COMPONENT_ID$3 = 'datepickers.calendar_item';
|
|
187
|
-
const
|
|
233
|
+
const sizeStyles$2 = _ref => {
|
|
188
234
|
let {
|
|
189
|
-
isCompact,
|
|
235
|
+
$isCompact,
|
|
190
236
|
theme
|
|
191
237
|
} = _ref;
|
|
192
238
|
let size;
|
|
193
|
-
if (isCompact) {
|
|
239
|
+
if ($isCompact) {
|
|
194
240
|
size = `${theme.space.base * 8}px`;
|
|
195
241
|
} else {
|
|
196
242
|
size = `${theme.space.base * 10}px`;
|
|
@@ -198,106 +244,155 @@ const retrieveSize = _ref => {
|
|
|
198
244
|
return styled.css(["width:", ";height:", ";"], size, size);
|
|
199
245
|
};
|
|
200
246
|
const StyledCalendarItem = styled__default.default.div.attrs({
|
|
201
|
-
'data-garden-id': COMPONENT_ID$3
|
|
247
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
248
|
+
'data-garden-version': '9.0.0-next.21'
|
|
202
249
|
}).withConfig({
|
|
203
250
|
displayName: "StyledCalendarItem",
|
|
204
251
|
componentId: "sc-143w8wb-0"
|
|
205
|
-
})(["display:inline-block;position:relative;vertical-align:top;", " ", ";"],
|
|
252
|
+
})(["display:inline-block;position:relative;vertical-align:top;", " ", ";"], sizeStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
206
253
|
StyledCalendarItem.defaultProps = {
|
|
207
254
|
theme: reactTheming.DEFAULT_THEME
|
|
208
255
|
};
|
|
209
256
|
|
|
210
257
|
const COMPONENT_ID$2 = 'datepickers.day_label';
|
|
211
258
|
const StyledDayLabel = styled__default.default.div.attrs({
|
|
212
|
-
'data-garden-id': COMPONENT_ID$2
|
|
259
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
260
|
+
'data-garden-version': '9.0.0-next.21'
|
|
213
261
|
}).withConfig({
|
|
214
262
|
displayName: "StyledDayLabel",
|
|
215
263
|
componentId: "sc-9bh1p7-0"
|
|
216
|
-
})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:", ";font-weight:", ";", ";"], props => props
|
|
264
|
+
})(["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));
|
|
217
265
|
StyledDayLabel.defaultProps = {
|
|
218
266
|
theme: reactTheming.DEFAULT_THEME
|
|
219
267
|
};
|
|
220
268
|
|
|
221
269
|
const COMPONENT_ID$1 = 'datepickers.highlight';
|
|
222
|
-
const
|
|
270
|
+
const sizeStyles$1 = _ref => {
|
|
223
271
|
let {
|
|
224
272
|
theme,
|
|
225
|
-
isEnd,
|
|
226
|
-
isStart
|
|
273
|
+
$isEnd,
|
|
274
|
+
$isStart
|
|
227
275
|
} = _ref;
|
|
228
|
-
|
|
229
|
-
const
|
|
276
|
+
let borderRadius;
|
|
277
|
+
const startValue = '0 50% 50% 0;';
|
|
278
|
+
const endValue = '50% 0 0 50%;';
|
|
230
279
|
if (theme.rtl) {
|
|
231
|
-
if (isStart) {
|
|
232
|
-
|
|
233
|
-
} else if (isEnd) {
|
|
234
|
-
|
|
280
|
+
if ($isStart) {
|
|
281
|
+
borderRadius = startValue;
|
|
282
|
+
} else if ($isEnd) {
|
|
283
|
+
borderRadius = endValue;
|
|
235
284
|
}
|
|
236
285
|
}
|
|
237
|
-
if (isStart) {
|
|
238
|
-
|
|
239
|
-
} else if (isEnd) {
|
|
240
|
-
|
|
286
|
+
if ($isStart) {
|
|
287
|
+
borderRadius = endValue;
|
|
288
|
+
} else if ($isEnd) {
|
|
289
|
+
borderRadius = startValue;
|
|
241
290
|
}
|
|
242
|
-
return
|
|
291
|
+
return styled.css(["border-radius:", ";width:100%;height:100%;"], borderRadius);
|
|
243
292
|
};
|
|
244
|
-
const
|
|
293
|
+
const colorStyles$1 = _ref2 => {
|
|
245
294
|
let {
|
|
246
|
-
isHighlighted,
|
|
295
|
+
$isHighlighted,
|
|
247
296
|
theme
|
|
248
297
|
} = _ref2;
|
|
249
|
-
return styled.css(["background-color:", ";"], isHighlighted && reactTheming.getColor(
|
|
298
|
+
return styled.css(["background-color:", ";"], $isHighlighted && reactTheming.getColor({
|
|
299
|
+
variable: 'background.primaryEmphasis',
|
|
300
|
+
transparency: theme.opacity[100],
|
|
301
|
+
theme
|
|
302
|
+
}));
|
|
250
303
|
};
|
|
251
304
|
const StyledHighlight = styled__default.default.div.attrs({
|
|
252
|
-
'data-garden-id': COMPONENT_ID$1
|
|
305
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
306
|
+
'data-garden-version': '9.0.0-next.21'
|
|
253
307
|
}).withConfig({
|
|
254
308
|
displayName: "StyledHighlight",
|
|
255
309
|
componentId: "sc-16vr32x-0"
|
|
256
|
-
})(["position:absolute;top:0;left:0;
|
|
310
|
+
})(["position:absolute;top:0;left:0;", " ", " ", ";"], sizeStyles$1, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
257
311
|
StyledHighlight.defaultProps = {
|
|
258
312
|
theme: reactTheming.DEFAULT_THEME
|
|
259
313
|
};
|
|
260
314
|
|
|
261
|
-
const
|
|
315
|
+
const sizeStyles = () => {
|
|
316
|
+
return styled.css(["border-radius:50%;width:100%;height:100%;"]);
|
|
317
|
+
};
|
|
318
|
+
const colorStyles = _ref => {
|
|
262
319
|
let {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
theme
|
|
320
|
+
$isToday,
|
|
321
|
+
$isPreviousMonth,
|
|
322
|
+
theme,
|
|
323
|
+
...props
|
|
268
324
|
} = _ref;
|
|
325
|
+
const isSelected = props['aria-selected'];
|
|
326
|
+
const isDisabled = props['aria-disabled'];
|
|
269
327
|
let backgroundColor = 'inherit';
|
|
270
|
-
let
|
|
328
|
+
let foreground;
|
|
329
|
+
const backgroundHover = reactTheming.getColor({
|
|
330
|
+
variable: 'background.primaryEmphasis',
|
|
331
|
+
theme,
|
|
332
|
+
transparency: theme.opacity[100]
|
|
333
|
+
});
|
|
334
|
+
const foregroundHover = !$isToday && reactTheming.getColor({
|
|
335
|
+
variable: 'foreground.primary',
|
|
336
|
+
light: {
|
|
337
|
+
offset: 100
|
|
338
|
+
},
|
|
339
|
+
dark: {
|
|
340
|
+
offset: -100
|
|
341
|
+
},
|
|
342
|
+
theme
|
|
343
|
+
});
|
|
344
|
+
const backgroundActive = reactTheming.getColor({
|
|
345
|
+
variable: 'background.primaryEmphasis',
|
|
346
|
+
theme,
|
|
347
|
+
transparency: theme.opacity[200]
|
|
348
|
+
});
|
|
349
|
+
const foregroundActive = !$isToday && reactTheming.getColor({
|
|
350
|
+
variable: 'foreground.primary',
|
|
351
|
+
light: {
|
|
352
|
+
offset: 200
|
|
353
|
+
},
|
|
354
|
+
dark: {
|
|
355
|
+
offset: -200
|
|
356
|
+
},
|
|
357
|
+
theme
|
|
358
|
+
});
|
|
271
359
|
if (isSelected && !isDisabled) {
|
|
272
|
-
backgroundColor = reactTheming.getColor(
|
|
273
|
-
|
|
360
|
+
backgroundColor = reactTheming.getColor({
|
|
361
|
+
variable: 'background.primaryEmphasis',
|
|
362
|
+
theme
|
|
363
|
+
});
|
|
364
|
+
foreground = reactTheming.getColor({
|
|
365
|
+
variable: 'foreground.onEmphasis',
|
|
366
|
+
theme
|
|
367
|
+
});
|
|
274
368
|
} else if (isDisabled) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
369
|
+
foreground = reactTheming.getColor({
|
|
370
|
+
variable: 'foreground.disabled',
|
|
371
|
+
theme
|
|
372
|
+
});
|
|
373
|
+
} else if ($isToday) {
|
|
374
|
+
foreground = 'inherit';
|
|
375
|
+
} else if ($isPreviousMonth) {
|
|
376
|
+
foreground = reactTheming.getColor({
|
|
377
|
+
variable: 'foreground.subtle',
|
|
378
|
+
theme
|
|
379
|
+
});
|
|
380
|
+
} else {
|
|
381
|
+
foreground = reactTheming.getColor({
|
|
382
|
+
variable: 'foreground.primary',
|
|
383
|
+
theme
|
|
384
|
+
});
|
|
280
385
|
}
|
|
281
|
-
return styled.css(["background-color:", ";color:", ";", ""], backgroundColor,
|
|
282
|
-
:hover {
|
|
283
|
-
background-color: ${reactTheming.getColor('primaryHue', 600, theme, 0.08)};
|
|
284
|
-
color: ${reactTheming.getColor('primaryHue', 800, theme)};
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
:active {
|
|
288
|
-
background-color: ${reactTheming.getColor('primaryHue', 600, theme, 0.2)};
|
|
289
|
-
color: ${reactTheming.getColor('primaryHue', 800, theme)};
|
|
290
|
-
}
|
|
291
|
-
`);
|
|
386
|
+
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);
|
|
292
387
|
};
|
|
293
388
|
const COMPONENT_ID = 'datepickers.day';
|
|
294
|
-
const StyledDay = styled__default.default.div.attrs(
|
|
389
|
+
const StyledDay = styled__default.default.div.attrs({
|
|
295
390
|
'data-garden-id': COMPONENT_ID,
|
|
296
|
-
'
|
|
297
|
-
})
|
|
391
|
+
'data-garden-version': '9.0.0-next.21'
|
|
392
|
+
}).withConfig({
|
|
298
393
|
displayName: "StyledDay",
|
|
299
394
|
componentId: "sc-v42uk5-0"
|
|
300
|
-
})(["display:flex;position:absolute;align-items:center;justify-content:center;
|
|
395
|
+
})(["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));
|
|
301
396
|
StyledDay.defaultProps = {
|
|
302
397
|
theme: reactTheming.DEFAULT_THEME
|
|
303
398
|
};
|
|
@@ -389,9 +484,9 @@ function getStartOfWeek(locale) {
|
|
|
389
484
|
}
|
|
390
485
|
|
|
391
486
|
var _path$1;
|
|
392
|
-
function _extends$
|
|
487
|
+
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); }
|
|
393
488
|
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
394
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
489
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
395
490
|
xmlns: "http://www.w3.org/2000/svg",
|
|
396
491
|
width: 16,
|
|
397
492
|
height: 16,
|
|
@@ -405,9 +500,9 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
405
500
|
};
|
|
406
501
|
|
|
407
502
|
var _path;
|
|
408
|
-
function _extends
|
|
503
|
+
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); }
|
|
409
504
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
410
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends
|
|
505
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
411
506
|
xmlns: "http://www.w3.org/2000/svg",
|
|
412
507
|
width: 16,
|
|
413
508
|
height: 16,
|
|
@@ -437,18 +532,18 @@ const MonthSelector = _ref => {
|
|
|
437
532
|
return formatter.format(date);
|
|
438
533
|
}, [locale]);
|
|
439
534
|
return React__namespace.default.createElement(StyledHeader, {
|
|
440
|
-
isCompact: isCompact
|
|
535
|
+
$isCompact: isCompact
|
|
441
536
|
}, React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
442
|
-
isCompact: isCompact,
|
|
537
|
+
$isCompact: isCompact,
|
|
443
538
|
onClick: () => {
|
|
444
539
|
dispatch({
|
|
445
540
|
type: 'PREVIEW_PREVIOUS_MONTH'
|
|
446
541
|
});
|
|
447
542
|
}
|
|
448
543
|
}, React__namespace.default.createElement(SvgChevronLeftStroke, null)), React__namespace.default.createElement(StyledHeaderLabel, {
|
|
449
|
-
isCompact: isCompact
|
|
544
|
+
$isCompact: isCompact
|
|
450
545
|
}, headerLabelFormatter(state.previewDate)), React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
451
|
-
isCompact: isCompact,
|
|
546
|
+
$isCompact: isCompact,
|
|
452
547
|
onClick: () => {
|
|
453
548
|
dispatch({
|
|
454
549
|
type: 'PREVIEW_NEXT_MONTH'
|
|
@@ -492,9 +587,9 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
492
587
|
const formattedDayLabel = dayLabelFormatter(date);
|
|
493
588
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
494
589
|
key: `day-label-${formattedDayLabel}`,
|
|
495
|
-
isCompact: isCompact
|
|
590
|
+
$isCompact: isCompact
|
|
496
591
|
}, React__namespace.default.createElement(StyledDayLabel, {
|
|
497
|
-
isCompact: isCompact
|
|
592
|
+
$isCompact: isCompact
|
|
498
593
|
}, formattedDayLabel));
|
|
499
594
|
});
|
|
500
595
|
const items = eachDayOfInterval.eachDayOfInterval({
|
|
@@ -514,13 +609,13 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
514
609
|
}
|
|
515
610
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
516
611
|
key: `day-${itemsIndex}`,
|
|
517
|
-
isCompact: isCompact
|
|
612
|
+
$isCompact: isCompact
|
|
518
613
|
}, React__namespace.default.createElement(StyledDay, {
|
|
519
|
-
isToday: isCurrentDate,
|
|
520
|
-
isPreviousMonth: isPreviousMonth,
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
614
|
+
$isToday: isCurrentDate,
|
|
615
|
+
$isPreviousMonth: isPreviousMonth,
|
|
616
|
+
$isCompact: isCompact,
|
|
617
|
+
"aria-selected": isSelected || undefined,
|
|
618
|
+
"aria-disabled": isDisabled || undefined,
|
|
524
619
|
onClick: () => {
|
|
525
620
|
if (!isDisabled) {
|
|
526
621
|
dispatch({
|
|
@@ -533,7 +628,7 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
533
628
|
});
|
|
534
629
|
return React__namespace.default.createElement(StyledDatePicker, {
|
|
535
630
|
ref: ref,
|
|
536
|
-
isCompact: isCompact,
|
|
631
|
+
$isCompact: isCompact,
|
|
537
632
|
onMouseDown: e => {
|
|
538
633
|
e.preventDefault();
|
|
539
634
|
}
|
|
@@ -541,7 +636,7 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
541
636
|
locale: locale,
|
|
542
637
|
isCompact: isCompact
|
|
543
638
|
}), React__namespace.default.createElement(StyledCalendar, {
|
|
544
|
-
isCompact: isCompact
|
|
639
|
+
$isCompact: isCompact
|
|
545
640
|
}, dayLabels, items));
|
|
546
641
|
});
|
|
547
642
|
Calendar$1.displayName = 'Calendar';
|
|
@@ -828,6 +923,10 @@ const DatePicker = React.forwardRef((props, calendarRef) => {
|
|
|
828
923
|
transform
|
|
829
924
|
}
|
|
830
925
|
} = reactDom.useFloating({
|
|
926
|
+
platform: {
|
|
927
|
+
...reactDom.platform,
|
|
928
|
+
isRTL: () => theme.rtl
|
|
929
|
+
},
|
|
831
930
|
elements: {
|
|
832
931
|
reference: triggerRef?.current,
|
|
833
932
|
floating: floatingRef?.current
|
|
@@ -880,10 +979,10 @@ const DatePicker = React.forwardRef((props, calendarRef) => {
|
|
|
880
979
|
style: {
|
|
881
980
|
transform
|
|
882
981
|
},
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
982
|
+
$isAnimated: isAnimated && (state.isOpen || isVisible),
|
|
983
|
+
$placement: placement,
|
|
984
|
+
$zIndex: zIndex,
|
|
985
|
+
"aria-hidden": !state.isOpen || undefined
|
|
887
986
|
}, (state.isOpen || isVisible) && React__namespace.default.createElement(StyledMenu, menuProps, React__namespace.default.createElement(Calendar$1, {
|
|
888
987
|
ref: calendarRef,
|
|
889
988
|
isCompact: isCompact,
|
|
@@ -1354,21 +1453,6 @@ const End = props => {
|
|
|
1354
1453
|
};
|
|
1355
1454
|
End.displayName = 'DatePickerRange.End';
|
|
1356
1455
|
|
|
1357
|
-
function _extends() {
|
|
1358
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1359
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1360
|
-
var source = arguments[i];
|
|
1361
|
-
for (var key in source) {
|
|
1362
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1363
|
-
target[key] = source[key];
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
return target;
|
|
1368
|
-
};
|
|
1369
|
-
return _extends.apply(this, arguments);
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
1456
|
const Month = React.forwardRef((_ref, ref) => {
|
|
1373
1457
|
let {
|
|
1374
1458
|
displayDate,
|
|
@@ -1422,9 +1506,9 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1422
1506
|
const formattedDayLabel = dayLabelFormatter(date);
|
|
1423
1507
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
1424
1508
|
key: `day-label-${formattedDayLabel}`,
|
|
1425
|
-
isCompact: isCompact
|
|
1509
|
+
$isCompact: isCompact
|
|
1426
1510
|
}, React__namespace.default.createElement(StyledDayLabel, {
|
|
1427
|
-
isCompact: isCompact
|
|
1511
|
+
$isCompact: isCompact
|
|
1428
1512
|
}, formattedDayLabel));
|
|
1429
1513
|
});
|
|
1430
1514
|
const items = eachDayOfInterval.eachDayOfInterval({
|
|
@@ -1437,11 +1521,11 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1437
1521
|
if (isPreviousMonth) {
|
|
1438
1522
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
1439
1523
|
key: `day-${itemsIndex}`,
|
|
1440
|
-
isCompact: isCompact
|
|
1524
|
+
$isCompact: isCompact
|
|
1441
1525
|
}, React__namespace.default.createElement(StyledDay, {
|
|
1442
|
-
isCompact: isCompact,
|
|
1443
|
-
isPreviousMonth: true,
|
|
1444
|
-
|
|
1526
|
+
$isCompact: isCompact,
|
|
1527
|
+
$isPreviousMonth: true,
|
|
1528
|
+
"aria-disabled": true
|
|
1445
1529
|
}, "\xA0"));
|
|
1446
1530
|
}
|
|
1447
1531
|
let isSelected = false;
|
|
@@ -1485,17 +1569,17 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1485
1569
|
}
|
|
1486
1570
|
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
1487
1571
|
key: `day-${itemsIndex}`,
|
|
1488
|
-
isCompact: isCompact
|
|
1572
|
+
$isCompact: isCompact
|
|
1489
1573
|
}, React__namespace.default.createElement(StyledHighlight, {
|
|
1490
|
-
isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
|
|
1491
|
-
isStart: !isInvalidDateRange && isHighlightStart,
|
|
1492
|
-
isEnd: !isInvalidDateRange && isHighlightEnd
|
|
1574
|
+
$isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
|
|
1575
|
+
$isStart: !isInvalidDateRange && isHighlightStart,
|
|
1576
|
+
$isEnd: !isInvalidDateRange && isHighlightEnd
|
|
1493
1577
|
}), React__namespace.default.createElement(StyledDay, {
|
|
1494
|
-
isToday: isCurrentDate,
|
|
1495
|
-
isPreviousMonth: isPreviousMonth,
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
isCompact: isCompact,
|
|
1578
|
+
$isToday: isCurrentDate,
|
|
1579
|
+
$isPreviousMonth: isPreviousMonth,
|
|
1580
|
+
"aria-selected": !isInvalidDateRange && isSelected || undefined,
|
|
1581
|
+
"aria-disabled": isDisabled || undefined,
|
|
1582
|
+
$isCompact: isCompact,
|
|
1499
1583
|
onClick: () => {
|
|
1500
1584
|
if (!isDisabled) {
|
|
1501
1585
|
dispatch({
|
|
@@ -1565,32 +1649,32 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
1565
1649
|
});
|
|
1566
1650
|
return React__namespace.default.createElement(StyledDatePicker, {
|
|
1567
1651
|
ref: ref,
|
|
1568
|
-
isCompact: isCompact,
|
|
1652
|
+
$isCompact: isCompact,
|
|
1569
1653
|
onMouseDown: e => {
|
|
1570
1654
|
e.preventDefault();
|
|
1571
1655
|
}
|
|
1572
1656
|
}, React__namespace.default.createElement(StyledHeader, {
|
|
1573
|
-
isCompact: isCompact
|
|
1657
|
+
$isCompact: isCompact
|
|
1574
1658
|
}, React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
1575
|
-
isCompact: isCompact,
|
|
1659
|
+
$isCompact: isCompact,
|
|
1576
1660
|
onClick: () => {
|
|
1577
1661
|
dispatch({
|
|
1578
1662
|
type: 'PREVIEW_PREVIOUS_MONTH'
|
|
1579
1663
|
});
|
|
1580
1664
|
},
|
|
1581
|
-
|
|
1665
|
+
"aria-hidden": isPreviousHidden || undefined
|
|
1582
1666
|
}, React__namespace.default.createElement(SvgChevronLeftStroke, null)), React__namespace.default.createElement(StyledHeaderLabel, {
|
|
1583
|
-
isCompact: isCompact
|
|
1667
|
+
$isCompact: isCompact
|
|
1584
1668
|
}, headerLabelFormatter(displayDate)), React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
1585
|
-
isCompact: isCompact,
|
|
1586
|
-
|
|
1669
|
+
$isCompact: isCompact,
|
|
1670
|
+
"aria-hidden": isNextHidden || undefined,
|
|
1587
1671
|
onClick: () => {
|
|
1588
1672
|
dispatch({
|
|
1589
1673
|
type: 'PREVIEW_NEXT_MONTH'
|
|
1590
1674
|
});
|
|
1591
1675
|
}
|
|
1592
1676
|
}, React__namespace.default.createElement(SvgChevronRightStroke, null))), React__namespace.default.createElement(StyledCalendar, {
|
|
1593
|
-
isCompact: isCompact,
|
|
1677
|
+
$isCompact: isCompact,
|
|
1594
1678
|
onMouseLeave: () => {
|
|
1595
1679
|
dispatch({
|
|
1596
1680
|
type: 'HOVER_DATE',
|
|
@@ -1605,10 +1689,10 @@ const Calendar = React.forwardRef((props, ref) => {
|
|
|
1605
1689
|
const {
|
|
1606
1690
|
state
|
|
1607
1691
|
} = useDatePickerContext();
|
|
1608
|
-
return React__namespace.default.createElement(StyledRangeCalendar,
|
|
1692
|
+
return React__namespace.default.createElement(StyledRangeCalendar, Object.assign({
|
|
1609
1693
|
ref: ref,
|
|
1610
1694
|
"data-garden-id": "datepickers.range",
|
|
1611
|
-
"data-garden-version": '9.0.0-next.
|
|
1695
|
+
"data-garden-version": '9.0.0-next.21'
|
|
1612
1696
|
}, props), React__namespace.default.createElement(Month, {
|
|
1613
1697
|
displayDate: state.previewDate,
|
|
1614
1698
|
isNextHidden: true
|