@xaypay/tui 0.0.119 → 0.0.121
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/dist/index.es.js +3983 -4344
- package/dist/index.js +3982 -4345
- package/package.json +1 -1
- package/tui.config.js +1 -1
- package/.eslintrc.js +0 -30
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -10
- package/.storybook/main.js +0 -48
- package/.storybook/preview.js +0 -9
- package/rollup.config.js +0 -37
- package/src/assets/attach.svg +0 -4
- package/src/assets/delete.svg +0 -4
- package/src/assets/down-arrow.svg +0 -4
- package/src/assets/figma-image.png +0 -0
- package/src/assets/heart-filled.svg +0 -17
- package/src/assets/heart-outline.svg +0 -14
- package/src/assets/like-filled.svg +0 -21
- package/src/assets/like-outline.svg +0 -21
- package/src/assets/minus.svg +0 -4
- package/src/assets/pdf.svg +0 -3
- package/src/assets/plus.svg +0 -4
- package/src/assets/range-arrow-default.svg +0 -19
- package/src/assets/range-arrow-error.svg +0 -19
- package/src/assets/range-arrow-success.svg +0 -19
- package/src/assets/star-filled.svg +0 -21
- package/src/assets/star-outline.svg +0 -5
- package/src/assets/table-settings-icon.svg +0 -3
- package/src/assets/up-arrow.svg +0 -4
- package/src/assets_old/icons/Read Me.txt +0 -7
- package/src/assets_old/icons/demo-files/demo.css +0 -152
- package/src/assets_old/icons/demo-files/demo.js +0 -28
- package/src/assets_old/icons/demo.html +0 -192
- package/src/assets_old/icons/fonts/icomoon.eot +0 -0
- package/src/assets_old/icons/fonts/icomoon.svg +0 -21
- package/src/assets_old/icons/fonts/icomoon.ttf +0 -0
- package/src/assets_old/icons/fonts/icomoon.woff +0 -0
- package/src/assets_old/icons/selection.json +0 -1
- package/src/assets_old/icons/style.css +0 -58
- package/src/components/autocomplate/autocomplate.module.css +0 -95
- package/src/components/autocomplate/autocomplate.stories.js +0 -35
- package/src/components/autocomplate/index.js +0 -164
- package/src/components/button/button.stories.js +0 -13
- package/src/components/button/index.js +0 -187
- package/src/components/captcha/captcha.module.css +0 -74
- package/src/components/captcha/captcha.stories.js +0 -21
- package/src/components/captcha/index.js +0 -158
- package/src/components/checkbox/checkbox.module.css +0 -0
- package/src/components/checkbox/checkbox.stories.js +0 -76
- package/src/components/checkbox/index.js +0 -120
- package/src/components/file/file.module.css +0 -114
- package/src/components/file/file.stories.js +0 -20
- package/src/components/file/index.js +0 -138
- package/src/components/icon/Active.js +0 -20
- package/src/components/icon/Arrow.js +0 -19
- package/src/components/icon/Cancel.js +0 -19
- package/src/components/icon/CaptchaArrowDown.js +0 -19
- package/src/components/icon/CaptchaArrowUp.js +0 -19
- package/src/components/icon/CheckboxChecked.js +0 -21
- package/src/components/icon/CheckboxUnchecked.js +0 -21
- package/src/components/icon/Close.js +0 -19
- package/src/components/icon/CloseIcon.js +0 -19
- package/src/components/icon/CloseSlide.js +0 -19
- package/src/components/icon/DeActive.js +0 -20
- package/src/components/icon/DeleteComponent.js +0 -20
- package/src/components/icon/Done.js +0 -19
- package/src/components/icon/Dots.js +0 -19
- package/src/components/icon/DownArrow.js +0 -20
- package/src/components/icon/HeartFilled.js +0 -25
- package/src/components/icon/HeartOutline.js +0 -25
- package/src/components/icon/Heic.js +0 -21
- package/src/components/icon/Icon.js +0 -11
- package/src/components/icon/ListItemDelete.js +0 -19
- package/src/components/icon/ListItemJpeg.js +0 -21
- package/src/components/icon/ListItemJpg.js +0 -21
- package/src/components/icon/ListItemPdf.js +0 -21
- package/src/components/icon/ListItemPng.js +0 -21
- package/src/components/icon/Next.js +0 -20
- package/src/components/icon/Nextarrow.js +0 -19
- package/src/components/icon/PDF.js +0 -19
- package/src/components/icon/Prev.js +0 -20
- package/src/components/icon/RangeArrowDefault.js +0 -43
- package/src/components/icon/RangeArrowError.js +0 -43
- package/src/components/icon/RangeArrowSuccess.js +0 -43
- package/src/components/icon/Reject.js +0 -19
- package/src/components/icon/RemoveFile.js +0 -20
- package/src/components/icon/Required.js +0 -19
- package/src/components/icon/ToasterClose.js +0 -19
- package/src/components/icon/ToasterError.js +0 -19
- package/src/components/icon/ToasterInfo.js +0 -19
- package/src/components/icon/ToasterSuccess.js +0 -19
- package/src/components/icon/ToasterWarning.js +0 -19
- package/src/components/icon/Tooltip.js +0 -19
- package/src/components/icon/UpArrow.js +0 -20
- package/src/components/icon/Upload.js +0 -25
- package/src/components/icon/Wrong.js +0 -21
- package/src/components/icon/Zoom.js +0 -21
- package/src/components/icon/index.js +0 -0
- package/src/components/input/index.js +0 -688
- package/src/components/input/input.module.css +0 -51
- package/src/components/input/input.stories.js +0 -26
- package/src/components/modal/index.js +0 -436
- package/src/components/modal/modal.module.css +0 -22
- package/src/components/modal/modal.stories.js +0 -88
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +0 -102
- package/src/components/newAutocomplete/autocomplete.module.css +0 -4
- package/src/components/newAutocomplete/index.js +0 -592
- package/src/components/newFile/fileItem.js +0 -281
- package/src/components/newFile/index.js +0 -731
- package/src/components/newFile/newFile.stories.js +0 -93
- package/src/components/pagination/index.js +0 -234
- package/src/components/pagination/pagination.module.css +0 -93
- package/src/components/pagination/pagination.stories.js +0 -371
- package/src/components/pagination/paginationRange.js +0 -45
- package/src/components/radio/index.js +0 -236
- package/src/components/radio/radio.module.css +0 -59
- package/src/components/radio/radio.stories.js +0 -59
- package/src/components/select/index.js +0 -534
- package/src/components/select/select.module.css +0 -93
- package/src/components/select/select.stories.js +0 -39
- package/src/components/singleCheckbox/Checkbox.js +0 -84
- package/src/components/singleCheckbox/index.js +0 -65
- package/src/components/singleCheckbox/singleCheckbox.stories.js +0 -24
- package/src/components/stepper/index.js +0 -45
- package/src/components/stepper/stepper.module.css +0 -57
- package/src/components/stepper/stepper.stories.js +0 -17
- package/src/components/table/index.js +0 -789
- package/src/components/table/table.module.css +0 -63
- package/src/components/table/table.stories.js +0 -497
- package/src/components/table/td.js +0 -429
- package/src/components/table/th.js +0 -103
- package/src/components/textarea/index.js +0 -285
- package/src/components/textarea/textarea.module.css +0 -25
- package/src/components/textarea/textarea.stories.js +0 -56
- package/src/components/toaster/Toast.js +0 -203
- package/src/components/toaster/index.js +0 -131
- package/src/components/toaster/toaster.module.css +0 -201
- package/src/components/toaster/toaster.stories.js +0 -593
- package/src/components/tooltip/index.js +0 -156
- package/src/components/tooltip/tooltip.module.css +0 -46
- package/src/components/tooltip/tooltip.stories.js +0 -30
- package/src/components/typography/index.js +0 -124
- package/src/components/typography/typography.module.css +0 -57
- package/src/components/typography/typography.stories.js +0 -22
- package/src/index.js +0 -19
- package/src/stories/Introduction.stories.mdx +0 -210
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/changelog.stories.mdx +0 -172
- package/src/stories/configuration.stories.mdx +0 -715
- package/src/stories/documentation.stories.mdx +0 -118
- package/src/stories/static/autocomplete-usage.png +0 -0
- package/src/stories/static/button-usage-icon.png +0 -0
- package/src/stories/static/button-usage.png +0 -0
- package/src/stories/static/captcha-usage.png +0 -0
- package/src/stories/static/checkbox-group-usage-2.png +0 -0
- package/src/stories/static/checkbox-group-usage.png +0 -0
- package/src/stories/static/file-single-usage.png +0 -0
- package/src/stories/static/file-usage.png +0 -0
- package/src/stories/static/input-usage.png +0 -0
- package/src/stories/static/modal-usage.png +0 -0
- package/src/stories/static/radio-usage.png +0 -0
- package/src/stories/static/select-usage.png +0 -0
- package/src/stories/static/table-body-data-structure-first-part-usage.png +0 -0
- package/src/stories/static/table-body-data-structure-second-part-usage.png +0 -0
- package/src/stories/static/table-body-data-structure-third-part-usage.png +0 -0
- package/src/stories/static/table-component-usage.png +0 -0
- package/src/stories/static/table-header-data-structure-usage.png +0 -0
- package/src/stories/static/table-new-data-structure-usage.png +0 -0
- package/src/stories/static/textarea-usage.png +0 -0
- package/src/stories/static/toaster-container-usage.png +0 -0
- package/src/stories/static/toaster-usage.png +0 -0
- package/src/stories/static/tooltip-usage.png +0 -0
- package/src/stories/usage.stories.mdx +0 -201
- package/src/utils/index.js +0 -29
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classnames from 'classnames'
|
|
4
|
-
import { compereConfigs } from './../../utils'
|
|
5
|
-
|
|
6
|
-
export const Button = ({
|
|
7
|
-
icon,
|
|
8
|
-
size,
|
|
9
|
-
type,
|
|
10
|
-
font,
|
|
11
|
-
color,
|
|
12
|
-
label,
|
|
13
|
-
width,
|
|
14
|
-
height,
|
|
15
|
-
cursor,
|
|
16
|
-
weight,
|
|
17
|
-
border,
|
|
18
|
-
radius,
|
|
19
|
-
outline,
|
|
20
|
-
padding,
|
|
21
|
-
onClick,
|
|
22
|
-
disabled,
|
|
23
|
-
className,
|
|
24
|
-
boxSizing,
|
|
25
|
-
hoverIcon,
|
|
26
|
-
hoverColor,
|
|
27
|
-
transition,
|
|
28
|
-
contentWidth,
|
|
29
|
-
disabledColor,
|
|
30
|
-
textTransform,
|
|
31
|
-
backgroundColor,
|
|
32
|
-
disabledLineColor,
|
|
33
|
-
btnIconMarginRight,
|
|
34
|
-
backgroundHoverColor,
|
|
35
|
-
disabledBackgroundColor,
|
|
36
|
-
...props
|
|
37
|
-
}) => {
|
|
38
|
-
const [isHover, setIsHover] = useState(false)
|
|
39
|
-
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (!label && !icon) {
|
|
42
|
-
alert('Add icon or label props on Button component')
|
|
43
|
-
}
|
|
44
|
-
}, [])
|
|
45
|
-
|
|
46
|
-
const configStyles = compereConfigs()
|
|
47
|
-
const classProps = classnames(className ? className : configStyles.BUTTON.className)
|
|
48
|
-
|
|
49
|
-
const handleMouseEnter = () => {
|
|
50
|
-
setIsHover(true)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const handleMouseLeave = () => {
|
|
54
|
-
setIsHover(false)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<button
|
|
59
|
-
style={{
|
|
60
|
-
display: 'flex',
|
|
61
|
-
outline: 'none',
|
|
62
|
-
alignItems: 'center',
|
|
63
|
-
justifyContent: 'center',
|
|
64
|
-
fontSize: size ? size : configStyles.BUTTON.size,
|
|
65
|
-
fontFamily: font ? font : configStyles.BUTTON.font,
|
|
66
|
-
height: height ? height : configStyles.BUTTON.height,
|
|
67
|
-
fontWeight: weight ? weight : configStyles.BUTTON.weight,
|
|
68
|
-
padding: padding ? padding : configStyles.BUTTON.padding,
|
|
69
|
-
borderRadius: radius ? radius : configStyles.BUTTON.radius,
|
|
70
|
-
boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
|
|
71
|
-
transition: transition ? transition : configStyles.BUTTON.transition,
|
|
72
|
-
border: outline ? 'none' : border ? border : configStyles.BUTTON.border,
|
|
73
|
-
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
74
|
-
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
75
|
-
textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
|
|
76
|
-
backgroundColor:
|
|
77
|
-
(outline || !outline) && disabled
|
|
78
|
-
? disabledBackgroundColor
|
|
79
|
-
? disabledBackgroundColor
|
|
80
|
-
: configStyles.BUTTON.disabledBackgroundColor
|
|
81
|
-
: outline && !disabled
|
|
82
|
-
? isHover
|
|
83
|
-
? backgroundColor
|
|
84
|
-
? backgroundColor
|
|
85
|
-
: configStyles.BUTTON.backgroundColor
|
|
86
|
-
: '#ffffff'
|
|
87
|
-
: !outline && !disabled && isHover
|
|
88
|
-
? backgroundHoverColor
|
|
89
|
-
? backgroundHoverColor
|
|
90
|
-
: configStyles.BUTTON.backgroundHoverColor
|
|
91
|
-
: backgroundColor
|
|
92
|
-
? backgroundColor
|
|
93
|
-
: configStyles.BUTTON.backgroundColor,
|
|
94
|
-
boxShadow: outline
|
|
95
|
-
? disabled
|
|
96
|
-
? `inset 0 0 0 2px ${
|
|
97
|
-
disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor
|
|
98
|
-
}`
|
|
99
|
-
: `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}`
|
|
100
|
-
: 'none',
|
|
101
|
-
color:
|
|
102
|
-
(outline || !outline) && disabled
|
|
103
|
-
? disabledColor
|
|
104
|
-
? disabledColor
|
|
105
|
-
: configStyles.BUTTON.disabledColor
|
|
106
|
-
: outline && !disabled
|
|
107
|
-
? isHover
|
|
108
|
-
? color
|
|
109
|
-
? color
|
|
110
|
-
: configStyles.BUTTON.color
|
|
111
|
-
: backgroundColor
|
|
112
|
-
? backgroundColor
|
|
113
|
-
: configStyles.BUTTON.backgroundColor
|
|
114
|
-
: !outline && !disabled && isHover
|
|
115
|
-
? hoverColor
|
|
116
|
-
? hoverColor
|
|
117
|
-
: configStyles.BUTTON.hoverColor
|
|
118
|
-
: color
|
|
119
|
-
? color
|
|
120
|
-
: configStyles.BUTTON.color,
|
|
121
|
-
}}
|
|
122
|
-
type={type ? type : configStyles.BUTTON.type}
|
|
123
|
-
disabled={disabled ? disabled : configStyles.BUTTON.disabled}
|
|
124
|
-
onClick={
|
|
125
|
-
disabled
|
|
126
|
-
? (_) => _
|
|
127
|
-
: type !== 'submit'
|
|
128
|
-
? onClick
|
|
129
|
-
? onClick
|
|
130
|
-
: () => alert('Add click event handler on Button component')
|
|
131
|
-
: (_) => _
|
|
132
|
-
}
|
|
133
|
-
onMouseEnter={handleMouseEnter}
|
|
134
|
-
onMouseLeave={handleMouseLeave}
|
|
135
|
-
className={classProps}
|
|
136
|
-
{...props}
|
|
137
|
-
>
|
|
138
|
-
{isHover && hoverIcon ? hoverIcon : icon ?? null}{' '}
|
|
139
|
-
{label && (
|
|
140
|
-
<span
|
|
141
|
-
style={{
|
|
142
|
-
marginLeft: icon
|
|
143
|
-
? btnIconMarginRight
|
|
144
|
-
? btnIconMarginRight
|
|
145
|
-
: configStyles.BUTTON.btnIconMarginRight
|
|
146
|
-
: '0px',
|
|
147
|
-
}}
|
|
148
|
-
>
|
|
149
|
-
{label}
|
|
150
|
-
</span>
|
|
151
|
-
)}{' '}
|
|
152
|
-
{!icon && !label && 'Add icon or label prop on Button component'}
|
|
153
|
-
</button>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
Button.propTypes = {
|
|
158
|
-
type: PropTypes.string,
|
|
159
|
-
size: PropTypes.string,
|
|
160
|
-
font: PropTypes.string,
|
|
161
|
-
icon: PropTypes.element,
|
|
162
|
-
hoverIcon: PropTypes.element,
|
|
163
|
-
color: PropTypes.string,
|
|
164
|
-
width: PropTypes.string,
|
|
165
|
-
outline: PropTypes.bool,
|
|
166
|
-
onClick: PropTypes.func,
|
|
167
|
-
label: PropTypes.string,
|
|
168
|
-
weight: PropTypes.string,
|
|
169
|
-
height: PropTypes.string,
|
|
170
|
-
cursor: PropTypes.string,
|
|
171
|
-
border: PropTypes.string,
|
|
172
|
-
disabled: PropTypes.bool,
|
|
173
|
-
radius: PropTypes.string,
|
|
174
|
-
padding: PropTypes.string,
|
|
175
|
-
boxSizing: PropTypes.string,
|
|
176
|
-
className: PropTypes.string,
|
|
177
|
-
hoverColor: PropTypes.string,
|
|
178
|
-
transition: PropTypes.string,
|
|
179
|
-
contentWidth: PropTypes.bool,
|
|
180
|
-
textTransform: PropTypes.string,
|
|
181
|
-
disabledColor: PropTypes.string,
|
|
182
|
-
backgroundColor: PropTypes.string,
|
|
183
|
-
disabledLineColor: PropTypes.string,
|
|
184
|
-
btnIconMarginRight: PropTypes.string,
|
|
185
|
-
backgroundHoverColor: PropTypes.string,
|
|
186
|
-
disabledBackgroundColor: PropTypes.string,
|
|
187
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
.start-point::after {
|
|
2
|
-
content: '';
|
|
3
|
-
position: absolute;
|
|
4
|
-
top: 7.5px;
|
|
5
|
-
left: 0px;
|
|
6
|
-
width: 10px;
|
|
7
|
-
height: 10px;
|
|
8
|
-
border: 2px solid #ffffff;
|
|
9
|
-
border-radius: 6px;
|
|
10
|
-
-webkit-border-radius: 6px;
|
|
11
|
-
-moz-border-radius: 6px;
|
|
12
|
-
-ms-border-radius: 6px;
|
|
13
|
-
-o-border-radius: 6px;
|
|
14
|
-
background-color: #D1D1D1;
|
|
15
|
-
z-index: -1;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.range {
|
|
19
|
-
margin: 0px;
|
|
20
|
-
-webkit-appearance: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.range::-webkit-slider-runnable-track {
|
|
24
|
-
width: 100%;
|
|
25
|
-
-webkit-appearance: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.range-default::-webkit-slider-thumb {
|
|
29
|
-
width: 34px;
|
|
30
|
-
height: 34px;
|
|
31
|
-
cursor: ew-resize;
|
|
32
|
-
border-radius: 17px;
|
|
33
|
-
-webkit-border-radius: 17px;
|
|
34
|
-
-moz-border-radius: 17px;
|
|
35
|
-
-ms-border-radius: 17px;
|
|
36
|
-
-o-border-radius: 17px;
|
|
37
|
-
-webkit-appearance: none;
|
|
38
|
-
background-position: -5px;
|
|
39
|
-
background-size: 46px 46px;
|
|
40
|
-
background-repeat: no-repeat;
|
|
41
|
-
background-image: url('./../../assets/range-arrow-default.svg');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.range-error::-webkit-slider-thumb {
|
|
45
|
-
width: 34px;
|
|
46
|
-
height: 34px;
|
|
47
|
-
cursor: ew-resize;
|
|
48
|
-
border-radius: 17px;
|
|
49
|
-
-webkit-border-radius: 17px;
|
|
50
|
-
-moz-border-radius: 17px;
|
|
51
|
-
-ms-border-radius: 17px;
|
|
52
|
-
-o-border-radius: 17px;
|
|
53
|
-
-webkit-appearance: none;
|
|
54
|
-
background-position: -5px;
|
|
55
|
-
background-size: 46px 46px;
|
|
56
|
-
background-repeat: no-repeat;
|
|
57
|
-
background-image: url('./../../assets/range-arrow-error.svg');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.range-success::-webkit-slider-thumb {
|
|
61
|
-
width: 34px;
|
|
62
|
-
height: 34px;
|
|
63
|
-
cursor: ew-resize;
|
|
64
|
-
border-radius: 17px;
|
|
65
|
-
-webkit-border-radius: 17px;
|
|
66
|
-
-moz-border-radius: 17px;
|
|
67
|
-
-ms-border-radius: 17px;
|
|
68
|
-
-o-border-radius: 17px;
|
|
69
|
-
-webkit-appearance: none;
|
|
70
|
-
background-position: -5px;
|
|
71
|
-
background-size: 46px 46px;
|
|
72
|
-
background-repeat: no-repeat;
|
|
73
|
-
background-image: url('./../../assets/range-arrow-success.svg');
|
|
74
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Captcha } from './index'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
component: Captcha,
|
|
6
|
-
title: 'Components/Captcha',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const Template = (args) => (
|
|
10
|
-
<Captcha label="Captcha" {...args}>
|
|
11
|
-
Default
|
|
12
|
-
</Captcha>
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
export const Default = Template.bind({})
|
|
16
|
-
Default.args = {
|
|
17
|
-
range: 72,
|
|
18
|
-
getRange: (range) => {
|
|
19
|
-
console.log('Range is ' + range)
|
|
20
|
-
},
|
|
21
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classnames from 'classnames'
|
|
4
|
-
import { compereConfigs } from './../../utils'
|
|
5
|
-
|
|
6
|
-
import SvgCaptchaArrowUp from './../icon/CaptchaArrowUp'
|
|
7
|
-
import SvgCaptchaArrowDown from './../icon/CaptchaArrowDown'
|
|
8
|
-
|
|
9
|
-
import styles from './captcha.module.css'
|
|
10
|
-
|
|
11
|
-
export const Captcha = ({ size, color, range, label, className, getRange }) => {
|
|
12
|
-
const [rangeNumber, setRangeNumber] = useState(0)
|
|
13
|
-
const [rangeProgress, setRangeProgress] = useState(0)
|
|
14
|
-
const configStyles = compereConfigs()
|
|
15
|
-
const classProps = classnames(className ? className : configStyles.CAPTCHA.className)
|
|
16
|
-
|
|
17
|
-
const handleRange = (e) => {
|
|
18
|
-
const value = e.target.value
|
|
19
|
-
getRange(value)
|
|
20
|
-
setRangeProgress(value)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (range === undefined || range === null) {
|
|
25
|
-
alert('Please add range property on Captcha component')
|
|
26
|
-
}
|
|
27
|
-
if (!getRange) {
|
|
28
|
-
alert('Please add getRange property on Captcha component')
|
|
29
|
-
}
|
|
30
|
-
if (range >= 100) {
|
|
31
|
-
setRangeNumber(100)
|
|
32
|
-
} else if (range <= 0) {
|
|
33
|
-
setRangeNumber(0)
|
|
34
|
-
} else {
|
|
35
|
-
const roundedRange = Math.ceil(range / 5) * 5
|
|
36
|
-
setRangeNumber(Math.min(roundedRange, 100))
|
|
37
|
-
}
|
|
38
|
-
}, [range, getRange])
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div className={classProps}>
|
|
42
|
-
{label && (
|
|
43
|
-
<p
|
|
44
|
-
style={{
|
|
45
|
-
fontSize: size ? size : configStyles.CAPTCHA.size,
|
|
46
|
-
color: color ? color : configStyles.CAPTCHA.color,
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
{label}
|
|
50
|
-
</p>
|
|
51
|
-
)}
|
|
52
|
-
<div
|
|
53
|
-
style={{
|
|
54
|
-
width: '100%',
|
|
55
|
-
height: '76px',
|
|
56
|
-
maxWidth: '400px',
|
|
57
|
-
position: 'relative',
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
<div
|
|
61
|
-
style={{
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
top: '0px',
|
|
64
|
-
height: '15px',
|
|
65
|
-
left: `calc(${rangeNumber}% - 6px)`,
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<SvgCaptchaArrowDown />
|
|
69
|
-
</div>
|
|
70
|
-
<div
|
|
71
|
-
style={{
|
|
72
|
-
position: 'absolute',
|
|
73
|
-
display: 'flex',
|
|
74
|
-
top: '23px',
|
|
75
|
-
left: '0px',
|
|
76
|
-
width: '100%',
|
|
77
|
-
height: '30px',
|
|
78
|
-
alignItems: 'center',
|
|
79
|
-
zIndex: 1,
|
|
80
|
-
}}
|
|
81
|
-
className={styles['start-point']}
|
|
82
|
-
>
|
|
83
|
-
<div
|
|
84
|
-
style={{
|
|
85
|
-
position: 'absolute',
|
|
86
|
-
top: '13px',
|
|
87
|
-
right: '0px',
|
|
88
|
-
width: '100%',
|
|
89
|
-
height: '4px',
|
|
90
|
-
backgroundColor: '#EEEEEE',
|
|
91
|
-
borderRadius: '10px',
|
|
92
|
-
zIndex: -2,
|
|
93
|
-
}}
|
|
94
|
-
></div>
|
|
95
|
-
<input
|
|
96
|
-
min={0}
|
|
97
|
-
step={5}
|
|
98
|
-
max={100}
|
|
99
|
-
type="range"
|
|
100
|
-
value={rangeProgress}
|
|
101
|
-
style={{
|
|
102
|
-
height: '4px',
|
|
103
|
-
width: '100%',
|
|
104
|
-
borderRadius: '2px',
|
|
105
|
-
cursor: 'pointer',
|
|
106
|
-
backgroundColor: 'transparent',
|
|
107
|
-
}}
|
|
108
|
-
className={`
|
|
109
|
-
${styles['range']}
|
|
110
|
-
${
|
|
111
|
-
+rangeProgress === rangeNumber
|
|
112
|
-
? styles['range-success']
|
|
113
|
-
: +rangeProgress !== rangeNumber && +rangeProgress > 0
|
|
114
|
-
? styles['range-error']
|
|
115
|
-
: styles['range-default']
|
|
116
|
-
}
|
|
117
|
-
`}
|
|
118
|
-
onInput={handleRange}
|
|
119
|
-
/>
|
|
120
|
-
<div
|
|
121
|
-
style={{
|
|
122
|
-
position: 'absolute',
|
|
123
|
-
top: '13px',
|
|
124
|
-
left: '0px',
|
|
125
|
-
width: rangeProgress + '%',
|
|
126
|
-
height: '4px',
|
|
127
|
-
borderRadius: '2px',
|
|
128
|
-
backgroundColor:
|
|
129
|
-
+rangeProgress === rangeNumber
|
|
130
|
-
? '#0DA574'
|
|
131
|
-
: +rangeProgress !== rangeNumber && +rangeProgress > 0
|
|
132
|
-
? '#EE0000'
|
|
133
|
-
: 'transparent',
|
|
134
|
-
zIndex: -1,
|
|
135
|
-
}}
|
|
136
|
-
></div>
|
|
137
|
-
</div>
|
|
138
|
-
<div
|
|
139
|
-
style={{
|
|
140
|
-
position: 'absolute',
|
|
141
|
-
bottom: '0px',
|
|
142
|
-
height: '15px',
|
|
143
|
-
left: `calc(${rangeNumber}% - 6px)`,
|
|
144
|
-
transform: 'translate(-50% -50%)',
|
|
145
|
-
}}
|
|
146
|
-
>
|
|
147
|
-
<SvgCaptchaArrowUp />
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
Captcha.propTypes = {
|
|
155
|
-
label: PropTypes.string,
|
|
156
|
-
range: PropTypes.number.isRequired,
|
|
157
|
-
getRange: PropTypes.func.isRequired,
|
|
158
|
-
}
|
|
File without changes
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { Checkbox, DirectionMode } from '.'
|
|
3
|
-
import SvgCancel from './../icon/Cancel'
|
|
4
|
-
import SvgDone from './../icon/Done'
|
|
5
|
-
export default {
|
|
6
|
-
component: Checkbox,
|
|
7
|
-
title: 'Components/Checkbox',
|
|
8
|
-
argsType: {
|
|
9
|
-
direction: {
|
|
10
|
-
options: Object.values(DirectionMode),
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const checkBoxData = [
|
|
16
|
-
{
|
|
17
|
-
id: 1,
|
|
18
|
-
label: '1 checkbox',
|
|
19
|
-
checked: true,
|
|
20
|
-
disabled: true,
|
|
21
|
-
ignoreDisabledForChecked: true,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: 2,
|
|
25
|
-
label: '2 checkbox',
|
|
26
|
-
checked: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: 3,
|
|
30
|
-
label: '3 checkbox',
|
|
31
|
-
checked: true,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 4,
|
|
35
|
-
label: '4 checkbox',
|
|
36
|
-
checked: true,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 5,
|
|
40
|
-
label: '5 checkbox',
|
|
41
|
-
checked: true,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 6,
|
|
45
|
-
label: '6 checkbox',
|
|
46
|
-
checked: true,
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
const Template = (args) => {
|
|
51
|
-
const [innerData, setInnerData] = useState(checkBoxData)
|
|
52
|
-
|
|
53
|
-
const handleGetData = (data) => {
|
|
54
|
-
console.log(data, 'data - - -')
|
|
55
|
-
setInnerData(data.checkboxArr)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<Checkbox
|
|
60
|
-
{...args}
|
|
61
|
-
data={innerData}
|
|
62
|
-
getData={handleGetData}
|
|
63
|
-
checkedIcon={<SvgCancel />}
|
|
64
|
-
unCheckedIcon={<SvgDone />}
|
|
65
|
-
keyNames={{
|
|
66
|
-
id: 'id',
|
|
67
|
-
label: 'label',
|
|
68
|
-
checked: 'checked',
|
|
69
|
-
disabled: 'disabled',
|
|
70
|
-
ignoreDisabledForChecked: 'ignoreDisabledForChecked',
|
|
71
|
-
}}
|
|
72
|
-
/>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const Default = Template.bind({})
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classnames from 'classnames'
|
|
4
|
-
import { SingleCheckbox } from './../singleCheckbox'
|
|
5
|
-
import { compereConfigs } from './../../utils'
|
|
6
|
-
|
|
7
|
-
export const DirectionMode = {
|
|
8
|
-
VERTICAL: 'vertical',
|
|
9
|
-
HORINZONTAL: 'horizontal',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Checkbox = ({
|
|
13
|
-
data,
|
|
14
|
-
getData,
|
|
15
|
-
keyNames,
|
|
16
|
-
className,
|
|
17
|
-
direction,
|
|
18
|
-
checkedIcon,
|
|
19
|
-
unCheckedIcon,
|
|
20
|
-
labelMarginLeft,
|
|
21
|
-
checkBoxMarginBottom,
|
|
22
|
-
}) => {
|
|
23
|
-
const configStyles = compereConfigs()
|
|
24
|
-
const [innerData, setInnerData] = useState([])
|
|
25
|
-
const classProps = classnames(className ? className : configStyles.CHECKBOX.className)
|
|
26
|
-
|
|
27
|
-
const handleSendData = (_, e, index) => {
|
|
28
|
-
const dataForSend = {}
|
|
29
|
-
setInnerData((prev) =>
|
|
30
|
-
prev.map((innerItem, innerIndex) => {
|
|
31
|
-
if (innerIndex === index) {
|
|
32
|
-
innerItem[keyNames.checked] = !innerItem[keyNames.checked]
|
|
33
|
-
dataForSend.item = innerItem
|
|
34
|
-
dataForSend.itemIndex = innerIndex
|
|
35
|
-
dataForSend.itemId = innerItem[keyNames.id]
|
|
36
|
-
}
|
|
37
|
-
return innerItem
|
|
38
|
-
})
|
|
39
|
-
)
|
|
40
|
-
dataForSend.checkboxArr = innerData
|
|
41
|
-
getData && getData(dataForSend)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (Array.isArray(data)) {
|
|
46
|
-
setInnerData(data)
|
|
47
|
-
} else {
|
|
48
|
-
setInnerData([data])
|
|
49
|
-
}
|
|
50
|
-
}, [data])
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<div
|
|
54
|
-
style={{
|
|
55
|
-
width: '100%',
|
|
56
|
-
display: 'flex',
|
|
57
|
-
flexDirection: direction === 'vertical' ? 'column' : 'row',
|
|
58
|
-
}}
|
|
59
|
-
className={classProps}
|
|
60
|
-
>
|
|
61
|
-
{innerData &&
|
|
62
|
-
innerData.length > 0 &&
|
|
63
|
-
innerData.map((item, index) => {
|
|
64
|
-
return (
|
|
65
|
-
<div
|
|
66
|
-
key={`TUI_${index}_checkbox`}
|
|
67
|
-
style={{
|
|
68
|
-
width: 'fit-content',
|
|
69
|
-
marginBottom:
|
|
70
|
-
direction === 'vertical'
|
|
71
|
-
? checkBoxMarginBottom
|
|
72
|
-
? checkBoxMarginBottom
|
|
73
|
-
: configStyles.CHECKBOX.checkBoxMarginBottom
|
|
74
|
-
: '0px',
|
|
75
|
-
}}
|
|
76
|
-
>
|
|
77
|
-
<SingleCheckbox
|
|
78
|
-
data={item}
|
|
79
|
-
index={index}
|
|
80
|
-
checkedColor="#00236A"
|
|
81
|
-
unCheckedColor="#D1D1D1"
|
|
82
|
-
checkedIcon={checkedIcon}
|
|
83
|
-
label={item[keyNames.label]}
|
|
84
|
-
unCheckedIcon={unCheckedIcon}
|
|
85
|
-
handleChecked={handleSendData}
|
|
86
|
-
checked={item[keyNames.checked]}
|
|
87
|
-
disabled={item[keyNames.disabled]}
|
|
88
|
-
ignoreDisabledForChecked={item[keyNames.ignoreDisabledForChecked]}
|
|
89
|
-
labelMarginLeft={
|
|
90
|
-
labelMarginLeft ? labelMarginLeft : configStyles.CHECKBOX.labelMarginLeft
|
|
91
|
-
}
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
)
|
|
95
|
-
})}
|
|
96
|
-
</div>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
Checkbox.propTypes = {
|
|
101
|
-
getData: PropTypes.func,
|
|
102
|
-
keyNames: PropTypes.object,
|
|
103
|
-
checkedIcon: PropTypes.element,
|
|
104
|
-
unCheckedIcon: PropTypes.element,
|
|
105
|
-
labelMarginLeft: PropTypes.string,
|
|
106
|
-
checkBoxMarginBottom: PropTypes.string,
|
|
107
|
-
direction: PropTypes.oneOf(Object.values(DirectionMode)),
|
|
108
|
-
data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
Checkbox.defaultProps = {
|
|
112
|
-
direction: 'vertical',
|
|
113
|
-
keyNames: {
|
|
114
|
-
id: 'id',
|
|
115
|
-
label: 'label',
|
|
116
|
-
checked: 'checked',
|
|
117
|
-
disabled: 'disabled',
|
|
118
|
-
ignoreDisabledForChecked: 'ignoreDisabledForChecked',
|
|
119
|
-
},
|
|
120
|
-
}
|