@7shifts/sous-chef 2.1.1 → 2.3.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.
@@ -15,7 +15,9 @@ declare type Props<T> = {
15
15
  placeholder?: string;
16
16
  disabled?: boolean;
17
17
  closeOnSelect?: boolean;
18
+ /** When the user opens the menu, if this prop is `true`, it will scroll the page into to the menu view (if its content falls under a scroll). It is recomended to disable this behaviour when using the `MultiSelectField` inside a modal. */
19
+ menuShouldScrollIntoView?: boolean;
18
20
  };
19
21
  /** Component to make possible choose from a predefined options. */
20
- declare const MultiSelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, label, caption, error, placeholder, disabled, closeOnSelect }: Props<T>) => JSX.Element;
22
+ declare const MultiSelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, label, caption, error, placeholder, disabled, closeOnSelect, menuShouldScrollIntoView }: Props<T>) => JSX.Element;
21
23
  export default MultiSelectField;
@@ -18,7 +18,9 @@ declare type Props<T> = {
18
18
  /** Use a prefix for things like currency symbols (“$”, “¥”, “£”) or icons. */
19
19
  prefix?: React.ReactNode;
20
20
  asToolbarFilter?: boolean;
21
+ /** When the user opens the menu, if this prop is `true`, it will scroll the page into to the menu view (if its content falls under a scroll). It is recomended to disable this behaviour when using the `SelectField` inside a modal. */
22
+ menuShouldScrollIntoView?: boolean;
21
23
  };
22
24
  /** Component to make possible choose from a predefined options. */
23
- declare const SelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, SelectedOptionPrefix, label, caption, error, placeholder, disabled, prefix, asToolbarFilter }: Props<T>) => JSX.Element;
25
+ declare const SelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, SelectedOptionPrefix, label, caption, error, placeholder, disabled, prefix, asToolbarFilter, menuShouldScrollIntoView }: Props<T>) => JSX.Element;
24
26
  export default SelectField;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  declare type AutoCompleteType = 'off' | 'on';
3
- declare type Props = {
3
+ export declare type Props = {
4
4
  autoComplete?: AutoCompleteType;
5
5
  autoFocus?: boolean;
6
6
  caption?: React.ReactNode;
@@ -0,0 +1,38 @@
1
+ /// <reference types="react" />
2
+ import { RefType } from '../../utils/types';
3
+ import type { Props } from './TextField';
4
+ declare type UseTextFieldProps = Props & {
5
+ ref: RefType<HTMLInputElement>;
6
+ };
7
+ export declare const useTextField: ({ autoComplete, autoFocus, defaultValue, disabled, error, id, maxLength, name, caption, label, onBlur, onChange, onFocus, onKeyDown, placeholder, value, ref }: UseTextFieldProps) => {
8
+ inputProps: {
9
+ 'aria-describedby': string;
10
+ 'aria-invalid': boolean;
11
+ autoComplete: "on" | "off" | undefined;
12
+ autoFocus: boolean | undefined;
13
+ className: string;
14
+ 'data-testid': string;
15
+ disabled: boolean | undefined;
16
+ defaultValue: string | undefined;
17
+ id: string;
18
+ maxLength: number | undefined;
19
+ name: string;
20
+ onBlur: (e: import("react").ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
21
+ onChange: (e: import("react").ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
22
+ onFocus: (e: import("react").FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
23
+ onKeyDown: (e: import("react").KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
24
+ placeholder: string | undefined;
25
+ ref: RefType<HTMLInputElement>;
26
+ size: number;
27
+ type: string;
28
+ value: string | undefined;
29
+ };
30
+ fieldProps: {
31
+ caption: import("react").ReactNode;
32
+ error: string | undefined;
33
+ label: import("react").ReactNode;
34
+ id: string;
35
+ name: string;
36
+ };
37
+ };
38
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Props as TextFieldProps } from '../TextField/TextField';
3
+ /**
4
+ * `TimeField` are like `TextField` but it auto-format the value when the user leaves the field.
5
+ *
6
+ * At the end, it is just a string formatted nicely. **You are in charge of validating the value and parsing it back to a value that you can use on your application**.
7
+ */
8
+ declare const TimeField: React.ForwardRefExoticComponent<Pick<TextFieldProps, "disabled" | "id" | "caption" | "label" | "error" | "onChange" | "name" | "value" | "onBlur" | "placeholder" | "autoFocus" | "onFocus" | "onKeyDown" | "defaultValue" | "autoComplete" | "maxLength"> & React.RefAttributes<HTMLInputElement>>;
9
+ export default TimeField;
@@ -0,0 +1 @@
1
+ export { default } from './TimeField';
@@ -12,7 +12,8 @@ import SelectField from './SelectField';
12
12
  import DateField from './DateField';
13
13
  import DateRangeField from './DateRangeField';
14
14
  import WeekField from './WeekField';
15
- export { Form, FormRow, TextAreaField, TextField, CheckboxField, PillSelectField, RadioGroupField, RadioGroupOption, PasswordField, MultiSelectField, SelectField, DateField, DateRangeField, WeekField, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT };
15
+ import TimeField from './TimeField';
16
+ export { Form, FormRow, TextAreaField, TextField, CheckboxField, PillSelectField, RadioGroupField, RadioGroupOption, PasswordField, MultiSelectField, SelectField, DateField, DateRangeField, WeekField, TimeField, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT };
16
17
  export type { PasswordCriteria } from './PasswordField/types';
17
18
  export type { SelectOption, SelectOptions } from './SelectField/types';
18
19
  export type { FormikType } from './Form/types';
@@ -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 IconGavel: {
8
+ (props: Props): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export default IconGavel;
@@ -56,6 +56,7 @@ export { default as IconFile } from './IconFile';
56
56
  export { default as IconFlag } from './IconFlag';
57
57
  export { default as IconFourDotsCircle } from './IconFourDotsCircle';
58
58
  export { default as IconFourSquares } from './IconFourSquares';
59
+ export { default as IconGavel } from './IconGavel';
59
60
  export { default as IconGift } from './IconGift';
60
61
  export { default as IconGrinBeam } from './IconGrinBeam';
61
62
  export { default as IconGripVertical } from './IconGripVertical';
package/dist/index.css CHANGED
@@ -1571,6 +1571,7 @@ Please ask a designer if you have questions about which colours to use.
1571
1571
  ._1Sc9D {
1572
1572
  padding-top: 8px;
1573
1573
  padding-bottom: 6px;
1574
+ width: 100%;
1574
1575
  }
1575
1576
  /*********************************
1576
1577
  For new colours, see _colors.scss.
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ var dateFnsFormat = _interopDefault(require('date-fns/format'));
12
12
  var dateFnsParse = _interopDefault(require('date-fns/parse'));
13
13
  var startOfDay = _interopDefault(require('date-fns/startOfDay'));
14
14
  var eachDayOfInterval = _interopDefault(require('date-fns/eachDayOfInterval'));
15
+ var parseTime = _interopDefault(require('time-autocomplete/src/core/AMPMParser'));
15
16
  var ReactModal = _interopDefault(require('react-modal'));
16
17
 
17
18
  function _extends() {
@@ -239,8 +240,8 @@ var updateMisalignedOverlay = function updateMisalignedOverlay(overlayPosition,
239
240
  if (overlayPosition.left > arrowPosition.left) {
240
241
  left = arrowPosition.left - ARROW_MARGIN;
241
242
  } else if (overlayPosition.left + tooltipRectPosition.width < arrowPosition.left + ARROW_WIDTH) {
242
- left = arrowPosition.left - tooltipRectPosition.width + ARROW_WIDTH + ARROW_MARGIN;
243
- }
243
+ left = arrowPosition.left - tooltipRectPosition.width + ARROW_WIDTH + ARROW_MARGIN;
244
+ }
244
245
 
245
246
  return _extends({}, overlayPosition, {
246
247
  left: left
@@ -1784,6 +1785,21 @@ var IconFourSquares = function IconFourSquares(props) {
1784
1785
 
1785
1786
  IconFourSquares.displayName = 'IconFourSquares';
1786
1787
 
1788
+ var IconGavel = function IconGavel(props) {
1789
+ return React__default.createElement("svg", Object.assign({
1790
+ viewBox: "0 0 60 60",
1791
+ fill: "none",
1792
+ xmlns: "http://www.w3.org/2000/svg",
1793
+ "data-testid": "icon-gavel",
1794
+ style: getIconStyles(props)
1795
+ }, props), React__default.createElement("path", {
1796
+ d: "m58.698 21.863-2.418-2.42a4.442 4.442 0 0 0-5.476-.638l-9.61-9.609a4.442 4.442 0 0 0-.638-5.476l-2.418-2.418a4.438 4.438 0 0 0-6.28 0L18.551 14.605a4.446 4.446 0 0 0 0 6.28l2.42 2.42a4.448 4.448 0 0 0 5.475.637l3.48 3.48-6.891 6.89-.947-.946a5.095 5.095 0 0 0-7.198 0l-13.403 13.4a5.095 5.095 0 0 0 0 7.198l4.548 4.548a5.095 5.095 0 0 0 7.197 0l13.401-13.403a5.095 5.095 0 0 0 0-7.198l-.947-.947 6.891-6.89 3.48 3.479a4.449 4.449 0 0 0 .637 5.476l2.42 2.419a4.446 4.446 0 0 0 6.28 0l13.303-13.305a4.439 4.439 0 0 0 0-6.28ZM23.983 42.457l-13.401 13.4a1.34 1.34 0 0 1-1.894 0l-4.546-4.545a1.34 1.34 0 0 1 0-1.894l13.401-13.4a1.34 1.34 0 0 1 1.894 0l4.546 4.545a1.341 1.341 0 0 1 0 1.894Zm32.065-16.966L42.743 38.796a.69.69 0 0 1-.977 0l-2.42-2.42a.691.691 0 0 1 0-.976l1.932-1.93L26.53 18.721l-1.93 1.931a.692.692 0 0 1-.978 0l-2.419-2.419a.692.692 0 0 1 0-.977L34.51 3.952a.691.691 0 0 1 .977 0l2.419 2.42a.691.691 0 0 1 0 .976l-1.93 1.931L50.72 24.026l1.931-1.93a.69.69 0 0 1 .977 0l2.419 2.418a.692.692 0 0 1 0 .977Z",
1797
+ fill: "currentColor"
1798
+ }));
1799
+ };
1800
+
1801
+ IconGavel.displayName = 'IconGavel';
1802
+
1787
1803
  var IconGift = function IconGift(props) {
1788
1804
  return React__default.createElement("svg", Object.assign({
1789
1805
  viewBox: "0 0 20 20",
@@ -1807,9 +1823,6 @@ var IconGrinBeam = function IconGrinBeam(props) {
1807
1823
  "data-testid": "icon-grin-beam",
1808
1824
  style: getIconStyles(props)
1809
1825
  }, props), React__default.createElement("path", {
1810
- fill: "#fff",
1811
- d: "M0 0h20v20H0z"
1812
- }), React__default.createElement("path", {
1813
1826
  d: "M4.746 9.676a.335.335 0 0 0 .375-.145l.383-.664c.31-.535.774-.844 1.27-.844s.96.309 1.27.844l.383.664c.085.145.25.184.375.145a.314.314 0 0 0 .23-.324c-.133-1.645-1.298-2.79-2.258-2.79S4.65 7.707 4.516 9.352a.317.317 0 0 0 .23.324Zm6.452 0a.335.335 0 0 0 .375-.145l.383-.664c.31-.535.774-.844 1.27-.844s.96.309 1.27.844l.383.664c.085.145.25.184.375.145a.314.314 0 0 0 .23-.324c-.133-1.645-1.299-2.79-2.258-2.79-.96 0-2.125 1.145-2.258 2.79a.317.317 0 0 0 .23.324Zm3.766 2.855c-1.218.38-3.029.594-4.964.594-1.935 0-3.746-.215-4.964-.594a.662.662 0 0 0-.617.121.62.62 0 0 0-.213.579c.37 2.148 3.354 3.644 5.798 3.644s5.423-1.496 5.798-3.645a.624.624 0 0 0-.213-.578.66.66 0 0 0-.625-.12ZM10 15.625c-1.411 0-3.105-.637-3.972-1.574 2.319.422 5.63.422 7.948 0-.871.937-2.565 1.574-3.976 1.574ZM10 .312C4.476.313 0 4.649 0 10s4.476 9.688 10 9.688S20 15.351 20 10 15.524.312 10 .312Zm0 18.125c-4.802 0-8.71-3.785-8.71-8.437 0-4.652 3.908-8.438 8.71-8.438 4.802 0 8.71 3.786 8.71 8.438 0 4.652-3.908 8.438-8.71 8.438Z",
1814
1827
  fill: "currentColor"
1815
1828
  }));
@@ -3910,30 +3923,29 @@ var TextAreaField = function TextAreaField(_ref) {
3910
3923
 
3911
3924
  var styles$j = {"text-field":"_20YOA","text-field--invalid":"_3kUSh","text-field--prefixed":"_3IU3Q","text-field--suffixed":"_QXJOD"};
3912
3925
 
3913
- var TextFieldElement = function TextFieldElement(_ref, ref) {
3926
+ var useTextField = function useTextField(_ref) {
3914
3927
  var _classnames;
3915
3928
 
3916
3929
  var autoComplete = _ref.autoComplete,
3917
3930
  autoFocus = _ref.autoFocus,
3918
- caption = _ref.caption,
3919
3931
  defaultValue = _ref.defaultValue,
3920
3932
  disabled = _ref.disabled,
3921
3933
  error = _ref.error,
3922
- inputId = _ref.id,
3923
- label = _ref.label,
3934
+ id = _ref.id,
3924
3935
  maxLength = _ref.maxLength,
3925
3936
  name = _ref.name,
3937
+ caption = _ref.caption,
3938
+ label = _ref.label,
3926
3939
  onBlur = _ref.onBlur,
3927
3940
  onChange = _ref.onChange,
3928
3941
  onFocus = _ref.onFocus,
3929
3942
  onKeyDown = _ref.onKeyDown,
3930
3943
  placeholder = _ref.placeholder,
3931
- prefix = _ref.prefix,
3932
- suffix = _ref.suffix,
3933
- value = _ref.value;
3944
+ value = _ref.value,
3945
+ ref = _ref.ref;
3934
3946
  var controllers = useFieldControllers({
3935
3947
  error: error,
3936
- id: inputId,
3948
+ id: id,
3937
3949
  name: name,
3938
3950
  onChange: onChange,
3939
3951
  onBlur: onBlur,
@@ -3942,23 +3954,13 @@ var TextFieldElement = function TextFieldElement(_ref, ref) {
3942
3954
  value: value
3943
3955
  });
3944
3956
  var hasError = !!controllers.error;
3945
- var fieldProps = {
3946
- caption: caption,
3947
- error: controllers.error,
3948
- label: label,
3949
- id: controllers.id,
3950
- name: name
3951
- };
3952
- return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
3953
- prefix: prefix,
3954
- suffix: suffix
3955
- }, React__default.createElement("input", {
3956
- "aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
3957
- "aria-invalid": hasError,
3957
+ var inputProps = {
3958
+ 'aria-describedby': hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
3959
+ 'aria-invalid': hasError,
3958
3960
  autoComplete: autoComplete,
3959
3961
  autoFocus: autoFocus,
3960
3962
  className: classnames(styles$j['text-field'], (_classnames = {}, _classnames[styles$j['text-field--invalid']] = hasError, _classnames)),
3961
- "data-testid": "text-field-" + name,
3963
+ 'data-testid': "text-field-" + name,
3962
3964
  disabled: disabled,
3963
3965
  defaultValue: defaultValue,
3964
3966
  id: controllers.id,
@@ -3971,9 +3973,39 @@ var TextFieldElement = function TextFieldElement(_ref, ref) {
3971
3973
  placeholder: placeholder,
3972
3974
  ref: ref,
3973
3975
  size: 1,
3974
- type: "text",
3976
+ type: 'text',
3975
3977
  value: controllers.value
3976
- })));
3978
+ };
3979
+ var fieldProps = {
3980
+ caption: caption,
3981
+ error: controllers.error,
3982
+ label: label,
3983
+ id: inputProps.id,
3984
+ name: name
3985
+ };
3986
+ return {
3987
+ inputProps: inputProps,
3988
+ fieldProps: fieldProps
3989
+ };
3990
+ };
3991
+
3992
+ var _excluded$2 = ["prefix", "suffix"];
3993
+
3994
+ var TextFieldElement = function TextFieldElement(_ref, ref) {
3995
+ var prefix = _ref.prefix,
3996
+ suffix = _ref.suffix,
3997
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
3998
+
3999
+ var _useTextField = useTextField(_extends({}, props, {
4000
+ ref: ref
4001
+ })),
4002
+ inputProps = _useTextField.inputProps,
4003
+ fieldProps = _useTextField.fieldProps;
4004
+
4005
+ return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
4006
+ prefix: prefix,
4007
+ suffix: suffix
4008
+ }, React__default.createElement("input", Object.assign({}, inputProps))));
3977
4009
  };
3978
4010
 
3979
4011
  var TextField = React.forwardRef(TextFieldElement);
@@ -4482,7 +4514,7 @@ var getSelectStyles = function getSelectStyles(_ref) {
4482
4514
  return Object.assign({}, base, {
4483
4515
  flex: '1',
4484
4516
  fontFamily: FONT_FAMILY,
4485
- minWidth: '64px',
4517
+ minWidth: '110px',
4486
4518
  backgroundColor: state.isDisabled && !asToolbarFilter ? GREY100 : WHITE,
4487
4519
  position: 'initial'
4488
4520
  });
@@ -4527,11 +4559,12 @@ var getSelectStyles = function getSelectStyles(_ref) {
4527
4559
  return Object.assign({}, base, {
4528
4560
  color: state.isDisabled ? GREY400 : null,
4529
4561
  marginRight: 0,
4530
- position: 'static',
4562
+ position: asToolbarFilter ? 'static' : 'absolute',
4531
4563
  transform: 'initial',
4532
4564
  overflow: 'hidden',
4533
4565
  textOverflow: 'ellipsis',
4534
- whiteSpace: 'nowrap'
4566
+ whiteSpace: 'nowrap',
4567
+ top: !asToolbarFilter && 'auto'
4535
4568
  });
4536
4569
  },
4537
4570
  dropdownIndicator: function dropdownIndicator(base, state) {
@@ -4546,7 +4579,8 @@ var getSelectStyles = function getSelectStyles(_ref) {
4546
4579
  color: state.isDisabled ? GREY400 : state.isSelected ? EGGPLANT700 : GREY500,
4547
4580
  cursor: 'pointer',
4548
4581
  fontFamily: FONT_FAMILY,
4549
- fontSize: '14px'
4582
+ fontSize: '14px',
4583
+ wordBreak: 'break-word'
4550
4584
  });
4551
4585
  },
4552
4586
  group: function group(base) {
@@ -4583,12 +4617,12 @@ var getSelectStyles = function getSelectStyles(_ref) {
4583
4617
  };
4584
4618
  };
4585
4619
 
4586
- var _excluded$2 = ["children", "CustomComponent"];
4620
+ var _excluded$3 = ["children", "CustomComponent"];
4587
4621
 
4588
4622
  function CustomOption(_ref) {
4589
4623
  var children = _ref.children,
4590
4624
  CustomComponent = _ref.CustomComponent,
4591
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
4625
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
4592
4626
 
4593
4627
  return React__default.createElement(Select.components.Option, Object.assign({}, props), React__default.createElement(CustomComponent, Object.assign({}, props), children));
4594
4628
  }
@@ -4607,7 +4641,9 @@ var MultiSelectField = function MultiSelectField(_ref) {
4607
4641
  placeholder = _ref.placeholder,
4608
4642
  disabled = _ref.disabled,
4609
4643
  _ref$closeOnSelect = _ref.closeOnSelect,
4610
- closeOnSelect = _ref$closeOnSelect === void 0 ? false : _ref$closeOnSelect;
4644
+ closeOnSelect = _ref$closeOnSelect === void 0 ? false : _ref$closeOnSelect,
4645
+ _ref$menuShouldScroll = _ref.menuShouldScrollIntoView,
4646
+ menuShouldScrollIntoView = _ref$menuShouldScroll === void 0 ? true : _ref$menuShouldScroll;
4611
4647
  var controllers = useMultiSelectFieldControllers({
4612
4648
  name: name,
4613
4649
  id: inputId,
@@ -4645,6 +4681,18 @@ var MultiSelectField = function MultiSelectField(_ref) {
4645
4681
  CustomComponent: UserCustomOption
4646
4682
  }, props));
4647
4683
  } : Select.components.Option
4684
+ },
4685
+ menuShouldScrollIntoView: menuShouldScrollIntoView,
4686
+ menuPlacement: menuShouldScrollIntoView ? 'bottom' : 'auto',
4687
+ menuPosition: menuShouldScrollIntoView ? 'absolute' : 'fixed',
4688
+ closeMenuOnScroll: function closeMenuOnScroll(e) {
4689
+ if (menuShouldScrollIntoView || !e.target) {
4690
+ return false;
4691
+ }
4692
+
4693
+ var target = e.target;
4694
+ var isScrollingTheMenu = typeof target.className === 'string' && target.className.includes('MenuList');
4695
+ return !isScrollingTheMenu;
4648
4696
  }
4649
4697
  }));
4650
4698
  };
@@ -4703,14 +4751,14 @@ var useSelectFieldControllers = function useSelectFieldControllers(_ref) {
4703
4751
 
4704
4752
  var styles$q = {"custom-control":"_1cDCR"};
4705
4753
 
4706
- var _excluded$3 = ["children", "CustomPrefixComponent"];
4754
+ var _excluded$4 = ["children", "CustomPrefixComponent"];
4707
4755
 
4708
4756
  function CustomControl(_ref) {
4709
4757
  var _props$getValue;
4710
4758
 
4711
4759
  var children = _ref.children,
4712
4760
  CustomPrefixComponent = _ref.CustomPrefixComponent,
4713
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
4761
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
4714
4762
 
4715
4763
  var selectedOption = (_props$getValue = props.getValue()) === null || _props$getValue === void 0 ? void 0 : _props$getValue[0];
4716
4764
  return React__default.createElement(Select.components.Control, Object.assign({}, props), CustomControl && selectedOption ? React__default.createElement("div", {
@@ -4727,12 +4775,12 @@ function CustomControl(_ref) {
4727
4775
  }, props)), children)) : children);
4728
4776
  }
4729
4777
 
4730
- var _excluded$4 = ["children", "CustomComponent"];
4778
+ var _excluded$5 = ["children", "CustomComponent"];
4731
4779
 
4732
4780
  function CustomOption$1(_ref) {
4733
4781
  var children = _ref.children,
4734
4782
  CustomComponent = _ref.CustomComponent,
4735
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
4783
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
4736
4784
 
4737
4785
  return React__default.createElement(Select.components.Option, Object.assign({}, props), React__default.createElement(CustomComponent, Object.assign({}, props), children));
4738
4786
  }
@@ -4753,7 +4801,9 @@ var SelectField = function SelectField(_ref) {
4753
4801
  disabled = _ref.disabled,
4754
4802
  prefix = _ref.prefix,
4755
4803
  _ref$asToolbarFilter = _ref.asToolbarFilter,
4756
- asToolbarFilter = _ref$asToolbarFilter === void 0 ? false : _ref$asToolbarFilter;
4804
+ asToolbarFilter = _ref$asToolbarFilter === void 0 ? false : _ref$asToolbarFilter,
4805
+ _ref$menuShouldScroll = _ref.menuShouldScrollIntoView,
4806
+ menuShouldScrollIntoView = _ref$menuShouldScroll === void 0 ? true : _ref$menuShouldScroll;
4757
4807
  var controllers = useSelectFieldControllers({
4758
4808
  name: name,
4759
4809
  id: inputId,
@@ -4796,6 +4846,18 @@ var SelectField = function SelectField(_ref) {
4796
4846
  CustomPrefixComponent: SelectedOptionPrefix
4797
4847
  }, props));
4798
4848
  } : Select.components.Control
4849
+ },
4850
+ menuShouldScrollIntoView: menuShouldScrollIntoView,
4851
+ menuPlacement: menuShouldScrollIntoView ? 'bottom' : 'auto',
4852
+ menuPosition: menuShouldScrollIntoView ? 'absolute' : 'fixed',
4853
+ closeMenuOnScroll: function closeMenuOnScroll(e) {
4854
+ if (menuShouldScrollIntoView || !e.target) {
4855
+ return false;
4856
+ }
4857
+
4858
+ var target = e.target;
4859
+ var isScrollingTheMenu = typeof target.className === 'string' && target.className.includes('MenuList');
4860
+ return !isScrollingTheMenu;
4799
4861
  }
4800
4862
  })));
4801
4863
  };
@@ -5388,6 +5450,34 @@ var WeekField = function WeekField(_ref) {
5388
5450
  })));
5389
5451
  };
5390
5452
 
5453
+ var _excluded$6 = ["placeholder", "autoComplete"];
5454
+
5455
+ var TimeFieldElement = function TimeFieldElement(_ref, ref) {
5456
+ var _ref$placeholder = _ref.placeholder,
5457
+ placeholder = _ref$placeholder === void 0 ? '9am' : _ref$placeholder,
5458
+ _ref$autoComplete = _ref.autoComplete,
5459
+ autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
5460
+ allOtherProps = _objectWithoutPropertiesLoose(_ref, _excluded$6);
5461
+
5462
+ var _useTextField = useTextField(_extends({}, allOtherProps, {
5463
+ placeholder: placeholder,
5464
+ autoComplete: autoComplete,
5465
+ ref: ref
5466
+ })),
5467
+ inputProps = _useTextField.inputProps,
5468
+ fieldProps = _useTextField.fieldProps;
5469
+
5470
+ return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("input", Object.assign({}, inputProps, {
5471
+ onBlur: function onBlur(e) {
5472
+ e.target.value = parseTime(e.target.value, 'g:i A');
5473
+ inputProps.onChange(e);
5474
+ inputProps.onBlur(e);
5475
+ }
5476
+ })));
5477
+ };
5478
+
5479
+ var TimeField = React.forwardRef(TimeFieldElement);
5480
+
5391
5481
  var styles$u = {"caption":"_1QDLF","label":"_2wiMV","toggle":"_1ui8X","toggle__label":"_1YRJT","toggle__caption":"_1jEiW","toggle__switch":"_3tNyE"};
5392
5482
 
5393
5483
  var Toggle = function Toggle(_ref) {
@@ -5561,7 +5651,7 @@ var FooterContainer = function FooterContainer(_ref2) {
5561
5651
 
5562
5652
  var styles$z = {"badge":"_2f81N","badge--warning":"_2g1GI","badge--danger":"_2zLnM","badge--success":"_27QOo","badge--info":"_2gmsM"};
5563
5653
 
5564
- var _excluded$5 = ["children", "theme", "title"];
5654
+ var _excluded$7 = ["children", "theme", "title"];
5565
5655
 
5566
5656
  var Badge = function Badge(_ref, forwardedRef) {
5567
5657
  var _classnames;
@@ -5569,7 +5659,7 @@ var Badge = function Badge(_ref, forwardedRef) {
5569
5659
  var children = _ref.children,
5570
5660
  theme = _ref.theme,
5571
5661
  title = _ref.title,
5572
- otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$5);
5662
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$7);
5573
5663
 
5574
5664
  var internalRef = React.useRef(null);
5575
5665
  var ref = forwardedRef || internalRef;
@@ -5769,6 +5859,7 @@ exports.IconFilePdf = IconFilePdf;
5769
5859
  exports.IconFlag = IconFlag;
5770
5860
  exports.IconFourDotsCircle = IconFourDotsCircle;
5771
5861
  exports.IconFourSquares = IconFourSquares;
5862
+ exports.IconGavel = IconGavel;
5772
5863
  exports.IconGift = IconGift;
5773
5864
  exports.IconGrinBeam = IconGrinBeam;
5774
5865
  exports.IconGripVertical = IconGripVertical;
@@ -5852,6 +5943,7 @@ exports.Spinner = Spinner;
5852
5943
  exports.Stack = Stack;
5853
5944
  exports.TextAreaField = TextAreaField;
5854
5945
  exports.TextField = TextField;
5946
+ exports.TimeField = TimeField;
5855
5947
  exports.Toggle = Toggle;
5856
5948
  exports.Tooltip = Tooltip$1;
5857
5949
  exports.WeekField = WeekField;