@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.
@@ -3027,16 +3027,9 @@ const Rating = ({
3027
3027
  };
3028
3028
 
3029
3029
  const SelectWrapper = ({
3030
- children,
3031
- isError = false
3030
+ children
3032
3031
  }) => {
3033
- return /*#__PURE__*/React__default.createElement(Box, {
3034
- css: css`
3035
- .react-select__control {
3036
- border-color: ${isError ? colors.danger['500'] : colors.neutral['500']} !important;
3037
- }
3038
- `
3039
- }, children);
3032
+ return /*#__PURE__*/React__default.createElement(Box, null, children);
3040
3033
  };
3041
3034
  SelectWrapper.defaultProps = {
3042
3035
  isError: false
@@ -3048,7 +3041,17 @@ const selectStyle = {
3048
3041
  lineHeight: styleMd.lineHeight,
3049
3042
  letterSpacing: 0
3050
3043
  };
3044
+ const boxShadow = color => `0 0 0 1px ${color}`;
3051
3045
  function selectStyles(colorMode, _isError) {
3046
+ const boxShadowLight = (isFocused = false, isError = false) => {
3047
+ if (isError && isFocused || isError) {
3048
+ return boxShadow(colors.danger['500']);
3049
+ }
3050
+ if (isFocused) {
3051
+ return boxShadow(colors.primary['500']);
3052
+ }
3053
+ return boxShadow(colors.neutral['400']);
3054
+ };
3052
3055
  return {
3053
3056
  control: (base, state) => colorMode === 'dark' ? {
3054
3057
  ...base,
@@ -3060,7 +3063,8 @@ function selectStyles(colorMode, _isError) {
3060
3063
  } : {
3061
3064
  ...base,
3062
3065
  ...selectStyle,
3063
- boxShadow: state.isFocused ? 'none' : colors.neutral['500']
3066
+ borderWidth: 0,
3067
+ boxShadow: boxShadowLight(state.isFocused, _isError)
3064
3068
  },
3065
3069
  option: (base, {
3066
3070
  isSelected
@@ -3114,6 +3118,13 @@ function selectStyles(colorMode, _isError) {
3114
3118
  } : {
3115
3119
  ...base,
3116
3120
  ...selectStyle
3121
+ },
3122
+ placeholder: base => {
3123
+ return {
3124
+ ...base,
3125
+ ...selectStyle,
3126
+ color: colors.black.low
3127
+ };
3117
3128
  }
3118
3129
  };
3119
3130
  }
@@ -3145,7 +3156,7 @@ function Select({
3145
3156
  classNamePrefix: "react-select"
3146
3157
  }, rest, {
3147
3158
  styles: {
3148
- ...selectStyles(colorMode)
3159
+ ...selectStyles(colorMode, isError)
3149
3160
  },
3150
3161
  theme: themeSelect
3151
3162
  })));
@@ -3165,7 +3176,7 @@ function SelectAsync({
3165
3176
  classNamePrefix: "react-select"
3166
3177
  }, rest, {
3167
3178
  styles: {
3168
- ...selectStyles(colorMode),
3179
+ ...selectStyles(colorMode, isError),
3169
3180
  ...styles
3170
3181
  },
3171
3182
  theme: themeSelect
@@ -3186,7 +3197,7 @@ function SelectAsyncCreatable({
3186
3197
  classNamePrefix: "react-select"
3187
3198
  }, rest, {
3188
3199
  styles: {
3189
- ...selectStyles(colorMode),
3200
+ ...selectStyles(colorMode, isError),
3190
3201
  ...styles
3191
3202
  },
3192
3203
  theme: themeSelect
@@ -3207,7 +3218,7 @@ function SelectCreatable({
3207
3218
  classNamePrefix: "react-select"
3208
3219
  }, rest, {
3209
3220
  styles: {
3210
- ...selectStyles(colorMode),
3221
+ ...selectStyles(colorMode, isError),
3211
3222
  ...styles
3212
3223
  },
3213
3224
  theme: themeSelect