@sproutsocial/seeds-react-drawer 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/dist/index.js ADDED
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ Drawer: () => Drawer_default,
34
+ default: () => src_default
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+
38
+ // src/Drawer.tsx
39
+ var React = __toESM(require("react"));
40
+ var import_react = require("react");
41
+ var import_react_focus_lock = __toESM(require("react-focus-lock"));
42
+ var import_web = require("@react-spring/web");
43
+ var import_unitless = require("@sproutsocial/seeds-motion/unitless");
44
+ var import_seeds_react_box2 = __toESM(require("@sproutsocial/seeds-react-box"));
45
+ var import_seeds_react_button = __toESM(require("@sproutsocial/seeds-react-button"));
46
+ var import_seeds_react_icon = __toESM(require("@sproutsocial/seeds-react-icon"));
47
+ var import_seeds_react_text = __toESM(require("@sproutsocial/seeds-react-text"));
48
+ var import_seeds_react_portal = __toESM(require("@sproutsocial/seeds-react-portal"));
49
+
50
+ // src/styles.ts
51
+ var import_styled_components = __toESM(require("styled-components"));
52
+ var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
53
+ var import_seeds_react_box = __toESM(require("@sproutsocial/seeds-react-box"));
54
+ var Content = (0, import_styled_components.default)(import_seeds_react_box.default)`
55
+ overflow-y: auto;
56
+ `;
57
+ var Container = import_styled_components.default.div`
58
+ display: flex;
59
+ flex-direction: column;
60
+ position: fixed;
61
+ top: 0;
62
+ height: 100%;
63
+ width: ${(props) => props.width}px;
64
+ background-color: ${(props) => props.theme.colors.container.background.base};
65
+ box-shadow: ${(props) => props.theme.shadows.high};
66
+ filter: blur(0);
67
+
68
+ ${(props) => import_styled_components.css`
69
+ ${props.direction}: ${props.offset}px;
70
+ `}
71
+
72
+ ${import_seeds_react_system_props.COMMON}
73
+ `;
74
+ var styles_default = Container;
75
+
76
+ // src/Drawer.tsx
77
+ var import_jsx_runtime = require("react/jsx-runtime");
78
+ var useSlideTransition = ({
79
+ isVisible,
80
+ width,
81
+ direction
82
+ }) => {
83
+ const offset = width * (direction === "left" ? -1 : 1);
84
+ return (0, import_web.useTransition)(isVisible, {
85
+ from: {
86
+ opacity: 0,
87
+ x: offset
88
+ },
89
+ enter: {
90
+ opacity: 1,
91
+ x: 0
92
+ },
93
+ leave: {
94
+ opacity: 0,
95
+ x: offset
96
+ },
97
+ config: {
98
+ duration: import_unitless.MOTION_DURATION_MEDIUM * 1e3
99
+ }
100
+ });
101
+ };
102
+ var AnimatedDrawer = (0, import_web.animated)(styles_default);
103
+ var doesRefContainEventTarget = (ref, event) => {
104
+ return ref.current && event.target instanceof Node && ref.current.contains(event.target);
105
+ };
106
+ var DrawerContext = React.createContext({});
107
+ var DrawerCloseButton = (props) => {
108
+ const { onClose, closeButtonLabel } = (0, import_react.useContext)(DrawerContext);
109
+ if (props.render) {
110
+ return props.render({
111
+ onClose,
112
+ closeButtonLabel
113
+ }) ?? null;
114
+ }
115
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ import_seeds_react_button.default,
117
+ {
118
+ appearance: "pill",
119
+ "aria-label": closeButtonLabel,
120
+ onClick: onClose,
121
+ ...props,
122
+ children: props.children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_icon.default, { "aria-hidden": true, name: "x-outline" })
123
+ }
124
+ );
125
+ };
126
+ var DrawerHeader = ({
127
+ title = "",
128
+ id = void 0,
129
+ children,
130
+ render,
131
+ ...rest
132
+ }) => {
133
+ const drawerContext = (0, import_react.useContext)(DrawerContext);
134
+ if (render) {
135
+ return render(drawerContext);
136
+ }
137
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ import_seeds_react_box2.default,
139
+ {
140
+ display: "flex",
141
+ flex: "0 0 auto",
142
+ justifyContent: "space-between",
143
+ alignItems: "center",
144
+ pt: 400,
145
+ px: 450,
146
+ ...rest,
147
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(React.Fragment, { children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
+ import_seeds_react_text.default,
150
+ {
151
+ as: "h2",
152
+ fontSize: 400,
153
+ fontWeight: "semibold",
154
+ color: "text.headline",
155
+ id,
156
+ children: title
157
+ }
158
+ ),
159
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerCloseButton, {})
160
+ ] })
161
+ }
162
+ );
163
+ };
164
+ var DrawerContent = ({ children, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, { height: "100%", p: 450, color: "text.body", ...rest, children });
165
+ var useCloseOnBodyClick = ({
166
+ ref,
167
+ disableCloseOnClickOutside,
168
+ onClose,
169
+ closeTargets
170
+ }) => {
171
+ (0, import_react.useEffect)(() => {
172
+ const documentBody = document.body;
173
+ if (!documentBody) {
174
+ return;
175
+ }
176
+ const onEsc = (event) => {
177
+ if (event.key === "Escape") {
178
+ onClose();
179
+ }
180
+ };
181
+ const bodyClick = (event) => {
182
+ if (
183
+ // @ts-ignore I'm not sure how to type this ref properly
184
+ !doesRefContainEventTarget(ref, event) && !disableCloseOnClickOutside
185
+ ) {
186
+ onClose();
187
+ }
188
+ };
189
+ documentBody?.addEventListener("keydown", onEsc, { capture: true });
190
+ if (closeTargets) {
191
+ closeTargets.forEach(
192
+ (targetElement) => targetElement?.addEventListener("click", bodyClick, { capture: true })
193
+ );
194
+ } else {
195
+ documentBody.firstElementChild?.addEventListener("click", bodyClick, {
196
+ capture: true
197
+ });
198
+ }
199
+ return () => {
200
+ documentBody?.removeEventListener("keydown", onEsc, { capture: true });
201
+ if (closeTargets) {
202
+ closeTargets.forEach(
203
+ (targetElement) => targetElement?.removeEventListener("click", bodyClick, {
204
+ capture: true
205
+ })
206
+ );
207
+ } else {
208
+ documentBody.firstElementChild?.removeEventListener(
209
+ "click",
210
+ bodyClick,
211
+ { capture: true }
212
+ );
213
+ }
214
+ };
215
+ }, [onClose, disableCloseOnClickOutside, closeTargets, ref]);
216
+ };
217
+ var Drawer = ({
218
+ id,
219
+ offset,
220
+ direction,
221
+ children,
222
+ disableCloseOnClickOutside,
223
+ onClose,
224
+ zIndex,
225
+ closeTargets,
226
+ width,
227
+ focusLockExemptCheck,
228
+ isOpen,
229
+ ...rest
230
+ }) => {
231
+ const ref = (0, import_react.useRef)(null);
232
+ useCloseOnBodyClick({
233
+ ref,
234
+ disableCloseOnClickOutside,
235
+ onClose,
236
+ closeTargets
237
+ });
238
+ const transition = useSlideTransition({
239
+ isVisible: isOpen,
240
+ width,
241
+ direction
242
+ });
243
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
+ import_react_focus_lock.default,
245
+ {
246
+ autoFocus: true,
247
+ returnFocus: true,
248
+ whiteList: focusLockExemptCheck ? (e) => !focusLockExemptCheck(e) : void 0,
249
+ children: transition(
250
+ (style, isVisible) => isVisible ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
+ AnimatedDrawer,
252
+ {
253
+ ref,
254
+ style: { ...style, zIndex },
255
+ width,
256
+ offset,
257
+ direction,
258
+ "data-qa-drawer": id,
259
+ role: "dialog",
260
+ ...rest,
261
+ children
262
+ }
263
+ ) : null
264
+ )
265
+ },
266
+ id
267
+ );
268
+ };
269
+ var DrawerContainer = ({
270
+ children,
271
+ closeButtonLabel,
272
+ direction = "right",
273
+ disableCloseOnClickOutside = false,
274
+ id,
275
+ isOpen,
276
+ offset = 0,
277
+ onClose,
278
+ zIndex = 7,
279
+ closeTargets = [],
280
+ width = 600,
281
+ ...rest
282
+ }) => {
283
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_portal.default, { id, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
284
+ DrawerContext.Provider,
285
+ {
286
+ value: {
287
+ onClose,
288
+ closeButtonLabel
289
+ },
290
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
291
+ Drawer,
292
+ {
293
+ isOpen,
294
+ id,
295
+ offset,
296
+ direction,
297
+ disableCloseOnClickOutside,
298
+ onClose,
299
+ zIndex,
300
+ closeTargets,
301
+ width,
302
+ "data-qa-drawer": id || "",
303
+ "data-qa-drawer-isopen": isOpen,
304
+ ...rest,
305
+ children
306
+ }
307
+ )
308
+ }
309
+ ) });
310
+ };
311
+ DrawerHeader.displayName = "Drawer.Header";
312
+ DrawerContent.displayName = "Drawer.Content";
313
+ DrawerCloseButton.displayName = "Drawer.CloseButton";
314
+ DrawerContainer.Header = DrawerHeader;
315
+ DrawerContainer.Content = DrawerContent;
316
+ DrawerContainer.CloseButton = DrawerCloseButton;
317
+ var Drawer_default = DrawerContainer;
318
+
319
+ // src/DrawerTypes.ts
320
+ var React2 = require("react");
321
+
322
+ // src/index.ts
323
+ var src_default = Drawer_default;
324
+ // Annotate the CommonJS export names for ESM import in node:
325
+ 0 && (module.exports = {
326
+ Drawer
327
+ });
328
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/Drawer.tsx","../src/styles.ts","../src/DrawerTypes.ts"],"sourcesContent":["import Drawer from \"./Drawer\";\n\nexport default Drawer;\nexport { Drawer };\nexport * from \"./DrawerTypes\";\n","import * as React from \"react\";\nimport { useContext, useEffect, useRef } from \"react\";\nimport FocusLock from \"react-focus-lock\";\nimport { animated, useTransition } from \"@react-spring/web\";\nimport { MOTION_DURATION_MEDIUM } from \"@sproutsocial/seeds-motion/unitless\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\n// eslint-disable-next-line import/no-deprecated\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport Portal from \"@sproutsocial/seeds-react-portal\";\nimport Container, { Content } from \"./styles\";\nimport type {\n TypeDrawerContext,\n TypeDrawerCloseButtonProps,\n TypeDrawerHeaderProps,\n TypeDrawerProps,\n TypeInnerDrawerProps,\n TypeDrawerContentProps,\n TypeUseCloseOnBodyClickProps,\n} from \"./DrawerTypes\";\n\nconst useSlideTransition = ({\n isVisible,\n width,\n direction,\n}: {\n isVisible: boolean;\n width: number;\n direction: \"left\" | \"right\";\n}) => {\n const offset = width * (direction === \"left\" ? -1 : 1);\n\n return useTransition(isVisible, {\n from: {\n opacity: 0,\n x: offset,\n },\n enter: {\n opacity: 1,\n x: 0,\n },\n leave: {\n opacity: 0,\n x: offset,\n },\n config: {\n duration: MOTION_DURATION_MEDIUM * 1000,\n },\n });\n};\n\nconst AnimatedDrawer = animated(Container);\n\nconst doesRefContainEventTarget = (\n ref: { current: { contains: (arg0: any) => any } },\n event: Event\n) => {\n return (\n ref.current &&\n event.target instanceof Node &&\n ref.current.contains(event.target)\n );\n};\n\nconst DrawerContext = React.createContext<TypeDrawerContext>({});\n\nconst DrawerCloseButton = (props: TypeDrawerCloseButtonProps) => {\n const { onClose, closeButtonLabel } = useContext(DrawerContext);\n\n if (props.render) {\n return (\n props.render({\n onClose,\n closeButtonLabel,\n }) ?? null\n );\n }\n\n return (\n <Button\n appearance=\"pill\"\n aria-label={closeButtonLabel}\n onClick={onClose}\n {...props}\n >\n {props.children || <Icon aria-hidden name=\"x-outline\" />}\n </Button>\n );\n};\n\nconst DrawerHeader = ({\n title = \"\",\n id = undefined,\n children,\n render,\n ...rest\n}: TypeDrawerHeaderProps) => {\n const drawerContext = useContext(DrawerContext);\n\n if (render) {\n return render(drawerContext);\n }\n\n return (\n <Box\n display=\"flex\"\n flex=\"0 0 auto\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n pt={400}\n px={450}\n {...rest}\n >\n {children || (\n <React.Fragment>\n <Text\n as=\"h2\"\n fontSize={400}\n fontWeight=\"semibold\"\n color=\"text.headline\"\n id={id}\n >\n {title}\n </Text>\n <DrawerCloseButton />\n </React.Fragment>\n )}\n </Box>\n );\n};\n\nconst DrawerContent = ({ children, ...rest }: TypeDrawerContentProps) => (\n <Content height=\"100%\" p={450} color=\"text.body\" {...rest}>\n {children}\n </Content>\n);\n\nconst useCloseOnBodyClick = ({\n ref,\n disableCloseOnClickOutside,\n onClose,\n closeTargets,\n}: TypeUseCloseOnBodyClickProps) => {\n useEffect(() => {\n const documentBody = document.body;\n\n if (!documentBody) {\n return;\n }\n\n const onEsc = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") {\n onClose();\n }\n };\n\n const bodyClick = (event: Event): void => {\n if (\n // @ts-ignore I'm not sure how to type this ref properly\n !doesRefContainEventTarget(ref, event) &&\n !disableCloseOnClickOutside\n ) {\n onClose();\n }\n };\n\n documentBody?.addEventListener(\"keydown\", onEsc, { capture: true });\n\n if (closeTargets) {\n closeTargets.forEach((targetElement) =>\n targetElement?.addEventListener(\"click\", bodyClick, { capture: true })\n );\n } else {\n documentBody.firstElementChild?.addEventListener(\"click\", bodyClick, {\n capture: true,\n });\n }\n\n return () => {\n documentBody?.removeEventListener(\"keydown\", onEsc, { capture: true });\n\n if (closeTargets) {\n closeTargets.forEach((targetElement) =>\n targetElement?.removeEventListener(\"click\", bodyClick, {\n capture: true,\n })\n );\n } else {\n documentBody.firstElementChild?.removeEventListener(\n \"click\",\n bodyClick,\n { capture: true }\n );\n }\n };\n }, [onClose, disableCloseOnClickOutside, closeTargets, ref]);\n};\n\nconst Drawer = ({\n id,\n offset,\n direction,\n children,\n disableCloseOnClickOutside,\n onClose,\n zIndex,\n closeTargets,\n width,\n focusLockExemptCheck,\n isOpen,\n ...rest\n}: TypeInnerDrawerProps) => {\n const ref = useRef(null);\n useCloseOnBodyClick({\n ref,\n disableCloseOnClickOutside,\n onClose,\n closeTargets,\n });\n\n const transition = useSlideTransition({\n isVisible: isOpen,\n width,\n direction,\n });\n\n return (\n <FocusLock\n key={id}\n autoFocus={true}\n returnFocus\n whiteList={\n focusLockExemptCheck ? (e) => !focusLockExemptCheck(e) : undefined\n }\n >\n {transition((style, isVisible) =>\n isVisible ? (\n <AnimatedDrawer\n ref={ref}\n style={{ ...style, zIndex }}\n width={width}\n offset={offset}\n direction={direction}\n data-qa-drawer={id}\n role=\"dialog\"\n {...rest}\n >\n {children}\n </AnimatedDrawer>\n ) : null\n )}\n </FocusLock>\n );\n};\n\nconst DrawerContainer = ({\n children,\n closeButtonLabel,\n direction = \"right\",\n disableCloseOnClickOutside = false,\n id,\n isOpen,\n offset = 0,\n onClose,\n zIndex = 7,\n closeTargets = [],\n width = 600,\n ...rest\n}: TypeDrawerProps) => {\n return (\n <Portal id={id}>\n <DrawerContext.Provider\n value={{\n onClose,\n closeButtonLabel,\n }}\n >\n <Drawer\n isOpen={isOpen}\n id={id}\n offset={offset}\n direction={direction}\n disableCloseOnClickOutside={disableCloseOnClickOutside}\n onClose={onClose}\n zIndex={zIndex}\n closeTargets={closeTargets}\n width={width}\n data-qa-drawer={id || \"\"}\n data-qa-drawer-isopen={isOpen}\n {...rest}\n >\n {children}\n </Drawer>\n </DrawerContext.Provider>\n </Portal>\n );\n};\n\nDrawerHeader.displayName = \"Drawer.Header\";\nDrawerContent.displayName = \"Drawer.Content\";\nDrawerCloseButton.displayName = \"Drawer.CloseButton\";\n\nDrawerContainer.Header = DrawerHeader;\nDrawerContainer.Content = DrawerContent;\nDrawerContainer.CloseButton = DrawerCloseButton;\n\nexport default DrawerContainer;\n","import type { TypeDrawerProps } from \"./DrawerTypes\";\nimport styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeSystemCommonProps } from \"@sproutsocial/seeds-react-system-props\";\n\nimport Box from \"@sproutsocial/seeds-react-box\";\n\nexport const Content = styled(Box)`\n overflow-y: auto;\n`;\n\ninterface ContainerType\n extends Pick<TypeDrawerProps, \"offset\" | \"direction\">,\n TypeSystemCommonProps {\n width: number;\n}\n\nconst Container = styled.div<ContainerType>`\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n height: 100%;\n width: ${(props) => props.width}px;\n background-color: ${(props) => props.theme.colors.container.background.base};\n box-shadow: ${(props) => props.theme.shadows.high};\n filter: blur(0);\n\n ${(props) => css`\n ${props.direction}: ${props.offset}px;\n `}\n\n ${COMMON}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\nimport type { TypeButtonProps } from \"@sproutsocial/seeds-react-button\";\n\ntype DrawerAnimationDirection = \"left\" | \"right\";\n\nexport interface TypeDrawerContext {\n /** Callback for close button */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClose?: () => any;\n\n /** aria-label for drawer close button */\n closeButtonLabel?: string;\n}\n// TODO: Should the render prop be a React.FC?\nexport interface TypeDrawerCloseButtonProps\n extends Omit<TypeButtonProps, \"children\"> {\n /** An optional function that receives the context of the parent drawer as an argument. Can be used to customize the on-close behavior. */\n render?: React.FC<TypeDrawerContext>;\n children?: React.ReactNode;\n}\n\nexport interface TypeDrawerHeaderProps extends TypeBoxProps {\n title?: string;\n children?: React.ReactNode;\n\n /** An optional function that receives the context of the parent drawer as an argument. Can be used to customize the appearance of the header. */\n render?: React.FC<TypeDrawerContext>;\n}\n\nexport interface TypeInnerDrawerProps\n extends Omit<TypeDrawerProps, \"closeButtonLabel\"> {\n width: number;\n direction: DrawerAnimationDirection;\n}\n\ntype useBodyClicksProps = Pick<\n TypeDrawerProps,\n \"closeTargets\" | \"onClose\" | \"disableCloseOnClickOutside\"\n>;\n\nexport interface TypeUseCloseOnBodyClickProps\n extends Pick<\n TypeDrawerProps,\n \"closeTargets\" | \"onClose\" | \"disableCloseOnClickOutside\"\n > {\n ref?: React.RefObject<HTMLElement | null>;\n}\n\nexport interface TypeDrawerProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"nav\">, \"color\"> {\n children: React.ReactNode;\n\n /** Label for the close button. Usually this should be \"Close\" */\n closeButtonLabel: string;\n\n /** Whether the drawer slides in from the left or right side of the screen */\n direction?: DrawerAnimationDirection;\n\n /** In some cases, you may not want the user to be able to click outside of the drawer to close it. You can disable that with this prop. */\n disableCloseOnClickOutside?: boolean;\n id: string;\n isOpen: boolean;\n offset?: number;\n onClose: () => void;\n zIndex?: number;\n closeTargets?: Array<Element>;\n width?: number;\n focusLockExemptCheck?: (element: HTMLElement) => boolean;\n}\n\nexport interface TypeDrawerContentProps extends TypeBoxProps {\n children?: React.ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,m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1B,gBAAgB,cAAc;AAE9B,IAAO,iBAAQ;;;AEnTf,IAAAC,SAAuB;;;AHEvB,IAAO,cAAQ;","names":["import_seeds_react_box","styled","Box","Button","Icon","Box","Text","FocusLock","Portal","React"]}
package/jest.config.js ADDED
@@ -0,0 +1,9 @@
1
+ const baseConfig = require("@sproutsocial/seeds-testing");
2
+
3
+ /** * @type {import('jest').Config} */
4
+ const config = {
5
+ ...baseConfig,
6
+ displayName: "seeds-react-drawer",
7
+ };
8
+
9
+ module.exports = config;
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@sproutsocial/seeds-react-drawer",
3
+ "version": "1.0.0",
4
+ "description": "Seeds React Drawer",
5
+ "author": "Sprout Social, Inc.",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "module": "dist/esm/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "scripts": {
11
+ "build": "tsup --dts",
12
+ "build:debug": "tsup --dts --metafile",
13
+ "dev": "tsup --watch --dts",
14
+ "clean": "rm -rf .turbo dist",
15
+ "clean:modules": "rm -rf node_modules",
16
+ "typecheck": "tsc --noEmit",
17
+ "test": "jest",
18
+ "test:watch": "jest --watch --coverage=false"
19
+ },
20
+ "dependencies": {
21
+ "@sproutsocial/seeds-react-theme": "*",
22
+ "@sproutsocial/seeds-react-system-props": "*",
23
+ "@sproutsocial/seeds-react-box": "*",
24
+ "@sproutsocial/seeds-react-button": "*",
25
+ "@sproutsocial/seeds-react-icon": "*",
26
+ "@sproutsocial/seeds-react-text": "*",
27
+ "@sproutsocial/seeds-react-portal": "*",
28
+ "@sproutsocial/seeds-motion": "*",
29
+ "@react-spring/web": "^9.0.0",
30
+ "react-focus-lock": "^2.0.3"
31
+ },
32
+ "devDependencies": {
33
+ "@types/react": "^18.0.0",
34
+ "@types/styled-components": "^5.1.26",
35
+ "@sproutsocial/eslint-config-seeds": "*",
36
+ "react": "^18.0.0",
37
+ "styled-components": "^5.2.3",
38
+ "tsup": "^8.0.2",
39
+ "typescript": "^5.6.2",
40
+ "@sproutsocial/seeds-tsconfig": "*",
41
+ "@sproutsocial/seeds-testing": "*",
42
+ "@sproutsocial/seeds-react-testing-library": "*"
43
+ },
44
+ "peerDependencies": {
45
+ "styled-components": "^5.2.3"
46
+ },
47
+ "engines": {
48
+ "node": ">=18"
49
+ }
50
+ }