@ctlyst.id/internal-ui 2.0.15 → 2.0.17

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
@@ -3120,6 +3124,13 @@ function selectStyles(colorMode, _isError) {
3120
3124
  } : {
3121
3125
  ...base,
3122
3126
  ...selectStyle
3127
+ },
3128
+ placeholder: base => {
3129
+ return {
3130
+ ...base,
3131
+ ...selectStyle,
3132
+ color: colors.black.low
3133
+ };
3123
3134
  }
3124
3135
  };
3125
3136
  }
@@ -3151,7 +3162,7 @@ function Select({
3151
3162
  classNamePrefix: "react-select"
3152
3163
  }, rest, {
3153
3164
  styles: {
3154
- ...selectStyles(colorMode)
3165
+ ...selectStyles(colorMode, isError)
3155
3166
  },
3156
3167
  theme: themeSelect
3157
3168
  })));
@@ -3171,7 +3182,7 @@ function SelectAsync({
3171
3182
  classNamePrefix: "react-select"
3172
3183
  }, rest, {
3173
3184
  styles: {
3174
- ...selectStyles(colorMode),
3185
+ ...selectStyles(colorMode, isError),
3175
3186
  ...styles
3176
3187
  },
3177
3188
  theme: themeSelect
@@ -3192,7 +3203,7 @@ function SelectAsyncCreatable({
3192
3203
  classNamePrefix: "react-select"
3193
3204
  }, rest, {
3194
3205
  styles: {
3195
- ...selectStyles(colorMode),
3206
+ ...selectStyles(colorMode, isError),
3196
3207
  ...styles
3197
3208
  },
3198
3209
  theme: themeSelect
@@ -3213,7 +3224,7 @@ function SelectCreatable({
3213
3224
  classNamePrefix: "react-select"
3214
3225
  }, rest, {
3215
3226
  styles: {
3216
- ...selectStyles(colorMode),
3227
+ ...selectStyles(colorMode, isError),
3217
3228
  ...styles
3218
3229
  },
3219
3230
  theme: themeSelect