@shoplflow/base 0.24.4 → 0.24.5
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 +391 -383
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +392 -384
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2021,6 +2021,285 @@ var Dropdown = ({
|
|
|
2021
2021
|
Dropdown.Button = DropdownButton;
|
|
2022
2022
|
Dropdown.Content = DropdownContent;
|
|
2023
2023
|
exports.Dropdown = Dropdown;
|
|
2024
|
+
var Container2 = styled6__default.default.div`
|
|
2025
|
+
width: 32px;
|
|
2026
|
+
height: 32px;
|
|
2027
|
+
padding: 7px;
|
|
2028
|
+
`;
|
|
2029
|
+
var IconButton2 = styled6__default.default.button`
|
|
2030
|
+
display: flex;
|
|
2031
|
+
width: 16px;
|
|
2032
|
+
height: 16px;
|
|
2033
|
+
flex-direction: column;
|
|
2034
|
+
justify-content: center;
|
|
2035
|
+
align-items: center;
|
|
2036
|
+
border-radius: ${exports.borderRadiusTokens.borderRadius04};
|
|
2037
|
+
border: none;
|
|
2038
|
+
background: ${({ color }) => exports.colorTokens[color]};
|
|
2039
|
+
cursor: pointer;
|
|
2040
|
+
transition:
|
|
2041
|
+
transform 0.1s ease-out,
|
|
2042
|
+
background 0.1s ease;
|
|
2043
|
+
|
|
2044
|
+
&:hover {
|
|
2045
|
+
background: ${({ color }) => exports.colorTokens[getNextColor(color, 1)]};
|
|
2046
|
+
}
|
|
2047
|
+
`;
|
|
2048
|
+
var MUNUS_BUTTON_SYMBOL_KEY = Symbol("SHOPLFLOW_MUNUS_BUTTON");
|
|
2049
|
+
var MinusButton = React3.forwardRef((_a, ref) => {
|
|
2050
|
+
var _b = _a, { onClick, color = "neutral300" } = _b, rest = __objRest(_b, ["onClick", "color"]);
|
|
2051
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container2, { "data-shoplflow": "minusButton", children: /* @__PURE__ */ jsxRuntime.jsx(IconButton2, __spreadProps(__spreadValues({ color, onClick, ref }, rest), { children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2052
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2053
|
+
"path",
|
|
2054
|
+
{
|
|
2055
|
+
d: "M0 4C0 1.79086 1.79086 0 4 0H12C14.2091 0 16 1.79086 16 4V12C16 14.2091 14.2091 16 12 16H4C1.79086 16 0 14.2091 0 12V4Z",
|
|
2056
|
+
fill: "none"
|
|
2057
|
+
}
|
|
2058
|
+
),
|
|
2059
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2060
|
+
"path",
|
|
2061
|
+
{
|
|
2062
|
+
fillRule: "evenodd",
|
|
2063
|
+
clipRule: "evenodd",
|
|
2064
|
+
d: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z",
|
|
2065
|
+
fill: "white"
|
|
2066
|
+
}
|
|
2067
|
+
)
|
|
2068
|
+
] }) })) });
|
|
2069
|
+
});
|
|
2070
|
+
MinusButton[MUNUS_BUTTON_SYMBOL_KEY] = true;
|
|
2071
|
+
exports.MinusButton = MinusButton;
|
|
2072
|
+
var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
|
|
2073
|
+
switch (styleVariant) {
|
|
2074
|
+
case "PRIMARY":
|
|
2075
|
+
if (isSelected) {
|
|
2076
|
+
return react$1.css`
|
|
2077
|
+
background: ${exports.colorTokens.primary300};
|
|
2078
|
+
border: 1.5px solid ${exports.colorTokens.primary300};
|
|
2079
|
+
& > svg > path {
|
|
2080
|
+
fill: ${exports.colorTokens.neutral0};
|
|
2081
|
+
}
|
|
2082
|
+
${isHovered && react$1.css`
|
|
2083
|
+
border: 1.5px solid ${exports.colorTokens.primary400};
|
|
2084
|
+
background: ${exports.colorTokens.primary400};
|
|
2085
|
+
`}
|
|
2086
|
+
`;
|
|
2087
|
+
}
|
|
2088
|
+
return react$1.css`
|
|
2089
|
+
background: ${exports.colorTokens.neutral200};
|
|
2090
|
+
border: 1.5px solid ${exports.colorTokens.neutral200};
|
|
2091
|
+
border-radius: 4px;
|
|
2092
|
+
${isHovered && react$1.css`
|
|
2093
|
+
border: 1.5px solid ${exports.colorTokens.neutral300};
|
|
2094
|
+
background: ${exports.colorTokens.neutral300};
|
|
2095
|
+
`}
|
|
2096
|
+
|
|
2097
|
+
& > svg > path {
|
|
2098
|
+
fill: ${exports.colorTokens.neutral0};
|
|
2099
|
+
}
|
|
2100
|
+
`;
|
|
2101
|
+
case "LINE":
|
|
2102
|
+
if (isSelected) {
|
|
2103
|
+
return react$1.css`
|
|
2104
|
+
border: 1.5px solid ${exports.colorTokens.primary300};
|
|
2105
|
+
background: transparent;
|
|
2106
|
+
border-radius: 4px;
|
|
2107
|
+
& > svg > path {
|
|
2108
|
+
fill: ${exports.colorTokens.primary300};
|
|
2109
|
+
}
|
|
2110
|
+
${isHovered && react$1.css`
|
|
2111
|
+
border: 1.5px solid ${exports.colorTokens.primary400};
|
|
2112
|
+
& > svg > path {
|
|
2113
|
+
fill: ${exports.colorTokens.primary400};
|
|
2114
|
+
}
|
|
2115
|
+
`}
|
|
2116
|
+
`;
|
|
2117
|
+
}
|
|
2118
|
+
return react$1.css`
|
|
2119
|
+
background: transparent;
|
|
2120
|
+
border: 1.5px solid ${exports.colorTokens.neutral200};
|
|
2121
|
+
border-radius: 4px;
|
|
2122
|
+
& > svg > path {
|
|
2123
|
+
fill: ${exports.colorTokens.neutral200};
|
|
2124
|
+
}
|
|
2125
|
+
${isHovered && react$1.css`
|
|
2126
|
+
border: 1.5px solid ${exports.colorTokens.neutral300};
|
|
2127
|
+
& > svg > path {
|
|
2128
|
+
fill: ${exports.colorTokens.neutral300};
|
|
2129
|
+
}
|
|
2130
|
+
`}
|
|
2131
|
+
`;
|
|
2132
|
+
default:
|
|
2133
|
+
return "";
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
var StyledCheckbox = styled6__default.default.button`
|
|
2137
|
+
display: flex;
|
|
2138
|
+
align-items: center;
|
|
2139
|
+
justify-content: center;
|
|
2140
|
+
min-width: 16px;
|
|
2141
|
+
min-height: 16px;
|
|
2142
|
+
width: 16px;
|
|
2143
|
+
height: 16px;
|
|
2144
|
+
background: ${exports.colorTokens.neutral200};
|
|
2145
|
+
border-radius: 4px;
|
|
2146
|
+
box-sizing: border-box;
|
|
2147
|
+
cursor: pointer;
|
|
2148
|
+
${({ styleVar, isSelected, isHovered }) => getStylesByStyleVariant(styleVar, isSelected, isHovered)};
|
|
2149
|
+
${({ disabled }) => getDisabledStyle(disabled)}
|
|
2150
|
+
`;
|
|
2151
|
+
var Container3 = styled6__default.default.button`
|
|
2152
|
+
display: flex;
|
|
2153
|
+
align-items: center;
|
|
2154
|
+
justify-content: center;
|
|
2155
|
+
padding: 4px;
|
|
2156
|
+
width: fit-content;
|
|
2157
|
+
height: fit-content;
|
|
2158
|
+
`;
|
|
2159
|
+
exports.CHECKBOX_SYMBOL_KEY = Symbol("SHOPLFLOW_CHECKBOX");
|
|
2160
|
+
var Checkbox = (_a) => {
|
|
2161
|
+
var _b = _a, {
|
|
2162
|
+
defaultSelected,
|
|
2163
|
+
isSelected,
|
|
2164
|
+
disabled,
|
|
2165
|
+
onClick,
|
|
2166
|
+
onMouseEnter,
|
|
2167
|
+
onMouseLeave,
|
|
2168
|
+
styleVar = "PRIMARY"
|
|
2169
|
+
} = _b, rest = __objRest(_b, [
|
|
2170
|
+
"defaultSelected",
|
|
2171
|
+
"isSelected",
|
|
2172
|
+
"disabled",
|
|
2173
|
+
"onClick",
|
|
2174
|
+
"onMouseEnter",
|
|
2175
|
+
"onMouseLeave",
|
|
2176
|
+
"styleVar"
|
|
2177
|
+
]);
|
|
2178
|
+
const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
|
|
2179
|
+
const [isHovered, toggleHovered] = React3.useState(false);
|
|
2180
|
+
const handleMouseLeave = (e) => {
|
|
2181
|
+
toggleHovered(false);
|
|
2182
|
+
onMouseLeave && onMouseLeave(e);
|
|
2183
|
+
};
|
|
2184
|
+
const handleMouseEnter = (e) => {
|
|
2185
|
+
toggleHovered(true);
|
|
2186
|
+
onMouseEnter && onMouseEnter(e);
|
|
2187
|
+
};
|
|
2188
|
+
const handleClick = (e) => {
|
|
2189
|
+
if (disabled) {
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
onClick && onClick(e);
|
|
2193
|
+
toggleSelected();
|
|
2194
|
+
};
|
|
2195
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2196
|
+
Container3,
|
|
2197
|
+
__spreadProps(__spreadValues({
|
|
2198
|
+
onClick: handleClick,
|
|
2199
|
+
onMouseLeave: handleMouseLeave,
|
|
2200
|
+
onMouseEnter: handleMouseEnter,
|
|
2201
|
+
disabled
|
|
2202
|
+
}, rest), {
|
|
2203
|
+
"data-shoplflow": "Checkbox",
|
|
2204
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(StyledCheckbox, { styleVar, isHovered, isSelected: selected, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2205
|
+
"path",
|
|
2206
|
+
{
|
|
2207
|
+
fillRule: "evenodd",
|
|
2208
|
+
clipRule: "evenodd",
|
|
2209
|
+
d: "M9.78822 0.297596C10.1761 -0.0955083 10.8093 -0.0997053 11.2024 0.288222C11.5653 0.646308 11.5968 1.21334 11.2943 1.60765L11.2118 1.7024L5.31714 7.7024C4.95248 8.07193 4.37282 8.09687 3.97909 7.77976L3.88476 7.69335L0.779404 4.42669C0.396475 4.02871 0.408672 3.39567 0.806647 3.01274C1.17401 2.65926 1.74167 2.64247 2.12801 2.95499L2.2206 3.03998L4.614 5.567L9.78822 0.297596Z",
|
|
2210
|
+
fill: "white"
|
|
2211
|
+
}
|
|
2212
|
+
) }) })
|
|
2213
|
+
})
|
|
2214
|
+
);
|
|
2215
|
+
};
|
|
2216
|
+
Checkbox[exports.CHECKBOX_SYMBOL_KEY] = true;
|
|
2217
|
+
exports.Checkbox = Checkbox;
|
|
2218
|
+
|
|
2219
|
+
// src/components/ControlButtons/Checkbox/Checkbox.types.ts
|
|
2220
|
+
exports.CheckboxStyleVariants = {
|
|
2221
|
+
PRIMARY: "PRIMARY",
|
|
2222
|
+
LINE: "LINE"
|
|
2223
|
+
};
|
|
2224
|
+
var getSelectedStyle = (isHovered) => {
|
|
2225
|
+
return react$1.css`
|
|
2226
|
+
& > svg > circle {
|
|
2227
|
+
stroke: ${exports.colorTokens.primary300};
|
|
2228
|
+
}
|
|
2229
|
+
${isHovered && react$1.css`
|
|
2230
|
+
& > svg > circle {
|
|
2231
|
+
stroke: ${exports.colorTokens.primary400};
|
|
2232
|
+
}
|
|
2233
|
+
`}
|
|
2234
|
+
`;
|
|
2235
|
+
};
|
|
2236
|
+
var StyledRadio = styled6__default.default.div`
|
|
2237
|
+
display: flex;
|
|
2238
|
+
align-items: center;
|
|
2239
|
+
justify-content: center;
|
|
2240
|
+
min-width: 16px;
|
|
2241
|
+
min-height: 16px;
|
|
2242
|
+
width: 16px;
|
|
2243
|
+
height: 16px;
|
|
2244
|
+
${({ isHovered }) => react$1.css`
|
|
2245
|
+
& > svg > circle {
|
|
2246
|
+
stroke: ${exports.colorTokens.neutral200};
|
|
2247
|
+
}
|
|
2248
|
+
${isHovered && react$1.css`
|
|
2249
|
+
& > svg > circle {
|
|
2250
|
+
stroke: ${exports.colorTokens.neutral300};
|
|
2251
|
+
}
|
|
2252
|
+
`}
|
|
2253
|
+
`}
|
|
2254
|
+
cursor: pointer;
|
|
2255
|
+
${({ isSelected, isHovered }) => isSelected && getSelectedStyle(isHovered)}
|
|
2256
|
+
${({ disabled }) => getDisabledStyle(disabled)}
|
|
2257
|
+
`;
|
|
2258
|
+
var Container4 = styled6__default.default.button`
|
|
2259
|
+
display: flex;
|
|
2260
|
+
align-items: center;
|
|
2261
|
+
justify-content: center;
|
|
2262
|
+
background: transparent;
|
|
2263
|
+
padding: 4px;
|
|
2264
|
+
width: fit-content;
|
|
2265
|
+
height: fit-content;
|
|
2266
|
+
`;
|
|
2267
|
+
exports.RADIO_SYMBOL_KEY = Symbol("SHOPLFLOW_RADIO");
|
|
2268
|
+
var Radio = (_a) => {
|
|
2269
|
+
var _b = _a, { isSelected, defaultSelected, disabled, onClick, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["isSelected", "defaultSelected", "disabled", "onClick", "onMouseEnter", "onMouseLeave"]);
|
|
2270
|
+
const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
|
|
2271
|
+
const [isHovered, toggleHovered] = React3.useState(false);
|
|
2272
|
+
const handleMouseLeave = (e) => {
|
|
2273
|
+
toggleHovered(false);
|
|
2274
|
+
onMouseLeave && onMouseLeave(e);
|
|
2275
|
+
};
|
|
2276
|
+
const handleMouseEnter = (e) => {
|
|
2277
|
+
toggleHovered(true);
|
|
2278
|
+
onMouseEnter && onMouseEnter(e);
|
|
2279
|
+
};
|
|
2280
|
+
const handleClick = (e) => {
|
|
2281
|
+
if (disabled) {
|
|
2282
|
+
return;
|
|
2283
|
+
}
|
|
2284
|
+
onClick && onClick(e);
|
|
2285
|
+
toggleSelected();
|
|
2286
|
+
};
|
|
2287
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2288
|
+
Container4,
|
|
2289
|
+
__spreadProps(__spreadValues({
|
|
2290
|
+
onClick: handleClick,
|
|
2291
|
+
onMouseEnter: handleMouseEnter,
|
|
2292
|
+
onMouseLeave: handleMouseLeave
|
|
2293
|
+
}, rest), {
|
|
2294
|
+
"data-shoplflow": "Radio",
|
|
2295
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(StyledRadio, { isSelected: selected, isHovered, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "5.5", fill: "white", stroke: "#3299FE", strokeWidth: "5" }) }) })
|
|
2296
|
+
})
|
|
2297
|
+
);
|
|
2298
|
+
};
|
|
2299
|
+
Radio[exports.RADIO_SYMBOL_KEY] = true;
|
|
2300
|
+
exports.Radio = Radio;
|
|
2301
|
+
|
|
2302
|
+
// src/components/Menu/Menu.styled.ts
|
|
2024
2303
|
var getStylesBySizeVar = (sizeVar) => {
|
|
2025
2304
|
switch (sizeVar) {
|
|
2026
2305
|
case "XS":
|
|
@@ -2068,7 +2347,7 @@ exports.StyledMenu = styled6__default.default.li`
|
|
|
2068
2347
|
background: ${exports.colorTokens.neutral400_5};
|
|
2069
2348
|
}
|
|
2070
2349
|
${({ disabled }) => disabled && getDisabledStyle(disabled)}
|
|
2071
|
-
${({ isSelected, leftSource }) => isSelected === true && !leftSource && react$1.css`
|
|
2350
|
+
${({ isSelected, leftSource }) => isSelected === true && (!leftSource || leftSource && !leftSource.type[exports.RADIO_SYMBOL_KEY] && !leftSource.type[exports.CHECKBOX_SYMBOL_KEY] && !leftSource.type[MUNUS_BUTTON_SYMBOL_KEY]) && react$1.css`
|
|
2072
2351
|
background: ${exports.colorTokens.neutral200};
|
|
2073
2352
|
&:hover {
|
|
2074
2353
|
background: ${exports.colorTokens.neutral200};
|
|
@@ -2709,416 +2988,145 @@ var TextArea = React3.forwardRef(
|
|
|
2709
2988
|
}, [defaultValue, maxLength]);
|
|
2710
2989
|
React3.useEffect(() => {
|
|
2711
2990
|
if (value) {
|
|
2712
|
-
const convertString = convertToString(value);
|
|
2713
|
-
if (maxLength && convertString.length > maxLength) {
|
|
2714
|
-
setText(convertString);
|
|
2715
|
-
}
|
|
2716
|
-
setText(convertToString(value));
|
|
2717
|
-
}
|
|
2718
|
-
}, [maxLength, value]);
|
|
2719
|
-
const uniqueId = React3.useId();
|
|
2720
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2721
|
-
InputWrapper,
|
|
2722
|
-
{
|
|
2723
|
-
htmlFor: uniqueId,
|
|
2724
|
-
isFocused,
|
|
2725
|
-
disabled,
|
|
2726
|
-
isHovered,
|
|
2727
|
-
isError,
|
|
2728
|
-
direction: "column",
|
|
2729
|
-
onMouseEnter: handleOnMouseEnter,
|
|
2730
|
-
onMouseLeave: handleOnMouseLeave,
|
|
2731
|
-
width,
|
|
2732
|
-
"data-shoplflow": "text-area",
|
|
2733
|
-
children: [
|
|
2734
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2735
|
-
StyledTextarea,
|
|
2736
|
-
__spreadValues({
|
|
2737
|
-
className: "body1_400" + (className ? ` ${className}` : ""),
|
|
2738
|
-
placeholder,
|
|
2739
|
-
onFocus: handleOnFocus,
|
|
2740
|
-
onBlur: handleOnBlur,
|
|
2741
|
-
onChange: handleOnChange,
|
|
2742
|
-
name,
|
|
2743
|
-
id: uniqueId,
|
|
2744
|
-
value,
|
|
2745
|
-
ref,
|
|
2746
|
-
maxLength,
|
|
2747
|
-
disabled,
|
|
2748
|
-
minHeight
|
|
2749
|
-
}, rest)
|
|
2750
|
-
),
|
|
2751
|
-
/* @__PURE__ */ jsxRuntime.jsx(BottomElementWrapper, { children: maxLength && /* @__PURE__ */ jsxRuntime.jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) })
|
|
2752
|
-
]
|
|
2753
|
-
}
|
|
2754
|
-
);
|
|
2755
|
-
}
|
|
2756
|
-
);
|
|
2757
|
-
exports.TextArea = TextArea;
|
|
2758
|
-
var StyledSelectInputButton = styled6__default.default.div`
|
|
2759
|
-
display: flex;
|
|
2760
|
-
flex-direction: row;
|
|
2761
|
-
align-items: center;
|
|
2762
|
-
justify-content: space-between;
|
|
2763
|
-
width: 100%;
|
|
2764
|
-
background: ${exports.colorTokens.neutral0};
|
|
2765
|
-
gap: 4px;
|
|
2766
|
-
padding: 4px 4px 4px 12px;
|
|
2767
|
-
cursor: pointer;
|
|
2768
|
-
${({ disabled }) => disabled && react$1.css`
|
|
2769
|
-
background-color: ${exports.colorTokens.neutral100};
|
|
2770
|
-
cursor: not-allowed;
|
|
2771
|
-
`}
|
|
2772
|
-
`;
|
|
2773
|
-
var SelectInputButton = (_a) => {
|
|
2774
|
-
var _b = _a, {
|
|
2775
|
-
disabled,
|
|
2776
|
-
isSelected,
|
|
2777
|
-
onMouseEnter,
|
|
2778
|
-
onMouseLeave,
|
|
2779
|
-
onClick,
|
|
2780
|
-
onClear,
|
|
2781
|
-
value,
|
|
2782
|
-
placeholder,
|
|
2783
|
-
label,
|
|
2784
|
-
width,
|
|
2785
|
-
rightSource
|
|
2786
|
-
} = _b, rest = __objRest(_b, [
|
|
2787
|
-
"disabled",
|
|
2788
|
-
"isSelected",
|
|
2789
|
-
"onMouseEnter",
|
|
2790
|
-
"onMouseLeave",
|
|
2791
|
-
"onClick",
|
|
2792
|
-
"onClear",
|
|
2793
|
-
"value",
|
|
2794
|
-
"placeholder",
|
|
2795
|
-
"label",
|
|
2796
|
-
"width",
|
|
2797
|
-
"rightSource"
|
|
2798
|
-
]);
|
|
2799
|
-
const [isHovered, setIsHovered] = React3.useState(false);
|
|
2800
|
-
const handleOnClick = (e) => {
|
|
2801
|
-
e.preventDefault();
|
|
2802
|
-
e.stopPropagation();
|
|
2803
|
-
if (!disabled) {
|
|
2804
|
-
onClick && onClick(e);
|
|
2805
|
-
}
|
|
2806
|
-
};
|
|
2807
|
-
const handleOnClear = (e) => {
|
|
2808
|
-
e.preventDefault();
|
|
2809
|
-
e.stopPropagation();
|
|
2810
|
-
if (!disabled) {
|
|
2811
|
-
onClear && onClear(e);
|
|
2812
|
-
}
|
|
2813
|
-
};
|
|
2814
|
-
const handleOnMouseEnter = (e) => {
|
|
2815
|
-
setIsHovered(true);
|
|
2816
|
-
onMouseEnter && onMouseEnter(e);
|
|
2817
|
-
};
|
|
2818
|
-
const handleOnMouseLeave = (e) => {
|
|
2819
|
-
setIsHovered(false);
|
|
2820
|
-
onMouseLeave && onMouseLeave(e);
|
|
2821
|
-
};
|
|
2822
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2823
|
-
InputWrapper,
|
|
2824
|
-
__spreadProps(__spreadValues({
|
|
2825
|
-
onMouseEnter: handleOnMouseEnter,
|
|
2826
|
-
onMouseLeave: handleOnMouseLeave,
|
|
2827
|
-
onClick: handleOnClick,
|
|
2828
|
-
isHovered,
|
|
2829
|
-
isFocused: isSelected,
|
|
2830
|
-
disabled,
|
|
2831
|
-
width
|
|
2832
|
-
}, rest), {
|
|
2833
|
-
"data-shoplflow": "SelectInputButton",
|
|
2834
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
|
|
2835
|
-
value && value.length > 0 && label ? /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", children: value[0][label] }) : /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", color: "neutral350", children: placeholder }),
|
|
2836
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
|
|
2837
|
-
value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
|
|
2838
|
-
"+",
|
|
2839
|
-
value.length - 1
|
|
2840
|
-
] }),
|
|
2841
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
|
|
2842
|
-
value && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
|
|
2843
|
-
rightSource
|
|
2844
|
-
] })
|
|
2845
|
-
] })
|
|
2846
|
-
] })
|
|
2847
|
-
})
|
|
2848
|
-
);
|
|
2849
|
-
};
|
|
2850
|
-
exports.SelectInputButton = SelectInputButton;
|
|
2851
|
-
var Container2 = styled6__default.default.div`
|
|
2852
|
-
width: 32px;
|
|
2853
|
-
height: 32px;
|
|
2854
|
-
padding: 7px;
|
|
2855
|
-
`;
|
|
2856
|
-
var IconButton2 = styled6__default.default.button`
|
|
2857
|
-
display: flex;
|
|
2858
|
-
width: 16px;
|
|
2859
|
-
height: 16px;
|
|
2860
|
-
flex-direction: column;
|
|
2861
|
-
justify-content: center;
|
|
2862
|
-
align-items: center;
|
|
2863
|
-
border-radius: ${exports.borderRadiusTokens.borderRadius04};
|
|
2864
|
-
border: none;
|
|
2865
|
-
background: ${({ color }) => exports.colorTokens[color]};
|
|
2866
|
-
cursor: pointer;
|
|
2867
|
-
transition:
|
|
2868
|
-
transform 0.1s ease-out,
|
|
2869
|
-
background 0.1s ease;
|
|
2870
|
-
|
|
2871
|
-
&:hover {
|
|
2872
|
-
background: ${({ color }) => exports.colorTokens[getNextColor(color, 1)]};
|
|
2873
|
-
}
|
|
2874
|
-
`;
|
|
2875
|
-
var MinusButton = React3.forwardRef((_a, ref) => {
|
|
2876
|
-
var _b = _a, { onClick, color = "neutral300" } = _b, rest = __objRest(_b, ["onClick", "color"]);
|
|
2877
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container2, { "data-shoplflow": "minusButton", children: /* @__PURE__ */ jsxRuntime.jsx(IconButton2, __spreadProps(__spreadValues({ color, onClick, ref }, rest), { children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2878
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2879
|
-
"path",
|
|
2880
|
-
{
|
|
2881
|
-
d: "M0 4C0 1.79086 1.79086 0 4 0H12C14.2091 0 16 1.79086 16 4V12C16 14.2091 14.2091 16 12 16H4C1.79086 16 0 14.2091 0 12V4Z",
|
|
2882
|
-
fill: "none"
|
|
2883
|
-
}
|
|
2884
|
-
),
|
|
2885
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2886
|
-
"path",
|
|
2887
|
-
{
|
|
2888
|
-
fillRule: "evenodd",
|
|
2889
|
-
clipRule: "evenodd",
|
|
2890
|
-
d: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z",
|
|
2891
|
-
fill: "white"
|
|
2892
|
-
}
|
|
2893
|
-
)
|
|
2894
|
-
] }) })) });
|
|
2895
|
-
});
|
|
2896
|
-
exports.MinusButton = MinusButton;
|
|
2897
|
-
var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
|
|
2898
|
-
switch (styleVariant) {
|
|
2899
|
-
case "PRIMARY":
|
|
2900
|
-
if (isSelected) {
|
|
2901
|
-
return react$1.css`
|
|
2902
|
-
background: ${exports.colorTokens.primary300};
|
|
2903
|
-
border: 1.5px solid ${exports.colorTokens.primary300};
|
|
2904
|
-
& > svg > path {
|
|
2905
|
-
fill: ${exports.colorTokens.neutral0};
|
|
2906
|
-
}
|
|
2907
|
-
${isHovered && react$1.css`
|
|
2908
|
-
border: 1.5px solid ${exports.colorTokens.primary400};
|
|
2909
|
-
background: ${exports.colorTokens.primary400};
|
|
2910
|
-
`}
|
|
2911
|
-
`;
|
|
2912
|
-
}
|
|
2913
|
-
return react$1.css`
|
|
2914
|
-
background: ${exports.colorTokens.neutral200};
|
|
2915
|
-
border: 1.5px solid ${exports.colorTokens.neutral200};
|
|
2916
|
-
border-radius: 4px;
|
|
2917
|
-
${isHovered && react$1.css`
|
|
2918
|
-
border: 1.5px solid ${exports.colorTokens.neutral300};
|
|
2919
|
-
background: ${exports.colorTokens.neutral300};
|
|
2920
|
-
`}
|
|
2921
|
-
|
|
2922
|
-
& > svg > path {
|
|
2923
|
-
fill: ${exports.colorTokens.neutral0};
|
|
2924
|
-
}
|
|
2925
|
-
`;
|
|
2926
|
-
case "LINE":
|
|
2927
|
-
if (isSelected) {
|
|
2928
|
-
return react$1.css`
|
|
2929
|
-
border: 1.5px solid ${exports.colorTokens.primary300};
|
|
2930
|
-
background: transparent;
|
|
2931
|
-
border-radius: 4px;
|
|
2932
|
-
& > svg > path {
|
|
2933
|
-
fill: ${exports.colorTokens.primary300};
|
|
2934
|
-
}
|
|
2935
|
-
${isHovered && react$1.css`
|
|
2936
|
-
border: 1.5px solid ${exports.colorTokens.primary400};
|
|
2937
|
-
& > svg > path {
|
|
2938
|
-
fill: ${exports.colorTokens.primary400};
|
|
2939
|
-
}
|
|
2940
|
-
`}
|
|
2941
|
-
`;
|
|
2942
|
-
}
|
|
2943
|
-
return react$1.css`
|
|
2944
|
-
background: transparent;
|
|
2945
|
-
border: 1.5px solid ${exports.colorTokens.neutral200};
|
|
2946
|
-
border-radius: 4px;
|
|
2947
|
-
& > svg > path {
|
|
2948
|
-
fill: ${exports.colorTokens.neutral200};
|
|
2991
|
+
const convertString = convertToString(value);
|
|
2992
|
+
if (maxLength && convertString.length > maxLength) {
|
|
2993
|
+
setText(convertString);
|
|
2949
2994
|
}
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2995
|
+
setText(convertToString(value));
|
|
2996
|
+
}
|
|
2997
|
+
}, [maxLength, value]);
|
|
2998
|
+
const uniqueId = React3.useId();
|
|
2999
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3000
|
+
InputWrapper,
|
|
3001
|
+
{
|
|
3002
|
+
htmlFor: uniqueId,
|
|
3003
|
+
isFocused,
|
|
3004
|
+
disabled,
|
|
3005
|
+
isHovered,
|
|
3006
|
+
isError,
|
|
3007
|
+
direction: "column",
|
|
3008
|
+
onMouseEnter: handleOnMouseEnter,
|
|
3009
|
+
onMouseLeave: handleOnMouseLeave,
|
|
3010
|
+
width,
|
|
3011
|
+
"data-shoplflow": "text-area",
|
|
3012
|
+
children: [
|
|
3013
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3014
|
+
StyledTextarea,
|
|
3015
|
+
__spreadValues({
|
|
3016
|
+
className: "body1_400" + (className ? ` ${className}` : ""),
|
|
3017
|
+
placeholder,
|
|
3018
|
+
onFocus: handleOnFocus,
|
|
3019
|
+
onBlur: handleOnBlur,
|
|
3020
|
+
onChange: handleOnChange,
|
|
3021
|
+
name,
|
|
3022
|
+
id: uniqueId,
|
|
3023
|
+
value,
|
|
3024
|
+
ref,
|
|
3025
|
+
maxLength,
|
|
3026
|
+
disabled,
|
|
3027
|
+
minHeight
|
|
3028
|
+
}, rest)
|
|
3029
|
+
),
|
|
3030
|
+
/* @__PURE__ */ jsxRuntime.jsx(BottomElementWrapper, { children: maxLength && /* @__PURE__ */ jsxRuntime.jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) })
|
|
3031
|
+
]
|
|
3032
|
+
}
|
|
3033
|
+
);
|
|
2959
3034
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
3035
|
+
);
|
|
3036
|
+
exports.TextArea = TextArea;
|
|
3037
|
+
var StyledSelectInputButton = styled6__default.default.div`
|
|
2962
3038
|
display: flex;
|
|
3039
|
+
flex-direction: row;
|
|
2963
3040
|
align-items: center;
|
|
2964
|
-
justify-content:
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
background: ${exports.colorTokens.neutral200};
|
|
2970
|
-
border-radius: 4px;
|
|
2971
|
-
box-sizing: border-box;
|
|
3041
|
+
justify-content: space-between;
|
|
3042
|
+
width: 100%;
|
|
3043
|
+
background: ${exports.colorTokens.neutral0};
|
|
3044
|
+
gap: 4px;
|
|
3045
|
+
padding: 4px 4px 4px 12px;
|
|
2972
3046
|
cursor: pointer;
|
|
2973
|
-
${({
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
display: flex;
|
|
2978
|
-
align-items: center;
|
|
2979
|
-
justify-content: center;
|
|
2980
|
-
padding: 4px;
|
|
2981
|
-
width: fit-content;
|
|
2982
|
-
height: fit-content;
|
|
3047
|
+
${({ disabled }) => disabled && react$1.css`
|
|
3048
|
+
background-color: ${exports.colorTokens.neutral100};
|
|
3049
|
+
cursor: not-allowed;
|
|
3050
|
+
`}
|
|
2983
3051
|
`;
|
|
2984
|
-
var
|
|
3052
|
+
var SelectInputButton = (_a) => {
|
|
2985
3053
|
var _b = _a, {
|
|
2986
|
-
defaultSelected,
|
|
2987
|
-
isSelected,
|
|
2988
3054
|
disabled,
|
|
2989
|
-
|
|
3055
|
+
isSelected,
|
|
2990
3056
|
onMouseEnter,
|
|
2991
3057
|
onMouseLeave,
|
|
2992
|
-
|
|
3058
|
+
onClick,
|
|
3059
|
+
onClear,
|
|
3060
|
+
value,
|
|
3061
|
+
placeholder,
|
|
3062
|
+
label,
|
|
3063
|
+
width,
|
|
3064
|
+
rightSource
|
|
2993
3065
|
} = _b, rest = __objRest(_b, [
|
|
2994
|
-
"defaultSelected",
|
|
2995
|
-
"isSelected",
|
|
2996
3066
|
"disabled",
|
|
2997
|
-
"
|
|
3067
|
+
"isSelected",
|
|
2998
3068
|
"onMouseEnter",
|
|
2999
3069
|
"onMouseLeave",
|
|
3000
|
-
"
|
|
3070
|
+
"onClick",
|
|
3071
|
+
"onClear",
|
|
3072
|
+
"value",
|
|
3073
|
+
"placeholder",
|
|
3074
|
+
"label",
|
|
3075
|
+
"width",
|
|
3076
|
+
"rightSource"
|
|
3001
3077
|
]);
|
|
3002
|
-
const [
|
|
3003
|
-
const
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
const handleMouseEnter = (e) => {
|
|
3009
|
-
toggleHovered(true);
|
|
3010
|
-
onMouseEnter && onMouseEnter(e);
|
|
3011
|
-
};
|
|
3012
|
-
const handleClick = (e) => {
|
|
3013
|
-
if (disabled) {
|
|
3014
|
-
return;
|
|
3078
|
+
const [isHovered, setIsHovered] = React3.useState(false);
|
|
3079
|
+
const handleOnClick = (e) => {
|
|
3080
|
+
e.preventDefault();
|
|
3081
|
+
e.stopPropagation();
|
|
3082
|
+
if (!disabled) {
|
|
3083
|
+
onClick && onClick(e);
|
|
3015
3084
|
}
|
|
3016
|
-
onClick && onClick(e);
|
|
3017
|
-
toggleSelected();
|
|
3018
3085
|
};
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
onMouseEnter: handleMouseEnter,
|
|
3025
|
-
disabled
|
|
3026
|
-
}, rest), {
|
|
3027
|
-
"data-shoplflow": "Checkbox",
|
|
3028
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(StyledCheckbox, { styleVar, isHovered, isSelected: selected, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3029
|
-
"path",
|
|
3030
|
-
{
|
|
3031
|
-
fillRule: "evenodd",
|
|
3032
|
-
clipRule: "evenodd",
|
|
3033
|
-
d: "M9.78822 0.297596C10.1761 -0.0955083 10.8093 -0.0997053 11.2024 0.288222C11.5653 0.646308 11.5968 1.21334 11.2943 1.60765L11.2118 1.7024L5.31714 7.7024C4.95248 8.07193 4.37282 8.09687 3.97909 7.77976L3.88476 7.69335L0.779404 4.42669C0.396475 4.02871 0.408672 3.39567 0.806647 3.01274C1.17401 2.65926 1.74167 2.64247 2.12801 2.95499L2.2206 3.03998L4.614 5.567L9.78822 0.297596Z",
|
|
3034
|
-
fill: "white"
|
|
3035
|
-
}
|
|
3036
|
-
) }) })
|
|
3037
|
-
})
|
|
3038
|
-
);
|
|
3039
|
-
};
|
|
3040
|
-
exports.Checkbox = Checkbox;
|
|
3041
|
-
|
|
3042
|
-
// src/components/ControlButtons/Checkbox/Checkbox.types.ts
|
|
3043
|
-
exports.CheckboxStyleVariants = {
|
|
3044
|
-
PRIMARY: "PRIMARY",
|
|
3045
|
-
LINE: "LINE"
|
|
3046
|
-
};
|
|
3047
|
-
var getSelectedStyle = (isHovered) => {
|
|
3048
|
-
return react$1.css`
|
|
3049
|
-
& > svg > circle {
|
|
3050
|
-
stroke: ${exports.colorTokens.primary300};
|
|
3051
|
-
}
|
|
3052
|
-
${isHovered && react$1.css`
|
|
3053
|
-
& > svg > circle {
|
|
3054
|
-
stroke: ${exports.colorTokens.primary400};
|
|
3055
|
-
}
|
|
3056
|
-
`}
|
|
3057
|
-
`;
|
|
3058
|
-
};
|
|
3059
|
-
var StyledRadio = styled6__default.default.div`
|
|
3060
|
-
display: flex;
|
|
3061
|
-
align-items: center;
|
|
3062
|
-
justify-content: center;
|
|
3063
|
-
min-width: 16px;
|
|
3064
|
-
min-height: 16px;
|
|
3065
|
-
width: 16px;
|
|
3066
|
-
height: 16px;
|
|
3067
|
-
${({ isHovered }) => react$1.css`
|
|
3068
|
-
& > svg > circle {
|
|
3069
|
-
stroke: ${exports.colorTokens.neutral200};
|
|
3086
|
+
const handleOnClear = (e) => {
|
|
3087
|
+
e.preventDefault();
|
|
3088
|
+
e.stopPropagation();
|
|
3089
|
+
if (!disabled) {
|
|
3090
|
+
onClear && onClear(e);
|
|
3070
3091
|
}
|
|
3071
|
-
${isHovered && react$1.css`
|
|
3072
|
-
& > svg > circle {
|
|
3073
|
-
stroke: ${exports.colorTokens.neutral300};
|
|
3074
|
-
}
|
|
3075
|
-
`}
|
|
3076
|
-
`}
|
|
3077
|
-
cursor: pointer;
|
|
3078
|
-
${({ isSelected, isHovered }) => isSelected && getSelectedStyle(isHovered)}
|
|
3079
|
-
${({ disabled }) => getDisabledStyle(disabled)}
|
|
3080
|
-
`;
|
|
3081
|
-
var Container4 = styled6__default.default.button`
|
|
3082
|
-
display: flex;
|
|
3083
|
-
align-items: center;
|
|
3084
|
-
justify-content: center;
|
|
3085
|
-
background: transparent;
|
|
3086
|
-
padding: 4px;
|
|
3087
|
-
width: fit-content;
|
|
3088
|
-
height: fit-content;
|
|
3089
|
-
`;
|
|
3090
|
-
var Radio = (_a) => {
|
|
3091
|
-
var _b = _a, { isSelected, defaultSelected, disabled, onClick, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["isSelected", "defaultSelected", "disabled", "onClick", "onMouseEnter", "onMouseLeave"]);
|
|
3092
|
-
const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
|
|
3093
|
-
const [isHovered, toggleHovered] = React3.useState(false);
|
|
3094
|
-
const handleMouseLeave = (e) => {
|
|
3095
|
-
toggleHovered(false);
|
|
3096
|
-
onMouseLeave && onMouseLeave(e);
|
|
3097
3092
|
};
|
|
3098
|
-
const
|
|
3099
|
-
|
|
3093
|
+
const handleOnMouseEnter = (e) => {
|
|
3094
|
+
setIsHovered(true);
|
|
3100
3095
|
onMouseEnter && onMouseEnter(e);
|
|
3101
3096
|
};
|
|
3102
|
-
const
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
}
|
|
3106
|
-
onClick && onClick(e);
|
|
3107
|
-
toggleSelected();
|
|
3097
|
+
const handleOnMouseLeave = (e) => {
|
|
3098
|
+
setIsHovered(false);
|
|
3099
|
+
onMouseLeave && onMouseLeave(e);
|
|
3108
3100
|
};
|
|
3109
3101
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3110
|
-
|
|
3102
|
+
InputWrapper,
|
|
3111
3103
|
__spreadProps(__spreadValues({
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3104
|
+
onMouseEnter: handleOnMouseEnter,
|
|
3105
|
+
onMouseLeave: handleOnMouseLeave,
|
|
3106
|
+
onClick: handleOnClick,
|
|
3107
|
+
isHovered,
|
|
3108
|
+
isFocused: isSelected,
|
|
3109
|
+
disabled,
|
|
3110
|
+
width
|
|
3115
3111
|
}, rest), {
|
|
3116
|
-
"data-shoplflow": "
|
|
3117
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
3112
|
+
"data-shoplflow": "SelectInputButton",
|
|
3113
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
|
|
3114
|
+
value && value.length > 0 && label ? /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", children: value[0][label] }) : /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", color: "neutral350", children: placeholder }),
|
|
3115
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
|
|
3116
|
+
value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
|
|
3117
|
+
"+",
|
|
3118
|
+
value.length - 1
|
|
3119
|
+
] }),
|
|
3120
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
|
|
3121
|
+
value && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
|
|
3122
|
+
rightSource
|
|
3123
|
+
] })
|
|
3124
|
+
] })
|
|
3125
|
+
] })
|
|
3118
3126
|
})
|
|
3119
3127
|
);
|
|
3120
3128
|
};
|
|
3121
|
-
exports.
|
|
3129
|
+
exports.SelectInputButton = SelectInputButton;
|
|
3122
3130
|
/*! Bundled license information:
|
|
3123
3131
|
|
|
3124
3132
|
classnames/index.js:
|