diginet-core-ui 1.3.64-beta.1 → 1.3.65-beta.2

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.
@@ -1,17 +1,17 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import { memo, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
4
+ import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
5
5
  import useInput from '../../../utils/useInput';
6
6
  import PropTypes from 'prop-types';
7
7
  import { jsx, css } from '@emotion/core';
8
- import { renderIcon } from '../../../utils';
9
8
  import theme from '../../../theme/settings';
10
9
  import { typography } from '../../../styles/typography';
11
10
  const {
12
11
  colors
13
12
  } = theme;
14
13
  import { getGlobal } from '../../../global';
14
+ import Icon from '../../../icons';
15
15
  const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
16
16
  type,
17
17
  viewType,
@@ -588,26 +588,46 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
588
588
  onFocus: onFocus,
589
589
  ...bind
590
590
  }));
591
+ const StartIcon = useMemo(() => {
592
+ let node = startIcon;
593
+
594
+ if (typeof node === 'string') {
595
+ node = jsx(Icon, {
596
+ name: startIcon,
597
+ style: iconStyle
598
+ });
599
+ }
600
+
601
+ return jsx("div", {
602
+ css: inputBaseIconCSS,
603
+ ...startIconProps,
604
+ className: ['start-icon', startIconProps.className ? startIconProps.className : ''].join(' ').trim()
605
+ }, node);
606
+ }, [startIcon]);
607
+ const EndIcon = useMemo(() => {
608
+ let node = endIcon;
609
+
610
+ if (typeof node === 'string') {
611
+ node = jsx(Icon, {
612
+ name: endIcon,
613
+ style: iconStyle
614
+ });
615
+ }
616
+
617
+ return jsx("div", {
618
+ css: inputBaseIconCSS,
619
+ ...endIconProps,
620
+ className: ['end-icon', endIconProps.className ? endIconProps.className : ''].join(' ').trim()
621
+ }, ' ', node, ' ');
622
+ }, [endIcon]);
591
623
  const InputComp = jsx("div", {
592
624
  css: inputBaseRoot,
593
625
  ref: ref,
594
626
  ...props,
595
627
  className: ['DGN-UI-InputBase', newClass, className, status].join(' ').trim()
596
- }, jsx("div", {
628
+ }, startIcon && StartIcon, jsx("div", {
597
629
  css: inputBaseCSS
598
- }, !!startIcon && jsx("div", {
599
- css: inputBaseIconCSS,
600
- ...startIconProps,
601
- className: 'start-icon ' + (startIconProps.className ? startIconProps.className : '')
602
- }, renderIcon(startIcon, typeof startIcon === 'string' && startIcon.length < 20 ? 'effect' : null, {
603
- onClick: startIconProps.onClick ? null : () => inputBaseRef.current.focus(),
604
- style: {
605
- padding: 0,
606
- minHeight: '24px',
607
- ...iconStyle
608
- },
609
- viewBox: true
610
- })), jsx("input", {
630
+ }, jsx("input", {
611
631
  type: type,
612
632
  autoComplete: autoComplete,
613
633
  placeholder: isEnabled ? placeholder : '',
@@ -627,18 +647,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
627
647
  onBlur: onBlur,
628
648
  onFocus: onFocus,
629
649
  ...bind
630
- })), !!endIcon && jsx("div", {
631
- css: inputBaseIconCSS,
632
- ...endIconProps,
633
- className: 'end-icon ' + (endIconProps.className ? endIconProps.className : '')
634
- }, renderIcon(endIcon, null, {
635
- style: {
636
- padding: 0,
637
- minHeight: '24px',
638
- ...iconStyle
639
- },
640
- viewBox: true
641
- })));
650
+ })), endIcon && EndIcon);
642
651
  const InputBaseComp = multiline ? MultipleInputComp : InputComp;
643
652
  /* End component */
644
653
 
@@ -724,10 +733,10 @@ InputBase.propTypes = {
724
733
  required: PropTypes.bool,
725
734
 
726
735
  /** icon element display in the left of input */
727
- startIcon: PropTypes.any,
736
+ startIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
728
737
 
729
738
  /** icon element display in the right of input */
730
- endIcon: PropTypes.any,
739
+ endIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
731
740
 
732
741
  /** props of input in InputBase component */
733
742
  inputProps: PropTypes.object,
@@ -78,7 +78,6 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
78
78
  e,
79
79
  changeBy
80
80
  }) => {
81
- if (page === currentPageState) return;
82
81
  const lastPage = getLastPage(totalItemsState, itemsPerPageState);
83
82
  let disablePrev = false;
84
83
  let disableNext = false; // If last page = 1. Disable all
@@ -98,6 +97,10 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
98
97
  disablePrev = true;
99
98
  }
100
99
 
100
+ setDisablePrevState(disablePrev);
101
+ setDisableNextState(disableNext);
102
+ if (page === currentPageState) return;
103
+
101
104
  if (onChangingPage) {
102
105
  const event = { ...e,
103
106
  cancel: false,
@@ -119,8 +122,6 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
119
122
  currentPageRef.current = page;
120
123
  setCurrentPageState(page);
121
124
  setInputPageValue(page);
122
- setDisablePrevState(disablePrev);
123
- setDisableNextState(disableNext);
124
125
  if (onChangePage) onChangePage(page);
125
126
  };
126
127
 
@@ -523,7 +524,8 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
523
524
  .DGN-UI-Dropdown-Form {
524
525
  min-height: 24px;
525
526
  padding: 0;
526
- input {
527
+ input,
528
+ span {
527
529
  ${paragraph2};
528
530
  ${noPadding};
529
531
  ${cursorPointer};
@@ -69,7 +69,6 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
69
69
  e,
70
70
  changeBy
71
71
  }) => {
72
- if (page === currentPageState) return;
73
72
  let disablePrev = false;
74
73
  let disableNext = false; // If last page = 1. Disable all
75
74
 
@@ -88,6 +87,10 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
88
87
  disablePrev = true;
89
88
  }
90
89
 
90
+ setDisablePrevState(disablePrev);
91
+ setDisableNextState(disableNext);
92
+ if (page === currentPageState) return;
93
+
91
94
  if (onChangingPage) {
92
95
  const event = { ...e,
93
96
  cancel: false,
@@ -107,8 +110,6 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
107
110
 
108
111
  currentPageRef.current = page;
109
112
  setCurrentPageState(page);
110
- setDisablePrevState(disablePrev);
111
- setDisableNextState(disableNext);
112
113
  if (onChangePage) onChangePage(page);
113
114
  };
114
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.64-beta.1",
3
+ "version": "1.3.65-beta.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/readme.md CHANGED
@@ -38,6 +38,9 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.3.65
42
+ - \[Changed\]: Dropdown – Add viewType none
43
+
41
44
  ## 1.3.64
42
45
  - \[Added\]: COLORS – Add new colors
43
46
  - \[Changed\]: Checkbox – Add case checked, defaultChecked is number 0,1