@shoplflow/base 0.37.5 → 0.38.0

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.
package/dist/index.cjs CHANGED
@@ -2935,12 +2935,15 @@ var getDropdownIconSizeBySizeVar = (size2) => {
2935
2935
  `;
2936
2936
  }
2937
2937
  };
2938
- var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
2938
+ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled, sizeVar }) => {
2939
2939
  if (!disabled) {
2940
2940
  if (isError) {
2941
2941
  return exports.colorTokens.red300;
2942
2942
  }
2943
2943
  if (isFocused) {
2944
+ if (sizeVar === "L") {
2945
+ return exports.colorTokens.neutral700;
2946
+ }
2944
2947
  return exports.colorTokens.primary300;
2945
2948
  }
2946
2949
  if (isHovered) {
@@ -2949,13 +2952,18 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
2949
2952
  }
2950
2953
  return exports.colorTokens.neutral300;
2951
2954
  };
2952
- var getButtoWrapperStyleBySizeVar = (sizeVar) => {
2955
+ var getButtonWrapperStyleBySizeVar = ({ sizeVar, isFocused }) => {
2953
2956
  switch (sizeVar) {
2954
2957
  case "L":
2955
2958
  return react$1.css`
2956
2959
  background-color: transparent;
2957
- border-width: 2px;
2960
+ border-width: ${isFocused ? "2px" : "1px"};
2961
+ transition: border-width 0.2s ease-in-out;
2958
2962
  border-radius: 12px;
2963
+
2964
+ &:hover {
2965
+ border-width: 2px;
2966
+ }
2959
2967
  `;
2960
2968
  default:
2961
2969
  return react$1.css`
@@ -2983,16 +2991,16 @@ var StyledDropdownButtonWrapper = styled6__default.default.label`
2983
2991
  max-height: initial;
2984
2992
  min-width: initial;
2985
2993
  max-width: initial;
2994
+ justify-content: space-between;
2995
+ border-style: solid;
2996
+ overflow: hidden;
2997
+ border-color: ${(props) => getBorderColorByStatus(props)};
2986
2998
  ${({ height, width }) => getStyleByType({
2987
2999
  height,
2988
3000
  width
2989
3001
  })};
2990
- justify-content: space-between;
2991
- border-color: ${(props) => getBorderColorByStatus(props)};
2992
- border-style: solid;
2993
- ${({ sizeVar }) => getButtoWrapperStyleBySizeVar(sizeVar)};
3002
+ ${(props) => getButtonWrapperStyleBySizeVar(props)};
2994
3003
 
2995
- overflow: hidden;
2996
3004
  ${({ disabled }) => getDisabledStyle2(disabled)};
2997
3005
  `;
2998
3006
  var StyledDropdownButton = styled6__default.default.button`
@@ -3556,12 +3564,15 @@ var assetFunction = (iconName, domainProps) => {
3556
3564
  const ShoplIcon = ShoplAssets__namespace[iconName];
3557
3565
  return domain === "hada" ? HadaIcon : ShoplIcon;
3558
3566
  };
3559
- var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled }) => {
3567
+ var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled, focusedBorderColor }) => {
3560
3568
  if (!disabled) {
3561
3569
  if (isError) {
3562
3570
  return exports.colorTokens.red300;
3563
3571
  }
3564
3572
  if (isFocused) {
3573
+ if (focusedBorderColor) {
3574
+ return exports.colorTokens[focusedBorderColor];
3575
+ }
3565
3576
  return exports.colorTokens.primary300;
3566
3577
  }
3567
3578
  if (isHovered) {
@@ -3963,7 +3974,7 @@ var InputButton = React3.forwardRef(
3963
3974
  }
3964
3975
  );
3965
3976
  exports.InputButton = InputButton;
3966
- var BottomElementWrapper = styled6__default.default.div`
3977
+ styled6__default.default.div`
3967
3978
  display: flex;
3968
3979
  width: 100%;
3969
3980
  flex-direction: row;
@@ -3976,14 +3987,29 @@ var StyledTextarea = styled6__default.default.textarea`
3976
3987
  background-color: transparent;
3977
3988
  resize: none;
3978
3989
  width: 100%;
3979
- height: 100%;
3980
3990
  flex: 1;
3981
3991
  word-break: break-all;
3992
+ overflow-y: auto;
3982
3993
  ${({ disabled }) => getDisabledStyle(disabled)};
3983
3994
  &::placeholder {
3984
3995
  color: ${exports.colorTokens.neutral350};
3985
3996
  }
3986
3997
  `;
3998
+ var TextAreaContext = React3.createContext(null);
3999
+ var useTextArea = () => {
4000
+ const context = React3.useContext(TextAreaContext);
4001
+ if (!context) {
4002
+ throw new Error("useTextArea must be used within a TextAreaProvider");
4003
+ }
4004
+ return context;
4005
+ };
4006
+ var MaxLength = () => {
4007
+ const { text, maxLength } = useTextArea();
4008
+ if (!maxLength) {
4009
+ return null;
4010
+ }
4011
+ return /* @__PURE__ */ jsxRuntime.jsx(StackContainer, { padding: "0 0 0 4px", children: /* @__PURE__ */ jsxRuntime.jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) });
4012
+ };
3987
4013
  var TextArea = React3.forwardRef(
3988
4014
  (_a, ref) => {
3989
4015
  var _b = _a, {
@@ -4000,7 +4026,10 @@ var TextArea = React3.forwardRef(
4000
4026
  minHeight = "100px",
4001
4027
  width,
4002
4028
  height,
4003
- className
4029
+ className,
4030
+ focusedBorderColor = "primary300",
4031
+ leftSource,
4032
+ rightSource
4004
4033
  } = _b, rest = __objRest(_b, [
4005
4034
  "name",
4006
4035
  "maxLength",
@@ -4015,7 +4044,10 @@ var TextArea = React3.forwardRef(
4015
4044
  "minHeight",
4016
4045
  "width",
4017
4046
  "height",
4018
- "className"
4047
+ "className",
4048
+ "focusedBorderColor",
4049
+ "leftSource",
4050
+ "rightSource"
4019
4051
  ]);
4020
4052
  const [text, setText] = React3.useState("");
4021
4053
  const [isFocused, setIsFocused] = React3.useState(false);
@@ -4063,7 +4095,11 @@ var TextArea = React3.forwardRef(
4063
4095
  }
4064
4096
  }, [maxLength, value]);
4065
4097
  const uniqueId = React3.useId();
4066
- return /* @__PURE__ */ jsxRuntime.jsxs(
4098
+ const contextValue = {
4099
+ text,
4100
+ maxLength
4101
+ };
4102
+ return /* @__PURE__ */ jsxRuntime.jsx(TextAreaContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
4067
4103
  InputWrapper,
4068
4104
  {
4069
4105
  htmlFor: uniqueId,
@@ -4079,11 +4115,12 @@ var TextArea = React3.forwardRef(
4079
4115
  width,
4080
4116
  gap: "0",
4081
4117
  "data-shoplflow": "text-area",
4118
+ focusedBorderColor,
4082
4119
  children: [
4083
4120
  /* @__PURE__ */ jsxRuntime.jsx(
4084
4121
  StyledTextarea,
4085
4122
  __spreadValues({
4086
- className: "body1_400" + (className ? ` ${className}` : ""),
4123
+ className: "paragraph1" + (className ? ` ${className}` : ""),
4087
4124
  placeholder,
4088
4125
  onFocus: handleOnFocus,
4089
4126
  onBlur: handleOnBlur,
@@ -4096,12 +4133,26 @@ var TextArea = React3.forwardRef(
4096
4133
  disabled
4097
4134
  }, rest)
4098
4135
  ),
4099
- /* @__PURE__ */ jsxRuntime.jsx(BottomElementWrapper, { children: maxLength && /* @__PURE__ */ jsxRuntime.jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) })
4136
+ !leftSource && !rightSource ? /* @__PURE__ */ jsxRuntime.jsx(StackContainer.Horizontal, { padding: "8px", width: "100%", justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(StackContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(MaxLength, {}) }) }) : /* @__PURE__ */ jsxRuntime.jsxs(
4137
+ StackContainer.Horizontal,
4138
+ {
4139
+ padding: "8px",
4140
+ width: "100%",
4141
+ align: "center",
4142
+ justify: "space-between",
4143
+ style: { visibility: disabled ? "hidden" : "visible" },
4144
+ children: [
4145
+ leftSource,
4146
+ rightSource
4147
+ ]
4148
+ }
4149
+ )
4100
4150
  ]
4101
4151
  }
4102
- );
4152
+ ) });
4103
4153
  }
4104
4154
  );
4155
+ TextArea.MaxLength = MaxLength;
4105
4156
  exports.TextArea = TextArea;
4106
4157
  var StyledSelectInputButton = styled6__default.default.div`
4107
4158
  display: flex;
package/dist/index.d.cts CHANGED
@@ -1139,23 +1139,42 @@ interface InputButtonOptionProps extends Omit<InputHTMLAttributes<HTMLInputEleme
1139
1139
  declare const InputButton: React__default.ForwardRefExoticComponent<InputButtonProps & React__default.RefAttributes<HTMLInputElement>>;
1140
1140
 
1141
1141
  interface TextAreaOptionProps extends DisableProps, ErrorProps {
1142
+ /**
1143
+ * TextArea의 너비를 설정합니다.
1144
+ */
1142
1145
  width?: string;
1143
1146
  /**
1144
- * maxLength를 설정해요.
1147
+ * maxLength를 설정합니다.
1145
1148
  */
1146
1149
  maxLength?: number;
1147
1150
  /**
1148
- * text area의 높이를 조절해요.
1151
+ * TextArea의 높이를 설정합니다.
1149
1152
  */
1150
1153
  height?: string;
1151
1154
  /**
1152
- * text area의 최소 높이를 조절해요.
1155
+ * TextArea의 최소 높이를 설정합니다.
1153
1156
  */
1154
1157
  minHeight?: string;
1158
+ /**
1159
+ * focused 상태일 때의 border-color를 설정합니다.
1160
+ */
1161
+ focusedBorderColor?: ColorTokens;
1162
+ /**
1163
+ * TextArea Toolbar의 왼쪽 요소를 설정합니다.
1164
+ */
1165
+ leftSource?: ReactElement;
1166
+ /**
1167
+ * TextArea Toolbar의 오른쪽 요소를 설정합니다.
1168
+ */
1169
+ rightSource?: ReactElement;
1155
1170
  }
1156
1171
  declare type TextAreaProps = ComponentPropsWithoutRef<'textarea'> & TextAreaOptionProps;
1157
1172
 
1158
- declare const TextArea: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & TextAreaOptionProps & React__default.RefAttributes<HTMLTextAreaElement>>;
1173
+ declare const MaxLength: () => react_jsx_runtime.JSX.Element | null;
1174
+ declare type TextAreaComponent = React__default.ForwardRefExoticComponent<TextAreaProps & React__default.RefAttributes<HTMLTextAreaElement>> & {
1175
+ MaxLength: typeof MaxLength;
1176
+ };
1177
+ declare const TextArea: TextAreaComponent;
1159
1178
 
1160
1179
  interface SelectInputButtonProps extends SelectInputButtonOptionProps {
1161
1180
  }
package/dist/index.d.ts CHANGED
@@ -1139,23 +1139,42 @@ interface InputButtonOptionProps extends Omit<InputHTMLAttributes<HTMLInputEleme
1139
1139
  declare const InputButton: React__default.ForwardRefExoticComponent<InputButtonProps & React__default.RefAttributes<HTMLInputElement>>;
1140
1140
 
1141
1141
  interface TextAreaOptionProps extends DisableProps, ErrorProps {
1142
+ /**
1143
+ * TextArea의 너비를 설정합니다.
1144
+ */
1142
1145
  width?: string;
1143
1146
  /**
1144
- * maxLength를 설정해요.
1147
+ * maxLength를 설정합니다.
1145
1148
  */
1146
1149
  maxLength?: number;
1147
1150
  /**
1148
- * text area의 높이를 조절해요.
1151
+ * TextArea의 높이를 설정합니다.
1149
1152
  */
1150
1153
  height?: string;
1151
1154
  /**
1152
- * text area의 최소 높이를 조절해요.
1155
+ * TextArea의 최소 높이를 설정합니다.
1153
1156
  */
1154
1157
  minHeight?: string;
1158
+ /**
1159
+ * focused 상태일 때의 border-color를 설정합니다.
1160
+ */
1161
+ focusedBorderColor?: ColorTokens;
1162
+ /**
1163
+ * TextArea Toolbar의 왼쪽 요소를 설정합니다.
1164
+ */
1165
+ leftSource?: ReactElement;
1166
+ /**
1167
+ * TextArea Toolbar의 오른쪽 요소를 설정합니다.
1168
+ */
1169
+ rightSource?: ReactElement;
1155
1170
  }
1156
1171
  declare type TextAreaProps = ComponentPropsWithoutRef<'textarea'> & TextAreaOptionProps;
1157
1172
 
1158
- declare const TextArea: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & TextAreaOptionProps & React__default.RefAttributes<HTMLTextAreaElement>>;
1173
+ declare const MaxLength: () => react_jsx_runtime.JSX.Element | null;
1174
+ declare type TextAreaComponent = React__default.ForwardRefExoticComponent<TextAreaProps & React__default.RefAttributes<HTMLTextAreaElement>> & {
1175
+ MaxLength: typeof MaxLength;
1176
+ };
1177
+ declare const TextArea: TextAreaComponent;
1159
1178
 
1160
1179
  interface SelectInputButtonProps extends SelectInputButtonOptionProps {
1161
1180
  }
package/dist/index.js CHANGED
@@ -2908,12 +2908,15 @@ var getDropdownIconSizeBySizeVar = (size2) => {
2908
2908
  `;
2909
2909
  }
2910
2910
  };
2911
- var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
2911
+ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled, sizeVar }) => {
2912
2912
  if (!disabled) {
2913
2913
  if (isError) {
2914
2914
  return colorTokens.red300;
2915
2915
  }
2916
2916
  if (isFocused) {
2917
+ if (sizeVar === "L") {
2918
+ return colorTokens.neutral700;
2919
+ }
2917
2920
  return colorTokens.primary300;
2918
2921
  }
2919
2922
  if (isHovered) {
@@ -2922,13 +2925,18 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
2922
2925
  }
2923
2926
  return colorTokens.neutral300;
2924
2927
  };
2925
- var getButtoWrapperStyleBySizeVar = (sizeVar) => {
2928
+ var getButtonWrapperStyleBySizeVar = ({ sizeVar, isFocused }) => {
2926
2929
  switch (sizeVar) {
2927
2930
  case "L":
2928
2931
  return css`
2929
2932
  background-color: transparent;
2930
- border-width: 2px;
2933
+ border-width: ${isFocused ? "2px" : "1px"};
2934
+ transition: border-width 0.2s ease-in-out;
2931
2935
  border-radius: 12px;
2936
+
2937
+ &:hover {
2938
+ border-width: 2px;
2939
+ }
2932
2940
  `;
2933
2941
  default:
2934
2942
  return css`
@@ -2956,16 +2964,16 @@ var StyledDropdownButtonWrapper = styled6.label`
2956
2964
  max-height: initial;
2957
2965
  min-width: initial;
2958
2966
  max-width: initial;
2967
+ justify-content: space-between;
2968
+ border-style: solid;
2969
+ overflow: hidden;
2970
+ border-color: ${(props) => getBorderColorByStatus(props)};
2959
2971
  ${({ height, width }) => getStyleByType({
2960
2972
  height,
2961
2973
  width
2962
2974
  })};
2963
- justify-content: space-between;
2964
- border-color: ${(props) => getBorderColorByStatus(props)};
2965
- border-style: solid;
2966
- ${({ sizeVar }) => getButtoWrapperStyleBySizeVar(sizeVar)};
2975
+ ${(props) => getButtonWrapperStyleBySizeVar(props)};
2967
2976
 
2968
- overflow: hidden;
2969
2977
  ${({ disabled }) => getDisabledStyle2(disabled)};
2970
2978
  `;
2971
2979
  var StyledDropdownButton = styled6.button`
@@ -3529,12 +3537,15 @@ var assetFunction = (iconName, domainProps) => {
3529
3537
  const ShoplIcon = ShoplAssets[iconName];
3530
3538
  return domain === "hada" ? HadaIcon : ShoplIcon;
3531
3539
  };
3532
- var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled }) => {
3540
+ var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled, focusedBorderColor }) => {
3533
3541
  if (!disabled) {
3534
3542
  if (isError) {
3535
3543
  return colorTokens.red300;
3536
3544
  }
3537
3545
  if (isFocused) {
3546
+ if (focusedBorderColor) {
3547
+ return colorTokens[focusedBorderColor];
3548
+ }
3538
3549
  return colorTokens.primary300;
3539
3550
  }
3540
3551
  if (isHovered) {
@@ -3936,7 +3947,7 @@ var InputButton = forwardRef(
3936
3947
  }
3937
3948
  );
3938
3949
  var InputButton_default = InputButton;
3939
- var BottomElementWrapper = styled6.div`
3950
+ styled6.div`
3940
3951
  display: flex;
3941
3952
  width: 100%;
3942
3953
  flex-direction: row;
@@ -3949,14 +3960,29 @@ var StyledTextarea = styled6.textarea`
3949
3960
  background-color: transparent;
3950
3961
  resize: none;
3951
3962
  width: 100%;
3952
- height: 100%;
3953
3963
  flex: 1;
3954
3964
  word-break: break-all;
3965
+ overflow-y: auto;
3955
3966
  ${({ disabled }) => getDisabledStyle(disabled)};
3956
3967
  &::placeholder {
3957
3968
  color: ${colorTokens.neutral350};
3958
3969
  }
3959
3970
  `;
3971
+ var TextAreaContext = createContext(null);
3972
+ var useTextArea = () => {
3973
+ const context = useContext(TextAreaContext);
3974
+ if (!context) {
3975
+ throw new Error("useTextArea must be used within a TextAreaProvider");
3976
+ }
3977
+ return context;
3978
+ };
3979
+ var MaxLength = () => {
3980
+ const { text, maxLength } = useTextArea();
3981
+ if (!maxLength) {
3982
+ return null;
3983
+ }
3984
+ return /* @__PURE__ */ jsx(StackContainer, { padding: "0 0 0 4px", children: /* @__PURE__ */ jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) });
3985
+ };
3960
3986
  var TextArea = forwardRef(
3961
3987
  (_a, ref) => {
3962
3988
  var _b = _a, {
@@ -3973,7 +3999,10 @@ var TextArea = forwardRef(
3973
3999
  minHeight = "100px",
3974
4000
  width,
3975
4001
  height,
3976
- className
4002
+ className,
4003
+ focusedBorderColor = "primary300",
4004
+ leftSource,
4005
+ rightSource
3977
4006
  } = _b, rest = __objRest(_b, [
3978
4007
  "name",
3979
4008
  "maxLength",
@@ -3988,7 +4017,10 @@ var TextArea = forwardRef(
3988
4017
  "minHeight",
3989
4018
  "width",
3990
4019
  "height",
3991
- "className"
4020
+ "className",
4021
+ "focusedBorderColor",
4022
+ "leftSource",
4023
+ "rightSource"
3992
4024
  ]);
3993
4025
  const [text, setText] = useState("");
3994
4026
  const [isFocused, setIsFocused] = useState(false);
@@ -4036,7 +4068,11 @@ var TextArea = forwardRef(
4036
4068
  }
4037
4069
  }, [maxLength, value]);
4038
4070
  const uniqueId = useId();
4039
- return /* @__PURE__ */ jsxs(
4071
+ const contextValue = {
4072
+ text,
4073
+ maxLength
4074
+ };
4075
+ return /* @__PURE__ */ jsx(TextAreaContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(
4040
4076
  InputWrapper,
4041
4077
  {
4042
4078
  htmlFor: uniqueId,
@@ -4052,11 +4088,12 @@ var TextArea = forwardRef(
4052
4088
  width,
4053
4089
  gap: "0",
4054
4090
  "data-shoplflow": "text-area",
4091
+ focusedBorderColor,
4055
4092
  children: [
4056
4093
  /* @__PURE__ */ jsx(
4057
4094
  StyledTextarea,
4058
4095
  __spreadValues({
4059
- className: "body1_400" + (className ? ` ${className}` : ""),
4096
+ className: "paragraph1" + (className ? ` ${className}` : ""),
4060
4097
  placeholder,
4061
4098
  onFocus: handleOnFocus,
4062
4099
  onBlur: handleOnBlur,
@@ -4069,12 +4106,26 @@ var TextArea = forwardRef(
4069
4106
  disabled
4070
4107
  }, rest)
4071
4108
  ),
4072
- /* @__PURE__ */ jsx(BottomElementWrapper, { children: maxLength && /* @__PURE__ */ jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) })
4109
+ !leftSource && !rightSource ? /* @__PURE__ */ jsx(StackContainer.Horizontal, { padding: "8px", width: "100%", justify: "flex-end", children: /* @__PURE__ */ jsx(StackContainer, { children: /* @__PURE__ */ jsx(MaxLength, {}) }) }) : /* @__PURE__ */ jsxs(
4110
+ StackContainer.Horizontal,
4111
+ {
4112
+ padding: "8px",
4113
+ width: "100%",
4114
+ align: "center",
4115
+ justify: "space-between",
4116
+ style: { visibility: disabled ? "hidden" : "visible" },
4117
+ children: [
4118
+ leftSource,
4119
+ rightSource
4120
+ ]
4121
+ }
4122
+ )
4073
4123
  ]
4074
4124
  }
4075
- );
4125
+ ) });
4076
4126
  }
4077
4127
  );
4128
+ TextArea.MaxLength = MaxLength;
4078
4129
  var TextArea_default = TextArea;
4079
4130
  var StyledSelectInputButton = styled6.div`
4080
4131
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplflow/base",
3
- "version": "0.37.5",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -90,9 +90,9 @@
90
90
  "react-datepicker": "^7.3.0",
91
91
  "react-dom": "^18.2.0",
92
92
  "simplebar-react": "^3.2.6",
93
- "@shoplflow/hada-assets": "^0.1.3",
94
93
  "@shoplflow/shopl-assets": "^0.12.8",
95
- "@shoplflow/utils": "^0.6.5"
94
+ "@shoplflow/utils": "^0.6.5",
95
+ "@shoplflow/hada-assets": "^0.1.3"
96
96
  },
97
97
  "scripts": {
98
98
  "type-check": "tsc --noEmit",