kira-kit 0.4.0 → 0.5.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 +273 -176
- package/dist/index.mjs +4763 -1284
- package/package.json +71 -64
- package/templates/monorepo/components.json +23 -23
- package/templates/monorepo/packages/ui/package.json +37 -32
- package/templates/monorepo/packages/ui/src/components/ui/welcome.tsx +52 -52
- package/templates/monorepo/packages/ui/src/index.css +738 -89
- package/templates/monorepo/packages/ui/src/styles/kira-utilities.css +649 -0
- package/templates/monorepo/packages/ui/tsconfig.json +8 -7
- package/templates/next/app/globals.css +731 -83
- package/templates/next/app/kira-utilities.css +649 -0
- package/templates/next/components/ui/welcome.tsx +62 -62
- package/templates/next/components.json +23 -23
- package/templates/next/package.json +31 -28
- package/templates/next/types/import-meta.d.ts +11 -0
- package/templates/tanstack-start/README.md +16 -16
- package/templates/tanstack-start/components.json +23 -23
- package/templates/tanstack-start/package.json +33 -30
- package/templates/tanstack-start/src/components/ui/route-transition.tsx +116 -0
- package/templates/tanstack-start/src/components/ui/welcome.tsx +52 -52
- package/templates/tanstack-start/src/index.css +738 -89
- package/templates/tanstack-start/src/lib/view-transition.ts +35 -0
- package/templates/tanstack-start/src/router.tsx +23 -15
- package/templates/tanstack-start/src/routes/__root.tsx +70 -41
- package/templates/tanstack-start/src/styles/kira-utilities.css +649 -0
- package/templates/tanstack-start/tsconfig.json +22 -21
- package/templates/vite/components.json +23 -23
- package/templates/vite/package.json +31 -28
- package/templates/vite/src/components/ui/welcome.tsx +60 -60
- package/templates/vite/src/index.css +731 -83
- package/templates/vite/src/styles/kira-utilities.css +649 -0
- package/templates/vite/tsconfig.node.json +25 -22
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { ComponentPropsWithoutRef } from "react";
|
|
4
|
-
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
5
|
-
import { IconSparkles } from "@tabler/icons-react";
|
|
6
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
7
|
-
import { cn } from "
|
|
8
|
-
|
|
9
|
-
export const welcomeVariants = cva(
|
|
10
|
-
"w-full max-w-lg rounded-xl border bg-card p-8 text-card-foreground shadow-sm",
|
|
11
|
-
{
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
default: "border-border",
|
|
15
|
-
accent: "border-primary/20 bg-primary/5",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
variant: "default",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
type WelcomeProps = ComponentPropsWithoutRef<"section"> &
|
|
25
|
-
VariantProps<typeof welcomeVariants>;
|
|
26
|
-
|
|
27
|
-
export function Welcome({ className, variant, ...props }: WelcomeProps) {
|
|
28
|
-
return (
|
|
29
|
-
<section
|
|
30
|
-
data-slot="welcome"
|
|
31
|
-
className={cn(welcomeVariants({ variant }), className)}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
<div className="flex items-start gap-4">
|
|
35
|
-
<IconSparkles
|
|
36
|
-
aria-hidden="true"
|
|
37
|
-
className="size-10 shrink-0 rounded-lg bg-primary p-2 text-primary-foreground"
|
|
38
|
-
/>
|
|
39
|
-
<div className="space-y-2">
|
|
40
|
-
<h1 className="text-2xl font-semibold tracking-tight">
|
|
41
|
-
Kira Kit is ready
|
|
42
|
-
</h1>
|
|
43
|
-
<p className="text-sm leading-6 text-muted-foreground">
|
|
44
|
-
Your project is configured for Base UI, Tailwind CSS, and the Kira
|
|
45
|
-
Kit registry.
|
|
46
|
-
</p>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
<div className="mt-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
|
50
|
-
<code className="rounded-md bg-muted px-3 py-2 text-xs sm:text-sm">
|
|
51
|
-
|
|
52
|
-
</code>
|
|
53
|
-
<ButtonPrimitive
|
|
54
|
-
type="button"
|
|
55
|
-
className="inline-flex h-9 shrink-0 items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
56
|
-
>
|
|
57
|
-
Start building
|
|
58
|
-
</ButtonPrimitive>
|
|
59
|
-
</div>
|
|
60
|
-
</section>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
4
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
5
|
+
import { IconSparkles } from "@tabler/icons-react";
|
|
6
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
7
|
+
import { cn } from "cn";
|
|
8
|
+
|
|
9
|
+
export const welcomeVariants = cva(
|
|
10
|
+
"w-full max-w-lg rounded-xl border bg-card p-8 text-card-foreground shadow-sm",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: "border-border",
|
|
15
|
+
accent: "border-primary/20 bg-primary/5",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
type WelcomeProps = ComponentPropsWithoutRef<"section"> &
|
|
25
|
+
VariantProps<typeof welcomeVariants>;
|
|
26
|
+
|
|
27
|
+
export function Welcome({ className, variant, ...props }: WelcomeProps) {
|
|
28
|
+
return (
|
|
29
|
+
<section
|
|
30
|
+
data-slot="welcome"
|
|
31
|
+
className={cn(welcomeVariants({ variant }), className)}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
<div className="flex items-start gap-4">
|
|
35
|
+
<IconSparkles
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
className="size-10 shrink-0 rounded-lg bg-primary p-2 text-primary-foreground"
|
|
38
|
+
/>
|
|
39
|
+
<div className="space-y-2">
|
|
40
|
+
<h1 className="text-2xl font-semibold tracking-tight">
|
|
41
|
+
Kira Kit is ready
|
|
42
|
+
</h1>
|
|
43
|
+
<p className="text-sm leading-6 text-muted-foreground">
|
|
44
|
+
Your project is configured for Base UI, Tailwind CSS, and the Kira
|
|
45
|
+
Kit registry.
|
|
46
|
+
</p>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div className="mt-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
|
50
|
+
<code className="rounded-md bg-muted px-3 py-2 text-xs sm:text-sm">
|
|
51
|
+
kira-kit add @kira-kit/button
|
|
52
|
+
</code>
|
|
53
|
+
<ButtonPrimitive
|
|
54
|
+
type="button"
|
|
55
|
+
className="inline-flex h-9 shrink-0 items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
56
|
+
>
|
|
57
|
+
Start building
|
|
58
|
+
</ButtonPrimitive>
|
|
59
|
+
</div>
|
|
60
|
+
</section>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://
|
|
3
|
-
"style": "
|
|
4
|
-
"rsc": true,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "app/globals.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
11
|
-
},
|
|
12
|
-
"aliases": {
|
|
13
|
-
"components": "@/components",
|
|
14
|
-
"utils": "@/lib/utils",
|
|
15
|
-
"ui": "@/components/ui",
|
|
16
|
-
"lib": "@/lib",
|
|
17
|
-
"hooks": "@/hooks"
|
|
18
|
-
},
|
|
19
|
-
"iconLibrary": "tabler",
|
|
20
|
-
"registries": {
|
|
21
|
-
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kira-kit.vercel.app/schema/components.json",
|
|
3
|
+
"style": "kira",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "app/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true
|
|
11
|
+
},
|
|
12
|
+
"aliases": {
|
|
13
|
+
"components": "@/components",
|
|
14
|
+
"utils": "@/lib/utils",
|
|
15
|
+
"ui": "@/components/ui",
|
|
16
|
+
"lib": "@/lib",
|
|
17
|
+
"hooks": "@/hooks"
|
|
18
|
+
},
|
|
19
|
+
"iconLibrary": "tabler",
|
|
20
|
+
"registries": {
|
|
21
|
+
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "kira-next-app",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "next dev",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@base-ui/react": "^1.9.0",
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "kira-next-app",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@base-ui/react": "^1.9.0",
|
|
12
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
13
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
14
|
+
"@tabler/icons-react": "^3.49.0",
|
|
15
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
16
|
+
"class-variance-authority": "^0.7.1",
|
|
17
|
+
"cn": "^0.5.2",
|
|
18
|
+
"next": "^15.5.0",
|
|
19
|
+
"react": "^19.3.1",
|
|
20
|
+
"react-dom": "^19.3.1",
|
|
21
|
+
"tailwindcss": "^4.3.3",
|
|
22
|
+
"tw-animate-css": "^1.4.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.0.0",
|
|
26
|
+
"@types/react": "^19.3.0",
|
|
27
|
+
"@types/react-dom": "^19.3.0",
|
|
28
|
+
"postcss": "^8.5.6",
|
|
29
|
+
"typescript": "~5.9.3"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Kira Kit components read import.meta.env.DEV for development-only checks.
|
|
2
|
+
// Next.js does not ship Vite's ambient types, so declare the shape here.
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly DEV?: boolean;
|
|
5
|
+
readonly PROD?: boolean;
|
|
6
|
+
readonly MODE?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface ImportMeta {
|
|
10
|
+
readonly env: ImportMetaEnv;
|
|
11
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Kira Kit + TanStack Start
|
|
2
|
-
|
|
3
|
-
## Getting started
|
|
4
|
-
|
|
5
|
-
```sh
|
|
6
|
-
npm install
|
|
7
|
-
npm run dev
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
`vite dev` generates `src/routeTree.gen.ts` automatically. Do not create or edit that file manually; run the dev server before `npm run typecheck`.
|
|
11
|
-
|
|
12
|
-
Add Kira Kit components from the project root:
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
|
|
16
|
-
```
|
|
1
|
+
# Kira Kit + TanStack Start
|
|
2
|
+
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install
|
|
7
|
+
npm run dev
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`vite dev` generates `src/routeTree.gen.ts` automatically. Do not create or edit that file manually; run the dev server before `npm run typecheck`.
|
|
11
|
+
|
|
12
|
+
Add Kira Kit components from the project root:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
kira-kit add @kira-kit/button
|
|
16
|
+
```
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://
|
|
3
|
-
"style": "
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "src/index.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
11
|
-
},
|
|
12
|
-
"iconLibrary": "tabler",
|
|
13
|
-
"aliases": {
|
|
14
|
-
"components": "@/components",
|
|
15
|
-
"utils": "@/lib/utils",
|
|
16
|
-
"ui": "@/components/ui",
|
|
17
|
-
"lib": "@/lib",
|
|
18
|
-
"hooks": "@/hooks"
|
|
19
|
-
},
|
|
20
|
-
"registries": {
|
|
21
|
-
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kira-kit.vercel.app/schema/components.json",
|
|
3
|
+
"style": "kira",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/index.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true
|
|
11
|
+
},
|
|
12
|
+
"iconLibrary": "tabler",
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"ui": "@/components/ui",
|
|
17
|
+
"lib": "@/lib",
|
|
18
|
+
"hooks": "@/hooks"
|
|
19
|
+
},
|
|
20
|
+
"registries": {
|
|
21
|
+
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "kira-kit-tanstack-start",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite dev",
|
|
7
|
-
"build": "vite build",
|
|
8
|
-
"typecheck": "tsc --noEmit"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@base-ui/react": "^1.9.0",
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "kira-kit-tanstack-start",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite dev",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"typecheck": "tsc --noEmit"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@base-ui/react": "^1.9.0",
|
|
12
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
13
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
14
|
+
"@tabler/icons-react": "^3.49.0",
|
|
15
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
16
|
+
"@tanstack/react-router": "^1.170.46",
|
|
17
|
+
"@tanstack/react-start": "^1.169.5",
|
|
18
|
+
"class-variance-authority": "^0.7.1",
|
|
19
|
+
"cn": "^0.5.2",
|
|
20
|
+
"react": "^19.3.1",
|
|
21
|
+
"react-dom": "^19.3.1",
|
|
22
|
+
"tailwindcss": "^4.3.3",
|
|
23
|
+
"tw-animate-css": "^1.4.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^26.6.5",
|
|
27
|
+
"@types/react": "^19.3.0",
|
|
28
|
+
"@types/react-dom": "^19.3.0",
|
|
29
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
30
|
+
"typescript": "~5.9.3",
|
|
31
|
+
"vite": "^8.3.5"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
|
|
5
|
+
const routeTransitionVariants = cva("", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
fade: "animate-route-fade motion-reduce:animate-none",
|
|
9
|
+
"fade-up": "animate-route-fade-up motion-reduce:animate-none",
|
|
10
|
+
"fade-down": "animate-route-fade-down motion-reduce:animate-none",
|
|
11
|
+
"slide-left": "animate-route-slide-left motion-reduce:animate-none",
|
|
12
|
+
"slide-right": "animate-route-slide-right motion-reduce:animate-none",
|
|
13
|
+
zoom: "animate-route-zoom motion-reduce:animate-none",
|
|
14
|
+
none: "",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { variant: "fade" },
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
interface RouteTransitionProps
|
|
21
|
+
extends
|
|
22
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
23
|
+
VariantProps<typeof routeTransitionVariants> {
|
|
24
|
+
/** Changing this key remounts the wrapper and replays the entrance, e.g. the router pathname. */
|
|
25
|
+
transitionKey?: React.Key;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function RouteTransition({
|
|
29
|
+
className,
|
|
30
|
+
variant,
|
|
31
|
+
transitionKey,
|
|
32
|
+
...props
|
|
33
|
+
}: RouteTransitionProps) {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
key={transitionKey}
|
|
37
|
+
data-slot="route-transition"
|
|
38
|
+
className={cn(routeTransitionVariants({ variant }), className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type NavigationProgressPhase = "idle" | "loading" | "finishing";
|
|
45
|
+
|
|
46
|
+
// Fast navigations never flash a bar; only loads that outlive the grace period show one.
|
|
47
|
+
const SHOW_DELAY_MS = 120;
|
|
48
|
+
const FINISH_DURATION_MS = 320;
|
|
49
|
+
|
|
50
|
+
interface NavigationProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
51
|
+
/** Whether a navigation is in flight. The bar completes and fades out when this flips back to false. */
|
|
52
|
+
active: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function NavigationProgress({
|
|
56
|
+
active,
|
|
57
|
+
className,
|
|
58
|
+
style,
|
|
59
|
+
...props
|
|
60
|
+
}: NavigationProgressProps) {
|
|
61
|
+
const [phase, setPhase] = React.useState<NavigationProgressPhase>("idle");
|
|
62
|
+
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
if (!active) {
|
|
65
|
+
// oxlint-disable-next-line react/set-state-in-effect -- the phase machine mirrors the active prop; one transition render per navigation, never per frame.
|
|
66
|
+
setPhase((current) => (current === "loading" ? "finishing" : current));
|
|
67
|
+
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const timer = setTimeout(() => setPhase("loading"), SHOW_DELAY_MS);
|
|
72
|
+
|
|
73
|
+
return () => clearTimeout(timer);
|
|
74
|
+
}, [active]);
|
|
75
|
+
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (phase !== "finishing") return;
|
|
78
|
+
|
|
79
|
+
const timer = setTimeout(() => setPhase("idle"), FINISH_DURATION_MS);
|
|
80
|
+
|
|
81
|
+
return () => clearTimeout(timer);
|
|
82
|
+
}, [phase]);
|
|
83
|
+
|
|
84
|
+
if (phase === "idle") return null;
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
data-slot="navigation-progress"
|
|
89
|
+
data-state={phase}
|
|
90
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a native <progress> cannot express the transform-driven trickle or its completion retarget.
|
|
91
|
+
role="progressbar"
|
|
92
|
+
aria-label="Loading page"
|
|
93
|
+
className={cn(
|
|
94
|
+
"pointer-events-none fixed inset-x-0 top-0 z-50 h-0.5 origin-left bg-primary drop-shadow-[0_0_6px_var(--primary)]",
|
|
95
|
+
phase === "loading" && "animate-nav-progress",
|
|
96
|
+
className,
|
|
97
|
+
)}
|
|
98
|
+
style={
|
|
99
|
+
phase === "finishing"
|
|
100
|
+
? {
|
|
101
|
+
// Retargets from the in-flight trickle value to full width, then fades.
|
|
102
|
+
animation: "none",
|
|
103
|
+
transform: "scaleX(1)",
|
|
104
|
+
opacity: 0,
|
|
105
|
+
transition:
|
|
106
|
+
"transform 150ms cubic-bezier(0.23, 1, 0.32, 1), opacity 150ms cubic-bezier(0.23, 1, 0.32, 1) 150ms",
|
|
107
|
+
...style,
|
|
108
|
+
}
|
|
109
|
+
: style
|
|
110
|
+
}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { RouteTransition, NavigationProgress, routeTransitionVariants };
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
3
|
-
import { IconSparkles } from "@tabler/icons-react";
|
|
4
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
-
import { cn } from "
|
|
6
|
-
|
|
7
|
-
const welcomeVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center gap-2 rounded-lg border text-sm font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default:
|
|
13
|
-
"border-transparent bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14
|
-
outline:
|
|
15
|
-
"border-border bg-background hover:bg-accent hover:text-accent-foreground",
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
sm: "h-8 px-3 text-xs",
|
|
19
|
-
default: "h-9 px-4",
|
|
20
|
-
lg: "h-10 px-5",
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
variant: "default",
|
|
25
|
-
size: "default",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
type WelcomeProps = Omit<React.ComponentPropsWithoutRef<"button">, "size"> &
|
|
31
|
-
VariantProps<typeof welcomeVariants>;
|
|
32
|
-
|
|
33
|
-
export function Welcome({
|
|
34
|
-
children = "Start building",
|
|
35
|
-
className,
|
|
36
|
-
variant,
|
|
37
|
-
size,
|
|
38
|
-
...props
|
|
39
|
-
}: WelcomeProps) {
|
|
40
|
-
return (
|
|
41
|
-
<ButtonPrimitive
|
|
42
|
-
data-slot="welcome"
|
|
43
|
-
className={cn(welcomeVariants({ variant, size }), className)}
|
|
44
|
-
{...props}
|
|
45
|
-
>
|
|
46
|
-
<IconSparkles aria-hidden="true" />
|
|
47
|
-
{children}
|
|
48
|
-
</ButtonPrimitive>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { welcomeVariants };
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
3
|
+
import { IconSparkles } from "@tabler/icons-react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
|
|
7
|
+
const welcomeVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 rounded-lg border text-sm font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default:
|
|
13
|
+
"border-transparent bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14
|
+
outline:
|
|
15
|
+
"border-border bg-background hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
sm: "h-8 px-3 text-xs",
|
|
19
|
+
default: "h-9 px-4",
|
|
20
|
+
lg: "h-10 px-5",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
size: "default",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
type WelcomeProps = Omit<React.ComponentPropsWithoutRef<"button">, "size"> &
|
|
31
|
+
VariantProps<typeof welcomeVariants>;
|
|
32
|
+
|
|
33
|
+
export function Welcome({
|
|
34
|
+
children = "Start building",
|
|
35
|
+
className,
|
|
36
|
+
variant,
|
|
37
|
+
size,
|
|
38
|
+
...props
|
|
39
|
+
}: WelcomeProps) {
|
|
40
|
+
return (
|
|
41
|
+
<ButtonPrimitive
|
|
42
|
+
data-slot="welcome"
|
|
43
|
+
className={cn(welcomeVariants({ variant, size }), className)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
<IconSparkles aria-hidden="true" />
|
|
47
|
+
{children}
|
|
48
|
+
</ButtonPrimitive>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { welcomeVariants };
|