@invopop/popui 0.1.4-beta.47 → 0.1.4-beta.49
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/ButtonSearch.svelte
CHANGED
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<div
|
|
48
|
-
class="overflow-hidden transition-all duration-
|
|
48
|
+
class="overflow-hidden transition-all duration-150 ease-in-out relative rounded-md"
|
|
49
49
|
class:w-[280px]={expanded}
|
|
50
50
|
class:w-10={!expanded}
|
|
51
51
|
use:clickOutside
|
|
52
52
|
onclick_outside={handleClickOutside}
|
|
53
53
|
>
|
|
54
54
|
<div
|
|
55
|
-
class="w-[280px] transition-opacity duration-
|
|
55
|
+
class="w-[280px] transition-opacity duration-100 absolute left-0 top-0"
|
|
56
56
|
class:opacity-0={!expanded}
|
|
57
57
|
class:opacity-100={expanded}
|
|
58
58
|
class:pointer-events-none={!expanded}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
/>
|
|
69
69
|
</div>
|
|
70
70
|
<div
|
|
71
|
-
class="transition-opacity duration-
|
|
71
|
+
class="transition-opacity duration-100"
|
|
72
72
|
class:opacity-0={expanded}
|
|
73
73
|
class:opacity-100={!expanded}
|
|
74
74
|
class:pointer-events-none={expanded}
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
let mounted = $state(false)
|
|
77
77
|
let itemsCache = $state<DrawerOption[]>([])
|
|
78
78
|
let isDragging = $state(false)
|
|
79
|
+
let draggedItemId = $state<string | null>(null)
|
|
79
80
|
let emitTimeout: number | undefined
|
|
80
81
|
let draggedOverGroup = $state<string | null>(null)
|
|
81
82
|
let dropIndicator = $state<DropIndicatorState>(null)
|
|
@@ -203,10 +204,12 @@
|
|
|
203
204
|
getInitialData: () => ({ id: dndItem.id, groupSlug, type: 'drawer-item' }),
|
|
204
205
|
onDragStart: () => {
|
|
205
206
|
isDragging = true
|
|
207
|
+
draggedItemId = dndItem.id
|
|
206
208
|
dropIndicator = null
|
|
207
209
|
},
|
|
208
210
|
onDrop: () => {
|
|
209
211
|
isDragging = false
|
|
212
|
+
draggedItemId = null
|
|
210
213
|
dropIndicator = null
|
|
211
214
|
}
|
|
212
215
|
})
|
|
@@ -225,8 +228,7 @@
|
|
|
225
228
|
const cleanup = dropTargetForElements({
|
|
226
229
|
element,
|
|
227
230
|
getData: () => {
|
|
228
|
-
const items =
|
|
229
|
-
groupSlug === 'ungrouped' ? ungroupedDndItems : groupDndItems[groupSlug] || []
|
|
231
|
+
const items = groupSlug === 'ungrouped' ? ungroupedDndItems : groupDndItems[groupSlug] || []
|
|
230
232
|
return { groupSlug, items: items.map((i) => i.id) }
|
|
231
233
|
},
|
|
232
234
|
canDrop: ({ source }) => source.data.type === 'drawer-item',
|
|
@@ -464,10 +466,7 @@
|
|
|
464
466
|
transition:slide={{ duration: collapsibleGroups ? 200 : 0 }}
|
|
465
467
|
>
|
|
466
468
|
{#if draggable}
|
|
467
|
-
<div
|
|
468
|
-
use:setupDropZone={group.slug}
|
|
469
|
-
class="min-h-[40px]"
|
|
470
|
-
>
|
|
469
|
+
<div use:setupDropZone={group.slug} class="min-h-[40px]">
|
|
471
470
|
{#if !groupItems.length}
|
|
472
471
|
<div class="px-1 pt-1 pb-5">
|
|
473
472
|
<EmptyState
|
|
@@ -482,14 +481,17 @@
|
|
|
482
481
|
dropIndicator?.itemId === dndItem.id && dropIndicator?.edge === 'top'}
|
|
483
482
|
{@const showBottomIndicator =
|
|
484
483
|
dropIndicator?.itemId === dndItem.id && dropIndicator?.edge === 'bottom'}
|
|
484
|
+
{@const isBeingDragged = draggedItemId === dndItem.id}
|
|
485
485
|
<div
|
|
486
486
|
animate:flip={{ duration: isDragging ? flipDurationMs : 0 }}
|
|
487
487
|
use:setupDraggableItem={[dndItem, group.slug]}
|
|
488
488
|
use:setupItemDropZone={[dndItem, group.slug]}
|
|
489
489
|
class:border-t-2={showTopIndicator}
|
|
490
|
-
class:border-t-
|
|
490
|
+
class:border-t-accent-50={showTopIndicator}
|
|
491
491
|
class:border-b-2={showBottomIndicator}
|
|
492
|
-
class:border-b-
|
|
492
|
+
class:border-b-accent-50={showBottomIndicator}
|
|
493
|
+
class:opacity-40={isBeingDragged}
|
|
494
|
+
class="transition-opacity"
|
|
493
495
|
>
|
|
494
496
|
{@render drawerItem(dndItem)}
|
|
495
497
|
</div>
|
|
@@ -529,14 +531,17 @@
|
|
|
529
531
|
dropIndicator?.itemId === dndItem.id && dropIndicator?.edge === 'top'}
|
|
530
532
|
{@const showBottomIndicator =
|
|
531
533
|
dropIndicator?.itemId === dndItem.id && dropIndicator?.edge === 'bottom'}
|
|
534
|
+
{@const isBeingDragged = draggedItemId === dndItem.id}
|
|
532
535
|
<div
|
|
533
536
|
animate:flip={{ duration: isDragging ? flipDurationMs : 0 }}
|
|
534
537
|
use:setupDraggableItem={[dndItem, 'ungrouped']}
|
|
535
538
|
use:setupItemDropZone={[dndItem, 'ungrouped']}
|
|
536
539
|
class:border-t-2={showTopIndicator}
|
|
537
|
-
class:border-t-
|
|
540
|
+
class:border-t-accent-50={showTopIndicator}
|
|
538
541
|
class:border-b-2={showBottomIndicator}
|
|
539
|
-
class:border-b-
|
|
542
|
+
class:border-b-accent-50={showBottomIndicator}
|
|
543
|
+
class:opacity-40={isBeingDragged}
|
|
544
|
+
class="transition-opacity"
|
|
540
545
|
>
|
|
541
546
|
{@render drawerItem(dndItem)}
|
|
542
547
|
</div>
|
|
@@ -79,6 +79,7 @@ export interface DataTableProps<TData> {
|
|
|
79
79
|
initialFrozenColumns?: string[];
|
|
80
80
|
initialColumnOrder?: string[];
|
|
81
81
|
initialColumnVisibility?: Record<string, boolean>;
|
|
82
|
+
initialColumnSizing?: Record<string, number>;
|
|
82
83
|
pageSizeOptions?: number[];
|
|
83
84
|
emptyState?: Omit<EmptyStateProps, 'children' | 'check'>;
|
|
84
85
|
onRowClick?: (row: TData) => void;
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
initialFrozenColumns = [],
|
|
47
47
|
initialColumnOrder = [],
|
|
48
48
|
initialColumnVisibility = {},
|
|
49
|
+
initialColumnSizing = {},
|
|
49
50
|
emptyState = {
|
|
50
51
|
iconSource: Search,
|
|
51
52
|
title: 'No results',
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
: []
|
|
84
85
|
)
|
|
85
86
|
let pagination = $state<PaginationState>({ pageIndex: initialPage, pageSize: initialPageSize })
|
|
86
|
-
let columnSizing = $state<ColumnSizingState>(
|
|
87
|
+
let columnSizing = $state<ColumnSizingState>(initialColumnSizing)
|
|
87
88
|
let columnSizingInfo = $state<ColumnSizingInfoState>({
|
|
88
89
|
columnSizingStart: [],
|
|
89
90
|
deltaOffset: null,
|
|
@@ -100,6 +101,7 @@
|
|
|
100
101
|
let tableBodyRef: HTMLTableSectionElement | null = null
|
|
101
102
|
let animatingRows = $state<Set<any>>(new Set())
|
|
102
103
|
let previousData = $state<TData[]>([])
|
|
104
|
+
let tableRenderKey = $state<number>(0) // Force re-render when visibility changes
|
|
103
105
|
|
|
104
106
|
// Build TanStack columns from config
|
|
105
107
|
const columns = $derived.by(() =>
|
|
@@ -177,7 +179,11 @@
|
|
|
177
179
|
getColumnSizingInfo: () => columnSizingInfo,
|
|
178
180
|
getColumnOrder: () => columnOrder,
|
|
179
181
|
setRowSelection: (value) => (rowSelection = value),
|
|
180
|
-
setColumnVisibility: (value) =>
|
|
182
|
+
setColumnVisibility: (value) => {
|
|
183
|
+
columnVisibility = value
|
|
184
|
+
// Increment render key to force table rebuild after visibility changes
|
|
185
|
+
tableRenderKey++
|
|
186
|
+
},
|
|
181
187
|
setSorting: (value) => (sorting = value),
|
|
182
188
|
setPagination: (value) => (pagination = value),
|
|
183
189
|
setColumnSizing: (value) => {
|
|
@@ -433,7 +439,7 @@
|
|
|
433
439
|
hasSelectColumn = false,
|
|
434
440
|
...restProps
|
|
435
441
|
}: { column: Column<TData>; title?: string; isFirst?: boolean; hasSelectColumn?: boolean } & HTMLAttributes<HTMLDivElement>)}
|
|
436
|
-
{@const isCurrency = column.columnDef.
|
|
442
|
+
{@const isCurrency = column.columnDef.cellType === 'currency'}
|
|
437
443
|
{@const needsEdgePadding = isFirst && !hasSelectColumn}
|
|
438
444
|
<div
|
|
439
445
|
class={cn('flex items-center w-full [th[data-last-frozen=true]_&]:border-r [th[data-last-frozen=true]_&]:border-border', className)}
|
|
@@ -518,7 +524,7 @@
|
|
|
518
524
|
{:else}
|
|
519
525
|
<Table.Root>
|
|
520
526
|
<Table.Header>
|
|
521
|
-
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
|
|
527
|
+
{#each table.getHeaderGroups() as headerGroup (`${headerGroup.id}-${tableRenderKey}`)}
|
|
522
528
|
{@const hasSelectColumn = headerGroup.headers.some(h => h.id === 'select')}
|
|
523
529
|
<Table.Row class="hover:!bg-transparent">
|
|
524
530
|
{#each headerGroup.headers as header, index (header.id)}
|