@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.
- package/dist/events/index.js +2 -1
- package/dist/functions/mount/fetch-data.js +187 -0
- package/dist/functions/mount/fetch-data.spec.js +189 -0
- package/dist/functions/mount/index.js +132 -164
- package/dist/functions/mount/mount.spec.js +2 -4
- package/dist/functions/mount/setup-element.js +40 -0
- package/dist/functions/mount/setup-framepay-theme.js +95 -0
- package/dist/functions/mount/setup-framepay.js +5 -1
- package/dist/functions/mount/setup-i18n.js +33 -0
- package/dist/functions/mount/setup-options.js +68 -47
- package/dist/functions/mount/setup-options.spec.js +66 -0
- package/dist/functions/mount/setup-storefront.js +6 -4
- package/dist/functions/mount/setup-styles.js +4 -2
- package/dist/functions/purchase.js +129 -24
- package/dist/functions/purchase.spec.js +13 -10
- package/dist/functions/setup.js +85 -0
- package/dist/functions/setup.spec.js +87 -0
- package/dist/functions/show.js +8 -4
- package/dist/functions/show.spec.js +9 -5
- package/dist/functions/update.js +39 -24
- package/dist/functions/update.spec.js +0 -4
- package/dist/i18n/en.json +5 -2
- package/dist/i18n/es.json +4 -1
- package/dist/index.js +17 -3
- package/dist/index.spec.js +3 -16
- package/dist/loader/index.js +4 -3
- package/dist/storefront/index.js +33 -0
- package/dist/storefront/invoices.js +27 -0
- package/dist/storefront/models/base-model.js +18 -0
- package/dist/storefront/models/invoice-model.js +14 -0
- package/dist/storefront/models/plan-model.js +4 -35
- package/dist/storefront/models/product-model.js +4 -23
- package/dist/storefront/models/summary-model.js +12 -25
- package/dist/storefront/models/transaction-model.js +31 -0
- package/dist/storefront/payment-instruments.js +47 -0
- package/dist/storefront/payment-instruments.spec.js +55 -0
- package/dist/storefront/plans.js +10 -18
- package/dist/storefront/plans.spec.js +3 -13
- package/dist/storefront/products.js +10 -13
- package/dist/storefront/products.spec.js +12 -19
- package/dist/storefront/purchase.js +23 -12
- package/dist/storefront/purchase.spec.js +1 -20
- package/dist/storefront/ready-to-pay.js +18 -15
- package/dist/storefront/ready-to-pay.spec.js +2 -12
- package/dist/storefront/summary.js +21 -17
- package/dist/storefront/summary.spec.js +4 -15
- package/dist/storefront/transactions.js +27 -0
- package/dist/style/base/__snapshots__/theme.spec.js.snap +188 -45
- package/dist/style/base/default-theme.js +699 -0
- package/dist/style/base/index.js +48 -16
- package/dist/style/base/theme.js +16 -48
- package/dist/style/base/theme.spec.js +4 -15
- package/dist/style/components/address.js +3 -3
- package/dist/style/components/button.js +32 -22
- package/dist/style/components/divider.js +9 -9
- package/dist/style/components/forms/checkbox.js +12 -9
- package/dist/style/components/forms/field.js +18 -6
- package/dist/style/components/forms/form.js +2 -2
- package/dist/style/components/forms/input.js +54 -13
- package/dist/style/components/forms/label.js +39 -18
- package/dist/style/components/forms/select.js +54 -22
- package/dist/style/components/forms/validation.js +53 -6
- package/dist/style/components/icons.js +4 -4
- package/dist/style/components/loader.js +5 -3
- package/dist/style/components/methods.js +18 -15
- package/dist/style/components/overlay.js +5 -5
- package/dist/style/helpers/index.js +46 -46
- package/dist/style/index.js +3 -1
- package/dist/style/payment-instruments/payment-card.js +4 -4
- package/dist/style/utils/border.js +47 -0
- package/dist/style/utils/color-values.js +39 -3
- package/dist/style/utils/remove-empty-null.js +20 -0
- package/dist/style/vendor/framepay.js +11 -8
- package/dist/style/vendor/postmate.js +2 -2
- package/dist/style/views/confirmation.js +13 -13
- package/dist/style/views/method-selector.js +2 -2
- package/dist/style/views/modal.js +6 -6
- package/dist/style/views/result.js +4 -4
- package/dist/style/views/summary.js +26 -22
- package/dist/views/__snapshots__/summary.spec.js.snap +77 -119
- package/dist/views/common/iframe/base-iframe.js +2 -0
- package/dist/views/common/iframe/modal-iframe.js +50 -4
- package/dist/views/confirmation.js +19 -8
- package/dist/views/method-selector/generate-digital-wallet.js +12 -3
- package/dist/views/method-selector/generate-digital-wallet.spec.js +11 -0
- package/dist/views/method-selector/get-payment-methods.js +13 -2
- package/dist/views/method-selector/get-payment-methods.spec.js +21 -19
- package/dist/views/method-selector/index.js +23 -34
- package/dist/views/method-selector/method-selector.spec.js +50 -55
- package/dist/views/method-selector/mount-methods.js +5 -8
- package/dist/views/modal.js +8 -2
- package/dist/views/result.js +3 -4
- package/dist/views/summary.js +156 -97
- package/dist/views/summary.spec.js +53 -58
- package/package.json +4 -2
- package/src/events/index.js +2 -1
- package/src/functions/mount/fetch-data.js +152 -0
- package/src/functions/mount/fetch-data.spec.js +238 -0
- package/src/functions/mount/index.js +101 -158
- package/src/functions/mount/mount.spec.js +3 -5
- package/src/functions/mount/setup-element.js +26 -0
- package/src/functions/mount/setup-framepay-theme.js +82 -0
- package/src/functions/mount/setup-framepay.js +5 -1
- package/src/functions/mount/setup-i18n.js +19 -0
- package/src/functions/mount/setup-options.js +78 -48
- package/src/functions/mount/setup-options.spec.js +60 -0
- package/src/functions/mount/setup-storefront.js +6 -4
- package/src/functions/mount/setup-styles.js +4 -2
- package/src/functions/on.spec.js +1 -1
- package/src/functions/purchase.js +99 -23
- package/src/functions/purchase.spec.js +10 -10
- package/src/functions/setup.js +48 -0
- package/src/functions/setup.spec.js +98 -0
- package/src/functions/show.js +2 -4
- package/src/functions/show.spec.js +3 -4
- package/src/functions/update.js +40 -25
- package/src/functions/update.spec.js +0 -4
- package/src/i18n/en.json +5 -2
- package/src/i18n/es.json +4 -1
- package/src/index.js +9 -3
- package/src/index.spec.js +3 -21
- package/src/loader/index.js +3 -3
- package/src/storefront/index.js +28 -0
- package/src/storefront/invoices.js +11 -0
- package/src/storefront/models/base-model.js +10 -0
- package/src/storefront/models/invoice-model.js +3 -0
- package/src/storefront/models/plan-model.js +3 -35
- package/src/storefront/models/product-model.js +3 -23
- package/src/storefront/models/summary-model.js +12 -19
- package/src/storefront/models/transaction-model.js +19 -0
- package/src/storefront/payment-instruments.js +30 -0
- package/src/storefront/payment-instruments.spec.js +69 -0
- package/src/storefront/plans.js +6 -17
- package/src/storefront/plans.spec.js +4 -11
- package/src/storefront/products.js +8 -16
- package/src/storefront/products.spec.js +16 -22
- package/src/storefront/purchase.js +14 -16
- package/src/storefront/purchase.spec.js +2 -14
- package/src/storefront/ready-to-pay.js +13 -16
- package/src/storefront/ready-to-pay.spec.js +3 -10
- package/src/storefront/summary.js +19 -17
- package/src/storefront/summary.spec.js +5 -12
- package/src/storefront/transactions.js +11 -0
- package/src/style/base/__snapshots__/theme.spec.js.snap +188 -45
- package/src/style/base/default-theme.js +674 -0
- package/src/style/base/index.js +48 -16
- package/src/style/base/theme.js +17 -47
- package/src/style/base/theme.spec.js +4 -16
- package/src/style/components/address.js +3 -3
- package/src/style/components/button.js +32 -24
- package/src/style/components/divider.js +9 -9
- package/src/style/components/forms/checkbox.js +11 -11
- package/src/style/components/forms/field.js +18 -6
- package/src/style/components/forms/form.js +2 -2
- package/src/style/components/forms/input.js +54 -13
- package/src/style/components/forms/label.js +39 -18
- package/src/style/components/forms/select.js +54 -22
- package/src/style/components/forms/validation.js +53 -6
- package/src/style/components/icons.js +4 -4
- package/src/style/components/loader.js +4 -5
- package/src/style/components/methods.js +18 -15
- package/src/style/components/overlay.js +5 -5
- package/src/style/helpers/index.js +46 -46
- package/src/style/index.js +2 -1
- package/src/style/payment-instruments/payment-card.js +4 -4
- package/src/style/utils/border.js +34 -0
- package/src/style/utils/color-values.js +27 -1
- package/src/style/utils/remove-empty-null.js +10 -0
- package/src/style/vendor/framepay.js +11 -8
- package/src/style/vendor/postmate.js +2 -2
- package/src/style/views/confirmation.js +13 -13
- package/src/style/views/method-selector.js +2 -2
- package/src/style/views/modal.js +6 -6
- package/src/style/views/result.js +4 -4
- package/src/style/views/summary.js +26 -22
- package/src/views/__snapshots__/summary.spec.js.snap +77 -119
- package/src/views/common/iframe/base-iframe.js +2 -0
- package/src/views/common/iframe/modal-iframe.js +45 -3
- package/src/views/confirmation.js +15 -5
- package/src/views/method-selector/generate-digital-wallet.js +10 -3
- package/src/views/method-selector/generate-digital-wallet.spec.js +10 -0
- package/src/views/method-selector/get-payment-methods.js +7 -2
- package/src/views/method-selector/get-payment-methods.spec.js +26 -23
- package/src/views/method-selector/index.js +21 -28
- package/src/views/method-selector/method-selector.spec.js +49 -64
- package/src/views/method-selector/mount-methods.js +5 -8
- package/src/views/modal.js +6 -2
- package/src/views/result.js +4 -3
- package/src/views/summary.js +161 -117
- package/src/views/summary.spec.js +60 -75
- package/tests/mocks/rebilly-instruments-mock.js +37 -7
- package/tests/mocks/storefront-api-mock.js +8 -0
- package/tests/mocks/storefront-mock.js +17 -0
- package/dist/functions/mount/fetch-summary-data.js +0 -46
- package/dist/functions/mount/fetch-summary-data.spec.js +0 -43
- package/src/functions/mount/fetch-summary-data.js +0 -29
- package/src/functions/mount/fetch-summary-data.spec.js +0 -40
package/src/style/base/index.js
CHANGED
|
@@ -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:
|
|
10
|
-
background:
|
|
11
|
-
font-size:
|
|
12
|
-
|
|
13
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
54
|
-
line-height:
|
|
55
|
-
|
|
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(
|
|
60
|
-
line-height:
|
|
61
|
-
margin: 0 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
|
`;
|
package/src/style/base/theme.js
CHANGED
|
@@ -1,61 +1,31 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
42
|
-
|
|
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
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
...
|
|
58
|
-
|
|
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
|
-
|
|
14
|
-
|
|
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.
|
|
21
|
-
expect(theme.
|
|
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 = (
|
|
4
|
+
export const address = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Address
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-address {
|
|
9
|
-
margin: 0 0
|
|
10
|
-
color:
|
|
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 = (
|
|
4
|
+
export const button = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Buttons
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-button {
|
|
9
|
-
font-size:
|
|
10
|
-
font-family:
|
|
11
|
-
line-height:
|
|
12
|
-
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:
|
|
15
|
-
color:
|
|
16
|
-
border-radius:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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:
|
|
34
|
-
|
|
35
|
-
color:
|
|
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:
|
|
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 {
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
.rebilly-instruments-button:focus {
|
|
48
|
+
box-shadow: 0 0 0 1px var(--rebilly-colorPrimary);
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
.rebilly-instruments-button:disabled
|
|
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 = (
|
|
4
|
+
export const divider = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Divider
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-divider {
|
|
9
|
-
line-height:
|
|
10
|
-
padding:
|
|
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:
|
|
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:
|
|
29
|
+
color: var(--rebilly-colorMutedText);
|
|
30
30
|
font-weight: 500;
|
|
31
31
|
text-transform: uppercase;
|
|
32
|
-
padding: 0
|
|
33
|
-
line-height:
|
|
34
|
-
background-color:
|
|
35
|
-
font-size:
|
|
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:
|
|
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:
|
|
33
|
+
position: relative;
|
|
32
34
|
top: 0;
|
|
33
35
|
left: 0;
|
|
34
36
|
height: 24px;
|
|
35
37
|
width: 24px;
|
|
36
|
-
border-radius:
|
|
37
|
-
box-shadow: inset 0 0 0 1px
|
|
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
|
|
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
|
|
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.
|
|
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 = (
|
|
4
|
+
export const field = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Field
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-form-field {
|
|
9
|
-
margin: calc(
|
|
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(
|
|
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:
|
|
22
|
-
margin-right:
|
|
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(
|
|
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 = (
|
|
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:
|
|
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 = (
|
|
4
|
+
export const input = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Input
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-form-field-input {
|
|
9
|
-
font-size:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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:
|
|
30
|
-
|
|
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
|
`;
|
|
@@ -1,34 +1,55 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
2
|
// This file contains all styles related to the label component.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
export const label = (
|
|
4
|
+
export const label = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Label
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-form-field-label {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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:
|
|
21
|
+
opacity: 1;
|
|
14
22
|
position: absolute;
|
|
15
|
-
transform: translateY(-50%);
|
|
16
|
-
transition:
|
|
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);
|
|
19
43
|
}
|
|
20
44
|
|
|
21
|
-
.rebilly-instruments-form-field-input:
|
|
22
|
-
.rebilly-instruments-form-field-select:focus + .rebilly-instruments-form-field-label,
|
|
23
|
-
.rebilly-instruments-form-field-label.is-active {
|
|
24
|
-
padding: 0
|
|
25
|
-
left: calc(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
color: ${theme.color.text};
|
|
29
|
-
background: ${theme.color.background};
|
|
30
|
-
font-weight: 500;
|
|
45
|
+
.is-floating .rebilly-instruments-form-field-input:focus + .rebilly-instruments-form-field-label,
|
|
46
|
+
.is-floating .rebilly-instruments-form-field-select:focus + .rebilly-instruments-form-field-label,
|
|
47
|
+
.is-floating .rebilly-instruments-form-field-label.is-active {
|
|
48
|
+
padding: 0 var(--rebilly-spacings-2xs);
|
|
49
|
+
left: calc(var(--rebilly-spacings-label-offset-left) - var(--rebilly-spacings-2xs));
|
|
50
|
+
line-height: 1;
|
|
51
|
+
background: var(--rebilly-colorBackground);
|
|
31
52
|
opacity: 1;
|
|
32
|
-
|
|
53
|
+
transform: translateY(-175%) scale(0.875);
|
|
33
54
|
}
|
|
34
55
|
`;
|