@ctlyst.id/internal-ui 2.0.14 → 2.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -3033,20 +3033,9 @@ const Rating = ({
3033
3033
  };
3034
3034
 
3035
3035
  const SelectWrapper = ({
3036
- children,
3037
- isError = false
3036
+ children
3038
3037
  }) => {
3039
- return /*#__PURE__*/React__default.createElement(react.Box, {
3040
- css: react$1.css`
3041
- .react-select__control {
3042
- border-color: ${isError ? colors.danger['500'] : colors.neutral['500']} !important;
3043
- }
3044
-
3045
- .react-select__control:hover {
3046
- border-color: ${isError ? colors.danger['500'] : colors.primary['500']} !important;
3047
- }
3048
- `
3049
- }, children);
3038
+ return /*#__PURE__*/React__default.createElement(react.Box, null, children);
3050
3039
  };
3051
3040
  SelectWrapper.defaultProps = {
3052
3041
  isError: false
@@ -3058,7 +3047,17 @@ const selectStyle = {
3058
3047
  lineHeight: styleMd.lineHeight,
3059
3048
  letterSpacing: 0
3060
3049
  };
3050
+ const boxShadow = color => `0 0 0 1px ${color}`;
3061
3051
  function selectStyles(colorMode, _isError) {
3052
+ const boxShadowLight = (isFocused = false, isError = false) => {
3053
+ if (isError && isFocused || isError) {
3054
+ return boxShadow(colors.danger['500']);
3055
+ }
3056
+ if (isFocused) {
3057
+ return boxShadow(colors.primary['500']);
3058
+ }
3059
+ return boxShadow(colors.neutral['400']);
3060
+ };
3062
3061
  return {
3063
3062
  control: (base, state) => colorMode === 'dark' ? {
3064
3063
  ...base,
@@ -3070,7 +3069,8 @@ function selectStyles(colorMode, _isError) {
3070
3069
  } : {
3071
3070
  ...base,
3072
3071
  ...selectStyle,
3073
- boxShadow: state.isFocused ? 'none' : colors.neutral['500']
3072
+ borderWidth: 0,
3073
+ boxShadow: boxShadowLight(state.isFocused, _isError)
3074
3074
  },
3075
3075
  option: (base, {
3076
3076
  isSelected
@@ -3155,7 +3155,7 @@ function Select({
3155
3155
  classNamePrefix: "react-select"
3156
3156
  }, rest, {
3157
3157
  styles: {
3158
- ...selectStyles(colorMode)
3158
+ ...selectStyles(colorMode, isError)
3159
3159
  },
3160
3160
  theme: themeSelect
3161
3161
  })));
@@ -3175,7 +3175,7 @@ function SelectAsync({
3175
3175
  classNamePrefix: "react-select"
3176
3176
  }, rest, {
3177
3177
  styles: {
3178
- ...selectStyles(colorMode),
3178
+ ...selectStyles(colorMode, isError),
3179
3179
  ...styles
3180
3180
  },
3181
3181
  theme: themeSelect
@@ -3196,7 +3196,7 @@ function SelectAsyncCreatable({
3196
3196
  classNamePrefix: "react-select"
3197
3197
  }, rest, {
3198
3198
  styles: {
3199
- ...selectStyles(colorMode),
3199
+ ...selectStyles(colorMode, isError),
3200
3200
  ...styles
3201
3201
  },
3202
3202
  theme: themeSelect
@@ -3217,7 +3217,7 @@ function SelectCreatable({
3217
3217
  classNamePrefix: "react-select"
3218
3218
  }, rest, {
3219
3219
  styles: {
3220
- ...selectStyles(colorMode),
3220
+ ...selectStyles(colorMode, isError),
3221
3221
  ...styles
3222
3222
  },
3223
3223
  theme: themeSelect