@7shifts/sous-chef 3.69.0 → 3.70.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.
@@ -1,2 +1,2 @@
1
- declare const _default: typeof import("react-select/src/components/containers").SelectContainer;
1
+ declare const _default: <Option_18, IsMulti_18 extends boolean, Group_18 extends import("react-select").GroupBase<Option_18>>(props: import("react-select").ContainerProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: typeof import("react-select/src/components/Option").default;
1
+ declare const _default: <Option_16, IsMulti_16 extends boolean, Group_16 extends import("react-select").GroupBase<Option_16>>(props: import("react-select").OptionProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
2
2
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { ControlProps } from 'react-select';
2
3
  export type GroupOption<T> = {
3
4
  label: string;
@@ -19,3 +20,11 @@ export type CustomOptionProps<T> = {
19
20
  export interface SelectedOptionPrefixProps<T> extends ControlProps<T, false> {
20
21
  selectedOption: SelectOption<T>;
21
22
  }
23
+ export type CustomComponentsExtraProps = {
24
+ testId?: string;
25
+ UserCustomOption?: React.ElementType;
26
+ SelectedOptionPrefix?: React.ElementType;
27
+ creatableButton?: ReactNode;
28
+ onMenuInputFocus: (isFocused: boolean) => void;
29
+ onCreate?: (option: string) => void;
30
+ };
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import type { Props } from './SelectField';
3
+ import { CustomComponentsExtraProps } from './types';
3
4
  export declare const useSelectField: <T extends unknown>({ asToolbarFilter, caption, disabled, error, id, isClearable, label, menuShouldScrollIntoView, name, noOptionsMessage, options, onBlur, onChange, placeholder, value, defaultValue, CustomOption: UserCustomOption, SelectedOptionPrefix, testId, creatableButton, onCreate, isSearchable, autoFocus, ...rest }: Props<T>) => {
4
- selectProps: {
5
- [x: string]: any;
6
- [x: number]: any;
7
- } & import("react-select/src/stateManager").Props<import("react-select").OptionTypeBase, boolean, import("react-select").GroupTypeBase<import("react-select").OptionTypeBase>> & import("react-select").Props<import("react-select").OptionTypeBase, boolean, import("react-select").GroupTypeBase<import("react-select").OptionTypeBase>>;
5
+ selectProps: Omit<import("react-select/dist/declarations/src/Select").PublicBaseSelectProps<unknown, boolean, import("react-select").GroupBase<unknown>>, "onChange" | "value" | "inputValue" | "menuIsOpen" | "onInputChange" | "onMenuOpen" | "onMenuClose"> & Partial<import("react-select/dist/declarations/src/Select").PublicBaseSelectProps<unknown, boolean, import("react-select").GroupBase<unknown>>> & import("react-select/dist/declarations/src/useStateManager").StateManagerAdditionalProps<unknown> & import("react").RefAttributes<import("react-select/dist/declarations/src/Select").default<unknown, boolean, import("react-select").GroupBase<unknown>>> & {
6
+ componentsProps: CustomComponentsExtraProps;
7
+ };
8
8
  fieldProps: {
9
9
  caption: import("react").ReactNode;
10
10
  error: import("react").ReactNode;
package/dist/index.js CHANGED
@@ -9972,27 +9972,6 @@ var useSelectFieldControllers = function useSelectFieldControllers(_ref) {
9972
9972
  return controllers;
9973
9973
  };
9974
9974
 
9975
- /**
9976
- * This helper method helps to check if the user is scrolling inside the select options so,
9977
- * it does not close the menu when using the prop menuShouldScrollIntoView
9978
- **/
9979
- var isScrollingTheSelectMenu = function isScrollingTheSelectMenu(element) {
9980
- if (!isReactSelectElement(element)) {
9981
- var _element$children;
9982
- // Checking in case it is a grouped options
9983
- return isReactSelectElement(element == null || (_element$children = element.children) == null ? void 0 : _element$children[0]);
9984
- }
9985
- return true;
9986
- };
9987
- var isReactSelectElement = function isReactSelectElement(element) {
9988
- var _element$children2;
9989
- var firstOption = element == null || (_element$children2 = element.children) == null ? void 0 : _element$children2[0];
9990
- if (!firstOption) {
9991
- return false;
9992
- }
9993
- return typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
9994
- };
9995
-
9996
9975
  var styles$v = {"custom-control":"_pXQqq"};
9997
9976
 
9998
9977
  var _excluded$d = ["children"];
@@ -10021,6 +10000,9 @@ function CustomOption(_ref) {
10021
10000
  var children = _ref.children,
10022
10001
  props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
10023
10002
  var UserCustomOption = props.selectProps.componentsProps.UserCustomOption;
10003
+ if (!UserCustomOption) {
10004
+ return null;
10005
+ }
10024
10006
  return React__default["default"].createElement(Select.components.Option, _extends({}, props), React__default["default"].createElement(UserCustomOption, _extends({}, props), children));
10025
10007
  }
10026
10008
 
@@ -10218,7 +10200,7 @@ function CustomMenu(_ref) {
10218
10200
  });
10219
10201
  };
10220
10202
  var onCreateButton = function onCreateButton() {
10221
- if (textFieldRef.current && textFieldRef.current.value.trim() !== '') {
10203
+ if (textFieldRef.current && textFieldRef.current.value.trim() !== '' && onCreate) {
10222
10204
  onCreate(textFieldRef.current.value);
10223
10205
  textFieldRef.current.value = '';
10224
10206
  setShowFooter(false);
@@ -10330,13 +10312,6 @@ var useSelectField = function useSelectField(_ref) {
10330
10312
  var _getDataProps = getDataProps(rest),
10331
10313
  dataProps = _getDataProps.dataProps;
10332
10314
  var selectProps = {
10333
- closeMenuOnScroll: function closeMenuOnScroll(e) {
10334
- if (!e.target) {
10335
- return false;
10336
- }
10337
- return !isScrollingTheSelectMenu(e.target);
10338
- },
10339
- // Used to pass props to the custom components inside `components`
10340
10315
  componentsProps: {
10341
10316
  testId: testId,
10342
10317
  UserCustomOption: UserCustomOption,
@@ -11605,6 +11580,7 @@ var MultiSelectField = function MultiSelectField(_ref) {
11605
11580
  onBlur: controllers.onBlur,
11606
11581
  isMulti: true,
11607
11582
  closeMenuOnSelect: closeOnSelect,
11583
+ // @ts-expect-error Used to pass props to the custom components inside `components`
11608
11584
  componentsProps: {
11609
11585
  testId: testId,
11610
11586
  UserCustomOption: UserCustomOption,
@@ -11620,12 +11596,6 @@ var MultiSelectField = function MultiSelectField(_ref) {
11620
11596
  menuShouldScrollIntoView: menuShouldScrollIntoView,
11621
11597
  menuPlacement: menuShouldScrollIntoView ? 'bottom' : 'auto',
11622
11598
  menuPosition: menuShouldScrollIntoView ? 'absolute' : 'fixed',
11623
- closeMenuOnScroll: function closeMenuOnScroll(e) {
11624
- if (!e.target) {
11625
- return false;
11626
- }
11627
- return !isScrollingTheSelectMenu(e.target);
11628
- },
11629
11599
  isSearchable: isSearchable,
11630
11600
  menuIsOpen: isMenuInputFocus || undefined,
11631
11601
  isClearable: isClearable
@@ -11694,7 +11664,7 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
11694
11664
  var _ref$current;
11695
11665
  var hasMore = _ref2.hasMore,
11696
11666
  options = _ref2.options;
11697
- if (ref.current && inputValue !== (ref == null || (_ref$current = ref.current) == null ? void 0 : _ref$current['state']['inputValue'])) {
11667
+ if (ref.current && inputValue !== (ref == null || (_ref$current = ref.current) == null ? void 0 : _ref$current['inputRef']['value'])) {
11698
11668
  return;
11699
11669
  }
11700
11670
  if (!hasFirstLoadPerformed) {