@ctlyst.id/internal-ui 2.0.15 → 2.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -3033,16 +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
- }, children);
3038
+ return /*#__PURE__*/React__default.createElement(react.Box, null, children);
3046
3039
  };
3047
3040
  SelectWrapper.defaultProps = {
3048
3041
  isError: false
@@ -3054,7 +3047,17 @@ const selectStyle = {
3054
3047
  lineHeight: styleMd.lineHeight,
3055
3048
  letterSpacing: 0
3056
3049
  };
3050
+ const boxShadow = color => `0 0 0 1px ${color}`;
3057
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
+ };
3058
3061
  return {
3059
3062
  control: (base, state) => colorMode === 'dark' ? {
3060
3063
  ...base,
@@ -3066,7 +3069,8 @@ function selectStyles(colorMode, _isError) {
3066
3069
  } : {
3067
3070
  ...base,
3068
3071
  ...selectStyle,
3069
- boxShadow: state.isFocused ? 'none' : colors.neutral['500']
3072
+ borderWidth: 0,
3073
+ boxShadow: boxShadowLight(state.isFocused, _isError)
3070
3074
  },
3071
3075
  option: (base, {
3072
3076
  isSelected
@@ -3151,7 +3155,7 @@ function Select({
3151
3155
  classNamePrefix: "react-select"
3152
3156
  }, rest, {
3153
3157
  styles: {
3154
- ...selectStyles(colorMode)
3158
+ ...selectStyles(colorMode, isError)
3155
3159
  },
3156
3160
  theme: themeSelect
3157
3161
  })));
@@ -3171,7 +3175,7 @@ function SelectAsync({
3171
3175
  classNamePrefix: "react-select"
3172
3176
  }, rest, {
3173
3177
  styles: {
3174
- ...selectStyles(colorMode),
3178
+ ...selectStyles(colorMode, isError),
3175
3179
  ...styles
3176
3180
  },
3177
3181
  theme: themeSelect
@@ -3192,7 +3196,7 @@ function SelectAsyncCreatable({
3192
3196
  classNamePrefix: "react-select"
3193
3197
  }, rest, {
3194
3198
  styles: {
3195
- ...selectStyles(colorMode),
3199
+ ...selectStyles(colorMode, isError),
3196
3200
  ...styles
3197
3201
  },
3198
3202
  theme: themeSelect
@@ -3213,7 +3217,7 @@ function SelectCreatable({
3213
3217
  classNamePrefix: "react-select"
3214
3218
  }, rest, {
3215
3219
  styles: {
3216
- ...selectStyles(colorMode),
3220
+ ...selectStyles(colorMode, isError),
3217
3221
  ...styles
3218
3222
  },
3219
3223
  theme: themeSelect