@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.
Files changed (93) hide show
  1. package/.eslintrc.js +30 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.prettierrc +10 -0
  4. package/.storybook/main.js +42 -45
  5. package/.storybook/preview.js +7 -7
  6. package/cli-command.js +1 -1
  7. package/dist/index.es.js +105 -94
  8. package/dist/index.js +105 -94
  9. package/package.json +16 -4
  10. package/rollup.config.js +11 -11
  11. package/src/assets_old/icons/demo-files/demo.js +16 -18
  12. package/src/components/autocomplate/autocomplate.stories.js +30 -28
  13. package/src/components/autocomplate/index.js +145 -127
  14. package/src/components/button/button.stories.js +6 -6
  15. package/src/components/button/index.js +176 -126
  16. package/src/components/captcha/captcha.stories.js +12 -8
  17. package/src/components/captcha/index.js +47 -50
  18. package/src/components/checkbox/checkbox.stories.js +7 -7
  19. package/src/components/checkbox/index.js +77 -93
  20. package/src/components/file/file.stories.js +15 -15
  21. package/src/components/file/index.js +114 -116
  22. package/src/components/icon/Arrow.js +18 -18
  23. package/src/components/icon/CaptchaArrowDown.js +18 -18
  24. package/src/components/icon/CaptchaArrowUp.js +18 -18
  25. package/src/components/icon/CheckboxChecked.js +20 -20
  26. package/src/components/icon/CheckboxUnchecked.js +20 -20
  27. package/src/components/icon/Close.js +18 -18
  28. package/src/components/icon/CloseIcon.js +18 -18
  29. package/src/components/icon/CloseSlide.js +18 -18
  30. package/src/components/icon/DeleteComponent.js +19 -19
  31. package/src/components/icon/Dots.js +18 -18
  32. package/src/components/icon/HeartFilled.js +22 -23
  33. package/src/components/icon/HeartOutline.js +22 -22
  34. package/src/components/icon/Icon.js +3 -5
  35. package/src/components/icon/ListItemDelete.js +18 -18
  36. package/src/components/icon/ListItemJpeg.js +20 -20
  37. package/src/components/icon/ListItemJpg.js +20 -20
  38. package/src/components/icon/ListItemPdf.js +20 -20
  39. package/src/components/icon/ListItemPng.js +20 -20
  40. package/src/components/icon/Next.js +19 -19
  41. package/src/components/icon/Nextarrow.js +18 -18
  42. package/src/components/icon/PDF.js +18 -18
  43. package/src/components/icon/Prev.js +19 -19
  44. package/src/components/icon/RangeArrowDefault.js +41 -52
  45. package/src/components/icon/RangeArrowError.js +41 -52
  46. package/src/components/icon/RangeArrowSuccess.js +41 -52
  47. package/src/components/icon/RemoveFile.js +19 -19
  48. package/src/components/icon/ToasterClose.js +18 -18
  49. package/src/components/icon/ToasterError.js +18 -18
  50. package/src/components/icon/ToasterInfo.js +18 -18
  51. package/src/components/icon/ToasterSuccess.js +18 -18
  52. package/src/components/icon/ToasterWarning.js +18 -18
  53. package/src/components/icon/Tooltip.js +18 -18
  54. package/src/components/icon/Upload.js +24 -24
  55. package/src/components/input/index.js +267 -224
  56. package/src/components/input/input.stories.js +20 -21
  57. package/src/components/modal/index.js +172 -159
  58. package/src/components/modal/modal.stories.js +79 -78
  59. package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
  60. package/src/components/newAutocomplete/index.js +342 -216
  61. package/src/components/newFile/fileItem.js +214 -191
  62. package/src/components/newFile/index.js +235 -173
  63. package/src/components/newFile/newFile.stories.js +32 -35
  64. package/src/components/pagination/index.js +97 -122
  65. package/src/components/pagination/pagination.stories.js +362 -362
  66. package/src/components/pagination/paginationRange.js +42 -53
  67. package/src/components/radio/index.js +49 -62
  68. package/src/components/radio/radio.stories.js +7 -7
  69. package/src/components/select/index.js +318 -223
  70. package/src/components/select/select.stories.js +25 -14
  71. package/src/components/singleCheckbox/Checkbox.js +31 -34
  72. package/src/components/singleCheckbox/index.js +36 -45
  73. package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
  74. package/src/components/stepper/index.js +35 -30
  75. package/src/components/stepper/stepper.stories.js +11 -11
  76. package/src/components/table/index.js +280 -148
  77. package/src/components/table/table.stories.js +105 -217
  78. package/src/components/table/td.js +80 -72
  79. package/src/components/table/th.js +19 -16
  80. package/src/components/textarea/index.js +86 -62
  81. package/src/components/textarea/textarea.stories.js +10 -13
  82. package/src/components/toaster/Toast.js +180 -158
  83. package/src/components/toaster/index.js +108 -111
  84. package/src/components/toaster/toaster.module.css +13 -0
  85. package/src/components/toaster/toaster.stories.js +582 -367
  86. package/src/components/tooltip/index.js +79 -46
  87. package/src/components/tooltip/tooltip.stories.js +9 -10
  88. package/src/components/typography/index.js +108 -101
  89. package/src/components/typography/typography.stories.js +16 -19
  90. package/src/index.js +20 -20
  91. package/src/stories/configuration.stories.mdx +1 -0
  92. package/src/utils/index.js +11 -11
  93. 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.105",
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("click", function(e) {
6
- var target = e.target;
7
- if (target.tagName === "INPUT" &&
8
- target.getAttribute('class').indexOf('liga') === -1) {
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 "react";
2
- import { Autocomplate } from "./index";
1
+ import React from 'react'
2
+ import { Autocomplate } from './index'
3
3
 
4
4
  export default {
5
- component: Autocomplate,
6
- title: "Components/Autocomplate",
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
- 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': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjYyYTU0MzhmYjY3ODZmYzgzY2NkZmVkMGNlYzExZDZjY2IxNmRhNWJhYTVlOTMwMWVjNDU2MWRmYzIyMDcyYTc0ZjEyY2IxZGEzOTJlMjE5IiwiaWF0IjoxNjg2MDM0NTA0LjU5OTMzOSwibmJmIjoxNjg2MDM0NTA0LjU5OTM2NywiZXhwIjoxNjg2MDU5NzA0LjU4NDkxMiwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.DzzdZFLHiFTyUIlKIK25IMSxnjI0cQ5EaUT3vdMoZT3XjclPA1uohP4hiRr30Duy6psyOcPuQuZ2t8KuGUy5n500Di-Wbw0tZDVW-ctyOQNQRPjcTL41lN7xrTaRzxrkSa3KHlZT0_w4KjHTp32wo6XHWjLwrbZIFlBBbJv-bMBqj0KIcsLWHBMfHb2lU8UK6_xMgSbsV_E3FzrhbgmBeFifBTn9BVkduz450jWKmib5zKFRv4lqpFrMJo7gOQRj0-uQliCCdtnvOBW3QqBeT0Zl-RFH-Vc22GAxSYWF7PZ1M-tOZ2PlR7pyfJabp6nEtsRii5PhoejUBAynYmZBKxY-TvKGjfpOXcULm2w0zIqrV2KRf4acj189Kok_nE5rpReqc0xk6hxDdhyBPdBDtgm58c25G_fkkSpMJvDyZg0fqpCB7wkYfGpqeYH-eW4KYuZeReU1OyIKCTxBJhDfcFqZRb4x7TUIxNoFXknLhhU4mB7t75ZZxpUwtJRXqF_Ps8eiBWcfmt5uZfVQqzFXcBlx6lmDwBn7RIF0jy5oKvs6ss5mBjv0SdKSJrpRMa9GIVT9lUJDqKA15JZIGXdugjBXwlrzFfekePXA_7AAFrxgS0Dn7EZJCh7EmBdGG3slPLRtnkcVru2AOLHZ-aRPtVluzxgip9RU23VMVXvoX-I',
25
- },
26
- }).then((res)=> {
27
- return res.json()
28
- }).then((data)=> {
29
- console.log(data)
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 "react";
2
- import PropTypes from "prop-types";
3
- import classnames from "classnames";
4
- import { compereConfigs } from "./../../utils";
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
- label,
9
- value,
10
- required,
11
- disabled,
12
- keyNames,
13
- onChange,
14
- className,
15
- searchCount,
16
- placeHolder,
17
- errorMessage,
18
- autoComplete,
19
- jsonOptionsData,
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
- const configStyles = compereConfigs();
24
- const classProps = classnames(styles.searchBox, className);
25
- const parseSelectedOptionsData =
26
- jsonSelectedOptionsData ? JSON.parse(jsonSelectedOptionsData) : { name: '', id: '' };
27
- const [inputValue, setInputValue] = useState(parseSelectedOptionsData[keyNames.name]);
28
- const [inputId, setInputId] = useState(parseSelectedOptionsData[keyNames.id]);
29
- const [activeOption, setActiveOption] = useState(0);
30
- const [showOptions, setShowOptions] = useState(false);
31
- const parseOptionsData =
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
- const handleChange = (e) => {
35
- const currentInputValue = e.currentTarget.value;
36
- setInputId(null)
37
- setInputValue(currentInputValue);
38
- setInputId('')
39
- setActiveOption(0);
40
- setShowOptions(true);
41
- onChange({ name: currentInputValue, id: e.target.id });
42
- };
43
- const handleClick = (e) => {
44
- setActiveOption(0);
45
- setShowOptions(false);
46
- setInputValue(e.target.innerText);
47
- setInputId(e.target.id)
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
- let optionList;
53
- if (showOptions && inputValue) {
54
- if (parseOptionsData.length && inputValue.length >= searchCount) {
55
- optionList = (
56
- <div className={`${styles['autocomplate-content-bottom']} autocomplate-content-bottom-rem`}>
57
- <div className={`${styles['autocomplate-content-bottom-inner']} autocomplate-content-bottom-inner-rem`}>
58
- {parseOptionsData.map((optionName, index) => {
59
- let className;
60
- if (index === activeOption) {
61
- className = "option-active";
62
- }
63
- return (
64
- <div
65
- className={`${styles[className]} autocomplate-content-click-rem`}
66
- key={optionName[keyNames.id]}
67
- onClick={handleClick}
68
- >
69
- <div id={optionName[keyNames.id]} className={`${styles['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`}>{optionName[keyNames.name]}</div>
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
- </div>
74
- </div>
75
-
76
-
77
- );
78
- } else {
79
- optionList = (
80
- <div className={`${styles['autocomplate-content-bottom']} autocomplate-content-bottom-rem`}>
81
- <div className={`${styles['autocomplate-content-bottom-inner']} autocomplate-content-bottom-inner-rem`}>
82
- <div className={`${styles['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`}>
83
- <div className={`${styles['no-option']} autocomplate-no-option`}>{inputValue.length < searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'}</div>
84
- </div>
85
- </div>
86
- </div>
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
- useEffect(() => {
92
- setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name])
93
- setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id])
94
- }, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]])
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
- return (
97
- <>
98
- {label ? <label className={`${styles['autocomplate-title']} autocomplate-title-rem`}>{label} {required && <sup style={{color: "#ee0000"}}>*</sup>}</label> : ""}
99
- <div className={`${styles['autocomplate-content']} autocomplate-content-rem`}>
100
- <input
101
- id={inputId}
102
- type="text"
103
- autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
104
- className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMessage ? styles.errorBorder : ''}`}
105
- disabled={disabled}
106
- onChange={handleChange}
107
- onClick={() => { setShowOptions(!showOptions) }}
108
- value={inputValue}
109
- placeholder={placeHolder}
110
- style={{
111
- cursor: disabled ? 'not-allowed' : 'auto'
112
- }}
113
- {...props}
114
- />
115
- {errorMessage ? <span className={styles.errorMessage}>{errorMessage}</span> : null}
116
- {optionList}
117
- </div>
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
- label: PropTypes.string,
124
- disabled: PropTypes.bool,
125
- required: PropTypes.bool,
126
- onChange: PropTypes.func,
127
- value: PropTypes.string,
128
- keyNames: PropTypes.object,
129
- className: PropTypes.string,
130
- searchCount: PropTypes.number,
131
- errorMessage: PropTypes.string,
132
- placeHolder: PropTypes.string,
133
- autoComplete: PropTypes.string,
134
- jsonOptionsData: PropTypes.string,
135
- jsonSelectedOptionsData: PropTypes.string,
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
- required: false,
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='Button' icon={<ReactSVG />} {...args}/>;
11
+ const Template = (args) => <Button label="Button" icon={<ReactSVG />} {...args} />
12
12
 
13
- export const Default = Template.bind({});
13
+ export const Default = Template.bind({})