@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.
Files changed (91) 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 +84 -83
  8. package/dist/index.js +84 -83
  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 +213 -191
  62. package/src/components/newFile/index.js +231 -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 +316 -221
  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 +177 -159
  83. package/src/components/toaster/index.js +107 -111
  84. package/src/components/toaster/toaster.stories.js +582 -367
  85. package/src/components/tooltip/index.js +79 -46
  86. package/src/components/tooltip/tooltip.stories.js +9 -10
  87. package/src/components/typography/index.js +108 -101
  88. package/src/components/typography/typography.stories.js +16 -19
  89. package/src/index.js +20 -20
  90. package/src/utils/index.js +11 -11
  91. package/tui.config.js +343 -341
@@ -1,28 +1,39 @@
1
- import { Select } from ".";
1
+ import React from 'react'
2
+ import { Select } from '.'
2
3
 
3
4
  export default {
4
5
  component: Select,
5
6
  title: 'Components/Select',
6
7
  argTypes: {
7
8
  options: {
8
- control: 'array'
9
+ control: 'array',
9
10
  },
10
11
  selected: {
11
- control: 'array'
12
- }
13
- }
14
- };
12
+ control: 'array',
13
+ },
14
+ },
15
+ }
15
16
 
16
- const Template = (args) => <Select label='' {...args} >Default</Select>;
17
+ const Template = (args) => (
18
+ <Select label="" {...args}>
19
+ Default
20
+ </Select>
21
+ )
17
22
 
18
- export const Default = Template.bind({});
23
+ export const Default = Template.bind({})
19
24
  Default.args = {
20
25
  showCloseIcon: true,
21
26
  label: 'վարչական շրջան',
22
- options: [{"bbb":"0", "value":"Արաբկիր"}, {"bbb":"1", "value":"Կենտրոն"}, {"bbb":"2", "value":"Մալաթիա"}],
23
- onChange: (newValue)=> {
24
- },
27
+ options: [
28
+ { bbb: '0', value: 'Արաբկիր' },
29
+ { bbb: '1', value: 'Կենտրոն' },
30
+ { bbb: '2', value: 'Մալաթիա' },
31
+ ],
32
+ onChange: () => {},
25
33
  defaultOption: 'Ընտրել',
26
- selected: [{"bbb":"1", "value":"Կենտրոն"}, {"bbb":"2", "value":"Մալաթիա"}],
27
- keyNames: {name: 'value', id : 'bbb'}
28
- };
34
+ selected: [
35
+ { bbb: '1', value: 'Կենտրոն' },
36
+ { bbb: '2', value: 'Մալաթիա' },
37
+ ],
38
+ keyNames: { name: 'value', id: 'bbb' },
39
+ }
@@ -1,36 +1,28 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState } from 'react'
2
2
 
3
- import { compereConfigs } from './../../utils';
3
+ import { compereConfigs } from './../../utils'
4
4
 
5
- import ReactCheckbox from '../icon/CheckboxUnchecked';
6
- import ReactCheckboxChecked from '../icon/CheckboxChecked';
5
+ import ReactCheckbox from '../icon/CheckboxUnchecked'
6
+ import ReactCheckboxChecked from '../icon/CheckboxChecked'
7
7
 
8
- const Checkbox = ({
9
- data,
10
- styles,
11
- checked,
12
- disabled,
13
- checkedColor,
14
- handleChecked,
15
- unCheckedColor
16
- }) => {
17
- const configStyles = compereConfigs();
8
+ const Checkbox = ({ data, styles, checked, disabled, checkedColor, handleChecked, unCheckedColor }) => {
9
+ const configStyles = compereConfigs()
18
10
 
19
- const [ innerChecked, setInnerChecked ] = useState(false);
20
- const [ innerDisabled, setInnerDisabled ] = useState(false);
11
+ const [innerChecked, setInnerChecked] = useState(false)
12
+ const [innerDisabled, setInnerDisabled] = useState(false)
21
13
 
22
14
  const handleClick = (e) => {
23
- handleChecked(data, e);
24
- };
15
+ handleChecked(data, e)
16
+ }
25
17
 
26
18
  useEffect(() => {
27
- setInnerDisabled(disabled);
28
- }, [disabled]);
19
+ setInnerDisabled(disabled)
20
+ }, [disabled])
29
21
 
30
22
  useEffect(() => {
31
- setInnerChecked(checked);
32
- }, [checked]);
33
-
23
+ setInnerChecked(checked)
24
+ }, [checked])
25
+
34
26
  return (
35
27
  <div
36
28
  style={{
@@ -39,18 +31,23 @@ const Checkbox = ({
39
31
  marginRight: '9px',
40
32
  display: 'inline-block',
41
33
  cursor: !innerDisabled ? 'pointer' : 'not-allowed',
42
- ...styles
34
+ ...styles,
43
35
  }}
44
- onClick={!innerDisabled && handleChecked ? handleClick : _ => _}
36
+ onClick={!innerDisabled && handleChecked ? handleClick : (_) => _}
45
37
  >
46
- { innerChecked && !innerDisabled
47
- ? <ReactCheckboxChecked fillColor={checkedColor ? checkedColor : configStyles.SINGLECHECKBOX.checkedColor} />
48
- : <ReactCheckbox fillColor={unCheckedColor ? unCheckedColor : configStyles.SINGLECHECKBOX.unCheckedColor} />
49
- }
50
-
51
- {/* {label && <span>{ label }</span>} */}
38
+ {innerChecked && !innerDisabled ? (
39
+ <ReactCheckboxChecked
40
+ fillColor={checkedColor ? checkedColor : configStyles.SINGLECHECKBOX.checkedColor}
41
+ />
42
+ ) : (
43
+ <ReactCheckbox
44
+ fillColor={unCheckedColor ? unCheckedColor : configStyles.SINGLECHECKBOX.unCheckedColor}
45
+ />
46
+ )}
47
+
48
+ {data?.label && <span>{data.label}</span>}
52
49
  </div>
53
- );
54
- };
50
+ )
51
+ }
55
52
 
56
- export default Checkbox;
53
+ export default Checkbox
@@ -1,51 +1,42 @@
1
- import React, { useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import React, { useEffect, useState } from 'react'
2
+ import PropTypes from 'prop-types'
3
3
 
4
- import Checkbox from './Checkbox';
4
+ import Checkbox from './Checkbox'
5
5
 
6
- export const SingleCheckbox = ({
7
- data,
8
- styles,
9
- checked,
10
- disabled,
11
- checkedColor,
12
- handleChecked,
13
- unCheckedColor
14
- }) => {
6
+ export const SingleCheckbox = ({ data, styles, checked, disabled, checkedColor, handleChecked, unCheckedColor }) => {
7
+ const [innerData, setInnerData] = useState(null)
15
8
 
16
- const [ innerData, setInnerData ] = useState(null);
9
+ useEffect(() => {
10
+ // if (data) {
11
+ // if (typeof data === 'object' && data.constructor === Object) {
12
+ // setInnerData(data);
13
+ // } else {
14
+ // alert('Data props on Checkbox component must be an object');
15
+ // }
16
+ // } else {
17
+ // alert('Please add data props on Checkbox component');
18
+ // }
19
+ setInnerData(data)
20
+ }, [data])
17
21
 
18
- useEffect(() => {
19
- // if (data) {
20
- // if (typeof data === 'object' && data.constructor === Object) {
21
- // setInnerData(data);
22
- // } else {
23
- // alert('Data props on Checkbox component must be an object');
24
- // }
25
- // } else {
26
- // alert('Please add data props on Checkbox component');
27
- // }
28
- setInnerData(data);
29
- }, [data]);
30
-
31
- return (
32
- <Checkbox
33
- styles={styles}
34
- data={innerData}
35
- checked={checked}
36
- disabled={disabled}
37
- checkedColor={checkedColor}
38
- handleChecked={handleChecked}
39
- unCheckedColor={unCheckedColor}
40
- />
41
- );
42
- };
22
+ return (
23
+ <Checkbox
24
+ styles={styles}
25
+ data={innerData}
26
+ checked={checked}
27
+ disabled={disabled}
28
+ checkedColor={checkedColor}
29
+ handleChecked={handleChecked}
30
+ unCheckedColor={unCheckedColor}
31
+ />
32
+ )
33
+ }
43
34
 
44
35
  SingleCheckbox.propTypes = {
45
- onClick: PropTypes.func,
46
- styles: PropTypes.object,
47
- disabled: PropTypes.bool,
48
- checkedColor: PropTypes.string,
49
- unCheckedColor: PropTypes.string,
50
- data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
51
- };
36
+ data: PropTypes.object,
37
+ onClick: PropTypes.func,
38
+ styles: PropTypes.object,
39
+ disabled: PropTypes.bool,
40
+ checkedColor: PropTypes.string,
41
+ unCheckedColor: PropTypes.string,
42
+ }
@@ -1,24 +1,24 @@
1
- import React, { useState } from "react";
2
- import { SingleCheckbox } from ".";
1
+ import React, { useState } from 'react'
2
+ import { SingleCheckbox } from '.'
3
3
  export default {
4
- component: SingleCheckbox,
5
- title: "Components/SingleCheckbox",
6
- };
4
+ component: SingleCheckbox,
5
+ title: 'Components/SingleCheckbox',
6
+ }
7
7
 
8
8
  const Template = (args) => {
9
- const [ check, setCheck ] = useState(false);
9
+ const [check, setCheck] = useState(false)
10
10
 
11
- const handleChecked = (data, e) => {
12
- console.log(e, 'target event');
13
- console.log(data, 'data');
14
- setCheck(!check);
15
- };
11
+ const handleChecked = (data, e) => {
12
+ console.log(e, 'target event')
13
+ console.log(data, 'data')
14
+ setCheck(!check)
15
+ }
16
16
 
17
- return <SingleCheckbox checked={check} data={[1,2,3]} handleChecked={handleChecked} {...args} />;
17
+ return <SingleCheckbox checked={check} handleChecked={handleChecked} {...args} />
18
18
  }
19
19
 
20
- export const Default = Template.bind({});
20
+ export const Default = Template.bind({})
21
21
  Default.args = {
22
- checkedColor: '#00236A',
23
- unCheckedColor: '#D1D1D1'
24
- };
22
+ checkedColor: '#00236A',
23
+ unCheckedColor: '#D1D1D1',
24
+ }
@@ -1,33 +1,38 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import classNames from "classnames";
4
- import styles from "./stepper.module.css";
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import classNames from 'classnames'
4
+ import styles from './stepper.module.css'
5
5
 
6
- export const Stepper = ({ className, onChange, stepLength, activeSteps }) => {
7
- const classProps = classNames(className, 'stepper-inner-rem');
8
- return (
9
- <div className={`${styles['stepper-container']} stepper-container-rem`}>
10
- {(() => {
11
- let steppers = [];
12
- for (let step = 1; step <= stepLength; step++) {
13
- steppers.push(
14
- <div className={classNames(`${step <= activeSteps ? styles.activeRing : styles.bigRing}`)} key={step}>
15
- <div
16
- className={classNames(`${step <= activeSteps ? styles.smallActiveRing : styles.smallRing}`)}>
17
- {step <= activeSteps ? step : ""}
18
- </div>
19
- </div>
20
- );
21
- }
22
- return steppers;
23
- })()}
24
- </div>
25
- );
26
- };
6
+ export const Stepper = ({ stepLength, activeSteps }) => {
7
+ return (
8
+ <div className={`${styles['stepper-container']} stepper-container-rem`}>
9
+ {(() => {
10
+ let steppers = []
11
+ for (let step = 1; step <= stepLength; step++) {
12
+ steppers.push(
13
+ <div
14
+ className={classNames(`${step <= activeSteps ? styles.activeRing : styles.bigRing}`)}
15
+ key={step}
16
+ >
17
+ <div
18
+ className={classNames(
19
+ `${step <= activeSteps ? styles.smallActiveRing : styles.smallRing}`
20
+ )}
21
+ >
22
+ {step <= activeSteps ? step : ''}
23
+ </div>
24
+ </div>
25
+ )
26
+ }
27
+ return steppers
28
+ })()}
29
+ </div>
30
+ )
31
+ }
27
32
 
28
33
  Stepper.propTypes = {
29
- className: PropTypes.string,
30
- onChange: PropTypes.func,
31
- stepLength: PropTypes.number,
32
- activeSteps: PropTypes.number,
33
- };
34
+ className: PropTypes.string,
35
+ onChange: PropTypes.func,
36
+ stepLength: PropTypes.number,
37
+ activeSteps: PropTypes.number,
38
+ }
@@ -1,17 +1,17 @@
1
- import React from "react";
2
- import { Stepper } from "./index";
1
+ import React from 'react'
2
+ import { Stepper } from './index'
3
3
  export default {
4
- component: Stepper,
5
- title: "Components/Stepper",
6
- };
4
+ component: Stepper,
5
+ title: 'Components/Stepper',
6
+ }
7
7
 
8
8
  const Template = ({ stepLength, activeSteps }) => {
9
- return <Stepper stepLength={stepLength} activeSteps={activeSteps} />;
10
- };
9
+ return <Stepper stepLength={stepLength} activeSteps={activeSteps} />
10
+ }
11
11
 
12
- export const Default = Template.bind({});
12
+ export const Default = Template.bind({})
13
13
 
14
14
  Default.args = {
15
- stepLength: 5,
16
- activeSteps: 3,
17
- };
15
+ stepLength: 5,
16
+ activeSteps: 3,
17
+ }