@rebilly/instruments 2.0.0-beta → 3.0.1-beta.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.
Files changed (197) hide show
  1. package/dist/events/index.js +2 -1
  2. package/dist/functions/mount/fetch-data.js +187 -0
  3. package/dist/functions/mount/fetch-data.spec.js +189 -0
  4. package/dist/functions/mount/index.js +132 -164
  5. package/dist/functions/mount/mount.spec.js +2 -4
  6. package/dist/functions/mount/setup-element.js +40 -0
  7. package/dist/functions/mount/setup-framepay-theme.js +95 -0
  8. package/dist/functions/mount/setup-framepay.js +5 -1
  9. package/dist/functions/mount/setup-i18n.js +33 -0
  10. package/dist/functions/mount/setup-options.js +68 -47
  11. package/dist/functions/mount/setup-options.spec.js +66 -0
  12. package/dist/functions/mount/setup-storefront.js +6 -4
  13. package/dist/functions/mount/setup-styles.js +4 -2
  14. package/dist/functions/purchase.js +129 -24
  15. package/dist/functions/purchase.spec.js +13 -10
  16. package/dist/functions/setup.js +85 -0
  17. package/dist/functions/setup.spec.js +87 -0
  18. package/dist/functions/show.js +8 -4
  19. package/dist/functions/show.spec.js +9 -5
  20. package/dist/functions/update.js +39 -24
  21. package/dist/functions/update.spec.js +0 -4
  22. package/dist/i18n/en.json +5 -2
  23. package/dist/i18n/es.json +4 -1
  24. package/dist/index.js +17 -3
  25. package/dist/index.spec.js +3 -16
  26. package/dist/loader/index.js +4 -3
  27. package/dist/storefront/index.js +33 -0
  28. package/dist/storefront/invoices.js +27 -0
  29. package/dist/storefront/models/base-model.js +18 -0
  30. package/dist/storefront/models/invoice-model.js +14 -0
  31. package/dist/storefront/models/plan-model.js +4 -35
  32. package/dist/storefront/models/product-model.js +4 -23
  33. package/dist/storefront/models/summary-model.js +12 -25
  34. package/dist/storefront/models/transaction-model.js +31 -0
  35. package/dist/storefront/payment-instruments.js +47 -0
  36. package/dist/storefront/payment-instruments.spec.js +55 -0
  37. package/dist/storefront/plans.js +10 -18
  38. package/dist/storefront/plans.spec.js +3 -13
  39. package/dist/storefront/products.js +10 -13
  40. package/dist/storefront/products.spec.js +12 -19
  41. package/dist/storefront/purchase.js +23 -12
  42. package/dist/storefront/purchase.spec.js +1 -20
  43. package/dist/storefront/ready-to-pay.js +18 -15
  44. package/dist/storefront/ready-to-pay.spec.js +2 -12
  45. package/dist/storefront/summary.js +21 -17
  46. package/dist/storefront/summary.spec.js +4 -15
  47. package/dist/storefront/transactions.js +27 -0
  48. package/dist/style/base/__snapshots__/theme.spec.js.snap +188 -45
  49. package/dist/style/base/default-theme.js +699 -0
  50. package/dist/style/base/index.js +48 -16
  51. package/dist/style/base/theme.js +16 -48
  52. package/dist/style/base/theme.spec.js +4 -15
  53. package/dist/style/components/address.js +3 -3
  54. package/dist/style/components/button.js +32 -22
  55. package/dist/style/components/divider.js +9 -9
  56. package/dist/style/components/forms/checkbox.js +12 -9
  57. package/dist/style/components/forms/field.js +18 -6
  58. package/dist/style/components/forms/form.js +2 -2
  59. package/dist/style/components/forms/input.js +54 -13
  60. package/dist/style/components/forms/label.js +39 -18
  61. package/dist/style/components/forms/select.js +54 -22
  62. package/dist/style/components/forms/validation.js +53 -6
  63. package/dist/style/components/icons.js +4 -4
  64. package/dist/style/components/loader.js +5 -3
  65. package/dist/style/components/methods.js +18 -15
  66. package/dist/style/components/overlay.js +5 -5
  67. package/dist/style/helpers/index.js +46 -46
  68. package/dist/style/index.js +3 -1
  69. package/dist/style/payment-instruments/payment-card.js +4 -4
  70. package/dist/style/utils/border.js +47 -0
  71. package/dist/style/utils/color-values.js +39 -3
  72. package/dist/style/utils/remove-empty-null.js +20 -0
  73. package/dist/style/vendor/framepay.js +11 -8
  74. package/dist/style/vendor/postmate.js +2 -2
  75. package/dist/style/views/confirmation.js +13 -13
  76. package/dist/style/views/method-selector.js +2 -2
  77. package/dist/style/views/modal.js +6 -6
  78. package/dist/style/views/result.js +4 -4
  79. package/dist/style/views/summary.js +26 -22
  80. package/dist/views/__snapshots__/summary.spec.js.snap +77 -119
  81. package/dist/views/common/iframe/base-iframe.js +2 -0
  82. package/dist/views/common/iframe/modal-iframe.js +50 -4
  83. package/dist/views/confirmation.js +19 -8
  84. package/dist/views/method-selector/generate-digital-wallet.js +12 -3
  85. package/dist/views/method-selector/generate-digital-wallet.spec.js +11 -0
  86. package/dist/views/method-selector/get-payment-methods.js +13 -2
  87. package/dist/views/method-selector/get-payment-methods.spec.js +21 -19
  88. package/dist/views/method-selector/index.js +23 -34
  89. package/dist/views/method-selector/method-selector.spec.js +50 -55
  90. package/dist/views/method-selector/mount-methods.js +5 -8
  91. package/dist/views/modal.js +8 -2
  92. package/dist/views/result.js +3 -4
  93. package/dist/views/summary.js +156 -97
  94. package/dist/views/summary.spec.js +53 -58
  95. package/package.json +4 -2
  96. package/src/events/index.js +2 -1
  97. package/src/functions/mount/fetch-data.js +152 -0
  98. package/src/functions/mount/fetch-data.spec.js +238 -0
  99. package/src/functions/mount/index.js +101 -158
  100. package/src/functions/mount/mount.spec.js +3 -5
  101. package/src/functions/mount/setup-element.js +26 -0
  102. package/src/functions/mount/setup-framepay-theme.js +82 -0
  103. package/src/functions/mount/setup-framepay.js +5 -1
  104. package/src/functions/mount/setup-i18n.js +19 -0
  105. package/src/functions/mount/setup-options.js +78 -48
  106. package/src/functions/mount/setup-options.spec.js +60 -0
  107. package/src/functions/mount/setup-storefront.js +6 -4
  108. package/src/functions/mount/setup-styles.js +4 -2
  109. package/src/functions/on.spec.js +1 -1
  110. package/src/functions/purchase.js +99 -23
  111. package/src/functions/purchase.spec.js +10 -10
  112. package/src/functions/setup.js +48 -0
  113. package/src/functions/setup.spec.js +98 -0
  114. package/src/functions/show.js +2 -4
  115. package/src/functions/show.spec.js +3 -4
  116. package/src/functions/update.js +40 -25
  117. package/src/functions/update.spec.js +0 -4
  118. package/src/i18n/en.json +5 -2
  119. package/src/i18n/es.json +4 -1
  120. package/src/index.js +9 -3
  121. package/src/index.spec.js +3 -21
  122. package/src/loader/index.js +3 -3
  123. package/src/storefront/index.js +28 -0
  124. package/src/storefront/invoices.js +11 -0
  125. package/src/storefront/models/base-model.js +10 -0
  126. package/src/storefront/models/invoice-model.js +3 -0
  127. package/src/storefront/models/plan-model.js +3 -35
  128. package/src/storefront/models/product-model.js +3 -23
  129. package/src/storefront/models/summary-model.js +12 -19
  130. package/src/storefront/models/transaction-model.js +19 -0
  131. package/src/storefront/payment-instruments.js +30 -0
  132. package/src/storefront/payment-instruments.spec.js +69 -0
  133. package/src/storefront/plans.js +6 -17
  134. package/src/storefront/plans.spec.js +4 -11
  135. package/src/storefront/products.js +8 -16
  136. package/src/storefront/products.spec.js +16 -22
  137. package/src/storefront/purchase.js +14 -16
  138. package/src/storefront/purchase.spec.js +2 -14
  139. package/src/storefront/ready-to-pay.js +13 -16
  140. package/src/storefront/ready-to-pay.spec.js +3 -10
  141. package/src/storefront/summary.js +19 -17
  142. package/src/storefront/summary.spec.js +5 -12
  143. package/src/storefront/transactions.js +11 -0
  144. package/src/style/base/__snapshots__/theme.spec.js.snap +188 -45
  145. package/src/style/base/default-theme.js +674 -0
  146. package/src/style/base/index.js +48 -16
  147. package/src/style/base/theme.js +17 -47
  148. package/src/style/base/theme.spec.js +4 -16
  149. package/src/style/components/address.js +3 -3
  150. package/src/style/components/button.js +32 -24
  151. package/src/style/components/divider.js +9 -9
  152. package/src/style/components/forms/checkbox.js +11 -11
  153. package/src/style/components/forms/field.js +18 -6
  154. package/src/style/components/forms/form.js +2 -2
  155. package/src/style/components/forms/input.js +54 -13
  156. package/src/style/components/forms/label.js +39 -18
  157. package/src/style/components/forms/select.js +54 -22
  158. package/src/style/components/forms/validation.js +53 -6
  159. package/src/style/components/icons.js +4 -4
  160. package/src/style/components/loader.js +4 -5
  161. package/src/style/components/methods.js +18 -15
  162. package/src/style/components/overlay.js +5 -5
  163. package/src/style/helpers/index.js +46 -46
  164. package/src/style/index.js +2 -1
  165. package/src/style/payment-instruments/payment-card.js +4 -4
  166. package/src/style/utils/border.js +34 -0
  167. package/src/style/utils/color-values.js +27 -1
  168. package/src/style/utils/remove-empty-null.js +10 -0
  169. package/src/style/vendor/framepay.js +11 -8
  170. package/src/style/vendor/postmate.js +2 -2
  171. package/src/style/views/confirmation.js +13 -13
  172. package/src/style/views/method-selector.js +2 -2
  173. package/src/style/views/modal.js +6 -6
  174. package/src/style/views/result.js +4 -4
  175. package/src/style/views/summary.js +26 -22
  176. package/src/views/__snapshots__/summary.spec.js.snap +77 -119
  177. package/src/views/common/iframe/base-iframe.js +2 -0
  178. package/src/views/common/iframe/modal-iframe.js +45 -3
  179. package/src/views/confirmation.js +15 -5
  180. package/src/views/method-selector/generate-digital-wallet.js +10 -3
  181. package/src/views/method-selector/generate-digital-wallet.spec.js +10 -0
  182. package/src/views/method-selector/get-payment-methods.js +7 -2
  183. package/src/views/method-selector/get-payment-methods.spec.js +26 -23
  184. package/src/views/method-selector/index.js +21 -28
  185. package/src/views/method-selector/method-selector.spec.js +49 -64
  186. package/src/views/method-selector/mount-methods.js +5 -8
  187. package/src/views/modal.js +6 -2
  188. package/src/views/result.js +4 -3
  189. package/src/views/summary.js +161 -117
  190. package/src/views/summary.spec.js +60 -75
  191. package/tests/mocks/rebilly-instruments-mock.js +37 -7
  192. package/tests/mocks/storefront-api-mock.js +8 -0
  193. package/tests/mocks/storefront-mock.js +17 -0
  194. package/dist/functions/mount/fetch-summary-data.js +0 -46
  195. package/dist/functions/mount/fetch-summary-data.spec.js +0 -43
  196. package/src/functions/mount/fetch-summary-data.js +0 -29
  197. package/src/functions/mount/fetch-summary-data.spec.js +0 -40
@@ -1,30 +1,59 @@
1
1
  // -----------------------------------------------------------------------------
2
2
  // This file contains all styles related to the select component.
3
3
  // -----------------------------------------------------------------------------
4
- export const select = (theme) => `
4
+ export const select = () => `
5
5
  /**
6
6
  * Select
7
7
  */
8
8
  .rebilly-instruments-form-field-select {
9
- font-size: ${theme.typography.fontSize};
10
- line-height: ${theme.typography.lineHeight};
11
- padding: ${theme.space.form.padding};
12
- min-height: ${theme.space.form.minHeight};
13
- border: 1px solid ${theme.getComputed.color.mutedBorder};
14
- border-radius: ${theme.borderRadius};
15
- color: ${theme.color.text};
16
- background: transparent;
9
+ font-size: var(--rebilly-inputFontSize);
10
+ font-family: var(--rebilly-inputFontFamily);
11
+ font-weight: var(--rebilly-inputFontWeight);
12
+ line-height: var(--rebilly-inputFontLineHeight);
13
+ padding: var(--rebilly-spacings-input-py) var(--rebilly-spacings-input-px);
14
+ min-height: var(--rebilly-spacings-form-element-min-height);
15
+ border: var(--rebilly-inputBorder);
16
+ border-radius: var(--rebilly-inputBorderRadius);
17
+ color: var(--rebilly-inputColorText);
18
+ background: var(--rebilly-inputColorBackground);
17
19
  box-sizing: border-box;
20
+ box-shadow: var(--rebilly-inputBoxShadow);
18
21
  width: 100%;
19
22
  transition: all 200ms;
23
+ order: 1;
24
+ }
25
+
26
+ .rebilly-instruments-form-field-select:hover {
27
+ background: var(--rebilly-inputHoverColorBackground);
28
+ color: var(--rebilly-inputHoverColorText);
29
+ font-family: var(--rebilly-inputHoverFontFamily);
30
+ font-size: var(--rebilly-inputHoverFontSize);
31
+ line-height: var(--rebilly-inputHoverFontLineHeight);
32
+ font-weight: var(--rebilly-inputHoverFontWeight);
33
+ border: var(--rebilly-inputHoverBorder);
34
+ border-radius: var(--rebilly-inputHoverBorderRadius);
35
+ box-shadow: var(--rebilly-inputHoverBoxShadow);
20
36
  }
21
37
 
22
38
  .rebilly-instruments-form-field-select:focus {
23
39
  outline: none;
24
- border: 1px solid ${theme.color.primary};
25
- box-shadow: 0 0 0 1px ${theme.color.primary};
40
+ background: var(--rebilly-inputFocusColorBackground);
41
+ color: var(--rebilly-inputFocusColorText);
42
+ font-family: var(--rebilly-inputFocusFontFamily);
43
+ font-size: var(--rebilly-inputFocusFontSize);
44
+ line-height: var(--rebilly-inputFocusFontLineHeight);
45
+ font-weight: var(--rebilly-inputFocusFontWeight);
46
+ border: var(--rebilly-inputFocusBorder);
47
+ border-radius: var(--rebilly-inputFocusBorderRadius);
48
+ box-shadow: var(--rebilly-inputFocusBoxShadow);
26
49
  }
27
50
 
51
+ .rebilly-instruments-form-field-select::selection {
52
+ color: var(--rebilly-inputSelectionColorText);
53
+ background: var(--rebilly-inputSelectionColorBackground);
54
+ }
55
+
56
+
28
57
  .rebilly-instruments-form-field-select:disabled {
29
58
  opacity: 0.6;
30
59
  }
@@ -34,21 +63,24 @@ export const select = (theme) => `
34
63
  -moz-appearance: none;
35
64
  }
36
65
 
37
- .rebilly-instruments-form-field-select + .rebilly-instruments-form-field-label {
38
- font-size: ${theme.typography.fontSize};
39
- opacity: 0.5;
40
- }
41
-
42
66
  .rebilly-instruments-form-field-select::-ms-expand { display: none; }
43
67
 
44
68
  .rebilly-instruments-form-field-select-arrow {
45
- border: solid ${theme.color.text};
69
+ border: solid var(--rebilly-inputColorText);
46
70
  position: absolute;
47
- width: 8px;
48
- height: 8px;
71
+ width: var(--rebilly-spacings-xs);
72
+ height: var(--rebilly-spacings-xs);
49
73
  border-width: 0 2px 2px 0;
50
- transform: rotate(45deg);
51
- right: 16px;
52
- top: 16px;
74
+ border-radius: 1px;
75
+ right: var(--rebilly-spacings-s);
76
+ top: 50%;
77
+ margin-top: calc(var(--rebilly-inputFontSize) * 0.875 - var(--rebilly-spacings-xs));
78
+ transform: translateY(-50%) rotate(45deg);
79
+ }
80
+
81
+ .is-floating .rebilly-instruments-form-field-select-arrow {
82
+ top: 50%;
83
+ margin-top: 0;
84
+ transform: translateY(-50%) rotate(45deg);
53
85
  }
54
86
  `;
@@ -1,25 +1,72 @@
1
1
  // -----------------------------------------------------------------------------
2
2
  // This file contains all styles related to the form validations.
3
3
  // -----------------------------------------------------------------------------
4
- export const validation = (theme) => `
4
+ export const validation = () => `
5
5
  /**
6
6
  * Validations
7
7
  */
8
8
  .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input,
9
9
  .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-select {
10
- border-color: ${theme.color.errorText};
11
- color: ${theme.color.errorText};
10
+ font-family: var(--rebilly-inputErrorFontFamily);
11
+ font-size: var(--rebilly-inputErrorFontSize);
12
+ font-weight: var(--rebilly-inputErrorFontWeight);
13
+ line-height: var(--rebilly-inputErrorFontLineHeight);
14
+ background: var(--rebilly-inputErrorColorBackground);
15
+ color: var(--rebilly-inputErrorColorText);
16
+ border: var(--rebilly-inputErrorBorder);
17
+ border-radius: var(--rebilly-inputErrorBorderRadius);
18
+ box-shadow: var(--rebilly-inputErrorBoxShadow);
19
+ }
20
+
21
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:hover,
22
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-select:hover {
23
+ font-family: var(--rebilly-inputErrorHoverFontFamily);
24
+ font-size: var(--rebilly-inputErrorHoverFontSize);
25
+ font-weight: var(--rebilly-inputErrorHoverFontWeight);
26
+ line-height: var(--rebilly-inputErrorHoverFontLineHeight);
27
+ background: var(--rebilly-inputErrorHoverColorBackground);
28
+ color: var(--rebilly-inputErrorHoverColorText);
29
+ border: var(--rebilly-inputErrorHoverBorder);
30
+ border-radius: var(--rebilly-inputErrorHoverBorderRadius);
31
+ box-shadow: var(--rebilly-inputErrorHoverBoxShadow);
32
+ }
33
+
34
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:focus,
35
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-select:focus {
36
+ font-family: var(--rebilly-inputErrorFocusFontFamily);
37
+ font-size: var(--rebilly-inputErrorFocusFontSize);
38
+ font-weight: var(--rebilly-inputErrorFocusFontWeight);
39
+ line-height: var(--rebilly-inputErrorFocusFontLineHeight);
40
+ background: var(--rebilly-inputErrorFocusColorBackground);
41
+ color: var(--rebilly-inputErrorFocusColorText);
42
+ border: var(--rebilly-inputErrorFocusBorder);
43
+ border-radius: var(--rebilly-inputErrorFocusBorderRadius);
44
+ box-shadow: var(--rebilly-inputErrorFocusBoxShadow);
45
+ }
46
+
47
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::placeholder {
48
+ color: var(--rebilly-inputErrorPlaceholderColorText);
49
+ font-family: var(--rebilly-inputErrorPlaceholderFontFamily);
50
+ font-size: var(--rebilly-inputErrorPlaceholderFontSize);
51
+ line-height: var(--rebilly-inputErrorPlaceholderFontLineHeight);
52
+ font-weight: var(--rebilly-inputErrorPlaceholderFontWeight);
53
+ }
54
+
55
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::selection,
56
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-select::selection {
57
+ color: var(--rebilly-inputErrorSelectionColorText);
58
+ background: var(--rebilly-inputErrorSelectionColorBackground);
12
59
  }
13
60
 
14
61
  .rebilly-instruments-form-field-error-wrapper {
15
- margin-top: ${theme.space.xxs};
16
- margin-bottom: calc(${theme.space.xxs} + ${theme.space.s});
62
+ margin-top: var(--rebilly-spacings-2xs);
63
+ margin-bottom: 0;
17
64
  padding: 0;
18
65
  list-style: none;
19
66
  }
20
67
 
21
68
  .rebilly-instruments-form-field-error-wrapper > li {
22
- color: ${theme.color.errorText};
69
+ color: var(--rebilly-colorDanger);
23
70
  padding: 0;
24
71
  }
25
72
  `;
@@ -1,13 +1,13 @@
1
1
  // -----------------------------------------------------------------------------
2
2
  // This file contains all styles related to the icons component.
3
3
  // -----------------------------------------------------------------------------
4
- export const icons = (theme) => `
4
+ export const icons = () => `
5
5
  /**
6
6
  * Icons
7
7
  */
8
8
  .rebilly-instruments-icon {
9
- width: ${theme.typography.lineHeight};
10
- height: ${theme.typography.lineHeight};
11
- fill: ${theme.color.text};
9
+ width: var(--rebilly-fontLineHeightBase, calc(var(--rebilly-fontSizeBase) * 1.5));
10
+ height: var(--rebilly-fontLineHeightBase, calc(var(--rebilly-fontSizeBase) * 1.5));
11
+ fill: var(--rebilly-colorText);
12
12
  }
13
13
  `;
@@ -1,3 +1,4 @@
1
+ import { lighten } from '../utils/color-values';
1
2
  // -----------------------------------------------------------------------------
2
3
  // This file contains all styles related to the loader component.
3
4
  // -----------------------------------------------------------------------------
@@ -14,7 +15,7 @@ export const loader = (theme) => `
14
15
  right: 0;
15
16
  justify-content: center;
16
17
  align-items: center;
17
- background-color: ${theme.color.background};
18
+ background-color: var(--rebilly-colorBackground);
18
19
  z-index: 9000;
19
20
  transition: all 200ms;
20
21
  }
@@ -24,10 +25,8 @@ export const loader = (theme) => `
24
25
  }
25
26
 
26
27
  .rebilly-instruments-loader-spinner {
27
- border: 4px solid ${theme.getComputed.color.primaryValues
28
- .tint(80)
29
- .hexString()};
30
- border-top: 4px solid ${theme.color.primary};
28
+ border: 4px solid ${lighten(theme.colorPrimary, 80)};
29
+ border-top: 4px solid var(--rebilly-colorPrimary);
31
30
  border-radius: 50%;
32
31
  width: 40px;
33
32
  height: 40px;
@@ -1,7 +1,7 @@
1
1
  // -----------------------------------------------------------------------------
2
2
  // This file contains all styles related to the methods component.
3
3
  // -----------------------------------------------------------------------------
4
- export const expressMethods = (theme) => `
4
+ export const expressMethods = () => `
5
5
  /**
6
6
  * Express methods
7
7
  */
@@ -13,9 +13,11 @@ export const expressMethods = (theme) => `
13
13
  }
14
14
 
15
15
  .rebilly-instruments-express-methods.is-compact {
16
- border: 1px solid ${theme.getComputed.color.mutedBorder};
17
- padding: calc(${theme.space.xs} + ${theme.space.s}) ${theme.space.s} ${theme.space.s};
18
- border-radius: ${theme.borderRadius};
16
+ border: 1px solid var(--rebilly-colorMutedBorder);
17
+ padding: var(--rebilly-spacings-s);
18
+ padding-top: calc(var(--rebilly-spacings-xs) + var(--rebilly-spacings-s));
19
+ padding-top: calc(var(--rebilly-fontSizeBase) + var(--rebilly-spacings-2xs));
20
+ border-radius: 4px;
19
21
  position: relative;
20
22
  }
21
23
 
@@ -27,10 +29,11 @@ export const expressMethods = (theme) => `
27
29
 
28
30
  .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > * {
29
31
  border-radius: 6px;
30
- margin-bottom: ${theme.space.xs};
31
- background: linear-gradient(110deg, ${theme.getComputed.color.mutedBorder} 0%, ${theme.color.background} 25%, ${theme.getComputed.color.mutedBorder} 50%);
32
+ margin-bottom: var(--rebilly-spacings-xs);
33
+ background: linear-gradient(110deg, var(--rebilly-colorMutedBorder) 0%, var(--rebilly-colorBackground) 25%, var(--rebilly-colorMutedBorder) 50%);
32
34
  background-size: 200% 100%;
33
35
  animation: 1.5s rebillyExpressShine linear infinite;
36
+ height: 44px;
34
37
  }
35
38
  .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > *:last-child {
36
39
  margin: 0;
@@ -44,7 +47,7 @@ export const expressMethods = (theme) => `
44
47
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
45
48
  flex: 1 1 0px;
46
49
  max-width: 260px;
47
- margin: 0 ${theme.space.xs};
50
+ margin: 0 var(--rebilly-spacings-xs);
48
51
  }
49
52
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:first-child {
50
53
  margin-left: 0;
@@ -58,17 +61,17 @@ export const expressMethods = (theme) => `
58
61
  }
59
62
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-label {
60
63
  position: absolute;
61
- top: -12px; left: 50%;
62
- transform: translateX(-50%);
63
- color: ${theme.color.text};
64
- padding: 0 ${theme.space.s};
65
- line-height: ${theme.typography.lineHeight};
66
- background: ${theme.color.background};
64
+ top: 0; left: 50%;
65
+ transform: translateX(-50%) translateY(-50%);
66
+ color: var(--rebilly-colorText);
67
+ padding: var(--rebilly-spacings-2xs) var(--rebilly-spacings-s);
68
+ line-height: 1;
69
+ background: var(--rebilly-colorBackground);
67
70
  display: inline-block;
68
71
  font-weight: 500;
69
72
  min-height: auto;
70
73
  margin: 0;
71
- border: 1px soplid red;
74
+ white-space: nowrap;
72
75
  }
73
76
 
74
77
  @media (max-width: 600px) {
@@ -77,7 +80,7 @@ export const expressMethods = (theme) => `
77
80
  }
78
81
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
79
82
  max-width: 100%;
80
- margin: 0 0 ${theme.space.xs};
83
+ margin: 0 0 var(--rebilly-spacings-xs);
81
84
  }
82
85
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
83
86
  margin: 0;
@@ -1,7 +1,7 @@
1
1
  // -----------------------------------------------------------------------------
2
2
  // This file contains all styles related to the overlay component.
3
3
  // -----------------------------------------------------------------------------
4
- export const overlay = (theme) => `
4
+ export const overlay = () => `
5
5
  /**
6
6
  * Overlay
7
7
  */
@@ -15,10 +15,10 @@ export const overlay = (theme) => `
15
15
  display: flex;
16
16
  justify-content: center;
17
17
  align-items: center;
18
- color: #ffffff;
19
- font-family: ${theme.typography.fontFamily};
20
- font-size: calc(${theme.typography.fontSize} * 1.12);
21
- line-height: ${theme.typography.lineHeight};
18
+ color: #FFF;
19
+ font-family: var(--rebilly-fontFamily);
20
+ font-size: calc(var(--rebilly-fontSizeBase) * 1.12);
21
+ line-height: var(--rebilly-fontLineHeightBase, calc(var(--rebilly-fontSizeBase) * 1.5));
22
22
  z-index: 9001
23
23
  }
24
24
  `;
@@ -2,50 +2,50 @@
2
2
  // This file contains all styles related to helpers.
3
3
  // -----------------------------------------------------------------------------
4
4
 
5
- export const helpers = (theme) => `
6
- /* Helpers
7
- ------------------------------------------------------------ */
8
- .rebilly-instruments-helper-visually-hidden {
9
- border: 0;
10
- clip: rect(0 0 0 0);
11
- height: 1px;
12
- margin: -1px;
13
- overflow: hidden;
14
- padding: 0;
15
- position: absolute;
16
- width: 1px;
17
- }
5
+ export const helpers = () => `
6
+ /* Helpers
7
+ ------------------------------------------------------------ */
8
+ .rebilly-instruments-helper-visually-hidden {
9
+ border: 0;
10
+ clip: rect(0 0 0 0);
11
+ height: 1px;
12
+ margin: -1px;
13
+ overflow: hidden;
14
+ padding: 0;
15
+ position: absolute;
16
+ width: 1px;
17
+ }
18
18
 
19
- .rebilly-instruments-helper-mt-xxs { margin-top: ${theme.space.xxs}!important }
20
- .rebilly-instruments-helper-mt-xs { margin-top: ${theme.space.xs}!important }
21
- .rebilly-instruments-helper-mt-s { margin-top: ${theme.space.s}!important }
22
- .rebilly-instruments-helper-mt-m { margin-top: ${theme.space.m}!important }
23
- .rebilly-instruments-helper-mt-l { margin-top: ${theme.space.l}!important }
24
- .rebilly-instruments-helper-mt-xl { margin-top: ${theme.space.xl}!important }
25
- .rebilly-instruments-helper-mt-xxl { margin-top: ${theme.space.xxl}!important }
26
- .rebilly-instruments-helper-mt-0 { margin-top: 0!important }
27
- .rebilly-instruments-helper-mr-xxs { margin-right: ${theme.space.xxs}!important }
28
- .rebilly-instruments-helper-mr-xs { margin-right: ${theme.space.xs}!important }
29
- .rebilly-instruments-helper-mr-s { margin-right: ${theme.space.s}!important }
30
- .rebilly-instruments-helper-mr-m { margin-right: ${theme.space.m}!important }
31
- .rebilly-instruments-helper-mr-l { margin-right: ${theme.space.l}!important }
32
- .rebilly-instruments-helper-mr-xl { margin-right: ${theme.space.xl}!important }
33
- .rebilly-instruments-helper-mr-xxl { margin-right: ${theme.space.xxl}!important }
34
- .rebilly-instruments-helper-mr-0 { margin-right: 0!important }
35
- .rebilly-instruments-helper-mb-xxs { margin-bottom: ${theme.space.xxs}!important }
36
- .rebilly-instruments-helper-mb-xs { margin-bottom: ${theme.space.xs}!important }
37
- .rebilly-instruments-helper-mb-s { margin-bottom: ${theme.space.s}!important }
38
- .rebilly-instruments-helper-mb-m { margin-bottom: ${theme.space.m}!important }
39
- .rebilly-instruments-helper-mb-l { margin-bottom: ${theme.space.l}!important }
40
- .rebilly-instruments-helper-mb-xl { margin-bottom: ${theme.space.xl}!important }
41
- .rebilly-instruments-helper-mb-xxl { margin-bottom: ${theme.space.xxl}!important }
42
- .rebilly-instruments-helper-mb-0 { margin-bottom: 0!important }
43
- .rebilly-instruments-helper-ml-xxs { margin-left: ${theme.space.xxs}!important }
44
- .rebilly-instruments-helper-ml-xs { margin-left: ${theme.space.xs}!important }
45
- .rebilly-instruments-helper-ml-s { margin-left: ${theme.space.s}!important }
46
- .rebilly-instruments-helper-ml-m { margin-left: ${theme.space.m}!important }
47
- .rebilly-instruments-helper-ml-l { margin-left: ${theme.space.l}!important }
48
- .rebilly-instruments-helper-ml-xl { margin-left: ${theme.space.xl}!important }
49
- .rebilly-instruments-helper-ml-xxl { margin-left: ${theme.space.xxl}!important }
50
- .rebilly-instruments-helper-ml-0 { margin-left: 0!important }
51
- `;
19
+ .rebilly-instruments-helper-mt-xxs { margin-top: var(--rebilly-spacings-2xs) !important }
20
+ .rebilly-instruments-helper-mt-xs { margin-top: var(--rebilly-spacings-xs) !important }
21
+ .rebilly-instruments-helper-mt-s { margin-top: var(--rebilly-spacings-s) !important }
22
+ .rebilly-instruments-helper-mt-m { margin-top: var(--rebilly-spacings-base) !important }
23
+ .rebilly-instruments-helper-mt-l { margin-top: var(--rebilly-spacings-l) !important }
24
+ .rebilly-instruments-helper-mt-xl { margin-top: var(--rebilly-spacings-xl) !important }
25
+ .rebilly-instruments-helper-mt-xxl { margin-top: var(--rebilly-spacings-2xl) !important }
26
+ .rebilly-instruments-helper-mt-0 { margin-top: 0!important }
27
+ .rebilly-instruments-helper-mr-xxs { margin-right: var(--rebilly-spacings-2xs) !important }
28
+ .rebilly-instruments-helper-mr-xs { margin-right: var(--rebilly-spacings-xs) !important }
29
+ .rebilly-instruments-helper-mr-s { margin-right: var(--rebilly-spacings-s) !important }
30
+ .rebilly-instruments-helper-mr-m { margin-right: var(--rebilly-spacings-base) !important }
31
+ .rebilly-instruments-helper-mr-l { margin-right: var(--rebilly-spacings-l) !important }
32
+ .rebilly-instruments-helper-mr-xl { margin-right: var(--rebilly-spacings-xl) !important }
33
+ .rebilly-instruments-helper-mr-xxl { margin-right: var(--rebilly-spacings-2xl) !important }
34
+ .rebilly-instruments-helper-mr-0 { margin-right: 0!important }
35
+ .rebilly-instruments-helper-mb-xxs { margin-bottom: var(--rebilly-spacings-2xs) !important }
36
+ .rebilly-instruments-helper-mb-xs { margin-bottom: var(--rebilly-spacings-xs) !important }
37
+ .rebilly-instruments-helper-mb-s { margin-bottom: var(--rebilly-spacings-s) !important }
38
+ .rebilly-instruments-helper-mb-m { margin-bottom: var(--rebilly-spacings-base) !important }
39
+ .rebilly-instruments-helper-mb-l { margin-bottom: var(--rebilly-spacings-l) !important }
40
+ .rebilly-instruments-helper-mb-xl { margin-bottom: var(--rebilly-spacings-xl) !important }
41
+ .rebilly-instruments-helper-mb-xxl { margin-bottom: var(--rebilly-spacings-2xl) !important }
42
+ .rebilly-instruments-helper-mb-0 { margin-bottom: 0!important }
43
+ .rebilly-instruments-helper-ml-xxs { margin-left: var(--rebilly-spacings-2xs) !important }
44
+ .rebilly-instruments-helper-ml-xs { margin-left: var(--rebilly-spacings-xs) !important }
45
+ .rebilly-instruments-helper-ml-s { margin-left: var(--rebilly-spacings-s) !important }
46
+ .rebilly-instruments-helper-ml-m { margin-left: var(--rebilly-spacings-base) !important }
47
+ .rebilly-instruments-helper-ml-l { margin-left: var(--rebilly-spacings-l) !important }
48
+ .rebilly-instruments-helper-ml-xl { margin-left: var(--rebilly-spacings-xl) !important }
49
+ .rebilly-instruments-helper-ml-xxl { margin-left: var(--rebilly-spacings-2xl) !important }
50
+ .rebilly-instruments-helper-ml-0 { margin-left: 0!important }
51
+ `;
@@ -1,6 +1,7 @@
1
1
  import postcss from 'postcss';
2
2
  import autoprefixer from 'autoprefixer';
3
3
  import { browserslist } from './browserslist';
4
+ import removeEmptyAndNull from './utils/remove-empty-null';
4
5
 
5
6
  import { Theme } from './base/theme';
6
7
  import { base } from './base';
@@ -24,7 +25,7 @@ export const mainStyle = async (themeOverride) => {
24
25
  ${helpers(resolvedTheme)}
25
26
  `;
26
27
 
27
- return postcss([autoprefixer(browserslist)])
28
+ return postcss([removeEmptyAndNull, autoprefixer(browserslist)])
28
29
  .process(style, { from: undefined })
29
30
  .then((result) => result.css);
30
31
  };
@@ -1,4 +1,4 @@
1
- export const paymentCard = (theme) => `
1
+ export const paymentCard = () => `
2
2
  /**
3
3
  * Payment card
4
4
  */
@@ -6,18 +6,18 @@ export const paymentCard = (theme) => `
6
6
  display: inline-flex;
7
7
  width: 100%;
8
8
  justify-content: flex-end;
9
- margin-top: ${theme.space.s}
9
+ margin-top: var(--rebilly-spacings-s);
10
10
  }
11
11
 
12
12
  .rebilly-instruments-payment-card-brands figure {
13
- margin: 0 0 0 ${theme.space.xxs};
13
+ margin: 0 0 0 var(--rebilly-spacings-2xs);
14
14
  padding: 0;
15
15
  height: 26px;
16
16
  }
17
17
 
18
18
  .rebilly-instruments-payment-card-brands figure img {
19
19
  width: 42px;
20
- border-radius: ${theme.borderRadius};
20
+ border-radius: 4px;
21
21
  }
22
22
 
23
23
  .rebilly-instruments-modal-container.rebilly-instruments-payment-card {
@@ -0,0 +1,34 @@
1
+ export default class Border {
2
+ allStyles = ['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial', 'inherit'];
3
+
4
+ constructor(str) {
5
+ this.str = str || '';
6
+
7
+ const style = this.allStyles.find(s => this.str.includes(s));
8
+ const borderProps = this.str.split(style).map(a => a.trim());
9
+ this.border = [borderProps[0], style, borderProps[1]];
10
+ }
11
+
12
+ get stylePosition() {
13
+ let stylePosition = 0;
14
+ if(this.border.length === 3) {
15
+ stylePosition = 1;
16
+ } else if(this.border.length === 2) {
17
+ if(this.allStyles.includes(this.border[0])) {
18
+ stylePosition = 0;
19
+ } else {
20
+ stylePosition = 1;
21
+ }
22
+ }
23
+ return stylePosition;
24
+ }
25
+
26
+ updateColor(color) {
27
+ this.border[this.stylePosition + 1] = color;
28
+ return this;
29
+ }
30
+
31
+ get value() {
32
+ return this.border.join(' ');
33
+ }
34
+ }
@@ -3,7 +3,33 @@ import Values from 'values.js';
3
3
  export const colorValues = (color) => new Values(color);
4
4
 
5
5
  export function alphaColor(color, alphaValue = 1) {
6
- const _alphaColor = new Values(color);
6
+ if(color === null) {
7
+ return color;
8
+ }
9
+
10
+ const _alphaColor = colorValues(color);
7
11
  _alphaColor.alpha = alphaValue;
8
12
  return _alphaColor.rgbString();
9
13
  }
14
+
15
+ export const mutedTextColor = (color) => alphaColor(color, 0.6);
16
+
17
+ export const mutedBorderColor = (color) => alphaColor(color, 0.25);
18
+
19
+ export const darken = (color, percent) => {
20
+ if(color === null) {
21
+ return color;
22
+ }
23
+
24
+ const _color = colorValues(color);
25
+ return _color.shade(percent).hexString()
26
+ }
27
+
28
+ export const lighten = (color, percent) => {
29
+ if(color === null) {
30
+ return color;
31
+ }
32
+
33
+ const _color = colorValues(color);
34
+ return _color.tint(percent).hexString()
35
+ }
@@ -0,0 +1,10 @@
1
+ import postcss from 'postcss';
2
+
3
+ export default postcss.plugin('postcss-remove-empty-null', () => (root) => {
4
+ root.walkDecls(decl => {
5
+ if ((decl.value === '\'\'' || decl.value === '""' || decl.value.includes('null')) && decl.prop !== 'content') {
6
+ decl.remove();
7
+ }
8
+ });
9
+ }
10
+ );
@@ -1,19 +1,22 @@
1
- export const framepayStyle = (theme) => `
1
+ export const framepayStyle = () => `
2
2
  .rebilly-instruments-framepay .rebilly-framepay {
3
- box-shadow: none;
4
- min-height: ${theme.space.form.minHeight};
5
- border: 1px solid ${theme.getComputed.color.mutedBorder};
3
+ min-height: var(--rebilly-spacings-form-element-min-height);
4
+ border: var(--rebilly-inputBorder);
6
5
  margin-bottom: 0;
7
- background: ${theme.color.background};
6
+ background: var(--rebilly-inputColorBackground);
7
+ border-radius: var(--rebilly-inputBorderRadius);
8
+ box-shadow: var(--rebilly-inputBoxShadow);
8
9
  }
9
10
 
10
11
  .rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-focus {
11
- border: 1px solid ${theme.color.primary};
12
- box-shadow: 0 0 0 1px ${theme.color.primary};
12
+ background: var(--rebilly-inputFocusColorBackground);
13
+ border: var(--rebilly-inputFocusBorder);
14
+ border-radius: var(--rebilly-inputFocusBorderRadius);
15
+ box-shadow: var(--rebilly-inputFocusBoxShadow);
13
16
  }
14
17
 
15
18
  .rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-invalid {
16
- border: 1px solid ${theme.color.errorText};
19
+ border-color: var(--rebilly-colorDanger);
17
20
  box-shadow: none;
18
21
  }
19
22
 
@@ -1,8 +1,8 @@
1
- export const postmateStyle = (theme) => `
1
+ export const postmateStyle = () => `
2
2
  .rebilly-instruments-iframe {
3
3
  border: none;
4
4
  width: 100%;
5
- min-height: ${theme.space.form.minHeight};
5
+ min-height: var(--rebilly-spacings-form-element-min-height);
6
6
  transition: all 0.2s ease;
7
7
  }
8
8
  `;