@particle-academy/react-fancy 1.0.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.
@@ -0,0 +1,393 @@
1
+ import * as react from 'react';
2
+ import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ type Size = "xs" | "sm" | "md" | "lg" | "xl";
7
+ type Color = "zinc" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
8
+ type Variant = "solid" | "outline" | "ghost" | "soft";
9
+ type ActionColor = "blue" | "emerald" | "amber" | "red" | "violet" | "indigo" | "sky" | "rose" | "orange" | "zinc";
10
+
11
+ interface ActionProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "color"> {
12
+ /** Shape variant */
13
+ variant?: "default" | "circle";
14
+ /** Standalone color (overrides state colors) */
15
+ color?: ActionColor;
16
+ size?: Size;
17
+ /** Behavioral states */
18
+ active?: boolean;
19
+ checked?: boolean;
20
+ warn?: boolean;
21
+ alert?: boolean;
22
+ /** Leading icon (ReactNode) */
23
+ icon?: ReactNode;
24
+ /** Trailing icon (convenience for right-side icon) */
25
+ iconTrailing?: ReactNode;
26
+ /** Icon placement direction */
27
+ iconPlace?: "left" | "right" | "top" | "bottom";
28
+ /** Pulsing alert icon */
29
+ alertIcon?: ReactNode;
30
+ /** Position alert icon on trailing side */
31
+ alertIconTrailing?: boolean;
32
+ /** Emoji slug (resolved via emoji-utils) */
33
+ emoji?: string;
34
+ /** Trailing emoji slug */
35
+ emojiTrailing?: string;
36
+ /** Avatar image URL */
37
+ avatar?: string;
38
+ /** Position avatar on trailing side */
39
+ avatarTrailing?: boolean;
40
+ /** Badge text */
41
+ badge?: string;
42
+ /** Position badge on trailing side */
43
+ badgeTrailing?: boolean;
44
+ /** Sort order of decorative elements: e=emoji, i=icon, a=avatar, b=badge */
45
+ sort?: string;
46
+ /** Show loading spinner */
47
+ loading?: boolean;
48
+ disabled?: boolean;
49
+ /** Render as anchor tag */
50
+ href?: string;
51
+ }
52
+
53
+ declare const Action: react.ForwardRefExoticComponent<ActionProps & react.RefAttributes<HTMLButtonElement>>;
54
+
55
+ interface FieldProps {
56
+ label?: string;
57
+ description?: string;
58
+ error?: string;
59
+ required?: boolean;
60
+ htmlFor?: string;
61
+ size?: Size;
62
+ children: ReactNode;
63
+ className?: string;
64
+ }
65
+
66
+ declare function Field({ label, description, error, required, htmlFor, size, children, className, }: FieldProps): react_jsx_runtime.JSX.Element;
67
+
68
+ type InputOption<V = string> = string | {
69
+ value: V;
70
+ label: string;
71
+ disabled?: boolean;
72
+ description?: string;
73
+ };
74
+ type InputOptionGroup<V = string> = {
75
+ label: string;
76
+ options: InputOption<V>[];
77
+ };
78
+ interface InputBaseProps {
79
+ size?: Size;
80
+ dirty?: boolean;
81
+ error?: string;
82
+ label?: string;
83
+ description?: string;
84
+ required?: boolean;
85
+ disabled?: boolean;
86
+ className?: string;
87
+ id?: string;
88
+ name?: string;
89
+ }
90
+
91
+ interface InputProps extends InputBaseProps, Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
92
+ type?: "text" | "email" | "password" | "number" | "tel" | "url" | "search";
93
+ onValueChange?: (value: string) => void;
94
+ leading?: ReactNode;
95
+ trailing?: ReactNode;
96
+ }
97
+
98
+ declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
99
+
100
+ interface TextareaProps extends InputBaseProps, Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> {
101
+ autoResize?: boolean;
102
+ minRows?: number;
103
+ maxRows?: number;
104
+ onValueChange?: (value: string) => void;
105
+ }
106
+
107
+ declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
108
+
109
+ interface SelectProps extends InputBaseProps, Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
110
+ list: InputOption[] | InputOptionGroup[];
111
+ placeholder?: string;
112
+ onValueChange?: (value: string) => void;
113
+ }
114
+
115
+ declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
116
+
117
+ interface CheckboxProps extends Omit<InputBaseProps, "label"> {
118
+ checked?: boolean;
119
+ defaultChecked?: boolean;
120
+ onCheckedChange?: (checked: boolean) => void;
121
+ indeterminate?: boolean;
122
+ label?: string;
123
+ }
124
+
125
+ declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
126
+
127
+ interface CheckboxGroupProps<V = string> extends Omit<InputBaseProps, "id"> {
128
+ list: InputOption<V>[];
129
+ value?: V[];
130
+ defaultValue?: V[];
131
+ onValueChange?: (values: V[]) => void;
132
+ orientation?: "horizontal" | "vertical";
133
+ }
134
+
135
+ declare function CheckboxGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, }: CheckboxGroupProps<V>): react_jsx_runtime.JSX.Element;
136
+ declare namespace CheckboxGroup {
137
+ var displayName: string;
138
+ }
139
+
140
+ interface RadioGroupProps<V = string> extends Omit<InputBaseProps, "id"> {
141
+ list: InputOption<V>[];
142
+ value?: V;
143
+ defaultValue?: V;
144
+ onValueChange?: (value: V) => void;
145
+ orientation?: "horizontal" | "vertical";
146
+ }
147
+
148
+ declare function RadioGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, }: RadioGroupProps<V>): react_jsx_runtime.JSX.Element;
149
+ declare namespace RadioGroup {
150
+ var displayName: string;
151
+ }
152
+
153
+ interface SwitchProps extends Omit<InputBaseProps, "label"> {
154
+ checked?: boolean;
155
+ defaultChecked?: boolean;
156
+ onCheckedChange?: (checked: boolean) => void;
157
+ color?: Color;
158
+ label?: string;
159
+ }
160
+
161
+ declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLButtonElement>>;
162
+
163
+ interface SliderBaseProps extends InputBaseProps {
164
+ min?: number;
165
+ max?: number;
166
+ step?: number;
167
+ showValue?: boolean;
168
+ marks?: {
169
+ value: number;
170
+ label?: string;
171
+ }[];
172
+ }
173
+ interface SliderSingleProps extends SliderBaseProps {
174
+ range?: false;
175
+ value?: number;
176
+ defaultValue?: number;
177
+ onValueChange?: (value: number) => void;
178
+ }
179
+ interface SliderRangeProps extends SliderBaseProps {
180
+ range: true;
181
+ value?: [number, number];
182
+ defaultValue?: [number, number];
183
+ onValueChange?: (value: [number, number]) => void;
184
+ }
185
+ type SliderProps = SliderSingleProps | SliderRangeProps;
186
+
187
+ declare const Slider: react.ForwardRefExoticComponent<SliderProps & react.RefAttributes<HTMLInputElement>>;
188
+
189
+ interface DatePickerBaseProps extends InputBaseProps {
190
+ min?: string;
191
+ max?: string;
192
+ includeTime?: boolean;
193
+ }
194
+ interface DatePickerSingleProps extends DatePickerBaseProps {
195
+ range?: false;
196
+ value?: string;
197
+ defaultValue?: string;
198
+ onValueChange?: (value: string) => void;
199
+ }
200
+ interface DatePickerRangeProps extends DatePickerBaseProps {
201
+ range: true;
202
+ value?: [string, string];
203
+ defaultValue?: [string, string];
204
+ onValueChange?: (value: [string, string]) => void;
205
+ }
206
+ type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
207
+
208
+ declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLInputElement>>;
209
+
210
+ interface CarouselContextValue {
211
+ activeIndex: number;
212
+ totalSlides: number;
213
+ next: () => void;
214
+ prev: () => void;
215
+ goTo: (index: number) => void;
216
+ registerSlides: (count: number) => void;
217
+ }
218
+ interface CarouselProps {
219
+ children: ReactNode;
220
+ defaultIndex?: number;
221
+ className?: string;
222
+ autoPlay?: boolean;
223
+ interval?: number;
224
+ }
225
+ interface CarouselSlideProps {
226
+ children: ReactNode;
227
+ className?: string;
228
+ }
229
+ interface CarouselControlsProps {
230
+ className?: string;
231
+ prevLabel?: ReactNode;
232
+ nextLabel?: ReactNode;
233
+ }
234
+ interface CarouselStepsProps {
235
+ className?: string;
236
+ }
237
+ interface CarouselPanelsProps {
238
+ children: ReactNode;
239
+ className?: string;
240
+ }
241
+
242
+ declare function CarouselPanels({ children, className }: CarouselPanelsProps): react_jsx_runtime.JSX.Element;
243
+
244
+ declare function CarouselSlide({ children, className }: CarouselSlideProps): react_jsx_runtime.JSX.Element;
245
+
246
+ declare function CarouselControls({ className, prevLabel, nextLabel, }: CarouselControlsProps): react_jsx_runtime.JSX.Element;
247
+
248
+ declare function CarouselSteps({ className }: CarouselStepsProps): react_jsx_runtime.JSX.Element;
249
+
250
+ declare function CarouselRoot({ children, defaultIndex, className, }: CarouselProps): react_jsx_runtime.JSX.Element;
251
+ declare const Carousel: typeof CarouselRoot & {
252
+ Panels: typeof CarouselPanels;
253
+ Slide: typeof CarouselSlide;
254
+ Controls: typeof CarouselControls;
255
+ Steps: typeof CarouselSteps;
256
+ };
257
+
258
+ declare function useCarousel(): CarouselContextValue;
259
+
260
+ interface ColorPickerProps {
261
+ value?: Color;
262
+ defaultValue?: Color;
263
+ onChange?: (color: Color) => void;
264
+ colors?: Color[];
265
+ size?: "sm" | "md" | "lg";
266
+ className?: string;
267
+ }
268
+
269
+ declare function ColorPicker({ value, defaultValue, onChange, colors, size, className, }: ColorPickerProps): react_jsx_runtime.JSX.Element;
270
+
271
+ interface EmojiProps {
272
+ name?: string;
273
+ emoji?: string;
274
+ size?: "sm" | "md" | "lg" | "xl";
275
+ className?: string;
276
+ }
277
+
278
+ declare function Emoji({ name, emoji, size, className }: EmojiProps): react_jsx_runtime.JSX.Element | null;
279
+
280
+ interface EmojiSelectProps {
281
+ value?: string;
282
+ defaultValue?: string;
283
+ onChange?: (emoji: string) => void;
284
+ placeholder?: string;
285
+ className?: string;
286
+ }
287
+
288
+ declare function EmojiSelect({ value, defaultValue, onChange, placeholder, className, }: EmojiSelectProps): react_jsx_runtime.JSX.Element;
289
+
290
+ interface TableProps {
291
+ children: ReactNode;
292
+ className?: string;
293
+ }
294
+ interface TableHeadProps {
295
+ children: ReactNode;
296
+ className?: string;
297
+ }
298
+ interface TableBodyProps {
299
+ children: ReactNode;
300
+ className?: string;
301
+ }
302
+ interface TableRowProps {
303
+ children: ReactNode;
304
+ className?: string;
305
+ onClick?: () => void;
306
+ }
307
+ interface TableCellProps {
308
+ children: ReactNode;
309
+ className?: string;
310
+ header?: boolean;
311
+ }
312
+ interface TableColumnProps {
313
+ label: string;
314
+ sortKey?: string;
315
+ className?: string;
316
+ }
317
+ interface TablePaginationProps {
318
+ className?: string;
319
+ total: number;
320
+ pageSize?: number;
321
+ }
322
+ interface TableSearchProps {
323
+ className?: string;
324
+ placeholder?: string;
325
+ }
326
+ interface TableTrayProps {
327
+ children: ReactNode;
328
+ className?: string;
329
+ }
330
+
331
+ declare function TableHead({ children, className }: TableHeadProps): react_jsx_runtime.JSX.Element;
332
+
333
+ declare function TableBody({ children, className }: TableBodyProps): react_jsx_runtime.JSX.Element;
334
+
335
+ declare function TableRow({ children, className, onClick }: TableRowProps): react_jsx_runtime.JSX.Element;
336
+
337
+ declare function TableCell({ children, className, header }: TableCellProps): react_jsx_runtime.JSX.Element;
338
+
339
+ declare function TableColumn({ label, sortKey, className }: TableColumnProps): react_jsx_runtime.JSX.Element;
340
+
341
+ declare function TablePagination({ className, total, pageSize, }: TablePaginationProps): react_jsx_runtime.JSX.Element | null;
342
+
343
+ declare function TableSearch({ className, placeholder, }: TableSearchProps): react_jsx_runtime.JSX.Element;
344
+
345
+ declare function TableTray({ children, className }: TableTrayProps): react_jsx_runtime.JSX.Element;
346
+
347
+ declare function TableRoot({ children, className }: TableProps): react_jsx_runtime.JSX.Element;
348
+ declare const Table: typeof TableRoot & {
349
+ Head: typeof TableHead;
350
+ Body: typeof TableBody;
351
+ Row: typeof TableRow;
352
+ Cell: typeof TableCell;
353
+ Column: typeof TableColumn;
354
+ Pagination: typeof TablePagination;
355
+ Search: typeof TableSearch;
356
+ Tray: typeof TableTray;
357
+ };
358
+
359
+ declare function cn(...inputs: ClassValue[]): string;
360
+
361
+ declare function useControllableState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (value: T | ((prev: T) => T)) => void];
362
+
363
+ /**
364
+ * Simplified emoji data for the picker component.
365
+ * Each category contains just the emoji character strings.
366
+ */
367
+ declare const EMOJI_DATA: Array<{
368
+ category: string;
369
+ icon: string;
370
+ label: string;
371
+ emojis: string[];
372
+ }>;
373
+ /**
374
+ * Flat list of all emojis with name and category, useful for search.
375
+ */
376
+ declare const EMOJI_ENTRIES: Array<{
377
+ char: string;
378
+ name: string;
379
+ category: string;
380
+ }>;
381
+
382
+ /** Resolve an emoji name to its character. */
383
+ declare function resolve(name: string): string | undefined;
384
+ /** Search emojis by name substring. Returns matching emoji characters. */
385
+ declare function search(query: string): string[];
386
+ /** Find an emoji entry by its character. */
387
+ declare function find(char: string): {
388
+ char: string;
389
+ name: string;
390
+ category: string;
391
+ } | undefined;
392
+
393
+ export { Action, type ActionColor, type ActionProps, Carousel, type CarouselContextValue, type CarouselControlsProps, type CarouselPanelsProps, type CarouselProps, type CarouselSlideProps, type CarouselStepsProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type Color, ColorPicker, type ColorPickerProps, DatePicker, type DatePickerProps, EMOJI_DATA, EMOJI_ENTRIES, Emoji, type EmojiProps, EmojiSelect, type EmojiSelectProps, Field, type FieldProps, Input, type InputBaseProps, type InputOption, type InputOptionGroup, type InputProps, RadioGroup, type RadioGroupProps, Select, type SelectProps, type Size, Slider, type SliderProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableHeadProps, type TablePaginationProps, type TableProps, type TableRowProps, type TableSearchProps, type TableTrayProps, Textarea, type TextareaProps, type Variant, cn, find, resolve, search, useCarousel, useControllableState };