@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,270 @@
1
+ # CustomToggle
2
+
3
+ A highly customizable toggle component that allows you to define custom content for both the on and off states. This component provides a flexible alternative to the standard Toggle component by letting you specify what content appears in each state, making it perfect for scenarios where you need more than just basic on/off visual states.
4
+
5
+ ## Aliases
6
+
7
+ - CustomToggle
8
+ - CustomSwitch
9
+ - ContentToggle
10
+
11
+ ## Props Breakdown
12
+
13
+ **Extends:** `ControlledFormComponentProps<boolean>`
14
+
15
+ | Prop | Type | Default | Required | Description |
16
+ |------|------|---------|----------|-------------|
17
+ | `offContent` | `ReactNode` | `undefined` | No | Content to show when toggle is off |
18
+ | `onContent` | `ReactNode` | `undefined` | No | Content to show when toggle is on |
19
+ | `className` | `string` | `undefined` | No | Additional className for the toggle |
20
+ | `initialValue` | `boolean` | `undefined` | No | The initial value for the field |
21
+ | `checked` | `boolean` | `undefined` | No | The initial value for the field |
22
+ | `value` | `boolean` | `undefined` | No | The current value of the form field |
23
+ | `onValueChange` | `(value: boolean) => void` | `undefined` | No | Callback function that is called when the field value changes |
24
+ | `disabled` | `boolean` | `false` | No | Whether the form field is disabled and cannot be interacted with |
25
+ | `required` | `boolean` | `false` | No | Whether the form field must have a value |
26
+ | `invalid` | `boolean` | `false` | No | Whether the form field's current value is invalid |
27
+ | `id` | `string` | `undefined` | No | Id for the form field |
28
+
29
+ ## Examples
30
+
31
+ ### Basic Custom Toggle
32
+
33
+ ```tsx
34
+ import { CustomToggle } from '@delightui/components';
35
+
36
+ function BasicCustomToggleExample() {
37
+ const [isEnabled, setIsEnabled] = useState(false);
38
+
39
+ return (
40
+ <CustomToggle
41
+ value={isEnabled}
42
+ onValueChange={setIsEnabled}
43
+ offContent="Disabled"
44
+ onContent="Enabled"
45
+ />
46
+ );
47
+ }
48
+ ```
49
+
50
+ ### Custom Toggle with Icons
51
+
52
+ ```tsx
53
+ import { CustomToggle, Icon } from '@delightui/components';
54
+
55
+ function IconCustomToggleExample() {
56
+ const [isVisible, setIsVisible] = useState(false);
57
+
58
+ return (
59
+ <CustomToggle
60
+ value={isVisible}
61
+ onValueChange={setIsVisible}
62
+ offContent={<Icon name="VisibilityOffFilled" />}
63
+ onContent={<Icon name="VisibilityOnFilled" />}
64
+ />
65
+ );
66
+ }
67
+ ```
68
+
69
+ ### Custom Toggle with Rich Content
70
+
71
+ ```tsx
72
+ import { CustomToggle, Text } from '@delightui/components';
73
+
74
+ function RichContentToggleExample() {
75
+ const [isActive, setIsActive] = useState(false);
76
+
77
+ return (
78
+ <CustomToggle
79
+ value={isActive}
80
+ onValueChange={setIsActive}
81
+ offContent={
82
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
83
+ <Text size="small" color="error">OFF</Text>
84
+ <span>🔴</span>
85
+ </div>
86
+ }
87
+ onContent={
88
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
89
+ <Text size="small" color="success">ON</Text>
90
+ <span>🟢</span>
91
+ </div>
92
+ }
93
+ />
94
+ );
95
+ }
96
+ ```
97
+
98
+ ### Form Integration
99
+
100
+ ```tsx
101
+ import { Form, FormField, CustomToggle, Button } from '@delightui/components';
102
+
103
+ function FormIntegrationExample() {
104
+ const handleSubmit = (data: any) => {
105
+ console.log('Form submitted:', data);
106
+ };
107
+
108
+ return (
109
+ <Form onSubmit={handleSubmit}>
110
+ <FormField
111
+ name="notifications"
112
+ label="Email Notifications"
113
+ required
114
+ >
115
+ <CustomToggle
116
+ offContent="Notifications Off"
117
+ onContent="Notifications On"
118
+ />
119
+ </FormField>
120
+
121
+ <FormField
122
+ name="darkMode"
123
+ label="Dark Mode"
124
+ >
125
+ <CustomToggle
126
+ offContent="☀️ Light"
127
+ onContent="🌙 Dark"
128
+ />
129
+ </FormField>
130
+
131
+ <Button type="submit">
132
+ Save Settings
133
+ </Button>
134
+ </Form>
135
+ );
136
+ }
137
+ ```
138
+
139
+ ### Disabled State
140
+
141
+ ```tsx
142
+ import { CustomToggle } from '@delightui/components';
143
+
144
+ function DisabledCustomToggleExample() {
145
+ return (
146
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
147
+ <CustomToggle
148
+ disabled
149
+ value={false}
150
+ offContent="Cannot Enable"
151
+ onContent="Enabled"
152
+ />
153
+
154
+ <CustomToggle
155
+ disabled
156
+ value={true}
157
+ offContent="Disabled"
158
+ onContent="Cannot Disable"
159
+ />
160
+ </div>
161
+ );
162
+ }
163
+ ```
164
+
165
+ ### Custom Styling
166
+
167
+ ```tsx
168
+ import { CustomToggle } from '@delightui/components';
169
+
170
+ function StyledCustomToggleExample() {
171
+ const [isOn, setIsOn] = useState(false);
172
+
173
+ return (
174
+ <CustomToggle
175
+ value={isOn}
176
+ onValueChange={setIsOn}
177
+ className="custom-toggle-styles"
178
+ offContent="Start"
179
+ onContent="Stop"
180
+ />
181
+ );
182
+ }
183
+ ```
184
+
185
+ ### Multiple Custom Toggles
186
+
187
+ ```tsx
188
+ import { CustomToggle } from '@delightui/components';
189
+
190
+ function MultipleCustomTogglesExample() {
191
+ const [settings, setSettings] = useState({
192
+ sound: false,
193
+ vibration: false,
194
+ bluetooth: false
195
+ });
196
+
197
+ const updateSetting = (key: string, value: boolean) => {
198
+ setSettings(prev => ({ ...prev, [key]: value }));
199
+ };
200
+
201
+ return (
202
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
203
+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
204
+ <span>Sound:</span>
205
+ <CustomToggle
206
+ value={settings.sound}
207
+ onValueChange={(value) => updateSetting('sound', value)}
208
+ offContent="🔇 Muted"
209
+ onContent="🔊 On"
210
+ />
211
+ </div>
212
+
213
+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
214
+ <span>Vibration:</span>
215
+ <CustomToggle
216
+ value={settings.vibration}
217
+ onValueChange={(value) => updateSetting('vibration', value)}
218
+ offContent="📱 Off"
219
+ onContent="📳 On"
220
+ />
221
+ </div>
222
+
223
+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
224
+ <span>Bluetooth:</span>
225
+ <CustomToggle
226
+ value={settings.bluetooth}
227
+ onValueChange={(value) => updateSetting('bluetooth', value)}
228
+ offContent="Disconnected"
229
+ onContent="Connected"
230
+ />
231
+ </div>
232
+ </div>
233
+ );
234
+ }
235
+ ```
236
+
237
+ ### Controlled vs Uncontrolled
238
+
239
+ ```tsx
240
+ import { CustomToggle } from '@delightui/components';
241
+
242
+ function ControlledVsUncontrolledExample() {
243
+ const [controlledValue, setControlledValue] = useState(false);
244
+
245
+ return (
246
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
247
+ {/* Controlled */}
248
+ <div>
249
+ <h4>Controlled CustomToggle</h4>
250
+ <CustomToggle
251
+ value={controlledValue}
252
+ onValueChange={setControlledValue}
253
+ offContent="Controlled Off"
254
+ onContent="Controlled On"
255
+ />
256
+ </div>
257
+
258
+ {/* Uncontrolled with initial value */}
259
+ <div>
260
+ <h4>Uncontrolled CustomToggle</h4>
261
+ <CustomToggle
262
+ initialValue={true}
263
+ offContent="Uncontrolled Off"
264
+ onContent="Uncontrolled On"
265
+ />
266
+ </div>
267
+ </div>
268
+ );
269
+ }
270
+ ```
@@ -0,0 +1,365 @@
1
+ # Icon
2
+
3
+ ## Description
4
+
5
+ SVG icon component with dynamic imports that supports multiple icon styles and sizes. Provides a consistent way to display icons throughout the application with automatic SVG loading.
6
+
7
+ ## Aliases
8
+
9
+ - SVG Icon
10
+ - Vector Icon
11
+ - Glyph
12
+ - Symbol
13
+
14
+ ## Props Breakdown
15
+
16
+ **Extends:** Standalone interface (no HTML element inheritance)
17
+
18
+ | Prop | Type | Default | Required | Description |
19
+ |------|------|---------|----------|-------------|
20
+ | `icon` | `string` | - | Yes | Name of the icon to be displayed |
21
+ | `style` | `'Outlined' \| 'Filled' \| 'Round'` | `'Filled'` | No | Visual style variant of the icon |
22
+ | `size` | `'Small' \| 'Medium' \| 'Large'` | `'Medium'` | No | Size variant of the icon |
23
+ | `className` | `string` | - | No | Additional CSS class names |
24
+
25
+ ## How Icon Loading Works
26
+
27
+ The Icon component uses a dynamic SVG import system that combines the `icon` and `style` props to load the appropriate SVG file. Here's how the variant props work together:
28
+
29
+ ### File Naming Convention
30
+ The component constructs the SVG filename by concatenating the `icon` name with the `style` variant:
31
+ ```
32
+ {icon}{style}.svg
33
+ ```
34
+
35
+ **Examples:**
36
+ - `icon="Add"` + `style="Filled"` → loads `/icons/AddFilled.svg`
37
+ - `icon="Search"` + `style="Outlined"` → loads `/icons/SearchOutlined.svg`
38
+ - `icon="Close"` + `style="Round"` → loads `/icons/CloseRound.svg`
39
+
40
+ ### Dynamic Loading Process
41
+ 1. **Filename Construction**: Combines `icon` + `style` props (e.g., "AddFilled")
42
+ 2. **Cache Check**: First checks if the SVG is already cached in memory
43
+ 3. **Deduplication**: Prevents duplicate requests if the same icon is requested multiple times
44
+ 4. **Network Fetch**: Downloads the SVG from `/icons/{iconName}{style}.svg`
45
+ 5. **Caching**: Stores the SVG content in memory for future use
46
+ 6. **Rendering**: Injects the SVG content using `dangerouslySetInnerHTML`
47
+
48
+ ### Loading States
49
+ The component handles three states during the loading process:
50
+ - **Loading**: Shows an empty div with appropriate size classes
51
+ - **Error**: Shows an empty div if the SVG file cannot be loaded
52
+ - **Success**: Renders the SVG content within a properly sized container
53
+
54
+ ### Performance Optimizations
55
+ - **Memory Caching**: Downloaded SVGs are cached to avoid re-fetching
56
+ - **Request Deduplication**: Multiple components requesting the same icon share a single network request
57
+ - **Lazy Loading**: Icons are only loaded when the component is mounted and rendered
58
+
59
+ ### File Structure Requirements
60
+ For the Icon component to work properly, SVG files must be organized in the public directory:
61
+ ```
62
+ public/
63
+ icons/
64
+ AddFilled.svg
65
+ AddOutlined.svg
66
+ AddRound.svg
67
+ SearchFilled.svg
68
+ SearchOutlined.svg
69
+ SearchRound.svg
70
+ ...
71
+ ```
72
+
73
+ ## Examples
74
+
75
+ ### Basic Usage
76
+ ```tsx
77
+ import { Icon } from '@delightui/components';
78
+
79
+ function BasicExample() {
80
+ return (
81
+ <div className="icon-examples">
82
+ <Icon icon="Add" />
83
+ <Icon icon="Search" />
84
+ <Icon icon="Close" />
85
+ </div>
86
+ );
87
+ }
88
+ ```
89
+
90
+ ### Icon Styles
91
+ ```tsx
92
+ function StylesExample() {
93
+ return (
94
+ <div className="icon-styles">
95
+ <Icon icon="Add" style="Outlined" />
96
+ <Icon icon="Add" style="Filled" />
97
+ <Icon icon="Add" style="Round" />
98
+ </div>
99
+ );
100
+ }
101
+ ```
102
+
103
+ ### Icon Sizes
104
+ ```tsx
105
+ function SizesExample() {
106
+ return (
107
+ <div className="icon-sizes">
108
+ <Icon icon="Search" size="Small" />
109
+ <Icon icon="Search" size="Medium" />
110
+ <Icon icon="Search" size="Large" />
111
+ </div>
112
+ );
113
+ }
114
+ ```
115
+
116
+ ### Common Icons
117
+ ```tsx
118
+ function CommonIconsExample() {
119
+ const commonIcons = [
120
+ 'Add', 'Search', 'Close', 'Check', 'ArrowForward',
121
+ 'ExpandMore', 'Info', 'Error', 'Visibility', 'Edit'
122
+ ];
123
+
124
+ return (
125
+ <div className="common-icons">
126
+ {commonIcons.map(iconName => (
127
+ <div key={iconName} className="icon-item">
128
+ <Icon icon={iconName} />
129
+ <span>{iconName}</span>
130
+ </div>
131
+ ))}
132
+ </div>
133
+ );
134
+ }
135
+ ```
136
+
137
+ ### In Buttons
138
+ ```tsx
139
+ import { Icon, Button } from '@delightui/components';
140
+
141
+ function ButtonIconsExample() {
142
+ return (
143
+ <div className="button-icons">
144
+ <Button leadingIcon={<Icon icon="Add" />}>
145
+ Add Item
146
+ </Button>
147
+
148
+ <Button trailingIcon={<Icon icon="ArrowForward" />}>
149
+ Continue
150
+ </Button>
151
+
152
+ <Button
153
+ leadingIcon={<Icon icon="Search" />}
154
+ trailingIcon={<Icon icon="ExpandMore" />}
155
+ >
156
+ Search Options
157
+ </Button>
158
+ </div>
159
+ );
160
+ }
161
+ ```
162
+
163
+ ### Navigation Icons
164
+ ```tsx
165
+ import { NavLink, Text } from '@delightui/components';
166
+
167
+ function NavigationExample() {
168
+ const navigationItems = [
169
+ { icon: 'Home', label: 'Dashboard' },
170
+ { icon: 'Person', label: 'Profile' },
171
+ { icon: 'Settings', label: 'Settings' },
172
+ { icon: 'Notifications', label: 'Notifications' },
173
+ { icon: 'Help', label: 'Help' }
174
+ ];
175
+
176
+ return (
177
+ <nav className="navigation">
178
+ {navigationItems.map(item => (
179
+ <NavLink key={item.label} href="#" className="nav-item">
180
+ <Icon icon={item.icon} size="Medium" />
181
+ <Text>{item.label}</Text>
182
+ </NavLink>
183
+ ))}
184
+ </nav>
185
+ );
186
+ }
187
+ ```
188
+
189
+ ### Status Icons
190
+ ```tsx
191
+ import { Text } from '@delightui/components';
192
+
193
+ function StatusIconsExample() {
194
+ const statusItems = [
195
+ { status: 'success', icon: 'Check', color: 'green' },
196
+ { status: 'error', icon: 'Error', color: 'red' },
197
+ { status: 'warning', icon: 'Warning', color: 'orange' },
198
+ { status: 'info', icon: 'Info', color: 'blue' }
199
+ ];
200
+
201
+ return (
202
+ <div className="status-icons">
203
+ {statusItems.map(item => (
204
+ <div key={item.status} className={`status-item status-${item.status}`}>
205
+ <Icon
206
+ icon={item.icon}
207
+ style="Filled"
208
+ className={`icon-${item.color}`}
209
+ />
210
+ <Text>{item.status}</Text>
211
+ </div>
212
+ ))}
213
+ </div>
214
+ );
215
+ }
216
+ ```
217
+
218
+ ### Interactive Icons
219
+ ```tsx
220
+ import { Text } from '@delightui/components';
221
+
222
+ function InteractiveIconsExample() {
223
+ const [favorites, setFavorites] = useState([]);
224
+ const [visibility, setVisibility] = useState({});
225
+
226
+ const toggleFavorite = (itemId) => {
227
+ setFavorites(prev =>
228
+ prev.includes(itemId)
229
+ ? prev.filter(id => id !== itemId)
230
+ : [...prev, itemId]
231
+ );
232
+ };
233
+
234
+ const toggleVisibility = (itemId) => {
235
+ setVisibility(prev => ({
236
+ ...prev,
237
+ [itemId]: !prev[itemId]
238
+ }));
239
+ };
240
+
241
+ return (
242
+ <div className="interactive-icons">
243
+ <div className="item">
244
+ <Text>Favorite this item</Text>
245
+ <Icon
246
+ icon={favorites.includes(1) ? 'FavoriteFilled' : 'FavoriteOutlined'}
247
+ style={favorites.includes(1) ? 'Filled' : 'Outlined'}
248
+ className="clickable-icon"
249
+ onClick={() => toggleFavorite(1)}
250
+ />
251
+ </div>
252
+
253
+ <div className="item">
254
+ <Text>Toggle visibility</Text>
255
+ <Icon
256
+ icon={visibility[1] ? 'VisibilityOff' : 'Visibility'}
257
+ style="Filled"
258
+ className="clickable-icon"
259
+ onClick={() => toggleVisibility(1)}
260
+ />
261
+ </div>
262
+ </div>
263
+ );
264
+ }
265
+ ```
266
+
267
+ ### Form Field Icons
268
+ ```tsx
269
+ import { Icon, Input, FormField } from '@delightui/components';
270
+
271
+ function FormIconsExample() {
272
+ return (
273
+ <div className="form-icons">
274
+ <FormField name="email" label="Email">
275
+ <Input
276
+ inputType="Email"
277
+ leadingIcon={<Icon icon="Email" />}
278
+ placeholder="Enter your email"
279
+ />
280
+ </FormField>
281
+
282
+ <FormField name="password" label="Password">
283
+ <Input
284
+ inputType="Password"
285
+ leadingIcon={<Icon icon="Lock" />}
286
+ trailingIcon={<Icon icon="Visibility" />}
287
+ placeholder="Enter password"
288
+ />
289
+ </FormField>
290
+
291
+ <FormField name="search" label="Search">
292
+ <Input
293
+ leadingIcon={<Icon icon="Search" />}
294
+ trailingIcon={<Icon icon="Close" />}
295
+ placeholder="Search..."
296
+ />
297
+ </FormField>
298
+ </div>
299
+ );
300
+ }
301
+ ```
302
+
303
+ ### Icon Grid
304
+ ```tsx
305
+ import { Text } from '@delightui/components';
306
+
307
+ function IconGridExample() {
308
+ const allIcons = [
309
+ { name: 'Add', styles: ['Outlined', 'Filled', 'Round'] },
310
+ { name: 'Search', styles: ['Outlined', 'Filled', 'Round'] },
311
+ { name: 'Close', styles: ['Outlined', 'Filled', 'Round'] },
312
+ { name: 'Check', styles: ['Outlined', 'Filled', 'Round'] },
313
+ { name: 'ArrowForward', styles: ['Outlined', 'Filled', 'Round'] }
314
+ ];
315
+
316
+ return (
317
+ <div className="icon-grid">
318
+ {allIcons.map(iconGroup => (
319
+ <div key={iconGroup.name} className="icon-group">
320
+ <Text type="Heading4">{iconGroup.name}</Text>
321
+ <div className="icon-variants">
322
+ {iconGroup.styles.map(style => (
323
+ <div key={style} className="icon-variant">
324
+ <Icon
325
+ icon={iconGroup.name}
326
+ style={style}
327
+ size="Large"
328
+ />
329
+ <Text type="BodySmall">{style}</Text>
330
+ </div>
331
+ ))}
332
+ </div>
333
+ </div>
334
+ ))}
335
+ </div>
336
+ );
337
+ }
338
+ ```
339
+
340
+ ### Custom Styling
341
+ ```tsx
342
+ function CustomStylingExample() {
343
+ return (
344
+ <div className="custom-icon-styling">
345
+ <Icon
346
+ icon="Star"
347
+ className="icon-primary"
348
+ size="Large"
349
+ />
350
+
351
+ <Icon
352
+ icon="Heart"
353
+ className="icon-danger animated-icon"
354
+ size="Medium"
355
+ />
356
+
357
+ <Icon
358
+ icon="Thumb_up"
359
+ className="icon-success rotating-icon"
360
+ size="Small"
361
+ />
362
+ </div>
363
+ );
364
+ }
365
+ ```