@xaypay/tui 0.0.105 → 0.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +30 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +42 -45
- package/.storybook/preview.js +7 -7
- package/cli-command.js +1 -1
- package/dist/index.es.js +84 -83
- package/dist/index.js +84 -83
- package/package.json +16 -4
- package/rollup.config.js +11 -11
- package/src/assets_old/icons/demo-files/demo.js +16 -18
- package/src/components/autocomplate/autocomplate.stories.js +30 -28
- package/src/components/autocomplate/index.js +145 -127
- package/src/components/button/button.stories.js +6 -6
- package/src/components/button/index.js +176 -126
- package/src/components/captcha/captcha.stories.js +12 -8
- package/src/components/captcha/index.js +47 -50
- package/src/components/checkbox/checkbox.stories.js +7 -7
- package/src/components/checkbox/index.js +77 -93
- package/src/components/file/file.stories.js +15 -15
- package/src/components/file/index.js +114 -116
- package/src/components/icon/Arrow.js +18 -18
- package/src/components/icon/CaptchaArrowDown.js +18 -18
- package/src/components/icon/CaptchaArrowUp.js +18 -18
- package/src/components/icon/CheckboxChecked.js +20 -20
- package/src/components/icon/CheckboxUnchecked.js +20 -20
- package/src/components/icon/Close.js +18 -18
- package/src/components/icon/CloseIcon.js +18 -18
- package/src/components/icon/CloseSlide.js +18 -18
- package/src/components/icon/DeleteComponent.js +19 -19
- package/src/components/icon/Dots.js +18 -18
- package/src/components/icon/HeartFilled.js +22 -23
- package/src/components/icon/HeartOutline.js +22 -22
- package/src/components/icon/Icon.js +3 -5
- package/src/components/icon/ListItemDelete.js +18 -18
- package/src/components/icon/ListItemJpeg.js +20 -20
- package/src/components/icon/ListItemJpg.js +20 -20
- package/src/components/icon/ListItemPdf.js +20 -20
- package/src/components/icon/ListItemPng.js +20 -20
- package/src/components/icon/Next.js +19 -19
- package/src/components/icon/Nextarrow.js +18 -18
- package/src/components/icon/PDF.js +18 -18
- package/src/components/icon/Prev.js +19 -19
- package/src/components/icon/RangeArrowDefault.js +41 -52
- package/src/components/icon/RangeArrowError.js +41 -52
- package/src/components/icon/RangeArrowSuccess.js +41 -52
- package/src/components/icon/RemoveFile.js +19 -19
- package/src/components/icon/ToasterClose.js +18 -18
- package/src/components/icon/ToasterError.js +18 -18
- package/src/components/icon/ToasterInfo.js +18 -18
- package/src/components/icon/ToasterSuccess.js +18 -18
- package/src/components/icon/ToasterWarning.js +18 -18
- package/src/components/icon/Tooltip.js +18 -18
- package/src/components/icon/Upload.js +24 -24
- package/src/components/input/index.js +267 -224
- package/src/components/input/input.stories.js +20 -21
- package/src/components/modal/index.js +172 -159
- package/src/components/modal/modal.stories.js +79 -78
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
- package/src/components/newAutocomplete/index.js +342 -216
- package/src/components/newFile/fileItem.js +213 -191
- package/src/components/newFile/index.js +231 -173
- package/src/components/newFile/newFile.stories.js +32 -35
- package/src/components/pagination/index.js +97 -122
- package/src/components/pagination/pagination.stories.js +362 -362
- package/src/components/pagination/paginationRange.js +42 -53
- package/src/components/radio/index.js +49 -62
- package/src/components/radio/radio.stories.js +7 -7
- package/src/components/select/index.js +316 -221
- package/src/components/select/select.stories.js +25 -14
- package/src/components/singleCheckbox/Checkbox.js +31 -34
- package/src/components/singleCheckbox/index.js +36 -45
- package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
- package/src/components/stepper/index.js +35 -30
- package/src/components/stepper/stepper.stories.js +11 -11
- package/src/components/table/index.js +280 -148
- package/src/components/table/table.stories.js +105 -217
- package/src/components/table/td.js +80 -72
- package/src/components/table/th.js +19 -16
- package/src/components/textarea/index.js +86 -62
- package/src/components/textarea/textarea.stories.js +10 -13
- package/src/components/toaster/Toast.js +177 -159
- package/src/components/toaster/index.js +107 -111
- package/src/components/toaster/toaster.stories.js +582 -367
- package/src/components/tooltip/index.js +79 -46
- package/src/components/tooltip/tooltip.stories.js +9 -10
- package/src/components/typography/index.js +108 -101
- package/src/components/typography/typography.stories.js +16 -19
- package/src/index.js +20 -20
- package/src/utils/index.js +11 -11
- package/tui.config.js +343 -341
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React, {useEffect, useState, useRef} from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classnames from 'classnames'
|
|
4
|
-
import { compereConfigs } from
|
|
5
|
-
import { SingleCheckbox } from '../singleCheckbox'
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classnames from 'classnames'
|
|
4
|
+
import { compereConfigs } from './../../utils'
|
|
5
|
+
import { SingleCheckbox } from '../singleCheckbox'
|
|
6
6
|
|
|
7
|
-
import ReactArrowIcon from '../icon/Arrow'
|
|
8
|
-
import ReactCloseIcon from '../icon/CloseIcon'
|
|
7
|
+
import ReactArrowIcon from '../icon/Arrow'
|
|
8
|
+
import ReactCloseIcon from '../icon/CloseIcon'
|
|
9
9
|
|
|
10
|
-
import styles from './select.module.css'
|
|
10
|
+
import styles from './select.module.css'
|
|
11
11
|
|
|
12
12
|
export const Select = ({
|
|
13
13
|
dots,
|
|
@@ -71,158 +71,159 @@ export const Select = ({
|
|
|
71
71
|
optionItemBackgroudColorHover,
|
|
72
72
|
|
|
73
73
|
boxShadow,
|
|
74
|
-
boxShadowHover
|
|
74
|
+
boxShadowHover,
|
|
75
75
|
}) => {
|
|
76
|
-
const ref = useRef()
|
|
77
|
-
|
|
78
|
-
const [opened, setOpened] = useState(false)
|
|
79
|
-
const [isHover, setIsHover] = useState(false)
|
|
80
|
-
const [newSelected, setNewSelected] = useState([])
|
|
81
|
-
const [existOptions, setExistOptions] = useState([])
|
|
82
|
-
|
|
83
|
-
const configStyles = compereConfigs()
|
|
84
|
-
const classProps = classnames(
|
|
85
|
-
className
|
|
86
|
-
);
|
|
76
|
+
const ref = useRef()
|
|
77
|
+
|
|
78
|
+
const [opened, setOpened] = useState(false)
|
|
79
|
+
const [isHover, setIsHover] = useState(false)
|
|
80
|
+
const [newSelected, setNewSelected] = useState([])
|
|
81
|
+
const [existOptions, setExistOptions] = useState([])
|
|
82
|
+
|
|
83
|
+
const configStyles = compereConfigs()
|
|
84
|
+
const classProps = classnames(className)
|
|
87
85
|
|
|
88
86
|
const handleOpenClose = () => {
|
|
89
|
-
setOpened(!opened)
|
|
90
|
-
}
|
|
87
|
+
setOpened(!opened)
|
|
88
|
+
}
|
|
91
89
|
|
|
92
90
|
const handleClearSelect = (e) => {
|
|
93
|
-
onChange({})
|
|
94
|
-
setNewSelected([])
|
|
95
|
-
const clearedOptions =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
onChange({})
|
|
92
|
+
setNewSelected([])
|
|
93
|
+
const clearedOptions =
|
|
94
|
+
existOptions &&
|
|
95
|
+
existOptions.length > 0 &&
|
|
96
|
+
existOptions.map((item) => {
|
|
97
|
+
item.checked = false
|
|
98
|
+
return item
|
|
99
|
+
})
|
|
100
|
+
setExistOptions(clearedOptions)
|
|
101
|
+
e.stopPropagation()
|
|
102
|
+
}
|
|
102
103
|
|
|
103
104
|
const handleSelectItem = (option) => {
|
|
104
|
-
const checkedOption = {...option}
|
|
105
|
-
delete checkedOption.checked
|
|
106
|
-
|
|
105
|
+
const checkedOption = { ...option }
|
|
106
|
+
delete checkedOption.checked
|
|
107
|
+
|
|
107
108
|
if (!multiple) {
|
|
108
|
-
setOpened(!opened)
|
|
109
|
-
setNewSelected([option])
|
|
110
|
-
onChange(checkedOption)
|
|
109
|
+
setOpened(!opened)
|
|
110
|
+
setNewSelected([option])
|
|
111
|
+
onChange(checkedOption)
|
|
111
112
|
} else {
|
|
112
|
-
const indexOfObject = newSelected.findIndex(obj => {
|
|
113
|
-
return obj[keyNames.name] === option[keyNames.name]
|
|
114
|
-
})
|
|
113
|
+
const indexOfObject = newSelected.findIndex((obj) => {
|
|
114
|
+
return obj[keyNames.name] === option[keyNames.name]
|
|
115
|
+
})
|
|
115
116
|
if (indexOfObject === -1) {
|
|
116
|
-
option.checked = true
|
|
117
|
-
setNewSelected(prev => {
|
|
118
|
-
return [
|
|
119
|
-
|
|
120
|
-
option
|
|
121
|
-
]
|
|
122
|
-
});
|
|
117
|
+
option.checked = true
|
|
118
|
+
setNewSelected((prev) => {
|
|
119
|
+
return [...prev, option]
|
|
120
|
+
})
|
|
123
121
|
onChange([...newSelected, option])
|
|
124
122
|
} else {
|
|
125
|
-
option.checked = false
|
|
126
|
-
setNewSelected([
|
|
127
|
-
|
|
128
|
-
...newSelected.slice(indexOfObject + 1),
|
|
129
|
-
]);
|
|
130
|
-
onChange([
|
|
131
|
-
...newSelected.slice(0, indexOfObject),
|
|
132
|
-
...newSelected.slice(indexOfObject + 1),
|
|
133
|
-
])
|
|
123
|
+
option.checked = false
|
|
124
|
+
setNewSelected([...newSelected.slice(0, indexOfObject), ...newSelected.slice(indexOfObject + 1)])
|
|
125
|
+
onChange([...newSelected.slice(0, indexOfObject), ...newSelected.slice(indexOfObject + 1)])
|
|
134
126
|
}
|
|
135
127
|
}
|
|
136
|
-
}
|
|
128
|
+
}
|
|
137
129
|
|
|
138
130
|
const handleMouseEnter = () => {
|
|
139
|
-
setIsHover(true)
|
|
140
|
-
}
|
|
141
|
-
|
|
131
|
+
setIsHover(true)
|
|
132
|
+
}
|
|
133
|
+
|
|
142
134
|
const handleMouseLeave = () => {
|
|
143
|
-
setIsHover(false)
|
|
144
|
-
}
|
|
135
|
+
setIsHover(false)
|
|
136
|
+
}
|
|
145
137
|
|
|
146
138
|
const handleMouseEnterOption = (e) => {
|
|
147
|
-
e.target.style.color = optionItemColorHover ? optionItemColorHover : configStyles.SELECT.optionItemColorHover
|
|
148
|
-
e.target.style.backgroundColor = optionItemBackgroudColorHover
|
|
149
|
-
|
|
150
|
-
|
|
139
|
+
e.target.style.color = optionItemColorHover ? optionItemColorHover : configStyles.SELECT.optionItemColorHover
|
|
140
|
+
e.target.style.backgroundColor = optionItemBackgroudColorHover
|
|
141
|
+
? optionItemBackgroudColorHover
|
|
142
|
+
: configStyles.SELECT.optionItemBackgroudColorHover
|
|
143
|
+
}
|
|
144
|
+
|
|
151
145
|
const handleMouseLeaveOption = (e) => {
|
|
152
146
|
e.target.style.color = optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor
|
|
153
|
-
e.target.style.backgroundColor = optionItemBackgroudColor
|
|
154
|
-
|
|
147
|
+
e.target.style.backgroundColor = optionItemBackgroudColor
|
|
148
|
+
? optionItemBackgroudColor
|
|
149
|
+
: configStyles.SELECT.optionItemBackgroudColor
|
|
150
|
+
}
|
|
155
151
|
|
|
156
152
|
const isObjectEmpty = (obj) => {
|
|
157
153
|
for (var key in obj) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
155
|
+
if (obj.hasOwnProperty(key)) {
|
|
156
|
+
return false
|
|
157
|
+
}
|
|
161
158
|
}
|
|
162
|
-
return true
|
|
163
|
-
}
|
|
159
|
+
return true
|
|
160
|
+
}
|
|
164
161
|
|
|
165
162
|
useEffect(() => {
|
|
166
|
-
if(opened){
|
|
167
|
-
const checkIfClickedOutside = e => {
|
|
163
|
+
if (opened) {
|
|
164
|
+
const checkIfClickedOutside = (e) => {
|
|
168
165
|
if (opened && ref.current && !ref.current.contains(e.target)) {
|
|
169
166
|
setOpened(false)
|
|
170
167
|
}
|
|
171
|
-
}
|
|
172
|
-
document.addEventListener(
|
|
168
|
+
}
|
|
169
|
+
document.addEventListener('mousedown', checkIfClickedOutside)
|
|
173
170
|
return () => {
|
|
174
|
-
document.removeEventListener(
|
|
171
|
+
document.removeEventListener('mousedown', checkIfClickedOutside)
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
|
-
}, [opened])
|
|
174
|
+
}, [opened])
|
|
178
175
|
|
|
179
176
|
useEffect(() => {
|
|
180
177
|
if (selected) {
|
|
181
178
|
if (selected.length > 0) {
|
|
182
|
-
setNewSelected(isObjectEmpty(selected[0]) ? []: selected
|
|
179
|
+
setNewSelected(isObjectEmpty(selected[0]) ? [] : selected)
|
|
183
180
|
} else {
|
|
184
|
-
setNewSelected([])
|
|
181
|
+
setNewSelected([])
|
|
185
182
|
}
|
|
186
183
|
}
|
|
187
184
|
|
|
188
185
|
if (!multiple) {
|
|
189
|
-
options && options.length > 0 && setExistOptions(options)
|
|
186
|
+
options && options.length > 0 && setExistOptions(options)
|
|
190
187
|
} else {
|
|
191
|
-
const modifiedOptions =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
188
|
+
const modifiedOptions =
|
|
189
|
+
options &&
|
|
190
|
+
options.length > 0 &&
|
|
191
|
+
options.map((item) => {
|
|
192
|
+
item.checked = false
|
|
193
|
+
if (selected && selected.length > 0) {
|
|
194
|
+
selected.map((innerItem) => {
|
|
195
|
+
if (innerItem[keyNames.name] === item[keyNames.name]) {
|
|
196
|
+
item.checked = true
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
return item
|
|
201
|
+
})
|
|
202
|
+
setExistOptions(modifiedOptions)
|
|
203
203
|
}
|
|
204
|
-
}, [options, multiple, selected, selected?.length])
|
|
205
|
-
|
|
204
|
+
}, [options, multiple, selected, selected?.length])
|
|
205
|
+
|
|
206
206
|
return (
|
|
207
207
|
<div className={classProps} style={{ position: 'relative' }}>
|
|
208
|
-
{
|
|
209
|
-
label
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
208
|
+
{label ? (
|
|
209
|
+
<label
|
|
210
|
+
style={{
|
|
211
|
+
color: labelColor ? labelColor : configStyles.SELECT.labelColor,
|
|
212
|
+
fontWeight: labelWeight ? labelWeight : configStyles.SELECT.labelWeight,
|
|
213
|
+
display: labelDisplay ? labelDisplay : configStyles.SELECT.labelDisplay,
|
|
214
|
+
fontSize: labelFontSize ? labelFontSize : configStyles.SELECT.labelFontSize,
|
|
215
|
+
lineHeight: labelLineHeight ? labelLineHeight : configStyles.SELECT.labelLineHeight,
|
|
216
|
+
marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.SELECT.labelMarginBottom,
|
|
217
|
+
textTransform: labelTextTransform ? labelTextTransform : configStyles.SELECT.labelTextTransform,
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
{label}
|
|
221
|
+
{required && <sup style={{ color: '#ee0000' }}>*</sup>}
|
|
222
|
+
</label>
|
|
223
|
+
) : (
|
|
224
|
+
''
|
|
225
|
+
)}
|
|
226
|
+
|
|
226
227
|
<div ref={ref}>
|
|
227
228
|
<div className={styles['select-content']}>
|
|
228
229
|
<div
|
|
@@ -233,15 +234,37 @@ export const Select = ({
|
|
|
233
234
|
borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
|
|
234
235
|
fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
|
|
235
236
|
boxSizing: selectedBoxSizing ? selectedBoxSizing : configStyles.SELECT.selectedBoxSizing,
|
|
236
|
-
fontWeight: selectedFontWeight
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
fontWeight: selectedFontWeight
|
|
238
|
+
? selectedFontWeight
|
|
239
|
+
: configStyles.SELECT.selectedFontWeight,
|
|
240
|
+
lineHeight: selectedLineHeight
|
|
241
|
+
? selectedLineHeight
|
|
242
|
+
: configStyles.SELECT.selectedLineHeight,
|
|
243
|
+
transition: selectedTransition
|
|
244
|
+
? selectedTransition
|
|
245
|
+
: configStyles.SELECT.selectedTransition,
|
|
246
|
+
backgroundColor: disabled
|
|
247
|
+
? selectedDisableBackgroundColor
|
|
248
|
+
? selectedDisableBackgroundColor
|
|
249
|
+
: configStyles.SELECT.selectedDisableBackgroundColor
|
|
250
|
+
: selectedBackgroundColor
|
|
251
|
+
? selectedBackgroundColor
|
|
252
|
+
: configStyles.SELECT.selectedBackgroundColor,
|
|
253
|
+
boxShadow: errorMessage
|
|
254
|
+
? errorColor
|
|
255
|
+
? `0 0 0 2px ${errorColor}`
|
|
256
|
+
: `0 0 0 2px ${configStyles.SELECT.errorColor}`
|
|
257
|
+
: isHover
|
|
258
|
+
? boxShadowHover
|
|
259
|
+
? boxShadowHover
|
|
260
|
+
: configStyles.SELECT.boxShadowHover
|
|
261
|
+
: boxShadow
|
|
262
|
+
? boxShadow
|
|
263
|
+
: configStyles.SELECT.boxShadow,
|
|
241
264
|
}}
|
|
242
|
-
onClick={disabled ? _ => _ :
|
|
243
|
-
onMouseEnter={disabled ? _ => _ :
|
|
244
|
-
onMouseLeave={disabled ? _ => _ :
|
|
265
|
+
onClick={disabled ? (_) => _ : () => handleOpenClose()}
|
|
266
|
+
onMouseEnter={disabled ? (_) => _ : () => handleMouseEnter()}
|
|
267
|
+
onMouseLeave={disabled ? (_) => _ : () => handleMouseLeave()}
|
|
245
268
|
className={`${styles['select-content-top']}`}
|
|
246
269
|
>
|
|
247
270
|
<div
|
|
@@ -250,119 +273,191 @@ export const Select = ({
|
|
|
250
273
|
whiteSpace: 'nowrap',
|
|
251
274
|
overflow: 'hidden',
|
|
252
275
|
textOverflow: 'ellipsis',
|
|
253
|
-
color: errorMessage
|
|
276
|
+
color: errorMessage
|
|
277
|
+
? errorColor
|
|
278
|
+
? errorColor
|
|
279
|
+
: configStyles.SELECT.errorColor
|
|
280
|
+
: isHover
|
|
281
|
+
? selectedHoverColor
|
|
282
|
+
? selectedHoverColor
|
|
283
|
+
: configStyles.SELECT.selectedHoverColor
|
|
284
|
+
: selectedColor
|
|
285
|
+
? selectedColor
|
|
286
|
+
: configStyles.SELECT.selectedColor,
|
|
254
287
|
}}
|
|
255
288
|
>
|
|
256
|
-
{
|
|
257
|
-
|
|
258
|
-
newSelected && newSelected.length > 0
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
289
|
+
{!multiple && newSelected && newSelected[0] && newSelected[0][keyNames.name]
|
|
290
|
+
? newSelected[0][keyNames.name]
|
|
291
|
+
: newSelected && newSelected.length > 0
|
|
292
|
+
? newSelected.map((_, index) => {
|
|
293
|
+
if (newSelected[index][keyNames.name]) {
|
|
294
|
+
if (index > 0) {
|
|
295
|
+
return ', ' + newSelected[index][keyNames.name]
|
|
296
|
+
} else {
|
|
297
|
+
return newSelected[index][keyNames.name]
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
: defaultOption
|
|
302
|
+
? defaultOption
|
|
303
|
+
: ''}
|
|
268
304
|
</div>
|
|
269
305
|
<div className={`${styles['select-content-top-icon']}`}>
|
|
270
|
-
{
|
|
271
|
-
!disabled && multiple && newSelected.length > 1 && <span>{newSelected.length}</span>
|
|
272
|
-
}
|
|
306
|
+
{!disabled && multiple && newSelected.length > 1 && <span>{newSelected.length}</span>}
|
|
273
307
|
|
|
274
|
-
{(showCloseIcon === true || showCloseIcon === false
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
308
|
+
{(showCloseIcon === true || showCloseIcon === false
|
|
309
|
+
? showCloseIcon
|
|
310
|
+
: configStyles.SELECT.showCloseIcon) &&
|
|
311
|
+
!disabled &&
|
|
312
|
+
newSelected &&
|
|
313
|
+
newSelected.length > 0 && (
|
|
314
|
+
<div
|
|
315
|
+
className={`${styles['close-icon']}`}
|
|
316
|
+
onClick={disabled ? (_) => _ : handleClearSelect}
|
|
317
|
+
style={{ marginLeft: multiple && newSelected.length > 1 ? '17px' : '0px' }}
|
|
318
|
+
>
|
|
319
|
+
{closeIcon ? closeIcon : <ReactCloseIcon />}
|
|
320
|
+
</div>
|
|
321
|
+
)}
|
|
283
322
|
|
|
284
|
-
{!disabled ?
|
|
323
|
+
{!disabled ? (
|
|
324
|
+
<div
|
|
285
325
|
style={{
|
|
286
326
|
transform: opened ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
287
327
|
}}
|
|
288
|
-
className={`${styles['arrow-icon']}`}
|
|
328
|
+
className={`${styles['arrow-icon']}`}
|
|
329
|
+
>
|
|
289
330
|
{arrowIcon ? arrowIcon : <ReactArrowIcon />}
|
|
290
|
-
</div>
|
|
291
|
-
|
|
331
|
+
</div>
|
|
332
|
+
) : (
|
|
333
|
+
''
|
|
334
|
+
)}
|
|
292
335
|
</div>
|
|
293
336
|
</div>
|
|
294
|
-
{
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
337
|
+
{opened && !disabled ? (
|
|
338
|
+
<div
|
|
339
|
+
style={{
|
|
340
|
+
boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
|
|
341
|
+
borderRadius: optionsBorderRadius
|
|
342
|
+
? optionsBorderRadius
|
|
343
|
+
: configStyles.SELECT.optionsBorderRadius,
|
|
344
|
+
backgroundColor: optionsBackgroundColor
|
|
345
|
+
? optionsBackgroundColor
|
|
346
|
+
: configStyles.SELECT.optionsBackgroundColor,
|
|
347
|
+
top: selectedMinHeight
|
|
348
|
+
? selectedMinHeight.includes('rem')
|
|
349
|
+
? parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) +
|
|
350
|
+
0.6 +
|
|
351
|
+
'rem'
|
|
352
|
+
: parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) +
|
|
353
|
+
6 +
|
|
354
|
+
'px'
|
|
355
|
+
: configStyles.SELECT.selectedMinHeight.includes('rem')
|
|
356
|
+
? parseFloat(
|
|
357
|
+
configStyles.SELECT.selectedMinHeight.substr(
|
|
358
|
+
0,
|
|
359
|
+
configStyles.SELECT.selectedMinHeight.length - 3
|
|
360
|
+
)
|
|
361
|
+
) +
|
|
362
|
+
0.6 +
|
|
363
|
+
'rem'
|
|
364
|
+
: parseFloat(
|
|
365
|
+
configStyles.SELECT.selectedMinHeight.substr(
|
|
366
|
+
0,
|
|
367
|
+
configStyles.SELECT.selectedMinHeight.length - 2
|
|
368
|
+
)
|
|
369
|
+
) +
|
|
370
|
+
6 +
|
|
371
|
+
'px',
|
|
372
|
+
}}
|
|
373
|
+
className={`${styles['select-content-bottom']}`}
|
|
374
|
+
>
|
|
375
|
+
<div className={`${styles['select-content-bottom-inner']}`}>
|
|
376
|
+
{existOptions &&
|
|
377
|
+
existOptions.length > 0 &&
|
|
378
|
+
existOptions.map((option, i) => {
|
|
379
|
+
return (
|
|
380
|
+
<div
|
|
381
|
+
key={i}
|
|
382
|
+
disabled={true}
|
|
383
|
+
defaultValue={option[keyNames.id]}
|
|
384
|
+
onClick={disabled ? (_) => _ : () => handleSelectItem(option)}
|
|
385
|
+
onMouseEnter={disabled ? (_) => _ : (e) => handleMouseEnterOption(e)}
|
|
386
|
+
onMouseLeave={disabled ? (_) => _ : (e) => handleMouseLeaveOption(e)}
|
|
387
|
+
className={`${styles['select-content-bottom-row']} ${
|
|
388
|
+
dots || configStyles.SELECT.dots ? styles['ellipsis'] : ''
|
|
389
|
+
}`}
|
|
390
|
+
style={{
|
|
391
|
+
overflowWrap:
|
|
392
|
+
!dots && !configStyles.SELECT.dots ? 'anywhere' : 'break-word',
|
|
393
|
+
color: optionItemColor
|
|
394
|
+
? optionItemColor
|
|
395
|
+
: configStyles.SELECT.optionItemColor,
|
|
396
|
+
cursor: optionItemCursor
|
|
397
|
+
? optionItemCursor
|
|
398
|
+
: configStyles.SELECT.optionItemCursor,
|
|
399
|
+
padding: optionItemPadding
|
|
400
|
+
? optionItemPadding
|
|
401
|
+
: configStyles.SELECT.optionItemPadding,
|
|
402
|
+
fontSize: optionItemFontSize
|
|
403
|
+
? optionItemFontSize
|
|
404
|
+
: configStyles.SELECT.optionItemFontSize,
|
|
405
|
+
boxSizing: optionItemBoxSizing
|
|
406
|
+
? optionItemBoxSizing
|
|
407
|
+
: configStyles.SELECT.optionItemBoxSizing,
|
|
408
|
+
minHeight: optionItemMinHeight
|
|
409
|
+
? optionItemMinHeight
|
|
410
|
+
: configStyles.SELECT.optionItemMinHeight,
|
|
411
|
+
fontWeight: optionItemFontWeight
|
|
412
|
+
? optionItemFontWeight
|
|
413
|
+
: configStyles.SELECT.optionItemFontWeight,
|
|
414
|
+
lineHeight:
|
|
415
|
+
dots || configStyles.SELECT.dots
|
|
416
|
+
? '46px'
|
|
417
|
+
: optionItemLineHeight
|
|
418
|
+
? optionItemLineHeight
|
|
419
|
+
: configStyles.SELECT.optionItemLineHeight,
|
|
420
|
+
marginBottom: optionItemMarginBottom
|
|
421
|
+
? optionItemMarginBottom
|
|
422
|
+
: configStyles.SELECT.optionItemMarginBottom,
|
|
423
|
+
backgroundColor: optionItemBackgroudColor
|
|
424
|
+
? optionItemBackgroudColor
|
|
425
|
+
: configStyles.SELECT.optionItemBackgroudColor,
|
|
426
|
+
}}
|
|
427
|
+
>
|
|
428
|
+
{multiple && multipleCheckbox ? (
|
|
429
|
+
<SingleCheckbox checked={option.checked} />
|
|
430
|
+
) : (
|
|
431
|
+
''
|
|
432
|
+
)}
|
|
433
|
+
{option[keyNames.name]}
|
|
434
|
+
</div>
|
|
435
|
+
)
|
|
436
|
+
})}
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
) : null}
|
|
345
440
|
</div>
|
|
346
441
|
</div>
|
|
347
|
-
|
|
348
|
-
{
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
442
|
+
|
|
443
|
+
{errorMessage ? (
|
|
444
|
+
<span
|
|
445
|
+
style={{
|
|
446
|
+
position: 'absolute',
|
|
447
|
+
color: errorColor ? errorColor : configStyles.SELECT.errorColor,
|
|
448
|
+
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize,
|
|
449
|
+
zIndex: errorZindex ? errorZindex : configStyles.SELECT.errorZindex,
|
|
450
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
451
|
+
}}
|
|
452
|
+
>
|
|
453
|
+
{errorMessage}
|
|
454
|
+
</span>
|
|
455
|
+
) : (
|
|
456
|
+
''
|
|
457
|
+
)}
|
|
363
458
|
</div>
|
|
364
|
-
)
|
|
365
|
-
}
|
|
459
|
+
)
|
|
460
|
+
}
|
|
366
461
|
|
|
367
462
|
Select.propTypes = {
|
|
368
463
|
dots: PropTypes.bool,
|
|
@@ -427,4 +522,4 @@ Select.propTypes = {
|
|
|
427
522
|
|
|
428
523
|
boxShadow: PropTypes.string,
|
|
429
524
|
boxShadowHover: PropTypes.string,
|
|
430
|
-
}
|
|
525
|
+
}
|