@invopop/popui 0.1.58 → 0.1.60
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/ButtonUuidCopy.svelte +2 -1
- package/dist/DataListItem.svelte +23 -5
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.js +3 -0
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Duplicate } from '@invopop/ui-icons'
|
|
3
3
|
import BaseButton from './BaseButton.svelte'
|
|
4
4
|
import type { ButtonUuidCopyProps } from './types'
|
|
5
|
+
import { copyToClipboard } from './helpers'
|
|
5
6
|
|
|
6
7
|
let {
|
|
7
8
|
uuid = '',
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
data-uuid-copy
|
|
36
37
|
onclick={async (e) => {
|
|
37
38
|
e.stopPropagation()
|
|
38
|
-
await
|
|
39
|
+
await copyToClipboard(uuid)
|
|
39
40
|
oncopied?.(uuid)
|
|
40
41
|
}}
|
|
41
42
|
>
|
package/dist/DataListItem.svelte
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
import type { DataListItemProps } from './types'
|
|
4
4
|
import BaseButton from './BaseButton.svelte'
|
|
5
5
|
import { Duplicate, ExternalLink } from '@invopop/ui-icons'
|
|
6
|
+
import { copyToClipboard } from './helpers'
|
|
6
7
|
|
|
7
8
|
let {
|
|
8
9
|
label = '',
|
|
9
10
|
value = '',
|
|
10
11
|
monospaced = false,
|
|
12
|
+
vertical = false,
|
|
11
13
|
children,
|
|
12
14
|
onCopy,
|
|
13
15
|
onLink
|
|
@@ -21,11 +23,12 @@
|
|
|
21
23
|
|
|
22
24
|
let clickAction = $derived(onCopy || onLink)
|
|
23
25
|
|
|
24
|
-
const handleAreaClick = (e: MouseEvent) => {
|
|
26
|
+
const handleAreaClick = async (e: MouseEvent) => {
|
|
25
27
|
// Only handle click if not clicking on a button
|
|
26
28
|
if ((e.target as HTMLElement).closest('button')) return
|
|
27
29
|
|
|
28
30
|
if (onCopy) {
|
|
31
|
+
await copyToClipboard(value)
|
|
29
32
|
onCopy()
|
|
30
33
|
} else if (onLink) {
|
|
31
34
|
onLink()
|
|
@@ -33,15 +36,25 @@
|
|
|
33
36
|
}
|
|
34
37
|
</script>
|
|
35
38
|
|
|
36
|
-
<div
|
|
37
|
-
|
|
39
|
+
<div
|
|
40
|
+
class={clsx('flex group', {
|
|
41
|
+
'flex-col gap-1.5': vertical,
|
|
42
|
+
'gap-6 items-center': !vertical
|
|
43
|
+
})}
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
class={clsx('text-foreground-default-secondary text-base', {
|
|
47
|
+
'pl-2': vertical,
|
|
48
|
+
'min-w-[125px]': !vertical
|
|
49
|
+
})}
|
|
50
|
+
>
|
|
38
51
|
{label}
|
|
39
52
|
</div>
|
|
40
53
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
41
54
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
42
55
|
<div
|
|
43
56
|
class={clsx(
|
|
44
|
-
'flex flex-1 gap-1 items-center group-hover:bg-background-default-secondary py-1 pl-2 pr-1 rounded-md min-w-0',
|
|
57
|
+
'flex flex-1 gap-1 items-center group-hover:bg-background-default-secondary py-1 pl-2 pr-1 rounded-md min-w-0 h-8',
|
|
45
58
|
{ 'cursor-pointer': clickAction }
|
|
46
59
|
)}
|
|
47
60
|
onclick={clickAction ? handleAreaClick : undefined}
|
|
@@ -57,14 +70,19 @@
|
|
|
57
70
|
</div>
|
|
58
71
|
{#if onCopy}
|
|
59
72
|
<BaseButton
|
|
73
|
+
size="sm"
|
|
60
74
|
variant="outline"
|
|
61
75
|
icon={Duplicate}
|
|
62
|
-
onclick={
|
|
76
|
+
onclick={async () => {
|
|
77
|
+
await copyToClipboard(value)
|
|
78
|
+
onCopy()
|
|
79
|
+
}}
|
|
63
80
|
class="opacity-0 group-hover:opacity-100 transition-opacity"
|
|
64
81
|
/>
|
|
65
82
|
{/if}
|
|
66
83
|
{#if onLink}
|
|
67
84
|
<BaseButton
|
|
85
|
+
size="sm"
|
|
68
86
|
variant="outline"
|
|
69
87
|
icon={ExternalLink}
|
|
70
88
|
onclick={onLink}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export declare function scrollIntoTableView(element: HTMLElement): void;
|
|
|
11
11
|
export declare function isInputFocused(): boolean;
|
|
12
12
|
export declare function toCalendarDate(date: Date): DateValue;
|
|
13
13
|
export declare function datesFromToday(): DatesFromToday;
|
|
14
|
+
export declare function copyToClipboard(text: string): Promise<void>;
|
package/dist/helpers.js
CHANGED
package/dist/types.d.ts
CHANGED