@shohojdhara/atomix 0.6.1 → 0.6.3
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 +510 -106
- package/dist/atomix.css +30 -24
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +6 -6
- package/dist/atomix.min.css.map +1 -1
- package/dist/atomix.umd.js +1 -1
- package/dist/atomix.umd.js.map +1 -1
- package/dist/atomix.umd.min.js +1 -1
- package/dist/charts.d.ts +11 -2
- package/dist/charts.js +294 -139
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +14 -39
- package/dist/core.js +297 -145
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +11 -1
- package/dist/forms.js +385 -185
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +9 -0
- package/dist/heavy.js +297 -143
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +156 -164
- package/dist/index.esm.js +391 -203
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +391 -203
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +14 -6
- package/dist/theme.js +2 -9
- package/dist/theme.js.map +1 -1
- package/package.json +26 -26
- package/src/components/AtomixGlass/AtomixGlass.tsx +1 -1
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +8 -1
- package/src/components/AtomixGlass/deprecated/AtomixGlass.deprecated.tsx +390 -0
- package/src/components/AtomixGlass/glass-utils.ts +29 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +32 -1
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/Button.tsx +6 -5
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Dropdown/Dropdown.tsx +1 -0
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Form/Select.test.tsx +75 -0
- package/src/components/Form/Select.tsx +348 -252
- package/src/components/Form/SelectOption.tsx +16 -10
- package/src/components/index.ts +1 -1
- package/src/layouts/CssGrid/index.ts +1 -0
- package/src/lib/composables/shared-mouse-tracker.ts +62 -6
- package/src/lib/composables/useAtomixGlass.ts +241 -139
- package/src/lib/composables/useAtomixGlassStyles.ts +201 -149
- package/src/lib/constants/components.ts +54 -35
- package/src/lib/theme/config/configLoader.ts +1 -1
- package/src/lib/theme/test/testTheme.ts +2 -2
- package/src/lib/theme/utils/themeUtils.ts +98 -110
- package/src/lib/types/components.ts +29 -65
- package/src/styles/01-settings/_settings.spacing.scss +6 -1
- package/src/styles/03-generic/_generic.reset.scss +1 -1
- package/src/styles/06-components/_components.atomix-glass.scss +20 -29
- package/src/styles/06-components/_components.data-table.scss +5 -4
- package/src/styles/06-components/_components.dynamic-background.scss +9 -8
- package/src/styles/06-components/_components.footer.scss +8 -7
- package/src/styles/06-components/_components.hero.scss +2 -2
- package/src/styles/06-components/_components.messages.scss +16 -16
- package/src/styles/06-components/_components.navbar.scss +2 -0
- package/src/styles/06-components/_components.select.scss +15 -2
- package/src/styles/06-components/_components.upload.scss +3 -3
- package/CHANGELOG.md +0 -165
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +0 -215
package/README.md
CHANGED
|
@@ -1,176 +1,580 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<br />
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
<!-- Replace with your actual logo path if one exists -->
|
|
6
|
+
<h1>⚛ Atomix Design System</h1>
|
|
7
|
+
|
|
8
|
+
<p><strong>A premium, physics-aware React component library built for the modern web.</strong></p>
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/@shohojdhara/atomix)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://www.npmjs.com/package/@shohojdhara/atomix)
|
|
13
|
+
[](https://www.typescriptlang.org)
|
|
14
|
+
[](https://react.dev)
|
|
15
|
+
[](https://storybook.js.org)
|
|
16
|
+
[](https://nodejs.org)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
8
21
|
|
|
9
22
|
## Table of Contents
|
|
10
23
|
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
24
|
+
- [Overview](#overview)
|
|
25
|
+
- [Highlights](#highlights)
|
|
26
|
+
- [Component Catalog](#component-catalog)
|
|
13
27
|
- [Installation](#installation)
|
|
14
|
-
- [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- [React Integration](#react-integration)
|
|
18
|
-
- [Components](#components)
|
|
28
|
+
- [Quick Start](#quick-start)
|
|
29
|
+
- [Theming System](#theming-system)
|
|
30
|
+
- [AtomixGlass — Liquid Glass UI](#atomixglass--liquid-glass-ui)
|
|
19
31
|
- [Utility Classes](#utility-classes)
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
32
|
+
- [Tree-Shakable Exports](#tree-shakable-exports)
|
|
33
|
+
- [CLI Tooling](#cli-tooling)
|
|
34
|
+
- [Available Themes](#available-themes)
|
|
35
|
+
- [Build System](#build-system)
|
|
22
36
|
- [Contributing](#contributing)
|
|
23
37
|
- [License](#license)
|
|
24
38
|
|
|
25
|
-
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Overview
|
|
42
|
+
|
|
43
|
+
**Atomix** (`@shohojdhara/atomix`) is a modern, enterprise-grade design system and React component library. It ships a complete ITCSS-structured Sass layer, a physics-reactive glassmorphism engine (`AtomixGlass`), a comprehensive suite of 50+ typed React components, a configurable theming system backed by CSS custom properties, and a CLI toolchain for scaffolding and token management — all in one package.
|
|
44
|
+
|
|
45
|
+
> **Current version:** `v0.6.x` · **Status:** Active development
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Highlights
|
|
50
|
+
|
|
51
|
+
| Feature | Details |
|
|
52
|
+
|---|---|
|
|
53
|
+
| 🧊 **Liquid Glass UI** | Hardware-accelerated backdrop blur, SVG displacement maps, spring-physics elasticity, and velocity-driven border gradients via `AtomixGlass` |
|
|
54
|
+
| 🎨 **Token-Based Theming** | Deep CSS variable integration with `defineConfig()` — override colors, spacing, typography, radius, shadows, and z-index at build or runtime |
|
|
55
|
+
| ♿ **WCAG 2.1 AA** | Keyboard navigation, ARIA attributes, and screen-reader compliance baked into every component |
|
|
56
|
+
| 🏗️ **Polymorphic API** | Change the underlying HTML element of any component with the `as` prop; integrate with Next.js `<Link>`, React Router, and more via `LinkComponent` |
|
|
57
|
+
| ⚡ **Tree-Shakable** | Multiple sub-entry points (`/core`, `/forms`, `/layout`, `/charts`, `/heavy`) for minimal bundle footprint |
|
|
58
|
+
| 🛠 **CLI Toolchain** | `atomix generate`, `atomix tokens sync`, `atomix migrate`, `atomix doctor` and more — all driven by `atomix.config.ts` |
|
|
59
|
+
| 📊 **16 Chart Types** | First-class chart components (Line, Bar, Pie, Donut, Radar, Heatmap, Candlestick, Treemap…) |
|
|
60
|
+
| 🎭 **Storybook 8.x** | Full Storybook integration with a11y, interactions, measure, outline, and viewport addons |
|
|
61
|
+
| 🔄 **Changeset-Driven Releases** | Semantic versioning via `@changesets/cli` |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Component Catalog
|
|
66
|
+
|
|
67
|
+
### Layout & Structure
|
|
68
|
+
|
|
69
|
+
| Component | Description |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `Block` | Generic layout block primitive |
|
|
72
|
+
| `Hero` | Full-width hero section with flexible content slots |
|
|
73
|
+
| `River` | Alternating two-column content layout |
|
|
74
|
+
| `SectionIntro` | Section heading with optional sub-copy |
|
|
75
|
+
| `EdgePanel` | Slide-in side panel with built-in Glass UI support |
|
|
76
|
+
|
|
77
|
+
### Navigation
|
|
78
|
+
|
|
79
|
+
| Component | Description |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `Navbar` | Responsive top navigation bar |
|
|
82
|
+
| `Nav` / `NavItem` | Inline or stacked navigation list |
|
|
83
|
+
| `NavDropdown` | Hover/click dropdown attached to a `NavItem` |
|
|
84
|
+
| `SideMenu` / `SideMenuItem` / `SideMenuList` | Collapsible sidebar menu |
|
|
85
|
+
| `Menu` / `MenuItem` / `MenuDivider` | Context or action menus |
|
|
86
|
+
| `MegaMenu` / `MegaMenuColumn` / `MegaMenuLink` | Full-width mega-menu with column layout |
|
|
87
|
+
| `Breadcrumb` | Accessible breadcrumb trail |
|
|
88
|
+
| `Pagination` | Page-based navigation control |
|
|
89
|
+
| `Footer` / `FooterSection` / `FooterLink` / `FooterSocialLink` | Multi-layout footer |
|
|
90
|
+
|
|
91
|
+
### Forms & Inputs
|
|
92
|
+
|
|
93
|
+
| Component | Description |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `Button` / `ButtonGroup` | Primary action element with variants, sizes, and `glass` support |
|
|
96
|
+
| `Input` | Text input with label, hint, and validation states |
|
|
97
|
+
| `Textarea` | Multi-line text input |
|
|
98
|
+
| `Select` | Styled native `<select>` element |
|
|
99
|
+
| `Checkbox` | Accessible checkbox with indeterminate state |
|
|
100
|
+
| `Radio` | Radio button group |
|
|
101
|
+
| `Toggle` | Switch/toggle for boolean settings |
|
|
102
|
+
| `DatePicker` | Calendar-powered date selection |
|
|
103
|
+
| `Slider` | Range slider with min/max/step |
|
|
104
|
+
| `Upload` | Drag-and-drop or click-to-upload file input |
|
|
105
|
+
| `Form` / `FormGroup` | Form layout and field grouping wrappers |
|
|
106
|
+
|
|
107
|
+
### Data Display
|
|
108
|
+
|
|
109
|
+
| Component | Description |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `Card` / `ElevationCard` | Content surface with header, body, and footer slots |
|
|
112
|
+
| `DataTable` | Sortable, paginated data table |
|
|
113
|
+
| `List` / `ListGroup` | Ordered / unordered lists and grouped variants |
|
|
114
|
+
| `Badge` | Small status or count indicator |
|
|
115
|
+
| `Avatar` / `AvatarGroup` | User avatar with fallback initials and group stacking |
|
|
116
|
+
| `Rating` | Star rating display and input |
|
|
117
|
+
| `Progress` | Linear or circular progress indicator |
|
|
118
|
+
| `Steps` | Multi-step workflow tracker |
|
|
119
|
+
| `Countdown` | Time-remaining countdown display |
|
|
120
|
+
| `ProductReview` | Star rating with review metadata |
|
|
121
|
+
| `Testimonial` | Quote card for social proof |
|
|
122
|
+
|
|
123
|
+
### Feedback & Overlays
|
|
124
|
+
|
|
125
|
+
| Component | Description |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `Modal` | Accessible dialog with backdrop and focus trap |
|
|
128
|
+
| `Tooltip` | Floating label on hover/focus |
|
|
129
|
+
| `Popover` | Rich floating panel for contextual content |
|
|
130
|
+
| `Dropdown` | Trigger + floating menu composable |
|
|
131
|
+
| `Callout` | Inline contextual alerts (info, success, warning, danger) |
|
|
132
|
+
| `Spinner` | Loading indicator |
|
|
133
|
+
| `Messages` | Chat-style message thread component |
|
|
134
|
+
|
|
135
|
+
### Media & Rich Content
|
|
136
|
+
|
|
137
|
+
| Component | Description |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `VideoPlayer` | Custom HTML5 video player with controls |
|
|
140
|
+
| `PhotoViewer` | Lightbox-style image viewer with zoom and navigation |
|
|
141
|
+
| `Tabs` | Tab panel with animated active indicator |
|
|
142
|
+
| `Accordion` | Collapsible content sections |
|
|
143
|
+
|
|
144
|
+
### Charts (16 types)
|
|
145
|
+
|
|
146
|
+
Shipped via the `@shohojdhara/atomix/charts` entry point:
|
|
26
147
|
|
|
27
|
-
|
|
148
|
+
```
|
|
149
|
+
AreaChart · BarChart · BubbleChart · CandlestickChart · DonutChart
|
|
150
|
+
FunnelChart · GaugeChart · HeatmapChart · LineChart · MultiAxisChart
|
|
151
|
+
PieChart · RadarChart · ScatterChart · TreemapChart · WaterfallChart
|
|
152
|
+
Chart (base) · ChartRenderer
|
|
153
|
+
```
|
|
28
154
|
|
|
29
|
-
|
|
30
|
-
- **Premium Aesthetics & Glassmorphism:** Move past generic flat design with baked-in support for stunning, hardware-accelerated **Glass UI** (`glass={true}`) and highly refined micro-animations that deliver an instant "wow" factor out-of-the-box.
|
|
31
|
-
- **Enterprise SaaS & B2B Scalability:** Carefully crafted for data-dense environments. Atomix excels natively in complex CRMs, high-frequency B2B marketplaces, and sprawling admin dashboards without compromising on performance.
|
|
32
|
-
- **Polymorphic Architecture:** Extreme flexibility out of the box. Using the `as` prop, you can seamlessly adapt any component to native HTML or third-party Link components (e.g., Next.js `<Link>`, React Router) while maintaining perfect SEO and semantic structure.
|
|
155
|
+
### Primitives & Utilities
|
|
33
156
|
|
|
34
|
-
|
|
157
|
+
| Component | Description |
|
|
158
|
+
|---|---|
|
|
159
|
+
| `AtomixGlass` | Physics-reactive glassmorphism wrapper (see below) |
|
|
160
|
+
| `Icon` | Phosphor Icons integration wrapper |
|
|
161
|
+
| `ColorModeToggle` | Light/dark mode switcher |
|
|
162
|
+
| `AtomixLogo` | Brand logo component |
|
|
163
|
+
| `Todo` | Interactive to-do list micro-application |
|
|
35
164
|
|
|
36
|
-
|
|
37
|
-
- 🪄 **Micro-Interactions** - Silky smooth, highly refined CSS animations that feel native and responsive.
|
|
38
|
-
- 🎨 **Advanced Theming Engine** - Deep CSS variable integration supporting instant light/dark toggles and dynamic color generation.
|
|
39
|
-
- ♿ **A11y-First Development** - Built closely alongside strict WCAG guidelines guaranteeing keyboard navigation and rich ARIA compliance.
|
|
40
|
-
- 🏗️ **Polymorphic Components** - Total control over rendered DOM nodes via the polymorphic `as` prop.
|
|
41
|
-
- ⚡ **Fast & Lightweight** - Aggressively tree-shakable with an extremely minimal bundle footprint.
|
|
42
|
-
- 🛠 **Framework Agnostic Core** - Write once, use everywhere (React, Vue, Vanilla JS, and modern SSR architectures like Next.js and Remix).
|
|
165
|
+
---
|
|
43
166
|
|
|
44
167
|
## Installation
|
|
45
168
|
|
|
46
169
|
```bash
|
|
170
|
+
# npm
|
|
47
171
|
npm install @shohojdhara/atomix
|
|
48
|
-
|
|
172
|
+
|
|
173
|
+
# yarn
|
|
49
174
|
yarn add @shohojdhara/atomix
|
|
50
|
-
|
|
175
|
+
|
|
176
|
+
# pnpm
|
|
51
177
|
pnpm add @shohojdhara/atomix
|
|
52
178
|
```
|
|
53
179
|
|
|
54
|
-
|
|
180
|
+
**Peer dependencies** (install alongside if not already present):
|
|
55
181
|
|
|
56
|
-
|
|
182
|
+
```bash
|
|
183
|
+
npm install react react-dom @phosphor-icons/react@2.1.10
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Engine requirements:**
|
|
187
|
+
|
|
188
|
+
- Node.js `≥ 18.0.0`
|
|
189
|
+
- npm `≥ 8.0.0 <11.0.0` or `≥ 11.7.0`
|
|
57
190
|
|
|
58
|
-
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Quick Start
|
|
194
|
+
|
|
195
|
+
### 1. Import styles
|
|
59
196
|
|
|
60
197
|
```tsx
|
|
61
|
-
|
|
62
|
-
import '@shohojdhara/atomix/
|
|
198
|
+
// In your app entry point (e.g. main.tsx / _app.tsx)
|
|
199
|
+
import '@shohojdhara/atomix/css';
|
|
200
|
+
// or the minified build
|
|
201
|
+
import '@shohojdhara/atomix/css/min';
|
|
202
|
+
```
|
|
63
203
|
|
|
64
|
-
|
|
204
|
+
> If you use Sass, import the source directly for full variable access:
|
|
205
|
+
> ```scss
|
|
206
|
+
> @use '@shohojdhara/atomix/scss';
|
|
207
|
+
> ```
|
|
208
|
+
|
|
209
|
+
### 2. Use components
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { Button, Card, Badge } from '@shohojdhara/atomix';
|
|
213
|
+
|
|
214
|
+
export default function App() {
|
|
65
215
|
return (
|
|
66
|
-
<
|
|
67
|
-
variant="
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</Button>
|
|
216
|
+
<Card glass>
|
|
217
|
+
<Badge variant="success">New</Badge>
|
|
218
|
+
<p>Welcome to Atomix!</p>
|
|
219
|
+
<Button variant="primary" glass onClick={() => alert('Hello!')}>
|
|
220
|
+
Get Started
|
|
221
|
+
</Button>
|
|
222
|
+
</Card>
|
|
74
223
|
);
|
|
75
224
|
}
|
|
76
225
|
```
|
|
77
226
|
|
|
78
|
-
###
|
|
227
|
+
### 3. Polymorphic rendering with `as`
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
import { Button } from '@shohojdhara/atomix';
|
|
231
|
+
import Link from 'next/link';
|
|
79
232
|
|
|
80
|
-
|
|
233
|
+
// Renders as a Next.js <Link> while keeping full Button styling
|
|
234
|
+
<Button as="a" href="/dashboard" LinkComponent={Link} variant="secondary">
|
|
235
|
+
Go to Dashboard
|
|
236
|
+
</Button>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 4. Utility classes
|
|
81
240
|
|
|
82
241
|
```tsx
|
|
83
|
-
|
|
242
|
+
// Use u-* prefixed utilities for one-off overrides.
|
|
243
|
+
// Never write ad-hoc CSS — always prefer component props first.
|
|
244
|
+
<Button className="u-mt-4 u-w-100" variant="primary">
|
|
245
|
+
Full-width button
|
|
246
|
+
</Button>
|
|
247
|
+
```
|
|
84
248
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Theming System
|
|
252
|
+
|
|
253
|
+
Atomix uses a CSS custom property-based theme engine. Create an `atomix.config.ts` at the root of your project:
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
// atomix.config.ts
|
|
257
|
+
import { defineConfig } from '@shohojdhara/atomix/config';
|
|
258
|
+
|
|
259
|
+
export default defineConfig({
|
|
260
|
+
prefix: 'myapp', // Renames --atomix-* → --myapp-*
|
|
261
|
+
|
|
262
|
+
theme: {
|
|
263
|
+
extend: {
|
|
264
|
+
colors: {
|
|
265
|
+
primary: { main: '#7AFFD7' },
|
|
266
|
+
secondary: { main: '#FF5733' },
|
|
267
|
+
},
|
|
268
|
+
// spacing, typography, borderRadius, shadows, zIndex, transitions…
|
|
99
269
|
},
|
|
100
270
|
},
|
|
101
271
|
});
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Runtime theme injection
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import { createTheme, injectTheme } from '@shohojdhara/atomix/theme';
|
|
278
|
+
|
|
279
|
+
// Reads atomix.config.ts automatically
|
|
280
|
+
const css = createTheme();
|
|
281
|
+
injectTheme(css);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### ThemeProvider + useTheme
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
import { ThemeProvider, useTheme } from '@shohojdhara/atomix/theme';
|
|
102
288
|
|
|
103
289
|
function App() {
|
|
104
290
|
return (
|
|
105
|
-
<ThemeProvider
|
|
106
|
-
themes={{
|
|
107
|
-
|
|
291
|
+
<ThemeProvider
|
|
292
|
+
themes={{
|
|
293
|
+
light: { name: 'Light', class: 'default-light' },
|
|
294
|
+
dark: { name: 'Dark', class: 'dark-complementary' },
|
|
295
|
+
'high-contrast': { name: 'High Contrast', class: 'high-contrast' },
|
|
108
296
|
}}
|
|
109
|
-
defaultTheme="
|
|
297
|
+
defaultTheme="light"
|
|
110
298
|
>
|
|
111
299
|
<YourApp />
|
|
112
300
|
</ThemeProvider>
|
|
113
301
|
);
|
|
114
302
|
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### React Integration
|
|
118
|
-
|
|
119
|
-
We provide complete foundational context hooks ensuring your entire React app naturally cascades themes and configs:
|
|
120
|
-
|
|
121
|
-
```tsx
|
|
122
|
-
import { useTheme } from '@shohojdhara/atomix/theme';
|
|
123
303
|
|
|
124
304
|
function ThemeSwitcher() {
|
|
125
305
|
const { theme, setTheme, availableThemes } = useTheme();
|
|
126
|
-
|
|
127
306
|
return (
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
className="u-bg-dark u-text-primary u-border u-rounded-sm u-p-2"
|
|
134
|
-
>
|
|
135
|
-
{availableThemes.map(t => (
|
|
136
|
-
<option key={t.class} value={t.class}>
|
|
137
|
-
{t.name}
|
|
138
|
-
</option>
|
|
139
|
-
))}
|
|
140
|
-
</select>
|
|
141
|
-
</div>
|
|
307
|
+
<select value={theme} onChange={e => setTheme(e.target.value)}>
|
|
308
|
+
{availableThemes.map(t => (
|
|
309
|
+
<option key={t.class} value={t.class}>{t.name}</option>
|
|
310
|
+
))}
|
|
311
|
+
</select>
|
|
142
312
|
);
|
|
143
313
|
}
|
|
144
314
|
```
|
|
145
315
|
|
|
146
|
-
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## AtomixGlass — Liquid Glass UI
|
|
147
319
|
|
|
148
|
-
|
|
320
|
+
`AtomixGlass` is the flagship component of Atomix. It provides a physics-reactive, Apple-inspired glassmorphism surface with:
|
|
321
|
+
|
|
322
|
+
- **Backdrop blur** with adaptive saturation and brightness
|
|
323
|
+
- **SVG displacement filters** in four modes: `standard`, `polar`, `prominent`, and `shader`
|
|
324
|
+
- **Shader mode** — GLSL-based canvas displacement maps generated off-thread with LRU caching
|
|
325
|
+
- **Spring-physics elasticity** — cursor motion drives realistic stretch/deformation
|
|
326
|
+
- **Velocity-driven border gradients** — border intensity follows movement speed
|
|
327
|
+
- **Chromatic aberration** — subtle color fringing for a refractive lens effect
|
|
328
|
+
- **`overLight` mode** — inverted shadow layering for bright surface rendering
|
|
329
|
+
- **Time-based animation loop** — adaptive FPS targeting (12–60fps based on `distortionQuality`)
|
|
330
|
+
- **`prefers-reduced-motion`** awareness — fully respects accessibility preferences
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
import { AtomixGlass } from '@shohojdhara/atomix';
|
|
334
|
+
|
|
335
|
+
<AtomixGlass
|
|
336
|
+
glass // Enables the glass effect
|
|
337
|
+
mode="shader" // 'standard' | 'polar' | 'prominent' | 'shader'
|
|
338
|
+
shaderVariant="liquidGlass"
|
|
339
|
+
elasticity={0.6} // 0 = rigid, 1 = highly elastic
|
|
340
|
+
withLiquidBlur // Mouse-reactive blur intensity
|
|
341
|
+
withTimeAnimation // Continuous animated displacement
|
|
342
|
+
animationSpeed={1.2}
|
|
343
|
+
distortionQuality="high" // 'low' | 'medium' | 'high' | 'ultra'
|
|
344
|
+
overLight // Bright-surface shadow inversion
|
|
345
|
+
>
|
|
346
|
+
<p>Your content here</p>
|
|
347
|
+
</AtomixGlass>
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Any component that accepts a `glass` boolean prop (`Button`, `Card`, `EdgePanel`, `Callout`, etc.) internally wraps its content with `AtomixGlass`.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Utility Classes
|
|
355
|
+
|
|
356
|
+
All layout utilities use the `u-` prefix. **Never** invent utilities or use Bootstrap defaults.
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
Display: u-flex · u-grid · u-block · u-none · u-inline-block
|
|
360
|
+
Position: u-relative · u-absolute · u-fixed · u-sticky
|
|
361
|
+
Z-index: u-z-0 · u-z-1 · u-z-modal · u-z-tooltip
|
|
362
|
+
Spacing: u-m-{n} · u-mx-{n} · u-my-{n} · u-mt-{n} · u-mb-{n} · u-ms-{n} · u-me-{n}
|
|
363
|
+
u-p-{n} · u-px-{n} · u-py-{n} · u-pt-{n} · u-pb-{n} (0–90, auto)
|
|
364
|
+
Gap: u-gap-{n} · u-row-gap-{n} · u-column-gap-{n}
|
|
365
|
+
Flex: u-flex-row · u-flex-column · u-flex-wrap · u-flex-nowrap
|
|
366
|
+
Justify: u-justify-start · u-justify-center · u-justify-between
|
|
367
|
+
Align: u-items-start · u-items-center · u-self-start · u-self-center
|
|
368
|
+
Width: u-w-0 · u-w-25 · u-w-50 · u-w-100 · u-w-auto · u-max-w-100
|
|
369
|
+
Height: u-h-50 · u-h-100 · u-h-auto
|
|
370
|
+
Text: u-text-xs · u-text-sm · u-text-base · u-text-lg · u-fs-2xl
|
|
371
|
+
u-font-bold · u-text-center · u-text-start · u-text-end
|
|
372
|
+
Colors: u-text-primary · u-bg-primary · u-bg-dark · u-bg-primary-subtle
|
|
373
|
+
Borders: u-border · u-border-0 · u-border-solid · u-rounded · u-rounded-circle
|
|
374
|
+
Shadows: u-shadow-none · u-shadow-sm · u-shadow-lg
|
|
375
|
+
Opacity: u-opacity-0 · u-opacity-50 · u-opacity-100
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Responsive variants use the pattern `u-{category}-{breakpoint}-{value}`:
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
<div className="u-flex u-flex-column u-flex-md-row u-gap-4 u-w-100 u-w-lg-50">
|
|
382
|
+
…
|
|
383
|
+
</div>
|
|
384
|
+
```
|
|
149
385
|
|
|
150
|
-
|
|
151
|
-
- **Navigation**: Navbar, Breadcrumb, Pagination
|
|
152
|
-
- **Forms**: Input, Button, Select, Checkbox, Radio
|
|
153
|
-
- **Feedback**: Alert, Modal, Tooltip, Toast, Loader
|
|
154
|
-
- **Data Display**: Table, Card, Badge, Avatar, Masonry Grid
|
|
155
|
-
- **Surfaces**: Accordion, Tabs, Expansion Panel
|
|
386
|
+
Breakpoints: `sm` · `md` · `lg` · `xl` · `xxl` (mobile-first)
|
|
156
387
|
|
|
157
|
-
|
|
388
|
+
---
|
|
158
389
|
|
|
159
|
-
##
|
|
390
|
+
## Tree-Shakable Exports
|
|
160
391
|
|
|
161
|
-
|
|
392
|
+
Import only what you need to minimize bundle size:
|
|
162
393
|
|
|
163
|
-
|
|
394
|
+
```ts
|
|
395
|
+
// All components (largest)
|
|
396
|
+
import { Button, Card } from '@shohojdhara/atomix';
|
|
164
397
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
398
|
+
// Core UI primitives only
|
|
399
|
+
import { Button } from '@shohojdhara/atomix/core';
|
|
400
|
+
|
|
401
|
+
// Form components
|
|
402
|
+
import { Input, Select, Checkbox } from '@shohojdhara/atomix/forms';
|
|
403
|
+
|
|
404
|
+
// Layout components
|
|
405
|
+
import { Hero, River } from '@shohojdhara/atomix/layout';
|
|
406
|
+
|
|
407
|
+
// Charts (lazily loaded)
|
|
408
|
+
import { LineChart, BarChart } from '@shohojdhara/atomix/charts';
|
|
409
|
+
|
|
410
|
+
// Heavy components (VideoPlayer, PhotoViewer, etc.)
|
|
411
|
+
import { VideoPlayer } from '@shohojdhara/atomix/heavy';
|
|
412
|
+
|
|
413
|
+
// Theming utilities
|
|
414
|
+
import { createTheme, ThemeProvider } from '@shohojdhara/atomix/theme';
|
|
415
|
+
|
|
416
|
+
// Config helpers
|
|
417
|
+
import { defineConfig } from '@shohojdhara/atomix/config';
|
|
418
|
+
|
|
419
|
+
// Sass source (for Sass-based projects)
|
|
420
|
+
@use '@shohojdhara/atomix/scss';
|
|
421
|
+
@use '@shohojdhara/atomix/scss/settings';
|
|
422
|
+
@use '@shohojdhara/atomix/scss/components';
|
|
423
|
+
@use '@shohojdhara/atomix/scss/utilities';
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## CLI Tooling
|
|
429
|
+
|
|
430
|
+
Atomix ships a CLI (`atomix`) for scaffolding, token management, and diagnostics. It is driven by your `atomix.config.ts`.
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Scaffold a new component with all boilerplate
|
|
434
|
+
atomix generate component MyComponent
|
|
435
|
+
|
|
436
|
+
# Initialize Atomix in a new project
|
|
437
|
+
atomix init
|
|
438
|
+
|
|
439
|
+
# Sync design tokens from config → SCSS variables
|
|
440
|
+
atomix tokens sync
|
|
441
|
+
|
|
442
|
+
# Inspect and validate token definitions
|
|
443
|
+
atomix tokens inspect
|
|
444
|
+
|
|
445
|
+
# Build a theme variant
|
|
446
|
+
atomix build-theme dark-complementary
|
|
447
|
+
|
|
448
|
+
# Bridge tokens between Sass and JavaScript theme objects
|
|
449
|
+
atomix theme-bridge
|
|
450
|
+
|
|
451
|
+
# Run the environment diagnostics / health check
|
|
452
|
+
atomix doctor
|
|
453
|
+
|
|
454
|
+
# Check for breaking changes and run migration patches
|
|
455
|
+
atomix migrate
|
|
456
|
+
|
|
457
|
+
# Clean generated artifacts
|
|
458
|
+
atomix clean
|
|
459
|
+
|
|
460
|
+
# Validate atomix.config.ts against the source of truth
|
|
461
|
+
atomix validate
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
The CLI can be extended via the `plugins` array in `atomix.config.ts`:
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
export default defineConfig({
|
|
468
|
+
plugins: [
|
|
469
|
+
{ name: './scripts/cli/plugins/style-dictionary.js', options: { strictMode: true } }
|
|
470
|
+
],
|
|
471
|
+
});
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## Available Themes
|
|
477
|
+
|
|
478
|
+
Atomix ships four built-in themes in the `themes/` directory:
|
|
479
|
+
|
|
480
|
+
| Theme | Class | Description |
|
|
481
|
+
|---|---|---|
|
|
482
|
+
| `default-light` | `default-light` | Clean, bright default |
|
|
483
|
+
| `dark-complementary` | `dark-complementary` | Rich dark mode with complementary accents |
|
|
484
|
+
| `high-contrast` | `high-contrast` | Maximally accessible, high contrast |
|
|
485
|
+
| `test-theme` | `test-theme` | Internal testing theme |
|
|
486
|
+
|
|
487
|
+
Add your own by creating a folder under `themes/` or using `atomix build-theme`.
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Build System
|
|
492
|
+
|
|
493
|
+
| Script | Description |
|
|
494
|
+
|---|---|
|
|
495
|
+
| `npm run dev` | Start Storybook dev server at `localhost:6006` |
|
|
496
|
+
| `npm run build` | Full production build (JS + types + styles + UMD) |
|
|
497
|
+
| `npm run build:js` | JavaScript bundles only (Rollup) |
|
|
498
|
+
| `npm run build:types` | TypeScript declaration files only |
|
|
499
|
+
| `npm run build:styles` | CSS output only |
|
|
500
|
+
| `npm run build:umd` | UMD bundle for CDN usage |
|
|
501
|
+
| `npm run build:analyze` | Bundle size visualization |
|
|
502
|
+
| `npm run build:storybook` | Static Storybook build |
|
|
503
|
+
| `npm run test` | Vitest unit tests |
|
|
504
|
+
| `npm run test:cli` | CLI-specific unit tests |
|
|
505
|
+
| `npm run lint` | ESLint source |
|
|
506
|
+
| `npm run typecheck` | TypeScript type-checking (no emit) |
|
|
507
|
+
| `npm run sync:tokens` | Regenerate design tokens from config |
|
|
508
|
+
| `npm run verify:build` | Post-build output verification |
|
|
509
|
+
| `npm run attw` | Check package exports with `are-the-types-wrong` |
|
|
510
|
+
|
|
511
|
+
The build pipeline uses:
|
|
512
|
+
- **Rollup 3** for JS bundling with Babel + TypeScript
|
|
513
|
+
- **PostCSS** (autoprefixer, preset-env, flexbugs-fixes, cssnano) for CSS processing
|
|
514
|
+
- **Sass** for the ITCSS source layer
|
|
515
|
+
- **rollup-plugin-dts** for `.d.ts` bundling
|
|
516
|
+
- **Parallel builds** via `concurrently` for faster CI
|
|
517
|
+
|
|
518
|
+
---
|
|
169
519
|
|
|
170
520
|
## Contributing
|
|
171
521
|
|
|
172
|
-
We welcome
|
|
522
|
+
We welcome contributions of all kinds — new components, accessibility fixes, bug reports, documentation, and performance improvements.
|
|
523
|
+
|
|
524
|
+
### Local development setup
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
# 1. Fork and clone the repository
|
|
528
|
+
git clone https://github.com/Shohojdhara/atomix.git
|
|
529
|
+
cd atomix
|
|
530
|
+
|
|
531
|
+
# 2. Install dependencies
|
|
532
|
+
npm install
|
|
533
|
+
|
|
534
|
+
# 3. Start the Storybook dev server
|
|
535
|
+
npm run dev
|
|
536
|
+
|
|
537
|
+
# 4. Run tests
|
|
538
|
+
npm test
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Before submitting a PR
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
npm run lint # ESLint
|
|
545
|
+
npm run typecheck # TypeScript
|
|
546
|
+
npm run build # Full build passes
|
|
547
|
+
npm run verify:build # Build output looks correct
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### Commit convention
|
|
551
|
+
|
|
552
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
feat: add new Callout component
|
|
556
|
+
fix: resolve glass blur calculation on Safari
|
|
557
|
+
docs: update README installation section
|
|
558
|
+
chore: bump storybook to 8.6.15
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### Component architecture
|
|
562
|
+
|
|
563
|
+
Every component lives in `src/components/<ComponentName>/`:
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
src/components/MyComponent/
|
|
567
|
+
├── MyComponent.tsx # React component (forwardRef + memo)
|
|
568
|
+
├── MyComponent.stories.tsx # Storybook stories
|
|
569
|
+
└── index.ts # Re-exports
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
See the full guide in [CONTRIBUTING.md](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
573
|
+
|
|
574
|
+
---
|
|
173
575
|
|
|
174
576
|
## License
|
|
175
577
|
|
|
176
|
-
|
|
578
|
+
Licensed under the **[Apache License 2.0](LICENSE)**.
|
|
579
|
+
|
|
580
|
+
Copyright © [Shohojdhara](https://github.com/Shohojdhara) · [GitHub](https://github.com/Shohojdhara/atomix) · [npm](https://www.npmjs.com/package/@shohojdhara/atomix) · [Issues](https://github.com/Shohojdhara/atomix/issues) · [Sponsor](https://github.com/sponsors/Shohojdhara)
|