@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,430 @@
1
+ # Input
2
+
3
+ ## Description
4
+
5
+ Text input component with validation, icons, and form integration support. Provides a flexible foundation for collecting user text input with proper accessibility and styling.
6
+
7
+ ## Aliases
8
+
9
+ - Text Input
10
+ - Text Field
11
+ - Input Field
12
+ - Form Input
13
+
14
+ ## Props Breakdown
15
+
16
+ **Extends:** `InputHTMLAttributes<HTMLInputElement>` (excluding `type` and `value`) + `ControlledFormComponentProps<string>`
17
+
18
+ | Prop | Type | Default | Required | Description |
19
+ |------|------|---------|----------|-------------|
20
+ | `inputType` | `'Text' \| 'Number' \| 'Email' \| 'Password'` | `'Text'` | No | Type of input field |
21
+ | `leadingIcon` | `ReactNode` | - | No | Icon displayed before the input text |
22
+ | `trailingIcon` | `ReactNode` | - | No | Icon displayed after the input text |
23
+ | `component-variant` | `string` | - | No | Override styling variant |
24
+ | `initialValue` | `string` | - | No | Initial value for controlled form usage |
25
+ | `value` | `string` | - | No | Controlled value |
26
+ | `onValueChange` | `(value: string) => void` | - | No | Callback when input value changes |
27
+ | `disabled` | `boolean` | `false` | No | Whether the input is disabled |
28
+ | `required` | `boolean` | `false` | No | Whether the input is required |
29
+ | `invalid` | `boolean` | `false` | No | Whether the input value is invalid |
30
+ | `id` | `string` | - | No | HTML id attribute |
31
+ | `placeholder` | `string` | - | No | Placeholder text |
32
+ | `className` | `string` | - | No | Additional CSS class names |
33
+
34
+ Plus all standard HTML input attributes (name, autoComplete, autoFocus, min, max, step, pattern, etc.) except `type` and `value`.
35
+
36
+ ## Examples
37
+
38
+ ### Basic Usage
39
+ ```tsx
40
+ import { Input } from '@delightui/components';
41
+
42
+ function BasicExample() {
43
+ const [value, setValue] = useState('');
44
+
45
+ return (
46
+ <Input
47
+ placeholder="Enter your name"
48
+ value={value}
49
+ onValueChange={setValue}
50
+ />
51
+ );
52
+ }
53
+ ```
54
+
55
+ ### Input Types
56
+ ```tsx
57
+ function InputTypesExample() {
58
+ return (
59
+ <div className="input-types">
60
+ <Input
61
+ inputType="Text"
62
+ placeholder="Enter text"
63
+ />
64
+
65
+ <Input
66
+ inputType="Email"
67
+ placeholder="Enter email address"
68
+ />
69
+
70
+ <Input
71
+ inputType="Password"
72
+ placeholder="Enter password"
73
+ />
74
+
75
+ <Input
76
+ inputType="Number"
77
+ placeholder="Enter number"
78
+ />
79
+ </div>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ### With Icons
85
+ ```tsx
86
+ import {
87
+ UserIcon,
88
+ EnvelopeIcon,
89
+ LockClosedIcon,
90
+ MagnifyingGlassIcon,
91
+ EyeIcon
92
+ } from '@heroicons/react/24/outline';
93
+
94
+ function IconsExample() {
95
+ return (
96
+ <div className="input-icons">
97
+ <Input
98
+ leadingIcon={<UserIcon />}
99
+ placeholder="Username"
100
+ />
101
+
102
+ <Input
103
+ leadingIcon={<EnvelopeIcon />}
104
+ inputType="Email"
105
+ placeholder="Email address"
106
+ />
107
+
108
+ <Input
109
+ leadingIcon={<LockClosedIcon />}
110
+ trailingIcon={<EyeIcon />}
111
+ inputType="Password"
112
+ placeholder="Password"
113
+ />
114
+
115
+ <Input
116
+ leadingIcon={<MagnifyingGlassIcon />}
117
+ placeholder="Search..."
118
+ />
119
+ </div>
120
+ );
121
+ }
122
+ ```
123
+
124
+ ### Form Integration
125
+ ```tsx
126
+ import { Input, Form, FormField, Button } from '@delightui/components';
127
+
128
+ function FormExample() {
129
+ const handleSubmit = (values, setError) => {
130
+ // Validate email
131
+ if (!values.email || !values.email.includes('@')) {
132
+ setError('email', 'Please enter a valid email address');
133
+ return;
134
+ }
135
+
136
+ // Validate password
137
+ if (!values.password || values.password.length < 8) {
138
+ setError('password', 'Password must be at least 8 characters');
139
+ return;
140
+ }
141
+
142
+ console.log('Form submitted:', values);
143
+ };
144
+
145
+ return (
146
+ <Form onSubmit={handleSubmit}>
147
+ <FormField
148
+ name="firstName"
149
+ label="First Name"
150
+ required
151
+ >
152
+ <Input
153
+ placeholder="Enter your first name"
154
+ leadingIcon={<UserIcon />}
155
+ />
156
+ </FormField>
157
+
158
+ <FormField
159
+ name="lastName"
160
+ label="Last Name"
161
+ required
162
+ >
163
+ <Input
164
+ placeholder="Enter your last name"
165
+ leadingIcon={<UserIcon />}
166
+ />
167
+ </FormField>
168
+
169
+ <FormField
170
+ name="email"
171
+ label="Email Address"
172
+ required
173
+ >
174
+ <Input
175
+ inputType="Email"
176
+ placeholder="Enter your email"
177
+ leadingIcon={<EnvelopeIcon />}
178
+ />
179
+ </FormField>
180
+
181
+ <FormField
182
+ name="password"
183
+ label="Password"
184
+ required
185
+ >
186
+ <Input
187
+ inputType="Password"
188
+ placeholder="Enter password"
189
+ leadingIcon={<LockClosedIcon />}
190
+ />
191
+ </FormField>
192
+
193
+ <Button actionType="submit">
194
+ Create Account
195
+ </Button>
196
+ </Form>
197
+ );
198
+ }
199
+ ```
200
+
201
+ ### Validation States
202
+ ```tsx
203
+ import { Text } from '@delightui/components';
204
+
205
+ function ValidationExample() {
206
+ const [email, setEmail] = useState('');
207
+ const [isValid, setIsValid] = useState(true);
208
+
209
+ const validateEmail = (value) => {
210
+ const isValidEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
211
+ setIsValid(isValidEmail);
212
+ return isValidEmail;
213
+ };
214
+
215
+ const handleEmailChange = (value) => {
216
+ setEmail(value);
217
+ if (value) {
218
+ validateEmail(value);
219
+ } else {
220
+ setIsValid(true);
221
+ }
222
+ };
223
+
224
+ return (
225
+ <div className="validation-example">
226
+ <Input
227
+ inputType="Email"
228
+ value={email}
229
+ onValueChange={handleEmailChange}
230
+ invalid={!isValid && email.length > 0}
231
+ placeholder="Enter email address"
232
+ leadingIcon={<EnvelopeIcon />}
233
+ />
234
+
235
+ {!isValid && email.length > 0 && (
236
+ <Text type="BodySmall" className="error-message">
237
+ Please enter a valid email address
238
+ </Text>
239
+ )}
240
+ </div>
241
+ );
242
+ }
243
+ ```
244
+
245
+ ### Disabled State
246
+ ```tsx
247
+ function DisabledExample() {
248
+ return (
249
+ <div className="disabled-inputs">
250
+ <Input
251
+ disabled
252
+ placeholder="Disabled input"
253
+ value="Cannot edit this"
254
+ />
255
+
256
+ <Input
257
+ disabled
258
+ leadingIcon={<UserIcon />}
259
+ placeholder="Disabled with icon"
260
+ />
261
+ </div>
262
+ );
263
+ }
264
+ ```
265
+
266
+ ### Search Input
267
+ ```tsx
268
+ import { IconButton, Icon } from '@delightui/components';
269
+
270
+ function SearchExample() {
271
+ const [searchTerm, setSearchTerm] = useState('');
272
+ const [results, setResults] = useState([]);
273
+
274
+ const handleSearch = useCallback(
275
+ debounce((term) => {
276
+ if (term.length > 2) {
277
+ // Simulate search
278
+ setResults([
279
+ `Result 1 for "${term}"`,
280
+ `Result 2 for "${term}"`,
281
+ `Result 3 for "${term}"`
282
+ ]);
283
+ } else {
284
+ setResults([]);
285
+ }
286
+ }, 300),
287
+ []
288
+ );
289
+
290
+ useEffect(() => {
291
+ handleSearch(searchTerm);
292
+ }, [searchTerm, handleSearch]);
293
+
294
+ const clearSearch = () => {
295
+ setSearchTerm('');
296
+ setResults([]);
297
+ };
298
+
299
+ return (
300
+ <div className="search-input">
301
+ <Input
302
+ leadingIcon={<MagnifyingGlassIcon />}
303
+ trailingIcon={
304
+ searchTerm ? (
305
+ <IconButton onClick={clearSearch} size="Small">
306
+ <Icon icon="Close" />
307
+ </IconButton>
308
+ ) : null
309
+ }
310
+ placeholder="Search..."
311
+ value={searchTerm}
312
+ onValueChange={setSearchTerm}
313
+ />
314
+
315
+ {results.length > 0 && (
316
+ <div className="search-results">
317
+ {results.map((result, index) => (
318
+ <div key={index} className="result-item">
319
+ {result}
320
+ </div>
321
+ ))}
322
+ </div>
323
+ )}
324
+ </div>
325
+ );
326
+ }
327
+ ```
328
+
329
+ ### Number Input with Validation
330
+ ```tsx
331
+ import { Text } from '@delightui/components';
332
+
333
+ function NumberInputExample() {
334
+ const [age, setAge] = useState('');
335
+ const [error, setError] = useState('');
336
+
337
+ const handleAgeChange = (value) => {
338
+ setAge(value);
339
+
340
+ const numValue = parseInt(value);
341
+ if (value && (isNaN(numValue) || numValue < 0 || numValue > 120)) {
342
+ setError('Please enter a valid age (0-120)');
343
+ } else {
344
+ setError('');
345
+ }
346
+ };
347
+
348
+ return (
349
+ <div className="number-input">
350
+ <Input
351
+ inputType="Number"
352
+ value={age}
353
+ onValueChange={handleAgeChange}
354
+ invalid={!!error}
355
+ placeholder="Enter your age"
356
+ min="0"
357
+ max="120"
358
+ />
359
+
360
+ {error && (
361
+ <Text type="BodySmall" className="error-message">{error}</Text>
362
+ )}
363
+ </div>
364
+ );
365
+ }
366
+ ```
367
+
368
+ ### Controlled vs Uncontrolled
369
+ ```tsx
370
+ import { Button, Text } from '@delightui/components';
371
+
372
+ function ControlledExample() {
373
+ // Controlled input
374
+ const [controlledValue, setControlledValue] = useState('');
375
+
376
+ // Uncontrolled input
377
+ const uncontrolledRef = useRef(null);
378
+
379
+ const getUncontrolledValue = () => {
380
+ alert(`Uncontrolled value: ${uncontrolledRef.current?.value}`);
381
+ };
382
+
383
+ return (
384
+ <div className="controlled-comparison">
385
+ <div>
386
+ <Text type="Heading4">Controlled Input</Text>
387
+ <Input
388
+ value={controlledValue}
389
+ onValueChange={setControlledValue}
390
+ placeholder="Controlled input"
391
+ />
392
+ <Text>Current value: {controlledValue}</Text>
393
+ </div>
394
+
395
+ <div>
396
+ <Text type="Heading4">Uncontrolled Input</Text>
397
+ <Input
398
+ ref={uncontrolledRef}
399
+ defaultValue="Initial value"
400
+ placeholder="Uncontrolled input"
401
+ />
402
+ <Button onClick={getUncontrolledValue}>
403
+ Get Value
404
+ </Button>
405
+ </div>
406
+ </div>
407
+ );
408
+ }
409
+ ```
410
+
411
+ ### Custom Styling
412
+ ```tsx
413
+ function CustomStylingExample() {
414
+ return (
415
+ <div className="custom-styling">
416
+ <Input
417
+ component-variant="primary"
418
+ placeholder="Primary variant"
419
+ leadingIcon={<StarIcon />}
420
+ />
421
+
422
+ <Input
423
+ component-variant="secondary"
424
+ placeholder="Secondary variant"
425
+ className="custom-input-class"
426
+ />
427
+ </div>
428
+ );
429
+ }
430
+ ```