compote-ui 0.79.1 → 0.80.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/column-filter-editing.svelte.d.ts +41 -0
- package/dist/components/data-table-v9/column-filter-editing.svelte.js +88 -0
- package/dist/components/data-table-v9/column-filter-kind.d.ts +10 -0
- package/dist/components/data-table-v9/column-filter-kind.js +25 -0
- package/dist/components/data-table-v9/create-table.svelte.js +49 -26
- package/dist/components/data-table-v9/data-table-head.svelte +230 -201
- package/dist/components/data-table-v9/data-table-head.svelte.d.ts +2 -0
- package/dist/components/data-table-v9/data-table-utils.d.ts +7 -0
- package/dist/components/data-table-v9/data-table-utils.js +4 -0
- package/dist/components/data-table-v9/data-table.svelte +154 -151
- package/dist/components/data-table-v9/data-table.svelte.d.ts +2 -0
- package/dist/components/data-table-v9/date-cell.d.ts +13 -0
- package/dist/components/data-table-v9/date-cell.js +38 -0
- package/dist/components/data-table-v9/filter-editors/boolean-filter-editor.svelte +45 -0
- package/dist/components/data-table-v9/filter-editors/boolean-filter-editor.svelte.d.ts +7 -0
- package/dist/components/data-table-v9/filter-editors/column-filter-editor.svelte +33 -0
- package/dist/components/data-table-v9/filter-editors/column-filter-editor.svelte.d.ts +30 -0
- package/dist/components/data-table-v9/filter-editors/date-range-filter-editor.svelte +52 -0
- package/dist/components/data-table-v9/filter-editors/date-range-filter-editor.svelte.d.ts +28 -0
- package/dist/components/data-table-v9/filter-editors/range-filter-editor.svelte +51 -0
- package/dist/components/data-table-v9/filter-editors/range-filter-editor.svelte.d.ts +30 -0
- package/dist/components/data-table-v9/filter-editors/select-filter-editor.svelte +59 -0
- package/dist/components/data-table-v9/filter-editors/select-filter-editor.svelte.d.ts +28 -0
- package/dist/components/data-table-v9/filter-editors/text-filter-editor.svelte +20 -0
- package/dist/components/data-table-v9/filter-editors/text-filter-editor.svelte.d.ts +8 -0
- package/dist/components/data-table-v9/filter-revisions.svelte.d.ts +17 -0
- package/dist/components/data-table-v9/filter-revisions.svelte.js +42 -0
- package/dist/components/data-table-v9/header/column-header-filter.svelte +66 -0
- package/dist/components/data-table-v9/header/column-header-filter.svelte.d.ts +30 -0
- package/dist/components/data-table-v9/table-view-state.svelte.d.ts +1 -0
- package/dist/components/data-table-v9/table-view-state.svelte.js +3 -0
- package/dist/components/data-table-v9/toolbar/data-table-column-filter.svelte +203 -433
- package/dist/components/data-table-v9/toolbar/data-table-column-filter.svelte.d.ts +1 -1
- package/dist/components/data-table-v9/virtual/data-table-virtualized.svelte +82 -79
- package/dist/components/data-table-v9/virtual/data-table-virtualized.svelte.d.ts +2 -0
- package/dist/components/dialog/alert-dialog.svelte +73 -71
- package/dist/components/dialog/dialog-root.svelte +45 -43
- package/dist/components/drawer/drawer-content.svelte +213 -211
- package/dist/components/number-input/number-input.svelte +2 -6
- package/dist/components/popover/popover-content.svelte +97 -71
- package/dist/components/popover/popover-content.svelte.d.ts +2 -1
- package/dist/components/popover/popover-description.svelte +19 -15
- package/dist/components/popover/popover-labels.svelte.d.ts +18 -0
- package/dist/components/popover/popover-labels.svelte.js +35 -0
- package/dist/components/popover/popover-root.svelte +27 -24
- package/dist/components/popover/popover-title.svelte +19 -15
- package/dist/icons/PhFunnelFill.svelte +19 -0
- package/dist/icons/PhFunnelFill.svelte.d.ts +5 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/utils/date-filter.d.ts +31 -0
- package/dist/utils/date-filter.js +58 -0
- package/dist/utils/date.d.ts +19 -1
- package/dist/utils/date.js +48 -1
- package/dist/utils/debounced-filter-edit.svelte.d.ts +16 -0
- package/dist/utils/debounced-filter-edit.svelte.js +56 -0
- package/dist/utils/number-input-value.d.ts +10 -0
- package/dist/utils/number-input-value.js +15 -0
- package/dist/utils/range-filter.d.ts +19 -0
- package/dist/utils/range-filter.js +23 -0
- package/dist/utils/release-focus-on-exit.d.ts +22 -0
- package/dist/utils/release-focus-on-exit.js +26 -0
- package/package.json +1 -1
- package/skills/component-usage/SKILL.md +1 -1
- package/skills/component-usage/references/forms-and-inputs.md +3 -0
- package/skills/component-usage/references/overlays-and-floating-ui.md +278 -273
- package/skills/data-table/SKILL.md +314 -283
- package/skills/data-table/references/column-options.md +175 -150
- package/skills/data-table/references/table-state-and-reactivity.md +65 -45
|
@@ -1,79 +1,82 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends RowData">
|
|
2
|
-
import type { RowData } from '@tanstack/svelte-table';
|
|
3
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import { cn, type ClassValue } from 'tailwind-variants';
|
|
5
|
-
import type { DataTableInstance } from '../data-table-utils';
|
|
6
|
-
import { createTableViewState } from '../table-view-state.svelte';
|
|
7
|
-
import DataTableHead from '../data-table-head.svelte';
|
|
8
|
-
import DataTableFoot from '../data-table-foot.svelte';
|
|
9
|
-
import DataTableVirtualRows from './data-table-virtual-rows.svelte';
|
|
10
|
-
import { tableSizeStyle } from '../data-table-utils';
|
|
11
|
-
|
|
12
|
-
type Props = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
|
|
13
|
-
table: DataTableInstance<T>;
|
|
14
|
-
caption?: string;
|
|
15
|
-
emptyMessage?: string;
|
|
16
|
-
class?: ClassValue;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
{
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{/if}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
<script lang="ts" generics="T extends RowData">
|
|
2
|
+
import type { RowData } from '@tanstack/svelte-table';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn, type ClassValue } from 'tailwind-variants';
|
|
5
|
+
import type { DataTableInstance } from '../data-table-utils';
|
|
6
|
+
import { createTableViewState } from '../table-view-state.svelte';
|
|
7
|
+
import DataTableHead from '../data-table-head.svelte';
|
|
8
|
+
import DataTableFoot from '../data-table-foot.svelte';
|
|
9
|
+
import DataTableVirtualRows from './data-table-virtual-rows.svelte';
|
|
10
|
+
import { tableSizeStyle } from '../data-table-utils';
|
|
11
|
+
|
|
12
|
+
type Props = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
|
|
13
|
+
table: DataTableInstance<T>;
|
|
14
|
+
caption?: string;
|
|
15
|
+
emptyMessage?: string;
|
|
16
|
+
class?: ClassValue;
|
|
17
|
+
/** Show a filter funnel in the header of every filterable column. */
|
|
18
|
+
headerFilters?: boolean;
|
|
19
|
+
onRowClick?: (details: { row: T; event: MouseEvent }) => void;
|
|
20
|
+
onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
table,
|
|
25
|
+
caption,
|
|
26
|
+
emptyMessage = 'No rows found',
|
|
27
|
+
class: className,
|
|
28
|
+
headerFilters = false,
|
|
29
|
+
onRowClick,
|
|
30
|
+
onRowDoubleClick,
|
|
31
|
+
...rest
|
|
32
|
+
}: Props = $props();
|
|
33
|
+
|
|
34
|
+
let scrollContainerRef = $state<HTMLDivElement | undefined>(undefined);
|
|
35
|
+
|
|
36
|
+
const view = createTableViewState(() => table);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<div
|
|
40
|
+
class={cn(
|
|
41
|
+
'flex max-h-full min-h-0 flex-col overflow-hidden rounded-lg border border-surface-3 bg-surface-1',
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...rest}
|
|
45
|
+
>
|
|
46
|
+
{#if view.isColumnResizing}
|
|
47
|
+
<div aria-hidden="true" class="fixed inset-0 z-50 cursor-col-resize select-none"></div>
|
|
48
|
+
{/if}
|
|
49
|
+
|
|
50
|
+
<div class="min-h-0 flex-1 overflow-auto" bind:this={scrollContainerRef}>
|
|
51
|
+
<table
|
|
52
|
+
class="table-fixed border-separate border-spacing-0 text-sm"
|
|
53
|
+
style="display: grid; {tableSizeStyle(table, view.isRowSelectionEnabled, view)}"
|
|
54
|
+
>
|
|
55
|
+
{#if caption}
|
|
56
|
+
<caption class="sr-only">{caption}</caption>
|
|
57
|
+
{/if}
|
|
58
|
+
<DataTableHead {table} {view} isVirtual {headerFilters} />
|
|
59
|
+
{#if scrollContainerRef}
|
|
60
|
+
<DataTableVirtualRows
|
|
61
|
+
{table}
|
|
62
|
+
{view}
|
|
63
|
+
scrollContainer={scrollContainerRef}
|
|
64
|
+
{emptyMessage}
|
|
65
|
+
{onRowClick}
|
|
66
|
+
{onRowDoubleClick}
|
|
67
|
+
/>
|
|
68
|
+
{/if}
|
|
69
|
+
{#if view.hasFooter}
|
|
70
|
+
<DataTableFoot {table} {view} hasGrowColumn={false} isVirtual />
|
|
71
|
+
{/if}
|
|
72
|
+
</table>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div class="shrink-0 border-t border-surface-3 bg-surface-2 px-3 py-2 text-sm text-ink-dim">
|
|
76
|
+
{#if view.isRowSelectionEnabled}
|
|
77
|
+
{view.selectedRowCount} of {view.rowModel.rows.length} rows selected
|
|
78
|
+
{:else}
|
|
79
|
+
{view.rowModel.rows.length} rows
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
@@ -8,6 +8,8 @@ declare function $$render<T extends RowData>(): {
|
|
|
8
8
|
caption?: string;
|
|
9
9
|
emptyMessage?: string;
|
|
10
10
|
class?: ClassValue;
|
|
11
|
+
/** Show a filter funnel in the header of every filterable column. */
|
|
12
|
+
headerFilters?: boolean;
|
|
11
13
|
onRowClick?: (details: {
|
|
12
14
|
row: T;
|
|
13
15
|
event: MouseEvent;
|
|
@@ -1,71 +1,73 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { PhX } from '../../icons';
|
|
3
|
-
import { Dialog } from '@ark-ui/svelte/dialog';
|
|
4
|
-
import { Portal } from '@ark-ui/svelte/portal';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</Dialog.
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PhX } from '../../icons';
|
|
3
|
+
import { Dialog } from '@ark-ui/svelte/dialog';
|
|
4
|
+
import { Portal } from '@ark-ui/svelte/portal';
|
|
5
|
+
import { releaseFocusOnExitProps } from '../../utils/release-focus-on-exit';
|
|
6
|
+
import type { AlertDialogProps } from './dialog.types';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
open = $bindable(),
|
|
10
|
+
title,
|
|
11
|
+
description,
|
|
12
|
+
confirmLabel = 'Confirm',
|
|
13
|
+
cancelLabel = 'Cancel',
|
|
14
|
+
onConfirm,
|
|
15
|
+
onCancel,
|
|
16
|
+
variant = 'default',
|
|
17
|
+
lazyMount = true,
|
|
18
|
+
unmountOnExit = true,
|
|
19
|
+
...restProps
|
|
20
|
+
}: AlertDialogProps = $props();
|
|
21
|
+
|
|
22
|
+
const confirmClass = $derived(
|
|
23
|
+
variant === 'destructive'
|
|
24
|
+
? 'inline-flex h-9 items-center justify-center rounded-md bg-red-600 px-4 text-sm font-medium text-ink-inverse shadow-sm transition-colors hover:bg-red-700 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring'
|
|
25
|
+
: 'inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-ink-inverse shadow-sm transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring'
|
|
26
|
+
);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<Dialog.Root role="alertdialog" bind:open {lazyMount} {unmountOnExit} {...restProps}>
|
|
30
|
+
<Portal>
|
|
31
|
+
<Dialog.Backdrop
|
|
32
|
+
class="fixed inset-0 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0"
|
|
33
|
+
style="z-index: calc(50 + var(--layer-index, 0))"
|
|
34
|
+
/>
|
|
35
|
+
<Dialog.Positioner
|
|
36
|
+
class="fixed inset-0 flex items-center justify-center"
|
|
37
|
+
style="z-index: calc(50 + var(--layer-index, 0))"
|
|
38
|
+
>
|
|
39
|
+
<Dialog.Content
|
|
40
|
+
class="relative w-full max-w-md rounded-lg border bg-surface-1 p-6 shadow-xl data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95"
|
|
41
|
+
{...releaseFocusOnExitProps}
|
|
42
|
+
>
|
|
43
|
+
<Dialog.Title class="text-lg leading-none font-semibold tracking-tight">
|
|
44
|
+
{title}
|
|
45
|
+
</Dialog.Title>
|
|
46
|
+
{#if description}
|
|
47
|
+
<Dialog.Description class="mt-2 text-sm text-ink-dim">
|
|
48
|
+
{#each Array.isArray(description) ? description : [description] as line, i (i)}
|
|
49
|
+
<span class="block">{line}</span>
|
|
50
|
+
{/each}
|
|
51
|
+
</Dialog.Description>
|
|
52
|
+
{/if}
|
|
53
|
+
<div class="mt-6 flex justify-end gap-3">
|
|
54
|
+
<Dialog.CloseTrigger
|
|
55
|
+
class="inline-flex h-9 items-center justify-center rounded-md border bg-surface-1 px-4 text-sm font-medium shadow-sm transition-colors hover:bg-surface-2 hover:text-ink focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"
|
|
56
|
+
onclick={onCancel}
|
|
57
|
+
>
|
|
58
|
+
{cancelLabel}
|
|
59
|
+
</Dialog.CloseTrigger>
|
|
60
|
+
<button type="button" class={confirmClass} onclick={onConfirm}>
|
|
61
|
+
{confirmLabel}
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
<Dialog.CloseTrigger
|
|
65
|
+
class="absolute top-3 right-3 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none"
|
|
66
|
+
>
|
|
67
|
+
<PhX class="h-4 w-4" />
|
|
68
|
+
<span class="sr-only">Close</span>
|
|
69
|
+
</Dialog.CloseTrigger>
|
|
70
|
+
</Dialog.Content>
|
|
71
|
+
</Dialog.Positioner>
|
|
72
|
+
</Portal>
|
|
73
|
+
</Dialog.Root>
|
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Dialog } from '@ark-ui/svelte/dialog';
|
|
3
|
-
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</Dialog.
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog } from '@ark-ui/svelte/dialog';
|
|
3
|
+
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
|
+
import { releaseFocusOnExitProps } from '../../utils/release-focus-on-exit';
|
|
5
|
+
import { cn } from 'tailwind-variants';
|
|
6
|
+
import type { DialogProps } from './dialog.types';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
open = $bindable(),
|
|
10
|
+
children,
|
|
11
|
+
contentClass,
|
|
12
|
+
lazyMount = true,
|
|
13
|
+
unmountOnExit = true,
|
|
14
|
+
onOpenChange,
|
|
15
|
+
...restProps
|
|
16
|
+
}: DialogProps = $props();
|
|
17
|
+
|
|
18
|
+
function handleOpenChange(details: { open: boolean }) {
|
|
19
|
+
open = details.open;
|
|
20
|
+
onOpenChange?.(details);
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Dialog.Root {open} {lazyMount} {unmountOnExit} onOpenChange={handleOpenChange} {...restProps}>
|
|
25
|
+
<Portal>
|
|
26
|
+
<Dialog.Backdrop
|
|
27
|
+
class="fixed inset-0 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0"
|
|
28
|
+
style="z-index: calc(50 + var(--layer-index, 0))"
|
|
29
|
+
/>
|
|
30
|
+
<Dialog.Positioner
|
|
31
|
+
class="fixed inset-0 flex items-center justify-center p-4"
|
|
32
|
+
style="z-index: calc(50 + var(--layer-index, 0))"
|
|
33
|
+
>
|
|
34
|
+
<Dialog.Content
|
|
35
|
+
class={cn(
|
|
36
|
+
'relative w-full max-w-2xl rounded-lg border bg-surface-1 p-6 shadow-xl data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
|
|
37
|
+
contentClass
|
|
38
|
+
)}
|
|
39
|
+
{...releaseFocusOnExitProps}
|
|
40
|
+
>
|
|
41
|
+
{@render children()}
|
|
42
|
+
</Dialog.Content>
|
|
43
|
+
</Dialog.Positioner>
|
|
44
|
+
</Portal>
|
|
45
|
+
</Dialog.Root>
|