@sereno-ds/ui 0.24.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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/_internal/CharCount.d.ts +9 -0
- package/dist/_internal/CharCount.js +25 -0
- package/dist/_internal/CharCount.js.map +1 -0
- package/dist/_internal/Field.d.ts +17 -0
- package/dist/_internal/Field.js +55 -0
- package/dist/_internal/Field.js.map +1 -0
- package/dist/_internal/mask.d.ts +12 -0
- package/dist/_internal/mask.js +56 -0
- package/dist/_internal/mask.js.map +1 -0
- package/dist/_internal/style.d.ts +12 -0
- package/dist/_internal/style.js +5 -0
- package/dist/_internal/style.js.map +1 -0
- package/dist/core/Avatar.d.ts +14 -0
- package/dist/core/Avatar.js +62 -0
- package/dist/core/Avatar.js.map +1 -0
- package/dist/core/Badge.d.ts +16 -0
- package/dist/core/Badge.js +49 -0
- package/dist/core/Badge.js.map +1 -0
- package/dist/core/Brand.d.ts +18 -0
- package/dist/core/Brand.js +58 -0
- package/dist/core/Brand.js.map +1 -0
- package/dist/core/Button.d.ts +31 -0
- package/dist/core/Button.js +100 -0
- package/dist/core/Button.js.map +1 -0
- package/dist/core/Card.d.ts +15 -0
- package/dist/core/Card.js +34 -0
- package/dist/core/Card.js.map +1 -0
- package/dist/core/IconButton.d.ts +18 -0
- package/dist/core/IconButton.js +64 -0
- package/dist/core/IconButton.js.map +1 -0
- package/dist/core/Menu.d.ts +69 -0
- package/dist/core/Menu.js +278 -0
- package/dist/core/Menu.js.map +1 -0
- package/dist/core/Table.d.ts +92 -0
- package/dist/core/Table.js +162 -0
- package/dist/core/Table.js.map +1 -0
- package/dist/feedback/Alert.d.ts +27 -0
- package/dist/feedback/Alert.js +68 -0
- package/dist/feedback/Alert.js.map +1 -0
- package/dist/feedback/Dialog.d.ts +36 -0
- package/dist/feedback/Dialog.js +218 -0
- package/dist/feedback/Dialog.js.map +1 -0
- package/dist/feedback/EmptyState.d.ts +13 -0
- package/dist/feedback/EmptyState.js +70 -0
- package/dist/feedback/EmptyState.js.map +1 -0
- package/dist/feedback/Skeleton.d.ts +23 -0
- package/dist/feedback/Skeleton.js +44 -0
- package/dist/feedback/Skeleton.js.map +1 -0
- package/dist/feedback/Toast.d.ts +23 -0
- package/dist/feedback/Toast.js +85 -0
- package/dist/feedback/Toast.js.map +1 -0
- package/dist/feedback/ToastProvider.d.ts +69 -0
- package/dist/feedback/ToastProvider.js +183 -0
- package/dist/feedback/ToastProvider.js.map +1 -0
- package/dist/forms/AvatarUpload.d.ts +57 -0
- package/dist/forms/AvatarUpload.js +579 -0
- package/dist/forms/AvatarUpload.js.map +1 -0
- package/dist/forms/Checkbox.d.ts +15 -0
- package/dist/forms/Checkbox.js +57 -0
- package/dist/forms/Checkbox.js.map +1 -0
- package/dist/forms/DateTimePicker.d.ts +43 -0
- package/dist/forms/DateTimePicker.js +391 -0
- package/dist/forms/DateTimePicker.js.map +1 -0
- package/dist/forms/FileUpload.d.ts +39 -0
- package/dist/forms/FileUpload.js +376 -0
- package/dist/forms/FileUpload.js.map +1 -0
- package/dist/forms/Input.d.ts +35 -0
- package/dist/forms/Input.js +143 -0
- package/dist/forms/Input.js.map +1 -0
- package/dist/forms/Radio.d.ts +18 -0
- package/dist/forms/Radio.js +50 -0
- package/dist/forms/Radio.js.map +1 -0
- package/dist/forms/SearchInput.d.ts +23 -0
- package/dist/forms/SearchInput.js +70 -0
- package/dist/forms/SearchInput.js.map +1 -0
- package/dist/forms/Select.d.ts +40 -0
- package/dist/forms/Select.js +524 -0
- package/dist/forms/Select.js.map +1 -0
- package/dist/forms/Switch.d.ts +20 -0
- package/dist/forms/Switch.js +76 -0
- package/dist/forms/Switch.js.map +1 -0
- package/dist/forms/Textarea.d.ts +19 -0
- package/dist/forms/Textarea.js +65 -0
- package/dist/forms/Textarea.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation/BottomNav.d.ts +17 -0
- package/dist/navigation/BottomNav.js +72 -0
- package/dist/navigation/BottomNav.js.map +1 -0
- package/dist/navigation/SidebarNav.d.ts +53 -0
- package/dist/navigation/SidebarNav.js +594 -0
- package/dist/navigation/SidebarNav.js.map +1 -0
- package/dist/navigation/Stepper.d.ts +33 -0
- package/dist/navigation/Stepper.js +87 -0
- package/dist/navigation/Stepper.js.map +1 -0
- package/dist/navigation/Tabs.d.ts +23 -0
- package/dist/navigation/Tabs.js +174 -0
- package/dist/navigation/Tabs.js.map +1 -0
- package/dist/navigation/TopBar.d.ts +17 -0
- package/dist/navigation/TopBar.js +65 -0
- package/dist/navigation/TopBar.js.map +1 -0
- package/dist/styles.css +258 -0
- package/dist/theme/ThemeProvider.d.ts +12 -0
- package/dist/theme/ThemeProvider.js +10 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/ThemeToggle.d.ts +14 -0
- package/dist/theme/ThemeToggle.js +25 -0
- package/dist/theme/ThemeToggle.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { sx } from "../_internal/style";
|
|
5
|
+
const TONES = {
|
|
6
|
+
info: ["--status-info-bg", "--status-info-fg"],
|
|
7
|
+
success: ["--status-success-bg", "--status-success-fg"],
|
|
8
|
+
warning: ["--status-warning-bg", "--status-warning-fg"],
|
|
9
|
+
error: ["--status-error-bg", "--status-error-fg"]
|
|
10
|
+
};
|
|
11
|
+
function Alert({ tone = "info", title, children, icon, action, onDismiss, style, ...rest }) {
|
|
12
|
+
const [bg, fg] = TONES[tone] || TONES.info;
|
|
13
|
+
return /* @__PURE__ */ jsxs(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
role: tone === "error" ? "alert" : "status",
|
|
17
|
+
...rest,
|
|
18
|
+
style: sx({
|
|
19
|
+
display: "flex",
|
|
20
|
+
gap: "var(--space-3)",
|
|
21
|
+
alignItems: "flex-start",
|
|
22
|
+
padding: "var(--space-3) var(--space-4)",
|
|
23
|
+
borderRadius: "var(--radius-card)",
|
|
24
|
+
background: "var(" + bg + ")",
|
|
25
|
+
color: "var(" + fg + ")",
|
|
26
|
+
border: "var(--border-width-hairline) solid color-mix(in srgb,currentColor 20%,transparent)",
|
|
27
|
+
...style
|
|
28
|
+
}),
|
|
29
|
+
children: [
|
|
30
|
+
icon && /* @__PURE__ */ jsx("span", { style: sx({ display: "flex", flex: "0 0 auto", marginTop: 1 }), children: icon }),
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { style: sx({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 2 }), children: [
|
|
32
|
+
title && /* @__PURE__ */ jsx("span", { style: sx({ fontFamily: "var(--font-body)", fontSize: "var(--text-sm)", fontWeight: "var(--weight-semibold)" }), children: title }),
|
|
33
|
+
children && /* @__PURE__ */ jsx("span", { style: sx({ fontFamily: "var(--font-body)", fontSize: "var(--text-xs)", lineHeight: 1.5, opacity: 0.9 }), children }),
|
|
34
|
+
action && /* @__PURE__ */ jsx("span", { style: sx({ display: "flex", gap: "var(--space-2)", marginTop: "var(--space-2)" }), children: action })
|
|
35
|
+
] }),
|
|
36
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
type: "button",
|
|
40
|
+
onClick: onDismiss,
|
|
41
|
+
"aria-label": "Dispensar",
|
|
42
|
+
className: "sereno-dismiss",
|
|
43
|
+
style: sx({
|
|
44
|
+
flex: "0 0 auto",
|
|
45
|
+
display: "inline-flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
width: 28,
|
|
49
|
+
height: 28,
|
|
50
|
+
margin: "-3px -5px 0 0",
|
|
51
|
+
border: "none",
|
|
52
|
+
borderRadius: "var(--radius-sm)",
|
|
53
|
+
background: "transparent",
|
|
54
|
+
color: "currentColor",
|
|
55
|
+
opacity: 0.6,
|
|
56
|
+
cursor: "pointer"
|
|
57
|
+
}),
|
|
58
|
+
children: /* @__PURE__ */ jsx(X, { size: 16, strokeWidth: 2 })
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
Alert
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/Alert.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { X } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Persistent in-page notice — stays until the user dismisses it or the underlying\n * condition is resolved. Sits in the content flow (never floating, no shadow),\n * unlike `Toast`, which is transient and self-dismissing.\n */\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Semantic tone (same five as Badge / Toast). `info` = neutral heads-up.\n * `success` = something went right. `warning` = something needs doing.\n * `error` = something is broken or blocked.\n */\n tone?: 'info' | 'success' | 'warning' | 'error';\n title?: string;\n /** Body copy, passed as children. */\n children?: React.ReactNode;\n /** Leading glyph — a Lucide icon matching the tone. */\n icon?: React.ReactNode;\n /** Inline action(s), rendered under the body. Use `Button size=\"sm\"`. */\n action?: React.ReactNode;\n /** When provided, renders the × dismiss control. Omit for conditions the user cannot dismiss. */\n onDismiss?: () => void;\n}\n\nconst TONES: Record<NonNullable<AlertProps['tone']>, [string, string]> = {\n info: ['--status-info-bg', '--status-info-fg'],\n success: ['--status-success-bg', '--status-success-fg'],\n warning: ['--status-warning-bg', '--status-warning-fg'],\n error: ['--status-error-bg', '--status-error-fg'],\n};\n\nexport function Alert({ tone = 'info', title, children, icon, action, onDismiss, style, ...rest }: AlertProps) {\n const [bg, fg] = TONES[tone] || TONES.info;\n return (\n <div\n role={tone === 'error' ? 'alert' : 'status'}\n {...rest}\n style={sx({\n display: 'flex',\n gap: 'var(--space-3)',\n alignItems: 'flex-start',\n padding: 'var(--space-3) var(--space-4)',\n borderRadius: 'var(--radius-card)',\n background: 'var(' + bg + ')',\n color: 'var(' + fg + ')',\n border: 'var(--border-width-hairline) solid color-mix(in srgb,currentColor 20%,transparent)',\n ...style,\n })}\n >\n {icon && <span style={sx({ display: 'flex', flex: '0 0 auto', marginTop: 1 })}>{icon}</span>}\n <div style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 2 })}>\n {title && <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-sm)', fontWeight: 'var(--weight-semibold)' })}>{title}</span>}\n {children && <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-xs)', lineHeight: 1.5, opacity: 0.9 })}>{children}</span>}\n {action && <span style={sx({ display: 'flex', gap: 'var(--space-2)', marginTop: 'var(--space-2)' })}>{action}</span>}\n </div>\n {onDismiss && (\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label=\"Dispensar\"\n className=\"sereno-dismiss\"\n style={sx({\n flex: '0 0 auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 28,\n height: 28,\n margin: '-3px -5px 0 0',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: 'transparent',\n color: 'currentColor',\n opacity: 0.6,\n cursor: 'pointer',\n })}\n >\n <X size={16} strokeWidth={2} />\n </button>\n )}\n </div>\n );\n}"],"mappings":";AAsDe,cACT,YADS;AAnDf,SAAS,SAAS;AAClB,SAAS,UAAU;AAyBnB,MAAM,QAAmE;AAAA,EACvE,MAAM,CAAC,oBAAoB,kBAAkB;AAAA,EAC7C,SAAS,CAAC,uBAAuB,qBAAqB;AAAA,EACtD,SAAS,CAAC,uBAAuB,qBAAqB;AAAA,EACtD,OAAO,CAAC,qBAAqB,mBAAmB;AAClD;AAEO,SAAS,MAAM,EAAE,OAAO,QAAQ,OAAO,UAAU,MAAM,QA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AAAA,cACR,QAAQ;AAAA,cACR,cAAc;AAAA,cACd,YAAY;AAAA,cACZ,OAAO;AAAA,cACP,SAAS;AAAA,cACT,QAAQ;AAAA,YACV,CAAC;AAAA,YAED,8BAAC,KAAE,MAAM,IAAI,aAAa,GAAG;AAAA;AAAA,QAC/B;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Modal (desktop), bottom sheet (mobile) or full-screen. Portalled to `<body>`
|
|
5
|
+
* and fixed to the viewport, so no ancestor's `overflow`/`transform`/positioning
|
|
6
|
+
* can trap it. While open it locks page scroll and closes on `Escape`. Host needs
|
|
7
|
+
* the `sereno-pop` / `sereno-slide-up` keyframes (see globals.css).
|
|
8
|
+
*/
|
|
9
|
+
interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
open?: boolean;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Action buttons, right-aligned. */
|
|
14
|
+
footer?: React.ReactNode;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
/** `sheet` slides up from the bottom (mobile default); `fullscreen` fills the viewport. */
|
|
17
|
+
variant?: 'center' | 'sheet' | 'fullscreen';
|
|
18
|
+
/** Max width of the centered modal. Ignored for `sheet` / `fullscreen`. */
|
|
19
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
20
|
+
/** Hairline rules between header / body / footer, MUI-style. The body scrolls on its own. */
|
|
21
|
+
dividers?: boolean;
|
|
22
|
+
/** Show an ✕ in the header. Defaults to `true` for `fullscreen`, `false` otherwise. Needs `onClose`. */
|
|
23
|
+
showClose?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* When `false`, a scrim click and `Escape` no longer close the dialog — only
|
|
26
|
+
* the header ✕, a footer action, or `open={false}` do. Use it for a choice the
|
|
27
|
+
* user must make explicitly. Defaults to `true`.
|
|
28
|
+
*/
|
|
29
|
+
dismissible?: boolean;
|
|
30
|
+
/** Explicit pixel width — overrides `size`. */
|
|
31
|
+
width?: number;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
declare function Dialog({ open, title, description, children, footer, onClose, variant, size, dividers, showClose, dismissible, width, style, ...rest }: DialogProps): React.ReactPortal | null;
|
|
35
|
+
|
|
36
|
+
export { Dialog, type DialogProps };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
import { sx } from "../_internal/style";
|
|
7
|
+
const SIZE_W = { sm: 440, md: 600, lg: 800, xl: 1e3 };
|
|
8
|
+
function Dialog({
|
|
9
|
+
open = true,
|
|
10
|
+
title,
|
|
11
|
+
description,
|
|
12
|
+
children,
|
|
13
|
+
footer,
|
|
14
|
+
onClose,
|
|
15
|
+
variant = "center",
|
|
16
|
+
size = "sm",
|
|
17
|
+
dividers = false,
|
|
18
|
+
showClose,
|
|
19
|
+
dismissible = true,
|
|
20
|
+
width,
|
|
21
|
+
style,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
24
|
+
const sheet = variant === "sheet";
|
|
25
|
+
const full = variant === "fullscreen";
|
|
26
|
+
const showX = (showClose ?? full) && !!onClose;
|
|
27
|
+
const rid = React.useId();
|
|
28
|
+
const titleId = title ? `${rid}-title` : void 0;
|
|
29
|
+
const [mounted, setMounted] = React.useState(false);
|
|
30
|
+
React.useEffect(() => setMounted(true), []);
|
|
31
|
+
const onCloseRef = React.useRef(onClose);
|
|
32
|
+
const dismissibleRef = React.useRef(dismissible);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
onCloseRef.current = onClose;
|
|
35
|
+
dismissibleRef.current = dismissible;
|
|
36
|
+
});
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (!open) return;
|
|
39
|
+
const root = document.documentElement;
|
|
40
|
+
const prev = { h: root.style.overflow, b: document.body.style.overflow };
|
|
41
|
+
root.style.overflow = "hidden";
|
|
42
|
+
document.body.style.overflow = "hidden";
|
|
43
|
+
const onKey = (e) => {
|
|
44
|
+
if (e.key === "Escape" && dismissibleRef.current) onCloseRef.current?.();
|
|
45
|
+
};
|
|
46
|
+
document.addEventListener("keydown", onKey);
|
|
47
|
+
return () => {
|
|
48
|
+
root.style.overflow = prev.h;
|
|
49
|
+
document.body.style.overflow = prev.b;
|
|
50
|
+
document.removeEventListener("keydown", onKey);
|
|
51
|
+
};
|
|
52
|
+
}, [open]);
|
|
53
|
+
const panelRef = React.useRef(null);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (open && mounted) panelRef.current?.focus();
|
|
56
|
+
}, [open, mounted]);
|
|
57
|
+
if (!open || !mounted) return null;
|
|
58
|
+
const pad = "var(--space-5)";
|
|
59
|
+
const hairline = "var(--border-width-hairline) solid var(--border-default)";
|
|
60
|
+
const hasHeader = !!(title || description || showX);
|
|
61
|
+
return createPortal(
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
style: sx({
|
|
66
|
+
position: "fixed",
|
|
67
|
+
inset: 0,
|
|
68
|
+
zIndex: 1e3,
|
|
69
|
+
display: "flex",
|
|
70
|
+
alignItems: sheet ? "flex-end" : "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
background: "var(--bg-overlay)",
|
|
73
|
+
backdropFilter: "blur(2px)",
|
|
74
|
+
padding: sheet || full ? 0 : "var(--space-5)"
|
|
75
|
+
}),
|
|
76
|
+
onClick: dismissible ? onClose : void 0,
|
|
77
|
+
children: /* @__PURE__ */ jsxs(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
ref: panelRef,
|
|
81
|
+
role: "dialog",
|
|
82
|
+
"aria-modal": "true",
|
|
83
|
+
"aria-labelledby": titleId,
|
|
84
|
+
"aria-label": titleId ? void 0 : title,
|
|
85
|
+
tabIndex: -1,
|
|
86
|
+
onClick: (e) => e.stopPropagation(),
|
|
87
|
+
...rest,
|
|
88
|
+
style: sx({
|
|
89
|
+
width: full || sheet ? "100%" : "min(100%," + (width ?? SIZE_W[size]) + "px)",
|
|
90
|
+
height: full ? "100%" : void 0,
|
|
91
|
+
maxHeight: full ? void 0 : sheet ? "90dvh" : "calc(100dvh - var(--space-6))",
|
|
92
|
+
display: "flex",
|
|
93
|
+
flexDirection: "column",
|
|
94
|
+
overflow: "hidden",
|
|
95
|
+
outline: "none",
|
|
96
|
+
background: "var(--bg-surface)",
|
|
97
|
+
borderRadius: full ? 0 : sheet ? "var(--radius-sheet) var(--radius-sheet) 0 0" : "var(--radius-lg)",
|
|
98
|
+
border: full ? "none" : hairline,
|
|
99
|
+
boxShadow: full ? "none" : sheet ? "var(--shadow-sheet)" : "var(--shadow-lg)",
|
|
100
|
+
animation: sheet ? "sereno-slide-up var(--duration-sheet) var(--ease-gentle)" : "sereno-pop var(--duration-normal) var(--ease-out)",
|
|
101
|
+
...style
|
|
102
|
+
}),
|
|
103
|
+
children: [
|
|
104
|
+
sheet && /* @__PURE__ */ jsx(
|
|
105
|
+
"span",
|
|
106
|
+
{
|
|
107
|
+
"aria-hidden": true,
|
|
108
|
+
style: sx({ width: 36, height: 4, borderRadius: "999px", background: "var(--border-strong)", alignSelf: "center", marginTop: "var(--space-2)", flex: "0 0 auto" })
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
hasHeader && /* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
style: sx({
|
|
115
|
+
flex: "0 0 auto",
|
|
116
|
+
display: "flex",
|
|
117
|
+
alignItems: "flex-start",
|
|
118
|
+
gap: "var(--space-3)",
|
|
119
|
+
padding: dividers ? pad : `${pad} ${pad} var(--space-3)`,
|
|
120
|
+
borderBottom: dividers ? hairline : void 0
|
|
121
|
+
}),
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsxs("div", { style: sx({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "var(--space-2)" }), children: [
|
|
124
|
+
title && /* @__PURE__ */ jsx(
|
|
125
|
+
"h3",
|
|
126
|
+
{
|
|
127
|
+
id: titleId,
|
|
128
|
+
style: sx({
|
|
129
|
+
fontFamily: "var(--font-display)",
|
|
130
|
+
fontSize: "var(--text-xl)",
|
|
131
|
+
fontWeight: "var(--weight-bold)",
|
|
132
|
+
letterSpacing: "var(--tracking-tight)",
|
|
133
|
+
color: "var(--text-primary)",
|
|
134
|
+
margin: 0
|
|
135
|
+
}),
|
|
136
|
+
children: title
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
description && /* @__PURE__ */ jsx(
|
|
140
|
+
"p",
|
|
141
|
+
{
|
|
142
|
+
style: sx({
|
|
143
|
+
fontFamily: "var(--font-body)",
|
|
144
|
+
fontSize: "var(--text-base)",
|
|
145
|
+
lineHeight: "var(--leading-normal)",
|
|
146
|
+
color: "var(--text-secondary)",
|
|
147
|
+
margin: 0
|
|
148
|
+
}),
|
|
149
|
+
children: description
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }),
|
|
153
|
+
showX && /* @__PURE__ */ jsx(
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
type: "button",
|
|
157
|
+
className: "sereno-dialog-close",
|
|
158
|
+
"aria-label": "Fechar",
|
|
159
|
+
onClick: onClose,
|
|
160
|
+
style: sx({
|
|
161
|
+
flex: "0 0 auto",
|
|
162
|
+
display: "inline-flex",
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "center",
|
|
165
|
+
width: full ? 40 : 34,
|
|
166
|
+
height: full ? 40 : 34,
|
|
167
|
+
margin: full ? 0 : "-3px -5px 0 0",
|
|
168
|
+
border: "none",
|
|
169
|
+
borderRadius: "var(--radius-md)",
|
|
170
|
+
background: full ? "var(--bg-subtle)" : "transparent",
|
|
171
|
+
color: "var(--text-secondary)",
|
|
172
|
+
cursor: "pointer"
|
|
173
|
+
}),
|
|
174
|
+
children: /* @__PURE__ */ jsx(X, { size: full ? 22 : 18, strokeWidth: 2 })
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
style: sx({
|
|
184
|
+
flex: full ? "1 1 auto" : "0 1 auto",
|
|
185
|
+
minHeight: 0,
|
|
186
|
+
overflowY: "auto",
|
|
187
|
+
padding: dividers ? pad : hasHeader ? `0 ${pad} ${footer ? "var(--space-3)" : pad}` : pad
|
|
188
|
+
}),
|
|
189
|
+
children
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
footer && /* @__PURE__ */ jsx(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
style: sx({
|
|
196
|
+
flex: "0 0 auto",
|
|
197
|
+
display: "flex",
|
|
198
|
+
gap: "var(--space-3)",
|
|
199
|
+
justifyContent: "flex-end",
|
|
200
|
+
flexWrap: "wrap",
|
|
201
|
+
padding: dividers ? pad : `0 ${pad} ${pad}`,
|
|
202
|
+
borderTop: dividers ? hairline : void 0
|
|
203
|
+
}),
|
|
204
|
+
children: footer
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
document.body
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
Dialog
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/Dialog.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { X } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Modal (desktop), bottom sheet (mobile) or full-screen. Portalled to `<body>`\n * and fixed to the viewport, so no ancestor's `overflow`/`transform`/positioning\n * can trap it. While open it locks page scroll and closes on `Escape`. Host needs\n * the `sereno-pop` / `sereno-slide-up` keyframes (see globals.css).\n */\nexport interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n title?: string;\n description?: string;\n /** Action buttons, right-aligned. */\n footer?: React.ReactNode;\n onClose?: () => void;\n /** `sheet` slides up from the bottom (mobile default); `fullscreen` fills the viewport. */\n variant?: 'center' | 'sheet' | 'fullscreen';\n /** Max width of the centered modal. Ignored for `sheet` / `fullscreen`. */\n size?: 'sm' | 'md' | 'lg' | 'xl';\n /** Hairline rules between header / body / footer, MUI-style. The body scrolls on its own. */\n dividers?: boolean;\n /** Show an ✕ in the header. Defaults to `true` for `fullscreen`, `false` otherwise. Needs `onClose`. */\n showClose?: boolean;\n /**\n * When `false`, a scrim click and `Escape` no longer close the dialog — only\n * the header ✕, a footer action, or `open={false}` do. Use it for a choice the\n * user must make explicitly. Defaults to `true`.\n */\n dismissible?: boolean;\n /** Explicit pixel width — overrides `size`. */\n width?: number;\n children?: React.ReactNode;\n}\n\nconst SIZE_W = { sm: 440, md: 600, lg: 800, xl: 1000 } as const;\n\nexport function Dialog({\n open = true,\n title,\n description,\n children,\n footer,\n onClose,\n variant = 'center',\n size = 'sm',\n dividers = false,\n showClose,\n dismissible = true,\n width,\n style,\n ...rest\n}: DialogProps) {\n const sheet = variant === 'sheet';\n const full = variant === 'fullscreen';\n const showX = (showClose ?? full) && !!onClose;\n const rid = React.useId();\n const titleId = title ? `${rid}-title` : undefined;\n\n // Portal target is client-only.\n const [mounted, setMounted] = React.useState(false);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- portal target is client-only\n React.useEffect(() => setMounted(true), []);\n\n // While open: lock page scroll and bind Escape to close. `onClose` / `dismissible`\n // are read through refs so the lock effect only re-runs when `open` flips.\n const onCloseRef = React.useRef(onClose);\n const dismissibleRef = React.useRef(dismissible);\n React.useEffect(() => {\n onCloseRef.current = onClose;\n dismissibleRef.current = dismissible;\n });\n React.useEffect(() => {\n if (!open) return;\n const root = document.documentElement;\n const prev = { h: root.style.overflow, b: document.body.style.overflow };\n root.style.overflow = 'hidden';\n document.body.style.overflow = 'hidden';\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && dismissibleRef.current) onCloseRef.current?.();\n };\n document.addEventListener('keydown', onKey);\n return () => {\n root.style.overflow = prev.h;\n document.body.style.overflow = prev.b;\n document.removeEventListener('keydown', onKey);\n };\n }, [open]);\n\n // Pull focus into the dialog when it opens.\n const panelRef = React.useRef<HTMLDivElement>(null);\n React.useEffect(() => {\n if (open && mounted) panelRef.current?.focus();\n }, [open, mounted]);\n\n if (!open || !mounted) return null;\n\n const pad = 'var(--space-5)';\n const hairline = 'var(--border-width-hairline) solid var(--border-default)';\n const hasHeader = !!(title || description || showX);\n\n return createPortal(\n <div\n style={sx({\n position: 'fixed',\n inset: 0,\n zIndex: 1000,\n display: 'flex',\n alignItems: sheet ? 'flex-end' : 'center',\n justifyContent: 'center',\n background: 'var(--bg-overlay)',\n backdropFilter: 'blur(2px)',\n padding: sheet || full ? 0 : 'var(--space-5)',\n })}\n onClick={dismissible ? onClose : undefined}\n >\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-label={titleId ? undefined : title}\n tabIndex={-1}\n onClick={(e) => e.stopPropagation()}\n {...rest}\n style={sx({\n width: full || sheet ? '100%' : 'min(100%,' + (width ?? SIZE_W[size]) + 'px)',\n height: full ? '100%' : undefined,\n maxHeight: full ? undefined : sheet ? '90dvh' : 'calc(100dvh - var(--space-6))',\n display: 'flex',\n flexDirection: 'column',\n overflow: 'hidden',\n outline: 'none',\n background: 'var(--bg-surface)',\n borderRadius: full ? 0 : sheet ? 'var(--radius-sheet) var(--radius-sheet) 0 0' : 'var(--radius-lg)',\n border: full ? 'none' : hairline,\n boxShadow: full ? 'none' : sheet ? 'var(--shadow-sheet)' : 'var(--shadow-lg)',\n animation: sheet ? 'sereno-slide-up var(--duration-sheet) var(--ease-gentle)' : 'sereno-pop var(--duration-normal) var(--ease-out)',\n ...style,\n })}\n >\n {sheet && (\n <span\n aria-hidden\n style={sx({ width: 36, height: 4, borderRadius: '999px', background: 'var(--border-strong)', alignSelf: 'center', marginTop: 'var(--space-2)', flex: '0 0 auto' })}\n />\n )}\n\n {hasHeader && (\n <div\n style={sx({\n flex: '0 0 auto',\n display: 'flex',\n alignItems: 'flex-start',\n gap: 'var(--space-3)',\n padding: dividers ? pad : `${pad} ${pad} var(--space-3)`,\n borderBottom: dividers ? hairline : undefined,\n })}\n >\n <div style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' })}>\n {title && (\n <h3\n id={titleId}\n style={sx({\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-xl)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-tight)',\n color: 'var(--text-primary)',\n margin: 0,\n })}\n >\n {title}\n </h3>\n )}\n {description && (\n <p\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n lineHeight: 'var(--leading-normal)',\n color: 'var(--text-secondary)',\n margin: 0,\n })}\n >\n {description}\n </p>\n )}\n </div>\n {showX && (\n <button\n type=\"button\"\n className=\"sereno-dialog-close\"\n aria-label=\"Fechar\"\n onClick={onClose}\n style={sx({\n flex: '0 0 auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: full ? 40 : 34,\n height: full ? 40 : 34,\n margin: full ? 0 : '-3px -5px 0 0',\n border: 'none',\n borderRadius: 'var(--radius-md)',\n background: full ? 'var(--bg-subtle)' : 'transparent',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n })}\n >\n <X size={full ? 22 : 18} strokeWidth={2} />\n </button>\n )}\n </div>\n )}\n\n <div\n style={sx({\n flex: full ? '1 1 auto' : '0 1 auto',\n minHeight: 0,\n overflowY: 'auto',\n padding: dividers\n ? pad\n : hasHeader\n ? `0 ${pad} ${footer ? 'var(--space-3)' : pad}`\n : pad,\n })}\n >\n {children}\n </div>\n\n {footer && (\n <div\n style={sx({\n flex: '0 0 auto',\n display: 'flex',\n gap: 'var(--space-3)',\n justifyContent: 'flex-end',\n flexWrap: 'wrap',\n padding: dividers ? pad : `0 ${pad} ${pad}`,\n borderTop: dividers ? hairline : undefined,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";AAkJU,cAiBE,YAjBF;AAhJV,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAClB,SAAS,UAAU;AAkCnB,MAAM,SAAS,EAAE,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,IAAK;AAE9C,SAAS,OAAO;AAAA,EACrB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,WAAW;AAAA,EACX;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAgB;AACd,QAAM,QAAQ,YAAY;AAC1B,QAAM,OAAO,YAAY;AACzB,QAAM,SAAS,aAAa,SAAS,CAAC,CAAC;AACvC,QAAM,MAAM,MAAM,MAAM;AACxB,QAAM,UAAU,QAAQ,GAAG,GAAG,WAAW;AAGzC,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAElD,QAAM,UAAU,MAAM,WAAW,IAAI,GAAG,CAAC,CAAC;AAI1C,QAAM,aAAa,MAAM,OAAO,OAAO;AACvC,QAAM,iBAAiB,MAAM,OAAO,WAAW;AAC/C,QAAM,UAAU,MAAM;AACpB,eAAW,UAAU;AACrB,mBAAe,UAAU;AAAA,EAC3B,CAAC;AACD,Q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A,oBACV,SAAS,WAAW,MAAM,KAAK,GAAG,IAAI,GAAG;AAAA,oBACzC,WAAW,WAAW,WAAW;AAAA,kBACnC,CAAC;AAAA,kBAEA;AAAA;AAAA,cACH;AAAA;AAAA;AAAA,QAEJ;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Friendly placeholder for empty agendas, client lists and search results. */
|
|
4
|
+
interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
action?: React.ReactNode;
|
|
9
|
+
compact?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function EmptyState({ icon, title, description, action, compact, style, ...rest }: EmptyStateProps): React.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { EmptyState, type EmptyStateProps };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sx } from "../_internal/style";
|
|
4
|
+
function EmptyState({ icon, title, description, action, compact = false, style, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
...rest,
|
|
9
|
+
style: sx({
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
textAlign: "center",
|
|
14
|
+
gap: "var(--space-3)",
|
|
15
|
+
padding: compact ? "var(--space-6)" : "var(--space-9) var(--space-6)",
|
|
16
|
+
...style
|
|
17
|
+
}),
|
|
18
|
+
children: [
|
|
19
|
+
icon && /* @__PURE__ */ jsx(
|
|
20
|
+
"span",
|
|
21
|
+
{
|
|
22
|
+
style: sx({
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
width: 52,
|
|
27
|
+
height: 52,
|
|
28
|
+
borderRadius: "var(--radius-xl)",
|
|
29
|
+
background: "var(--bg-brand-soft)",
|
|
30
|
+
color: "var(--text-brand)",
|
|
31
|
+
marginBottom: 2
|
|
32
|
+
}),
|
|
33
|
+
children: icon
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
style: sx({
|
|
40
|
+
fontFamily: "var(--font-display)",
|
|
41
|
+
fontSize: "var(--text-lg)",
|
|
42
|
+
fontWeight: "var(--weight-bold)",
|
|
43
|
+
letterSpacing: "var(--tracking-tight)",
|
|
44
|
+
color: "var(--text-primary)"
|
|
45
|
+
}),
|
|
46
|
+
children: title
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
description && /* @__PURE__ */ jsx(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
style: sx({
|
|
53
|
+
fontFamily: "var(--font-body)",
|
|
54
|
+
fontSize: "var(--text-sm)",
|
|
55
|
+
color: "var(--text-secondary)",
|
|
56
|
+
lineHeight: "var(--leading-normal)",
|
|
57
|
+
maxWidth: 340
|
|
58
|
+
}),
|
|
59
|
+
children: description
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
action && /* @__PURE__ */ jsx("div", { style: sx({ marginTop: "var(--space-2)" }), children: action })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
EmptyState
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=EmptyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/EmptyState.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/** Friendly placeholder for empty agendas, client lists and search results. */\nexport interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {\n icon?: React.ReactNode;\n title: string;\n description?: string;\n action?: React.ReactNode;\n compact?: boolean;\n}\n\nexport function EmptyState({ icon, title, description, action, compact = false, style, ...rest }: EmptyStateProps) {\n return (\n <div\n {...rest}\n style={sx({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n textAlign: 'center',\n gap: 'var(--space-3)',\n padding: compact ? 'var(--space-6)' : 'var(--space-9) var(--space-6)',\n ...style,\n })}\n >\n {icon && (\n <span\n style={sx({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 52,\n height: 52,\n borderRadius: 'var(--radius-xl)',\n background: 'var(--bg-brand-soft)',\n color: 'var(--text-brand)',\n marginBottom: 2,\n })}\n >\n {icon}\n </span>\n )}\n <span\n style={sx({\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-lg)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-tight)',\n color: 'var(--text-primary)',\n })}\n >\n {title}\n </span>\n {description && (\n <span\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n color: 'var(--text-secondary)',\n lineHeight: 'var(--leading-normal)',\n maxWidth: 340,\n })}\n >\n {description}\n </span>\n )}\n {action && <div style={sx({ marginTop: 'var(--space-2)' })}>{action}</div>}\n </div>\n );\n}"],"mappings":";AAgBI,SAaI,KAbJ;AAbJ,SAAS,UAAU;AAWZ,SAAS,WAAW,EAAE,MAAM,OAAO,aAAa,QAAQ,UAAU,OAAO,OAAO,GAAG,KAAK,GAAoB;AACjH,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,GAAG;AAAA,QACR,SAAS;AAAA,QACT,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,KAAK;AAAA,QACL,SAAS,UAAU,mBAAmB;AAAA,QACtC,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA,gBACC;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,GAAG;AAAA,cACR,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,gBAAgB;AAAA,cAChB,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,cAAc;AAAA,cACd,YAAY;AAAA,cACZ,OAAO;AAAA,cACP,cAAc;AAAA,YAChB,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,GAAG;AAAA,cACR,YAAY;AAAA,cACZ,UAAU;AAAA,cACV,YAAY;AAAA,cACZ,eAAe;AAAA,cACf,OAAO;AAAA,YACT,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QACC,eACC;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,GAAG;AAAA,cACR,YAAY;AAAA,cACZ,UAAU;AAAA,cACV,OAAO;AAAA,cACP,YAAY;AAAA,cACZ,UAAU;AAAA,YACZ,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QAED,UAAU,oBAAC,SAAI,OAAO,GAAG,EAAE,WAAW,iBAAiB,CAAC,GAAI,kBAAO;AAAA;AAAA;AAAA,EACtE;AAEJ;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Loading placeholder that holds the shape of content still being fetched.
|
|
5
|
+
* Host must include the `sereno-pulse` keyframes (see globals.css).
|
|
6
|
+
*/
|
|
7
|
+
interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* `text` = stacked lines (last one short). `card` = avatar + three lines + trailing
|
|
10
|
+
* pill — a typical list-row card. `avatar` = single circle sized to
|
|
11
|
+
* `Avatar`. `block` = one rectangle for images, charts, calendars.
|
|
12
|
+
*/
|
|
13
|
+
variant?: 'text' | 'card' | 'avatar' | 'block';
|
|
14
|
+
/** Line count for `variant="text"`. Default 3. */
|
|
15
|
+
lines?: number;
|
|
16
|
+
/** Overrides the per-variant default width (any CSS length). */
|
|
17
|
+
width?: number | string;
|
|
18
|
+
/** Overrides the per-variant default height (any CSS length). */
|
|
19
|
+
height?: number | string;
|
|
20
|
+
}
|
|
21
|
+
declare function Skeleton({ variant, lines, width, height, style, ...rest }: SkeletonProps): React.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { Skeleton, type SkeletonProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sx } from "../_internal/style";
|
|
4
|
+
const BASE = { background: "var(--bg-subtle)", animation: "sereno-pulse 1.6s var(--ease-gentle) infinite" };
|
|
5
|
+
function Bar({ w, h, r }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: sx({ ...BASE, display: "block", width: w, height: h, borderRadius: r, flex: "0 0 auto" }) });
|
|
7
|
+
}
|
|
8
|
+
function Skeleton({ variant = "text", lines = 3, width, height, style, ...rest }) {
|
|
9
|
+
if (variant === "avatar")
|
|
10
|
+
return /* @__PURE__ */ jsx("span", { ...rest, style: sx({ display: "inline-flex", ...style }), children: /* @__PURE__ */ jsx(Bar, { w: width || 44, h: height || 44, r: "var(--radius-pill)" }) });
|
|
11
|
+
if (variant === "block")
|
|
12
|
+
return /* @__PURE__ */ jsx("span", { ...rest, style: sx({ display: "flex", ...style }), children: /* @__PURE__ */ jsx(Bar, { w: width || "100%", h: height || 120, r: "var(--radius-md)" }) });
|
|
13
|
+
if (variant === "card")
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
...rest,
|
|
18
|
+
style: sx({
|
|
19
|
+
display: "flex",
|
|
20
|
+
gap: "var(--space-4)",
|
|
21
|
+
alignItems: "flex-start",
|
|
22
|
+
padding: "var(--space-4)",
|
|
23
|
+
borderRadius: "var(--radius-card)",
|
|
24
|
+
background: "var(--bg-surface)",
|
|
25
|
+
border: "var(--border-width-hairline) solid var(--border-default)",
|
|
26
|
+
...style
|
|
27
|
+
}),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Bar, { w: 44, h: 44, r: "var(--radius-pill)" }),
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { style: sx({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "var(--space-2)" }), children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Bar, { w: "52%", h: 13, r: "var(--radius-sm)" }),
|
|
32
|
+
/* @__PURE__ */ jsx(Bar, { w: "80%", h: 11, r: "var(--radius-sm)" }),
|
|
33
|
+
/* @__PURE__ */ jsx(Bar, { w: "34%", h: 11, r: "var(--radius-sm)" })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ jsx(Bar, { w: 72, h: 24, r: "var(--radius-pill)" })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ jsx("div", { ...rest, style: sx({ display: "flex", flexDirection: "column", gap: "var(--space-2)", ...style }), children: Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ jsx(Bar, { w: width || (i === lines - 1 ? "60%" : "100%"), h: height || 12, r: "var(--radius-sm)" }, i)) });
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
Skeleton
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/feedback/Skeleton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Loading placeholder that holds the shape of content still being fetched.\n * Host must include the `sereno-pulse` keyframes (see globals.css).\n */\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * `text` = stacked lines (last one short). `card` = avatar + three lines + trailing\n * pill — a typical list-row card. `avatar` = single circle sized to\n * `Avatar`. `block` = one rectangle for images, charts, calendars.\n */\n variant?: 'text' | 'card' | 'avatar' | 'block';\n /** Line count for `variant=\"text\"`. Default 3. */\n lines?: number;\n /** Overrides the per-variant default width (any CSS length). */\n width?: number | string;\n /** Overrides the per-variant default height (any CSS length). */\n height?: number | string;\n}\n\nconst BASE = { background: 'var(--bg-subtle)', animation: 'sereno-pulse 1.6s var(--ease-gentle) infinite' };\n\nfunction Bar({ w, h, r }: { w: number | string; h: number | string; r: string }) {\n return <span aria-hidden=\"true\" style={sx({ ...BASE, display: 'block', width: w, height: h, borderRadius: r, flex: '0 0 auto' })} />;\n}\n\nexport function Skeleton({ variant = 'text', lines = 3, width, height, style, ...rest }: SkeletonProps) {\n if (variant === 'avatar')\n return (\n <span {...rest} style={sx({ display: 'inline-flex', ...style })}>\n <Bar w={width || 44} h={height || 44} r=\"var(--radius-pill)\" />\n </span>\n );\n if (variant === 'block')\n return (\n <span {...rest} style={sx({ display: 'flex', ...style })}>\n <Bar w={width || '100%'} h={height || 120} r=\"var(--radius-md)\" />\n </span>\n );\n if (variant === 'card')\n return (\n <div\n {...rest}\n style={sx({\n display: 'flex',\n gap: 'var(--space-4)',\n alignItems: 'flex-start',\n padding: 'var(--space-4)',\n borderRadius: 'var(--radius-card)',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <Bar w={44} h={44} r=\"var(--radius-pill)\" />\n <div style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' })}>\n <Bar w=\"52%\" h={13} r=\"var(--radius-sm)\" />\n <Bar w=\"80%\" h={11} r=\"var(--radius-sm)\" />\n <Bar w=\"34%\" h={11} r=\"var(--radius-sm)\" />\n </div>\n <Bar w={72} h={24} r=\"var(--radius-pill)\" />\n </div>\n );\n return (\n <div {...rest} style={sx({ display: 'flex', flexDirection: 'column', gap: 'var(--space-2)', ...style })}>\n {Array.from({ length: lines }).map((_, i) => (\n <Bar key={i} w={width || (i === lines - 1 ? '60%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C,GACtG;AAAA,gCAAC,OAAI,GAAE,OAAM,GAAG,IAAI,GAAE,oBAAmB;AAAA,YACzC,oBAAC,OAAI,GAAE,OAAM,GAAG,IAAI,GAAE,oBAAmB;AAAA,YACzC,oBAAC,OAAI,GAAE,OAAM,GAAG,IAAI,GAAE,oBAAmB;AAAA,aAC3C;AAAA,UACA,oBAAC,OAAI,GAAG,IAAI,GAAG,IAAI,GAAE,sBAAqB;AAAA;AAAA;AAAA,IAC5C;AAEJ,SACE,oBAAC,SAAK,GAAG,MAAM,OAAO,GAAG,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,kBAAkB,GAAG,MAAM,CAAC,GACnG,gBAAM,KAAK,EAAE,QAAQ,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,MACrC,oBAAC,OAAY,GAAG,UAAU,MAAM,QAAQ,IAAI,QAAQ,SAAS,GAAG,UAAU,IAAI,GAAE,sBAAtE,CAAyF,CACpG,GACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Transient confirmation of a completed action. One line of title, optional detail. */
|
|
4
|
+
interface ToastProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Semantic tone (same five as Badge / Alert). `neutral` is the plain dark toast. */
|
|
6
|
+
tone?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Auto-dismiss countdown bar along the bottom edge. `ms` is the full duration;
|
|
14
|
+
* `paused` freezes it. `ToastProvider` wires this — you rarely set it by hand.
|
|
15
|
+
*/
|
|
16
|
+
progress?: {
|
|
17
|
+
ms: number;
|
|
18
|
+
paused?: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
declare function Toast({ tone, title, description, icon, action, onClose, progress, style, ...rest }: ToastProps): React.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { Toast, type ToastProps };
|