grommet 2.46.0 → 2.47.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 (230) hide show
  1. package/components/Accordion/index.d.ts +7 -1
  2. package/components/AccordionPanel/index.d.ts +4 -1
  3. package/components/Anchor/index.d.ts +7 -1
  4. package/components/Avatar/Avatar.js +4 -3
  5. package/components/Avatar/index.d.ts +9 -1
  6. package/components/Avatar/propTypes.js +2 -1
  7. package/components/Box/Box.js +41 -6
  8. package/components/Box/{ResponsiveContainer.js → ResponsiveContainerProvider.js} +29 -28
  9. package/components/Box/StyledBox.js +13 -2
  10. package/components/Box/index.d.ts +9 -2
  11. package/components/Button/index.d.ts +14 -2
  12. package/components/Calendar/Calendar.js +43 -32
  13. package/components/Calendar/StyledCalendar.js +86 -32
  14. package/components/Calendar/index.d.ts +15 -2
  15. package/components/Calendar/propTypes.js +1 -0
  16. package/components/Cards/index.d.ts +7 -1
  17. package/components/Carousel/index.d.ts +4 -1
  18. package/components/Chart/index.d.ts +7 -1
  19. package/components/CheckBox/index.d.ts +7 -1
  20. package/components/CheckBoxGroup/index.d.ts +15 -2
  21. package/components/Clock/index.d.ts +14 -2
  22. package/components/Collapsible/index.d.ts +4 -1
  23. package/components/Data/index.d.ts +4 -1
  24. package/components/DataFilter/index.d.ts +4 -1
  25. package/components/DataFilters/index.d.ts +4 -1
  26. package/components/DataTable/Body.js +13 -7
  27. package/components/DataTable/DataTable.js +6 -1
  28. package/components/DataTable/index.d.ts +11 -2
  29. package/components/DataTable/propTypes.js +5 -1
  30. package/components/DataTable/stories/rowDetails.stories.js +174 -66
  31. package/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
  32. package/components/DataTableGroupBy/index.d.ts +4 -1
  33. package/components/DataView/index.d.ts +4 -1
  34. package/components/DateInput/index.d.ts +4 -1
  35. package/components/Diagram/index.d.ts +4 -1
  36. package/components/Distribution/index.d.ts +4 -1
  37. package/components/Drop/StyledDrop.js +3 -1
  38. package/components/Drop/index.d.ts +6 -2
  39. package/components/DropButton/index.d.ts +8 -1
  40. package/components/FileInput/index.d.ts +8 -2
  41. package/components/Form/index.d.ts +7 -1
  42. package/components/FormField/index.d.ts +4 -1
  43. package/components/Grid/index.d.ts +4 -1
  44. package/components/Grommet/index.d.ts +18 -1
  45. package/components/Grommet/propTypes.js +11 -0
  46. package/components/Header/stories/typescript/Ref.stories.tsx +1 -1
  47. package/components/Heading/index.d.ts +7 -7
  48. package/components/Image/index.d.ts +4 -1
  49. package/components/InfiniteScroll/index.d.ts +2 -2
  50. package/components/Layer/index.d.ts +4 -1
  51. package/components/List/index.d.ts +9 -3
  52. package/components/Markdown/index.d.ts +5 -1
  53. package/components/MaskedInput/MaskedInput.js +49 -4
  54. package/components/MaskedInput/index.d.ts +7 -1
  55. package/components/MaskedInput/stories/CustomBox.stories.js +1 -0
  56. package/components/MaskedInput/stories/Date.stories.js +1 -0
  57. package/components/MaskedInput/stories/DateRange.stories.js +1 -0
  58. package/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
  59. package/components/MaskedInput/stories/Filtered.stories.js +1 -0
  60. package/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
  61. package/components/MaskedInput/stories/Time.stories.js +1 -0
  62. package/components/NameValueList/index.d.ts +8 -1
  63. package/components/Notification/index.d.ts +1 -0
  64. package/components/PageHeader/index.d.ts +5 -1
  65. package/components/Pagination/PaginationStep.js +4 -0
  66. package/components/Pagination/index.d.ts +5 -0
  67. package/components/Pagination/propTypes.js +6 -1
  68. package/components/Paragraph/index.d.ts +7 -1
  69. package/components/RadioButton/index.d.ts +7 -1
  70. package/components/RadioButtonGroup/index.d.ts +7 -1
  71. package/components/RangeInput/index.d.ts +7 -1
  72. package/components/RangeSelector/index.d.ts +15 -2
  73. package/components/RoutedAnchor/index.d.ts +3 -2
  74. package/components/RoutedButton/index.d.ts +3 -2
  75. package/components/Select/Select.js +2 -4
  76. package/components/Select/index.d.ts +7 -1
  77. package/components/Select/utils.js +12 -3
  78. package/components/SelectMultiple/SelectMultiple.js +5 -10
  79. package/components/SelectMultiple/SelectMultipleContainer.js +2 -4
  80. package/components/SelectMultiple/SelectMultipleValue.js +1 -2
  81. package/components/SelectMultiple/index.d.ts +7 -1
  82. package/components/Sidebar/index.d.ts +4 -1
  83. package/components/Stack/index.d.ts +4 -1
  84. package/components/Tab/index.d.ts +7 -1
  85. package/components/Table/index.d.ts +4 -1
  86. package/components/TableBody/index.d.ts +4 -1
  87. package/components/TableCell/index.d.ts +10 -3
  88. package/components/TableFooter/index.d.ts +4 -1
  89. package/components/TableHeader/index.d.ts +4 -1
  90. package/components/TableRow/index.d.ts +4 -1
  91. package/components/Tabs/index.d.ts +4 -1
  92. package/components/Tag/Tag.js +15 -1
  93. package/components/Tag/index.d.ts +6 -0
  94. package/components/Tag/propTypes.js +6 -0
  95. package/components/Text/Text.js +3 -2
  96. package/components/Text/index.d.ts +7 -1
  97. package/components/TextArea/index.d.ts +7 -1
  98. package/components/TextInput/TextInput.js +6 -2
  99. package/components/TextInput/index.d.ts +6 -3
  100. package/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
  101. package/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
  102. package/components/TextInput/stories/OnSelect.stories.js +1 -0
  103. package/components/TextInput/stories/WithTags.stories.js +1 -0
  104. package/components/Tip/Tip.js +25 -3
  105. package/components/ToggleGroup/index.d.ts +7 -1
  106. package/components/Toolbar/index.d.ts +5 -2
  107. package/components/Video/index.d.ts +7 -1
  108. package/components/WorldMap/index.d.ts +7 -1
  109. package/es6/components/Accordion/index.d.ts +7 -1
  110. package/es6/components/AccordionPanel/index.d.ts +4 -1
  111. package/es6/components/Anchor/index.d.ts +7 -1
  112. package/es6/components/Avatar/Avatar.js +4 -3
  113. package/es6/components/Avatar/index.d.ts +9 -1
  114. package/es6/components/Avatar/propTypes.js +2 -1
  115. package/es6/components/Box/Box.js +42 -7
  116. package/es6/components/Box/ResponsiveContainerProvider.js +54 -0
  117. package/es6/components/Box/StyledBox.js +12 -2
  118. package/es6/components/Box/index.d.ts +9 -2
  119. package/es6/components/Button/index.d.ts +14 -2
  120. package/es6/components/Calendar/Calendar.js +44 -32
  121. package/es6/components/Calendar/StyledCalendar.js +86 -32
  122. package/es6/components/Calendar/index.d.ts +15 -2
  123. package/es6/components/Calendar/propTypes.js +1 -0
  124. package/es6/components/Cards/index.d.ts +7 -1
  125. package/es6/components/Carousel/index.d.ts +4 -1
  126. package/es6/components/Chart/index.d.ts +7 -1
  127. package/es6/components/CheckBox/index.d.ts +7 -1
  128. package/es6/components/CheckBoxGroup/index.d.ts +15 -2
  129. package/es6/components/Clock/index.d.ts +14 -2
  130. package/es6/components/Collapsible/index.d.ts +4 -1
  131. package/es6/components/Data/index.d.ts +4 -1
  132. package/es6/components/DataFilter/index.d.ts +4 -1
  133. package/es6/components/DataFilters/index.d.ts +4 -1
  134. package/es6/components/DataTable/Body.js +13 -7
  135. package/es6/components/DataTable/DataTable.js +6 -1
  136. package/es6/components/DataTable/index.d.ts +11 -2
  137. package/es6/components/DataTable/propTypes.js +5 -1
  138. package/es6/components/DataTable/stories/rowDetails.stories.js +172 -66
  139. package/es6/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
  140. package/es6/components/DataTableGroupBy/index.d.ts +4 -1
  141. package/es6/components/DataView/index.d.ts +4 -1
  142. package/es6/components/DateInput/index.d.ts +4 -1
  143. package/es6/components/Diagram/index.d.ts +4 -1
  144. package/es6/components/Distribution/index.d.ts +4 -1
  145. package/es6/components/Drop/StyledDrop.js +3 -1
  146. package/es6/components/Drop/index.d.ts +6 -2
  147. package/es6/components/DropButton/index.d.ts +8 -1
  148. package/es6/components/FileInput/index.d.ts +8 -2
  149. package/es6/components/Form/index.d.ts +7 -1
  150. package/es6/components/FormField/index.d.ts +4 -1
  151. package/es6/components/Grid/index.d.ts +4 -1
  152. package/es6/components/Grommet/index.d.ts +18 -1
  153. package/es6/components/Grommet/propTypes.js +11 -0
  154. package/es6/components/Header/stories/typescript/Ref.stories.tsx +1 -1
  155. package/es6/components/Heading/index.d.ts +7 -7
  156. package/es6/components/Image/index.d.ts +4 -1
  157. package/es6/components/InfiniteScroll/index.d.ts +2 -2
  158. package/es6/components/Layer/index.d.ts +4 -1
  159. package/es6/components/List/index.d.ts +9 -3
  160. package/es6/components/Markdown/index.d.ts +5 -1
  161. package/es6/components/MaskedInput/MaskedInput.js +49 -4
  162. package/es6/components/MaskedInput/index.d.ts +7 -1
  163. package/es6/components/MaskedInput/stories/CustomBox.stories.js +1 -0
  164. package/es6/components/MaskedInput/stories/Date.stories.js +1 -0
  165. package/es6/components/MaskedInput/stories/DateRange.stories.js +1 -0
  166. package/es6/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
  167. package/es6/components/MaskedInput/stories/Filtered.stories.js +1 -0
  168. package/es6/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
  169. package/es6/components/MaskedInput/stories/Time.stories.js +1 -0
  170. package/es6/components/NameValueList/index.d.ts +8 -1
  171. package/es6/components/Notification/index.d.ts +1 -0
  172. package/es6/components/PageHeader/index.d.ts +5 -1
  173. package/es6/components/Pagination/PaginationStep.js +4 -0
  174. package/es6/components/Pagination/index.d.ts +5 -0
  175. package/es6/components/Pagination/propTypes.js +6 -1
  176. package/es6/components/Paragraph/index.d.ts +7 -1
  177. package/es6/components/RadioButton/index.d.ts +7 -1
  178. package/es6/components/RadioButtonGroup/index.d.ts +7 -1
  179. package/es6/components/RangeInput/index.d.ts +7 -1
  180. package/es6/components/RangeSelector/index.d.ts +15 -2
  181. package/es6/components/RoutedAnchor/index.d.ts +3 -2
  182. package/es6/components/RoutedButton/index.d.ts +3 -2
  183. package/es6/components/Select/Select.js +3 -5
  184. package/es6/components/Select/index.d.ts +7 -1
  185. package/es6/components/Select/utils.js +9 -2
  186. package/es6/components/SelectMultiple/SelectMultiple.js +6 -11
  187. package/es6/components/SelectMultiple/SelectMultipleContainer.js +3 -5
  188. package/es6/components/SelectMultiple/SelectMultipleValue.js +2 -3
  189. package/es6/components/SelectMultiple/index.d.ts +7 -1
  190. package/es6/components/Sidebar/index.d.ts +4 -1
  191. package/es6/components/Stack/index.d.ts +4 -1
  192. package/es6/components/Tab/index.d.ts +7 -1
  193. package/es6/components/Table/index.d.ts +4 -1
  194. package/es6/components/TableBody/index.d.ts +4 -1
  195. package/es6/components/TableCell/index.d.ts +10 -3
  196. package/es6/components/TableFooter/index.d.ts +4 -1
  197. package/es6/components/TableHeader/index.d.ts +4 -1
  198. package/es6/components/TableRow/index.d.ts +4 -1
  199. package/es6/components/Tabs/index.d.ts +4 -1
  200. package/es6/components/Tag/Tag.js +16 -2
  201. package/es6/components/Tag/index.d.ts +6 -0
  202. package/es6/components/Tag/propTypes.js +6 -0
  203. package/es6/components/Text/Text.js +3 -2
  204. package/es6/components/Text/index.d.ts +7 -1
  205. package/es6/components/TextArea/index.d.ts +7 -1
  206. package/es6/components/TextInput/TextInput.js +6 -2
  207. package/es6/components/TextInput/index.d.ts +6 -3
  208. package/es6/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
  209. package/es6/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
  210. package/es6/components/TextInput/stories/OnSelect.stories.js +1 -0
  211. package/es6/components/TextInput/stories/WithTags.stories.js +1 -0
  212. package/es6/components/Tip/Tip.js +26 -3
  213. package/es6/components/ToggleGroup/index.d.ts +7 -1
  214. package/es6/components/Toolbar/index.d.ts +5 -2
  215. package/es6/components/Video/index.d.ts +7 -1
  216. package/es6/components/WorldMap/index.d.ts +7 -1
  217. package/es6/languages/default.json +6 -0
  218. package/es6/utils/mixins.js +2 -1
  219. package/es6/utils/responsive.js +8 -7
  220. package/grommet.min.js +1 -1
  221. package/grommet.min.js.map +1 -1
  222. package/languages/default.json +6 -0
  223. package/package.json +43 -43
  224. package/utils/mixins.js +2 -1
  225. package/utils/responsive.js +8 -7
  226. package/components/Box/StyledResponsiveContainer.js +0 -11
  227. package/components/Drop/stories/TrapFocus.stories.js +0 -86
  228. package/es6/components/Box/ResponsiveContainer.js +0 -52
  229. package/es6/components/Box/StyledResponsiveContainer.js +0 -6
  230. package/es6/components/Drop/stories/TrapFocus.stories.js +0 -82
@@ -0,0 +1,54 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ResponsiveContainerContext, ResponsiveContext } from '../../contexts';
3
+ import { deviceResponsive, getBreakpoint } from '../../utils/responsive';
4
+
5
+ // The value of ResponsiveContainerContext
6
+ // when we're within a responsive container
7
+ var responsiveContainerValue = true;
8
+ export var ResponsiveContainerProvider = function ResponsiveContainerProvider(_ref) {
9
+ var container = _ref.container,
10
+ theme = _ref.theme,
11
+ children = _ref.children;
12
+ var _useState = useState(function () {
13
+ var _theme$global;
14
+ return deviceResponsive(navigator.userAgent, theme) || (theme == null || (_theme$global = theme.global) == null ? void 0 : _theme$global.deviceBreakpoints.tablet);
15
+ }),
16
+ value = _useState[0],
17
+ setValue = _useState[1];
18
+ useEffect(function () {
19
+ if (!container) return undefined;
20
+
21
+ // Track what breakpoint width of the container is at
22
+ // and update the ResponsiveContext value accordingly.
23
+ var resizeObserver;
24
+ if (typeof window !== 'undefined' && window.ResizeObserver) {
25
+ resizeObserver = new window.ResizeObserver(function (entries) {
26
+ window.requestAnimationFrame(function () {
27
+ var _entries$;
28
+ if (!Array.isArray(entries) || !entries.length) {
29
+ return;
30
+ }
31
+ var size = (_entries$ = entries[0]) == null || (_entries$ = _entries$.borderBoxSize) == null || (_entries$ = _entries$[0]) == null ? void 0 : _entries$.inlineSize;
32
+ if (size) {
33
+ setValue(getBreakpoint(size, theme));
34
+ }
35
+ });
36
+ });
37
+ resizeObserver.observe(container);
38
+ }
39
+ // Initial size for ResponsiveContext in responsive container mode.
40
+ // Also is a fallback for server side rendering
41
+ var containerWidth = container.getBoundingClientRect().width;
42
+ setValue(getBreakpoint(containerWidth, theme));
43
+ return function () {
44
+ if (resizeObserver) {
45
+ resizeObserver.disconnect();
46
+ }
47
+ };
48
+ }, [container, theme]);
49
+ return /*#__PURE__*/React.createElement(ResponsiveContainerContext.Provider, {
50
+ value: responsiveContainerValue
51
+ }, /*#__PURE__*/React.createElement(ResponsiveContext.Provider, {
52
+ value: value
53
+ }, children));
54
+ };
@@ -1,6 +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 isPropValid from '@emotion/is-prop-valid';
4
5
  import { alignContentStyle, alignStyle, backgroundStyle, borderStyle, breakpointStyle, edgeStyle, elevationStyle, fillStyle, focusStyle, genericStyles, getBreakpointStyle, getHoverIndicatorStyle, heightStyle, overflowStyle, parseMetricToNum, responsiveBorderStyle, widthStyle } from '../../utils';
5
6
  import { roundStyle, styledComponentsConfig } from '../../utils/styles';
6
7
  import { animationBounds, animationObjectStyle } from '../../utils/animation';
@@ -158,12 +159,19 @@ var gapStyle = function gapStyle(directionProp, gap, responsive, wrap, theme) {
158
159
  }
159
160
  return styles;
160
161
  };
162
+ var responsiveContainerStyle = css(["container-type:inline-size;"]);
161
163
 
162
164
  // NOTE: basis must be after flex! Otherwise, flex overrides basis
163
- var StyledBox = styled.div.withConfig(styledComponentsConfig).withConfig({
165
+ // After upgrading to react 19 the 'selected' prop is leaking through
166
+ // to the DOM, added a check to prevent this.
167
+ var StyledBox = styled.div.withConfig({
168
+ shouldForwardProp: function shouldForwardProp(prop) {
169
+ return isPropValid(prop) && !['selected'].includes(prop);
170
+ }
171
+ }).withConfig({
164
172
  displayName: "StyledBox",
165
173
  componentId: "sc-13pk1d4-0"
166
- })(["display:flex;box-sizing:border-box;", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
174
+ })(["display:flex;box-sizing:border-box;", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
167
175
  return !props.basis && 'max-width: 100%;';
168
176
  }, genericStyles, function (props) {
169
177
  return props.align && alignStyle;
@@ -209,6 +217,8 @@ var StyledBox = styled.div.withConfig(styledComponentsConfig).withConfig({
209
217
  return props.theme.box && props.theme.box.extend;
210
218
  }, function (props) {
211
219
  return props.kindProp && props.kindProp.extend;
220
+ }, function (props) {
221
+ return props.responsiveContainer ? responsiveContainerStyle : '';
212
222
  });
213
223
  var gapGapStyle = function gapGapStyle(directionProp, gap, responsive, border, theme) {
214
224
  var metric = theme.global.edgeSize[gap] || gap;
@@ -75,10 +75,17 @@ export interface BoxProps {
75
75
 
76
76
  export interface BoxExtendedProps
77
77
  extends BoxProps,
78
- Omit<JSX.IntrinsicElements['div'], keyof BoxProps> {}
78
+ Omit<
79
+ React.DetailedHTMLProps<
80
+ React.HTMLAttributes<HTMLDivElement>,
81
+ HTMLDivElement
82
+ >,
83
+ keyof BoxProps
84
+ > {}
79
85
 
80
86
  // Keep type alias for backwards compatibility.
81
- export type BoxTypes = BoxProps & JSX.IntrinsicElements['div'];
87
+ export type BoxTypes = BoxProps &
88
+ React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
82
89
 
83
90
  declare const Box: React.FC<BoxExtendedProps>;
84
91
 
@@ -79,8 +79,20 @@ export interface ButtonProps {
79
79
  as?: PolymorphicType;
80
80
  }
81
81
 
82
- type anchorType = Omit<JSX.IntrinsicElements['a'], 'color'>;
83
- type buttonType = Omit<JSX.IntrinsicElements['button'], 'color'>;
82
+ type anchorType = Omit<
83
+ React.DetailedHTMLProps<
84
+ React.AnchorHTMLAttributes<HTMLAnchorElement>,
85
+ HTMLAnchorElement
86
+ >,
87
+ 'color'
88
+ >;
89
+ type buttonType = Omit<
90
+ React.DetailedHTMLProps<
91
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
92
+ HTMLButtonElement
93
+ >,
94
+ 'color'
95
+ >;
84
96
  type extendType = anchorType & buttonType;
85
97
 
86
98
  export interface ButtonExtendedProps
@@ -1,8 +1,7 @@
1
- var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "level", "locale", "messages", "onReference", "onSelect", "range", "reference", "showAdjacentDays", "size", "timestamp"];
1
+ var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "level", "locale", "messages", "onReference", "onSelect", "range", "reference", "responsive", "showAdjacentDays", "size", "timestamp"];
2
2
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(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';
6
5
  import { AnnounceContext } from '../../contexts/AnnounceContext';
7
6
  import { MessageContext } from '../../contexts/MessageContext';
8
7
  import { Box } from '../Box';
@@ -12,7 +11,7 @@ import { Heading } from '../Heading';
12
11
  import { Keyboard } from '../Keyboard';
13
12
  import { Text } from '../Text';
14
13
  import { CalendarPropTypes } from './propTypes';
15
- import { StyledCalendar, StyledDay, StyledDayContainer, StyledWeek, StyledWeeks, StyledWeeksContainer } from './StyledCalendar';
14
+ import { StyledCalendar, StyledDay, StyledDayButton, StyledDayContainer, StyledWeek, StyledWeeks, StyledWeeksContainer } from './StyledCalendar';
16
15
  import { addDays, addMonths, betweenDates, daysApart, endOfMonth, handleOffset, sameDayOrAfter, sameDayOrBefore, startOfMonth, subtractDays, subtractMonths, withinDates } from './utils';
17
16
  import { setHoursWithOffset } from '../../utils/dates';
18
17
  import { useThemeValue } from '../../utils/useThemeValue';
@@ -151,16 +150,6 @@ var _getOutputFormat = function getOutputFormat(dates) {
151
150
  };
152
151
  export { _getOutputFormat as getOutputFormat };
153
152
  var millisecondsPerYear = 31557600000;
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
- });
164
153
  var CalendarDay = function CalendarDay(_ref) {
165
154
  var children = _ref.children,
166
155
  fill = _ref.fill,
@@ -170,7 +159,8 @@ var CalendarDay = function CalendarDay(_ref) {
170
159
  otherMonth = _ref.otherMonth,
171
160
  rangePosition = _ref.rangePosition,
172
161
  _ref$buttonProps = _ref.buttonProps,
173
- buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps;
162
+ buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
163
+ responsive = _ref.responsive;
174
164
  var _useThemeValue = useThemeValue(),
175
165
  passThemeFlag = _useThemeValue.passThemeFlag;
176
166
  var usingKeyboard = useKeyboard();
@@ -180,11 +170,13 @@ var CalendarDay = function CalendarDay(_ref) {
180
170
  isSelected: isSelected,
181
171
  rangePosition: rangePosition,
182
172
  sizeProp: size,
183
- fillContainer: fill
184
- }, /*#__PURE__*/React.createElement(CalendarDayButton, _extends({
173
+ fillContainer: fill,
174
+ responsive: responsive
175
+ }, /*#__PURE__*/React.createElement(StyledDayButton, _extends({
185
176
  fill: fill,
186
177
  tabIndex: -1,
187
- plain: true
178
+ plain: true,
179
+ responsive: responsive
188
180
  }, buttonProps), function (_ref2) {
189
181
  var active = _ref2.active,
190
182
  hover = _ref2.hover;
@@ -199,7 +191,8 @@ var CalendarDay = function CalendarDay(_ref) {
199
191
  isSelected: isSelected,
200
192
  otherMonth: otherMonth,
201
193
  sizeProp: size,
202
- fillContainer: fill
194
+ fillContainer: fill,
195
+ responsive: responsive
203
196
  }, passThemeFlag), children);
204
197
  }));
205
198
  };
@@ -207,20 +200,24 @@ var CalendarCustomDay = function CalendarCustomDay(_ref3) {
207
200
  var children = _ref3.children,
208
201
  fill = _ref3.fill,
209
202
  size = _ref3.size,
210
- buttonProps = _ref3.buttonProps;
203
+ buttonProps = _ref3.buttonProps,
204
+ responsive = _ref3.responsive;
211
205
  if (!buttonProps) {
212
206
  return /*#__PURE__*/React.createElement(StyledDayContainer, {
213
207
  role: "gridcell",
214
208
  sizeProp: size,
215
- fillContainer: fill
209
+ fillContainer: fill,
210
+ responsive: responsive
216
211
  }, children);
217
212
  }
218
213
  return /*#__PURE__*/React.createElement(StyledDayContainer, {
219
214
  role: "gridcell",
220
215
  sizeProp: size,
221
- fillContainer: fill
222
- }, /*#__PURE__*/React.createElement(CalendarDayButton, _extends({
223
- fill: fill
216
+ fillContainer: fill,
217
+ responsive: responsive
218
+ }, /*#__PURE__*/React.createElement(StyledDayButton, _extends({
219
+ fill: fill,
220
+ responsive: responsive
224
221
  }, buttonProps), children));
225
222
  };
226
223
  var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
@@ -246,6 +243,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
246
243
  onSelect = _ref4.onSelect,
247
244
  range = _ref4.range,
248
245
  referenceProp = _ref4.reference,
246
+ _ref4$responsive = _ref4.responsive,
247
+ responsiveProp = _ref4$responsive === void 0 ? true : _ref4$responsive,
249
248
  _ref4$showAdjacentDay = _ref4.showAdjacentDays,
250
249
  showAdjacentDays = _ref4$showAdjacentDay === void 0 ? true : _ref4$showAdjacentDay,
251
250
  _ref4$size = _ref4.size,
@@ -259,6 +258,9 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
259
258
  var _useContext = useContext(MessageContext),
260
259
  format = _useContext.format;
261
260
 
261
+ // If fill is true the responsive behavior isn't needed.
262
+ var responsive = responsiveProp && !fill;
263
+
262
264
  // when mousedown, we don't want to let Calendar set
263
265
  // active date to firstInMonth
264
266
  var _useState = useState(false),
@@ -605,10 +607,12 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
605
607
  role: "gridcell",
606
608
  key: days.length,
607
609
  sizeProp: size,
608
- fillContainer: fill
610
+ fillContainer: fill,
611
+ responsive: responsive
609
612
  }, /*#__PURE__*/React.createElement(StyledDay, {
610
613
  sizeProp: size,
611
- fillContainer: fill
614
+ fillContainer: fill,
615
+ responsive: responsive
612
616
  }, day.toLocaleDateString(locale, {
613
617
  weekday: 'narrow'
614
618
  }))));
@@ -639,10 +643,12 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
639
643
  days.push(/*#__PURE__*/React.createElement(StyledDayContainer, {
640
644
  key: day.getTime(),
641
645
  sizeProp: size,
642
- fillContainer: fill
646
+ fillContainer: fill,
647
+ responsive: responsive
643
648
  }, /*#__PURE__*/React.createElement(StyledDay, {
644
649
  sizeProp: size,
645
- fillContainer: fill
650
+ fillContainer: fill,
651
+ responsive: responsive
646
652
  })));
647
653
  if (weeks.length === 5 &&
648
654
  /* If the length days array is less than the current getDate()
@@ -661,10 +667,12 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
661
667
  days.push(/*#__PURE__*/React.createElement(StyledDayContainer, {
662
668
  key: day.getTime(),
663
669
  sizeProp: size,
664
- fillContainer: fill
670
+ fillContainer: fill,
671
+ responsive: responsive
665
672
  }, /*#__PURE__*/React.createElement(StyledDay, {
666
673
  sizeProp: size,
667
- fillContainer: fill
674
+ fillContainer: fill,
675
+ responsive: responsive
668
676
  })));
669
677
  } else {
670
678
  var dateObject = day;
@@ -707,7 +715,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
707
715
  otherMonth: day.getMonth() !== reference.getMonth(),
708
716
  rangePosition: rangePosition,
709
717
  size: size,
710
- fill: fill
718
+ fill: fill,
719
+ responsive: responsive
711
720
  }, day.getDate()));
712
721
  } else {
713
722
  days.push(/*#__PURE__*/React.createElement(CalendarCustomDay, {
@@ -727,7 +736,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
727
736
  }
728
737
  } : null,
729
738
  size: size,
730
- fill: fill
739
+ fill: fill,
740
+ responsive: responsive
731
741
  }, children({
732
742
  date: day,
733
743
  day: day.getDate(),
@@ -752,7 +762,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
752
762
  return /*#__PURE__*/React.createElement(StyledCalendar, _extends({
753
763
  ref: ref,
754
764
  sizeProp: size,
755
- fillContainer: fill
765
+ fillContainer: fill,
766
+ responsive: responsive
756
767
  }, passThemeFlag, rest), /*#__PURE__*/React.createElement(Box, {
757
768
  fill: fill
758
769
  }, header ? header({
@@ -837,6 +848,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
837
848
  ref: daysRef,
838
849
  sizeProp: size,
839
850
  fillContainer: fill,
851
+ responsive: responsive,
840
852
  focus: focus,
841
853
  onFocus: function onFocus() {
842
854
  setFocus(true);
@@ -1,6 +1,14 @@
1
1
  import styled, { css, keyframes } from 'styled-components';
2
+ import { Button } from '../Button';
2
3
  import { backgroundStyle, focusStyle, genericStyles, kindPartStyles, normalizeColor, parseMetricToNum, roundStyle, styledComponentsConfig } from '../../utils';
3
4
  import { activeStyle } from '../../utils/background';
5
+ import { breakpointStyle } from '../../utils/mixins';
6
+ var responsiveSizeStyle = function responsiveSizeStyle(props) {
7
+ var breakpoint = props.theme.global.size[props.sizeProp];
8
+ return breakpointStyle({
9
+ value: breakpoint
10
+ }, "\n width: 100vw;\n max-width: " + breakpoint + ";\n ", true);
11
+ };
4
12
  var sizeStyle = function sizeStyle(props) {
5
13
  var data = props.theme.calendar[props.sizeProp];
6
14
  var width = props.fillContainer ? '100%' : props.theme.global.size[props.sizeProp];
@@ -11,8 +19,10 @@ var sizeStyle = function sizeStyle(props) {
11
19
  var StyledCalendar = styled.div.withConfig(styledComponentsConfig).withConfig({
12
20
  displayName: "StyledCalendar",
13
21
  componentId: "sc-1y4xhmp-0"
14
- })(["", " ", " ", ""], genericStyles, function (props) {
22
+ })(["", " ", " ", " ", ""], genericStyles, function (props) {
15
23
  return sizeStyle(props);
24
+ }, function (props) {
25
+ return props.responsive && responsiveSizeStyle(props);
16
26
  }, function (props) {
17
27
  return props.theme.calendar && props.theme.calendar.extend;
18
28
  });
@@ -20,11 +30,20 @@ var weeksContainerSizeStyle = function weeksContainerSizeStyle(props) {
20
30
  var height = props.fillContainer ? '100%' : parseMetricToNum(props.theme.calendar[props.sizeProp].daySize) * 6 + "px";
21
31
  return "\n height: " + height + ";\n\n ";
22
32
  };
33
+ var weeksContainerResponsiveSizeStyle = function weeksContainerResponsiveSizeStyle(props) {
34
+ var breakpoint = props.theme.global.size[props.sizeProp];
35
+ // set aspect-ratio to 7 days by 6 weeks
36
+ return breakpointStyle({
37
+ value: breakpoint
38
+ }, "\n height: auto;\n aspect-ratio: 7/6;\n ", true);
39
+ };
23
40
  var StyledWeeksContainer = styled.div.withConfig(styledComponentsConfig).withConfig({
24
41
  displayName: "StyledCalendar__StyledWeeksContainer",
25
42
  componentId: "sc-1y4xhmp-1"
26
- })(["overflow:hidden;", " ", ";"], function (props) {
43
+ })(["overflow:hidden;", " ", " ", ";"], function (props) {
27
44
  return weeksContainerSizeStyle(props);
45
+ }, function (props) {
46
+ return props.responsive && weeksContainerResponsiveSizeStyle(props);
28
47
  }, function (props) {
29
48
  return props.focus && !props.plain && focusStyle();
30
49
  });
@@ -75,45 +94,78 @@ var StyledWeek = styled.div.withConfig(styledComponentsConfig).withConfig({
75
94
  })(["display:flex;justify-content:space-between;", ""], function (props) {
76
95
  return props.fillContainer && 'flex: 1;';
77
96
  });
97
+ var responsiveDayContainerStyle = function responsiveDayContainerStyle(props) {
98
+ var breakpoint = props.theme.global.size[props.sizeProp];
99
+ return breakpointStyle({
100
+ value: breakpoint
101
+ }, "\n width: 14.3%;\n ", true);
102
+ };
78
103
 
79
104
  // The width of 14.3% is derived from dividing 100/7. We want the
80
105
  // widths of 7 days to equally fill 100% of the row.
81
106
  var StyledDayContainer = styled.div.withConfig(styledComponentsConfig).withConfig({
82
107
  displayName: "StyledCalendar__StyledDayContainer",
83
108
  componentId: "sc-1y4xhmp-4"
84
- })(["flex:0 1 auto;", " ", " ", ""], function (props) {
109
+ })(["flex:0 1 auto;", " ", " ", " ", ""], function (props) {
85
110
  return props.fillContainer && 'width: 14.3%;';
86
111
  }, function (props) {
87
112
  var _props$theme$calendar7;
88
113
  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
114
  }, function (props) {
90
115
  return rangeRoundStyle(props);
116
+ }, function (props) {
117
+ return props.responsive && responsiveDayContainerStyle(props);
118
+ });
119
+ var responsiveDayButtonStyle = function responsiveDayButtonStyle(props) {
120
+ var breakpoint = props.theme.global.size[props.sizeProp];
121
+ return breakpointStyle({
122
+ value: breakpoint
123
+ }, "\n width: 100%;\n ", true);
124
+ };
125
+
126
+ // when caller opts in to day hover styling, apply all state styles
127
+ // on CalendarDay instead of active state on CalendarDayButton
128
+ var StyledDayButton = styled(Button).withConfig({
129
+ displayName: "StyledCalendar__StyledDayButton",
130
+ componentId: "sc-1y4xhmp-5"
131
+ })(["", " ", ""], function (props) {
132
+ var _props$theme$calendar8;
133
+ return ((_props$theme$calendar8 = props.theme.calendar) == null || (_props$theme$calendar8 = _props$theme$calendar8.day) == null || (_props$theme$calendar8 = _props$theme$calendar8.hover) == null ? void 0 : _props$theme$calendar8.background) && 'background: inherit;';
134
+ }, function (props) {
135
+ return props.responsive && responsiveDayButtonStyle(props);
91
136
  });
92
137
  var daySizeStyle = function daySizeStyle(props) {
93
138
  var data = props.theme.calendar[props.sizeProp];
94
139
  return css(["width:", ";height:", ";"], props.fillContainer ? '100%' : data.daySize, props.fillContainer ? '100%' : data.daySize);
95
140
  };
141
+ var responsiveDaySizeStyle = function responsiveDaySizeStyle(props) {
142
+ var breakpoint = props.theme.global.size[props.sizeProp];
143
+ var data = props.theme.calendar[props.sizeProp];
144
+ return breakpointStyle({
145
+ value: breakpoint
146
+ }, "\n width: 100%;\n max-width: " + data.daySize + ";\n height: auto;\n aspect-ratio: 1;\n ", true);
147
+ };
96
148
  var dayStyle = function dayStyle(props) {
97
149
  var backgroundObj;
98
150
  var colorObj;
99
151
  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;
152
+ var _props$theme$calendar9, _props$theme$calendar10;
153
+ backgroundObj = ((_props$theme$calendar9 = props.theme.calendar.day) == null || (_props$theme$calendar9 = _props$theme$calendar9.selected) == null ? void 0 : _props$theme$calendar9.background) || 'control';
154
+ colorObj = (_props$theme$calendar10 = props.theme.calendar.day) == null || (_props$theme$calendar10 = _props$theme$calendar10.selected) == null ? void 0 : _props$theme$calendar10.color;
103
155
  } else if (props.inRange) {
104
- var _props$theme$calendar10, _props$theme$calendar11, _props$theme$calendar12, _props$theme$calendar13;
156
+ var _props$theme$calendar11, _props$theme$calendar12, _props$theme$calendar13, _props$theme$calendar14;
105
157
  // for backwards compatability, only apply this if caller hasn't specified
106
158
  // range specific rounding
107
159
  // 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) || {
160
+ backgroundObj = !((_props$theme$calendar11 = props.theme.calendar) != null && (_props$theme$calendar11 = _props$theme$calendar11[props.sizeProp]) != null && (_props$theme$calendar11 = _props$theme$calendar11.range) != null && _props$theme$calendar11.round) && !((_props$theme$calendar12 = props.theme.calendar) != null && (_props$theme$calendar12 = _props$theme$calendar12.medium.range) != null && _props$theme$calendar12.round) && (((_props$theme$calendar13 = props.theme.calendar.day) == null || (_props$theme$calendar13 = _props$theme$calendar13.inRange) == null ? void 0 : _props$theme$calendar13.background) || {
109
161
  color: 'control',
110
162
  opacity: 'weak'
111
163
  });
112
- colorObj = (_props$theme$calendar13 = props.theme.calendar.day) == null || (_props$theme$calendar13 = _props$theme$calendar13.inRange) == null ? void 0 : _props$theme$calendar13.color;
164
+ colorObj = (_props$theme$calendar14 = props.theme.calendar.day) == null || (_props$theme$calendar14 = _props$theme$calendar14.inRange) == null ? void 0 : _props$theme$calendar14.color;
113
165
  } 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;
166
+ var _props$theme$calendar15, _props$theme$calendar16;
167
+ backgroundObj = (_props$theme$calendar15 = props.theme.calendar.day) == null ? void 0 : _props$theme$calendar15.background;
168
+ colorObj = (_props$theme$calendar16 = props.theme.calendar.day) == null ? void 0 : _props$theme$calendar16.color;
117
169
  }
118
170
  if (colorObj && !backgroundObj) return "color: " + normalizeColor(colorObj, props.theme) + ";";
119
171
  return backgroundStyle(backgroundObj, props.theme, colorObj);
@@ -122,17 +174,17 @@ var dayHoverStyle = function dayHoverStyle(props) {
122
174
  var backgroundObj;
123
175
  var colorObj;
124
176
  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;
177
+ var _props$theme$calendar17, _props$theme$calendar18;
178
+ backgroundObj = (_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.background;
179
+ colorObj = (_props$theme$calendar18 = props.theme.calendar.day) == null || (_props$theme$calendar18 = _props$theme$calendar18.selected) == null || (_props$theme$calendar18 = _props$theme$calendar18.hover) == null ? void 0 : _props$theme$calendar18.color;
128
180
  } 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;
181
+ var _props$theme$calendar19, _props$theme$calendar20;
182
+ backgroundObj = (_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.background;
183
+ colorObj = (_props$theme$calendar20 = props.theme.calendar.day) == null || (_props$theme$calendar20 = _props$theme$calendar20.inRange) == null || (_props$theme$calendar20 = _props$theme$calendar20.hover) == null ? void 0 : _props$theme$calendar20.color;
132
184
  } 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;
185
+ var _props$theme$calendar21, _props$theme$calendar22;
186
+ backgroundObj = (_props$theme$calendar21 = props.theme.calendar.day) == null || (_props$theme$calendar21 = _props$theme$calendar21.hover) == null ? void 0 : _props$theme$calendar21.background;
187
+ colorObj = (_props$theme$calendar22 = props.theme.calendar.day) == null || (_props$theme$calendar22 = _props$theme$calendar22.hover) == null ? void 0 : _props$theme$calendar22.color;
136
188
  }
137
189
  if (colorObj && !backgroundObj) return "color: " + normalizeColor(colorObj, props.theme) + ";";
138
190
  return backgroundStyle(backgroundObj, props.theme, colorObj);
@@ -140,30 +192,32 @@ var dayHoverStyle = function dayHoverStyle(props) {
140
192
  var dayFontStyle = function dayFontStyle(props) {
141
193
  var fontWeight;
142
194
  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
195
  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;
196
+ fontWeight = (_props$theme$calendar23 = props.theme.calendar.day) == null || (_props$theme$calendar23 = _props$theme$calendar23.selected) == null || (_props$theme$calendar23 = _props$theme$calendar23.font) == null ? void 0 : _props$theme$calendar23.weight;
197
+ } else if (props.inRange) {
198
+ var _props$theme$calendar24;
199
+ fontWeight = (_props$theme$calendar24 = props.theme.calendar.day) == null || (_props$theme$calendar24 = _props$theme$calendar24.inRange) == null || (_props$theme$calendar24 = _props$theme$calendar24.font) == null ? void 0 : _props$theme$calendar24.weight;
148
200
  }
149
201
  return fontWeight && "font-weight: " + fontWeight + ";";
150
202
  };
151
203
  var StyledDay = styled.div.withConfig(styledComponentsConfig).withConfig({
152
204
  displayName: "StyledCalendar__StyledDay",
153
- componentId: "sc-1y4xhmp-5"
154
- })(["display:flex;justify-content:center;align-items:center;color:", ";", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
155
- var _props$theme$calendar24;
156
- return normalizeColor(props.otherMonth ? ((_props$theme$calendar24 = props.theme.calendar) == null || (_props$theme$calendar24 = _props$theme$calendar24.day) == null || (_props$theme$calendar24 = _props$theme$calendar24.adjacent) == null ? void 0 : _props$theme$calendar24.color) || 'text-xweak' : 'text-strong', props.theme);
205
+ componentId: "sc-1y4xhmp-6"
206
+ })(["display:flex;justify-content:center;align-items:center;color:", ";", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
207
+ var _props$theme$calendar25;
208
+ return normalizeColor(props.otherMonth ? ((_props$theme$calendar25 = props.theme.calendar) == null || (_props$theme$calendar25 = _props$theme$calendar25.day) == null || (_props$theme$calendar25 = _props$theme$calendar25.adjacent) == null ? void 0 : _props$theme$calendar25.color) || 'text-xweak' : 'text-strong', props.theme);
157
209
  }, function (props) {
158
210
  return daySizeStyle(props);
211
+ }, function (props) {
212
+ return props.responsive && responsiveDaySizeStyle(props);
159
213
  }, function (props) {
160
214
  return dayStyle(props);
161
215
  }, function (props) {
162
216
  return dayFontStyle(props);
163
217
  }, function (props) {
164
- var _props$theme$calendar25, _props$theme$calendar26;
218
+ var _props$theme$calendar26, _props$theme$calendar27;
165
219
  // fallback to medium if no size-specific styles
166
- var round = ((_props$theme$calendar25 = props.theme.calendar) == null || (_props$theme$calendar25 = _props$theme$calendar25[props.sizeProp]) == null || (_props$theme$calendar25 = _props$theme$calendar25.day) == null ? void 0 : _props$theme$calendar25.round) || ((_props$theme$calendar26 = props.theme.calendar) == null || (_props$theme$calendar26 = _props$theme$calendar26.medium) == null || (_props$theme$calendar26 = _props$theme$calendar26.day) == null ? void 0 : _props$theme$calendar26.round);
220
+ var round = ((_props$theme$calendar26 = props.theme.calendar) == null || (_props$theme$calendar26 = _props$theme$calendar26[props.sizeProp]) == null || (_props$theme$calendar26 = _props$theme$calendar26.day) == null ? void 0 : _props$theme$calendar26.round) || ((_props$theme$calendar27 = props.theme.calendar) == null || (_props$theme$calendar27 = _props$theme$calendar27.medium) == null || (_props$theme$calendar27 = _props$theme$calendar27.day) == null ? void 0 : _props$theme$calendar27.round);
167
221
  return round && roundStyle(round, props.responsive, props.theme);
168
222
  }, function (props) {
169
223
  return props.active && activeStyle;
@@ -178,4 +232,4 @@ var StyledDay = styled.div.withConfig(styledComponentsConfig).withConfig({
178
232
  }, function (props) {
179
233
  return props.theme.calendar && props.theme.calendar.day && props.theme.calendar.day.extend;
180
234
  });
181
- export { StyledCalendar, StyledWeeksContainer, StyledWeeks, StyledWeek, StyledDayContainer, StyledDay };
235
+ export { StyledCalendar, StyledWeeksContainer, StyledWeeks, StyledWeek, StyledDayContainer, StyledDayButton, StyledDay };
@@ -49,17 +49,30 @@ export interface CalendarProps {
49
49
  onSelect?: (select: string | string[]) => any;
50
50
  range?: boolean | 'array';
51
51
  reference?: string;
52
+ responsive?: boolean;
52
53
  showAdjacentDays?: boolean | 'trim';
53
54
  size?: 'small' | 'medium' | 'large' | string;
54
55
  }
55
56
 
56
57
  export interface CalendarExtendedProps
57
58
  extends CalendarProps,
58
- Omit<JSX.IntrinsicElements['div'], keyof CalendarProps> {}
59
+ Omit<
60
+ React.DetailedHTMLProps<
61
+ React.HTMLAttributes<HTMLDivElement>,
62
+ HTMLDivElement
63
+ >,
64
+ keyof CalendarProps
65
+ > {}
59
66
 
60
67
  // Keep type alias for backwards compatibility.
61
68
  export type CalendarType = CalendarProps &
62
- Omit<JSX.IntrinsicElements['div'], 'onSelect'>;
69
+ Omit<
70
+ React.DetailedHTMLProps<
71
+ React.HTMLAttributes<HTMLDivElement>,
72
+ HTMLDivElement
73
+ >,
74
+ 'onSelect'
75
+ >;
63
76
 
64
77
  declare const Calendar: React.ComponentClass<CalendarExtendedProps>;
65
78
 
@@ -25,6 +25,7 @@ if (process.env.NODE_ENV !== 'production') {
25
25
  onSelect: PropTypes.func,
26
26
  range: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['array'])]),
27
27
  reference: PropTypes.string,
28
+ responsive: PropTypes.bool,
28
29
  showAdjacentDays: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['trim'])]),
29
30
  size: PropTypes.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string])
30
31
  });
@@ -25,7 +25,13 @@ export interface CardsProps<CardType = any> {
25
25
  step?: number;
26
26
  }
27
27
 
28
- type ulProps = Omit<JSX.IntrinsicElements['ul'], 'children'>;
28
+ type ulProps = Omit<
29
+ React.DetailedHTMLProps<
30
+ React.HTMLAttributes<HTMLUListElement>,
31
+ HTMLUListElement
32
+ >,
33
+ 'children'
34
+ >;
29
35
 
30
36
  export interface CardsExtendedProps<CardType>
31
37
  extends CardsProps<CardType>,
@@ -24,7 +24,10 @@ export interface CarouselProps {
24
24
  onChild?: (...args: any[]) => void;
25
25
  }
26
26
 
27
- type divType = JSX.IntrinsicElements['div'];
27
+ type divType = React.DetailedHTMLProps<
28
+ React.HTMLAttributes<HTMLDivElement>,
29
+ HTMLDivElement
30
+ >;
28
31
 
29
32
  export interface CarouselExtendedProps extends CarouselProps, divType {}
30
33
 
@@ -104,7 +104,13 @@ export interface ChartProps {
104
104
 
105
105
  export interface ChartExtendedProps
106
106
  extends ChartProps,
107
- Omit<JSX.IntrinsicElements['svg'], keyof ChartProps> {}
107
+ Omit<
108
+ React.DetailedHTMLProps<
109
+ React.SVGAttributes<SVGSVGElement>,
110
+ SVGSVGElement
111
+ >,
112
+ keyof ChartProps
113
+ > {}
108
114
 
109
115
  declare const Chart: React.FC<ChartExtendedProps>;
110
116