@grantbii/design-system 1.11.3 → 1.11.5
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/molecules/Modal.js +3 -2
- package/core/molecules/Modal.js.map +1 -1
- package/package.json +24 -17
- package/tsconfig.tsbuildinfo +1 -1
package/core/molecules/Modal.js
CHANGED
|
@@ -4,7 +4,7 @@ import styled from "styled-components";
|
|
|
4
4
|
import { Button, Overlay } from "../atoms";
|
|
5
5
|
import { Colors, Responsive } from "../foundations";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
|
-
const Modal = ({ header, content, footer, width, height, onClickClose, closeText, }) => createPortal(_jsx(Overlay, { "$centerContent": true, children: _jsxs(ModalWindow, { "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: content }), _jsxs(ModalFooter, { children: [onClickClose ? (_jsx(CloseButton, { onClick: onClickClose, closeText: closeText })) : (_jsx(_Fragment, {})), footer ? footer : _jsx(_Fragment, {})] })] }) }), document.body);
|
|
7
|
+
const Modal = ({ header, content, footer, width, height, onClickClose, closeText, }) => createPortal(_jsx(Overlay, { "$centerContent": true, children: _jsxs(ModalWindow, { "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: content }), onClickClose || footer ? (_jsxs(ModalFooter, { children: [onClickClose ? (_jsx(CloseButton, { onClick: onClickClose, closeText: closeText })) : (_jsx(_Fragment, {})), footer ? footer : _jsx(_Fragment, {})] })) : (_jsx(_Fragment, {}))] }) }), document.body);
|
|
8
8
|
export default Modal;
|
|
9
9
|
export const useModal = () => {
|
|
10
10
|
const [showModal, setShowModal] = useState(false);
|
|
@@ -64,6 +64,8 @@ const ModalHeader = styled.div `
|
|
|
64
64
|
font-size: 18px;
|
|
65
65
|
|
|
66
66
|
padding: 12px 20px;
|
|
67
|
+
margin-bottom: 12px;
|
|
68
|
+
|
|
67
69
|
border-bottom: 1px solid ${Colors.neutral.grey3};
|
|
68
70
|
`;
|
|
69
71
|
const ModalBody = styled.div `
|
|
@@ -71,7 +73,6 @@ const ModalBody = styled.div `
|
|
|
71
73
|
flex-direction: column;
|
|
72
74
|
|
|
73
75
|
height: 100%;
|
|
74
|
-
padding-top: 12px;
|
|
75
76
|
overflow-y: auto;
|
|
76
77
|
|
|
77
78
|
> * {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/molecules/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAYzC,MAAM,KAAK,GAAG,CAAC,EACb,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,YAAY,EACZ,SAAS,GACE,EAAE,EAAE,CACf,YAAY,CACV,KAAC,OAAO,sCACN,MAAC,WAAW,cAAS,KAAK,aAAW,MAAM,aACxC,MAAM,CAAC,CAAC,CAAC,KAAC,WAAW,cAAE,MAAM,GAAe,CAAC,CAAC,CAAC,mBAAK,EAErD,KAAC,SAAS,cAAE,OAAO,GAAa,
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/molecules/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE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AG,EAAE;QACrB,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,YAAY,EAAE,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO;QACL,SAAS;QACT,SAAS;QACT,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAuC;;;;sBAI/C,MAAM,CAAC,IAAI,CAAC,KAAK;;;;;oBAKnB,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;;;;;;;qBAWlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;aAK3C,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;cACrB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;;;;CAIrC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;6BAOD,MAAM,CAAC,OAAO,CAAC,KAAK;CAChD,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;CAe3B,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM7B,CAAC;AAOF,MAAM,WAAW,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,EAAoB,EAAE,EAAE,CAAC,CAC1E,KAAC,MAAM,IACL,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EACrC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,GAClC,CACH,CAAC","sourcesContent":["import {\n type JSX,\n type MouseEventHandler,\n type ReactNode,\n useCallback,\n useState,\n} from \"react\";\nimport styled from \"styled-components\";\nimport { Button, Overlay } from \"../atoms\";\nimport { Colors, Responsive } from \"../foundations\";\nimport { createPortal } from \"react-dom\";\n\ntype ModalProps = {\n header?: ReactNode;\n content: JSX.Element;\n footer?: ReactNode;\n width?: string;\n height?: string;\n onClickClose?: MouseEventHandler<HTMLButtonElement>;\n closeText?: string;\n};\n\nconst Modal = ({\n header,\n content,\n footer,\n width,\n height,\n onClickClose,\n closeText,\n}: ModalProps) =>\n createPortal(\n <Overlay $centerContent>\n <ModalWindow $width={width} $height={height}>\n {header ? <ModalHeader>{header}</ModalHeader> : <></>}\n\n <ModalBody>{content}</ModalBody>\n\n {onClickClose || footer ? (\n <ModalFooter>\n {onClickClose ? (\n <CloseButton onClick={onClickClose} closeText={closeText} />\n ) : (\n <></>\n )}\n\n {footer ? footer : <></>}\n </ModalFooter>\n ) : (\n <></>\n )}\n </ModalWindow>\n </Overlay>,\n document.body,\n );\n\nexport default Modal;\n\nexport const useModal = () => {\n const [showModal, setShowModal] = useState(false);\n\n const lockScroll = useCallback(() => {\n document.body.style.overflow = \"hidden\";\n }, []);\n\n const unlockScroll = useCallback(() => {\n document.body.style.overflow = \"initial\";\n }, []);\n\n const openModal = () => {\n setShowModal(true);\n lockScroll();\n };\n\n const closeModal = () => {\n setShowModal(false);\n unlockScroll();\n };\n\n return {\n showModal,\n openModal,\n closeModal,\n };\n};\n\nconst ModalWindow = styled.div<{ $width?: string; $height?: string }>`\n display: flex;\n flex-direction: column;\n\n background-color: ${Colors.base.white};\n\n min-height: 100px;\n max-height: 100vh;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: fixed;\n bottom: 0px;\n left: 0px;\n\n width: 100%;\n height: 100%;\n\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: static;\n bottom: auto;\n left: auto;\n\n width: ${({ $width }) => $width};\n height: ${({ $height }) => $height};\n\n border-radius: 8px;\n }\n`;\n\nconst ModalHeader = styled.div`\n font-weight: 500;\n font-size: 18px;\n\n padding: 12px 20px;\n margin-bottom: 12px;\n\n border-bottom: 1px solid ${Colors.neutral.grey3};\n`;\n\nconst ModalBody = styled.div`\n display: flex;\n flex-direction: column;\n\n height: 100%;\n overflow-y: auto;\n\n > * {\n width: 100%;\n height: 100%;\n min-height: 100px;\n\n padding: 2px 20px;\n border: none;\n }\n`;\n\nconst ModalFooter = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 12px;\n\n padding: 16px 20px;\n`;\n\ntype CloseButtonProps = {\n onClick: MouseEventHandler<HTMLButtonElement>;\n closeText?: string;\n};\n\nconst CloseButton = ({ onClick, closeText = \"Close\" }: CloseButtonProps) => (\n <Button\n label={closeText}\n onClick={onClick}\n backgroundColor={Colors.neutral.grey3}\n color={Colors.typography.blackHigh}\n />\n);\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@grantbii/design-system",
|
|
3
3
|
"author": "Grantbii",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
|
-
"version": "1.11.
|
|
5
|
+
"version": "1.11.5",
|
|
6
6
|
"description": "Grantbii's Design System",
|
|
7
7
|
"homepage": "https://design.grantbii.com",
|
|
8
8
|
"repository": {
|
|
@@ -20,42 +20,49 @@
|
|
|
20
20
|
"build-storybook": "storybook build"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@grantbii/ui-core": "1.6.2",
|
|
24
23
|
"@phosphor-icons/react": "2.1.10",
|
|
25
24
|
"country-flag-icons": "1.6.4",
|
|
26
|
-
"next": "16.1.1",
|
|
27
|
-
"react": "19.2.3",
|
|
28
|
-
"react-dom": "19.2.3",
|
|
29
25
|
"react-dropzone": "14.3.8",
|
|
30
|
-
"react-spinners": "0.17.0"
|
|
31
|
-
|
|
26
|
+
"react-spinners": "0.17.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@grantbii/ui-core": "^1.6.0",
|
|
30
|
+
"next": "^16.1.0",
|
|
31
|
+
"react": ">=18 <20",
|
|
32
|
+
"react-dom": ">=18 <20",
|
|
33
|
+
"styled-components": "^6.3.0"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@chromatic-com/storybook": "
|
|
36
|
+
"@chromatic-com/storybook": "5.0.0",
|
|
35
37
|
"@eslint/js": "9.39.2",
|
|
36
|
-
"@
|
|
38
|
+
"@grantbii/ui-core": "1.6.2",
|
|
39
|
+
"@next/eslint-plugin-next": "16.1.2",
|
|
37
40
|
"@storybook/addon-a11y": "10.1.11",
|
|
38
41
|
"@storybook/addon-docs": "10.1.11",
|
|
39
42
|
"@storybook/addon-onboarding": "10.1.11",
|
|
40
43
|
"@storybook/addon-vitest": "10.1.11",
|
|
41
44
|
"@storybook/nextjs-vite": "10.1.11",
|
|
42
45
|
"@types/node": "22.18.0",
|
|
43
|
-
"@types/react": "19.2.
|
|
46
|
+
"@types/react": "19.2.8",
|
|
44
47
|
"@types/react-dom": "19.2.3",
|
|
45
|
-
"@vitest/browser": "4.0.
|
|
46
|
-
"@vitest/browser-playwright": "4.0.
|
|
47
|
-
"@vitest/coverage-v8": "4.0.
|
|
48
|
-
"baseline-browser-mapping": "2.9.
|
|
48
|
+
"@vitest/browser": "4.0.17",
|
|
49
|
+
"@vitest/browser-playwright": "4.0.17",
|
|
50
|
+
"@vitest/coverage-v8": "4.0.17",
|
|
51
|
+
"baseline-browser-mapping": "2.9.14",
|
|
49
52
|
"eslint": "9.39.2",
|
|
50
|
-
"eslint-config-next": "16.1.
|
|
53
|
+
"eslint-config-next": "16.1.2",
|
|
51
54
|
"eslint-plugin-storybook": "10.1.11",
|
|
52
55
|
"husky": "9.1.7",
|
|
53
56
|
"lint-staged": "16.2.7",
|
|
57
|
+
"next": "16.1.2",
|
|
54
58
|
"playwright": "1.57.0",
|
|
55
|
-
"prettier": "3.
|
|
59
|
+
"prettier": "3.8.0",
|
|
60
|
+
"react": "19.2.3",
|
|
61
|
+
"react-dom": "19.2.3",
|
|
56
62
|
"storybook": "10.1.11",
|
|
63
|
+
"styled-components": "6.3.6",
|
|
57
64
|
"typescript": "5.9.3",
|
|
58
|
-
"vitest": "4.0.
|
|
65
|
+
"vitest": "4.0.17"
|
|
59
66
|
},
|
|
60
67
|
"lint-staged": {
|
|
61
68
|
"**/*.{html,css,json,md,yaml}": [
|