@gamecp/ui 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/README.md +244 -0
- package/dist/index.d.mts +211 -0
- package/dist/index.d.ts +211 -0
- package/dist/index.js +1306 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1276 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# @gamecp/ui
|
|
2
|
+
|
|
3
|
+
React UI component library for GameCP. A collection of reusable, accessible, and customizable components built with React, TypeScript, and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @gamecp/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- React 19+
|
|
14
|
+
- Tailwind CSS (configured in your project)
|
|
15
|
+
- react-icons
|
|
16
|
+
- framer-motion
|
|
17
|
+
- Next.js 15+ (for Link component)
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Button, Card, FormInput, Badge } from '@gamecp/ui';
|
|
23
|
+
|
|
24
|
+
function MyComponent() {
|
|
25
|
+
return (
|
|
26
|
+
<Card title="Example Card">
|
|
27
|
+
<FormInput
|
|
28
|
+
label="Email"
|
|
29
|
+
name="email"
|
|
30
|
+
type="email"
|
|
31
|
+
value={email}
|
|
32
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
33
|
+
/>
|
|
34
|
+
<Button variant="primary">Submit</Button>
|
|
35
|
+
<Badge variant="success">Active</Badge>
|
|
36
|
+
</Card>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Components
|
|
42
|
+
|
|
43
|
+
### Core Components
|
|
44
|
+
|
|
45
|
+
#### Button
|
|
46
|
+
Versatile button component with multiple variants and sizes.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<Button variant="primary" size="md" isLoading={false}>
|
|
50
|
+
Click me
|
|
51
|
+
</Button>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Props:**
|
|
55
|
+
- `variant`: 'primary' | 'secondary' | 'destructive' | 'ghost' | 'link' | 'outline'
|
|
56
|
+
- `size`: 'sm' | 'md' | 'lg'
|
|
57
|
+
- `isLoading`: boolean
|
|
58
|
+
- `leftIcon`, `rightIcon`: React.ReactNode
|
|
59
|
+
- `fullWidth`: boolean
|
|
60
|
+
|
|
61
|
+
#### Badge
|
|
62
|
+
Display status, categories, or labels.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Badge variant="success" size="md">Active</Badge>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Props:**
|
|
69
|
+
- `variant`: 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info' | 'gray' | 'purple' | etc.
|
|
70
|
+
- `size`: 'sm' | 'md' | 'lg'
|
|
71
|
+
- `customColors`: { background, text, border }
|
|
72
|
+
|
|
73
|
+
#### Card
|
|
74
|
+
Flexible container component with header, content, and footer sections.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<Card
|
|
78
|
+
title="Card Title"
|
|
79
|
+
subtitle="Subtitle"
|
|
80
|
+
icon={IconComponent}
|
|
81
|
+
variant="default"
|
|
82
|
+
>
|
|
83
|
+
Card content
|
|
84
|
+
</Card>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Variants:**
|
|
88
|
+
- `SimpleCard`: Basic card
|
|
89
|
+
- `HeaderCard`: Card with header section
|
|
90
|
+
- `StatusCard`: Card with status indicator
|
|
91
|
+
- `ClickableCard`: Interactive card
|
|
92
|
+
- `AccordionCard`: Collapsible card
|
|
93
|
+
|
|
94
|
+
#### Link
|
|
95
|
+
Next.js Link wrapper with consistent styling.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<Link href="/dashboard" variant="primary">
|
|
99
|
+
Go to Dashboard
|
|
100
|
+
</Link>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Form Components
|
|
104
|
+
|
|
105
|
+
#### FormInput
|
|
106
|
+
Comprehensive form input supporting multiple types.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<FormInput
|
|
110
|
+
label="Username"
|
|
111
|
+
name="username"
|
|
112
|
+
type="text"
|
|
113
|
+
value={value}
|
|
114
|
+
onChange={handleChange}
|
|
115
|
+
required
|
|
116
|
+
error={errors.username}
|
|
117
|
+
description="Enter your username"
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Supported Types:**
|
|
122
|
+
- text, email, password, number, tel, url
|
|
123
|
+
- checkbox, textarea, color
|
|
124
|
+
|
|
125
|
+
**Features:**
|
|
126
|
+
- Icon support (left/right)
|
|
127
|
+
- Password visibility toggle
|
|
128
|
+
- Copy to clipboard
|
|
129
|
+
- Clear button
|
|
130
|
+
- Loading states
|
|
131
|
+
- Error handling
|
|
132
|
+
|
|
133
|
+
#### Switch
|
|
134
|
+
Toggle switch component.
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
<Switch
|
|
138
|
+
checked={enabled}
|
|
139
|
+
onChange={setEnabled}
|
|
140
|
+
label="Enable feature"
|
|
141
|
+
description="Turn this on to enable the feature"
|
|
142
|
+
/>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### UI Components
|
|
146
|
+
|
|
147
|
+
#### Modal
|
|
148
|
+
Accessible modal dialog with animations.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<Modal
|
|
152
|
+
isOpen={isOpen}
|
|
153
|
+
onClose={handleClose}
|
|
154
|
+
title="Modal Title"
|
|
155
|
+
size="md"
|
|
156
|
+
>
|
|
157
|
+
Modal content
|
|
158
|
+
</Modal>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Props:**
|
|
162
|
+
- `size`: 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
163
|
+
- `blocking`: boolean (prevents closing)
|
|
164
|
+
- `variant`: 'default' | 'plain'
|
|
165
|
+
- `fullScreen`: boolean
|
|
166
|
+
|
|
167
|
+
#### LoadingSpinner
|
|
168
|
+
Animated loading indicator.
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
<LoadingSpinner message="Loading..." showMessage />
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Layout Components
|
|
175
|
+
|
|
176
|
+
#### PageHeader
|
|
177
|
+
Consistent page header with title, subtitle, and actions.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<PageHeader
|
|
181
|
+
icon={IconComponent}
|
|
182
|
+
title="Page Title"
|
|
183
|
+
subtitle="Page description"
|
|
184
|
+
rightContent={<Button>Action</Button>}
|
|
185
|
+
/>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### FormSection
|
|
189
|
+
Organize form fields into logical sections.
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<FormSection
|
|
193
|
+
title="Account Settings"
|
|
194
|
+
description="Manage your account preferences"
|
|
195
|
+
>
|
|
196
|
+
<FormInput... />
|
|
197
|
+
<FormInput... />
|
|
198
|
+
</FormSection>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Grid & GridItem
|
|
202
|
+
Responsive grid layout system.
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
<Grid cols={3} gap={4}>
|
|
206
|
+
<GridItem span={1}>Content 1</GridItem>
|
|
207
|
+
<GridItem span={2}>Content 2</GridItem>
|
|
208
|
+
</Grid>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Styling
|
|
212
|
+
|
|
213
|
+
All components use Tailwind CSS utility classes and expect your project to have Tailwind configured. The components use semantic color tokens like:
|
|
214
|
+
|
|
215
|
+
- `primary`, `secondary`, `destructive`
|
|
216
|
+
- `foreground`, `background`, `muted`
|
|
217
|
+
- `border`, `ring`, `success`, `error`
|
|
218
|
+
|
|
219
|
+
Make sure these are defined in your Tailwind theme.
|
|
220
|
+
|
|
221
|
+
## TypeScript
|
|
222
|
+
|
|
223
|
+
All components are fully typed with TypeScript. Import types as needed:
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import type { ButtonProps, BadgeVariant } from '@gamecp/ui';
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# Install dependencies
|
|
233
|
+
npm install
|
|
234
|
+
|
|
235
|
+
# Build the library
|
|
236
|
+
npm run build
|
|
237
|
+
|
|
238
|
+
# Watch mode for development
|
|
239
|
+
npm run dev
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ButtonHTMLAttributes, ReactNode, AnchorHTMLAttributes } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { IconType } from 'react-icons';
|
|
5
|
+
|
|
6
|
+
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost' | 'link' | 'outline';
|
|
7
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
8
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
leftIcon?: React__default.ReactNode;
|
|
13
|
+
rightIcon?: React__default.ReactNode;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
|
|
18
|
+
type BadgeVariant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'gray' | 'purple' | 'pink' | 'indigo' | 'yellow' | 'orange' | 'teal' | 'cyan' | 'lime' | 'emerald' | 'rose' | 'sky' | 'violet' | 'fuchsia' | 'amber' | 'custom';
|
|
19
|
+
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
20
|
+
interface BadgeProps {
|
|
21
|
+
children: React__default.ReactNode;
|
|
22
|
+
variant?: BadgeVariant;
|
|
23
|
+
size?: BadgeSize;
|
|
24
|
+
className?: string;
|
|
25
|
+
customColors?: {
|
|
26
|
+
background: string;
|
|
27
|
+
text: string;
|
|
28
|
+
border?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare function Badge({ children, variant, size, className, customColors, }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
declare const SuccessBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare const WarningBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare const ErrorBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare const InfoBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare const PrimaryBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare const GrayBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function StatusBadge({ isActive, activeText, inactiveText, ...props }: {
|
|
39
|
+
isActive: boolean;
|
|
40
|
+
activeText?: string;
|
|
41
|
+
inactiveText?: string;
|
|
42
|
+
} & Omit<BadgeProps, 'children' | 'variant'>): react_jsx_runtime.JSX.Element;
|
|
43
|
+
|
|
44
|
+
interface BaseCardProps {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
className?: string;
|
|
47
|
+
onClick?: () => void;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
type CardPadding = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
51
|
+
type BorderAccent = 'none' | 'green' | 'blue' | 'red' | 'yellow' | 'purple' | 'orange' | 'gray';
|
|
52
|
+
type CardVariant = 'default' | 'elevated' | 'outlined' | 'filled';
|
|
53
|
+
interface InteractiveCardProps extends BaseCardProps {
|
|
54
|
+
hover?: boolean;
|
|
55
|
+
clickable?: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface HeaderCardProps extends InteractiveCardProps {
|
|
58
|
+
title?: string;
|
|
59
|
+
subtitle?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
icon?: IconType;
|
|
62
|
+
iconColor?: 'green' | 'blue' | 'red' | 'yellow' | 'purple' | 'orange' | 'gray' | 'indigo' | 'pink';
|
|
63
|
+
iconSize?: 'sm' | 'md' | 'lg';
|
|
64
|
+
actionButton?: ReactNode;
|
|
65
|
+
headerClassName?: string;
|
|
66
|
+
}
|
|
67
|
+
interface AccordionCardProps extends HeaderCardProps {
|
|
68
|
+
accordion?: boolean;
|
|
69
|
+
defaultExpanded?: boolean;
|
|
70
|
+
onToggle?: (isExpanded: boolean) => void;
|
|
71
|
+
contentClassName?: string;
|
|
72
|
+
}
|
|
73
|
+
interface StatusCardProps extends HeaderCardProps {
|
|
74
|
+
status?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
75
|
+
statusIcon?: ReactNode;
|
|
76
|
+
statusText?: string;
|
|
77
|
+
}
|
|
78
|
+
interface CardProps extends AccordionCardProps, StatusCardProps {
|
|
79
|
+
padding?: CardPadding;
|
|
80
|
+
borderAccent?: BorderAccent;
|
|
81
|
+
variant?: CardVariant;
|
|
82
|
+
overflow?: 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
83
|
+
minHeight?: string;
|
|
84
|
+
maxHeight?: string;
|
|
85
|
+
}
|
|
86
|
+
declare function Card({ children, className, onClick, disabled, padding, borderAccent, variant, overflow, minHeight, maxHeight, hover, clickable, title, subtitle, description, icon: Icon, iconColor, iconSize, actionButton, headerClassName, accordion, defaultExpanded, onToggle, contentClassName, status, statusIcon, statusText, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
87
|
+
declare function SimpleCard({ children, className, ...props }: BaseCardProps): react_jsx_runtime.JSX.Element;
|
|
88
|
+
declare function HeaderCard({ title, subtitle, description, icon, iconColor, iconSize, actionButton, children, className, ...props }: HeaderCardProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
declare function StatusCard({ status, statusIcon, statusText, children, className, ...props }: StatusCardProps): react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare function ClickableCard({ onClick, children, className, ...props }: InteractiveCardProps): react_jsx_runtime.JSX.Element;
|
|
91
|
+
declare function AccordionCard({ accordion, children, className, ...props }: AccordionCardProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
|
|
93
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
94
|
+
href: string;
|
|
95
|
+
variant?: 'default' | 'primary' | 'muted';
|
|
96
|
+
underline?: boolean;
|
|
97
|
+
external?: boolean;
|
|
98
|
+
}
|
|
99
|
+
declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
100
|
+
|
|
101
|
+
type IconConfig = React__default.ReactNode | {
|
|
102
|
+
left?: React__default.ReactNode;
|
|
103
|
+
right?: React__default.ReactNode;
|
|
104
|
+
};
|
|
105
|
+
interface FormInputProps {
|
|
106
|
+
label: string;
|
|
107
|
+
name: string;
|
|
108
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'checkbox' | 'textarea' | 'color';
|
|
109
|
+
value: string | number | boolean;
|
|
110
|
+
onChange: (e: React__default.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
111
|
+
placeholder?: string;
|
|
112
|
+
required?: boolean;
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
error?: string | React__default.ReactNode;
|
|
115
|
+
className?: string;
|
|
116
|
+
inputClassName?: string;
|
|
117
|
+
min?: number;
|
|
118
|
+
max?: number;
|
|
119
|
+
step?: number;
|
|
120
|
+
maxLength?: number;
|
|
121
|
+
autoComplete?: string;
|
|
122
|
+
description?: string | React__default.ReactNode;
|
|
123
|
+
footerDescription?: string | React__default.ReactNode;
|
|
124
|
+
autoFocus?: boolean;
|
|
125
|
+
onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
126
|
+
onBlur?: (e: React__default.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
127
|
+
icon?: IconConfig;
|
|
128
|
+
rows?: number;
|
|
129
|
+
showHidePassword?: boolean;
|
|
130
|
+
onGeneratePassword?: () => void;
|
|
131
|
+
copyable?: boolean;
|
|
132
|
+
readOnly?: boolean;
|
|
133
|
+
clearable?: boolean;
|
|
134
|
+
}
|
|
135
|
+
declare function FormInput({ label, name, type, value, onChange, placeholder, required, disabled, error, className, inputClassName, min, max, step, maxLength, autoComplete, description, footerDescription, autoFocus, onKeyDown, onBlur, icon, rows, showHidePassword, onGeneratePassword, copyable, readOnly, clearable, }: FormInputProps): react_jsx_runtime.JSX.Element;
|
|
136
|
+
|
|
137
|
+
interface SwitchProps {
|
|
138
|
+
checked: boolean;
|
|
139
|
+
onChange: (checked: boolean) => void;
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
label?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
className?: string;
|
|
144
|
+
size?: 'sm' | 'md' | 'lg';
|
|
145
|
+
}
|
|
146
|
+
declare function Switch({ checked, onChange, disabled, label, description, className, size, }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
147
|
+
|
|
148
|
+
interface ModalProps {
|
|
149
|
+
isOpen: boolean;
|
|
150
|
+
onClose: () => void;
|
|
151
|
+
children: ReactNode;
|
|
152
|
+
title?: string;
|
|
153
|
+
header?: ReactNode;
|
|
154
|
+
blocking?: boolean;
|
|
155
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
156
|
+
className?: string;
|
|
157
|
+
footer?: ReactNode;
|
|
158
|
+
fullScreen?: boolean;
|
|
159
|
+
noPadding?: boolean;
|
|
160
|
+
footerBg?: 'white' | 'gray';
|
|
161
|
+
variant?: 'default' | 'plain';
|
|
162
|
+
scrollable?: boolean;
|
|
163
|
+
'aria-describedby'?: string;
|
|
164
|
+
customStyles?: {
|
|
165
|
+
container?: string;
|
|
166
|
+
backdrop?: string;
|
|
167
|
+
content?: string;
|
|
168
|
+
header?: string;
|
|
169
|
+
footer?: string;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
declare function Modal({ isOpen, onClose, children, title, header, blocking, size, className, footer, fullScreen, noPadding, footerBg, variant, scrollable, 'aria-describedby': ariaDescribedBy, customStyles, }: ModalProps): React.ReactPortal | null;
|
|
173
|
+
|
|
174
|
+
interface LoadingSpinnerProps {
|
|
175
|
+
message?: string;
|
|
176
|
+
className?: string;
|
|
177
|
+
showMessage?: boolean;
|
|
178
|
+
}
|
|
179
|
+
declare const LoadingSpinner: ({ message, className, showMessage, }: LoadingSpinnerProps) => react_jsx_runtime.JSX.Element;
|
|
180
|
+
|
|
181
|
+
interface PageHeaderProps {
|
|
182
|
+
icon?: IconType;
|
|
183
|
+
title: string;
|
|
184
|
+
subtitle?: string;
|
|
185
|
+
rightContent?: React__default.ReactNode;
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
declare function PageHeader({ icon: Icon, title, subtitle, rightContent, className, }: PageHeaderProps): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
interface FormSectionProps {
|
|
191
|
+
title: string;
|
|
192
|
+
description?: string;
|
|
193
|
+
children: ReactNode;
|
|
194
|
+
className?: string;
|
|
195
|
+
}
|
|
196
|
+
declare function FormSection({ title, description, children, className, }: FormSectionProps): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
interface GridProps {
|
|
199
|
+
children: React__default.ReactNode;
|
|
200
|
+
cols?: 1 | 2 | 3 | 4 | 5 | 6 | 12;
|
|
201
|
+
gap?: 1 | 2 | 3 | 4 | 6 | 8;
|
|
202
|
+
className?: string;
|
|
203
|
+
}
|
|
204
|
+
declare function Grid({ children, cols, gap, className, }: GridProps): react_jsx_runtime.JSX.Element;
|
|
205
|
+
declare function GridItem({ children, span, className, }: {
|
|
206
|
+
children: React__default.ReactNode;
|
|
207
|
+
span?: number;
|
|
208
|
+
className?: string;
|
|
209
|
+
}): react_jsx_runtime.JSX.Element;
|
|
210
|
+
|
|
211
|
+
export { AccordionCard, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ClickableCard, ErrorBadge, FormInput, FormSection, GrayBadge, Grid, GridItem, HeaderCard, InfoBadge, Link, type LinkProps, LoadingSpinner, Modal, PageHeader, PrimaryBadge, SimpleCard, StatusBadge, StatusCard, SuccessBadge, Switch, WarningBadge };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ButtonHTMLAttributes, ReactNode, AnchorHTMLAttributes } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { IconType } from 'react-icons';
|
|
5
|
+
|
|
6
|
+
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost' | 'link' | 'outline';
|
|
7
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
8
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
leftIcon?: React__default.ReactNode;
|
|
13
|
+
rightIcon?: React__default.ReactNode;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
|
|
18
|
+
type BadgeVariant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'gray' | 'purple' | 'pink' | 'indigo' | 'yellow' | 'orange' | 'teal' | 'cyan' | 'lime' | 'emerald' | 'rose' | 'sky' | 'violet' | 'fuchsia' | 'amber' | 'custom';
|
|
19
|
+
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
20
|
+
interface BadgeProps {
|
|
21
|
+
children: React__default.ReactNode;
|
|
22
|
+
variant?: BadgeVariant;
|
|
23
|
+
size?: BadgeSize;
|
|
24
|
+
className?: string;
|
|
25
|
+
customColors?: {
|
|
26
|
+
background: string;
|
|
27
|
+
text: string;
|
|
28
|
+
border?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare function Badge({ children, variant, size, className, customColors, }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
declare const SuccessBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare const WarningBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare const ErrorBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare const InfoBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare const PrimaryBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare const GrayBadge: (props: Omit<BadgeProps, "variant">) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function StatusBadge({ isActive, activeText, inactiveText, ...props }: {
|
|
39
|
+
isActive: boolean;
|
|
40
|
+
activeText?: string;
|
|
41
|
+
inactiveText?: string;
|
|
42
|
+
} & Omit<BadgeProps, 'children' | 'variant'>): react_jsx_runtime.JSX.Element;
|
|
43
|
+
|
|
44
|
+
interface BaseCardProps {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
className?: string;
|
|
47
|
+
onClick?: () => void;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
type CardPadding = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
51
|
+
type BorderAccent = 'none' | 'green' | 'blue' | 'red' | 'yellow' | 'purple' | 'orange' | 'gray';
|
|
52
|
+
type CardVariant = 'default' | 'elevated' | 'outlined' | 'filled';
|
|
53
|
+
interface InteractiveCardProps extends BaseCardProps {
|
|
54
|
+
hover?: boolean;
|
|
55
|
+
clickable?: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface HeaderCardProps extends InteractiveCardProps {
|
|
58
|
+
title?: string;
|
|
59
|
+
subtitle?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
icon?: IconType;
|
|
62
|
+
iconColor?: 'green' | 'blue' | 'red' | 'yellow' | 'purple' | 'orange' | 'gray' | 'indigo' | 'pink';
|
|
63
|
+
iconSize?: 'sm' | 'md' | 'lg';
|
|
64
|
+
actionButton?: ReactNode;
|
|
65
|
+
headerClassName?: string;
|
|
66
|
+
}
|
|
67
|
+
interface AccordionCardProps extends HeaderCardProps {
|
|
68
|
+
accordion?: boolean;
|
|
69
|
+
defaultExpanded?: boolean;
|
|
70
|
+
onToggle?: (isExpanded: boolean) => void;
|
|
71
|
+
contentClassName?: string;
|
|
72
|
+
}
|
|
73
|
+
interface StatusCardProps extends HeaderCardProps {
|
|
74
|
+
status?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
75
|
+
statusIcon?: ReactNode;
|
|
76
|
+
statusText?: string;
|
|
77
|
+
}
|
|
78
|
+
interface CardProps extends AccordionCardProps, StatusCardProps {
|
|
79
|
+
padding?: CardPadding;
|
|
80
|
+
borderAccent?: BorderAccent;
|
|
81
|
+
variant?: CardVariant;
|
|
82
|
+
overflow?: 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
83
|
+
minHeight?: string;
|
|
84
|
+
maxHeight?: string;
|
|
85
|
+
}
|
|
86
|
+
declare function Card({ children, className, onClick, disabled, padding, borderAccent, variant, overflow, minHeight, maxHeight, hover, clickable, title, subtitle, description, icon: Icon, iconColor, iconSize, actionButton, headerClassName, accordion, defaultExpanded, onToggle, contentClassName, status, statusIcon, statusText, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
87
|
+
declare function SimpleCard({ children, className, ...props }: BaseCardProps): react_jsx_runtime.JSX.Element;
|
|
88
|
+
declare function HeaderCard({ title, subtitle, description, icon, iconColor, iconSize, actionButton, children, className, ...props }: HeaderCardProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
declare function StatusCard({ status, statusIcon, statusText, children, className, ...props }: StatusCardProps): react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare function ClickableCard({ onClick, children, className, ...props }: InteractiveCardProps): react_jsx_runtime.JSX.Element;
|
|
91
|
+
declare function AccordionCard({ accordion, children, className, ...props }: AccordionCardProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
|
|
93
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
94
|
+
href: string;
|
|
95
|
+
variant?: 'default' | 'primary' | 'muted';
|
|
96
|
+
underline?: boolean;
|
|
97
|
+
external?: boolean;
|
|
98
|
+
}
|
|
99
|
+
declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
100
|
+
|
|
101
|
+
type IconConfig = React__default.ReactNode | {
|
|
102
|
+
left?: React__default.ReactNode;
|
|
103
|
+
right?: React__default.ReactNode;
|
|
104
|
+
};
|
|
105
|
+
interface FormInputProps {
|
|
106
|
+
label: string;
|
|
107
|
+
name: string;
|
|
108
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'checkbox' | 'textarea' | 'color';
|
|
109
|
+
value: string | number | boolean;
|
|
110
|
+
onChange: (e: React__default.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
111
|
+
placeholder?: string;
|
|
112
|
+
required?: boolean;
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
error?: string | React__default.ReactNode;
|
|
115
|
+
className?: string;
|
|
116
|
+
inputClassName?: string;
|
|
117
|
+
min?: number;
|
|
118
|
+
max?: number;
|
|
119
|
+
step?: number;
|
|
120
|
+
maxLength?: number;
|
|
121
|
+
autoComplete?: string;
|
|
122
|
+
description?: string | React__default.ReactNode;
|
|
123
|
+
footerDescription?: string | React__default.ReactNode;
|
|
124
|
+
autoFocus?: boolean;
|
|
125
|
+
onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
126
|
+
onBlur?: (e: React__default.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
127
|
+
icon?: IconConfig;
|
|
128
|
+
rows?: number;
|
|
129
|
+
showHidePassword?: boolean;
|
|
130
|
+
onGeneratePassword?: () => void;
|
|
131
|
+
copyable?: boolean;
|
|
132
|
+
readOnly?: boolean;
|
|
133
|
+
clearable?: boolean;
|
|
134
|
+
}
|
|
135
|
+
declare function FormInput({ label, name, type, value, onChange, placeholder, required, disabled, error, className, inputClassName, min, max, step, maxLength, autoComplete, description, footerDescription, autoFocus, onKeyDown, onBlur, icon, rows, showHidePassword, onGeneratePassword, copyable, readOnly, clearable, }: FormInputProps): react_jsx_runtime.JSX.Element;
|
|
136
|
+
|
|
137
|
+
interface SwitchProps {
|
|
138
|
+
checked: boolean;
|
|
139
|
+
onChange: (checked: boolean) => void;
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
label?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
className?: string;
|
|
144
|
+
size?: 'sm' | 'md' | 'lg';
|
|
145
|
+
}
|
|
146
|
+
declare function Switch({ checked, onChange, disabled, label, description, className, size, }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
147
|
+
|
|
148
|
+
interface ModalProps {
|
|
149
|
+
isOpen: boolean;
|
|
150
|
+
onClose: () => void;
|
|
151
|
+
children: ReactNode;
|
|
152
|
+
title?: string;
|
|
153
|
+
header?: ReactNode;
|
|
154
|
+
blocking?: boolean;
|
|
155
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
156
|
+
className?: string;
|
|
157
|
+
footer?: ReactNode;
|
|
158
|
+
fullScreen?: boolean;
|
|
159
|
+
noPadding?: boolean;
|
|
160
|
+
footerBg?: 'white' | 'gray';
|
|
161
|
+
variant?: 'default' | 'plain';
|
|
162
|
+
scrollable?: boolean;
|
|
163
|
+
'aria-describedby'?: string;
|
|
164
|
+
customStyles?: {
|
|
165
|
+
container?: string;
|
|
166
|
+
backdrop?: string;
|
|
167
|
+
content?: string;
|
|
168
|
+
header?: string;
|
|
169
|
+
footer?: string;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
declare function Modal({ isOpen, onClose, children, title, header, blocking, size, className, footer, fullScreen, noPadding, footerBg, variant, scrollable, 'aria-describedby': ariaDescribedBy, customStyles, }: ModalProps): React.ReactPortal | null;
|
|
173
|
+
|
|
174
|
+
interface LoadingSpinnerProps {
|
|
175
|
+
message?: string;
|
|
176
|
+
className?: string;
|
|
177
|
+
showMessage?: boolean;
|
|
178
|
+
}
|
|
179
|
+
declare const LoadingSpinner: ({ message, className, showMessage, }: LoadingSpinnerProps) => react_jsx_runtime.JSX.Element;
|
|
180
|
+
|
|
181
|
+
interface PageHeaderProps {
|
|
182
|
+
icon?: IconType;
|
|
183
|
+
title: string;
|
|
184
|
+
subtitle?: string;
|
|
185
|
+
rightContent?: React__default.ReactNode;
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
declare function PageHeader({ icon: Icon, title, subtitle, rightContent, className, }: PageHeaderProps): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
interface FormSectionProps {
|
|
191
|
+
title: string;
|
|
192
|
+
description?: string;
|
|
193
|
+
children: ReactNode;
|
|
194
|
+
className?: string;
|
|
195
|
+
}
|
|
196
|
+
declare function FormSection({ title, description, children, className, }: FormSectionProps): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
interface GridProps {
|
|
199
|
+
children: React__default.ReactNode;
|
|
200
|
+
cols?: 1 | 2 | 3 | 4 | 5 | 6 | 12;
|
|
201
|
+
gap?: 1 | 2 | 3 | 4 | 6 | 8;
|
|
202
|
+
className?: string;
|
|
203
|
+
}
|
|
204
|
+
declare function Grid({ children, cols, gap, className, }: GridProps): react_jsx_runtime.JSX.Element;
|
|
205
|
+
declare function GridItem({ children, span, className, }: {
|
|
206
|
+
children: React__default.ReactNode;
|
|
207
|
+
span?: number;
|
|
208
|
+
className?: string;
|
|
209
|
+
}): react_jsx_runtime.JSX.Element;
|
|
210
|
+
|
|
211
|
+
export { AccordionCard, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ClickableCard, ErrorBadge, FormInput, FormSection, GrayBadge, Grid, GridItem, HeaderCard, InfoBadge, Link, type LinkProps, LoadingSpinner, Modal, PageHeader, PrimaryBadge, SimpleCard, StatusBadge, StatusCard, SuccessBadge, Switch, WarningBadge };
|