diginet-core-ui 1.4.48 → 1.4.49

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.
@@ -7,7 +7,7 @@ import { getGlobal } from "../../../global";
7
7
  import PropTypes from 'prop-types';
8
8
  import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
9
9
  import ReactDOM from 'react-dom';
10
- import { animation, bgColor, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, bottom, boxBorder, breakWord, cursorDefault, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, fill, flexRow, flexWrap, inset, insetX, invisible, italic, itemsCenter, justifyCenter, justifyStart, outlineNone, overflowScroll, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMinHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textColor, top, userSelectNone, z } from "../../../styles/general";
10
+ import { animation, bgColor, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, bottom, boxBorder, breakWord, cursorDefault, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, fill, flexRow, flexWrap, inset, insetX, invisible, italic, itemsCenter, justifyCenter, justifyStart, outlineNone, overflowXScroll, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMinHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textColor, top, userSelectNone, z } from "../../../styles/general";
11
11
  import { useTheme } from "../../../theme";
12
12
  import useThemeProps from "../../../theme/utils/useThemeProps";
13
13
  import { classNames, getProp, isMobile, randomString } from "../../../utils";
@@ -61,6 +61,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
61
61
  });
62
62
  const {
63
63
  action = {},
64
+ allowInput,
64
65
  allowSearch,
65
66
  children,
66
67
  className,
@@ -223,6 +224,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
223
224
  padding: ${spacing([2, 4])};
224
225
  `
225
226
  }, getGlobal('selected'), " ", (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) || 0, "/", maximumSelectionLength) : null, jsx("div", {
227
+ onScroll: onLoadMoreHandler,
226
228
  css: _DropdownBoxCSS,
227
229
  className: 'DGN-Dropdown-Box'
228
230
  }, dropdown), loadingState ? jsx("div", {
@@ -256,6 +258,19 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
256
258
  } else if (e.key === 'ArrowDown' && dropdownListRef.current) {
257
259
  e.preventDefault();
258
260
  dropdownListRef.current.firstChild.focus();
261
+ } else if (!!allowInput && txtSearch && multiple && e.key === 'Enter') {
262
+ if (!Array.isArray(currentValue[unique])) currentValue[unique] = [];
263
+ const newValueArrState = [...valueMulti];
264
+ if (!newValueArrState.some(v => JSON.stringify(v) === JSON.stringify(txtSearch))) {
265
+ newValueArrState.push(txtSearch);
266
+ }
267
+ setValueMulti(newValueArrState);
268
+ !!onChange && onChange({
269
+ value: newValueArrState,
270
+ data: {
271
+ [valueExpr]: txtSearch
272
+ }
273
+ });
259
274
  }
260
275
  };
261
276
  const closeDropdown = (event, reason, value) => {
@@ -635,7 +650,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
635
650
  scrollHeight,
636
651
  offsetHeight
637
652
  } = e.target;
638
- if (scrollHeight === Math.ceil(scrollTop) + offsetHeight && dropdownListRef.current) {
653
+ if (scrollHeight <= Math.ceil(scrollTop) + offsetHeight && dropdownListRef.current) {
639
654
  var _dropdownListRef$curr;
640
655
  const length = ((_dropdownListRef$curr = dropdownListRef.current.children) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.length) - ((vlObjDefaultState === null || vlObjDefaultState === void 0 ? void 0 : vlObjDefaultState.length) || 0);
641
656
  // dropdownListRef.current.removeEventListener('scroll', onLoadMoreHandler);
@@ -1158,6 +1173,27 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
1158
1173
  });
1159
1174
  }
1160
1175
  items.push(item);
1176
+ } else if (allowInput && multiple) {
1177
+ const displayText = vl;
1178
+ let item;
1179
+ if (typeof renderSelectedItem === 'function') {
1180
+ item = renderSelectedItem({
1181
+ data,
1182
+ index
1183
+ });
1184
+ } else {
1185
+ item = jsx(Chip, {
1186
+ css: [parseWidth('100%'), parseMaxWidth('max-content')],
1187
+ key: index,
1188
+ startIcon: getIconFromData(data, true),
1189
+ label: displayText,
1190
+ size: 'medium',
1191
+ disabled: disabled,
1192
+ clearAble: !readOnly && !disabled,
1193
+ onRemove: e => onRemove(e, vl)
1194
+ });
1195
+ }
1196
+ items.push(item);
1161
1197
  }
1162
1198
  });
1163
1199
  }
@@ -1519,7 +1555,7 @@ const DropdownListCSS = ({
1519
1555
  const DropdownBoxCSS = (loading, {
1520
1556
  colors
1521
1557
  }) => css`
1522
- ${loading ? overflowHidden : overflowScroll};
1558
+ ${loading ? overflowHidden : overflowXScroll};
1523
1559
  ${parseMaxHeight(280)};
1524
1560
  &::-webkit-scrollbar {
1525
1561
  ${borderRadius(4)};
@@ -1657,6 +1693,8 @@ Dropdown.propTypes = {
1657
1693
  }),
1658
1694
  /** If `true`, the input box for searching will be displayed. */
1659
1695
  allowSearch: PropTypes.bool,
1696
+ /** If `true`, the input value will be added when user hit Enter. */
1697
+ allowInput: PropTypes.bool,
1660
1698
  /** The content to be displayed inside the Dropdown box, such as TreeView. */
1661
1699
  children: PropTypes.node,
1662
1700
  /** The CSS class for the component. */
package/icons/basic.js CHANGED
@@ -2581,6 +2581,34 @@ export const First = /*#__PURE__*/memo(({
2581
2581
  fill: fillColor(color)
2582
2582
  }));
2583
2583
  });
2584
+ export const Fire = /*#__PURE__*/memo(({
2585
+ width,
2586
+ height,
2587
+ color = 'system/rest',
2588
+ viewBox = false
2589
+ }) => {
2590
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
2591
+ width: width || 24,
2592
+ height: height || 24,
2593
+ viewBox: "0 0 24 24",
2594
+ fill: "none"
2595
+ }, /*#__PURE__*/React.createElement("path", {
2596
+ fillRule: "evenodd",
2597
+ clipRule: "evenodd",
2598
+ d: "M14.24 5.46992C14.24 3.31992 13.5 0.669922 13.5 0.669922C17.41 3.79992 20 8.60992 20 13.9999C20 18.4199 16.42 21.9999 12 21.9999C7.58 21.9999 4 18.4199 4 13.9999C4 10.6199 5.21 7.50992 7.23 5.10992L7.2 5.46992C7.2 7.52992 8.76 9.19992 10.83 9.19992C12.89 9.19992 14.24 7.52992 14.24 5.46992ZM8.49 15.8599C8.49 17.5999 9.93 18.9999 11.71 18.9999C14.36 18.9999 16.51 16.8499 16.51 14.1999C16.51 12.8099 16.31 11.4499 15.92 10.1599C14.9 11.5299 13.07 12.3799 11.3 12.7399C9.54 13.0999 8.49 14.2399 8.49 15.8599Z",
2599
+ fill: fillColor(color)
2600
+ })) : /*#__PURE__*/React.createElement("svg", {
2601
+ width: width || 16,
2602
+ height: height || 22,
2603
+ viewBox: "0 0 16 22",
2604
+ fill: "none"
2605
+ }, /*#__PURE__*/React.createElement("path", {
2606
+ fillRule: "evenodd",
2607
+ clipRule: "evenodd",
2608
+ d: "M10.24 5.46992C10.24 3.31992 9.5 0.669922 9.5 0.669922C13.41 3.79992 16 8.60992 16 13.9999C16 18.4199 12.42 21.9999 8 21.9999C3.58 21.9999 0 18.4199 0 13.9999C0 10.6199 1.21 7.50992 3.23 5.10992L3.2 5.46992C3.2 7.52992 4.76 9.19992 6.83 9.19992C8.89 9.19992 10.24 7.52992 10.24 5.46992ZM4.49 15.8599C4.49 17.5999 5.93 18.9999 7.71 18.9999C10.36 18.9999 12.51 16.8499 12.51 14.1999C12.51 12.8099 12.31 11.4499 11.92 10.1599C10.9 11.5299 9.07 12.3799 7.3 12.7399C5.54 13.0999 4.49 14.2399 4.49 15.8599Z",
2609
+ fill: fillColor(color)
2610
+ }));
2611
+ });
2584
2612
  export const FiveSquare = /*#__PURE__*/memo(({
2585
2613
  width,
2586
2614
  height,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.4.48",
3
+ "version": "1.4.49",
4
4
  "description": "The DigiNet core ui",
5
5
  "homepage": "https://diginet.com.vn",
6
6
  "main": "index.js",
package/readme.md CHANGED
@@ -42,6 +42,11 @@ npm test
42
42
 
43
43
  ## Changelog
44
44
 
45
+ ## 1.4.49
46
+ - \[Added\]: Icon – Add Icon Fire
47
+ - \[Added\]: Dropdown – Add allowInput to the multiple-select dropdown.
48
+ - \[Added\]: Dropdown – Dropdown does not display all data when shown - onLoadMore
49
+
45
50
  ## 1.4.48
46
51
  - \[Added\]: Icon – Add IconMenu MHRP38N0003, MHRP38N0004
47
52
  - \[Added\]: Icon – Add IconMenu MHRP38N0005, MHRM38N0012
package/styles/general.js CHANGED
@@ -337,6 +337,12 @@ const outlineNone = css`
337
337
  const overflowScroll = css`
338
338
  overflow: scroll;
339
339
  `;
340
+ const overflowXScroll = css`
341
+ overflow-x: scroll;
342
+ `;
343
+ const overflowYScroll = css`
344
+ overflow-y: scroll;
345
+ `;
340
346
  const overflowAuto = css`
341
347
  overflow: auto;
342
348
  `;
@@ -554,7 +560,7 @@ mgx,
554
560
  // deprecated
555
561
  mgy,
556
562
  // deprecated
557
- noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectFit, objectNone, order, outlineNone, overflowAuto, overflowScroll, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd,
563
+ noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectFit, objectNone, order, outlineNone, overflowAuto, overflowScroll, overflowXScroll, overflowYScroll, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd,
558
564
  // deprecated
559
565
  pdb,
560
566
  // deprecated