orbital-ds 0.44.1 → 0.50.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.
- package/AGENTS.md +42 -10
- package/CHANGELOG.md +489 -0
- package/README.md +2 -2
- package/components.manifest.json +590 -83
- package/dist/hooks/use-ds-messages.d.ts +54 -0
- package/dist/hooks/use-esc-close-stack.d.ts +3 -0
- package/dist/hooks/use-esc-close-stack.js +38 -0
- package/dist/hooks/use-simulated-progress.d.ts +11 -0
- package/dist/hooks/use-simulated-progress.js +30 -0
- package/dist/lib/brand-allowlist.d.ts +3 -0
- package/dist/lib/brand-allowlist.js +719 -0
- package/dist/lib/brand-runtime.d.ts +52 -0
- package/dist/lib/brand-runtime.js +85 -0
- package/dist/lib/echarts-presets.d.ts +81 -1
- package/dist/lib/echarts-presets.js +152 -1
- package/dist/lib/echarts-setup.js +2 -0
- package/dist/lib/i18n.d.ts +54 -0
- package/dist/lib/i18n.js +165 -3
- package/dist/lib/locales/de.js +55 -1
- package/dist/lib/locales/fr.js +55 -1
- package/dist/lib/locales/he.js +55 -1
- package/dist/lib/locales/it.js +55 -1
- package/dist/styles.css +44 -0
- package/dist/themes/tactile.css +1 -6
- package/dist/themes/tactile.scoped.css +1 -6
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/api-key-list.d.ts +40 -0
- package/dist/ui/api-key-list.js +89 -0
- package/dist/ui/attachment.d.ts +3 -3
- package/dist/ui/audit-log.d.ts +53 -0
- package/dist/ui/audit-log.js +102 -0
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/bubble.d.ts +1 -1
- package/dist/ui/button-group.d.ts +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/chart-card.d.ts +0 -1
- package/dist/ui/context-menu.js +2 -2
- package/dist/ui/cta-banner.d.ts +30 -0
- package/dist/ui/cta-banner.js +63 -0
- package/dist/ui/detail-panel.d.ts +3 -1
- package/dist/ui/detail-panel.js +2 -2
- package/dist/ui/faq.d.ts +34 -0
- package/dist/ui/faq.js +25 -0
- package/dist/ui/feature-grid.d.ts +40 -0
- package/dist/ui/feature-grid.js +40 -0
- package/dist/ui/field.d.ts +1 -1
- package/dist/ui/input-group.d.ts +1 -1
- package/dist/ui/item.d.ts +3 -3
- package/dist/ui/landing-section.d.ts +34 -0
- package/dist/ui/landing-section.js +59 -0
- package/dist/ui/marker.d.ts +1 -1
- package/dist/ui/member-list.d.ts +43 -0
- package/dist/ui/member-list.js +107 -0
- package/dist/ui/onboarding-checklist.d.ts +38 -0
- package/dist/ui/onboarding-checklist.js +132 -0
- package/dist/ui/panel.d.ts +2 -2
- package/dist/ui/permission-matrix.d.ts +35 -0
- package/dist/ui/permission-matrix.js +89 -0
- package/dist/ui/plan-summary.d.ts +59 -0
- package/dist/ui/plan-summary.js +92 -0
- package/dist/ui/popover.d.ts +1 -1
- package/dist/ui/pricing-table.d.ts +29 -0
- package/dist/ui/pricing-table.js +86 -0
- package/dist/ui/sheet.d.ts +2 -2
- package/dist/ui/sheet.js +1 -1
- package/dist/ui/sidebar.d.ts +1 -1
- package/dist/ui/sparkline.d.ts +1 -1
- package/dist/ui/status-badge.d.ts +2 -2
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/testimonial.d.ts +37 -0
- package/dist/ui/testimonial.js +61 -0
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/upgrade-prompt.d.ts +24 -0
- package/dist/ui/upgrade-prompt.js +85 -0
- package/dist/ui/workspace-switcher.d.ts +28 -0
- package/dist/ui/workspace-switcher.js +92 -0
- package/docs/GRAFICOS.md +1 -1
- package/docs/designer/patrones.md +36 -3
- package/manifest/actions.json +1 -1
- package/manifest/agents.json +1 -1
- package/manifest/ai.json +1 -1
- package/manifest/auth.json +1 -1
- package/manifest/chat.json +1 -1
- package/manifest/content.json +496 -1
- package/manifest/data.json +498 -103
- package/manifest/feedback.json +234 -47
- package/manifest/forms.json +1 -1
- package/manifest/motion.json +3 -3
- package/manifest/navigation.json +104 -3
- package/manifest/overlays.json +15 -12
- package/package.json +6 -18
- package/scripts/cli.mjs +82 -5
- package/scripts/doctor.mjs +32 -4
- package/scripts/eslint-plugin.mjs +32 -0
- package/scripts/manifest.mjs +20 -0
- package/scripts/skill.mjs +85 -0
- package/scripts/upgrade.mjs +126 -0
- package/skill/SKILL.md +5 -2
- package/dist/ui/chart.d.ts +0 -65
- package/dist/ui/chart.js +0 -254
- package/dist/ui/sonner.d.ts +0 -6
- package/dist/ui/sonner.js +0 -60
package/dist/ui/item.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ 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?: "
|
|
12
|
-
size?: "default" | "
|
|
11
|
+
variant?: "outline" | "default" | "muted" | "card" | null | undefined;
|
|
12
|
+
size?: "default" | "xs" | "sm" | null | undefined;
|
|
13
13
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
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
|
-
variant?: "
|
|
16
|
+
variant?: "icon" | "default" | "image" | null | undefined;
|
|
17
17
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
18
18
|
declare function ItemMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React.JSX.Element;
|
|
19
19
|
declare function ItemContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @group content
|
|
5
|
+
* @summary Sección de una web pública bajo el Hero: antetítulo, título, texto y el bloque que la ocupa (características, precios, testimonios, preguntas frecuentes).
|
|
6
|
+
* @see hero — la portada de arriba del todo, una por página
|
|
7
|
+
* @see page-header — cabecera de una vista de trabajo dentro de la app
|
|
8
|
+
* @example Sección de características
|
|
9
|
+
* <LandingSection eyebrow="Cómo funciona" title="Todo lo que necesitas para empezar" description="Sin instalar nada y en cinco minutos.">
|
|
10
|
+
* <FeatureGrid>
|
|
11
|
+
* <Feature icon={<ZapIcon />} title="Rápido" description="Respuestas en milisegundos." />
|
|
12
|
+
* </FeatureGrid>
|
|
13
|
+
* </LandingSection>
|
|
14
|
+
* @example Alineada al inicio, con una acción
|
|
15
|
+
* <LandingSection align="start" title="Preguntas frecuentes" actions={<Button variant="outline">Contactar</Button>}>
|
|
16
|
+
* <Faq items={faqs} />
|
|
17
|
+
* </LandingSection>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
type LandingSectionProps = Omit<React.ComponentProps<"section">, "title"> & {
|
|
21
|
+
/** Título de la sección. No es el atributo HTML `title`. */
|
|
22
|
+
title?: React.ReactNode;
|
|
23
|
+
description?: React.ReactNode;
|
|
24
|
+
/** Sobre el título: la categoría o una Badge. */
|
|
25
|
+
eyebrow?: React.ReactNode;
|
|
26
|
+
/** Una acción de la sección (ver todo, contactar). */
|
|
27
|
+
actions?: React.ReactNode;
|
|
28
|
+
align?: "start" | "center";
|
|
29
|
+
/** h2 por defecto; h3 si la sección va dentro de otra. */
|
|
30
|
+
titleAs?: "h2" | "h3";
|
|
31
|
+
};
|
|
32
|
+
declare function LandingSection({ title, description, eyebrow, actions, align, titleAs: Title, className, children, ...props }: LandingSectionProps): React.JSX.Element;
|
|
33
|
+
|
|
34
|
+
export { LandingSection, type LandingSectionProps };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
function LandingSection({
|
|
6
|
+
title,
|
|
7
|
+
description,
|
|
8
|
+
eyebrow,
|
|
9
|
+
actions,
|
|
10
|
+
align = "center",
|
|
11
|
+
titleAs: Title = "h2",
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const id = React.useId();
|
|
17
|
+
const center = align === "center";
|
|
18
|
+
const hasHeader = title != null || description != null || eyebrow != null || actions != null;
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"section",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "landing-section",
|
|
23
|
+
"data-align": align,
|
|
24
|
+
"aria-labelledby": title != null ? id : void 0,
|
|
25
|
+
className: cn("@container/landing w-full px-(--ds-hero-px) py-(--ds-landing-py) @3xl/landing:py-(--ds-landing-py-wide)", className),
|
|
26
|
+
...props,
|
|
27
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-(--ds-page-max-w) flex-col gap-(--ds-landing-body-gap)", children: [
|
|
28
|
+
hasHeader ? /* @__PURE__ */ jsxs(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "landing-section-header",
|
|
32
|
+
className: cn(
|
|
33
|
+
"flex max-w-(--ds-landing-measure) flex-col gap-(--ds-landing-header-gap)",
|
|
34
|
+
center ? "mx-auto items-center text-center" : "items-start text-start"
|
|
35
|
+
),
|
|
36
|
+
children: [
|
|
37
|
+
eyebrow != null ? /* @__PURE__ */ jsx("div", { "data-slot": "landing-section-eyebrow", className: "text-sm font-(--ds-medium-weight) text-primary", children: eyebrow }) : null,
|
|
38
|
+
title != null ? /* @__PURE__ */ jsx(
|
|
39
|
+
Title,
|
|
40
|
+
{
|
|
41
|
+
id,
|
|
42
|
+
"data-slot": "landing-section-title",
|
|
43
|
+
className: "text-(length:--ds-landing-title-size) leading-(--ds-hero-title-leading) font-(--ds-heading-weight) tracking-(--ds-heading-tracking) text-balance @3xl/landing:text-(length:--ds-landing-title-size-wide)",
|
|
44
|
+
children: title
|
|
45
|
+
}
|
|
46
|
+
) : null,
|
|
47
|
+
description != null ? /* @__PURE__ */ jsx("p", { "data-slot": "landing-section-description", className: "text-(length:--ds-hero-description-size) text-pretty text-muted-foreground", children: description }) : null,
|
|
48
|
+
actions != null ? /* @__PURE__ */ jsx("div", { "data-slot": "landing-section-actions", className: cn("flex flex-wrap items-center gap-3", center && "justify-center"), children: actions }) : null
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
) : null,
|
|
52
|
+
children != null ? /* @__PURE__ */ jsx("div", { "data-slot": "landing-section-body", className: "min-w-0", children }) : null
|
|
53
|
+
] })
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
LandingSection
|
|
59
|
+
};
|
package/dist/ui/marker.d.ts
CHANGED
|
@@ -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?: "
|
|
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;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type MemberListPreset = "team" | "workspace" | "compact";
|
|
4
|
+
type MemberStatus = "active" | "invited" | "suspended";
|
|
5
|
+
type MemberInfo = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: React.ReactNode;
|
|
8
|
+
/** Texto para iniciales y etiquetas accesibles cuando `name` no es texto. */
|
|
9
|
+
label?: string;
|
|
10
|
+
email?: React.ReactNode;
|
|
11
|
+
avatar?: string;
|
|
12
|
+
role: string;
|
|
13
|
+
status?: MemberStatus;
|
|
14
|
+
/** Última actividad (fecha). */
|
|
15
|
+
lastActive?: string | number | Date;
|
|
16
|
+
/** La persona que mira la lista. */
|
|
17
|
+
you?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type MemberRole = {
|
|
20
|
+
value: string;
|
|
21
|
+
label: React.ReactNode;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type MemberListProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
25
|
+
preset?: MemberListPreset;
|
|
26
|
+
members: MemberInfo[];
|
|
27
|
+
roles: MemberRole[];
|
|
28
|
+
/** Rol editable con un Select (si hay `onRoleChange`). */
|
|
29
|
+
editable?: boolean;
|
|
30
|
+
/** Muestra la última actividad. */
|
|
31
|
+
showActivity?: boolean;
|
|
32
|
+
/** Separa las invitaciones pendientes al final. */
|
|
33
|
+
groupInvites?: boolean;
|
|
34
|
+
onRoleChange?: (id: string, role: string) => void | Promise<void>;
|
|
35
|
+
onRemove?: (id: string) => void | Promise<void>;
|
|
36
|
+
onResendInvite?: (id: string) => void | Promise<void>;
|
|
37
|
+
onCancelInvite?: (id: string) => void | Promise<void>;
|
|
38
|
+
/** Acciones propias por persona (DropdownMenuItem), además de las de serie. */
|
|
39
|
+
renderActions?: (member: MemberInfo) => React.ReactNode;
|
|
40
|
+
};
|
|
41
|
+
declare function MemberList({ preset, members, roles, editable, showActivity, groupInvites, onRoleChange, onRemove, onResendInvite, onCancelInvite, renderActions, className, ...props }: MemberListProps): React.JSX.Element;
|
|
42
|
+
|
|
43
|
+
export { type MemberInfo, MemberList, type MemberListPreset, type MemberListProps, type MemberRole, type MemberStatus };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MoreHorizontalIcon } from "lucide-react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
8
|
+
import { Badge } from "./badge.js";
|
|
9
|
+
import { Button } from "./button.js";
|
|
10
|
+
import { RelativeTime } from "./date-time.js";
|
|
11
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
12
|
+
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from "./item.js";
|
|
13
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
14
|
+
const PRESETS = {
|
|
15
|
+
team: { editable: true, showActivity: false, groupInvites: false, size: "sm", variant: "card" },
|
|
16
|
+
workspace: { editable: true, showActivity: true, groupInvites: true, size: "sm", variant: "card" },
|
|
17
|
+
compact: { editable: false, showActivity: false, groupInvites: false, size: "xs", variant: "default" }
|
|
18
|
+
};
|
|
19
|
+
function initials(text) {
|
|
20
|
+
return text.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0]?.toUpperCase() ?? "").join("");
|
|
21
|
+
}
|
|
22
|
+
function MemberList({
|
|
23
|
+
preset = "team",
|
|
24
|
+
members,
|
|
25
|
+
roles,
|
|
26
|
+
editable,
|
|
27
|
+
showActivity,
|
|
28
|
+
groupInvites,
|
|
29
|
+
onRoleChange,
|
|
30
|
+
onRemove,
|
|
31
|
+
onResendInvite,
|
|
32
|
+
onCancelInvite,
|
|
33
|
+
renderActions,
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
const t = useDsMessages();
|
|
38
|
+
const p = PRESETS[preset];
|
|
39
|
+
const canEdit = (editable ?? p.editable) && onRoleChange != null;
|
|
40
|
+
const activity = showActivity ?? p.showActivity;
|
|
41
|
+
const split = groupInvites ?? p.groupInvites;
|
|
42
|
+
const items = roles.map((r) => ({ value: r.value, label: r.label }));
|
|
43
|
+
const roleLabel = (value) => roles.find((r) => r.value === value)?.label ?? value;
|
|
44
|
+
const active = split ? members.filter((m) => m.status !== "invited") : members;
|
|
45
|
+
const invited = split ? members.filter((m) => m.status === "invited") : [];
|
|
46
|
+
const row = (m) => {
|
|
47
|
+
const text = m.label ?? (typeof m.name === "string" ? m.name : m.id);
|
|
48
|
+
const isInvite = m.status === "invited";
|
|
49
|
+
const menu = !m.you && (onRemove || isInvite && (onResendInvite || onCancelInvite) || renderActions);
|
|
50
|
+
return /* @__PURE__ */ jsxs(Item, { variant: p.variant, size: p.size, "data-slot": "member-list-item", "data-status": m.status ?? "active", "data-you": m.you || void 0, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(ItemMedia, { children: /* @__PURE__ */ jsxs(Avatar, { size: preset === "compact" ? "sm" : "default", children: [
|
|
52
|
+
m.avatar ? /* @__PURE__ */ jsx(AvatarImage, { src: m.avatar, alt: "" }) : null,
|
|
53
|
+
/* @__PURE__ */ jsx(AvatarFallback, { children: initials(text) })
|
|
54
|
+
] }) }),
|
|
55
|
+
/* @__PURE__ */ jsxs(ItemContent, { className: "min-w-0", children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(ItemTitle, { className: "min-w-0", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
58
|
+
m.you ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", size: "sm", children: t.memberYou }) : null,
|
|
59
|
+
isInvite ? /* @__PURE__ */ jsx(Badge, { variant: "info", size: "sm", children: t.memberInvited }) : null,
|
|
60
|
+
m.status === "suspended" ? /* @__PURE__ */ jsx(Badge, { variant: "warning", size: "sm", children: t.memberSuspended }) : null
|
|
61
|
+
] }),
|
|
62
|
+
(m.email != null || activity && m.lastActive != null) && preset !== "compact" ? /* @__PURE__ */ jsxs(ItemDescription, { className: "truncate", children: [
|
|
63
|
+
m.email,
|
|
64
|
+
m.email != null && activity && m.lastActive != null ? " \xB7 " : null,
|
|
65
|
+
activity && m.lastActive != null ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
t.memberLastActive,
|
|
67
|
+
" ",
|
|
68
|
+
/* @__PURE__ */ jsx(RelativeTime, { value: m.lastActive })
|
|
69
|
+
] }) : null
|
|
70
|
+
] }) : null
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsxs(ItemActions, { className: "gap-1", children: [
|
|
73
|
+
canEdit && !m.you ? /* @__PURE__ */ jsxs(Select, { items, value: m.role, onValueChange: (v) => v != null && void onRoleChange?.(m.id, String(v)), children: [
|
|
74
|
+
/* @__PURE__ */ jsx(SelectTrigger, { size: "sm", "aria-label": dsFormat(t.memberRoleOf, { name: text }), children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
75
|
+
/* @__PURE__ */ jsx(SelectContent, { children: roles.map((r) => /* @__PURE__ */ jsx(SelectItem, { value: r.value, disabled: r.disabled, children: r.label }, r.value)) })
|
|
76
|
+
] }) : /* @__PURE__ */ jsx(Badge, { variant: "outline", size: "sm", "data-slot": "member-list-role", children: roleLabel(m.role) }),
|
|
77
|
+
menu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
78
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": dsFormat(t.conversationActions, { name: text }) }), children: /* @__PURE__ */ jsx(MoreHorizontalIcon, {}) }),
|
|
79
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
|
|
80
|
+
isInvite && onResendInvite ? /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => void onResendInvite(m.id), children: t.memberResendInvite }) : null,
|
|
81
|
+
renderActions?.(m),
|
|
82
|
+
isInvite && onCancelInvite ? /* @__PURE__ */ jsx(DropdownMenuItem, { variant: "destructive", onClick: () => void onCancelInvite(m.id), children: t.memberCancelInvite }) : null,
|
|
83
|
+
!isInvite && onRemove ? /* @__PURE__ */ jsx(DropdownMenuItem, { variant: "destructive", onClick: () => void onRemove(m.id), children: t.memberRemove }) : null
|
|
84
|
+
] })
|
|
85
|
+
] }) : null
|
|
86
|
+
] })
|
|
87
|
+
] }, m.id);
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "member-list", "data-preset": preset, className: cn("flex min-w-0 flex-col gap-4", className), ...props, children: [
|
|
90
|
+
/* @__PURE__ */ jsx(ItemGroup, { className: preset === "compact" ? "gap-0" : "gap-2", children: active.map(row) }),
|
|
91
|
+
invited.length > 0 && /* @__PURE__ */ jsxs("section", { "data-slot": "member-list-invites", className: "flex flex-col gap-2", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("h3", { className: "text-xs font-(--ds-medium-weight) text-muted-foreground", children: [
|
|
93
|
+
t.memberPendingInvites,
|
|
94
|
+
" ",
|
|
95
|
+
/* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
|
|
96
|
+
"(",
|
|
97
|
+
invited.length,
|
|
98
|
+
")"
|
|
99
|
+
] })
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ jsx(ItemGroup, { className: "gap-2", children: invited.map(row) })
|
|
102
|
+
] })
|
|
103
|
+
] });
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
MemberList
|
|
107
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DsDensity } from '../lib/presets.js';
|
|
3
|
+
|
|
4
|
+
type OnboardingPreset = "card" | "sidebar" | "page";
|
|
5
|
+
type OnboardingStep = {
|
|
6
|
+
id: string;
|
|
7
|
+
title: React.ReactNode;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
done?: boolean;
|
|
10
|
+
/** No cuenta para el progreso ni bloquea el «Todo listo». */
|
|
11
|
+
optional?: boolean;
|
|
12
|
+
/** Acción del paso (un botón): solo se enseña en el paso que toca, o en todos con `showAllActions`. */
|
|
13
|
+
action?: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
type OnboardingChecklistProps = Omit<React.ComponentProps<"section">, "title"> & {
|
|
16
|
+
preset?: OnboardingPreset;
|
|
17
|
+
title: React.ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
steps: OnboardingStep[];
|
|
20
|
+
density?: DsDensity;
|
|
21
|
+
/** Solo el paso que toca a la vista; el resto se despliega. */
|
|
22
|
+
collapsed?: boolean;
|
|
23
|
+
/** Pliega los pasos hechos detrás de «Ver los hechos». */
|
|
24
|
+
hideCompleted?: boolean;
|
|
25
|
+
/** Enseña la descripción de cada paso (si no, solo la del que toca). */
|
|
26
|
+
showDescriptions?: boolean;
|
|
27
|
+
/** Acciones en todos los pasos sin hacer, no solo en el que toca. */
|
|
28
|
+
showAllActions?: boolean;
|
|
29
|
+
/** Muestra el botón de ocultar la lista. */
|
|
30
|
+
onDismiss?: () => void;
|
|
31
|
+
/** Contenido al completarlo todo (por defecto, «Todo listo»). */
|
|
32
|
+
completeContent?: React.ReactNode;
|
|
33
|
+
/** Nivel del título (h2 por defecto). */
|
|
34
|
+
headingLevel?: 2 | 3 | 4;
|
|
35
|
+
};
|
|
36
|
+
declare function OnboardingChecklist({ preset, title, description, steps, density, collapsed, hideCompleted, showDescriptions, showAllActions, onDismiss, completeContent, headingLevel, className, ...props }: OnboardingChecklistProps): React.JSX.Element;
|
|
37
|
+
|
|
38
|
+
export { OnboardingChecklist, type OnboardingChecklistProps, type OnboardingPreset, type OnboardingStep };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
6
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { Button } from "./button.js";
|
|
9
|
+
import { Card } from "./card.js";
|
|
10
|
+
import { Progress } from "./progress.js";
|
|
11
|
+
const PRESETS = {
|
|
12
|
+
card: { density: "default", collapsed: false, hideCompleted: true, showDescriptions: true, surface: true },
|
|
13
|
+
sidebar: { density: "compact", collapsed: true, hideCompleted: true, showDescriptions: false, surface: false },
|
|
14
|
+
page: { density: "comfortable", collapsed: false, hideCompleted: false, showDescriptions: true, surface: true }
|
|
15
|
+
};
|
|
16
|
+
const GAP = { compact: "gap-1", default: "gap-1.5", comfortable: "gap-2" };
|
|
17
|
+
const STEP_PAD = { compact: "px-2 py-1.5", default: "px-3 py-2.5", comfortable: "px-4 py-3.5" };
|
|
18
|
+
function OnboardingChecklist({
|
|
19
|
+
preset = "card",
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
steps,
|
|
23
|
+
density,
|
|
24
|
+
collapsed,
|
|
25
|
+
hideCompleted,
|
|
26
|
+
showDescriptions,
|
|
27
|
+
showAllActions = false,
|
|
28
|
+
onDismiss,
|
|
29
|
+
completeContent,
|
|
30
|
+
headingLevel = 2,
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}) {
|
|
34
|
+
const t = useDsMessages();
|
|
35
|
+
const p = PRESETS[preset];
|
|
36
|
+
const d = density ?? p.density;
|
|
37
|
+
const isCollapsed = collapsed ?? p.collapsed;
|
|
38
|
+
const hide = hideCompleted ?? p.hideCompleted;
|
|
39
|
+
const descriptions = showDescriptions ?? p.showDescriptions;
|
|
40
|
+
const [expanded, setExpanded] = React.useState(!isCollapsed);
|
|
41
|
+
const [showDone, setShowDone] = React.useState(!hide);
|
|
42
|
+
const listId = React.useId();
|
|
43
|
+
const required = steps.filter((s) => !s.optional);
|
|
44
|
+
const doneCount = required.filter((s) => s.done).length;
|
|
45
|
+
const total = required.length;
|
|
46
|
+
const current = steps.find((s) => !s.done && !s.optional) ?? steps.find((s) => !s.done);
|
|
47
|
+
const complete = total > 0 && doneCount === total;
|
|
48
|
+
const completedSteps = steps.filter((s) => s.done);
|
|
49
|
+
const visible = steps.filter((s) => {
|
|
50
|
+
if (!expanded) return s === current;
|
|
51
|
+
if (s.done && !showDone) return false;
|
|
52
|
+
return true;
|
|
53
|
+
});
|
|
54
|
+
const Heading = `h${headingLevel}`;
|
|
55
|
+
const header = /* @__PURE__ */ jsxs("div", { "data-slot": "onboarding-checklist-header", className: "flex min-w-0 flex-col gap-2", children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
57
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Heading, { "data-slot": "onboarding-checklist-title", className: cn("leading-tight font-(--ds-heading-weight) text-foreground", d === "compact" ? "text-sm" : "text-base"), children: title }),
|
|
59
|
+
description != null && d !== "compact" && /* @__PURE__ */ jsx("p", { className: "text-sm text-pretty text-muted-foreground", children: description })
|
|
60
|
+
] }),
|
|
61
|
+
isCollapsed && steps.length > 1 && /* @__PURE__ */ jsx(Button, { type: "button", size: "icon-xs", variant: "ghost", "aria-expanded": expanded, "aria-controls": listId, "aria-label": expanded ? t.showLess : t.showMore, onClick: () => setExpanded((v) => !v), children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("transition-transform duration-(--ds-motion-snap)", expanded && "rotate-180") }) }),
|
|
62
|
+
onDismiss && /* @__PURE__ */ jsx(Button, { type: "button", size: "icon-xs", variant: "ghost", "aria-label": t.onboardingDismiss, title: t.onboardingDismiss, onClick: onDismiss, children: /* @__PURE__ */ jsx(XIcon, {}) })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
65
|
+
/* @__PURE__ */ jsx(Progress, { value: total ? doneCount / total * 100 : 0, "aria-label": dsFormat(t.onboardingProgress, { done: doneCount, total }), className: "flex-1" }),
|
|
66
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "onboarding-checklist-count", className: "shrink-0 text-xs text-muted-foreground tabular-nums", children: dsFormat(t.onboardingProgress, { done: doneCount, total }) })
|
|
67
|
+
] })
|
|
68
|
+
] });
|
|
69
|
+
const body = complete ? /* @__PURE__ */ jsxs("div", { "data-slot": "onboarding-checklist-complete", role: "status", className: "flex items-center gap-2 text-sm text-foreground", children: [
|
|
70
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "flex size-(--ds-onboarding-check) items-center justify-center rounded-full bg-(--ds-onboarding-check-done) text-background [&_svg]:size-3", children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
71
|
+
completeContent ?? t.onboardingComplete
|
|
72
|
+
] }) : /* @__PURE__ */ jsx("ol", { id: listId, "data-slot": "onboarding-checklist-steps", className: cn("flex flex-col", GAP[d]), children: visible.map((s) => {
|
|
73
|
+
const state = s.done ? "done" : s === current ? "current" : "todo";
|
|
74
|
+
const showAction = !s.done && s.action != null && (state === "current" || showAllActions);
|
|
75
|
+
const showDesc = s.description != null && !s.done && (descriptions || state === "current");
|
|
76
|
+
return /* @__PURE__ */ jsxs(
|
|
77
|
+
"li",
|
|
78
|
+
{
|
|
79
|
+
"data-slot": "onboarding-checklist-step",
|
|
80
|
+
"data-state": state,
|
|
81
|
+
"aria-current": state === "current" ? "step" : void 0,
|
|
82
|
+
className: cn("flex min-w-0 items-start gap-3 rounded-item", STEP_PAD[d], state === "current" && "bg-(--ds-onboarding-current-bg)"),
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsxs(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
"data-slot": "onboarding-checklist-check",
|
|
88
|
+
className: cn(
|
|
89
|
+
"mt-0.5 flex size-(--ds-onboarding-check) shrink-0 items-center justify-center rounded-full border [&_svg]:size-3",
|
|
90
|
+
s.done ? "border-(--ds-onboarding-check-done) bg-(--ds-onboarding-check-done) text-background" : state === "current" ? "border-primary" : "border-(--ds-field-border)"
|
|
91
|
+
),
|
|
92
|
+
children: [
|
|
93
|
+
s.done ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }) : null,
|
|
94
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: s.done ? t.onboardingStepDone : t.onboardingStepTodo })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2", children: [
|
|
100
|
+
/* @__PURE__ */ jsx("span", { className: cn("text-sm", s.done ? "text-muted-foreground line-through" : "font-(--ds-medium-weight) text-foreground"), children: s.title }),
|
|
101
|
+
s.optional && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t.onboardingOptional })
|
|
102
|
+
] }),
|
|
103
|
+
showDesc && /* @__PURE__ */ jsx("p", { className: "text-sm text-pretty text-muted-foreground", children: s.description }),
|
|
104
|
+
showAction && /* @__PURE__ */ jsx("div", { "data-slot": "onboarding-checklist-action", className: "flex flex-wrap gap-2 pt-1", children: s.action })
|
|
105
|
+
] })
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
s.id
|
|
109
|
+
);
|
|
110
|
+
}) });
|
|
111
|
+
const toggleDone = expanded && hide && completedSteps.length > 0 && !complete && /* @__PURE__ */ jsx(Button, { type: "button", size: "xs", variant: "ghost", className: "self-start", "aria-expanded": showDone, "aria-controls": listId, onClick: () => setShowDone((v) => !v), children: showDone ? t.onboardingHideCompleted : t.onboardingShowCompleted });
|
|
112
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
header,
|
|
114
|
+
body,
|
|
115
|
+
toggleDone
|
|
116
|
+
] });
|
|
117
|
+
return /* @__PURE__ */ jsx(
|
|
118
|
+
"section",
|
|
119
|
+
{
|
|
120
|
+
"data-slot": "onboarding-checklist",
|
|
121
|
+
"data-preset": preset,
|
|
122
|
+
"data-density": d,
|
|
123
|
+
"data-complete": complete || void 0,
|
|
124
|
+
className: cn("min-w-0", className),
|
|
125
|
+
...props,
|
|
126
|
+
children: p.surface ? /* @__PURE__ */ jsx(Card, { className: cn("flex flex-col px-(--ds-card-spacing)", d === "comfortable" ? "gap-4" : "gap-3"), children: content }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: content })
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
OnboardingChecklist
|
|
132
|
+
};
|
package/dist/ui/panel.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const panelVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
8
|
-
size?: "sm" | "
|
|
7
|
+
variant?: "outline" | "default" | "ghost" | "muted" | "glass" | null | undefined;
|
|
8
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
declare function Panel({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof panelVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
11
11
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type PermissionMatrixPreset = "roles" | "review" | "scopes";
|
|
4
|
+
type Permission = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type PermissionGroup = {
|
|
10
|
+
id: string;
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
permissions: Permission[];
|
|
13
|
+
};
|
|
14
|
+
type PermissionRole = {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
type PermissionValue = Record<string, string[]>;
|
|
19
|
+
type PermissionMatrixProps = Omit<React.ComponentProps<"div">, "onChange" | "children"> & {
|
|
20
|
+
preset?: PermissionMatrixPreset;
|
|
21
|
+
roles: PermissionRole[];
|
|
22
|
+
groups: PermissionGroup[];
|
|
23
|
+
value: PermissionValue;
|
|
24
|
+
/** Recibe el valor nuevo completo. Sin él, solo lectura. */
|
|
25
|
+
onChange?: (value: PermissionValue) => void;
|
|
26
|
+
/** Roles que se muestran pero no se pueden cambiar. */
|
|
27
|
+
lockedRoles?: string[];
|
|
28
|
+
/** scopes: el rol o token que se edita (por defecto, el primero de `roles`). */
|
|
29
|
+
role?: string;
|
|
30
|
+
/** Solo lectura aunque haya `onChange`. */
|
|
31
|
+
readOnly?: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare function PermissionMatrix({ preset, roles, groups, value, onChange, lockedRoles, role, readOnly, className, ...props }: PermissionMatrixProps): React.JSX.Element | null;
|
|
34
|
+
|
|
35
|
+
export { type Permission, type PermissionGroup, PermissionMatrix, type PermissionMatrixPreset, type PermissionMatrixProps, type PermissionRole, type PermissionValue };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, LockIcon, MinusIcon } from "lucide-react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { Checkbox } from "./checkbox.js";
|
|
8
|
+
import { Switch } from "./switch.js";
|
|
9
|
+
function toggle(value, role, permission, on) {
|
|
10
|
+
const set = new Set(value[role] ?? []);
|
|
11
|
+
if (on) set.add(permission);
|
|
12
|
+
else set.delete(permission);
|
|
13
|
+
return { ...value, [role]: [...set] };
|
|
14
|
+
}
|
|
15
|
+
function PermissionMatrix({ preset = "roles", roles, groups, value, onChange, lockedRoles = [], role, readOnly, className, ...props }) {
|
|
16
|
+
const t = useDsMessages();
|
|
17
|
+
const editable = !(readOnly ?? preset === "review") && onChange != null;
|
|
18
|
+
const has = (r, p) => (value[r] ?? []).includes(p);
|
|
19
|
+
if (preset === "scopes") {
|
|
20
|
+
const r = roles.find((x) => x.value === role) ?? roles[0];
|
|
21
|
+
if (!r) return null;
|
|
22
|
+
const locked = lockedRoles.includes(r.value);
|
|
23
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "permission-matrix", "data-preset": preset, className: cn("flex min-w-0 flex-col gap-5", className), ...props, children: groups.map((g) => /* @__PURE__ */ jsxs("fieldset", { "data-slot": "permission-matrix-group", className: "flex min-w-0 flex-col gap-1", children: [
|
|
24
|
+
/* @__PURE__ */ jsx("legend", { className: "mb-1 text-xs font-(--ds-medium-weight) text-muted-foreground", children: g.label }),
|
|
25
|
+
g.permissions.map((p) => {
|
|
26
|
+
const id = `pm-${r.value}-${p.id}`;
|
|
27
|
+
const on = has(r.value, p.id);
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "permission-matrix-cell", "data-allowed": on || void 0, className: "flex min-w-0 items-start gap-3 rounded-item py-2", children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-(--ds-medium-weight) text-foreground", children: p.label }),
|
|
31
|
+
p.description != null ? /* @__PURE__ */ jsx("span", { className: "text-sm text-pretty text-muted-foreground", children: p.description }) : null
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Switch,
|
|
35
|
+
{
|
|
36
|
+
id,
|
|
37
|
+
checked: on,
|
|
38
|
+
disabled: !editable || locked,
|
|
39
|
+
onCheckedChange: (c) => onChange?.(toggle(value, r.value, p.id, c))
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }, p.id);
|
|
43
|
+
})
|
|
44
|
+
] }, g.id)) });
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "permission-matrix", "data-preset": preset, className: cn("min-w-0 overflow-x-auto rounded-card border border-border", className), ...props, children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm", children: [
|
|
47
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border", children: [
|
|
48
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "sticky start-0 min-w-(--ds-permission-label-min) bg-card px-3 py-2 text-start text-xs font-(--ds-medium-weight) text-muted-foreground", children: t.permissionHeader }),
|
|
49
|
+
roles.map((r) => /* @__PURE__ */ jsx("th", { scope: "col", className: "min-w-(--ds-permission-col-min) px-3 py-2 text-center text-xs font-(--ds-medium-weight) text-foreground", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
|
|
50
|
+
r.label,
|
|
51
|
+
lockedRoles.includes(r.value) ? /* @__PURE__ */ jsxs("span", { title: t.permissionLocked, className: "inline-flex text-muted-foreground", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(LockIcon, { "aria-hidden": "true", className: "size-3" }),
|
|
53
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.permissionLocked })
|
|
54
|
+
] }) : null
|
|
55
|
+
] }) }, r.value))
|
|
56
|
+
] }) }),
|
|
57
|
+
groups.map((g) => /* @__PURE__ */ jsxs("tbody", { "data-slot": "permission-matrix-group", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("tr", { className: "bg-(--ds-row-hover)", children: /* @__PURE__ */ jsx("th", { scope: "colgroup", colSpan: roles.length + 1, className: "sticky start-0 px-3 py-1.5 text-start text-xs font-(--ds-medium-weight) text-muted-foreground", children: g.label }) }),
|
|
59
|
+
g.permissions.map((p) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-border hover:bg-(--ds-row-hover)", children: [
|
|
60
|
+
/* @__PURE__ */ jsxs("th", { scope: "row", className: "sticky start-0 bg-card px-3 py-2 text-start align-top font-(--ds-normal-weight)", children: [
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: "block text-foreground", children: p.label }),
|
|
62
|
+
p.description != null ? /* @__PURE__ */ jsx("span", { className: "block text-xs text-pretty text-muted-foreground", children: p.description }) : null
|
|
63
|
+
] }),
|
|
64
|
+
roles.map((r) => {
|
|
65
|
+
const on = has(r.value, p.id);
|
|
66
|
+
const locked = lockedRoles.includes(r.value);
|
|
67
|
+
return /* @__PURE__ */ jsx("td", { "data-slot": "permission-matrix-cell", "data-allowed": on || void 0, className: "px-3 py-2 text-center align-middle", children: editable ? /* @__PURE__ */ jsx(
|
|
68
|
+
Checkbox,
|
|
69
|
+
{
|
|
70
|
+
checked: on,
|
|
71
|
+
disabled: locked,
|
|
72
|
+
"aria-label": dsFormat(t.permissionToggle, { permission: p.label, role: r.label }),
|
|
73
|
+
onCheckedChange: (c) => onChange?.(toggle(value, r.value, p.id, c === true))
|
|
74
|
+
}
|
|
75
|
+
) : on ? /* @__PURE__ */ jsxs("span", { className: "inline-flex text-success", children: [
|
|
76
|
+
/* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
77
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.permissionAllowed })
|
|
78
|
+
] }) : /* @__PURE__ */ jsxs("span", { className: "inline-flex text-muted-foreground", children: [
|
|
79
|
+
/* @__PURE__ */ jsx(MinusIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
80
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.permissionDenied })
|
|
81
|
+
] }) }, r.value);
|
|
82
|
+
})
|
|
83
|
+
] }, p.id))
|
|
84
|
+
] }, g.id))
|
|
85
|
+
] }) });
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
PermissionMatrix
|
|
89
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @group data
|
|
5
|
+
* @summary Resumen de la suscripción: plan, estado, precio, renovación o fin de la prueba y el uso frente a lo contratado; presets overview · compact · trial.
|
|
6
|
+
* @see usage-meter — un solo medidor de uso frente a su límite
|
|
7
|
+
* @see pricing-table — elegir entre planes (portada o cambio de plan), no ver el contratado
|
|
8
|
+
* @see next-step-card — un estado con su única acción, sin datos de facturación
|
|
9
|
+
* @example Página de facturación (preset overview)
|
|
10
|
+
* <PlanSummary
|
|
11
|
+
* preset="overview"
|
|
12
|
+
* plan="Pro"
|
|
13
|
+
* status="active"
|
|
14
|
+
* price="49 € / mes"
|
|
15
|
+
* renewsAt="2026-12-21"
|
|
16
|
+
* usage={[
|
|
17
|
+
* { id: "seats", label: "Puestos", value: 8, limit: 10, unit: "{seat}" },
|
|
18
|
+
* { id: "storage", label: "Almacenamiento", value: 42, limit: 50, unit: "GBy" },
|
|
19
|
+
* ]}
|
|
20
|
+
* actions={<Button variant="outline">Gestionar el plan</Button>}
|
|
21
|
+
* />
|
|
22
|
+
* @example Prueba que termina pronto (preset trial)
|
|
23
|
+
* <PlanSummary preset="trial" plan="Pro" status="trialing" trialEndsAt="2026-11-28" actions={<Button>Elegir un plan</Button>} />
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
type PlanSummaryPreset = "overview" | "compact" | "trial";
|
|
27
|
+
type PlanStatus = "active" | "trialing" | "past_due" | "canceled";
|
|
28
|
+
type PlanUsage = {
|
|
29
|
+
id: string;
|
|
30
|
+
label: React.ReactNode;
|
|
31
|
+
value: number | null;
|
|
32
|
+
limit?: number | null;
|
|
33
|
+
unit?: string;
|
|
34
|
+
};
|
|
35
|
+
type PlanSummaryProps = Omit<React.ComponentProps<"section">, "children"> & {
|
|
36
|
+
preset?: PlanSummaryPreset;
|
|
37
|
+
/** Nombre del plan («Pro»). */
|
|
38
|
+
plan: React.ReactNode;
|
|
39
|
+
status?: PlanStatus;
|
|
40
|
+
/** Precio ya formateado por la app («49 € / mes»). */
|
|
41
|
+
price?: React.ReactNode;
|
|
42
|
+
/** Próxima renovación (activo). */
|
|
43
|
+
renewsAt?: string | number | Date | null;
|
|
44
|
+
/** Fin del servicio (cancelado). */
|
|
45
|
+
endsAt?: string | number | Date | null;
|
|
46
|
+
/** Fin de la prueba. */
|
|
47
|
+
trialEndsAt?: string | number | Date | null;
|
|
48
|
+
usage?: PlanUsage[];
|
|
49
|
+
showUsage?: boolean;
|
|
50
|
+
/** Fechas como «dentro de 5 días» en vez de la fecha. */
|
|
51
|
+
relative?: boolean;
|
|
52
|
+
/** Texto de apoyo (qué incluye, por qué hay pago pendiente). */
|
|
53
|
+
description?: React.ReactNode;
|
|
54
|
+
/** Botones (gestionar, cambiar de plan). */
|
|
55
|
+
actions?: React.ReactNode;
|
|
56
|
+
};
|
|
57
|
+
declare function PlanSummary({ preset, plan, status, price, renewsAt, endsAt, trialEndsAt, usage, showUsage, relative, description, actions, className, ...props }: PlanSummaryProps): React.JSX.Element;
|
|
58
|
+
|
|
59
|
+
export { type PlanStatus, PlanSummary, type PlanSummaryPreset, type PlanSummaryProps, type PlanUsage };
|