diginet-core-ui 1.3.98 → 1.3.99-beta.1

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.
@@ -478,15 +478,18 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
478
478
  };
479
479
 
480
480
  const checkExistingFile = newFile => {
481
- const files = allNewAttached.getAll('files');
482
- if (files && files.length) {
483
- const length = files.length;
484
- for (let i = 0; i < length; i++) {
485
- if (parseStringify(newFile) === parseStringify(files[i])) return true;
486
- }
487
- }
488
- return false;
481
+ const files = [...dataState, ...newDataState];
482
+ return files.some(file => ((file === null || file === void 0 ? void 0 : file.FileName) || (file === null || file === void 0 ? void 0 : file.name)) === ((newFile === null || newFile === void 0 ? void 0 : newFile.FileName) || (newFile === null || newFile === void 0 ? void 0 : newFile.name)) && ((file === null || file === void 0 ? void 0 : file.FileSize) || (file === null || file === void 0 ? void 0 : file.size)) === ((newFile === null || newFile === void 0 ? void 0 : newFile.FileSize) || (newFile === null || newFile === void 0 ? void 0 : newFile.size)));
483
+ // const files = allNewAttached.getAll('files');
484
+ // if (files && files.length) {
485
+ // const length = files.length;
486
+ // for (let i = 0; i < length; i++) {
487
+ // if (parseStringify(newFile) === parseStringify(files[i])) return true;
488
+ // }
489
+ // }
490
+ // return false;
489
491
  };
492
+
490
493
  const checkAcceptFileType = newFile => {
491
494
  if (!accept || !accept.length) return true;
492
495
  const type = typeof accept === 'string' ? accept : accept.join('-');
@@ -682,14 +685,17 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
682
685
  document.removeEventListener('keydown', onKeyDown);
683
686
  document.removeEventListener('click', clickOutOfItem);
684
687
  };
685
- const parseStringify = fileInfo => JSON.stringify({
686
- lastModified: fileInfo.lastModified,
687
- lastModifiedDate: fileInfo.lastModifiedDate,
688
- name: fileInfo.name,
689
- size: fileInfo.size,
690
- type: fileInfo.type,
691
- webkitRelativePath: fileInfo.webkitRelativePath
692
- });
688
+
689
+ // const parseStringify = fileInfo =>
690
+ // JSON.stringify({
691
+ // lastModified: fileInfo.lastModified,
692
+ // lastModifiedDate: fileInfo.lastModifiedDate,
693
+ // name: fileInfo.name,
694
+ // size: fileInfo.size,
695
+ // type: fileInfo.type,
696
+ // webkitRelativePath: fileInfo.webkitRelativePath,
697
+ // });
698
+
693
699
  const mountDomain = item => {
694
700
  if (!item) return item;
695
701
  const cloneItem = JSON.parse(JSON.stringify(item));
@@ -777,6 +783,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
777
783
  }
778
784
  };
779
785
  }, [data]);
786
+ useEffect(() => {
787
+ setNewDataState([]);
788
+ }, [dataState]);
780
789
  useEffect(() => {
781
790
  if (inputProps && Object.keys(inputProps).length) {
782
791
  Object.keys(inputProps).forEach(name => {
@@ -1299,6 +1308,7 @@ Attachment.defaultProps = {
1299
1308
  fileType: getGlobal(['errorDefault', 'fileType']),
1300
1309
  existingFile: getGlobal(['errorDefault', 'existingFile'])
1301
1310
  },
1311
+ viewType: 'detail',
1302
1312
  ...getGlobal(['components', 'attachment', 'defaultProps'])
1303
1313
  };
1304
1314
  Attachment.propTypes = {
@@ -33,6 +33,16 @@ const convertData = (dt, valueExpr) => {
33
33
  valueTemp = valueTemp.map(i => i[valueExpr] || i);
34
34
  return valueTemp;
35
35
  };
36
+ const convertSearchDelayTime = searchDelayTime => {
37
+ var _searchDelayTime$matc, _searchDelayTime$matc2;
38
+ if (searchDelayTime === true) return getGlobal('delayOnInput');
39
+ const units = {
40
+ m: 60000,
41
+ s: 1000,
42
+ ms: 1
43
+ };
44
+ return typeof searchDelayTime === 'number' ? searchDelayTime : (((_searchDelayTime$matc = searchDelayTime.match(/[^a-z]+/i)) === null || _searchDelayTime$matc === void 0 ? void 0 : _searchDelayTime$matc[0]) || 1) * units[((_searchDelayTime$matc2 = searchDelayTime.match(/ms|s|m/i)) === null || _searchDelayTime$matc2 === void 0 ? void 0 : _searchDelayTime$matc2[0]) || 's'];
45
+ };
36
46
  const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
37
47
  action = {},
38
48
  allowSearch,
@@ -86,6 +96,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
86
96
  if (!reference) reference = useRef(null);
87
97
  if (multiple && selectBox === undefined) selectBox = true;
88
98
  if (typeof searchExpr === 'string') searchExpr = [searchExpr];
99
+ searchDelayTime = convertSearchDelayTime(searchDelayTime);
89
100
  const ref = useRef(null);
90
101
  const dropdownRef = useRef(null);
91
102
  const timer = useRef(null);
@@ -96,7 +107,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
96
107
  const dropdownListRef = useRef(null);
97
108
  const searchRef = useRef(null);
98
109
  // const lastSearchRef = useRef(null);
99
- const timeout = useRef(null);
110
+ // const timeout = useRef(null);
100
111
  const loadMoreTimer = useRef(null);
101
112
  const dataChosen = useRef([]);
102
113
  const [unique] = useState(randomString(6, {
@@ -382,12 +393,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
382
393
  // if (handleRenderBySearch(data, pattern)) continue;
383
394
  // } else if (pattern && !new RegExp(pattern).test(displayText.normalize())) continue;
384
395
 
385
- if (renderItem && typeof renderItem === 'function') {
386
- displayText = renderItem({
387
- data,
388
- index
389
- });
390
- } else if (subText) {
396
+ if (subText) {
391
397
  displayText = jsx(Fragment, null, jsx(Typography, {
392
398
  className: 'DGN-UI-Dropdown-PrimaryText',
393
399
  type: 'p1'
@@ -403,7 +409,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
403
409
  const value = typeof data === 'object' ? data[valueExpr] : data;
404
410
  let itemDisabled = typeof data === 'object' ? data['disabled'] : false;
405
411
  const icon = getIconFromData(data);
406
- const text = jsx(Typography, {
412
+ const text = renderItem && typeof renderItem === 'function' ? renderItem({
413
+ data,
414
+ index
415
+ }) : jsx(Typography, {
407
416
  type: 'p1'
408
417
  }, displayText);
409
418
  if (multiple && selectBox) {
@@ -961,11 +970,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
961
970
  }, content);
962
971
  if (typeof renderSelectedItem === 'function') {
963
972
  inputRef.current.innerHTML = '';
964
- const item = renderContent(renderSelectedItem({
973
+ const item = renderSelectedItem({
965
974
  data
966
- }));
975
+ });
967
976
  const el = document.createElement('div');
968
977
  el.style.display = 'flex';
978
+ el.style.width = '100%';
969
979
  el.style.minHeight = '24px';
970
980
  if (!multilineSelectedItem) el.style.maxHeight = '24px';
971
981
  ReactDOM.render(item, inputRef.current.appendChild(el));
@@ -1044,21 +1054,26 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1044
1054
  closeDropdown();
1045
1055
  };
1046
1056
  }, []);
1047
- useEffect(() => {
1048
- if (searchDelayTime) {
1049
- var _searchDelayTime$matc, _searchDelayTime$matc2;
1050
- if (searchDelayTime === true) searchDelayTime = getGlobal('delayOnInput');
1051
- const units = {
1052
- m: 60000,
1053
- s: 1000,
1054
- ms: 1
1055
- };
1056
- timeout.current = typeof searchDelayTime === 'number' ? searchDelayTime : (((_searchDelayTime$matc = searchDelayTime.match(/[^a-z]+/i)) === null || _searchDelayTime$matc === void 0 ? void 0 : _searchDelayTime$matc[0]) || 1) * units[((_searchDelayTime$matc2 = searchDelayTime.match(/ms|s|m/i)) === null || _searchDelayTime$matc2 === void 0 ? void 0 : _searchDelayTime$matc2[0]) || 's'];
1057
- return () => {
1058
- timeout.current = null;
1059
- };
1060
- }
1061
- }, [searchDelayTime]);
1057
+
1058
+ // useEffect(() => {
1059
+ // if (searchDelayTime) {
1060
+ // if (searchDelayTime === true) searchDelayTime = getGlobal('delayOnInput');
1061
+ // const units = {
1062
+ // m: 60000,
1063
+ // s: 1000,
1064
+ // ms: 1,
1065
+ // };
1066
+ // timeout.current =
1067
+ // typeof searchDelayTime === 'number'
1068
+ // ? searchDelayTime
1069
+ // : (searchDelayTime.match(/[^a-z]+/i)?.[0] || 1) *
1070
+ // units[searchDelayTime.match(/ms|s|m/i)?.[0] || 's'];
1071
+ // return () => {
1072
+ // timeout.current = null;
1073
+ // };
1074
+ // }
1075
+ // }, [searchDelayTime]);
1076
+
1062
1077
  useEffect(() => {
1063
1078
  if (allValue[unique][allValue[unique].length - 1] !== valueProp) {
1064
1079
  allValue[unique].push(valueProp);
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
4
4
  import PropTypes from 'prop-types';
5
5
  import React, { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
6
6
  import { displayFlex, flexCol, flexRow, parseWidth, positionRelative, typographyTypes } from "../../styles/general";
7
- import { classNames, randomString } from "../../utils";
7
+ import { classNames } from "../../utils";
8
8
  import TabContext from "./context";
9
9
  const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
10
  action = {},
@@ -23,10 +23,6 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
23
23
  value
24
24
  } = props;
25
25
  const [tabIndexState, setTabIndexState] = useState(tabIndex || value);
26
- const [id] = useState(randomString(6, {
27
- allowNumber: false,
28
- allowSymbol: false
29
- }));
30
26
  if (level === 'level1') level = 'h3';
31
27
  if (level === 'level2') level = 'p1';
32
28
  const _TabContainerCSS = TabContainerCSS(direction, width);
@@ -47,7 +43,6 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
47
43
  return jsx("div", {
48
44
  css: _TabContainerCSS,
49
45
  ref: ref,
50
- id: `DGN-${id}-tab-button-container`,
51
46
  className: classNames('DGN-UI-Tab-Container', className),
52
47
  style: style,
53
48
  ...props
@@ -93,9 +88,5 @@ TabContainer.propTypes = {
93
88
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
94
89
  /** Any props else. */
95
90
  props: PropTypes.any
96
- /**
97
- * Ref methods.
98
- */
99
91
  };
100
-
101
92
  export default TabContainer;
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
4
4
  import { ButtonIcon } from "./..";
5
5
  import PropTypes from 'prop-types';
6
6
  import React, { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef, useState } from 'react';
7
- import { boxBorder, displayFlex, displayNone, flexCol, flexRow, justifyCenter, mg, overflowHidden, parseMaxWidth, parseWidth, parseWidthHeight, pd, positionRelative, selfCenter, whiteSpaceNoWrap } from "../../styles/general";
7
+ import { boxBorder, displayFlex, displayNone, flexCol, flexRow, justifyCenter, mg, overflowHidden, parseWidth, parseWidthHeight, pd, positionRelative, selfCenter, whiteSpaceNoWrap } from "../../styles/general";
8
8
  import { classNames } from "../../utils";
9
9
  import TabContext from "./context";
10
10
  const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
@@ -50,11 +50,10 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
50
50
  return useMemo(() => {
51
51
  return jsx("div", {
52
52
  css: _ContainerCSS,
53
- id: `DGN-control`,
54
53
  className: classNames('DGN-UI-Tab-Header-Container', className),
55
54
  style: style,
56
55
  ...props
57
- }, scrollButtons && !isVertical && jsx(ButtonIcon, {
56
+ }, scrollButtons && !isVertical ? jsx(ButtonIcon, {
58
57
  css: ScrollLeftButtonCSS,
59
58
  name: isVertical ? 'ArrowUp' : 'ArrowLeft',
60
59
  viewType: 'text',
@@ -62,7 +61,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
62
61
  viewBox: true,
63
62
  disabled: !showScrollLeftButton,
64
63
  onClick: () => _onClickScrollButton(true)
65
- }), jsx("div", {
64
+ }) : null, jsx("div", {
66
65
  css: [_TabHeaderCSS, !isVertical && TabHeaderHorizontalCSS],
67
66
  className: 'DGN-UI-Tab-Header',
68
67
  ref: ref,
@@ -72,7 +71,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
72
71
  }
73
72
  }, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
74
73
  level
75
- }))), scrollButtons && !isVertical && jsx(ButtonIcon, {
74
+ }))), scrollButtons && !isVertical ? jsx(ButtonIcon, {
76
75
  css: ScrollRightButtonCSS,
77
76
  name: isVertical ? 'ArrowDown' : 'ArrowRight',
78
77
  viewType: 'text',
@@ -80,7 +79,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
80
79
  viewBox: true,
81
80
  disabled: !showScrollRightButton,
82
81
  onClick: () => _onClickScrollButton(false)
83
- }));
82
+ }) : null);
84
83
  }, [centered, children, className, level, props, scrollButtons, style, width, direction, isVertical, scrollLeft]);
85
84
  }));
86
85
  const ContainerCSS = (centered, isVertical, width) => css`
@@ -91,7 +90,6 @@ const ContainerCSS = (centered, isVertical, width) => css`
91
90
  ${parseWidthHeight(width, 'auto')};
92
91
  ${centered && justifyCenter};
93
92
  ${isVertical ? flexCol : flexRow};
94
- ${parseMaxWidth(isVertical ? 'max-content' : '100%')};
95
93
  ${pd(0)};
96
94
  `;
97
95
  const TabHeaderCSS = width => css`
@@ -100,6 +98,7 @@ const TabHeaderCSS = width => css`
100
98
  ${parseWidth(width)};
101
99
  `;
102
100
  const TabHeaderHorizontalCSS = css`
101
+ ${displayFlex};
103
102
  ${flexRow};
104
103
  ${positionRelative};
105
104
  ${whiteSpaceNoWrap};
@@ -142,9 +141,5 @@ TabHeader.propTypes = {
142
141
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
143
142
  /** Any props else. */
144
143
  props: PropTypes.any
145
- /**
146
- * Ref methods.
147
- */
148
144
  };
149
-
150
145
  export default TabHeader;
@@ -23,8 +23,8 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
23
23
  const [isRendered, setIsRendered] = useState(false);
24
24
  const ref = useRef(null);
25
25
  const isVertical = direction === 'vertical';
26
- const isActive = index === tabIndexState;
27
- const _TabPanelCSS = TabPanelCSS(isVertical, isActive);
26
+ const isSelected = index === tabIndexState;
27
+ const _TabPanelCSS = TabPanelCSS(isVertical, isSelected);
28
28
  useEffect(() => {
29
29
  if (isRendered) return;else if (index === tabIndexState) setIsRendered(true);
30
30
  }, [tabIndexState]);
@@ -42,23 +42,20 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
42
42
  return jsx("div", {
43
43
  css: _TabPanelCSS,
44
44
  ref: ref,
45
- role: 'tab-panel',
46
- "aria-labelledby": `tab-${index}`,
47
- id: `tab-panel-${index}`,
48
45
  className: classNames('DGN-UI-Tab-Panel', className),
49
46
  style: style,
50
47
  ...props
51
- }, isActive || !lazyLoading || isRendered ? children : null);
52
- }, [children, className, index, lazyLoading, props, style, isActive, isRendered, tabIndexState]);
48
+ }, isSelected || !lazyLoading || isRendered ? children : null);
49
+ }, [children, className, index, lazyLoading, props, style, isSelected, isRendered, tabIndexState]);
53
50
  }));
54
- const TabPanelCSS = (isVertical, isActive) => css`
51
+ const TabPanelCSS = (isVertical, isSelected) => css`
55
52
  ${displayFlex};
56
53
  ${flexCol};
57
54
  ${boxBorder};
58
55
  ${positionRelative};
59
- ${isActive ? flexCol : displayNone};
56
+ ${isSelected ? flexCol : displayNone};
60
57
  ${parseWidthHeight('100%', isVertical ? 300 : '100%')};
61
- ${textColor('text.main')};
58
+ ${textColor('text/main')};
62
59
  ${pd([0, isVertical ? 3 : 2.5])};
63
60
  `;
64
61
  TabPanel.defaultProps = {
@@ -79,9 +76,5 @@ TabPanel.propTypes = {
79
76
  style: PropTypes.object,
80
77
  /** Any props else. */
81
78
  props: PropTypes.any
82
- /**
83
- * Ref methods.
84
- */
85
79
  };
86
-
87
80
  export default TabPanel;
@@ -5,7 +5,7 @@ import { Icon, Typography } from "./..";
5
5
  import Ripple from "../button/ripple-effect";
6
6
  import PropTypes from 'prop-types';
7
7
  import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
8
- import { bgColor, bgTransparent, borderRadius, boxBorder, breakWord, cursorDefault, cursorPointer, displayFlex, flexRow, itemsCenter, justifyCenter, justifyStart, mgl, mgr, outlineNone, overflowHidden, parseHeight, parseMaxWidth, parseMaxWidthHeight, parseMinWidth, parseWidth, pd, pointerEventsAuto, pointerEventsNone, positionAbsolute, positionRelative, shadowNone, textCenter, textColor, userSelectNone, whiteSpaceNoWrap } from "../../styles/general";
8
+ import { bgColor, borderRadius, bottom, boxBorder, breakWord, cursorDefault, cursorPointer, displayFlex, flexRow, itemsCenter, justifyCenter, justifyStart, left, mgl, mgr, outlineNone, overflowHidden, parseHeight, parseMaxWidth, parseMaxWidthHeight, parseMinWidth, parseWidth, pd, pointerEventsAuto, pointerEventsNone, positionAbsolute, positionRelative, shadowNone, textCenter, textColor, userSelectNone, whiteSpaceNoWrap } from "../../styles/general";
9
9
  import { classNames } from "../../utils";
10
10
  import TabContext from "./context";
11
11
  const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
@@ -59,8 +59,7 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
59
59
  });
60
60
  }
61
61
  return jsx("span", {
62
- css: IconCSS,
63
- className: isEndIcon ? 'end-icon' : ''
62
+ css: [IconCSS, isEndIcon && EndIconCSS]
64
63
  }, node);
65
64
  };
66
65
  return useMemo(() => {
@@ -100,7 +99,6 @@ const TabItemCSS = (color, isVertical) => css`
100
99
  ${whiteSpaceNoWrap};
101
100
  ${shadowNone};
102
101
  ${!isVertical && textCenter};
103
- ${bgColor('system.white')};
104
102
  ${textColor(color)};
105
103
  ${parseMinWidth(80)};
106
104
  ${parseMaxWidth(isVertical ? '100%' : 287)};
@@ -108,29 +106,26 @@ const TabItemCSS = (color, isVertical) => css`
108
106
  ${pointerEventsAuto};
109
107
  ${userSelectNone};
110
108
  flex: 0 0 auto;
111
- border: 0;
112
109
  transition: all 0.2s ease-in-out, background-color 0.2s ease-in-out;
113
110
  :hover:not(.selected):not(.disabled),
114
111
  :focus {
115
- ${bgColor('system.white')};
116
- ${textColor('system.rest')};
112
+ ${textColor('system/rest')};
117
113
  .Indicator {
118
- ${bgColor('system.rest')};
114
+ ${bgColor('system/rest')};
119
115
  transform: scale(1);
120
116
  }
121
117
  }
122
118
  `;
123
119
  const TabItemDisabledCSS = css`
124
120
  ${pointerEventsNone};
125
- ${bgTransparent};
126
121
  ${cursorDefault};
127
- ${textColor('system.disabled')};
122
+ ${bgColor('transparent')};
123
+ ${textColor('system/disabled')};
128
124
  `;
129
125
  const TabItemSelectedCSS = css`
130
- ${bgColor('system.white')};
131
- ${textColor('system.active')};
126
+ ${textColor('system/active')};
132
127
  .Indicator {
133
- ${bgColor('system.active')};
128
+ ${bgColor('system/active')};
134
129
  transform: scale(1);
135
130
  }
136
131
  `;
@@ -139,12 +134,13 @@ const IndicatorCSS = isVertical => css`
139
134
  ${parseHeight(isVertical ? '100%' : 4)};
140
135
  ${parseWidth(isVertical ? 4 : '100%')}
141
136
  ${borderRadius(1)};
142
- bottom: 0;
143
- left: 0;
137
+ ${bottom(0)};
138
+ ${left(0)};
144
139
  transform: ${isVertical ? 'scaleY(0)' : 'scaleX(0)'};
145
140
  transition: transform 0.2s ease-in-out;
146
141
  `;
147
142
  const IconCSS = css`
143
+ ${displayFlex};
148
144
  ${flexRow};
149
145
  ${itemsCenter};
150
146
  ${justifyCenter};
@@ -152,14 +148,14 @@ const IconCSS = css`
152
148
  ${boxBorder};
153
149
  ${parseMaxWidthHeight(24)};
154
150
  ${mgr([1])};
155
- &.end-icon {
156
- ${mgr('unset')};
157
- ${mgl([1])};
158
- }
151
+ `;
152
+ const EndIconCSS = css`
153
+ ${mgr('unset')};
154
+ ${mgl([1])};
159
155
  `;
160
156
  TabItem.defaultProps = {
161
157
  className: '',
162
- color: 'system.rest',
158
+ color: 'system/rest',
163
159
  disabled: false,
164
160
  label: '',
165
161
  style: {}
@@ -189,9 +185,5 @@ TabItem.propTypes = {
189
185
  style: PropTypes.object,
190
186
  /** Any props else. */
191
187
  props: PropTypes.any
192
- /**
193
- * Ref methods.
194
- */
195
188
  };
196
-
197
189
  export default TabItem;
package/package.json CHANGED
@@ -1,42 +1,73 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.98",
4
- "description": "The DigiNet core ui",
5
- "homepage": "https://diginet.com.vn",
3
+ "version": "1.3.99-beta.1",
4
+ "description": "",
6
5
  "main": "index.js",
6
+ "license": "UNLICENSED",
7
7
  "scripts": {
8
- "start-js": "react-scripts start --max_old_space_size=4096",
9
- "start": "npx npm-run-all -p start-js",
10
- "build": "GENERATE_SOURCEMAP=false && react-scripts build --env=production --max_old_space_size=8192",
11
- "eject": "react-scripts eject",
12
- "test": "echo \"Error: no test specified\" && exit 1"
8
+ "start": "npm-run-all --parallel start-sb eslint-test",
9
+ "start-sb": "start-storybook -p 9050",
10
+ "build-storybook": "build-storybook -c .storybook -s src",
11
+ "build": "run-script-os",
12
+ "build:windows": "rimraf dist && mkdirp dist/components && npm run compile && sass --style=compressed src/scss:dist/css && xcopy src\\\\assets dist\\\\assets\\ /e /y",
13
+ "build:darwin:linux:default": "rm -rf dist && npm run compile && sass --style=compressed src/scss:dist/css && cp -rf src/assets dist/assets",
14
+ "compile": "babel src --out-dir dist --ignore **/*.stories.js",
15
+ "pack": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm pack",
16
+ "production-keep-version": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish",
17
+ "beta": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish --tag beta",
18
+ "production": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm publish",
19
+ "version:add": "run-script-os",
20
+ "version:add:windows": "cat package.json.tmp | sed \"s/0.0.0/%npm_package_version%/g\" > dist/package.json",
21
+ "version:add:darwin:linux:default": "VERSION=$(npm run version:extract --silent) && cat package.json.tmp | sed \"s/0.0.0/${VERSION}/g\" > dist/package.json",
22
+ "version:bump": "npm version patch --no-git-tag-version --silent",
23
+ "version:extract": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'",
24
+ "test": "echo \"Error: no test specified\" && exit 1",
25
+ "lint": "eslint --fix --config .eslintrc.js \"**/*.js\"",
26
+ "eslint-test": "onchange \"src/**/*.{js,jsx,json}\" -- eslint . --fix",
27
+ "test-storybook": "test-storybook --url http://localhost:9050"
13
28
  },
14
29
  "dependencies": {
15
30
  "@emotion/core": "^10.0.35",
31
+ "babel-plugin-module-resolver": "^4.1.0",
16
32
  "prop-types": "^15.7.2"
17
33
  },
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://diginetvn@bitbucket.org/diginetvn/diginet-core-ui.git"
34
+ "lint-staged": {
35
+ "*/**/*.{js,jsx,json}": [
36
+ "prettier --write",
37
+ "git add"
38
+ ]
21
39
  },
22
- "keywords": [
23
- "core ui",
24
- "diginet"
25
- ],
26
- "author": "rocachien",
27
- "contributors": [
28
- {
29
- "name": "Chien Do",
30
- "email": "rocachien@gmail.com"
31
- },
32
- {
33
- "name": "Nhat Tran",
34
- "email": "tranminhnhat1005@gmail.com"
35
- },
36
- {
37
- "name": "Thuan Nguyen",
38
- "email": "nt.thuan.hutech@gmail.com"
39
- }
40
- ],
41
- "license": "MIT"
40
+ "devDependencies": {
41
+ "@babel/cli": "^7.14.3",
42
+ "@babel/plugin-proposal-class-properties": "^7.13.0",
43
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.16.0",
44
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
45
+ "@babel/plugin-proposal-optional-chaining": "^7.14.2",
46
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
47
+ "@babel/plugin-proposal-private-property-in-object": "^7.18.6",
48
+ "@babel/preset-react": "^7.13.13",
49
+ "@storybook/addon-actions": "6.2.9",
50
+ "@storybook/addon-essentials": "6.2.9",
51
+ "@storybook/addon-links": "6.2.9",
52
+ "@storybook/addon-postcss": "^2.0.0",
53
+ "@storybook/react": "6.2.9",
54
+ "@storybook/test-runner": "^0.7.1",
55
+ "autoprefixer": "^10.3.1",
56
+ "babel-loader": "^8.2.2",
57
+ "eslint": "^8.4.1",
58
+ "eslint-plugin-react": "^7.27.1",
59
+ "eslint-plugin-regex": "^1.10.0",
60
+ "husky": "^7.0.4",
61
+ "jest": "^27.5.1",
62
+ "lint-staged": "^12.1.2",
63
+ "mkdirp": "^1.0.4",
64
+ "npm-run-all": "^4.1.5",
65
+ "onchange": "^7.1.0",
66
+ "postcss-flexbugs-fixes": "^5.0.2",
67
+ "react": "^17.0.1",
68
+ "react-dom": "^17.0.1",
69
+ "rimraf": "^3.0.2",
70
+ "run-script-os": "^1.1.6",
71
+ "sass": "1.58.3"
72
+ }
42
73
  }
package/readme.md CHANGED
@@ -38,6 +38,12 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.3.99
42
+ - \[Changed\]: Typography – Add new text style
43
+ - \[Fixed\]: Tab – Fix background UI not match design
44
+ - \[Fixed\]: Dropdown – Fix case renderItem, renderSelectedItem inside Typography
45
+ - \[Fixed\]: Attachment – Fix bug not reset new upload data
46
+
41
47
  ## 1.3.98
42
48
  - \[Changed\]: Image – Change default image
43
49
  - \[Changed\]: Icon – Update Image, Another, Compressed, Presentation, Sheet, Word, PDF
package/styles/general.js CHANGED
@@ -10,10 +10,10 @@ export const alphaPseudo = {
10
10
  };
11
11
  export const typographyTypes = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
12
12
 
13
- /**
14
- * get value spacing with rootZIndex
15
- * @param number
16
- * @return {number}
13
+ /**
14
+ * get value spacing with rootZIndex
15
+ * @param number
16
+ * @return {number}
17
17
  */
18
18
  export const zIndex = number => {
19
19
  number = Number(number || 0);
@@ -21,10 +21,10 @@ export const zIndex = number => {
21
21
  return rootZIndex + number;
22
22
  };
23
23
 
24
- /**
25
- * get value spacing with rootSpacing
26
- * @param {(number|number[])} vl - default 1
27
- * @returns {(number|string)}
24
+ /**
25
+ * get value spacing with rootSpacing
26
+ * @param {(number|number[])} vl - default 1
27
+ * @returns {(number|string)}
28
28
  */
29
29
 
30
30
  export const getSpacing = (vl = 1) => {
@@ -34,9 +34,9 @@ export const getSpacing = (vl = 1) => {
34
34
  } else return vl;
35
35
  };
36
36
 
37
- /**
38
- * replace rootZIndex
39
- * @param number
37
+ /**
38
+ * replace rootZIndex
39
+ * @param number
40
40
  */
41
41
  export const setZIndex = number => {
42
42
  number = Number(number || 0);
@@ -51,6 +51,9 @@ const animation = ({
51
51
  }) => css`
52
52
  animation: ${keyframes} ${duration} ${timingFunction};
53
53
  `;
54
+ const aspectSquare = css`
55
+ aspect-ratio: 1 / 1;
56
+ `;
54
57
  const bgColor = cl => css`
55
58
  background-color: ${getColor(cl)};
56
59
  `;
@@ -90,6 +93,9 @@ const borderRadius4px = css`
90
93
  const borderRadius50 = css`
91
94
  border-radius: 50%;
92
95
  `;
96
+ const borderRight = (withVl, colorVl) => css`
97
+ border-right: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
98
+ `;
93
99
  const borderTop = (withVl, colorVl) => css`
94
100
  border-top: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
95
101
  `;
@@ -481,4 +487,4 @@ const whiteSpacePreWrap = css`
481
487
  const z = vl => css`
482
488
  z-index: ${zIndex(vl)};
483
489
  `;
484
- export { animation, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
490
+ export { animation, aspectSquare, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderRight, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
@@ -13,9 +13,12 @@ const fontNormal = css`
13
13
  const fontWeightBold = css`
14
14
  font-weight: 700;
15
15
  `;
16
- const fontWeightRegular = css`
16
+ const fontWeightMedium = css`
17
17
  font-weight: 500;
18
18
  `;
19
+ const fontWeightRegular = css`
20
+ font-weight: 400;
21
+ `;
19
22
  const fontWeightNormal = css`
20
23
  font-weight: normal;
21
24
  `;
@@ -28,7 +31,7 @@ const getFontSize = size => css`
28
31
  const title1 = css`
29
32
  ${fontNormal};
30
33
  ${fontWeightBold};
31
- ${getFontSize(parseInt(fontSize) + 16)}; //32
34
+ ${getFontSize(parseInt(fontSize) + 12)}; //28
32
35
  `;
33
36
  const title2 = css`
34
37
  ${fontNormal};
@@ -72,22 +75,52 @@ const heading5 = css`
72
75
  `;
73
76
  const heading6 = css`
74
77
  ${fontNormal};
75
- ${fontWeightRegular}
78
+ ${fontWeightMedium};
76
79
  ${getFontSize(parseInt(fontSize) - 4)}; //12
77
80
  `;
81
+ const body1 = css`
82
+ ${fontNormal};
83
+ ${fontWeightRegular};
84
+ ${getFontSize(parseInt(fontSize) + 12)}; //28
85
+ `;
86
+ const body2 = css`
87
+ ${fontNormal};
88
+ ${fontWeightRegular};
89
+ ${getFontSize(parseInt(fontSize) + 10)}; //26
90
+ `;
91
+ const body3 = css`
92
+ ${fontNormal};
93
+ ${fontWeightRegular};
94
+ ${getFontSize(parseInt(fontSize) + 8)}; //24
95
+ `;
96
+ const body4 = css`
97
+ ${fontNormal};
98
+ ${fontWeightRegular};
99
+ ${getFontSize(parseInt(fontSize) + 6)}; //22
100
+ `;
101
+ const body5 = css`
102
+ ${fontNormal};
103
+ ${fontWeightRegular};
104
+ ${getFontSize(parseInt(fontSize) + 4)}; //20
105
+ `;
106
+ const body6 = css`
107
+ ${fontNormal};
108
+ ${fontWeightRegular};
109
+ ${getFontSize(parseInt(fontSize) + 2)}; //18
110
+ `;
78
111
  const paragraph1 = css`
79
112
  ${fontNormal};
80
- ${fontWeightNormal};
113
+ ${fontWeightRegular};
81
114
  ${getFontSize(parseInt(fontSize))}; //16
82
115
  `;
83
116
  const paragraph2 = css`
84
117
  ${fontNormal};
85
- ${fontWeightNormal};
118
+ ${fontWeightRegular};
86
119
  ${getFontSize(parseInt(fontSize) - 2)}; //14
87
120
  `;
88
121
  const paragraph3 = css`
89
122
  ${fontNormal};
90
- ${fontWeightNormal};
123
+ ${fontWeightRegular};
91
124
  ${getFontSize(parseInt(fontSize) - 4)}; //12
92
125
  `;
93
126
  const uppercase = css`
@@ -101,7 +134,7 @@ const helperText = css`
101
134
  font-size: ${parseInt(fontSize) - 4}px; //12
102
135
  ${fontWeightNormal}
103
136
  `;
104
- export const typography = [[title1, ['title1', 't1']], [title2, ['title2', 't2']], [title3, ['title3', 't3']], [title4, ['title4', 't4']], [heading1, ['heading1', 'h1']], [heading2, ['heading2', 'h2']], [heading3, ['heading3', 'h3']], [heading4, ['heading4', 'h4']], [heading5, ['heading5', 'h5']], [heading6, ['heading6', 'h6']], [paragraph1, ['paragraph1', 'p1']], [paragraph2, ['paragraph2', 'p2']], [paragraph3, ['paragraph3', 'p3']], [uppercase, ['uppercase']], [label, ['label']], [helperText, ['helperText']]].reduce((obj, [value, keys]) => {
137
+ export const typography = [[title1, ['title1', 't1']], [title2, ['title2', 't2']], [title3, ['title3', 't3']], [title4, ['title4', 't4']], [heading1, ['heading1', 'h1']], [heading2, ['heading2', 'h2']], [heading3, ['heading3', 'h3']], [heading4, ['heading4', 'h4']], [heading5, ['heading5', 'h5']], [heading6, ['heading6', 'h6']], [body1, ['body1', 'b1']], [body2, ['body2', 'b2']], [body3, ['body3', 'b3']], [body4, ['body4', 'b4']], [body5, ['body5', 'b5']], [body6, ['body6', 'b6']], [paragraph1, ['paragraph1', 'p1']], [paragraph2, ['paragraph2', 'p2']], [paragraph3, ['paragraph3', 'p3']], [uppercase, ['uppercase']], [label, ['label']], [helperText, ['helperText']]].reduce((obj, [value, keys]) => {
105
138
  for (const key of keys) {
106
139
  obj = {
107
140
  ...obj,