@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,592 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
|
|
4
|
-
import classnames from 'classnames'
|
|
5
|
-
import { compereConfigs, hasOwnerProperty } from './../../utils'
|
|
6
|
-
|
|
7
|
-
import SvgRequired from './../icon/Required'
|
|
8
|
-
|
|
9
|
-
import { keyframes, css } from 'styled-components'
|
|
10
|
-
import styles from './autocomplete.module.css'
|
|
11
|
-
|
|
12
|
-
export const NewAutocomplete = ({
|
|
13
|
-
label,
|
|
14
|
-
change,
|
|
15
|
-
options,
|
|
16
|
-
getItem,
|
|
17
|
-
keyNames,
|
|
18
|
-
required,
|
|
19
|
-
disabled,
|
|
20
|
-
selected,
|
|
21
|
-
className,
|
|
22
|
-
errorSize,
|
|
23
|
-
labelSize,
|
|
24
|
-
marginTop,
|
|
25
|
-
errorColor,
|
|
26
|
-
labelColor,
|
|
27
|
-
labelWeight,
|
|
28
|
-
searchCount,
|
|
29
|
-
placeHolder,
|
|
30
|
-
errorMessage,
|
|
31
|
-
autoComplete,
|
|
32
|
-
labelDisplay,
|
|
33
|
-
contentDisplay,
|
|
34
|
-
contentTopSize,
|
|
35
|
-
contentPosition,
|
|
36
|
-
contentTopColor,
|
|
37
|
-
labelLineHeight,
|
|
38
|
-
labelFontFamily,
|
|
39
|
-
contentDirection,
|
|
40
|
-
contentTopWeight,
|
|
41
|
-
contentTopRadius,
|
|
42
|
-
contentTopHeight,
|
|
43
|
-
contentTopBorder,
|
|
44
|
-
labelMarginBottom,
|
|
45
|
-
contentTopDisplay,
|
|
46
|
-
contentTopPadding,
|
|
47
|
-
contentBottomLeft,
|
|
48
|
-
innerErrorPadding,
|
|
49
|
-
showOptionDuration,
|
|
50
|
-
contentTopMaxWidth,
|
|
51
|
-
labelTextTransform,
|
|
52
|
-
contentBottomWidth,
|
|
53
|
-
contentBottomZindex,
|
|
54
|
-
contentBottomRadius,
|
|
55
|
-
contentTopDirection,
|
|
56
|
-
contentTopBoxSizing,
|
|
57
|
-
contentTopLineHeight,
|
|
58
|
-
contentBottomMaxWidth,
|
|
59
|
-
contentTopBorderHover,
|
|
60
|
-
contentBottomOverflow,
|
|
61
|
-
contentBottomPosition,
|
|
62
|
-
contentBottomRowColor,
|
|
63
|
-
contentBottomMinHeight,
|
|
64
|
-
contentBottomBoxShadow,
|
|
65
|
-
contentBottomRowHeight,
|
|
66
|
-
contentBottomRowCursor,
|
|
67
|
-
contentTopBorderActive,
|
|
68
|
-
contentBottomRowDisplay,
|
|
69
|
-
contentBottomRowPadding,
|
|
70
|
-
contentBottomRowFontSize,
|
|
71
|
-
contentBottomRowBoxSizing,
|
|
72
|
-
contentBottomInnerDisplay,
|
|
73
|
-
innerErrorBackgroundColor,
|
|
74
|
-
contentBottomRowFontWeight,
|
|
75
|
-
contentBottomRowLineHeight,
|
|
76
|
-
contentBottomRowAlignItems,
|
|
77
|
-
contentBottomRowTransition,
|
|
78
|
-
contentBottomRowHoverColor,
|
|
79
|
-
contentBottomInnerOverflowY,
|
|
80
|
-
contentBottomInnerOverflowX,
|
|
81
|
-
contentBottomInnerMaxHeight,
|
|
82
|
-
contentBottomInnerDirection,
|
|
83
|
-
contentBottomBackgroundColor,
|
|
84
|
-
contentBottomRowMarginBottom,
|
|
85
|
-
contentBottomRowBackgroundColor,
|
|
86
|
-
contentBottomRowHoverBackgroundColor,
|
|
87
|
-
backgroundDisableColor,
|
|
88
|
-
...props
|
|
89
|
-
}) => {
|
|
90
|
-
const [id, setId] = useState('')
|
|
91
|
-
const [show, setShow] = useState(false)
|
|
92
|
-
const [isHover, setIsHover] = useState(false)
|
|
93
|
-
const [isFocus, setIsFocus] = useState(false)
|
|
94
|
-
const [innerError, setInnerError] = useState('')
|
|
95
|
-
const [innerValue, setInnerValue] = useState('')
|
|
96
|
-
const [innerOptions, setInnerOptions] = useState([])
|
|
97
|
-
const configStyles = compereConfigs()
|
|
98
|
-
const classProps = classnames(
|
|
99
|
-
className ? className : configStyles.NEWAUTOCOMPLETE.className,
|
|
100
|
-
styles['auto-complete']
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
const showOption = keyframes`
|
|
104
|
-
100% {
|
|
105
|
-
max-height: 400px;
|
|
106
|
-
}
|
|
107
|
-
`
|
|
108
|
-
|
|
109
|
-
const animation = () => css`
|
|
110
|
-
${showOption} ${showOptionDuration
|
|
111
|
-
? showOptionDuration
|
|
112
|
-
: configStyles.NEWAUTOCOMPLETE.showOptionDuration} linear forwards
|
|
113
|
-
`
|
|
114
|
-
|
|
115
|
-
const handleMouseEnter = () => {
|
|
116
|
-
setIsHover(true)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const handleMouseLeave = () => {
|
|
120
|
-
setIsHover(false)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const handleRowMouseEnter = (e) => {
|
|
124
|
-
e.target.style.color = contentBottomRowHoverColor
|
|
125
|
-
? contentBottomRowHoverColor
|
|
126
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowHoverColor
|
|
127
|
-
e.target.style.backgroundColor = contentBottomRowHoverBackgroundColor
|
|
128
|
-
? contentBottomRowHoverBackgroundColor
|
|
129
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowHoverBackgroundColor
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const handleRowMouseLeave = (e) => {
|
|
133
|
-
e.target.style.color = contentBottomRowColor
|
|
134
|
-
? contentBottomRowColor
|
|
135
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowColor
|
|
136
|
-
e.target.style.backgroundColor = contentBottomRowBackgroundColor
|
|
137
|
-
? contentBottomRowBackgroundColor
|
|
138
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const handleFocus = () => {
|
|
142
|
-
setIsFocus(true)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const handleBlur = () => {
|
|
146
|
-
setIsFocus(false)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const handleChange = (e) => {
|
|
150
|
-
const value = e.target.value
|
|
151
|
-
const currentId = e.target.id
|
|
152
|
-
value.length > 0 ? setShow(true) : setShow(false)
|
|
153
|
-
setInnerError('')
|
|
154
|
-
setInnerValue(value)
|
|
155
|
-
if (value.length >= searchCount) {
|
|
156
|
-
change({ name: value, id: currentId })
|
|
157
|
-
} else {
|
|
158
|
-
change({ name: '', id: '' })
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const handleClick = (selectedValue) => {
|
|
163
|
-
setShow(false)
|
|
164
|
-
setId(selectedValue[keyNames.id])
|
|
165
|
-
setInnerValue(selectedValue[keyNames.name])
|
|
166
|
-
getItem(selectedValue)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const optionList = (
|
|
170
|
-
<div>
|
|
171
|
-
{show && innerOptions && !disabled ? (
|
|
172
|
-
innerOptions.length > 0 ? (
|
|
173
|
-
<div
|
|
174
|
-
style={{
|
|
175
|
-
left: contentBottomLeft
|
|
176
|
-
? contentBottomLeft
|
|
177
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomLeft,
|
|
178
|
-
width: contentBottomWidth
|
|
179
|
-
? contentBottomWidth
|
|
180
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomWidth,
|
|
181
|
-
zIndex: contentBottomZindex
|
|
182
|
-
? contentBottomZindex
|
|
183
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomZindex,
|
|
184
|
-
borderRadius: contentBottomRadius
|
|
185
|
-
? contentBottomRadius
|
|
186
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRadius,
|
|
187
|
-
maxWidth: contentBottomMaxWidth
|
|
188
|
-
? contentBottomMaxWidth
|
|
189
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomMaxWidth,
|
|
190
|
-
overflow: contentBottomOverflow
|
|
191
|
-
? contentBottomOverflow
|
|
192
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomOverflow,
|
|
193
|
-
position: contentBottomPosition
|
|
194
|
-
? contentBottomPosition
|
|
195
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomPosition,
|
|
196
|
-
minHeight: contentBottomMinHeight
|
|
197
|
-
? contentBottomMinHeight
|
|
198
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomMinHeight,
|
|
199
|
-
boxShadow: contentBottomBoxShadow
|
|
200
|
-
? contentBottomBoxShadow
|
|
201
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomBoxShadow,
|
|
202
|
-
backgroundColor: contentBottomBackgroundColor
|
|
203
|
-
? contentBottomBackgroundColor
|
|
204
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomBackgroundColor,
|
|
205
|
-
top: contentTopHeight
|
|
206
|
-
? contentTopHeight.includes('rem')
|
|
207
|
-
? parseFloat(contentTopHeight.substr(0, contentTopHeight.length - 3)) + 0.6 + 'rem'
|
|
208
|
-
: parseFloat(contentTopHeight.substr(0, contentTopHeight.length - 2)) + 6 + 'px'
|
|
209
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopHeight.includes('rem')
|
|
210
|
-
? parseFloat(
|
|
211
|
-
configStyles.NEWAUTOCOMPLETE.contentTopHeight.substr(
|
|
212
|
-
0,
|
|
213
|
-
configStyles.NEWAUTOCOMPLETE.contentTopHeight.length - 3
|
|
214
|
-
)
|
|
215
|
-
) +
|
|
216
|
-
0.6 +
|
|
217
|
-
'rem'
|
|
218
|
-
: parseFloat(
|
|
219
|
-
configStyles.NEWAUTOCOMPLETE.contentTopHeight.substr(
|
|
220
|
-
0,
|
|
221
|
-
configStyles.NEWAUTOCOMPLETE.contentTopHeight.length - 2
|
|
222
|
-
)
|
|
223
|
-
) +
|
|
224
|
-
6 +
|
|
225
|
-
'px',
|
|
226
|
-
animation,
|
|
227
|
-
}}
|
|
228
|
-
>
|
|
229
|
-
<div
|
|
230
|
-
style={{
|
|
231
|
-
display: contentBottomInnerDisplay
|
|
232
|
-
? contentBottomInnerDisplay
|
|
233
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomInnerDisplay,
|
|
234
|
-
overflowY: contentBottomInnerOverflowY
|
|
235
|
-
? contentBottomInnerOverflowY
|
|
236
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomInnerOverflowY,
|
|
237
|
-
overflowX: contentBottomInnerOverflowX
|
|
238
|
-
? contentBottomInnerOverflowX
|
|
239
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomInnerOverflowX,
|
|
240
|
-
maxHeight: contentBottomInnerMaxHeight
|
|
241
|
-
? contentBottomInnerMaxHeight
|
|
242
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomInnerMaxHeight,
|
|
243
|
-
flexDirection: contentBottomInnerDirection
|
|
244
|
-
? contentBottomInnerDirection
|
|
245
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomInnerDirection,
|
|
246
|
-
}}
|
|
247
|
-
>
|
|
248
|
-
{innerOptions.map((item) => {
|
|
249
|
-
return (
|
|
250
|
-
<p
|
|
251
|
-
key={item.id}
|
|
252
|
-
onMouseEnter={handleRowMouseEnter}
|
|
253
|
-
onMouseLeave={handleRowMouseLeave}
|
|
254
|
-
onClick={() => handleClick(item)}
|
|
255
|
-
style={{
|
|
256
|
-
flexShrink: 0,
|
|
257
|
-
color: contentBottomRowColor
|
|
258
|
-
? contentBottomRowColor
|
|
259
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowColor,
|
|
260
|
-
height: contentBottomRowHeight
|
|
261
|
-
? contentBottomRowHeight
|
|
262
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
263
|
-
cursor: contentBottomRowCursor
|
|
264
|
-
? contentBottomRowCursor
|
|
265
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowCursor,
|
|
266
|
-
display: contentBottomRowDisplay
|
|
267
|
-
? contentBottomRowDisplay
|
|
268
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowDisplay,
|
|
269
|
-
padding: contentBottomRowPadding
|
|
270
|
-
? contentBottomRowPadding
|
|
271
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
|
|
272
|
-
fontSize: contentBottomRowFontSize
|
|
273
|
-
? contentBottomRowFontSize
|
|
274
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowFontSize,
|
|
275
|
-
boxSizing: contentBottomRowBoxSizing
|
|
276
|
-
? contentBottomRowBoxSizing
|
|
277
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowBoxSizing,
|
|
278
|
-
fontWeight: contentBottomRowFontWeight
|
|
279
|
-
? contentBottomRowFontWeight
|
|
280
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowFontWeight,
|
|
281
|
-
lineHeight: contentBottomRowLineHeight
|
|
282
|
-
? contentBottomRowLineHeight
|
|
283
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowLineHeight,
|
|
284
|
-
alignItems: contentBottomRowAlignItems
|
|
285
|
-
? contentBottomRowAlignItems
|
|
286
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowAlignItems,
|
|
287
|
-
transition: contentBottomRowTransition
|
|
288
|
-
? contentBottomRowTransition
|
|
289
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowTransition,
|
|
290
|
-
marginBottom: contentBottomRowMarginBottom
|
|
291
|
-
? contentBottomRowMarginBottom
|
|
292
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
|
|
293
|
-
backgroundColor: contentBottomRowBackgroundColor
|
|
294
|
-
? contentBottomRowBackgroundColor
|
|
295
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor,
|
|
296
|
-
}}
|
|
297
|
-
>
|
|
298
|
-
{item[keyNames.name]}
|
|
299
|
-
</p>
|
|
300
|
-
)
|
|
301
|
-
})}
|
|
302
|
-
</div>
|
|
303
|
-
</div>
|
|
304
|
-
) : innerOptions.length <= 0 ? (
|
|
305
|
-
innerError ? (
|
|
306
|
-
''
|
|
307
|
-
) : innerValue.length <= 0 ? (
|
|
308
|
-
''
|
|
309
|
-
) : (
|
|
310
|
-
<span
|
|
311
|
-
style={{
|
|
312
|
-
position: 'absolute',
|
|
313
|
-
zIndex: '1',
|
|
314
|
-
color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
|
|
315
|
-
fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
|
|
316
|
-
top: marginTop
|
|
317
|
-
? `calc(100% + ${marginTop})`
|
|
318
|
-
: `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
319
|
-
padding: innerErrorPadding
|
|
320
|
-
? innerErrorPadding
|
|
321
|
-
: configStyles.NEWAUTOCOMPLETE.innerErrorPadding,
|
|
322
|
-
height: contentBottomRowHeight
|
|
323
|
-
? contentBottomRowHeight
|
|
324
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
325
|
-
lineHeight: contentBottomRowHeight
|
|
326
|
-
? contentBottomRowHeight
|
|
327
|
-
: configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
328
|
-
backgroundColor: innerErrorBackgroundColor
|
|
329
|
-
? innerErrorBackgroundColor
|
|
330
|
-
: configStyles.NEWAUTOCOMPLETE.innerErrorBackgroundColor,
|
|
331
|
-
}}
|
|
332
|
-
>
|
|
333
|
-
{innerValue.length >= searchCount
|
|
334
|
-
? 'Նման տվյալ առկա չէ'
|
|
335
|
-
: `Լրացնել առնվազն ${searchCount} նիշ`}
|
|
336
|
-
</span>
|
|
337
|
-
)
|
|
338
|
-
) : (
|
|
339
|
-
''
|
|
340
|
-
)
|
|
341
|
-
) : (
|
|
342
|
-
''
|
|
343
|
-
)}
|
|
344
|
-
</div>
|
|
345
|
-
)
|
|
346
|
-
|
|
347
|
-
useEffect(() => {
|
|
348
|
-
if (options === undefined) {
|
|
349
|
-
alert('Please add options prop')
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
options &&
|
|
353
|
-
options.length > 0 &&
|
|
354
|
-
options.map((item) => {
|
|
355
|
-
if (!hasOwnerProperty(item, keyNames.name)) {
|
|
356
|
-
alert(`Please add ${keyNames.name} property in items of options array`)
|
|
357
|
-
}
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
if (!getItem) {
|
|
361
|
-
alert('Please add getItem function for get choosen item from autocomplete')
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
options && setInnerOptions(options)
|
|
365
|
-
}, [options, options?.length, getItem])
|
|
366
|
-
|
|
367
|
-
useEffect(() => {
|
|
368
|
-
if (!change) {
|
|
369
|
-
alert('Please add change prop on New Autocomplete component')
|
|
370
|
-
}
|
|
371
|
-
}, [change])
|
|
372
|
-
|
|
373
|
-
useEffect(() => {
|
|
374
|
-
if (selected) {
|
|
375
|
-
setId(selected[keyNames.id])
|
|
376
|
-
setInnerValue(selected[keyNames.name])
|
|
377
|
-
} else {
|
|
378
|
-
setId('')
|
|
379
|
-
setInnerValue('')
|
|
380
|
-
}
|
|
381
|
-
}, [selected])
|
|
382
|
-
|
|
383
|
-
useEffect(() => {
|
|
384
|
-
setInnerError(errorMessage)
|
|
385
|
-
}, [errorMessage])
|
|
386
|
-
|
|
387
|
-
return (
|
|
388
|
-
<div className={classProps}>
|
|
389
|
-
{label ? (
|
|
390
|
-
<label
|
|
391
|
-
style={{
|
|
392
|
-
color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
|
|
393
|
-
fontSize: labelSize ? labelSize : configStyles.NEWAUTOCOMPLETE.labelSize,
|
|
394
|
-
display: labelDisplay ? labelDisplay : configStyles.NEWAUTOCOMPLETE.labelDisplay,
|
|
395
|
-
fontWeight: labelWeight ? labelWeight : configStyles.NEWAUTOCOMPLETE.labelWeight,
|
|
396
|
-
fontFamily: labelFontFamily ? labelFontFamily : configStyles.NEWAUTOCOMPLETE.labelFontFamily,
|
|
397
|
-
lineHeight: labelLineHeight ? labelLineHeight : configStyles.NEWAUTOCOMPLETE.labelLineHeight,
|
|
398
|
-
maxWidth: contentTopMaxWidth
|
|
399
|
-
? contentTopMaxWidth
|
|
400
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
|
|
401
|
-
marginBottom: labelMarginBottom
|
|
402
|
-
? labelMarginBottom
|
|
403
|
-
: configStyles.NEWAUTOCOMPLETE.labelMarginBottom,
|
|
404
|
-
textTransform: labelTextTransform
|
|
405
|
-
? labelTextTransform
|
|
406
|
-
: configStyles.NEWAUTOCOMPLETE.labelTextTransform,
|
|
407
|
-
}}
|
|
408
|
-
>
|
|
409
|
-
{label}
|
|
410
|
-
{required && (
|
|
411
|
-
<sup>
|
|
412
|
-
<SvgRequired />
|
|
413
|
-
</sup>
|
|
414
|
-
)}
|
|
415
|
-
</label>
|
|
416
|
-
) : (
|
|
417
|
-
''
|
|
418
|
-
)}
|
|
419
|
-
<div
|
|
420
|
-
style={{
|
|
421
|
-
display: contentDisplay ? contentDisplay : configStyles.NEWAUTOCOMPLETE.contentDisplay,
|
|
422
|
-
position: contentPosition ? contentPosition : configStyles.NEWAUTOCOMPLETE.contentPosition,
|
|
423
|
-
flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection,
|
|
424
|
-
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
|
|
425
|
-
}}
|
|
426
|
-
>
|
|
427
|
-
<input
|
|
428
|
-
id={id}
|
|
429
|
-
type="text"
|
|
430
|
-
value={innerValue}
|
|
431
|
-
disabled={disabled}
|
|
432
|
-
onBlur={handleBlur}
|
|
433
|
-
onFocus={handleFocus}
|
|
434
|
-
onInput={handleChange}
|
|
435
|
-
onMouseEnter={handleMouseEnter}
|
|
436
|
-
onMouseLeave={handleMouseLeave}
|
|
437
|
-
placeholder={placeHolder ? placeHolder : ''}
|
|
438
|
-
autoComplete={autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete}
|
|
439
|
-
style={{
|
|
440
|
-
border: 'none',
|
|
441
|
-
outline: 'none',
|
|
442
|
-
maxWidth: '100%',
|
|
443
|
-
transition: 'all 240ms',
|
|
444
|
-
cursor: disabled ? 'not-allowed' : 'auto',
|
|
445
|
-
color: contentTopColor ? contentTopColor : configStyles.NEWAUTOCOMPLETE.contentTopColor,
|
|
446
|
-
fontSize: contentTopSize ? contentTopSize : configStyles.NEWAUTOCOMPLETE.contentTopSize,
|
|
447
|
-
backgroundColor:
|
|
448
|
-
disabled && (backgroundDisableColor ?? configStyles.NEWAUTOCOMPLETE.backgroundDisableColor),
|
|
449
|
-
height: contentTopHeight ? contentTopHeight : configStyles.NEWAUTOCOMPLETE.contentTopHeight,
|
|
450
|
-
padding: contentTopPadding ? contentTopPadding : configStyles.NEWAUTOCOMPLETE.contentTopPadding,
|
|
451
|
-
display: contentTopDisplay ? contentTopDisplay : configStyles.NEWAUTOCOMPLETE.contentTopDisplay,
|
|
452
|
-
fontWeight: contentTopWeight ? contentTopWeight : configStyles.NEWAUTOCOMPLETE.contentTopWeight,
|
|
453
|
-
borderRadius: contentTopRadius
|
|
454
|
-
? contentTopRadius
|
|
455
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopRadius,
|
|
456
|
-
boxSizing: contentTopBoxSizing
|
|
457
|
-
? contentTopBoxSizing
|
|
458
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopBoxSizing,
|
|
459
|
-
lineHeight: contentTopLineHeight
|
|
460
|
-
? contentTopLineHeight
|
|
461
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopLineHeight,
|
|
462
|
-
flexDirection: contentTopDirection
|
|
463
|
-
? contentTopDirection
|
|
464
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopDirection,
|
|
465
|
-
boxShadow: errorMessage
|
|
466
|
-
? errorColor
|
|
467
|
-
? `0 0 0 2px ${errorColor}`
|
|
468
|
-
: `0 0 0 2px ${configStyles.NEWAUTOCOMPLETE.errorColor}`
|
|
469
|
-
: isFocus
|
|
470
|
-
? contentTopBorderActive
|
|
471
|
-
? contentTopBorderActive
|
|
472
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopBorderActive
|
|
473
|
-
: isHover
|
|
474
|
-
? contentTopBorderHover
|
|
475
|
-
? contentTopBorderHover
|
|
476
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopBorderHover
|
|
477
|
-
: contentTopBorder
|
|
478
|
-
? contentTopBorder
|
|
479
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopBorder,
|
|
480
|
-
}}
|
|
481
|
-
{...props}
|
|
482
|
-
/>
|
|
483
|
-
|
|
484
|
-
{innerError ? (
|
|
485
|
-
<span
|
|
486
|
-
style={{
|
|
487
|
-
left: '0px',
|
|
488
|
-
position: 'absolute',
|
|
489
|
-
color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
|
|
490
|
-
fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
|
|
491
|
-
top: marginTop
|
|
492
|
-
? `calc(100% + ${marginTop})`
|
|
493
|
-
: `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
494
|
-
maxWidth: contentTopMaxWidth
|
|
495
|
-
? contentTopMaxWidth
|
|
496
|
-
: configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
|
|
497
|
-
}}
|
|
498
|
-
>
|
|
499
|
-
{innerError}
|
|
500
|
-
</span>
|
|
501
|
-
) : (
|
|
502
|
-
''
|
|
503
|
-
)}
|
|
504
|
-
|
|
505
|
-
{optionList}
|
|
506
|
-
</div>
|
|
507
|
-
</div>
|
|
508
|
-
)
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
NewAutocomplete.propTypes = {
|
|
512
|
-
label: PropTypes.string,
|
|
513
|
-
required: PropTypes.bool,
|
|
514
|
-
disabled: PropTypes.bool,
|
|
515
|
-
keyNames: PropTypes.object,
|
|
516
|
-
selected: PropTypes.object,
|
|
517
|
-
className: PropTypes.string,
|
|
518
|
-
errorSize: PropTypes.string,
|
|
519
|
-
marginTop: PropTypes.string,
|
|
520
|
-
labelSize: PropTypes.string,
|
|
521
|
-
errorColor: PropTypes.string,
|
|
522
|
-
labelColor: PropTypes.string,
|
|
523
|
-
searchCount: PropTypes.number,
|
|
524
|
-
placeHolder: PropTypes.string,
|
|
525
|
-
labelWeight: PropTypes.number,
|
|
526
|
-
errorMessage: PropTypes.string,
|
|
527
|
-
labelDisplay: PropTypes.string,
|
|
528
|
-
autoComplete: PropTypes.string,
|
|
529
|
-
contentDisplay: PropTypes.string,
|
|
530
|
-
contentTopSize: PropTypes.string,
|
|
531
|
-
contentPosition: PropTypes.string,
|
|
532
|
-
labelLineHeight: PropTypes.string,
|
|
533
|
-
contentTopColor: PropTypes.string,
|
|
534
|
-
change: PropTypes.func.isRequired,
|
|
535
|
-
labelFontFamily: PropTypes.string,
|
|
536
|
-
contentDirection: PropTypes.string,
|
|
537
|
-
contentTopWeight: PropTypes.number,
|
|
538
|
-
contentTopRadius: PropTypes.string,
|
|
539
|
-
contentTopHeight: PropTypes.string,
|
|
540
|
-
contentTopBorder: PropTypes.string,
|
|
541
|
-
getItem: PropTypes.func.isRequired,
|
|
542
|
-
contentTopDisplay: PropTypes.string,
|
|
543
|
-
contentTopPadding: PropTypes.string,
|
|
544
|
-
contentBottomLeft: PropTypes.string,
|
|
545
|
-
options: PropTypes.array.isRequired,
|
|
546
|
-
labelMarginBottom: PropTypes.string,
|
|
547
|
-
innerErrorPadding: PropTypes.string,
|
|
548
|
-
labelTextTransform: PropTypes.string,
|
|
549
|
-
showOptionDuration: PropTypes.string,
|
|
550
|
-
contentTopMaxWidth: PropTypes.string,
|
|
551
|
-
contentBottomWidth: PropTypes.string,
|
|
552
|
-
contentTopDirection: PropTypes.string,
|
|
553
|
-
contentTopBoxSizing: PropTypes.string,
|
|
554
|
-
contentBottomZindex: PropTypes.number,
|
|
555
|
-
contentBottomRadius: PropTypes.string,
|
|
556
|
-
contentTopLineHeight: PropTypes.string,
|
|
557
|
-
contentTopBorderHover: PropTypes.string,
|
|
558
|
-
contentBottomRowColor: PropTypes.string,
|
|
559
|
-
contentBottomMaxWidth: PropTypes.string,
|
|
560
|
-
contentBottomOverflow: PropTypes.string,
|
|
561
|
-
contentBottomPosition: PropTypes.string,
|
|
562
|
-
contentBottomMinHeight: PropTypes.string,
|
|
563
|
-
contentBottomBoxShadow: PropTypes.string,
|
|
564
|
-
contentBottomRowHeight: PropTypes.string,
|
|
565
|
-
contentBottomRowCursor: PropTypes.string,
|
|
566
|
-
contentTopBorderActive: PropTypes.string,
|
|
567
|
-
contentBottomRowDisplay: PropTypes.string,
|
|
568
|
-
contentBottomRowPadding: PropTypes.string,
|
|
569
|
-
contentBottomRowFontSize: PropTypes.string,
|
|
570
|
-
contentBottomRowBoxSizing: PropTypes.string,
|
|
571
|
-
innerErrorBackgroundColor: PropTypes.string,
|
|
572
|
-
contentBottomInnerDisplay: PropTypes.string,
|
|
573
|
-
contentBottomRowFontWeight: PropTypes.number,
|
|
574
|
-
contentBottomRowLineHeight: PropTypes.string,
|
|
575
|
-
contentBottomRowAlignItems: PropTypes.string,
|
|
576
|
-
contentBottomRowTransition: PropTypes.string,
|
|
577
|
-
contentBottomRowHoverColor: PropTypes.string,
|
|
578
|
-
contentBottomInnerOverflowY: PropTypes.string,
|
|
579
|
-
contentBottomInnerOverflowX: PropTypes.string,
|
|
580
|
-
contentBottomInnerMaxHeight: PropTypes.string,
|
|
581
|
-
contentBottomInnerDirection: PropTypes.string,
|
|
582
|
-
contentBottomRowMarginBottom: PropTypes.string,
|
|
583
|
-
contentBottomBackgroundColor: PropTypes.string,
|
|
584
|
-
contentBottomRowBackgroundColor: PropTypes.string,
|
|
585
|
-
contentBottomRowHoverBackgroundColor: PropTypes.string,
|
|
586
|
-
backgroundDisableColor: PropTypes.string,
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
NewAutocomplete.defaultProps = {
|
|
590
|
-
searchCount: 3,
|
|
591
|
-
disabled: false,
|
|
592
|
-
}
|