@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,244 @@
|
|
|
1
|
+
# GridList
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
A grid-based list component that extends the standard List component with CSS Grid layout functionality. It automatically arranges list items in a responsive grid format with customizable columns and spacing, providing an organized way to display collections of data in a grid pattern.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- GridList
|
|
10
|
+
- GridCollection
|
|
11
|
+
- DataGrid
|
|
12
|
+
- GridContainer
|
|
13
|
+
|
|
14
|
+
## Props Breakdown
|
|
15
|
+
|
|
16
|
+
**Extends:** All `List` component props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Required | Description |
|
|
19
|
+
|------|------|---------|----------|-------------|
|
|
20
|
+
| `columns` | `number` | `1` | No | Number of columns in the grid layout |
|
|
21
|
+
| `gap` | `string \| number` | - | No | Gap spacing between grid items (CSS gap property) |
|
|
22
|
+
| `className` | `string` | - | No | Additional CSS class names |
|
|
23
|
+
| `component` | `React.ComponentType<T>` | - | Yes | Component to render for each list item |
|
|
24
|
+
| `data` | `T[]` | - | Yes | Array of data items to render |
|
|
25
|
+
|
|
26
|
+
Plus all standard List component properties (sorting, callbacks, etc.).
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Basic Grid Layout
|
|
31
|
+
```tsx
|
|
32
|
+
import { GridList } from '@delightui/components';
|
|
33
|
+
|
|
34
|
+
const ProductCard = ({ name, price, image }) => (
|
|
35
|
+
<div className="product-card">
|
|
36
|
+
<img src={image} alt={name} />
|
|
37
|
+
<h3>{name}</h3>
|
|
38
|
+
<p>${price}</p>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function BasicGridExample() {
|
|
43
|
+
const products = [
|
|
44
|
+
{ id: 1, name: 'Product 1', price: 29.99, image: '/product1.jpg' },
|
|
45
|
+
{ id: 2, name: 'Product 2', price: 39.99, image: '/product2.jpg' },
|
|
46
|
+
{ id: 3, name: 'Product 3', price: 19.99, image: '/product3.jpg' },
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<GridList
|
|
51
|
+
data={products}
|
|
52
|
+
component={ProductCard}
|
|
53
|
+
columns={3}
|
|
54
|
+
gap="16px"
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Responsive Grid
|
|
61
|
+
```tsx
|
|
62
|
+
function ResponsiveGridExample() {
|
|
63
|
+
const images = [
|
|
64
|
+
{ id: 1, src: '/image1.jpg', alt: 'Image 1' },
|
|
65
|
+
{ id: 2, src: '/image2.jpg', alt: 'Image 2' },
|
|
66
|
+
{ id: 3, src: '/image3.jpg', alt: 'Image 3' },
|
|
67
|
+
{ id: 4, src: '/image4.jpg', alt: 'Image 4' },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const ImageCard = ({ src, alt }) => (
|
|
71
|
+
<div className="image-card">
|
|
72
|
+
<img src={src} alt={alt} />
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div className="responsive-grids">
|
|
78
|
+
{/* Mobile: 1 column */}
|
|
79
|
+
<div className="mobile-grid">
|
|
80
|
+
<GridList
|
|
81
|
+
data={images}
|
|
82
|
+
component={ImageCard}
|
|
83
|
+
columns={1}
|
|
84
|
+
gap="12px"
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
{/* Tablet: 2 columns */}
|
|
89
|
+
<div className="tablet-grid">
|
|
90
|
+
<GridList
|
|
91
|
+
data={images}
|
|
92
|
+
component={ImageCard}
|
|
93
|
+
columns={2}
|
|
94
|
+
gap="16px"
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{/* Desktop: 4 columns */}
|
|
99
|
+
<div className="desktop-grid">
|
|
100
|
+
<GridList
|
|
101
|
+
data={images}
|
|
102
|
+
component={ImageCard}
|
|
103
|
+
columns={4}
|
|
104
|
+
gap="20px"
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Card Grid with Actions
|
|
113
|
+
```tsx
|
|
114
|
+
import { Button, Text } from '@delightui/components';
|
|
115
|
+
|
|
116
|
+
function CardGridExample() {
|
|
117
|
+
const users = [
|
|
118
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', avatar: '/avatar1.jpg' },
|
|
119
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', avatar: '/avatar2.jpg' },
|
|
120
|
+
{ id: 3, name: 'Bob Johnson', email: 'bob@example.com', avatar: '/avatar3.jpg' },
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
const UserCard = ({ name, email, avatar, onEdit, onDelete }) => (
|
|
124
|
+
<div className="user-card">
|
|
125
|
+
<img src={avatar} alt={name} className="user-avatar" />
|
|
126
|
+
<Text type="Heading" size="Small">{name}</Text>
|
|
127
|
+
<Text type="Body" size="Small" color="Secondary">{email}</Text>
|
|
128
|
+
<div className="card-actions">
|
|
129
|
+
<Button size="Small" onClick={() => onEdit(id)}>Edit</Button>
|
|
130
|
+
<Button size="Small" style="Destructive" onClick={() => onDelete(id)}>Delete</Button>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const handleEdit = (userId) => {
|
|
136
|
+
console.log('Edit user:', userId);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const handleDelete = (userId) => {
|
|
140
|
+
console.log('Delete user:', userId);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<GridList
|
|
145
|
+
data={users.map(user => ({ ...user, onEdit: handleEdit, onDelete: handleDelete }))}
|
|
146
|
+
component={UserCard}
|
|
147
|
+
columns={3}
|
|
148
|
+
gap="24px"
|
|
149
|
+
className="user-grid"
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Variable Gap Spacing
|
|
156
|
+
```tsx
|
|
157
|
+
function GapSpacingExample() {
|
|
158
|
+
const items = Array.from({ length: 9 }, (_, i) => ({
|
|
159
|
+
id: i + 1,
|
|
160
|
+
content: `Item ${i + 1}`
|
|
161
|
+
}));
|
|
162
|
+
|
|
163
|
+
const SimpleCard = ({ content }) => (
|
|
164
|
+
<div className="simple-card">{content}</div>
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<div className="gap-examples">
|
|
169
|
+
{/* Tight spacing */}
|
|
170
|
+
<GridList
|
|
171
|
+
data={items}
|
|
172
|
+
component={SimpleCard}
|
|
173
|
+
columns={3}
|
|
174
|
+
gap="8px"
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
{/* Medium spacing */}
|
|
178
|
+
<GridList
|
|
179
|
+
data={items}
|
|
180
|
+
component={SimpleCard}
|
|
181
|
+
columns={3}
|
|
182
|
+
gap="16px"
|
|
183
|
+
/>
|
|
184
|
+
|
|
185
|
+
{/* Large spacing */}
|
|
186
|
+
<GridList
|
|
187
|
+
data={items}
|
|
188
|
+
component={SimpleCard}
|
|
189
|
+
columns={3}
|
|
190
|
+
gap="32px"
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Mixed Content Grid
|
|
198
|
+
```tsx
|
|
199
|
+
function MixedContentExample() {
|
|
200
|
+
const content = [
|
|
201
|
+
{ id: 1, type: 'text', title: 'Article 1', summary: 'Lorem ipsum...' },
|
|
202
|
+
{ id: 2, type: 'image', src: '/image.jpg', alt: 'Featured image' },
|
|
203
|
+
{ id: 3, type: 'video', thumbnail: '/video-thumb.jpg', duration: '5:30' },
|
|
204
|
+
{ id: 4, type: 'text', title: 'Article 2', summary: 'Dolor sit amet...' },
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
const ContentCard = ({ type, title, summary, src, alt, thumbnail, duration }) => {
|
|
208
|
+
switch (type) {
|
|
209
|
+
case 'text':
|
|
210
|
+
return (
|
|
211
|
+
<div className="text-card">
|
|
212
|
+
<h3>{title}</h3>
|
|
213
|
+
<p>{summary}</p>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
case 'image':
|
|
217
|
+
return (
|
|
218
|
+
<div className="image-card">
|
|
219
|
+
<img src={src} alt={alt} />
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
case 'video':
|
|
223
|
+
return (
|
|
224
|
+
<div className="video-card">
|
|
225
|
+
<img src={thumbnail} alt="Video thumbnail" />
|
|
226
|
+
<div className="video-duration">{duration}</div>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
default:
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<GridList
|
|
236
|
+
data={content}
|
|
237
|
+
component={ContentCard}
|
|
238
|
+
columns={2}
|
|
239
|
+
gap="20px"
|
|
240
|
+
className="mixed-content-grid"
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
```
|