@grantbii/design-system 1.0.49 → 1.0.50

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,7 +3,7 @@ import { useCallback, useState } from "react";
3
3
  import styled from "styled-components";
4
4
  import { Button } from "../atoms";
5
5
  import { Colors } from "../foundations";
6
- const Modal = ({ header, content, footer, width, height, isFullScreen, onClickCancel, }) => (_jsx(Overlay, { "$isFullScreen": isFullScreen, children: _jsxs(ModalWindow, { "$isFullScreen": isFullScreen, "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: _jsx(ModalContent, { children: content }) }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: onClickCancel }), footer ? footer : _jsx(_Fragment, {})] })] }) }));
6
+ const Modal = ({ header, content, footer, width, height, isFullScreen, onClickCancel, }) => (_jsx(Overlay, { "$isFullScreen": isFullScreen, children: _jsxs(ModalWindow, { "$isFullScreen": isFullScreen, "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: content }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: onClickCancel }), footer ? footer : _jsx(_Fragment, {})] })] }) }));
7
7
  export default Modal;
8
8
  export const useModal = () => {
9
9
  const [showModal, setShowModal] = useState(false);
@@ -70,14 +70,15 @@ const ModalBody = styled.div `
70
70
  height: 100%;
71
71
  padding-top: 24px;
72
72
  overflow-y: auto;
73
- `;
74
- const ModalContent = styled.div `
75
- width: 100%;
76
- height: 100%;
77
- min-height: 100px;
78
73
 
79
- padding: 2px 24px;
80
- border: none;
74
+ > * {
75
+ width: 100%;
76
+ height: 100%;
77
+ min-height: 100px;
78
+
79
+ padding: 2px 24px;
80
+ border: none;
81
+ }
81
82
  `;
82
83
  const ModalFooter = styled.div `
83
84
  display: flex;
@@ -0,0 +1,10 @@
1
+ import { MouseEventHandler, ReactNode } from "react";
2
+ type TallyModalProps = {
3
+ header?: ReactNode;
4
+ tallyId: string;
5
+ prefilledFieldsQueryParams?: string;
6
+ isFullScreen?: boolean;
7
+ onClickCancel: MouseEventHandler<HTMLButtonElement>;
8
+ };
9
+ declare const TallyModal: ({ tallyId, prefilledFieldsQueryParams, ...modalProps }: TallyModalProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default TallyModal;
@@ -0,0 +1,20 @@
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 { Modal } from "../molecules";
14
+ const TallyModal = (_a) => {
15
+ var { tallyId, prefilledFieldsQueryParams } = _a, modalProps = __rest(_a, ["tallyId", "prefilledFieldsQueryParams"]);
16
+ return (_jsx(Modal, Object.assign({}, modalProps, { content: _jsx("iframe", { src: constructIframeSrc(tallyId, prefilledFieldsQueryParams), loading: "lazy" }), width: "640px", height: "480px" })));
17
+ };
18
+ export default TallyModal;
19
+ const constructIframeSrc = (tallyId, prefilledFieldsQueryParams) => `https://tally.so/embed/${tallyId}?${TALLY_QUERIES}${prefilledFieldsQueryParams ? `&${prefilledFieldsQueryParams}` : ""}`;
20
+ const TALLY_QUERIES = "alignLeft=1&hideTitle=1&transparentBackground=1&dynamicHeight=0";
@@ -1 +1,2 @@
1
+ export { default as TallyModal } from "./TallyModal";
1
2
  export { default as YesNoOptions } from "./YesNoOptions";
@@ -1 +1,2 @@
1
+ export { default as TallyModal } from "./TallyModal";
1
2
  export { default as YesNoOptions } from "./YesNoOptions";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { Button, Modal, useModal } from "@/.";
3
3
  const ModalExample = (props) => {
4
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, {}))] }));
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
6
  };
7
7
  const meta = {
8
8
  title: "Molecules/Modal",
@@ -0,0 +1,14 @@
1
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
2
+ import { ReactNode } from "react";
3
+ type TallyModalExampleProps = {
4
+ header?: ReactNode;
5
+ tallyId: string;
6
+ prefilledFieldsQueryParams?: string;
7
+ isFullScreen?: boolean;
8
+ };
9
+ declare const TallyModalExample: (props: TallyModalExampleProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const meta: Meta<typeof TallyModalExample>;
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const PopUp: Story;
14
+ export declare const FullScreen: Story;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, TallyModal, useModal } from "@/.";
3
+ const TallyModalExample = (props) => {
4
+ const { showModal, openModal, closeModal } = useModal();
5
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { text: "Click to open modal", onClick: () => openModal() }), showModal ? (_jsx(TallyModal, Object.assign({}, props, { onClickCancel: () => closeModal() }))) : (_jsx(_Fragment, {}))] }));
6
+ };
7
+ const meta = {
8
+ title: "Organisms/Tally Modal",
9
+ component: TallyModalExample,
10
+ tags: ["autodocs"],
11
+ parameters: {
12
+ layout: "centered",
13
+ },
14
+ };
15
+ export default meta;
16
+ const baseArgs = {
17
+ header: "Apply with us",
18
+ tallyId: "3jAj5Q",
19
+ };
20
+ export const PopUp = {
21
+ args: baseArgs,
22
+ };
23
+ export const FullScreen = {
24
+ args: Object.assign(Object.assign({}, baseArgs), { isFullScreen: true }),
25
+ };