grommet 2.41.0 → 2.42.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 (117) hide show
  1. package/components/AccordionPanel/AccordionPanel.js +1 -7
  2. package/components/Box/Box.js +1 -1
  3. package/components/Box/StyledBox.js +1 -6
  4. package/components/Box/index.d.ts +1 -0
  5. package/components/Box/propTypes.js +1 -0
  6. package/components/Button/Button.js +1 -0
  7. package/components/Button/StyledButton.js +3 -2
  8. package/components/Calendar/Calendar.js +90 -56
  9. package/components/Calendar/StyledCalendar.js +89 -7
  10. package/components/Calendar/utils.js +16 -2
  11. package/components/Carousel/Carousel.js +1 -1
  12. package/components/Chart/Chart.js +3 -3
  13. package/components/CheckBox/CheckBox.js +3 -2
  14. package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  15. package/components/Clock/Digital.js +1 -1
  16. package/components/Data/stories/Infinite.js +2 -2
  17. package/components/Data/stories/OnSelect.js +2 -2
  18. package/components/Data/stories/SpaceX.js +2 -2
  19. package/components/Data/stories/StarWars.js +1 -1
  20. package/components/DataFilter/DataFilter.js +1 -1
  21. package/components/DataSort/DataSort.js +46 -14
  22. package/components/DataSort/stories/Simple.js +10 -1
  23. package/components/DataTable/Body.js +14 -8
  24. package/components/DataTable/GroupedBody.js +3 -3
  25. package/components/DataTable/buildState.js +5 -1
  26. package/components/DataTable/stories/SpaceX.js +2 -2
  27. package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
  28. package/components/FileInput/index.d.ts +2 -3
  29. package/components/Layer/Layer.js +1 -1
  30. package/components/Layer/index.d.ts +2 -0
  31. package/components/List/List.js +18 -12
  32. package/components/Meter/Circle.js +2 -2
  33. package/components/Notification/Notification.js +18 -6
  34. package/components/Notification/index.d.ts +1 -0
  35. package/components/Notification/propTypes.js +1 -0
  36. package/components/Pagination/Pagination.js +4 -2
  37. package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  38. package/components/Select/Select.js +7 -3
  39. package/components/Select/SelectContainer.js +41 -34
  40. package/components/Select/index.d.ts +1 -1
  41. package/components/Select/utils.js +13 -2
  42. package/components/SelectMultiple/SelectMultiple.js +10 -0
  43. package/components/SelectMultiple/SelectMultipleContainer.js +28 -2
  44. package/components/SelectMultiple/SelectMultipleValue.js +14 -1
  45. package/components/SkipLinks/index.d.ts +1 -0
  46. package/components/SkipLinks/propTypes.js +1 -0
  47. package/components/Tab/Tab.js +1 -1
  48. package/components/Tag/Tag.js +11 -7
  49. package/components/ToggleGroup/StyledToggleGroup.js +12 -5
  50. package/components/ToggleGroup/ToggleGroup.js +21 -10
  51. package/components/WorldMap/WorldMap.js +1 -1
  52. package/es6/components/AccordionPanel/AccordionPanel.js +2 -9
  53. package/es6/components/Box/Box.js +1 -1
  54. package/es6/components/Box/StyledBox.js +1 -6
  55. package/es6/components/Box/index.d.ts +1 -0
  56. package/es6/components/Box/propTypes.js +1 -0
  57. package/es6/components/Button/Button.js +1 -0
  58. package/es6/components/Button/StyledButton.js +4 -3
  59. package/es6/components/Calendar/Calendar.js +89 -56
  60. package/es6/components/Calendar/StyledCalendar.js +90 -8
  61. package/es6/components/Calendar/utils.js +15 -1
  62. package/es6/components/Carousel/Carousel.js +1 -1
  63. package/es6/components/Chart/Chart.js +3 -3
  64. package/es6/components/CheckBox/CheckBox.js +3 -2
  65. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  66. package/es6/components/Clock/Digital.js +1 -1
  67. package/es6/components/Data/stories/Infinite.js +2 -2
  68. package/es6/components/Data/stories/OnSelect.js +2 -2
  69. package/es6/components/Data/stories/SpaceX.js +2 -2
  70. package/es6/components/Data/stories/StarWars.js +1 -1
  71. package/es6/components/DataFilter/DataFilter.js +1 -1
  72. package/es6/components/DataSort/DataSort.js +46 -14
  73. package/es6/components/DataSort/stories/Simple.js +10 -1
  74. package/es6/components/DataTable/Body.js +14 -8
  75. package/es6/components/DataTable/GroupedBody.js +3 -3
  76. package/es6/components/DataTable/buildState.js +5 -1
  77. package/es6/components/DataTable/stories/SpaceX.js +2 -2
  78. package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
  79. package/es6/components/FileInput/index.d.ts +2 -3
  80. package/es6/components/Layer/Layer.js +1 -1
  81. package/es6/components/Layer/index.d.ts +2 -0
  82. package/es6/components/List/List.js +18 -12
  83. package/es6/components/Meter/Circle.js +2 -2
  84. package/es6/components/Notification/Notification.js +18 -6
  85. package/es6/components/Notification/index.d.ts +1 -0
  86. package/es6/components/Notification/propTypes.js +1 -0
  87. package/es6/components/Pagination/Pagination.js +4 -2
  88. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  89. package/es6/components/Select/Select.js +8 -4
  90. package/es6/components/Select/SelectContainer.js +41 -34
  91. package/es6/components/Select/index.d.ts +1 -1
  92. package/es6/components/Select/utils.js +15 -3
  93. package/es6/components/SelectMultiple/SelectMultiple.js +10 -0
  94. package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -2
  95. package/es6/components/SelectMultiple/SelectMultipleValue.js +14 -1
  96. package/es6/components/SkipLinks/index.d.ts +1 -0
  97. package/es6/components/SkipLinks/propTypes.js +1 -0
  98. package/es6/components/Tab/Tab.js +1 -1
  99. package/es6/components/Tag/Tag.js +11 -7
  100. package/es6/components/ToggleGroup/StyledToggleGroup.js +12 -5
  101. package/es6/components/ToggleGroup/ToggleGroup.js +22 -11
  102. package/es6/components/WorldMap/WorldMap.js +1 -1
  103. package/es6/themes/base.d.ts +204 -6
  104. package/es6/themes/base.js +165 -1
  105. package/es6/utils/background.js +1 -1
  106. package/es6/utils/index.js +2 -1
  107. package/es6/utils/styles.js +8 -0
  108. package/es6/utils/useId.js +16 -0
  109. package/grommet.min.js +1 -1
  110. package/grommet.min.js.map +1 -1
  111. package/package.json +33 -33
  112. package/themes/base.d.ts +204 -6
  113. package/themes/base.js +165 -1
  114. package/utils/background.js +1 -1
  115. package/utils/index.js +6 -0
  116. package/utils/styles.js +9 -1
  117. package/utils/useId.js +19 -0
@@ -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
  , {
@@ -756,6 +783,12 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
756
783
  onEnter: function onEnter() {
757
784
  return active !== undefined ? _onClick(active) : undefined;
758
785
  },
786
+ onSpace: function onSpace(event) {
787
+ event.preventDefault();
788
+ if (active !== undefined) {
789
+ _onClick(active);
790
+ }
791
+ },
759
792
  onUp: function onUp(event) {
760
793
  event.preventDefault();
761
794
  event.stopPropagation(); // so the page doesn't scroll
@@ -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,
@@ -78,6 +78,18 @@ export var betweenDates = function betweenDates(date, dates) {
78
78
  }
79
79
  return result;
80
80
  };
81
+ export var getRangePosition = function getRangePosition(date, dates) {
82
+ var rangePosition;
83
+ if (dates) {
84
+ var _ref2 = Array.isArray(dates) ? dates.map(function (d) {
85
+ return d ? new Date(d) : undefined;
86
+ }) : [dates, undefined],
87
+ from = _ref2[0],
88
+ to = _ref2[1];
89
+ if (from && sameDay(date, from)) rangePosition = 'start';else if (to && sameDay(date, to)) rangePosition = 'end';
90
+ }
91
+ return rangePosition;
92
+ };
81
93
 
82
94
  // withinDates takes an array of string dates or 2 element arrays and
83
95
  // checks whether the supplied date matches any string or is between
@@ -85,6 +97,7 @@ export var betweenDates = function betweenDates(date, dates) {
85
97
  // returns 2 if exact match, 1 if between, undefined otherwise
86
98
  export var withinDates = function withinDates(date, dates) {
87
99
  var result;
100
+ var rangePosition;
88
101
  if (dates) {
89
102
  if (Array.isArray(dates)) {
90
103
  dates.some(function (d) {
@@ -94,6 +107,7 @@ export var withinDates = function withinDates(date, dates) {
94
107
  }
95
108
  } else {
96
109
  result = betweenDates(date, d);
110
+ rangePosition = getRangePosition(date, d);
97
111
  }
98
112
  return result;
99
113
  });
@@ -101,7 +115,7 @@ export var withinDates = function withinDates(date, dates) {
101
115
  result = 2;
102
116
  }
103
117
  }
104
- return result;
118
+ return [result, rangePosition];
105
119
  };
106
120
  export var handleOffset = function handleOffset(date) {
107
121
  var normalizedDate = new Date(date);
@@ -156,7 +156,7 @@ var Carousel = function Carousel(_ref) {
156
156
  var iconColor = normalizeColor(theme.carousel.icons.color || 'control', theme);
157
157
  var selectors = [];
158
158
  var wrappedChildren = Children.map(children, function (child, index) {
159
- selectors.push( /*#__PURE__*/React.createElement(Button, {
159
+ selectors.push(/*#__PURE__*/React.createElement(Button, {
160
160
  a11yTitle: format({
161
161
  id: 'carousel.jump',
162
162
  values: {
@@ -475,7 +475,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
475
475
  }).join('-');
476
476
  var gradientId = uniqueGradientId + "-" + id + "-gradient";
477
477
  var maskId = uniqueGradientId + "-" + id + "-mask";
478
- defs.push( /*#__PURE__*/React.createElement("linearGradient", {
478
+ defs.push(/*#__PURE__*/React.createElement("linearGradient", {
479
479
  key: "gradientId",
480
480
  id: gradientId,
481
481
  x1: 0,
@@ -493,7 +493,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
493
493
  stopColor: normalizeColor(gradientColor, theme)
494
494
  });
495
495
  })));
496
- defs.push( /*#__PURE__*/React.createElement("mask", {
496
+ defs.push(/*#__PURE__*/React.createElement("mask", {
497
497
  key: "mask",
498
498
  id: maskId
499
499
  }, drawing));
@@ -552,7 +552,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
552
552
  strokeWidth: strokeWidth
553
553
  });
554
554
  }
555
- defs.push( /*#__PURE__*/React.createElement("pattern", {
555
+ defs.push(/*#__PURE__*/React.createElement("pattern", {
556
556
  key: patternId,
557
557
  id: patternId,
558
558
  width: _double,
@@ -1,4 +1,4 @@
1
- var _excluded = ["a11yTitle", "aria-label", "checked", "children", "defaultChecked", "disabled", "fill", "focus", "focusIndicator", "id", "label", "name", "onBlur", "onChange", "onFocus", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver", "pad", "reverse", "toggle", "indeterminate"];
1
+ var _excluded = ["a11yTitle", "aria-label", "checked", "children", "containerProps", "defaultChecked", "disabled", "fill", "focus", "focusIndicator", "id", "label", "name", "onBlur", "onChange", "onFocus", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver", "pad", "reverse", "toggle", "indeterminate"];
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, useEffect, useState } from 'react';
@@ -21,6 +21,7 @@ var CheckBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
21
  ariaLabel = _ref['aria-label'],
22
22
  checkedProp = _ref.checked,
23
23
  children = _ref.children,
24
+ containerProps = _ref.containerProps,
24
25
  _ref$defaultChecked = _ref.defaultChecked,
25
26
  defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
26
27
  disabled = _ref.disabled,
@@ -187,7 +188,7 @@ var CheckBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
187
188
  onMouseOut: function onMouseOut(event) {
188
189
  return _onMouseOut == null ? void 0 : _onMouseOut(event);
189
190
  }
190
- }, passThemeFlag, themeableProps), first, second);
191
+ }, passThemeFlag, themeableProps, containerProps), first, second);
191
192
  });
192
193
  CheckBox.displayName = 'CheckBox';
193
194
  CheckBox.propTypes = CheckBoxPropTypes;
@@ -75,7 +75,7 @@ var CheckBoxGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
75
75
  var checked = value.indexOf(valueOption) >= 0;
76
76
  var disabled = disabledProp || option.disabled;
77
77
  var key = label + "-" + valueOption;
78
- if (option.checked) console.warn( // eslint-disable-next-line max-len
78
+ if (option.checked) console.warn(// eslint-disable-next-line max-len
79
79
  "'checked' prop of an individual CheckBox shouldn't be used in a CheckBoxGroup component. Use the CheckBoxGroup 'value' prop instead.");
80
80
  // value shouldn't propagate the input field and the onChange option
81
81
  var omit = option.value,
@@ -65,7 +65,7 @@ var Element = function Element(_ref2) {
65
65
  number: ones
66
66
  })];
67
67
  if (sep) {
68
- result.unshift( /*#__PURE__*/React.createElement(StyledDigitalDigit, _extends({
68
+ result.unshift(/*#__PURE__*/React.createElement(StyledDigitalDigit, _extends({
69
69
  key: "sep",
70
70
  size: size
71
71
  }, passThemeFlag), ":"));
@@ -30,7 +30,7 @@ var buildQuery = function buildQuery(view) {
30
30
  return query;
31
31
  };
32
32
  var fetchLaunches = /*#__PURE__*/function () {
33
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
33
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
34
34
  var _view$sort, _view$sort2, _sort;
35
35
  var query, sort, body;
36
36
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -72,7 +72,7 @@ var fetchLaunches = /*#__PURE__*/function () {
72
72
  };
73
73
  }();
74
74
  var fetchRockets = /*#__PURE__*/function () {
75
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
75
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
76
76
  var body;
77
77
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
78
78
  while (1) switch (_context2.prev = _context2.next) {
@@ -29,7 +29,7 @@ var buildQuery = function buildQuery(view) {
29
29
  return query;
30
30
  };
31
31
  var fetchLaunches = /*#__PURE__*/function () {
32
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
32
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
33
33
  var _view$sort, _view$sort2, _sort;
34
34
  var query, sort, body;
35
35
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -72,7 +72,7 @@ var fetchLaunches = /*#__PURE__*/function () {
72
72
  };
73
73
  }();
74
74
  var fetchRockets = /*#__PURE__*/function () {
75
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
75
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
76
76
  var body;
77
77
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
78
78
  while (1) switch (_context2.prev = _context2.next) {
@@ -29,7 +29,7 @@ var buildQuery = function buildQuery(view) {
29
29
  return query;
30
30
  };
31
31
  var fetchLaunches = /*#__PURE__*/function () {
32
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
32
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
33
33
  var _view$sort, _view$sort2, _sort;
34
34
  var query, sort, body;
35
35
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -72,7 +72,7 @@ var fetchLaunches = /*#__PURE__*/function () {
72
72
  };
73
73
  }();
74
74
  var fetchRockets = /*#__PURE__*/function () {
75
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
75
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
76
76
  var body;
77
77
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
78
78
  while (1) switch (_context2.prev = _context2.next) {
@@ -9,7 +9,7 @@ import { Box, Data, List, Pagination } from 'grommet';
9
9
  var step = 10; // default for https://swapi.dev
10
10
 
11
11
  var fetchData = /*#__PURE__*/function () {
12
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(view, signal) {
12
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view, signal) {
13
13
  var params, url;
14
14
  return _regeneratorRuntime().wrap(function _callee$(_context) {
15
15
  while (1) switch (_context.prev = _context.next) {
@@ -135,7 +135,7 @@ export var DataFilter = function DataFilter(_ref) {
135
135
  var _properties$property4;
136
136
  var step =
137
137
  // from `range` on DataFilter
138
- (rangeProp == null ? void 0 : rangeProp.step) || ( // from range in Data `properties`
138
+ (rangeProp == null ? void 0 : rangeProp.step) || (// from range in Data `properties`
139
139
  properties == null || (_properties$property4 = properties[property]) == null || (_properties$property4 = _properties$property4.range) == null ? void 0 : _properties$property4.step);
140
140
  if (!step) {
141
141
  // avoid floating point issues where 4.4 - 2 returns 2.4000000000000004