@xaypay/tui 0.0.105 → 0.0.107
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 +105 -94
- package/dist/index.js +105 -94
- 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 +214 -191
- package/src/components/newFile/index.js +235 -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 +318 -223
- 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 +180 -158
- package/src/components/toaster/index.js +108 -111
- package/src/components/toaster/toaster.module.css +13 -0
- 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/stories/configuration.stories.mdx +1 -0
- package/src/utils/index.js +11 -11
- package/tui.config.js +343 -340
|
@@ -1,136 +1,186 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classnames from 'classnames'
|
|
4
|
-
import { compereConfigs } from './../../utils'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classnames from 'classnames'
|
|
4
|
+
import { compereConfigs } from './../../utils'
|
|
5
5
|
|
|
6
6
|
export const Button = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
7
|
+
icon,
|
|
8
|
+
hoverIcon,
|
|
9
|
+
size,
|
|
10
|
+
type,
|
|
11
|
+
font,
|
|
12
|
+
color,
|
|
13
|
+
label,
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
cursor,
|
|
17
|
+
weight,
|
|
18
|
+
border,
|
|
19
|
+
radius,
|
|
20
|
+
outline,
|
|
21
|
+
padding,
|
|
22
|
+
onClick,
|
|
23
|
+
disabled,
|
|
24
|
+
className,
|
|
25
|
+
boxSizing,
|
|
26
|
+
hoverColor,
|
|
27
|
+
transition,
|
|
28
|
+
contentWidth,
|
|
29
|
+
disabledColor,
|
|
30
|
+
textTransform,
|
|
31
|
+
backgroundColor,
|
|
32
|
+
disabledLineColor,
|
|
33
|
+
btnIconMarginRight,
|
|
34
|
+
backgroundHoverColor,
|
|
35
|
+
disabledBackgroundColor,
|
|
36
|
+
...props
|
|
36
37
|
}) => {
|
|
38
|
+
const [isHover, setIsHover] = useState(false)
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!label && !icon) {
|
|
42
|
+
alert('Add icon or label props on Button component')
|
|
43
|
+
}
|
|
44
|
+
}, [])
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
alert('Add icon or label props on Button component');
|
|
43
|
-
}
|
|
44
|
-
}, []);
|
|
46
|
+
const configStyles = compereConfigs()
|
|
47
|
+
const classProps = classnames(className)
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
49
|
+
const handleMouseEnter = () => {
|
|
50
|
+
setIsHover(true)
|
|
51
|
+
}
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const handleMouseLeave = () => {
|
|
56
|
-
setIsHover(false);
|
|
57
|
-
};
|
|
53
|
+
const handleMouseLeave = () => {
|
|
54
|
+
setIsHover(false)
|
|
55
|
+
}
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
57
|
+
return (
|
|
58
|
+
<button
|
|
59
|
+
style={{
|
|
60
|
+
display: 'flex',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
fontSize: size ? size : configStyles.BUTTON.size,
|
|
64
|
+
fontFamily: font ? font : configStyles.BUTTON.font,
|
|
65
|
+
height: height ? height : configStyles.BUTTON.height,
|
|
66
|
+
fontWeight: weight ? weight : configStyles.BUTTON.weight,
|
|
67
|
+
padding: padding ? padding : configStyles.BUTTON.padding,
|
|
68
|
+
borderRadius: radius ? radius : configStyles.BUTTON.radius,
|
|
69
|
+
boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
|
|
70
|
+
transition: transition ? transition : configStyles.BUTTON.transition,
|
|
71
|
+
border: outline ? 'none' : border ? border : configStyles.BUTTON.border,
|
|
72
|
+
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
73
|
+
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
74
|
+
textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
|
|
75
|
+
backgroundColor:
|
|
76
|
+
(outline || !outline) && disabled
|
|
77
|
+
? disabledBackgroundColor
|
|
78
|
+
? disabledBackgroundColor
|
|
79
|
+
: configStyles.BUTTON.disabledBackgroundColor
|
|
80
|
+
: outline && !disabled
|
|
81
|
+
? isHover
|
|
82
|
+
? backgroundColor
|
|
83
|
+
? backgroundColor
|
|
84
|
+
: configStyles.BUTTON.backgroundColor
|
|
85
|
+
: '#ffffff'
|
|
86
|
+
: !outline && !disabled && isHover
|
|
87
|
+
? backgroundHoverColor
|
|
88
|
+
? backgroundHoverColor
|
|
89
|
+
: configStyles.BUTTON.backgroundHoverColor
|
|
90
|
+
: backgroundColor
|
|
91
|
+
? backgroundColor
|
|
92
|
+
: configStyles.BUTTON.backgroundColor,
|
|
93
|
+
boxShadow: outline
|
|
94
|
+
? disabled
|
|
95
|
+
? `inset 0 0 0 2px ${
|
|
96
|
+
disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor
|
|
97
|
+
}`
|
|
98
|
+
: `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}`
|
|
99
|
+
: 'none',
|
|
100
|
+
color:
|
|
101
|
+
(outline || !outline) && disabled
|
|
102
|
+
? disabledColor
|
|
103
|
+
? disabledColor
|
|
104
|
+
: configStyles.BUTTON.disabledColor
|
|
105
|
+
: outline && !disabled
|
|
106
|
+
? isHover
|
|
107
|
+
? color
|
|
108
|
+
? color
|
|
109
|
+
: configStyles.BUTTON.color
|
|
110
|
+
: backgroundColor
|
|
111
|
+
? backgroundColor
|
|
112
|
+
: configStyles.BUTTON.backgroundColor
|
|
113
|
+
: !outline && !disabled && isHover
|
|
114
|
+
? hoverColor
|
|
115
|
+
? hoverColor
|
|
116
|
+
: configStyles.BUTTON.hoverColor
|
|
117
|
+
: color
|
|
118
|
+
? color
|
|
119
|
+
: configStyles.BUTTON.color,
|
|
120
|
+
}}
|
|
121
|
+
type={type ? type : configStyles.BUTTON.type}
|
|
122
|
+
disabled={disabled ? disabled : configStyles.BUTTON.disabled}
|
|
123
|
+
onClick={
|
|
124
|
+
disabled
|
|
125
|
+
? (_) => _
|
|
126
|
+
: type !== 'submit'
|
|
127
|
+
? onClick
|
|
128
|
+
? onClick
|
|
129
|
+
: () => alert('Add click event handler on Button component')
|
|
130
|
+
: (_) => _
|
|
131
|
+
}
|
|
132
|
+
onMouseEnter={handleMouseEnter}
|
|
133
|
+
onMouseLeave={handleMouseLeave}
|
|
134
|
+
className={classProps}
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
{isHover && hoverIcon ? hoverIcon : icon ?? null}{' '}
|
|
138
|
+
{label && (
|
|
139
|
+
<span
|
|
140
|
+
style={{
|
|
141
|
+
marginLeft: icon
|
|
142
|
+
? btnIconMarginRight
|
|
143
|
+
? btnIconMarginRight
|
|
144
|
+
: configStyles.BUTTON.btnIconMarginRight
|
|
145
|
+
: '0px',
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
{label}
|
|
149
|
+
</span>
|
|
150
|
+
)}{' '}
|
|
151
|
+
{!icon && !label && 'Add icon or label prop on Button component'}
|
|
152
|
+
</button>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
106
155
|
|
|
107
156
|
Button.propTypes = {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
157
|
+
type: PropTypes.string,
|
|
158
|
+
size: PropTypes.string,
|
|
159
|
+
font: PropTypes.string,
|
|
160
|
+
icon: PropTypes.element,
|
|
161
|
+
hoverIcon: PropTypes.element,
|
|
162
|
+
color: PropTypes.string,
|
|
163
|
+
width: PropTypes.string,
|
|
164
|
+
outline: PropTypes.bool,
|
|
165
|
+
onClick: PropTypes.func,
|
|
166
|
+
label: PropTypes.string,
|
|
167
|
+
weight: PropTypes.string,
|
|
168
|
+
height: PropTypes.string,
|
|
169
|
+
cursor: PropTypes.string,
|
|
170
|
+
border: PropTypes.string,
|
|
171
|
+
disabled: PropTypes.bool,
|
|
172
|
+
radius: PropTypes.string,
|
|
173
|
+
padding: PropTypes.string,
|
|
174
|
+
boxSizing: PropTypes.string,
|
|
175
|
+
className: PropTypes.string,
|
|
176
|
+
hoverColor: PropTypes.string,
|
|
177
|
+
transition: PropTypes.string,
|
|
178
|
+
contentWidth: PropTypes.bool,
|
|
179
|
+
textTransform: PropTypes.string,
|
|
180
|
+
disabledColor: PropTypes.string,
|
|
181
|
+
backgroundColor: PropTypes.string,
|
|
182
|
+
disabledLineColor: PropTypes.string,
|
|
183
|
+
btnIconMarginRight: PropTypes.string,
|
|
184
|
+
backgroundHoverColor: PropTypes.string,
|
|
185
|
+
disabledBackgroundColor: PropTypes.string,
|
|
186
|
+
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Captcha } from './index'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Captcha } from './index'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
component: Captcha,
|
|
6
6
|
title: 'Components/Captcha',
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => (
|
|
10
|
+
<Captcha label="Captcha" {...args}>
|
|
11
|
+
Default
|
|
12
|
+
</Captcha>
|
|
13
|
+
)
|
|
10
14
|
|
|
11
|
-
export const Default = Template.bind({})
|
|
15
|
+
export const Default = Template.bind({})
|
|
12
16
|
Default.args = {
|
|
13
17
|
range: 72,
|
|
14
18
|
getRange: (range) => {
|
|
15
|
-
console.log('Range is ' + range)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
19
|
+
console.log('Range is ' + range)
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
-
import { compereConfigs } from './../../utils'
|
|
4
|
+
import { compereConfigs } from './../../utils'
|
|
5
5
|
|
|
6
|
-
import SvgCaptchaArrowUp from './../icon/CaptchaArrowUp'
|
|
7
|
-
import SvgCaptchaArrowDown from './../icon/CaptchaArrowDown'
|
|
6
|
+
import SvgCaptchaArrowUp from './../icon/CaptchaArrowUp'
|
|
7
|
+
import SvgCaptchaArrowDown from './../icon/CaptchaArrowDown'
|
|
8
8
|
|
|
9
|
-
import styles from './captcha.module.css'
|
|
9
|
+
import styles from './captcha.module.css'
|
|
10
10
|
|
|
11
11
|
export const Captcha = ({ size, color, range, label, getRange }) => {
|
|
12
|
+
const [rangeNumber, setRangeNumber] = useState(0)
|
|
13
|
+
const [rangeProgress, setRangeProgress] = useState(0)
|
|
12
14
|
|
|
13
|
-
const
|
|
14
|
-
const [rangeProgress, setRangeProgress] = useState(0);
|
|
15
|
-
|
|
16
|
-
const configStyles = compereConfigs();
|
|
15
|
+
const configStyles = compereConfigs()
|
|
17
16
|
|
|
18
17
|
const handleRange = (e) => {
|
|
19
|
-
const value = e.target.value
|
|
20
|
-
getRange(value)
|
|
21
|
-
setRangeProgress(value)
|
|
22
|
-
}
|
|
18
|
+
const value = e.target.value
|
|
19
|
+
getRange(value)
|
|
20
|
+
setRangeProgress(value)
|
|
21
|
+
}
|
|
23
22
|
|
|
24
23
|
useEffect(() => {
|
|
25
24
|
if (range === undefined || range === null) {
|
|
26
|
-
alert('Please add range property on Captcha component')
|
|
25
|
+
alert('Please add range property on Captcha component')
|
|
27
26
|
}
|
|
28
27
|
if (!getRange) {
|
|
29
|
-
alert('Please add getRange property on Captcha component')
|
|
28
|
+
alert('Please add getRange property on Captcha component')
|
|
30
29
|
}
|
|
31
30
|
if (range >= 100) {
|
|
32
|
-
setRangeNumber(100)
|
|
31
|
+
setRangeNumber(100)
|
|
33
32
|
} else if (range <= 0) {
|
|
34
|
-
setRangeNumber(0)
|
|
33
|
+
setRangeNumber(0)
|
|
35
34
|
} else {
|
|
36
|
-
const roundedRange = Math.ceil(range / 5) * 5
|
|
37
|
-
setRangeNumber(Math.min(roundedRange, 100))
|
|
35
|
+
const roundedRange = Math.ceil(range / 5) * 5
|
|
36
|
+
setRangeNumber(Math.min(roundedRange, 100))
|
|
38
37
|
}
|
|
39
|
-
}, [range, getRange])
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
}, [range, getRange])
|
|
42
39
|
|
|
43
40
|
return (
|
|
44
41
|
<>
|
|
45
|
-
{
|
|
46
|
-
|
|
42
|
+
{label && (
|
|
43
|
+
<p
|
|
47
44
|
style={{
|
|
48
45
|
fontSize: size ? size : configStyles.Captcha.size,
|
|
49
|
-
color: color ? color : configStyles.Captcha.color
|
|
46
|
+
color: color ? color : configStyles.Captcha.color,
|
|
50
47
|
}}
|
|
51
|
-
>
|
|
52
|
-
|
|
48
|
+
>
|
|
49
|
+
{label}
|
|
50
|
+
</p>
|
|
51
|
+
)}
|
|
53
52
|
<div
|
|
54
53
|
style={{
|
|
55
54
|
width: '100%',
|
|
@@ -77,7 +76,7 @@ export const Captcha = ({ size, color, range, label, getRange }) => {
|
|
|
77
76
|
width: '100%',
|
|
78
77
|
height: '30px',
|
|
79
78
|
alignItems: 'center',
|
|
80
|
-
zIndex: 1
|
|
79
|
+
zIndex: 1,
|
|
81
80
|
}}
|
|
82
81
|
className={styles['start-point']}
|
|
83
82
|
>
|
|
@@ -88,33 +87,32 @@ export const Captcha = ({ size, color, range, label, getRange }) => {
|
|
|
88
87
|
right: '0px',
|
|
89
88
|
width: '100%',
|
|
90
89
|
height: '4px',
|
|
91
|
-
borderRadius: '2px',
|
|
92
90
|
backgroundColor: '#EEEEEE',
|
|
93
91
|
borderRadius: '10px',
|
|
94
|
-
zIndex: -2
|
|
92
|
+
zIndex: -2,
|
|
95
93
|
}}
|
|
96
94
|
></div>
|
|
97
95
|
<input
|
|
98
96
|
min={0}
|
|
99
97
|
step={5}
|
|
100
98
|
max={100}
|
|
101
|
-
type=
|
|
99
|
+
type="range"
|
|
102
100
|
value={rangeProgress}
|
|
103
101
|
style={{
|
|
104
102
|
height: '4px',
|
|
105
103
|
width: '100%',
|
|
106
104
|
borderRadius: '2px',
|
|
107
105
|
cursor: 'pointer',
|
|
108
|
-
backgroundColor: 'transparent'
|
|
106
|
+
backgroundColor: 'transparent',
|
|
109
107
|
}}
|
|
110
108
|
className={`
|
|
111
109
|
${styles['range']}
|
|
112
110
|
${
|
|
113
|
-
+rangeProgress === rangeNumber
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
+rangeProgress === rangeNumber
|
|
112
|
+
? styles['range-success']
|
|
113
|
+
: +rangeProgress !== rangeNumber && +rangeProgress > 0
|
|
114
|
+
? styles['range-error']
|
|
115
|
+
: styles['range-default']
|
|
118
116
|
}
|
|
119
117
|
`}
|
|
120
118
|
onInput={handleRange}
|
|
@@ -128,13 +126,12 @@ export const Captcha = ({ size, color, range, label, getRange }) => {
|
|
|
128
126
|
height: '4px',
|
|
129
127
|
borderRadius: '2px',
|
|
130
128
|
backgroundColor:
|
|
131
|
-
+rangeProgress === rangeNumber
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
zIndex: -1
|
|
129
|
+
+rangeProgress === rangeNumber
|
|
130
|
+
? '#0DA574'
|
|
131
|
+
: +rangeProgress !== rangeNumber && +rangeProgress > 0
|
|
132
|
+
? '#EE0000'
|
|
133
|
+
: 'transparent',
|
|
134
|
+
zIndex: -1,
|
|
138
135
|
}}
|
|
139
136
|
></div>
|
|
140
137
|
</div>
|
|
@@ -144,18 +141,18 @@ export const Captcha = ({ size, color, range, label, getRange }) => {
|
|
|
144
141
|
bottom: '0px',
|
|
145
142
|
height: '15px',
|
|
146
143
|
left: `calc(${rangeNumber}% - 6px)`,
|
|
147
|
-
transform: 'translate(-50% -50%)'
|
|
144
|
+
transform: 'translate(-50% -50%)',
|
|
148
145
|
}}
|
|
149
146
|
>
|
|
150
147
|
<SvgCaptchaArrowUp />
|
|
151
148
|
</div>
|
|
152
149
|
</div>
|
|
153
150
|
</>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
156
153
|
|
|
157
154
|
Captcha.propTypes = {
|
|
158
155
|
label: PropTypes.string,
|
|
159
156
|
range: PropTypes.number.isRequired,
|
|
160
|
-
getRange: PropTypes.func.isRequired
|
|
161
|
-
}
|
|
157
|
+
getRange: PropTypes.func.isRequired,
|
|
158
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Checkbox } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Checkbox } from '.'
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
component: Checkbox,
|
|
5
|
+
title: 'Components/Checkbox',
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
const Template = (args) => <Checkbox {...args}
|
|
8
|
+
const Template = (args) => <Checkbox {...args} />
|
|
9
9
|
|
|
10
|
-
export const CheckboxButton = Template.bind({})
|
|
10
|
+
export const CheckboxButton = Template.bind({})
|