@open-tender/store 0.5.0 → 0.5.2

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.
@@ -0,0 +1,304 @@
1
+ import { Dimensions, HEX, Rems, TCButtonSizes, TCFontSizes, TCLayout, ThemeCloud } from '../types';
2
+ export declare const remsToPixels: (rems: string, ratio: number) => string;
3
+ export declare const remsToNumber: (rems: Rems) => number;
4
+ export declare const decorateTheme: (theme: ThemeCloud, dimensions: Dimensions, responsive?: boolean) => {
5
+ border: {
6
+ radius: string;
7
+ radiusSmall: string;
8
+ width: string;
9
+ widthApp: string;
10
+ color: HEX;
11
+ };
12
+ buttons: {
13
+ sizes: TCButtonSizes;
14
+ colors: import("../types").TCButtonColors;
15
+ };
16
+ cards: {
17
+ default: {
18
+ borderRadius: string;
19
+ borderWidth: string;
20
+ borderWidthApp: string;
21
+ bgColor: HEX;
22
+ borderColor: HEX;
23
+ boxShadow: string;
24
+ overrideFontColors: boolean;
25
+ textColor: HEX;
26
+ titleColor: HEX;
27
+ };
28
+ form: {
29
+ borderRadius: string;
30
+ borderWidth: string;
31
+ borderWidthApp: string;
32
+ bgColor: HEX;
33
+ borderColor: HEX;
34
+ boxShadow: string;
35
+ overrideFontColors: boolean;
36
+ textColor: HEX;
37
+ titleColor: HEX;
38
+ };
39
+ menuItem: {
40
+ borderRadius: string;
41
+ borderWidth: string;
42
+ borderWidthApp: string;
43
+ bgColor: HEX;
44
+ borderColor: HEX;
45
+ boxShadow: string;
46
+ overrideFontColors: boolean;
47
+ textColor: HEX;
48
+ titleColor: HEX;
49
+ };
50
+ modifier: {
51
+ borderRadius: string;
52
+ borderWidth: string;
53
+ borderWidthApp: string;
54
+ bgColor: HEX;
55
+ borderColor: HEX;
56
+ boxShadow: string;
57
+ overrideFontColors: boolean;
58
+ textColor: HEX;
59
+ titleColor: HEX;
60
+ };
61
+ };
62
+ counts: {
63
+ alerts: {
64
+ borderWidth: string;
65
+ borderWidthApp: string;
66
+ fontSize: string;
67
+ fontSizeMobile: string;
68
+ paddingBottom: string;
69
+ paddingTop: string;
70
+ bgColor?: HEX | undefined;
71
+ borderColor?: HEX | undefined;
72
+ color?: HEX | undefined;
73
+ family: string;
74
+ fontMobile: string;
75
+ fontSmoothing: string;
76
+ weight: string;
77
+ };
78
+ quantity: {
79
+ fontSize: string;
80
+ fontSizeMobile: string;
81
+ paddingBottom: string;
82
+ paddingTop: string;
83
+ bgColor?: HEX | undefined;
84
+ borderColor?: HEX | undefined;
85
+ borderWidth?: string | undefined;
86
+ borderWidthApp?: string | undefined;
87
+ color?: HEX | undefined;
88
+ family: string;
89
+ fontMobile: string;
90
+ fontSmoothing: string;
91
+ weight: string;
92
+ };
93
+ };
94
+ fonts: {
95
+ headline: {
96
+ letterSpacing: string;
97
+ lineHeights: {};
98
+ color?: HEX | undefined;
99
+ family: string;
100
+ fontMobile: string;
101
+ fontSize?: string | undefined;
102
+ fontSmoothing: string;
103
+ lineHeight: number;
104
+ textTransform: string;
105
+ url?: string | undefined;
106
+ weight: string;
107
+ } | {
108
+ fontSize: string;
109
+ lineHeight: string;
110
+ letterSpacing: string;
111
+ lineHeights: {};
112
+ color?: HEX | undefined;
113
+ family: string;
114
+ fontMobile: string;
115
+ fontSmoothing: string;
116
+ textTransform: string;
117
+ url?: string | undefined;
118
+ weight: string;
119
+ };
120
+ headings: {
121
+ letterSpacing: string;
122
+ lineHeights: {};
123
+ color?: HEX | undefined;
124
+ family: string;
125
+ fontMobile: string;
126
+ fontSize?: string | undefined;
127
+ fontSmoothing: string;
128
+ lineHeight: number;
129
+ textTransform: string;
130
+ url?: string | undefined;
131
+ weight: string;
132
+ } | {
133
+ fontSize: string;
134
+ lineHeight: string;
135
+ letterSpacing: string;
136
+ lineHeights: {};
137
+ color?: HEX | undefined;
138
+ family: string;
139
+ fontMobile: string;
140
+ fontSmoothing: string;
141
+ textTransform: string;
142
+ url?: string | undefined;
143
+ weight: string;
144
+ };
145
+ body: {
146
+ letterSpacing: string;
147
+ lineHeights: {};
148
+ color?: HEX | undefined;
149
+ family: string;
150
+ fontMobile: string;
151
+ fontSize?: string | undefined;
152
+ fontSmoothing: string;
153
+ lineHeight: number;
154
+ textTransform: string;
155
+ url?: string | undefined;
156
+ weight: string;
157
+ } | {
158
+ fontSize: string;
159
+ lineHeight: string;
160
+ letterSpacing: string;
161
+ lineHeights: {};
162
+ color?: HEX | undefined;
163
+ family: string;
164
+ fontMobile: string;
165
+ fontSmoothing: string;
166
+ textTransform: string;
167
+ url?: string | undefined;
168
+ weight: string;
169
+ };
170
+ preface: {
171
+ letterSpacing: string;
172
+ lineHeights: {};
173
+ color?: HEX | undefined;
174
+ family: string;
175
+ fontMobile: string;
176
+ fontSize?: string | undefined;
177
+ fontSmoothing: string;
178
+ lineHeight: number;
179
+ textTransform: string;
180
+ url?: string | undefined;
181
+ weight: string;
182
+ } | {
183
+ fontSize: string;
184
+ lineHeight: string;
185
+ letterSpacing: string;
186
+ lineHeights: {};
187
+ color?: HEX | undefined;
188
+ family: string;
189
+ fontMobile: string;
190
+ fontSmoothing: string;
191
+ textTransform: string;
192
+ url?: string | undefined;
193
+ weight: string;
194
+ };
195
+ sizes: TCFontSizes;
196
+ lineHeights: {};
197
+ };
198
+ inputs: {
199
+ borderWidth: string;
200
+ borderWidthApp: string;
201
+ fontSize: string;
202
+ fontSizeMobile: string;
203
+ iconLeft: string;
204
+ iconPadding: string;
205
+ label: {
206
+ fontSize: string;
207
+ fontSizeMobile: string;
208
+ left: string;
209
+ offset: string;
210
+ padding: string;
211
+ top: string;
212
+ };
213
+ letterSpacing: string;
214
+ lineHeight: string;
215
+ lineHeightMobile: string;
216
+ padding: string;
217
+ paddingBottom: string;
218
+ paddingBottomActive: string;
219
+ paddingHorizontal: string;
220
+ paddingTop: string;
221
+ paddingTopActive: string;
222
+ paddingVertical: string;
223
+ radius: string;
224
+ selectPaddingBottom: string;
225
+ selectSize: string;
226
+ selectSizeMobile: string;
227
+ bgColor: HEX;
228
+ bgColorFocus: HEX;
229
+ borderColor: HEX;
230
+ borderColorFocus: HEX;
231
+ borderStyle: string;
232
+ bottomBorderOnly: boolean;
233
+ boxShadow: string;
234
+ color: HEX;
235
+ colorFocus: HEX;
236
+ family: string;
237
+ fontMobile: string;
238
+ fontSmoothing: string;
239
+ placeholderColor: HEX;
240
+ showIcon: boolean;
241
+ showLabel: boolean;
242
+ showOutline: boolean;
243
+ textTransform: string;
244
+ weight: string;
245
+ };
246
+ item: {
247
+ desktop: {
248
+ imageMaxHeight: string;
249
+ imageMinHeight: string;
250
+ imagePadding: string;
251
+ maxWidth: string;
252
+ padding: string;
253
+ imageHeight: string;
254
+ };
255
+ mobile: {
256
+ imageMaxHeight: string;
257
+ imageMinHeight: string;
258
+ imagePadding: string;
259
+ maxWidth: string;
260
+ padding: string;
261
+ imageHeight: string;
262
+ };
263
+ };
264
+ lineHeight: string;
265
+ layout: TCLayout;
266
+ welcome: {
267
+ desktop: {
268
+ textAlign: import("../types").TCTextAlign;
269
+ marginTop: string;
270
+ marginBottom: string;
271
+ titleMarginLeft: string;
272
+ titleSize: string;
273
+ titleLineHeight: string;
274
+ subtitleSize: string;
275
+ subtitleLineHeight: string;
276
+ subtitleMarginTop: string;
277
+ };
278
+ mobile: {
279
+ textAlign: import("../types").TCTextAlign;
280
+ marginTop: string;
281
+ marginBottom: string;
282
+ titleMarginLeft: string;
283
+ titleSize: string;
284
+ titleLineHeight: string;
285
+ subtitleSize: string;
286
+ subtitleLineHeight: string;
287
+ subtitleMarginTop: string;
288
+ };
289
+ };
290
+ alert: import("../types").TCMessageColor;
291
+ bgColors: import("../types").TCBgColors;
292
+ boldWeight: string;
293
+ boxShadow: import("../types").TCBoxShadow;
294
+ breakpoints: import("../types").TCBreakpoints;
295
+ colors: import("../types").TCColors;
296
+ error: import("../types").TCMessageColor;
297
+ header: import("../types").TCHeader;
298
+ icons: import("../types").TCIcons;
299
+ links: import("../types").TCLinks;
300
+ overlay: import("../types").TCOverlay;
301
+ success: import("../types").TCMessageColor;
302
+ toast: import("../types").TCMessageColor;
303
+ };
304
+ export declare function hexToRgbA(hex: HEX, opacity: string): string | null;
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hexToRgbA = exports.decorateTheme = exports.remsToNumber = exports.remsToPixels = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var remsToPixels = function (rems, ratio) {
6
+ var pixels = parseFloat(rems.replace('rem', '')) * 10;
7
+ var adjustedPixels = pixels * ratio;
8
+ var noZeroes = parseFloat(adjustedPixels.toFixed(2)).toString();
9
+ return noZeroes === '0' ? '0' : "".concat(noZeroes, "px");
10
+ };
11
+ exports.remsToPixels = remsToPixels;
12
+ var remsToNumber = function (rems) {
13
+ return parseInt((parseFloat(rems.replace('rem', '')) * 10).toString(), 10);
14
+ };
15
+ exports.remsToNumber = remsToNumber;
16
+ var makeLineHeight = function (lineHeight, fontSize, ratio) {
17
+ var size = parseInt(fontSize.replace('px', ''));
18
+ return "".concat((ratio * parseFloat(lineHeight.toString()) * size).toFixed(3), "px");
19
+ };
20
+ var makeLineHeights = function (sizes, lineHeight, ratio) {
21
+ return Object.entries(sizes).reduce(function (obj, _a) {
22
+ var _b;
23
+ var size = _a[0], fontSize = _a[1];
24
+ return tslib_1.__assign(tslib_1.__assign({}, obj), (_b = {}, _b[size] = makeLineHeight(lineHeight, fontSize, ratio), _b));
25
+ }, {});
26
+ };
27
+ var fontSizesToPixels = function (object, ratio) {
28
+ return Object.entries(object).reduce(function (obj, _a) {
29
+ var _b;
30
+ var key = _a[0], value = _a[1];
31
+ return tslib_1.__assign(tslib_1.__assign({}, obj), (_b = {}, _b[key] = (0, exports.remsToPixels)(value, ratio), _b));
32
+ }, {});
33
+ };
34
+ var layoutToPixels = function (object, ratio) {
35
+ return Object.entries(object).reduce(function (obj, _a) {
36
+ var _b;
37
+ var key = _a[0], value = _a[1];
38
+ return tslib_1.__assign(tslib_1.__assign({}, obj), (_b = {}, _b[key] = (0, exports.remsToPixels)(value, ratio), _b));
39
+ }, {});
40
+ };
41
+ var paddingToPixels = function (padding, ratio) {
42
+ var _a = padding.split(' '), top = _a[0], horizontal = _a[1], bottom = _a[2];
43
+ var topPx = (0, exports.remsToPixels)(top, ratio);
44
+ var horizontalPx = (0, exports.remsToPixels)(horizontal, ratio);
45
+ var bottomPx = (0, exports.remsToPixels)(bottom, ratio);
46
+ return "".concat(topPx, " ").concat(horizontalPx, " ").concat(bottomPx);
47
+ };
48
+ var buttonToPixels = function (button, ratio) {
49
+ return tslib_1.__assign(tslib_1.__assign({}, button), { borderRadius: (0, exports.remsToPixels)(button.borderRadius, ratio), borderWidth: (0, exports.remsToPixels)(button.borderWidth, ratio), borderWidthApp: button.borderWidthApp
50
+ ? (0, exports.remsToPixels)(button.borderWidthApp, ratio)
51
+ : (0, exports.remsToPixels)(button.borderWidth, ratio), fontSize: button.fontSize ? (0, exports.remsToPixels)(button.fontSize, ratio) : null, letterSpacing: button.letterSpacing
52
+ ? (0, exports.remsToPixels)(button.letterSpacing, ratio)
53
+ : null, padding: button.padding ? paddingToPixels(button.padding, ratio) : null });
54
+ };
55
+ var buttonLargeToPixels = function (button, ratio) {
56
+ var largeButton = buttonToPixels(button, ratio);
57
+ return tslib_1.__assign(tslib_1.__assign({}, largeButton), { subtitleFontSizeMobile: button.subtitleFontSizeMobile
58
+ ? (0, exports.remsToPixels)(button.subtitleFontSizeMobile, ratio)
59
+ : null, subtitleMarginTopMobile: button.subtitleMarginTopMobile
60
+ ? (0, exports.remsToPixels)(button.subtitleMarginTopMobile, ratio)
61
+ : null, titleFontSizeMobile: button.titleFontSizeMobile
62
+ ? (0, exports.remsToPixels)(button.titleFontSizeMobile, ratio)
63
+ : null, titleMarginLeftMobile: button.titleMarginLeftMobile
64
+ ? (0, exports.remsToPixels)(button.titleMarginLeftMobile, ratio)
65
+ : null });
66
+ };
67
+ var makeButtons = function (buttons, ratio) {
68
+ var sizes = Object.entries(buttons.sizes).reduce(function (obj, _a) {
69
+ var _b;
70
+ var key = _a[0], value = _a[1];
71
+ return tslib_1.__assign(tslib_1.__assign({}, obj), (_b = {}, _b[key] = key === 'large'
72
+ ? buttonLargeToPixels(value, ratio)
73
+ : buttonToPixels(value, ratio), _b));
74
+ }, {});
75
+ return tslib_1.__assign(tslib_1.__assign({}, buttons), { sizes: sizes });
76
+ };
77
+ var makeFont = function (font, sizes, ratio) {
78
+ var fontStyle = tslib_1.__assign(tslib_1.__assign({}, font), { letterSpacing: (0, exports.remsToPixels)(font.letterSpacing, ratio), lineHeights: makeLineHeights(sizes, font.lineHeight, ratio) });
79
+ if (!font.fontSize) {
80
+ return fontStyle;
81
+ }
82
+ var fontSize = (0, exports.remsToPixels)(font.fontSize, ratio);
83
+ var lineHeight = makeLineHeight(font.lineHeight, fontSize, ratio);
84
+ return tslib_1.__assign(tslib_1.__assign({}, fontStyle), { fontSize: fontSize, lineHeight: lineHeight });
85
+ };
86
+ var makeFonts = function (fonts, lineHeight, ratio) {
87
+ var sizes = fontSizesToPixels(fonts.sizes, ratio);
88
+ var lineHeights = makeLineHeights(sizes, lineHeight, ratio);
89
+ var headline = makeFont(fonts.headline, sizes, ratio);
90
+ var headings = makeFont(fonts.headings, sizes, ratio);
91
+ var body = makeFont(fonts.body, sizes, ratio);
92
+ var preface = makeFont(fonts.preface, sizes, ratio);
93
+ return tslib_1.__assign(tslib_1.__assign({}, fonts), { headline: headline, headings: headings, body: body, preface: preface, sizes: sizes, lineHeights: lineHeights });
94
+ };
95
+ var makeBorder = function (border, ratio) {
96
+ return tslib_1.__assign(tslib_1.__assign({}, border), { radius: (0, exports.remsToPixels)(border.radius, ratio), radiusSmall: (0, exports.remsToPixels)(border.radiusSmall, ratio), width: (0, exports.remsToPixels)(border.width, ratio), widthApp: (0, exports.remsToPixels)(border.widthApp, ratio) });
97
+ };
98
+ var makeLabel = function (label, ratio) {
99
+ var _a = label.padding.split(' '), vertical = _a[0], horizontal = _a[1];
100
+ return {
101
+ fontSize: (0, exports.remsToPixels)(label.fontSize, ratio),
102
+ fontSizeMobile: (0, exports.remsToPixels)(label.fontSizeMobile, ratio),
103
+ left: (0, exports.remsToPixels)(label.left, ratio),
104
+ offset: (0, exports.remsToPixels)(label.offset, ratio),
105
+ padding: "".concat((0, exports.remsToPixels)(vertical, ratio), " ").concat((0, exports.remsToPixels)(horizontal, ratio)),
106
+ top: (0, exports.remsToPixels)(label.top, ratio)
107
+ };
108
+ };
109
+ var makeInputs = function (inputs, ratio) {
110
+ var _a = inputs.padding.split(' '), vertical = _a[0], horizontal = _a[1];
111
+ return tslib_1.__assign(tslib_1.__assign({}, inputs), { borderWidth: (0, exports.remsToPixels)(inputs.borderWidth, ratio), borderWidthApp: (0, exports.remsToPixels)(inputs.borderWidthApp, ratio), fontSize: (0, exports.remsToPixels)(inputs.fontSize, ratio), fontSizeMobile: (0, exports.remsToPixels)(inputs.fontSizeMobile, ratio), iconLeft: (0, exports.remsToPixels)(inputs.iconLeft, ratio), iconPadding: (0, exports.remsToPixels)(inputs.iconPadding, ratio), label: makeLabel(inputs.label, ratio), letterSpacing: (0, exports.remsToPixels)(inputs.letterSpacing, ratio), lineHeight: makeLineHeight(inputs.lineHeight, inputs.fontSize, ratio), lineHeightMobile: makeLineHeight(inputs.lineHeight, inputs.fontSizeMobile, ratio), padding: "".concat((0, exports.remsToPixels)(vertical, ratio), " ").concat((0, exports.remsToPixels)(horizontal, ratio)), paddingBottom: (0, exports.remsToPixels)(inputs.paddingBottom, ratio), paddingBottomActive: (0, exports.remsToPixels)(inputs.paddingBottomActive, ratio), paddingHorizontal: (0, exports.remsToPixels)(inputs.paddingHorizontal, ratio), paddingTop: (0, exports.remsToPixels)(inputs.paddingTop, ratio), paddingTopActive: (0, exports.remsToPixels)(inputs.paddingTopActive, ratio), paddingVertical: (0, exports.remsToPixels)(inputs.paddingVertical, ratio), radius: (0, exports.remsToPixels)(inputs.radius, ratio), selectPaddingBottom: (0, exports.remsToPixels)(inputs.selectPaddingBottom, ratio), selectSize: (0, exports.remsToPixels)(inputs.selectSize, ratio), selectSizeMobile: (0, exports.remsToPixels)(inputs.selectSizeMobile, ratio) });
112
+ };
113
+ var makeCounts = function (counts, ratio) {
114
+ var alerts = counts.alerts, quantity = counts.quantity;
115
+ return {
116
+ alerts: tslib_1.__assign(tslib_1.__assign({}, alerts), { borderWidth: (0, exports.remsToPixels)(alerts.borderWidth, ratio), borderWidthApp: (0, exports.remsToPixels)(alerts.borderWidthApp, ratio), fontSize: (0, exports.remsToPixels)(alerts.fontSize, ratio), fontSizeMobile: (0, exports.remsToPixels)(alerts.fontSizeMobile, ratio), paddingBottom: (0, exports.remsToPixels)(alerts.paddingBottom, ratio), paddingTop: (0, exports.remsToPixels)(alerts.paddingTop, ratio) }),
117
+ quantity: tslib_1.__assign(tslib_1.__assign({}, quantity), { fontSize: (0, exports.remsToPixels)(quantity.fontSize, ratio), fontSizeMobile: (0, exports.remsToPixels)(quantity.fontSizeMobile, ratio), paddingBottom: (0, exports.remsToPixels)(quantity.paddingBottom, ratio), paddingTop: (0, exports.remsToPixels)(quantity.paddingTop, ratio) })
118
+ };
119
+ };
120
+ var makeCards = function (cards, ratio) {
121
+ var box = cards.default, form = cards.form, menuItem = cards.menuItem, modifier = cards.modifier;
122
+ return {
123
+ default: tslib_1.__assign(tslib_1.__assign({}, box), { borderRadius: (0, exports.remsToPixels)(box.borderRadius, ratio), borderWidth: (0, exports.remsToPixels)(box.borderWidth, ratio), borderWidthApp: (0, exports.remsToPixels)(box.borderWidthApp, ratio) }),
124
+ form: tslib_1.__assign(tslib_1.__assign({}, form), { borderRadius: (0, exports.remsToPixels)(form.borderRadius, ratio), borderWidth: (0, exports.remsToPixels)(form.borderWidth, ratio), borderWidthApp: (0, exports.remsToPixels)(form.borderWidthApp, ratio) }),
125
+ menuItem: tslib_1.__assign(tslib_1.__assign({}, menuItem), { borderRadius: (0, exports.remsToPixels)(menuItem.borderRadius, ratio), borderWidth: (0, exports.remsToPixels)(menuItem.borderWidth, ratio), borderWidthApp: (0, exports.remsToPixels)(menuItem.borderWidthApp, ratio) }),
126
+ modifier: tslib_1.__assign(tslib_1.__assign({}, modifier), { borderRadius: (0, exports.remsToPixels)(modifier.borderRadius, ratio), borderWidth: (0, exports.remsToPixels)(modifier.borderWidth, ratio), borderWidthApp: (0, exports.remsToPixels)(modifier.borderWidthApp, ratio) })
127
+ };
128
+ };
129
+ var makeItem = function (item, ratio) {
130
+ return tslib_1.__assign(tslib_1.__assign({}, item), { imageMaxHeight: (0, exports.remsToPixels)(item.imageMaxHeight, ratio), imageMinHeight: (0, exports.remsToPixels)(item.imageMinHeight, ratio), imagePadding: (0, exports.remsToPixels)(item.imagePadding, ratio), maxWidth: (0, exports.remsToPixels)(item.maxWidth, ratio), padding: (0, exports.remsToPixels)(item.padding, ratio) });
131
+ };
132
+ var makeItems = function (item, ratio) {
133
+ var desktop = item.desktop, mobile = item.mobile;
134
+ return {
135
+ desktop: makeItem(desktop, ratio),
136
+ mobile: makeItem(mobile, ratio)
137
+ };
138
+ };
139
+ var makeWelcome = function (welcome, ratio) {
140
+ var titleSize = (0, exports.remsToPixels)(welcome.titleSize, ratio);
141
+ var subtitleSize = (0, exports.remsToPixels)(welcome.subtitleSize, ratio);
142
+ return {
143
+ textAlign: welcome.textAlign,
144
+ marginTop: (0, exports.remsToPixels)(welcome.marginTop, ratio),
145
+ marginBottom: (0, exports.remsToPixels)(welcome.marginBottom, ratio),
146
+ titleMarginLeft: (0, exports.remsToPixels)(welcome.titleMarginLeft, ratio),
147
+ titleSize: titleSize,
148
+ titleLineHeight: makeLineHeight(welcome.titleLineHeight, titleSize, ratio),
149
+ subtitleSize: subtitleSize,
150
+ subtitleLineHeight: makeLineHeight(welcome.subtitleLineHeight, subtitleSize, ratio),
151
+ subtitleMarginTop: (0, exports.remsToPixels)(welcome.subtitleMarginTop, ratio)
152
+ };
153
+ };
154
+ var makeWelcomes = function (welcomes, ratio) {
155
+ var desktop = welcomes.desktop, mobile = welcomes.mobile;
156
+ return {
157
+ desktop: makeWelcome(desktop, ratio),
158
+ mobile: makeWelcome(mobile, ratio)
159
+ };
160
+ };
161
+ var DEFAULT_WIDTH = 390;
162
+ var DEFAULT_HEIGHT = 844;
163
+ var makeRatio = function (width, height) {
164
+ return (width * height) / (DEFAULT_WIDTH * DEFAULT_HEIGHT);
165
+ };
166
+ var decorateTheme = function (theme, dimensions, responsive) {
167
+ if (responsive === void 0) { responsive = true; }
168
+ var width = dimensions.width, height = dimensions.height;
169
+ var ratio = responsive ? makeRatio(width, height) : 1.0;
170
+ var border = makeBorder(theme.border, ratio);
171
+ var buttons = makeButtons(theme.buttons, ratio);
172
+ var cards = makeCards(theme.cards, ratio);
173
+ var counts = makeCounts(theme.counts, ratio);
174
+ var fonts = makeFonts(theme.fonts, theme.lineHeight, ratio);
175
+ var inputs = makeInputs(theme.inputs, ratio);
176
+ var item = makeItems(theme.item, ratio);
177
+ var layout = layoutToPixels(theme.layout, ratio);
178
+ var lineHeight = makeLineHeight(theme.lineHeight, fonts.sizes.main, ratio);
179
+ var welcome = makeWelcomes(theme.welcome, ratio);
180
+ return tslib_1.__assign(tslib_1.__assign({}, theme), { border: border, buttons: buttons, cards: cards, counts: counts, fonts: fonts, inputs: inputs, item: item, lineHeight: lineHeight, layout: layout, welcome: welcome });
181
+ };
182
+ exports.decorateTheme = decorateTheme;
183
+ function hexToRgbA(hex, opacity) {
184
+ var c;
185
+ if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
186
+ c = hex.substring(1).split('');
187
+ if (c.length === 3) {
188
+ c = [c[0], c[0], c[1], c[1], c[2], c[2]];
189
+ }
190
+ c = '0x' + c.join('');
191
+ return ('rgba(' +
192
+ [(c >> 16) & 255, (c >> 8) & 255, c & 255].join(',') +
193
+ ",".concat(opacity, ")"));
194
+ }
195
+ return null;
196
+ }
197
+ exports.hexToRgbA = hexToRgbA;
@@ -1,4 +1,4 @@
1
- import { KioskBrand, KioskContent, KioskTheme, RequestError, RequestStatus, Store } from '../types';
1
+ import { KioskBrand, KioskContent, ThemeCloud, RequestError, RequestStatus, Store } from '../types';
2
2
  import { AppState } from '../app';
3
3
  export interface KioskApp {
4
4
  apiUrl: string;
@@ -11,7 +11,7 @@ export interface KioskState {
11
11
  revenueCenterId: number | null;
12
12
  brand: KioskBrand | null;
13
13
  content: KioskContent | null;
14
- theme: KioskTheme | null;
14
+ theme: ThemeCloud | null;
15
15
  loading: RequestStatus;
16
16
  error: RequestError | null;
17
17
  retries: number;
@@ -24,3 +24,4 @@ export * from './settings';
24
24
  export * from './store';
25
25
  export * from './surcharges';
26
26
  export * from './taxes';
27
+ export * from './themeCloud';
@@ -24,3 +24,4 @@ export * from './settings';
24
24
  export * from './store';
25
25
  export * from './surcharges';
26
26
  export * from './taxes';
27
+ export * from './themeCloud';
@@ -1,8 +1,12 @@
1
+ import { ThemeCloud } from './themeCloud';
2
+ export interface Dimensions {
3
+ width: number;
4
+ height: number;
5
+ }
1
6
  export declare type KioskBrand = Record<string, unknown>;
2
7
  export declare type KioskContent = Record<string, unknown>;
3
- export declare type KioskTheme = Record<string, unknown>;
4
8
  export interface KioskConfig {
5
9
  brand: KioskBrand;
6
10
  content: KioskContent;
7
- theme: KioskTheme;
11
+ theme: ThemeCloud;
8
12
  }