@xaypay/tui 0.0.56 → 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.
@@ -25,7 +25,6 @@ export const Typography = ({
25
25
  margin,
26
26
  padding,
27
27
  variant,
28
- bgColor,
29
28
  onClick,
30
29
  children,
31
30
  textAlign,
@@ -37,6 +36,7 @@ export const Typography = ({
37
36
  fontFamily,
38
37
  textTransform,
39
38
  textDecoration,
39
+ backgroundColor,
40
40
  ...props
41
41
  }) => {
42
42
  const configStyles = compereConfigs();
@@ -44,25 +44,6 @@ export const Typography = ({
44
44
 
45
45
  const [isHover, setIsHover] = useState(false);
46
46
  const [validVariant, setValidVariant] = useState(false);
47
- const [style, setStyle] = useState({
48
- border: border ? border : configStyles.TYPOGRAPHY.border,
49
- cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
50
- borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
51
- fontSize: size ? size : configStyles.TYPOGRAPHY['size'+variant],
52
- margin: margin ? margin : configStyles.TYPOGRAPHY['margin'+variant],
53
- fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight'+variant],
54
- padding: padding ? padding : configStyles.TYPOGRAPHY['padding'+variant],
55
- textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
56
- textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign'+variant],
57
- backgroundColor: bgColor ? bgColor : configStyles.TYPOGRAPHY['bgColor'+variant],
58
- fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle'+variant],
59
- lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight'+variant],
60
- fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily'+variant],
61
- textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform'+variant],
62
- textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration'+variant],
63
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover'+variant] : color ? color : configStyles.TYPOGRAPHY['color'+variant],
64
-
65
- });
66
47
 
67
48
  useEffect(() => {
68
49
  if (!Object.values(TypographyType).includes(variant)) {
@@ -70,17 +51,6 @@ export const Typography = ({
70
51
  }
71
52
  }, [variant]);
72
53
 
73
- useEffect(() => {
74
- if (color) {
75
- setStyle(prev => {
76
- return {
77
- ...prev,
78
- color: color
79
- }
80
- })
81
- }
82
- }, [color]);
83
-
84
54
  const handleMouseEnter = () => {
85
55
  setIsHover(true);
86
56
  };
@@ -92,7 +62,24 @@ export const Typography = ({
92
62
  const tagT = React.createElement(
93
63
  variant,
94
64
  {
95
- style,
65
+ style: {
66
+ border: border ? border : configStyles.TYPOGRAPHY.border,
67
+ cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
68
+ borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
69
+ fontSize: size ? size : configStyles.TYPOGRAPHY['size'+variant],
70
+ margin: margin ? margin : configStyles.TYPOGRAPHY['margin'+variant],
71
+ fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight'+variant],
72
+ padding: padding ? padding : configStyles.TYPOGRAPHY['padding'+variant],
73
+ textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
74
+ textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign'+variant],
75
+ fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle'+variant],
76
+ lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight'+variant],
77
+ fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily'+variant],
78
+ textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform'+variant],
79
+ textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration'+variant],
80
+ backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor'+variant],
81
+ color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover'+variant] : color ? color : configStyles.TYPOGRAPHY['color'+variant],
82
+ },
96
83
  ...props,
97
84
  className: classProps,
98
85
  onClick: onClick ? onClick : _ => _,
@@ -117,7 +104,6 @@ Typography.propTypes = {
117
104
  cursor: PropTypes.string,
118
105
  margin: PropTypes.string,
119
106
  radius: PropTypes.string,
120
- bgColor: PropTypes.string,
121
107
  padding: PropTypes.string,
122
108
  textAlign: PropTypes.string,
123
109
  className: PropTypes.string,
@@ -128,6 +114,7 @@ Typography.propTypes = {
128
114
  colorHover: PropTypes.string,
129
115
  textTransform: PropTypes.string,
130
116
  textDecoration: PropTypes.string,
117
+ backgroundColor: PropTypes.string,
131
118
  variant: PropTypes.oneOf(Object.values(TypographyType)),
132
119
  };
133
120
 
@@ -9,7 +9,7 @@ export default {
9
9
  const staticTag = ['h1','h2','h3','h4','h5','h6','span','p']
10
10
 
11
11
  export const Template = (args) => <>
12
- <Typography {...args}>Dynamic Typography</Typography>
12
+ <Typography {...args} >Dynamic Typography</Typography>
13
13
  {
14
14
  staticTag.map((tag,key) => {
15
15
  return <Typography
@@ -277,14 +277,14 @@ import StackAlt from './assets/stackalt.svg';
277
277
  colorHoverh6: '#3C393E', // for variant h6 color in hover mode
278
278
  colorHoverspan: '#3C393E', // for variant span color in hover mode
279
279
 
280
- bgColorp: 'transparent', // for variant p background color
281
- bgColorh1: 'transparent', // for variant h1 background color
282
- bgColorh2: 'transparent', // for variant h2 background color
283
- bgColorh3: 'transparent', // for variant h3 background color
284
- bgColorh4: 'transparent', // for variant h4 background color
285
- bgColorh5: 'transparent', // for variant h5 background color
286
- bgColorh6: 'transparent', // for variant h6 background color
287
- bgColorspan: 'transparent', // for variant span background color
280
+ backgroundColorp: 'transparent', // for variant p background color
281
+ backgroundColorh1: 'transparent', // for variant h1 background color
282
+ backgroundColorh2: 'transparent', // for variant h2 background color
283
+ backgroundColorh3: 'transparent', // for variant h3 background color
284
+ backgroundColorh4: 'transparent', // for variant h4 background color
285
+ backgroundColorh5: 'transparent', // for variant h5 background color
286
+ backgroundColorh6: 'transparent', // for variant h6 background color
287
+ backgroundColorspan: 'transparent', // for variant span background color
288
288
 
289
289
  textDecorationp: 'none', // for variant p text decoration
290
290
  textDecorationh1: 'none', // for variant h1 text decoration
@@ -332,3 +332,51 @@ import StackAlt from './assets/stackalt.svg';
332
332
  fontFamilyspan: 'Arial, sans-serif', // for variant span font family
333
333
  }
334
334
  ```
335
+
336
+ ### Select
337
+
338
+ ```
339
+ {
340
+ labelWeight: '500', // for label font weight
341
+ labelColor: '#3C393E', // for label color
342
+ labelDisplay: 'block', // for label display
343
+ labelFontSize: '16px', // for label font size
344
+ labelLineHeight: '22px', // for label line height
345
+ labelMarginBottom: '6px', // for label margin bottom
346
+ labelTextTransform: 'none', // for label text transform
347
+
348
+ errorSize: '14px', // for error font size
349
+ errorColor: 'rgb(238, 0, 0)', // for error color
350
+
351
+ cursor: 'pointer', // for selected cursor
352
+ selectedRadius: '6px', // for selected border radius
353
+ selectedHeight: '46px', // for selected height
354
+ selectedColor: '#3C393E', // for selected color
355
+ selectedFontSize: '16px', // for selected font size
356
+ selectedFontWeight: '500', // for selected font weight
357
+ selectedLineHeight: '22px', // for selected line height
358
+ selectedPadding: '0px 15px', // for selected padding
359
+ selectedBorder: '2px solid', // for selected border
360
+ selectedHoverColor: '#373538', // for selected color ( when hover )
361
+ selectedBorderColor: '#D1D1D1', // for selected border color
362
+ selectedBoxSizing: 'border-box', // for selected box sizing
363
+ selectedTransition: 'border-color 240ms', // for selected transition
364
+
365
+ optionsBorderRadius: '6px', // for options block border radius
366
+ optionsBackgroundColor: '#FBFBFB', // for options block background color
367
+ optionsBoxShadow: '0 0 10px rgba(60, 57, 62, 0.08)', // for options block box shadow
368
+
369
+ optionItemColor: '#3C393E', // for option color
370
+ optionItemFontSize: '16px', // for option font size
371
+ optionItemCursor: 'pointer', // for option cursor
372
+ optionItemMinHeight: '46px', // for option min height
373
+ optionItemFontWeight: '500', // for option font weight
374
+ optionItemLineHeight: '22px', // for option line height
375
+ optionItemPadding: '0px 15px', // for option padding
376
+ optionItemMarginBottom: '2px', // for option margin bottom
377
+ optionItemColorHover: '#00236A', // for option color ( when hover )
378
+ optionItemBoxSizing: 'border-box', // for option box sizing
379
+ optionItemBackgroudColor: '#ffffff', // for option background color
380
+ optionItemBackgroudColorHover: 'unset', // for option background color ( when hover )
381
+ }
382
+ ```
@@ -9,6 +9,7 @@ import Repo from './assets/repo.svg';
9
9
  import StackAlt from './assets/stackalt.svg';
10
10
 
11
11
  import buttonImage from './static/button-usage.png';
12
+ import inputTooltipImage from './static/input-tooltip-usage.png';
12
13
 
13
14
  <Meta title="Intro/Usage" />
14
15
 
@@ -126,3 +127,6 @@ import buttonImage from './static/button-usage.png';
126
127
 
127
128
  <img src={buttonImage} alt="button image" />
128
129
 
130
+ ### Input / Tooltip
131
+
132
+ <img src={inputTooltipImage} alt="button image" />
@@ -4,12 +4,7 @@ export const compereConfigs = () => {
4
4
  let projectConfig = {};
5
5
  let packageConfig = {};
6
6
 
7
- try {
8
- packageConfig = require('../tui.config.js');
9
- } catch (error) {
10
- packageConfig = require('../../tui.config.js');
11
- // console.log(error, 'Package: tui.config.js file is not define');
12
- }
7
+ packageConfig = require(process.env.STORYBOOK_PATH);
13
8
 
14
9
  try {
15
10
  projectConfig = require('../../../../tui.config.js');
package/tui.config.js CHANGED
@@ -143,14 +143,14 @@ module.exports = {
143
143
  colorHoverh6: '#3C393E', // for variant h6 color in hover mode
144
144
  colorHoverspan: '#3C393E', // for variant span color in hover mode
145
145
 
146
- bgColorp: 'transparent', // for variant p background color
147
- bgColorh1: 'transparent', // for variant h1 background color
148
- bgColorh2: 'transparent', // for variant h2 background color
149
- bgColorh3: 'transparent', // for variant h3 background color
150
- bgColorh4: 'transparent', // for variant h4 background color
151
- bgColorh5: 'transparent', // for variant h5 background color
152
- bgColorh6: 'transparent', // for variant h6 background color
153
- bgColorspan: 'transparent', // for variant span background color
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
154
154
 
155
155
  textDecorationp: 'none', // for variant p text decoration
156
156
  textDecorationh1: 'none', // for variant h1 text decoration
@@ -196,5 +196,49 @@ module.exports = {
196
196
  fontFamilyh5: 'Arial, sans-serif', // for variant h5 font family
197
197
  fontFamilyh6: 'Arial, sans-serif', // for variant h6 font family
198
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 )
199
243
  }
200
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
- };