shadcn-ui-react 0.2.0 → 0.2.3
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 +1 -1
- package/README.md +82 -3
- package/dist/index.cjs +17365 -59
- package/dist/index.d.cts +96 -2
- package/dist/index.d.ts +96 -2
- package/dist/index.js +17380 -51
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Then use the components:
|
|
|
26
26
|
import { Button } from 'shadcn-ui-react'
|
|
27
27
|
|
|
28
28
|
export default function MyComponent() {
|
|
29
|
-
return <Button>Hello world</Button>
|
|
29
|
+
return (<Button>Hello world</Button>)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -34,11 +34,27 @@ export default function MyComponent() {
|
|
|
34
34
|
import { Card } from 'shadcn-ui-react'
|
|
35
35
|
|
|
36
36
|
export default function MyComponent() {
|
|
37
|
-
return <Card
|
|
37
|
+
return (<Card><h1>Hello World</h1></Card>)
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
```tsx
|
|
42
|
+
import React, { useState } from 'react';
|
|
43
|
+
import { SearchInput } from './components/search-input';
|
|
44
|
+
|
|
45
|
+
export default function MyComponent() {
|
|
46
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
47
|
+
|
|
48
|
+
const handleSearch = (term) => {
|
|
49
|
+
setSearchTerm(term);
|
|
50
|
+
console.log('Search term:', term);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return (<SearchInput placeholder="Search" value={searchTerm} onSearch={handleSearch} />);
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Example of a login form
|
|
42
58
|
```tsx
|
|
43
59
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
44
60
|
import { useForm } from 'react-hook-form';
|
|
@@ -105,4 +121,67 @@ export default function UserAuthForm() {
|
|
|
105
121
|
</Form>
|
|
106
122
|
);
|
|
107
123
|
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Example of a data table
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import React, { useState } from 'react';
|
|
130
|
+
import { DataTable } from 'shadcn-ui-react';
|
|
131
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
132
|
+
|
|
133
|
+
type Data = {
|
|
134
|
+
id: number;
|
|
135
|
+
name: string;
|
|
136
|
+
age: number;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const columns: ColumnDef<Data, any>[] = [
|
|
140
|
+
{
|
|
141
|
+
accessorKey: 'id',
|
|
142
|
+
header: 'ID',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
accessorKey: 'name',
|
|
146
|
+
header: 'Name',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
accessorKey: 'age',
|
|
150
|
+
header: 'Age',
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
const data: Data[] = [
|
|
155
|
+
{ id: 1, name: 'John Doe', age: 28 },
|
|
156
|
+
{ id: 2, name: 'Jane Smith', age: 34 },
|
|
157
|
+
{ id: 3, name: 'Sam Johnson', age: 45 },
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
const Example = () => {
|
|
161
|
+
const [page, setPage] = useState(1);
|
|
162
|
+
|
|
163
|
+
const handlePageChange = (newPage: number) => {
|
|
164
|
+
setPage(newPage);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const handleRowClick = (row: Data) => {
|
|
168
|
+
console.log('Row clicked:', row);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<div>
|
|
173
|
+
<h1>Data Table Example</h1>
|
|
174
|
+
<DataTable
|
|
175
|
+
columns={columns}
|
|
176
|
+
data={data}
|
|
177
|
+
pageCount={3}
|
|
178
|
+
page={page}
|
|
179
|
+
onPageChange={handlePageChange}
|
|
180
|
+
onClick={handleRowClick}
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export default Example;
|
|
108
187
|
```
|