@grantbii/design-system 1.3.0 → 1.4.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/core/assets/logos/load_fail_logo.webp +0 -0
- package/core/atoms/BrandLogo.js +2 -2
- package/core/atoms/BrandLogo.js.map +1 -1
- package/core/atoms/Button.d.ts +2 -1
- package/core/atoms/Button.js +1 -1
- package/core/atoms/Button.js.map +1 -1
- package/core/atoms/index.d.ts +0 -1
- package/core/atoms/index.js +0 -1
- package/core/atoms/index.js.map +1 -1
- package/core/atoms/shared.d.ts +5 -0
- package/core/atoms/shared.js +9 -2
- package/core/atoms/shared.js.map +1 -1
- package/core/molecules/FileDrop.js +7 -7
- package/core/molecules/FileDrop.js.map +1 -1
- package/core/organisms/GrantMatch/ActiveQueryFiles.js +1 -3
- package/core/organisms/GrantMatch/ActiveQueryFiles.js.map +1 -1
- package/core/organisms/GrantMatch/GrantMatchModal.js +4 -4
- package/core/organisms/GrantMatch/GrantMatchModal.js.map +1 -1
- package/core/templates/LoadingFailedSign.d.ts +6 -0
- package/core/templates/LoadingFailedSign.js +78 -0
- package/core/templates/LoadingFailedSign.js.map +1 -0
- package/core/templates/PageLoader.js.map +1 -0
- package/core/templates/index.d.ts +2 -0
- package/core/templates/index.js +3 -0
- package/core/templates/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/stories/atoms/Input.stories.js +2 -2
- package/stories/atoms/Input.stories.js.map +1 -1
- package/stories/templates/LoadingFailedSign.stories.d.ts +7 -0
- package/stories/templates/LoadingFailedSign.stories.js +19 -0
- package/stories/templates/LoadingFailedSign.stories.js.map +1 -0
- package/stories/{atoms → templates}/PageLoader.stories.js +1 -1
- package/stories/templates/PageLoader.stories.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/core/atoms/PageLoader.js.map +0 -1
- package/stories/atoms/PageLoader.stories.js.map +0 -1
- /package/core/{atoms → templates}/PageLoader.d.ts +0 -0
- /package/core/{atoms → templates}/PageLoader.js +0 -0
- /package/stories/{atoms → templates}/PageLoader.stories.d.ts +0 -0
|
Binary file
|
package/core/atoms/BrandLogo.js
CHANGED
|
@@ -4,9 +4,9 @@ import styled from "styled-components";
|
|
|
4
4
|
import darkLogo from "../assets/logos/brand_logo-dark.webp";
|
|
5
5
|
import lightLogo from "../assets/logos/brand_logo-light.webp";
|
|
6
6
|
import { Responsive } from "../foundations";
|
|
7
|
-
const BrandLogo = ({ isDarkTheme = true, alt = "Grantbii", }) => (_jsx(
|
|
7
|
+
const BrandLogo = ({ isDarkTheme = true, alt = "Grantbii", }) => (_jsx(BrandImage, { src: isDarkTheme ? darkLogo : lightLogo, width: 250, height: 80, alt: alt, priority: true }));
|
|
8
8
|
export default BrandLogo;
|
|
9
|
-
const
|
|
9
|
+
const BrandImage = styled(Image) `
|
|
10
10
|
@media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
11
11
|
width: 125px;
|
|
12
12
|
height: 40px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandLogo.js","sourceRoot":"","sources":["../../../core/atoms/BrandLogo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5C,MAAM,SAAS,GAAG,CAAC,EACjB,WAAW,GAAG,IAAI,EAClB,GAAG,GAAG,UAAU,GACD,EAAE,EAAE,CAAC,CACpB,KAAC,
|
|
1
|
+
{"version":3,"file":"BrandLogo.js","sourceRoot":"","sources":["../../../core/atoms/BrandLogo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5C,MAAM,SAAS,GAAG,CAAC,EACjB,WAAW,GAAG,IAAI,EAClB,GAAG,GAAG,UAAU,GACD,EAAE,EAAE,CAAC,CACpB,KAAC,UAAU,IACT,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACvC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,EAAE,EACV,GAAG,EAAE,GAAG,EACR,QAAQ,SACR,CACH,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;oBACZ,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;qBAKlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;CAIvD,CAAC","sourcesContent":["import Image from \"next/image\";\nimport styled from \"styled-components\";\nimport darkLogo from \"../assets/logos/brand_logo-dark.webp\";\nimport lightLogo from \"../assets/logos/brand_logo-light.webp\";\nimport { Responsive } from \"../foundations\";\n\ntype BrandLogoProps = {\n isDarkTheme?: boolean;\n alt?: string;\n};\n\nconst BrandLogo = ({\n isDarkTheme = true,\n alt = \"Grantbii\",\n}: BrandLogoProps) => (\n <BrandImage\n src={isDarkTheme ? darkLogo : lightLogo}\n width={250}\n height={80}\n alt={alt}\n priority\n />\n);\n\nexport default BrandLogo;\n\nconst BrandImage = styled(Image)`\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 125px;\n height: 40px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 150px;\n height: 48px;\n }\n`;\n"]}
|
package/core/atoms/Button.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ type ButtonProps = {
|
|
|
6
6
|
RightIcon?: ComponentType<Icons.IconProps>;
|
|
7
7
|
underline?: boolean;
|
|
8
8
|
backgroundColor?: string;
|
|
9
|
+
borderColor?: string;
|
|
9
10
|
color?: string;
|
|
10
11
|
width?: string;
|
|
11
12
|
} & DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
12
|
-
declare const Button: ({ text, LeftIcon, RightIcon, underline, backgroundColor, color, width, type, ...buttonProps }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const Button: ({ text, LeftIcon, RightIcon, underline, backgroundColor, borderColor, color, width, type, ...buttonProps }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default Button;
|
package/core/atoms/Button.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { Icons } from "../foundations";
|
|
4
4
|
import { BaseButton as ButtonContent } from "./shared";
|
|
5
|
-
const Button = ({ text, LeftIcon, RightIcon, underline, backgroundColor, color, width, type = "button", ...buttonProps }) => (_jsx(BaseButton, { ...buttonProps, type: type, "$width": width, children: _jsxs(ButtonContent, { "$underline": underline, "$backgroundColor": backgroundColor, "$color": color, "$width": width, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }) }));
|
|
5
|
+
const Button = ({ text, LeftIcon, RightIcon, underline, backgroundColor, borderColor, color, width, type = "button", ...buttonProps }) => (_jsx(BaseButton, { ...buttonProps, type: type, "$width": width, children: _jsxs(ButtonContent, { "$underline": underline, "$backgroundColor": backgroundColor, "$borderColor": borderColor, "$color": color, "$width": width, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }) }));
|
|
6
6
|
export default Button;
|
|
7
7
|
const BaseButton = styled.button `
|
|
8
8
|
width: ${({ $width = "auto" }) => $width};
|
package/core/atoms/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../core/atoms/Button.tsx"],"names":[],"mappings":";AAKA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../core/atoms/Button.tsx"],"names":[],"mappings":";AAKA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AAgBvD,MAAM,MAAM,GAAG,CAAC,EACd,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,eAAe,EACf,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,GAAG,WAAW,EACF,EAAE,EAAE,CAAC,CACjB,KAAC,UAAU,OAAK,WAAW,EAAE,IAAI,EAAE,IAAI,YAAU,KAAK,YACpD,MAAC,aAAa,kBACA,SAAS,sBACH,eAAe,kBACnB,WAAW,YACjB,KAAK,YACL,KAAK,aAEZ,QAAQ,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,mBAAK,EACxD,sBAAI,IAAI,GAAK,EACZ,SAAS,CAAC,CAAC,CAAC,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,mBAAK,IAC5C,GACL,CACd,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAqB;WAC1C,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;CACzC,CAAC","sourcesContent":["import type {\n ButtonHTMLAttributes,\n ComponentType,\n DetailedHTMLProps,\n} from \"react\";\nimport styled from \"styled-components\";\nimport { Icons } from \"../foundations\";\nimport { BaseButton as ButtonContent } from \"./shared\";\n\ntype ButtonProps = {\n text: string;\n LeftIcon?: ComponentType<Icons.IconProps>;\n RightIcon?: ComponentType<Icons.IconProps>;\n underline?: boolean;\n backgroundColor?: string;\n borderColor?: string;\n color?: string;\n width?: string;\n} & DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nconst Button = ({\n text,\n LeftIcon,\n RightIcon,\n underline,\n backgroundColor,\n borderColor,\n color,\n width,\n type = \"button\",\n ...buttonProps\n}: ButtonProps) => (\n <BaseButton {...buttonProps} type={type} $width={width}>\n <ButtonContent\n $underline={underline}\n $backgroundColor={backgroundColor}\n $borderColor={borderColor}\n $color={color}\n $width={width}\n >\n {LeftIcon ? <LeftIcon color={color} size={20} /> : <></>}\n <p>{text}</p>\n {RightIcon ? <RightIcon color={color} size={20} /> : <></>}\n </ButtonContent>\n </BaseButton>\n);\n\nexport default Button;\n\nconst BaseButton = styled.button<{ $width?: string }>`\n width: ${({ $width = \"auto\" }) => $width};\n`;\n"]}
|
package/core/atoms/index.d.ts
CHANGED
|
@@ -5,6 +5,5 @@ export { default as Checkbox } from "./Checkbox";
|
|
|
5
5
|
export { default as Dropdown, type DropdownProps } from "./Dropdown";
|
|
6
6
|
export { default as Input } from "./Input";
|
|
7
7
|
export { default as LinkButton } from "./LinkButton";
|
|
8
|
-
export { default as PageLoader } from "./PageLoader";
|
|
9
8
|
export { default as RadioButton } from "./RadioButton";
|
|
10
9
|
export { default as Textarea } from "./Textarea";
|
package/core/atoms/index.js
CHANGED
|
@@ -5,7 +5,6 @@ export { default as Checkbox } from "./Checkbox";
|
|
|
5
5
|
export { default as Dropdown } from "./Dropdown";
|
|
6
6
|
export { default as Input } from "./Input";
|
|
7
7
|
export { default as LinkButton } from "./LinkButton";
|
|
8
|
-
export { default as PageLoader } from "./PageLoader";
|
|
9
8
|
export { default as RadioButton } from "./RadioButton";
|
|
10
9
|
export { default as Textarea } from "./Textarea";
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/core/atoms/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/atoms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAmB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAsB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/atoms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAmB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAsB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default as Badge, type BadgeProps } from \"./Badge\";\nexport { default as BrandLogo } from \"./BrandLogo\";\nexport { default as Button } from \"./Button\";\nexport { default as Checkbox } from \"./Checkbox\";\nexport { default as Dropdown, type DropdownProps } from \"./Dropdown\";\nexport { default as Input } from \"./Input\";\nexport { default as LinkButton } from \"./LinkButton\";\nexport { default as RadioButton } from \"./RadioButton\";\nexport { default as Textarea } from \"./Textarea\";\n"]}
|
package/core/atoms/shared.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { Icons } from "../foundations";
|
|
1
2
|
export declare const BaseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
3
|
$underline?: boolean;
|
|
3
4
|
$backgroundColor?: string;
|
|
5
|
+
$borderColor?: string;
|
|
4
6
|
$color?: string;
|
|
5
7
|
$width?: string;
|
|
6
8
|
}>> & string;
|
|
7
9
|
export declare const LabelledInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
10
|
export declare const InputValidation: import("styled-components").RuleSet<object>;
|
|
11
|
+
export declare const FILE_TYPE_ICON_MAP: {
|
|
12
|
+
[mimeType: string]: Icons.Icon;
|
|
13
|
+
};
|
package/core/atoms/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import { Colors } from "../foundations";
|
|
2
|
+
import { Colors, Icons } from "../foundations";
|
|
3
3
|
export const BaseButton = styled.div `
|
|
4
4
|
display: flex;
|
|
5
5
|
justify-content: center;
|
|
@@ -9,7 +9,6 @@ export const BaseButton = styled.div `
|
|
|
9
9
|
width: ${({ $width = "auto" }) => $width};
|
|
10
10
|
|
|
11
11
|
padding: 10px 16px;
|
|
12
|
-
border-radius: 4px;
|
|
13
12
|
|
|
14
13
|
font-weight: 500;
|
|
15
14
|
font-size: 14px;
|
|
@@ -18,6 +17,9 @@ export const BaseButton = styled.div `
|
|
|
18
17
|
|
|
19
18
|
color: ${({ $color = Colors.typography.whiteHigh }) => $color};
|
|
20
19
|
background-color: ${({ $underline = false, $backgroundColor = Colors.main.grantbiiBlue, }) => ($underline ? "transparent" : $backgroundColor)};
|
|
20
|
+
|
|
21
|
+
border: 1px solid ${({ $borderColor = "transparent" }) => $borderColor};
|
|
22
|
+
border-radius: 4px;
|
|
21
23
|
`;
|
|
22
24
|
export const LabelledInput = styled.div `
|
|
23
25
|
display: flex;
|
|
@@ -55,4 +57,9 @@ export const InputValidation = css `
|
|
|
55
57
|
outline: 1px solid ${Colors.accent.red1};
|
|
56
58
|
}
|
|
57
59
|
`;
|
|
60
|
+
export const FILE_TYPE_ICON_MAP = {
|
|
61
|
+
"application/pdf": Icons.FilePdfIcon,
|
|
62
|
+
"image/png": Icons.FilePngIcon,
|
|
63
|
+
"image/jpeg": Icons.FileJpgIcon,
|
|
64
|
+
};
|
|
58
65
|
//# sourceMappingURL=shared.js.map
|
package/core/atoms/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../core/atoms/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,C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BAIpB,MAAM,CAAC,IAAI,CAAC,KAAK;wBACjB,MAAM,CAAC,MAAM,CAAC,IAAI;;;;;wBAKlB,MAAM,CAAC,IAAI,CAAC,KAAK;wBACjB,MAAM,CAAC,MAAM,CAAC,IAAI;yBACjB,MAAM,CAAC,MAAM,CAAC,IAAI;;CAE1C,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,iBAAiB,EAAE,KAAK,CAAC,WAAW;IACpC,WAAW,EAAE,KAAK,CAAC,WAAW;IAC9B,YAAY,EAAE,KAAK,CAAC,WAAW;CAChC,CAAC","sourcesContent":["import styled, { css } from \"styled-components\";\nimport { Colors, Icons } from \"../foundations\";\n\nexport const BaseButton = styled.div<{\n $underline?: boolean;\n $backgroundColor?: string;\n $borderColor?: string;\n $color?: string;\n $width?: string;\n}>`\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 10px;\n\n width: ${({ $width = \"auto\" }) => $width};\n\n padding: 10px 16px;\n\n font-weight: 500;\n font-size: 14px;\n\n text-decoration: ${({ $underline = false }) =>\n $underline ? \"underline\" : \"none\"};\n\n color: ${({ $color = Colors.typography.whiteHigh }) => $color};\n background-color: ${({\n $underline = false,\n $backgroundColor = Colors.main.grantbiiBlue,\n }) => ($underline ? \"transparent\" : $backgroundColor)};\n\n border: 1px solid ${({ $borderColor = \"transparent\" }) => $borderColor};\n border-radius: 4px;\n`;\n\nexport const LabelledInput = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nexport const InputValidation = css`\n &:disabled {\n background-color: ${Colors.neutral.grey4};\n border: 1px solid ${Colors.neutral.grey3};\n outline: none;\n }\n\n &:valid {\n background-color: ${Colors.base.white};\n border: 1px solid ${Colors.neutral.grey3};\n outline: none;\n }\n\n &:valid&:focus {\n background-color: ${Colors.base.white};\n border: 1px solid ${Colors.accent.blue1};\n outline: 1px solid ${Colors.accent.blue1};\n }\n\n &:invalid {\n background-color: ${Colors.base.white};\n border: 1px solid ${Colors.accent.red1};\n outline: none;\n }\n\n &:invalid&:focus {\n background-color: ${Colors.base.white};\n border: 1px solid ${Colors.accent.red1};\n outline: 1px solid ${Colors.accent.red1};\n }\n`;\n\nexport const FILE_TYPE_ICON_MAP: { [mimeType: string]: Icons.Icon } = {\n \"application/pdf\": Icons.FilePdfIcon,\n \"image/png\": Icons.FilePngIcon,\n \"image/jpeg\": Icons.FileJpgIcon,\n};\n"]}
|
|
@@ -4,13 +4,18 @@ import { useDropzone } from "react-dropzone";
|
|
|
4
4
|
import styled from "styled-components";
|
|
5
5
|
import { Badge } from "../atoms";
|
|
6
6
|
import { Colors, Icons, Responsive, Typography } from "../foundations";
|
|
7
|
+
import { FILE_TYPE_ICON_MAP } from "../atoms/shared";
|
|
7
8
|
const DEFAULT_MAX_FILE_SIZE_MB = 5;
|
|
8
9
|
const DEFAULT_MAX_FILES = 5;
|
|
9
10
|
const FileDrop = ({ uploadedFiles, uploadFiles, removeFile, errorMessage, maxFiles = DEFAULT_MAX_FILES, maxSizeMB = DEFAULT_MAX_FILE_SIZE_MB, }) => {
|
|
10
11
|
const reachedMaxUploads = uploadedFiles.length >= maxFiles;
|
|
11
12
|
const { getInputProps, getRootProps } = useDropzone({
|
|
12
13
|
onDrop: uploadFiles,
|
|
13
|
-
accept: {
|
|
14
|
+
accept: {
|
|
15
|
+
"application/pdf": [".pdf"],
|
|
16
|
+
"image/png": [".png"],
|
|
17
|
+
"image/jpeg": ["jpeg", ".jpg"],
|
|
18
|
+
},
|
|
14
19
|
disabled: reachedMaxUploads,
|
|
15
20
|
noClick: reachedMaxUploads,
|
|
16
21
|
noDrag: reachedMaxUploads,
|
|
@@ -35,9 +40,7 @@ const Dropzone = styled.div `
|
|
|
35
40
|
cursor: ${({ $reachedMaxUploads }) => $reachedMaxUploads ? "not-allowed" : "pointer"};
|
|
36
41
|
}
|
|
37
42
|
`;
|
|
38
|
-
const DropzoneContent = ({ maxFiles, maxSizeMB }) => (_jsxs(BaseDropzoneContent, { children: [_jsx(Icons.FileDashedIcon, { weight: "thin", size: 48, color: Colors.neutral.grey1 }), _jsxs(AllDropzoneText, { children: [_jsx(DropzoneText, { children: `Drop up to ${maxFiles} files here (${maxSizeMB}MB each)` }), _jsx(DropzoneSubtitle, { "$isHighlighted": true, children:
|
|
39
|
-
const DROPZONE_BROWSE_TEXT = "or click to browse with your file explorer";
|
|
40
|
-
const FILE_FORMAT_TEXT = "Accepted file formats: .pdf (more coming soon)";
|
|
43
|
+
const DropzoneContent = ({ maxFiles, maxSizeMB }) => (_jsxs(BaseDropzoneContent, { children: [_jsx(Icons.FileDashedIcon, { weight: "thin", size: 48, color: Colors.neutral.grey1 }), _jsxs(AllDropzoneText, { children: [_jsx(DropzoneText, { children: `Drop up to ${maxFiles} files here (up to ${maxSizeMB}MB each)` }), _jsx(DropzoneSubtitle, { "$isHighlighted": true, children: "or click to browse with your file explorer" }), _jsx(DropzoneSubtitle, { children: "Accepted file formats: pdf, png, jpg" })] })] }));
|
|
41
44
|
const BaseDropzoneContent = styled.div `
|
|
42
45
|
display: flex;
|
|
43
46
|
flex-direction: column;
|
|
@@ -86,9 +89,6 @@ const BaseUploadedFiles = styled.div `
|
|
|
86
89
|
flex-direction: column;
|
|
87
90
|
gap: 4px;
|
|
88
91
|
`;
|
|
89
|
-
const FILE_TYPE_ICON_MAP = {
|
|
90
|
-
"application/pdf": Icons.FilePdfIcon,
|
|
91
|
-
};
|
|
92
92
|
export const useFileDrop = (initialFiles = [], maxFiles = DEFAULT_MAX_FILES, maxSizeMB = DEFAULT_MAX_FILE_SIZE_MB) => {
|
|
93
93
|
const [files, setFiles] = useState(() => initialFiles);
|
|
94
94
|
const [errorMessage, setErrorMessage] = useState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDrop.js","sourceRoot":"","sources":["../../../core/molecules/FileDrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,M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,GAAG,CAAC,SAAiB,EAAU,EAAE,CAC5D,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1B,MAAM,6BAA6B,GAAG,CACpC,QAAgB,EAChB,QAAgB,EACR,EAAE;IACV,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAClC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAClD,CAAC;IAEF,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,QAAQ,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAU,EAAE,CACpE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AAEjD,MAAM,2BAA2B,GAAG,CAAC,QAAgB,EAAU,EAAE,CAC/D,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["import { useState } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport styled from \"styled-components\";\nimport { Badge } from \"../atoms\";\nimport { Colors, Icons, Responsive, Typography } from \"../foundations\";\n\nconst DEFAULT_MAX_FILE_SIZE_MB = 5;\nconst DEFAULT_MAX_FILES = 5;\n\ntype FileDropzoneProps = {\n uploadedFiles: File[];\n uploadFiles: (acceptedFiles: File[]) => void;\n removeFile: (fileName: string) => void;\n errorMessage?: string;\n maxFiles?: number;\n maxSizeMB?: number;\n};\n\nconst FileDrop = ({\n uploadedFiles,\n uploadFiles,\n removeFile,\n errorMessage,\n maxFiles = DEFAULT_MAX_FILES,\n maxSizeMB = DEFAULT_MAX_FILE_SIZE_MB,\n}: FileDropzoneProps) => {\n const reachedMaxUploads = uploadedFiles.length >= maxFiles;\n\n const { getInputProps, getRootProps } = useDropzone({\n onDrop: uploadFiles,\n accept: { \"application/pdf\": [\".pdf\"] },\n disabled: reachedMaxUploads,\n noClick: reachedMaxUploads,\n noDrag: reachedMaxUploads,\n multiple: true,\n });\n\n return (\n <BaseFileDrop>\n <Dropzone\n {...getRootProps()}\n $reachedMaxUploads={reachedMaxUploads}\n $hasError={!!errorMessage}\n >\n <input {...getInputProps()} type=\"file\" />\n <DropzoneContent maxFiles={maxFiles} maxSizeMB={maxSizeMB} />\n </Dropzone>\n\n {errorMessage ? <ErrorMessage>{errorMessage}</ErrorMessage> : <></>}\n\n <UploadedFiles uploadedFiles={uploadedFiles} removeFile={removeFile} />\n </BaseFileDrop>\n );\n};\n\nexport default FileDrop;\n\nconst BaseFileDrop = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 6px;\n`;\n\nconst Dropzone = styled.div<{\n $reachedMaxUploads: boolean;\n $hasError: boolean;\n}>`\n padding: 40px;\n border-radius: 6px;\n border: 1px solid\n ${({ $hasError }) =>\n $hasError ? Colors.accent.red1 : Colors.neutral.grey3};\n\n &:hover {\n cursor: ${({ $reachedMaxUploads }) =>\n $reachedMaxUploads ? \"not-allowed\" : \"pointer\"};\n }\n`;\n\ntype DropzoneContentProps = {\n maxFiles: number;\n maxSizeMB: number;\n};\n\nconst DropzoneContent = ({ maxFiles, maxSizeMB }: DropzoneContentProps) => (\n <BaseDropzoneContent>\n <Icons.FileDashedIcon\n weight=\"thin\"\n size={48}\n color={Colors.neutral.grey1}\n />\n <AllDropzoneText>\n <DropzoneText>\n {`Drop up to ${maxFiles} files here (${maxSizeMB}MB each)`}\n </DropzoneText>\n\n <DropzoneSubtitle $isHighlighted>{DROPZONE_BROWSE_TEXT}</DropzoneSubtitle>\n <DropzoneSubtitle>{FILE_FORMAT_TEXT}</DropzoneSubtitle>\n </AllDropzoneText>\n </BaseDropzoneContent>\n);\n\nconst DROPZONE_BROWSE_TEXT = \"or click to browse with your file explorer\";\nconst FILE_FORMAT_TEXT = \"Accepted file formats: .pdf (more coming soon)\";\n\nconst BaseDropzoneContent = styled.div`\n display: flex;\n flex-direction: column;\n gap: 24px;\n align-items: center;\n`;\n\nconst AllDropzoneText = styled.div`\n display: flex;\n flex-direction: column;\n gap: 4px;\n`;\n\nconst DropzoneText = styled.p`\n text-align: center;\n\n font-weight: 500;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.BODY_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.BODY_FONT_SIZES.big};\n }\n`;\n\nconst DropzoneSubtitle = styled.p<{ $isHighlighted?: boolean }>`\n text-align: center;\n\n font-weight: 400;\n\n color: ${({ $isHighlighted = false }) =>\n $isHighlighted ? Colors.accent.yellow1 : Colors.typography.blackLow};\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.HELPER_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.HELPER_FONT_SIZES.big};\n }\n`;\n\nconst ErrorMessage = styled.p`\n color: ${Colors.accent.red1};\n`;\n\ntype UploadedFilesProps = {\n uploadedFiles: File[];\n removeFile: (fileName: string) => void;\n};\n\nconst UploadedFiles = ({ uploadedFiles, removeFile }: UploadedFilesProps) => (\n <BaseUploadedFiles>\n {uploadedFiles.map(({ name: fileName, type: fileType }) => (\n <Badge\n key={fileName}\n text={getFileNameWithoutExtension(fileName)}\n onClickClose={() => removeFile(fileName)}\n Icon={FILE_TYPE_ICON_MAP[fileType] ?? Icons.FileIcon}\n />\n ))}\n </BaseUploadedFiles>\n);\n\nconst BaseUploadedFiles = styled.div`\n display: flex;\n flex-direction: column;\n gap: 4px;\n`;\n\nconst FILE_TYPE_ICON_MAP: { [itemType: string]: Icons.Icon } = {\n \"application/pdf\": Icons.FilePdfIcon,\n};\n\nexport const useFileDrop = (\n initialFiles: File[] = [],\n maxFiles: number = DEFAULT_MAX_FILES,\n maxSizeMB: number = DEFAULT_MAX_FILE_SIZE_MB,\n) => {\n const [files, setFiles] = useState<File[]>(() => initialFiles);\n const [errorMessage, setErrorMessage] = useState<string | undefined>();\n\n const uploadFiles = (acceptedFiles: File[]) => {\n if (files.length + acceptedFiles.length > maxFiles) {\n setErrorMessage(() => `Maximum upload limit is ${maxFiles} files`);\n } else if (anyFileTooLarge(acceptedFiles, maxSizeMB)) {\n setErrorMessage(() => `Maximum file size is ${maxSizeMB}MB`);\n } else {\n setErrorMessage(() => undefined);\n setFiles((previousFiles) =>\n combineFilesWithoutDuplicates(previousFiles, acceptedFiles),\n );\n }\n };\n\n const removeFile = (fileName: string) => {\n setErrorMessage(() => undefined);\n setFiles((previousFiles) => filterFilesByName(previousFiles, fileName));\n };\n\n return {\n files,\n uploadFiles,\n removeFile,\n errorMessage,\n };\n};\n\nconst anyFileTooLarge = (files: File[], maxSizeMB: number): boolean =>\n files.some((file) => file.size > convertMegabytesToBytes(maxSizeMB));\n\nconst convertMegabytesToBytes = (megabytes: number): number =>\n megabytes * 1024 * 1024;\n\nconst combineFilesWithoutDuplicates = (\n oldFiles: File[],\n newFiles: File[],\n): File[] => {\n const newFileNames = newFiles.map((file) => file.name);\n const keptOldFiles = oldFiles.filter(\n (oldFile) => !newFileNames.includes(oldFile.name),\n );\n\n return [...keptOldFiles, ...newFiles];\n};\n\nconst filterFilesByName = (files: File[], fileName: string): File[] =>\n files.filter((file) => file.name !== fileName);\n\nconst getFileNameWithoutExtension = (fileName: string): string =>\n fileName.substring(0, fileName.lastIndexOf(\".\"));\n"]}
|
|
1
|
+
{"version":3,"file":"FileDrop.js","sourceRoot":"","sources":["../../../core/molecules/FileDrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EA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AS,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1B,MAAM,6BAA6B,GAAG,CACpC,QAAgB,EAChB,QAAgB,EACR,EAAE;IACV,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAClC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAClD,CAAC;IAEF,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,QAAQ,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAU,EAAE,CACpE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AAEjD,MAAM,2BAA2B,GAAG,CAAC,QAAgB,EAAU,EAAE,CAC/D,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["import { useState } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport styled from \"styled-components\";\nimport { Badge } from \"../atoms\";\nimport { Colors, Icons, Responsive, Typography } from \"../foundations\";\nimport { FILE_TYPE_ICON_MAP } from \"../atoms/shared\";\n\nconst DEFAULT_MAX_FILE_SIZE_MB = 5;\nconst DEFAULT_MAX_FILES = 5;\n\ntype FileDropzoneProps = {\n uploadedFiles: File[];\n uploadFiles: (acceptedFiles: File[]) => void;\n removeFile: (fileName: string) => void;\n errorMessage?: string;\n maxFiles?: number;\n maxSizeMB?: number;\n};\n\nconst FileDrop = ({\n uploadedFiles,\n uploadFiles,\n removeFile,\n errorMessage,\n maxFiles = DEFAULT_MAX_FILES,\n maxSizeMB = DEFAULT_MAX_FILE_SIZE_MB,\n}: FileDropzoneProps) => {\n const reachedMaxUploads = uploadedFiles.length >= maxFiles;\n\n const { getInputProps, getRootProps } = useDropzone({\n onDrop: uploadFiles,\n accept: {\n \"application/pdf\": [\".pdf\"],\n \"image/png\": [\".png\"],\n \"image/jpeg\": [\"jpeg\", \".jpg\"],\n },\n disabled: reachedMaxUploads,\n noClick: reachedMaxUploads,\n noDrag: reachedMaxUploads,\n multiple: true,\n });\n\n return (\n <BaseFileDrop>\n <Dropzone\n {...getRootProps()}\n $reachedMaxUploads={reachedMaxUploads}\n $hasError={!!errorMessage}\n >\n <input {...getInputProps()} type=\"file\" />\n <DropzoneContent maxFiles={maxFiles} maxSizeMB={maxSizeMB} />\n </Dropzone>\n\n {errorMessage ? <ErrorMessage>{errorMessage}</ErrorMessage> : <></>}\n\n <UploadedFiles uploadedFiles={uploadedFiles} removeFile={removeFile} />\n </BaseFileDrop>\n );\n};\n\nexport default FileDrop;\n\nconst BaseFileDrop = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 6px;\n`;\n\nconst Dropzone = styled.div<{\n $reachedMaxUploads: boolean;\n $hasError: boolean;\n}>`\n padding: 40px;\n border-radius: 6px;\n border: 1px solid\n ${({ $hasError }) =>\n $hasError ? Colors.accent.red1 : Colors.neutral.grey3};\n\n &:hover {\n cursor: ${({ $reachedMaxUploads }) =>\n $reachedMaxUploads ? \"not-allowed\" : \"pointer\"};\n }\n`;\n\ntype DropzoneContentProps = {\n maxFiles: number;\n maxSizeMB: number;\n};\n\nconst DropzoneContent = ({ maxFiles, maxSizeMB }: DropzoneContentProps) => (\n <BaseDropzoneContent>\n <Icons.FileDashedIcon\n weight=\"thin\"\n size={48}\n color={Colors.neutral.grey1}\n />\n <AllDropzoneText>\n <DropzoneText>\n {`Drop up to ${maxFiles} files here (up to ${maxSizeMB}MB each)`}\n </DropzoneText>\n\n <DropzoneSubtitle $isHighlighted>\n or click to browse with your file explorer\n </DropzoneSubtitle>\n\n <DropzoneSubtitle>Accepted file formats: pdf, png, jpg</DropzoneSubtitle>\n </AllDropzoneText>\n </BaseDropzoneContent>\n);\n\nconst BaseDropzoneContent = styled.div`\n display: flex;\n flex-direction: column;\n gap: 24px;\n align-items: center;\n`;\n\nconst AllDropzoneText = styled.div`\n display: flex;\n flex-direction: column;\n gap: 4px;\n`;\n\nconst DropzoneText = styled.p`\n text-align: center;\n\n font-weight: 500;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.BODY_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.BODY_FONT_SIZES.big};\n }\n`;\n\nconst DropzoneSubtitle = styled.p<{ $isHighlighted?: boolean }>`\n text-align: center;\n\n font-weight: 400;\n\n color: ${({ $isHighlighted = false }) =>\n $isHighlighted ? Colors.accent.yellow1 : Colors.typography.blackLow};\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.HELPER_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.HELPER_FONT_SIZES.big};\n }\n`;\n\nconst ErrorMessage = styled.p`\n color: ${Colors.accent.red1};\n`;\n\ntype UploadedFilesProps = {\n uploadedFiles: File[];\n removeFile: (fileName: string) => void;\n};\n\nconst UploadedFiles = ({ uploadedFiles, removeFile }: UploadedFilesProps) => (\n <BaseUploadedFiles>\n {uploadedFiles.map(({ name: fileName, type: fileType }) => (\n <Badge\n key={fileName}\n text={getFileNameWithoutExtension(fileName)}\n onClickClose={() => removeFile(fileName)}\n Icon={FILE_TYPE_ICON_MAP[fileType] ?? Icons.FileIcon}\n />\n ))}\n </BaseUploadedFiles>\n);\n\nconst BaseUploadedFiles = styled.div`\n display: flex;\n flex-direction: column;\n gap: 4px;\n`;\n\nexport const useFileDrop = (\n initialFiles: File[] = [],\n maxFiles: number = DEFAULT_MAX_FILES,\n maxSizeMB: number = DEFAULT_MAX_FILE_SIZE_MB,\n) => {\n const [files, setFiles] = useState<File[]>(() => initialFiles);\n const [errorMessage, setErrorMessage] = useState<string | undefined>();\n\n const uploadFiles = (acceptedFiles: File[]) => {\n if (files.length + acceptedFiles.length > maxFiles) {\n setErrorMessage(() => `Maximum upload limit is ${maxFiles} files`);\n } else if (anyFileTooLarge(acceptedFiles, maxSizeMB)) {\n setErrorMessage(() => `Maximum file size is ${maxSizeMB}MB`);\n } else {\n setErrorMessage(() => undefined);\n setFiles((previousFiles) =>\n combineFilesWithoutDuplicates(previousFiles, acceptedFiles),\n );\n }\n };\n\n const removeFile = (fileName: string) => {\n setErrorMessage(() => undefined);\n setFiles((previousFiles) => filterFilesByName(previousFiles, fileName));\n };\n\n return {\n files,\n uploadFiles,\n removeFile,\n errorMessage,\n };\n};\n\nconst anyFileTooLarge = (files: File[], maxSizeMB: number): boolean =>\n files.some((file) => file.size > convertMegabytesToBytes(maxSizeMB));\n\nconst convertMegabytesToBytes = (megabytes: number): number =>\n megabytes * 1024 * 1024;\n\nconst combineFilesWithoutDuplicates = (\n oldFiles: File[],\n newFiles: File[],\n): File[] => {\n const newFileNames = newFiles.map((file) => file.name);\n const keptOldFiles = oldFiles.filter(\n (oldFile) => !newFileNames.includes(oldFile.name),\n );\n\n return [...keptOldFiles, ...newFiles];\n};\n\nconst filterFilesByName = (files: File[], fileName: string): File[] =>\n files.filter((file) => file.name !== fileName);\n\nconst getFileNameWithoutExtension = (fileName: string): string =>\n fileName.substring(0, fileName.lastIndexOf(\".\"));\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { Badge, Button } from "../../atoms";
|
|
4
|
+
import { FILE_TYPE_ICON_MAP } from "../../atoms/shared";
|
|
4
5
|
import { Colors, Icons } from "../../foundations";
|
|
5
6
|
import { useGrantMatchContext } from "./context";
|
|
6
7
|
const ActiveQueryFiles = () => (_jsxs(BaseActiveFiles, { children: [_jsx(FileBadges, {}), _jsx(ResetFilesButton, {})] }));
|
|
@@ -39,9 +40,6 @@ const BaseFileBadges = styled.div `
|
|
|
39
40
|
|
|
40
41
|
/* TODO: fade effect on overflow-x */
|
|
41
42
|
`;
|
|
42
|
-
const FILE_TYPE_ICON_MAP = {
|
|
43
|
-
"application/pdf": Icons.FilePdfIcon,
|
|
44
|
-
};
|
|
45
43
|
const ResetFilesButton = () => {
|
|
46
44
|
const { activeQuery, updateActiveQuery } = useGrantMatchContext();
|
|
47
45
|
return (_jsx(Button, { text: "Reset", onClick: () => updateActiveQuery({ files: [], text: activeQuery.text }), color: Colors.typography.blackMedium, underline: true }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveQueryFiles.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/ActiveQueryFiles.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ActiveQueryFiles.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/ActiveQueryFiles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAC7B,MAAC,eAAe,eACd,KAAC,UAAU,KAAG,EACd,KAAC,gBAAgB,KAAG,IACJ,CACnB,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAEhC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIjC,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,MAAM,EAAE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AK,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,EACpC,SAAS,SACT,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import styled from \"styled-components\";\nimport { Badge, Button } from \"../../atoms\";\nimport { FILE_TYPE_ICON_MAP } from \"../../atoms/shared\";\nimport { Colors, Icons } from \"../../foundations\";\nimport { useGrantMatchContext } from \"./context\";\n\nconst ActiveQueryFiles = () => (\n <BaseActiveFiles>\n <FileBadges />\n <ResetFilesButton />\n </BaseActiveFiles>\n);\n\nexport default ActiveQueryFiles;\n\nconst BaseActiveFiles = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\n\nconst FileBadges = () => {\n const { activeQuery, updateActiveQuery } = useGrantMatchContext();\n\n const removeActiveQueryFile = (fileName: string) => {\n const newQuery = {\n files: activeQuery.files.filter((file) => file.name !== fileName),\n text: activeQuery.text,\n };\n\n updateActiveQuery(newQuery);\n };\n\n return (\n <BaseFileBadges>\n {activeQuery.files.map((file) => (\n <Badge\n key={file.name}\n text={file.name.substring(0, file.name.lastIndexOf(\".\"))}\n Icon={FILE_TYPE_ICON_MAP[file.type] ?? Icons.FileIcon}\n onClickClose={() => removeActiveQueryFile(file.name)}\n textWidthPixels={160}\n />\n ))}\n </BaseFileBadges>\n );\n};\n\nconst BaseFileBadges = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n\n width: 100%;\n\n overflow-x: auto;\n\n /* hide scrollbar but still allow for scrolling */\n -ms-overflow-style: none;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n\n /* TODO: fade effect on overflow-x */\n`;\n\nconst ResetFilesButton = () => {\n const { activeQuery, updateActiveQuery } = useGrantMatchContext();\n\n return (\n <Button\n text=\"Reset\"\n onClick={() => updateActiveQuery({ files: [], text: activeQuery.text })}\n color={Colors.typography.blackMedium}\n underline\n />\n );\n};\n"]}
|
|
@@ -6,13 +6,13 @@ import { FileDrop, Modal, useFileDrop } from "../../molecules";
|
|
|
6
6
|
import { useGrantMatchContext } from "./context";
|
|
7
7
|
const GrantMatchModal = () => {
|
|
8
8
|
const { activeQuery, closeModal } = useGrantMatchContext();
|
|
9
|
-
const { files, uploadFiles, removeFile } = useFileDrop(activeQuery.files);
|
|
10
|
-
return (_jsx(Modal, { header: _jsx("div", { children: "Grant Match" }), content: _jsx(ModalContent, { files: files, uploadFiles: uploadFiles, removeFile: removeFile }), footer: _jsx(FindGrantsButton, { files: files }), onClickCancel: () => closeModal(), width: "480px", height: "600px" }));
|
|
9
|
+
const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(activeQuery.files);
|
|
10
|
+
return (_jsx(Modal, { header: _jsx("div", { children: "Grant Match" }), content: _jsx(ModalContent, { files: files, uploadFiles: uploadFiles, removeFile: removeFile, errorMessage: errorMessage }), footer: _jsx(FindGrantsButton, { files: files }), onClickCancel: () => closeModal(), width: "480px", height: "600px" }));
|
|
11
11
|
};
|
|
12
12
|
export default GrantMatchModal;
|
|
13
|
-
const ModalContent = ({ files, uploadFiles, removeFile, }) => {
|
|
13
|
+
const ModalContent = ({ files, uploadFiles, removeFile, errorMessage, }) => {
|
|
14
14
|
const { queryText, updateQueryText } = useGrantMatchContext();
|
|
15
|
-
return (_jsxs(BaseContent, { children: [_jsx(FileDrop, { uploadedFiles: files, uploadFiles: uploadFiles, removeFile: removeFile }), _jsxs(ModalQueryText, { children: [_jsx("label", { htmlFor: QUERY_TEXTAREA_ID, children: "Search Grants Opportunities" }), _jsx(Textarea, { id: QUERY_TEXTAREA_ID, value: queryText, onChange: (event) => updateQueryText(event.target.value), placeholder: "Explore by grant name or share what your project is about..." })] })] }));
|
|
15
|
+
return (_jsxs(BaseContent, { children: [_jsx(FileDrop, { uploadedFiles: files, uploadFiles: uploadFiles, removeFile: removeFile, errorMessage: errorMessage }), _jsxs(ModalQueryText, { children: [_jsx("label", { htmlFor: QUERY_TEXTAREA_ID, children: "Search Grants Opportunities" }), _jsx(Textarea, { id: QUERY_TEXTAREA_ID, value: queryText, onChange: (event) => updateQueryText(event.target.value), placeholder: "Explore by grant name or share what your project is about..." })] })] }));
|
|
16
16
|
};
|
|
17
17
|
const QUERY_TEXTAREA_ID = "query-textarea";
|
|
18
18
|
const BaseContent = styled.div `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrantMatchModal.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/GrantMatchModal.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC3D,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"GrantMatchModal.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/GrantMatchModal.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC3D,MAAM,EAAE,K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c,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAC;AAMF,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,EAAyB,EAAE,EAAE;IAC5D,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAE5E,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAC9C,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,GACtC,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import styled from \"styled-components\";\nimport { Button, Textarea } from \"../../atoms\";\nimport { Colors } from \"../../foundations\";\nimport { FileDrop, Modal, useFileDrop } from \"../../molecules\";\nimport { useGrantMatchContext } from \"./context\";\n\nconst GrantMatchModal = () => {\n const { activeQuery, closeModal } = useGrantMatchContext();\n const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(\n activeQuery.files,\n );\n\n return (\n <Modal\n header={<div>Grant Match</div>}\n content={\n <ModalContent\n files={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n }\n footer={<FindGrantsButton files={files} />}\n onClickCancel={() => closeModal()}\n width=\"480px\"\n height=\"600px\"\n />\n );\n};\n\nexport default GrantMatchModal;\n\ntype ModalContentProps = {\n files: File[];\n uploadFiles: (acceptedFiles: File[]) => void;\n removeFile: (fileName: string) => void;\n errorMessage?: string;\n};\n\nconst ModalContent = ({\n files,\n uploadFiles,\n removeFile,\n errorMessage,\n}: ModalContentProps) => {\n const { queryText, updateQueryText } = useGrantMatchContext();\n\n return (\n <BaseContent>\n <FileDrop\n uploadedFiles={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n\n <ModalQueryText>\n <label htmlFor={QUERY_TEXTAREA_ID}>Search Grants Opportunities</label>\n <Textarea\n id={QUERY_TEXTAREA_ID}\n value={queryText}\n onChange={(event) => updateQueryText(event.target.value)}\n placeholder=\"Explore by grant name or share what your project is about...\"\n />\n </ModalQueryText>\n </BaseContent>\n );\n};\n\nconst QUERY_TEXTAREA_ID = \"query-textarea\";\n\nconst BaseContent = styled.div`\n display: flex;\n flex-direction: column;\n gap: 12px;\n`;\n\nconst ModalQueryText = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\ntype FindGrantsButtonProps = {\n files: File[];\n};\n\nconst FindGrantsButton = ({ files }: FindGrantsButtonProps) => {\n const { updateActiveQuery, queryText, closeModal } = useGrantMatchContext();\n\n const onClick = () => {\n updateActiveQuery({ files, text: queryText });\n closeModal();\n };\n\n return (\n <Button\n text=\"Find My Grants\"\n onClick={onClick}\n backgroundColor={Colors.accent.yellow1}\n />\n );\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MouseEventHandler } from "react";
|
|
2
|
+
type LoadingFailedSignProps = {
|
|
3
|
+
onClickReload?: MouseEventHandler<HTMLButtonElement>;
|
|
4
|
+
};
|
|
5
|
+
declare const LoadingFailedSign: ({ onClickReload }: LoadingFailedSignProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default LoadingFailedSign;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import loadFailLogo from "../assets/logos/load_fail_logo.webp";
|
|
5
|
+
import { Colors, Responsive, Typography } from "../foundations";
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
import { Button } from "../atoms";
|
|
8
|
+
const LoadingFailedSign = ({ onClickReload }) => (_jsxs(BaseLoadFail, { children: [_jsx(LoadFailImage, { src: loadFailLogo, width: 693, height: 641, alt: "Failed to load results", priority: true }), _jsxs(Text, { children: [_jsx(ErrorMessage, { children: "Failed to load results" }), _jsxs(ErrorDescription, { children: ["Please refresh or try again in a moment ", _jsx("br", {}), " or contact us at", " ", _jsx(SupportEmailLink, { href: "mailto:support@grantbii.com", children: "support@grantbii.com" })] })] }), onClickReload ? (_jsx(Button, { text: "Try Again", onClick: onClickReload, backgroundColor: Colors.base.white, borderColor: Colors.neutral.grey3, color: Colors.typography.blackHigh })) : (_jsx(_Fragment, {}))] }));
|
|
9
|
+
export default LoadingFailedSign;
|
|
10
|
+
const BaseLoadFail = styled.div `
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
padding: 24px;
|
|
19
|
+
|
|
20
|
+
@media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
21
|
+
gap: 16px;
|
|
22
|
+
|
|
23
|
+
border: none;
|
|
24
|
+
border-radius: 0px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
28
|
+
gap: 24px;
|
|
29
|
+
|
|
30
|
+
border: 1px solid ${Colors.neutral.grey3};
|
|
31
|
+
border-radius: 12px;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const LoadFailImage = styled(Image) `
|
|
35
|
+
@media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
36
|
+
width: 151px;
|
|
37
|
+
height: 140px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
41
|
+
width: 173px;
|
|
42
|
+
height: 160px;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
const Text = styled.div `
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
|
|
51
|
+
text-align: center;
|
|
52
|
+
`;
|
|
53
|
+
const ErrorMessage = styled.p `
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
|
|
56
|
+
@media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
57
|
+
font-size: ${Typography.SUBHEADER_FONT_SIZES.small};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
61
|
+
font-size: ${Typography.SUBHEADER_FONT_SIZES.big};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const ErrorDescription = styled.p `
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
|
|
67
|
+
@media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
68
|
+
font-size: ${Typography.BODY_FONT_SIZES.small};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
|
|
72
|
+
font-size: ${Typography.BODY_FONT_SIZES.big};
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const SupportEmailLink = styled(Link) `
|
|
76
|
+
text-decoration: underline;
|
|
77
|
+
`;
|
|
78
|
+
//# sourceMappingURL=LoadingFailedSign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingFailedSign.js","sourceRoot":"","sources":["../../../core/templates/LoadingFailedSign.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,O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UAAU,CAAC,iBAAiB,CAAC,MAAM;iBACtC,UAAU,CAAC,oBAAoB,CAAC,KAAK;;;qBAGjC,UAAU,CAAC,iBAAiB,CAAC,MAAM;iBACvC,UAAU,CAAC,oBAAoB,CAAC,GAAG;;CAEnD,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,CAAA;;;oBAGb,UAAU,CAAC,iBAAiB,CAAC,MAAM;iBACtC,UAAU,CAAC,eAAe,CAAC,KAAK;;;qBAG5B,UAAU,CAAC,iBAAiB,CAAC,MAAM;iBACvC,UAAU,CAAC,eAAe,CAAC,GAAG;;CAE9C,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAEpC,CAAC","sourcesContent":["import Image from \"next/image\";\nimport styled from \"styled-components\";\nimport loadFailLogo from \"../assets/logos/load_fail_logo.webp\";\nimport { Colors, Responsive, Typography } from \"../foundations\";\nimport Link from \"next/link\";\nimport type { MouseEventHandler } from \"react\";\nimport { Button } from \"../atoms\";\n\ntype LoadingFailedSignProps = {\n onClickReload?: MouseEventHandler<HTMLButtonElement>;\n};\n\nconst LoadingFailedSign = ({ onClickReload }: LoadingFailedSignProps) => (\n <BaseLoadFail>\n <LoadFailImage\n src={loadFailLogo}\n width={693}\n height={641}\n alt=\"Failed to load results\"\n priority\n />\n\n <Text>\n <ErrorMessage>Failed to load results</ErrorMessage>\n <ErrorDescription>\n Please refresh or try again in a moment <br /> or contact us at{\" \"}\n <SupportEmailLink href=\"mailto:support@grantbii.com\">\n support@grantbii.com\n </SupportEmailLink>\n </ErrorDescription>\n </Text>\n\n {onClickReload ? (\n <Button\n text=\"Try Again\"\n onClick={onClickReload}\n backgroundColor={Colors.base.white}\n borderColor={Colors.neutral.grey3}\n color={Colors.typography.blackHigh}\n />\n ) : (\n <></>\n )}\n </BaseLoadFail>\n);\n\nexport default LoadingFailedSign;\n\nconst BaseLoadFail = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n height: 100%;\n padding: 24px;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 16px;\n\n border: none;\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 24px;\n\n border: 1px solid ${Colors.neutral.grey3};\n border-radius: 12px;\n }\n`;\n\nconst LoadFailImage = styled(Image)`\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 151px;\n height: 140px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 173px;\n height: 160px;\n }\n`;\n\nconst Text = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n\n text-align: center;\n`;\n\nconst ErrorMessage = styled.p`\n font-weight: 700;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.SUBHEADER_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.SUBHEADER_FONT_SIZES.big};\n }\n`;\n\nconst ErrorDescription = styled.p`\n font-weight: 400;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.BODY_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n font-size: ${Typography.BODY_FONT_SIZES.big};\n }\n`;\n\nconst SupportEmailLink = styled(Link)`\n text-decoration: underline;\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageLoader.js","sourceRoot":"","sources":["../../../core/templates/PageLoader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAMxC;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,EAClB,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAC3B,IAAI,EACJ,GAAG,WAAW,EACE,EAAE,EAAE,CAAC,CACrB,KAAC,UAAU,cACR,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAM,WAAW,GAAI,CACxE,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAM,WAAW,GAAI,CACtE,GACU,CACd,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAO5B,CAAC","sourcesContent":["import { MoonLoader, PacmanLoader } from \"react-spinners\";\nimport type { LoaderSizeMarginProps } from \"react-spinners/helpers/props\";\nimport styled from \"styled-components\";\nimport { Colors } from \"../foundations\";\n\ntype PageLoaderProps = {\n isPacman?: boolean;\n} & LoaderSizeMarginProps;\n\n/**\n * The animation to show when loading the whole page\n */\nconst PageLoader = ({\n isPacman = false,\n color = Colors.accent.blue1,\n size,\n ...restOfProps\n}: PageLoaderProps) => (\n <Background>\n {isPacman ? (\n <PacmanLoader color={color} size={size ? size : 20} {...restOfProps} />\n ) : (\n <MoonLoader color={color} size={size ? size : 32} {...restOfProps} />\n )}\n </Background>\n);\n\nexport default PageLoader;\n\nconst Background = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { default as LoadingFailedSign } from \"./LoadingFailedSign\";\nexport { default as PageLoader } from \"./PageLoader\";\n"]}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC","sourcesContent":["\"use client\";\n\nexport * from \"./core/atoms\";\nexport * from \"./core/foundations\";\nexport * from \"./core/global\";\nexport * from \"./core/integrations\";\nexport * from \"./core/molecules\";\nexport * from \"./core/organisms\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC","sourcesContent":["\"use client\";\n\nexport * from \"./core/atoms\";\nexport * from \"./core/foundations\";\nexport * from \"./core/global\";\nexport * from \"./core/integrations\";\nexport * from \"./core/molecules\";\nexport * from \"./core/organisms\";\nexport * from \"./core/templates\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grantbii/design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Grantbii's Design System",
|
|
5
5
|
"homepage": "https://design.grantbii.com",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"build-storybook": "storybook build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@grantbii/ui-core": "1.
|
|
22
|
+
"@grantbii/ui-core": "1.1.1",
|
|
23
23
|
"@phosphor-icons/react": "2.1.10",
|
|
24
24
|
"country-flag-icons": "1.5.20",
|
|
25
25
|
"next": "15.5.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Input, mapEnumToOptions } from "@/.";
|
|
2
|
-
import {
|
|
2
|
+
import { CostItem } from "@grantbii/ui-core/grant/enums";
|
|
3
3
|
const meta = {
|
|
4
4
|
title: "Atoms/Input",
|
|
5
5
|
component: Input,
|
|
@@ -25,7 +25,7 @@ export const WithDatalist = {
|
|
|
25
25
|
args: {
|
|
26
26
|
placeholder: "Enter a cost item",
|
|
27
27
|
datalistId: "supportable-cost-items",
|
|
28
|
-
datalistOptions: mapEnumToOptions(
|
|
28
|
+
datalistOptions: mapEnumToOptions(CostItem),
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=Input.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Input.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGzD,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;CACtD,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,EAAE;CACzD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,IAAI,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,SAAS,EAAE,EAAE,EAAE;CAC/D,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,WAAW,EAAE,mBAAmB;QAChC,UAAU,EAAE,wBAAwB;QACpC,eAAe,EAAE,gBAAgB,CAAC,QAAQ,CAAC;KAC5C;CACF,CAAC","sourcesContent":["import { Input, mapEnumToOptions } from \"@/.\";\nimport { CostItem } from \"@grantbii/ui-core/grant/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nconst meta: Meta<typeof Input> = {\n title: \"Atoms/Input\",\n component: Input,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const BasicInput: Story = {\n args: { placeholder: \"Type here\" },\n};\n\nexport const NumericalField: Story = {\n args: { placeholder: \"Numbers only\", type: \"number\" },\n};\n\nexport const EmailField: Story = {\n args: { placeholder: \"Enter your email\", type: \"email\" },\n};\n\nexport const MinimumLength: Story = {\n args: { placeholder: \"At least 10 characters\", minLength: 10 },\n};\n\nexport const WithDatalist: Story = {\n args: {\n placeholder: \"Enter a cost item\",\n datalistId: \"supportable-cost-items\",\n datalistOptions: mapEnumToOptions(CostItem),\n },\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LoadingFailedSign } from "@/.";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
3
|
+
declare const meta: Meta<typeof LoadingFailedSign>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Reload: Story;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LoadingFailedSign } from "@/.";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Templates/Loading-Failed Sign",
|
|
4
|
+
component: LoadingFailedSign,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "centered",
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
args: {},
|
|
13
|
+
};
|
|
14
|
+
export const Reload = {
|
|
15
|
+
args: {
|
|
16
|
+
onClickReload: () => alert("reloading..."),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=LoadingFailedSign.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingFailedSign.stories.js","sourceRoot":"","sources":["../../../stories/templates/LoadingFailedSign.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAC;AAGxC,MAAM,IAAI,GAAmC;IAC3C,KAAK,EAAE,+BAA+B;IACtC,SAAS,EAAE,iBAAiB;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAU;IAC3B,IAAI,EAAE;QACJ,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC;KAC3C;CACF,CAAC","sourcesContent":["import { LoadingFailedSign } from \"@/.\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nconst meta: Meta<typeof LoadingFailedSign> = {\n title: \"Templates/Loading-Failed Sign\",\n component: LoadingFailedSign,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n args: {},\n};\n\nexport const Reload: Story = {\n args: {\n onClickReload: () => alert(\"reloading...\"),\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageLoader.stories.js","sourceRoot":"","sources":["../../../stories/templates/PageLoader.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAMvC,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAA0B,EAAE,EAAE,CAAC,CAClE,KAAC,WAAW,cACV,KAAC,UAAU,IAAC,QAAQ,EAAE,QAAQ,GAAI,GACtB,CACf,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG7B,CAAC;AAEF,MAAM,IAAI,GAAmC;IAC3C,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,iBAAiB;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;CACzB,CAAC","sourcesContent":["import { PageLoader } from \"@/.\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport styled from \"styled-components\";\n\ntype PageLoaderExampleProps = {\n isPacman?: boolean;\n};\n\nconst PageLoaderExample = ({ isPacman }: PageLoaderExampleProps) => (\n <BaseExample>\n <PageLoader isPacman={isPacman} />\n </BaseExample>\n);\n\nconst BaseExample = styled.div`\n width: 100vw;\n height: 100vh;\n`;\n\nconst meta: Meta<typeof PageLoaderExample> = {\n title: \"Templates/Page Loader\",\n component: PageLoaderExample,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"fullscreen\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const GrantbiiApp: Story = {\n args: {},\n};\n\nexport const AdminConsole: Story = {\n args: { isPacman: true },\n};\n"]}
|