Skip to content

Commit efd58db

Browse files
committed
feat(checkboxgroup): initial checkbox group
feat(data-table): initial datatable feat(form): initial form feat(form-item): initial form-item feat(label): initial label
1 parent fbebcdc commit efd58db

File tree

21 files changed

+808
-21
lines changed

21 files changed

+808
-21
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@
7979
},
8080
"dependencies": {
8181
"@floating-ui/react": "^0.27.15",
82+
"@radix-ui/react-checkbox": "^1.3.2",
8283
"@shilong/utils": "^0.0.9",
84+
"@tanstack/react-table": "^8.21.3",
85+
"lucide-react": "^0.539.0",
86+
"react-hook-form": "^7.62.0",
8387
"sonner": "^2.0.7"
8488
}
8589
}

playground/src/App.tsx

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,62 @@
1-
import { Button, Input, Popover, Toaster, Tooltip, toast } from '@shilong/ui'
1+
import { CheckboxGroup, Input, FormItem, Form, Button } from '../../src'
2+
3+
const options = [
4+
{
5+
label: '豆腐',
6+
value: 'toufu',
7+
},
8+
{
9+
label: '棉花糖',
10+
value: 'mianhuatang',
11+
},
12+
{
13+
label: '棉花糖2',
14+
value: 'mianhuatang2',
15+
},
16+
{
17+
label: '棉花糖3',
18+
value: 'mianhuatang3',
19+
},
20+
{
21+
label: '棉花糖4',
22+
value: 'mianhuatang4',
23+
},
24+
]
225

326
export function App() {
427
return (
528
<>
6-
<Input />
7-
<Button onClick={() => toast('nih')}>Toast</Button>
8-
<Toaster position="top-center" />
9-
<Popover trigger={<Button>Trigger</Button>}>
10-
<div>nihao</div>
11-
</Popover>
12-
13-
<Popover trigger={<Button>Trigger1</Button>}>
14-
<>nihao</>
15-
</Popover>
16-
17-
<Tooltip trigger={<Button variant="outline">E</Button>} arrow>
18-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores minus
19-
suscipit distinctio asperiores vero molestias, quos rerum aliquid? Et
20-
nulla ducimus, qui repudiandae culpa quod pariatur ipsam aut magni sint.
21-
</Tooltip>
29+
<div className="flex min-h-svh items-center justify-center">
30+
<Form onSubmit={(v) => console.log(v)} className="max-w-[300px]">
31+
<FormItem
32+
label="Username"
33+
name="username"
34+
rules={{
35+
required: '内容必填',
36+
}}
37+
render={<Input autoComplete="on" />}
38+
/>
39+
<FormItem
40+
label="Password"
41+
name="password"
42+
rules={{
43+
required: 'message',
44+
}}
45+
render={<Input autoComplete="on" />}
46+
/>
47+
<FormItem
48+
label="like"
49+
name="food"
50+
rules={{
51+
required: 'message',
52+
}}
53+
controlled
54+
className="items-start"
55+
render={<CheckboxGroup options={options} />}
56+
/>
57+
<Button type="submit">Submit</Button>
58+
</Form>
59+
</div>
2260
</>
2361
)
2462
}

playground/src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { StrictMode } from 'react'
22
import { createRoot } from 'react-dom/client'
3-
import { App } from './App.tsx'
3+
import { App } from './App'
44
import './style.css'
5-
import '@shilong/ui/style.css'
5+
import '../../src/global.css'
66

77
createRoot(document.querySelector('#app')!).render(
88
<StrictMode>
99
<App />
10-
</StrictMode>
10+
</StrictMode>,
1111
)

playground/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import react from '@vitejs/plugin-react'
22
import { defineConfig } from 'vite'
3+
import tailwindcss from '@tailwindcss/vite'
34

45
export default defineConfig({
56
root: './playground',
6-
plugins: [react()],
7+
plugins: [react(), tailwindcss()],
78
})

0 commit comments

Comments
 (0)