@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,197 @@
1
+ # Button
2
+
3
+ ## Description
4
+
5
+ Flexible button component with multiple variants, sizes, and states. Supports icons, loading states, and various styling options to fit different use cases throughout the application.
6
+
7
+ ## Aliases
8
+
9
+ - Action Button
10
+ - CTA (Call to Action)
11
+ - Click Button
12
+ - Submit Button
13
+
14
+ ## Props Breakdown
15
+
16
+ **Extends:** `HTMLAttributes<HTMLButtonElement>` (excluding `style`)
17
+
18
+ | Prop | Type | Default | Required | Description |
19
+ |------|------|---------|----------|-------------|
20
+ | `appearance` | `'Default' \| 'Inverse'` | `'Default'` | No | Visual appearance theme of the button |
21
+ | `type` | `'Filled' \| 'Outlined' \| 'Ghost'` | `'Filled'` | No | Visual style variant of the button |
22
+ | `style` | `'Primary' \| 'Secondary' \| 'Destructive'` | `'Primary'` | No | Color scheme and intent of the button |
23
+ | `size` | `'Small' \| 'Medium' \| 'Large'` | `'Medium'` | No | Size variant of the button |
24
+ | `loading` | `boolean` | `false` | No | Shows loading spinner and disables interaction |
25
+ | `disabled` | `boolean` | `false` | No | Disables the button and shows disabled state |
26
+ | `leadingIcon` | `ReactNode` | - | No | Icon to display before the button text |
27
+ | `trailingIcon` | `ReactNode` | - | No | Icon to display after the button text |
28
+ | `onClick` | `(event?: MouseEvent<HTMLElement>) => void` | - | No | Click event handler |
29
+ | `className` | `string` | - | No | Additional CSS class names |
30
+ | `actionType` | `'button' \| 'submit' \| 'reset'` | `'button'` | No | HTML button type attribute |
31
+ | `children` | `ReactNode` | - | No | Button content/text |
32
+
33
+ Plus all standard HTML button attributes (id, title, aria-*, data-*, etc.).
34
+
35
+ ## Examples
36
+
37
+ ### Basic Usage
38
+ ```tsx
39
+ import { Button } from '@delightui/components';
40
+
41
+ function BasicExample() {
42
+ return (
43
+ <Button onClick={() => console.log('Clicked')}>
44
+ Click Me
45
+ </Button>
46
+ );
47
+ }
48
+ ```
49
+
50
+ ### Button Variants
51
+ ```tsx
52
+ function VariantsExample() {
53
+ return (
54
+ <div className="button-group">
55
+ {/* Different types */}
56
+ <Button type="Filled">Filled Button</Button>
57
+ <Button type="Outlined">Outlined Button</Button>
58
+ <Button type="Ghost">Ghost Button</Button>
59
+
60
+ {/* Different styles */}
61
+ <Button style="Primary">Primary</Button>
62
+ <Button style="Secondary">Secondary</Button>
63
+ <Button style="Destructive">Delete</Button>
64
+ </div>
65
+ );
66
+ }
67
+ ```
68
+
69
+ ### Button Sizes
70
+ ```tsx
71
+ function SizesExample() {
72
+ return (
73
+ <div className="button-sizes">
74
+ <Button size="Small">Small</Button>
75
+ <Button size="Medium">Medium</Button>
76
+ <Button size="Large">Large</Button>
77
+ </div>
78
+ );
79
+ }
80
+ ```
81
+
82
+ ### Buttons with Icons
83
+ ```tsx
84
+ import { PlusIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
85
+
86
+ function IconButtonsExample() {
87
+ return (
88
+ <div className="icon-buttons">
89
+ <Button leadingIcon={<PlusIcon />}>
90
+ Add Item
91
+ </Button>
92
+
93
+ <Button trailingIcon={<ArrowRightIcon />}>
94
+ Continue
95
+ </Button>
96
+
97
+ <Button
98
+ leadingIcon={<PlusIcon />}
99
+ trailingIcon={<ArrowRightIcon />}
100
+ >
101
+ Add & Continue
102
+ </Button>
103
+ </div>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ### Loading and Disabled States
109
+ ```tsx
110
+ function StatesExample() {
111
+ const [loading, setLoading] = useState(false);
112
+
113
+ const handleSubmit = async () => {
114
+ setLoading(true);
115
+ await new Promise(resolve => setTimeout(resolve, 2000));
116
+ setLoading(false);
117
+ };
118
+
119
+ return (
120
+ <div className="button-states">
121
+ <Button
122
+ loading={loading}
123
+ onClick={handleSubmit}
124
+ >
125
+ Submit with loading
126
+ </Button>
127
+
128
+ <Button disabled>
129
+ Disabled Button
130
+ </Button>
131
+ </div>
132
+ );
133
+ }
134
+ ```
135
+
136
+ ### Form Integration
137
+ ```tsx
138
+ import { Button, Form, FormField, Input } from '@delightui/components';
139
+
140
+ function FormExample() {
141
+ const handleSubmit = (values, setError) => {
142
+ console.log('Form submitted with values:', values);
143
+ // Handle form submission
144
+ };
145
+
146
+ const handleReset = () => {
147
+ console.log('Form reset');
148
+ };
149
+
150
+ return (
151
+ <Form onSubmit={handleSubmit}>
152
+ <FormField name="name" label="Full Name" required>
153
+ <Input placeholder="Enter your name" />
154
+ </FormField>
155
+
156
+ <FormField name="email" label="Email" required>
157
+ <Input inputType="Email" placeholder="Enter your email" />
158
+ </FormField>
159
+
160
+ <div className="form-actions">
161
+ <Button
162
+ actionType="reset"
163
+ type="Outlined"
164
+ style="Secondary"
165
+ onClick={handleReset}
166
+ >
167
+ Reset
168
+ </Button>
169
+
170
+ <Button
171
+ actionType="submit"
172
+ style="Primary"
173
+ >
174
+ Submit Form
175
+ </Button>
176
+ </div>
177
+ </Form>
178
+ );
179
+ }
180
+ ```
181
+
182
+ ### Appearance Variants
183
+ ```tsx
184
+ function AppearanceExample() {
185
+ return (
186
+ <div className="appearance-variants">
187
+ {/* Default appearance */}
188
+ <Button appearance="Default">Default Theme</Button>
189
+
190
+ {/* Inverse appearance for dark backgrounds */}
191
+ <div className="dark-background">
192
+ <Button appearance="Inverse">Inverse Theme</Button>
193
+ </div>
194
+ </div>
195
+ );
196
+ }
197
+ ```
@@ -0,0 +1,299 @@
1
+ # Checkbox
2
+
3
+ ## Description
4
+
5
+ Customizable checkbox input component with support for controlled and uncontrolled states, various sizes, label positioning, and form integration. Includes proper accessibility features and validation support.
6
+
7
+ ## Aliases
8
+
9
+ - Check Box
10
+ - Tick Box
11
+ - Selection Box
12
+ - Boolean Input
13
+ - Toggle Checkbox
14
+
15
+ ## Props Breakdown
16
+
17
+ **Extends:** `InputHTMLAttributes<HTMLInputElement>` (excluding 'type', 'size') + `ControlledFormComponentProps<boolean>`
18
+
19
+ | Prop | Type | Default | Required | Description |
20
+ |------|------|---------|----------|-------------|
21
+ | `children` | `ReactNode` | - | No | Label content for the checkbox |
22
+ | `size` | `'Small' \| 'Medium' \| 'Large'` | `'Medium'` | No | Size variant of the checkbox |
23
+ | `type` | `'Default' \| 'Inverse'` | `'Default'` | No | Visual theme of the checkbox |
24
+ | `defaultChecked` | `boolean` | `false` | No | Default checked state for uncontrolled usage |
25
+ | `labelAlignment` | `'Left' \| 'Right'` | - | No | Position of the label relative to the checkbox |
26
+ | `initialValue` | `boolean` | - | No | Initial value for controlled form usage |
27
+ | `checked` | `boolean` | - | No | Controlled checked state |
28
+ | `value` | `boolean` | - | No | Current value for controlled form usage |
29
+ | `onValueChange` | `(value: boolean) => void` | - | No | Callback when checkbox value changes |
30
+ | `disabled` | `boolean` | `false` | No | Whether the checkbox is disabled |
31
+ | `required` | `boolean` | `false` | No | Whether the checkbox is required |
32
+ | `invalid` | `boolean` | `false` | No | Whether the checkbox value is invalid |
33
+ | `id` | `string` | - | No | HTML id attribute |
34
+ | `className` | `string` | - | No | Additional CSS class names |
35
+ | `name` | `string` | - | No | HTML name attribute |
36
+
37
+ *Note: In addition to the props listed above, this component inherits all HTML input attributes (except 'type' and 'size') such as `onChange`, `onFocus`, `onBlur`, `aria-*`, `data-*`, etc. It also includes controlled form component properties for integration with form libraries.*
38
+
39
+ ## Examples
40
+
41
+ ### Basic Usage
42
+ ```tsx
43
+ import { Checkbox } from '@delightui/components';
44
+
45
+ function BasicExample() {
46
+ const [checked, setChecked] = useState(false);
47
+
48
+ return (
49
+ <Checkbox
50
+ checked={checked}
51
+ onValueChange={setChecked}
52
+ >
53
+ Accept terms and conditions
54
+ </Checkbox>
55
+ );
56
+ }
57
+ ```
58
+
59
+ ### Checkbox Sizes
60
+ ```tsx
61
+ function SizesExample() {
62
+ return (
63
+ <div className="checkbox-sizes">
64
+ <Checkbox size="Small">Small checkbox</Checkbox>
65
+ <Checkbox size="Medium">Medium checkbox</Checkbox>
66
+ <Checkbox size="Large">Large checkbox</Checkbox>
67
+ </div>
68
+ );
69
+ }
70
+ ```
71
+
72
+ ### Label Alignment
73
+ ```tsx
74
+ function AlignmentExample() {
75
+ return (
76
+ <div className="checkbox-alignment">
77
+ <Checkbox labelAlignment="Left">
78
+ Label on the left
79
+ </Checkbox>
80
+
81
+ <Checkbox labelAlignment="Right">
82
+ Label on the right
83
+ </Checkbox>
84
+ </div>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ### Checkbox Types
90
+ ```tsx
91
+ function TypesExample() {
92
+ return (
93
+ <div className="checkbox-types">
94
+ <Checkbox type="Default">
95
+ Default theme
96
+ </Checkbox>
97
+
98
+ {/* Use inverse for dark backgrounds */}
99
+ <div className="dark-background">
100
+ <Checkbox type="Inverse">
101
+ Inverse theme
102
+ </Checkbox>
103
+ </div>
104
+ </div>
105
+ );
106
+ }
107
+ ```
108
+
109
+ ### Disabled and Invalid States
110
+ ```tsx
111
+ function StatesExample() {
112
+ return (
113
+ <div className="checkbox-states">
114
+ <Checkbox disabled>
115
+ Disabled checkbox
116
+ </Checkbox>
117
+
118
+ <Checkbox disabled checked>
119
+ Disabled checked
120
+ </Checkbox>
121
+
122
+ <Checkbox invalid>
123
+ Invalid checkbox
124
+ </Checkbox>
125
+
126
+ <Checkbox required>
127
+ Required checkbox
128
+ </Checkbox>
129
+ </div>
130
+ );
131
+ }
132
+ ```
133
+
134
+ ### Uncontrolled Usage
135
+ ```tsx
136
+ function UncontrolledExample() {
137
+ const handleChange = (event) => {
138
+ console.log('Checkbox changed:', event.target.checked);
139
+ };
140
+
141
+ return (
142
+ <div className="uncontrolled-checkboxes">
143
+ <Checkbox
144
+ defaultChecked={false}
145
+ onChange={handleChange}
146
+ name="newsletter"
147
+ >
148
+ Subscribe to newsletter
149
+ </Checkbox>
150
+
151
+ <Checkbox
152
+ defaultChecked={true}
153
+ onChange={handleChange}
154
+ name="notifications"
155
+ >
156
+ Enable notifications
157
+ </Checkbox>
158
+ </div>
159
+ );
160
+ }
161
+ ```
162
+
163
+ ### Form Integration
164
+ ```tsx
165
+ import { Checkbox, Form, FormField } from '@delightui/components';
166
+
167
+ function FormExample() {
168
+ const handleSubmit = (values, setError) => {
169
+ if (!values.terms) {
170
+ setError('terms', 'You must accept the terms and conditions');
171
+ return;
172
+ }
173
+
174
+ console.log('Form submitted:', values);
175
+ };
176
+
177
+ return (
178
+ <Form onSubmit={handleSubmit}>
179
+ <FormField
180
+ name="terms"
181
+ required
182
+ message="Please accept the terms to continue"
183
+ >
184
+ <Checkbox>
185
+ I accept the <a href="/terms">terms and conditions</a>
186
+ </Checkbox>
187
+ </FormField>
188
+
189
+ <FormField name="newsletter">
190
+ <Checkbox>
191
+ Subscribe to our newsletter for updates
192
+ </Checkbox>
193
+ </FormField>
194
+
195
+ <FormField name="marketing">
196
+ <Checkbox>
197
+ Receive marketing communications
198
+ </Checkbox>
199
+ </FormField>
200
+
201
+ <Button actionType="submit">
202
+ Submit
203
+ </Button>
204
+ </Form>
205
+ );
206
+ }
207
+ ```
208
+
209
+ ### Multi-Selection List
210
+ ```tsx
211
+ function MultiSelectionExample() {
212
+ const [selectedItems, setSelectedItems] = useState([]);
213
+
214
+ const options = [
215
+ { id: 'react', label: 'React' },
216
+ { id: 'vue', label: 'Vue.js' },
217
+ { id: 'angular', label: 'Angular' },
218
+ { id: 'svelte', label: 'Svelte' }
219
+ ];
220
+
221
+ const handleItemToggle = (itemId, checked) => {
222
+ setSelectedItems(prev =>
223
+ checked
224
+ ? [...prev, itemId]
225
+ : prev.filter(id => id !== itemId)
226
+ );
227
+ };
228
+
229
+ return (
230
+ <div className="multi-selection">
231
+ <h3>Select your preferred frameworks:</h3>
232
+ {options.map(option => (
233
+ <Checkbox
234
+ key={option.id}
235
+ checked={selectedItems.includes(option.id)}
236
+ onValueChange={(checked) => handleItemToggle(option.id, checked)}
237
+ >
238
+ {option.label}
239
+ </Checkbox>
240
+ ))}
241
+
242
+ <p>Selected: {selectedItems.join(', ')}</p>
243
+ </div>
244
+ );
245
+ }
246
+ ```
247
+
248
+ ### Select All Pattern
249
+ ```tsx
250
+ function SelectAllExample() {
251
+ const [items, setItems] = useState([
252
+ { id: 1, name: 'Item 1', selected: false },
253
+ { id: 2, name: 'Item 2', selected: false },
254
+ { id: 3, name: 'Item 3', selected: false },
255
+ ]);
256
+
257
+ const allSelected = items.every(item => item.selected);
258
+ const someSelected = items.some(item => item.selected);
259
+
260
+ const handleSelectAll = (checked) => {
261
+ setItems(items.map(item => ({ ...item, selected: checked })));
262
+ };
263
+
264
+ const handleItemToggle = (itemId, checked) => {
265
+ setItems(items.map(item =>
266
+ item.id === itemId ? { ...item, selected: checked } : item
267
+ ));
268
+ };
269
+
270
+ return (
271
+ <div className="select-all-pattern">
272
+ <Checkbox
273
+ checked={allSelected}
274
+ // Show indeterminate state when some but not all are selected
275
+ ref={checkbox => {
276
+ if (checkbox) {
277
+ checkbox.indeterminate = someSelected && !allSelected;
278
+ }
279
+ }}
280
+ onValueChange={handleSelectAll}
281
+ >
282
+ Select All
283
+ </Checkbox>
284
+
285
+ <hr />
286
+
287
+ {items.map(item => (
288
+ <Checkbox
289
+ key={item.id}
290
+ checked={item.selected}
291
+ onValueChange={(checked) => handleItemToggle(item.id, checked)}
292
+ >
293
+ {item.name}
294
+ </Checkbox>
295
+ ))}
296
+ </div>
297
+ );
298
+ }
299
+ ```