@shoplflow/base 0.24.28 → 0.24.29
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 +82 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -319
- package/dist/index.d.ts +19 -319
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ var react = require('@floating-ui/react');
|
|
|
12
12
|
var reactDom = require('@floating-ui/react-dom');
|
|
13
13
|
var ShoplAssets = require('@shoplflow/shopl-assets');
|
|
14
14
|
var HadaAssets = require('@shoplflow/hada-assets');
|
|
15
|
+
var core = require('@floating-ui/core');
|
|
15
16
|
|
|
16
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
|
|
@@ -1644,7 +1645,7 @@ exports.CalloutTypes = {
|
|
|
1644
1645
|
INFORMATION: "INFORMATION",
|
|
1645
1646
|
ALERT: "ALERT"
|
|
1646
1647
|
};
|
|
1647
|
-
|
|
1648
|
+
var StyledPopper = styled5__default.default.div`
|
|
1648
1649
|
width: ${({ width }) => width != null ? width : "fit-content"};
|
|
1649
1650
|
height: ${({ height }) => height && height};
|
|
1650
1651
|
`;
|
|
@@ -1717,7 +1718,7 @@ exports.PopperTrigger = React2.forwardRef(
|
|
|
1717
1718
|
React2.useEffect(() => {
|
|
1718
1719
|
setIsOpen(isOpen);
|
|
1719
1720
|
}, [isOpen, setIsOpen]);
|
|
1720
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1721
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledPopper, __spreadProps(__spreadValues({ ref: refs, "data-shoplflow": "Popper" }, rest), { children }));
|
|
1721
1722
|
}
|
|
1722
1723
|
);
|
|
1723
1724
|
exports.PopperPortal = React2.forwardRef(
|
|
@@ -1741,7 +1742,7 @@ exports.PopperPortal = React2.forwardRef(
|
|
|
1741
1742
|
Popper.Trigger = exports.PopperTrigger;
|
|
1742
1743
|
Popper.Portal = exports.PopperPortal;
|
|
1743
1744
|
exports.Popper = Popper;
|
|
1744
|
-
|
|
1745
|
+
var getDropdownHeightBySizeVar = (size2) => {
|
|
1745
1746
|
switch (size2) {
|
|
1746
1747
|
case "M":
|
|
1747
1748
|
return "40px";
|
|
@@ -1751,7 +1752,7 @@ exports.getDropdownHeightBySizeVar = (size2) => {
|
|
|
1751
1752
|
return "40px";
|
|
1752
1753
|
}
|
|
1753
1754
|
};
|
|
1754
|
-
|
|
1755
|
+
var getDropdownFontSizeBySizeVar = (size2) => {
|
|
1755
1756
|
switch (size2) {
|
|
1756
1757
|
case "M":
|
|
1757
1758
|
return "body1_400";
|
|
@@ -1761,7 +1762,7 @@ exports.getDropdownFontSizeBySizeVar = (size2) => {
|
|
|
1761
1762
|
return "body1_400";
|
|
1762
1763
|
}
|
|
1763
1764
|
};
|
|
1764
|
-
|
|
1765
|
+
var getDropdownStyleBySizeVar = (size2) => {
|
|
1765
1766
|
switch (size2) {
|
|
1766
1767
|
case "M":
|
|
1767
1768
|
return react$1.css`
|
|
@@ -1778,7 +1779,7 @@ exports.getDropdownStyleBySizeVar = (size2) => {
|
|
|
1778
1779
|
`;
|
|
1779
1780
|
}
|
|
1780
1781
|
};
|
|
1781
|
-
|
|
1782
|
+
var getDropdownIconSizeBySizeVar = (size2) => {
|
|
1782
1783
|
switch (size2) {
|
|
1783
1784
|
case "S":
|
|
1784
1785
|
return react$1.css`
|
|
@@ -1803,10 +1804,10 @@ exports.getDropdownIconSizeBySizeVar = (size2) => {
|
|
|
1803
1804
|
`;
|
|
1804
1805
|
}
|
|
1805
1806
|
};
|
|
1806
|
-
|
|
1807
|
+
var StyledDropdown = styled5__default.default.div`
|
|
1807
1808
|
width: ${({ width }) => width};
|
|
1808
1809
|
`;
|
|
1809
|
-
|
|
1810
|
+
var StyledDropdownContent = styled5__default.default.div`
|
|
1810
1811
|
display: flex;
|
|
1811
1812
|
flex-direction: column;
|
|
1812
1813
|
background: ${exports.colorTokens.neutral0};
|
|
@@ -1815,7 +1816,7 @@ exports.StyledDropdownContent = styled5__default.default.div`
|
|
|
1815
1816
|
border-radius: 6px;
|
|
1816
1817
|
box-shadow: ${exports.boxShadowTokens.dropShadow};
|
|
1817
1818
|
`;
|
|
1818
|
-
|
|
1819
|
+
var StyledDropdownButton = styled5__default.default.button`
|
|
1819
1820
|
display: flex;
|
|
1820
1821
|
flex-direction: row;
|
|
1821
1822
|
align-items: center;
|
|
@@ -1825,17 +1826,17 @@ exports.StyledDropdownButton = styled5__default.default.button`
|
|
|
1825
1826
|
gap: 8px;
|
|
1826
1827
|
cursor: pointer;
|
|
1827
1828
|
background-color: ${exports.colorTokens.neutral0};
|
|
1828
|
-
${({ sizeVar }) => sizeVar &&
|
|
1829
|
+
${({ sizeVar }) => sizeVar && getDropdownStyleBySizeVar(sizeVar)};
|
|
1829
1830
|
${({ disabled }) => disabled && react$1.css`
|
|
1830
1831
|
cursor: not-allowed;
|
|
1831
1832
|
`}
|
|
1832
1833
|
`;
|
|
1833
|
-
|
|
1834
|
+
var DropdownButtonIcon = styled5__default.default(framerMotion.motion.div)`
|
|
1834
1835
|
display: flex;
|
|
1835
1836
|
align-items: center;
|
|
1836
1837
|
justify-content: center;
|
|
1837
1838
|
|
|
1838
|
-
${({ sizeVar }) => sizeVar &&
|
|
1839
|
+
${({ sizeVar }) => sizeVar && getDropdownIconSizeBySizeVar(sizeVar)};
|
|
1839
1840
|
`;
|
|
1840
1841
|
var DropdownContext = React2.createContext(null);
|
|
1841
1842
|
var useDropdown = () => {
|
|
@@ -1974,13 +1975,13 @@ var DropdownButton = React2.forwardRef(
|
|
|
1974
1975
|
disabled,
|
|
1975
1976
|
width,
|
|
1976
1977
|
isError,
|
|
1977
|
-
height:
|
|
1978
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1978
|
+
height: getDropdownHeightBySizeVar(sizeVar),
|
|
1979
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
|
|
1979
1980
|
leftSource && leftSource,
|
|
1980
1981
|
value || /* @__PURE__ */ jsxRuntime.jsx(
|
|
1981
1982
|
exports.Text,
|
|
1982
1983
|
{
|
|
1983
|
-
typography:
|
|
1984
|
+
typography: getDropdownFontSizeBySizeVar(sizeVar),
|
|
1984
1985
|
color: "neutral400",
|
|
1985
1986
|
textOverflow: "ellipsis",
|
|
1986
1987
|
lineClamp: 1,
|
|
@@ -1988,7 +1989,7 @@ var DropdownButton = React2.forwardRef(
|
|
|
1988
1989
|
}
|
|
1989
1990
|
),
|
|
1990
1991
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1991
|
-
|
|
1992
|
+
DropdownButtonIcon,
|
|
1992
1993
|
{
|
|
1993
1994
|
sizeVar,
|
|
1994
1995
|
animate: {
|
|
@@ -2025,7 +2026,7 @@ var DropdownContent = (_a) => {
|
|
|
2025
2026
|
setIsOpen(false);
|
|
2026
2027
|
}
|
|
2027
2028
|
};
|
|
2028
|
-
return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2029
|
+
return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
|
|
2029
2030
|
};
|
|
2030
2031
|
var Dropdown = ({
|
|
2031
2032
|
isOpen: initialIsOpen = false,
|
|
@@ -2051,7 +2052,7 @@ var Dropdown = ({
|
|
|
2051
2052
|
}
|
|
2052
2053
|
setIsOpen(initialIsOpen);
|
|
2053
2054
|
}, [initialIsOpen]);
|
|
2054
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2055
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledDropdown, { "data-shoplflow": "Dropdown", width, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownContext.Provider, { value: __spreadProps(__spreadValues({}, size2), { isOpen, setIsOpen, option }), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2055
2056
|
exports.Popper,
|
|
2056
2057
|
{
|
|
2057
2058
|
offset: 4,
|
|
@@ -2371,7 +2372,7 @@ var getStylesBySizeVar = (sizeVar) => {
|
|
|
2371
2372
|
`;
|
|
2372
2373
|
}
|
|
2373
2374
|
};
|
|
2374
|
-
|
|
2375
|
+
var getFontStylesBySizeVar = (sizeVar) => {
|
|
2375
2376
|
switch (sizeVar) {
|
|
2376
2377
|
case "XS":
|
|
2377
2378
|
return "body2_400";
|
|
@@ -2383,7 +2384,7 @@ exports.getFontStylesBySizeVar = (sizeVar) => {
|
|
|
2383
2384
|
return "body1_400";
|
|
2384
2385
|
}
|
|
2385
2386
|
};
|
|
2386
|
-
|
|
2387
|
+
var StyledMenu = styled5__default.default.li`
|
|
2387
2388
|
display: flex;
|
|
2388
2389
|
width: 100%;
|
|
2389
2390
|
flex-direction: row;
|
|
@@ -2434,7 +2435,7 @@ var Menu = (_a) => {
|
|
|
2434
2435
|
!disabled && onClick && onClick(e);
|
|
2435
2436
|
};
|
|
2436
2437
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2437
|
-
|
|
2438
|
+
StyledMenu,
|
|
2438
2439
|
__spreadProps(__spreadValues({
|
|
2439
2440
|
sizeVar,
|
|
2440
2441
|
isSelected: selected,
|
|
@@ -2444,7 +2445,7 @@ var Menu = (_a) => {
|
|
|
2444
2445
|
"data-shoplflow": "Menu",
|
|
2445
2446
|
children: [
|
|
2446
2447
|
leftSource && LeftSourceClone,
|
|
2447
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { width: "100%", height: "100%", align: "center", className:
|
|
2448
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { width: "100%", height: "100%", align: "center", className: getFontStylesBySizeVar(sizeVar), children }),
|
|
2448
2449
|
rightSource && rightSource
|
|
2449
2450
|
]
|
|
2450
2451
|
})
|
|
@@ -2458,7 +2459,7 @@ exports.MenuSizeVariants = {
|
|
|
2458
2459
|
S: "S",
|
|
2459
2460
|
M: "M"
|
|
2460
2461
|
};
|
|
2461
|
-
|
|
2462
|
+
var StyledList = styled5__default.default.li`
|
|
2462
2463
|
display: flex;
|
|
2463
2464
|
flex-direction: row;
|
|
2464
2465
|
width: 100%;
|
|
@@ -2473,7 +2474,7 @@ exports.StyledList = styled5__default.default.li`
|
|
|
2473
2474
|
background: ${exports.colorTokens.neutral100};
|
|
2474
2475
|
}
|
|
2475
2476
|
`;
|
|
2476
|
-
|
|
2477
|
+
var StyledText2Rows = styled5__default.default.div`
|
|
2477
2478
|
display: flex;
|
|
2478
2479
|
flex-direction: column;
|
|
2479
2480
|
justify-content: center;
|
|
@@ -2485,14 +2486,14 @@ var List = (_a) => {
|
|
|
2485
2486
|
if (!children && rightSource) {
|
|
2486
2487
|
throw new Error("RightSource\uB294 children\uC774 \uD544\uC218\uB85C \uD3EC\uD568\uB418\uC5B4\uC57C\uD569\uB2C8\uB2E4.");
|
|
2487
2488
|
}
|
|
2488
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2489
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StyledList, __spreadProps(__spreadValues({ "data-shoplflow": "List" }, rest), { children: [
|
|
2489
2490
|
LeftSourceClone && LeftSourceClone,
|
|
2490
2491
|
/* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { height: "36px", width: "100%", spacing: "spacing08", align: "center", children }),
|
|
2491
2492
|
rightSource && rightSource
|
|
2492
2493
|
] }));
|
|
2493
2494
|
};
|
|
2494
2495
|
exports.Text2Rows = ({ title, subTitle }) => {
|
|
2495
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2496
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StyledText2Rows, { children: [
|
|
2496
2497
|
/* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_500", color: "neutral700", lineClamp: 1, wordBreak: "break-all", children: title }),
|
|
2497
2498
|
subTitle && /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body2_400", color: "neutral400", lineClamp: 1, wordBreak: "break-all", children: subTitle })
|
|
2498
2499
|
] });
|
|
@@ -2866,7 +2867,7 @@ var Input = React2.forwardRef(
|
|
|
2866
2867
|
}
|
|
2867
2868
|
);
|
|
2868
2869
|
exports.Input = Input;
|
|
2869
|
-
|
|
2870
|
+
var StyledInputButton = styled5__default.default.div`
|
|
2870
2871
|
display: flex;
|
|
2871
2872
|
flex-direction: row;
|
|
2872
2873
|
align-items: center;
|
|
@@ -2881,7 +2882,7 @@ exports.StyledInputButton = styled5__default.default.div`
|
|
|
2881
2882
|
cursor: not-allowed;
|
|
2882
2883
|
`}
|
|
2883
2884
|
`;
|
|
2884
|
-
|
|
2885
|
+
var StyledInputButtonContent = styled5__default.default.input`
|
|
2885
2886
|
display: flex;
|
|
2886
2887
|
width: 100%;
|
|
2887
2888
|
border: none;
|
|
@@ -2973,8 +2974,8 @@ var InputButton = React2.forwardRef(
|
|
|
2973
2974
|
minHeight: "40px",
|
|
2974
2975
|
maxHeight: "40px",
|
|
2975
2976
|
width,
|
|
2976
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2977
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2977
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
|
|
2978
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
|
|
2978
2979
|
/* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
|
|
2979
2980
|
text && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
|
|
2980
2981
|
rightSource
|
|
@@ -3218,6 +3219,57 @@ var SelectInputButton = (_a) => {
|
|
|
3218
3219
|
);
|
|
3219
3220
|
};
|
|
3220
3221
|
exports.SelectInputButton = SelectInputButton;
|
|
3222
|
+
var StyledTooltipContent = styled5__default.default.div`
|
|
3223
|
+
background-color: ${exports.colorTokens.neutral700};
|
|
3224
|
+
padding: 4px 8px;
|
|
3225
|
+
max-width: 240px;
|
|
3226
|
+
border-radius: 4px;
|
|
3227
|
+
`;
|
|
3228
|
+
var TooltipContent = (_a) => {
|
|
3229
|
+
var _b = _a, { content } = _b, args = __objRest(_b, ["content"]);
|
|
3230
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledTooltipContent, __spreadProps(__spreadValues({}, args), { children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "caption_400", color: "neutral0", wordBreak: "break-all", children: content }) }));
|
|
3231
|
+
};
|
|
3232
|
+
var Tooltip = (_a) => {
|
|
3233
|
+
var _b = _a, {
|
|
3234
|
+
trigger,
|
|
3235
|
+
popper,
|
|
3236
|
+
placement = "bottom-start",
|
|
3237
|
+
offset: offset3 = 4,
|
|
3238
|
+
triggerRef,
|
|
3239
|
+
portalRef
|
|
3240
|
+
} = _b, popperProps = __objRest(_b, [
|
|
3241
|
+
"trigger",
|
|
3242
|
+
"popper",
|
|
3243
|
+
"placement",
|
|
3244
|
+
"offset",
|
|
3245
|
+
"triggerRef",
|
|
3246
|
+
"portalRef"
|
|
3247
|
+
]);
|
|
3248
|
+
const [isOpen, setIsOpen] = React2.useState(false);
|
|
3249
|
+
const showHandler = React2.useCallback(() => {
|
|
3250
|
+
setIsOpen(true);
|
|
3251
|
+
}, []);
|
|
3252
|
+
const hideHandler = React2.useCallback(() => {
|
|
3253
|
+
setIsOpen(false);
|
|
3254
|
+
}, []);
|
|
3255
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.Popper, __spreadProps(__spreadValues({ offset: offset3, placement, middlewares: [core.flip(), core.shift({ padding: 5 })] }, popperProps), { children: [
|
|
3256
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3257
|
+
exports.Popper.Trigger,
|
|
3258
|
+
{
|
|
3259
|
+
ref: triggerRef,
|
|
3260
|
+
isOpen,
|
|
3261
|
+
onMouseOver: showHandler,
|
|
3262
|
+
onMouseLeave: hideHandler,
|
|
3263
|
+
onFocus: showHandler,
|
|
3264
|
+
onBlur: hideHandler,
|
|
3265
|
+
children: trigger
|
|
3266
|
+
}
|
|
3267
|
+
),
|
|
3268
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Portal, { ref: portalRef, children: popper })
|
|
3269
|
+
] }));
|
|
3270
|
+
};
|
|
3271
|
+
Tooltip.Content = TooltipContent;
|
|
3272
|
+
exports.Tooltip = Tooltip;
|
|
3221
3273
|
var SpaceMarginWrapper = styled5__default.default(framerMotion.motion.div)`
|
|
3222
3274
|
position: relative;
|
|
3223
3275
|
display: flex;
|