@invopop/popui 0.1.4-beta.47 → 0.1.4-beta.48

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.
@@ -45,14 +45,14 @@
45
45
  </script>
46
46
 
47
47
  <div
48
- class="overflow-hidden transition-all duration-300 ease-in-out relative rounded-md"
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-200 absolute left-0 top-0"
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-200"
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-border-selected={showTopIndicator}
490
+ class:border-t-accent-50={showTopIndicator}
491
491
  class:border-b-2={showBottomIndicator}
492
- class:border-b-border-selected={showBottomIndicator}
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-border-selected={showTopIndicator}
540
+ class:border-t-accent-50={showTopIndicator}
538
541
  class:border-b-2={showBottomIndicator}
539
- class:border-b-border-selected={showBottomIndicator}
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,
@@ -433,7 +434,7 @@
433
434
  hasSelectColumn = false,
434
435
  ...restProps
435
436
  }: { column: Column<TData>; title?: string; isFirst?: boolean; hasSelectColumn?: boolean } & HTMLAttributes<HTMLDivElement>)}
436
- {@const isCurrency = column.columnDef.meta?.cellType === 'currency'}
437
+ {@const isCurrency = column.columnDef.cellType === 'currency'}
437
438
  {@const needsEdgePadding = isFirst && !hasSelectColumn}
438
439
  <div
439
440
  class={cn('flex items-center w-full [th[data-last-frozen=true]_&]:border-r [th[data-last-frozen=true]_&]:border-border', className)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.4-beta.47",
4
+ "version": "0.1.4-beta.48",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },