@sereno-ds/ui 0.28.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+
3
+ type TypographyVariant = 'display' | 'h1' | 'h2' | 'h3' | 'body' | 'bodySm' | 'label' | 'caption' | 'eyebrow';
4
+ type TypographyColor = 'primary' | 'secondary' | 'muted' | 'disabled' | 'inverse' | 'brand' | 'accent' | 'link' | 'error';
5
+ interface TypographyProps extends React.HTMLAttributes<HTMLElement> {
6
+ variant?: TypographyVariant;
7
+ /** Overrides the variant's own default color token. */
8
+ color?: TypographyColor;
9
+ /** Render as a different element than the variant's own default tag — e.g. an
10
+ * `h3`-styled label that should not enter the document's heading outline. */
11
+ as?: React.ElementType;
12
+ /** Single-line ellipsis. Needs a width-constrained ancestor to actually clip. */
13
+ truncate?: boolean;
14
+ /** Tabular (fixed-width) figures — digits line up column-to-column instead of
15
+ * each taking their own width. For a value that updates or stacks with others
16
+ * at the same position: countdowns, ticket/queue numbers, times, prices. */
17
+ numeric?: boolean;
18
+ children?: React.ReactNode;
19
+ }
20
+ /**
21
+ * Text primitive — one place for the type-scale/font-family/weight combos
22
+ * every screen otherwise reconstructs by hand (see `/design-system/tokens`
23
+ * for the raw scale this wraps). `variant` picks the look *and* the default
24
+ * semantic tag; `as` overrides just the tag, `color` just the color, so a
25
+ * heading-styled label that isn't really a document heading, or a caption in
26
+ * the brand color, are one-prop changes, not a new style object.
27
+ */
28
+ declare function Typography({ variant, color, as, truncate, numeric, style, children, ...rest }: TypographyProps): React.JSX.Element;
29
+
30
+ export { Typography, type TypographyColor, type TypographyProps, type TypographyVariant };
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { sx } from "../_internal/style.js";
4
+ const VARIANTS = {
5
+ display: {
6
+ as: "h1",
7
+ style: { fontFamily: "var(--font-display)", fontSize: "var(--text-5xl)", fontWeight: "var(--weight-extrabold)", letterSpacing: "var(--tracking-tight)", lineHeight: "var(--leading-tight)" }
8
+ },
9
+ h1: {
10
+ as: "h1",
11
+ style: { fontFamily: "var(--font-display)", fontSize: "var(--text-3xl)", fontWeight: "var(--weight-bold)", letterSpacing: "var(--tracking-tight)", lineHeight: "var(--leading-tight)" }
12
+ },
13
+ h2: {
14
+ as: "h2",
15
+ style: { fontFamily: "var(--font-display)", fontSize: "var(--text-xl)", fontWeight: "var(--weight-bold)", letterSpacing: "var(--tracking-snug)", lineHeight: "var(--leading-tight)" }
16
+ },
17
+ h3: {
18
+ as: "h3",
19
+ style: { fontFamily: "var(--font-display)", fontSize: "var(--text-md)", fontWeight: "var(--weight-bold)", letterSpacing: "var(--tracking-snug)", lineHeight: "var(--leading-snug)" }
20
+ },
21
+ body: {
22
+ as: "p",
23
+ style: { fontFamily: "var(--font-body)", fontSize: "var(--text-base)", fontWeight: "var(--weight-regular)", lineHeight: "var(--leading-normal)" }
24
+ },
25
+ bodySm: {
26
+ as: "p",
27
+ style: { fontFamily: "var(--font-body)", fontSize: "var(--text-sm)", fontWeight: "var(--weight-regular)", lineHeight: "var(--leading-normal)" }
28
+ },
29
+ label: {
30
+ as: "span",
31
+ style: { fontFamily: "var(--font-body)", fontSize: "var(--text-sm)", fontWeight: "var(--weight-semibold)", letterSpacing: "var(--tracking-snug)", lineHeight: "var(--leading-snug)" }
32
+ },
33
+ caption: {
34
+ as: "span",
35
+ style: { fontFamily: "var(--font-body)", fontSize: "var(--text-xs)", fontWeight: "var(--weight-regular)", lineHeight: "var(--leading-normal)" }
36
+ },
37
+ eyebrow: {
38
+ as: "span",
39
+ style: {
40
+ fontFamily: "var(--font-body)",
41
+ fontSize: "var(--text-2xs)",
42
+ fontWeight: "var(--weight-semibold)",
43
+ letterSpacing: "var(--tracking-caps)",
44
+ textTransform: "uppercase",
45
+ lineHeight: "var(--leading-normal)"
46
+ }
47
+ }
48
+ };
49
+ const DEFAULT_COLOR = {
50
+ display: "primary",
51
+ h1: "primary",
52
+ h2: "primary",
53
+ h3: "primary",
54
+ body: "primary",
55
+ bodySm: "secondary",
56
+ label: "primary",
57
+ caption: "muted",
58
+ eyebrow: "muted"
59
+ };
60
+ const COLOR_TOKEN = {
61
+ primary: "--text-primary",
62
+ secondary: "--text-secondary",
63
+ muted: "--text-muted",
64
+ disabled: "--text-disabled",
65
+ inverse: "--text-inverse",
66
+ brand: "--text-brand",
67
+ accent: "--text-accent",
68
+ link: "--text-link",
69
+ error: "--interactive-error"
70
+ };
71
+ function Typography({ variant = "body", color, as, truncate, numeric, style, children, ...rest }) {
72
+ const v = VARIANTS[variant];
73
+ const Tag = as ?? v.as;
74
+ return /* @__PURE__ */ jsx(
75
+ Tag,
76
+ {
77
+ ...rest,
78
+ style: sx({
79
+ margin: 0,
80
+ ...v.style,
81
+ color: "var(" + COLOR_TOKEN[color ?? DEFAULT_COLOR[variant]] + ")",
82
+ // `overflow`/`textOverflow` are no-ops on a plain inline box (the
83
+ // default for the `span`-tagged variants) — `block` makes the
84
+ // element actually respect a constrained-width ancestor.
85
+ ...truncate ? { display: "block", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } : null,
86
+ ...numeric ? { fontVariantNumeric: "tabular-nums" } : null,
87
+ ...style
88
+ }),
89
+ children
90
+ }
91
+ );
92
+ }
93
+ export {
94
+ Typography
95
+ };
96
+ //# sourceMappingURL=Typography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/Typography.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\nexport type TypographyVariant = 'display' | 'h1' | 'h2' | 'h3' | 'body' | 'bodySm' | 'label' | 'caption' | 'eyebrow';\nexport type TypographyColor = 'primary' | 'secondary' | 'muted' | 'disabled' | 'inverse' | 'brand' | 'accent' | 'link' | 'error';\n\nexport interface TypographyProps extends React.HTMLAttributes<HTMLElement> {\n variant?: TypographyVariant;\n /** Overrides the variant's own default color token. */\n color?: TypographyColor;\n /** Render as a different element than the variant's own default tag — e.g. an\n * `h3`-styled label that should not enter the document's heading outline. */\n as?: React.ElementType;\n /** Single-line ellipsis. Needs a width-constrained ancestor to actually clip. */\n truncate?: boolean;\n /** Tabular (fixed-width) figures — digits line up column-to-column instead of\n * each taking their own width. For a value that updates or stacks with others\n * at the same position: countdowns, ticket/queue numbers, times, prices. */\n numeric?: boolean;\n children?: React.ReactNode;\n}\n\nconst VARIANTS: Record<TypographyVariant, { as: React.ElementType; style: React.CSSProperties }> = {\n display: {\n as: 'h1',\n style: { fontFamily: 'var(--font-display)', fontSize: 'var(--text-5xl)', fontWeight: 'var(--weight-extrabold)', letterSpacing: 'var(--tracking-tight)', lineHeight: 'var(--leading-tight)' },\n },\n h1: {\n as: 'h1',\n style: { fontFamily: 'var(--font-display)', fontSize: 'var(--text-3xl)', fontWeight: 'var(--weight-bold)', letterSpacing: 'var(--tracking-tight)', lineHeight: 'var(--leading-tight)' },\n },\n h2: {\n as: 'h2',\n style: { fontFamily: 'var(--font-display)', fontSize: 'var(--text-xl)', fontWeight: 'var(--weight-bold)', letterSpacing: 'var(--tracking-snug)', lineHeight: 'var(--leading-tight)' },\n },\n h3: {\n as: 'h3',\n style: { fontFamily: 'var(--font-display)', fontSize: 'var(--text-md)', fontWeight: 'var(--weight-bold)', letterSpacing: 'var(--tracking-snug)', lineHeight: 'var(--leading-snug)' },\n },\n body: {\n as: 'p',\n style: { fontFamily: 'var(--font-body)', fontSize: 'var(--text-base)', fontWeight: 'var(--weight-regular)', lineHeight: 'var(--leading-normal)' },\n },\n bodySm: {\n as: 'p',\n style: { fontFamily: 'var(--font-body)', fontSize: 'var(--text-sm)', fontWeight: 'var(--weight-regular)', lineHeight: 'var(--leading-normal)' },\n },\n label: {\n as: 'span',\n style: { fontFamily: 'var(--font-body)', fontSize: 'var(--text-sm)', fontWeight: 'var(--weight-semibold)', letterSpacing: 'var(--tracking-snug)', lineHeight: 'var(--leading-snug)' },\n },\n caption: {\n as: 'span',\n style: { fontFamily: 'var(--font-body)', fontSize: 'var(--text-xs)', fontWeight: 'var(--weight-regular)', lineHeight: 'var(--leading-normal)' },\n },\n eyebrow: {\n as: 'span',\n style: {\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n lineHeight: 'var(--leading-normal)',\n },\n },\n};\n\n// Each variant's own sensible default — overridable via the `color` prop.\nconst DEFAULT_COLOR: Record<TypographyVariant, TypographyColor> = {\n display: 'primary',\n h1: 'primary',\n h2: 'primary',\n h3: 'primary',\n body: 'primary',\n bodySm: 'secondary',\n label: 'primary',\n caption: 'muted',\n eyebrow: 'muted',\n};\n\nconst COLOR_TOKEN: Record<TypographyColor, string> = {\n primary: '--text-primary',\n secondary: '--text-secondary',\n muted: '--text-muted',\n disabled: '--text-disabled',\n inverse: '--text-inverse',\n brand: '--text-brand',\n accent: '--text-accent',\n link: '--text-link',\n error: '--interactive-error',\n};\n\n/**\n * Text primitive — one place for the type-scale/font-family/weight combos\n * every screen otherwise reconstructs by hand (see `/design-system/tokens`\n * for the raw scale this wraps). `variant` picks the look *and* the default\n * semantic tag; `as` overrides just the tag, `color` just the color, so a\n * heading-styled label that isn't really a document heading, or a caption in\n * the brand color, are one-prop changes, not a new style object.\n */\nexport function Typography({ variant = 'body', color, as, truncate, numeric, style, children, ...rest }: TypographyProps) {\n const v = VARIANTS[variant];\n const Tag = as ?? v.as;\n return (\n <Tag\n {...rest}\n style={sx({\n margin: 0,\n ...v.style,\n color: 'var(' + COLOR_TOKEN[color ?? DEFAULT_COLOR[variant]] + ')',\n // `overflow`/`textOverflow` are no-ops on a plain inline box (the\n // default for the `span`-tagged variants) — `block` makes the\n // element actually respect a constrained-width ancestor.\n ...(truncate ? { display: 'block', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } : null),\n ...(numeric ? { fontVariantNumeric: 'tabular-nums'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IAAI;AAAA,IACJ,OAAO;AAAA,MACL,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,eAAe;AAAA,MACf,YAAY;AAAA,IACd;AAAA,EACF;AACF;AAGA,MAAM,gBAA4D;AAAA,EAChE,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AAEA,MAAM,cAA+C;AAAA,EACnD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AACT;AAUO,SAAS,WAAW,EAAE,UAAU,QAAQ,OAAO,IAAI,UAAU,SAAS,OAAO,UAAU,GAAG,KAAK,GAAoB;AACxH,QAAM,IAAI,SAAS,OAAO;AAC1B,QAAM,MAAM,MAAM,EAAE;AACpB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,GAAG;AAAA,QACR,QAAQ;AAAA,QACR,GAAG,EAAE;AAAA,QACL,OAAO,SAAS,YAAY,SAAS,cAAc,OAAO,CAAC,IAAI;AAAA;AAAA;AAAA;AAAA,QAI/D,GAAI,WAAW,EAAE,SAAS,SAAS,UAAU,UAAU,cAAc,YAAY,YAAY,SAAS,IAAI;AAAA,QAC1G,GAAI,UAAU,EAAE,oBAAoB,eAAe,IAAI;AAAA,QACvD,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -4,6 +4,7 @@ import * as React from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import { X } from "lucide-react";
6
6
  import { sx } from "../_internal/style.js";
7
+ import { Typography } from "../core/Typography.js";
7
8
  const SIZE_W = { sm: 440, md: 600, lg: 800, xl: 1e3 };
8
9
  const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
9
10
  function focusableIn(el) {
@@ -164,33 +165,8 @@ function Header({ title, description, children }) {
164
165
  }),
165
166
  children: [
166
167
  /* @__PURE__ */ jsxs("div", { id: titleId, style: sx({ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "var(--space-2)" }), children: [
167
- title && /* @__PURE__ */ jsx(
168
- "h3",
169
- {
170
- style: sx({
171
- fontFamily: "var(--font-display)",
172
- fontSize: "var(--text-xl)",
173
- fontWeight: "var(--weight-bold)",
174
- letterSpacing: "var(--tracking-tight)",
175
- color: "var(--text-primary)",
176
- margin: 0
177
- }),
178
- children: title
179
- }
180
- ),
181
- description && /* @__PURE__ */ jsx(
182
- "p",
183
- {
184
- style: sx({
185
- fontFamily: "var(--font-body)",
186
- fontSize: "var(--text-base)",
187
- lineHeight: "var(--leading-normal)",
188
- color: "var(--text-secondary)",
189
- margin: 0
190
- }),
191
- children: description
192
- }
193
- ),
168
+ title && /* @__PURE__ */ jsx(Typography, { as: "h3", variant: "h2", style: { letterSpacing: "var(--tracking-tight)" }, children: title }),
169
+ description && /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: description }),
194
170
  extra
195
171
  ] }),
196
172
  closeEl
@@ -1 +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 — a **compound\n * component**. Portalled to `<body>` and fixed to the viewport, so no\n * ancestor's `overflow`/`transform`/positioning can trap it. While open it\n * locks page scroll and closes on `Escape`. Host needs the `sereno-pop` /\n * `sereno-slide-up` keyframes (see globals.css).\n *\n * ```tsx\n * <Dialog open={open} onClose={close} footer={false}>\n * <Dialog.Header title=\"Cancel booking?\" description=\"…\">\n * <Dialog.Close />\n * </Dialog.Header>\n * <Dialog.Body>…</Dialog.Body>\n * <Dialog.Footer>\n * <Button variant=\"ghost\" onClick={close}>Back</Button>\n * <Button variant=\"error\" onClick={confirm}>Cancel booking</Button>\n * </Dialog.Footer>\n * </Dialog>\n * ```\n *\n * `Dialog.Header` / `Dialog.Footer` are both optional — a dialog can be just\n * a `Dialog.Body`. `Dialog.Close` goes wherever you put it (typically inside\n * `Dialog.Header`); nothing renders a close button unless you add one.\n */\nexport interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {\n open?: boolean;\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 /**\n * When `false`, a scrim click and `Escape` no longer close the dialog — only\n * `Dialog.Close`, a footer action, or `open={false}` do. Use it for a choice\n * the 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\nexport interface DialogHeaderProps {\n title?: string;\n description?: string;\n /** Extra content below the description — or the whole header, if you skip `title`/`description`. Put `Dialog.Close` here. */\n children?: React.ReactNode;\n}\n\nexport interface DialogBodyProps {\n children?: React.ReactNode;\n}\n\nexport interface DialogFooterProps {\n /** Action buttons, right-aligned. */\n children?: React.ReactNode;\n}\n\ninterface DialogContextValue {\n titleId: string;\n onClose?: () => void;\n full: boolean;\n dividers: boolean;\n hasHeader: boolean;\n hasFooter: boolean;\n}\n\nconst SIZE_W = { sm: 440, md: 600, lg: 800, xl: 1000 } as const;\n\n// Cheap, dependency-free focusable check — matches what most hand-rolled\n// focus traps use. No visibility filtering: nothing inside a Dialog is ever\n// conditionally hidden today, and jsdom doesn't compute layout (offsetParent\n// is always null there), so a visibility check would be untestable dead\n// weight rather than a real safeguard.\nconst FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\nfunction focusableIn(el: HTMLElement): HTMLElement[] {\n return Array.from(el.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n}\n\nconst DialogContext = React.createContext<DialogContextValue | null>(null);\n\nfunction useDialogContext(component: string): DialogContextValue {\n const ctx = React.useContext(DialogContext);\n if (!ctx) throw new Error(`<Dialog.${component}> must be rendered inside <Dialog>.`);\n return ctx;\n}\n\nfunction DialogRoot({\n open = true,\n children,\n onClose,\n variant = 'center',\n size = 'sm',\n dividers = false,\n dismissible = true,\n width,\n style,\n ...rest\n}: DialogProps) {\n const sheet = variant === 'sheet';\n const full = variant === 'fullscreen';\n const rid = React.useId();\n const titleId = `${rid}-title`;\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, bind Escape to close, trap Tab inside the\n // panel, and restore focus to whatever had it before opening once closed.\n // `onClose` / `dismissible` are read through refs so the effect only\n // 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 const panelRef = React.useRef<HTMLDivElement>(null);\n React.useEffect(() => {\n if (!open) return;\n const previouslyFocused = document.activeElement as HTMLElement | null;\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') {\n if (dismissibleRef.current) onCloseRef.current?.();\n return;\n }\n if (e.key !== 'Tab') return;\n const panel = panelRef.current;\n if (!panel) return;\n const focusables = focusableIn(panel);\n // No focusable content (a bare Dialog.Body with plain text): keep\n // focus pinned on the panel itself rather than leaking to the page.\n if (focusables.length === 0) {\n e.preventDefault();\n return;\n }\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\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 // The trigger may itself have unmounted (e.g. a row it lived in was\n // removed) — focus() on a detached element is a silent no-op, not a\n // throw, so no need to guard beyond the null check.\n previouslyFocused?.focus();\n };\n }, [open]);\n\n // Pull focus into the dialog when it opens.\n React.useEffect(() => {\n if (open && mounted) panelRef.current?.focus();\n }, [open, mounted]);\n\n if (!open || !mounted) return null;\n\n // Body/Footer padding depends on whether a Header/Footer is actually\n // present — read straight off the children, the same technique\n // SidebarNav.Item / Stepper use for data they need before render.\n const items = React.Children.toArray(children);\n const hasHeader = items.some((c) => React.isValidElement(c) && c.type === Header);\n const hasFooter = items.some((c) => React.isValidElement(c) && c.type === Footer);\n\n const ctx: DialogContextValue = { titleId, onClose, full, dividers, hasHeader, hasFooter };\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={hasHeader ? titleId : undefined}\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' : 'var(--border-width-hairline) solid var(--border-default)',\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 <DialogContext.Provider value={ctx}>{children}</DialogContext.Provider>\n </div>\n </div>,\n document.body,\n );\n}\n\nfunction Header({ title, description, children }: DialogHeaderProps) {\n const { titleId, dividers } = useDialogContext('Header');\n const pad = 'var(--space-5)';\n const hairline = 'var(--border-width-hairline) solid var(--border-default)';\n\n const items = React.Children.toArray(children);\n const closeEl = items.find((c) => React.isValidElement(c) && c.type === Close);\n const extra = items.filter((c) => c !== closeEl);\n\n return (\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 id={titleId} style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' })}>\n {title && (\n <h3\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 {extra}\n </div>\n {closeEl}\n </div>\n );\n}\n\nfunction Body({ children }: DialogBodyProps) {\n const { dividers, hasHeader, hasFooter, full } = useDialogContext('Body');\n const pad = 'var(--space-5)';\n return (\n <div\n style={sx({\n flex: full ? '1 1 auto' : '0 1 auto',\n minHeight: 0,\n overflowY: 'auto',\n padding: dividers ? pad : hasHeader ? `0 ${pad} ${hasFooter ? 'var(--space-3)' : pad}` : pad,\n })}\n >\n {children}\n </div>\n );\n}\n\nfunction Footer({ children }: DialogFooterProps) {\n const { dividers } = useDialogContext('Footer');\n const pad = 'var(--space-5)';\n const hairline = 'var(--border-width-hairline) solid var(--border-default)';\n return (\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 {children}\n </div>\n );\n}\n\nfunction Close() {\n const { onClose, full } = useDialogContext('Close');\n return (\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}\n\nexport const Dialog = Object.assign(DialogRoot, { Header, Body, Footer, Close });\n"],"mappings":";AA4MM,SAyBI,KAzBJ;AA1MN,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAClB,SAAS,UAAU;AAuE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O,MAAM,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,MAAM,QAAQ,MAAM,CAAC;","names":[]}
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';\nimport { Typography } from '../core/Typography';\n\n/**\n * Modal (desktop), bottom sheet (mobile) or full-screen — a **compound\n * component**. Portalled to `<body>` and fixed to the viewport, so no\n * ancestor's `overflow`/`transform`/positioning can trap it. While open it\n * locks page scroll and closes on `Escape`. Host needs the `sereno-pop` /\n * `sereno-slide-up` keyframes (see globals.css).\n *\n * ```tsx\n * <Dialog open={open} onClose={close} footer={false}>\n * <Dialog.Header title=\"Cancel booking?\" description=\"…\">\n * <Dialog.Close />\n * </Dialog.Header>\n * <Dialog.Body>…</Dialog.Body>\n * <Dialog.Footer>\n * <Button variant=\"ghost\" onClick={close}>Back</Button>\n * <Button variant=\"error\" onClick={confirm}>Cancel booking</Button>\n * </Dialog.Footer>\n * </Dialog>\n * ```\n *\n * `Dialog.Header` / `Dialog.Footer` are both optional — a dialog can be just\n * a `Dialog.Body`. `Dialog.Close` goes wherever you put it (typically inside\n * `Dialog.Header`); nothing renders a close button unless you add one.\n */\nexport interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {\n open?: boolean;\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 /**\n * When `false`, a scrim click and `Escape` no longer close the dialog — only\n * `Dialog.Close`, a footer action, or `open={false}` do. Use it for a choice\n * the 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\nexport interface DialogHeaderProps {\n title?: string;\n description?: string;\n /** Extra content below the description — or the whole header, if you skip `title`/`description`. Put `Dialog.Close` here. */\n children?: React.ReactNode;\n}\n\nexport interface DialogBodyProps {\n children?: React.ReactNode;\n}\n\nexport interface DialogFooterProps {\n /** Action buttons, right-aligned. */\n children?: React.ReactNode;\n}\n\ninterface DialogContextValue {\n titleId: string;\n onClose?: () => void;\n full: boolean;\n dividers: boolean;\n hasHeader: boolean;\n hasFooter: boolean;\n}\n\nconst SIZE_W = { sm: 440, md: 600, lg: 800, xl: 1000 } as const;\n\n// Cheap, dependency-free focusable check — matches what most hand-rolled\n// focus traps use. No visibility filtering: nothing inside a Dialog is ever\n// conditionally hidden today, and jsdom doesn't compute layout (offsetParent\n// is always null there), so a visibility check would be untestable dead\n// weight rather than a real safeguard.\nconst FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\nfunction focusableIn(el: HTMLElement): HTMLElement[] {\n return Array.from(el.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n}\n\nconst DialogContext = React.createContext<DialogContextValue | null>(null);\n\nfunction useDialogContext(component: string): DialogContextValue {\n const ctx = React.useContext(DialogContext);\n if (!ctx) throw new Error(`<Dialog.${component}> must be rendered inside <Dialog>.`);\n return ctx;\n}\n\nfunction DialogRoot({\n open = true,\n children,\n onClose,\n variant = 'center',\n size = 'sm',\n dividers = false,\n dismissible = true,\n width,\n style,\n ...rest\n}: DialogProps) {\n const sheet = variant === 'sheet';\n const full = variant === 'fullscreen';\n const rid = React.useId();\n const titleId = `${rid}-title`;\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, bind Escape to close, trap Tab inside the\n // panel, and restore focus to whatever had it before opening once closed.\n // `onClose` / `dismissible` are read through refs so the effect only\n // 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 const panelRef = React.useRef<HTMLDivElement>(null);\n React.useEffect(() => {\n if (!open) return;\n const previouslyFocused = document.activeElement as HTMLElement | null;\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') {\n if (dismissibleRef.current) onCloseRef.current?.();\n return;\n }\n if (e.key !== 'Tab') return;\n const panel = panelRef.current;\n if (!panel) return;\n const focusables = focusableIn(panel);\n // No focusable content (a bare Dialog.Body with plain text): keep\n // focus pinned on the panel itself rather than leaking to the page.\n if (focusables.length === 0) {\n e.preventDefault();\n return;\n }\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\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 // The trigger may itself have unmounted (e.g. a row it lived in was\n // removed) — focus() on a detached element is a silent no-op, not a\n // throw, so no need to guard beyond the null check.\n previouslyFocused?.focus();\n };\n }, [open]);\n\n // Pull focus into the dialog when it opens.\n React.useEffect(() => {\n if (open && mounted) panelRef.current?.focus();\n }, [open, mounted]);\n\n if (!open || !mounted) return null;\n\n // Body/Footer padding depends on whether a Header/Footer is actually\n // present — read straight off the children, the same technique\n // SidebarNav.Item / Stepper use for data they need before render.\n const items = React.Children.toArray(children);\n const hasHeader = items.some((c) => React.isValidElement(c) && c.type === Header);\n const hasFooter = items.some((c) => React.isValidElement(c) && c.type === Footer);\n\n const ctx: DialogContextValue = { titleId, onClose, full, dividers, hasHeader, hasFooter };\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={hasHeader ? titleId : undefined}\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' : 'var(--border-width-hairline) solid var(--border-default)',\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 <DialogContext.Provider value={ctx}>{children}</DialogContext.Provider>\n </div>\n </div>,\n document.body,\n );\n}\n\nfunction Header({ title, description, children }: DialogHeaderProps) {\n const { titleId, dividers } = useDialogContext('Header');\n const pad = 'var(--space-5)';\n const hairline = 'var(--border-width-hairline) solid var(--border-default)';\n\n const items = React.Children.toArray(children);\n const closeEl = items.find((c) => React.isValidElement(c) && c.type === Close);\n const extra = items.filter((c) => c !== closeEl);\n\n return (\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 id={titleId} style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' })}>\n {title && (\n <Typography as=\"h3\" variant=\"h2\" style={{ letterSpacing: 'var(--tracking-tight)' }}>\n {title}\n </Typography>\n )}\n {description && (\n <Typography variant=\"body\" color=\"secondary\">\n {description}\n </Typography>\n )}\n {extra}\n </div>\n {closeEl}\n </div>\n );\n}\n\nfunction Body({ children }: DialogBodyProps) {\n const { dividers, hasHeader, hasFooter, full } = useDialogContext('Body');\n const pad = 'var(--space-5)';\n return (\n <div\n style={sx({\n flex: full ? '1 1 auto' : '0 1 auto',\n minHeight: 0,\n overflowY: 'auto',\n padding: dividers ? pad : hasHeader ? `0 ${pad} ${hasFooter ? 'var(--space-3)' : pad}` : pad,\n })}\n >\n {children}\n </div>\n );\n}\n\nfunction Footer({ children }: DialogFooterProps) {\n const { dividers } = useDialogContext('Footer');\n const pad = 'var(--space-5)';\n const hairline = 'var(--border-width-hairline) solid var(--border-default)';\n return (\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 {children}\n </div>\n );\n}\n\nfunction Close() {\n const { onClose, full } = useDialogContext('Close');\n return (\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}\n\nexport const Dialog = Object.assign(DialogRoot, { Header, Body, Footer, Close });\n"],"mappings":";AA6MM,SAyBI,KAzBJ;AA3MN,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAClB,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAuE3B,MAAM,SAAS,EAAE,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,IAAK;AAOrD,MAAM,qBAAqB;AAC3B,SAAS,YAAY,IAAgC;AACnD,SAAO,MAAM,KAAK,GAAG,iBAA8B,kBAAkB,CAAC;AACxE;AAEA,MAAM,gBAAgB,MAAM,cAAyC,IAAI;AAEzE,SAAS,iBAAiB,WAAuC;AAC/D,QAAM,MAAM,MAAM,WAAW,aAAa;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,WAAW,SAAS,qCAAqC;AACnF,SAAO;AACT;AAEA,SAAS,WAAW;AAAA,EAClB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,WAAW;AAAA,EACX,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAgB;AACd,QAAM,QAAQ,YAAY;AAC1B,QAAM,OAAO,YAAY;AACzB,QAAM,MAAM,MAAM,MAAM;AACxB,QAAM,UAAU,GAAG,GAAG;AAGtB,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAElD,QAAM,UAAU,MAAM,WAAW,IAAI,GAAG,CAAC,CAAC;AAM1C,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,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O,KAAK,IAAI,aAAa,GAAG;AAAA;AAAA,EAC3C;AAEJ;AAEO,MAAM,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,MAAM,QAAQ,MAAM,CAAC;","names":[]}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { sx } from "../_internal/style.js";
4
+ import { Typography } from "../core/Typography.js";
4
5
  function EmptyState({ icon, title, description, action, compact = false, style, ...rest }) {
5
6
  return /* @__PURE__ */ jsxs(
6
7
  "div",
@@ -33,32 +34,8 @@ function EmptyState({ icon, title, description, action, compact = false, style,
33
34
  children: icon
34
35
  }
35
36
  ),
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
- ),
37
+ /* @__PURE__ */ jsx(Typography, { as: "span", variant: "h1", style: { fontSize: "var(--text-lg)" }, children: title }),
38
+ description && /* @__PURE__ */ jsx(Typography, { as: "span", variant: "bodySm", style: { maxWidth: 340 }, children: description }),
62
39
  action && /* @__PURE__ */ jsx("div", { style: sx({ marginTop: "var(--space-2)" }), children: action })
63
40
  ]
64
41
  }
@@ -1 +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":[]}
1
+ {"version":3,"sources":["../../src/feedback/EmptyState.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\nimport { Typography } from '../core/Typography';\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 <Typography as=\"span\" variant=\"h1\" style={{ fontSize: 'var(--text-lg)' }}>\n {title}\n </Typography>\n {description && (\n <Typography as=\"span\" variant=\"bodySm\" style={{ maxWidth: 340 }}>\n {description}\n </Typography>\n )}\n {action && <div style={sx({ marginTop: 'var(--space-2)' })}>{action}</div>}\n </div>\n );\n}"],"mappings":";AAiBI,SAaI,KAbJ;AAdJ,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAWpB,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,oBAAC,cAAW,IAAG,QAAO,SAAQ,MAAK,OAAO,EAAE,UAAU,iBAAiB,GACpE,iBACH;AAAA,QACC,eACC,oBAAC,cAAW,IAAG,QAAO,SAAQ,UAAS,OAAO,EAAE,UAAU,IAAI,GAC3D,uBACH;AAAA,QAED,UAAU,oBAAC,SAAI,OAAO,GAAG,EAAE,WAAW,iBAAiB,CAAC,GAAI,kBAAO;AAAA;AAAA;AAAA,EACtE;AAEJ;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { Typography, TypographyColor, TypographyProps, TypographyVariant } from './core/Typography.js';
1
2
  export { Button, ButtonProps } from './core/Button.js';
2
3
  export { IconButton, IconButtonProps } from './core/IconButton.js';
3
4
  export { Badge, BadgeProps } from './core/Badge.js';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Typography } from "./core/Typography.js";
1
2
  import { Button } from "./core/Button.js";
2
3
  import { IconButton } from "./core/IconButton.js";
3
4
  import { Badge } from "./core/Badge.js";
@@ -70,6 +71,7 @@ export {
70
71
  Toast,
71
72
  ToastProvider,
72
73
  TopBar,
74
+ Typography,
73
75
  useToast
74
76
  };
75
77
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Sereno Design System — public component surface. See the /design-system\n// showcase for the live catalog, or the barrel smoke test for the full list.\n// Icons are passed in as props (lucide-react), never imported here; theming is\n// 100% CSS custom properties.\n\n// core\nexport { Button, type ButtonProps } from './core/Button';\nexport { IconButton, type IconButtonProps } from './core/IconButton';\nexport { Badge, type BadgeProps } from './core/Badge';\nexport { Card, type CardProps } from './core/Card';\nexport { Avatar, type AvatarProps } from './core/Avatar';\nexport { Brand, type BrandProps } from './core/Brand';\nexport { Menu, type MenuProps, type MenuItem, type MenuEntry, type MenuSeparator, type MenuHeading } from './core/Menu';\nexport {\n Table,\n type TableProps,\n type TableRowProps,\n type HeaderCellProps,\n type CellProps,\n type TableSort,\n type SortDirection,\n} from './core/Table';\n\n// forms\nexport { Input, type InputProps } from './forms/Input';\nexport { Textarea, type TextareaProps } from './forms/Textarea';\nexport { Select, type SelectProps, type SelectOption } from './forms/Select';\nexport { Checkbox, type CheckboxProps } from './forms/Checkbox';\nexport { Radio, type RadioProps } from './forms/Radio';\nexport { Switch, type SwitchProps } from './forms/Switch';\nexport { DateTimePicker, type DateTimePickerProps, type TimeSlot } from './forms/DateTimePicker';\nexport { DatePicker, type DatePickerProps } from './forms/DatePicker';\nexport { FileUpload, type FileUploadProps } from './forms/FileUpload';\nexport { AvatarUpload, type AvatarUploadProps } from './forms/AvatarUpload';\nexport { SearchInput, type SearchInputProps } from './forms/SearchInput';\n\n// navigation\nexport { TopBar, type TopBarProps, type TopBarLeadingProps, type TopBarTitleProps, type TopBarActionsProps } from './navigation/TopBar';\nexport { Tabs, type TabsProps, type TabsListProps, type TabsTabProps, type TabsPanelProps } from './navigation/Tabs';\nexport { BottomNav, type BottomNavProps, type BottomNavItemProps } from './navigation/BottomNav';\nexport {\n SidebarNav,\n type SidebarNavProps,\n type SidebarNavSectionProps,\n type SidebarNavItemProps,\n type SidebarNavSubItemProps,\n} from './navigation/SidebarNav';\nexport { Stepper, type StepperProps, type StepperStepProps } from './navigation/Stepper';\n\n// feedback\nexport { Alert, type AlertProps } from './feedback/Alert';\nexport { Toast, type ToastProps } from './feedback/Toast';\nexport {\n ToastProvider,\n useToast,\n type ToastProviderProps,\n type ToastOptions,\n type ToastApi,\n type ToastContextValue,\n type ToastPosition,\n} from './feedback/ToastProvider';\nexport { Dialog, type DialogProps, type DialogHeaderProps, type DialogBodyProps, type DialogFooterProps } from './feedback/Dialog';\nexport { Skeleton, type SkeletonProps } from './feedback/Skeleton';\nexport { EmptyState, type EmptyStateProps } from './feedback/EmptyState';\n\n// theme — the `data-theme` provider (next-themes) + the light/dark toggle\nexport { ThemeProvider } from './theme/ThemeProvider';\nexport { ThemeToggle } from './theme/ThemeToggle';\n"],"mappings":"AAMA,SAAS,cAAgC;AACzC,SAAS,kBAAwC;AACjD,SAAS,aAA8B;AACvC,SAAS,YAA4B;AACrC,SAAS,cAAgC;AACzC,SAAS,aAA8B;AACvC,SAAS,YAAiG;AAC1G;AAAA,EACE;AAAA,OAOK;AAGP,SAAS,aAA8B;AACvC,SAAS,gBAAoC;AAC7C,SAAS,cAAmD;AAC5D,SAAS,gBAAoC;AAC7C,SAAS,aAA8B;AACvC,SAAS,cAAgC;AACzC,SAAS,sBAA+D;AACxE,SAAS,kBAAwC;AACjD,SAAS,kBAAwC;AACjD,SAAS,oBAA4C;AACrD,SAAS,mBAA0C;AAGnD,SAAS,cAAyG;AAClH,SAAS,YAAwF;AACjG,SAAS,iBAA+D;AACxE;AAAA,EACE;AAAA,OAKK;AACP,SAAS,eAAyD;AAGlE,SAAS,aAA8B;AACvC,SAAS,aAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAMK;AACP,SAAS,cAAsG;AAC/G,SAAS,gBAAoC;AAC7C,SAAS,kBAAwC;AAGjD,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Sereno Design System — public component surface. See the /design-system\n// showcase for the live catalog, or the barrel smoke test for the full list.\n// Icons are passed in as props (lucide-react), never imported here; theming is\n// 100% CSS custom properties.\n\n// core\nexport { Typography, type TypographyProps, type TypographyVariant, type TypographyColor } from './core/Typography';\nexport { Button, type ButtonProps } from './core/Button';\nexport { IconButton, type IconButtonProps } from './core/IconButton';\nexport { Badge, type BadgeProps } from './core/Badge';\nexport { Card, type CardProps } from './core/Card';\nexport { Avatar, type AvatarProps } from './core/Avatar';\nexport { Brand, type BrandProps } from './core/Brand';\nexport { Menu, type MenuProps, type MenuItem, type MenuEntry, type MenuSeparator, type MenuHeading } from './core/Menu';\nexport {\n Table,\n type TableProps,\n type TableRowProps,\n type HeaderCellProps,\n type CellProps,\n type TableSort,\n type SortDirection,\n} from './core/Table';\n\n// forms\nexport { Input, type InputProps } from './forms/Input';\nexport { Textarea, type TextareaProps } from './forms/Textarea';\nexport { Select, type SelectProps, type SelectOption } from './forms/Select';\nexport { Checkbox, type CheckboxProps } from './forms/Checkbox';\nexport { Radio, type RadioProps } from './forms/Radio';\nexport { Switch, type SwitchProps } from './forms/Switch';\nexport { DateTimePicker, type DateTimePickerProps, type TimeSlot } from './forms/DateTimePicker';\nexport { DatePicker, type DatePickerProps } from './forms/DatePicker';\nexport { FileUpload, type FileUploadProps } from './forms/FileUpload';\nexport { AvatarUpload, type AvatarUploadProps } from './forms/AvatarUpload';\nexport { SearchInput, type SearchInputProps } from './forms/SearchInput';\n\n// navigation\nexport { TopBar, type TopBarProps, type TopBarLeadingProps, type TopBarTitleProps, type TopBarActionsProps } from './navigation/TopBar';\nexport { Tabs, type TabsProps, type TabsListProps, type TabsTabProps, type TabsPanelProps } from './navigation/Tabs';\nexport { BottomNav, type BottomNavProps, type BottomNavItemProps } from './navigation/BottomNav';\nexport {\n SidebarNav,\n type SidebarNavProps,\n type SidebarNavSectionProps,\n type SidebarNavItemProps,\n type SidebarNavSubItemProps,\n} from './navigation/SidebarNav';\nexport { Stepper, type StepperProps, type StepperStepProps } from './navigation/Stepper';\n\n// feedback\nexport { Alert, type AlertProps } from './feedback/Alert';\nexport { Toast, type ToastProps } from './feedback/Toast';\nexport {\n ToastProvider,\n useToast,\n type ToastProviderProps,\n type ToastOptions,\n type ToastApi,\n type ToastContextValue,\n type ToastPosition,\n} from './feedback/ToastProvider';\nexport { Dialog, type DialogProps, type DialogHeaderProps, type DialogBodyProps, type DialogFooterProps } from './feedback/Dialog';\nexport { Skeleton, type SkeletonProps } from './feedback/Skeleton';\nexport { EmptyState, type EmptyStateProps } from './feedback/EmptyState';\n\n// theme — the `data-theme` provider (next-themes) + the light/dark toggle\nexport { ThemeProvider } from './theme/ThemeProvider';\nexport { ThemeToggle } from './theme/ThemeToggle';\n"],"mappings":"AAMA,SAAS,kBAAsF;AAC/F,SAAS,cAAgC;AACzC,SAAS,kBAAwC;AACjD,SAAS,aAA8B;AACvC,SAAS,YAA4B;AACrC,SAAS,cAAgC;AACzC,SAAS,aAA8B;AACvC,SAAS,YAAiG;AAC1G;AAAA,EACE;AAAA,OAOK;AAGP,SAAS,aAA8B;AACvC,SAAS,gBAAoC;AAC7C,SAAS,cAAmD;AAC5D,SAAS,gBAAoC;AAC7C,SAAS,aAA8B;AACvC,SAAS,cAAgC;AACzC,SAAS,sBAA+D;AACxE,SAAS,kBAAwC;AACjD,SAAS,kBAAwC;AACjD,SAAS,oBAA4C;AACrD,SAAS,mBAA0C;AAGnD,SAAS,cAAyG;AAClH,SAAS,YAAwF;AACjG,SAAS,iBAA+D;AACxE;AAAA,EACE;AAAA,OAKK;AACP,SAAS,eAAyD;AAGlE,SAAS,aAA8B;AACvC,SAAS,aAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAMK;AACP,SAAS,cAAsG;AAC/G,SAAS,gBAAoC;AAC7C,SAAS,kBAAwC;AAGjD,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sereno-ds/ui",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Sereno Design System — React primitives (token-driven, inline styles, no UI base lib).",
5
5
  "license": "MIT",
6
6
  "author": "Sereno",