@undefine-ui/design-system 3.1.0 → 3.3.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 CHANGED
@@ -77,7 +77,7 @@ Storybook (`pnpm dev:storybook`) documents each component and token surface.
77
77
 
78
78
  ### Icon library
79
79
 
80
- The package includes a comprehensive icon library with 40+ SVG icons organized by category.
80
+ The package includes a comprehensive icon library with 45+ SVG icons organized by category.
81
81
 
82
82
  **Available icons:**
83
83
 
@@ -89,6 +89,7 @@ The package includes a comprehensive icon library with 40+ SVG icons organized b
89
89
  - **Visibility:** Eye, EyeClosed
90
90
  - **Date & Time:** Calendar, Clock
91
91
  - **Data:** SortUp, SortDown, StatUp, StatDown
92
+ - **Toast:** InfoToast, SuccessToast, WarningToast, ErrorToast
92
93
  - **System:** KeyCommand
93
94
 
94
95
  **Usage:**
@@ -232,6 +233,83 @@ import { Image } from '@undefine-ui/design-system';
232
233
  - Use `srcSet` with appropriate sizes for optimal image delivery
233
234
  - Set `observerMargin="400px"` to preload images slightly before viewport
234
235
 
236
+ ### Toast Notifications
237
+
238
+ Toast notifications powered by [Sonner](https://sonner.emilkowal.ski/) with Define styling. Supports success, error, warning, info variants with optional descriptions and action buttons.
239
+
240
+ **Setup:**
241
+
242
+ Add the `Toast` component once at the root of your application:
243
+
244
+ ```tsx
245
+ import {
246
+ SettingsProvider,
247
+ defaultSettings,
248
+ ThemeProvider,
249
+ Toast
250
+ } from '@undefine-ui/design-system';
251
+
252
+ export function App({ children }: { children: React.ReactNode }) {
253
+ return (
254
+ <SettingsProvider settings={defaultSettings}>
255
+ <ThemeProvider>
256
+ <Toast />
257
+ {children}
258
+ </ThemeProvider>
259
+ </SettingsProvider>
260
+ );
261
+ }
262
+ ```
263
+
264
+ **Usage:**
265
+
266
+ ```tsx
267
+ import { toast } from '@undefine-ui/design-system';
268
+
269
+ // Basic toast
270
+ toast('This is a basic toast');
271
+
272
+ // Variants
273
+ toast.success('Success Notification');
274
+ toast.error('Error Notification');
275
+ toast.warning('Warning Notification');
276
+ toast.info('Information Notification');
277
+ toast.loading('Loading...');
278
+
279
+ // With description
280
+ toast.success('Event created', {
281
+ description: 'Your event has been created successfully'
282
+ });
283
+
284
+ // With action buttons
285
+ toast('Are you sure?', {
286
+ description: 'This action cannot be undone',
287
+ cancel: {
288
+ label: 'Cancel',
289
+ onClick: () => console.log('Cancelled')
290
+ },
291
+ action: {
292
+ label: 'Confirm',
293
+ onClick: () => console.log('Confirmed')
294
+ }
295
+ });
296
+
297
+ // Promise-based (auto shows loading → success/error)
298
+ toast.promise(fetchData(), {
299
+ loading: 'Saving changes...',
300
+ success: 'Changes saved successfully',
301
+ error: 'Failed to save changes'
302
+ });
303
+ ```
304
+
305
+ **Features:**
306
+
307
+ - **Multiple variants:** Success, error, warning, info, loading states
308
+ - **Action buttons:** Cancel and action buttons with callbacks
309
+ - **Promise support:** Auto-transition from loading to success/error
310
+ - **Dark themed:** Consistent dark background with themed icons
311
+ - **Positioned:** Top-right with expandable queue
312
+
235
313
  ### Date Pickers (React Hook Form)
236
314
 
237
315
  Form-ready date picker components integrated with React Hook Form. Includes `RHFDatePicker`, `RHFTimePicker`, and `RHFDateTimePicker` for seamless form state management.
@@ -473,6 +551,57 @@ The animated logo automatically plays on mount with:
473
551
 
474
552
  Ideal for splash screens, loading overlays, or brand storytelling moments.
475
553
 
554
+ ### ApexCharts Styling
555
+
556
+ The design system provides styling utilities for ApexCharts integration, ensuring charts match the Define theme.
557
+
558
+ **Installation:**
559
+
560
+ ```bash
561
+ pnpm add apexcharts react-apexcharts
562
+ ```
563
+
564
+ **Usage:**
565
+
566
+ ```tsx
567
+ import ReactApexChart from 'react-apexcharts';
568
+ import { useTheme, styled } from '@mui/material/styles';
569
+ import { apexChartsStyles, getDefaultChartOptions } from '@undefine-ui/design-system';
570
+
571
+ // Create a styled wrapper
572
+ const ChartWrapper = styled('div')(({ theme }) => ({
573
+ ...apexChartsStyles(theme)
574
+ }));
575
+
576
+ function LineChart() {
577
+ const theme = useTheme();
578
+
579
+ const chartOptions = {
580
+ ...getDefaultChartOptions(theme),
581
+ xaxis: {
582
+ ...getDefaultChartOptions(theme).xaxis,
583
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
584
+ }
585
+ };
586
+
587
+ const chartSeries = [
588
+ { name: 'Bookings', data: [10, 41, 35, 51, 49, 62, 69] },
589
+ { name: 'Revenue', data: [20, 35, 50, 30, 45, 55, 40] }
590
+ ];
591
+
592
+ return (
593
+ <ChartWrapper>
594
+ <ReactApexChart type="line" series={chartSeries} options={chartOptions} height={350} />
595
+ </ChartWrapper>
596
+ );
597
+ }
598
+ ```
599
+
600
+ **Available exports:**
601
+
602
+ - `apexChartsStyles(theme)` - CSS styles to apply to a wrapper element (tooltips, legends, labels)
603
+ - `getDefaultChartOptions(theme)` - Default ApexCharts options with theme colors, typography, and grid styling
604
+
476
605
  ## Export surface
477
606
 
478
607
  Everything is re-exported from `src/index.ts`. Key groups: