reend-components 0.1.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/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/lib/index.cjs +2 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.ts +70 -0
- package/dist/lib/index.mjs +247 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/style.css +1 -0
- package/package.json +118 -0
- package/src/styles/variables.css +140 -0
- package/src/tailwind-preset.ts +120 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 VBeatDead
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# ReEnd-Components
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/reend-components)
|
|
4
|
+
[](https://www.npmjs.com/package/reend-components)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
**Arknights: Endfield Design System** — A React component library inspired by the UI aesthetics of Arknights: Endfield. Built with TypeScript, Tailwind CSS, and Radix UI primitives.
|
|
8
|
+
|
|
9
|
+
[Documentation](https://reend-components.pages.dev) · [GitHub](https://github.com/VBeatDead/ReEnd-Components) · [npm](https://www.npmjs.com/package/reend-components)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install reend-components
|
|
15
|
+
# or
|
|
16
|
+
pnpm add reend-components
|
|
17
|
+
# or
|
|
18
|
+
yarn add reend-components
|
|
19
|
+
# or
|
|
20
|
+
bun add reend-components
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Peer Dependencies
|
|
24
|
+
|
|
25
|
+
| Package | Version |
|
|
26
|
+
| ----------- | ----------------- |
|
|
27
|
+
| react | ≥18.0.0 |
|
|
28
|
+
| react-dom | ≥18.0.0 |
|
|
29
|
+
| tailwindcss | ≥3.4.0 (optional) |
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### 1. Configure Tailwind (recommended)
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// tailwind.config.ts
|
|
37
|
+
import reendPreset from "reend-components/tailwind";
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
presets: [reendPreset],
|
|
41
|
+
content: [
|
|
42
|
+
"./src/**/*.{ts,tsx}",
|
|
43
|
+
"./node_modules/reend-components/dist/**/*.{js,mjs}",
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2. Import CSS Variables
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
/* In your global CSS file */
|
|
52
|
+
@import "reend-components/variables.css";
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Use Components
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import {
|
|
59
|
+
Tooltip,
|
|
60
|
+
TooltipTrigger,
|
|
61
|
+
TooltipContent,
|
|
62
|
+
TooltipProvider,
|
|
63
|
+
} from "reend-components";
|
|
64
|
+
|
|
65
|
+
function App() {
|
|
66
|
+
return (
|
|
67
|
+
<TooltipProvider>
|
|
68
|
+
<Tooltip>
|
|
69
|
+
<TooltipTrigger>Hover me</TooltipTrigger>
|
|
70
|
+
<TooltipContent>Styled with Endfield design tokens</TooltipContent>
|
|
71
|
+
</Tooltip>
|
|
72
|
+
</TooltipProvider>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Without Tailwind
|
|
78
|
+
|
|
79
|
+
If you're not using Tailwind CSS, import the pre-built stylesheet:
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import "reend-components/styles.css";
|
|
83
|
+
import { Tooltip } from "reend-components";
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Components
|
|
87
|
+
|
|
88
|
+
| Component | Description |
|
|
89
|
+
| --------------- | --------------------------------------- |
|
|
90
|
+
| `Tooltip` | Popup info on hover/focus (Radix-based) |
|
|
91
|
+
| `Toast` | Notification toasts (Radix-based) |
|
|
92
|
+
| `Toaster` | Toast container/renderer |
|
|
93
|
+
| `SonnerToaster` | Alternative toast (Sonner lib) |
|
|
94
|
+
| `cn()` | Utility for merging Tailwind classes |
|
|
95
|
+
| `useToast()` | Toast notification hook |
|
|
96
|
+
|
|
97
|
+
## Theming
|
|
98
|
+
|
|
99
|
+
ReEnd uses CSS custom properties for all colors. Override any variable:
|
|
100
|
+
|
|
101
|
+
```css
|
|
102
|
+
:root {
|
|
103
|
+
--ef-yellow: 47 100% 56%;
|
|
104
|
+
--primary: 47 100% 56%;
|
|
105
|
+
--background: 0 0% 4%;
|
|
106
|
+
--foreground: 0 0% 94.1%;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Dark/light mode: toggle `.light` class on document root.
|
|
111
|
+
|
|
112
|
+
> All color variables use **HSL values without `hsl()` wrapper** for alpha support:
|
|
113
|
+
> `background: hsl(var(--primary) / 0.5);`
|
|
114
|
+
|
|
115
|
+
See [CSS Variable Reference](https://reend-components.pages.dev/docs/foundations) for the complete token list.
|
|
116
|
+
|
|
117
|
+
## Design Tokens
|
|
118
|
+
|
|
119
|
+
| Token | Purpose | Dark | Light |
|
|
120
|
+
| -------------- | -------------- | -------------- | ------------- |
|
|
121
|
+
| `--ef-yellow` | Primary accent | `48 100% 58%` | `42 90% 42%` |
|
|
122
|
+
| `--ef-blue` | Info / links | `201 66% 58%` | — |
|
|
123
|
+
| `--ef-red` | Destructive | `355 100% 64%` | `355 80% 50%` |
|
|
124
|
+
| `--ef-green` | Success | `145 67% 51%` | — |
|
|
125
|
+
| `--background` | Page bg | `0 0% 4%` | `0 0% 97%` |
|
|
126
|
+
| `--foreground` | Text color | `0 0% 94.1%` | `0 0% 8%` |
|
|
127
|
+
| `--primary` | Brand color | `48 100% 58%` | `42 90% 42%` |
|
|
128
|
+
|
|
129
|
+
[Full token reference →](https://reend-components.pages.dev/docs/foundations)
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
git clone https://github.com/VBeatDead/ReEnd-Components.git
|
|
135
|
+
cd ReEnd-Components
|
|
136
|
+
npm install
|
|
137
|
+
npm run dev # docs dev server at :8080
|
|
138
|
+
npm run build # build docs SPA
|
|
139
|
+
npm run build:lib # build library for npm
|
|
140
|
+
npm run test # run tests
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT © [VBeatDead](https://github.com/VBeatDead)
|
|
146
|
+
|
|
147
|
+
## Disclaimer
|
|
148
|
+
|
|
149
|
+
This is a community-driven, fan-made project inspired by the sci-fi industrial aesthetics of _Arknights: Endfield_. It is **not** affiliated with, endorsed by, or connected to Hypergryph, Gryphline, or any of their subsidiaries. All game-related trademarks and copyrights belong to their respective owners. The MIT license applies to the source code only.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),R=require("react"),D=require("@radix-ui/react-tooltip"),P=require("clsx"),E=require("tailwind-merge"),M=require("@radix-ui/react-toast"),I=require("class-variance-authority"),V=require("lucide-react"),w=require("sonner");function g(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const i=g(R),u=g(D),a=g(M);function n(...t){return E.twMerge(P.clsx(t))}const q=u.Provider,C=u.Root,k=u.Trigger,S=i.forwardRef(({className:t,sideOffset:e=4,...o},s)=>r.jsx(u.Content,{ref:s,sideOffset:e,className:n("z-50 overflow-hidden border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o}));S.displayName=u.Content.displayName;const N=a.Provider,T=i.forwardRef(({className:t,...e},o)=>r.jsx(a.Viewport,{ref:o,className:n("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));T.displayName=a.Viewport.displayName;const z=I.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),v=i.forwardRef(({className:t,variant:e,...o},s)=>r.jsx(a.Root,{ref:s,className:n(z({variant:e}),t),...o}));v.displayName=a.Root.displayName;const j=i.forwardRef(({className:t,...e},o)=>r.jsx(a.Action,{ref:o,className:n("inline-flex h-8 shrink-0 items-center justify-center border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));j.displayName=a.Action.displayName;const x=i.forwardRef(({className:t,...e},o)=>r.jsx(a.Close,{ref:o,className:n("absolute right-2 top-2 p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:r.jsx(V.X,{className:"h-4 w-4"})}));x.displayName=a.Close.displayName;const b=i.forwardRef(({className:t,...e},o)=>r.jsx(a.Title,{ref:o,className:n("text-sm font-semibold",t),...e}));b.displayName=a.Title.displayName;const y=i.forwardRef(({className:t,...e},o)=>r.jsx(a.Description,{ref:o,className:n("text-sm opacity-90",t),...e}));y.displayName=a.Description.displayName;const B=1,L=5e3;let f=0;function U(){return f=(f+1)%Number.MAX_SAFE_INTEGER,f.toString()}const m=new Map,h=t=>{if(m.has(t))return;const e=setTimeout(()=>{m.delete(t),c({type:"REMOVE_TOAST",toastId:t})},L);m.set(t,e)},X=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,B)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(o=>o.id===e.toast.id?{...o,...e.toast}:o)};case"DISMISS_TOAST":{const{toastId:o}=e;return o?h(o):t.toasts.forEach(s=>{h(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===o||o===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(o=>o.id!==e.toastId)}}},l=[];let p={toasts:[]};function c(t){p=X(p,t),l.forEach(e=>{e(p)})}function A({...t}){const e=U(),o=d=>c({type:"UPDATE_TOAST",toast:{...d,id:e}}),s=()=>c({type:"DISMISS_TOAST",toastId:e});return c({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:d=>{d||s()}}}),{id:e,dismiss:s,update:o}}function O(){const[t,e]=i.useState(p);return i.useEffect(()=>(l.push(e),()=>{const o=l.indexOf(e);o>-1&&l.splice(o,1)}),[t]),{...t,toast:A,dismiss:o=>c({type:"DISMISS_TOAST",toastId:o})}}function F(){const{toasts:t}=O();return r.jsxs(N,{children:[t.map(function({id:e,title:o,description:s,action:d,..._}){return r.jsxs(v,{..._,children:[r.jsxs("div",{className:"grid gap-1",children:[o&&r.jsx(b,{children:o}),s&&r.jsx(y,{children:s})]}),d,r.jsx(x,{})]},e)}),r.jsx(T,{})]})}const G=({theme:t="dark",...e})=>r.jsx(w.Toaster,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e});Object.defineProperty(exports,"toast",{enumerable:!0,get:()=>w.toast});exports.SonnerToaster=G;exports.Toast=v;exports.ToastAction=j;exports.ToastClose=x;exports.ToastDescription=y;exports.ToastProvider=N;exports.ToastTitle=b;exports.ToastViewport=T;exports.Toaster=F;exports.Tooltip=C;exports.TooltipContent=S;exports.TooltipProvider=q;exports.TooltipTrigger=k;exports.cn=n;exports.toastAction=A;exports.useToast=O;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/lib/utils.ts","../../src/components/ui/tooltip.tsx","../../src/components/ui/toast.tsx","../../src/hooks/use-toast.ts","../../src/components/ui/toaster.tsx","../../src/components/ui/sonner.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import * as React from \"react\";\nimport * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst ToastProvider = ToastPrimitives.Provider;\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className,\n )}\n {...props}\n />\n));\nToastViewport.displayName = ToastPrimitives.Viewport.displayName;\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive bg-destructive text-destructive-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n});\nToast.displayName = ToastPrimitives.Root.displayName;\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n));\nToastAction.displayName = ToastPrimitives.Action.displayName;\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-2 top-2 p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n));\nToastClose.displayName = ToastPrimitives.Close.displayName;\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n));\nToastTitle.displayName = ToastPrimitives.Title.displayName;\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n));\nToastDescription.displayName = ToastPrimitives.Description.displayName;\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>;\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n","import * as React from \"react\";\n\nimport type { ToastActionElement, ToastProps } from \"../components/ui/toast\";\n\nconst TOAST_LIMIT = 1;\nconst TOAST_REMOVE_DELAY = 5000;\n\ntype ToasterToast = ToastProps & {\n id: string;\n title?: React.ReactNode;\n description?: React.ReactNode;\n action?: ToastActionElement;\n};\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const;\n\nlet count = 0;\n\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\n return count.toString();\n}\n\ntype ActionType = typeof actionTypes;\n\ntype Action =\n | {\n type: ActionType[\"ADD_TOAST\"];\n toast: ToasterToast;\n }\n | {\n type: ActionType[\"UPDATE_TOAST\"];\n toast: Partial<ToasterToast>;\n }\n | {\n type: ActionType[\"DISMISS_TOAST\"];\n toastId?: ToasterToast[\"id\"];\n }\n | {\n type: ActionType[\"REMOVE_TOAST\"];\n toastId?: ToasterToast[\"id\"];\n };\n\ninterface State {\n toasts: ToasterToast[];\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId,\n });\n }, TOAST_REMOVE_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t,\n ),\n };\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action;\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t,\n ),\n };\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [] };\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n}\n\ntype Toast = Omit<ToasterToast, \"id\">;\n\nfunction toast({ ...props }: Toast) {\n const id = genId();\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id },\n });\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id });\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss();\n },\n },\n });\n\n return {\n id: id,\n dismiss,\n update,\n };\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState);\n\n React.useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n };\n}\n\nexport { useToast, toast };\n","import { useToast } from \"../../hooks/use-toast\";\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from \"./toast\";\n\nexport function Toaster() {\n const { toasts } = useToast();\n\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n <ToastViewport />\n </ToastProvider>\n );\n}\n","import { Toaster as Sonner, toast } from \"sonner\";\n\ntype ToasterProps = React.ComponentProps<typeof Sonner>;\n\nconst Toaster = ({ theme = \"dark\", ...props }: ToasterProps) => {\n return (\n <Sonner\n theme={theme as ToasterProps[\"theme\"]}\n className=\"toaster group\"\n toastOptions={{\n classNames: {\n toast:\n \"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg\",\n description: \"group-[.toast]:text-muted-foreground\",\n actionButton:\n \"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n cancelButton:\n \"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\",\n },\n }}\n {...props}\n />\n );\n};\n\nexport { Toaster, toast };\n"],"names":["cn","inputs","twMerge","clsx","TooltipProvider","TooltipPrimitive","Tooltip","TooltipTrigger","TooltipContent","React","className","sideOffset","props","ref","jsx","ToastProvider","ToastPrimitives","ToastViewport","toastVariants","cva","Toast","variant","ToastAction","ToastClose","X","ToastTitle","ToastDescription","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","id","update","dismiss","open","useToast","setState","index","Toaster","toasts","title","description","jsxs","theme","Sonner"],"mappings":"0nBAGO,SAASA,KAAMC,EAAsB,CAC1C,OAAOC,EAAAA,QAAQC,OAAKF,CAAM,CAAC,CAC7B,CCAA,MAAMG,EAAkBC,EAAiB,SAEnCC,EAAUD,EAAiB,KAE3BE,EAAiBF,EAAiB,QAElCG,EAAiBC,EAAM,WAG3B,CAAC,CAAE,UAAAC,EAAW,WAAAC,EAAa,EAAG,GAAGC,GAASC,IAC1CC,EAAAA,IAACT,EAAiB,QAAjB,CACC,IAAAQ,EACA,WAAAF,EACA,UAAWX,EACT,0XACAU,CAAA,EAED,GAAGE,CAAA,CACN,CACD,EACDJ,EAAe,YAAcH,EAAiB,QAAQ,YClBtD,MAAMU,EAAgBC,EAAgB,SAEhCC,EAAgBR,EAAM,WAG1B,CAAC,CAAE,UAAAC,EAAW,GAAGE,CAAA,EAASC,IAC1BC,EAAAA,IAACE,EAAgB,SAAhB,CACC,IAAAH,EACA,UAAWb,EACT,oIACAU,CAAA,EAED,GAAGE,CAAA,CACN,CACD,EACDK,EAAc,YAAcD,EAAgB,SAAS,YAErD,MAAME,EAAgBC,EAAAA,IACpB,ilBACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,uCACT,YACE,iFAAA,CACJ,EAEF,gBAAiB,CACf,QAAS,SAAA,CACX,CAEJ,EAEMC,EAAQX,EAAM,WAIlB,CAAC,CAAE,UAAAC,EAAW,QAAAW,EAAS,GAAGT,CAAA,EAASC,IAEjCC,EAAAA,IAACE,EAAgB,KAAhB,CACC,IAAAH,EACA,UAAWb,EAAGkB,EAAc,CAAE,QAAAG,CAAA,CAAS,EAAGX,CAAS,EAClD,GAAGE,CAAA,CAAA,CAGT,EACDQ,EAAM,YAAcJ,E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,CAEJ,CC5BA,MAAMkC,EAAU,CAAC,CAAE,MAAAK,EAAQ,OAAQ,GAAG5C,KAElCE,EAAAA,IAAC2C,EAAAA,QAAA,CACC,MAAAD,EACA,UAAU,gBACV,aAAc,CACZ,WAAY,CACV,MACE,wIACF,YAAa,uCACb,aACE,mEACF,aACE,8DAAA,CACJ,EAED,GAAG5C,CAAA,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
4
|
+
import * as React_2 from 'react';
|
|
5
|
+
import { toast } from 'sonner';
|
|
6
|
+
import { Toaster as Toaster_2 } from 'sonner';
|
|
7
|
+
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
8
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
9
|
+
import { VariantProps } from 'class-variance-authority';
|
|
10
|
+
|
|
11
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
12
|
+
|
|
13
|
+
export declare const SonnerToaster: ({ theme, ...props }: ToasterProps) => JSX_2.Element;
|
|
14
|
+
|
|
15
|
+
export declare const Toast: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React_2.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
|
|
16
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
17
|
+
} & ClassProp) | undefined) => string> & React_2.RefAttributes<HTMLLIElement>>;
|
|
18
|
+
|
|
19
|
+
export { toast }
|
|
20
|
+
|
|
21
|
+
declare type Toast_2 = Omit<ToasterToast, "id">;
|
|
22
|
+
|
|
23
|
+
export declare const ToastAction: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
|
|
25
|
+
export declare function toastAction({ ...props }: Toast_2): {
|
|
26
|
+
id: string;
|
|
27
|
+
dismiss: () => void;
|
|
28
|
+
update: (props: ToasterToast) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export declare type ToastActionElement = React_2.ReactElement<typeof ToastAction>;
|
|
32
|
+
|
|
33
|
+
export declare const ToastClose: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
|
|
35
|
+
export declare const ToastDescription: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
|
|
37
|
+
export declare function Toaster(): JSX_2.Element;
|
|
38
|
+
|
|
39
|
+
declare type ToasterProps = React.ComponentProps<typeof Toaster_2>;
|
|
40
|
+
|
|
41
|
+
declare type ToasterToast = ToastProps & {
|
|
42
|
+
id: string;
|
|
43
|
+
title?: React_2.ReactNode;
|
|
44
|
+
description?: React_2.ReactNode;
|
|
45
|
+
action?: ToastActionElement;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export declare type ToastProps = React_2.ComponentPropsWithoutRef<typeof Toast>;
|
|
49
|
+
|
|
50
|
+
export declare const ToastProvider: React_2.FC<ToastPrimitives.ToastProviderProps>;
|
|
51
|
+
|
|
52
|
+
export declare const ToastTitle: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
|
|
54
|
+
export declare const ToastViewport: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React_2.RefAttributes<HTMLOListElement>, "ref"> & React_2.RefAttributes<HTMLOListElement>>;
|
|
55
|
+
|
|
56
|
+
export declare const Tooltip: React_2.FC<TooltipPrimitive.TooltipProps>;
|
|
57
|
+
|
|
58
|
+
export declare const TooltipContent: React_2.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
|
|
60
|
+
export declare const TooltipProvider: React_2.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
61
|
+
|
|
62
|
+
export declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
63
|
+
|
|
64
|
+
export declare function useToast(): {
|
|
65
|
+
toast: typeof toastAction;
|
|
66
|
+
dismiss: (toastId?: string) => void;
|
|
67
|
+
toasts: ToasterToast[];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { }
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import * as c from "@radix-ui/react-tooltip";
|
|
4
|
+
import { clsx as N } from "clsx";
|
|
5
|
+
import { twMerge as S } from "tailwind-merge";
|
|
6
|
+
import * as a from "@radix-ui/react-toast";
|
|
7
|
+
import { cva as A } from "class-variance-authority";
|
|
8
|
+
import { X as O } from "lucide-react";
|
|
9
|
+
import { Toaster as R } from "sonner";
|
|
10
|
+
import { toast as K } from "sonner";
|
|
11
|
+
function n(...t) {
|
|
12
|
+
return S(N(t));
|
|
13
|
+
}
|
|
14
|
+
const F = c.Provider, G = c.Root, Q = c.Trigger, E = i.forwardRef(({ className: t, sideOffset: e = 4, ...o }, s) => /* @__PURE__ */ r(
|
|
15
|
+
c.Content,
|
|
16
|
+
{
|
|
17
|
+
ref: s,
|
|
18
|
+
sideOffset: e,
|
|
19
|
+
className: n(
|
|
20
|
+
"z-50 overflow-hidden border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
21
|
+
t
|
|
22
|
+
),
|
|
23
|
+
...o
|
|
24
|
+
}
|
|
25
|
+
));
|
|
26
|
+
E.displayName = c.Content.displayName;
|
|
27
|
+
const _ = a.Provider, v = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ r(
|
|
28
|
+
a.Viewport,
|
|
29
|
+
{
|
|
30
|
+
ref: o,
|
|
31
|
+
className: n(
|
|
32
|
+
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
|
|
33
|
+
t
|
|
34
|
+
),
|
|
35
|
+
...e
|
|
36
|
+
}
|
|
37
|
+
));
|
|
38
|
+
v.displayName = a.Viewport.displayName;
|
|
39
|
+
const D = A(
|
|
40
|
+
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
41
|
+
{
|
|
42
|
+
variants: {
|
|
43
|
+
variant: {
|
|
44
|
+
default: "border bg-background text-foreground",
|
|
45
|
+
destructive: "destructive group border-destructive bg-destructive text-destructive-foreground"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
variant: "default"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
), x = i.forwardRef(({ className: t, variant: e, ...o }, s) => /* @__PURE__ */ r(
|
|
53
|
+
a.Root,
|
|
54
|
+
{
|
|
55
|
+
ref: s,
|
|
56
|
+
className: n(D({ variant: e }), t),
|
|
57
|
+
...o
|
|
58
|
+
}
|
|
59
|
+
));
|
|
60
|
+
x.displayName = a.Root.displayName;
|
|
61
|
+
const I = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ r(
|
|
62
|
+
a.Action,
|
|
63
|
+
{
|
|
64
|
+
ref: o,
|
|
65
|
+
className: n(
|
|
66
|
+
"inline-flex h-8 shrink-0 items-center justify-center border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",
|
|
67
|
+
t
|
|
68
|
+
),
|
|
69
|
+
...e
|
|
70
|
+
}
|
|
71
|
+
));
|
|
72
|
+
I.displayName = a.Action.displayName;
|
|
73
|
+
const h = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ r(
|
|
74
|
+
a.Close,
|
|
75
|
+
{
|
|
76
|
+
ref: o,
|
|
77
|
+
className: n(
|
|
78
|
+
"absolute right-2 top-2 p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
|
|
79
|
+
t
|
|
80
|
+
),
|
|
81
|
+
"toast-close": "",
|
|
82
|
+
...e,
|
|
83
|
+
children: /* @__PURE__ */ r(O, { className: "h-4 w-4" })
|
|
84
|
+
}
|
|
85
|
+
));
|
|
86
|
+
h.displayName = a.Close.displayName;
|
|
87
|
+
const y = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ r(
|
|
88
|
+
a.Title,
|
|
89
|
+
{
|
|
90
|
+
ref: o,
|
|
91
|
+
className: n("text-sm font-semibold", t),
|
|
92
|
+
...e
|
|
93
|
+
}
|
|
94
|
+
));
|
|
95
|
+
y.displayName = a.Title.displayName;
|
|
96
|
+
const b = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ r(
|
|
97
|
+
a.Description,
|
|
98
|
+
{
|
|
99
|
+
ref: o,
|
|
100
|
+
className: n("text-sm opacity-90", t),
|
|
101
|
+
...e
|
|
102
|
+
}
|
|
103
|
+
));
|
|
104
|
+
b.displayName = a.Description.displayName;
|
|
105
|
+
const M = 1, P = 5e3;
|
|
106
|
+
let f = 0;
|
|
107
|
+
function V() {
|
|
108
|
+
return f = (f + 1) % Number.MAX_SAFE_INTEGER, f.toString();
|
|
109
|
+
}
|
|
110
|
+
const g = /* @__PURE__ */ new Map(), T = (t) => {
|
|
111
|
+
if (g.has(t))
|
|
112
|
+
return;
|
|
113
|
+
const e = setTimeout(() => {
|
|
114
|
+
g.delete(t), u({
|
|
115
|
+
type: "REMOVE_TOAST",
|
|
116
|
+
toastId: t
|
|
117
|
+
});
|
|
118
|
+
}, P);
|
|
119
|
+
g.set(t, e);
|
|
120
|
+
}, C = (t, e) => {
|
|
121
|
+
switch (e.type) {
|
|
122
|
+
case "ADD_TOAST":
|
|
123
|
+
return {
|
|
124
|
+
...t,
|
|
125
|
+
toasts: [e.toast, ...t.toasts].slice(0, M)
|
|
126
|
+
};
|
|
127
|
+
case "UPDATE_TOAST":
|
|
128
|
+
return {
|
|
129
|
+
...t,
|
|
130
|
+
toasts: t.toasts.map(
|
|
131
|
+
(o) => o.id === e.toast.id ? { ...o, ...e.toast } : o
|
|
132
|
+
)
|
|
133
|
+
};
|
|
134
|
+
case "DISMISS_TOAST": {
|
|
135
|
+
const { toastId: o } = e;
|
|
136
|
+
return o ? T(o) : t.toasts.forEach((s) => {
|
|
137
|
+
T(s.id);
|
|
138
|
+
}), {
|
|
139
|
+
...t,
|
|
140
|
+
toasts: t.toasts.map(
|
|
141
|
+
(s) => s.id === o || o === void 0 ? {
|
|
142
|
+
...s,
|
|
143
|
+
open: !1
|
|
144
|
+
} : s
|
|
145
|
+
)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
case "REMOVE_TOAST":
|
|
149
|
+
return e.toastId === void 0 ? {
|
|
150
|
+
...t,
|
|
151
|
+
toasts: []
|
|
152
|
+
} : {
|
|
153
|
+
...t,
|
|
154
|
+
toasts: t.toasts.filter((o) => o.id !== e.toastId)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}, p = [];
|
|
158
|
+
let l = { toasts: [] };
|
|
159
|
+
function u(t) {
|
|
160
|
+
l = C(l, t), p.forEach((e) => {
|
|
161
|
+
e(l);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function k({ ...t }) {
|
|
165
|
+
const e = V(), o = (d) => u({
|
|
166
|
+
type: "UPDATE_TOAST",
|
|
167
|
+
toast: { ...d, id: e }
|
|
168
|
+
}), s = () => u({ type: "DISMISS_TOAST", toastId: e });
|
|
169
|
+
return u({
|
|
170
|
+
type: "ADD_TOAST",
|
|
171
|
+
toast: {
|
|
172
|
+
...t,
|
|
173
|
+
id: e,
|
|
174
|
+
open: !0,
|
|
175
|
+
onOpenChange: (d) => {
|
|
176
|
+
d || s();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}), {
|
|
180
|
+
id: e,
|
|
181
|
+
dismiss: s,
|
|
182
|
+
update: o
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function j() {
|
|
186
|
+
const [t, e] = i.useState(l);
|
|
187
|
+
return i.useEffect(() => (p.push(e), () => {
|
|
188
|
+
const o = p.indexOf(e);
|
|
189
|
+
o > -1 && p.splice(o, 1);
|
|
190
|
+
}), [t]), {
|
|
191
|
+
...t,
|
|
192
|
+
toast: k,
|
|
193
|
+
dismiss: (o) => u({ type: "DISMISS_TOAST", toastId: o })
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function Y() {
|
|
197
|
+
const { toasts: t } = j();
|
|
198
|
+
return /* @__PURE__ */ m(_, { children: [
|
|
199
|
+
t.map(function({ id: e, title: o, description: s, action: d, ...w }) {
|
|
200
|
+
return /* @__PURE__ */ m(x, { ...w, children: [
|
|
201
|
+
/* @__PURE__ */ m("div", { className: "grid gap-1", children: [
|
|
202
|
+
o && /* @__PURE__ */ r(y, { children: o }),
|
|
203
|
+
s && /* @__PURE__ */ r(b, { children: s })
|
|
204
|
+
] }),
|
|
205
|
+
d,
|
|
206
|
+
/* @__PURE__ */ r(h, {})
|
|
207
|
+
] }, e);
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ r(v, {})
|
|
210
|
+
] });
|
|
211
|
+
}
|
|
212
|
+
const q = ({ theme: t = "dark", ...e }) => /* @__PURE__ */ r(
|
|
213
|
+
R,
|
|
214
|
+
{
|
|
215
|
+
theme: t,
|
|
216
|
+
className: "toaster group",
|
|
217
|
+
toastOptions: {
|
|
218
|
+
classNames: {
|
|
219
|
+
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
220
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
221
|
+
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
222
|
+
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
...e
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
export {
|
|
229
|
+
q as SonnerToaster,
|
|
230
|
+
x as Toast,
|
|
231
|
+
I as ToastAction,
|
|
232
|
+
h as ToastClose,
|
|
233
|
+
b as ToastDescription,
|
|
234
|
+
_ as ToastProvider,
|
|
235
|
+
y as ToastTitle,
|
|
236
|
+
v as ToastViewport,
|
|
237
|
+
Y as Toaster,
|
|
238
|
+
G as Tooltip,
|
|
239
|
+
E as TooltipContent,
|
|
240
|
+
F as TooltipProvider,
|
|
241
|
+
Q as TooltipTrigger,
|
|
242
|
+
n as cn,
|
|
243
|
+
K as toast,
|
|
244
|
+
k as toastAction,
|
|
245
|
+
j as useToast
|
|
246
|
+
};
|
|
247
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/lib/utils.ts","../../src/components/ui/tooltip.tsx","../../src/components/ui/toast.tsx","../../src/hooks/use-toast.ts","../../src/components/ui/toaster.tsx","../../src/components/ui/sonner.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import * as React from \"react\";\nimport * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst ToastProvider = ToastPrimitives.Provider;\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className,\n )}\n {...props}\n />\n));\nToastViewport.displayName = ToastPrimitives.Viewport.displayName;\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive bg-destructive text-destructive-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n});\nToast.displayName = ToastPrimitives.Root.displayName;\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n));\nToastAction.displayName = ToastPrimitives.Action.displayName;\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-2 top-2 p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n));\nToastClose.displayName = ToastPrimitives.Close.displayName;\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n));\nToastTitle.displayName = ToastPrimitives.Title.displayName;\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n));\nToastDescription.displayName = ToastPrimitives.Description.displayName;\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>;\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n","import * as React from \"react\";\n\nimport type { ToastActionElement, ToastProps } from \"../components/ui/toast\";\n\nconst TOAST_LIMIT = 1;\nconst TOAST_REMOVE_DELAY = 5000;\n\ntype ToasterToast = ToastProps & {\n id: string;\n title?: React.ReactNode;\n description?: React.ReactNode;\n action?: ToastActionElement;\n};\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const;\n\nlet count = 0;\n\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\n return count.toString();\n}\n\ntype ActionType = typeof actionTypes;\n\ntype Action =\n | {\n type: ActionType[\"ADD_TOAST\"];\n toast: ToasterToast;\n }\n | {\n type: ActionType[\"UPDATE_TOAST\"];\n toast: Partial<ToasterToast>;\n }\n | {\n type: ActionType[\"DISMISS_TOAST\"];\n toastId?: ToasterToast[\"id\"];\n }\n | {\n type: ActionType[\"REMOVE_TOAST\"];\n toastId?: ToasterToast[\"id\"];\n };\n\ninterface State {\n toasts: ToasterToast[];\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId,\n });\n }, TOAST_REMOVE_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t,\n ),\n };\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action;\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t,\n ),\n };\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [] };\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n}\n\ntype Toast = Omit<ToasterToast, \"id\">;\n\nfunction toast({ ...props }: Toast) {\n const id = genId();\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id },\n });\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id });\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss();\n },\n },\n });\n\n return {\n id: id,\n dismiss,\n update,\n };\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState);\n\n React.useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n };\n}\n\nexport { useToast, toast };\n","import { useToast } from \"../../hooks/use-toast\";\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from \"./toast\";\n\nexport function Toaster() {\n const { toasts } = useToast();\n\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n <ToastViewport />\n </ToastProvider>\n );\n}\n","import { Toaster as Sonner, toast } from \"sonner\";\n\ntype ToasterProps = React.ComponentProps<typeof Sonner>;\n\nconst Toaster = ({ theme = \"dark\", ...props }: ToasterProps) => {\n return (\n <Sonner\n theme={theme as ToasterProps[\"theme\"]}\n className=\"toaster group\"\n toastOptions={{\n classNames: {\n toast:\n \"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg\",\n description: \"group-[.toast]:text-muted-foreground\",\n actionButton:\n \"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n cancelButton:\n \"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\",\n },\n }}\n {...props}\n />\n );\n};\n\nexport { Toaster, toast };\n"],"names":["cn","inputs","twMerge","clsx","TooltipProvider","TooltipPrimitive","Tooltip","TooltipTrigger","TooltipContent","React","className","sideOffset","props","ref","jsx","ToastProvider","ToastPrimitives","ToastViewport","toastVariants","cva","Toast","variant","ToastAction","ToastClose","X","ToastTitle","ToastDescription","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","id","update","dismiss","open","useToast","setState","index","Toaster","toasts","title","description","jsxs","theme","Sonner"],"mappings":";;;;;;;;;;AAGO,SAASA,KAAMC,G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1%;--ef-pure-white: 0 0% 100%;--ef-yellow: 48 100% 58%;--ef-yellow-dark: 48 85% 39%;--ef-yellow-glow: 48 100% 58% / .25;--ef-blue: 201 66% 58%;--ef-blue-light: 196 64% 69%;--ef-blue-dark: 202 56% 38%;--ef-cyan: 186 100% 50%;--ef-red: 355 100% 64%;--ef-green: 145 67% 51%;--ef-orange: 39 100% 50%;--ef-purple: 270 77% 64%;--background: 0 0% 4%;--foreground: 0 0% 94.1%;--card: 0 0% 7.8%;--card-foreground: 0 0% 87.8%;--popover: 0 0% 10%;--popover-foreground: 0 0% 87.8%;--primary: 48 100% 58%;--primary-foreground: 0 0% 4%;--secondary: 0 0% 10%;--secondary-foreground: 0 0% 87.8%;--muted: 0 0% 13.3%;--muted-foreground: 0 0% 60%;--accent: 0 0% 10%;--accent-foreground: 48 100% 58%;--destructive: 355 100% 64%;--destructive-foreground: 0 0% 100%;--border: 0 0% 100% / .06;--input: 0 0% 100% / .1;--ring: 48 100% 58%;--radius: 0px;--surface-canvas: 0 0% 4%;--surface-0: 0 0% 5.9%;--surface-1: 0 0% 7.8%;--surface-2: 0 0% 10%;--surface-3: 0 0% 13.3%;--surface-hover: 0 0% 11.8%;--surface-active: 0 0% 14.5%}.light{--ef-black: 0 0% 96%;--ef-black-soft: 0 0% 93%;--ef-black-muted: 0 0% 90%;--ef-dark-gray: 0 0% 87%;--ef-gray: 0 0% 80%;--ef-gray-mid: 0 0% 50%;--ef-gray-light: 0 0% 35%;--ef-white-muted: 0 0% 25%;--ef-white-soft: 0 0% 15%;--ef-white: 0 0% 8%;--ef-pure-white: 0 0% 0%;--ef-yellow: 42 90% 42%;--ef-yellow-dark: 42 85% 30%;--background: 0 0% 97%;--foreground: 0 0% 8%;--card: 0 0% 100%;--card-foreground: 0 0% 15%;--popover: 0 0% 100%;--popover-foreground: 0 0% 15%;--primary: 42 90% 42%;--primary-foreground: 0 0% 100%;--secondary: 0 0% 93%;--secondary-foreground: 0 0% 15%;--muted: 0 0% 93%;--muted-foreground: 0 0% 42%;--accent: 0 0% 93%;--accent-foreground: 42 90% 42%;--destructive: 355 80% 50%;--destructive-foreground: 0 0% 100%;--border: 0 0% 0% / .1;--input: 0 0% 0% / .12;--ring: 42 90% 42%;--surface-canvas: 0 0% 97%;--surface-0: 0 0% 95%;--surface-1: 0 0% 100%;--surface-2: 0 0% 97%;--surface-3: 0 0% 93%;--surface-hover: 0 0% 92%;--surface-active: 0 0% 88%}body{background-color:hsl(var(--background));color:hsl(var(--foreground));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
|
package/package.json
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reend-components",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Arknights: Endfield Design System — React component library with Tailwind CSS",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/lib/index.cjs",
|
|
8
|
+
"module": "./dist/lib/index.mjs",
|
|
9
|
+
"types": "./dist/lib/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/lib/index.d.ts",
|
|
14
|
+
"default": "./dist/lib/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/lib/index.d.cts",
|
|
18
|
+
"default": "./dist/lib/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": "./dist/lib/style.css",
|
|
22
|
+
"./variables.css": "./src/styles/variables.css",
|
|
23
|
+
"./tailwind": {
|
|
24
|
+
"import": "./src/tailwind-preset.ts",
|
|
25
|
+
"require": "./src/tailwind-preset.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/lib",
|
|
30
|
+
"src/styles",
|
|
31
|
+
"src/tailwind-preset.ts",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"**/*.css"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"author": "VBeatDead (https://github.com/VBeatDead)",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/VBeatDead/ReEnd-Components.git"
|
|
43
|
+
},
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/VBeatDead/ReEnd-Components/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://reend-components.pages.dev",
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react",
|
|
50
|
+
"components",
|
|
51
|
+
"ui",
|
|
52
|
+
"tailwindcss",
|
|
53
|
+
"design-system",
|
|
54
|
+
"arknights",
|
|
55
|
+
"endfield",
|
|
56
|
+
"typescript",
|
|
57
|
+
"radix-ui"
|
|
58
|
+
],
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
61
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"tailwindcss": {
|
|
65
|
+
"optional": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"dev": "vite",
|
|
70
|
+
"build": "vite build",
|
|
71
|
+
"build:dev": "vite build --mode development",
|
|
72
|
+
"build:lib": "vite build --config vite.lib.config.ts",
|
|
73
|
+
"prepublishOnly": "npm run build:lib",
|
|
74
|
+
"lint": "eslint .",
|
|
75
|
+
"preview": "vite preview",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"test:watch": "vitest"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@radix-ui/react-toast": "^1.2.14",
|
|
81
|
+
"@radix-ui/react-tooltip": "^1.2.7",
|
|
82
|
+
"class-variance-authority": "^0.7.1",
|
|
83
|
+
"clsx": "^2.1.1",
|
|
84
|
+
"framer-motion": "^12.34.0",
|
|
85
|
+
"fuse.js": "^7.1.0",
|
|
86
|
+
"lucide-react": "^0.462.0",
|
|
87
|
+
"react": "^18.3.1",
|
|
88
|
+
"react-dom": "^18.3.1",
|
|
89
|
+
"react-error-boundary": "^6.1.1",
|
|
90
|
+
"react-router-dom": "^6.30.1",
|
|
91
|
+
"shiki": "^3.22.0",
|
|
92
|
+
"sonner": "^1.7.4",
|
|
93
|
+
"tailwind-merge": "^2.6.0",
|
|
94
|
+
"tailwindcss-animate": "^1.0.7"
|
|
95
|
+
},
|
|
96
|
+
"devDependencies": {
|
|
97
|
+
"@eslint/js": "^9.32.0",
|
|
98
|
+
"@testing-library/jest-dom": "^6.6.0",
|
|
99
|
+
"@testing-library/react": "^16.0.0",
|
|
100
|
+
"@types/node": "^22.16.5",
|
|
101
|
+
"@types/react": "^18.3.23",
|
|
102
|
+
"@types/react-dom": "^18.3.7",
|
|
103
|
+
"@vitejs/plugin-react-swc": "^3.11.0",
|
|
104
|
+
"autoprefixer": "^10.4.21",
|
|
105
|
+
"eslint": "^9.32.0",
|
|
106
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
107
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
108
|
+
"globals": "^15.15.0",
|
|
109
|
+
"jsdom": "^20.0.3",
|
|
110
|
+
"postcss": "^8.5.6",
|
|
111
|
+
"tailwindcss": "^3.4.17",
|
|
112
|
+
"typescript": "^5.8.3",
|
|
113
|
+
"typescript-eslint": "^8.38.0",
|
|
114
|
+
"vite": "^5.4.19",
|
|
115
|
+
"vite-plugin-dts": "^4.5.4",
|
|
116
|
+
"vitest": "^3.2.4"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReEnd-Components — Endfield Design System
|
|
3
|
+
* CSS Custom Properties (Design Tokens)
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* @import "reend-components/variables.css";
|
|
7
|
+
*
|
|
8
|
+
* Dark mode: default (no class needed)
|
|
9
|
+
* Light mode: add class="light" to <html> or <body>
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
:root {
|
|
13
|
+
/* ═══ ENDFIELD COLORS (HSL) ═══ */
|
|
14
|
+
--ef-black: 0 0% 4%;
|
|
15
|
+
--ef-black-soft: 0 0% 6.7%;
|
|
16
|
+
--ef-black-muted: 0 0% 10%;
|
|
17
|
+
--ef-dark-gray: 0 0% 13.3%;
|
|
18
|
+
--ef-gray: 0 0% 20%;
|
|
19
|
+
--ef-gray-mid: 0 0% 40%;
|
|
20
|
+
--ef-gray-light: 0 0% 60%;
|
|
21
|
+
--ef-white-muted: 0 0% 80%;
|
|
22
|
+
--ef-white-soft: 0 0% 87.8%;
|
|
23
|
+
--ef-white: 0 0% 94.1%;
|
|
24
|
+
--ef-pure-white: 0 0% 100%;
|
|
25
|
+
|
|
26
|
+
/* Accents */
|
|
27
|
+
--ef-yellow: 48 100% 58%;
|
|
28
|
+
--ef-yellow-dark: 48 85% 39%;
|
|
29
|
+
--ef-yellow-glow: 48 100% 58% / 0.25;
|
|
30
|
+
--ef-blue: 201 66% 58%;
|
|
31
|
+
--ef-blue-light: 196 64% 69%;
|
|
32
|
+
--ef-blue-dark: 202 56% 38%;
|
|
33
|
+
--ef-cyan: 186 100% 50%;
|
|
34
|
+
--ef-red: 355 100% 64%;
|
|
35
|
+
--ef-green: 145 67% 51%;
|
|
36
|
+
--ef-orange: 39 100% 50%;
|
|
37
|
+
--ef-purple: 270 77% 64%;
|
|
38
|
+
|
|
39
|
+
/* ═══ SEMANTIC TOKENS ═══ */
|
|
40
|
+
--background: 0 0% 4%;
|
|
41
|
+
--foreground: 0 0% 94.1%;
|
|
42
|
+
|
|
43
|
+
--card: 0 0% 7.8%;
|
|
44
|
+
--card-foreground: 0 0% 87.8%;
|
|
45
|
+
|
|
46
|
+
--popover: 0 0% 10%;
|
|
47
|
+
--popover-foreground: 0 0% 87.8%;
|
|
48
|
+
|
|
49
|
+
--primary: 48 100% 58%;
|
|
50
|
+
--primary-foreground: 0 0% 4%;
|
|
51
|
+
|
|
52
|
+
--secondary: 0 0% 10%;
|
|
53
|
+
--secondary-foreground: 0 0% 87.8%;
|
|
54
|
+
|
|
55
|
+
--muted: 0 0% 13.3%;
|
|
56
|
+
--muted-foreground: 0 0% 60%;
|
|
57
|
+
|
|
58
|
+
--accent: 0 0% 10%;
|
|
59
|
+
--accent-foreground: 48 100% 58%;
|
|
60
|
+
|
|
61
|
+
--destructive: 355 100% 64%;
|
|
62
|
+
--destructive-foreground: 0 0% 100%;
|
|
63
|
+
|
|
64
|
+
--border: 0 0% 100% / 0.06;
|
|
65
|
+
--input: 0 0% 100% / 0.1;
|
|
66
|
+
--ring: 48 100% 58%;
|
|
67
|
+
|
|
68
|
+
--radius: 0px;
|
|
69
|
+
|
|
70
|
+
/* ═══ SURFACES ═══ */
|
|
71
|
+
--surface-canvas: 0 0% 4%;
|
|
72
|
+
--surface-0: 0 0% 5.9%;
|
|
73
|
+
--surface-1: 0 0% 7.8%;
|
|
74
|
+
--surface-2: 0 0% 10%;
|
|
75
|
+
--surface-3: 0 0% 13.3%;
|
|
76
|
+
--surface-hover: 0 0% 11.8%;
|
|
77
|
+
--surface-active: 0 0% 14.5%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ═══ LIGHT MODE ═══ */
|
|
81
|
+
.light {
|
|
82
|
+
--ef-black: 0 0% 96%;
|
|
83
|
+
--ef-black-soft: 0 0% 93%;
|
|
84
|
+
--ef-black-muted: 0 0% 90%;
|
|
85
|
+
--ef-dark-gray: 0 0% 87%;
|
|
86
|
+
--ef-gray: 0 0% 80%;
|
|
87
|
+
--ef-gray-mid: 0 0% 50%;
|
|
88
|
+
--ef-gray-light: 0 0% 35%;
|
|
89
|
+
--ef-white-muted: 0 0% 25%;
|
|
90
|
+
--ef-white-soft: 0 0% 15%;
|
|
91
|
+
--ef-white: 0 0% 8%;
|
|
92
|
+
--ef-pure-white: 0 0% 0%;
|
|
93
|
+
|
|
94
|
+
--ef-yellow: 42 90% 42%;
|
|
95
|
+
--ef-yellow-dark: 42 85% 30%;
|
|
96
|
+
|
|
97
|
+
--background: 0 0% 97%;
|
|
98
|
+
--foreground: 0 0% 8%;
|
|
99
|
+
|
|
100
|
+
--card: 0 0% 100%;
|
|
101
|
+
--card-foreground: 0 0% 15%;
|
|
102
|
+
|
|
103
|
+
--popover: 0 0% 100%;
|
|
104
|
+
--popover-foreground: 0 0% 15%;
|
|
105
|
+
|
|
106
|
+
--primary: 42 90% 42%;
|
|
107
|
+
--primary-foreground: 0 0% 100%;
|
|
108
|
+
|
|
109
|
+
--secondary: 0 0% 93%;
|
|
110
|
+
--secondary-foreground: 0 0% 15%;
|
|
111
|
+
|
|
112
|
+
--muted: 0 0% 93%;
|
|
113
|
+
--muted-foreground: 0 0% 42%;
|
|
114
|
+
|
|
115
|
+
--accent: 0 0% 93%;
|
|
116
|
+
--accent-foreground: 42 90% 42%;
|
|
117
|
+
|
|
118
|
+
--destructive: 355 80% 50%;
|
|
119
|
+
--destructive-foreground: 0 0% 100%;
|
|
120
|
+
|
|
121
|
+
--border: 0 0% 0% / 0.1;
|
|
122
|
+
--input: 0 0% 0% / 0.12;
|
|
123
|
+
--ring: 42 90% 42%;
|
|
124
|
+
|
|
125
|
+
--surface-canvas: 0 0% 97%;
|
|
126
|
+
--surface-0: 0 0% 95%;
|
|
127
|
+
--surface-1: 0 0% 100%;
|
|
128
|
+
--surface-2: 0 0% 97%;
|
|
129
|
+
--surface-3: 0 0% 93%;
|
|
130
|
+
--surface-hover: 0 0% 92%;
|
|
131
|
+
--surface-active: 0 0% 88%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* ═══ BASE STYLES ═══ */
|
|
135
|
+
body {
|
|
136
|
+
background-color: hsl(var(--background));
|
|
137
|
+
color: hsl(var(--foreground));
|
|
138
|
+
-webkit-font-smoothing: antialiased;
|
|
139
|
+
-moz-osx-font-smoothing: grayscale;
|
|
140
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReEnd-Components — Tailwind CSS Preset
|
|
3
|
+
* Arknights: Endfield Design System
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* // tailwind.config.ts
|
|
7
|
+
* import reendPreset from "reend-components/tailwind";
|
|
8
|
+
* export default {
|
|
9
|
+
* presets: [reendPreset],
|
|
10
|
+
* content: [
|
|
11
|
+
* "./src/**\/*.{ts,tsx}",
|
|
12
|
+
* "./node_modules/reend-components/dist/**\/*.{js,mjs}",
|
|
13
|
+
* ],
|
|
14
|
+
* };
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { Config } from "tailwindcss";
|
|
18
|
+
|
|
19
|
+
const reendPreset: Partial<Config> = {
|
|
20
|
+
darkMode: ["class"],
|
|
21
|
+
theme: {
|
|
22
|
+
extend: {
|
|
23
|
+
fontFamily: {
|
|
24
|
+
display: ["Orbitron", "monospace"],
|
|
25
|
+
ui: ["Orbitron", "monospace"],
|
|
26
|
+
mono: ["JetBrains Mono", "Courier New", "monospace"],
|
|
27
|
+
body: ["Source Han Sans", "Noto Sans SC", "Inter", "sans-serif"],
|
|
28
|
+
},
|
|
29
|
+
colors: {
|
|
30
|
+
border: "hsl(var(--border))",
|
|
31
|
+
input: "hsl(var(--input))",
|
|
32
|
+
ring: "hsl(var(--ring))",
|
|
33
|
+
background: "hsl(var(--background))",
|
|
34
|
+
foreground: "hsl(var(--foreground))",
|
|
35
|
+
primary: {
|
|
36
|
+
DEFAULT: "hsl(var(--primary))",
|
|
37
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
38
|
+
},
|
|
39
|
+
secondary: {
|
|
40
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
41
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
42
|
+
},
|
|
43
|
+
destructive: {
|
|
44
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
45
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
46
|
+
},
|
|
47
|
+
muted: {
|
|
48
|
+
DEFAULT: "hsl(var(--muted))",
|
|
49
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
50
|
+
},
|
|
51
|
+
accent: {
|
|
52
|
+
DEFAULT: "hsl(var(--accent))",
|
|
53
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
54
|
+
},
|
|
55
|
+
popover: {
|
|
56
|
+
DEFAULT: "hsl(var(--popover))",
|
|
57
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
58
|
+
},
|
|
59
|
+
card: {
|
|
60
|
+
DEFAULT: "hsl(var(--card))",
|
|
61
|
+
foreground: "hsl(var(--card-foreground))",
|
|
62
|
+
},
|
|
63
|
+
ef: {
|
|
64
|
+
black: "hsl(var(--ef-black))",
|
|
65
|
+
"black-soft": "hsl(var(--ef-black-soft))",
|
|
66
|
+
"black-muted": "hsl(var(--ef-black-muted))",
|
|
67
|
+
"dark-gray": "hsl(var(--ef-dark-gray))",
|
|
68
|
+
gray: "hsl(var(--ef-gray))",
|
|
69
|
+
"gray-mid": "hsl(var(--ef-gray-mid))",
|
|
70
|
+
"gray-light": "hsl(var(--ef-gray-light))",
|
|
71
|
+
"white-muted": "hsl(var(--ef-white-muted))",
|
|
72
|
+
"white-soft": "hsl(var(--ef-white-soft))",
|
|
73
|
+
white: "hsl(var(--ef-white))",
|
|
74
|
+
yellow: "hsl(var(--ef-yellow))",
|
|
75
|
+
"yellow-dark": "hsl(var(--ef-yellow-dark))",
|
|
76
|
+
"yellow-glow": "hsl(var(--ef-yellow-glow))",
|
|
77
|
+
blue: "hsl(var(--ef-blue))",
|
|
78
|
+
"blue-light": "hsl(var(--ef-blue-light))",
|
|
79
|
+
"blue-dark": "hsl(var(--ef-blue-dark))",
|
|
80
|
+
cyan: "hsl(var(--ef-cyan))",
|
|
81
|
+
red: "hsl(var(--ef-red))",
|
|
82
|
+
green: "hsl(var(--ef-green))",
|
|
83
|
+
orange: "hsl(var(--ef-orange))",
|
|
84
|
+
purple: "hsl(var(--ef-purple))",
|
|
85
|
+
},
|
|
86
|
+
surface: {
|
|
87
|
+
canvas: "hsl(var(--surface-canvas))",
|
|
88
|
+
0: "hsl(var(--surface-0))",
|
|
89
|
+
1: "hsl(var(--surface-1))",
|
|
90
|
+
2: "hsl(var(--surface-2))",
|
|
91
|
+
3: "hsl(var(--surface-3))",
|
|
92
|
+
hover: "hsl(var(--surface-hover))",
|
|
93
|
+
active: "hsl(var(--surface-active))",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
borderRadius: {
|
|
97
|
+
lg: "var(--radius)",
|
|
98
|
+
md: "calc(var(--radius) - 2px)",
|
|
99
|
+
sm: "calc(var(--radius) - 4px)",
|
|
100
|
+
},
|
|
101
|
+
keyframes: {
|
|
102
|
+
"accordion-down": {
|
|
103
|
+
from: { height: "0" },
|
|
104
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
105
|
+
},
|
|
106
|
+
"accordion-up": {
|
|
107
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
108
|
+
to: { height: "0" },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
animation: {
|
|
112
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
113
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
plugins: [require("tailwindcss-animate")],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default reendPreset;
|