alope-ui 1.2.6 β 1.2.8
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 +275 -8
- package/dist/components/Popover/Popover.d.ts +14 -0
- package/dist/index.css +1 -1
- package/dist/main.cjs +95 -82
- package/dist/main.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,19 +100,16 @@ export default App;
|
|
|
100
100
|
- [π Pagination](#pagination) - Page navigation controls
|
|
101
101
|
- [π± Bottom Navbar](#bottom-navbar) - Mobile bottom navigation bar
|
|
102
102
|
|
|
103
|
-
---
|
|
104
|
-
|
|
105
103
|
### Feedback Components
|
|
106
104
|
|
|
107
105
|
- [β οΈ Alert](#alert) - Status messages and notifications
|
|
108
106
|
- [π Toast](#toast) - Temporary notification messages
|
|
107
|
+
- [π¨οΈ Popover](#popover) - Contextual interactive content
|
|
109
108
|
- [π‘ Tooltip](#tooltip) - Contextual information on hover
|
|
110
109
|
- [β³ Spinner](#spinner) - Loading indicators
|
|
111
110
|
- [π Skeleton](#skeleton) - Content loading placeholders
|
|
112
111
|
- [π
Date Picker](#datepicker) - Date selection calendar
|
|
113
112
|
|
|
114
|
-
---
|
|
115
|
-
|
|
116
113
|
### Data Display
|
|
117
114
|
|
|
118
115
|
- [π·οΈ Badge](#badge) - Status indicators and labels
|
|
@@ -124,8 +121,6 @@ export default App;
|
|
|
124
121
|
- [π Timeline](#timeline) - Chronological event display
|
|
125
122
|
- [π Collection](#collection) - Grouped content or list display
|
|
126
123
|
|
|
127
|
-
---
|
|
128
|
-
|
|
129
124
|
### Form Controls
|
|
130
125
|
|
|
131
126
|
- [βοΈ Checkbox Input](#checkbox-input) - Multiple choice selections
|
|
@@ -138,8 +133,6 @@ export default App;
|
|
|
138
133
|
- [π’ Code Input](#codeinput) - Multi-field input for codes or OTPs
|
|
139
134
|
- [ποΈ Slider](#slider) - Range or value selector
|
|
140
135
|
|
|
141
|
-
---
|
|
142
|
-
|
|
143
136
|
### Interactive Elements
|
|
144
137
|
|
|
145
138
|
- [π Button](#button) - Clickable actions
|
|
@@ -149,6 +142,20 @@ export default App;
|
|
|
149
142
|
|
|
150
143
|
---
|
|
151
144
|
|
|
145
|
+
## π¨ Customization
|
|
146
|
+
|
|
147
|
+
### Theming
|
|
148
|
+
|
|
149
|
+
- [βοΈ Setup](#setup) - Wrap your app with ThemeProvider
|
|
150
|
+
- [π― Usage](#usage) - Access theme with useTheme hook
|
|
151
|
+
- [π Theme Hook API](#theme-hook-api) - Available properties and methods
|
|
152
|
+
- [π¨ Styling Components](#styling-components) - Theme-aware styling with Tailwind
|
|
153
|
+
- [πΎ Persistence](#persistence) - Automatic localStorage integration
|
|
154
|
+
- [π Example Implementation](#example-implementation) - Complete theming example
|
|
155
|
+
- [β¨ Best Practices](#best-practices) - Guidelines for optimal theming
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
152
159
|
## π Component Documentation
|
|
153
160
|
|
|
154
161
|
## Accordion
|
|
@@ -1229,6 +1236,150 @@ const BasicExample = () => {
|
|
|
1229
1236
|
|
|
1230
1237
|
---
|
|
1231
1238
|
|
|
1239
|
+
## Popover
|
|
1240
|
+
|
|
1241
|
+
The Popover component displays contextual content or interactive elements over a trigger element. Itβs useful for showing details, quick actions, or supplementary information without navigating away from the page.
|
|
1242
|
+
|
|
1243
|
+
### Import
|
|
1244
|
+
|
|
1245
|
+
```jsx
|
|
1246
|
+
import { Popover } from "alope-ui";
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
### Props
|
|
1250
|
+
|
|
1251
|
+
| Prop | Type | Default | Description |
|
|
1252
|
+
| ------------- | ---------------------------------------- | --------- | --------------------------------- |
|
|
1253
|
+
| `title` | `string` | `""` | Popover header title |
|
|
1254
|
+
| `content` | `string` | `""` | Main Popover content |
|
|
1255
|
+
| `placement` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Position relative to trigger |
|
|
1256
|
+
| `trigger` | `'click' \| 'hover'` | `'click'` | How Popover appears |
|
|
1257
|
+
| `dismissible` | `boolean` | `false` | Close by clicking outside |
|
|
1258
|
+
| `disabled` | `boolean` | `false` | Disable Popover |
|
|
1259
|
+
| `offset` | `string` | `'8'` | Distance from trigger (px) |
|
|
1260
|
+
| `arrow` | `'arrow' \| 'no-arrow'` | `'arrow'` | Show arrow pointing to trigger |
|
|
1261
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
1262
|
+
| `children` | `React.ReactNode` | required | Element that triggers the Popover |
|
|
1263
|
+
|
|
1264
|
+
### Basic Popover
|
|
1265
|
+
|
|
1266
|
+
```jsx
|
|
1267
|
+
<Popover
|
|
1268
|
+
title="Default Popover"
|
|
1269
|
+
content="This is the default popover, suitable for displaying brief information."
|
|
1270
|
+
>
|
|
1271
|
+
<Button variant="solid">Default Popover</Button>
|
|
1272
|
+
</Popover>
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
### Placement
|
|
1276
|
+
|
|
1277
|
+
```jsx
|
|
1278
|
+
<Popover placement="top" title="Top Popover" content="Appears above the button">
|
|
1279
|
+
<Button>Top</Button>
|
|
1280
|
+
</Popover>
|
|
1281
|
+
|
|
1282
|
+
<Popover placement="right" title="Right Popover" content="Appears to the right">
|
|
1283
|
+
<Button>Right</Button>
|
|
1284
|
+
</Popover>
|
|
1285
|
+
|
|
1286
|
+
<Popover placement="bottom" title="Bottom Popover" content="Appears below">
|
|
1287
|
+
<Button>Bottom</Button>
|
|
1288
|
+
</Popover>
|
|
1289
|
+
|
|
1290
|
+
<Popover placement="left" title="Left Popover" content="Appears to the left">
|
|
1291
|
+
<Button>Left</Button>
|
|
1292
|
+
</Popover>
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
### Trigger
|
|
1296
|
+
|
|
1297
|
+
```jsx
|
|
1298
|
+
<Popover trigger="click" title="Click Popover" content="Triggered by click">
|
|
1299
|
+
<Button>Click me</Button>
|
|
1300
|
+
</Popover>
|
|
1301
|
+
|
|
1302
|
+
<Popover trigger="hover" title="Hover Popover" content="Triggered on hover">
|
|
1303
|
+
<Button>Hover me</Button>
|
|
1304
|
+
</Popover>
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
### Arrow
|
|
1308
|
+
|
|
1309
|
+
```jsx
|
|
1310
|
+
<Popover arrow="arrow" title="Arrow Popover" content="Popover with arrow">
|
|
1311
|
+
<Button>With arrow</Button>
|
|
1312
|
+
</Popover>
|
|
1313
|
+
|
|
1314
|
+
<Popover arrow="no-arrow" title="No Arrow" content="Popover without arrow">
|
|
1315
|
+
<Button>No arrow</Button>
|
|
1316
|
+
</Popover>
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
### Offset
|
|
1320
|
+
|
|
1321
|
+
```jsx
|
|
1322
|
+
<Popover title="Default Offset" content="Default 8px offset">
|
|
1323
|
+
<Button>Default offset</Button>
|
|
1324
|
+
</Popover>
|
|
1325
|
+
|
|
1326
|
+
<Popover offset="16" title="Custom Offset" content="Custom 16px offset">
|
|
1327
|
+
<Button>Custom offset</Button>
|
|
1328
|
+
</Popover>
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
### Custom Popover
|
|
1332
|
+
|
|
1333
|
+
```jsx
|
|
1334
|
+
<Popover
|
|
1335
|
+
content={
|
|
1336
|
+
<div className="flex flex-col gap-3 w-64 max-w-full p-4 bg-white dark:bg-gray-900">
|
|
1337
|
+
<div className="flex items-center gap-3">
|
|
1338
|
+
<Avatar fallbackName="John Doe" />
|
|
1339
|
+
<div className="flex flex-col">
|
|
1340
|
+
<span className="font-semibold">Jane Doe</span>
|
|
1341
|
+
<span className="text-sm text-gray-500">@janedoe</span>
|
|
1342
|
+
</div>
|
|
1343
|
+
</div>
|
|
1344
|
+
<p className="text-sm text-gray-600">
|
|
1345
|
+
Frontend developer passionate about React and UI design.
|
|
1346
|
+
</p>
|
|
1347
|
+
<Button variant="solid" variantType="info">
|
|
1348
|
+
Follow
|
|
1349
|
+
</Button>
|
|
1350
|
+
</div>
|
|
1351
|
+
}
|
|
1352
|
+
>
|
|
1353
|
+
<Button>Custom Popover</Button>
|
|
1354
|
+
</Popover>
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
### Dismissible Popover
|
|
1358
|
+
|
|
1359
|
+
```jsx
|
|
1360
|
+
<Popover
|
|
1361
|
+
title="Dismissible Popover"
|
|
1362
|
+
content="Click outside to close this popover."
|
|
1363
|
+
dismissible
|
|
1364
|
+
>
|
|
1365
|
+
<Button variant="solid" variantType="error">
|
|
1366
|
+
Dismissible Popover
|
|
1367
|
+
</Button>
|
|
1368
|
+
</Popover>
|
|
1369
|
+
```
|
|
1370
|
+
|
|
1371
|
+
### Disabled Popover
|
|
1372
|
+
|
|
1373
|
+
```jsx
|
|
1374
|
+
<Popover title="Disabled Popover" content="This popover is disabled." disabled>
|
|
1375
|
+
<Button variant="solid" disabled>
|
|
1376
|
+
Disabled
|
|
1377
|
+
</Button>
|
|
1378
|
+
</Popover>
|
|
1379
|
+
```
|
|
1380
|
+
|
|
1381
|
+
---
|
|
1382
|
+
|
|
1232
1383
|
## Checkbox Input
|
|
1233
1384
|
|
|
1234
1385
|
The CheckboxInput component provides checkbox functionality for selecting single or multiple options, with indeterminate state support.
|
|
@@ -7238,6 +7389,122 @@ const CompleteExample = () => {
|
|
|
7238
7389
|
|
|
7239
7390
|
---
|
|
7240
7391
|
|
|
7392
|
+
## Theming
|
|
7393
|
+
|
|
7394
|
+
ALOPE UI provides built-in theming support with light and dark mode capabilities. The theming system is implemented using React Context, making it easy to toggle themes across your entire application.
|
|
7395
|
+
|
|
7396
|
+
### Setup
|
|
7397
|
+
|
|
7398
|
+
To enable theming in your application, wrap your app with the `ThemeProvider`:
|
|
7399
|
+
|
|
7400
|
+
```tsx
|
|
7401
|
+
import { StrictMode } from "react";
|
|
7402
|
+
import { createRoot } from "react-dom/client";
|
|
7403
|
+
import { ThemeProvider } from "./context/ThemeContext";
|
|
7404
|
+
import App from "./App";
|
|
7405
|
+
|
|
7406
|
+
createRoot(document.getElementById("root")!).render(
|
|
7407
|
+
<StrictMode>
|
|
7408
|
+
<ThemeProvider>
|
|
7409
|
+
<App />
|
|
7410
|
+
</ThemeProvider>
|
|
7411
|
+
</StrictMode>
|
|
7412
|
+
);
|
|
7413
|
+
```
|
|
7414
|
+
|
|
7415
|
+
### Usage
|
|
7416
|
+
|
|
7417
|
+
Once your app is wrapped with `ThemeProvider`, you can access the current theme and toggle function using the `useTheme` hook:
|
|
7418
|
+
|
|
7419
|
+
```tsx
|
|
7420
|
+
import { useTheme } from "./context/ThemeContext";
|
|
7421
|
+
import { Button } from "./components";
|
|
7422
|
+
|
|
7423
|
+
function App() {
|
|
7424
|
+
const { theme, toggleTheme } = useTheme();
|
|
7425
|
+
|
|
7426
|
+
return (
|
|
7427
|
+
<div>
|
|
7428
|
+
<Button onClick={toggleTheme}>
|
|
7429
|
+
Toggle {theme.charAt(0).toUpperCase() + theme.slice(1)} Mode
|
|
7430
|
+
</Button>
|
|
7431
|
+
|
|
7432
|
+
<p>Current theme: {theme}</p>
|
|
7433
|
+
</div>
|
|
7434
|
+
);
|
|
7435
|
+
}
|
|
7436
|
+
```
|
|
7437
|
+
|
|
7438
|
+
### Theme Hook API
|
|
7439
|
+
|
|
7440
|
+
The `useTheme` hook returns an object with the following properties:
|
|
7441
|
+
|
|
7442
|
+
- **`theme`**: `'light' | 'dark'` - The current active theme
|
|
7443
|
+
- **`toggleTheme`**: `() => void` - Function to toggle between light and dark modes
|
|
7444
|
+
|
|
7445
|
+
### Styling Components
|
|
7446
|
+
|
|
7447
|
+
ALOPE UI components automatically respond to theme changes through Tailwind's `dark:` modifier. The theme is applied via a `dark` class on the root element.
|
|
7448
|
+
|
|
7449
|
+
Example of theme-aware styling:
|
|
7450
|
+
|
|
7451
|
+
```tsx
|
|
7452
|
+
<div className="bg-white dark:bg-gray-800">
|
|
7453
|
+
<h1 className="text-gray-800 dark:text-white">Hello World</h1>
|
|
7454
|
+
<p className="text-gray-600 dark:text-gray-300">
|
|
7455
|
+
This text adapts to the current theme
|
|
7456
|
+
</p>
|
|
7457
|
+
</div>
|
|
7458
|
+
```
|
|
7459
|
+
|
|
7460
|
+
### Persistence
|
|
7461
|
+
|
|
7462
|
+
The theme preference is automatically saved to `localStorage` and persists across browser sessions.
|
|
7463
|
+
|
|
7464
|
+
### Example Implementation
|
|
7465
|
+
|
|
7466
|
+
Here's a complete example showing theme integration:
|
|
7467
|
+
|
|
7468
|
+
```tsx
|
|
7469
|
+
import { Button, Card } from "./components";
|
|
7470
|
+
import { useTheme } from "./context/ThemeContext";
|
|
7471
|
+
|
|
7472
|
+
function App() {
|
|
7473
|
+
const { theme, toggleTheme } = useTheme();
|
|
7474
|
+
|
|
7475
|
+
return (
|
|
7476
|
+
<div className="min-h-screen bg-gradient-to-br from-primary/25 to-blue-100 dark:from-gray-900 dark:to-gray-700">
|
|
7477
|
+
<div className="max-w-6xl mx-auto p-10">
|
|
7478
|
+
<h1 className="text-4xl font-bold text-gray-800 dark:text-white">
|
|
7479
|
+
ALOPE UI Library
|
|
7480
|
+
</h1>
|
|
7481
|
+
|
|
7482
|
+
<Button onClick={toggleTheme} className="mt-4">
|
|
7483
|
+
Toggle {theme.charAt(0).toUpperCase() + theme.slice(1)} Mode
|
|
7484
|
+
</Button>
|
|
7485
|
+
|
|
7486
|
+
<Card
|
|
7487
|
+
title="Theme-Aware Card"
|
|
7488
|
+
description="This card automatically adapts to your theme preference"
|
|
7489
|
+
titleClassName="dark:text-white"
|
|
7490
|
+
descriptionClassName="dark:text-gray-300"
|
|
7491
|
+
containerClassName="dark:bg-gray-800 dark:border-gray-700"
|
|
7492
|
+
/>
|
|
7493
|
+
</div>
|
|
7494
|
+
</div>
|
|
7495
|
+
);
|
|
7496
|
+
}
|
|
7497
|
+
```
|
|
7498
|
+
|
|
7499
|
+
### Best Practices
|
|
7500
|
+
|
|
7501
|
+
1. **Wrap at the root level**: Place `ThemeProvider` at the top level of your application, typically in `main.tsx`
|
|
7502
|
+
2. **Use dark: modifiers**: Leverage Tailwind's `dark:` prefix for all theme-dependent styles
|
|
7503
|
+
3. **Consistent colors**: Use semantic color classes that work well in both themes
|
|
7504
|
+
4. **Test both modes**: Always test your components in both light and dark modes
|
|
7505
|
+
|
|
7506
|
+
---
|
|
7507
|
+
|
|
7241
7508
|
## π‘ Contributing
|
|
7242
7509
|
|
|
7243
7510
|
We welcome contributions! If you want to add features, fix bugs, or improve documentation, feel free to fork this project and submit a pull request.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type PopoverProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
content?: string | React.ReactNode;
|
|
5
|
+
placement?: "top" | "bottom" | "left" | "right";
|
|
6
|
+
trigger?: "click" | "hover";
|
|
7
|
+
dismissible?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
offset?: string;
|
|
10
|
+
arrow?: "arrow" | "no-arrow";
|
|
11
|
+
className?: string;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const Popover: React.FC<PopoverProps>;
|