@grantbii/design-system 1.0.40 → 1.0.42
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/RadioButton.d.ts +6 -0
- package/core/atoms/RadioButton.js +22 -0
- package/core/atoms/index.d.ts +1 -0
- package/core/atoms/index.js +1 -0
- package/core/foundations/index.d.ts +1 -0
- package/core/foundations/types.d.ts +4 -0
- package/core/foundations/types.js +1 -0
- package/core/molecules/Modal.js +2 -2
- package/core/molecules/RadioButtons.d.ts +9 -0
- package/core/molecules/RadioButtons.js +26 -0
- package/core/molecules/index.d.ts +1 -0
- package/core/molecules/index.js +1 -0
- package/package.json +1 -1
- package/stories/atoms/Badge.stories.d.ts +1 -2
- package/stories/atoms/BrandLogo.stories.d.ts +1 -2
- package/stories/atoms/Button.stories.d.ts +1 -2
- package/stories/atoms/LinkButton.stories.d.ts +1 -2
- package/stories/molecules/Modal.stories.d.ts +1 -2
- package/stories/molecules/RadioButtons.stories.d.ts +6 -0
- package/stories/molecules/RadioButtons.stories.js +27 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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
|
+
`;
|
package/core/atoms/index.d.ts
CHANGED
package/core/atoms/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/core/molecules/Modal.js
CHANGED
|
@@ -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,9 @@
|
|
|
1
|
+
import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
2
|
+
import { Option } from "../foundations";
|
|
3
|
+
type RadioOption = Option & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
|
+
type RadioButtonProps = {
|
|
5
|
+
name: string;
|
|
6
|
+
options: RadioOption[];
|
|
7
|
+
};
|
|
8
|
+
declare const RadioButtons: ({ name, options }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default RadioButtons;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 = ({ name, options }) => {
|
|
17
|
+
return (_jsx(RadioGroup, { children: options.map((_a) => {
|
|
18
|
+
var { value } = _a, props = __rest(_a, ["value"]);
|
|
19
|
+
return (_createElement(RadioButton, Object.assign({}, props, { key: `${value}-radio-button`, id: `${value}-radio-button`, value: value, name: name })));
|
|
20
|
+
}) }));
|
|
21
|
+
};
|
|
22
|
+
export default RadioButtons;
|
|
23
|
+
const RadioGroup = styled.div `
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 12px;
|
|
26
|
+
`;
|
package/core/molecules/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Badge } from "@/.";
|
|
2
|
-
import
|
|
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
|
|
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
|
|
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
|
|
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>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
{
|
|
16
|
+
label: "Singapore",
|
|
17
|
+
value: "Singapore",
|
|
18
|
+
onChange: () => alert("Selected Singapore!"),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Hong Kong",
|
|
22
|
+
value: "Hong Kong",
|
|
23
|
+
onChange: () => alert("Selected Hong Kong!"),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
};
|