@xaypay/tui 0.0.55 → 0.0.57
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/dist/index.es.js +319 -184
- package/dist/index.js +318 -185
- package/package.json +5 -4
- package/rollup.config.js +2 -0
- package/src/assets/icons/arrow.svg +3 -0
- package/src/assets/icons/close-icon.svg +3 -0
- package/src/components/autocomplate/index.js +22 -17
- package/src/components/button/index.js +8 -8
- package/src/components/file/index.js +7 -0
- package/src/components/input/index.js +14 -18
- package/src/components/select/index.js +252 -103
- package/src/components/select/select.module.css +43 -80
- package/src/components/select/select.stories.js +1 -2
- package/src/components/table/index.js +1 -1
- package/src/components/tooltip/index.js +37 -34
- package/src/components/tooltip/tooltip.module.css +2 -2
- package/src/components/tooltip/tooltip.stories.js +3 -2
- package/src/components/typography/index.js +26 -35
- package/src/components/typography/typography.stories.js +1 -1
- package/src/stories/Introduction.stories.mdx +10 -0
- package/src/stories/configuration.stories.mdx +76 -11
- package/src/stories/static/button-usage.png +0 -0
- package/src/stories/static/input-tooltip-usage.png +0 -0
- package/src/stories/usage.stories.mdx +132 -0
- package/src/utils/index.js +1 -5
- package/tui.config.js +67 -13
- package/src/components/multiselect/index.js +0 -96
- package/src/components/multiselect/multiselect.module.css +0 -137
- package/src/components/multiselect/multiselect.stories.js +0 -20
package/tui.config.js
CHANGED
|
@@ -16,10 +16,10 @@ module.exports = {
|
|
|
16
16
|
padding: '12px 20px', // for padding
|
|
17
17
|
textTransform: 'none', // for text transform
|
|
18
18
|
boxSizing: 'border-box', // for box sizing
|
|
19
|
-
bgColor: 'rgba(0, 35, 106, 1)', // for background color
|
|
20
19
|
disabledColor: 'rgba(60, 57, 62, 1)', // for color in disabled mode
|
|
20
|
+
backgroundColor: 'rgba(0, 35, 106, 1)', // for background color
|
|
21
21
|
disabledLineColor: 'rgba(60, 57, 62, 1)', // for border color (outline) in disabled mode
|
|
22
|
-
|
|
22
|
+
disabledBackgroundColor: 'rgba(238, 238, 238, 1)', // for background color in disabled mode
|
|
23
23
|
transition: 'background-color 240ms, color 240ms', // for transition
|
|
24
24
|
},
|
|
25
25
|
// default properties for <Input /> component
|
|
@@ -30,7 +30,6 @@ module.exports = {
|
|
|
30
30
|
radius: '0px', // for input and also (if there exist left or right icons) icons block border-radius
|
|
31
31
|
className: '', // for input classname (you can set custom class for your custom css)
|
|
32
32
|
height: '46px', // for height
|
|
33
|
-
tooltip: false, // for tooltip
|
|
34
33
|
required: false, // for showing required mark on label (it meens input is required)
|
|
35
34
|
disabled: false, // for disabled
|
|
36
35
|
errorLeft: '0px', // for error message position from left (work when errorPosition prop is 'absolute')
|
|
@@ -59,9 +58,20 @@ module.exports = {
|
|
|
59
58
|
errorAnimationDuration: '240ms', // for animation duration (when have error message and errorAnimation prop is true)
|
|
60
59
|
boxShadowHover: '0 0 0 2px #3c393e', // for border size and color in hover mode (set if you want to change it)
|
|
61
60
|
},
|
|
61
|
+
// default properties for <Tooltip /> component
|
|
62
62
|
TOOLTIP: {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
type: 'top', // for tooltip type (top, right, bottom, left)
|
|
64
|
+
width: '46px', // for tooltip parent block width
|
|
65
|
+
radius: '0px', // for tooltip parent block border radius
|
|
66
|
+
className: '', // for tooltip className (maybe you want to add your custom class for your custom css)
|
|
67
|
+
color: 'white', // for tooltip color
|
|
68
|
+
height: '46px', // for tooltip parent block height
|
|
69
|
+
fontSize: '14px', // for tooltip font size
|
|
70
|
+
tooltipRadius: '3px', // for tooltip border radius
|
|
71
|
+
tooltipWidth: '100px', // for tooltip width
|
|
72
|
+
backgroundColor: 'transparent', // for tooltip parent block background color (maybe you want to see it)
|
|
73
|
+
fontFamily: 'Arial, sans-serif', // for tooltip font family
|
|
74
|
+
tooltipBackgroundColor: '#03a9f4' // for tooltip backgrond color
|
|
65
75
|
},
|
|
66
76
|
// default properties for <Typography /> component
|
|
67
77
|
TYPOGRAPHY: {
|
|
@@ -133,14 +143,14 @@ module.exports = {
|
|
|
133
143
|
colorHoverh6: '#3C393E', // for variant h6 color in hover mode
|
|
134
144
|
colorHoverspan: '#3C393E', // for variant span color in hover mode
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
backgroundColorp: 'transparent', // for variant p background color
|
|
147
|
+
backgroundColorh1: 'transparent', // for variant h1 background color
|
|
148
|
+
backgroundColorh2: 'transparent', // for variant h2 background color
|
|
149
|
+
backgroundColorh3: 'transparent', // for variant h3 background color
|
|
150
|
+
backgroundColorh4: 'transparent', // for variant h4 background color
|
|
151
|
+
backgroundColorh5: 'transparent', // for variant h5 background color
|
|
152
|
+
backgroundColorh6: 'transparent', // for variant h6 background color
|
|
153
|
+
backgroundColorspan: 'transparent', // for variant span background color
|
|
144
154
|
|
|
145
155
|
textDecorationp: 'none', // for variant p text decoration
|
|
146
156
|
textDecorationh1: 'none', // for variant h1 text decoration
|
|
@@ -186,5 +196,49 @@ module.exports = {
|
|
|
186
196
|
fontFamilyh5: 'Arial, sans-serif', // for variant h5 font family
|
|
187
197
|
fontFamilyh6: 'Arial, sans-serif', // for variant h6 font family
|
|
188
198
|
fontFamilyspan: 'Arial, sans-serif', // for variant span font family
|
|
199
|
+
},
|
|
200
|
+
// default properties for <Select /> component
|
|
201
|
+
SELECT: {
|
|
202
|
+
labelWeight: '500', // for label font weight
|
|
203
|
+
labelColor: '#3C393E', // for label color
|
|
204
|
+
labelDisplay: 'block', // for label display
|
|
205
|
+
labelFontSize: '16px', // for label font size
|
|
206
|
+
labelLineHeight: '22px', // for label line height
|
|
207
|
+
labelMarginBottom: '6px', // for label margin bottom
|
|
208
|
+
labelTextTransform: 'none', // for label text transform
|
|
209
|
+
|
|
210
|
+
errorSize: '14px', // for error font size
|
|
211
|
+
errorColor: 'rgb(238, 0, 0)', // for error color
|
|
212
|
+
|
|
213
|
+
cursor: 'pointer', // for selected cursor
|
|
214
|
+
selectedRadius: '6px', // for selected border radius
|
|
215
|
+
selectedHeight: '46px', // for selected height
|
|
216
|
+
selectedColor: '#3C393E', // for selected color
|
|
217
|
+
selectedFontSize: '16px', // for selected font size
|
|
218
|
+
selectedFontWeight: '500', // for selected font weight
|
|
219
|
+
selectedLineHeight: '22px', // for selected line height
|
|
220
|
+
selectedPadding: '0px 15px', // for selected padding
|
|
221
|
+
selectedBorder: '2px solid', // for selected border
|
|
222
|
+
selectedHoverColor: '#373538', // for selected color ( when hover )
|
|
223
|
+
selectedBorderColor: '#D1D1D1', // for selected border color
|
|
224
|
+
selectedBoxSizing: 'border-box', // for selected box sizing
|
|
225
|
+
selectedTransition: 'border-color 240ms', // for selected transition
|
|
226
|
+
|
|
227
|
+
optionsBorderRadius: '6px', // for options block border radius
|
|
228
|
+
optionsBackgroundColor: '#FBFBFB', // for options block background color
|
|
229
|
+
optionsBoxShadow: '0 0 10px rgba(60, 57, 62, 0.08)', // for options block box shadow
|
|
230
|
+
|
|
231
|
+
optionItemColor: '#3C393E', // for option color
|
|
232
|
+
optionItemFontSize: '16px', // for option font size
|
|
233
|
+
optionItemCursor: 'pointer', // for option cursor
|
|
234
|
+
optionItemMinHeight: '46px', // for option min height
|
|
235
|
+
optionItemFontWeight: '500', // for option font weight
|
|
236
|
+
optionItemLineHeight: '22px', // for option line height
|
|
237
|
+
optionItemPadding: '0px 15px', // for option padding
|
|
238
|
+
optionItemMarginBottom: '2px', // for option margin bottom
|
|
239
|
+
optionItemColorHover: '#00236A', // for option color ( when hover )
|
|
240
|
+
optionItemBoxSizing: 'border-box', // for option box sizing
|
|
241
|
+
optionItemBackgroudColor: '#ffffff', // for option background color
|
|
242
|
+
optionItemBackgroudColorHover: 'unset', // for option background color ( when hover )
|
|
189
243
|
}
|
|
190
244
|
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import styles from "./multiselect.module.css";
|
|
4
|
-
import Icon from '../icon/Icon'
|
|
5
|
-
|
|
6
|
-
export const Multiselect = ({
|
|
7
|
-
className,
|
|
8
|
-
label,
|
|
9
|
-
jsonOptionsData,
|
|
10
|
-
jsonSelectedOptionsData,
|
|
11
|
-
onchange,
|
|
12
|
-
keyNames,
|
|
13
|
-
value
|
|
14
|
-
}) => {
|
|
15
|
-
const [searchedOptions, setSearchedOptions] = useState(jsonOptionsData.length ? JSON.parse(jsonOptionsData) : []);
|
|
16
|
-
const [options, setOptions] = useState(jsonSelectedOptionsData?.length ? JSON.parse(jsonSelectedOptionsData) : []);
|
|
17
|
-
const [values, setValues] = useState(jsonOptionsData.length ? JSON.parse(jsonOptionsData) : []);
|
|
18
|
-
const [opened, setOpened] = useState(false);
|
|
19
|
-
return (
|
|
20
|
-
<div className={`${styles.main} multi-select`}>
|
|
21
|
-
{label ? <label className={`${styles['multi-select-title']} multi-select-title-rem`}>{label} {required && <sup style={{color: "#ee0000"}}>*</sup>}</label> : ""}
|
|
22
|
-
<div className={`${styles['multi-select-content-top']} multi-select-content-top-rem`} onClick={() => { setOpened(!opened) }}>
|
|
23
|
-
{
|
|
24
|
-
options.map((option, i) => {
|
|
25
|
-
return (<div className={`${styles['multi-select-content-bottom-row']} multi-select-content-bottom-row-rem`} key={option[keyNames.id]}>
|
|
26
|
-
<div id={option[keyNames.id]}>{option[keyNames.name]}</div>
|
|
27
|
-
<div
|
|
28
|
-
onClick={() => {
|
|
29
|
-
options.splice(i, 1);
|
|
30
|
-
setOptions(options);
|
|
31
|
-
setValues([...values, option]);
|
|
32
|
-
setSearchedOptions([...values, option]);
|
|
33
|
-
setOpened(true);
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
{/*<Icon className='icon-close' />*/}
|
|
37
|
-
<i className='icon-close'></i>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
</div>)
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
<input onChange={(e) => {
|
|
45
|
-
setValues(e.target.value ? searchedOptions.filter((option) => {
|
|
46
|
-
return option[keyNames.name].toLowerCase().includes(e.target.value.toLowerCase())
|
|
47
|
-
}) : searchedOptions)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}} className={styles.input} type='text' />
|
|
51
|
-
<div className={`${styles['select-content-top-icon']} select-content-top-icon-rem`}>
|
|
52
|
-
<Icon className={opened ? 'icon-arrow-up' : 'icon-arrow-down'} />
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
opened ? <div className={`${styles['multi-select-content-bottom']} multi-select-content-bottom-rem`} onClick={onchange}>
|
|
58
|
-
<div className={`${styles['multi-select-content-bottom-inner']} multi-select-content-bottom-inner-rem`}>
|
|
59
|
-
{
|
|
60
|
-
values.length ?
|
|
61
|
-
values.map((value, i) => {
|
|
62
|
-
return (<div
|
|
63
|
-
className={`${styles['multi-select-content-bottom-row']} multi-select-content-bottom-row-rem`}
|
|
64
|
-
key={value[keyNames.id]}
|
|
65
|
-
id={value.id}
|
|
66
|
-
onClick={(e) => {
|
|
67
|
-
setOptions([...options, { [keyNames.name]: value[keyNames.name], [keyNames.id]: value[keyNames.id] }])
|
|
68
|
-
values.splice(i, 1);
|
|
69
|
-
setValues(values);
|
|
70
|
-
setSearchedOptions(values);
|
|
71
|
-
}}>
|
|
72
|
-
{value[keyNames.name]}
|
|
73
|
-
</div>)
|
|
74
|
-
}) :
|
|
75
|
-
<div className={`${styles['no-elements']} no-elements-rem`}>No Elements!</div>
|
|
76
|
-
}
|
|
77
|
-
</div>
|
|
78
|
-
</div> : null
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
Multiselect.propTypes = {
|
|
86
|
-
className: PropTypes.string,
|
|
87
|
-
label: PropTypes.string,
|
|
88
|
-
jsonOptionsData: PropTypes.string,
|
|
89
|
-
jsonSelectedOptionsData: PropTypes.string,
|
|
90
|
-
onchange: PropTypes.func,
|
|
91
|
-
keyNames: PropTypes.object,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
Multiselect.defaultProps = {
|
|
95
|
-
required: false,
|
|
96
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
.fff {
|
|
2
|
-
background: red;
|
|
3
|
-
}
|
|
4
|
-
.multi-select-title {
|
|
5
|
-
display: block;
|
|
6
|
-
text-transform: none;
|
|
7
|
-
font-size: 16px;
|
|
8
|
-
color: #3C393E;
|
|
9
|
-
line-height: 22px;
|
|
10
|
-
font-weight: 500;
|
|
11
|
-
margin-bottom: 6px;
|
|
12
|
-
}
|
|
13
|
-
.multi-select-title span {
|
|
14
|
-
font-size: 16px;
|
|
15
|
-
line-height: 20px;
|
|
16
|
-
color: #ff0000;
|
|
17
|
-
}
|
|
18
|
-
.multi-select-content {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
}
|
|
22
|
-
.multi-select-content-top {
|
|
23
|
-
position: relative;
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: row;
|
|
26
|
-
flex-wrap: wrap;
|
|
27
|
-
align-items: center;
|
|
28
|
-
max-width: 840px;
|
|
29
|
-
height: 46px;
|
|
30
|
-
gap: 10px;
|
|
31
|
-
padding: 0 40px 0 15px;
|
|
32
|
-
font-size: 16px;
|
|
33
|
-
color: #3C393E;
|
|
34
|
-
line-height: 22px;
|
|
35
|
-
font-weight: 500;
|
|
36
|
-
border: 2px solid #D1D1D1;
|
|
37
|
-
border-radius: 6px;
|
|
38
|
-
transition: border-color 240ms;
|
|
39
|
-
box-sizing: border-box;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
}
|
|
42
|
-
.select-content-top-icon {
|
|
43
|
-
position: absolute;
|
|
44
|
-
top: 0;
|
|
45
|
-
right: 0;
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
width: 40px;
|
|
50
|
-
height: 100%;
|
|
51
|
-
}
|
|
52
|
-
.select-content-top-icon i {
|
|
53
|
-
font-size: 10px;
|
|
54
|
-
}
|
|
55
|
-
.multi-select-content-top.active {
|
|
56
|
-
border-color: #00236A;
|
|
57
|
-
}
|
|
58
|
-
.multi-select-content-top:hover {
|
|
59
|
-
border-color: #3C393E;
|
|
60
|
-
}
|
|
61
|
-
.multi-select-content-bottom {
|
|
62
|
-
position: relative;
|
|
63
|
-
top: 6px;
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
max-width: 840px;
|
|
66
|
-
background: #ffffff;
|
|
67
|
-
box-shadow: 0 0 10px rgba(60, 57, 62, 0.08);
|
|
68
|
-
border-radius: 6px;
|
|
69
|
-
animation: multi-select-show 640ms linear forwards;
|
|
70
|
-
max-height: 0;
|
|
71
|
-
}
|
|
72
|
-
.multi-select-content-bottom-inner {
|
|
73
|
-
display: flex;
|
|
74
|
-
flex-direction: row;
|
|
75
|
-
flex-wrap: wrap;
|
|
76
|
-
overflow-y: auto;
|
|
77
|
-
overflow-x: hidden;
|
|
78
|
-
max-height: 234px;
|
|
79
|
-
padding: 10px;
|
|
80
|
-
gap: 8px;
|
|
81
|
-
}
|
|
82
|
-
@keyframes multi-select-show {
|
|
83
|
-
100% {
|
|
84
|
-
max-height: 400px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
.multi-select-content-top-text {
|
|
88
|
-
flex: 1;
|
|
89
|
-
display: flex;
|
|
90
|
-
flex-direction: row;
|
|
91
|
-
flex-wrap: nowrap;
|
|
92
|
-
align-items: center;
|
|
93
|
-
}
|
|
94
|
-
.multi-select-content-top-icon {
|
|
95
|
-
padding: 0 5px 0 20px;
|
|
96
|
-
box-sizing: border-box;
|
|
97
|
-
}
|
|
98
|
-
.multi-select-content-top-icon {
|
|
99
|
-
display: flex;
|
|
100
|
-
align-items: center;
|
|
101
|
-
flex: 0 0 auto;
|
|
102
|
-
}
|
|
103
|
-
.multi-select-content-top-icon > i{
|
|
104
|
-
font-size: 8px;
|
|
105
|
-
color: #3C393E;
|
|
106
|
-
}
|
|
107
|
-
.multi-select-content-bottom-row {
|
|
108
|
-
display: flex;
|
|
109
|
-
align-items: center;
|
|
110
|
-
background: #ffffff;
|
|
111
|
-
padding: 0 10px;
|
|
112
|
-
height: 30px;
|
|
113
|
-
font-size: 16px;
|
|
114
|
-
color: #3C393E;
|
|
115
|
-
border: 1px solid #D1D1D1;
|
|
116
|
-
line-height: 20px;
|
|
117
|
-
font-weight: 500;
|
|
118
|
-
border-radius: 4px;
|
|
119
|
-
box-sizing: border-box;
|
|
120
|
-
transition: border-color 240ms, color 240ms;
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
|
-
.multi-select-content-bottom-row:hover {
|
|
124
|
-
color: #00236A;
|
|
125
|
-
border-color: #00236A;
|
|
126
|
-
}
|
|
127
|
-
.multi-select-content-top .multi-select-content-bottom-row i {
|
|
128
|
-
padding: 0 8px;
|
|
129
|
-
font-size: 10px;
|
|
130
|
-
}
|
|
131
|
-
.multi-select-content-top .multi-select-content-bottom-row {
|
|
132
|
-
border: 0;
|
|
133
|
-
padding: 0;
|
|
134
|
-
}
|
|
135
|
-
.no-elements {
|
|
136
|
-
color: #ff0000;
|
|
137
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Multiselect } from "./index";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
component: Multiselect,
|
|
6
|
-
title: "Components/Multiselect",
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const Template = (args) => <Multiselect {...args} />;
|
|
10
|
-
|
|
11
|
-
export const Default = Template.bind({});
|
|
12
|
-
Default.args = {
|
|
13
|
-
jsonOptionsData: '[{"bbb":"1", "value":"Կենտրոն"}]',
|
|
14
|
-
jsonSelectedOptionsData: '[{"bbb":"0", "value":"Արաբկիր"}, {"bbb":"2", "value":"Մալաթիա"}]',
|
|
15
|
-
label: 'label',
|
|
16
|
-
onchange: (newValue) => {
|
|
17
|
-
console.log(newValue);
|
|
18
|
-
},
|
|
19
|
-
keyNames: { name: 'value', id: 'bbb' }
|
|
20
|
-
};
|