@grantbii/design-system 1.0.35 → 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.
- package/core/atoms/Badge.d.ts +4 -3
- package/core/atoms/Badge.js +2 -2
- package/core/atoms/Button.d.ts +5 -4
- package/core/atoms/Button.js +2 -2
- package/core/atoms/LinkButton.d.ts +4 -3
- package/core/atoms/LinkButton.js +1 -1
- package/package.json +1 -1
- package/stories/atoms/Badge.stories.js +2 -4
- package/stories/atoms/Button.stories.js +3 -4
- package/stories/atoms/LinkButton.stories.js +3 -4
- package/tsconfig.tsbuildinfo +1 -1
package/core/atoms/Badge.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType, MouseEventHandler } from "react";
|
|
2
|
+
import { Icons } from "../foundations";
|
|
2
3
|
type BadgeProps = {
|
|
3
4
|
text: string;
|
|
4
|
-
|
|
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: ({
|
|
11
|
+
declare const Badge: ({ Icon, text, onClickClose, textWidthPixels, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export default Badge;
|
package/core/atoms/Badge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
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 = ({
|
|
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;
|
package/core/atoms/Button.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType, MouseEventHandler } from "react";
|
|
2
|
+
import { Icons } from "../foundations";
|
|
2
3
|
type ButtonProps = {
|
|
3
4
|
text: string;
|
|
4
5
|
disabled?: boolean;
|
|
5
6
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
6
7
|
type?: "button" | "submit" | "reset";
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
LeftIcon?: ComponentType<Icons.IconProps>;
|
|
9
|
+
RightIcon?: ComponentType<Icons.IconProps>;
|
|
9
10
|
backgroundColor?: string;
|
|
10
11
|
color?: string;
|
|
11
12
|
};
|
|
12
|
-
declare const Button: ({ text, onClick, disabled,
|
|
13
|
+
declare const Button: ({ text, onClick, disabled, LeftIcon, RightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default Button;
|
package/core/atoms/Button.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
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, disabled,
|
|
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,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType, HTMLAttributeAnchorTarget } from "react";
|
|
2
|
+
import { Icons } from "../foundations";
|
|
2
3
|
type LinkButtonProps = {
|
|
3
4
|
text: string;
|
|
4
5
|
href: string;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
target?: HTMLAttributeAnchorTarget;
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
LeftIcon?: ComponentType<Icons.IconProps>;
|
|
9
|
+
RightIcon?: ComponentType<Icons.IconProps>;
|
|
9
10
|
backgroundColor?: string;
|
|
10
11
|
color?: string;
|
|
11
12
|
};
|
package/core/atoms/LinkButton.js
CHANGED
|
@@ -18,7 +18,7 @@ const LinkButton = (_a) => {
|
|
|
18
18
|
return disabled ? (_jsx(Content, Object.assign({}, contentProps))) : (_jsx(Link, { href: href, target: target, children: _jsx(Content, Object.assign({}, contentProps)) }));
|
|
19
19
|
};
|
|
20
20
|
export default LinkButton;
|
|
21
|
-
const Content = ({ text,
|
|
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, {})] }));
|
|
22
22
|
const BaseLinkButton = styled.div `
|
|
23
23
|
${ButtonStyle}
|
|
24
24
|
`;
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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), {
|
|
19
|
+
args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.PlusIcon }),
|
|
21
20
|
};
|
|
22
21
|
export const RightIcon = {
|
|
23
|
-
args: Object.assign(Object.assign({}, baseArgs), {
|
|
22
|
+
args: Object.assign(Object.assign({}, baseArgs), { RightIcon: Icons.MinusIcon }),
|
|
24
23
|
};
|
|
25
24
|
export const BothIcons = {
|
|
26
|
-
args: Object.assign(Object.assign({}, baseArgs), {
|
|
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), {
|
|
20
|
+
args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.PlusIcon }),
|
|
22
21
|
};
|
|
23
22
|
export const RightIcon = {
|
|
24
|
-
args: Object.assign(Object.assign({}, baseArgs), {
|
|
23
|
+
args: Object.assign(Object.assign({}, baseArgs), { RightIcon: Icons.MinusIcon }),
|
|
25
24
|
};
|
|
26
25
|
export const BothIcons = {
|
|
27
|
-
args: Object.assign(Object.assign({}, baseArgs), {
|
|
26
|
+
args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
|
|
28
27
|
};
|