@zaptek/application-livel 0.0.0-stage → 0.15.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/README.md +49 -2
  3. package/dist/client/livel-application-client.d.ts +32 -0
  4. package/dist/client/livel-application-client.js +71 -0
  5. package/dist/components/files/file-download-button.component.d.ts +7 -0
  6. package/dist/components/files/file-download-button.component.js +36 -0
  7. package/dist/components/files/file-upload-button.component.d.ts +11 -0
  8. package/dist/components/files/file-upload-button.component.js +41 -0
  9. package/dist/components/files/index.d.ts +4 -0
  10. package/dist/components/files/index.js +2 -0
  11. package/dist/components/index.d.ts +4 -0
  12. package/dist/components/index.js +3 -0
  13. package/dist/components/livel-application.provider.d.ts +20 -0
  14. package/dist/components/livel-application.provider.js +75 -0
  15. package/dist/components/livel-data-connection-status.component.d.ts +4 -0
  16. package/dist/components/livel-data-connection-status.component.js +122 -0
  17. package/dist/dev/dev-errors.contract.d.ts +23 -0
  18. package/dist/dev/dev-errors.contract.js +2 -0
  19. package/dist/hooks/files.hooks.d.ts +51 -0
  20. package/dist/hooks/files.hooks.js +296 -0
  21. package/dist/hooks/index.d.ts +6 -0
  22. package/dist/hooks/index.js +3 -0
  23. package/dist/hooks/rpc.hooks.d.ts +8 -0
  24. package/dist/hooks/rpc.hooks.js +26 -0
  25. package/dist/host/embedded-host.d.ts +8 -0
  26. package/dist/host/embedded-host.js +47 -0
  27. package/dist/host/livel-host.contract.d.ts +17 -0
  28. package/dist/host/livel-host.contract.js +1 -0
  29. package/dist/host/livel-host.d.ts +14 -0
  30. package/dist/host/livel-host.js +1 -0
  31. package/dist/index.d.ts +9 -0
  32. package/dist/index.js +4 -0
  33. package/dist/rpc/rpc-caller.d.ts +9 -0
  34. package/dist/rpc/rpc-caller.js +10 -0
  35. package/dist/vite/index.d.ts +1 -0
  36. package/dist/vite/index.js +1 -0
  37. package/dist/vite/livel-dev-errors.plugin.d.ts +13 -0
  38. package/dist/vite/livel-dev-errors.plugin.js +109 -0
  39. package/docs/README.md +24 -0
  40. package/docs/authentication.md +66 -0
  41. package/docs/data.md +134 -0
  42. package/docs/files.md +130 -0
  43. package/docs/getting-started.md +83 -0
  44. package/docs/rpc.md +49 -0
  45. package/docs/troubleshooting.md +15 -0
  46. package/package.json +66 -3
  47. package/template/.env.example +8 -0
  48. package/template/AGENTS.md +104 -0
  49. package/template/README.md +83 -0
  50. package/template/_gitignore +11 -0
  51. package/template/components.json +25 -0
  52. package/template/livel.json +14 -0
  53. package/template/package.json +48 -0
  54. package/template/pnpm-workspace.yaml +28 -0
  55. package/template/src/components/route-error.tsx +33 -0
  56. package/template/src/components/ui/button.tsx +57 -0
  57. package/template/src/components/ui/toast.tsx +221 -0
  58. package/template/src/lib/utils.ts +1 -0
  59. package/template/src/routeTree.gen.ts +68 -0
  60. package/template/src/router.tsx +19 -0
  61. package/template/src/routes/__root.tsx +53 -0
  62. package/template/src/routes/index.tsx +85 -0
  63. package/template/src/styles.css +148 -0
  64. package/template/tsconfig.json +21 -0
  65. package/template/vite.config.ts +28 -0
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "@zaptek/application-livel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.15.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/MattisJournet/zaptek.git",
10
+ "directory": "packages/application-livel"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "docs",
15
+ "template",
16
+ "README.md",
17
+ "CHANGELOG.md"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ },
24
+ "./hooks": {
25
+ "types": "./dist/hooks/index.d.ts",
26
+ "import": "./dist/hooks/index.js"
27
+ },
28
+ "./components": {
29
+ "types": "./dist/components/index.d.ts",
30
+ "import": "./dist/components/index.js"
31
+ },
32
+ "./vite": {
33
+ "types": "./dist/vite/index.d.ts",
34
+ "import": "./dist/vite/index.js"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "dependencies": {
42
+ "@orpc/client": "^1.16.2",
43
+ "@supabase/supabase-js": "^2.114.0",
44
+ "penpal": "^8.0.1",
45
+ "@zaptek/resource": "0.2.0"
46
+ },
47
+ "peerDependencies": {
48
+ "@tanstack/react-query": "^5.90.21",
49
+ "react": "^19.2.3",
50
+ "vite": "^8.0.14"
51
+ },
52
+ "devDependencies": {
53
+ "@tanstack/react-query": "^5.90.21",
54
+ "@types/node": "^22.9.0",
55
+ "@types/react": "^19.2.14",
56
+ "react": "^19.2.3",
57
+ "typescript": "^5.7.2",
58
+ "vite": "^8.0.14"
59
+ },
60
+ "peerDependenciesMeta": {
61
+ "vite": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "scripts": {
66
+ "build": "tsc --project tsconfig.json",
67
+ "dev": "tsc --watch --project tsconfig.json"
68
+ }
6
69
  }
@@ -0,0 +1,8 @@
1
+ # Livel fournit ces valeurs publiques au serveur de développement.
2
+ # Pour tester l'auth dans une iframe locale, renseigner les mêmes valeurs dans .env.local.
3
+ VITE_LIVEL_PLATFORM_ORIGIN=https://livel.example.com
4
+ VITE_LIVEL_WORKSPACE_ID=00000000-0000-0000-0000-000000000000
5
+ VITE_SUPABASE_URL=https://example.supabase.co
6
+ VITE_SUPABASE_PUBLISHABLE_KEY=...
7
+
8
+ # Le token utilisateur est transmis par l'iframe, jamais par une variable d'environnement.
@@ -0,0 +1,104 @@
1
+ # Livel Application
2
+
3
+ This Git repository contains the interface and the durable code of a Livel application;
4
+ business data remains managed by the platform at the workspace level.
5
+
6
+ ## Stack
7
+
8
+ - TanStack Start in SPA mode
9
+ - React 19 and strict TypeScript
10
+ - Tailwind CSS 4
11
+ - shadcn/ui with Base UI and the Nova preset
12
+ - Node.js 24 and pnpm 10.34.0
13
+
14
+ ## Code quality
15
+
16
+ - Keep the final system as simple as possible to understand, change and
17
+ verify. Simplicity is measured neither by the minimum number of lines nor by
18
+ the speed of a workaround; do not sacrifice validation or security.
19
+ - Before adding code, look for the existing equivalent and reuse or
20
+ adapt it. A given business rule, query, validation or transformation must
21
+ have a single implementation; do not copy it into several screens.
22
+ - Extract a component, hook or utility when it carries a clear
23
+ responsibility or genuinely shared behavior. Do not create simple-delegation
24
+ wrappers, generic layers or dependencies for hypothetical
25
+ needs. Two pieces that look alike but change for
26
+ different reasons do not justify a common abstraction.
27
+ - Keep components focused on display. Use the SDK's public hooks
28
+ when it covers the resource; this application's own hooks
29
+ live in `*.hooks.ts`.
30
+ Keep reusable computations in pure functions.
31
+ Use explicit names and derive types from the existing contracts.
32
+ Do not copy TanStack Query data into a second React state.
33
+ - When replacing something, update all affected usages and remove
34
+ the old code, imports and branches that have become useless. Do not keep
35
+ a compatibility layer or refactor unrelated features.
36
+ - Before finishing, reread the diff: each new file and abstraction
37
+ must have a concrete purpose; no duplication or masked error.
38
+
39
+ ## Rules
40
+
41
+ - Build simple, accessible screens that are usable on mobile.
42
+ - Write the interface text in French. In it, talk about the user's business
43
+ and data, not technical providers. Use a welcoming tone and the formal
44
+ « vous », including for loading states and errors.
45
+ - Organize new pages under `src/routes/` and reusable code under
46
+ `src/components/` or `src/lib/`.
47
+ - Reuse the primitives present in `src/components/ui`. Read their
48
+ documentation with `pnpm ui:docs <component>` and add a primitive with
49
+ `pnpm ui:add <component>`.
50
+ - Keep Shadcn primitives in `src/components/ui` and business components
51
+ in `src/components`. Use the semantic tokens of `src/styles.css`
52
+ rather than a second color system.
53
+ - Do not copy a primitive from the Shadcn registry: add it through the
54
+ application's scripts, then adapt that code if needed. Do not modify
55
+ `components.json` without an explicit request concerning the design system.
56
+ - Do not use `pnpm dlx shadcn@latest`: the application's CLI is pinned.
57
+ - Never store a secret, token or customer data in the repository.
58
+ - Display the loading, error and empty-result states of the data
59
+ the application will use. Do not display SQL errors directly to
60
+ users.
61
+ - Notifications use the shadcn/Base UI Toast component: import
62
+ `toast` from `@/components/ui/toast` and call `toast.add({ type, title,
63
+ description })` in the hooks' callbacks. The `Toaster` is mounted
64
+ once in `src/routes/__root.tsx`. Do not add another toast
65
+ library.
66
+ - Keep business types and validations specific to the application. Do not copy the
67
+ platform's full schema or depend on its internal code.
68
+ - For any capability of the `@zaptek/application-livel` SDK, first read the
69
+ documentation of the installed version in
70
+ `node_modules/@zaptek/application-livel/docs/README.md`. Read its
71
+ `CHANGELOG.md` when updating. Import only its public exports;
72
+ do not copy its implementation into the application.
73
+ - The SDK's provider is already mounted in the root route; do not create another
74
+ Supabase client or `QueryClientProvider` for Livel data.
75
+ - The workspace's data is its objects. Their tables are declared in
76
+ `src/livel-objects.gen.ts`, generated by Livel: do not modify it or declare
77
+ data types by hand. After the objects change, Livel
78
+ regenerates the file; run the build and fix each type error.
79
+ - Read and write an object's records with a resource declared once,
80
+ in `src/lib/resources/<object>.resource.ts`, with `defineResource` from
81
+ `@zaptek/resource` on the generated table: relations (a `<field>_id` column),
82
+ filters (`eqFilter`, `inFilter`, `searchFilter`…) and sort. Components
83
+ call its hooks (`useList`, `useInfiniteList`, `useCount`,
84
+ `useAggregate`, `useDetail`, `useCreate`, `useUpdate`, `useDelete`); do not
85
+ write a Supabase query by hand for this data. Read the documentation
86
+ `node_modules/@zaptek/application-livel/docs/data.md`.
87
+ - Filter, sort, paginate and aggregate in the database with the resource rather than
88
+ loading the whole table to compute on the client. Read linked records with
89
+ the resource's relations (`useList(filters, ["policyholder"])`), never with
90
+ one query per row.
91
+ - The labels of objects, of their fields and of their choices come from
92
+ `<object>_labels` in `src/livel-objects.gen.ts` (`health_contract_labels
93
+ .choices.status[contract.status]`); do not write a label table by
94
+ hand.
95
+ - An amount is in cents (`<field>_cents` column): display it in euros
96
+ and write it in cents. A new record states its owning group
97
+ (`owner_workspace_group_id`); its owner is the signed-in member.
98
+ - A date-time is written in UTC (`new Date().toISOString()`); the database rejects
99
+ any other offset.
100
+ - A date without a time (`"2025-06-12"`) is a calendar date: do not
101
+ pass it to `new Date(...)`, which reads it at midnight UTC and can display the previous day.
102
+ Compare it as an ISO string and format it from its components.
103
+ - Do not modify `src/routeTree.gen.ts` by hand: TanStack generates it.
104
+ - Keep the SPA mode and the `livel.json` contract unless explicitly requested.
@@ -0,0 +1,83 @@
1
+ # Livel Application
2
+
3
+ Standalone React application, built with TanStack Start in SPA mode. This
4
+ repository contains the interface and its code. The `@zaptek/application-livel` SDK
5
+ receives Livel's token in the iframe; its provider is already mounted in the
6
+ root route.
7
+
8
+ ## Livel SDK
9
+
10
+ First read the
11
+ [documentation of the installed version](node_modules/@zaptek/application-livel/docs/README.md);
12
+ it defines the public API. The SDK provides:
13
+
14
+ - the iframe authentication and the Supabase client under the permissions of the
15
+ signed-in member;
16
+ - the hooks for reading tables and entries, as well as the mutations of
17
+ entries;
18
+ - an authenticated RPC client, and hooks and components for files.
19
+
20
+ The [Authentication](node_modules/@zaptek/application-livel/docs/authentication.md),
21
+ [Data](node_modules/@zaptek/application-livel/docs/data.md),
22
+ [RPC](node_modules/@zaptek/application-livel/docs/rpc.md) and
23
+ [Files](node_modules/@zaptek/application-livel/docs/files.md) guides contain
24
+ their contracts and examples. Read the
25
+ [changelog](node_modules/@zaptek/application-livel/CHANGELOG.md) before updating
26
+ the package.
27
+
28
+ ## Development
29
+
30
+ From the root of this repository:
31
+
32
+ ```bash
33
+ pnpm install
34
+ pnpm dev
35
+ ```
36
+
37
+ `pnpm dev` keeps the server in the foreground until it is stopped in the terminal.
38
+ The port stays fixed (`strictPort`) so that a conflict is an error.
39
+
40
+ In Livel's sandbox, the platform runs `pnpm dev` itself and supervises
41
+ the process: it restarts it when the application is redeveloped, and displays
42
+ its output and the application's preview. Do not start a second server or
43
+ improvise a detached launch. Ordinary interface changes
44
+ use hot reloading.
45
+
46
+ A server that responds only confirms that the application is reachable. It
47
+ validates neither the build nor data access, does not publish the application and does not create
48
+ a private preview link.
49
+
50
+ The public values used by the SDK are listed in `.env.example`.
51
+ Livel provides them during development in its sandbox. Outside the Livel
52
+ iframe, the interface can be worked on locally but the data hooks
53
+ remain unavailable: no user access token is present.
54
+
55
+ The interface code lives under `src/`. TanStack Start automatically generates
56
+ `src/routeTree.gen.ts` from the files placed in `src/routes/`.
57
+ The home page displays the SDK's `LivelDataConnectionStatus`: its state changes to
58
+ "Données connectées" after a successful read of the workspace's tables in
59
+ the Livel iframe. An empty list is still a successful response. It also shows
60
+ "API connectée" after the identity is verified with Livel.
61
+
62
+ ## Interface
63
+
64
+ The application uses shadcn/ui on Base UI. The installed primitives live
65
+ in `src/components/ui` and remain fully modifiable in the application.
66
+
67
+ ```bash
68
+ pnpm ui:docs dialog
69
+ pnpm ui:add dialog
70
+ pnpm ui:info
71
+ ```
72
+
73
+ Notifications use the Toast component in
74
+ `src/components/ui/toast.tsx`, with a single `Toaster` mounted in the root route.
75
+
76
+ ## Verification
77
+
78
+ ```bash
79
+ pnpm build
80
+ ```
81
+
82
+ This command checks the build and the types. It does not check the
83
+ preview in Livel or data access.
@@ -0,0 +1,11 @@
1
+ node_modules/
2
+ .output/
3
+ .tanstack/
4
+ .vercel/
5
+ dist/
6
+ *.local
7
+ .env
8
+ .env.*
9
+ !.env.example
10
+ *.tsbuildinfo
11
+ .DS_Store
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "base-nova",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/styles.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "rtl": false,
15
+ "aliases": {
16
+ "components": "@/components",
17
+ "utils": "@/lib/utils",
18
+ "ui": "@/components/ui",
19
+ "lib": "@/lib",
20
+ "hooks": "@/hooks"
21
+ },
22
+ "menuColor": "default",
23
+ "menuAccent": "subtle",
24
+ "registries": {}
25
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "schema_version": 1,
3
+ "template": {
4
+ "id": "livel-application"
5
+ },
6
+ "application": {
7
+ "name": "Mon espace"
8
+ },
9
+ "ui": {
10
+ "framework": "tanstack-start",
11
+ "mode": "spa",
12
+ "source": "src"
13
+ }
14
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@livel/application-template",
3
+ "private": true,
4
+ "sideEffects": false,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite dev",
8
+ "build": "vite build && tsc --noEmit",
9
+ "preview": "vite preview",
10
+ "start": "node .output/server/index.mjs",
11
+ "ui:add": "shadcn add",
12
+ "ui:docs": "shadcn docs",
13
+ "ui:info": "shadcn info"
14
+ },
15
+ "engines": {
16
+ "node": "24.x"
17
+ },
18
+ "packageManager": "pnpm@10.34.0",
19
+ "dependencies": {
20
+ "@zaptek/application-livel": "0.15.0",
21
+ "@zaptek/resource": "0.2.0",
22
+ "@tanstack/react-query": "catalog:",
23
+ "zod": "catalog:",
24
+ "@base-ui/react": "catalog:",
25
+ "@fontsource-variable/geist": "catalog:",
26
+ "@tanstack/react-router": "catalog:",
27
+ "@tanstack/react-start": "catalog:",
28
+ "class-variance-authority": "catalog:",
29
+ "cn": "catalog:",
30
+ "lucide-react": "catalog:",
31
+ "react": "catalog:",
32
+ "react-dom": "catalog:",
33
+ "shadcn": "catalog:",
34
+ "tw-animate-css": "catalog:",
35
+ "drizzle-orm": "catalog:"
36
+ },
37
+ "devDependencies": {
38
+ "@tailwindcss/vite": "catalog:",
39
+ "@types/node": "catalog:",
40
+ "@types/react": "catalog:",
41
+ "@types/react-dom": "catalog:",
42
+ "@vitejs/plugin-react": "catalog:",
43
+ "nitro": "catalog:",
44
+ "tailwindcss": "catalog:",
45
+ "typescript": "catalog:",
46
+ "vite": "catalog:"
47
+ }
48
+ }
@@ -0,0 +1,28 @@
1
+ # Dependency versions for this standalone application.
2
+ packages:
3
+ - "."
4
+
5
+ catalog:
6
+ "@base-ui/react": "^1.8.0"
7
+ "@fontsource-variable/geist": "^5.3.0"
8
+ "@tailwindcss/vite": "^4.3.3"
9
+ "@tanstack/react-query": "^5.90.21"
10
+ "@tanstack/react-router": "1.170.41"
11
+ "@tanstack/react-start": "^1.168.60"
12
+ "@types/node": "^22.9.0"
13
+ "@types/react": "^19.2.14"
14
+ "@types/react-dom": "^19.2.3"
15
+ "@vitejs/plugin-react": "^6.0.1"
16
+ "class-variance-authority": "^0.7.1"
17
+ "cn": "^0.2.6"
18
+ "drizzle-orm": "^0.45.1"
19
+ "lucide-react": "^0.575.0"
20
+ "nitro": "^3.0.260311-beta"
21
+ "react": "^19.2.3"
22
+ "react-dom": "^19.2.3"
23
+ "shadcn": "^4.21.0"
24
+ "tailwindcss": "^4.3.3"
25
+ "tw-animate-css": "^1.2.4"
26
+ "typescript": "^5.7.2"
27
+ "vite": "^8.0.14"
28
+ "zod": "^4.1.12"
@@ -0,0 +1,33 @@
1
+ import { useEffect } from "react"
2
+ import { useReportError } from "@zaptek/application-livel/hooks"
3
+ import { type ErrorComponentProps, useRouter } from "@tanstack/react-router"
4
+
5
+ import { Button } from "@/components/ui/button"
6
+
7
+ /** Shown when a page fails; the error also appears in Livel, ready to fix. */
8
+ export function RouteError({ error, reset }: ErrorComponentProps) {
9
+ const router = useRouter()
10
+ const reportError = useReportError()
11
+
12
+ useEffect(() => reportError(error), [error, reportError])
13
+
14
+ return (
15
+ <main className='flex min-h-svh flex-col items-center justify-center gap-4 p-6 text-center'>
16
+ <div className='space-y-1'>
17
+ <h1 className='text-lg font-semibold'>Cette page a rencontré une erreur</h1>
18
+ <p className='text-muted-foreground text-sm'>
19
+ {error instanceof Error ? error.message : String(error)}
20
+ </p>
21
+ </div>
22
+ <Button
23
+ variant='outline'
24
+ onClick={() => {
25
+ reset()
26
+ void router.invalidate()
27
+ }}
28
+ >
29
+ Réessayer
30
+ </Button>
31
+ </main>
32
+ )
33
+ }
@@ -0,0 +1,57 @@
1
+ import { Button as ButtonPrimitive } from "@base-ui/react/button"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { cn } from "cn"
4
+
5
+ const buttonVariants = cva(
6
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
11
+ outline:
12
+ "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
13
+ secondary:
14
+ "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
15
+ ghost:
16
+ "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
17
+ destructive:
18
+ "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
19
+ link: "text-primary underline-offset-4 hover:underline",
20
+ },
21
+ size: {
22
+ default:
23
+ "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
24
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
25
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
26
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
27
+ icon: "size-8",
28
+ "icon-xs":
29
+ "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
30
+ "icon-sm":
31
+ "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
32
+ "icon-lg": "size-9",
33
+ },
34
+ },
35
+ defaultVariants: {
36
+ variant: "default",
37
+ size: "default",
38
+ },
39
+ }
40
+ )
41
+
42
+ function Button({
43
+ className,
44
+ variant = "default",
45
+ size = "default",
46
+ ...props
47
+ }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
48
+ return (
49
+ <ButtonPrimitive
50
+ data-slot='button'
51
+ className={cn(buttonVariants({ variant, size, className }))}
52
+ {...props}
53
+ />
54
+ )
55
+ }
56
+
57
+ export { Button, buttonVariants }