@grantbii/design-system 1.0.37 → 1.0.39

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.
@@ -3,10 +3,12 @@ import { Icons } from "../foundations";
3
3
  type BadgeProps = {
4
4
  text: string;
5
5
  Icon?: ComponentType<Icons.IconProps>;
6
+ iconSize?: string | number;
7
+ iconWeight?: Icons.IconWeight;
6
8
  onClickClose?: MouseEventHandler<HTMLButtonElement>;
7
9
  textWidthPixels?: number;
8
10
  backgroundColor?: string;
9
11
  color?: string;
10
12
  };
11
- declare const Badge: ({ Icon, text, onClickClose, textWidthPixels, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const Badge: ({ text, Icon, iconSize, iconWeight, onClickClose, textWidthPixels, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
12
14
  export default Badge;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styled from "styled-components";
3
3
  import { Colors, Icons } from "../foundations";
4
- const Badge = ({ Icon, text, onClickClose, textWidthPixels, backgroundColor, color, }) => (_jsxs(BaseBadge, { "$backgroundColor": backgroundColor, "$color": color, children: [Icon ? _jsx(Icon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx(BadgeText, { "$widthPixels": textWidthPixels, children: text }), onClickClose ? (_jsx(Button, { type: "button", onClick: onClickClose, children: _jsx(Icons.XIcon, { size: 12 }) })) : (_jsx(_Fragment, {}))] }));
4
+ const Badge = ({ text, Icon, iconSize = 20, iconWeight = "regular", onClickClose, textWidthPixels, backgroundColor, color, }) => (_jsxs(BaseBadge, { "$backgroundColor": backgroundColor, "$color": color, children: [Icon ? _jsx(Icon, { color: color, size: iconSize, weight: iconWeight }) : _jsx(_Fragment, {}), _jsx(BadgeText, { "$widthPixels": textWidthPixels, children: text }), onClickClose ? (_jsx(Button, { type: "button", onClick: onClickClose, children: _jsx(Icons.XIcon, { size: 12 }) })) : (_jsx(_Fragment, {}))] }));
5
5
  export default Badge;
6
6
  const BaseBadge = styled.div `
7
7
  display: flex;
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Image from "next/image";
3
3
  import darkLogo from "../../public/logos/brand_logo-dark.webp";
4
4
  import lightLogo from "../../public/logos/brand_logo-light.webp";
5
- const BrandLogo = ({ width = 250, height = 80, isDarkTheme = true, alt = "Grantbii", }) => (_jsx(Image, { src: isDarkTheme ? darkLogo : lightLogo, alt: alt, width: width, height: height }));
5
+ const BrandLogo = ({ width = 250, height = 80, isDarkTheme = true, alt = "Grantbii", }) => (_jsx(Image, { src: isDarkTheme ? darkLogo : lightLogo, alt: alt, width: width, height: height, priority: true }));
6
6
  export default BrandLogo;
@@ -1,12 +1,17 @@
1
- import { MouseEventHandler, ReactElement, ReactNode } from "react";
1
+ import { MouseEventHandler, ReactNode } from "react";
2
2
  type ModalProps = {
3
- clickable: (openModal: MouseEventHandler<HTMLButtonElement>) => ReactNode;
4
3
  header?: ReactNode;
5
- content: ReactElement;
4
+ content: ReactNode;
6
5
  footer?: ReactNode;
7
6
  width?: string;
8
7
  height?: string;
9
8
  isFullScreen?: boolean;
9
+ onClickCancel: MouseEventHandler<HTMLButtonElement>;
10
10
  };
11
- declare const Modal: ({ clickable, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const Modal: ({ header, content, footer, width, height, isFullScreen, onClickCancel, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default Modal;
13
+ export declare const useModal: () => {
14
+ showModal: boolean;
15
+ openModal: () => void;
16
+ closeModal: () => void;
17
+ };
@@ -1,23 +1,18 @@
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
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useCallback, useState, } from "react";
2
+ import { useCallback, useState } from "react";
14
3
  import styled from "styled-components";
15
4
  import { Button } from "../atoms";
16
5
  import { Colors } from "../foundations";
17
- const Modal = (_a) => {
18
- var { clickable } = _a, props = __rest(_a, ["clickable"]);
6
+ const Modal = ({ header, content, footer, width, height, isFullScreen, onClickCancel, }) => (_jsx(Overlay, { children: _jsxs(ModalWindow, { "$isFullScreen": isFullScreen, "$width": width, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { "$isFullScreen": isFullScreen, "$height": height, children: content }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: onClickCancel }), footer ? footer : _jsx(_Fragment, {})] })] }) }));
7
+ export default Modal;
8
+ export const useModal = () => {
19
9
  const [showModal, setShowModal] = useState(false);
20
- const { lockScroll, unlockScroll } = useScrollLock();
10
+ const lockScroll = useCallback(() => {
11
+ document.body.style.overflow = "hidden";
12
+ }, []);
13
+ const unlockScroll = useCallback(() => {
14
+ document.body.style.overflow = "initial";
15
+ }, []);
21
16
  const openModal = () => {
22
17
  setShowModal(true);
23
18
  lockScroll();
@@ -26,22 +21,12 @@ const Modal = (_a) => {
26
21
  setShowModal(false);
27
22
  unlockScroll();
28
23
  };
29
- return (_jsxs(_Fragment, { children: [clickable(openModal), showModal ? _jsx(PopUp, Object.assign({}, props, { closeModal: closeModal })) : _jsx(_Fragment, {})] }));
30
- };
31
- export default Modal;
32
- const useScrollLock = () => {
33
- const lockScroll = useCallback(() => {
34
- document.body.style.overflow = "hidden";
35
- }, []);
36
- const unlockScroll = useCallback(() => {
37
- document.body.style.overflow = "initial";
38
- }, []);
39
24
  return {
40
- lockScroll,
41
- unlockScroll,
25
+ showModal,
26
+ openModal,
27
+ closeModal,
42
28
  };
43
29
  };
44
- const PopUp = ({ header, content, footer, width, height, isFullScreen, closeModal, }) => (_jsx(Overlay, { children: _jsxs(ModalWindow, { "$isFullScreen": isFullScreen, "$width": width, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { "$isFullScreen": isFullScreen, "$height": height, children: content }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: () => closeModal() }), footer ? footer : _jsx(_Fragment, {})] })] }) }));
45
30
  const Overlay = styled.div `
46
31
  background-color: ${Colors.semantic.overlay};
47
32
 
@@ -87,7 +72,7 @@ const ModalBody = styled.div `
87
72
  width: 100%;
88
73
  height: 100%;
89
74
 
90
- padding: 0px 24px;
75
+ padding: 2px 24px;
91
76
  border: none;
92
77
 
93
78
  overflow-y: auto;
@@ -1 +1 @@
1
- export { default as Modal } from "./Modal";
1
+ export { default as Modal, useModal } from "./Modal";
@@ -1 +1 @@
1
- export { default as Modal } from "./Modal";
1
+ export { default as Modal, useModal } from "./Modal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -25,7 +25,7 @@ export const Icon = {
25
25
  export const Closeable = {
26
26
  args: {
27
27
  text: defaultText,
28
- onClickClose: onClickClose,
28
+ onClickClose,
29
29
  },
30
30
  };
31
31
  export const LongText = {
@@ -39,6 +39,6 @@ export const Everything = {
39
39
  Icon: Icons.SmileyXEyesIcon,
40
40
  text: longText,
41
41
  textWidthPixels: 160,
42
- onClickClose: onClickClose,
42
+ onClickClose,
43
43
  },
44
44
  };
@@ -8,4 +8,3 @@ export declare const TextOnly: Story;
8
8
  export declare const LeftIcon: Story;
9
9
  export declare const RightIcon: Story;
10
10
  export declare const BothIcons: Story;
11
- export declare const Wide: Story;
@@ -24,6 +24,3 @@ export const RightIcon = {
24
24
  export const BothIcons = {
25
25
  args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
26
26
  };
27
- export const Wide = {
28
- args: Object.assign({}, baseArgs),
29
- };
@@ -1,7 +1,16 @@
1
- import { Modal } from "@/.";
2
1
  import type { StoryObj } from "@storybook/nextjs-vite";
3
2
  import { Meta } from "@storybook/nextjs-vite";
4
- declare const meta: Meta<typeof Modal>;
3
+ import { ReactNode } from "react";
4
+ type ModalExampleProps = {
5
+ header?: ReactNode;
6
+ content: ReactNode;
7
+ footer?: ReactNode;
8
+ width?: string;
9
+ height?: string;
10
+ isFullScreen?: boolean;
11
+ };
12
+ declare const ModalExample: (props: ModalExampleProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const meta: Meta<typeof ModalExample>;
5
14
  export default meta;
6
15
  type Story = StoryObj<typeof meta>;
7
16
  export declare const DesktopVersion: Story;
@@ -1,27 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button, Modal } from "@/.";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Modal, useModal } from "@/.";
3
+ const ModalExample = (props) => {
4
+ const { showModal, openModal, closeModal } = useModal();
5
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { text: "Click to open modal", onClick: openModal }), showModal ? (_jsx(Modal, Object.assign({}, props, { onClickCancel: () => closeModal() }))) : (_jsx(_Fragment, {}))] }));
6
+ };
3
7
  const meta = {
4
8
  title: "Molecules/Modal",
5
- component: Modal,
9
+ component: ModalExample,
6
10
  tags: ["autodocs"],
7
11
  parameters: {
8
12
  layout: "centered",
9
13
  },
10
14
  };
11
15
  export default meta;
16
+ const header = "What is Grantbii?";
12
17
  const text = "Grantbii is an AI-powered grant intelligence and matching platform that helps grant seekers effortlessly find, match, prep & apply for the right business grants - maximizing grant funding success with minimal effort. Our platform connects businesses with a trusted Grant Enabler Network - solution providers, consulting experts, and delivery partners - ensuring that every dollar of grant funding leads to real business transformation impact.";
13
18
  export const DesktopVersion = {
14
19
  args: {
15
- clickable: (openModal) => (_jsx(Button, { text: "Click to open modal", onClick: openModal })),
16
- header: "What is Grantbii?",
20
+ header,
17
21
  content: _jsx("p", { children: text }),
18
22
  width: "600px",
19
23
  },
20
24
  };
21
25
  export const MobileVersion = {
22
26
  args: {
23
- clickable: (openModal) => (_jsx(Button, { text: "Click to open modal", onClick: openModal })),
24
- header: "What is Grantbii?",
27
+ header,
25
28
  content: _jsx("p", { children: text }),
26
29
  isFullScreen: true,
27
30
  },