@7shifts/sous-chef 3.11.0 → 3.11.2

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.
@@ -4,7 +4,7 @@ declare type TimeFieldDropdownProps = {
4
4
  trigger: React.ReactElement;
5
5
  interval: TimeInterval;
6
6
  startTime?: 'now' | string;
7
- onOptionClick: (option: any) => void;
7
+ onOptionClick: (option: string) => void;
8
8
  inputValue?: string;
9
9
  width?: number;
10
10
  };
@@ -5,5 +5,6 @@ declare const TimeFieldDropdownTrigger: React.ForwardRefExoticComponent<Pick<Tex
5
5
  onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
6
6
  onMouseLeave?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
7
7
  onInputChange?: ((e: string) => void) | undefined;
8
+ selectedTimeOption?: string | undefined;
8
9
  } & React.RefAttributes<HTMLInputElement>>;
9
10
  export default TimeFieldDropdownTrigger;
@@ -1,7 +1,6 @@
1
1
  declare type Props = {
2
2
  inputProps: any;
3
3
  allOtherProps: any;
4
- onInputChange?: (e: string) => void;
5
4
  };
6
5
  declare const TimeFieldInput: ({ inputProps, allOtherProps }: Props) => JSX.Element;
7
6
  export default TimeFieldInput;
package/dist/index.css CHANGED
@@ -817,7 +817,6 @@ Just for future references:
817
817
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
818
818
  background: var(--color-white);
819
819
  margin-top: 8px;
820
- z-index: 10;
821
820
  transform-origin: top right;
822
821
  min-width: 120px;
823
822
  padding: 20px;
@@ -2243,6 +2242,7 @@ h5._3CIA3 {
2243
2242
  }
2244
2243
  ._29ZIp {
2245
2244
  position: relative;
2245
+ height: 100%;
2246
2246
  }
2247
2247
  ._3Q8NT {
2248
2248
  box-sizing: border-box;
package/dist/index.js CHANGED
@@ -4485,7 +4485,8 @@ var PaneOverlay = function PaneOverlay(_ref) {
4485
4485
  style: _extends({}, position, {
4486
4486
  width: width,
4487
4487
  maxHeight: maxHeight,
4488
- overflow: overflow
4488
+ overflow: overflow,
4489
+ zIndex: Z_INDEX_LAYERS.MENU
4489
4490
  }),
4490
4491
  ref: paneRef,
4491
4492
  onMouseEnter: onMouseEnter,
@@ -5184,6 +5185,9 @@ var DropdownListItem = function DropdownListItem(_ref) {
5184
5185
 
5185
5186
  return React__default.createElement("li", {
5186
5187
  className: classnames(styles$l['dropdown-list-item'], (_classNames = {}, _classNames[styles$l['dropdown-list-item--selected']] = selected, _classNames[styles$l['dropdown-list-item--disabled']] = disabled, _classNames)),
5188
+ onMouseDown: function onMouseDown(e) {
5189
+ return e.preventDefault();
5190
+ },
5187
5191
  onClick: handleClick,
5188
5192
  onKeyPress: handleClick,
5189
5193
  role: "menuitem",
@@ -5621,13 +5625,14 @@ var TimeFieldInput = function TimeFieldInput(_ref) {
5621
5625
  }));
5622
5626
  };
5623
5627
 
5624
- var _excluded$2h = ["placeholder", "autoComplete"];
5628
+ var _excluded$2h = ["placeholder", "autoComplete", "selectedTimeOption"];
5625
5629
 
5626
5630
  var TimeFieldDropdownElement = function TimeFieldDropdownElement(_ref, ref) {
5627
5631
  var _ref$placeholder = _ref.placeholder,
5628
5632
  placeholder = _ref$placeholder === void 0 ? '9:00 AM' : _ref$placeholder,
5629
5633
  _ref$autoComplete = _ref.autoComplete,
5630
5634
  autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
5635
+ selectedTimeOption = _ref.selectedTimeOption,
5631
5636
  allOtherProps = _objectWithoutPropertiesLoose(_ref, _excluded$2h);
5632
5637
 
5633
5638
  var _useTextField = useTextField(_extends({}, allOtherProps, {
@@ -5638,6 +5643,15 @@ var TimeFieldDropdownElement = function TimeFieldDropdownElement(_ref, ref) {
5638
5643
  inputProps = _useTextField.inputProps,
5639
5644
  fieldProps = _useTextField.fieldProps;
5640
5645
 
5646
+ React.useEffect(function () {
5647
+ if (selectedTimeOption) {
5648
+ inputProps.onChange({
5649
+ target: {
5650
+ value: selectedTimeOption
5651
+ }
5652
+ });
5653
+ }
5654
+ }, [selectedTimeOption]);
5641
5655
  return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(TimeFieldInput, {
5642
5656
  inputProps: inputProps,
5643
5657
  allOtherProps: allOtherProps
@@ -9149,11 +9163,11 @@ var TimeFieldElement = function TimeFieldElement(_ref, forwardedRef) {
9149
9163
  var ref = forwardedRef || internalRef;
9150
9164
 
9151
9165
  var _useState = React.useState(allOtherProps.defaultValue),
9152
- inputValue = _useState[0],
9153
- setInputValue = _useState[1];
9166
+ selectedDropdownValue = _useState[0],
9167
+ setSelectedDropdownValue = _useState[1];
9154
9168
 
9155
9169
  var onOptionClick = function onOptionClick(option) {
9156
- setInputValue(option);
9170
+ setSelectedDropdownValue(option);
9157
9171
  allOtherProps.onChange && allOtherProps.onChange(option);
9158
9172
  ref.current.value = option;
9159
9173
  ref.current.focus();
@@ -9184,12 +9198,13 @@ var TimeFieldElement = function TimeFieldElement(_ref, forwardedRef) {
9184
9198
  },
9185
9199
  ref: ref,
9186
9200
  onInputChange: function onInputChange(e) {
9187
- return setInputValue(e);
9188
- }
9201
+ return setSelectedDropdownValue(e);
9202
+ },
9203
+ selectedTimeOption: selectedDropdownValue
9189
9204
  })),
9190
9205
  startTime: startTime,
9191
9206
  onOptionClick: onOptionClick,
9192
- inputValue: inputValue,
9207
+ inputValue: selectedDropdownValue,
9193
9208
  width: width
9194
9209
  });
9195
9210
  };