@undefine-ui/design-system 3.10.2 → 3.12.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 +213 -13
- package/dist/index.cjs +1897 -887
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -14
- package/dist/index.d.ts +231 -14
- package/dist/index.js +1749 -739
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,19 +78,20 @@ Storybook (`pnpm dev:storybook`) documents each component and token surface.
|
|
|
78
78
|
|
|
79
79
|
### Icon library
|
|
80
80
|
|
|
81
|
-
The package includes a comprehensive icon library with
|
|
81
|
+
The package includes a comprehensive icon library with 60+ SVG icons organized by category.
|
|
82
82
|
|
|
83
83
|
**Available icons:**
|
|
84
84
|
|
|
85
85
|
- **Navigation:** NavArrowLeft, NavArrowRight, NavArrowDown, NavArrowDownSolid, LongArrowUpLeftSolid
|
|
86
86
|
- **User:** User, UserSolid, Building, Bank
|
|
87
87
|
- **Form Controls:** CheckboxDefault, CheckboxSelect, CheckboxIndeterminate, RadioDefault, RadioSelect
|
|
88
|
-
- **Actions:** Search, Copy, Trash, XMark, XMarkSolid, CloudUpload, Download, Settings, Plus, PlusSquare, Attachment, FilterList
|
|
89
|
-
- **Feedback:** InfoCircle, InfoCircleSolid, CheckCircleSolid, HelpCircle, ClipboardCheck, Loader, BellNotification, Circle
|
|
90
|
-
- **Visibility:** Eye, EyeClosed
|
|
88
|
+
- **Actions:** Search, Copy, Edit, Trash, XMark, XMarkSolid, CloudUpload, Download, Settings, Plus, Minus, PlusSquare, Attachment, FilterList, RefreshDouble, MoreHorizontal
|
|
89
|
+
- **Feedback:** InfoCircle, InfoCircleSolid, CheckCircleSolid, HelpCircle, ClipboardCheck, Loader, BellNotification, Circle, ChatBubbleQuestionSolid
|
|
90
|
+
- **Visibility:** Eye, EyeClosed, ZoomIn, ZoomOut
|
|
91
91
|
- **Date & Time:** Calendar, Clock
|
|
92
92
|
- **Data:** SortUp, SortDown, StatUp, StatDown
|
|
93
93
|
- **Toast:** InfoToast, SuccessToast, WarningToast, ErrorToast
|
|
94
|
+
- **Files:** FilePdf, FileAudio, FileVideo, FileDocument, FileGeneric
|
|
94
95
|
- **Location:** MapPinXMark
|
|
95
96
|
- **System:** KeyCommand
|
|
96
97
|
|
|
@@ -602,6 +603,7 @@ import {
|
|
|
602
603
|
ToolbarSettingsButton,
|
|
603
604
|
ToolbarTodayButton,
|
|
604
605
|
ToolbarDatePickerButton,
|
|
606
|
+
ToolbarSelectionButton,
|
|
605
607
|
FilterDropdown,
|
|
606
608
|
SortDropdown,
|
|
607
609
|
DateRangeDropdown,
|
|
@@ -613,6 +615,12 @@ import {
|
|
|
613
615
|
// Base toolbar button with icon and label
|
|
614
616
|
<ToolbarButton icon="Filter" label="Filter" onClick={handleClick} />
|
|
615
617
|
|
|
618
|
+
// Base toolbar button with custom children (icon and label are ignored when children provided)
|
|
619
|
+
<ToolbarButton>
|
|
620
|
+
<CustomIcon />
|
|
621
|
+
<span>Custom Content</span>
|
|
622
|
+
</ToolbarButton>
|
|
623
|
+
|
|
616
624
|
// Specialized button components
|
|
617
625
|
<ToolbarFilterButton onClick={handleFilter} />
|
|
618
626
|
<ToolbarSortButton onClick={handleSort} />
|
|
@@ -620,6 +628,11 @@ import {
|
|
|
620
628
|
<ToolbarTodayButton onClick={handleToday} />
|
|
621
629
|
<ToolbarDatePickerButton label="Last 30 days" onClick={handleDate} />
|
|
622
630
|
|
|
631
|
+
// Selection button - shows count with clear action
|
|
632
|
+
<ToolbarSelectionButton count={3} onClear={() => clearSelection()} />
|
|
633
|
+
<ToolbarSelectionButton count={5} label="items" onClear={handleClear} />
|
|
634
|
+
<ToolbarSelectionButton count={3} showClearButton={false} />
|
|
635
|
+
|
|
623
636
|
// Search field with clear button
|
|
624
637
|
<ToolbarSearchField
|
|
625
638
|
value={search}
|
|
@@ -676,12 +689,21 @@ const sortOptions: SortOption[] = [
|
|
|
676
689
|
|
|
677
690
|
**ToolbarButton Props:**
|
|
678
691
|
|
|
679
|
-
- `icon` - Icon name from the icon library
|
|
680
|
-
- `label` - Button label text
|
|
692
|
+
- `icon` - Icon name from the icon library (used when children is not provided)
|
|
693
|
+
- `label` - Button label text (used when children is not provided)
|
|
694
|
+
- `children` - Custom content to render. When provided, icon and label props are ignored
|
|
681
695
|
- `open` - Whether the button is in open/active state
|
|
682
696
|
- `disabled` - Disable the button
|
|
683
697
|
- All standard MUI ButtonBase props
|
|
684
698
|
|
|
699
|
+
**ToolbarSelectionButton Props:**
|
|
700
|
+
|
|
701
|
+
- `count` - Number of selected items (required)
|
|
702
|
+
- `label` - Text after the count (default: `'selected'`)
|
|
703
|
+
- `onClear` - Callback when the clear button is clicked
|
|
704
|
+
- `showClearButton` - Whether to show the clear button (default: `true`)
|
|
705
|
+
- All standard MUI ButtonBase props (except `icon`, `open`, `children`)
|
|
706
|
+
|
|
685
707
|
**FilterDropdown Props:**
|
|
686
708
|
|
|
687
709
|
- `children` - Content to render inside the popover (use Form + Field components)
|
|
@@ -1077,6 +1099,184 @@ import { CustomDialog, FeedbackDialog } from '@undefine-ui/design-system';
|
|
|
1077
1099
|
- **Customizable:** Style individual elements via feedbackSlotProps
|
|
1078
1100
|
- **Theme integration:** Uses theme variables for consistent styling
|
|
1079
1101
|
|
|
1102
|
+
### Lightbox
|
|
1103
|
+
|
|
1104
|
+
A full-featured image gallery lightbox component with zoom, pan, navigation, thumbnails, and keyboard support. Perfect for image galleries, product showcases, and media viewers.
|
|
1105
|
+
|
|
1106
|
+
**Usage:**
|
|
1107
|
+
|
|
1108
|
+
```tsx
|
|
1109
|
+
import { Lightbox, useLightbox, type LightboxSlide } from '@undefine-ui/design-system';
|
|
1110
|
+
|
|
1111
|
+
// Define your slides
|
|
1112
|
+
const slides: LightboxSlide[] = [
|
|
1113
|
+
{
|
|
1114
|
+
src: '/images/photo1.jpg',
|
|
1115
|
+
thumbnail: '/images/photo1-thumb.jpg',
|
|
1116
|
+
alt: 'Photo 1',
|
|
1117
|
+
title: 'Mountain Landscape',
|
|
1118
|
+
description: 'A beautiful mountain view at sunset'
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
src: '/images/photo2.jpg',
|
|
1122
|
+
thumbnail: '/images/photo2-thumb.jpg',
|
|
1123
|
+
alt: 'Photo 2'
|
|
1124
|
+
}
|
|
1125
|
+
];
|
|
1126
|
+
|
|
1127
|
+
// Using the useLightbox hook (recommended)
|
|
1128
|
+
const MyGallery = () => {
|
|
1129
|
+
const lightbox = useLightbox(slides);
|
|
1130
|
+
|
|
1131
|
+
return (
|
|
1132
|
+
<>
|
|
1133
|
+
<Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(3, 100px)', gap: 1 }}>
|
|
1134
|
+
{slides.map((slide, index) => (
|
|
1135
|
+
<Box
|
|
1136
|
+
key={index}
|
|
1137
|
+
component="img"
|
|
1138
|
+
src={slide.thumbnail}
|
|
1139
|
+
alt={slide.alt}
|
|
1140
|
+
onClick={() => lightbox.onOpen(index)}
|
|
1141
|
+
sx={{ cursor: 'pointer', width: 100, height: 75, objectFit: 'cover' }}
|
|
1142
|
+
/>
|
|
1143
|
+
))}
|
|
1144
|
+
</Box>
|
|
1145
|
+
<Lightbox
|
|
1146
|
+
open={lightbox.open}
|
|
1147
|
+
onClose={lightbox.onClose}
|
|
1148
|
+
slides={lightbox.slides}
|
|
1149
|
+
index={lightbox.selected}
|
|
1150
|
+
onIndexChange={lightbox.onSetSelected}
|
|
1151
|
+
/>
|
|
1152
|
+
</>
|
|
1153
|
+
);
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
// Controlled usage
|
|
1157
|
+
const [open, setOpen] = useState(false);
|
|
1158
|
+
const [index, setIndex] = useState(0);
|
|
1159
|
+
|
|
1160
|
+
<Lightbox
|
|
1161
|
+
open={open}
|
|
1162
|
+
onClose={() => setOpen(false)}
|
|
1163
|
+
slides={slides}
|
|
1164
|
+
index={index}
|
|
1165
|
+
onIndexChange={setIndex}
|
|
1166
|
+
/>
|
|
1167
|
+
|
|
1168
|
+
// Without thumbnails
|
|
1169
|
+
<Lightbox
|
|
1170
|
+
open={open}
|
|
1171
|
+
onClose={handleClose}
|
|
1172
|
+
slides={slides}
|
|
1173
|
+
showThumbnails={false}
|
|
1174
|
+
/>
|
|
1175
|
+
|
|
1176
|
+
// Without zoom functionality
|
|
1177
|
+
<Lightbox
|
|
1178
|
+
open={open}
|
|
1179
|
+
onClose={handleClose}
|
|
1180
|
+
slides={slides}
|
|
1181
|
+
enableZoom={false}
|
|
1182
|
+
/>
|
|
1183
|
+
|
|
1184
|
+
// Minimal UI (no thumbnails, no counter, no zoom)
|
|
1185
|
+
<Lightbox
|
|
1186
|
+
open={open}
|
|
1187
|
+
onClose={handleClose}
|
|
1188
|
+
slides={slides}
|
|
1189
|
+
showThumbnails={false}
|
|
1190
|
+
showCounter={false}
|
|
1191
|
+
enableZoom={false}
|
|
1192
|
+
/>
|
|
1193
|
+
|
|
1194
|
+
// Custom zoom levels
|
|
1195
|
+
<Lightbox
|
|
1196
|
+
open={open}
|
|
1197
|
+
onClose={handleClose}
|
|
1198
|
+
slides={slides}
|
|
1199
|
+
zoomLevels={[0.5, 1, 6]} // [min, default, max]
|
|
1200
|
+
/>
|
|
1201
|
+
|
|
1202
|
+
// Disable looping
|
|
1203
|
+
<Lightbox
|
|
1204
|
+
open={open}
|
|
1205
|
+
onClose={handleClose}
|
|
1206
|
+
slides={slides}
|
|
1207
|
+
loop={false}
|
|
1208
|
+
/>
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1211
|
+
**Lightbox Props:**
|
|
1212
|
+
|
|
1213
|
+
- `open` - Controls lightbox visibility (required)
|
|
1214
|
+
- `onClose` - Callback when lightbox is closed (required)
|
|
1215
|
+
- `slides` - Array of slide objects `LightboxSlide[]` (required)
|
|
1216
|
+
- `index` - Current slide index (default: `0`)
|
|
1217
|
+
- `onIndexChange` - Callback when index changes `(index: number) => void`
|
|
1218
|
+
- `showThumbnails` - Show thumbnail strip at bottom (default: `true`)
|
|
1219
|
+
- `showCounter` - Show slide counter in toolbar (default: `true`)
|
|
1220
|
+
- `enableZoom` - Enable zoom functionality (default: `true`)
|
|
1221
|
+
- `loop` - Enable infinite navigation (default: `true`)
|
|
1222
|
+
- `zoomLevels` - Zoom levels as `[min, default, max]` (default: `[1, 1, 4]`)
|
|
1223
|
+
|
|
1224
|
+
**LightboxSlide Interface:**
|
|
1225
|
+
|
|
1226
|
+
```typescript
|
|
1227
|
+
interface LightboxSlide {
|
|
1228
|
+
src: string; // Full-size image URL (required)
|
|
1229
|
+
thumbnail?: string; // Thumbnail URL (falls back to src)
|
|
1230
|
+
alt?: string; // Alt text for accessibility
|
|
1231
|
+
title?: string; // Title displayed below image
|
|
1232
|
+
description?: string; // Description displayed below title
|
|
1233
|
+
}
|
|
1234
|
+
```
|
|
1235
|
+
|
|
1236
|
+
**useLightbox Hook:**
|
|
1237
|
+
|
|
1238
|
+
The `useLightbox` hook provides a convenient way to manage lightbox state:
|
|
1239
|
+
|
|
1240
|
+
```typescript
|
|
1241
|
+
const lightbox = useLightbox(slides);
|
|
1242
|
+
|
|
1243
|
+
// Returns:
|
|
1244
|
+
{
|
|
1245
|
+
open: boolean; // Whether lightbox is open
|
|
1246
|
+
selected: number; // Current slide index
|
|
1247
|
+
slides: LightboxSlide[]; // Slides array
|
|
1248
|
+
onOpen: (index?: number) => void; // Open at specific index
|
|
1249
|
+
onClose: () => void; // Close lightbox
|
|
1250
|
+
onSetSelected: (index: number) => void; // Change slide
|
|
1251
|
+
setSlides: (slides: LightboxSlide[]) => void; // Update slides
|
|
1252
|
+
}
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
**Keyboard Navigation:**
|
|
1256
|
+
|
|
1257
|
+
- `←` / `→` - Navigate between slides
|
|
1258
|
+
- `Escape` - Close lightbox
|
|
1259
|
+
|
|
1260
|
+
**Mouse/Touch Controls:**
|
|
1261
|
+
|
|
1262
|
+
- **Scroll wheel** - Zoom in/out when zoom is enabled
|
|
1263
|
+
- **Double-click** - Toggle between default and max zoom
|
|
1264
|
+
- **Drag** - Pan around when zoomed in
|
|
1265
|
+
- **Click thumbnails** - Jump to specific slide
|
|
1266
|
+
- **Click arrows** - Navigate to previous/next slide
|
|
1267
|
+
|
|
1268
|
+
**Features:**
|
|
1269
|
+
|
|
1270
|
+
- **Zoom & Pan:** Mouse wheel zoom and drag-to-pan when zoomed
|
|
1271
|
+
- **Keyboard navigation:** Arrow keys and Escape support
|
|
1272
|
+
- **Thumbnail strip:** Quick navigation with visual thumbnails
|
|
1273
|
+
- **Slide counter:** Shows current position (e.g., "2 / 10")
|
|
1274
|
+
- **Captions:** Optional title and description per slide
|
|
1275
|
+
- **Loop navigation:** Seamlessly cycle through images
|
|
1276
|
+
- **Loading states:** Skeleton placeholders while images load
|
|
1277
|
+
- **Responsive:** Full-screen overlay with proper mobile handling
|
|
1278
|
+
- **Accessible:** Proper ARIA labels and keyboard support
|
|
1279
|
+
|
|
1080
1280
|
### Drawer
|
|
1081
1281
|
|
|
1082
1282
|
A drawer component with a fixed header containing a title and close button. The content area is scrollable while the header remains fixed. Built on top of MUI Drawer with enhanced styling and layout.
|
|
@@ -1332,13 +1532,13 @@ function LineChart() {
|
|
|
1332
1532
|
|
|
1333
1533
|
Everything is re-exported from `src/index.ts`. Key groups:
|
|
1334
1534
|
|
|
1335
|
-
| Group | Exports
|
|
1336
|
-
| ---------- |
|
|
1337
|
-
| Components | `CopyButton`, `CustomDialog`, `CustomDrawer`, `EmptyContent`, `FeedbackDialog`, `HookForm` helpers (`Form`, `Field`, `RHFSwitch`, etc.), `Icon`, `Image`, `Logo`, `LoadingScreen`, `OTPInput`, `Table`, `Upload` |
|
|
1338
|
-
| Hooks | `useBoolean`, `useCopyToClipboard`, `useEventListener`, `useLocalStorage`, `useResponsive`, `useSettings`, `useSetState`, `useScrollOffsetTop`, `usePopover`, `useCountdown`
|
|
1339
|
-
| Contexts | `SettingsProvider`, `SettingsContext`, `defaultSettings`, `SettingsValueProps`
|
|
1340
|
-
| Theme | `ThemeProvider`, `createTheme`, `colorSchemes`, `components`, `palette`, `radius`, `shadows`, `customSpacing`, utilities such as `varAlpha`, `bgGradient`, `hideScrollX/Y`
|
|
1341
|
-
| Utilities | `changeCase` helpers, `formatNumber`, `fullname-utils`, generic `helpers`
|
|
1535
|
+
| Group | Exports |
|
|
1536
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1537
|
+
| Components | `CopyButton`, `CustomDialog`, `CustomDrawer`, `EmptyContent`, `FeedbackDialog`, `HookForm` helpers (`Form`, `Field`, `RHFSwitch`, etc.), `Icon`, `Image`, `Lightbox`, `Logo`, `LoadingScreen`, `OTPInput`, `Table`, `Upload` |
|
|
1538
|
+
| Hooks | `useBoolean`, `useCopyToClipboard`, `useEventListener`, `useLightbox`, `useLocalStorage`, `useResponsive`, `useSettings`, `useSetState`, `useScrollOffsetTop`, `usePopover`, `useCountdown` |
|
|
1539
|
+
| Contexts | `SettingsProvider`, `SettingsContext`, `defaultSettings`, `SettingsValueProps` |
|
|
1540
|
+
| Theme | `ThemeProvider`, `createTheme`, `colorSchemes`, `components`, `palette`, `radius`, `shadows`, `customSpacing`, utilities such as `varAlpha`, `bgGradient`, `hideScrollX/Y` |
|
|
1541
|
+
| Utilities | `changeCase` helpers, `formatNumber`, `fullname-utils`, generic `helpers` |
|
|
1342
1542
|
|
|
1343
1543
|
You can also import the theme pieces directly to compose your own MUI theme or to extend tokens in Storybook.
|
|
1344
1544
|
|