@reshape-biotech/design-system 0.0.35 → 0.0.36
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/table/Table.stories.svelte +17 -13
- package/dist/components/table/Table.svelte +17 -1
- package/dist/components/table/Table.svelte.d.ts +13 -7
- package/dist/components/table/components/TBody.svelte +14 -0
- package/dist/components/table/components/TBody.svelte.d.ts +8 -0
- package/dist/components/table/components/THead.svelte +14 -0
- package/dist/components/table/components/THead.svelte.d.ts +8 -0
- package/package.json +1 -1
|
@@ -67,20 +67,24 @@
|
|
|
67
67
|
<Story name="Base">
|
|
68
68
|
<Table>
|
|
69
69
|
{#snippet children({ C })}
|
|
70
|
-
<C.
|
|
71
|
-
<C.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
{#each users as user}
|
|
77
|
-
<C.Tr disabled={user.role === 'deactivated'}>
|
|
78
|
-
<C.Td>{user.name}</C.Td>
|
|
79
|
-
<C.Td>{user.age}</C.Td>
|
|
80
|
-
<C.Td>{user.role}</C.Td>
|
|
81
|
-
<C.Td><IconButton disabled={user.role === 'deactivated'}><Phone /></IconButton></C.Td>
|
|
70
|
+
<C.THead>
|
|
71
|
+
<C.Tr>
|
|
72
|
+
<C.Th>Name</C.Th>
|
|
73
|
+
<C.Th>Age</C.Th>
|
|
74
|
+
<C.Th class="w-[100px]">Role</C.Th>
|
|
75
|
+
<C.Th class="w-6"></C.Th>
|
|
82
76
|
</C.Tr>
|
|
83
|
-
|
|
77
|
+
</C.THead>
|
|
78
|
+
<C.TBody>
|
|
79
|
+
{#each users as user}
|
|
80
|
+
<C.Tr disabled={user.role === 'deactivated'}>
|
|
81
|
+
<C.Td>{user.name}</C.Td>
|
|
82
|
+
<C.Td>{user.age}</C.Td>
|
|
83
|
+
<C.Td>{user.role}</C.Td>
|
|
84
|
+
<C.Td><IconButton disabled={user.role === 'deactivated'}><Phone /></IconButton></C.Td>
|
|
85
|
+
</C.Tr>
|
|
86
|
+
{/each}
|
|
87
|
+
</C.TBody>
|
|
84
88
|
{/snippet}
|
|
85
89
|
</Table>
|
|
86
90
|
</Story>
|
|
@@ -3,14 +3,30 @@
|
|
|
3
3
|
import Td from './components/Td.svelte';
|
|
4
4
|
import Th from './components/Th.svelte';
|
|
5
5
|
import Tr from './components/Tr.svelte';
|
|
6
|
+
import THead from './components/THead.svelte';
|
|
7
|
+
import TBody from './components/TBody.svelte';
|
|
6
8
|
|
|
7
9
|
interface Props {
|
|
8
10
|
tableLayout?: 'fixed' | 'auto';
|
|
9
|
-
children?: Snippet<
|
|
11
|
+
children?: Snippet<
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
C: {
|
|
15
|
+
THead: typeof THead;
|
|
16
|
+
TBody: typeof TBody;
|
|
17
|
+
Tr: typeof Tr;
|
|
18
|
+
Th: typeof Th;
|
|
19
|
+
Td: typeof Td;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
>;
|
|
10
24
|
}
|
|
11
25
|
|
|
12
26
|
let { tableLayout = 'fixed', children }: Props = $props();
|
|
13
27
|
const C = {
|
|
28
|
+
THead: THead,
|
|
29
|
+
TBody: TBody,
|
|
14
30
|
Tr: Tr,
|
|
15
31
|
Th: Th,
|
|
16
32
|
Td: Td
|
|
@@ -2,15 +2,21 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import Td from './components/Td.svelte';
|
|
3
3
|
import Th from './components/Th.svelte';
|
|
4
4
|
import Tr from './components/Tr.svelte';
|
|
5
|
+
import THead from './components/THead.svelte';
|
|
6
|
+
import TBody from './components/TBody.svelte';
|
|
5
7
|
interface Props {
|
|
6
8
|
tableLayout?: 'fixed' | 'auto';
|
|
7
|
-
children?: Snippet<[
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
children?: Snippet<[
|
|
10
|
+
{
|
|
11
|
+
C: {
|
|
12
|
+
THead: typeof THead;
|
|
13
|
+
TBody: typeof TBody;
|
|
14
|
+
Tr: typeof Tr;
|
|
15
|
+
Th: typeof Th;
|
|
16
|
+
Td: typeof Td;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
]>;
|
|
14
20
|
}
|
|
15
21
|
declare const Table: import("svelte").Component<Props, {}, "">;
|
|
16
22
|
type Table = ReturnType<typeof Table>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { class: className = '', children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<tbody class={`${className}`}>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</tbody>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { class: className = '', children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<thead class={`${className}`}>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</thead>
|