elij-ui-library 0.3.1 → 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/README.md +219 -85
- package/package.json +1 -1
- package/registry/components.json +1 -1
package/README.md
CHANGED
|
@@ -1,120 +1,175 @@
|
|
|
1
|
-
# Elij UI
|
|
1
|
+
# Elij UI Library
|
|
2
2
|
|
|
3
|
-
A reusable React + TypeScript component library with Storybook documentation.
|
|
3
|
+
A reusable React + TypeScript component library with accessible primitives, layout components, charts, themes, and Storybook documentation.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
in registry/components.json for future CLI and MCP tooling.
|
|
5
|
+
## Installation
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
Install the published package in a React application:
|
|
9
8
|
|
|
10
9
|
```bash
|
|
11
|
-
npm install
|
|
12
|
-
npm run dev
|
|
10
|
+
npm install elij-ui-library
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
`react` and `react-dom` are peer dependencies, so your application should provide React 18 or 19.
|
|
16
14
|
|
|
17
|
-
##
|
|
15
|
+
## Basic usage
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
npm run build
|
|
21
|
-
npm run build-storybook
|
|
22
|
-
```
|
|
17
|
+
Import the stylesheet once in your application entry point, then import the components you need:
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
```tsx
|
|
20
|
+
import 'elij-ui-library/styles.css';
|
|
21
|
+
import { Button, SectionHeading } from 'elij-ui-library';
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
export function Example() {
|
|
24
|
+
return (
|
|
25
|
+
<section>
|
|
26
|
+
<SectionHeading
|
|
27
|
+
eyebrow="Example"
|
|
28
|
+
title="Build a clear interface"
|
|
29
|
+
description="Typed components with consistent visual treatment."
|
|
30
|
+
/>
|
|
31
|
+
<Button variant="primary">Continue</Button>
|
|
32
|
+
</section>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
Import `elij-ui-library/styles.css` only once, from the application entry point. In Next.js App Router projects, import it from `app/layout.tsx`; in Vite projects, import it from `main.tsx`.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
the public component inventory. Every public component has a dedicated Storybook
|
|
40
|
-
story with controls or an interaction example where appropriate.
|
|
39
|
+
## Component examples
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
### Card and actions
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
```tsx
|
|
44
|
+
import { Button, Card, CardBody, SectionHeading } from 'elij-ui-library';
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
export function PricingCard() {
|
|
47
|
+
return (
|
|
48
|
+
<Card>
|
|
49
|
+
<CardBody>
|
|
50
|
+
<SectionHeading
|
|
51
|
+
eyebrow="Popular"
|
|
52
|
+
title="3 Hours"
|
|
53
|
+
description="A complete photo booth experience for larger celebrations."
|
|
54
|
+
/>
|
|
55
|
+
<Button variant="primary">Request details</Button>
|
|
56
|
+
</CardBody>
|
|
57
|
+
</Card>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
files or Storybook internals.
|
|
62
|
+
### Tabs and filters
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
```tsx
|
|
65
|
+
import { FilterTabs } from 'elij-ui-library';
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
const tabs = [
|
|
68
|
+
{ id: 'all', label: 'All' },
|
|
69
|
+
{ id: 'wedding', label: 'Wedding' },
|
|
70
|
+
{ id: 'birthday', label: 'Birthday' },
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export function CategoryFilters() {
|
|
74
|
+
return <FilterTabs items={tabs} value="all" onChange={(value) => console.log(value)} />;
|
|
75
|
+
}
|
|
62
76
|
```
|
|
63
77
|
|
|
64
|
-
|
|
78
|
+
### Event carousel
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { EventCarousel } from 'elij-ui-library';
|
|
65
82
|
|
|
66
|
-
|
|
83
|
+
const media = [
|
|
84
|
+
{ src: '/events/wedding-01.jpg', alt: 'Wedding celebration' },
|
|
85
|
+
{ src: '/events/setup-01.jpg', alt: 'On-site booth setup' },
|
|
86
|
+
{ src: '/events/prints-01.mp4', type: 'video', alt: 'Instant print demo' },
|
|
87
|
+
];
|
|
67
88
|
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
export function EventExample() {
|
|
90
|
+
return (
|
|
91
|
+
<EventCarousel
|
|
92
|
+
title="Real celebrations"
|
|
93
|
+
description="Photos from recent events."
|
|
94
|
+
media={media}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
70
98
|
```
|
|
71
99
|
|
|
72
|
-
|
|
100
|
+
`EventCarousel` supports image and video media. Each item should include a stable `src`; add `alt` text for accessible image descriptions.
|
|
101
|
+
|
|
102
|
+
### WhatsApp button
|
|
73
103
|
|
|
74
104
|
```tsx
|
|
75
|
-
import 'elij-ui-library
|
|
76
|
-
import { Button } from 'elij-ui-library';
|
|
105
|
+
import { WhatsAppButton } from 'elij-ui-library';
|
|
77
106
|
|
|
78
|
-
export function
|
|
79
|
-
return
|
|
107
|
+
export function ContactExample() {
|
|
108
|
+
return (
|
|
109
|
+
<WhatsAppButton href="https://wa.me/659xxxxxxx">
|
|
110
|
+
WhatsApp enquire
|
|
111
|
+
</WhatsAppButton>
|
|
112
|
+
);
|
|
80
113
|
}
|
|
81
114
|
```
|
|
82
115
|
|
|
83
|
-
|
|
116
|
+
Pass your own WhatsApp URL through `href`. The component opens external links in a new tab by default and supports `size`, `variant`, `icon`, `target`, and `rel` props.
|
|
84
117
|
|
|
85
|
-
|
|
86
|
-
npm install elij-ui-library
|
|
87
|
-
~~~
|
|
118
|
+
### Forms
|
|
88
119
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
~~~tsx
|
|
92
|
-
import 'elij-ui-library/styles.css';
|
|
93
|
-
import { Button, SectionHeading } from 'elij-ui-library';
|
|
120
|
+
```tsx
|
|
121
|
+
import { Button, Input, Select, Textarea } from 'elij-ui-library';
|
|
94
122
|
|
|
95
|
-
export function
|
|
123
|
+
export function EnquiryForm() {
|
|
96
124
|
return (
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
125
|
+
<form>
|
|
126
|
+
<Input label="Name" name="name" placeholder="Your name" required />
|
|
127
|
+
<Select
|
|
128
|
+
label="Event type"
|
|
129
|
+
name="eventType"
|
|
130
|
+
options={[
|
|
131
|
+
{ value: 'wedding', label: 'Wedding' },
|
|
132
|
+
{ value: 'birthday', label: 'Birthday' },
|
|
133
|
+
]}
|
|
134
|
+
/>
|
|
135
|
+
<Textarea label="Message" name="message" rows={4} />
|
|
136
|
+
<Button type="submit" variant="primary">Send enquiry</Button>
|
|
137
|
+
</form>
|
|
101
138
|
);
|
|
102
139
|
}
|
|
103
|
-
|
|
140
|
+
```
|
|
104
141
|
|
|
105
|
-
|
|
142
|
+
Form components expose native HTML attributes where appropriate. Validation and submission state remain owned by the consuming application.
|
|
106
143
|
|
|
107
|
-
|
|
108
|
-
import registry from 'elij-ui-library/registry';
|
|
109
|
-
~~~
|
|
144
|
+
### Charts
|
|
110
145
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
React components.
|
|
146
|
+
```tsx
|
|
147
|
+
import { BarChart, UIProvider } from 'elij-ui-library';
|
|
114
148
|
|
|
115
|
-
|
|
149
|
+
const data = [
|
|
150
|
+
{ month: 'Jan', bookings: 12 },
|
|
151
|
+
{ month: 'Feb', bookings: 18 },
|
|
152
|
+
];
|
|
116
153
|
|
|
117
|
-
|
|
154
|
+
export function BookingChart() {
|
|
155
|
+
return (
|
|
156
|
+
<UIProvider>
|
|
157
|
+
<BarChart
|
|
158
|
+
data={data}
|
|
159
|
+
xKey="month"
|
|
160
|
+
series={[{ dataKey: 'bookings', name: 'Bookings' }]}
|
|
161
|
+
ariaLabel="Monthly bookings"
|
|
162
|
+
/>
|
|
163
|
+
</UIProvider>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Cartesian charts accept `data`, `series`, and `xKey`. Pie and donut charts accept `data`, `nameKey`, and `valueKey`. Charts support loading and empty states, legends, tooltips, formatters, custom colors, and accessible labels.
|
|
169
|
+
|
|
170
|
+
## Themes and localization
|
|
171
|
+
|
|
172
|
+
Wrap your application, or one section of it, with `UIProvider`:
|
|
118
173
|
|
|
119
174
|
```tsx
|
|
120
175
|
import 'elij-ui-library/styles.css';
|
|
@@ -134,20 +189,99 @@ export function App() {
|
|
|
134
189
|
}
|
|
135
190
|
```
|
|
136
191
|
|
|
137
|
-
Built-in locales are `en` and `zh-CN`. Built-in themes are `light`, `dark`, and `ocean`.
|
|
138
|
-
|
|
139
|
-
Elij UI automatically translates built-in control text and accessible labels such as close, loading, pagination, menus, tabs, steps, and progress. Product-specific content—titles, field labels, table data, and messages—remains owned by the consuming application and should be passed through props. In Storybook, use the globe toolbar to switch both component semantics and demo content between English and Simplified Chinese.
|
|
192
|
+
Built-in locales are `en` and `zh-CN`. Built-in themes are `light`, `dark`, and `ocean`. Custom locale strings can be provided through `messages`, and custom themes can define CSS variables under a matching `[data-ui-theme="..."]` selector.
|
|
140
193
|
|
|
141
194
|
```tsx
|
|
142
|
-
<UIProvider
|
|
143
|
-
locale="en-SG"
|
|
144
|
-
messages={{ next: 'Carry on' }}
|
|
145
|
-
theme="my-theme"
|
|
146
|
-
>
|
|
195
|
+
<UIProvider locale="en-SG" messages={{ next: 'Carry on' }} theme="ocean">
|
|
147
196
|
<App />
|
|
148
197
|
</UIProvider>
|
|
149
198
|
```
|
|
150
199
|
|
|
151
|
-
|
|
200
|
+
Elij UI translates built-in control labels and accessibility text. Product-specific copy, field labels, table data, and event content should be supplied by the consuming application.
|
|
201
|
+
|
|
202
|
+
## Component catalogue
|
|
203
|
+
|
|
204
|
+
The package currently includes 54 public components:
|
|
205
|
+
|
|
206
|
+
- Actions: `Button`, `ActionLinkButton`, `WhatsAppButton`
|
|
207
|
+
- Data visualization: `LineChart`, `BarChart`, `AreaChart`, `PieChart`, `DonutChart`, `StackedBarChart`, `StackedBarLineChart`, `VerticalBarChart`, `HorizontalBarChart`, `GroupedBarChart`, `DualAxisChart`
|
|
208
|
+
- General: `Title`, `Text`, `Paragraph`, `Link`
|
|
209
|
+
- Forms: `Input`, `Textarea`, `Checkbox`, `RadioGroup`, `Switch`, `Select`
|
|
210
|
+
- Navigation: `Menu`, `Dropdown`, `Tabs`, `FilterTabs`, `Breadcrumb`, `Pagination`, `Steps`
|
|
211
|
+
- Feedback: `Alert`, `Spinner`, `Skeleton`, `Progress`, `Result`, `Empty`
|
|
212
|
+
- Data display: `Badge`, `Card`, `CardHeader`, `CardBody`, `CardFooter`, `Avatar`, `Tag`, `Tooltip`, `Table`
|
|
213
|
+
- Overlay: `Dialog`, `Drawer`
|
|
214
|
+
- Layout: `Divider`, `Space`, `Flex`, `Row`, `Col`, `Layout`, `Header`, `Sider`, `Content`, `Footer`
|
|
215
|
+
- Content: `SectionHeading`, `EventCarousel`
|
|
216
|
+
|
|
217
|
+
Every public component has TypeScript declarations and a Storybook story. The Storybook Registry/Catalog provides a searchable inventory with component descriptions, props, and story names.
|
|
218
|
+
|
|
219
|
+
## Registry metadata
|
|
220
|
+
|
|
221
|
+
The published registry is intended for CLI, MCP, documentation, and scaffolding tools. It is not required for normal React component rendering.
|
|
222
|
+
|
|
223
|
+
In Node.js, import the JSON registry with an import attribute:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
import registry from 'elij-ui-library/registry' with { type: 'json' };
|
|
227
|
+
|
|
228
|
+
console.log(registry.version);
|
|
229
|
+
console.log(registry.components.length);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
The registry schema is also available at `elij-ui-library/registry/schema`.
|
|
233
|
+
|
|
234
|
+
## Storybook
|
|
235
|
+
|
|
236
|
+
Run Storybook locally from this package:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
npm run dev
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Open `http://localhost:6006` to browse components, change controls, inspect accessibility, and view interaction examples. Build the static Storybook output with:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npm run build-storybook
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## TypeScript, accessibility, and browser support
|
|
249
|
+
|
|
250
|
+
The package exports component prop types from the main entry point. Interactive components use semantic HTML, keyboard interaction, focusable controls, and accessible labels where applicable. Always provide meaningful `alt` text and `ariaLabel` values for content whose meaning is not obvious from surrounding text.
|
|
251
|
+
|
|
252
|
+
## Local development and monorepo usage
|
|
253
|
+
|
|
254
|
+
From the monorepo root:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
corepack yarn workspace elij-ui-library dev
|
|
258
|
+
corepack yarn workspace elij-ui-library build
|
|
259
|
+
corepack yarn workspace elij-ui-library test
|
|
260
|
+
corepack yarn workspace elij-ui-library typecheck
|
|
261
|
+
corepack yarn workspace elij-ui-library lint
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
For active development across separate projects, use a workspace monorepo or a local package link. In the current monorepo, depend on the workspace package and run `corepack yarn install` from the root.
|
|
265
|
+
|
|
266
|
+
## Versioning and publishing
|
|
267
|
+
|
|
268
|
+
The registry version should stay synchronized with the package version. Before publishing:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
npm pack --dry-run
|
|
272
|
+
npm publish --access public
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Use the published package in another application with:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
npm install elij-ui-library
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Troubleshooting
|
|
152
282
|
|
|
153
|
-
|
|
283
|
+
- **Styles are missing:** import `elij-ui-library/styles.css` once from the application entry point.
|
|
284
|
+
- **A component is not found:** check the exported component names or search the Storybook Registry/Catalog.
|
|
285
|
+
- **Charts do not render:** ensure the chart is mounted in a browser environment and has a non-empty `data` array.
|
|
286
|
+
- **Theme changes do not apply:** use `UIProvider` or define CSS variables under the matching `data-ui-theme` selector.
|
|
287
|
+
- **Registry import fails in Node.js:** use `with { type: 'json' }` as shown in the Registry metadata section.
|
package/package.json
CHANGED