@invopop/popui 0.1.69 → 0.1.70
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/DrawerContext.svelte +3 -1
- package/dist/DropdownSelect.svelte +28 -16
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
onreorder,
|
|
50
50
|
ondropitem,
|
|
51
51
|
children,
|
|
52
|
-
groups
|
|
52
|
+
groups,
|
|
53
|
+
...rest
|
|
53
54
|
}: DrawerContextProps = $props()
|
|
54
55
|
|
|
55
56
|
type DndItem = DrawerOption & { id: string }
|
|
@@ -497,6 +498,7 @@
|
|
|
497
498
|
<div
|
|
498
499
|
bind:this={containerRef}
|
|
499
500
|
class={containerClasses}
|
|
501
|
+
{...rest}
|
|
500
502
|
>
|
|
501
503
|
{@render children?.()}
|
|
502
504
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import BaseFlag from './BaseFlag.svelte'
|
|
10
10
|
import { resolveIcon } from './helpers.js'
|
|
11
11
|
import { buttonVariants } from './button/button.svelte'
|
|
12
|
+
import { cn } from './utils.js'
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
value = $bindable(''),
|
|
@@ -25,7 +26,9 @@
|
|
|
25
26
|
stackLeft = false,
|
|
26
27
|
stackRight = false,
|
|
27
28
|
multipleLabel = 'items',
|
|
28
|
-
strategy
|
|
29
|
+
strategy,
|
|
30
|
+
disabled = false,
|
|
31
|
+
class: className = ''
|
|
29
32
|
}: DropdownSelectProps = $props()
|
|
30
33
|
|
|
31
34
|
let selectDropdown: BaseDropdown | undefined = $state()
|
|
@@ -71,16 +74,25 @@
|
|
|
71
74
|
let isStacked = $derived(stackLeft || stackRight)
|
|
72
75
|
|
|
73
76
|
let styles = $derived(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
cn(
|
|
78
|
+
'flex items-center rounded-lg py-1.5 pl-2 bg-background overflow-hidden w-full h-7',
|
|
79
|
+
{
|
|
80
|
+
'pr-[28px]': !isStacked,
|
|
81
|
+
'pr-2': isStacked,
|
|
82
|
+
'opacity-30 pointer-events-none': disabled
|
|
83
|
+
},
|
|
84
|
+
isStacked
|
|
85
|
+
? buttonVariants({
|
|
86
|
+
variant: 'ghost',
|
|
87
|
+
stackedLeft: stackLeft,
|
|
88
|
+
stackedRight: stackRight
|
|
89
|
+
})
|
|
90
|
+
: clsx('border backdrop-blur-sm backdrop-filter dropdown-select', {
|
|
91
|
+
'border-border-selected-bold shadow-active': isOpen,
|
|
92
|
+
'border-border-default-secondary hover:border-border-default-secondary-hover': !isOpen
|
|
93
|
+
}),
|
|
94
|
+
className
|
|
95
|
+
)
|
|
84
96
|
)
|
|
85
97
|
|
|
86
98
|
function handleClick(val: AnyProp) {
|
|
@@ -115,6 +127,7 @@
|
|
|
115
127
|
|
|
116
128
|
{#snippet label()}
|
|
117
129
|
<span
|
|
130
|
+
data-dropdown-select-label
|
|
118
131
|
class={clsx('flex-1 text-base truncate', {
|
|
119
132
|
'text-foreground': selectedItems.length,
|
|
120
133
|
'text-foreground-default-secondary': !selectedItems.length,
|
|
@@ -126,19 +139,17 @@
|
|
|
126
139
|
{/snippet}
|
|
127
140
|
|
|
128
141
|
<BaseDropdown
|
|
142
|
+
data-dropdown-select
|
|
129
143
|
bind:isOpen
|
|
130
144
|
placement="bottom-start"
|
|
131
145
|
{fullWidth}
|
|
132
146
|
{strategy}
|
|
147
|
+
{disabled}
|
|
133
148
|
bind:this={selectDropdown}
|
|
134
149
|
class={fullWidth || isStacked ? '' : widthClass}
|
|
135
150
|
>
|
|
136
151
|
{#snippet trigger()}
|
|
137
|
-
<div
|
|
138
|
-
class="{styles} flex items-center rounded-lg py-1.5 pl-2 bg-background overflow-hidden w-full h-7"
|
|
139
|
-
class:pr-[28px]={!isStacked}
|
|
140
|
-
class:pr-2={isStacked}
|
|
141
|
-
>
|
|
152
|
+
<div data-dropdown-select-trigger class={styles}>
|
|
142
153
|
{#if hasMultipleColors}
|
|
143
154
|
<div class="flex items-center gap-1 flex-1 min-w-0">
|
|
144
155
|
<div class="flex items-center -space-x-0.5">
|
|
@@ -177,6 +188,7 @@
|
|
|
177
188
|
</div>
|
|
178
189
|
{/snippet}
|
|
179
190
|
<DrawerContext
|
|
191
|
+
data-dropdown-select-content
|
|
180
192
|
widthClass="min-w-[256px]"
|
|
181
193
|
{multiple}
|
|
182
194
|
{items}
|
package/dist/types.d.ts
CHANGED
|
@@ -349,6 +349,7 @@ export interface DrawerContextProps {
|
|
|
349
349
|
ondropitem?: (groups: Record<string, DrawerOption[]>) => void;
|
|
350
350
|
children?: Snippet;
|
|
351
351
|
groups?: DrawerGroup[];
|
|
352
|
+
[key: string]: unknown;
|
|
352
353
|
}
|
|
353
354
|
export interface DrawerContextItemProps {
|
|
354
355
|
multiple?: boolean;
|
|
@@ -374,6 +375,8 @@ export interface DropdownSelectProps {
|
|
|
374
375
|
stackRight?: boolean;
|
|
375
376
|
multipleLabel?: string;
|
|
376
377
|
strategy?: 'absolute' | 'fixed';
|
|
378
|
+
disabled?: boolean;
|
|
379
|
+
class?: string;
|
|
377
380
|
}
|
|
378
381
|
export interface EmptyStateProps {
|
|
379
382
|
icon?: Snippet;
|