@envive-ai/react-toolkit 0.1.9 → 0.1.11
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/Accordion/index.cjs +3 -82
- package/dist/Accordion/index.d.cts +2 -2
- package/dist/Accordion/index.d.ts +2 -2
- package/dist/Accordion/index.js +2 -75
- package/dist/Accordion-Cp3Hx2zm.js +77 -0
- package/dist/Accordion-DBZpiQe7.cjs +88 -0
- package/dist/AppliedFiltersScrollbar/index.d.ts +2 -2
- package/dist/ButtonBase/index.cjs +2 -2
- package/dist/ButtonBase/index.d.cts +2 -2
- package/dist/ButtonBase/index.d.ts +2 -2
- package/dist/ButtonBase/index.js +2 -2
- package/dist/DynamicFiltersScrollbar/index.d.cts +2 -2
- package/dist/DynamicFiltersScrollbar/index.d.ts +2 -2
- package/dist/FilterScrollbar/index.cjs +1 -1
- package/dist/FilterScrollbar/index.d.cts +3 -3
- package/dist/FilterScrollbar/index.d.ts +3 -3
- package/dist/FilterScrollbar/index.js +1 -1
- package/dist/Headline/index.cjs +1 -1
- package/dist/Headline/index.d.cts +2 -2
- package/dist/Headline/index.d.ts +2 -2
- package/dist/Headline/index.js +1 -1
- package/dist/ImageWithFallback/index.cjs +1 -1
- package/dist/ImageWithFallback/index.d.cts +2 -2
- package/dist/ImageWithFallback/index.d.ts +2 -2
- package/dist/ImageWithFallback/index.js +1 -1
- package/dist/ModalSheet/index.cjs +3 -0
- package/dist/ModalSheet/index.d.cts +38 -0
- package/dist/ModalSheet/index.d.ts +38 -0
- package/dist/ModalSheet/index.js +3 -0
- package/dist/ModalSheet-CXZgyZ4a.cjs +335 -0
- package/dist/ModalSheet-CZd5pssv.js +324 -0
- package/dist/ProductCard/index.cjs +4 -4
- package/dist/ProductCard/index.d.cts +1 -1
- package/dist/ProductCard/index.d.ts +1 -1
- package/dist/ProductCard/index.js +4 -4
- package/dist/{ProductCard-D44lhkxO.js → ProductCard-D-lyh8uV.js} +4 -4
- package/dist/{ProductCard-BcQBegyj.cjs → ProductCard-F49krjHk.cjs} +5 -5
- package/dist/ProductGrid/index.cjs +5 -5
- package/dist/ProductGrid/index.d.cts +3 -3
- package/dist/ProductGrid/index.d.ts +3 -3
- package/dist/ProductGrid/index.js +5 -5
- package/dist/{ProductGrid-ZXF7LBVG.js → ProductGrid-FIf5wFQx.js} +1 -1
- package/dist/{ProductGrid-50PmrwA4.cjs → ProductGrid-QeoaIfcq.cjs} +1 -1
- package/dist/RadioButton/index.cjs +6 -0
- package/dist/RadioButton/index.d.cts +30 -0
- package/dist/RadioButton/index.d.ts +30 -0
- package/dist/RadioButton/index.js +6 -0
- package/dist/RadioButton-Bf68dZl7.js +68 -0
- package/dist/RadioButton-DZ6QXkrN.cjs +77 -0
- package/dist/RadioButtonGroup/index.cjs +8 -0
- package/dist/RadioButtonGroup/index.d.cts +36 -0
- package/dist/RadioButtonGroup/index.d.ts +36 -0
- package/dist/RadioButtonGroup/index.js +7 -0
- package/dist/RadioButtonGroup-8k7hkJYB.js +37 -0
- package/dist/RadioButtonGroup-Dc_n5amh.cjs +51 -0
- package/dist/SearchAutocomplete/index.cjs +1 -1
- package/dist/SearchAutocomplete/index.js +1 -1
- package/dist/SearchFilter/index.cjs +9 -2
- package/dist/SearchFilter/index.d.cts +15 -9
- package/dist/SearchFilter/index.d.ts +15 -9
- package/dist/SearchFilter/index.js +9 -2
- package/dist/SearchFilter-BOwErEyI.js +258 -0
- package/dist/SearchFilter-BtLKnFMm.cjs +279 -0
- package/dist/SearchInput/index.cjs +3 -3
- package/dist/SearchInput/index.d.cts +1 -1
- package/dist/SearchInput/index.d.ts +2 -2
- package/dist/SearchInput/index.js +3 -3
- package/dist/{SearchInput-DxDC1mcq.js → SearchInput-BBaYEwkR.js} +2 -2
- package/dist/{SearchInput-BFlu_3iT.cjs → SearchInput-BTNvgrIa.cjs} +2 -2
- package/dist/SearchInputForm/index.cjs +4 -4
- package/dist/SearchInputForm/index.d.cts +1 -1
- package/dist/SearchInputForm/index.d.ts +1 -1
- package/dist/SearchInputForm/index.js +4 -4
- package/dist/SearchResultsContent/index.cjs +16 -30
- package/dist/SearchResultsContent/index.d.cts +6 -21
- package/dist/SearchResultsContent/index.d.ts +6 -21
- package/dist/SearchResultsContent/index.js +12 -25
- package/dist/SearchResultsFilterSidebar/index.cjs +15 -8
- package/dist/SearchResultsFilterSidebar/index.d.cts +1 -1
- package/dist/SearchResultsFilterSidebar/index.d.ts +1 -1
- package/dist/SearchResultsFilterSidebar/index.js +13 -6
- package/dist/SearchResultsStates/index.cjs +10 -10
- package/dist/SearchResultsStates/index.d.cts +6 -6
- package/dist/SearchResultsStates/index.d.ts +6 -6
- package/dist/SearchResultsStates/index.js +10 -10
- package/dist/{SearchResultsStates-T--7xKI7.js → SearchResultsStates-CB5k1xkK.js} +5 -5
- package/dist/{SearchResultsStates-B7a6B6-P.cjs → SearchResultsStates-DywK7vvp.cjs} +5 -5
- package/dist/SparkleAnimation/index.cjs +1 -1
- package/dist/SparkleAnimation/index.d.cts +2 -2
- package/dist/SparkleAnimation/index.d.ts +2 -2
- package/dist/SparkleAnimation/index.js +1 -1
- package/dist/Spinner/index.cjs +1 -1
- package/dist/Spinner/index.d.cts +2 -2
- package/dist/Spinner/index.d.ts +2 -2
- package/dist/Spinner/index.js +1 -1
- package/dist/Styles/index.cjs +274 -0
- package/dist/Styles/index.d.cts +258 -0
- package/dist/Styles/index.d.ts +258 -0
- package/dist/Styles/index.js +274 -0
- package/dist/SuggestionButton/index.cjs +1 -1
- package/dist/SuggestionButton/index.d.cts +2 -2
- package/dist/SuggestionButton/index.d.ts +2 -2
- package/dist/SuggestionButton/index.js +1 -1
- package/dist/Text/index.d.cts +2 -2
- package/dist/Text/index.d.ts +3 -3
- package/dist/TextInput/index.cjs +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/ToggleButton/index.cjs +6 -0
- package/dist/ToggleButton/index.d.cts +30 -0
- package/dist/ToggleButton/index.d.ts +30 -0
- package/dist/ToggleButton/index.js +6 -0
- package/dist/ToggleButton-BKRR_-69.js +60 -0
- package/dist/ToggleButton-D90UO4qv.cjs +68 -0
- package/dist/{index-vrOLXtJO.d.ts → index-1x_hMlEf.d.cts} +5 -5
- package/dist/{index-ozZ5JSZp.d.cts → index-CgjZdKpL.d.cts} +5 -5
- package/dist/{index-CC5ru80z.d.ts → index-Cl4d_pDw.d.ts} +5 -5
- package/dist/{index-Bl5T42aR.d.ts → index-H_9LhS_1.d.cts} +2 -2
- package/dist/{index-C5sr5-A0.d.cts → index-QMTPxKA9.d.ts} +5 -5
- package/dist/{index-BkxuyRJ6.d.cts → index-gfYBM7Ul.d.ts} +2 -2
- package/dist/{searchFilterSidebarVariants-B8nMp970.js → searchFilterSidebarVariants-CDFCHVeZ.js} +1 -1
- package/dist/{searchFilterSidebarVariants-BMZs5kyL.cjs → searchFilterSidebarVariants-CtmuwSBQ.cjs} +1 -1
- package/package.json +30 -4
- package/src/components/AnimatedChevron/AnimatedChevron.tsx +37 -0
- package/src/components/ModalSheet/ModalSheet.tsx +42 -0
- package/src/components/ModalSheet/common/closeIcon.tsx +40 -0
- package/src/components/ModalSheet/common/enviveWatermark.tsx +30 -0
- package/src/components/ModalSheet/desktop/desktopHeader.tsx +24 -0
- package/src/components/ModalSheet/desktop/index.tsx +118 -0
- package/src/components/ModalSheet/index.ts +1 -0
- package/src/components/ModalSheet/mobile/index.tsx +117 -0
- package/src/components/ModalSheet/mobile/mobileHeader.tsx +42 -0
- package/src/components/ModalSheet/types.ts +33 -0
- package/src/components/RadioButton/RadioButton.tsx +88 -0
- package/src/components/RadioButton/index.ts +1 -0
- package/src/components/RadioButtonGroup/RadioButtonGroup.tsx +72 -0
- package/src/components/RadioButtonGroup/index.ts +1 -0
- package/src/components/SearchFilter/SearchFilter.tsx +161 -64
- package/src/components/SearchFilter/SearchFilterFooter.tsx +55 -0
- package/src/components/SearchFilter/types.ts +2 -1
- package/src/components/SearchFilter/useHasFilterStateChanged.tsx +40 -0
- package/src/components/SearchFilter/utils.ts +15 -0
- package/src/components/SearchResultsContent/SearchResultsContent.tsx +1 -1
- package/src/components/SearchResultsContent/index.ts +0 -1
- package/src/components/SearchResultsFilterSidebar/SearchResultsFilter.tsx +2 -2
- package/src/components/Styles/EnviveTailwindPreset.ts +285 -0
- package/src/components/Styles/index.ts +2 -0
- package/src/components/ToggleButton/ToggleButton.tsx +98 -0
- package/src/components/ToggleButton/index.ts +1 -0
- package/tailwind-preset.js +3 -0
- package/dist/SearchFilter-B3vl3aWK.js +0 -117
- package/dist/SearchFilter-QV5AH7gk.cjs +0 -137
- package/src/components/SearchResultsContent/utils.ts +0 -28
- /package/dist/{ButtonBase-C_uKnl48.js → ButtonBase-0NN6wmX-.js} +0 -0
- /package/dist/{ButtonBase-DGbSm0SJ.js → ButtonBase-BAf-nlCm.js} +0 -0
- /package/dist/{ButtonBase-DbWQ25n-.cjs → ButtonBase-BIXx56hq.cjs} +0 -0
- /package/dist/{ButtonBase-DGpQBeLR.cjs → ButtonBase-Do88ndKa.cjs} +0 -0
- /package/dist/{DynamicFiltersScrollbar-D4d6pGke.js → DynamicFiltersScrollbar-C4kdNSJ9.js} +0 -0
- /package/dist/{DynamicFiltersScrollbar-DCElnZJa.cjs → DynamicFiltersScrollbar-CVw1PINp.cjs} +0 -0
- /package/dist/{Headline-BkOW1lQj.js → Headline-DNEWF8ly.js} +0 -0
- /package/dist/{Headline-QpruZlcg.cjs → Headline-DTT4RSv2.cjs} +0 -0
- /package/dist/{ImageWithFallback-1LqhQK1q.cjs → ImageWithFallback-Cx-KNi-D.cjs} +0 -0
- /package/dist/{ImageWithFallback-Ckwsmd8P.js → ImageWithFallback-DqxjwO3i.js} +0 -0
- /package/dist/{SearchAutocomplete-C4RY0IoT.js → SearchAutocomplete-C6omCGJp.js} +0 -0
- /package/dist/{SearchAutocomplete-hQDnKtwQ.cjs → SearchAutocomplete-Cofuvwwp.cjs} +0 -0
- /package/dist/{SparkleAnimation-DT3coYkB.js → SparkleAnimation-AM4XoegD.js} +0 -0
- /package/dist/{SparkleAnimation-2m4gwmrY.cjs → SparkleAnimation-Edzqyb48.cjs} +0 -0
- /package/dist/{Spinner-BqTt55uu.js → Spinner-CjGLIRgs.js} +0 -0
- /package/dist/{Spinner-DjK8ts9E.cjs → Spinner-DFor2Szi.cjs} +0 -0
- /package/dist/{TextInput-BFPXhSAY.js → TextInput-BVPdz7e8.js} +0 -0
- /package/dist/{TextInput-DLSgpP6b.cjs → TextInput-CnXhppYn.cjs} +0 -0
- /package/dist/{colorsConfig-BQlaCfxi.js → colorsConfig-5Yf4nrEe.js} +0 -0
- /package/dist/{colorsConfig-DCvy_dV4.cjs → colorsConfig-DFL3mBwB.cjs} +0 -0
- /package/dist/{textVariantClasses-ypYGLq0h.d.ts → textVariantClasses-kyZtL8F5.d.ts} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ModalSheet/types.d.ts
|
|
4
|
+
type ModalSheetProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
closeModal: () => void;
|
|
8
|
+
desktopWidth?: number;
|
|
9
|
+
mobileFullHeight?: number;
|
|
10
|
+
animationDuration?: number;
|
|
11
|
+
headerProps: ModalSheetHeaderProps;
|
|
12
|
+
footerProps?: ModalSheetFooterProps;
|
|
13
|
+
showOverlay?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type ModalSheetHeaderProps = {
|
|
16
|
+
headerVariant?: ModalSheetHeaderVariant;
|
|
17
|
+
headerContent: React.ReactNode;
|
|
18
|
+
handleHeaderClick?: () => void;
|
|
19
|
+
chevronColor: string;
|
|
20
|
+
};
|
|
21
|
+
type ModalSheetFooterProps = {
|
|
22
|
+
footerContent: React.ReactNode;
|
|
23
|
+
footerClassName?: string;
|
|
24
|
+
};
|
|
25
|
+
type ModalSheetHeaderVariant = 'primary';
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/ModalSheet/ModalSheet.d.ts
|
|
28
|
+
declare const ModalSheet: ({
|
|
29
|
+
children,
|
|
30
|
+
isOpen,
|
|
31
|
+
closeModal,
|
|
32
|
+
animationDuration,
|
|
33
|
+
desktopWidth,
|
|
34
|
+
headerProps,
|
|
35
|
+
footerProps
|
|
36
|
+
}: ModalSheetProps) => react_jsx_runtime13.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ModalSheet };
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
let framer_motion = require("framer-motion");
|
|
3
|
+
framer_motion = require_chunk.__toESM(framer_motion);
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_chunk.__toESM(react);
|
|
6
|
+
let classnames = require("classnames");
|
|
7
|
+
classnames = require_chunk.__toESM(classnames);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
10
|
+
let __envive_ai_react_hooks_hooks = require("@envive-ai/react-hooks/hooks");
|
|
11
|
+
__envive_ai_react_hooks_hooks = require_chunk.__toESM(__envive_ai_react_hooks_hooks);
|
|
12
|
+
|
|
13
|
+
//#region src/components/AnimatedChevron/AnimatedChevron.tsx
|
|
14
|
+
const AnimatedChevron = ({ animationKey, chevronColor }) => {
|
|
15
|
+
const leftRotation = (0, framer_motion.useTransform)(animationKey, [300, 0], [-12, 0]);
|
|
16
|
+
const rightRotation = (0, framer_motion.useTransform)(animationKey, [300, 0], [12, 0]);
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18
|
+
style: { display: "flex" },
|
|
19
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, { style: {
|
|
20
|
+
x: 1,
|
|
21
|
+
width: "25px",
|
|
22
|
+
height: "4px",
|
|
23
|
+
background: chevronColor,
|
|
24
|
+
borderRadius: "8px",
|
|
25
|
+
rotate: leftRotation
|
|
26
|
+
} }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, { style: {
|
|
27
|
+
x: -1,
|
|
28
|
+
width: "25px",
|
|
29
|
+
height: "4px",
|
|
30
|
+
background: chevronColor,
|
|
31
|
+
borderRadius: "8px",
|
|
32
|
+
rotate: rightRotation
|
|
33
|
+
} })]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/ModalSheet/mobile/mobileHeader.tsx
|
|
39
|
+
const modalSheetVariants$1 = { primary: {
|
|
40
|
+
"spiffy-tw-bg-[--spiffy-colors-background-primary]": true,
|
|
41
|
+
"spiffy-tw-text-[--spiffy-colors-text-light]": true
|
|
42
|
+
} };
|
|
43
|
+
const ModalSheetMobileHeader = ({ headerVariant = "primary", headerContent, handleHeaderClick, chevronColor }) => {
|
|
44
|
+
const animationKey = (0, framer_motion.useMotionValue)(-1);
|
|
45
|
+
const headerClassName = (0, classnames.default)({
|
|
46
|
+
"spiffy-modal-sheet-header": true,
|
|
47
|
+
"spiffy-tw-flex": true,
|
|
48
|
+
"spiffy-tw-items-center": true,
|
|
49
|
+
"spiffy-tw-justify-between": true,
|
|
50
|
+
"spiffy-tw-w-full": true,
|
|
51
|
+
"spiffy-tw-flex-col": true,
|
|
52
|
+
"spiffy-tw-pt-[16px]": true,
|
|
53
|
+
"spiffy-tw-shadow-[0px_-8px_16px_0px_#0000001A]": true,
|
|
54
|
+
...modalSheetVariants$1[headerVariant]
|
|
55
|
+
});
|
|
56
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
57
|
+
className: headerClassName,
|
|
58
|
+
onTouchStart: handleHeaderClick,
|
|
59
|
+
onMouseDown: handleHeaderClick,
|
|
60
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedChevron, {
|
|
61
|
+
animationKey,
|
|
62
|
+
chevronColor
|
|
63
|
+
}), headerContent]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/components/ModalSheet/mobile/index.tsx
|
|
69
|
+
const ModalSheetMobile = ({ children, isOpen, closeModal, mobileFullHeight = 180, animationDuration, headerProps, footerProps }) => {
|
|
70
|
+
const [isHidden, setIsHidden] = (0, react.useState)(isOpen ? "block" : "none");
|
|
71
|
+
const [bottom, setBottom] = (0, react.useState)(isOpen ? 0 : 0 - mobileFullHeight);
|
|
72
|
+
const [overlayOpacity, setOverlayOpacity] = (0, react.useState)(isOpen ? 1 : 0);
|
|
73
|
+
(0, react.useEffect)(() => {
|
|
74
|
+
setIsHidden(isOpen ? "block" : "none");
|
|
75
|
+
setBottom(isOpen ? 0 : 0 - mobileFullHeight);
|
|
76
|
+
setOverlayOpacity(isOpen ? 1 : 0);
|
|
77
|
+
}, [mobileFullHeight, isOpen]);
|
|
78
|
+
const overlayClassNames = (0, classnames.default)({
|
|
79
|
+
"spiffy-modal-sheet-overlay": true,
|
|
80
|
+
"spiffy-tw-fixed": true,
|
|
81
|
+
"spiffy-tw-inset-0": true,
|
|
82
|
+
"spiffy-tw-top-[0]": true,
|
|
83
|
+
"spiffy-tw-bottom-[0]": true,
|
|
84
|
+
"spiffy-tw-left-[0]": true,
|
|
85
|
+
"spiffy-tw-right-[0]": true,
|
|
86
|
+
"spiffy-tw-bg-black/30": true,
|
|
87
|
+
"spiffy-tw-z-[100]": true
|
|
88
|
+
});
|
|
89
|
+
const modalClassNames = (0, classnames.default)({
|
|
90
|
+
"spiffy-modal-sheet": true,
|
|
91
|
+
"spiffy-modal-sheet-open": isOpen,
|
|
92
|
+
"spiffy-tw-w-full": true,
|
|
93
|
+
"spiffy-tw-overflow-y-auto": true,
|
|
94
|
+
"spiffy-tw-shadow-lg": true,
|
|
95
|
+
"spiffy-tw-fixed": true,
|
|
96
|
+
"spiffy-tw-bg-white": true,
|
|
97
|
+
"spiffy-tw-border-box": true,
|
|
98
|
+
"spiffy-tw-rounded-t-[16px]": true,
|
|
99
|
+
"spiffy-tw-h-[89%]": true,
|
|
100
|
+
"spiffy-tw-max-h-[89%]": true
|
|
101
|
+
});
|
|
102
|
+
const contentClassNames = (0, classnames.default)({
|
|
103
|
+
"spiffy-modal-sheet-content": true,
|
|
104
|
+
"spiffy-tw-flex": true,
|
|
105
|
+
"spiffy-tw-flex-col": true,
|
|
106
|
+
"spiffy-tw-w-full": true,
|
|
107
|
+
"spiffy-tw-h-full": true
|
|
108
|
+
});
|
|
109
|
+
const headerClassNames = (0, classnames.default)({
|
|
110
|
+
"spiffy-tw-sticky": true,
|
|
111
|
+
"spiffy-tw-top-[0px]": true,
|
|
112
|
+
"spiffy-tw-flex": true,
|
|
113
|
+
"spiffy-tw-flex-col": true
|
|
114
|
+
});
|
|
115
|
+
const { footerContent, footerClassName } = footerProps || {};
|
|
116
|
+
const footerClassNames = (0, classnames.default)({
|
|
117
|
+
"spiffy-tw-sticky": true,
|
|
118
|
+
"spiffy-tw-bottom-[0px]": true,
|
|
119
|
+
"spiffy-modal-sheet-footer": true,
|
|
120
|
+
"spiffy-tw-flex": true,
|
|
121
|
+
"spiffy-tw-flex-col": true
|
|
122
|
+
}, footerClassName);
|
|
123
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
124
|
+
className: overlayClassNames,
|
|
125
|
+
animate: {
|
|
126
|
+
opacity: overlayOpacity,
|
|
127
|
+
display: isHidden
|
|
128
|
+
},
|
|
129
|
+
onClick: closeModal,
|
|
130
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
131
|
+
role: "dialog",
|
|
132
|
+
className: modalClassNames,
|
|
133
|
+
initial: {
|
|
134
|
+
bottom,
|
|
135
|
+
display: isHidden
|
|
136
|
+
},
|
|
137
|
+
animate: {
|
|
138
|
+
bottom,
|
|
139
|
+
display: isHidden
|
|
140
|
+
},
|
|
141
|
+
exit: {
|
|
142
|
+
bottom,
|
|
143
|
+
display: isHidden
|
|
144
|
+
},
|
|
145
|
+
transition: {
|
|
146
|
+
duration: animationDuration,
|
|
147
|
+
ease: "easeIn"
|
|
148
|
+
},
|
|
149
|
+
onClick: (e) => e.stopPropagation(),
|
|
150
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
151
|
+
className: contentClassNames,
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
154
|
+
className: headerClassNames,
|
|
155
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetMobileHeader, {
|
|
156
|
+
headerContent: headerProps.headerContent,
|
|
157
|
+
headerVariant: headerProps?.headerVariant,
|
|
158
|
+
handleHeaderClick: closeModal
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
children,
|
|
162
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "spiffy-tw-flex-grow" }),
|
|
163
|
+
footerContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
164
|
+
className: footerClassNames,
|
|
165
|
+
children: footerContent
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
}) });
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/components/ModalSheet/desktop/desktopHeader.tsx
|
|
175
|
+
const modalSheetVariants = { primary: {
|
|
176
|
+
"spiffy-tw-bg-[--spiffy-colors-background-primary]": true,
|
|
177
|
+
"spiffy-tw-text-[--spiffy-colors-text-light]": true
|
|
178
|
+
} };
|
|
179
|
+
const ModalSheetDesktopHeader = ({ headerVariant = "primary", headerContent }) => {
|
|
180
|
+
const headerStyles = (0, classnames.default)({
|
|
181
|
+
"spiffy-modal-sheet-header": true,
|
|
182
|
+
"spiffy-tw-flex": true,
|
|
183
|
+
"spiffy-tw-items-center": true,
|
|
184
|
+
"spiffy-tw-justify-between": true,
|
|
185
|
+
"spiffy-tw-w-full": true,
|
|
186
|
+
...modalSheetVariants[headerVariant]
|
|
187
|
+
});
|
|
188
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
189
|
+
className: headerStyles,
|
|
190
|
+
children: headerContent
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/components/ModalSheet/desktop/index.tsx
|
|
196
|
+
const ModalSheetDesktop = ({ children, isOpen, closeModal, desktopWidth = 512, animationDuration, headerProps, footerProps, showOverlay = false }) => {
|
|
197
|
+
const [isHidden, setIsHidden] = (0, react.useState)(isOpen ? "block" : "none");
|
|
198
|
+
const [right, setRight] = (0, react.useState)(isOpen ? 0 : 0 - desktopWidth);
|
|
199
|
+
const [overlayOpacity, setOverlayOpacity] = (0, react.useState)(0);
|
|
200
|
+
(0, react.useEffect)(() => {
|
|
201
|
+
setIsHidden(isOpen ? "block" : "none");
|
|
202
|
+
setRight(isOpen ? 0 : 0 - desktopWidth);
|
|
203
|
+
setOverlayOpacity(isOpen ? 1 : 0);
|
|
204
|
+
}, [desktopWidth, isOpen]);
|
|
205
|
+
const overlayClassNames = (0, classnames.default)({
|
|
206
|
+
"spiffy-modal-sheet-overlay": true,
|
|
207
|
+
"spiffy-tw-fixed": true,
|
|
208
|
+
"spiffy-tw-inset-0": true,
|
|
209
|
+
"spiffy-tw-top-[0]": true,
|
|
210
|
+
"spiffy-tw-bottom-[0]": true,
|
|
211
|
+
"spiffy-tw-left-[0]": true,
|
|
212
|
+
"spiffy-tw-right-[0]": true,
|
|
213
|
+
"spiffy-tw-z-[2147483647]": true,
|
|
214
|
+
"spiffy-tw-bg-black/30": showOverlay
|
|
215
|
+
});
|
|
216
|
+
const modalClassNames = (0, classnames.default)({
|
|
217
|
+
"spiffy-modal-sheet": true,
|
|
218
|
+
"spiffy-modal-sheet-open": isOpen,
|
|
219
|
+
"spiffy-tw-max-h-full": true,
|
|
220
|
+
"spiffy-tw-h-screen": true,
|
|
221
|
+
"spiffy-tw-w-[512px]": true,
|
|
222
|
+
"spiffy-tw-shadow-lg": true,
|
|
223
|
+
"spiffy-tw-top-[0]": true,
|
|
224
|
+
"spiffy-tw-bottom-[0]": true,
|
|
225
|
+
"spiffy-tw-fixed": true,
|
|
226
|
+
"spiffy-tw-bg-white": true,
|
|
227
|
+
"spiffy-tw-border-box": true
|
|
228
|
+
});
|
|
229
|
+
const contentClassNames = (0, classnames.default)({
|
|
230
|
+
"spiffy-modal-sheet-content": true,
|
|
231
|
+
"spiffy-tw-overflow-y-auto": true,
|
|
232
|
+
"spiffy-tw-overflow-x-hidden": true,
|
|
233
|
+
"spiffy-tw-flex": true,
|
|
234
|
+
"spiffy-tw-flex-col": true,
|
|
235
|
+
"spiffy-tw-h-full": true,
|
|
236
|
+
"spiffy-tw-w-full": true
|
|
237
|
+
});
|
|
238
|
+
const headerClassNames = (0, classnames.default)({
|
|
239
|
+
"spiffy-tw-sticky": true,
|
|
240
|
+
"spiffy-tw-top-0": true,
|
|
241
|
+
"spiffy-tw-flex": true,
|
|
242
|
+
"spiffy-tw-flex-col": true
|
|
243
|
+
});
|
|
244
|
+
const { footerContent, footerClassName } = footerProps || {};
|
|
245
|
+
const footerClassNames = (0, classnames.default)({
|
|
246
|
+
"spiffy-tw-sticky": true,
|
|
247
|
+
"spiffy-tw-bottom-0": true,
|
|
248
|
+
"spiffy-modal-sheet-footer": true,
|
|
249
|
+
"spiffy-tw-flex": true,
|
|
250
|
+
"spiffy-tw-flex-col": true
|
|
251
|
+
}, footerClassName);
|
|
252
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
253
|
+
className: overlayClassNames,
|
|
254
|
+
initial: {
|
|
255
|
+
opacity: 0,
|
|
256
|
+
display: "none"
|
|
257
|
+
},
|
|
258
|
+
animate: {
|
|
259
|
+
opacity: overlayOpacity,
|
|
260
|
+
display: isHidden
|
|
261
|
+
},
|
|
262
|
+
onClick: closeModal,
|
|
263
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
264
|
+
role: "dialog",
|
|
265
|
+
className: modalClassNames,
|
|
266
|
+
initial: {
|
|
267
|
+
right,
|
|
268
|
+
display: isHidden
|
|
269
|
+
},
|
|
270
|
+
animate: {
|
|
271
|
+
right,
|
|
272
|
+
display: isHidden
|
|
273
|
+
},
|
|
274
|
+
exit: {
|
|
275
|
+
right,
|
|
276
|
+
display: isHidden
|
|
277
|
+
},
|
|
278
|
+
transition: {
|
|
279
|
+
duration: animationDuration,
|
|
280
|
+
ease: "easeIn"
|
|
281
|
+
},
|
|
282
|
+
style: { width: desktopWidth },
|
|
283
|
+
onClick: (e) => e.stopPropagation(),
|
|
284
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
285
|
+
className: contentClassNames,
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
288
|
+
className: headerClassNames,
|
|
289
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetDesktopHeader, {
|
|
290
|
+
headerContent: headerProps.headerContent,
|
|
291
|
+
headerVariant: headerProps?.headerVariant
|
|
292
|
+
})
|
|
293
|
+
}),
|
|
294
|
+
children,
|
|
295
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "spiffy-tw-flex-grow" }),
|
|
296
|
+
footerContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
297
|
+
className: footerClassNames,
|
|
298
|
+
children: footerContent
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
}) });
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/components/ModalSheet/ModalSheet.tsx
|
|
308
|
+
const ANIMATION_DURATION = .3;
|
|
309
|
+
const ModalSheet = ({ children, isOpen, closeModal, animationDuration = ANIMATION_DURATION, desktopWidth = 512, headerProps, footerProps }) => {
|
|
310
|
+
return (0, __envive_ai_react_hooks_hooks.useIsSmallScreen)() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetMobile, {
|
|
311
|
+
isOpen,
|
|
312
|
+
closeModal,
|
|
313
|
+
desktopWidth,
|
|
314
|
+
animationDuration,
|
|
315
|
+
headerProps,
|
|
316
|
+
footerProps,
|
|
317
|
+
children
|
|
318
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalSheetDesktop, {
|
|
319
|
+
isOpen,
|
|
320
|
+
closeModal,
|
|
321
|
+
desktopWidth,
|
|
322
|
+
animationDuration,
|
|
323
|
+
headerProps,
|
|
324
|
+
footerProps,
|
|
325
|
+
children
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
Object.defineProperty(exports, 'ModalSheet', {
|
|
331
|
+
enumerable: true,
|
|
332
|
+
get: function () {
|
|
333
|
+
return ModalSheet;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { motion, useMotionValue, useTransform } from "framer-motion";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useIsSmallScreen } from "@envive-ai/react-hooks/hooks";
|
|
6
|
+
|
|
7
|
+
//#region src/components/AnimatedChevron/AnimatedChevron.tsx
|
|
8
|
+
const AnimatedChevron = ({ animationKey, chevronColor }) => {
|
|
9
|
+
const leftRotation = useTransform(animationKey, [300, 0], [-12, 0]);
|
|
10
|
+
const rightRotation = useTransform(animationKey, [300, 0], [12, 0]);
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12
|
+
style: { display: "flex" },
|
|
13
|
+
children: [/* @__PURE__ */ jsx(motion.div, { style: {
|
|
14
|
+
x: 1,
|
|
15
|
+
width: "25px",
|
|
16
|
+
height: "4px",
|
|
17
|
+
background: chevronColor,
|
|
18
|
+
borderRadius: "8px",
|
|
19
|
+
rotate: leftRotation
|
|
20
|
+
} }), /* @__PURE__ */ jsx(motion.div, { style: {
|
|
21
|
+
x: -1,
|
|
22
|
+
width: "25px",
|
|
23
|
+
height: "4px",
|
|
24
|
+
background: chevronColor,
|
|
25
|
+
borderRadius: "8px",
|
|
26
|
+
rotate: rightRotation
|
|
27
|
+
} })]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/ModalSheet/mobile/mobileHeader.tsx
|
|
33
|
+
const modalSheetVariants$1 = { primary: {
|
|
34
|
+
"spiffy-tw-bg-[--spiffy-colors-background-primary]": true,
|
|
35
|
+
"spiffy-tw-text-[--spiffy-colors-text-light]": true
|
|
36
|
+
} };
|
|
37
|
+
const ModalSheetMobileHeader = ({ headerVariant = "primary", headerContent, handleHeaderClick, chevronColor }) => {
|
|
38
|
+
const animationKey = useMotionValue(-1);
|
|
39
|
+
const headerClassName = classNames({
|
|
40
|
+
"spiffy-modal-sheet-header": true,
|
|
41
|
+
"spiffy-tw-flex": true,
|
|
42
|
+
"spiffy-tw-items-center": true,
|
|
43
|
+
"spiffy-tw-justify-between": true,
|
|
44
|
+
"spiffy-tw-w-full": true,
|
|
45
|
+
"spiffy-tw-flex-col": true,
|
|
46
|
+
"spiffy-tw-pt-[16px]": true,
|
|
47
|
+
"spiffy-tw-shadow-[0px_-8px_16px_0px_#0000001A]": true,
|
|
48
|
+
...modalSheetVariants$1[headerVariant]
|
|
49
|
+
});
|
|
50
|
+
return /* @__PURE__ */ jsxs(motion.div, {
|
|
51
|
+
className: headerClassName,
|
|
52
|
+
onTouchStart: handleHeaderClick,
|
|
53
|
+
onMouseDown: handleHeaderClick,
|
|
54
|
+
children: [/* @__PURE__ */ jsx(AnimatedChevron, {
|
|
55
|
+
animationKey,
|
|
56
|
+
chevronColor
|
|
57
|
+
}), headerContent]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/components/ModalSheet/mobile/index.tsx
|
|
63
|
+
const ModalSheetMobile = ({ children, isOpen, closeModal, mobileFullHeight = 180, animationDuration, headerProps, footerProps }) => {
|
|
64
|
+
const [isHidden, setIsHidden] = useState(isOpen ? "block" : "none");
|
|
65
|
+
const [bottom, setBottom] = useState(isOpen ? 0 : 0 - mobileFullHeight);
|
|
66
|
+
const [overlayOpacity, setOverlayOpacity] = useState(isOpen ? 1 : 0);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setIsHidden(isOpen ? "block" : "none");
|
|
69
|
+
setBottom(isOpen ? 0 : 0 - mobileFullHeight);
|
|
70
|
+
setOverlayOpacity(isOpen ? 1 : 0);
|
|
71
|
+
}, [mobileFullHeight, isOpen]);
|
|
72
|
+
const overlayClassNames = classNames({
|
|
73
|
+
"spiffy-modal-sheet-overlay": true,
|
|
74
|
+
"spiffy-tw-fixed": true,
|
|
75
|
+
"spiffy-tw-inset-0": true,
|
|
76
|
+
"spiffy-tw-top-[0]": true,
|
|
77
|
+
"spiffy-tw-bottom-[0]": true,
|
|
78
|
+
"spiffy-tw-left-[0]": true,
|
|
79
|
+
"spiffy-tw-right-[0]": true,
|
|
80
|
+
"spiffy-tw-bg-black/30": true,
|
|
81
|
+
"spiffy-tw-z-[100]": true
|
|
82
|
+
});
|
|
83
|
+
const modalClassNames = classNames({
|
|
84
|
+
"spiffy-modal-sheet": true,
|
|
85
|
+
"spiffy-modal-sheet-open": isOpen,
|
|
86
|
+
"spiffy-tw-w-full": true,
|
|
87
|
+
"spiffy-tw-overflow-y-auto": true,
|
|
88
|
+
"spiffy-tw-shadow-lg": true,
|
|
89
|
+
"spiffy-tw-fixed": true,
|
|
90
|
+
"spiffy-tw-bg-white": true,
|
|
91
|
+
"spiffy-tw-border-box": true,
|
|
92
|
+
"spiffy-tw-rounded-t-[16px]": true,
|
|
93
|
+
"spiffy-tw-h-[89%]": true,
|
|
94
|
+
"spiffy-tw-max-h-[89%]": true
|
|
95
|
+
});
|
|
96
|
+
const contentClassNames = classNames({
|
|
97
|
+
"spiffy-modal-sheet-content": true,
|
|
98
|
+
"spiffy-tw-flex": true,
|
|
99
|
+
"spiffy-tw-flex-col": true,
|
|
100
|
+
"spiffy-tw-w-full": true,
|
|
101
|
+
"spiffy-tw-h-full": true
|
|
102
|
+
});
|
|
103
|
+
const headerClassNames = classNames({
|
|
104
|
+
"spiffy-tw-sticky": true,
|
|
105
|
+
"spiffy-tw-top-[0px]": true,
|
|
106
|
+
"spiffy-tw-flex": true,
|
|
107
|
+
"spiffy-tw-flex-col": true
|
|
108
|
+
});
|
|
109
|
+
const { footerContent, footerClassName } = footerProps || {};
|
|
110
|
+
const footerClassNames = classNames({
|
|
111
|
+
"spiffy-tw-sticky": true,
|
|
112
|
+
"spiffy-tw-bottom-[0px]": true,
|
|
113
|
+
"spiffy-modal-sheet-footer": true,
|
|
114
|
+
"spiffy-tw-flex": true,
|
|
115
|
+
"spiffy-tw-flex-col": true
|
|
116
|
+
}, footerClassName);
|
|
117
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(motion.div, {
|
|
118
|
+
className: overlayClassNames,
|
|
119
|
+
animate: {
|
|
120
|
+
opacity: overlayOpacity,
|
|
121
|
+
display: isHidden
|
|
122
|
+
},
|
|
123
|
+
onClick: closeModal,
|
|
124
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
125
|
+
role: "dialog",
|
|
126
|
+
className: modalClassNames,
|
|
127
|
+
initial: {
|
|
128
|
+
bottom,
|
|
129
|
+
display: isHidden
|
|
130
|
+
},
|
|
131
|
+
animate: {
|
|
132
|
+
bottom,
|
|
133
|
+
display: isHidden
|
|
134
|
+
},
|
|
135
|
+
exit: {
|
|
136
|
+
bottom,
|
|
137
|
+
display: isHidden
|
|
138
|
+
},
|
|
139
|
+
transition: {
|
|
140
|
+
duration: animationDuration,
|
|
141
|
+
ease: "easeIn"
|
|
142
|
+
},
|
|
143
|
+
onClick: (e) => e.stopPropagation(),
|
|
144
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: contentClassNames,
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx("div", {
|
|
148
|
+
className: headerClassNames,
|
|
149
|
+
children: /* @__PURE__ */ jsx(ModalSheetMobileHeader, {
|
|
150
|
+
headerContent: headerProps.headerContent,
|
|
151
|
+
headerVariant: headerProps?.headerVariant,
|
|
152
|
+
handleHeaderClick: closeModal
|
|
153
|
+
})
|
|
154
|
+
}),
|
|
155
|
+
children,
|
|
156
|
+
/* @__PURE__ */ jsx("div", { className: "spiffy-tw-flex-grow" }),
|
|
157
|
+
footerContent && /* @__PURE__ */ jsx("div", {
|
|
158
|
+
className: footerClassNames,
|
|
159
|
+
children: footerContent
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
}) });
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/components/ModalSheet/desktop/desktopHeader.tsx
|
|
169
|
+
const modalSheetVariants = { primary: {
|
|
170
|
+
"spiffy-tw-bg-[--spiffy-colors-background-primary]": true,
|
|
171
|
+
"spiffy-tw-text-[--spiffy-colors-text-light]": true
|
|
172
|
+
} };
|
|
173
|
+
const ModalSheetDesktopHeader = ({ headerVariant = "primary", headerContent }) => {
|
|
174
|
+
const headerStyles = classNames({
|
|
175
|
+
"spiffy-modal-sheet-header": true,
|
|
176
|
+
"spiffy-tw-flex": true,
|
|
177
|
+
"spiffy-tw-items-center": true,
|
|
178
|
+
"spiffy-tw-justify-between": true,
|
|
179
|
+
"spiffy-tw-w-full": true,
|
|
180
|
+
...modalSheetVariants[headerVariant]
|
|
181
|
+
});
|
|
182
|
+
return /* @__PURE__ */ jsx("div", {
|
|
183
|
+
className: headerStyles,
|
|
184
|
+
children: headerContent
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/components/ModalSheet/desktop/index.tsx
|
|
190
|
+
const ModalSheetDesktop = ({ children, isOpen, closeModal, desktopWidth = 512, animationDuration, headerProps, footerProps, showOverlay = false }) => {
|
|
191
|
+
const [isHidden, setIsHidden] = useState(isOpen ? "block" : "none");
|
|
192
|
+
const [right, setRight] = useState(isOpen ? 0 : 0 - desktopWidth);
|
|
193
|
+
const [overlayOpacity, setOverlayOpacity] = useState(0);
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
setIsHidden(isOpen ? "block" : "none");
|
|
196
|
+
setRight(isOpen ? 0 : 0 - desktopWidth);
|
|
197
|
+
setOverlayOpacity(isOpen ? 1 : 0);
|
|
198
|
+
}, [desktopWidth, isOpen]);
|
|
199
|
+
const overlayClassNames = classNames({
|
|
200
|
+
"spiffy-modal-sheet-overlay": true,
|
|
201
|
+
"spiffy-tw-fixed": true,
|
|
202
|
+
"spiffy-tw-inset-0": true,
|
|
203
|
+
"spiffy-tw-top-[0]": true,
|
|
204
|
+
"spiffy-tw-bottom-[0]": true,
|
|
205
|
+
"spiffy-tw-left-[0]": true,
|
|
206
|
+
"spiffy-tw-right-[0]": true,
|
|
207
|
+
"spiffy-tw-z-[2147483647]": true,
|
|
208
|
+
"spiffy-tw-bg-black/30": showOverlay
|
|
209
|
+
});
|
|
210
|
+
const modalClassNames = classNames({
|
|
211
|
+
"spiffy-modal-sheet": true,
|
|
212
|
+
"spiffy-modal-sheet-open": isOpen,
|
|
213
|
+
"spiffy-tw-max-h-full": true,
|
|
214
|
+
"spiffy-tw-h-screen": true,
|
|
215
|
+
"spiffy-tw-w-[512px]": true,
|
|
216
|
+
"spiffy-tw-shadow-lg": true,
|
|
217
|
+
"spiffy-tw-top-[0]": true,
|
|
218
|
+
"spiffy-tw-bottom-[0]": true,
|
|
219
|
+
"spiffy-tw-fixed": true,
|
|
220
|
+
"spiffy-tw-bg-white": true,
|
|
221
|
+
"spiffy-tw-border-box": true
|
|
222
|
+
});
|
|
223
|
+
const contentClassNames = classNames({
|
|
224
|
+
"spiffy-modal-sheet-content": true,
|
|
225
|
+
"spiffy-tw-overflow-y-auto": true,
|
|
226
|
+
"spiffy-tw-overflow-x-hidden": true,
|
|
227
|
+
"spiffy-tw-flex": true,
|
|
228
|
+
"spiffy-tw-flex-col": true,
|
|
229
|
+
"spiffy-tw-h-full": true,
|
|
230
|
+
"spiffy-tw-w-full": true
|
|
231
|
+
});
|
|
232
|
+
const headerClassNames = classNames({
|
|
233
|
+
"spiffy-tw-sticky": true,
|
|
234
|
+
"spiffy-tw-top-0": true,
|
|
235
|
+
"spiffy-tw-flex": true,
|
|
236
|
+
"spiffy-tw-flex-col": true
|
|
237
|
+
});
|
|
238
|
+
const { footerContent, footerClassName } = footerProps || {};
|
|
239
|
+
const footerClassNames = classNames({
|
|
240
|
+
"spiffy-tw-sticky": true,
|
|
241
|
+
"spiffy-tw-bottom-0": true,
|
|
242
|
+
"spiffy-modal-sheet-footer": true,
|
|
243
|
+
"spiffy-tw-flex": true,
|
|
244
|
+
"spiffy-tw-flex-col": true
|
|
245
|
+
}, footerClassName);
|
|
246
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(motion.div, {
|
|
247
|
+
className: overlayClassNames,
|
|
248
|
+
initial: {
|
|
249
|
+
opacity: 0,
|
|
250
|
+
display: "none"
|
|
251
|
+
},
|
|
252
|
+
animate: {
|
|
253
|
+
opacity: overlayOpacity,
|
|
254
|
+
display: isHidden
|
|
255
|
+
},
|
|
256
|
+
onClick: closeModal,
|
|
257
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
258
|
+
role: "dialog",
|
|
259
|
+
className: modalClassNames,
|
|
260
|
+
initial: {
|
|
261
|
+
right,
|
|
262
|
+
display: isHidden
|
|
263
|
+
},
|
|
264
|
+
animate: {
|
|
265
|
+
right,
|
|
266
|
+
display: isHidden
|
|
267
|
+
},
|
|
268
|
+
exit: {
|
|
269
|
+
right,
|
|
270
|
+
display: isHidden
|
|
271
|
+
},
|
|
272
|
+
transition: {
|
|
273
|
+
duration: animationDuration,
|
|
274
|
+
ease: "easeIn"
|
|
275
|
+
},
|
|
276
|
+
style: { width: desktopWidth },
|
|
277
|
+
onClick: (e) => e.stopPropagation(),
|
|
278
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
279
|
+
className: contentClassNames,
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ jsx("div", {
|
|
282
|
+
className: headerClassNames,
|
|
283
|
+
children: /* @__PURE__ */ jsx(ModalSheetDesktopHeader, {
|
|
284
|
+
headerContent: headerProps.headerContent,
|
|
285
|
+
headerVariant: headerProps?.headerVariant
|
|
286
|
+
})
|
|
287
|
+
}),
|
|
288
|
+
children,
|
|
289
|
+
/* @__PURE__ */ jsx("div", { className: "spiffy-tw-flex-grow" }),
|
|
290
|
+
footerContent && /* @__PURE__ */ jsx("div", {
|
|
291
|
+
className: footerClassNames,
|
|
292
|
+
children: footerContent
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
})
|
|
296
|
+
})
|
|
297
|
+
}) });
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/components/ModalSheet/ModalSheet.tsx
|
|
302
|
+
const ANIMATION_DURATION = .3;
|
|
303
|
+
const ModalSheet = ({ children, isOpen, closeModal, animationDuration = ANIMATION_DURATION, desktopWidth = 512, headerProps, footerProps }) => {
|
|
304
|
+
return useIsSmallScreen() ? /* @__PURE__ */ jsx(ModalSheetMobile, {
|
|
305
|
+
isOpen,
|
|
306
|
+
closeModal,
|
|
307
|
+
desktopWidth,
|
|
308
|
+
animationDuration,
|
|
309
|
+
headerProps,
|
|
310
|
+
footerProps,
|
|
311
|
+
children
|
|
312
|
+
}) : /* @__PURE__ */ jsx(ModalSheetDesktop, {
|
|
313
|
+
isOpen,
|
|
314
|
+
closeModal,
|
|
315
|
+
desktopWidth,
|
|
316
|
+
animationDuration,
|
|
317
|
+
headerProps,
|
|
318
|
+
footerProps,
|
|
319
|
+
children
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
//#endregion
|
|
324
|
+
export { ModalSheet };
|