@invopop/popui 0.1.67 → 0.1.69
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/ButtonUuidCopy.svelte +19 -14
- package/dist/button/button.svelte +8 -4
- package/dist/data-table/cells/uuid-cell.svelte +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/types.d.ts +8 -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>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import BaseButton from './BaseButton.svelte'
|
|
4
4
|
import type { ButtonUuidCopyProps } from './types'
|
|
5
5
|
import { copyToClipboard } from './helpers'
|
|
6
|
+
import { cn } from './utils'
|
|
6
7
|
|
|
7
8
|
let {
|
|
8
9
|
uuid = '',
|
|
@@ -10,21 +11,13 @@
|
|
|
10
11
|
suffixLength = 4,
|
|
11
12
|
full = false,
|
|
12
13
|
disabled = false,
|
|
13
|
-
oncopied
|
|
14
|
+
oncopied,
|
|
15
|
+
class: className
|
|
14
16
|
}: ButtonUuidCopyProps = $props()
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const prefix = inputString.substring(0, prefixLength)
|
|
22
|
-
const suffix = inputString.substring(inputString.length - suffixLength)
|
|
23
|
-
|
|
24
|
-
return prefix + '...' + suffix
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let formattedUuid = $derived(full ? uuid : shortenString(uuid, prefixLength, suffixLength))
|
|
18
|
+
let prefix = $derived(uuid.substring(0, prefixLength))
|
|
19
|
+
let suffix = $derived(uuid.substring(uuid.length - suffixLength))
|
|
20
|
+
let middle = $derived(uuid.substring(prefixLength, uuid.length - suffixLength))
|
|
28
21
|
</script>
|
|
29
22
|
|
|
30
23
|
<BaseButton
|
|
@@ -34,11 +27,23 @@
|
|
|
34
27
|
iconPosition="right"
|
|
35
28
|
variant="ghost"
|
|
36
29
|
data-uuid-copy
|
|
30
|
+
class={cn(
|
|
31
|
+
'max-w-full [&_[data-button-content]]:max-w-full [&_[data-button-content]]:min-w-0 [&_[data-button-content]>span]:min-w-0',
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
37
34
|
onclick={async (e) => {
|
|
38
35
|
e.stopPropagation()
|
|
39
36
|
await copyToClipboard(uuid)
|
|
40
37
|
oncopied?.(uuid)
|
|
41
38
|
}}
|
|
42
39
|
>
|
|
43
|
-
|
|
40
|
+
{#if full}
|
|
41
|
+
<span class="font-mono">{uuid}</span>
|
|
42
|
+
{:else}
|
|
43
|
+
<span class="font-mono flex items-center min-w-0 overflow-hidden">
|
|
44
|
+
<span class="shrink-0">{prefix}</span>
|
|
45
|
+
<span class="truncate min-w-0">{middle}</span>
|
|
46
|
+
<span class="shrink-0">{suffix}</span>
|
|
47
|
+
</span>
|
|
48
|
+
{/if}
|
|
44
49
|
</BaseButton>
|
|
@@ -232,10 +232,14 @@
|
|
|
232
232
|
|
|
233
233
|
{#snippet buttonContent()}
|
|
234
234
|
<div
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
'
|
|
238
|
-
|
|
235
|
+
data-button-content
|
|
236
|
+
class={clsx(
|
|
237
|
+
'inline-flex items-center transition-transform group-active/button:translate-y-px',
|
|
238
|
+
{
|
|
239
|
+
'gap-1': !iconOnly && !shortcut,
|
|
240
|
+
'gap-1.5': !iconOnly && shortcut
|
|
241
|
+
}
|
|
242
|
+
)}
|
|
239
243
|
>
|
|
240
244
|
{#if icon && !children}
|
|
241
245
|
{@render iconContent()}
|
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;
|
|
@@ -266,6 +273,7 @@ export interface ButtonUuidCopyProps {
|
|
|
266
273
|
full?: boolean;
|
|
267
274
|
disabled?: boolean;
|
|
268
275
|
oncopied?: (label: string) => void;
|
|
276
|
+
class?: string;
|
|
269
277
|
}
|
|
270
278
|
export interface ButtonSearchProps {
|
|
271
279
|
value?: string;
|