@grantbii/design-system 1.0.34 → 1.0.36

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.
@@ -1,11 +1,12 @@
1
- import { JSX, MouseEventHandler } from "react";
1
+ import { ComponentType, MouseEventHandler } from "react";
2
+ import { Icons } from "../foundations";
2
3
  type BadgeProps = {
3
4
  text: string;
4
- icon?: JSX.Element;
5
+ Icon?: ComponentType<Icons.IconProps>;
5
6
  onClickClose?: MouseEventHandler<HTMLButtonElement>;
6
7
  textWidthPixels?: number;
7
8
  backgroundColor?: string;
8
9
  color?: string;
9
10
  };
10
- declare const Badge: ({ icon, text, onClickClose, textWidthPixels, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const Badge: ({ Icon, text, onClickClose, textWidthPixels, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
11
12
  export default Badge;
@@ -1,7 +1,7 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 ? icon : _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 = ({ 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, {}))] }));
5
5
  export default Badge;
6
6
  const BaseBadge = styled.div `
7
7
  display: flex;
@@ -1,12 +1,14 @@
1
- import { JSX, MouseEventHandler } from "react";
1
+ import { ComponentType, MouseEventHandler } from "react";
2
+ import { Icons } from "../foundations";
2
3
  type ButtonProps = {
3
4
  text: string;
5
+ disabled?: boolean;
4
6
  onClick: MouseEventHandler<HTMLButtonElement>;
5
7
  type?: "button" | "submit" | "reset";
6
- leftIcon?: JSX.Element;
7
- rightIcon?: JSX.Element;
8
+ LeftIcon?: ComponentType<Icons.IconProps>;
9
+ RightIcon?: ComponentType<Icons.IconProps>;
8
10
  backgroundColor?: string;
9
11
  color?: string;
10
12
  };
11
- declare const Button: ({ text, onClick, leftIcon, rightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const Button: ({ text, onClick, disabled, LeftIcon, RightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
12
14
  export default Button;
@@ -1,7 +1,7 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 { ButtonStyle } from "./shared";
4
- const Button = ({ text, onClick, leftIcon, rightIcon, backgroundColor, color, type = "button", }) => (_jsx("button", { type: type, onClick: onClick, children: _jsxs(BaseButton, { "$backgroundColor": backgroundColor, "$color": color, children: [leftIcon ? leftIcon : _jsx(_Fragment, {}), _jsx("p", { children: text }), rightIcon ? rightIcon : _jsx(_Fragment, {})] }) }));
4
+ const Button = ({ text, onClick, disabled, LeftIcon, RightIcon, backgroundColor, color, type = "button", }) => (_jsx("button", { type: type, onClick: onClick, disabled: disabled, children: _jsxs(BaseButton, { "$backgroundColor": backgroundColor, "$color": color, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }) }));
5
5
  export default Button;
6
6
  const BaseButton = styled.div `
7
7
  ${ButtonStyle}
@@ -1,12 +1,14 @@
1
- import { HTMLAttributeAnchorTarget, JSX } from "react";
1
+ import { ComponentType, HTMLAttributeAnchorTarget } from "react";
2
+ import { Icons } from "../foundations";
2
3
  type LinkButtonProps = {
3
4
  text: string;
4
5
  href: string;
6
+ disabled?: boolean;
5
7
  target?: HTMLAttributeAnchorTarget;
6
- leftIcon?: JSX.Element;
7
- rightIcon?: JSX.Element;
8
+ LeftIcon?: ComponentType<Icons.IconProps>;
9
+ RightIcon?: ComponentType<Icons.IconProps>;
8
10
  backgroundColor?: string;
9
11
  color?: string;
10
12
  };
11
- declare const LinkButton: ({ text, href, target, leftIcon, rightIcon, backgroundColor, color, }: LinkButtonProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const LinkButton: ({ href, target, disabled, ...contentProps }: LinkButtonProps) => import("react/jsx-runtime").JSX.Element;
12
14
  export default LinkButton;
@@ -1,9 +1,24 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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";
2
13
  import Link from "next/link";
3
14
  import styled from "styled-components";
4
15
  import { ButtonStyle } from "./shared";
5
- const LinkButton = ({ text, href, target, leftIcon, rightIcon, backgroundColor, color, }) => (_jsx(Link, { href: href, target: target, children: _jsxs(BaseLinkButton, { "$backgroundColor": backgroundColor, "$color": color, children: [leftIcon ? leftIcon : _jsx(_Fragment, {}), _jsx("p", { children: text }), rightIcon ? rightIcon : _jsx(_Fragment, {})] }) }));
16
+ const LinkButton = (_a) => {
17
+ var { href, target, disabled } = _a, contentProps = __rest(_a, ["href", "target", "disabled"]);
18
+ return disabled ? (_jsx(Content, Object.assign({}, contentProps))) : (_jsx(Link, { href: href, target: target, children: _jsx(Content, Object.assign({}, contentProps)) }));
19
+ };
6
20
  export default LinkButton;
21
+ const Content = ({ text, LeftIcon, RightIcon, backgroundColor, color, }) => (_jsxs(BaseLinkButton, { "$backgroundColor": backgroundColor, "$color": color, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }));
7
22
  const BaseLinkButton = styled.div `
8
23
  ${ButtonStyle}
9
24
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { Badge, Icons } from "@/.";
3
2
  const meta = {
4
3
  title: "Atoms/Badge",
@@ -11,7 +10,6 @@ const meta = {
11
10
  export default meta;
12
11
  const defaultText = "Badge";
13
12
  const longText = "the quick brown fox jumps over the lazy dog";
14
- const icon = _jsx(Icons.SmileyXEyesIcon, { size: 20 });
15
13
  const onClickClose = () => alert("You have closed the badge.");
16
14
  export const TextOnly = {
17
15
  args: {
@@ -20,7 +18,7 @@ export const TextOnly = {
20
18
  };
21
19
  export const Icon = {
22
20
  args: {
23
- icon: icon,
21
+ Icon: Icons.SmileyXEyesIcon,
24
22
  text: defaultText,
25
23
  },
26
24
  };
@@ -38,7 +36,7 @@ export const LongText = {
38
36
  };
39
37
  export const Everything = {
40
38
  args: {
41
- icon: icon,
39
+ Icon: Icons.SmileyXEyesIcon,
42
40
  text: longText,
43
41
  textWidthPixels: 160,
44
42
  onClickClose: onClickClose,
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { Button, Icons } from "@/.";
3
2
  const meta = {
4
3
  title: "Atoms/Button",
@@ -17,13 +16,13 @@ export const TextOnly = {
17
16
  args: baseArgs,
18
17
  };
19
18
  export const LeftIcon = {
20
- args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.PlusIcon, { size: 14 }) }),
19
+ args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.PlusIcon }),
21
20
  };
22
21
  export const RightIcon = {
23
- args: Object.assign(Object.assign({}, baseArgs), { rightIcon: _jsx(Icons.MinusIcon, { size: 14 }) }),
22
+ args: Object.assign(Object.assign({}, baseArgs), { RightIcon: Icons.MinusIcon }),
24
23
  };
25
24
  export const BothIcons = {
26
- args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.SmileyXEyesIcon, { size: 20 }), rightIcon: _jsx(Icons.SmileyMeltingIcon, { size: 20 }) }),
25
+ args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
27
26
  };
28
27
  export const Wide = {
29
28
  args: Object.assign({}, baseArgs),
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { Icons, LinkButton } from "@/.";
3
2
  const meta = {
4
3
  title: "Atoms/LinkButton",
@@ -18,11 +17,11 @@ export const TextOnly = {
18
17
  args: baseArgs,
19
18
  };
20
19
  export const LeftIcon = {
21
- args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.PlusIcon, { size: 14 }) }),
20
+ args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.PlusIcon }),
22
21
  };
23
22
  export const RightIcon = {
24
- args: Object.assign(Object.assign({}, baseArgs), { rightIcon: _jsx(Icons.MinusIcon, { size: 14 }) }),
23
+ args: Object.assign(Object.assign({}, baseArgs), { RightIcon: Icons.MinusIcon }),
25
24
  };
26
25
  export const BothIcons = {
27
- args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.SmileyXEyesIcon, { size: 20 }), rightIcon: _jsx(Icons.SmileyMeltingIcon, { size: 20 }) }),
26
+ args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
28
27
  };