@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.
- package/.eslintrc.js +30 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +42 -45
- package/.storybook/preview.js +7 -7
- package/cli-command.js +1 -1
- package/dist/index.es.js +84 -83
- package/dist/index.js +84 -83
- package/package.json +16 -4
- package/rollup.config.js +11 -11
- package/src/assets_old/icons/demo-files/demo.js +16 -18
- package/src/components/autocomplate/autocomplate.stories.js +30 -28
- package/src/components/autocomplate/index.js +145 -127
- package/src/components/button/button.stories.js +6 -6
- package/src/components/button/index.js +176 -126
- package/src/components/captcha/captcha.stories.js +12 -8
- package/src/components/captcha/index.js +47 -50
- package/src/components/checkbox/checkbox.stories.js +7 -7
- package/src/components/checkbox/index.js +77 -93
- package/src/components/file/file.stories.js +15 -15
- package/src/components/file/index.js +114 -116
- package/src/components/icon/Arrow.js +18 -18
- package/src/components/icon/CaptchaArrowDown.js +18 -18
- package/src/components/icon/CaptchaArrowUp.js +18 -18
- package/src/components/icon/CheckboxChecked.js +20 -20
- package/src/components/icon/CheckboxUnchecked.js +20 -20
- package/src/components/icon/Close.js +18 -18
- package/src/components/icon/CloseIcon.js +18 -18
- package/src/components/icon/CloseSlide.js +18 -18
- package/src/components/icon/DeleteComponent.js +19 -19
- package/src/components/icon/Dots.js +18 -18
- package/src/components/icon/HeartFilled.js +22 -23
- package/src/components/icon/HeartOutline.js +22 -22
- package/src/components/icon/Icon.js +3 -5
- package/src/components/icon/ListItemDelete.js +18 -18
- package/src/components/icon/ListItemJpeg.js +20 -20
- package/src/components/icon/ListItemJpg.js +20 -20
- package/src/components/icon/ListItemPdf.js +20 -20
- package/src/components/icon/ListItemPng.js +20 -20
- package/src/components/icon/Next.js +19 -19
- package/src/components/icon/Nextarrow.js +18 -18
- package/src/components/icon/PDF.js +18 -18
- package/src/components/icon/Prev.js +19 -19
- package/src/components/icon/RangeArrowDefault.js +41 -52
- package/src/components/icon/RangeArrowError.js +41 -52
- package/src/components/icon/RangeArrowSuccess.js +41 -52
- package/src/components/icon/RemoveFile.js +19 -19
- package/src/components/icon/ToasterClose.js +18 -18
- package/src/components/icon/ToasterError.js +18 -18
- package/src/components/icon/ToasterInfo.js +18 -18
- package/src/components/icon/ToasterSuccess.js +18 -18
- package/src/components/icon/ToasterWarning.js +18 -18
- package/src/components/icon/Tooltip.js +18 -18
- package/src/components/icon/Upload.js +24 -24
- package/src/components/input/index.js +267 -224
- package/src/components/input/input.stories.js +20 -21
- package/src/components/modal/index.js +172 -159
- package/src/components/modal/modal.stories.js +79 -78
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
- package/src/components/newAutocomplete/index.js +342 -216
- package/src/components/newFile/fileItem.js +213 -191
- package/src/components/newFile/index.js +231 -173
- package/src/components/newFile/newFile.stories.js +32 -35
- package/src/components/pagination/index.js +97 -122
- package/src/components/pagination/pagination.stories.js +362 -362
- package/src/components/pagination/paginationRange.js +42 -53
- package/src/components/radio/index.js +49 -62
- package/src/components/radio/radio.stories.js +7 -7
- package/src/components/select/index.js +316 -221
- package/src/components/select/select.stories.js +25 -14
- package/src/components/singleCheckbox/Checkbox.js +31 -34
- package/src/components/singleCheckbox/index.js +36 -45
- package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
- package/src/components/stepper/index.js +35 -30
- package/src/components/stepper/stepper.stories.js +11 -11
- package/src/components/table/index.js +280 -148
- package/src/components/table/table.stories.js +105 -217
- package/src/components/table/td.js +80 -72
- package/src/components/table/th.js +19 -16
- package/src/components/textarea/index.js +86 -62
- package/src/components/textarea/textarea.stories.js +10 -13
- package/src/components/toaster/Toast.js +177 -159
- package/src/components/toaster/index.js +107 -111
- package/src/components/toaster/toaster.stories.js +582 -367
- package/src/components/tooltip/index.js +79 -46
- package/src/components/tooltip/tooltip.stories.js +9 -10
- package/src/components/typography/index.js +108 -101
- package/src/components/typography/typography.stories.js +16 -19
- package/src/index.js +20 -20
- package/src/utils/index.js +11 -11
- package/tui.config.js +343 -341
|
@@ -1,56 +1,45 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
2
|
|
|
3
|
-
export const Dots =
|
|
3
|
+
export const Dots = '...'
|
|
4
4
|
|
|
5
5
|
const range = (start, end) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const PaginationRange = ({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import classNames from
|
|
4
|
-
import styles from
|
|
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
|
2
|
-
import { Radio } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Radio } from '.'
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
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({})
|