@particle-academy/react-fancy 1.7.0 → 1.7.2
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 +76 -82
- package/docs/Accordion.md +78 -0
- package/docs/Action.md +76 -0
- package/docs/Autocomplete.md +74 -0
- package/docs/Avatar.md +40 -0
- package/docs/Badge.md +42 -0
- package/docs/Brand.md +44 -0
- package/docs/Breadcrumbs.md +51 -0
- package/docs/Calendar.md +72 -0
- package/docs/Callout.md +46 -0
- package/docs/Canvas.md +102 -0
- package/docs/Card.md +68 -0
- package/docs/Carousel.md +97 -0
- package/docs/Chart.md +126 -0
- package/docs/Checkbox.md +86 -0
- package/docs/ColorPicker.md +49 -0
- package/docs/Command.md +88 -0
- package/docs/Composer.md +60 -0
- package/docs/ContentRenderer.md +68 -0
- package/docs/ContextMenu.md +82 -0
- package/docs/DatePicker.md +64 -0
- package/docs/Diagram.md +119 -0
- package/docs/Dropdown.md +79 -0
- package/docs/Editor.md +84 -0
- package/docs/Emoji.md +40 -0
- package/docs/EmojiSelect.md +47 -0
- package/docs/Field.md +48 -0
- package/docs/FileUpload.md +81 -0
- package/docs/Heading.md +43 -0
- package/docs/Icon.md +75 -0
- package/docs/Input.md +73 -0
- package/docs/Kanban.md +79 -0
- package/docs/Menu.md +71 -0
- package/docs/MobileMenu.md +69 -0
- package/docs/Modal.md +74 -0
- package/docs/MultiSwitch.md +64 -0
- package/docs/Navbar.md +65 -0
- package/docs/OtpInput.md +48 -0
- package/docs/Pagination.md +48 -0
- package/docs/Pillbox.md +53 -0
- package/docs/Popover.md +82 -0
- package/docs/Portal.md +40 -0
- package/docs/Profile.md +52 -0
- package/docs/Progress.md +42 -0
- package/docs/RadioGroup.md +69 -0
- package/docs/Select.md +122 -0
- package/docs/Separator.md +41 -0
- package/docs/Sidebar.md +88 -0
- package/docs/Skeleton.md +44 -0
- package/docs/Slider.md +75 -0
- package/docs/Switch.md +55 -0
- package/docs/Table.md +133 -0
- package/docs/Tabs.md +85 -0
- package/docs/Text.md +44 -0
- package/docs/Textarea.md +62 -0
- package/docs/TimePicker.md +45 -0
- package/docs/Timeline.md +118 -0
- package/docs/Toast.md +79 -0
- package/docs/Tooltip.md +46 -0
- package/docs/hooks.md +180 -0
- package/docs/utilities.md +74 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -56,109 +56,103 @@ npx vite build # Build demo app (verifies imports work)
|
|
|
56
56
|
|
|
57
57
|
### Core
|
|
58
58
|
|
|
59
|
-
| Component | Description |
|
|
60
|
-
|
|
61
|
-
| Action | Button with colors, states, icons, emoji, avatar, badge, sort control |
|
|
62
|
-
| Carousel | Slide carousel with directional/wizard variants, autoplay, loop |
|
|
63
|
-
| ColorPicker | Native color input with swatch preview, hex display, presets |
|
|
64
|
-
| Emoji | Emoji renderer from slugs |
|
|
65
|
-
| EmojiSelect | Emoji search and selection dropdown |
|
|
66
|
-
| Table | Data table with sorting, pagination, search, and tray |
|
|
59
|
+
| Component | Description | Docs |
|
|
60
|
+
|-----------|-------------|------|
|
|
61
|
+
| Action | Button with colors, states, icons, emoji, avatar, badge, sort control | [docs](docs/Action.md) |
|
|
62
|
+
| Carousel | Slide carousel with directional/wizard variants, autoplay, loop | [docs](docs/Carousel.md) |
|
|
63
|
+
| ColorPicker | Native color input with swatch preview, hex display, presets | [docs](docs/ColorPicker.md) |
|
|
64
|
+
| Emoji | Emoji renderer from slugs | [docs](docs/Emoji.md) |
|
|
65
|
+
| EmojiSelect | Emoji search and selection dropdown | [docs](docs/EmojiSelect.md) |
|
|
66
|
+
| Table | Data table with sorting, pagination, search, and tray | [docs](docs/Table.md) |
|
|
67
67
|
|
|
68
68
|
### Form Inputs
|
|
69
69
|
|
|
70
|
-
| Component | Description |
|
|
71
|
-
|
|
72
|
-
| Field | Form field wrapper with label and error display |
|
|
73
|
-
| Input | Text input |
|
|
74
|
-
| Textarea | Multi-line text input |
|
|
75
|
-
| Select |
|
|
76
|
-
| Checkbox / CheckboxGroup | Checkbox inputs |
|
|
77
|
-
| RadioGroup | Radio button group |
|
|
78
|
-
| Switch | Toggle switch |
|
|
79
|
-
| Slider | Range slider (single and range modes) |
|
|
80
|
-
| MultiSwitch | Segmented toggle between multiple options |
|
|
81
|
-
| DatePicker | Date selection (single and range modes) |
|
|
82
|
-
| Autocomplete | Input with filtered dropdown suggestions, async search, keyboard nav |
|
|
83
|
-
| Pillbox | Tag/pill input with add/remove, backspace delete |
|
|
84
|
-
| OtpInput | Single-digit OTP code input with auto-advance and paste support |
|
|
85
|
-
| FileUpload | Drag-and-drop file upload with dropzone and file list |
|
|
86
|
-
| TimePicker | Hour/minute/AM-PM time selection |
|
|
87
|
-
| Calendar | Month grid with single, range, and multi-select modes |
|
|
70
|
+
| Component | Description | Docs |
|
|
71
|
+
|-----------|-------------|------|
|
|
72
|
+
| Field | Form field wrapper with label and error display | [docs](docs/Field.md) |
|
|
73
|
+
| Input | Text input | [docs](docs/Input.md) |
|
|
74
|
+
| Textarea | Multi-line text input | [docs](docs/Textarea.md) |
|
|
75
|
+
| Select | Native and listbox dropdown with multi-select support | [docs](docs/Select.md) |
|
|
76
|
+
| Checkbox / CheckboxGroup | Checkbox inputs | [docs](docs/Checkbox.md) |
|
|
77
|
+
| RadioGroup | Radio button group | [docs](docs/RadioGroup.md) |
|
|
78
|
+
| Switch | Toggle switch | [docs](docs/Switch.md) |
|
|
79
|
+
| Slider | Range slider (single and range modes) | [docs](docs/Slider.md) |
|
|
80
|
+
| MultiSwitch | Segmented toggle between multiple options | [docs](docs/MultiSwitch.md) |
|
|
81
|
+
| DatePicker | Date selection (single and range modes) | [docs](docs/DatePicker.md) |
|
|
82
|
+
| Autocomplete | Input with filtered dropdown suggestions, async search, keyboard nav | [docs](docs/Autocomplete.md) |
|
|
83
|
+
| Pillbox | Tag/pill input with add/remove, backspace delete | [docs](docs/Pillbox.md) |
|
|
84
|
+
| OtpInput | Single-digit OTP code input with auto-advance and paste support | [docs](docs/OtpInput.md) |
|
|
85
|
+
| FileUpload | Drag-and-drop file upload with dropzone and file list | [docs](docs/FileUpload.md) |
|
|
86
|
+
| TimePicker | Hour/minute/AM-PM time selection | [docs](docs/TimePicker.md) |
|
|
87
|
+
| Calendar | Month grid with single, range, and multi-select modes | [docs](docs/Calendar.md) |
|
|
88
88
|
|
|
89
89
|
### Display
|
|
90
90
|
|
|
91
|
-
| Component | Description |
|
|
92
|
-
|
|
93
|
-
| Heading | Semantic heading (`h1`–`h6`) with size and weight props |
|
|
94
|
-
| Text | Paragraph/span with size, color, weight, and `as` prop |
|
|
95
|
-
| Separator | Horizontal/vertical divider with optional label |
|
|
96
|
-
| Badge | Inline label with color, variant, size, and dot indicator |
|
|
97
|
-
| Icon | Size wrapper around icon ReactNode |
|
|
98
|
-
| Avatar | Image with fallback initials, size variants, status indicator |
|
|
99
|
-
| Skeleton | Animated placeholder (rect, circle, text), pulse animation |
|
|
100
|
-
| Progress | Bar and circular variants, indeterminate mode |
|
|
101
|
-
| Brand | Logo + text lockup |
|
|
102
|
-
| Profile | Avatar + name + subtitle layout |
|
|
103
|
-
| Card | Container with Header, Body, Footer compound slots |
|
|
104
|
-
| Callout | Alert/info box with icon, color, and dismissible support |
|
|
105
|
-
| Timeline | Stacked, alternating, and horizontal timeline with data-driven or compound API |
|
|
91
|
+
| Component | Description | Docs |
|
|
92
|
+
|-----------|-------------|------|
|
|
93
|
+
| Heading | Semantic heading (`h1`–`h6`) with size and weight props | [docs](docs/Heading.md) |
|
|
94
|
+
| Text | Paragraph/span with size, color, weight, and `as` prop | [docs](docs/Text.md) |
|
|
95
|
+
| Separator | Horizontal/vertical divider with optional label | [docs](docs/Separator.md) |
|
|
96
|
+
| Badge | Inline label with color, variant, size, and dot indicator | [docs](docs/Badge.md) |
|
|
97
|
+
| Icon | Size wrapper around icon ReactNode | [docs](docs/Icon.md) |
|
|
98
|
+
| Avatar | Image with fallback initials, size variants, status indicator | [docs](docs/Avatar.md) |
|
|
99
|
+
| Skeleton | Animated placeholder (rect, circle, text), pulse animation | [docs](docs/Skeleton.md) |
|
|
100
|
+
| Progress | Bar and circular variants, indeterminate mode | [docs](docs/Progress.md) |
|
|
101
|
+
| Brand | Logo + text lockup | [docs](docs/Brand.md) |
|
|
102
|
+
| Profile | Avatar + name + subtitle layout | [docs](docs/Profile.md) |
|
|
103
|
+
| Card | Container with Header, Body, Footer compound slots | [docs](docs/Card.md) |
|
|
104
|
+
| Callout | Alert/info box with icon, color, and dismissible support | [docs](docs/Callout.md) |
|
|
105
|
+
| Timeline | Stacked, alternating, and horizontal timeline with data-driven or compound API | [docs](docs/Timeline.md) |
|
|
106
106
|
|
|
107
107
|
### Overlay & Floating
|
|
108
108
|
|
|
109
|
-
| Component | Description |
|
|
110
|
-
|
|
111
|
-
| Tooltip | Hover/focus tooltip with arrow and placement control |
|
|
112
|
-
| Popover | Click
|
|
113
|
-
| Dropdown | Popover with keyboard-navigable menu items |
|
|
114
|
-
| ContextMenu | Right-click triggered dropdown |
|
|
115
|
-
| Modal | Full-screen backdrop dialog with focus trap and scroll lock |
|
|
116
|
-
| Toast | Notification stack with auto-dismiss, variants, and position options |
|
|
117
|
-
| Command | `Cmd+K` command palette with search and keyboard navigation |
|
|
109
|
+
| Component | Description | Docs |
|
|
110
|
+
|-----------|-------------|------|
|
|
111
|
+
| Tooltip | Hover/focus tooltip with arrow and placement control | [docs](docs/Tooltip.md) |
|
|
112
|
+
| Popover | Click or hover floating panel | [docs](docs/Popover.md) |
|
|
113
|
+
| Dropdown | Popover with keyboard-navigable menu items | [docs](docs/Dropdown.md) |
|
|
114
|
+
| ContextMenu | Right-click triggered dropdown | [docs](docs/ContextMenu.md) |
|
|
115
|
+
| Modal | Full-screen backdrop dialog with focus trap and scroll lock | [docs](docs/Modal.md) |
|
|
116
|
+
| Toast | Notification stack with auto-dismiss, variants, and position options | [docs](docs/Toast.md) |
|
|
117
|
+
| Command | `Cmd+K` command palette with search and keyboard navigation | [docs](docs/Command.md) |
|
|
118
118
|
|
|
119
119
|
### Navigation & Layout
|
|
120
120
|
|
|
121
|
-
| Component | Description |
|
|
122
|
-
|
|
123
|
-
| Tabs | Tabbed content with underline, pills, and boxed variants |
|
|
124
|
-
| Accordion | Collapsible content sections (single/multiple mode) |
|
|
125
|
-
| Breadcrumbs | Navigation breadcrumb trail with separator |
|
|
126
|
-
| Navbar | Responsive navigation bar with hamburger collapse |
|
|
127
|
-
| Pagination | Page navigation with prev/next and ellipsis |
|
|
121
|
+
| Component | Description | Docs |
|
|
122
|
+
|-----------|-------------|------|
|
|
123
|
+
| Tabs | Tabbed content with underline, pills, and boxed variants | [docs](docs/Tabs.md) |
|
|
124
|
+
| Accordion | Collapsible content sections (single/multiple mode) | [docs](docs/Accordion.md) |
|
|
125
|
+
| Breadcrumbs | Navigation breadcrumb trail with separator | [docs](docs/Breadcrumbs.md) |
|
|
126
|
+
| Navbar | Responsive navigation bar with hamburger collapse | [docs](docs/Navbar.md) |
|
|
127
|
+
| Pagination | Page navigation with prev/next and ellipsis | [docs](docs/Pagination.md) |
|
|
128
128
|
|
|
129
129
|
### Rich Content
|
|
130
130
|
|
|
131
|
-
| Component | Description |
|
|
132
|
-
|
|
133
|
-
| Composer | Chat-style message input composing textarea + actions |
|
|
134
|
-
| Chart | SVG-based Bar
|
|
135
|
-
| Editor | Toolbar chrome wrapper for contentEditable |
|
|
136
|
-
| Kanban | Drag-and-drop board with columns and cards |
|
|
137
|
-
| Canvas | Interactive node canvas with pan, zoom, and connections |
|
|
138
|
-
| Diagram | Entity-relationship diagram with draggable nodes and relation lines |
|
|
139
|
-
| ContentRenderer | Markdown/HTML content renderer |
|
|
131
|
+
| Component | Description | Docs |
|
|
132
|
+
|-----------|-------------|------|
|
|
133
|
+
| Composer | Chat-style message input composing textarea + actions | [docs](docs/Composer.md) |
|
|
134
|
+
| Chart | SVG-based Bar, Line, Area, Pie, Donut, and Sparkline charts | [docs](docs/Chart.md) |
|
|
135
|
+
| Editor | Toolbar chrome wrapper for contentEditable | [docs](docs/Editor.md) |
|
|
136
|
+
| Kanban | Drag-and-drop board with columns and cards | [docs](docs/Kanban.md) |
|
|
137
|
+
| Canvas | Interactive node canvas with pan, zoom, and connections | [docs](docs/Canvas.md) |
|
|
138
|
+
| Diagram | Entity-relationship diagram with draggable nodes and relation lines | [docs](docs/Diagram.md) |
|
|
139
|
+
| ContentRenderer | Markdown/HTML content renderer | [docs](docs/ContentRenderer.md) |
|
|
140
140
|
|
|
141
141
|
### Menus & Navigation
|
|
142
142
|
|
|
143
|
-
| Component | Description |
|
|
144
|
-
|
|
145
|
-
| Menu | Hierarchical menu with nested items |
|
|
146
|
-
| Sidebar | Collapsible sidebar navigation |
|
|
147
|
-
| MobileMenu | Responsive mobile navigation overlay |
|
|
143
|
+
| Component | Description | Docs |
|
|
144
|
+
|-----------|-------------|------|
|
|
145
|
+
| Menu | Hierarchical menu with nested items | [docs](docs/Menu.md) |
|
|
146
|
+
| Sidebar | Collapsible sidebar navigation | [docs](docs/Sidebar.md) |
|
|
147
|
+
| MobileMenu | Responsive mobile navigation overlay | [docs](docs/MobileMenu.md) |
|
|
148
148
|
|
|
149
149
|
### Utilities & Hooks
|
|
150
150
|
|
|
151
|
-
| Export | Description |
|
|
152
|
-
|
|
153
|
-
| Portal | `createPortal` wrapper with automatic dark mode propagation |
|
|
154
|
-
| `cn()` | `clsx` + `tailwind-merge` for conditional class composition |
|
|
155
|
-
|
|
|
156
|
-
| `useFloatingPosition` | Anchor-relative positioning for floating elements |
|
|
157
|
-
| `useOutsideClick` | Close on click outside handler |
|
|
158
|
-
| `useEscapeKey` | Close on Escape key handler |
|
|
159
|
-
| `useFocusTrap` | Tab-cycle focus within container |
|
|
160
|
-
| `useAnimation` | Enter/exit CSS transitions with unmount |
|
|
161
|
-
| `useId` | Stable ID generation |
|
|
151
|
+
| Export | Description | Docs |
|
|
152
|
+
|--------|-------------|------|
|
|
153
|
+
| Portal | `createPortal` wrapper with automatic dark mode propagation | [docs](docs/Portal.md) |
|
|
154
|
+
| `cn()` | `clsx` + `tailwind-merge` for conditional class composition | [docs](docs/utilities.md) |
|
|
155
|
+
| Hooks | useControllableState, useFloatingPosition, useOutsideClick, useEscapeKey, useFocusTrap, useAnimation, useId, usePanZoom | [docs](docs/hooks.md) |
|
|
162
156
|
|
|
163
157
|
## Customization
|
|
164
158
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
A collapsible content panel supporting single or multiple open items simultaneously.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Accordion } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Accordion>
|
|
15
|
+
<Accordion.Item value="item-1">
|
|
16
|
+
<Accordion.Trigger>What is React Fancy?</Accordion.Trigger>
|
|
17
|
+
<Accordion.Content>
|
|
18
|
+
A headless-ish UI component library for React.
|
|
19
|
+
</Accordion.Content>
|
|
20
|
+
</Accordion.Item>
|
|
21
|
+
<Accordion.Item value="item-2">
|
|
22
|
+
<Accordion.Trigger>Is it accessible?</Accordion.Trigger>
|
|
23
|
+
<Accordion.Content>
|
|
24
|
+
Yes, it follows WAI-ARIA patterns.
|
|
25
|
+
</Accordion.Content>
|
|
26
|
+
</Accordion.Item>
|
|
27
|
+
</Accordion>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Props
|
|
31
|
+
|
|
32
|
+
### Accordion (root)
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Default | Description |
|
|
35
|
+
|------|------|---------|-------------|
|
|
36
|
+
| type | `"single" \| "multiple"` | `"single"` | Whether one or multiple items can be open |
|
|
37
|
+
| defaultOpen | `string[]` | `[]` | Values of items that start open |
|
|
38
|
+
| className | `string` | - | Additional CSS classes |
|
|
39
|
+
|
|
40
|
+
### Accordion.Item
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| value | `string` | - | Unique item identifier (required) |
|
|
45
|
+
| className | `string` | - | Additional CSS classes |
|
|
46
|
+
|
|
47
|
+
### Accordion.Trigger
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Description |
|
|
50
|
+
|------|------|---------|-------------|
|
|
51
|
+
| children | `ReactNode` | - | Clickable header content |
|
|
52
|
+
| className | `string` | - | Additional CSS classes |
|
|
53
|
+
|
|
54
|
+
### Accordion.Content
|
|
55
|
+
|
|
56
|
+
| Prop | Type | Default | Description |
|
|
57
|
+
|------|------|---------|-------------|
|
|
58
|
+
| children | `ReactNode` | - | Collapsible content |
|
|
59
|
+
| className | `string` | - | Additional CSS classes |
|
|
60
|
+
|
|
61
|
+
## Multiple Open Items
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Accordion type="multiple" defaultOpen={["faq-1", "faq-3"]}>
|
|
65
|
+
<Accordion.Item value="faq-1">
|
|
66
|
+
<Accordion.Trigger>First question</Accordion.Trigger>
|
|
67
|
+
<Accordion.Content>First answer</Accordion.Content>
|
|
68
|
+
</Accordion.Item>
|
|
69
|
+
<Accordion.Item value="faq-2">
|
|
70
|
+
<Accordion.Trigger>Second question</Accordion.Trigger>
|
|
71
|
+
<Accordion.Content>Second answer</Accordion.Content>
|
|
72
|
+
</Accordion.Item>
|
|
73
|
+
<Accordion.Item value="faq-3">
|
|
74
|
+
<Accordion.Trigger>Third question</Accordion.Trigger>
|
|
75
|
+
<Accordion.Content>Third answer</Accordion.Content>
|
|
76
|
+
</Accordion.Item>
|
|
77
|
+
</Accordion>
|
|
78
|
+
```
|
package/docs/Action.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Action
|
|
2
|
+
|
|
3
|
+
A versatile button component with support for icons, emojis, avatars, badges, loading states, and color variants.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Action } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Action>Click me</Action>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| variant | `"default" \| "circle"` | `"default"` | Shape variant |
|
|
22
|
+
| color | `ActionColor` | - | Standalone color (overrides state colors). One of: `"blue"`, `"emerald"`, `"amber"`, `"red"`, `"violet"`, `"indigo"`, `"sky"`, `"rose"`, `"orange"`, `"zinc"` |
|
|
23
|
+
| size | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Button size |
|
|
24
|
+
| active | `boolean` | - | Active state (blue highlight) |
|
|
25
|
+
| checked | `boolean` | - | Checked state (emerald highlight) |
|
|
26
|
+
| warn | `boolean` | - | Warning state (amber highlight) |
|
|
27
|
+
| alert | `boolean` | - | Pulsing animation on the entire button |
|
|
28
|
+
| icon | `string` | - | Leading icon slug resolved via the Icon component |
|
|
29
|
+
| iconTrailing | `string` | - | Trailing icon slug |
|
|
30
|
+
| iconPlace | `string` | `"left"` | Icon placement. Supports: `"left"`, `"right"`, `"top"`, `"bottom"`, and compound positions like `"top left"`, `"bottom right"` |
|
|
31
|
+
| alertIcon | `string` | - | Pulsing alert icon slug |
|
|
32
|
+
| alertIconTrailing | `boolean` | - | Position alert icon on trailing side |
|
|
33
|
+
| emoji | `string` | - | Leading emoji slug |
|
|
34
|
+
| emojiTrailing | `string` | - | Trailing emoji slug |
|
|
35
|
+
| avatar | `string` | - | Avatar image URL |
|
|
36
|
+
| avatarTrailing | `boolean` | - | Position avatar on trailing side |
|
|
37
|
+
| badge | `string` | - | Badge text |
|
|
38
|
+
| badgeTrailing | `boolean` | - | Position badge on trailing side |
|
|
39
|
+
| sort | `string` | `"eiab"` | Sort order of decorative elements: `e`=emoji, `i`=icon, `a`=avatar, `b`=badge |
|
|
40
|
+
| loading | `boolean` | `false` | Show loading spinner (disables the button) |
|
|
41
|
+
| disabled | `boolean` | - | Disable the button |
|
|
42
|
+
| href | `string` | - | Render as an anchor tag instead of a button |
|
|
43
|
+
|
|
44
|
+
Also extends all native `<button>` HTML attributes (except `color`).
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
### Icon button with color
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<Action icon="pencil" color="blue" size="lg">
|
|
52
|
+
Edit
|
|
53
|
+
</Action>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Circle icon button
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
<Action variant="circle" icon="plus" color="emerald" />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Loading state with badge
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Action loading badge="3" badgeTrailing>
|
|
66
|
+
Messages
|
|
67
|
+
</Action>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Link button with trailing icon
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Action href="/docs" iconTrailing="arrow-right">
|
|
74
|
+
Read docs
|
|
75
|
+
</Action>
|
|
76
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Autocomplete
|
|
2
|
+
|
|
3
|
+
Text input with a filterable dropdown of suggestions, supporting async search and keyboard navigation.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Autocomplete } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Autocomplete
|
|
15
|
+
options={[
|
|
16
|
+
{ value: "react", label: "React" },
|
|
17
|
+
{ value: "vue", label: "Vue" },
|
|
18
|
+
{ value: "angular", label: "Angular" },
|
|
19
|
+
]}
|
|
20
|
+
placeholder="Search frameworks..."
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| `options` | `AutocompleteOption[]` | **required** | `{ value: string; label: string; disabled?: boolean }` |
|
|
29
|
+
| `value` | `string` | - | Controlled selected value |
|
|
30
|
+
| `defaultValue` | `string` | `""` | Default value (uncontrolled) |
|
|
31
|
+
| `onChange` | `(value: string) => void` | - | Callback when an option is selected |
|
|
32
|
+
| `onSearch` | `(query: string) => void` | - | Callback fired as the user types (for async fetching) |
|
|
33
|
+
| `placeholder` | `string` | - | Input placeholder |
|
|
34
|
+
| `loading` | `boolean` | `false` | Show a loading indicator in the dropdown |
|
|
35
|
+
| `emptyMessage` | `ReactNode` | `"No results found."` | Message when no options match |
|
|
36
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
37
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
38
|
+
|
|
39
|
+
Matching text in dropdown options is automatically highlighted in bold.
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Async search
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
const [options, setOptions] = useState([]);
|
|
47
|
+
const [loading, setLoading] = useState(false);
|
|
48
|
+
|
|
49
|
+
<Autocomplete
|
|
50
|
+
options={options}
|
|
51
|
+
loading={loading}
|
|
52
|
+
placeholder="Search users..."
|
|
53
|
+
onSearch={async (query) => {
|
|
54
|
+
setLoading(true);
|
|
55
|
+
const results = await fetchUsers(query);
|
|
56
|
+
setOptions(results.map((u) => ({ value: u.id, label: u.name })));
|
|
57
|
+
setLoading(false);
|
|
58
|
+
}}
|
|
59
|
+
onChange={(userId) => console.log("Selected:", userId)}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Controlled
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
const [city, setCity] = useState("");
|
|
67
|
+
|
|
68
|
+
<Autocomplete
|
|
69
|
+
options={cities}
|
|
70
|
+
value={city}
|
|
71
|
+
onChange={setCity}
|
|
72
|
+
placeholder="Pick a city"
|
|
73
|
+
/>
|
|
74
|
+
```
|
package/docs/Avatar.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
A circular avatar component with image, fallback initials, and optional online status indicator.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Avatar } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Avatar src="/photo.jpg" alt="Jane Doe" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| src | `string` | - | Image source URL |
|
|
22
|
+
| alt | `string` | `""` | Alt text for the image |
|
|
23
|
+
| fallback | `string` | - | Fallback initials when no image is provided |
|
|
24
|
+
| size | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Avatar size |
|
|
25
|
+
| status | `"online" \| "offline" \| "busy" \| "away"` | - | Online status indicator dot |
|
|
26
|
+
| className | `string` | - | Additional CSS classes |
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### With fallback initials and status
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<Avatar fallback="JD" size="lg" status="online" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Small avatar with image
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Avatar src="/avatar.png" alt="User" size="sm" status="busy" />
|
|
40
|
+
```
|
package/docs/Badge.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
An inline badge/tag component with color, variant, and optional dot indicator.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Badge } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Badge>Default</Badge>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| color | `"zinc" \| "red" \| "blue" \| "green" \| "amber" \| "violet" \| "rose"` | `"zinc"` | Badge color |
|
|
22
|
+
| variant | `"solid" \| "outline" \| "soft"` | `"soft"` | Visual variant |
|
|
23
|
+
| size | `"sm" \| "md" \| "lg"` | `"md"` | Badge size |
|
|
24
|
+
| dot | `boolean` | `false` | Show a small dot indicator before text |
|
|
25
|
+
|
|
26
|
+
Also extends all native `<span>` HTML attributes.
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Status badge with dot
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<Badge color="green" dot>Active</Badge>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Solid colored badge
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Badge color="red" variant="solid" size="sm">
|
|
40
|
+
3 errors
|
|
41
|
+
</Badge>
|
|
42
|
+
```
|
package/docs/Brand.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Brand
|
|
2
|
+
|
|
3
|
+
A branding component that displays a logo, name, and tagline side by side.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Brand } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Brand name="Acme Inc." />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| logo | `ReactNode` | - | Logo element (image, icon, SVG, etc.) |
|
|
22
|
+
| name | `string` | - | Brand name text |
|
|
23
|
+
| tagline | `string` | - | Tagline or subtitle text |
|
|
24
|
+
| size | `"sm" \| "md" \| "lg"` | `"md"` | Overall size |
|
|
25
|
+
| className | `string` | - | Additional CSS classes |
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### Full brand with logo
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
<Brand
|
|
33
|
+
logo={<img src="/logo.svg" alt="" className="h-8 w-8" />}
|
|
34
|
+
name="Acme Inc."
|
|
35
|
+
tagline="Build amazing things"
|
|
36
|
+
size="lg"
|
|
37
|
+
/>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Name only
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Brand name="My App" size="sm" />
|
|
44
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Breadcrumbs
|
|
2
|
+
|
|
3
|
+
A navigation trail with configurable separators, a shrinkable mode that collapses intermediate items to "...", and an automatic mobile dropdown.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Breadcrumbs } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Breadcrumbs>
|
|
15
|
+
<Breadcrumbs.Item href="/">Home</Breadcrumbs.Item>
|
|
16
|
+
<Breadcrumbs.Item href="/products">Products</Breadcrumbs.Item>
|
|
17
|
+
<Breadcrumbs.Item active>Widget</Breadcrumbs.Item>
|
|
18
|
+
</Breadcrumbs>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
### Breadcrumbs (root)
|
|
24
|
+
|
|
25
|
+
| Prop | Type | Default | Description |
|
|
26
|
+
|------|------|---------|-------------|
|
|
27
|
+
| separator | `ReactNode` | `<ChevronRight />` | Custom separator element between items |
|
|
28
|
+
| shrink | `boolean` | - | Collapse intermediate items to "..." (expand on hover/click) |
|
|
29
|
+
| className | `string` | - | Additional CSS classes |
|
|
30
|
+
|
|
31
|
+
### Breadcrumbs.Item
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Default | Description |
|
|
34
|
+
|------|------|---------|-------------|
|
|
35
|
+
| children | `ReactNode` | - | Item label |
|
|
36
|
+
| href | `string` | - | Link URL (renders an anchor when provided) |
|
|
37
|
+
| active | `boolean` | - | Mark as the current page (no link) |
|
|
38
|
+
| className | `string` | - | Additional CSS classes |
|
|
39
|
+
|
|
40
|
+
## Shrinkable Breadcrumbs
|
|
41
|
+
|
|
42
|
+
When `shrink` is enabled, only the "..." button and the last item are shown. Hovering or clicking "..." expands the full trail.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<Breadcrumbs shrink>
|
|
46
|
+
<Breadcrumbs.Item href="/">Home</Breadcrumbs.Item>
|
|
47
|
+
<Breadcrumbs.Item href="/docs">Docs</Breadcrumbs.Item>
|
|
48
|
+
<Breadcrumbs.Item href="/docs/components">Components</Breadcrumbs.Item>
|
|
49
|
+
<Breadcrumbs.Item active>Breadcrumbs</Breadcrumbs.Item>
|
|
50
|
+
</Breadcrumbs>
|
|
51
|
+
```
|
package/docs/Calendar.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Calendar
|
|
2
|
+
|
|
3
|
+
Inline calendar widget supporting single date, multiple date, and date range selection.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Calendar } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Calendar onChange={(date) => console.log(date)} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| `mode` | `"single" \| "range" \| "multiple"` | `"single"` | Selection mode |
|
|
22
|
+
| `value` | `Date \| Date[] \| DateRange \| null` | - | Controlled value (type depends on mode) |
|
|
23
|
+
| `onChange` | `(value: Date \| Date[] \| DateRange \| null) => void` | - | Callback when selection changes |
|
|
24
|
+
| `minDate` | `Date` | - | Earliest selectable date |
|
|
25
|
+
| `maxDate` | `Date` | - | Latest selectable date |
|
|
26
|
+
| `disabledDates` | `Date[]` | `[]` | Specific dates to disable |
|
|
27
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
28
|
+
|
|
29
|
+
### DateRange type
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
interface DateRange {
|
|
33
|
+
start: Date | null;
|
|
34
|
+
end: Date | null;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Behavior:**
|
|
39
|
+
- Month navigation via chevron buttons.
|
|
40
|
+
- Today is visually emphasized with bold text.
|
|
41
|
+
- In `"range"` mode, hovering previews the range highlight before the second click.
|
|
42
|
+
- Out-of-month days are dimmed but still clickable.
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Date range selection
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
const [range, setRange] = useState<DateRange>({ start: null, end: null });
|
|
50
|
+
|
|
51
|
+
<Calendar
|
|
52
|
+
mode="range"
|
|
53
|
+
value={range}
|
|
54
|
+
onChange={setRange}
|
|
55
|
+
minDate={new Date()}
|
|
56
|
+
/>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Multiple dates with constraints
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
const [dates, setDates] = useState<Date[]>([]);
|
|
63
|
+
|
|
64
|
+
<Calendar
|
|
65
|
+
mode="multiple"
|
|
66
|
+
value={dates}
|
|
67
|
+
onChange={setDates}
|
|
68
|
+
minDate={new Date(2024, 0, 1)}
|
|
69
|
+
maxDate={new Date(2024, 11, 31)}
|
|
70
|
+
disabledDates={[new Date(2024, 6, 4)]}
|
|
71
|
+
/>
|
|
72
|
+
```
|