@shoplflow/base 0.28.5 → 0.29.0

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.d.cts CHANGED
@@ -945,14 +945,15 @@ interface TreeItemOptionProps extends ChildrenProps, LeftElementProps, RightElem
945
945
  * 트리아이템을 직접 조작할 때 사용합니다.
946
946
  */
947
947
  isOpen?: boolean;
948
+ disabled?: boolean;
948
949
  }
949
950
  declare const TREE_SYMBOL_KEY: unique symbol;
950
951
 
951
952
  declare const Tree: {
952
953
  ({ children, ...rest }: TreeProps): react_jsx_runtime.JSX.Element | null;
953
- Item: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
954
+ Item: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, disabled, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
954
955
  };
955
- declare const TreeItem: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
956
+ declare const TreeItem: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, disabled, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
956
957
 
957
958
  declare const IconSizeVariants: {
958
959
  readonly XS: "XS";
package/dist/index.d.ts CHANGED
@@ -945,14 +945,15 @@ interface TreeItemOptionProps extends ChildrenProps, LeftElementProps, RightElem
945
945
  * 트리아이템을 직접 조작할 때 사용합니다.
946
946
  */
947
947
  isOpen?: boolean;
948
+ disabled?: boolean;
948
949
  }
949
950
  declare const TREE_SYMBOL_KEY: unique symbol;
950
951
 
951
952
  declare const Tree: {
952
953
  ({ children, ...rest }: TreeProps): react_jsx_runtime.JSX.Element | null;
953
- Item: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
954
+ Item: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, disabled, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
954
955
  };
955
- declare const TreeItem: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
956
+ declare const TreeItem: ({ children, label, leftSource, rightSource, depth, initialIsOpen, isOpen, disabled, ...rest }: TreeItemProps) => react_jsx_runtime.JSX.Element;
956
957
 
957
958
  declare const IconSizeVariants: {
958
959
  readonly XS: "XS";
package/dist/index.js CHANGED
@@ -2814,16 +2814,17 @@ var StyledTreeItem = styled6(motion.li)`
2814
2814
  gap: 4px;
2815
2815
  align-items: center;
2816
2816
  justify-content: space-between;
2817
- padding: 8px 0;
2817
+ padding: 8px 8px 8px 0;
2818
2818
  border-radius: 8px;
2819
2819
  background: transparent;
2820
- cursor: initial;
2820
+ cursor: ${({ onClick }) => onClick ? "pointer" : "initial"};
2821
2821
  ${({ depth }) => depth && css`
2822
2822
  padding-left: ${depth * 16}px;
2823
2823
  `};
2824
2824
  &:hover {
2825
2825
  background: ${colorTokens.neutral400_5};
2826
2826
  }
2827
+ ${({ disabled }) => disabled && getDisabledStyle(disabled)}
2827
2828
  `;
2828
2829
  var LeftElementWrapper = styled6.div`
2829
2830
  display: flex;
@@ -2869,7 +2870,8 @@ var TreeItem = (_a) => {
2869
2870
  rightSource,
2870
2871
  depth = 0,
2871
2872
  initialIsOpen,
2872
- isOpen
2873
+ isOpen,
2874
+ disabled = false
2873
2875
  } = _b, rest = __objRest(_b, [
2874
2876
  "children",
2875
2877
  "label",
@@ -2877,7 +2879,8 @@ var TreeItem = (_a) => {
2877
2879
  "rightSource",
2878
2880
  "depth",
2879
2881
  "initialIsOpen",
2880
- "isOpen"
2882
+ "isOpen",
2883
+ "disabled"
2881
2884
  ]);
2882
2885
  const [isOpened, setIsOpened] = React3__default.useState(initialIsOpen != null ? initialIsOpen : false);
2883
2886
  const CloneChildren = React3__default.Children.map(children, (child) => {
@@ -2891,7 +2894,8 @@ var TreeItem = (_a) => {
2891
2894
  }
2892
2895
  return child;
2893
2896
  });
2894
- const handleToggle = () => {
2897
+ const handleToggle = (e) => {
2898
+ e.stopPropagation();
2895
2899
  setIsOpened((prev) => !prev);
2896
2900
  };
2897
2901
  useEffect(() => {
@@ -2900,24 +2904,36 @@ var TreeItem = (_a) => {
2900
2904
  }
2901
2905
  }, [isOpen]);
2902
2906
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2903
- /* @__PURE__ */ createElement(StyledTreeItem, __spreadValues(__spreadProps(__spreadValues({ depth, variants: fadeInOut }, AnimateKey), { layout: true, key: String(label) }), rest), /* @__PURE__ */ jsxs(LeftElementWrapper, { children: [
2904
- leftSource,
2905
- /* @__PURE__ */ jsx(StackContainer_default, { padding: "0 0 0 4px", children: /* @__PURE__ */ jsx(Text_default, { typography: "body1_400", lineClamp: 1, children: label }) })
2906
- ] }), /* @__PURE__ */ jsxs(RightElementWrapper, { children: [
2907
- rightSource,
2908
- children && /* @__PURE__ */ jsx(IconButton_default, { styleVar: "GHOST", onClick: handleToggle, children: /* @__PURE__ */ jsx(
2909
- IconWrapper,
2910
- {
2911
- animate: {
2912
- rotate: isOpened ? 180 : 0,
2913
- transition: {
2914
- duration: 0.2
2915
- }
2916
- },
2917
- children: /* @__PURE__ */ jsx(Icon_default, { iconSource: DownArrowIcon, sizeVar: "S" })
2918
- }
2919
- ) })
2920
- ] })),
2907
+ /* @__PURE__ */ createElement(
2908
+ StyledTreeItem,
2909
+ __spreadValues(__spreadProps(__spreadValues({
2910
+ disabled,
2911
+ depth,
2912
+ variants: fadeInOut
2913
+ }, AnimateKey), {
2914
+ layout: true,
2915
+ key: String(label)
2916
+ }), rest),
2917
+ /* @__PURE__ */ jsxs(LeftElementWrapper, { children: [
2918
+ leftSource,
2919
+ /* @__PURE__ */ jsx(StackContainer_default, { padding: "0 0 0 4px", children: /* @__PURE__ */ jsx(Text_default, { typography: "body1_400", lineClamp: 1, color: disabled ? "neutral350" : "neutral700", children: label }) })
2920
+ ] }),
2921
+ /* @__PURE__ */ jsxs(RightElementWrapper, { children: [
2922
+ rightSource,
2923
+ children && /* @__PURE__ */ jsx(IconButton_default, { styleVar: "GHOST", onClick: handleToggle, sizeVar: "S", children: /* @__PURE__ */ jsx(
2924
+ IconWrapper,
2925
+ {
2926
+ animate: {
2927
+ rotate: isOpened ? 180 : 0,
2928
+ transition: {
2929
+ duration: 0.2
2930
+ }
2931
+ },
2932
+ children: /* @__PURE__ */ jsx(Icon_default, { iconSource: DownArrowIcon, sizeVar: "S", color: "neutral400" })
2933
+ }
2934
+ ) })
2935
+ ] })
2936
+ ),
2921
2937
  /* @__PURE__ */ jsx(AnimatePresence, { mode: "sync", children: isOpened && children && /* @__PURE__ */ jsx(motion.div, __spreadProps(__spreadValues({ layout: true }, AnimateKey), { variants: fadeInOut, children: CloneChildren }), "children" + String(CloneChildren)) })
2922
2938
  ] });
2923
2939
  };