@nayhoo/ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/chunk-CI5TDSK3.mjs +15 -0
- package/dist/chunk-CI5TDSK3.mjs.map +1 -0
- package/dist/index.css +11091 -11091
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4838 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +35 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +857 -0
- package/dist/index.mjs.map +1 -0
- package/dist/providers/index.css +9500 -0
- package/dist/providers/index.css.map +1 -0
- package/dist/providers/index.d.mts +16 -0
- package/dist/providers/index.d.ts +16 -0
- package/dist/providers/index.js +64 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +33 -0
- package/dist/providers/index.mjs.map +1 -0
- package/package.json +18 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tim Kinsman
|
|
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,138 @@
|
|
|
1
|
+
# @nayhoo/ui
|
|
2
|
+
|
|
3
|
+
A collection of React components, built with [Radix Primitives](https://www.radix-ui.com/primitives), styled with [vanilla-extract](https://vanilla-extract.style).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @nayhoo/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
### Next.js
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @vanilla-extract/next-plugin
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// next.config.ts
|
|
21
|
+
|
|
22
|
+
import { createVanillaExtractPlugin } from "@vanilla-extract/next-plugin";
|
|
23
|
+
import type { NextConfig } from "next";
|
|
24
|
+
|
|
25
|
+
const withVanillaExtract = createVanillaExtractPlugin();
|
|
26
|
+
|
|
27
|
+
const nextConfig: NextConfig = {
|
|
28
|
+
// https://vanilla-extract.style/documentation/integrations/next/
|
|
29
|
+
transpilePackages: ["@nayhoo/ui"],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default withVanillaExtract(nextConfig);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// src/app/layout.tsx
|
|
37
|
+
|
|
38
|
+
import "@nayhoo/ui/css"; // REQUIRED
|
|
39
|
+
import type { Metadata } from "next";
|
|
40
|
+
import "./globals.css";
|
|
41
|
+
import { AppProvider } from "./provider";
|
|
42
|
+
|
|
43
|
+
export const metadata: Metadata = {
|
|
44
|
+
title: "Create Next App",
|
|
45
|
+
description: "Generated by create next app",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default function RootLayout({
|
|
49
|
+
children,
|
|
50
|
+
}: Readonly<{
|
|
51
|
+
children: React.ReactNode;
|
|
52
|
+
}>) {
|
|
53
|
+
return (
|
|
54
|
+
<html lang="en">
|
|
55
|
+
<body className={lightTheme}>
|
|
56
|
+
<AppProvider>{children}</AppProvider>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
// src/app/provider.tsx
|
|
65
|
+
|
|
66
|
+
"use client";
|
|
67
|
+
|
|
68
|
+
import { ThemeProvider } from "@nayhoo/ui/providers";
|
|
69
|
+
import React from "react";
|
|
70
|
+
|
|
71
|
+
type AppProviderProps = {
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const AppProvider = ({ children }: AppProviderProps) => {
|
|
76
|
+
return <ThemeProvider>{children}</ThemeProvider>;
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Vite
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npm install @vanilla-extract/vite-plugin
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
// vite.config.ts
|
|
88
|
+
|
|
89
|
+
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
|
90
|
+
import react from "@vitejs/plugin-react";
|
|
91
|
+
import { defineConfig } from "vite";
|
|
92
|
+
|
|
93
|
+
// https://vite.dev/config/
|
|
94
|
+
export default defineConfig({
|
|
95
|
+
plugins: [react(), vanillaExtractPlugin()],
|
|
96
|
+
optimizeDeps: {
|
|
97
|
+
include: ["@nayhoo/ui"],
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
// src/main.tsx
|
|
104
|
+
|
|
105
|
+
import "@nayhoo/ui/css"; // REQUIRED
|
|
106
|
+
import { StrictMode } from "react";
|
|
107
|
+
import { createRoot } from "react-dom/client";
|
|
108
|
+
import "./index.css";
|
|
109
|
+
import App from "./App.tsx";
|
|
110
|
+
|
|
111
|
+
createRoot(document.getElementById("root")!).render(
|
|
112
|
+
<StrictMode>
|
|
113
|
+
<App />
|
|
114
|
+
</StrictMode>,
|
|
115
|
+
);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// src/app.tsx
|
|
120
|
+
|
|
121
|
+
import { ThemeProvider } from "@nayhoo/ui/providers";
|
|
122
|
+
|
|
123
|
+
function App({ children }: { children: React.ReactNode }) {
|
|
124
|
+
return <ThemeProvider>{children}</ThemeProvider>;
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Usage
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
"use client";
|
|
132
|
+
|
|
133
|
+
import { Button } from "@nayhoo/ui";
|
|
134
|
+
|
|
135
|
+
export const Component = () => {
|
|
136
|
+
return <Button onClick={() => alert("Hello!")}>Press me</Button>;
|
|
137
|
+
};
|
|
138
|
+
```
|