@sellout/ui 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/Colors.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export declare enum Colors {
2
2
  White = "#FFFFFF",
3
+ Black = "#000000",
4
+ Green = "#419D78",
3
5
  OffWhite = "#FCFCFC",
4
6
  Blue = "#020151",
5
7
  Red = "#E63946",
@@ -10,5 +12,6 @@ export declare enum Colors {
10
12
  Grey3 = "#828282",
11
13
  Grey4 = "#BDBDBD",
12
14
  Grey5 = "#E0E0E0",
13
- Grey6 = "#F2F2F2"
15
+ Grey6 = "#F2F2F2",
16
+ Grey7 = "F8F8F8"
14
17
  }
@@ -1,10 +1,11 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  export declare type InputProps = {
3
+ inputRef?: React.Ref<HTMLInputElement>;
3
4
  autoFocus?: boolean | undefined;
4
5
  placeholder?: string;
5
6
  value: string;
6
7
  defaultValue?: string;
7
- icon?: string;
8
+ icon?: any;
8
9
  type?: string;
9
10
  onMouseEnter?: any;
10
11
  onMouseLeave?: any;
@@ -17,5 +18,6 @@ export declare type InputProps = {
17
18
  loading?: boolean;
18
19
  margin?: string;
19
20
  padding?: string;
21
+ width?: string;
20
22
  };
21
- export default function Input({ autoFocus, placeholder, value, defaultValue, icon, type, onMouseEnter, onMouseLeave, onChange, onFocus, onBlur, onSubmit, onClear, canSubmit, loading, margin, padding, }: InputProps): JSX.Element;
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;
package/build/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import Icon from "./components/Icon";
5
5
  import Input from "./components/Input";
6
6
  import Loader, { LoaderSizes } from "./components/Loader";
7
7
  import Product from "./components/Product";
8
+ import makeEventHandler from './utils/makeEventHandler';
8
9
  declare const Icons: {
9
10
  AudienceRegular: import("@fortawesome/fontawesome-common-types").IconDefinition;
10
11
  BoxOfficeRegular: import("@fortawesome/fontawesome-common-types").IconDefinition;
@@ -99,4 +100,4 @@ declare const Icons: {
99
100
  SortBy: import("@fortawesome/fontawesome-common-types").IconDefinition;
100
101
  UpgradeSolid: import("@fortawesome/fontawesome-common-types").IconDefinition;
101
102
  };
102
- export { Colors, Button, ButtonTypes, ButtonStates, Counter, Icon, Icons, Input, Loader, LoaderSizes, Product, };
103
+ export { Colors, Button, ButtonTypes, ButtonStates, Counter, Icon, Icons, Input, Loader, LoaderSizes, Product, makeEventHandler };
package/build/index.es.js CHANGED
@@ -8,10 +8,13 @@ import { faCalendarAlt, faClock, faCopy as faCopy$1, faEdit, faEye as faEye$1, f
8
8
  import { faCalendarDay as faCalendarDay$1, faMapMarkerAlt, faMinusCircle, faPlusCircle as faPlusCircle$1 } from '@fortawesome/pro-light-svg-icons';
9
9
  import { faCalendarStar as faCalendarStar$1, faCreditCardFront, faTachometer as faTachometer$1, faUsdSquare as faUsdSquare$1, faKeySkeleton as faKeySkeleton$1, faLongArrowRight, faFileChartLine as faFileChartLine$1, faSortAlt, faArrowAltSquareUp as faArrowAltSquareUp$1 } from '@fortawesome/pro-solid-svg-icons';
10
10
  import AnimateHeight from 'react-animate-height';
11
+ import { output } from '@sellout/utils/.dist/price';
11
12
 
12
13
  var Colors;
13
14
  (function (Colors) {
14
15
  Colors["White"] = "#FFFFFF";
16
+ Colors["Black"] = "#000000";
17
+ Colors["Green"] = "#419D78";
15
18
  Colors["OffWhite"] = "#FCFCFC";
16
19
  Colors["Blue"] = "#020151";
17
20
  Colors["Red"] = "#E63946";
@@ -23,6 +26,7 @@ var Colors;
23
26
  Colors["Grey4"] = "#BDBDBD";
24
27
  Colors["Grey5"] = "#E0E0E0";
25
28
  Colors["Grey6"] = "#F2F2F2";
29
+ Colors["Grey7"] = "F8F8F8";
26
30
  })(Colors || (Colors = {}));
27
31
 
28
32
  /*! *****************************************************************************
@@ -249,8 +253,8 @@ function Counter(_a) {
249
253
  }
250
254
  var templateObject_1$2, templateObject_2$1, templateObject_3;
251
255
 
252
- 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 ",
253
- ";\n"])), function (props) {
256
+ var Form = styled.form(templateObject_1$3 || (templateObject_1$3 = __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 ",
257
+ ";\n"])), function (props) { return props.width; }, function (props) {
254
258
  if (props.focused)
255
259
  return Colors.Grey3;
256
260
  if (props.hovered)
@@ -272,7 +276,7 @@ var RightContainer = styled.div(templateObject_4 || (templateObject_4 = __makeTe
272
276
  var Spacer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 50px;\n"], ["\n width: 50px;\n"])));
273
277
  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);
274
278
  function Input(_a) {
275
- 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;
279
+ 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;
276
280
  var _d = useState(false), hovered = _d[0], setHovered = _d[1];
277
281
  var _e = useState(false), focused = _e[0], setFocused = _e[1];
278
282
  var submit = function (event) {
@@ -281,10 +285,10 @@ function Input(_a) {
281
285
  onSubmit();
282
286
  }
283
287
  };
284
- return (React.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); } },
288
+ return (React.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); }, width: width },
285
289
  icon && (React.createElement(LeftContainer, null,
286
290
  React.createElement(Icon, { icon: icon, size: 16, color: focused ? Colors.Grey1 : Colors.Grey4 }))),
287
- React.createElement(InputStyled, { autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: onChange, onFocus: function (event) {
291
+ React.createElement(InputStyled, { ref: inputRef, autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: onChange, onFocus: function (event) {
288
292
  setFocused(true);
289
293
  if (onFocus)
290
294
  onFocus(event);
@@ -325,7 +329,7 @@ var templateObject_1$3, templateObject_2$2, templateObject_3$1, templateObject_4
325
329
 
326
330
  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; });
327
331
  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"])));
328
- 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"])), Colors.White);
332
+ var Container$1 = styled.div(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n background-color: ", ";\n padding: 15px;\n border-bottom: 1px solid ", ";\n"], ["\n background-color: ", ";\n padding: 15px;\n border-bottom: 1px solid ", ";\n"])), Colors.White, Colors.Grey6);
329
333
  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"])), Colors.Grey1);
330
334
  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"])), Colors.Grey2);
331
335
  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"])), Colors.Grey3);
@@ -352,7 +356,7 @@ function Product(_a) {
352
356
  React.createElement(Title, null, title),
353
357
  React.createElement(Price, null,
354
358
  "$",
355
- price)),
359
+ output(price))),
356
360
  React.createElement(Counter, { value: value, minValue: minValue, maxValue: maxValue, onIncrement: onIncrement, onDecrement: onDecrement })),
357
361
  React.createElement(Row, null, subtitle && React.createElement(Subtitle, null, subtitle)),
358
362
  (function () {
@@ -367,6 +371,16 @@ function Product(_a) {
367
371
  }
368
372
  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;
369
373
 
374
+ function makeEventHandler(executeOnEvent) {
375
+ if (executeOnEvent === void 0) { executeOnEvent = function () { }; }
376
+ return function (eventHandler) {
377
+ return function (event) {
378
+ executeOnEvent();
379
+ eventHandler(event.currentTarget.value);
380
+ };
381
+ };
382
+ }
383
+
370
384
  var Icons$1 = IconEnum;
371
385
 
372
- export { Button, ButtonStates, ButtonTypes, Colors, Counter, Icon, Icons$1 as Icons, Input, Loader, LoaderSizes, Product };
386
+ export { Button, ButtonStates, ButtonTypes, Colors, Counter, Icon, Icons$1 as Icons, Input, Loader, LoaderSizes, Product, makeEventHandler };
package/build/index.js CHANGED
@@ -15,9 +15,12 @@ var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
15
15
  var proLightSvgIcons = require('@fortawesome/pro-light-svg-icons');
16
16
  var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
17
17
  var AnimateHeight = _interopDefault(require('react-animate-height'));
18
+ var PriceUtil = require('@sellout/utils/.dist/price');
18
19
 
19
20
  (function (Colors) {
20
21
  Colors["White"] = "#FFFFFF";
22
+ Colors["Black"] = "#000000";
23
+ Colors["Green"] = "#419D78";
21
24
  Colors["OffWhite"] = "#FCFCFC";
22
25
  Colors["Blue"] = "#020151";
23
26
  Colors["Red"] = "#E63946";
@@ -29,6 +32,7 @@ var AnimateHeight = _interopDefault(require('react-animate-height'));
29
32
  Colors["Grey4"] = "#BDBDBD";
30
33
  Colors["Grey5"] = "#E0E0E0";
31
34
  Colors["Grey6"] = "#F2F2F2";
35
+ Colors["Grey7"] = "F8F8F8";
32
36
  })(exports.Colors || (exports.Colors = {}));
33
37
 
34
38
  /*! *****************************************************************************
@@ -251,8 +255,8 @@ function Counter(_a) {
251
255
  }
252
256
  var templateObject_1$2, templateObject_2$1, templateObject_3;
253
257
 
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) {
258
+ var Form = styled.form(templateObject_1$3 || (templateObject_1$3 = __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 ",
259
+ ";\n"])), function (props) { return props.width; }, function (props) {
256
260
  if (props.focused)
257
261
  return exports.Colors.Grey3;
258
262
  if (props.hovered)
@@ -274,7 +278,7 @@ var RightContainer = styled.div(templateObject_4 || (templateObject_4 = __makeTe
274
278
  var Spacer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 50px;\n"], ["\n width: 50px;\n"])));
275
279
  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
280
  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;
281
+ 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;
278
282
  var _d = React.useState(false), hovered = _d[0], setHovered = _d[1];
279
283
  var _e = React.useState(false), focused = _e[0], setFocused = _e[1];
280
284
  var submit = function (event) {
@@ -283,10 +287,10 @@ function Input(_a) {
283
287
  onSubmit();
284
288
  }
285
289
  };
286
- return (React__default.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); } },
290
+ return (React__default.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); }, width: width },
287
291
  icon && (React__default.createElement(LeftContainer, null,
288
292
  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) {
293
+ React__default.createElement(InputStyled, { ref: inputRef, autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: onChange, onFocus: function (event) {
290
294
  setFocused(true);
291
295
  if (onFocus)
292
296
  onFocus(event);
@@ -327,7 +331,7 @@ var templateObject_1$3, templateObject_2$2, templateObject_3$1, templateObject_4
327
331
 
328
332
  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
333
  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);
334
+ var Container$1 = styled.div(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n background-color: ", ";\n padding: 15px;\n border-bottom: 1px solid ", ";\n"], ["\n background-color: ", ";\n padding: 15px;\n border-bottom: 1px solid ", ";\n"])), exports.Colors.White, exports.Colors.Grey6);
331
335
  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
336
  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
337
  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);
@@ -354,7 +358,7 @@ function Product(_a) {
354
358
  React__default.createElement(Title, null, title),
355
359
  React__default.createElement(Price, null,
356
360
  "$",
357
- price)),
361
+ PriceUtil.output(price))),
358
362
  React__default.createElement(Counter, { value: value, minValue: minValue, maxValue: maxValue, onIncrement: onIncrement, onDecrement: onDecrement })),
359
363
  React__default.createElement(Row, null, subtitle && React__default.createElement(Subtitle, null, subtitle)),
360
364
  (function () {
@@ -369,6 +373,16 @@ function Product(_a) {
369
373
  }
370
374
  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
375
 
376
+ function makeEventHandler(executeOnEvent) {
377
+ if (executeOnEvent === void 0) { executeOnEvent = function () { }; }
378
+ return function (eventHandler) {
379
+ return function (event) {
380
+ executeOnEvent();
381
+ eventHandler(event.currentTarget.value);
382
+ };
383
+ };
384
+ }
385
+
372
386
  var Icons$1 = IconEnum;
373
387
 
374
388
  exports.Button = Button;
@@ -378,3 +392,4 @@ exports.Icons = Icons$1;
378
392
  exports.Input = Input;
379
393
  exports.Loader = Loader;
380
394
  exports.Product = Product;
395
+ exports.makeEventHandler = makeEventHandler;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function makeEventHandler(executeOnEvent?: Function): (eventHandler: Function) => (event: import("react").FormEvent<HTMLInputElement>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellout/ui",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.es.js",
6
6
  "jsnext:main": "build/index.es.js",
@@ -24,10 +24,7 @@
24
24
  "@fortawesome/pro-regular-svg-icons": "^5.12.1",
25
25
  "@fortawesome/pro-solid-svg-icons": "^5.12.1",
26
26
  "@fortawesome/react-fontawesome": "^0.1.9",
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",
27
+ "@sellout/utils": "^0.0.9",
31
28
  "@testing-library/jest-dom": "^4.2.4",
32
29
  "@testing-library/react": "^9.4.0",
33
30
  "@testing-library/user-event": "^7.2.1",
@@ -39,9 +36,7 @@
39
36
  "babel-loader": "^8.0.6",
40
37
  "jest": "^24.9.0",
41
38
  "polished": "^3.4.4",
42
- "react": "^16.13.0",
43
39
  "react-animate-height": "^2.0.20",
44
- "react-dom": "^16.13.0",
45
40
  "rollup": "^1.27.13",
46
41
  "rollup-plugin-commonjs": "^10.1.0",
47
42
  "rollup-plugin-node-resolve": "^5.2.0",
@@ -51,10 +46,10 @@
51
46
  "ts-jest": "^24.2.0",
52
47
  "typescript": "^3.7.5"
53
48
  },
54
- "gitHead": "991f3c469d9cd9754715c231b3c5cc7b7b6bfaf5",
49
+ "gitHead": "c54a032fe5d7b97ad1ac2532edce24854e063180",
55
50
  "peerDependencies": {
56
- "react": "^16",
57
- "react-dom": "^16",
51
+ "react": "^16.13.0",
52
+ "react-dom": "^16.13.0",
58
53
  "styled-components": "^5.0.1"
59
54
  },
60
55
  "jest": {
package/rollup.config.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import typescript from "rollup-plugin-typescript2";
2
2
  import pkg from "./package.json";
3
3
 
4
+ console.log(Object.keys(pkg.peerDependencies || {}));
5
+
4
6
  export default [
5
7
  {
6
8
  input: "src/index.ts",
package/src/Colors.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export enum Colors {
2
2
  White = "#FFFFFF",
3
- OffWhite = '#FCFCFC',
4
- Blue = '#020151',
3
+ Black = "#000000",
4
+ Green = "#419D78",
5
+ OffWhite = "#FCFCFC",
6
+ Blue = "#020151",
5
7
  Red = "#E63946",
6
8
  Orange = "#FF700F",
7
9
  DarkOrange = "#D65600",
@@ -11,4 +13,5 @@ export enum Colors {
11
13
  Grey4 = "#BDBDBD",
12
14
  Grey5 = "#E0E0E0",
13
15
  Grey6 = "#F2F2F2",
16
+ Grey7 = 'F8F8F8',
14
17
  }
@@ -8,9 +8,11 @@ import Loader, { LoaderSizes } from "./Loader";
8
8
  type FormProps = {
9
9
  hovered: boolean;
10
10
  focused: boolean;
11
+ width?: string;
11
12
  };
12
13
 
13
14
  const Form = styled.form<FormProps>`
15
+ width: ${props => props.width};
14
16
  display: flex;
15
17
  flex-direction: row;
16
18
  position: relative;
@@ -111,11 +113,12 @@ const InputStyled = styled.input<StyledInputProps>`
111
113
  `;
112
114
 
113
115
  export type InputProps = {
116
+ inputRef?: React.Ref<HTMLInputElement>;
114
117
  autoFocus?: boolean | undefined;
115
118
  placeholder?: string;
116
119
  value: string;
117
120
  defaultValue?: string;
118
- icon?: string;
121
+ icon?: any;
119
122
  type?: string;
120
123
  onMouseEnter?: any;
121
124
  onMouseLeave?: any;
@@ -124,13 +127,15 @@ export type InputProps = {
124
127
  onBlur?: any;
125
128
  onSubmit?: Function;
126
129
  onClear?: Function;
127
- canSubmit?: boolean,
130
+ canSubmit?: boolean;
128
131
  loading?: boolean;
129
132
  margin?: string;
130
133
  padding?: string;
134
+ width?: string;
131
135
  };
132
136
 
133
137
  export default function Input({
138
+ inputRef,
134
139
  autoFocus,
135
140
  placeholder,
136
141
  value,
@@ -148,6 +153,7 @@ export default function Input({
148
153
  loading,
149
154
  margin,
150
155
  padding,
156
+ width,
151
157
  }: InputProps) {
152
158
  const [hovered, setHovered] = useState(false);
153
159
  const [focused, setFocused] = useState(false);
@@ -164,6 +170,7 @@ export default function Input({
164
170
  hovered={hovered}
165
171
  focused={focused}
166
172
  onSubmit={event => submit(event)}
173
+ width={width}
167
174
  >
168
175
  {icon && (
169
176
  <LeftContainer>
@@ -175,6 +182,7 @@ export default function Input({
175
182
  </LeftContainer>
176
183
  )}
177
184
  <InputStyled
185
+ ref={inputRef}
178
186
  autoFocus={autoFocus}
179
187
  placeholder={placeholder}
180
188
  value={value}
@@ -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 = {
@@ -25,6 +25,7 @@ const Column = styled.div`
25
25
  const Container = styled.div`
26
26
  background-color: ${Colors.White};
27
27
  padding: 15px;
28
+ border-bottom: 1px solid ${Colors.Grey6};
28
29
  `;
29
30
 
30
31
  const Title = styled.div`
@@ -116,7 +117,6 @@ export default function Product({
116
117
  const toggle = () => {
117
118
  setShowEllipsis(!showEllipsis);
118
119
  setShowMore(!showMore)
119
-
120
120
  }
121
121
 
122
122
  return (
@@ -124,7 +124,7 @@ export default function Product({
124
124
  <Row justify="space-between">
125
125
  <Column>
126
126
  <Title>{title}</Title>
127
- <Price>${price}</Price>
127
+ <Price>${PriceUtil.output(price)}</Price>
128
128
  </Column>
129
129
  <Counter
130
130
  value={value}
@@ -134,9 +134,7 @@ export default function Product({
134
134
  onDecrement={onDecrement}
135
135
  />
136
136
  </Row>
137
- <Row>
138
- {subtitle && <Subtitle>{subtitle}</Subtitle>}
139
- </Row>
137
+ <Row>{subtitle && <Subtitle>{subtitle}</Subtitle>}</Row>
140
138
  {(() => {
141
139
  if (!description) return;
142
140
 
package/src/index.ts CHANGED
@@ -6,10 +6,12 @@ import { IconEnum } from "./components/Icons";
6
6
  import Input from "./components/Input";
7
7
  import Loader, { LoaderSizes } from "./components/Loader";
8
8
  import Product from "./components/Product";
9
+ import makeEventHandler from './utils/makeEventHandler';
9
10
 
10
11
  const Icons = IconEnum;
11
12
 
12
- export {
13
+ export {
14
+ // Components
13
15
  Colors,
14
16
  Button,
15
17
  ButtonTypes,
@@ -21,4 +23,6 @@ export {
21
23
  Loader,
22
24
  LoaderSizes,
23
25
  Product,
24
- };
26
+ // Utils
27
+ makeEventHandler
28
+ };
@@ -0,0 +1,8 @@
1
+ export default function makeEventHandler(executeOnEvent: Function = () => {}) {
2
+ return function (eventHandler: Function) {
3
+ return function(event: React.FormEvent<HTMLInputElement>) {
4
+ executeOnEvent();
5
+ eventHandler(event.currentTarget.value as string);
6
+ };
7
+ }
8
+ }
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export default function Simple(): JSX.Element;