orbital-ds 0.10.0 → 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 (74) hide show
  1. package/AGENTS.md +37 -6
  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/echarts-server.js +2 -2
  7. package/dist/lib/echarts-setup.d.ts +5 -1
  8. package/dist/lib/echarts-setup.js +36 -28
  9. package/dist/lib/i18n.d.ts +17 -0
  10. package/dist/lib/i18n.js +54 -3
  11. package/dist/styles.css +111 -0
  12. package/dist/themes/fractalia.css +464 -0
  13. package/dist/themes/fractalia.fonts.css +3 -0
  14. package/dist/themes/fractalia.guide.md +77 -0
  15. package/dist/themes/fractalia.meta.json +96 -0
  16. package/dist/themes/fractalia.scoped.css +464 -0
  17. package/dist/themes/fractalia.tokens.json +39 -0
  18. package/dist/ui/accordion.js +1 -1
  19. package/dist/ui/attachment.js +1 -1
  20. package/dist/ui/badge.js +1 -1
  21. package/dist/ui/banner.js +2 -2
  22. package/dist/ui/button-group.js +1 -1
  23. package/dist/ui/button.js +7 -7
  24. package/dist/ui/calendar.js +2 -2
  25. package/dist/ui/chart.js +3 -3
  26. package/dist/ui/combobox.js +1 -1
  27. package/dist/ui/command.js +1 -1
  28. package/dist/ui/echart.js +2 -2
  29. package/dist/ui/empty.js +1 -1
  30. package/dist/ui/field.js +2 -2
  31. package/dist/ui/gauge.d.ts +40 -0
  32. package/dist/ui/gauge.js +157 -0
  33. package/dist/ui/heatmap-grid.js +1 -1
  34. package/dist/ui/input-group.js +1 -1
  35. package/dist/ui/input.js +1 -1
  36. package/dist/ui/item.js +1 -1
  37. package/dist/ui/kbd.js +1 -1
  38. package/dist/ui/label.js +1 -1
  39. package/dist/ui/legend.d.ts +3 -1
  40. package/dist/ui/legend.js +15 -1
  41. package/dist/ui/level-meter.d.ts +16 -0
  42. package/dist/ui/level-meter.js +60 -0
  43. package/dist/ui/menubar.js +1 -1
  44. package/dist/ui/message.js +2 -2
  45. package/dist/ui/navigation-menu.js +1 -1
  46. package/dist/ui/password-strength.d.ts +14 -0
  47. package/dist/ui/password-strength.js +61 -0
  48. package/dist/ui/progress.js +1 -1
  49. package/dist/ui/proportion-bar.js +2 -2
  50. package/dist/ui/questionnaire.js +2 -2
  51. package/dist/ui/shield.d.ts +21 -0
  52. package/dist/ui/shield.js +141 -0
  53. package/dist/ui/sidebar.js +1 -1
  54. package/dist/ui/status-badge.d.ts +3 -2
  55. package/dist/ui/status-badge.js +4 -2
  56. package/dist/ui/status-hero.d.ts +12 -0
  57. package/dist/ui/status-hero.js +60 -0
  58. package/dist/ui/step-dots.d.ts +10 -0
  59. package/dist/ui/step-dots.js +40 -0
  60. package/dist/ui/step-ring.d.ts +12 -0
  61. package/dist/ui/step-ring.js +35 -0
  62. package/dist/ui/table.js +1 -1
  63. package/dist/ui/tabs.js +1 -1
  64. package/dist/ui/task-loader.d.ts +14 -0
  65. package/dist/ui/task-loader.js +50 -0
  66. package/dist/ui/task-progress.d.ts +18 -0
  67. package/dist/ui/task-progress.js +84 -0
  68. package/dist/ui/toggle.js +1 -1
  69. package/docs/adr/0002-sistemas-corporativos-al-modelo.md +176 -0
  70. package/package.json +173 -171
  71. package/scripts/brand-core.mjs +5 -3
  72. package/scripts/doctor.mjs +61 -3
  73. package/scripts/i18n.mjs +0 -0
  74. package/scripts/init.mjs +182 -26
package/dist/ui/echart.js CHANGED
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { DownloadIcon } from "lucide-react";
5
5
  import { useDsMessages } from "../hooks/use-ds-messages";
6
- import { echarts } from "../lib/echarts-setup";
6
+ import { dsEcharts } from "../lib/echarts-setup";
7
7
  import { dsEchartsTheme } from "../lib/echarts-theme";
8
8
  import { cn } from "../lib/utils";
9
9
  import { Button } from "./button";
@@ -27,7 +27,7 @@ const EChart = React.forwardRef(function EChart2({ option, height = 320, rendere
27
27
  }, []);
28
28
  React.useEffect(() => {
29
29
  if (!box.current || empty) return;
30
- const instance = echarts.init(box.current, dsEchartsTheme(box.current), { renderer });
30
+ const instance = dsEcharts().init(box.current, dsEchartsTheme(box.current), { renderer });
31
31
  chart.current = instance;
32
32
  instance.setOption(optionRef.current);
33
33
  for (const [name, handler] of Object.entries(onEvents ?? {})) instance.on(name, handler);
package/dist/ui/empty.js CHANGED
@@ -59,7 +59,7 @@ function EmptyTitle({ className, ...props }) {
59
59
  {
60
60
  "data-slot": "empty-title",
61
61
  className: cn(
62
- "text-lg font-medium tracking-(--ds-heading-tracking)",
62
+ "text-lg font-(--ds-overlay-title-weight) tracking-(--ds-heading-tracking)",
63
63
  className
64
64
  ),
65
65
  ...props
package/dist/ui/field.js CHANGED
@@ -28,7 +28,7 @@ function FieldLegend({
28
28
  "data-slot": "field-legend",
29
29
  "data-variant": variant,
30
30
  className: cn(
31
- "mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",
31
+ "mb-3 font-(--ds-medium-weight) data-[variant=label]:text-sm data-[variant=legend]:text-base",
32
32
  className
33
33
  ),
34
34
  ...props
@@ -115,7 +115,7 @@ function FieldTitle({ className, ...props }) {
115
115
  {
116
116
  "data-slot": "field-label",
117
117
  className: cn(
118
- "flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-(--ds-disabled-opacity)",
118
+ "flex w-fit items-center gap-2 text-sm font-(--ds-medium-weight) group-data-[disabled=true]/field:opacity-(--ds-disabled-opacity)",
119
119
  className
120
120
  ),
121
121
  ...props
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ import { DsDataTone } from './legend.js';
3
+
4
+ type GaugeShape = "ring" | "semi";
5
+ interface GaugeSegment {
6
+ value: number;
7
+ tone?: DsDataTone;
8
+ label?: string;
9
+ }
10
+ declare function Gauge({ value, max, shape, tone, segments, label, valueText, className, children, ...props }: React.ComponentProps<"div"> & {
11
+ /** Valor (0–max). Con `segments` se ignora. `null` = sin dato. */
12
+ value?: number | null;
13
+ max?: number;
14
+ shape?: GaugeShape;
15
+ tone?: DsDataTone;
16
+ segments?: GaugeSegment[];
17
+ /** Nombre accesible del indicador («Riesgo», «Puntuación»…). */
18
+ label?: string;
19
+ /** Texto accesible del valor (por defecto, el porcentaje). */
20
+ valueText?: string;
21
+ }): React.JSX.Element;
22
+ /** Cifra central. */
23
+ declare function GaugeValue({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
24
+ /** Sufijo de la cifra («/1.000», «pts»). */
25
+ declare function GaugeSuffix({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
26
+ /** Etiqueta del estado, sobre el fondo suave del tono del indicador. */
27
+ declare function GaugeTag({ className, style, tone, ...props }: React.ComponentProps<"span"> & {
28
+ tone?: DsDataTone;
29
+ }): React.JSX.Element;
30
+ /** Texto pequeño bajo la cifra. */
31
+ declare function GaugeCaption({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
32
+ /** Escala bajo un arco: mínimo y máximo, cada uno con su tono. */
33
+ declare function GaugeScale({ min, max, minTone, maxTone, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
34
+ min: React.ReactNode;
35
+ max: React.ReactNode;
36
+ minTone?: DsDataTone;
37
+ maxTone?: DsDataTone;
38
+ }): React.JSX.Element;
39
+
40
+ export { Gauge, GaugeCaption, GaugeScale, type GaugeSegment, type GaugeShape, GaugeSuffix, GaugeTag, GaugeValue };
@@ -0,0 +1,157 @@
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 { cn } from "../lib/utils";
6
+ import { dataToneSoftVar, dataToneVar } from "./legend";
7
+ const GaugeContext = React.createContext({ tone: "primary" });
8
+ const R = 64;
9
+ const C = 70;
10
+ function Gauge({
11
+ value,
12
+ max = 100,
13
+ shape = "ring",
14
+ tone = "primary",
15
+ segments,
16
+ label,
17
+ valueText,
18
+ className,
19
+ children,
20
+ ...props
21
+ }) {
22
+ const t = useDsMessages();
23
+ const locale = useDsLocale();
24
+ const safeMax = max > 0 ? max : 1;
25
+ const clamp = (v) => Math.min(Math.max(v, 0), safeMax);
26
+ const total = segments ? segments.reduce((s, x) => s + Math.max(0, x.value), 0) : value;
27
+ const known = total != null && Number.isFinite(total);
28
+ const now = known ? clamp(total) : null;
29
+ const pct = (v) => clamp(v) / safeMax * 100;
30
+ const text = valueText ?? (now == null ? t.statNoData : segments?.length ? segments.map((s) => `${s.label ? `${s.label}: ` : ""}${s.value}`).join(", ") : new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 }).format(now / safeMax));
31
+ const semi = shape === "semi";
32
+ const geometry = semi ? { d: `M${C - R} ${C} A${R} ${R} 0 0 1 ${C + R} ${C}`, viewBox: `0 0 ${C * 2} ${C + 6}` } : { d: `M${C} ${C - R} A${R} ${R} 0 1 1 ${C - 0.01} ${C - R}`, viewBox: `0 0 ${C * 2} ${C * 2}` };
33
+ let offset = 0;
34
+ const arcs = segments?.length ? segments.map((s, i) => {
35
+ const len = pct(Math.max(0, s.value));
36
+ const arc = { len, start: offset, tone: s.tone ?? `chart-${i % 5 + 1}`, label: s.label };
37
+ offset += len;
38
+ return arc;
39
+ }) : now == null ? [] : [{ len: pct(now), start: 0, tone, label: void 0 }];
40
+ return /* @__PURE__ */ jsx(GaugeContext.Provider, { value: { tone }, children: /* @__PURE__ */ jsx(
41
+ "div",
42
+ {
43
+ "data-slot": "gauge",
44
+ "data-shape": shape,
45
+ "data-tone": segments ? void 0 : tone,
46
+ className: cn("inline-flex flex-col items-center gap-2 text-foreground", className),
47
+ ...props,
48
+ children: /* @__PURE__ */ jsxs(
49
+ "div",
50
+ {
51
+ role: "meter",
52
+ "aria-label": label,
53
+ "aria-valuemin": 0,
54
+ "aria-valuemax": safeMax,
55
+ "aria-valuenow": now ?? void 0,
56
+ "aria-valuetext": text,
57
+ "data-slot": "gauge-chart",
58
+ className: cn("relative shrink-0 w-(--ds-gauge-size)", semi ? "h-[calc(var(--ds-gauge-size)/2)]" : "h-(--ds-gauge-size)"),
59
+ children: [
60
+ /* @__PURE__ */ jsxs("svg", { viewBox: geometry.viewBox, "aria-hidden": "true", className: "size-full overflow-visible rtl:-scale-x-100", children: [
61
+ /* @__PURE__ */ jsx(
62
+ "path",
63
+ {
64
+ "data-slot": "gauge-track",
65
+ d: geometry.d,
66
+ pathLength: 100,
67
+ className: "fill-none stroke-(--ds-track-bg) stroke-(length:--ds-gauge-stroke)"
68
+ }
69
+ ),
70
+ arcs.map((a, i) => /* @__PURE__ */ jsx(
71
+ "path",
72
+ {
73
+ "data-slot": segments ? "gauge-segment" : "gauge-indicator",
74
+ "data-tone": a.tone,
75
+ d: geometry.d,
76
+ pathLength: 100,
77
+ className: "fill-none stroke-(length:--ds-gauge-stroke) transition-[stroke-dasharray] duration-(--ds-motion-slow) ease-(--ds-ease-standard) motion-reduce:transition-none",
78
+ style: { stroke: dataToneVar[a.tone], strokeDasharray: `${a.len} 100`, strokeDashoffset: -a.start },
79
+ children: a.label && /* @__PURE__ */ jsx("title", { children: a.label })
80
+ },
81
+ i
82
+ ))
83
+ ] }),
84
+ children != null && /* @__PURE__ */ jsx(
85
+ "div",
86
+ {
87
+ "data-slot": "gauge-center",
88
+ className: cn(
89
+ "absolute flex flex-col items-center justify-center gap-1 text-center",
90
+ semi ? "inset-x-0 bottom-0" : "inset-[15%]"
91
+ ),
92
+ children
93
+ }
94
+ )
95
+ ]
96
+ }
97
+ )
98
+ }
99
+ ) });
100
+ }
101
+ function GaugeValue({ className, ...props }) {
102
+ return /* @__PURE__ */ jsx(
103
+ "span",
104
+ {
105
+ "data-slot": "gauge-value",
106
+ className: cn("font-display text-(length:--ds-gauge-value-size) leading-none font-(--ds-heading-weight) tabular-nums", className),
107
+ ...props
108
+ }
109
+ );
110
+ }
111
+ function GaugeSuffix({ className, ...props }) {
112
+ return /* @__PURE__ */ jsx("span", { "data-slot": "gauge-value-suffix", className: cn("text-(length:--ds-gauge-suffix-size)", className), ...props });
113
+ }
114
+ function GaugeTag({ className, style, tone, ...props }) {
115
+ const ctx = React.useContext(GaugeContext);
116
+ return /* @__PURE__ */ jsx(
117
+ "span",
118
+ {
119
+ "data-slot": "gauge-tag",
120
+ className: cn("inline-flex rounded-badge px-(--ds-badge-px) py-(--ds-badge-py) text-xs text-foreground", className),
121
+ style: { backgroundColor: dataToneSoftVar[tone ?? ctx.tone], ...style },
122
+ ...props
123
+ }
124
+ );
125
+ }
126
+ function GaugeCaption({ className, ...props }) {
127
+ return /* @__PURE__ */ jsx("span", { "data-slot": "gauge-caption", className: cn("text-xs text-muted-foreground", className), ...props });
128
+ }
129
+ function GaugeScale({
130
+ min,
131
+ max,
132
+ minTone = "danger",
133
+ maxTone = "success",
134
+ className,
135
+ ...props
136
+ }) {
137
+ return /* @__PURE__ */ jsxs(
138
+ "div",
139
+ {
140
+ "data-slot": "gauge-scale",
141
+ className: cn("flex w-(--ds-gauge-size) justify-between text-xs font-(--ds-strong-weight)", className),
142
+ ...props,
143
+ children: [
144
+ /* @__PURE__ */ jsx("span", { "data-slot": "gauge-scale-min", style: { color: dataToneVar[minTone] }, children: min }),
145
+ /* @__PURE__ */ jsx("span", { "data-slot": "gauge-scale-max", style: { color: dataToneVar[maxTone] }, children: max })
146
+ ]
147
+ }
148
+ );
149
+ }
150
+ export {
151
+ Gauge,
152
+ GaugeCaption,
153
+ GaugeScale,
154
+ GaugeSuffix,
155
+ GaugeTag,
156
+ GaugeValue
157
+ };
@@ -130,7 +130,7 @@ function HeatmapGrid({
130
130
  ] }, c);
131
131
  };
132
132
  const table = /* @__PURE__ */ jsxs("table", { role: "grid", "data-slot": "heatmap-grid-table", className: "border-separate border-spacing-0.5 text-xs", children: [
133
- caption && /* @__PURE__ */ jsx("caption", { "data-slot": "heatmap-grid-caption", className: "pb-2 text-start text-sm font-medium text-foreground", children: caption }),
133
+ caption && /* @__PURE__ */ jsx("caption", { "data-slot": "heatmap-grid-caption", className: "pb-2 text-start text-sm font-(--ds-medium-weight) text-foreground", children: caption }),
134
134
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
135
135
  /* @__PURE__ */ jsx("td", { "aria-hidden": true }),
136
136
  columns.map((col, c) => /* @__PURE__ */ jsx(
@@ -20,7 +20,7 @@ function InputGroup({ className, ...props }) {
20
20
  );
21
21
  }
22
22
  const inputGroupAddonVariants = cva(
23
- "flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-(--ds-disabled-opacity) **:data-[slot=kbd]:rounded-control **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4",
23
+ "flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-(--ds-medium-weight) text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-(--ds-disabled-opacity) **:data-[slot=kbd]:rounded-control **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4",
24
24
  {
25
25
  variants: {
26
26
  align: {
package/dist/ui/input.js CHANGED
@@ -7,7 +7,7 @@ function Input({ className, type, ...props }) {
7
7
  type,
8
8
  "data-slot": "input",
9
9
  className: cn(
10
- "h-(--ds-control-h-md) w-full min-w-0 rounded-control shadow-control border border-input bg-(--ds-field-bg) px-(--ds-field-px) py-1 text-base transition-colors duration-(--ds-motion-snap) outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-(--ds-disabled-opacity) aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(length:--ds-ring-width) aria-invalid:ring-(--ds-invalid-ring) md:text-sm",
10
+ "h-(--ds-control-h-md) w-full min-w-0 rounded-control shadow-control border border-input bg-(--ds-field-bg) px-(--ds-field-px) py-1 text-base transition-colors duration-(--ds-motion-snap) outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-(--ds-medium-weight) file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-(--ds-disabled-opacity) aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(length:--ds-ring-width) aria-invalid:ring-(--ds-invalid-ring) md:text-sm",
11
11
  className
12
12
  ),
13
13
  ...props
package/dist/ui/item.js CHANGED
@@ -125,7 +125,7 @@ function ItemTitle({ className, ...props }) {
125
125
  {
126
126
  "data-slot": "item-title",
127
127
  className: cn(
128
- "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",
128
+ "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-(--ds-medium-weight) underline-offset-4",
129
129
  className
130
130
  ),
131
131
  ...props
package/dist/ui/kbd.js CHANGED
@@ -6,7 +6,7 @@ function Kbd({ className, ...props }) {
6
6
  {
7
7
  "data-slot": "kbd",
8
8
  className: cn(
9
- "pointer-events-none inline-flex h-(--ds-kbd-h) w-fit min-w-(--ds-kbd-h) items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
9
+ "pointer-events-none inline-flex h-(--ds-kbd-h) w-fit min-w-(--ds-kbd-h) items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-(--ds-medium-weight) text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
10
10
  className
11
11
  ),
12
12
  ...props
package/dist/ui/label.js CHANGED
@@ -7,7 +7,7 @@ function Label({ className, ...props }) {
7
7
  {
8
8
  "data-slot": "label",
9
9
  className: cn(
10
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-(--ds-disabled-opacity) peer-disabled:cursor-not-allowed peer-disabled:opacity-(--ds-disabled-opacity)",
10
+ "flex items-center gap-2 text-sm leading-none font-(--ds-medium-weight) select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-(--ds-disabled-opacity) peer-disabled:cursor-not-allowed peer-disabled:opacity-(--ds-disabled-opacity)",
11
11
  className
12
12
  ),
13
13
  ...props
@@ -6,6 +6,8 @@ type DsDataTone = "primary" | "info" | "success" | "warning" | "danger" | "neutr
6
6
  declare const dataToneBg: Record<DsDataTone, string>;
7
7
  /** Variable CSS del color de cada tono (para mezclas con color-mix). */
8
8
  declare const dataToneVar: Record<DsDataTone, string>;
9
+ /** Fondo SUAVE de cada tono (etiquetas, pistas teñidas): el «-soft» del tema o una mezcla. */
10
+ declare const dataToneSoftVar: Record<DsDataTone, string>;
9
11
  declare function Legend({ className, orientation, ...props }: React.ComponentProps<"ul"> & {
10
12
  orientation?: "horizontal" | "vertical";
11
13
  }): React.JSX.Element;
@@ -27,4 +29,4 @@ declare function LegendItem({ className, tone, color, shape, value, active, onTo
27
29
  onToggle?: (active: boolean) => void;
28
30
  }): React.JSX.Element;
29
31
 
30
- export { type DsDataTone, Legend, LegendItem, LegendSwatch, dataToneBg, dataToneVar };
32
+ export { type DsDataTone, Legend, LegendItem, LegendSwatch, dataToneBg, dataToneSoftVar, dataToneVar };
package/dist/ui/legend.js CHANGED
@@ -27,6 +27,19 @@ const dataToneVar = {
27
27
  "chart-4": "var(--chart-4)",
28
28
  "chart-5": "var(--chart-5)"
29
29
  };
30
+ const dataToneSoftVar = {
31
+ primary: "color-mix(in oklch, var(--primary) 14%, transparent)",
32
+ info: "var(--info-soft)",
33
+ success: "var(--success-soft)",
34
+ warning: "var(--warning-soft)",
35
+ danger: "var(--danger-soft)",
36
+ neutral: "var(--neutral-soft)",
37
+ "chart-1": "color-mix(in oklch, var(--chart-1) 16%, transparent)",
38
+ "chart-2": "color-mix(in oklch, var(--chart-2) 16%, transparent)",
39
+ "chart-3": "color-mix(in oklch, var(--chart-3) 16%, transparent)",
40
+ "chart-4": "color-mix(in oklch, var(--chart-4) 16%, transparent)",
41
+ "chart-5": "color-mix(in oklch, var(--chart-5) 16%, transparent)"
42
+ };
30
43
  function Legend({
31
44
  className,
32
45
  orientation = "horizontal",
@@ -88,7 +101,7 @@ function LegendItem({
88
101
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
89
102
  /* @__PURE__ */ jsx(LegendSwatch, { tone, color, shape }),
90
103
  /* @__PURE__ */ jsx("span", { "data-slot": "legend-label", className: "min-w-0 truncate text-muted-foreground", children }),
91
- value != null && /* @__PURE__ */ jsx("span", { "data-slot": "legend-value", className: "ms-auto ps-2 font-medium text-foreground tabular-nums", children: value })
104
+ value != null && /* @__PURE__ */ jsx("span", { "data-slot": "legend-value", className: "ms-auto ps-2 font-(--ds-medium-weight) text-foreground tabular-nums", children: value })
92
105
  ] });
93
106
  return /* @__PURE__ */ jsx(
94
107
  "li",
@@ -120,5 +133,6 @@ export {
120
133
  LegendItem,
121
134
  LegendSwatch,
122
135
  dataToneBg,
136
+ dataToneSoftVar,
123
137
  dataToneVar
124
138
  };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { DsDataTone } from './legend.js';
3
+
4
+ declare function LevelMeter({ value, tone, level, range, label, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
5
+ /** Porcentaje 0–100. */
6
+ value: number;
7
+ tone?: DsDataTone;
8
+ /** Nombre del nivel («Bajo», «Medio», «Alto»). */
9
+ level?: React.ReactNode;
10
+ /** Rango del nivel («0–25 %»). */
11
+ range?: React.ReactNode;
12
+ /** Nombre accesible de la medición. */
13
+ label?: string;
14
+ }): React.JSX.Element;
15
+
16
+ export { LevelMeter };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useDsLocale } from "../hooks/use-ds-messages";
4
+ import { cn } from "../lib/utils";
5
+ import { dataToneSoftVar, dataToneVar } from "./legend";
6
+ function LevelMeter({
7
+ value,
8
+ tone = "primary",
9
+ level,
10
+ range,
11
+ label,
12
+ className,
13
+ ...props
14
+ }) {
15
+ const locale = useDsLocale();
16
+ const v = Math.min(Math.max(Number.isFinite(value) ? value : 0, 0), 100);
17
+ const percent = new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 1 }).format(v / 100);
18
+ const levelText = typeof level === "string" ? `${level}, ${percent}` : percent;
19
+ return /* @__PURE__ */ jsxs(
20
+ "div",
21
+ {
22
+ role: "meter",
23
+ "aria-label": label,
24
+ "aria-valuemin": 0,
25
+ "aria-valuemax": 100,
26
+ "aria-valuenow": v,
27
+ "aria-valuetext": levelText,
28
+ "data-slot": "level-meter",
29
+ "data-tone": tone,
30
+ className: cn("flex flex-col gap-1 text-foreground", className),
31
+ ...props,
32
+ children: [
33
+ /* @__PURE__ */ jsxs("div", { "data-slot": "level-meter-header", className: "flex items-center gap-2", children: [
34
+ level && /* @__PURE__ */ jsx(
35
+ "span",
36
+ {
37
+ "data-slot": "level-meter-tag",
38
+ className: "inline-flex rounded-badge px-(--ds-badge-px) py-(--ds-badge-py) text-xs",
39
+ style: { backgroundColor: dataToneSoftVar[tone] },
40
+ children: level
41
+ }
42
+ ),
43
+ /* @__PURE__ */ jsx(
44
+ "span",
45
+ {
46
+ "data-slot": "level-meter-value",
47
+ className: "font-display text-(length:--ds-level-value-size) leading-none font-(--ds-heading-weight) tabular-nums",
48
+ style: { color: dataToneVar[tone] },
49
+ children: percent
50
+ }
51
+ )
52
+ ] }),
53
+ range && /* @__PURE__ */ jsx("span", { "data-slot": "level-meter-range", className: "font-display text-(length:--ds-level-range-size) leading-none font-(--ds-heading-weight)", children: range })
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ LevelMeter
60
+ };
@@ -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-medium 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-muted aria-expanded:bg-muted",
55
55
  className
56
56
  ),
57
57
  ...props
@@ -60,7 +60,7 @@ function MessageHeader({ className, ...props }) {
60
60
  {
61
61
  "data-slot": "message-header",
62
62
  className: cn(
63
- "flex max-w-full min-w-0 items-center px-(--ds-bubble-px) text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
63
+ "flex max-w-full min-w-0 items-center px-(--ds-bubble-px) text-xs font-(--ds-medium-weight) text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
64
64
  className
65
65
  ),
66
66
  ...props
@@ -73,7 +73,7 @@ function MessageFooter({ className, ...props }) {
73
73
  {
74
74
  "data-slot": "message-footer",
75
75
  className: cn(
76
- "flex max-w-full min-w-0 items-center px-(--ds-bubble-px) text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
76
+ "flex max-w-full min-w-0 items-center px-(--ds-bubble-px) text-xs font-(--ds-medium-weight) text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
77
77
  className
78
78
  ),
79
79
  ...props
@@ -55,7 +55,7 @@ function NavigationMenuItem({
55
55
  );
56
56
  }
57
57
  const navigationMenuTriggerStyle = cva(
58
- "group/navigation-menu-trigger inline-flex h-(--ds-control-h-md) w-max items-center justify-center rounded-2xl px-4.5 py-2.5 text-sm font-medium transition-all duration-(--ds-motion-snap) outline-none hover:bg-muted focus:bg-muted focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-(--ds-disabled-opacity) data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted"
58
+ "group/navigation-menu-trigger inline-flex h-(--ds-control-h-md) w-max items-center justify-center rounded-2xl px-4.5 py-2.5 text-sm font-(--ds-medium-weight) transition-all duration-(--ds-motion-snap) outline-none hover:bg-muted focus:bg-muted focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-(--ds-disabled-opacity) data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted"
59
59
  );
60
60
  function NavigationMenuTrigger({
61
61
  className,
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ type StrengthLevel = "weak" | "medium" | "strong";
4
+ declare function PasswordStrength({ value, level, segments, showLabel, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
5
+ /** Segmentos llenos (0–segments). */
6
+ value?: number;
7
+ /** Nivel directo (si no hay `value`). */
8
+ level?: StrengthLevel;
9
+ segments?: number;
10
+ /** Muestra «Nivel de fuerza:» delante. */
11
+ showLabel?: boolean;
12
+ }): React.JSX.Element;
13
+
14
+ export { PasswordStrength, type StrengthLevel };
@@ -0,0 +1,61 @@
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
+ import { dataToneVar } from "./legend";
6
+ const LEVEL_TONE = { weak: "danger", medium: "warning", strong: "success" };
7
+ function PasswordStrength({
8
+ value,
9
+ level,
10
+ segments = 5,
11
+ showLabel = true,
12
+ className,
13
+ ...props
14
+ }) {
15
+ const t = useDsMessages();
16
+ const n = Math.max(1, Math.round(segments));
17
+ const filled = value != null && Number.isFinite(value) ? Math.min(Math.max(Math.round(value), 0), n) : level === "strong" ? n : level === "medium" ? Math.ceil(n * 3 / 5) : level === "weak" ? Math.max(1, Math.round(n / 5)) : 0;
18
+ const lvl = level ?? (filled / n <= 1 / 5 ? "weak" : filled / n <= 3 / 5 ? "medium" : "strong");
19
+ const levelText = filled === 0 ? "" : { weak: t.strengthWeak, medium: t.strengthMedium, strong: t.strengthStrong }[lvl];
20
+ return /* @__PURE__ */ jsxs(
21
+ "div",
22
+ {
23
+ "data-slot": "password-strength",
24
+ "data-level": filled === 0 ? void 0 : lvl,
25
+ className: cn("inline-flex items-end gap-2 text-xs text-foreground", className),
26
+ ...props,
27
+ children: [
28
+ showLabel && /* @__PURE__ */ jsx("span", { "data-slot": "password-strength-label", className: "font-(--ds-strong-weight)", children: t.strengthLabel }),
29
+ /* @__PURE__ */ jsxs("div", { "data-slot": "password-strength-box", className: "flex flex-col gap-0.5 pb-0.5", children: [
30
+ /* @__PURE__ */ jsx("span", { "data-slot": "password-strength-text", "aria-live": "polite", className: "min-h-[1lh]", children: levelText }),
31
+ /* @__PURE__ */ jsx(
32
+ "div",
33
+ {
34
+ role: "meter",
35
+ "aria-label": t.strengthLabel,
36
+ "aria-valuemin": 0,
37
+ "aria-valuemax": n,
38
+ "aria-valuenow": filled,
39
+ "aria-valuetext": levelText || t.statNoData,
40
+ "data-slot": "password-strength-bar",
41
+ className: "flex gap-(--ds-strength-gap)",
42
+ children: Array.from({ length: n }, (_, i) => /* @__PURE__ */ jsx(
43
+ "span",
44
+ {
45
+ "data-slot": "password-strength-segment",
46
+ "data-filled": i < filled || void 0,
47
+ className: "h-(--ds-strength-segment-h) w-(--ds-strength-segment-w) rounded-(--ds-strength-radius) bg-(--ds-track-bg) transition-colors duration-(--ds-motion-base) ease-(--ds-ease-standard) motion-reduce:transition-none",
48
+ style: i < filled ? { backgroundColor: dataToneVar[LEVEL_TONE[lvl]] } : void 0
49
+ },
50
+ i
51
+ ))
52
+ }
53
+ )
54
+ ] })
55
+ ]
56
+ }
57
+ );
58
+ }
59
+ export {
60
+ PasswordStrength
61
+ };
@@ -11,7 +11,7 @@ function Progress({
11
11
  ProgressPrimitive.Track,
12
12
  {
13
13
  className: cn(
14
- "relative flex h-(--ds-track-h) w-full items-center overflow-x-hidden rounded-track bg-muted",
14
+ "relative flex h-(--ds-track-h) w-full items-center overflow-x-hidden rounded-track bg-(--ds-track-bg)",
15
15
  className
16
16
  ),
17
17
  "data-slot": "progress-track",
@@ -39,7 +39,7 @@ function ProportionBar({
39
39
  children: [
40
40
  (label || showValue) && /* @__PURE__ */ jsxs("div", { "data-slot": "proportion-bar-header", className: "flex items-baseline justify-between gap-2 text-sm", children: [
41
41
  label && /* @__PURE__ */ jsx("span", { id: labelId, "data-slot": "proportion-bar-label", className: "min-w-0 truncate text-muted-foreground", children: label }),
42
- showValue && /* @__PURE__ */ jsx("span", { "data-slot": "proportion-bar-value", className: "ms-auto font-medium text-foreground tabular-nums", children: now == null ? t.statNoData : format(now) })
42
+ showValue && /* @__PURE__ */ jsx("span", { "data-slot": "proportion-bar-value", className: "ms-auto font-(--ds-medium-weight) text-foreground tabular-nums", children: now == null ? t.statNoData : format(now) })
43
43
  ] }),
44
44
  /* @__PURE__ */ jsx(
45
45
  "div",
@@ -51,7 +51,7 @@ function ProportionBar({
51
51
  "aria-valuenow": now ?? void 0,
52
52
  "aria-valuetext": valueText,
53
53
  "data-slot": "proportion-bar-track",
54
- className: "flex h-(--ds-proportion-h) w-full overflow-hidden rounded-track bg-muted",
54
+ className: "flex h-(--ds-proportion-h) w-full overflow-hidden rounded-track bg-(--ds-track-bg)",
55
55
  style: isUnknown ? { backgroundImage: HATCH } : void 0,
56
56
  children: !isUnknown && (segments?.length ? segments.map((s, i) => {
57
57
  const segTone = s.tone ?? `chart-${i % 5 + 1}`;
@@ -27,7 +27,7 @@ function QuestionnaireProgress({
27
27
  {
28
28
  "data-slot": "questionnaire-progress",
29
29
  className: cn(
30
- "min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums",
30
+ "min-h-[1lh] w-fit min-w-[14ch] text-xs font-(--ds-medium-weight) text-muted-foreground tabular-nums",
31
31
  className
32
32
  ),
33
33
  ...props
@@ -148,7 +148,7 @@ function QuestionnaireChoice({
148
148
  QuestionnairePrimitive.ChoiceShortcut,
149
149
  {
150
150
  "data-slot": "questionnaire-choice-shortcut",
151
- className: "pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-full border border-input bg-background/80 font-mono text-2xs leading-none font-medium text-muted-foreground group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[shortcut]/questionnaire-choice:inline-flex"
151
+ className: "pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-full border border-input bg-background/80 font-mono text-2xs leading-none font-(--ds-medium-weight) text-muted-foreground group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[shortcut]/questionnaire-choice:inline-flex"
152
152
  }
153
153
  )
154
154
  ]
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { DsDataTone } from './legend.js';
3
+
4
+ type ShieldSize = "sm" | "md";
5
+ declare function Shield({ value, size, label, decorative, className, children, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
6
+ /** Protección de 0 a 1 (se recorta a ese rango). Sin valor, el escudo vacío. */
7
+ value?: number | null;
8
+ size?: ShieldSize;
9
+ /** Texto accesible. Por defecto, «Nivel de protección: N %». */
10
+ label?: string;
11
+ /** Solo decoración: se oculta a los lectores de pantalla. */
12
+ decorative?: boolean;
13
+ /** Insignia en lugar del porcentaje (estrella, icono…). */
14
+ children?: React.ReactNode;
15
+ }): React.JSX.Element;
16
+ type ShieldRadarTone = Extract<DsDataTone, "success" | "warning" | "danger" | "info" | "neutral" | "primary">;
17
+ declare function ShieldRadar({ tone, className, style, children, ...props }: React.ComponentProps<"div"> & {
18
+ tone?: ShieldRadarTone;
19
+ }): React.JSX.Element;
20
+
21
+ export { Shield, ShieldRadar, type ShieldRadarTone, type ShieldSize };