@invopop/popui 0.1.68 → 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/Accordion.svelte +40 -0
- package/dist/Accordion.svelte.d.ts +4 -0
- package/dist/DrawerContext.svelte +3 -1
- package/dist/DropdownSelect.svelte +28 -16
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/types.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Icon } from '@steeze-ui/svelte-icon'
|
|
3
|
+
import { ChevronDown } from '@invopop/ui-icons'
|
|
4
|
+
import clsx from 'clsx'
|
|
5
|
+
import type { AccordionProps } from './types'
|
|
6
|
+
import { cn } from './utils.js'
|
|
7
|
+
|
|
8
|
+
let { label, open = true, children, onToggle, class: className }: AccordionProps = $props()
|
|
9
|
+
|
|
10
|
+
let isOpen = $derived(open)
|
|
11
|
+
|
|
12
|
+
function toggle() {
|
|
13
|
+
isOpen = !isOpen
|
|
14
|
+
onToggle?.(isOpen)
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div class={cn('flex flex-col', className)}>
|
|
19
|
+
<button
|
|
20
|
+
data-accordion-trigger
|
|
21
|
+
class="flex items-center gap-1.5 overflow-clip pl-2 py-2 pr-1.5 rounded-lg cursor-pointer"
|
|
22
|
+
onclick={toggle}
|
|
23
|
+
>
|
|
24
|
+
<p data-accordion-label class="text-sm font-medium text-foreground-default-secondary text-left">
|
|
25
|
+
{label}
|
|
26
|
+
</p>
|
|
27
|
+
<Icon
|
|
28
|
+
data-accordion-icon
|
|
29
|
+
src={ChevronDown}
|
|
30
|
+
class={clsx('size-3 text-icon-default-secondary transition-transform', {
|
|
31
|
+
'-rotate-90': !isOpen
|
|
32
|
+
})}
|
|
33
|
+
/>
|
|
34
|
+
</button>
|
|
35
|
+
{#if isOpen}
|
|
36
|
+
<div data-accordion-content>
|
|
37
|
+
{@render children?.()}
|
|
38
|
+
</div>
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
@@ -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/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Accordion from './Accordion.svelte';
|
|
1
2
|
import AlertDialog from './AlertDialog.svelte';
|
|
2
3
|
import BaseButton from './BaseButton.svelte';
|
|
3
4
|
import BaseCard from './BaseCard.svelte';
|
|
@@ -86,4 +87,4 @@ import { FlexRender } from './data-table';
|
|
|
86
87
|
import { createSvelteTable } from './data-table';
|
|
87
88
|
import { renderComponent } from './data-table';
|
|
88
89
|
import { renderSnippet } from './data-table';
|
|
89
|
-
export { AlertDialog, BaseButton, BaseCard, BaseCounter, BaseDropdown, BaseFlag, BaseTableActions, Breadcrumbs, ButtonFile, ButtonSearch, ButtonUuidCopy, CardCheckbox, CardRelation, CompanySelector, CounterWidget, DataListItem, DatePicker, DrawerContext, DrawerContextItem, DrawerContextSeparator, DropdownSelect, DropdownSelectGroup, EmptyState, FeedEvents, FeedIconEvent, FeedIconStatus, FeedItem, FeedItemDetail, FeedViewer, GlobalSearch, InputCheckbox, InputError, InputLabel, InputRadio, InputSearch, InputSelect, InputText, InputTextarea, InputToggle, MenuItem, MenuItemCollapsible, Notification, ProfileAvatar, ProgressBar, ProgressBarCircle, SeparatorHorizontal, ShortcutWrapper, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonList, StatusLabel, StepIcon, StepIconList, Table, TableBody, TableCaption, TableFooter, TableHeader, TableRow, TableHead, TableCell, Tabs, TabsContent, TabsList, TabsTrigger, TagBeta, TagProgress, TagSearch, TagStatus, TitleMain, TitleSection, Toaster, Tooltip, TooltipContent, TooltipTrigger, TooltipAutoHide, resolveIcon, getCountryName, getStatusType, buttonVariants, DataTable, DataTableToolbar, DataTableViewOptions, FlexRender, createSvelteTable, renderComponent, renderSnippet };
|
|
90
|
+
export { Accordion, AlertDialog, BaseButton, BaseCard, BaseCounter, BaseDropdown, BaseFlag, BaseTableActions, Breadcrumbs, ButtonFile, ButtonSearch, ButtonUuidCopy, CardCheckbox, CardRelation, CompanySelector, CounterWidget, DataListItem, DatePicker, DrawerContext, DrawerContextItem, DrawerContextSeparator, DropdownSelect, DropdownSelectGroup, EmptyState, FeedEvents, FeedIconEvent, FeedIconStatus, FeedItem, FeedItemDetail, FeedViewer, GlobalSearch, InputCheckbox, InputError, InputLabel, InputRadio, InputSearch, InputSelect, InputText, InputTextarea, InputToggle, MenuItem, MenuItemCollapsible, Notification, ProfileAvatar, ProgressBar, ProgressBarCircle, SeparatorHorizontal, ShortcutWrapper, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonList, StatusLabel, StepIcon, StepIconList, Table, TableBody, TableCaption, TableFooter, TableHeader, TableRow, TableHead, TableCell, Tabs, TabsContent, TabsList, TabsTrigger, TagBeta, TagProgress, TagSearch, TagStatus, TitleMain, TitleSection, Toaster, Tooltip, TooltipContent, TooltipTrigger, TooltipAutoHide, resolveIcon, getCountryName, getStatusType, buttonVariants, DataTable, DataTableToolbar, DataTableViewOptions, FlexRender, createSvelteTable, renderComponent, renderSnippet };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Accordion from './Accordion.svelte'
|
|
1
2
|
import AlertDialog from './AlertDialog.svelte'
|
|
2
3
|
import BaseButton from './BaseButton.svelte'
|
|
3
4
|
import BaseCard from './BaseCard.svelte'
|
|
@@ -81,6 +82,7 @@ import {
|
|
|
81
82
|
} from './data-table'
|
|
82
83
|
|
|
83
84
|
export {
|
|
85
|
+
Accordion,
|
|
84
86
|
AlertDialog,
|
|
85
87
|
BaseButton,
|
|
86
88
|
BaseCard,
|
package/dist/types.d.ts
CHANGED
|
@@ -139,6 +139,13 @@ export type StepIcon = {
|
|
|
139
139
|
name: string;
|
|
140
140
|
url: string;
|
|
141
141
|
};
|
|
142
|
+
export interface AccordionProps {
|
|
143
|
+
label: string;
|
|
144
|
+
open?: boolean;
|
|
145
|
+
children?: Snippet;
|
|
146
|
+
onToggle?: (open: boolean) => void;
|
|
147
|
+
class?: string;
|
|
148
|
+
}
|
|
142
149
|
export interface AlertDialogProps {
|
|
143
150
|
open?: boolean;
|
|
144
151
|
destructive?: boolean;
|
|
@@ -342,6 +349,7 @@ export interface DrawerContextProps {
|
|
|
342
349
|
ondropitem?: (groups: Record<string, DrawerOption[]>) => void;
|
|
343
350
|
children?: Snippet;
|
|
344
351
|
groups?: DrawerGroup[];
|
|
352
|
+
[key: string]: unknown;
|
|
345
353
|
}
|
|
346
354
|
export interface DrawerContextItemProps {
|
|
347
355
|
multiple?: boolean;
|
|
@@ -367,6 +375,8 @@ export interface DropdownSelectProps {
|
|
|
367
375
|
stackRight?: boolean;
|
|
368
376
|
multipleLabel?: string;
|
|
369
377
|
strategy?: 'absolute' | 'fixed';
|
|
378
|
+
disabled?: boolean;
|
|
379
|
+
class?: string;
|
|
370
380
|
}
|
|
371
381
|
export interface EmptyStateProps {
|
|
372
382
|
icon?: Snippet;
|