@rebilly/instruments 3.13.2-beta.0 → 3.13.4-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 (84) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +66 -43
  3. package/dist/index.min.js +66 -43
  4. package/package.json +6 -3
  5. package/src/functions/destroy.js +2 -8
  6. package/src/functions/mount/fetch-data.js +2 -9
  7. package/src/functions/mount/index.js +10 -15
  8. package/src/functions/mount/mount.spec.js +11 -10
  9. package/src/functions/mount/setup-framepay-theme.js +72 -30
  10. package/src/functions/mount/setup-options.js +2 -2
  11. package/src/functions/mount/{setup-styles-vars.js → setup-styles.js} +7 -9
  12. package/src/functions/purchase.js +5 -2
  13. package/src/functions/setup.js +6 -3
  14. package/src/functions/show.js +2 -2
  15. package/src/functions/show.spec.js +4 -4
  16. package/src/functions/update.spec.js +3 -4
  17. package/src/instance.js +1 -4
  18. package/src/loader/index.js +33 -57
  19. package/src/storefront/index.js +5 -2
  20. package/src/storefront/payment-instruments.js +0 -7
  21. package/src/style/base/__snapshots__/theme.spec.js.snap +220 -136
  22. package/src/style/base/default-theme.js +14 -187
  23. package/src/style/base/index.js +79 -487
  24. package/src/style/base/theme.js +4 -3
  25. package/src/style/base/theme.spec.js +3 -2
  26. package/src/style/browserslist.js +1 -0
  27. package/src/style/components/accordion.js +140 -0
  28. package/src/style/components/address.js +55 -0
  29. package/src/style/components/button.js +117 -0
  30. package/src/style/components/divider.js +39 -0
  31. package/src/style/components/forms/checkbox.js +75 -0
  32. package/src/style/components/forms/field.js +56 -0
  33. package/src/style/components/forms/form.js +18 -0
  34. package/src/style/components/forms/input.js +77 -0
  35. package/src/style/components/forms/label.js +55 -0
  36. package/src/style/components/forms/radio.js +80 -0
  37. package/src/style/components/forms/select.js +86 -0
  38. package/src/style/components/forms/validation.js +72 -0
  39. package/src/style/components/icons.js +13 -0
  40. package/src/style/components/index.js +39 -0
  41. package/src/style/components/loader.js +41 -0
  42. package/src/style/components/methods.js +97 -0
  43. package/src/style/components/overlay.js +24 -0
  44. package/src/style/helpers/index.js +54 -0
  45. package/src/style/index.js +24 -4
  46. package/src/style/payment-instruments/content.js +8 -0
  47. package/src/style/payment-instruments/index.js +14 -0
  48. package/src/style/payment-instruments/payment-card.js +27 -0
  49. package/src/style/payment-instruments/payment-instrument-list.js +44 -0
  50. package/src/style/payment-instruments/payment-instrument.js +55 -0
  51. package/src/style/utils/color-values.js +1 -1
  52. package/src/style/utils/remove-empty-null.js +10 -0
  53. package/src/style/vendor/framepay.js +28 -0
  54. package/src/style/vendor/postmate.js +18 -0
  55. package/src/style/views/confirmation.js +26 -0
  56. package/src/style/views/index.js +16 -0
  57. package/src/style/views/method-selector.js +11 -0
  58. package/src/style/views/modal.js +91 -0
  59. package/src/style/views/result.js +52 -0
  60. package/src/style/views/summary.js +118 -0
  61. package/src/views/__snapshots__/summary.spec.js.snap +246 -0
  62. package/src/views/common/iframe/base-iframe.js +2 -3
  63. package/src/views/common/iframe/event-listeners.js +9 -12
  64. package/src/views/common/iframe/method-iframe.js +1 -3
  65. package/src/views/common/iframe/modal-iframe.js +2 -4
  66. package/src/views/common/iframe/view-iframe.js +1 -3
  67. package/src/views/confirmation.js +7 -12
  68. package/src/views/method-selector/express-methods/apple-pay.js +92 -0
  69. package/src/views/method-selector/express-methods/index.js +25 -0
  70. package/src/views/method-selector/get-payment-methods.js +1 -0
  71. package/src/views/method-selector/index.js +58 -45
  72. package/src/views/method-selector/method-selector.spec.js +1 -1
  73. package/src/views/method-selector/mount-express-methods.js +26 -66
  74. package/src/views/method-selector/mount-methods.js +178 -0
  75. package/src/views/modal.js +1 -1
  76. package/src/views/result.js +3 -3
  77. package/src/views/summary.js +190 -24
  78. package/src/views/summary.spec.js +145 -0
  79. package/tests/mocks/storefront-api-mock.js +27 -48
  80. package/src/style/utils/minifyCss.js +0 -14
  81. package/src/views/errors.js +0 -95
  82. package/src/views/method-selector/express-methods.js +0 -51
  83. package/src/views/method-selector/generate-framepay-config.js +0 -54
  84. package/src/views/method-selector/generate-framepay-config.spec.js +0 -195
@@ -0,0 +1,80 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the radio component.
3
+ // -----------------------------------------------------------------------------
4
+ export const radio = () => `
5
+ /**
6
+ * Checkbox
7
+ */
8
+ .rebilly-instruments-form-field-radio {
9
+ position: relative;
10
+ opacity: 1;
11
+ align-items: center;
12
+ display: flex;
13
+ flex-direction: row-reverse;
14
+ justify-content: start;
15
+ cursor: pointer;
16
+ transform: none;
17
+ }
18
+
19
+ .rebilly-instruments-form-field-radio > * {
20
+ cursor: pointer;
21
+ }
22
+
23
+ .rebilly-instruments-form-field-radio input[type="radio"] {
24
+ position: absolute;
25
+ opacity: 0;
26
+ cursor: pointer;
27
+ height: 0;
28
+ width: 0;
29
+ }
30
+
31
+ .rebilly-instruments-form-field-radio > span {
32
+ position: relative;
33
+ top: 0;
34
+ left: 0;
35
+ height: calc(var(--rebilly-spacings-m) - var(--rebilly-spacings-2xs));
36
+ width: calc(var(--rebilly-spacings-m) - var(--rebilly-spacings-2xs));
37
+ min-width: calc(var(--rebilly-spacings-m) - var(--rebilly-spacings-2xs));
38
+ border-radius: 50%;
39
+ box-shadow: inset 0 0 0 2px var(--rebilly-colorMutedBorder);
40
+ margin-right: var(--rebilly-spacings-s);
41
+ background-color: transparent;
42
+ transition: all 200ms;
43
+ }
44
+
45
+ .rebilly-instruments-form-field-radio > span:after {
46
+ content: '';
47
+ position: absolute;
48
+ left: 50%;
49
+ top: 50%;
50
+ transform: translateX(-50%) translateY(-50%);
51
+ opacity: 0;
52
+ width: calc(var(--rebilly-spacings-xs) + 4px);
53
+ height: calc(var(--rebilly-spacings-xs) + 4px);
54
+ border-radius: 50%;
55
+ background: var(--rebilly-colorMutedBorder);
56
+ transition: all 200ms;
57
+ }
58
+
59
+ .rebilly-instruments-form-field-radio:hover > span:after {
60
+ opacity: 1;
61
+ }
62
+
63
+ .rebilly-instruments-form-field-radio input[type="radio"]:checked ~ span {
64
+ box-shadow: inset 0 0 0 2px var(--rebilly-colorPrimary);
65
+ }
66
+
67
+ .rebilly-instruments-form-field-radio input[type="radio"]:checked ~ span:after {
68
+ background: var(--rebilly-colorPrimary);
69
+ opacity: 1;
70
+ }
71
+
72
+ .rebilly-instruments-form-field-radio input[type="radio"]:focus ~ span {
73
+ opacity: 1;
74
+ box-shadow: inset 0 0 0 2px var(--rebilly-colorPrimary);
75
+ }
76
+
77
+ .rebilly-instruments-form-field-radio input[type="radio"]:disabled ~ span {
78
+ opacity: 0.6;
79
+ }
80
+ `;
@@ -0,0 +1,86 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the select component.
3
+ // -----------------------------------------------------------------------------
4
+ export const select = () => `
5
+ /**
6
+ * Select
7
+ */
8
+ .rebilly-instruments-form-field-select {
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);
19
+ box-sizing: border-box;
20
+ box-shadow: var(--rebilly-inputBoxShadow);
21
+ width: 100%;
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);
36
+ }
37
+
38
+ .rebilly-instruments-form-field-select:focus {
39
+ outline: none;
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);
49
+ }
50
+
51
+ .rebilly-instruments-form-field-select::selection {
52
+ color: var(--rebilly-inputSelectionColorText);
53
+ background: var(--rebilly-inputSelectionColorBackground);
54
+ }
55
+
56
+
57
+ .rebilly-instruments-form-field-select:disabled {
58
+ opacity: 0.6;
59
+ }
60
+
61
+ .rebilly-instruments-form-field-select {
62
+ -webkit-appearance: none;
63
+ -moz-appearance: none;
64
+ }
65
+
66
+ .rebilly-instruments-form-field-select::-ms-expand { display: none; }
67
+
68
+ .rebilly-instruments-form-field-select-arrow {
69
+ border: solid var(--rebilly-inputColorText);
70
+ position: absolute;
71
+ width: var(--rebilly-spacings-xs);
72
+ height: var(--rebilly-spacings-xs);
73
+ border-width: 0 2px 2px 0;
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);
85
+ }
86
+ `;
@@ -0,0 +1,72 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the form validations.
3
+ // -----------------------------------------------------------------------------
4
+ export const validation = () => `
5
+ /**
6
+ * Validations
7
+ */
8
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input,
9
+ .rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-select {
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);
59
+ }
60
+
61
+ .rebilly-instruments-form-field-error-wrapper {
62
+ margin-top: var(--rebilly-spacings-2xs);
63
+ margin-bottom: 0;
64
+ padding: 0;
65
+ list-style: none;
66
+ }
67
+
68
+ .rebilly-instruments-form-field-error-wrapper > li {
69
+ color: var(--rebilly-colorDanger);
70
+ padding: 0;
71
+ }
72
+ `;
@@ -0,0 +1,13 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the icons component.
3
+ // -----------------------------------------------------------------------------
4
+ export const icons = () => `
5
+ /**
6
+ * Icons
7
+ */
8
+ .rebilly-instruments-icon {
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
+ }
13
+ `;
@@ -0,0 +1,39 @@
1
+ import { expressMethods, methods } from './methods';
2
+ import { form } from './forms/form';
3
+ import { checkbox } from './forms/checkbox';
4
+ import { radio } from './forms/radio';
5
+ import { field } from './forms/field';
6
+ import { input } from './forms/input';
7
+ import { label } from './forms/label';
8
+ import { select } from './forms/select';
9
+ import { validation } from './forms/validation';
10
+ import { button } from './button';
11
+ import { divider } from './divider';
12
+ import { loader } from './loader';
13
+ import { icons } from './icons';
14
+ import { address } from './address';
15
+ import { overlay } from './overlay';
16
+ import { accordion } from './accordion';
17
+
18
+ // Order of components matters for style cascade
19
+ export const components = (theme) => `
20
+ /* Components
21
+ ------------------------------------------------------------ */
22
+ ${expressMethods(theme)}
23
+ ${methods()}
24
+ ${form(theme)}
25
+ ${field(theme)}
26
+ ${input(theme)}
27
+ ${select(theme)}
28
+ ${label(theme)}
29
+ ${checkbox()}
30
+ ${radio()}
31
+ ${validation(theme)}
32
+ ${button(theme)}
33
+ ${divider(theme)}
34
+ ${loader(theme)}
35
+ ${icons(theme)}
36
+ ${address(theme)}
37
+ ${overlay(theme)}
38
+ ${accordion()}
39
+ `;
@@ -0,0 +1,41 @@
1
+ import { lighten } from '../utils/color-values';
2
+ // -----------------------------------------------------------------------------
3
+ // This file contains all styles related to the loader component.
4
+ // -----------------------------------------------------------------------------
5
+ export const loader = (theme) => `
6
+ /**
7
+ * Loader
8
+ */
9
+ .rebilly-instruments-loader {
10
+ display: none;
11
+ position: absolute;
12
+ top: 0;
13
+ bottom: 0;
14
+ left: 0;
15
+ right: 0;
16
+ justify-content: center;
17
+ align-items: center;
18
+ flex-direction: column;
19
+ background-color: var(--rebilly-colorBackground);
20
+ z-index: 1000;
21
+ transition: all 200ms;
22
+ }
23
+
24
+ .rebilly-instruments-loader.is-active {
25
+ display: flex;
26
+ }
27
+
28
+ .rebilly-instruments-loader-spinner {
29
+ border: 4px solid ${lighten(theme.colorPrimary, 80)};
30
+ border-top: 4px solid var(--rebilly-colorPrimary);
31
+ border-radius: 50%;
32
+ width: 40px;
33
+ height: 40px;
34
+ animation: spin 0.5s ease infinite;
35
+ }
36
+
37
+ @keyframes spin {
38
+ 0% { transform: rotate(0deg); }
39
+ 100% { transform: rotate(360deg); }
40
+ }
41
+ `;
@@ -0,0 +1,97 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the methods component.
3
+ // -----------------------------------------------------------------------------
4
+ export const expressMethods = () => `
5
+ /**
6
+ * Express methods
7
+ */
8
+
9
+ @keyframes rebillyExpressShine {
10
+ to {
11
+ background-position-x: -200%;
12
+ }
13
+ }
14
+
15
+ .rebilly-instruments-express-methods.is-compact {
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;
21
+ position: relative;
22
+ }
23
+
24
+ .rebilly-instruments-express-methods .rebilly-instruments-iframe {
25
+ display: block;
26
+ margin-bottom: 0;
27
+ height: 44px;
28
+ }
29
+
30
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > * {
31
+ border-radius: 6px;
32
+ margin-bottom: var(--rebilly-spacings-xs);
33
+ background: linear-gradient(110deg, var(--rebilly-colorMutedBorder) 0%, var(--rebilly-colorBackground) 25%, var(--rebilly-colorMutedBorder) 50%);
34
+ background-size: 200% 100%;
35
+ animation: 1.5s rebillyExpressShine linear infinite;
36
+ height: 44px;
37
+ }
38
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > *:last-child {
39
+ margin: 0;
40
+ }
41
+
42
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
43
+ display: flex;
44
+ justify-content: center;
45
+ }
46
+
47
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
48
+ flex: 1 1 0px;
49
+ max-width: 260px;
50
+ margin: 0 var(--rebilly-spacings-xs);
51
+ }
52
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:first-child {
53
+ margin-left: 0;
54
+ }
55
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
56
+ margin-right: 0;
57
+ }
58
+
59
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-label {
60
+ display: none;
61
+ }
62
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-label {
63
+ position: absolute;
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);
70
+ display: inline-block;
71
+ font-weight: 500;
72
+ min-height: auto;
73
+ margin: 0;
74
+ white-space: nowrap;
75
+ }
76
+
77
+ @media (max-width: 600px) {
78
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
79
+ flex-direction: column;
80
+ }
81
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
82
+ max-width: 100%;
83
+ margin: 0 0 var(--rebilly-spacings-s);
84
+ }
85
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
86
+ margin: 0;
87
+ }
88
+ }
89
+ `;
90
+
91
+ export const methods = () => `
92
+ /**
93
+ * Methods
94
+ */
95
+
96
+ .rebilly-instruments-methods {}
97
+ `;
@@ -0,0 +1,24 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the overlay component.
3
+ // -----------------------------------------------------------------------------
4
+ export const overlay = () => `
5
+ /**
6
+ * Overlay
7
+ */
8
+ .rebilly-instruments-overlay {
9
+ position: fixed;
10
+ left: 0;
11
+ right: 0;
12
+ top: 0;
13
+ bottom: 0;
14
+ background: rgba(0,0,0,0.8);
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
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
+ z-index: 9001
23
+ }
24
+ `;
@@ -0,0 +1,54 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to helpers.
3
+ // -----------------------------------------------------------------------------
4
+
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
+
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
+
52
+ .rebilly-instruments-display-flex { display: flex!important }
53
+ .rebilly-instruments-align-items-center { align-items: center!important }
54
+ `;
@@ -1,11 +1,31 @@
1
+ import postcss from 'postcss';
2
+ import autoprefixer from 'autoprefixer';
3
+ import { browserslist } from './browserslist';
4
+ import removeEmptyAndNull from './utils/remove-empty-null';
5
+
1
6
  import { Theme } from './base/theme';
2
- import { vars } from './base';
7
+ import { base } from './base';
8
+ import { framepayStyle } from './vendor/framepay';
9
+ import { postmateStyle } from './vendor/postmate';
10
+ import { components } from './components';
11
+ import { paymentInstruments } from './payment-instruments';
12
+ import { views } from './views';
13
+ import { helpers } from './helpers';
3
14
 
4
- export const mainStyleVars = (themeOverride) => {
15
+ export const mainStyle = async (themeOverride) => {
5
16
  const resolvedTheme = new Theme(themeOverride).build();
17
+
6
18
  const style = `
7
- ${vars(resolvedTheme)}
19
+ ${base(resolvedTheme)}
20
+ ${components(resolvedTheme)}
21
+ ${views(resolvedTheme)}
22
+ ${paymentInstruments(resolvedTheme)}
23
+ ${framepayStyle(resolvedTheme)}
24
+ ${postmateStyle(resolvedTheme)}
25
+ ${helpers(resolvedTheme)}
8
26
  `;
9
27
 
10
- return style;
28
+ return postcss([removeEmptyAndNull, autoprefixer(browserslist)])
29
+ .process(style, { from: undefined })
30
+ .then((result) => result.css);
11
31
  };
@@ -0,0 +1,8 @@
1
+ export const methodContent = () => `
2
+ /**
3
+ * Content
4
+ */
5
+ .rebilly-instruments-method-content {
6
+ padding: 2px;
7
+ }
8
+ `;
@@ -0,0 +1,14 @@
1
+ import { methodContent } from './content';
2
+ import { paymentCard } from './payment-card';
3
+ import { paymentInstrumentList } from './payment-instrument-list';
4
+ import { paymentInstrument } from './payment-instrument';
5
+
6
+ // Order of components matters for style cascade
7
+ export const paymentInstruments = (theme) => `
8
+ /* Payment instruments
9
+ ------------------------------------------------------------ */
10
+ ${methodContent()}
11
+ ${paymentCard(theme)}
12
+ ${paymentInstrument()}
13
+ ${paymentInstrumentList()}
14
+ `;
@@ -0,0 +1,27 @@
1
+ export const paymentCard = () => `
2
+ /**
3
+ * Payment card
4
+ */
5
+ .rebilly-instruments-payment-card-brands {
6
+ display: inline-flex;
7
+ width: 100%;
8
+ justify-content: flex-end;
9
+ margin-top: var(--rebilly-spacings-s);
10
+ }
11
+
12
+ .rebilly-instruments-payment-card-brands figure {
13
+ margin: 0 0 0 var(--rebilly-spacings-2xs);
14
+ padding: 0;
15
+ height: 26px;
16
+ }
17
+
18
+ .rebilly-instruments-payment-card-brands figure img {
19
+ width: auto;
20
+ height: 100%;
21
+ border-radius: 4px;
22
+ }
23
+
24
+ .rebilly-instruments-modal-container.rebilly-instruments-payment-card {
25
+ max-width: 600px;
26
+ }
27
+ `;
@@ -0,0 +1,44 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the payment instrument list component.
3
+ // -----------------------------------------------------------------------------
4
+ export const paymentInstrumentList = () => `
5
+ .rebilly-instruments-payment-instrument-list {
6
+ margin: 0;
7
+ padding: 0;
8
+ }
9
+
10
+ .rebilly-instruments-payment-instrument-list > li {
11
+ display: flex;
12
+ width: 100%;
13
+ align-items: center;
14
+ list-style-type: none;
15
+ padding: var(--rebilly-spacings-xs) 0;
16
+ }
17
+
18
+ .rebilly-instruments-payment-instrument-list > li:first-child {
19
+ padding-top: 0;
20
+ }
21
+
22
+ .rebilly-instruments-payment-instrument-list > li:last-child {
23
+ padding-bottom: 0;
24
+ }
25
+
26
+ .rebilly-instruments-payment-instrument-list > li + li {
27
+ border-top: 1px solid var(--rebilly-colorMutedBorder);
28
+ }
29
+
30
+ .rebilly-instruments-payment-instrument-list.is-relaxed > li {
31
+ min-height: var(--rebilly-spacings-form-element-min-height);
32
+ }
33
+
34
+ .rebilly-instruments-payment-instrument-list .rebilly-instruments-form-field {
35
+ width: 100%;
36
+ }
37
+
38
+ .rebilly-instruments-payment-instrument-list > li .rebilly-instruments-payment-instrument-list-container {
39
+ display: flex;
40
+ justify-content: space-between;
41
+ align-items: center;
42
+ width: 100%;
43
+ }
44
+ `;