@valerius_petrini/corekit-ui 0.1.55 → 0.1.56
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/Input.svelte +1 -1
- package/dist/components/Progress.svelte +1 -0
- package/dist/components/Table.svelte +47 -0
- package/dist/components/Table.svelte.d.ts +4 -0
- package/dist/styles/layout.css +1 -1
- package/dist/types/Table.d.ts +14 -0
- package/dist/types/Table.js +3 -0
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
const lifted = $derived(isFloating && (isFocused || hasContent));
|
|
101
101
|
|
|
102
102
|
const Icon = $derived(icon ?? ({
|
|
103
|
-
|
|
103
|
+
email: Mail, password: Lock, tel: Phone
|
|
104
104
|
}[restProps.type as string] as Component ?? null));
|
|
105
105
|
|
|
106
106
|
let defaultClass = "text-main-text w-full rounded outline-none px-1.5 w-full bg-inherit border-0 focus:ring-0 focus-visible:ring-0";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableProps } from "../types/Table.js";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children = undefined,
|
|
7
|
+
class: className = "",
|
|
8
|
+
tableHeaders = [],
|
|
9
|
+
tableData = [],
|
|
10
|
+
size = "md",
|
|
11
|
+
radius = "md",
|
|
12
|
+
...restProps
|
|
13
|
+
}: TableProps = $props();
|
|
14
|
+
|
|
15
|
+
const defaultTableClass = "w-full border-collapse text-main-text border border-form-border border-l-0";
|
|
16
|
+
const defaultTableHeaderClass = "text-left border-b border-b-1 border-b-form-border bg-sub-background font-medium";
|
|
17
|
+
const defaultTableCellClass = "p-2 text-sm border-l border-l-[1px] border-l-form-border";
|
|
18
|
+
const defaultTableBodyClass = "even:bg-sub-background odd:bg-form-background";
|
|
19
|
+
|
|
20
|
+
const combinedTableClass = $derived(twMerge(
|
|
21
|
+
defaultTableClass,
|
|
22
|
+
className
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
const combinedTableHeaderClass = $derived(twMerge(defaultTableHeaderClass, defaultTableCellClass));
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<div class="overflow-auto w-full">
|
|
29
|
+
<table {...restProps} class={combinedTableClass}>
|
|
30
|
+
<thead>
|
|
31
|
+
<tr>
|
|
32
|
+
{#each tableHeaders as header}
|
|
33
|
+
<th class={combinedTableHeaderClass}>{header.label}</th>
|
|
34
|
+
{/each}
|
|
35
|
+
</tr>
|
|
36
|
+
</thead>
|
|
37
|
+
<tbody>
|
|
38
|
+
{#each tableData as row}
|
|
39
|
+
<tr class={defaultTableBodyClass}>
|
|
40
|
+
{#each row as cell}
|
|
41
|
+
<td class={defaultTableCellClass}>{cell}</td>
|
|
42
|
+
{/each}
|
|
43
|
+
</tr>
|
|
44
|
+
{/each}
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
</div>
|
package/dist/styles/layout.css
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SizeStyle } from "../styles/size.js";
|
|
2
|
+
export interface TableHeaders {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TableProps {
|
|
7
|
+
children?: any;
|
|
8
|
+
class?: string;
|
|
9
|
+
tableHeaders?: TableHeaders[];
|
|
10
|
+
tableData?: any[];
|
|
11
|
+
size?: SizeStyle;
|
|
12
|
+
radius?: SizeStyle;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|