@sazito/checkout 0.1.2 → 0.2.1

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.
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var useCheckout = require('../chunks/use-checkout-CQBSONj1.cjs');
4
+ var useCheckout = require('../chunks/use-checkout-BEaLKgNa.cjs');
5
5
  require('react/jsx-runtime');
6
6
  require('react');
7
- require('../chunks/labels-DJ_RnkCQ.cjs');
7
+ require('../chunks/labels-BlZiVd3n.cjs');
8
8
  require('@sazito/client-sdk');
9
9
 
10
10
 
@@ -71,6 +71,14 @@ interface CheckoutTheme {
71
71
  danger?: string;
72
72
  /** Success and completed-state color. */
73
73
  success?: string;
74
+ /** Foreground used on top of solid success surfaces. */
75
+ successForeground?: string;
76
+ /** Background plate behind carrier and shipping-method logos. */
77
+ logoBackground?: string;
78
+ /** Neutral surface used when a shipping color is white or near-white. */
79
+ shippingNeutral?: string;
80
+ /** Foreground used on the neutral shipping surface. */
81
+ shippingNeutralForeground?: string;
74
82
  /** Base corner radius in px. */
75
83
  radius?: number;
76
84
  /** Font family. Defaults to `inherit` so the host font flows through. */
@@ -71,6 +71,14 @@ interface CheckoutTheme {
71
71
  danger?: string;
72
72
  /** Success and completed-state color. */
73
73
  success?: string;
74
+ /** Foreground used on top of solid success surfaces. */
75
+ successForeground?: string;
76
+ /** Background plate behind carrier and shipping-method logos. */
77
+ logoBackground?: string;
78
+ /** Neutral surface used when a shipping color is white or near-white. */
79
+ shippingNeutral?: string;
80
+ /** Foreground used on the neutral shipping surface. */
81
+ shippingNeutralForeground?: string;
74
82
  /** Base corner radius in px. */
75
83
  radius?: number;
76
84
  /** Font family. Defaults to `inherit` so the host font flows through. */
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- export { C as CheckoutProvider, S as SazitoProvider, u as useCheckout, a as useCheckoutEngine, b as useSazitoClient } from '../chunks/use-checkout-gAjnCzae.js';
2
+ export { C as CheckoutProvider, S as SazitoProvider, u as useCheckout, a as useCheckoutEngine, b as useSazitoClient } from '../chunks/use-checkout-DwHd4uFh.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
- import '../chunks/labels-ByA_yGKl.js';
5
+ import '../chunks/labels-CTR6b-KZ.js';
6
6
  import '@sazito/client-sdk';
7
7
  //# sourceMappingURL=index.js.map
package/dist/styles.css CHANGED
@@ -5,7 +5,6 @@
5
5
  .szc-root {
6
6
  --szc-accent: #4f46e5;
7
7
  --szc-accent-foreground: #ffffff;
8
- --szc-accent-soft: color-mix(in srgb, var(--szc-accent) 10%, #ffffff);
9
8
  --szc-radius: 16px;
10
9
  --szc-font: inherit;
11
10
 
@@ -18,6 +17,11 @@
18
17
  --szc-summary-bg: #f6f6fb;
19
18
  --szc-danger: #dc2626;
20
19
  --szc-success: #16a34a;
20
+ --szc-success-foreground: #ffffff;
21
+ --szc-logo-bg: #ffffff;
22
+ --szc-shipping-neutral: #eef0f5;
23
+ --szc-shipping-neutral-foreground: #475569;
24
+ --szc-accent-soft: color-mix(in srgb, var(--szc-accent) 10%, var(--szc-card));
21
25
 
22
26
  font-family: var(--szc-font);
23
27
  color: var(--szc-fg);
@@ -161,7 +165,7 @@
161
165
  }
162
166
  .szc-step--done .szc-step__dot {
163
167
  background: var(--szc-success);
164
- color: #fff;
168
+ color: var(--szc-success-foreground);
165
169
  }
166
170
  /* The mobile header replaces the stepper on small screens. Must come after
167
171
  the base .szc-stepper rule — same specificity, source order decides. */
@@ -425,15 +429,15 @@
425
429
  line-height: 1.7;
426
430
  }
427
431
  .szc-input--error {
428
- border-color: #ef4444;
432
+ border-color: var(--szc-danger);
429
433
  }
430
434
  .szc-input--error:focus {
431
- border-color: #ef4444;
432
- box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 18%, transparent);
435
+ border-color: var(--szc-danger);
436
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--szc-danger) 18%, transparent);
433
437
  }
434
438
  .szc-field__error {
435
439
  font-size: 11.5px;
436
- color: #ef4444;
440
+ color: var(--szc-danger);
437
441
  }
438
442
  .szc-select-wrap {
439
443
  position: relative;
@@ -506,7 +510,7 @@
506
510
  color: var(--szc-accent-foreground);
507
511
  }
508
512
  .szc-btn--primary:not(:disabled):hover {
509
- background: color-mix(in srgb, var(--szc-accent) 88%, #000);
513
+ background: color-mix(in srgb, var(--szc-accent) 88%, var(--szc-fg));
510
514
  }
511
515
  .szc-btn--primary:disabled:not([aria-busy='true']) {
512
516
  background: color-mix(in srgb, var(--szc-border) 60%, var(--szc-card));
@@ -578,7 +582,6 @@
578
582
  gap: 6px;
579
583
  padding-block: 9px;
580
584
  padding-inline: 12px 16px;
581
- border-radius: 999px;
582
585
  }
583
586
  .szc-back-btn:not(:disabled):hover {
584
587
  background: var(--szc-muted);
@@ -591,8 +594,7 @@
591
594
  .szc-side__cta {
592
595
  display: flex;
593
596
  }
594
- .szc-side__cta .szc-btn,
595
- .szc-side__cta .szc-skeleton--button {
597
+ .szc-side__cta .szc-btn {
596
598
  flex: 1;
597
599
  }
598
600
  .szc-footer-bar {
@@ -689,10 +691,10 @@
689
691
  display: flex;
690
692
  align-items: center;
691
693
  justify-content: center;
692
- background: #ffffff;
694
+ background: var(--szc-card);
693
695
  border: 1px solid color-mix(in srgb, var(--szc-border) 85%, var(--szc-muted-fg));
694
696
  color: color-mix(in srgb, var(--szc-muted-fg) 78%, var(--szc-accent));
695
- box-shadow: 0 1px 2px rgb(15 23 42 / 3%);
697
+ box-shadow: 0 1px 2px color-mix(in srgb, var(--szc-fg) 3%, transparent);
696
698
  }
697
699
  .szc-cart-row__thumb {
698
700
  object-fit: cover;
@@ -730,7 +732,7 @@
730
732
  width: 12px;
731
733
  height: 12px;
732
734
  border-radius: 50%;
733
- border: 1px solid rgba(0, 0, 0, 0.15);
735
+ border: 1px solid color-mix(in srgb, var(--szc-fg) 15%, transparent);
734
736
  flex-shrink: 0;
735
737
  }
736
738
  .szc-cart-row__price {
@@ -762,7 +764,7 @@
762
764
  background: var(--szc-card);
763
765
  border: 1px solid var(--szc-border);
764
766
  border-radius: 9px;
765
- box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
767
+ box-shadow: 0 1px 2px color-mix(in srgb, var(--szc-fg) 4%, transparent);
766
768
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
767
769
  }
768
770
  .szc-qty:focus-within {
@@ -844,8 +846,8 @@
844
846
  transition: background 0.13s, color 0.13s;
845
847
  }
846
848
  .szc-cart-row__remove:not(:disabled):hover {
847
- background: color-mix(in srgb, #ef4444 12%, transparent);
848
- color: #ef4444;
849
+ background: color-mix(in srgb, var(--szc-danger) 12%, transparent);
850
+ color: var(--szc-danger);
849
851
  }
850
852
  .szc-cart-row__remove:disabled {
851
853
  opacity: 0.35;
@@ -974,7 +976,7 @@
974
976
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--szc-rate-foreground, var(--szc-accent)) 14%, transparent);
975
977
  }
976
978
  .szc-ship-group__mark:has(img) {
977
- background: #fff;
979
+ background: var(--szc-logo-bg);
978
980
  color: inherit;
979
981
  box-shadow: inset 0 0 0 1px var(--szc-border);
980
982
  }
@@ -1177,9 +1179,9 @@
1177
1179
  .szc-rate--selected .szc-rate__icon {
1178
1180
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--szc-rate-foreground, var(--szc-accent)) 24%, transparent);
1179
1181
  }
1180
- /* Image/logo icons render on a clean white plate so brand artwork stays true. */
1182
+ /* Image/logo icons render on a configurable clean plate so brand artwork stays true. */
1181
1183
  .szc-rate__icon:has(img) {
1182
- background: #fff;
1184
+ background: var(--szc-logo-bg);
1183
1185
  color: inherit;
1184
1186
  box-shadow: inset 0 0 0 1px var(--szc-border);
1185
1187
  }
@@ -1386,7 +1388,7 @@
1386
1388
  }
1387
1389
  .szc-pay--selected .szc-pay__icon {
1388
1390
  background: var(--szc-accent);
1389
- color: #fff;
1391
+ color: var(--szc-accent-foreground);
1390
1392
  }
1391
1393
  .szc-pay__body {
1392
1394
  display: flex;
@@ -1435,7 +1437,7 @@
1435
1437
  align-items: center;
1436
1438
  gap: 6px;
1437
1439
  font-size: 12.5px;
1438
- color: #ef4444;
1440
+ color: var(--szc-danger);
1439
1441
  margin: 0;
1440
1442
  }
1441
1443
  .szc-discount__error svg {
@@ -1704,108 +1706,24 @@
1704
1706
  .szc-error {
1705
1707
  padding: 12px 14px;
1706
1708
  border-radius: calc(var(--szc-radius) * 0.6);
1707
- background: color-mix(in srgb, var(--szc-danger) 10%, #fff);
1709
+ background: color-mix(in srgb, var(--szc-danger) 10%, var(--szc-card));
1708
1710
  color: var(--szc-danger);
1709
- border: 1px solid color-mix(in srgb, var(--szc-danger) 30%, #fff);
1711
+ border: 1px solid color-mix(in srgb, var(--szc-danger) 30%, var(--szc-card));
1710
1712
  font-size: 13.5px;
1711
1713
  }
1712
- /* ---- checkout skeleton --------------------------------------------- */
1713
- .szc-skeleton-layout {
1714
- min-height: 440px;
1715
- }
1716
- .szc-skeleton {
1717
- display: block;
1718
- border-radius: 7px;
1719
- background: color-mix(in srgb, var(--szc-border) 62%, var(--szc-card));
1720
- animation: szc-skeleton-pulse 1.35s ease-in-out infinite;
1721
- }
1722
- @keyframes szc-skeleton-pulse {
1723
- 0%, 100% { opacity: 0.52; }
1724
- 50% { opacity: 0.92; }
1725
- }
1726
- .szc-skeleton-cart-row {
1727
- min-height: 94px;
1728
- display: flex;
1729
- align-items: center;
1730
- gap: 14px;
1731
- padding: 14px;
1732
- border: 1px solid var(--szc-border);
1733
- border-radius: var(--szc-radius);
1734
- background: var(--szc-card);
1735
- }
1736
- .szc-skeleton-copy {
1737
- flex: 1;
1738
- min-width: 0;
1739
- display: flex;
1740
- flex-direction: column;
1741
- gap: 7px;
1742
- }
1743
- .szc-skeleton--thumb {
1744
- width: 64px;
1745
- height: 64px;
1746
- border-radius: 12px;
1747
- flex: none;
1748
- }
1749
- .szc-skeleton--title {
1750
- width: min(68%, 190px);
1751
- height: 14px;
1752
- }
1753
- .szc-skeleton--text {
1754
- width: min(52%, 140px);
1755
- height: 10px;
1756
- }
1757
- .szc-skeleton--price {
1758
- width: 72px;
1759
- height: 12px;
1760
- }
1761
- .szc-skeleton--counter {
1762
- width: 92px;
1763
- height: 32px;
1764
- border-radius: 9px;
1765
- flex: none;
1766
- }
1767
- .szc-skeleton--button {
1768
- width: 100%;
1769
- height: 51px;
1770
- border-radius: calc(var(--szc-radius) * 0.7);
1771
- }
1772
- .szc-summary--skeleton {
1773
- min-height: 440px;
1774
- }
1775
- .szc-skeleton--summary-label {
1776
- width: 70px;
1777
- height: 12px;
1778
- }
1779
- .szc-skeleton--summary-total {
1780
- width: 190px;
1781
- height: 38px;
1782
- border-radius: 10px;
1783
- }
1784
- .szc-skeleton-summary-lines {
1714
+ /* ---- initial checkout loading -------------------------------------- */
1715
+ .szc-checkout-loading {
1716
+ min-height: 320px;
1785
1717
  display: flex;
1786
1718
  flex-direction: column;
1787
- gap: 11px;
1788
- border-top: 1px solid var(--szc-border);
1789
- padding-top: 16px;
1790
- }
1791
- .szc-skeleton-summary-lines div,
1792
- .szc-skeleton-summary-grand {
1793
- display: flex;
1794
1719
  align-items: center;
1795
- justify-content: space-between;
1796
- }
1797
- .szc-skeleton-summary-lines .szc-skeleton {
1798
- width: 72px;
1799
- height: 11px;
1800
- }
1801
- .szc-skeleton-summary-grand {
1802
- border-top: 1px solid var(--szc-border);
1803
- padding-top: 14px;
1804
- }
1805
- .szc-skeleton-summary-grand .szc-skeleton {
1806
- width: 88px;
1807
- height: 15px;
1720
+ justify-content: center;
1721
+ gap: 12px;
1722
+ color: var(--szc-muted-fg);
1723
+ font-size: 13px;
1808
1724
  }
1809
- @media (prefers-reduced-motion: reduce) {
1810
- .szc-skeleton { animation: none; }
1725
+ .szc-checkout-loading__spinner {
1726
+ width: 22px;
1727
+ height: 22px;
1728
+ color: var(--szc-accent);
1811
1729
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sazito/checkout",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "Headless checkout engine + React UI for the Sazito platform, powered by @sazito/client-sdk",
5
5
  "license": "MIT",
6
6
  "repository": {