@xaypay/tui 0.0.105 → 0.0.106

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 (91) hide show
  1. package/.eslintrc.js +30 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.prettierrc +10 -0
  4. package/.storybook/main.js +42 -45
  5. package/.storybook/preview.js +7 -7
  6. package/cli-command.js +1 -1
  7. package/dist/index.es.js +84 -83
  8. package/dist/index.js +84 -83
  9. package/package.json +16 -4
  10. package/rollup.config.js +11 -11
  11. package/src/assets_old/icons/demo-files/demo.js +16 -18
  12. package/src/components/autocomplate/autocomplate.stories.js +30 -28
  13. package/src/components/autocomplate/index.js +145 -127
  14. package/src/components/button/button.stories.js +6 -6
  15. package/src/components/button/index.js +176 -126
  16. package/src/components/captcha/captcha.stories.js +12 -8
  17. package/src/components/captcha/index.js +47 -50
  18. package/src/components/checkbox/checkbox.stories.js +7 -7
  19. package/src/components/checkbox/index.js +77 -93
  20. package/src/components/file/file.stories.js +15 -15
  21. package/src/components/file/index.js +114 -116
  22. package/src/components/icon/Arrow.js +18 -18
  23. package/src/components/icon/CaptchaArrowDown.js +18 -18
  24. package/src/components/icon/CaptchaArrowUp.js +18 -18
  25. package/src/components/icon/CheckboxChecked.js +20 -20
  26. package/src/components/icon/CheckboxUnchecked.js +20 -20
  27. package/src/components/icon/Close.js +18 -18
  28. package/src/components/icon/CloseIcon.js +18 -18
  29. package/src/components/icon/CloseSlide.js +18 -18
  30. package/src/components/icon/DeleteComponent.js +19 -19
  31. package/src/components/icon/Dots.js +18 -18
  32. package/src/components/icon/HeartFilled.js +22 -23
  33. package/src/components/icon/HeartOutline.js +22 -22
  34. package/src/components/icon/Icon.js +3 -5
  35. package/src/components/icon/ListItemDelete.js +18 -18
  36. package/src/components/icon/ListItemJpeg.js +20 -20
  37. package/src/components/icon/ListItemJpg.js +20 -20
  38. package/src/components/icon/ListItemPdf.js +20 -20
  39. package/src/components/icon/ListItemPng.js +20 -20
  40. package/src/components/icon/Next.js +19 -19
  41. package/src/components/icon/Nextarrow.js +18 -18
  42. package/src/components/icon/PDF.js +18 -18
  43. package/src/components/icon/Prev.js +19 -19
  44. package/src/components/icon/RangeArrowDefault.js +41 -52
  45. package/src/components/icon/RangeArrowError.js +41 -52
  46. package/src/components/icon/RangeArrowSuccess.js +41 -52
  47. package/src/components/icon/RemoveFile.js +19 -19
  48. package/src/components/icon/ToasterClose.js +18 -18
  49. package/src/components/icon/ToasterError.js +18 -18
  50. package/src/components/icon/ToasterInfo.js +18 -18
  51. package/src/components/icon/ToasterSuccess.js +18 -18
  52. package/src/components/icon/ToasterWarning.js +18 -18
  53. package/src/components/icon/Tooltip.js +18 -18
  54. package/src/components/icon/Upload.js +24 -24
  55. package/src/components/input/index.js +267 -224
  56. package/src/components/input/input.stories.js +20 -21
  57. package/src/components/modal/index.js +172 -159
  58. package/src/components/modal/modal.stories.js +79 -78
  59. package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
  60. package/src/components/newAutocomplete/index.js +342 -216
  61. package/src/components/newFile/fileItem.js +213 -191
  62. package/src/components/newFile/index.js +231 -173
  63. package/src/components/newFile/newFile.stories.js +32 -35
  64. package/src/components/pagination/index.js +97 -122
  65. package/src/components/pagination/pagination.stories.js +362 -362
  66. package/src/components/pagination/paginationRange.js +42 -53
  67. package/src/components/radio/index.js +49 -62
  68. package/src/components/radio/radio.stories.js +7 -7
  69. package/src/components/select/index.js +316 -221
  70. package/src/components/select/select.stories.js +25 -14
  71. package/src/components/singleCheckbox/Checkbox.js +31 -34
  72. package/src/components/singleCheckbox/index.js +36 -45
  73. package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
  74. package/src/components/stepper/index.js +35 -30
  75. package/src/components/stepper/stepper.stories.js +11 -11
  76. package/src/components/table/index.js +280 -148
  77. package/src/components/table/table.stories.js +105 -217
  78. package/src/components/table/td.js +80 -72
  79. package/src/components/table/th.js +19 -16
  80. package/src/components/textarea/index.js +86 -62
  81. package/src/components/textarea/textarea.stories.js +10 -13
  82. package/src/components/toaster/Toast.js +177 -159
  83. package/src/components/toaster/index.js +107 -111
  84. package/src/components/toaster/toaster.stories.js +582 -367
  85. package/src/components/tooltip/index.js +79 -46
  86. package/src/components/tooltip/tooltip.stories.js +9 -10
  87. package/src/components/typography/index.js +108 -101
  88. package/src/components/typography/typography.stories.js +16 -19
  89. package/src/index.js +20 -20
  90. package/src/utils/index.js +11 -11
  91. package/tui.config.js +343 -341
@@ -1,56 +1,45 @@
1
- import React, { useMemo } from "react";
1
+ import { useMemo } from 'react'
2
2
 
3
- export const Dots = "...";
3
+ export const Dots = '...'
4
4
 
5
5
  const range = (start, end) => {
6
- const length = end - start + 1;
7
- return Array.from({ length }, (_, idx) => idx + start);
8
- };
9
-
10
- export const PaginationRange = ({
11
- offset,
12
- currentTotalCount,
13
- currentPageNumber,
14
- }) => {
15
- const paginationRange = useMemo(() => {
16
- const firstPageIndex = 1;
17
- const totalPageCount = Math.ceil(currentTotalCount / offset);
18
- const lastPageIndex = totalPageCount;
19
-
20
- if (7 >= totalPageCount) {
21
- return range(1, totalPageCount);
22
- }
23
-
24
- const leftSiblingIndex = Math.max(currentPageNumber - 1, 1);
25
- const rightSiblingIndex = Math.min(currentPageNumber + 1, totalPageCount);
26
-
27
- const shouldShowLeftDots = leftSiblingIndex > 2;
28
- const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;
29
-
30
- if (!shouldShowLeftDots && shouldShowRightDots) {
31
-
32
- let leftItemCount = currentPageNumber === 4 && lastPageIndex >= 7 ? 5 : 4;
33
-
34
- let leftRange = range(1, leftItemCount);
35
- return [...leftRange, Dots, totalPageCount];
36
-
37
- } else if (shouldShowLeftDots && !shouldShowRightDots) {
38
-
39
- let rightItemCount = currentPageNumber === lastPageIndex - 3 && lastPageIndex >= 7 ? 4 : 3;
40
-
41
- let rightRange = range(totalPageCount - rightItemCount + 1, totalPageCount);
42
- return [firstPageIndex, Dots, ...rightRange];
43
-
44
- } else if (shouldShowLeftDots && shouldShowRightDots) {
45
-
46
- let middleRange = range(leftSiblingIndex, rightSiblingIndex);
47
- return [firstPageIndex, Dots, ...middleRange, Dots, lastPageIndex];
48
-
49
- } else {
50
- return range(firstPageIndex, totalPageCount);
51
- }
52
-
53
- }, [currentTotalCount, offset, currentPageNumber]);
54
-
55
- return paginationRange;
56
- };
6
+ const length = end - start + 1
7
+ return Array.from({ length }, (_, idx) => idx + start)
8
+ }
9
+
10
+ export const PaginationRange = ({ offset, currentTotalCount, currentPageNumber }) => {
11
+ const paginationRange = useMemo(() => {
12
+ const firstPageIndex = 1
13
+ const totalPageCount = Math.ceil(currentTotalCount / offset)
14
+ const lastPageIndex = totalPageCount
15
+
16
+ if (7 >= totalPageCount) {
17
+ return range(1, totalPageCount)
18
+ }
19
+
20
+ const leftSiblingIndex = Math.max(currentPageNumber - 1, 1)
21
+ const rightSiblingIndex = Math.min(currentPageNumber + 1, totalPageCount)
22
+
23
+ const shouldShowLeftDots = leftSiblingIndex > 2
24
+ const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2
25
+
26
+ if (!shouldShowLeftDots && shouldShowRightDots) {
27
+ let leftItemCount = currentPageNumber === 4 && lastPageIndex >= 7 ? 5 : 4
28
+
29
+ let leftRange = range(1, leftItemCount)
30
+ return [...leftRange, Dots, totalPageCount]
31
+ } else if (shouldShowLeftDots && !shouldShowRightDots) {
32
+ let rightItemCount = currentPageNumber === lastPageIndex - 3 && lastPageIndex >= 7 ? 4 : 3
33
+
34
+ let rightRange = range(totalPageCount - rightItemCount + 1, totalPageCount)
35
+ return [firstPageIndex, Dots, ...rightRange]
36
+ } else if (shouldShowLeftDots && shouldShowRightDots) {
37
+ let middleRange = range(leftSiblingIndex, rightSiblingIndex)
38
+ return [firstPageIndex, Dots, ...middleRange, Dots, lastPageIndex]
39
+ } else {
40
+ return range(firstPageIndex, totalPageCount)
41
+ }
42
+ }, [currentTotalCount, offset, currentPageNumber])
43
+
44
+ return paginationRange
45
+ }
@@ -1,68 +1,55 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import classNames from "classnames";
4
- import styles from "./radio.module.css";
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import classNames from 'classnames'
4
+ import styles from './radio.module.css'
5
5
 
6
- export const Radio = ({
7
- disabled,
8
- defaultChecked,
9
- required,
10
- className,
11
- name,
12
- value,
13
- jsonData,
14
- label,
15
- keyNames,
16
- ...props
17
- }) => {
18
- const classProps = classNames(styles.checkbox, className);
19
- const parseData = jsonData.length !== 0 ? JSON.parse(jsonData) : [];
6
+ export const Radio = ({ disabled, defaultChecked, required, className, name, value, jsonData, label, ...props }) => {
7
+ const classProps = classNames(styles.checkbox, className)
8
+ const parseData = jsonData.length !== 0 ? JSON.parse(jsonData) : []
20
9
 
21
- return (
22
- <>
23
- {parseData.map((element, id) => {
24
- return (
25
- <label className={`${styles["radio-wrap"]} radio-wrap-rem`} key={element.value}>
26
- <input
27
- type="radio"
28
- className={classProps}
29
- disabled={disabled}
30
- required={required}
31
- defaultChecked={id === 0 ? defaultChecked : ""}
32
- value={value ? value : element.value}
33
- name={name ? name : element.name}
34
- {...props}
35
- />
36
- <span className={`${styles["radio-checkmark"]} radio-checkmark-rem`}/>
37
- {element.label ? (
38
- <span className={styles.labelRadio}>
39
- {label ? label : element.label}
40
- </span>
41
- ) : (
42
- ""
43
- )}
44
- </label>
45
- );
46
- })}
47
- </>
48
- );
49
- };
10
+ return (
11
+ <>
12
+ {parseData.map((element, id) => {
13
+ return (
14
+ <label className={`${styles['radio-wrap']} radio-wrap-rem`} key={element.value}>
15
+ <input
16
+ type="radio"
17
+ className={classProps}
18
+ disabled={disabled}
19
+ required={required}
20
+ defaultChecked={id === 0 ? defaultChecked : ''}
21
+ value={value ? value : element.value}
22
+ name={name ? name : element.name}
23
+ {...props}
24
+ />
25
+ <span className={`${styles['radio-checkmark']} radio-checkmark-rem`} />
26
+ {element.label ? (
27
+ <span className={styles.labelRadio}>{label ? label : element.label}</span>
28
+ ) : (
29
+ ''
30
+ )}
31
+ </label>
32
+ )
33
+ })}
34
+ </>
35
+ )
36
+ }
50
37
 
51
38
  Radio.propTypes = {
52
- className: PropTypes.string,
53
- onChange: PropTypes.func,
54
- required: PropTypes.bool,
55
- defaultChecked: PropTypes.bool,
56
- disabled: PropTypes.bool,
57
- name: PropTypes.string,
58
- value: PropTypes.string,
59
- jsonData: PropTypes.string,
60
- label: PropTypes.string,
61
- keyNames: PropTypes.object,
62
- };
39
+ className: PropTypes.string,
40
+ onChange: PropTypes.func,
41
+ required: PropTypes.bool,
42
+ defaultChecked: PropTypes.bool,
43
+ disabled: PropTypes.bool,
44
+ name: PropTypes.string,
45
+ value: PropTypes.string,
46
+ jsonData: PropTypes.string,
47
+ label: PropTypes.string,
48
+ keyNames: PropTypes.object,
49
+ }
63
50
 
64
51
  Radio.defaultProps = {
65
- onChange: undefined,
66
- jsonData:
67
- '[{"value":"email", "name":"contact", "label":"Email", "id":"contactChoice1"}, {"value":"phone", "name":"contact", "label":"Phone", "id":"contactChoice2"}]',
68
- };
52
+ onChange: undefined,
53
+ jsonData:
54
+ '[{"value":"email", "name":"contact", "label":"Email", "id":"contactChoice1"}, {"value":"phone", "name":"contact", "label":"Phone", "id":"contactChoice2"}]',
55
+ }
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { Radio } from ".";
1
+ import React from 'react'
2
+ import { Radio } from '.'
3
3
  export default {
4
- component: Radio,
5
- title: "Components/Radio",
6
- };
4
+ component: Radio,
5
+ title: 'Components/Radio',
6
+ }
7
7
 
8
- const Template = (args) => <Radio {...args} />;
8
+ const Template = (args) => <Radio {...args} />
9
9
 
10
- export const RadioButton = Template.bind({});
10
+ export const RadioButton = Template.bind({})