@particle-academy/react-fancy 1.7.1 → 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/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
|
@@ -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
|
+
```
|
package/docs/Callout.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Callout
|
|
2
|
+
|
|
3
|
+
A colored alert/callout box with optional icon and dismiss button.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Callout } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Callout>This is an informational callout.</Callout>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| children | `ReactNode` | **required** | Callout content |
|
|
22
|
+
| color | `"blue" \| "green" \| "amber" \| "red" \| "zinc"` | `"blue"` | Callout color theme |
|
|
23
|
+
| icon | `ReactNode` | - | Icon element displayed on the left |
|
|
24
|
+
| dismissible | `boolean` | `false` | Show a dismiss/close button |
|
|
25
|
+
| onDismiss | `() => void` | - | Callback when dismiss button is clicked |
|
|
26
|
+
| className | `string` | - | Additional CSS classes |
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Warning callout with icon
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { AlertTriangle } from "lucide-react";
|
|
34
|
+
|
|
35
|
+
<Callout color="amber" icon={<AlertTriangle size={20} />}>
|
|
36
|
+
Your trial expires in 3 days.
|
|
37
|
+
</Callout>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Dismissible error callout
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Callout color="red" dismissible onDismiss={() => setVisible(false)}>
|
|
44
|
+
Something went wrong. Please try again.
|
|
45
|
+
</Callout>
|
|
46
|
+
```
|
package/docs/Canvas.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Canvas
|
|
2
|
+
|
|
3
|
+
An infinite pannable and zoomable canvas for positioning nodes with edges between them. Includes minimap and zoom controls.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Canvas } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Canvas className="h-96 w-full" showGrid>
|
|
15
|
+
<Canvas.Node id="a" x={50} y={50} draggable>
|
|
16
|
+
<div className="rounded border bg-white p-4">Node A</div>
|
|
17
|
+
</Canvas.Node>
|
|
18
|
+
<Canvas.Node id="b" x={300} y={150} draggable>
|
|
19
|
+
<div className="rounded border bg-white p-4">Node B</div>
|
|
20
|
+
</Canvas.Node>
|
|
21
|
+
<Canvas.Edge from="a" to="b" curve="bezier" markerEnd="canvas-arrow" />
|
|
22
|
+
<Canvas.Controls />
|
|
23
|
+
<Canvas.Minimap />
|
|
24
|
+
</Canvas>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Props
|
|
28
|
+
|
|
29
|
+
### Canvas (root)
|
|
30
|
+
|
|
31
|
+
| Prop | Type | Default | Description |
|
|
32
|
+
|------|------|---------|-------------|
|
|
33
|
+
| viewport | `ViewportState` | - | Controlled viewport `{ panX, panY, zoom }` |
|
|
34
|
+
| defaultViewport | `ViewportState` | `{ panX: 0, panY: 0, zoom: 1 }` | Default viewport (uncontrolled) |
|
|
35
|
+
| onViewportChange | `(viewport: ViewportState) => void` | - | Callback when viewport changes |
|
|
36
|
+
| minZoom | `number` | `0.1` | Minimum zoom level |
|
|
37
|
+
| maxZoom | `number` | `3` | Maximum zoom level |
|
|
38
|
+
| pannable | `boolean` | `true` | Enable panning (click+drag on background) |
|
|
39
|
+
| zoomable | `boolean` | `true` | Enable zoom (Ctrl+scroll) |
|
|
40
|
+
| gridSize | `number` | - | Grid cell size in px |
|
|
41
|
+
| showGrid | `boolean` | `false` | Display dot grid background |
|
|
42
|
+
| fitOnMount | `boolean` | `false` | Auto-fit all nodes into view on mount |
|
|
43
|
+
| className | `string` | - | Additional CSS classes |
|
|
44
|
+
| style | `CSSProperties` | - | Inline styles |
|
|
45
|
+
|
|
46
|
+
### Canvas.Node
|
|
47
|
+
|
|
48
|
+
| Prop | Type | Default | Description |
|
|
49
|
+
|------|------|---------|-------------|
|
|
50
|
+
| id | `string` | - | Unique node identifier (required) |
|
|
51
|
+
| x | `number` | - | X position in canvas coordinates (required) |
|
|
52
|
+
| y | `number` | - | Y position in canvas coordinates (required) |
|
|
53
|
+
| draggable | `boolean` | - | Allow drag-to-move |
|
|
54
|
+
| onPositionChange | `(x: number, y: number) => void` | - | Callback when dragged to a new position |
|
|
55
|
+
| className | `string` | - | Additional CSS classes |
|
|
56
|
+
| style | `CSSProperties` | - | Inline styles |
|
|
57
|
+
|
|
58
|
+
### Canvas.Edge
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Default | Description |
|
|
61
|
+
|------|------|---------|-------------|
|
|
62
|
+
| from | `string` | - | Source node id (required) |
|
|
63
|
+
| to | `string` | - | Target node id (required) |
|
|
64
|
+
| fromAnchor | `EdgeAnchor` | - | Anchor point on source: `"top"`, `"bottom"`, `"left"`, `"right"`, `"center"`, `"auto"` |
|
|
65
|
+
| toAnchor | `EdgeAnchor` | - | Anchor point on target |
|
|
66
|
+
| curve | `"bezier" \| "step" \| "straight"` | - | Path interpolation |
|
|
67
|
+
| color | `string` | - | Stroke color |
|
|
68
|
+
| strokeWidth | `number` | - | Stroke width |
|
|
69
|
+
| dashed | `boolean` | - | Dashed line |
|
|
70
|
+
| animated | `boolean` | - | Animated dash pattern |
|
|
71
|
+
| label | `ReactNode` | - | Label at the midpoint |
|
|
72
|
+
| markerStart | `string` | - | SVG marker id for start (e.g. `"canvas-arrow"`, `"canvas-circle"`, `"canvas-diamond"`) |
|
|
73
|
+
| markerEnd | `string` | - | SVG marker id for end |
|
|
74
|
+
| className | `string` | - | Additional CSS classes |
|
|
75
|
+
|
|
76
|
+
### Canvas.Controls
|
|
77
|
+
|
|
78
|
+
| Prop | Type | Default | Description |
|
|
79
|
+
|------|------|---------|-------------|
|
|
80
|
+
| showZoomIn | `boolean` | - | Show zoom-in button |
|
|
81
|
+
| showZoomOut | `boolean` | - | Show zoom-out button |
|
|
82
|
+
| showReset | `boolean` | - | Show reset-viewport button |
|
|
83
|
+
| showFitAll | `boolean` | - | Show fit-all button |
|
|
84
|
+
| className | `string` | - | Additional CSS classes |
|
|
85
|
+
|
|
86
|
+
### Canvas.Minimap
|
|
87
|
+
|
|
88
|
+
| Prop | Type | Default | Description |
|
|
89
|
+
|------|------|---------|-------------|
|
|
90
|
+
| width | `number` | - | Minimap width in px |
|
|
91
|
+
| height | `number` | - | Minimap height in px |
|
|
92
|
+
| className | `string` | - | Additional CSS classes |
|
|
93
|
+
|
|
94
|
+
### ViewportState
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
{ panX: number; panY: number; zoom: number }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Built-in SVG Markers
|
|
101
|
+
|
|
102
|
+
The Canvas includes predefined SVG markers for edge endpoints: `"canvas-arrow"`, `"canvas-circle"`, `"canvas-diamond"`, `"canvas-one"`, `"canvas-crow-foot"`.
|
package/docs/Card.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
A container component with optional header, body, and footer sections. Uses `Object.assign` to expose compound sub-components.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Card } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Card>
|
|
15
|
+
<Card.Body>Content goes here</Card.Body>
|
|
16
|
+
</Card>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Card Props
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Default | Description |
|
|
22
|
+
|------|------|---------|-------------|
|
|
23
|
+
| variant | `"outlined" \| "elevated" \| "flat"` | `"outlined"` | Visual variant |
|
|
24
|
+
| padding | `"none" \| "sm" \| "md" \| "lg"` | `"md"` | Padding applied to child sections |
|
|
25
|
+
|
|
26
|
+
Also extends all native `<div>` HTML attributes.
|
|
27
|
+
|
|
28
|
+
## Sub-Components
|
|
29
|
+
|
|
30
|
+
### Card.Header
|
|
31
|
+
|
|
32
|
+
Renders a section with a bottom border. Accepts all `<div>` HTML attributes.
|
|
33
|
+
|
|
34
|
+
### Card.Body
|
|
35
|
+
|
|
36
|
+
Renders a plain content section. Accepts all `<div>` HTML attributes.
|
|
37
|
+
|
|
38
|
+
### Card.Footer
|
|
39
|
+
|
|
40
|
+
Renders a section with a top border. Accepts all `<div>` HTML attributes.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Full card with sections
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<Card variant="elevated" padding="lg">
|
|
48
|
+
<Card.Header>
|
|
49
|
+
<h3 className="font-semibold">Settings</h3>
|
|
50
|
+
</Card.Header>
|
|
51
|
+
<Card.Body>
|
|
52
|
+
<p>Configure your preferences below.</p>
|
|
53
|
+
</Card.Body>
|
|
54
|
+
<Card.Footer>
|
|
55
|
+
<button>Save</button>
|
|
56
|
+
</Card.Footer>
|
|
57
|
+
</Card>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Flat card without header
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<Card variant="flat">
|
|
64
|
+
<Card.Body>
|
|
65
|
+
<p>A simple flat card.</p>
|
|
66
|
+
</Card.Body>
|
|
67
|
+
</Card>
|
|
68
|
+
```
|