@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,521 @@
1
+ # Option
2
+
3
+ ## Description
4
+
5
+ A select dropdown option component that represents individual choices within Select components. Supports icons, disabled states, custom styling, and accessibility features for creating rich selection interfaces with proper keyboard navigation and screen reader support.
6
+
7
+ ## Aliases
8
+
9
+ - Option
10
+ - SelectOption
11
+ - DropdownOption
12
+ - Choice
13
+ - ListOption
14
+
15
+ ## Props Breakdown
16
+
17
+ **Extends:** `LiHTMLAttributes<HTMLLIElement>`
18
+
19
+ | Prop | Type | Default | Required | Description |
20
+ |------|------|---------|----------|-------------|
21
+ | `value` | `string \| number` | - | Yes | Value associated with the option |
22
+ | `disabled` | `boolean` | `false` | No | Whether the option is disabled |
23
+ | `leadingIcon` | `ReactNode` | - | No | Icon displayed before the option content |
24
+ | `trailingIcon` | `ReactNode` | - | No | Icon displayed after the option content |
25
+ | `className` | `string` | - | No | Additional CSS class names for custom styling |
26
+ | `children` | `ReactNode` | - | Yes | Content of the option (text, elements, etc.) |
27
+ | `closeSelectOptions` | `() => void` | - | No | Internal function to close select dropdown |
28
+
29
+ Plus all standard HTML list item attributes (`id`, `style`, `onClick`, etc.).
30
+
31
+ ## Examples
32
+
33
+ ### Basic Usage
34
+ ```tsx
35
+ import { Select, Option } from '@delightui/components';
36
+
37
+ function BasicExample() {
38
+ return (
39
+ <Select placeholder="Choose an option">
40
+ <Option value="option1">Option 1</Option>
41
+ <Option value="option2">Option 2</Option>
42
+ <Option value="option3">Option 3</Option>
43
+ <Option value="option4">Option 4</Option>
44
+ </Select>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ### Options with Icons
50
+ ```tsx
51
+ function IconOptionsExample() {
52
+ return (
53
+ <Select placeholder="Select a service">
54
+ <Option
55
+ value="web"
56
+ leadingIcon={<Icon icon="Web" />}
57
+ >
58
+ Web Development
59
+ </Option>
60
+
61
+ <Option
62
+ value="mobile"
63
+ leadingIcon={<Icon icon="PhoneAndroid" />}
64
+ >
65
+ Mobile Development
66
+ </Option>
67
+
68
+ <Option
69
+ value="design"
70
+ leadingIcon={<Icon icon="Palette" />}
71
+ >
72
+ UI/UX Design
73
+ </Option>
74
+
75
+ <Option
76
+ value="consulting"
77
+ leadingIcon={<Icon icon="Business" />}
78
+ trailingIcon={<Icon icon="Star" />}
79
+ >
80
+ Business Consulting
81
+ </Option>
82
+ </Select>
83
+ );
84
+ }
85
+ ```
86
+
87
+ ### Disabled Options
88
+ ```tsx
89
+ function DisabledOptionsExample() {
90
+ return (
91
+ <Select placeholder="Select a plan">
92
+ <Option value="free" leadingIcon={<Icon icon="Free" />}>
93
+ Free Plan
94
+ </Option>
95
+
96
+ <Option value="basic" leadingIcon={<Icon icon="Basic" />}>
97
+ Basic Plan - $9/month
98
+ </Option>
99
+
100
+ <Option
101
+ value="premium"
102
+ leadingIcon={<Icon icon="Premium" />}
103
+ disabled
104
+ >
105
+ Premium Plan - Coming Soon
106
+ </Option>
107
+
108
+ <Option
109
+ value="enterprise"
110
+ leadingIcon={<Icon icon="Enterprise" />}
111
+ disabled
112
+ >
113
+ Enterprise Plan - Contact Sales
114
+ </Option>
115
+ </Select>
116
+ );
117
+ }
118
+ ```
119
+
120
+ ### Country/Region Selection
121
+ ```tsx
122
+ function CountrySelectExample() {
123
+ const countries = [
124
+ { code: 'us', name: 'United States', flag: 'πΊπΈ' },
125
+ { code: 'uk', name: 'United Kingdom', flag: 'π¬π§' },
126
+ { code: 'ca', name: 'Canada', flag: 'π¨π¦' },
127
+ { code: 'au', name: 'Australia', flag: 'π¦πΊ' },
128
+ { code: 'de', name: 'Germany', flag: 'π©πͺ' },
129
+ { code: 'fr', name: 'France', flag: 'π«π·' },
130
+ { code: 'jp', name: 'Japan', flag: 'π―π΅' }
131
+ ];
132
+
133
+ return (
134
+ <Select placeholder="Select your country">
135
+ {countries.map(country => (
136
+ <Option
137
+ key={country.code}
138
+ value={country.code}
139
+ leadingIcon={<Text>{country.flag}</Text>}
140
+ >
141
+ {country.name}
142
+ </Option>
143
+ ))}
144
+ </Select>
145
+ );
146
+ }
147
+ ```
148
+
149
+ ### Options with Descriptions
150
+ ```tsx
151
+ function DescriptiveOptionsExample() {
152
+ return (
153
+ <Select placeholder="Choose your subscription">
154
+ <Option value="starter" className="descriptive-option">
155
+ <div className="option-content">
156
+ <div className="option-header">
157
+ <Icon icon="Rocket" />
158
+ <Text type="BodyMedium">Starter Plan</Text>
159
+ <Chip size="Small" style="Success">Popular</Chip>
160
+ </div>
161
+ <Text type="BodySmall" className="option-description">
162
+ Perfect for individuals and small teams
163
+ </Text>
164
+ <Text type="BodySmall" className="option-price">
165
+ $9/month
166
+ </Text>
167
+ </div>
168
+ </Option>
169
+
170
+ <Option value="professional" className="descriptive-option">
171
+ <div className="option-content">
172
+ <div className="option-header">
173
+ <Icon icon="Business" />
174
+ <Text type="BodyMedium">Professional Plan</Text>
175
+ </div>
176
+ <Text type="BodySmall" className="option-description">
177
+ Advanced features for growing businesses
178
+ </Text>
179
+ <Text type="BodySmall" className="option-price">
180
+ $29/month
181
+ </Text>
182
+ </div>
183
+ </Option>
184
+
185
+ <Option value="enterprise" className="descriptive-option">
186
+ <div className="option-content">
187
+ <div className="option-header">
188
+ <Icon icon="Enterprise" />
189
+ <Text type="BodyMedium">Enterprise Plan</Text>
190
+ </div>
191
+ <Text type="BodySmall" className="option-description">
192
+ Full-scale solution for large organizations
193
+ </Text>
194
+ <Text type="BodySmall" className="option-price">
195
+ Custom pricing
196
+ </Text>
197
+ </div>
198
+ </Option>
199
+ </Select>
200
+ );
201
+ }
202
+ ```
203
+
204
+ ### Status/Priority Options
205
+ ```tsx
206
+ function StatusOptionsExample() {
207
+ return (
208
+ <Select placeholder="Set priority level">
209
+ <Option
210
+ value="critical"
211
+ leadingIcon={<Icon icon="PriorityHigh" style={{ color: '#d32f2f' }} />}
212
+ >
213
+ <Text style={{ color: '#d32f2f' }}>Critical</Text>
214
+ </Option>
215
+
216
+ <Option
217
+ value="high"
218
+ leadingIcon={<Icon icon="ArrowUpward" style={{ color: '#f57c00' }} />}
219
+ >
220
+ <Text style={{ color: '#f57c00' }}>High Priority</Text>
221
+ </Option>
222
+
223
+ <Option
224
+ value="medium"
225
+ leadingIcon={<Icon icon="Remove" style={{ color: '#1976d2' }} />}
226
+ >
227
+ <Text style={{ color: '#1976d2' }}>Medium Priority</Text>
228
+ </Option>
229
+
230
+ <Option
231
+ value="low"
232
+ leadingIcon={<Icon icon="ArrowDownward" style={{ color: '#388e3c' }} />}
233
+ >
234
+ <Text style={{ color: '#388e3c' }}>Low Priority</Text>
235
+ </Option>
236
+ </Select>
237
+ );
238
+ }
239
+ ```
240
+
241
+ ### Team Member Selection
242
+ ```tsx
243
+ function TeamMemberOptionsExample() {
244
+ const teamMembers = [
245
+ {
246
+ id: 'john',
247
+ name: 'John Doe',
248
+ role: 'Developer',
249
+ avatar: '/avatars/john.jpg',
250
+ status: 'online'
251
+ },
252
+ {
253
+ id: 'jane',
254
+ name: 'Jane Smith',
255
+ role: 'Designer',
256
+ avatar: '/avatars/jane.jpg',
257
+ status: 'busy'
258
+ },
259
+ {
260
+ id: 'mike',
261
+ name: 'Mike Johnson',
262
+ role: 'Project Manager',
263
+ avatar: '/avatars/mike.jpg',
264
+ status: 'offline'
265
+ }
266
+ ];
267
+
268
+ return (
269
+ <Select placeholder="Assign to team member">
270
+ {teamMembers.map(member => (
271
+ <Option
272
+ key={member.id}
273
+ value={member.id}
274
+ className="team-member-option"
275
+ disabled={member.status === 'offline'}
276
+ >
277
+ <div className="member-info">
278
+ <div className="member-avatar">
279
+ <Image
280
+ src={member.avatar}
281
+ alt={member.name}
282
+ size="Small"
283
+ />
284
+ <div className={`status-indicator ${member.status}`} />
285
+ </div>
286
+
287
+ <div className="member-details">
288
+ <Text type="BodyMedium">{member.name}</Text>
289
+ <Text type="BodySmall" className="member-role">
290
+ {member.role}
291
+ </Text>
292
+ </div>
293
+
294
+ <div className="member-status">
295
+ <Chip
296
+ size="Small"
297
+ style={
298
+ member.status === 'online' ? 'Success' :
299
+ member.status === 'busy' ? 'Warning' : 'Default'
300
+ }
301
+ >
302
+ {member.status}
303
+ </Chip>
304
+ </div>
305
+ </div>
306
+ </Option>
307
+ ))}
308
+ </Select>
309
+ );
310
+ }
311
+ ```
312
+
313
+ ### Grouped Options
314
+ ```tsx
315
+ function GroupedOptionsExample() {
316
+ return (
317
+ <Select placeholder="Select a technology">
318
+ <optgroup label="Frontend">
319
+ <Option value="react" leadingIcon={<Icon icon="React" />}>
320
+ React
321
+ </Option>
322
+ <Option value="vue" leadingIcon={<Icon icon="Vue" />}>
323
+ Vue.js
324
+ </Option>
325
+ <Option value="angular" leadingIcon={<Icon icon="Angular" />}>
326
+ Angular
327
+ </Option>
328
+ </optgroup>
329
+
330
+ <optgroup label="Backend">
331
+ <Option value="node" leadingIcon={<Icon icon="NodeJS" />}>
332
+ Node.js
333
+ </Option>
334
+ <Option value="python" leadingIcon={<Icon icon="Python" />}>
335
+ Python
336
+ </Option>
337
+ <Option value="java" leadingIcon={<Icon icon="Java" />}>
338
+ Java
339
+ </Option>
340
+ </optgroup>
341
+
342
+ <optgroup label="Database">
343
+ <Option value="mongodb" leadingIcon={<Icon icon="Database" />}>
344
+ MongoDB
345
+ </Option>
346
+ <Option value="postgresql" leadingIcon={<Icon icon="Database" />}>
347
+ PostgreSQL
348
+ </Option>
349
+ <Option value="mysql" leadingIcon={<Icon icon="Database" />}>
350
+ MySQL
351
+ </Option>
352
+ </optgroup>
353
+ </Select>
354
+ );
355
+ }
356
+ ```
357
+
358
+ ### Multi-select Options
359
+ ```tsx
360
+ function MultiSelectOptionsExample() {
361
+ const [selectedTags, setSelectedTags] = useState([]);
362
+
363
+ const tags = [
364
+ { id: 'urgent', label: 'Urgent', color: '#d32f2f' },
365
+ { id: 'important', label: 'Important', color: '#f57c00' },
366
+ { id: 'feature', label: 'Feature', color: '#1976d2' },
367
+ { id: 'bug', label: 'Bug Fix', color: '#d32f2f' },
368
+ { id: 'improvement', label: 'Improvement', color: '#388e3c' },
369
+ { id: 'documentation', label: 'Documentation', color: '#7b1fa2' }
370
+ ];
371
+
372
+ return (
373
+ <Select
374
+ multiple
375
+ value={selectedTags}
376
+ onValueChange={setSelectedTags}
377
+ placeholder="Select tags"
378
+ >
379
+ {tags.map(tag => (
380
+ <Option
381
+ key={tag.id}
382
+ value={tag.id}
383
+ leadingIcon={
384
+ <div
385
+ className="tag-color-indicator"
386
+ style={{ backgroundColor: tag.color }}
387
+ />
388
+ }
389
+ trailingIcon={
390
+ selectedTags.includes(tag.id) ? (
391
+ <Icon icon="Check" />
392
+ ) : null
393
+ }
394
+ >
395
+ {tag.label}
396
+ </Option>
397
+ ))}
398
+ </Select>
399
+ );
400
+ }
401
+ ```
402
+
403
+ ### Search Results Options
404
+ ```tsx
405
+ function SearchResultsOptionsExample() {
406
+ const [searchTerm, setSearchTerm] = useState('');
407
+
408
+ const searchResults = [
409
+ {
410
+ id: 1,
411
+ title: 'React Best Practices',
412
+ category: 'Development',
413
+ description: 'Learn the latest React patterns and techniques'
414
+ },
415
+ {
416
+ id: 2,
417
+ title: 'Design System Guidelines',
418
+ category: 'Design',
419
+ description: 'Comprehensive guide to building design systems'
420
+ },
421
+ {
422
+ id: 3,
423
+ title: 'API Documentation',
424
+ category: 'Documentation',
425
+ description: 'Complete API reference and examples'
426
+ }
427
+ ];
428
+
429
+ const filteredResults = searchResults.filter(result =>
430
+ result.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
431
+ result.description.toLowerCase().includes(searchTerm.toLowerCase())
432
+ );
433
+
434
+ return (
435
+ <div className="search-select">
436
+ <Input
437
+ placeholder="Search..."
438
+ value={searchTerm}
439
+ onValueChange={setSearchTerm}
440
+ leadingIcon={<Icon icon="Search" />}
441
+ />
442
+
443
+ <Select placeholder="Select from results">
444
+ {filteredResults.map(result => (
445
+ <Option
446
+ key={result.id}
447
+ value={result.id}
448
+ className="search-result-option"
449
+ >
450
+ <div className="result-content">
451
+ <div className="result-header">
452
+ <Text type="BodyMedium">{result.title}</Text>
453
+ <Chip size="Small">{result.category}</Chip>
454
+ </div>
455
+ <Text type="BodySmall" className="result-description">
456
+ {result.description}
457
+ </Text>
458
+ </div>
459
+ </Option>
460
+ ))}
461
+
462
+ {filteredResults.length === 0 && (
463
+ <Option value="" disabled>
464
+ <Text type="BodySmall">No results found</Text>
465
+ </Option>
466
+ )}
467
+ </Select>
468
+ </div>
469
+ );
470
+ }
471
+ ```
472
+
473
+ ### Custom Styled Options
474
+ ```tsx
475
+ function CustomStyledOptionsExample() {
476
+ return (
477
+ <Select placeholder="Choose your theme">
478
+ <Option
479
+ value="light"
480
+ className="theme-option light-theme"
481
+ leadingIcon={<Icon icon="LightMode" />}
482
+ >
483
+ <div className="theme-content">
484
+ <Text type="BodyMedium">Light Theme</Text>
485
+ <div className="theme-preview">
486
+ <div className="color-swatch" style={{ backgroundColor: '#ffffff' }} />
487
+ <div className="color-swatch" style={{ backgroundColor: '#f5f5f5' }} />
488
+ <div className="color-swatch" style={{ backgroundColor: '#e0e0e0' }} />
489
+ </div>
490
+ </div>
491
+ </Option>
492
+
493
+ <Option
494
+ value="dark"
495
+ className="theme-option dark-theme"
496
+ leadingIcon={<Icon icon="DarkMode" />}
497
+ >
498
+ <div className="theme-content">
499
+ <Text type="BodyMedium">Dark Theme</Text>
500
+ <div className="theme-preview">
501
+ <div className="color-swatch" style={{ backgroundColor: '#121212' }} />
502
+ <div className="color-swatch" style={{ backgroundColor: '#1e1e1e' }} />
503
+ <div className="color-swatch" style={{ backgroundColor: '#333333' }} />
504
+ </div>
505
+ </div>
506
+ </Option>
507
+
508
+ <Option
509
+ value="auto"
510
+ className="theme-option auto-theme"
511
+ leadingIcon={<Icon icon="AutoMode" />}
512
+ >
513
+ <div className="theme-content">
514
+ <Text type="BodyMedium">Auto Theme</Text>
515
+ <Text type="BodySmall">Follows system preference</Text>
516
+ </div>
517
+ </Option>
518
+ </Select>
519
+ );
520
+ }
521
+ ```