@rebilly/instruments 2.1.1-beta.0 → 3.0.0-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 (83) hide show
  1. package/dist/functions/mount/fetch-data.js +4 -0
  2. package/dist/functions/mount/index.js +6 -0
  3. package/dist/functions/mount/mount.spec.js +2 -4
  4. package/dist/functions/mount/setup-framepay-theme.js +95 -0
  5. package/dist/functions/mount/setup-options.js +3 -0
  6. package/dist/i18n/en.json +1 -1
  7. package/dist/style/base/__snapshots__/theme.spec.js.snap +188 -45
  8. package/dist/style/base/default-theme.js +699 -0
  9. package/dist/style/base/index.js +48 -16
  10. package/dist/style/base/theme.js +16 -49
  11. package/dist/style/base/theme.spec.js +4 -15
  12. package/dist/style/components/address.js +3 -3
  13. package/dist/style/components/button.js +32 -22
  14. package/dist/style/components/divider.js +9 -9
  15. package/dist/style/components/forms/checkbox.js +12 -9
  16. package/dist/style/components/forms/field.js +18 -6
  17. package/dist/style/components/forms/form.js +2 -2
  18. package/dist/style/components/forms/input.js +54 -13
  19. package/dist/style/components/forms/label.js +44 -18
  20. package/dist/style/components/forms/select.js +54 -22
  21. package/dist/style/components/forms/validation.js +53 -6
  22. package/dist/style/components/icons.js +4 -4
  23. package/dist/style/components/loader.js +5 -3
  24. package/dist/style/components/methods.js +18 -15
  25. package/dist/style/components/overlay.js +5 -5
  26. package/dist/style/helpers/index.js +46 -46
  27. package/dist/style/index.js +3 -1
  28. package/dist/style/payment-instruments/payment-card.js +4 -4
  29. package/dist/style/utils/border.js +47 -0
  30. package/dist/style/utils/color-values.js +39 -3
  31. package/dist/style/utils/remove-empty-null.js +20 -0
  32. package/dist/style/vendor/framepay.js +11 -8
  33. package/dist/style/vendor/postmate.js +2 -2
  34. package/dist/style/views/confirmation.js +13 -13
  35. package/dist/style/views/method-selector.js +2 -2
  36. package/dist/style/views/modal.js +6 -6
  37. package/dist/style/views/result.js +4 -4
  38. package/dist/style/views/summary.js +23 -23
  39. package/dist/views/__snapshots__/summary.spec.js.snap +4 -40
  40. package/dist/views/common/iframe/modal-iframe.js +6 -1
  41. package/dist/views/summary.js +17 -11
  42. package/package.json +3 -1
  43. package/src/functions/mount/fetch-data.js +4 -0
  44. package/src/functions/mount/index.js +2 -0
  45. package/src/functions/mount/mount.spec.js +3 -5
  46. package/src/functions/mount/setup-framepay-theme.js +82 -0
  47. package/src/functions/mount/setup-options.js +3 -0
  48. package/src/i18n/en.json +1 -1
  49. package/src/style/base/__snapshots__/theme.spec.js.snap +188 -45
  50. package/src/style/base/default-theme.js +674 -0
  51. package/src/style/base/index.js +48 -16
  52. package/src/style/base/theme.js +17 -47
  53. package/src/style/base/theme.spec.js +4 -16
  54. package/src/style/components/address.js +3 -3
  55. package/src/style/components/button.js +32 -24
  56. package/src/style/components/divider.js +9 -9
  57. package/src/style/components/forms/checkbox.js +11 -11
  58. package/src/style/components/forms/field.js +18 -6
  59. package/src/style/components/forms/form.js +2 -2
  60. package/src/style/components/forms/input.js +54 -13
  61. package/src/style/components/forms/label.js +44 -18
  62. package/src/style/components/forms/select.js +54 -22
  63. package/src/style/components/forms/validation.js +53 -6
  64. package/src/style/components/icons.js +4 -4
  65. package/src/style/components/loader.js +4 -5
  66. package/src/style/components/methods.js +18 -15
  67. package/src/style/components/overlay.js +5 -5
  68. package/src/style/helpers/index.js +46 -46
  69. package/src/style/index.js +2 -1
  70. package/src/style/payment-instruments/payment-card.js +4 -4
  71. package/src/style/utils/border.js +34 -0
  72. package/src/style/utils/color-values.js +27 -1
  73. package/src/style/utils/remove-empty-null.js +10 -0
  74. package/src/style/vendor/framepay.js +11 -8
  75. package/src/style/vendor/postmate.js +2 -2
  76. package/src/style/views/confirmation.js +13 -13
  77. package/src/style/views/method-selector.js +2 -2
  78. package/src/style/views/modal.js +6 -6
  79. package/src/style/views/result.js +4 -4
  80. package/src/style/views/summary.js +23 -23
  81. package/src/views/__snapshots__/summary.spec.js.snap +4 -40
  82. package/src/views/common/iframe/modal-iframe.js +7 -1
  83. package/src/views/summary.js +17 -11
@@ -1,34 +1,60 @@
1
1
  // -----------------------------------------------------------------------------
2
2
  // This file contains all styles related to the label component.
3
3
  // -----------------------------------------------------------------------------
4
- export const label = (theme) => `
4
+ export const label = () => `
5
5
  /**
6
6
  * Label
7
7
  */
8
8
  .rebilly-instruments-form-field-label {
9
- left: ${theme.space.form.horizontalPadding};
10
- color: ${theme.color.text};
11
- top: calc(${theme.space.form.minHeight} / 2);
9
+ font-size: calc(var(--rebilly-fontSizeBase) * 0.92);
10
+ line-height: calc(var(--rebilly-fontSizeBase) * 0.92);
11
+ margin-bottom: var(--rebilly-spacings-2xs);
12
+ }
13
+
14
+ /* Floating Labels */
15
+ .is-floating .rebilly-instruments-form-field-label {
16
+ font-size: var(--rebilly-fontSizeBase);
17
+ left: var(--rebilly-spacings-label-offset-left);
18
+ color: var(--rebilly-colorText);
19
+ top: 50%;
12
20
  background: transparent;
13
- opacity: 0;
21
+ opacity: 1;
14
22
  position: absolute;
15
- transform: translateY(-50%);
16
- transition: all 200ms;
23
+ transform: translateY(-50%) scale(1);
24
+ transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), background 0.35s cubic-bezier(0.19, 1, 0.22, 1);
17
25
  cursor: text;
18
26
  pointer-events: none;
27
+ transform-origin: left top;
28
+ }
29
+
30
+ /* Includes Google autocomplete fix */
31
+ .is-floating input:-webkit-autofill + .rebilly-instruments-form-field-label,
32
+ .is-floating input:-webkit-autofill:hover + .rebilly-instruments-form-field-label,
33
+ .is-floating input:-webkit-autofill:focus + .rebilly-instruments-form-field-label,
34
+ .is-floating select:-webkit-autofill + .rebilly-instruments-form-field-label,
35
+ .is-floating select:-webkit-autofill:hover + .rebilly-instruments-form-field-label,
36
+ .is-floating select:-webkit-autofill:focus + .rebilly-instruments-form-field-label {
37
+ padding: 0 var(--rebilly-spacings-2xs);
38
+ left: calc(var(--rebilly-spacings-label-offset-left) - var(--rebilly-spacings-2xs));
39
+ line-height: 1;
40
+ background: var(--rebilly-colorBackground);
41
+ opacity: 1!important;
42
+ transform: translateY(-175%) scale(0.875);
43
+ }
44
+
45
+ .is-floating .rebilly-instruments-form-field-select + .rebilly-instruments-form-field-label {
46
+ font-size: var(--rebilly-fontSizeBase);
47
+ opacity: 0.5;
19
48
  }
20
49
 
21
- .rebilly-instruments-form-field-input:not(:placeholder-shown) + .rebilly-instruments-form-field-label,
22
- .rebilly-instruments-form-field-select:focus + .rebilly-instruments-form-field-label,
23
- .rebilly-instruments-form-field-label.is-active {
24
- padding: 0 ${theme.space.xxs};
25
- left: calc(${theme.space.form.horizontalPadding} - ${theme.space.xxs});
26
- font-size: ${theme.typography.captionFontSize};
27
- line-height: ${theme.typography.captionLineHeight};
28
- color: ${theme.color.text};
29
- background: ${theme.color.background};
30
- font-weight: 500;
50
+ .is-floating .rebilly-instruments-form-field-input:focus + .rebilly-instruments-form-field-label,
51
+ .is-floating .rebilly-instruments-form-field-select:focus + .rebilly-instruments-form-field-label,
52
+ .is-floating .rebilly-instruments-form-field-label.is-active {
53
+ padding: 0 var(--rebilly-spacings-2xs);
54
+ left: calc(var(--rebilly-spacings-label-offset-left) - var(--rebilly-spacings-2xs));
55
+ line-height: 1;
56
+ background: var(--rebilly-colorBackground);
31
57
  opacity: 1;
32
- top: 0;
58
+ transform: translateY(-175%) scale(0.875);
33
59
  }
34
60
  `;
@@ -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
+ );