@grantbii/design-system 1.0.48 → 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.
@@ -0,0 +1,7 @@
1
+ import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
+ type CheckboxProps = {
3
+ label: string;
4
+ labelBefore?: boolean;
5
+ } & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
6
+ declare const Checkbox: ({ id, label, labelBefore, ...checkboxProps }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default Checkbox;
@@ -0,0 +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
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { LabelInput } from "./shared";
14
+ const Checkbox = (_a) => {
15
+ var { id, label, labelBefore = false } = _a, checkboxProps = __rest(_a, ["id", "label", "labelBefore"]);
16
+ return (_jsxs(LabelInput, { children: [labelBefore ? _jsx("label", { htmlFor: `${id}-checkbox`, children: label }) : _jsx(_Fragment, {}), _jsx("input", Object.assign({}, checkboxProps, { id: `${id}-checkbox`, type: "checkbox" })), labelBefore ? _jsx(_Fragment, {}) : _jsx("label", { htmlFor: `${id}-checkbox`, children: label })] }));
17
+ };
18
+ export default Checkbox;
@@ -2,5 +2,5 @@ import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
2
  type RadioButtonProps = {
3
3
  label: string;
4
4
  } & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
5
- declare const RadioButton: ({ label, id, ...radioButtonProps }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const RadioButton: ({ id, label, ...radioButtonProps }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default RadioButton;
@@ -10,13 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import styled from "styled-components";
13
+ import { LabelInput } from "./shared";
14
14
  const RadioButton = (_a) => {
15
- var { label, id } = _a, radioButtonProps = __rest(_a, ["label", "id"]);
16
- return (_jsxs(BaseRadioButton, { children: [_jsx("input", Object.assign({}, radioButtonProps, { id: `${id}-radio-button`, type: "radio" })), _jsx("label", { htmlFor: `${id}-radio-button`, children: label })] }));
15
+ var { id, label } = _a, radioButtonProps = __rest(_a, ["id", "label"]);
16
+ return (_jsxs(LabelInput, { children: [_jsx("input", Object.assign({}, radioButtonProps, { id: `${id}-radio-button`, type: "radio" })), _jsx("label", { htmlFor: `${id}-radio-button`, children: label })] }));
17
17
  };
18
18
  export default RadioButton;
19
- const BaseRadioButton = styled.div `
20
- display: flex;
21
- gap: 8px;
22
- `;
@@ -1,6 +1,7 @@
1
1
  export { default as Badge } from "./Badge";
2
2
  export { default as BrandLogo } from "./BrandLogo";
3
3
  export { default as Button } from "./Button";
4
+ export { default as Checkbox } from "./Checkbox";
4
5
  export { default as LinkButton } from "./LinkButton";
5
6
  export { default as RadioButton } from "./RadioButton";
6
7
  export { default as Textarea } from "./Textarea";
@@ -1,6 +1,7 @@
1
1
  export { default as Badge } from "./Badge";
2
2
  export { default as BrandLogo } from "./BrandLogo";
3
3
  export { default as Button } from "./Button";
4
+ export { default as Checkbox } from "./Checkbox";
4
5
  export { default as LinkButton } from "./LinkButton";
5
6
  export { default as RadioButton } from "./RadioButton";
6
7
  export { default as Textarea } from "./Textarea";
@@ -3,3 +3,4 @@ export declare const BaseButton: import("styled-components/dist/types").IStyledC
3
3
  $backgroundColor?: string;
4
4
  $color?: string;
5
5
  }>> & string;
6
+ export declare const LabelInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -17,3 +17,8 @@ export const BaseButton = styled.div `
17
17
  color: ${({ $color = Colors.typography.whiteHigh }) => $color};
18
18
  background-color: ${({ $underline = false, $backgroundColor = Colors.main.grantbiiBlue, }) => ($underline ? "transparent" : $backgroundColor)};
19
19
  `;
20
+ export const LabelInput = styled.div `
21
+ display: flex;
22
+ align-items: center;
23
+ gap: 8px;
24
+ `;
@@ -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;
@@ -22,5 +22,6 @@ const RadioButtons = ({ name, options }) => {
22
22
  export default RadioButtons;
23
23
  const RadioGroup = styled.div `
24
24
  display: flex;
25
+ align-items: center;
25
26
  gap: 12px;
26
27
  `;
@@ -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.48",
3
+ "version": "1.0.50",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -0,0 +1,7 @@
1
+ import { Checkbox } from "@/.";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
3
+ declare const meta: Meta<typeof Checkbox>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const LabelBefore: Story;
7
+ export declare const LabelAfter: Story;
@@ -0,0 +1,23 @@
1
+ import { Checkbox } from "@/.";
2
+ const meta = {
3
+ title: "Atoms/Checkbox",
4
+ component: Checkbox,
5
+ tags: ["autodocs"],
6
+ parameters: {
7
+ layout: "centered",
8
+ },
9
+ };
10
+ export default meta;
11
+ const label = "Grantbii is the best";
12
+ export const LabelBefore = {
13
+ args: {
14
+ label,
15
+ labelBefore: true,
16
+ },
17
+ };
18
+ export const LabelAfter = {
19
+ args: {
20
+ label,
21
+ labelBefore: false,
22
+ },
23
+ };
@@ -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
+ };