@grantbii/design-system 1.0.42 → 1.0.44

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.
@@ -2,13 +2,14 @@ import { ComponentType, MouseEventHandler } from "react";
2
2
  import { Icons } from "../foundations";
3
3
  type ButtonProps = {
4
4
  text: string;
5
- disabled?: boolean;
6
5
  onClick: MouseEventHandler<HTMLButtonElement>;
6
+ disabled?: boolean;
7
7
  type?: "button" | "submit" | "reset";
8
8
  LeftIcon?: ComponentType<Icons.IconProps>;
9
9
  RightIcon?: ComponentType<Icons.IconProps>;
10
+ underline?: boolean;
10
11
  backgroundColor?: string;
11
12
  color?: string;
12
13
  };
13
- declare const Button: ({ text, onClick, disabled, LeftIcon, RightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
14
+ declare const Button: ({ text, onClick, disabled, LeftIcon, RightIcon, underline, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
14
15
  export default Button;
@@ -1,8 +1,4 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import styled from "styled-components";
3
- import { ButtonStyle } from "./shared";
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, {})] }) }));
2
+ import { BaseButton } from "./shared";
3
+ const Button = ({ text, onClick, disabled, LeftIcon, RightIcon, underline, backgroundColor, color, type = "button", }) => (_jsx("button", { type: type, onClick: onClick, disabled: disabled, children: _jsxs(BaseButton, { "$underline": underline, "$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
4
  export default Button;
6
- const BaseButton = styled.div `
7
- ${ButtonStyle}
8
- `;
@@ -7,6 +7,7 @@ type LinkButtonProps = {
7
7
  target?: HTMLAttributeAnchorTarget;
8
8
  LeftIcon?: ComponentType<Icons.IconProps>;
9
9
  RightIcon?: ComponentType<Icons.IconProps>;
10
+ underline?: boolean;
10
11
  backgroundColor?: string;
11
12
  color?: string;
12
13
  };
@@ -11,14 +11,10 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import Link from "next/link";
14
- import styled from "styled-components";
15
- import { ButtonStyle } from "./shared";
14
+ import { BaseButton } from "./shared";
16
15
  const LinkButton = (_a) => {
17
16
  var { href, target, disabled } = _a, contentProps = __rest(_a, ["href", "target", "disabled"]);
18
17
  return disabled ? (_jsx(Content, Object.assign({}, contentProps))) : (_jsx(Link, { href: href, target: target, children: _jsx(Content, Object.assign({}, contentProps)) }));
19
18
  };
20
19
  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, {})] }));
22
- const BaseLinkButton = styled.div `
23
- ${ButtonStyle}
24
- `;
20
+ const Content = ({ text, LeftIcon, RightIcon, underline, backgroundColor, color, }) => (_jsxs(BaseButton, { "$underline": underline, "$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, {})] }));
@@ -1,4 +1,5 @@
1
- export declare const ButtonStyle: import("styled-components").RuleSet<{
1
+ export declare const BaseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
2
+ $underline?: boolean;
2
3
  $backgroundColor?: string;
3
4
  $color?: string;
4
- }>;
5
+ }>> & string;
@@ -1,6 +1,6 @@
1
- import { css } from "styled-components";
1
+ import styled from "styled-components";
2
2
  import { Colors } from "../foundations";
3
- export const ButtonStyle = css `
3
+ export const BaseButton = styled.div `
4
4
  display: flex;
5
5
  justify-content: center;
6
6
  align-items: center;
@@ -12,6 +12,8 @@ export const ButtonStyle = css `
12
12
  font-weight: 500;
13
13
  font-size: 14px;
14
14
 
15
+ text-decoration: ${({ $underline = false }) => $underline ? "underline" : "none"};
16
+
15
17
  color: ${({ $color = Colors.typography.whiteHigh }) => $color};
16
- background-color: ${({ $backgroundColor = Colors.main.grantbiiBlue }) => $backgroundColor};
18
+ background-color: ${({ $underline = false, $backgroundColor = Colors.main.grantbiiBlue, }) => ($underline ? "transparent" : $backgroundColor)};
17
19
  `;
@@ -1,6 +1,6 @@
1
1
  import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
2
  import { Option } from "../foundations";
3
- type RadioOption = Option & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
3
+ export type RadioOption = Option & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4
4
  type RadioButtonProps = {
5
5
  name: string;
6
6
  options: RadioOption[];
@@ -1,2 +1,2 @@
1
1
  export { default as Modal, useModal } from "./Modal";
2
- export { default as RadioButtons } from "./RadioButtons";
2
+ export { default as RadioButtons, type RadioOption } from "./RadioButtons";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -7,3 +7,4 @@ export declare const TextOnly: Story;
7
7
  export declare const LeftIcon: Story;
8
8
  export declare const RightIcon: Story;
9
9
  export declare const BothIcons: Story;
10
+ export declare const Underline: Story;
@@ -1,4 +1,4 @@
1
- import { Button, Icons } from "@/.";
1
+ import { Button, Colors, Icons } from "@/.";
2
2
  const meta = {
3
3
  title: "Atoms/Button",
4
4
  component: Button,
@@ -24,3 +24,6 @@ export const RightIcon = {
24
24
  export const BothIcons = {
25
25
  args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
26
26
  };
27
+ export const Underline = {
28
+ args: Object.assign(Object.assign({}, baseArgs), { underline: true, color: Colors.typography.blackMedium }),
29
+ };
@@ -7,3 +7,4 @@ export declare const TextOnly: Story;
7
7
  export declare const LeftIcon: Story;
8
8
  export declare const RightIcon: Story;
9
9
  export declare const BothIcons: Story;
10
+ export declare const Underline: Story;
@@ -1,4 +1,4 @@
1
- import { Icons, LinkButton } from "@/.";
1
+ import { Colors, Icons, LinkButton } from "@/.";
2
2
  const meta = {
3
3
  title: "Atoms/LinkButton",
4
4
  component: LinkButton,
@@ -25,3 +25,6 @@ export const RightIcon = {
25
25
  export const BothIcons = {
26
26
  args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
27
27
  };
28
+ export const Underline = {
29
+ args: Object.assign(Object.assign({}, baseArgs), { underline: true, color: Colors.typography.blackMedium }),
30
+ };
@@ -3,4 +3,5 @@ import { Meta, StoryObj } from "@storybook/nextjs-vite";
3
3
  declare const meta: Meta<typeof RadioButtons>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
- export declare const TextOnly: Story;
6
+ export declare const NoneSelectedByDefault: Story;
7
+ export declare const OneSelectedByDefault: Story;
@@ -8,7 +8,7 @@ const meta = {
8
8
  },
9
9
  };
10
10
  export default meta;
11
- export const TextOnly = {
11
+ export const NoneSelectedByDefault = {
12
12
  args: {
13
13
  name: "location ",
14
14
  options: [
@@ -25,3 +25,21 @@ export const TextOnly = {
25
25
  ],
26
26
  },
27
27
  };
28
+ export const OneSelectedByDefault = {
29
+ args: {
30
+ name: "location ",
31
+ options: [
32
+ {
33
+ label: "Singapore",
34
+ value: "Singapore",
35
+ onChange: () => alert("Selected Singapore!"),
36
+ defaultChecked: true,
37
+ },
38
+ {
39
+ label: "Hong Kong",
40
+ value: "Hong Kong",
41
+ onChange: () => alert("Selected Hong Kong!"),
42
+ },
43
+ ],
44
+ },
45
+ };