@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/docs/Skeleton.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
An animated placeholder component for loading states, available as rectangle, circle, or text line shapes.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Skeleton } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Skeleton width={200} height={20} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| shape | `"rect" \| "circle" \| "text"` | `"rect"` | Shape of the skeleton placeholder |
|
|
22
|
+
| width | `string \| number` | - | Custom width (CSS value or number in px) |
|
|
23
|
+
| height | `string \| number` | - | Custom height (CSS value or number in px) |
|
|
24
|
+
| className | `string` | - | Additional CSS classes |
|
|
25
|
+
|
|
26
|
+
Shape defaults: `"rect"` renders with rounded-lg corners; `"circle"` renders as a rounded-full with 1:1 aspect ratio; `"text"` renders as a full-width line at 16px height.
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Loading card placeholder
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<div className="space-y-3">
|
|
34
|
+
<Skeleton shape="circle" width={48} height={48} />
|
|
35
|
+
<Skeleton shape="text" />
|
|
36
|
+
<Skeleton shape="text" width="60%" />
|
|
37
|
+
</div>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Custom rectangle
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Skeleton width={300} height={180} />
|
|
44
|
+
```
|
package/docs/Slider.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
Range slider supporting single-value and dual-thumb range modes, with optional marks and value display.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Slider } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Slider label="Volume" defaultValue={50} showValue />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| `min` | `number` | `0` | Minimum value |
|
|
22
|
+
| `max` | `number` | `100` | Maximum value |
|
|
23
|
+
| `step` | `number` | `1` | Step increment |
|
|
24
|
+
| `showValue` | `boolean` | `false` | Display current value beside the slider |
|
|
25
|
+
| `marks` | `{ value: number; label?: string }[]` | - | Tick marks below the track |
|
|
26
|
+
| `prefix` | `ReactNode` | - | Prefix before the displayed value (e.g. `"$"`) |
|
|
27
|
+
| `suffix` | `ReactNode` | - | Suffix after the displayed value (e.g. `"%"`) |
|
|
28
|
+
| `range` | `boolean` | `false` | Enable dual-thumb range mode |
|
|
29
|
+
| `value` | `number` (single) / `[number, number]` (range) | - | Controlled value |
|
|
30
|
+
| `defaultValue` | `number` / `[number, number]` | `min` / `[min, max]` | Default value (uncontrolled) |
|
|
31
|
+
| `onValueChange` | `(value) => void` | - | Callback when value changes |
|
|
32
|
+
| `label` | `string` | - | Wraps in a `Field` with this label |
|
|
33
|
+
| `description` | `string` | - | Helper text |
|
|
34
|
+
| `error` | `string` | - | Error message |
|
|
35
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Track thickness |
|
|
36
|
+
| `dirty` | `boolean` | `false` | Amber ring |
|
|
37
|
+
| `disabled` | `boolean` | `false` | Disables the slider |
|
|
38
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### With marks and suffix
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<Slider
|
|
46
|
+
label="Temperature"
|
|
47
|
+
min={0}
|
|
48
|
+
max={100}
|
|
49
|
+
step={10}
|
|
50
|
+
showValue
|
|
51
|
+
suffix="°C"
|
|
52
|
+
marks={[
|
|
53
|
+
{ value: 0, label: "Cold" },
|
|
54
|
+
{ value: 50, label: "Warm" },
|
|
55
|
+
{ value: 100, label: "Hot" },
|
|
56
|
+
]}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Range slider
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
const [range, setRange] = useState<[number, number]>([20, 80]);
|
|
64
|
+
|
|
65
|
+
<Slider
|
|
66
|
+
label="Price range"
|
|
67
|
+
range
|
|
68
|
+
min={0}
|
|
69
|
+
max={200}
|
|
70
|
+
prefix="$"
|
|
71
|
+
showValue
|
|
72
|
+
value={range}
|
|
73
|
+
onValueChange={setRange}
|
|
74
|
+
/>
|
|
75
|
+
```
|
package/docs/Switch.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
Toggle switch for boolean on/off states with configurable color and optional label.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Switch } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Switch label="Enable notifications" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| `checked` | `boolean` | - | Controlled checked state |
|
|
22
|
+
| `defaultChecked` | `boolean` | `false` | Initial checked state (uncontrolled) |
|
|
23
|
+
| `onCheckedChange` | `(checked: boolean) => void` | - | Callback when toggled |
|
|
24
|
+
| `color` | `Color` | `"blue"` | Track color when checked. Any Tailwind color: `"zinc"`, `"red"`, `"green"`, `"blue"`, `"purple"`, etc. |
|
|
25
|
+
| `label` | `string` | - | Label text next to the switch |
|
|
26
|
+
| `description` | `string` | - | Helper text below the label |
|
|
27
|
+
| `error` | `string` | - | Error message |
|
|
28
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Switch size |
|
|
29
|
+
| `dirty` | `boolean` | `false` | Amber ring |
|
|
30
|
+
| `required` | `boolean` | `false` | Red asterisk on label |
|
|
31
|
+
| `disabled` | `boolean` | `false` | Disables the switch |
|
|
32
|
+
| `name` | `string` | - | Form field name (renders a hidden input with value `"1"` or `"0"`) |
|
|
33
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Controlled with color
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
const [darkMode, setDarkMode] = useState(false);
|
|
41
|
+
|
|
42
|
+
<Switch
|
|
43
|
+
label="Dark mode"
|
|
44
|
+
description="Toggle the application theme"
|
|
45
|
+
color="violet"
|
|
46
|
+
checked={darkMode}
|
|
47
|
+
onCheckedChange={setDarkMode}
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### In a form
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<Switch name="marketing_emails" label="Receive marketing emails" defaultChecked />
|
|
55
|
+
```
|
package/docs/Table.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
A data table with sorting, pagination, search, expandable row trays, and a compound sub-component API.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Table } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Table>
|
|
15
|
+
<Table.Search placeholder="Filter users..." />
|
|
16
|
+
<Table.Head>
|
|
17
|
+
<Table.Row>
|
|
18
|
+
<Table.Column label="Name" sortKey="name" />
|
|
19
|
+
<Table.Column label="Email" sortKey="email" />
|
|
20
|
+
<Table.Column label="Role" />
|
|
21
|
+
</Table.Row>
|
|
22
|
+
</Table.Head>
|
|
23
|
+
<Table.Body>
|
|
24
|
+
{users.map((user) => (
|
|
25
|
+
<Table.Row key={user.id}>
|
|
26
|
+
<Table.Cell>{user.name}</Table.Cell>
|
|
27
|
+
<Table.Cell>{user.email}</Table.Cell>
|
|
28
|
+
<Table.Cell>{user.role}</Table.Cell>
|
|
29
|
+
</Table.Row>
|
|
30
|
+
))}
|
|
31
|
+
</Table.Body>
|
|
32
|
+
<Table.Pagination total={users.length} pageSize={10} />
|
|
33
|
+
</Table>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Props
|
|
37
|
+
|
|
38
|
+
### Table (root)
|
|
39
|
+
|
|
40
|
+
| Prop | Type | Default | Description |
|
|
41
|
+
|------|------|---------|-------------|
|
|
42
|
+
| children | `ReactNode` | - | Table sub-components |
|
|
43
|
+
| className | `string` | - | Additional CSS classes |
|
|
44
|
+
|
|
45
|
+
### Table.Head
|
|
46
|
+
|
|
47
|
+
| Prop | Type | Default | Description |
|
|
48
|
+
|------|------|---------|-------------|
|
|
49
|
+
| children | `ReactNode` | - | Header row(s) |
|
|
50
|
+
| className | `string` | - | Additional CSS classes |
|
|
51
|
+
|
|
52
|
+
### Table.Body
|
|
53
|
+
|
|
54
|
+
| Prop | Type | Default | Description |
|
|
55
|
+
|------|------|---------|-------------|
|
|
56
|
+
| children | `ReactNode` | - | Data rows |
|
|
57
|
+
| className | `string` | - | Additional CSS classes |
|
|
58
|
+
|
|
59
|
+
### Table.Row
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Default | Description |
|
|
62
|
+
|------|------|---------|-------------|
|
|
63
|
+
| children | `ReactNode` | - | Cells |
|
|
64
|
+
| onClick | `() => void` | - | Row click handler |
|
|
65
|
+
| tray | `ReactNode` | - | Expandable tray content |
|
|
66
|
+
| trayTriggerPosition | `"start" \| "end" \| "hidden"` | - | Position of the expand/collapse trigger |
|
|
67
|
+
| expanded | `boolean` | - | Controlled expanded state |
|
|
68
|
+
| defaultExpanded | `boolean` | - | Default expanded state (uncontrolled) |
|
|
69
|
+
| onExpandedChange | `(expanded: boolean) => void` | - | Callback when expanded state changes |
|
|
70
|
+
| className | `string` | - | Additional CSS classes |
|
|
71
|
+
|
|
72
|
+
### Table.Cell
|
|
73
|
+
|
|
74
|
+
| Prop | Type | Default | Description |
|
|
75
|
+
|------|------|---------|-------------|
|
|
76
|
+
| children | `ReactNode` | - | Cell content |
|
|
77
|
+
| header | `boolean` | - | Render as `<th>` instead of `<td>` |
|
|
78
|
+
| className | `string` | - | Additional CSS classes |
|
|
79
|
+
|
|
80
|
+
### Table.Column
|
|
81
|
+
|
|
82
|
+
| Prop | Type | Default | Description |
|
|
83
|
+
|------|------|---------|-------------|
|
|
84
|
+
| label | `string` | - | Column header text (required) |
|
|
85
|
+
| sortKey | `string` | - | Enable sorting on this key |
|
|
86
|
+
| className | `string` | - | Additional CSS classes |
|
|
87
|
+
|
|
88
|
+
### Table.Pagination
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Default | Description |
|
|
91
|
+
|------|------|---------|-------------|
|
|
92
|
+
| total | `number` | - | Total number of rows (required) |
|
|
93
|
+
| pageSize | `number` | - | Rows per page |
|
|
94
|
+
| className | `string` | - | Additional CSS classes |
|
|
95
|
+
|
|
96
|
+
### Table.Search
|
|
97
|
+
|
|
98
|
+
| Prop | Type | Default | Description |
|
|
99
|
+
|------|------|---------|-------------|
|
|
100
|
+
| placeholder | `string` | - | Input placeholder |
|
|
101
|
+
| className | `string` | - | Additional CSS classes |
|
|
102
|
+
|
|
103
|
+
### Table.Tray / Table.RowTray
|
|
104
|
+
|
|
105
|
+
| Prop | Type | Default | Description |
|
|
106
|
+
|------|------|---------|-------------|
|
|
107
|
+
| children | `ReactNode` | - | Tray content |
|
|
108
|
+
| className | `string` | - | Additional CSS classes |
|
|
109
|
+
|
|
110
|
+
## Expandable Row Tray
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<Table>
|
|
114
|
+
<Table.Head>
|
|
115
|
+
<Table.Row>
|
|
116
|
+
<Table.Column label="Order" />
|
|
117
|
+
<Table.Column label="Status" />
|
|
118
|
+
</Table.Row>
|
|
119
|
+
</Table.Head>
|
|
120
|
+
<Table.Body>
|
|
121
|
+
{orders.map((order) => (
|
|
122
|
+
<Table.Row
|
|
123
|
+
key={order.id}
|
|
124
|
+
tray={<div className="p-4">Order details for {order.id}</div>}
|
|
125
|
+
trayTriggerPosition="end"
|
|
126
|
+
>
|
|
127
|
+
<Table.Cell>{order.id}</Table.Cell>
|
|
128
|
+
<Table.Cell>{order.status}</Table.Cell>
|
|
129
|
+
</Table.Row>
|
|
130
|
+
))}
|
|
131
|
+
</Table.Body>
|
|
132
|
+
</Table>
|
|
133
|
+
```
|
package/docs/Tabs.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
A tabbed interface with three visual variants, controlled and uncontrolled modes, and linked tab-panel pairs.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Tabs } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Tabs defaultTab="general">
|
|
15
|
+
<Tabs.List>
|
|
16
|
+
<Tabs.Tab value="general">General</Tabs.Tab>
|
|
17
|
+
<Tabs.Tab value="security">Security</Tabs.Tab>
|
|
18
|
+
<Tabs.Tab value="notifications">Notifications</Tabs.Tab>
|
|
19
|
+
</Tabs.List>
|
|
20
|
+
<Tabs.Panels>
|
|
21
|
+
<Tabs.Panel value="general">General settings content</Tabs.Panel>
|
|
22
|
+
<Tabs.Panel value="security">Security settings content</Tabs.Panel>
|
|
23
|
+
<Tabs.Panel value="notifications">Notification preferences</Tabs.Panel>
|
|
24
|
+
</Tabs.Panels>
|
|
25
|
+
</Tabs>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Props
|
|
29
|
+
|
|
30
|
+
### Tabs (root)
|
|
31
|
+
|
|
32
|
+
| Prop | Type | Default | Description |
|
|
33
|
+
|------|------|---------|-------------|
|
|
34
|
+
| defaultTab | `string` | `""` | Initially active tab value (uncontrolled) |
|
|
35
|
+
| activeTab | `string` | - | Controlled active tab value |
|
|
36
|
+
| onTabChange | `(tab: string) => void` | - | Callback when the active tab changes |
|
|
37
|
+
| variant | `"underline" \| "pills" \| "boxed"` | `"underline"` | Visual style |
|
|
38
|
+
| className | `string` | - | Additional CSS classes |
|
|
39
|
+
|
|
40
|
+
### Tabs.List
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| children | `ReactNode` | - | Tab elements |
|
|
45
|
+
| className | `string` | - | Additional CSS classes |
|
|
46
|
+
|
|
47
|
+
### Tabs.Tab
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Description |
|
|
50
|
+
|------|------|---------|-------------|
|
|
51
|
+
| value | `string` | - | Unique tab identifier (required) |
|
|
52
|
+
| disabled | `boolean` | - | Disable this tab |
|
|
53
|
+
| className | `string` | - | Additional CSS classes |
|
|
54
|
+
|
|
55
|
+
### Tabs.Panels
|
|
56
|
+
|
|
57
|
+
| Prop | Type | Default | Description |
|
|
58
|
+
|------|------|---------|-------------|
|
|
59
|
+
| children | `ReactNode` | - | Panel elements |
|
|
60
|
+
| className | `string` | - | Additional CSS classes |
|
|
61
|
+
|
|
62
|
+
### Tabs.Panel
|
|
63
|
+
|
|
64
|
+
| Prop | Type | Default | Description |
|
|
65
|
+
|------|------|---------|-------------|
|
|
66
|
+
| value | `string` | - | Tab value this panel corresponds to (required) |
|
|
67
|
+
| className | `string` | - | Additional CSS classes |
|
|
68
|
+
|
|
69
|
+
## Controlled with Pills Variant
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
const [tab, setTab] = useState("overview");
|
|
73
|
+
|
|
74
|
+
<Tabs activeTab={tab} onTabChange={setTab} variant="pills">
|
|
75
|
+
<Tabs.List>
|
|
76
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
77
|
+
<Tabs.Tab value="analytics">Analytics</Tabs.Tab>
|
|
78
|
+
<Tabs.Tab value="reports" disabled>Reports</Tabs.Tab>
|
|
79
|
+
</Tabs.List>
|
|
80
|
+
<Tabs.Panels>
|
|
81
|
+
<Tabs.Panel value="overview">Overview content</Tabs.Panel>
|
|
82
|
+
<Tabs.Panel value="analytics">Analytics content</Tabs.Panel>
|
|
83
|
+
</Tabs.Panels>
|
|
84
|
+
</Tabs>
|
|
85
|
+
```
|
package/docs/Text.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Text
|
|
2
|
+
|
|
3
|
+
A text component for rendering paragraphs, spans, or labels with preset sizes, weights, and colors.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Text } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Text>Hello, world!</Text>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| as | `"p" \| "span" \| "div" \| "label"` | `"p"` | Which element to render |
|
|
22
|
+
| size | `"xs" \| "sm" \| "md" \| "lg"` | `"md"` | Text size |
|
|
23
|
+
| weight | `"normal" \| "medium" \| "semibold" \| "bold"` | `"normal"` | Font weight |
|
|
24
|
+
| color | `"default" \| "muted" \| "accent" \| "danger" \| "success"` | `"default"` | Text color preset |
|
|
25
|
+
|
|
26
|
+
Also extends all native HTML attributes for the rendered element.
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Muted helper text
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<Text size="sm" color="muted">
|
|
34
|
+
This action cannot be undone.
|
|
35
|
+
</Text>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Inline accent text
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<Text as="span" color="accent" weight="semibold">
|
|
42
|
+
New
|
|
43
|
+
</Text>
|
|
44
|
+
```
|
package/docs/Textarea.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Textarea
|
|
2
|
+
|
|
3
|
+
Multi-line text input with optional auto-resize, label, error, and prefix/suffix support.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Textarea } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Textarea label="Bio" placeholder="Tell us about yourself..." />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
Extends all native `<textarea>` attributes (except `size`, `prefix`).
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Default | Description |
|
|
22
|
+
|------|------|---------|-------------|
|
|
23
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Controls text size and padding |
|
|
24
|
+
| `autoResize` | `boolean` | `false` | Auto-grows height to fit content |
|
|
25
|
+
| `minRows` | `number` | `3` | Minimum visible rows |
|
|
26
|
+
| `maxRows` | `number` | - | Maximum rows before scrolling (only applies with `autoResize`) |
|
|
27
|
+
| `label` | `string` | - | Wraps textarea in a `Field` with this label |
|
|
28
|
+
| `description` | `string` | - | Helper text below the textarea |
|
|
29
|
+
| `error` | `string` | - | Error message (red text and border) |
|
|
30
|
+
| `required` | `boolean` | `false` | Red asterisk on label |
|
|
31
|
+
| `dirty` | `boolean` | `false` | Amber ring to indicate unsaved changes |
|
|
32
|
+
| `disabled` | `boolean` | `false` | Disables the textarea |
|
|
33
|
+
| `prefix` | `ReactNode` | - | Affix rendered before the textarea (always outside) |
|
|
34
|
+
| `suffix` | `ReactNode` | - | Affix rendered after the textarea (always outside) |
|
|
35
|
+
| `onValueChange` | `(value: string) => void` | - | Convenience callback with the string value directly |
|
|
36
|
+
| `className` | `string` | - | Additional CSS classes on the `<textarea>` |
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Auto-resize with max height
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Textarea
|
|
44
|
+
label="Message"
|
|
45
|
+
autoResize
|
|
46
|
+
minRows={2}
|
|
47
|
+
maxRows={10}
|
|
48
|
+
placeholder="Type your message..."
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Controlled
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
const [notes, setNotes] = useState("");
|
|
56
|
+
|
|
57
|
+
<Textarea
|
|
58
|
+
label="Notes"
|
|
59
|
+
value={notes}
|
|
60
|
+
onValueChange={setNotes}
|
|
61
|
+
/>
|
|
62
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# TimePicker
|
|
2
|
+
|
|
3
|
+
Spinner-style time picker with hour/minute columns and optional 12h/24h format.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { TimePicker } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<TimePicker onChange={(time) => console.log(time)} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| `value` | `string` | - | Controlled value in `"HH:MM"` 24h format |
|
|
22
|
+
| `defaultValue` | `string` | `"12:00"` | Default time (uncontrolled) |
|
|
23
|
+
| `onChange` | `(value: string) => void` | - | Callback with time string in `"HH:MM"` 24h format |
|
|
24
|
+
| `format` | `"12h" \| "24h"` | `"12h"` | Display format. `"12h"` shows an AM/PM toggle button. |
|
|
25
|
+
| `minuteStep` | `number` | `1` | Minute increment per click |
|
|
26
|
+
| `disabled` | `boolean` | `false` | Disables all controls |
|
|
27
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
28
|
+
|
|
29
|
+
**Note:** Regardless of display format, the `value` and `onChange` always use 24-hour `"HH:MM"` strings.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
### 24-hour format with 15-minute steps
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<TimePicker format="24h" minuteStep={15} defaultValue="09:00" />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Controlled
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
const [time, setTime] = useState("14:30");
|
|
43
|
+
|
|
44
|
+
<TimePicker value={time} onChange={setTime} />
|
|
45
|
+
```
|
package/docs/Timeline.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Timeline
|
|
2
|
+
|
|
3
|
+
A timeline component supporting stacked, alternating, and horizontal layouts. Can be used data-driven (via the `events` prop) or as a compound component with `Timeline.Item` and `Timeline.Block`.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Timeline } from "@particle-academy/react-fancy";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Timeline>
|
|
15
|
+
<Timeline.Item date="Jan 2024">
|
|
16
|
+
<h3>Project started</h3>
|
|
17
|
+
</Timeline.Item>
|
|
18
|
+
<Timeline.Item date="Mar 2024">
|
|
19
|
+
<h3>First release</h3>
|
|
20
|
+
</Timeline.Item>
|
|
21
|
+
</Timeline>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Timeline Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| children | `ReactNode` | - | Compound children (`Timeline.Item` or `Timeline.Block`) |
|
|
29
|
+
| variant | `"stacked" \| "alternating" \| "horizontal"` | `"stacked"` | Layout variant |
|
|
30
|
+
| events | `TimelineEvent[]` | - | Data-driven events (alternative to children) |
|
|
31
|
+
| heading | `ReactNode` | - | Optional heading above the timeline |
|
|
32
|
+
| description | `ReactNode` | - | Optional description below the heading |
|
|
33
|
+
| animated | `boolean` | `true` | Enable scroll-reveal animation |
|
|
34
|
+
| className | `string` | - | Additional CSS classes |
|
|
35
|
+
|
|
36
|
+
## Timeline.Item Props
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Default | Description |
|
|
39
|
+
|------|------|---------|-------------|
|
|
40
|
+
| children | `ReactNode` | - | Item content |
|
|
41
|
+
| icon | `ReactNode` | - | Custom icon for the dot |
|
|
42
|
+
| emoji | `string` | - | Emoji character for the dot |
|
|
43
|
+
| date | `string` | - | Date label displayed above the content |
|
|
44
|
+
| color | `Color` | `"zinc"` | Dot accent color (any Tailwind color name) |
|
|
45
|
+
| active | `boolean` | `false` | Whether this item is the active/current step |
|
|
46
|
+
| className | `string` | - | Additional CSS classes |
|
|
47
|
+
|
|
48
|
+
## Timeline.Block Props
|
|
49
|
+
|
|
50
|
+
A convenience wrapper around `Timeline.Item` that renders content inside a bordered card.
|
|
51
|
+
|
|
52
|
+
| Prop | Type | Default | Description |
|
|
53
|
+
|------|------|---------|-------------|
|
|
54
|
+
| heading | `ReactNode` | - | Block heading |
|
|
55
|
+
| children | `ReactNode` | **required** | Block body content |
|
|
56
|
+
| icon | `ReactNode` | - | Icon for the dot |
|
|
57
|
+
| emoji | `string` | - | Emoji for the dot |
|
|
58
|
+
| color | `Color` | `"zinc"` | Dot/icon color |
|
|
59
|
+
| active | `boolean` | `false` | Whether this block is active (adds ring highlight) |
|
|
60
|
+
| className | `string` | - | Additional CSS classes |
|
|
61
|
+
|
|
62
|
+
## TimelineEvent (data-driven)
|
|
63
|
+
|
|
64
|
+
| Field | Type | Required | Description |
|
|
65
|
+
|-------|------|----------|-------------|
|
|
66
|
+
| title | `string` | yes | Event heading |
|
|
67
|
+
| description | `string` | no | Body text |
|
|
68
|
+
| date | `string` | no | Date string |
|
|
69
|
+
| emoji | `string` | no | Emoji for the dot |
|
|
70
|
+
| icon | `ReactNode` | no | Custom icon for the dot |
|
|
71
|
+
| color | `Color` | no | Accent color |
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### Data-driven timeline
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<Timeline
|
|
79
|
+
heading="Project History"
|
|
80
|
+
events={[
|
|
81
|
+
{ date: "Jan 2024", title: "Kickoff", description: "Project started", color: "blue" },
|
|
82
|
+
{ date: "Mar 2024", title: "Beta", description: "First beta release", emoji: "🚀" },
|
|
83
|
+
{ date: "Jun 2024", title: "Launch", description: "Public launch", color: "green" },
|
|
84
|
+
]}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Alternating layout with blocks
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Timeline variant="alternating">
|
|
92
|
+
<Timeline.Block heading="Design" color="violet" emoji="🎨">
|
|
93
|
+
Completed wireframes and mockups.
|
|
94
|
+
</Timeline.Block>
|
|
95
|
+
<Timeline.Block heading="Development" color="blue" active>
|
|
96
|
+
Building core features.
|
|
97
|
+
</Timeline.Block>
|
|
98
|
+
<Timeline.Block heading="Launch" color="green">
|
|
99
|
+
Planned for Q3.
|
|
100
|
+
</Timeline.Block>
|
|
101
|
+
</Timeline>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Horizontal timeline
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<Timeline variant="horizontal">
|
|
108
|
+
<Timeline.Item date="Step 1" color="blue">
|
|
109
|
+
<h3 className="font-semibold">Sign up</h3>
|
|
110
|
+
</Timeline.Item>
|
|
111
|
+
<Timeline.Item date="Step 2" color="blue">
|
|
112
|
+
<h3 className="font-semibold">Configure</h3>
|
|
113
|
+
</Timeline.Item>
|
|
114
|
+
<Timeline.Item date="Step 3" color="green" active>
|
|
115
|
+
<h3 className="font-semibold">Go live</h3>
|
|
116
|
+
</Timeline.Item>
|
|
117
|
+
</Timeline>
|
|
118
|
+
```
|