@shoplflow/base 0.30.0 → 0.30.1
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 +145 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +146 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3996,6 +3996,151 @@ var Pagination = (_a) => {
|
|
|
3996
3996
|
};
|
|
3997
3997
|
Pagination.SizeSelector = PaginationSizeSelector_default;
|
|
3998
3998
|
exports.Pagination = Pagination;
|
|
3999
|
+
var getLabelStyleByStatus = (selected, disabled) => {
|
|
4000
|
+
if (disabled) {
|
|
4001
|
+
return react$1.css`
|
|
4002
|
+
cursor: not-allowed;
|
|
4003
|
+
opacity: 0.5;
|
|
4004
|
+
`;
|
|
4005
|
+
}
|
|
4006
|
+
if (selected) {
|
|
4007
|
+
return react$1.css`
|
|
4008
|
+
cursor: default;
|
|
4009
|
+
background-color: ${exports.colorTokens.neutral0};
|
|
4010
|
+
`;
|
|
4011
|
+
}
|
|
4012
|
+
};
|
|
4013
|
+
var getLabelStyleBySizeVar = (sizeVar) => {
|
|
4014
|
+
switch (sizeVar) {
|
|
4015
|
+
case "S": {
|
|
4016
|
+
return react$1.css`
|
|
4017
|
+
padding: 4px 8px;
|
|
4018
|
+
`;
|
|
4019
|
+
}
|
|
4020
|
+
case "M": {
|
|
4021
|
+
return react$1.css`
|
|
4022
|
+
padding: 8px;
|
|
4023
|
+
`;
|
|
4024
|
+
}
|
|
4025
|
+
default: {
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
};
|
|
4030
|
+
var StyledToggleButton = styled6__default.default.div`
|
|
4031
|
+
display: flex;
|
|
4032
|
+
padding: ${exports.spacingTokens.spacing04};
|
|
4033
|
+
align-items: center;
|
|
4034
|
+
background-color: ${exports.colorTokens.neutral150};
|
|
4035
|
+
border-radius: ${exports.borderRadiusTokens.borderRadius06};
|
|
4036
|
+
`;
|
|
4037
|
+
var StyledToggleInner = styled6__default.default.button`
|
|
4038
|
+
height: fit-content;
|
|
4039
|
+
width: fit-content;
|
|
4040
|
+
cursor: pointer;
|
|
4041
|
+
|
|
4042
|
+
& input:checked + label {
|
|
4043
|
+
background-color: ${exports.colorTokens.neutral0};
|
|
4044
|
+
cursor: default;
|
|
4045
|
+
}
|
|
4046
|
+
`;
|
|
4047
|
+
var StyledToggleInnerLabel = styled6__default.default.label`
|
|
4048
|
+
display: flex;
|
|
4049
|
+
align-items: center;
|
|
4050
|
+
justify-content: center;
|
|
4051
|
+
min-width: ${({ width }) => `${width}px`};
|
|
4052
|
+
padding: 0 12px;
|
|
4053
|
+
border-radius: 6px;
|
|
4054
|
+
background-color: transparent;
|
|
4055
|
+
${({ disabled, selected }) => getLabelStyleByStatus(selected, Boolean(disabled))}
|
|
4056
|
+
${({ sizeVar }) => getLabelStyleBySizeVar(sizeVar)}
|
|
4057
|
+
|
|
4058
|
+
&:hover {
|
|
4059
|
+
${({ disabled }) => !disabled && react$1.css`
|
|
4060
|
+
cursor: pointer;
|
|
4061
|
+
background-color: ${exports.colorTokens.neutral400_5};
|
|
4062
|
+
`}
|
|
4063
|
+
}
|
|
4064
|
+
`;
|
|
4065
|
+
var StyledToggleInnerInput = styled6__default.default.input`
|
|
4066
|
+
position: absolute;
|
|
4067
|
+
width: 0;
|
|
4068
|
+
height: 0;
|
|
4069
|
+
opacity: 0;
|
|
4070
|
+
visibility: hidden;
|
|
4071
|
+
`;
|
|
4072
|
+
var ToggleButtonContext = React3.createContext(null);
|
|
4073
|
+
var useToggleButton = () => {
|
|
4074
|
+
const context = React3.useContext(ToggleButtonContext);
|
|
4075
|
+
if (!context) {
|
|
4076
|
+
throw new Error("ToggleInnerButton \uCEF4\uD3EC\uB10C\uD2B8\uB294 ToggleButton \uB0B4\uBD80\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC8FC\uC138\uC694");
|
|
4077
|
+
}
|
|
4078
|
+
return context;
|
|
4079
|
+
};
|
|
4080
|
+
var ToggleButton = (_a) => {
|
|
4081
|
+
var _b = _a, {
|
|
4082
|
+
fixedWidth,
|
|
4083
|
+
children,
|
|
4084
|
+
targetName,
|
|
4085
|
+
onChange,
|
|
4086
|
+
selectedValue,
|
|
4087
|
+
sizeVar = "S"
|
|
4088
|
+
} = _b, rest = __objRest(_b, [
|
|
4089
|
+
"fixedWidth",
|
|
4090
|
+
"children",
|
|
4091
|
+
"targetName",
|
|
4092
|
+
"onChange",
|
|
4093
|
+
"selectedValue",
|
|
4094
|
+
"sizeVar"
|
|
4095
|
+
]);
|
|
4096
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToggleButtonContext.Provider, { value: { fixedWidth, targetName, onChange, selectedValue, sizeVar }, children: /* @__PURE__ */ jsxRuntime.jsx(StyledToggleButton, __spreadProps(__spreadValues({ "data-shoplflow": "ToggleButton" }, rest), { children })) });
|
|
4097
|
+
};
|
|
4098
|
+
var ToggleInnerRadio = React3.forwardRef(
|
|
4099
|
+
(_a, ref) => {
|
|
4100
|
+
var _b = _a, { label, disabled, value, id } = _b, rest = __objRest(_b, ["label", "disabled", "value", "id"]);
|
|
4101
|
+
const { fixedWidth, onChange, targetName, selectedValue, sizeVar } = useToggleButton();
|
|
4102
|
+
let selected = false;
|
|
4103
|
+
if (selectedValue && selectedValue === value) {
|
|
4104
|
+
selected = true;
|
|
4105
|
+
}
|
|
4106
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StyledToggleInner, { disabled, children: [
|
|
4107
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4108
|
+
StyledToggleInnerInput,
|
|
4109
|
+
__spreadProps(__spreadValues({
|
|
4110
|
+
width: fixedWidth,
|
|
4111
|
+
disabled,
|
|
4112
|
+
selected,
|
|
4113
|
+
value,
|
|
4114
|
+
id,
|
|
4115
|
+
type: "radio",
|
|
4116
|
+
ref,
|
|
4117
|
+
name: targetName
|
|
4118
|
+
}, rest), {
|
|
4119
|
+
onChange
|
|
4120
|
+
})
|
|
4121
|
+
),
|
|
4122
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4123
|
+
StyledToggleInnerLabel,
|
|
4124
|
+
{
|
|
4125
|
+
htmlFor: id,
|
|
4126
|
+
width: fixedWidth,
|
|
4127
|
+
disabled,
|
|
4128
|
+
selected,
|
|
4129
|
+
sizeVar,
|
|
4130
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { lineClamp: 1, wordBreak: "break-all", typography: "body2_400", children: label })
|
|
4131
|
+
}
|
|
4132
|
+
)
|
|
4133
|
+
] });
|
|
4134
|
+
}
|
|
4135
|
+
);
|
|
4136
|
+
ToggleButton.InnerRadio = ToggleInnerRadio;
|
|
4137
|
+
exports.ToggleButton = ToggleButton;
|
|
4138
|
+
|
|
4139
|
+
// src/components/ToggleButton/ToggleButton.types.ts
|
|
4140
|
+
exports.ToggleButtonSizeVariants = {
|
|
4141
|
+
S: "S",
|
|
4142
|
+
M: "M"
|
|
4143
|
+
};
|
|
3999
4144
|
var SpaceMarginWrapper = styled6__default.default(framerMotion.motion.div)`
|
|
4000
4145
|
position: relative;
|
|
4001
4146
|
display: flex;
|