rupoui 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.
- package/LICENSE +21 -0
- package/README.md +611 -0
- package/dist/components/button/Button.d.ts +17 -0
- package/dist/components/button/button.styles.d.ts +217 -0
- package/dist/components/button/button.types.d.ts +17 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +3 -0
- package/dist/components/checkbox/CheckboxGroup.d.ts +3 -0
- package/dist/components/checkbox/checkbox-group-context.d.ts +17 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +377 -0
- package/dist/components/checkbox/checkbox.types.d.ts +159 -0
- package/dist/components/checkbox/example.d.ts +1 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/checkbox/useCheckbox.d.ts +314 -0
- package/dist/components/checkbox/useCheckboxGroup.d.ts +283 -0
- package/dist/components/input/Input.d.ts +18 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/input.styles.d.ts +301 -0
- package/dist/components/input/input.types.d.ts +61 -0
- package/dist/components/input-number/InputNumber.d.ts +30 -0
- package/dist/components/input-number/index.d.ts +2 -0
- package/dist/components/input-number/input-number.styles.d.ts +403 -0
- package/dist/components/input-number/input-number.types.d.ts +120 -0
- package/dist/components/input-number/utils.d.ts +6 -0
- package/dist/components/radio/Radio.d.ts +3 -0
- package/dist/components/radio/RadioGroup.d.ts +3 -0
- package/dist/components/radio/index.d.ts +5 -0
- package/dist/components/radio/radio-group-context.d.ts +17 -0
- package/dist/components/radio/radio.styles.d.ts +371 -0
- package/dist/components/radio/radio.types.d.ts +143 -0
- package/dist/components/radio/useRadio.d.ts +314 -0
- package/dist/components/radio/useRadioGroup.d.ts +284 -0
- package/dist/components/select/Select.d.ts +4 -0
- package/dist/components/select/SelectItem.d.ts +6 -0
- package/dist/components/select/index.d.ts +5 -0
- package/dist/components/select/select.styles.d.ts +286 -0
- package/dist/components/select/select.types.d.ts +63 -0
- package/dist/components/select/useSelect.d.ts +19 -0
- package/dist/components/spinner/Spinner.d.ts +6 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/spinner.styles.d.ts +103 -0
- package/dist/components/spinner/spinner.types.d.ts +6 -0
- package/dist/components/switch/Switch.d.ts +3 -0
- package/dist/components/switch/index.d.ts +4 -0
- package/dist/components/switch/switch.styles.d.ts +190 -0
- package/dist/components/switch/switch.types.d.ts +83 -0
- package/dist/components/switch/useSwitch.d.ts +314 -0
- package/dist/components/textarea/Textarea.d.ts +17 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/textarea.styles.d.ts +352 -0
- package/dist/components/textarea/textarea.types.d.ts +58 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +5821 -0
- package/dist/motion/focus.d.ts +8 -0
- package/dist/motion/hover.d.ts +9 -0
- package/dist/motion/index.d.ts +5 -0
- package/dist/motion/press.d.ts +9 -0
- package/dist/motion/reveal.d.ts +18 -0
- package/dist/motion/tokens.d.ts +11 -0
- package/dist/provider/RupoUIContext.d.ts +3 -0
- package/dist/provider/RupoUIProvider.d.ts +8 -0
- package/dist/provider/types.d.ts +31 -0
- package/dist/provider/useRupoUI.d.ts +3 -0
- package/dist/style.css +1 -0
- package/dist/styles/tokens/colors.d.ts +26 -0
- package/dist/styles/tokens/index.d.ts +5 -0
- package/dist/styles/tokens/motion.d.ts +11 -0
- package/dist/styles/tokens/radius.d.ts +8 -0
- package/dist/styles/tokens/spacing.d.ts +13 -0
- package/dist/styles/tokens/typography.d.ts +34 -0
- package/dist/tailwind/index.cjs +1 -0
- package/dist/tailwind/index.d.ts +5 -0
- package/dist/tailwind/index.js +112 -0
- package/dist/tailwind/plugin-utils.d.ts +5 -0
- package/dist/tailwind/theme.d.ts +33 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 handi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
# RupoUI
|
|
2
|
+
|
|
3
|
+
A modern, accessible, and highly customizable React UI library built with **Tailwind CSS** and **Framer Motion**. RupoUI focuses on developer experience, providing a type-safe, consistent, and motion-first design system.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **Tailwind CSS First**: Built on top of Tailwind CSS for infinite customization.
|
|
8
|
+
- **Type-Safe**: Written in TypeScript with full type definitions.
|
|
9
|
+
- **Accessible**: Follows ARIA patterns and best practices.
|
|
10
|
+
- **Motion**: Integrated animations using Framer Motion.
|
|
11
|
+
- **Customizable**: Global configuration and granular slot styling via `classNames`.
|
|
12
|
+
- **Dark Mode**: Native support for dark mode.
|
|
13
|
+
|
|
14
|
+
## 📦 Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install rupo-ui framer-motion tailwind-variants tailwind-merge clsx
|
|
18
|
+
# or
|
|
19
|
+
pnpm add rupo-ui framer-motion tailwind-variants tailwind-merge clsx
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🛠Setup
|
|
23
|
+
|
|
24
|
+
### 1. Configure Tailwind CSS
|
|
25
|
+
|
|
26
|
+
Add the RupoUI plugin to your `tailwind.config.js` or `tailwind.config.ts` content and plugins:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// tailwind.config.ts
|
|
30
|
+
import { rupoUi } from "rupo-ui/tailwind";
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
content: [
|
|
34
|
+
// ... your app content
|
|
35
|
+
"./node_modules/rupo-ui/dist/**/*.{js,ts,jsx,tsx}",
|
|
36
|
+
],
|
|
37
|
+
plugins: [rupoUi()],
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Add Provider
|
|
42
|
+
|
|
43
|
+
Wrap your application with the `RupoUIProvider` to enable global configurations and styles:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { RupoUIProvider } from "rupo-ui";
|
|
47
|
+
|
|
48
|
+
function App() {
|
|
49
|
+
return (
|
|
50
|
+
<RupoUIProvider>
|
|
51
|
+
<YourApp />
|
|
52
|
+
</RupoUIProvider>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 🧩 Components
|
|
58
|
+
|
|
59
|
+
### Button
|
|
60
|
+
|
|
61
|
+
A versatile button component with support for loading states and icons.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button } from "rupo-ui";
|
|
65
|
+
|
|
66
|
+
<Button variant="solid" color="primary">
|
|
67
|
+
Click Me
|
|
68
|
+
</Button>
|
|
69
|
+
|
|
70
|
+
<Button isLoading color="secondary">
|
|
71
|
+
Loading
|
|
72
|
+
</Button>
|
|
73
|
+
|
|
74
|
+
<Button variant="bordered" radius="full">
|
|
75
|
+
Bordered
|
|
76
|
+
</Button>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Props:**
|
|
80
|
+
|
|
81
|
+
- `variant`: `solid` (default), `bordered`, `flat`, `ghost`, `light`.
|
|
82
|
+
- `color`: `primary`, `secondary`, `success`, `warning`, `danger`.
|
|
83
|
+
- `size`: `sm`, `md` (default), `lg`.
|
|
84
|
+
- `radius`: `none`, `sm`, `md`, `lg`, `full`.
|
|
85
|
+
- `isLoading`: Shows a spinner and disables interaction.
|
|
86
|
+
|
|
87
|
+
### Input
|
|
88
|
+
|
|
89
|
+
A text input component with validation and content slots.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { Input } from "rupo-ui";
|
|
93
|
+
|
|
94
|
+
<Input label="Email" placeholder="Enter your email" />
|
|
95
|
+
|
|
96
|
+
<Input
|
|
97
|
+
label="Password"
|
|
98
|
+
type="password"
|
|
99
|
+
isInvalid
|
|
100
|
+
errorMessage="Invalid password"
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<Input
|
|
104
|
+
startContent={<MailIcon />}
|
|
105
|
+
variant="bordered"
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Props:**
|
|
110
|
+
|
|
111
|
+
- `label`, `placeholder`, `description`, `errorMessage`.
|
|
112
|
+
- `startContent`, `endContent`: Elements to display inside the input.
|
|
113
|
+
- `isInvalid`, `isDisabled`, `isReadOnly`.
|
|
114
|
+
|
|
115
|
+
### InputNumber
|
|
116
|
+
|
|
117
|
+
A specialized numeric input with formatting, validation, and layout controls.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { InputNumber } from "rupo-ui";
|
|
121
|
+
|
|
122
|
+
// Basic
|
|
123
|
+
<InputNumber label="Quantity" min={0} max={100} />
|
|
124
|
+
|
|
125
|
+
// Formatted Currency
|
|
126
|
+
<InputNumber
|
|
127
|
+
label="Price"
|
|
128
|
+
format={{
|
|
129
|
+
style: "currency",
|
|
130
|
+
currency: "USD",
|
|
131
|
+
prefix: "$"
|
|
132
|
+
}}
|
|
133
|
+
defaultValue={1000}
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
// Stacked Controls
|
|
137
|
+
<InputNumber
|
|
138
|
+
label="Stacked"
|
|
139
|
+
controlsPosition="right"
|
|
140
|
+
/>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Features:**
|
|
144
|
+
|
|
145
|
+
- **Controlled/Uncontrolled**: Supports both `value`/`onChange` and `defaultValue`.
|
|
146
|
+
- **Formatting**: Format on blur via `format` prop (locale, precision, thousand separators, prefix/suffix).
|
|
147
|
+
- **Layout**: `controlsPosition` prop for `split` (default) or `right` (vertical stack).
|
|
148
|
+
- **Validation**: `min`, `max`, `step` clamping.
|
|
149
|
+
|
|
150
|
+
### DatePicker
|
|
151
|
+
|
|
152
|
+
A component that allows users to select a date from a calendar or enter it manually.
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { DatePicker } from "rupo-ui";
|
|
156
|
+
|
|
157
|
+
// Basic
|
|
158
|
+
<DatePicker placeholder="Select a date" />
|
|
159
|
+
|
|
160
|
+
// Segmented Input (Date Only)
|
|
161
|
+
<DatePicker
|
|
162
|
+
inputMode="segmented"
|
|
163
|
+
placeholder="DD / MM / YYYY"
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
// Date + Time (Minutes)
|
|
167
|
+
<DatePicker
|
|
168
|
+
granularity="minute"
|
|
169
|
+
placeholder="Select Date & Time"
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
// Date + Time (Seconds)
|
|
173
|
+
<DatePicker
|
|
174
|
+
granularity="second"
|
|
175
|
+
placeholder="Select Date & Time"
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
<DatePicker
|
|
179
|
+
minDate={new Date()}
|
|
180
|
+
format="dd/MM/yyyy"
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Props:**
|
|
185
|
+
|
|
186
|
+
- `value`, `defaultValue`, `onChange`.
|
|
187
|
+
- `granularity`: `date` (default), `minute`, `second`.
|
|
188
|
+
- `inputMode`: `text` (default), `segmented`.
|
|
189
|
+
- `minDate`, `maxDate`: Date constraints.
|
|
190
|
+
- `disabledDates`: Array of disabled dates.
|
|
191
|
+
- `format`: Date format string (e.g., "yyyy-MM-dd").
|
|
192
|
+
- `locale`: Locale string for formatting.
|
|
193
|
+
- `allowInput`: Whether to allow manual typing (legacy text mode).
|
|
194
|
+
- `closeOnSelect`: Whether to close the calendar after selection (default: `true`).
|
|
195
|
+
- `weekStartsOn`: Day index (0 for Sunday).
|
|
196
|
+
- `isDisabled`, `isReadOnly`, `placeholder`.
|
|
197
|
+
|
|
198
|
+
### Calendar
|
|
199
|
+
|
|
200
|
+
A pure renderer component for displaying a calendar grid with full keyboard navigation and accessibility support. It uses an external engine for state management, giving you complete control over the calendar's behavior.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { Calendar, CalendarEngine, getMonthGrid } from "rupo-ui";
|
|
204
|
+
import { useState, useMemo } from "react";
|
|
205
|
+
import { startOfMonth, addMonths, subMonths } from "date-fns";
|
|
206
|
+
|
|
207
|
+
// Basic Calendar
|
|
208
|
+
function useCalendarEngine() {
|
|
209
|
+
const [viewDate, setViewDate] = useState(startOfMonth(new Date()));
|
|
210
|
+
const [selectedDate, setSelectedDate] = useState<Date>();
|
|
211
|
+
|
|
212
|
+
const weeks = useMemo(() => {
|
|
213
|
+
const grid = getMonthGrid({ viewDate, selectedDate });
|
|
214
|
+
return grid.map((row) =>
|
|
215
|
+
row.map((cell) => ({
|
|
216
|
+
...cell,
|
|
217
|
+
isOutsideMonth: !cell.isCurrentMonth,
|
|
218
|
+
})),
|
|
219
|
+
);
|
|
220
|
+
}, [viewDate, selectedDate]);
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
weeks,
|
|
224
|
+
viewDate,
|
|
225
|
+
goToNextMonth: () => setViewDate((prev) => addMonths(prev, 1)),
|
|
226
|
+
goToPrevMonth: () => setViewDate((prev) => subMonths(prev, 1)),
|
|
227
|
+
setDate: setSelectedDate,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const MyCalendar = () => {
|
|
232
|
+
const engine = useCalendarEngine();
|
|
233
|
+
return <Calendar engine={engine} />;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// With Time Selection
|
|
237
|
+
const CalendarWithTime = () => {
|
|
238
|
+
const engine = useCalendarEngine();
|
|
239
|
+
return <Calendar engine={engine} granularity="minute" />;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// With Seconds
|
|
243
|
+
const CalendarWithSeconds = () => {
|
|
244
|
+
const engine = useCalendarEngine();
|
|
245
|
+
return <Calendar engine={engine} granularity="second" />;
|
|
246
|
+
};
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Props:**
|
|
250
|
+
|
|
251
|
+
- `engine`: The `CalendarEngine` object containing state and methods (required).
|
|
252
|
+
- `weeks`: A 2D array of `CalendarEngineDay` objects representing the calendar grid.
|
|
253
|
+
- `viewDate`: The currently displayed month/year.
|
|
254
|
+
- `goToNextMonth()`: Navigate to the next month.
|
|
255
|
+
- `goToPrevMonth()`: Navigate to the previous month.
|
|
256
|
+
- `setDate(date: Date)`: Set the selected date.
|
|
257
|
+
- `granularity`: `date` (default), `minute`, `second` - Controls whether to show time selection.
|
|
258
|
+
- `isDisabled`: Disables all interactions.
|
|
259
|
+
- `isReadOnly`: Prevents date selection but allows navigation.
|
|
260
|
+
- `classNames`: Custom styles for component slots:
|
|
261
|
+
- `base`, `header`, `headerTitle`, `grid`, `weekdaysWrapper`, `daysWrapper`
|
|
262
|
+
- `weekday`, `cell`, `cellSelected`, `cellToday`, `cellDisabled`, `cellOutside`, `time`
|
|
263
|
+
|
|
264
|
+
**Features:**
|
|
265
|
+
|
|
266
|
+
- **Headless Architecture**: Bring your own state management via the `engine` prop.
|
|
267
|
+
- **Full Keyboard Navigation**: Arrow keys, Home/End, PageUp/PageDown support.
|
|
268
|
+
- **Accessibility**: ARIA grid pattern with proper roles and labels.
|
|
269
|
+
- **Time Selection**: Optional time picker for minute or second granularity.
|
|
270
|
+
- **Helper Utility**: Use `getMonthGrid()` to generate calendar data from state.
|
|
271
|
+
|
|
272
|
+
### Select
|
|
273
|
+
|
|
274
|
+
A form component for selecting a value from a set of options, supporting single and multiple selection.
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import { Select, SelectItem } from "rupo-ui";
|
|
278
|
+
|
|
279
|
+
// Basic
|
|
280
|
+
<Select label="Favorite Animal">
|
|
281
|
+
<SelectItem key="cat">Cat</SelectItem>
|
|
282
|
+
<SelectItem key="dog">Dog</SelectItem>
|
|
283
|
+
</Select>
|
|
284
|
+
|
|
285
|
+
// Multiple Selection
|
|
286
|
+
<Select
|
|
287
|
+
label="Tech Stack"
|
|
288
|
+
selectionMode="multiple"
|
|
289
|
+
>
|
|
290
|
+
<SelectItem key="react">React</SelectItem>
|
|
291
|
+
<SelectItem key="vue">Vue</SelectItem>
|
|
292
|
+
</Select>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Features:**
|
|
296
|
+
|
|
297
|
+
- **Dynamic**: Supports single and multiple selection modes.
|
|
298
|
+
- **Controlled**: Fully controllable via `value` and `onValueChange`.
|
|
299
|
+
- **Accessible**: Keyboard navigation and ARIA support out of the box.
|
|
300
|
+
- **Customizable**: Styling slots for `trigger`, `popover`, `listbox`, `option`, etc.
|
|
301
|
+
|
|
302
|
+
### Checkbox
|
|
303
|
+
|
|
304
|
+
A control that allows the user to select one or more items from a set.
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
import { Checkbox, CheckboxGroup } from "rupo-ui";
|
|
308
|
+
|
|
309
|
+
// Single
|
|
310
|
+
<Checkbox>Accept terms</Checkbox>
|
|
311
|
+
|
|
312
|
+
// Indeterminate
|
|
313
|
+
<Checkbox isIndeterminate>Select all</Checkbox>
|
|
314
|
+
|
|
315
|
+
// Group
|
|
316
|
+
<CheckboxGroup
|
|
317
|
+
label="Select cities"
|
|
318
|
+
defaultValue={["sydney", "london"]}
|
|
319
|
+
color="warning"
|
|
320
|
+
>
|
|
321
|
+
<Checkbox value="sydney">Sydney</Checkbox>
|
|
322
|
+
<Checkbox value="london">London</Checkbox>
|
|
323
|
+
<Checkbox value="tokyo">Tokyo</Checkbox>
|
|
324
|
+
</CheckboxGroup>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Features:**
|
|
328
|
+
|
|
329
|
+
- **Controlled/Uncontrolled**: Supports both `isSelected`/`onValueChange` and `defaultSelected`.
|
|
330
|
+
- **Indeterminate**: Support for indeterminate state.
|
|
331
|
+
- **Group Context**: `CheckboxGroup` manages shared state and propagates styles (`color`, `size`, etc.) to children.
|
|
332
|
+
- **Accessibility**: Focus rings and native keyboard support.
|
|
333
|
+
|
|
334
|
+
### Radio & RadioGroup
|
|
335
|
+
|
|
336
|
+
A set of checkable buttons where only one can be checked at a time.
|
|
337
|
+
|
|
338
|
+
```tsx
|
|
339
|
+
import { Radio, RadioGroup } from "rupo-ui";
|
|
340
|
+
|
|
341
|
+
<RadioGroup label="Select Plan" defaultValue="free" color="secondary">
|
|
342
|
+
<Radio value="free">Free</Radio>
|
|
343
|
+
<Radio value="pro">Pro (Recommended)</Radio>
|
|
344
|
+
<Radio value="enterprise" description="Contact sales">
|
|
345
|
+
Enterprise
|
|
346
|
+
</Radio>
|
|
347
|
+
</RadioGroup>;
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Features:**
|
|
351
|
+
|
|
352
|
+
- **Single Selection**: Managed automatically by `RadioGroup`.
|
|
353
|
+
- **Customizable**: Full support for variants, colors, and sizes.
|
|
354
|
+
- **Accessibility**: Full ARIA support and keyboard navigation.
|
|
355
|
+
|
|
356
|
+
### Textarea
|
|
357
|
+
|
|
358
|
+
A multiline text input component with consistent styling and resizing controls.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
import { Textarea } from "rupo-ui";
|
|
362
|
+
|
|
363
|
+
<Textarea label="Description" placeholder="Enter your description" />
|
|
364
|
+
|
|
365
|
+
<Textarea
|
|
366
|
+
label="Bio"
|
|
367
|
+
variant="bordered"
|
|
368
|
+
resize="vertical"
|
|
369
|
+
rows={4}
|
|
370
|
+
/>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
**Props:**
|
|
374
|
+
|
|
375
|
+
- `label`, `placeholder`, `description`, `errorMessage`.
|
|
376
|
+
- `resize`: `none` (default), `vertical`, `horizontal`, `both`.
|
|
377
|
+
- `rows`: Number of text rows.
|
|
378
|
+
- Standard `Input` styling props (`variant`, `color`, `size`, `radius`).
|
|
379
|
+
|
|
380
|
+
### Spinner
|
|
381
|
+
|
|
382
|
+
loading indicator.
|
|
383
|
+
|
|
384
|
+
```tsx
|
|
385
|
+
import { Spinner } from "rupo-ui";
|
|
386
|
+
|
|
387
|
+
<Spinner size="lg" color="primary" />;
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Switch
|
|
391
|
+
|
|
392
|
+
A control that allows the user to toggle between checked and not checked.
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
import { Switch } from "rupo-ui";
|
|
396
|
+
|
|
397
|
+
<Switch defaultSelected>WiFi</Switch>
|
|
398
|
+
|
|
399
|
+
<Switch color="success" size="lg" startContent={<SunIcon />} endContent={<MoonIcon />}>
|
|
400
|
+
Dark Mode
|
|
401
|
+
</Switch>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
**Props:**
|
|
405
|
+
|
|
406
|
+
- `size`: `sm`, `md` (default), `lg`.
|
|
407
|
+
- `color`: `primary` (default), `secondary`, `success`, `warning`, `danger`.
|
|
408
|
+
- `startContent`, `endContent`: Icons or text inside the thumb.
|
|
409
|
+
- `isSelected`, `defaultSelected`, `onValueChange`.
|
|
410
|
+
|
|
411
|
+
### Dropdown
|
|
412
|
+
|
|
413
|
+
A floating menu that displays a list of actions or options.
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
import { Dropdown, DropdownTrigger, DropdownContent, DropdownItem } from "rupo-ui";
|
|
417
|
+
|
|
418
|
+
<Dropdown>
|
|
419
|
+
<DropdownTrigger>
|
|
420
|
+
<Button variant="bordered">Open Menu</Button>
|
|
421
|
+
</DropdownTrigger>
|
|
422
|
+
<DropdownContent>
|
|
423
|
+
<DropdownItem key="new">New file</DropdownItem>
|
|
424
|
+
<DropdownItem key="copy">Copy link</DropdownItem>
|
|
425
|
+
<DropdownItem key="edit">Edit file</DropdownItem>
|
|
426
|
+
<DropdownItem key="delete" className="text-danger" color="danger">
|
|
427
|
+
Delete file
|
|
428
|
+
</DropdownItem>
|
|
429
|
+
</DropdownContent>
|
|
430
|
+
</Dropdown>;
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Features:**
|
|
434
|
+
|
|
435
|
+
- **Trigger**: Can wrap any element (Button, Avatar, etc.).
|
|
436
|
+
- **Content**: Supports sections, dividers, and custom styling.
|
|
437
|
+
- **Interaction**: Handles focus, keyboard navigation, and click outside automatically.
|
|
438
|
+
|
|
439
|
+
### Modal
|
|
440
|
+
|
|
441
|
+
A dialog that focuses the user's attention exclusively on an information or an action.
|
|
442
|
+
|
|
443
|
+
```tsx
|
|
444
|
+
import {
|
|
445
|
+
Modal,
|
|
446
|
+
ModalTrigger,
|
|
447
|
+
ModalContent,
|
|
448
|
+
ModalHeader,
|
|
449
|
+
ModalBody,
|
|
450
|
+
ModalFooter,
|
|
451
|
+
Button,
|
|
452
|
+
} from "rupo-ui";
|
|
453
|
+
|
|
454
|
+
<Modal>
|
|
455
|
+
<ModalTrigger>
|
|
456
|
+
<Button>Open Modal</Button>
|
|
457
|
+
</ModalTrigger>
|
|
458
|
+
<ModalContent>
|
|
459
|
+
{(onClose) => (
|
|
460
|
+
<>
|
|
461
|
+
<ModalHeader>Modal Title</ModalHeader>
|
|
462
|
+
<ModalBody>
|
|
463
|
+
<p>Modal content goes here...</p>
|
|
464
|
+
</ModalBody>
|
|
465
|
+
<ModalFooter>
|
|
466
|
+
<Button color="danger" variant="light" onPress={onClose}>
|
|
467
|
+
Close
|
|
468
|
+
</Button>
|
|
469
|
+
<Button color="primary" onPress={onClose}>
|
|
470
|
+
Action
|
|
471
|
+
</Button>
|
|
472
|
+
</ModalFooter>
|
|
473
|
+
</>
|
|
474
|
+
)}
|
|
475
|
+
</ModalContent>
|
|
476
|
+
</Modal>;
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Props:**
|
|
480
|
+
|
|
481
|
+
- `size`: `xs` to `5xl`, `full`.
|
|
482
|
+
- `backdrop`: `opaque` (default), `blur`, `transparent`.
|
|
483
|
+
- `placement`: `auto`, `top`, `center` (default), `bottom`.
|
|
484
|
+
- `scrollBehavior`: `normal` (default), `inside`, `outside`.
|
|
485
|
+
|
|
486
|
+
### Tooltip
|
|
487
|
+
|
|
488
|
+
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
import { Tooltip, Button } from "rupo-ui";
|
|
492
|
+
|
|
493
|
+
<Tooltip content="I am a tooltip">
|
|
494
|
+
<Button>Hover me</Button>
|
|
495
|
+
</Tooltip>;
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
**Props:**
|
|
499
|
+
|
|
500
|
+
- `content`: The content of the tooltip.
|
|
501
|
+
- `placement`: Position relative to the trigger (top, bottom, left, right, etc.).
|
|
502
|
+
- `delay`: Delay in milliseconds before opening.
|
|
503
|
+
- `closeDelay`: Delay in milliseconds before closing.
|
|
504
|
+
- `offset`: Distance from the trigger.
|
|
505
|
+
|
|
506
|
+
### Popover
|
|
507
|
+
|
|
508
|
+
A non-modal dialog that floats around a trigger. It is used to display rich content behind a trigger element.
|
|
509
|
+
|
|
510
|
+
```tsx
|
|
511
|
+
import { Popover, PopoverTrigger, PopoverContent, Button } from "rupo-ui";
|
|
512
|
+
|
|
513
|
+
<Popover placement="bottom">
|
|
514
|
+
<PopoverTrigger>
|
|
515
|
+
<Button>Open Popover</Button>
|
|
516
|
+
</PopoverTrigger>
|
|
517
|
+
<PopoverContent showArrow={true}>
|
|
518
|
+
<div className="px-1 py-2">
|
|
519
|
+
<div className="text-small font-bold">Popover Content</div>
|
|
520
|
+
<div className="text-tiny">This is the popover content</div>
|
|
521
|
+
</div>
|
|
522
|
+
</PopoverContent>
|
|
523
|
+
</Popover>;
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
**Props:**
|
|
527
|
+
|
|
528
|
+
- `placement`: Position relative to the trigger (`top`, `bottom`, `left`, `right`, etc.).
|
|
529
|
+
- `offset`: Distance from the trigger.
|
|
530
|
+
- `trigger`: Interaction to trigger the popover: `click` (default), `hover`.
|
|
531
|
+
- `isOpen` / `defaultOpen` / `onOpenChange`: Controlled and uncontrolled state management.
|
|
532
|
+
- `showArrow`: Whether to show an arrow (on `PopoverContent`).
|
|
533
|
+
- `motionPreset`: `scale` (default), `fade`, `slide` (on `PopoverContent`).
|
|
534
|
+
|
|
535
|
+
### Tabs
|
|
536
|
+
|
|
537
|
+
A component that allows users to switch between different views or functional aspects of an application.
|
|
538
|
+
|
|
539
|
+
```tsx
|
|
540
|
+
import { Tabs, Tab } from "rupo-ui";
|
|
541
|
+
|
|
542
|
+
<Tabs aria-label="Options">
|
|
543
|
+
<Tab key="photos" title="Photos">
|
|
544
|
+
<Card>Photos Content</Card>
|
|
545
|
+
</Tab>
|
|
546
|
+
<Tab key="music" title="Music">
|
|
547
|
+
<Card>Music Content</Card>
|
|
548
|
+
</Tab>
|
|
549
|
+
<Tab key="videos" title="Videos">
|
|
550
|
+
<Card>Videos Content</Card>
|
|
551
|
+
</Tab>
|
|
552
|
+
</Tabs>
|
|
553
|
+
|
|
554
|
+
// Vertical
|
|
555
|
+
<Tabs isVertical aria-label="Vertical tabs">
|
|
556
|
+
<Tab key="settings" title="Settings" />
|
|
557
|
+
<Tab key="permissions" title="Permissions" />
|
|
558
|
+
</Tabs>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
**Props:**
|
|
562
|
+
|
|
563
|
+
- `variant`: `solid` (default), `underlined`, `bordered`, `light`.
|
|
564
|
+
- `color`: `default` (default), `primary`, `secondary`, `success`, `warning`, `danger`.
|
|
565
|
+
- `size`: `sm`, `md` (default), `lg`.
|
|
566
|
+
- `radius`: `none`, `sm`, `md`, `lg`, `full`.
|
|
567
|
+
- `isVertical`: Whether to render tabs vertically.
|
|
568
|
+
- `fullWidth`: Whether to take up the full width of the container.
|
|
569
|
+
|
|
570
|
+
## 🎨 Customization
|
|
571
|
+
|
|
572
|
+
### Global Configuration
|
|
573
|
+
|
|
574
|
+
Set default props for any component globally via the provider:
|
|
575
|
+
|
|
576
|
+
```tsx
|
|
577
|
+
<RupoUIProvider
|
|
578
|
+
config={{
|
|
579
|
+
Button: {
|
|
580
|
+
radius: "full",
|
|
581
|
+
variant: "bordered",
|
|
582
|
+
},
|
|
583
|
+
Input: {
|
|
584
|
+
size: "lg",
|
|
585
|
+
},
|
|
586
|
+
Textarea: {
|
|
587
|
+
variant: "faded",
|
|
588
|
+
},
|
|
589
|
+
}}
|
|
590
|
+
>
|
|
591
|
+
<App />
|
|
592
|
+
</RupoUIProvider>
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Granular Styling
|
|
596
|
+
|
|
597
|
+
Use the `classNames` prop to override inner slots of any component:
|
|
598
|
+
|
|
599
|
+
```tsx
|
|
600
|
+
<Input
|
|
601
|
+
classNames={{
|
|
602
|
+
input: "text-lg font-bold",
|
|
603
|
+
inputWrapper: "bg-gray-100 dark:bg-gray-800",
|
|
604
|
+
label: "text-primary",
|
|
605
|
+
}}
|
|
606
|
+
/>
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
## 📄 License
|
|
610
|
+
|
|
611
|
+
MIT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const Button: React.ForwardRefExoticComponent<{
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
variant?: "solid" | "flat" | "ghost" | "bordered";
|
|
7
|
+
color?: "primary" | "secondary" | "success" | "warning" | "danger";
|
|
8
|
+
radius?: "sm" | "md" | "lg" | "full";
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
startContent?: React.ReactNode;
|
|
13
|
+
endContent?: React.ReactNode;
|
|
14
|
+
as?: any;
|
|
15
|
+
href?: string;
|
|
16
|
+
classNames?: Partial<Record<"base" | "content" | "spinner", string>>;
|
|
17
|
+
} & Omit<import('framer-motion').HTMLMotionProps<"button">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|