@r2digisolutions/components 0.25.18 → 0.25.20

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.
@@ -4,6 +4,14 @@ declare const meta: {
4
4
  component: import("svelte").Component<{
5
5
  title?: string;
6
6
  description?: string;
7
+ eyebrow?: string;
8
+ hint?: string;
9
+ variant?: "dashed" | "card" | "plain";
10
+ size?: "sm" | "md" | "lg";
11
+ background?: "none" | "gradient";
12
+ iconStyle?: "soft" | "elevated";
13
+ showAction?: boolean;
14
+ customIcon?: boolean;
7
15
  }, {}, "">;
8
16
  tags: string[];
9
17
  argTypes: {
@@ -13,6 +21,34 @@ declare const meta: {
13
21
  description: {
14
22
  control: "text";
15
23
  };
24
+ eyebrow: {
25
+ control: "text";
26
+ };
27
+ hint: {
28
+ control: "text";
29
+ };
30
+ variant: {
31
+ control: "inline-radio";
32
+ options: string[];
33
+ };
34
+ size: {
35
+ control: "inline-radio";
36
+ options: string[];
37
+ };
38
+ background: {
39
+ control: "inline-radio";
40
+ options: string[];
41
+ };
42
+ iconStyle: {
43
+ control: "inline-radio";
44
+ options: string[];
45
+ };
46
+ showAction: {
47
+ control: "boolean";
48
+ };
49
+ customIcon: {
50
+ control: "boolean";
51
+ };
16
52
  };
17
53
  args: {
18
54
  title: string;
@@ -23,3 +59,10 @@ export default meta;
23
59
  type Story = StoryObj<typeof meta>;
24
60
  export declare const Default: Story;
25
61
  export declare const NoProjects: Story;
62
+ /** The full-page treatment: eyebrow, large heading, elevated icon tile, glow and a hint under the action. */
63
+ export declare const Hero: Story;
64
+ export declare const Gradient: Story;
65
+ export declare const Card: Story;
66
+ export declare const Plain: Story;
67
+ export declare const Small: Story;
68
+ export declare const WithEyebrow: Story;
@@ -5,7 +5,15 @@ const meta = {
5
5
  tags: ['autodocs'],
6
6
  argTypes: {
7
7
  title: { control: 'text' },
8
- description: { control: 'text' }
8
+ description: { control: 'text' },
9
+ eyebrow: { control: 'text' },
10
+ hint: { control: 'text' },
11
+ variant: { control: 'inline-radio', options: ['dashed', 'card', 'plain'] },
12
+ size: { control: 'inline-radio', options: ['sm', 'md', 'lg'] },
13
+ background: { control: 'inline-radio', options: ['none', 'gradient'] },
14
+ iconStyle: { control: 'inline-radio', options: ['soft', 'elevated'] },
15
+ showAction: { control: 'boolean' },
16
+ customIcon: { control: 'boolean' }
9
17
  },
10
18
  args: {
11
19
  title: 'No invoices found',
@@ -15,3 +23,22 @@ const meta = {
15
23
  export default meta;
16
24
  export const Default = { args: { title: 'No results found', description: 'Try adjusting your search or filter options.' } };
17
25
  export const NoProjects = { args: { title: 'No projects yet', description: 'Get started by creating a new workspace project.' } };
26
+ /** The full-page treatment: eyebrow, large heading, elevated icon tile, glow and a hint under the action. */
27
+ export const Hero = {
28
+ args: {
29
+ size: 'lg',
30
+ variant: 'card',
31
+ background: 'gradient',
32
+ iconStyle: 'elevated',
33
+ customIcon: true,
34
+ eyebrow: 'It starts with hello',
35
+ title: 'Your conversations start here',
36
+ description: 'Ask about a listing, work out the details and come back here to keep talking.',
37
+ hint: 'Look for the “Send message” button on each listing.'
38
+ }
39
+ };
40
+ export const Gradient = { args: { background: 'gradient', variant: 'card', iconStyle: 'elevated' } };
41
+ export const Card = { args: { variant: 'card' } };
42
+ export const Plain = { args: { variant: 'plain', showAction: false } };
43
+ export const Small = { args: { size: 'sm', title: 'Nothing here yet', description: 'Items you add will show up here.', showAction: false } };
44
+ export const WithEyebrow = { args: { eyebrow: 'Getting started' } };
@@ -4,48 +4,115 @@
4
4
  interface EmptyStateProps {
5
5
  title?: string;
6
6
  description?: string;
7
+ /** Small uppercase line above the title. */
8
+ eyebrow?: string;
7
9
  icon?: Snippet;
8
10
  action?: Snippet;
11
+ /** Muted line under the action (a tip, a shortcut, a reassurance). */
12
+ hint?: string;
13
+ /** Free-form content under the hint, for anything `hint` can't express. */
14
+ footer?: Snippet;
9
15
  /** Heading level of the title, to keep the page outline in order. Default 3. */
10
16
  headingLevel?: 2 | 3 | 4 | 5 | 6;
17
+ /** `dashed` outline (default), solid `card` outline, or `plain` with no surface. */
18
+ variant?: 'dashed' | 'card' | 'plain';
19
+ /** `sm` fits a panel, `md` (default) a section, `lg` a whole empty page. */
20
+ size?: 'sm' | 'md' | 'lg';
21
+ /** `gradient` adds a soft brand glow fading from the top edge; works in light and dark. */
22
+ background?: 'none' | 'gradient';
23
+ /** `soft` brand-tinted tile (default) or `elevated` surface tile with border and shadow. */
24
+ iconStyle?: 'soft' | 'elevated';
11
25
  class?: string;
12
26
  }
13
27
 
14
28
  const {
15
29
  title = 'No data found',
16
30
  description = 'There are no items to display right now.',
31
+ eyebrow,
17
32
  icon,
18
33
  action,
34
+ hint,
35
+ footer,
19
36
  headingLevel = 3,
37
+ variant = 'dashed',
38
+ size = 'md',
39
+ background = 'none',
40
+ iconStyle = 'soft',
20
41
  class: className = ''
21
42
  }: EmptyStateProps = $props();
43
+
44
+ const variantClass = {
45
+ dashed: 'rounded-2xl border border-dashed border-border bg-surface-elevated',
46
+ card: 'rounded-3xl border border-border bg-surface-elevated',
47
+ plain: ''
48
+ };
49
+ const sizeClass = {
50
+ sm: 'p-5',
51
+ md: 'p-8',
52
+ lg: 'px-7 py-14'
53
+ };
54
+ const tileSize = {
55
+ sm: 'h-10 w-10 rounded-xl mb-3',
56
+ md: 'h-14 w-14 rounded-2xl mb-4',
57
+ lg: 'h-[76px] w-[76px] rounded-[25px] mb-6'
58
+ };
59
+ const tileStyle = {
60
+ soft: 'bg-brand-50 dark:bg-brand-950/60 text-brand-600 dark:text-brand-400 shadow-xs',
61
+ elevated:
62
+ 'bg-surface-elevated border border-border text-brand-600 dark:text-brand-400 shadow-lg'
63
+ };
64
+ const iconSize = { sm: 'h-5 w-5', md: 'h-7 w-7', lg: 'h-8 w-8' };
65
+ const titleClass = {
66
+ sm: 'text-sm font-semibold mb-1',
67
+ md: 'text-base font-semibold mb-1',
68
+ lg: 'text-[clamp(1.375rem,3vw,1.75rem)] font-normal tracking-tight mb-2'
69
+ };
70
+ const descriptionClass = {
71
+ sm: 'text-xs max-w-xs mb-4',
72
+ md: 'text-xs max-w-sm mb-5',
73
+ lg: 'text-sm max-w-[26rem] mb-6'
74
+ };
75
+ const gradient =
76
+ 'bg-[radial-gradient(ellipse_at_top,var(--color-brand-50),transparent_65%)] dark:bg-[radial-gradient(ellipse_at_top,color-mix(in_oklab,var(--color-brand-500)_18%,transparent),transparent_65%)]';
22
77
  </script>
23
78
 
24
79
  <div
25
80
  class={[
26
- 'flex flex-col items-center justify-center p-8 text-center rounded-2xl border border-dashed border-border bg-surface-elevated w-full',
81
+ 'flex flex-col items-center justify-center text-center w-full',
82
+ variantClass[variant],
83
+ sizeClass[size],
84
+ background === 'gradient' && gradient,
27
85
  className
28
86
  ]}
29
87
  >
30
88
  <!-- Icon or illustration container -->
31
- <div class="h-14 w-14 rounded-2xl bg-brand-50 dark:bg-brand-950/60 text-brand-600 dark:text-brand-400 flex items-center justify-center mb-4 shadow-xs">
89
+ <div class={['flex items-center justify-center', tileSize[size], tileStyle[iconStyle]]}>
32
90
  {#if icon}
33
91
  {@render icon()}
34
92
  {:else}
35
- <svg class="h-7 w-7" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.75">
93
+ <svg class={iconSize[size]} fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.75">
36
94
  <path stroke-linecap="round" stroke-linejoin="round" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" />
37
95
  </svg>
38
96
  {/if}
39
97
  </div>
40
98
 
41
- <svelte:element this={`h${headingLevel}`} class="text-base font-semibold text-primary mb-1"
99
+ {#if eyebrow}
100
+ <p class="text-[11px] font-semibold uppercase tracking-[0.14em] text-muted mb-2">{eyebrow}</p>
101
+ {/if}
102
+ <svelte:element this={`h${headingLevel}`} class={['text-primary', titleClass[size]]}
42
103
  >{title}</svelte:element
43
104
  >
44
105
  {#if description}
45
- <p class="text-xs text-muted max-w-sm leading-relaxed mb-5">{description}</p>
106
+ <p class={['text-muted leading-relaxed', descriptionClass[size]]}>{description}</p>
46
107
  {/if}
47
108
 
48
109
  {#if action}
49
110
  {@render action()}
50
111
  {/if}
112
+ {#if hint}
113
+ <p class="text-xs text-muted mt-4">{hint}</p>
114
+ {/if}
115
+ {#if footer}
116
+ {@render footer()}
117
+ {/if}
51
118
  </div>
@@ -2,10 +2,24 @@ import type { Snippet } from 'svelte';
2
2
  interface EmptyStateProps {
3
3
  title?: string;
4
4
  description?: string;
5
+ /** Small uppercase line above the title. */
6
+ eyebrow?: string;
5
7
  icon?: Snippet;
6
8
  action?: Snippet;
9
+ /** Muted line under the action (a tip, a shortcut, a reassurance). */
10
+ hint?: string;
11
+ /** Free-form content under the hint, for anything `hint` can't express. */
12
+ footer?: Snippet;
7
13
  /** Heading level of the title, to keep the page outline in order. Default 3. */
8
14
  headingLevel?: 2 | 3 | 4 | 5 | 6;
15
+ /** `dashed` outline (default), solid `card` outline, or `plain` with no surface. */
16
+ variant?: 'dashed' | 'card' | 'plain';
17
+ /** `sm` fits a panel, `md` (default) a section, `lg` a whole empty page. */
18
+ size?: 'sm' | 'md' | 'lg';
19
+ /** `gradient` adds a soft brand glow fading from the top edge; works in light and dark. */
20
+ background?: 'none' | 'gradient';
21
+ /** `soft` brand-tinted tile (default) or `elevated` surface tile with border and shadow. */
22
+ iconStyle?: 'soft' | 'elevated';
9
23
  class?: string;
10
24
  }
11
25
  declare const EmptyState: import("svelte").Component<EmptyStateProps, {}, "">;
@@ -5,16 +5,43 @@
5
5
  let props = $props<{
6
6
  title?: string;
7
7
  description?: string;
8
+ eyebrow?: string;
9
+ hint?: string;
10
+ variant?: 'dashed' | 'card' | 'plain';
11
+ size?: 'sm' | 'md' | 'lg';
12
+ background?: 'none' | 'gradient';
13
+ iconStyle?: 'soft' | 'elevated';
14
+ showAction?: boolean;
15
+ customIcon?: boolean;
8
16
  }>();
9
17
  </script>
10
18
 
11
- <div class="w-96 max-w-full">
19
+ <div class={props.size === 'lg' ? 'w-[40rem] max-w-full' : 'w-96 max-w-full'}>
12
20
  <EmptyState
13
21
  title={props.title ?? 'No invoices found'}
14
22
  description={props.description ?? 'You haven’t created any invoices yet. Create your first invoice to get started.'}
23
+ eyebrow={props.eyebrow}
24
+ hint={props.hint}
25
+ variant={props.variant}
26
+ size={props.size}
27
+ background={props.background}
28
+ iconStyle={props.iconStyle}
15
29
  >
30
+ {#snippet icon()}
31
+ {#if props.customIcon}
32
+ <svg class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
33
+ <path stroke-linecap="round" stroke-linejoin="round" d="M8 10h8M8 14h5m-9 6 3-3h10a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v13Z" />
34
+ </svg>
35
+ {:else}
36
+ <svg class="h-7 w-7" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.75">
37
+ <path stroke-linecap="round" stroke-linejoin="round" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" />
38
+ </svg>
39
+ {/if}
40
+ {/snippet}
16
41
  {#snippet action()}
17
- <Button variant="primary" size="sm">Create Invoice</Button>
42
+ {#if props.showAction !== false}
43
+ <Button variant="primary" size="sm">Create Invoice</Button>
44
+ {/if}
18
45
  {/snippet}
19
46
  </EmptyState>
20
47
  </div>
@@ -1,6 +1,14 @@
1
1
  type $$ComponentProps = {
2
2
  title?: string;
3
3
  description?: string;
4
+ eyebrow?: string;
5
+ hint?: string;
6
+ variant?: 'dashed' | 'card' | 'plain';
7
+ size?: 'sm' | 'md' | 'lg';
8
+ background?: 'none' | 'gradient';
9
+ iconStyle?: 'soft' | 'elevated';
10
+ showAction?: boolean;
11
+ customIcon?: boolean;
4
12
  };
5
13
  declare const EmptyStateStory: import("svelte").Component<$$ComponentProps, {}, "">;
6
14
  type EmptyStateStory = ReturnType<typeof EmptyStateStory>;
@@ -357,13 +357,21 @@
357
357
  return `transform: translate3d(${tx}px, ${ty}px, 0) scale(${scale}); opacity: ${fade}`;
358
358
  });
359
359
  const transitioning = $derived(!dragging);
360
+
361
+ /** Promotes the node to the top layer; removing it from the DOM leaves the layer automatically. */
362
+ function topLayer(node: HTMLElement) {
363
+ node.showPopover?.();
364
+ }
360
365
  </script>
361
366
 
362
367
  {#if open && current}
368
+ <!-- popover=manual → browser top layer: fixed page chrome (bottom navs, headers) can't cover it -->
363
369
  <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
364
370
  <div
371
+ popover="manual"
372
+ use:topLayer
365
373
  class={[
366
- 'fixed inset-0 z-50 flex flex-col',
374
+ 'fixed inset-0 z-50 m-0 flex h-dvh max-h-none w-screen max-w-none flex-col overflow-visible border-0 p-0',
367
375
  blurBackdrop && 'backdrop-blur-xl',
368
376
  className
369
377
  ]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.25.18",
3
+ "version": "0.25.20",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",