@shoplflow/base 0.24.28 → 0.24.30

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
@@ -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
- exports.StyledPopper = styled5__default.default.div`
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(exports.StyledPopper, __spreadProps(__spreadValues({ ref: refs, "data-shoplflow": "Popper" }, rest), { children }));
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
- exports.getDropdownHeightBySizeVar = (size2) => {
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
- exports.getDropdownFontSizeBySizeVar = (size2) => {
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
- exports.getDropdownStyleBySizeVar = (size2) => {
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
- exports.getDropdownIconSizeBySizeVar = (size2) => {
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
- exports.StyledDropdown = styled5__default.default.div`
1807
+ var StyledDropdown = styled5__default.default.div`
1807
1808
  width: ${({ width }) => width};
1808
1809
  `;
1809
- exports.StyledDropdownContent = styled5__default.default.div`
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
- exports.StyledDropdownButton = styled5__default.default.button`
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 && exports.getDropdownStyleBySizeVar(sizeVar)};
1829
+ ${({ sizeVar }) => sizeVar && getDropdownStyleBySizeVar(sizeVar)};
1829
1830
  ${({ disabled }) => disabled && react$1.css`
1830
1831
  cursor: not-allowed;
1831
1832
  `}
1832
1833
  `;
1833
- exports.DropdownButtonIcon = styled5__default.default(framerMotion.motion.div)`
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 && exports.getDropdownIconSizeBySizeVar(sizeVar)};
1839
+ ${({ sizeVar }) => sizeVar && getDropdownIconSizeBySizeVar(sizeVar)};
1839
1840
  `;
1840
1841
  var DropdownContext = React2.createContext(null);
1841
1842
  var useDropdown = () => {
@@ -1874,19 +1875,13 @@ var getStyleByType = ({
1874
1875
  height: 32px;
1875
1876
  `;
1876
1877
  }
1877
- if (type === "text" || type === "password") {
1878
- return react$1.css`
1879
- width: ${width != null ? width : "100%"};
1880
- min-width: ${minWidth != null ? minWidth : "initial"};
1881
- max-width: ${maxWidth != null ? maxWidth : "initial"};
1882
- height: ${height != null ? height : "initial"};
1883
- min-height: ${minHeight != null ? minHeight : "initial"};
1884
- max-height: ${maxHeight != null ? maxHeight : "initial"};
1885
- `;
1886
- }
1887
1878
  return react$1.css`
1888
- width: 64px;
1889
- height: 32px;
1879
+ width: ${width != null ? width : "100%"};
1880
+ min-width: ${minWidth != null ? minWidth : "initial"};
1881
+ max-width: ${maxWidth != null ? maxWidth : "initial"};
1882
+ height: ${height != null ? height : "initial"};
1883
+ min-height: ${minHeight != null ? minHeight : "initial"};
1884
+ max-height: ${maxHeight != null ? maxHeight : "initial"};
1890
1885
  `;
1891
1886
  };
1892
1887
  var InputWrapper = styled5__default.default.label`
@@ -1974,13 +1969,13 @@ var DropdownButton = React2.forwardRef(
1974
1969
  disabled,
1975
1970
  width,
1976
1971
  isError,
1977
- height: exports.getDropdownHeightBySizeVar(sizeVar),
1978
- children: /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
1972
+ height: getDropdownHeightBySizeVar(sizeVar),
1973
+ children: /* @__PURE__ */ jsxRuntime.jsxs(StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
1979
1974
  leftSource && leftSource,
1980
1975
  value || /* @__PURE__ */ jsxRuntime.jsx(
1981
1976
  exports.Text,
1982
1977
  {
1983
- typography: exports.getDropdownFontSizeBySizeVar(sizeVar),
1978
+ typography: getDropdownFontSizeBySizeVar(sizeVar),
1984
1979
  color: "neutral400",
1985
1980
  textOverflow: "ellipsis",
1986
1981
  lineClamp: 1,
@@ -1988,7 +1983,7 @@ var DropdownButton = React2.forwardRef(
1988
1983
  }
1989
1984
  ),
1990
1985
  /* @__PURE__ */ jsxRuntime.jsx(
1991
- exports.DropdownButtonIcon,
1986
+ DropdownButtonIcon,
1992
1987
  {
1993
1988
  sizeVar,
1994
1989
  animate: {
@@ -2025,7 +2020,7 @@ var DropdownContent = (_a) => {
2025
2020
  setIsOpen(false);
2026
2021
  }
2027
2022
  };
2028
- return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(exports.StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
2023
+ return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
2029
2024
  };
2030
2025
  var Dropdown = ({
2031
2026
  isOpen: initialIsOpen = false,
@@ -2051,7 +2046,7 @@ var Dropdown = ({
2051
2046
  }
2052
2047
  setIsOpen(initialIsOpen);
2053
2048
  }, [initialIsOpen]);
2054
- return /* @__PURE__ */ jsxRuntime.jsx(exports.StyledDropdown, { "data-shoplflow": "Dropdown", width, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownContext.Provider, { value: __spreadProps(__spreadValues({}, size2), { isOpen, setIsOpen, option }), children: /* @__PURE__ */ jsxRuntime.jsxs(
2049
+ 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
2050
  exports.Popper,
2056
2051
  {
2057
2052
  offset: 4,
@@ -2371,7 +2366,7 @@ var getStylesBySizeVar = (sizeVar) => {
2371
2366
  `;
2372
2367
  }
2373
2368
  };
2374
- exports.getFontStylesBySizeVar = (sizeVar) => {
2369
+ var getFontStylesBySizeVar = (sizeVar) => {
2375
2370
  switch (sizeVar) {
2376
2371
  case "XS":
2377
2372
  return "body2_400";
@@ -2383,7 +2378,7 @@ exports.getFontStylesBySizeVar = (sizeVar) => {
2383
2378
  return "body1_400";
2384
2379
  }
2385
2380
  };
2386
- exports.StyledMenu = styled5__default.default.li`
2381
+ var StyledMenu = styled5__default.default.li`
2387
2382
  display: flex;
2388
2383
  width: 100%;
2389
2384
  flex-direction: row;
@@ -2434,7 +2429,7 @@ var Menu = (_a) => {
2434
2429
  !disabled && onClick && onClick(e);
2435
2430
  };
2436
2431
  return /* @__PURE__ */ jsxRuntime.jsxs(
2437
- exports.StyledMenu,
2432
+ StyledMenu,
2438
2433
  __spreadProps(__spreadValues({
2439
2434
  sizeVar,
2440
2435
  isSelected: selected,
@@ -2444,7 +2439,7 @@ var Menu = (_a) => {
2444
2439
  "data-shoplflow": "Menu",
2445
2440
  children: [
2446
2441
  leftSource && LeftSourceClone,
2447
- /* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { width: "100%", height: "100%", align: "center", className: exports.getFontStylesBySizeVar(sizeVar), children }),
2442
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { width: "100%", height: "100%", align: "center", className: getFontStylesBySizeVar(sizeVar), children }),
2448
2443
  rightSource && rightSource
2449
2444
  ]
2450
2445
  })
@@ -2458,7 +2453,7 @@ exports.MenuSizeVariants = {
2458
2453
  S: "S",
2459
2454
  M: "M"
2460
2455
  };
2461
- exports.StyledList = styled5__default.default.li`
2456
+ var StyledList = styled5__default.default.li`
2462
2457
  display: flex;
2463
2458
  flex-direction: row;
2464
2459
  width: 100%;
@@ -2473,7 +2468,7 @@ exports.StyledList = styled5__default.default.li`
2473
2468
  background: ${exports.colorTokens.neutral100};
2474
2469
  }
2475
2470
  `;
2476
- exports.StyledText2Rows = styled5__default.default.div`
2471
+ var StyledText2Rows = styled5__default.default.div`
2477
2472
  display: flex;
2478
2473
  flex-direction: column;
2479
2474
  justify-content: center;
@@ -2485,14 +2480,14 @@ var List = (_a) => {
2485
2480
  if (!children && rightSource) {
2486
2481
  throw new Error("RightSource\uB294 children\uC774 \uD544\uC218\uB85C \uD3EC\uD568\uB418\uC5B4\uC57C\uD569\uB2C8\uB2E4.");
2487
2482
  }
2488
- return /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledList, __spreadProps(__spreadValues({ "data-shoplflow": "List" }, rest), { children: [
2483
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledList, __spreadProps(__spreadValues({ "data-shoplflow": "List" }, rest), { children: [
2489
2484
  LeftSourceClone && LeftSourceClone,
2490
2485
  /* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { height: "36px", width: "100%", spacing: "spacing08", align: "center", children }),
2491
2486
  rightSource && rightSource
2492
2487
  ] }));
2493
2488
  };
2494
2489
  exports.Text2Rows = ({ title, subTitle }) => {
2495
- return /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledText2Rows, { children: [
2490
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledText2Rows, { children: [
2496
2491
  /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_500", color: "neutral700", lineClamp: 1, wordBreak: "break-all", children: title }),
2497
2492
  subTitle && /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body2_400", color: "neutral400", lineClamp: 1, wordBreak: "break-all", children: subTitle })
2498
2493
  ] });
@@ -2866,7 +2861,7 @@ var Input = React2.forwardRef(
2866
2861
  }
2867
2862
  );
2868
2863
  exports.Input = Input;
2869
- exports.StyledInputButton = styled5__default.default.div`
2864
+ var StyledInputButton = styled5__default.default.div`
2870
2865
  display: flex;
2871
2866
  flex-direction: row;
2872
2867
  align-items: center;
@@ -2881,7 +2876,7 @@ exports.StyledInputButton = styled5__default.default.div`
2881
2876
  cursor: not-allowed;
2882
2877
  `}
2883
2878
  `;
2884
- exports.StyledInputButtonContent = styled5__default.default.input`
2879
+ var StyledInputButtonContent = styled5__default.default.input`
2885
2880
  display: flex;
2886
2881
  width: 100%;
2887
2882
  border: none;
@@ -2973,8 +2968,8 @@ var InputButton = React2.forwardRef(
2973
2968
  minHeight: "40px",
2974
2969
  maxHeight: "40px",
2975
2970
  width,
2976
- children: /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledInputButton, { onClick: handleOnClick, disabled, children: [
2977
- /* @__PURE__ */ jsxRuntime.jsx(exports.StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
2971
+ children: /* @__PURE__ */ jsxRuntime.jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
2972
+ /* @__PURE__ */ jsxRuntime.jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
2978
2973
  /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2979
2974
  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
2975
  rightSource
@@ -3218,6 +3213,57 @@ var SelectInputButton = (_a) => {
3218
3213
  );
3219
3214
  };
3220
3215
  exports.SelectInputButton = SelectInputButton;
3216
+ var StyledTooltipContent = styled5__default.default.div`
3217
+ background-color: ${exports.colorTokens.neutral700};
3218
+ padding: 4px 8px;
3219
+ max-width: 240px;
3220
+ border-radius: 4px;
3221
+ `;
3222
+ var TooltipContent = (_a) => {
3223
+ var _b = _a, { content } = _b, args = __objRest(_b, ["content"]);
3224
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledTooltipContent, __spreadProps(__spreadValues({}, args), { children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "caption_400", color: "neutral0", wordBreak: "break-all", children: content }) }));
3225
+ };
3226
+ var Tooltip = (_a) => {
3227
+ var _b = _a, {
3228
+ trigger,
3229
+ popper,
3230
+ placement = "bottom-start",
3231
+ offset: offset3 = 4,
3232
+ triggerRef,
3233
+ portalRef
3234
+ } = _b, popperProps = __objRest(_b, [
3235
+ "trigger",
3236
+ "popper",
3237
+ "placement",
3238
+ "offset",
3239
+ "triggerRef",
3240
+ "portalRef"
3241
+ ]);
3242
+ const [isOpen, setIsOpen] = React2.useState(false);
3243
+ const showHandler = React2.useCallback(() => {
3244
+ setIsOpen(true);
3245
+ }, []);
3246
+ const hideHandler = React2.useCallback(() => {
3247
+ setIsOpen(false);
3248
+ }, []);
3249
+ return /* @__PURE__ */ jsxRuntime.jsxs(exports.Popper, __spreadProps(__spreadValues({ offset: offset3, placement, middlewares: [core.flip(), core.shift({ padding: 5 })] }, popperProps), { children: [
3250
+ /* @__PURE__ */ jsxRuntime.jsx(
3251
+ exports.Popper.Trigger,
3252
+ {
3253
+ ref: triggerRef,
3254
+ isOpen,
3255
+ onMouseOver: showHandler,
3256
+ onMouseLeave: hideHandler,
3257
+ onFocus: showHandler,
3258
+ onBlur: hideHandler,
3259
+ children: trigger
3260
+ }
3261
+ ),
3262
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Portal, { ref: portalRef, children: popper })
3263
+ ] }));
3264
+ };
3265
+ Tooltip.Content = TooltipContent;
3266
+ exports.Tooltip = Tooltip;
3221
3267
  var SpaceMarginWrapper = styled5__default.default(framerMotion.motion.div)`
3222
3268
  position: relative;
3223
3269
  display: flex;