@vllnt/ui 0.4.0-canary.sha36bfa21 → 0.4.0-canary.sha49f831b
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/CHANGELOG.md +170 -6
- package/README.md +61 -3
- package/dist/components/atoms/accordion/accordion.js +28 -7
- package/dist/components/atoms/agent-activity/agent-activity.js +1 -1
- package/dist/components/atoms/ai-source-citation/ai-source-citation.js +1 -1
- package/dist/components/atoms/alert/alert.js +1 -1
- package/dist/components/atoms/alert-pulse/alert-pulse.js +7 -4
- package/dist/components/atoms/avatar/avatar.js +129 -24
- package/dist/components/atoms/badge/badge.js +84 -5
- package/dist/components/atoms/bottom-activity-strip/bottom-activity-strip.js +3 -2
- package/dist/components/atoms/breadcrumb/breadcrumb.js +89 -37
- package/dist/components/atoms/checklist/checklist.js +2 -2
- package/dist/components/atoms/curriculum/curriculum.js +4 -4
- package/dist/components/atoms/dialog/dialog.js +4 -2
- package/dist/components/atoms/drawer/drawer.js +1 -1
- package/dist/components/atoms/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/components/atoms/floating-toolbar/floating-toolbar.js +23 -2
- package/dist/components/atoms/gauge-chart/gauge-chart.js +1 -1
- package/dist/components/atoms/glass-progress/glass-progress.js +1 -1
- package/dist/components/atoms/heat-overlay/heat-overlay.js +3 -2
- package/dist/components/atoms/jarvis-dock/jarvis-dock.js +2 -2
- package/dist/components/atoms/kbd/kbd.js +41 -11
- package/dist/components/atoms/keyboard-shortcuts-help/keyboard-shortcuts-help.js +1 -1
- package/dist/components/atoms/menubar/menubar.js +1 -1
- package/dist/components/atoms/meter/meter.js +2 -2
- package/dist/components/atoms/metric-cluster/metric-cluster.js +2 -1
- package/dist/components/atoms/policy-delivery-panel/policy-delivery-panel.js +19 -10
- package/dist/components/atoms/presence-stack/presence-stack.js +1 -1
- package/dist/components/atoms/progress-bar/progress-bar.js +190 -30
- package/dist/components/atoms/pull-quote/pull-quote.js +77 -0
- package/dist/components/atoms/quiz/quiz.js +2 -2
- package/dist/components/atoms/relationship-inspector/relationship-inspector.js +1 -1
- package/dist/components/atoms/routing-assignment-panel/routing-assignment-panel.js +20 -11
- package/dist/components/atoms/runtime-overview-panel/runtime-overview-panel.js +2 -1
- package/dist/components/atoms/scrim/scrim.js +32 -0
- package/dist/components/atoms/segmented-control/segmented-control.js +2 -2
- package/dist/components/atoms/select/select.js +3 -3
- package/dist/components/atoms/sheet/sheet.js +3 -2
- package/dist/components/atoms/skeleton/skeleton.js +1 -1
- package/dist/components/atoms/state-badge-overlay/state-badge-overlay.js +14 -16
- package/dist/components/atoms/stepper/stepper.js +1 -1
- package/dist/components/atoms/sticky-metric/sticky-metric.js +2 -1
- package/dist/components/atoms/table/table.js +1 -1
- package/dist/components/atoms/table-of-contents/table-of-contents.js +1 -1
- package/dist/components/atoms/table-of-contents-panel/table-of-contents-panel.js +4 -4
- package/dist/components/atoms/tabs/tabs.js +34 -11
- package/dist/components/atoms/tag-group/tag-group.js +10 -5
- package/dist/components/atoms/tags-input/tags-input.js +1 -1
- package/dist/components/atoms/thread-bubble/thread-bubble.js +1 -1
- package/dist/components/atoms/threshold-ring/threshold-ring.js +3 -2
- package/dist/components/atoms/timeline/timeline.js +15 -3
- package/dist/components/atoms/timeline-scrubber/timeline-scrubber.js +3 -2
- package/dist/components/atoms/tldr-section/tldr-section.js +5 -5
- package/dist/components/atoms/toggle/toggle.js +1 -1
- package/dist/components/atoms/view-switcher/view-switcher.js +1 -1
- package/dist/components/atoms/viewport-bookmarks/viewport-bookmarks.js +1 -1
- package/dist/components/atoms/watchlist/watchlist.js +1 -1
- package/dist/components/atoms/workspace-switcher/workspace-switcher.js +1 -1
- package/dist/components/index.js +38 -2
- package/dist/components/molecules/ai-artifact/ai-artifact.js +2 -12
- package/dist/components/molecules/approval-request/approval-request.js +168 -0
- package/dist/components/molecules/civilization-card/civilization-card.js +1 -1
- package/dist/components/molecules/completion-dialog/completion-dialog.js +1 -1
- package/dist/components/molecules/content-intro/content-intro.js +2 -2
- package/dist/components/molecules/conversation-thread/conversation-thread.js +5 -5
- package/dist/components/molecules/cookie-consent/cookie-consent.js +188 -80
- package/dist/components/molecules/copy-button/use-copy-to-clipboard.js +10 -12
- package/dist/components/molecules/countdown-timer/countdown-timer.js +1 -1
- package/dist/components/molecules/credit-badge/credit-badge.js +13 -16
- package/dist/components/molecules/filter-bar/filter-bar.js +2 -2
- package/dist/components/molecules/historical-figure-card/historical-figure-card.js +1 -1
- package/dist/components/molecules/plan-badge/plan-badge.js +12 -13
- package/dist/components/molecules/pricing-table/pricing-table.js +1 -1
- package/dist/components/molecules/progress-tracker/progress-tracker.js +8 -17
- package/dist/components/molecules/sidebar/sidebar.js +24 -9
- package/dist/components/molecules/tour/tour.js +1 -1
- package/dist/components/molecules/transaction-list/transaction-list.js +7 -9
- package/dist/components/molecules/tutorial-filters/tutorial-filters.js +2 -2
- package/dist/components/molecules/usage-breakdown/usage-breakdown.js +1 -1
- package/dist/components/organisms/access-matrix/access-matrix.js +271 -0
- package/dist/components/organisms/activity-heatmap/activity-heatmap.js +1 -1
- package/dist/components/organisms/code-block/code-block.js +145 -81
- package/dist/components/organisms/cta-band/cta-band.js +79 -0
- package/dist/components/organisms/flow-diagram/flow-controls.js +1 -1
- package/dist/components/organisms/flow-diagram/flow-fullscreen.js +1 -1
- package/dist/components/organisms/gantt-chart/gantt-chart.js +1 -1
- package/dist/components/organisms/historic-timeline/historic-timeline.js +1 -1
- package/dist/components/organisms/navbar-saas/navbar-saas.js +1 -1
- package/dist/components/organisms/order-summary/order-summary.js +172 -0
- package/dist/components/organisms/settings-list/settings-list.js +125 -0
- package/dist/components/organisms/share-dialog-people/share-dialog-people.js +412 -0
- package/dist/components/organisms/slideshow/slideshow.js +6 -6
- package/dist/components/organisms/subscription-card/subscription-card.js +10 -10
- package/dist/components/organisms/tutorial-complete/tutorial-complete.js +2 -2
- package/dist/components/organisms/tutorial-mdx/tutorial-mdx.js +1 -1
- package/dist/index.d.ts +1143 -82
- package/dist/index.js +10 -0
- package/dist/lib/copy-text.js +64 -0
- package/dist/lib/status-dot.js +33 -0
- package/dist/tailwind-preset.js +16 -0
- package/package.json +17 -4
- package/styles.css +48 -7
- package/themes/default.css +48 -7
- package/themes/presets.css +24 -24
- package/themes/products.css +146 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Badge } from "../../atoms/badge/badge.js";
|
|
4
4
|
function getStatusLabel(status) {
|
|
5
5
|
switch (status) {
|
|
6
6
|
case "depleted":
|
|
@@ -13,16 +13,16 @@ function getStatusLabel(status) {
|
|
|
13
13
|
return "Balance overdue";
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function getStatusTone(status) {
|
|
17
17
|
switch (status) {
|
|
18
18
|
case "depleted":
|
|
19
|
-
return "
|
|
19
|
+
return "neutral";
|
|
20
20
|
case "healthy":
|
|
21
|
-
return "
|
|
21
|
+
return "success";
|
|
22
22
|
case "low":
|
|
23
|
-
return "
|
|
23
|
+
return "warning";
|
|
24
24
|
case "overdue":
|
|
25
|
-
return "
|
|
25
|
+
return "danger";
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
const CreditBadge = ({
|
|
@@ -33,21 +33,18 @@ const CreditBadge = ({
|
|
|
33
33
|
status,
|
|
34
34
|
...props
|
|
35
35
|
}) => {
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Badge,
|
|
38
38
|
{
|
|
39
39
|
className: cn(
|
|
40
|
-
|
|
41
|
-
"gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-medium shadow-none",
|
|
42
|
-
getStatusClasses(status),
|
|
40
|
+
"py-1 text-[11px] font-medium shadow-none hover:bg-secondary",
|
|
43
41
|
className
|
|
44
42
|
),
|
|
43
|
+
dot: true,
|
|
45
44
|
ref: reference,
|
|
45
|
+
tone: getStatusTone(status),
|
|
46
46
|
...props,
|
|
47
|
-
children:
|
|
48
|
-
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "size-1.5 rounded-full bg-current" }),
|
|
49
|
-
/* @__PURE__ */ jsx("span", { children: amount ? `${amount} \u2022 ${label ?? getStatusLabel(status)}` : label ?? getStatusLabel(status) })
|
|
50
|
-
]
|
|
47
|
+
children: /* @__PURE__ */ jsx("span", { children: amount ? `${amount} \u2022 ${label ?? getStatusLabel(status)}` : label ?? getStatusLabel(status) })
|
|
51
48
|
}
|
|
52
49
|
);
|
|
53
50
|
};
|
|
@@ -48,7 +48,7 @@ function DifficultyFilter({
|
|
|
48
48
|
{
|
|
49
49
|
className: cn(
|
|
50
50
|
"px-3 py-1 text-sm rounded-lg border transition-colors",
|
|
51
|
-
isActive ? "bg-primary text-primary-foreground border-transparent" : "bg-background text-foreground border-border hover:bg-
|
|
51
|
+
isActive ? "bg-primary text-primary-foreground border-transparent" : "bg-background text-foreground border-border hover:bg-secondary"
|
|
52
52
|
),
|
|
53
53
|
disabled,
|
|
54
54
|
onClick: () => {
|
|
@@ -91,7 +91,7 @@ function TagFilter({
|
|
|
91
91
|
{
|
|
92
92
|
className: cn(
|
|
93
93
|
"cursor-pointer transition-all",
|
|
94
|
-
isActive ? "bg-primary text-primary-foreground border-transparent" : "hover:bg-
|
|
94
|
+
isActive ? "bg-primary text-primary-foreground border-transparent" : "hover:bg-secondary"
|
|
95
95
|
),
|
|
96
96
|
onClick: () => {
|
|
97
97
|
onTagToggle(tag);
|
|
@@ -44,7 +44,7 @@ function LifespanBar({
|
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
46
|
"aria-label": `${label}: ${formatYear(birthYear) ?? ""} \u2013 ${formatYear(deathYear) ?? ""}`,
|
|
47
|
-
className: "relative mt-2 h-1.5 w-full rounded-full bg-
|
|
47
|
+
className: "relative mt-2 h-1.5 w-full rounded-full bg-secondary",
|
|
48
48
|
role: "img",
|
|
49
49
|
children: /* @__PURE__ */ jsx(
|
|
50
50
|
"span",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Badge } from "../../atoms/badge/badge.js";
|
|
4
4
|
function getPlanLabel(tier) {
|
|
5
5
|
switch (tier) {
|
|
6
6
|
case "enterprise":
|
|
@@ -13,22 +13,22 @@ function getPlanLabel(tier) {
|
|
|
13
13
|
return "Starter";
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function getPlanTone(tier, state) {
|
|
17
17
|
if (state === "legacy") {
|
|
18
|
-
return "
|
|
18
|
+
return "warning";
|
|
19
19
|
}
|
|
20
20
|
if (state === "trial") {
|
|
21
|
-
return "
|
|
21
|
+
return "info";
|
|
22
22
|
}
|
|
23
23
|
switch (tier) {
|
|
24
24
|
case "enterprise":
|
|
25
|
-
return "
|
|
25
|
+
return "primary";
|
|
26
26
|
case "free":
|
|
27
|
-
return "
|
|
27
|
+
return "neutral";
|
|
28
28
|
case "growth":
|
|
29
|
-
return "
|
|
29
|
+
return "info";
|
|
30
30
|
case "starter":
|
|
31
|
-
return "
|
|
31
|
+
return "success";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
const PlanBadge = ({
|
|
@@ -40,18 +40,17 @@ const PlanBadge = ({
|
|
|
40
40
|
...props
|
|
41
41
|
}) => {
|
|
42
42
|
return /* @__PURE__ */ jsxs(
|
|
43
|
-
|
|
43
|
+
Badge,
|
|
44
44
|
{
|
|
45
45
|
className: cn(
|
|
46
|
-
|
|
47
|
-
"gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-medium tracking-[0.02em] shadow-none",
|
|
48
|
-
getPlanClasses(tier, state),
|
|
46
|
+
"py-1 text-[11px] font-medium tracking-[0.02em] shadow-none hover:bg-secondary",
|
|
49
47
|
className
|
|
50
48
|
),
|
|
49
|
+
dot: true,
|
|
51
50
|
ref: reference,
|
|
51
|
+
tone: getPlanTone(tier, state),
|
|
52
52
|
...props,
|
|
53
53
|
children: [
|
|
54
|
-
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "size-1.5 rounded-full bg-current" }),
|
|
55
54
|
/* @__PURE__ */ jsx("span", { children: label ?? getPlanLabel(tier) }),
|
|
56
55
|
state === "trial" ? /* @__PURE__ */ jsx("span", { className: "text-current/80", children: "Trial" }) : null,
|
|
57
56
|
state === "legacy" ? /* @__PURE__ */ jsx("span", { className: "text-current/80", children: "Legacy" }) : null
|
|
@@ -213,7 +213,7 @@ function PeriodToggle({
|
|
|
213
213
|
"div",
|
|
214
214
|
{
|
|
215
215
|
"aria-label": "Billing period",
|
|
216
|
-
className: "mx-auto inline-flex items-center gap-2 rounded-full border bg-
|
|
216
|
+
className: "mx-auto inline-flex items-center gap-2 rounded-full border bg-secondary/40 p-1 text-sm",
|
|
217
217
|
role: "radiogroup",
|
|
218
218
|
children: [
|
|
219
219
|
/* @__PURE__ */ jsx(
|
|
@@ -244,7 +244,7 @@ function OverviewRing({
|
|
|
244
244
|
/* @__PURE__ */ jsx(
|
|
245
245
|
"circle",
|
|
246
246
|
{
|
|
247
|
-
className: "stroke-
|
|
247
|
+
className: "stroke-secondary",
|
|
248
248
|
cx: "60",
|
|
249
249
|
cy: "60",
|
|
250
250
|
fill: "none",
|
|
@@ -461,24 +461,15 @@ function ModuleProgress({
|
|
|
461
461
|
} = values;
|
|
462
462
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
463
463
|
/* @__PURE__ */ jsx(
|
|
464
|
-
|
|
464
|
+
ProgressBar,
|
|
465
465
|
{
|
|
466
466
|
"aria-label": `${title} progress`,
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
{
|
|
474
|
-
completedLabel: "lessons",
|
|
475
|
-
currentLabel: `${progressPercent}% complete`,
|
|
476
|
-
isComplete,
|
|
477
|
-
max: resolvedLessonTotal,
|
|
478
|
-
showLabels: true,
|
|
479
|
-
value: progressValue
|
|
480
|
-
}
|
|
481
|
-
)
|
|
467
|
+
currentLabel: `${progressPercent}% complete`,
|
|
468
|
+
isComplete,
|
|
469
|
+
max: 100,
|
|
470
|
+
showLabels: true,
|
|
471
|
+
value: progressPercent,
|
|
472
|
+
valueLabel: `${progressValue} / ${resolvedLessonTotal} lessons`
|
|
482
473
|
}
|
|
483
474
|
),
|
|
484
475
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-2 text-sm text-muted-foreground sm:grid-cols-2", children: [
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
useSyncExternalStore
|
|
10
|
+
} from "react";
|
|
4
11
|
import { ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
12
|
import Link from "next/link";
|
|
6
13
|
import { usePathname } from "next/navigation";
|
|
7
14
|
import { useMounted } from "../../../lib/use-mounted.js";
|
|
8
15
|
import { cn } from "../../../lib/utils.js";
|
|
9
16
|
import { useSidebar } from "../../atoms/sidebar-provider/sidebar-provider.js";
|
|
17
|
+
const PrefetchContext = createContext(void 0);
|
|
18
|
+
function SidebarLink(properties) {
|
|
19
|
+
const prefetch = useContext(PrefetchContext);
|
|
20
|
+
return /* @__PURE__ */ jsx(Link, { prefetch, ...properties });
|
|
21
|
+
}
|
|
10
22
|
const getMobileSnapshot = () => typeof window === "undefined" ? false : window.innerWidth < 1024;
|
|
11
23
|
const getServerMobileSnapshot = () => false;
|
|
12
24
|
const subscribeToViewportResize = (onStoreChange) => {
|
|
@@ -114,7 +126,7 @@ function FamilyList({
|
|
|
114
126
|
/* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Components" }),
|
|
115
127
|
/* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: sections.map(
|
|
116
128
|
(section, index) => section.href ? /* @__PURE__ */ jsx(
|
|
117
|
-
|
|
129
|
+
SidebarLink,
|
|
118
130
|
{
|
|
119
131
|
className: FAMILY_ROW_CLASS,
|
|
120
132
|
href: section.href,
|
|
@@ -175,9 +187,9 @@ function FamilyItems({
|
|
|
175
187
|
),
|
|
176
188
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 pb-1", children: [
|
|
177
189
|
section.href ? /* @__PURE__ */ jsx(
|
|
178
|
-
|
|
190
|
+
SidebarLink,
|
|
179
191
|
{
|
|
180
|
-
className: "text-sm font-semibold hover:underline",
|
|
192
|
+
className: "inline-flex min-h-6 min-w-6 items-center text-sm font-semibold hover:underline",
|
|
181
193
|
href: section.href,
|
|
182
194
|
onClick: () => {
|
|
183
195
|
if (isMobile) {
|
|
@@ -190,7 +202,7 @@ function FamilyItems({
|
|
|
190
202
|
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: section.items.length })
|
|
191
203
|
] }),
|
|
192
204
|
/* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: section.items.map((item) => /* @__PURE__ */ jsx(
|
|
193
|
-
|
|
205
|
+
SidebarLink,
|
|
194
206
|
{
|
|
195
207
|
"aria-current": getAriaCurrent(item, pathname),
|
|
196
208
|
className: cn(
|
|
@@ -327,7 +339,7 @@ function SectionLinks({
|
|
|
327
339
|
section
|
|
328
340
|
}) {
|
|
329
341
|
return /* @__PURE__ */ jsx("div", { className: section.title ? "space-y-0.5" : "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsx(
|
|
330
|
-
|
|
342
|
+
SidebarLink,
|
|
331
343
|
{
|
|
332
344
|
"aria-current": getAriaCurrent(item, pathname),
|
|
333
345
|
className: cn(
|
|
@@ -450,9 +462,12 @@ function Sidebar({
|
|
|
450
462
|
ariaLabel = "Sidebar navigation",
|
|
451
463
|
closeLabel = "Close sidebar",
|
|
452
464
|
id = "site-sidebar",
|
|
465
|
+
pathname: pathnameOverride,
|
|
466
|
+
prefetch,
|
|
453
467
|
sections
|
|
454
468
|
}) {
|
|
455
|
-
const
|
|
469
|
+
const routerPathname = usePathname();
|
|
470
|
+
const pathname = pathnameOverride ?? routerPathname;
|
|
456
471
|
const { open, setOpen } = useSidebar();
|
|
457
472
|
const isMobile = useMobile(setOpen);
|
|
458
473
|
const mounted = useMounted();
|
|
@@ -499,7 +514,7 @@ function Sidebar({
|
|
|
499
514
|
className: "flex-1 h-full overflow-y-auto overscroll-contain p-4 focus:outline-none [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
500
515
|
ref: scrollContainerReference,
|
|
501
516
|
tabIndex: isMobile && open ? -1 : void 0,
|
|
502
|
-
children: /* @__PURE__ */ jsx(
|
|
517
|
+
children: /* @__PURE__ */ jsx(PrefetchContext.Provider, { value: prefetch, children: /* @__PURE__ */ jsx(
|
|
503
518
|
SidebarSections,
|
|
504
519
|
{
|
|
505
520
|
isMobile,
|
|
@@ -507,7 +522,7 @@ function Sidebar({
|
|
|
507
522
|
pathname,
|
|
508
523
|
sections
|
|
509
524
|
}
|
|
510
|
-
)
|
|
525
|
+
) })
|
|
511
526
|
}
|
|
512
527
|
)
|
|
513
528
|
] })
|
|
@@ -32,7 +32,7 @@ function TourHeader({
|
|
|
32
32
|
totalSteps
|
|
33
33
|
] })
|
|
34
34
|
] }),
|
|
35
|
-
/* @__PURE__ */ jsx("div", { className: "h-1 rounded-full bg-
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "h-1 rounded-full bg-secondary", children: /* @__PURE__ */ jsx(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
38
38
|
className: "h-full rounded-full bg-primary transition-all",
|
|
@@ -48,11 +48,11 @@ const AMOUNT_CLASS = {
|
|
|
48
48
|
negative: "text-destructive",
|
|
49
49
|
positive: "text-emerald-700 dark:text-emerald-400"
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
active: "
|
|
53
|
-
canceled: "
|
|
54
|
-
past_due: "
|
|
55
|
-
trialing: "
|
|
51
|
+
const STATUS_TONE = {
|
|
52
|
+
active: "success",
|
|
53
|
+
canceled: "neutral",
|
|
54
|
+
past_due: "danger",
|
|
55
|
+
trialing: "info"
|
|
56
56
|
};
|
|
57
57
|
const STATUS_LABEL_KEY = {
|
|
58
58
|
active: "active",
|
|
@@ -209,13 +209,11 @@ const TransactionListSubscriptionRow = ({
|
|
|
209
209
|
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
210
210
|
const formatted = formatTransactionAmount(amountCents, { currency, locale });
|
|
211
211
|
const intervalSuffix = INTERVAL_LABEL[interval];
|
|
212
|
-
const isActive = status === "active";
|
|
213
212
|
return /* @__PURE__ */ jsxs(
|
|
214
213
|
"div",
|
|
215
214
|
{
|
|
216
215
|
className: cn(
|
|
217
|
-
"flex items-start justify-between gap-3 rounded-lg border px-3 py-2",
|
|
218
|
-
isActive ? "border-emerald-500/40 bg-emerald-500/5" : "border-border bg-muted/20",
|
|
216
|
+
"flex items-start justify-between gap-3 rounded-lg border border-border bg-muted/20 px-3 py-2",
|
|
219
217
|
className
|
|
220
218
|
),
|
|
221
219
|
"data-status": status,
|
|
@@ -225,7 +223,7 @@ const TransactionListSubscriptionRow = ({
|
|
|
225
223
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
226
224
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
227
225
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: plan }),
|
|
228
|
-
/* @__PURE__ */ jsx(Badge, {
|
|
226
|
+
/* @__PURE__ */ jsx(Badge, { dot: true, tone: STATUS_TONE[status], children: resolvedLabels[STATUS_LABEL_KEY[status]] })
|
|
229
227
|
] }),
|
|
230
228
|
/* @__PURE__ */ jsx(
|
|
231
229
|
SubscriptionMeta,
|
|
@@ -38,7 +38,7 @@ function DifficultyFilter({
|
|
|
38
38
|
return /* @__PURE__ */ jsx(
|
|
39
39
|
"button",
|
|
40
40
|
{
|
|
41
|
-
className: `px-3 py-1 text-sm rounded-lg border transition-colors ${isActive ? "bg-primary text-primary-foreground border-transparent" : "bg-background text-foreground border-border hover:bg-
|
|
41
|
+
className: `px-3 py-1 text-sm rounded-lg border transition-colors ${isActive ? "bg-primary text-primary-foreground border-transparent" : "bg-background text-foreground border-border hover:bg-secondary"}`,
|
|
42
42
|
disabled: isPending,
|
|
43
43
|
onClick: () => {
|
|
44
44
|
onDifficultyChange(difficulty);
|
|
@@ -79,7 +79,7 @@ function TagFilter({
|
|
|
79
79
|
return /* @__PURE__ */ jsx(
|
|
80
80
|
Badge,
|
|
81
81
|
{
|
|
82
|
-
className: `cursor-pointer transition-all ${isActive ? "bg-primary text-primary-foreground border-transparent" : "hover:bg-
|
|
82
|
+
className: `cursor-pointer transition-all ${isActive ? "bg-primary text-primary-foreground border-transparent" : "hover:bg-secondary"}`,
|
|
83
83
|
onClick: () => {
|
|
84
84
|
onTagToggle(tag);
|
|
85
85
|
},
|
|
@@ -52,7 +52,7 @@ function UsageBreakdownMeter({
|
|
|
52
52
|
value
|
|
53
53
|
}) {
|
|
54
54
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
55
|
-
/* @__PURE__ */ jsx("div", { className: "h-2 overflow-hidden rounded-full bg-
|
|
55
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsx(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
58
|
"aria-hidden": "true",
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Check, CornerDownRight, X } from "lucide-react";
|
|
6
|
+
import { cn } from "../../../lib/utils.js";
|
|
7
|
+
import { Button } from "../../atoms/button/button.js";
|
|
8
|
+
import {
|
|
9
|
+
Table,
|
|
10
|
+
TableBody,
|
|
11
|
+
TableCell,
|
|
12
|
+
TableHead,
|
|
13
|
+
TableHeader,
|
|
14
|
+
TableRow
|
|
15
|
+
} from "../../atoms/table/table.js";
|
|
16
|
+
const DEFAULT_LABELS = {
|
|
17
|
+
denied: "Denied",
|
|
18
|
+
granted: "Granted",
|
|
19
|
+
inherited: "Inherited"
|
|
20
|
+
};
|
|
21
|
+
const STATE_ICONS = {
|
|
22
|
+
denied: X,
|
|
23
|
+
granted: Check,
|
|
24
|
+
inherited: CornerDownRight
|
|
25
|
+
};
|
|
26
|
+
const accessMatrixStateVariants = cva(
|
|
27
|
+
"inline-flex items-center justify-center gap-1.5 text-sm font-medium",
|
|
28
|
+
{
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
state: "denied"
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
state: {
|
|
34
|
+
denied: "text-muted-foreground",
|
|
35
|
+
granted: "text-success",
|
|
36
|
+
inherited: "text-info"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
function resolveLabels(labels) {
|
|
42
|
+
return {
|
|
43
|
+
denied: labels?.denied ?? DEFAULT_LABELS.denied,
|
|
44
|
+
granted: labels?.granted ?? DEFAULT_LABELS.granted,
|
|
45
|
+
inherited: labels?.inherited ?? DEFAULT_LABELS.inherited
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getState(value, subjectId, permissionId) {
|
|
49
|
+
return value[subjectId]?.[permissionId] ?? "denied";
|
|
50
|
+
}
|
|
51
|
+
function StateControl({
|
|
52
|
+
framed,
|
|
53
|
+
label,
|
|
54
|
+
onToggle,
|
|
55
|
+
permissionLabel,
|
|
56
|
+
showWord,
|
|
57
|
+
state,
|
|
58
|
+
subjectLabel
|
|
59
|
+
}) {
|
|
60
|
+
const Icon = STATE_ICONS[state];
|
|
61
|
+
const content = /* @__PURE__ */ jsxs(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
className: cn(
|
|
65
|
+
accessMatrixStateVariants({ state }),
|
|
66
|
+
!onToggle && framed && (showWord ? "h-9 px-3" : "size-10")
|
|
67
|
+
),
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", className: "size-4 shrink-0" }),
|
|
70
|
+
/* @__PURE__ */ jsx("span", { className: cn(!showWord && "sr-only"), children: label })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
if (!onToggle) {
|
|
75
|
+
return content;
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
Button,
|
|
79
|
+
{
|
|
80
|
+
"aria-label": `${subjectLabel}, ${permissionLabel}: ${label}`,
|
|
81
|
+
onClick: onToggle,
|
|
82
|
+
size: showWord ? "sm" : "icon",
|
|
83
|
+
type: "button",
|
|
84
|
+
variant: "ghost",
|
|
85
|
+
children: content
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function MatrixCell({
|
|
90
|
+
labels,
|
|
91
|
+
onChange,
|
|
92
|
+
permission,
|
|
93
|
+
showWord,
|
|
94
|
+
subject,
|
|
95
|
+
value
|
|
96
|
+
}) {
|
|
97
|
+
const state = getState(value, subject.id, permission.id);
|
|
98
|
+
const next = state === "granted" ? "denied" : "granted";
|
|
99
|
+
const isEditable = onChange !== void 0 && state !== "inherited";
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
StateControl,
|
|
102
|
+
{
|
|
103
|
+
framed: onChange !== void 0,
|
|
104
|
+
label: labels[state],
|
|
105
|
+
onToggle: isEditable ? () => {
|
|
106
|
+
onChange(subject.id, permission.id, next);
|
|
107
|
+
} : void 0,
|
|
108
|
+
permissionLabel: permission.label,
|
|
109
|
+
showWord,
|
|
110
|
+
state,
|
|
111
|
+
subjectLabel: subject.label
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function SubjectText({
|
|
116
|
+
subject
|
|
117
|
+
}) {
|
|
118
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
119
|
+
/* @__PURE__ */ jsx("span", { className: "block text-sm font-medium text-foreground", children: subject.label }),
|
|
120
|
+
subject.description ? /* @__PURE__ */ jsx("span", { className: "block text-xs font-normal text-muted-foreground", children: subject.description }) : null
|
|
121
|
+
] });
|
|
122
|
+
}
|
|
123
|
+
function AccessMatrixGrid({
|
|
124
|
+
labelledBy,
|
|
125
|
+
labels,
|
|
126
|
+
onChange,
|
|
127
|
+
permissions,
|
|
128
|
+
subjects,
|
|
129
|
+
value
|
|
130
|
+
}) {
|
|
131
|
+
return /* @__PURE__ */ jsxs(Table, { "aria-labelledby": labelledBy, children: [
|
|
132
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: "hover:bg-transparent", children: [
|
|
133
|
+
/* @__PURE__ */ jsx(TableCell, {}),
|
|
134
|
+
permissions.map((permission) => /* @__PURE__ */ jsx(TableHead, { className: "text-center", scope: "col", children: permission.label }, permission.id))
|
|
135
|
+
] }) }),
|
|
136
|
+
/* @__PURE__ */ jsx(TableBody, { children: subjects.map((subject) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
137
|
+
/* @__PURE__ */ jsx(TableHead, { className: "h-auto py-3 text-foreground", scope: "row", children: /* @__PURE__ */ jsx(SubjectText, { subject }) }),
|
|
138
|
+
permissions.map((permission) => /* @__PURE__ */ jsx(TableCell, { className: "text-center", children: /* @__PURE__ */ jsx(
|
|
139
|
+
MatrixCell,
|
|
140
|
+
{
|
|
141
|
+
labels,
|
|
142
|
+
onChange,
|
|
143
|
+
permission,
|
|
144
|
+
showWord: false,
|
|
145
|
+
subject,
|
|
146
|
+
value
|
|
147
|
+
}
|
|
148
|
+
) }, permission.id))
|
|
149
|
+
] }, subject.id)) })
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
function AccessMatrixList({
|
|
153
|
+
labelledBy,
|
|
154
|
+
labels,
|
|
155
|
+
onChange,
|
|
156
|
+
permissions,
|
|
157
|
+
subjects,
|
|
158
|
+
value
|
|
159
|
+
}) {
|
|
160
|
+
return /* @__PURE__ */ jsx("ul", { "aria-labelledby": labelledBy, className: "divide-y", children: subjects.map((subject) => /* @__PURE__ */ jsxs("li", { className: "space-y-3 px-4 py-3", children: [
|
|
161
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(SubjectText, { subject }) }),
|
|
162
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-1", children: permissions.map((permission) => /* @__PURE__ */ jsxs(
|
|
163
|
+
"li",
|
|
164
|
+
{
|
|
165
|
+
className: "flex items-center justify-between gap-3 text-sm",
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: permission.label }),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
MatrixCell,
|
|
170
|
+
{
|
|
171
|
+
labels,
|
|
172
|
+
onChange,
|
|
173
|
+
permission,
|
|
174
|
+
showWord: true,
|
|
175
|
+
subject,
|
|
176
|
+
value
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
permission.id
|
|
182
|
+
)) })
|
|
183
|
+
] }, subject.id)) });
|
|
184
|
+
}
|
|
185
|
+
function AccessMatrixHeader({
|
|
186
|
+
inheritedLabel,
|
|
187
|
+
showInherited,
|
|
188
|
+
title,
|
|
189
|
+
titleId
|
|
190
|
+
}) {
|
|
191
|
+
if (!title && !showInherited) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return /* @__PURE__ */ jsxs("header", { className: "flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3", children: [
|
|
195
|
+
title ? /* @__PURE__ */ jsx(
|
|
196
|
+
"h3",
|
|
197
|
+
{
|
|
198
|
+
className: "text-base font-semibold leading-none tracking-tight",
|
|
199
|
+
id: titleId,
|
|
200
|
+
children: title
|
|
201
|
+
}
|
|
202
|
+
) : null,
|
|
203
|
+
showInherited ? /* @__PURE__ */ jsxs(
|
|
204
|
+
"p",
|
|
205
|
+
{
|
|
206
|
+
"aria-hidden": "true",
|
|
207
|
+
className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsx(CornerDownRight, { className: "size-3.5 shrink-0" }),
|
|
210
|
+
inheritedLabel
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
) : null
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
const AccessMatrix = ({
|
|
217
|
+
className,
|
|
218
|
+
labels,
|
|
219
|
+
mode = "grid",
|
|
220
|
+
onChange,
|
|
221
|
+
permissions,
|
|
222
|
+
ref: reference,
|
|
223
|
+
subjects,
|
|
224
|
+
title,
|
|
225
|
+
value,
|
|
226
|
+
...props
|
|
227
|
+
}) => {
|
|
228
|
+
const titleId = React.useId();
|
|
229
|
+
const resolvedLabels = resolveLabels(labels);
|
|
230
|
+
const hasEntries = subjects.length > 0 && permissions.length > 0;
|
|
231
|
+
const hasInherited = subjects.some(
|
|
232
|
+
(subject) => permissions.some(
|
|
233
|
+
(permission) => getState(value, subject.id, permission.id) === "inherited"
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
const bodyProps = {
|
|
237
|
+
labelledBy: title ? titleId : void 0,
|
|
238
|
+
labels: resolvedLabels,
|
|
239
|
+
onChange,
|
|
240
|
+
permissions,
|
|
241
|
+
subjects,
|
|
242
|
+
value
|
|
243
|
+
};
|
|
244
|
+
return /* @__PURE__ */ jsxs(
|
|
245
|
+
"section",
|
|
246
|
+
{
|
|
247
|
+
className: cn(
|
|
248
|
+
"w-full rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
249
|
+
className
|
|
250
|
+
),
|
|
251
|
+
ref: reference,
|
|
252
|
+
...props,
|
|
253
|
+
children: [
|
|
254
|
+
/* @__PURE__ */ jsx(
|
|
255
|
+
AccessMatrixHeader,
|
|
256
|
+
{
|
|
257
|
+
inheritedLabel: resolvedLabels.inherited,
|
|
258
|
+
showInherited: hasInherited,
|
|
259
|
+
title,
|
|
260
|
+
titleId
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
hasEntries ? mode === "list" ? /* @__PURE__ */ jsx(AccessMatrixList, { ...bodyProps }) : /* @__PURE__ */ jsx(AccessMatrixGrid, { ...bodyProps }) : null
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
AccessMatrix.displayName = "AccessMatrix";
|
|
269
|
+
export {
|
|
270
|
+
AccessMatrix
|
|
271
|
+
};
|
|
@@ -4,7 +4,7 @@ import { cn } from "../../../lib/utils.js";
|
|
|
4
4
|
const WEEKDAY_LABELS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
5
5
|
const VISIBLE_DAY_LABELS = /* @__PURE__ */ new Set(["Mon", "Wed", "Fri"]);
|
|
6
6
|
const LEVEL_CLASS_NAMES = [
|
|
7
|
-
"bg-
|
|
7
|
+
"bg-secondary",
|
|
8
8
|
"bg-emerald-500/25",
|
|
9
9
|
"bg-emerald-500/45",
|
|
10
10
|
"bg-emerald-500/65",
|