@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.
- package/README.md +104 -1
- package/dist/cjs/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/cjs/components/molecules/Modal/index.d.ts +2 -0
- package/dist/cjs/components/molecules/index.d.ts +2 -0
- package/dist/cjs/library.css +19 -6
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Modal/DemoModal.d.ts +8 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.d.ts +41 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +87 -0
- package/dist/esm/components/molecules/Modal/ModalContext/index.d.ts +3 -0
- package/dist/esm/components/molecules/Modal/ModalContext/useModal.d.ts +34 -0
- package/dist/esm/components/molecules/Modal/index.d.ts +2 -0
- package/dist/esm/components/molecules/index.d.ts +2 -0
- package/dist/esm/library.css +19 -6
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +108 -2
- package/docs/README.md +264 -0
- package/docs/components/atoms/ActionImage.md +119 -0
- package/docs/components/atoms/Button.md +197 -0
- package/docs/components/atoms/Checkbox.md +299 -0
- package/docs/components/atoms/CheckboxItem.md +314 -0
- package/docs/components/atoms/Chip.md +380 -0
- package/docs/components/atoms/CustomToggle.md +270 -0
- package/docs/components/atoms/Icon.md +365 -0
- package/docs/components/atoms/IconButton.md +407 -0
- package/docs/components/atoms/Image.md +448 -0
- package/docs/components/atoms/Input.md +430 -0
- package/docs/components/atoms/ListItem.md +502 -0
- package/docs/components/atoms/Password.md +472 -0
- package/docs/components/atoms/RadioButton.md +614 -0
- package/docs/components/atoms/RadioButtonItem.md +588 -0
- package/docs/components/atoms/ResponsiveComponent.md +612 -0
- package/docs/components/atoms/SelectListItem.md +609 -0
- package/docs/components/atoms/Slider.md +605 -0
- package/docs/components/atoms/Spinner.md +605 -0
- package/docs/components/atoms/Text.md +463 -0
- package/docs/components/atoms/TextArea.md +670 -0
- package/docs/components/atoms/ToastNotification.md +668 -0
- package/docs/components/atoms/Toggle.md +737 -0
- package/docs/components/atoms/ToggleButton.md +751 -0
- package/docs/components/atoms/Tooltip.md +391 -0
- package/docs/components/molecules/Accordion.md +440 -0
- package/docs/components/molecules/AccordionGroup.md +547 -0
- package/docs/components/molecules/ActionCard.md +546 -0
- package/docs/components/molecules/Breadcrumb.md +403 -0
- package/docs/components/molecules/Breadcrumbs.md +485 -0
- package/docs/components/molecules/ButtonGroup.md +383 -0
- package/docs/components/molecules/Card.md +298 -0
- package/docs/components/molecules/ChipInput.md +646 -0
- package/docs/components/molecules/ContextMenu.md +768 -0
- package/docs/components/molecules/CustomTimeSelector.md +116 -0
- package/docs/components/molecules/DatePicker.md +516 -0
- package/docs/components/molecules/DateTimeSelector.md +166 -0
- package/docs/components/molecules/FormField.md +312 -0
- package/docs/components/molecules/Grid.md +577 -0
- package/docs/components/molecules/GridItem.md +834 -0
- package/docs/components/molecules/GridList.md +244 -0
- package/docs/components/molecules/List.md +485 -0
- package/docs/components/molecules/Modal.md +470 -0
- package/docs/components/molecules/ModalFooter.md +702 -0
- package/docs/components/molecules/ModalHeader.md +756 -0
- package/docs/components/molecules/ModalProvider.md +205 -0
- package/docs/components/molecules/Nav.md +530 -0
- package/docs/components/molecules/NavItem.md +572 -0
- package/docs/components/molecules/NavLink.md +499 -0
- package/docs/components/molecules/Option.md +521 -0
- package/docs/components/molecules/Pagination.md +592 -0
- package/docs/components/molecules/PaginationNumberField.md +722 -0
- package/docs/components/molecules/Popover.md +516 -0
- package/docs/components/molecules/ProgressBar.md +624 -0
- package/docs/components/molecules/RadioGroup.md +831 -0
- package/docs/components/molecules/RepeaterList.md +185 -0
- package/docs/components/molecules/Select.md +402 -0
- package/docs/components/molecules/SortableTrigger.md +82 -0
- package/docs/components/molecules/useModal.md +379 -0
- package/docs/components/organisms/Dropzone.md +346 -0
- package/docs/components/organisms/DropzoneClear.md +135 -0
- package/docs/components/organisms/DropzoneContent.md +216 -0
- package/docs/components/organisms/DropzoneFilename.md +191 -0
- package/docs/components/organisms/DropzoneSupportedFormats.md +184 -0
- package/docs/components/organisms/DropzoneTrigger.md +209 -0
- package/docs/components/organisms/Form.md +533 -0
- package/docs/components/organisms/SlideOutPanel.md +662 -0
- package/docs/components/organisms/TabContent.md +902 -0
- package/docs/components/organisms/TabItem.md +1091 -0
- package/docs/components/organisms/Table.md +611 -0
- package/docs/components/organisms/TableBody.md +679 -0
- package/docs/components/organisms/TableCell.md +482 -0
- package/docs/components/organisms/TableHeader.md +513 -0
- package/docs/components/organisms/TableHeaderCell.md +661 -0
- package/docs/components/organisms/TableRow.md +715 -0
- package/docs/components/organisms/Tabs.md +1330 -0
- package/docs/components/utils/ConditionalView.md +568 -0
- package/docs/components/utils/RenderStateView.md +726 -0
- package/docs/components/utils/WrapTextNodes.md +614 -0
- package/package.json +3 -2
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# CheckboxItem
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Enhanced checkbox component with integrated label styling and an optional right-side action button. Extends the base Checkbox functionality with additional interactive elements for more complex use cases.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- Checkbox List Item
|
|
10
|
+
- Enhanced Checkbox
|
|
11
|
+
- Action Checkbox
|
|
12
|
+
- Checkbox with Button
|
|
13
|
+
|
|
14
|
+
## Props Breakdown
|
|
15
|
+
|
|
16
|
+
Inherits all props from [Checkbox](./Checkbox.md) plus:
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Required | Description |
|
|
19
|
+
|------|------|---------|----------|-------------|
|
|
20
|
+
| `showRightButton` | `boolean` | `false` | No | Whether to show an action button on the right side |
|
|
21
|
+
| `onRightButtonClick` | `() => void` | - | No | Callback function when the right button is clicked |
|
|
22
|
+
| `rightButtonIcon` | `ReactNode` | - | No | Custom icon for the right button |
|
|
23
|
+
|
|
24
|
+
### Inherited Props from Checkbox
|
|
25
|
+
- `children` - Label content for the checkbox
|
|
26
|
+
- `size` - Size variant ('Small', 'Medium', 'Large')
|
|
27
|
+
- `type` - Visual theme ('Default', 'Inverse')
|
|
28
|
+
- `checked`/`value` - Controlled state
|
|
29
|
+
- `onValueChange` - Change handler
|
|
30
|
+
- `disabled` - Disabled state
|
|
31
|
+
- `required` - Required field
|
|
32
|
+
- `invalid` - Invalid state
|
|
33
|
+
- All standard HTML input attributes
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Basic Usage
|
|
38
|
+
```tsx
|
|
39
|
+
import { CheckboxItem } from '@delightui/components';
|
|
40
|
+
|
|
41
|
+
function BasicExample() {
|
|
42
|
+
const [checked, setChecked] = useState(false);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<CheckboxItem
|
|
46
|
+
checked={checked}
|
|
47
|
+
onValueChange={setChecked}
|
|
48
|
+
>
|
|
49
|
+
Enable notifications
|
|
50
|
+
</CheckboxItem>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### With Right Action Button
|
|
56
|
+
```tsx
|
|
57
|
+
import { CogIcon } from '@heroicons/react/24/outline';
|
|
58
|
+
|
|
59
|
+
function ActionButtonExample() {
|
|
60
|
+
const [checked, setChecked] = useState(false);
|
|
61
|
+
|
|
62
|
+
const handleSettings = () => {
|
|
63
|
+
console.log('Opening notification settings');
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<CheckboxItem
|
|
68
|
+
checked={checked}
|
|
69
|
+
onValueChange={setChecked}
|
|
70
|
+
showRightButton={true}
|
|
71
|
+
onRightButtonClick={handleSettings}
|
|
72
|
+
rightButtonIcon={<CogIcon />}
|
|
73
|
+
>
|
|
74
|
+
Email notifications
|
|
75
|
+
</CheckboxItem>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Settings List
|
|
81
|
+
```tsx
|
|
82
|
+
import { CogIcon, InfoIcon, BellIcon } from '@heroicons/react/24/outline';
|
|
83
|
+
|
|
84
|
+
function SettingsListExample() {
|
|
85
|
+
const [settings, setSettings] = useState({
|
|
86
|
+
notifications: true,
|
|
87
|
+
marketing: false,
|
|
88
|
+
updates: true
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const updateSetting = (key, value) => {
|
|
92
|
+
setSettings(prev => ({ ...prev, [key]: value }));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const openSettingsDetail = (settingKey) => {
|
|
96
|
+
console.log(`Opening ${settingKey} settings`);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className="settings-list">
|
|
101
|
+
<CheckboxItem
|
|
102
|
+
checked={settings.notifications}
|
|
103
|
+
onValueChange={(value) => updateSetting('notifications', value)}
|
|
104
|
+
showRightButton={true}
|
|
105
|
+
onRightButtonClick={() => openSettingsDetail('notifications')}
|
|
106
|
+
rightButtonIcon={<CogIcon />}
|
|
107
|
+
>
|
|
108
|
+
Push Notifications
|
|
109
|
+
</CheckboxItem>
|
|
110
|
+
|
|
111
|
+
<CheckboxItem
|
|
112
|
+
checked={settings.marketing}
|
|
113
|
+
onValueChange={(value) => updateSetting('marketing', value)}
|
|
114
|
+
showRightButton={true}
|
|
115
|
+
onRightButtonClick={() => openSettingsDetail('marketing')}
|
|
116
|
+
rightButtonIcon={<InfoIcon />}
|
|
117
|
+
>
|
|
118
|
+
Marketing Communications
|
|
119
|
+
</CheckboxItem>
|
|
120
|
+
|
|
121
|
+
<CheckboxItem
|
|
122
|
+
checked={settings.updates}
|
|
123
|
+
onValueChange={(value) => updateSetting('updates', value)}
|
|
124
|
+
showRightButton={true}
|
|
125
|
+
onRightButtonClick={() => openSettingsDetail('updates')}
|
|
126
|
+
rightButtonIcon={<BellIcon />}
|
|
127
|
+
>
|
|
128
|
+
Product Updates
|
|
129
|
+
</CheckboxItem>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Different Sizes
|
|
136
|
+
```tsx
|
|
137
|
+
function SizesExample() {
|
|
138
|
+
return (
|
|
139
|
+
<div className="checkbox-item-sizes">
|
|
140
|
+
<CheckboxItem
|
|
141
|
+
size="Small"
|
|
142
|
+
showRightButton={true}
|
|
143
|
+
rightButtonIcon={<CogIcon />}
|
|
144
|
+
>
|
|
145
|
+
Small checkbox item
|
|
146
|
+
</CheckboxItem>
|
|
147
|
+
|
|
148
|
+
<CheckboxItem
|
|
149
|
+
size="Medium"
|
|
150
|
+
showRightButton={true}
|
|
151
|
+
rightButtonIcon={<CogIcon />}
|
|
152
|
+
>
|
|
153
|
+
Medium checkbox item
|
|
154
|
+
</CheckboxItem>
|
|
155
|
+
|
|
156
|
+
<CheckboxItem
|
|
157
|
+
size="Large"
|
|
158
|
+
showRightButton={true}
|
|
159
|
+
rightButtonIcon={<CogIcon />}
|
|
160
|
+
>
|
|
161
|
+
Large checkbox item
|
|
162
|
+
</CheckboxItem>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Form Integration
|
|
169
|
+
```tsx
|
|
170
|
+
import { CheckboxItem, Form, FormField, Button } from '@delightui/components';
|
|
171
|
+
|
|
172
|
+
function FormExample() {
|
|
173
|
+
const handleSubmit = (values, setError) => {
|
|
174
|
+
console.log('Form submitted:', values);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const openPrivacySettings = () => {
|
|
178
|
+
console.log('Opening privacy settings');
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Form onSubmit={handleSubmit}>
|
|
183
|
+
<FormField name="terms" required>
|
|
184
|
+
<CheckboxItem>
|
|
185
|
+
I accept the terms and conditions
|
|
186
|
+
</CheckboxItem>
|
|
187
|
+
</FormField>
|
|
188
|
+
|
|
189
|
+
<FormField name="privacy">
|
|
190
|
+
<CheckboxItem
|
|
191
|
+
showRightButton={true}
|
|
192
|
+
onRightButtonClick={openPrivacySettings}
|
|
193
|
+
rightButtonIcon={<CogIcon />}
|
|
194
|
+
>
|
|
195
|
+
Configure privacy settings
|
|
196
|
+
</CheckboxItem>
|
|
197
|
+
</FormField>
|
|
198
|
+
|
|
199
|
+
<FormField name="newsletter">
|
|
200
|
+
<CheckboxItem>
|
|
201
|
+
Subscribe to newsletter
|
|
202
|
+
</CheckboxItem>
|
|
203
|
+
</FormField>
|
|
204
|
+
|
|
205
|
+
<Button actionType="submit">
|
|
206
|
+
Create Account
|
|
207
|
+
</Button>
|
|
208
|
+
</Form>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Permission Management
|
|
214
|
+
```tsx
|
|
215
|
+
import {
|
|
216
|
+
EyeIcon,
|
|
217
|
+
PencilIcon,
|
|
218
|
+
TrashIcon,
|
|
219
|
+
CogIcon
|
|
220
|
+
} from '@heroicons/react/24/outline';
|
|
221
|
+
|
|
222
|
+
function PermissionExample() {
|
|
223
|
+
const [permissions, setPermissions] = useState({
|
|
224
|
+
read: true,
|
|
225
|
+
write: false,
|
|
226
|
+
delete: false,
|
|
227
|
+
admin: false
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const updatePermission = (key, value) => {
|
|
231
|
+
setPermissions(prev => ({ ...prev, [key]: value }));
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const configurePermission = (permissionType) => {
|
|
235
|
+
console.log(`Configuring ${permissionType} permission`);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<div className="permission-manager">
|
|
240
|
+
<h3>User Permissions</h3>
|
|
241
|
+
|
|
242
|
+
<CheckboxItem
|
|
243
|
+
checked={permissions.read}
|
|
244
|
+
onValueChange={(value) => updatePermission('read', value)}
|
|
245
|
+
showRightButton={true}
|
|
246
|
+
onRightButtonClick={() => configurePermission('read')}
|
|
247
|
+
rightButtonIcon={<EyeIcon />}
|
|
248
|
+
>
|
|
249
|
+
Read Access
|
|
250
|
+
</CheckboxItem>
|
|
251
|
+
|
|
252
|
+
<CheckboxItem
|
|
253
|
+
checked={permissions.write}
|
|
254
|
+
onValueChange={(value) => updatePermission('write', value)}
|
|
255
|
+
showRightButton={true}
|
|
256
|
+
onRightButtonClick={() => configurePermission('write')}
|
|
257
|
+
rightButtonIcon={<PencilIcon />}
|
|
258
|
+
>
|
|
259
|
+
Write Access
|
|
260
|
+
</CheckboxItem>
|
|
261
|
+
|
|
262
|
+
<CheckboxItem
|
|
263
|
+
checked={permissions.delete}
|
|
264
|
+
onValueChange={(value) => updatePermission('delete', value)}
|
|
265
|
+
showRightButton={true}
|
|
266
|
+
onRightButtonClick={() => configurePermission('delete')}
|
|
267
|
+
rightButtonIcon={<TrashIcon />}
|
|
268
|
+
invalid={permissions.delete && !permissions.write}
|
|
269
|
+
>
|
|
270
|
+
Delete Access
|
|
271
|
+
</CheckboxItem>
|
|
272
|
+
|
|
273
|
+
<CheckboxItem
|
|
274
|
+
checked={permissions.admin}
|
|
275
|
+
onValueChange={(value) => updatePermission('admin', value)}
|
|
276
|
+
showRightButton={true}
|
|
277
|
+
onRightButtonClick={() => configurePermission('admin')}
|
|
278
|
+
rightButtonIcon={<CogIcon />}
|
|
279
|
+
disabled={!permissions.read || !permissions.write}
|
|
280
|
+
>
|
|
281
|
+
Admin Access
|
|
282
|
+
</CheckboxItem>
|
|
283
|
+
</div>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Disabled States
|
|
289
|
+
```tsx
|
|
290
|
+
function DisabledStatesExample() {
|
|
291
|
+
return (
|
|
292
|
+
<div className="disabled-states">
|
|
293
|
+
<CheckboxItem disabled>
|
|
294
|
+
Disabled without button
|
|
295
|
+
</CheckboxItem>
|
|
296
|
+
|
|
297
|
+
<CheckboxItem
|
|
298
|
+
disabled
|
|
299
|
+
checked={true}
|
|
300
|
+
>
|
|
301
|
+
Disabled and checked
|
|
302
|
+
</CheckboxItem>
|
|
303
|
+
|
|
304
|
+
<CheckboxItem
|
|
305
|
+
disabled
|
|
306
|
+
showRightButton={true}
|
|
307
|
+
rightButtonIcon={<CogIcon />}
|
|
308
|
+
>
|
|
309
|
+
Disabled with button
|
|
310
|
+
</CheckboxItem>
|
|
311
|
+
</div>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
```
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
# Chip
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Small, compact elements used for tags, filters, categories, and interactive selections. Supports multiple visual styles, sizes, icons, and dismissible functionality for versatile use cases.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- Tag
|
|
10
|
+
- Badge
|
|
11
|
+
- Label
|
|
12
|
+
- Token
|
|
13
|
+
- Filter Chip
|
|
14
|
+
|
|
15
|
+
## Props Breakdown
|
|
16
|
+
|
|
17
|
+
**Extends:** `HTMLAttributes<HTMLDivElement>` (excluding `style`)
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Required | Description |
|
|
20
|
+
|------|------|---------|----------|-------------|
|
|
21
|
+
| `type` | `'Bright' \| 'BrightOutline' \| 'Subdued' \| 'SubduedOutline'` | `'Bright'` | No | Visual style variant of the chip |
|
|
22
|
+
| `style` | `'A' \| 'B' \| 'C' \| 'D' \| 'E' \| 'F'` | `'A'` | No | Color scheme of the chip |
|
|
23
|
+
| `size` | `'Small' \| 'Medium' \| 'Large'` | `'Medium'` | No | Size variant of the chip |
|
|
24
|
+
| `corner` | `'Rounded' \| 'Squared'` | `'Rounded'` | No | Corner style of the chip |
|
|
25
|
+
| `isDisabled` | `boolean` | `false` | No | Whether the chip is disabled |
|
|
26
|
+
| `isDismissible` | `boolean` | `false` | No | Whether the chip can be dismissed/removed |
|
|
27
|
+
| `leadingIcon` | `ReactNode` | - | No | Icon displayed before the chip content |
|
|
28
|
+
| `trailingIcon` | `ReactNode` | - | No | Icon displayed after the chip content |
|
|
29
|
+
| `closeIcon` | `ReactNode` | - | No | Custom close icon for dismissible chips |
|
|
30
|
+
| `onClick` | `(event?: MouseEvent<HTMLDivElement>) => void` | - | No | Click event handler |
|
|
31
|
+
| `onClose` | `(event?: MouseEvent<HTMLElement>) => void` | - | No | Close event handler for dismissible chips |
|
|
32
|
+
| `className` | `string` | - | No | Additional CSS class names |
|
|
33
|
+
| `children` | `ReactNode` | - | No | Content of the chip |
|
|
34
|
+
|
|
35
|
+
Plus all standard HTML div attributes (id, role, aria-*, data-*, etc.) except `style`.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### Basic Usage
|
|
40
|
+
```tsx
|
|
41
|
+
import { Chip } from '@delightui/components';
|
|
42
|
+
|
|
43
|
+
function BasicExample() {
|
|
44
|
+
return (
|
|
45
|
+
<div className="chip-examples">
|
|
46
|
+
<Chip>JavaScript</Chip>
|
|
47
|
+
<Chip>React</Chip>
|
|
48
|
+
<Chip>TypeScript</Chip>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Chip Types
|
|
55
|
+
```tsx
|
|
56
|
+
function TypesExample() {
|
|
57
|
+
return (
|
|
58
|
+
<div className="chip-types">
|
|
59
|
+
<Chip type="Bright">Bright</Chip>
|
|
60
|
+
<Chip type="BrightOutline">Bright Outline</Chip>
|
|
61
|
+
<Chip type="Subdued">Subdued</Chip>
|
|
62
|
+
<Chip type="SubduedOutline">Subdued Outline</Chip>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Chip Styles (Colors)
|
|
69
|
+
```tsx
|
|
70
|
+
function StylesExample() {
|
|
71
|
+
return (
|
|
72
|
+
<div className="chip-styles">
|
|
73
|
+
<Chip style="A">Style A</Chip>
|
|
74
|
+
<Chip style="B">Style B</Chip>
|
|
75
|
+
<Chip style="C">Style C</Chip>
|
|
76
|
+
<Chip style="D">Style D</Chip>
|
|
77
|
+
<Chip style="E">Style E</Chip>
|
|
78
|
+
<Chip style="F">Style F</Chip>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Chip Sizes
|
|
85
|
+
```tsx
|
|
86
|
+
function SizesExample() {
|
|
87
|
+
return (
|
|
88
|
+
<div className="chip-sizes">
|
|
89
|
+
<Chip size="Small">Small</Chip>
|
|
90
|
+
<Chip size="Medium">Medium</Chip>
|
|
91
|
+
<Chip size="Large">Large</Chip>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Corner Styles
|
|
98
|
+
```tsx
|
|
99
|
+
function CornersExample() {
|
|
100
|
+
return (
|
|
101
|
+
<div className="chip-corners">
|
|
102
|
+
<Chip corner="Rounded">Rounded</Chip>
|
|
103
|
+
<Chip corner="Squared">Squared</Chip>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### With Icons
|
|
110
|
+
```tsx
|
|
111
|
+
import {
|
|
112
|
+
TagIcon,
|
|
113
|
+
UserIcon,
|
|
114
|
+
CalendarIcon,
|
|
115
|
+
HeartIcon
|
|
116
|
+
} from '@heroicons/react/24/outline';
|
|
117
|
+
|
|
118
|
+
function IconsExample() {
|
|
119
|
+
return (
|
|
120
|
+
<div className="chip-icons">
|
|
121
|
+
<Chip leadingIcon={<TagIcon />}>
|
|
122
|
+
Category
|
|
123
|
+
</Chip>
|
|
124
|
+
|
|
125
|
+
<Chip trailingIcon={<UserIcon />}>
|
|
126
|
+
User
|
|
127
|
+
</Chip>
|
|
128
|
+
|
|
129
|
+
<Chip
|
|
130
|
+
leadingIcon={<CalendarIcon />}
|
|
131
|
+
trailingIcon={<HeartIcon />}
|
|
132
|
+
>
|
|
133
|
+
Event
|
|
134
|
+
</Chip>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Dismissible Chips
|
|
141
|
+
```tsx
|
|
142
|
+
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
143
|
+
|
|
144
|
+
function DismissibleExample() {
|
|
145
|
+
const [tags, setTags] = useState([
|
|
146
|
+
{ id: 1, label: 'React' },
|
|
147
|
+
{ id: 2, label: 'JavaScript' },
|
|
148
|
+
{ id: 3, label: 'TypeScript' },
|
|
149
|
+
{ id: 4, label: 'CSS' }
|
|
150
|
+
]);
|
|
151
|
+
|
|
152
|
+
const removeTag = (tagId) => {
|
|
153
|
+
setTags(tags.filter(tag => tag.id !== tagId));
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div className="dismissible-chips">
|
|
158
|
+
{tags.map(tag => (
|
|
159
|
+
<Chip
|
|
160
|
+
key={tag.id}
|
|
161
|
+
isDismissible={true}
|
|
162
|
+
onClose={() => removeTag(tag.id)}
|
|
163
|
+
closeIcon={<XMarkIcon />}
|
|
164
|
+
>
|
|
165
|
+
{tag.label}
|
|
166
|
+
</Chip>
|
|
167
|
+
))}
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Interactive Filter Chips
|
|
174
|
+
```tsx
|
|
175
|
+
function FilterChipsExample() {
|
|
176
|
+
const [selectedFilters, setSelectedFilters] = useState(['all']);
|
|
177
|
+
|
|
178
|
+
const filters = [
|
|
179
|
+
{ id: 'all', label: 'All Items' },
|
|
180
|
+
{ id: 'active', label: 'Active' },
|
|
181
|
+
{ id: 'completed', label: 'Completed' },
|
|
182
|
+
{ id: 'pending', label: 'Pending' }
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
const toggleFilter = (filterId) => {
|
|
186
|
+
if (filterId === 'all') {
|
|
187
|
+
setSelectedFilters(['all']);
|
|
188
|
+
} else {
|
|
189
|
+
setSelectedFilters(prev => {
|
|
190
|
+
const newFilters = prev.filter(f => f !== 'all');
|
|
191
|
+
return prev.includes(filterId)
|
|
192
|
+
? newFilters.filter(f => f !== filterId)
|
|
193
|
+
: [...newFilters, filterId];
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div className="filter-chips">
|
|
200
|
+
{filters.map(filter => (
|
|
201
|
+
<Chip
|
|
202
|
+
key={filter.id}
|
|
203
|
+
type={selectedFilters.includes(filter.id) ? 'Bright' : 'SubduedOutline'}
|
|
204
|
+
onClick={() => toggleFilter(filter.id)}
|
|
205
|
+
style={selectedFilters.includes(filter.id) ? 'A' : 'B'}
|
|
206
|
+
>
|
|
207
|
+
{filter.label}
|
|
208
|
+
</Chip>
|
|
209
|
+
))}
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Status Chips
|
|
216
|
+
```tsx
|
|
217
|
+
import {
|
|
218
|
+
CheckCircleIcon,
|
|
219
|
+
ExclamationCircleIcon,
|
|
220
|
+
ClockIcon,
|
|
221
|
+
XCircleIcon
|
|
222
|
+
} from '@heroicons/react/24/solid';
|
|
223
|
+
|
|
224
|
+
function StatusChipsExample() {
|
|
225
|
+
const statusItems = [
|
|
226
|
+
{
|
|
227
|
+
status: 'success',
|
|
228
|
+
label: 'Completed',
|
|
229
|
+
icon: <CheckCircleIcon />,
|
|
230
|
+
style: 'C'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
status: 'warning',
|
|
234
|
+
label: 'Pending',
|
|
235
|
+
icon: <ClockIcon />,
|
|
236
|
+
style: 'E'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
status: 'error',
|
|
240
|
+
label: 'Failed',
|
|
241
|
+
icon: <XCircleIcon />,
|
|
242
|
+
style: 'D'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
status: 'info',
|
|
246
|
+
label: 'In Progress',
|
|
247
|
+
icon: <ExclamationCircleIcon />,
|
|
248
|
+
style: 'B'
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<div className="status-chips">
|
|
254
|
+
{statusItems.map(item => (
|
|
255
|
+
<Chip
|
|
256
|
+
key={item.status}
|
|
257
|
+
leadingIcon={item.icon}
|
|
258
|
+
style={item.style}
|
|
259
|
+
type="Bright"
|
|
260
|
+
>
|
|
261
|
+
{item.label}
|
|
262
|
+
</Chip>
|
|
263
|
+
))}
|
|
264
|
+
</div>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Tag Input System
|
|
270
|
+
```tsx
|
|
271
|
+
import { Input, Button } from '@delightui/components';
|
|
272
|
+
|
|
273
|
+
function TagInputExample() {
|
|
274
|
+
const [tags, setTags] = useState(['React', 'JavaScript']);
|
|
275
|
+
const [inputValue, setInputValue] = useState('');
|
|
276
|
+
|
|
277
|
+
const addTag = () => {
|
|
278
|
+
if (inputValue.trim() && !tags.includes(inputValue.trim())) {
|
|
279
|
+
setTags([...tags, inputValue.trim()]);
|
|
280
|
+
setInputValue('');
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const removeTag = (tagToRemove) => {
|
|
285
|
+
setTags(tags.filter(tag => tag !== tagToRemove));
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const handleKeyPress = (e) => {
|
|
289
|
+
if (e.key === 'Enter') {
|
|
290
|
+
addTag();
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
return (
|
|
295
|
+
<div className="tag-input-system">
|
|
296
|
+
<div className="tags-container">
|
|
297
|
+
{tags.map(tag => (
|
|
298
|
+
<Chip
|
|
299
|
+
key={tag}
|
|
300
|
+
isDismissible={true}
|
|
301
|
+
onClose={() => removeTag(tag)}
|
|
302
|
+
type="BrightOutline"
|
|
303
|
+
style="A"
|
|
304
|
+
>
|
|
305
|
+
{tag}
|
|
306
|
+
</Chip>
|
|
307
|
+
))}
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div className="tag-input">
|
|
311
|
+
<Input
|
|
312
|
+
value={inputValue}
|
|
313
|
+
onValueChange={setInputValue}
|
|
314
|
+
onKeyPress={handleKeyPress}
|
|
315
|
+
placeholder="Add a tag..."
|
|
316
|
+
/>
|
|
317
|
+
<Button onClick={addTag}>Add</Button>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Disabled States
|
|
325
|
+
```tsx
|
|
326
|
+
function DisabledExample() {
|
|
327
|
+
return (
|
|
328
|
+
<div className="disabled-chips">
|
|
329
|
+
<Chip isDisabled>Disabled Chip</Chip>
|
|
330
|
+
|
|
331
|
+
<Chip
|
|
332
|
+
isDisabled
|
|
333
|
+
leadingIcon={<TagIcon />}
|
|
334
|
+
>
|
|
335
|
+
Disabled with Icon
|
|
336
|
+
</Chip>
|
|
337
|
+
|
|
338
|
+
<Chip
|
|
339
|
+
isDisabled
|
|
340
|
+
isDismissible={true}
|
|
341
|
+
>
|
|
342
|
+
Disabled Dismissible
|
|
343
|
+
</Chip>
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Complex Combination
|
|
350
|
+
```tsx
|
|
351
|
+
function ComplexExample() {
|
|
352
|
+
return (
|
|
353
|
+
<div className="complex-chips">
|
|
354
|
+
<Chip
|
|
355
|
+
type="Bright"
|
|
356
|
+
style="A"
|
|
357
|
+
size="Large"
|
|
358
|
+
corner="Rounded"
|
|
359
|
+
leadingIcon={<UserIcon />}
|
|
360
|
+
trailingIcon={<HeartIcon />}
|
|
361
|
+
onClick={() => console.log('Chip clicked')}
|
|
362
|
+
>
|
|
363
|
+
Featured User
|
|
364
|
+
</Chip>
|
|
365
|
+
|
|
366
|
+
<Chip
|
|
367
|
+
type="SubduedOutline"
|
|
368
|
+
style="D"
|
|
369
|
+
size="Small"
|
|
370
|
+
corner="Squared"
|
|
371
|
+
isDismissible={true}
|
|
372
|
+
onClose={() => console.log('Chip dismissed')}
|
|
373
|
+
leadingIcon={<TagIcon />}
|
|
374
|
+
>
|
|
375
|
+
Remove Me
|
|
376
|
+
</Chip>
|
|
377
|
+
</div>
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
```
|