@sellout/ui 0.0.5 → 0.0.7

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/index.js ADDED
@@ -0,0 +1,380 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var React = require('react');
8
+ var React__default = _interopDefault(React);
9
+ var styled = _interopDefault(require('styled-components'));
10
+ var Polished = require('polished');
11
+ var reactFontawesome = require('@fortawesome/react-fontawesome');
12
+ var proRegularSvgIcons = require('@fortawesome/pro-regular-svg-icons');
13
+ var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
14
+ var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
15
+ var proLightSvgIcons = require('@fortawesome/pro-light-svg-icons');
16
+ var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
17
+ var AnimateHeight = _interopDefault(require('react-animate-height'));
18
+
19
+ (function (Colors) {
20
+ Colors["White"] = "#FFFFFF";
21
+ Colors["OffWhite"] = "#FCFCFC";
22
+ Colors["Blue"] = "#020151";
23
+ Colors["Red"] = "#E63946";
24
+ Colors["Orange"] = "#FF700F";
25
+ Colors["DarkOrange"] = "#D65600";
26
+ Colors["Grey1"] = "#333333";
27
+ Colors["Grey2"] = "#4F4F4F";
28
+ Colors["Grey3"] = "#828282";
29
+ Colors["Grey4"] = "#BDBDBD";
30
+ Colors["Grey5"] = "#E0E0E0";
31
+ Colors["Grey6"] = "#F2F2F2";
32
+ })(exports.Colors || (exports.Colors = {}));
33
+
34
+ /*! *****************************************************************************
35
+ Copyright (c) Microsoft Corporation. All rights reserved.
36
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
37
+ this file except in compliance with the License. You may obtain a copy of the
38
+ License at http://www.apache.org/licenses/LICENSE-2.0
39
+
40
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
41
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
42
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
43
+ MERCHANTABLITY OR NON-INFRINGEMENT.
44
+
45
+ See the Apache Version 2.0 License for specific language governing permissions
46
+ and limitations under the License.
47
+ ***************************************************************************** */
48
+
49
+ function __makeTemplateObject(cooked, raw) {
50
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
51
+ return cooked;
52
+ }
53
+
54
+ var _a;
55
+ (function (LoaderSizes) {
56
+ LoaderSizes["VerySmall"] = "VerySmall";
57
+ LoaderSizes["Small"] = "Small";
58
+ LoaderSizes["Medium"] = "Medium";
59
+ LoaderSizes["Large"] = "Large";
60
+ })(exports.LoaderSizes || (exports.LoaderSizes = {}));
61
+ var LoaderSizesMap = (_a = {},
62
+ _a[exports.LoaderSizes.VerySmall] = 24,
63
+ _a[exports.LoaderSizes.Small] = 30,
64
+ _a[exports.LoaderSizes.Medium] = 40,
65
+ _a[exports.LoaderSizes.Large] = 60,
66
+ _a);
67
+ var scale = function (size, scale) { return size * scale + "px"; };
68
+ 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; });
69
+ function Loader(_a) {
70
+ var _b = _a.size, size = _b === void 0 ? exports.LoaderSizes.Medium : _b, _c = _a.color, color = _c === void 0 ? exports.Colors.White : _c;
71
+ return (React__default.createElement(StyledLoader, { size: LoaderSizesMap[size], color: color },
72
+ React__default.createElement("div", { className: "lds-ring" },
73
+ React__default.createElement("div", null),
74
+ React__default.createElement("div", null),
75
+ React__default.createElement("div", null))));
76
+ }
77
+ var templateObject_1;
78
+
79
+ (function (ButtonTypes) {
80
+ ButtonTypes["Submit"] = "Submit";
81
+ })(exports.ButtonTypes || (exports.ButtonTypes = {}));
82
+ (function (ButtonStates) {
83
+ ButtonStates["Active"] = "Active";
84
+ })(exports.ButtonStates || (exports.ButtonStates = {}));
85
+ var StyledButton = styled.div(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n position: relative;\n height: 40px;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n text-align: center;\n border-radius: 10px;\n transition: all 0.2s;\n margin: ", ";\n padding: ", ";\n background-color: ", ";\n\n &:hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ", ";\n }\n"], ["\n position: relative;\n height: 40px;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n text-align: center;\n border-radius: 10px;\n transition: all 0.2s;\n margin: ", ";\n padding: ", ";\n background-color: ",
86
+ ";\n\n &:hover {\n cursor: ", ";\n background-color: ",
87
+ ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ",
88
+ ";\n }\n"])), function (props) { return (Boolean(props.margin) ? props.margin : "0px"); }, function (props) { return (Boolean(props.padding) ? props.padding : "0px"); }, function (props) {
89
+ if (props.type === exports.ButtonTypes.Submit) {
90
+ return exports.Colors.Orange;
91
+ }
92
+ return null;
93
+ }, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
94
+ if (props.onClick && props.type === exports.ButtonTypes.Submit) {
95
+ return Polished.lighten(0.025, exports.Colors.Orange);
96
+ }
97
+ return null;
98
+ }, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
99
+ if (props.onClick && props.type === exports.ButtonTypes.Submit) {
100
+ return Polished.darken(0.025, exports.Colors.Orange);
101
+ }
102
+ return null;
103
+ });
104
+ var Text = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: 1.4rem;\n font-weight: 600;\n text-transform: uppercase;\n margin-left: ", ";\n color: ", ";\n"], ["\n font-size: 1.4rem;\n font-weight: 600;\n text-transform: uppercase;\n margin-left: ", ";\n color: ",
105
+ ";\n"])), function (props) { return (props.icon ? "10px" : 0); }, function (props) {
106
+ if (props.type === exports.ButtonTypes.Submit) {
107
+ return exports.Colors.White;
108
+ }
109
+ return null;
110
+ });
111
+ function Button(_a) {
112
+ var _b = _a.type, type = _b === void 0 ? exports.ButtonTypes.Submit : _b, _c = _a.state, state = _c === void 0 ? exports.ButtonStates.Active : _c, text = _a.text, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, icon = _a.icon, margin = _a.margin, padding = _a.padding, _e = _a.loading, loading = _e === void 0 ? false : _e;
113
+ return (React__default.createElement(StyledButton, { type: type, onClick: loading ? null : function () { return onClick(); }, margin: margin, padding: padding, state: state }, (function () {
114
+ return (React__default.createElement(React.Fragment, null, (function () {
115
+ if (loading) {
116
+ return React__default.createElement(Loader, { size: exports.LoaderSizes.VerySmall });
117
+ }
118
+ return (React__default.createElement(Text, { type: type, icon: Boolean(icon) }, text));
119
+ })()));
120
+ })()));
121
+ }
122
+ var templateObject_1$1, templateObject_2;
123
+
124
+ // import { library } from "@fortawesome/fontawesome-svg-core";
125
+ var IconEnum = {
126
+ AudienceRegular: proRegularSvgIcons.faUserFriends,
127
+ BoxOfficeRegular: proRegularSvgIcons.faCashRegister,
128
+ CalculatorRegular: proRegularSvgIcons.faCalculator,
129
+ CalendarStarRegular: proRegularSvgIcons.faCalendarStar,
130
+ Check: proRegularSvgIcons.faCheck,
131
+ Cheers: proRegularSvgIcons.faGlassCheers,
132
+ Clipboard: proRegularSvgIcons.faClipboardList,
133
+ CrownRegular: proRegularSvgIcons.faCrown,
134
+ DashboardRegular: proRegularSvgIcons.faTachometer,
135
+ DeleteRegular: proRegularSvgIcons.faTrash,
136
+ Dollar: proRegularSvgIcons.faDollarSign,
137
+ DownArrow: proRegularSvgIcons.faArrowAltDown,
138
+ DownloadReport: proRegularSvgIcons.faFileDownload,
139
+ Embed: proRegularSvgIcons.faCode,
140
+ Export: proRegularSvgIcons.faFileExport,
141
+ FeeRegular: proRegularSvgIcons.faUsdSquare,
142
+ FilterRegular: proRegularSvgIcons.faFilter,
143
+ GlobeRegular: proRegularSvgIcons.faGlobeAmericas,
144
+ GraphGrowth: proRegularSvgIcons.faChartLine,
145
+ KeyRegular: proRegularSvgIcons.faKeySkeleton,
146
+ LeftChevron: proRegularSvgIcons.faChevronLeft,
147
+ Link: proRegularSvgIcons.faLink,
148
+ MicrophoneRegular: proRegularSvgIcons.faMicrophoneAlt,
149
+ PrintRegular: proRegularSvgIcons.faPrint,
150
+ ReceiptRegular: proRegularSvgIcons.faReceipt,
151
+ ReportRegular: proRegularSvgIcons.faFileChartLine,
152
+ SearchRegular: proRegularSvgIcons.faSearch,
153
+ TicketRegular: proRegularSvgIcons.faTicketAlt,
154
+ Unlock: proRegularSvgIcons.faUnlock,
155
+ UpArrow: proRegularSvgIcons.faArrowAltUp,
156
+ UpgradeRegular: proRegularSvgIcons.faArrowAltSquareUp,
157
+ Upload: proRegularSvgIcons.faUpload,
158
+ UsersRegular: proRegularSvgIcons.faUsers,
159
+ VenueRegular: proRegularSvgIcons.faLandmark,
160
+ AudienceSolid: freeSolidSvgIcons.faUserFriends,
161
+ BackArrow: freeSolidSvgIcons.faArrowLeft,
162
+ Bold: freeSolidSvgIcons.faBold,
163
+ BoxOfficeSolid: freeSolidSvgIcons.faCashRegister,
164
+ Bullhorn: freeSolidSvgIcons.faBullhorn,
165
+ CalculatorSolid: freeSolidSvgIcons.faCalculator,
166
+ CalendarDaySolid: freeSolidSvgIcons.faCalendarDay,
167
+ Cancel: freeSolidSvgIcons.faTimes,
168
+ CancelCircle: freeSolidSvgIcons.faTimesCircle,
169
+ CaretDown: freeSolidSvgIcons.faCaretDown,
170
+ Cash: freeSolidSvgIcons.faMoneyBill,
171
+ CheckCircle: freeSolidSvgIcons.faCheckCircle,
172
+ CopySolid: freeSolidSvgIcons.faCopy,
173
+ CreditCardBack: freeSolidSvgIcons.faCreditCard,
174
+ CrownSolid: freeSolidSvgIcons.faCrown,
175
+ Cursor: freeSolidSvgIcons.faICursor,
176
+ DeleteSolid: freeSolidSvgIcons.faTrash,
177
+ EnvelopeSolid: freeSolidSvgIcons.faEnvelope,
178
+ EyeSolid: freeSolidSvgIcons.faEye,
179
+ HelpSolid: freeSolidSvgIcons.faQuestionCircle,
180
+ Italic: freeSolidSvgIcons.faItalic,
181
+ MicrophoneSolid: freeSolidSvgIcons.faMicrophoneAlt,
182
+ Mobile: freeSolidSvgIcons.faMobileAlt,
183
+ PlusCircle: freeSolidSvgIcons.faPlusCircle,
184
+ PrintSolid: freeSolidSvgIcons.faPrint,
185
+ ReceiptSolid: freeSolidSvgIcons.faReceipt,
186
+ RightChevronCircle: freeSolidSvgIcons.faChevronCircleRight,
187
+ SearchSolid: freeSolidSvgIcons.faSearch,
188
+ Sort: freeSolidSvgIcons.faSort,
189
+ TicketSolid: freeSolidSvgIcons.faTicketAlt,
190
+ Underline: freeSolidSvgIcons.faUnderline,
191
+ UserCircle: freeSolidSvgIcons.faUserCircle,
192
+ UserSolid: freeSolidSvgIcons.faUser,
193
+ UsersSolid: freeSolidSvgIcons.faUsers,
194
+ VenueSolid: freeSolidSvgIcons.faLandmark,
195
+ Warning: freeSolidSvgIcons.faExclamationTriangle,
196
+ Calendar: freeRegularSvgIcons.faCalendarAlt,
197
+ Clock: freeRegularSvgIcons.faClock,
198
+ CopyRegular: freeRegularSvgIcons.faCopy,
199
+ Edit: freeRegularSvgIcons.faEdit,
200
+ EyeRegular: freeRegularSvgIcons.faEye,
201
+ EyeSlashRegular: freeRegularSvgIcons.faEyeSlash,
202
+ HelpRegular: freeRegularSvgIcons.faQuestionCircle,
203
+ SadTear: freeRegularSvgIcons.faSadTear,
204
+ UserRegular: freeRegularSvgIcons.faUser,
205
+ CalendarDayLight: proLightSvgIcons.faCalendarDay,
206
+ mapPinLight: proLightSvgIcons.faMapMarkerAlt,
207
+ MinusCircleLight: proLightSvgIcons.faMinusCircle,
208
+ PlusCircleLight: proLightSvgIcons.faPlusCircle,
209
+ CalendarStarSolid: proSolidSvgIcons.faCalendarStar,
210
+ CreditCardFront: proSolidSvgIcons.faCreditCardFront,
211
+ DashboardSolid: proSolidSvgIcons.faTachometer,
212
+ FeeSolid: proSolidSvgIcons.faUsdSquare,
213
+ KeySolid: proSolidSvgIcons.faKeySkeleton,
214
+ LongRightArrow: proSolidSvgIcons.faLongArrowRight,
215
+ ReportSolid: proSolidSvgIcons.faFileChartLine,
216
+ SortBy: proSolidSvgIcons.faSortAlt,
217
+ UpgradeSolid: proSolidSvgIcons.faArrowAltSquareUp,
218
+ };
219
+
220
+ var Icons = IconEnum;
221
+ function Icon(_a) {
222
+ var _b = _a.icon, icon = _b === void 0 ? Icons.AudienceRegular : _b, _c = _a.color, color = _c === void 0 ? exports.Colors.Orange : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 20 : _e, top = _a.top, left = _a.left, right = _a.right, _f = _a.position, position = _f === void 0 ? 'relative' : _f, zIndex = _a.zIndex;
223
+ return (React__default.createElement(reactFontawesome.FontAwesomeIcon, { icon: icon, onClick: onClick, style: {
224
+ color: color,
225
+ top: top,
226
+ left: left,
227
+ right: right,
228
+ position: position,
229
+ zIndex: zIndex,
230
+ fontSize: size,
231
+ transition: "all 0.2s"
232
+ } }));
233
+ }
234
+
235
+ var Container = styled.div(templateObject_1$2 || (templateObject_1$2 = __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"])));
236
+ var IconContainer = styled.div(templateObject_2$1 || (templateObject_2$1 = __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: ",
237
+ " !important;\n }\n"])), function (props) { return props.justify; }, function (props) { return (props.active ? "pointer" : null); }, function (props) {
238
+ return props.active ? Polished.lighten(0.025, exports.Colors.Orange) : null;
239
+ });
240
+ 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"])), exports.Colors.Grey1);
241
+ function Counter(_a) {
242
+ var value = _a.value, maxValue = _a.maxValue, _b = _a.minValue, minValue = _b === void 0 ? 0 : _b, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement;
243
+ var canDecrement = value > minValue;
244
+ var canIncrement = Boolean(!Boolean(maxValue) || (maxValue && value < maxValue));
245
+ return (React__default.createElement(Container, null,
246
+ React__default.createElement(IconContainer, { active: canDecrement, onClick: function () { return (canDecrement ? onDecrement() : null); }, justify: "flex-start" },
247
+ React__default.createElement(Icon, { icon: Icons.MinusCircleLight, color: canDecrement ? exports.Colors.Orange : exports.Colors.Grey5 })),
248
+ React__default.createElement(Value, null, value),
249
+ React__default.createElement(IconContainer, { active: canIncrement, onClick: function () { return (canIncrement ? onIncrement() : null); }, justify: "flex-end" },
250
+ React__default.createElement(Icon, { icon: Icons.PlusCircleLight, color: canIncrement ? exports.Colors.Orange : exports.Colors.Grey5 }))));
251
+ }
252
+ var templateObject_1$2, templateObject_2$1, templateObject_3;
253
+
254
+ var Form = styled.form(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\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 display: flex;\n flex-direction: row;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ",
255
+ ";\n"])), function (props) {
256
+ if (props.focused)
257
+ return exports.Colors.Grey3;
258
+ if (props.hovered)
259
+ return exports.Colors.Grey4;
260
+ return exports.Colors.Grey5;
261
+ });
262
+ var Button$1 = styled.div(templateObject_2$2 || (templateObject_2$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: ",
263
+ ";\n\n &:hover {\n cursor: ", ";\n background-color: ",
264
+ ";\n }\n\n &:active {\n cursor: ", ";\n background-color: ",
265
+ ";\n }\n"])), exports.Colors.White, function (props) {
266
+ return props.canSubmit ? exports.Colors.Orange : exports.Colors.Grey6;
267
+ }, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
268
+ return props.canSubmit ? Polished.lighten(0.025, exports.Colors.Orange) : null;
269
+ }, function (props) { return (props.onClick ? "pointer" : null); }, function (props) {
270
+ return props.canSubmit ? Polished.darken(0.025, exports.Colors.Orange) : null;
271
+ });
272
+ var LeftContainer = styled.div(templateObject_3$1 || (templateObject_3$1 = __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"])));
273
+ 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); });
274
+ var Spacer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 50px;\n"], ["\n width: 50px;\n"])));
275
+ 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"])), exports.Colors.White, exports.Colors.Grey1, function (props) { return props.margin; }, function (props) { return props.padding; }, exports.Colors.Grey4);
276
+ function Input(_a) {
277
+ var 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;
278
+ var _d = React.useState(false), hovered = _d[0], setHovered = _d[1];
279
+ var _e = React.useState(false), focused = _e[0], setFocused = _e[1];
280
+ var submit = function (event) {
281
+ event.preventDefault();
282
+ if (onSubmit && canSubmit && !loading) {
283
+ onSubmit();
284
+ }
285
+ };
286
+ return (React__default.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); } },
287
+ icon && (React__default.createElement(LeftContainer, null,
288
+ React__default.createElement(Icon, { icon: icon, size: 16, color: focused ? exports.Colors.Grey1 : exports.Colors.Grey4 }))),
289
+ React__default.createElement(InputStyled, { autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: onChange, onFocus: function (event) {
290
+ setFocused(true);
291
+ if (onFocus)
292
+ onFocus(event);
293
+ }, onBlur: function (event) {
294
+ setFocused(false);
295
+ if (onFocus)
296
+ onBlur(event);
297
+ }, onMouseEnter: function (event) {
298
+ setHovered(true);
299
+ if (onMouseEnter)
300
+ onMouseEnter(event);
301
+ }, onMouseLeave: function (event) {
302
+ setHovered(false);
303
+ if (onMouseLeave)
304
+ onMouseLeave(event);
305
+ }, margin: margin, padding: padding }),
306
+ (function () {
307
+ if (onSubmit) {
308
+ return (React__default.createElement(React.Fragment, null,
309
+ React__default.createElement(Spacer, null),
310
+ React__default.createElement(Button$1, { canSubmit: canSubmit, onClick: function (event) { return submit(event); } }, (function () {
311
+ if (loading) {
312
+ return React__default.createElement(Loader, { size: exports.LoaderSizes.VerySmall });
313
+ }
314
+ return (React__default.createElement(Icon, { icon: Icons.RightChevronCircle, color: canSubmit ? exports.Colors.White : exports.Colors.Grey4, size: 16 }));
315
+ })())));
316
+ }
317
+ if (Boolean(value) && onClear) {
318
+ return (React__default.createElement(React.Fragment, null,
319
+ React__default.createElement(Spacer, null),
320
+ React__default.createElement(RightContainer, { onClick: function () { return onClear(); } },
321
+ React__default.createElement(Icon, { icon: Icons.CancelCircle, color: exports.Colors.Grey3, size: 16 }))));
322
+ }
323
+ return React__default.createElement(Spacer, null);
324
+ })()));
325
+ }
326
+ var templateObject_1$3, templateObject_2$2, templateObject_3$1, templateObject_4, templateObject_5, templateObject_6;
327
+
328
+ var Row = styled.div(templateObject_1$4 || (templateObject_1$4 = __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; });
329
+ var Column = styled.div(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
330
+ var Container$1 = styled.div(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n background-color: ", ";\n padding: 15px;\n"], ["\n background-color: ", ";\n padding: 15px;\n"])), exports.Colors.White);
331
+ var Title = styled.div(templateObject_4$1 || (templateObject_4$1 = __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"])), exports.Colors.Grey1);
332
+ var Price = styled.div(templateObject_5$1 || (templateObject_5$1 = __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"])), exports.Colors.Grey2);
333
+ var Subtitle = styled.div(templateObject_6$1 || (templateObject_6$1 = __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"])), exports.Colors.Grey3);
334
+ 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"])), exports.Colors.Grey2);
335
+ 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; });
336
+ 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"])), exports.Colors.Orange, Polished.lighten(0.025, exports.Colors.Orange), Polished.darken(0.025, exports.Colors.Orange));
337
+ function Product(_a) {
338
+ 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,
339
+ // Counter Props
340
+ value = _a.value, minValue = _a.minValue, maxValue = _a.maxValue, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement;
341
+ var _f = React.useState(false), showMore = _f[0], setShowMore = _f[1];
342
+ var _g = React.useState(true), showEllipsis = _g[0], setShowEllipsis = _g[1];
343
+ var descModified = description;
344
+ if (descModified.length > 210 && !showMore) {
345
+ descModified = descModified.substring(0, 210) + '...';
346
+ }
347
+ var toggle = function () {
348
+ setShowEllipsis(!showEllipsis);
349
+ setShowMore(!showMore);
350
+ };
351
+ return (React__default.createElement(Container$1, null,
352
+ React__default.createElement(Row, { justify: "space-between" },
353
+ React__default.createElement(Column, null,
354
+ React__default.createElement(Title, null, title),
355
+ React__default.createElement(Price, null,
356
+ "$",
357
+ price)),
358
+ React__default.createElement(Counter, { value: value, minValue: minValue, maxValue: maxValue, onIncrement: onIncrement, onDecrement: onDecrement })),
359
+ React__default.createElement(Row, null, subtitle && React__default.createElement(Subtitle, null, subtitle)),
360
+ (function () {
361
+ if (!description)
362
+ return;
363
+ return (React__default.createElement(React.Fragment, null,
364
+ React__default.createElement(AnimateHeight, { height: showMore ? "auto" : 67 },
365
+ React__default.createElement(Ellipsis, { active: showEllipsis },
366
+ React__default.createElement(Description, null, description))),
367
+ React__default.createElement(ShowMore, { onClick: function () { return toggle(); } }, showMore ? "Show Less" : "Show More")));
368
+ })()));
369
+ }
370
+ var templateObject_1$4, templateObject_2$3, templateObject_3$2, templateObject_4$1, templateObject_5$1, templateObject_6$1, templateObject_7, templateObject_8, templateObject_9;
371
+
372
+ var Icons$1 = IconEnum;
373
+
374
+ exports.Button = Button;
375
+ exports.Counter = Counter;
376
+ exports.Icon = Icon;
377
+ exports.Icons = Icons$1;
378
+ exports.Input = Input;
379
+ exports.Loader = Loader;
380
+ exports.Product = Product;
package/package.json CHANGED
@@ -1,7 +1,22 @@
1
1
  {
2
2
  "name": "@sellout/ui",
3
- "version": "0.0.5",
4
- "dependencies": {
3
+ "version": "0.0.7",
4
+ "main": "build/index.js",
5
+ "module": "build/index.es.js",
6
+ "jsnext:main": "build/index.es.js",
7
+ "scripts": {
8
+ "prepare": "npm run build",
9
+ "build": "rollup -c",
10
+ "start": "rollup -c -w",
11
+ "test": "jest --coverage",
12
+ "storybook": "start-storybook -p 9009 -s public",
13
+ "build-storybook": "build-storybook -s public"
14
+ },
15
+ "keywords": [],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "@babel/core": "^7.7.7",
5
20
  "@fortawesome/fontawesome-svg-core": "^1.2.27",
6
21
  "@fortawesome/free-regular-svg-icons": "^5.12.1",
7
22
  "@fortawesome/free-solid-svg-icons": "^5.12.1",
@@ -9,55 +24,58 @@
9
24
  "@fortawesome/pro-regular-svg-icons": "^5.12.1",
10
25
  "@fortawesome/pro-solid-svg-icons": "^5.12.1",
11
26
  "@fortawesome/react-fontawesome": "^0.1.9",
12
- "@rehooks/component-size": "^1.0.3",
13
- "@sellout/utils": "^0.0.5",
27
+ "@sellout/utils": "^0.0.7",
28
+ "@storybook/addon-actions": "^5.3.17",
29
+ "@storybook/addon-links": "^5.3.17",
30
+ "@storybook/react": "^5.2.8",
14
31
  "@testing-library/jest-dom": "^4.2.4",
15
- "@testing-library/react": "^9.5.0",
32
+ "@testing-library/react": "^9.4.0",
16
33
  "@testing-library/user-event": "^7.2.1",
17
- "@types/jest": "^24.9.1",
18
- "@types/node": "^12.12.30",
19
- "@types/react": "^16.9.23",
20
- "@types/react-dom": "^16.9.5",
34
+ "@types/jest": "^24.0.24",
35
+ "@types/react": "^16.9.17",
36
+ "@types/react-dom": "^16.9.4",
37
+ "@types/styled-components": "^5.0.1",
38
+ "awesome-typescript-loader": "^5.2.1",
39
+ "babel-loader": "^8.0.6",
40
+ "jest": "^24.9.0",
21
41
  "polished": "^3.4.4",
22
42
  "react": "^16.13.0",
23
43
  "react-animate-height": "^2.0.20",
24
44
  "react-dom": "^16.13.0",
25
- "react-scripts": "3.4.0",
26
- "styled-components": "^5.0.1",
45
+ "rollup": "^1.27.13",
46
+ "rollup-plugin-commonjs": "^10.1.0",
47
+ "rollup-plugin-node-resolve": "^5.2.0",
48
+ "rollup-plugin-peer-deps-external": "^2.2.0",
49
+ "rollup-plugin-typescript2": "^0.25.3",
50
+ "standard": "^14.3.1",
51
+ "ts-jest": "^24.2.0",
27
52
  "typescript": "^3.7.5"
28
53
  },
29
- "scripts": {
30
- "prepare": "npm run build",
31
- "start": "react-scripts start",
32
- "build": "react-scripts build",
33
- "test": "react-scripts test",
34
- "eject": "react-scripts eject",
35
- "storybook": "start-storybook -p 9009 -s public",
36
- "build-storybook": "build-storybook -s public"
54
+ "gitHead": "991f3c469d9cd9754715c231b3c5cc7b7b6bfaf5",
55
+ "peerDependencies": {
56
+ "react": "^16",
57
+ "react-dom": "^16",
58
+ "styled-components": "^5.0.1"
37
59
  },
38
- "eslintConfig": {
39
- "extends": "react-app"
60
+ "jest": {
61
+ "preset": "ts-jest",
62
+ "testEnvironment": "jsdom",
63
+ "testPathIgnorePatterns": [
64
+ "build/"
65
+ ]
40
66
  },
41
- "browserslist": {
42
- "production": [
43
- ">0.2%",
44
- "not dead",
45
- "not op_mini all"
67
+ "standard": {
68
+ "ignore": [
69
+ "node_modules/",
70
+ "build/"
46
71
  ],
47
- "development": [
48
- "last 1 chrome version",
49
- "last 1 firefox version",
50
- "last 1 safari version"
72
+ "globals": [
73
+ "describe",
74
+ "it",
75
+ "test",
76
+ "expect",
77
+ "afterAll",
78
+ "jest"
51
79
  ]
52
- },
53
- "devDependencies": {
54
- "@storybook/addon-actions": "^5.3.17",
55
- "@storybook/addon-links": "^5.3.17",
56
- "@storybook/addons": "^5.3.17",
57
- "@storybook/preset-create-react-app": "^2.0.0",
58
- "@storybook/react": "^5.3.17",
59
- "@types/styled-components": "^5.0.1",
60
- "csvtojson": "^2.0.10"
61
- },
62
- "gitHead": "5af90cec2aeb461ce24ab03508bd8cb705de8ae3"
80
+ }
63
81
  }
@@ -0,0 +1,18 @@
1
+ import typescript from "rollup-plugin-typescript2";
2
+ import pkg from "./package.json";
3
+
4
+ export default [
5
+ {
6
+ input: "src/index.ts",
7
+ external: Object.keys(pkg.peerDependencies || {}),
8
+ plugins: [
9
+ typescript({
10
+ typescript: require("typescript")
11
+ })
12
+ ],
13
+ output: [
14
+ { file: pkg.main, format: "cjs" },
15
+ { file: pkg.module, format: "esm" },
16
+ ]
17
+ }
18
+ ];
package/src/Colors.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export enum Colors {
2
2
  White = "#FFFFFF",
3
+ OffWhite = '#FCFCFC',
4
+ Blue = '#020151',
3
5
  Red = "#E63946",
4
6
  Orange = "#FF700F",
5
7
  DarkOrange = "#D65600",
@@ -38,6 +38,7 @@ const StyledButton = styled.div<StyledButtonProps>`
38
38
  if (props.type === ButtonTypes.Submit) {
39
39
  return Colors.Orange;
40
40
  }
41
+ return null;
41
42
  }};
42
43
 
43
44
  &:hover {
@@ -46,6 +47,7 @@ const StyledButton = styled.div<StyledButtonProps>`
46
47
  if (props.onClick && props.type === ButtonTypes.Submit) {
47
48
  return Polished.lighten(0.025, Colors.Orange);
48
49
  }
50
+ return null;
49
51
  }};
50
52
  }
51
53
 
@@ -55,6 +57,7 @@ const StyledButton = styled.div<StyledButtonProps>`
55
57
  if (props.onClick && props.type === ButtonTypes.Submit) {
56
58
  return Polished.darken(0.025, Colors.Orange);
57
59
  }
60
+ return null;
58
61
  }};
59
62
  }
60
63
  `;
@@ -73,6 +76,7 @@ const Text = styled.span<TextProps>`
73
76
  if (props.type === ButtonTypes.Submit) {
74
77
  return Colors.White;
75
78
  }
79
+ return null;
76
80
  }};
77
81
  `;
78
82
 
@@ -7,7 +7,7 @@ export const Icons = IconEnum;
7
7
 
8
8
  export type IconProps = {
9
9
  icon: any;
10
- color?: Colors | null;
10
+ color?: Colors | string | null;
11
11
  onClick?: any | null;
12
12
  size?: string | number | undefined;
13
13
  position?: string;
@@ -1,5 +1,5 @@
1
1
  import React, { Fragment, useState } from "react";
2
- import styled from 'styled-components';
2
+ import styled from "styled-components";
3
3
  import * as Polished from 'polished';
4
4
  import { Colors } from "../Colors";
5
5
  import Icon, { Icons } from './Icon'
@@ -4,7 +4,7 @@ import * as Polished from "polished";
4
4
  import AnimateHeight from "react-animate-height";
5
5
  import { Colors } from "../Colors";
6
6
  import Counter, { CounterProps } from './Counter';
7
- import * as PriceUtil from '@sellout/utils/.dist/price';
7
+ // import * as PriceUtil from '@sellout/utils/.dist/price';
8
8
  // import Icon from "./Icon";
9
9
 
10
10
  type RowProps = {
@@ -124,7 +124,7 @@ export default function Product({
124
124
  <Row justify="space-between">
125
125
  <Column>
126
126
  <Title>{title}</Title>
127
- <Price>{PriceUtil.output(price)}</Price>
127
+ <Price>${price}</Price>
128
128
  </Column>
129
129
  <Counter
130
130
  value={value}
@@ -136,23 +136,23 @@ export default function Product({
136
136
  </Row>
137
137
  <Row>
138
138
  {subtitle && <Subtitle>{subtitle}</Subtitle>}
139
- {(() => {
140
- if (!description) return;
141
-
142
- return (
143
- <Fragment>
144
- <AnimateHeight height={showMore ? "auto" : 67}>
145
- <Ellipsis active={showEllipsis}>
146
- <Description>{description}</Description>
147
- </Ellipsis>
148
- </AnimateHeight>
149
- <ShowMore onClick={() => toggle()}>
150
- {showMore ? "Show Less" : "Show More"}
151
- </ShowMore>
152
- </Fragment>
153
- );
154
- })()}
155
139
  </Row>
140
+ {(() => {
141
+ if (!description) return;
142
+
143
+ return (
144
+ <Fragment>
145
+ <AnimateHeight height={showMore ? "auto" : 67}>
146
+ <Ellipsis active={showEllipsis}>
147
+ <Description>{description}</Description>
148
+ </Ellipsis>
149
+ </AnimateHeight>
150
+ <ShowMore onClick={() => toggle()}>
151
+ {showMore ? "Show Less" : "Show More"}
152
+ </ShowMore>
153
+ </Fragment>
154
+ );
155
+ })()}
156
156
  </Container>
157
157
  );
158
158
  }