@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.
Files changed (37) hide show
  1. package/dist/esm/elements/DatePicker/DatePicker.js +19 -15
  2. package/dist/esm/elements/DatePicker/components/Calendar.js +12 -12
  3. package/dist/esm/elements/DatePicker/components/MonthSelector.js +4 -4
  4. package/dist/esm/elements/DatePickerRange/components/Calendar.js +1 -1
  5. package/dist/esm/elements/DatePickerRange/components/Month.js +26 -26
  6. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-left-stroke.svg.js +1 -1
  7. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-right-stroke.svg.js +1 -1
  8. package/dist/esm/styled/StyledCalendar.js +4 -6
  9. package/dist/esm/styled/StyledCalendarItem.js +8 -10
  10. package/dist/esm/styled/StyledDatePicker.js +19 -14
  11. package/dist/esm/styled/StyledDay.js +71 -33
  12. package/dist/esm/styled/StyledDayLabel.js +4 -6
  13. package/dist/esm/styled/StyledHeader.js +4 -6
  14. package/dist/esm/styled/StyledHeaderLabel.js +4 -6
  15. package/dist/esm/styled/StyledHeaderPaddle.js +45 -15
  16. package/dist/esm/styled/StyledHighlight.js +26 -23
  17. package/dist/esm/styled/StyledMenu.js +2 -5
  18. package/dist/esm/styled/StyledMenuWrapper.js +8 -9
  19. package/dist/esm/styled/StyledRangeCalendar.js +3 -5
  20. package/dist/index.cjs.js +248 -184
  21. package/dist/typings/elements/DatePicker/utils/date-picker-reducer.d.ts +4 -4
  22. package/dist/typings/elements/DatePicker/utils/useDatePickerContext.d.ts +0 -1
  23. package/dist/typings/elements/DatePickerRange/DatePickerRange.d.ts +4 -2
  24. package/dist/typings/elements/DatePickerRange/utils/date-picker-range-reducer.d.ts +4 -4
  25. package/dist/typings/styled/StyledCalendar.d.ts +3 -2
  26. package/dist/typings/styled/StyledCalendarItem.d.ts +4 -3
  27. package/dist/typings/styled/StyledDatePicker.d.ts +3 -2
  28. package/dist/typings/styled/StyledDay.d.ts +5 -5
  29. package/dist/typings/styled/StyledDayLabel.d.ts +3 -2
  30. package/dist/typings/styled/StyledHeader.d.ts +3 -2
  31. package/dist/typings/styled/StyledHeaderLabel.d.ts +3 -2
  32. package/dist/typings/styled/StyledHeaderPaddle.d.ts +7 -4
  33. package/dist/typings/styled/StyledHighlight.d.ts +5 -4
  34. package/dist/typings/styled/StyledMenuWrapper.d.ts +4 -4
  35. package/dist/typings/styled/StyledRangeCalendar.d.ts +2 -1
  36. package/dist/typings/types/index.d.ts +2 -0
  37. package/package.json +7 -7
@@ -5,6 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import React__default, { forwardRef, useContext, useCallback, useReducer, useRef, useState, useMemo, useEffect } from 'react';
8
+ import { createPortal } from 'react-dom';
8
9
  import PropTypes from 'prop-types';
9
10
  import { mergeRefs } from 'react-merge-refs';
10
11
  import { ThemeContext } from 'styled-components';
@@ -31,6 +32,7 @@ import { Input } from './components/Input.js';
31
32
  const PLACEMENT_DEFAULT = 'bottom-start';
32
33
  const DatePicker = forwardRef((props, calendarRef) => {
33
34
  const {
35
+ appendToNode,
34
36
  children,
35
37
  placement: _placement,
36
38
  zIndex,
@@ -115,24 +117,16 @@ const DatePicker = forwardRef((props, calendarRef) => {
115
117
  type: 'CONTROLLED_LOCALE_CHANGE'
116
118
  });
117
119
  }, [locale]);
118
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(Input, {
119
- element: Child,
120
- dispatch: dispatch,
121
- state: state,
122
- refKey: refKey,
123
- ref: mergeRefs([triggerRef, Child.ref ? Child.ref : null])
124
- }), React__default.createElement(DatePickerContext.Provider, {
125
- value: contextValue
126
- }, React__default.createElement(StyledMenuWrapper, {
120
+ const Node = React__default.createElement(StyledMenuWrapper, {
127
121
  ref: floatingRef,
128
122
  style: {
129
123
  transform
130
124
  },
131
- isHidden: !state.isOpen,
132
- isAnimated: isAnimated && (state.isOpen || isVisible),
133
- placement: placement,
134
- zIndex: zIndex
135
- }, (state.isOpen || isVisible) && React__default.createElement(StyledMenu, menuProps, React__default.createElement(Calendar, {
125
+ $isAnimated: !!isAnimated && (state.isOpen || isVisible),
126
+ $placement: placement,
127
+ $zIndex: zIndex,
128
+ "aria-hidden": !state.isOpen || undefined
129
+ }, !!(state.isOpen || isVisible) && React__default.createElement(StyledMenu, menuProps, React__default.createElement(Calendar, {
136
130
  ref: calendarRef,
137
131
  isCompact: isCompact,
138
132
  value: value,
@@ -140,10 +134,20 @@ const DatePicker = forwardRef((props, calendarRef) => {
140
134
  maxValue: maxValue,
141
135
  locale: locale,
142
136
  weekStartsOn: weekStartsOn
143
- })))));
137
+ })));
138
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement(Input, {
139
+ element: Child,
140
+ dispatch: dispatch,
141
+ state: state,
142
+ refKey: refKey,
143
+ ref: mergeRefs([triggerRef, Child.ref ? Child.ref : null])
144
+ }), React__default.createElement(DatePickerContext.Provider, {
145
+ value: contextValue
146
+ }, appendToNode ? createPortal(Node, appendToNode) : Node));
144
147
  });
145
148
  DatePicker.displayName = 'DatePicker';
146
149
  DatePicker.propTypes = {
150
+ appendToNode: PropTypes.any,
147
151
  value: PropTypes.any,
148
152
  onChange: PropTypes.any,
149
153
  formatDate: PropTypes.func,
@@ -68,15 +68,15 @@ const Calendar = forwardRef((_ref, ref) => {
68
68
  const formattedDayLabel = dayLabelFormatter(date);
69
69
  return React__default.createElement(StyledCalendarItem, {
70
70
  key: `day-label-${formattedDayLabel}`,
71
- isCompact: isCompact
71
+ $isCompact: isCompact
72
72
  }, React__default.createElement(StyledDayLabel, {
73
- isCompact: isCompact
73
+ $isCompact: isCompact
74
74
  }, formattedDayLabel));
75
75
  });
76
76
  const items = eachDayOfInterval({
77
77
  start: startDate,
78
78
  end: endDate
79
- }).map((date, itemsIndex) => {
79
+ }).map(date => {
80
80
  const formattedDayLabel = getDate(date);
81
81
  const isCurrentDate = isToday(date);
82
82
  const isPreviousMonth = !isSameMonth(date, state.previewDate);
@@ -89,14 +89,14 @@ const Calendar = forwardRef((_ref, ref) => {
89
89
  isDisabled = isDisabled || isAfter(date, maxValue) && !isSameDay(date, maxValue);
90
90
  }
91
91
  return React__default.createElement(StyledCalendarItem, {
92
- key: `day-${itemsIndex}`,
93
- isCompact: isCompact
92
+ key: date.toISOString(),
93
+ $isCompact: isCompact
94
94
  }, React__default.createElement(StyledDay, {
95
- isToday: isCurrentDate,
96
- isPreviousMonth: isPreviousMonth,
97
- isSelected: isSelected,
98
- isDisabled: isDisabled,
99
- isCompact: isCompact,
95
+ $isToday: isCurrentDate,
96
+ $isPreviousMonth: isPreviousMonth,
97
+ $isCompact: isCompact,
98
+ "aria-selected": isSelected || undefined,
99
+ "aria-disabled": isDisabled || undefined,
100
100
  onClick: () => {
101
101
  if (!isDisabled) {
102
102
  dispatch({
@@ -109,7 +109,7 @@ const Calendar = forwardRef((_ref, ref) => {
109
109
  });
110
110
  return React__default.createElement(StyledDatePicker, {
111
111
  ref: ref,
112
- isCompact: isCompact,
112
+ $isCompact: isCompact,
113
113
  onMouseDown: e => {
114
114
  e.preventDefault();
115
115
  }
@@ -117,7 +117,7 @@ const Calendar = forwardRef((_ref, ref) => {
117
117
  locale: locale,
118
118
  isCompact: isCompact
119
119
  }), React__default.createElement(StyledCalendar, {
120
- isCompact: isCompact
120
+ $isCompact: isCompact
121
121
  }, dayLabels, items));
122
122
  });
123
123
  Calendar.displayName = 'Calendar';
@@ -38,18 +38,18 @@ const MonthSelector = _ref => {
38
38
  return formatter.format(date);
39
39
  }, [locale]);
40
40
  return React__default.createElement(StyledHeader, {
41
- isCompact: isCompact
41
+ $isCompact: isCompact
42
42
  }, React__default.createElement(StyledHeaderPaddle, {
43
- isCompact: isCompact,
43
+ $isCompact: isCompact,
44
44
  onClick: () => {
45
45
  dispatch({
46
46
  type: 'PREVIEW_PREVIOUS_MONTH'
47
47
  });
48
48
  }
49
49
  }, React__default.createElement(SvgChevronLeftStroke, null)), React__default.createElement(StyledHeaderLabel, {
50
- isCompact: isCompact
50
+ $isCompact: isCompact
51
51
  }, headerLabelFormatter(state.previewDate)), React__default.createElement(StyledHeaderPaddle, {
52
- isCompact: isCompact,
52
+ $isCompact: isCompact,
53
53
  onClick: () => {
54
54
  dispatch({
55
55
  type: 'PREVIEW_NEXT_MONTH'
@@ -28,7 +28,7 @@ const Calendar = forwardRef((props, ref) => {
28
28
  return React__default.createElement(StyledRangeCalendar, Object.assign({
29
29
  ref: ref,
30
30
  "data-garden-id": "datepickers.range",
31
- "data-garden-version": '9.0.0-next.9'
31
+ "data-garden-version": '9.1.0'
32
32
  }, props), React__default.createElement(Month, {
33
33
  displayDate: state.previewDate,
34
34
  isNextHidden: true
@@ -88,26 +88,26 @@ const Month = forwardRef((_ref, ref) => {
88
88
  const formattedDayLabel = dayLabelFormatter(date);
89
89
  return React__default.createElement(StyledCalendarItem, {
90
90
  key: `day-label-${formattedDayLabel}`,
91
- isCompact: isCompact
91
+ $isCompact: isCompact
92
92
  }, React__default.createElement(StyledDayLabel, {
93
- isCompact: isCompact
93
+ $isCompact: isCompact
94
94
  }, formattedDayLabel));
95
95
  });
96
96
  const items = eachDayOfInterval({
97
97
  start: startDate,
98
98
  end: endDate
99
- }).map((date, itemsIndex) => {
99
+ }).map(date => {
100
100
  const formattedDayLabel = dayFormatter(date);
101
101
  const isCurrentDate = isToday(date);
102
102
  const isPreviousMonth = !isSameMonth(date, displayDate);
103
103
  if (isPreviousMonth) {
104
104
  return React__default.createElement(StyledCalendarItem, {
105
- key: `day-${itemsIndex}`,
106
- isCompact: isCompact
105
+ key: date.toISOString(),
106
+ $isCompact: isCompact
107
107
  }, React__default.createElement(StyledDay, {
108
- isCompact: isCompact,
109
- isPreviousMonth: true,
110
- isDisabled: true
108
+ $isCompact: isCompact,
109
+ $isPreviousMonth: true,
110
+ "aria-disabled": true
111
111
  }, "\xA0"));
112
112
  }
113
113
  let isSelected = false;
@@ -150,18 +150,18 @@ const Month = forwardRef((_ref, ref) => {
150
150
  }
151
151
  }
152
152
  return React__default.createElement(StyledCalendarItem, {
153
- key: `day-${itemsIndex}`,
154
- isCompact: isCompact
153
+ key: date.toISOString(),
154
+ $isCompact: isCompact
155
155
  }, React__default.createElement(StyledHighlight, {
156
- isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
157
- isStart: !isInvalidDateRange && isHighlightStart,
158
- isEnd: !isInvalidDateRange && isHighlightEnd
156
+ $isHighlighted: !isInvalidDateRange && !!isHighlighted && !isDisabled,
157
+ $isStart: !isInvalidDateRange && isHighlightStart,
158
+ $isEnd: !isInvalidDateRange && isHighlightEnd
159
159
  }), React__default.createElement(StyledDay, {
160
- isToday: isCurrentDate,
161
- isPreviousMonth: isPreviousMonth,
162
- isSelected: !isInvalidDateRange && isSelected,
163
- isDisabled: isDisabled,
164
- isCompact: isCompact,
160
+ $isToday: isCurrentDate,
161
+ $isPreviousMonth: isPreviousMonth,
162
+ "aria-selected": !isInvalidDateRange && isSelected || undefined,
163
+ "aria-disabled": isDisabled || undefined,
164
+ $isCompact: isCompact,
165
165
  onClick: () => {
166
166
  if (!isDisabled) {
167
167
  dispatch({
@@ -231,32 +231,32 @@ const Month = forwardRef((_ref, ref) => {
231
231
  });
232
232
  return React__default.createElement(StyledDatePicker, {
233
233
  ref: ref,
234
- isCompact: isCompact,
234
+ $isCompact: isCompact,
235
235
  onMouseDown: e => {
236
236
  e.preventDefault();
237
237
  }
238
238
  }, React__default.createElement(StyledHeader, {
239
- isCompact: isCompact
239
+ $isCompact: isCompact
240
240
  }, React__default.createElement(StyledHeaderPaddle, {
241
- isCompact: isCompact,
241
+ $isCompact: isCompact,
242
242
  onClick: () => {
243
243
  dispatch({
244
244
  type: 'PREVIEW_PREVIOUS_MONTH'
245
245
  });
246
246
  },
247
- isHidden: isPreviousHidden
247
+ "aria-hidden": isPreviousHidden || undefined
248
248
  }, React__default.createElement(SvgChevronLeftStroke, null)), React__default.createElement(StyledHeaderLabel, {
249
- isCompact: isCompact
249
+ $isCompact: isCompact
250
250
  }, headerLabelFormatter(displayDate)), React__default.createElement(StyledHeaderPaddle, {
251
- isCompact: isCompact,
252
- isHidden: isNextHidden,
251
+ $isCompact: isCompact,
252
+ "aria-hidden": isNextHidden || undefined,
253
253
  onClick: () => {
254
254
  dispatch({
255
255
  type: 'PREVIEW_NEXT_MONTH'
256
256
  });
257
257
  }
258
258
  }, React__default.createElement(SvgChevronRightStroke, null))), React__default.createElement(StyledCalendar, {
259
- isCompact: isCompact,
259
+ $isCompact: isCompact,
260
260
  onMouseLeave: () => {
261
261
  dispatch({
262
262
  type: 'HOVER_DATE',
@@ -7,7 +7,7 @@
7
7
  import * as React from 'react';
8
8
 
9
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); }
10
+ 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); }
11
11
  var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
12
12
  return /*#__PURE__*/React.createElement("svg", _extends({
13
13
  xmlns: "http://www.w3.org/2000/svg",
@@ -7,7 +7,7 @@
7
7
  import * as React from 'react';
8
8
 
9
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); }
10
+ 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); }
11
11
  var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
12
12
  return /*#__PURE__*/React.createElement("svg", _extends({
13
13
  xmlns: "http://www.w3.org/2000/svg",
@@ -5,17 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'datepickers.calendar';
11
11
  const StyledCalendar = styled.div.attrs({
12
- 'data-garden-id': COMPONENT_ID
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.1.0'
13
14
  }).withConfig({
14
15
  displayName: "StyledCalendar",
15
16
  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
- };
17
+ })(["width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => retrieveComponentStyles(COMPONENT_ID, props));
20
18
 
21
19
  export { StyledCalendar };
@@ -5,16 +5,16 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'datepickers.calendar_item';
11
- const retrieveSize = _ref => {
11
+ const sizeStyles = _ref => {
12
12
  let {
13
- isCompact,
13
+ $isCompact,
14
14
  theme
15
15
  } = _ref;
16
16
  let size;
17
- if (isCompact) {
17
+ if ($isCompact) {
18
18
  size = `${theme.space.base * 8}px`;
19
19
  } else {
20
20
  size = `${theme.space.base * 10}px`;
@@ -22,13 +22,11 @@ const retrieveSize = _ref => {
22
22
  return css(["width:", ";height:", ";"], size, size);
23
23
  };
24
24
  const StyledCalendarItem = styled.div.attrs({
25
- 'data-garden-id': COMPONENT_ID
25
+ 'data-garden-id': COMPONENT_ID,
26
+ 'data-garden-version': '9.1.0'
26
27
  }).withConfig({
27
28
  displayName: "StyledCalendarItem",
28
29
  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
- };
30
+ })(["display:inline-block;position:relative;vertical-align:top;", " ", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
33
31
 
34
- export { StyledCalendarItem, retrieveSize };
32
+ export { StyledCalendarItem, sizeStyles };
@@ -4,29 +4,34 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'datepickers.datepicker';
11
- const retrievePadding = _ref => {
11
+ const sizeStyles = _ref => {
12
12
  let {
13
- isCompact,
13
+ $isCompact,
14
14
  theme
15
15
  } = _ref;
16
- let value = theme.space.base * 5;
17
- if (isCompact) {
18
- value = theme.space.base * 4;
19
- }
20
- return `margin: ${value}px;`;
16
+ const margin = theme.space.base * ($isCompact ? 4 : 5);
17
+ return css(["margin:", "px;"], margin);
18
+ };
19
+ const colorStyles = _ref2 => {
20
+ let {
21
+ theme
22
+ } = _ref2;
23
+ const foreground = getColor({
24
+ variable: 'foreground.default',
25
+ theme
26
+ });
27
+ return css(["background-color:transparent;color:", ";"], foreground);
21
28
  };
22
29
  const StyledDatePicker = styled.div.attrs({
23
- 'data-garden-id': COMPONENT_ID
30
+ 'data-garden-id': COMPONENT_ID,
31
+ 'data-garden-version': '9.1.0'
24
32
  }).withConfig({
25
33
  displayName: "StyledDatePicker",
26
34
  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
- };
35
+ })(["direction:", ";", " ", " ", ";"], p => p.theme.rtl && 'rtl', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
31
36
 
32
37
  export { StyledDatePicker };
@@ -5,50 +5,88 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
 
10
- const retrieveStyledDayColors = _ref => {
10
+ const sizeStyles = () => {
11
+ return css(["border-radius:50%;width:100%;height:100%;"]);
12
+ };
13
+ const colorStyles = _ref => {
11
14
  let {
12
- isSelected,
13
- isDisabled,
14
- isToday,
15
- isPreviousMonth,
16
- theme
15
+ $isToday,
16
+ $isPreviousMonth,
17
+ theme,
18
+ ...props
17
19
  } = _ref;
20
+ const isSelected = props['aria-selected'];
21
+ const isDisabled = props['aria-disabled'];
18
22
  let backgroundColor = 'inherit';
19
- let color = getColorV8('primaryHue', 600, theme);
23
+ let foreground;
24
+ const backgroundHover = getColor({
25
+ variable: 'background.primaryEmphasis',
26
+ theme,
27
+ transparency: theme.opacity[100]
28
+ });
29
+ const foregroundHover = !$isToday && getColor({
30
+ variable: 'foreground.primary',
31
+ light: {
32
+ offset: 100
33
+ },
34
+ dark: {
35
+ offset: -100
36
+ },
37
+ theme
38
+ });
39
+ const backgroundActive = getColor({
40
+ variable: 'background.primaryEmphasis',
41
+ theme,
42
+ transparency: theme.opacity[200]
43
+ });
44
+ const foregroundActive = !$isToday && getColor({
45
+ variable: 'foreground.primary',
46
+ light: {
47
+ offset: 200
48
+ },
49
+ dark: {
50
+ offset: -200
51
+ },
52
+ theme
53
+ });
20
54
  if (isSelected && !isDisabled) {
21
- backgroundColor = getColorV8('primaryHue', 600, theme);
22
- color = getColorV8('background', 600 , theme);
55
+ backgroundColor = getColor({
56
+ variable: 'background.primaryEmphasis',
57
+ theme
58
+ });
59
+ foreground = getColor({
60
+ variable: 'foreground.onEmphasis',
61
+ theme
62
+ });
23
63
  } 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);
64
+ foreground = getColor({
65
+ variable: 'foreground.disabled',
66
+ theme
67
+ });
68
+ } else if ($isToday) {
69
+ foreground = 'inherit';
70
+ } else if ($isPreviousMonth) {
71
+ foreground = getColor({
72
+ variable: 'foreground.subtle',
73
+ theme
74
+ });
75
+ } else {
76
+ foreground = getColor({
77
+ variable: 'foreground.primary',
78
+ theme
79
+ });
29
80
  }
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
- `);
81
+ return 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);
41
82
  };
42
83
  const COMPONENT_ID = 'datepickers.day';
43
- const StyledDay = styled.div.attrs(props => ({
84
+ const StyledDay = styled.div.attrs({
44
85
  'data-garden-id': COMPONENT_ID,
45
- 'aria-disabled': props.isDisabled ? 'true' : 'false'
46
- })).withConfig({
86
+ 'data-garden-version': '9.1.0'
87
+ }).withConfig({
47
88
  displayName: "StyledDay",
48
89
  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
- };
90
+ })(["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 => retrieveComponentStyles(COMPONENT_ID, props));
53
91
 
54
92
  export { StyledDay };
@@ -5,17 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'datepickers.day_label';
11
11
  const StyledDayLabel = styled.div.attrs({
12
- 'data-garden-id': COMPONENT_ID
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.1.0'
13
14
  }).withConfig({
14
15
  displayName: "StyledDayLabel",
15
16
  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
- };
17
+ })(["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));
20
18
 
21
19
  export { StyledDayLabel };
@@ -5,17 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'datepickers.header';
11
11
  const StyledHeader = styled.div.attrs({
12
- 'data-garden-id': COMPONENT_ID
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.1.0'
13
14
  }).withConfig({
14
15
  displayName: "StyledHeader",
15
16
  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
- };
17
+ })(["display:flex;width:", "px;", ";"], props => props.$isCompact ? props.theme.space.base * 56 : props.theme.space.base * 70, props => retrieveComponentStyles(COMPONENT_ID, props));
20
18
 
21
19
  export { StyledHeader };
@@ -5,17 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'datepickers.header_label';
11
11
  const StyledHeaderLabel = styled.div.attrs({
12
- 'data-garden-id': COMPONENT_ID
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.1.0'
13
14
  }).withConfig({
14
15
  displayName: "StyledHeaderLabel",
15
16
  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
- };
17
+ })(["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));
20
18
 
21
19
  export { StyledHeaderLabel };