@sellout/ui 0.0.58 → 0.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/build/Colors.js +26 -0
  2. package/build/_virtual/_tslib.js +51 -0
  3. package/build/components/Button.d.ts +20 -6
  4. package/build/components/Button.js +210 -0
  5. package/build/components/CodeInput.d.ts +8 -0
  6. package/build/components/CodeInput.js +78 -0
  7. package/build/components/Counter.js +28 -0
  8. package/build/components/Dropdown.d.ts +24 -0
  9. package/build/components/Dropdown.js +49 -0
  10. package/build/components/Flex.d.ts +12 -0
  11. package/build/components/Flex.js +12 -0
  12. package/build/components/Icon.d.ts +49 -3
  13. package/build/components/Icon.js +39 -0
  14. package/build/components/Icons.d.ts +48 -2
  15. package/build/components/Icons.js +181 -0
  16. package/build/components/Input.d.ts +16 -1
  17. package/build/components/Input.js +177 -0
  18. package/build/components/InputOld.d.ts +23 -0
  19. package/build/components/InputOld.js +83 -0
  20. package/build/components/Label.d.ts +9 -0
  21. package/build/components/Label.js +22 -0
  22. package/build/components/Loader.js +37 -0
  23. package/build/components/MaxLength.d.ts +7 -0
  24. package/build/components/MaxLength.js +16 -0
  25. package/build/components/Motion.d.ts +30 -0
  26. package/build/components/Motion.js +39 -0
  27. package/build/components/PhoneNumberInput.d.ts +19 -0
  28. package/build/components/PhoneNumberInput.js +39 -0
  29. package/build/components/Product.js +54 -0
  30. package/build/components/TextButton.d.ts +15 -0
  31. package/build/components/TextButton.js +39 -0
  32. package/build/components/Tip.d.ts +7 -0
  33. package/build/components/Tip.js +18 -0
  34. package/build/components/UserImage.d.ts +13 -0
  35. package/build/components/UserImage.js +20 -0
  36. package/build/components/UserInfo.d.ts +12 -0
  37. package/build/components/UserInfo.js +38 -0
  38. package/build/components/ValidationError.d.ts +6 -0
  39. package/build/components/ValidationError.js +23 -0
  40. package/build/components/VerticalUserInfo.d.ts +12 -0
  41. package/build/index.d.ts +18 -126
  42. package/build/index.js +27 -453
  43. package/build/utils/ErrorUtil.d.ts +1 -0
  44. package/build/utils/ErrorUtil.js +18 -0
  45. package/build/utils/MediaQuery.d.ts +17 -0
  46. package/build/utils/MediaQuery.js +64 -0
  47. package/build/utils/Validation.d.ts +6 -0
  48. package/build/utils/Validation.js +53 -0
  49. package/build/utils/makeEventHandler.js +11 -0
  50. package/package.json +13 -5
  51. package/.storybook/config.js +0 -3
  52. package/.storybook/preview-head.html +0 -21
  53. package/.storybook/webpack.config.js +0 -19
  54. package/build/index.es.js +0 -443
  55. package/rollup.config.js +0 -20
  56. package/src/Colors.ts +0 -23
  57. package/src/assets/images/sellout-logo-long.svg +0 -11
  58. package/src/assets/images/sellout-logo-mono-white.svg +0 -4
  59. package/src/components/Button.tsx +0 -141
  60. package/src/components/Counter.tsx +0 -91
  61. package/src/components/Icon.tsx +0 -78
  62. package/src/components/Icons.ts +0 -251
  63. package/src/components/Input.tsx +0 -258
  64. package/src/components/Loader.tsx +0 -88
  65. package/src/components/Product.tsx +0 -156
  66. package/src/index.ts +0 -28
  67. package/src/stories/Button.stories.js +0 -30
  68. package/src/stories/Counter.stories.js +0 -28
  69. package/src/stories/Icon.stories.js +0 -25
  70. package/src/stories/Input.stories.js +0 -79
  71. package/src/stories/Loader.stories.js +0 -50
  72. package/src/stories/Product.stories.js +0 -67
  73. package/src/utils/makeEventHandler.ts +0 -8
  74. package/tsconfig.json +0 -24
  75. package/utils/generateIconLibrary.js +0 -49
  76. package/utils/icon-library.csv +0 -129
@@ -0,0 +1,26 @@
1
+ var Colors;
2
+ (function (Colors) {
3
+ Colors["White"] = "#FFFFFF";
4
+ Colors["Black"] = "#000000";
5
+ Colors["Yellow"] = "#FFBA49";
6
+ // Green = "#419D78",
7
+ Colors["Green"] = "#42BB83";
8
+ Colors["OffWhite"] = "#FCFCFC";
9
+ Colors["LightBlue"] = "#39159C";
10
+ Colors["Blue"] = "#2D0E84";
11
+ Colors["DarkBlue"] = "#1D0858";
12
+ Colors["Red"] = "#E63946";
13
+ Colors["Orange"] = "#FF700F";
14
+ Colors["FadedOrange"] = "#FFF1E7";
15
+ Colors["LightOrange"] = "#FFBE93";
16
+ Colors["DarkOrange"] = "#D65600";
17
+ Colors["Grey1"] = "#333333";
18
+ Colors["Grey2"] = "#4F4F4F";
19
+ Colors["Grey3"] = "#828282";
20
+ Colors["Grey4"] = "#BDBDBD";
21
+ Colors["Grey5"] = "#E0E0E0";
22
+ Colors["Grey6"] = "#F2F2F2";
23
+ Colors["Grey7"] = "#F8F8F8";
24
+ })(Colors || (Colors = {}));
25
+
26
+ export { Colors };
@@ -0,0 +1,51 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+ var __assign = function() {
17
+ __assign = Object.assign || function __assign(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+
27
+ function __rest(s, e) {
28
+ var t = {};
29
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
+ t[p] = s[p];
31
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
+ t[p[i]] = s[p[i]];
35
+ }
36
+ return t;
37
+ }
38
+
39
+ function __spreadArrays() {
40
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
41
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
42
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
43
+ r[k] = a[j];
44
+ return r;
45
+ }
46
+ function __makeTemplateObject(cooked, raw) {
47
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
48
+ return cooked;
49
+ }
50
+
51
+ export { __assign, __makeTemplateObject, __rest, __spreadArrays };
@@ -1,18 +1,32 @@
1
1
  /// <reference types="react" />
2
+ import { Colors } from '../Colors';
2
3
  export declare enum ButtonTypes {
3
- Submit = "Submit"
4
+ Next = "Next",
5
+ Regular = "Regular",
6
+ Thin = "Thin"
4
7
  }
5
8
  export declare enum ButtonStates {
6
- Active = "Active"
9
+ Active = "Active",
10
+ Warning = "Warning",
11
+ Disabled = "Disabled"
12
+ }
13
+ export declare enum ButtonIconPosition {
14
+ Left = "Left",
15
+ Right = "Right"
7
16
  }
8
17
  export declare type ButtonProps = {
9
- type?: string;
10
- state?: string;
18
+ type?: ButtonTypes;
19
+ state?: ButtonStates;
20
+ bgColor?: Colors;
11
21
  text?: string;
12
22
  onClick?: any;
13
23
  icon?: any;
24
+ iconPosition?: ButtonIconPosition;
25
+ iconSize?: number;
14
26
  margin?: string;
15
- padding?: string;
16
27
  loading?: boolean;
28
+ label?: string;
29
+ tip?: string;
30
+ subLabel?: string;
17
31
  };
18
- export default function Button({ type, state, text, onClick, icon, margin, padding, loading, }: ButtonProps): JSX.Element;
32
+ export default function Button({ type, state, bgColor, text, onClick, icon, iconPosition, iconSize, margin, loading, }: ButtonProps): JSX.Element;
@@ -0,0 +1,210 @@
1
+ import { Colors } from '../Colors.js';
2
+ import { __makeTemplateObject } from '../_virtual/_tslib.js';
3
+ import React, { Fragment } from 'react';
4
+ import styled from 'styled-components';
5
+ import { lighten, darken } from 'polished';
6
+ import Icon from './Icon.js';
7
+ import Loader, { LoaderSizes } from './Loader.js';
8
+
9
+ var ButtonTypes;
10
+ (function (ButtonTypes) {
11
+ ButtonTypes["Next"] = "Next";
12
+ ButtonTypes["Regular"] = "Regular";
13
+ ButtonTypes["Thin"] = "Thin";
14
+ })(ButtonTypes || (ButtonTypes = {}));
15
+ var ButtonStates;
16
+ (function (ButtonStates) {
17
+ ButtonStates["Active"] = "Active";
18
+ ButtonStates["Warning"] = "Warning";
19
+ ButtonStates["Disabled"] = "Disabled";
20
+ })(ButtonStates || (ButtonStates = {}));
21
+ var ButtonIconPosition;
22
+ (function (ButtonIconPosition) {
23
+ ButtonIconPosition["Left"] = "Left";
24
+ ButtonIconPosition["Right"] = "Right";
25
+ })(ButtonIconPosition || (ButtonIconPosition = {}));
26
+ var StyledButton = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n align-items: center;\n overflow: hidden;\n justify-content: center;\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: ",
27
+ ";\n width: ",
28
+ ";\n display: flex;\n flex-direction: row;\n align-items: center;\n overflow: hidden;\n justify-content: center;\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: ",
29
+ ";\n background-color: ",
30
+ ";\n border: ",
31
+ ";\n\n &:hover {\n cursor: ",
32
+ ";\n background-color: ",
33
+ ";\n }\n\n &:active {\n cursor: ",
34
+ ";\n background-color: ",
35
+ ";\n }\n"])), function (props) {
36
+ if (props.type === ButtonTypes.Next) {
37
+ return "50px";
38
+ }
39
+ if (props.type === ButtonTypes.Regular) {
40
+ return "40px";
41
+ }
42
+ if (props.type === ButtonTypes.Thin) {
43
+ if (props.state === ButtonStates.Warning) {
44
+ return "28px";
45
+ }
46
+ return "30px";
47
+ }
48
+ return null;
49
+ }, function (props) {
50
+ if (props.type === ButtonTypes.Next) {
51
+ return "100%";
52
+ }
53
+ if (props.type === ButtonTypes.Regular) {
54
+ return "fit-content";
55
+ }
56
+ if (props.type === ButtonTypes.Thin) {
57
+ return "fit-content";
58
+ }
59
+ return null;
60
+ }, function (props) { return (Boolean(props.margin) ? props.margin : "0px"); }, function (props) {
61
+ if (props.type === ButtonTypes.Next) {
62
+ return "0px";
63
+ }
64
+ if (props.type === ButtonTypes.Regular) {
65
+ return "0 25px";
66
+ }
67
+ if (props.type === ButtonTypes.Thin) {
68
+ return "0 15px";
69
+ }
70
+ return null;
71
+ }, function (props) {
72
+ if (props.state === ButtonStates.Disabled) {
73
+ return Colors.Grey6;
74
+ }
75
+ if (props.state === ButtonStates.Warning) {
76
+ return Colors.White;
77
+ }
78
+ return props.bgColor || Colors.Orange;
79
+ }, function (props) {
80
+ if (props.state === ButtonStates.Warning) {
81
+ return "1px solid " + Colors.Grey5;
82
+ }
83
+ return null;
84
+ }, function (props) {
85
+ if (props.state === ButtonStates.Disabled) {
86
+ return null;
87
+ }
88
+ return props.onClick ? "pointer" : null;
89
+ }, function (props) {
90
+ if (props.state === ButtonStates.Disabled) {
91
+ return Colors.Grey6;
92
+ }
93
+ if (props.state === ButtonStates.Warning) {
94
+ return Colors.White;
95
+ }
96
+ return lighten(0.05, props.bgColor || Colors.Orange);
97
+ }, function (props) {
98
+ if (props.state === ButtonStates.Disabled) {
99
+ return null;
100
+ }
101
+ return props.onClick ? "pointer" : null;
102
+ }, function (props) {
103
+ if (props.state === ButtonStates.Disabled) {
104
+ return Colors.Grey6;
105
+ }
106
+ if (props.state === ButtonStates.Warning) {
107
+ return Colors.White;
108
+ }
109
+ return darken(0.05, props.bgColor || Colors.Orange);
110
+ });
111
+ var Text = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n font-size: ", ";\n font-weight: ", ";\n text-transform: uppercase;\n margin: ", ";\n color: ", ";\n top: ", ";\n"], ["\n position: relative;\n font-size: ",
112
+ ";\n font-weight: ",
113
+ ";\n text-transform: uppercase;\n margin: ",
114
+ ";\n color: ",
115
+ ";\n top: ",
116
+ ";\n"])), function (props) {
117
+ if (props.type === ButtonTypes.Next) {
118
+ return "1.4rem";
119
+ }
120
+ if (props.type === ButtonTypes.Regular) {
121
+ return "1.4rem";
122
+ }
123
+ if (props.type === ButtonTypes.Regular) {
124
+ return "1.2rem";
125
+ }
126
+ if (props.type === ButtonTypes.Thin) {
127
+ return "1.2rem";
128
+ }
129
+ return null;
130
+ }, function (props) {
131
+ if (props.type === ButtonTypes.Next) {
132
+ return "700";
133
+ }
134
+ if (props.type === ButtonTypes.Regular) {
135
+ return "700";
136
+ }
137
+ if (props.type === ButtonTypes.Thin) {
138
+ return "600";
139
+ }
140
+ return null;
141
+ }, function (props) {
142
+ if (props.type === ButtonTypes.Next) {
143
+ return "0 10px";
144
+ }
145
+ if (props.type === ButtonTypes.Regular) {
146
+ if (props.iconPosition === ButtonIconPosition.Left) {
147
+ return "0 0 0 10px";
148
+ }
149
+ if (props.iconPosition === ButtonIconPosition.Right) {
150
+ return "0 10px 0 0";
151
+ }
152
+ return "0";
153
+ }
154
+ if (props.type === ButtonTypes.Thin) {
155
+ if (props.iconPosition === ButtonIconPosition.Left) {
156
+ return "0 0 0 7px";
157
+ }
158
+ if (props.iconPosition === ButtonIconPosition.Right) {
159
+ return "0 7px 0 0";
160
+ }
161
+ return "0";
162
+ }
163
+ return null;
164
+ }, function (props) {
165
+ if (props.state === ButtonStates.Disabled) {
166
+ return Colors.Grey3;
167
+ }
168
+ if (props.state === ButtonStates.Warning) {
169
+ return Colors.Grey3;
170
+ }
171
+ return Colors.White;
172
+ }, function (props) {
173
+ if (props.type === ButtonTypes.Thin) {
174
+ if (props.icon) {
175
+ return '-1px';
176
+ }
177
+ return "0";
178
+ }
179
+ return null;
180
+ });
181
+ function Button(_a) {
182
+ var _b = _a.type, type = _b === void 0 ? ButtonTypes.Next : _b, _c = _a.state, state = _c === void 0 ? ButtonStates.Active : _c, bgColor = _a.bgColor, 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,
183
+ // label,
184
+ // tip,
185
+ // subLabel,
186
+ margin = _a.margin, _f = _a.loading, loading = _f === void 0 ? false : _f;
187
+ var iconColor = state === ButtonStates.Disabled ? Colors.Grey3 : Colors.White;
188
+ if (icon && !iconPosition)
189
+ iconPosition = ButtonIconPosition.Left;
190
+ var iconEl = (React.createElement(Icon, { icon: icon, color: iconColor, size: iconSize, top: iconSize < 14 ? "-1px" : undefined }));
191
+ var click = loading || state === ButtonStates.Disabled ? null : function () { return onClick(); };
192
+ return (React.createElement(React.Fragment, null,
193
+ React.createElement(StyledButton, { type: type, state: state, onClick: click, margin: margin, bgColor: bgColor }, (function () {
194
+ return (React.createElement(Fragment, null, (function () {
195
+ if (loading) {
196
+ return (React.createElement(Fragment, null,
197
+ React.createElement(Loader, { size: LoaderSizes.VerySmall, color: iconColor })));
198
+ }
199
+ return (React.createElement(Fragment, null,
200
+ icon && iconPosition === ButtonIconPosition.Left && iconEl,
201
+ text && (React.createElement(Text, { type: type, state: state, icon: Boolean(icon), iconPosition: iconPosition }, text)),
202
+ icon &&
203
+ iconPosition === ButtonIconPosition.Right && iconEl));
204
+ })()));
205
+ })())));
206
+ }
207
+ var templateObject_1, templateObject_2;
208
+
209
+ export default Button;
210
+ export { ButtonIconPosition, ButtonStates, ButtonTypes };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare type CodeInputProps = {
3
+ length: number;
4
+ onChange: Function;
5
+ onComplete: Function;
6
+ };
7
+ declare const CodeInput: React.FC<CodeInputProps>;
8
+ export default CodeInput;
@@ -0,0 +1,78 @@
1
+ import { Colors } from '../Colors.js';
2
+ import { __makeTemplateObject, __spreadArrays } from '../_virtual/_tslib.js';
3
+ import React, { useState } from 'react';
4
+ import styled from 'styled-components';
5
+
6
+ var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([" \n margin: ", ";\n"], [" \n margin: ", ";\n"])), function (props) { return props.margin; });
7
+ var Input = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 2px solid ", ";\n height: 70px;\n width: 55px;\n border-radius: 10px;\n background-color: white;\n transition: all 0.1s;\n margin-right: 10px;\n outline: 0px;\n font-size: 24px;\n text-align: center;\n padding: 0px;\n box-shadow: none;\n -moz-appearance: textfield;\n\n &:focus {\n border: 2px solid ", ";\n }\n"], ["\n border: 2px solid ", ";\n height: 70px;\n width: 55px;\n border-radius: 10px;\n background-color: white;\n transition: all 0.1s;\n margin-right: 10px;\n outline: 0px;\n font-size: 24px;\n text-align: center;\n padding: 0px;\n box-shadow: none;\n -moz-appearance: textfield;\n\n &:focus {\n border: 2px solid ", ";\n }\n"])), Colors.Grey5, Colors.Grey1);
8
+ var CodeInput = function (_a) {
9
+ var onChange = _a.onChange, onComplete = _a.onComplete, _b = _a.length, length = _b === void 0 ? 4 : _b;
10
+ var _c = useState(new Array(length).fill('')), value = _c[0], setValue = _c[1];
11
+ var inputs = [];
12
+ var change = function (valueAt, index) {
13
+ var currentValue = __spreadArrays(value);
14
+ // Single Character Press
15
+ if (valueAt.length === 1) {
16
+ currentValue[index] = valueAt;
17
+ setValue(currentValue);
18
+ if (inputs[index + 1]) {
19
+ inputs[index + 1].focus();
20
+ }
21
+ }
22
+ else if (valueAt.length === length) { //code pasted
23
+ setValue(valueAt.split(''));
24
+ onComplete(valueAt);
25
+ if (inputs[index + 1]) {
26
+ inputs[index + 1].focus();
27
+ }
28
+ }
29
+ else if (valueAt.length > 0 && valueAt.length < length) { // More than 1 character, less than the total number required
30
+ change(valueAt.charAt(valueAt.length - 1), index);
31
+ }
32
+ if (index + 1 === length) {
33
+ onComplete(currentValue.join(''));
34
+ }
35
+ };
36
+ var renderInput = function (index) {
37
+ var curValue = value[index];
38
+ 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) {
39
+ onChange();
40
+ change(event.target.value, index);
41
+ }, onKeyDown: function (event) {
42
+ if (event.keyCode === 8 || event.keyCode === 46) { // handle backspace or delete
43
+ event.preventDefault();
44
+ var currentValue = __spreadArrays(value);
45
+ currentValue[index] = '';
46
+ setValue(currentValue);
47
+ if (index !== 0) {
48
+ inputs[index - 1].focus();
49
+ }
50
+ }
51
+ else if (event.keyCode === 37) { // navigate left with left arrow key
52
+ event.preventDefault();
53
+ if (index !== 0) {
54
+ inputs[index - 1].focus();
55
+ }
56
+ }
57
+ else if (event.keyCode === 39) { // navigate right with right arrow key
58
+ event.preventDefault();
59
+ if (index !== value.length - 1) {
60
+ inputs[index + 1].focus();
61
+ }
62
+ }
63
+ else if ( // prohibit weird behavior when up, down, +, or - are pressed
64
+ event.keyCode === 38
65
+ || event.keyCode === 40
66
+ || event.keyCode === 107
67
+ || event.keyCode === 109) {
68
+ event.preventDefault();
69
+ }
70
+ } }));
71
+ };
72
+ return (React.createElement(Container, null, value.map(function (_, index) {
73
+ return renderInput(index);
74
+ })));
75
+ };
76
+ var templateObject_1, templateObject_2;
77
+
78
+ export default CodeInput;
@@ -0,0 +1,28 @@
1
+ import { Colors } from '../Colors.js';
2
+ import { __makeTemplateObject } from '../_virtual/_tslib.js';
3
+ import React, { Fragment } from 'react';
4
+ import styled from 'styled-components';
5
+ import { lighten } from 'polished';
6
+ import Icon, { Icons } from './Icon.js';
7
+
8
+ 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: 85px;\n min-height: 42px;\n /* background-color: red; */\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 85px;\n min-height: 42px;\n /* background-color: red; */\n"])));
9
+ 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: ",
10
+ " !important;\n }\n"])), function (props) { return props.justify; }, function (props) { return (props.active ? "pointer" : null); }, function (props) {
11
+ return props.active ? lighten(0.025, Colors.Orange) : null;
12
+ });
13
+ var Value = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 2.4rem;\n color: ", ";\n min-width: 20px;\n text-align: center;\n"], ["\n font-size: 2.4rem;\n color: ", ";\n min-width: 20px;\n text-align: center;\n"])), Colors.Grey1);
14
+ function Counter(_a) {
15
+ var value = _a.value, maxValue = _a.maxValue, _b = _a.minValue, minValue = _b === void 0 ? 0 : _b, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement;
16
+ var canDecrement = value > minValue;
17
+ var canIncrement = Boolean(!Boolean(maxValue) || (maxValue && value < maxValue));
18
+ return (React.createElement(Container, null,
19
+ value > 0 && (React.createElement(Fragment, null,
20
+ React.createElement(IconContainer, { active: canDecrement, onClick: function () { return (canDecrement ? onDecrement() : null); }, justify: "flex-start" },
21
+ React.createElement(Icon, { icon: Icons.MinusCircleLight, color: canDecrement ? Colors.Orange : Colors.Grey5 })),
22
+ React.createElement(Value, null, value))),
23
+ React.createElement(IconContainer, { active: canIncrement, onClick: function () { return (canIncrement ? onIncrement() : null); }, justify: "flex-end" },
24
+ React.createElement(Icon, { icon: Icons.PlusCircleLight, color: canIncrement ? Colors.Orange : Colors.Grey5 }))));
25
+ }
26
+ var templateObject_1, templateObject_2, templateObject_3;
27
+
28
+ export default Counter;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ export interface IDropdownItem {
3
+ text: string;
4
+ value: any;
5
+ icon?: React.ReactNode;
6
+ color?: string;
7
+ }
8
+ export declare enum DropdownTypes {
9
+ Regular = "Regular",
10
+ Small = "Small"
11
+ }
12
+ declare type DropdownProps = {
13
+ type?: DropdownTypes;
14
+ value?: string;
15
+ onChange: Function;
16
+ placeholder?: string;
17
+ width?: string;
18
+ items: IDropdownItem[];
19
+ label?: string;
20
+ tip?: string;
21
+ icon?: React.ReactNode;
22
+ };
23
+ declare const Dropdown: React.FC<DropdownProps>;
24
+ export default Dropdown;
@@ -0,0 +1,49 @@
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 { darken } from 'polished';
6
+ import Icon, { Icons } from './Icon.js';
7
+ import Label from './Label.js';
8
+ import Flex from './Flex.js';
9
+
10
+ var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: 65px;\n width: ", ";\n"], ["\n position: relative;\n height: 65px;\n width: ", ";\n"])), function (props) { return props.width; });
11
+ var FieldContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n height: ", ";\n width: ", ";\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 10px;\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 height: ", ";\n width: ", ";\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 10px;\n transition: all 0.2s;\n z-index: ", ";\n box-shadow: ",
12
+ ";\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.width; }, Colors.White, Colors.Grey5, function (props) { return (props.open ? 100 : 0); }, function (props) {
13
+ return props.open ? "0px 4px 16px rgba(0, 0, 0, 0.05)" : "";
14
+ }, darken(0.05, Colors.Grey5), Colors.Grey4);
15
+ 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: 38px;\n padding: 0 15px;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n height: 38px;\n padding: 0 15px;\n"])));
16
+ 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 font-weight: 500;\n margin-right: 10px;\n white-space: nowrap;\n"], ["\n font-size: 1.4rem;\n font-weight: 500;\n color: ", ";\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n margin-right: 10px;\n white-space: nowrap;\n"])), Colors.Grey1);
17
+ var ItemsContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n height: ", ";\n overflow: ", ";\n"], ["\n position: relative;\n height: ", ";\n overflow: ", ";\n"])), function (props) { return (props.open ? props.height : "0px"); }, function (props) { return (props.open ? "scroll" : "hidden"); });
18
+ 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: ",
19
+ ";\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.selected ? Colors.Grey7 : Colors.White;
21
+ }, Colors.Grey1, Colors.Grey7);
22
+ var DropdownTypes;
23
+ (function (DropdownTypes) {
24
+ DropdownTypes["Regular"] = "Regular";
25
+ DropdownTypes["Small"] = "Small";
26
+ })(DropdownTypes || (DropdownTypes = {}));
27
+ var Dropdown = function (_a) {
28
+ var
29
+ // type = DropdownTypes.Regular,
30
+ 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;
31
+ var _c = React.useState(false), open = _c[0], setOpen = _c[1];
32
+ return (React.createElement(Container, { width: width },
33
+ label && React.createElement(Label, { text: label, tip: tip }),
34
+ React.createElement(FieldContainer, { tabIndex: 1, open: open, height: items.length > 4 ? "163px" : items.length * 30 + 43 + "px", width: width, onClick: function () { return setOpen(!open); }, onBlur: function () { return setOpen(false); } },
35
+ React.createElement(TopRow, null,
36
+ React.createElement(Flex, { align: "center" },
37
+ icon && icon,
38
+ React.createElement(Value, null, value)),
39
+ React.createElement(Icon, { icon: Icons.Sort, size: 12, color: Colors.Grey1 })),
40
+ React.createElement(ItemsContainer, { open: open, height: items.length > 3 ? "120px" : items.length * 30 + "px" }, items === null || items === void 0 ? void 0 : items.map(function (item) {
41
+ return (React.createElement(Item, { key: item.value, selected: false, onClick: function () { return onChange(item.value); } },
42
+ item.icon && item.icon,
43
+ item.text));
44
+ })))));
45
+ };
46
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
47
+
48
+ export default Dropdown;
49
+ export { DropdownTypes };
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ declare type FlexProps = {
3
+ direction?: string;
4
+ justify?: string;
5
+ align?: string;
6
+ padding?: string;
7
+ margin?: string;
8
+ flex?: string;
9
+ height?: string;
10
+ };
11
+ declare const Flex: React.FC<FlexProps>;
12
+ export default Flex;
@@ -0,0 +1,12 @@
1
+ import { __makeTemplateObject } from '../_virtual/_tslib.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"], ["\n display: flex;\n flex-direction: ", ";\n justify-content: ", ";\n align-items: ", ";\n padding: ", ";\n margin: ", ";\n flex: ", ";\n height: ", ";\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; });
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;
8
+ return (React.createElement(Container, { direction: direction, justify: justify, align: align, padding: padding, margin: margin, flex: flex, height: height }, children));
9
+ };
10
+ var templateObject_1;
11
+
12
+ export default Flex;