@ctlyst.id/internal-ui 2.0.15 → 2.0.16

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.
@@ -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
@@ -3145,7 +3149,7 @@ function Select({
3145
3149
  classNamePrefix: "react-select"
3146
3150
  }, rest, {
3147
3151
  styles: {
3148
- ...selectStyles(colorMode)
3152
+ ...selectStyles(colorMode, isError)
3149
3153
  },
3150
3154
  theme: themeSelect
3151
3155
  })));
@@ -3165,7 +3169,7 @@ function SelectAsync({
3165
3169
  classNamePrefix: "react-select"
3166
3170
  }, rest, {
3167
3171
  styles: {
3168
- ...selectStyles(colorMode),
3172
+ ...selectStyles(colorMode, isError),
3169
3173
  ...styles
3170
3174
  },
3171
3175
  theme: themeSelect
@@ -3186,7 +3190,7 @@ function SelectAsyncCreatable({
3186
3190
  classNamePrefix: "react-select"
3187
3191
  }, rest, {
3188
3192
  styles: {
3189
- ...selectStyles(colorMode),
3193
+ ...selectStyles(colorMode, isError),
3190
3194
  ...styles
3191
3195
  },
3192
3196
  theme: themeSelect
@@ -3207,7 +3211,7 @@ function SelectCreatable({
3207
3211
  classNamePrefix: "react-select"
3208
3212
  }, rest, {
3209
3213
  styles: {
3210
- ...selectStyles(colorMode),
3214
+ ...selectStyles(colorMode, isError),
3211
3215
  ...styles
3212
3216
  },
3213
3217
  theme: themeSelect