@r2digisolutions/components 0.24.0 → 0.24.1

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.
@@ -0,0 +1,76 @@
1
+ <script lang="ts">
2
+ interface VerifiedBadgeProps {
3
+ /** Icon size. `sm` for inline text, `md` next to titles, `lg` for hero headers. */
4
+ size?: 'sm' | 'md' | 'lg';
5
+ /** When set, renders a pill with the seal and this text instead of the bare seal. */
6
+ label?: string;
7
+ /** Accessible name for the bare seal. */
8
+ title?: string;
9
+ class?: string;
10
+ }
11
+
12
+ let {
13
+ size = 'md',
14
+ label,
15
+ title = 'Verified',
16
+ class: className = ''
17
+ }: VerifiedBadgeProps = $props();
18
+
19
+ const sizeClass = $derived(
20
+ {
21
+ sm: 'h-4 w-4',
22
+ md: 'h-5 w-5',
23
+ lg: 'h-7 w-7'
24
+ }[size]
25
+ );
26
+ </script>
27
+
28
+ {#snippet seal(extra: string)}
29
+ <svg
30
+ class={['drop-shadow-sm shrink-0', extra]}
31
+ viewBox="0 0 24 24"
32
+ fill="none"
33
+ aria-hidden="true"
34
+ >
35
+ <defs>
36
+ <linearGradient id="r2-verified-gradient" x1="0" y1="0" x2="1" y2="1">
37
+ <stop offset="0" stop-color="#38bdf8" />
38
+ <stop offset="1" stop-color="#0284c7" />
39
+ </linearGradient>
40
+ </defs>
41
+ <!-- Scalloped seal: 12 lobes -->
42
+ <path
43
+ fill="url(#r2-verified-gradient)"
44
+ d="M12 1.6l2.05 1.7 2.6-.55.98 2.48 2.48.98-.55 2.6L21.26 11l-1.7 2.05.55 2.6-2.48.98-.98 2.48-2.6-.55L12 20.26l-2.05-1.7-2.6.55-.98-2.48-2.48-.98.55-2.6L2.74 11l1.7-2.05-.55-2.6 2.48-.98.98-2.48 2.6.55z"
45
+ transform="translate(0 1)"
46
+ />
47
+ <path
48
+ d="M8.2 12.2l2.4 2.4 5.2-5.4"
49
+ stroke="#fff"
50
+ stroke-width="2.4"
51
+ stroke-linecap="round"
52
+ stroke-linejoin="round"
53
+ />
54
+ </svg>
55
+ {/snippet}
56
+
57
+ {#if label}
58
+ <span
59
+ class={[
60
+ 'gap-1.5 bg-sky-50 py-0.5 pr-2.5 pl-1.5 text-xs font-medium text-sky-700 dark:bg-sky-500/15 dark:text-sky-300 inline-flex items-center rounded-full',
61
+ className
62
+ ]}
63
+ >
64
+ {@render seal('h-4 w-4')}
65
+ {label}
66
+ </span>
67
+ {:else}
68
+ <span
69
+ class={['inline-flex items-center align-middle', className]}
70
+ {title}
71
+ role="img"
72
+ aria-label={title}
73
+ >
74
+ {@render seal(sizeClass)}
75
+ </span>
76
+ {/if}
@@ -0,0 +1,12 @@
1
+ interface VerifiedBadgeProps {
2
+ /** Icon size. `sm` for inline text, `md` next to titles, `lg` for hero headers. */
3
+ size?: 'sm' | 'md' | 'lg';
4
+ /** When set, renders a pill with the seal and this text instead of the bare seal. */
5
+ label?: string;
6
+ /** Accessible name for the bare seal. */
7
+ title?: string;
8
+ class?: string;
9
+ }
10
+ declare const VerifiedBadge: import("svelte").Component<VerifiedBadgeProps, {}, "">;
11
+ type VerifiedBadge = ReturnType<typeof VerifiedBadge>;
12
+ export default VerifiedBadge;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { onDestroy } from 'svelte';
2
+ import { onDestroy, type Snippet } from 'svelte';
3
3
 
4
4
  interface ProfileMedia {
5
5
  file: File;
@@ -44,6 +44,10 @@
44
44
  /** Top-right actions once a cover exists. The cover itself still replaces the file. */
45
45
  onframe?: () => void;
46
46
  onedit?: () => void;
47
+ /** Profile identity (name, badges…) rendered beside the avatar, like a public header. */
48
+ details?: Snippet;
49
+ /** Right-aligned actions on the avatar row (e.g. "View public page"). */
50
+ actions?: Snippet;
47
51
  }
48
52
 
49
53
  let {
@@ -71,7 +75,9 @@
71
75
  class: className = '',
72
76
  onchange,
73
77
  onframe,
74
- onedit
78
+ onedit,
79
+ details,
80
+ actions
75
81
  }: ProfileHeaderUploaderProps = $props();
76
82
 
77
83
  let cover = $state<ProfileMedia | null>(null);
@@ -530,9 +536,28 @@
530
536
  {/if}
531
537
  </div>
532
538
 
533
- <div class="min-w-0 pb-1 flex-1">
539
+ <!-- With `details`, only the avatar overlaps the cover; the text stays on the card
540
+ surface so it never has to compete with the cover image for contrast. -->
541
+ <div
542
+ class={[
543
+ 'min-w-0 flex-1',
544
+ details
545
+ ? 'mt-10 gap-4 pt-2 sm:mt-12 flex flex-wrap items-center justify-between self-start'
546
+ : 'pb-1'
547
+ ]}
548
+ >
549
+ {#if details}
550
+ <div class="min-w-0 flex-1">
551
+ {@render details()}
552
+ </div>
553
+ {/if}
554
+ {#if actions && details}
555
+ <div class="gap-2 flex shrink-0 flex-wrap items-center justify-end">
556
+ {@render actions()}
557
+ </div>
558
+ {/if}
534
559
  {#if hasLocalMedia}
535
- <div class="gap-2 flex flex-wrap items-center">
560
+ <div class={['gap-2 flex flex-wrap items-center', details ? 'w-full' : '']}>
536
561
  {#if cover && !disabled}
537
562
  <button
538
563
  type="button"
@@ -552,12 +577,17 @@
552
577
  </button>
553
578
  {/if}
554
579
  </div>
555
- {:else}
580
+ {:else if !details}
556
581
  <p id={helperId} class="text-xs text-secondary leading-relaxed">
557
582
  {avatarHelperText}
558
583
  </p>
559
584
  {/if}
560
585
  </div>
586
+ {#if actions && !details}
587
+ <div class="pb-1 gap-2 flex shrink-0 flex-wrap items-center justify-end">
588
+ {@render actions()}
589
+ </div>
590
+ {/if}
561
591
  </div>
562
592
  </div>
563
593
  {/if}
@@ -1,3 +1,4 @@
1
+ import { type Snippet } from 'svelte';
1
2
  interface ProfileHeaderValue {
2
3
  cover: File | null;
3
4
  avatar: File | null;
@@ -34,6 +35,10 @@ interface ProfileHeaderUploaderProps {
34
35
  /** Top-right actions once a cover exists. The cover itself still replaces the file. */
35
36
  onframe?: () => void;
36
37
  onedit?: () => void;
38
+ /** Profile identity (name, badges…) rendered beside the avatar, like a public header. */
39
+ details?: Snippet;
40
+ /** Right-aligned actions on the avatar row (e.g. "View public page"). */
41
+ actions?: Snippet;
37
42
  }
38
43
  declare const ProfileHeaderUploader: import("svelte").Component<ProfileHeaderUploaderProps, {
39
44
  replaceCover: (file: File) => void;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { default as Slider } from './components/atoms/Slider/Slider.svelte';
6
6
  export { default as Skeleton } from './components/atoms/Skeleton/Skeleton.svelte';
7
7
  export { default as ProgressBar } from './components/atoms/ProgressBar/ProgressBar.svelte';
8
8
  export { default as Badge } from './components/atoms/Badge/Badge.svelte';
9
+ export { default as VerifiedBadge } from './components/atoms/VerifiedBadge/VerifiedBadge.svelte';
9
10
  export { default as Avatar } from './components/atoms/Avatar/Avatar.svelte';
10
11
  export { default as Spinner } from './components/atoms/Spinner/Spinner.svelte';
11
12
  export { default as Toggle } from './components/atoms/Toggle/Toggle.svelte';
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as Slider } from './components/atoms/Slider/Slider.svelte';
10
10
  export { default as Skeleton } from './components/atoms/Skeleton/Skeleton.svelte';
11
11
  export { default as ProgressBar } from './components/atoms/ProgressBar/ProgressBar.svelte';
12
12
  export { default as Badge } from './components/atoms/Badge/Badge.svelte';
13
+ export { default as VerifiedBadge } from './components/atoms/VerifiedBadge/VerifiedBadge.svelte';
13
14
  export { default as Avatar } from './components/atoms/Avatar/Avatar.svelte';
14
15
  export { default as Spinner } from './components/atoms/Spinner/Spinner.svelte';
15
16
  export { default as Toggle } from './components/atoms/Toggle/Toggle.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",