daply-ui 0.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 CHANGED
@@ -1,73 +1,724 @@
1
- # React + TypeScript + Vite
1
+ # @daply-ui
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ A React component library for building beautiful, modern forms that integrate seamlessly with the Daply backend. Features professional styling inspired by Daply forms with automatic light/dark theme support.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## Features
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ - 🎨 **Modern Design** - Clean, professional styling matching Daply form aesthetics
8
+ - 🌓 **Theme Support** - Automatic light/dark theme adaptation
9
+ - ✅ **Built-in Validation** - Required fields, email, URL validation
10
+ - 🔧 **Custom Validation** - Define your own validation rules
11
+ - 🚀 **API Integration** - Automatic submission to Daply backend
12
+ - 📱 **Responsive** - Mobile-first design that works everywhere
13
+ - 💪 **TypeScript** - Full type safety and IntelliSense support
14
+ - 🎯 **Customizable** - Override any styling with custom classes
9
15
 
10
- ## React Compiler
16
+ ## Installation
11
17
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
18
+ ```bash
19
+ npm install daply-ui
20
+ ```
21
+
22
+ **No additional dependencies required!** The library uses inline styles, so it works out of the box without needing Tailwind CSS or any other CSS framework.
23
+
24
+ ## Components
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
+
36
+ ### Form Component
37
+
38
+ A fully-featured form component with built-in validation and Daply backend integration.
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
+
59
+ ## Basic Usage
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
+
127
+ ```tsx
128
+ import { Form } from 'daply-ui';
129
+
130
+ function App() {
131
+ return (
132
+ <Form
133
+ formId="contact-form"
134
+ siteId="my-website"
135
+ baseUrl="https://api.daply.com"
136
+ apiToken="your-api-token-here"
137
+ encryptedDbName="ff95d16da2340fe621ce03a61b9e6ee5b2c5dacbb12bd1914cb3dae6e5ad1bea73029edd7bf8bae1eefaa23cde52ea28"
138
+ theme="dark" // 'light', 'dark', or 'auto' (default)
139
+ fields={[
140
+ {
141
+ name: "name",
142
+ type: "text",
143
+ label: "Name",
144
+ required: true,
145
+ placeholder: "Enter your name"
146
+ },
147
+ {
148
+ name: "email",
149
+ type: "email",
150
+ label: "Email",
151
+ required: true,
152
+ placeholder: "your.email@example.com"
153
+ },
154
+ {
155
+ name: "subject",
156
+ type: "text",
157
+ label: "Subject",
158
+ required: true,
159
+ placeholder: "What's this about?"
160
+ },
161
+ {
162
+ name: "message",
163
+ type: "textarea",
164
+ label: "Message",
165
+ required: true,
166
+ rows: 6,
167
+ placeholder: "Your message here..."
168
+ }
169
+ ]}
170
+ onSuccess={(response) => {
171
+ console.log("Form submitted successfully!", response);
172
+ alert("Thank you for your submission!");
173
+ }}
174
+ onError={(error) => {
175
+ console.error("Form submission failed:", error);
176
+ alert("Something went wrong. Please try again.");
177
+ }}
178
+ />
179
+ );
180
+ }
181
+ ```
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
+
334
+ ## Advanced Usage
335
+
336
+ ### Custom Styling
13
337
 
14
- ## Expanding the ESLint configuration
338
+ ```tsx
339
+ <Form
340
+ formId="styled-form"
341
+ siteId="my-website"
342
+ baseUrl="https://api.daply.com"
343
+ apiToken="your-api-token-here"
344
+ fields={[
345
+ {
346
+ name: "username",
347
+ type: "text",
348
+ label: "Username",
349
+ required: true,
350
+ className: "custom-input-class"
351
+ }
352
+ ]}
353
+ formClassName="my-custom-form"
354
+ submitButtonClassName="my-custom-button"
355
+ submitButtonText="Send Message"
356
+ loadingText="Sending..."
357
+ />
358
+ ```
359
+
360
+ ### With Metadata and Tracking
15
361
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
362
+ ```tsx
363
+ <Form
364
+ formId="contact-form"
365
+ siteId="my-website"
366
+ baseUrl="https://api.daply.com"
367
+ apiToken="your-api-token-here"
368
+ pageUrl={window.location.href}
369
+ pageId="contact-page"
370
+ sessionId="user-session-id"
371
+ metadata={{
372
+ source: "contact page",
373
+ campaign: "organic",
374
+ userAgent: navigator.userAgent
375
+ }}
376
+ fields={[
377
+ // ... your fields
378
+ ]}
379
+ />
380
+ ```
17
381
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
382
+ ### Custom Validation
25
383
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
384
+ ```tsx
385
+ <Form
386
+ formId="signup-form"
387
+ siteId="my-website"
388
+ baseUrl="https://api.daply.com"
389
+ apiToken="your-api-token-here"
390
+ fields={[
391
+ {
392
+ name: "password",
393
+ type: "text",
394
+ label: "Password",
395
+ required: true,
396
+ validation: (value) => {
397
+ if (value.length < 8) {
398
+ return "Password must be at least 8 characters";
399
+ }
400
+ if (!/[A-Z]/.test(value)) {
401
+ return "Password must contain at least one uppercase letter";
402
+ }
403
+ if (!/[0-9]/.test(value)) {
404
+ return "Password must contain at least one number";
405
+ }
406
+ return undefined; // No error
407
+ }
408
+ }
409
+ ]}
410
+ />
411
+ ```
32
412
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
413
+ ### All Available Field Types
414
+
415
+ ```tsx
416
+ <Form
417
+ formId="all-fields-form"
418
+ siteId="my-website"
419
+ baseUrl="https://api.daply.com"
420
+ apiToken="your-api-token-here"
421
+ fields={[
422
+ {
423
+ name: "text_field",
424
+ type: "text",
425
+ label: "Text Input",
426
+ placeholder: "Enter text"
41
427
  },
42
- },
43
- ])
44
- ```
45
-
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
428
+ {
429
+ name: "email_field",
430
+ type: "email",
431
+ label: "Email Input",
432
+ placeholder: "email@example.com"
433
+ },
434
+ {
435
+ name: "number_field",
436
+ type: "number",
437
+ label: "Number Input",
438
+ placeholder: "123"
70
439
  },
440
+ {
441
+ name: "tel_field",
442
+ type: "tel",
443
+ label: "Phone Number",
444
+ placeholder: "+1 (555) 123-4567"
445
+ },
446
+ {
447
+ name: "url_field",
448
+ type: "url",
449
+ label: "Website URL",
450
+ placeholder: "https://example.com"
451
+ },
452
+ {
453
+ name: "textarea_field",
454
+ type: "textarea",
455
+ label: "Textarea",
456
+ rows: 5,
457
+ placeholder: "Enter multiple lines..."
458
+ }
459
+ ]}
460
+ />
461
+ ```
462
+
463
+ ## API Reference
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
+
484
+ ### FormConfig Props
485
+
486
+ | Prop | Type | Required | Description |
487
+ |------|------|----------|-------------|
488
+ | `formId` | `string` | Yes | Unique identifier for the form |
489
+ | `siteId` | `string` | Yes | Identifier for your site |
490
+ | `baseUrl` | `string` | Yes | Daply API base URL |
491
+ | `apiToken` | `string` | Yes | Bearer token for authentication |
492
+ | `encryptedDbName` | `string` | Yes | Encrypted database name for x-encrypted-db-name header |
493
+ | `fields` | `FormField[]` | Yes | Array of form fields (see below) |
494
+ | `theme` | `'light' \| 'dark' \| 'auto'` | No | Theme mode (default: 'auto') |
495
+ | `pageUrl` | `string` | No | Current page URL for tracking |
496
+ | `pageId` | `string` | No | Page identifier for tracking |
497
+ | `sessionId` | `string` | No | User session ID for tracking |
498
+ | `metadata` | `object` | No | Additional metadata to send with form |
499
+ | `onSuccess` | `(response: any) => void` | No | Callback when form submits successfully |
500
+ | `onError` | `(error: Error) => void` | No | Callback when form submission fails |
501
+ | `submitButtonText` | `string` | No | Submit button text (default: "Submit") |
502
+ | `submitButtonClassName` | `string` | No | Custom CSS class for submit button |
503
+ | `formClassName` | `string` | No | Custom CSS class for form wrapper |
504
+ | `loadingText` | `string` | No | Loading text (default: "Submitting...") |
505
+
506
+ ### FormField Props
507
+
508
+ | Prop | Type | Required | Description |
509
+ |------|------|----------|-------------|
510
+ | `name` | `string` | Yes | Field name (must be unique) |
511
+ | `type` | `FieldType` | Yes | Field type: `text`, `email`, `textarea`, `number`, `tel`, `url` |
512
+ | `label` | `string` | No | Label text displayed above field |
513
+ | `required` | `boolean` | No | Whether field is required (default: false) |
514
+ | `placeholder` | `string` | No | Placeholder text |
515
+ | `defaultValue` | `string` | No | Default value for the field |
516
+ | `rows` | `number` | No | Number of rows (for textarea only) |
517
+ | `className` | `string` | No | Custom CSS class for input element |
518
+ | `validation` | `(value: string) => string \| undefined` | No | Custom validation function |
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
+
557
+ ## Styling
558
+
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.
560
+
561
+ ### Theme Support
562
+
563
+ The components automatically adapt to light and dark modes:
564
+
565
+ ```tsx
566
+ // Light theme
567
+ <Form theme="light" {...props} />
568
+
569
+ // Dark theme (like Oasis Energy form)
570
+ <Form theme="dark" {...props} />
571
+
572
+ // Auto-detect user's system preference (default)
573
+ <Form theme="auto" {...props} />
574
+ ```
575
+
576
+ ### Default Styles
577
+ - **Form Container**: Clean white (light) / dark `#1a1a1a` (dark) with subtle shadows
578
+ - **Input Fields**: Large padding (16px), rounded corners, smooth transitions
579
+ - **Focus States**: Blue ring with smooth animations
580
+ - **Error States**: Red border and background tint
581
+ - **Submit Button**: Gradient blue with hover effects and uppercase text
582
+
583
+ ### Customization Options
584
+
585
+ You can add custom classes for additional styling:
586
+
587
+ ```tsx
588
+ <Form
589
+ formClassName="my-custom-form"
590
+ submitButtonClassName="my-custom-button"
591
+ fields={[
592
+ {
593
+ name: "email",
594
+ type: "email",
595
+ className: "my-custom-input"
596
+ // Add your own CSS classes
597
+ }
598
+ ]}
599
+ />
600
+ ```
601
+
602
+ **Note:** Inline styles take precedence, but you can use `!important` in your custom CSS to override them if needed.
603
+
604
+ ## TypeScript Support
605
+
606
+ Full TypeScript support with exported types:
607
+
608
+ ```tsx
609
+ import type {
610
+ FormConfig,
611
+ FormField,
612
+ FormSchema,
613
+ FormData,
614
+ FieldType,
615
+ FieldSchema,
616
+ DaplyFormSubmission,
617
+ MultiStepFormConfig,
618
+ FormStep,
619
+ VideoPlayerConfig
620
+ } from 'daply-ui';
621
+ ```
622
+
623
+ ## API Endpoint
624
+
625
+ The form submits to:
626
+ ```
627
+ POST {{baseUrl}}/api/v1/form-submissions
628
+ ```
629
+
630
+ With the following payload structure:
631
+
632
+ ```json
633
+ {
634
+ "formId": "contact-form",
635
+ "siteId": "my-website",
636
+ "formData": {
637
+ "name": "John Doe",
638
+ "email": "john@example.com",
639
+ "subject": "Inquiry",
640
+ "message": "This is a test message."
641
+ },
642
+ "formSchema": {
643
+ "name": { "type": "text", "required": true },
644
+ "email": { "type": "email", "required": true },
645
+ "subject": { "type": "text", "required": true },
646
+ "message": { "type": "textarea", "required": true }
71
647
  },
72
- ])
648
+ "pageUrl": "https://example.com/contact",
649
+ "pageId": "contact-page",
650
+ "sessionId": "sess_123456789",
651
+ "metadata": {
652
+ "source": "contact page",
653
+ "campaign": "organic"
654
+ }
655
+ }
656
+ ```
657
+
658
+ Headers:
73
659
  ```
660
+ Content-Type: application/json
661
+ Authorization: Bearer {your-api-token}
662
+ x-encrypted-db-name: {your-encrypted-db-name}
663
+ ```
664
+
665
+ **Important:** Store your `apiToken` and `encryptedDbName` securely in environment variables:
666
+
667
+ ```tsx
668
+ <Form
669
+ apiToken={process.env.REACT_APP_DAPLY_TOKEN}
670
+ encryptedDbName={process.env.REACT_APP_ENCRYPTED_DB_NAME}
671
+ // ... other props
672
+ />
673
+ ```
674
+
675
+ ## Features
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
680
+ - ✅ Built-in validation (required fields, email, URL)
681
+ - ✅ Custom validation functions
682
+ - ✅ Automatic form submission to Daply backend
683
+ - ✅ Loading states with smooth animations
684
+ - ✅ Error handling with user-friendly messages
685
+ - ✅ Success/error callbacks
686
+ - ✅ Full TypeScript support
687
+ - ✅ Modern, clean design inspired by Daply forms
688
+ - ✅ Light & Dark theme support (automatic)
689
+ - ✅ Customizable styling with Tailwind CSS
690
+ - ✅ Multiple field types (text, email, textarea, number, tel, url)
691
+ - ✅ Metadata and tracking support
692
+ - ✅ Smooth transitions and hover effects
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
701
+
702
+ ## Development
703
+
704
+ ```bash
705
+ # Install dependencies
706
+ npm install
707
+
708
+ # Run development server
709
+ npm run dev
710
+
711
+ # Build library
712
+ npm run build
713
+
714
+ # Publish to npm
715
+ npm run publish
716
+ ```
717
+
718
+ ## License
719
+
720
+ MIT
721
+
722
+ ## Support
723
+
724
+ For issues and questions, please visit our [GitHub repository](https://github.com/yourusername/daply-ui).