@sproutsocial/seeds-react-modal 1.0.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/.eslintignore ADDED
@@ -0,0 +1,6 @@
1
+ # Node modules
2
+ node_modules/
3
+
4
+ # Build output
5
+ dist/
6
+ coverage/
package/.eslintrc.js ADDED
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ["eslint-config-seeds/racine"],
4
+ };
@@ -0,0 +1,21 @@
1
+ yarn run v1.22.22
2
+ $ tsup --dts
3
+ CLI Building entry: src/index.ts
4
+ CLI Using tsconfig: tsconfig.json
5
+ CLI tsup v8.0.2
6
+ CLI Using tsup config: /home/runner/work/seeds/seeds/seeds-react/seeds-react-modal/tsup.config.ts
7
+ CLI Target: es2022
8
+ CLI Cleaning output folder
9
+ CJS Build start
10
+ ESM Build start
11
+ CJS dist/index.js 9.99 KB
12
+ CJS dist/index.js.map 14.80 KB
13
+ CJS ⚡️ Build success in 102ms
14
+ ESM dist/esm/index.js 7.22 KB
15
+ ESM dist/esm/index.js.map 14.60 KB
16
+ ESM ⚡️ Build success in 112ms
17
+ DTS Build start
18
+ DTS ⚡️ Build success in 10031ms
19
+ DTS dist/index.d.ts 2.63 KB
20
+ DTS dist/index.d.mts 2.63 KB
21
+ Done in 13.51s.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @sproutsocial/seeds-react-modal
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 235f60d: Migrate Modal to its own seeds-react-modal component
@@ -0,0 +1,237 @@
1
+ // src/Modal.tsx
2
+ import * as React2 from "react";
3
+ import { useContext } from "react";
4
+ import Box2 from "@sproutsocial/seeds-react-box";
5
+ import Button from "@sproutsocial/seeds-react-button";
6
+ import Icon from "@sproutsocial/seeds-react-icon";
7
+ import Text from "@sproutsocial/seeds-react-text";
8
+
9
+ // src/styles.tsx
10
+ import "react";
11
+ import styled, { createGlobalStyle } from "styled-components";
12
+ import { width, zIndex } from "styled-system";
13
+ import ReactModal from "react-modal";
14
+ import { COMMON } from "@sproutsocial/seeds-react-system-props";
15
+ import Box from "@sproutsocial/seeds-react-box";
16
+ import { jsx } from "react/jsx-runtime";
17
+ var BODY_PADDING = "64px";
18
+ var ReactModalAdapter = ({
19
+ className = "",
20
+ ...props
21
+ }) => {
22
+ const contentClassName = className.split(" ").map((className2) => `${className2} ${className2}__Content`).join(" ");
23
+ const overlayClassName = className.split(" ").map((className2) => `${className2} ${className2}__Overlay`).join(" ");
24
+ return /* @__PURE__ */ jsx(
25
+ ReactModal,
26
+ {
27
+ portalClassName: className,
28
+ className: contentClassName,
29
+ overlayClassName,
30
+ ...props
31
+ }
32
+ );
33
+ };
34
+ var Body = createGlobalStyle`
35
+ .ReactModal__Body--open {
36
+ overflow: hidden;
37
+ }
38
+ `;
39
+ var Container = styled(ReactModalAdapter)`
40
+ &__Overlay {
41
+ position: fixed;
42
+ top: 0px;
43
+ left: 0px;
44
+ right: 0px;
45
+ bottom: 0px;
46
+ display: flex;
47
+ align-items: center;
48
+ justify-content: center;
49
+ background-color: ${(props) => props.theme.colors.overlay.background.base};
50
+ opacity: 0;
51
+ will-change: opacity;
52
+ transition: opacity ${(props) => props.theme.duration.medium}
53
+ ${(props) => props.theme.easing.ease_inout};
54
+
55
+ ${zIndex}
56
+
57
+ &.ReactModal__Overlay--after-open {
58
+ opacity: 1;
59
+ }
60
+ &.ReactModal__Overlay--before-close {
61
+ opacity: 0;
62
+ }
63
+ }
64
+
65
+ &__Content {
66
+ display: flex;
67
+ flex-direction: column;
68
+ background: ${(props) => props.theme.colors.container.background.base};
69
+ border-radius: ${(props) => props.theme.radii[600]};
70
+ box-shadow: ${(props) => props.theme.shadows.medium};
71
+ filter: blur(0);
72
+ color: ${(props) => props.theme.colors.text.body};
73
+
74
+ outline: none;
75
+ max-width: calc(100vw - ${BODY_PADDING});
76
+ max-height: calc(100vh - ${BODY_PADDING});
77
+ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
78
+ /**
79
+ * This prevents the modal from being very short in IE11. Better too big
80
+ * than too small.
81
+ */
82
+ height: calc(100vh - ${BODY_PADDING});
83
+ }
84
+
85
+ ${width}
86
+
87
+ ${COMMON}
88
+ }
89
+ `;
90
+ var Content = styled(Box)`
91
+ font-family: ${(props) => props.theme.fontFamily};
92
+ min-height: 80px;
93
+ overflow-y: auto;
94
+ flex: 1 1 auto;
95
+ padding: ${(props) => props.theme.space[400]}
96
+ ${(props) => props.theme.space[450]};
97
+ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
98
+ /* 'flex-basis: auto' breaks overflow in IE11 */
99
+ flex-basis: 100%;
100
+ }
101
+ `;
102
+ var HeaderContainer = styled(Box)`
103
+ font-family: ${(props) => props.theme.fontFamily};
104
+ padding: ${(props) => props.theme.space[400]}
105
+ ${(props) => props.theme.space[450]};
106
+ `;
107
+ var Header = styled(HeaderContainer)`
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: space-between;
111
+ flex: 0 0 auto;
112
+ border-bottom-width: ${(props) => props.theme.borderWidths[500]};
113
+ border-bottom-color: ${(props) => props.bordered ? props.theme.colors.container.border.base : "transparent"};
114
+ border-bottom-style: solid;
115
+ `;
116
+ var Footer = styled(Box)`
117
+ flex: 0 0 auto;
118
+ font-family: ${(props) => props.theme.fontFamily};
119
+ padding: ${(props) => props.theme.space[400]}
120
+ ${(props) => props.theme.space[450]};
121
+ border-bottom-right-radius: ${(props) => props.theme.radii[500]};
122
+ border-bottom-left-radius: ${(props) => props.theme.radii[500]};
123
+ `;
124
+ Container.displayName = "ModalContainer";
125
+ Content.displayName = "Content";
126
+ Header.displayName = "Modal.Header";
127
+ Footer.displayName = "Modal.Footer";
128
+
129
+ // src/Modal.tsx
130
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
131
+ var ModalContext = React2.createContext({});
132
+ var ModalHeader = (props) => {
133
+ const { title, subtitle, children, bordered, ...rest } = props;
134
+ return /* @__PURE__ */ jsx2(Header, { bordered: title || subtitle || bordered, ...rest, children: children ? children : /* @__PURE__ */ jsxs(React2.Fragment, { children: [
135
+ /* @__PURE__ */ jsxs(Box2, { children: [
136
+ title && /* @__PURE__ */ jsx2(Text, { as: "h1", fontSize: 400, fontWeight: "semibold", children: title }),
137
+ subtitle && /* @__PURE__ */ jsx2(Text, { as: "div", fontSize: 200, children: subtitle })
138
+ ] }),
139
+ /* @__PURE__ */ jsx2(Box2, { display: "flex", alignItems: "center", "justify-content": "flex-end", children: /* @__PURE__ */ jsx2(ModalCloseButton, { ml: 400 }) })
140
+ ] }) });
141
+ };
142
+ var ModalCloseButton = (props) => {
143
+ const { onClose, closeButtonLabel } = useContext(ModalContext);
144
+ if (!onClose)
145
+ return null;
146
+ return /* @__PURE__ */ jsx2(Button, { onClick: onClose, ...props, children: /* @__PURE__ */ jsx2(Icon, { name: "x-outline", ariaLabel: closeButtonLabel }) });
147
+ };
148
+ var ModalFooter = (props) => /* @__PURE__ */ jsx2(Footer, { borderTop: 500, borderColor: "container.border.base", ...props });
149
+ ModalFooter.defaultProps = {
150
+ bg: "container.background.base"
151
+ };
152
+ var ModalContent = React2.forwardRef(
153
+ ({ children, ...rest }, ref) => {
154
+ const { label } = useContext(ModalContext);
155
+ return /* @__PURE__ */ jsx2(Content, { "data-qa-modal": true, "data-qa-label": label, ref, ...rest, children });
156
+ }
157
+ );
158
+ var Modal = (props) => {
159
+ const {
160
+ appElementSelector,
161
+ children,
162
+ isOpen,
163
+ label,
164
+ onClose,
165
+ closeButtonLabel,
166
+ width: width2,
167
+ zIndex: zIndex2,
168
+ data = {},
169
+ ...rest
170
+ } = props;
171
+ const isCloseable = Boolean(onClose);
172
+ const appElement = appElementSelector && document ? document.querySelector(appElementSelector) : void 0;
173
+ return /* @__PURE__ */ jsx2(
174
+ Container,
175
+ {
176
+ appElement,
177
+ ariaHideApp: !!appElement,
178
+ isOpen,
179
+ contentLabel: label,
180
+ onRequestClose: onClose || (() => {
181
+ }),
182
+ shouldFocusAfterRender: true,
183
+ shouldCloseOnOverlayClick: isCloseable,
184
+ shouldCloseOnEsc: isCloseable,
185
+ shouldReturnFocusAfterClose: true,
186
+ closeTimeoutMS: 200,
187
+ role: "dialog",
188
+ width: width2,
189
+ zIndex: zIndex2,
190
+ data: {
191
+ "qa-modal": "",
192
+ "qa-modal-isopen": isOpen,
193
+ ...data
194
+ },
195
+ ...rest,
196
+ children: /* @__PURE__ */ jsxs(React2.Fragment, { children: [
197
+ /* @__PURE__ */ jsx2(Body, {}),
198
+ /* @__PURE__ */ jsx2(
199
+ ModalContext.Provider,
200
+ {
201
+ value: {
202
+ onClose,
203
+ closeButtonLabel,
204
+ label
205
+ },
206
+ children
207
+ }
208
+ )
209
+ ] })
210
+ }
211
+ );
212
+ };
213
+ Modal.defaultProps = {
214
+ width: "800px",
215
+ zIndex: 6
216
+ };
217
+ ModalHeader.displayName = "Modal.Header";
218
+ ModalFooter.displayName = "Modal.Footer";
219
+ ModalContent.displayName = "Modal.Content";
220
+ ModalCloseButton.displayName = "Modal.CloseButton";
221
+ Modal.Header = ModalHeader;
222
+ Modal.Footer = ModalFooter;
223
+ Modal.Content = ModalContent;
224
+ Modal.CloseButton = ModalCloseButton;
225
+ var Modal_default = Modal;
226
+
227
+ // src/ModalTypes.ts
228
+ import "react";
229
+ import "react-modal";
230
+
231
+ // src/index.ts
232
+ var src_default = Modal_default;
233
+ export {
234
+ Modal_default as Modal,
235
+ src_default as default
236
+ };
237
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Modal.tsx","../../src/styles.tsx","../../src/ModalTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useContext } from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport { Container, Content, Header, Footer, Body } from \"./styles\";\nimport type {\n TypeModalProps,\n TypeModalCloseButtonProps,\n TypeModalContentProps,\n TypeModalFooterProps,\n TypeModalHeaderProps,\n} from \"./ModalTypes\";\n\ntype TypeModalContext = Partial<{\n onClose: () => void;\n closeButtonLabel: string;\n label: string;\n}>;\n\nconst ModalContext = React.createContext<TypeModalContext>({});\n\nconst ModalHeader = (props: TypeModalHeaderProps) => {\n const { title, subtitle, children, bordered, ...rest } = props;\n return (\n <Header bordered={title || subtitle || bordered} {...rest}>\n {children ? (\n children\n ) : (\n <React.Fragment>\n <Box>\n {title && (\n <Text as=\"h1\" fontSize={400} fontWeight=\"semibold\">\n {title}\n </Text>\n )}\n {subtitle && (\n <Text as=\"div\" fontSize={200}>\n {subtitle}\n </Text>\n )}\n </Box>\n <Box display=\"flex\" alignItems=\"center\" justify-content=\"flex-end\">\n <ModalCloseButton ml={400} />\n </Box>\n </React.Fragment>\n )}\n </Header>\n );\n};\n\nconst ModalCloseButton = (props: TypeModalCloseButtonProps) => {\n const { onClose, closeButtonLabel } = useContext(ModalContext);\n if (!onClose) return null;\n return (\n <Button onClick={onClose} {...props}>\n <Icon name=\"x-outline\" ariaLabel={closeButtonLabel} />\n </Button>\n );\n};\n\nconst ModalFooter = (props: TypeModalFooterProps) => (\n <Footer borderTop={500} borderColor=\"container.border.base\" {...props} />\n);\n\nModalFooter.defaultProps = {\n bg: \"container.background.base\",\n};\n\nconst ModalContent = React.forwardRef(\n ({ children, ...rest }: TypeModalContentProps, ref) => {\n const { label } = useContext(ModalContext);\n return (\n <Content data-qa-modal data-qa-label={label} ref={ref} {...rest}>\n {children}\n </Content>\n );\n }\n);\n\n/**\n * The modal you want\n */\nconst Modal = (props: TypeModalProps) => {\n const {\n appElementSelector,\n children,\n isOpen,\n label,\n onClose,\n closeButtonLabel,\n width,\n zIndex,\n data = {},\n ...rest\n } = props;\n\n const isCloseable = Boolean(onClose);\n const appElement =\n appElementSelector && document\n ? (document.querySelector(appElementSelector) as HTMLElement)\n : undefined;\n\n return (\n <Container\n appElement={appElement}\n ariaHideApp={!!appElement}\n isOpen={isOpen}\n contentLabel={label}\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onRequestClose={onClose || (() => {})}\n shouldFocusAfterRender={true}\n shouldCloseOnOverlayClick={isCloseable}\n shouldCloseOnEsc={isCloseable}\n shouldReturnFocusAfterClose={true}\n closeTimeoutMS={200}\n role=\"dialog\"\n width={width}\n zIndex={zIndex}\n data={{\n \"qa-modal\": \"\",\n \"qa-modal-isopen\": isOpen,\n ...data,\n }}\n {...rest}\n >\n <React.Fragment>\n <Body />\n\n <ModalContext.Provider\n value={{\n onClose,\n closeButtonLabel,\n label,\n }}\n >\n {children}\n </ModalContext.Provider>\n </React.Fragment>\n </Container>\n );\n};\n\nModal.defaultProps = {\n width: \"800px\",\n zIndex: 6,\n};\n\nModalHeader.displayName = \"Modal.Header\";\nModalFooter.displayName = \"Modal.Footer\";\nModalContent.displayName = \"Modal.Content\";\nModalCloseButton.displayName = \"Modal.CloseButton\";\n\nModal.Header = ModalHeader;\nModal.Footer = ModalFooter;\nModal.Content = ModalContent;\nModal.CloseButton = ModalCloseButton;\n\nexport default Modal;\n","import React from \"react\";\nimport styled, { createGlobalStyle } from \"styled-components\";\nimport { width, zIndex } from \"styled-system\";\nimport ReactModal from \"react-modal\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport Box, { type TypeContainerProps } from \"@sproutsocial/seeds-react-box\";\n\n// This is the max space allowed between the modal and the edge of the browser\nconst BODY_PADDING = \"64px\";\n\nconst ReactModalAdapter = ({\n className = \"\",\n ...props\n}: { className?: string } & Omit<\n ReactModal.Props,\n \"portalClassName\" | \"className\" | \"overlayClassName\"\n>) => {\n // We want to create *__Content and *__Overlay class names on the subcomponents.\n // Because `className` could be a space-separated list of class names, we make\n // sure that we append `__Content` and `__Overlay` to every class name.\n const contentClassName = className\n .split(\" \")\n .map((className) => `${className} ${className}__Content`)\n .join(\" \");\n\n const overlayClassName = className\n .split(\" \")\n .map((className) => `${className} ${className}__Overlay`)\n .join(\" \");\n\n return (\n <ReactModal\n portalClassName={className}\n className={contentClassName}\n overlayClassName={overlayClassName}\n {...props}\n />\n );\n};\n\nexport const Body = createGlobalStyle`\n .ReactModal__Body--open {\n overflow: hidden;\n }\n`;\n\nexport const Container = styled(ReactModalAdapter)<TypeContainerProps>`\n &__Overlay {\n position: fixed;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ${(props) => props.theme.colors.overlay.background.base};\n opacity: 0;\n will-change: opacity;\n transition: opacity ${(props) => props.theme.duration.medium}\n ${(props) => props.theme.easing.ease_inout};\n\n ${zIndex}\n\n &.ReactModal__Overlay--after-open {\n opacity: 1;\n }\n &.ReactModal__Overlay--before-close {\n opacity: 0;\n }\n }\n\n &__Content {\n display: flex;\n flex-direction: column;\n background: ${(props) => props.theme.colors.container.background.base};\n border-radius: ${(props) => props.theme.radii[600]};\n box-shadow: ${(props) => props.theme.shadows.medium};\n filter: blur(0);\n color: ${(props) => props.theme.colors.text.body};\n\n outline: none;\n max-width: calc(100vw - ${BODY_PADDING});\n max-height: calc(100vh - ${BODY_PADDING});\n @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n /**\n * This prevents the modal from being very short in IE11. Better too big\n * than too small.\n */\n height: calc(100vh - ${BODY_PADDING});\n }\n\n ${width}\n\n ${COMMON}\n }\n`;\n\nexport const Content = styled(Box)`\n font-family: ${(props) => props.theme.fontFamily};\n min-height: 80px;\n overflow-y: auto;\n flex: 1 1 auto;\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[450]};\n @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n /* 'flex-basis: auto' breaks overflow in IE11 */\n flex-basis: 100%;\n }\n`;\n\nexport const HeaderContainer = styled(Box)`\n font-family: ${(props) => props.theme.fontFamily};\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[450]};\n`;\n\nexport const Header = styled(HeaderContainer)<{ bordered?: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 0 0 auto;\n border-bottom-width: ${(props) => props.theme.borderWidths[500]};\n border-bottom-color: ${(props) =>\n props.bordered ? props.theme.colors.container.border.base : \"transparent\"};\n border-bottom-style: solid;\n`;\n\nexport const Footer = styled(Box)`\n flex: 0 0 auto;\n font-family: ${(props) => props.theme.fontFamily};\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[450]};\n border-bottom-right-radius: ${(props) => props.theme.radii[500]};\n border-bottom-left-radius: ${(props) => props.theme.radii[500]};\n`;\n\nContainer.displayName = \"ModalContainer\";\nContent.displayName = \"Content\";\nHeader.displayName = \"Modal.Header\";\nFooter.displayName = \"Modal.Footer\";\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport type {\n TypeBoxProps,\n TypeContainerProps,\n} from \"@sproutsocial/seeds-react-box\";\nimport type { TypeButtonProps } from \"@sproutsocial/seeds-react-button\";\n\nexport interface TypeModalCloseButtonProps\n extends Omit<TypeButtonProps, \"children\"> {\n children?: void | null;\n}\n\nexport interface TypeModalHeaderProps extends TypeBoxProps {\n title?: string;\n subtitle?: string;\n\n /** Passing children will override the default modal header */\n children?: React.ReactNode;\n\n /** If you're rendering a custom header, you can use this prop to add a bottom border */\n bordered?: boolean;\n}\n\nexport interface TypeModalFooterProps extends TypeBoxProps {\n bg?: string;\n children: React.ReactNode;\n}\n\nexport interface TypeModalContentProps extends TypeBoxProps {\n children?: React.ReactNode;\n}\n\nexport interface TypeModalProps\n extends TypeContainerProps,\n // @ts-notes - onClose is an alias for onRequestClose so we don't need to include it here\n Omit<ReactModal.Props, keyof TypeContainerProps | \"onRequestClose\"> {\n /** section of app to aria hide for the modal */\n appElementSelector?: string;\n\n /** trigger to open or close the modal */\n isOpen: boolean;\n\n /** label for screen readers to announce the modal */\n label: string;\n\n /** body content of the modal */\n children: React.ReactNode;\n\n /** callback for close */\n onClose?: () => void;\n\n /** aria-label for modal X */\n closeButtonLabel: string;\n\n /** Controls the z-index CSS property */\n zIndex?: number;\n\n /** The max width of the modal container */\n width?: string | number;\n\n /**\n * Custom attributes to be added to the modals container\n * Each key will be prepended with \"data-\" when rendered in the DOM\n */\n data?: Record<string, string | boolean | number>;\n}\n","import Modal from \"./Modal\";\n\nexport default Modal;\nexport { Modal };\nexport * from \"./ModalTypes\";\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,SAAS,kBAAkB;AAC3B,OAAOC,UAAS;AAChB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,UAAU;;;ACLjB,OAAkB;AAClB,OAAO,UAAU,yBAAyB;AAC1C,SAAS,OAAO,cAAc;AAC9B,OAAO,gBAAgB;AACvB,SAAS,cAAc;AACvB,OAAO,SAAsC;AA0BzC;AAvBJ,IAAM,eAAe;AAErB,IAAM,oBAAoB,CAAC;AAAA,EACzB,YAAY;AAAA,EACZ,GAAG;AACL,MAGM;AAIJ,QAAM,mBAAmB,UACtB,MAAM,GAAG,EACT,IAAI,CAACC,eAAc,GAAGA,UAAS,IAAIA,UAAS,WAAW,EACvD,KAAK,GAAG;AAEX,QAAM,mBAAmB,UACtB,MAAM,GAAG,EACT,IAAI,CAACA,eAAc,GAAGA,UAAS,IAAIA,UAAS,WAAW,EACvD,KAAK,GAAG;AAEX,SACE;AAAA,IAAC;AAAA;AAAA,MACC,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,IAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAMb,IAAM,YAAY,OAAO,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAUzB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;AAAA;AAAA;AAAA,0BAGnD,CAAC,UAAU,MAAM,MAAM,SAAS,MAAM;AAAA,QACxD,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AEA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,aAAa,cAAc;AAC3B,iBAAiB,cAAc;AAE/B,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,cAAc;AAEpB,IAAO,gBAAQ;;;AE/Jf,OAAuB;AACvB,OAAuB;;;ACCvB,IAAO,cAAQ;","names":["React","Box","className","jsx","Box","width","zIndex"]}
@@ -0,0 +1,76 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import ReactModal from 'react-modal';
4
+ import { TypeBoxProps, TypeContainerProps } from '@sproutsocial/seeds-react-box';
5
+ import { TypeButtonProps } from '@sproutsocial/seeds-react-button';
6
+
7
+ interface TypeModalCloseButtonProps extends Omit<TypeButtonProps, "children"> {
8
+ children?: void | null;
9
+ }
10
+ interface TypeModalHeaderProps extends TypeBoxProps {
11
+ title?: string;
12
+ subtitle?: string;
13
+ /** Passing children will override the default modal header */
14
+ children?: React.ReactNode;
15
+ /** If you're rendering a custom header, you can use this prop to add a bottom border */
16
+ bordered?: boolean;
17
+ }
18
+ interface TypeModalFooterProps extends TypeBoxProps {
19
+ bg?: string;
20
+ children: React.ReactNode;
21
+ }
22
+ interface TypeModalContentProps extends TypeBoxProps {
23
+ children?: React.ReactNode;
24
+ }
25
+ interface TypeModalProps extends TypeContainerProps, Omit<ReactModal.Props, keyof TypeContainerProps | "onRequestClose"> {
26
+ /** section of app to aria hide for the modal */
27
+ appElementSelector?: string;
28
+ /** trigger to open or close the modal */
29
+ isOpen: boolean;
30
+ /** label for screen readers to announce the modal */
31
+ label: string;
32
+ /** body content of the modal */
33
+ children: React.ReactNode;
34
+ /** callback for close */
35
+ onClose?: () => void;
36
+ /** aria-label for modal X */
37
+ closeButtonLabel: string;
38
+ /** Controls the z-index CSS property */
39
+ zIndex?: number;
40
+ /** The max width of the modal container */
41
+ width?: string | number;
42
+ /**
43
+ * Custom attributes to be added to the modals container
44
+ * Each key will be prepended with "data-" when rendered in the DOM
45
+ */
46
+ data?: Record<string, string | boolean | number>;
47
+ }
48
+
49
+ /**
50
+ * The modal you want
51
+ */
52
+ declare const Modal: {
53
+ (props: TypeModalProps): react_jsx_runtime.JSX.Element;
54
+ defaultProps: {
55
+ width: string;
56
+ zIndex: number;
57
+ };
58
+ Header: {
59
+ (props: TypeModalHeaderProps): react_jsx_runtime.JSX.Element;
60
+ displayName: string;
61
+ };
62
+ Footer: {
63
+ (props: TypeModalFooterProps): react_jsx_runtime.JSX.Element;
64
+ defaultProps: {
65
+ bg: string;
66
+ };
67
+ displayName: string;
68
+ };
69
+ Content: React.ForwardRefExoticComponent<Omit<TypeModalContentProps, "ref"> & React.RefAttributes<unknown>>;
70
+ CloseButton: {
71
+ (props: TypeModalCloseButtonProps): react_jsx_runtime.JSX.Element | null;
72
+ displayName: string;
73
+ };
74
+ };
75
+
76
+ export { Modal, type TypeModalCloseButtonProps, type TypeModalContentProps, type TypeModalFooterProps, type TypeModalHeaderProps, type TypeModalProps, Modal as default };
@@ -0,0 +1,76 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import ReactModal from 'react-modal';
4
+ import { TypeBoxProps, TypeContainerProps } from '@sproutsocial/seeds-react-box';
5
+ import { TypeButtonProps } from '@sproutsocial/seeds-react-button';
6
+
7
+ interface TypeModalCloseButtonProps extends Omit<TypeButtonProps, "children"> {
8
+ children?: void | null;
9
+ }
10
+ interface TypeModalHeaderProps extends TypeBoxProps {
11
+ title?: string;
12
+ subtitle?: string;
13
+ /** Passing children will override the default modal header */
14
+ children?: React.ReactNode;
15
+ /** If you're rendering a custom header, you can use this prop to add a bottom border */
16
+ bordered?: boolean;
17
+ }
18
+ interface TypeModalFooterProps extends TypeBoxProps {
19
+ bg?: string;
20
+ children: React.ReactNode;
21
+ }
22
+ interface TypeModalContentProps extends TypeBoxProps {
23
+ children?: React.ReactNode;
24
+ }
25
+ interface TypeModalProps extends TypeContainerProps, Omit<ReactModal.Props, keyof TypeContainerProps | "onRequestClose"> {
26
+ /** section of app to aria hide for the modal */
27
+ appElementSelector?: string;
28
+ /** trigger to open or close the modal */
29
+ isOpen: boolean;
30
+ /** label for screen readers to announce the modal */
31
+ label: string;
32
+ /** body content of the modal */
33
+ children: React.ReactNode;
34
+ /** callback for close */
35
+ onClose?: () => void;
36
+ /** aria-label for modal X */
37
+ closeButtonLabel: string;
38
+ /** Controls the z-index CSS property */
39
+ zIndex?: number;
40
+ /** The max width of the modal container */
41
+ width?: string | number;
42
+ /**
43
+ * Custom attributes to be added to the modals container
44
+ * Each key will be prepended with "data-" when rendered in the DOM
45
+ */
46
+ data?: Record<string, string | boolean | number>;
47
+ }
48
+
49
+ /**
50
+ * The modal you want
51
+ */
52
+ declare const Modal: {
53
+ (props: TypeModalProps): react_jsx_runtime.JSX.Element;
54
+ defaultProps: {
55
+ width: string;
56
+ zIndex: number;
57
+ };
58
+ Header: {
59
+ (props: TypeModalHeaderProps): react_jsx_runtime.JSX.Element;
60
+ displayName: string;
61
+ };
62
+ Footer: {
63
+ (props: TypeModalFooterProps): react_jsx_runtime.JSX.Element;
64
+ defaultProps: {
65
+ bg: string;
66
+ };
67
+ displayName: string;
68
+ };
69
+ Content: React.ForwardRefExoticComponent<Omit<TypeModalContentProps, "ref"> & React.RefAttributes<unknown>>;
70
+ CloseButton: {
71
+ (props: TypeModalCloseButtonProps): react_jsx_runtime.JSX.Element | null;
72
+ displayName: string;
73
+ };
74
+ };
75
+
76
+ export { Modal, type TypeModalCloseButtonProps, type TypeModalContentProps, type TypeModalFooterProps, type TypeModalHeaderProps, type TypeModalProps, Modal as default };