diginet-core-ui 1.3.54 → 1.3.55

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.
@@ -0,0 +1,8 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9 0C4.03 0 0 4.03 0 9C0 13.97 4.03 18 9 18C13.97 18 18 13.97 18 9C17.99 4.03 13.96 0 9 0ZM9.67 13.54V15.07H8.21V13.64C7.21 13.61 6.25 13.33 5.68 13.02L6.13 11.28C6.75 11.62 7.63 11.93 8.6 11.93C9.45 11.93 10.04 11.59 10.04 11.01C10.04 10.44 9.55 10.09 8.45 9.72C6.85 9.18 5.77 8.43 5.77 6.99C5.77 5.67 6.69 4.64 8.28 4.34V2.93H9.74V4.24C10.74 4.27 11.41 4.49 11.91 4.73L11.46 6.41C11.09 6.23 10.39 5.89 9.32 5.89C8.35 5.89 8.04 6.32 8.04 6.74C8.04 7.22 8.56 7.54 9.82 8C11.6 8.63 12.3 9.44 12.3 10.8C12.31 12.12 11.39 13.24 9.67 13.54Z" fill="#FFAA00"/>
3
+ <path d="M9.23009 29.5501C9.24009 31.6701 9.23009 33.7701 9.23009 35.8901V39.0001H2.34009C2.34009 39.0001 2.37009 31.7801 2.38009 29.6701C2.38009 28.5501 2.75009 28.2101 3.91009 28.2001H7.79009C8.82009 28.2001 9.22009 28.5701 9.23009 29.5501Z" fill="#2680EB"/>
4
+ <path d="M18.3601 26.9901C18.3701 29.9701 18.3601 32.9401 18.3601 35.9301V39.0001H11.5101C11.5101 39.0001 11.5001 30.0601 11.5101 27.1201C11.5101 25.9501 11.8701 25.6101 13.0801 25.6101C14.3501 25.6001 15.6101 25.6001 16.8801 25.6101C17.9601 25.6101 18.3501 25.9701 18.3601 26.9901Z" fill="#2680EB"/>
5
+ <path d="M27.4901 23.1301V39.0001H20.6401V23.2601C20.6401 21.9301 20.9401 21.6401 22.3201 21.6401H25.9001C27.1501 21.6501 27.4901 21.9601 27.4901 23.1301Z" fill="#2680EB"/>
6
+ <path d="M36.6301 39.0001H29.7701V16.0901C29.7701 14.7101 30.0501 14.4401 31.4901 14.4401C32.6601 14.4301 33.8201 14.4301 34.9901 14.4401C36.2901 14.4401 36.6201 14.7501 36.6201 15.9701L36.6301 39.0001Z" fill="#2680EB"/>
7
+ <path d="M38.95 8.00006C38.36 5.72006 37.74 3.44006 37.12 1.17006C36.88 0.310064 36.17 -0.149936 35.39 0.0500641C32.84 0.690064 30.51 1.32006 28.27 1.97006C27.83 2.10006 27.49 2.43006 27.35 2.87006C27.19 3.35006 27.28 3.88006 27.59 4.29006C28.02 4.84006 28.64 5.02006 29.44 4.80006L32.6 3.95006C32.58 3.99006 32.55 4.03006 32.52 4.07006C26.96 12.8301 14.59 21.7301 1.69998 21.7901C1.17998 21.7901 0.719982 21.9701 0.409982 22.2801C0.139982 22.5601 -0.0100183 22.9401 -1.83033e-05 23.3601C0.0099817 23.7801 0.169982 24.1601 0.459982 24.4301C0.759982 24.7101 1.16998 24.8501 1.63998 24.8501C1.67998 24.8501 1.71998 24.8501 1.75998 24.8501C2.08998 24.8301 2.42998 24.8201 2.75998 24.8001C3.93998 24.7501 5.14998 24.7001 6.32998 24.4801C18.43 22.2401 28.12 15.9101 35.13 5.65006L35.33 6.40006C35.53 7.16006 35.73 7.91006 35.94 8.66006C36.2 9.55006 37.04 10.0701 37.87 9.84006C38.7 9.62006 39.16 8.82006 38.95 8.00006Z" fill="#FF8C00"/>
8
+ </svg>
@@ -115,38 +115,33 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
115
115
  });
116
116
 
117
117
  const _onClick = event => {
118
+ event.persist();
118
119
  onClick && event.stopPropagation();
119
120
  if (disabled || loading) return;
120
121
  onClick && onClick(event);
121
122
  };
122
123
 
123
124
  return useMemo(() => {
124
- let node = children;
125
-
126
- if (!node) {
127
- node = jsx(Icon, {
128
- name: name,
129
- width: isViewTypeGhost ? width ? _width : iconSize : iconSize,
130
- height: isViewTypeGhost ? height ? _height : iconSize : iconSize,
131
- color: 'currentColor',
132
- viewBox: viewBox
133
- });
134
- }
135
-
136
125
  return jsx("div", {
137
126
  css: _ButtonRootCSS,
138
- style: style,
139
127
  ref: ref,
128
+ id: id,
129
+ style: style,
140
130
  onClick: _onClick,
141
- className: ['DGN-UI-ButtonIcon', viewType, getClassNameFromColor(color), size, loading && 'button-icon--loading', disabled && 'button-icon--disabled', className].join(' ').trim().replace(/\s+/g, ' '),
142
- id: id
131
+ className: ['DGN-UI-ButtonIcon', viewType, getClassNameFromColor(color), size, loading && 'button-icon--loading', disabled && 'button-icon--disabled', className].join(' ').trim().replace(/\s+/g, ' ')
143
132
  }, loading && renderIconLoading(iconSize), !loading && jsx("span", {
144
133
  className: 'DGN-UI-ButtonIcon-Icon'
145
- }, " ", node, " "), !disabled && !loading && viewType !== 'ghost' && jsx(Ripple, {
134
+ }, children || jsx(Icon, {
135
+ name: name,
136
+ width: isViewTypeGhost ? width ? _width : iconSize : iconSize,
137
+ height: isViewTypeGhost ? height ? _height : iconSize : iconSize,
138
+ color: 'currentColor',
139
+ viewBox: viewBox
140
+ })), !disabled && !loading && viewType !== 'ghost' && jsx(Ripple, {
146
141
  color: getRippleColor(color, viewType, allColors),
147
142
  circular: circular
148
143
  }));
149
- }, [style, className, size, viewType, color, colorHover, disabled, name, children, onClick, loading, circular, viewBox, width, height]);
144
+ }, [id, style, className, size, viewType, color, colorHover, disabled, name, children, onClick, loading, circular, viewBox, width, height]);
150
145
  }));
151
146
 
152
147
  const ButtonRootCSS = (circular, size, width, _width, height, _height, buttonSize, iconSize, colorHover, color, _color, name) => css`
@@ -201,7 +196,7 @@ const ButtonRootCSS = (circular, size, width, _width, height, _height, buttonSiz
201
196
  &.outlined {
202
197
  ${backgroundTransparent};
203
198
  &.default {
204
- ${border(1, rest)}
199
+ ${border(1, rest)};
205
200
  color: ${rest};
206
201
  &.button-icon--loading,
207
202
  &:hover,
@@ -348,17 +343,35 @@ ButtonIcon.defaultProps = {
348
343
  viewBox: true
349
344
  };
350
345
  ButtonIcon.propTypes = {
351
- /** used to fill background for button */
352
- viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
346
+ /** The content of the component. */
347
+ children: PropTypes.node,
353
348
 
354
- /** color for button */
349
+ /** If `true`, component is circular. */
350
+ circular: PropTypes.bool,
351
+
352
+ /** Class for component. */
353
+ className: PropTypes.string,
354
+
355
+ /** The color of the component. */
355
356
  color: PropTypes.string,
356
357
 
357
- /** custom hover color for button with color 'default' */
358
+ /** Custom hover color for button with color 'default'. */
358
359
  colorHover: PropTypes.string,
359
360
 
361
+ /** If `true`, the component is disabled. */
362
+ disabled: PropTypes.bool,
363
+
364
+ /** Height oof the component. */
365
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
366
+
367
+ /** If `true`, the loading indicator is shown. */
368
+ loading: PropTypes.bool,
369
+
370
+ /** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
371
+ name: PropTypes.string,
372
+
360
373
  /**
361
- * size of button
374
+ * The size of the component.
362
375
  *
363
376
  * * tiny (button 24px, icon 16px)
364
377
  * * small (button 32px, icon 20px)
@@ -368,38 +381,20 @@ ButtonIcon.propTypes = {
368
381
  * */
369
382
  size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
370
383
 
371
- /** name of icon in icons store */
372
- name: PropTypes.string,
373
-
374
- /** the class for button */
375
- className: PropTypes.string,
376
-
377
- /** the width of button */
378
- width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
379
-
380
- /** the height of button */
381
- height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
384
+ /** Style inline of component. */
385
+ style: PropTypes.object,
382
386
 
383
- /** has view box if true */
387
+ /** If `true`, icon has view box. */
384
388
  viewBox: PropTypes.bool,
385
389
 
386
- /** circle button if true */
387
- circular: PropTypes.bool,
388
-
389
- /** prevent all event if true */
390
- disabled: PropTypes.bool,
391
-
392
- /** style inline of button */
393
- style: PropTypes.object,
394
-
395
- /** element to display in button */
396
- children: PropTypes.node,
390
+ /** The variant to use. */
391
+ viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
397
392
 
398
- /** status loading of button */
399
- loading: PropTypes.bool,
393
+ /** Width of the component. */
394
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
400
395
 
401
396
  /**
402
- * ref methods
397
+ * ref methods (ref.current.instance.*method*)
403
398
  *
404
399
  * * option(): Gets all UI component properties
405
400
  * * Returns value - object
@@ -59,6 +59,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
59
59
  if (!inputBaseRef) inputBaseRef = useRef(null);
60
60
  const ref = useRef(null);
61
61
  const valueArray = useRef([]);
62
+ const isEnabled = !readOnly && !disabled;
62
63
  /* Start styled */
63
64
 
64
65
  const inputBaseRoot = css`
@@ -490,12 +491,12 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
490
491
  if (autoFocus) {
491
492
  inputBaseRef.current.focus();
492
493
  }
493
- }, [multiline]);
494
- useEffect(() => {
495
- if (placeholder !== undefined) {
496
- inputBaseRef.current.placeholder = placeholder;
497
- }
498
- }, [placeholder]);
494
+ }, [multiline]); // useEffect(() => {
495
+ // if (placeholder !== undefined) {
496
+ // inputBaseRef.current.placeholder = placeholder;
497
+ // }
498
+ // }, [placeholder]);
499
+
499
500
  useEffect(() => {
500
501
  const defaultHeight = 24;
501
502
 
@@ -541,7 +542,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
541
542
  ...props
542
543
  }, jsx("textarea", {
543
544
  type: "text",
544
- placeholder: placeholder,
545
+ placeholder: isEnabled ? placeholder : '',
545
546
  defaultValue: defaultValue,
546
547
  ...inputProps,
547
548
  css: textAreaCSS,
@@ -578,7 +579,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
578
579
  })), jsx("input", {
579
580
  type: type,
580
581
  autoComplete: autoComplete,
581
- placeholder: placeholder,
582
+ placeholder: isEnabled ? placeholder : '',
582
583
  defaultValue: defaultValue,
583
584
  ...inputProps,
584
585
  readOnly: readOnly,
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-redeclare */
2
+
1
3
  /** @jsxRuntime classic */
2
4
 
3
5
  /** @jsx jsx */
@@ -16,7 +18,9 @@ const num2WordsVi = function () {
16
18
  let o = '',
17
19
  a = Math.floor(r / 10),
18
20
  e = r % 10;
19
- return a > 1 ? (o = ' ' + t[a] + ' mươi', 1 === e && (o += ' mốt')) : 1 === a ? (o = ' mười', 1 === e && (o += ' một')) : n && e > 0 && (o = ' lẻ'), 5 === e && a >= 1 ? o += ' lăm' : 4 === e && a >= 1 ? o += ' tư' : (e > 1 || 1 === e && 0 === a) && (o += ' ' + t[e]), o;
21
+ return a > 1 ? (o = ' ' + t[a] + ' mươi', 1 === e && (o += ' mốt')) : 1 === a ? (o = ' mười', 1 === e && (o += ' một')) : n && e > 0 && (o = ' lẻ'), 5 === e && a >= 1 ? o += ' lăm' : // : 4 === e && a >= 1
22
+ // ? (o += ' tư')
23
+ (e > 1 || 1 === e && 0 === a) && (o += ' ' + t[e]), o;
20
24
  },
21
25
  n = function (n, o) {
22
26
  var a = '',
@@ -48,9 +52,6 @@ const num2WordsVi = function () {
48
52
  };
49
53
  }();
50
54
 
51
- var a = ['', 'one ', 'two ', 'three ', 'four ', 'five ', 'six ', 'seven ', 'eight ', 'nine ', 'ten ', 'eleven ', 'twelve ', 'thirteen ', 'fourteen ', 'fifteen ', 'sixteen ', 'seventeen ', 'eighteen ', 'nineteen '];
52
- var b = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
53
-
54
55
  const num2WordsEn = n => {
55
56
  const arr = x => Array.from(x);
56
57
 
@@ -104,19 +105,14 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
104
105
  placeholder,
105
106
  startIcon,
106
107
  endIcon,
107
- autoComplete,
108
108
  autoFocus,
109
109
  disabled,
110
110
  readOnly,
111
111
  multiline,
112
- onConfirm,
113
112
  refs,
114
113
  inputRef,
115
114
  inputProps,
116
- iconStyle,
117
115
  inputStyle,
118
- labelProps,
119
- errorProps,
120
116
  error,
121
117
  onChange,
122
118
  onBlur,
@@ -456,7 +452,6 @@ MoneyInput.defaultProps = {
456
452
  viewType: 'underlined',
457
453
  valueTypeReturn: 'number',
458
454
  label: '',
459
- placeholder: '',
460
455
  className: '',
461
456
  error: '',
462
457
  startIcon: '',
@@ -501,9 +496,6 @@ MoneyInput.propTypes = {
501
496
  /** error for input */
502
497
  error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
503
498
 
504
- /** type auto complete of input (like new-password) */
505
- autoComplete: PropTypes.string,
506
-
507
499
  /** icon at start */
508
500
  startIcon: PropTypes.any,
509
501
 
@@ -543,12 +535,6 @@ MoneyInput.propTypes = {
543
535
  /** style inline of input in MoneyInput component */
544
536
  inputStyle: PropTypes.object,
545
537
 
546
- /** any props of label in MoneyInput component */
547
- labelProps: PropTypes.object,
548
-
549
- /** any props of error in MoneyInput component */
550
- errorProps: PropTypes.object,
551
-
552
538
  /** The function to get ref of MoneyInput component */
553
539
  refs: PropTypes.func,
554
540
 
@@ -7,7 +7,6 @@ import { jsx, css } from '@emotion/core';
7
7
  import locale from '../../../locale';
8
8
  import { InputBase, Label, HelperText } from '../..';
9
9
  import { onValidate } from '../../../utils';
10
- import { getGlobal } from '../../../global';
11
10
  /* Start styled */
12
11
 
13
12
  const NumberInputRoot = css`
@@ -309,7 +308,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
309
308
  NumberInput.defaultProps = {
310
309
  viewType: 'underlined',
311
310
  label: '',
312
- placeholder: getGlobal('inputPlaceholder'),
311
+ // placeholder: getGlobal('inputPlaceholder'),
313
312
  error: '',
314
313
  startIcon: '',
315
314
  endIcon: '',
@@ -36,7 +36,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
36
36
  defaultValue,
37
37
  value: valueProp,
38
38
  placeholder,
39
- resize,
40
39
  startIcon,
41
40
  endIcon,
42
41
  startIconProps,
@@ -58,7 +57,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
58
57
  inputProps,
59
58
  inputStyle,
60
59
  labelProps,
61
- errorProps,
62
60
  error,
63
61
  onChange,
64
62
  onBlur,
@@ -109,7 +107,7 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
109
107
  /* Start handler */
110
108
 
111
109
  const onMouseDownHandler = () => {
112
- ref.current.querySelector(`.css-${TextInputBox.name}`).style.backgroundColor = 'transparent';
110
+ // ref.current.querySelector(`.css-${TextInputBox.name}`).style.backgroundColor = 'transparent';
113
111
  inputRef.current.style.backgroundColor = 'transparent';
114
112
  };
115
113
 
@@ -376,10 +374,8 @@ TextInput.defaultProps = {
376
374
  label: '',
377
375
  className: '',
378
376
  defaultValue: '',
379
- placeholder: '',
380
377
  status: 'default',
381
378
  error: '',
382
- resize: 'none',
383
379
  autoComplete: 'off',
384
380
  required: false,
385
381
  loading: false,
@@ -427,9 +423,6 @@ TextInput.propTypes = {
427
423
  /** type auto complete of input (like new-password) */
428
424
  autoComplete: PropTypes.string,
429
425
 
430
- /** allow resize multiline input (resize css style) */
431
- resize: PropTypes.string,
432
-
433
426
  /** prevent all event if true, hide all icon */
434
427
  disabled: PropTypes.bool,
435
428
 
@@ -475,9 +468,6 @@ TextInput.propTypes = {
475
468
  /** any props of label in TextInput component */
476
469
  labelProps: PropTypes.object,
477
470
 
478
- /** any props of error in TextInput component */
479
- errorProps: PropTypes.object,
480
-
481
471
  /** The function to get ref of Dropdown component */
482
472
  refs: PropTypes.func,
483
473
 
@@ -138,7 +138,6 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
138
138
 
139
139
  currentPageRef.current = 0;
140
140
  setItemsPerPageState(per);
141
- setCurrentPageState(0);
142
141
  setDisablePrevState(true);
143
142
  setDisableNextState(disableNext);
144
143
  if (onChangePerPage) onChangePerPage(per);
@@ -175,7 +174,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
175
174
  }
176
175
 
177
176
  timer.current = setTimeout(() => {
178
- _onChangePage(currentPageState !== null && currentPageState !== void 0 ? currentPageState : 0, true);
177
+ _onChangePage(0, true);
179
178
  }, delayOnInput);
180
179
  }, [totalItemsState, itemsPerPageState]);
181
180
  useEffect(() => {
package/icons/basic.js CHANGED
@@ -1138,6 +1138,34 @@ export const Calendar = /*#__PURE__*/memo(({
1138
1138
  fill: colors[color] || color
1139
1139
  }));
1140
1140
  });
1141
+ export const CalendarAdd = /*#__PURE__*/memo(({
1142
+ width,
1143
+ height,
1144
+ color = '#7F828E',
1145
+ viewBox = false
1146
+ }) => {
1147
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
1148
+ width: width || 24,
1149
+ height: height || 24,
1150
+ viewBox: "0 0 24 24",
1151
+ fill: "none"
1152
+ }, /*#__PURE__*/React.createElement("path", {
1153
+ fillRule: "evenodd",
1154
+ clipRule: "evenodd",
1155
+ d: "M19 3H20C21.1 3 22 3.9 22 5V21C22 22.1 21.1 23 20 23H4C2.9 23 2 22.1 2 21V5C2 3.9 2.9 3 4 3H5V1H7V3H17V1H19V3ZM4 21H20V8H4V21ZM13 10.5H11V13.5H8V15.5H11V18.5H13V15.5H16V13.5H13V10.5Z",
1156
+ fill: colors[color] || color
1157
+ })) : /*#__PURE__*/React.createElement("svg", {
1158
+ width: width || 20,
1159
+ height: height || 22,
1160
+ viewBox: "0 0 20 22",
1161
+ fill: "none"
1162
+ }, /*#__PURE__*/React.createElement("path", {
1163
+ fillRule: "evenodd",
1164
+ clipRule: "evenodd",
1165
+ d: "M17 2H18C19.1 2 20 2.9 20 4V20C20 21.1 19.1 22 18 22H2C0.9 22 0 21.1 0 20V4C0 2.9 0.9 2 2 2H3V0H5V2H15V0H17V2ZM2 20H18V7H2V20ZM11 9.5H9V12.5H6V14.5H9V17.5H11V14.5H14V12.5H11V9.5Z",
1166
+ fill: colors[color] || color
1167
+ }));
1168
+ });
1141
1169
  export const CalendarBlank = /*#__PURE__*/memo(({
1142
1170
  width,
1143
1171
  height,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.54",
3
+ "version": "1.3.55",
4
4
  "description": "The DigiNet core ui",
5
5
  "homepage": "https://diginet.com.vn",
6
6
  "main": "index.js",
package/readme.md CHANGED
@@ -38,6 +38,14 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.3.55
42
+ - \[Added\]: MenuIcon – MHRM09N1040
43
+ - \[Added\]: Icon – CalendarAdd
44
+ - \[Changed\]: MoneyInput – Correct some cases of convert to words
45
+ - \[Fixed\]: Input – Fix default placeholder; Hide placeholder when readOnly, or disabled
46
+ - \[Fixed\]: ButtonIcon – Add event.persist()
47
+ - \[Fixed\]: PagingInfo – Fix bug not go to first page when totalItems, itemsPerPage changed
48
+
41
49
  ## 1.3.54
42
50
  - \[Changed\]: Popover – Allow prop anchor as element
43
51
  - \[Changed\]: Row, Col – Update responsive padding