@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,614 @@
|
|
|
1
|
+
# WrapTextNodes
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
A utility component that wraps text nodes within its children with specified Text component styling. WrapTextNodes automatically identifies text content and applies consistent typography styling, making it perfect for scenarios where you want to ensure uniform text appearance across complex component hierarchies without manually wrapping every text element.
|
|
6
|
+
|
|
7
|
+
## Aliases
|
|
8
|
+
|
|
9
|
+
- WrapTextNodes
|
|
10
|
+
- Text Wrapper
|
|
11
|
+
- Typography Wrapper
|
|
12
|
+
- Auto Text Styler
|
|
13
|
+
|
|
14
|
+
## Props Breakdown
|
|
15
|
+
|
|
16
|
+
**Extends:** `TextProps` (excluding `className`)
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Required | Description |
|
|
19
|
+
|------|------|---------|----------|-------------|
|
|
20
|
+
| `type` | `TextTypeEnum` | `'BodyMedium'` | No | Typography type for wrapped text |
|
|
21
|
+
| `weight` | `TextWeightEnum \| number` | `'Regular'` | No | Font weight for wrapped text |
|
|
22
|
+
| `decoration` | `TextDecorationEnum` | `'None'` | No | Text decoration (underline, strikethrough) |
|
|
23
|
+
| `transform` | `TextTransformEnum` | `'None'` | No | Text transformation (uppercase, lowercase, etc.) |
|
|
24
|
+
| `italic` | `boolean` | `false` | No | Whether text should be italic |
|
|
25
|
+
| `wrap` | `boolean` | `true` | No | Whether text should wrap |
|
|
26
|
+
| `ellipsis` | `boolean` | `false` | No | Whether to show ellipsis for overflow |
|
|
27
|
+
| `as` | `string` | `'span'` | No | HTML element to render as |
|
|
28
|
+
| `children` | `ReactNode` | - | Yes | Content containing text nodes to wrap |
|
|
29
|
+
|
|
30
|
+
This component applies text styling to text nodes without adding standard HTML attributes.
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Basic Text Wrapping
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { WrapTextNodes, Card, Button } from '@delightui/components';
|
|
38
|
+
|
|
39
|
+
function BasicTextWrappingExample() {
|
|
40
|
+
return (
|
|
41
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
42
|
+
<Card style={{ padding: '20px' }}>
|
|
43
|
+
<WrapTextNodes weight="Bold" type="Heading3">
|
|
44
|
+
<div>
|
|
45
|
+
This text will be automatically wrapped with Bold Heading3 styling.
|
|
46
|
+
<Button style={{ margin: '0 8px' }}>Button stays unchanged</Button>
|
|
47
|
+
More text here will also get the same styling.
|
|
48
|
+
</div>
|
|
49
|
+
</WrapTextNodes>
|
|
50
|
+
</Card>
|
|
51
|
+
|
|
52
|
+
<Card style={{ padding: '20px' }}>
|
|
53
|
+
<WrapTextNodes weight="Light" decoration="Underline">
|
|
54
|
+
<div>
|
|
55
|
+
All text nodes in this container will be underlined and light weight.
|
|
56
|
+
<div>
|
|
57
|
+
Even nested text gets wrapped consistently.
|
|
58
|
+
<span>This span text too!</span>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</WrapTextNodes>
|
|
62
|
+
</Card>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Form Error Messages
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { WrapTextNodes, Form, FormField, Input, Button, Card } from '@delightui/components';
|
|
72
|
+
|
|
73
|
+
function FormErrorMessagesExample() {
|
|
74
|
+
const [errors, setErrors] = useState({
|
|
75
|
+
email: 'Please enter a valid email address',
|
|
76
|
+
password: 'Password must be at least 8 characters long'
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Card style={{ padding: '20px', maxWidth: '400px' }}>
|
|
81
|
+
<Form onSubmit={(data) => console.log(data)}>
|
|
82
|
+
<FormField name="email" label="Email" required invalid={!!errors.email}>
|
|
83
|
+
<Input inputType="Email" placeholder="Enter your email" />
|
|
84
|
+
<WrapTextNodes weight="Regular" type="BodySmall" style={{ color: '#d32f2f' }}>
|
|
85
|
+
<div style={{ marginTop: '4px' }}>
|
|
86
|
+
{errors.email}
|
|
87
|
+
</div>
|
|
88
|
+
</WrapTextNodes>
|
|
89
|
+
</FormField>
|
|
90
|
+
|
|
91
|
+
<FormField name="password" label="Password" required invalid={!!errors.password}>
|
|
92
|
+
<Input inputType="Password" placeholder="Enter your password" />
|
|
93
|
+
<WrapTextNodes weight="Regular" type="BodySmall" style={{ color: '#d32f2f' }}>
|
|
94
|
+
<div style={{ marginTop: '4px' }}>
|
|
95
|
+
{errors.password}
|
|
96
|
+
</div>
|
|
97
|
+
</WrapTextNodes>
|
|
98
|
+
</FormField>
|
|
99
|
+
|
|
100
|
+
<WrapTextNodes weight="Light" type="BodySmall" style={{ color: '#666' }}>
|
|
101
|
+
<div style={{ marginTop: '16px', marginBottom: '16px' }}>
|
|
102
|
+
By creating an account, you agree to our
|
|
103
|
+
<a href="/terms" style={{ margin: '0 4px' }}>Terms of Service</a>
|
|
104
|
+
and
|
|
105
|
+
<a href="/privacy" style={{ margin: '0 4px' }}>Privacy Policy</a>.
|
|
106
|
+
</div>
|
|
107
|
+
</WrapTextNodes>
|
|
108
|
+
|
|
109
|
+
<Button actionType="submit" style={{ width: '100%' }}>
|
|
110
|
+
Create Account
|
|
111
|
+
</Button>
|
|
112
|
+
</Form>
|
|
113
|
+
</Card>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Notification System
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { WrapTextNodes, Card, Button, Icon } from '@delightui/components';
|
|
122
|
+
|
|
123
|
+
function NotificationSystemExample() {
|
|
124
|
+
const [notifications, setNotifications] = useState([
|
|
125
|
+
{ id: 1, type: 'success', title: 'Success!', message: 'Your changes have been saved successfully.' },
|
|
126
|
+
{ id: 2, type: 'warning', title: 'Warning', message: 'Your session will expire in 5 minutes.' },
|
|
127
|
+
{ id: 3, type: 'error', title: 'Error', message: 'Failed to upload file. Please try again.' }
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
const getNotificationStyle = (type: string) => {
|
|
131
|
+
switch (type) {
|
|
132
|
+
case 'success':
|
|
133
|
+
return { backgroundColor: '#e8f5e8', borderLeft: '4px solid #4caf50' };
|
|
134
|
+
case 'warning':
|
|
135
|
+
return { backgroundColor: '#fff3e0', borderLeft: '4px solid #ff9800' };
|
|
136
|
+
case 'error':
|
|
137
|
+
return { backgroundColor: '#ffebee', borderLeft: '4px solid #f44336' };
|
|
138
|
+
default:
|
|
139
|
+
return { backgroundColor: '#f5f5f5', borderLeft: '4px solid #2196f3' };
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const getTextColor = (type: string) => {
|
|
144
|
+
switch (type) {
|
|
145
|
+
case 'success': return '#2e7d32';
|
|
146
|
+
case 'warning': return '#f57c00';
|
|
147
|
+
case 'error': return '#d32f2f';
|
|
148
|
+
default: return '#1976d2';
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<div style={{ maxWidth: '500px', display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
154
|
+
{notifications.map(notification => (
|
|
155
|
+
<Card key={notification.id} style={{ ...getNotificationStyle(notification.type), padding: '16px' }}>
|
|
156
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
|
|
157
|
+
<div style={{ flex: 1 }}>
|
|
158
|
+
<WrapTextNodes
|
|
159
|
+
weight="Bold"
|
|
160
|
+
type="BodyMedium"
|
|
161
|
+
style={{ color: getTextColor(notification.type) }}
|
|
162
|
+
>
|
|
163
|
+
<div style={{ marginBottom: '4px' }}>
|
|
164
|
+
{notification.title}
|
|
165
|
+
</div>
|
|
166
|
+
</WrapTextNodes>
|
|
167
|
+
|
|
168
|
+
<WrapTextNodes
|
|
169
|
+
weight="Regular"
|
|
170
|
+
type="BodySmall"
|
|
171
|
+
style={{ color: '#666' }}
|
|
172
|
+
>
|
|
173
|
+
<div>
|
|
174
|
+
{notification.message}
|
|
175
|
+
</div>
|
|
176
|
+
</WrapTextNodes>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<Button
|
|
180
|
+
size="Small"
|
|
181
|
+
type="Ghost"
|
|
182
|
+
onClick={() => setNotifications(prev => prev.filter(n => n.id !== notification.id))}
|
|
183
|
+
>
|
|
184
|
+
×
|
|
185
|
+
</Button>
|
|
186
|
+
</div>
|
|
187
|
+
</Card>
|
|
188
|
+
))}
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Documentation Content
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
import { WrapTextNodes, Card, Button } from '@delightui/components';
|
|
198
|
+
|
|
199
|
+
function DocumentationContentExample() {
|
|
200
|
+
return (
|
|
201
|
+
<div style={{ maxWidth: '800px', lineHeight: 1.6 }}>
|
|
202
|
+
<WrapTextNodes weight="Bold" type="Heading1">
|
|
203
|
+
<h1>Component Documentation</h1>
|
|
204
|
+
</WrapTextNodes>
|
|
205
|
+
|
|
206
|
+
<WrapTextNodes weight="Regular" type="BodyLarge">
|
|
207
|
+
<div style={{ marginBottom: '24px' }}>
|
|
208
|
+
This documentation provides comprehensive information about using our component library.
|
|
209
|
+
Follow the examples below to get started with implementation.
|
|
210
|
+
</div>
|
|
211
|
+
</WrapTextNodes>
|
|
212
|
+
|
|
213
|
+
<Card style={{ padding: '20px', marginBottom: '24px' }}>
|
|
214
|
+
<WrapTextNodes weight="SemiBold" type="Heading3">
|
|
215
|
+
<h3 style={{ marginBottom: '12px' }}>Installation</h3>
|
|
216
|
+
</WrapTextNodes>
|
|
217
|
+
|
|
218
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
219
|
+
<div style={{ marginBottom: '12px' }}>
|
|
220
|
+
Install the package using npm or yarn:
|
|
221
|
+
</div>
|
|
222
|
+
</WrapTextNodes>
|
|
223
|
+
|
|
224
|
+
<WrapTextNodes weight="Medium" type="BodyMedium" as="code">
|
|
225
|
+
<div style={{
|
|
226
|
+
backgroundColor: '#f5f5f5',
|
|
227
|
+
padding: '12px',
|
|
228
|
+
borderRadius: '4px',
|
|
229
|
+
fontFamily: 'monospace',
|
|
230
|
+
marginBottom: '16px'
|
|
231
|
+
}}>
|
|
232
|
+
npm install @delightui/components
|
|
233
|
+
</div>
|
|
234
|
+
</WrapTextNodes>
|
|
235
|
+
|
|
236
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
237
|
+
<div>
|
|
238
|
+
Then import the components you need:
|
|
239
|
+
</div>
|
|
240
|
+
</WrapTextNodes>
|
|
241
|
+
|
|
242
|
+
<WrapTextNodes weight="Medium" type="BodyMedium" as="code">
|
|
243
|
+
<div style={{
|
|
244
|
+
backgroundColor: '#f5f5f5',
|
|
245
|
+
padding: '12px',
|
|
246
|
+
borderRadius: '4px',
|
|
247
|
+
fontFamily: 'monospace'
|
|
248
|
+
}}>
|
|
249
|
+
import {`{ Button, Card, Text }`} from '@delightui/components';
|
|
250
|
+
</div>
|
|
251
|
+
</WrapTextNodes>
|
|
252
|
+
</Card>
|
|
253
|
+
|
|
254
|
+
<Card style={{ padding: '20px', marginBottom: '24px' }}>
|
|
255
|
+
<WrapTextNodes weight="SemiBold" type="Heading3">
|
|
256
|
+
<h3 style={{ marginBottom: '12px' }}>Quick Start</h3>
|
|
257
|
+
</WrapTextNodes>
|
|
258
|
+
|
|
259
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
260
|
+
<div style={{ marginBottom: '16px' }}>
|
|
261
|
+
Here's a simple example to get you started:
|
|
262
|
+
</div>
|
|
263
|
+
</WrapTextNodes>
|
|
264
|
+
|
|
265
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
266
|
+
<ol style={{ paddingLeft: '20px' }}>
|
|
267
|
+
<li style={{ marginBottom: '8px' }}>Import the necessary components</li>
|
|
268
|
+
<li style={{ marginBottom: '8px' }}>Create your component structure</li>
|
|
269
|
+
<li style={{ marginBottom: '8px' }}>Add event handlers and state management</li>
|
|
270
|
+
<li>Style your components using the provided props</li>
|
|
271
|
+
</ol>
|
|
272
|
+
</WrapTextNodes>
|
|
273
|
+
</Card>
|
|
274
|
+
|
|
275
|
+
<WrapTextNodes weight="Light" type="BodySmall" style={{ color: '#666' }}>
|
|
276
|
+
<div style={{ textAlign: 'center', marginTop: '40px' }}>
|
|
277
|
+
For more information, visit our
|
|
278
|
+
<a href="#" style={{ margin: '0 4px', color: '#1976d2' }}>GitHub repository</a>
|
|
279
|
+
or check out the
|
|
280
|
+
<a href="#" style={{ margin: '0 4px', color: '#1976d2' }}>complete API reference</a>.
|
|
281
|
+
</div>
|
|
282
|
+
</WrapTextNodes>
|
|
283
|
+
</div>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Dashboard Widget Content
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { WrapTextNodes, Card, ProgressBar, Button } from '@delightui/components';
|
|
292
|
+
|
|
293
|
+
function DashboardWidgetExample() {
|
|
294
|
+
const widgets = [
|
|
295
|
+
{
|
|
296
|
+
title: 'Sales Performance',
|
|
297
|
+
value: '$45,678',
|
|
298
|
+
change: '+12.5%',
|
|
299
|
+
description: 'Compared to last month',
|
|
300
|
+
trend: 'positive'
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
title: 'Active Users',
|
|
304
|
+
value: '2,847',
|
|
305
|
+
change: '-3.2%',
|
|
306
|
+
description: 'Online right now',
|
|
307
|
+
trend: 'negative'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
title: 'Conversion Rate',
|
|
311
|
+
value: '3.4%',
|
|
312
|
+
change: '+0.8%',
|
|
313
|
+
description: 'This week vs last week',
|
|
314
|
+
trend: 'positive'
|
|
315
|
+
}
|
|
316
|
+
];
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '20px' }}>
|
|
320
|
+
{widgets.map((widget, index) => (
|
|
321
|
+
<Card key={index} style={{ padding: '20px' }}>
|
|
322
|
+
<WrapTextNodes weight="Medium" type="BodyMedium" style={{ color: '#666' }}>
|
|
323
|
+
<div style={{ marginBottom: '8px' }}>
|
|
324
|
+
{widget.title}
|
|
325
|
+
</div>
|
|
326
|
+
</WrapTextNodes>
|
|
327
|
+
|
|
328
|
+
<WrapTextNodes weight="Bold" type="Heading2">
|
|
329
|
+
<div style={{ marginBottom: '4px' }}>
|
|
330
|
+
{widget.value}
|
|
331
|
+
</div>
|
|
332
|
+
</WrapTextNodes>
|
|
333
|
+
|
|
334
|
+
<WrapTextNodes
|
|
335
|
+
weight="SemiBold"
|
|
336
|
+
type="BodySmall"
|
|
337
|
+
style={{ color: widget.trend === 'positive' ? '#4caf50' : '#f44336' }}
|
|
338
|
+
>
|
|
339
|
+
<div style={{ marginBottom: '8px' }}>
|
|
340
|
+
{widget.change}
|
|
341
|
+
</div>
|
|
342
|
+
</WrapTextNodes>
|
|
343
|
+
|
|
344
|
+
<WrapTextNodes weight="Regular" type="BodySmall" style={{ color: '#888' }}>
|
|
345
|
+
<div style={{ marginBottom: '16px' }}>
|
|
346
|
+
{widget.description}
|
|
347
|
+
</div>
|
|
348
|
+
</WrapTextNodes>
|
|
349
|
+
|
|
350
|
+
<ProgressBar
|
|
351
|
+
value={Math.random() * 100}
|
|
352
|
+
max={100}
|
|
353
|
+
style={{ marginBottom: '12px' }}
|
|
354
|
+
/>
|
|
355
|
+
|
|
356
|
+
<Button size="Small" type="Outlined" style={{ width: '100%' }}>
|
|
357
|
+
View Details
|
|
358
|
+
</Button>
|
|
359
|
+
</Card>
|
|
360
|
+
))}
|
|
361
|
+
</div>
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Chat Message Styling
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
import { WrapTextNodes, Card } from '@delightui/components';
|
|
370
|
+
|
|
371
|
+
function ChatMessageStylingExample() {
|
|
372
|
+
const messages = [
|
|
373
|
+
{ id: 1, user: 'Alice', content: 'Hey everyone! How is the project going?', time: '2:30 PM', isOwn: false },
|
|
374
|
+
{ id: 2, user: 'You', content: 'Great progress! We finished the UI components and are working on the backend integration now.', time: '2:32 PM', isOwn: true },
|
|
375
|
+
{ id: 3, user: 'Bob', content: 'Awesome! Let me know if you need any help with the API endpoints.', time: '2:35 PM', isOwn: false },
|
|
376
|
+
{ id: 4, user: 'You', content: 'Thanks Bob! Will definitely reach out if needed.', time: '2:36 PM', isOwn: true }
|
|
377
|
+
];
|
|
378
|
+
|
|
379
|
+
return (
|
|
380
|
+
<div style={{ maxWidth: '500px', height: '400px', overflow: 'auto', padding: '16px', backgroundColor: '#f5f5f5' }}>
|
|
381
|
+
{messages.map(message => (
|
|
382
|
+
<div
|
|
383
|
+
key={message.id}
|
|
384
|
+
style={{
|
|
385
|
+
display: 'flex',
|
|
386
|
+
justifyContent: message.isOwn ? 'flex-end' : 'flex-start',
|
|
387
|
+
marginBottom: '12px'
|
|
388
|
+
}}
|
|
389
|
+
>
|
|
390
|
+
<Card
|
|
391
|
+
style={{
|
|
392
|
+
padding: '12px 16px',
|
|
393
|
+
maxWidth: '70%',
|
|
394
|
+
backgroundColor: message.isOwn ? '#2196f3' : '#ffffff',
|
|
395
|
+
color: message.isOwn ? 'white' : 'black'
|
|
396
|
+
}}
|
|
397
|
+
>
|
|
398
|
+
{!message.isOwn && (
|
|
399
|
+
<WrapTextNodes
|
|
400
|
+
weight="SemiBold"
|
|
401
|
+
type="BodySmall"
|
|
402
|
+
style={{ color: message.isOwn ? '#e3f2fd' : '#1976d2' }}
|
|
403
|
+
>
|
|
404
|
+
<div style={{ marginBottom: '4px' }}>
|
|
405
|
+
{message.user}
|
|
406
|
+
</div>
|
|
407
|
+
</WrapTextNodes>
|
|
408
|
+
)}
|
|
409
|
+
|
|
410
|
+
<WrapTextNodes
|
|
411
|
+
weight="Regular"
|
|
412
|
+
type="BodyMedium"
|
|
413
|
+
style={{ color: message.isOwn ? 'white' : 'black' }}
|
|
414
|
+
>
|
|
415
|
+
<div style={{ marginBottom: '4px' }}>
|
|
416
|
+
{message.content}
|
|
417
|
+
</div>
|
|
418
|
+
</WrapTextNodes>
|
|
419
|
+
|
|
420
|
+
<WrapTextNodes
|
|
421
|
+
weight="Light"
|
|
422
|
+
type="BodySmall"
|
|
423
|
+
style={{ color: message.isOwn ? '#bbdefb' : '#666' }}
|
|
424
|
+
>
|
|
425
|
+
<div style={{ textAlign: 'right' }}>
|
|
426
|
+
{message.time}
|
|
427
|
+
</div>
|
|
428
|
+
</WrapTextNodes>
|
|
429
|
+
</Card>
|
|
430
|
+
</div>
|
|
431
|
+
))}
|
|
432
|
+
</div>
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Article Content Formatting
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
import { WrapTextNodes, Card } from '@delightui/components';
|
|
441
|
+
|
|
442
|
+
function ArticleContentExample() {
|
|
443
|
+
return (
|
|
444
|
+
<Card style={{ padding: '40px', maxWidth: '700px', lineHeight: 1.7 }}>
|
|
445
|
+
<WrapTextNodes weight="Bold" type="Heading1">
|
|
446
|
+
<h1 style={{ marginBottom: '16px' }}>The Future of Web Development</h1>
|
|
447
|
+
</WrapTextNodes>
|
|
448
|
+
|
|
449
|
+
<WrapTextNodes weight="Light" type="BodyMedium" style={{ color: '#666' }}>
|
|
450
|
+
<div style={{ marginBottom: '24px' }}>
|
|
451
|
+
Published on January 15, 2024 • 5 min read
|
|
452
|
+
</div>
|
|
453
|
+
</WrapTextNodes>
|
|
454
|
+
|
|
455
|
+
<WrapTextNodes weight="Regular" type="BodyLarge">
|
|
456
|
+
<div style={{ marginBottom: '20px' }}>
|
|
457
|
+
Web development continues to evolve at a rapid pace, bringing new technologies, frameworks, and methodologies that reshape how we build digital experiences.
|
|
458
|
+
</div>
|
|
459
|
+
</WrapTextNodes>
|
|
460
|
+
|
|
461
|
+
<WrapTextNodes weight="SemiBold" type="Heading3">
|
|
462
|
+
<h3 style={{ marginBottom: '12px', marginTop: '32px' }}>Component-Driven Development</h3>
|
|
463
|
+
</WrapTextNodes>
|
|
464
|
+
|
|
465
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
466
|
+
<div style={{ marginBottom: '16px' }}>
|
|
467
|
+
Modern web development has shifted towards component-driven architectures. This approach offers several key benefits:
|
|
468
|
+
</div>
|
|
469
|
+
</WrapTextNodes>
|
|
470
|
+
|
|
471
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
472
|
+
<ul style={{ paddingLeft: '24px', marginBottom: '20px' }}>
|
|
473
|
+
<li style={{ marginBottom: '8px' }}>Improved code reusability and maintainability</li>
|
|
474
|
+
<li style={{ marginBottom: '8px' }}>Better separation of concerns</li>
|
|
475
|
+
<li style={{ marginBottom: '8px' }}>Enhanced testing capabilities</li>
|
|
476
|
+
<li>Faster development cycles</li>
|
|
477
|
+
</ul>
|
|
478
|
+
</WrapTextNodes>
|
|
479
|
+
|
|
480
|
+
<WrapTextNodes weight="SemiBold" type="Heading3">
|
|
481
|
+
<h3 style={{ marginBottom: '12px', marginTop: '32px' }}>Performance Optimization</h3>
|
|
482
|
+
</WrapTextNodes>
|
|
483
|
+
|
|
484
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
485
|
+
<div style={{ marginBottom: '16px' }}>
|
|
486
|
+
Performance remains a critical factor in web development. Key areas of focus include:
|
|
487
|
+
</div>
|
|
488
|
+
</WrapTextNodes>
|
|
489
|
+
|
|
490
|
+
<WrapTextNodes weight="Medium" type="BodyMedium">
|
|
491
|
+
<div style={{
|
|
492
|
+
backgroundColor: '#f8f9fa',
|
|
493
|
+
padding: '16px',
|
|
494
|
+
borderLeft: '4px solid #2196f3',
|
|
495
|
+
marginBottom: '20px'
|
|
496
|
+
}}>
|
|
497
|
+
"Performance is not just about speed—it's about creating seamless user experiences that feel natural and responsive."
|
|
498
|
+
</div>
|
|
499
|
+
</WrapTextNodes>
|
|
500
|
+
|
|
501
|
+
<WrapTextNodes weight="Regular" type="BodyMedium">
|
|
502
|
+
<div style={{ marginBottom: '20px' }}>
|
|
503
|
+
As we look towards the future, emerging technologies like WebAssembly, Progressive Web Apps, and advanced build tools will continue to push the boundaries of what's possible on the web.
|
|
504
|
+
</div>
|
|
505
|
+
</WrapTextNodes>
|
|
506
|
+
|
|
507
|
+
<WrapTextNodes weight="Light" type="BodySmall" style={{ color: '#666' }}>
|
|
508
|
+
<div style={{
|
|
509
|
+
textAlign: 'center',
|
|
510
|
+
marginTop: '40px',
|
|
511
|
+
paddingTop: '20px',
|
|
512
|
+
borderTop: '1px solid #eee'
|
|
513
|
+
}}>
|
|
514
|
+
Share this article on
|
|
515
|
+
<a href="#" style={{ margin: '0 4px', color: '#1976d2' }}>Twitter</a>
|
|
516
|
+
or
|
|
517
|
+
<a href="#" style={{ margin: '0 4px', color: '#1976d2' }}>LinkedIn</a>
|
|
518
|
+
</div>
|
|
519
|
+
</WrapTextNodes>
|
|
520
|
+
</Card>
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Dynamic Content Styling
|
|
526
|
+
|
|
527
|
+
```tsx
|
|
528
|
+
import { WrapTextNodes, Card, Button } from '@delightui/components';
|
|
529
|
+
|
|
530
|
+
function DynamicContentStylingExample() {
|
|
531
|
+
const [textStyle, setTextStyle] = useState({
|
|
532
|
+
weight: 'Regular' as const,
|
|
533
|
+
type: 'BodyMedium' as const,
|
|
534
|
+
decoration: 'None' as const,
|
|
535
|
+
transform: 'None' as const
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
const content = `This is dynamic content that changes its styling based on the controls below.
|
|
539
|
+
You can see how WrapTextNodes applies the styling to all text within this container,
|
|
540
|
+
including this paragraph and any other text elements that might be nested inside.`;
|
|
541
|
+
|
|
542
|
+
return (
|
|
543
|
+
<div style={{ maxWidth: '600px' }}>
|
|
544
|
+
<Card style={{ padding: '20px', marginBottom: '20px' }}>
|
|
545
|
+
<WrapTextNodes
|
|
546
|
+
weight={textStyle.weight}
|
|
547
|
+
type={textStyle.type}
|
|
548
|
+
decoration={textStyle.decoration}
|
|
549
|
+
transform={textStyle.transform}
|
|
550
|
+
>
|
|
551
|
+
<div>
|
|
552
|
+
{content}
|
|
553
|
+
<div style={{ marginTop: '16px' }}>
|
|
554
|
+
This is additional nested content that will also receive the same styling.
|
|
555
|
+
</div>
|
|
556
|
+
</div>
|
|
557
|
+
</WrapTextNodes>
|
|
558
|
+
</Card>
|
|
559
|
+
|
|
560
|
+
<Card style={{ padding: '20px' }}>
|
|
561
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px' }}>
|
|
562
|
+
<div>
|
|
563
|
+
<label style={{ display: 'block', marginBottom: '8px', fontWeight: 'bold' }}>Weight:</label>
|
|
564
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
|
|
565
|
+
{['Light', 'Regular', 'Medium', 'SemiBold', 'Bold'].map(weight => (
|
|
566
|
+
<Button
|
|
567
|
+
key={weight}
|
|
568
|
+
size="Small"
|
|
569
|
+
type={textStyle.weight === weight ? 'Filled' : 'Outlined'}
|
|
570
|
+
onClick={() => setTextStyle(prev => ({ ...prev, weight: weight as any }))}
|
|
571
|
+
>
|
|
572
|
+
{weight}
|
|
573
|
+
</Button>
|
|
574
|
+
))}
|
|
575
|
+
</div>
|
|
576
|
+
</div>
|
|
577
|
+
|
|
578
|
+
<div>
|
|
579
|
+
<label style={{ display: 'block', marginBottom: '8px', fontWeight: 'bold' }}>Decoration:</label>
|
|
580
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
|
|
581
|
+
{['None', 'Underline', 'Strikethrough'].map(decoration => (
|
|
582
|
+
<Button
|
|
583
|
+
key={decoration}
|
|
584
|
+
size="Small"
|
|
585
|
+
type={textStyle.decoration === decoration ? 'Filled' : 'Outlined'}
|
|
586
|
+
onClick={() => setTextStyle(prev => ({ ...prev, decoration: decoration as any }))}
|
|
587
|
+
>
|
|
588
|
+
{decoration}
|
|
589
|
+
</Button>
|
|
590
|
+
))}
|
|
591
|
+
</div>
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
<div>
|
|
595
|
+
<label style={{ display: 'block', marginBottom: '8px', fontWeight: 'bold' }}>Transform:</label>
|
|
596
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
|
|
597
|
+
{['None', 'Uppercase', 'Lowercase', 'Capitalize'].map(transform => (
|
|
598
|
+
<Button
|
|
599
|
+
key={transform}
|
|
600
|
+
size="Small"
|
|
601
|
+
type={textStyle.transform === transform ? 'Filled' : 'Outlined'}
|
|
602
|
+
onClick={() => setTextStyle(prev => ({ ...prev, transform: transform as any }))}
|
|
603
|
+
>
|
|
604
|
+
{transform}
|
|
605
|
+
</Button>
|
|
606
|
+
))}
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
</div>
|
|
610
|
+
</Card>
|
|
611
|
+
</div>
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delightui/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.107",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "vite",
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
"dist/assets",
|
|
96
96
|
"dist/cjs",
|
|
97
97
|
"dist/esm",
|
|
98
|
-
"dist/index.d.ts"
|
|
98
|
+
"dist/index.d.ts",
|
|
99
|
+
"docs"
|
|
99
100
|
],
|
|
100
101
|
"types": "dist/index.d.ts"
|
|
101
102
|
}
|