daply-ui 1.0.0 → 1.1.0
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 +316 -1
- package/dist/daply-ui.js +957 -163
- package/dist/daply-ui.umd.cjs +15 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,12 +23,107 @@ npm install daply-ui
|
|
|
23
23
|
|
|
24
24
|
## Components
|
|
25
25
|
|
|
26
|
+
### Button Component
|
|
27
|
+
|
|
28
|
+
A beautiful animated button component with shadow effects and hover animations:
|
|
29
|
+
- 🎨 **Animated Shadow** - 3D push-down effect on hover
|
|
30
|
+
- 🎯 **Multiple Variants** - Primary and secondary styles
|
|
31
|
+
- 📏 **Size Options** - Small, default, and large sizes
|
|
32
|
+
- 🎨 **Theme Support** - Automatic light/dark theme adaptation
|
|
33
|
+
- 🔘 **Icon Support** - Add icons to left or right
|
|
34
|
+
- ⚡ **Smooth Animations** - Transition effects on all interactions
|
|
35
|
+
|
|
26
36
|
### Form Component
|
|
27
37
|
|
|
28
38
|
A fully-featured form component with built-in validation and Daply backend integration.
|
|
29
39
|
|
|
40
|
+
### MultiStepForm Component
|
|
41
|
+
|
|
42
|
+
A powerful multi-step form component that breaks long forms into manageable steps with:
|
|
43
|
+
- ✅ **Step Navigation** - Forward and backward navigation with validation
|
|
44
|
+
- 📊 **Progress Indicator** - Visual step progress tracking
|
|
45
|
+
- 💾 **Data Persistence** - Form data persists across all steps
|
|
46
|
+
- ✅ **Step Validation** - Validates each step before allowing navigation
|
|
47
|
+
- 🎨 **Custom Styling** - Title and description for each step
|
|
48
|
+
|
|
49
|
+
### VideoPlayer Component
|
|
50
|
+
|
|
51
|
+
A modern video player component with support for multiple video sources:
|
|
52
|
+
- 🎬 **YouTube Support** - Embed YouTube videos with optimized parameters
|
|
53
|
+
- 📺 **HLS Streaming** - Support for HLS streams (including Daply transcoder)
|
|
54
|
+
- 🖼️ **Custom Thumbnails** - Display custom thumbnails before playback
|
|
55
|
+
- ⚡ **Performance Optimized** - Lazy loading and efficient video embedding
|
|
56
|
+
- 🎨 **Theme Support** - Automatic light/dark theme adaptation
|
|
57
|
+
- 🔗 **External Links** - Open videos in new tab
|
|
58
|
+
|
|
30
59
|
## Basic Usage
|
|
31
60
|
|
|
61
|
+
### Button Usage
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button } from 'daply-ui';
|
|
65
|
+
|
|
66
|
+
// Primary Button
|
|
67
|
+
function PrimaryButtonExample() {
|
|
68
|
+
return (
|
|
69
|
+
<Button
|
|
70
|
+
label="Click Me"
|
|
71
|
+
variant="primary"
|
|
72
|
+
theme="light"
|
|
73
|
+
onClick={() => alert('Clicked!')}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Secondary Button
|
|
79
|
+
function SecondaryButtonExample() {
|
|
80
|
+
return (
|
|
81
|
+
<Button
|
|
82
|
+
label="Secondary"
|
|
83
|
+
variant="secondary"
|
|
84
|
+
theme="dark"
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Button with Icon
|
|
90
|
+
function IconButtonExample() {
|
|
91
|
+
return (
|
|
92
|
+
<Button
|
|
93
|
+
label="Download"
|
|
94
|
+
variant="primary"
|
|
95
|
+
icon={<DownloadIcon />}
|
|
96
|
+
iconPosition="right"
|
|
97
|
+
size="large"
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Different Sizes
|
|
103
|
+
function SizeExamples() {
|
|
104
|
+
return (
|
|
105
|
+
<>
|
|
106
|
+
<Button label="Small" size="small" variant="primary" />
|
|
107
|
+
<Button label="Default" size="default" variant="primary" />
|
|
108
|
+
<Button label="Large" size="large" variant="primary" />
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Disabled State
|
|
114
|
+
function DisabledExample() {
|
|
115
|
+
return (
|
|
116
|
+
<Button
|
|
117
|
+
label="Disabled"
|
|
118
|
+
disabled={true}
|
|
119
|
+
variant="primary"
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Form Usage
|
|
126
|
+
|
|
32
127
|
```tsx
|
|
33
128
|
import { Form } from 'daply-ui';
|
|
34
129
|
|
|
@@ -85,6 +180,157 @@ function App() {
|
|
|
85
180
|
}
|
|
86
181
|
```
|
|
87
182
|
|
|
183
|
+
## Multi-Step Form Usage
|
|
184
|
+
|
|
185
|
+
Break long forms into manageable steps with automatic data persistence and step validation.
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import { MultiStepForm } from 'daply-ui';
|
|
189
|
+
|
|
190
|
+
function App() {
|
|
191
|
+
return (
|
|
192
|
+
<MultiStepForm
|
|
193
|
+
formId="signup"
|
|
194
|
+
siteId="my-website"
|
|
195
|
+
baseUrl="https://api.daply.com"
|
|
196
|
+
apiToken="your-api-token-here"
|
|
197
|
+
encryptedDbName="ff95d16da2340fe621ce03a61b9e6ee5b2c5dacbb12bd1914cb3dae6e5ad1bea73029edd7bf8bae1eefaa23cde52ea28"
|
|
198
|
+
theme="dark"
|
|
199
|
+
showStepIndicator={true} // Show visual progress indicator
|
|
200
|
+
steps={[
|
|
201
|
+
{
|
|
202
|
+
id: 'account',
|
|
203
|
+
title: 'Account Information',
|
|
204
|
+
description: 'Let\'s start with your basic account details',
|
|
205
|
+
fields: [
|
|
206
|
+
{
|
|
207
|
+
name: 'email',
|
|
208
|
+
type: 'email',
|
|
209
|
+
label: 'Email Address',
|
|
210
|
+
required: true,
|
|
211
|
+
placeholder: 'you@example.com'
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'password',
|
|
215
|
+
type: 'text',
|
|
216
|
+
label: 'Password',
|
|
217
|
+
required: true,
|
|
218
|
+
placeholder: 'Create a strong password',
|
|
219
|
+
validation: (value) => {
|
|
220
|
+
if (value.length < 8) {
|
|
221
|
+
return "Password must be at least 8 characters";
|
|
222
|
+
}
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: 'profile',
|
|
230
|
+
title: 'Personal Information',
|
|
231
|
+
description: 'Tell us a bit about yourself',
|
|
232
|
+
fields: [
|
|
233
|
+
{
|
|
234
|
+
name: 'firstName',
|
|
235
|
+
type: 'text',
|
|
236
|
+
label: 'First Name',
|
|
237
|
+
required: true,
|
|
238
|
+
placeholder: 'John'
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: 'lastName',
|
|
242
|
+
type: 'text',
|
|
243
|
+
label: 'Last Name',
|
|
244
|
+
required: true,
|
|
245
|
+
placeholder: 'Doe'
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
]}
|
|
250
|
+
submitButtonText="Create Account"
|
|
251
|
+
onSuccess={(response) => {
|
|
252
|
+
console.log("Form submitted successfully!", response);
|
|
253
|
+
alert("Account created successfully!");
|
|
254
|
+
}}
|
|
255
|
+
onError={(error) => {
|
|
256
|
+
console.error("Form submission failed:", error);
|
|
257
|
+
alert("Something went wrong. Please try again.");
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### MultiStepForm Features
|
|
265
|
+
|
|
266
|
+
- **Automatic Data Persistence**: Form data is preserved as users navigate between steps
|
|
267
|
+
- **Step Validation**: Each step is validated before allowing forward navigation
|
|
268
|
+
- **Visual Progress**: Optional step indicator shows users where they are in the process
|
|
269
|
+
- **Back Button**: Users can go back to previous steps to review or edit their data
|
|
270
|
+
- **Custom Step Content**: Each step can have its own title and description
|
|
271
|
+
- **All Form Features**: Supports all the same validation, theming, and customization options as the regular Form component
|
|
272
|
+
|
|
273
|
+
## Video Player Usage
|
|
274
|
+
|
|
275
|
+
Play YouTube videos, HLS streams, or custom video files with a beautiful, responsive player.
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import { VideoPlayer } from 'daply-ui';
|
|
279
|
+
|
|
280
|
+
// YouTube Video
|
|
281
|
+
function YouTubeVideoExample() {
|
|
282
|
+
return (
|
|
283
|
+
<VideoPlayer
|
|
284
|
+
youtubeUrl="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
285
|
+
title="My YouTube Video"
|
|
286
|
+
author="Creator Name"
|
|
287
|
+
theme="auto"
|
|
288
|
+
onVideoClick={() => console.log('Video clicked!')}
|
|
289
|
+
/>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// HLS Stream (Daply or any HLS)
|
|
294
|
+
function HLSStreamExample() {
|
|
295
|
+
return (
|
|
296
|
+
<VideoPlayer
|
|
297
|
+
videoUrl="https://storage.googleapis.com/daply-transcoder-storage/sample/manifest.m3u8"
|
|
298
|
+
title="Live HLS Stream"
|
|
299
|
+
author="Daply"
|
|
300
|
+
thumbnailUrl="https://example.com/thumbnail.jpg"
|
|
301
|
+
theme="dark"
|
|
302
|
+
autoplay={false}
|
|
303
|
+
/>
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Custom Video File
|
|
308
|
+
function CustomVideoExample() {
|
|
309
|
+
return (
|
|
310
|
+
<VideoPlayer
|
|
311
|
+
videoUrl="https://example.com/video.mp4"
|
|
312
|
+
title="Custom Video"
|
|
313
|
+
author="Your Company"
|
|
314
|
+
date={new Date().toISOString()}
|
|
315
|
+
thumbnailUrl="https://example.com/thumbnail.jpg"
|
|
316
|
+
theme="light"
|
|
317
|
+
/>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### VideoPlayer Features
|
|
323
|
+
|
|
324
|
+
- **Multiple Video Sources**: YouTube, HLS streams, or standard video files (mp4, webm, etc.)
|
|
325
|
+
- **Smart Detection**: Automatically detects video type and uses appropriate player
|
|
326
|
+
- **Custom Thumbnails**: Display custom preview images before playback
|
|
327
|
+
- **Lazy Loading**: Videos load only when needed for better performance
|
|
328
|
+
- **Theme Support**: Adapts to light, dark, or auto themes
|
|
329
|
+
- **Responsive Design**: Perfect 16:9 aspect ratio on all devices
|
|
330
|
+
- **External Links**: Built-in button to open videos in new tabs
|
|
331
|
+
- **Loading States**: Smooth loading indicators during video initialization
|
|
332
|
+
- **Optimized YouTube Embeds**: Pre-configured parameters for best performance
|
|
333
|
+
|
|
88
334
|
## Advanced Usage
|
|
89
335
|
|
|
90
336
|
### Custom Styling
|
|
@@ -216,6 +462,25 @@ function App() {
|
|
|
216
462
|
|
|
217
463
|
## API Reference
|
|
218
464
|
|
|
465
|
+
### Button Props
|
|
466
|
+
|
|
467
|
+
| Prop | Type | Required | Description |
|
|
468
|
+
|------|------|----------|-------------|
|
|
469
|
+
| `label` | `string` | No | Button text label |
|
|
470
|
+
| `children` | `ReactNode` | No | Custom button content (overrides label) |
|
|
471
|
+
| `disabled` | `boolean` | No | Whether button is disabled (default: false) |
|
|
472
|
+
| `color` | `string` | No | Color identifier (default: "blue-900") |
|
|
473
|
+
| `icon` | `ReactNode` | No | Icon to display with button |
|
|
474
|
+
| `iconPosition` | `'left' \| 'right'` | No | Icon position (default: 'right') |
|
|
475
|
+
| `className` | `string` | No | Additional CSS classes |
|
|
476
|
+
| `style` | `CSSProperties` | No | Inline styles object |
|
|
477
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | No | Button type (default: 'button') |
|
|
478
|
+
| `size` | `'small' \| 'default' \| 'large'` | No | Button size (default: 'default') |
|
|
479
|
+
| `variant` | `'primary' \| 'secondary'` | No | Button style variant (default: 'primary') |
|
|
480
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | No | Theme mode (default: 'auto') |
|
|
481
|
+
| `onClick` | `(e: MouseEvent) => void` | No | Click handler function |
|
|
482
|
+
| `isNoLabelForSm` | `boolean` | No | Hide label on small screens (default: false) |
|
|
483
|
+
|
|
219
484
|
### FormConfig Props
|
|
220
485
|
|
|
221
486
|
| Prop | Type | Required | Description |
|
|
@@ -252,6 +517,43 @@ function App() {
|
|
|
252
517
|
| `className` | `string` | No | Custom CSS class for input element |
|
|
253
518
|
| `validation` | `(value: string) => string \| undefined` | No | Custom validation function |
|
|
254
519
|
|
|
520
|
+
### MultiStepFormConfig Props
|
|
521
|
+
|
|
522
|
+
MultiStepFormConfig extends all FormConfig props (except `fields`) and adds:
|
|
523
|
+
|
|
524
|
+
| Prop | Type | Required | Description |
|
|
525
|
+
|------|------|----------|-------------|
|
|
526
|
+
| `steps` | `FormStep[]` | Yes | Array of form steps (see below) |
|
|
527
|
+
| `showStepIndicator` | `boolean` | No | Whether to show step progress indicator (default: true) |
|
|
528
|
+
|
|
529
|
+
**Note**: All other props from FormConfig (formId, siteId, baseUrl, apiToken, etc.) are also required.
|
|
530
|
+
|
|
531
|
+
### FormStep Props
|
|
532
|
+
|
|
533
|
+
| Prop | Type | Required | Description |
|
|
534
|
+
|------|------|----------|-------------|
|
|
535
|
+
| `id` | `string` | Yes | Unique identifier for the step |
|
|
536
|
+
| `title` | `string` | No | Title displayed at the top of the step |
|
|
537
|
+
| `description` | `string` | No | Description text displayed below the title |
|
|
538
|
+
| `fields` | `FormField[]` | Yes | Array of form fields for this step |
|
|
539
|
+
|
|
540
|
+
### VideoPlayerConfig Props
|
|
541
|
+
|
|
542
|
+
| Prop | Type | Required | Description |
|
|
543
|
+
|------|------|----------|-------------|
|
|
544
|
+
| `videoUrl` | `string \| null \| undefined` | No | Direct video URL (mp4, webm, HLS manifest) |
|
|
545
|
+
| `youtubeUrl` | `string \| null \| undefined` | No | YouTube video URL |
|
|
546
|
+
| `title` | `string` | Yes | Video title displayed in thumbnail and metadata |
|
|
547
|
+
| `author` | `string` | No | Author/creator name (default: "Daply") |
|
|
548
|
+
| `date` | `string` | No | ISO date string for video metadata |
|
|
549
|
+
| `thumbnailUrl` | `string \| null \| undefined` | No | Custom thumbnail image URL |
|
|
550
|
+
| `autoplay` | `boolean` | No | Whether to autoplay video (default: false) |
|
|
551
|
+
| `className` | `string` | No | Additional CSS classes |
|
|
552
|
+
| `onVideoClick` | `() => void` | No | Callback when video play button is clicked |
|
|
553
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | No | Theme mode (default: 'auto') |
|
|
554
|
+
|
|
555
|
+
**Note**: Either `videoUrl` or `youtubeUrl` must be provided.
|
|
556
|
+
|
|
255
557
|
## Styling
|
|
256
558
|
|
|
257
559
|
The components use **inline styles** for maximum compatibility and zero dependencies. They work out of the box without requiring Tailwind CSS or any other CSS framework.
|
|
@@ -311,7 +613,10 @@ import type {
|
|
|
311
613
|
FormData,
|
|
312
614
|
FieldType,
|
|
313
615
|
FieldSchema,
|
|
314
|
-
DaplyFormSubmission
|
|
616
|
+
DaplyFormSubmission,
|
|
617
|
+
MultiStepFormConfig,
|
|
618
|
+
FormStep,
|
|
619
|
+
VideoPlayerConfig
|
|
315
620
|
} from 'daply-ui';
|
|
316
621
|
```
|
|
317
622
|
|
|
@@ -369,6 +674,9 @@ x-encrypted-db-name: {your-encrypted-db-name}
|
|
|
369
674
|
|
|
370
675
|
## Features
|
|
371
676
|
|
|
677
|
+
- ✅ **Animated Buttons** - Beautiful 3D push-down effect with shadows
|
|
678
|
+
- ✅ **Multiple Button Variants** - Primary and secondary styles
|
|
679
|
+
- ✅ **Button Sizes** - Small, default, and large options
|
|
372
680
|
- ✅ Built-in validation (required fields, email, URL)
|
|
373
681
|
- ✅ Custom validation functions
|
|
374
682
|
- ✅ Automatic form submission to Daply backend
|
|
@@ -383,6 +691,13 @@ x-encrypted-db-name: {your-encrypted-db-name}
|
|
|
383
691
|
- ✅ Metadata and tracking support
|
|
384
692
|
- ✅ Smooth transitions and hover effects
|
|
385
693
|
- ✅ Mobile-responsive design
|
|
694
|
+
- ✅ **Multi-step forms** with automatic data persistence
|
|
695
|
+
- ✅ **Step validation** - validate each step before proceeding
|
|
696
|
+
- ✅ **Visual progress indicator** - show users their progress
|
|
697
|
+
- ✅ **Back/Next navigation** - easily navigate between steps
|
|
698
|
+
- ✅ **Video Player** - YouTube, HLS streams, and custom videos
|
|
699
|
+
- ✅ **Optimized Video Playback** - lazy loading and performance optimizations
|
|
700
|
+
- ✅ **Custom Thumbnails** - beautiful video previews
|
|
386
701
|
|
|
387
702
|
## Development
|
|
388
703
|
|