Skip to content

Commit 54d2ecb

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/table-scroll
# Conflicts: # src/Table/style/Default.module.scss
2 parents 68d8139 + 68a6fde commit 54d2ecb

14 files changed

+479
-345
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tableflow/ui-library",
3-
"version": "1.46.0",
3+
"version": "1.51.0",
44
"description": "A library of frontend components used by TableFlow",
55
"repository": {
66
"type": "git",

src/Checkbox/Checkbox.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { ComponentMeta, ComponentStory } from "@storybook/react";
2+
import { iconsArray } from "../Icon/types";
3+
import CheckboxComponent from ".";
4+
import { CheckboxProps } from "./types";
5+
6+
export default {
7+
title: "User Interface/Checkbox",
8+
component: CheckboxComponent,
9+
} as ComponentMeta<typeof CheckboxComponent>;
10+
11+
const Template: ComponentStory<typeof CheckboxComponent> = (args: CheckboxProps) => <CheckboxComponent {...args} />;
12+
13+
export const Checkbox = Template.bind({});
14+
Checkbox.args = {
15+
label: "Text",
16+
disabled: false,
17+
};

src/Checkbox/index.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import classes from "../utils/classes";
2+
import { CheckboxProps } from "./types";
3+
import style from "./style/Checkbox.module.scss";
4+
5+
export default function Checkbox({ label, className, ...props }: CheckboxProps) {
6+
const containerClasses = classes([style.container, className]);
7+
8+
return (
9+
<label className={containerClasses}>
10+
<input type="checkbox" {...props} />
11+
<span>{label}</span>
12+
</label>
13+
);
14+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.container {
2+
display: inline-block;
3+
gap: var(--m-xs);
4+
align-items: center;
5+
6+
&:has(input:not(:disabled)) {
7+
cursor: pointer;
8+
}
9+
10+
input[type="checkbox"] {
11+
-webkit-appearance: none;
12+
appearance: none;
13+
background-color: transparent;
14+
margin: 0;
15+
color: var(--color-primary);
16+
width: var(--m);
17+
height: var(--m);
18+
border: 2px solid var(--color-border);
19+
display: grid;
20+
place-content: center;
21+
border-radius: var(--border-radius-1);
22+
cursor: pointer;
23+
24+
&::before {
25+
content: "";
26+
width: var(--m-xs);
27+
height: var(--m-xs);
28+
}
29+
30+
&:checked {
31+
background-color: var(--color-primary);
32+
border-color: var(--color-primary);
33+
}
34+
35+
&:checked::before {
36+
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
37+
box-shadow: inset 1em 1em var(--color-text-on-primary);
38+
}
39+
40+
&:not(:disabled) {
41+
&:focus-visible {
42+
outline: 1px solid var(--color-border);
43+
outline-offset: 3px;
44+
}
45+
}
46+
47+
&:disabled {
48+
--container-color: var(--container-disabled);
49+
color: var(--container-disabled);
50+
cursor: default;
51+
background-color: var(--color-input-disabled);
52+
border-color: var(--color-border-soft);
53+
54+
&:checked {
55+
&::before {
56+
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
57+
box-shadow: inset 1em 1em var(--color-border-soft);
58+
}
59+
}
60+
}
61+
}
62+
}

src/Checkbox/types/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { InputHTMLAttributes, ReactElement } from "react";
2+
3+
export type CheckboxProps = InputHTMLAttributes<HTMLInputElement> & {
4+
label?: string | ReactElement;
5+
};

src/Input/Input.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,6 @@ Dropdown.args = {
135135
"Option III": { value: "3" },
136136
"Option IV": { value: "4" },
137137
"Option V": { value: "5" },
138-
"Option V": { value: "required", required: true },
138+
"Option VI": { value: "required", required: true },
139139
},
140140
};

0 commit comments

Comments
 (0)