@sellout/ui 0.0.108 → 0.0.110
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/components/FormattedfullInput.d.ts +32 -0
- package/build/components/FormattedfullInput.js +85 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +1 -0
- package/package.json +4 -4
- package/build/stories/Button.stories.d.ts +0 -9
- package/build/stories/Counter.stories.d.ts +0 -7
- package/build/stories/Icon.stories.d.ts +0 -7
- package/build/stories/Input.stories.d.ts +0 -9
- package/build/stories/Loader.stories.d.ts +0 -11
- package/build/stories/Product.stories.d.ts +0 -8
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare enum InputfullFormats {
|
|
3
|
+
Price = "Price",
|
|
4
|
+
Percent = "Percent"
|
|
5
|
+
}
|
|
6
|
+
export declare type InputProps = {
|
|
7
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
8
|
+
autoFocus?: boolean | undefined;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
value: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
format?: InputfullFormats;
|
|
14
|
+
onMouseEnter?: any;
|
|
15
|
+
onMouseLeave?: any;
|
|
16
|
+
onChange?: any;
|
|
17
|
+
onFocus?: any;
|
|
18
|
+
onBlur?: any;
|
|
19
|
+
onSubmit?: Function;
|
|
20
|
+
canSubmit?: boolean;
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
margin?: string;
|
|
23
|
+
width?: string;
|
|
24
|
+
onEnter?: Function;
|
|
25
|
+
label?: string;
|
|
26
|
+
subLabel?: string;
|
|
27
|
+
tip?: string;
|
|
28
|
+
maxLength?: number;
|
|
29
|
+
validationError?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export default function Input({ inputRef, autoFocus, placeholder, value, defaultValue, format, type, onMouseEnter, onMouseLeave, onChange, onFocus, onBlur, onSubmit, canSubmit, loading, margin, width, onEnter, label, subLabel, tip, maxLength, validationError, disabled, }: InputProps): JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Colors } from '../Colors.js';
|
|
2
|
+
import { __makeTemplateObject } from '../_virtual/_tslib.js';
|
|
3
|
+
import React, { useState } 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
|
+
import MaxLength from './MaxLength.js';
|
|
10
|
+
import ValidationError from './ValidationError.js';
|
|
11
|
+
import { media } from '../utils/MediaQuery.js';
|
|
12
|
+
|
|
13
|
+
var InputfullFormats;
|
|
14
|
+
(function (InputfullFormats) {
|
|
15
|
+
InputfullFormats["Price"] = "Price";
|
|
16
|
+
InputfullFormats["Percent"] = "Percent";
|
|
17
|
+
})(InputfullFormats || (InputfullFormats = {}));
|
|
18
|
+
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n"], ["\n width: ", ";\n"])), function (props) { return props.width; });
|
|
19
|
+
var Form = styled.form(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ", ";\n overflow: hidden;\n"], ["\n margin: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: relative;\n border-radius: 10px;\n transition: all 0.2s;\n border: 1px solid\n ",
|
|
20
|
+
";\n overflow: hidden;\n"])), function (props) { return props.margin; }, function (props) { return props.width; }, function (props) {
|
|
21
|
+
if (props.focused)
|
|
22
|
+
return Colors.Grey4;
|
|
23
|
+
if (props.hovered)
|
|
24
|
+
return darken(0.05, Colors.Grey5);
|
|
25
|
+
return Colors.Grey5;
|
|
26
|
+
});
|
|
27
|
+
var PriceContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 25px;\n background-color: ", ";\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 25px;\n background-color: ", ";\n"])), Colors.Grey5);
|
|
28
|
+
var InputStyled = styled.input(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n outline: none;\n border: 0px;\n height: 38px;\n width: 100%;\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n text-indent: 1px;\n transition: all 0.2s;\n padding: 0 16px;\n text-align: left;\n\n ", ";\n\n ", ";\n\n ::placeholder {\n color: ", ";\n }\n"], ["\n background-color: ",
|
|
29
|
+
";\n color: ", ";\n outline: none;\n border: 0px;\n height: 38px;\n width: 100%;\n font-family: \"neue-haas-grotesk-display\", sans-serif;\n font-weight: 500;\n text-indent: 1px;\n transition: all 0.2s;\n padding: 0 16px;\n text-align: left;\n\n ",
|
|
30
|
+
";\n\n ",
|
|
31
|
+
";\n\n ::placeholder {\n color: ", ";\n }\n"])), function (props) {
|
|
32
|
+
return props.disabled ? Colors.Grey6 + " !important" : null;
|
|
33
|
+
}, function (props) { return (props.disabled ? Colors.Grey4 : Colors.Grey1); }, media.mobile(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 1.6rem;\n "], ["\n font-size: 1.6rem;\n "]))), media.desktop(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: 1.4rem;\n "], ["\n font-size: 1.4rem;\n "]))), Colors.Grey4);
|
|
34
|
+
var IconText = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 1.4rem;\n font-weight: 600;\n color: ", ";\n"], ["\n font-size: 1.4rem;\n font-weight: 600;\n color: ", ";\n"])), Colors.Grey3);
|
|
35
|
+
function Input(_a) {
|
|
36
|
+
var inputRef = _a.inputRef, autoFocus = _a.autoFocus, placeholder = _a.placeholder, value = _a.value, defaultValue = _a.defaultValue, _b = _a.format, format = _b === void 0 ? InputfullFormats.Price : _b, _c = _a.type, type = _c === void 0 ? "text" : _c, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, onSubmit = _a.onSubmit, _d = _a.canSubmit, canSubmit = _d === void 0 ? true : _d, loading = _a.loading, margin = _a.margin, width = _a.width, onEnter = _a.onEnter, label = _a.label, subLabel = _a.subLabel, tip = _a.tip, maxLength = _a.maxLength, validationError = _a.validationError, _e = _a.disabled, disabled = _e === void 0 ? false : _e;
|
|
37
|
+
var _f = useState(false), hovered = _f[0], setHovered = _f[1];
|
|
38
|
+
var _g = useState(false), focused = _g[0], setFocused = _g[1];
|
|
39
|
+
var submit = function (event) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
if (onSubmit && canSubmit && !loading) {
|
|
42
|
+
onSubmit();
|
|
43
|
+
}
|
|
44
|
+
else if (onEnter && !loading) {
|
|
45
|
+
onEnter();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return (React.createElement(Container, { width: width },
|
|
49
|
+
React.createElement(Flex, { justify: "space-between" },
|
|
50
|
+
label && React.createElement(Label, { text: label, subText: subLabel, tip: tip }),
|
|
51
|
+
maxLength && React.createElement(MaxLength, { value: value, maxLength: maxLength })),
|
|
52
|
+
React.createElement(Form, { hovered: hovered, focused: focused, onSubmit: function (event) { return submit(event); }, width: width, margin: margin, noValidate // disables default html5 validation
|
|
53
|
+
: true, disabled: disabled },
|
|
54
|
+
format === InputfullFormats.Price && (React.createElement(PriceContainer, null,
|
|
55
|
+
React.createElement(Icon, { icon: Icons.Dollar, size: 14, color: Colors.Grey3 }))),
|
|
56
|
+
React.createElement(InputStyled, { ref: inputRef, disabled: disabled, autoFocus: autoFocus, placeholder: placeholder, value: value, defaultValue: defaultValue, type: type, onChange: function (e) {
|
|
57
|
+
if (maxLength && e.currentTarget.value.length > maxLength) ;
|
|
58
|
+
else {
|
|
59
|
+
onChange(e);
|
|
60
|
+
}
|
|
61
|
+
}, onFocus: function (event) {
|
|
62
|
+
setFocused(true);
|
|
63
|
+
if (onFocus)
|
|
64
|
+
onFocus(event);
|
|
65
|
+
}, onBlur: function (event) {
|
|
66
|
+
setFocused(false);
|
|
67
|
+
if (onFocus)
|
|
68
|
+
onBlur(event);
|
|
69
|
+
}, onMouseEnter: function (event) {
|
|
70
|
+
setHovered(true);
|
|
71
|
+
if (onMouseEnter)
|
|
72
|
+
onMouseEnter(event);
|
|
73
|
+
}, onMouseLeave: function (event) {
|
|
74
|
+
setHovered(false);
|
|
75
|
+
if (onMouseLeave)
|
|
76
|
+
onMouseLeave(event);
|
|
77
|
+
} }),
|
|
78
|
+
format === InputfullFormats.Percent && (React.createElement(PriceContainer, null,
|
|
79
|
+
React.createElement(IconText, null, "%")))),
|
|
80
|
+
validationError && (React.createElement(ValidationError, { validationError: validationError }))));
|
|
81
|
+
}
|
|
82
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
83
|
+
|
|
84
|
+
export default Input;
|
|
85
|
+
export { InputfullFormats };
|
package/build/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import Counter from "./components/Counter";
|
|
|
5
5
|
import Dropdown from "./components/Dropdown";
|
|
6
6
|
import Flex from "./components/Flex";
|
|
7
7
|
import FormattedInput, { InputFormats } from "./components/FormattedInput";
|
|
8
|
+
import FormattedfullInput, { InputfullFormats } from "./components/FormattedfullInput";
|
|
8
9
|
import Icon, { Icons } from "./components/Icon";
|
|
9
10
|
import Input from "./components/Input";
|
|
10
11
|
import Label from "./components/Label";
|
|
@@ -24,4 +25,4 @@ import * as ErrorUtil from './utils/ErrorUtil';
|
|
|
24
25
|
import makeEventHandler from './utils/makeEventHandler';
|
|
25
26
|
import * as MediaQuery from './utils/MediaQuery';
|
|
26
27
|
import * as Validation from './utils/Validation';
|
|
27
|
-
export { Colors, Button, CodeInput, Counter, Dropdown, Flex, FormattedInput, InputFormats, Icon, Icons, Input, Label, MaxLength, Loader, LoaderSizes, Motion, PhoneNumberInput, Product, TextButton, Tip, UserImage, UserInfo, ValidationError, ErrorUtil, makeEventHandler, MediaQuery, Validation, AddressSearchDropdown, SearchDropdown };
|
|
28
|
+
export { Colors, Button, CodeInput, Counter, Dropdown, Flex, FormattedInput, InputFormats, FormattedfullInput, InputfullFormats, Icon, Icons, Input, Label, MaxLength, Loader, LoaderSizes, Motion, PhoneNumberInput, Product, TextButton, Tip, UserImage, UserInfo, ValidationError, ErrorUtil, makeEventHandler, MediaQuery, Validation, AddressSearchDropdown, SearchDropdown };
|
package/build/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as ValidationError } from './components/ValidationError.js';
|
|
|
15
15
|
import * as MediaQuery from './utils/MediaQuery.js';
|
|
16
16
|
export { MediaQuery };
|
|
17
17
|
export { default as FormattedInput, InputFormats } from './components/FormattedInput.js';
|
|
18
|
+
export { default as FormattedfullInput, InputfullFormats } from './components/FormattedfullInput.js';
|
|
18
19
|
export { default as Input } from './components/Input.js';
|
|
19
20
|
export { default as PhoneNumberInput } from './components/PhoneNumberInput.js';
|
|
20
21
|
export { default as Product } from './components/Product.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sellout/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.110",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"module": "build/index.es.js",
|
|
6
6
|
"files": [
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@hapi/joi": "^17.1.1",
|
|
57
57
|
"@react-pdf/primitives": "^2.0.0",
|
|
58
58
|
"@react-pdf/renderer": "^2.0.20",
|
|
59
|
-
"@sellout/models": "^0.0.
|
|
60
|
-
"@sellout/utils": "^0.0.
|
|
59
|
+
"@sellout/models": "^0.0.110",
|
|
60
|
+
"@sellout/utils": "^0.0.110",
|
|
61
61
|
"@types/escape-html": "^1.0.1",
|
|
62
62
|
"@types/hapi__joi": "^16.0.12",
|
|
63
63
|
"@types/react-pdf": "^4.0.6",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"shortid": "^2.2.16",
|
|
72
72
|
"use-places-autocomplete": "^1.9.4"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "f0424d166bf32ead0bce38f54d5d37caec02cfc6",
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": "^16.13.0",
|
|
77
77
|
"react-dom": "^16.13.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export const title: string;
|
|
3
|
-
export { OldButton as component };
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
6
|
-
export function Text(): JSX.Element;
|
|
7
|
-
export function Loading(): JSX.Element;
|
|
8
|
-
export function MaxWidth(): JSX.Element;
|
|
9
|
-
import OldButton from "../components/Button";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export const title: string;
|
|
3
|
-
export { Input as component };
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
6
|
-
export function Clear(): JSX.Element;
|
|
7
|
-
export function Submit(): JSX.Element;
|
|
8
|
-
export function Loading(): JSX.Element;
|
|
9
|
-
import Input from "../components/Input";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export const title: string;
|
|
3
|
-
export { Loader as component };
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
6
|
-
export function VerySmall(): JSX.Element;
|
|
7
|
-
export function Small(): JSX.Element;
|
|
8
|
-
export function Medium(): JSX.Element;
|
|
9
|
-
export function Large(): JSX.Element;
|
|
10
|
-
export function Colored(): JSX.Element;
|
|
11
|
-
import Loader from "../components/Loader";
|