@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.cjs CHANGED
@@ -2839,16 +2839,17 @@ var StyledTreeItem = styled6__default.default(framerMotion.motion.li)`
2839
2839
  gap: 4px;
2840
2840
  align-items: center;
2841
2841
  justify-content: space-between;
2842
- padding: 8px 0;
2842
+ padding: 8px 8px 8px 0;
2843
2843
  border-radius: 8px;
2844
2844
  background: transparent;
2845
- cursor: initial;
2845
+ cursor: ${({ onClick }) => onClick ? "pointer" : "initial"};
2846
2846
  ${({ depth }) => depth && react$1.css`
2847
2847
  padding-left: ${depth * 16}px;
2848
2848
  `};
2849
2849
  &:hover {
2850
2850
  background: ${exports.colorTokens.neutral400_5};
2851
2851
  }
2852
+ ${({ disabled }) => disabled && getDisabledStyle(disabled)}
2852
2853
  `;
2853
2854
  var LeftElementWrapper = styled6__default.default.div`
2854
2855
  display: flex;
@@ -2894,7 +2895,8 @@ exports.TreeItem = (_a) => {
2894
2895
  rightSource,
2895
2896
  depth = 0,
2896
2897
  initialIsOpen,
2897
- isOpen
2898
+ isOpen,
2899
+ disabled = false
2898
2900
  } = _b, rest = __objRest(_b, [
2899
2901
  "children",
2900
2902
  "label",
@@ -2902,7 +2904,8 @@ exports.TreeItem = (_a) => {
2902
2904
  "rightSource",
2903
2905
  "depth",
2904
2906
  "initialIsOpen",
2905
- "isOpen"
2907
+ "isOpen",
2908
+ "disabled"
2906
2909
  ]);
2907
2910
  const [isOpened, setIsOpened] = React3__namespace.default.useState(initialIsOpen != null ? initialIsOpen : false);
2908
2911
  const CloneChildren = React3__namespace.default.Children.map(children, (child) => {
@@ -2916,7 +2919,8 @@ exports.TreeItem = (_a) => {
2916
2919
  }
2917
2920
  return child;
2918
2921
  });
2919
- const handleToggle = () => {
2922
+ const handleToggle = (e) => {
2923
+ e.stopPropagation();
2920
2924
  setIsOpened((prev) => !prev);
2921
2925
  };
2922
2926
  React3.useEffect(() => {
@@ -2925,24 +2929,36 @@ exports.TreeItem = (_a) => {
2925
2929
  }
2926
2930
  }, [isOpen]);
2927
2931
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2928
- /* @__PURE__ */ React3.createElement(StyledTreeItem, __spreadValues(__spreadProps(__spreadValues({ depth, variants: fadeInOut }, AnimateKey), { layout: true, key: String(label) }), rest), /* @__PURE__ */ jsxRuntime.jsxs(LeftElementWrapper, { children: [
2929
- leftSource,
2930
- /* @__PURE__ */ jsxRuntime.jsx(exports.StackContainer, { padding: "0 0 0 4px", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", lineClamp: 1, children: label }) })
2931
- ] }), /* @__PURE__ */ jsxRuntime.jsxs(RightElementWrapper, { children: [
2932
- rightSource,
2933
- children && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { styleVar: "GHOST", onClick: handleToggle, children: /* @__PURE__ */ jsxRuntime.jsx(
2934
- IconWrapper,
2935
- {
2936
- animate: {
2937
- rotate: isOpened ? 180 : 0,
2938
- transition: {
2939
- duration: 0.2
2940
- }
2941
- },
2942
- children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.DownArrowIcon, sizeVar: "S" })
2943
- }
2944
- ) })
2945
- ] })),
2932
+ /* @__PURE__ */ React3.createElement(
2933
+ StyledTreeItem,
2934
+ __spreadValues(__spreadProps(__spreadValues({
2935
+ disabled,
2936
+ depth,
2937
+ variants: fadeInOut
2938
+ }, AnimateKey), {
2939
+ layout: true,
2940
+ key: String(label)
2941
+ }), rest),
2942
+ /* @__PURE__ */ jsxRuntime.jsxs(LeftElementWrapper, { children: [
2943
+ leftSource,
2944
+ /* @__PURE__ */ jsxRuntime.jsx(exports.StackContainer, { padding: "0 0 0 4px", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", lineClamp: 1, color: disabled ? "neutral350" : "neutral700", children: label }) })
2945
+ ] }),
2946
+ /* @__PURE__ */ jsxRuntime.jsxs(RightElementWrapper, { children: [
2947
+ rightSource,
2948
+ children && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { styleVar: "GHOST", onClick: handleToggle, sizeVar: "S", children: /* @__PURE__ */ jsxRuntime.jsx(
2949
+ IconWrapper,
2950
+ {
2951
+ animate: {
2952
+ rotate: isOpened ? 180 : 0,
2953
+ transition: {
2954
+ duration: 0.2
2955
+ }
2956
+ },
2957
+ children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.DownArrowIcon, sizeVar: "S", color: "neutral400" })
2958
+ }
2959
+ ) })
2960
+ ] })
2961
+ ),
2946
2962
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "sync", children: isOpened && children && /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, __spreadProps(__spreadValues({ layout: true }, AnimateKey), { variants: fadeInOut, children: CloneChildren }), "children" + String(CloneChildren)) })
2947
2963
  ] });
2948
2964
  };