sveltacular 0.0.5 → 0.0.6
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/generic/section/section.svelte +2 -2
- package/dist/layout/flex-col.svelte +4 -4
- package/dist/layout/flex-col.svelte.d.ts +3 -3
- package/dist/layout/flex-row.svelte +8 -2
- package/dist/layout/flex-row.svelte.d.ts +3 -1
- package/dist/tables/data-grid.svelte +17 -3
- package/dist/tables/data-grid.svelte.d.ts +1 -0
- package/dist/tables/table-caption.svelte +14 -0
- package/dist/tables/table-caption.svelte.d.ts +27 -0
- package/dist/tables/table-cell.svelte +13 -7
- package/dist/tables/table-cell.svelte.d.ts +1 -0
- package/dist/tables/table-footer-cell.svelte +3 -0
- package/dist/tables/table-header-cell.svelte +19 -12
- package/dist/tables/table-header-cell.svelte.d.ts +1 -0
- package/dist/types/data.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let
|
|
3
|
-
export let gap =
|
|
1
|
+
<script>export let marginBottom = "1rem";
|
|
2
|
+
export let marginTop = "1rem";
|
|
3
|
+
export let gap = "1rem";
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<div style={`margin: ${
|
|
6
|
+
<div style={`margin: ${marginTop} ${marginBottom}; gap: ${gap}`}>
|
|
7
7
|
<slot />
|
|
8
8
|
</div>
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
gap?: number | undefined;
|
|
4
|
+
marginBottom?: string | number | undefined;
|
|
5
|
+
marginTop?: string | number | undefined;
|
|
6
|
+
gap?: string | number | undefined;
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
<script>export let
|
|
1
|
+
<script>export let marginBottom = "1rem";
|
|
2
|
+
export let marginTop = "1rem";
|
|
3
|
+
export let gap = "1rem";
|
|
2
4
|
export let layout = "stretch";
|
|
3
5
|
export let size = "full";
|
|
4
6
|
export let wrap = false;
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
|
-
<div
|
|
9
|
+
<div
|
|
10
|
+
style={`margin: ${marginTop} ${marginBottom}; gap: ${gap}`}
|
|
11
|
+
class="{layout} {size} {wrap ? 'wrap' : 'nowrap'}"
|
|
12
|
+
>
|
|
8
13
|
<slot />
|
|
9
14
|
</div>
|
|
10
15
|
|
|
@@ -14,6 +19,7 @@ export let wrap = false;
|
|
|
14
19
|
justify-content: center;
|
|
15
20
|
align-items: center;
|
|
16
21
|
flex-wrap: nowrap;
|
|
22
|
+
column-gap: 1rem;
|
|
17
23
|
}
|
|
18
24
|
div *.auto {
|
|
19
25
|
width: auto;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
|
|
4
|
+
marginBottom?: string | number | undefined;
|
|
5
|
+
marginTop?: string | number | undefined;
|
|
6
|
+
gap?: string | number | undefined;
|
|
5
7
|
layout?: "stretch" | "center" | "end" | "start" | undefined;
|
|
6
8
|
size?: "full" | "auto" | undefined;
|
|
7
9
|
wrap?: boolean | undefined;
|
|
@@ -8,6 +8,9 @@ import TableHeaderRow from "./table-header-row.svelte";
|
|
|
8
8
|
import TableHeader from "./table-header.svelte";
|
|
9
9
|
import TableRow from "./table-row.svelte";
|
|
10
10
|
import Table from "./table.svelte";
|
|
11
|
+
import Text from "../typography/text.svelte";
|
|
12
|
+
import TableCaption from "./table-caption.svelte";
|
|
13
|
+
export let caption = "";
|
|
11
14
|
export let data;
|
|
12
15
|
export let cols;
|
|
13
16
|
$:
|
|
@@ -15,11 +18,14 @@ $:
|
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
20
|
<Table>
|
|
21
|
+
{#if caption}
|
|
22
|
+
<TableCaption>{caption}</TableCaption>
|
|
23
|
+
{/if}
|
|
18
24
|
<TableHeader>
|
|
19
25
|
<TableHeaderRow>
|
|
20
26
|
{#each cols as col}
|
|
21
27
|
{#if !col.hide}
|
|
22
|
-
<TableHeaderCell>{col.label}</TableHeaderCell>
|
|
28
|
+
<TableHeaderCell type={col.type || typeof data[0][col.key]}>{col.label}</TableHeaderCell>
|
|
23
29
|
{/if}
|
|
24
30
|
{/each}
|
|
25
31
|
</TableHeaderRow>
|
|
@@ -29,7 +35,13 @@ $:
|
|
|
29
35
|
<TableRow>
|
|
30
36
|
{#each cols as col}
|
|
31
37
|
{#if !col.hide}
|
|
32
|
-
<TableCell
|
|
38
|
+
<TableCell type={col.type || typeof row[col.key]}>
|
|
39
|
+
{#if col.format}
|
|
40
|
+
{col.format(row, col.key)}
|
|
41
|
+
{:else}
|
|
42
|
+
{row[col.key]}
|
|
43
|
+
{/if}
|
|
44
|
+
</TableCell>
|
|
33
45
|
{/if}
|
|
34
46
|
{/each}
|
|
35
47
|
</TableRow>
|
|
@@ -37,7 +49,9 @@ $:
|
|
|
37
49
|
</TableBody>
|
|
38
50
|
<TableFooter>
|
|
39
51
|
<TableFooterRow>
|
|
40
|
-
<TableFooterCell colspan={colCount}>
|
|
52
|
+
<TableFooterCell colspan={colCount}>
|
|
53
|
+
<Text transform="uppercase">Page 1 of 50</Text>
|
|
54
|
+
</TableFooterCell>
|
|
41
55
|
</TableFooterRow>
|
|
42
56
|
</TableFooter>
|
|
43
57
|
</Table>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<caption>
|
|
2
|
+
<slot />
|
|
3
|
+
</caption>
|
|
4
|
+
|
|
5
|
+
<style>caption {
|
|
6
|
+
padding: 0.5rem 0.75rem;
|
|
7
|
+
font-weight: 600;
|
|
8
|
+
font-size: 1rem;
|
|
9
|
+
line-height: 1.25rem;
|
|
10
|
+
letter-spacing: 0.1em;
|
|
11
|
+
text-transform: uppercase;
|
|
12
|
+
font-family: sans-serif;
|
|
13
|
+
text-shadow: 1px 1px 1px black;
|
|
14
|
+
}</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} TableCaptionProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} TableCaptionEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} TableCaptionSlots */
|
|
4
|
+
export default class TableCaption extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type TableCaptionProps = typeof __propDef.props;
|
|
13
|
+
export type TableCaptionEvents = typeof __propDef.events;
|
|
14
|
+
export type TableCaptionSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponent } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
<script>export let colspan = 1;
|
|
2
|
+
export let type = void 0;
|
|
2
3
|
</script>
|
|
3
4
|
|
|
4
|
-
<td {colspan}>
|
|
5
|
+
<td {colspan} class={type}>
|
|
5
6
|
<slot />
|
|
6
7
|
</td>
|
|
7
8
|
|
|
8
|
-
<style>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
<style>td {
|
|
10
|
+
padding: 0.5rem;
|
|
11
|
+
font-size: 1rem;
|
|
12
|
+
}
|
|
13
|
+
td.currency, td.number {
|
|
14
|
+
text-align: right;
|
|
15
|
+
}
|
|
16
|
+
td.boolean {
|
|
17
|
+
text-align: center;
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
}</style>
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
<script>export let colspan = 1;
|
|
2
|
+
export let type = void 0;
|
|
2
3
|
</script>
|
|
3
4
|
|
|
4
|
-
<th {colspan}>
|
|
5
|
+
<th {colspan} class={type}>
|
|
5
6
|
<slot />
|
|
6
7
|
</th>
|
|
7
8
|
|
|
8
|
-
<style>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
<style>th {
|
|
10
|
+
text-align: left;
|
|
11
|
+
padding: 0.5rem 0.75rem;
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
font-size: 0.8rem;
|
|
14
|
+
font-family: sans-serif;
|
|
15
|
+
line-height: 1.25rem;
|
|
16
|
+
letter-spacing: 0.015em;
|
|
17
|
+
text-transform: uppercase;
|
|
18
|
+
text-shadow: 1px 1px 1px black;
|
|
19
|
+
}
|
|
20
|
+
th.currency, th.number {
|
|
21
|
+
text-align: right;
|
|
22
|
+
}
|
|
23
|
+
th.boolean {
|
|
24
|
+
text-align: center;
|
|
25
|
+
}</style>
|
package/dist/types/data.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type DataRow =
|
|
2
|
-
[key: string]: unknown;
|
|
3
|
-
};
|
|
1
|
+
export type DataRow = Record<string, unknown>;
|
|
4
2
|
export type DataCol = {
|
|
5
3
|
key: string;
|
|
6
4
|
label: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
format?: (row: DataRow, key: string) => string;
|
|
7
7
|
hide?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export type Pagination = {
|