@sellout/ui 0.0.57 → 0.0.60
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.js +26 -0
- package/build/_virtual/_tslib.js +51 -0
- package/build/components/Button.d.ts +20 -6
- package/build/components/Button.js +210 -0
- package/build/components/CodeInput.d.ts +8 -0
- package/build/components/CodeInput.js +78 -0
- package/build/components/Counter.js +28 -0
- package/build/components/Dropdown.d.ts +24 -0
- package/build/components/Dropdown.js +49 -0
- package/build/components/Flex.d.ts +12 -0
- package/build/components/Flex.js +12 -0
- package/build/components/Icon.d.ts +49 -3
- package/build/components/Icon.js +39 -0
- package/build/components/Icons.d.ts +49 -3
- package/build/components/Icons.js +181 -0
- package/build/components/Input.d.ts +16 -1
- package/build/components/Input.js +177 -0
- package/build/components/InputOld.d.ts +23 -0
- package/build/components/InputOld.js +83 -0
- package/build/components/Label.d.ts +9 -0
- package/build/components/Label.js +22 -0
- package/build/components/Loader.js +37 -0
- package/build/components/MaxLength.d.ts +7 -0
- package/build/components/MaxLength.js +16 -0
- package/build/components/Motion.d.ts +30 -0
- package/build/components/Motion.js +39 -0
- package/build/components/PhoneNumberInput.d.ts +19 -0
- package/build/components/PhoneNumberInput.js +39 -0
- package/build/components/Product.js +54 -0
- package/build/components/TextButton.d.ts +15 -0
- package/build/components/TextButton.js +39 -0
- package/build/components/Tip.d.ts +7 -0
- package/build/components/Tip.js +18 -0
- package/build/components/UserImage.d.ts +13 -0
- package/build/components/UserImage.js +20 -0
- package/build/components/UserInfo.d.ts +12 -0
- package/build/components/UserInfo.js +38 -0
- package/build/components/ValidationError.d.ts +6 -0
- package/build/components/ValidationError.js +23 -0
- package/build/components/VerticalUserInfo.d.ts +12 -0
- package/build/index.d.ts +18 -126
- package/build/index.js +27 -453
- package/build/utils/ErrorUtil.d.ts +1 -0
- package/build/utils/ErrorUtil.js +18 -0
- package/build/utils/MediaQuery.d.ts +17 -0
- package/build/utils/MediaQuery.js +64 -0
- package/build/utils/Validation.d.ts +6 -0
- package/build/utils/Validation.js +53 -0
- package/build/utils/makeEventHandler.js +11 -0
- package/package.json +13 -5
- package/.storybook/config.js +0 -3
- package/.storybook/preview-head.html +0 -21
- package/.storybook/webpack.config.js +0 -19
- package/build/index.es.js +0 -443
- package/rollup.config.js +0 -20
- package/src/Colors.ts +0 -23
- package/src/assets/images/sellout-logo-long.svg +0 -11
- package/src/assets/images/sellout-logo-mono-white.svg +0 -4
- package/src/components/Button.tsx +0 -141
- package/src/components/Counter.tsx +0 -91
- package/src/components/Icon.tsx +0 -78
- package/src/components/Icons.ts +0 -251
- package/src/components/Input.tsx +0 -258
- package/src/components/Loader.tsx +0 -88
- package/src/components/Product.tsx +0 -156
- package/src/index.ts +0 -28
- package/src/stories/Button.stories.js +0 -30
- package/src/stories/Counter.stories.js +0 -28
- package/src/stories/Icon.stories.js +0 -25
- package/src/stories/Input.stories.js +0 -79
- package/src/stories/Loader.stories.js +0 -50
- package/src/stories/Product.stories.js +0 -67
- package/src/utils/makeEventHandler.ts +0 -8
- package/tsconfig.json +0 -24
- package/utils/generateIconLibrary.js +0 -49
- package/utils/icon-library.csv +0 -129
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React, { useState, Fragment } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { darken, lighten } from 'polished';
|
|
6
|
+
import Icon, { Icons } from './Icon.js';
|
|
7
|
+
import Loader, { LoaderSizes } from './Loader.js';
|
|
8
|
+
import Label from './Label.js';
|
|
9
|
+
import Flex from './Flex.js';
|
|
10
|
+
import MaxLength from './MaxLength.js';
|
|
11
|
+
import ValidationError from './ValidationError.js';
|
|
12
|
+
import { media } from '../utils/MediaQuery.js';
|
|
13
|
+
|
|
14
|
+
var InputSizes;
|
|
15
|
+
(function (InputSizes) {
|
|
16
|
+
InputSizes["Large"] = "Large";
|
|
17
|
+
InputSizes["Regular"] = "Regular";
|
|
18
|
+
})(InputSizes || (InputSizes = {}));
|
|
19
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n margin: ", ";\n"], ["\n width: ", ";\n margin: ", ";\n"])), function (props) { return props.width; }, function (props) { return props.margin; });
|
|
20
|
+
var Form = styled.form(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n display: flex;\n flex-direction: row;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ", ";\n overflow: hidden;\n background-color: ", ";\n\n > * {\n background-color: ", ";\n }\n"], ["\n width: ", ";\n display: flex;\n flex-direction: row;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ",
|
|
21
|
+
";\n overflow: hidden;\n background-color: ", ";\n\n > * {\n background-color: ", ";\n }\n"])), function (props) { return props.width; }, function (props) {
|
|
22
|
+
if (props.focused)
|
|
23
|
+
return Colors.Grey4;
|
|
24
|
+
if (props.hovered)
|
|
25
|
+
return darken(0.05, Colors.Grey5);
|
|
26
|
+
return Colors.Grey5;
|
|
27
|
+
}, function (props) { return props.disabled ? Colors.Grey6 + " !important" : null; }, function (props) { return props.disabled ? Colors.Grey6 + " !important" : null; });
|
|
28
|
+
var Button = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 0 10px 10px 0;\n top: -1px;\n right: -1px;\n transition: all 0.2s;\n background-color: ", ";\n\n &:hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ", ";\n }\n"], ["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n height: ",
|
|
29
|
+
";\n width: ",
|
|
30
|
+
";\n border-radius: 0 10px 10px 0;\n top: -1px;\n right: -1px;\n transition: all 0.2s;\n background-color: ",
|
|
31
|
+
";\n\n &:hover {\n cursor: ", ";\n background-color: ",
|
|
32
|
+
";\n }\n\n &:active {\n cursor: ", ";\n background-color: ",
|
|
33
|
+
";\n }\n"])), Colors.White, function (props) {
|
|
34
|
+
if (props.size === InputSizes.Large)
|
|
35
|
+
return "50px";
|
|
36
|
+
if (props.size === InputSizes.Regular)
|
|
37
|
+
return "40px";
|
|
38
|
+
return null;
|
|
39
|
+
}, function (props) {
|
|
40
|
+
if (props.size === InputSizes.Large)
|
|
41
|
+
return "50px";
|
|
42
|
+
if (props.size === InputSizes.Regular)
|
|
43
|
+
return "40px";
|
|
44
|
+
return null;
|
|
45
|
+
}, function (props) {
|
|
46
|
+
return props.canSubmit ? Colors.Orange : Colors.Grey6;
|
|
47
|
+
}, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
|
|
48
|
+
return props.canSubmit ? lighten(0.025, Colors.Orange) : null;
|
|
49
|
+
}, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
|
|
50
|
+
return props.canSubmit ? darken(0.025, Colors.Orange) : null;
|
|
51
|
+
});
|
|
52
|
+
var IconContainer = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n"])));
|
|
53
|
+
/* height: ${(props) => {
|
|
54
|
+
if (props.size === InputSizes.Large) return "50px";
|
|
55
|
+
if (props.size === InputSizes.Regular) return "40px";
|
|
56
|
+
}};
|
|
57
|
+
width: ${(props) => {
|
|
58
|
+
if (props.size === InputSizes.Large) return "50px";
|
|
59
|
+
if (props.size === InputSizes.Regular) return "40px";
|
|
60
|
+
}}; */
|
|
61
|
+
var LeftContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: 15px;\n top: 0px;\n left: 0px;\n background-color: ", ";\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: 15px;\n top: 0px;\n left: 0px;\n background-color: ", ";\n"])), Colors.White);
|
|
62
|
+
var RightContainer = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n height: ", ";\n width: ", ";\n top: -1px;\n right: -1px;\n background-color: ", ";\n\n &:hover {\n cursor: ", ";\n }\n"], ["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n height: ",
|
|
63
|
+
";\n width: ",
|
|
64
|
+
";\n top: -1px;\n right: -1px;\n background-color: ", ";\n\n &:hover {\n cursor: ", ";\n }\n"])), function (props) {
|
|
65
|
+
if (props.size === InputSizes.Large)
|
|
66
|
+
return "50px";
|
|
67
|
+
if (props.size === InputSizes.Regular)
|
|
68
|
+
return "40px";
|
|
69
|
+
return null;
|
|
70
|
+
}, function (props) {
|
|
71
|
+
if (props.size === InputSizes.Large)
|
|
72
|
+
return "50px";
|
|
73
|
+
if (props.size === InputSizes.Regular)
|
|
74
|
+
return "40px";
|
|
75
|
+
return null;
|
|
76
|
+
}, Colors.White, function (props) { return (props.onClick ? "pointer" : null); });
|
|
77
|
+
var Spacer = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: 50px;\n background-color: ", ";\n"], ["\n width: 50px;\n background-color: ", ";\n"])), Colors.White);
|
|
78
|
+
var InputStyled = styled.input(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n /* border-radius: 10px; */\n height: ", ";\n width: fill-available;\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n padding: 0 0 0 10px;\n text-indent: 1px;\n transition: all 0.2s;\n padding: ", ";\n\n ::placeholder {\n color: ", ";\n }\n\n ", ";\n\n ", ";\n"], ["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n /* border-radius: 10px; */\n height: ",
|
|
79
|
+
";\n width: fill-available;\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n padding: 0 0 0 10px;\n text-indent: 1px;\n transition: all 0.2s;\n padding: ", ";\n\n ::placeholder {\n color: ", ";\n }\n\n ",
|
|
80
|
+
";\n\n ",
|
|
81
|
+
";\n"])), Colors.White, function (props) { return props.disabled ? Colors.Grey4 : Colors.Grey1; }, function (props) {
|
|
82
|
+
if (props.inputSize === InputSizes.Large)
|
|
83
|
+
return "48px";
|
|
84
|
+
if (props.inputSize === InputSizes.Regular)
|
|
85
|
+
return "38px";
|
|
86
|
+
return null;
|
|
87
|
+
}, function (props) { return props.padding; }, Colors.Grey4, media.mobile(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-size: 1.6rem;\n"], ["\n font-size: 1.6rem;\n"]))), media.desktop(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font-size: 1.4rem;\n"], ["\n font-size: 1.4rem;\n"]))));
|
|
88
|
+
function Input(_a) {
|
|
89
|
+
var inputRef = _a.inputRef, autoFocus = _a.autoFocus, placeholder = _a.placeholder, value = _a.value, defaultValue = _a.defaultValue, icon = _a.icon, iconColor = _a.iconColor, _b = _a.size, size = _b === void 0 ? InputSizes.Regular : _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, onClear = _a.onClear, _d = _a.canSubmit, canSubmit = _d === void 0 ? true : _d, loading = _a.loading, margin = _a.margin, padding = _a.padding, width = _a.width, onEnter = _a.onEnter, label = _a.label, subLabel = _a.subLabel, tip = _a.tip, maxLength = _a.maxLength, iconConditionalColor = _a.iconConditionalColor, validationError = _a.validationError, _e = _a.disabled, disabled = _e === void 0 ? false : _e;
|
|
90
|
+
var _f = useState(false), hovered = _f[0], setHovered = _f[1];
|
|
91
|
+
var _g = useState(false), focused = _g[0], setFocused = _g[1];
|
|
92
|
+
var submit = function (event) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
if (onSubmit && canSubmit && !loading) {
|
|
95
|
+
onSubmit();
|
|
96
|
+
}
|
|
97
|
+
else if (onEnter && !loading) {
|
|
98
|
+
onEnter();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var iconSize = (function () {
|
|
102
|
+
if (size === InputSizes.Large)
|
|
103
|
+
return 16;
|
|
104
|
+
if (size === InputSizes.Regular)
|
|
105
|
+
return 14;
|
|
106
|
+
return 14;
|
|
107
|
+
})();
|
|
108
|
+
return (React.createElement(Container, { width: width, margin: margin },
|
|
109
|
+
React.createElement(Flex, { justify: "space-between" },
|
|
110
|
+
label && React.createElement(Label, { text: label, subText: subLabel, tip: tip }),
|
|
111
|
+
maxLength && React.createElement(MaxLength, { value: value, maxLength: maxLength })),
|
|
112
|
+
React.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); }, width: width, disabled: disabled, noValidate // disables default html5 validation
|
|
113
|
+
: true },
|
|
114
|
+
icon && (React.createElement(LeftContainer, { size: size },
|
|
115
|
+
React.createElement(IconContainer, null,
|
|
116
|
+
React.createElement(Icon, { icon: icon, size: iconSize, color: (function () {
|
|
117
|
+
if (iconColor)
|
|
118
|
+
return iconColor;
|
|
119
|
+
return value
|
|
120
|
+
? iconConditionalColor || Colors.Grey1
|
|
121
|
+
: focused
|
|
122
|
+
? Colors.Grey3
|
|
123
|
+
: Colors.Grey4;
|
|
124
|
+
})() })))),
|
|
125
|
+
React.createElement(InputStyled, { ref: inputRef, disabled: disabled, autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: function (e) {
|
|
126
|
+
if (maxLength && e.currentTarget.value.length > maxLength) ;
|
|
127
|
+
else {
|
|
128
|
+
onChange(e);
|
|
129
|
+
}
|
|
130
|
+
}, onFocus: function (event) {
|
|
131
|
+
setFocused(true);
|
|
132
|
+
if (onFocus)
|
|
133
|
+
onFocus(event);
|
|
134
|
+
}, onBlur: function (event) {
|
|
135
|
+
setFocused(false);
|
|
136
|
+
if (onFocus)
|
|
137
|
+
onBlur(event);
|
|
138
|
+
}, onMouseEnter: function (event) {
|
|
139
|
+
setHovered(true);
|
|
140
|
+
if (onMouseEnter)
|
|
141
|
+
onMouseEnter(event);
|
|
142
|
+
}, onMouseLeave: function (event) {
|
|
143
|
+
setHovered(false);
|
|
144
|
+
if (onMouseLeave)
|
|
145
|
+
onMouseLeave(event);
|
|
146
|
+
}, padding: padding, inputSize: size }),
|
|
147
|
+
(function () {
|
|
148
|
+
if (onSubmit) {
|
|
149
|
+
return (React.createElement(Fragment, null,
|
|
150
|
+
React.createElement(Spacer, null),
|
|
151
|
+
React.createElement(Button, { canSubmit: canSubmit, onClick: function (event) { return submit(event); }, size: size }, (function () {
|
|
152
|
+
if (loading) {
|
|
153
|
+
return React.createElement(Loader, { size: LoaderSizes.VerySmall });
|
|
154
|
+
}
|
|
155
|
+
return (React.createElement(Icon, { icon: Icons.RightChevronCircle, color: canSubmit ? Colors.White : Colors.Grey4, size: iconSize }));
|
|
156
|
+
})())));
|
|
157
|
+
}
|
|
158
|
+
if (loading) {
|
|
159
|
+
return (React.createElement(Fragment, null,
|
|
160
|
+
React.createElement(Spacer, null),
|
|
161
|
+
React.createElement(RightContainer, { size: size },
|
|
162
|
+
React.createElement(Loader, { size: LoaderSizes.SuperSmall, color: Colors.Orange }))));
|
|
163
|
+
}
|
|
164
|
+
if (Boolean(value) && onClear) {
|
|
165
|
+
return (React.createElement(Fragment, null,
|
|
166
|
+
React.createElement(Spacer, null),
|
|
167
|
+
React.createElement(RightContainer, { onClick: function () { return onClear(); }, size: size },
|
|
168
|
+
React.createElement(Icon, { icon: Icons.CancelCircle, color: Colors.Grey4, hoverColor: Colors.Grey3, size: iconSize }))));
|
|
169
|
+
}
|
|
170
|
+
return React.createElement(Spacer, null);
|
|
171
|
+
})()),
|
|
172
|
+
validationError && React.createElement(ValidationError, { validationError: validationError })));
|
|
173
|
+
}
|
|
174
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
175
|
+
|
|
176
|
+
export default Input;
|
|
177
|
+
export { InputSizes };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type InputProps = {
|
|
3
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
4
|
+
autoFocus?: boolean | undefined;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
value: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
icon?: any;
|
|
9
|
+
type?: string;
|
|
10
|
+
onMouseEnter?: any;
|
|
11
|
+
onMouseLeave?: any;
|
|
12
|
+
onChange?: any;
|
|
13
|
+
onFocus?: any;
|
|
14
|
+
onBlur?: any;
|
|
15
|
+
onSubmit?: Function;
|
|
16
|
+
onClear?: Function;
|
|
17
|
+
canSubmit?: boolean;
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
margin?: string;
|
|
20
|
+
padding?: string;
|
|
21
|
+
width?: string;
|
|
22
|
+
};
|
|
23
|
+
export default function Input({ inputRef, autoFocus, placeholder, value, defaultValue, icon, type, onMouseEnter, onMouseLeave, onChange, onFocus, onBlur, onSubmit, onClear, canSubmit, loading, margin, padding, width, }: InputProps): JSX.Element;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React, { useState, Fragment } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { lighten, darken } from 'polished';
|
|
6
|
+
import Icon, { Icons } from './Icon.js';
|
|
7
|
+
import Loader, { LoaderSizes } from './Loader.js';
|
|
8
|
+
|
|
9
|
+
var Form = styled.form(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n display: flex;\n flex-direction: row;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ", ";\n"], ["\n width: ", ";\n display: flex;\n flex-direction: row;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ",
|
|
10
|
+
";\n"])), function (props) { return props.width; }, function (props) {
|
|
11
|
+
if (props.focused)
|
|
12
|
+
return Colors.Grey3;
|
|
13
|
+
if (props.hovered)
|
|
14
|
+
return Colors.Grey4;
|
|
15
|
+
return Colors.Grey5;
|
|
16
|
+
});
|
|
17
|
+
var Button = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n height: 50px;\n width: 50px;\n border-radius: 0 10px 10px 0;\n top: -1px;\n right: -1px;\n transition: all 0.2s;\n background-color: ", ";\n\n &:hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ", ";\n }\n"], ["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n height: 50px;\n width: 50px;\n border-radius: 0 10px 10px 0;\n top: -1px;\n right: -1px;\n transition: all 0.2s;\n background-color: ",
|
|
18
|
+
";\n\n &:hover {\n cursor: ", ";\n background-color: ",
|
|
19
|
+
";\n }\n\n &:active {\n cursor: ", ";\n background-color: ",
|
|
20
|
+
";\n }\n"])), Colors.White, function (props) {
|
|
21
|
+
return props.canSubmit ? Colors.Orange : Colors.Grey6;
|
|
22
|
+
}, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
|
|
23
|
+
return props.canSubmit ? lighten(0.025, Colors.Orange) : null;
|
|
24
|
+
}, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
|
|
25
|
+
return props.canSubmit ? darken(0.025, Colors.Orange) : null;
|
|
26
|
+
});
|
|
27
|
+
var LeftContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: 15px;\n top: 0px;\n left: 0px;\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: 15px;\n top: 0px;\n left: 0px;\n"])));
|
|
28
|
+
var RightContainer = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 50px;\n width: 50px;\n top: -1px;\n right: -1px;\n\n &:hover {\n cursor: ", ";\n }\n"], ["\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 50px;\n width: 50px;\n top: -1px;\n right: -1px;\n\n &:hover {\n cursor: ", ";\n }\n"])), function (props) { return (props.onClick ? "pointer" : null); });
|
|
29
|
+
var Spacer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 50px;\n"], ["\n width: 50px;\n"])));
|
|
30
|
+
var InputStyled = styled.input(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n border-radius: 10px;\n height: 48px;\n width: fill-available;\n font-size: 1.4rem;\n font-weight: 500;\n padding: 0 0 0 10px;\n transition: all 0.2s;\n margin: ", ";\n padding: ", ";\n \n ::placeholder {\n color: ", ";\n }\n"], ["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n border-radius: 10px;\n height: 48px;\n width: fill-available;\n font-size: 1.4rem;\n font-weight: 500;\n padding: 0 0 0 10px;\n transition: all 0.2s;\n margin: ", ";\n padding: ", ";\n \n ::placeholder {\n color: ", ";\n }\n"])), Colors.White, Colors.Grey1, function (props) { return props.margin; }, function (props) { return props.padding; }, Colors.Grey4);
|
|
31
|
+
function Input(_a) {
|
|
32
|
+
var inputRef = _a.inputRef, autoFocus = _a.autoFocus, placeholder = _a.placeholder, value = _a.value, defaultValue = _a.defaultValue, icon = _a.icon, _b = _a.type, type = _b === void 0 ? 'text' : _b, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, onSubmit = _a.onSubmit, onClear = _a.onClear, _c = _a.canSubmit, canSubmit = _c === void 0 ? true : _c, loading = _a.loading, margin = _a.margin, padding = _a.padding, width = _a.width;
|
|
33
|
+
var _d = useState(false), hovered = _d[0], setHovered = _d[1];
|
|
34
|
+
var _e = useState(false), focused = _e[0], setFocused = _e[1];
|
|
35
|
+
var submit = function (event) {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
if (onSubmit && canSubmit && !loading) {
|
|
38
|
+
onSubmit();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (React.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); }, width: width },
|
|
42
|
+
icon && (React.createElement(LeftContainer, null,
|
|
43
|
+
React.createElement(Icon, { icon: icon, size: 16, color: focused ? Colors.Grey1 : Colors.Grey4 }))),
|
|
44
|
+
React.createElement(InputStyled, { ref: inputRef, autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: onChange, onFocus: function (event) {
|
|
45
|
+
setFocused(true);
|
|
46
|
+
if (onFocus)
|
|
47
|
+
onFocus(event);
|
|
48
|
+
}, onBlur: function (event) {
|
|
49
|
+
setFocused(false);
|
|
50
|
+
if (onFocus)
|
|
51
|
+
onBlur(event);
|
|
52
|
+
}, onMouseEnter: function (event) {
|
|
53
|
+
setHovered(true);
|
|
54
|
+
if (onMouseEnter)
|
|
55
|
+
onMouseEnter(event);
|
|
56
|
+
}, onMouseLeave: function (event) {
|
|
57
|
+
setHovered(false);
|
|
58
|
+
if (onMouseLeave)
|
|
59
|
+
onMouseLeave(event);
|
|
60
|
+
}, margin: margin, padding: padding }),
|
|
61
|
+
(function () {
|
|
62
|
+
if (onSubmit) {
|
|
63
|
+
return (React.createElement(Fragment, null,
|
|
64
|
+
React.createElement(Spacer, null),
|
|
65
|
+
React.createElement(Button, { canSubmit: canSubmit, onClick: function (event) { return submit(event); } }, (function () {
|
|
66
|
+
if (loading) {
|
|
67
|
+
return React.createElement(Loader, { size: LoaderSizes.VerySmall });
|
|
68
|
+
}
|
|
69
|
+
return (React.createElement(Icon, { icon: Icons.RightChevronCircle, color: canSubmit ? Colors.White : Colors.Grey4, size: 16 }));
|
|
70
|
+
})())));
|
|
71
|
+
}
|
|
72
|
+
if (Boolean(value) && onClear) {
|
|
73
|
+
return (React.createElement(Fragment, null,
|
|
74
|
+
React.createElement(Spacer, null),
|
|
75
|
+
React.createElement(RightContainer, { onClick: function () { return onClear(); } },
|
|
76
|
+
React.createElement(Icon, { icon: Icons.CancelCircle, color: Colors.Grey3, size: 16 }))));
|
|
77
|
+
}
|
|
78
|
+
return React.createElement(Spacer, null);
|
|
79
|
+
})()));
|
|
80
|
+
}
|
|
81
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
82
|
+
|
|
83
|
+
export default Input;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import Tip from './Tip.js';
|
|
6
|
+
|
|
7
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n margin: ", ";\n height: 15px;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n margin: ", ";\n height: 15px;\n"])), function (props) { return props.margin; });
|
|
8
|
+
var Text = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: 1.2rem;\n font-weight: 600;\n color: ", ";\n margin-right: 7px;\n"], ["\n font-size: 1.2rem;\n font-weight: 600;\n color: ", ";\n margin-right: 7px;\n"])), Colors.Grey1);
|
|
9
|
+
var SubText = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), Colors.Grey3);
|
|
10
|
+
var Label = function (_a) {
|
|
11
|
+
var text = _a.text, subText = _a.subText, tip = _a.tip, _b = _a.margin, margin = _b === void 0 ? '0 0 10px' : _b;
|
|
12
|
+
return (React.createElement(Container, { margin: margin },
|
|
13
|
+
React.createElement(Text, null,
|
|
14
|
+
text,
|
|
15
|
+
subText && React.createElement(SubText, null,
|
|
16
|
+
"\u00A0",
|
|
17
|
+
subText)),
|
|
18
|
+
tip && (React.createElement(Tip, { tip: tip }))));
|
|
19
|
+
};
|
|
20
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
21
|
+
|
|
22
|
+
export default Label;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
var _a;
|
|
7
|
+
var LoaderSizes;
|
|
8
|
+
(function (LoaderSizes) {
|
|
9
|
+
LoaderSizes["FuckingTiny"] = "FuckingTiny";
|
|
10
|
+
LoaderSizes["SuperSmall"] = "SuperSmall";
|
|
11
|
+
LoaderSizes["VerySmall"] = "VerySmall";
|
|
12
|
+
LoaderSizes["Small"] = "Small";
|
|
13
|
+
LoaderSizes["Medium"] = "Medium";
|
|
14
|
+
LoaderSizes["Large"] = "Large";
|
|
15
|
+
})(LoaderSizes || (LoaderSizes = {}));
|
|
16
|
+
var LoaderSizesMap = (_a = {},
|
|
17
|
+
_a[LoaderSizes.FuckingTiny] = 14,
|
|
18
|
+
_a[LoaderSizes.SuperSmall] = 20,
|
|
19
|
+
_a[LoaderSizes.VerySmall] = 24,
|
|
20
|
+
_a[LoaderSizes.Small] = 30,
|
|
21
|
+
_a[LoaderSizes.Medium] = 40,
|
|
22
|
+
_a[LoaderSizes.Large] = 60,
|
|
23
|
+
_a);
|
|
24
|
+
var scale = function (size, scale) { return size * scale + "px"; };
|
|
25
|
+
var StyledLoader = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n top: 1.5px;\n\n .lds-ring {\n display: inline-block;\n position: relative;\n width: ", ";\n height: ", ";\n }\n .lds-ring div {\n box-sizing: border-box;\n display: block;\n position: absolute;\n width: ", ";\n height: ", ";\n margin: ", ";\n border: ", " solid ", ";\n border-radius: 50%;\n animation: lds-ring 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: ", " transparent transparent transparent;\n }\n .lds-ring div:nth-child(1) {\n animation-delay: -0.3s;\n }\n .lds-ring div:nth-child(2) {\n animation-delay: -0.2s;\n }\n .lds-ring div:nth-child(3) {\n animation-delay: -0.1s;\n }\n @keyframes lds-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"], ["\n position: relative;\n top: 1.5px;\n\n .lds-ring {\n display: inline-block;\n position: relative;\n width: ", ";\n height: ", ";\n }\n .lds-ring div {\n box-sizing: border-box;\n display: block;\n position: absolute;\n width: ", ";\n height: ", ";\n margin: ", ";\n border: ", " solid ", ";\n border-radius: 50%;\n animation: lds-ring 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: ", " transparent transparent transparent;\n }\n .lds-ring div:nth-child(1) {\n animation-delay: -0.3s;\n }\n .lds-ring div:nth-child(2) {\n animation-delay: -0.2s;\n }\n .lds-ring div:nth-child(3) {\n animation-delay: -0.1s;\n }\n @keyframes lds-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])), function (props) { return scale(props.size, 1); }, function (props) { return scale(props.size, 1); }, function (props) { return scale(props.size, .8); }, function (props) { return scale(props.size, .8); }, function (props) { return scale(props.size, .1); }, function (props) { return scale(props.size, 0.066); }, function (props) { return props.color; }, function (props) { return props.color; });
|
|
26
|
+
function Loader(_a) {
|
|
27
|
+
var _b = _a.size, size = _b === void 0 ? LoaderSizes.Medium : _b, _c = _a.color, color = _c === void 0 ? Colors.White : _c;
|
|
28
|
+
return (React.createElement(StyledLoader, { size: LoaderSizesMap[size], color: color },
|
|
29
|
+
React.createElement("div", { className: "lds-ring" },
|
|
30
|
+
React.createElement("div", null),
|
|
31
|
+
React.createElement("div", null),
|
|
32
|
+
React.createElement("div", null))));
|
|
33
|
+
}
|
|
34
|
+
var templateObject_1;
|
|
35
|
+
|
|
36
|
+
export default Loader;
|
|
37
|
+
export { LoaderSizes };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n font-size: 1.2rem;\n font-weight: 500;\n color: ", ";\n margin-bottom: 10px;\n"], ["\n display: flex;\n align-items: center;\n font-size: 1.2rem;\n font-weight: 500;\n color: ", ";\n margin-bottom: 10px;\n"])), function (props) { return (props.isMax ? Colors.Red : Colors.Grey3); });
|
|
7
|
+
var MaxLength = function (_a) {
|
|
8
|
+
var value = _a.value, maxLength = _a.maxLength;
|
|
9
|
+
return (React.createElement(Container, { isMax: value.length === maxLength },
|
|
10
|
+
value.length,
|
|
11
|
+
"/",
|
|
12
|
+
maxLength));
|
|
13
|
+
};
|
|
14
|
+
var templateObject_1;
|
|
15
|
+
|
|
16
|
+
export default MaxLength;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Error Pop
|
|
4
|
+
*******************************************************************************/
|
|
5
|
+
declare type ErrorPopProps = {
|
|
6
|
+
duration?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const ErrorPop: React.FC<ErrorPopProps>;
|
|
9
|
+
/********************************************************************************
|
|
10
|
+
* Pop
|
|
11
|
+
*******************************************************************************/
|
|
12
|
+
declare type PopProps = {
|
|
13
|
+
duration?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const Pop: React.FC<PopProps>;
|
|
16
|
+
/********************************************************************************
|
|
17
|
+
* Card Pop
|
|
18
|
+
*******************************************************************************/
|
|
19
|
+
declare type CardPopProps = {
|
|
20
|
+
duration?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const CardPop: React.FC<CardPopProps>;
|
|
23
|
+
/********************************************************************************
|
|
24
|
+
* Fade In
|
|
25
|
+
*******************************************************************************/
|
|
26
|
+
declare type FadeInProps = {
|
|
27
|
+
duration?: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const FadeIn: React.FC<FadeInProps>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __rest, __assign } from '../_virtual/_tslib.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { motion } from 'framer-motion';
|
|
4
|
+
|
|
5
|
+
var ErrorPop = function (_a) {
|
|
6
|
+
var _b = _a.duration, children = _a.children, props = __rest(_a, ["duration", "children"]);
|
|
7
|
+
return (React.createElement(motion.div, __assign({}, props, { initial: { right: -100 }, animate: { right: 15 }, transition: {
|
|
8
|
+
// duration: duration as any,
|
|
9
|
+
type: "spring",
|
|
10
|
+
stiffness: 400,
|
|
11
|
+
damping: 20,
|
|
12
|
+
} }), children));
|
|
13
|
+
};
|
|
14
|
+
var Pop = function (_a) {
|
|
15
|
+
var _b = _a.duration, children = _a.children, props = __rest(_a, ["duration", "children"]);
|
|
16
|
+
return (React.createElement(motion.div, __assign({}, props, { initial: { scale: 0.8 }, animate: { scale: 1 }, transition: {
|
|
17
|
+
// duration,
|
|
18
|
+
type: "spring",
|
|
19
|
+
stiffness: 260,
|
|
20
|
+
damping: 20,
|
|
21
|
+
} }), children));
|
|
22
|
+
};
|
|
23
|
+
var CardPop = function (_a) {
|
|
24
|
+
var _b = _a.duration, duration = _b === void 0 ? 0.2 : _b, children = _a.children, props = __rest(_a, ["duration", "children"]);
|
|
25
|
+
return (React.createElement(motion.div, __assign({}, props, { initial: { scale: 0.9, opacity: 0 }, animate: { scale: 1, opacity: 1 }, transition: {
|
|
26
|
+
duration: duration,
|
|
27
|
+
// type: 'spring',
|
|
28
|
+
stiffness: 260,
|
|
29
|
+
damping: 20,
|
|
30
|
+
} }), children));
|
|
31
|
+
};
|
|
32
|
+
var FadeIn = function (_a) {
|
|
33
|
+
var _b = _a.duration, duration = _b === void 0 ? 0.2 : _b, children = _a.children, props = __rest(_a, ["duration", "children"]);
|
|
34
|
+
return (React.createElement(motion.div, __assign({}, props, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: {
|
|
35
|
+
duration: duration,
|
|
36
|
+
} }), children));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { CardPop, ErrorPop, FadeIn, Pop };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "react-phone-input-2/lib/semantic-ui.css";
|
|
3
|
+
export declare enum PhoneNumberInputSizes {
|
|
4
|
+
Large = "Large",
|
|
5
|
+
Regular = "Regular"
|
|
6
|
+
}
|
|
7
|
+
declare type PhoneNumberInputProps = {
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: any;
|
|
10
|
+
onEnter?: any;
|
|
11
|
+
validationError?: string;
|
|
12
|
+
subLabel?: string;
|
|
13
|
+
tip?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
phoneNumberInputSize?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const PhoneNumberInput: React.FC<PhoneNumberInputProps>;
|
|
19
|
+
export default PhoneNumberInput;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import Label from './Label.js';
|
|
6
|
+
import ValidationError from './ValidationError.js';
|
|
7
|
+
import { useMobileMedia } from '../utils/MediaQuery.js';
|
|
8
|
+
import PhoneInput from 'react-phone-input-2';
|
|
9
|
+
import 'react-phone-input-2/lib/semantic-ui.css';
|
|
10
|
+
|
|
11
|
+
var PhoneNumberInputSizes;
|
|
12
|
+
(function (PhoneNumberInputSizes) {
|
|
13
|
+
PhoneNumberInputSizes["Large"] = "Large";
|
|
14
|
+
PhoneNumberInputSizes["Regular"] = "Regular";
|
|
15
|
+
})(PhoneNumberInputSizes || (PhoneNumberInputSizes = {}));
|
|
16
|
+
// overwrite the preset style imports
|
|
17
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .react-tel-input {\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-size: ", ";\n position: relative;\n width: 100%;\n :disabled {\n cursor: not-allowed;\n }\n\n .form-control {\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n text-indent: 15px;\n transition: all 0.2s;\n color: ", ";\n font-weight: 500;\n position: relative;\n font-size: ", ";\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n margin-left: 50px;\n padding-left: 0;\n background: ", ";\n border: 1px solid ", ";\n border-radius: 0px 10px 10px 0px;\n height: ", ";\n width: calc(100% - 50px);\n z-index: 1;\n outline: none;\n &:hover {\n border: 1px solid ", ";\n }\n &.invalid-number {\n border: 1px solid ", ";\n background-color: ", ";\n border-left-color: ", ";\n &:focus {\n border: 1px solid ", ";\n border-left-color: ", ";\n background-color: ", ";\n }\n }\n &.open {\n border-color: ", ";\n border-radius: 0px 10px 0 0;\n /* border-bottom: none; */\n box-shadow: none;\n }\n ::placeholder {\n color: ", ";\n }\n &:focus {\n border: 1px solid ", ";\n }\n }\n\n .flag-dropdown {\n outline: none;\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n padding: 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 10px;\n &.open {\n background: ", ";\n border-radius: 10px 10px 0 0;\n .selected-flag {\n background: ", ";\n border-radius: 10px 0 0 0;\n }\n }\n &:hover, &:focus {\n cursor: pointer;\n .selected-flag {\n background-color: ", ";\n }\n }\n }\n\n input[disabled] {\n &+.flag-dropdown {\n &:hover {\n cursor: default;\n .selected-flag {\n background-color: transparent;\n }\n }\n }\n }\n\n .selected-flag {\n transition: all 0.2s;\n background: ", ";\n position: relative;\n width: 50px;\n height: 100%;\n padding: 0 0 0 10px;\n border-radius: 10px 0 0 10px;\n .flag {\n position: absolute;\n top: 50%;\n margin-top: -5px;\n }\n .arrow {\n position: relative;\n top: 50%;\n margin-top: -2px;\n left: 25px;\n width: 0;\n height: 0;\n border-left: 3px solid transparent;\n border-right: 3px solid transparent;\n border-top: 4px solid #555;\n &.up {\n border-top: none;\n border-bottom: 4px solid #555;\n }\n }\n &.open {\n z-index: 2;\n }\n }\n\n .country-list {\n z-index: 2;\n border-radius: 0 0 10px 10px;\n border: 1px solid ", ";\n border-top: none;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0px 0 10px -1px;\n box-shadow: unset;\n background-color: ", ";\n width: calc(100% + 2px);\n max-height: ", ";\n overflow-y: scroll;\n .flag {\n display: inline-block;\n }\n .divider {\n padding-bottom: 5px;\n margin-bottom: 5px;\n border-bottom: 1px solid #ccc;\n }\n .country {\n padding: 7px 9px;\n .dial-code {\n color: #6b6b6b;\n }\n &:hover {\n background-color: #f1f1f1;\n }\n &.highlight {\n background-color: #f1f1f1;\n }\n }\n .flag {\n margin-right: 7px;\n margin-top: 2px;\n }\n .country-name {\n margin-right: 6px;\n }\n .search {\n position: sticky;\n top: 0;\n background-color: #fff;\n padding: 5px 0 6px 10px;\n }\n .search-emoji {\n display: none;\n font-size: ", ";\n }\n .search-box {\n border: 1px solid #cacaca;\n border-radius: 3px;\n font-size: ", ";\n line-height: 15px;\n padding: 3px 8px 5px;\n outline: none;\n }\n .no-entries-message {\n padding: 7px 10px 11px;\n opacity: .7;\n }\n &::-webkit-scrollbar { width: 12px; }\n &::-webkit-scrollbar-track { background-color: #e6e6e6; }\n &::-webkit-scrollbar-thumb { background-color: #c5c5c4; border-radius: 5px; }\n }\n\n .invalid-number-message {\n position: absolute;\n z-index: 1;\n font-size: ", ";\n left: 46px;\n top: -8px;\n background: #fff;\n padding: 0 2px;\n color: #de0000;\n }\n }\n"], ["\n .react-tel-input {\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-size: ", ";\n position: relative;\n width: 100%;\n :disabled {\n cursor: not-allowed;\n }\n\n .form-control {\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n text-indent: 15px;\n transition: all 0.2s;\n color: ", ";\n font-weight: 500;\n position: relative;\n font-size: ", ";\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n margin-left: 50px;\n padding-left: 0;\n background: ", ";\n border: 1px solid ", ";\n border-radius: 0px 10px 10px 0px;\n height: ", ";\n width: calc(100% - 50px);\n z-index: 1;\n outline: none;\n &:hover {\n border: 1px solid ", ";\n }\n &.invalid-number {\n border: 1px solid ", ";\n background-color: ", ";\n border-left-color: ", ";\n &:focus {\n border: 1px solid ", ";\n border-left-color: ", ";\n background-color: ", ";\n }\n }\n &.open {\n border-color: ", ";\n border-radius: 0px 10px 0 0;\n /* border-bottom: none; */\n box-shadow: none;\n }\n ::placeholder {\n color: ", ";\n }\n &:focus {\n border: 1px solid ", ";\n }\n }\n\n .flag-dropdown {\n outline: none;\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n padding: 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 10px;\n &.open {\n background: ", ";\n border-radius: 10px 10px 0 0;\n .selected-flag {\n background: ", ";\n border-radius: 10px 0 0 0;\n }\n }\n &:hover, &:focus {\n cursor: pointer;\n .selected-flag {\n background-color: ", ";\n }\n }\n }\n\n input[disabled] {\n &+.flag-dropdown {\n &:hover {\n cursor: default;\n .selected-flag {\n background-color: transparent;\n }\n }\n }\n }\n\n .selected-flag {\n transition: all 0.2s;\n background: ", ";\n position: relative;\n width: 50px;\n height: 100%;\n padding: 0 0 0 10px;\n border-radius: 10px 0 0 10px;\n .flag {\n position: absolute;\n top: 50%;\n margin-top: -5px;\n }\n .arrow {\n position: relative;\n top: 50%;\n margin-top: -2px;\n left: 25px;\n width: 0;\n height: 0;\n border-left: 3px solid transparent;\n border-right: 3px solid transparent;\n border-top: 4px solid #555;\n &.up {\n border-top: none;\n border-bottom: 4px solid #555;\n }\n }\n &.open {\n z-index: 2;\n }\n }\n\n .country-list {\n z-index: 2;\n border-radius: 0 0 10px 10px;\n border: 1px solid ", ";\n border-top: none;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0px 0 10px -1px;\n box-shadow: unset;\n background-color: ", ";\n width: calc(100% + 2px);\n max-height: ", ";\n overflow-y: scroll;\n .flag {\n display: inline-block;\n }\n .divider {\n padding-bottom: 5px;\n margin-bottom: 5px;\n border-bottom: 1px solid #ccc;\n }\n .country {\n padding: 7px 9px;\n .dial-code {\n color: #6b6b6b;\n }\n &:hover {\n background-color: #f1f1f1;\n }\n &.highlight {\n background-color: #f1f1f1;\n }\n }\n .flag {\n margin-right: 7px;\n margin-top: 2px;\n }\n .country-name {\n margin-right: 6px;\n }\n .search {\n position: sticky;\n top: 0;\n background-color: #fff;\n padding: 5px 0 6px 10px;\n }\n .search-emoji {\n display: none;\n font-size: ", ";\n }\n .search-box {\n border: 1px solid #cacaca;\n border-radius: 3px;\n font-size: ", ";\n line-height: 15px;\n padding: 3px 8px 5px;\n outline: none;\n }\n .no-entries-message {\n padding: 7px 10px 11px;\n opacity: .7;\n }\n &::-webkit-scrollbar { width: 12px; }\n &::-webkit-scrollbar-track { background-color: #e6e6e6; }\n &::-webkit-scrollbar-thumb { background-color: #c5c5c4; border-radius: 5px; }\n }\n\n .invalid-number-message {\n position: absolute;\n z-index: 1;\n font-size: ", ";\n left: 46px;\n top: -8px;\n background: #fff;\n padding: 0 2px;\n color: #de0000;\n }\n }\n"])), function (props) { return props.isMobile ? '1.6rem' : '1.4rem'; }, Colors.Grey1, function (props) { return props.isMobile ? '1.6rem' : '1.4rem'; }, Colors.White, Colors.Grey5, function (props) { return props.phoneNumberInputSize === PhoneNumberInputSizes.Regular ? '38px' : '48px'; }, Colors.Grey5, Colors.Grey5, Colors.White, Colors.Grey5, Colors.Grey4, Colors.Grey5, Colors.White, Colors.Grey5, Colors.Grey4, Colors.Grey4, Colors.Grey6, Colors.Grey5, Colors.Grey6, Colors.Grey6, Colors.Grey5, Colors.Grey6, Colors.Grey5, Colors.White, function (props) { return props.isMobile ? '180px' : '200px'; }, function (props) { return props.isMobile ? '1.6rem' : '1.4rem'; }, function (props) { return props.isMobile ? '1.6rem' : '1.4rem'; }, function (props) { return props.isMobile ? '1.6rem' : '1.4rem'; });
|
|
18
|
+
var PhoneNumberInput = function (_a) {
|
|
19
|
+
var value = _a.value, onChange = _a.onChange, onEnter = _a.onEnter, validationError = _a.validationError, phoneNumberInputSize = _a.phoneNumberInputSize, subLabel = _a.subLabel, tip = _a.tip, label = _a.label;
|
|
20
|
+
return (React.createElement(React.Fragment, null,
|
|
21
|
+
label && React.createElement(Label, { text: label, subText: subLabel, tip: tip }),
|
|
22
|
+
React.createElement(Container, { isMobile: useMobileMedia(), phoneNumberInputSize: phoneNumberInputSize },
|
|
23
|
+
React.createElement(PhoneInput, { country: 'us', placeholder: "Enter your mobile phone number", preferredCountries: ['us', 'ca'], value: value, onKeyDown: function (e) {
|
|
24
|
+
// quick fix for current issue -> https://github.com/bl00mber/react-phone-input-2/issues/222
|
|
25
|
+
if ((e.which === 8 || e.which === 46) && value.length <= 1) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
}
|
|
28
|
+
else if (e.which === 13 && onEnter) {
|
|
29
|
+
onEnter();
|
|
30
|
+
}
|
|
31
|
+
}, onChange: function (value) {
|
|
32
|
+
onChange(value);
|
|
33
|
+
}, countryCodeEditable: false }),
|
|
34
|
+
validationError && (React.createElement(ValidationError, { validationError: validationError })))));
|
|
35
|
+
};
|
|
36
|
+
var templateObject_1;
|
|
37
|
+
|
|
38
|
+
export default PhoneNumberInput;
|
|
39
|
+
export { PhoneNumberInputSizes };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React, { useState, Fragment } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { lighten, darken } from 'polished';
|
|
6
|
+
import Counter from './Counter.js';
|
|
7
|
+
import AnimateHeight from 'react-animate-height';
|
|
8
|
+
import { output } from '@sellout/utils/.dist/price';
|
|
9
|
+
|
|
10
|
+
var Row = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: ", ";\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: ", ";\n"])), function (props) { return props.justify; });
|
|
11
|
+
var Column = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
|
|
12
|
+
var Container = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n margin: 0 30px;\n padding: 25px 0;\n border-bottom: 1px solid ", ";\n"], ["\n background-color: ", ";\n margin: 0 30px;\n padding: 25px 0;\n border-bottom: 1px solid ", ";\n"])), Colors.White, Colors.Grey6);
|
|
13
|
+
var Title = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 1.8rem;\n color: ", ";\n font-weight: 600;\n margin-bottom: 5px;\n"], ["\n font-size: 1.8rem;\n color: ", ";\n font-weight: 600;\n margin-bottom: 5px;\n"])), Colors.Grey1);
|
|
14
|
+
var Price = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: 1.4rem;\n font-weight: 500;\n color: ", ";\n margin-bottom: 5px;\n"], ["\n font-size: 1.4rem;\n font-weight: 500;\n color: ", ";\n margin-bottom: 5px;\n"])), Colors.Grey2);
|
|
15
|
+
var Subtitle = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: 1.2rem;\n font-weight: 500;\n line-height: 160%;\n color: ", ";\n"], ["\n font-size: 1.2rem;\n font-weight: 500;\n line-height: 160%;\n color: ", ";\n"])), Colors.Grey3);
|
|
16
|
+
var Description = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 1.2rem;\n font-weight: 500;\n line-height: 160%;\n color: ", ";\n margin-top: 10px;\n"], ["\n font-size: 1.2rem;\n font-weight: 500;\n line-height: 160%;\n color: ", ";\n margin-top: 10px;\n"])), Colors.Grey2);
|
|
17
|
+
var Ellipsis = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: -webkit-box;\n -webkit-line-clamp: ", ";\n -webkit-box-orient: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n"], ["\n display: -webkit-box;\n -webkit-line-clamp: ", ";\n -webkit-box-orient: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n"])), function (props) { return props.active ? 3 : null; }, function (props) { return props.active ? 'vertical' : null; });
|
|
18
|
+
var ShowMore = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font-size: 1.2rem;\n font-weight: 500;\n line-height: 160%;\n color: ", ";\n transition: all 0.2s;\n\n &:hover {\n cursor: pointer;\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n"], ["\n font-size: 1.2rem;\n font-weight: 500;\n line-height: 160%;\n color: ", ";\n transition: all 0.2s;\n\n &:hover {\n cursor: pointer;\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n"])), Colors.Orange, lighten(0.025, Colors.Orange), darken(0.025, Colors.Orange));
|
|
19
|
+
function Product(_a) {
|
|
20
|
+
var _b = _a.title, title = _b === void 0 ? '' : _b, _c = _a.price, price = _c === void 0 ? 0 : _c, _d = _a.subtitle, subtitle = _d === void 0 ? '' : _d, _e = _a.description, description = _e === void 0 ? '' : _e,
|
|
21
|
+
// Counter Props
|
|
22
|
+
value = _a.value, minValue = _a.minValue, maxValue = _a.maxValue, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement;
|
|
23
|
+
var _f = useState(false), showMore = _f[0], setShowMore = _f[1];
|
|
24
|
+
var _g = useState(true), showEllipsis = _g[0], setShowEllipsis = _g[1];
|
|
25
|
+
var descModified = description;
|
|
26
|
+
if (descModified.length > 210 && !showMore) {
|
|
27
|
+
descModified = descModified.substring(0, 210) + '...';
|
|
28
|
+
}
|
|
29
|
+
var toggle = function () {
|
|
30
|
+
setShowEllipsis(!showEllipsis);
|
|
31
|
+
setShowMore(!showMore);
|
|
32
|
+
};
|
|
33
|
+
return (React.createElement(Container, null,
|
|
34
|
+
React.createElement(Row, { justify: "space-between" },
|
|
35
|
+
React.createElement(Column, null,
|
|
36
|
+
React.createElement(Title, null, title),
|
|
37
|
+
React.createElement(Price, null,
|
|
38
|
+
"$",
|
|
39
|
+
output(price))),
|
|
40
|
+
React.createElement(Counter, { value: value, minValue: minValue, maxValue: maxValue, onIncrement: onIncrement, onDecrement: onDecrement })),
|
|
41
|
+
React.createElement(Row, null, subtitle && React.createElement(Subtitle, null, subtitle)),
|
|
42
|
+
(function () {
|
|
43
|
+
if (!description)
|
|
44
|
+
return;
|
|
45
|
+
return (React.createElement(Fragment, null,
|
|
46
|
+
React.createElement(AnimateHeight, { height: showMore ? "auto" : 67 },
|
|
47
|
+
React.createElement(Ellipsis, { active: showEllipsis },
|
|
48
|
+
React.createElement(Description, null, description))),
|
|
49
|
+
React.createElement(ShowMore, { onClick: function () { return toggle(); } }, showMore ? "Show Less" : "Show More")));
|
|
50
|
+
})()));
|
|
51
|
+
}
|
|
52
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
53
|
+
|
|
54
|
+
export default Product;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare enum TextButtonSizes {
|
|
3
|
+
Regular = "Regular",
|
|
4
|
+
Small = "Small"
|
|
5
|
+
}
|
|
6
|
+
declare type TextButtonProps = {
|
|
7
|
+
children: string;
|
|
8
|
+
size?: TextButtonSizes;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
10
|
+
margin?: string;
|
|
11
|
+
icon?: any;
|
|
12
|
+
iconRotation?: number;
|
|
13
|
+
};
|
|
14
|
+
declare const TextButton: React.FC<TextButtonProps>;
|
|
15
|
+
export default TextButton;
|