@zendeskgarden/react-datepickers 9.0.0-next.1 → 9.0.0-next.10

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.
Files changed (55) hide show
  1. package/README.md +7 -7
  2. package/dist/esm/elements/DatePicker/DatePicker.js +169 -0
  3. package/dist/esm/elements/DatePicker/components/Calendar.js +125 -0
  4. package/dist/esm/elements/DatePicker/components/Input.js +75 -0
  5. package/dist/esm/elements/DatePicker/components/MonthSelector.js +61 -0
  6. package/dist/esm/elements/DatePicker/utils/date-picker-reducer.js +187 -0
  7. package/dist/esm/elements/DatePicker/utils/useDatePickerContext.js +14 -0
  8. package/dist/esm/elements/DatePickerRange/DatePickerRange.js +101 -0
  9. package/dist/esm/elements/DatePickerRange/components/Calendar.js +42 -0
  10. package/dist/esm/elements/DatePickerRange/components/End.js +79 -0
  11. package/dist/esm/elements/DatePickerRange/components/Month.js +270 -0
  12. package/dist/esm/elements/DatePickerRange/components/Start.js +79 -0
  13. package/dist/esm/elements/DatePickerRange/utils/date-picker-range-reducer.js +319 -0
  14. package/dist/esm/elements/DatePickerRange/utils/useDatePickerRangeContext.js +14 -0
  15. package/dist/esm/index.js +8 -0
  16. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-left-stroke.svg.js +25 -0
  17. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-right-stroke.svg.js +25 -0
  18. package/dist/esm/styled/StyledCalendar.js +21 -0
  19. package/dist/esm/styled/StyledCalendarItem.js +34 -0
  20. package/dist/esm/styled/StyledDatePicker.js +32 -0
  21. package/dist/esm/styled/StyledDay.js +54 -0
  22. package/dist/esm/styled/StyledDayLabel.js +21 -0
  23. package/dist/esm/styled/StyledHeader.js +21 -0
  24. package/dist/esm/styled/StyledHeaderLabel.js +21 -0
  25. package/dist/esm/styled/StyledHeaderPaddle.js +38 -0
  26. package/dist/esm/styled/StyledHighlight.js +50 -0
  27. package/dist/esm/styled/StyledMenu.js +22 -0
  28. package/dist/esm/styled/StyledMenuWrapper.js +27 -0
  29. package/dist/esm/styled/StyledRangeCalendar.js +22 -0
  30. package/dist/esm/types/index.js +12 -0
  31. package/dist/esm/utils/calendar-utils.js +88 -0
  32. package/dist/index.cjs.js +195 -238
  33. package/dist/typings/elements/{Datepicker/Datepicker.d.ts → DatePicker/DatePicker.d.ts} +2 -2
  34. package/dist/typings/elements/DatePicker/components/Input.d.ts +16 -0
  35. package/dist/typings/elements/{Datepicker/utils/datepicker-reducer.d.ts → DatePicker/utils/date-picker-reducer.d.ts} +6 -6
  36. package/dist/typings/elements/DatePicker/utils/useDatePickerContext.d.ts +18 -0
  37. package/dist/typings/elements/{DatepickerRange/DatepickerRange.d.ts → DatePickerRange/DatePickerRange.d.ts} +3 -3
  38. package/dist/typings/elements/{DatepickerRange/utils/datepicker-range-reducer.d.ts → DatePickerRange/utils/date-picker-range-reducer.d.ts} +6 -6
  39. package/dist/typings/elements/{DatepickerRange/utils/useDatepickerRangeContext.d.ts → DatePickerRange/utils/useDatePickerRangeContext.d.ts} +7 -7
  40. package/dist/typings/index.d.ts +3 -5
  41. package/dist/typings/styled/{StyledDatepicker.d.ts → StyledDatePicker.d.ts} +3 -3
  42. package/dist/typings/styled/StyledMenuWrapper.d.ts +2 -2
  43. package/dist/typings/styled/index.d.ts +1 -1
  44. package/dist/typings/types/index.d.ts +5 -14
  45. package/dist/typings/utils/calendar-utils.d.ts +2 -2
  46. package/package.json +8 -7
  47. package/dist/index.esm.js +0 -1714
  48. package/dist/typings/elements/Datepicker/utils/garden-placements.d.ts +0 -21
  49. package/dist/typings/elements/Datepicker/utils/useDatepickerContext.d.ts +0 -18
  50. /package/dist/typings/elements/{Datepicker → DatePicker}/components/Calendar.d.ts +0 -0
  51. /package/dist/typings/elements/{Datepicker → DatePicker}/components/MonthSelector.d.ts +0 -0
  52. /package/dist/typings/elements/{DatepickerRange → DatePickerRange}/components/Calendar.d.ts +0 -0
  53. /package/dist/typings/elements/{DatepickerRange → DatePickerRange}/components/End.d.ts +0 -0
  54. /package/dist/typings/elements/{DatepickerRange → DatePickerRange}/components/Month.d.ts +0 -0
  55. /package/dist/typings/elements/{DatepickerRange → DatePickerRange}/components/Start.d.ts +0 -0
@@ -0,0 +1,319 @@
1
+ /**
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
+ */
7
+ import { addMonths } from 'date-fns/addMonths';
8
+ import { subMonths } from 'date-fns/subMonths';
9
+ import { isBefore } from 'date-fns/isBefore';
10
+ import { isValid } from 'date-fns/isValid';
11
+ import { isSameDay } from 'date-fns/isSameDay';
12
+ import { endOfMonth } from 'date-fns/endOfMonth';
13
+ import { parse } from 'date-fns/parse';
14
+ import { startOfMonth } from 'date-fns/startOfMonth';
15
+ import { compareAsc } from 'date-fns/compareAsc';
16
+ import { isAfter } from 'date-fns/isAfter';
17
+
18
+ function formatValue(_ref) {
19
+ let {
20
+ value,
21
+ locale,
22
+ formatDate
23
+ } = _ref;
24
+ let stringValue = '';
25
+ if (value !== undefined && isValid(value)) {
26
+ if (formatDate) {
27
+ stringValue = formatDate(value);
28
+ } else {
29
+ stringValue = new Intl.DateTimeFormat(locale, {
30
+ month: 'long',
31
+ day: 'numeric',
32
+ year: 'numeric'
33
+ }).format(value);
34
+ }
35
+ }
36
+ return stringValue;
37
+ }
38
+ function parseInputValue(_ref2) {
39
+ let {
40
+ inputValue
41
+ } = _ref2;
42
+ const MINIMUM_DATE = new Date(1001, 0, 0);
43
+ let tryParseDate = parse(inputValue || '', 'P', new Date());
44
+ if (isValid(tryParseDate) && !isBefore(tryParseDate, MINIMUM_DATE)) {
45
+ return tryParseDate;
46
+ }
47
+ tryParseDate = parse(inputValue || '', 'PP', new Date());
48
+ if (isValid(tryParseDate) && !isBefore(tryParseDate, MINIMUM_DATE)) {
49
+ return tryParseDate;
50
+ }
51
+ tryParseDate = parse(inputValue || '', 'PPP', new Date());
52
+ if (isValid(tryParseDate) && !isBefore(tryParseDate, MINIMUM_DATE)) {
53
+ return tryParseDate;
54
+ }
55
+ return new Date(NaN);
56
+ }
57
+ const datepickerRangeReducer = _ref3 => {
58
+ let {
59
+ startValue,
60
+ endValue,
61
+ locale,
62
+ formatDate,
63
+ customParseDate
64
+ } = _ref3;
65
+ return (state, action) => {
66
+ switch (action.type) {
67
+ case 'START_FOCUS':
68
+ {
69
+ let previewDate = state.previewDate;
70
+ if (startValue) {
71
+ if (compareAsc(startValue, startOfMonth(state.previewDate)) === 1 && compareAsc(startValue, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
72
+ previewDate = state.previewDate;
73
+ } else {
74
+ previewDate = startOfMonth(startValue);
75
+ }
76
+ }
77
+ return {
78
+ ...state,
79
+ previewDate,
80
+ isStartFocused: true,
81
+ isEndFocused: false
82
+ };
83
+ }
84
+ case 'END_FOCUS':
85
+ {
86
+ let previewDate = state.previewDate;
87
+ if (endValue) {
88
+ if (compareAsc(endValue, startOfMonth(state.previewDate)) === 1 && compareAsc(endValue, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
89
+ previewDate = state.previewDate;
90
+ } else {
91
+ previewDate = startOfMonth(endValue);
92
+ }
93
+ }
94
+ return {
95
+ ...state,
96
+ previewDate,
97
+ isEndFocused: true,
98
+ isStartFocused: false
99
+ };
100
+ }
101
+ case 'START_BLUR':
102
+ {
103
+ let parsedDate;
104
+ if (customParseDate) {
105
+ parsedDate = customParseDate(state.startInputValue);
106
+ } else {
107
+ parsedDate = parseInputValue({
108
+ inputValue: state.startInputValue
109
+ });
110
+ }
111
+ const startInputValue = formatValue({
112
+ value: parsedDate,
113
+ locale,
114
+ formatDate
115
+ });
116
+ return {
117
+ ...state,
118
+ startInputValue: startInputValue || formatValue({
119
+ value: startValue,
120
+ locale,
121
+ formatDate
122
+ }),
123
+ isStartFocused: false
124
+ };
125
+ }
126
+ case 'END_BLUR':
127
+ {
128
+ let parsedDate;
129
+ if (customParseDate) {
130
+ parsedDate = customParseDate(state.endInputValue);
131
+ } else {
132
+ parsedDate = parseInputValue({
133
+ inputValue: state.endInputValue
134
+ });
135
+ }
136
+ const endInputValue = formatValue({
137
+ value: parsedDate,
138
+ locale,
139
+ formatDate
140
+ }) || formatValue({
141
+ value: endValue,
142
+ locale,
143
+ formatDate
144
+ });
145
+ return {
146
+ ...state,
147
+ endInputValue,
148
+ isEndFocused: false
149
+ };
150
+ }
151
+ case 'CONTROLLED_START_VALUE_CHANGE':
152
+ {
153
+ const startInputValue = formatValue({
154
+ value: action.value,
155
+ locale,
156
+ formatDate
157
+ });
158
+ let previewDate = state.previewDate;
159
+ if (action.value) {
160
+ if (compareAsc(action.value, startOfMonth(state.previewDate)) === 1 && compareAsc(action.value, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
161
+ previewDate = state.previewDate;
162
+ } else {
163
+ previewDate = startOfMonth(action.value);
164
+ }
165
+ }
166
+ return {
167
+ ...state,
168
+ startInputValue,
169
+ hoverDate: undefined,
170
+ previewDate
171
+ };
172
+ }
173
+ case 'CONTROLLED_END_VALUE_CHANGE':
174
+ {
175
+ const endInputValue = formatValue({
176
+ value: action.value,
177
+ locale,
178
+ formatDate
179
+ });
180
+ let previewDate = state.previewDate;
181
+ if (action.value) {
182
+ if (compareAsc(action.value, startOfMonth(state.previewDate)) === 1 && compareAsc(action.value, addMonths(endOfMonth(state.previewDate), 1)) === -1) {
183
+ previewDate = state.previewDate;
184
+ } else {
185
+ previewDate = startOfMonth(action.value);
186
+ }
187
+ }
188
+ return {
189
+ ...state,
190
+ endInputValue,
191
+ hoverDate: undefined,
192
+ previewDate
193
+ };
194
+ }
195
+ case 'CLICK_DATE':
196
+ if (state.isStartFocused) {
197
+ if (endValue !== undefined && (isBefore(action.value, endValue) || isSameDay(action.value, endValue))) {
198
+ return {
199
+ ...state,
200
+ startInputValue: formatValue({
201
+ value: action.value
202
+ })
203
+ };
204
+ }
205
+ return {
206
+ ...state,
207
+ startInputValue: formatValue({
208
+ value: action.value
209
+ }),
210
+ endInputValue: undefined
211
+ };
212
+ } else if (state.isEndFocused) {
213
+ if (startValue !== undefined && (isAfter(action.value, startValue) || isSameDay(action.value, startValue))) {
214
+ return {
215
+ ...state,
216
+ endInputValue: formatValue({
217
+ value: action.value
218
+ })
219
+ };
220
+ }
221
+ return {
222
+ ...state,
223
+ startInputValue: formatValue({
224
+ value: action.value
225
+ })
226
+ };
227
+ } else if (startValue === undefined) {
228
+ return {
229
+ ...state,
230
+ startInputValue: formatValue({
231
+ value: action.value
232
+ }),
233
+ endInputValue: undefined
234
+ };
235
+ } else if (endValue === undefined) {
236
+ if (isBefore(action.value, startValue)) {
237
+ return {
238
+ ...state,
239
+ startInputValue: formatValue({
240
+ value: action.value
241
+ }),
242
+ endInputValue: undefined
243
+ };
244
+ }
245
+ return {
246
+ ...state,
247
+ endInputValue: formatValue({
248
+ value: action.value
249
+ })
250
+ };
251
+ }
252
+ return state;
253
+ case 'START_INPUT_ONCHANGE':
254
+ {
255
+ return {
256
+ ...state,
257
+ startInputValue: action.value
258
+ };
259
+ }
260
+ case 'END_INPUT_ONCHANGE':
261
+ {
262
+ return {
263
+ ...state,
264
+ endInputValue: action.value
265
+ };
266
+ }
267
+ case 'HOVER_DATE':
268
+ return {
269
+ ...state,
270
+ hoverDate: action.value
271
+ };
272
+ case 'PREVIEW_NEXT_MONTH':
273
+ {
274
+ const previewDate = addMonths(state.previewDate, 1);
275
+ return {
276
+ ...state,
277
+ previewDate,
278
+ hoverDate: undefined
279
+ };
280
+ }
281
+ case 'PREVIEW_PREVIOUS_MONTH':
282
+ {
283
+ const previewDate = subMonths(state.previewDate, 1);
284
+ return {
285
+ ...state,
286
+ previewDate,
287
+ hoverDate: undefined
288
+ };
289
+ }
290
+ default:
291
+ throw new Error();
292
+ }
293
+ };
294
+ };
295
+ function retrieveInitialState(initialProps) {
296
+ let previewDate = initialProps.startValue;
297
+ if (previewDate === undefined || !isValid(previewDate)) {
298
+ previewDate = new Date();
299
+ }
300
+ const startInputValue = formatValue({
301
+ value: initialProps.startValue,
302
+ locale: initialProps.locale,
303
+ formatDate: initialProps.formatDate
304
+ });
305
+ const endInputValue = formatValue({
306
+ value: initialProps.endValue,
307
+ locale: initialProps.locale,
308
+ formatDate: initialProps.formatDate
309
+ });
310
+ return {
311
+ previewDate,
312
+ startInputValue,
313
+ endInputValue,
314
+ isStartFocused: false,
315
+ isEndFocused: false
316
+ };
317
+ }
318
+
319
+ export { datepickerRangeReducer, formatValue, parseInputValue, retrieveInitialState };
@@ -0,0 +1,14 @@
1
+ /**
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
+ */
7
+ import { createContext, useContext } from 'react';
8
+
9
+ const DatePickerRangeContext = createContext(undefined);
10
+ const useDatePickerContext = () => {
11
+ return useContext(DatePickerRangeContext);
12
+ };
13
+
14
+ export { DatePickerRangeContext, useDatePickerContext as default };
@@ -0,0 +1,8 @@
1
+ /**
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
+ */
7
+ export { DatePicker } from './elements/DatePicker/DatePicker.js';
8
+ export { DatePickerRange } from './elements/DatePickerRange/DatePickerRange.js';
@@ -0,0 +1,25 @@
1
+ /**
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
+ */
7
+ import * as React from 'react';
8
+
9
+ var _path;
10
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
+ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
12
+ return /*#__PURE__*/React.createElement("svg", _extends({
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: 16,
15
+ height: 16,
16
+ focusable: "false",
17
+ viewBox: "0 0 16 16",
18
+ "aria-hidden": "true"
19
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
20
+ fill: "currentColor",
21
+ d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
22
+ })));
23
+ };
24
+
25
+ export { SvgChevronLeftStroke as default };
@@ -0,0 +1,25 @@
1
+ /**
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
+ */
7
+ import * as React from 'react';
8
+
9
+ var _path;
10
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
+ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
12
+ return /*#__PURE__*/React.createElement("svg", _extends({
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: 16,
15
+ height: 16,
16
+ focusable: "false",
17
+ viewBox: "0 0 16 16",
18
+ "aria-hidden": "true"
19
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
20
+ fill: "currentColor",
21
+ d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
22
+ })));
23
+ };
24
+
25
+ export { SvgChevronRightStroke as default };
@@ -0,0 +1,21 @@
1
+ /**
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
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'datepickers.calendar';
11
+ const StyledCalendar = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID
13
+ }).withConfig({
14
+ displayName: "StyledCalendar",
15
+ componentId: "sc-g5hoe8-0"
16
+ })(["width:", "px;", ";"], props => props.isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => retrieveComponentStyles(COMPONENT_ID, props));
17
+ StyledCalendar.defaultProps = {
18
+ theme: DEFAULT_THEME
19
+ };
20
+
21
+ export { StyledCalendar };
@@ -0,0 +1,34 @@
1
+ /**
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
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'datepickers.calendar_item';
11
+ const retrieveSize = _ref => {
12
+ let {
13
+ isCompact,
14
+ theme
15
+ } = _ref;
16
+ let size;
17
+ if (isCompact) {
18
+ size = `${theme.space.base * 8}px`;
19
+ } else {
20
+ size = `${theme.space.base * 10}px`;
21
+ }
22
+ return css(["width:", ";height:", ";"], size, size);
23
+ };
24
+ const StyledCalendarItem = styled.div.attrs({
25
+ 'data-garden-id': COMPONENT_ID
26
+ }).withConfig({
27
+ displayName: "StyledCalendarItem",
28
+ componentId: "sc-143w8wb-0"
29
+ })(["display:inline-block;position:relative;vertical-align:top;", " ", ";"], retrieveSize, props => retrieveComponentStyles(COMPONENT_ID, props));
30
+ StyledCalendarItem.defaultProps = {
31
+ theme: DEFAULT_THEME
32
+ };
33
+
34
+ export { StyledCalendarItem, retrieveSize };
@@ -0,0 +1,32 @@
1
+ /**
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
+ */
7
+ import styled from 'styled-components';
8
+ import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'datepickers.datepicker';
11
+ const retrievePadding = _ref => {
12
+ let {
13
+ isCompact,
14
+ theme
15
+ } = _ref;
16
+ let value = theme.space.base * 5;
17
+ if (isCompact) {
18
+ value = theme.space.base * 4;
19
+ }
20
+ return `margin: ${value}px;`;
21
+ };
22
+ const StyledDatePicker = styled.div.attrs({
23
+ 'data-garden-id': COMPONENT_ID
24
+ }).withConfig({
25
+ displayName: "StyledDatePicker",
26
+ componentId: "sc-15hwqzh-0"
27
+ })(["direction:", ";", " background-color:", ";color:", ";", ";"], props => props.theme.rtl && 'rtl', retrievePadding, props => getColorV8('background', 600 , props.theme), props => getColorV8('foreground', 600 , props.theme), props => retrieveComponentStyles(COMPONENT_ID, props));
28
+ StyledDatePicker.defaultProps = {
29
+ theme: DEFAULT_THEME
30
+ };
31
+
32
+ export { StyledDatePicker };
@@ -0,0 +1,54 @@
1
+ /**
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
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+
10
+ const retrieveStyledDayColors = _ref => {
11
+ let {
12
+ isSelected,
13
+ isDisabled,
14
+ isToday,
15
+ isPreviousMonth,
16
+ theme
17
+ } = _ref;
18
+ let backgroundColor = 'inherit';
19
+ let color = getColorV8('primaryHue', 600, theme);
20
+ if (isSelected && !isDisabled) {
21
+ backgroundColor = getColorV8('primaryHue', 600, theme);
22
+ color = getColorV8('background', 600 , theme);
23
+ } else if (isDisabled) {
24
+ color = getColorV8('neutralHue', 400, theme);
25
+ } else if (isToday) {
26
+ color = 'inherit';
27
+ } else if (isPreviousMonth) {
28
+ color = getColorV8('neutralHue', 600, theme);
29
+ }
30
+ return css(["background-color:", ";color:", ";", ""], backgroundColor, color, !isSelected && !isDisabled && `
31
+ :hover {
32
+ background-color: ${getColorV8('primaryHue', 600, theme, 0.08)};
33
+ color: ${getColorV8('primaryHue', 800, theme)};
34
+ }
35
+
36
+ :active {
37
+ background-color: ${getColorV8('primaryHue', 600, theme, 0.2)};
38
+ color: ${getColorV8('primaryHue', 800, theme)};
39
+ }
40
+ `);
41
+ };
42
+ const COMPONENT_ID = 'datepickers.day';
43
+ const StyledDay = styled.div.attrs(props => ({
44
+ 'data-garden-id': COMPONENT_ID,
45
+ 'aria-disabled': props.isDisabled ? 'true' : 'false'
46
+ })).withConfig({
47
+ displayName: "StyledDay",
48
+ componentId: "sc-v42uk5-0"
49
+ })(["display:flex;position:absolute;align-items:center;justify-content:center;border-radius:50%;cursor:", ";width:100%;height:100%;font-size:", ";font-weight:", ";", " ", ";"], props => props.isDisabled ? 'inherit' : 'pointer', props => props.isCompact ? props.theme.fontSizes.sm : props.theme.fontSizes.md, props => props.isToday && !props.isDisabled ? props.theme.fontWeights.semibold : 'inherit', retrieveStyledDayColors, props => retrieveComponentStyles(COMPONENT_ID, props));
50
+ StyledDay.defaultProps = {
51
+ theme: DEFAULT_THEME
52
+ };
53
+
54
+ export { StyledDay };
@@ -0,0 +1,21 @@
1
+ /**
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
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'datepickers.day_label';
11
+ const StyledDayLabel = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID
13
+ }).withConfig({
14
+ displayName: "StyledDayLabel",
15
+ componentId: "sc-9bh1p7-0"
16
+ })(["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 => retrieveComponentStyles(COMPONENT_ID, props));
17
+ StyledDayLabel.defaultProps = {
18
+ theme: DEFAULT_THEME
19
+ };
20
+
21
+ export { StyledDayLabel };
@@ -0,0 +1,21 @@
1
+ /**
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
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'datepickers.header';
11
+ const StyledHeader = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID
13
+ }).withConfig({
14
+ displayName: "StyledHeader",
15
+ componentId: "sc-upq318-0"
16
+ })(["display:flex;width:", "px;", ";"], props => props.isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => retrieveComponentStyles(COMPONENT_ID, props));
17
+ StyledHeader.defaultProps = {
18
+ theme: DEFAULT_THEME
19
+ };
20
+
21
+ export { StyledHeader };
@@ -0,0 +1,21 @@
1
+ /**
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
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'datepickers.header_label';
11
+ const StyledHeaderLabel = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID
13
+ }).withConfig({
14
+ displayName: "StyledHeaderLabel",
15
+ componentId: "sc-1ryf5ub-0"
16
+ })(["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 => retrieveComponentStyles(COMPONENT_ID, props));
17
+ StyledHeaderLabel.defaultProps = {
18
+ theme: DEFAULT_THEME
19
+ };
20
+
21
+ export { StyledHeaderLabel };
@@ -0,0 +1,38 @@
1
+ /**
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
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+
10
+ const retrieveSizing = _ref => {
11
+ let {
12
+ isCompact,
13
+ theme
14
+ } = _ref;
15
+ let size = theme.space.base * 10;
16
+ if (isCompact) {
17
+ size = theme.space.base * 8;
18
+ }
19
+ return css(["width:", "px;height:", "px;"], size, size);
20
+ };
21
+ const retrieveColor = _ref2 => {
22
+ let {
23
+ theme
24
+ } = _ref2;
25
+ return css([":hover{background-color:", ";color:", ";}:active{background-color:", ";color:", ";}color:", ";"], getColorV8('primaryHue', 600, theme, 0.08), getColorV8('foreground', 600 , theme), getColorV8('primaryHue', 600, theme, 0.2), getColorV8('foreground', 600 , theme), getColorV8('neutralHue', 600, theme));
26
+ };
27
+ const COMPONENT_ID = 'datepickers.header_paddle';
28
+ const StyledHeaderPaddle = styled.div.attrs({
29
+ 'data-garden-id': COMPONENT_ID
30
+ }).withConfig({
31
+ displayName: "StyledHeaderPaddle",
32
+ componentId: "sc-2oqh0g-0"
33
+ })(["display:flex;align-items:center;justify-content:center;transform:", ";visibility:", ";border-radius:50%;cursor:pointer;", " ", " svg{width:", ";height:", ";}", ";"], props => props.theme.rtl && 'rotate(180deg)', props => props.isHidden && 'hidden', retrieveSizing, retrieveColor, props => `${props.theme.iconSizes.md}`, props => `${props.theme.iconSizes.md}`, props => retrieveComponentStyles(COMPONENT_ID, props));
34
+ StyledHeaderPaddle.defaultProps = {
35
+ theme: DEFAULT_THEME
36
+ };
37
+
38
+ export { StyledHeaderPaddle };