@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,59 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { Radio, RadioDirectionMode } from '.'
|
|
3
|
-
export default {
|
|
4
|
-
component: Radio,
|
|
5
|
-
title: 'Components/Radio',
|
|
6
|
-
argsType: {
|
|
7
|
-
direction: {
|
|
8
|
-
options: Object.values(RadioDirectionMode),
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const radioData = [
|
|
14
|
-
{
|
|
15
|
-
id: 1,
|
|
16
|
-
disabled: false,
|
|
17
|
-
label: 'radio label 1',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 2,
|
|
21
|
-
disabled: false,
|
|
22
|
-
label: 'radio label 2',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: 3,
|
|
26
|
-
disabled: true,
|
|
27
|
-
label: 'radio label 3',
|
|
28
|
-
},
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
const selectedRadio = {
|
|
32
|
-
id: 3,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Template = (args) => {
|
|
36
|
-
const [innerData] = useState(radioData)
|
|
37
|
-
const [innerSelectedData, setInnerSelectedData] = useState(selectedRadio)
|
|
38
|
-
|
|
39
|
-
const handleGetData = (selected) => {
|
|
40
|
-
console.log(selected, 'selected - - -')
|
|
41
|
-
setInnerSelectedData(selected)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<Radio
|
|
46
|
-
{...args}
|
|
47
|
-
data={innerData}
|
|
48
|
-
getData={handleGetData}
|
|
49
|
-
selected={innerSelectedData}
|
|
50
|
-
keyNames={{
|
|
51
|
-
id: 'id',
|
|
52
|
-
label: 'label',
|
|
53
|
-
disabled: 'disabled',
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export const RadioButton = Template.bind({})
|
|
@@ -1,534 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classnames from 'classnames'
|
|
4
|
-
import { compereConfigs, hasOwnerProperty } from './../../utils'
|
|
5
|
-
import { SingleCheckbox } from '../singleCheckbox'
|
|
6
|
-
|
|
7
|
-
import ReactArrowIcon from '../icon/Arrow'
|
|
8
|
-
import SvgRequired from './../icon/Required'
|
|
9
|
-
import ReactCloseIcon from '../icon/CloseIcon'
|
|
10
|
-
|
|
11
|
-
import styles from './select.module.css'
|
|
12
|
-
|
|
13
|
-
export const Select = ({
|
|
14
|
-
dots,
|
|
15
|
-
options,
|
|
16
|
-
multiple,
|
|
17
|
-
disabled,
|
|
18
|
-
required,
|
|
19
|
-
onChange,
|
|
20
|
-
keyNames,
|
|
21
|
-
selected,
|
|
22
|
-
className,
|
|
23
|
-
marginTop,
|
|
24
|
-
arrowIcon,
|
|
25
|
-
closeIcon,
|
|
26
|
-
errorZindex,
|
|
27
|
-
errorMessage,
|
|
28
|
-
showCloseIcon,
|
|
29
|
-
defaultOption,
|
|
30
|
-
multipleCheckbox,
|
|
31
|
-
|
|
32
|
-
label,
|
|
33
|
-
labelColor,
|
|
34
|
-
labelWeight,
|
|
35
|
-
labelDisplay,
|
|
36
|
-
labelFontSize,
|
|
37
|
-
labelLineHeight,
|
|
38
|
-
labelFontFamily,
|
|
39
|
-
labelMarginBottom,
|
|
40
|
-
labelTextTransform,
|
|
41
|
-
|
|
42
|
-
cursor,
|
|
43
|
-
errorSize,
|
|
44
|
-
errorColor,
|
|
45
|
-
selectedColor,
|
|
46
|
-
selectedRadius,
|
|
47
|
-
selectedMinHeight,
|
|
48
|
-
selectedPadding,
|
|
49
|
-
selectedFontSize,
|
|
50
|
-
selectedBoxSizing,
|
|
51
|
-
selectedFontWeight,
|
|
52
|
-
selectedLineHeight,
|
|
53
|
-
selectedHoverColor,
|
|
54
|
-
selectedTransition,
|
|
55
|
-
selectedBackgroundColor,
|
|
56
|
-
selectedDisableBackgroundColor,
|
|
57
|
-
|
|
58
|
-
optionsBoxShadow,
|
|
59
|
-
optionsBorderRadius,
|
|
60
|
-
optionsBackgroundColor,
|
|
61
|
-
|
|
62
|
-
optionItemColor,
|
|
63
|
-
optionItemCursor,
|
|
64
|
-
optionItemPadding,
|
|
65
|
-
optionItemFontSize,
|
|
66
|
-
optionItemMinHeight,
|
|
67
|
-
optionItemBoxSizing,
|
|
68
|
-
optionItemFontWeight,
|
|
69
|
-
optionItemLineHeight,
|
|
70
|
-
optionItemColorHover,
|
|
71
|
-
optionItemMarginBottom,
|
|
72
|
-
optionItemBackgroudColor,
|
|
73
|
-
optionItemBackgroudColorHover,
|
|
74
|
-
|
|
75
|
-
boxShadow,
|
|
76
|
-
boxShadowHover,
|
|
77
|
-
}) => {
|
|
78
|
-
const ref = useRef()
|
|
79
|
-
|
|
80
|
-
const [opened, setOpened] = useState(false)
|
|
81
|
-
const [isHover, setIsHover] = useState(false)
|
|
82
|
-
const [newSelected, setNewSelected] = useState([])
|
|
83
|
-
const [existOptions, setExistOptions] = useState([])
|
|
84
|
-
|
|
85
|
-
const configStyles = compereConfigs()
|
|
86
|
-
const classProps = classnames(className ? className : configStyles.SELECT.className)
|
|
87
|
-
|
|
88
|
-
const handleOpenClose = () => {
|
|
89
|
-
setOpened(!opened)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const handleClearSelect = (e) => {
|
|
93
|
-
onChange({})
|
|
94
|
-
setNewSelected([])
|
|
95
|
-
const clearedOptions =
|
|
96
|
-
existOptions &&
|
|
97
|
-
existOptions.length > 0 &&
|
|
98
|
-
existOptions.map((item) => {
|
|
99
|
-
if (hasOwnerProperty(item, 'checked')) {
|
|
100
|
-
item.checked = false
|
|
101
|
-
}
|
|
102
|
-
return item
|
|
103
|
-
})
|
|
104
|
-
setExistOptions(clearedOptions)
|
|
105
|
-
e.stopPropagation()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const handleSelectItem = (option) => {
|
|
109
|
-
const checkedOption = { ...option }
|
|
110
|
-
delete checkedOption.checked
|
|
111
|
-
|
|
112
|
-
if (!multiple) {
|
|
113
|
-
setOpened(!opened)
|
|
114
|
-
setNewSelected([option])
|
|
115
|
-
onChange(checkedOption)
|
|
116
|
-
} else {
|
|
117
|
-
const indexOfObject = newSelected.findIndex((obj) => {
|
|
118
|
-
return obj[keyNames.name] === option[keyNames.name]
|
|
119
|
-
})
|
|
120
|
-
if (indexOfObject === -1) {
|
|
121
|
-
option.checked = true
|
|
122
|
-
setNewSelected((prev) => {
|
|
123
|
-
return [...prev, option]
|
|
124
|
-
})
|
|
125
|
-
onChange([...newSelected, option])
|
|
126
|
-
} else {
|
|
127
|
-
option.checked = false
|
|
128
|
-
setNewSelected([...newSelected.slice(0, indexOfObject), ...newSelected.slice(indexOfObject + 1)])
|
|
129
|
-
onChange([...newSelected.slice(0, indexOfObject), ...newSelected.slice(indexOfObject + 1)])
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const handleMouseEnter = () => {
|
|
135
|
-
setIsHover(true)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const handleMouseLeave = () => {
|
|
139
|
-
setIsHover(false)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const handleMouseEnterOption = (e) => {
|
|
143
|
-
e.target.style.color = optionItemColorHover ? optionItemColorHover : configStyles.SELECT.optionItemColorHover
|
|
144
|
-
e.target.style.backgroundColor = optionItemBackgroudColorHover
|
|
145
|
-
? optionItemBackgroudColorHover
|
|
146
|
-
: configStyles.SELECT.optionItemBackgroudColorHover
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const handleMouseLeaveOption = (e) => {
|
|
150
|
-
e.target.style.color = optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor
|
|
151
|
-
e.target.style.backgroundColor = optionItemBackgroudColor
|
|
152
|
-
? optionItemBackgroudColor
|
|
153
|
-
: configStyles.SELECT.optionItemBackgroudColor
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const isObjectEmpty = (obj) => {
|
|
157
|
-
for (var key in obj) {
|
|
158
|
-
if (hasOwnerProperty(obj, key)) {
|
|
159
|
-
return false
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return true
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
useEffect(() => {
|
|
166
|
-
if (opened) {
|
|
167
|
-
const checkIfClickedOutside = (e) => {
|
|
168
|
-
if (opened && ref.current && !ref.current.contains(e.target)) {
|
|
169
|
-
setOpened(false)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
document.addEventListener('mousedown', checkIfClickedOutside)
|
|
173
|
-
return () => {
|
|
174
|
-
document.removeEventListener('mousedown', checkIfClickedOutside)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}, [opened])
|
|
178
|
-
|
|
179
|
-
useEffect(() => {
|
|
180
|
-
if (selected) {
|
|
181
|
-
if (selected.length > 0) {
|
|
182
|
-
setNewSelected(isObjectEmpty(selected[0]) ? [] : selected)
|
|
183
|
-
} else {
|
|
184
|
-
setNewSelected([])
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (!multiple) {
|
|
189
|
-
options && options.length > 0 && setExistOptions(options)
|
|
190
|
-
} else {
|
|
191
|
-
const modifiedOptions =
|
|
192
|
-
options &&
|
|
193
|
-
options.length > 0 &&
|
|
194
|
-
options.map((item) => {
|
|
195
|
-
item.checked = false
|
|
196
|
-
if (selected && selected.length > 0) {
|
|
197
|
-
selected.map((innerItem) => {
|
|
198
|
-
if (innerItem[keyNames.name] === item[keyNames.name]) {
|
|
199
|
-
item.checked = true
|
|
200
|
-
}
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
return item
|
|
204
|
-
})
|
|
205
|
-
setExistOptions(modifiedOptions)
|
|
206
|
-
}
|
|
207
|
-
}, [options, multiple, selected, selected?.length])
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<div className={classProps} style={{ position: 'relative', width: '100%' }}>
|
|
211
|
-
{label ? (
|
|
212
|
-
<label
|
|
213
|
-
style={{
|
|
214
|
-
color: labelColor ? labelColor : configStyles.SELECT.labelColor,
|
|
215
|
-
fontWeight: labelWeight ? labelWeight : configStyles.SELECT.labelWeight,
|
|
216
|
-
display: labelDisplay ? labelDisplay : configStyles.SELECT.labelDisplay,
|
|
217
|
-
fontSize: labelFontSize ? labelFontSize : configStyles.SELECT.labelFontSize,
|
|
218
|
-
lineHeight: labelLineHeight ? labelLineHeight : configStyles.SELECT.labelLineHeight,
|
|
219
|
-
fontFamily: labelFontFamily ? labelFontFamily : configStyles.SELECT.labelFontFamily,
|
|
220
|
-
marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.SELECT.labelMarginBottom,
|
|
221
|
-
textTransform: labelTextTransform ? labelTextTransform : configStyles.SELECT.labelTextTransform,
|
|
222
|
-
}}
|
|
223
|
-
>
|
|
224
|
-
{label}
|
|
225
|
-
{required && (
|
|
226
|
-
<sup>
|
|
227
|
-
<SvgRequired />
|
|
228
|
-
</sup>
|
|
229
|
-
)}
|
|
230
|
-
</label>
|
|
231
|
-
) : (
|
|
232
|
-
''
|
|
233
|
-
)}
|
|
234
|
-
|
|
235
|
-
<div ref={ref}>
|
|
236
|
-
<div className={styles['select-content']}>
|
|
237
|
-
<div
|
|
238
|
-
style={{
|
|
239
|
-
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
|
|
240
|
-
minHeight: selectedMinHeight ? selectedMinHeight : configStyles.SELECT.selectedMinHeight,
|
|
241
|
-
padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
|
|
242
|
-
borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
|
|
243
|
-
fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
|
|
244
|
-
boxSizing: selectedBoxSizing ? selectedBoxSizing : configStyles.SELECT.selectedBoxSizing,
|
|
245
|
-
fontWeight: selectedFontWeight
|
|
246
|
-
? selectedFontWeight
|
|
247
|
-
: configStyles.SELECT.selectedFontWeight,
|
|
248
|
-
lineHeight: selectedLineHeight
|
|
249
|
-
? selectedLineHeight
|
|
250
|
-
: configStyles.SELECT.selectedLineHeight,
|
|
251
|
-
transition: selectedTransition
|
|
252
|
-
? selectedTransition
|
|
253
|
-
: configStyles.SELECT.selectedTransition,
|
|
254
|
-
backgroundColor: disabled
|
|
255
|
-
? selectedDisableBackgroundColor
|
|
256
|
-
? selectedDisableBackgroundColor
|
|
257
|
-
: configStyles.SELECT.selectedDisableBackgroundColor
|
|
258
|
-
: selectedBackgroundColor
|
|
259
|
-
? selectedBackgroundColor
|
|
260
|
-
: configStyles.SELECT.selectedBackgroundColor,
|
|
261
|
-
boxShadow: errorMessage
|
|
262
|
-
? errorColor
|
|
263
|
-
? `0 0 0 2px ${errorColor}`
|
|
264
|
-
: `0 0 0 2px ${configStyles.SELECT.errorColor}`
|
|
265
|
-
: isHover
|
|
266
|
-
? boxShadowHover
|
|
267
|
-
? boxShadowHover
|
|
268
|
-
: configStyles.SELECT.boxShadowHover
|
|
269
|
-
: boxShadow
|
|
270
|
-
? boxShadow
|
|
271
|
-
: configStyles.SELECT.boxShadow,
|
|
272
|
-
}}
|
|
273
|
-
onClick={disabled ? (_) => _ : () => handleOpenClose()}
|
|
274
|
-
onMouseEnter={disabled ? (_) => _ : () => handleMouseEnter()}
|
|
275
|
-
onMouseLeave={disabled ? (_) => _ : () => handleMouseLeave()}
|
|
276
|
-
className={`${styles['select-content-top']}`}
|
|
277
|
-
>
|
|
278
|
-
<div
|
|
279
|
-
className={`${styles['select-content-top-text']}`}
|
|
280
|
-
style={{
|
|
281
|
-
whiteSpace: disabled ? 'pre-wrap' : 'nowrap',
|
|
282
|
-
overflow: 'hidden',
|
|
283
|
-
textOverflow: 'ellipsis',
|
|
284
|
-
color: errorMessage
|
|
285
|
-
? errorColor
|
|
286
|
-
? errorColor
|
|
287
|
-
: configStyles.SELECT.errorColor
|
|
288
|
-
: isHover
|
|
289
|
-
? selectedHoverColor
|
|
290
|
-
? selectedHoverColor
|
|
291
|
-
: configStyles.SELECT.selectedHoverColor
|
|
292
|
-
: selectedColor
|
|
293
|
-
? selectedColor
|
|
294
|
-
: configStyles.SELECT.selectedColor,
|
|
295
|
-
}}
|
|
296
|
-
>
|
|
297
|
-
{!multiple && newSelected && newSelected[0] && newSelected[0][keyNames.name]
|
|
298
|
-
? newSelected[0][keyNames.name]
|
|
299
|
-
: newSelected && newSelected.length > 0
|
|
300
|
-
? newSelected.map((_, index) => {
|
|
301
|
-
if (newSelected[index][keyNames.name]) {
|
|
302
|
-
if (index > 0) {
|
|
303
|
-
return ', ' + newSelected[index][keyNames.name]
|
|
304
|
-
} else {
|
|
305
|
-
return newSelected[index][keyNames.name]
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
})
|
|
309
|
-
: defaultOption
|
|
310
|
-
? defaultOption
|
|
311
|
-
: ''}
|
|
312
|
-
</div>
|
|
313
|
-
<div className={`${styles['select-content-top-icon']}`}>
|
|
314
|
-
{!disabled && multiple && newSelected.length > 1 && <span>{newSelected.length}</span>}
|
|
315
|
-
|
|
316
|
-
{(showCloseIcon === true || showCloseIcon === false
|
|
317
|
-
? showCloseIcon
|
|
318
|
-
: configStyles.SELECT.showCloseIcon) &&
|
|
319
|
-
!disabled &&
|
|
320
|
-
newSelected &&
|
|
321
|
-
newSelected.length > 0 && (
|
|
322
|
-
<div
|
|
323
|
-
className={`${styles['close-icon']}`}
|
|
324
|
-
onClick={disabled ? (_) => _ : handleClearSelect}
|
|
325
|
-
style={{ marginLeft: multiple && newSelected.length > 1 ? '17px' : '0px' }}
|
|
326
|
-
>
|
|
327
|
-
{closeIcon ? closeIcon : <ReactCloseIcon />}
|
|
328
|
-
</div>
|
|
329
|
-
)}
|
|
330
|
-
|
|
331
|
-
{!disabled ? (
|
|
332
|
-
<div
|
|
333
|
-
style={{
|
|
334
|
-
transform: opened ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
335
|
-
}}
|
|
336
|
-
className={`${styles['arrow-icon']}`}
|
|
337
|
-
>
|
|
338
|
-
{arrowIcon ? arrowIcon : <ReactArrowIcon />}
|
|
339
|
-
</div>
|
|
340
|
-
) : (
|
|
341
|
-
''
|
|
342
|
-
)}
|
|
343
|
-
</div>
|
|
344
|
-
</div>
|
|
345
|
-
{opened && !disabled ? (
|
|
346
|
-
<div
|
|
347
|
-
style={{
|
|
348
|
-
boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
|
|
349
|
-
borderRadius: optionsBorderRadius
|
|
350
|
-
? optionsBorderRadius
|
|
351
|
-
: configStyles.SELECT.optionsBorderRadius,
|
|
352
|
-
backgroundColor: optionsBackgroundColor
|
|
353
|
-
? optionsBackgroundColor
|
|
354
|
-
: configStyles.SELECT.optionsBackgroundColor,
|
|
355
|
-
top: selectedMinHeight
|
|
356
|
-
? selectedMinHeight.includes('rem')
|
|
357
|
-
? parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) +
|
|
358
|
-
0.6 +
|
|
359
|
-
'rem'
|
|
360
|
-
: parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) +
|
|
361
|
-
6 +
|
|
362
|
-
'px'
|
|
363
|
-
: configStyles.SELECT.selectedMinHeight.includes('rem')
|
|
364
|
-
? parseFloat(
|
|
365
|
-
configStyles.SELECT.selectedMinHeight.substr(
|
|
366
|
-
0,
|
|
367
|
-
configStyles.SELECT.selectedMinHeight.length - 3
|
|
368
|
-
)
|
|
369
|
-
) +
|
|
370
|
-
0.6 +
|
|
371
|
-
'rem'
|
|
372
|
-
: parseFloat(
|
|
373
|
-
configStyles.SELECT.selectedMinHeight.substr(
|
|
374
|
-
0,
|
|
375
|
-
configStyles.SELECT.selectedMinHeight.length - 2
|
|
376
|
-
)
|
|
377
|
-
) +
|
|
378
|
-
6 +
|
|
379
|
-
'px',
|
|
380
|
-
}}
|
|
381
|
-
className={`${styles['select-content-bottom']}`}
|
|
382
|
-
>
|
|
383
|
-
<div className={`${styles['select-content-bottom-inner']}`}>
|
|
384
|
-
{existOptions &&
|
|
385
|
-
existOptions.length > 0 &&
|
|
386
|
-
existOptions.map((option, i) => {
|
|
387
|
-
return (
|
|
388
|
-
<div
|
|
389
|
-
key={i}
|
|
390
|
-
disabled={true}
|
|
391
|
-
defaultValue={option[keyNames.id]}
|
|
392
|
-
onClick={disabled ? (_) => _ : () => handleSelectItem(option)}
|
|
393
|
-
onMouseEnter={disabled ? (_) => _ : (e) => handleMouseEnterOption(e)}
|
|
394
|
-
onMouseLeave={disabled ? (_) => _ : (e) => handleMouseLeaveOption(e)}
|
|
395
|
-
className={`${styles['select-content-bottom-row']} ${
|
|
396
|
-
dots || configStyles.SELECT.dots ? styles['ellipsis'] : ''
|
|
397
|
-
}`}
|
|
398
|
-
style={{
|
|
399
|
-
overflowWrap:
|
|
400
|
-
!dots && !configStyles.SELECT.dots ? 'anywhere' : 'break-word',
|
|
401
|
-
color: optionItemColor
|
|
402
|
-
? optionItemColor
|
|
403
|
-
: configStyles.SELECT.optionItemColor,
|
|
404
|
-
cursor: optionItemCursor
|
|
405
|
-
? optionItemCursor
|
|
406
|
-
: configStyles.SELECT.optionItemCursor,
|
|
407
|
-
padding: optionItemPadding
|
|
408
|
-
? optionItemPadding
|
|
409
|
-
: configStyles.SELECT.optionItemPadding,
|
|
410
|
-
fontSize: optionItemFontSize
|
|
411
|
-
? optionItemFontSize
|
|
412
|
-
: configStyles.SELECT.optionItemFontSize,
|
|
413
|
-
boxSizing: optionItemBoxSizing
|
|
414
|
-
? optionItemBoxSizing
|
|
415
|
-
: configStyles.SELECT.optionItemBoxSizing,
|
|
416
|
-
minHeight: optionItemMinHeight
|
|
417
|
-
? optionItemMinHeight
|
|
418
|
-
: configStyles.SELECT.optionItemMinHeight,
|
|
419
|
-
fontWeight: optionItemFontWeight
|
|
420
|
-
? optionItemFontWeight
|
|
421
|
-
: configStyles.SELECT.optionItemFontWeight,
|
|
422
|
-
lineHeight:
|
|
423
|
-
dots || configStyles.SELECT.dots
|
|
424
|
-
? '46px'
|
|
425
|
-
: optionItemLineHeight
|
|
426
|
-
? optionItemLineHeight
|
|
427
|
-
: configStyles.SELECT.optionItemLineHeight,
|
|
428
|
-
marginBottom: optionItemMarginBottom
|
|
429
|
-
? optionItemMarginBottom
|
|
430
|
-
: configStyles.SELECT.optionItemMarginBottom,
|
|
431
|
-
backgroundColor: optionItemBackgroudColor
|
|
432
|
-
? optionItemBackgroudColor
|
|
433
|
-
: configStyles.SELECT.optionItemBackgroudColor,
|
|
434
|
-
}}
|
|
435
|
-
>
|
|
436
|
-
{multiple && multipleCheckbox ? (
|
|
437
|
-
<SingleCheckbox checked={option.checked} />
|
|
438
|
-
) : (
|
|
439
|
-
''
|
|
440
|
-
)}
|
|
441
|
-
{option[keyNames.name]}
|
|
442
|
-
</div>
|
|
443
|
-
)
|
|
444
|
-
})}
|
|
445
|
-
</div>
|
|
446
|
-
</div>
|
|
447
|
-
) : null}
|
|
448
|
-
</div>
|
|
449
|
-
</div>
|
|
450
|
-
|
|
451
|
-
{errorMessage ? (
|
|
452
|
-
<span
|
|
453
|
-
style={{
|
|
454
|
-
position: 'absolute',
|
|
455
|
-
color: errorColor ? errorColor : configStyles.SELECT.errorColor,
|
|
456
|
-
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize,
|
|
457
|
-
zIndex: errorZindex ? errorZindex : configStyles.SELECT.errorZindex,
|
|
458
|
-
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
459
|
-
}}
|
|
460
|
-
>
|
|
461
|
-
{errorMessage}
|
|
462
|
-
</span>
|
|
463
|
-
) : (
|
|
464
|
-
''
|
|
465
|
-
)}
|
|
466
|
-
</div>
|
|
467
|
-
)
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
Select.propTypes = {
|
|
471
|
-
dots: PropTypes.bool,
|
|
472
|
-
options: PropTypes.array,
|
|
473
|
-
multiple: PropTypes.bool,
|
|
474
|
-
onChange: PropTypes.func,
|
|
475
|
-
required: PropTypes.bool,
|
|
476
|
-
disabled: PropTypes.bool,
|
|
477
|
-
selected: PropTypes.array,
|
|
478
|
-
keyNames: PropTypes.object,
|
|
479
|
-
marginTop: PropTypes.string,
|
|
480
|
-
className: PropTypes.string,
|
|
481
|
-
arrowIcon: PropTypes.element,
|
|
482
|
-
closeIcon: PropTypes.element,
|
|
483
|
-
showCloseIcon: PropTypes.bool,
|
|
484
|
-
errorZindex: PropTypes.number,
|
|
485
|
-
errorMessage: PropTypes.string,
|
|
486
|
-
defaultOption: PropTypes.string,
|
|
487
|
-
multipleCheckbox: PropTypes.bool,
|
|
488
|
-
|
|
489
|
-
label: PropTypes.string,
|
|
490
|
-
labelColor: PropTypes.string,
|
|
491
|
-
labelWeight: PropTypes.string,
|
|
492
|
-
labelDisplay: PropTypes.string,
|
|
493
|
-
labelFontSize: PropTypes.string,
|
|
494
|
-
labelLineHeight: PropTypes.string,
|
|
495
|
-
labelFontFamily: PropTypes.string,
|
|
496
|
-
labelMarginBottom: PropTypes.string,
|
|
497
|
-
labelTextTransform: PropTypes.string,
|
|
498
|
-
|
|
499
|
-
cursor: PropTypes.string,
|
|
500
|
-
errorSize: PropTypes.string,
|
|
501
|
-
errorColor: PropTypes.string,
|
|
502
|
-
selectedColor: PropTypes.string,
|
|
503
|
-
selectedRadius: PropTypes.string,
|
|
504
|
-
selectedMinHeight: PropTypes.string,
|
|
505
|
-
selectedPadding: PropTypes.string,
|
|
506
|
-
selectedFontSize: PropTypes.string,
|
|
507
|
-
selectedBoxSizing: PropTypes.string,
|
|
508
|
-
selectedHoverColor: PropTypes.string,
|
|
509
|
-
selectedFontWeight: PropTypes.string,
|
|
510
|
-
selectedLineHeight: PropTypes.string,
|
|
511
|
-
selectedTransition: PropTypes.string,
|
|
512
|
-
selectedBackgroundColor: PropTypes.string,
|
|
513
|
-
selectedDisableBackgroundColor: PropTypes.string,
|
|
514
|
-
|
|
515
|
-
optionsBoxShadow: PropTypes.string,
|
|
516
|
-
optionsBorderRadius: PropTypes.string,
|
|
517
|
-
optionsBackgroundColor: PropTypes.string,
|
|
518
|
-
|
|
519
|
-
optionItemColor: PropTypes.string,
|
|
520
|
-
optionItemCursor: PropTypes.string,
|
|
521
|
-
optionItemPadding: PropTypes.string,
|
|
522
|
-
optionItemFontSize: PropTypes.string,
|
|
523
|
-
optionItemMinHeight: PropTypes.string,
|
|
524
|
-
optionItemBoxSizing: PropTypes.string,
|
|
525
|
-
optionItemFontWeight: PropTypes.string,
|
|
526
|
-
optionItemColorHover: PropTypes.string,
|
|
527
|
-
optionItemLineHeight: PropTypes.string,
|
|
528
|
-
optionItemMarginBottom: PropTypes.string,
|
|
529
|
-
optionItemBackgroudColor: PropTypes.string,
|
|
530
|
-
optionItemBackgroudColorHover: PropTypes.string,
|
|
531
|
-
|
|
532
|
-
boxShadow: PropTypes.string,
|
|
533
|
-
boxShadowHover: PropTypes.string,
|
|
534
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
.select-content {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
position: relative;
|
|
5
|
-
-webkit-appearance: none;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.select-content-top {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: row;
|
|
11
|
-
flex-wrap: nowrap;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: space-between;
|
|
14
|
-
-webkit-appearance: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.select-content-bottom {
|
|
18
|
-
position: absolute;
|
|
19
|
-
width: 100%;
|
|
20
|
-
left: 0px;
|
|
21
|
-
z-index: 99999999999;
|
|
22
|
-
max-height: 0;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
animation: select-show 640ms linear forwards;
|
|
25
|
-
-webkit-animation: select-show 640ms linear forwards;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.select-content-bottom-inner {
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
overflow-y: auto;
|
|
32
|
-
overflow-x: hidden;
|
|
33
|
-
max-height: 234px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.select-content-top-icon {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex: 0 0 auto;
|
|
39
|
-
align-items: center;
|
|
40
|
-
padding: 0 5px 0 20px;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.select-content-top-icon>div {
|
|
45
|
-
display: flex;
|
|
46
|
-
width: 14px;
|
|
47
|
-
height: 14px;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.close-icon {
|
|
53
|
-
padding-right: 9px;
|
|
54
|
-
border-right: 1px solid #EEEEEE;
|
|
55
|
-
box-sizing: content-box;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.arrow-icon {
|
|
59
|
-
margin-left: 9px;
|
|
60
|
-
transform-origin: center;
|
|
61
|
-
transition: all 640ms ease;
|
|
62
|
-
-webkit-transition: all 640ms ease;
|
|
63
|
-
-moz-transition: all 640ms ease;
|
|
64
|
-
-ms-transition: all 640ms ease;
|
|
65
|
-
-o-transition: all 640ms ease;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.select-content-bottom-row {
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
transition: background-color 240ms, color 240ms;
|
|
72
|
-
-webkit-transition: background-color 240ms, color 240ms;
|
|
73
|
-
-moz-transition: background-color 240ms, color 240ms;
|
|
74
|
-
-ms-transition: background-color 240ms, color 240ms;
|
|
75
|
-
-o-transition: background-color 240ms, color 240ms;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.select-content-bottom-row:last-child {
|
|
79
|
-
margin-bottom: 0px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.ellipsis {
|
|
83
|
-
display: inline-block;
|
|
84
|
-
white-space: nowrap;
|
|
85
|
-
overflow: hidden;
|
|
86
|
-
text-overflow: ellipsis;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@keyframes select-show {
|
|
90
|
-
100% {
|
|
91
|
-
max-height: 234px;
|
|
92
|
-
}
|
|
93
|
-
}
|