@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
@@ -6,6 +6,33 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.base = void 0;
7
7
 
8
8
  const base = theme => `
9
+ /* Instruments 'global' variables
10
+ ------------------------------------------------------------ */
11
+ :root,
12
+ #rebilly-instruments-app,
13
+ .rebilly-instruments-content,
14
+ .rebilly-instruments-loader,
15
+ .rebilly-instruments-modal-overlay {
16
+ ${theme.cssVars}
17
+
18
+ --rebilly-spacings-base: calc(var(--rebilly-fontSizeBase) * 1.5);
19
+ --rebilly-spacings-2xs: calc(var(--rebilly-spacings-base) * 0.16667);
20
+ --rebilly-spacings-xs: calc(var(--rebilly-spacings-base) * 0.25);
21
+ --rebilly-spacings-s: calc(var(--rebilly-spacings-base) * 0.5);
22
+ --rebilly-spacings-m: var(--rebilly-spacings-base);
23
+ --rebilly-spacings-l: calc(var(--rebilly-spacings-base) * 2);
24
+ --rebilly-spacings-xl: calc(var(--rebilly-spacings-base) * 4);
25
+ --rebilly-spacings-2xl: calc(var(--rebilly-spacings-base) * 4.6667);
26
+
27
+ --rebilly-spacings-input-py: calc(var(--rebilly-spacings-2xs) * 2);
28
+ --rebilly-spacings-input-px: calc(var(--rebilly-spacings-s) + var(--rebilly-spacings-2xs));
29
+ --rebilly-spacings-label-offset-left: var(--rebilly-spacings-input-px);
30
+ --rebilly-spacings-form-element-min-height: calc(var(--rebilly-spacings-base) * 1.83333);
31
+ --rebilly-spacings-button-py: var(--rebilly-spacings-input-py);
32
+ --rebilly-spacings-button-px: var(--rebilly-spacings-input-px);
33
+ }
34
+
35
+
9
36
  /* Base, Typography
10
37
  ------------------------------------------------------------ */
11
38
  /* Base setup for top level elements */
@@ -13,19 +40,21 @@ const base = theme => `
13
40
  .rebilly-instruments-method-content,
14
41
  .rebilly-instruments-confirmation,
15
42
  .rebilly-instruments-results {
16
- color: ${theme.color.text};
17
- background: ${theme.color.background};
18
- font-size: ${theme.typography.fontSize};
19
- line-height: ${theme.typography.lineHeight};
20
- font-family: ${theme.typography.fontFamily};
43
+ color: var(--rebilly-colorText);
44
+ background: var(--rebilly-colorBackground);
45
+ font-size: var(--rebilly-fontSizeBase);
46
+ font-weight: var(--rebilly-fontWeightBase);
47
+ line-height: var(--rebilly-fontLineHeightBase, calc(var(--rebilly-fontSizeBase) * 1.5));
48
+ font-family: var(--rebilly-fontFamily);
21
49
  -webkit-font-smoothing: antialiased;
22
50
  -moz-osx-font-smoothing: grayscale;
23
51
  text-align: left;
24
52
  transition: all 200ms;
53
+ font-smooth: var(--rebilly-fontSmooth);
25
54
  }
26
55
 
27
56
  .rebilly-instruments-link {
28
- color: ${theme.color.primary};
57
+ color: var(--rebilly-colorPrimary);
29
58
  cursor: pointer;
30
59
  }
31
60
 
@@ -34,7 +63,7 @@ const base = theme => `
34
63
  }
35
64
 
36
65
  .rebilly-instruments-link .rebilly-instruments-icon {
37
- fill: ${theme.color.primary};
66
+ fill: var(--rebilly-colorPrimary);
38
67
  }
39
68
 
40
69
  .rebilly-instruments-link.has-icon-left,
@@ -43,29 +72,32 @@ const base = theme => `
43
72
  }
44
73
 
45
74
  .rebilly-instruments-link.has-icon-left .rebilly-instruments-icon {
46
- margin-right: ${theme.space.xs};
75
+ margin-right: var(--rebilly-spacings-xs);
47
76
  }
48
77
 
49
78
  .rebilly-instruments-link.has-icon-right .rebilly-instruments-icon {
50
- margin-left: ${theme.space.xs};
79
+ margin-left: var(--rebilly-spacings-xs);
51
80
  }
52
81
 
53
82
  /* Typography */
54
83
  .rebilly-instruments-h1,
55
84
  .rebilly-instruments-h2 {
56
- font-weight: 500;
85
+ font-weight: var(--rebilly-headingFontWeight);
86
+ font-family: var(--rebilly-headingFontFamily);
87
+ color: var(--rebilly-headingColorText);
57
88
  }
58
89
 
59
90
  .rebilly-instruments-h1 {
60
- font-size: calc(${theme.typography.fontSize} * 1.5);
61
- line-height: calc(${theme.typography.lineHeight} * 1.5);
62
- margin: 0 0 calc(${theme.space.m} * 1.5) 0;
91
+ font-size: calc(var(--rebilly-fontSizeBase) * 1.5);
92
+ line-height: 1.5;
93
+ line-height: calc(${theme.fontLineHeightBase} * 1.5);
94
+ margin: 0 0 calc(var(--rebilly-spacings-base) * 1.5) 0;
63
95
  }
64
96
 
65
97
  .rebilly-instruments-h2 {
66
- font-size: calc(${theme.typography.fontSize} * 1.12);
67
- line-height: ${theme.typography.lineHeight};
68
- margin: 0 0 ${theme.space.m} 0;
98
+ font-size: calc(var(--rebilly-fontSizeBase) * 1.125);
99
+ line-height: var(--rebilly-fontLineHeightBase, 1.33);
100
+ margin: 0 0 var(--rebilly-spacings-base) 0;
69
101
  }
70
102
  `;
71
103
 
@@ -5,69 +5,37 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Theme = void 0;
7
7
 
8
- var _lodash = _interopRequireDefault(require("lodash.merge"));
9
-
10
- var _colorValues = require("../utils/color-values");
8
+ var _defaultTheme = _interopRequireDefault(require("./default-theme"));
11
9
 
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
11
 
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
14
  class Theme {
15
15
  constructor(overrides = {}) {
16
16
  this.overrides = overrides;
17
- this.theme = {
18
- color: {
19
- primary: '#0044d4',
20
- errorText: '#cd5c5c',
21
- text: '#0D2B3E',
22
- buttonText: '#ffffff',
23
- background: '#ffffff'
24
- },
25
- typography: {
26
- fontFamily: 'Avenir, Helvetica, Arial, sans-serif',
27
- fontSize: '16px',
28
- lineHeight: '24px',
29
- captionFontSize: '12px',
30
- captionLineHeight: '12px'
31
- },
32
- space: {
33
- xxs: '4px',
34
- xs: '6px',
35
- s: '12px',
36
- m: '24px',
37
- l: '48px',
38
- xl: '96px',
39
- xxl: '112px',
40
- form: {
41
- padding: '8px 16px',
42
- verticalPadding: '8px',
43
- horizontalPadding: '16px',
44
- minHeight: '44px'
45
- }
46
- },
47
- borderRadius: '4px'
48
- };
17
+ this.theme = _defaultTheme.default;
49
18
  }
50
19
 
51
- get getComputed() {
52
- return this.computed();
20
+ overrideTheme() {
21
+ Object.keys(this.overrides).forEach(prop => {
22
+ this.theme[prop] = this.overrides[prop];
23
+ });
53
24
  }
54
25
 
55
- computed() {
56
- return {
57
- color: {
58
- primaryValues: (0, _colorValues.colorValues)(this.theme.color.primary),
59
- mutedText: (0, _colorValues.alphaColor)(this.theme.color.text, 0.6),
60
- mutedBorder: (0, _colorValues.alphaColor)(this.theme.color.text, 0.25)
61
- }
62
- };
26
+ get cssVars() {
27
+ return Object.keys(this.theme).filter(v => !Theme.nonCssProperties.includes(v)).map(p => `--rebilly-${p}: ${this.theme[p]};`).join('\n');
63
28
  }
64
29
 
65
30
  build() {
66
- return { ...(0, _lodash.default)(this.theme, this.overrides),
67
- getComputed: this.getComputed
31
+ this.overrideTheme();
32
+ return { ...this.theme,
33
+ cssVars: this.cssVars
68
34
  };
69
35
  }
70
36
 
71
37
  }
72
38
 
73
- exports.Theme = Theme;
39
+ exports.Theme = Theme;
40
+
41
+ _defineProperty(Theme, "nonCssProperties", ['labels']);
@@ -2,10 +2,6 @@
2
2
 
3
3
  var _theme = require("./theme");
4
4
 
5
- var _values = _interopRequireDefault(require("values.js"));
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
5
  describe('RebillyInstruments theme', () => {
10
6
  it('builds the theme object', () => {
11
7
  const theme = new _theme.Theme().build();
@@ -13,18 +9,11 @@ describe('RebillyInstruments theme', () => {
13
9
  });
14
10
  it('properly overrides the default properties', () => {
15
11
  const overrides = {
16
- color: {
17
- primary: 'purple',
18
- text: 'gray'
19
- }
12
+ colorPrimary: 'red',
13
+ buttonBorderRadius: '30px'
20
14
  };
21
15
  const theme = new _theme.Theme(overrides).build();
22
- expect(theme.color.primary).toEqual('purple');
23
- expect(theme.color.text).toEqual('gray');
24
- });
25
- it('computes new styles from theme properties', () => {
26
- const theme = new _theme.Theme().build();
27
- expect(theme.getComputed.color.primaryValues instanceof _values.default).toEqual(true);
28
- expect(theme.getComputed.color.mutedText).toEqual('rgba(13, 43, 62, 0.6)');
16
+ expect(theme.colorPrimary).toEqual('red');
17
+ expect(theme.buttonBorderRadius).toEqual('30px');
29
18
  });
30
19
  });
@@ -8,13 +8,13 @@ exports.address = void 0;
8
8
  // -----------------------------------------------------------------------------
9
9
  // This file contains all styles related to the address component.
10
10
  // -----------------------------------------------------------------------------
11
- const address = theme => `
11
+ const address = () => `
12
12
  /**
13
13
  * Address
14
14
  */
15
15
  .rebilly-instruments-address {
16
- margin: 0 0 ${theme.space.m};
17
- color: ${theme.getComputed.color.mutedText};
16
+ margin: 0 0 var(--rebilly-spacings-base);
17
+ color: var(--rebilly-colorMutedText);
18
18
  font-style: normal;
19
19
  }
20
20
 
@@ -8,22 +8,23 @@ exports.button = void 0;
8
8
  // -----------------------------------------------------------------------------
9
9
  // This file contains all styles related to the button component.
10
10
  // -----------------------------------------------------------------------------
11
- const button = theme => `
11
+ const button = () => `
12
12
  /**
13
13
  * Buttons
14
14
  */
15
15
  .rebilly-instruments-button {
16
- font-size: ${theme.typography.fontSize};
17
- font-family: ${theme.typography.fontFamily};
18
- line-height: ${theme.typography.lineHeight};
19
- padding: ${theme.space.form.padding};
16
+ font-size: var(--rebilly-buttonFontSize);
17
+ font-family: var(--rebilly-buttonFontFamily);
18
+ line-height: var(--rebilly-buttonFontLineHeight);
19
+ padding: var(--rebilly-spacings-button-py) var(--rebilly-spacings-button-px);
20
20
  box-sizing: border-box;
21
- background: ${theme.color.primary};
22
- color: ${theme.color.buttonText};
23
- border-radius: ${theme.borderRadius};
24
- margin: calc(${theme.space.xxs} + ${theme.space.s} / 2) 0;
25
- font-weight: 500;
26
- border: none;
21
+ background: var(--rebilly-buttonColorBackground);
22
+ color: var(--rebilly-buttonColorText, #FFF);
23
+ border-radius: var(--rebilly-buttonBorderRadius);
24
+ font-weight: var(--rebilly-buttonFontWeight);
25
+ border: var(--rebilly-buttonBorder);
26
+ box-shadow: var(--rebilly-buttonBoxShadow);
27
+ margin: calc(var(--rebilly-spacings-2xs) + var(--rebilly-spacings-s) / 2) 0;
27
28
  width: 100%;
28
29
  cursor: pointer;
29
30
  min-height: 44px;
@@ -31,25 +32,34 @@ const button = theme => `
31
32
  outline: none;
32
33
  }
33
34
 
34
- .rebilly-instruments-button:hover,
35
- .rebilly-instruments-button:active {
36
- background: ${theme.getComputed.color.primaryValues.shade(20).hexString()};
35
+ .rebilly-instruments-button:not([disabled]):hover {
36
+ background: var(--rebilly-buttonHoverColorBackground);
37
+ }
38
+
39
+ .rebilly-instruments-button:not([disabled]):active {
40
+ background: var(--rebilly-buttonActiveColorBackground);
37
41
  }
38
42
 
39
43
  .rebilly-instruments-button.rebilly-instruments-button-secondary {
40
- background: ${theme.color.background};
41
- box-shadow: inset 0 0 0 1px ${theme.color.primary};
42
- color: ${theme.color.primary};
44
+ background: var(--rebilly-colorBackground);
45
+ color: var(--rebilly-buttonColorBackground);
46
+ border-color: var(--rebilly-buttonColorBackground);
43
47
  }
44
48
 
45
- .rebilly-instruments-button.rebilly-instruments-button-secondary:hover,
46
- .rebilly-instruments-button.rebilly-instruments-button-secondary:active {
47
- background: ${theme.color.background};
49
+ .rebilly-instruments-button.rebilly-instruments-button-secondary:not([disabled]):hover,
50
+ .rebilly-instruments-button.rebilly-instruments-button-secondary:not([disabled]):active {
51
+ background: var(--rebilly-colorBackground);
48
52
  }
49
53
 
50
- .rebilly-instruments-button:focus { box-shadow: 0 0 0 2px ${theme.getComputed.color.primaryValues.tint(60).hexString()}; }
54
+ .rebilly-instruments-button:focus {
55
+ box-shadow: 0 0 0 1px var(--rebilly-colorPrimary);
56
+ }
51
57
 
52
- .rebilly-instruments-button:disabled { opacity: 0.6; }
58
+ .rebilly-instruments-button:disabled,
59
+ .rebilly-instruments-button:disabled:hover {
60
+ cursor: not-allowed;
61
+ opacity: 0.6;
62
+ }
53
63
 
54
64
  .rebilly-instruments-button::first-letter { text-transform: uppercase; }
55
65
 
@@ -8,13 +8,13 @@ exports.divider = void 0;
8
8
  // -----------------------------------------------------------------------------
9
9
  // This file contains all styles related to the divider component.
10
10
  // -----------------------------------------------------------------------------
11
- const divider = theme => `
11
+ const divider = () => `
12
12
  /**
13
13
  * Divider
14
14
  */
15
15
  .rebilly-instruments-divider {
16
- line-height: ${theme.typography.lineHeight};
17
- padding: ${theme.space.m} 0;
16
+ line-height: var(--rebilly-fontLineHeightBase, calc(var(--rebilly-fontSizeBase) * 1.5));
17
+ padding: var(--rebilly-spacings-base) 0;
18
18
  margin: 0;
19
19
  position: relative;
20
20
  outline: 0;
@@ -23,7 +23,7 @@ const divider = theme => `
23
23
  }
24
24
 
25
25
  .rebilly-instruments-divider::before {
26
- background: ${theme.getComputed.color.mutedBorder};
26
+ background: var(--rebilly-colorMutedBorder);
27
27
  content: '';
28
28
  position: absolute;
29
29
  left: 0;
@@ -33,13 +33,13 @@ const divider = theme => `
33
33
  }
34
34
 
35
35
  .rebilly-instruments-divider .rebilly-instruments-divider-label {
36
- color: ${theme.getComputed.color.mutedText};
36
+ color: var(--rebilly-colorMutedText);
37
37
  font-weight: 500;
38
38
  text-transform: uppercase;
39
- padding: 0 ${theme.space.s};
40
- line-height: 14px;
41
- background-color: ${theme.color.background};
42
- font-size: 12px;
39
+ padding: 0 var(--rebilly-spacings-s);
40
+ line-height: calc(var(--rebilly-fontSizeBase) * 0.875);
41
+ background-color: var(--rebilly-colorBackground);
42
+ font-size: calc(var(--rebilly-fontSizeBase) * 0.875);
43
43
  position: relative;
44
44
  display: inline-block;
45
45
  }
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.checkbox = void 0;
7
7
 
8
+ var _colorValues = require("../../utils/color-values");
9
+
8
10
  // -----------------------------------------------------------------------------
9
11
  // This file contains all styles related to the checkbox component.
10
12
  // -----------------------------------------------------------------------------
@@ -15,9 +17,10 @@ const checkbox = theme => `
15
17
  .rebilly-instruments-form-field-checkbox {
16
18
  position: relative;
17
19
  opacity: 1;
18
- padding-left: calc(${theme.space.m} + ${theme.space.s});
19
20
  align-items: center;
20
- display: inline-block;
21
+ display: flex;
22
+ flex-direction: row-reverse;
23
+ justify-content: start;
21
24
  cursor: pointer;
22
25
  transform: none;
23
26
  }
@@ -35,13 +38,14 @@ const checkbox = theme => `
35
38
  }
36
39
 
37
40
  .rebilly-instruments-form-field-checkbox span {
38
- position: absolute;
41
+ position: relative;
39
42
  top: 0;
40
43
  left: 0;
41
44
  height: 24px;
42
45
  width: 24px;
43
- border-radius: ${theme.borderRadius};
44
- box-shadow: inset 0 0 0 1px ${theme.getComputed.color.mutedBorder};
46
+ border-radius: 4px;
47
+ box-shadow: inset 0 0 0 1px var(--rebilly-colorMutedBorder);
48
+ margin-right: var(--rebilly-spacings-s);
45
49
  background-color: transparent;
46
50
  transition: all 200ms;
47
51
  }
@@ -54,7 +58,7 @@ const checkbox = theme => `
54
58
  opacity: 0;
55
59
  width: 5px;
56
60
  height: 11px;
57
- border: solid ${theme.color.primary};
61
+ border: solid var(--rebilly-colorPrimary);
58
62
  border-width: 0 2px 2px 0;
59
63
  -webkit-transform: rotate(45deg);
60
64
  -ms-transform: rotate(45deg);
@@ -63,7 +67,7 @@ const checkbox = theme => `
63
67
  }
64
68
 
65
69
  .rebilly-instruments-form-field-checkbox input[type="checkbox"]:checked ~ span {
66
- box-shadow: inset 0 0 0 2px ${theme.color.primary};
70
+ box-shadow: inset 0 0 0 2px var(--rebilly-colorPrimary);
67
71
  }
68
72
 
69
73
  .rebilly-instruments-form-field-checkbox input[type="checkbox"]:checked ~ span:after {
@@ -71,8 +75,7 @@ const checkbox = theme => `
71
75
  }
72
76
 
73
77
  .rebilly-instruments-form-field-checkbox input[type="checkbox"]:focus ~ span {
74
- box-shadow: 0 0 0 2px ${theme.getComputed.color.primaryValues.tint(80).hexString()},
75
- inset 0 0 0 1px ${theme.color.primary};
78
+ box-shadow: 0 0 0 2px ${(0, _colorValues.lighten)(theme.colorPrimary, 80)}, inset 0 0 0 1px var(--rebilly-colorPrimary);
76
79
  }
77
80
 
78
81
  .rebilly-instruments-form-field-checkbox input[type="checkbox"]:disabled ~ span {
@@ -8,25 +8,37 @@ exports.field = void 0;
8
8
  // -----------------------------------------------------------------------------
9
9
  // This file contains all styles related to the field component.
10
10
  // -----------------------------------------------------------------------------
11
- const field = theme => `
11
+ const field = () => `
12
12
  /**
13
13
  * Field
14
14
  */
15
15
  .rebilly-instruments-form-field {
16
- margin: calc(${theme.space.xxs} + ${theme.space.s}) 0;
16
+ margin: calc(var(--rebilly-spacings-xs) + var(--rebilly-spacings-s)) 0;
17
+ position: relative;
18
+ }
19
+
20
+ .rebilly-instruments-form-field.is-compact {
21
+ margin-top: calc(var(--rebilly-spacings-2xs) + var(--rebilly-spacings-s));
22
+ margin-bottom: calc(var(--rebilly-spacings-2xs) + var(--rebilly-spacings-s));
23
+ }
24
+
25
+ .rebilly-instruments-form-field > div {
26
+ display: flex;
27
+ flex-wrap: wrap;
28
+ flex-direction: column;
17
29
  position: relative;
18
30
  }
19
31
 
20
32
  /* Field group */
21
33
  .rebilly-instruments-form-field-group {
22
- margin: calc(-${theme.space.xxs} - ${theme.space.s}) 0;
34
+ margin: calc(calc(var(--rebilly-spacings-xs) * -1) - var(--rebilly-spacings-s)) 0;
23
35
  display: flex;
24
36
  }
25
37
 
26
38
  .rebilly-instruments-form-field-group > * {
27
39
  flex: 1 0;
28
- margin-left: ${theme.space.xs};
29
- margin-right: ${theme.space.xs}
40
+ margin-left: var(--rebilly-spacings-xs);
41
+ margin-right: var(--rebilly-spacings-xs);
30
42
  }
31
43
 
32
44
  .rebilly-instruments-form-field-group > *:first-child {
@@ -40,7 +52,7 @@ const field = theme => `
40
52
  @media (max-width: 480px) {
41
53
  .rebilly-instruments-form-field-group {
42
54
  display: block;
43
- margin: calc(${theme.space.xxs} + ${theme.space.s}) 0;
55
+ margin: calc(var(--rebilly-spacings-2xs) + var(--rebilly-spacings-s)) 0;
44
56
  }
45
57
 
46
58
  .rebilly-instruments-form-field-group > * {
@@ -8,7 +8,7 @@ exports.form = void 0;
8
8
  // -----------------------------------------------------------------------------
9
9
  // This file contains all styles related to the form component.
10
10
  // -----------------------------------------------------------------------------
11
- const form = theme => `
11
+ const form = () => `
12
12
  /**
13
13
  * Form
14
14
  */
@@ -19,7 +19,7 @@ const form = theme => `
19
19
  .rebilly-instruments-form select:-webkit-autofill,
20
20
  .rebilly-instruments-form select:-webkit-autofill:hover,
21
21
  .rebilly-instruments-form select:-webkit-autofill:focus {
22
- -webkit-text-fill-color: ${theme.color.text};
22
+ -webkit-text-fill-color: var(--rebilly-colorText);
23
23
  -webkit-box-shadow: 0 0 0px 1000px transparent inset;
24
24
  transition: background-color 5000s ease-in-out 0s;
25
25
  }
@@ -8,38 +8,79 @@ exports.input = void 0;
8
8
  // -----------------------------------------------------------------------------
9
9
  // This file contains all styles related to the input component.
10
10
  // -----------------------------------------------------------------------------
11
- const input = theme => `
11
+ const input = () => `
12
12
  /**
13
13
  * Input
14
14
  */
15
15
  .rebilly-instruments-form-field-input {
16
- font-size: ${theme.typography.fontSize};
17
- line-height: ${theme.typography.lineHeight};
18
- padding: ${theme.space.form.padding};
19
- min-height: ${theme.space.form.minHeight};
20
- border: 1px solid ${theme.getComputed.color.mutedBorder};
21
- border-radius: ${theme.borderRadius};
22
- color: ${theme.color.text};
23
- background: transparent;
16
+ font-size: var(--rebilly-inputFontSize);
17
+ font-family: var(--rebilly-inputFontFamily);
18
+ font-weight: var(--rebilly-inputFontWeight);
19
+ line-height: var(--rebilly-inputFontLineHeight);
20
+ padding: var(--rebilly-spacings-input-py) var(--rebilly-spacings-input-px);
21
+ min-height: var(--rebilly-spacings-form-element-min-height);
22
+ border: var(--rebilly-inputBorder);
23
+ border-radius: var(--rebilly-inputBorderRadius);
24
+ color: var(--rebilly-inputColorText);
25
+ background: var(--rebilly-inputColorBackground);
24
26
  box-sizing: border-box;
27
+ box-shadow: var(--rebilly-inputBoxShadow);
25
28
  width: 100%;
26
29
  transition: all 200ms;
30
+ order: 1;
31
+ }
32
+
33
+ .rebilly-instruments-form-field-input:hover {
34
+ background: var(--rebilly-inputHoverColorBackground);
35
+ color: var(--rebilly-inputHoverColorText);
36
+ font-family: var(--rebilly-inputHoverFontFamily);
37
+ font-size: var(--rebilly-inputHoverFontSize);
38
+ line-height: var(--rebilly-inputHoverFontLineHeight);
39
+ font-weight: var(--rebilly-inputHoverFontWeight);
40
+ border: var(--rebilly-inputHoverBorder);
41
+ border-radius: var(--rebilly-inputHoverBorderRadius);
42
+ box-shadow: var(--rebilly-inputHoverBoxShadow);
27
43
  }
28
44
 
29
45
  .rebilly-instruments-form-field-input:focus {
30
46
  outline: none;
31
- border: 1px solid ${theme.color.primary};
32
- box-shadow: 0 0 0 1px ${theme.color.primary};
47
+ background: var(--rebilly-inputFocusColorBackground);
48
+ color: var(--rebilly-inputFocusColorText);
49
+ font-family: var(--rebilly-inputFocusFontFamily);
50
+ font-size: var(--rebilly-inputFocusFontSize);
51
+ line-height: var(--rebilly-inputFocusFontLineHeight);
52
+ font-weight: var(--rebilly-inputFocusFontWeight);
53
+ border: var(--rebilly-inputFocusBorder);
54
+ border-radius: var(--rebilly-inputFocusBorderRadius);
55
+ box-shadow: var(--rebilly-inputFocusBoxShadow);
33
56
  }
34
57
 
35
58
  .rebilly-instruments-form-field-input::placeholder {
36
- color: ${theme.color.text};
37
- opacity: 0.5;
59
+ color: var(--rebilly-inputPlaceholderColorText);
60
+ font-family: var(--rebilly-inputPlaceholderFontFamily);
61
+ font-size: var(--rebilly-inputPlaceholderFontSize);
62
+ line-height: var(--rebilly-inputPlaceholderFontLineHeight);
63
+ font-weight: var(--rebilly-inputPlaceholderFontWeight);
64
+ opacity: 1;
65
+ }
66
+
67
+ .rebilly-instruments-form-field-input::selection {
68
+ color: var(--rebilly-inputSelectionColorText);
69
+ background: var(--rebilly-inputSelectionColorBackground);
38
70
  }
39
71
 
40
72
  .rebilly-instruments-form-field-input:disabled {
41
73
  opacity: 0.6;
42
74
  }
75
+
76
+ /* Floating Labels */
77
+ .is-floating .rebilly-instruments-form-field-input::placeholder {
78
+ opacity: 0;
79
+ }
80
+
81
+ .is-floating .rebilly-instruments-form-field-input:focus::placeholder {
82
+ opacity: 1;
83
+ }
43
84
  `;
44
85
 
45
86
  exports.input = input;