@signal9/era-ui 2.19.0 → 2.20.0

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.
@@ -23,3 +23,7 @@ is resolved on each click, not at render. |
23
23
  | `resetDelay?` | `number` | `1500` | How long the result icon holds before falling back to idle. |
24
24
  | `label?` | `string` | `'Copy'` | Accessible name in the idle and failure states. |
25
25
  | `copiedLabel?` | `string` | `'Copied'` | Accessible name while the success icon is showing. |
26
+ | `idleIcon?` | `Component<IconProps>` | `Copy` | Idle-state glyph (the "copy" affordance). Swap to match a host
27
+ icon set — any component taking lucide's IconProps fits. |
28
+ | `successIcon?` | `Component<IconProps>` | `Check` | Glyph shown after a successful write. |
29
+ | `failureIcon?` | `Component<IconProps>` | `X` | Glyph shown after a failed write. |
@@ -470,6 +470,10 @@ is resolved on each click, not at render. |
470
470
  | `resetDelay?` | `number` | `1500` | How long the result icon holds before falling back to idle. |
471
471
  | `label?` | `string` | `'Copy'` | Accessible name in the idle and failure states. |
472
472
  | `copiedLabel?` | `string` | `'Copied'` | Accessible name while the success icon is showing. |
473
+ | `idleIcon?` | `Component<IconProps>` | `Copy` | Idle-state glyph (the "copy" affordance). Swap to match a host
474
+ icon set — any component taking lucide's IconProps fits. |
475
+ | `successIcon?` | `Component<IconProps>` | `Check` | Glyph shown after a successful write. |
476
+ | `failureIcon?` | `Component<IconProps>` | `X` | Glyph shown after a failed write. |
473
477
 
474
478
  <!-- end: copy-button -->
475
479
 
@@ -186,7 +186,7 @@
186
186
  "slug": "copy-button",
187
187
  "title": "Copy Button",
188
188
  "summary": "An icon button that copies text and cross-fades to a result glyph.",
189
- "tokenEstimate": 257,
189
+ "tokenEstimate": 345,
190
190
  "sections": [
191
191
  "Import",
192
192
  "Props"
@@ -1,5 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import type { Component } from 'svelte';
4
+ import type { IconProps } from '@lucide/svelte';
3
5
  import Copy from '@lucide/svelte/icons/copy';
4
6
  import Check from '@lucide/svelte/icons/check';
5
7
  import X from '@lucide/svelte/icons/x';
@@ -14,6 +16,9 @@
14
16
  label = 'Copy',
15
17
  copiedLabel = 'Copied',
16
18
  size = 'sm',
19
+ idleIcon: IdleIcon = Copy,
20
+ successIcon: SuccessIcon = Check,
21
+ failureIcon: FailureIcon = X,
17
22
  class: className,
18
23
  ...restProps
19
24
  // Typed off the native button rather than bits-ui's Button.RootProps: the
@@ -36,6 +41,13 @@
36
41
  label?: string;
37
42
  /** Accessible name while the success icon is showing. */
38
43
  copiedLabel?: string;
44
+ /** Idle-state glyph (the "copy" affordance). Swap to match a host
45
+ * icon set — any component taking lucide's IconProps fits. */
46
+ idleIcon?: Component<IconProps>;
47
+ /** Glyph shown after a successful write. */
48
+ successIcon?: Component<IconProps>;
49
+ /** Glyph shown after a failed write. */
50
+ failureIcon?: Component<IconProps>;
39
51
  } = $props();
40
52
 
41
53
  let status = $state<'idle' | 'success' | 'failure'>('idle');
@@ -78,8 +90,8 @@
78
90
  {...restProps}
79
91
  >
80
92
  <span class="relative block size-(--era-h-xs) shrink-0">
81
- <Copy class={cn(iconBase, status === 'idle' ? iconIn : iconOut)} />
82
- <Check class={cn(iconBase, 'text-success', status === 'success' ? iconIn : iconOut)} />
83
- <X class={cn(iconBase, 'text-destructive', status === 'failure' ? iconIn : iconOut)} />
93
+ <IdleIcon class={cn(iconBase, status === 'idle' ? iconIn : iconOut)} />
94
+ <SuccessIcon class={cn(iconBase, 'text-success', status === 'success' ? iconIn : iconOut)} />
95
+ <FailureIcon class={cn(iconBase, 'text-destructive', status === 'failure' ? iconIn : iconOut)} />
84
96
  </span>
85
97
  </Button>
@@ -1,4 +1,6 @@
1
1
  import type { HTMLButtonAttributes } from 'svelte/elements';
2
+ import type { Component } from 'svelte';
3
+ import type { IconProps } from '@lucide/svelte';
2
4
  import { type ButtonVariants } from '../button/index.js';
3
5
  type $$ComponentProps = Omit<HTMLButtonAttributes, 'onclick' | 'children'> & {
4
6
  ref?: HTMLElement | null;
@@ -17,7 +19,14 @@ type $$ComponentProps = Omit<HTMLButtonAttributes, 'onclick' | 'children'> & {
17
19
  label?: string;
18
20
  /** Accessible name while the success icon is showing. */
19
21
  copiedLabel?: string;
22
+ /** Idle-state glyph (the "copy" affordance). Swap to match a host
23
+ * icon set — any component taking lucide's IconProps fits. */
24
+ idleIcon?: Component<IconProps>;
25
+ /** Glyph shown after a successful write. */
26
+ successIcon?: Component<IconProps>;
27
+ /** Glyph shown after a failed write. */
28
+ failureIcon?: Component<IconProps>;
20
29
  };
21
- declare const CopyButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
30
+ declare const CopyButton: Component<$$ComponentProps, {}, "ref">;
22
31
  type CopyButton = ReturnType<typeof CopyButton>;
23
32
  export default CopyButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signal9/era-ui",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev --host",
6
6
  "build": "vite build && npm run prepack",