@aristobyte-ui/dropdown 2.6.2 → 2.8.1
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 +120 -0
- package/es/.tsbuildinfo +1 -1
- package/es/components/Dropdown/index.d.ts +0 -1
- package/es/components/DropdownOption/index.d.ts +0 -1
- package/es/components/index.d.ts +0 -1
- package/es/index.d.ts +0 -1
- package/lib/.tsbuildinfo +1 -1
- package/lib/components/Dropdown/index.d.ts +0 -1
- package/lib/components/DropdownOption/index.d.ts +0 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/package.json +11 -3
- package/es/components/Dropdown/index.d.ts.map +0 -1
- package/es/components/DropdownOption/index.d.ts.map +0 -1
- package/es/components/index.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/lib/components/Dropdown/index.d.ts.map +0 -1
- package/lib/components/DropdownOption/index.d.ts.map +0 -1
- package/lib/components/index.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# @aristobyte-ui/dropdown
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/badge/TypeScript-5.8-blue?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
|
|
5
|
+
<img src="https://img.shields.io/badge/Build-Turbo-green?style=for-the-badge&logo=turbo&logoColor=white" alt="TurboRepo" />
|
|
6
|
+
<img src="https://img.shields.io/badge/Lint-Strict-red?style=for-the-badge&logo=eslint&logoColor=white" alt="ESLint" />
|
|
7
|
+
<img src="https://img.shields.io/badge/License-MIT-black?style=for-the-badge&logo=open-source-initiative&logoColor=white" alt="License" />
|
|
8
|
+
<img src="https://img.shields.io/badge/AristoByte-UI-purple?style=for-the-badge&logo=react&logoColor=white" alt="AristoByte UI" />
|
|
9
|
+
<img src="https://img.shields.io/badge/Node-20.17.0+-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js >=20.17.0" />
|
|
10
|
+
<img src="https://img.shields.io/badge/Yarn-1.22+-2C8EBB?style=for-the-badge&logo=yarn&logoColor=white" alt="Yarn >=1.22" />
|
|
11
|
+
<img src="https://img.shields.io/badge/NPM-10.8+-CB3837?style=for-the-badge&logo=npm&logoColor=white" alt="NPM >=10.8" />
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
> A fully typed, modular, and composable Dropdown component built for AristoByteUI, leveraging Button for interactive triggers and providing lightweight, performant, and flexible menus for React applications.
|
|
15
|
+
|
|
16
|
+
## 📦 Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install via Yarn
|
|
20
|
+
yarn add -D @aristobyte-ui/dropdown
|
|
21
|
+
|
|
22
|
+
# Or via npm
|
|
23
|
+
npm install -D @aristobyte-ui/dropdown
|
|
24
|
+
|
|
25
|
+
# Or via pnpm
|
|
26
|
+
pnpm add -D @aristobyte-ui/dropdown
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 🛠 Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Dropdown } from "@aristobyte-ui/dropdown";
|
|
34
|
+
import { Button } from "@aristobyte-ui/button";
|
|
35
|
+
|
|
36
|
+
export default function Example() {
|
|
37
|
+
return (
|
|
38
|
+
<Dropdown
|
|
39
|
+
trigger={<Button variant="primary">Options</Button>}
|
|
40
|
+
items={[
|
|
41
|
+
{ label: "Profile", onClick: () => console.log("Profile clicked") },
|
|
42
|
+
{ label: "Settings", onClick: () => console.log("Settings clicked") },
|
|
43
|
+
{ label: "Logout", onClick: () => console.log("Logout clicked") },
|
|
44
|
+
]}
|
|
45
|
+
placement="bottom-start"
|
|
46
|
+
disabled={false}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
##📂 Presets Available
|
|
53
|
+
|
|
54
|
+
- **trigger**: Any React element, commonly a Button, to toggle the dropdown.
|
|
55
|
+
- **items**: Array of menu items, each with label, optional icon, and onClick callback.
|
|
56
|
+
- **placement**: Positioning of the dropdown menu (e.g., `top`, `bottom`, `left`, `right` with variations like -start or -end).
|
|
57
|
+
- **disabled**: Boolean to disable the dropdown trigger.
|
|
58
|
+
|
|
59
|
+
## 🔧 Example in a Package
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { Dropdown } from "@aristobyte-ui/dropdown";
|
|
63
|
+
import { Button } from "@aristobyte-ui/button";
|
|
64
|
+
import { FiSettings, FiUser } from "react-icons/fi";
|
|
65
|
+
|
|
66
|
+
export function UserMenu() {
|
|
67
|
+
return (
|
|
68
|
+
<Dropdown
|
|
69
|
+
trigger={
|
|
70
|
+
<Button variant="secondary" appearance="outline">
|
|
71
|
+
Menu
|
|
72
|
+
</Button>
|
|
73
|
+
}
|
|
74
|
+
items={[
|
|
75
|
+
{
|
|
76
|
+
label: "Profile",
|
|
77
|
+
icon: FiUser,
|
|
78
|
+
onClick: () => console.log("Profile"),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "Settings",
|
|
82
|
+
icon: FiSettings,
|
|
83
|
+
onClick: () => console.log("Settings"),
|
|
84
|
+
},
|
|
85
|
+
{ label: "Logout", onClick: () => console.log("Logout") },
|
|
86
|
+
]}
|
|
87
|
+
placement="bottom-end"
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 📊 Why This Matters
|
|
94
|
+
|
|
95
|
+
- **Performance-first:** Lightweight CSS ensures fast rendering and smooth transitions.
|
|
96
|
+
- **Fully typed:** TypeScript-first API ensures predictable usage and IDE autocomplete.
|
|
97
|
+
- **AristoByteUI ready:** Seamlessly integrates with design tokens, SCSS modules, and Button component composition.
|
|
98
|
+
- **Flexible:** Supports multiple variants, appearances, sizes, radius options, icons, ripple-enabled interactive feedback, and nested menu structures.
|
|
99
|
+
|
|
100
|
+
## 🏆 Philosophy
|
|
101
|
+
|
|
102
|
+
- **Modular architecture:** Dropdown component is fully composable with Button and other interactive elements.
|
|
103
|
+
- **Declarative styling:** SCSS modules keep styles maintainable and scoped.
|
|
104
|
+
- **Strict typing & runtime flexibility:** Props fully typed while allowing runtime overrides.
|
|
105
|
+
- **Developer experience optimized:** Easy to use with predictable behavior and minimal boilerplate.
|
|
106
|
+
|
|
107
|
+
## 📜 License
|
|
108
|
+
|
|
109
|
+
MIT © AristoByte
|
|
110
|
+
|
|
111
|
+
## 🛡 Shields Showcase
|
|
112
|
+
|
|
113
|
+
<p align="center">
|
|
114
|
+
<img src="https://img.shields.io/badge/Consistency-100%25-green?style=for-the-badge&logo=typescript" />
|
|
115
|
+
<img src="https://img.shields.io/badge/Maintained-Active-brightgreen?style=for-the-badge&logo=github" />
|
|
116
|
+
<img src="https://img.shields.io/badge/Strictness-High-critical?style=for-the-badge&logo=eslint" />
|
|
117
|
+
<img src="https://img.shields.io/badge/Declarations-Enabled-blue?style=for-the-badge&logo=typescript" />
|
|
118
|
+
<img src="https://img.shields.io/badge/Monorepo-Turbo-green?style=for-the-badge&logo=monorepo" />
|
|
119
|
+
<img src="https://img.shields.io/badge/Interop-ESM%2FCJS-orange?style=for-the-badge&logo=javascript" />
|
|
120
|
+
</p>
|