@xaypay/tui 0.0.75 → 0.0.77

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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "storybook": "STORYBOOK_PATH=../../tui.config.js start-storybook -p 6006",
9
+ "storybook": "STORYBOOK_PATH=../../tui.config.js start-storybook -p 6006",
10
10
  "build-storybook": "STORYBOOK_PATH=../../tui.config.js build-storybook",
11
- "build-lib": "STORYBOOK_PATH=../tui.config.js rollup --config rollup.config.js",
11
+ "build-lib": "STORYBOOK_PATH=../tui.config.js STORYBOOK_CONFIG_PATH=../../../../tui.config.js rollup --config rollup.config.js",
12
12
  "svgr": "svgr --icon --title-prop -d src/components/icon -- src/assets/icons"
13
13
  },
14
14
  "author": "",
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.8744 20H8.12436C7.87436 20 7.65769 19.9167 7.47436 19.75C7.29103 19.5833 7.18269 19.375 7.14936 19.125L6.84936 16.8C6.63269 16.7167 6.42869 16.6167 6.23736 16.5C6.04536 16.3833 5.85769 16.2583 5.67436 16.125L3.49936 17.025C3.26603 17.1083 3.03269 17.1167 2.79936 17.05C2.56603 16.9833 2.38269 16.8417 2.24936 16.625L0.399361 13.4C0.266027 13.1833 0.224361 12.95 0.274361 12.7C0.324361 12.45 0.449361 12.25 0.649361 12.1L2.52436 10.675C2.50769 10.5583 2.49936 10.4457 2.49936 10.337V9.662C2.49936 9.554 2.50769 9.44167 2.52436 9.325L0.649361 7.9C0.449361 7.75 0.324361 7.55 0.274361 7.3C0.224361 7.05 0.266027 6.81667 0.399361 6.6L2.24936 3.375C2.36603 3.14167 2.54503 2.99567 2.78636 2.937C3.02836 2.879 3.26603 2.89167 3.49936 2.975L5.67436 3.875C5.85769 3.74167 6.04936 3.61667 6.24936 3.5C6.44936 3.38333 6.64936 3.28333 6.84936 3.2L7.14936 0.875C7.18269 0.625 7.29103 0.416667 7.47436 0.25C7.65769 0.0833333 7.87436 0 8.12436 0H11.8744C12.1244 0 12.341 0.0833333 12.5244 0.25C12.7077 0.416667 12.816 0.625 12.8494 0.875L13.1494 3.2C13.366 3.28333 13.5704 3.38333 13.7624 3.5C13.9537 3.61667 14.141 3.74167 14.3244 3.875L16.4994 2.975C16.7327 2.89167 16.966 2.88333 17.1994 2.95C17.4327 3.01667 17.616 3.15833 17.7494 3.375L19.5994 6.6C19.7327 6.81667 19.7744 7.05 19.7244 7.3C19.6744 7.55 19.5494 7.75 19.3494 7.9L17.4744 9.325C17.491 9.44167 17.4994 9.554 17.4994 9.662V10.337C17.4994 10.4457 17.4827 10.5583 17.4494 10.675L19.3244 12.1C19.5244 12.25 19.6494 12.45 19.6994 12.7C19.7494 12.95 19.7077 13.1833 19.5744 13.4L17.7244 16.6C17.591 16.8167 17.4037 16.9627 17.1624 17.038C16.9204 17.1127 16.6827 17.1083 16.4494 17.025L14.3244 16.125C14.141 16.2583 13.9494 16.3833 13.7494 16.5C13.5494 16.6167 13.3494 16.7167 13.1494 16.8L12.8494 19.125C12.816 19.375 12.7077 19.5833 12.5244 19.75C12.341 19.9167 12.1244 20 11.8744 20ZM10.0494 13.5C11.016 13.5 11.841 13.1583 12.5244 12.475C13.2077 11.7917 13.5494 10.9667 13.5494 10C13.5494 9.03333 13.2077 8.20833 12.5244 7.525C11.841 6.84167 11.016 6.5 10.0494 6.5C9.06603 6.5 8.23669 6.84167 7.56136 7.525C6.88669 8.20833 6.54936 9.03333 6.54936 10C6.54936 10.9667 6.88669 11.7917 7.56136 12.475C8.23669 13.1583 9.06603 13.5 10.0494 13.5Z" fill="white"/>
3
+ </svg>
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import {Button} from './index';
2
+ import { Button } from './index';
3
+
4
+ import { ReactComponent as ReactSVG } from './../../assets/range-arrow-default.svg';
3
5
 
4
6
  export default {
5
7
  component: Button,
6
8
  title: 'Components/Button',
7
9
  };
8
10
 
9
- const Template = (args) => <Button label='Button' {...args}/>;
11
+ const Template = (args) => <Button label='Button' icon={<ReactSVG />} {...args}/>;
10
12
 
11
13
  export const Default = Template.bind({});
@@ -4,6 +4,7 @@ import classnames from 'classnames';
4
4
  import { compereConfigs } from './../../utils';
5
5
 
6
6
  export const Button = ({
7
+ icon,
7
8
  size,
8
9
  type,
9
10
  font,
@@ -34,8 +35,8 @@ export const Button = ({
34
35
  const [isHover, setIsHover] = useState(false);
35
36
 
36
37
  useEffect(() => {
37
- if (!label) {
38
- alert('Button component: label prop is required, please add it!!!');
38
+ if (!label && !icon) {
39
+ alert('Add icon or label props on Button component');
39
40
  }
40
41
  }, []);
41
42
 
@@ -55,11 +56,14 @@ export const Button = ({
55
56
  return (
56
57
  <button
57
58
  style={{
59
+ display: 'flex',
60
+ alignItems: 'center',
58
61
  fontSize: size ? size : configStyles.BUTTON.size,
59
62
  fontFamily: font ? font : configStyles.BUTTON.font,
60
63
  height: height ? height : configStyles.BUTTON.height,
61
64
  fontWeight: weight ? weight : configStyles.BUTTON.weight,
62
65
  padding: padding ? padding : configStyles.BUTTON.padding,
66
+ justifyContent: icon && label? 'space-between' : 'center',
63
67
  borderRadius: radius ? radius : configStyles.BUTTON.radius,
64
68
  boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
65
69
  transition: transition ? transition : configStyles.BUTTON.transition,
@@ -88,7 +92,7 @@ export const Button = ({
88
92
  className={classProps}
89
93
  {...props}
90
94
  >
91
- {label}
95
+ {icon && icon} {label && label} {!icon && !label && 'Add icon or label prop on Button component'}
92
96
  </button>
93
97
  );
94
98
  };
@@ -97,10 +101,12 @@ Button.propTypes = {
97
101
  type: PropTypes.string,
98
102
  size: PropTypes.string,
99
103
  font: PropTypes.string,
104
+ icon: PropTypes.element,
100
105
  color: PropTypes.string,
101
106
  width: PropTypes.string,
102
107
  outline: PropTypes.bool,
103
108
  onClick: PropTypes.func,
109
+ label: PropTypes.string,
104
110
  weight: PropTypes.string,
105
111
  height: PropTypes.string,
106
112
  cursor: PropTypes.string,
@@ -115,7 +121,6 @@ Button.propTypes = {
115
121
  textTransform: PropTypes.string,
116
122
  disabledColor: PropTypes.string,
117
123
  backgroundColor: PropTypes.string,
118
- label: PropTypes.string.isRequired,
119
124
  disabledLineColor: PropTypes.string,
120
125
  disabledBackgroundColor: PropTypes.string
121
126
  };
@@ -45,6 +45,7 @@ export const Input = ({
45
45
  maxLength,
46
46
  labelColor,
47
47
  errorColor,
48
+ borderRight,
48
49
  placeholder,
49
50
  errorZindex,
50
51
  errorBottom,
@@ -62,9 +63,11 @@ export const Input = ({
62
63
  labelLineHeight,
63
64
  backgroundColor,
64
65
  telErrorMessage,
66
+ borderRightColor,
65
67
  labelMarginBottom,
66
68
  regexpErrorMessage,
67
69
  phoneJustifyContent,
70
+ borderRightColorHover,
68
71
  errorAnimationDuration,
69
72
  ...props
70
73
  }) => {
@@ -153,28 +156,32 @@ export const Input = ({
153
156
  setInnerErrorMessage('');
154
157
  }
155
158
 
156
- if (value !== undefined && value !== null) {
157
- setInnerValue(value);
158
- if (type === 'tel') {
159
- if (!phoneNumberRegex.test(value)) {
160
- telErrorMessage && setInnerErrorMessage(telErrorMessage);
161
- setInnerValue('');
162
- } else {
163
- setInnerErrorMessage('');
164
- if (value.length > 8) {
165
- setInnerValue(value.substr(0, 8));
159
+ if (value !== undefined) {
160
+ if (value === null) {
161
+ setInnerValue('');
162
+ } else {
163
+ setInnerValue(value);
164
+ if (type === 'tel') {
165
+ if (!phoneNumberRegex.test(value)) {
166
+ telErrorMessage && setInnerErrorMessage(telErrorMessage);
167
+ setInnerValue('');
166
168
  } else {
167
- setInnerValue(value);
169
+ setInnerErrorMessage('');
170
+ if (value.length > 8) {
171
+ setInnerValue(value.substr(0, 8));
172
+ } else {
173
+ setInnerValue(value);
174
+ }
168
175
  }
169
- }
170
- }
176
+ }
171
177
 
172
- if (maxLength && value.length > maxLength && type !== 'tel') {
173
- setInnerValue(value.substr(0, maxLength));
174
- }
178
+ if (maxLength && value.length > maxLength && type !== 'tel') {
179
+ setInnerValue(value.substr(0, maxLength));
180
+ }
175
181
 
176
- if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
177
- !regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('')
182
+ if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
183
+ !regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('')
184
+ }
178
185
  }
179
186
  }
180
187
  }, [type, value, regexp, maxLength, errorMessage, regexpErrorMessage]);
@@ -239,7 +246,14 @@ export const Input = ({
239
246
  borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
240
247
  borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
241
248
  display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
249
+ borderRight: borderRight ? borderRight : configStyles.INPUT.borderRight,
242
250
  alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
251
+ borderColor:
252
+ isHover
253
+ ?
254
+ borderRightColorHover ? borderRightColorHover : configStyles.INPUT.borderRightColorHover
255
+ :
256
+ borderRightColor ? borderRightColor : configStyles.INPUT.borderRightColor,
243
257
  color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
244
258
  justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
245
259
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
@@ -327,7 +341,6 @@ Input.propTypes = {
327
341
  name: PropTypes.string,
328
342
  change: PropTypes.func,
329
343
  color: PropTypes.string,
330
- value: PropTypes.string,
331
344
  width: PropTypes.string,
332
345
  label: PropTypes.string,
333
346
  required: PropTypes.bool,
@@ -348,6 +361,7 @@ Input.propTypes = {
348
361
  maxLength: PropTypes.number,
349
362
  errorColor: PropTypes.string,
350
363
  labelColor: PropTypes.string,
364
+ borderRight: PropTypes.string,
351
365
  placeholder: PropTypes.string,
352
366
  errorZindex: PropTypes.string,
353
367
  errorBottom: PropTypes.string,
@@ -365,14 +379,17 @@ Input.propTypes = {
365
379
  phoneAlignItems: PropTypes.string,
366
380
  errorLineHeight: PropTypes.string,
367
381
  labelLineHeight: PropTypes.string,
382
+ borderRightColor: PropTypes.string,
368
383
  labelMarginBottom: PropTypes.string,
369
384
  regexpErrorMessage: PropTypes.string,
370
385
  regexp: PropTypes.instanceOf(RegExp),
371
386
  phoneJustifyContent: PropTypes.string,
387
+ borderRightColorHover: PropTypes.string,
372
388
  errorAnimationDuration: PropTypes.string,
373
389
  leftIcon: PropTypes.arrayOf(PropTypes.element),
374
390
  rightIcon: PropTypes.arrayOf(PropTypes.element),
375
391
  type: PropTypes.oneOf(Object.values(InputTypes)),
392
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
376
393
  };
377
394
 
378
395
  Input.defaultProps = {
@@ -85,7 +85,7 @@ export const NewFile = ({
85
85
 
86
86
  const handleRemoveFile = () => {
87
87
  setImage(null);
88
- removeFile(singleFile);
88
+ removeFile && removeFile(singleFile);
89
89
  };
90
90
 
91
91
  const handleChange = (e) => {
@@ -201,7 +201,11 @@ export const NewFile = ({
201
201
  if (multiple) {
202
202
  setSingleFile(null);
203
203
  }
204
- }, [multiple, filesArray && filesArray.length, defaultData]);
204
+
205
+ if (multiple && !removeFile) {
206
+ alert('Please add removeFile prop on NewFile component, it is a require in multiple mode');
207
+ }
208
+ }, [multiple, removeFile, filesArray && filesArray.length, defaultData]);
205
209
 
206
210
  useEffect(() => {
207
211
  if (errorMessage) {
@@ -215,11 +219,7 @@ export const NewFile = ({
215
219
  if (!change) {
216
220
  alert('Please add change prop on File component');
217
221
  }
218
-
219
- if (!removeFile) {
220
- alert('Please add removeFile prop on File component');
221
- }
222
- }, [change, removeFile]);
222
+ }, [change]);
223
223
 
224
224
  return (
225
225
  <div
@@ -413,7 +413,7 @@ export const NewFile = ({
413
413
  status={item.status}
414
414
  size={item.file.size}
415
415
  name={item.file.name}
416
- removeFile={removeFile}
416
+ removeFile={removeFile ? removeFile : _ => _}
417
417
  radius={radius ? radius : configStyles.File.radius}
418
418
  fileFormat={item.file.type.split('/')[1].toLowerCase()}
419
419
  progressColor={progressColor ? progressColor : configStyles.File.progressColor}
@@ -449,6 +449,7 @@ NewFile.propTypes = {
449
449
  upload: PropTypes.string,
450
450
  weight: PropTypes.number,
451
451
  maxSize: PropTypes.number,
452
+ removeFile: PropTypes.func,
452
453
  errorSize: PropTypes.string,
453
454
  labelSize: PropTypes.string,
454
455
  labelColor: PropTypes.string,
@@ -475,7 +476,6 @@ NewFile.propTypes = {
475
476
  progressTrackColor: PropTypes.string,
476
477
  fileAreaImageWidth: PropTypes.string,
477
478
  listItemErrorColor: PropTypes.string,
478
- removeFile: PropTypes.func.isRequired,
479
479
  fileAreaImageHeight: PropTypes.string,
480
480
  progressFailedColor: PropTypes.string,
481
481
  progressSuccessColor: PropTypes.string,
@@ -489,6 +489,6 @@ NewFile.propTypes = {
489
489
  };
490
490
 
491
491
  NewFile.defaultProps = {
492
- maxSize: 50,
492
+ maxSize: 10,
493
493
  fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
494
494
  };
@@ -39,7 +39,6 @@ export const Select = ({
39
39
  selectedColor,
40
40
  selectedRadius,
41
41
  selectedMinHeight,
42
- selectedBorder,
43
42
  selectedPadding,
44
43
  selectedFontSize,
45
44
  selectedBoxSizing,
@@ -47,7 +46,6 @@ export const Select = ({
47
46
  selectedLineHeight,
48
47
  selectedHoverColor,
49
48
  selectedTransition,
50
- selectedBorderColor,
51
49
 
52
50
  optionsBoxShadow,
53
51
  optionsBorderRadius,
@@ -65,6 +63,9 @@ export const Select = ({
65
63
  optionItemMarginBottom,
66
64
  optionItemBackgroudColor,
67
65
  optionItemBackgroudColorHover,
66
+
67
+ boxShadow,
68
+ boxShadowHover
68
69
  }) => {
69
70
  const ref = useRef();
70
71
 
@@ -222,7 +223,6 @@ export const Select = ({
222
223
  style={{
223
224
  cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
224
225
  minHeight: selectedMinHeight ? selectedMinHeight : configStyles.SELECT.selectedMinHeight,
225
- border: selectedBorder ? selectedBorder : configStyles.SELECT.selectedBorder,
226
226
  padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
227
227
  borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
228
228
  fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
@@ -230,7 +230,7 @@ export const Select = ({
230
230
  fontWeight: selectedFontWeight ? selectedFontWeight : configStyles.SELECT.selectedFontWeight,
231
231
  lineHeight: selectedLineHeight ? selectedLineHeight : configStyles.SELECT.selectedLineHeight,
232
232
  transition: selectedTransition ? selectedTransition : configStyles.SELECT.selectedTransition,
233
- borderColor: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : selectedBorderColor ? selectedBorderColor : configStyles.SELECT.selectedBorderColor
233
+ boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.SELECT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.SELECT.boxShadowHover : boxShadow ? boxShadow : configStyles.SELECT.boxShadow
234
234
  }}
235
235
  onClick={disabled ? _ => _ : _ => handleOpenClose()}
236
236
  onMouseEnter={disabled ? _ => _ : _ => handleMouseEnter()}
@@ -378,7 +378,6 @@ Select.propTypes = {
378
378
  errorSize: PropTypes.string,
379
379
  errorColor: PropTypes.string,
380
380
  selectedColor: PropTypes.string,
381
- selectedBorder: PropTypes.string,
382
381
  selectedRadius: PropTypes.string,
383
382
  selectedMinHeight: PropTypes.string,
384
383
  selectedPadding: PropTypes.string,
@@ -388,7 +387,6 @@ Select.propTypes = {
388
387
  selectedFontWeight: PropTypes.string,
389
388
  selectedLineHeight: PropTypes.string,
390
389
  selectedTransition: PropTypes.string,
391
- selectedBorderColor: PropTypes.string,
392
390
 
393
391
  optionsBoxShadow: PropTypes.string,
394
392
  optionsBorderRadius: PropTypes.string,
@@ -406,4 +404,7 @@ Select.propTypes = {
406
404
  optionItemMarginBottom: PropTypes.string,
407
405
  optionItemBackgroudColor: PropTypes.string,
408
406
  optionItemBackgroudColorHover: PropTypes.string,
407
+
408
+ boxShadow: PropTypes.string,
409
+ boxShadowHover: PropTypes.string,
409
410
  };
@@ -16,7 +16,7 @@
16
16
  position: absolute;
17
17
  width: 100%;
18
18
  left: 0px;
19
- z-index: 1;
19
+ z-index: 9;
20
20
  max-height: 0;
21
21
  overflow: hidden;
22
22
  animation: select-show 640ms linear forwards;