orbital-ds 0.10.1 → 0.12.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 (69) hide show
  1. package/AGENTS.md +32 -4
  2. package/README.md +7 -1
  3. package/components.manifest.json +1854 -1713
  4. package/contract.json +37 -0
  5. package/dist/hooks/use-ds-messages.d.ts +17 -0
  6. package/dist/lib/i18n.d.ts +17 -0
  7. package/dist/lib/i18n.js +54 -3
  8. package/dist/styles.css +111 -0
  9. package/dist/themes/fractalia.css +464 -0
  10. package/dist/themes/fractalia.fonts.css +3 -0
  11. package/dist/themes/fractalia.guide.md +77 -0
  12. package/dist/themes/fractalia.meta.json +96 -0
  13. package/dist/themes/fractalia.scoped.css +464 -0
  14. package/dist/themes/fractalia.tokens.json +39 -0
  15. package/dist/ui/accordion.js +1 -1
  16. package/dist/ui/attachment.js +1 -1
  17. package/dist/ui/badge.js +1 -1
  18. package/dist/ui/banner.js +2 -2
  19. package/dist/ui/button-group.js +1 -1
  20. package/dist/ui/button.js +7 -7
  21. package/dist/ui/calendar.js +2 -2
  22. package/dist/ui/chart.js +3 -3
  23. package/dist/ui/combobox.js +1 -1
  24. package/dist/ui/command.js +1 -1
  25. package/dist/ui/empty.js +1 -1
  26. package/dist/ui/field.js +2 -2
  27. package/dist/ui/gauge.d.ts +40 -0
  28. package/dist/ui/gauge.js +157 -0
  29. package/dist/ui/heatmap-grid.js +1 -1
  30. package/dist/ui/input-group.js +1 -1
  31. package/dist/ui/input.js +1 -1
  32. package/dist/ui/item.js +1 -1
  33. package/dist/ui/kbd.js +1 -1
  34. package/dist/ui/label.js +1 -1
  35. package/dist/ui/legend.d.ts +3 -1
  36. package/dist/ui/legend.js +15 -1
  37. package/dist/ui/level-meter.d.ts +16 -0
  38. package/dist/ui/level-meter.js +60 -0
  39. package/dist/ui/menubar.js +1 -1
  40. package/dist/ui/message.js +2 -2
  41. package/dist/ui/navigation-menu.js +1 -1
  42. package/dist/ui/password-strength.d.ts +14 -0
  43. package/dist/ui/password-strength.js +61 -0
  44. package/dist/ui/progress.js +1 -1
  45. package/dist/ui/proportion-bar.js +2 -2
  46. package/dist/ui/questionnaire.js +2 -2
  47. package/dist/ui/shield.d.ts +21 -0
  48. package/dist/ui/shield.js +141 -0
  49. package/dist/ui/sidebar.js +1 -1
  50. package/dist/ui/status-badge.d.ts +3 -2
  51. package/dist/ui/status-badge.js +4 -2
  52. package/dist/ui/status-hero.d.ts +12 -0
  53. package/dist/ui/status-hero.js +60 -0
  54. package/dist/ui/step-dots.d.ts +10 -0
  55. package/dist/ui/step-dots.js +40 -0
  56. package/dist/ui/step-ring.d.ts +12 -0
  57. package/dist/ui/step-ring.js +35 -0
  58. package/dist/ui/table.js +1 -1
  59. package/dist/ui/tabs.js +1 -1
  60. package/dist/ui/task-loader.d.ts +14 -0
  61. package/dist/ui/task-loader.js +50 -0
  62. package/dist/ui/task-progress.d.ts +18 -0
  63. package/dist/ui/task-progress.js +84 -0
  64. package/dist/ui/toggle.js +1 -1
  65. package/docs/adr/0002-sistemas-corporativos-al-modelo.md +176 -0
  66. package/package.json +1 -1
  67. package/scripts/brand-core.mjs +5 -3
  68. package/scripts/doctor.mjs +61 -3
  69. package/scripts/init.mjs +182 -26
@@ -0,0 +1,141 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { useDsLocale, useDsMessages } from "../hooks/use-ds-messages";
5
+ import { dsFormat } from "../lib/i18n";
6
+ import { cn } from "../lib/utils";
7
+ import { dataToneVar } from "./legend";
8
+ const SHIELD_PATH = "M64 5.0003C65.8441 5.00024 67.0078 5.57611 67.3564 5.91045C75.7373 13.9567 91.3926 24.0714 118.666 28.9837C118.767 29.002 118.825 29.0412 118.854 29.0638C119.256 37.6016 119.301 58.4526 112.314 78.7581C105.364 98.9578 91.6913 118.097 64.7559 124.698H64.7549C64.7515 124.698 64.7461 124.699 64.7402 124.7C64.7346 124.7 64.7293 124.701 64.7246 124.701H63.2783C63.2735 124.701 63.2675 124.7 63.2617 124.7C63.2559 124.699 63.2505 124.698 63.2471 124.698H63.2461C36.3089 118.097 22.6357 98.9576 15.6855 78.7581C8.69902 58.4526 8.74294 37.6015 9.14551 29.0638C9.17323 29.0412 9.23199 29.0021 9.33398 28.9837C36.6076 24.0714 52.2627 13.9578 60.6436 5.91143C60.9918 5.57704 62.1556 5.00044 64 5.0003Z";
9
+ function Shield({
10
+ value,
11
+ size = "md",
12
+ label,
13
+ decorative = false,
14
+ className,
15
+ children,
16
+ ...props
17
+ }) {
18
+ const t = useDsMessages();
19
+ const locale = useDsLocale();
20
+ const clipId = `ds-shield-${React.useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
21
+ const v = value == null || !Number.isFinite(value) ? null : Math.min(Math.max(value, 0), 1);
22
+ const percent = v == null ? null : new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 }).format(v);
23
+ const a11y = decorative ? { "aria-hidden": true } : { role: "img", "aria-label": label ?? (percent ? dsFormat(t.shieldLabel, { value: percent }) : t.statNoData) };
24
+ return /* @__PURE__ */ jsxs(
25
+ "div",
26
+ {
27
+ "data-slot": "shield",
28
+ "data-size": size,
29
+ className: cn(
30
+ "relative inline-grid shrink-0 place-items-center text-(--ds-shield-progress)",
31
+ size === "md" ? "h-(--ds-shield-h) w-(--ds-shield-w)" : "h-(--ds-shield-h-sm) w-(--ds-shield-w-sm)",
32
+ className
33
+ ),
34
+ ...a11y,
35
+ ...props,
36
+ children: [
37
+ /* @__PURE__ */ jsxs(
38
+ "svg",
39
+ {
40
+ "data-slot": "shield-graphic",
41
+ viewBox: "0 0 128 137.7",
42
+ "aria-hidden": "true",
43
+ className: "absolute inset-0 size-full overflow-visible",
44
+ children: [
45
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: clipId, children: /* @__PURE__ */ jsx(
46
+ "rect",
47
+ {
48
+ "data-slot": "shield-progress-clip",
49
+ x: "0",
50
+ y: "0",
51
+ width: "128",
52
+ height: "130",
53
+ rx: "15",
54
+ className: "origin-bottom transition-transform duration-(--ds-motion-slow) ease-(--ds-ease-standard) [transform-box:fill-box] motion-reduce:transition-none",
55
+ style: { transform: `scaleY(${v ?? 0})` }
56
+ }
57
+ ) }) }),
58
+ /* @__PURE__ */ jsx(
59
+ "path",
60
+ {
61
+ "data-slot": "shield-body",
62
+ d: SHIELD_PATH,
63
+ className: "fill-(--ds-shield-fill) stroke-(--ds-shield-track) stroke-(length:--ds-shield-stroke) [stroke-linejoin:round] [filter:var(--ds-shield-filter)]"
64
+ }
65
+ ),
66
+ /* @__PURE__ */ jsx(
67
+ "path",
68
+ {
69
+ "data-slot": "shield-progress",
70
+ d: SHIELD_PATH,
71
+ clipPath: `url(#${clipId})`,
72
+ className: "fill-none stroke-(--ds-shield-progress) stroke-(length:--ds-shield-stroke) [stroke-linejoin:round]"
73
+ }
74
+ )
75
+ ]
76
+ }
77
+ ),
78
+ children != null ? /* @__PURE__ */ jsx("span", { "data-slot": "shield-badge", className: "relative grid size-(--ds-shield-badge) place-items-center [&_svg]:size-full", children }) : percent && /* @__PURE__ */ jsx(
79
+ "span",
80
+ {
81
+ "data-slot": "shield-value",
82
+ "aria-hidden": "true",
83
+ className: "relative font-display text-(length:--ds-shield-value-size) leading-none font-(--ds-shield-value-weight) tabular-nums",
84
+ children: percent
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ );
90
+ }
91
+ function ShieldRadar({
92
+ tone = "success",
93
+ className,
94
+ style,
95
+ children,
96
+ ...props
97
+ }) {
98
+ return /* @__PURE__ */ jsxs(
99
+ "div",
100
+ {
101
+ "data-slot": "shield-radar",
102
+ "data-tone": tone,
103
+ className: cn("relative inline-grid size-(--ds-shield-radar-size) shrink-0 place-items-center", className),
104
+ style: { "--ds-radar-tone": dataToneVar[tone], ...style },
105
+ ...props,
106
+ children: [
107
+ /* @__PURE__ */ jsx(
108
+ "span",
109
+ {
110
+ "data-slot": "shield-ring",
111
+ "data-ring": "outer",
112
+ "aria-hidden": "true",
113
+ className: "absolute size-full rounded-full border border-(--ds-radar-tone) animate-ds-ring-outer motion-reduce:animate-none"
114
+ }
115
+ ),
116
+ /* @__PURE__ */ jsx(
117
+ "span",
118
+ {
119
+ "data-slot": "shield-ring",
120
+ "data-ring": "inner",
121
+ "aria-hidden": "true",
122
+ className: "absolute size-[89.17%] rounded-full border border-(--ds-radar-tone) animate-ds-ring-inner motion-reduce:animate-none"
123
+ }
124
+ ),
125
+ /* @__PURE__ */ jsx(
126
+ "span",
127
+ {
128
+ "data-slot": "shield-radar-circle",
129
+ "aria-hidden": "true",
130
+ className: "absolute size-(--ds-shield-radar-circle) rounded-full border-2 border-[color-mix(in_oklch,var(--ds-radar-tone)_60%,transparent)] bg-card shadow-[inset_0_0_var(--ds-shield-radar-glow)_color-mix(in_oklch,var(--ds-radar-tone)_45%,transparent)]"
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsx("div", { "data-slot": "shield-radar-content", className: "relative", children })
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ export {
139
+ Shield,
140
+ ShieldRadar
141
+ };
@@ -529,7 +529,7 @@ function SidebarMenuBadge({
529
529
  "data-slot": "sidebar-menu-badge",
530
530
  "data-sidebar": "menu-badge",
531
531
  className: cn(
532
- "pointer-events-none absolute top-1/2 right-1 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center rounded-(--ds-sidebar-item-radius) px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
532
+ "pointer-events-none absolute top-1/2 right-1 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center rounded-(--ds-sidebar-item-radius) px-1 text-xs font-(--ds-medium-weight) text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
533
533
  className
534
534
  ),
535
535
  ...props
@@ -9,11 +9,12 @@ declare const statusDotVariants: (props?: ({
9
9
  type StatusDotProps = Omit<React.ComponentProps<"span">, "children"> & {
10
10
  level?: StatusLevel;
11
11
  pulse?: boolean;
12
+ /** Tamaño del punto suelto (sin él, el del punto en línea: --ds-status-dot). */
13
+ size?: "sm" | "md" | "lg";
12
14
  /** Texto accesible. Sin él el punto es decorativo: acompáñalo de texto visible. */
13
15
  label?: string;
14
16
  };
15
- /** Punto de estado suelto. Sin `label` es decorativo: pon el texto al lado. */
16
- declare function StatusDot({ level, pulse, label, className, ...props }: StatusDotProps): React.JSX.Element;
17
+ declare function StatusDot({ level, pulse, size, label, className, ...props }: StatusDotProps): React.JSX.Element;
17
18
  declare const statusBadgeVariants: (props?: ({
18
19
  variant?: "outline" | "dot" | "soft" | null | undefined;
19
20
  level?: "none" | "info" | "warning" | "neutral" | "critical" | "ok" | null | undefined;
@@ -27,7 +27,8 @@ const statusDotVariants = cva("relative inline-flex size-(--ds-status-dot) shrin
27
27
  defaultVariants: { level: "neutral" }
28
28
  });
29
29
  const pulseClassName = "pointer-events-none absolute inset-0 rounded-full bg-inherit opacity-75 motion-safe:animate-ping [animation-duration:var(--ds-motion-pulse)]";
30
- function StatusDot({ level = "neutral", pulse = false, label, className, ...props }) {
30
+ const statusDotSize = { sm: "size-(--ds-status-dot-sm)", md: "size-(--ds-status-dot-md)", lg: "size-(--ds-status-dot-lg)" };
31
+ function StatusDot({ level = "neutral", pulse = false, size, label, className, ...props }) {
31
32
  return /* @__PURE__ */ jsx(
32
33
  "span",
33
34
  {
@@ -35,8 +36,9 @@ function StatusDot({ level = "neutral", pulse = false, label, className, ...prop
35
36
  "data-level": level,
36
37
  "data-tone": levelTone[level],
37
38
  "data-state": pulse ? "pulsing" : "static",
39
+ "data-size": size,
38
40
  ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
39
- className: cn(statusDotVariants({ level }), className),
41
+ className: cn(statusDotVariants({ level }), size && statusDotSize[size], className),
40
42
  ...props,
41
43
  children: pulse && level !== "none" && /* @__PURE__ */ jsx("span", { "data-slot": "status-dot-pulse", className: pulseClassName })
42
44
  }
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+
3
+ type StatusHeroTone = "success" | "warning" | "danger" | "info" | "neutral";
4
+ declare function StatusHero({ tone, label, badge, className, style, children, ...props }: React.ComponentProps<"div"> & {
5
+ tone?: StatusHeroTone;
6
+ /** Texto accesible (qué y en qué estado). */
7
+ label?: string;
8
+ /** Insignia a medida (icono). `null` la quita. */
9
+ badge?: React.ReactNode;
10
+ }): React.JSX.Element;
11
+
12
+ export { StatusHero, type StatusHeroTone };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { InfoIcon, MinusIcon, ShieldCheckIcon, ShieldXIcon, TriangleAlertIcon } from "lucide-react";
4
+ import { useDsMessages } from "../hooks/use-ds-messages";
5
+ import { cn } from "../lib/utils";
6
+ import { dataToneVar } from "./legend";
7
+ const BADGE_ICON = {
8
+ success: ShieldCheckIcon,
9
+ warning: TriangleAlertIcon,
10
+ danger: ShieldXIcon,
11
+ info: InfoIcon,
12
+ neutral: MinusIcon
13
+ };
14
+ function StatusHero({
15
+ tone = "success",
16
+ label,
17
+ badge,
18
+ className,
19
+ style,
20
+ children,
21
+ ...props
22
+ }) {
23
+ const t = useDsMessages();
24
+ const toneText = { success: t.toneSuccess, warning: t.toneWarning, danger: t.toneDanger, info: t.toneInfo, neutral: t.toneNeutral }[tone];
25
+ const Icon = BADGE_ICON[tone];
26
+ return /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ role: "img",
30
+ "aria-label": label ?? toneText,
31
+ "data-slot": "status-hero",
32
+ "data-tone": tone,
33
+ className: cn("relative inline-grid size-(--ds-status-hero) shrink-0 place-items-center", className),
34
+ style: { "--ds-hero-tone": dataToneVar[tone], "--ds-hero-halo": `var(--ds-status-halo-${tone})`, ...style },
35
+ ...props,
36
+ children: [
37
+ /* @__PURE__ */ jsx(
38
+ "div",
39
+ {
40
+ "data-slot": "status-hero-surface",
41
+ className: "grid size-full place-items-center overflow-hidden rounded-(--ds-status-hero-radius) bg-card p-(--ds-status-hero-p) shadow-[inset_0_0_var(--ds-status-halo-inset)_var(--ds-hero-halo)] [filter:drop-shadow(0_0_var(--ds-status-halo-blur)_var(--ds-hero-halo))] [&>img]:size-full [&>img]:rounded-[inherit] [&>img]:object-cover [&>svg]:size-full",
42
+ children
43
+ }
44
+ ),
45
+ badge !== null && /* @__PURE__ */ jsx(
46
+ "span",
47
+ {
48
+ "data-slot": "status-hero-badge",
49
+ "aria-hidden": "true",
50
+ className: "absolute -end-1.5 -bottom-0.75 grid size-(--ds-status-hero-badge) place-items-center rounded-full bg-(--ds-hero-tone) p-1.5 text-background [&_svg]:size-full",
51
+ children: badge ?? /* @__PURE__ */ jsx(Icon, {})
52
+ }
53
+ )
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ StatusHero
60
+ };
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+
3
+ declare function StepDots({ count, current, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
4
+ /** Número de pasos. */
5
+ count: number;
6
+ /** Paso actual, empezando en 1. */
7
+ current: number;
8
+ }): React.JSX.Element;
9
+
10
+ export { StepDots };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useDsMessages } from "../hooks/use-ds-messages";
4
+ import { dsFormat } from "../lib/i18n";
5
+ import { cn } from "../lib/utils";
6
+ function StepDots({
7
+ count,
8
+ current,
9
+ className,
10
+ ...props
11
+ }) {
12
+ const t = useDsMessages();
13
+ const total = Math.max(1, Math.round(count));
14
+ const now = Math.min(Math.max(Math.round(current), 1), total);
15
+ return /* @__PURE__ */ jsx(
16
+ "div",
17
+ {
18
+ role: "progressbar",
19
+ "aria-valuemin": 1,
20
+ "aria-valuemax": total,
21
+ "aria-valuenow": now,
22
+ "aria-valuetext": dsFormat(t.stepOf, { n: now, total }),
23
+ "data-slot": "step-dots",
24
+ className: cn("inline-flex items-center gap-(--ds-step-dot-gap)", className),
25
+ ...props,
26
+ children: Array.from({ length: total }, (_, i) => /* @__PURE__ */ jsx(
27
+ "span",
28
+ {
29
+ "data-slot": "step-dot",
30
+ "data-active": i + 1 === now || void 0,
31
+ className: "h-(--ds-step-dot) w-(--ds-step-dot) rounded-full bg-(--ds-step-dot-bg) transition-[width,background-color] duration-(--ds-motion-base) ease-(--ds-ease-standard) motion-reduce:transition-none data-active:w-(--ds-step-dot-active-w) data-active:bg-primary"
32
+ },
33
+ i
34
+ ))
35
+ }
36
+ );
37
+ }
38
+ export {
39
+ StepDots
40
+ };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+
3
+ declare function StepRing({ total, completed, current, className, style, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
4
+ /** Número de sectores (pasos). */
5
+ total?: number;
6
+ /** Pasos completados. */
7
+ completed: number;
8
+ /** El paso siguiente a los completados está en curso. */
9
+ current?: boolean;
10
+ }): React.JSX.Element;
11
+
12
+ export { StepRing };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useDsMessages } from "../hooks/use-ds-messages";
4
+ import { dsFormat } from "../lib/i18n";
5
+ import { cn } from "../lib/utils";
6
+ function StepRing({
7
+ total = 4,
8
+ completed,
9
+ current = false,
10
+ className,
11
+ style,
12
+ ...props
13
+ }) {
14
+ const t = useDsMessages();
15
+ const n = Math.max(1, Math.round(total));
16
+ const done = Math.min(Math.max(Math.round(completed), 0), n);
17
+ const sector = 360 / n;
18
+ const color = (i) => i < done ? "var(--success)" : i === done && current ? "var(--info)" : "var(--ds-track-bg)";
19
+ const stops = Array.from({ length: n }, (_, i) => `${color(i)} ${i * sector}deg ${(i + 1) * sector}deg`).join(", ");
20
+ return /* @__PURE__ */ jsx(
21
+ "div",
22
+ {
23
+ role: "img",
24
+ "aria-label": dsFormat(t.stepRingLabel, { completed: done, total: n }),
25
+ "data-slot": "step-ring",
26
+ "data-state": done === n ? "complete" : current ? "current" : "pending",
27
+ className: cn("inline-block size-(--ds-step-ring-size) shrink-0 rounded-full rtl:-scale-x-100", className),
28
+ style: { backgroundImage: `conic-gradient(${stops})`, ...style },
29
+ ...props
30
+ }
31
+ );
32
+ }
33
+ export {
34
+ StepRing
35
+ };
package/dist/ui/table.js CHANGED
@@ -43,7 +43,7 @@ function TableFooter({ className, ...props }) {
43
43
  {
44
44
  "data-slot": "table-footer",
45
45
  className: cn(
46
- "border-t bg-(--ds-row-hover) font-medium [&>tr]:last:border-b-0",
46
+ "border-t bg-(--ds-row-hover) font-(--ds-medium-weight) [&>tr]:last:border-b-0",
47
47
  className
48
48
  ),
49
49
  ...props
package/dist/ui/tabs.js CHANGED
@@ -22,7 +22,7 @@ function Tabs({
22
22
  );
23
23
  }
24
24
  const tabsListVariants = cva(
25
- "group/tabs-list inline-flex w-fit items-center justify-center rounded-control p-(--ds-tabs-list-p) text-muted-foreground group-data-[orientation=horizontal]/tabs:h-(--ds-control-h-md) group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col group-data-[orientation=vertical]/tabs:rounded-2xl data-[variant=line]:rounded-none",
25
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-tabs-list p-(--ds-tabs-list-p) text-muted-foreground group-data-[orientation=horizontal]/tabs:h-(--ds-control-h-md) group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col group-data-[orientation=vertical]/tabs:rounded-2xl data-[variant=line]:rounded-none",
26
26
  {
27
27
  variants: {
28
28
  variant: {
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ type TaskLoaderState = "running" | "done";
4
+ declare function TaskLoader({ icon, value, state, label, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
5
+ /** Ilustración (decorativa). */
6
+ icon: React.ReactNode;
7
+ /** Avance 0–100. Sin valor, indeterminado. */
8
+ value?: number;
9
+ state?: TaskLoaderState;
10
+ /** Texto del estado para lectores de pantalla. */
11
+ label?: string;
12
+ }): React.JSX.Element;
13
+
14
+ export { TaskLoader, type TaskLoaderState };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useDsMessages } from "../hooks/use-ds-messages";
4
+ import { cn } from "../lib/utils";
5
+ function TaskLoader({
6
+ icon,
7
+ value,
8
+ state = "running",
9
+ label,
10
+ className,
11
+ ...props
12
+ }) {
13
+ const t = useDsMessages();
14
+ const done = state === "done";
15
+ const indeterminate = !done && (value == null || !Number.isFinite(value));
16
+ const pct = done ? 100 : indeterminate ? 0 : Math.min(Math.max(value, 0), 100);
17
+ return /* @__PURE__ */ jsxs(
18
+ "div",
19
+ {
20
+ role: "status",
21
+ "aria-live": "polite",
22
+ "data-slot": "task-loader",
23
+ "data-state": done ? "done" : indeterminate ? "indeterminate" : "running",
24
+ className: cn(
25
+ "flex size-(--ds-loader-size) shrink-0 flex-col items-center gap-2 rounded-(--ds-loader-radius) p-(--ds-loader-p) text-foreground transition-[background-color,box-shadow] duration-(--ds-motion-base) ease-(--ds-ease-standard) motion-reduce:transition-none",
26
+ done ? "bg-(--ds-loader-done-bg) shadow-(--ds-loader-done-glow)" : "bg-(--ds-loader-bg)",
27
+ className
28
+ ),
29
+ ...props,
30
+ children: [
31
+ /* @__PURE__ */ jsx("span", { "data-slot": "task-loader-icon", "aria-hidden": "true", className: "grid size-(--ds-loader-icon) shrink-0 place-items-center [&>*]:max-h-full [&>*]:max-w-full", children: icon }),
32
+ /* @__PURE__ */ jsx("span", { "data-slot": "task-loader-track", "aria-hidden": "true", className: "relative h-(--ds-loader-bar-h) w-full overflow-hidden rounded-full bg-(--ds-track-bg) [--ds-dir:1] rtl:[--ds-dir:-1]", children: /* @__PURE__ */ jsx(
33
+ "span",
34
+ {
35
+ "data-slot": "task-loader-fill",
36
+ className: cn(
37
+ "absolute inset-y-0 start-0 bg-info",
38
+ indeterminate ? "w-2/5 animate-ds-indeterminate motion-reduce:animate-none" : "transition-[width] duration-(--ds-motion-slow) ease-(--ds-ease-standard) motion-reduce:transition-none"
39
+ ),
40
+ style: indeterminate ? void 0 : { width: `${pct}%` }
41
+ }
42
+ ) }),
43
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: label ?? (done ? t.progressDone : t.loading) })
44
+ ]
45
+ }
46
+ );
47
+ }
48
+ export {
49
+ TaskLoader
50
+ };
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ type TaskState = "idle" | "running" | "done" | "error";
4
+ declare function TaskProgress({ label, value, current, total, state, error, counter, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
5
+ label?: React.ReactNode;
6
+ /** Porcentaje 0–100 (o usa current/total). */
7
+ value?: number;
8
+ /** Paso actual y total: dan el porcentaje y el contador «3 de 5». */
9
+ current?: number;
10
+ total?: number;
11
+ state?: TaskState;
12
+ /** Motivo del fallo (estado error). */
13
+ error?: React.ReactNode;
14
+ /** Contador a medida (por defecto «n de N» o el porcentaje). */
15
+ counter?: React.ReactNode;
16
+ }): React.JSX.Element;
17
+
18
+ export { TaskProgress, type TaskState };
@@ -0,0 +1,84 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { CheckIcon } from "lucide-react";
5
+ import { useDsLocale, useDsMessages } from "../hooks/use-ds-messages";
6
+ import { dsFormat } from "../lib/i18n";
7
+ import { cn } from "../lib/utils";
8
+ function TaskProgress({
9
+ label,
10
+ value,
11
+ current,
12
+ total,
13
+ state,
14
+ error,
15
+ counter,
16
+ className,
17
+ ...props
18
+ }) {
19
+ const t = useDsMessages();
20
+ const locale = useDsLocale();
21
+ const labelId = React.useId();
22
+ const errorId = React.useId();
23
+ const pct = value != null && Number.isFinite(value) ? Math.min(Math.max(value, 0), 100) : current != null && total ? Math.min(Math.max(current / total * 100, 0), 100) : 0;
24
+ const st = state ?? (pct >= 100 ? "done" : pct > 0 ? "running" : "idle");
25
+ const stateText = { idle: t.progressNotStarted, running: t.progressRunning, done: t.progressDone, error: t.progressError }[st];
26
+ const percent = new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 1 }).format(pct / 100);
27
+ const shownCounter = counter ?? (current != null && total ? dsFormat(t.progressCounter, { n: current, total }) : percent);
28
+ const fill = st === "done" ? 100 : pct;
29
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "task-progress", "data-state": st, className: cn("flex w-full min-w-0 flex-col gap-1 text-foreground", className), ...props, children: [
30
+ /* @__PURE__ */ jsxs("div", { "data-slot": "task-progress-header", className: "flex items-center justify-between gap-2", children: [
31
+ label && /* @__PURE__ */ jsx("span", { id: labelId, "data-slot": "task-progress-label", className: "min-w-0 truncate font-(--ds-strong-weight) data-[state=done]:text-success", "data-state": st, children: label }),
32
+ /* @__PURE__ */ jsx(
33
+ "span",
34
+ {
35
+ "data-slot": "task-progress-counter",
36
+ className: cn("ms-auto text-sm tabular-nums", st === "done" ? "text-success" : "text-info"),
37
+ children: st === "idle" ? stateText : shownCounter
38
+ }
39
+ )
40
+ ] }),
41
+ /* @__PURE__ */ jsxs("div", { "data-slot": "task-progress-row", className: "flex items-center gap-1", children: [
42
+ /* @__PURE__ */ jsxs(
43
+ "div",
44
+ {
45
+ role: "progressbar",
46
+ "aria-labelledby": label ? labelId : void 0,
47
+ "aria-describedby": st === "error" && error ? errorId : void 0,
48
+ "aria-valuemin": 0,
49
+ "aria-valuemax": 100,
50
+ "aria-valuenow": Math.round(fill),
51
+ "aria-valuetext": `${stateText}, ${percent}`,
52
+ "data-slot": "task-progress-track",
53
+ className: "relative h-(--ds-task-progress-h) flex-1 overflow-hidden rounded-track bg-(--ds-track-bg)",
54
+ children: [
55
+ /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ "data-slot": "task-progress-fill",
59
+ className: cn(
60
+ "absolute inset-y-0 start-0 transition-[width] duration-(--ds-motion-base) ease-(--ds-ease-standard) motion-reduce:transition-none",
61
+ st === "error" ? "rounded-s-track bg-success" : st === "done" ? "rounded-track bg-success" : "rounded-track bg-warning"
62
+ ),
63
+ style: { width: `${fill}%` }
64
+ }
65
+ ),
66
+ st === "error" && /* @__PURE__ */ jsx(
67
+ "div",
68
+ {
69
+ "data-slot": "task-progress-fill-error",
70
+ className: "absolute inset-y-0 end-0 rounded-e-track bg-danger",
71
+ style: { insetInlineStart: `${fill}%` }
72
+ }
73
+ )
74
+ ]
75
+ }
76
+ ),
77
+ st === "done" && /* @__PURE__ */ jsx(CheckIcon, { "data-slot": "task-progress-icon", "aria-hidden": "true", className: "size-4 shrink-0 text-success" })
78
+ ] }),
79
+ st === "error" && error && /* @__PURE__ */ jsx("span", { id: errorId, "data-slot": "task-progress-error", className: "text-xs text-danger", children: error })
80
+ ] });
81
+ }
82
+ export {
83
+ TaskProgress
84
+ };
package/dist/ui/toggle.js CHANGED
@@ -3,7 +3,7 @@ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
3
3
  import { cva } from "class-variance-authority";
4
4
  import { cn } from "../lib/utils";
5
5
  const toggleVariants = cva(
6
- "group/toggle inline-flex items-center justify-center gap-1 rounded-control text-sm font-medium whitespace-nowrap transition-colors duration-(--ds-motion-snap) outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) disabled:pointer-events-none disabled:opacity-(--ds-disabled-opacity) aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(--ds-invalid-ring) aria-pressed:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
6
+ "group/toggle inline-flex items-center justify-center gap-1 rounded-control text-sm font-(--ds-medium-weight) whitespace-nowrap transition-colors duration-(--ds-motion-snap) outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) disabled:pointer-events-none disabled:opacity-(--ds-disabled-opacity) aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(--ds-invalid-ring) aria-pressed:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
7
  {
8
8
  variants: {
9
9
  variant: {