@grantbii/design-system 1.0.40 → 1.0.41

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,6 @@
1
+ import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
+ type RadioButtonProps = {
3
+ label: string;
4
+ } & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
5
+ declare const RadioButton: ({ label, id, ...radioButtonProps }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default RadioButton;
@@ -0,0 +1,22 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import styled from "styled-components";
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, type: "radio" })), _jsx("label", { htmlFor: id, children: label })] }));
17
+ };
18
+ export default RadioButton;
19
+ const BaseRadioButton = styled.div `
20
+ display: flex;
21
+ gap: 8px;
22
+ `;
@@ -2,3 +2,4 @@ export { default as Badge } from "./Badge";
2
2
  export { default as BrandLogo } from "./BrandLogo";
3
3
  export { default as Button } from "./Button";
4
4
  export { default as LinkButton } from "./LinkButton";
5
+ export { default as RadioButton } from "./RadioButton";
@@ -2,3 +2,4 @@ export { default as Badge } from "./Badge";
2
2
  export { default as BrandLogo } from "./BrandLogo";
3
3
  export { default as Button } from "./Button";
4
4
  export { default as LinkButton } from "./LinkButton";
5
+ export { default as RadioButton } from "./RadioButton";
@@ -2,3 +2,4 @@ export * as Icons from "@phosphor-icons/react";
2
2
  export * as Flags from "country-flag-icons/react/3x2";
3
3
  export * as Breakpoints from "./breakpoints";
4
4
  export * as Colors from "./colors";
5
+ export type * from "./types";
@@ -0,0 +1,4 @@
1
+ export type Option = {
2
+ label: string;
3
+ value: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -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, { 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: _jsx(ModalContent, { 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);
@@ -30,7 +30,7 @@ export const useModal = () => {
30
30
  const Overlay = styled.div `
31
31
  background-color: ${Colors.semantic.overlay};
32
32
 
33
- z-index: ${Number.MAX_SAFE_INTEGER};
33
+ z-index: ${({ $isFullScreen }) => $isFullScreen ? Number.MAX_SAFE_INTEGER - 1 : Number.MAX_SAFE_INTEGER};
34
34
  position: fixed;
35
35
  top: 0px;
36
36
  left: 0px;
@@ -0,0 +1,7 @@
1
+ import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
+ import { Option } from "../foundations";
3
+ type RadioButtonProps = {
4
+ options: Option[];
5
+ } & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
6
+ declare const RadioButtons: ({ options, name, ...radioButtonProps }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default RadioButtons;
@@ -0,0 +1,24 @@
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 { createElement as _createElement } from "react";
14
+ import styled from "styled-components";
15
+ import { RadioButton } from "../atoms";
16
+ const RadioButtons = (_a) => {
17
+ var { options, name } = _a, radioButtonProps = __rest(_a, ["options", "name"]);
18
+ return (_jsx(RadioGroup, { children: options.map(({ label, value }) => (_createElement(RadioButton, Object.assign({}, radioButtonProps, { key: `${name}-radio-button`, id: `${name}-radio-button`, name: name, label: label, value: value })))) }));
19
+ };
20
+ export default RadioButtons;
21
+ const RadioGroup = styled.div `
22
+ display: flex;
23
+ gap: 12px;
24
+ `;
@@ -1 +1,2 @@
1
1
  export { default as Modal, useModal } from "./Modal";
2
+ export { default as RadioButtons } from "./RadioButtons";
@@ -1 +1,2 @@
1
1
  export { default as Modal, useModal } from "./Modal";
2
+ export { default as RadioButtons } from "./RadioButtons";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -1,6 +1,5 @@
1
1
  import { Badge } from "@/.";
2
- import type { StoryObj } from "@storybook/nextjs-vite";
3
- import { Meta } from "@storybook/nextjs-vite";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
4
3
  declare const meta: Meta<typeof Badge>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof meta>;
@@ -1,6 +1,5 @@
1
1
  import { BrandLogo } from "@/.";
2
- import type { StoryObj } from "@storybook/nextjs-vite";
3
- import { Meta } from "@storybook/nextjs-vite";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
4
3
  declare const meta: Meta<typeof BrandLogo>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof meta>;
@@ -1,6 +1,5 @@
1
1
  import { Button } from "@/.";
2
- import type { StoryObj } from "@storybook/nextjs-vite";
3
- import { Meta } from "@storybook/nextjs-vite";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
4
3
  declare const meta: Meta<typeof Button>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof meta>;
@@ -1,6 +1,5 @@
1
1
  import { LinkButton } from "@/.";
2
- import type { StoryObj } from "@storybook/nextjs-vite";
3
- import { Meta } from "@storybook/nextjs-vite";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
4
3
  declare const meta: Meta<typeof LinkButton>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof meta>;
@@ -1,5 +1,4 @@
1
- import type { StoryObj } from "@storybook/nextjs-vite";
2
- import { Meta } from "@storybook/nextjs-vite";
1
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
3
2
  import { ReactNode } from "react";
4
3
  type ModalExampleProps = {
5
4
  header?: ReactNode;
@@ -0,0 +1,6 @@
1
+ import { RadioButtons } from "@/core/molecules";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
3
+ declare const meta: Meta<typeof RadioButtons>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const TextOnly: Story;
@@ -0,0 +1,19 @@
1
+ import { RadioButtons } from "@/core/molecules";
2
+ const meta = {
3
+ title: "Molecules/Radio Buttons",
4
+ component: RadioButtons,
5
+ tags: ["autodocs"],
6
+ parameters: {
7
+ layout: "centered",
8
+ },
9
+ };
10
+ export default meta;
11
+ export const TextOnly = {
12
+ args: {
13
+ name: "location ",
14
+ options: [
15
+ { label: "Singapore", value: "Singapore" },
16
+ { label: "Hong Kong", value: "Hong Kong" },
17
+ ],
18
+ },
19
+ };