compote-ui 0.75.3 → 0.76.0
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/data-table-v9/index.d.ts +1 -0
- package/dist/components/data-table-v9/index.js +1 -0
- package/dist/components/data-table-v9/toolbar/data-table-column-filter.svelte +41 -11
- package/dist/components/data-table-v9/toolbar/data-table-column-filter.svelte.d.ts +1 -0
- package/dist/components/data-table-v9/toolbar/data-table-column-visibility.svelte +27 -7
- package/dist/components/data-table-v9/toolbar/data-table-column-visibility.svelte.d.ts +1 -0
- package/dist/components/data-table-v9/toolbar/data-table-refresh.svelte +46 -0
- package/dist/components/data-table-v9/toolbar/data-table-refresh.svelte.d.ts +11 -0
- package/dist/components/data-table-v9/virtual/index.d.ts +1 -1
- package/dist/components/data-table-v9/virtual/index.js +1 -1
- package/dist/components/menu/menu-content.svelte +21 -1
- package/dist/components/popover/popover-trigger.svelte +2 -2
- package/dist/components/popover/popover-trigger.svelte.d.ts +2 -2
- package/dist/icons/PhColumns.svelte +19 -0
- package/dist/icons/PhColumns.svelte.d.ts +5 -0
- package/dist/icons/PhFunnel.svelte +19 -0
- package/dist/icons/PhFunnel.svelte.d.ts +5 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/package.json +2 -2
- package/skills/data-table/SKILL.md +37 -1
|
@@ -7,5 +7,6 @@ export { default as Toolbar } from './toolbar/data-table-toolbar.svelte';
|
|
|
7
7
|
export { default as ColumnFilter } from './toolbar/data-table-column-filter.svelte';
|
|
8
8
|
export { default as ColumnVisibility } from './toolbar/data-table-column-visibility.svelte';
|
|
9
9
|
export { default as Search } from './toolbar/data-table-search.svelte';
|
|
10
|
+
export { default as Refresh } from './toolbar/data-table-refresh.svelte';
|
|
10
11
|
export type { CreateDataTableOptions, DataTableInstance } from './create-table.svelte';
|
|
11
12
|
export type { DataTableAlign, DataTableAccessorFnColumn, DataTableAccessorKeyColumn, DataTableColumn, DataTableColumnBase, DataTableColumnOptions, DataTableColumnType, DataTableCellPropsResolver, DataTableCellRenderProps, DataTableGroupColumn, DataTableLeafColumnBase, DataTableLeafColumn } from './types';
|
|
@@ -7,3 +7,4 @@ export { default as Toolbar } from './toolbar/data-table-toolbar.svelte';
|
|
|
7
7
|
export { default as ColumnFilter } from './toolbar/data-table-column-filter.svelte';
|
|
8
8
|
export { default as ColumnVisibility } from './toolbar/data-table-column-visibility.svelte';
|
|
9
9
|
export { default as Search } from './toolbar/data-table-search.svelte';
|
|
10
|
+
export { default as Refresh } from './toolbar/data-table-refresh.svelte';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { onDestroy } from 'svelte';
|
|
3
3
|
import type { Column, RowData } from '@tanstack/svelte-table';
|
|
4
4
|
import * as Popover from '../../popover';
|
|
5
|
+
import * as Tooltip from '../../tooltip';
|
|
5
6
|
import * as ScrollArea from '../../scroll-area';
|
|
6
7
|
import Checkbox from '../../checkbox/checkbox.svelte';
|
|
7
8
|
import { cn } from 'tailwind-variants';
|
|
@@ -9,14 +10,20 @@
|
|
|
9
10
|
import type { DataTableFeatures } from '../features';
|
|
10
11
|
import NumberInput from '../../number-input/number-input.svelte';
|
|
11
12
|
import * as Field from '../../field';
|
|
12
|
-
import
|
|
13
|
+
import Badge from '../../badge/badge.svelte';
|
|
14
|
+
import { button } from '../../button/button.variants';
|
|
15
|
+
import { PhX, PhMagnifyingGlass, PhFunnel } from '../../../icons';
|
|
13
16
|
|
|
14
17
|
type Props = {
|
|
15
18
|
table: DataTableInstance<T>;
|
|
19
|
+
/** Text label for the trigger. When omitted, a funnel icon is shown instead. */
|
|
16
20
|
triggerLabel?: string;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
let { table, triggerLabel
|
|
23
|
+
let { table, triggerLabel }: Props = $props();
|
|
24
|
+
|
|
25
|
+
// Popover and tooltip share one trigger element, so both must agree on its id.
|
|
26
|
+
const triggerId = $props.id();
|
|
20
27
|
|
|
21
28
|
let localText: Record<string, string> = $state({});
|
|
22
29
|
let localNumMin: Record<string, number> = $state({});
|
|
@@ -165,15 +172,38 @@
|
|
|
165
172
|
}
|
|
166
173
|
</script>
|
|
167
174
|
|
|
168
|
-
<Popover.Root positioning={{ placement: 'bottom-end' }}>
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
<Popover.Root ids={{ trigger: triggerId }} positioning={{ placement: 'bottom-end' }}>
|
|
176
|
+
<Tooltip.Root ids={{ trigger: triggerId }} disabled={!!triggerLabel}>
|
|
177
|
+
<Tooltip.Trigger>
|
|
178
|
+
{#snippet asChild(tooltipProps)}
|
|
179
|
+
<Popover.Trigger
|
|
180
|
+
{...tooltipProps()}
|
|
181
|
+
aria-label={triggerLabel ? undefined : 'Filters'}
|
|
182
|
+
class={button({
|
|
183
|
+
variant: 'outline',
|
|
184
|
+
size: triggerLabel ? 'default' : 'icon',
|
|
185
|
+
class: 'relative'
|
|
186
|
+
})}
|
|
187
|
+
>
|
|
188
|
+
{#if triggerLabel}
|
|
189
|
+
{triggerLabel}
|
|
190
|
+
{:else}
|
|
191
|
+
<PhFunnel />
|
|
192
|
+
{/if}
|
|
193
|
+
{#if activeCount > 0}
|
|
194
|
+
<Badge
|
|
195
|
+
variant="solid"
|
|
196
|
+
color="primary"
|
|
197
|
+
class="absolute top-0 right-0 size-4 translate-x-1/3 -translate-y-1/3 justify-center px-1 text-xs"
|
|
198
|
+
>
|
|
199
|
+
{activeCount > 99 ? '99+' : activeCount}
|
|
200
|
+
</Badge>
|
|
201
|
+
{/if}
|
|
202
|
+
</Popover.Trigger>
|
|
203
|
+
{/snippet}
|
|
204
|
+
</Tooltip.Trigger>
|
|
205
|
+
<Tooltip.Content>Filters</Tooltip.Content>
|
|
206
|
+
</Tooltip.Root>
|
|
177
207
|
|
|
178
208
|
<Popover.Content class="flex w-70 flex-col gap-3 p-3" showArrow={false}>
|
|
179
209
|
<div class="mr-1 flex items-center justify-between py-2.5">
|
|
@@ -3,6 +3,7 @@ import type { DataTableInstance } from '../data-table-utils';
|
|
|
3
3
|
declare function $$render<T extends RowData>(): {
|
|
4
4
|
props: {
|
|
5
5
|
table: DataTableInstance<T>;
|
|
6
|
+
/** Text label for the trigger. When omitted, a funnel icon is shown instead. */
|
|
6
7
|
triggerLabel?: string;
|
|
7
8
|
};
|
|
8
9
|
exports: {};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends RowData">
|
|
2
2
|
import type { RowData } from '@tanstack/svelte-table';
|
|
3
3
|
import * as Popover from '../../popover';
|
|
4
|
+
import * as Tooltip from '../../tooltip';
|
|
4
5
|
import * as ScrollArea from '../../scroll-area';
|
|
5
6
|
import Checkbox from '../../checkbox/checkbox.svelte';
|
|
6
7
|
import type { DataTableInstance } from '../data-table-utils';
|
|
8
|
+
import { button } from '../../button/button.variants';
|
|
9
|
+
import { PhColumns } from '../../../icons';
|
|
7
10
|
|
|
8
11
|
type Props = {
|
|
9
12
|
table: DataTableInstance<T>;
|
|
13
|
+
/** Text label for the trigger. When omitted, a columns icon is shown instead. */
|
|
10
14
|
triggerLabel?: string;
|
|
11
15
|
};
|
|
12
16
|
|
|
13
|
-
let { table, triggerLabel
|
|
17
|
+
let { table, triggerLabel }: Props = $props();
|
|
18
|
+
|
|
19
|
+
// Popover and tooltip share one trigger element, so both must agree on its id.
|
|
20
|
+
const triggerId = $props.id();
|
|
14
21
|
|
|
15
22
|
const columnVisibility = $derived.by(() => table.atoms.columnVisibility.get());
|
|
16
23
|
const allLeafColumns = $derived.by(() => {
|
|
@@ -32,12 +39,25 @@
|
|
|
32
39
|
}
|
|
33
40
|
</script>
|
|
34
41
|
|
|
35
|
-
<Popover.Root positioning={{ placement: 'bottom-end' }}>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
<Popover.Root ids={{ trigger: triggerId }} positioning={{ placement: 'bottom-end' }}>
|
|
43
|
+
<Tooltip.Root ids={{ trigger: triggerId }} disabled={!!triggerLabel}>
|
|
44
|
+
<Tooltip.Trigger>
|
|
45
|
+
{#snippet asChild(tooltipProps)}
|
|
46
|
+
<Popover.Trigger
|
|
47
|
+
{...tooltipProps()}
|
|
48
|
+
aria-label={triggerLabel ? undefined : 'Columns'}
|
|
49
|
+
class={button({ variant: 'outline', size: triggerLabel ? 'default' : 'icon' })}
|
|
50
|
+
>
|
|
51
|
+
{#if triggerLabel}
|
|
52
|
+
{triggerLabel}
|
|
53
|
+
{:else}
|
|
54
|
+
<PhColumns />
|
|
55
|
+
{/if}
|
|
56
|
+
</Popover.Trigger>
|
|
57
|
+
{/snippet}
|
|
58
|
+
</Tooltip.Trigger>
|
|
59
|
+
<Tooltip.Content>Columns</Tooltip.Content>
|
|
60
|
+
</Tooltip.Root>
|
|
41
61
|
|
|
42
62
|
<Popover.Content class="w-56 p-2" showArrow={false}>
|
|
43
63
|
<div class="border-b border-surface-3 px-2 pb-2">
|
|
@@ -3,6 +3,7 @@ import type { DataTableInstance } from '../data-table-utils';
|
|
|
3
3
|
declare function $$render<T extends RowData>(): {
|
|
4
4
|
props: {
|
|
5
5
|
table: DataTableInstance<T>;
|
|
6
|
+
/** Text label for the trigger. When omitted, a columns icon is shown instead. */
|
|
6
7
|
triggerLabel?: string;
|
|
7
8
|
};
|
|
8
9
|
exports: {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Tooltip from '../../tooltip';
|
|
3
|
+
import { PhArrowClockwise } from '../../../icons';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
/** Called on click. If it returns a promise, the button shows a busy state until it settles. */
|
|
7
|
+
onRefresh: () => void | Promise<unknown>;
|
|
8
|
+
/** Force the busy state, e.g. when a refresh is triggered elsewhere. */
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** Text label for the trigger. When omitted, a refresh icon is shown instead. */
|
|
11
|
+
triggerLabel?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let { onRefresh, loading = false, triggerLabel }: Props = $props();
|
|
15
|
+
|
|
16
|
+
let pending = $state(false);
|
|
17
|
+
const busy = $derived(loading || pending);
|
|
18
|
+
|
|
19
|
+
async function handleClick() {
|
|
20
|
+
if (busy) return;
|
|
21
|
+
pending = true;
|
|
22
|
+
try {
|
|
23
|
+
await onRefresh();
|
|
24
|
+
} finally {
|
|
25
|
+
pending = false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<Tooltip.Root disabled={!!triggerLabel}>
|
|
31
|
+
<!-- aria-disabled instead of disabled so keyboard focus isn't lost mid-refresh -->
|
|
32
|
+
<Tooltip.Trigger
|
|
33
|
+
type="button"
|
|
34
|
+
variant="outline"
|
|
35
|
+
size={triggerLabel ? 'default' : 'icon'}
|
|
36
|
+
class="aria-disabled:cursor-default"
|
|
37
|
+
aria-label={triggerLabel ? undefined : 'Refresh'}
|
|
38
|
+
aria-busy={busy}
|
|
39
|
+
aria-disabled={busy}
|
|
40
|
+
onclick={handleClick}
|
|
41
|
+
>
|
|
42
|
+
<PhArrowClockwise class={busy ? 'animate-spin motion-reduce:animate-none' : undefined} />
|
|
43
|
+
{triggerLabel}
|
|
44
|
+
</Tooltip.Trigger>
|
|
45
|
+
<Tooltip.Content>Refresh</Tooltip.Content>
|
|
46
|
+
</Tooltip.Root>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** Called on click. If it returns a promise, the button shows a busy state until it settles. */
|
|
3
|
+
onRefresh: () => void | Promise<unknown>;
|
|
4
|
+
/** Force the busy state, e.g. when a refresh is triggered elsewhere. */
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
/** Text label for the trigger. When omitted, a refresh icon is shown instead. */
|
|
7
|
+
triggerLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const DataTableRefresh: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type DataTableRefresh = ReturnType<typeof DataTableRefresh>;
|
|
11
|
+
export default DataTableRefresh;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as Root } from './data-table-virtualized.svelte';
|
|
2
|
-
export { ColumnFilter, ColumnVisibility, FlexRender, Search, Title, Toolbar, createDataTableColumnHelper, createTable, renderComponent, renderSnippet } from '../index';
|
|
2
|
+
export { ColumnFilter, ColumnVisibility, FlexRender, Refresh, Search, Title, Toolbar, createDataTableColumnHelper, createTable, renderComponent, renderSnippet } from '../index';
|
|
3
3
|
export type { CreateDataTableOptions, DataTableAccessorFnColumn, DataTableAccessorKeyColumn, DataTableAlign, DataTableCellPropsResolver, DataTableCellRenderProps, DataTableColumn, DataTableColumnBase, DataTableColumnOptions, DataTableColumnType, DataTableGroupColumn, DataTableInstance, DataTableLeafColumn, DataTableLeafColumnBase } from '../index';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Root } from './data-table-virtualized.svelte';
|
|
2
|
-
export { ColumnFilter, ColumnVisibility, FlexRender, Search, Title, Toolbar, createDataTableColumnHelper, createTable, renderComponent, renderSnippet } from '../index';
|
|
2
|
+
export { ColumnFilter, ColumnVisibility, FlexRender, Refresh, Search, Title, Toolbar, createDataTableColumnHelper, createTable, renderComponent, renderSnippet } from '../index';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Menu } from '@ark-ui/svelte/menu';
|
|
2
|
+
import { Menu, useMenuContext } from '@ark-ui/svelte/menu';
|
|
3
3
|
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
4
|
import type { MenuContentBaseProps } from '@ark-ui/svelte/menu';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
@@ -11,6 +11,26 @@
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const { class: className, children, ...restProps }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const menu = useMenuContext();
|
|
16
|
+
const open = $derived(menu().open);
|
|
17
|
+
|
|
18
|
+
// Workaround for context menus opening at (0,0) the first time: zag skips
|
|
19
|
+
// `trackPositioning` for context triggers, so `currentPlacement` is first set in
|
|
20
|
+
// the popper's onComplete — after it wrote --x/--y. That changes the positioner
|
|
21
|
+
// style, and Svelte rewrites the whole `style` attribute, wiping --x/--y.
|
|
22
|
+
// Re-positioning once that settles makes the coordinates stick.
|
|
23
|
+
$effect(() => {
|
|
24
|
+
if (!open) return;
|
|
25
|
+
let inner = 0;
|
|
26
|
+
const outer = requestAnimationFrame(() => {
|
|
27
|
+
inner = requestAnimationFrame(() => menu().reposition());
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
cancelAnimationFrame(outer);
|
|
31
|
+
cancelAnimationFrame(inner);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
14
34
|
</script>
|
|
15
35
|
|
|
16
36
|
<Portal>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Popover } from '@ark-ui/svelte/popover';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PopoverTriggerProps } from '@ark-ui/svelte/popover';
|
|
4
4
|
import type { ClassValue } from 'svelte/elements';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
|
|
7
|
-
interface Props extends
|
|
7
|
+
interface Props extends Omit<PopoverTriggerProps, 'class' | 'children'> {
|
|
8
8
|
class?: ClassValue;
|
|
9
9
|
children: Snippet;
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopoverTriggerProps } from '@ark-ui/svelte/popover';
|
|
2
2
|
import type { ClassValue } from 'svelte/elements';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
-
interface Props extends
|
|
4
|
+
interface Props extends Omit<PopoverTriggerProps, 'class' | 'children'> {
|
|
5
5
|
class?: ClassValue;
|
|
6
6
|
children: Snippet;
|
|
7
7
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { class: className = '', ...restProps } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
width="1em"
|
|
8
|
+
height="1em"
|
|
9
|
+
viewBox="0 0 256 256"
|
|
10
|
+
class={className}
|
|
11
|
+
{...restProps}
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
d="M104,32H64A16,16,0,0,0,48,48V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,104,32Zm0,176H64V48h40ZM192,32H152a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,192,32Zm0,176H152V48h40Z"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
|
|
19
|
+
<!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { class: className = '', ...restProps } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
width="1em"
|
|
8
|
+
height="1em"
|
|
9
|
+
viewBox="0 0 256 256"
|
|
10
|
+
class={className}
|
|
11
|
+
{...restProps}
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
d="M230.6,49.53A15.81,15.81,0,0,0,216,40H40A16,16,0,0,0,28.19,66.76l.08.09L96,139.17V216a16,16,0,0,0,24.87,13.32l32-21.34A16,16,0,0,0,160,194.66V139.17l67.74-72.32.08-.09A15.8,15.8,0,0,0,230.6,49.53ZM40,56h0Zm106.18,74.58A8,8,0,0,0,144,136v58.66L112,216V136a8,8,0,0,0-2.16-5.47L40,56H216Z"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
|
|
19
|
+
<!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -9,11 +9,13 @@ export { default as PhCaretDown } from './PhCaretDown.svelte';
|
|
|
9
9
|
export { default as PhCaretRight } from './PhCaretRight.svelte';
|
|
10
10
|
export { default as PhCaretUp } from './PhCaretUp.svelte';
|
|
11
11
|
export { default as PhCheck } from './PhCheck.svelte';
|
|
12
|
+
export { default as PhColumns } from './PhColumns.svelte';
|
|
12
13
|
export { default as PhEye } from './PhEye.svelte';
|
|
13
14
|
export { default as PhEyeSlash } from './PhEyeSlash.svelte';
|
|
14
15
|
export { default as PhFile } from './PhFile.svelte';
|
|
15
16
|
export { default as PhFileArchive } from './PhFileArchive.svelte';
|
|
16
17
|
export { default as PhFileText } from './PhFileText.svelte';
|
|
18
|
+
export { default as PhFunnel } from './PhFunnel.svelte';
|
|
17
19
|
export { default as PhHeadphones } from './PhHeadphones.svelte';
|
|
18
20
|
export { default as PhImage } from './PhImage.svelte';
|
|
19
21
|
export { default as PhListMagnifyingGlass } from './PhListMagnifyingGlass.svelte';
|
package/dist/icons/index.js
CHANGED
|
@@ -9,11 +9,13 @@ export { default as PhCaretDown } from './PhCaretDown.svelte';
|
|
|
9
9
|
export { default as PhCaretRight } from './PhCaretRight.svelte';
|
|
10
10
|
export { default as PhCaretUp } from './PhCaretUp.svelte';
|
|
11
11
|
export { default as PhCheck } from './PhCheck.svelte';
|
|
12
|
+
export { default as PhColumns } from './PhColumns.svelte';
|
|
12
13
|
export { default as PhEye } from './PhEye.svelte';
|
|
13
14
|
export { default as PhEyeSlash } from './PhEyeSlash.svelte';
|
|
14
15
|
export { default as PhFile } from './PhFile.svelte';
|
|
15
16
|
export { default as PhFileArchive } from './PhFileArchive.svelte';
|
|
16
17
|
export { default as PhFileText } from './PhFileText.svelte';
|
|
18
|
+
export { default as PhFunnel } from './PhFunnel.svelte';
|
|
17
19
|
export { default as PhHeadphones } from './PhHeadphones.svelte';
|
|
18
20
|
export { default as PhImage } from './PhImage.svelte';
|
|
19
21
|
export { default as PhListMagnifyingGlass } from './PhListMagnifyingGlass.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compote-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@tailwindcss/vite": "^4.3.3",
|
|
72
72
|
"@tanstack/intent": "^0.4.0",
|
|
73
73
|
"@tanstack/svelte-table": "9.2.4",
|
|
74
|
-
"@types/node": "^
|
|
74
|
+
"@types/node": "^24",
|
|
75
75
|
"eslint": "^10.10.0",
|
|
76
76
|
"eslint-config-prettier": "^10.1.8",
|
|
77
77
|
"eslint-plugin-svelte": "^3.23.0",
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
metadata:
|
|
9
9
|
type: composition
|
|
10
10
|
library: compote-ui
|
|
11
|
-
library_version: '0.
|
|
11
|
+
library_version: '0.75.5'
|
|
12
12
|
requires:
|
|
13
13
|
- component-usage
|
|
14
14
|
- theming
|
|
@@ -151,6 +151,42 @@ bun add @tanstack/svelte-virtual
|
|
|
151
151
|
</div>
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
### Label toolbar triggers
|
|
155
|
+
|
|
156
|
+
`ColumnFilter` and `ColumnVisibility` render icon-only outline buttons by default (funnel and
|
|
157
|
+
columns icons, with `aria-label` and a hover tooltip). Pass `triggerLabel` to show text instead. `ColumnFilter`
|
|
158
|
+
shows the active filter count as a badge in the corner either way.
|
|
159
|
+
|
|
160
|
+
```svelte
|
|
161
|
+
<DataTable.ColumnFilter {table} triggerLabel="Filters" />
|
|
162
|
+
<DataTable.ColumnVisibility {table} triggerLabel="Columns" />
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Add a refresh button
|
|
166
|
+
|
|
167
|
+
`DataTable.Refresh` is data-source agnostic: it calls `onRefresh` and, if that returns a promise,
|
|
168
|
+
spins its icon and sets `aria-busy` until the promise settles. Clicks while busy are ignored. Pass
|
|
169
|
+
`loading` to force the busy state when a refresh starts elsewhere (polling, another control).
|
|
170
|
+
|
|
171
|
+
```svelte
|
|
172
|
+
<script lang="ts">
|
|
173
|
+
import { getInvoices } from './invoices.remote';
|
|
174
|
+
|
|
175
|
+
const invoices = getInvoices();
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<DataTable.Toolbar>
|
|
179
|
+
{#snippet right()}
|
|
180
|
+
<DataTable.Refresh onRefresh={() => invoices.refresh()} />
|
|
181
|
+
<DataTable.ColumnFilter {table} />
|
|
182
|
+
<DataTable.ColumnVisibility {table} />
|
|
183
|
+
{/snippet}
|
|
184
|
+
</DataTable.Toolbar>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Props: `onRefresh: () => void | Promise<unknown>`, `loading?: boolean`, `triggerLabel?: string`
|
|
188
|
+
(icon-only with `aria-label="Refresh"` and a tooltip when omitted). Errors thrown by `onRefresh` are not caught.
|
|
189
|
+
|
|
154
190
|
## Common Mistakes
|
|
155
191
|
|
|
156
192
|
### CRITICAL Missing id for accessorFn column
|