@shoplflow/base 0.30.5 → 0.30.7

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
@@ -506,13 +506,17 @@ interface ModalFooterType extends React.FC<ModalBodyProps> {
506
506
  declare type ModalStateType = {
507
507
  component: ReactNode;
508
508
  id?: string;
509
+ /**
510
+ * custom zIndex를 넣어주세요
511
+ */
512
+ zIndex?: number;
509
513
  };
510
514
  declare type RemoveModalProps = {
511
515
  id?: string;
512
516
  deps?: number;
513
517
  };
514
518
  declare type ModalHandlerContext = {
515
- addModal: (modal: ReactNode, id?: string) => void;
519
+ addModal: (modal: ReactNode, id?: string, zIndex?: number) => void;
516
520
  removeModal: (props?: RemoveModalProps) => void;
517
521
  };
518
522
  declare const ModalHandlerContext: React$1.Context<ModalHandlerContext>;
@@ -524,7 +528,7 @@ declare const useModalValue: () => {
524
528
  };
525
529
 
526
530
  declare const useHandleModal: () => {
527
- addModal: (modal: React$1.ReactNode, id?: string | undefined) => void;
531
+ addModal: (modal: React$1.ReactNode, id?: string | undefined, zIndex?: number | undefined) => void;
528
532
  removeModal: (props?: RemoveModalProps | undefined) => void;
529
533
  };
530
534
 
@@ -536,6 +540,7 @@ declare const Modal: {
536
540
  };
537
541
 
538
542
  interface BackDropProps extends ChildrenProps, BackDropOptionProps {
543
+ zIndex?: number;
539
544
  }
540
545
  interface BackDropOptionProps {
541
546
  }
package/dist/index.d.ts CHANGED
@@ -506,13 +506,17 @@ interface ModalFooterType extends React.FC<ModalBodyProps> {
506
506
  declare type ModalStateType = {
507
507
  component: ReactNode;
508
508
  id?: string;
509
+ /**
510
+ * custom zIndex를 넣어주세요
511
+ */
512
+ zIndex?: number;
509
513
  };
510
514
  declare type RemoveModalProps = {
511
515
  id?: string;
512
516
  deps?: number;
513
517
  };
514
518
  declare type ModalHandlerContext = {
515
- addModal: (modal: ReactNode, id?: string) => void;
519
+ addModal: (modal: ReactNode, id?: string, zIndex?: number) => void;
516
520
  removeModal: (props?: RemoveModalProps) => void;
517
521
  };
518
522
  declare const ModalHandlerContext: React$1.Context<ModalHandlerContext>;
@@ -524,7 +528,7 @@ declare const useModalValue: () => {
524
528
  };
525
529
 
526
530
  declare const useHandleModal: () => {
527
- addModal: (modal: React$1.ReactNode, id?: string | undefined) => void;
531
+ addModal: (modal: React$1.ReactNode, id?: string | undefined, zIndex?: number | undefined) => void;
528
532
  removeModal: (props?: RemoveModalProps | undefined) => void;
529
533
  };
530
534
 
@@ -536,6 +540,7 @@ declare const Modal: {
536
540
  };
537
541
 
538
542
  interface BackDropProps extends ChildrenProps, BackDropOptionProps {
543
+ zIndex?: number;
539
544
  }
540
545
  interface BackDropOptionProps {
541
546
  }
package/dist/index.js CHANGED
@@ -162,12 +162,12 @@ var BackDropStyled = styled6(motion.div)`
162
162
  position: fixed;
163
163
  top: 0;
164
164
  left: 0;
165
- z-index: 20000;
165
+ z-index: ${({ zIndex }) => zIndex || 2e4};
166
166
  width: 100%;
167
167
  height: 100%;
168
168
  background: rgba(51, 51, 51, 0.6);
169
169
  `;
170
- var BackDrop = ({ children }) => {
170
+ var BackDrop = ({ children, zIndex }) => {
171
171
  return /* @__PURE__ */ jsx(
172
172
  BackDropStyled,
173
173
  {
@@ -176,6 +176,7 @@ var BackDrop = ({ children }) => {
176
176
  animate: "animate",
177
177
  exit: "exit",
178
178
  "data-shoplflow": "BackDrop",
179
+ zIndex,
179
180
  children
180
181
  }
181
182
  );
@@ -1028,12 +1029,12 @@ var useHandleModal = () => {
1028
1029
  };
1029
1030
  var ModalProvider = ({ children }) => {
1030
1031
  const [openedModals, setOpenedModals] = useState([]);
1031
- const addModal = (component, id) => {
1032
+ const addModal = (component, id, zIndex) => {
1032
1033
  setOpenedModals((modals) => {
1033
1034
  if (modals) {
1034
- return [...modals, { component, id }];
1035
+ return [...modals, { component, id, zIndex }];
1035
1036
  }
1036
- return [{ component, id }];
1037
+ return [{ component, id, zIndex }];
1037
1038
  });
1038
1039
  };
1039
1040
  const removeModal = (props) => {
@@ -4136,7 +4137,7 @@ var SpaceMarginWrapper = styled6(motion.div)`
4136
4137
  var ModalPortal = () => {
4137
4138
  const modal = useContext(ModalContext);
4138
4139
  return /* @__PURE__ */ jsx(Fragment, { children: createPortal(
4139
- /* @__PURE__ */ jsx(AnimatePresence, { children: modal.map((item, index) => /* @__PURE__ */ jsx(BackDrop_default, { children: /* @__PURE__ */ jsx(SpaceMarginWrapper, { children: item.component }) }, index)) }),
4140
+ /* @__PURE__ */ jsx(AnimatePresence, { children: modal.map((item, index) => /* @__PURE__ */ jsx(BackDrop_default, { zIndex: item.zIndex, children: /* @__PURE__ */ jsx(SpaceMarginWrapper, { children: item.component }) }, index)) }),
4140
4141
  document.body
4141
4142
  ) });
4142
4143
  };