orbital-ds 0.10.1 → 0.13.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 (106) hide show
  1. package/AGENTS.md +63 -7
  2. package/README.md +93 -87
  3. package/components.manifest.json +1906 -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/motion.css +139 -0
  9. package/dist/styles.css +124 -0
  10. package/dist/themes/fractalia.css +473 -0
  11. package/dist/themes/fractalia.fonts.css +3 -0
  12. package/dist/themes/fractalia.guide.md +79 -0
  13. package/dist/themes/fractalia.meta.json +99 -0
  14. package/dist/themes/fractalia.scoped.css +473 -0
  15. package/dist/themes/fractalia.tokens.json +39 -0
  16. package/dist/themes/friendly.css +7 -1
  17. package/dist/themes/friendly.meta.json +7 -0
  18. package/dist/themes/friendly.scoped.css +7 -1
  19. package/dist/themes/qratia.css +13 -8
  20. package/dist/themes/qratia.meta.json +8 -1
  21. package/dist/themes/qratia.scoped.css +13 -8
  22. package/dist/themes/tactile.css +7 -1
  23. package/dist/themes/tactile.meta.json +7 -0
  24. package/dist/themes/tactile.scoped.css +7 -1
  25. package/dist/themes/twitter.css +7 -1
  26. package/dist/themes/twitter.meta.json +7 -0
  27. package/dist/themes/twitter.scoped.css +7 -1
  28. package/dist/themes/zyro.css +7 -1
  29. package/dist/themes/zyro.meta.json +7 -0
  30. package/dist/themes/zyro.scoped.css +7 -1
  31. package/dist/ui/accordion.js +1 -1
  32. package/dist/ui/alert.js +6 -5
  33. package/dist/ui/attachment.d.ts +1 -1
  34. package/dist/ui/attachment.js +1 -1
  35. package/dist/ui/badge.js +7 -7
  36. package/dist/ui/banner.js +6 -6
  37. package/dist/ui/button-group.js +1 -1
  38. package/dist/ui/button.d.ts +1 -1
  39. package/dist/ui/button.js +7 -7
  40. package/dist/ui/calendar.js +2 -2
  41. package/dist/ui/chart.js +3 -3
  42. package/dist/ui/combobox.js +2 -2
  43. package/dist/ui/command.js +1 -1
  44. package/dist/ui/context-menu.js +4 -4
  45. package/dist/ui/dropdown-menu.js +4 -4
  46. package/dist/ui/empty.js +1 -1
  47. package/dist/ui/field.js +2 -2
  48. package/dist/ui/gauge.d.ts +40 -0
  49. package/dist/ui/gauge.js +157 -0
  50. package/dist/ui/heatmap-grid.js +1 -1
  51. package/dist/ui/input-group.d.ts +1 -1
  52. package/dist/ui/input-group.js +1 -1
  53. package/dist/ui/input.js +1 -1
  54. package/dist/ui/item.d.ts +3 -3
  55. package/dist/ui/item.js +15 -5
  56. package/dist/ui/kbd.js +1 -1
  57. package/dist/ui/label.js +1 -1
  58. package/dist/ui/legend.d.ts +3 -1
  59. package/dist/ui/legend.js +15 -1
  60. package/dist/ui/level-meter.d.ts +16 -0
  61. package/dist/ui/level-meter.js +60 -0
  62. package/dist/ui/marker.d.ts +1 -1
  63. package/dist/ui/menubar.js +5 -5
  64. package/dist/ui/message.js +2 -2
  65. package/dist/ui/native-select.js +2 -2
  66. package/dist/ui/navigation-menu.js +1 -1
  67. package/dist/ui/password-strength.d.ts +14 -0
  68. package/dist/ui/password-strength.js +61 -0
  69. package/dist/ui/progress.js +1 -1
  70. package/dist/ui/proportion-bar.js +2 -2
  71. package/dist/ui/questionnaire.js +2 -2
  72. package/dist/ui/select.js +7 -8
  73. package/dist/ui/shield.d.ts +21 -0
  74. package/dist/ui/shield.js +141 -0
  75. package/dist/ui/sidebar.js +1 -1
  76. package/dist/ui/stat.d.ts +11 -1
  77. package/dist/ui/stat.js +13 -3
  78. package/dist/ui/status-badge.d.ts +3 -2
  79. package/dist/ui/status-badge.js +10 -8
  80. package/dist/ui/status-hero.d.ts +12 -0
  81. package/dist/ui/status-hero.js +60 -0
  82. package/dist/ui/step-dots.d.ts +10 -0
  83. package/dist/ui/step-dots.js +40 -0
  84. package/dist/ui/step-ring.d.ts +12 -0
  85. package/dist/ui/step-ring.js +35 -0
  86. package/dist/ui/table.js +1 -1
  87. package/dist/ui/tabs.js +1 -1
  88. package/dist/ui/task-loader.d.ts +14 -0
  89. package/dist/ui/task-loader.js +50 -0
  90. package/dist/ui/task-progress.d.ts +18 -0
  91. package/dist/ui/task-progress.js +84 -0
  92. package/dist/ui/toggle.js +1 -1
  93. package/docs/adr/0002-sistemas-corporativos-al-modelo.md +176 -0
  94. package/docs/designer/flujo.md +79 -0
  95. package/docs/designer/patrones.md +116 -0
  96. package/docs/designer/revision.md +60 -0
  97. package/docs/designer/ux.md +71 -0
  98. package/package.json +9 -2
  99. package/scripts/brand-core.mjs +55 -15
  100. package/scripts/cli.mjs +370 -0
  101. package/scripts/doctor.mjs +578 -451
  102. package/scripts/init.mjs +329 -111
  103. package/scripts/manifest.mjs +85 -79
  104. package/scripts/setup.mjs +2 -1
  105. package/scripts/skill.mjs +67 -0
  106. package/skill/SKILL.md +47 -0
@@ -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(
@@ -10,7 +10,7 @@ declare const inputGroupAddonVariants: (props?: ({
10
10
  } & class_variance_authority_types.ClassProp) | undefined) => string;
11
11
  declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
12
12
  declare const inputGroupButtonVariants: (props?: ({
13
- size?: "xs" | "sm" | "icon-xs" | "icon-sm" | null | undefined;
13
+ size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
14
14
  } & class_variance_authority_types.ClassProp) | undefined) => string;
15
15
  declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size" | "type"> & VariantProps<typeof inputGroupButtonVariants> & {
16
16
  type?: "button" | "submit" | "reset";
@@ -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.d.ts CHANGED
@@ -8,10 +8,10 @@ import '@base-ui/react/separator';
8
8
  declare function ItemGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
9
9
  declare function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
10
10
  declare const itemVariants: (props?: ({
11
- variant?: "default" | "outline" | "muted" | null | undefined;
12
- size?: "default" | "xs" | "sm" | null | undefined;
11
+ variant?: "default" | "outline" | "muted" | "card" | null | undefined;
12
+ size?: "default" | "sm" | "xs" | null | undefined;
13
13
  } & class_variance_authority_types.ClassProp) | undefined) => string;
14
- declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
14
+ declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React.JSX.Element;
15
15
  declare const itemMediaVariants: (props?: ({
16
16
  variant?: "image" | "default" | "icon" | null | undefined;
17
17
  } & class_variance_authority_types.ClassProp) | undefined) => string;
package/dist/ui/item.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
2
3
  import { mergeProps } from "@base-ui/react/merge-props";
3
4
  import { useRender } from "@base-ui/react/use-render";
4
5
  import { cva } from "class-variance-authority";
5
6
  import { cn } from "../lib/utils";
6
7
  import { Separator } from "./separator";
8
+ const ItemGroupContext = React.createContext(false);
7
9
  function ItemGroup({ className, ...props }) {
8
- return /* @__PURE__ */ jsx(
10
+ return /* @__PURE__ */ jsx(ItemGroupContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
9
11
  "div",
10
12
  {
11
13
  role: "list",
@@ -16,17 +18,19 @@ function ItemGroup({ className, ...props }) {
16
18
  ),
17
19
  ...props
18
20
  }
19
- );
21
+ ) });
20
22
  }
21
23
  function ItemSeparator({
22
24
  className,
23
25
  ...props
24
26
  }) {
27
+ const enLista = React.useContext(ItemGroupContext);
25
28
  return /* @__PURE__ */ jsx(
26
29
  Separator,
27
30
  {
28
31
  "data-slot": "item-separator",
29
32
  orientation: "horizontal",
33
+ ...enLista ? { "aria-hidden": true } : {},
30
34
  className: cn("my-2", className),
31
35
  ...props
32
36
  }
@@ -39,7 +43,10 @@ const itemVariants = cva(
39
43
  variant: {
40
44
  default: "border-transparent",
41
45
  outline: "border-border",
42
- muted: "border-transparent bg-(--ds-row-hover)"
46
+ muted: "border-transparent bg-(--ds-row-hover)",
47
+ /* Fila-tarjeta (listas de entidades: agentes, herramientas): superficie de tarjeta; el tema
48
+ le da el gesto de su tarjeta (familia «surface»). Pulsable si es enlace o botón. */
49
+ card: "border-border bg-card text-card-foreground shadow-card [a]:hover:bg-card [button]:hover:bg-card [a]:hover:shadow-card-hover [button]:hover:shadow-card-hover"
43
50
  },
44
51
  size: {
45
52
  default: "gap-3.5 px-(--ds-item-px) py-(--ds-item-py)",
@@ -60,7 +67,8 @@ function Item({
60
67
  render,
61
68
  ...props
62
69
  }) {
63
- return useRender({
70
+ const enLista = React.useContext(ItemGroupContext);
71
+ const element = useRender({
64
72
  defaultTagName: "div",
65
73
  props: mergeProps(
66
74
  {
@@ -75,6 +83,8 @@ function Item({
75
83
  size
76
84
  }
77
85
  });
86
+ if (!enLista || props.role === "listitem") return element;
87
+ return /* @__PURE__ */ jsx(ItemGroupContext.Provider, { value: false, children: /* @__PURE__ */ jsx("div", { role: "listitem", "data-slot": "item-listitem", children: element }) });
78
88
  }
79
89
  const itemMediaVariants = cva(
80
90
  "flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none",
@@ -125,7 +135,7 @@ function ItemTitle({ className, ...props }) {
125
135
  {
126
136
  "data-slot": "item-title",
127
137
  className: cn(
128
- "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",
138
+ "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-(--ds-medium-weight) underline-offset-4",
129
139
  className
130
140
  ),
131
141
  ...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
+ };
@@ -4,7 +4,7 @@ import { useRender } from '@base-ui/react/use-render';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const markerVariants: (props?: ({
7
- variant?: "separator" | "default" | "border" | null | undefined;
7
+ variant?: "default" | "separator" | "border" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  declare function Marker({ className, variant, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof markerVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
10
10
  declare function MarkerIcon({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
@@ -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
@@ -90,7 +90,7 @@ function MenubarItem({
90
90
  "data-inset": inset,
91
91
  "data-variant": variant,
92
92
  className: cn(
93
- "group/menubar-item gap-2.5 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-(--ds-disabled-opacity) [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
93
+ "group/menubar-item gap-2.5 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 data-disabled:opacity-(--ds-disabled-opacity) [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
94
94
  className
95
95
  ),
96
96
  ...props
@@ -110,7 +110,7 @@ function MenubarCheckboxItem({
110
110
  "data-slot": "menubar-checkbox-item",
111
111
  "data-inset": inset,
112
112
  className: cn(
113
- "relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py) pr-(--ds-menu-item-px) pl-9.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0",
113
+ "relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py) pr-(--ds-menu-item-px) pl-9.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-highlighted:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0",
114
114
  className
115
115
  ),
116
116
  checked,
@@ -142,7 +142,7 @@ function MenubarRadioItem({
142
142
  "data-slot": "menubar-radio-item",
143
143
  "data-inset": inset,
144
144
  className: cn(
145
- "relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py) pr-(--ds-menu-item-px) pl-9.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
145
+ "relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py) pr-(--ds-menu-item-px) pl-9.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-highlighted:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
146
146
  className
147
147
  ),
148
148
  ...props,
@@ -219,7 +219,7 @@ function MenubarSubTrigger({
219
219
  "data-slot": "menubar-sub-trigger",
220
220
  "data-inset": inset,
221
221
  className: cn(
222
- "gap-2 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-9.5 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
222
+ "gap-2 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm data-highlighted:bg-accent data-highlighted:text-accent-foreground data-inset:pl-9.5 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
223
223
  className
224
224
  ),
225
225
  ...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
@@ -21,11 +21,11 @@ function NativeSelect({
21
21
  {
22
22
  "data-slot": "native-select",
23
23
  "data-size": size,
24
- className: "h-(--ds-control-h-md) w-full min-w-0 appearance-none rounded-control shadow-control border border-input bg-(--ds-field-bg) py-1 pr-8 pl-(--ds-field-px) text-sm transition-colors duration-(--ds-motion-snap) outline-none select-none selection:bg-primary selection:text-primary-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 aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(length:--ds-ring-width) aria-invalid:ring-(--ds-invalid-ring) data-[size=sm]:h-(--ds-control-h-sm) dark:hover:bg-(--ds-field-bg-hover)",
24
+ className: "h-(--ds-control-h-md) w-full min-w-0 cursor-pointer appearance-none rounded-control shadow-control border border-input bg-(--ds-field-bg) py-1 pe-8 ps-(--ds-field-px) text-sm transition-colors duration-(--ds-motion-snap) outline-none select-none selection:bg-primary selection:text-primary-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 aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(length:--ds-ring-width) aria-invalid:ring-(--ds-invalid-ring) data-[size=sm]:h-(--ds-control-h-sm) hover:bg-(--ds-field-bg-hover)",
25
25
  ...props
26
26
  }
27
27
  ),
28
- /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 text-muted-foreground select-none", "aria-hidden": "true", "data-slot": "native-select-icon" })
28
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none absolute top-1/2 end-3.5 size-4 -translate-y-1/2 text-muted-foreground select-none", "aria-hidden": "true", "data-slot": "native-select-icon" })
29
29
  ]
30
30
  }
31
31
  );
@@ -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",