@shoplflow/base 0.37.6 → 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 +52 -9
- package/dist/index.d.cts +23 -4
- package/dist/index.d.ts +23 -4
- package/dist/index.js +52 -9
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3564,12 +3564,15 @@ var assetFunction = (iconName, domainProps) => {
|
|
|
3564
3564
|
const ShoplIcon = ShoplAssets__namespace[iconName];
|
|
3565
3565
|
return domain === "hada" ? HadaIcon : ShoplIcon;
|
|
3566
3566
|
};
|
|
3567
|
-
var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled }) => {
|
|
3567
|
+
var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled, focusedBorderColor }) => {
|
|
3568
3568
|
if (!disabled) {
|
|
3569
3569
|
if (isError) {
|
|
3570
3570
|
return exports.colorTokens.red300;
|
|
3571
3571
|
}
|
|
3572
3572
|
if (isFocused) {
|
|
3573
|
+
if (focusedBorderColor) {
|
|
3574
|
+
return exports.colorTokens[focusedBorderColor];
|
|
3575
|
+
}
|
|
3573
3576
|
return exports.colorTokens.primary300;
|
|
3574
3577
|
}
|
|
3575
3578
|
if (isHovered) {
|
|
@@ -3971,7 +3974,7 @@ var InputButton = React3.forwardRef(
|
|
|
3971
3974
|
}
|
|
3972
3975
|
);
|
|
3973
3976
|
exports.InputButton = InputButton;
|
|
3974
|
-
|
|
3977
|
+
styled6__default.default.div`
|
|
3975
3978
|
display: flex;
|
|
3976
3979
|
width: 100%;
|
|
3977
3980
|
flex-direction: row;
|
|
@@ -3984,14 +3987,29 @@ var StyledTextarea = styled6__default.default.textarea`
|
|
|
3984
3987
|
background-color: transparent;
|
|
3985
3988
|
resize: none;
|
|
3986
3989
|
width: 100%;
|
|
3987
|
-
height: 100%;
|
|
3988
3990
|
flex: 1;
|
|
3989
3991
|
word-break: break-all;
|
|
3992
|
+
overflow-y: auto;
|
|
3990
3993
|
${({ disabled }) => getDisabledStyle(disabled)};
|
|
3991
3994
|
&::placeholder {
|
|
3992
3995
|
color: ${exports.colorTokens.neutral350};
|
|
3993
3996
|
}
|
|
3994
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
|
+
};
|
|
3995
4013
|
var TextArea = React3.forwardRef(
|
|
3996
4014
|
(_a, ref) => {
|
|
3997
4015
|
var _b = _a, {
|
|
@@ -4008,7 +4026,10 @@ var TextArea = React3.forwardRef(
|
|
|
4008
4026
|
minHeight = "100px",
|
|
4009
4027
|
width,
|
|
4010
4028
|
height,
|
|
4011
|
-
className
|
|
4029
|
+
className,
|
|
4030
|
+
focusedBorderColor = "primary300",
|
|
4031
|
+
leftSource,
|
|
4032
|
+
rightSource
|
|
4012
4033
|
} = _b, rest = __objRest(_b, [
|
|
4013
4034
|
"name",
|
|
4014
4035
|
"maxLength",
|
|
@@ -4023,7 +4044,10 @@ var TextArea = React3.forwardRef(
|
|
|
4023
4044
|
"minHeight",
|
|
4024
4045
|
"width",
|
|
4025
4046
|
"height",
|
|
4026
|
-
"className"
|
|
4047
|
+
"className",
|
|
4048
|
+
"focusedBorderColor",
|
|
4049
|
+
"leftSource",
|
|
4050
|
+
"rightSource"
|
|
4027
4051
|
]);
|
|
4028
4052
|
const [text, setText] = React3.useState("");
|
|
4029
4053
|
const [isFocused, setIsFocused] = React3.useState(false);
|
|
@@ -4071,7 +4095,11 @@ var TextArea = React3.forwardRef(
|
|
|
4071
4095
|
}
|
|
4072
4096
|
}, [maxLength, value]);
|
|
4073
4097
|
const uniqueId = React3.useId();
|
|
4074
|
-
|
|
4098
|
+
const contextValue = {
|
|
4099
|
+
text,
|
|
4100
|
+
maxLength
|
|
4101
|
+
};
|
|
4102
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TextAreaContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4075
4103
|
InputWrapper,
|
|
4076
4104
|
{
|
|
4077
4105
|
htmlFor: uniqueId,
|
|
@@ -4087,11 +4115,12 @@ var TextArea = React3.forwardRef(
|
|
|
4087
4115
|
width,
|
|
4088
4116
|
gap: "0",
|
|
4089
4117
|
"data-shoplflow": "text-area",
|
|
4118
|
+
focusedBorderColor,
|
|
4090
4119
|
children: [
|
|
4091
4120
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4092
4121
|
StyledTextarea,
|
|
4093
4122
|
__spreadValues({
|
|
4094
|
-
className: "
|
|
4123
|
+
className: "paragraph1" + (className ? ` ${className}` : ""),
|
|
4095
4124
|
placeholder,
|
|
4096
4125
|
onFocus: handleOnFocus,
|
|
4097
4126
|
onBlur: handleOnBlur,
|
|
@@ -4104,12 +4133,26 @@ var TextArea = React3.forwardRef(
|
|
|
4104
4133
|
disabled
|
|
4105
4134
|
}, rest)
|
|
4106
4135
|
),
|
|
4107
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
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
|
+
)
|
|
4108
4150
|
]
|
|
4109
4151
|
}
|
|
4110
|
-
);
|
|
4152
|
+
) });
|
|
4111
4153
|
}
|
|
4112
4154
|
);
|
|
4155
|
+
TextArea.MaxLength = MaxLength;
|
|
4113
4156
|
exports.TextArea = TextArea;
|
|
4114
4157
|
var StyledSelectInputButton = styled6__default.default.div`
|
|
4115
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
|
-
*
|
|
1151
|
+
* TextArea의 높이를 설정합니다.
|
|
1149
1152
|
*/
|
|
1150
1153
|
height?: string;
|
|
1151
1154
|
/**
|
|
1152
|
-
*
|
|
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
|
|
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
|
-
*
|
|
1151
|
+
* TextArea의 높이를 설정합니다.
|
|
1149
1152
|
*/
|
|
1150
1153
|
height?: string;
|
|
1151
1154
|
/**
|
|
1152
|
-
*
|
|
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
|
|
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
|
@@ -3537,12 +3537,15 @@ var assetFunction = (iconName, domainProps) => {
|
|
|
3537
3537
|
const ShoplIcon = ShoplAssets[iconName];
|
|
3538
3538
|
return domain === "hada" ? HadaIcon : ShoplIcon;
|
|
3539
3539
|
};
|
|
3540
|
-
var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled }) => {
|
|
3540
|
+
var getBorderColorByStatus2 = ({ isFocused, isError, isHovered, disabled, focusedBorderColor }) => {
|
|
3541
3541
|
if (!disabled) {
|
|
3542
3542
|
if (isError) {
|
|
3543
3543
|
return colorTokens.red300;
|
|
3544
3544
|
}
|
|
3545
3545
|
if (isFocused) {
|
|
3546
|
+
if (focusedBorderColor) {
|
|
3547
|
+
return colorTokens[focusedBorderColor];
|
|
3548
|
+
}
|
|
3546
3549
|
return colorTokens.primary300;
|
|
3547
3550
|
}
|
|
3548
3551
|
if (isHovered) {
|
|
@@ -3944,7 +3947,7 @@ var InputButton = forwardRef(
|
|
|
3944
3947
|
}
|
|
3945
3948
|
);
|
|
3946
3949
|
var InputButton_default = InputButton;
|
|
3947
|
-
|
|
3950
|
+
styled6.div`
|
|
3948
3951
|
display: flex;
|
|
3949
3952
|
width: 100%;
|
|
3950
3953
|
flex-direction: row;
|
|
@@ -3957,14 +3960,29 @@ var StyledTextarea = styled6.textarea`
|
|
|
3957
3960
|
background-color: transparent;
|
|
3958
3961
|
resize: none;
|
|
3959
3962
|
width: 100%;
|
|
3960
|
-
height: 100%;
|
|
3961
3963
|
flex: 1;
|
|
3962
3964
|
word-break: break-all;
|
|
3965
|
+
overflow-y: auto;
|
|
3963
3966
|
${({ disabled }) => getDisabledStyle(disabled)};
|
|
3964
3967
|
&::placeholder {
|
|
3965
3968
|
color: ${colorTokens.neutral350};
|
|
3966
3969
|
}
|
|
3967
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
|
+
};
|
|
3968
3986
|
var TextArea = forwardRef(
|
|
3969
3987
|
(_a, ref) => {
|
|
3970
3988
|
var _b = _a, {
|
|
@@ -3981,7 +3999,10 @@ var TextArea = forwardRef(
|
|
|
3981
3999
|
minHeight = "100px",
|
|
3982
4000
|
width,
|
|
3983
4001
|
height,
|
|
3984
|
-
className
|
|
4002
|
+
className,
|
|
4003
|
+
focusedBorderColor = "primary300",
|
|
4004
|
+
leftSource,
|
|
4005
|
+
rightSource
|
|
3985
4006
|
} = _b, rest = __objRest(_b, [
|
|
3986
4007
|
"name",
|
|
3987
4008
|
"maxLength",
|
|
@@ -3996,7 +4017,10 @@ var TextArea = forwardRef(
|
|
|
3996
4017
|
"minHeight",
|
|
3997
4018
|
"width",
|
|
3998
4019
|
"height",
|
|
3999
|
-
"className"
|
|
4020
|
+
"className",
|
|
4021
|
+
"focusedBorderColor",
|
|
4022
|
+
"leftSource",
|
|
4023
|
+
"rightSource"
|
|
4000
4024
|
]);
|
|
4001
4025
|
const [text, setText] = useState("");
|
|
4002
4026
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -4044,7 +4068,11 @@ var TextArea = forwardRef(
|
|
|
4044
4068
|
}
|
|
4045
4069
|
}, [maxLength, value]);
|
|
4046
4070
|
const uniqueId = useId();
|
|
4047
|
-
|
|
4071
|
+
const contextValue = {
|
|
4072
|
+
text,
|
|
4073
|
+
maxLength
|
|
4074
|
+
};
|
|
4075
|
+
return /* @__PURE__ */ jsx(TextAreaContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
4048
4076
|
InputWrapper,
|
|
4049
4077
|
{
|
|
4050
4078
|
htmlFor: uniqueId,
|
|
@@ -4060,11 +4088,12 @@ var TextArea = forwardRef(
|
|
|
4060
4088
|
width,
|
|
4061
4089
|
gap: "0",
|
|
4062
4090
|
"data-shoplflow": "text-area",
|
|
4091
|
+
focusedBorderColor,
|
|
4063
4092
|
children: [
|
|
4064
4093
|
/* @__PURE__ */ jsx(
|
|
4065
4094
|
StyledTextarea,
|
|
4066
4095
|
__spreadValues({
|
|
4067
|
-
className: "
|
|
4096
|
+
className: "paragraph1" + (className ? ` ${className}` : ""),
|
|
4068
4097
|
placeholder,
|
|
4069
4098
|
onFocus: handleOnFocus,
|
|
4070
4099
|
onBlur: handleOnBlur,
|
|
@@ -4077,12 +4106,26 @@ var TextArea = forwardRef(
|
|
|
4077
4106
|
disabled
|
|
4078
4107
|
}, rest)
|
|
4079
4108
|
),
|
|
4080
|
-
/* @__PURE__ */ jsx(
|
|
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
|
+
)
|
|
4081
4123
|
]
|
|
4082
4124
|
}
|
|
4083
|
-
);
|
|
4125
|
+
) });
|
|
4084
4126
|
}
|
|
4085
4127
|
);
|
|
4128
|
+
TextArea.MaxLength = MaxLength;
|
|
4086
4129
|
var TextArea_default = TextArea;
|
|
4087
4130
|
var StyledSelectInputButton = styled6.div`
|
|
4088
4131
|
display: flex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoplflow/base",
|
|
3
|
-
"version": "0.
|
|
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",
|