@valerius_petrini/corekit-ui 0.1.87 → 0.1.89
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/dist/components/display/Card/index.stories.svelte +1 -1
- package/dist/components/display/DataGrid/index.stories.svelte +18 -0
- package/dist/components/display/DataGrid/index.stories.svelte.d.ts +18 -0
- package/dist/components/display/DataGrid/index.svelte +44 -0
- package/dist/components/display/DataGrid/index.svelte.d.ts +4 -0
- package/dist/components/display/DataGrid/types.d.ts +12 -0
- package/dist/components/display/DataGrid/types.js +3 -0
- package/dist/components/display/Skeleton/index.stories.svelte +11 -0
- package/dist/components/display/Skeleton/index.stories.svelte.d.ts +18 -0
- package/dist/components/display/Table/TableBody.svelte +22 -0
- package/dist/components/display/Table/TableBody.svelte.d.ts +4 -0
- package/dist/components/display/Table/TableCell.svelte +21 -0
- package/dist/components/display/Table/TableCell.svelte.d.ts +4 -0
- package/dist/components/display/Table/TableHeadCell.svelte +24 -0
- package/dist/components/display/Table/TableHeadCell.svelte.d.ts +4 -0
- package/dist/components/display/Table/TableHeader.svelte +14 -0
- package/dist/components/display/Table/TableHeader.svelte.d.ts +4 -0
- package/dist/components/display/Table/TableRow.svelte +14 -0
- package/dist/components/display/Table/TableRow.svelte.d.ts +4 -0
- package/dist/components/display/Table/index.stories.svelte +47 -0
- package/dist/components/display/Table/index.stories.svelte.d.ts +18 -0
- package/dist/components/display/Table/index.svelte +2 -25
- package/dist/components/display/Table/types.d.ts +8 -6
- package/dist/components/display/Table/types.js +0 -1
- package/dist/components/display/index.d.ts +12 -2
- package/dist/components/display/index.js +6 -1
- package/dist/components/display/table.d.ts +4 -0
- package/dist/components/display/table.js +4 -0
- package/dist/components/inputs/Checkbox/index.stories.svelte +23 -0
- package/dist/components/inputs/Checkbox/index.stories.svelte.d.ts +18 -0
- package/dist/components/inputs/Checkbox/index.svelte +27 -6
- package/dist/components/inputs/Select/index.stories.svelte +33 -0
- package/dist/components/inputs/Select/index.stories.svelte.d.ts +18 -0
- package/dist/components/inputs/Select/index.svelte +4 -0
- package/dist/components/inputs/Select/types.d.ts +1 -0
- package/dist/components/typography/Link/index.stories.svelte +16 -0
- package/dist/components/typography/Link/index.stories.svelte.d.ts +18 -0
- package/dist/components/typography/Link/index.svelte +28 -0
- package/dist/components/typography/Link/index.svelte.d.ts +4 -0
- package/dist/components/typography/Link/types.d.ts +7 -0
- package/dist/components/typography/Link/types.js +2 -0
- package/dist/components/typography/Text/index.svelte +25 -42
- package/dist/components/typography/Text/types.d.ts +0 -1
- package/dist/components/typography/index.d.ts +1 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/styles/layout.css +6 -1
- package/package.json +1 -1
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
{/snippet}
|
|
39
39
|
|
|
40
40
|
<Story name="Default" args={{ variant: "bordered", size: "md", footer, header }}>
|
|
41
|
-
<Text tag="h2" class="
|
|
41
|
+
<Text tag="h2" class="mb-2">Customizable Card</Text>
|
|
42
42
|
<Text class="mb-4">This is a customizable card component. You can add any content here and style it as needed.</Text>
|
|
43
43
|
</Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import DataGrid from "./index.svelte";
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: "Components/Display/DataGrid",
|
|
7
|
+
component: DataGrid,
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Story name="Default" args={{ tableHeaders:[
|
|
12
|
+
{ key: "name", label: "Name" },
|
|
13
|
+
{ key: "age", label: "Age" },
|
|
14
|
+
{ key: "email", label: "Email" },
|
|
15
|
+
], tableData: [
|
|
16
|
+
{ name: "John Doe", age: 30, email: "john.doe@example.com" },
|
|
17
|
+
{ name: "Jane Smith", age: 25, email: "jane.smith@example.com" }
|
|
18
|
+
] }}></Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defaultTableClass, defaultTableHeaderClass, defaultTableCellClass, defaultTableBodyClass } from "../table";
|
|
3
|
+
import type { DataGridProps } from "./types";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children = undefined,
|
|
8
|
+
class: className = "",
|
|
9
|
+
element = $bindable(),
|
|
10
|
+
tableHeaders = [],
|
|
11
|
+
tableData = [],
|
|
12
|
+
size = "md",
|
|
13
|
+
radius = "md",
|
|
14
|
+
...restProps
|
|
15
|
+
}: DataGridProps = $props();
|
|
16
|
+
|
|
17
|
+
const combinedTableClass = $derived(twMerge(
|
|
18
|
+
defaultTableClass,
|
|
19
|
+
className
|
|
20
|
+
));
|
|
21
|
+
|
|
22
|
+
const combinedTableHeaderClass = $derived(twMerge(defaultTableHeaderClass, defaultTableCellClass));
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="overflow-auto w-full" bind:this={element}>
|
|
26
|
+
<table {...restProps} class={combinedTableClass}>
|
|
27
|
+
<thead>
|
|
28
|
+
<tr>
|
|
29
|
+
{#each tableHeaders as header}
|
|
30
|
+
<th class={combinedTableHeaderClass}>{header.label}</th>
|
|
31
|
+
{/each}
|
|
32
|
+
</tr>
|
|
33
|
+
</thead>
|
|
34
|
+
<tbody>
|
|
35
|
+
{#each tableData as row}
|
|
36
|
+
<tr class={defaultTableBodyClass}>
|
|
37
|
+
{#each tableHeaders as header}
|
|
38
|
+
<td class={defaultTableCellClass}>{row[header.key]}</td>
|
|
39
|
+
{/each}
|
|
40
|
+
</tr>
|
|
41
|
+
{/each}
|
|
42
|
+
</tbody>
|
|
43
|
+
</table>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SizeStyle } from "../../../styles/size.js";
|
|
2
|
+
import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
|
|
3
|
+
export interface DataGridHeaders {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DataGridProps extends BaseComponentProps {
|
|
8
|
+
tableHeaders?: DataGridHeaders[];
|
|
9
|
+
tableData?: any[];
|
|
10
|
+
size?: SizeStyle;
|
|
11
|
+
radius?: SizeStyle;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Skeleton from "./index.svelte";
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: "Components/Display/Skeleton",
|
|
7
|
+
component: Skeleton,
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Story name="Default"></Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import type { TableBodyProps } from "./types";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
children = undefined,
|
|
9
|
+
class: className = "",
|
|
10
|
+
element = $bindable(),
|
|
11
|
+
...restProps
|
|
12
|
+
}: TableBodyProps = $props();
|
|
13
|
+
|
|
14
|
+
const combinedTableBodyClass = $derived(twMerge(
|
|
15
|
+
"[&_tr]:even:bg-sub-background [&_tr]:odd:bg-sub-background-hover",
|
|
16
|
+
className
|
|
17
|
+
));
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<tbody class={combinedTableBodyClass} bind:this={element} {...restProps}>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</tbody>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { defaultTableCellClass } from "../table";
|
|
4
|
+
import type { TableCellProps } from "./types";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children = undefined,
|
|
8
|
+
class: className = "",
|
|
9
|
+
element = $bindable(),
|
|
10
|
+
...restProps
|
|
11
|
+
}: TableCellProps = $props();
|
|
12
|
+
|
|
13
|
+
const combinedTableCellClass = $derived(twMerge(
|
|
14
|
+
defaultTableCellClass,
|
|
15
|
+
className
|
|
16
|
+
));
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<td class={combinedTableCellClass} bind:this={element} {...restProps}>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</td>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { defaultTableCellClass, defaultTableHeaderClass } from "../table";
|
|
4
|
+
import type { TableHeadCellProps } from "./types";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children = undefined,
|
|
8
|
+
class: className = "",
|
|
9
|
+
element = $bindable(),
|
|
10
|
+
size = "md",
|
|
11
|
+
radius = "md",
|
|
12
|
+
...restProps
|
|
13
|
+
}: TableHeadCellProps = $props();
|
|
14
|
+
|
|
15
|
+
const combinedTableHeaderClass = $derived(twMerge(
|
|
16
|
+
defaultTableHeaderClass,
|
|
17
|
+
defaultTableCellClass,
|
|
18
|
+
className
|
|
19
|
+
));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<th class={combinedTableHeaderClass} bind:this={element} {...restProps}>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</th>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableHeaderProps } from "./types";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children = undefined,
|
|
6
|
+
class: className = "",
|
|
7
|
+
element = $bindable(),
|
|
8
|
+
...restProps
|
|
9
|
+
}: TableHeaderProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<thead class={className} bind:this={element} {...restProps}>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</thead>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableProps } from "./types";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children = undefined,
|
|
6
|
+
class: className = "",
|
|
7
|
+
element = $bindable(),
|
|
8
|
+
...restProps
|
|
9
|
+
}: TableProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<tr class={className} bind:this={element} {...restProps}>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</tr>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Table from "./index.svelte";
|
|
4
|
+
import TableHeader from "./TableHeader.svelte";
|
|
5
|
+
import TableRow from "./TableRow.svelte";
|
|
6
|
+
import TableHeadCell from "./TableHeadCell.svelte";
|
|
7
|
+
import { TableBody } from "..";
|
|
8
|
+
import TableCell from "./TableCell.svelte";
|
|
9
|
+
import { Button } from "../../inputs";
|
|
10
|
+
import { Tooltip } from "../../overlay";
|
|
11
|
+
|
|
12
|
+
const { Story } = defineMeta({
|
|
13
|
+
title: "Components/Display/Table",
|
|
14
|
+
component: Table,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const userData = [
|
|
18
|
+
{ name: "John Doe", age: 30, email: "johndoe@email.com" },
|
|
19
|
+
{ name: "Jane Smith", age: 25, email: "janesmith@email.com" }
|
|
20
|
+
];
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<Story name="Default">
|
|
24
|
+
<TableHeader>
|
|
25
|
+
<TableRow>
|
|
26
|
+
<TableHeadCell>Name</TableHeadCell>
|
|
27
|
+
<TableHeadCell>Age</TableHeadCell>
|
|
28
|
+
<TableHeadCell>Email</TableHeadCell>
|
|
29
|
+
<TableHeadCell></TableHeadCell>
|
|
30
|
+
</TableRow>
|
|
31
|
+
</TableHeader>
|
|
32
|
+
|
|
33
|
+
<TableBody>
|
|
34
|
+
{#each userData as user}
|
|
35
|
+
<TableRow>
|
|
36
|
+
<TableCell>{user.name}</TableCell>
|
|
37
|
+
<TableCell>{user.age}</TableCell>
|
|
38
|
+
<TableCell>{user.email}</TableCell>
|
|
39
|
+
<TableCell>
|
|
40
|
+
<Tooltip text="Edit User">
|
|
41
|
+
<Button size="sm">Edit</Button>
|
|
42
|
+
</Tooltip>
|
|
43
|
+
</TableCell>
|
|
44
|
+
</TableRow>
|
|
45
|
+
{/each}
|
|
46
|
+
</TableBody>
|
|
47
|
+
</Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { defaultTableClass } from "../table";
|
|
2
3
|
import type { TableProps } from "./types";
|
|
3
4
|
import { twMerge } from "tailwind-merge";
|
|
4
5
|
|
|
@@ -6,43 +7,19 @@
|
|
|
6
7
|
children = undefined,
|
|
7
8
|
class: className = "",
|
|
8
9
|
element = $bindable(),
|
|
9
|
-
tableHeaders = [],
|
|
10
|
-
tableData = [],
|
|
11
10
|
size = "md",
|
|
12
11
|
radius = "md",
|
|
13
12
|
...restProps
|
|
14
13
|
}: TableProps = $props();
|
|
15
14
|
|
|
16
|
-
const defaultTableClass = "w-full border-collapse text-main-text border border-form-border border-l-0";
|
|
17
|
-
const defaultTableHeaderClass = "text-left border-b border-b-1 border-b-form-border bg-sub-background font-medium";
|
|
18
|
-
const defaultTableCellClass = "p-2 text-sm border-l border-l-[1px] border-l-form-border";
|
|
19
|
-
const defaultTableBodyClass = "even:bg-sub-background odd:bg-sub-background-hover";
|
|
20
|
-
|
|
21
15
|
const combinedTableClass = $derived(twMerge(
|
|
22
16
|
defaultTableClass,
|
|
23
17
|
className
|
|
24
18
|
));
|
|
25
|
-
|
|
26
|
-
const combinedTableHeaderClass = $derived(twMerge(defaultTableHeaderClass, defaultTableCellClass));
|
|
27
19
|
</script>
|
|
28
20
|
|
|
29
21
|
<div class="overflow-auto w-full" bind:this={element}>
|
|
30
22
|
<table {...restProps} class={combinedTableClass}>
|
|
31
|
-
|
|
32
|
-
<tr>
|
|
33
|
-
{#each tableHeaders as header}
|
|
34
|
-
<th class={combinedTableHeaderClass}>{header.label}</th>
|
|
35
|
-
{/each}
|
|
36
|
-
</tr>
|
|
37
|
-
</thead>
|
|
38
|
-
<tbody>
|
|
39
|
-
{#each tableData as row}
|
|
40
|
-
<tr class={defaultTableBodyClass}>
|
|
41
|
-
{#each tableHeaders as header}
|
|
42
|
-
<td class={defaultTableCellClass}>{row[header.key]}</td>
|
|
43
|
-
{/each}
|
|
44
|
-
</tr>
|
|
45
|
-
{/each}
|
|
46
|
-
</tbody>
|
|
23
|
+
{@render children()}
|
|
47
24
|
</table>
|
|
48
25
|
</div>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { SizeStyle } from "../../../styles/size.js";
|
|
2
2
|
import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
|
|
3
|
-
export interface TableHeaders {
|
|
4
|
-
key: string;
|
|
5
|
-
label: string;
|
|
6
|
-
}
|
|
7
3
|
export interface TableProps extends BaseComponentProps {
|
|
8
|
-
tableHeaders?: TableHeaders[];
|
|
9
|
-
tableData?: any[];
|
|
10
4
|
size?: SizeStyle;
|
|
11
5
|
radius?: SizeStyle;
|
|
12
6
|
}
|
|
7
|
+
export interface TableHeaderProps extends BaseComponentProps {
|
|
8
|
+
}
|
|
9
|
+
export interface TableHeadCellProps extends BaseComponentProps {
|
|
10
|
+
}
|
|
11
|
+
export interface TableCellProps extends BaseComponentProps {
|
|
12
|
+
}
|
|
13
|
+
export interface TableBodyProps extends BaseComponentProps {
|
|
14
|
+
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
export { default as Card } from "./Card/index.svelte";
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as DataGrid } from "./DataGrid/index.svelte";
|
|
3
3
|
export { default as KBD } from "./KBD/index.svelte";
|
|
4
4
|
export { default as Skeleton } from "./Skeleton/index.svelte";
|
|
5
5
|
export { default as Accordion } from "./Accordion/index.svelte";
|
|
6
6
|
export { default as AccordionItem } from "./Accordion/AccordionItem.svelte";
|
|
7
7
|
export { default as Tree } from "./Tree/index.svelte";
|
|
8
8
|
export { default as TreeNode } from "./Tree/TreeNode.svelte";
|
|
9
|
+
export { default as Table } from "./Table/index.svelte";
|
|
10
|
+
export { default as TableHeader } from "./Table/TableHeader.svelte";
|
|
11
|
+
export { default as TableHeadCell } from "./Table/TableHeadCell.svelte";
|
|
12
|
+
export { default as TableCell } from "./Table/TableCell.svelte";
|
|
13
|
+
export { default as TableBody } from "./Table/TableBody.svelte";
|
|
9
14
|
export type { CardProps } from "./Card/types.ts";
|
|
10
|
-
export type {
|
|
15
|
+
export type { DataGridProps } from "./DataGrid/types.ts";
|
|
11
16
|
export type { SkeletonProps } from "./Skeleton/types.ts";
|
|
12
17
|
export type { AccordionProps, AccordionItemProps, AccordionContext } from "./Accordion/types.ts";
|
|
13
18
|
export type { TreeProps, TreeNodeProps, TreeContext } from "./Tree/types.ts";
|
|
19
|
+
export type { TableProps } from "./Table/types.ts";
|
|
20
|
+
export type { TableHeaderProps } from "./Table/types.ts";
|
|
21
|
+
export type { TableHeadCellProps } from "./Table/types.ts";
|
|
22
|
+
export type { TableCellProps } from "./Table/types.ts";
|
|
23
|
+
export type { TableBodyProps } from "./Table/types.ts";
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export { default as Card } from "./Card/index.svelte";
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as DataGrid } from "./DataGrid/index.svelte";
|
|
3
3
|
export { default as KBD } from "./KBD/index.svelte";
|
|
4
4
|
export { default as Skeleton } from "./Skeleton/index.svelte";
|
|
5
5
|
export { default as Accordion } from "./Accordion/index.svelte";
|
|
6
6
|
export { default as AccordionItem } from "./Accordion/AccordionItem.svelte";
|
|
7
7
|
export { default as Tree } from "./Tree/index.svelte";
|
|
8
8
|
export { default as TreeNode } from "./Tree/TreeNode.svelte";
|
|
9
|
+
export { default as Table } from "./Table/index.svelte";
|
|
10
|
+
export { default as TableHeader } from "./Table/TableHeader.svelte";
|
|
11
|
+
export { default as TableHeadCell } from "./Table/TableHeadCell.svelte";
|
|
12
|
+
export { default as TableCell } from "./Table/TableCell.svelte";
|
|
13
|
+
export { default as TableBody } from "./Table/TableBody.svelte";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const defaultTableClass = "w-full border-collapse text-main-text border border-form-border border-l-0";
|
|
2
|
+
export declare const defaultTableHeaderClass = "text-left border-b border-b-1 border-b-form-border bg-sub-background font-medium";
|
|
3
|
+
export declare const defaultTableCellClass = "p-2 text-sm border-l border-l-[1px] border-l-form-border";
|
|
4
|
+
export declare const defaultTableBodyClass = "even:bg-sub-background odd:bg-sub-background-hover";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const defaultTableClass = "w-full border-collapse text-main-text border border-form-border border-l-0";
|
|
2
|
+
export const defaultTableHeaderClass = "text-left border-b border-b-1 border-b-form-border bg-sub-background font-medium";
|
|
3
|
+
export const defaultTableCellClass = "p-2 text-sm border-l border-l-[1px] border-l-form-border";
|
|
4
|
+
export const defaultTableBodyClass = "even:bg-sub-background odd:bg-sub-background-hover";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Checkbox from "./index.svelte";
|
|
4
|
+
import { colorStyles, colorStyleTypes } from "../../../styles/color.js";
|
|
5
|
+
import { sizeStyles } from "../../../styles/size.js";
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: "Components/Inputs/Checkbox",
|
|
9
|
+
component: Checkbox,
|
|
10
|
+
argTypes: {
|
|
11
|
+
size: {
|
|
12
|
+
control: "select",
|
|
13
|
+
options: sizeStyles,
|
|
14
|
+
},
|
|
15
|
+
radius: {
|
|
16
|
+
control: "select",
|
|
17
|
+
options: sizeStyles,
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<Story name="Default" args={{ label: "Input Label" }}></Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
...restProps
|
|
20
20
|
}: CheckboxProps = $props();
|
|
21
21
|
|
|
22
|
-
let defaultClass = "z-20 bg-form-
|
|
22
|
+
let defaultClass = "w-4 h-4 z-20 bg-form-background text-main-text rounded outline-none transition-all checked:bg-blue-500";
|
|
23
23
|
let defaultLabelClass = "block text-sub-text font-medium";
|
|
24
24
|
let defaultDivClass = "relative flex items-center gap-2";
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
<
|
|
31
|
+
<Text tag="label" for={id} class={combinedDivClass}>
|
|
32
32
|
<input
|
|
33
33
|
type="checkbox"
|
|
34
34
|
id={id}
|
|
@@ -36,7 +36,28 @@
|
|
|
36
36
|
class={combinedClass}
|
|
37
37
|
{...restProps}
|
|
38
38
|
bind:this={element}/>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
{label}
|
|
40
|
+
</Text>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
input[type="checkbox"] {
|
|
44
|
+
appearance: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
input[type="checkbox"]:checked::before {
|
|
48
|
+
transform: scale(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
input[type="checkbox"]::before {
|
|
52
|
+
content: "";
|
|
53
|
+
width: 80%;
|
|
54
|
+
height: 80%;
|
|
55
|
+
margin: 1.5px;
|
|
56
|
+
transform: scale(0);
|
|
57
|
+
transform-origin: bottom left;
|
|
58
|
+
transition: 150ms transform ease-in-out;
|
|
59
|
+
display: block;
|
|
60
|
+
background-color: white;
|
|
61
|
+
clip-path: polygon(14% 44%, 0% 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Select from "./index.svelte";
|
|
4
|
+
import { sizeStyles } from "../../../styles/size.js";
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: "Components/Inputs/Select",
|
|
8
|
+
component: Select,
|
|
9
|
+
argTypes: {
|
|
10
|
+
size: {
|
|
11
|
+
control: "select",
|
|
12
|
+
options: sizeStyles,
|
|
13
|
+
},
|
|
14
|
+
radius: {
|
|
15
|
+
control: "select",
|
|
16
|
+
options: sizeStyles,
|
|
17
|
+
},
|
|
18
|
+
type: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: ["text", "password", "email", "number", "search", "tel", "url"],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Story name="Default" args={{ label: "Input Label", placeholder: "Select an Item", options: [
|
|
27
|
+
{ label: "Option 1", value: "option1" },
|
|
28
|
+
{ label: "Option 2", value: "option2" },
|
|
29
|
+
{ label: "Option 3", value: "option3" },
|
|
30
|
+
{ label: "Option 4", value: "option4" },
|
|
31
|
+
{ label: "Option 5", value: "option5" },
|
|
32
|
+
{ label: "Option 6", value: "option6" },
|
|
33
|
+
]}}></Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
children = undefined,
|
|
14
14
|
class: className = "",
|
|
15
15
|
element = $bindable(),
|
|
16
|
+
placeholder = "",
|
|
16
17
|
label = "",
|
|
17
18
|
labelClass = "",
|
|
18
19
|
divClass = "",
|
|
@@ -77,6 +78,9 @@
|
|
|
77
78
|
bind:value={value}
|
|
78
79
|
style={customStyle}
|
|
79
80
|
{...restProps}>
|
|
81
|
+
{#if placeholder}
|
|
82
|
+
<option value="" disabled selected>{placeholder}</option>
|
|
83
|
+
{/if}
|
|
80
84
|
{#each options as option}
|
|
81
85
|
<option value={option.value}>{option.label}</option>
|
|
82
86
|
{/each}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Link from "./index.svelte";
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: "Components/Typography/Link",
|
|
7
|
+
component: Link,
|
|
8
|
+
argTypes: {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Default" args={{ href: "https://example.com" }}>
|
|
15
|
+
The quick brown fox jumps over the lazy dog.
|
|
16
|
+
</Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { sizeStyleParts, type SizeStyleTheme } from "../../../styles/size";
|
|
3
|
+
import { getLinkProps } from "../../../utils/link.js";
|
|
4
|
+
import { multiAction } from "../../../utils/multiAction.js";
|
|
5
|
+
import type { TextProps } from "./types.js";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children = undefined,
|
|
10
|
+
class: className = "",
|
|
11
|
+
element = $bindable(),
|
|
12
|
+
href = "",
|
|
13
|
+
external = false,
|
|
14
|
+
size = "none",
|
|
15
|
+
use = [],
|
|
16
|
+
...restProps
|
|
17
|
+
}: TextProps = $props();
|
|
18
|
+
|
|
19
|
+
let combinedClass = $derived(twMerge(
|
|
20
|
+
"text-main-text font-body text-link decoration-link/0 underline underline-offset-2 transition-all cursor-pointer duration-150 hover:decoration-link text-base",
|
|
21
|
+
sizeStyleParts[size as SizeStyleTheme]?.text || "",
|
|
22
|
+
className
|
|
23
|
+
));
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<a bind:this={element} {href} class={combinedClass} {...restProps} use:multiAction={use} {...getLinkProps(href, external, false)}>
|
|
27
|
+
{@render children?.()}
|
|
28
|
+
</a>
|
|
@@ -9,60 +9,43 @@
|
|
|
9
9
|
class: className = "",
|
|
10
10
|
element = $bindable(),
|
|
11
11
|
tag = "p",
|
|
12
|
-
shrink = undefined,
|
|
13
12
|
size = "none",
|
|
14
13
|
use = [],
|
|
15
14
|
...restProps
|
|
16
15
|
}: TextProps = $props();
|
|
17
16
|
|
|
18
|
-
const tagStyles: Record<string,
|
|
19
|
-
"p":
|
|
20
|
-
"div":
|
|
21
|
-
"span":
|
|
22
|
-
"label":
|
|
23
|
-
"strong":
|
|
24
|
-
"b":
|
|
25
|
-
"em":
|
|
26
|
-
"i":
|
|
27
|
-
"u":
|
|
28
|
-
"small":
|
|
29
|
-
"blockquote":
|
|
30
|
-
"pre":
|
|
31
|
-
"code":
|
|
32
|
-
"a":
|
|
33
|
-
"li":
|
|
34
|
-
"h1":
|
|
35
|
-
"h2":
|
|
36
|
-
"h3":
|
|
37
|
-
"h4":
|
|
38
|
-
"h5":
|
|
39
|
-
"h6":
|
|
17
|
+
const tagStyles: Record<string, string> = {
|
|
18
|
+
"p": "text-base",
|
|
19
|
+
"div": " text-base",
|
|
20
|
+
"span": " text-base",
|
|
21
|
+
"label": "text-sub-text font-semibold text-xs",
|
|
22
|
+
"strong": "font-bold text-base",
|
|
23
|
+
"b": "font-bold text-base",
|
|
24
|
+
"em": "italic text-base",
|
|
25
|
+
"i": "italic text-base",
|
|
26
|
+
"u": "underline text-base",
|
|
27
|
+
"small": " text-sm",
|
|
28
|
+
"blockquote": "border-l-4 border-gray-500 pl-2 opacity-70 text-base",
|
|
29
|
+
"pre": "font-mono bg-sub-background px-3 py-2 rounded overflow-x-auto whitespace-pre text-base",
|
|
30
|
+
"code": "font-mono bg-sub-background px-1 rounded inline-block text-base",
|
|
31
|
+
"a": "text-link decoration-link/0 underline underline-offset-2 transition-all cursor-pointer duration-150 hover:decoration-link text-base",
|
|
32
|
+
"li": "text-base list-disc list-inside text-base",
|
|
33
|
+
"h1": "font-bold font-display text-4xl",
|
|
34
|
+
"h2": "font-bold font-display text-3xl",
|
|
35
|
+
"h3": "font-semibold font-display text-2xl",
|
|
36
|
+
"h4": "font-semibold font-display text-xl",
|
|
37
|
+
"h5": "font-medium font-display text-lg",
|
|
38
|
+
"h6": "font-normal font-display text-base"
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
function getTextSizeInRem(): string {
|
|
43
|
-
if (size !== "none") {
|
|
44
|
-
const sizeKey = (sizeStyleParts[size as SizeStyleTheme]?.text ?? "text-base") as keyof typeof textStyle;
|
|
45
|
-
return textStyle[sizeKey] ?? textStyle["text-base"];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return textStyle[tagStyles[tag]?.size || "text-base"] ?? textStyle["text-base"];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let shrinkStyle = $derived(shrink
|
|
52
|
-
? `font-size: clamp(8px, ${shrink}cqi, ${getTextSizeInRem()}); white-space: nowrap; display: block; width: fit-content;`
|
|
53
|
-
: ""
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
let defaultClass = "text-main-text font-body";
|
|
57
41
|
let combinedClass = $derived(twMerge(
|
|
58
|
-
|
|
59
|
-
tagStyles[tag]
|
|
60
|
-
tagStyles[tag]?.size || "",
|
|
42
|
+
"text-main-text font-body",
|
|
43
|
+
tagStyles[tag],
|
|
61
44
|
sizeStyleParts[size as SizeStyleTheme]?.text || "",
|
|
62
45
|
className
|
|
63
46
|
));
|
|
64
47
|
</script>
|
|
65
48
|
|
|
66
|
-
<svelte:element bind:this={element} this={tag}
|
|
49
|
+
<svelte:element bind:this={element} this={tag} class={combinedClass} {...restProps} use:multiAction={use}>
|
|
67
50
|
{@render children?.()}
|
|
68
51
|
</svelte:element>
|
|
@@ -3,7 +3,6 @@ import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
|
|
|
3
3
|
type TextTagOptions = "p" | "div" | "span" | "label" | "strong" | "em" | "b" | "i" | "u" | "small" | "blockquote" | "pre" | "code" | "a" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
4
|
export interface TextProps extends BaseComponentProps {
|
|
5
5
|
tag?: TextTagOptions;
|
|
6
|
-
shrink?: number;
|
|
7
6
|
size?: SizeStyle;
|
|
8
7
|
}
|
|
9
8
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Text } from "./Text/index.svelte";
|
|
2
|
+
export { default as Link } from "./Link/index.svelte";
|
|
2
3
|
export { default as Typewriter } from "./Typewriter/index.svelte";
|
|
3
4
|
export type { TextProps } from "./Text/types.ts";
|
|
4
5
|
export type { TypewriterAction, DisplaySegment } from "./Typewriter/types.ts";
|
package/dist/styles/layout.css
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
--color-form-hover: var(--vpcui-form-hover);
|
|
20
20
|
--color-form-border: var(--vpcui-form-border);
|
|
21
21
|
--color-sub-background-border-hover: var(--vpcui-sub-background-border-hover);
|
|
22
|
+
--color-link: var(--vpcui-link);
|
|
22
23
|
|
|
23
24
|
--color-primary: var(--vpcui-primary);
|
|
24
25
|
--color-secondary: var(--vpcui-secondary);
|
|
@@ -93,8 +94,10 @@
|
|
|
93
94
|
--vpcui-loader-btn-color: rgba(255, 255, 255, 0.25);
|
|
94
95
|
|
|
95
96
|
--vpcui-font-display: ui-serif, Georgia, serif;
|
|
96
|
-
--vpcui-font-body: ui-sans-serif, system-ui sans-serif;
|
|
97
|
+
--vpcui-font-body: ui-sans-serif, system-ui, sans-serif;
|
|
97
98
|
--vpcui-font-mono: ui-monospace, monospace;
|
|
99
|
+
|
|
100
|
+
--vpcui-link: #2673f1;
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
html.dark {
|
|
@@ -122,6 +125,8 @@ html.dark {
|
|
|
122
125
|
--vpcui-form-hover: var(--vpcui-dark-200);
|
|
123
126
|
|
|
124
127
|
--vpcui-loader-btn-color: rgba(0, 0, 0, 0.25);
|
|
128
|
+
|
|
129
|
+
--vpcui-link: #4a90e2;
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
html {
|