create-expo-updates-server 0.4.0 → 0.6.1
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 +4 -2
- package/dist/template/Dockerfile +4 -6
- package/dist/template/README.md +4 -9
- package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
- package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
- package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
- package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
- package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
- package/dist/template/app/api/admin/updates/route.test.ts +21 -0
- package/dist/template/app/api/admin/updates/route.ts +12 -1
- package/dist/template/app/globals.css +65 -68
- package/dist/template/app/login/page.tsx +66 -42
- package/dist/template/app/updates/[encodedKey]/page.tsx +375 -263
- package/dist/template/app/updates/devices/page.tsx +188 -152
- package/dist/template/app/updates/embedded/page.tsx +63 -29
- package/dist/template/app/updates/emergency-redirects/page.tsx +93 -58
- package/dist/template/app/updates/layout.tsx +2 -1
- package/dist/template/app/updates/page.tsx +381 -283
- package/dist/template/app/updates/releases.test.tsx +156 -0
- package/dist/template/components/admin/admin-role.ts +5 -0
- package/dist/template/components/admin/admin-shell.tsx +166 -101
- package/dist/template/components/admin/confirm-action.tsx +123 -0
- package/dist/template/components/admin/language-switcher.tsx +25 -17
- package/dist/template/components/admin/release-badges.test.tsx +50 -0
- package/dist/template/components/admin/release-badges.tsx +101 -0
- package/dist/template/components/ui/alert.tsx +10 -3
- package/dist/template/components/ui/avatar.tsx +108 -0
- package/dist/template/components/ui/badge.tsx +2 -2
- package/dist/template/components/ui/breadcrumb.tsx +108 -0
- package/dist/template/components/ui/button.tsx +5 -5
- package/dist/template/components/ui/card.tsx +2 -2
- package/dist/template/components/ui/chart.tsx +1 -1
- package/dist/template/components/ui/collapsible.tsx +7 -0
- package/dist/template/components/ui/empty.tsx +103 -0
- package/dist/template/components/ui/field.tsx +248 -0
- package/dist/template/components/ui/input-group.tsx +170 -0
- package/dist/template/components/ui/input.tsx +1 -1
- package/dist/template/components/ui/native-select.tsx +1 -1
- package/dist/template/components/ui/radio-group.tsx +41 -0
- package/dist/template/components/ui/status-tones.ts +15 -0
- package/dist/template/components/ui/table.tsx +1 -1
- package/dist/template/components/ui/textarea.tsx +1 -1
- package/dist/template/docs/admin-ui.md +7 -3
- package/dist/template/docs/device-targeting.md +2 -7
- package/dist/template/docs/doctor.md +2 -2
- package/dist/template/docs/expo-app-setup.md +9 -27
- package/dist/template/docs/getting-started.md +3 -4
- package/dist/template/docs/installation-telemetry.md +2 -8
- package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
- package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
- package/dist/template/docs/migrations/schema.sql +349 -0
- package/dist/template/docs/npm-installer.md +3 -3
- package/dist/template/docs/operations-guide.md +8 -6
- package/dist/template/docs/ota-client-lifecycle.md +30 -68
- package/dist/template/docs/ota-update-policy.md +9 -20
- package/dist/template/docs/ru/admin-ui.md +7 -3
- package/dist/template/docs/ru/device-targeting.md +2 -2
- package/dist/template/docs/ru/doctor.md +2 -2
- package/dist/template/docs/ru/expo-app-setup.md +9 -9
- package/dist/template/docs/ru/getting-started.md +3 -3
- package/dist/template/docs/ru/installation-telemetry.md +2 -2
- package/dist/template/docs/ru/npm-installer.md +3 -3
- package/dist/template/docs/ru/operations-guide.md +8 -3
- package/dist/template/docs/ru/ota-client-lifecycle.md +30 -35
- package/dist/template/docs/ru/ota-update-policy.md +9 -7
- package/dist/template/docs/ru/publishing-npm-installer.md +2 -2
- package/dist/template/docs/uk/admin-ui.md +7 -3
- package/dist/template/docs/uk/device-targeting.md +2 -2
- package/dist/template/docs/uk/doctor.md +2 -2
- package/dist/template/docs/uk/expo-app-setup.md +9 -9
- package/dist/template/docs/uk/getting-started.md +3 -3
- package/dist/template/docs/uk/installation-telemetry.md +2 -2
- package/dist/template/docs/uk/npm-installer.md +3 -3
- package/dist/template/docs/uk/operations-guide.md +8 -3
- package/dist/template/docs/uk/ota-client-lifecycle.md +30 -35
- package/dist/template/docs/uk/ota-update-policy.md +9 -7
- package/dist/template/docs/uk/publishing-npm-installer.md +2 -2
- package/dist/template/lib/audience-ids.ts +4 -0
- package/dist/template/package-lock.json +46 -0
- package/dist/template/package.json +3 -1
- package/dist/template/scripts/configure-expo-app.mjs +3 -3
- package/dist/template/scripts/create-access-token.mjs +1 -1
- package/dist/template/scripts/lib/doctor.mjs +10 -7
- package/dist/template/scripts/lib/doctor.test.mjs +7 -5
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
- package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
- package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
- package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
- package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
- package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
- package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
- package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
- package/dist/template/scripts/tests/e2e/console.mjs +86 -0
- package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
- package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
- package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
- package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
- package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
- package/dist/template/scripts/tests/e2e/release-matrix.mjs +303 -0
- package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
- package/dist/template/scripts/tests/e2e/run.mjs +224 -0
- package/dist/template/scripts/tests/manifest-identity.sql +7 -5
- package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
- package/dist/template/src/client/admin-api.ts +45 -10
- package/dist/template/src/client/admin-types.ts +35 -1
- package/dist/template/src/client/devices/analytics.tsx +168 -231
- package/dist/template/src/client/devices/cohorts.tsx +181 -0
- package/dist/template/src/client/devices/device-name.tsx +37 -23
- package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
- package/dist/template/src/client/devices/registry.tsx +258 -245
- package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
- package/dist/template/src/client/devices/use-devices-report.ts +53 -82
- package/dist/template/src/client/devices/version-adoption-chart.tsx +47 -49
- package/dist/template/src/client/distribution-control.tsx +89 -57
- package/dist/template/src/client/distribution-history.tsx +353 -0
- package/dist/template/src/client/guard-action-catalog.tsx +183 -0
- package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
- package/dist/template/src/client/guard-action-combobox.tsx +133 -239
- package/dist/template/src/client/guard-action-options.ts +4 -6
- package/dist/template/src/client/i18n/en.json +133 -2
- package/dist/template/src/client/i18n/language-switching.test.tsx +12 -3
- package/dist/template/src/client/i18n/ru.json +133 -2
- package/dist/template/src/client/i18n/uk.json +133 -2
- package/dist/template/src/client/logout-button.tsx +3 -3
- package/dist/template/src/client/policy-draft.ts +138 -0
- package/dist/template/src/client/update-audience-editor.tsx +597 -206
- package/dist/template/src/client/update-policy-editor.test.ts +101 -29
- package/dist/template/src/client/update-policy-editor.tsx +454 -320
- package/dist/template/src/client/use-filtered-results.ts +55 -0
- package/dist/template/src/server/controllers/manifest.test.ts +25 -3
- package/dist/template/src/server/controllers/manifest.ts +1 -2
- package/dist/template/src/server/devices/audience.ts +9 -5
- package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
- package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
- package/dist/template/src/server/lib/admin-updates.ts +160 -534
- package/dist/template/src/server/lib/distribution-history.ts +97 -0
- package/dist/template/src/server/lib/supabase.js +24 -0
- package/dist/template/src/server/lib/supabase.test.ts +38 -1
- package/dist/template/src/server/lib/update-policy.test.ts +20 -0
- package/dist/template/src/server/lib/update-policy.ts +23 -10
- package/dist/template/src/server/manifest/manifest-repository.ts +2 -2
- package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
- package/dist/template/src/server/manifest/manifest-values.ts +21 -13
- package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
- package/dist/template/tsconfig.json +2 -2
- package/dist/template-manifest.json +445 -300
- package/package.json +1 -1
- package/dist/template/scripts/lib/device-identity.test.ts +0 -29
- package/dist/template/scripts/lib/ota-client.test.ts +0 -55
- package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
- package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
- package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
- package/dist/template/templates/expo-app/ota-client/README.md +0 -73
- package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
- package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
- package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
- package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
- package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
- package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
- package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { Languages } from "lucide-react";
|
|
4
|
+
import { NativeSelect } from "@/components/ui/native-select";
|
|
3
5
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
4
6
|
import { resolveLocale } from "@/src/client/i18n/messages";
|
|
5
7
|
|
|
@@ -7,22 +9,28 @@ export function LanguageSwitcher() {
|
|
|
7
9
|
const { locale, setLocale, t } = useI18n();
|
|
8
10
|
const label = t("Interface language");
|
|
9
11
|
return (
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
<div className="relative">
|
|
13
|
+
<Languages
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
className="pointer-events-none absolute left-2.5 top-1/2 z-10 size-4 -translate-y-1/2 text-muted-foreground"
|
|
16
|
+
/>
|
|
17
|
+
<NativeSelect
|
|
18
|
+
aria-label={label}
|
|
19
|
+
title={label}
|
|
20
|
+
value={locale}
|
|
21
|
+
onChange={(event) => setLocale(resolveLocale(event.target.value))}
|
|
22
|
+
className="border-transparent bg-transparent pl-8 hover:border-input"
|
|
23
|
+
>
|
|
24
|
+
<option value="en" lang="en">
|
|
25
|
+
English
|
|
26
|
+
</option>
|
|
27
|
+
<option value="ru" lang="ru">
|
|
28
|
+
Русский
|
|
29
|
+
</option>
|
|
30
|
+
<option value="uk" lang="uk">
|
|
31
|
+
Українська
|
|
32
|
+
</option>
|
|
33
|
+
</NativeSelect>
|
|
34
|
+
</div>
|
|
27
35
|
);
|
|
28
36
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import {
|
|
4
|
+
AudienceBadge,
|
|
5
|
+
ChannelBadge,
|
|
6
|
+
DeliveryBadge,
|
|
7
|
+
PlatformBadge,
|
|
8
|
+
ReleaseStatusBadge,
|
|
9
|
+
} from "./release-badges";
|
|
10
|
+
|
|
11
|
+
describe("release badge labels and states", () => {
|
|
12
|
+
it("distinguishes an unpublished draft from a disabled published release", () => {
|
|
13
|
+
const draft = renderToStaticMarkup(
|
|
14
|
+
<ReleaseStatusBadge
|
|
15
|
+
release={{ status: "disabled", policyEditable: true }}
|
|
16
|
+
/>,
|
|
17
|
+
);
|
|
18
|
+
const disabled = renderToStaticMarkup(
|
|
19
|
+
<ReleaseStatusBadge
|
|
20
|
+
release={{ status: "disabled", policyEditable: false }}
|
|
21
|
+
/>,
|
|
22
|
+
);
|
|
23
|
+
expect(draft).toContain('data-variant="warning"');
|
|
24
|
+
expect(draft).toContain("draft</span>");
|
|
25
|
+
expect(disabled).toContain('data-variant="neutral"');
|
|
26
|
+
expect(disabled).toContain("disabled</span>");
|
|
27
|
+
});
|
|
28
|
+
it("preserves arbitrary registry and channel values, including their case", () => {
|
|
29
|
+
for (const badge of [
|
|
30
|
+
<ChannelBadge key="c" channel="Production" />,
|
|
31
|
+
<PlatformBadge key="p" platform="custom" />,
|
|
32
|
+
]) {
|
|
33
|
+
expect(renderToStaticMarkup(badge)).toContain('data-variant="neutral"');
|
|
34
|
+
}
|
|
35
|
+
expect(renderToStaticMarkup(<PlatformBadge platform="custom" />)).toContain(
|
|
36
|
+
">custom<",
|
|
37
|
+
);
|
|
38
|
+
expect(
|
|
39
|
+
renderToStaticMarkup(<ChannelBadge channel="Production" />),
|
|
40
|
+
).toContain(">Production<");
|
|
41
|
+
});
|
|
42
|
+
it("keeps audience and delivery readable without relying on color", () => {
|
|
43
|
+
expect(renderToStaticMarkup(<AudienceBadge mode="devices" />)).toContain(
|
|
44
|
+
"Selected devices",
|
|
45
|
+
);
|
|
46
|
+
expect(renderToStaticMarkup(<DeliveryBadge mode="background" />)).toContain(
|
|
47
|
+
"Background",
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Check, CircleOff, GitBranch, Pencil } from "lucide-react";
|
|
4
|
+
import { Badge } from "@/components/ui/badge";
|
|
5
|
+
import { useI18n } from "@/src/client/i18n/provider";
|
|
6
|
+
import type { UpdateItem } from "@/src/client/admin-types";
|
|
7
|
+
import type { DeviceLaunchKind } from "@/src/server/devices/report-types";
|
|
8
|
+
|
|
9
|
+
export function PlatformBadge({ platform }: { platform: string }) {
|
|
10
|
+
if (platform === "ios") return <Badge variant="info">iOS</Badge>;
|
|
11
|
+
if (platform === "android") return <Badge variant="positive">Android</Badge>;
|
|
12
|
+
return <Badge variant="neutral">{platform}</Badge>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const channelTones = new Map<string, "violet" | "warning" | "teal">([
|
|
16
|
+
["production", "violet"],
|
|
17
|
+
["prod", "violet"],
|
|
18
|
+
["preview", "warning"],
|
|
19
|
+
["staging", "warning"],
|
|
20
|
+
["beta", "warning"],
|
|
21
|
+
["development", "teal"],
|
|
22
|
+
["dev", "teal"],
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
export function ChannelBadge({ channel }: { channel: string }) {
|
|
26
|
+
const variant = channelTones.get(channel) ?? "neutral";
|
|
27
|
+
return (
|
|
28
|
+
<Badge
|
|
29
|
+
variant={variant}
|
|
30
|
+
title={channel}
|
|
31
|
+
className="max-w-full min-w-0 shrink"
|
|
32
|
+
>
|
|
33
|
+
<GitBranch aria-hidden="true" className="shrink-0" />
|
|
34
|
+
<span className="truncate">{channel}</span>
|
|
35
|
+
</Badge>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function ReleaseStatusBadge({
|
|
40
|
+
release,
|
|
41
|
+
}: {
|
|
42
|
+
release: Pick<UpdateItem, "status" | "policyEditable">;
|
|
43
|
+
}) {
|
|
44
|
+
const { t } = useI18n();
|
|
45
|
+
const state = release.policyEditable ? "draft" : release.status;
|
|
46
|
+
const Icon =
|
|
47
|
+
state === "draft" ? Pencil : state === "active" ? Check : CircleOff;
|
|
48
|
+
return (
|
|
49
|
+
<Badge
|
|
50
|
+
variant={
|
|
51
|
+
state === "draft"
|
|
52
|
+
? "warning"
|
|
53
|
+
: state === "active"
|
|
54
|
+
? "positive"
|
|
55
|
+
: "neutral"
|
|
56
|
+
}
|
|
57
|
+
>
|
|
58
|
+
<Icon aria-hidden="true" />
|
|
59
|
+
{t(state)}
|
|
60
|
+
</Badge>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function AudienceBadge({
|
|
65
|
+
mode,
|
|
66
|
+
compact = false,
|
|
67
|
+
}: {
|
|
68
|
+
mode: UpdateItem["audienceMode"];
|
|
69
|
+
compact?: boolean;
|
|
70
|
+
}) {
|
|
71
|
+
const { t } = useI18n();
|
|
72
|
+
return (
|
|
73
|
+
<Badge
|
|
74
|
+
variant={mode === "devices" ? "violet" : "teal"}
|
|
75
|
+
className="max-w-full whitespace-normal text-left"
|
|
76
|
+
>
|
|
77
|
+
{mode === "devices"
|
|
78
|
+
? t("Выбранные устройства")
|
|
79
|
+
: compact
|
|
80
|
+
? t("All devices")
|
|
81
|
+
: t("Все совместимые устройства")}
|
|
82
|
+
</Badge>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function DeliveryBadge({ mode }: { mode: UpdateItem["deliveryMode"] }) {
|
|
87
|
+
const { t } = useI18n();
|
|
88
|
+
if (mode === "manual-postpone")
|
|
89
|
+
return <Badge variant="teal">{t("Download on postpone")}</Badge>;
|
|
90
|
+
return (
|
|
91
|
+
<Badge variant={mode === "background" ? "info" : "neutral"}>
|
|
92
|
+
{mode === "background" ? t("Background") : t("Manual")}
|
|
93
|
+
</Badge>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const launchKindTone = {
|
|
98
|
+
ota: "info",
|
|
99
|
+
embedded: "teal",
|
|
100
|
+
unknown: "warning",
|
|
101
|
+
} as const satisfies Record<DeviceLaunchKind, string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { statusTones } from "./status-tones";
|
|
3
4
|
import { cn } from "@/lib/utils";
|
|
4
5
|
|
|
5
6
|
const alertVariants = cva(
|
|
@@ -8,8 +9,14 @@ const alertVariants = cva(
|
|
|
8
9
|
variants: {
|
|
9
10
|
variant: {
|
|
10
11
|
default: "bg-card text-card-foreground",
|
|
11
|
-
destructive:
|
|
12
|
-
|
|
12
|
+
destructive: [
|
|
13
|
+
statusTones.destructive,
|
|
14
|
+
"*:data-[slot=alert-description]:text-current",
|
|
15
|
+
],
|
|
16
|
+
warning: [
|
|
17
|
+
statusTones.warning,
|
|
18
|
+
"*:data-[slot=alert-description]:text-current",
|
|
19
|
+
],
|
|
13
20
|
},
|
|
14
21
|
},
|
|
15
22
|
defaultVariants: {
|
|
@@ -38,7 +45,7 @@ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
38
45
|
<div
|
|
39
46
|
data-slot="alert-title"
|
|
40
47
|
className={cn(
|
|
41
|
-
"col-start-2
|
|
48
|
+
"col-start-2 min-h-4 font-medium tracking-tight",
|
|
42
49
|
className,
|
|
43
50
|
)}
|
|
44
51
|
{...props}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { Avatar as AvatarPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
function Avatar({
|
|
8
|
+
className,
|
|
9
|
+
size = "default",
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Root> & {
|
|
12
|
+
size?: "default" | "sm" | "lg";
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<AvatarPrimitive.Root
|
|
16
|
+
data-slot="avatar"
|
|
17
|
+
data-size={size}
|
|
18
|
+
className={cn(
|
|
19
|
+
"group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function AvatarImage({
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
31
|
+
return (
|
|
32
|
+
<AvatarPrimitive.Image
|
|
33
|
+
data-slot="avatar-image"
|
|
34
|
+
className={cn("aspect-square size-full", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function AvatarFallback({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
44
|
+
return (
|
|
45
|
+
<AvatarPrimitive.Fallback
|
|
46
|
+
data-slot="avatar-fallback"
|
|
47
|
+
className={cn(
|
|
48
|
+
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
|
|
49
|
+
className,
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
|
|
57
|
+
return (
|
|
58
|
+
<span
|
|
59
|
+
data-slot="avatar-badge"
|
|
60
|
+
className={cn(
|
|
61
|
+
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none",
|
|
62
|
+
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
|
|
63
|
+
"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
|
|
64
|
+
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="avatar-group"
|
|
76
|
+
className={cn(
|
|
77
|
+
"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
|
|
78
|
+
className,
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function AvatarGroupCount({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<"div">) {
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
data-slot="avatar-group-count"
|
|
92
|
+
className={cn(
|
|
93
|
+
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
|
|
94
|
+
className,
|
|
95
|
+
)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
Avatar,
|
|
103
|
+
AvatarImage,
|
|
104
|
+
AvatarFallback,
|
|
105
|
+
AvatarBadge,
|
|
106
|
+
AvatarGroup,
|
|
107
|
+
AvatarGroupCount,
|
|
108
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
3
|
import { cn } from "@/lib/utils";
|
|
4
|
+
import { statusTones } from "./status-tones";
|
|
4
5
|
import { Slot } from "radix-ui";
|
|
5
6
|
|
|
6
7
|
const badgeVariants = cva(
|
|
@@ -11,8 +12,7 @@ const badgeVariants = cva(
|
|
|
11
12
|
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
12
13
|
secondary:
|
|
13
14
|
"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
14
|
-
|
|
15
|
-
"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
|
|
15
|
+
...statusTones,
|
|
16
16
|
outline:
|
|
17
17
|
"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
18
18
|
ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
|
+
|
|
6
|
+
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
|
|
7
|
+
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
11
|
+
return (
|
|
12
|
+
<ol
|
|
13
|
+
data-slot="breadcrumb-list"
|
|
14
|
+
className={cn(
|
|
15
|
+
"flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5",
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
24
|
+
return (
|
|
25
|
+
<li
|
|
26
|
+
data-slot="breadcrumb-item"
|
|
27
|
+
className={cn("inline-flex items-center gap-1.5", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function BreadcrumbLink({
|
|
34
|
+
asChild,
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<"a"> & {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
}) {
|
|
40
|
+
const Comp = asChild ? Slot.Root : "a";
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Comp
|
|
44
|
+
data-slot="breadcrumb-link"
|
|
45
|
+
className={cn("transition-colors hover:text-foreground", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
52
|
+
return (
|
|
53
|
+
<span
|
|
54
|
+
data-slot="breadcrumb-page"
|
|
55
|
+
role="link"
|
|
56
|
+
aria-disabled="true"
|
|
57
|
+
aria-current="page"
|
|
58
|
+
className={cn("font-normal text-foreground", className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function BreadcrumbSeparator({
|
|
65
|
+
children,
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<"li">) {
|
|
69
|
+
return (
|
|
70
|
+
<li
|
|
71
|
+
data-slot="breadcrumb-separator"
|
|
72
|
+
role="presentation"
|
|
73
|
+
aria-hidden="true"
|
|
74
|
+
className={cn("[&>svg]:size-3.5", className)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
{children ?? <ChevronRight />}
|
|
78
|
+
</li>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function BreadcrumbEllipsis({
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}: React.ComponentProps<"span">) {
|
|
86
|
+
return (
|
|
87
|
+
<span
|
|
88
|
+
data-slot="breadcrumb-ellipsis"
|
|
89
|
+
role="presentation"
|
|
90
|
+
aria-hidden="true"
|
|
91
|
+
className={cn("flex size-9 items-center justify-center", className)}
|
|
92
|
+
{...props}
|
|
93
|
+
>
|
|
94
|
+
<MoreHorizontal className="size-4" />
|
|
95
|
+
<span className="sr-only">More</span>
|
|
96
|
+
</span>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
Breadcrumb,
|
|
102
|
+
BreadcrumbList,
|
|
103
|
+
BreadcrumbItem,
|
|
104
|
+
BreadcrumbLink,
|
|
105
|
+
BreadcrumbPage,
|
|
106
|
+
BreadcrumbSeparator,
|
|
107
|
+
BreadcrumbEllipsis,
|
|
108
|
+
};
|
|
@@ -4,17 +4,17 @@ import { cn } from "@/lib/utils";
|
|
|
4
4
|
import { Slot } from "radix-ui";
|
|
5
5
|
|
|
6
6
|
const buttonVariants = cva(
|
|
7
|
-
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-
|
|
7
|
+
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,border-color,box-shadow,color] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/
|
|
11
|
+
default: "bg-primary text-primary-foreground border border-transparent hover:bg-primary/85",
|
|
12
12
|
destructive:
|
|
13
|
-
"bg-destructive text-white hover:bg-destructive
|
|
13
|
+
"border border-transparent bg-destructive-button text-white hover:bg-destructive-hover focus-visible:ring-destructive/50",
|
|
14
14
|
outline:
|
|
15
|
-
"border
|
|
15
|
+
"border border-input bg-card text-foreground hover:border-muted-foreground hover:bg-accent",
|
|
16
16
|
secondary:
|
|
17
|
-
"bg-secondary text-secondary-foreground hover:bg-
|
|
17
|
+
"border border-border bg-secondary text-secondary-foreground hover:border-input hover:bg-accent",
|
|
18
18
|
ghost:
|
|
19
19
|
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
20
20
|
link: "text-primary underline-offset-4 hover:underline",
|
|
@@ -6,7 +6,7 @@ function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
6
6
|
<div
|
|
7
7
|
data-slot="card"
|
|
8
8
|
className={cn(
|
|
9
|
-
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground
|
|
9
|
+
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground",
|
|
10
10
|
className,
|
|
11
11
|
)}
|
|
12
12
|
{...props}
|
|
@@ -31,7 +31,7 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
31
31
|
return (
|
|
32
32
|
<div
|
|
33
33
|
data-slot="card-title"
|
|
34
|
-
className={cn("leading-
|
|
34
|
+
className={cn("leading-tight font-semibold tracking-tight", className)}
|
|
35
35
|
{...props}
|
|
36
36
|
/>
|
|
37
37
|
);
|
|
@@ -190,7 +190,7 @@ function ChartTooltipContent({
|
|
|
190
190
|
return (
|
|
191
191
|
<div
|
|
192
192
|
className={cn(
|
|
193
|
-
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border
|
|
193
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border bg-popover px-2.5 py-1.5 text-xs shadow-xl",
|
|
194
194
|
className,
|
|
195
195
|
)}
|
|
196
196
|
>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
function Empty({ className, ...props }: React.ComponentProps<"div">) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
data-slot="empty"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
data-slot="empty-header"
|
|
21
|
+
className={cn(
|
|
22
|
+
"flex max-w-sm flex-col items-center gap-2 text-center",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const emptyMediaVariants = cva(
|
|
31
|
+
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
32
|
+
{
|
|
33
|
+
variants: {
|
|
34
|
+
variant: {
|
|
35
|
+
default: "bg-transparent",
|
|
36
|
+
icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
function EmptyMedia({
|
|
46
|
+
className,
|
|
47
|
+
variant = "default",
|
|
48
|
+
...props
|
|
49
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-slot="empty-icon"
|
|
53
|
+
data-variant={variant}
|
|
54
|
+
className={cn(emptyMediaVariants({ variant, className }))}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
data-slot="empty-title"
|
|
64
|
+
className={cn("text-lg font-medium tracking-tight", className)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
data-slot="empty-description"
|
|
74
|
+
className={cn(
|
|
75
|
+
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
76
|
+
className,
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
data-slot="empty-content"
|
|
87
|
+
className={cn(
|
|
88
|
+
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
|
|
89
|
+
className,
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
Empty,
|
|
98
|
+
EmptyHeader,
|
|
99
|
+
EmptyTitle,
|
|
100
|
+
EmptyDescription,
|
|
101
|
+
EmptyContent,
|
|
102
|
+
EmptyMedia,
|
|
103
|
+
};
|