orbital-ds 0.28.0 → 0.30.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.
Files changed (137) hide show
  1. package/AGENTS.md +303 -273
  2. package/components.manifest.json +526 -12
  3. package/dist/hooks/use-ds-messages.d.ts +205 -0
  4. package/dist/lib/auth-better-auth.d.ts +29 -0
  5. package/dist/lib/auth-better-auth.js +60 -0
  6. package/dist/lib/auth-flow.d.ts +83 -0
  7. package/dist/lib/auth-flow.js +152 -0
  8. package/dist/lib/auth-providers.d.ts +194 -0
  9. package/dist/lib/auth-providers.js +64 -0
  10. package/dist/lib/auth.d.ts +68 -0
  11. package/dist/lib/auth.js +110 -0
  12. package/dist/lib/header-control.d.ts +4 -0
  13. package/dist/lib/header-control.js +14 -0
  14. package/dist/lib/i18n.d.ts +205 -0
  15. package/dist/lib/i18n.js +624 -3
  16. package/dist/ui/app-bar.d.ts +10 -0
  17. package/dist/ui/app-bar.js +51 -0
  18. package/dist/ui/attachment.js +1 -1
  19. package/dist/ui/auth-backdrop.d.ts +20 -0
  20. package/dist/ui/auth-backdrop.js +137 -0
  21. package/dist/ui/auth-form.d.ts +111 -0
  22. package/dist/ui/auth-form.js +531 -0
  23. package/dist/ui/auth-layout.d.ts +70 -0
  24. package/dist/ui/auth-layout.js +283 -0
  25. package/dist/ui/auth-parts.d.ts +43 -0
  26. package/dist/ui/auth-parts.js +159 -0
  27. package/dist/ui/auth-status.d.ts +23 -0
  28. package/dist/ui/auth-status.js +99 -0
  29. package/dist/ui/badge.js +2 -2
  30. package/dist/ui/button.js +1 -1
  31. package/dist/ui/connected-accounts.d.ts +25 -0
  32. package/dist/ui/connected-accounts.js +89 -0
  33. package/dist/ui/content-card.d.ts +6 -2
  34. package/dist/ui/content-card.js +27 -3
  35. package/dist/ui/dropzone.js +1 -1
  36. package/dist/ui/empty-state.d.ts +10 -1
  37. package/dist/ui/empty-state.js +28 -7
  38. package/dist/ui/error-page.d.ts +10 -1
  39. package/dist/ui/error-page.js +74 -28
  40. package/dist/ui/icon-tile.d.ts +1 -1
  41. package/dist/ui/input-otp.js +2 -1
  42. package/dist/ui/item.js +1 -1
  43. package/dist/ui/legend.js +1 -1
  44. package/dist/ui/locale-switcher.d.ts +19 -0
  45. package/dist/ui/locale-switcher.js +54 -0
  46. package/dist/ui/menubar.js +1 -1
  47. package/dist/ui/message-scroller.js +1 -1
  48. package/dist/ui/mfa-challenge.d.ts +33 -0
  49. package/dist/ui/mfa-challenge.js +214 -0
  50. package/dist/ui/mfa-setup.d.ts +29 -0
  51. package/dist/ui/mfa-setup.js +196 -0
  52. package/dist/ui/navigation-menu.js +2 -2
  53. package/dist/ui/notice-review.d.ts +1 -0
  54. package/dist/ui/notifications.d.ts +12 -2
  55. package/dist/ui/notifications.js +28 -5
  56. package/dist/ui/oauth-consent.d.ts +54 -0
  57. package/dist/ui/oauth-consent.js +208 -0
  58. package/dist/ui/passkey-list.d.ts +17 -0
  59. package/dist/ui/passkey-list.js +112 -0
  60. package/dist/ui/password-input.d.ts +5 -0
  61. package/dist/ui/password-input.js +77 -0
  62. package/dist/ui/session-list.d.ts +19 -0
  63. package/dist/ui/session-list.js +70 -0
  64. package/dist/ui/session-timeout.d.ts +13 -0
  65. package/dist/ui/session-timeout.js +87 -0
  66. package/dist/ui/sidebar.d.ts +27 -5
  67. package/dist/ui/sidebar.js +56 -11
  68. package/dist/ui/sign-out-dialog.d.ts +17 -0
  69. package/dist/ui/sign-out-dialog.js +82 -0
  70. package/dist/ui/stat-group.d.ts +1 -1
  71. package/dist/ui/stat-group.js +6 -2
  72. package/dist/ui/stat.d.ts +24 -5
  73. package/dist/ui/stat.js +124 -19
  74. package/dist/ui/status-badge.d.ts +1 -1
  75. package/dist/ui/theme-toggle.d.ts +14 -0
  76. package/dist/ui/theme-toggle.js +112 -0
  77. package/dist/ui/toggle.js +2 -2
  78. package/dist/ui/week-strip.js +1 -1
  79. package/docs/CONTRACT.md +1 -1
  80. package/docs/designer/patrones.md +27 -0
  81. package/docs/designer/revision.md +8 -0
  82. package/package.json +3 -2
  83. package/scripts/brand-core.d.mts +2 -0
  84. package/scripts/brand-core.mjs +21 -1
  85. package/scripts/cli.mjs +452 -452
  86. package/scripts/doctor.mjs +3 -0
  87. package/scripts/init.mjs +7 -3
  88. package/dist/motion.css +0 -146
  89. package/dist/styles.css +0 -1240
  90. package/dist/themes/fractalia.css +0 -549
  91. package/dist/themes/fractalia.fonts.css +0 -3
  92. package/dist/themes/fractalia.guide.md +0 -86
  93. package/dist/themes/fractalia.meta.json +0 -112
  94. package/dist/themes/fractalia.scoped.css +0 -549
  95. package/dist/themes/fractalia.tokens.json +0 -39
  96. package/dist/themes/friendly.css +0 -367
  97. package/dist/themes/friendly.fonts.css +0 -2
  98. package/dist/themes/friendly.guide.md +0 -38
  99. package/dist/themes/friendly.meta.json +0 -82
  100. package/dist/themes/friendly.scoped.css +0 -367
  101. package/dist/themes/friendly.tokens.json +0 -45
  102. package/dist/themes/lagoon.css +0 -348
  103. package/dist/themes/lagoon.fonts.css +0 -2
  104. package/dist/themes/lagoon.guide.md +0 -47
  105. package/dist/themes/lagoon.meta.json +0 -84
  106. package/dist/themes/lagoon.scoped.css +0 -348
  107. package/dist/themes/lagoon.tokens.json +0 -49
  108. package/dist/themes/liquid.css +0 -502
  109. package/dist/themes/liquid.fonts.css +0 -7
  110. package/dist/themes/liquid.guide.md +0 -82
  111. package/dist/themes/liquid.meta.json +0 -134
  112. package/dist/themes/liquid.scoped.css +0 -502
  113. package/dist/themes/liquid.tokens.json +0 -47
  114. package/dist/themes/qratia.css +0 -260
  115. package/dist/themes/qratia.fonts.css +0 -2
  116. package/dist/themes/qratia.guide.md +0 -34
  117. package/dist/themes/qratia.meta.json +0 -49
  118. package/dist/themes/qratia.scoped.css +0 -260
  119. package/dist/themes/qratia.tokens.json +0 -49
  120. package/dist/themes/tactile.css +0 -588
  121. package/dist/themes/tactile.fonts.css +0 -3
  122. package/dist/themes/tactile.guide.md +0 -82
  123. package/dist/themes/tactile.meta.json +0 -182
  124. package/dist/themes/tactile.scoped.css +0 -588
  125. package/dist/themes/tactile.tokens.json +0 -42
  126. package/dist/themes/twitter.css +0 -357
  127. package/dist/themes/twitter.fonts.css +0 -6
  128. package/dist/themes/twitter.guide.md +0 -35
  129. package/dist/themes/twitter.meta.json +0 -90
  130. package/dist/themes/twitter.scoped.css +0 -357
  131. package/dist/themes/twitter.tokens.json +0 -45
  132. package/dist/themes/zyro.css +0 -434
  133. package/dist/themes/zyro.fonts.css +0 -2
  134. package/dist/themes/zyro.guide.md +0 -33
  135. package/dist/themes/zyro.meta.json +0 -74
  136. package/dist/themes/zyro.scoped.css +0 -434
  137. package/dist/themes/zyro.tokens.json +0 -46
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { AlertTriangleIcon, CheckCircle2Icon, PlugIcon } from "lucide-react";
4
+ import * as React from "react";
5
+ import { useDsMessages } from "../hooks/use-ds-messages.js";
6
+ import { cn } from "../lib/utils.js";
7
+ import { Badge } from "./badge.js";
8
+ import { Button } from "./button.js";
9
+ import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from "./item.js";
10
+ import { Spinner } from "./spinner.js";
11
+ function ConnectedAccounts({
12
+ preset = "social",
13
+ items,
14
+ onConnect,
15
+ onDisconnect,
16
+ keepOne,
17
+ className,
18
+ ...props
19
+ }) {
20
+ const t = useDsMessages();
21
+ const [busy, setBusy] = React.useState(null);
22
+ const guard = keepOne ?? preset === "social";
23
+ const connected = items.filter((i) => i.status === "connected" || i.status === "expired" || i.status === "error").length;
24
+ async function act(id, task) {
25
+ if (!task) return;
26
+ setBusy(id);
27
+ try {
28
+ await task(id);
29
+ } finally {
30
+ setBusy(null);
31
+ }
32
+ }
33
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "connected-accounts", "data-preset": preset, className: cn("flex flex-col gap-2", className), ...props, children: [
34
+ /* @__PURE__ */ jsx(ItemGroup, { className: "gap-2", children: items.map((item) => {
35
+ const isBusy = busy === item.id || item.status === "pending";
36
+ const linked = item.status !== "disconnected" && item.status !== "pending";
37
+ const last = guard && linked && connected <= 1;
38
+ const statusBadge = item.status === "connected" ? /* @__PURE__ */ jsxs(Badge, { variant: "success", children: [
39
+ /* @__PURE__ */ jsx(CheckCircle2Icon, {}),
40
+ t.authConnConnected
41
+ ] }) : item.status === "expired" ? /* @__PURE__ */ jsxs(Badge, { variant: "warning", children: [
42
+ /* @__PURE__ */ jsx(AlertTriangleIcon, {}),
43
+ t.authConnExpired
44
+ ] }) : item.status === "error" ? /* @__PURE__ */ jsxs(Badge, { variant: "danger", children: [
45
+ /* @__PURE__ */ jsx(AlertTriangleIcon, {}),
46
+ t.authConnError
47
+ ] }) : null;
48
+ return /* @__PURE__ */ jsxs(Item, { variant: "card", size: "sm", "data-slot": "connected-account", "data-status": item.status, "data-provider": item.id, children: [
49
+ /* @__PURE__ */ jsx(ItemMedia, { variant: "image", className: "bg-muted text-muted-foreground [&_svg]:size-5", children: item.icon ?? /* @__PURE__ */ jsx(PlugIcon, {}) }),
50
+ /* @__PURE__ */ jsxs(ItemContent, { children: [
51
+ /* @__PURE__ */ jsxs(ItemTitle, { children: [
52
+ item.label,
53
+ statusBadge
54
+ ] }),
55
+ /* @__PURE__ */ jsx(ItemDescription, { children: item.account ?? item.description ?? (linked ? null : t.authConnNotConnected) }),
56
+ item.detail ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: item.detail }) : null
57
+ ] }),
58
+ /* @__PURE__ */ jsx(ItemActions, { children: item.status === "disconnected" ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: isBusy, onClick: () => void act(item.id, onConnect), children: [
59
+ isBusy ? /* @__PURE__ */ jsx(Spinner, {}) : null,
60
+ t.authConnConnect
61
+ ] }) : item.status === "pending" ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: true, children: [
62
+ /* @__PURE__ */ jsx(Spinner, {}),
63
+ t.authConnPending
64
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
65
+ item.status === "expired" || item.status === "error" ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", disabled: isBusy, onClick: () => void act(item.id, onConnect), children: [
66
+ isBusy ? /* @__PURE__ */ jsx(Spinner, {}) : null,
67
+ t.authConnReconnect
68
+ ] }) : null,
69
+ /* @__PURE__ */ jsx(
70
+ Button,
71
+ {
72
+ type: "button",
73
+ size: "sm",
74
+ variant: "ghost",
75
+ disabled: isBusy || last,
76
+ title: last ? t.authConnLastMethod : void 0,
77
+ onClick: () => void act(item.id, onDisconnect),
78
+ children: t.authConnDisconnect
79
+ }
80
+ )
81
+ ] }) })
82
+ ] }, item.id);
83
+ }) }),
84
+ guard && connected <= 1 && items.some((i) => i.status === "connected") ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t.authConnLastMethod }) : null
85
+ ] });
86
+ }
87
+ export {
88
+ ConnectedAccounts
89
+ };
@@ -4,9 +4,9 @@ import { IconTile } from './icon-tile.js';
4
4
  import 'class-variance-authority/types';
5
5
  import 'class-variance-authority';
6
6
 
7
- type ContentCardPreset = "basic" | "feature" | "media" | "horizontal";
7
+ type ContentCardPreset = "basic" | "feature" | "media" | "horizontal" | "metric" | "status";
8
8
  type ContentCardEmphasis = "elevated" | "outlined" | "filled" | "ghost";
9
- declare function ContentCard({ preset, emphasis, tone, density, icon, media, title, description, action, footer, href, onSelect, children, className, }: {
9
+ declare function ContentCard({ preset, emphasis, tone, density, icon, media, value, delta, title, description, action, footer, href, onSelect, children, className, }: {
10
10
  preset?: ContentCardPreset;
11
11
  emphasis?: ContentCardEmphasis;
12
12
  tone?: React.ComponentProps<typeof IconTile>["tone"];
@@ -15,6 +15,10 @@ declare function ContentCard({ preset, emphasis, tone, density, icon, media, tit
15
15
  icon?: React.ReactNode;
16
16
  /** Portada (preset media y horizontal): imagen, vídeo o cualquier nodo. */
17
17
  media?: React.ReactNode;
18
+ /** Dato grande (preset metric). */
19
+ value?: React.ReactNode;
20
+ /** Variación junto al dato (preset metric): «+4,2 %». */
21
+ delta?: React.ReactNode;
18
22
  title: React.ReactNode;
19
23
  description?: React.ReactNode;
20
24
  /** Acción de la cabecera (menú, botón de icono); sigue pulsable en una tarjeta interactiva. */
@@ -11,6 +11,15 @@ const EMPHASIS = {
11
11
  filled: "border-transparent bg-muted shadow-none hover:shadow-none",
12
12
  ghost: "border-transparent bg-transparent shadow-none hover:shadow-none"
13
13
  };
14
+ const STATUS_DOT = {
15
+ neutral: "bg-muted-foreground",
16
+ primary: "bg-primary",
17
+ accent: "bg-primary",
18
+ info: "bg-info",
19
+ success: "bg-success",
20
+ warning: "bg-warning",
21
+ danger: "bg-danger"
22
+ };
14
23
  const DENSITY = {
15
24
  compact: "[--ds-card-spacing:var(--ds-card-spacing-sm)] gap-2",
16
25
  default: "",
@@ -23,6 +32,8 @@ function ContentCard({
23
32
  density = "default",
24
33
  icon,
25
34
  media,
35
+ value,
36
+ delta,
26
37
  title,
27
38
  description,
28
39
  action,
@@ -36,12 +47,13 @@ function ContentCard({
36
47
  if (href && onSelect) dsWarn("ContentCard", "use either `href` or `onSelect`, not both.");
37
48
  if ((preset === "media" || preset === "horizontal") && !media)
38
49
  dsWarn("ContentCard", `preset="${preset}" needs the \`media\` prop.`);
39
- }, [href, onSelect, preset, media]);
50
+ if (preset === "metric" && value == null) dsWarn("ContentCard", 'preset="metric" needs the `value` prop.');
51
+ }, [href, onSelect, preset, media, value]);
40
52
  const interactive = Boolean(href || onSelect);
41
53
  const stretch = "after:absolute after:inset-0 after:content-[''] outline-none after:rounded-card focus-visible:after:ring-(length:--ds-ring-width) focus-visible:after:ring-(--ds-ring-color)";
42
54
  const titleNode = href ? /* @__PURE__ */ jsx("a", { href, className: stretch, children: title }) : onSelect ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onSelect, className: cn("text-start", stretch), children: title }) : title;
43
55
  const horizontal = preset === "horizontal";
44
- const showIcon = icon && preset !== "media" && preset !== "horizontal";
56
+ const showIcon = icon && preset !== "media" && preset !== "horizontal" && preset !== "metric" && preset !== "status";
45
57
  return /* @__PURE__ */ jsxs(
46
58
  Card,
47
59
  {
@@ -54,7 +66,7 @@ function ContentCard({
54
66
  "@container/content-card relative",
55
67
  EMPHASIS[emphasis],
56
68
  DENSITY[density],
57
- interactive && "cursor-pointer hover:bg-muted/40",
69
+ interactive && "cursor-pointer hover:bg-(--ds-row-hover)",
58
70
  horizontal && "@md/content-card:flex-row @md/content-card:py-0",
59
71
  className
60
72
  ),
@@ -73,10 +85,22 @@ function ContentCard({
73
85
  /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col gap-(--ds-card-spacing)", horizontal && "@md/content-card:py-(--ds-card-spacing)"), children: [
74
86
  /* @__PURE__ */ jsxs(CardHeader, { children: [
75
87
  showIcon ? /* @__PURE__ */ jsx(IconTile, { tone, size: "md", className: "mb-1", children: icon }) : null,
88
+ preset === "status" ? /* @__PURE__ */ jsx(
89
+ "span",
90
+ {
91
+ "data-slot": "content-card-dot",
92
+ "aria-hidden": "true",
93
+ className: cn("mb-1 block size-(--ds-status-dot) rounded-full", STATUS_DOT[tone ?? "neutral"])
94
+ }
95
+ ) : null,
76
96
  /* @__PURE__ */ jsx(CardTitle, { children: titleNode }),
77
97
  description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
78
98
  action ? /* @__PURE__ */ jsx(CardAction, { className: "relative z-(--ds-z-raised)", children: action }) : null
79
99
  ] }),
100
+ preset === "metric" && value != null ? /* @__PURE__ */ jsxs(CardContent, { "data-slot": "content-card-value", className: "flex items-baseline gap-2", children: [
101
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-(--ds-stat-value-weight) tracking-tight tabular-nums", children: value }),
102
+ delta ? /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-muted-foreground tabular-nums", children: delta }) : null
103
+ ] }) : null,
80
104
  children ? /* @__PURE__ */ jsx(CardContent, { children }) : null,
81
105
  footer ? /* @__PURE__ */ jsx(CardFooter, { className: "relative z-(--ds-z-raised) gap-2", children: footer }) : null
82
106
  ] })
@@ -142,7 +142,7 @@ function Dropzone({
142
142
  handle(e.dataTransfer.files);
143
143
  },
144
144
  className: cn(
145
- "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-card border-(length:--ds-rule-w) border-dashed border-border bg-(--ds-field-bg) p-(--ds-dropzone-p) text-center text-sm transition-colors duration-(--ds-motion-snap) hover:bg-muted/50",
145
+ "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-card border-(length:--ds-rule-w) border-dashed border-border bg-(--ds-field-bg) p-(--ds-dropzone-p) text-center text-sm transition-colors duration-(--ds-motion-snap) hover:bg-(--ds-row-hover)",
146
146
  "has-[input:focus-visible]:border-ring has-[input:focus-visible]:ring-(length:--ds-ring-width) has-[input:focus-visible]:ring-(--ds-ring-color)",
147
147
  "data-[state=drag-over]:border-primary data-[state=drag-over]:bg-accent data-[state=drag-over]:text-accent-foreground",
148
148
  "data-[state=error]:border-danger data-[state=error]:bg-danger-soft",
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
+ import { AuthBackdropVariant } from './auth-backdrop.js';
2
3
  import { Empty } from './empty.js';
3
4
  import 'class-variance-authority/types';
4
5
  import 'class-variance-authority';
5
6
 
6
7
  type EmptyStatePreset = "first-use" | "no-results" | "error" | "forbidden";
7
- declare function EmptyState({ preset, title, description, icon, action, className, ...props }: Omit<React.ComponentProps<typeof Empty>, "title"> & {
8
+ declare function EmptyState({ preset, title, description, icon, action, backdrop, backdropMedia, backdropGlass, animated, className, children, ...props }: Omit<React.ComponentProps<typeof Empty>, "title"> & {
8
9
  preset?: EmptyStatePreset;
9
10
  title?: React.ReactNode;
10
11
  description?: React.ReactNode;
@@ -12,6 +13,14 @@ declare function EmptyState({ preset, title, description, icon, action, classNam
12
13
  icon?: React.ReactNode;
13
14
  /** Acción principal (botón o enlace); la pone la app. */
14
15
  action?: React.ReactNode;
16
+ /** Fondo decorativo detrás (ver AuthBackdrop): mesh, aurora, dots, image… Por defecto, ninguno. */
17
+ backdrop?: AuthBackdropVariant;
18
+ /** backdrop="image": la foto o el vídeo (un <img>/<video> con alt=""), teñido de marca. */
19
+ backdropMedia?: React.ReactNode;
20
+ /** Cristal esmerilado sobre el fondo («mesh + glass»). */
21
+ backdropGlass?: boolean;
22
+ /** Entrada en cascada y el icono flotando con el ritmo del tema (quieto con movimiento reducido). */
23
+ animated?: boolean;
15
24
  }): React.JSX.Element;
16
25
 
17
26
  export { EmptyState, type EmptyStatePreset };
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { InboxIcon, LockIcon, SearchXIcon, TriangleAlertIcon } from "lucide-react";
4
4
  import { useDsMessages } from "../hooks/use-ds-messages.js";
5
5
  import { cn } from "../lib/utils.js";
6
+ import { AuthBackdrop } from "./auth-backdrop.js";
6
7
  import {
7
8
  Empty,
8
9
  EmptyContent,
@@ -23,7 +24,12 @@ function EmptyState({
23
24
  description,
24
25
  icon,
25
26
  action,
27
+ backdrop = "none",
28
+ backdropMedia,
29
+ backdropGlass = false,
30
+ animated = false,
26
31
  className,
32
+ children,
27
33
  ...props
28
34
  }) {
29
35
  const t = useDsMessages();
@@ -34,21 +40,36 @@ function EmptyState({
34
40
  error: [t.emptyErrorTitle, t.emptyErrorBody],
35
41
  forbidden: [t.emptyForbiddenTitle, t.emptyForbiddenBody]
36
42
  }[preset];
43
+ const withFx = backdrop !== "none" || backdropGlass;
44
+ const enter = (i) => animated ? { className: "animate-ds-stagger motion-reduce:animate-none", style: { "--ds-stagger-i": i } } : {};
37
45
  return /* @__PURE__ */ jsxs(
38
46
  Empty,
39
47
  {
40
48
  "data-slot": "empty-state",
41
49
  "data-preset": preset,
50
+ "data-backdrop": withFx ? backdrop : void 0,
51
+ "data-animated": animated || void 0,
42
52
  role: preset === "error" ? "alert" : void 0,
43
- className: cn("border border-border", className),
53
+ className: cn("border border-border", withFx && "relative isolate overflow-hidden", className),
44
54
  ...props,
45
55
  children: [
46
- /* @__PURE__ */ jsxs(EmptyHeader, { children: [
47
- /* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", className: cn(preset === "error" && "text-danger"), children: icon ?? /* @__PURE__ */ jsx(Icon, {}) }),
48
- /* @__PURE__ */ jsx(EmptyTitle, { children: title ?? texts[0] }),
49
- /* @__PURE__ */ jsx(EmptyDescription, { children: description ?? texts[1] })
50
- ] }),
51
- action ? /* @__PURE__ */ jsx(EmptyContent, { children: action }) : null
56
+ withFx ? /* @__PURE__ */ jsx(AuthBackdrop, { variant: backdrop, media: backdropMedia, glass: backdropGlass, animated }) : null,
57
+ /* @__PURE__ */ jsxs(
58
+ "div",
59
+ {
60
+ "data-slot": "empty-state-content",
61
+ className: cn(withFx ? ["max-w-sm gap-4 p-(--ds-auth-p-sm)", "relative flex w-full flex-col items-center rounded-(--ds-auth-radius) border border-(--ds-auth-border) bg-(--ds-backdrop-plate-bg) shadow-(--ds-auth-shadow-elevated) [backdrop-filter:var(--ds-auth-glass-filter)]"] : "contents"),
62
+ children: [
63
+ /* @__PURE__ */ jsxs(EmptyHeader, { children: [
64
+ /* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", className: cn(preset === "error" && "text-danger", enter(0).className), style: enter(0).style, children: /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center leading-none", animated && "animate-ds-float motion-reduce:animate-none"), children: icon ?? /* @__PURE__ */ jsx(Icon, {}) }) }),
65
+ /* @__PURE__ */ jsx(EmptyTitle, { className: enter(1).className, style: enter(1).style, children: title ?? texts[0] }),
66
+ /* @__PURE__ */ jsx(EmptyDescription, { className: enter(2).className, style: enter(2).style, children: description ?? texts[1] })
67
+ ] }),
68
+ action ? /* @__PURE__ */ jsx(EmptyContent, { className: enter(3).className, style: enter(3).style, children: action }) : null
69
+ ]
70
+ }
71
+ ),
72
+ children
52
73
  ]
53
74
  }
54
75
  );
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { AuthBackdropVariant } from './auth-backdrop.js';
2
3
 
3
4
  type ErrorPagePreset = "not-found" | "forbidden" | "server-error" | "offline" | "maintenance";
4
5
  type ErrorPageTone = "neutral" | "playful";
5
- declare function ErrorPage({ preset, tone, code, title, description, illustration, actions, className, ...props }: Omit<React.ComponentProps<"main">, "title"> & {
6
+ declare function ErrorPage({ preset, tone, code, title, description, illustration, actions, backdrop, backdropMedia, backdropGlass, animated, className, style, ...props }: Omit<React.ComponentProps<"main">, "title"> & {
6
7
  preset?: ErrorPagePreset;
7
8
  /** Tono de los textos por defecto. */
8
9
  tone?: ErrorPageTone;
@@ -14,6 +15,14 @@ declare function ErrorPage({ preset, tone, code, title, description, illustratio
14
15
  illustration?: React.ReactNode;
15
16
  /** Botones o enlaces de la app; el primero es el principal. */
16
17
  actions?: React.ReactNode;
18
+ /** Fondo decorativo detrás (ver AuthBackdrop): mesh, aurora, dots, image… Por defecto, ninguno. */
19
+ backdrop?: AuthBackdropVariant;
20
+ /** backdrop="image": la foto o el vídeo (un <img>/<video> con alt=""), teñido de marca. */
21
+ backdropMedia?: React.ReactNode;
22
+ /** Cristal esmerilado sobre el fondo («mesh + glass»). */
23
+ backdropGlass?: boolean;
24
+ /** Entrada en cascada y el icono flotando con el ritmo del tema (quieto con movimiento reducido). */
25
+ animated?: boolean;
17
26
  }): React.JSX.Element;
18
27
 
19
28
  export { ErrorPage, type ErrorPagePreset, type ErrorPageTone };
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CloudOffIcon, CompassIcon, LockIcon, ServerCrashIcon, WrenchIcon } from "lucide-react";
4
4
  import { useDsMessages } from "../hooks/use-ds-messages.js";
5
5
  import { cn } from "../lib/utils.js";
6
+ import { AuthBackdrop } from "./auth-backdrop.js";
6
7
  const META = {
7
8
  "not-found": { code: "404", icon: CompassIcon, alert: false },
8
9
  forbidden: { code: "403", icon: LockIcon, alert: false },
@@ -18,7 +19,12 @@ function ErrorPage({
18
19
  description,
19
20
  illustration,
20
21
  actions,
22
+ backdrop = "none",
23
+ backdropMedia,
24
+ backdropGlass = false,
25
+ animated = false,
21
26
  className,
27
+ style,
22
28
  ...props
23
29
  }) {
24
30
  const t = useDsMessages();
@@ -40,49 +46,89 @@ function ErrorPage({
40
46
  };
41
47
  const texts = (tone === "playful" ? playful : neutral)[preset];
42
48
  const shownCode = code === void 0 ? meta.code : code;
49
+ const withFx = backdrop !== "none" || backdropGlass;
50
+ let step = 0;
51
+ const enter = () => animated ? { className: "animate-ds-stagger motion-reduce:animate-none", style: { "--ds-stagger-i": step++ } } : { className: "", style: void 0 };
52
+ const iconIn = enter();
53
+ const codeIn = shownCode ? enter() : null;
54
+ const textIn = enter();
55
+ const actionsIn = actions ? enter() : null;
43
56
  return /* @__PURE__ */ jsxs(
44
57
  "main",
45
58
  {
46
59
  "data-slot": "error-page",
47
60
  "data-preset": preset,
48
61
  "data-tone": tone,
62
+ "data-backdrop": withFx ? backdrop : void 0,
63
+ "data-animated": animated || void 0,
49
64
  role: meta.alert ? "alert" : void 0,
50
65
  className: cn(
51
66
  "mx-auto flex min-h-(--ds-errorpage-min-h) w-full max-w-(--ds-errorpage-max-w) flex-col items-center justify-center gap-(--ds-errorpage-gap) px-4 py-12 text-center",
52
- "animate-in fade-in duration-(--ds-motion-base) ease-(--ds-ease-enter) motion-reduce:animate-none",
67
+ withFx && "relative isolate max-w-none overflow-hidden",
68
+ !animated && "animate-in fade-in duration-(--ds-motion-base) ease-(--ds-ease-enter) motion-reduce:animate-none",
53
69
  className
54
70
  ),
71
+ style,
55
72
  ...props,
56
73
  children: [
57
- /* @__PURE__ */ jsx(
58
- "span",
74
+ withFx ? /* @__PURE__ */ jsx(AuthBackdrop, { variant: backdrop, media: backdropMedia, glass: backdropGlass, animated }) : null,
75
+ /* @__PURE__ */ jsxs(
76
+ "div",
59
77
  {
60
- "aria-hidden": "true",
61
- className: "grid size-(--ds-errorpage-icon-box) place-items-center rounded-full bg-muted text-muted-foreground [&>svg]:size-(--ds-errorpage-icon)",
62
- children: illustration ?? /* @__PURE__ */ jsx(Icon, {})
78
+ "data-slot": "error-page-content",
79
+ className: cn(
80
+ "flex w-full flex-col items-center gap-(--ds-errorpage-gap)",
81
+ withFx && ["max-w-(--ds-errorpage-max-w) p-(--ds-auth-p-sm)", "relative flex w-full flex-col items-center rounded-(--ds-auth-radius) border border-(--ds-auth-border) bg-(--ds-backdrop-plate-bg) shadow-(--ds-auth-shadow-elevated) [backdrop-filter:var(--ds-auth-glass-filter)]"]
82
+ ),
83
+ children: [
84
+ /* @__PURE__ */ jsx(
85
+ "span",
86
+ {
87
+ "aria-hidden": "true",
88
+ className: cn(
89
+ "flex size-(--ds-errorpage-icon-box) shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:size-(--ds-errorpage-icon)",
90
+ iconIn.className
91
+ ),
92
+ style: iconIn.style,
93
+ children: /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center leading-none", animated && "animate-ds-float motion-reduce:animate-none"), children: illustration ?? /* @__PURE__ */ jsx(Icon, {}) })
94
+ }
95
+ ),
96
+ shownCode && codeIn ? /* @__PURE__ */ jsx(
97
+ "p",
98
+ {
99
+ "data-slot": "error-page-code",
100
+ "aria-hidden": "true",
101
+ className: cn(
102
+ "text-(length:--ds-errorpage-code-size) leading-none font-(--ds-heading-weight) text-muted-foreground tabular-nums",
103
+ codeIn.className
104
+ ),
105
+ style: codeIn.style,
106
+ children: shownCode
107
+ }
108
+ ) : null,
109
+ /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", textIn.className), style: textIn.style, children: [
110
+ /* @__PURE__ */ jsx(
111
+ "h1",
112
+ {
113
+ "data-slot": "error-page-title",
114
+ className: "text-(length:--ds-page-title-size) leading-tight font-(--ds-heading-weight) text-foreground",
115
+ children: title ?? texts[0]
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsx("p", { "data-slot": "error-page-description", className: "max-w-prose text-sm text-muted-foreground", children: description ?? texts[1] })
119
+ ] }),
120
+ actions ? /* @__PURE__ */ jsx(
121
+ "div",
122
+ {
123
+ "data-slot": "error-page-actions",
124
+ className: cn("flex flex-wrap items-center justify-center gap-2", actionsIn?.className),
125
+ style: actionsIn?.style,
126
+ children: actions
127
+ }
128
+ ) : null
129
+ ]
63
130
  }
64
- ),
65
- shownCode ? /* @__PURE__ */ jsx(
66
- "p",
67
- {
68
- "data-slot": "error-page-code",
69
- "aria-hidden": "true",
70
- className: "text-(length:--ds-errorpage-code-size) leading-none font-(--ds-heading-weight) text-muted-foreground tabular-nums",
71
- children: shownCode
72
- }
73
- ) : null,
74
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
75
- /* @__PURE__ */ jsx(
76
- "h1",
77
- {
78
- "data-slot": "error-page-title",
79
- className: "text-(length:--ds-page-title-size) leading-tight font-(--ds-heading-weight) text-foreground",
80
- children: title ?? texts[0]
81
- }
82
- ),
83
- /* @__PURE__ */ jsx("p", { "data-slot": "error-page-description", className: "max-w-prose text-sm text-muted-foreground", children: description ?? texts[1] })
84
- ] }),
85
- actions ? /* @__PURE__ */ jsx("div", { "data-slot": "error-page-actions", className: "flex flex-wrap items-center justify-center gap-2", children: actions }) : null
131
+ )
86
132
  ]
87
133
  }
88
134
  );
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
3
3
  import * as React from 'react';
4
4
 
5
5
  declare const iconTileVariants: (props?: ({
6
- tone?: "info" | "success" | "warning" | "danger" | "primary" | "neutral" | "accent" | null | undefined;
6
+ tone?: "info" | "success" | "warning" | "danger" | "neutral" | "primary" | "accent" | null | undefined;
7
7
  size?: "sm" | "lg" | "md" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  declare function IconTile({ className, tone, size, ...props }: React.ComponentProps<"div"> & VariantProps<typeof iconTileVariants>): React.JSX.Element;
@@ -47,13 +47,14 @@ function InputOTPSlot({
47
47
  {
48
48
  "data-slot": "input-otp-slot",
49
49
  "data-active": isActive,
50
+ "data-filled": char ? true : void 0,
50
51
  className: cn(
51
52
  "relative flex size-(--ds-control-h-md) items-center justify-center border-y border-r border-input bg-(--ds-field-bg) text-sm transition-all duration-(--ds-motion-snap) outline-none first:rounded-l-control first:border-l last:rounded-r-control aria-invalid:border-(--ds-invalid-border) data-[active=true]:z-(--ds-z-raised) data-[active=true]:border-ring data-[active=true]:ring-(length:--ds-ring-width) data-[active=true]:ring-(--ds-ring-color) data-[active=true]:aria-invalid:border-(--ds-invalid-border) data-[active=true]:aria-invalid:ring-(--ds-invalid-ring)",
52
53
  className
53
54
  ),
54
55
  ...props,
55
56
  children: [
56
- char,
57
+ char ? /* @__PURE__ */ jsx("span", { "data-slot": "input-otp-char", className: "animate-ds-otp-char", children: char }, char) : null,
57
58
  hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-(--ds-motion-blink)" }) })
58
59
  ]
59
60
  }
package/dist/ui/item.js CHANGED
@@ -37,7 +37,7 @@ function ItemSeparator({
37
37
  );
38
38
  }
39
39
  const itemVariants = cva(
40
- "group/item flex w-full flex-wrap items-center rounded-panel border text-sm transition-colors duration-(--ds-motion-fast) outline-none focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) [a]:transition-colors [a]:hover:bg-muted",
40
+ "group/item flex w-full flex-wrap items-center rounded-panel border text-sm transition-colors duration-(--ds-motion-fast) outline-none focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) [a]:transition-colors [a]:hover:bg-(--ds-hover-bg)",
41
41
  {
42
42
  variants: {
43
43
  variant: {
package/dist/ui/legend.js CHANGED
@@ -119,7 +119,7 @@ function LegendItem({
119
119
  "aria-pressed": active,
120
120
  onClick: () => onToggle(!active),
121
121
  className: cn(
122
- "-mx-1 flex min-w-0 flex-1 items-center gap-2 rounded-xs px-1 outline-hidden transition-opacity duration-(--ds-motion-fast) hover:bg-muted focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) motion-reduce:transition-none",
122
+ "-mx-1 flex min-w-0 flex-1 items-center gap-2 rounded-xs px-1 outline-hidden transition-opacity duration-(--ds-motion-fast) hover:bg-(--ds-hover-bg) focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) motion-reduce:transition-none",
123
123
  !active && "opacity-(--ds-disabled-opacity) [&_[data-slot=legend-label]]:line-through"
124
124
  ),
125
125
  children: content
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { HeaderControlTone } from '../lib/header-control.js';
3
+
4
+ type LocaleOption = {
5
+ value: string;
6
+ label: string;
7
+ short?: string;
8
+ };
9
+ type LocaleSwitcherPreset = "compact" | "menu";
10
+ declare function LocaleSwitcher({ locales, value, onValueChange, preset, tone, className, }: {
11
+ locales: LocaleOption[];
12
+ value: string;
13
+ onValueChange?: (value: string) => void;
14
+ preset?: LocaleSwitcherPreset;
15
+ tone?: HeaderControlTone;
16
+ className?: string;
17
+ }): React.JSX.Element;
18
+
19
+ export { type LocaleOption, LocaleSwitcher, type LocaleSwitcherPreset };
@@ -0,0 +1,54 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { LanguagesIcon } from "lucide-react";
3
+ import { useDsMessages } from "../hooks/use-ds-messages.js";
4
+ import { headerControlClass } from "../lib/header-control.js";
5
+ import { cn } from "../lib/utils.js";
6
+ import { Button } from "./button.js";
7
+ import {
8
+ DropdownMenu,
9
+ DropdownMenuContent,
10
+ DropdownMenuRadioGroup,
11
+ DropdownMenuRadioItem,
12
+ DropdownMenuTrigger
13
+ } from "./dropdown-menu.js";
14
+ function LocaleSwitcher({
15
+ locales,
16
+ value,
17
+ onValueChange,
18
+ preset = "compact",
19
+ tone = "neutral",
20
+ className
21
+ }) {
22
+ const t = useDsMessages();
23
+ const base = value.split("-")[0];
24
+ const current = locales.find((l) => l.value === value) ?? locales.find((l) => l.value === base) ?? locales[0];
25
+ const short = current?.short ?? (current?.value ?? value).slice(0, 2).toUpperCase();
26
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
27
+ /* @__PURE__ */ jsxs(
28
+ DropdownMenuTrigger,
29
+ {
30
+ render: /* @__PURE__ */ jsx(
31
+ Button,
32
+ {
33
+ type: "button",
34
+ variant: "ghost",
35
+ size: "sm",
36
+ "data-slot": "locale-switcher",
37
+ "data-preset": preset,
38
+ "data-value": current?.value ?? value,
39
+ "aria-label": `${t.localeSwitcherLabel}: ${current?.label ?? value}`,
40
+ className: cn(headerControlClass(tone), className)
41
+ }
42
+ ),
43
+ children: [
44
+ /* @__PURE__ */ jsx(LanguagesIcon, {}),
45
+ preset === "menu" ? current?.label : short
46
+ ]
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", children: /* @__PURE__ */ jsx(DropdownMenuRadioGroup, { value: current?.value ?? value, onValueChange: (v) => onValueChange?.(v), children: locales.map((l) => /* @__PURE__ */ jsx(DropdownMenuRadioItem, { value: l.value, lang: l.value, children: l.label }, l.value)) }) })
50
+ ] });
51
+ }
52
+ export {
53
+ LocaleSwitcher
54
+ };
@@ -51,7 +51,7 @@ function MenubarTrigger({
51
51
  {
52
52
  "data-slot": "menubar-trigger",
53
53
  className: cn(
54
- "flex items-center rounded-item px-2 py-0.75 text-sm font-(--ds-medium-weight) outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
54
+ "flex items-center rounded-item px-2 py-0.75 text-sm font-(--ds-medium-weight) outline-hidden select-none hover:bg-(--ds-hover-bg) aria-expanded:bg-muted",
55
55
  className
56
56
  ),
57
57
  ...props
@@ -95,7 +95,7 @@ function MessageScrollerButton({
95
95
  "data-size": size,
96
96
  direction,
97
97
  className: cn(
98
- "absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-(--ds-motion-base) hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-(--ds-motion-slow) data-[active=false]:ease-(--ds-ease-exit) data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-(--ds-ease-enter) data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
98
+ "absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-(--ds-motion-base) hover:bg-(--ds-hover-bg) hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-(--ds-motion-slow) data-[active=false]:ease-(--ds-ease-exit) data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-(--ds-ease-enter) data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
99
99
  className
100
100
  ),
101
101
  render: render ?? /* @__PURE__ */ jsx(Button, { variant, size }),
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import { MfaMethod } from '../lib/auth.js';
3
+ import { AuthResult } from './auth-form.js';
4
+ import '../lib/i18n.js';
5
+
6
+ type MfaChallengePreset = "totp" | "sms" | "email" | "backup-code" | "passkey";
7
+ declare function MfaChallenge({ preset, methods, destination, codeLength, trustDevice, onVerify, onPasskey, onResend, onMethodChange, resendAfter, onCancel, error: errorProp, title, description, className, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
8
+ preset?: MfaChallengePreset;
9
+ /** Métodos activos de la persona (el primero no hace falta repetirlo). */
10
+ methods?: MfaMethod[];
11
+ /** Número o correo ya enmascarado («•••• 4821», «f•••@empresa.com»). */
12
+ destination?: string;
13
+ codeLength?: number;
14
+ /** Casilla «no volver a preguntar en este dispositivo». */
15
+ trustDevice?: boolean;
16
+ onVerify?: (code: string, options: {
17
+ method: MfaMethod;
18
+ trustDevice: boolean;
19
+ }) => AuthResult | Promise<AuthResult>;
20
+ onPasskey?: () => AuthResult | Promise<AuthResult>;
21
+ /** sms y email: reenviar el código. */
22
+ onResend?: (method: MfaMethod) => void | Promise<void>;
23
+ /** Se ha cambiado de método (p. ej. para pedir al servidor que envíe el SMS). */
24
+ onMethodChange?: (method: MfaMethod) => void;
25
+ resendAfter?: number;
26
+ /** Volver (cerrar sesión parcial, volver al inicio). */
27
+ onCancel?: () => void;
28
+ error?: React.ReactNode;
29
+ title?: React.ReactNode;
30
+ description?: React.ReactNode;
31
+ }): React.JSX.Element;
32
+
33
+ export { MfaChallenge, type MfaChallengePreset };