@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.
Files changed (180) hide show
  1. package/dist/index.es.js +3983 -4344
  2. package/dist/index.js +3982 -4345
  3. package/package.json +1 -1
  4. package/tui.config.js +1 -1
  5. package/.eslintrc.js +0 -30
  6. package/.husky/pre-commit +0 -4
  7. package/.prettierrc +0 -10
  8. package/.storybook/main.js +0 -48
  9. package/.storybook/preview.js +0 -9
  10. package/rollup.config.js +0 -37
  11. package/src/assets/attach.svg +0 -4
  12. package/src/assets/delete.svg +0 -4
  13. package/src/assets/down-arrow.svg +0 -4
  14. package/src/assets/figma-image.png +0 -0
  15. package/src/assets/heart-filled.svg +0 -17
  16. package/src/assets/heart-outline.svg +0 -14
  17. package/src/assets/like-filled.svg +0 -21
  18. package/src/assets/like-outline.svg +0 -21
  19. package/src/assets/minus.svg +0 -4
  20. package/src/assets/pdf.svg +0 -3
  21. package/src/assets/plus.svg +0 -4
  22. package/src/assets/range-arrow-default.svg +0 -19
  23. package/src/assets/range-arrow-error.svg +0 -19
  24. package/src/assets/range-arrow-success.svg +0 -19
  25. package/src/assets/star-filled.svg +0 -21
  26. package/src/assets/star-outline.svg +0 -5
  27. package/src/assets/table-settings-icon.svg +0 -3
  28. package/src/assets/up-arrow.svg +0 -4
  29. package/src/assets_old/icons/Read Me.txt +0 -7
  30. package/src/assets_old/icons/demo-files/demo.css +0 -152
  31. package/src/assets_old/icons/demo-files/demo.js +0 -28
  32. package/src/assets_old/icons/demo.html +0 -192
  33. package/src/assets_old/icons/fonts/icomoon.eot +0 -0
  34. package/src/assets_old/icons/fonts/icomoon.svg +0 -21
  35. package/src/assets_old/icons/fonts/icomoon.ttf +0 -0
  36. package/src/assets_old/icons/fonts/icomoon.woff +0 -0
  37. package/src/assets_old/icons/selection.json +0 -1
  38. package/src/assets_old/icons/style.css +0 -58
  39. package/src/components/autocomplate/autocomplate.module.css +0 -95
  40. package/src/components/autocomplate/autocomplate.stories.js +0 -35
  41. package/src/components/autocomplate/index.js +0 -164
  42. package/src/components/button/button.stories.js +0 -13
  43. package/src/components/button/index.js +0 -187
  44. package/src/components/captcha/captcha.module.css +0 -74
  45. package/src/components/captcha/captcha.stories.js +0 -21
  46. package/src/components/captcha/index.js +0 -158
  47. package/src/components/checkbox/checkbox.module.css +0 -0
  48. package/src/components/checkbox/checkbox.stories.js +0 -76
  49. package/src/components/checkbox/index.js +0 -120
  50. package/src/components/file/file.module.css +0 -114
  51. package/src/components/file/file.stories.js +0 -20
  52. package/src/components/file/index.js +0 -138
  53. package/src/components/icon/Active.js +0 -20
  54. package/src/components/icon/Arrow.js +0 -19
  55. package/src/components/icon/Cancel.js +0 -19
  56. package/src/components/icon/CaptchaArrowDown.js +0 -19
  57. package/src/components/icon/CaptchaArrowUp.js +0 -19
  58. package/src/components/icon/CheckboxChecked.js +0 -21
  59. package/src/components/icon/CheckboxUnchecked.js +0 -21
  60. package/src/components/icon/Close.js +0 -19
  61. package/src/components/icon/CloseIcon.js +0 -19
  62. package/src/components/icon/CloseSlide.js +0 -19
  63. package/src/components/icon/DeActive.js +0 -20
  64. package/src/components/icon/DeleteComponent.js +0 -20
  65. package/src/components/icon/Done.js +0 -19
  66. package/src/components/icon/Dots.js +0 -19
  67. package/src/components/icon/DownArrow.js +0 -20
  68. package/src/components/icon/HeartFilled.js +0 -25
  69. package/src/components/icon/HeartOutline.js +0 -25
  70. package/src/components/icon/Heic.js +0 -21
  71. package/src/components/icon/Icon.js +0 -11
  72. package/src/components/icon/ListItemDelete.js +0 -19
  73. package/src/components/icon/ListItemJpeg.js +0 -21
  74. package/src/components/icon/ListItemJpg.js +0 -21
  75. package/src/components/icon/ListItemPdf.js +0 -21
  76. package/src/components/icon/ListItemPng.js +0 -21
  77. package/src/components/icon/Next.js +0 -20
  78. package/src/components/icon/Nextarrow.js +0 -19
  79. package/src/components/icon/PDF.js +0 -19
  80. package/src/components/icon/Prev.js +0 -20
  81. package/src/components/icon/RangeArrowDefault.js +0 -43
  82. package/src/components/icon/RangeArrowError.js +0 -43
  83. package/src/components/icon/RangeArrowSuccess.js +0 -43
  84. package/src/components/icon/Reject.js +0 -19
  85. package/src/components/icon/RemoveFile.js +0 -20
  86. package/src/components/icon/Required.js +0 -19
  87. package/src/components/icon/ToasterClose.js +0 -19
  88. package/src/components/icon/ToasterError.js +0 -19
  89. package/src/components/icon/ToasterInfo.js +0 -19
  90. package/src/components/icon/ToasterSuccess.js +0 -19
  91. package/src/components/icon/ToasterWarning.js +0 -19
  92. package/src/components/icon/Tooltip.js +0 -19
  93. package/src/components/icon/UpArrow.js +0 -20
  94. package/src/components/icon/Upload.js +0 -25
  95. package/src/components/icon/Wrong.js +0 -21
  96. package/src/components/icon/Zoom.js +0 -21
  97. package/src/components/icon/index.js +0 -0
  98. package/src/components/input/index.js +0 -688
  99. package/src/components/input/input.module.css +0 -51
  100. package/src/components/input/input.stories.js +0 -26
  101. package/src/components/modal/index.js +0 -436
  102. package/src/components/modal/modal.module.css +0 -22
  103. package/src/components/modal/modal.stories.js +0 -88
  104. package/src/components/newAutocomplete/NewAutocomplete.stories.js +0 -102
  105. package/src/components/newAutocomplete/autocomplete.module.css +0 -4
  106. package/src/components/newAutocomplete/index.js +0 -592
  107. package/src/components/newFile/fileItem.js +0 -281
  108. package/src/components/newFile/index.js +0 -731
  109. package/src/components/newFile/newFile.stories.js +0 -93
  110. package/src/components/pagination/index.js +0 -234
  111. package/src/components/pagination/pagination.module.css +0 -93
  112. package/src/components/pagination/pagination.stories.js +0 -371
  113. package/src/components/pagination/paginationRange.js +0 -45
  114. package/src/components/radio/index.js +0 -236
  115. package/src/components/radio/radio.module.css +0 -59
  116. package/src/components/radio/radio.stories.js +0 -59
  117. package/src/components/select/index.js +0 -534
  118. package/src/components/select/select.module.css +0 -93
  119. package/src/components/select/select.stories.js +0 -39
  120. package/src/components/singleCheckbox/Checkbox.js +0 -84
  121. package/src/components/singleCheckbox/index.js +0 -65
  122. package/src/components/singleCheckbox/singleCheckbox.stories.js +0 -24
  123. package/src/components/stepper/index.js +0 -45
  124. package/src/components/stepper/stepper.module.css +0 -57
  125. package/src/components/stepper/stepper.stories.js +0 -17
  126. package/src/components/table/index.js +0 -789
  127. package/src/components/table/table.module.css +0 -63
  128. package/src/components/table/table.stories.js +0 -497
  129. package/src/components/table/td.js +0 -429
  130. package/src/components/table/th.js +0 -103
  131. package/src/components/textarea/index.js +0 -285
  132. package/src/components/textarea/textarea.module.css +0 -25
  133. package/src/components/textarea/textarea.stories.js +0 -56
  134. package/src/components/toaster/Toast.js +0 -203
  135. package/src/components/toaster/index.js +0 -131
  136. package/src/components/toaster/toaster.module.css +0 -201
  137. package/src/components/toaster/toaster.stories.js +0 -593
  138. package/src/components/tooltip/index.js +0 -156
  139. package/src/components/tooltip/tooltip.module.css +0 -46
  140. package/src/components/tooltip/tooltip.stories.js +0 -30
  141. package/src/components/typography/index.js +0 -124
  142. package/src/components/typography/typography.module.css +0 -57
  143. package/src/components/typography/typography.stories.js +0 -22
  144. package/src/index.js +0 -19
  145. package/src/stories/Introduction.stories.mdx +0 -210
  146. package/src/stories/assets/code-brackets.svg +0 -1
  147. package/src/stories/assets/colors.svg +0 -1
  148. package/src/stories/assets/comments.svg +0 -1
  149. package/src/stories/assets/direction.svg +0 -1
  150. package/src/stories/assets/flow.svg +0 -1
  151. package/src/stories/assets/plugin.svg +0 -1
  152. package/src/stories/assets/repo.svg +0 -1
  153. package/src/stories/assets/stackalt.svg +0 -1
  154. package/src/stories/changelog.stories.mdx +0 -172
  155. package/src/stories/configuration.stories.mdx +0 -715
  156. package/src/stories/documentation.stories.mdx +0 -118
  157. package/src/stories/static/autocomplete-usage.png +0 -0
  158. package/src/stories/static/button-usage-icon.png +0 -0
  159. package/src/stories/static/button-usage.png +0 -0
  160. package/src/stories/static/captcha-usage.png +0 -0
  161. package/src/stories/static/checkbox-group-usage-2.png +0 -0
  162. package/src/stories/static/checkbox-group-usage.png +0 -0
  163. package/src/stories/static/file-single-usage.png +0 -0
  164. package/src/stories/static/file-usage.png +0 -0
  165. package/src/stories/static/input-usage.png +0 -0
  166. package/src/stories/static/modal-usage.png +0 -0
  167. package/src/stories/static/radio-usage.png +0 -0
  168. package/src/stories/static/select-usage.png +0 -0
  169. package/src/stories/static/table-body-data-structure-first-part-usage.png +0 -0
  170. package/src/stories/static/table-body-data-structure-second-part-usage.png +0 -0
  171. package/src/stories/static/table-body-data-structure-third-part-usage.png +0 -0
  172. package/src/stories/static/table-component-usage.png +0 -0
  173. package/src/stories/static/table-header-data-structure-usage.png +0 -0
  174. package/src/stories/static/table-new-data-structure-usage.png +0 -0
  175. package/src/stories/static/textarea-usage.png +0 -0
  176. package/src/stories/static/toaster-container-usage.png +0 -0
  177. package/src/stories/static/toaster-usage.png +0 -0
  178. package/src/stories/static/tooltip-usage.png +0 -0
  179. package/src/stories/usage.stories.mdx +0 -201
  180. 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
- }