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