@shoplflow/base 0.32.41 → 0.32.42
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 +71 -19
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +73 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -856,6 +856,9 @@ var FooterContainer = styled6__default.default.div`
|
|
|
856
856
|
border-top: 1px solid ${exports.colorTokens.neutral300};
|
|
857
857
|
background: ${exports.colorTokens.neutral0};
|
|
858
858
|
`;
|
|
859
|
+
var BottomContainer = styled6__default.default.footer`
|
|
860
|
+
width: 100%;
|
|
861
|
+
`;
|
|
859
862
|
|
|
860
863
|
// src/components/Modal/Modal.types.ts
|
|
861
864
|
exports.ModalSize = {
|
|
@@ -882,6 +885,27 @@ var useViewportSizeObserver = () => {
|
|
|
882
885
|
}, []);
|
|
883
886
|
return size2;
|
|
884
887
|
};
|
|
888
|
+
var ModalOptionContext = React3.createContext({
|
|
889
|
+
heightToDeduct: 0,
|
|
890
|
+
setHeightToDeduct: utils.noop,
|
|
891
|
+
clearHeightToDeduct: utils.noop
|
|
892
|
+
});
|
|
893
|
+
var ModalOptionContextProvider = ({ children }) => {
|
|
894
|
+
const [heightToDeduct, setHeightToDeduct] = React3.useState(0);
|
|
895
|
+
const controlHeightToDeduct = React3.useCallback((heightToAdd) => {
|
|
896
|
+
setHeightToDeduct((prev) => prev + heightToAdd);
|
|
897
|
+
}, []);
|
|
898
|
+
const clearHeightToDeduct = React3.useCallback(() => {
|
|
899
|
+
setHeightToDeduct(0);
|
|
900
|
+
}, []);
|
|
901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
902
|
+
ModalOptionContext.Provider,
|
|
903
|
+
{
|
|
904
|
+
value: { heightToDeduct, setHeightToDeduct: controlHeightToDeduct, clearHeightToDeduct },
|
|
905
|
+
children
|
|
906
|
+
}
|
|
907
|
+
);
|
|
908
|
+
};
|
|
885
909
|
var ModalContainer = (_a) => {
|
|
886
910
|
var _b = _a, { children, height, outsideClick = utils.noop } = _b, rest = __objRest(_b, ["children", "height", "outsideClick"]);
|
|
887
911
|
const ref = utils.useParentElementClick(outsideClick);
|
|
@@ -916,7 +940,7 @@ var ModalContainer = (_a) => {
|
|
|
916
940
|
height: heightWidthMargin
|
|
917
941
|
});
|
|
918
942
|
});
|
|
919
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container, __spreadProps(__spreadValues({ ref }, rest), { height: heightWidthMargin, viewport: windowHeight, "data-shoplflow": "Modal", children: addPropInChildren }));
|
|
943
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container, __spreadProps(__spreadValues({ ref }, rest), { height: heightWidthMargin, viewport: windowHeight, "data-shoplflow": "Modal", children: /* @__PURE__ */ jsxRuntime.jsx(ModalOptionContextProvider, { children: addPropInChildren }) }));
|
|
920
944
|
};
|
|
921
945
|
var ModalContainer_default = ModalContainer;
|
|
922
946
|
var ModalFooter = ({ children }) => {
|
|
@@ -954,6 +978,13 @@ var ScrollArea = React3.forwardRef((_a, ref) => {
|
|
|
954
978
|
) });
|
|
955
979
|
});
|
|
956
980
|
exports.ScrollArea = ScrollArea;
|
|
981
|
+
var useModalOption = () => {
|
|
982
|
+
const context = React3.useContext(ModalOptionContext);
|
|
983
|
+
if (!context) {
|
|
984
|
+
throw new Error(`useModalOption cannot be called outside the ModalOptionProvider`);
|
|
985
|
+
}
|
|
986
|
+
return context;
|
|
987
|
+
};
|
|
957
988
|
var ModalBody = ({
|
|
958
989
|
children,
|
|
959
990
|
isIncludeHeader = false,
|
|
@@ -962,6 +993,7 @@ var ModalBody = ({
|
|
|
962
993
|
height: modalContainerHeight
|
|
963
994
|
}) => {
|
|
964
995
|
const { height: windowHeight } = useViewportSizeObserver();
|
|
996
|
+
const { heightToDeduct } = useModalOption();
|
|
965
997
|
const headerHeight = 64;
|
|
966
998
|
const footerHeight = 72;
|
|
967
999
|
const topBottomMargin = 64;
|
|
@@ -983,11 +1015,11 @@ var ModalBody = ({
|
|
|
983
1015
|
if (modalContainerHeight) {
|
|
984
1016
|
if (modalContainerHeight <= 1200) {
|
|
985
1017
|
if (windowHeight < modalContainerHeight) {
|
|
986
|
-
return windowHeight - topBottomMargin - headerFooterHeight;
|
|
1018
|
+
return windowHeight - topBottomMargin - headerFooterHeight - heightToDeduct;
|
|
987
1019
|
}
|
|
988
|
-
return modalContainerHeight - topBottomMargin - headerFooterHeight;
|
|
1020
|
+
return modalContainerHeight - topBottomMargin - headerFooterHeight - heightToDeduct;
|
|
989
1021
|
}
|
|
990
|
-
return modalContainerHeight - topBottomMargin - headerFooterHeight;
|
|
1022
|
+
return modalContainerHeight - topBottomMargin - headerFooterHeight - heightToDeduct;
|
|
991
1023
|
} else {
|
|
992
1024
|
return "100%";
|
|
993
1025
|
}
|
|
@@ -1014,32 +1046,23 @@ var ModalBody = ({
|
|
|
1014
1046
|
}
|
|
1015
1047
|
return 0;
|
|
1016
1048
|
};
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
autoHeightMax = autoHeightMax - 24;
|
|
1020
|
-
if (isIncludeHeader) {
|
|
1021
|
-
autoHeightMax = autoHeightMax - 24;
|
|
1022
|
-
}
|
|
1023
|
-
if (!isIncludeHeader) {
|
|
1024
|
-
autoHeightMax = autoHeightMax - 16;
|
|
1025
|
-
}
|
|
1026
|
-
return autoHeightMax;
|
|
1027
|
-
};
|
|
1049
|
+
const autoHeightMin = setAutoHeightMin();
|
|
1050
|
+
const _autoHeightMin = typeof autoHeightMin === "string" ? autoHeightMin : autoHeightMin - heightToDeduct;
|
|
1028
1051
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
1052
|
BodyContainer,
|
|
1030
1053
|
{
|
|
1031
1054
|
isIncludeHeader,
|
|
1032
1055
|
sizeVar,
|
|
1033
|
-
minHeight:
|
|
1034
|
-
maxHeight: setAutoHeightMax(),
|
|
1056
|
+
minHeight: _autoHeightMin,
|
|
1057
|
+
maxHeight: setAutoHeightMax() - heightToDeduct,
|
|
1035
1058
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
1059
|
exports.ScrollArea,
|
|
1037
1060
|
{
|
|
1038
1061
|
id: `scrollbar`,
|
|
1039
1062
|
universal: true,
|
|
1040
1063
|
autoHeight: !modalContainerHeight,
|
|
1041
|
-
autoHeightMin:
|
|
1042
|
-
autoHeightMax:
|
|
1064
|
+
autoHeightMin: _autoHeightMin,
|
|
1065
|
+
autoHeightMax: "100%",
|
|
1043
1066
|
style: {},
|
|
1044
1067
|
children: /* @__PURE__ */ jsxRuntime.jsx(ModalBodyContainerInner, { children: /* @__PURE__ */ jsxRuntime.jsx(ModalBodyContent, { isIncludeHeader, sizeVar, children }) })
|
|
1045
1068
|
}
|
|
@@ -1053,6 +1076,33 @@ var ModalHeader = ({ children }) => {
|
|
|
1053
1076
|
};
|
|
1054
1077
|
ModalHeader[exports.MODAL_HEADER_KEY] = true;
|
|
1055
1078
|
var ModalHeader_default = ModalHeader;
|
|
1079
|
+
var ModalTop = ({ children }) => {
|
|
1080
|
+
const [topRef, setTopRef] = React3.useState(null);
|
|
1081
|
+
const { setHeightToDeduct, clearHeightToDeduct } = useModalOption();
|
|
1082
|
+
React3.useEffect(() => {
|
|
1083
|
+
if (!topRef) {
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
const { height } = topRef.getBoundingClientRect();
|
|
1087
|
+
setHeightToDeduct == null ? void 0 : setHeightToDeduct(height);
|
|
1088
|
+
return () => clearHeightToDeduct();
|
|
1089
|
+
}, [topRef, setHeightToDeduct, clearHeightToDeduct]);
|
|
1090
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: setTopRef, children });
|
|
1091
|
+
};
|
|
1092
|
+
var ModalTop_default = ModalTop;
|
|
1093
|
+
var ModalBottom = ({ children }) => {
|
|
1094
|
+
const [bottomRef, setBottomRef] = React3.useState(null);
|
|
1095
|
+
const { setHeightToDeduct, clearHeightToDeduct } = useModalOption();
|
|
1096
|
+
React3.useEffect(() => {
|
|
1097
|
+
if (!bottomRef) {
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
const { height } = bottomRef.getBoundingClientRect();
|
|
1101
|
+
setHeightToDeduct == null ? void 0 : setHeightToDeduct(height);
|
|
1102
|
+
return () => clearHeightToDeduct();
|
|
1103
|
+
}, [bottomRef, setHeightToDeduct, clearHeightToDeduct]);
|
|
1104
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BottomContainer, { ref: setBottomRef, children });
|
|
1105
|
+
};
|
|
1056
1106
|
exports.ModalHandlerContext = React3.createContext({
|
|
1057
1107
|
addModal: utils.noop,
|
|
1058
1108
|
removeModal: utils.noop
|
|
@@ -1147,7 +1197,9 @@ var ModalProvider_default = ModalProvider;
|
|
|
1147
1197
|
exports.Modal = {
|
|
1148
1198
|
Container: ModalContainer_default,
|
|
1149
1199
|
Header: ModalHeader_default,
|
|
1200
|
+
Top: ModalTop_default,
|
|
1150
1201
|
Body: ModalBody_default,
|
|
1202
|
+
Bottom: ModalBottom,
|
|
1151
1203
|
Footer: ModalFooter_default
|
|
1152
1204
|
};
|
|
1153
1205
|
var SwitchContainer = styled6__default.default.div`
|
package/dist/index.d.cts
CHANGED
|
@@ -504,6 +504,10 @@ declare const MODAL_FOOTER_KEY: unique symbol;
|
|
|
504
504
|
interface ModalFooterType extends React.FC<ModalBodyProps> {
|
|
505
505
|
[MODAL_FOOTER_KEY]?: boolean;
|
|
506
506
|
}
|
|
507
|
+
interface ModalTopProps extends ChildrenProps {
|
|
508
|
+
}
|
|
509
|
+
interface ModalBottomProps extends ChildrenProps {
|
|
510
|
+
}
|
|
507
511
|
|
|
508
512
|
declare type ModalStateType = {
|
|
509
513
|
component: ReactNode;
|
|
@@ -537,7 +541,9 @@ declare const useHandleModal: () => {
|
|
|
537
541
|
declare const Modal: {
|
|
538
542
|
Container: ({ children, height, outsideClick, ...rest }: ModalContainerProps) => react_jsx_runtime.JSX.Element;
|
|
539
543
|
Header: ModalHeaderType;
|
|
544
|
+
Top: ({ children }: ModalTopProps) => react_jsx_runtime.JSX.Element;
|
|
540
545
|
Body: ({ children, isIncludeHeader, isIncludeFooter, sizeVar, height: modalContainerHeight, }: ModalBodyProps) => react_jsx_runtime.JSX.Element;
|
|
546
|
+
Bottom: ({ children }: ModalBottomProps) => react_jsx_runtime.JSX.Element;
|
|
541
547
|
Footer: ModalFooterType;
|
|
542
548
|
};
|
|
543
549
|
|
|
@@ -1524,4 +1530,4 @@ declare type NumberComboboxProps = NumberComboboxOptionProps & Omit<InputHTMLAtt
|
|
|
1524
1530
|
|
|
1525
1531
|
declare const NumberCombobox: ({ disabled, onSelect, onChange, value, width, onBlur, items, isError, sizeVar, placeholder, maxLength, className, floatingZIndex, ...rest }: NumberComboboxProps) => react_jsx_runtime.JSX.Element;
|
|
1526
1532
|
|
|
1527
|
-
export { AnnualDatepicker, AnnualDatepickerProps, AsProp, Avatar, AvatarOptionProps, AvatarProps, AvatarSizeVariantType, AvatarSizeVariants, BackDropOptionProps, BackDropProps, BorderRadiusTokens, BoxShadowTokens, Button, ButtonComponent, ButtonOptionProps, ButtonProps, ButtonSizeVariantType, ButtonSizeVariants, ButtonStyleVariantType, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout, CalloutOptionProps, CalloutProps, CalloutType, CalloutTypes, Checkbox, CheckboxOptionProps, CheckboxProps, CheckboxStyleVariantType, CheckboxStyleVariants, ChipButton, ChipButtonOptionProps, ChipButtonProps, ChipButtonSizeVariantType, ChipButtonSizeVariants, ChipButtonStyleVariantType, ChipButtonStyleVariants, ChipToggle, ChipToggleOptionProps, ChipToggleProps, ChipToggleSizeVariantType, ChipToggleSizeVariants, ChipToggleStyleVariantType, ChipToggleStyleVariants, ColorTokens, DangerouslySetInnerHTML, DayCalendarType, DayDatepicker, DayDatepickerHeaderCustomProps, DayDatepickerOptionProps, DayDatepickerProps, DayDatepickerSizeVariantType, DayDatepickerSizeVariants, DomainType, Dropdown, DropdownButton, DropdownButtonContext, DropdownButtonContextType, DropdownButtonOptionProps, DropdownButtonProps, DropdownButtonSizeVariantType, DropdownButtonSizeVariants, DropdownButtonStyleVariantType, DropdownButtonStyleVariants, DropdownContentProps, DropdownOptionProps, DropdownOptionVariantType, DropdownProps, DropdownSizeVariantType, DropdownTriggerButtonProps, FontWeightTokens, Icon, IconButton, IconButtonComponent, IconButtonOptionProps, IconButtonProps, IconButtonSizeVariantType, IconButtonSizeVariants, IconButtonStyleVariantType, IconButtonStyleVariants, IconOptionProps, IconProps, IconSizeVariants, IconSizeVariantsType, Input, InputButton, InputButtonOptionProps, InputButtonProps, InputOptionProps, InputProps, InputSizeVariantType, InputSizeVariants, List, ListContent2ColumnsProps, ListOptionProps, ListProps, ListText2RowsProps, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu, MenuOptionProps, MenuProps, MenuSizeVariantType, MenuSizeVariants, MinusBoxOptionProps, MinusBoxProps, MinusButton, Modal, ModalBodyOptionProps, ModalBodyProps, ModalContainerOptionProps, ModalContainerProps, ModalContext, ModalFooterOptionProps, ModalFooterProps, ModalFooterType, ModalHandlerContext, ModalHeaderOptionProps, ModalHeaderProps, ModalHeaderType, ModalPortal as ModalProvider, ModalSize, ModalSizeType, ModalStateType, MonthClickDateInfo, MonthDatepicker, MonthDatepickerProps, MonthDatepickerStyleType, MotionStack, MotionStackComponentType, MotionStackContainer, MotionStackContainerComponentType, NumberCombobox, NumberComboboxErrorType, NumberComboboxInputType, NumberComboboxOptionProps, NumberComboboxProps, NumberComboboxSizeVariantType, NumberComboboxSizeVariants, Pagination, PaginationOptionProps, PaginationProps, PaginationSizeSelectorProps, PolymorphicComponentProps, PolymorphicRef, Popper, PopperOptionProps, PopperPortal, PopperPortalProps, PopperProps, PopperTrigger, PopperTriggerProps, RADIO_SYMBOL_KEY, Radio, RadioOptionProps, RadioProps, RemoveModalProps, ScrollArea, ScrollAreaOptionProps, ScrollAreaProps, ScrollbarRefType, SelectInputButton, SelectInputButtonOptionProps, SelectInputButtonProps, ShoplflowProvider, ShoplflowProviderProps, SpacingTokens, SplitButton, SplitButtonContext, SplitButtonContextType, SplitButtonOptionProps, SplitButtonProps, SplitButtonSizeVariantType, SplitButtonSizeVariants, SplitButtonStyleVariantType, SplitButtonStyleVariants, Stack, StackComponentType, StackContainer, StackContainerComponentType, StackContainerGenericProps, StackContainerOptionProps, StackContainerProps, StackGenericProps, StackOptionProps, StackProps, StyledIcon, StyledStack, StyledStackContainer, Switch, SwitchOptionProps, SwitchProps, TREE_SYMBOL_KEY, TabOptionProps, TabProps, TabSizeVariantType, TabSizeVariants, TabStyleVariantType, TabStyleVariants, TabStyledProps, TabTextStyledProps, Tabs, TabsContext, TabsContextType, TabsOptionProps, TabsProps, Tag, TagOptionProps, TagProps, TagSizeVariantType, TagSizeVariants, TagStyleVariantType, TagStyleVariants, Text, Text2Rows, TextArea, TextAreaOptionProps, TextAreaProps, TextOptionProps, TextProps, ToggleButton, ToggleButtonInnerRadioOptionProps, ToggleButtonInnerRadioProps, ToggleButtonOptionProps, ToggleButtonProps, ToggleButtonSizeVariantType, ToggleButtonSizeVariants, Tooltip, TooltipContentProps, TooltipOptionProps, TooltipProps, Tree, TreeItem, TreeItemOptionProps, TreeItemProps, TreeOptionProps, TreeProps, TypographyTokens, WeekClickDateInfo, WeekDatepicker, WeekDatepickerProps, WeekDatepickerStyleType, YearSelectProps, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
|
1533
|
+
export { AnnualDatepicker, AnnualDatepickerProps, AsProp, Avatar, AvatarOptionProps, AvatarProps, AvatarSizeVariantType, AvatarSizeVariants, BackDropOptionProps, BackDropProps, BorderRadiusTokens, BoxShadowTokens, Button, ButtonComponent, ButtonOptionProps, ButtonProps, ButtonSizeVariantType, ButtonSizeVariants, ButtonStyleVariantType, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout, CalloutOptionProps, CalloutProps, CalloutType, CalloutTypes, Checkbox, CheckboxOptionProps, CheckboxProps, CheckboxStyleVariantType, CheckboxStyleVariants, ChipButton, ChipButtonOptionProps, ChipButtonProps, ChipButtonSizeVariantType, ChipButtonSizeVariants, ChipButtonStyleVariantType, ChipButtonStyleVariants, ChipToggle, ChipToggleOptionProps, ChipToggleProps, ChipToggleSizeVariantType, ChipToggleSizeVariants, ChipToggleStyleVariantType, ChipToggleStyleVariants, ColorTokens, DangerouslySetInnerHTML, DayCalendarType, DayDatepicker, DayDatepickerHeaderCustomProps, DayDatepickerOptionProps, DayDatepickerProps, DayDatepickerSizeVariantType, DayDatepickerSizeVariants, DomainType, Dropdown, DropdownButton, DropdownButtonContext, DropdownButtonContextType, DropdownButtonOptionProps, DropdownButtonProps, DropdownButtonSizeVariantType, DropdownButtonSizeVariants, DropdownButtonStyleVariantType, DropdownButtonStyleVariants, DropdownContentProps, DropdownOptionProps, DropdownOptionVariantType, DropdownProps, DropdownSizeVariantType, DropdownTriggerButtonProps, FontWeightTokens, Icon, IconButton, IconButtonComponent, IconButtonOptionProps, IconButtonProps, IconButtonSizeVariantType, IconButtonSizeVariants, IconButtonStyleVariantType, IconButtonStyleVariants, IconOptionProps, IconProps, IconSizeVariants, IconSizeVariantsType, Input, InputButton, InputButtonOptionProps, InputButtonProps, InputOptionProps, InputProps, InputSizeVariantType, InputSizeVariants, List, ListContent2ColumnsProps, ListOptionProps, ListProps, ListText2RowsProps, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu, MenuOptionProps, MenuProps, MenuSizeVariantType, MenuSizeVariants, MinusBoxOptionProps, MinusBoxProps, MinusButton, Modal, ModalBodyOptionProps, ModalBodyProps, ModalBottomProps, ModalContainerOptionProps, ModalContainerProps, ModalContext, ModalFooterOptionProps, ModalFooterProps, ModalFooterType, ModalHandlerContext, ModalHeaderOptionProps, ModalHeaderProps, ModalHeaderType, ModalPortal as ModalProvider, ModalSize, ModalSizeType, ModalStateType, ModalTopProps, MonthClickDateInfo, MonthDatepicker, MonthDatepickerProps, MonthDatepickerStyleType, MotionStack, MotionStackComponentType, MotionStackContainer, MotionStackContainerComponentType, NumberCombobox, NumberComboboxErrorType, NumberComboboxInputType, NumberComboboxOptionProps, NumberComboboxProps, NumberComboboxSizeVariantType, NumberComboboxSizeVariants, Pagination, PaginationOptionProps, PaginationProps, PaginationSizeSelectorProps, PolymorphicComponentProps, PolymorphicRef, Popper, PopperOptionProps, PopperPortal, PopperPortalProps, PopperProps, PopperTrigger, PopperTriggerProps, RADIO_SYMBOL_KEY, Radio, RadioOptionProps, RadioProps, RemoveModalProps, ScrollArea, ScrollAreaOptionProps, ScrollAreaProps, ScrollbarRefType, SelectInputButton, SelectInputButtonOptionProps, SelectInputButtonProps, ShoplflowProvider, ShoplflowProviderProps, SpacingTokens, SplitButton, SplitButtonContext, SplitButtonContextType, SplitButtonOptionProps, SplitButtonProps, SplitButtonSizeVariantType, SplitButtonSizeVariants, SplitButtonStyleVariantType, SplitButtonStyleVariants, Stack, StackComponentType, StackContainer, StackContainerComponentType, StackContainerGenericProps, StackContainerOptionProps, StackContainerProps, StackGenericProps, StackOptionProps, StackProps, StyledIcon, StyledStack, StyledStackContainer, Switch, SwitchOptionProps, SwitchProps, TREE_SYMBOL_KEY, TabOptionProps, TabProps, TabSizeVariantType, TabSizeVariants, TabStyleVariantType, TabStyleVariants, TabStyledProps, TabTextStyledProps, Tabs, TabsContext, TabsContextType, TabsOptionProps, TabsProps, Tag, TagOptionProps, TagProps, TagSizeVariantType, TagSizeVariants, TagStyleVariantType, TagStyleVariants, Text, Text2Rows, TextArea, TextAreaOptionProps, TextAreaProps, TextOptionProps, TextProps, ToggleButton, ToggleButtonInnerRadioOptionProps, ToggleButtonInnerRadioProps, ToggleButtonOptionProps, ToggleButtonProps, ToggleButtonSizeVariantType, ToggleButtonSizeVariants, Tooltip, TooltipContentProps, TooltipOptionProps, TooltipProps, Tree, TreeItem, TreeItemOptionProps, TreeItemProps, TreeOptionProps, TreeProps, TypographyTokens, WeekClickDateInfo, WeekDatepicker, WeekDatepickerProps, WeekDatepickerStyleType, YearSelectProps, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
package/dist/index.d.ts
CHANGED
|
@@ -504,6 +504,10 @@ declare const MODAL_FOOTER_KEY: unique symbol;
|
|
|
504
504
|
interface ModalFooterType extends React.FC<ModalBodyProps> {
|
|
505
505
|
[MODAL_FOOTER_KEY]?: boolean;
|
|
506
506
|
}
|
|
507
|
+
interface ModalTopProps extends ChildrenProps {
|
|
508
|
+
}
|
|
509
|
+
interface ModalBottomProps extends ChildrenProps {
|
|
510
|
+
}
|
|
507
511
|
|
|
508
512
|
declare type ModalStateType = {
|
|
509
513
|
component: ReactNode;
|
|
@@ -537,7 +541,9 @@ declare const useHandleModal: () => {
|
|
|
537
541
|
declare const Modal: {
|
|
538
542
|
Container: ({ children, height, outsideClick, ...rest }: ModalContainerProps) => react_jsx_runtime.JSX.Element;
|
|
539
543
|
Header: ModalHeaderType;
|
|
544
|
+
Top: ({ children }: ModalTopProps) => react_jsx_runtime.JSX.Element;
|
|
540
545
|
Body: ({ children, isIncludeHeader, isIncludeFooter, sizeVar, height: modalContainerHeight, }: ModalBodyProps) => react_jsx_runtime.JSX.Element;
|
|
546
|
+
Bottom: ({ children }: ModalBottomProps) => react_jsx_runtime.JSX.Element;
|
|
541
547
|
Footer: ModalFooterType;
|
|
542
548
|
};
|
|
543
549
|
|
|
@@ -1524,4 +1530,4 @@ declare type NumberComboboxProps = NumberComboboxOptionProps & Omit<InputHTMLAtt
|
|
|
1524
1530
|
|
|
1525
1531
|
declare const NumberCombobox: ({ disabled, onSelect, onChange, value, width, onBlur, items, isError, sizeVar, placeholder, maxLength, className, floatingZIndex, ...rest }: NumberComboboxProps) => react_jsx_runtime.JSX.Element;
|
|
1526
1532
|
|
|
1527
|
-
export { AnnualDatepicker, AnnualDatepickerProps, AsProp, Avatar, AvatarOptionProps, AvatarProps, AvatarSizeVariantType, AvatarSizeVariants, BackDropOptionProps, BackDropProps, BorderRadiusTokens, BoxShadowTokens, Button, ButtonComponent, ButtonOptionProps, ButtonProps, ButtonSizeVariantType, ButtonSizeVariants, ButtonStyleVariantType, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout, CalloutOptionProps, CalloutProps, CalloutType, CalloutTypes, Checkbox, CheckboxOptionProps, CheckboxProps, CheckboxStyleVariantType, CheckboxStyleVariants, ChipButton, ChipButtonOptionProps, ChipButtonProps, ChipButtonSizeVariantType, ChipButtonSizeVariants, ChipButtonStyleVariantType, ChipButtonStyleVariants, ChipToggle, ChipToggleOptionProps, ChipToggleProps, ChipToggleSizeVariantType, ChipToggleSizeVariants, ChipToggleStyleVariantType, ChipToggleStyleVariants, ColorTokens, DangerouslySetInnerHTML, DayCalendarType, DayDatepicker, DayDatepickerHeaderCustomProps, DayDatepickerOptionProps, DayDatepickerProps, DayDatepickerSizeVariantType, DayDatepickerSizeVariants, DomainType, Dropdown, DropdownButton, DropdownButtonContext, DropdownButtonContextType, DropdownButtonOptionProps, DropdownButtonProps, DropdownButtonSizeVariantType, DropdownButtonSizeVariants, DropdownButtonStyleVariantType, DropdownButtonStyleVariants, DropdownContentProps, DropdownOptionProps, DropdownOptionVariantType, DropdownProps, DropdownSizeVariantType, DropdownTriggerButtonProps, FontWeightTokens, Icon, IconButton, IconButtonComponent, IconButtonOptionProps, IconButtonProps, IconButtonSizeVariantType, IconButtonSizeVariants, IconButtonStyleVariantType, IconButtonStyleVariants, IconOptionProps, IconProps, IconSizeVariants, IconSizeVariantsType, Input, InputButton, InputButtonOptionProps, InputButtonProps, InputOptionProps, InputProps, InputSizeVariantType, InputSizeVariants, List, ListContent2ColumnsProps, ListOptionProps, ListProps, ListText2RowsProps, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu, MenuOptionProps, MenuProps, MenuSizeVariantType, MenuSizeVariants, MinusBoxOptionProps, MinusBoxProps, MinusButton, Modal, ModalBodyOptionProps, ModalBodyProps, ModalContainerOptionProps, ModalContainerProps, ModalContext, ModalFooterOptionProps, ModalFooterProps, ModalFooterType, ModalHandlerContext, ModalHeaderOptionProps, ModalHeaderProps, ModalHeaderType, ModalPortal as ModalProvider, ModalSize, ModalSizeType, ModalStateType, MonthClickDateInfo, MonthDatepicker, MonthDatepickerProps, MonthDatepickerStyleType, MotionStack, MotionStackComponentType, MotionStackContainer, MotionStackContainerComponentType, NumberCombobox, NumberComboboxErrorType, NumberComboboxInputType, NumberComboboxOptionProps, NumberComboboxProps, NumberComboboxSizeVariantType, NumberComboboxSizeVariants, Pagination, PaginationOptionProps, PaginationProps, PaginationSizeSelectorProps, PolymorphicComponentProps, PolymorphicRef, Popper, PopperOptionProps, PopperPortal, PopperPortalProps, PopperProps, PopperTrigger, PopperTriggerProps, RADIO_SYMBOL_KEY, Radio, RadioOptionProps, RadioProps, RemoveModalProps, ScrollArea, ScrollAreaOptionProps, ScrollAreaProps, ScrollbarRefType, SelectInputButton, SelectInputButtonOptionProps, SelectInputButtonProps, ShoplflowProvider, ShoplflowProviderProps, SpacingTokens, SplitButton, SplitButtonContext, SplitButtonContextType, SplitButtonOptionProps, SplitButtonProps, SplitButtonSizeVariantType, SplitButtonSizeVariants, SplitButtonStyleVariantType, SplitButtonStyleVariants, Stack, StackComponentType, StackContainer, StackContainerComponentType, StackContainerGenericProps, StackContainerOptionProps, StackContainerProps, StackGenericProps, StackOptionProps, StackProps, StyledIcon, StyledStack, StyledStackContainer, Switch, SwitchOptionProps, SwitchProps, TREE_SYMBOL_KEY, TabOptionProps, TabProps, TabSizeVariantType, TabSizeVariants, TabStyleVariantType, TabStyleVariants, TabStyledProps, TabTextStyledProps, Tabs, TabsContext, TabsContextType, TabsOptionProps, TabsProps, Tag, TagOptionProps, TagProps, TagSizeVariantType, TagSizeVariants, TagStyleVariantType, TagStyleVariants, Text, Text2Rows, TextArea, TextAreaOptionProps, TextAreaProps, TextOptionProps, TextProps, ToggleButton, ToggleButtonInnerRadioOptionProps, ToggleButtonInnerRadioProps, ToggleButtonOptionProps, ToggleButtonProps, ToggleButtonSizeVariantType, ToggleButtonSizeVariants, Tooltip, TooltipContentProps, TooltipOptionProps, TooltipProps, Tree, TreeItem, TreeItemOptionProps, TreeItemProps, TreeOptionProps, TreeProps, TypographyTokens, WeekClickDateInfo, WeekDatepicker, WeekDatepickerProps, WeekDatepickerStyleType, YearSelectProps, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
|
1533
|
+
export { AnnualDatepicker, AnnualDatepickerProps, AsProp, Avatar, AvatarOptionProps, AvatarProps, AvatarSizeVariantType, AvatarSizeVariants, BackDropOptionProps, BackDropProps, BorderRadiusTokens, BoxShadowTokens, Button, ButtonComponent, ButtonOptionProps, ButtonProps, ButtonSizeVariantType, ButtonSizeVariants, ButtonStyleVariantType, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout, CalloutOptionProps, CalloutProps, CalloutType, CalloutTypes, Checkbox, CheckboxOptionProps, CheckboxProps, CheckboxStyleVariantType, CheckboxStyleVariants, ChipButton, ChipButtonOptionProps, ChipButtonProps, ChipButtonSizeVariantType, ChipButtonSizeVariants, ChipButtonStyleVariantType, ChipButtonStyleVariants, ChipToggle, ChipToggleOptionProps, ChipToggleProps, ChipToggleSizeVariantType, ChipToggleSizeVariants, ChipToggleStyleVariantType, ChipToggleStyleVariants, ColorTokens, DangerouslySetInnerHTML, DayCalendarType, DayDatepicker, DayDatepickerHeaderCustomProps, DayDatepickerOptionProps, DayDatepickerProps, DayDatepickerSizeVariantType, DayDatepickerSizeVariants, DomainType, Dropdown, DropdownButton, DropdownButtonContext, DropdownButtonContextType, DropdownButtonOptionProps, DropdownButtonProps, DropdownButtonSizeVariantType, DropdownButtonSizeVariants, DropdownButtonStyleVariantType, DropdownButtonStyleVariants, DropdownContentProps, DropdownOptionProps, DropdownOptionVariantType, DropdownProps, DropdownSizeVariantType, DropdownTriggerButtonProps, FontWeightTokens, Icon, IconButton, IconButtonComponent, IconButtonOptionProps, IconButtonProps, IconButtonSizeVariantType, IconButtonSizeVariants, IconButtonStyleVariantType, IconButtonStyleVariants, IconOptionProps, IconProps, IconSizeVariants, IconSizeVariantsType, Input, InputButton, InputButtonOptionProps, InputButtonProps, InputOptionProps, InputProps, InputSizeVariantType, InputSizeVariants, List, ListContent2ColumnsProps, ListOptionProps, ListProps, ListText2RowsProps, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu, MenuOptionProps, MenuProps, MenuSizeVariantType, MenuSizeVariants, MinusBoxOptionProps, MinusBoxProps, MinusButton, Modal, ModalBodyOptionProps, ModalBodyProps, ModalBottomProps, ModalContainerOptionProps, ModalContainerProps, ModalContext, ModalFooterOptionProps, ModalFooterProps, ModalFooterType, ModalHandlerContext, ModalHeaderOptionProps, ModalHeaderProps, ModalHeaderType, ModalPortal as ModalProvider, ModalSize, ModalSizeType, ModalStateType, ModalTopProps, MonthClickDateInfo, MonthDatepicker, MonthDatepickerProps, MonthDatepickerStyleType, MotionStack, MotionStackComponentType, MotionStackContainer, MotionStackContainerComponentType, NumberCombobox, NumberComboboxErrorType, NumberComboboxInputType, NumberComboboxOptionProps, NumberComboboxProps, NumberComboboxSizeVariantType, NumberComboboxSizeVariants, Pagination, PaginationOptionProps, PaginationProps, PaginationSizeSelectorProps, PolymorphicComponentProps, PolymorphicRef, Popper, PopperOptionProps, PopperPortal, PopperPortalProps, PopperProps, PopperTrigger, PopperTriggerProps, RADIO_SYMBOL_KEY, Radio, RadioOptionProps, RadioProps, RemoveModalProps, ScrollArea, ScrollAreaOptionProps, ScrollAreaProps, ScrollbarRefType, SelectInputButton, SelectInputButtonOptionProps, SelectInputButtonProps, ShoplflowProvider, ShoplflowProviderProps, SpacingTokens, SplitButton, SplitButtonContext, SplitButtonContextType, SplitButtonOptionProps, SplitButtonProps, SplitButtonSizeVariantType, SplitButtonSizeVariants, SplitButtonStyleVariantType, SplitButtonStyleVariants, Stack, StackComponentType, StackContainer, StackContainerComponentType, StackContainerGenericProps, StackContainerOptionProps, StackContainerProps, StackGenericProps, StackOptionProps, StackProps, StyledIcon, StyledStack, StyledStackContainer, Switch, SwitchOptionProps, SwitchProps, TREE_SYMBOL_KEY, TabOptionProps, TabProps, TabSizeVariantType, TabSizeVariants, TabStyleVariantType, TabStyleVariants, TabStyledProps, TabTextStyledProps, Tabs, TabsContext, TabsContextType, TabsOptionProps, TabsProps, Tag, TagOptionProps, TagProps, TagSizeVariantType, TagSizeVariants, TagStyleVariantType, TagStyleVariants, Text, Text2Rows, TextArea, TextAreaOptionProps, TextAreaProps, TextOptionProps, TextProps, ToggleButton, ToggleButtonInnerRadioOptionProps, ToggleButtonInnerRadioProps, ToggleButtonOptionProps, ToggleButtonProps, ToggleButtonSizeVariantType, ToggleButtonSizeVariants, Tooltip, TooltipContentProps, TooltipOptionProps, TooltipProps, Tree, TreeItem, TreeItemOptionProps, TreeItemProps, TreeOptionProps, TreeProps, TypographyTokens, WeekClickDateInfo, WeekDatepicker, WeekDatepickerProps, WeekDatepickerStyleType, YearSelectProps, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React3 from 'react';
|
|
2
|
-
import React3__default, { forwardRef, useRef, useState, useCallback, useEffect,
|
|
2
|
+
import React3__default, { forwardRef, createContext, useRef, useState, useCallback, useEffect, useId, useContext, useMemo, createElement } from 'react';
|
|
3
3
|
import styled6 from '@emotion/styled';
|
|
4
4
|
import { motion, AnimatePresence, LayoutGroup, LazyMotion, domAnimation } from 'framer-motion';
|
|
5
5
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { css } from '@emotion/react';
|
|
8
|
-
import {
|
|
8
|
+
import { noop, useMergeRefs, useOutsideClick, OutSideClick, useSelect, useParentElementClick, isNullOrUndefined } from '@shoplflow/utils';
|
|
9
9
|
import Scrollbars from 'react-custom-scrollbars-2';
|
|
10
10
|
import { FloatingPortal, autoUpdate, offset, autoPlacement } from '@floating-ui/react';
|
|
11
11
|
export { arrow, flip, hide, inline, offset, shift, size } from '@floating-ui/react';
|
|
@@ -829,6 +829,9 @@ var FooterContainer = styled6.div`
|
|
|
829
829
|
border-top: 1px solid ${colorTokens.neutral300};
|
|
830
830
|
background: ${colorTokens.neutral0};
|
|
831
831
|
`;
|
|
832
|
+
var BottomContainer = styled6.footer`
|
|
833
|
+
width: 100%;
|
|
834
|
+
`;
|
|
832
835
|
|
|
833
836
|
// src/components/Modal/Modal.types.ts
|
|
834
837
|
var ModalSize = {
|
|
@@ -855,6 +858,27 @@ var useViewportSizeObserver = () => {
|
|
|
855
858
|
}, []);
|
|
856
859
|
return size2;
|
|
857
860
|
};
|
|
861
|
+
var ModalOptionContext = createContext({
|
|
862
|
+
heightToDeduct: 0,
|
|
863
|
+
setHeightToDeduct: noop,
|
|
864
|
+
clearHeightToDeduct: noop
|
|
865
|
+
});
|
|
866
|
+
var ModalOptionContextProvider = ({ children }) => {
|
|
867
|
+
const [heightToDeduct, setHeightToDeduct] = useState(0);
|
|
868
|
+
const controlHeightToDeduct = useCallback((heightToAdd) => {
|
|
869
|
+
setHeightToDeduct((prev) => prev + heightToAdd);
|
|
870
|
+
}, []);
|
|
871
|
+
const clearHeightToDeduct = useCallback(() => {
|
|
872
|
+
setHeightToDeduct(0);
|
|
873
|
+
}, []);
|
|
874
|
+
return /* @__PURE__ */ jsx(
|
|
875
|
+
ModalOptionContext.Provider,
|
|
876
|
+
{
|
|
877
|
+
value: { heightToDeduct, setHeightToDeduct: controlHeightToDeduct, clearHeightToDeduct },
|
|
878
|
+
children
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
};
|
|
858
882
|
var ModalContainer = (_a) => {
|
|
859
883
|
var _b = _a, { children, height, outsideClick = noop } = _b, rest = __objRest(_b, ["children", "height", "outsideClick"]);
|
|
860
884
|
const ref = useParentElementClick(outsideClick);
|
|
@@ -889,7 +913,7 @@ var ModalContainer = (_a) => {
|
|
|
889
913
|
height: heightWidthMargin
|
|
890
914
|
});
|
|
891
915
|
});
|
|
892
|
-
return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({ ref }, rest), { height: heightWidthMargin, viewport: windowHeight, "data-shoplflow": "Modal", children: addPropInChildren }));
|
|
916
|
+
return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({ ref }, rest), { height: heightWidthMargin, viewport: windowHeight, "data-shoplflow": "Modal", children: /* @__PURE__ */ jsx(ModalOptionContextProvider, { children: addPropInChildren }) }));
|
|
893
917
|
};
|
|
894
918
|
var ModalContainer_default = ModalContainer;
|
|
895
919
|
var ModalFooter = ({ children }) => {
|
|
@@ -927,6 +951,13 @@ var ScrollArea = forwardRef((_a, ref) => {
|
|
|
927
951
|
) });
|
|
928
952
|
});
|
|
929
953
|
var ScrollArea_default = ScrollArea;
|
|
954
|
+
var useModalOption = () => {
|
|
955
|
+
const context = useContext(ModalOptionContext);
|
|
956
|
+
if (!context) {
|
|
957
|
+
throw new Error(`useModalOption cannot be called outside the ModalOptionProvider`);
|
|
958
|
+
}
|
|
959
|
+
return context;
|
|
960
|
+
};
|
|
930
961
|
var ModalBody = ({
|
|
931
962
|
children,
|
|
932
963
|
isIncludeHeader = false,
|
|
@@ -935,6 +966,7 @@ var ModalBody = ({
|
|
|
935
966
|
height: modalContainerHeight
|
|
936
967
|
}) => {
|
|
937
968
|
const { height: windowHeight } = useViewportSizeObserver();
|
|
969
|
+
const { heightToDeduct } = useModalOption();
|
|
938
970
|
const headerHeight = 64;
|
|
939
971
|
const footerHeight = 72;
|
|
940
972
|
const topBottomMargin = 64;
|
|
@@ -956,11 +988,11 @@ var ModalBody = ({
|
|
|
956
988
|
if (modalContainerHeight) {
|
|
957
989
|
if (modalContainerHeight <= 1200) {
|
|
958
990
|
if (windowHeight < modalContainerHeight) {
|
|
959
|
-
return windowHeight - topBottomMargin - headerFooterHeight;
|
|
991
|
+
return windowHeight - topBottomMargin - headerFooterHeight - heightToDeduct;
|
|
960
992
|
}
|
|
961
|
-
return modalContainerHeight - topBottomMargin - headerFooterHeight;
|
|
993
|
+
return modalContainerHeight - topBottomMargin - headerFooterHeight - heightToDeduct;
|
|
962
994
|
}
|
|
963
|
-
return modalContainerHeight - topBottomMargin - headerFooterHeight;
|
|
995
|
+
return modalContainerHeight - topBottomMargin - headerFooterHeight - heightToDeduct;
|
|
964
996
|
} else {
|
|
965
997
|
return "100%";
|
|
966
998
|
}
|
|
@@ -987,32 +1019,23 @@ var ModalBody = ({
|
|
|
987
1019
|
}
|
|
988
1020
|
return 0;
|
|
989
1021
|
};
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
autoHeightMax = autoHeightMax - 24;
|
|
993
|
-
if (isIncludeHeader) {
|
|
994
|
-
autoHeightMax = autoHeightMax - 24;
|
|
995
|
-
}
|
|
996
|
-
if (!isIncludeHeader) {
|
|
997
|
-
autoHeightMax = autoHeightMax - 16;
|
|
998
|
-
}
|
|
999
|
-
return autoHeightMax;
|
|
1000
|
-
};
|
|
1022
|
+
const autoHeightMin = setAutoHeightMin();
|
|
1023
|
+
const _autoHeightMin = typeof autoHeightMin === "string" ? autoHeightMin : autoHeightMin - heightToDeduct;
|
|
1001
1024
|
return /* @__PURE__ */ jsx(
|
|
1002
1025
|
BodyContainer,
|
|
1003
1026
|
{
|
|
1004
1027
|
isIncludeHeader,
|
|
1005
1028
|
sizeVar,
|
|
1006
|
-
minHeight:
|
|
1007
|
-
maxHeight: setAutoHeightMax(),
|
|
1029
|
+
minHeight: _autoHeightMin,
|
|
1030
|
+
maxHeight: setAutoHeightMax() - heightToDeduct,
|
|
1008
1031
|
children: /* @__PURE__ */ jsx(
|
|
1009
1032
|
ScrollArea_default,
|
|
1010
1033
|
{
|
|
1011
1034
|
id: `scrollbar`,
|
|
1012
1035
|
universal: true,
|
|
1013
1036
|
autoHeight: !modalContainerHeight,
|
|
1014
|
-
autoHeightMin:
|
|
1015
|
-
autoHeightMax:
|
|
1037
|
+
autoHeightMin: _autoHeightMin,
|
|
1038
|
+
autoHeightMax: "100%",
|
|
1016
1039
|
style: {},
|
|
1017
1040
|
children: /* @__PURE__ */ jsx(ModalBodyContainerInner, { children: /* @__PURE__ */ jsx(ModalBodyContent, { isIncludeHeader, sizeVar, children }) })
|
|
1018
1041
|
}
|
|
@@ -1026,6 +1049,33 @@ var ModalHeader = ({ children }) => {
|
|
|
1026
1049
|
};
|
|
1027
1050
|
ModalHeader[MODAL_HEADER_KEY] = true;
|
|
1028
1051
|
var ModalHeader_default = ModalHeader;
|
|
1052
|
+
var ModalTop = ({ children }) => {
|
|
1053
|
+
const [topRef, setTopRef] = useState(null);
|
|
1054
|
+
const { setHeightToDeduct, clearHeightToDeduct } = useModalOption();
|
|
1055
|
+
useEffect(() => {
|
|
1056
|
+
if (!topRef) {
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
const { height } = topRef.getBoundingClientRect();
|
|
1060
|
+
setHeightToDeduct == null ? void 0 : setHeightToDeduct(height);
|
|
1061
|
+
return () => clearHeightToDeduct();
|
|
1062
|
+
}, [topRef, setHeightToDeduct, clearHeightToDeduct]);
|
|
1063
|
+
return /* @__PURE__ */ jsx("div", { ref: setTopRef, children });
|
|
1064
|
+
};
|
|
1065
|
+
var ModalTop_default = ModalTop;
|
|
1066
|
+
var ModalBottom = ({ children }) => {
|
|
1067
|
+
const [bottomRef, setBottomRef] = useState(null);
|
|
1068
|
+
const { setHeightToDeduct, clearHeightToDeduct } = useModalOption();
|
|
1069
|
+
useEffect(() => {
|
|
1070
|
+
if (!bottomRef) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
const { height } = bottomRef.getBoundingClientRect();
|
|
1074
|
+
setHeightToDeduct == null ? void 0 : setHeightToDeduct(height);
|
|
1075
|
+
return () => clearHeightToDeduct();
|
|
1076
|
+
}, [bottomRef, setHeightToDeduct, clearHeightToDeduct]);
|
|
1077
|
+
return /* @__PURE__ */ jsx(BottomContainer, { ref: setBottomRef, children });
|
|
1078
|
+
};
|
|
1029
1079
|
var ModalHandlerContext = createContext({
|
|
1030
1080
|
addModal: noop,
|
|
1031
1081
|
removeModal: noop
|
|
@@ -1120,7 +1170,9 @@ var ModalProvider_default = ModalProvider;
|
|
|
1120
1170
|
var Modal = {
|
|
1121
1171
|
Container: ModalContainer_default,
|
|
1122
1172
|
Header: ModalHeader_default,
|
|
1173
|
+
Top: ModalTop_default,
|
|
1123
1174
|
Body: ModalBody_default,
|
|
1175
|
+
Bottom: ModalBottom,
|
|
1124
1176
|
Footer: ModalFooter_default
|
|
1125
1177
|
};
|
|
1126
1178
|
var SwitchContainer = styled6.div`
|