@shoplflow/base 0.24.27 → 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 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 = () => {
@@ -1859,16 +1860,42 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
1859
1860
  }
1860
1861
  return exports.colorTokens.neutral300;
1861
1862
  };
1863
+ var getStyleByType = ({
1864
+ type,
1865
+ height,
1866
+ minHeight,
1867
+ maxHeight,
1868
+ width,
1869
+ minWidth,
1870
+ maxWidth
1871
+ }) => {
1872
+ if (type === "number") {
1873
+ return react$1.css`
1874
+ width: 64px;
1875
+ height: 32px;
1876
+ `;
1877
+ }
1878
+ if (type === "text" || type === "password") {
1879
+ return react$1.css`
1880
+ width: ${width != null ? width : "100%"};
1881
+ min-width: ${minWidth != null ? minWidth : "initial"};
1882
+ max-width: ${maxWidth != null ? maxWidth : "initial"};
1883
+ height: ${height != null ? height : "initial"};
1884
+ min-height: ${minHeight != null ? minHeight : "initial"};
1885
+ max-height: ${maxHeight != null ? maxHeight : "initial"};
1886
+ `;
1887
+ }
1888
+ return react$1.css`
1889
+ width: 64px;
1890
+ height: 32px;
1891
+ `;
1892
+ };
1862
1893
  var InputWrapper = styled5__default.default.label`
1894
+ position: relative;
1863
1895
  display: flex;
1864
1896
  align-items: center;
1865
1897
  flex-direction: ${({ direction }) => direction || "row"};
1866
- width: ${({ width }) => width != null ? width : "100%"};
1867
- min-width: ${({ minWidth }) => minWidth != null ? minWidth : "initial"};
1868
- max-width: ${({ maxWidth }) => maxWidth != null ? maxWidth : "initial"};
1869
- min-height: ${({ minHeight }) => minHeight != null ? minHeight : "initial"};
1870
- max-height: ${({ maxHeight }) => maxHeight != null ? maxHeight : "initial"};
1871
- height: ${({ height }) => height != null ? height : "initial"};
1898
+ ${({ type, height, minHeight, maxHeight, width, maxWidth, minWidth }) => getStyleByType({ type, height, minHeight, maxHeight, width, maxWidth, minWidth })};
1872
1899
  justify-content: space-between;
1873
1900
  gap: 8px;
1874
1901
  border: 1px solid ${(props) => getBorderColorByStatus(props)};
@@ -1948,13 +1975,13 @@ var DropdownButton = React2.forwardRef(
1948
1975
  disabled,
1949
1976
  width,
1950
1977
  isError,
1951
- height: exports.getDropdownHeightBySizeVar(sizeVar),
1952
- children: /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
1978
+ height: getDropdownHeightBySizeVar(sizeVar),
1979
+ children: /* @__PURE__ */ jsxRuntime.jsxs(StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
1953
1980
  leftSource && leftSource,
1954
1981
  value || /* @__PURE__ */ jsxRuntime.jsx(
1955
1982
  exports.Text,
1956
1983
  {
1957
- typography: exports.getDropdownFontSizeBySizeVar(sizeVar),
1984
+ typography: getDropdownFontSizeBySizeVar(sizeVar),
1958
1985
  color: "neutral400",
1959
1986
  textOverflow: "ellipsis",
1960
1987
  lineClamp: 1,
@@ -1962,7 +1989,7 @@ var DropdownButton = React2.forwardRef(
1962
1989
  }
1963
1990
  ),
1964
1991
  /* @__PURE__ */ jsxRuntime.jsx(
1965
- exports.DropdownButtonIcon,
1992
+ DropdownButtonIcon,
1966
1993
  {
1967
1994
  sizeVar,
1968
1995
  animate: {
@@ -1999,7 +2026,7 @@ var DropdownContent = (_a) => {
1999
2026
  setIsOpen(false);
2000
2027
  }
2001
2028
  };
2002
- return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(exports.StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
2029
+ return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
2003
2030
  };
2004
2031
  var Dropdown = ({
2005
2032
  isOpen: initialIsOpen = false,
@@ -2025,7 +2052,7 @@ var Dropdown = ({
2025
2052
  }
2026
2053
  setIsOpen(initialIsOpen);
2027
2054
  }, [initialIsOpen]);
2028
- 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(
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(
2029
2056
  exports.Popper,
2030
2057
  {
2031
2058
  offset: 4,
@@ -2345,7 +2372,7 @@ var getStylesBySizeVar = (sizeVar) => {
2345
2372
  `;
2346
2373
  }
2347
2374
  };
2348
- exports.getFontStylesBySizeVar = (sizeVar) => {
2375
+ var getFontStylesBySizeVar = (sizeVar) => {
2349
2376
  switch (sizeVar) {
2350
2377
  case "XS":
2351
2378
  return "body2_400";
@@ -2357,7 +2384,7 @@ exports.getFontStylesBySizeVar = (sizeVar) => {
2357
2384
  return "body1_400";
2358
2385
  }
2359
2386
  };
2360
- exports.StyledMenu = styled5__default.default.li`
2387
+ var StyledMenu = styled5__default.default.li`
2361
2388
  display: flex;
2362
2389
  width: 100%;
2363
2390
  flex-direction: row;
@@ -2408,7 +2435,7 @@ var Menu = (_a) => {
2408
2435
  !disabled && onClick && onClick(e);
2409
2436
  };
2410
2437
  return /* @__PURE__ */ jsxRuntime.jsxs(
2411
- exports.StyledMenu,
2438
+ StyledMenu,
2412
2439
  __spreadProps(__spreadValues({
2413
2440
  sizeVar,
2414
2441
  isSelected: selected,
@@ -2418,7 +2445,7 @@ var Menu = (_a) => {
2418
2445
  "data-shoplflow": "Menu",
2419
2446
  children: [
2420
2447
  leftSource && LeftSourceClone,
2421
- /* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { width: "100%", height: "100%", align: "center", className: exports.getFontStylesBySizeVar(sizeVar), children }),
2448
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { width: "100%", height: "100%", align: "center", className: getFontStylesBySizeVar(sizeVar), children }),
2422
2449
  rightSource && rightSource
2423
2450
  ]
2424
2451
  })
@@ -2432,7 +2459,7 @@ exports.MenuSizeVariants = {
2432
2459
  S: "S",
2433
2460
  M: "M"
2434
2461
  };
2435
- exports.StyledList = styled5__default.default.li`
2462
+ var StyledList = styled5__default.default.li`
2436
2463
  display: flex;
2437
2464
  flex-direction: row;
2438
2465
  width: 100%;
@@ -2447,7 +2474,7 @@ exports.StyledList = styled5__default.default.li`
2447
2474
  background: ${exports.colorTokens.neutral100};
2448
2475
  }
2449
2476
  `;
2450
- exports.StyledText2Rows = styled5__default.default.div`
2477
+ var StyledText2Rows = styled5__default.default.div`
2451
2478
  display: flex;
2452
2479
  flex-direction: column;
2453
2480
  justify-content: center;
@@ -2459,14 +2486,14 @@ var List = (_a) => {
2459
2486
  if (!children && rightSource) {
2460
2487
  throw new Error("RightSource\uB294 children\uC774 \uD544\uC218\uB85C \uD3EC\uD568\uB418\uC5B4\uC57C\uD569\uB2C8\uB2E4.");
2461
2488
  }
2462
- return /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledList, __spreadProps(__spreadValues({ "data-shoplflow": "List" }, rest), { children: [
2489
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledList, __spreadProps(__spreadValues({ "data-shoplflow": "List" }, rest), { children: [
2463
2490
  LeftSourceClone && LeftSourceClone,
2464
2491
  /* @__PURE__ */ jsxRuntime.jsx(exports.Stack.Horizontal, { height: "36px", width: "100%", spacing: "spacing08", align: "center", children }),
2465
2492
  rightSource && rightSource
2466
2493
  ] }));
2467
2494
  };
2468
2495
  exports.Text2Rows = ({ title, subTitle }) => {
2469
- return /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledText2Rows, { children: [
2496
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledText2Rows, { children: [
2470
2497
  /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_500", color: "neutral700", lineClamp: 1, wordBreak: "break-all", children: title }),
2471
2498
  subTitle && /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body2_400", color: "neutral400", lineClamp: 1, wordBreak: "break-all", children: subTitle })
2472
2499
  ] });
@@ -2603,7 +2630,8 @@ exports.TagSizeVariants = {
2603
2630
  var StyledInput = styled5__default.default.input`
2604
2631
  padding: 4px 0 4px 12px;
2605
2632
  background-color: transparent;
2606
- width: 100%;
2633
+ display: flex;
2634
+ min-width: 64px;
2607
2635
  border: none;
2608
2636
  box-sizing: border-box;
2609
2637
  &::placeholder {
@@ -2624,6 +2652,12 @@ var StyledInput = styled5__default.default.input`
2624
2652
  text-align: center;
2625
2653
  -moz-appearance: textfield;
2626
2654
  }
2655
+
2656
+ *,
2657
+ *:before,
2658
+ *:after {
2659
+ box-sizing: inherit;
2660
+ }
2627
2661
  `;
2628
2662
  var RightElementWrapper = styled5__default.default.div`
2629
2663
  display: flex;
@@ -2686,7 +2720,7 @@ var Input = React2.forwardRef(
2686
2720
  min,
2687
2721
  max,
2688
2722
  className,
2689
- width = "100%"
2723
+ width
2690
2724
  } = _b, rest = __objRest(_b, [
2691
2725
  "onFocus",
2692
2726
  "onBlur",
@@ -2705,7 +2739,7 @@ var Input = React2.forwardRef(
2705
2739
  ]);
2706
2740
  const [text, setText] = React2.useState("");
2707
2741
  const [isFocused, setIsFocused] = React2.useState(false);
2708
- const [type, setType] = React2.useState("text");
2742
+ const [type, setType] = React2.useState(void 0);
2709
2743
  const [isHovered, setIsHovered] = React2.useState(false);
2710
2744
  const uniqueId = React2.useId();
2711
2745
  const inputRef = React2__namespace.default.useRef(null);
@@ -2752,13 +2786,6 @@ var Input = React2.forwardRef(
2752
2786
  }
2753
2787
  setText(slicedText);
2754
2788
  };
2755
- const getWidth = () => {
2756
- if (type === "number") {
2757
- return "64px";
2758
- } else {
2759
- return width;
2760
- }
2761
- };
2762
2789
  const handleOnClear = () => {
2763
2790
  onClear && onClear();
2764
2791
  if (inputRef.current) {
@@ -2802,9 +2829,10 @@ var Input = React2.forwardRef(
2802
2829
  isHovered,
2803
2830
  onMouseEnter: handleOnMouseEnter,
2804
2831
  onMouseLeave: handleOnMouseLeave,
2805
- width: getWidth(),
2806
- height: type === "number" ? "32px" : "40px",
2807
- maxHeight: type === "number" ? "32px" : "40px",
2832
+ type,
2833
+ width,
2834
+ height: "40px",
2835
+ maxHeight: "40px",
2808
2836
  "data-shoplflow": "input",
2809
2837
  children: [
2810
2838
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2839,7 +2867,7 @@ var Input = React2.forwardRef(
2839
2867
  }
2840
2868
  );
2841
2869
  exports.Input = Input;
2842
- exports.StyledInputButton = styled5__default.default.div`
2870
+ var StyledInputButton = styled5__default.default.div`
2843
2871
  display: flex;
2844
2872
  flex-direction: row;
2845
2873
  align-items: center;
@@ -2854,7 +2882,7 @@ exports.StyledInputButton = styled5__default.default.div`
2854
2882
  cursor: not-allowed;
2855
2883
  `}
2856
2884
  `;
2857
- exports.StyledInputButtonContent = styled5__default.default.input`
2885
+ var StyledInputButtonContent = styled5__default.default.input`
2858
2886
  display: flex;
2859
2887
  width: 100%;
2860
2888
  border: none;
@@ -2946,8 +2974,8 @@ var InputButton = React2.forwardRef(
2946
2974
  minHeight: "40px",
2947
2975
  maxHeight: "40px",
2948
2976
  width,
2949
- children: /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledInputButton, { onClick: handleOnClick, disabled, children: [
2950
- /* @__PURE__ */ jsxRuntime.jsx(exports.StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
2977
+ children: /* @__PURE__ */ jsxRuntime.jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
2978
+ /* @__PURE__ */ jsxRuntime.jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
2951
2979
  /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2952
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" }) }),
2953
2981
  rightSource
@@ -3191,6 +3219,57 @@ var SelectInputButton = (_a) => {
3191
3219
  );
3192
3220
  };
3193
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;
3194
3273
  var SpaceMarginWrapper = styled5__default.default(framerMotion.motion.div)`
3195
3274
  position: relative;
3196
3275
  display: flex;