Skip to content

Commit 9a5a41e

Browse files
committed
update dependencies
1 parent 4945434 commit 9a5a41e

File tree

23 files changed

+2245
-1984
lines changed

23 files changed

+2245
-1984
lines changed

package.json

+36-36
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@
1212
"check": "biome check --no-errors-on-unmatched"
1313
},
1414
"dependencies": {
15-
"@fortawesome/fontawesome-svg-core": "^6.5.2",
16-
"@fortawesome/free-brands-svg-icons": "^6.5.2",
17-
"@fortawesome/free-regular-svg-icons": "^6.5.2",
18-
"@fortawesome/free-solid-svg-icons": "^6.5.2",
19-
"@fortawesome/react-fontawesome": "^0.2.0",
20-
"@generouted/react-router": "^1.18.6",
21-
"@pandacss/dev": "^0.37.2",
22-
"@radix-ui/primitive": "^1.0.1",
23-
"@radix-ui/react-checkbox": "^1.0.4",
24-
"@radix-ui/react-collapsible": "^1.0.3",
25-
"@radix-ui/react-context": "^1.0.1",
26-
"@radix-ui/react-dialog": "^1.0.5",
27-
"@radix-ui/react-popover": "^1.0.7",
28-
"@radix-ui/react-select": "^2.0.0",
29-
"@radix-ui/react-slot": "^1.0.2",
30-
"@radix-ui/react-tabs": "^1.0.4",
31-
"@radix-ui/react-toggle": "^1.0.3",
32-
"@radix-ui/react-tooltip": "^1.0.7",
33-
"@radix-ui/react-use-controllable-state": "^1.0.1",
34-
"@tanstack/react-form": "^0.19.0",
35-
"@tanstack/react-table": "^8.15.3",
36-
"@tanstack/valibot-form-adapter": "^0.19.0",
37-
"echarts": "^5.5.0",
38-
"fast-xml-parser": "^4.3.6",
15+
"@fortawesome/fontawesome-svg-core": "^6.6.0",
16+
"@fortawesome/free-brands-svg-icons": "^6.6.0",
17+
"@fortawesome/free-regular-svg-icons": "^6.6.0",
18+
"@fortawesome/free-solid-svg-icons": "^6.6.0",
19+
"@fortawesome/react-fontawesome": "^0.2.2",
20+
"@generouted/react-router": "^1.19.6",
21+
"@pandacss/dev": "^0.46.1",
22+
"@radix-ui/primitive": "^1.1.0",
23+
"@radix-ui/react-checkbox": "^1.1.1",
24+
"@radix-ui/react-collapsible": "^1.1.0",
25+
"@radix-ui/react-context": "^1.1.0",
26+
"@radix-ui/react-dialog": "^1.1.1",
27+
"@radix-ui/react-popover": "^1.1.1",
28+
"@radix-ui/react-select": "^2.1.1",
29+
"@radix-ui/react-slot": "^1.1.0",
30+
"@radix-ui/react-tabs": "^1.1.0",
31+
"@radix-ui/react-toggle": "^1.1.0",
32+
"@radix-ui/react-tooltip": "^1.1.2",
33+
"@radix-ui/react-use-controllable-state": "^1.1.0",
34+
"@tanstack/react-form": "^0.33.0",
35+
"@tanstack/react-table": "^8.20.5",
36+
"@tanstack/valibot-form-adapter": "^0.33.0",
37+
"echarts": "^5.5.1",
38+
"fast-xml-parser": "^4.5.0",
3939
"file-saver": "^2.0.5",
4040
"jszip": "^3.10.1",
4141
"pako": "^2.1.0",
4242
"prompts": "^2.4.2",
43-
"react": "^18.2.0",
44-
"react-dom": "^18.2.0",
43+
"react": "^18.3.1",
44+
"react-dom": "^18.3.1",
4545
"react-dropzone": "^14.2.3",
46-
"react-router-dom": "^6.22.3",
46+
"react-router-dom": "^6.26.2",
4747
"slugify": "^1.6.6",
48-
"valibot": "^0.30.0"
48+
"valibot": "^0.42.1"
4949
},
5050
"devDependencies": {
5151
"@biomejs/biome": "1.9.2",
5252
"@types/file-saver": "^2.0.7",
53-
"@types/node": "^20.12.5",
53+
"@types/node": "^20.16.10",
5454
"@types/pako": "^2.0.3",
55-
"@types/react": "^18.2.74",
56-
"@types/react-dom": "^18.2.24",
57-
"@vitejs/plugin-react": "^4.2.1",
58-
"lefthook": "^1.7.16",
59-
"typescript": "^5.4.4",
60-
"vite": "^5.2.8",
61-
"vitest": "^1.4.0"
55+
"@types/react": "^18.3.10",
56+
"@types/react-dom": "^18.3.0",
57+
"@vitejs/plugin-react": "^4.3.2",
58+
"lefthook": "^1.7.18",
59+
"typescript": "^5.6.2",
60+
"vite": "^5.4.8",
61+
"vitest": "^2.1.1"
6262
},
6363
"engines": {
6464
"node": ">=18"

src/components/ui/builders/Dialog/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const Content = createPrimitive<typeof Primitive.Content>(Primitive.Content, (El
1616
);
1717
});
1818

19+
const Title = Primitive.Title;
20+
1921
const cn = {
2022
portal: css({
2123
"&[data-lock-scroll]": {
@@ -32,4 +34,4 @@ const cn = {
3234
content: css({}),
3335
};
3436

35-
export { Content, Root, Trigger };
37+
export { Content, Root, Title, Trigger };

src/components/ui/molecules/Dialog/index.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ import { Dialog as Builder } from "$/components/ui/builders";
22
import { RenderProps } from "$/types";
33
import { ComponentPropsWithoutRef } from "react";
44
import { css } from "styled-system/css";
5+
import { visuallyHidden } from "styled-system/patterns";
56

6-
interface Props extends ComponentPropsWithoutRef<typeof Builder.Root> {}
7+
interface Props extends ComponentPropsWithoutRef<typeof Builder.Root> {
8+
title: string;
9+
}
710

8-
function Component({ render, children, ...rest }: Props & RenderProps<{ close: (props?: Props) => void }>) {
11+
function Component({ title, render, children, ...rest }: Props & RenderProps<{ close: (props?: Props) => void }>) {
912
return (
1013
<Builder.Root {...rest}>
1114
<Builder.Trigger asChild>{children}</Builder.Trigger>
12-
<Builder.Content className={cn.content}>{render({ close })}</Builder.Content>
15+
<Builder.Content className={cn.content}>
16+
<Builder.Title className={visuallyHidden()}>{title}</Builder.Title>
17+
{render({ close })}
18+
</Builder.Content>
1319
</Builder.Root>
1420
);
1521
}

src/components/ui/organisms/Actions/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Icon } from "$/components/ui/atoms";
22
import { IconProp } from "@fortawesome/fontawesome-svg-core";
3-
import { ExoticComponent, Fragment, HTMLAttributes, PropsWithChildren, ReactNode, useMemo } from "react";
3+
import { ComponentProps, Fragment, PropsWithChildren, ReactNode, useMemo } from "react";
44
import { hstack } from "styled-system/patterns";
55

66
interface Item {
77
icon: IconProp;
88
condition?: () => boolean;
9-
render: <Props = HTMLAttributes<HTMLElement>>(icon: ExoticComponent<Props>, props: Props) => ReactNode;
9+
render: (icon: typeof Icon, props: ComponentProps<typeof Icon>) => ReactNode;
1010
}
1111
interface Props {
1212
items: Record<string, Item>;
@@ -19,7 +19,7 @@ function Component({ items, spacing = 2 }: PropsWithChildren<Props>) {
1919
<div className={cn.row} style={{ gap: `${spacing / 4}em` }}>
2020
{entries.map(([key, { icon, render, condition }]) => {
2121
if (condition && !condition()) return;
22-
return <Fragment key={key}>{render(Icon, { key, icon: icon })}</Fragment>;
22+
return <Fragment key={key}>{render(Icon, { icon: icon })}</Fragment>;
2323
})}
2424
</div>
2525
);

src/components/ui/organisms/Content/nav.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default function Nav({ layout = "basic" }: Props) {
8787
<div className={cn.row}>
8888
{layout !== "level" && (
8989
<Fragment>
90-
<Dialog render={({ close }) => <ManualDatasetForm onSubmit={() => close()} />}>
90+
<Dialog title="Create Dataset" render={({ close }) => <ManualDatasetForm onSubmit={() => close()} />}>
9191
<Icon icon={faAdd} variant="primary" title="Create Dataset" className={cx(cn.icon)} />
9292
</Dialog>
9393
<Input asChild type="file" id="file" accept="application/json,text/plain" onChange={handleImport} multiple>

src/components/ui/organisms/DatasetTable/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ function Component({ id, data }: Props) {
103103
<ToggleRow table={table} fields={fields.dataset} />
104104
<Pagination id={id} table={table} />
105105
<div className={cn.row}>
106-
<Dialog render={({ close }) => <ManualDataForm onSubmit={(x) => handleSubmit([x], close)} />}>
106+
<Dialog title="Add Entry" render={({ close }) => <ManualDataForm onSubmit={(x) => handleSubmit([x], close)} />}>
107107
<Button title="Add Entry">
108108
<Icon icon={faAdd} />
109109
</Button>
110110
</Dialog>
111-
<Dialog render={({ close }) => <ArchiveDataForm onSubmit={(x) => handleSubmit(x, close)} />}>
111+
<Dialog title="Import from Archive" render={({ close }) => <ArchiveDataForm onSubmit={(x) => handleSubmit(x, close)} />}>
112112
<Button title="Import from Archive">
113113
<Icon icon={faArchive} />
114114
</Button>

src/components/ui/templates/actions/dataset.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Component({ id }: PropsWithChildren<Props>) {
4242
);
4343

4444
const handleDownload = useCallback(
45-
(event: MouseEvent<HTMLButtonElement>) => {
45+
(event: MouseEvent<SVGSVGElement>) => {
4646
if (!state) return;
4747
event.preventDefault();
4848
let data: IEntry[] | Record<string, IEntry> = state.data;
@@ -67,42 +67,42 @@ function Component({ id }: PropsWithChildren<Props>) {
6767
return {
6868
edit: {
6969
icon: faPencil,
70-
render: (Icon, { ...rest }) => {
70+
render: (Icon, { key, ...rest }) => {
7171
return (
72-
<Dialog render={({ close }) => <ManualDatasetForm initial={{ id, ...state }} onSubmit={() => close()} />}>
73-
<Icon {...rest} title="Edit" variant="primary" />
72+
<Dialog title="Edit Dataset" render={({ close }) => <ManualDatasetForm initial={{ id, ...state }} onSubmit={() => close()} />}>
73+
<Icon key={key} {...rest} title="Edit" variant="primary" />
7474
</Dialog>
7575
);
7676
},
7777
},
7878
overwrite: {
7979
icon: faFileImport,
80-
render: (Icon, { ...rest }) => {
80+
render: (Icon, { key, ...rest }) => {
8181
return (
8282
<Input asChild type="file" id="file" accept="application/json,text/plain" onChange={handleOverwrite}>
83-
<Icon {...rest} title="Overwrite" variant="primary" />
83+
<Icon key={key} {...rest} title="Overwrite" variant="primary" />
8484
</Input>
8585
);
8686
},
8787
},
8888
download: {
8989
icon: faDownload,
90-
render: (Icon, { ...rest }) => {
91-
return <Icon {...rest} title="Download" variant="primary" onClick={handleDownload} />;
90+
render: (Icon, { key, ...rest }) => {
91+
return <Icon key={key} {...rest} title="Download" variant="primary" onClick={handleDownload} />;
9292
},
9393
},
9494
delete: {
9595
icon: faTrash,
9696
condition: () => !isInternal,
97-
render: (Icon, { ...rest }) => {
98-
return <Icon {...rest} title="Delete" variant="danger" onClick={handleDelete} />;
97+
render: (Icon, { key, ...rest }) => {
98+
return <Icon key={key} {...rest} title="Delete" variant="danger" onClick={handleDelete} />;
9999
},
100100
},
101101
refresh: {
102102
icon: faRefresh,
103103
condition: () => isInternal,
104-
render: (Icon, { ...rest }) => {
105-
return <Icon {...rest} title="Refresh" variant="primary" onClick={handleRefresh} />;
104+
render: (Icon, { key, ...rest }) => {
105+
return <Icon key={key} {...rest} title="Refresh" variant="primary" onClick={handleRefresh} />;
106106
},
107107
},
108108
};

src/components/ui/templates/actions/level.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ function Component({ id, onSubmit, onDelete }: Props) {
5959
return {
6060
edit: {
6161
icon: faPencil,
62-
render: (Icon, { ...rest }) => {
62+
render: (Icon, { key, ...rest }) => {
6363
return (
64-
<Dialog render={({ close }) => <ManualDataForm initial={{ ...entry.data, ...omit(entry, "data") }} onSubmit={(x) => handleSubmit(x, close)} />}>
65-
<Icon {...rest} title="Edit" variant="primary" />
64+
<Dialog title="Edit Entry" render={({ close }) => <ManualDataForm initial={{ ...entry.data, ...omit(entry, "data") }} onSubmit={(x) => handleSubmit(x, close)} />}>
65+
<Icon key={key} {...rest} title="Edit" variant="primary" />
6666
</Dialog>
6767
);
6868
},
6969
},
7070
delete: {
7171
icon: faTrash,
7272
condition: () => !!entry.data,
73-
render: (Icon, { ...rest }) => {
74-
return <Icon {...rest} title="Delete" variant="danger" onClick={() => handleDelete(id)} />;
73+
render: (Icon, { key, ...rest }) => {
74+
return <Icon key={key} {...rest} title="Delete" variant="danger" onClick={() => handleDelete(id)} />;
7575
},
7676
},
7777
};

src/components/ui/templates/actions/row.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props<T> {
1717
onDelete?: (ids: string[]) => void;
1818
}
1919

20-
function Component<T>({ table, ids, onSubmit, onDelete, ...rest }: Props<T>) {
20+
function Component<T>({ table, ids, onSubmit, onDelete }: Props<T>) {
2121
const { key } = useParams("/:key");
2222
const { state, dispatch } = useDataset(key);
2323
if (!state) throw Error("The dataset does not exist.");
@@ -68,7 +68,7 @@ function Component<T>({ table, ids, onSubmit, onDelete, ...rest }: Props<T>) {
6868
icon: faPencil,
6969
render: (Icon, { ...rest }) => {
7070
return (
71-
<Dialog render={({ close }) => <ManualDataForm initial={shared} onSubmit={(x) => handleSubmit(x, close)} disable={disable} />}>
71+
<Dialog title="Edit Entry" render={({ close }) => <ManualDataForm initial={shared} onSubmit={(x) => handleSubmit(x, close)} disable={disable} />}>
7272
<Icon {...rest} title="Edit" variant="primary" />
7373
</Dialog>
7474
);

src/components/ui/templates/forms/dataset.tsx

+23-20
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { IDataset, IEntry, schemas } from "$/types";
66
import { omit } from "$/utils";
77
import { useForm } from "@tanstack/react-form";
88
import { valibotValidator } from "@tanstack/valibot-form-adapter";
9-
import { Fragment } from "react";
9+
import { FormEvent, Fragment } from "react";
1010
import { css } from "styled-system/css";
1111
import { parse } from "valibot";
1212

@@ -19,28 +19,33 @@ function Component({ initial, onSubmit }: Props) {
1919
const { state, dispatch } = useDatasets();
2020

2121
const F = useForm({
22-
validatorAdapter: valibotValidator,
22+
validatorAdapter: valibotValidator(),
2323
defaultValues: { id: initial?.id ?? "", ...initial },
24+
onSubmit: ({ value }) => {
25+
const id = parse(schemas.data.id, value.id);
26+
const update: IDataset = {
27+
...omit(value, "id"),
28+
name: parse(schemas.artificial.string(schemas.metadata.v1.dataset.entries.name), value.name),
29+
contributors: parse(schemas.metadata.v1.dataset.entries.contributors, value.contributors),
30+
description: parse(schemas.artificial.string(schemas.metadata.v1.dataset.entries.description), value.description),
31+
data: state[id]?.data ?? [],
32+
};
33+
if (!initial && state[id]) {
34+
if (!confirm("This dataset already exists, so any existing data will be overwritten. Are you sure you want to continue?")) return;
35+
}
36+
dispatch({ type: "UPDATE", payload: { id, dataset: { ...update, updated: new Date().toISOString() }, overwrite: true } });
37+
if (onSubmit) onSubmit(Object.values(update.data));
38+
},
2439
});
2540

26-
function handleSubmit(values: typeof F.state.values) {
27-
const id = parse(schemas.data.id, values.id);
28-
const update: IDataset = {
29-
...omit(values, "id"),
30-
name: parse(schemas.artificial.string(schemas.metadata.v1.dataset.entries.name), values.name),
31-
contributors: parse(schemas.metadata.v1.dataset.entries.contributors, values.contributors),
32-
description: parse(schemas.artificial.string(schemas.metadata.v1.dataset.entries.description), values.description),
33-
data: state[id]?.data ?? [],
34-
};
35-
if (!initial && state[id]) {
36-
if (!confirm("This dataset already exists, so any existing data will be overwritten. Are you sure you want to continue?")) return;
37-
}
38-
dispatch({ type: "UPDATE", payload: { id, dataset: { ...update, updated: new Date().toISOString() }, overwrite: true } });
39-
if (onSubmit) onSubmit(Object.values(update.data));
41+
function handleSubmit(event: FormEvent<HTMLElement>) {
42+
event.preventDefault();
43+
event.stopPropagation();
44+
F.handleSubmit();
4045
}
4146

4247
return (
43-
<Form.Root title={initial ? "Edit Dataset" : "Create Dataset"}>
48+
<Form.Root title={initial ? "Edit Dataset" : "Create Dataset"} onSubmit={handleSubmit}>
4449
{!initial && (
4550
<Form.Row>
4651
<F.Field name="id" validators={{ onChange: schemas.data.id }} children={(field) => <Field.String field={field} heading="ID" />} />
@@ -58,9 +63,7 @@ function Component({ initial, onSubmit }: Props) {
5863
children={(canSubmit) => {
5964
return (
6065
<Fragment>
61-
<Button disabled={!canSubmit} onClick={() => handleSubmit(F.state.values)}>
62-
Submit
63-
</Button>
66+
<Button disabled={!canSubmit}>Submit</Button>
6467
</Fragment>
6568
);
6669
}}

0 commit comments

Comments
 (0)