@grantbii/design-system 1.0.57 → 1.0.59

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.
@@ -0,0 +1,3 @@
1
+ import { LoaderSizeProps } from "react-spinners/helpers/props";
2
+ declare const PageLoader: ({ color, size, ...restOfProps }: LoaderSizeProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default PageLoader;
@@ -0,0 +1,28 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { MoonLoader } from "react-spinners";
14
+ import styled from "styled-components";
15
+ import { Colors } from "../foundations";
16
+ const PageLoader = (_a) => {
17
+ var { color = Colors.accent.blue1, size = 32 } = _a, restOfProps = __rest(_a, ["color", "size"]);
18
+ return (_jsx(BasePageLoader, { children: _jsx(MoonLoader, Object.assign({ color: color, size: size }, restOfProps)) }));
19
+ };
20
+ export default PageLoader;
21
+ const BasePageLoader = styled.div `
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+
26
+ width: 100%;
27
+ height: 100%;
28
+ `;
@@ -3,5 +3,6 @@ export { default as BrandLogo } from "./BrandLogo";
3
3
  export { default as Button } from "./Button";
4
4
  export { default as Checkbox } from "./Checkbox";
5
5
  export { default as LinkButton } from "./LinkButton";
6
+ export { default as PageLoader } from "./PageLoader";
6
7
  export { default as RadioButton } from "./RadioButton";
7
8
  export { default as Textarea } from "./Textarea";
@@ -3,5 +3,6 @@ export { default as BrandLogo } from "./BrandLogo";
3
3
  export { default as Button } from "./Button";
4
4
  export { default as Checkbox } from "./Checkbox";
5
5
  export { default as LinkButton } from "./LinkButton";
6
+ export { default as PageLoader } from "./PageLoader";
6
7
  export { default as RadioButton } from "./RadioButton";
7
8
  export { default as Textarea } from "./Textarea";
@@ -107,10 +107,7 @@ export const useFileDrop = (initialFiles = [], maxFiles = DEFAULT_MAX_FILES, max
107
107
  errorMessage,
108
108
  };
109
109
  };
110
- const anyFileTooLarge = (files, maxSizeMB) => files.some((file) => {
111
- console.log("file size:", file.size);
112
- return file.size > convertMegabytesToBytes(maxSizeMB);
113
- });
110
+ const anyFileTooLarge = (files, maxSizeMB) => files.some((file) => file.size > convertMegabytesToBytes(maxSizeMB));
114
111
  const convertMegabytesToBytes = (megabytes) => megabytes * 1024 * 1024;
115
112
  const combineFilesWithoutDuplicates = (oldFiles, newFiles) => {
116
113
  const newFileNames = newFiles.map((file) => file.name);
@@ -1,8 +1,8 @@
1
1
  import { GrantMatchQuery } from "@grantbii/ui-base/match/models";
2
2
  type GrantMatchProps = GrantMatchQueryProps & {
3
- isModalFullScreen?: boolean;
3
+ isSmallerThanLaptop?: boolean;
4
4
  };
5
- declare const GrantMatch: ({ query, updateQuery, removeQueryFile, removeQueryText, resetQuery, isModalFullScreen, }: GrantMatchProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const GrantMatch: ({ query, updateQuery, removeQueryFile, removeQueryText, resetQuery, isSmallerThanLaptop, }: GrantMatchProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default GrantMatch;
7
7
  type GrantMatchQueryProps = {
8
8
  query: GrantMatchQuery;
@@ -5,14 +5,14 @@ import styled from "styled-components";
5
5
  import { Badge, Button, Textarea } from "../atoms";
6
6
  import { Colors, Icons } from "../foundations";
7
7
  import { FileDrop, Modal, useFileDrop, useModal } from "../molecules";
8
- const GrantMatch = ({ query, updateQuery, removeQueryFile, removeQueryText, resetQuery, isModalFullScreen, }) => {
8
+ const GrantMatch = ({ query, updateQuery, removeQueryFile, removeQueryText, resetQuery, isSmallerThanLaptop, }) => {
9
9
  const { showModal, openModal, closeModal } = useModal();
10
10
  const isActive = isGrantMatchActive(query);
11
11
  const updateActiveQuery = (newQuery) => {
12
12
  updateQuery(newQuery);
13
13
  closeModal();
14
14
  };
15
- return (_jsxs(BaseGrantMatch, { children: [_jsx(GrantMatchButtons, { isActive: isActive, onClickMatch: () => openModal(), onClickReset: () => resetQuery() }), isActive ? (_jsx(QueryItems, { activeQuery: query, removeQueryFile: removeQueryFile, removeQueryText: removeQueryText })) : (_jsx(_Fragment, {})), showModal ? (_jsx(GrantMatchModal, { activeQuery: query, updateActiveQuery: updateActiveQuery, onClickCancel: () => closeModal(), isFullScreen: isModalFullScreen })) : (_jsx(_Fragment, {}))] }));
15
+ return (_jsxs(BaseGrantMatch, { children: [_jsx(GrantMatchButtons, { isActive: isActive, onClickMatch: () => openModal(), onClickReset: () => resetQuery(), isSmallerThanLaptop: isSmallerThanLaptop }), isActive ? (_jsxs(QueryItemsRow, { children: [_jsx(QueryItems, { activeQuery: query, removeQueryFile: removeQueryFile, removeQueryText: removeQueryText }), isSmallerThanLaptop ? (_jsx(ResetButton, { onClick: () => resetQuery() })) : (_jsx(_Fragment, {}))] })) : (_jsx(_Fragment, {})), showModal ? (_jsx(GrantMatchModal, { activeQuery: query, updateActiveQuery: updateActiveQuery, onClickCancel: () => closeModal(), isFullScreen: isSmallerThanLaptop })) : (_jsx(_Fragment, {}))] }));
16
16
  };
17
17
  export default GrantMatch;
18
18
  export const useGrantMatchQueryItems = (performGrantMatch, resetGrantMatch) => {
@@ -67,34 +67,47 @@ const BaseGrantMatch = styled.div `
67
67
  flex-direction: column;
68
68
  gap: 8px;
69
69
 
70
- padding: 16px 16px 0px 16px;
71
-
72
70
  width: 100%;
73
71
  max-width: 100vw;
74
72
  `;
75
- const GrantMatchButtons = ({ isActive, onClickMatch, onClickReset, }) => (_jsxs(Buttons, { children: [_jsx(GrantMatchButton, { isActive: isActive, onClick: onClickMatch }), isActive ? (_jsx(Button, { text: "Reset", onClick: onClickReset, color: Colors.typography.blackMedium, underline: true })) : (_jsx(_Fragment, {}))] }));
73
+ const GrantMatchButtons = ({ isActive, onClickMatch, onClickReset, isSmallerThanLaptop, }) => (_jsxs(Buttons, { children: [_jsx(GrantMatchButton, { isActive: isActive, isSmallerThanLaptop: isSmallerThanLaptop, onClick: onClickMatch }), !isSmallerThanLaptop && isActive ? (_jsx(ResetButton, { onClick: onClickReset })) : (_jsx(_Fragment, {}))] }));
76
74
  const Buttons = styled.div `
77
75
  display: flex;
78
76
  align-items: center;
79
77
  gap: 8px;
80
78
  `;
81
- const GrantMatchButton = ({ isActive, onClick }) => (_jsxs(BaseGrantMatchButton, { type: "button", "$isActive": isActive, onClick: onClick, children: [_jsx(Icons.GrantMatchIcon, { size: 20 }), _jsx("p", { children: "Find grants that match your needs" }), _jsx(Icons.MagnifyingGlassIcon, { size: 20 })] }));
79
+ const GrantMatchButton = ({ isActive, onClick, isSmallerThanLaptop, }) => (_jsxs(BaseGrantMatchButton, { type: "button", "$isSmallerThanLaptop": isSmallerThanLaptop, "$isActive": isActive, onClick: onClick, children: [_jsxs(GrantMatchButtonContent, { children: [_jsx(Icons.GrantMatchIcon, { size: 20 }), _jsx("p", { children: "Find grants that match your needs" })] }), _jsx(Icons.MagnifyingGlassIcon, { size: 20 })] }));
82
80
  const BaseGrantMatchButton = styled.button `
83
81
  display: flex;
84
82
  align-items: center;
85
- gap: 8px;
83
+ justify-content: space-between;
84
+ gap: 16px;
86
85
 
87
- height: 20px;
88
86
  padding: 10px 16px;
89
- border-radius: 200px;
87
+
88
+ height: 20px;
89
+ width: ${({ $isSmallerThanLaptop = false }) => $isSmallerThanLaptop ? "100%" : "auto"};
90
90
 
91
91
  font-size: 14px;
92
92
  font-weight: 500;
93
93
 
94
- color: ${Colors.typography.blackMedium};
95
94
  background-color: ${Colors.base.white};
95
+ color: ${Colors.typography.blackMedium};
96
+
96
97
  border: 1px solid
97
98
  ${({ $isActive }) => $isActive ? Colors.accent.yellow1 : Colors.neutral.grey3};
99
+ border-radius: 200px;
100
+ `;
101
+ const GrantMatchButtonContent = styled.div `
102
+ display: flex;
103
+ align-items: center;
104
+ gap: 8px;
105
+ `;
106
+ const ResetButton = ({ onClick }) => (_jsx(Button, { text: "Reset", onClick: onClick, color: Colors.typography.blackMedium, underline: true }));
107
+ const QueryItemsRow = styled.div `
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: space-between;
98
111
  `;
99
112
  const QueryItems = ({ activeQuery, removeQueryFile, removeQueryText, }) => (_jsxs(BaseQueryItems, { children: [activeQuery.files.map((file) => {
100
113
  var _a;
@@ -105,6 +118,8 @@ const BaseQueryItems = styled.div `
105
118
  align-items: center;
106
119
  gap: 8px;
107
120
 
121
+ width: 100%;
122
+
108
123
  overflow-x: auto;
109
124
 
110
125
  /* hide scrollbar but still allow for scrolling */
@@ -113,6 +128,8 @@ const BaseQueryItems = styled.div `
113
128
  ::-webkit-scrollbar {
114
129
  display: none;
115
130
  }
131
+
132
+ /* TODO: fade effect on overflow-x */
116
133
  `;
117
134
  const FILE_TYPE_ICON_MAP = {
118
135
  "application/pdf": Icons.FilePdfIcon,
@@ -120,7 +137,7 @@ const FILE_TYPE_ICON_MAP = {
120
137
  const GrantMatchModal = ({ activeQuery, updateActiveQuery, onClickCancel, isFullScreen, }) => {
121
138
  const { files, uploadFiles, removeFile } = useFileDrop(activeQuery.files);
122
139
  const [text, setText] = useState(activeQuery.text);
123
- return (_jsx(Modal, { header: _jsx(Header, {}), content: _jsx(Content, { files: files, uploadFiles: uploadFiles, removeFile: removeFile, queryText: text, updateQueryText: (newText) => setText(newText) }), footer: _jsx(Button, { text: "Find My Grants", onClick: () => updateActiveQuery({ files, text }), backgroundColor: Colors.accent.yellow1 }), onClickCancel: onClickCancel, isFullScreen: isFullScreen }));
140
+ return (_jsx(Modal, { header: _jsx(Header, {}), content: _jsx(Content, { files: files, uploadFiles: uploadFiles, removeFile: removeFile, queryText: text, updateQueryText: (newText) => setText(newText) }), footer: _jsx(Button, { text: "Find My Grants", onClick: () => updateActiveQuery({ files, text }), backgroundColor: Colors.accent.yellow1 }), onClickCancel: onClickCancel, isFullScreen: isFullScreen, width: "480px" }));
124
141
  };
125
142
  const Header = () => (_jsxs(BaseHeader, { children: [_jsx(Icons.GrantMatchIcon, { size: 24 }), _jsx("div", { children: "Grant Match" })] }));
126
143
  const BaseHeader = styled.div `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -25,6 +25,7 @@
25
25
  "react": "^19.1.0",
26
26
  "react-dom": "^19.1.0",
27
27
  "react-dropzone": "^14.3.8",
28
+ "react-spinners": "^0.17.0",
28
29
  "styled-components": "^6.1.19"
29
30
  },
30
31
  "devDependencies": {
@@ -0,0 +1,6 @@
1
+ import { PageLoader } from "@/.";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
3
+ declare const meta: Meta<typeof PageLoader>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
@@ -0,0 +1,13 @@
1
+ import { PageLoader } from "@/.";
2
+ const meta = {
3
+ title: "Atoms/Page Loader",
4
+ component: PageLoader,
5
+ tags: ["autodocs"],
6
+ parameters: {
7
+ layout: "centered",
8
+ },
9
+ };
10
+ export default meta;
11
+ export const Default = {
12
+ args: {},
13
+ };
@@ -1,10 +1,10 @@
1
1
  import { Meta, StoryObj } from "@storybook/nextjs-vite";
2
2
  type GrantMatchExampleProps = {
3
- isModalFullScreen?: boolean;
3
+ isMobile?: boolean;
4
4
  };
5
- declare const GrantMatchExample: ({ isModalFullScreen }: GrantMatchExampleProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const GrantMatchExample: ({ isMobile }: GrantMatchExampleProps) => import("react/jsx-runtime").JSX.Element;
6
6
  declare const meta: Meta<typeof GrantMatchExample>;
7
7
  export default meta;
8
8
  type Story = StoryObj<typeof meta>;
9
- export declare const PopUp: Story;
10
- export declare const FullScreen: Story;
9
+ export declare const Desktop: Story;
10
+ export declare const Mobile: Story;
@@ -1,27 +1,31 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { GrantMatch } from "@/.";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Colors, GrantMatch } from "@/.";
3
3
  import { useGrantMatchQueryItems } from "@/core/organisms/GrantMatch";
4
4
  import { useState } from "react";
5
5
  import styled from "styled-components";
6
- const GrantMatchExample = ({ isModalFullScreen }) => {
7
- const [status, setStatus] = useState("Pending input");
6
+ const GrantMatchExample = ({ isMobile }) => {
7
+ const [status, setStatus] = useState("pending query");
8
8
  const performGrantMatch = (newQuery) => {
9
9
  const fileNames = newQuery.files.map((file) => file.name).join(", ");
10
- setStatus(`Finding grants using files [${fileNames}] and text [${newQuery.text}]`);
11
- setTimeout(() => setStatus("Found grants"), 3000);
10
+ setStatus(`finding grants using files [${fileNames}] and text [${newQuery.text}]`);
11
+ setTimeout(() => setStatus("found grants"), 3000);
12
12
  };
13
- const resetGrantMatch = () => setStatus("Pending input");
13
+ const resetGrantMatch = () => setStatus("pending query");
14
14
  const grantMatchQueryProps = useGrantMatchQueryItems(performGrantMatch, resetGrantMatch);
15
- return (_jsxs(Container, { children: [_jsxs(GrantMatchStatus, { children: ["Status: ", status] }), _jsx(GrantMatch, Object.assign({}, grantMatchQueryProps, { isModalFullScreen: isModalFullScreen }))] }));
15
+ return (_jsxs(Container, { "$isMobile": isMobile, children: [_jsx(GrantMatch, Object.assign({}, grantMatchQueryProps, { isSmallerThanLaptop: isMobile })), _jsxs("p", { children: ["Status: ", status] })] }));
16
16
  };
17
- const GrantMatchStatus = styled.p `
18
- margin: 0px 16px;
19
- `;
20
17
  const Container = styled.div `
21
18
  display: flex;
22
19
  flex-direction: column;
20
+ gap: 8px;
21
+
22
+ padding: 16px;
23
+
24
+ width: ${({ $isMobile = false }) => ($isMobile ? "360px" : "90vw")};
25
+ height: ${({ $isMobile = false }) => ($isMobile ? "600px" : "100vh")};
23
26
 
24
- width: 90vw;
27
+ border: ${({ $isMobile = false }) => $isMobile ? `1px solid ${Colors.neutral.grey2}` : "none"};
28
+ border-radius: 32px;
25
29
  `;
26
30
  const meta = {
27
31
  title: "Organisms/Grant Match",
@@ -32,9 +36,9 @@ const meta = {
32
36
  },
33
37
  };
34
38
  export default meta;
35
- export const PopUp = {
36
- args: {},
39
+ export const Desktop = {
40
+ args: { isMobile: false },
37
41
  };
38
- export const FullScreen = {
39
- args: { isModalFullScreen: true },
42
+ export const Mobile = {
43
+ args: { isMobile: true },
40
44
  };