orbital-ds 0.9.0 → 0.10.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.
- package/AGENTS.md +22 -2
- package/components.manifest.json +388 -1
- package/contract.json +5 -0
- package/dist/hooks/use-ds-messages.d.ts +59 -1
- package/dist/hooks/use-ds-messages.js +6 -0
- package/dist/lib/echarts-presets.d.ts +153 -0
- package/dist/lib/echarts-presets.js +311 -0
- package/dist/lib/echarts-server.d.ts +15 -0
- package/dist/lib/echarts-server.js +15 -0
- package/dist/lib/echarts-setup.d.ts +8 -0
- package/dist/lib/echarts-setup.js +68 -0
- package/dist/lib/echarts-theme.d.ts +36 -0
- package/dist/lib/echarts-theme.js +142 -0
- package/dist/lib/i18n.d.ts +57 -1
- package/dist/lib/i18n.js +169 -3
- package/dist/styles.css +43 -5
- package/dist/themes/friendly.css +3 -1
- package/dist/themes/friendly.scoped.css +3 -1
- package/dist/themes/friendly.tokens.json +45 -0
- package/dist/themes/qratia.tokens.json +49 -0
- package/dist/themes/tactile.css +3 -1
- package/dist/themes/tactile.scoped.css +3 -1
- package/dist/themes/tactile.tokens.json +42 -0
- package/dist/themes/twitter.css +3 -1
- package/dist/themes/twitter.scoped.css +3 -1
- package/dist/themes/twitter.tokens.json +45 -0
- package/dist/themes/zyro.css +3 -1
- package/dist/themes/zyro.scoped.css +3 -1
- package/dist/themes/zyro.tokens.json +46 -0
- package/dist/ui/calendar.js +4 -0
- package/dist/ui/code-block.d.ts +14 -0
- package/dist/ui/code-block.js +106 -0
- package/dist/ui/data-table.d.ts +185 -0
- package/dist/ui/data-table.js +714 -0
- package/dist/ui/date-picker.d.ts +65 -0
- package/dist/ui/date-picker.js +362 -0
- package/dist/ui/dropzone.d.ts +42 -0
- package/dist/ui/dropzone.js +220 -0
- package/dist/ui/echart.d.ts +31 -0
- package/dist/ui/echart.js +88 -0
- package/dist/ui/eyebrow.d.ts +7 -0
- package/dist/ui/eyebrow.js +16 -0
- package/dist/ui/filter-bar.d.ts +36 -0
- package/dist/ui/filter-bar.js +193 -0
- package/dist/ui/heatmap-grid.d.ts +39 -0
- package/dist/ui/heatmap-grid.js +195 -0
- package/dist/ui/i18n-provider.js +3 -3
- package/dist/ui/legend.d.ts +30 -0
- package/dist/ui/legend.js +124 -0
- package/dist/ui/notifications.d.ts +69 -0
- package/dist/ui/notifications.js +335 -0
- package/dist/ui/page-header.d.ts +19 -0
- package/dist/ui/page-header.js +132 -0
- package/dist/ui/panel.d.ts +12 -0
- package/dist/ui/panel.js +41 -0
- package/dist/ui/proportion-bar.d.ts +27 -0
- package/dist/ui/proportion-bar.js +92 -0
- package/dist/ui/sparkline.d.ts +26 -0
- package/dist/ui/sparkline.js +97 -0
- package/dist/ui/stat.d.ts +61 -0
- package/dist/ui/stat.js +238 -0
- package/dist/ui/status-badge.d.ts +38 -0
- package/dist/ui/status-badge.js +153 -0
- package/dist/ui/stepper.d.ts +20 -0
- package/dist/ui/stepper.js +152 -0
- package/dist/ui/timeline.d.ts +29 -0
- package/dist/ui/timeline.js +157 -0
- package/docs/GRAFICOS.md +125 -0
- package/docs/adr/0001-rtl-clases-logicas.md +78 -0
- package/package.json +17 -4
- package/scripts/init.mjs +1 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
const dataToneBg = {
|
|
5
|
+
primary: "bg-primary",
|
|
6
|
+
info: "bg-info",
|
|
7
|
+
success: "bg-success",
|
|
8
|
+
warning: "bg-warning",
|
|
9
|
+
danger: "bg-danger",
|
|
10
|
+
neutral: "bg-neutral",
|
|
11
|
+
"chart-1": "bg-chart-1",
|
|
12
|
+
"chart-2": "bg-chart-2",
|
|
13
|
+
"chart-3": "bg-chart-3",
|
|
14
|
+
"chart-4": "bg-chart-4",
|
|
15
|
+
"chart-5": "bg-chart-5"
|
|
16
|
+
};
|
|
17
|
+
const dataToneVar = {
|
|
18
|
+
primary: "var(--primary)",
|
|
19
|
+
info: "var(--info)",
|
|
20
|
+
success: "var(--success)",
|
|
21
|
+
warning: "var(--warning)",
|
|
22
|
+
danger: "var(--danger)",
|
|
23
|
+
neutral: "var(--neutral)",
|
|
24
|
+
"chart-1": "var(--chart-1)",
|
|
25
|
+
"chart-2": "var(--chart-2)",
|
|
26
|
+
"chart-3": "var(--chart-3)",
|
|
27
|
+
"chart-4": "var(--chart-4)",
|
|
28
|
+
"chart-5": "var(--chart-5)"
|
|
29
|
+
};
|
|
30
|
+
function Legend({
|
|
31
|
+
className,
|
|
32
|
+
orientation = "horizontal",
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"ul",
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "legend",
|
|
39
|
+
"data-orientation": orientation,
|
|
40
|
+
className: cn(
|
|
41
|
+
"flex min-w-0 text-sm",
|
|
42
|
+
orientation === "horizontal" ? "flex-row flex-wrap items-center gap-x-4 gap-y-1" : "flex-col gap-1",
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function LegendSwatch({
|
|
50
|
+
className,
|
|
51
|
+
tone = "chart-1",
|
|
52
|
+
color,
|
|
53
|
+
shape = "square",
|
|
54
|
+
style,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "legend-swatch",
|
|
61
|
+
"data-shape": shape,
|
|
62
|
+
"data-tone": color ? void 0 : tone,
|
|
63
|
+
"aria-hidden": true,
|
|
64
|
+
className: cn(
|
|
65
|
+
"inline-block shrink-0",
|
|
66
|
+
!color && dataToneBg[tone],
|
|
67
|
+
shape === "square" && "size-(--ds-legend-swatch) rounded-xs",
|
|
68
|
+
shape === "circle" && "size-(--ds-legend-swatch) rounded-(--ds-radius-pill)",
|
|
69
|
+
shape === "line" && "h-0.5 w-(--ds-legend-swatch) rounded-(--ds-radius-pill)",
|
|
70
|
+
className
|
|
71
|
+
),
|
|
72
|
+
style: color ? { backgroundColor: color, ...style } : style,
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function LegendItem({
|
|
78
|
+
className,
|
|
79
|
+
tone = "chart-1",
|
|
80
|
+
color,
|
|
81
|
+
shape,
|
|
82
|
+
value,
|
|
83
|
+
active = true,
|
|
84
|
+
onToggle,
|
|
85
|
+
children,
|
|
86
|
+
...props
|
|
87
|
+
}) {
|
|
88
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(LegendSwatch, { tone, color, shape }),
|
|
90
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "legend-label", className: "min-w-0 truncate text-muted-foreground", children }),
|
|
91
|
+
value != null && /* @__PURE__ */ jsx("span", { "data-slot": "legend-value", className: "ms-auto ps-2 font-medium text-foreground tabular-nums", children: value })
|
|
92
|
+
] });
|
|
93
|
+
return /* @__PURE__ */ jsx(
|
|
94
|
+
"li",
|
|
95
|
+
{
|
|
96
|
+
"data-slot": "legend-item",
|
|
97
|
+
"data-state": active ? "active" : "inactive",
|
|
98
|
+
"data-tone": color ? void 0 : tone,
|
|
99
|
+
className: cn("flex min-w-0 items-center", className),
|
|
100
|
+
...props,
|
|
101
|
+
children: onToggle ? /* @__PURE__ */ jsx(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
"data-slot": "legend-toggle",
|
|
106
|
+
"aria-pressed": active,
|
|
107
|
+
onClick: () => onToggle(!active),
|
|
108
|
+
className: cn(
|
|
109
|
+
"-mx-1 flex min-w-0 flex-1 items-center gap-2 rounded-xs px-1 outline-hidden transition-opacity duration-(--ds-motion-fast) hover:bg-muted focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) motion-reduce:transition-none",
|
|
110
|
+
!active && "opacity-(--ds-disabled-opacity) [&_[data-slot=legend-label]]:line-through"
|
|
111
|
+
),
|
|
112
|
+
children: content
|
|
113
|
+
}
|
|
114
|
+
) : /* @__PURE__ */ jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: content })
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
Legend,
|
|
120
|
+
LegendItem,
|
|
121
|
+
LegendSwatch,
|
|
122
|
+
dataToneBg,
|
|
123
|
+
dataToneVar
|
|
124
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Tabs, TabsContent } from './tabs.js';
|
|
3
|
+
import 'class-variance-authority/types';
|
|
4
|
+
import '@base-ui/react/tabs';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
type NotificationTone = "info" | "success" | "warning" | "danger" | "neutral";
|
|
8
|
+
type NotificationState = "new" | "acknowledged" | "resolved" | (string & {});
|
|
9
|
+
type NotificationTab = "for-you" | "general" | "history";
|
|
10
|
+
declare function NotificationCenter({ unreadCount, onMarkAllRead, title, open, defaultOpen, onOpenChange, align, className, triggerClassName, children, }: {
|
|
11
|
+
/** Avisos sin leer: contador de la campana y nombre accesible. */
|
|
12
|
+
unreadCount?: number;
|
|
13
|
+
/** Si se pasa, la cabecera muestra «Marcar todo como leído». */
|
|
14
|
+
onMarkAllRead?: () => void;
|
|
15
|
+
/** Título del panel; por defecto, «Notificaciones». */
|
|
16
|
+
title?: React.ReactNode;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
align?: "start" | "center" | "end";
|
|
21
|
+
/** Clases del panel. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Clases del botón campana. */
|
|
24
|
+
triggerClassName?: string;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare function NotificationTabs({ className, counts, defaultValue, children, ...props }: Omit<React.ComponentProps<typeof Tabs>, "defaultValue"> & {
|
|
28
|
+
/** Contadores de cada pestaña (se omiten los que no se pasan o valen 0). */
|
|
29
|
+
counts?: {
|
|
30
|
+
forYou?: number;
|
|
31
|
+
general?: number;
|
|
32
|
+
history?: number;
|
|
33
|
+
};
|
|
34
|
+
defaultValue?: NotificationTab;
|
|
35
|
+
}): React.JSX.Element;
|
|
36
|
+
declare function NotificationTabsContent({ value, ...props }: Omit<React.ComponentProps<typeof TabsContent>, "value"> & {
|
|
37
|
+
value: NotificationTab;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
declare function NotificationList({ className, children, empty, ...props }: React.ComponentProps<"ul"> & {
|
|
40
|
+
/** Qué pintar sin avisos; por defecto, `<NotificationEmpty />`. */
|
|
41
|
+
empty?: React.ReactNode;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
/** Tiempo relativo («hace 5 minutos», «ayer») en el idioma activo. */
|
|
44
|
+
declare function formatRelativeTime(date: Date, locale: string, now?: number): string;
|
|
45
|
+
declare function NotificationItem({ className, unread, tone, icon, title, description, time, now, state, meta, actions, children, ...props }: Omit<React.ComponentProps<"li">, "title"> & {
|
|
46
|
+
/** Sin leer: punto de marca y fondo resaltado. */
|
|
47
|
+
unread?: boolean;
|
|
48
|
+
/** Tono de estado: colorea la baldosa del icono. */
|
|
49
|
+
tone?: NotificationTone;
|
|
50
|
+
/** Icono (Lucide) dentro de una baldosa del tono; o un nodo propio. */
|
|
51
|
+
icon?: React.ReactNode;
|
|
52
|
+
title: React.ReactNode;
|
|
53
|
+
description?: React.ReactNode;
|
|
54
|
+
/** Momento del aviso: se muestra en tiempo relativo. */
|
|
55
|
+
time?: Date | number | string;
|
|
56
|
+
/** «Ahora» para el tiempo relativo (pruebas, SSR). */
|
|
57
|
+
now?: number;
|
|
58
|
+
/** Estado del aviso (new | acknowledged | resolved…): va a `data-state`. */
|
|
59
|
+
state?: NotificationState;
|
|
60
|
+
/** Etiquetas junto a la hora (p. ej. un Badge con el estado). */
|
|
61
|
+
meta?: React.ReactNode;
|
|
62
|
+
/** Acciones del aviso (botones «Útil», «Ruido», «Investigar»…). */
|
|
63
|
+
actions?: React.ReactNode;
|
|
64
|
+
}): React.JSX.Element;
|
|
65
|
+
declare function NotificationEmpty({ className, children, icon, ...props }: React.ComponentProps<"div"> & {
|
|
66
|
+
icon?: React.ReactNode;
|
|
67
|
+
}): React.JSX.Element;
|
|
68
|
+
|
|
69
|
+
export { NotificationCenter, NotificationEmpty, NotificationItem, NotificationList, type NotificationState, type NotificationTab, NotificationTabs, NotificationTabsContent, type NotificationTone, formatRelativeTime };
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { BellIcon, BellOffIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useDsLocale, useDsMessages } from "../hooks/use-ds-messages";
|
|
6
|
+
import { dsFormat } from "../lib/i18n";
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
import { Badge } from "./badge";
|
|
9
|
+
import { Button } from "./button";
|
|
10
|
+
import { IconTile } from "./icon-tile";
|
|
11
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
12
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs";
|
|
13
|
+
function NotificationCenter({
|
|
14
|
+
unreadCount = 0,
|
|
15
|
+
onMarkAllRead,
|
|
16
|
+
title,
|
|
17
|
+
open,
|
|
18
|
+
defaultOpen,
|
|
19
|
+
onOpenChange,
|
|
20
|
+
align = "end",
|
|
21
|
+
className,
|
|
22
|
+
triggerClassName,
|
|
23
|
+
children
|
|
24
|
+
}) {
|
|
25
|
+
const t = useDsMessages();
|
|
26
|
+
const unreadText = dsFormat(t.notificationsUnread, { n: unreadCount });
|
|
27
|
+
const label = unreadCount > 0 ? `${t.notifications}, ${unreadText}` : t.notifications;
|
|
28
|
+
return /* @__PURE__ */ jsxs(
|
|
29
|
+
Popover,
|
|
30
|
+
{
|
|
31
|
+
open,
|
|
32
|
+
defaultOpen,
|
|
33
|
+
onOpenChange: onOpenChange ? (o) => onOpenChange(o) : void 0,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(
|
|
36
|
+
PopoverTrigger,
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "notification-trigger",
|
|
39
|
+
render: /* @__PURE__ */ jsx(
|
|
40
|
+
Button,
|
|
41
|
+
{
|
|
42
|
+
variant: "ghost",
|
|
43
|
+
size: "icon",
|
|
44
|
+
"aria-label": label,
|
|
45
|
+
className: cn("relative", triggerClassName)
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx(BellIcon, {}),
|
|
50
|
+
unreadCount > 0 ? /* @__PURE__ */ jsx(
|
|
51
|
+
Badge,
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "notification-count",
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
className: "pointer-events-none absolute -top-1 -end-1 min-w-5 justify-center px-1 py-0 tabular-nums",
|
|
56
|
+
children: unreadCount > 99 ? "99+" : unreadCount
|
|
57
|
+
}
|
|
58
|
+
) : null
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsxs(
|
|
63
|
+
PopoverContent,
|
|
64
|
+
{
|
|
65
|
+
"data-slot": "notification-center",
|
|
66
|
+
align,
|
|
67
|
+
"aria-label": t.notifications,
|
|
68
|
+
className: cn(
|
|
69
|
+
"w-(--ds-notifications-w) max-w-(--available-width) gap-0 p-0",
|
|
70
|
+
className
|
|
71
|
+
),
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsxs(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
"data-slot": "notification-header",
|
|
77
|
+
className: "flex items-center justify-between gap-2 border-b border-border px-(--ds-popover-p) py-3",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"h2",
|
|
82
|
+
{
|
|
83
|
+
"data-slot": "notification-title",
|
|
84
|
+
className: "truncate text-base font-(--ds-overlay-title-weight)",
|
|
85
|
+
children: title ?? t.notifications
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
unreadCount > 0 ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", "data-slot": "notification-unread", children: unreadText }) : null
|
|
89
|
+
] }),
|
|
90
|
+
onMarkAllRead ? /* @__PURE__ */ jsx(
|
|
91
|
+
Button,
|
|
92
|
+
{
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
size: "xs",
|
|
95
|
+
disabled: unreadCount === 0,
|
|
96
|
+
onClick: onMarkAllRead,
|
|
97
|
+
"data-slot": "notification-mark-all",
|
|
98
|
+
children: t.notificationsMarkAllRead
|
|
99
|
+
}
|
|
100
|
+
) : null
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
children
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function NotificationTabs({
|
|
113
|
+
className,
|
|
114
|
+
counts,
|
|
115
|
+
defaultValue = "for-you",
|
|
116
|
+
children,
|
|
117
|
+
...props
|
|
118
|
+
}) {
|
|
119
|
+
const t = useDsMessages();
|
|
120
|
+
const tabs = [
|
|
121
|
+
{ value: "for-you", label: t.notificationsForYou, count: counts?.forYou },
|
|
122
|
+
{ value: "general", label: t.notificationsGeneral, count: counts?.general },
|
|
123
|
+
{ value: "history", label: t.notificationsHistory, count: counts?.history }
|
|
124
|
+
];
|
|
125
|
+
return /* @__PURE__ */ jsxs(
|
|
126
|
+
Tabs,
|
|
127
|
+
{
|
|
128
|
+
"data-slot": "notification-tabs",
|
|
129
|
+
defaultValue,
|
|
130
|
+
className: cn("gap-0", className),
|
|
131
|
+
...props,
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-border px-(--ds-popover-p) py-2", children: /* @__PURE__ */ jsx(TabsList, { variant: "line", className: "w-full justify-start", children: tabs.map((tab) => /* @__PURE__ */ jsxs(
|
|
134
|
+
TabsTrigger,
|
|
135
|
+
{
|
|
136
|
+
value: tab.value,
|
|
137
|
+
"data-slot": "notification-tab",
|
|
138
|
+
className: "flex-none",
|
|
139
|
+
children: [
|
|
140
|
+
tab.label,
|
|
141
|
+
tab.count ? /* @__PURE__ */ jsx(
|
|
142
|
+
Badge,
|
|
143
|
+
{
|
|
144
|
+
variant: "secondary",
|
|
145
|
+
"data-slot": "notification-tab-count",
|
|
146
|
+
className: "tabular-nums",
|
|
147
|
+
children: tab.count
|
|
148
|
+
}
|
|
149
|
+
) : null
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
tab.value
|
|
153
|
+
)) }) }),
|
|
154
|
+
children
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
function NotificationTabsContent({
|
|
160
|
+
value,
|
|
161
|
+
...props
|
|
162
|
+
}) {
|
|
163
|
+
return /* @__PURE__ */ jsx(TabsContent, { "data-slot": "notification-tabs-content", value, ...props });
|
|
164
|
+
}
|
|
165
|
+
function NotificationList({
|
|
166
|
+
className,
|
|
167
|
+
children,
|
|
168
|
+
empty,
|
|
169
|
+
...props
|
|
170
|
+
}) {
|
|
171
|
+
const hasItems = React.Children.toArray(children).length > 0;
|
|
172
|
+
if (!hasItems) return /* @__PURE__ */ jsx(Fragment, { children: empty ?? /* @__PURE__ */ jsx(NotificationEmpty, {}) });
|
|
173
|
+
return /* @__PURE__ */ jsx(
|
|
174
|
+
"ul",
|
|
175
|
+
{
|
|
176
|
+
"data-slot": "notification-list",
|
|
177
|
+
className: cn(
|
|
178
|
+
"flex max-h-(--ds-notifications-max-h) flex-col overflow-y-auto",
|
|
179
|
+
className
|
|
180
|
+
),
|
|
181
|
+
...props,
|
|
182
|
+
children
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
function formatRelativeTime(date, locale, now = Date.now()) {
|
|
187
|
+
const diff = (date.getTime() - now) / 1e3;
|
|
188
|
+
const steps = [
|
|
189
|
+
["second", 60],
|
|
190
|
+
["minute", 60],
|
|
191
|
+
["hour", 24],
|
|
192
|
+
["day", 7],
|
|
193
|
+
["week", 4.34524],
|
|
194
|
+
["month", 12],
|
|
195
|
+
["year", Number.POSITIVE_INFINITY]
|
|
196
|
+
];
|
|
197
|
+
let value = diff;
|
|
198
|
+
for (const [unit, size] of steps) {
|
|
199
|
+
if (Math.abs(value) < size) {
|
|
200
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(
|
|
201
|
+
Math.round(value),
|
|
202
|
+
unit
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
value /= size;
|
|
206
|
+
}
|
|
207
|
+
return "";
|
|
208
|
+
}
|
|
209
|
+
function NotificationItem({
|
|
210
|
+
className,
|
|
211
|
+
unread = false,
|
|
212
|
+
tone = "neutral",
|
|
213
|
+
icon,
|
|
214
|
+
title,
|
|
215
|
+
description,
|
|
216
|
+
time,
|
|
217
|
+
now,
|
|
218
|
+
state,
|
|
219
|
+
meta,
|
|
220
|
+
actions,
|
|
221
|
+
children,
|
|
222
|
+
...props
|
|
223
|
+
}) {
|
|
224
|
+
const t = useDsMessages();
|
|
225
|
+
const locale = useDsLocale();
|
|
226
|
+
const date = time != null ? new Date(time) : null;
|
|
227
|
+
const valid = date && !Number.isNaN(date.getTime());
|
|
228
|
+
return /* @__PURE__ */ jsxs(
|
|
229
|
+
"li",
|
|
230
|
+
{
|
|
231
|
+
"data-slot": "notification-item",
|
|
232
|
+
"data-state": state,
|
|
233
|
+
"data-unread": unread || void 0,
|
|
234
|
+
"data-tone": tone,
|
|
235
|
+
className: cn(
|
|
236
|
+
"group/notification relative flex gap-3 border-b border-border px-(--ds-popover-p) py-3 text-start last:border-b-0 data-unread:bg-(--ds-row-hover)",
|
|
237
|
+
className
|
|
238
|
+
),
|
|
239
|
+
...props,
|
|
240
|
+
children: [
|
|
241
|
+
icon ? React.isValidElement(icon) && icon.props["data-slot"] === "icon-tile" ? icon : /* @__PURE__ */ jsx(IconTile, { "data-slot": "notification-icon", tone, size: "sm", children: icon }) : null,
|
|
242
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
243
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
244
|
+
/* @__PURE__ */ jsx(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
"data-slot": "notification-item-title",
|
|
248
|
+
className: "min-w-0 flex-1 text-sm font-(--ds-label-weight) text-foreground group-data-[state=resolved]/notification:text-muted-foreground",
|
|
249
|
+
children: title
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
unread ? /* @__PURE__ */ jsx(
|
|
253
|
+
"span",
|
|
254
|
+
{
|
|
255
|
+
"data-slot": "notification-dot",
|
|
256
|
+
className: "mt-1.5 size-(--ds-status-dot) shrink-0 rounded-full bg-primary",
|
|
257
|
+
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: t.notificationUnread })
|
|
258
|
+
}
|
|
259
|
+
) : null
|
|
260
|
+
] }),
|
|
261
|
+
description ? /* @__PURE__ */ jsx(
|
|
262
|
+
"div",
|
|
263
|
+
{
|
|
264
|
+
"data-slot": "notification-item-description",
|
|
265
|
+
className: "text-sm text-muted-foreground",
|
|
266
|
+
children: description
|
|
267
|
+
}
|
|
268
|
+
) : null,
|
|
269
|
+
valid || meta ? /* @__PURE__ */ jsxs(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
"data-slot": "notification-meta",
|
|
273
|
+
className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground",
|
|
274
|
+
children: [
|
|
275
|
+
valid && date ? /* @__PURE__ */ jsx(
|
|
276
|
+
"time",
|
|
277
|
+
{
|
|
278
|
+
dateTime: date.toISOString(),
|
|
279
|
+
title: new Intl.DateTimeFormat(locale, {
|
|
280
|
+
dateStyle: "medium",
|
|
281
|
+
timeStyle: "short"
|
|
282
|
+
}).format(date),
|
|
283
|
+
children: formatRelativeTime(date, locale, now)
|
|
284
|
+
}
|
|
285
|
+
) : null,
|
|
286
|
+
meta
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
) : null,
|
|
290
|
+
children,
|
|
291
|
+
actions ? /* @__PURE__ */ jsx(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
"data-slot": "notification-actions",
|
|
295
|
+
className: "mt-1 flex flex-wrap items-center gap-2",
|
|
296
|
+
children: actions
|
|
297
|
+
}
|
|
298
|
+
) : null
|
|
299
|
+
] })
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
function NotificationEmpty({
|
|
305
|
+
className,
|
|
306
|
+
children,
|
|
307
|
+
icon,
|
|
308
|
+
...props
|
|
309
|
+
}) {
|
|
310
|
+
const t = useDsMessages();
|
|
311
|
+
return /* @__PURE__ */ jsxs(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
"data-slot": "notification-empty",
|
|
315
|
+
className: cn(
|
|
316
|
+
"flex flex-col items-center justify-center gap-3 px-(--ds-popover-p) py-8 text-center text-sm text-muted-foreground",
|
|
317
|
+
className
|
|
318
|
+
),
|
|
319
|
+
...props,
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ jsx(IconTile, { tone: "neutral", size: "md", children: icon ?? /* @__PURE__ */ jsx(BellOffIcon, {}) }),
|
|
322
|
+
/* @__PURE__ */ jsx("p", { children: children ?? t.notificationsEmpty })
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
export {
|
|
328
|
+
NotificationCenter,
|
|
329
|
+
NotificationEmpty,
|
|
330
|
+
NotificationItem,
|
|
331
|
+
NotificationList,
|
|
332
|
+
NotificationTabs,
|
|
333
|
+
NotificationTabsContent,
|
|
334
|
+
formatRelativeTime
|
|
335
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IconTile } from './icon-tile.js';
|
|
3
|
+
import 'class-variance-authority/types';
|
|
4
|
+
import 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare function PageHeader({ className, ...props }: React.ComponentProps<"header">): React.JSX.Element;
|
|
7
|
+
declare function PageHeaderBreadcrumb({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function PageHeaderTitle({ className, ...props }: React.ComponentProps<"h1">): React.JSX.Element;
|
|
9
|
+
declare function PageHeaderDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
10
|
+
declare function PageHeaderActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
/** Hueco para avisos de la página (Banner, Alert) bajo la cabecera. */
|
|
12
|
+
declare function PageHeaderNotice({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare function SectionHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function SectionHeaderIcon({ className, size, ...props }: React.ComponentProps<typeof IconTile>): React.JSX.Element;
|
|
15
|
+
declare function SectionHeaderTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
16
|
+
declare function SectionHeaderDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
17
|
+
declare function SectionHeaderActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { PageHeader, PageHeaderActions, PageHeaderBreadcrumb, PageHeaderDescription, PageHeaderNotice, PageHeaderTitle, SectionHeader, SectionHeaderActions, SectionHeaderDescription, SectionHeaderIcon, SectionHeaderTitle };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
import { IconTile } from "./icon-tile";
|
|
4
|
+
function PageHeader({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"header",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "page-header",
|
|
9
|
+
className: cn(
|
|
10
|
+
"group/page-header @container/page-header mx-auto mb-(--ds-page-gap) grid w-full max-w-(--ds-page-max-w) grid-cols-1 gap-x-(--ds-page-gap) gap-y-0 [grid-template-areas:'breadcrumb'_'title'_'description'_'actions'_'notice'] @2xl/page-header:grid-cols-[minmax(0,1fr)_auto] @2xl/page-header:[grid-template-areas:'breadcrumb_breadcrumb'_'title_actions'_'description_actions'_'notice_notice']",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function PageHeaderBreadcrumb({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "page-header-breadcrumb", className: cn("mb-2 min-w-0 [grid-area:breadcrumb]", className), ...props });
|
|
19
|
+
}
|
|
20
|
+
function PageHeaderTitle({ className, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"h1",
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "page-header-title",
|
|
25
|
+
className: cn(
|
|
26
|
+
"min-w-0 text-2xl leading-tight font-(--ds-heading-weight) text-foreground [grid-area:title] @2xl/page-header:text-3xl",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function PageHeaderDescription({ className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"p",
|
|
36
|
+
{
|
|
37
|
+
"data-slot": "page-header-description",
|
|
38
|
+
className: cn("mt-1.5 max-w-prose min-w-0 text-sm text-pretty text-muted-foreground [grid-area:description]", className),
|
|
39
|
+
...props
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function PageHeaderActions({ className, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "page-header-actions",
|
|
48
|
+
className: cn(
|
|
49
|
+
"mt-2 flex flex-wrap items-center gap-2 [grid-area:actions] @2xl/page-header:mt-0 @2xl/page-header:justify-end @2xl/page-header:self-start",
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
...props
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function PageHeaderNotice({ className, ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "page-header-notice",
|
|
61
|
+
className: cn("mt-(--ds-section-gap) flex min-w-0 flex-col gap-2 [grid-area:notice]", className),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function SectionHeader({ className, ...props }) {
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
"data-slot": "section-header",
|
|
71
|
+
className: cn(
|
|
72
|
+
"group/section-header @container/section-header mb-(--ds-section-gap) grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-0 [grid-template-areas:'title_actions'_'description_actions'] has-data-[slot=section-header-icon]:grid-cols-[auto_minmax(0,1fr)_auto] has-data-[slot=section-header-icon]:[grid-template-areas:'icon_title_actions'_'icon_description_actions']",
|
|
73
|
+
className
|
|
74
|
+
),
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function SectionHeaderIcon({ className, size = "sm", ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
IconTile,
|
|
82
|
+
{
|
|
83
|
+
size,
|
|
84
|
+
"data-slot": "section-header-icon",
|
|
85
|
+
className: cn("self-center [grid-area:icon]", className),
|
|
86
|
+
...props
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
function SectionHeaderTitle({ className, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"h2",
|
|
93
|
+
{
|
|
94
|
+
"data-slot": "section-header-title",
|
|
95
|
+
className: cn("min-w-0 text-lg leading-tight font-(--ds-heading-weight) text-foreground [grid-area:title]", className),
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function SectionHeaderDescription({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx(
|
|
102
|
+
"p",
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "section-header-description",
|
|
105
|
+
className: cn("mt-0.5 min-w-0 text-sm text-muted-foreground [grid-area:description]", className),
|
|
106
|
+
...props
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function SectionHeaderActions({ className, ...props }) {
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
"data-slot": "section-header-actions",
|
|
115
|
+
className: cn("flex flex-wrap items-center justify-end gap-2 [grid-area:actions]", className),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
PageHeader,
|
|
122
|
+
PageHeaderActions,
|
|
123
|
+
PageHeaderBreadcrumb,
|
|
124
|
+
PageHeaderDescription,
|
|
125
|
+
PageHeaderNotice,
|
|
126
|
+
PageHeaderTitle,
|
|
127
|
+
SectionHeader,
|
|
128
|
+
SectionHeaderActions,
|
|
129
|
+
SectionHeaderDescription,
|
|
130
|
+
SectionHeaderIcon,
|
|
131
|
+
SectionHeaderTitle
|
|
132
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const panelVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "ghost" | "muted" | null | undefined;
|
|
8
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare function Panel({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof panelVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
11
|
+
|
|
12
|
+
export { Panel, panelVariants };
|