@w3payments/react 1.4.0 → 1.5.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
@@ -260,7 +260,8 @@ Customize the widget appearance with props:
260
260
  subtitle="CHOOSE PAYMENT METHOD"
261
261
  logo="/your-logo.png"
262
262
  showAmount={false} // Hide amount section
263
- showHeader={false} // Hide header with title/logo
263
+ // Logo/title displays automatically when provided
264
+ // Description displays when provided, independent of logo
264
265
  // ... other props
265
266
  />
266
267
  ```
@@ -284,33 +285,55 @@ import { W3PaymentWidget } from '@w3payments/react';
284
285
  #### Custom Themes
285
286
 
286
287
  ```tsx
287
- import type { W3Appearance } from '@w3payments/common';
288
+ import type { W3Appearance } from '@w3payments/react';
288
289
 
289
290
  const customTheme: W3Appearance = {
290
291
  variables: {
291
292
  // Brand colors
292
- primary: '#ff6b35', // Orange brand color
293
- background: '#f8f9fa', // Light gray background
294
- text: '#2d3748', // Dark text
295
- textSecondary: '#718096', // Muted text
293
+ primary: '#ff6b35', // Orange brand color
294
+
295
+ // Main layout backgrounds
296
+ mainBackground: '#ffffff', // Outer container + footer background
297
+ innerBackground: '#f8f9fa', // Inner container (amount/methods section)
298
+ cardBackground: '#ffffff', // Payment method row background
299
+
300
+ // Text colors (component-based)
301
+ primaryText: '#2d3748', // Main text color (logo/headers)
302
+ secondaryText: '#718096', // Secondary text (method descriptions, USD amounts)
303
+ descriptionText: '#718096', // Widget description text
304
+ amountText: '#2d3748', // Payment amount text
305
+ subtitleText: '#718096', // "CHOOSE A PAYMENT METHOD" text
306
+ cardText: '#2d3748', // Payment method card text
307
+ cardSecondaryText: '#718096', // Payment method card subtitle text
308
+ usdText: '#718096', // USD amount text color
309
+ footerText: '#718096', // Footer text color
310
+
311
+ // QR screen specific colors
312
+ qrAddressBackground: '#f8f9fa', // QR address section background
313
+ qrAddressText: '#2d3748', // QR address text color
314
+ qrInstructionsBackground: '#f8f9fa', // QR instructions background
315
+ qrInstructionsText: '#718096', // QR instructions text color
316
+ qrCardBackground: '#ffffff', // QR network/token cards background
317
+ qrCardText: '#2d3748', // QR network/token cards text
296
318
 
297
319
  // Status colors
298
- success: '#38a169', // Green
299
- danger: '#e53e3e', // Red
300
- warning: '#dd6b20', // Orange
301
- border: '#e2e8f0', // Light border
320
+ success: '#38a169', // Green
321
+ danger: '#e53e3e', // Red
322
+ warning: '#dd6b20', // Orange
323
+ borderColor: '#e2e8f0', // Borders and dividers
324
+ info: '#3182ce', // Info background
302
325
 
303
326
  // Typography
304
327
  fontFamily: 'Inter, system-ui, sans-serif',
305
328
  fontSizeBase: '14px',
306
329
  fontSizeSmall: '12px',
307
- fontSizeLarge: '28px',
308
- fontWeightNormal: '500',
330
+ fontSizeLarge: '32px',
331
+ fontWeightNormal: '400',
309
332
 
310
333
  // Layout
311
- spacingUnit: '6px', // Increased spacing
312
- borderRadius: '12px', // More rounded
313
- buttonRadius: '8px' // Button radius
334
+ spacingUnit: '4px', // Base spacing unit
335
+ borderRadius: '8px', // Default border radius
336
+ buttonRadius: '6px' // Button border radius
314
337
  }
315
338
  };
316
339
 
@@ -322,15 +345,51 @@ const customTheme: W3Appearance = {
322
345
  ```tsx
323
346
  const darkTheme: W3Appearance = {
324
347
  variables: {
325
- primary: '#0085FF', // Blue accent
326
- background: '#1a202c', // Dark background
327
- text: '#f7fafc', // Light text
328
- textSecondary: '#a0aec0', // Muted light text
329
- success: '#48bb78', // Bright green
330
- danger: '#f56565', // Bright red
331
- warning: '#ed8936', // Bright orange
332
- border: '#4a5568', // Dark border
333
- fontFamily: 'SF Pro Display, system-ui, sans-serif'
348
+ // Brand colors
349
+ primary: '#0085FF', // Blue accent
350
+
351
+ // Dark layout backgrounds
352
+ mainBackground: '#14171D', // Dark outer container + footer
353
+ innerBackground: '#1a1d24', // Dark inner container
354
+ cardBackground: '#1f222a', // Dark payment method cards
355
+
356
+ // Light text on dark backgrounds
357
+ primaryText: '#C9CED8', // Light headers/logo
358
+ secondaryText: '#8C99AD', // Muted light text
359
+ descriptionText: '#8C99AD', // Light description text
360
+ amountText: '#C9CED8', // Light payment amount
361
+ subtitleText: '#8C99AD', // Light subtitle
362
+ cardText: '#C9CED8', // Light card text
363
+ cardSecondaryText: '#8C99AD', // Muted card text
364
+ usdText: '#8C99AD', // Light USD amounts
365
+ footerText: '#8C99AD', // Light footer text
366
+
367
+ // QR screen dark theme
368
+ qrAddressBackground: '#2B3039', // Dark QR address section
369
+ qrAddressText: '#C9CED8', // Light QR address text
370
+ qrInstructionsBackground: '#2B3039', // Dark QR instructions
371
+ qrInstructionsText: '#8C99AD', // Light QR instructions text
372
+ qrCardBackground: '#1f222a', // Dark QR cards
373
+ qrCardText: '#C9CED8', // Light QR card text
374
+
375
+ // Bright status colors for dark theme
376
+ success: '#48bb78', // Bright green
377
+ danger: '#F23154', // Bright red
378
+ warning: '#ed8936', // Bright orange
379
+ borderColor: '#2B3039', // Dark borders
380
+ info: '#1e3a5f', // Dark info background
381
+
382
+ // Typography
383
+ fontFamily: 'SF Pro Display, system-ui, sans-serif',
384
+ fontSizeBase: '14px',
385
+ fontSizeSmall: '12px',
386
+ fontSizeLarge: '32px',
387
+ fontWeightNormal: '400',
388
+
389
+ // Layout
390
+ spacingUnit: '4px',
391
+ borderRadius: '8px',
392
+ buttonRadius: '6px'
334
393
  }
335
394
  };
336
395
 
@@ -404,23 +463,195 @@ const brandTheme: W3Appearance = {
404
463
  variables: {
405
464
  // Use your brand colors
406
465
  primary: 'var(--brand-primary, #2563eb)',
407
- background: 'var(--surface-primary, #ffffff)',
408
- text: 'var(--text-primary, #1a1a1a)',
409
- textSecondary: 'var(--text-secondary, #6b7280)',
466
+
467
+ // Map to your design system backgrounds
468
+ mainBackground: 'var(--surface-primary, #ffffff)',
469
+ innerBackground: 'var(--surface-secondary, #f8f9fa)',
470
+ cardBackground: 'var(--surface-primary, #ffffff)',
471
+
472
+ // Map to your text color system
473
+ primaryText: 'var(--text-primary, #1a1a1a)',
474
+ secondaryText: 'var(--text-secondary, #6b7280)',
475
+ descriptionText: 'var(--text-muted, #6b7280)',
476
+ amountText: 'var(--text-primary, #1a1a1a)',
477
+ subtitleText: 'var(--text-secondary, #6b7280)',
478
+ cardText: 'var(--text-primary, #1a1a1a)',
479
+ cardSecondaryText: 'var(--text-muted, #6b7280)',
480
+ usdText: 'var(--text-secondary, #6b7280)',
481
+ footerText: 'var(--text-secondary, #6b7280)',
482
+
483
+ // QR screen brand colors
484
+ qrAddressBackground: 'var(--surface-secondary, #f8f9fa)',
485
+ qrAddressText: 'var(--text-primary, #1a1a1a)',
486
+ qrInstructionsBackground: 'var(--surface-tertiary, #e5e7eb)',
487
+ qrInstructionsText: 'var(--text-secondary, #6b7280)',
488
+ qrCardBackground: 'var(--surface-primary, #ffffff)',
489
+ qrCardText: 'var(--text-primary, #1a1a1a)',
490
+
491
+ // Status colors from design system
492
+ success: 'var(--status-success, #16a34a)',
493
+ danger: 'var(--status-error, #dc2626)',
494
+ warning: 'var(--status-warning, #ca8a04)',
495
+ borderColor: 'var(--border-default, #e5e7eb)',
496
+ info: 'var(--status-info, #3b82f6)',
410
497
 
411
498
  // Match your typography
412
499
  fontFamily: 'var(--font-family, Inter, sans-serif)',
413
500
  fontSizeBase: 'var(--text-sm, 14px)',
501
+ fontSizeSmall: 'var(--text-xs, 12px)',
502
+ fontSizeLarge: 'var(--text-2xl, 32px)',
503
+ fontWeightNormal: 'var(--font-normal, 400)',
414
504
 
415
505
  // Match your spacing scale
416
506
  spacingUnit: 'var(--spacing-1, 4px)',
417
- borderRadius: 'var(--radius-md, 8px)'
507
+ borderRadius: 'var(--radius-md, 8px)',
508
+ buttonRadius: 'var(--radius-sm, 6px)'
418
509
  }
419
510
  };
420
511
 
421
512
  <W3PaymentWidget appearance={brandTheme} />
422
513
  ```
423
514
 
515
+ ### Complete W3Appearance API Reference
516
+
517
+ The W3Appearance API provides comprehensive theming control with component-based variable naming for precise styling.
518
+
519
+ #### Background Colors
520
+ ```tsx
521
+ {
522
+ // Main layout structure
523
+ mainBackground: string; // Outer container + footer background
524
+ innerBackground: string; // Inner container (amount/methods section)
525
+ cardBackground: string; // Payment method row background
526
+
527
+ // QR screen specific backgrounds
528
+ qrAddressBackground: string; // QR address section background
529
+ qrInstructionsBackground: string; // QR instructions section background
530
+ qrCardBackground: string; // QR network/token cards background
531
+ }
532
+ ```
533
+
534
+ #### Text Colors
535
+ ```tsx
536
+ {
537
+ // Main content text colors
538
+ primaryText: string; // Main text (logo, headers)
539
+ secondaryText: string; // Secondary text (descriptions, labels)
540
+ descriptionText: string; // Widget description text
541
+ amountText: string; // Payment amount display
542
+ subtitleText: string; // Section subtitles
543
+
544
+ // Payment method cards
545
+ cardText: string; // Payment method primary text
546
+ cardSecondaryText: string; // Payment method subtitle text
547
+
548
+ // Specific element colors
549
+ usdText: string; // USD conversion amounts
550
+ footerText: string; // Footer text
551
+
552
+ // QR screen text colors
553
+ qrAddressText: string; // QR address text
554
+ qrInstructionsText: string; // QR instructions text
555
+ qrCardText: string; // QR network/token cards text
556
+ }
557
+ ```
558
+
559
+ #### Status & Accent Colors
560
+ ```tsx
561
+ {
562
+ primary: string; // Brand/accent color
563
+ success: string; // Success states (green)
564
+ danger: string; // Error states (red)
565
+ warning: string; // Warning states (orange)
566
+ info: string; // Info backgrounds (blue)
567
+ borderColor: string; // Borders and dividers
568
+ }
569
+ ```
570
+
571
+ #### Typography
572
+ ```tsx
573
+ {
574
+ fontFamily: string; // Primary font stack
575
+ fontSizeBase: string; // Default text size (14px)
576
+ fontSizeSmall: string; // Small text size (12px)
577
+ fontSizeLarge: string; // Large text size (32px)
578
+ fontWeightNormal: string; // Default font weight (400)
579
+ }
580
+ ```
581
+
582
+ #### Layout & Spacing
583
+ ```tsx
584
+ {
585
+ spacingUnit: string; // Base spacing unit (4px)
586
+ borderRadius: string; // Default border radius (8px)
587
+ buttonRadius: string; // Button border radius (6px)
588
+ }
589
+ ```
590
+
591
+ #### Real-World Usage Examples
592
+
593
+ **E-commerce Integration:**
594
+ ```tsx
595
+ const ecommerceTheme: W3Appearance = {
596
+ variables: {
597
+ // Match your site's header/footer
598
+ mainBackground: '#ffffff',
599
+ footerText: '#6b7280',
600
+
601
+ // Match product card styling
602
+ cardBackground: '#ffffff',
603
+ cardText: '#1f2937',
604
+ borderRadius: '12px',
605
+
606
+ // Use your brand accent
607
+ primary: '#3b82f6',
608
+ amountText: '#059669', // Green for price
609
+ }
610
+ };
611
+ ```
612
+
613
+ **DeFi Application:**
614
+ ```tsx
615
+ const defiTheme: W3Appearance = {
616
+ variables: {
617
+ // Dark crypto aesthetic
618
+ mainBackground: '#0f172a',
619
+ innerBackground: '#1e293b',
620
+ cardBackground: '#334155',
621
+
622
+ // Bright accent for crypto
623
+ primary: '#00d4aa',
624
+ primaryText: '#f1f5f9',
625
+ amountText: '#00d4aa',
626
+
627
+ // Crypto-friendly fonts
628
+ fontFamily: 'JetBrains Mono, monospace',
629
+ borderRadius: '4px', // Sharp edges
630
+ }
631
+ };
632
+ ```
633
+
634
+ **Banking Application:**
635
+ ```tsx
636
+ const bankingTheme: W3Appearance = {
637
+ variables: {
638
+ // Conservative, trustworthy colors
639
+ mainBackground: '#fefefe',
640
+ primary: '#1e40af', // Deep blue
641
+
642
+ // Clear hierarchy
643
+ primaryText: '#1f2937',
644
+ secondaryText: '#6b7280',
645
+ amountText: '#1f2937',
646
+
647
+ // Professional typography
648
+ fontFamily: 'system-ui, sans-serif',
649
+ fontWeightNormal: '500',
650
+ borderRadius: '6px',
651
+ }
652
+ };
653
+ ```
654
+
424
655
  ### Advanced CSS Customization
425
656
 
426
657
  For specific styling needs beyond the W3Appearance API:
@@ -4,16 +4,32 @@
4
4
  * Following Stripe's appearance API pattern for simple but complete theming.
5
5
  * This file belongs in the React package as it's UI-specific.
6
6
  */
7
- export interface W3Appearance {
7
+ interface W3Appearance {
8
8
  variables?: {
9
9
  primary?: string;
10
- background?: string;
11
- text?: string;
12
- textSecondary?: string;
10
+ mainBackground?: string;
11
+ innerBackground?: string;
12
+ cardBackground?: string;
13
+ primaryText?: string;
14
+ secondaryText?: string;
15
+ descriptionText?: string;
16
+ amountText?: string;
17
+ subtitleText?: string;
18
+ cardText?: string;
19
+ cardSecondaryText?: string;
20
+ usdText?: string;
21
+ footerText?: string;
22
+ qrAddressBackground?: string;
23
+ qrAddressText?: string;
24
+ qrInstructionsBackground?: string;
25
+ qrInstructionsText?: string;
26
+ qrCardBackground?: string;
27
+ qrCardText?: string;
13
28
  danger?: string;
14
29
  success?: string;
15
30
  warning?: string;
16
- border?: string;
31
+ borderColor?: string;
32
+ info?: string;
17
33
  fontFamily?: string;
18
34
  fontSizeBase?: string;
19
35
  fontSizeSmall?: string;
@@ -27,4 +43,5 @@ export interface W3Appearance {
27
43
  declare const BUILT_IN_THEMES: Record<string, Required<W3Appearance['variables']>>;
28
44
  export declare const getThemeVariables: (themeName?: string, appearance?: W3Appearance) => Record<string, string>;
29
45
  export { BUILT_IN_THEMES };
46
+ export type { W3Appearance };
30
47
  //# sourceMappingURL=appearance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../src/appearance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE;QAEV,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAGhB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;Q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