@delightui/components 0.1.104 → 0.1.106
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/Popover/Popover.presenter.d.ts +26 -0
- package/dist/cjs/components/molecules/Select/Option/Option.types.d.ts +6 -0
- package/dist/cjs/components/molecules/Select/Select.Context.d.ts +1 -1
- package/dist/cjs/components/molecules/Select/Select.d.ts +5 -5
- package/dist/cjs/components/molecules/Select/Select.presenter.d.ts +1 -0
- package/dist/cjs/components/molecules/Select/Select.types.d.ts +5 -0
- package/dist/cjs/components/molecules/Select/index.d.ts +2 -9
- package/dist/cjs/components/molecules/index.d.ts +2 -0
- package/dist/cjs/components/utils/accessibilityUtils.d.ts +41 -0
- package/dist/cjs/components/utils/index.d.ts +2 -0
- package/dist/cjs/library.css +13 -0
- package/dist/cjs/library.js +2 -2
- 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/Popover/Popover.presenter.d.ts +26 -0
- package/dist/esm/components/molecules/Select/Option/Option.types.d.ts +6 -0
- package/dist/esm/components/molecules/Select/Select.Context.d.ts +1 -1
- package/dist/esm/components/molecules/Select/Select.d.ts +5 -5
- package/dist/esm/components/molecules/Select/Select.presenter.d.ts +1 -0
- package/dist/esm/components/molecules/Select/Select.types.d.ts +5 -0
- package/dist/esm/components/molecules/Select/index.d.ts +2 -9
- package/dist/esm/components/molecules/index.d.ts +2 -0
- package/dist/esm/components/utils/accessibilityUtils.d.ts +41 -0
- package/dist/esm/components/utils/index.d.ts +2 -0
- package/dist/esm/library.css +13 -0
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +156 -12
- 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,612 @@
|
|
|
1
|
+
# ResponsiveComponent
|
|
2
|
+
|
|
3
|
+
A utility component that renders different components based on screen width breakpoints. It provides a declarative way to handle responsive design by allowing you to specify different component configurations for different screen sizes, making it easy to create adaptive user interfaces.
|
|
4
|
+
|
|
5
|
+
## Aliases
|
|
6
|
+
|
|
7
|
+
- ResponsiveComponent
|
|
8
|
+
- ResponsiveRenderer
|
|
9
|
+
- BreakpointComponent
|
|
10
|
+
|
|
11
|
+
## Props Breakdown
|
|
12
|
+
|
|
13
|
+
**Extends:** This component does not extend standard HTML elements as it's a utility component that renders different components based on breakpoints.
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Required | Description |
|
|
16
|
+
|------|------|---------|----------|-------------|
|
|
17
|
+
| `className` | `string` | `undefined` | No | CSS class name for the wrapper element |
|
|
18
|
+
| `component` | `React.FC<T>` | `undefined` | Yes | The component to render at different breakpoints |
|
|
19
|
+
| `children` | `React.ReactElement<BreakpointProps<T>>[]` | `undefined` | Yes | Array of breakpoint configurations |
|
|
20
|
+
|
|
21
|
+
### BreakpointProps
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Required | Description |
|
|
24
|
+
|------|------|---------|----------|-------------|
|
|
25
|
+
| `width` | `number` | `undefined` | Yes | Minimum width in pixels for this breakpoint |
|
|
26
|
+
| `children` | `React.ReactElement<T>` | `undefined` | Yes | Component configuration for this breakpoint |
|
|
27
|
+
|
|
28
|
+
This component does not add standard HTML attributes as it dynamically renders other components.
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Basic Responsive Button
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { ResponsiveComponent, Button } from '@delightui/components';
|
|
36
|
+
|
|
37
|
+
function ResponsiveButtonExample() {
|
|
38
|
+
return (
|
|
39
|
+
<ResponsiveComponent component={Button}>
|
|
40
|
+
<div width={0}>
|
|
41
|
+
<Button size="Small" type="Outlined">
|
|
42
|
+
Mobile Button
|
|
43
|
+
</Button>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div width={768}>
|
|
47
|
+
<Button size="Medium" type="Filled">
|
|
48
|
+
Tablet Button
|
|
49
|
+
</Button>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div width={1024}>
|
|
53
|
+
<Button size="Large" type="Filled" leadingIcon={<Icon name="AddFilled" />}>
|
|
54
|
+
Desktop Button
|
|
55
|
+
</Button>
|
|
56
|
+
</div>
|
|
57
|
+
</ResponsiveComponent>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Responsive Text Sizing
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { ResponsiveComponent, Text } from '@delightui/components';
|
|
66
|
+
|
|
67
|
+
function ResponsiveTextExample() {
|
|
68
|
+
return (
|
|
69
|
+
<ResponsiveComponent component={Text}>
|
|
70
|
+
<div width={0}>
|
|
71
|
+
<Text size="medium" weight="normal">
|
|
72
|
+
Mobile Text
|
|
73
|
+
</Text>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div width={768}>
|
|
77
|
+
<Text size="large" weight="medium">
|
|
78
|
+
Tablet Text
|
|
79
|
+
</Text>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div width={1024}>
|
|
83
|
+
<Text size="xlarge" weight="bold">
|
|
84
|
+
Desktop Text
|
|
85
|
+
</Text>
|
|
86
|
+
</div>
|
|
87
|
+
</ResponsiveComponent>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Responsive Navigation
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { ResponsiveComponent, Button, IconButton, Icon } from '@delightui/components';
|
|
96
|
+
|
|
97
|
+
function ResponsiveNavigationExample() {
|
|
98
|
+
const handleNavigation = (page: string) => {
|
|
99
|
+
console.log(`Navigate to: ${page}`);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<nav style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
|
|
104
|
+
<ResponsiveComponent component={Button}>
|
|
105
|
+
<div width={0}>
|
|
106
|
+
<IconButton
|
|
107
|
+
icon={<Icon name="AddFilled" />}
|
|
108
|
+
onClick={() => handleNavigation('home')}
|
|
109
|
+
title="Home"
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<div width={768}>
|
|
114
|
+
<Button
|
|
115
|
+
size="Small"
|
|
116
|
+
type="Ghost"
|
|
117
|
+
onClick={() => handleNavigation('home')}
|
|
118
|
+
>
|
|
119
|
+
Home
|
|
120
|
+
</Button>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div width={1024}>
|
|
124
|
+
<Button
|
|
125
|
+
size="Medium"
|
|
126
|
+
type="Ghost"
|
|
127
|
+
leadingIcon={<Icon name="AddFilled" />}
|
|
128
|
+
onClick={() => handleNavigation('home')}
|
|
129
|
+
>
|
|
130
|
+
Home
|
|
131
|
+
</Button>
|
|
132
|
+
</div>
|
|
133
|
+
</ResponsiveComponent>
|
|
134
|
+
|
|
135
|
+
<ResponsiveComponent component={Button}>
|
|
136
|
+
<div width={0}>
|
|
137
|
+
<IconButton
|
|
138
|
+
icon={<Icon name="SearchFilled" />}
|
|
139
|
+
onClick={() => handleNavigation('about')}
|
|
140
|
+
title="About"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div width={768}>
|
|
145
|
+
<Button
|
|
146
|
+
size="Small"
|
|
147
|
+
type="Ghost"
|
|
148
|
+
onClick={() => handleNavigation('about')}
|
|
149
|
+
>
|
|
150
|
+
About
|
|
151
|
+
</Button>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div width={1024}>
|
|
155
|
+
<Button
|
|
156
|
+
size="Medium"
|
|
157
|
+
type="Ghost"
|
|
158
|
+
leadingIcon={<Icon name="SearchFilled" />}
|
|
159
|
+
onClick={() => handleNavigation('about')}
|
|
160
|
+
>
|
|
161
|
+
About Us
|
|
162
|
+
</Button>
|
|
163
|
+
</div>
|
|
164
|
+
</ResponsiveComponent>
|
|
165
|
+
</nav>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Responsive Card Layout
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { ResponsiveComponent, Button, Text } from '@delightui/components';
|
|
174
|
+
|
|
175
|
+
function ResponsiveCardExample() {
|
|
176
|
+
return (
|
|
177
|
+
<div style={{
|
|
178
|
+
border: '1px solid #ccc',
|
|
179
|
+
borderRadius: '8px',
|
|
180
|
+
padding: '16px',
|
|
181
|
+
maxWidth: '400px'
|
|
182
|
+
}}>
|
|
183
|
+
<Text weight="bold" style={{ marginBottom: '12px' }}>
|
|
184
|
+
Product Card
|
|
185
|
+
</Text>
|
|
186
|
+
|
|
187
|
+
<Text size="small" color="secondary" style={{ marginBottom: '16px' }}>
|
|
188
|
+
This is a responsive product card that adapts its button based on screen size.
|
|
189
|
+
</Text>
|
|
190
|
+
|
|
191
|
+
<ResponsiveComponent component={Button}>
|
|
192
|
+
<div width={0}>
|
|
193
|
+
<Button size="Small" style={{ width: '100%' }}>
|
|
194
|
+
Buy
|
|
195
|
+
</Button>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
<div width={480}>
|
|
199
|
+
<Button size="Medium" style={{ width: '100%' }}>
|
|
200
|
+
Add to Cart
|
|
201
|
+
</Button>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<div width={768}>
|
|
205
|
+
<Button
|
|
206
|
+
size="Large"
|
|
207
|
+
leadingIcon={<Icon name="AddFilled" />}
|
|
208
|
+
style={{ width: '100%' }}
|
|
209
|
+
>
|
|
210
|
+
Add to Cart
|
|
211
|
+
</Button>
|
|
212
|
+
</div>
|
|
213
|
+
</ResponsiveComponent>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Responsive Form Input
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
import { ResponsiveComponent, Input, Button } from '@delightui/components';
|
|
223
|
+
|
|
224
|
+
function ResponsiveFormExample() {
|
|
225
|
+
return (
|
|
226
|
+
<form style={{ display: 'flex', gap: '8px', alignItems: 'flex-end' }}>
|
|
227
|
+
<div style={{ flex: 1 }}>
|
|
228
|
+
<ResponsiveComponent component={Input}>
|
|
229
|
+
<div width={0}>
|
|
230
|
+
<Input
|
|
231
|
+
placeholder="Search..."
|
|
232
|
+
inputType="Text"
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div width={768}>
|
|
237
|
+
<Input
|
|
238
|
+
placeholder="Enter your search query..."
|
|
239
|
+
inputType="Text"
|
|
240
|
+
leadingIcon={<Icon name="SearchFilled" />}
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
</ResponsiveComponent>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<ResponsiveComponent component={Button}>
|
|
247
|
+
<div width={0}>
|
|
248
|
+
<IconButton
|
|
249
|
+
icon={<Icon name="SearchFilled" />}
|
|
250
|
+
type="submit"
|
|
251
|
+
/>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div width={768}>
|
|
255
|
+
<Button type="submit">
|
|
256
|
+
Search
|
|
257
|
+
</Button>
|
|
258
|
+
</div>
|
|
259
|
+
</ResponsiveComponent>
|
|
260
|
+
</form>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Responsive Data Display
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { ResponsiveComponent, Text, Chip } from '@delightui/components';
|
|
269
|
+
|
|
270
|
+
function ResponsiveDataDisplayExample() {
|
|
271
|
+
const data = {
|
|
272
|
+
title: 'Project Alpha',
|
|
273
|
+
status: 'In Progress',
|
|
274
|
+
priority: 'High',
|
|
275
|
+
assignee: 'John Doe'
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<div style={{
|
|
280
|
+
border: '1px solid #ccc',
|
|
281
|
+
borderRadius: '8px',
|
|
282
|
+
padding: '16px',
|
|
283
|
+
marginBottom: '16px'
|
|
284
|
+
}}>
|
|
285
|
+
<ResponsiveComponent component={Text}>
|
|
286
|
+
<div width={0}>
|
|
287
|
+
<Text weight="bold" size="medium">
|
|
288
|
+
{data.title}
|
|
289
|
+
</Text>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<div width={768}>
|
|
293
|
+
<Text weight="bold" size="large">
|
|
294
|
+
{data.title}
|
|
295
|
+
</Text>
|
|
296
|
+
</div>
|
|
297
|
+
</ResponsiveComponent>
|
|
298
|
+
|
|
299
|
+
<div style={{ marginTop: '8px', display: 'flex', flexWrap: 'wrap', gap: '8px' }}>
|
|
300
|
+
<ResponsiveComponent component={Chip}>
|
|
301
|
+
<div width={0}>
|
|
302
|
+
<Chip size="Small" variant="outlined">
|
|
303
|
+
{data.status}
|
|
304
|
+
</Chip>
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
<div width={768}>
|
|
308
|
+
<Chip size="Medium" variant="filled">
|
|
309
|
+
Status: {data.status}
|
|
310
|
+
</Chip>
|
|
311
|
+
</div>
|
|
312
|
+
</ResponsiveComponent>
|
|
313
|
+
|
|
314
|
+
<ResponsiveComponent component={Chip}>
|
|
315
|
+
<div width={0}>
|
|
316
|
+
<Chip size="Small" variant="outlined" color="error">
|
|
317
|
+
{data.priority}
|
|
318
|
+
</Chip>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<div width={768}>
|
|
322
|
+
<Chip size="Medium" variant="filled" color="error">
|
|
323
|
+
Priority: {data.priority}
|
|
324
|
+
</Chip>
|
|
325
|
+
</div>
|
|
326
|
+
</ResponsiveComponent>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<ResponsiveComponent component={Text}>
|
|
330
|
+
<div width={0}>
|
|
331
|
+
<Text size="small" color="secondary" style={{ marginTop: '8px' }}>
|
|
332
|
+
{data.assignee}
|
|
333
|
+
</Text>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<div width={768}>
|
|
337
|
+
<Text size="small" color="secondary" style={{ marginTop: '8px' }}>
|
|
338
|
+
Assigned to: {data.assignee}
|
|
339
|
+
</Text>
|
|
340
|
+
</div>
|
|
341
|
+
</ResponsiveComponent>
|
|
342
|
+
</div>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Responsive Modal Actions
|
|
348
|
+
|
|
349
|
+
```tsx
|
|
350
|
+
import { ResponsiveComponent, Button, Modal, ModalHeader, ModalFooter } from '@delightui/components';
|
|
351
|
+
|
|
352
|
+
function ResponsiveModalExample() {
|
|
353
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
354
|
+
|
|
355
|
+
const handleConfirm = () => {
|
|
356
|
+
console.log('Confirmed');
|
|
357
|
+
setIsOpen(false);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const handleCancel = () => {
|
|
361
|
+
console.log('Cancelled');
|
|
362
|
+
setIsOpen(false);
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<div>
|
|
367
|
+
<Button onClick={() => setIsOpen(true)}>
|
|
368
|
+
Open Responsive Modal
|
|
369
|
+
</Button>
|
|
370
|
+
|
|
371
|
+
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
372
|
+
<ModalHeader>
|
|
373
|
+
Confirm Action
|
|
374
|
+
</ModalHeader>
|
|
375
|
+
|
|
376
|
+
<div style={{ padding: '16px' }}>
|
|
377
|
+
<Text>Are you sure you want to proceed with this action?</Text>
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
<ModalFooter>
|
|
381
|
+
<ResponsiveComponent component={Button}>
|
|
382
|
+
<div width={0}>
|
|
383
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px', width: '100%' }}>
|
|
384
|
+
<Button
|
|
385
|
+
onClick={handleConfirm}
|
|
386
|
+
style={{ width: '100%' }}
|
|
387
|
+
>
|
|
388
|
+
Confirm
|
|
389
|
+
</Button>
|
|
390
|
+
<Button
|
|
391
|
+
type="Outlined"
|
|
392
|
+
onClick={handleCancel}
|
|
393
|
+
style={{ width: '100%' }}
|
|
394
|
+
>
|
|
395
|
+
Cancel
|
|
396
|
+
</Button>
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
<div width={768}>
|
|
401
|
+
<div style={{ display: 'flex', gap: '8px', justifyContent: 'flex-end' }}>
|
|
402
|
+
<Button
|
|
403
|
+
type="Outlined"
|
|
404
|
+
onClick={handleCancel}
|
|
405
|
+
>
|
|
406
|
+
Cancel
|
|
407
|
+
</Button>
|
|
408
|
+
<Button
|
|
409
|
+
onClick={handleConfirm}
|
|
410
|
+
>
|
|
411
|
+
Confirm
|
|
412
|
+
</Button>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
</ResponsiveComponent>
|
|
416
|
+
</ModalFooter>
|
|
417
|
+
</Modal>
|
|
418
|
+
</div>
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Responsive Icon Display
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
import { ResponsiveComponent, IconButton, Button, Icon } from '@delightui/components';
|
|
427
|
+
|
|
428
|
+
function ResponsiveIconExample() {
|
|
429
|
+
const actions = [
|
|
430
|
+
{ id: 'save', icon: 'CheckFilled', label: 'Save' },
|
|
431
|
+
{ id: 'edit', icon: 'InfoFilled', label: 'Edit' },
|
|
432
|
+
{ id: 'delete', icon: 'CloseDeleteOutlined', label: 'Delete' }
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
return (
|
|
436
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
437
|
+
{actions.map((action) => (
|
|
438
|
+
<ResponsiveComponent key={action.id} component={Button}>
|
|
439
|
+
<div width={0}>
|
|
440
|
+
<IconButton
|
|
441
|
+
icon={<Icon name={action.icon} />}
|
|
442
|
+
onClick={() => console.log(`${action.label} clicked`)}
|
|
443
|
+
title={action.label}
|
|
444
|
+
/>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<div width={768}>
|
|
448
|
+
<Button
|
|
449
|
+
size="Small"
|
|
450
|
+
type="Outlined"
|
|
451
|
+
leadingIcon={<Icon name={action.icon} />}
|
|
452
|
+
onClick={() => console.log(`${action.label} clicked`)}
|
|
453
|
+
>
|
|
454
|
+
{action.label}
|
|
455
|
+
</Button>
|
|
456
|
+
</div>
|
|
457
|
+
</ResponsiveComponent>
|
|
458
|
+
))}
|
|
459
|
+
</div>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### Complex Responsive Layout
|
|
465
|
+
|
|
466
|
+
```tsx
|
|
467
|
+
import { ResponsiveComponent, Button, Text, Input, IconButton, Icon } from '@delightui/components';
|
|
468
|
+
|
|
469
|
+
function ComplexResponsiveExample() {
|
|
470
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
471
|
+
|
|
472
|
+
return (
|
|
473
|
+
<div style={{
|
|
474
|
+
border: '1px solid #ccc',
|
|
475
|
+
borderRadius: '8px',
|
|
476
|
+
padding: '16px'
|
|
477
|
+
}}>
|
|
478
|
+
<ResponsiveComponent component={Text}>
|
|
479
|
+
<div width={0}>
|
|
480
|
+
<Text weight="bold" size="large" style={{ marginBottom: '16px' }}>
|
|
481
|
+
Search
|
|
482
|
+
</Text>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
<div width={768}>
|
|
486
|
+
<Text weight="bold" size="xlarge" style={{ marginBottom: '20px' }}>
|
|
487
|
+
Advanced Search
|
|
488
|
+
</Text>
|
|
489
|
+
</div>
|
|
490
|
+
</ResponsiveComponent>
|
|
491
|
+
|
|
492
|
+
<div style={{ display: 'flex', gap: '8px', marginBottom: '16px' }}>
|
|
493
|
+
<ResponsiveComponent component={Input}>
|
|
494
|
+
<div width={0}>
|
|
495
|
+
<Input
|
|
496
|
+
value={searchTerm}
|
|
497
|
+
onValueChange={setSearchTerm}
|
|
498
|
+
placeholder="Search..."
|
|
499
|
+
style={{ flex: 1 }}
|
|
500
|
+
/>
|
|
501
|
+
</div>
|
|
502
|
+
|
|
503
|
+
<div width={768}>
|
|
504
|
+
<Input
|
|
505
|
+
value={searchTerm}
|
|
506
|
+
onValueChange={setSearchTerm}
|
|
507
|
+
placeholder="Enter your search query..."
|
|
508
|
+
leadingIcon={<Icon name="SearchFilled" />}
|
|
509
|
+
style={{ flex: 1 }}
|
|
510
|
+
/>
|
|
511
|
+
</div>
|
|
512
|
+
</ResponsiveComponent>
|
|
513
|
+
|
|
514
|
+
<ResponsiveComponent component={Button}>
|
|
515
|
+
<div width={0}>
|
|
516
|
+
<IconButton
|
|
517
|
+
icon={<Icon name="SearchFilled" />}
|
|
518
|
+
onClick={() => console.log('Search:', searchTerm)}
|
|
519
|
+
/>
|
|
520
|
+
</div>
|
|
521
|
+
|
|
522
|
+
<div width={768}>
|
|
523
|
+
<Button
|
|
524
|
+
onClick={() => console.log('Search:', searchTerm)}
|
|
525
|
+
leadingIcon={<Icon name="SearchFilled" />}
|
|
526
|
+
>
|
|
527
|
+
Search
|
|
528
|
+
</Button>
|
|
529
|
+
</div>
|
|
530
|
+
</ResponsiveComponent>
|
|
531
|
+
</div>
|
|
532
|
+
|
|
533
|
+
<ResponsiveComponent component={Button}>
|
|
534
|
+
<div width={0}>
|
|
535
|
+
<Button
|
|
536
|
+
size="Small"
|
|
537
|
+
type="Ghost"
|
|
538
|
+
style={{ width: '100%' }}
|
|
539
|
+
onClick={() => console.log('Advanced options')}
|
|
540
|
+
>
|
|
541
|
+
More Options
|
|
542
|
+
</Button>
|
|
543
|
+
</div>
|
|
544
|
+
|
|
545
|
+
<div width={768}>
|
|
546
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
547
|
+
<Button
|
|
548
|
+
type="Ghost"
|
|
549
|
+
onClick={() => console.log('Advanced filters')}
|
|
550
|
+
>
|
|
551
|
+
Advanced Filters
|
|
552
|
+
</Button>
|
|
553
|
+
<Button
|
|
554
|
+
type="Ghost"
|
|
555
|
+
onClick={() => console.log('Saved searches')}
|
|
556
|
+
>
|
|
557
|
+
Saved Searches
|
|
558
|
+
</Button>
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
</ResponsiveComponent>
|
|
562
|
+
</div>
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Custom Breakpoints
|
|
568
|
+
|
|
569
|
+
```tsx
|
|
570
|
+
import { ResponsiveComponent, Button } from '@delightui/components';
|
|
571
|
+
|
|
572
|
+
function CustomBreakpointsExample() {
|
|
573
|
+
return (
|
|
574
|
+
<ResponsiveComponent component={Button}>
|
|
575
|
+
{/* Extra small devices (phones) */}
|
|
576
|
+
<div width={0}>
|
|
577
|
+
<Button size="Small" type="Filled" style={{ width: '100%' }}>
|
|
578
|
+
XS
|
|
579
|
+
</Button>
|
|
580
|
+
</div>
|
|
581
|
+
|
|
582
|
+
{/* Small devices (landscape phones) */}
|
|
583
|
+
<div width={576}>
|
|
584
|
+
<Button size="Medium" type="Filled" style={{ width: '100%' }}>
|
|
585
|
+
SM
|
|
586
|
+
</Button>
|
|
587
|
+
</div>
|
|
588
|
+
|
|
589
|
+
{/* Medium devices (tablets) */}
|
|
590
|
+
<div width={768}>
|
|
591
|
+
<Button size="Medium" type="Outlined">
|
|
592
|
+
MD
|
|
593
|
+
</Button>
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
{/* Large devices (desktops) */}
|
|
597
|
+
<div width={992}>
|
|
598
|
+
<Button size="Large" type="Outlined">
|
|
599
|
+
LG
|
|
600
|
+
</Button>
|
|
601
|
+
</div>
|
|
602
|
+
|
|
603
|
+
{/* Extra large devices (large desktops) */}
|
|
604
|
+
<div width={1200}>
|
|
605
|
+
<Button size="Large" type="Ghost">
|
|
606
|
+
XL
|
|
607
|
+
</Button>
|
|
608
|
+
</div>
|
|
609
|
+
</ResponsiveComponent>
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
```
|