@js-empire/emperor-ui 1.2.4 → 1.2.5
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 +226 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,238 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./public/images/emperor-ui-logo.png" alt="Emperor UI Logo" width="120" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">Emperor UI</h1>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>They provide the atoms, we provide the empire.</strong>
|
|
9
|
+
</p>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@js-empire/emperor-ui">
|
|
13
|
+
<img src="https://img.shields.io/npm/v/@js-empire/emperor-ui.svg" alt="npm version" />
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://github.com/MustafaHasanat/emperor-ui/blob/main/package.json">
|
|
16
|
+
<img src="https://img.shields.io/npm/l/@js-empire/emperor-ui" alt="license" />
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Introduction
|
|
23
|
+
|
|
24
|
+
**Emperor UI** is a modular React component library built for modern web applications. It sits on top of [HeroUI](https://www.heroui.com/) to deliver ready-made organisms and page-level building blocks—so you can ship features faster without rebuilding common patterns from scratch.
|
|
25
|
+
|
|
26
|
+
Every component is designed with full control in mind: optional features can be enabled or disabled via props, and styling is customizable through `className` and `classNames` for fine-grained overrides.
|
|
27
|
+
|
|
28
|
+
Ideal for **React** and **Next.js** projects that use **Tailwind CSS** and HeroUI.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Install the package from npm:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @js-empire/emperor-ui
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or with yarn:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
yarn add @js-empire/emperor-ui
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or with pnpm:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm add @js-empire/emperor-ui
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Peer dependencies
|
|
53
|
+
|
|
54
|
+
Emperor UI depends on **React**, **HeroUI**, **Tailwind CSS**, and related tooling. Ensure your project has compatible versions. For theme switching, **next-themes** is used.
|
|
55
|
+
|
|
56
|
+
### Styles
|
|
57
|
+
|
|
58
|
+
Import the library’s global styles in your app root (e.g. `layout.tsx` or `_app.tsx`):
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import "@js-empire/emperor-ui/globals.css";
|
|
62
|
+
```
|
|
10
63
|
|
|
11
64
|
---
|
|
12
65
|
|
|
13
66
|
## Components
|
|
14
67
|
|
|
15
|
-
|
|
68
|
+
Components are grouped by complexity: **Atoms** (small building blocks), **Molecules** (combinations of atoms), **Organisms** (sections and features), and **Templates** (full page layouts).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Atoms
|
|
73
|
+
|
|
74
|
+
| Component | Description |
|
|
75
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
76
|
+
| **Brand** | Logo and brand mark for headers and sidebars. |
|
|
77
|
+
| **ColorPicker** | Color selection with preset or free (input) modes. Use `inputType="preset"` for predefined colors. |
|
|
78
|
+
| **Container** | Centered layout wrapper with consistent padding. |
|
|
79
|
+
| **Column** | Flex column layout primitive. |
|
|
80
|
+
| **Row** | Flex row layout primitive. |
|
|
81
|
+
| **CopyButton** | Button that copies a given string to the clipboard and shows copy/success state. Pass `value` to copy. |
|
|
82
|
+
| **Field** | Form field / sorter wrapper. |
|
|
83
|
+
| **Filter** | Single filter unit. Types: `search`, `select`, `autocomplete`, `date`, `numeric`, `checkbox`, `checkboxGroup`, `switch`, `range`. Use with `paramKey` and type-specific props. |
|
|
84
|
+
| **Portal** | Renders children into a DOM node (e.g. modals, tooltips). |
|
|
85
|
+
| **ThemeSwitch** | Toggle between light and dark theme (works with `next-themes`). |
|
|
86
|
+
| **Uploader** | File upload with label, listing, and optional avatar mode. Use with `useUpload` and pass the returned props. |
|
|
87
|
+
|
|
88
|
+
**Example — Theme switch**
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { ThemeSwitch } from "@js-empire/emperor-ui";
|
|
92
|
+
|
|
93
|
+
<ThemeSwitch />;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Example — Copy button**
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { CopyButton } from "@js-empire/emperor-ui";
|
|
100
|
+
|
|
101
|
+
<CopyButton value="Text to copy" />;
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Example — Filter**
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { Filter } from "@js-empire/emperor-ui";
|
|
108
|
+
|
|
109
|
+
<Filter
|
|
110
|
+
type="search"
|
|
111
|
+
paramKey="q"
|
|
112
|
+
searchProps={{ placeholder: "Search..." }}
|
|
113
|
+
/>;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Example — Uploader**
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { Uploader, useUpload } from "@js-empire/emperor-ui";
|
|
120
|
+
|
|
121
|
+
const uploadProps = useUpload({
|
|
122
|
+
labelId: "uploaded-file",
|
|
123
|
+
fileTypes: ["image", "pdf"],
|
|
124
|
+
isRequired: true,
|
|
125
|
+
isMulti: true,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
<Uploader {...uploadProps} />;
|
|
129
|
+
```
|
|
16
130
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### Molecules
|
|
134
|
+
|
|
135
|
+
| Component | Description |
|
|
136
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| **ItemCard** | Card for list/grid items: header, body, footer, optional actions and hover effects. Supports vertical/horizontal orientation. |
|
|
138
|
+
| **NavBar** | Horizontal navigation with items and optional hover effects. |
|
|
139
|
+
| **Scaffold** | Main content wrapper; respects Emperor UI config (e.g. `dir` for RTL). |
|
|
140
|
+
| **SideBar** | Collapsible sidebar with drawer on mobile; use with header, items, and trigger. |
|
|
141
|
+
|
|
142
|
+
**Example — Item card**
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { ItemCard } from "@js-empire/emperor-ui";
|
|
146
|
+
|
|
147
|
+
<ItemCard
|
|
148
|
+
item={{ key: "1", title: "Item", subtitle: "Description" }}
|
|
149
|
+
orientation="vertical"
|
|
150
|
+
actions={[{ key: "edit", label: "Edit" }]}
|
|
151
|
+
onActionClick={(key) => console.log(key)}
|
|
152
|
+
/>;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Example — Scaffold**
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import { Scaffold } from "@js-empire/emperor-ui";
|
|
159
|
+
|
|
160
|
+
<Scaffold>
|
|
161
|
+
<YourPageContent />
|
|
162
|
+
</Scaffold>;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### Organisms
|
|
168
|
+
|
|
169
|
+
| Component | Description |
|
|
170
|
+
| --------------- | ----------------------------------------------------------------------------------------------- |
|
|
171
|
+
| **Filters** | Container for multiple `Filter` components. Children must be `Filter` only. |
|
|
172
|
+
| **Footer** | Site footer with quick links, social links, policies, and copyright. |
|
|
173
|
+
| **Header** | App header with sidebar (drawer on mobile), nav bar, and optional glass effect. |
|
|
174
|
+
| **ItemDetails** | Details view block (e.g. breadcrumbs, media, title, price). |
|
|
175
|
+
| **Listings** | Grid or list of items with `ItemCard`, loading skeletons, empty state, and optional pagination. |
|
|
176
|
+
|
|
177
|
+
**Example — Filters**
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { Filters, Filter } from "@js-empire/emperor-ui";
|
|
181
|
+
|
|
182
|
+
<Filters>
|
|
183
|
+
<Filter type="search" paramKey="q" />
|
|
184
|
+
<Filter type="select" paramKey="category" options={[...]} />
|
|
185
|
+
</Filters>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Example — Listings**
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { Listings } from "@js-empire/emperor-ui";
|
|
23
192
|
|
|
24
|
-
|
|
193
|
+
<Listings
|
|
194
|
+
items={items}
|
|
195
|
+
layout="grid"
|
|
196
|
+
isLoading={isLoading}
|
|
197
|
+
pagination={{ page: 1, total: 10, pageSize: 12 }}
|
|
198
|
+
/>;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Example — Header**
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import { Header } from "@js-empire/emperor-ui";
|
|
205
|
+
|
|
206
|
+
<Header variant="default" glassEffect />;
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### Templates
|
|
212
|
+
|
|
213
|
+
| Component | Description |
|
|
214
|
+
| --------------- | --------------------------------------------------------------- |
|
|
215
|
+
| **LandingPage** | Full landing page layout composing header, content, and footer. |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Documentation & development
|
|
220
|
+
|
|
221
|
+
- **Storybook** — Run `npm run storybook` to browse and test components locally.
|
|
222
|
+
- **Issues** — [GitHub Issues](https://github.com/MustafaHasanat/emperor-ui/issues)
|
|
223
|
+
- **Repository** — [GitHub](https://github.com/MustafaHasanat/emperor-ui)
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Author
|
|
228
|
+
|
|
229
|
+
**JS Empire — Mustafa Alhasanat**
|
|
230
|
+
|
|
231
|
+
- [GitHub](https://github.com/MustafaHasanat)
|
|
232
|
+
- [npm](https://www.npmjs.com/~js-empire)
|
|
233
|
+
|
|
234
|
+
---
|
|
25
235
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- checkbox
|
|
30
|
-
- Multiple checkboxes under an accordion
|
|
31
|
-
- autocomplete or select box
|
|
32
|
-
- Action buttons: apply filters, reset filters
|
|
236
|
+
<p align="center">
|
|
237
|
+
<sub>Built with React, HeroUI, and Tailwind.</sub>
|
|
238
|
+
</p>
|