@electroplix/components 0.2.0 → 0.2.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 +59 -132
- package/cli.cjs +290 -61
- package/dist/README.md +14 -89
- package/dist/index.esm.js +21 -2
- package/dist/src/__tests__/test-utils.d.ts.map +1 -1
- package/dist/src/components/blog/index.d.ts.map +1 -1
- package/dist/src/components/buttons/index.d.ts.map +1 -1
- package/dist/src/components/content/BlockquoteTestimonial.d.ts.map +1 -1
- package/dist/src/components/content/CalloutBox.d.ts.map +1 -1
- package/dist/src/components/content/HeadingSection.d.ts.map +1 -1
- package/dist/src/components/content/InlineCodeText.d.ts.map +1 -1
- package/dist/src/components/content/ParagraphBlock.d.ts.map +1 -1
- package/dist/src/components/content/RichMarkdown.d.ts.map +1 -1
- package/dist/src/components/content/index.d.ts.map +1 -1
- package/dist/src/components/data-display/Badge.d.ts.map +1 -1
- package/dist/src/components/data-display/BadgeGroup.d.ts.map +1 -1
- package/dist/src/components/data-display/BarChart.d.ts.map +1 -1
- package/dist/src/components/data-display/CalendarGrid.d.ts.map +1 -1
- package/dist/src/components/data-display/DataTable.d.ts.map +1 -1
- package/dist/src/components/data-display/LineChart.d.ts.map +1 -1
- package/dist/src/components/data-display/PieChart.d.ts.map +1 -1
- package/dist/src/components/data-display/ProgressBar.d.ts.map +1 -1
- package/dist/src/components/data-display/RatingStars.d.ts.map +1 -1
- package/dist/src/components/data-display/Sparkline.d.ts.map +1 -1
- package/dist/src/components/data-display/Timeline.d.ts.map +1 -1
- package/dist/src/components/data-display/index.d.ts.map +1 -1
- package/dist/src/components/ecommerce/index.d.ts.map +1 -1
- package/dist/src/components/forms/AddressAutocomplete.d.ts.map +1 -1
- package/dist/src/components/forms/Captcha.d.ts.map +1 -1
- package/dist/src/components/forms/ContactForm.d.ts.map +1 -1
- package/dist/src/components/forms/DateTimePicker.d.ts.map +1 -1
- package/dist/src/components/forms/FileUploader.d.ts.map +1 -1
- package/dist/src/components/forms/FormShell.d.ts.map +1 -1
- package/dist/src/components/forms/InputField.d.ts.map +1 -1
- package/dist/src/components/forms/MultiStepWizard.d.ts.map +1 -1
- package/dist/src/components/forms/NewsletterSignup.d.ts.map +1 -1
- package/dist/src/components/forms/RadioGroup.d.ts.map +1 -1
- package/dist/src/components/forms/SelectDropdown.d.ts.map +1 -1
- package/dist/src/components/forms/TextAreaField.d.ts.map +1 -1
- package/dist/src/components/forms/ToggleSwitch.d.ts.map +1 -1
- package/dist/src/components/forms/ValidationWrapper.d.ts.map +1 -1
- package/dist/src/components/forms/index.d.ts.map +1 -1
- package/dist/src/components/hero/CTAOverlayHero.d.ts.map +1 -1
- package/dist/src/components/hero/CarouselHero.d.ts.map +1 -1
- package/dist/src/components/hero/HeroShell.d.ts.map +1 -1
- package/dist/src/components/hero/PatternedHero.d.ts.map +1 -1
- package/dist/src/components/hero/SplitHero.d.ts.map +1 -1
- package/dist/src/components/hero/StaticHero.d.ts.map +1 -1
- package/dist/src/components/hero/VideoHeaderHero.d.ts.map +1 -1
- package/dist/src/components/hero/index.d.ts.map +1 -1
- package/dist/src/components/lists-cards/index.d.ts.map +1 -1
- package/dist/src/components/marketing/index.d.ts.map +1 -1
- package/dist/src/components/media/index.d.ts.map +1 -1
- package/dist/src/components/miscellaneous/index.d.ts.map +1 -1
- package/dist/src/components/modals/index.d.ts.map +1 -1
- package/dist/src/components/navigation/AnchorLinks.d.ts.map +1 -1
- package/dist/src/components/navigation/Breadcrumbs.d.ts.map +1 -1
- package/dist/src/components/navigation/LanguageSelector.d.ts.map +1 -1
- package/dist/src/components/navigation/MegaMenu.d.ts.map +1 -1
- package/dist/src/components/navigation/Pagination.d.ts.map +1 -1
- package/dist/src/components/navigation/PrimaryNav.d.ts.map +1 -1
- package/dist/src/components/navigation/SideDrawerNav.d.ts.map +1 -1
- package/dist/src/components/navigation/SidebarMenu.d.ts.map +1 -1
- package/dist/src/components/navigation/Stepper.d.ts.map +1 -1
- package/dist/src/components/navigation/Tabs.d.ts.map +1 -1
- package/dist/src/components/navigation/index.d.ts.map +1 -1
- package/dist/src/components/onboarding/index.d.ts.map +1 -1
- package/dist/src/components/search/index.d.ts.map +1 -1
- package/dist/src/components/site-identity/index.d.ts.map +1 -1
- package/dist/src/components/social/index.d.ts.map +1 -1
- package/dist/src/components/user-accounts/index.d.ts.map +1 -1
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/icons.d.ts.map +1 -1
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/provider.d.ts.map +1 -1
- package/dist/src/core/types.d.ts +1 -1
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/utils.d.ts.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @electroplix/components
|
|
2
2
|
|
|
3
|
-
> Parametric, config-driven React UI components.
|
|
3
|
+
> Parametric, config-driven React UI components. **153 components** across **18 categories** — zero external CSS, zero icon dependencies, fully themeable via a single provider.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@electroplix/components)
|
|
6
6
|
|
|
@@ -36,27 +36,42 @@ yarn add @electroplix/components
|
|
|
36
36
|
|
|
37
37
|
## Quick Start
|
|
38
38
|
|
|
39
|
-
### 1.
|
|
39
|
+
### 1. Scaffold your project
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx @electroplix/components init
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This creates two files:
|
|
46
|
+
|
|
47
|
+
- **`electroplix.config.ts`** — your global theme configuration
|
|
48
|
+
- **`components/providers.tsx`** — a `"use client"` wrapper for the provider
|
|
49
|
+
|
|
50
|
+
### 2. Update your layout
|
|
51
|
+
|
|
52
|
+
Your root layout stays as a **Server Component** — import the client-side `Providers` wrapper:
|
|
40
53
|
|
|
41
54
|
```tsx
|
|
42
|
-
// app/layout.tsx (
|
|
43
|
-
import {
|
|
44
|
-
import config from "./electroplix.config";
|
|
55
|
+
// app/layout.tsx — Server Component (no "use client" needed here)
|
|
56
|
+
import { Providers } from "../components/providers";
|
|
45
57
|
|
|
46
58
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
47
59
|
return (
|
|
48
60
|
<html>
|
|
49
61
|
<body>
|
|
50
|
-
<
|
|
51
|
-
{children}
|
|
52
|
-
</ElectroplixProvider>
|
|
62
|
+
<Providers>{children}</Providers>
|
|
53
63
|
</body>
|
|
54
64
|
</html>
|
|
55
65
|
);
|
|
56
66
|
}
|
|
57
67
|
```
|
|
58
68
|
|
|
59
|
-
|
|
69
|
+
> **Why a separate `providers.tsx`?**
|
|
70
|
+
> `ElectroplixProvider` uses React Context (`createContext`), which only works in Client Components.
|
|
71
|
+
> By isolating it in a `"use client"` file, your layout stays a Server Component so metadata,
|
|
72
|
+
> static content, and other server-only features continue to work.
|
|
73
|
+
|
|
74
|
+
### 3. Use components in client pages
|
|
60
75
|
|
|
61
76
|
```tsx
|
|
62
77
|
"use client";
|
|
@@ -64,8 +79,6 @@ import {
|
|
|
64
79
|
PrimaryNav,
|
|
65
80
|
StaticHero,
|
|
66
81
|
PrimaryButton,
|
|
67
|
-
ContactForm,
|
|
68
|
-
BlogCard,
|
|
69
82
|
} from "@electroplix/components";
|
|
70
83
|
|
|
71
84
|
export default function HomePage() {
|
|
@@ -83,36 +96,34 @@ export default function HomePage() {
|
|
|
83
96
|
|
|
84
97
|
## Configuration
|
|
85
98
|
|
|
86
|
-
|
|
99
|
+
The `electroplix.config.ts` file uses the server-safe `./config` entry point (no React, no `"use client"`):
|
|
87
100
|
|
|
88
101
|
```ts
|
|
89
102
|
// electroplix.config.ts
|
|
90
103
|
import { defineConfig } from "@electroplix/components/config";
|
|
91
104
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
forms: {
|
|
109
|
-
inputBg: "rgba(255,255,255,0.05)",
|
|
110
|
-
radius: 8,
|
|
111
|
-
},
|
|
112
|
-
// ... configure any of the 18 categories
|
|
105
|
+
const config = defineConfig({
|
|
106
|
+
// ── Global overrides (applied to ALL categories) ──────────
|
|
107
|
+
accentColor: "#7C3AED",
|
|
108
|
+
textColor: "#E5E7EB",
|
|
109
|
+
bgColor: "#0b0b0c",
|
|
110
|
+
borderColor: "rgba(255,255,255,0.14)",
|
|
111
|
+
radius: 14,
|
|
112
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
113
|
+
|
|
114
|
+
// ── Per-category overrides ────────────────────────────────
|
|
115
|
+
navigation: { sticky: true, height: 64 },
|
|
116
|
+
hero: { minH: 600 },
|
|
117
|
+
buttons: { bgColor: "#e94560", radius: 12 },
|
|
118
|
+
forms: { inputBg: "rgba(255,255,255,0.05)" },
|
|
119
|
+
ecommerce: { accentColor: "#10B981" },
|
|
113
120
|
});
|
|
121
|
+
|
|
122
|
+
export default config;
|
|
114
123
|
```
|
|
115
124
|
|
|
125
|
+
**How merging works:** Global `BaseTheme` props (like `accentColor`, `bgColor`) are spread into every category as a baseline. Per-category overrides take priority. Built-in defaults fill any gaps.
|
|
126
|
+
|
|
116
127
|
### Available config keys
|
|
117
128
|
|
|
118
129
|
| Key | Theme Type | Category |
|
|
@@ -136,7 +147,7 @@ export default defineConfig({
|
|
|
136
147
|
| `social` | `SocialTheme` | Social sharing, login |
|
|
137
148
|
| `userAccounts` | `UserAccountsTheme` | Auth forms, profile |
|
|
138
149
|
|
|
139
|
-
|
|
150
|
+
**Global BaseTheme props** (set at root level): `bgColor`, `textColor`, `accentColor`, `borderColor`, `fontFamily`, `radius`, `spacing`, `headingSize`, `bodySize`, `fontWeight`, `lineHeight`, `letterSpacing`, `shadow`.
|
|
140
151
|
|
|
141
152
|
---
|
|
142
153
|
|
|
@@ -185,17 +196,6 @@ Every theme extends `BaseTheme` which provides: `bgColor`, `textColor`, `accentC
|
|
|
185
196
|
| `SplitHero` | `title`, `image`, `features`, `reverse` | Side-by-side hero |
|
|
186
197
|
| `VideoHeaderHero` | `videoSrc`, `poster`, `title` | Full-width video hero |
|
|
187
198
|
|
|
188
|
-
```tsx
|
|
189
|
-
<StaticHero
|
|
190
|
-
title="Build Incredible Products"
|
|
191
|
-
subtitle="Ship faster with pre-built components."
|
|
192
|
-
ctaLabel="Get Started Free"
|
|
193
|
-
onCta={() => router.push("/signup")}
|
|
194
|
-
titleSize={48}
|
|
195
|
-
align="center"
|
|
196
|
-
/>
|
|
197
|
-
```
|
|
198
|
-
|
|
199
199
|
### Buttons (10)
|
|
200
200
|
|
|
201
201
|
| Component | Key Props | Description |
|
|
@@ -211,25 +211,6 @@ Every theme extends `BaseTheme` which provides: `bgColor`, `textColor`, `accentC
|
|
|
211
211
|
| `DownloadButton` | `fileUrl`, `label` | File download button |
|
|
212
212
|
| `PrintButton` | `label` | Print page button |
|
|
213
213
|
|
|
214
|
-
```tsx
|
|
215
|
-
<PrimaryButton
|
|
216
|
-
label="Add to Cart"
|
|
217
|
-
icon="shopping-cart"
|
|
218
|
-
onClick={handleAddToCart}
|
|
219
|
-
bgColor="#7C3AED"
|
|
220
|
-
radius={12}
|
|
221
|
-
/>
|
|
222
|
-
|
|
223
|
-
<ButtonGroup
|
|
224
|
-
buttons={[
|
|
225
|
-
{ label: "Monthly", value: "monthly" },
|
|
226
|
-
{ label: "Yearly", value: "yearly" },
|
|
227
|
-
]}
|
|
228
|
-
toggle
|
|
229
|
-
onChange={(v) => setBilling(v)}
|
|
230
|
-
/>
|
|
231
|
-
```
|
|
232
|
-
|
|
233
214
|
### Forms (14)
|
|
234
215
|
|
|
235
216
|
| Component | Key Props | Description |
|
|
@@ -249,27 +230,6 @@ Every theme extends `BaseTheme` which provides: `bgColor`, `textColor`, `accentC
|
|
|
249
230
|
| `AddressAutocomplete` | `suggestions`, `onQuery`, `onSelect` | Address autocomplete |
|
|
250
231
|
| `ValidationWrapper` | `errors`, `children`, `success` | Error/success message wrapper |
|
|
251
232
|
|
|
252
|
-
```tsx
|
|
253
|
-
<InputField
|
|
254
|
-
label="Email"
|
|
255
|
-
name="email"
|
|
256
|
-
type="email"
|
|
257
|
-
value={email}
|
|
258
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
259
|
-
error={errors.email}
|
|
260
|
-
icon="mail"
|
|
261
|
-
/>
|
|
262
|
-
|
|
263
|
-
<MultiStepWizard
|
|
264
|
-
steps={[
|
|
265
|
-
{ label: "Personal", content: <PersonalStep /> },
|
|
266
|
-
{ label: "Payment", content: <PaymentStep /> },
|
|
267
|
-
{ label: "Confirm", content: <ConfirmStep /> },
|
|
268
|
-
]}
|
|
269
|
-
onFinish={handleSubmit}
|
|
270
|
-
/>
|
|
271
|
-
```
|
|
272
|
-
|
|
273
233
|
### Content (6)
|
|
274
234
|
|
|
275
235
|
| Component | Key Props | Description |
|
|
@@ -297,26 +257,6 @@ Every theme extends `BaseTheme` which provides: `bgColor`, `textColor`, `accentC
|
|
|
297
257
|
| `CalendarGrid` | `year`, `month`, `marks`, `onDateClick` | Month calendar grid |
|
|
298
258
|
| `Timeline` | `items` | Vertical timeline |
|
|
299
259
|
|
|
300
|
-
```tsx
|
|
301
|
-
<BarChart
|
|
302
|
-
data={[120, 280, 150, 350, 210]}
|
|
303
|
-
labels={["Mon", "Tue", "Wed", "Thu", "Fri"]}
|
|
304
|
-
title="Weekly Sales"
|
|
305
|
-
showGrid
|
|
306
|
-
/>
|
|
307
|
-
|
|
308
|
-
<DataTable
|
|
309
|
-
columns={[
|
|
310
|
-
{ key: "name", label: "Name" },
|
|
311
|
-
{ key: "email", label: "Email" },
|
|
312
|
-
{ key: "role", label: "Role" },
|
|
313
|
-
]}
|
|
314
|
-
rows={users}
|
|
315
|
-
pageSize={10}
|
|
316
|
-
searchable
|
|
317
|
-
/>
|
|
318
|
-
```
|
|
319
|
-
|
|
320
260
|
### Ecommerce (10)
|
|
321
261
|
|
|
322
262
|
| Component | Key Props | Description |
|
|
@@ -332,14 +272,6 @@ Every theme extends `BaseTheme` which provides: `bgColor`, `textColor`, `accentC
|
|
|
332
272
|
| `WishlistButton` | `productId`, `wishlisted`, `onToggle` | Heart wishlist toggle |
|
|
333
273
|
| `PaymentButtons` | `methods`, `onPay` | Payment method buttons |
|
|
334
274
|
|
|
335
|
-
```tsx
|
|
336
|
-
<ProductCard
|
|
337
|
-
product={{ id: "1", name: "T-Shirt", price: 29.99, image: "/tshirt.jpg" }}
|
|
338
|
-
currency="USD"
|
|
339
|
-
onAddToCart={(p) => addToCart(p)}
|
|
340
|
-
/>
|
|
341
|
-
```
|
|
342
|
-
|
|
343
275
|
### Lists & Cards (8)
|
|
344
276
|
|
|
345
277
|
| Component | Key Props | Description |
|
|
@@ -484,7 +416,7 @@ Every theme extends `BaseTheme` which provides: `bgColor`, `textColor`, `accentC
|
|
|
484
416
|
|
|
485
417
|
## Icon System
|
|
486
418
|
|
|
487
|
-
The package includes **113+ inline SVG icons** — zero external dependencies
|
|
419
|
+
The package includes **113+ inline SVG icons** — zero external dependencies:
|
|
488
420
|
|
|
489
421
|
```tsx
|
|
490
422
|
import { Icon, ICON_NAMES } from "@electroplix/components";
|
|
@@ -500,19 +432,22 @@ All available icon names: `activity`, `alert-circle`, `alert-triangle`, `align-l
|
|
|
500
432
|
|
|
501
433
|
## CLI
|
|
502
434
|
|
|
503
|
-
The package includes a CLI for scaffolding:
|
|
504
|
-
|
|
505
435
|
```bash
|
|
506
|
-
#
|
|
507
|
-
npx electroplix
|
|
436
|
+
# Scaffold config + providers
|
|
437
|
+
npx @electroplix/components init
|
|
438
|
+
|
|
439
|
+
# Show all components in a category
|
|
440
|
+
npx @electroplix/components add navigation
|
|
508
441
|
|
|
509
|
-
#
|
|
510
|
-
npx electroplix
|
|
442
|
+
# Show import instructions for a single component
|
|
443
|
+
npx @electroplix/components add PrimaryNav
|
|
511
444
|
|
|
512
|
-
#
|
|
513
|
-
npx electroplix
|
|
445
|
+
# Browse all 153 components with tree view
|
|
446
|
+
npx @electroplix/components list
|
|
514
447
|
```
|
|
515
448
|
|
|
449
|
+
The `add` command accepts both **component names** (`PrimaryNav`, `BlogCard`) and **category names** (`navigation`, `data-display`, `social`).
|
|
450
|
+
|
|
516
451
|
---
|
|
517
452
|
|
|
518
453
|
## Utilities
|
|
@@ -549,12 +484,10 @@ Exported utility functions and hooks:
|
|
|
549
484
|
</ElectroplixProvider>
|
|
550
485
|
```
|
|
551
486
|
|
|
552
|
-
- **`config`** — `Partial<ElectroplixConfig> | undefined` — optional theme overrides
|
|
487
|
+
- **`config`** — `Partial<ElectroplixConfig> | undefined` — optional theme overrides. Supports both root-level `BaseTheme` props (global) and per-category objects.
|
|
553
488
|
|
|
554
489
|
### Category hooks
|
|
555
490
|
|
|
556
|
-
Each component internally calls its category hook. You can also use them directly:
|
|
557
|
-
|
|
558
491
|
```tsx
|
|
559
492
|
import { useButtonTheme, useNavTheme } from "@electroplix/components";
|
|
560
493
|
|
|
@@ -566,7 +499,7 @@ function MyCustomButton() {
|
|
|
566
499
|
|
|
567
500
|
### `defineConfig(config)`
|
|
568
501
|
|
|
569
|
-
|
|
502
|
+
Server-safe type-checked config helper. Import from `@electroplix/components/config`.
|
|
570
503
|
|
|
571
504
|
### `mergeTheme(target, ...sources)`
|
|
572
505
|
|
|
@@ -581,9 +514,3 @@ pnpm nx test @electroplix/components
|
|
|
581
514
|
```
|
|
582
515
|
|
|
583
516
|
19 test suites, 163 tests covering all 18 categories.
|
|
584
|
-
|
|
585
|
-
---
|
|
586
|
-
|
|
587
|
-
## License
|
|
588
|
-
|
|
589
|
-
MIT
|