@xaypay/tui 0.0.105 → 0.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +30 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +42 -45
- package/.storybook/preview.js +7 -7
- package/cli-command.js +1 -1
- package/dist/index.es.js +84 -83
- package/dist/index.js +84 -83
- package/package.json +16 -4
- package/rollup.config.js +11 -11
- package/src/assets_old/icons/demo-files/demo.js +16 -18
- package/src/components/autocomplate/autocomplate.stories.js +30 -28
- package/src/components/autocomplate/index.js +145 -127
- package/src/components/button/button.stories.js +6 -6
- package/src/components/button/index.js +176 -126
- package/src/components/captcha/captcha.stories.js +12 -8
- package/src/components/captcha/index.js +47 -50
- package/src/components/checkbox/checkbox.stories.js +7 -7
- package/src/components/checkbox/index.js +77 -93
- package/src/components/file/file.stories.js +15 -15
- package/src/components/file/index.js +114 -116
- package/src/components/icon/Arrow.js +18 -18
- package/src/components/icon/CaptchaArrowDown.js +18 -18
- package/src/components/icon/CaptchaArrowUp.js +18 -18
- package/src/components/icon/CheckboxChecked.js +20 -20
- package/src/components/icon/CheckboxUnchecked.js +20 -20
- package/src/components/icon/Close.js +18 -18
- package/src/components/icon/CloseIcon.js +18 -18
- package/src/components/icon/CloseSlide.js +18 -18
- package/src/components/icon/DeleteComponent.js +19 -19
- package/src/components/icon/Dots.js +18 -18
- package/src/components/icon/HeartFilled.js +22 -23
- package/src/components/icon/HeartOutline.js +22 -22
- package/src/components/icon/Icon.js +3 -5
- package/src/components/icon/ListItemDelete.js +18 -18
- package/src/components/icon/ListItemJpeg.js +20 -20
- package/src/components/icon/ListItemJpg.js +20 -20
- package/src/components/icon/ListItemPdf.js +20 -20
- package/src/components/icon/ListItemPng.js +20 -20
- package/src/components/icon/Next.js +19 -19
- package/src/components/icon/Nextarrow.js +18 -18
- package/src/components/icon/PDF.js +18 -18
- package/src/components/icon/Prev.js +19 -19
- package/src/components/icon/RangeArrowDefault.js +41 -52
- package/src/components/icon/RangeArrowError.js +41 -52
- package/src/components/icon/RangeArrowSuccess.js +41 -52
- package/src/components/icon/RemoveFile.js +19 -19
- package/src/components/icon/ToasterClose.js +18 -18
- package/src/components/icon/ToasterError.js +18 -18
- package/src/components/icon/ToasterInfo.js +18 -18
- package/src/components/icon/ToasterSuccess.js +18 -18
- package/src/components/icon/ToasterWarning.js +18 -18
- package/src/components/icon/Tooltip.js +18 -18
- package/src/components/icon/Upload.js +24 -24
- package/src/components/input/index.js +267 -224
- package/src/components/input/input.stories.js +20 -21
- package/src/components/modal/index.js +172 -159
- package/src/components/modal/modal.stories.js +79 -78
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
- package/src/components/newAutocomplete/index.js +342 -216
- package/src/components/newFile/fileItem.js +213 -191
- package/src/components/newFile/index.js +231 -173
- package/src/components/newFile/newFile.stories.js +32 -35
- package/src/components/pagination/index.js +97 -122
- package/src/components/pagination/pagination.stories.js +362 -362
- package/src/components/pagination/paginationRange.js +42 -53
- package/src/components/radio/index.js +49 -62
- package/src/components/radio/radio.stories.js +7 -7
- package/src/components/select/index.js +316 -221
- package/src/components/select/select.stories.js +25 -14
- package/src/components/singleCheckbox/Checkbox.js +31 -34
- package/src/components/singleCheckbox/index.js +36 -45
- package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
- package/src/components/stepper/index.js +35 -30
- package/src/components/stepper/stepper.stories.js +11 -11
- package/src/components/table/index.js +280 -148
- package/src/components/table/table.stories.js +105 -217
- package/src/components/table/td.js +80 -72
- package/src/components/table/th.js +19 -16
- package/src/components/textarea/index.js +86 -62
- package/src/components/textarea/textarea.stories.js +10 -13
- package/src/components/toaster/Toast.js +177 -159
- package/src/components/toaster/index.js +107 -111
- package/src/components/toaster/toaster.stories.js +582 -367
- package/src/components/tooltip/index.js +79 -46
- package/src/components/tooltip/tooltip.stories.js +9 -10
- package/src/components/typography/index.js +108 -101
- package/src/components/typography/typography.stories.js +16 -19
- package/src/index.js +20 -20
- package/src/utils/index.js +11 -11
- package/tui.config.js +343 -341
|
@@ -1,28 +1,39 @@
|
|
|
1
|
-
import
|
|
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) =>
|
|
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: [
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
options: [
|
|
28
|
+
{ bbb: '0', value: 'Արաբկիր' },
|
|
29
|
+
{ bbb: '1', value: 'Կենտրոն' },
|
|
30
|
+
{ bbb: '2', value: 'Մալաթիա' },
|
|
31
|
+
],
|
|
32
|
+
onChange: () => {},
|
|
25
33
|
defaultOption: 'Ընտրել',
|
|
26
|
-
selected: [
|
|
27
|
-
|
|
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
|
-
|
|
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 [
|
|
20
|
-
const [
|
|
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
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
2
|
-
import { SingleCheckbox } from
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { SingleCheckbox } from '.'
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
component: SingleCheckbox,
|
|
5
|
+
title: 'Components/SingleCheckbox',
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
const Template = (args) => {
|
|
9
|
-
|
|
9
|
+
const [check, setCheck] = useState(false)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const handleChecked = (data, e) => {
|
|
12
|
+
console.log(e, 'target event')
|
|
13
|
+
console.log(data, 'data')
|
|
14
|
+
setCheck(!check)
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
22
|
+
checkedColor: '#00236A',
|
|
23
|
+
unCheckedColor: '#D1D1D1',
|
|
24
|
+
}
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import classNames from
|
|
4
|
-
import styles from
|
|
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 = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
2
|
-
import { Stepper } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Stepper } from './index'
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
component: Stepper,
|
|
5
|
+
title: 'Components/Stepper',
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
const Template = ({ stepLength, activeSteps }) => {
|
|
9
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
stepLength: 5,
|
|
16
|
+
activeSteps: 3,
|
|
17
|
+
}
|