@grantbii/design-system 1.0.48 → 1.0.49
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/Checkbox.d.ts +7 -0
- package/core/atoms/Checkbox.js +18 -0
- package/core/atoms/RadioButton.d.ts +1 -1
- package/core/atoms/RadioButton.js +3 -7
- package/core/atoms/index.d.ts +1 -0
- package/core/atoms/index.js +1 -0
- package/core/atoms/shared.d.ts +1 -0
- package/core/atoms/shared.js +5 -0
- package/core/molecules/RadioButtons.js +1 -0
- package/package.json +1 -1
- package/stories/atoms/Checkbox.stories.d.ts +7 -0
- package/stories/atoms/Checkbox.stories.js +23 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
2
|
+
type CheckboxProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
labelBefore?: boolean;
|
|
5
|
+
} & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
6
|
+
declare const Checkbox: ({ id, label, labelBefore, ...checkboxProps }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Checkbox;
|
|
@@ -0,0 +1,18 @@
|
|
|
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";
|
|
13
|
+
import { LabelInput } from "./shared";
|
|
14
|
+
const Checkbox = (_a) => {
|
|
15
|
+
var { id, label, labelBefore = false } = _a, checkboxProps = __rest(_a, ["id", "label", "labelBefore"]);
|
|
16
|
+
return (_jsxs(LabelInput, { children: [labelBefore ? _jsx("label", { htmlFor: `${id}-checkbox`, children: label }) : _jsx(_Fragment, {}), _jsx("input", Object.assign({}, checkboxProps, { id: `${id}-checkbox`, type: "checkbox" })), labelBefore ? _jsx(_Fragment, {}) : _jsx("label", { htmlFor: `${id}-checkbox`, children: label })] }));
|
|
17
|
+
};
|
|
18
|
+
export default Checkbox;
|
|
@@ -2,5 +2,5 @@ import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
|
2
2
|
type RadioButtonProps = {
|
|
3
3
|
label: string;
|
|
4
4
|
} & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
5
|
-
declare const RadioButton: ({
|
|
5
|
+
declare const RadioButton: ({ id, label, ...radioButtonProps }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default RadioButton;
|
|
@@ -10,13 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
13
|
+
import { LabelInput } from "./shared";
|
|
14
14
|
const RadioButton = (_a) => {
|
|
15
|
-
var {
|
|
16
|
-
return (_jsxs(
|
|
15
|
+
var { id, label } = _a, radioButtonProps = __rest(_a, ["id", "label"]);
|
|
16
|
+
return (_jsxs(LabelInput, { children: [_jsx("input", Object.assign({}, radioButtonProps, { id: `${id}-radio-button`, type: "radio" })), _jsx("label", { htmlFor: `${id}-radio-button`, children: label })] }));
|
|
17
17
|
};
|
|
18
18
|
export default RadioButton;
|
|
19
|
-
const BaseRadioButton = styled.div `
|
|
20
|
-
display: flex;
|
|
21
|
-
gap: 8px;
|
|
22
|
-
`;
|
package/core/atoms/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Badge } from "./Badge";
|
|
2
2
|
export { default as BrandLogo } from "./BrandLogo";
|
|
3
3
|
export { default as Button } from "./Button";
|
|
4
|
+
export { default as Checkbox } from "./Checkbox";
|
|
4
5
|
export { default as LinkButton } from "./LinkButton";
|
|
5
6
|
export { default as RadioButton } from "./RadioButton";
|
|
6
7
|
export { default as Textarea } from "./Textarea";
|
package/core/atoms/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Badge } from "./Badge";
|
|
2
2
|
export { default as BrandLogo } from "./BrandLogo";
|
|
3
3
|
export { default as Button } from "./Button";
|
|
4
|
+
export { default as Checkbox } from "./Checkbox";
|
|
4
5
|
export { default as LinkButton } from "./LinkButton";
|
|
5
6
|
export { default as RadioButton } from "./RadioButton";
|
|
6
7
|
export { default as Textarea } from "./Textarea";
|
package/core/atoms/shared.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export declare const BaseButton: import("styled-components/dist/types").IStyledC
|
|
|
3
3
|
$backgroundColor?: string;
|
|
4
4
|
$color?: string;
|
|
5
5
|
}>> & string;
|
|
6
|
+
export declare const LabelInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
package/core/atoms/shared.js
CHANGED
|
@@ -17,3 +17,8 @@ export const BaseButton = styled.div `
|
|
|
17
17
|
color: ${({ $color = Colors.typography.whiteHigh }) => $color};
|
|
18
18
|
background-color: ${({ $underline = false, $backgroundColor = Colors.main.grantbiiBlue, }) => ($underline ? "transparent" : $backgroundColor)};
|
|
19
19
|
`;
|
|
20
|
+
export const LabelInput = styled.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 8px;
|
|
24
|
+
`;
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Checkbox } from "@/.";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
3
|
+
declare const meta: Meta<typeof Checkbox>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const LabelBefore: Story;
|
|
7
|
+
export declare const LabelAfter: Story;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Checkbox } from "@/.";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Atoms/Checkbox",
|
|
4
|
+
component: Checkbox,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "centered",
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
const label = "Grantbii is the best";
|
|
12
|
+
export const LabelBefore = {
|
|
13
|
+
args: {
|
|
14
|
+
label,
|
|
15
|
+
labelBefore: true,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const LabelAfter = {
|
|
19
|
+
args: {
|
|
20
|
+
label,
|
|
21
|
+
labelBefore: false,
|
|
22
|
+
},
|
|
23
|
+
};
|