@invopop/popui 0.1.89 → 0.1.91

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.
@@ -82,8 +82,8 @@
82
82
  children
83
83
  }: DataTableProps<TData> = $props()
84
84
 
85
- const enableSelection = !disableSelection
86
- const enablePagination = !disablePagination
85
+ const enableSelection = $derived(!disableSelection)
86
+ const enablePagination = $derived(!disablePagination)
87
87
 
88
88
  let rowSelection = $state<RowSelectionState>({})
89
89
  let columnVisibility = $state<VisibilityState>(untrack(() => initialColumnVisibility))
@@ -154,9 +154,12 @@
154
154
  // Track selection changes
155
155
  $effect(() => {
156
156
  if (onSelectionChange) {
157
- const selectedRows = Object.keys(rowSelection)
158
- .filter((key) => rowSelection[key])
159
- .map((key) => data[parseInt(key)])
157
+ const selectedKeys = Object.keys(rowSelection).filter((key) => rowSelection[key])
158
+ const selectedRows = getRowId
159
+ ? selectedKeys
160
+ .map((key) => data.find((row, idx) => getRowId(row, idx) === key))
161
+ .filter((row): row is TData => row !== undefined)
162
+ : selectedKeys.map((key) => data[parseInt(key)])
160
163
  onSelectionChange(selectedRows)
161
164
  }
162
165
  })
@@ -383,7 +386,7 @@
383
386
  <Table.Root>
384
387
  <Table.Header>
385
388
  {#each table.getHeaderGroups() as headerGroup (`${headerGroup.id}-${tableRenderKey}`)}
386
- <Table.Row class="hover:!bg-transparent">
389
+ <Table.Row class="hover:bg-transparent!">
387
390
  {#each headerGroup.headers as header, index (header.id)}
388
391
  <DataTableHeaderCell
389
392
  {header}
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { createBubbler } from 'svelte/legacy'
3
- import { cn, type WithElementRef } from '../utils.js'
3
+ import { cn, type WithElementRef } from '../utils'
4
4
  import type { HTMLTdAttributes } from 'svelte/elements'
5
5
 
6
6
  const bubble = createBubbler()
@@ -16,7 +16,7 @@
16
16
  bind:this={ref}
17
17
  data-slot="table-cell"
18
18
  class={cn(
19
- 'py-[9px] [&:has([role=menu])]:py-0 [&:has([data-uuid-copy])]:py-0 pl-3 pr-3 align-middle text-foreground font-normal text-base [&:has([role=menu])]:pl-1 [&:has([role=menu])]:bg-white [&:has([type=checkbox])]:bg-white',
19
+ 'py-2.25 [&:has([role=menu])]:py-0 [&:has([data-uuid-copy])]:py-0 pl-3 pr-3 align-middle text-foreground font-normal text-base [&:has([role=menu])]:pl-1 [&:has([role=menu])]:bg-background [&:has([type=checkbox])]:bg-background',
20
20
  className
21
21
  )}
22
22
  {...restProps}
@@ -1,4 +1,4 @@
1
- import { type WithElementRef } from '../utils.js';
1
+ import { type WithElementRef } from '../utils';
2
2
  import type { HTMLTdAttributes } from 'svelte/elements';
3
3
  declare const TableCell: import("svelte").Component<WithElementRef<HTMLTdAttributes>, {}, "ref">;
4
4
  type TableCell = ReturnType<typeof TableCell>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.89",
4
+ "version": "0.1.91",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },