@invopop/popui 0.1.66 → 0.1.68

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.
@@ -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
- function shortenString(inputString: string, prefixLength: number, suffixLength: number) {
17
- if (inputString.length <= prefixLength + suffixLength) {
18
- return inputString // Return the whole string if it's too short
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
- <span class="font-mono">{formattedUuid}</span>
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
- class={clsx('inline-flex items-center transition-transform group-active/button:translate-y-px', {
236
- 'gap-1': !iconOnly && !shortcut,
237
- 'gap-1.5': !iconOnly && shortcut
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()}
@@ -14,6 +14,7 @@
14
14
  full={config?.full}
15
15
  disabled={config?.disabled}
16
16
  oncopied={config?.onCopy}
17
+ class="!font-[weight:inherit]"
17
18
  />
18
19
  </div>
19
20
  {:else}
@@ -1008,24 +1008,27 @@
1008
1008
  }
1009
1009
 
1010
1010
  .icon-sidebar-hide_anim_line {
1011
- transition-behavior: allow-discrete;
1011
+ transform: translate(3.5px, 0.5px);
1012
1012
  }
1013
1013
 
1014
- .icon-sidebar-hide_anim {
1015
- overflow: hidden;
1014
+ .icon-sidebar-hide:hover .icon-sidebar-hide_anim_line {
1015
+ transform: translate(-.25px, 0.5px) scale(0.70, 1);
1016
1016
  }
1017
1017
 
1018
- .icon-sidebar-hide:hover .icon-sidebar-hide_anim_line {
1019
- transform: translate(-2.5px, 0) scale(0.70, 1);
1018
+ .icon-sidebar-hide_anim {
1019
+ overflow: hidden;
1020
1020
  }
1021
1021
 
1022
1022
  .icon-sidebar-hide:hover .icon-sidebar-hide_anim_line rect {
1023
1023
  rx: 0.5px;
1024
1024
  }
1025
1025
 
1026
+ .icon-sidebar-hide_anim_arrow {
1027
+ transform: translate(-1.5px, -2px);
1028
+ }
1029
+
1026
1030
  .icon-sidebar-hide:hover .icon-sidebar-hide_anim_arrow {
1027
- transform: translate(-11px, 0);
1028
- display: block;
1031
+ transform: translate(-4px, -2px);
1029
1032
  }
1030
1033
 
1031
1034
  /* Animated sidebar show icon */
@@ -1057,7 +1060,7 @@
1057
1060
  }
1058
1061
 
1059
1062
  .icon-sidebar-show:hover .icon-sidebar-show_anim_arrow {
1060
- transform: scale(-1,1) translate(-4px, 0);
1063
+ transform: scale(-1, 1) translate(-4px, 0);
1061
1064
  }
1062
1065
 
1063
1066
  /* Animated pulse icon */
@@ -1067,4 +1070,4 @@
1067
1070
  @keyframes icon-pulse-animation {
1068
1071
  0%, 100% { fill: var(--color-background-default-tertiary); }
1069
1072
  40% { fill: var(--color-accent-50); }
1070
- }
1073
+ }
package/dist/types.d.ts CHANGED
@@ -266,6 +266,7 @@ export interface ButtonUuidCopyProps {
266
266
  full?: boolean;
267
267
  disabled?: boolean;
268
268
  oncopied?: (label: string) => void;
269
+ class?: string;
269
270
  }
270
271
  export interface ButtonSearchProps {
271
272
  value?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.66",
4
+ "version": "0.1.68",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },