@delightui/components 0.1.105 → 0.1.107

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.
Files changed (102) hide show
  1. package/README.md +104 -1
  2. package/dist/cjs/components/molecules/Modal/DemoModal.d.ts +8 -0
  3. package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
  4. package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
  5. package/dist/cjs/components/molecules/Modal/ModalContext/index.d.ts +3 -0
  6. package/dist/cjs/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
  7. package/dist/cjs/components/molecules/Modal/index.d.ts +2 -0
  8. package/dist/cjs/components/molecules/index.d.ts +2 -0
  9. package/dist/cjs/library.css +19 -6
  10. package/dist/cjs/library.js +3 -3
  11. package/dist/cjs/library.js.map +1 -1
  12. package/dist/esm/components/molecules/Modal/DemoModal.d.ts +8 -0
  13. package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
  14. package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
  15. package/dist/esm/components/molecules/Modal/ModalContext/index.d.ts +3 -0
  16. package/dist/esm/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
  17. package/dist/esm/components/molecules/Modal/index.d.ts +2 -0
  18. package/dist/esm/components/molecules/index.d.ts +2 -0
  19. package/dist/esm/library.css +19 -6
  20. package/dist/esm/library.js +3 -3
  21. package/dist/esm/library.js.map +1 -1
  22. package/dist/index.d.ts +108 -2
  23. package/docs/README.md +264 -0
  24. package/docs/components/atoms/ActionImage.md +119 -0
  25. package/docs/components/atoms/Button.md +197 -0
  26. package/docs/components/atoms/Checkbox.md +299 -0
  27. package/docs/components/atoms/CheckboxItem.md +314 -0
  28. package/docs/components/atoms/Chip.md +380 -0
  29. package/docs/components/atoms/CustomToggle.md +270 -0
  30. package/docs/components/atoms/Icon.md +365 -0
  31. package/docs/components/atoms/IconButton.md +407 -0
  32. package/docs/components/atoms/Image.md +448 -0
  33. package/docs/components/atoms/Input.md +430 -0
  34. package/docs/components/atoms/ListItem.md +502 -0
  35. package/docs/components/atoms/Password.md +472 -0
  36. package/docs/components/atoms/RadioButton.md +614 -0
  37. package/docs/components/atoms/RadioButtonItem.md +588 -0
  38. package/docs/components/atoms/ResponsiveComponent.md +612 -0
  39. package/docs/components/atoms/SelectListItem.md +609 -0
  40. package/docs/components/atoms/Slider.md +605 -0
  41. package/docs/components/atoms/Spinner.md +605 -0
  42. package/docs/components/atoms/Text.md +463 -0
  43. package/docs/components/atoms/TextArea.md +670 -0
  44. package/docs/components/atoms/ToastNotification.md +668 -0
  45. package/docs/components/atoms/Toggle.md +737 -0
  46. package/docs/components/atoms/ToggleButton.md +751 -0
  47. package/docs/components/atoms/Tooltip.md +391 -0
  48. package/docs/components/molecules/Accordion.md +440 -0
  49. package/docs/components/molecules/AccordionGroup.md +547 -0
  50. package/docs/components/molecules/ActionCard.md +546 -0
  51. package/docs/components/molecules/Breadcrumb.md +403 -0
  52. package/docs/components/molecules/Breadcrumbs.md +485 -0
  53. package/docs/components/molecules/ButtonGroup.md +383 -0
  54. package/docs/components/molecules/Card.md +298 -0
  55. package/docs/components/molecules/ChipInput.md +646 -0
  56. package/docs/components/molecules/ContextMenu.md +768 -0
  57. package/docs/components/molecules/CustomTimeSelector.md +116 -0
  58. package/docs/components/molecules/DatePicker.md +516 -0
  59. package/docs/components/molecules/DateTimeSelector.md +166 -0
  60. package/docs/components/molecules/FormField.md +312 -0
  61. package/docs/components/molecules/Grid.md +577 -0
  62. package/docs/components/molecules/GridItem.md +834 -0
  63. package/docs/components/molecules/GridList.md +244 -0
  64. package/docs/components/molecules/List.md +485 -0
  65. package/docs/components/molecules/Modal.md +470 -0
  66. package/docs/components/molecules/ModalFooter.md +702 -0
  67. package/docs/components/molecules/ModalHeader.md +756 -0
  68. package/docs/components/molecules/ModalProvider.md +205 -0
  69. package/docs/components/molecules/Nav.md +530 -0
  70. package/docs/components/molecules/NavItem.md +572 -0
  71. package/docs/components/molecules/NavLink.md +499 -0
  72. package/docs/components/molecules/Option.md +521 -0
  73. package/docs/components/molecules/Pagination.md +592 -0
  74. package/docs/components/molecules/PaginationNumberField.md +722 -0
  75. package/docs/components/molecules/Popover.md +516 -0
  76. package/docs/components/molecules/ProgressBar.md +624 -0
  77. package/docs/components/molecules/RadioGroup.md +831 -0
  78. package/docs/components/molecules/RepeaterList.md +185 -0
  79. package/docs/components/molecules/Select.md +402 -0
  80. package/docs/components/molecules/SortableTrigger.md +82 -0
  81. package/docs/components/molecules/useModal.md +379 -0
  82. package/docs/components/organisms/Dropzone.md +346 -0
  83. package/docs/components/organisms/DropzoneClear.md +135 -0
  84. package/docs/components/organisms/DropzoneContent.md +216 -0
  85. package/docs/components/organisms/DropzoneFilename.md +191 -0
  86. package/docs/components/organisms/DropzoneSupportedFormats.md +184 -0
  87. package/docs/components/organisms/DropzoneTrigger.md +209 -0
  88. package/docs/components/organisms/Form.md +533 -0
  89. package/docs/components/organisms/SlideOutPanel.md +662 -0
  90. package/docs/components/organisms/TabContent.md +902 -0
  91. package/docs/components/organisms/TabItem.md +1091 -0
  92. package/docs/components/organisms/Table.md +611 -0
  93. package/docs/components/organisms/TableBody.md +679 -0
  94. package/docs/components/organisms/TableCell.md +482 -0
  95. package/docs/components/organisms/TableHeader.md +513 -0
  96. package/docs/components/organisms/TableHeaderCell.md +661 -0
  97. package/docs/components/organisms/TableRow.md +715 -0
  98. package/docs/components/organisms/Tabs.md +1330 -0
  99. package/docs/components/utils/ConditionalView.md +568 -0
  100. package/docs/components/utils/RenderStateView.md +726 -0
  101. package/docs/components/utils/WrapTextNodes.md +614 -0
  102. package/package.json +3 -2
@@ -0,0 +1,470 @@
1
+ # Modal
2
+
3
+ ## Description
4
+
5
+ A modal dialog component that displays content in a layer above the main application interface. Provides flexible sizing options, customizable header and footer areas, backdrop controls, and accessibility features for creating overlay dialogs, confirmations, and forms.
6
+
7
+ ## Aliases
8
+
9
+ - Modal
10
+ - Dialog
11
+ - Popup
12
+ - Overlay
13
+ - Lightbox
14
+
15
+ ## Props Breakdown
16
+
17
+ **Extends:** Standalone interface (no HTML element inheritance)
18
+
19
+ | Prop | Type | Default | Required | Description |
20
+ |------|------|---------|----------|-------------|
21
+ | `children` | `ReactNode` | - | Yes | The content rendered inside the modal |
22
+ | `size` | `'Small' \| 'Medium' \| 'Large'` | `'Medium'` | No | Size of the modal |
23
+ | `onHide` | `() => void` | - | No | Callback function invoked when modal is hidden |
24
+ | `show` | `boolean` | `false` | No | Controls modal visibility |
25
+ | `header` | `ReactNode` | - | No | Content rendered in the modal header |
26
+ | `footer` | `ReactNode` | - | No | Content rendered in the modal footer |
27
+ | `renderBackdrop` | `ReactNode` | - | No | Custom backdrop element |
28
+ | `backdrop` | `boolean` | `true` | No | Whether to display backdrop behind modal |
29
+ | `disableBackdropDismiss` | `boolean` | `false` | No | Disables dismissing modal by clicking backdrop |
30
+ | `component-variant` | `string` | - | No | Override styling variant |
31
+ | `className` | `string` | - | No | Additional CSS class names |
32
+
33
+ ## Examples
34
+
35
+ ### Basic Usage
36
+ ```tsx
37
+ import { Modal, Button, Text, useModal } from '@delightui/components';
38
+
39
+ const SimpleModal = ({ show, onCancel, title, message }) => (
40
+ <Modal show={show} onHide={onCancel}>
41
+ <Text type="Heading4">{title}</Text>
42
+ <Text>{message}</Text>
43
+ </Modal>
44
+ );
45
+
46
+ function BasicExample() {
47
+ const modal = useModal(SimpleModal);
48
+
49
+ return (
50
+ <Button onClick={() => modal.openModal({
51
+ title: 'Welcome!',
52
+ message: 'This is a simple modal with basic content.'
53
+ })}>
54
+ Open Modal
55
+ </Button>
56
+ );
57
+ }
58
+ ```
59
+
60
+ ### Modal Sizes
61
+ ```tsx
62
+ import { Modal, Button, Text, useModal } from '@delightui/components';
63
+
64
+ const SizedModal = ({ show, onCancel, size, title, message }) => (
65
+ <Modal show={show} onHide={onCancel} size={size}>
66
+ <Text type={size === 'Small' ? 'Heading5' : size === 'Medium' ? 'Heading4' : 'Heading3'}>
67
+ {title}
68
+ </Text>
69
+ <Text>{message}</Text>
70
+ </Modal>
71
+ );
72
+
73
+ function SizesExample() {
74
+ const smallModal = useModal(SizedModal);
75
+ const mediumModal = useModal(SizedModal);
76
+ const largeModal = useModal(SizedModal);
77
+
78
+ return (
79
+ <div className="modal-sizes">
80
+ <Button onClick={() => smallModal.openModal({
81
+ size: 'Small',
82
+ title: 'Small Modal',
83
+ message: 'This is a small modal for quick messages.'
84
+ })}>
85
+ Small Modal
86
+ </Button>
87
+
88
+ <Button onClick={() => mediumModal.openModal({
89
+ size: 'Medium',
90
+ title: 'Medium Modal',
91
+ message: 'This is a medium modal with more content space.'
92
+ })}>
93
+ Medium Modal
94
+ </Button>
95
+
96
+ <Button onClick={() => largeModal.openModal({
97
+ size: 'Large',
98
+ title: 'Large Modal',
99
+ message: 'This is a large modal for complex content and forms.'
100
+ })}>
101
+ Large Modal
102
+ </Button>
103
+ </div>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ### Modal with Header and Footer
109
+ ```tsx
110
+ import { Modal, Button, Text, Icon, useModal } from '@delightui/components';
111
+
112
+ const ConfirmModal = ({ show, onCancel, onConfirm }) => {
113
+ const header = (
114
+ <div className="modal-header">
115
+ <Text type="Heading4">Confirm Action</Text>
116
+ <Button
117
+ type="Ghost"
118
+ onClick={onCancel}
119
+ aria-label="Close modal"
120
+ >
121
+ <Icon icon="Close" />
122
+ </Button>
123
+ </div>
124
+ );
125
+
126
+ const footer = (
127
+ <div className="modal-footer">
128
+ <Button
129
+ type="Outlined"
130
+ onClick={onCancel}
131
+ >
132
+ Cancel
133
+ </Button>
134
+ <Button
135
+ style="Destructive"
136
+ onClick={onConfirm}
137
+ >
138
+ Delete
139
+ </Button>
140
+ </div>
141
+ );
142
+
143
+ return (
144
+ <Modal
145
+ show={show}
146
+ onHide={onCancel}
147
+ header={header}
148
+ footer={footer}
149
+ >
150
+ <Text>
151
+ Are you sure you want to delete this item?
152
+ This action cannot be undone.
153
+ </Text>
154
+ </Modal>
155
+ );
156
+ };
157
+
158
+ function HeaderFooterExample() {
159
+ const confirmModal = useModal(ConfirmModal);
160
+
161
+ return (
162
+ <Button onClick={() => confirmModal.openModal({
163
+ onConfirm: () => {
164
+ // Handle confirmation
165
+ console.log('Item deleted');
166
+ confirmModal.closeModal();
167
+ }
168
+ })}>
169
+ Delete Item
170
+ </Button>
171
+ );
172
+ }
173
+ ```
174
+
175
+ ### Form Modal
176
+ ```tsx
177
+ import { Modal, Form, FormField, Input, TextArea, Button, Text, useModal } from '@delightui/components';
178
+
179
+ const ProjectFormModal = ({ show, onCancel }) => {
180
+ const handleSubmit = (values, setError) => {
181
+ console.log('Form submitted:', values);
182
+ onCancel();
183
+ };
184
+
185
+ const header = (
186
+ <Text type="Heading4">Create New Project</Text>
187
+ );
188
+
189
+ return (
190
+ <Modal
191
+ show={show}
192
+ onHide={onCancel}
193
+ size="Medium"
194
+ header={header}
195
+ >
196
+ <Form onSubmit={handleSubmit}>
197
+ <FormField name="projectName" label="Project Name" required>
198
+ <Input placeholder="Enter project name" />
199
+ </FormField>
200
+
201
+ <FormField name="description" label="Description">
202
+ <TextArea
203
+ placeholder="Project description..."
204
+ rows={3}
205
+ />
206
+ </FormField>
207
+
208
+ <FormField name="category" label="Category" required>
209
+ <Select>
210
+ <Option value="web">Web Development</Option>
211
+ <Option value="mobile">Mobile App</Option>
212
+ <Option value="design">Design</Option>
213
+ </Select>
214
+ </FormField>
215
+
216
+ <div className="modal-form-actions">
217
+ <Button
218
+ type="Outlined"
219
+ onClick={onCancel}
220
+ >
221
+ Cancel
222
+ </Button>
223
+ <Button actionType="submit">
224
+ Create Project
225
+ </Button>
226
+ </div>
227
+ </Form>
228
+ </Modal>
229
+ );
230
+ };
231
+
232
+ function FormModalExample() {
233
+ const projectModal = useModal(ProjectFormModal);
234
+
235
+ return (
236
+ <Button onClick={() => projectModal.openModal({})}>
237
+ New Project
238
+ </Button>
239
+ );
240
+ }
241
+ ```
242
+
243
+ ### Confirmation Modal
244
+ ```tsx
245
+ function ConfirmationModalExample() {
246
+ const [showModal, setShowModal] = useState(false);
247
+ const [loading, setLoading] = useState(false);
248
+
249
+ const handleConfirm = async () => {
250
+ setLoading(true);
251
+ // Simulate API call
252
+ await new Promise(resolve => setTimeout(resolve, 2000));
253
+ setLoading(false);
254
+ setShowModal(false);
255
+ };
256
+
257
+ return (
258
+ <>
259
+ <Button style="Destructive" onClick={() => setShowModal(true)}>
260
+ Delete Account
261
+ </Button>
262
+
263
+ <Modal
264
+ show={showModal}
265
+ onHide={() => setShowModal(false)}
266
+ size="Small"
267
+ disableBackdropDismiss={loading}
268
+ >
269
+ <div className="confirmation-modal">
270
+ <Icon icon="Warning" className="warning-icon" />
271
+
272
+ <Text type="Heading5">Delete Account</Text>
273
+
274
+ <Text>
275
+ This will permanently delete your account and all associated data.
276
+ This action cannot be undone.
277
+ </Text>
278
+
279
+ <div className="confirmation-actions">
280
+ <Button
281
+ type="Outlined"
282
+ onClick={() => setShowModal(false)}
283
+ disabled={loading}
284
+ >
285
+ Cancel
286
+ </Button>
287
+ <Button
288
+ style="Destructive"
289
+ loading={loading}
290
+ onClick={handleConfirm}
291
+ >
292
+ Delete Account
293
+ </Button>
294
+ </div>
295
+ </div>
296
+ </Modal>
297
+ </>
298
+ );
299
+ }
300
+ ```
301
+
302
+ ### Image Gallery Modal
303
+ ```tsx
304
+ function ImageGalleryModalExample() {
305
+ const [selectedImage, setSelectedImage] = useState(null);
306
+
307
+ const images = [
308
+ { src: '/image1.jpg', alt: 'Gallery Image 1' },
309
+ { src: '/image2.jpg', alt: 'Gallery Image 2' },
310
+ { src: '/image3.jpg', alt: 'Gallery Image 3' }
311
+ ];
312
+
313
+ return (
314
+ <div className="image-gallery">
315
+ {images.map((image, index) => (
316
+ <Image
317
+ key={index}
318
+ src={image.src}
319
+ alt={image.alt}
320
+ className="gallery-thumbnail"
321
+ onClick={() => setSelectedImage(image)}
322
+ />
323
+ ))}
324
+
325
+ <Modal
326
+ show={!!selectedImage}
327
+ onHide={() => setSelectedImage(null)}
328
+ size="Large"
329
+ className="image-modal"
330
+ >
331
+ {selectedImage && (
332
+ <>
333
+ <div className="image-modal-header">
334
+ <Button
335
+ type="Ghost"
336
+ onClick={() => setSelectedImage(null)}
337
+ >
338
+ <Icon icon="Close" />
339
+ </Button>
340
+ </div>
341
+
342
+ <div className="image-modal-content">
343
+ <Image
344
+ src={selectedImage.src}
345
+ alt={selectedImage.alt}
346
+ fit="Fit"
347
+ />
348
+ </div>
349
+ </>
350
+ )}
351
+ </Modal>
352
+ </div>
353
+ );
354
+ }
355
+ ```
356
+
357
+ ### Multi-step Modal
358
+ ```tsx
359
+ function MultiStepModalExample() {
360
+ const [showModal, setShowModal] = useState(false);
361
+ const [currentStep, setCurrentStep] = useState(1);
362
+ const totalSteps = 3;
363
+
364
+ const nextStep = () => setCurrentStep(prev => Math.min(prev + 1, totalSteps));
365
+ const prevStep = () => setCurrentStep(prev => Math.max(prev - 1, 1));
366
+
367
+ const closeModal = () => {
368
+ setShowModal(false);
369
+ setCurrentStep(1);
370
+ };
371
+
372
+ const header = (
373
+ <div className="multi-step-header">
374
+ <Text type="Heading4">Setup Wizard</Text>
375
+ <Text type="BodySmall">Step {currentStep} of {totalSteps}</Text>
376
+ </div>
377
+ );
378
+
379
+ const footer = (
380
+ <div className="multi-step-footer">
381
+ <Button
382
+ type="Outlined"
383
+ onClick={currentStep === 1 ? closeModal : prevStep}
384
+ >
385
+ {currentStep === 1 ? 'Cancel' : 'Previous'}
386
+ </Button>
387
+
388
+ <Button
389
+ onClick={currentStep === totalSteps ? closeModal : nextStep}
390
+ >
391
+ {currentStep === totalSteps ? 'Finish' : 'Next'}
392
+ </Button>
393
+ </div>
394
+ );
395
+
396
+ return (
397
+ <>
398
+ <Button onClick={() => setShowModal(true)}>
399
+ Start Setup
400
+ </Button>
401
+
402
+ <Modal
403
+ show={showModal}
404
+ onHide={closeModal}
405
+ size="Medium"
406
+ header={header}
407
+ footer={footer}
408
+ disableBackdropDismiss
409
+ >
410
+ <div className="step-content">
411
+ {currentStep === 1 && (
412
+ <div>
413
+ <Text type="Heading5">Welcome</Text>
414
+ <Text>Let's get you started with your account setup.</Text>
415
+ </div>
416
+ )}
417
+
418
+ {currentStep === 2 && (
419
+ <div>
420
+ <Text type="Heading5">Profile Information</Text>
421
+ <FormField name="name" label="Full Name">
422
+ <Input placeholder="Your name" />
423
+ </FormField>
424
+ </div>
425
+ )}
426
+
427
+ {currentStep === 3 && (
428
+ <div>
429
+ <Text type="Heading5">Complete</Text>
430
+ <Text>Your account has been set up successfully!</Text>
431
+ </div>
432
+ )}
433
+ </div>
434
+ </Modal>
435
+ </>
436
+ );
437
+ }
438
+ ```
439
+
440
+ ### Custom Backdrop Modal
441
+ ```tsx
442
+ function CustomBackdropExample() {
443
+ const [showModal, setShowModal] = useState(false);
444
+
445
+ const customBackdrop = (
446
+ <div className="custom-backdrop">
447
+ <div className="backdrop-pattern" />
448
+ </div>
449
+ );
450
+
451
+ return (
452
+ <>
453
+ <Button onClick={() => setShowModal(true)}>
454
+ Custom Backdrop
455
+ </Button>
456
+
457
+ <Modal
458
+ show={showModal}
459
+ onHide={() => setShowModal(false)}
460
+ renderBackdrop={customBackdrop}
461
+ >
462
+ <Text type="Heading4">Custom Styled Modal</Text>
463
+ <Text>
464
+ This modal uses a custom backdrop with special styling.
465
+ </Text>
466
+ </Modal>
467
+ </>
468
+ );
469
+ }
470
+ ```