@xaypay/tui 0.0.105 → 0.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +30 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +42 -45
- package/.storybook/preview.js +7 -7
- package/cli-command.js +1 -1
- package/dist/index.es.js +105 -94
- package/dist/index.js +105 -94
- package/package.json +16 -4
- package/rollup.config.js +11 -11
- package/src/assets_old/icons/demo-files/demo.js +16 -18
- package/src/components/autocomplate/autocomplate.stories.js +30 -28
- package/src/components/autocomplate/index.js +145 -127
- package/src/components/button/button.stories.js +6 -6
- package/src/components/button/index.js +176 -126
- package/src/components/captcha/captcha.stories.js +12 -8
- package/src/components/captcha/index.js +47 -50
- package/src/components/checkbox/checkbox.stories.js +7 -7
- package/src/components/checkbox/index.js +77 -93
- package/src/components/file/file.stories.js +15 -15
- package/src/components/file/index.js +114 -116
- package/src/components/icon/Arrow.js +18 -18
- package/src/components/icon/CaptchaArrowDown.js +18 -18
- package/src/components/icon/CaptchaArrowUp.js +18 -18
- package/src/components/icon/CheckboxChecked.js +20 -20
- package/src/components/icon/CheckboxUnchecked.js +20 -20
- package/src/components/icon/Close.js +18 -18
- package/src/components/icon/CloseIcon.js +18 -18
- package/src/components/icon/CloseSlide.js +18 -18
- package/src/components/icon/DeleteComponent.js +19 -19
- package/src/components/icon/Dots.js +18 -18
- package/src/components/icon/HeartFilled.js +22 -23
- package/src/components/icon/HeartOutline.js +22 -22
- package/src/components/icon/Icon.js +3 -5
- package/src/components/icon/ListItemDelete.js +18 -18
- package/src/components/icon/ListItemJpeg.js +20 -20
- package/src/components/icon/ListItemJpg.js +20 -20
- package/src/components/icon/ListItemPdf.js +20 -20
- package/src/components/icon/ListItemPng.js +20 -20
- package/src/components/icon/Next.js +19 -19
- package/src/components/icon/Nextarrow.js +18 -18
- package/src/components/icon/PDF.js +18 -18
- package/src/components/icon/Prev.js +19 -19
- package/src/components/icon/RangeArrowDefault.js +41 -52
- package/src/components/icon/RangeArrowError.js +41 -52
- package/src/components/icon/RangeArrowSuccess.js +41 -52
- package/src/components/icon/RemoveFile.js +19 -19
- package/src/components/icon/ToasterClose.js +18 -18
- package/src/components/icon/ToasterError.js +18 -18
- package/src/components/icon/ToasterInfo.js +18 -18
- package/src/components/icon/ToasterSuccess.js +18 -18
- package/src/components/icon/ToasterWarning.js +18 -18
- package/src/components/icon/Tooltip.js +18 -18
- package/src/components/icon/Upload.js +24 -24
- package/src/components/input/index.js +267 -224
- package/src/components/input/input.stories.js +20 -21
- package/src/components/modal/index.js +172 -159
- package/src/components/modal/modal.stories.js +79 -78
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
- package/src/components/newAutocomplete/index.js +342 -216
- package/src/components/newFile/fileItem.js +214 -191
- package/src/components/newFile/index.js +235 -173
- package/src/components/newFile/newFile.stories.js +32 -35
- package/src/components/pagination/index.js +97 -122
- package/src/components/pagination/pagination.stories.js +362 -362
- package/src/components/pagination/paginationRange.js +42 -53
- package/src/components/radio/index.js +49 -62
- package/src/components/radio/radio.stories.js +7 -7
- package/src/components/select/index.js +318 -223
- package/src/components/select/select.stories.js +25 -14
- package/src/components/singleCheckbox/Checkbox.js +31 -34
- package/src/components/singleCheckbox/index.js +36 -45
- package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
- package/src/components/stepper/index.js +35 -30
- package/src/components/stepper/stepper.stories.js +11 -11
- package/src/components/table/index.js +280 -148
- package/src/components/table/table.stories.js +105 -217
- package/src/components/table/td.js +80 -72
- package/src/components/table/th.js +19 -16
- package/src/components/textarea/index.js +86 -62
- package/src/components/textarea/textarea.stories.js +10 -13
- package/src/components/toaster/Toast.js +180 -158
- package/src/components/toaster/index.js +108 -111
- package/src/components/toaster/toaster.module.css +13 -0
- package/src/components/toaster/toaster.stories.js +582 -367
- package/src/components/tooltip/index.js +79 -46
- package/src/components/tooltip/tooltip.stories.js +9 -10
- package/src/components/typography/index.js +108 -101
- package/src/components/typography/typography.stories.js +16 -19
- package/src/index.js +20 -20
- package/src/stories/configuration.stories.mdx +1 -0
- package/src/utils/index.js +11 -11
- package/tui.config.js +343 -340
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaypay/tui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.107",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"storybook": "STORYBOOK_PATH=../../tui.config.js start-storybook -p 6006",
|
|
10
10
|
"build-storybook": "STORYBOOK_PATH=../../tui.config.js build-storybook",
|
|
11
11
|
"build-lib": "STORYBOOK_PATH=../tui.config.js STORYBOOK_CONFIG_PATH=../../../../tui.config.js rollup --config rollup.config.js",
|
|
12
|
-
"svgr": "svgr --icon --title-prop -d src/components/icon -- src/assets/icons"
|
|
12
|
+
"svgr": "svgr --icon --title-prop -d src/components/icon -- src/assets/icons",
|
|
13
|
+
"prepare": "husky install"
|
|
13
14
|
},
|
|
14
15
|
"author": "",
|
|
15
16
|
"license": "MIT",
|
|
@@ -46,7 +47,12 @@
|
|
|
46
47
|
"sass": "^1.54.9",
|
|
47
48
|
"sass-loader": "^13.0.2",
|
|
48
49
|
"style-loader": "^3.3.1",
|
|
49
|
-
"styled-components": "^5.3.5"
|
|
50
|
+
"styled-components": "^5.3.5",
|
|
51
|
+
"husky": "^8.0.0",
|
|
52
|
+
"lint-staged": "^13.1.0",
|
|
53
|
+
"eslint": "^8.32.0",
|
|
54
|
+
"eslint-plugin-react": "^7.32.1",
|
|
55
|
+
"prettier": "^2.8.3"
|
|
50
56
|
},
|
|
51
57
|
"peerDependencies": {
|
|
52
58
|
"classnames": "^2.3.1",
|
|
@@ -62,5 +68,11 @@
|
|
|
62
68
|
"react-icons": "^4.7.1",
|
|
63
69
|
"uuid": "^9.0.0"
|
|
64
70
|
},
|
|
65
|
-
"bin": "./cli-command.js"
|
|
71
|
+
"bin": "./cli-command.js",
|
|
72
|
+
"lint-staged": {
|
|
73
|
+
"src/**/*.{js, jsx}": [
|
|
74
|
+
"prettier --write",
|
|
75
|
+
"eslint --max-warnings=0"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
66
78
|
}
|
package/rollup.config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// import {babel} from '@rollup/plugin-babel';
|
|
2
|
-
import svg from 'rollup-plugin-svg'
|
|
3
|
-
import babel from 'rollup-plugin-babel'
|
|
4
|
-
import resolve from '@rollup/plugin-node-resolve'
|
|
5
|
-
import external from 'rollup-plugin-peer-deps-external'
|
|
6
|
-
import postcss from 'rollup-plugin-postcss'
|
|
2
|
+
import svg from 'rollup-plugin-svg'
|
|
3
|
+
import babel from 'rollup-plugin-babel'
|
|
4
|
+
import resolve from '@rollup/plugin-node-resolve'
|
|
5
|
+
import external from 'rollup-plugin-peer-deps-external'
|
|
6
|
+
import postcss from 'rollup-plugin-postcss'
|
|
7
7
|
|
|
8
8
|
export default [
|
|
9
9
|
{
|
|
@@ -17,9 +17,9 @@ export default [
|
|
|
17
17
|
file: 'dist/index.es.js',
|
|
18
18
|
format: 'es',
|
|
19
19
|
exports: 'named',
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
21
|
],
|
|
22
|
-
external: ['prop-types','classnames'],
|
|
22
|
+
external: ['prop-types', 'classnames'],
|
|
23
23
|
plugins: [
|
|
24
24
|
postcss({
|
|
25
25
|
plugins: [],
|
|
@@ -31,7 +31,7 @@ export default [
|
|
|
31
31
|
}),
|
|
32
32
|
svg(),
|
|
33
33
|
external(),
|
|
34
|
-
resolve()
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
]
|
|
34
|
+
resolve(),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
]
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
if (!('boxShadow' in document.body.style)) {
|
|
2
|
-
document.body.setAttribute('class', 'noBoxShadow')
|
|
2
|
+
document.body.setAttribute('class', 'noBoxShadow')
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
document.body.addEventListener(
|
|
6
|
-
var target = e.target
|
|
7
|
-
if (target.tagName ===
|
|
8
|
-
target.
|
|
9
|
-
target.select();
|
|
5
|
+
document.body.addEventListener('click', function (e) {
|
|
6
|
+
var target = e.target
|
|
7
|
+
if (target.tagName === 'INPUT' && target.getAttribute('class').indexOf('liga') === -1) {
|
|
8
|
+
target.select()
|
|
10
9
|
}
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
(function() {
|
|
10
|
+
})
|
|
11
|
+
;(function () {
|
|
14
12
|
var fontSize = document.getElementById('fontSize'),
|
|
15
13
|
testDrive = document.getElementById('testDrive'),
|
|
16
|
-
testText = document.getElementById('testText')
|
|
14
|
+
testText = document.getElementById('testText')
|
|
17
15
|
function updateTest() {
|
|
18
|
-
testDrive.innerHTML = testText.value || String.fromCharCode(160)
|
|
16
|
+
testDrive.innerHTML = testText.value || String.fromCharCode(160)
|
|
19
17
|
if (window.icomoonLiga) {
|
|
20
|
-
window.icomoonLiga(testDrive)
|
|
18
|
+
window.icomoonLiga(testDrive)
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
function updateSize() {
|
|
24
|
-
testDrive.style.fontSize = fontSize.value + 'px'
|
|
22
|
+
testDrive.style.fontSize = fontSize.value + 'px'
|
|
25
23
|
}
|
|
26
|
-
fontSize.addEventListener('change', updateSize, false)
|
|
27
|
-
testText.addEventListener('input', updateTest, false)
|
|
28
|
-
testText.addEventListener('change', updateTest, false)
|
|
29
|
-
updateSize()
|
|
30
|
-
}()
|
|
24
|
+
fontSize.addEventListener('change', updateSize, false)
|
|
25
|
+
testText.addEventListener('input', updateTest, false)
|
|
26
|
+
testText.addEventListener('change', updateTest, false)
|
|
27
|
+
updateSize()
|
|
28
|
+
})()
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Autocomplate } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Autocomplate } from './index'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
5
|
+
component: Autocomplate,
|
|
6
|
+
title: 'Components/Autocomplate',
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
const Template = (args) => <Autocomplate {...args}
|
|
9
|
+
const Template = (args) => <Autocomplate {...args} />
|
|
10
10
|
|
|
11
|
-
export const Default = Template.bind({})
|
|
11
|
+
export const Default = Template.bind({})
|
|
12
12
|
Default.args = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
13
|
+
jsonOptionsData: '[{"bbb":"0", "value":"asd"}, {"bbb":"2", "value":"bas"}]',
|
|
14
|
+
jsonSelectedOptionsData: '{"bbb":"0", "value":"gasdfgdsfgdsg"}',
|
|
15
|
+
label: 'label',
|
|
16
|
+
keyNames: { name: 'value', id: 'bbb' },
|
|
17
|
+
searchCount: 2,
|
|
18
|
+
onChange: (aa) => {
|
|
19
|
+
console.log(aa)
|
|
20
|
+
fetch(`http://dev2.govazd-api.yerevan.am/api/v1/companies/autocomplete?slug=${aa.name ? aa.name : 'a'}`, {
|
|
21
|
+
method: 'GET',
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
Authorization:
|
|
25
|
+
'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjYyYTU0MzhmYjY3ODZmYzgzY2NkZmVkMGNlYzExZDZjY2IxNmRhNWJhYTVlOTMwMWVjNDU2MWRmYzIyMDcyYTc0ZjEyY2IxZGEzOTJlMjE5IiwiaWF0IjoxNjg2MDM0NTA0LjU5OTMzOSwibmJmIjoxNjg2MDM0NTA0LjU5OTM2NywiZXhwIjoxNjg2MDU5NzA0LjU4NDkxMiwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.DzzdZFLHiFTyUIlKIK25IMSxnjI0cQ5EaUT3vdMoZT3XjclPA1uohP4hiRr30Duy6psyOcPuQuZ2t8KuGUy5n500Di-Wbw0tZDVW-ctyOQNQRPjcTL41lN7xrTaRzxrkSa3KHlZT0_w4KjHTp32wo6XHWjLwrbZIFlBBbJv-bMBqj0KIcsLWHBMfHb2lU8UK6_xMgSbsV_E3FzrhbgmBeFifBTn9BVkduz450jWKmib5zKFRv4lqpFrMJo7gOQRj0-uQliCCdtnvOBW3QqBeT0Zl-RFH-Vc22GAxSYWF7PZ1M-tOZ2PlR7pyfJabp6nEtsRii5PhoejUBAynYmZBKxY-TvKGjfpOXcULm2w0zIqrV2KRf4acj189Kok_nE5rpReqc0xk6hxDdhyBPdBDtgm58c25G_fkkSpMJvDyZg0fqpCB7wkYfGpqeYH-eW4KYuZeReU1OyIKCTxBJhDfcFqZRb4x7TUIxNoFXknLhhU4mB7t75ZZxpUwtJRXqF_Ps8eiBWcfmt5uZfVQqzFXcBlx6lmDwBn7RIF0jy5oKvs6ss5mBjv0SdKSJrpRMa9GIVT9lUJDqKA15JZIGXdugjBXwlrzFfekePXA_7AAFrxgS0Dn7EZJCh7EmBdGG3slPLRtnkcVru2AOLHZ-aRPtVluzxgip9RU23VMVXvoX-I',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
.then((res) => {
|
|
29
|
+
return res.json()
|
|
30
|
+
})
|
|
31
|
+
.then((data) => {
|
|
32
|
+
console.log(data)
|
|
33
|
+
})
|
|
34
|
+
},
|
|
35
|
+
}
|
|
@@ -1,140 +1,158 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import styles from "./autocomplate.module.css";
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import { compereConfigs } from './../../utils'
|
|
4
|
+
import styles from './autocomplate.module.css'
|
|
6
5
|
|
|
7
6
|
export const Autocomplate = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
jsonSelectedOptionsData,
|
|
21
|
-
...props
|
|
7
|
+
label,
|
|
8
|
+
required,
|
|
9
|
+
disabled,
|
|
10
|
+
keyNames,
|
|
11
|
+
onChange,
|
|
12
|
+
searchCount,
|
|
13
|
+
placeHolder,
|
|
14
|
+
errorMessage,
|
|
15
|
+
autoComplete,
|
|
16
|
+
jsonOptionsData,
|
|
17
|
+
jsonSelectedOptionsData,
|
|
18
|
+
...props
|
|
22
19
|
}) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
jsonOptionsData ? JSON.parse(jsonOptionsData) : [];
|
|
20
|
+
const configStyles = compereConfigs()
|
|
21
|
+
const parseSelectedOptionsData = jsonSelectedOptionsData
|
|
22
|
+
? JSON.parse(jsonSelectedOptionsData)
|
|
23
|
+
: { name: '', id: '' }
|
|
24
|
+
const [inputValue, setInputValue] = useState(parseSelectedOptionsData[keyNames.name])
|
|
25
|
+
const [inputId, setInputId] = useState(parseSelectedOptionsData[keyNames.id])
|
|
26
|
+
const [activeOption, setActiveOption] = useState(0)
|
|
27
|
+
const [showOptions, setShowOptions] = useState(false)
|
|
28
|
+
const parseOptionsData = jsonOptionsData ? JSON.parse(jsonOptionsData) : []
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
onChange({ name: e.target.innerText, id: e.target.id });
|
|
30
|
+
const handleChange = (e) => {
|
|
31
|
+
const currentInputValue = e.currentTarget.value
|
|
32
|
+
setInputId(null)
|
|
33
|
+
setInputValue(currentInputValue)
|
|
34
|
+
setInputId('')
|
|
35
|
+
setActiveOption(0)
|
|
36
|
+
setShowOptions(true)
|
|
37
|
+
onChange({ name: currentInputValue, id: e.target.id })
|
|
38
|
+
}
|
|
39
|
+
const handleClick = (e) => {
|
|
40
|
+
setActiveOption(0)
|
|
41
|
+
setShowOptions(false)
|
|
42
|
+
setInputValue(e.target.innerText)
|
|
43
|
+
setInputId(e.target.id)
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
onChange({ name: e.target.innerText, id: e.target.id })
|
|
46
|
+
}
|
|
47
|
+
let optionList
|
|
48
|
+
if (showOptions && inputValue) {
|
|
49
|
+
if (parseOptionsData.length && inputValue.length >= searchCount) {
|
|
50
|
+
optionList = (
|
|
51
|
+
<div className={`${styles['autocomplate-content-bottom']} autocomplate-content-bottom-rem`}>
|
|
52
|
+
<div
|
|
53
|
+
className={`${styles['autocomplate-content-bottom-inner']} autocomplate-content-bottom-inner-rem`}
|
|
54
|
+
>
|
|
55
|
+
{parseOptionsData.map((optionName, index) => {
|
|
56
|
+
let className
|
|
57
|
+
if (index === activeOption) {
|
|
58
|
+
className = 'option-active'
|
|
59
|
+
}
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className={`${styles[className]} autocomplate-content-click-rem`}
|
|
63
|
+
key={optionName[keyNames.id]}
|
|
64
|
+
onClick={handleClick}
|
|
65
|
+
>
|
|
66
|
+
<div
|
|
67
|
+
id={optionName[keyNames.id]}
|
|
68
|
+
className={`${styles['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`}
|
|
69
|
+
>
|
|
70
|
+
{optionName[keyNames.name]}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
})}
|
|
75
|
+
</div>
|
|
70
76
|
</div>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
)
|
|
78
|
+
} else {
|
|
79
|
+
optionList = (
|
|
80
|
+
<div className={`${styles['autocomplate-content-bottom']} autocomplate-content-bottom-rem`}>
|
|
81
|
+
<div
|
|
82
|
+
className={`${styles['autocomplate-content-bottom-inner']} autocomplate-content-bottom-inner-rem`}
|
|
83
|
+
>
|
|
84
|
+
<div
|
|
85
|
+
className={`${styles['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`}
|
|
86
|
+
>
|
|
87
|
+
<div className={`${styles['no-option']} autocomplate-no-option`}>
|
|
88
|
+
{inputValue.length < searchCount
|
|
89
|
+
? `Լրացնել առնվազն ${searchCount} նիշ`
|
|
90
|
+
: 'Նման տվյալ առկա չէ'}
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
88
97
|
}
|
|
89
|
-
}
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name])
|
|
101
|
+
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id])
|
|
102
|
+
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]])
|
|
95
103
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
104
|
+
return (
|
|
105
|
+
<>
|
|
106
|
+
{label ? (
|
|
107
|
+
<label className={`${styles['autocomplate-title']} autocomplate-title-rem`}>
|
|
108
|
+
{label} {required && <sup style={{ color: '#ee0000' }}>*</sup>}
|
|
109
|
+
</label>
|
|
110
|
+
) : (
|
|
111
|
+
''
|
|
112
|
+
)}
|
|
113
|
+
<div className={`${styles['autocomplate-content']} autocomplate-content-rem`}>
|
|
114
|
+
<input
|
|
115
|
+
id={inputId}
|
|
116
|
+
type="text"
|
|
117
|
+
autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
|
|
118
|
+
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${
|
|
119
|
+
errorMessage ? styles.errorBorder : ''
|
|
120
|
+
}`}
|
|
121
|
+
disabled={disabled}
|
|
122
|
+
onChange={handleChange}
|
|
123
|
+
onClick={() => {
|
|
124
|
+
setShowOptions(!showOptions)
|
|
125
|
+
}}
|
|
126
|
+
value={inputValue}
|
|
127
|
+
placeholder={placeHolder}
|
|
128
|
+
style={{
|
|
129
|
+
cursor: disabled ? 'not-allowed' : 'auto',
|
|
130
|
+
}}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
{errorMessage ? <span className={styles.errorMessage}>{errorMessage}</span> : null}
|
|
134
|
+
{optionList}
|
|
135
|
+
</div>
|
|
136
|
+
</>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
121
139
|
|
|
122
140
|
Autocomplate.propTypes = {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
141
|
+
label: PropTypes.string,
|
|
142
|
+
disabled: PropTypes.bool,
|
|
143
|
+
required: PropTypes.bool,
|
|
144
|
+
onChange: PropTypes.func,
|
|
145
|
+
value: PropTypes.string,
|
|
146
|
+
keyNames: PropTypes.object,
|
|
147
|
+
className: PropTypes.string,
|
|
148
|
+
searchCount: PropTypes.number,
|
|
149
|
+
errorMessage: PropTypes.string,
|
|
150
|
+
placeHolder: PropTypes.string,
|
|
151
|
+
autoComplete: PropTypes.string,
|
|
152
|
+
jsonOptionsData: PropTypes.string,
|
|
153
|
+
jsonSelectedOptionsData: PropTypes.string,
|
|
154
|
+
}
|
|
137
155
|
|
|
138
156
|
Autocomplate.defaultProps = {
|
|
139
|
-
|
|
140
|
-
}
|
|
157
|
+
required: false,
|
|
158
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Button } from './index'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button } from './index'
|
|
3
3
|
|
|
4
|
-
import { ReactComponent as ReactSVG } from './../../assets/range-arrow-default.svg'
|
|
4
|
+
import { ReactComponent as ReactSVG } from './../../assets/range-arrow-default.svg'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: Button,
|
|
8
8
|
title: 'Components/Button',
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
const Template = (args) => <Button label=
|
|
11
|
+
const Template = (args) => <Button label="Button" icon={<ReactSVG />} {...args} />
|
|
12
12
|
|
|
13
|
-
export const Default = Template.bind({})
|
|
13
|
+
export const Default = Template.bind({})
|