orbital-ds 0.17.0 → 0.18.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.
@@ -0,0 +1,44 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils.js";
3
+ function MediaCard({
4
+ src,
5
+ alt = "",
6
+ title,
7
+ meta,
8
+ badge,
9
+ action,
10
+ className,
11
+ children,
12
+ ...props
13
+ }) {
14
+ return /* @__PURE__ */ jsxs(
15
+ "article",
16
+ {
17
+ "data-slot": "media-card",
18
+ className: cn("group/media flex flex-col overflow-hidden rounded-card border border-border bg-card text-card-foreground shadow-card", className),
19
+ ...props,
20
+ children: [
21
+ /* @__PURE__ */ jsxs("div", { "data-slot": "media-card-media", className: "relative aspect-(--ds-media-aspect) overflow-hidden bg-(--ds-track-bg)", children: [
22
+ src && /* @__PURE__ */ jsx(
23
+ "img",
24
+ {
25
+ src,
26
+ alt,
27
+ className: "size-full object-cover transition-transform duration-(--ds-motion-slow) ease-(--ds-ease-standard) group-hover/media:scale-(--ds-media-zoom) motion-reduce:transition-none"
28
+ }
29
+ ),
30
+ badge && /* @__PURE__ */ jsx("span", { "data-slot": "media-card-badge", className: "absolute start-2 bottom-2 rounded-badge bg-background/80 px-(--ds-badge-px) py-(--ds-badge-py) text-xs text-foreground tabular-nums", children: badge }),
31
+ action && /* @__PURE__ */ jsx("span", { "data-slot": "media-card-action", className: "absolute inset-0 grid place-items-center", children: action })
32
+ ] }),
33
+ /* @__PURE__ */ jsxs("div", { "data-slot": "media-card-body", className: "flex flex-col gap-1 p-(--ds-card-spacing-sm)", children: [
34
+ /* @__PURE__ */ jsx("h3", { "data-slot": "media-card-title", className: "font-display text-base leading-snug font-(--ds-heading-weight)", children: title }),
35
+ meta && /* @__PURE__ */ jsx("p", { "data-slot": "media-card-meta", className: "text-sm text-muted-foreground", children: meta }),
36
+ children
37
+ ] })
38
+ ]
39
+ }
40
+ );
41
+ }
42
+ export {
43
+ MediaCard
44
+ };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+
3
+ declare function WeekStrip({ value, defaultValue, onValueChange, weekStartsOn, marked, className, ...props }: Omit<React.ComponentProps<"div">, "defaultValue" | "onChange"> & {
4
+ value?: Date;
5
+ defaultValue?: Date;
6
+ onValueChange?: (date: Date) => void;
7
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
8
+ /** Devuelve true para los días que llevan un punto (con eventos, por ejemplo). */
9
+ marked?: (date: Date) => boolean;
10
+ }): React.JSX.Element;
11
+
12
+ export { WeekStrip };
@@ -0,0 +1,82 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
5
+ import { useDsLocale, useDsMessages } from "../hooks/use-ds-messages.js";
6
+ import { cn } from "../lib/utils.js";
7
+ import { Button } from "./button.js";
8
+ function startOfDay(d) {
9
+ return new Date(d.getFullYear(), d.getMonth(), d.getDate());
10
+ }
11
+ function addDays(d, n) {
12
+ const r = new Date(d);
13
+ r.setDate(r.getDate() + n);
14
+ return startOfDay(r);
15
+ }
16
+ function sameDay(a, b) {
17
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
18
+ }
19
+ function WeekStrip({
20
+ value,
21
+ defaultValue,
22
+ onValueChange,
23
+ weekStartsOn = 1,
24
+ marked,
25
+ className,
26
+ ...props
27
+ }) {
28
+ const t = useDsMessages();
29
+ const locale = useDsLocale();
30
+ const [inner, setInner] = React.useState(() => startOfDay(defaultValue ?? /* @__PURE__ */ new Date()));
31
+ const selected = startOfDay(value ?? inner);
32
+ const [shift, setShift] = React.useState(0);
33
+ const first = addDays(selected, -((selected.getDay() - weekStartsOn + 7) % 7) + shift * 7);
34
+ const days = Array.from({ length: 7 }, (_, i) => addDays(first, i));
35
+ const today = startOfDay(/* @__PURE__ */ new Date());
36
+ const weekday = new Intl.DateTimeFormat(locale, { weekday: "short" });
37
+ const full = new Intl.DateTimeFormat(locale, { weekday: "long", day: "numeric", month: "long" });
38
+ const choose = (d) => {
39
+ setInner(d);
40
+ setShift(0);
41
+ onValueChange?.(d);
42
+ };
43
+ return /* @__PURE__ */ jsxs(
44
+ "div",
45
+ {
46
+ role: "group",
47
+ "aria-label": t.weekLabel,
48
+ "data-slot": "week-strip",
49
+ className: cn("flex items-center gap-(--ds-week-gap)", className),
50
+ ...props,
51
+ children: [
52
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": t.weekPrevious, onClick: () => setShift((s) => s - 1), children: /* @__PURE__ */ jsx(ChevronLeftIcon, {}) }),
53
+ /* @__PURE__ */ jsx("div", { className: "grid flex-1 grid-cols-7 gap-(--ds-week-gap)", children: days.map((d) => {
54
+ const active = sameDay(d, selected);
55
+ return /* @__PURE__ */ jsxs(
56
+ "button",
57
+ {
58
+ type: "button",
59
+ "data-slot": "week-strip-day",
60
+ "data-active": active || void 0,
61
+ "data-today": sameDay(d, today) || void 0,
62
+ "aria-pressed": active,
63
+ "aria-label": full.format(d),
64
+ onClick: () => choose(d),
65
+ className: "relative flex flex-col items-center gap-0.5 rounded-(--ds-week-day-radius) border border-transparent px-1 py-2 text-sm outline-none transition-colors duration-(--ds-motion-fast) ease-(--ds-ease-standard) hover:bg-muted focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) data-today:border-border data-active:bg-primary data-active:text-primary-foreground motion-reduce:transition-none",
66
+ children: [
67
+ /* @__PURE__ */ jsx("small", { className: "text-xs opacity-70", children: weekday.format(d) }),
68
+ /* @__PURE__ */ jsx("b", { className: "font-display tabular-nums", children: d.getDate() }),
69
+ marked?.(d) && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", "data-slot": "week-strip-mark", className: "absolute bottom-1 size-1 rounded-full bg-current" })
70
+ ]
71
+ },
72
+ d.toISOString()
73
+ );
74
+ }) }),
75
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": t.weekNext, onClick: () => setShift((s) => s + 1), children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) })
76
+ ]
77
+ }
78
+ );
79
+ }
80
+ export {
81
+ WeekStrip
82
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbital-ds",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Sistema de diseño genérico: estructura común + temas con personalidad (qratia, zyro) + ~60 componentes sobre Base UI y Tailwind v4, con contrato verificable y legible por agentes.",
5
5
  "keywords": [
6
6
  "design-system",