grommet 2.41.0 → 2.43.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 (175) hide show
  1. package/all/stories/Colors.js +6 -6
  2. package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  3. package/components/AccordionPanel/AccordionPanel.js +1 -7
  4. package/components/Box/Box.js +1 -1
  5. package/components/Box/StyledBox.js +1 -6
  6. package/components/Box/index.d.ts +1 -0
  7. package/components/Box/propTypes.js +1 -0
  8. package/components/Box/stories/Background.js +4 -10
  9. package/components/Button/Button.js +1 -0
  10. package/components/Button/StyledButton.js +3 -2
  11. package/components/Calendar/Calendar.js +96 -59
  12. package/components/Calendar/StyledCalendar.js +89 -7
  13. package/components/Calendar/utils.js +16 -2
  14. package/components/Card/stories/Simple.js +2 -2
  15. package/components/Carousel/Carousel.js +1 -1
  16. package/components/Chart/Chart.js +3 -3
  17. package/components/CheckBox/CheckBox.js +3 -2
  18. package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  19. package/components/Clock/Digital.js +1 -1
  20. package/components/Data/stories/Cards.js +3 -2
  21. package/components/Data/stories/Infinite.js +2 -2
  22. package/components/Data/stories/OnSelect.js +2 -2
  23. package/components/Data/stories/Properties.js +3 -2
  24. package/components/Data/stories/SpaceX.js +2 -2
  25. package/components/Data/stories/StarWars.js +1 -1
  26. package/components/DataFilter/DataFilter.js +1 -1
  27. package/components/DataSort/DataSort.js +46 -14
  28. package/components/DataSort/stories/Simple.js +10 -1
  29. package/components/DataTable/Body.js +14 -8
  30. package/components/DataTable/GroupedBody.js +3 -3
  31. package/components/DataTable/buildState.js +5 -1
  32. package/components/DataTable/stories/SpaceX.js +2 -2
  33. package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
  34. package/components/FileInput/index.d.ts +2 -3
  35. package/components/FormField/FormField.js +9 -2
  36. package/components/FormField/stories/ThresholdValidation.js +5 -1
  37. package/components/Grommet/index.d.ts +19 -1
  38. package/components/Grommet/propTypes.js +18 -0
  39. package/components/Grommet/stories/Theme.js +1 -1
  40. package/components/Grommet/stories/Vars.js +2 -2
  41. package/components/Layer/Layer.js +1 -1
  42. package/components/Layer/index.d.ts +2 -0
  43. package/components/List/List.js +43 -13
  44. package/components/List/stories/RenderedList.js +1 -1
  45. package/components/Meter/Circle.js +2 -2
  46. package/components/Meter/Meter.js +36 -17
  47. package/components/Meter/index.d.ts +18 -0
  48. package/components/Meter/propTypes.js +18 -0
  49. package/components/Notification/Notification.js +18 -6
  50. package/components/Notification/index.d.ts +1 -0
  51. package/components/Notification/propTypes.js +1 -0
  52. package/components/Pagination/Pagination.js +4 -2
  53. package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  54. package/components/Pagination/stories/NumberEdgePages.js +2 -0
  55. package/components/Pagination/stories/NumberMiddlePages.js +2 -0
  56. package/components/Pagination/stories/Simple.js +4 -2
  57. package/components/Pagination/stories/Size.js +3 -0
  58. package/components/Pagination/stories/Steps.js +3 -0
  59. package/components/RadioButton/RadioButton.js +14 -3
  60. package/components/RadioButton/stories/Children.js +16 -3
  61. package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  62. package/components/RadioButtonGroup/stories/Children.js +13 -1
  63. package/components/Select/Select.js +7 -3
  64. package/components/Select/SelectContainer.js +41 -34
  65. package/components/Select/index.d.ts +1 -1
  66. package/components/Select/utils.js +13 -2
  67. package/components/SelectMultiple/SelectMultiple.js +10 -0
  68. package/components/SelectMultiple/SelectMultipleContainer.js +28 -2
  69. package/components/SelectMultiple/SelectMultipleValue.js +14 -1
  70. package/components/SkipLinks/index.d.ts +1 -0
  71. package/components/SkipLinks/propTypes.js +1 -0
  72. package/components/Tab/Tab.js +1 -1
  73. package/components/Tabs/stories/Scrollable.js +2 -1
  74. package/components/Tag/Tag.js +11 -7
  75. package/components/TextInput/TextInput.js +7 -2
  76. package/components/ToggleGroup/StyledToggleGroup.js +12 -5
  77. package/components/ToggleGroup/ToggleGroup.js +21 -10
  78. package/components/WorldMap/WorldMap.js +1 -1
  79. package/es6/all/stories/Colors.js +6 -6
  80. package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  81. package/es6/components/AccordionPanel/AccordionPanel.js +2 -9
  82. package/es6/components/Box/Box.js +1 -1
  83. package/es6/components/Box/StyledBox.js +1 -6
  84. package/es6/components/Box/index.d.ts +1 -0
  85. package/es6/components/Box/propTypes.js +1 -0
  86. package/es6/components/Box/stories/Background.js +4 -10
  87. package/es6/components/Button/Button.js +1 -0
  88. package/es6/components/Button/StyledButton.js +4 -3
  89. package/es6/components/Calendar/Calendar.js +95 -59
  90. package/es6/components/Calendar/StyledCalendar.js +90 -8
  91. package/es6/components/Calendar/utils.js +15 -1
  92. package/es6/components/Card/stories/Simple.js +3 -3
  93. package/es6/components/Carousel/Carousel.js +1 -1
  94. package/es6/components/Chart/Chart.js +3 -3
  95. package/es6/components/CheckBox/CheckBox.js +3 -2
  96. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  97. package/es6/components/Clock/Digital.js +1 -1
  98. package/es6/components/Data/stories/Cards.js +4 -3
  99. package/es6/components/Data/stories/Infinite.js +2 -2
  100. package/es6/components/Data/stories/OnSelect.js +2 -2
  101. package/es6/components/Data/stories/Properties.js +4 -3
  102. package/es6/components/Data/stories/SpaceX.js +2 -2
  103. package/es6/components/Data/stories/StarWars.js +1 -1
  104. package/es6/components/DataFilter/DataFilter.js +1 -1
  105. package/es6/components/DataSort/DataSort.js +46 -14
  106. package/es6/components/DataSort/stories/Simple.js +10 -1
  107. package/es6/components/DataTable/Body.js +14 -8
  108. package/es6/components/DataTable/GroupedBody.js +3 -3
  109. package/es6/components/DataTable/buildState.js +5 -1
  110. package/es6/components/DataTable/stories/SpaceX.js +2 -2
  111. package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
  112. package/es6/components/FileInput/index.d.ts +2 -3
  113. package/es6/components/FormField/FormField.js +10 -3
  114. package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
  115. package/es6/components/Grommet/index.d.ts +19 -1
  116. package/es6/components/Grommet/propTypes.js +18 -0
  117. package/es6/components/Grommet/stories/Theme.js +1 -1
  118. package/es6/components/Grommet/stories/Vars.js +2 -2
  119. package/es6/components/Layer/Layer.js +1 -1
  120. package/es6/components/Layer/index.d.ts +2 -0
  121. package/es6/components/List/List.js +43 -13
  122. package/es6/components/List/stories/RenderedList.js +1 -1
  123. package/es6/components/Meter/Circle.js +2 -2
  124. package/es6/components/Meter/Meter.js +37 -18
  125. package/es6/components/Meter/index.d.ts +18 -0
  126. package/es6/components/Meter/propTypes.js +18 -0
  127. package/es6/components/Notification/Notification.js +18 -6
  128. package/es6/components/Notification/index.d.ts +1 -0
  129. package/es6/components/Notification/propTypes.js +1 -0
  130. package/es6/components/Pagination/Pagination.js +4 -2
  131. package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  132. package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
  133. package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
  134. package/es6/components/Pagination/stories/Simple.js +4 -2
  135. package/es6/components/Pagination/stories/Size.js +3 -0
  136. package/es6/components/Pagination/stories/Steps.js +3 -0
  137. package/es6/components/RadioButton/RadioButton.js +15 -4
  138. package/es6/components/RadioButton/stories/Children.js +16 -3
  139. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  140. package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
  141. package/es6/components/Select/Select.js +8 -4
  142. package/es6/components/Select/SelectContainer.js +41 -34
  143. package/es6/components/Select/index.d.ts +1 -1
  144. package/es6/components/Select/utils.js +15 -3
  145. package/es6/components/SelectMultiple/SelectMultiple.js +10 -0
  146. package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -2
  147. package/es6/components/SelectMultiple/SelectMultipleValue.js +14 -1
  148. package/es6/components/SkipLinks/index.d.ts +1 -0
  149. package/es6/components/SkipLinks/propTypes.js +1 -0
  150. package/es6/components/Tab/Tab.js +1 -1
  151. package/es6/components/Tabs/stories/Scrollable.js +2 -1
  152. package/es6/components/Tag/Tag.js +11 -7
  153. package/es6/components/TextInput/TextInput.js +7 -2
  154. package/es6/components/ToggleGroup/StyledToggleGroup.js +12 -5
  155. package/es6/components/ToggleGroup/ToggleGroup.js +22 -11
  156. package/es6/components/WorldMap/WorldMap.js +1 -1
  157. package/es6/languages/default.json +18 -0
  158. package/es6/themes/base.d.ts +204 -6
  159. package/es6/themes/base.js +165 -1
  160. package/es6/utils/background.js +1 -1
  161. package/es6/utils/index.js +2 -1
  162. package/es6/utils/styles.js +8 -0
  163. package/es6/utils/useId.js +17 -0
  164. package/grommet.min.js +1 -1
  165. package/grommet.min.js.map +1 -1
  166. package/languages/default.json +18 -0
  167. package/package.json +36 -36
  168. package/themes/base.d.ts +204 -6
  169. package/themes/base.js +165 -1
  170. package/utils/background.js +1 -1
  171. package/utils/index.js +6 -0
  172. package/utils/styles.js +9 -1
  173. package/utils/useId.js +22 -0
  174. package/components/CheckBox/stories/InsideButton.js +0 -38
  175. package/es6/components/CheckBox/stories/InsideButton.js +0 -32
@@ -18,13 +18,13 @@ var customTheme = {
18
18
  blue: '#00C8FF',
19
19
  green: '#17EBA0',
20
20
  teal: '#82FFF2',
21
- purple: '#F740FF',
22
- red: '#FC6161',
21
+ purple: '#694b75',
22
+ red: '#914049',
23
23
  orange: '#FFBC44',
24
- yellow: '#FFEB59',
24
+ yellow: '#faf6d4',
25
25
  // you can also point to existing grommet colors
26
26
  brightGreen: 'accent-1',
27
- deepGreen: 'neutral-2',
27
+ dark: 'dark-1',
28
28
  // Changing default text color,
29
29
  // all colors could be either a string or a dark and light object
30
30
  text: {
@@ -42,8 +42,8 @@ export var Colors = function Colors() {
42
42
  gap: "medium",
43
43
  pad: "small"
44
44
  }, /*#__PURE__*/React.createElement(Text, null, "Custom color purple"), /*#__PURE__*/React.createElement(Text, {
45
- color: "deepGreen"
46
- }, "Inline custom color of deepGreen"), /*#__PURE__*/React.createElement(Paragraph, {
45
+ color: "dark"
46
+ }, "Inline custom dark color"), /*#__PURE__*/React.createElement(Paragraph, {
47
47
  color: "red"
48
48
  }, "Wrapping your application with the Grommet component that is pointing to your customTheme object as shown on the example, will allow you full access to your custom colors across your application. You can override any Grommet color that is mentioned in the docs in a similar fashion."), /*#__PURE__*/React.createElement(Anchor, {
49
49
  href: "https://github.com/grommet/grommet/wiki/Color-Properties"
@@ -50,7 +50,7 @@ const RichPanel = ({ children, icon, label }) => {
50
50
  pad={{ horizontal: 'small' }}
51
51
  >
52
52
  {icon}
53
- <Heading level={4} color={hovering ? 'dark-1' : 'dark-3'}>
53
+ <Heading level={4} color={hovering ? 'dark-1' : 'dark-2'}>
54
54
  {label}
55
55
  </Heading>
56
56
  </Box>
@@ -2,7 +2,7 @@ var _excluded = ["children", "header", "id", "label", "onClick", "onMouseOut", "
2
2
  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); }
3
3
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
4
4
  import React, { forwardRef, useContext, useMemo, useState } from 'react';
5
- import { normalizeColor, parseMetricToNum } from '../../utils';
5
+ import { normalizeColor, parseMetricToNum, useId } from '../../utils';
6
6
  import { Box } from '../Box';
7
7
  import { Button } from '../Button';
8
8
  import { Collapsible } from '../Collapsible';
@@ -10,13 +10,6 @@ import { Heading } from '../Heading';
10
10
  import { AccordionContext } from '../Accordion/AccordionContext';
11
11
  import { AccordionPanelPropTypes } from './propTypes';
12
12
  import { useThemeValue } from '../../utils/useThemeValue';
13
-
14
- // Ideally we should use `useId` from react but this is only available
15
- // in React 18 and we want to keep compatibility with React 17 and 16.
16
- function getUID() {
17
- var timestamp = Date.now() + Math.random();
18
- return "grommet-accordion-button-" + timestamp;
19
- }
20
13
  var AccordionPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
14
  var children = _ref.children,
22
15
  header = _ref.header,
@@ -28,7 +21,7 @@ var AccordionPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
28
21
  _onFocus = _ref.onFocus,
29
22
  _onBlur = _ref.onBlur,
30
23
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
31
- var panelButtonId = id ? "grommet_accordion_button_" + id : getUID();
24
+ var panelButtonId = useId();
32
25
  var _useThemeValue = useThemeValue(),
33
26
  theme = _useThemeValue.theme;
34
27
  var _useContext = useContext(AccordionContext),
@@ -110,7 +110,7 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
110
110
  if (firstIndex === undefined) {
111
111
  firstIndex = index;
112
112
  } else {
113
- contents.push( /*#__PURE__*/React.createElement(StyledBoxGap
113
+ contents.push(/*#__PURE__*/React.createElement(StyledBoxGap
114
114
  // eslint-disable-next-line react/no-array-index-key
115
115
  , _extends({
116
116
  key: "gap-" + index,
@@ -1,7 +1,7 @@
1
1
  var _FLEX_MAP;
2
2
  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); }
3
3
  import styled, { css } from 'styled-components';
4
- import { alignContentStyle, alignStyle, backgroundStyle, borderStyle, breakpointStyle, edgeStyle, fillStyle, focusStyle, genericStyles, getBreakpointStyle, getHoverIndicatorStyle, heightStyle, overflowStyle, parseMetricToNum, responsiveBorderStyle, widthStyle } from '../../utils';
4
+ import { alignContentStyle, alignStyle, backgroundStyle, borderStyle, breakpointStyle, edgeStyle, elevationStyle, fillStyle, focusStyle, genericStyles, getBreakpointStyle, getHoverIndicatorStyle, heightStyle, overflowStyle, parseMetricToNum, responsiveBorderStyle, widthStyle } from '../../utils';
5
5
  import { roundStyle, styledComponentsConfig } from '../../utils/styles';
6
6
  import { animationBounds, animationObjectStyle } from '../../utils/animation';
7
7
  var BASIS_MAP = {
@@ -32,11 +32,6 @@ var directionStyle = function directionStyle(direction, theme) {
32
32
  }
33
33
  return styles;
34
34
  };
35
- var elevationStyle = function elevationStyle(elevation) {
36
- return css(["box-shadow:", ";"], function (props) {
37
- return props.theme.global.elevation[props.theme.dark ? 'dark' : 'light'][elevation];
38
- });
39
- };
40
35
  var FLEX_MAP = (_FLEX_MAP = {}, _FLEX_MAP[true] = '1 1', _FLEX_MAP[false] = '0 0', _FLEX_MAP.grow = '1 0', _FLEX_MAP.shrink = '0 1', _FLEX_MAP);
41
36
  var flexGrowShrinkProp = function flexGrowShrinkProp(flex) {
42
37
  if (typeof flex === 'boolean' || typeof flex === 'string') {
@@ -33,6 +33,7 @@ export interface BoxProps {
33
33
  background?: BackgroundType;
34
34
  basis?: BasisType;
35
35
  border?: BorderType;
36
+ cssGap?: boolean;
36
37
  direction?: DirectionType;
37
38
  elevation?: ElevationType;
38
39
  flex?: 'grow' | 'shrink' | boolean | { grow?: number; shrink?: number };
@@ -26,6 +26,7 @@ if (process.env.NODE_ENV !== 'production') {
26
26
  background: backgroundDoc,
27
27
  basis: PropTypes.oneOfType([PropTypes.oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'full', '1/2', '1/3', '2/3', '1/4', '2/4', '3/4', 'auto']), PropTypes.string]),
28
28
  border: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['top', 'left', 'bottom', 'right', 'start', 'end', 'horizontal', 'vertical', 'all', 'between']), BORDER_SHAPE, PropTypes.arrayOf(BORDER_SHAPE)]),
29
+ cssGap: PropTypes.bool,
29
30
  direction: PropTypes.oneOf(['row', 'column', 'row-responsive', 'row-reverse', 'column-reverse']),
30
31
  elevation: elevationPropType,
31
32
  flex: PropTypes.oneOfType([PropTypes.oneOf(['grow', 'shrink']), PropTypes.bool, PropTypes.shape({
@@ -56,9 +56,7 @@ export var BackgroundBox = function BackgroundBox() {
56
56
  dark: true
57
57
  },
58
58
  pad: "medium"
59
- }, /*#__PURE__*/React.createElement(Text, {
60
- color: "brand"
61
- }, "force dark background")), /*#__PURE__*/React.createElement(Box, {
59
+ }, /*#__PURE__*/React.createElement(Text, null, "force dark background")), /*#__PURE__*/React.createElement(Box, {
62
60
  background: "dark-1",
63
61
  pad: "medium"
64
62
  }, /*#__PURE__*/React.createElement(Box, {
@@ -72,15 +70,13 @@ export var BackgroundBox = function BackgroundBox() {
72
70
  }, "force light background"))), /*#__PURE__*/React.createElement(Box, {
73
71
  background: {
74
72
  color: {
75
- dark: 'darkgrey',
73
+ dark: 'dark-2',
76
74
  light: 'lightgrey'
77
75
  },
78
76
  dark: true
79
77
  },
80
78
  pad: "medium"
81
- }, /*#__PURE__*/React.createElement(Text, {
82
- color: "brand"
83
- }, "force dark background with color as object")), /*#__PURE__*/React.createElement(Box, {
79
+ }, /*#__PURE__*/React.createElement(Text, null, "force dark background with color as object")), /*#__PURE__*/React.createElement(Box, {
84
80
  background: "dark-1",
85
81
  pad: "medium"
86
82
  }, /*#__PURE__*/React.createElement(Box, {
@@ -92,9 +88,7 @@ export var BackgroundBox = function BackgroundBox() {
92
88
  dark: false
93
89
  },
94
90
  pad: "medium"
95
- }, /*#__PURE__*/React.createElement(Text, {
96
- color: "brand"
97
- }, "force light background with color as object"))))
91
+ }, /*#__PURE__*/React.createElement(Text, null, "force light background with color as object"))))
98
92
  // </Grommet>
99
93
  );
100
94
  };
@@ -339,6 +339,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
339
339
  }, first, second);
340
340
  } else if (typeof children === 'function') {
341
341
  contents = children({
342
+ active: active,
342
343
  disabled: disabled,
343
344
  hover: hover,
344
345
  focus: focus
@@ -1,6 +1,6 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { activeStyle, backgroundStyle, disabledStyle, edgeStyle, focusStyle, unfocusStyle, genericStyles, getHoverIndicatorStyle, normalizeColor } from '../../utils';
3
- import { styledComponentsConfig } from '../../utils/styles';
3
+ import { elevationStyle, styledComponentsConfig } from '../../utils/styles';
4
4
  var radiusStyle = function radiusStyle(props) {
5
5
  // border.radius shouldn't impact an only-icon rendering.
6
6
  var isIconOnly = props.hasIcon && !props.hasLabel;
@@ -23,10 +23,11 @@ var padStyle = function padStyle(props) {
23
23
  return css(["", " ", ""], props.theme.button.padding.vertical, props.theme.button.padding.horizontal);
24
24
  };
25
25
  var basicStyle = function basicStyle(props) {
26
- return css(["border:", " solid ", ";border-radius:", ";color:", ";padding:", ";", ""], props.theme.button.border.width, normalizeColor(props.colorValue || props.theme.button.border.color || 'control', props.theme), radiusStyle(props), normalizeColor(props.theme.button.color || 'text', props.theme), padStyle(props), fontStyle(props));
26
+ return css(["border:", " solid ", ";border-radius:", ";", " color:", ";padding:", ";", ""], props.theme.button.border.width, normalizeColor(props.colorValue || props.theme.button.border.color || 'control', props.theme), radiusStyle(props), props.theme.button.elevation && elevationStyle(props.theme.button.elevation), normalizeColor(props.theme.button.color || 'text', props.theme), padStyle(props), fontStyle(props));
27
27
  };
28
28
  var primaryStyle = function primaryStyle(props) {
29
- return css(["", " border-radius:", ";", ""], backgroundStyle(normalizeColor(props.colorValue || props.theme.button.primary && props.theme.button.primary.color || 'control', props.theme), props.theme, props.theme.button.color), radiusStyle(props), props.theme.button.primary && props.theme.button.primary.extend);
29
+ var _props$theme$button$p, _props$theme$button$p2;
30
+ return css(["", " border-radius:", ";", " ", ""], backgroundStyle(normalizeColor(props.colorValue || props.theme.button.primary && props.theme.button.primary.color || 'control', props.theme), props.theme, props.theme.button.color), radiusStyle(props), ((_props$theme$button$p = props.theme.button.primary) == null ? void 0 : _props$theme$button$p.elevation) && elevationStyle((_props$theme$button$p2 = props.theme.button.primary) == null ? void 0 : _props$theme$button$p2.elevation), props.theme.button.primary && props.theme.button.primary.extend);
30
31
  };
31
32
  function getHoverColor(props) {
32
33
  if (props.colorValue) {
@@ -2,6 +2,7 @@ var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates",
2
2
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
3
3
  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); }
4
4
  import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
5
+ import styled from 'styled-components';
5
6
  import { AnnounceContext } from '../../contexts/AnnounceContext';
6
7
  import { MessageContext } from '../../contexts/MessageContext';
7
8
  import { Box } from '../Box';
@@ -15,6 +16,7 @@ import { StyledCalendar, StyledDay, StyledDayContainer, StyledWeek, StyledWeeks,
15
16
  import { addDays, addMonths, betweenDates, daysApart, endOfMonth, handleOffset, sameDayOrAfter, sameDayOrBefore, startOfMonth, subtractDays, subtractMonths, withinDates } from './utils';
16
17
  import { setHoursWithOffset } from '../../utils/dates';
17
18
  import { useThemeValue } from '../../utils/useThemeValue';
19
+ import { useKeyboard } from '../../utils';
18
20
  var headingPadMap = {
19
21
  small: 'xsmall',
20
22
  medium: 'small',
@@ -149,12 +151,16 @@ var _getOutputFormat = function getOutputFormat(dates) {
149
151
  };
150
152
  export { _getOutputFormat as getOutputFormat };
151
153
  var millisecondsPerYear = 31557600000;
152
- var CalendarDayButton = function CalendarDayButton(props) {
153
- return /*#__PURE__*/React.createElement(Button, _extends({
154
- tabIndex: -1,
155
- plain: true
156
- }, props));
157
- };
154
+
155
+ // when caller opts in to day hover styling, apply all state styles
156
+ // on CalendarDay instead of active state on CalendarDayButton
157
+ var CalendarDayButton = styled(Button).withConfig({
158
+ displayName: "Calendar__CalendarDayButton",
159
+ componentId: "sc-1chaf9i-0"
160
+ })(["", ""], function (props) {
161
+ var _props$theme$calendar;
162
+ return ((_props$theme$calendar = props.theme.calendar) == null || (_props$theme$calendar = _props$theme$calendar.day) == null || (_props$theme$calendar = _props$theme$calendar.hover) == null ? void 0 : _props$theme$calendar.background) && 'background: inherit;';
163
+ });
158
164
  var CalendarDay = function CalendarDay(_ref) {
159
165
  var children = _ref.children,
160
166
  fill = _ref.fill,
@@ -162,30 +168,46 @@ var CalendarDay = function CalendarDay(_ref) {
162
168
  isInRange = _ref.isInRange,
163
169
  isSelected = _ref.isSelected,
164
170
  otherMonth = _ref.otherMonth,
171
+ rangePosition = _ref.rangePosition,
165
172
  _ref$buttonProps = _ref.buttonProps,
166
173
  buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps;
167
174
  var _useThemeValue = useThemeValue(),
168
175
  passThemeFlag = _useThemeValue.passThemeFlag;
176
+ var usingKeyboard = useKeyboard();
169
177
  return /*#__PURE__*/React.createElement(StyledDayContainer, {
170
178
  role: "gridcell",
171
- sizeProp: size,
172
- fillContainer: fill
173
- }, /*#__PURE__*/React.createElement(CalendarDayButton, _extends({
174
- fill: fill
175
- }, buttonProps), /*#__PURE__*/React.createElement(StyledDay, _extends({
176
- disabledProp: buttonProps.disabled,
177
179
  inRange: isInRange,
178
- otherMonth: otherMonth,
179
180
  isSelected: isSelected,
181
+ rangePosition: rangePosition,
180
182
  sizeProp: size,
181
183
  fillContainer: fill
182
- }, passThemeFlag), children)));
184
+ }, /*#__PURE__*/React.createElement(CalendarDayButton, _extends({
185
+ fill: fill,
186
+ tabIndex: -1,
187
+ plain: true
188
+ }, buttonProps), function (_ref2) {
189
+ var active = _ref2.active,
190
+ hover = _ref2.hover;
191
+ return /*#__PURE__*/React.createElement(StyledDay
192
+ // only apply active styling when using keyboard
193
+ // otherwise apply hover styling
194
+ , _extends({
195
+ active: usingKeyboard ? active : undefined,
196
+ disabledProp: buttonProps.disabled,
197
+ hover: hover,
198
+ inRange: isInRange,
199
+ isSelected: isSelected,
200
+ otherMonth: otherMonth,
201
+ sizeProp: size,
202
+ fillContainer: fill
203
+ }, passThemeFlag), children);
204
+ }));
183
205
  };
184
- var CalendarCustomDay = function CalendarCustomDay(_ref2) {
185
- var children = _ref2.children,
186
- fill = _ref2.fill,
187
- size = _ref2.size,
188
- buttonProps = _ref2.buttonProps;
206
+ var CalendarCustomDay = function CalendarCustomDay(_ref3) {
207
+ var children = _ref3.children,
208
+ fill = _ref3.fill,
209
+ size = _ref3.size,
210
+ buttonProps = _ref3.buttonProps;
189
211
  if (!buttonProps) {
190
212
  return /*#__PURE__*/React.createElement(StyledDayContainer, {
191
213
  role: "gridcell",
@@ -201,34 +223,34 @@ var CalendarCustomDay = function CalendarCustomDay(_ref2) {
201
223
  fill: fill
202
224
  }, buttonProps), children));
203
225
  };
204
- var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
205
- var activeDateProp = _ref3.activeDate,
206
- _ref3$animate = _ref3.animate,
207
- animate = _ref3$animate === void 0 ? true : _ref3$animate,
208
- boundsProp = _ref3.bounds,
209
- children = _ref3.children,
210
- dateProp = _ref3.date,
211
- datesProp = _ref3.dates,
212
- daysOfWeek = _ref3.daysOfWeek,
213
- disabled = _ref3.disabled,
214
- initialFocus = _ref3.initialFocus,
215
- fill = _ref3.fill,
216
- _ref3$firstDayOfWeek = _ref3.firstDayOfWeek,
217
- firstDayOfWeek = _ref3$firstDayOfWeek === void 0 ? 0 : _ref3$firstDayOfWeek,
218
- header = _ref3.header,
219
- _ref3$locale = _ref3.locale,
220
- locale = _ref3$locale === void 0 ? 'en-US' : _ref3$locale,
221
- messages = _ref3.messages,
222
- onReference = _ref3.onReference,
223
- onSelect = _ref3.onSelect,
224
- range = _ref3.range,
225
- referenceProp = _ref3.reference,
226
- _ref3$showAdjacentDay = _ref3.showAdjacentDays,
227
- showAdjacentDays = _ref3$showAdjacentDay === void 0 ? true : _ref3$showAdjacentDay,
228
- _ref3$size = _ref3.size,
229
- size = _ref3$size === void 0 ? 'medium' : _ref3$size,
230
- timestampProp = _ref3.timestamp,
231
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
226
+ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
227
+ var activeDateProp = _ref4.activeDate,
228
+ _ref4$animate = _ref4.animate,
229
+ animate = _ref4$animate === void 0 ? true : _ref4$animate,
230
+ boundsProp = _ref4.bounds,
231
+ children = _ref4.children,
232
+ dateProp = _ref4.date,
233
+ datesProp = _ref4.dates,
234
+ daysOfWeek = _ref4.daysOfWeek,
235
+ disabled = _ref4.disabled,
236
+ initialFocus = _ref4.initialFocus,
237
+ fill = _ref4.fill,
238
+ _ref4$firstDayOfWeek = _ref4.firstDayOfWeek,
239
+ firstDayOfWeek = _ref4$firstDayOfWeek === void 0 ? 0 : _ref4$firstDayOfWeek,
240
+ header = _ref4.header,
241
+ _ref4$locale = _ref4.locale,
242
+ locale = _ref4$locale === void 0 ? 'en-US' : _ref4$locale,
243
+ messages = _ref4.messages,
244
+ onReference = _ref4.onReference,
245
+ onSelect = _ref4.onSelect,
246
+ range = _ref4.range,
247
+ referenceProp = _ref4.reference,
248
+ _ref4$showAdjacentDay = _ref4.showAdjacentDays,
249
+ showAdjacentDays = _ref4$showAdjacentDay === void 0 ? true : _ref4$showAdjacentDay,
250
+ _ref4$size = _ref4.size,
251
+ size = _ref4$size === void 0 ? 'medium' : _ref4$size,
252
+ timestampProp = _ref4.timestamp,
253
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
232
254
  var _useThemeValue2 = useThemeValue(),
233
255
  theme = _useThemeValue2.theme,
234
256
  passThemeFlag = _useThemeValue2.passThemeFlag;
@@ -571,7 +593,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
571
593
  var day = new Date(displayBounds[0]);
572
594
  var days = [];
573
595
  while (days.length < 7) {
574
- days.push( /*#__PURE__*/React.createElement(StyledDayContainer, {
596
+ days.push(/*#__PURE__*/React.createElement(StyledDayContainer, {
575
597
  role: "gridcell",
576
598
  key: days.length,
577
599
  sizeProp: size,
@@ -597,7 +619,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
597
619
  var _loop = function _loop() {
598
620
  if (day.getDay() === firstDayOfWeek) {
599
621
  if (days) {
600
- weeks.push( /*#__PURE__*/React.createElement(StyledWeek, {
622
+ weeks.push(/*#__PURE__*/React.createElement(StyledWeek, {
601
623
  role: "row",
602
624
  key: day.getTime(),
603
625
  fillContainer: fill
@@ -607,7 +629,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
607
629
  }
608
630
  var otherMonth = day.getMonth() !== reference.getMonth();
609
631
  if (!showAdjacentDays && otherMonth) {
610
- days.push( /*#__PURE__*/React.createElement(StyledDayContainer, {
632
+ days.push(/*#__PURE__*/React.createElement(StyledDayContainer, {
611
633
  key: day.getTime(),
612
634
  sizeProp: size,
613
635
  fillContainer: fill
@@ -629,7 +651,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
629
651
  we know that all days in the array are from the next month. */
630
652
  days.length < day.getDate()) {
631
653
  blankWeek = true;
632
- days.push( /*#__PURE__*/React.createElement(StyledDayContainer, {
654
+ days.push(/*#__PURE__*/React.createElement(StyledDayContainer, {
633
655
  key: day.getTime(),
634
656
  sizeProp: size,
635
657
  fillContainer: fill
@@ -642,18 +664,22 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
642
664
  // this.dayRefs[dateObject] = React.createRef();
643
665
  var selected = false;
644
666
  var inRange = false;
645
- var selectedState = withinDates(day, range ? normalizeRange(value, activeDate) : value);
667
+ var rangePosition;
668
+ var _withinDates = withinDates(day, range ? normalizeRange(value, activeDate) : value),
669
+ selectedState = _withinDates[0];
646
670
  if (selectedState === 2) {
647
671
  selected = true;
672
+ var _withinDates2 = withinDates(day, range ? normalizeRange(value, activeDate) : value);
673
+ rangePosition = _withinDates2[1];
648
674
  } else if (selectedState === 1) {
649
675
  inRange = true;
650
676
  }
651
- var dayDisabled = withinDates(day, _normalizeInput(disabled)) || bounds && !betweenDates(day, _normalizeInput(bounds));
677
+ var dayDisabled = withinDates(day, _normalizeInput(disabled))[0] || bounds && !betweenDates(day, _normalizeInput(bounds));
652
678
  if (!firstDayInMonth && !dayDisabled && day.getMonth() === reference.getMonth()) {
653
679
  firstDayInMonth = dateObject;
654
680
  }
655
681
  if (!children) {
656
- days.push( /*#__PURE__*/React.createElement(CalendarDay, {
682
+ days.push(/*#__PURE__*/React.createElement(CalendarDay, {
657
683
  key: day.getTime(),
658
684
  buttonProps: {
659
685
  a11yTitle: day.toDateString(),
@@ -672,11 +698,12 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
672
698
  isInRange: inRange,
673
699
  isSelected: selected,
674
700
  otherMonth: day.getMonth() !== reference.getMonth(),
701
+ rangePosition: rangePosition,
675
702
  size: size,
676
703
  fill: fill
677
704
  }, day.getDate()));
678
705
  } else {
679
- days.push( /*#__PURE__*/React.createElement(CalendarCustomDay, {
706
+ days.push(/*#__PURE__*/React.createElement(CalendarCustomDay, {
680
707
  key: day.getTime(),
681
708
  buttonProps: onSelect ? {
682
709
  a11yTitle: day.toDateString(),
@@ -707,7 +734,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
707
734
  while (day.getTime() < displayBounds[1].getTime()) {
708
735
  _loop();
709
736
  }
710
- weeks.push( /*#__PURE__*/React.createElement(StyledWeek
737
+ weeks.push(/*#__PURE__*/React.createElement(StyledWeek
711
738
  // if a week contains only blank days, for screen reader accessibility
712
739
  // we don't want to set role="row"
713
740
  , {
@@ -752,10 +779,19 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
752
779
  },
753
780
  previousInBound: betweenDates(previousMonth, bounds),
754
781
  nextInBound: betweenDates(nextMonth, bounds)
755
- }) : renderCalendarHeader(previousMonth, nextMonth), daysOfWeek && renderDaysOfWeek(), /*#__PURE__*/React.createElement(Keyboard, {
782
+ }) : renderCalendarHeader(previousMonth, nextMonth), /*#__PURE__*/React.createElement(Box, {
783
+ fill: true,
784
+ role: "grid"
785
+ }, daysOfWeek && renderDaysOfWeek(), /*#__PURE__*/React.createElement(Keyboard, {
756
786
  onEnter: function onEnter() {
757
787
  return active !== undefined ? _onClick(active) : undefined;
758
788
  },
789
+ onSpace: function onSpace(event) {
790
+ event.preventDefault();
791
+ if (active !== undefined) {
792
+ _onClick(active);
793
+ }
794
+ },
759
795
  onUp: function onUp(event) {
760
796
  event.preventDefault();
761
797
  event.stopPropagation(); // so the page doesn't scroll
@@ -786,7 +822,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
786
822
  }
787
823
  }, /*#__PURE__*/React.createElement(StyledWeeksContainer, _extends({
788
824
  tabIndex: 0,
789
- role: "grid",
825
+ role: "rowgroup",
790
826
  "aria-label": reference.toLocaleDateString(locale, {
791
827
  month: 'long',
792
828
  year: 'numeric'
@@ -810,7 +846,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
810
846
  slide: slide,
811
847
  sizeProp: size,
812
848
  fillContainer: fill
813
- }, passThemeFlag), weeks)))));
849
+ }, passThemeFlag), weeks))))));
814
850
  });
815
851
  Calendar.displayName = 'Calendar';
816
852
  Calendar.propTypes = CalendarPropTypes;
@@ -1,5 +1,6 @@
1
1
  import styled, { css, keyframes } from 'styled-components';
2
- import { backgroundStyle, focusStyle, genericStyles, kindPartStyles, parseMetricToNum, styledComponentsConfig } from '../../utils';
2
+ import { backgroundStyle, focusStyle, genericStyles, kindPartStyles, normalizeColor, parseMetricToNum, roundStyle, styledComponentsConfig } from '../../utils';
3
+ import { activeStyle } from '../../utils/background';
3
4
  var sizeStyle = function sizeStyle(props) {
4
5
  var data = props.theme.calendar[props.sizeProp];
5
6
  var width = props.fillContainer ? '100%' : props.theme.global.size[props.sizeProp];
@@ -45,6 +46,21 @@ var slideStyle = function slideStyle(props) {
45
46
  var weeksSizeStyle = function weeksSizeStyle() {
46
47
  return css(["display:flex;flex-direction:column;height:100%;"]);
47
48
  };
49
+
50
+ // fallback to medium if no size-specific styles
51
+ var rangeRoundStyle = function rangeRoundStyle(props) {
52
+ var _props$theme$calendar5, _props$theme$calendar6;
53
+ var themeObj;
54
+ if (props.isSelected) {
55
+ var _props$theme$calendar, _props$theme$calendar2, _props$theme$calendar3, _props$theme$calendar4;
56
+ var rangeStart = ((_props$theme$calendar = props.theme.calendar) == null || (_props$theme$calendar = _props$theme$calendar[props.sizeProp]) == null || (_props$theme$calendar = _props$theme$calendar.range) == null || (_props$theme$calendar = _props$theme$calendar.start) == null ? void 0 : _props$theme$calendar.round) || ((_props$theme$calendar2 = props.theme.calendar) == null || (_props$theme$calendar2 = _props$theme$calendar2.medium) == null || (_props$theme$calendar2 = _props$theme$calendar2.range) == null || (_props$theme$calendar2 = _props$theme$calendar2.start) == null ? void 0 : _props$theme$calendar2.round);
57
+ var rangeEnd = ((_props$theme$calendar3 = props.theme.calendar) == null || (_props$theme$calendar3 = _props$theme$calendar3[props.sizeProp]) == null || (_props$theme$calendar3 = _props$theme$calendar3.range) == null || (_props$theme$calendar3 = _props$theme$calendar3.end) == null ? void 0 : _props$theme$calendar3.round) || ((_props$theme$calendar4 = props.theme.calendar) == null || (_props$theme$calendar4 = _props$theme$calendar4.medium) == null || (_props$theme$calendar4 = _props$theme$calendar4.range) == null || (_props$theme$calendar4 = _props$theme$calendar4.end) == null ? void 0 : _props$theme$calendar4.round);
58
+ if (props.rangePosition === 'start' && rangeStart) {
59
+ themeObj = rangeStart;
60
+ } else if (props.rangePosition === 'end' && rangeEnd) themeObj = rangeEnd;
61
+ } else themeObj = ((_props$theme$calendar5 = props.theme.calendar) == null || (_props$theme$calendar5 = _props$theme$calendar5[props.sizeProp]) == null || (_props$theme$calendar5 = _props$theme$calendar5.range) == null ? void 0 : _props$theme$calendar5.round) || ((_props$theme$calendar6 = props.theme.calendar) == null || (_props$theme$calendar6 = _props$theme$calendar6.medium) == null || (_props$theme$calendar6 = _props$theme$calendar6.range) == null ? void 0 : _props$theme$calendar6.round);
62
+ return themeObj && [roundStyle(themeObj, props.responsive, props.theme), 'overflow: hidden;'];
63
+ };
48
64
  var StyledWeeks = styled.div.withConfig(styledComponentsConfig).withConfig({
49
65
  displayName: "StyledCalendar__StyledWeeks",
50
66
  componentId: "sc-1y4xhmp-2"
@@ -65,27 +81,93 @@ var StyledWeek = styled.div.withConfig(styledComponentsConfig).withConfig({
65
81
  var StyledDayContainer = styled.div.withConfig(styledComponentsConfig).withConfig({
66
82
  displayName: "StyledCalendar__StyledDayContainer",
67
83
  componentId: "sc-1y4xhmp-4"
68
- })(["flex:0 1 auto;", ""], function (props) {
84
+ })(["flex:0 1 auto;", " ", " ", ""], function (props) {
69
85
  return props.fillContainer && 'width: 14.3%;';
86
+ }, function (props) {
87
+ var _props$theme$calendar7;
88
+ return (props.inRange || props.isSelected && props.rangePosition) && ((_props$theme$calendar7 = props.theme.calendar) == null || (_props$theme$calendar7 = _props$theme$calendar7.range) == null ? void 0 : _props$theme$calendar7.background) && backgroundStyle(props.theme.calendar.range.background, props.theme);
89
+ }, function (props) {
90
+ return rangeRoundStyle(props);
70
91
  });
71
92
  var daySizeStyle = function daySizeStyle(props) {
72
93
  var data = props.theme.calendar[props.sizeProp];
73
94
  return css(["width:", ";height:", ";"], props.fillContainer ? '100%' : data.daySize, props.fillContainer ? '100%' : data.daySize);
74
95
  };
96
+ var dayStyle = function dayStyle(props) {
97
+ var backgroundObj;
98
+ var colorObj;
99
+ if (props.isSelected) {
100
+ var _props$theme$calendar8, _props$theme$calendar9;
101
+ backgroundObj = ((_props$theme$calendar8 = props.theme.calendar.day) == null || (_props$theme$calendar8 = _props$theme$calendar8.selected) == null ? void 0 : _props$theme$calendar8.background) || 'control';
102
+ colorObj = (_props$theme$calendar9 = props.theme.calendar.day) == null || (_props$theme$calendar9 = _props$theme$calendar9.selected) == null ? void 0 : _props$theme$calendar9.color;
103
+ } else if (props.inRange) {
104
+ var _props$theme$calendar10, _props$theme$calendar11, _props$theme$calendar12, _props$theme$calendar13;
105
+ // for backwards compatability, only apply this if caller hasn't specified
106
+ // range specific rounding
107
+ // if they have, background will be applied to StyledDayContainer
108
+ backgroundObj = !((_props$theme$calendar10 = props.theme.calendar) != null && (_props$theme$calendar10 = _props$theme$calendar10[props.sizeProp]) != null && (_props$theme$calendar10 = _props$theme$calendar10.range) != null && _props$theme$calendar10.round) && !((_props$theme$calendar11 = props.theme.calendar) != null && (_props$theme$calendar11 = _props$theme$calendar11.medium.range) != null && _props$theme$calendar11.round) && (((_props$theme$calendar12 = props.theme.calendar.day) == null || (_props$theme$calendar12 = _props$theme$calendar12.inRange) == null ? void 0 : _props$theme$calendar12.background) || {
109
+ color: 'control',
110
+ opacity: 'weak'
111
+ });
112
+ colorObj = (_props$theme$calendar13 = props.theme.calendar.day) == null || (_props$theme$calendar13 = _props$theme$calendar13.inRange) == null ? void 0 : _props$theme$calendar13.color;
113
+ } else {
114
+ var _props$theme$calendar14, _props$theme$calendar15;
115
+ backgroundObj = (_props$theme$calendar14 = props.theme.calendar.day) == null ? void 0 : _props$theme$calendar14.background;
116
+ colorObj = (_props$theme$calendar15 = props.theme.calendar.day) == null ? void 0 : _props$theme$calendar15.color;
117
+ }
118
+ if (colorObj && !backgroundObj) return "color: " + normalizeColor(colorObj, props.theme) + ";";
119
+ return backgroundStyle(backgroundObj, props.theme, colorObj);
120
+ };
121
+ var dayHoverStyle = function dayHoverStyle(props) {
122
+ var backgroundObj;
123
+ var colorObj;
124
+ if (props.isSelected) {
125
+ var _props$theme$calendar16, _props$theme$calendar17;
126
+ backgroundObj = (_props$theme$calendar16 = props.theme.calendar.day) == null || (_props$theme$calendar16 = _props$theme$calendar16.selected) == null || (_props$theme$calendar16 = _props$theme$calendar16.hover) == null ? void 0 : _props$theme$calendar16.background;
127
+ colorObj = (_props$theme$calendar17 = props.theme.calendar.day) == null || (_props$theme$calendar17 = _props$theme$calendar17.selected) == null || (_props$theme$calendar17 = _props$theme$calendar17.hover) == null ? void 0 : _props$theme$calendar17.color;
128
+ } else if (props.inRange) {
129
+ var _props$theme$calendar18, _props$theme$calendar19;
130
+ backgroundObj = (_props$theme$calendar18 = props.theme.calendar.day) == null || (_props$theme$calendar18 = _props$theme$calendar18.inRange) == null || (_props$theme$calendar18 = _props$theme$calendar18.hover) == null ? void 0 : _props$theme$calendar18.background;
131
+ colorObj = (_props$theme$calendar19 = props.theme.calendar.day) == null || (_props$theme$calendar19 = _props$theme$calendar19.inRange) == null || (_props$theme$calendar19 = _props$theme$calendar19.hover) == null ? void 0 : _props$theme$calendar19.color;
132
+ } else {
133
+ var _props$theme$calendar20, _props$theme$calendar21;
134
+ backgroundObj = (_props$theme$calendar20 = props.theme.calendar.day) == null || (_props$theme$calendar20 = _props$theme$calendar20.hover) == null ? void 0 : _props$theme$calendar20.background;
135
+ colorObj = (_props$theme$calendar21 = props.theme.calendar.day) == null || (_props$theme$calendar21 = _props$theme$calendar21.hover) == null ? void 0 : _props$theme$calendar21.color;
136
+ }
137
+ if (colorObj && !backgroundObj) return "color: " + normalizeColor(colorObj, props.theme) + ";";
138
+ return backgroundStyle(backgroundObj, props.theme, colorObj);
139
+ };
140
+ var dayFontStyle = function dayFontStyle(props) {
141
+ var fontWeight;
142
+ if (props.isSelected) {
143
+ var _props$theme$calendar22;
144
+ fontWeight = (_props$theme$calendar22 = props.theme.calendar.day) == null || (_props$theme$calendar22 = _props$theme$calendar22.selected) == null || (_props$theme$calendar22 = _props$theme$calendar22.font) == null ? void 0 : _props$theme$calendar22.weight;
145
+ } else if (props.inRange) {
146
+ var _props$theme$calendar23;
147
+ fontWeight = (_props$theme$calendar23 = props.theme.calendar.day) == null || (_props$theme$calendar23 = _props$theme$calendar23.inRange) == null || (_props$theme$calendar23 = _props$theme$calendar23.font) == null ? void 0 : _props$theme$calendar23.weight;
148
+ }
149
+ return fontWeight && "font-weight: " + fontWeight + ";";
150
+ };
75
151
  var StyledDay = styled.div.withConfig(styledComponentsConfig).withConfig({
76
152
  displayName: "StyledCalendar__StyledDay",
77
153
  componentId: "sc-1y4xhmp-5"
78
- })(["display:flex;justify-content:center;align-items:center;", " ", " ", " ", " ", " ", ""], function (props) {
154
+ })(["display:flex;justify-content:center;align-items:center;", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
79
155
  return daySizeStyle(props);
80
156
  }, function (props) {
81
- return props.isSelected && backgroundStyle('control', props.theme) || props.inRange && backgroundStyle({
82
- color: 'control',
83
- opacity: 'weak'
84
- }, props.theme);
157
+ return dayStyle(props);
85
158
  }, function (props) {
86
159
  return props.otherMonth && 'opacity: 0.5;';
87
160
  }, function (props) {
88
- return props.isSelected && 'font-weight: bold;';
161
+ return dayFontStyle(props);
162
+ }, function (props) {
163
+ var _props$theme$calendar24, _props$theme$calendar25;
164
+ // fallback to medium if no size-specific styles
165
+ var round = ((_props$theme$calendar24 = props.theme.calendar) == null || (_props$theme$calendar24 = _props$theme$calendar24[props.sizeProp]) == null || (_props$theme$calendar24 = _props$theme$calendar24.day) == null ? void 0 : _props$theme$calendar24.round) || ((_props$theme$calendar25 = props.theme.calendar) == null || (_props$theme$calendar25 = _props$theme$calendar25.medium) == null || (_props$theme$calendar25 = _props$theme$calendar25.day) == null ? void 0 : _props$theme$calendar25.round);
166
+ return round && roundStyle(round, props.responsive, props.theme);
167
+ }, function (props) {
168
+ return props.active && activeStyle;
169
+ }, function (props) {
170
+ return props.hover && dayHoverStyle(props);
89
171
  }, function (props) {
90
172
  return (
91
173
  // when theme uses kind Buttons, since we use children for Button,