Skip to content

Commit 140bc7f

Browse files
committed
Fix merge conflict
2 parents 40a8f87 + 1b8872f commit 140bc7f

File tree

10 files changed

+74
-29
lines changed

10 files changed

+74
-29
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.43.0",
3+
"version": "1.49.0",
44
"description": "A library of frontend components used by TableFlow",
55
"repository": {
66
"type": "git",

src/Button/style/Button.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
}
5858

5959
&:is([disabled]) {
60-
background-color: var(--color-primary-disabled);
61-
color: var(--color-text-on-primary-disabled);
60+
background-color: var(--color-primary-button-disabled);
61+
color: var(--color-text-on-primary-button-disabled);
6262
}
6363
}
6464

src/Checkbox/style/Checkbox.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.container {
22
display: inline-block;
3-
display: flex;
43
gap: var(--m-xs);
54
align-items: center;
65

src/Stepper/index.tsx

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@ import style from "./style/Stepper.module.scss";
44
import Icon from "../Icon";
55

66
export default function Stepper({ steps, current, clickable, setCurrent }: StepperProps) {
7-
return (
8-
<div className={style.stepper}>
9-
{steps.map((step, i) => {
10-
const done = i < current;
7+
return (
8+
<div className={style.stepper}>
9+
{steps.map((step, i) => {
10+
const done = i < current;
1111

12-
const Element = clickable ? "button" : "div";
12+
const Element = clickable ? "button" : "div";
1313

14-
const buttonProps: any = clickable
15-
? {
16-
onClick: () => setCurrent(i),
17-
type: "button",
18-
}
19-
: {};
14+
const buttonProps: any = clickable
15+
? {
16+
onClick: () => setCurrent(i),
17+
type: "button",
18+
}
19+
: {};
2020

21-
return (
22-
<Element key={i} className={classes([style.step, i === current ? style.active : done && style.done])} {...buttonProps}>
23-
<div className={style.badge}>{done ? <Icon icon="check" /> : i + 1}</div>
24-
<div className={style.label}>{step.label}</div>
25-
</Element>
26-
);
27-
})}
28-
</div>
29-
);
21+
return (
22+
<Element
23+
key={i}
24+
className={classes([style.step, i === current ? style.active : done && style.done, steps.length < 4 && style.stepWide])}
25+
{...buttonProps}>
26+
<div className={style.badge}>{done ? <Icon icon="check" /> : i + 1}</div>
27+
<div className={style.label}>{step.label}</div>
28+
</Element>
29+
);
30+
})}
31+
</div>
32+
);
3033
}

src/Stepper/style/Stepper.module.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,20 @@
4444
&:not(:first-of-type) {
4545
&:before {
4646
content: "";
47-
height: 2px;
48-
width: min(140px, 10vw);
47+
height: 1px;
48+
width: min(140px, 4vw);
4949
background-color: var(--color-border);
5050
border-radius: 2px;
5151
margin-right: var(--m-xs);
5252
}
5353
}
5454
}
55+
56+
.stepWide {
57+
&:not(:first-of-type) {
58+
&:before {
59+
width: min(120px, 10vw);
60+
}
61+
}
62+
}
5563
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { ComponentMeta, ComponentStory } from "@storybook/react";
2+
import { StepperProps } from ".";
3+
import Stepper from "..";
4+
5+
const steps = [
6+
{ label: "Upload", id: "upload" },
7+
{ label: "Select Header Row", id: "row-selection" },
8+
{ label: "Review", id: "review" },
9+
{ label: "Complete", id: "complete" },
10+
];
11+
12+
export default {
13+
title: "User Interface/Stepper",
14+
component: Stepper,
15+
argTypes: {},
16+
} as ComponentMeta<typeof Stepper>;
17+
18+
const Template: ComponentStory<typeof Stepper> = (args: StepperProps) => {
19+
return (
20+
<div style={{ textAlign: "left" }}>
21+
<Stepper {...args} />
22+
</div>
23+
);
24+
};
25+
26+
export const Default = Template.bind({});
27+
Default.args = {
28+
steps,
29+
};

src/Table/Table.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ Table.args = {
2424
hideColumns: ["id"],
2525
fixHeader: true,
2626
};
27+
Table.args.onRowClick = (row: any) => console.log("Row clicked", row);

src/Table/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default function Table({
1818
columnWidths = [],
1919
columnAlignments = [],
2020
fixHeader = false,
21+
onRowClick,
2122
}: TableProps): React.ReactElement {
2223
// THEME
2324
// Tables receive a full CSS module as theme or applies default styles
@@ -60,7 +61,7 @@ export default function Table({
6061
<div className={style.tbody} role="rowgroup">
6162
{data.map((d, i) => {
6263
const key = keyAsId && d?.[keyAsId] ? d[keyAsId] : i;
63-
const props = { datum: d };
64+
const props = { datum: d, onClick: onRowClick };
6465
return <Row {...props} key={key?.toString()} />;
6566
})}
6667
</div>
@@ -74,13 +75,13 @@ export default function Table({
7475
);
7576
}
7677

77-
const Row = ({ datum }: RowProps) => {
78+
const Row = ({ datum, onClick }: RowProps) => {
7879
const { style, highlightColumns, hideColumns, columnWidths, columnAlignments } = useContext(TableContext);
7980

8081
const className = classes([style?.tr]);
8182

8283
return (
83-
<div className={className} role="row">
84+
<div className={className} role="row" onClick={() => onClick?.(datum)}>
8485
{Object.keys(datum)
8586
.filter((k) => !hideColumns.includes(datum[k]) && !hideColumns.includes(k))
8687
.map((k, i) => {

src/Table/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ export type TableProps = {
3131
columnWidths?: string[];
3232
columnAlignments?: ("left" | "center" | "right" | "")[];
3333
fixHeader?: boolean;
34+
onRowClick?: (row: TableDatum) => void;
3435
};
3536

3637
export type RowProps = {
3738
datum: TableDatum;
3839
isHeading?: boolean;
40+
onClick?: (row: TableDatum) => void;
3941
};
4042

4143
export type CellProps = PropsWithChildren<{

src/style/themes/common.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--color-primary-hover: #{$primary-700};
66
--color-primary-focus: #{$primary-600};
77
--color-primary-disabled: #{$primary-200};
8+
--color-primary-button-disabled: #3f3b55;
89

910
--color-secondary: #{$gray-800};
1011
--color-secondary-hover: #{$gray-600};
@@ -15,6 +16,7 @@
1516

1617
--color-text-on-primary: #{$base-white};
1718
--color-text-on-primary-disabled: #{$gray-500};
19+
--color-text-on-primary-button-disabled: #{$base-white};
1820

1921
--color-text-on-secondary: #{$gray-100};
2022
--color-text-on-secondary-disabled: #{$gray-600};

0 commit comments

Comments
 (0)