@sellout/ui 0.0.57 → 0.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +49 -3
  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
@@ -1,258 +0,0 @@
1
- import React, { Fragment, useState } from "react";
2
- import styled from "styled-components";
3
- import * as Polished from 'polished';
4
- import { Colors } from "../Colors";
5
- import Icon, { Icons } from './Icon'
6
- import Loader, { LoaderSizes } from "./Loader";
7
-
8
- type FormProps = {
9
- hovered: boolean;
10
- focused: boolean;
11
- width?: string;
12
- };
13
-
14
- const Form = styled.form<FormProps>`
15
- width: ${props => props.width};
16
- display: flex;
17
- flex-direction: row;
18
- position: relative;
19
- border-radius: 10px;
20
- transition: all 0.2s;
21
- border: 1px solid
22
- ${props => {
23
- if (props.focused) return Colors.Grey3;
24
- if (props.hovered) return Colors.Grey4;
25
- return Colors.Grey5;
26
- }};
27
- `;
28
-
29
- type ButtonProps = {
30
- canSubmit: boolean;
31
- };
32
-
33
- const Button = styled.div<ButtonProps>`
34
- position: absolute;
35
- display: flex;
36
- align-items: center;
37
- justify-content: center;
38
- color: ${Colors.White};
39
- height: 50px;
40
- width: 50px;
41
- border-radius: 0 10px 10px 0;
42
- top: -1px;
43
- right: -1px;
44
- transition: all 0.2s;
45
- background-color: ${props =>
46
- props.canSubmit ? Colors.Orange : Colors.Grey6};
47
-
48
- &:hover {
49
- cursor: ${props => (props.onClick ? "pointer" : null)};
50
- background-color: ${props =>
51
- props.canSubmit ? Polished.lighten(0.025, Colors.Orange) : null};
52
- }
53
-
54
- &:active {
55
- cursor: ${props => (props.onClick ? "pointer" : null)};
56
- background-color: ${props =>
57
- props.canSubmit ? Polished.darken(0.025, Colors.Orange) : null};
58
- }
59
- `;
60
-
61
- const LeftContainer = styled.div`
62
- position: relative;
63
- display: flex;
64
- align-items: center;
65
- justify-content: center;
66
- margin-left: 15px;
67
- top: 0px;
68
- left: 0px;
69
- `;
70
-
71
- const RightContainer = styled.div`
72
- position: absolute;
73
- display: flex;
74
- align-items: center;
75
- justify-content: center;
76
- height: 50px;
77
- width: 50px;
78
- top: -1px;
79
- right: -1px;
80
-
81
- &:hover {
82
- cursor: ${props => (props.onClick ? "pointer" : null)};
83
- }
84
- `;
85
-
86
- const Spacer = styled.div`
87
- width: 50px;
88
- `;
89
-
90
- type StyledInputProps = {
91
- margin?: string;
92
- padding?: string;
93
- }
94
-
95
- const InputStyled = styled.input<StyledInputProps>`
96
- background-color: ${Colors.White};
97
- color: ${Colors.Grey1};
98
- outline: none;
99
- border: 0px;
100
- border-radius: 10px;
101
- height: 48px;
102
- width: fill-available;
103
- font-size: 1.4rem;
104
- font-weight: 500;
105
- padding: 0 0 0 10px;
106
- transition: all 0.2s;
107
- margin: ${props => props.margin};
108
- padding: ${props => props.padding};
109
-
110
- ::placeholder {
111
- color: ${Colors.Grey4};
112
- }
113
- `;
114
-
115
- export type InputProps = {
116
- inputRef?: React.Ref<HTMLInputElement>;
117
- autoFocus?: boolean | undefined;
118
- placeholder?: string;
119
- value: string;
120
- defaultValue?: string;
121
- icon?: any;
122
- type?: string;
123
- onMouseEnter?: any;
124
- onMouseLeave?: any;
125
- onChange?: any;
126
- onFocus?: any;
127
- onBlur?: any;
128
- onSubmit?: Function;
129
- onClear?: Function;
130
- canSubmit?: boolean;
131
- loading?: boolean;
132
- margin?: string;
133
- padding?: string;
134
- width?: string;
135
- };
136
-
137
- export default function Input({
138
- inputRef,
139
- autoFocus,
140
- placeholder,
141
- value,
142
- defaultValue,
143
- icon,
144
- type = 'text',
145
- onMouseEnter,
146
- onMouseLeave,
147
- onChange,
148
- onFocus,
149
- onBlur,
150
- onSubmit,
151
- onClear,
152
- canSubmit = true,
153
- loading,
154
- margin,
155
- padding,
156
- width,
157
- }: InputProps) {
158
- const [hovered, setHovered] = useState(false);
159
- const [focused, setFocused] = useState(false);
160
-
161
- const submit = (event: any) => {
162
- event.preventDefault();
163
- if(onSubmit && canSubmit && !loading) {
164
- onSubmit();
165
- }
166
- }
167
-
168
- return (
169
- <Form
170
- hovered={hovered}
171
- focused={focused}
172
- onSubmit={event => submit(event)}
173
- width={width}
174
- >
175
- {icon && (
176
- <LeftContainer>
177
- <Icon
178
- icon={icon}
179
- size={16}
180
- color={focused ? Colors.Grey1 : Colors.Grey4}
181
- />
182
- </LeftContainer>
183
- )}
184
- <InputStyled
185
- ref={inputRef}
186
- autoFocus={autoFocus}
187
- placeholder={placeholder}
188
- value={value}
189
- defaultValue={defaultValue}
190
- type={type}
191
- onChange={onChange}
192
- onFocus={event => {
193
- setFocused(true);
194
- if (onFocus) onFocus(event);
195
- }}
196
- onBlur={event => {
197
- setFocused(false);
198
- if (onFocus) onBlur(event);
199
- }}
200
- onMouseEnter={(event: any) => {
201
- setHovered(true);
202
- if (onMouseEnter) onMouseEnter(event);
203
- }}
204
- onMouseLeave={(event: any) => {
205
- setHovered(false);
206
- if (onMouseLeave) onMouseLeave(event);
207
- }}
208
- margin={margin}
209
- padding={padding}
210
- />
211
-
212
- {(() => {
213
- if (onSubmit) {
214
- return (
215
- <Fragment>
216
- <Spacer />
217
- <Button
218
- canSubmit={canSubmit}
219
- onClick={event => submit(event)}
220
- >
221
- {(() => {
222
- if (loading) {
223
- return <Loader size={LoaderSizes.VerySmall} />;
224
- }
225
-
226
- return (
227
- <Icon
228
- icon={Icons.RightChevronCircle}
229
- color={canSubmit ? Colors.White : Colors.Grey4}
230
- size={16}
231
- />
232
- );
233
- })()}
234
- </Button>
235
- </Fragment>
236
- );
237
- }
238
-
239
- if (Boolean(value) && onClear) {
240
- return (
241
- <Fragment>
242
- <Spacer />
243
- <RightContainer onClick={() => onClear()}>
244
- <Icon
245
- icon={Icons.CancelCircle}
246
- color={Colors.Grey3}
247
- size={16}
248
- />
249
- </RightContainer>
250
- </Fragment>
251
- );
252
- }
253
-
254
- return <Spacer />;
255
- })()}
256
- </Form>
257
- );
258
- }
@@ -1,88 +0,0 @@
1
- import React from "react";
2
- import styled from "styled-components";
3
- import { Colors } from "./../Colors";
4
-
5
- export enum LoaderSizes {
6
- FuckingTiny = "FuckingTiny",
7
- SuperSmall = "SuperSmall",
8
- VerySmall = "VerySmall",
9
- Small = "Small",
10
- Medium = "Medium",
11
- Large = "Large",
12
- };
13
-
14
- const LoaderSizesMap = {
15
- [LoaderSizes.FuckingTiny]: 14,
16
- [LoaderSizes.SuperSmall]: 20,
17
- [LoaderSizes.VerySmall]: 24,
18
- [LoaderSizes.Small]: 30,
19
- [LoaderSizes.Medium]: 40,
20
- [LoaderSizes.Large]: 60
21
- };
22
-
23
- type StyledLoaderProps = {
24
- size: number;
25
- color: string;
26
- }
27
-
28
- const scale = (size: number, scale: number) => `${size * scale}px`;
29
-
30
- const StyledLoader = styled.div<StyledLoaderProps>`
31
- position: relative;
32
- top: 1.5px;
33
-
34
- .lds-ring {
35
- display: inline-block;
36
- position: relative;
37
- width: ${props => scale(props.size, 1)};
38
- height: ${props => scale(props.size, 1)};
39
- }
40
- .lds-ring div {
41
- box-sizing: border-box;
42
- display: block;
43
- position: absolute;
44
- width: ${props => scale(props.size, .8)};
45
- height: ${props => scale(props.size, .8)};
46
- margin: ${props => scale(props.size, .1)};
47
- border: ${props => scale(props.size, 0.066)} solid ${props => props.color};
48
- border-radius: 50%;
49
- animation: lds-ring 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
50
- border-color: ${props => props.color} transparent transparent transparent;
51
- }
52
- .lds-ring div:nth-child(1) {
53
- animation-delay: -0.3s;
54
- }
55
- .lds-ring div:nth-child(2) {
56
- animation-delay: -0.2s;
57
- }
58
- .lds-ring div:nth-child(3) {
59
- animation-delay: -0.1s;
60
- }
61
- @keyframes lds-ring {
62
- 0% {
63
- transform: rotate(0deg);
64
- }
65
- 100% {
66
- transform: rotate(360deg);
67
- }
68
- }
69
- `;
70
-
71
- export default function Loader({
72
- size = LoaderSizes.Medium,
73
- color = Colors.White,
74
- }) {
75
- return (
76
- <StyledLoader
77
- size={LoaderSizesMap[size]}
78
- color={color}
79
- >
80
- <div className="lds-ring">
81
- <div></div>
82
- <div></div>
83
- {/* <div></div> */}
84
- <div></div>
85
- </div>
86
- </StyledLoader>
87
- );
88
- }
@@ -1,156 +0,0 @@
1
- import React, { Fragment, useState } from "react";
2
- import styled from "styled-components";
3
- import * as Polished from "polished";
4
- import AnimateHeight from "react-animate-height";
5
- import { Colors } from "../Colors";
6
- import Counter, { CounterProps } from './Counter';
7
- import * as PriceUtil from '@sellout/utils/.dist/price';
8
- // import Icon from "./Icon";
9
-
10
- type RowProps = {
11
- justify?: string;
12
- };
13
-
14
- const Row = styled.div<RowProps>`
15
- display: flex;
16
- flex-direction: row;
17
- justify-content: ${props => props.justify};
18
- `;
19
-
20
- const Column = styled.div`
21
- display: flex;
22
- flex-direction: column;
23
- `;
24
-
25
- const Container = styled.div`
26
- background-color: ${Colors.White};
27
- padding: 15px;
28
- border-bottom: 1px solid ${Colors.Grey6};
29
- `;
30
-
31
- const Title = styled.div`
32
- font-size: 1.8rem;
33
- color: ${Colors.Grey1};
34
- font-weight: 600;
35
- margin-bottom: 5px;
36
- `;
37
-
38
- const Price = styled.div`
39
- font-size: 1.4rem;
40
- font-weight: 500;
41
- color: ${Colors.Grey2};
42
- margin-bottom: 5px;
43
- `;
44
-
45
- const Subtitle = styled.div`
46
- font-size: 1.2rem;
47
- font-weight: 500;
48
- line-height: 160%;
49
- color: ${Colors.Grey3};
50
- `;
51
-
52
- const Description = styled.div`
53
- font-size: 1.2rem;
54
- font-weight: 500;
55
- line-height: 160%;
56
- color: ${Colors.Grey2};
57
- margin-top: 10px;
58
- `;
59
-
60
- type EllipsisProps = {
61
- active: boolean
62
- };
63
-
64
- const Ellipsis = styled.div<EllipsisProps>`
65
- display: -webkit-box;
66
- -webkit-line-clamp: ${props => props.active ? 3 : null};
67
- -webkit-box-orient: ${props => props.active ? 'vertical' : null};
68
- overflow: hidden;
69
- text-overflow: ellipsis;
70
- `;
71
-
72
- const ShowMore = styled.div`
73
- font-size: 1.2rem;
74
- font-weight: 500;
75
- line-height: 160%;
76
- color: ${Colors.Orange};
77
- transition: all 0.2s;
78
-
79
- &:hover {
80
- cursor: pointer;
81
- color: ${Polished.lighten(0.025, Colors.Orange)};
82
- }
83
-
84
- &:active {
85
- color: ${Polished.darken(0.025, Colors.Orange)};
86
- }
87
- `;
88
-
89
- export type ProductProps = {
90
- title: string;
91
- price: number;
92
- subtitle?: string;
93
- description?: string;
94
- imageUrl?: string;
95
- } & CounterProps
96
-
97
- export default function Product({
98
- title = '',
99
- price = 0,
100
- subtitle = '',
101
- description = '',
102
- // Counter Props
103
- value,
104
- minValue,
105
- maxValue,
106
- onIncrement,
107
- onDecrement,
108
- }: ProductProps) {
109
- const [showMore, setShowMore] = useState(false);
110
- const [showEllipsis, setShowEllipsis] = useState(true);
111
-
112
- let descModified = description;
113
- if (descModified.length > 210 && !showMore) {
114
- descModified = descModified.substring(0, 210) + '...';
115
- }
116
-
117
- const toggle = () => {
118
- setShowEllipsis(!showEllipsis);
119
- setShowMore(!showMore)
120
- }
121
-
122
- return (
123
- <Container>
124
- <Row justify="space-between">
125
- <Column>
126
- <Title>{title}</Title>
127
- <Price>${PriceUtil.output(price)}</Price>
128
- </Column>
129
- <Counter
130
- value={value}
131
- minValue={minValue}
132
- maxValue={maxValue}
133
- onIncrement={onIncrement}
134
- onDecrement={onDecrement}
135
- />
136
- </Row>
137
- <Row>{subtitle && <Subtitle>{subtitle}</Subtitle>}</Row>
138
- {(() => {
139
- if (!description) return;
140
-
141
- return (
142
- <Fragment>
143
- <AnimateHeight height={showMore ? "auto" : 67}>
144
- <Ellipsis active={showEllipsis}>
145
- <Description>{description}</Description>
146
- </Ellipsis>
147
- </AnimateHeight>
148
- <ShowMore onClick={() => toggle()}>
149
- {showMore ? "Show Less" : "Show More"}
150
- </ShowMore>
151
- </Fragment>
152
- );
153
- })()}
154
- </Container>
155
- );
156
- }
package/src/index.ts DELETED
@@ -1,28 +0,0 @@
1
- import { Colors } from "./Colors";
2
- import Button, { ButtonTypes, ButtonStates } from './components/Button';
3
- import Counter from "./components/Counter";
4
- import Icon from "./components/Icon";
5
- import { IconEnum } from "./components/Icons";
6
- import Input from "./components/Input";
7
- import Loader, { LoaderSizes } from "./components/Loader";
8
- import Product from "./components/Product";
9
- import makeEventHandler from './utils/makeEventHandler';
10
-
11
- const Icons = IconEnum;
12
-
13
- export {
14
- // Components
15
- Colors,
16
- Button,
17
- ButtonTypes,
18
- ButtonStates,
19
- Counter,
20
- Icon,
21
- Icons,
22
- Input,
23
- Loader,
24
- LoaderSizes,
25
- Product,
26
- // Utils
27
- makeEventHandler
28
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
- import { action } from '@storybook/addon-actions';
4
- import Button from '../components/Button';
5
-
6
- const Container = styled.div`
7
- width: 300px;
8
- padding: 20px;
9
- `;
10
-
11
- export default {
12
- title: 'Button',
13
- component: Button,
14
- };
15
-
16
- export const Text = () => (
17
- <Container>
18
- <Button text="Next" onClick={action('clicked')} />
19
- </Container>
20
- );
21
-
22
- export const Loading = () => (
23
- <Container>
24
- <Button loading={true} />
25
- </Container>
26
- );
27
-
28
- export const MaxWidth = () => (
29
- <Button text="Create Event" onClick={action('clicked')} />
30
- );
@@ -1,28 +0,0 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
- import Counter from '../components/Counter';
4
-
5
- const Container = styled.div`
6
- width: 370px;
7
- padding: 20px;
8
- `;
9
-
10
- export default {
11
- title: 'Counter',
12
- component: Counter,
13
- };
14
-
15
- export const Default = () => {
16
- const [value, setValue] = useState(0);
17
- return (
18
- <Container>
19
- <Counter
20
- value={value}
21
- minValue={0}
22
- maxValue={10}
23
- onIncrement={() => setValue(value + 1)}
24
- onDecrement={() => setValue(value - 1)}
25
- />
26
- </Container>
27
- );
28
- };
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
- import { action } from '@storybook/addon-actions';
4
- import Icon, { Icons } from '../components/Icon';
5
- import { Colors } from '../Colors';
6
-
7
- const Container = styled.div`
8
- width: 300px;
9
- padding: 20px;
10
- `;
11
-
12
- export default {
13
- title: 'Icon',
14
- component: Icon,
15
- };
16
-
17
- export const Plain = () => (
18
- <Container>
19
- <Icon
20
- icon={Icons.AudienceRegular}
21
- onClick={action('Clicked')}
22
- color={Colors.Orange}
23
- />
24
- </Container>
25
- );
@@ -1,79 +0,0 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
- import { action } from '@storybook/addon-actions';
4
- import Input from '../components/Input';
5
- import { Icons } from '../components/Icon';
6
-
7
- const Container = styled.div`
8
- width: 370px;
9
- padding: 20px;
10
- `;
11
-
12
- export default {
13
- title: 'Input',
14
- component: Input,
15
- };
16
-
17
- export const Clear = () => {
18
- const [value, setValue] = useState('');
19
- return (
20
- <Container>
21
- <Input
22
- placeholder="Enter your email address"
23
- value={value}
24
- icon={Icons.Unlock}
25
- onChange={e => {
26
- action('onChange')();
27
- setValue(e.target.value);
28
- }}
29
- onClear={() => {
30
- action('onClear')();
31
- setValue('');
32
- }}
33
- onBlur={action('onBlur')}
34
- onFocus={action('onFocus')}
35
- />
36
- </Container>
37
- );
38
- };
39
-
40
- export const Submit = () => {
41
- const [loading, setLoading] = useState(false);
42
- const [value, setValue] = useState('');
43
- return (
44
- <Container>
45
- <Input
46
- placeholder="Enter your email address"
47
- value={value}
48
- icon={Icons.EnvelopeSolid}
49
- onChange={e => {
50
- action('onChange')();
51
- setValue(e.target.value);
52
- } }
53
- onBlur={action('onBlur')}
54
- onFocus={action('onFocus')}
55
- canSubmit={value.length > 7}
56
- onSubmit={() => {
57
- action('onSubmit')();
58
- setLoading(true);
59
- setTimeout(() => setLoading(false), 3000);
60
- }}
61
- loading={loading}
62
- />
63
- </Container>
64
- );
65
- };
66
-
67
- export const Loading = () => (
68
- <Container>
69
- <Input
70
- placeholder="Enter your email address"
71
- icon={Icons.EnvelopeSolid}
72
- onChange={action('onChange')}
73
- onBlur={action('onBlur')}
74
- onFocus={action('onFocus')}
75
- onSubmit={action('onSubmit')}
76
- loading={true}
77
- />
78
- </Container>
79
- );