@dapplelight/signet-ui 0.3.3 → 0.4.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/README.md +5 -0
- package/dist/blocks/analytics-dashboard/index.d.ts +42 -0
- package/dist/blocks/analytics-dashboard/index.d.ts.map +1 -0
- package/dist/blocks/analytics-dashboard/index.js +57 -0
- package/dist/blocks/analytics-dashboard/index.js.map +1 -0
- package/dist/blocks/analytics-dashboard/sample.d.ts +19 -0
- package/dist/blocks/analytics-dashboard/sample.d.ts.map +1 -0
- package/dist/blocks/analytics-dashboard/sample.js +37 -0
- package/dist/blocks/analytics-dashboard/sample.js.map +1 -0
- package/dist/blocks/auth-page/index.d.ts +61 -0
- package/dist/blocks/auth-page/index.d.ts.map +1 -0
- package/dist/blocks/auth-page/index.js +33 -0
- package/dist/blocks/auth-page/index.js.map +1 -0
- package/dist/blocks/checkout-summary/index.d.ts +42 -0
- package/dist/blocks/checkout-summary/index.d.ts.map +1 -0
- package/dist/blocks/checkout-summary/index.js +62 -0
- package/dist/blocks/checkout-summary/index.js.map +1 -0
- package/dist/blocks/checkout-summary/sample.d.ts +3 -0
- package/dist/blocks/checkout-summary/sample.d.ts.map +1 -0
- package/dist/blocks/checkout-summary/sample.js +6 -0
- package/dist/blocks/checkout-summary/sample.js.map +1 -0
- package/dist/blocks/empty-page/index.d.ts +24 -0
- package/dist/blocks/empty-page/index.d.ts.map +1 -0
- package/dist/blocks/empty-page/index.js +23 -0
- package/dist/blocks/empty-page/index.js.map +1 -0
- package/dist/blocks/error-page/index.d.ts +27 -0
- package/dist/blocks/error-page/index.d.ts.map +1 -0
- package/dist/blocks/error-page/index.js +26 -0
- package/dist/blocks/error-page/index.js.map +1 -0
- package/dist/blocks/list-detail/index.d.ts +43 -0
- package/dist/blocks/list-detail/index.d.ts.map +1 -0
- package/dist/blocks/list-detail/index.js +99 -0
- package/dist/blocks/list-detail/index.js.map +1 -0
- package/dist/blocks/list-detail/sample.d.ts +14 -0
- package/dist/blocks/list-detail/sample.d.ts.map +1 -0
- package/dist/blocks/list-detail/sample.js +43 -0
- package/dist/blocks/list-detail/sample.js.map +1 -0
- package/dist/blocks/onboarding/index.d.ts +37 -0
- package/dist/blocks/onboarding/index.d.ts.map +1 -0
- package/dist/blocks/onboarding/index.js +65 -0
- package/dist/blocks/onboarding/index.js.map +1 -0
- package/dist/blocks/onboarding/sample.d.ts +3 -0
- package/dist/blocks/onboarding/sample.d.ts.map +1 -0
- package/dist/blocks/onboarding/sample.js +23 -0
- package/dist/blocks/onboarding/sample.js.map +1 -0
- package/dist/blocks/pricing/index.d.ts +50 -0
- package/dist/blocks/pricing/index.d.ts.map +1 -0
- package/dist/blocks/pricing/index.js +63 -0
- package/dist/blocks/pricing/index.js.map +1 -0
- package/dist/blocks/pricing/sample.d.ts +3 -0
- package/dist/blocks/pricing/sample.d.ts.map +1 -0
- package/dist/blocks/pricing/sample.js +28 -0
- package/dist/blocks/pricing/sample.js.map +1 -0
- package/dist/blocks/settings/index.d.ts +56 -0
- package/dist/blocks/settings/index.d.ts.map +1 -0
- package/dist/blocks/settings/index.js +118 -0
- package/dist/blocks/settings/index.js.map +1 -0
- package/dist/components/screens/cost-dashboard.d.ts +69 -0
- package/dist/components/screens/cost-dashboard.d.ts.map +1 -0
- package/dist/components/screens/cost-dashboard.js +117 -0
- package/dist/components/screens/cost-dashboard.js.map +1 -0
- package/dist/components/ui/schema-form.d.ts +13 -0
- package/dist/components/ui/schema-form.d.ts.map +1 -0
- package/dist/components/ui/schema-form.js +87 -0
- package/dist/components/ui/schema-form.js.map +1 -0
- package/dist/components/ui/skip-link.d.ts +6 -0
- package/dist/components/ui/skip-link.d.ts.map +1 -0
- package/dist/components/ui/skip-link.js +9 -0
- package/dist/components/ui/skip-link.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/labels.d.ts +5 -0
- package/dist/lib/labels.d.ts.map +1 -1
- package/dist/lib/labels.js +5 -0
- package/dist/lib/labels.js.map +1 -1
- package/package.json +72 -4
package/README.md
CHANGED
|
@@ -133,6 +133,10 @@ few more. recharts, TanStack Hotkeys and the Markdown stack are optional.
|
|
|
133
133
|
trial conversions, paywall views against conversions, with filters by
|
|
134
134
|
store, plan, country and offering, saved audiences and a CSV link. Needs
|
|
135
135
|
recharts (optional peer), so it is its own export path.
|
|
136
|
+
- `screens/cost-dashboard`: `CostDashboard` on signet-server's
|
|
137
|
+
`observabilityAdminRoutes`: spend over time with cache savings, spend by
|
|
138
|
+
model, top spenders (hashes as given) and global cap bars; give it `data` or a
|
|
139
|
+
`fetcher(days)`. Needs recharts (optional peer), so it is its own export path.
|
|
136
140
|
- `screens/growth-screens`: `WaitlistJoin` (with the place in line),
|
|
137
141
|
`InviteAccept`, `ReferralCard`, `OnboardingChecklist`, `FeedbackWidget` /
|
|
138
142
|
`FeedbackForm` and `WhatsNew`, shaped like signet-db's growth results.
|
|
@@ -301,6 +305,7 @@ without an app changing. Each component's source starts with its recipe:
|
|
|
301
305
|
| `screens/status-screens` | live-region + field-wiring + roving-focus (timeline) |
|
|
302
306
|
| `screens/funnel-screens` | selection + controllable-state + live-region |
|
|
303
307
|
| `screens/subscription-charts` | field-wiring (labelled filters) + controllable-state (filters) |
|
|
308
|
+
| `screens/cost-dashboard` | controllable-state (range) + live-region (loading, error) |
|
|
304
309
|
| `screens/growth-screens` | selection + roving-focus + controllable-state + popup + dismiss + live-region + field-wiring |
|
|
305
310
|
| `screens/workflow-screens` | roving-focus (timeline) + live-region + field-wiring |
|
|
306
311
|
| `screens/org-screens` | popup + dismiss + live-region + field-wiring + controllable-state |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DashboardData, DashboardPoint } from "./sample.js";
|
|
3
|
+
export type { DashboardData, DashboardPoint, DashboardRow } from "./sample.js";
|
|
4
|
+
export { SAMPLE_DASHBOARD } from "./sample.js";
|
|
5
|
+
export type BlockState = "ready" | "loading" | "error";
|
|
6
|
+
export declare const DEFAULT_DASHBOARD_LABELS: {
|
|
7
|
+
title: string;
|
|
8
|
+
range: string;
|
|
9
|
+
chartTitle: string;
|
|
10
|
+
chartSummary: (points: DashboardPoint[]) => string;
|
|
11
|
+
activityTitle: string;
|
|
12
|
+
name: string;
|
|
13
|
+
status: string;
|
|
14
|
+
date: string;
|
|
15
|
+
emptyTitle: string;
|
|
16
|
+
emptyDescription: string;
|
|
17
|
+
errorMessage: string;
|
|
18
|
+
loading: string;
|
|
19
|
+
};
|
|
20
|
+
export type DashboardLabels = typeof DEFAULT_DASHBOARD_LABELS;
|
|
21
|
+
export declare const DEFAULT_DASHBOARD_RANGES: {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}[];
|
|
25
|
+
type Part = "header" | "stats" | "chart" | "activity";
|
|
26
|
+
export type AnalyticsDashboardProps = {
|
|
27
|
+
data?: DashboardData;
|
|
28
|
+
state?: BlockState;
|
|
29
|
+
onRetry?: () => void;
|
|
30
|
+
ranges?: {
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
}[];
|
|
34
|
+
range?: string;
|
|
35
|
+
onRangeChange?: (range: string) => void;
|
|
36
|
+
actions?: React.ReactNode;
|
|
37
|
+
labels?: Partial<DashboardLabels>;
|
|
38
|
+
classNames?: Partial<Record<Part, string>>;
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function AnalyticsDashboard({ data, state, onRetry, ranges, range, onRangeChange, actions, labels: labelOverrides, classNames, className, }: AnalyticsDashboardProps): React.JSX.Element;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/analytics-dashboard/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CA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kBAAkB,CAAC,EACjC,IAAI,EACJ,KAAe,EACf,OAAO,EACP,MAAiC,EACjC,KAAK,EACL,aAAa,EACb,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,UAAU,EACV,SAAS,GACV,EAAE,uBAAuB,qBAgIzB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts";
|
|
5
|
+
import { Badge } from "../../components/ui/badge.js";
|
|
6
|
+
import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card.js";
|
|
7
|
+
import { CHART_COLORS, ChartContainer, ChartTooltip, ChartTooltipContent, } from "../../components/ui/chart.js";
|
|
8
|
+
import { EmptyState } from "../../components/ui/empty-state.js";
|
|
9
|
+
import { ErrorState } from "../../components/ui/error-state.js";
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../components/ui/select.js";
|
|
11
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
12
|
+
import { StatStrip } from "../../components/ui/stat-strip.js";
|
|
13
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../components/ui/table.js";
|
|
14
|
+
import { cn } from "../../lib/utils.js";
|
|
15
|
+
export { SAMPLE_DASHBOARD } from "./sample.js";
|
|
16
|
+
export const DEFAULT_DASHBOARD_LABELS = {
|
|
17
|
+
title: "Overview",
|
|
18
|
+
range: "Date range",
|
|
19
|
+
chartTitle: "Visitors",
|
|
20
|
+
chartSummary: (points) => {
|
|
21
|
+
const first = points[0];
|
|
22
|
+
const last = points[points.length - 1];
|
|
23
|
+
if (!first || !last)
|
|
24
|
+
return "Visitors chart, no data";
|
|
25
|
+
const peak = points.reduce((a, b) => (b.value > a.value ? b : a));
|
|
26
|
+
return `Visitors from ${first.label} to ${last.label}: started at ${first.value.toLocaleString()}, ended at ${last.value.toLocaleString()}, peaked at ${peak.value.toLocaleString()} on ${peak.label}.`;
|
|
27
|
+
},
|
|
28
|
+
activityTitle: "Recent activity",
|
|
29
|
+
name: "Name",
|
|
30
|
+
status: "Status",
|
|
31
|
+
date: "Date",
|
|
32
|
+
emptyTitle: "No data yet",
|
|
33
|
+
emptyDescription: "Activity will show here once people start using your app.",
|
|
34
|
+
errorMessage: "We could not load your overview.",
|
|
35
|
+
loading: "Loading overview",
|
|
36
|
+
};
|
|
37
|
+
export const DEFAULT_DASHBOARD_RANGES = [
|
|
38
|
+
{ value: "7d", label: "Last 7 days" },
|
|
39
|
+
{ value: "30d", label: "Last 30 days" },
|
|
40
|
+
{ value: "90d", label: "Last 90 days" },
|
|
41
|
+
];
|
|
42
|
+
const CHART = { value: { label: "Visitors", color: CHART_COLORS[0] } };
|
|
43
|
+
export function AnalyticsDashboard({ data, state = "ready", onRetry, ranges = DEFAULT_DASHBOARD_RANGES, range, onRangeChange, actions, labels: labelOverrides, classNames, className, }) {
|
|
44
|
+
const l = { ...DEFAULT_DASHBOARD_LABELS, ...labelOverrides };
|
|
45
|
+
const [own, setOwn] = React.useState(ranges[0]?.value ?? "");
|
|
46
|
+
const selected = range ?? own;
|
|
47
|
+
const empty = !data || (!data.series.length && !data.rows.length && !data.stats.length);
|
|
48
|
+
const loading = state === "loading";
|
|
49
|
+
return (_jsxs("section", { "data-block": "analytics-dashboard", "data-state": state, "aria-busy": loading || undefined, className: cn("mx-auto flex w-full max-w-7xl flex-col gap-4 p-4 md:gap-6 md:p-6", className), children: [_jsxs("header", { "data-slot": "dashboard-header", className: cn("flex items-center justify-between gap-3", classNames?.header), children: [_jsx("h1", { className: "min-w-0 truncate text-title font-semibold text-text-primary", children: l.title }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [actions, _jsxs(Select, { value: selected, onValueChange: (v) => {
|
|
50
|
+
setOwn(v);
|
|
51
|
+
onRangeChange?.(v);
|
|
52
|
+
}, children: [_jsx(SelectTrigger, { "aria-label": l.range, className: "h-11 w-40 md:h-8", children: _jsx(SelectValue, { children: (v) => ranges.find((r) => r.value === v)?.label ?? v }) }), _jsx(SelectContent, { children: ranges.map((r) => (_jsx(SelectItem, { value: r.value, className: "min-h-11 md:min-h-0", children: r.label }, r.value))) })] })] })] }), state === "error" ? (_jsx(Card, { "data-slot": "dashboard-error", children: _jsx(CardContent, { children: _jsx(ErrorState, { message: l.errorMessage, onRetry: onRetry }) }) })) : loading ? (_jsx(DashboardSkeleton, { label: l.loading })) : empty ? (_jsx(Card, { "data-slot": "dashboard-empty", children: _jsx(CardContent, { children: _jsx("div", { className: "[&>div]:min-h-0 [&>div]:py-16", children: _jsx(EmptyState, { title: l.emptyTitle, description: l.emptyDescription }) }) }) })) : (_jsxs(_Fragment, { children: [_jsx(StatStrip, { items: data.stats, className: classNames?.stats }), _jsxs(Card, { "data-slot": "dashboard-chart", className: classNames?.chart, children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: l.chartTitle }) }), _jsx(CardContent, { children: _jsx(ChartContainer, { config: CHART, role: "img", "aria-label": l.chartSummary(data.series), className: "aspect-auto h-45 w-full md:h-60", children: _jsxs(AreaChart, { data: data.series, margin: { left: 8, right: 8, top: 8 }, children: [_jsx(CartesianGrid, { vertical: false }), _jsx(XAxis, { dataKey: "label", tickLine: false, axisLine: false, tickMargin: 8 }), _jsx(ChartTooltip, { content: _jsx(ChartTooltipContent, {}) }), _jsx(Area, { dataKey: "value", type: "monotone", stroke: "var(--color-value)", fill: "var(--color-value)", fillOpacity: 0.15, strokeWidth: 2, isAnimationActive: false })] }) }) })] }), _jsxs(Card, { "data-slot": "dashboard-activity", className: classNames?.activity, children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: l.activityTitle }) }), _jsx(CardContent, { children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: l.name }), _jsx(TableHead, { children: l.status }), _jsx(TableHead, { className: "hidden md:table-cell", children: l.date })] }) }), _jsx(TableBody, { children: data.rows.map((r) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "w-full max-w-0 truncate font-medium", title: r.name, children: r.name }), _jsx(TableCell, { children: _jsx(Badge, { variant: r.tone ?? "default", children: r.status }) }), _jsx(TableCell, { className: "hidden whitespace-nowrap text-text-muted md:table-cell", children: r.date })] }, r.id))) })] }) })] })] }))] }));
|
|
53
|
+
}
|
|
54
|
+
function DashboardSkeleton({ label }) {
|
|
55
|
+
return (_jsxs("div", { "data-slot": "dashboard-skeleton", role: "status", "aria-label": label, className: "contents", children: [_jsx("div", { className: "grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-4 lg:gap-4", children: [0, 1, 2, 3].map((i) => (_jsx(Skeleton, { className: "h-14 md:h-24" }, i))) }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(Skeleton, { className: "h-5 w-24" }) }), _jsx(CardContent, { children: _jsx(Skeleton, { className: "h-45 w-full md:h-60" }) })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(Skeleton, { className: "h-5 w-36" }) }), _jsx(CardContent, { className: "flex flex-col gap-3", children: [0, 1, 2, 3, 4].map((i) => (_jsx(Skeleton, { className: "h-8 w-full" }, i))) })] })] }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/blocks/analytics-dashboard/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAOZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,6BAA6B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,EAAE,KAAK,EAAqB;IACrD,OAAO,CACL,4BAAe,oBAAoB,EAAC,IAAI,EAAC,QAAQ,gBAAa,KAAK,EAAE,SAAS,EAAC,UAAU,aACvF,cAAK,SAAS,EAAC,+DAA+D,YAC3E,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACvB,KAAC,QAAQ,IAAS,SAAS,EAAC,cAAc,IAA3B,CAAC,CAA6B,CAC9C,CAAC,GACE,EACN,MAAC,IAAI,eACH,KAAC,UAAU,cACT,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,GACtB,EACb,KAAC,WAAW,cACV,KAAC,QAAQ,IAAC,SAAS,EAAC,qBAAqB,GAAG,GAChC,IACT,EACP,MAAC,IAAI,eACH,KAAC,UAAU,cACT,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,GACtB,EACb,KAAC,WAAW,IAAC,SAAS,EAAC,qBAAqB,YACzC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAC1B,KAAC,QAAQ,IAAS,SAAS,EAAC,YAAY,IAAzB,CAAC,CAA2B,CAC5C,CAAC,GACU,IACT,IACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StatItem } from "../../components/ui/stat-strip.js";
|
|
2
|
+
export type DashboardPoint = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
export type DashboardRow = {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
status: string;
|
|
10
|
+
tone?: "default" | "secondary" | "outline" | "destructive";
|
|
11
|
+
date: string;
|
|
12
|
+
};
|
|
13
|
+
export type DashboardData = {
|
|
14
|
+
stats: StatItem[];
|
|
15
|
+
series: DashboardPoint[];
|
|
16
|
+
rows: DashboardRow[];
|
|
17
|
+
};
|
|
18
|
+
export declare const SAMPLE_DASHBOARD: DashboardData;
|
|
19
|
+
//# sourceMappingURL=sample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../../src/blocks/analytics-dashboard/sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAGjE,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAG7D,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAAA;IAC1D,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,IAAI,EAAE,YAAY,EAAE,CAAA;CACrB,CAAA;AAGD,eAAO,MAAM,gBAAgB,EAAE,aAmC9B,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const SAMPLE_DASHBOARD = {
|
|
2
|
+
stats: [
|
|
3
|
+
{ label: "Visitors", value: "12,480", meta: "+8.2% vs last period", tone: "good" },
|
|
4
|
+
{ label: "Signups", value: "684", meta: "+3.1% vs last period", tone: "good" },
|
|
5
|
+
{ label: "Active users", value: "3,912", meta: "-1.4% vs last period", tone: "warn" },
|
|
6
|
+
{ label: "Projects", value: "1,207", meta: "42 created today" },
|
|
7
|
+
],
|
|
8
|
+
series: [
|
|
9
|
+
{ label: "Mon", value: 1420 },
|
|
10
|
+
{ label: "Tue", value: 1760 },
|
|
11
|
+
{ label: "Wed", value: 1680 },
|
|
12
|
+
{ label: "Thu", value: 2040 },
|
|
13
|
+
{ label: "Fri", value: 2310 },
|
|
14
|
+
{ label: "Sat", value: 1590 },
|
|
15
|
+
{ label: "Sun", value: 1680 },
|
|
16
|
+
],
|
|
17
|
+
rows: [
|
|
18
|
+
{ id: "1", name: "Acme Studio", status: "Active", date: "Nov 16, 2026" },
|
|
19
|
+
{
|
|
20
|
+
id: "2",
|
|
21
|
+
name: "Northwind Analytics",
|
|
22
|
+
status: "Trial",
|
|
23
|
+
tone: "secondary",
|
|
24
|
+
date: "Nov 15, 2026",
|
|
25
|
+
},
|
|
26
|
+
{ id: "3", name: "Globex Design Collective", status: "Active", date: "Nov 15, 2026" },
|
|
27
|
+
{ id: "4", name: "Initech", status: "Paused", tone: "outline", date: "Nov 13, 2026" },
|
|
28
|
+
{
|
|
29
|
+
id: "5",
|
|
30
|
+
name: "Umbrella Labs",
|
|
31
|
+
status: "Past due",
|
|
32
|
+
tone: "destructive",
|
|
33
|
+
date: "Nov 12, 2026",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=sample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../../src/blocks/analytics-dashboard/sample.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,gBAAgB,GAAkB;IAC7C,KAAK,EAAE;QACL,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,EAAE;QAClF,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,EAAE;QAC9E,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,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 +1,61 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type AuthChannel, type AuthMode, type AuthScreenProps, type CodeRequest, type OAuthProvider } from "../../components/screens/auth-screens.js";
|
|
3
|
+
export type BlockState = "ready" | "loading" | "error";
|
|
4
|
+
export declare const DEFAULT_AUTH_BLOCK_LABELS: {
|
|
5
|
+
signInTitle: string;
|
|
6
|
+
signUpTitle: string;
|
|
7
|
+
email: string;
|
|
8
|
+
phone: string;
|
|
9
|
+
emailPlaceholder: string;
|
|
10
|
+
phonePlaceholder: string;
|
|
11
|
+
channels: string;
|
|
12
|
+
sendCode: string;
|
|
13
|
+
or: string;
|
|
14
|
+
continueWith: (provider: string) => string;
|
|
15
|
+
toSignUp: string;
|
|
16
|
+
signUp: string;
|
|
17
|
+
toSignIn: string;
|
|
18
|
+
signIn: string;
|
|
19
|
+
verifyTitle: string;
|
|
20
|
+
verifyPhoneTitle: string;
|
|
21
|
+
sentTo: (to: string) => string;
|
|
22
|
+
code: string;
|
|
23
|
+
verify: string;
|
|
24
|
+
resend: string;
|
|
25
|
+
resendIn: (seconds: number) => string;
|
|
26
|
+
change: string;
|
|
27
|
+
expiredTitle: string;
|
|
28
|
+
expiredDescription: string;
|
|
29
|
+
expiredAction: string;
|
|
30
|
+
error: string;
|
|
31
|
+
errorMessage: string;
|
|
32
|
+
loading: string;
|
|
33
|
+
};
|
|
34
|
+
export type AuthBlockLabels = typeof DEFAULT_AUTH_BLOCK_LABELS;
|
|
35
|
+
export declare const SAMPLE_PROVIDERS: OAuthProvider[];
|
|
36
|
+
type Part = NonNullable<AuthScreenProps["classNames"]>;
|
|
37
|
+
export type AuthProps = {
|
|
38
|
+
mode?: AuthMode;
|
|
39
|
+
onModeChange?: (mode: AuthMode) => void;
|
|
40
|
+
step?: "request" | "verify";
|
|
41
|
+
channels?: readonly AuthChannel[];
|
|
42
|
+
to?: string;
|
|
43
|
+
channel?: AuthChannel;
|
|
44
|
+
onBack?: () => void;
|
|
45
|
+
onRequestCode?: (request: CodeRequest) => unknown;
|
|
46
|
+
onVerify?: (request: CodeRequest & {
|
|
47
|
+
code: string;
|
|
48
|
+
}) => unknown;
|
|
49
|
+
providers?: readonly OAuthProvider[];
|
|
50
|
+
onOAuth?: (provider: OAuthProvider, mode: AuthMode) => unknown;
|
|
51
|
+
logo?: React.ReactNode;
|
|
52
|
+
footer?: React.ReactNode;
|
|
53
|
+
state?: BlockState;
|
|
54
|
+
onRetry?: () => void;
|
|
55
|
+
labels?: Partial<AuthBlockLabels>;
|
|
56
|
+
classNames?: Partial<Part>;
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
export declare function Auth({ mode, onModeChange, step, channels, to, channel, onBack, onRequestCode, onVerify, providers, onOAuth, logo, footer, state, onRetry, labels: labelOverrides, classNames, className, }: AuthProps): React.JSX.Element;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/auth-page/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AACnC,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,QAAQ,EAEb,KAAK,eAAe,EACpB,KAAK,WAAW,EAEhB,KAAK,aAAa,EAEnB,MAAM,0CAA0C,CAAA;AAMjD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAGtD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIrC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,yBAAyB,CAAA;AAG9D,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAG3C,CAAA;AAED,KAAK,IAAI,GAAG,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAA;AAEtD,MAAM,MAAM,SAAS,GAAG;IAEtB,IAAI,CAAC,E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-0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AuthScreen, DEFAULT_AUTH_LABELS, VerifyCodeScreen, } from "../../components/screens/auth-screens.js";
|
|
4
|
+
import { Card, CardContent } from "../../components/ui/card.js";
|
|
5
|
+
import { ErrorState } from "../../components/ui/error-state.js";
|
|
6
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
8
|
+
export const DEFAULT_AUTH_BLOCK_LABELS = {
|
|
9
|
+
...DEFAULT_AUTH_LABELS,
|
|
10
|
+
errorMessage: "We could not load the sign-in page.",
|
|
11
|
+
loading: "Loading sign-in",
|
|
12
|
+
};
|
|
13
|
+
export const SAMPLE_PROVIDERS = [
|
|
14
|
+
{ id: "google", label: "Google" },
|
|
15
|
+
{ id: "github", label: "GitHub" },
|
|
16
|
+
];
|
|
17
|
+
const TOUCH = "max-md:[&_input]:h-11 max-md:[&_button[type=submit]]:h-11 max-md:[&_button[data-provider]]:h-11 max-md:[&_[role=tablist]]:h-11 max-md:[&_[data-slot=input-otp-slot]]:size-11";
|
|
18
|
+
export function Auth({ mode, onModeChange, step = "request", channels, to, channel, onBack, onRequestCode, onVerify, providers = [], onOAuth, logo, footer, state = "ready", onRetry, labels: labelOverrides, classNames, className, }) {
|
|
19
|
+
const l = { ...DEFAULT_AUTH_BLOCK_LABELS, ...labelOverrides };
|
|
20
|
+
const labels = l;
|
|
21
|
+
const card = cn(TOUCH, classNames?.card);
|
|
22
|
+
return (_jsx("section", { "data-block": "auth-page", "data-state": state, "data-step": step, "aria-busy": state === "loading" || undefined, className: cn("mx-auto w-full max-w-7xl p-4 py-8 md:p-6 md:py-16", className), children: state === "error" ? (_jsx(Card, { "data-slot": "auth-error", className: "mx-auto max-w-sm", children: _jsx(CardContent, { children: _jsx(ErrorState, { message: l.errorMessage, onRetry: onRetry }) }) })) : state === "loading" ? (_jsx(AuthSkeleton, { label: l.loading })) : step === "verify" ? (_jsx(VerifyCodeScreen, { channel: channel, to: to, onBack: onBack, logo: logo, labels: labels, onVerify: (code) => onVerify?.({ channel: channel ?? "email", to: to ?? "", mode: mode ?? "sign-in", code }), onResend: onRequestCode
|
|
23
|
+
? () => onRequestCode({
|
|
24
|
+
channel: channel ?? "email",
|
|
25
|
+
to: to ?? "",
|
|
26
|
+
mode: mode ?? "sign-in",
|
|
27
|
+
})
|
|
28
|
+
: undefined, className: card, classNames: { header: classNames?.header, form: classNames?.verify } })) : (_jsx(AuthScreen, { mode: mode, onModeChange: onModeChange, channels: channels, onRequestCode: onRequestCode, onVerify: onVerify, providers: providers, onOAuth: onOAuth, logo: logo, footer: footer, labels: labels, className: card, classNames: { ...classNames, card: undefined } })) }));
|
|
29
|
+
}
|
|
30
|
+
function AuthSkeleton({ label }) {
|
|
31
|
+
return (_jsxs("div", { "data-slot": "auth-skeleton", role: "status", "aria-label": label, className: "mx-auto flex w-full max-w-sm flex-col gap-6 rounded-xl bg-bg-surface p-6 ring-1 ring-foreground/10", children: [_jsx(Skeleton, { className: "mx-auto h-6 w-40" }), _jsx(Skeleton, { className: "h-11 w-full" }), _jsx(Skeleton, { className: "h-11 w-full" }), _jsx(Skeleton, { className: "h-11 w-full" })] }));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/blocks/auth-page/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAWZ,OAAO,EAIL,UAAU,EAGV,mBAAmB,EAEnB,gBAAgB,GACjB,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAA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EAAE,GAC9C,CACH,GACO,CACX,CAAA;AACH,CAAC;AAGD,SAAS,YAAY,CAAC,EAAE,KAAK,EAAqB;IAChD,OAAO,CACL,4BACY,eAAe,EACzB,IAAI,EAAC,QAAQ,gBACD,KAAK,EACjB,SAAS,EAAC,oGAAoG,aAE9G,KAAC,QAAQ,IAAC,SAAS,EAAC,kBAAkB,GAAG,EACzC,KAAC,QAAQ,IAAC,SAAS,EAAC,aAAa,GAAG,EACpC,KAAC,QAAQ,IAAC,SAAS,EAAC,aAAa,GAAG,EACpC,KAAC,QAAQ,IAAC,SAAS,EAAC,aAAa,GAAG,IAChC,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type BlockState = "ready" | "loading" | "error";
|
|
3
|
+
export type CheckoutItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
quantity?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const DEFAULT_CHECKOUT_LABELS: {
|
|
11
|
+
title: string;
|
|
12
|
+
items: string;
|
|
13
|
+
subtotal: string;
|
|
14
|
+
discount: string;
|
|
15
|
+
tax: string;
|
|
16
|
+
total: string;
|
|
17
|
+
quantity: (n: number) => string;
|
|
18
|
+
pay: (total: string) => string;
|
|
19
|
+
emptyTitle: string;
|
|
20
|
+
emptyDescription: string;
|
|
21
|
+
error: string;
|
|
22
|
+
errorMessage: string;
|
|
23
|
+
loading: string;
|
|
24
|
+
};
|
|
25
|
+
export type CheckoutLabels = typeof DEFAULT_CHECKOUT_LABELS;
|
|
26
|
+
type Part = "items" | "item" | "totals" | "total" | "pay";
|
|
27
|
+
export type CheckoutSummaryProps = {
|
|
28
|
+
items?: readonly CheckoutItem[];
|
|
29
|
+
currency?: string;
|
|
30
|
+
discount?: number;
|
|
31
|
+
tax?: number;
|
|
32
|
+
onPay?: (total: number) => void | Promise<void>;
|
|
33
|
+
state?: BlockState;
|
|
34
|
+
onRetry?: () => void;
|
|
35
|
+
labels?: Partial<CheckoutLabels>;
|
|
36
|
+
classNames?: Partial<Record<Part, string>>;
|
|
37
|
+
className?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function checkoutTotal(items: readonly CheckoutItem[], discount?: number, tax?: number): number;
|
|
40
|
+
export declare function CheckoutSummary({ items, currency, discount, tax, onPay, state, onRetry, labels: labelOverrides, classNames, className, }: CheckoutSummaryProps): React.JSX.Element;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/checkout-summary/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAEtD,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,MAAM,EAAE,MAAM,CAAA;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAGD,eAAO,MAAM,uBAAuB;IAClC,KAAK;IACL,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,GAAG;IACH,KAAK;IACL,QAAQ,MAAM,MAAM;IACpB,GAAG,UAAU,MAAM;IACnB,UAAU;IACV,gBAAgB;IAChB,KAAK;IACL,YAAY;IACZ,OAAO;CACR,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,uBAAuB,CAAA;AAE3D,KAAK,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAA;AAEzD,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IAE/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,QAAQ,SAAI,EAAE,GAAG,SAAI,GAAG,MAAM,CAE3F;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAoB,EACpB,QAAgB,EAChB,QAAY,EACZ,GAAO,EACP,KAAK,EACL,KAAe,EACf,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,UAAU,EACV,SAAS,GACV,EAAE,oBAAoB,qBAsHtB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { formatMoney } from "../../components/screens/billing-screens.js";
|
|
5
|
+
import { Button } from "../../components/ui/button.js";
|
|
6
|
+
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "../../components/ui/card.js";
|
|
7
|
+
import { EmptyState } from "../../components/ui/empty-state.js";
|
|
8
|
+
import { ErrorState } from "../../components/ui/error-state.js";
|
|
9
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
10
|
+
import { Spinner } from "../../components/ui/spinner.js";
|
|
11
|
+
import { cn } from "../../lib/utils.js";
|
|
12
|
+
import { SAMPLE_ITEMS } from "./sample.js";
|
|
13
|
+
export const DEFAULT_CHECKOUT_LABELS = {
|
|
14
|
+
title: "Order summary",
|
|
15
|
+
items: "Items",
|
|
16
|
+
subtotal: "Subtotal",
|
|
17
|
+
discount: "Discount",
|
|
18
|
+
tax: "Tax",
|
|
19
|
+
total: "Total",
|
|
20
|
+
quantity: (n) => `Qty ${n}`,
|
|
21
|
+
pay: (total) => `Pay ${total}`,
|
|
22
|
+
emptyTitle: "Your cart is empty",
|
|
23
|
+
emptyDescription: "Add something to check out.",
|
|
24
|
+
error: "Something went wrong. Try again.",
|
|
25
|
+
errorMessage: "We could not load your order.",
|
|
26
|
+
loading: "Loading order",
|
|
27
|
+
};
|
|
28
|
+
export function checkoutTotal(items, discount = 0, tax = 0) {
|
|
29
|
+
return items.reduce((sum, i) => sum + i.amount * (i.quantity ?? 1), 0) - discount + tax;
|
|
30
|
+
}
|
|
31
|
+
export function CheckoutSummary({ items = SAMPLE_ITEMS, currency = "USD", discount = 0, tax = 0, onPay, state = "ready", onRetry, labels: labelOverrides, classNames, className, }) {
|
|
32
|
+
const l = { ...DEFAULT_CHECKOUT_LABELS, ...labelOverrides };
|
|
33
|
+
const [pending, setPending] = React.useState(false);
|
|
34
|
+
const [error, setError] = React.useState(null);
|
|
35
|
+
const money = (n) => formatMoney(n, currency);
|
|
36
|
+
const total = checkoutTotal(items, discount, tax);
|
|
37
|
+
const subtotal = checkoutTotal(items);
|
|
38
|
+
const pay = async () => {
|
|
39
|
+
setPending(true);
|
|
40
|
+
setError(null);
|
|
41
|
+
try {
|
|
42
|
+
await onPay?.(total);
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
setError(e instanceof Error && e.message ? e.message : l.error);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
setPending(false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const row = "flex items-baseline justify-between gap-4";
|
|
52
|
+
return (_jsx("section", { "data-block": "checkout-summary", "data-state": state, "aria-busy": state === "loading" || undefined, className: cn("mx-auto w-full max-w-7xl p-4 md:p-6", className), children: state === "error" ? (_jsx(Card, { "data-slot": "checkout-error", children: _jsx(CardContent, { children: _jsx(ErrorState, { message: l.errorMessage, onRetry: onRetry }) }) })) : state === "loading" ? (_jsx(CheckoutSkeleton, { label: l.loading })) : items.length === 0 ? (_jsx(EmptyState, { title: l.emptyTitle, description: l.emptyDescription })) : (_jsxs(Card, { "data-slot": "checkout-card", className: "mx-auto max-w-lg", children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: _jsx("h2", { className: "text-base font-medium", children: l.title }) }) }), _jsxs(CardContent, { className: "flex flex-col gap-4", children: [_jsx("ul", { "data-slot": "checkout-items", "aria-label": l.items, className: cn("grid gap-3", classNames?.items), children: items.map((item) => {
|
|
53
|
+
const qty = item.quantity ?? 1;
|
|
54
|
+
return (_jsxs("li", { "data-slot": "checkout-item", className: cn(row, classNames?.item), children: [_jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block truncate font-medium", title: item.name, children: item.name }), item.description || qty > 1 ? (_jsx("span", { className: "block truncate text-text-muted", title: item.description, children: [item.description, qty > 1 ? l.quantity(qty) : null]
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.join(" · ") })) : null] }), _jsx("span", { className: "shrink-0 tabular-nums", children: money(item.amount * qty) })] }, item.id));
|
|
57
|
+
}) }), _jsxs("dl", { "data-slot": "checkout-totals", className: cn("grid gap-2 border-t border-border-default pt-4", classNames?.totals), children: [_jsxs("div", { className: row, children: [_jsx("dt", { className: "text-text-secondary", children: l.subtotal }), _jsx("dd", { className: "tabular-nums", children: money(subtotal) })] }), discount ? (_jsxs("div", { className: row, children: [_jsx("dt", { className: "text-text-secondary", children: l.discount }), _jsxs("dd", { className: "tabular-nums", children: ["\u2212", money(discount)] })] })) : null, tax ? (_jsxs("div", { className: row, children: [_jsx("dt", { className: "text-text-secondary", children: l.tax }), _jsx("dd", { className: "tabular-nums", children: money(tax) })] })) : null, _jsxs("div", { "data-slot": "checkout-total", className: cn(row, "font-bold", classNames?.total), children: [_jsx("dt", { children: l.total }), _jsx("dd", { className: "text-base tabular-nums", children: money(total) })] })] })] }), _jsxs(CardFooter, { className: "flex-col items-stretch gap-2", children: [_jsxs(Button, { type: "button", "data-slot": "checkout-pay", size: "touch", className: cn("w-full md:h-8", classNames?.pay), disabled: pending, onClick: pay, children: [pending && _jsx(Spinner, { className: "text-current", "aria-hidden": "true" }), l.pay(money(total))] }), _jsx("p", { role: "alert", className: "text-center text-sm text-destructive empty:hidden", children: error })] })] })) }));
|
|
58
|
+
}
|
|
59
|
+
function CheckoutSkeleton({ label }) {
|
|
60
|
+
return (_jsxs(Card, { "data-slot": "checkout-skeleton", role: "status", "aria-label": label, className: "mx-auto max-w-lg", children: [_jsx(CardHeader, { children: _jsx(Skeleton, { className: "h-5 w-36" }) }), _jsxs(CardContent, { className: "flex flex-col gap-4", children: [Array.from({ length: 3 }, (_, i) => (_jsx(Skeleton, { className: "h-10 w-full" }, i))), _jsx(Skeleton, { className: "h-16 w-full" })] }), _jsx(CardFooter, { children: _jsx(Skeleton, { className: "h-11 w-full md:h-8" }) })] }));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/blocks/checkout-summary/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AASZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAA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":"","sources":["../../../src/blocks/checkout-summary/sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG9C,eAAO,MAAM,YAAY,EAAE,YAAY,EAItC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SAMPLE_ITEMS = [
|
|
2
|
+
{ id: "team", name: "Team plan", description: "Billed monthly", amount: 1900 },
|
|
3
|
+
{ id: "seats", name: "Extra seat", description: "Per member", amount: 500, quantity: 3 },
|
|
4
|
+
{ id: "support", name: "Priority support", amount: 900 },
|
|
5
|
+
];
|
|
6
|
+
//# sourceMappingURL=sample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../../src/blocks/checkout-summary/sample.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9E,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE;IACxF,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,EAAE;CACzD,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export type BlockState = "ready" | "loading" | "error";
|
|
3
|
+
export declare const DEFAULT_EMPTY_PAGE_LABELS: {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
action: string;
|
|
7
|
+
errorMessage: string;
|
|
8
|
+
loading: string;
|
|
9
|
+
};
|
|
10
|
+
export type EmptyPageLabels = typeof DEFAULT_EMPTY_PAGE_LABELS;
|
|
11
|
+
export type EmptyPageProps = {
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
action?: React.ReactNode;
|
|
16
|
+
onAction?: () => void;
|
|
17
|
+
state?: BlockState;
|
|
18
|
+
onRetry?: () => void;
|
|
19
|
+
labels?: Partial<EmptyPageLabels>;
|
|
20
|
+
classNames?: Partial<Record<"content", string>>;
|
|
21
|
+
className?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function EmptyPage({ icon, title, description, action, onAction, state, onRetry, labels: labelOverrides, classNames, className, }: EmptyPageProps): React.JSX.Element;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/empty-page/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAQnC,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAGtD,eAAO,MAAM,yBAAyB;IACpC,KAAK;IACL,WAAW;IACX,MAAM;IACN,YAAY;IACZ,OAAO;CACR,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,yBAAyB,CAAA;AAE9D,MAAM,MAAM,cAAc,GAAG;IAE3B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAExB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,QAAQ,EACR,KAAe,EACf,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,UAAU,EACV,SAAS,GACV,EAAE,cAAc,qBA8ChB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FolderIcon } from "lucide-react";
|
|
4
|
+
import { Button } from "../../components/ui/button.js";
|
|
5
|
+
import { Card, CardContent } from "../../components/ui/card.js";
|
|
6
|
+
import { EmptyState } from "../../components/ui/empty-state.js";
|
|
7
|
+
import { ErrorState } from "../../components/ui/error-state.js";
|
|
8
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
9
|
+
import { cn } from "../../lib/utils.js";
|
|
10
|
+
export const DEFAULT_EMPTY_PAGE_LABELS = {
|
|
11
|
+
title: "No projects yet",
|
|
12
|
+
description: "Create your first project to get started.",
|
|
13
|
+
action: "New project",
|
|
14
|
+
errorMessage: "We could not load this page.",
|
|
15
|
+
loading: "Loading",
|
|
16
|
+
};
|
|
17
|
+
export function EmptyPage({ icon, title, description, action, onAction, state = "ready", onRetry, labels: labelOverrides, classNames, className, }) {
|
|
18
|
+
const l = { ...DEFAULT_EMPTY_PAGE_LABELS, ...labelOverrides };
|
|
19
|
+
const button = action ??
|
|
20
|
+
(onAction ? (_jsx(Button, { type: "button", size: "touch", className: "md:h-8", onClick: onAction, children: l.action })) : null);
|
|
21
|
+
return (_jsx("section", { "data-block": "empty-page", "data-state": state, "aria-busy": state === "loading" || undefined, className: cn("mx-auto w-full max-w-7xl p-4 md:p-6", className), children: state === "error" ? (_jsx(Card, { "data-slot": "empty-page-error", children: _jsx(CardContent, { children: _jsx(ErrorState, { message: l.errorMessage, onRetry: onRetry }) }) })) : state === "loading" ? (_jsxs("div", { "data-slot": "empty-page-skeleton", role: "status", "aria-label": l.loading, className: "flex min-h-[60vh] flex-col items-center justify-center gap-3", children: [_jsx(Skeleton, { className: "size-10 rounded-full" }), _jsx(Skeleton, { className: "h-5 w-40" }), _jsx(Skeleton, { className: "h-4 w-64 max-w-full" }), _jsx(Skeleton, { className: "h-11 w-32 md:h-8" })] })) : (_jsx("div", { "data-slot": "empty-page-content", className: classNames?.content, children: _jsx(EmptyState, { icon: icon === undefined ? _jsx(FolderIcon, { "aria-hidden": "true", className: "size-10" }) : icon, title: title ?? l.title, description: description ?? l.description, action: button }) })) }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/blocks/empty-page/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAMZ,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAKvC,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,2CAA2C;IACxD,MAAM,EAAE,aAAa;IACrB,YAAY,EAAE,8BAA8B;IAC5C,OAAO,EAAE,SAAS;CACnB,CAAA;AAoBD,MAAM,UAAU,SAAS,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,QAAQ,EACR,KAAK,GAAG,OAAO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AAC,UAAU,mBAAa,MAAM,EAAC,SAAS,EAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,EACvF,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK,EACvB,WAAW,EAAE,WAAW,IAAI,CAAC,CAAC,WAAW,EACzC,MAAM,EAAE,MAAM,GACd,GACE,CACP,GACO,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type BlockState = "ready" | "loading" | "error";
|
|
2
|
+
export declare const DEFAULT_ERROR_PAGE_LABELS: {
|
|
3
|
+
notFoundTitle: string;
|
|
4
|
+
notFoundDescription: string;
|
|
5
|
+
serverTitle: string;
|
|
6
|
+
serverDescription: string;
|
|
7
|
+
home: string;
|
|
8
|
+
retry: string;
|
|
9
|
+
errorMessage: string;
|
|
10
|
+
loading: string;
|
|
11
|
+
};
|
|
12
|
+
export type ErrorPageLabels = typeof DEFAULT_ERROR_PAGE_LABELS;
|
|
13
|
+
type Part = "code" | "title" | "description" | "actions";
|
|
14
|
+
export type ErrorPageProps = {
|
|
15
|
+
code?: 404 | 500;
|
|
16
|
+
homeHref?: string;
|
|
17
|
+
onHome?: () => void;
|
|
18
|
+
onTryAgain?: () => void;
|
|
19
|
+
state?: BlockState;
|
|
20
|
+
onRetry?: () => void;
|
|
21
|
+
labels?: Partial<ErrorPageLabels>;
|
|
22
|
+
classNames?: Partial<Record<Part, string>>;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function ErrorPage({ code, homeHref, onHome, onTryAgain, state, onRetry, labels: labelOverrides, classNames, className, }: ErrorPageProps): import("react").JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/error-page/index.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAGtD,eAAO,MAAM,yBAAyB;IACpC,aAAa;IACb,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,IAAI;IACJ,KAAK;IACL,YAAY;IACZ,OAAO;CACR,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,yBAAyB,CAAA;AAE9D,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,CAAA;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAA;IAEhB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IAEnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,KAAK,CAAC,EAAE,UAAU,CAAA;IAElB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAU,EACV,QAAQ,EACR,MAAM,EACN,UAAU,EACV,KAAe,EACf,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,UAAU,EACV,SAAS,GACV,EAAE,cAAc,+BA4FhB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, buttonVariants } from "../../components/ui/button.js";
|
|
4
|
+
import { Card, CardContent } from "../../components/ui/card.js";
|
|
5
|
+
import { ErrorState } from "../../components/ui/error-state.js";
|
|
6
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
8
|
+
export const DEFAULT_ERROR_PAGE_LABELS = {
|
|
9
|
+
notFoundTitle: "Page not found",
|
|
10
|
+
notFoundDescription: "The page you're looking for doesn't exist or has moved.",
|
|
11
|
+
serverTitle: "Something went wrong",
|
|
12
|
+
serverDescription: "We hit an error on our side. Try again in a moment.",
|
|
13
|
+
home: "Go home",
|
|
14
|
+
retry: "Try again",
|
|
15
|
+
errorMessage: "We could not load this page.",
|
|
16
|
+
loading: "Loading",
|
|
17
|
+
};
|
|
18
|
+
export function ErrorPage({ code = 404, homeHref, onHome, onTryAgain, state = "ready", onRetry, labels: labelOverrides, classNames, className, }) {
|
|
19
|
+
const l = { ...DEFAULT_ERROR_PAGE_LABELS, ...labelOverrides };
|
|
20
|
+
const notFound = code === 404;
|
|
21
|
+
const title = notFound ? l.notFoundTitle : l.serverTitle;
|
|
22
|
+
const description = notFound ? l.notFoundDescription : l.serverDescription;
|
|
23
|
+
const btn = "md:h-8";
|
|
24
|
+
return (_jsx("section", { "data-block": "error-page", "data-code": code, "data-state": state, "aria-busy": state === "loading" || undefined, className: cn("mx-auto w-full max-w-7xl p-4 md:p-6", className), children: state === "error" ? (_jsx(Card, { "data-slot": "error-page-error", children: _jsx(CardContent, { children: _jsx(ErrorState, { message: l.errorMessage, onRetry: onRetry }) }) })) : state === "loading" ? (_jsxs("div", { "data-slot": "error-page-skeleton", role: "status", "aria-label": l.loading, className: "flex min-h-[60vh] flex-col items-center justify-center gap-3", children: [_jsx(Skeleton, { className: "h-20 w-40" }), _jsx(Skeleton, { className: "h-6 w-56 max-w-full" }), _jsx(Skeleton, { className: "h-4 w-72 max-w-full" }), _jsx(Skeleton, { className: "h-11 w-28 md:h-8" })] })) : (_jsxs("div", { className: "flex min-h-[60vh] flex-col items-center justify-center text-center", children: [_jsx("p", { "aria-hidden": "true", "data-slot": "error-page-code", className: cn("text-8xl leading-none font-semibold tabular-nums text-text-muted md:text-9xl", classNames?.code), children: code }), _jsx("h1", { "data-slot": "error-page-title", title: title, className: cn("mt-4 max-w-full truncate text-xl font-medium", classNames?.title), children: title }), _jsx("p", { "data-slot": "error-page-description", className: cn("mt-1 max-w-md text-text-secondary", classNames?.description), children: description }), _jsxs("div", { "data-slot": "error-page-actions", className: cn("mt-6 flex flex-wrap justify-center gap-2", classNames?.actions), children: [notFound || !onTryAgain ? null : (_jsx(Button, { type: "button", size: "touch", className: btn, onClick: onTryAgain, children: l.retry })), homeHref ? (_jsx("a", { href: homeHref, className: cn(buttonVariants({ variant: notFound ? "default" : "outline", size: "touch" }), btn), children: l.home })) : onHome ? (_jsx(Button, { type: "button", variant: notFound ? "default" : "outline", size: "touch", className: btn, onClick: onHome, children: l.home })) : null] })] })) }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|