compote-ui 0.38.1 → 0.39.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.
@@ -72,7 +72,6 @@
72
72
  if (!isMultiRowSelectionEnabled) return false;
73
73
  return headerGroupIndex === headerGroupCount - 1;
74
74
  }
75
-
76
75
  </script>
77
76
 
78
77
  <thead
@@ -27,9 +27,10 @@
27
27
  isRowSelectionEnabled: boolean;
28
28
  table: DataTableInstance<T>;
29
29
  emptyMessage: string;
30
+ onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
30
31
  };
31
32
 
32
- let { rows, scrollContainer, isRowSelectionEnabled, table, emptyMessage }: Props = $props();
33
+ let { rows, scrollContainer, isRowSelectionEnabled, table, emptyMessage, onRowDoubleClick }: Props = $props();
33
34
 
34
35
  const rowVirtualizer = createVirtualizer<HTMLDivElement, HTMLTableRowElement>({
35
36
  get count() {
@@ -75,6 +76,7 @@
75
76
  'bg-well/60 [--row-bg:color-mix(in_srgb,var(--compote-well)_60%,var(--compote-surface-1))]'
76
77
  )}
77
78
  style="display: flex; position: absolute; transform: translateY({virtualRow.start}px); width: 100%"
79
+ ondblclick={(event) => onRowDoubleClick?.({ row: row.original, event })}
78
80
  >
79
81
  {#if isRowSelectionEnabled}
80
82
  <td
@@ -7,6 +7,10 @@ declare function $$render<T extends RowData>(): {
7
7
  isRowSelectionEnabled: boolean;
8
8
  table: DataTableInstance<T>;
9
9
  emptyMessage: string;
10
+ onRowDoubleClick?: (details: {
11
+ row: T;
12
+ event: MouseEvent;
13
+ }) => void;
10
14
  };
11
15
  exports: {};
12
16
  bindings: "";
@@ -16,6 +16,7 @@
16
16
  caption?: string;
17
17
  emptyMessage?: string;
18
18
  class?: ClassValue;
19
+ onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
19
20
  };
20
21
 
21
22
  let {
@@ -23,6 +24,7 @@
23
24
  caption,
24
25
  emptyMessage = 'No rows found',
25
26
  class: className,
27
+ onRowDoubleClick,
26
28
  ...rest
27
29
  }: Props = $props();
28
30
 
@@ -86,6 +88,7 @@
86
88
  {isRowSelectionEnabled}
87
89
  {table}
88
90
  {emptyMessage}
91
+ {onRowDoubleClick}
89
92
  />
90
93
  {/if}
91
94
  </table>
@@ -8,6 +8,10 @@ declare function $$render<T extends RowData>(): {
8
8
  caption?: string;
9
9
  emptyMessage?: string;
10
10
  class?: ClassValue;
11
+ onRowDoubleClick?: (details: {
12
+ row: T;
13
+ event: MouseEvent;
14
+ }) => void;
11
15
  };
12
16
  exports: {};
13
17
  bindings: "";
@@ -28,6 +28,7 @@
28
28
  caption?: string;
29
29
  emptyMessage?: string;
30
30
  class?: ClassValue;
31
+ onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
31
32
  };
32
33
 
33
34
  let {
@@ -35,6 +36,7 @@
35
36
  caption,
36
37
  emptyMessage = 'No rows found',
37
38
  class: className,
39
+ onRowDoubleClick,
38
40
  ...rest
39
41
  }: Props = $props();
40
42
 
@@ -115,6 +117,7 @@
115
117
  rowSelected &&
116
118
  'bg-well/60 [--row-bg:color-mix(in_srgb,var(--compote-well)_60%,var(--compote-surface-1))]'
117
119
  )}
120
+ ondblclick={(event) => onRowDoubleClick?.({ row: row.original, event })}
118
121
  >
119
122
  {#if isRowSelectionEnabled}
120
123
  <td
@@ -8,6 +8,10 @@ declare function $$render<T extends RowData>(): {
8
8
  caption?: string;
9
9
  emptyMessage?: string;
10
10
  class?: ClassValue;
11
+ onRowDoubleClick?: (details: {
12
+ row: T;
13
+ event: MouseEvent;
14
+ }) => void;
11
15
  };
12
16
  exports: {};
13
17
  bindings: "";
@@ -1,23 +1,28 @@
1
1
  <script lang="ts">
2
2
  import { Menu } from '@ark-ui/svelte/menu';
3
+ import { Portal } from '@ark-ui/svelte/portal';
4
+ import type { MenuContentBaseProps } from '@ark-ui/svelte/menu';
3
5
  import type { Snippet } from 'svelte';
4
6
  import { cn } from 'tailwind-variants';
5
7
 
6
- type Props = {
8
+ type Props = MenuContentBaseProps & {
7
9
  class?: string;
8
10
  children: Snippet;
9
11
  };
10
12
 
11
- const { class: className, children }: Props = $props();
13
+ const { class: className, children, ...restProps }: Props = $props();
12
14
  </script>
13
15
 
14
- <Menu.Positioner>
15
- <Menu.Content
16
- class={cn(
17
- 'z-50 min-w-32 overflow-hidden rounded-md border bg-surface-1 p-1 text-ink shadow-md outline-none',
18
- className
19
- )}
20
- >
21
- {@render children()}
22
- </Menu.Content>
23
- </Menu.Positioner>
16
+ <Portal>
17
+ <Menu.Positioner>
18
+ <Menu.Content
19
+ {...restProps}
20
+ class={cn(
21
+ 'z-50 min-w-32 overflow-hidden rounded-md border bg-surface-1 p-1 text-ink shadow-md outline-none',
22
+ className
23
+ )}
24
+ >
25
+ {@render children()}
26
+ </Menu.Content>
27
+ </Menu.Positioner>
28
+ </Portal>
@@ -1,5 +1,6 @@
1
+ import type { MenuContentBaseProps } from '@ark-ui/svelte/menu';
1
2
  import type { Snippet } from 'svelte';
2
- type Props = {
3
+ type Props = MenuContentBaseProps & {
3
4
  class?: string;
4
5
  children: Snippet;
5
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.38.1",
3
+ "version": "0.39.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev --open",