@ctlyst.id/internal-ui 2.0.14 → 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,20 +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
- .react-select__control:hover {
3040
- border-color: ${isError ? colors.danger['500'] : colors.primary['500']} !important;
3041
- }
3042
- `
3043
- }, children);
3032
+ return /*#__PURE__*/React__default.createElement(Box, null, children);
3044
3033
  };
3045
3034
  SelectWrapper.defaultProps = {
3046
3035
  isError: false
@@ -3052,7 +3041,17 @@ const selectStyle = {
3052
3041
  lineHeight: styleMd.lineHeight,
3053
3042
  letterSpacing: 0
3054
3043
  };
3044
+ const boxShadow = color => `0 0 0 1px ${color}`;
3055
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
+ };
3056
3055
  return {
3057
3056
  control: (base, state) => colorMode === 'dark' ? {
3058
3057
  ...base,
@@ -3064,7 +3063,8 @@ function selectStyles(colorMode, _isError) {
3064
3063
  } : {
3065
3064
  ...base,
3066
3065
  ...selectStyle,
3067
- boxShadow: state.isFocused ? 'none' : colors.neutral['500']
3066
+ borderWidth: 0,
3067
+ boxShadow: boxShadowLight(state.isFocused, _isError)
3068
3068
  },
3069
3069
  option: (base, {
3070
3070
  isSelected
@@ -3149,7 +3149,7 @@ function Select({
3149
3149
  classNamePrefix: "react-select"
3150
3150
  }, rest, {
3151
3151
  styles: {
3152
- ...selectStyles(colorMode)
3152
+ ...selectStyles(colorMode, isError)
3153
3153
  },
3154
3154
  theme: themeSelect
3155
3155
  })));
@@ -3169,7 +3169,7 @@ function SelectAsync({
3169
3169
  classNamePrefix: "react-select"
3170
3170
  }, rest, {
3171
3171
  styles: {
3172
- ...selectStyles(colorMode),
3172
+ ...selectStyles(colorMode, isError),
3173
3173
  ...styles
3174
3174
  },
3175
3175
  theme: themeSelect
@@ -3190,7 +3190,7 @@ function SelectAsyncCreatable({
3190
3190
  classNamePrefix: "react-select"
3191
3191
  }, rest, {
3192
3192
  styles: {
3193
- ...selectStyles(colorMode),
3193
+ ...selectStyles(colorMode, isError),
3194
3194
  ...styles
3195
3195
  },
3196
3196
  theme: themeSelect
@@ -3211,7 +3211,7 @@ function SelectCreatable({
3211
3211
  classNamePrefix: "react-select"
3212
3212
  }, rest, {
3213
3213
  styles: {
3214
- ...selectStyles(colorMode),
3214
+ ...selectStyles(colorMode, isError),
3215
3215
  ...styles
3216
3216
  },
3217
3217
  theme: themeSelect