@undefine-ui/design-system 3.10.2 → 3.11.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
@@ -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 45+ SVG icons organized by category.
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
 
@@ -1077,6 +1078,184 @@ import { CustomDialog, FeedbackDialog } from '@undefine-ui/design-system';
1077
1078
  - **Customizable:** Style individual elements via feedbackSlotProps
1078
1079
  - **Theme integration:** Uses theme variables for consistent styling
1079
1080
 
1081
+ ### Lightbox
1082
+
1083
+ A full-featured image gallery lightbox component with zoom, pan, navigation, thumbnails, and keyboard support. Perfect for image galleries, product showcases, and media viewers.
1084
+
1085
+ **Usage:**
1086
+
1087
+ ```tsx
1088
+ import { Lightbox, useLightbox, type LightboxSlide } from '@undefine-ui/design-system';
1089
+
1090
+ // Define your slides
1091
+ const slides: LightboxSlide[] = [
1092
+ {
1093
+ src: '/images/photo1.jpg',
1094
+ thumbnail: '/images/photo1-thumb.jpg',
1095
+ alt: 'Photo 1',
1096
+ title: 'Mountain Landscape',
1097
+ description: 'A beautiful mountain view at sunset'
1098
+ },
1099
+ {
1100
+ src: '/images/photo2.jpg',
1101
+ thumbnail: '/images/photo2-thumb.jpg',
1102
+ alt: 'Photo 2'
1103
+ }
1104
+ ];
1105
+
1106
+ // Using the useLightbox hook (recommended)
1107
+ const MyGallery = () => {
1108
+ const lightbox = useLightbox(slides);
1109
+
1110
+ return (
1111
+ <>
1112
+ <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(3, 100px)', gap: 1 }}>
1113
+ {slides.map((slide, index) => (
1114
+ <Box
1115
+ key={index}
1116
+ component="img"
1117
+ src={slide.thumbnail}
1118
+ alt={slide.alt}
1119
+ onClick={() => lightbox.onOpen(index)}
1120
+ sx={{ cursor: 'pointer', width: 100, height: 75, objectFit: 'cover' }}
1121
+ />
1122
+ ))}
1123
+ </Box>
1124
+ <Lightbox
1125
+ open={lightbox.open}
1126
+ onClose={lightbox.onClose}
1127
+ slides={lightbox.slides}
1128
+ index={lightbox.selected}
1129
+ onIndexChange={lightbox.onSetSelected}
1130
+ />
1131
+ </>
1132
+ );
1133
+ };
1134
+
1135
+ // Controlled usage
1136
+ const [open, setOpen] = useState(false);
1137
+ const [index, setIndex] = useState(0);
1138
+
1139
+ <Lightbox
1140
+ open={open}
1141
+ onClose={() => setOpen(false)}
1142
+ slides={slides}
1143
+ index={index}
1144
+ onIndexChange={setIndex}
1145
+ />
1146
+
1147
+ // Without thumbnails
1148
+ <Lightbox
1149
+ open={open}
1150
+ onClose={handleClose}
1151
+ slides={slides}
1152
+ showThumbnails={false}
1153
+ />
1154
+
1155
+ // Without zoom functionality
1156
+ <Lightbox
1157
+ open={open}
1158
+ onClose={handleClose}
1159
+ slides={slides}
1160
+ enableZoom={false}
1161
+ />
1162
+
1163
+ // Minimal UI (no thumbnails, no counter, no zoom)
1164
+ <Lightbox
1165
+ open={open}
1166
+ onClose={handleClose}
1167
+ slides={slides}
1168
+ showThumbnails={false}
1169
+ showCounter={false}
1170
+ enableZoom={false}
1171
+ />
1172
+
1173
+ // Custom zoom levels
1174
+ <Lightbox
1175
+ open={open}
1176
+ onClose={handleClose}
1177
+ slides={slides}
1178
+ zoomLevels={[0.5, 1, 6]} // [min, default, max]
1179
+ />
1180
+
1181
+ // Disable looping
1182
+ <Lightbox
1183
+ open={open}
1184
+ onClose={handleClose}
1185
+ slides={slides}
1186
+ loop={false}
1187
+ />
1188
+ ```
1189
+
1190
+ **Lightbox Props:**
1191
+
1192
+ - `open` - Controls lightbox visibility (required)
1193
+ - `onClose` - Callback when lightbox is closed (required)
1194
+ - `slides` - Array of slide objects `LightboxSlide[]` (required)
1195
+ - `index` - Current slide index (default: `0`)
1196
+ - `onIndexChange` - Callback when index changes `(index: number) => void`
1197
+ - `showThumbnails` - Show thumbnail strip at bottom (default: `true`)
1198
+ - `showCounter` - Show slide counter in toolbar (default: `true`)
1199
+ - `enableZoom` - Enable zoom functionality (default: `true`)
1200
+ - `loop` - Enable infinite navigation (default: `true`)
1201
+ - `zoomLevels` - Zoom levels as `[min, default, max]` (default: `[1, 1, 4]`)
1202
+
1203
+ **LightboxSlide Interface:**
1204
+
1205
+ ```typescript
1206
+ interface LightboxSlide {
1207
+ src: string; // Full-size image URL (required)
1208
+ thumbnail?: string; // Thumbnail URL (falls back to src)
1209
+ alt?: string; // Alt text for accessibility
1210
+ title?: string; // Title displayed below image
1211
+ description?: string; // Description displayed below title
1212
+ }
1213
+ ```
1214
+
1215
+ **useLightbox Hook:**
1216
+
1217
+ The `useLightbox` hook provides a convenient way to manage lightbox state:
1218
+
1219
+ ```typescript
1220
+ const lightbox = useLightbox(slides);
1221
+
1222
+ // Returns:
1223
+ {
1224
+ open: boolean; // Whether lightbox is open
1225
+ selected: number; // Current slide index
1226
+ slides: LightboxSlide[]; // Slides array
1227
+ onOpen: (index?: number) => void; // Open at specific index
1228
+ onClose: () => void; // Close lightbox
1229
+ onSetSelected: (index: number) => void; // Change slide
1230
+ setSlides: (slides: LightboxSlide[]) => void; // Update slides
1231
+ }
1232
+ ```
1233
+
1234
+ **Keyboard Navigation:**
1235
+
1236
+ - `←` / `→` - Navigate between slides
1237
+ - `Escape` - Close lightbox
1238
+
1239
+ **Mouse/Touch Controls:**
1240
+
1241
+ - **Scroll wheel** - Zoom in/out when zoom is enabled
1242
+ - **Double-click** - Toggle between default and max zoom
1243
+ - **Drag** - Pan around when zoomed in
1244
+ - **Click thumbnails** - Jump to specific slide
1245
+ - **Click arrows** - Navigate to previous/next slide
1246
+
1247
+ **Features:**
1248
+
1249
+ - **Zoom & Pan:** Mouse wheel zoom and drag-to-pan when zoomed
1250
+ - **Keyboard navigation:** Arrow keys and Escape support
1251
+ - **Thumbnail strip:** Quick navigation with visual thumbnails
1252
+ - **Slide counter:** Shows current position (e.g., "2 / 10")
1253
+ - **Captions:** Optional title and description per slide
1254
+ - **Loop navigation:** Seamlessly cycle through images
1255
+ - **Loading states:** Skeleton placeholders while images load
1256
+ - **Responsive:** Full-screen overlay with proper mobile handling
1257
+ - **Accessible:** Proper ARIA labels and keyboard support
1258
+
1080
1259
  ### Drawer
1081
1260
 
1082
1261
  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 +1511,13 @@ function LineChart() {
1332
1511
 
1333
1512
  Everything is re-exported from `src/index.ts`. Key groups:
1334
1513
 
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` |
1514
+ | Group | Exports |
1515
+ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1516
+ | Components | `CopyButton`, `CustomDialog`, `CustomDrawer`, `EmptyContent`, `FeedbackDialog`, `HookForm` helpers (`Form`, `Field`, `RHFSwitch`, etc.), `Icon`, `Image`, `Lightbox`, `Logo`, `LoadingScreen`, `OTPInput`, `Table`, `Upload` |
1517
+ | Hooks | `useBoolean`, `useCopyToClipboard`, `useEventListener`, `useLightbox`, `useLocalStorage`, `useResponsive`, `useSettings`, `useSetState`, `useScrollOffsetTop`, `usePopover`, `useCountdown` |
1518
+ | Contexts | `SettingsProvider`, `SettingsContext`, `defaultSettings`, `SettingsValueProps` |
1519
+ | Theme | `ThemeProvider`, `createTheme`, `colorSchemes`, `components`, `palette`, `radius`, `shadows`, `customSpacing`, utilities such as `varAlpha`, `bgGradient`, `hideScrollX/Y` |
1520
+ | Utilities | `changeCase` helpers, `formatNumber`, `fullname-utils`, generic `helpers` |
1342
1521
 
1343
1522
  You can also import the theme pieces directly to compose your own MUI theme or to extend tokens in Storybook.
1344
1523