@sellout/ui 0.0.397 → 0.0.399
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/build/Colors.d.ts +37 -37
- package/build/components/AddressSearchDropdown.d.ts +31 -31
- package/build/components/Button.d.ts +51 -51
- package/build/components/CodeInput.d.ts +22 -22
- package/build/components/Counter.d.ts +9 -9
- package/build/components/Dropdown.d.ts +40 -40
- package/build/components/Flex.d.ts +14 -14
- package/build/components/FormattedInput.d.ts +34 -34
- package/build/components/FormattedfullInput.d.ts +32 -32
- package/build/components/Icon.d.ts +219 -219
- package/build/components/Icons.d.ts +190 -190
- package/build/components/Input.d.ts +65 -77
- package/build/components/InputOld.d.ts +23 -23
- package/build/components/Label.d.ts +16 -16
- package/build/components/Loader.d.ts +14 -14
- package/build/components/MaxLength.d.ts +8 -8
- package/build/components/Motion.d.ts +30 -30
- package/build/components/PhoneNumberInput.d.ts +36 -36
- package/build/components/Product.d.ts +35 -35
- package/build/components/SearchDropdown.d.ts +41 -41
- package/build/components/SvgIcons.d.ts +15 -15
- package/build/components/SvgRendrer.d.ts +5 -5
- package/build/components/TextButton.d.ts +21 -21
- package/build/components/Tip.d.ts +7 -7
- package/build/components/UserImage.d.ts +13 -13
- package/build/components/UserInfo.d.ts +18 -24
- package/build/components/ValidationError.d.ts +7 -7
- package/build/index.d.ts +29 -29
- package/build/node_modules/tslib/tslib.es6.js +97 -0
- package/build/node_modules/tslib/tslib.es6.js.map +1 -0
- package/build/src/Colors.js +42 -0
- package/build/src/Colors.js.map +1 -0
- package/build/{components → src/components}/AddressSearchDropdown.js +101 -99
- package/build/src/components/AddressSearchDropdown.js.map +1 -0
- package/build/src/components/Button.js +264 -0
- package/build/src/components/Button.js.map +1 -0
- package/build/src/components/CodeInput.js +98 -0
- package/build/src/components/CodeInput.js.map +1 -0
- package/build/src/components/Counter.js +27 -0
- package/build/src/components/Counter.js.map +1 -0
- package/build/src/components/Dropdown.js +53 -0
- package/build/src/components/Dropdown.js.map +1 -0
- package/build/src/components/Flex.js +13 -0
- package/build/src/components/Flex.js.map +1 -0
- package/build/src/components/FormattedInput.js +81 -0
- package/build/src/components/FormattedInput.js.map +1 -0
- package/build/{components → src/components}/FormattedfullInput.js +66 -70
- package/build/src/components/FormattedfullInput.js.map +1 -0
- package/build/src/components/Icon.js +38 -0
- package/build/src/components/Icon.js.map +1 -0
- package/build/src/components/Icons.js +200 -0
- package/build/src/components/Icons.js.map +1 -0
- package/build/src/components/Input.js +182 -0
- package/build/src/components/Input.js.map +1 -0
- package/build/src/components/Label.js +23 -0
- package/build/src/components/Label.js.map +1 -0
- package/build/src/components/Loader.js +37 -0
- package/build/src/components/Loader.js.map +1 -0
- package/build/src/components/MaxLength.js +20 -0
- package/build/src/components/MaxLength.js.map +1 -0
- package/build/src/components/Motion.js +40 -0
- package/build/src/components/Motion.js.map +1 -0
- package/build/src/components/PhoneNumberInput.js +50 -0
- package/build/src/components/PhoneNumberInput.js.map +1 -0
- package/build/src/components/Product.js +125 -0
- package/build/src/components/Product.js.map +1 -0
- package/build/{components → src/components}/SearchDropdown.js +60 -59
- package/build/src/components/SearchDropdown.js.map +1 -0
- package/build/{components → src/components}/SvgIcons.js +35 -35
- package/build/src/components/SvgIcons.js.map +1 -0
- package/build/{components → src/components}/SvgRendrer.js +14 -14
- package/build/src/components/SvgRendrer.js.map +1 -0
- package/build/src/components/TextButton.js +48 -0
- package/build/src/components/TextButton.js.map +1 -0
- package/build/src/components/Tip.js +19 -0
- package/build/src/components/Tip.js.map +1 -0
- package/build/src/components/UserImage.js +37 -0
- package/build/src/components/UserImage.js.map +1 -0
- package/build/src/components/UserInfo.js +40 -0
- package/build/src/components/UserInfo.js.map +1 -0
- package/build/src/components/ValidationError.js +27 -0
- package/build/src/components/ValidationError.js.map +1 -0
- package/build/src/index.js +33 -0
- package/build/src/utils/ErrorUtil.js +19 -0
- package/build/src/utils/ErrorUtil.js.map +1 -0
- package/build/src/utils/MediaQuery.js +66 -0
- package/build/src/utils/MediaQuery.js.map +1 -0
- package/build/src/utils/Validation.js +50 -0
- package/build/src/utils/Validation.js.map +1 -0
- package/build/src/utils/makeEventHandler.js +12 -0
- package/build/src/utils/makeEventHandler.js.map +1 -0
- package/build/utils/ErrorUtil.d.ts +1 -1
- package/build/utils/MediaQuery.d.ts +18 -18
- package/build/utils/Validation.d.ts +6 -6
- package/build/utils/makeEventHandler.d.ts +1 -1
- package/package.json +8 -6
- package/build/Colors.js.map +0 -1
- package/build/_virtual/_tslib.js.map +0 -1
- package/build/components/AddressSearchDropdown.js.map +0 -1
- package/build/components/Button.js.map +0 -1
- package/build/components/CodeInput.js.map +0 -1
- package/build/components/Counter.js.map +0 -1
- package/build/components/Dropdown.js.map +0 -1
- package/build/components/Flex.js.map +0 -1
- package/build/components/FormattedInput.js.map +0 -1
- package/build/components/FormattedfullInput.js.map +0 -1
- package/build/components/Icon.js.map +0 -1
- package/build/components/Icons.js.map +0 -1
- package/build/components/Input.js.map +0 -1
- package/build/components/Label.js.map +0 -1
- package/build/components/Loader.js.map +0 -1
- package/build/components/MaxLength.js.map +0 -1
- package/build/components/Motion.js.map +0 -1
- package/build/components/PhoneNumberInput.js.map +0 -1
- package/build/components/Product.js.map +0 -1
- package/build/components/SearchDropdown.js.map +0 -1
- package/build/components/SvgIcons.js.map +0 -1
- package/build/components/SvgRendrer.js.map +0 -1
- package/build/components/TextButton.js.map +0 -1
- package/build/components/Tip.js.map +0 -1
- package/build/components/UserImage.js.map +0 -1
- package/build/components/UserInfo.js.map +0 -1
- package/build/components/ValidationError.js.map +0 -1
- package/build/utils/ErrorUtil.js.map +0 -1
- package/build/utils/MediaQuery.js.map +0 -1
- package/build/utils/Validation.js.map +0 -1
- package/build/utils/makeEventHandler.js.map +0 -1
- /package/build/{index.js.map → src/index.js.map} +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { __makeTemplateObject } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import * as Polished from 'polished';
|
|
5
|
+
import { Colors } from '../Colors.js';
|
|
6
|
+
import Icon from './Icon.js';
|
|
7
|
+
import Loader, { LoaderSizes } from './Loader.js';
|
|
8
|
+
import SvgRenderer from './SvgRendrer.js';
|
|
9
|
+
|
|
10
|
+
var ButtonTypes;
|
|
11
|
+
(function (ButtonTypes) {
|
|
12
|
+
ButtonTypes["Next"] = "Next";
|
|
13
|
+
ButtonTypes["Regular"] = "Regular";
|
|
14
|
+
ButtonTypes["Thin"] = "Thin";
|
|
15
|
+
ButtonTypes["Normal"] = "Normal";
|
|
16
|
+
ButtonTypes["CustomInputHeight"] = "CustomInputHeight";
|
|
17
|
+
})(ButtonTypes || (ButtonTypes = {}));
|
|
18
|
+
var ButtonStates;
|
|
19
|
+
(function (ButtonStates) {
|
|
20
|
+
ButtonStates["Active"] = "Active";
|
|
21
|
+
ButtonStates["Warning"] = "Warning";
|
|
22
|
+
ButtonStates["Disabled"] = "Disabled";
|
|
23
|
+
})(ButtonStates || (ButtonStates = {}));
|
|
24
|
+
var ButtonIconPosition;
|
|
25
|
+
(function (ButtonIconPosition) {
|
|
26
|
+
ButtonIconPosition["Left"] = "Left";
|
|
27
|
+
ButtonIconPosition["Right"] = "Right";
|
|
28
|
+
})(ButtonIconPosition || (ButtonIconPosition = {}));
|
|
29
|
+
var StyledButton = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: ", ";\n width: ", ";\n margin-bottom: ", ";\n display: flex;\n flex-direction: row;\n align-items: center;\n overflow: hidden;\n justify-content: ", ";\n white-space: nowrap;\n box-sizing: border-box;\n text-align: center;\n border-radius: 10px;\n transition: all 0.2s;\n margin: ", ";\n padding: ", ";\n background-color: ", ";\n border: ", ";\n\n &:hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ", ";\n }\n"], ["\n position: relative;\n height: ", ";\n width: ", ";\n margin-bottom: ", ";\n display: flex;\n flex-direction: row;\n align-items: center;\n overflow: hidden;\n justify-content: ", ";\n white-space: nowrap;\n box-sizing: border-box;\n text-align: center;\n border-radius: 10px;\n transition: all 0.2s;\n margin: ", ";\n padding: ", ";\n background-color: ", ";\n border: ", ";\n\n &:hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ", ";\n }\n"])), function (props) {
|
|
30
|
+
if (props.CustomInputHeight) {
|
|
31
|
+
return "55px";
|
|
32
|
+
}
|
|
33
|
+
if (props.type === ButtonTypes.Next) {
|
|
34
|
+
return "48px";
|
|
35
|
+
}
|
|
36
|
+
if (props.type === ButtonTypes.CustomInputHeight) {
|
|
37
|
+
return "55px";
|
|
38
|
+
}
|
|
39
|
+
if (props.type === ButtonTypes.Regular) {
|
|
40
|
+
return "40px";
|
|
41
|
+
}
|
|
42
|
+
if (props.type === ButtonTypes.Normal) {
|
|
43
|
+
return "50px";
|
|
44
|
+
}
|
|
45
|
+
if (props.type === ButtonTypes.Thin) {
|
|
46
|
+
if (props.state === ButtonStates.Warning) {
|
|
47
|
+
return "30px";
|
|
48
|
+
}
|
|
49
|
+
return "30px";
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}, function (props) {
|
|
53
|
+
if (props.type === ButtonTypes.Next) {
|
|
54
|
+
return "100%";
|
|
55
|
+
}
|
|
56
|
+
if (props.type === ButtonTypes.Regular) {
|
|
57
|
+
return "fit-content";
|
|
58
|
+
}
|
|
59
|
+
if (props.type === ButtonTypes.Thin) {
|
|
60
|
+
return "fit-content";
|
|
61
|
+
}
|
|
62
|
+
if (props.type === ButtonTypes.Normal) {
|
|
63
|
+
return "50px";
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}, function (props) {
|
|
67
|
+
return props.marginBottam ? "".concat(props.marginBottam, " !important") : "0px !important";
|
|
68
|
+
}, function (props) { return props.contentAlign || "center"; }, function (props) { return (Boolean(props.margin) ? props.margin : "0px"); }, function (props) {
|
|
69
|
+
if (props.type === ButtonTypes.Next && props.paddingAround) {
|
|
70
|
+
return props.paddingAround;
|
|
71
|
+
}
|
|
72
|
+
if (props.type === ButtonTypes.Next) {
|
|
73
|
+
return "0px";
|
|
74
|
+
}
|
|
75
|
+
if (props.type === ButtonTypes.Regular) {
|
|
76
|
+
return "0 25px";
|
|
77
|
+
}
|
|
78
|
+
if (props.type === ButtonTypes.Thin) {
|
|
79
|
+
return "0 15px";
|
|
80
|
+
}
|
|
81
|
+
if (props.type === ButtonTypes.Normal) {
|
|
82
|
+
return "0 25px";
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}, function (props) {
|
|
86
|
+
if (props.state === ButtonStates.Disabled && props.disabledbuttonTheme) {
|
|
87
|
+
return Colors.InteractiveBGSecondary;
|
|
88
|
+
}
|
|
89
|
+
if (props.state === ButtonStates.Disabled) {
|
|
90
|
+
return Colors.Grey6;
|
|
91
|
+
}
|
|
92
|
+
if (props.state === ButtonStates.Warning) {
|
|
93
|
+
return Colors.White;
|
|
94
|
+
}
|
|
95
|
+
return props.bgColor || Colors.Orange;
|
|
96
|
+
}, function (props) {
|
|
97
|
+
if (props.state === ButtonStates.Warning) {
|
|
98
|
+
return "1px solid ".concat(Colors.Grey5);
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}, function (props) {
|
|
102
|
+
if (props.state === ButtonStates.Disabled) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return props.onClick ? "pointer" : null;
|
|
106
|
+
}, function (props) {
|
|
107
|
+
if (props.state === ButtonStates.Disabled && props.disabledbuttonTheme) {
|
|
108
|
+
return Colors.Grey1;
|
|
109
|
+
}
|
|
110
|
+
if (props.state === ButtonStates.Disabled) {
|
|
111
|
+
return Colors.Grey6;
|
|
112
|
+
}
|
|
113
|
+
if (props.state === ButtonStates.Warning) {
|
|
114
|
+
return Colors.White;
|
|
115
|
+
}
|
|
116
|
+
return Polished.lighten(0.025, props.bgColor || Colors.Orange);
|
|
117
|
+
}, function (props) {
|
|
118
|
+
if (props.state === ButtonStates.Disabled) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return props.onClick ? "pointer" : null;
|
|
122
|
+
}, function (props) {
|
|
123
|
+
if (props.state === ButtonStates.Disabled) {
|
|
124
|
+
return Colors.Grey6;
|
|
125
|
+
}
|
|
126
|
+
if (props.state === ButtonStates.Warning) {
|
|
127
|
+
return Colors.White;
|
|
128
|
+
}
|
|
129
|
+
return Polished.darken(0.025, props.bgColor || Colors.Orange);
|
|
130
|
+
});
|
|
131
|
+
var Text = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n line-height:", ";\n font-family: ", ";\n letter-spacing: ", ";\n font-size: ", ";\n font-weight: ", ";\n text-transform: ", ";\n margin: ", ";\n color: ", ";\n top: ", ";\n white-space: ", ";\n"], ["\n position: relative;\n line-height:", ";\n font-family: ", ";\n letter-spacing: ", ";\n font-size: ", ";\n font-weight: ", ";\n text-transform: ", ";\n margin: ", ";\n color: ", ";\n top: ", ";\n white-space: ", ";\n"])), function (props) { return props.lineHeight; }, function (props) { return props.fontFamily; }, function (props) { return props.letterSpacing; }, function (props) {
|
|
132
|
+
if (props.type === ButtonTypes.Next && props.fontSize) {
|
|
133
|
+
return props.fontSize;
|
|
134
|
+
}
|
|
135
|
+
if (props.type === ButtonTypes.Regular && props.fontSize) {
|
|
136
|
+
return props.fontSize;
|
|
137
|
+
}
|
|
138
|
+
if (props.type === ButtonTypes.Next) {
|
|
139
|
+
return "1.4rem";
|
|
140
|
+
}
|
|
141
|
+
if (props.type === ButtonTypes.Regular) {
|
|
142
|
+
return "1.4rem";
|
|
143
|
+
}
|
|
144
|
+
if (props.type === ButtonTypes.Regular) {
|
|
145
|
+
return "1.2rem";
|
|
146
|
+
}
|
|
147
|
+
if (props.type === ButtonTypes.Thin) {
|
|
148
|
+
return "1.2rem";
|
|
149
|
+
}
|
|
150
|
+
if (props.type === ButtonTypes.Normal) {
|
|
151
|
+
return "2.5rem";
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}, function (props) {
|
|
155
|
+
if (props.type === ButtonTypes.Next && props.fontWeight) {
|
|
156
|
+
return props.fontWeight;
|
|
157
|
+
}
|
|
158
|
+
if (props.type === ButtonTypes.Regular && props.fontWeight) {
|
|
159
|
+
return props.fontWeight;
|
|
160
|
+
}
|
|
161
|
+
if (props.type === ButtonTypes.Next) {
|
|
162
|
+
return "600";
|
|
163
|
+
// return "700";
|
|
164
|
+
}
|
|
165
|
+
if (props.type === ButtonTypes.Regular) {
|
|
166
|
+
return "600";
|
|
167
|
+
// return "700";
|
|
168
|
+
}
|
|
169
|
+
if (props.type === ButtonTypes.Thin) {
|
|
170
|
+
return "600";
|
|
171
|
+
}
|
|
172
|
+
if (props.type === ButtonTypes.Normal) {
|
|
173
|
+
return "500";
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}, function (props) { return props.textTransform || "uppercase"; }, function (props) {
|
|
177
|
+
if (props.type === ButtonTypes.Next && props.marginOnButtonText) {
|
|
178
|
+
return "0 10px 0 0";
|
|
179
|
+
}
|
|
180
|
+
if (props.type === ButtonTypes.Next) {
|
|
181
|
+
return "0 10px";
|
|
182
|
+
}
|
|
183
|
+
if (props.type === ButtonTypes.Regular) {
|
|
184
|
+
if (props.iconPosition === ButtonIconPosition.Left) {
|
|
185
|
+
return "0 0 0 10px";
|
|
186
|
+
}
|
|
187
|
+
if (props.iconPosition === ButtonIconPosition.Right) {
|
|
188
|
+
return "0 10px 0 0";
|
|
189
|
+
}
|
|
190
|
+
return "0";
|
|
191
|
+
}
|
|
192
|
+
if (props.type === ButtonTypes.Normal) {
|
|
193
|
+
if (props.iconPosition === ButtonIconPosition.Left) {
|
|
194
|
+
return "0 0 0 10px";
|
|
195
|
+
}
|
|
196
|
+
if (props.iconPosition === ButtonIconPosition.Right) {
|
|
197
|
+
return "0 10px 0 0";
|
|
198
|
+
}
|
|
199
|
+
return "0";
|
|
200
|
+
}
|
|
201
|
+
if (props.type === ButtonTypes.Thin) {
|
|
202
|
+
if (props.iconPosition === ButtonIconPosition.Left) {
|
|
203
|
+
return "0 0 0 7px";
|
|
204
|
+
}
|
|
205
|
+
if (props.iconPosition === ButtonIconPosition.Right) {
|
|
206
|
+
return "0 7px 0 0";
|
|
207
|
+
}
|
|
208
|
+
return "0";
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}, function (props) {
|
|
212
|
+
if (props.state === ButtonStates.Disabled && props.disabledbuttonTheme) {
|
|
213
|
+
return Colors.Grey3;
|
|
214
|
+
}
|
|
215
|
+
if (props.state)
|
|
216
|
+
if (props.state === ButtonStates.Disabled) {
|
|
217
|
+
return Colors.Grey5;
|
|
218
|
+
}
|
|
219
|
+
if (props.state === ButtonStates.Warning) {
|
|
220
|
+
return Colors.Grey3;
|
|
221
|
+
}
|
|
222
|
+
return props.textColor || Colors.White;
|
|
223
|
+
}, function (props) {
|
|
224
|
+
if (props.type === ButtonTypes.Thin) {
|
|
225
|
+
if (props.icon) {
|
|
226
|
+
return "-1px";
|
|
227
|
+
}
|
|
228
|
+
return "0";
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
}, function (props) { return props.innerTextWhiteSpace; });
|
|
232
|
+
function Button(_a) {
|
|
233
|
+
var _b = _a.type, type = _b === void 0 ? ButtonTypes.Next : _b, _c = _a.state, state = _c === void 0 ? ButtonStates.Active : _c, bgColor = _a.bgColor, textColor = _a.textColor, text = _a.text, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, icon = _a.icon, iconPosition = _a.iconPosition, _e = _a.iconSize, iconSize = _e === void 0 ? 14 : _e,
|
|
234
|
+
// label,
|
|
235
|
+
// tip,
|
|
236
|
+
// subLabel,
|
|
237
|
+
margin = _a.margin, marginBottam = _a.marginBottam, _f = _a.loading, loading = _f === void 0 ? false : _f, paddingAround = _a.paddingAround, contentAlign = _a.contentAlign, textTransform = _a.textTransform, fontSize = _a.fontSize, fontWeight = _a.fontWeight, fontFamily = _a.fontFamily, letterSpacing = _a.letterSpacing, disabledbuttonTheme = _a.disabledbuttonTheme, CustomInputHeight = _a.CustomInputHeight, lineHeight = _a.lineHeight, svgIconName = _a.svgIconName, svgHeight = _a.svgHeight, svgWidth = _a.svgWidth, marginOnButtonText = _a.marginOnButtonText, innerTextWhiteSpace = _a.innerTextWhiteSpace;
|
|
238
|
+
var iconColor = state === ButtonStates.Disabled ? Colors.Grey3 : Colors.White;
|
|
239
|
+
if (icon && !iconPosition)
|
|
240
|
+
iconPosition = ButtonIconPosition.Left;
|
|
241
|
+
var iconEl = (React.createElement(Icon, { icon: icon, color: iconColor, size: iconSize, top: iconSize < 14 ? "-1px" : undefined }));
|
|
242
|
+
var click = loading || state === ButtonStates.Disabled ? null : function () { return onClick(); };
|
|
243
|
+
return (React.createElement(React.Fragment, null,
|
|
244
|
+
React.createElement(StyledButton, { type: type, state: state, onClick: click, margin: margin, bgColor: bgColor, marginBottam: marginBottam, paddingAround: paddingAround, contentAlign: contentAlign, disabledbuttonTheme: disabledbuttonTheme, CustomInputHeight: CustomInputHeight }, (function () {
|
|
245
|
+
return (React.createElement(Fragment, null, (function () {
|
|
246
|
+
if (loading) {
|
|
247
|
+
return (React.createElement(Fragment, null,
|
|
248
|
+
React.createElement(Loader, { size: LoaderSizes.VerySmall, color: iconColor })));
|
|
249
|
+
}
|
|
250
|
+
return (React.createElement(Fragment, null,
|
|
251
|
+
icon && iconPosition === ButtonIconPosition.Left && iconEl,
|
|
252
|
+
text && (React.createElement(Text, { type: type, state: state, icon: Boolean(icon), iconPosition: iconPosition, textColor: textColor, textTransform: textTransform, fontSize: fontSize, fontWeight: fontWeight, fontFamily: fontFamily, letterSpacing: letterSpacing, disabledbuttonTheme: disabledbuttonTheme, lineHeight: lineHeight, marginOnButtonText: marginOnButtonText, innerTextWhiteSpace: innerTextWhiteSpace }, text)),
|
|
253
|
+
icon &&
|
|
254
|
+
iconPosition === ButtonIconPosition.Right &&
|
|
255
|
+
iconEl,
|
|
256
|
+
svgIconName &&
|
|
257
|
+
React.createElement(SvgRenderer, { iconName: svgIconName, width: svgWidth, height: svgHeight, style: { margin: '2px 0px' } })));
|
|
258
|
+
})()));
|
|
259
|
+
})())));
|
|
260
|
+
}
|
|
261
|
+
var templateObject_1, templateObject_2;
|
|
262
|
+
|
|
263
|
+
export { ButtonIconPosition, ButtonStates, ButtonTypes, Button as default };
|
|
264
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;IAQY,YAMX;AAND,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,WAAA,CAAA,mBAAA,CAAA,GAAA,mBAAqC,CAAA;AACvC,CAAC,EANW,WAAW,KAAX,WAAW,GAMtB,EAAA,CAAA,CAAA,CAAA;IAEW,aAIX;AAJD,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,YAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,YAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAJW,YAAY,KAAZ,YAAY,GAIvB,EAAA,CAAA,CAAA,CAAA;IAEW,mBAGX;AAHD,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,kBAAA,CAAA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tC,mBAAmB,EAAE,mBAAmB,EAEvC,EAAA,IAAI,CACA,CACR;oBACA,IAAI;wBACH,YAAY,KAAK,kBAAkB,CAAC,KAAK;wBACzC,MAAM;oBACL,WAAW;wBACX,KAAC,CAAA,aAAA,CAAA,WAAW,EACX,EAAA,QAAQ,EAAE,WAAW,EACrB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,EAAA,CAC3B,CAEK,EACX;AACJ,aAAC,GAAG,CACK,EACX;AACJ,SAAC,GAAG,CACS,CACd,EACH;AACJ,CAAC;;;;;"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { __makeTemplateObject, __spreadArray } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Colors } from '../Colors.js';
|
|
5
|
+
|
|
6
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: ", ";\n padding-left: ", ";\n"], ["\n margin: ", ";\n padding-left: ", ";\n"])), function (props) { return props.margin; }, function (props) { return props.paddingLeft; });
|
|
7
|
+
var Input = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: ", ";\n height: ", ";\n width: ", ";\n background-color: ", ";\n transition: all 0.1s;\n margin-right:", "; \n outline: 0px;\n font-size: ", ";\n text-align: center;\n border-radius: ", ";\n -moz-appearance: textfield;\n padding: 0px;\n box-shadow: none;\n font-weight:", "; \n font-family:", ";\n color: ", ";\n -moz-appearance: textfield;\n\n &:focus {\n border: ", ";\n }\n &::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n"], ["\n border: ", ";\n height: ", ";\n width: ", ";\n background-color: ", ";\n transition: all 0.1s;\n margin-right:", "; \n outline: 0px;\n font-size: ", ";\n text-align: center;\n border-radius: ", ";\n -moz-appearance: textfield;\n padding: 0px;\n box-shadow: none;\n font-weight:", "; \n font-family:", ";\n color: ", ";\n -moz-appearance: textfield;\n\n &:focus {\n border: ", ";\n }\n &::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n"])), function (props) {
|
|
8
|
+
return props.height ? "".concat(props.border) : "2px solid ".concat(Colors.Grey5);
|
|
9
|
+
}, function (props) { return props.height || "70px"; }, function (props) { return props.width || "55px"; }, function (props) { return props.bgColor || "white"; }, function (props) { return props.marginRight || "10px"; }, function (props) { return props.fontSize || "24px"; }, function (props) { return props.borderRadius || "10px"; }, function (props) { return props.fontWeight; }, function (props) { return props.fontFamily; }, function (props) { return props.color; }, function (props) { return props.borderHover || "2px solid ".concat(Colors.Grey1); });
|
|
10
|
+
var CodeInput = function (_a) {
|
|
11
|
+
var onChange = _a.onChange, onComplete = _a.onComplete, _b = _a.length, length = _b === void 0 ? 4 : _b, _c = _a.resetCode, resetCode = _c === void 0 ? false : _c, color = _a.color, placeholder = _a.placeholder, height = _a.height, width = _a.width, border = _a.border, bgColor = _a.bgColor, borderRadius = _a.borderRadius, borderHover = _a.borderHover, fontSize = _a.fontSize, marginRight = _a.marginRight, fontWeight = _a.fontWeight, fontFamily = _a.fontFamily, paddingLeft = _a.paddingLeft;
|
|
12
|
+
var _d = useState(new Array(length).fill("")), value = _d[0], setValue = _d[1];
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
if (resetCode) {
|
|
15
|
+
setValue(new Array(length).fill(""));
|
|
16
|
+
}
|
|
17
|
+
}, [resetCode]);
|
|
18
|
+
var inputs = [];
|
|
19
|
+
var change = function (valueAt, index) {
|
|
20
|
+
var currentValue = __spreadArray([], value, true);
|
|
21
|
+
if (valueAt.length > 1) {
|
|
22
|
+
valueAt = valueAt.substring(1);
|
|
23
|
+
}
|
|
24
|
+
// Single Character Press
|
|
25
|
+
if (valueAt.length === 1) {
|
|
26
|
+
currentValue[index] = valueAt;
|
|
27
|
+
setValue(currentValue);
|
|
28
|
+
if (inputs[index + 1]) {
|
|
29
|
+
inputs[index + 1].focus();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (valueAt.length === length) {
|
|
33
|
+
//code pasted
|
|
34
|
+
setValue(valueAt.split(""));
|
|
35
|
+
onComplete(valueAt);
|
|
36
|
+
if (inputs[index + 1]) {
|
|
37
|
+
inputs[index + 1].focus();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (valueAt.length > 0 && valueAt.length < length) {
|
|
41
|
+
// More than 1 character, less than the total number required
|
|
42
|
+
change(valueAt.charAt(valueAt.length - 1), index);
|
|
43
|
+
}
|
|
44
|
+
if (index + 1 === length) {
|
|
45
|
+
onComplete(currentValue.join(""));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
onChange && onChange(value);
|
|
50
|
+
}, [value]);
|
|
51
|
+
var renderInput = function (index) {
|
|
52
|
+
var curValue = value[index];
|
|
53
|
+
return (React.createElement(Input, { key: index, autoFocus: index === 0, value: curValue, type: "number", pattern: "\\d*", ref: function (ref) { return (inputs[index] = ref); }, onChange: function (event) {
|
|
54
|
+
onChange();
|
|
55
|
+
change(event.target.value, index);
|
|
56
|
+
}, color: color, placeholder: placeholder, height: height, width: width, border: border, bgColor: bgColor, borderRadius: borderRadius, borderHover: borderHover, fontSize: fontSize, marginRight: marginRight, fontWeight: fontWeight, fontFamily: fontFamily, onKeyDown: function (event) {
|
|
57
|
+
if (event.keyCode === 8 || event.keyCode === 46) {
|
|
58
|
+
// handle backspace or delete
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
var currentValue = __spreadArray([], value, true);
|
|
61
|
+
currentValue[index] = "";
|
|
62
|
+
setValue(currentValue);
|
|
63
|
+
if (index !== 0) {
|
|
64
|
+
inputs[index - 1].focus();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (event.keyCode === 37) {
|
|
68
|
+
// navigate left with left arrow key
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
if (index !== 0) {
|
|
71
|
+
inputs[index - 1].focus();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (event.keyCode === 39) {
|
|
75
|
+
// navigate right with right arrow key
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
if (index !== value.length - 1) {
|
|
78
|
+
inputs[index + 1].focus();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (
|
|
82
|
+
// prohibit weird behavior when up, down, +, or - are pressed
|
|
83
|
+
event.keyCode === 38 ||
|
|
84
|
+
event.keyCode === 40 ||
|
|
85
|
+
event.keyCode === 107 ||
|
|
86
|
+
event.keyCode === 109) {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
}
|
|
89
|
+
} }));
|
|
90
|
+
};
|
|
91
|
+
return (React.createElement(Container, { paddingLeft: paddingLeft }, value.map(function (_, index) {
|
|
92
|
+
return renderInput(index);
|
|
93
|
+
})));
|
|
94
|
+
};
|
|
95
|
+
var templateObject_1, templateObject_2;
|
|
96
|
+
|
|
97
|
+
export { CodeInput as default };
|
|
98
|
+
//# sourceMappingURL=CodeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeInput.js","sources":["../../../src/components/CodeInput.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAQA,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAgB,gBAAA,KAAA,gBAAA,GAAA,oBAAA,CAAA,CAAA,cAAA,EAAA,qBAAA,EAAA,KAAA,CAAA,EAAA,CAAA,cAChC,EAAuB,qBACjB,EAA4B,KAC7C,CAFW,CAAA,CAAA,EAAA,UAAC,KAAK,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,CAAA,EAAA,EACjB,UAAC,KAAK,EAAA,EAAK,OAAA,KAAK,CAAC,WAAW,CAAjB,EAAiB,CAC7C,CAAC;AAeF,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA,gB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J,EAAE;;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __makeTemplateObject } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import * as Polished from 'polished';
|
|
5
|
+
import { Colors } from '../Colors.js';
|
|
6
|
+
import Button, { ButtonTypes } from './Button.js';
|
|
7
|
+
|
|
8
|
+
// Fixed issue SELLOUT-24
|
|
9
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: auto;\n min-height: 42px;\n gap:13px;\n /* background-color: red; */\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: auto;\n min-height: 42px;\n gap:13px;\n /* background-color: red; */\n"])));
|
|
10
|
+
var IconContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n flex: 1;\n /* background-color: blue; */\n height: 100%;\n\n &:hover {\n cursor: ", ";\n }\n\n .svg-inline--fa {\n color: ", " !important;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: ", ";\n flex: 1;\n /* background-color: blue; */\n height: 100%;\n\n &:hover {\n cursor: ", ";\n }\n\n .svg-inline--fa {\n color: ", " !important;\n }\n"])), function (props) { return props.justify; }, function (props) { return (props.active ? "pointer" : null); }, function (props) {
|
|
11
|
+
return props.active ? Polished.lighten(0.025, Colors.Orange) : null;
|
|
12
|
+
});
|
|
13
|
+
function Counter(_a) {
|
|
14
|
+
var value = _a.value, maxValue = _a.maxValue, _b = _a.minValue, minValue = _b === void 0 ? 0 : _b, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement;
|
|
15
|
+
var canDecrement = value > minValue;
|
|
16
|
+
var canIncrement = Boolean(!Boolean(maxValue) || (maxValue && value < maxValue));
|
|
17
|
+
return (React.createElement(Container, null,
|
|
18
|
+
React.createElement(Fragment, null,
|
|
19
|
+
React.createElement(IconContainer, { active: canDecrement, onClick: function () { return (canDecrement ? onDecrement() : null); }, justify: "flex-start" },
|
|
20
|
+
React.createElement(Button, { type: ButtonTypes.Normal, text: "-", bgColor: Colors.InteractiveBGSecondary }))),
|
|
21
|
+
React.createElement(IconContainer, { active: canIncrement, onClick: function () { return (canIncrement ? onIncrement() : null); }, justify: "flex-end" },
|
|
22
|
+
React.createElement(Button, { type: ButtonTypes.Normal, text: "+", bgColor: Colors.InteractiveBGPrimary }))));
|
|
23
|
+
}
|
|
24
|
+
var templateObject_1, templateObject_2;
|
|
25
|
+
|
|
26
|
+
export { Counter as default };
|
|
27
|
+
//# sourceMappingURL=Counter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Counter.js","sources":["../../../src/components/Counter.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAMA;AACA,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA,gBAAA,KAAA,gBAAA,GAAA,oBAAA,CAAA,CAAA,0LAAA,CAAA,EAAA,CAAA,0LAS3B,IAAA,CAAC;AAOF,IAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAoB,gBAAA,KAAA,gBAAA,GAAA,oBAAA,CAAA,CAAA,iEAAA,EAAA,8FAAA,EAAA,4CAAA,EAAA,qBAAA,CAAA,EAAA,CAAA,iEAG/B,EAAsB,8FAM7B,EAA0C,4CAI3C,EACqD,qBAEjE,KAboB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,OAAO,CAAA,EAAA,EAM7B,UAAA,KAAK,EAAI,EAAA,QAAC,KAAK,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,EAAhC,EAAiC,EAI3C,UAAA,KAAK,EAAA;AACZ,IAAA,OAAA,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;AAA5D,CAA4D,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;AACJ,CAAC;;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __makeTemplateObject } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Colors } from '../Colors.js';
|
|
5
|
+
import Icon, { Icons } from './Icon.js';
|
|
6
|
+
import Label from './Label.js';
|
|
7
|
+
import Flex from './Flex.js';
|
|
8
|
+
import * as Polished from 'polished';
|
|
9
|
+
|
|
10
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: ", ";\n width: ", ";\n"], ["\n position: relative;\n height: ", ";\n width: ", ";\n"])), function (props) {
|
|
11
|
+
return props.open ? (props.height ? props.height : "65px") : "65px";
|
|
12
|
+
}, function (props) { return props.width; });
|
|
13
|
+
var FieldContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n max-height: ", "; \n min-height: ", "; \n width: ", ";\n background-color: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: 8px;\n transition: all 0.2s;\n z-index: ", ";\n box-shadow: ", ";\n overflow: hidden;\n outline: none;\n\n &:hover {\n cursor: pointer;\n border: 1px solid ", ";\n }\n\n &:focus {\n border: 1px solid ", ";\n }\n"], ["\n position: absolute;\n max-height: ", "; \n min-height: ", "; \n width: ", ";\n background-color: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: 8px;\n transition: all 0.2s;\n z-index: ", ";\n box-shadow: ", ";\n overflow: hidden;\n outline: none;\n\n &:hover {\n cursor: pointer;\n border: 1px solid ", ";\n }\n\n &:focus {\n border: 1px solid ", ";\n }\n"])), function (props) { return (props.open ? props.height : "38px"); }, function (props) { return (props.containerMinHeight); }, function (props) { return props.width; }, function (props) { return props.bgColor || Colors.White; }, function (props) { return props.borderColor || Colors.Grey5; }, function (props) { return (props.open ? 100 : 0); }, function (props) {
|
|
14
|
+
return props.open ? "0px 4px 16px rgba(0, 0, 0, 0.05)" : "";
|
|
15
|
+
}, Polished.darken(0.05, Colors.Grey5), Colors.Grey4);
|
|
16
|
+
var TopRow = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n height: ", ";\n padding: 0 15px;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n height: ", ";\n padding: 0 15px;\n"])), function (props) { return (props.optionsHeight ? props.optionsHeight : "38px"); });
|
|
17
|
+
var Value = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 1.4rem;\n font-weight: 500;\n color: ", ";\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n margin-right: 10px;\n white-space:", ";\n"], ["\n font-size: 1.4rem;\n font-weight: 500;\n color: ", ";\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n margin-right: 10px;\n white-space:", ";\n"])), function (props) { return props.optionsColor || Colors.Grey1; }, function (props) { return (props.valueWhiteSpace ? props.valueWhiteSpace : "nowrap"); });
|
|
18
|
+
var ItemsContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n max-height: ", ";\n overflow: ", ";\n"], ["\n position: relative;\n max-height: ", ";\n overflow: ", ";\n"])), function (props) { return (props.open ? props.height : "0px"); }, function (props) { return (props.open ? "auto" : "hidden"); });
|
|
19
|
+
var Item = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n height: 30px;\n padding: 0 15px;\n background-color: ", ";\n font-size: 1.2rem;\n color: ", ";\n transition: all 0.2s;\n\n &:hover {\n cursor: pointer;\n background-color: ", ";\n }\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n height: 30px;\n padding: 0 15px;\n background-color: ", ";\n font-size: 1.2rem;\n color: ", ";\n transition: all 0.2s;\n\n &:hover {\n cursor: pointer;\n background-color: ", ";\n }\n"])), function (props) {
|
|
20
|
+
return props.bgColor
|
|
21
|
+
? Colors.SurfaceTertiary
|
|
22
|
+
: props.selected
|
|
23
|
+
? props.itemColor || Colors.Grey7
|
|
24
|
+
: Colors.White;
|
|
25
|
+
}, function (props) { return props.optionsColor || Colors.Grey1; }, function (props) { return props.hoverColor || Colors.Grey7; });
|
|
26
|
+
var DropdownTypes;
|
|
27
|
+
(function (DropdownTypes) {
|
|
28
|
+
DropdownTypes["Regular"] = "Regular";
|
|
29
|
+
DropdownTypes["Small"] = "Small";
|
|
30
|
+
})(DropdownTypes || (DropdownTypes = {}));
|
|
31
|
+
var Dropdown = function (_a) {
|
|
32
|
+
var
|
|
33
|
+
// type = DropdownTypes.Regular,
|
|
34
|
+
value = _a.value, onChange = _a.onChange, _b = _a.width, width = _b === void 0 ? "auto" : _b, items = _a.items, label = _a.label, tip = _a.tip, icon = _a.icon, _c = _a.height, height = _c === void 0 ? "65px" : _c, labelColor = _a.labelColor, bgColor = _a.bgColor, itemColor = _a.itemColor, optionsColor = _a.optionsColor, fontSize = _a.fontSize, fontFamily = _a.fontFamily, fontWeight = _a.fontWeight, iconColor = _a.iconColor, hoverColor = _a.hoverColor, letterSpacing = _a.letterSpacing, borderColor = _a.borderColor, containerMinHeight = _a.containerMinHeight, optionsHeight = _a.optionsHeight, itemContainerHeight = _a.itemContainerHeight, valueWhiteSpace = _a.valueWhiteSpace;
|
|
35
|
+
var _d = React.useState(false), open = _d[0], setOpen = _d[1];
|
|
36
|
+
return (React.createElement(Container, { width: width, open: true, height: height },
|
|
37
|
+
label && (React.createElement(Label, { text: label, tip: tip, labelColor: labelColor, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, letterSpacing: letterSpacing })),
|
|
38
|
+
React.createElement(FieldContainer, { itemColor: itemColor, bgColor: bgColor, tabIndex: 1, open: open, height: (items === null || items === void 0 ? void 0 : items.length) > 4 ? "130px" : "".concat((items === null || items === void 0 ? void 0 : items.length) * 30 + (itemContainerHeight ? parseInt(itemContainerHeight) : 43), "px"), width: width, onClick: function () { return setOpen(!open); }, onBlur: function () { return setOpen(false); }, borderColor: borderColor, containerMinHeight: containerMinHeight },
|
|
39
|
+
React.createElement(TopRow, { optionsHeight: optionsHeight },
|
|
40
|
+
React.createElement(Flex, { align: "center" },
|
|
41
|
+
icon && icon,
|
|
42
|
+
React.createElement(Value, { optionsColor: optionsColor, valueWhiteSpace: valueWhiteSpace }, value)),
|
|
43
|
+
React.createElement(Icon, { icon: Icons.Sort, size: 12, color: iconColor })),
|
|
44
|
+
React.createElement(ItemsContainer, { open: open, height: (items === null || items === void 0 ? void 0 : items.length) > 3 ? "90px" : "".concat((items === null || items === void 0 ? void 0 : items.length) * 30, "px"), className: "dropdown-list-menu dropdown-list-height" }, items === null || items === void 0 ? void 0 : items.map(function (item, index) {
|
|
45
|
+
return (React.createElement(Item, { bgColor: bgColor, optionsColor: optionsColor, itemColor: item.color, hoverColor: hoverColor, key: index, selected: false, onClick: function () { return onChange(item.value); } },
|
|
46
|
+
item.icon && item.icon,
|
|
47
|
+
item.text));
|
|
48
|
+
})))));
|
|
49
|
+
};
|
|
50
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
51
|
+
|
|
52
|
+
export { DropdownTypes, Dropdown as default };
|
|
53
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AA+BA,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA,gBAAA,KAAA,gBAAA,GAAA,oBAAA,CAAA,CAAA,qCAAA,EAAA,cAAA,EAAA,KAAA,CAAA,EAAA,CAAgB,qCAEhC,EACoD,cACrD,EAAsB,KAChC,CAAA,CAAA,CAAA,EAHW,UAAC,KAAK,EAAA;IACd,OAAA,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,M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BAAA,QACE,KAAC,CAAA,aAAA,CAAA,IAAI,IACH,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,IAAI,CAAC,KAAK,EACrB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,KAAK,EACf,OAAO,EAAE,YAAM,EAAA,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAA,EAAA;AAElC,oBAAA,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;AACtB,oBAAA,IAAI,CAAC,IAAI,CACL,EACP;AACJ,aAAC,CAAC,CACa,CACF,CACP,EACZ;AACJ,EAAE;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __makeTemplateObject } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: ", ";\n justify-content: ", ";\n align-items: ", ";\n padding: ", ";\n margin: ", ";\n flex: ", ";\n height: ", ";\n color: ", ";\n gap: ", ";\n"], ["\n display: flex;\n flex-direction: ", ";\n justify-content: ", ";\n align-items: ", ";\n padding: ", ";\n margin: ", ";\n flex: ", ";\n height: ", ";\n color: ", ";\n gap: ", ";\n"])), function (props) { return props.direction; }, function (props) { return props.justify; }, function (props) { return props.align; }, function (props) { return props.padding; }, function (props) { return props.margin; }, function (props) { return props.flex; }, function (props) { return props.height; }, function (props) { return props.color; }, function (props) { return props.gap; });
|
|
6
|
+
var Flex = function (_a) {
|
|
7
|
+
var children = _a.children, _b = _a.direction, direction = _b === void 0 ? 'row' : _b, _c = _a.justify, justify = _c === void 0 ? '' : _c, _d = _a.align, align = _d === void 0 ? '' : _d, _e = _a.padding, padding = _e === void 0 ? '' : _e, _f = _a.margin, margin = _f === void 0 ? '' : _f, _g = _a.flex, flex = _g === void 0 ? '' : _g, _h = _a.height, height = _h === void 0 ? '' : _h, _j = _a.color, color = _j === void 0 ? '' : _j, _k = _a.gap, gap = _k === void 0 ? '' : _k;
|
|
8
|
+
return (React.createElement(Container, { direction: direction, justify: justify, align: align, padding: padding, margin: margin, flex: flex, height: height, color: color, gap: gap }, children));
|
|
9
|
+
};
|
|
10
|
+
var templateObject_1;
|
|
11
|
+
|
|
12
|
+
export { Flex as default };
|
|
13
|
+
//# sourceMappingURL=Flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.js","sources":["../../../src/components/Flex.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;AAeA,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAW,gBAAA,KAAA,gBAAA,GAAA,oBAAA,CAAA,CAAA,wCAAA,EAAA,wBAAA,EAAA,oBAAA,EAAA,gBAAA,EAAA,eAAA,EAAA,aAAA,EAAA,eAAA,EAAA,cAAA,EAAA,YAAA,EAAA,KAAA,CAAA,EAAA,CAAA,wCAEnB,EAA0B,wBACzB,EAAwB,oBAC5B,EAAsB,gBAC1B,EAAwB,eACzB,EAAuB,aACzB,EAAqB,eACnB,EAAuB,cACxB,EAAsB,YACxB,EAAoB,KAC5B,CAAA,CAAA,CAAA,EATmB,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,SAAS,CAAf,EAAe,EACzB,UAAC,KAAK,EAAA,EAAK,OAAA,KAAK,CAAC,OAAO,GAAA,EAC5B,UAAC,KAAK,EAAK,EAAA,OAAA,KAAK,CAAC,KAAK,CAAA,EAAA,EAC1B,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,OAAO,CAAb,EAAa,EACzB,UAAC,KAAK,EAAA,EAAK,OAAA,KAAK,CAAC,MAAM,GAAA,EACzB,UAAC,KAAK,EAAK,EAAA,OAAA,KAAK,CAAC,IAAI,CAAA,EAAA,EACnB,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,MAAM,CAAZ,E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OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IAEP,QAAQ,CACC,EACZ;AACJ,EAAE;;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { __makeTemplateObject } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import * as Polished from 'polished';
|
|
5
|
+
import { Colors } from '../Colors.js';
|
|
6
|
+
import Icon, { Icons } from './Icon.js';
|
|
7
|
+
import Label from './Label.js';
|
|
8
|
+
import Flex from './Flex.js';
|
|
9
|
+
import MaxLength from './MaxLength.js';
|
|
10
|
+
import ValidationError from './ValidationError.js';
|
|
11
|
+
import { media } from '../utils/MediaQuery.js';
|
|
12
|
+
|
|
13
|
+
var InputFormats;
|
|
14
|
+
(function (InputFormats) {
|
|
15
|
+
InputFormats["Price"] = "Price";
|
|
16
|
+
InputFormats["Percent"] = "Percent";
|
|
17
|
+
})(InputFormats || (InputFormats = {}));
|
|
18
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n"], ["\n width: ", ";\n"])), function (props) { return props.width; });
|
|
19
|
+
var Form = styled.form(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ", ";\n overflow: hidden;\n"], ["\n margin: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ", ";\n overflow: hidden;\n"])), function (props) { return props.margin; }, function (props) { return props.width; }, function (props) {
|
|
20
|
+
if (props.focused)
|
|
21
|
+
return Colors.Grey4;
|
|
22
|
+
if (props.hovered)
|
|
23
|
+
return Polished.darken(0.05, Colors.Grey5);
|
|
24
|
+
return Colors.Grey5;
|
|
25
|
+
});
|
|
26
|
+
var PriceContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 25px;\n background-color: ", ";\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 25px;\n background-color: ", ";\n"])), Colors.Grey5);
|
|
27
|
+
var InputStyled = styled.input(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n height: 38px;\n width: ", ";\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n text-indent: 1px;\n transition: all 0.2s;\n padding: ", ";\n text-align: right;\n\n ", ";\n\n ", ";\n\n ::placeholder {\n color: ", ";\n }\n"], ["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n height: 38px;\n width: ", ";\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n text-indent: 1px;\n transition: all 0.2s;\n padding: ", ";\n text-align: right;\n\n ", ";\n\n ", ";\n\n ::placeholder {\n color: ", ";\n }\n"])), function (props) {
|
|
28
|
+
return props.disabled ? "".concat(Colors.Grey6, " !important") : null;
|
|
29
|
+
}, function (props) { return (props.disabled ? Colors.Grey4 : Colors.Grey1); }, function (props) { return props.inputWidth ? "90px" : "60px"; }, function (props) { return props.inputInnerPadding ? props.inputInnerPadding : "0 16px"; }, media.mobile(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 1.6rem;\n "], ["\n font-size: 1.6rem;\n "]))), media.desktop(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: 1.4rem;\n "], ["\n font-size: 1.4rem;\n "]))), Colors.Grey4);
|
|
30
|
+
var IconText = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 1.4rem;\n font-weight: 600;\n color: ", ";\n"], ["\n font-size: 1.4rem;\n font-weight: 600;\n color: ", ";\n"])), Colors.Grey3);
|
|
31
|
+
function Input(_a) {
|
|
32
|
+
var inputRef = _a.inputRef, autoFocus = _a.autoFocus, placeholder = _a.placeholder, value = _a.value, defaultValue = _a.defaultValue, _b = _a.format, format = _b === void 0 ? InputFormats.Price : _b, _c = _a.type, type = _c === void 0 ? "text" : _c, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, onSubmit = _a.onSubmit, _d = _a.canSubmit, canSubmit = _d === void 0 ? true : _d, loading = _a.loading, margin = _a.margin, width = _a.width, inputWidth = _a.inputWidth, onEnter = _a.onEnter, label = _a.label, subLabel = _a.subLabel, tip = _a.tip, maxLength = _a.maxLength, validationError = _a.validationError, _e = _a.disabled, disabled = _e === void 0 ? false : _e, inputInnerPadding = _a.inputInnerPadding;
|
|
33
|
+
var _f = useState(false), hovered = _f[0], setHovered = _f[1];
|
|
34
|
+
var _g = useState(false), focused = _g[0], setFocused = _g[1];
|
|
35
|
+
var submit = function (event) {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
if (onSubmit && canSubmit && !loading) {
|
|
38
|
+
onSubmit();
|
|
39
|
+
}
|
|
40
|
+
else if (onEnter && !loading) {
|
|
41
|
+
onEnter();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return (React.createElement(Container, { width: width },
|
|
45
|
+
React.createElement(Flex, { justify: "space-between" },
|
|
46
|
+
label && React.createElement(Label, { text: label, subText: subLabel, tip: tip }),
|
|
47
|
+
maxLength && React.createElement(MaxLength, { value: value, maxLength: maxLength })),
|
|
48
|
+
React.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); }, width: width, margin: margin, noValidate // disables default html5 validation
|
|
49
|
+
: true, disabled: disabled },
|
|
50
|
+
format === InputFormats.Price && (React.createElement(PriceContainer, null,
|
|
51
|
+
React.createElement(Icon, { icon: Icons.Dollar, size: 14, color: Colors.Grey3 }))),
|
|
52
|
+
React.createElement(InputStyled, { ref: inputRef, disabled: disabled, autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, inputWidth: inputWidth, inputInnerPadding: inputInnerPadding, onChange: function (e) {
|
|
53
|
+
if (maxLength && e.currentTarget.value.length > maxLength) ;
|
|
54
|
+
else {
|
|
55
|
+
onChange(e);
|
|
56
|
+
}
|
|
57
|
+
}, onFocus: function (event) {
|
|
58
|
+
setFocused(true);
|
|
59
|
+
if (onFocus)
|
|
60
|
+
onFocus(event);
|
|
61
|
+
}, onBlur: function (event) {
|
|
62
|
+
setFocused(false);
|
|
63
|
+
if (onFocus)
|
|
64
|
+
onBlur(event);
|
|
65
|
+
}, onMouseEnter: function (event) {
|
|
66
|
+
setHovered(true);
|
|
67
|
+
if (onMouseEnter)
|
|
68
|
+
onMouseEnter(event);
|
|
69
|
+
}, onMouseLeave: function (event) {
|
|
70
|
+
setHovered(false);
|
|
71
|
+
if (onMouseLeave)
|
|
72
|
+
onMouseLeave(event);
|
|
73
|
+
} }),
|
|
74
|
+
format === InputFormats.Percent && (React.createElement(PriceContainer, null,
|
|
75
|
+
React.createElement(IconText, null, "%")))),
|
|
76
|
+
validationError && (React.createElement(ValidationError, { validationError: validationError }))));
|
|
77
|
+
}
|
|
78
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
79
|
+
|
|
80
|
+
export { InputFormats, Input as default };
|
|
81
|
+
//# sourceMappingURL=FormattedInput.js.map
|