@atomazing-org/design-system 1.0.70 → 1.0.72
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 → README.MD} +277 -385
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +68 -68
package/{README.md → README.MD}
RENAMED
|
@@ -1,385 +1,277 @@
|
|
|
1
|
-
@atomazing-org/design-system
|
|
2
|
-
|
|
3
|
-
Modern MUI + Emotion design system with a ready theme factory, extended typography, global styles, component overrides, animations, and handy utilities.
|
|
4
|
-
|
|
5
|
-
Contents
|
|
6
|
-
- Introduction
|
|
7
|
-
- Installation
|
|
8
|
-
- Quick Start
|
|
9
|
-
- Provider Props
|
|
10
|
-
- Dynamic Themes (array)
|
|
11
|
-
- Theme Switching (UI)
|
|
12
|
-
- Dark Mode Control
|
|
13
|
-
- Extended Palette (4 variants)
|
|
14
|
-
- Palette Overrides
|
|
15
|
-
- Using Palette In SX
|
|
16
|
-
- Typography Variants
|
|
17
|
-
- Global Styles
|
|
18
|
-
- Animations
|
|
19
|
-
- Components
|
|
20
|
-
- Utilities
|
|
21
|
-
- SSR Notes
|
|
22
|
-
- Peer Dependencies
|
|
23
|
-
|
|
24
|
-
Introduction
|
|
25
|
-
The package streamlines consistent theming across apps: dark/light mode, typography variants, global styles, and component defaults. Built on MUI v7 + Emotion.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```tsx
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
<Box sx={{ bgcolor: (t) => t.palette.accent.main, color: (t) => t.palette.getContrastText(t.palette.accent.main) }}>
|
|
280
|
-
Accent surface
|
|
281
|
-
</Box>
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
Typography Variants
|
|
285
|
-
Extra variants are available (mapping to `<p>`/headers). Examples:
|
|
286
|
-
|
|
287
|
-
```tsx
|
|
288
|
-
import { Typography } from '@mui/material';
|
|
289
|
-
|
|
290
|
-
<Typography variant="text_md_regular">Body text</Typography>
|
|
291
|
-
<Typography variant="text_sm_bold">Strong caption</Typography>
|
|
292
|
-
<Typography variant="header_lg_bold">Section Title</Typography>
|
|
293
|
-
<Typography variant="header_md_semibold">Semibold Heading</Typography>
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
Global Styles
|
|
297
|
-
`ThemeProviderWrapper` injects global styles via Emotion. You can also set a custom font family:
|
|
298
|
-
|
|
299
|
-
```tsx
|
|
300
|
-
<ThemeProviderWrapper fontFamily="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif">
|
|
301
|
-
{/* ... */}
|
|
302
|
-
</ThemeProviderWrapper>
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
Animations
|
|
306
|
-
Keyframes ready for use in Emotion/MUI `sx`:
|
|
307
|
-
|
|
308
|
-
```tsx
|
|
309
|
-
import { keyframes } from '@emotion/react';
|
|
310
|
-
import { fadeIn, slideIn, scale, pulseAnimation, progressPulse } from '@atomazing-org/design-system';
|
|
311
|
-
import styled from '@emotion/styled';
|
|
312
|
-
|
|
313
|
-
const Card = styled.div`
|
|
314
|
-
animation: ${fadeIn} 300ms ease-in both;
|
|
315
|
-
`;
|
|
316
|
-
|
|
317
|
-
const Glowing = styled.div`
|
|
318
|
-
animation: ${progressPulse('#9FA9EA')} 2s ease-in-out infinite;
|
|
319
|
-
`;
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
Components
|
|
323
|
-
- ErrorBoundary
|
|
324
|
-
```tsx
|
|
325
|
-
import { ErrorBoundary } from '@atomazing-org/design-system';
|
|
326
|
-
|
|
327
|
-
<ErrorBoundary>
|
|
328
|
-
<App />
|
|
329
|
-
</ErrorBoundary>
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
- Loading
|
|
333
|
-
```tsx
|
|
334
|
-
import { Loading } from '@atomazing-org/design-system';
|
|
335
|
-
|
|
336
|
-
<Loading />
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
- PathName / DialogBtn
|
|
340
|
-
```tsx
|
|
341
|
-
import { PathName, DialogBtn } from '@atomazing-org/design-system';
|
|
342
|
-
|
|
343
|
-
<PathName>/settings/profile</PathName>
|
|
344
|
-
<DialogBtn variant="contained" color="brand">OK</DialogBtn>
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
Utilities
|
|
348
|
-
```tsx
|
|
349
|
-
import {
|
|
350
|
-
getFontColor, isFontLight, isHexColor,
|
|
351
|
-
timeAgo, timeAgoFromStart,
|
|
352
|
-
useResponsiveDisplay, useSystemTheme,
|
|
353
|
-
displayGreeting, getDayIdentifier,
|
|
354
|
-
systemInfo,
|
|
355
|
-
} from '@atomazing-org/design-system';
|
|
356
|
-
|
|
357
|
-
// Colors
|
|
358
|
-
getFontColor('#ffffff'); // '#101727' | '#f0f0f0'
|
|
359
|
-
isFontLight('#222');
|
|
360
|
-
isHexColor('#abc');
|
|
361
|
-
|
|
362
|
-
// Time
|
|
363
|
-
timeAgo(new Date(Date.now() - 3600_000));
|
|
364
|
-
timeAgoFromStart(new Date(Date.now() + 90_000));
|
|
365
|
-
|
|
366
|
-
// Device
|
|
367
|
-
const isMobile = useResponsiveDisplay(768);
|
|
368
|
-
const sysTheme = useSystemTheme(); // 'light' | 'dark' | 'unknown'
|
|
369
|
-
|
|
370
|
-
// Misc
|
|
371
|
-
displayGreeting(); // Good morning / afternoon / evening
|
|
372
|
-
getDayIdentifier(new Date()); // 'YYYY-MM-DD'
|
|
373
|
-
console.log(systemInfo.os, systemInfo.browser);
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
SSR Notes
|
|
377
|
-
- The library guards `localStorage`/`navigator`. Use normally in SSR apps; hydration updates settings on client.
|
|
378
|
-
- For Next.js, place the provider in a client boundary (e.g., `layout.tsx` with `"use client"`).
|
|
379
|
-
|
|
380
|
-
Peer Dependencies
|
|
381
|
-
- `@mui/material` ^7
|
|
382
|
-
- `@mui/icons-material` ^7
|
|
383
|
-
- `@emotion/react` ^11
|
|
384
|
-
- `@emotion/styled` ^11
|
|
385
|
-
- `@emotion/css` ^11 (optional)
|
|
1
|
+
@atomazing-org/design-system
|
|
2
|
+
|
|
3
|
+
Modern MUI + Emotion design system with a ready theme factory, extended typography, global styles, component overrides, animations, and handy utilities.
|
|
4
|
+
|
|
5
|
+
Contents
|
|
6
|
+
- Introduction
|
|
7
|
+
- Installation
|
|
8
|
+
- Quick Start
|
|
9
|
+
- Provider Props
|
|
10
|
+
- Dynamic Themes (array)
|
|
11
|
+
- Theme Switching (UI)
|
|
12
|
+
- Dark Mode Control
|
|
13
|
+
- Extended Palette (4 variants)
|
|
14
|
+
- Palette Overrides
|
|
15
|
+
- Using Palette In SX
|
|
16
|
+
- Typography Variants
|
|
17
|
+
- Global Styles
|
|
18
|
+
- Animations
|
|
19
|
+
- Components
|
|
20
|
+
- Utilities
|
|
21
|
+
- SSR Notes
|
|
22
|
+
- Peer Dependencies
|
|
23
|
+
|
|
24
|
+
Introduction
|
|
25
|
+
The package streamlines consistent theming across apps: dark/light mode, typography variants, global styles, and component defaults. Built on MUI v7 + Emotion.
|
|
26
|
+
|
|
27
|
+
Installation
|
|
28
|
+
```bash
|
|
29
|
+
npm install @atomazing-org/design-system
|
|
30
|
+
npm install @mui/material @mui/icons-material @emotion/react @emotion/styled @emotion/css
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Quick Start
|
|
34
|
+
```tsx
|
|
35
|
+
import { ThemeProviderWrapper } from '@atomazing-org/design-system';
|
|
36
|
+
|
|
37
|
+
export function App() {
|
|
38
|
+
return (
|
|
39
|
+
<ThemeProviderWrapper>
|
|
40
|
+
{/* your app */}
|
|
41
|
+
</ThemeProviderWrapper>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If `themes` is not provided, the provider falls back to a single "Default" theme using the current palette brand color.
|
|
47
|
+
|
|
48
|
+
Provider Props
|
|
49
|
+
- `themes?: { name: string; primaryColor: string; secondaryColor?: string }[]`
|
|
50
|
+
- `fontFamily?: string`
|
|
51
|
+
- `colorPaletteOverride?: Partial<ColorPaletteType>`
|
|
52
|
+
|
|
53
|
+
Dynamic Themes (array)
|
|
54
|
+
Provide a fully dynamic list of themes to the provider. This takes priority over static defaults.
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<ThemeProviderWrapper
|
|
58
|
+
themes={[
|
|
59
|
+
{ name: 'Blue', primaryColor: '#3B82F6' },
|
|
60
|
+
{
|
|
61
|
+
name: 'Aurora',
|
|
62
|
+
primaryColor: '#00E952',
|
|
63
|
+
secondaryColor: '#011926',
|
|
64
|
+
background: {
|
|
65
|
+
light: { default: '#F0FFF6', paper: '#FFFFFF' },
|
|
66
|
+
dark: { default: '#071B13', paper: '#0E2A1F' },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{ name: 'Gray', primaryColor: '#64748B' },
|
|
70
|
+
]}
|
|
71
|
+
>
|
|
72
|
+
{/* ... */}
|
|
73
|
+
</ThemeProviderWrapper>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Theme Switching (UI)
|
|
77
|
+
Use the theme context to read and change the active theme.
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { useThemeSettings } from '@atomazing-org/design-system';
|
|
81
|
+
import { ToggleButton, ToggleButtonGroup } from '@mui/material';
|
|
82
|
+
|
|
83
|
+
export function ThemeToggle() {
|
|
84
|
+
const { theme, setTheme } = useThemeSettings();
|
|
85
|
+
const options = ['Blue', 'Green', 'Gray'];
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<ToggleButtonGroup
|
|
89
|
+
size="small"
|
|
90
|
+
exclusive
|
|
91
|
+
color="brand"
|
|
92
|
+
value={theme}
|
|
93
|
+
onChange={(_, v) => v && setTheme(v)}
|
|
94
|
+
>
|
|
95
|
+
{options.map((o) => (
|
|
96
|
+
<ToggleButton key={o} value={o}>{o}</ToggleButton>
|
|
97
|
+
))}
|
|
98
|
+
</ToggleButtonGroup>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Dark Mode Control
|
|
104
|
+
Use `useThemeSettings()` to read and set dark mode. Modes: `light | dark | system | auto`.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { useThemeSettings, darkModeOptions } from '@atomazing-org/design-system';
|
|
108
|
+
import { RadioGroup, FormControlLabel, Radio } from '@mui/material';
|
|
109
|
+
|
|
110
|
+
export function DarkModeSelector() {
|
|
111
|
+
const { darkMode, setDarkMode } = useThemeSettings();
|
|
112
|
+
const options = darkModeOptions; // label + icon
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<RadioGroup
|
|
116
|
+
row
|
|
117
|
+
value={darkMode}
|
|
118
|
+
onChange={(e) => setDarkMode(e.target.value as any)}
|
|
119
|
+
>
|
|
120
|
+
{options.map((o) => (
|
|
121
|
+
<FormControlLabel key={o.value} value={o.value} control={<Radio />} label={o.label} />
|
|
122
|
+
))}
|
|
123
|
+
</RadioGroup>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Extended Palette (4 variants)
|
|
129
|
+
The design system adds four typed colors to the MUI palette, available on common components via the `color` prop:
|
|
130
|
+
|
|
131
|
+
- brand: project brand color (uses the active theme `primary`).
|
|
132
|
+
- neutral: neutral/gray scale color (from the design-system palette).
|
|
133
|
+
- accent: supporting accent color (from palette `accent`).
|
|
134
|
+
- muted: soft/desaturated color (based on neutral by default).
|
|
135
|
+
|
|
136
|
+
Supported components: `Button`, `Chip`, `Badge`, `Alert`.
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { Button, Chip, Alert } from '@mui/material';
|
|
140
|
+
|
|
141
|
+
<Button color="brand" variant="contained">Brand</Button>
|
|
142
|
+
<Button color="neutral" variant="outlined">Neutral</Button>
|
|
143
|
+
<Chip color="accent" label="Accent" />
|
|
144
|
+
<Alert color="muted" variant="filled">Muted Alert</Alert>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Palette Overrides
|
|
148
|
+
Override base palette tokens for the whole app.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<ThemeProviderWrapper
|
|
152
|
+
colorPaletteOverride={{
|
|
153
|
+
brand: '#4F46E5',
|
|
154
|
+
accent: '#F59E0B',
|
|
155
|
+
muted: '#94A3B8',
|
|
156
|
+
neutral: '#64748B',
|
|
157
|
+
success: '#16A34A',
|
|
158
|
+
warning: '#D97706',
|
|
159
|
+
error: '#DC2626',
|
|
160
|
+
info: '#0284C7',
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
{/* ... */}
|
|
164
|
+
</ThemeProviderWrapper>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Using Palette In SX
|
|
168
|
+
```tsx
|
|
169
|
+
import { Box } from '@mui/material';
|
|
170
|
+
|
|
171
|
+
<Box sx={{ bgcolor: (t) => t.palette.accent.main, color: (t) => t.palette.getContrastText(t.palette.accent.main) }}>
|
|
172
|
+
Accent surface
|
|
173
|
+
</Box>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Typography Variants
|
|
177
|
+
Extra variants are available (mapping to `<p>`/headers). Examples:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { Typography } from '@mui/material';
|
|
181
|
+
|
|
182
|
+
<Typography variant="text_md_regular">Body text</Typography>
|
|
183
|
+
<Typography variant="text_sm_bold">Strong caption</Typography>
|
|
184
|
+
<Typography variant="header_lg_bold">Section Title</Typography>
|
|
185
|
+
<Typography variant="header_md_semibold">Semibold Heading</Typography>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Global Styles
|
|
189
|
+
`ThemeProviderWrapper` injects global styles via Emotion. You can also set a custom font family:
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<ThemeProviderWrapper fontFamily="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif">
|
|
193
|
+
{/* ... */}
|
|
194
|
+
</ThemeProviderWrapper>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Animations
|
|
198
|
+
Keyframes ready for use in Emotion/MUI `sx`:
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { keyframes } from '@emotion/react';
|
|
202
|
+
import { fadeIn, slideIn, scale, pulseAnimation, progressPulse } from '@atomazing-org/design-system';
|
|
203
|
+
import styled from '@emotion/styled';
|
|
204
|
+
|
|
205
|
+
const Card = styled.div`
|
|
206
|
+
animation: ${fadeIn} 300ms ease-in both;
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
const Glowing = styled.div`
|
|
210
|
+
animation: ${progressPulse('#9FA9EA')} 2s ease-in-out infinite;
|
|
211
|
+
`;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Components
|
|
215
|
+
- ErrorBoundary
|
|
216
|
+
```tsx
|
|
217
|
+
import { ErrorBoundary } from '@atomazing-org/design-system';
|
|
218
|
+
|
|
219
|
+
<ErrorBoundary>
|
|
220
|
+
<App />
|
|
221
|
+
</ErrorBoundary>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- Loading
|
|
225
|
+
```tsx
|
|
226
|
+
import { Loading } from '@atomazing-org/design-system';
|
|
227
|
+
|
|
228
|
+
<Loading />
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
- PathName / DialogBtn
|
|
232
|
+
```tsx
|
|
233
|
+
import { PathName, DialogBtn } from '@atomazing-org/design-system';
|
|
234
|
+
|
|
235
|
+
<PathName>/settings/profile</PathName>
|
|
236
|
+
<DialogBtn variant="contained" color="brand">OK</DialogBtn>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Utilities
|
|
240
|
+
```tsx
|
|
241
|
+
import {
|
|
242
|
+
getFontColor, isFontLight, isHexColor,
|
|
243
|
+
timeAgo, timeAgoFromStart,
|
|
244
|
+
useResponsiveDisplay, useSystemTheme,
|
|
245
|
+
displayGreeting, getDayIdentifier,
|
|
246
|
+
systemInfo,
|
|
247
|
+
} from '@atomazing-org/design-system';
|
|
248
|
+
|
|
249
|
+
// Colors
|
|
250
|
+
getFontColor('#ffffff'); // '#101727' | '#f0f0f0'
|
|
251
|
+
isFontLight('#222');
|
|
252
|
+
isHexColor('#abc');
|
|
253
|
+
|
|
254
|
+
// Time
|
|
255
|
+
timeAgo(new Date(Date.now() - 3600_000));
|
|
256
|
+
timeAgoFromStart(new Date(Date.now() + 90_000));
|
|
257
|
+
|
|
258
|
+
// Device
|
|
259
|
+
const isMobile = useResponsiveDisplay(768);
|
|
260
|
+
const sysTheme = useSystemTheme(); // 'light' | 'dark' | 'unknown'
|
|
261
|
+
|
|
262
|
+
// Misc
|
|
263
|
+
displayGreeting(); // Good morning / afternoon / evening
|
|
264
|
+
getDayIdentifier(new Date()); // 'YYYY-MM-DD'
|
|
265
|
+
console.log(systemInfo.os, systemInfo.browser);
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
SSR Notes
|
|
269
|
+
- The library guards `localStorage`/`navigator`. Use normally in SSR apps; hydration updates settings on client.
|
|
270
|
+
- For Next.js, place the provider in a client boundary (e.g., `layout.tsx` with `"use client"`).
|
|
271
|
+
|
|
272
|
+
Peer Dependencies
|
|
273
|
+
- `@mui/material` ^7
|
|
274
|
+
- `@mui/icons-material` ^7
|
|
275
|
+
- `@emotion/react` ^11
|
|
276
|
+
- `@emotion/styled` ^11
|
|
277
|
+
- `@emotion/css` ^11 (optional)
|