@7shifts/sous-chef 2.4.0 → 2.6.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.
@@ -7,6 +7,8 @@ declare type Props = {
7
7
  onFocus: () => void;
8
8
  tabIndex: number;
9
9
  children: React.ReactNode;
10
+ showCalendar: boolean;
11
+ onClickOutside: () => void;
10
12
  };
11
13
  declare const DatePickerCalendar: React.FC<Props>;
12
14
  export default DatePickerCalendar;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
- import { WeekStart, DateRange } from '../../utils/date';
2
+ import { WeekStart, DateRange, BlockedDays } from '../../utils/date';
3
3
  declare type Props = {
4
4
  name: string;
5
5
  /** If not provided it will generate a random id so the label links properly with the text input */
6
6
  id?: string;
7
7
  value?: DateRange;
8
+ /** It disable some dates so the user can't click on them. Refer to this [doc](https://react-day-picker.js.org/api/types/matcher) to see what values you can use. */
9
+ disabledDays?: BlockedDays;
8
10
  /** Reference this for valid formats: https://date-fns.org/v2.18.0/docs/format */
9
11
  format?: string;
10
12
  onChange?: (e: DateRange) => void;
@@ -1,8 +1,9 @@
1
- import { WeekStart } from '../../../utils/date';
1
+ import { WeekStart, BlockedDays } from '../../../utils/date';
2
2
  declare type Props = {
3
3
  name: string;
4
4
  id: string;
5
5
  format: string;
6
+ disabledDays?: BlockedDays;
6
7
  start?: Date;
7
8
  end?: Date;
8
9
  placeholder: string;
@@ -12,5 +13,5 @@ declare type Props = {
12
13
  onChange: (e: Date) => void;
13
14
  onDayClick: () => void;
14
15
  };
15
- declare const FromDate: ({ name, id, format, start, end, placeholder, weekStart, disabled, readOnly, onChange, onDayClick }: Props) => JSX.Element;
16
+ declare const FromDate: ({ name, id, format, disabledDays, start, end, placeholder, weekStart, disabled, readOnly, onChange, onDayClick }: Props) => JSX.Element;
16
17
  export default FromDate;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import { WeekStart } from '../../../utils/date';
2
+ import { WeekStart, BlockedDays } from '../../../utils/date';
3
3
  declare type Props = {
4
4
  name: string;
5
5
  format: string;
6
+ disabledDays?: BlockedDays;
6
7
  start?: Date;
7
8
  end?: Date;
8
9
  placeholder: string;
@@ -10,6 +11,7 @@ declare type Props = {
10
11
  disabled?: boolean;
11
12
  readOnly: boolean;
12
13
  onChange: (e: Date) => void;
14
+ onBlur: () => void;
13
15
  };
14
16
  declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
15
17
  export default _default;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { IconSize } from '../types';
3
+ declare type Props = {
4
+ size?: IconSize;
5
+ color?: string;
6
+ } & React.SVGProps<SVGSVGElement>;
7
+ declare const IconBirthdayCake: {
8
+ (props: Props): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export default IconBirthdayCake;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { IconSize } from '../types';
3
+ declare type Props = {
4
+ size?: IconSize;
5
+ color?: string;
6
+ } & React.SVGProps<SVGSVGElement>;
7
+ declare const IconCalendarStar: {
8
+ (props: Props): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export default IconCalendarStar;
@@ -12,6 +12,7 @@ export { default as IconBan } from './IconBan';
12
12
  export { default as IconBarsH } from './IconBarsH';
13
13
  export { default as IconBarsV } from './IconBarsV';
14
14
  export { default as IconBell } from './IconBell';
15
+ export { default as IconBirthdayCake } from './IconBirthdayCake';
15
16
  export { default as IconBold } from './IconBold';
16
17
  export { default as IconBolt } from './IconBolt';
17
18
  export { default as IconBook } from './IconBook';
@@ -22,6 +23,7 @@ export { default as IconCalendarAlt } from './IconCalendarAlt';
22
23
  export { default as IconCalendarCheck } from './IconCalendarCheck';
23
24
  export { default as IconCalendarDay } from './IconCalendarDay';
24
25
  export { default as IconCalendarExclamation } from './IconCalendarExclamation';
26
+ export { default as IconCalendarStar } from './IconCalendarStar';
25
27
  export { default as IconCalendarTomorrow } from './IconCalendarTomorrow';
26
28
  export { default as IconCalendar } from './IconCalendar';
27
29
  export { default as IconCameraSlash } from './IconCameraSlash';
package/dist/index.css CHANGED
@@ -215,7 +215,7 @@ Please ask a designer if you have questions about which colours to use.
215
215
  }
216
216
  ._1iXKZ {
217
217
  background: #fff;
218
- color: #464646;
218
+ color: #555;
219
219
  }
220
220
  ._2K2Xx {
221
221
  font-weight: 600;
@@ -247,7 +247,7 @@ Please ask a designer if you have questions about which colours to use.
247
247
  }
248
248
  ._2LAWl {
249
249
  border-top-color: #fff;
250
- color: #464646;
250
+ color: #555;
251
251
  }
252
252
  /*********************************
253
253
  For new colours, see _colors.scss.
@@ -823,7 +823,7 @@ Please ask a designer if you have questions about which colours to use.
823
823
  font-weight: 600;
824
824
  font-family: "Proxima Nova", sans-serif;
825
825
  color: #555;
826
- padding: 19px 17px 8px 17px;
826
+ padding: 20px 17px 8px 17px;
827
827
  }
828
828
 
829
829
  ._27x4v {
@@ -1785,7 +1785,7 @@ Please ask a designer if you have questions about which colours to use.
1785
1785
  cursor: default;
1786
1786
  }
1787
1787
 
1788
- ._276GV {
1788
+ ._276GV:not(._3vJkw) {
1789
1789
  color: #c1c1c1;
1790
1790
  cursor: default;
1791
1791
  }
@@ -2003,7 +2003,7 @@ Please ask a designer if you have questions about which colours to use.
2003
2003
  cursor: default;
2004
2004
  }
2005
2005
 
2006
- ._CRqyX {
2006
+ ._CRqyX:not(._2pgnH) {
2007
2007
  color: #c1c1c1;
2008
2008
  cursor: default;
2009
2009
  }
@@ -2331,7 +2331,7 @@ Please ask a designer if you have questions about which colours to use.
2331
2331
  cursor: default;
2332
2332
  }
2333
2333
 
2334
- ._1PIJa {
2334
+ ._1PIJa:not(._1M4ZF) {
2335
2335
  color: #c1c1c1;
2336
2336
  cursor: default;
2337
2337
  }
package/dist/index.js CHANGED
@@ -974,6 +974,21 @@ var IconBell = function IconBell(props) {
974
974
 
975
975
  IconBell.displayName = 'IconBell';
976
976
 
977
+ var IconBirthdayCake = function IconBirthdayCake(props) {
978
+ return React__default.createElement("svg", Object.assign({
979
+ viewBox: "0 0 20 20",
980
+ fill: "none",
981
+ xmlns: "http://www.w3.org/2000/svg",
982
+ "data-testid": "icon-birthday-cake",
983
+ style: getIconStyles(props)
984
+ }, props), React__default.createElement("path", {
985
+ d: "M5 3.75c-.693 0-1.25-.557-1.25-1.25C3.75 1.29 5 1.602 5 0c.469 0 1.25 1.152 1.25 2.188C6.25 3.223 5.693 3.75 5 3.75Zm5 0c-.693 0-1.25-.557-1.25-1.25C8.75 1.29 10 1.602 10 0c.469 0 1.25 1.152 1.25 2.188 0 1.035-.557 1.562-1.25 1.562Zm5 0c-.693 0-1.25-.557-1.25-1.25C13.75 1.29 15 1.602 15 0c.469 0 1.25 1.152 1.25 2.188 0 1.035-.557 1.562-1.25 1.562ZM16.875 10h-1.25V4.375h-1.25V10h-3.75V4.375h-1.25V10h-3.75V4.375h-1.25V10h-1.25c-1.035 0-1.875.84-1.875 1.875V20h17.5v-8.125c0-1.035-.84-1.875-1.875-1.875Zm.625 8.75h-15v-2.814c.634-.37.935-.936 1.67-.936 1.092 0 1.22 1.25 2.92 1.25C8.763 16.25 8.934 15 10 15c1.1 0 1.219 1.25 2.92 1.25 1.694 0 1.827-1.25 2.92-1.25.722 0 1.025.565 1.66.936v2.814Zm0-4.39c-.376-.307-.829-.61-1.66-.61-1.697 0-1.83 1.25-2.92 1.25-1.082 0-1.229-1.25-2.92-1.25-1.674 0-1.844 1.25-2.91 1.25-1.1 0-1.219-1.25-2.92-1.25-.838 0-1.293.304-1.67.612v-2.487c0-.345.28-.625.625-.625h13.75c.345 0 .625.28.625.625v2.485Z",
986
+ fill: "currentColor"
987
+ }));
988
+ };
989
+
990
+ IconBirthdayCake.displayName = 'IconBirthdayCake';
991
+
977
992
  var IconBold = function IconBold(props) {
978
993
  return React__default.createElement("svg", Object.assign({
979
994
  viewBox: "0 0 20 20",
@@ -1149,6 +1164,21 @@ var IconCalendarExclamation = function IconCalendarExclamation(props) {
1149
1164
 
1150
1165
  IconCalendarExclamation.displayName = 'IconCalendarExclamation';
1151
1166
 
1167
+ var IconCalendarStar = function IconCalendarStar(props) {
1168
+ return React__default.createElement("svg", Object.assign({
1169
+ viewBox: "0 0 20 20",
1170
+ fill: "none",
1171
+ xmlns: "http://www.w3.org/2000/svg",
1172
+ "data-testid": "icon-calendar-star",
1173
+ style: getIconStyles(props)
1174
+ }, props), React__default.createElement("path", {
1175
+ d: "m6.952 14.406-.325 1.808c-.074.414.103.824.461 1.07a1.186 1.186 0 0 0 1.211.082l1.71-.851 1.71.85a1.2 1.2 0 0 0 1.215-.081c.358-.246.536-.656.461-1.07l-.325-1.808 1.38-1.276c.317-.293.428-.723.292-1.12a1.127 1.127 0 0 0-.93-.743l-1.912-.265-.853-1.644a1.166 1.166 0 0 0-1.038-.613c-.44 0-.836.235-1.03.61l-.853 1.643-1.911.266a1.127 1.127 0 0 0-.931.741c-.136.398-.025.828.292 1.12l1.376 1.281Zm2.044-2.268 1.013-1.948 1.014 1.948 2.265.312-1.64 1.52.388 2.139-2.027-1.008-2.027 1.011.387-2.139-1.64-1.519 2.267-.316Zm8.263-9.64h-1.977V.313a.322.322 0 0 0-.33-.312h-.659c-.18 0-.33.14-.33.312V2.5H6.055V.312A.322.322 0 0 0 5.724 0h-.658c-.182 0-.33.14-.33.312V2.5H2.759C1.667 2.499.78 3.338.78 4.373v13.742c0 1.035.886 1.874 1.978 1.874h14.5c1.092 0 1.978-.84 1.978-1.874V4.373c0-1.035-.886-1.874-1.977-1.874Zm.66 15.617c0 .344-.297.625-.66.625H2.76c-.363 0-.66-.281-.66-.625V7.496h15.82v10.62Zm0-11.868H2.099V4.373c0-.344.297-.625.66-.625h14.5c.363 0 .66.281.66.625v1.874Z",
1176
+ fill: "currentColor"
1177
+ }));
1178
+ };
1179
+
1180
+ IconCalendarStar.displayName = 'IconCalendarStar';
1181
+
1152
1182
  var IconCalendarTomorrow = function IconCalendarTomorrow(props) {
1153
1183
  return React__default.createElement("svg", Object.assign({
1154
1184
  viewBox: "0 0 20 20",
@@ -3412,7 +3442,7 @@ var DataTable = function DataTable(_ref) {
3412
3442
  numberOfRows: numberOfRows,
3413
3443
  hasVerticalBorders: hasVerticalBorders
3414
3444
  }
3415
- }, React__default.createElement("div", null, columns && React__default.createElement(DataTableHeader, {
3445
+ }, columns && React__default.createElement(DataTableHeader, {
3416
3446
  columns: columns,
3417
3447
  onSort: onSort,
3418
3448
  showActionMenu: showActionMenu
@@ -3440,7 +3470,7 @@ var DataTable = function DataTable(_ref) {
3440
3470
  hasNext: hasNext && !isLoading,
3441
3471
  onPreviousClick: onPreviousClick,
3442
3472
  onNextClick: onNextClick
3443
- }))));
3473
+ })));
3444
3474
  };
3445
3475
 
3446
3476
  var DefaultItemComponent$1 = function DefaultItemComponent(_ref2) {
@@ -5087,8 +5117,17 @@ var DatePickerCalendar = function DatePickerCalendar(_ref) {
5087
5117
  children = _ref.children,
5088
5118
  onBlur = _ref.onBlur,
5089
5119
  onFocus = _ref.onFocus,
5090
- tabIndex = _ref.tabIndex;
5120
+ tabIndex = _ref.tabIndex,
5121
+ showCalendar = _ref.showCalendar,
5122
+ onClickOutside = _ref.onClickOutside;
5091
5123
  var inputPosition = inputNode.getBoundingClientRect();
5124
+ var calendarRef = React.useRef(null);
5125
+ useOnClickOutside(calendarRef, onClickOutside);
5126
+
5127
+ if (!showCalendar) {
5128
+ return null;
5129
+ }
5130
+
5092
5131
  return React__default.createElement(Portal, null, React__default.createElement("div", {
5093
5132
  className: classNames.overlayWrapper,
5094
5133
  onBlur: onBlur,
@@ -5098,7 +5137,8 @@ var DatePickerCalendar = function DatePickerCalendar(_ref) {
5098
5137
  zIndex: 9999,
5099
5138
  left: inputPosition.left,
5100
5139
  top: inputPosition.top + window.scrollY + inputPosition.height + 3
5101
- }
5140
+ },
5141
+ ref: calendarRef
5102
5142
  }, React__default.createElement("div", {
5103
5143
  className: classNames.overlay
5104
5144
  }, children)));
@@ -5168,6 +5208,11 @@ var DateField = function DateField(_ref) {
5168
5208
  _ref$readOnly = _ref.readOnly,
5169
5209
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
5170
5210
  var inputRef = React.useRef();
5211
+
5212
+ var _useState = React.useState(false),
5213
+ showCalendar = _useState[0],
5214
+ setShowCalendar = _useState[1];
5215
+
5171
5216
  var controllers = useDateFieldControllers({
5172
5217
  name: name,
5173
5218
  id: inputId,
@@ -5209,10 +5254,17 @@ var DateField = function DateField(_ref) {
5209
5254
  defaultValue: defaultValue,
5210
5255
  value: controllers.value || '',
5211
5256
  onDayChange: controllers.onChange,
5212
- onDayPickerHide: controllers.onBlur,
5257
+ onDayPickerHide: function onDayPickerHide() {
5258
+ controllers.onBlur();
5259
+ setShowCalendar(false);
5260
+ },
5213
5261
  overlayComponent: function overlayComponent(props) {
5214
5262
  return React__default.createElement(DatePickerCalendar, Object.assign({}, props, {
5215
- inputNode: inputRef.current
5263
+ inputNode: inputRef.current,
5264
+ showCalendar: showCalendar,
5265
+ onClickOutside: function onClickOutside() {
5266
+ return setShowCalendar(false);
5267
+ }
5216
5268
  }));
5217
5269
  },
5218
5270
  dayPickerProps: dayPickerProps,
@@ -5226,7 +5278,13 @@ var DateField = function DateField(_ref) {
5226
5278
  autoComplete: 'off',
5227
5279
  ref: inputRef,
5228
5280
  readOnly: readOnly,
5229
- disabled: disabled
5281
+ disabled: disabled,
5282
+ onFocus: function onFocus() {
5283
+ return setShowCalendar(true);
5284
+ }
5285
+ },
5286
+ onDayPickerShow: function onDayPickerShow() {
5287
+ return setShowCalendar(true);
5230
5288
  }
5231
5289
  })));
5232
5290
  };
@@ -5264,7 +5322,7 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
5264
5322
 
5265
5323
  if (formik && formikState) {
5266
5324
  return _extends({}, initialControllers, {
5267
- error: error !== undefined ? initialControllers.error : formikState.error,
5325
+ error: error !== undefined ? initialControllers.error : getFormikError(formikState.error),
5268
5326
  value: value !== undefined ? initialControllers.value : formikState.value,
5269
5327
  onChange: _onChange ? initialControllers.onChange : function (newValue) {
5270
5328
  formik.setFieldValue(name, newValue === undefined ? null : newValue);
@@ -5278,12 +5336,33 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
5278
5336
  return initialControllers;
5279
5337
  };
5280
5338
 
5339
+ var getFormikError = function getFormikError(error) {
5340
+ if (!error) {
5341
+ return undefined;
5342
+ }
5343
+
5344
+ if (typeof error === 'string') {
5345
+ return error;
5346
+ }
5347
+
5348
+ if (error.start) {
5349
+ return error.start;
5350
+ }
5351
+
5352
+ if (error.end) {
5353
+ return error.end;
5354
+ }
5355
+
5356
+ return undefined;
5357
+ };
5358
+
5281
5359
  var styles$s = {"container":"_1Ini2","wrapper":"_21VnL","interactionDisabled":"_wJ6Cb","DayPicker-Day":"_1c48y","navBar":"_3KwsN","todayButton":"_10CBO","navButtonInteractionDisabled":"_dHL-D","navButtonPrev":"_6kNi3","navButtonNext":"_13W_e","months":"_1FeSY","month":"_wU6A4","caption":"_AMbAo","weekdays":"_1LEst","weekdaysRow":"_2XECo","weekday":"_1C5ry","body":"_11F-Y","week":"_3MAFk","day":"_mG73F","disabled":"_2pgnH","selected":"_MtLaz","outside":"_CRqyX","footer":"_2KG9-","today":"_2JA2y","overlayWrapper":"_1JWbc","overlay":"_2tL6g","weekNumber":"_3u72O","text-field":"_25rf7","date-range-field":"_3qVhi","text-field--invalid":"_2M9Ud","text-field--prefixed":"_3TUb2","text-field--suffixed":"_foqL0","date-range-field--invalid":"_3df9R","date-range-field--disabled":"_2Nkht"};
5282
5360
 
5283
5361
  var FromDate = function FromDate(_ref) {
5284
5362
  var name = _ref.name,
5285
5363
  id = _ref.id,
5286
5364
  format = _ref.format,
5365
+ disabledDays = _ref.disabledDays,
5287
5366
  start = _ref.start,
5288
5367
  end = _ref.end,
5289
5368
  placeholder = _ref.placeholder,
@@ -5291,12 +5370,29 @@ var FromDate = function FromDate(_ref) {
5291
5370
  disabled = _ref.disabled,
5292
5371
  readOnly = _ref.readOnly,
5293
5372
  onChange = _ref.onChange,
5294
- onDayClick = _ref.onDayClick;
5373
+ _onDayClick = _ref.onDayClick;
5374
+
5375
+ var _useState = React.useState(false),
5376
+ showCalendar = _useState[0],
5377
+ setShowCalendar = _useState[1];
5378
+
5295
5379
  var inputRef = React.useRef();
5296
5380
  var modifiers = {
5297
5381
  from: start,
5298
5382
  to: end
5299
5383
  };
5384
+ var disabledDaysChecks = end ? [{
5385
+ after: end
5386
+ }] : [];
5387
+
5388
+ if (disabledDays) {
5389
+ if (Array.isArray(disabledDays)) {
5390
+ disabledDaysChecks.push.apply(disabledDaysChecks, disabledDays);
5391
+ } else {
5392
+ disabledDaysChecks.push(disabledDays);
5393
+ }
5394
+ }
5395
+
5300
5396
  var dayPickerProps = {
5301
5397
  classNames: styles$s,
5302
5398
  months: MONTH_NAMES,
@@ -5310,12 +5406,18 @@ var FromDate = function FromDate(_ref) {
5310
5406
  from: start,
5311
5407
  to: end
5312
5408
  }],
5313
- disabledDays: {
5314
- after: end
5315
- },
5409
+ disabledDays: disabledDaysChecks,
5316
5410
  toMonth: end,
5317
5411
  modifiers: modifiers,
5318
- onDayClick: onDayClick
5412
+ onDayClick: function onDayClick(_, activeModifiers) {
5413
+ var isDateDisabled = Object.keys(activeModifiers).find(function (modifier) {
5414
+ return modifier;
5415
+ });
5416
+
5417
+ if (!Boolean(isDateDisabled)) {
5418
+ _onDayClick();
5419
+ }
5420
+ }
5319
5421
  };
5320
5422
  return React__default.createElement(DayPickerInput, {
5321
5423
  format: format,
@@ -5326,9 +5428,16 @@ var FromDate = function FromDate(_ref) {
5326
5428
  parseDate: parseDate,
5327
5429
  placeholder: placeholder,
5328
5430
  onDayChange: onChange,
5431
+ onDayPickerHide: function onDayPickerHide() {
5432
+ return setShowCalendar(false);
5433
+ },
5329
5434
  overlayComponent: function overlayComponent(props) {
5330
5435
  return React__default.createElement(DatePickerCalendar, Object.assign({}, props, {
5331
- inputNode: inputRef.current
5436
+ inputNode: inputRef.current,
5437
+ showCalendar: showCalendar,
5438
+ onClickOutside: function onClickOutside() {
5439
+ return setShowCalendar(false);
5440
+ }
5332
5441
  }));
5333
5442
  },
5334
5443
  dayPickerProps: dayPickerProps,
@@ -5340,7 +5449,13 @@ var FromDate = function FromDate(_ref) {
5340
5449
  readOnly: readOnly,
5341
5450
  disabled: disabled,
5342
5451
  'data-testid': "range-picker-field-from-" + name,
5343
- type: 'text'
5452
+ type: 'text',
5453
+ onFocus: function onFocus() {
5454
+ return setShowCalendar(true);
5455
+ }
5456
+ },
5457
+ onDayPickerShow: function onDayPickerShow() {
5458
+ return setShowCalendar(true);
5344
5459
  }
5345
5460
  });
5346
5461
  };
@@ -5348,17 +5463,36 @@ var FromDate = function FromDate(_ref) {
5348
5463
  var ToDate = function ToDate(_ref, ref) {
5349
5464
  var name = _ref.name,
5350
5465
  format = _ref.format,
5466
+ disabledDays = _ref.disabledDays,
5351
5467
  start = _ref.start,
5352
5468
  end = _ref.end,
5353
5469
  placeholder = _ref.placeholder,
5354
5470
  weekStart = _ref.weekStart,
5355
5471
  disabled = _ref.disabled,
5356
5472
  readOnly = _ref.readOnly,
5357
- onChange = _ref.onChange;
5473
+ onChange = _ref.onChange,
5474
+ _onBlur = _ref.onBlur;
5475
+
5476
+ var _useState = React.useState(false),
5477
+ showCalendar = _useState[0],
5478
+ setShowCalendar = _useState[1];
5479
+
5358
5480
  var modifiers = {
5359
5481
  from: start,
5360
5482
  to: end
5361
5483
  };
5484
+ var disabledDaysChecks = start ? [{
5485
+ before: start
5486
+ }] : [];
5487
+
5488
+ if (disabledDays) {
5489
+ if (Array.isArray(disabledDays)) {
5490
+ disabledDaysChecks.push.apply(disabledDaysChecks, disabledDays);
5491
+ } else {
5492
+ disabledDaysChecks.push(disabledDays);
5493
+ }
5494
+ }
5495
+
5362
5496
  var dayPickerProps = {
5363
5497
  classNames: styles$s,
5364
5498
  months: MONTH_NAMES,
@@ -5372,9 +5506,7 @@ var ToDate = function ToDate(_ref, ref) {
5372
5506
  from: start,
5373
5507
  to: end
5374
5508
  }],
5375
- disabledDays: {
5376
- before: start
5377
- },
5509
+ disabledDays: disabledDaysChecks,
5378
5510
  modifiers: modifiers,
5379
5511
  month: end || start,
5380
5512
  fromMonth: start
@@ -5388,9 +5520,16 @@ var ToDate = function ToDate(_ref, ref) {
5388
5520
  parseDate: parseDate,
5389
5521
  placeholder: placeholder,
5390
5522
  onDayChange: onChange,
5523
+ onDayPickerHide: function onDayPickerHide() {
5524
+ return setShowCalendar(false);
5525
+ },
5391
5526
  overlayComponent: function overlayComponent(props) {
5392
5527
  return React__default.createElement(DatePickerCalendar, Object.assign({}, props, {
5393
- inputNode: ref === null || ref === void 0 ? void 0 : ref.current
5528
+ inputNode: ref === null || ref === void 0 ? void 0 : ref.current,
5529
+ showCalendar: showCalendar,
5530
+ onClickOutside: function onClickOutside() {
5531
+ return setShowCalendar(false);
5532
+ }
5394
5533
  }));
5395
5534
  },
5396
5535
  dayPickerProps: dayPickerProps,
@@ -5401,7 +5540,16 @@ var ToDate = function ToDate(_ref, ref) {
5401
5540
  readOnly: readOnly,
5402
5541
  disabled: disabled,
5403
5542
  'data-testid': "range-picker-field-to-" + name,
5404
- type: 'text'
5543
+ type: 'text',
5544
+ onFocus: function onFocus() {
5545
+ return setShowCalendar(true);
5546
+ },
5547
+ onBlur: function onBlur() {
5548
+ setTimeout(_onBlur, 200);
5549
+ }
5550
+ },
5551
+ onDayPickerShow: function onDayPickerShow() {
5552
+ return setShowCalendar(true);
5405
5553
  }
5406
5554
  });
5407
5555
  };
@@ -5409,11 +5557,12 @@ var ToDate = function ToDate(_ref, ref) {
5409
5557
  var ToDate$1 = React.forwardRef(ToDate);
5410
5558
 
5411
5559
  var DateRangeField = function DateRangeField(_ref) {
5412
- var _classnames, _classnames2;
5560
+ var _classnames;
5413
5561
 
5414
5562
  var name = _ref.name,
5415
5563
  inputId = _ref.id,
5416
5564
  value = _ref.value,
5565
+ disabledDays = _ref.disabledDays,
5417
5566
  _ref$format = _ref.format,
5418
5567
  format = _ref$format === void 0 ? 'MM/dd/yyyy' : _ref$format,
5419
5568
  onChange = _ref.onChange,
@@ -5448,7 +5597,7 @@ var DateRangeField = function DateRangeField(_ref) {
5448
5597
  start = _controllers$value.start,
5449
5598
  end = _controllers$value.end;
5450
5599
  return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
5451
- className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames), (_classnames2 = {}, _classnames2[styles$s['date-range-field--disabled']] = disabled, _classnames2))
5600
+ className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames[styles$s['date-range-field--disabled']] = disabled, _classnames))
5452
5601
  }, React__default.createElement(IconCalendarAlt, {
5453
5602
  size: "medium",
5454
5603
  color: GREY400
@@ -5461,6 +5610,7 @@ var DateRangeField = function DateRangeField(_ref) {
5461
5610
  placeholder: placeholder || format.toUpperCase(),
5462
5611
  weekStart: weekStart,
5463
5612
  disabled: disabled,
5613
+ disabledDays: disabledDays,
5464
5614
  readOnly: readOnly,
5465
5615
  onChange: function onChange(val) {
5466
5616
  return controllers.onChange({
@@ -5484,7 +5634,9 @@ var DateRangeField = function DateRangeField(_ref) {
5484
5634
  placeholder: placeholder || format.toUpperCase(),
5485
5635
  weekStart: weekStart,
5486
5636
  disabled: disabled,
5637
+ disabledDays: disabledDays,
5487
5638
  readOnly: readOnly,
5639
+ onBlur: controllers.onBlur,
5488
5640
  onChange: function onChange(val) {
5489
5641
  return controllers.onChange({
5490
5642
  start: start,
@@ -5524,6 +5676,10 @@ var WeekField = function WeekField(_ref) {
5524
5676
  hoverDate = _useState[0],
5525
5677
  setHoverDate = _useState[1];
5526
5678
 
5679
+ var _useState2 = React.useState(false),
5680
+ showCalendar = _useState2[0],
5681
+ setShowCalendar = _useState2[1];
5682
+
5527
5683
  var inputRef = React.useRef();
5528
5684
  var controllers = useDateFieldControllers({
5529
5685
  name: name,
@@ -5606,7 +5762,11 @@ var WeekField = function WeekField(_ref) {
5606
5762
  onDayPickerHide: controllers.onBlur,
5607
5763
  overlayComponent: function overlayComponent(props) {
5608
5764
  return React__default.createElement(DatePickerCalendar, Object.assign({}, props, {
5609
- inputNode: inputRef.current
5765
+ inputNode: inputRef.current,
5766
+ showCalendar: showCalendar,
5767
+ onClickOutside: function onClickOutside() {
5768
+ return setShowCalendar(false);
5769
+ }
5610
5770
  }));
5611
5771
  },
5612
5772
  dayPickerProps: dayPickerProps,
@@ -5620,7 +5780,13 @@ var WeekField = function WeekField(_ref) {
5620
5780
  autoComplete: 'off',
5621
5781
  ref: inputRef,
5622
5782
  readOnly: readOnly,
5623
- disabled: disabled
5783
+ disabled: disabled,
5784
+ onFocus: function onFocus() {
5785
+ return setShowCalendar(true);
5786
+ }
5787
+ },
5788
+ onDayPickerShow: function onDayPickerShow() {
5789
+ return setShowCalendar(true);
5624
5790
  }
5625
5791
  })));
5626
5792
  };
@@ -5990,6 +6156,7 @@ exports.IconBan = IconBan;
5990
6156
  exports.IconBarsH = IconBarsH;
5991
6157
  exports.IconBarsV = IconBarsV;
5992
6158
  exports.IconBell = IconBell;
6159
+ exports.IconBirthdayCake = IconBirthdayCake;
5993
6160
  exports.IconBold = IconBold;
5994
6161
  exports.IconBolt = IconBolt;
5995
6162
  exports.IconBook = IconBook;
@@ -6001,6 +6168,7 @@ exports.IconCalendarAlt = IconCalendarAlt;
6001
6168
  exports.IconCalendarCheck = IconCalendarCheck;
6002
6169
  exports.IconCalendarDay = IconCalendarDay;
6003
6170
  exports.IconCalendarExclamation = IconCalendarExclamation;
6171
+ exports.IconCalendarStar = IconCalendarStar;
6004
6172
  exports.IconCalendarTomorrow = IconCalendarTomorrow;
6005
6173
  exports.IconCamera = IconCamera;
6006
6174
  exports.IconCameraSlash = IconCameraSlash;