@undefine-ui/design-system 3.1.0 → 3.2.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 +79 -1
- package/dist/index.cjs +935 -389
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1105 -383
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
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
|
|
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.
|