orbital-ds 0.36.0 → 0.40.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 (56) hide show
  1. package/AGENTS.md +1 -1
  2. package/components.manifest.json +147 -15
  3. package/dist/hooks/use-ds-messages.d.ts +25 -0
  4. package/dist/hooks/use-in-view.d.ts +9 -0
  5. package/dist/hooks/use-in-view.js +33 -0
  6. package/dist/lib/i18n.d.ts +25 -0
  7. package/dist/lib/i18n.js +75 -0
  8. package/dist/lib/image-upload.d.ts +41 -0
  9. package/dist/lib/image-upload.js +66 -0
  10. package/dist/styles.css +16 -0
  11. package/dist/themes/lagoon.css +4 -1
  12. package/dist/themes/lagoon.scoped.css +4 -1
  13. package/dist/ui/badge.d.ts +5 -1
  14. package/dist/ui/badge.js +23 -3
  15. package/dist/ui/card.d.ts +16 -1
  16. package/dist/ui/card.js +35 -3
  17. package/dist/ui/checkbox.js +1 -1
  18. package/dist/ui/choice-card.js +1 -1
  19. package/dist/ui/combobox.js +1 -1
  20. package/dist/ui/confirm-dialog.d.ts +21 -0
  21. package/dist/ui/confirm-dialog.js +54 -0
  22. package/dist/ui/content-card.d.ts +20 -3
  23. package/dist/ui/content-card.js +66 -38
  24. package/dist/ui/error-state.d.ts +16 -0
  25. package/dist/ui/error-state.js +42 -0
  26. package/dist/ui/input-group.js +1 -1
  27. package/dist/ui/input-otp.js +1 -1
  28. package/dist/ui/input.js +1 -1
  29. package/dist/ui/instruction-editor.d.ts +15 -2
  30. package/dist/ui/instruction-editor.js +139 -16
  31. package/dist/ui/load-more.d.ts +19 -0
  32. package/dist/ui/load-more.js +72 -0
  33. package/dist/ui/loading-state.d.ts +5 -1
  34. package/dist/ui/loading-state.js +16 -12
  35. package/dist/ui/mosaic.d.ts +4 -2
  36. package/dist/ui/mosaic.js +13 -2
  37. package/dist/ui/native-select.js +1 -1
  38. package/dist/ui/questionnaire.js +4 -4
  39. package/dist/ui/radio-group.js +1 -1
  40. package/dist/ui/reveal.d.ts +11 -0
  41. package/dist/ui/reveal.js +39 -0
  42. package/dist/ui/scroll-area.js +1 -1
  43. package/dist/ui/search-box.d.ts +32 -0
  44. package/dist/ui/search-box.js +238 -0
  45. package/dist/ui/select.js +1 -1
  46. package/dist/ui/show-more.d.ts +12 -0
  47. package/dist/ui/show-more.js +66 -0
  48. package/dist/ui/skeleton.d.ts +7 -2
  49. package/dist/ui/skeleton.js +19 -3
  50. package/dist/ui/slider.d.ts +19 -2
  51. package/dist/ui/textarea.js +1 -1
  52. package/docs/designer/criterio.md +87 -0
  53. package/docs/designer/revision.md +11 -0
  54. package/package.json +18 -8
  55. package/scripts/cli.mjs +1 -0
  56. package/skill/SKILL.md +7 -3
@@ -0,0 +1,66 @@
1
+ class ImageUploadError extends Error {
2
+ constructor(code, message) {
3
+ super(message ?? code);
4
+ this.code = code;
5
+ this.name = "ImageUploadError";
6
+ }
7
+ code;
8
+ }
9
+ function checkImageFile(file, { accept = "image/*", maxBytes } = {}) {
10
+ const ok = accept.split(",").map((s) => s.trim()).filter(Boolean).some((a) => a.endsWith("/*") ? file.type.startsWith(a.slice(0, -1)) : file.type === a);
11
+ if (!ok) throw new ImageUploadError("type");
12
+ if (maxBytes !== void 0 && file.size > maxBytes) throw new ImageUploadError("size");
13
+ }
14
+ function createPresignedUploader({
15
+ getUploadUrl,
16
+ fetcher = fetch
17
+ }) {
18
+ return async (file, options) => {
19
+ const { uploadUrl, publicUrl, headers } = await getUploadUrl(file);
20
+ let res;
21
+ try {
22
+ res = await fetcher(uploadUrl, {
23
+ method: "PUT",
24
+ body: file,
25
+ headers: { "Content-Type": file.type, ...headers },
26
+ signal: options?.signal
27
+ });
28
+ } catch {
29
+ throw new ImageUploadError("network");
30
+ }
31
+ if (!res.ok) throw new ImageUploadError("network", `HTTP ${res.status}`);
32
+ return publicUrl;
33
+ };
34
+ }
35
+ function createEndpointUploader({
36
+ endpoint,
37
+ fieldName = "file",
38
+ headers,
39
+ parse = (json) => json,
40
+ fetcher = fetch
41
+ }) {
42
+ return async (file, options) => {
43
+ const body = new FormData();
44
+ body.append(fieldName, file);
45
+ let res;
46
+ try {
47
+ res = await fetcher(endpoint, { method: "POST", body, headers, signal: options?.signal });
48
+ } catch {
49
+ throw new ImageUploadError("network");
50
+ }
51
+ if (!res.ok) throw new ImageUploadError("network", `HTTP ${res.status}`);
52
+ try {
53
+ const out = parse(await res.json());
54
+ if (typeof out === "string" ? !out : !out?.url) throw new Error();
55
+ return out;
56
+ } catch {
57
+ throw new ImageUploadError("response");
58
+ }
59
+ };
60
+ }
61
+ export {
62
+ ImageUploadError,
63
+ checkImageFile,
64
+ createEndpointUploader,
65
+ createPresignedUploader
66
+ };
package/dist/styles.css CHANGED
@@ -332,6 +332,7 @@
332
332
  --ds-control-h-xs: 1.5rem;
333
333
  --ds-chip-h: 1.375rem;
334
334
  --ds-field-bg: color-mix(in oklch, var(--input) 30%, transparent);
335
+ --ds-field-border: var(--input);
335
336
  --ds-field-bg-hover: color-mix(in oklch, var(--input) 50%, transparent);
336
337
  --ds-invalid-border: var(--destructive); /* borde de un campo con error */
337
338
  --ds-switch-track-off: var(--input); /* carril del interruptor apagado */
@@ -476,6 +477,8 @@
476
477
  --ds-badge-ai-fg: var(--info);
477
478
  --ds-badge-ai-border: color-mix(in oklch, var(--info) 35%, transparent);
478
479
  --ds-badge-py: 0.25rem;
480
+ --ds-badge-px-sm: 0.375rem;
481
+ --ds-badge-py-sm: 0.125rem;
479
482
  --ds-bubble-px: 0.875rem;
480
483
  --ds-bubble-py: 0.625rem;
481
484
  --ds-bubble-max-w: 80%;
@@ -509,6 +512,19 @@
509
512
  */
510
513
  --ds-card-spacing: 1.5rem;
511
514
  --ds-card-spacing-sm: 1rem;
515
+ --ds-card-hover-lift: 0.125rem; /* hoverable: cuánto sube */
516
+ --ds-card-spotlight: color-mix(in oklch, var(--primary) 14%, transparent); /* spotlight: color del foco */
517
+ --ds-card-spotlight-size: 18rem; /* spotlight: radio del foco */
518
+ --ds-card-glow: 0 0 0 1px var(--ds-card-hover-border), 0 0.5rem 2rem -0.5rem color-mix(in oklch, var(--primary) 35%, transparent); /* glow: resplandor al señalar */
519
+ --ds-card-cover-min-h: 14rem; /* cover: altura mínima */
520
+ --ds-card-scrim: linear-gradient(to top, color-mix(in oklch, black 78%, transparent) 0%, color-mix(in oklch, black 45%, transparent) 55%, color-mix(in oklch, black 12%, transparent) 100%); /* cover: velo para el contraste del texto */
521
+ --ds-card-cover-fg: oklch(1 0 0); /* cover: texto sobre el velo */
522
+ --ds-card-cover-fg-muted: oklch(1 0 0 / 0.82); /* cover: texto secundario */
523
+ --ds-card-title-lg: 1.5rem; /* titleSize="lg": título grande */
524
+ --ds-card-title-xl: 2rem; /* titleSize="xl": título de portada o héroe */
525
+ --ds-card-cover-blur: 0.75rem; /* plate="blur": desenfoque de la imagen tras el texto */
526
+ --ds-card-cover-plate: color-mix(in oklch, black 32%, transparent); /* plate="blur": tinte de la placa de texto */
527
+ --ds-card-hover-border: color-mix(in oklch, var(--primary) 40%, var(--border)); /* hoverable: borde al señalar */
512
528
  --ds-field-px: 0.75rem;
513
529
  --ds-density: 1; /* escala global de relleno y separación de listas y tablas (0.8 = más denso, 1.2 = más aireado) */
514
530
  --ds-cell-p: calc(0.75rem * var(--ds-density));
@@ -169,7 +169,9 @@
169
169
  --lg-hover-lift: -2px;
170
170
  /* Estados de superficie neutra: filas, campos y menús señalados usan la escalera común */
171
171
  --ds-row-hover: var(--ds-hover-bg);
172
- --ds-field-bg-hover: var(--ds-hover-bg);
172
+ --ds-field-bg: var(--card); /* campo claro y sólido: sobre el lienzo se lee como superficie, no como hueco gris */
173
+ --ds-field-bg-hover: var(--card);
174
+ --ds-field-border: #8d9893; /* borde de campo ≥3:1 sobre la tarjeta (WCAG 1.4.11) */
173
175
  --ds-hover-bg: #e4ebe8;
174
176
  --ds-active-bg: #dae2df;
175
177
  }
@@ -198,6 +200,7 @@
198
200
  --border: #2c322f;
199
201
  --input: #353c3a;
200
202
  --ring: #4fdcb6;
203
+ --ds-field-border: #5a6561;
201
204
 
202
205
  --chart-1: #5b96e6;
203
206
  --chart-2: #14a688;
@@ -169,7 +169,9 @@
169
169
  --lg-hover-lift: -2px;
170
170
  /* Estados de superficie neutra: filas, campos y menús señalados usan la escalera común */
171
171
  --ds-row-hover: var(--ds-hover-bg);
172
- --ds-field-bg-hover: var(--ds-hover-bg);
172
+ --ds-field-bg: var(--card); /* campo claro y sólido: sobre el lienzo se lee como superficie, no como hueco gris */
173
+ --ds-field-bg-hover: var(--card);
174
+ --ds-field-border: #8d9893; /* borde de campo ≥3:1 sobre la tarjeta (WCAG 1.4.11) */
173
175
  --ds-hover-bg: #e4ebe8;
174
176
  --ds-active-bg: #dae2df;
175
177
  }
@@ -198,6 +200,7 @@
198
200
  --border: #2c322f;
199
201
  --input: #353c3a;
200
202
  --ring: #4fdcb6;
203
+ --ds-field-border: #5a6561;
201
204
 
202
205
  --chart-1: #5b96e6;
203
206
  --chart-2: #14a688;
@@ -4,8 +4,12 @@ import { useRender } from '@base-ui/react/use-render';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const badgeVariants: (props?: ({
7
+ size?: "default" | "sm" | null | undefined;
7
8
  variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "info" | "success" | "warning" | "danger" | "neutral" | null | undefined;
8
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
- declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
10
+ declare function Badge({ className, variant, size, dot, render, children, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
11
+ /** Punto de estado a la izquierda, con el color del texto de la variante. */
12
+ dot?: boolean;
13
+ }): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
10
14
 
11
15
  export { Badge, badgeVariants };
package/dist/ui/badge.js CHANGED
@@ -1,11 +1,16 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
2
  import { mergeProps } from "@base-ui/react/merge-props";
2
3
  import { useRender } from "@base-ui/react/use-render";
3
4
  import { cva } from "class-variance-authority";
4
5
  import { cn } from "../lib/utils.js";
5
6
  const badgeVariants = cva(
6
- "group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-badge border border-transparent px-(--ds-badge-px) py-(--ds-badge-py) text-xs font-(--ds-badge-weight) whitespace-nowrap transition-all duration-(--ds-motion-snap) focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(--ds-invalid-ring) [&>svg]:pointer-events-none [&>svg]:size-3!",
7
+ "group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-badge border border-transparent text-xs font-(--ds-badge-weight) whitespace-nowrap transition-all duration-(--ds-motion-snap) focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-(--ds-invalid-border) aria-invalid:ring-(--ds-invalid-ring) [&>svg]:pointer-events-none [&>svg]:size-3!",
7
8
  {
8
9
  variants: {
10
+ size: {
11
+ default: "px-(--ds-badge-px) py-(--ds-badge-py)",
12
+ sm: "px-(--ds-badge-px-sm) py-(--ds-badge-py-sm)"
13
+ },
9
14
  variant: {
10
15
  default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
11
16
  secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
@@ -22,6 +27,7 @@ const badgeVariants = cva(
22
27
  }
23
28
  },
24
29
  defaultVariants: {
30
+ size: "default",
25
31
  variant: "default"
26
32
  }
27
33
  }
@@ -29,19 +35,33 @@ const badgeVariants = cva(
29
35
  function Badge({
30
36
  className,
31
37
  variant = "default",
38
+ size = "default",
39
+ dot = false,
32
40
  render,
41
+ children,
33
42
  ...props
34
43
  }) {
35
44
  return useRender({
36
45
  defaultTagName: "span",
37
46
  props: mergeProps(
38
47
  {
39
- className: cn(badgeVariants({ variant }), className)
48
+ className: cn(badgeVariants({ variant, size }), className),
49
+ children: dot ? /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ /* @__PURE__ */ jsx(
51
+ "span",
52
+ {
53
+ "data-slot": "badge-dot",
54
+ "aria-hidden": "true",
55
+ className: "size-(--ds-status-dot) shrink-0 rounded-full bg-current"
56
+ }
57
+ ),
58
+ children
59
+ ] }) : children
40
60
  },
41
61
  props
42
62
  ),
43
63
  render,
44
- state: { slot: "badge", variant }
64
+ state: { slot: "badge", variant, size }
45
65
  });
46
66
  }
47
67
  export {
package/dist/ui/card.d.ts CHANGED
@@ -1,7 +1,22 @@
1
1
  import * as React from 'react';
2
+ import { AuthBackdropVariant } from './auth-backdrop.js';
2
3
 
3
- declare function Card({ className, size, ...props }: React.ComponentProps<"div"> & {
4
+ declare function Card({ className, size, hoverable, spotlight, glow, backdrop, backdropMedia, backdropGlass, animated, children, onPointerMove, ...props }: React.ComponentProps<"div"> & {
4
5
  size?: "default" | "sm";
6
+ /** Al pasar el ratón la tarjeta se eleva y marca el borde (--ds-card-hover-lift / -border). */
7
+ hoverable?: boolean;
8
+ /** Un foco de luz sigue al puntero por dentro de la tarjeta (solo con ratón; quieto con movimiento reducido). */
9
+ spotlight?: boolean;
10
+ /** Resplandor de marca alrededor de la tarjeta al señalarla (--ds-card-glow). */
11
+ glow?: boolean;
12
+ /** Fondo de AuthBackdrop detrás del contenido (mesh, aurora, image, dots…). Con texto largo, prefiere `dots` o `grid`. */
13
+ backdrop?: AuthBackdropVariant;
14
+ /** backdrop="image": la foto o el vídeo (un <img>/<video> con alt=""). */
15
+ backdropMedia?: React.ReactNode;
16
+ /** Cristal esmerilado encima del fondo. */
17
+ backdropGlass?: boolean;
18
+ /** false = fondo quieto. */
19
+ animated?: boolean;
5
20
  }): React.JSX.Element;
6
21
  declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
7
22
  declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
package/dist/ui/card.js CHANGED
@@ -1,20 +1,52 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { cn } from "../lib/utils.js";
4
+ import { AuthBackdrop } from "./auth-backdrop.js";
3
5
  function Card({
4
6
  className,
5
7
  size = "default",
8
+ hoverable = false,
9
+ spotlight = false,
10
+ glow = false,
11
+ backdrop = "none",
12
+ backdropMedia,
13
+ backdropGlass = false,
14
+ animated = true,
15
+ children,
16
+ onPointerMove,
6
17
  ...props
7
18
  }) {
8
- return /* @__PURE__ */ jsx(
19
+ const withFx = backdrop !== "none" || backdropGlass;
20
+ return /* @__PURE__ */ jsxs(
9
21
  "div",
10
22
  {
11
23
  "data-slot": "card",
12
24
  "data-size": size,
25
+ "data-hoverable": hoverable || void 0,
26
+ "data-spotlight": spotlight || void 0,
27
+ "data-glow": glow || void 0,
28
+ "data-backdrop": withFx ? backdrop : void 0,
29
+ onPointerMove: spotlight ? (event) => {
30
+ onPointerMove?.(event);
31
+ if (event.pointerType !== "mouse") return;
32
+ const el = event.currentTarget;
33
+ const box = el.getBoundingClientRect();
34
+ el.style.setProperty("--ds-spot-x", `${event.clientX - box.left}px`);
35
+ el.style.setProperty("--ds-spot-y", `${event.clientY - box.top}px`);
36
+ } : onPointerMove,
13
37
  className: cn(
14
38
  "group/card flex flex-col gap-(--ds-card-spacing) overflow-hidden rounded-card border bg-card py-(--ds-card-spacing) text-sm text-card-foreground shadow-card transition-shadow duration-(--ds-motion-snap) hover:shadow-card-hover has-[>img:first-child]:pt-0 data-[size=sm]:[--ds-card-spacing:var(--ds-card-spacing-sm)] *:[img:first-child]:rounded-t-card *:[img:last-child]:rounded-b-card",
39
+ hoverable && "transition-[box-shadow,transform,border-color] duration-(--ds-motion-snap) hover:-translate-y-(--ds-card-hover-lift) hover:border-(--ds-card-hover-border) motion-reduce:transition-none motion-reduce:hover:translate-y-0",
40
+ (spotlight || withFx) && "relative isolate",
41
+ spotlight && "before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:opacity-0 before:transition-opacity before:duration-(--ds-motion-snap) before:content-[''] before:[background:radial-gradient(var(--ds-card-spotlight-size)_circle_at_var(--ds-spot-x,50%)_var(--ds-spot-y,50%),var(--ds-card-spotlight),transparent_70%)] hover:before:opacity-100 motion-reduce:before:hidden [@media(hover:none)]:before:hidden",
42
+ glow && "hover:shadow-(--ds-card-glow)",
15
43
  className
16
44
  ),
17
- ...props
45
+ ...props,
46
+ children: [
47
+ withFx ? /* @__PURE__ */ jsx(AuthBackdrop, { variant: backdrop, media: backdropMedia, glass: backdropGlass, animated, className: "-z-10" }) : null,
48
+ children
49
+ ]
18
50
  }
19
51
  );
20
52
  }
@@ -9,7 +9,7 @@ function Checkbox({ className, ...props }) {
9
9
  {
10
10
  "data-slot": "checkbox",
11
11
  className: cn(
12
- "peer relative flex size-(--ds-check-size) shrink-0 items-center justify-center rounded-check border border-input bg-(--ds-check-bg) transition-shadow duration-(--ds-motion-snap) outline-none group-has-disabled/field:opacity-(--ds-disabled-opacity) after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) 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) aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
12
+ "peer relative flex size-(--ds-check-size) shrink-0 items-center justify-center rounded-check border border-(--ds-field-border) bg-(--ds-check-bg) transition-shadow duration-(--ds-motion-snap) outline-none group-has-disabled/field:opacity-(--ds-disabled-opacity) after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) 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) aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
13
13
  className
14
14
  ),
15
15
  ...props,
@@ -79,7 +79,7 @@ function ChoiceCardIndicator({ className, ...props }) {
79
79
  "data-slot": "choice-card-indicator",
80
80
  "aria-hidden": "true",
81
81
  className: cn(
82
- "flex size-(--ds-check-size) shrink-0 items-center justify-center rounded-full border border-input bg-(--ds-check-bg) group-data-checked/choice-card:border-(--ds-choice-card-selected-accent) group-data-checked/choice-card:bg-(--ds-choice-card-selected-accent) group-data-[orientation=vertical]/choice-card:absolute group-data-[orientation=vertical]/choice-card:top-2 group-data-[orientation=vertical]/choice-card:end-2",
82
+ "flex size-(--ds-check-size) shrink-0 items-center justify-center rounded-full border border-(--ds-field-border) bg-(--ds-check-bg) group-data-checked/choice-card:border-(--ds-choice-card-selected-accent) group-data-checked/choice-card:bg-(--ds-choice-card-selected-accent) group-data-[orientation=vertical]/choice-card:absolute group-data-[orientation=vertical]/choice-card:top-2 group-data-[orientation=vertical]/choice-card:end-2",
83
83
  className
84
84
  ),
85
85
  ...props,
@@ -208,7 +208,7 @@ function ComboboxChips({
208
208
  {
209
209
  "data-slot": "combobox-chips",
210
210
  className: cn(
211
- "flex min-h-(--ds-control-h-md) flex-wrap items-center gap-1.5 rounded-control border border-input bg-(--ds-field-bg) bg-clip-padding px-(--ds-field-px) py-1.5 text-sm transition-colors duration-(--ds-motion-snap) focus-within:border-ring focus-within:ring-(length:--ds-ring-width) focus-within:ring-(--ds-ring-color) has-aria-invalid:border-(--ds-invalid-border) has-aria-invalid:ring-(length:--ds-ring-width) has-aria-invalid:ring-(--ds-invalid-ring) has-data-[slot=combobox-chip]:px-1.5",
211
+ "flex min-h-(--ds-control-h-md) flex-wrap items-center gap-1.5 rounded-control border border-(--ds-field-border) bg-(--ds-field-bg) bg-clip-padding px-(--ds-field-px) py-1.5 text-sm transition-colors duration-(--ds-motion-snap) focus-within:border-ring focus-within:ring-(length:--ds-ring-width) focus-within:ring-(--ds-ring-color) has-aria-invalid:border-(--ds-invalid-border) has-aria-invalid:ring-(length:--ds-ring-width) has-aria-invalid:ring-(--ds-invalid-ring) has-data-[slot=combobox-chip]:px-1.5",
212
212
  className
213
213
  ),
214
214
  ...props
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { ConfirmActionPreset } from './confirm-action.js';
3
+
4
+ interface ConfirmOptions {
5
+ title: React.ReactNode;
6
+ description?: React.ReactNode;
7
+ confirmLabel?: React.ReactNode;
8
+ cancelLabel?: React.ReactNode;
9
+ tone?: "destructive" | "default";
10
+ preset?: ConfirmActionPreset;
11
+ /** Texto que hay que escribir (preset `typed`). */
12
+ expected?: string;
13
+ }
14
+ type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
15
+ declare function ConfirmDialogProvider({ children }: {
16
+ children?: React.ReactNode;
17
+ }): React.JSX.Element;
18
+ /** Devuelve `confirm(options)`: promesa de `true` (confirmó) o `false` (canceló). */
19
+ declare function useConfirm(): ConfirmFn;
20
+
21
+ export { ConfirmDialogProvider, type ConfirmOptions, useConfirm };
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { dsWarn } from "../lib/presets.js";
5
+ import { ConfirmAction } from "./confirm-action.js";
6
+ const ConfirmContext = React.createContext(null);
7
+ function ConfirmDialogProvider({ children }) {
8
+ const [options, setOptions] = React.useState(null);
9
+ const [open, setOpen] = React.useState(false);
10
+ const resolver = React.useRef(null);
11
+ const settle = React.useCallback((ok) => {
12
+ resolver.current?.(ok);
13
+ resolver.current = null;
14
+ }, []);
15
+ const confirm = React.useCallback(
16
+ (next) => {
17
+ settle(false);
18
+ setOptions(next);
19
+ setOpen(true);
20
+ return new Promise((resolve) => {
21
+ resolver.current = resolve;
22
+ });
23
+ },
24
+ [settle]
25
+ );
26
+ React.useEffect(() => () => settle(false), [settle]);
27
+ return /* @__PURE__ */ jsxs(ConfirmContext.Provider, { value: confirm, children: [
28
+ children,
29
+ options ? /* @__PURE__ */ jsx(
30
+ ConfirmAction,
31
+ {
32
+ ...options,
33
+ open,
34
+ onOpenChange: (o) => {
35
+ setOpen(o);
36
+ if (!o) settle(false);
37
+ },
38
+ onConfirm: () => settle(true)
39
+ }
40
+ ) : null
41
+ ] });
42
+ }
43
+ function useConfirm() {
44
+ const confirm = React.useContext(ConfirmContext);
45
+ if (confirm) return confirm;
46
+ return async () => {
47
+ dsWarn("useConfirm", "Wrap your app in <ConfirmDialogProvider>; resolving false.");
48
+ return false;
49
+ };
50
+ }
51
+ export {
52
+ ConfirmDialogProvider,
53
+ useConfirm
54
+ };
@@ -1,19 +1,36 @@
1
1
  import * as React from 'react';
2
2
  import { DsDensity } from '../lib/presets.js';
3
+ import { Card } from './card.js';
3
4
  import { IconTile } from './icon-tile.js';
5
+ import './auth-backdrop.js';
4
6
  import 'class-variance-authority/types';
5
7
  import 'class-variance-authority';
6
8
 
7
- type ContentCardPreset = "basic" | "feature" | "media" | "horizontal" | "metric" | "status";
9
+ type ContentCardPreset = "basic" | "feature" | "media" | "horizontal" | "metric" | "status" | "cover";
8
10
  type ContentCardEmphasis = "elevated" | "outlined" | "filled" | "ghost";
9
- declare function ContentCard({ preset, emphasis, tone, density, icon, media, value, delta, title, description, action, footer, href, onSelect, children, className, }: {
11
+ declare function ContentCard({ preset, emphasis, tone, density, icon, media, value, delta, title, description, action, footer, href, onSelect, children, className, spotlight, glow, backdrop, backdropMedia, backdropGlass, animated, titleSize, plate, padding, }: {
10
12
  preset?: ContentCardPreset;
13
+ /** Foco de luz que sigue al ratón (ver Card). */
14
+ spotlight?: boolean;
15
+ /** Resplandor de marca al señalar (ver Card). */
16
+ glow?: boolean;
17
+ /** Fondo detrás del contenido (ver Card). Con `cover` la portada es `media`. */
18
+ backdrop?: React.ComponentProps<typeof Card>["backdrop"];
19
+ backdropMedia?: React.ReactNode;
20
+ backdropGlass?: boolean;
21
+ animated?: boolean;
22
+ /** Tamaño del título: `lg` y `xl` para portadas y celdas destacadas. */
23
+ titleSize?: "default" | "lg" | "xl";
24
+ /** Solo `cover`: `blur` pone el texto sobre una placa con la imagen desenfocada (vidrio). */
25
+ plate?: "none" | "blur";
26
+ /** `none`: contenido a sangre (gráfico, tabla o imagen); cabecera y pie conservan su margen. */
27
+ padding?: "default" | "none";
11
28
  emphasis?: ContentCardEmphasis;
12
29
  tone?: React.ComponentProps<typeof IconTile>["tone"];
13
30
  density?: DsDensity;
14
31
  /** Icono (preset feature o cualquiera con `icon`). */
15
32
  icon?: React.ReactNode;
16
- /** Portada (preset media y horizontal): imagen, vídeo o cualquier nodo. */
33
+ /** Portada (preset media, horizontal y cover): imagen, vídeo o cualquier nodo. */
17
34
  media?: React.ReactNode;
18
35
  /** Dato grande (preset metric). */
19
36
  value?: React.ReactNode;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { dsWarn } from "../lib/presets.js";
5
5
  import { cn } from "../lib/utils.js";
@@ -41,19 +41,30 @@ function ContentCard({
41
41
  href,
42
42
  onSelect,
43
43
  children,
44
- className
44
+ className,
45
+ spotlight,
46
+ glow,
47
+ backdrop,
48
+ backdropMedia,
49
+ backdropGlass,
50
+ animated,
51
+ titleSize = "default",
52
+ plate = "none",
53
+ padding = "default"
45
54
  }) {
46
55
  React.useEffect(() => {
47
56
  if (href && onSelect) dsWarn("ContentCard", "use either `href` or `onSelect`, not both.");
48
- if ((preset === "media" || preset === "horizontal") && !media)
57
+ if ((preset === "media" || preset === "horizontal" || preset === "cover") && !media)
49
58
  dsWarn("ContentCard", `preset="${preset}" needs the \`media\` prop.`);
50
59
  if (preset === "metric" && value == null) dsWarn("ContentCard", 'preset="metric" needs the `value` prop.');
51
60
  }, [href, onSelect, preset, media, value]);
52
61
  const interactive = Boolean(href || onSelect);
53
- const stretch = "after:absolute after:inset-0 after:content-[''] outline-none after:rounded-card focus-visible:after:ring-(length:--ds-ring-width) focus-visible:after:ring-(--ds-ring-color)";
62
+ const stretch = "text-inherit no-underline after:absolute after:inset-0 after:content-[''] outline-none after:rounded-card focus-visible:after:ring-(length:--ds-ring-width) focus-visible:after:ring-(--ds-ring-color)";
54
63
  const titleNode = href ? /* @__PURE__ */ jsx("a", { href, className: stretch, children: title }) : onSelect ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onSelect, className: cn("text-start", stretch), children: title }) : title;
55
64
  const horizontal = preset === "horizontal";
56
- const showIcon = icon && preset !== "media" && preset !== "horizontal" && preset !== "metric" && preset !== "status";
65
+ const cover = preset === "cover";
66
+ const blurPlate = cover && plate === "blur";
67
+ const showIcon = icon && preset !== "media" && preset !== "horizontal" && preset !== "metric" && preset !== "status" && !cover;
57
68
  return /* @__PURE__ */ jsxs(
58
69
  Card,
59
70
  {
@@ -62,47 +73,64 @@ function ContentCard({
62
73
  "data-emphasis": emphasis,
63
74
  "data-tone": tone,
64
75
  "data-density": density,
76
+ spotlight,
77
+ glow,
78
+ backdrop,
79
+ backdropMedia,
80
+ backdropGlass,
81
+ animated,
65
82
  className: cn(
66
83
  "@container/content-card relative",
84
+ cover && "isolate",
85
+ padding === "none" && "gap-0 py-0 [&_[data-slot=card-header]]:py-(--ds-card-spacing) [&_[data-slot=card-content]]:px-0 [&_[data-slot=card-footer]]:py-(--ds-card-spacing)",
86
+ cover && "min-h-(--ds-card-cover-min-h) justify-end border-transparent py-0 text-(--ds-card-cover-fg)",
67
87
  EMPHASIS[emphasis],
68
88
  DENSITY[density],
69
89
  interactive && "cursor-pointer hover:bg-(--ds-row-hover)",
70
- horizontal && "@md/content-card:flex-row @md/content-card:py-0",
90
+ horizontal && "py-0",
71
91
  className
72
92
  ),
73
93
  children: [
74
- media && (preset === "media" || horizontal) ? /* @__PURE__ */ jsx(
75
- "div",
76
- {
77
- "data-slot": "content-card-media",
78
- className: cn(
79
- "aspect-(--ds-media-aspect) w-full shrink-0 overflow-hidden bg-(--ds-track-bg) [&>img]:size-full [&>img]:object-cover",
80
- horizontal && "@md/content-card:aspect-auto @md/content-card:w-1/3"
81
- ),
82
- children: media
83
- }
84
- ) : null,
85
- /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col gap-(--ds-card-spacing)", horizontal && "@md/content-card:py-(--ds-card-spacing)"), children: [
86
- /* @__PURE__ */ jsxs(CardHeader, { children: [
87
- showIcon ? /* @__PURE__ */ jsx(IconTile, { tone, size: "md", className: "mb-1", children: icon }) : null,
88
- preset === "status" ? /* @__PURE__ */ jsx(
89
- "span",
90
- {
91
- "data-slot": "content-card-dot",
92
- "aria-hidden": "true",
93
- className: cn("mb-1 block size-(--ds-status-dot) rounded-full", STATUS_DOT[tone ?? "neutral"])
94
- }
95
- ) : null,
96
- /* @__PURE__ */ jsx(CardTitle, { children: titleNode }),
97
- description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
98
- action ? /* @__PURE__ */ jsx(CardAction, { className: "relative z-(--ds-z-raised)", children: action }) : null
99
- ] }),
100
- preset === "metric" && value != null ? /* @__PURE__ */ jsxs(CardContent, { "data-slot": "content-card-value", className: "flex items-baseline gap-2", children: [
101
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-(--ds-stat-value-weight) tracking-(--ds-tight-tracking) tabular-nums", children: value }),
102
- delta ? /* @__PURE__ */ jsx("span", { className: "text-sm font-(--ds-medium-weight) text-muted-foreground tabular-nums", children: delta }) : null
103
- ] }) : null,
104
- children ? /* @__PURE__ */ jsx(CardContent, { children }) : null,
105
- footer ? /* @__PURE__ */ jsx(CardFooter, { className: "relative z-(--ds-z-raised) gap-2", children: footer }) : null
94
+ cover && media ? /* @__PURE__ */ jsxs(Fragment, { children: [
95
+ /* @__PURE__ */ jsx("div", { "data-slot": "content-card-cover", "aria-hidden": "true", className: "absolute inset-0 -z-20 [&>*]:size-full [&>img]:object-cover [&>video]:object-cover", children: media }),
96
+ /* @__PURE__ */ jsx("div", { "data-slot": "content-card-scrim", "aria-hidden": "true", className: "absolute inset-0 -z-10 bg-(image:--ds-card-scrim)" })
97
+ ] }) : null,
98
+ /* @__PURE__ */ jsxs("div", { "data-slot": "content-card-layout", className: cn("flex min-w-0 flex-1 flex-col gap-(--ds-card-spacing)", horizontal && "@md/content-card:flex-row @md/content-card:gap-0", cover && "justify-end"), children: [
99
+ media && (preset === "media" || horizontal) ? /* @__PURE__ */ jsx(
100
+ "div",
101
+ {
102
+ "data-slot": "content-card-media",
103
+ className: cn(
104
+ "aspect-(--ds-media-aspect) w-full shrink-0 overflow-hidden bg-(--ds-track-bg) [&>img]:size-full [&>img]:object-cover",
105
+ horizontal && "@md/content-card:aspect-auto @md/content-card:w-1/3 @md/content-card:self-stretch"
106
+ ),
107
+ children: media
108
+ }
109
+ ) : null,
110
+ /* @__PURE__ */ jsxs("div", { "data-slot": "content-card-body", "data-plate": blurPlate ? "blur" : void 0, className: cn("flex min-w-0 flex-1 flex-col gap-(--ds-card-spacing)", titleSize === "lg" && "[&_[data-slot=card-title]]:text-(length:--ds-card-title-lg) [&_[data-slot=card-title]]:leading-tight [&_[data-slot=card-title]]:text-balance", titleSize === "xl" && "[&_[data-slot=card-title]]:text-(length:--ds-card-title-xl) [&_[data-slot=card-title]]:leading-tight [&_[data-slot=card-title]]:text-balance", blurPlate && "m-(--ds-card-spacing) mt-auto flex-none rounded-card bg-(--ds-card-cover-plate) py-(--ds-card-spacing) backdrop-blur-(--ds-card-cover-blur)", cover && "justify-end py-(--ds-card-spacing) [&_[data-slot=card-description]]:text-(--ds-card-cover-fg-muted)", horizontal && "@md/content-card:py-(--ds-card-spacing)"), children: [
111
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
112
+ showIcon ? /* @__PURE__ */ jsx(IconTile, { tone, size: "md", className: "mb-1", children: icon }) : null,
113
+ /* @__PURE__ */ jsxs(CardTitle, { className: preset === "status" ? "flex items-center gap-2" : void 0, children: [
114
+ preset === "status" ? /* @__PURE__ */ jsx(
115
+ "span",
116
+ {
117
+ "data-slot": "content-card-dot",
118
+ "aria-hidden": "true",
119
+ className: cn("block size-(--ds-status-dot) shrink-0 rounded-full", STATUS_DOT[tone ?? "neutral"])
120
+ }
121
+ ) : null,
122
+ titleNode
123
+ ] }),
124
+ description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
125
+ action ? /* @__PURE__ */ jsx(CardAction, { className: "relative z-(--ds-z-raised)", children: action }) : null
126
+ ] }),
127
+ preset === "metric" && value != null ? /* @__PURE__ */ jsxs(CardContent, { "data-slot": "content-card-value", className: "flex items-baseline gap-2", children: [
128
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-(--ds-stat-value-weight) tracking-(--ds-tight-tracking) tabular-nums", children: value }),
129
+ delta ? /* @__PURE__ */ jsx("span", { className: "text-sm font-(--ds-medium-weight) text-muted-foreground tabular-nums", children: delta }) : null
130
+ ] }) : null,
131
+ children ? /* @__PURE__ */ jsx(CardContent, { children }) : null,
132
+ footer ? /* @__PURE__ */ jsx(CardFooter, { className: "relative z-(--ds-z-raised) gap-2", children: footer }) : null
133
+ ] })
106
134
  ] })
107
135
  ]
108
136
  }
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { EmptyState } from './empty-state.js';
3
+ import './auth-backdrop.js';
4
+ import './empty.js';
5
+ import 'class-variance-authority/types';
6
+ import 'class-variance-authority';
7
+
8
+ declare function ErrorState({ onRetry, retrying, retryLabel, action, ...props }: Omit<React.ComponentProps<typeof EmptyState>, "preset"> & {
9
+ /** Reintenta la carga. Sin ella no se pinta el botón. */
10
+ onRetry?: () => void | Promise<void>;
11
+ /** Está reintentando: bloquea el botón. */
12
+ retrying?: boolean;
13
+ retryLabel?: React.ReactNode;
14
+ }): React.JSX.Element;
15
+
16
+ export { ErrorState };