@xaypay/tui 0.0.3 → 0.0.4

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 (72) hide show
  1. package/.idea/misc.xml +6 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/tui.iml +12 -0
  4. package/.idea/vcs.xml +6 -0
  5. package/.idea/workspace.xml +1755 -0
  6. package/.storybook/main.js +1 -1
  7. package/dist/index.es.js +866 -15
  8. package/dist/index.js +903 -14
  9. package/package.json +8 -4
  10. package/src/assets/heart-filled.svg +17 -0
  11. package/src/assets/heart-outline.svg +14 -0
  12. package/src/assets/like-filled.svg +21 -0
  13. package/src/assets/like-outline.svg +21 -0
  14. package/src/assets/star-filled.svg +21 -0
  15. package/src/assets/star-outline.svg +5 -0
  16. package/src/assets_old/icons/Read Me.txt +7 -0
  17. package/src/assets_old/icons/demo-files/demo.css +152 -0
  18. package/src/assets_old/icons/demo-files/demo.js +30 -0
  19. package/src/assets_old/icons/demo.html +150 -0
  20. package/src/assets_old/icons/fonts/icomoon.eot +0 -0
  21. package/src/assets_old/icons/fonts/icomoon.svg +18 -0
  22. package/src/assets_old/icons/fonts/icomoon.ttf +0 -0
  23. package/src/assets_old/icons/fonts/icomoon.woff +0 -0
  24. package/src/assets_old/icons/selection.json +1 -0
  25. package/src/assets_old/icons/style.css +51 -0
  26. package/src/components/autocomplate/autocomplate.module.css +74 -0
  27. package/src/components/autocomplate/autocomplate.stories.js +11 -0
  28. package/src/components/autocomplate/index.js +117 -0
  29. package/src/components/button/button.module.css +63 -1
  30. package/src/components/button/button.stories.js +10 -10
  31. package/src/components/button/index.js +12 -9
  32. package/src/components/captcha/blue.png +0 -0
  33. package/src/components/captcha/captcha.module.css +66 -0
  34. package/src/components/captcha/captcha.stories.js +17 -0
  35. package/src/components/captcha/green.png +0 -0
  36. package/src/components/captcha/index.js +63 -0
  37. package/src/components/captcha/red.png +0 -0
  38. package/src/components/checkbox/checkbox.module.css +57 -0
  39. package/src/components/checkbox/checkbox.stories.js +10 -0
  40. package/src/components/checkbox/index.js +87 -0
  41. package/src/components/icon/HeartFilled.js +26 -0
  42. package/src/components/icon/HeartOutline.js +25 -0
  43. package/src/components/icon/Icon.js +6 -0
  44. package/src/components/icon/LikeFilled.js +24 -0
  45. package/src/components/icon/LikeOutline.js +24 -0
  46. package/src/components/icon/StarFilled.js +24 -0
  47. package/src/components/icon/StarOutline.js +24 -0
  48. package/src/components/icon/index.js +6 -0
  49. package/src/components/input/index.js +90 -0
  50. package/src/components/input/input.module.css +89 -0
  51. package/src/components/input/input.stories.js +38 -0
  52. package/src/components/modal/index.js +24 -0
  53. package/src/components/modal/modal.module.css +35 -0
  54. package/src/components/modal/modal.stories.js +29 -0
  55. package/src/components/multiselect/index.js +76 -0
  56. package/src/components/multiselect/multiselect.module.css +137 -0
  57. package/src/components/multiselect/multiselect.stories.js +19 -0
  58. package/src/components/pagination/index.js +119 -0
  59. package/src/components/pagination/pagination.module.css +80 -0
  60. package/src/components/pagination/pagination.stories.js +371 -0
  61. package/src/components/pagination/paginationRange.js +70 -0
  62. package/src/components/radio/index.js +68 -0
  63. package/src/components/radio/radio.module.css +59 -0
  64. package/src/components/radio/radio.stories.js +10 -0
  65. package/src/components/select/index.js +130 -0
  66. package/src/components/select/select.module.css +100 -0
  67. package/src/components/select/select.stories.js +21 -0
  68. package/src/components/typography/index.js +53 -0
  69. package/src/components/typography/typography.module.css +60 -0
  70. package/src/components/typography/typography.stories.js +29 -0
  71. package/src/index.js +10 -1
  72. package/storybook-static/favicon.ico +0 -0
@@ -0,0 +1,68 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+ import styles from "./radio.module.css";
5
+
6
+ export const Radio = ({
7
+ disabled,
8
+ defaultChecked,
9
+ required,
10
+ className,
11
+ name,
12
+ value,
13
+ jsonData,
14
+ label,
15
+ keyNames,
16
+ ...props
17
+ }) => {
18
+ const classProps = classNames(styles.checkbox, className);
19
+ const parseData = jsonData.length !== 0 ? JSON.parse(jsonData) : [];
20
+
21
+ return (
22
+ <>
23
+ {parseData.map((element, id) => {
24
+ return (
25
+ <label className={styles["radio-wrap"]} key={element.value}>
26
+ <input
27
+ type="radio"
28
+ className={classProps}
29
+ disabled={disabled}
30
+ required={required}
31
+ defaultChecked={id === 0 ? defaultChecked : ""}
32
+ value={value ? value : element.value}
33
+ name={name ? name : element.name}
34
+ {...props}
35
+ />
36
+ <span className={styles["radio-checkmark"]}/>
37
+ {element.label ? (
38
+ <span className={styles.labelRadio}>
39
+ {label ? label : element.label}
40
+ </span>
41
+ ) : (
42
+ ""
43
+ )}
44
+ </label>
45
+ );
46
+ })}
47
+ </>
48
+ );
49
+ };
50
+
51
+ Radio.propTypes = {
52
+ className: PropTypes.string,
53
+ onChange: PropTypes.func,
54
+ required: PropTypes.bool,
55
+ defaultChecked: PropTypes.bool,
56
+ disabled: PropTypes.bool,
57
+ name: PropTypes.string,
58
+ value: PropTypes.string,
59
+ jsonData: PropTypes.string,
60
+ label: PropTypes.string,
61
+ keyNames: PropTypes.object,
62
+ };
63
+
64
+ Radio.defaultProps = {
65
+ onChange: undefined,
66
+ jsonData:
67
+ '[{"value":"email", "name":"contact", "label":"Email", "id":"contactChoice1"}, {"value":"phone", "name":"contact", "label":"Phone", "id":"contactChoice2"}]',
68
+ };
@@ -0,0 +1,59 @@
1
+ .radio-wrap {
2
+ position: relative;
3
+ display: inline-flex;
4
+ flex-direction: row;
5
+ flex-wrap: nowrap;
6
+ align-items: center;
7
+ margin: 0 6px;
8
+ padding-left: 24px;
9
+ cursor: pointer;
10
+ }
11
+ .radio-wrap > input {
12
+ position: absolute;
13
+ opacity: 0;
14
+ height: 0;
15
+ width: 0;
16
+ }
17
+
18
+ .radio-wrap .radio-checkmark {
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ display: inline-block;
23
+ vertical-align: top;
24
+ width: 14px;
25
+ height: 14px;
26
+ border: 1px solid #d9d9d9;
27
+ border-radius: 50%;
28
+ margin-right: 4px;
29
+ transition: border-color 240ms;
30
+ }
31
+
32
+ .radio-wrap > .radio-checkmark:after {
33
+ position: absolute;
34
+ content: '';
35
+ left: 0;
36
+ top: 0;
37
+ right: 0;
38
+ bottom: 0;
39
+ margin: auto;
40
+ width: 8px;
41
+ height: 8px;
42
+ border-radius: 50%;
43
+ background-color: #d9d9d9;
44
+ opacity: 0;
45
+ transition: opacity 240ms, background-color 240ms;
46
+ }
47
+
48
+ .radio-wrap input:checked ~ .radio-checkmark:after {
49
+ opacity: 1;
50
+ background-color: #1890ff;
51
+ }
52
+
53
+ .radio-wrap:hover input ~ .radio-checkmark:after {
54
+ opacity: 1;
55
+ }
56
+
57
+ .radio-wrap input:checked ~ .radio-checkmark {
58
+ border-color: #1890ff;
59
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { Radio } from ".";
3
+ export default {
4
+ component: Radio,
5
+ title: "Components/Radio",
6
+ };
7
+
8
+ const Template = (args) => <Radio {...args} />;
9
+
10
+ export const RadioButton = Template.bind({});
@@ -0,0 +1,130 @@
1
+ import React, {useEffect, useState} from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classnames from 'classnames';
4
+ import styles from './select.module.css';
5
+ import Icon from '../icon/Icon'
6
+
7
+
8
+ export const SelectTheme = {
9
+ DEFAULT: 'select-default',
10
+ PRIMARY: 'select-primary',
11
+ SUCCESS: 'select-success',
12
+ INFO: 'select-info',
13
+ WARNING: 'select-warning',
14
+ DANGER: 'select-danger',
15
+ LINK: 'select-link'
16
+ };
17
+
18
+ export const SelectSize = {
19
+ SMALL: 'small',
20
+ MEDIUM: 'medium',
21
+ LARGE: 'large'
22
+ };
23
+
24
+ export const Select = ({
25
+ theme,
26
+ size,
27
+ className,
28
+ disabled,
29
+ label,
30
+ jsonData,
31
+ eMessage,
32
+ required,
33
+ defaultOption,
34
+ onChange,
35
+ selected
36
+ }) => {
37
+ const options = jsonData.length ? JSON.parse(jsonData) : []
38
+ let [opened, setOpened] = useState(false)
39
+ let [newSelected, setNewSelected] = useState(selected)
40
+ const classProps = classnames(
41
+ styles[theme],
42
+ styles[size],
43
+ {
44
+ [styles.disabled]: disabled,
45
+ [styles.required]: required,
46
+ },
47
+ className
48
+ );
49
+
50
+ return (
51
+ <>
52
+ {label ? <label className={styles['select-title']}>{label}</label> : ""}
53
+ <div className={styles['select-wrap']}>
54
+ <div className={styles['select-content']} id={styles.selector}>
55
+ <div
56
+ className={styles['select-content-top']}
57
+ onClick={() => {
58
+ setOpened(!opened)
59
+ }}
60
+ >
61
+ <div className={styles['select-content-top-text']}>{newSelected ?.name || defaultOption}</div>
62
+ <div className={styles['select-content-top-icon']}>
63
+ <Icon className={opened ? 'icon-arrow-up' : 'icon-arrow-down'}/>
64
+ </div>
65
+ </div>
66
+ {
67
+ opened && !disabled ?
68
+
69
+ <div className={styles['select-content-bottom']}>
70
+ <div className={styles['select-content-bottom-inner']}>
71
+ <div
72
+ className={styles['select-content-bottom-row']}
73
+ onClick={() => {
74
+ if (!required && !selected) {
75
+ setNewSelected(defaultOption)
76
+ onChange(defaultOption)
77
+ setOpened(!opened)
78
+ }
79
+ }
80
+ }
81
+ >
82
+ {defaultOption}
83
+ </div>
84
+ {
85
+ options ?.map((option, i) => {
86
+ return <div
87
+ className={styles['select-content-bottom-row']}
88
+ disabled={true}
89
+ onClick={() => {
90
+ setNewSelected(option);
91
+ onChange(option);
92
+ setOpened(!opened);
93
+ }
94
+ }
95
+ defaultValue={option.id}
96
+ >
97
+ {option.name}
98
+ </div>
99
+ })
100
+ }
101
+ </div>
102
+
103
+ </div>
104
+ : null
105
+ }
106
+
107
+ </div>
108
+ </div>
109
+ {eMessage ? <span className={styles.eMessage}>{eMessage}</span> : null}
110
+ </>
111
+ );
112
+ };
113
+
114
+ Select.propTypes = {
115
+ theme: PropTypes.oneOf(Object.values(SelectTheme)),
116
+ size: PropTypes.oneOf(Object.values(SelectSize)),
117
+ label: PropTypes.string,
118
+ eMessage: PropTypes.string,
119
+ defaultOption: PropTypes.string,
120
+ onChange: PropTypes.func,
121
+ required: PropTypes.bool,
122
+ disabled: PropTypes.bool,
123
+ className: PropTypes.string,
124
+ selected: PropTypes.object,
125
+ jsonData: PropTypes.string
126
+ };
127
+
128
+ Select.defaultProps = {
129
+ size: 'medium'
130
+ };
@@ -0,0 +1,100 @@
1
+ .select-title {
2
+ display: block;
3
+ text-transform: capitalize;
4
+ font-size: 16px;
5
+ color: #3C393E;
6
+ line-height: 22px;
7
+ font-weight: 500;
8
+ margin-bottom: 6px;
9
+ }
10
+ .select-content {
11
+ display: flex;
12
+ flex-direction: column;
13
+ }
14
+ .select-content-top {
15
+ display: flex;
16
+ flex-direction: row;
17
+ max-width: 400px;
18
+ height: 46px;
19
+ padding: 0 15px;
20
+ font-size: 16px;
21
+ color: #3C393E;
22
+ line-height: 22px;
23
+ font-weight: 500;
24
+ border: 2px solid #D1D1D1;
25
+ border-radius: 6px;
26
+ transition: border-color 240ms;
27
+ box-sizing: border-box;
28
+ cursor: pointer;
29
+ }
30
+ .select-content-top.active {
31
+ border-color: #00236A;
32
+ }
33
+ .select-content-top:hover {
34
+ border-color: #3C393E;
35
+ }
36
+ .select-content-bottom {
37
+ position: relative;
38
+ top: 6px;
39
+ overflow: hidden;
40
+ max-width: 400px;
41
+ background: #FBFBFB;
42
+ box-shadow: 0 0 10px rgba(60, 57, 62, 0.08);
43
+ border-radius: 6px;
44
+ animation: select-show 640ms linear forwards;
45
+ max-height: 0;
46
+ }
47
+ .select-content-bottom-inner {
48
+ display: flex;
49
+ flex-direction: column;
50
+ overflow-y: auto;
51
+ overflow-x: hidden;
52
+ max-height: 234px;
53
+ }
54
+ @keyframes select-show {
55
+ 100% {
56
+ max-height: 400px;
57
+ }
58
+ }
59
+ .select-content-top-text {
60
+ flex: 1;
61
+ display: flex;
62
+ flex-direction: row;
63
+ flex-wrap: nowrap;
64
+ align-items: center;
65
+ }
66
+ .select-content-top-icon {
67
+ padding: 0 5px 0 20px;
68
+ box-sizing: border-box;
69
+ }
70
+ .select-content-top-icon {
71
+ display: flex;
72
+ align-items: center;
73
+ flex: 0 0 auto;
74
+ }
75
+ .select-content-top-icon > i{
76
+ font-size: 8px;
77
+ color: #3C393E;
78
+ }
79
+ .select-content-bottom-row {
80
+ display: flex;
81
+ align-items: center;
82
+ background: #ffffff;
83
+ padding: 0 15px;
84
+ height: 46px;
85
+ font-size: 16px;
86
+ color: #3C393E;
87
+ line-height: 22px;
88
+ font-weight: 500;
89
+ margin-bottom: 2px;
90
+ box-sizing: border-box;
91
+ transition: background 240ms, color 240ms;
92
+ cursor: pointer;
93
+ }
94
+ .select-content-bottom-row:last-child {
95
+ margin-bottom: 0;
96
+ }
97
+ .select-content-bottom-row:hover {
98
+ background: unset;
99
+ color: #00236A;;
100
+ }
@@ -0,0 +1,21 @@
1
+ import { Select, SelectTheme } from ".";
2
+
3
+ export default {
4
+ component: Select,
5
+ title: 'Components/Select',
6
+ };
7
+
8
+ const Template = (args) => <Select label='' {...args} >Default</Select>;
9
+
10
+ export const Default = Template.bind({});
11
+ Default.args = {
12
+ theme: SelectTheme.DEFAULT,
13
+ label: 'վարչական շրջան',
14
+ jsonData: '[{"id":"0", "name":"Արաբկիր"}, {"id":"1", "name":"Կենտրոն"}, {"id":"2", "name":"Մալաթիա"}]',
15
+ onChange: (newValue)=> {
16
+ console.log(newValue);
17
+ },
18
+ defaultOption: 'ընտրել',
19
+ selected: {"id":"2", "name":"Մալաթիա"}
20
+ };
21
+
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classnames from 'classnames';
4
+ import styles from './typography.module.css';
5
+ import styled from "styled-components";
6
+
7
+ export const TypographyType = {
8
+ h1: 'h1',
9
+ h2: 'h2',
10
+ h3: 'h3',
11
+ h4: 'h4',
12
+ h5: 'h5',
13
+ h6: 'h6',
14
+ span: 'span',
15
+ p: 'p',
16
+ i: 'i',
17
+ };
18
+
19
+
20
+
21
+ export const Typography = ({ variant, className, color, bold, children, ...props }) => {
22
+ const classProps = classnames(className,bold ? 'bold': '');
23
+ const CustomTag = variant;
24
+
25
+ // const Tag = ({ className, children }) => (
26
+ // <CustomTag
27
+ // className={className}
28
+ // {...props}
29
+ // >
30
+ // {children}
31
+ // </CustomTag>
32
+ // );
33
+
34
+ const StyledTypograpy = styled(CustomTag)`
35
+ ${color ? 'color: '+color+';' : '' }
36
+ ${bold ? 'font-weight: bold;' : '' }
37
+ `;
38
+
39
+ return (
40
+ <StyledTypograpy className={classProps}> {children} </StyledTypograpy>
41
+ );
42
+ };
43
+
44
+ Typography.propTypes = {
45
+ variant: PropTypes.oneOf(Object.values(TypographyType)),
46
+ className: PropTypes.string,
47
+ bold: PropTypes.bool,
48
+ color: PropTypes.string
49
+ };
50
+
51
+ Typography.defaultProps = {
52
+ variant: 'h1'
53
+ };
@@ -0,0 +1,60 @@
1
+ h1 {
2
+ text-transform: uppercase;
3
+ font-size: 70px;
4
+ line-height: 70px;
5
+ font-weight: 400;
6
+ }
7
+
8
+ h2 {
9
+ text-transform: uppercase;
10
+ font-size: 50px;
11
+ line-height: 50px;
12
+ font-weight: 400;
13
+ }
14
+
15
+ h3 {
16
+ text-transform: uppercase;
17
+ font-size: 38px;
18
+ line-height: 38px;
19
+ font-weight: 400;
20
+ }
21
+
22
+ h4 {
23
+ text-transform: uppercase;
24
+ font-size: 24px;
25
+ line-height: 24px;
26
+ font-weight: 600;
27
+ }
28
+
29
+ h5 {
30
+ text-transform: uppercase;
31
+ font-size: 20px;
32
+ line-height: 20px;
33
+ font-weight: 600;
34
+ }
35
+
36
+ h5 {
37
+ text-transform: capitalize;
38
+ font-size: 16px;
39
+ line-height: 22px;
40
+ font-weight: 600;
41
+ }
42
+
43
+ p {
44
+ text-transform: capitalize;
45
+ font-size: 14px;
46
+ line-height: 20px;
47
+ font-weight: 600;
48
+ }
49
+
50
+ span {
51
+ text-transform: capitalize;
52
+ font-size: 12px;
53
+ line-height: 16px;
54
+ font-weight: 500;
55
+ }
56
+
57
+ i {
58
+ font-family: icomoon;
59
+ font-style: inherit;
60
+ }
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import {Typography} from './index';
3
+
4
+ export default {
5
+ component: Typography,
6
+ title: 'Components/Typography',
7
+ };
8
+
9
+ const staticTag = ['h1','h2','h3','h4','h5','h6','span','p']
10
+
11
+ const Template = (args) => <>
12
+ <Typography {...args} >Dynamic Typography</Typography>
13
+ {
14
+ staticTag.map((tag,key) => {
15
+ return <Typography key={key} variant={tag} >{tag}</Typography>;
16
+ })
17
+ }
18
+ {/* <Typography variant="h1" >Test</Typography>
19
+ <Typography variant="h1" >Test</Typography>
20
+ <Typography variant="h1" >Test</Typography>
21
+ <Typography variant="h1" >Test</Typography>
22
+ <Typography variant="h1" >Test</Typography>
23
+ <Typography variant="h1" >Test</Typography> */}
24
+ </>;
25
+
26
+ export const Default = Template.bind({});
27
+ Default.args = {
28
+ variant: 'h1',
29
+ };
package/src/index.js CHANGED
@@ -1 +1,10 @@
1
- export * from './components/button';
1
+ export * from './components/button';
2
+ export * from './components/typography';
3
+ export * from './components/autocomplate';
4
+ export * from './components/checkbox';
5
+ export * from './components/icon';
6
+ export * from './components/input';
7
+ export * from './components/pagination';
8
+ export * from './components/radio';
9
+ export * from './components/captcha';
10
+ export * from './components/select';
Binary file