asterui 0.12.32 → 0.12.35
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/README.md +89 -47
- package/dist/components/Drawer.d.ts +34 -4
- package/dist/components/Drawer.js +240 -169
- package/dist/components/Drawer.js.map +1 -1
- package/dist/components/Layout.d.ts +40 -32
- package/dist/components/Layout.js +178 -130
- package/dist/components/Layout.js.map +1 -1
- package/dist/components/QRCode.js +55 -44
- package/dist/components/QRCode.js.map +1 -1
- package/dist/components/ResponsiveDrawer.d.ts +34 -0
- package/dist/components/ResponsiveDrawer.js +75 -0
- package/dist/components/ResponsiveDrawer.js.map +1 -0
- package/dist/components/Space.js +5 -5
- package/dist/components/Space.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.js +127 -129
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/PageLayout.d.ts +0 -9
- package/dist/components/PageLayout.js +0 -35
- package/dist/components/PageLayout.js.map +0 -1
- package/dist/components/SidebarDrawer.d.ts +0 -21
- package/dist/components/SidebarDrawer.js +0 -44
- package/dist/components/SidebarDrawer.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,16 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive React component library built with [DaisyUI](https://daisyui.com) and [Tailwind CSS](https://tailwindcss.com).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Demo
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
View the documentation at: [https://asterui.com](https://asterui.com)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
The fastest way to get started is with `create-asterui`, which sets up a new project with Vite, Tailwind CSS v4, DaisyUI v5, and AsterUI pre-configured:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm create asterui@latest
|
|
15
|
+
# or
|
|
16
|
+
pnpm create asterui@latest
|
|
17
|
+
# or
|
|
18
|
+
yarn create asterui
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The CLI will guide you through interactive prompts to configure:
|
|
22
|
+
- **Language** - TypeScript (recommended) or JavaScript
|
|
23
|
+
- **Themes** - Light/Dark, Business/Corporate, all themes, or custom selection
|
|
24
|
+
- **Package manager** - npm, pnpm, or yarn (auto-detected)
|
|
25
|
+
- **Optional components** - Chart, QRCode, VirtualList (adds required peer dependencies)
|
|
26
|
+
|
|
27
|
+
Then start the dev server:
|
|
10
28
|
|
|
11
29
|
```bash
|
|
30
|
+
cd my-app
|
|
31
|
+
npm run dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Manual Installation
|
|
35
|
+
|
|
36
|
+
To add AsterUI to an existing project, you'll need Tailwind CSS v4 and DaisyUI v5.
|
|
37
|
+
|
|
38
|
+
### 1. Install dependencies
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install asterui
|
|
12
42
|
npm install -D tailwindcss @tailwindcss/vite daisyui
|
|
13
43
|
```
|
|
14
44
|
|
|
45
|
+
### 2. Configure Vite
|
|
46
|
+
|
|
15
47
|
Add the Tailwind plugin to your `vite.config.ts`:
|
|
16
48
|
|
|
17
49
|
```ts
|
|
@@ -24,7 +56,9 @@ export default defineConfig({
|
|
|
24
56
|
})
|
|
25
57
|
```
|
|
26
58
|
|
|
27
|
-
Configure
|
|
59
|
+
### 3. Configure CSS
|
|
60
|
+
|
|
61
|
+
Update your CSS file (e.g., `src/index.css`):
|
|
28
62
|
|
|
29
63
|
```css
|
|
30
64
|
@import "tailwindcss";
|
|
@@ -34,16 +68,6 @@ Configure your CSS file (e.g., `src/index.css`):
|
|
|
34
68
|
|
|
35
69
|
The `@source` directive tells Tailwind to scan the AsterUI package for classes to include in your build.
|
|
36
70
|
|
|
37
|
-
## Installation
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm install asterui
|
|
41
|
-
# or
|
|
42
|
-
pnpm add asterui
|
|
43
|
-
# or
|
|
44
|
-
yarn add asterui
|
|
45
|
-
```
|
|
46
|
-
|
|
47
71
|
## Usage
|
|
48
72
|
|
|
49
73
|
```tsx
|
|
@@ -53,46 +77,46 @@ const { Link, Paragraph } = Typography
|
|
|
53
77
|
|
|
54
78
|
export default function App() {
|
|
55
79
|
const handleSubmit = (values: { email: string; password: string; remember: boolean }) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
80
|
+
Modal.success({
|
|
81
|
+
title: 'Login Successful',
|
|
82
|
+
content: <pre className="text-left">{JSON.stringify(values, null, 2)}</pre>,
|
|
83
|
+
})
|
|
60
84
|
}
|
|
61
85
|
|
|
62
86
|
return (
|
|
63
87
|
<Flex justify="center" align="center" minHeight="screen" className="bg-base-200 p-4">
|
|
64
88
|
<Card title="Sign In" className="w-full max-w-md">
|
|
65
89
|
<Form onFinish={handleSubmit} initialValues={{ remember: false }}>
|
|
66
|
-
|
|
67
|
-
|
|
90
|
+
<Form.Item name="email" label="Email" rules={[{ required: true }, { type: 'email' }]}>
|
|
91
|
+
<Input placeholder="you@example.com" />
|
|
92
|
+
</Form.Item>
|
|
93
|
+
<Form.Item
|
|
94
|
+
name="password"
|
|
95
|
+
label="Password"
|
|
96
|
+
rules={[
|
|
97
|
+
{ required: true },
|
|
98
|
+
{ min: 8, message: 'Password must be at least 8 characters' },
|
|
99
|
+
{ pattern: /[A-Z]/, message: 'Must contain an uppercase letter' },
|
|
100
|
+
{ pattern: /[a-z]/, message: 'Must contain a lowercase letter' },
|
|
101
|
+
{ pattern: /[0-9]/, message: 'Must contain a number' },
|
|
102
|
+
{ pattern: /[!@#$%^&*.?]/, message: 'Must contain a special character' },
|
|
103
|
+
]}
|
|
104
|
+
>
|
|
105
|
+
<Input type="password" placeholder="Enter your password" />
|
|
106
|
+
</Form.Item>
|
|
107
|
+
<Space justify="between" align="center" className="mb-4">
|
|
108
|
+
<Form.Item name="remember" valuePropName="checked" inline>
|
|
109
|
+
<Checkbox>Remember me</Checkbox>
|
|
68
110
|
</Form.Item>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{ pattern: /[!@#$%^&*.?]/, message: 'Must contain a special character' },
|
|
79
|
-
]}
|
|
80
|
-
>
|
|
81
|
-
<Input type="password" placeholder="Enter your password" />
|
|
82
|
-
</Form.Item>
|
|
83
|
-
<Space justify="between" align="center" className="mb-4">
|
|
84
|
-
<Form.Item name="remember" valuePropName="checked" inline>
|
|
85
|
-
<Checkbox>Remember me</Checkbox>
|
|
86
|
-
</Form.Item>
|
|
87
|
-
<Link size="sm">Forgot password?</Link>
|
|
88
|
-
</Space>
|
|
89
|
-
<Button color="primary" htmlType="submit" shape="block">
|
|
90
|
-
Sign In
|
|
91
|
-
</Button>
|
|
92
|
-
<Divider>or</Divider>
|
|
93
|
-
<Paragraph align="center" size="sm">
|
|
94
|
-
Don't have an account? <Link>Sign up</Link>
|
|
95
|
-
</Paragraph>
|
|
111
|
+
<Link size="sm">Forgot password?</Link>
|
|
112
|
+
</Space>
|
|
113
|
+
<Button color="primary" htmlType="submit" shape="block">
|
|
114
|
+
Sign In
|
|
115
|
+
</Button>
|
|
116
|
+
<Divider>or</Divider>
|
|
117
|
+
<Paragraph align="center" size="sm">
|
|
118
|
+
Don't have an account? <Link>Sign up</Link>
|
|
119
|
+
</Paragraph>
|
|
96
120
|
</Form>
|
|
97
121
|
</Card>
|
|
98
122
|
</Flex>
|
|
@@ -104,6 +128,24 @@ export default function App() {
|
|
|
104
128
|
|
|
105
129
|
90+ components including forms, data display, navigation, feedback, and layout. See the full list at [asterui.com/components](https://asterui.com/components).
|
|
106
130
|
|
|
131
|
+
## Optional Components
|
|
132
|
+
|
|
133
|
+
Some components require additional peer dependencies and use separate imports:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# For Chart component
|
|
137
|
+
npm install apexcharts
|
|
138
|
+
import { Chart } from 'asterui/chart'
|
|
139
|
+
|
|
140
|
+
# For QRCode component
|
|
141
|
+
npm install qrcode
|
|
142
|
+
import { QRCode } from 'asterui/qrcode'
|
|
143
|
+
|
|
144
|
+
# For VirtualList component
|
|
145
|
+
npm install @tanstack/react-virtual
|
|
146
|
+
import { VirtualList } from 'asterui/virtuallist'
|
|
147
|
+
```
|
|
148
|
+
|
|
107
149
|
## Requirements
|
|
108
150
|
|
|
109
151
|
- React 18 or 19
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export type DrawerPlacement = 'top' | 'right' | 'bottom' | 'left';
|
|
3
3
|
export type DrawerSize = 'default' | 'large' | number;
|
|
4
|
-
export interface
|
|
4
|
+
export interface DrawerPushConfig {
|
|
5
|
+
/** Distance to push parent drawer (default: 180) */
|
|
6
|
+
distance?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
9
|
/** Drawer content */
|
|
6
10
|
children: React.ReactNode;
|
|
7
11
|
/** Whether the drawer is visible */
|
|
8
12
|
open?: boolean;
|
|
9
13
|
/** Callback when drawer is closed */
|
|
10
|
-
onClose?: () => void;
|
|
14
|
+
onClose?: (e?: React.MouseEvent | React.KeyboardEvent) => void;
|
|
15
|
+
/** Callback after open/close animation completes */
|
|
16
|
+
afterOpenChange?: (open: boolean) => void;
|
|
11
17
|
/** Drawer title */
|
|
12
18
|
title?: React.ReactNode;
|
|
13
19
|
/** Direction drawer slides from */
|
|
@@ -36,16 +42,40 @@ export interface DrawerProps {
|
|
|
36
42
|
rootClassName?: string;
|
|
37
43
|
/** Style for drawer panel */
|
|
38
44
|
style?: React.CSSProperties;
|
|
45
|
+
/** Style for drawer header */
|
|
46
|
+
headerStyle?: React.CSSProperties;
|
|
47
|
+
/** Style for drawer body/content area */
|
|
48
|
+
bodyStyle?: React.CSSProperties;
|
|
49
|
+
/** Style for drawer footer */
|
|
50
|
+
footerStyle?: React.CSSProperties;
|
|
51
|
+
/** Style for drawer wrapper (includes mask) */
|
|
52
|
+
rootStyle?: React.CSSProperties;
|
|
53
|
+
/** Style for mask/backdrop */
|
|
54
|
+
maskStyle?: React.CSSProperties;
|
|
39
55
|
/** z-index of drawer */
|
|
40
56
|
zIndex?: number;
|
|
41
57
|
/** Destroy content when closed */
|
|
42
58
|
destroyOnClose?: boolean;
|
|
59
|
+
/** Pre-render drawer content (keep in DOM even when closed) */
|
|
60
|
+
forceRender?: boolean;
|
|
43
61
|
/** Where to place initial focus */
|
|
44
62
|
initialFocus?: 'close' | 'content';
|
|
63
|
+
/** Show loading skeleton */
|
|
64
|
+
loading?: boolean;
|
|
65
|
+
/** Custom container for portal (false to disable portal) */
|
|
66
|
+
getContainer?: HTMLElement | (() => HTMLElement) | false;
|
|
67
|
+
/** Nested drawer push behavior */
|
|
68
|
+
push?: boolean | DrawerPushConfig;
|
|
69
|
+
/** Test ID for testing */
|
|
70
|
+
'data-testid'?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface DrawerRef {
|
|
73
|
+
/** The drawer panel element */
|
|
74
|
+
nativeElement: HTMLDivElement | null;
|
|
45
75
|
}
|
|
46
76
|
/**
|
|
47
77
|
* Drawer - A panel that slides in from the edge of the screen.
|
|
48
78
|
* Use for forms, details, or task panels.
|
|
49
|
-
* For responsive sidebar navigation, use
|
|
79
|
+
* For responsive sidebar navigation, use ResponsiveDrawer instead.
|
|
50
80
|
*/
|
|
51
|
-
export declare
|
|
81
|
+
export declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<DrawerRef>>;
|