@commercetools-uikit/select-utils 15.14.3 → 15.15.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.
@@ -14,6 +14,7 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
14
14
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
15
15
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
16
16
  var designSystem = require('@commercetools-uikit/design-system');
17
+ var utils = require('@commercetools-uikit/utils');
17
18
  var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
18
19
  var react = require('@emotion/react');
19
20
  var icons = require('@commercetools-uikit/icons');
@@ -488,7 +489,7 @@ var valueContainerStyles = function valueContainerStyles(props) {
488
489
  // Display property should be grid when isMulti and has no value so the Placeholder component is positioned correctly with the Input
489
490
  // Display property should be Flex when there is an iconLeft, also when the input has some values when isMulti.
490
491
  // See PR from react select for more insight https://github.com/JedWatson/react-select/pull/4833
491
- display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue ? 'flex' : 'grid',
492
+ display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue && props.controlShouldRenderValue ? 'flex' : 'grid',
492
493
  fill: props.isDisabled || props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenDisabled : designSystem.designTokens.fontColorForSelectInputIcon
493
494
  });
494
495
  };
@@ -657,8 +658,19 @@ function createSelectStyles(props) {
657
658
  };
658
659
  }
659
660
 
661
+ var getMessage = function getMessage(componentName) {
662
+ return "".concat(componentName, ": use `menuPortalZIndex` in conjunction with `menuPortalTarget`");
663
+ };
664
+
665
+ var warnIfMenuPortalPropsAreMissing = function warnIfMenuPortalPropsAreMissing(props) {
666
+ if (typeof props.menuPortalZIndex !== 'undefined' && props.menuPortalZIndex !== 1 // 1 is the value passed in default props
667
+ ) {
668
+ process.env.NODE_ENV !== "production" ? utils.warning(props.menuPortalTarget, getMessage(props.componentName)) : void 0;
669
+ }
670
+ };
671
+
660
672
  // NOTE: This string will be replaced on build time with the package version.
661
- var version = "15.14.3";
673
+ var version = "15.15.0";
662
674
 
663
675
  exports.ClearIndicator = ClearIndicator$1;
664
676
  exports.CustomSelectInputOption = CustomSelectInputOption;
@@ -673,3 +685,4 @@ exports.createSelectStyles = createSelectStyles;
673
685
  exports.customComponentsWithIcons = customComponents;
674
686
  exports.messages = messages;
675
687
  exports.version = version;
688
+ exports.warnIfMenuPortalPropsAreMissing = warnIfMenuPortalPropsAreMissing;
@@ -14,6 +14,7 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
14
14
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
15
15
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
16
16
  var designSystem = require('@commercetools-uikit/design-system');
17
+ require('@commercetools-uikit/utils');
17
18
  var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
18
19
  var react = require('@emotion/react');
19
20
  var icons = require('@commercetools-uikit/icons');
@@ -488,7 +489,7 @@ var valueContainerStyles = function valueContainerStyles(props) {
488
489
  // Display property should be grid when isMulti and has no value so the Placeholder component is positioned correctly with the Input
489
490
  // Display property should be Flex when there is an iconLeft, also when the input has some values when isMulti.
490
491
  // See PR from react select for more insight https://github.com/JedWatson/react-select/pull/4833
491
- display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue ? 'flex' : 'grid',
492
+ display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue && props.controlShouldRenderValue ? 'flex' : 'grid',
492
493
  fill: props.isDisabled || props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenDisabled : designSystem.designTokens.fontColorForSelectInputIcon
493
494
  });
494
495
  };
@@ -657,8 +658,13 @@ function createSelectStyles(props) {
657
658
  };
658
659
  }
659
660
 
661
+ var warnIfMenuPortalPropsAreMissing = function warnIfMenuPortalPropsAreMissing(props) {
662
+ if (typeof props.menuPortalZIndex !== 'undefined' && props.menuPortalZIndex !== 1 // 1 is the value passed in default props
663
+ ) ;
664
+ };
665
+
660
666
  // NOTE: This string will be replaced on build time with the package version.
661
- var version = "15.14.3";
667
+ var version = "15.15.0";
662
668
 
663
669
  exports.ClearIndicator = ClearIndicator$1;
664
670
  exports.CustomSelectInputOption = CustomSelectInputOption;
@@ -673,3 +679,4 @@ exports.createSelectStyles = createSelectStyles;
673
679
  exports.customComponentsWithIcons = customComponents;
674
680
  exports.messages = messages;
675
681
  exports.version = version;
682
+ exports.warnIfMenuPortalPropsAreMissing = warnIfMenuPortalPropsAreMissing;
@@ -10,6 +10,7 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
10
10
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
11
11
  import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
12
12
  import { designTokens } from '@commercetools-uikit/design-system';
13
+ import { warning } from '@commercetools-uikit/utils';
13
14
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
14
15
  import { css } from '@emotion/react';
15
16
  import { CloseIcon, CloseBoldIcon, CaretDownIcon, SearchIcon } from '@commercetools-uikit/icons';
@@ -468,7 +469,7 @@ var valueContainerStyles = function valueContainerStyles(props) {
468
469
  // Display property should be grid when isMulti and has no value so the Placeholder component is positioned correctly with the Input
469
470
  // Display property should be Flex when there is an iconLeft, also when the input has some values when isMulti.
470
471
  // See PR from react select for more insight https://github.com/JedWatson/react-select/pull/4833
471
- display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue ? 'flex' : 'grid',
472
+ display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue && props.controlShouldRenderValue ? 'flex' : 'grid',
472
473
  fill: props.isDisabled || props.isReadOnly ? designTokens.fontColorForInputWhenDisabled : designTokens.fontColorForSelectInputIcon
473
474
  });
474
475
  };
@@ -637,7 +638,18 @@ function createSelectStyles(props) {
637
638
  };
638
639
  }
639
640
 
641
+ var getMessage = function getMessage(componentName) {
642
+ return "".concat(componentName, ": use `menuPortalZIndex` in conjunction with `menuPortalTarget`");
643
+ };
644
+
645
+ var warnIfMenuPortalPropsAreMissing = function warnIfMenuPortalPropsAreMissing(props) {
646
+ if (typeof props.menuPortalZIndex !== 'undefined' && props.menuPortalZIndex !== 1 // 1 is the value passed in default props
647
+ ) {
648
+ process.env.NODE_ENV !== "production" ? warning(props.menuPortalTarget, getMessage(props.componentName)) : void 0;
649
+ }
650
+ };
651
+
640
652
  // NOTE: This string will be replaced on build time with the package version.
641
- var version = "15.14.3";
653
+ var version = "15.15.0";
642
654
 
643
- export { ClearIndicator$1 as ClearIndicator, CustomSelectInputOption, DoublePropertySelectInputOption, DropdownIndicator$1 as DropdownIndicator, MultiplePropertiesSelectInputOption, SELECT_DROPDOWN_OPTION_TYPES, SearchIconDropdownIndicator$1 as SearchIconDropdownIndicator, TagRemove$1 as TagRemove, WrapperWithIcon$1 as ValueWrapperWithIcon, createSelectStyles, customComponents as customComponentsWithIcons, messages, version };
655
+ export { ClearIndicator$1 as ClearIndicator, CustomSelectInputOption, DoublePropertySelectInputOption, DropdownIndicator$1 as DropdownIndicator, MultiplePropertiesSelectInputOption, SELECT_DROPDOWN_OPTION_TYPES, SearchIconDropdownIndicator$1 as SearchIconDropdownIndicator, TagRemove$1 as TagRemove, WrapperWithIcon$1 as ValueWrapperWithIcon, createSelectStyles, customComponents as customComponentsWithIcons, messages, version, warnIfMenuPortalPropsAreMissing };
@@ -9,6 +9,7 @@ type TProps = {
9
9
  iconLeft?: ReactNode;
10
10
  isMulti?: boolean;
11
11
  hasValue?: boolean;
12
+ controlShouldRenderValue?: boolean;
12
13
  };
13
14
  type TBase = {
14
15
  fontColorForInput?: string;
@@ -8,4 +8,5 @@ export * from './custom-styled-select-options';
8
8
  export * from './export-types';
9
9
  export { default as messages } from './messages';
10
10
  export { default as createSelectStyles } from './create-select-styles';
11
+ export { warnIfMenuPortalPropsAreMissing } from './warning';
11
12
  export { default as version } from './version';
@@ -0,0 +1,8 @@
1
+ import { type Props as ReactSelectProps } from 'react-select';
2
+ type TWarnIfMenuPortalPropsAreMissingProps = {
3
+ menuPortalZIndex?: number;
4
+ menuPortalTarget?: ReactSelectProps['menuPortalTarget'];
5
+ componentName: string;
6
+ };
7
+ export declare const warnIfMenuPortalPropsAreMissing: (props: TWarnIfMenuPortalPropsAreMissingProps) => void;
8
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/select-utils",
3
3
  "description": "Utilities for working with select components.",
4
- "version": "15.14.3",
4
+ "version": "15.15.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,12 +21,12 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/accessible-button": "15.14.3",
25
- "@commercetools-uikit/design-system": "15.14.3",
26
- "@commercetools-uikit/icons": "15.14.3",
27
- "@commercetools-uikit/spacings": "15.14.3",
28
- "@commercetools-uikit/text": "15.14.3",
29
- "@commercetools-uikit/utils": "15.14.3",
24
+ "@commercetools-uikit/accessible-button": "15.15.0",
25
+ "@commercetools-uikit/design-system": "15.15.0",
26
+ "@commercetools-uikit/icons": "15.15.0",
27
+ "@commercetools-uikit/spacings": "15.15.0",
28
+ "@commercetools-uikit/text": "15.15.0",
29
+ "@commercetools-uikit/utils": "15.15.0",
30
30
  "@emotion/react": "^11.10.5",
31
31
  "@emotion/styled": "^11.10.5",
32
32
  "lodash": "4.17.21",