@r2digisolutions/components 0.25.19 → 0.26.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.
- package/README.md +4 -0
- package/WORKSPACE.md +48 -0
- package/dist/components/molecules/ActionRow/ActionRow.stories.js +9 -0
- package/dist/components/molecules/ActionRow/ActionRow.svelte +84 -0
- package/dist/components/molecules/ActionRow/ActionRow.svelte.d.ts +31 -0
- package/dist/components/molecules/ActionRow/ActionRowStory.svelte +36 -0
- package/dist/components/molecules/ActionRow/ActionRowStory.svelte.d.ts +18 -0
- package/dist/components/molecules/Card/Card.svelte +4 -0
- package/dist/components/molecules/Card/Card.svelte.d.ts +2 -0
- package/dist/components/molecules/EmptyState/EmptyState.stories.d.ts +43 -0
- package/dist/components/molecules/EmptyState/EmptyState.stories.js +28 -1
- package/dist/components/molecules/EmptyState/EmptyState.svelte +72 -5
- package/dist/components/molecules/EmptyState/EmptyState.svelte.d.ts +14 -0
- package/dist/components/molecules/EmptyState/EmptyStateStory.svelte +29 -2
- package/dist/components/molecules/EmptyState/EmptyStateStory.svelte.d.ts +8 -0
- package/dist/components/molecules/EntityHero/EntityHero.stories.js +9 -0
- package/dist/components/molecules/EntityHero/EntityHero.svelte +162 -0
- package/dist/components/molecules/EntityHero/EntityHero.svelte.d.ts +37 -0
- package/dist/components/molecules/EntityHero/EntityHeroStory.svelte +28 -0
- package/dist/components/molecules/EntityHero/EntityHeroStory.svelte.d.ts +18 -0
- package/dist/components/molecules/OrgSwitcher/OrgSwitcher.svelte +68 -23
- package/dist/components/molecules/OrgSwitcher/OrgSwitcher.svelte.d.ts +12 -0
- package/dist/components/molecules/SectionNav/SectionNav.stories.d.ts +12 -0
- package/dist/components/molecules/SectionNav/SectionNav.stories.js +9 -0
- package/dist/components/molecules/SectionNav/SectionNav.svelte +139 -0
- package/dist/components/molecules/SectionNav/SectionNav.svelte.d.ts +41 -0
- package/dist/components/molecules/SectionNav/SectionNavStory.svelte +48 -0
- package/dist/components/molecules/SectionNav/SectionNavStory.svelte.d.ts +3 -0
- package/dist/components/molecules/StatCard/StatCard.svelte +51 -15
- package/dist/components/molecules/StatCard/StatCard.svelte.d.ts +13 -2
- package/dist/components/organisms/BottomNav/BottomNav.svelte +93 -53
- package/dist/components/organisms/BottomNav/BottomNav.svelte.d.ts +17 -2
- package/dist/components/organisms/NavRail/NavRail.svelte +106 -34
- package/dist/components/organisms/NavRail/NavRail.svelte.d.ts +12 -0
- package/dist/components/organisms/ProfilePicker/ProfilePicker.stories.d.ts +12 -0
- package/dist/components/organisms/ProfilePicker/ProfilePicker.stories.js +9 -0
- package/dist/components/organisms/ProfilePicker/ProfilePicker.svelte +183 -0
- package/dist/components/organisms/ProfilePicker/ProfilePicker.svelte.d.ts +37 -0
- package/dist/components/organisms/ProfilePicker/ProfilePickerStory.svelte +18 -0
- package/dist/components/organisms/ProfilePicker/ProfilePickerStory.svelte.d.ts +3 -0
- package/dist/components/organisms/WorkspaceShell/WorkspaceShell.stories.d.ts +12 -0
- package/dist/components/organisms/WorkspaceShell/WorkspaceShell.stories.js +9 -0
- package/dist/components/organisms/WorkspaceShell/WorkspaceShell.svelte +75 -0
- package/dist/components/organisms/WorkspaceShell/WorkspaceShell.svelte.d.ts +30 -0
- package/dist/components/organisms/WorkspaceShell/WorkspaceShellStory.svelte +71 -0
- package/dist/components/organisms/WorkspaceShell/WorkspaceShellStory.svelte.d.ts +3 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +5 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -104,6 +104,10 @@ export default defineConfig({
|
|
|
104
104
|
- En `vite dev` no hace nada: se escanea todo.
|
|
105
105
|
- Si solo quieres los tokens sin escanear nada: `@import '@r2digisolutions/components/theme.css';`.
|
|
106
106
|
|
|
107
|
+
## Paneles (estética workspace)
|
|
108
|
+
|
|
109
|
+
Guía de estructura y estilo para paneles de gestión: [WORKSPACE.md](WORKSPACE.md).
|
|
110
|
+
|
|
107
111
|
## Tema: modo + paleta
|
|
108
112
|
|
|
109
113
|
Hay dos ejes independientes en `<html>`:
|
package/WORKSPACE.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Estética «workspace» (paneles y back-offices)
|
|
2
|
+
|
|
3
|
+
Guía para que todos los paneles (Evobusiness, Gestor, CRM, etc.) se vean y se usen igual.
|
|
4
|
+
Úsala siempre que montes un panel de gestión con varias secciones. La referencia visual es el panel de Evobusiness.
|
|
5
|
+
|
|
6
|
+
## Estructura
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
Escritorio (≥ lg) NavRail (solid, con etiquetas) | SectionNav | barra superior + contenido
|
|
10
|
+
Tablet (md) NavRail | barra superior + contenido
|
|
11
|
+
Móvil cabecera móvil / contenido / BottomNav con botón + central
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Todo se monta con `WorkspaceShell`, que solo coloca las piezas. Cada app pasa sus snippets:
|
|
15
|
+
|
|
16
|
+
| Zona | Componente | Notas |
|
|
17
|
+
| -------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
18
|
+
| `rail` | `NavRail variant="solid" showLabels` | Máximo 5 o 6 secciones arriba. Admin y la cuenta van en `footerItems`. Los contadores van en `badge`. |
|
|
19
|
+
| `secondary` | `SectionNav` | Título y una línea de la sección. Arriba, el `OrgSwitcher` en `header`. Abajo, en `footer`, el progreso o un enlace público. |
|
|
20
|
+
| `topbar` | migas + buscador (`CommandPalette`, Ctrl K) + botón **Crear** + campana | Altura de unos 60px y fondo transparente con desenfoque. |
|
|
21
|
+
| `mobileHeader` | switcher compacto + lupa + campana, y las subsecciones como pestañas (`Tabs` o enlaces) | |
|
|
22
|
+
| `bottomNav` | `BottomNav variant="docked" fabShape="square" activeStyle="color"` con `href` e `iconComponent` | 4 secciones y un `primary: true` en el centro para «Crear». |
|
|
23
|
+
|
|
24
|
+
Varias cuentas o empresas: `OrgSwitcher` (con `title`, `subtitle`, `badge`, `createLabel` y `footerNote`) en escritorio, y `ProfilePicker` (pantalla tipo perfiles de Netflix) en móvil y al entrar si hay más de una.
|
|
25
|
+
|
|
26
|
+
## Portada de la sección «Inicio» (dashboard)
|
|
27
|
+
|
|
28
|
+
1. `EntityHero coverSize="md"`: portada, logo, nombre, badges de estado y acciones (Compartir, QR, Editar). Los botones de la portada (Cambiar portada, Ajustar encuadre) van en el snippet `coverActions`: salen al pasar el ratón y siempre en táctil.
|
|
29
|
+
2. Fila de 4 `StatCard` con `labelIcon`, `sparkline` y `delta` en `deltaStyle="pill"`. En el móvil, en una fila con scroll lateral.
|
|
30
|
+
3. **Bandeja** (lo que necesita respuesta) con `ActionRow`: un icono con el `tone` del tipo, el título, `meta` con la fecha y la acción principal a la derecha (Responder, Aceptar…). Todo en una `Card`, con `Tabs` para filtrar.
|
|
31
|
+
4. Columna derecha: agenda de hoy, un resumen del escaparate y las tareas pendientes.
|
|
32
|
+
|
|
33
|
+
## Reglas visuales
|
|
34
|
+
|
|
35
|
+
- **Color:** solo los tokens `brand-*`. Cada app los redefine en su `@theme` (Evobusiness usa el verde `#31855b` como `brand-500`). Nunca pongas colores fijos en los componentes. Ámbar para avisos, rojo solo para errores y para borrar.
|
|
36
|
+
- **Superficies:** fondo `bg-surface`, tarjetas `bg-surface-elevated` con `border-border`, `rounded-2xl` y `shadow-sm` como mucho.
|
|
37
|
+
- **Texto:** Inter. Títulos `font-bold tracking-tight`. Etiquetas de grupo en `text-[11px] uppercase tracking-wider text-muted`.
|
|
38
|
+
- **Contadores:** en la barra verde, píldora ámbar. En los menús claros, píldora `brand-600` si requiere acción y gris si solo informa.
|
|
39
|
+
- **Iconos:** Lucide, con `strokeWidth` 1.75–1.9 y un tamaño de 18–20px en los menús.
|
|
40
|
+
- **Densidad:** filas de menú con `py-2` y tarjetas con `p-4`/`p-5`. Separación entre bloques de `gap-4`.
|
|
41
|
+
|
|
42
|
+
## Reglas de uso (todas las apps)
|
|
43
|
+
|
|
44
|
+
- Nada de elementos nativos sueltos (`<button>`, `<select>`, `<input>`…) en las apps: usa siempre los de esta librería. Si falta algo, se crea aquí, con su story, y se publica.
|
|
45
|
+
- Para los estados vacíos, `EmptyState`.
|
|
46
|
+
- En los modales (`Dialog`), las acciones van en el footer.
|
|
47
|
+
- Cada guardado o error termina en un toast. Donde se pueda, autoguardado.
|
|
48
|
+
- Los componentes nuevos van en la carpeta de su nivel (`atoms`, `molecules`, `organisms` o `templates`), con `XStory.svelte` y `X.stories.ts`, y se exportan en `src/lib/index.ts`.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export type ActionRowIcon = Component<{
|
|
5
|
+
class?: string;
|
|
6
|
+
size?: number | string;
|
|
7
|
+
strokeWidth?: number | string;
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
export type ActionRowTone = 'brand' | 'info' | 'warning' | 'danger' | 'neutral';
|
|
11
|
+
|
|
12
|
+
interface ActionRowProps {
|
|
13
|
+
title: string;
|
|
14
|
+
/** Small text next to the title (time ago, stars…). */
|
|
15
|
+
meta?: string;
|
|
16
|
+
/** Second line, truncated to one line. */
|
|
17
|
+
description?: string;
|
|
18
|
+
icon?: ActionRowIcon;
|
|
19
|
+
/** Colour of the icon tile: what kind of item this is. */
|
|
20
|
+
tone?: ActionRowTone;
|
|
21
|
+
/** Makes the title area a link (the actions stay independent). */
|
|
22
|
+
href?: string;
|
|
23
|
+
/** Mark as unread / new. */
|
|
24
|
+
unread?: boolean;
|
|
25
|
+
/** Hide the top divider (first row of a list). */
|
|
26
|
+
first?: boolean;
|
|
27
|
+
class?: string;
|
|
28
|
+
/** Inline extra after the title (stars, chips). */
|
|
29
|
+
titleExtra?: Snippet;
|
|
30
|
+
/** Buttons on the right (Responder, Aceptar…). */
|
|
31
|
+
actions?: Snippet;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
title,
|
|
36
|
+
meta,
|
|
37
|
+
description,
|
|
38
|
+
icon: Icon,
|
|
39
|
+
tone = 'brand',
|
|
40
|
+
href,
|
|
41
|
+
unread = false,
|
|
42
|
+
first = false,
|
|
43
|
+
class: className = '',
|
|
44
|
+
titleExtra,
|
|
45
|
+
actions
|
|
46
|
+
}: ActionRowProps = $props();
|
|
47
|
+
|
|
48
|
+
const TONES: Record<ActionRowTone, string> = {
|
|
49
|
+
brand: 'bg-brand-500/12 text-brand-700 dark:text-brand-300',
|
|
50
|
+
info: 'bg-sky-500/12 text-sky-700 dark:text-sky-300',
|
|
51
|
+
warning: 'bg-amber-500/15 text-amber-700 dark:text-amber-300',
|
|
52
|
+
danger: 'bg-red-500/12 text-red-700 dark:text-red-300',
|
|
53
|
+
neutral: 'bg-surface-overlay text-secondary'
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
{#snippet body()}
|
|
58
|
+
<span class="gap-1.5 flex items-center">
|
|
59
|
+
{#if unread}<span class="h-2 w-2 bg-brand-500 shrink-0 rounded-full" aria-label="Nuevo"
|
|
60
|
+
></span>{/if}
|
|
61
|
+
<span class="text-sm font-semibold text-primary truncate">{title}</span>
|
|
62
|
+
{#if titleExtra}{@render titleExtra()}{/if}
|
|
63
|
+
{#if meta}<span class="text-xs text-muted shrink-0">· {meta}</span>{/if}
|
|
64
|
+
</span>
|
|
65
|
+
{#if description}<span class="text-muted block truncate text-[13px]">{description}</span>{/if}
|
|
66
|
+
{/snippet}
|
|
67
|
+
|
|
68
|
+
<div class={['gap-3 py-3 flex items-center', !first && 'border-border border-t', className]}>
|
|
69
|
+
{#if Icon}
|
|
70
|
+
<span class={['h-9 w-9 rounded-xl flex shrink-0 items-center justify-center', TONES[tone]]}>
|
|
71
|
+
<Icon class="h-[18px] w-[18px]" strokeWidth={1.9} />
|
|
72
|
+
</span>
|
|
73
|
+
{/if}
|
|
74
|
+
{#if href}
|
|
75
|
+
<a
|
|
76
|
+
{href}
|
|
77
|
+
class="min-w-0 rounded-lg focus-visible:ring-brand-500/30 flex-1 focus-visible:ring-2 focus-visible:outline-none"
|
|
78
|
+
>{@render body()}</a
|
|
79
|
+
>
|
|
80
|
+
{:else}
|
|
81
|
+
<div class="min-w-0 flex-1">{@render body()}</div>
|
|
82
|
+
{/if}
|
|
83
|
+
{#if actions}<div class="gap-2 flex shrink-0 items-center">{@render actions()}</div>{/if}
|
|
84
|
+
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
export type ActionRowIcon = Component<{
|
|
3
|
+
class?: string;
|
|
4
|
+
size?: number | string;
|
|
5
|
+
strokeWidth?: number | string;
|
|
6
|
+
}>;
|
|
7
|
+
export type ActionRowTone = 'brand' | 'info' | 'warning' | 'danger' | 'neutral';
|
|
8
|
+
interface ActionRowProps {
|
|
9
|
+
title: string;
|
|
10
|
+
/** Small text next to the title (time ago, stars…). */
|
|
11
|
+
meta?: string;
|
|
12
|
+
/** Second line, truncated to one line. */
|
|
13
|
+
description?: string;
|
|
14
|
+
icon?: ActionRowIcon;
|
|
15
|
+
/** Colour of the icon tile: what kind of item this is. */
|
|
16
|
+
tone?: ActionRowTone;
|
|
17
|
+
/** Makes the title area a link (the actions stay independent). */
|
|
18
|
+
href?: string;
|
|
19
|
+
/** Mark as unread / new. */
|
|
20
|
+
unread?: boolean;
|
|
21
|
+
/** Hide the top divider (first row of a list). */
|
|
22
|
+
first?: boolean;
|
|
23
|
+
class?: string;
|
|
24
|
+
/** Inline extra after the title (stars, chips). */
|
|
25
|
+
titleExtra?: Snippet;
|
|
26
|
+
/** Buttons on the right (Responder, Aceptar…). */
|
|
27
|
+
actions?: Snippet;
|
|
28
|
+
}
|
|
29
|
+
declare const ActionRow: Component<ActionRowProps, {}, "">;
|
|
30
|
+
type ActionRow = ReturnType<typeof ActionRow>;
|
|
31
|
+
export default ActionRow;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ActionRow from './ActionRow.svelte';
|
|
3
|
+
import Button from '../../atoms/Button/Button.svelte';
|
|
4
|
+
import { Inbox, CalendarCheck, Star } from '@lucide/svelte';
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="max-w-2xl rounded-2xl border-border bg-surface-elevated px-5 py-2 border">
|
|
8
|
+
<ActionRow
|
|
9
|
+
first
|
|
10
|
+
unread
|
|
11
|
+
title="María G."
|
|
12
|
+
meta="hace 12 min"
|
|
13
|
+
description="Presupuesto: comida de empresa, 25 personas"
|
|
14
|
+
icon={Inbox}
|
|
15
|
+
tone="info"
|
|
16
|
+
>
|
|
17
|
+
{#snippet actions()}<Button size="sm">Responder</Button>{/snippet}
|
|
18
|
+
</ActionRow>
|
|
19
|
+
<ActionRow
|
|
20
|
+
title="Javier L."
|
|
21
|
+
meta="hace 1 h"
|
|
22
|
+
description="Reserva terraza · sáb. 21:30 · 6 personas"
|
|
23
|
+
icon={CalendarCheck}
|
|
24
|
+
>
|
|
25
|
+
{#snippet actions()}<Button size="sm" variant="outline">Rechazar</Button><Button size="sm"
|
|
26
|
+
>Aceptar</Button
|
|
27
|
+
>{/snippet}
|
|
28
|
+
</ActionRow>
|
|
29
|
+
<ActionRow
|
|
30
|
+
title="Ana R."
|
|
31
|
+
meta="ayer"
|
|
32
|
+
description="“Las croquetas de puchero, de lo mejor de Madrid.”"
|
|
33
|
+
icon={Star}
|
|
34
|
+
tone="warning"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ActionRowStory: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ActionRowStory = InstanceType<typeof ActionRowStory>;
|
|
18
|
+
export default ActionRowStory;
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
/** Soft tint behind header / footer chrome (DiffViewer-style). Default true. */
|
|
12
12
|
chrome?: boolean;
|
|
13
13
|
class?: string;
|
|
14
|
+
/** DOM id (anchor links such as #bandeja). */
|
|
15
|
+
id?: string;
|
|
14
16
|
header?: Snippet;
|
|
15
17
|
footer?: Snippet;
|
|
16
18
|
children?: Snippet;
|
|
@@ -23,6 +25,7 @@
|
|
|
23
25
|
hoverable = false,
|
|
24
26
|
chrome = true,
|
|
25
27
|
class: className = '',
|
|
28
|
+
id,
|
|
26
29
|
header,
|
|
27
30
|
footer,
|
|
28
31
|
children,
|
|
@@ -55,6 +58,7 @@
|
|
|
55
58
|
|
|
56
59
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
57
60
|
<div
|
|
61
|
+
{id}
|
|
58
62
|
class={[
|
|
59
63
|
'rounded-2xl flex flex-col overflow-hidden transition-[box-shadow,transform,border-color] duration-200',
|
|
60
64
|
variantClasses[variant],
|
|
@@ -8,6 +8,8 @@ interface CardProps {
|
|
|
8
8
|
/** Soft tint behind header / footer chrome (DiffViewer-style). Default true. */
|
|
9
9
|
chrome?: boolean;
|
|
10
10
|
class?: string;
|
|
11
|
+
/** DOM id (anchor links such as #bandeja). */
|
|
12
|
+
id?: string;
|
|
11
13
|
header?: Snippet;
|
|
12
14
|
footer?: Snippet;
|
|
13
15
|
children?: Snippet;
|
|
@@ -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
|
|
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=
|
|
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=
|
|
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
|
-
|
|
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=
|
|
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=
|
|
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
|
-
|
|
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>;
|