@gamecp/ui 0.1.0 → 0.1.13
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/dist/index.d.mts +198 -70
- package/dist/index.d.ts +198 -70
- package/dist/index.js +1349 -567
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1343 -558
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import React__default, { ButtonHTMLAttributes, ReactNode, AnchorHTMLAttributes } from 'react';
|
|
3
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { ButtonHTMLAttributes, ReactNode, AnchorHTMLAttributes } from 'react';
|
|
4
4
|
import { IconType } from 'react-icons';
|
|
5
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
6
|
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
7
|
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
20
8
|
interface BadgeProps {
|
|
@@ -29,17 +17,18 @@ interface BadgeProps {
|
|
|
29
17
|
};
|
|
30
18
|
}
|
|
31
19
|
declare function Badge({ children, variant, size, className, customColors, }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
20
|
+
|
|
21
|
+
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'danger' | 'ghost' | 'link' | 'outline';
|
|
22
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
23
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
24
|
+
variant?: ButtonVariant;
|
|
25
|
+
size?: ButtonSize;
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
leftIcon?: React__default.ReactNode;
|
|
28
|
+
rightIcon?: React__default.ReactNode;
|
|
29
|
+
fullWidth?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
43
32
|
|
|
44
33
|
interface BaseCardProps {
|
|
45
34
|
children: ReactNode;
|
|
@@ -82,32 +71,82 @@ interface CardProps extends AccordionCardProps, StatusCardProps {
|
|
|
82
71
|
overflow?: 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
83
72
|
minHeight?: string;
|
|
84
73
|
maxHeight?: string;
|
|
74
|
+
id?: string;
|
|
85
75
|
}
|
|
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;
|
|
76
|
+
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, id, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
92
77
|
|
|
93
|
-
interface
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
78
|
+
interface ConfirmDialogOptions {
|
|
79
|
+
title: string;
|
|
80
|
+
message: string;
|
|
81
|
+
confirmText: string;
|
|
82
|
+
cancelText?: string;
|
|
83
|
+
confirmButtonColor?: 'red' | 'blue' | 'green';
|
|
98
84
|
}
|
|
99
|
-
|
|
85
|
+
interface ConfirmDialogProps {
|
|
86
|
+
isOpen: boolean;
|
|
87
|
+
options: ConfirmDialogOptions;
|
|
88
|
+
onConfirm: () => void;
|
|
89
|
+
onCancel: () => void;
|
|
90
|
+
}
|
|
91
|
+
declare function ConfirmDialog({ isOpen, options, onConfirm, onCancel }: ConfirmDialogProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
/**
|
|
93
|
+
* Hook to use confirmation dialogs
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* const { confirm } = useConfirmDialog();
|
|
98
|
+
*
|
|
99
|
+
* const handleDelete = async () => {
|
|
100
|
+
* const confirmed = await confirm({
|
|
101
|
+
* title: 'Delete Item',
|
|
102
|
+
* message: 'Are you sure you want to delete this item?',
|
|
103
|
+
* confirmText: 'Delete',
|
|
104
|
+
* confirmButtonColor: 'red'
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* if (confirmed) {
|
|
108
|
+
* // Delete the item
|
|
109
|
+
* }
|
|
110
|
+
* };
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function useConfirmDialog(): {
|
|
114
|
+
confirm: (opts: ConfirmDialogOptions) => Promise<boolean>;
|
|
115
|
+
dialog: react_jsx_runtime.JSX.Element;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
interface ContainerProps {
|
|
119
|
+
children: React__default.ReactNode;
|
|
120
|
+
className?: string;
|
|
121
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
122
|
+
id?: string;
|
|
123
|
+
}
|
|
124
|
+
declare function Container({ children, className, padding, id }: ContainerProps): react_jsx_runtime.JSX.Element;
|
|
125
|
+
|
|
126
|
+
interface EmptyStateProps {
|
|
127
|
+
icon: IconType;
|
|
128
|
+
title: string;
|
|
129
|
+
subtitle: string;
|
|
130
|
+
action?: React__default.ReactNode;
|
|
131
|
+
className?: string;
|
|
132
|
+
}
|
|
133
|
+
declare const EmptyState: React__default.FC<EmptyStateProps>;
|
|
100
134
|
|
|
135
|
+
interface SelectOption {
|
|
136
|
+
value: string;
|
|
137
|
+
label: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
}
|
|
101
140
|
type IconConfig = React__default.ReactNode | {
|
|
102
141
|
left?: React__default.ReactNode;
|
|
103
142
|
right?: React__default.ReactNode;
|
|
104
143
|
};
|
|
105
144
|
interface FormInputProps {
|
|
106
|
-
label
|
|
145
|
+
label?: string;
|
|
107
146
|
name: string;
|
|
108
|
-
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'checkbox' | 'textarea' | 'color';
|
|
147
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'select' | 'checkbox' | 'textarea' | 'color';
|
|
109
148
|
value: string | number | boolean;
|
|
110
|
-
onChange: (e: React__default.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
149
|
+
onChange: (e: React__default.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
111
150
|
placeholder?: string;
|
|
112
151
|
required?: boolean;
|
|
113
152
|
disabled?: boolean;
|
|
@@ -125,25 +164,50 @@ interface FormInputProps {
|
|
|
125
164
|
onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
126
165
|
onBlur?: (e: React__default.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
127
166
|
icon?: IconConfig;
|
|
167
|
+
options?: SelectOption[];
|
|
168
|
+
multiSelect?: boolean;
|
|
169
|
+
selectWidth?: number;
|
|
170
|
+
searchable?: boolean;
|
|
171
|
+
clearable?: boolean;
|
|
128
172
|
rows?: number;
|
|
129
173
|
showHidePassword?: boolean;
|
|
130
174
|
onGeneratePassword?: () => void;
|
|
175
|
+
isLoading?: boolean;
|
|
131
176
|
copyable?: boolean;
|
|
132
177
|
readOnly?: boolean;
|
|
133
|
-
clearable?: boolean;
|
|
134
178
|
}
|
|
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,
|
|
179
|
+
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, options, multiSelect, selectWidth, searchable, clearable, rows, showHidePassword, onGeneratePassword, isLoading, copyable, readOnly, }: FormInputProps): react_jsx_runtime.JSX.Element;
|
|
136
180
|
|
|
137
|
-
interface
|
|
138
|
-
|
|
139
|
-
onChange: (checked: boolean) => void;
|
|
140
|
-
disabled?: boolean;
|
|
141
|
-
label?: string;
|
|
181
|
+
interface FormSectionProps {
|
|
182
|
+
title: string;
|
|
142
183
|
description?: string;
|
|
184
|
+
children: ReactNode;
|
|
143
185
|
className?: string;
|
|
144
|
-
size?: 'sm' | 'md' | 'lg';
|
|
145
186
|
}
|
|
146
|
-
declare function
|
|
187
|
+
declare function FormSection({ title, description, children, className, }: FormSectionProps): react_jsx_runtime.JSX.Element;
|
|
188
|
+
|
|
189
|
+
interface GridProps {
|
|
190
|
+
children: React__default.ReactNode;
|
|
191
|
+
cols?: 1 | 2 | 3 | 4 | 5 | 6 | 12;
|
|
192
|
+
gap?: 1 | 2 | 3 | 4 | 6 | 8;
|
|
193
|
+
className?: string;
|
|
194
|
+
}
|
|
195
|
+
declare function Grid({ children, cols, gap, className, }: GridProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
|
|
197
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
198
|
+
href: string;
|
|
199
|
+
variant?: 'default' | 'primary' | 'muted';
|
|
200
|
+
underline?: boolean;
|
|
201
|
+
external?: boolean;
|
|
202
|
+
}
|
|
203
|
+
declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
204
|
+
|
|
205
|
+
interface LoadingSpinnerProps {
|
|
206
|
+
message?: string;
|
|
207
|
+
className?: string;
|
|
208
|
+
showMessage?: boolean;
|
|
209
|
+
}
|
|
210
|
+
declare const LoadingSpinner: ({ message, className, showMessage, }: LoadingSpinnerProps) => react_jsx_runtime.JSX.Element;
|
|
147
211
|
|
|
148
212
|
interface ModalProps {
|
|
149
213
|
isOpen: boolean;
|
|
@@ -169,14 +233,7 @@ interface ModalProps {
|
|
|
169
233
|
footer?: string;
|
|
170
234
|
};
|
|
171
235
|
}
|
|
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;
|
|
236
|
+
declare function Modal({ isOpen, onClose, children, title, header, blocking, size, className, footer, fullScreen, noPadding, footerBg, variant, scrollable, 'aria-describedby': ariaDescribedBy, customStyles, }: ModalProps): React$1.ReactPortal | null;
|
|
180
237
|
|
|
181
238
|
interface PageHeaderProps {
|
|
182
239
|
icon?: IconType;
|
|
@@ -187,25 +244,96 @@ interface PageHeaderProps {
|
|
|
187
244
|
}
|
|
188
245
|
declare function PageHeader({ icon: Icon, title, subtitle, rightContent, className, }: PageHeaderProps): react_jsx_runtime.JSX.Element;
|
|
189
246
|
|
|
190
|
-
interface
|
|
191
|
-
|
|
247
|
+
interface SwitchProps {
|
|
248
|
+
checked: boolean;
|
|
249
|
+
onChange: (checked: boolean) => void;
|
|
250
|
+
disabled?: boolean;
|
|
251
|
+
label?: string;
|
|
192
252
|
description?: string;
|
|
193
|
-
children: ReactNode;
|
|
194
253
|
className?: string;
|
|
254
|
+
size?: 'sm' | 'md' | 'lg';
|
|
195
255
|
}
|
|
196
|
-
declare function
|
|
256
|
+
declare function Switch({ checked, onChange, disabled, label, description, className, size, }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
197
257
|
|
|
198
|
-
interface
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
258
|
+
interface SmartDropdownProps {
|
|
259
|
+
isOpen: boolean;
|
|
260
|
+
onClose: () => void;
|
|
261
|
+
trigger: ReactNode;
|
|
262
|
+
children: ReactNode | ((position: {
|
|
263
|
+
isAbove: boolean;
|
|
264
|
+
}) => ReactNode);
|
|
202
265
|
className?: string;
|
|
266
|
+
width?: number | 'auto' | 'fit-content';
|
|
267
|
+
maxHeight?: number;
|
|
268
|
+
offset?: number;
|
|
269
|
+
margin?: number;
|
|
270
|
+
id?: string;
|
|
271
|
+
position?: 'auto' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-left-aligned' | 'bottom-left-aligned';
|
|
203
272
|
}
|
|
204
|
-
declare function
|
|
205
|
-
|
|
273
|
+
declare function SmartDropdown({ isOpen, onClose, trigger, children, className, width, maxHeight, offset, margin, id, position, }: SmartDropdownProps): react_jsx_runtime.JSX.Element;
|
|
274
|
+
interface Option {
|
|
275
|
+
value: string;
|
|
276
|
+
label: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
icon?: React.ReactNode;
|
|
279
|
+
metadata?: {
|
|
280
|
+
isDefault?: boolean;
|
|
281
|
+
args?: string[];
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
interface SmartSelectProps {
|
|
285
|
+
options: Option[];
|
|
286
|
+
value: string | string[];
|
|
287
|
+
onChange: (value: string | string[]) => void;
|
|
288
|
+
placeholder?: string;
|
|
289
|
+
className?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
disabled?: boolean;
|
|
292
|
+
multiple?: boolean;
|
|
293
|
+
width?: number;
|
|
294
|
+
searchable?: boolean;
|
|
295
|
+
keepOpen?: boolean;
|
|
296
|
+
clearable?: boolean;
|
|
297
|
+
onOpen?: () => void;
|
|
298
|
+
onClose?: () => void;
|
|
299
|
+
onSearch?: (search: string) => void;
|
|
300
|
+
isLoading?: boolean;
|
|
301
|
+
}
|
|
302
|
+
declare function SmartSelect({ options, value, onChange, placeholder, className, description, disabled, multiple, width, searchable, keepOpen, clearable, onOpen, onClose, onSearch, isLoading, }: SmartSelectProps): react_jsx_runtime.JSX.Element;
|
|
303
|
+
|
|
304
|
+
interface SkeletonProps {
|
|
305
|
+
className?: string;
|
|
306
|
+
children?: ReactNode;
|
|
307
|
+
}
|
|
308
|
+
interface SkeletonItemProps {
|
|
309
|
+
className?: string;
|
|
310
|
+
width?: string;
|
|
311
|
+
height?: string;
|
|
312
|
+
rounded?: boolean;
|
|
313
|
+
animate?: boolean;
|
|
314
|
+
}
|
|
315
|
+
declare function Skeleton({ className, children }: SkeletonProps): react_jsx_runtime.JSX.Element;
|
|
316
|
+
declare function SkeletonItem({ className, width, height, rounded, animate, }: SkeletonItemProps): react_jsx_runtime.JSX.Element;
|
|
317
|
+
|
|
318
|
+
type TypographyElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div';
|
|
319
|
+
type TypographyVariant = 'default' | 'muted' | 'bold';
|
|
320
|
+
type TypographySize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
321
|
+
interface TypographyProps {
|
|
322
|
+
as?: TypographyElement;
|
|
323
|
+
variant?: TypographyVariant;
|
|
324
|
+
size?: TypographySize;
|
|
206
325
|
children: React__default.ReactNode;
|
|
207
|
-
span?: number;
|
|
208
326
|
className?: string;
|
|
209
|
-
}
|
|
327
|
+
}
|
|
328
|
+
declare function Typography({ as: Element, variant, size, children, className }: TypographyProps): react_jsx_runtime.JSX.Element;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @gamecp/ui - GameCP UI Component Library
|
|
332
|
+
*
|
|
333
|
+
* A collection of reusable React components for GameCP extensions.
|
|
334
|
+
* All components are built with TypeScript and Tailwind CSS.
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
declare const VERSION = "0.1.3";
|
|
210
338
|
|
|
211
|
-
export {
|
|
339
|
+
export { Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, ConfirmDialog, type ConfirmDialogOptions, Container, EmptyState, FormInput, FormSection, Grid, Link, type LinkProps, LoadingSpinner, Modal, PageHeader, Skeleton, SkeletonItem, SmartDropdown, SmartSelect, Switch, Typography, VERSION, useConfirmDialog };
|