diginet-core-ui 1.4.65 → 1.4.66-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.
@@ -0,0 +1,15 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2813_38)">
3
+ <path d="M9.70007 26.7C9.70007 27.3 10.1001 27.8 10.7001 28V25.4C10.1001 25.5 9.70007 26 9.70007 26.7Z" fill="#FF8C00"/>
4
+ <path d="M13.4001 31.5C13.3001 30.9 12.9001 30.4 12.4001 30.4V33C13.1001 32.7 13.5001 32.2 13.4001 31.5Z" fill="#FF8C00"/>
5
+ <path d="M18.7001 38.3V22.3C17.7001 21.1 16.6001 20 15.2001 19.1C15.1001 19 14.9001 19 14.8001 19C14.0001 19 13.2001 19.1 12.4001 19.1C12.1001 19.1 11.9001 19.1 11.6001 19.1C11.3001 19.1 11.1001 19.1 10.8001 19.1C10.0001 19.1 9.20007 19.1 8.40007 19C8.30007 19 8.10007 19 8.00007 19.1C6.50007 20 5.30007 21.2 4.30007 22.6C2.40007 25 1.00007 27.7 0.300074 30.7C7.42078e-05 32.2 -0.199926 33.6 0.200074 35.1C0.600074 36.5 1.40007 37.5 2.70007 38C3.80007 38.5 7.00007 39 7.00007 39C8.20007 39 9.30007 39 10.5001 39C10.9001 39 11.2001 39 11.6001 39C11.9001 39 12.3001 39 12.7001 39C13.9001 39 15.0001 39 16.2001 39C16.1001 39 18.7001 38.4 18.7001 38.3ZM12.9001 28.4C14.3001 28.9 15.2001 30 15.3001 31.5C15.4001 33 14.4001 34.2 13.0001 34.6C12.4001 34.8 12.4001 34.8 12.4001 35.4V36.1H10.8001C10.8001 35.7 10.8001 35.4 10.8001 35C10.8001 34.8 10.7001 34.7 10.5001 34.6C9.20007 34.2 8.30007 33.4 7.90007 32C7.80007 31.7 7.80007 31.4 7.80007 31.1H9.80007C9.80007 31.8 10.1001 32.2 10.8001 32.5V30C10.7001 30 10.5001 29.9 10.3001 29.9C8.80007 29.4 7.80007 28.2 7.90007 26.7C7.90007 25.2 8.90007 24 10.3001 23.6C10.8001 23.5 10.8001 23.5 10.8001 23V22.1H12.4001C12.4001 22.5 12.4001 22.9 12.4001 23.2C12.4001 23.4 12.5001 23.5 12.7001 23.6C14.0001 24 14.9001 24.8 15.3001 26.1C15.5001 27 15.5001 27 14.6001 27H13.4001C13.4001 26.3 13.1001 25.8 12.4001 25.5V28.2C12.5001 28.3 12.7001 28.3 12.9001 28.4Z" fill="#FF8C00"/>
6
+ <path d="M8.80007 17.7C8.60007 17.7 8.50007 17.6 8.40007 17.5C7.40007 16.1 6.40007 14.7 5.60007 13.2C5.30007 12.6 5.10007 12 4.90007 11.4C4.80007 11.2 4.90007 11 4.90007 10.8C4.90007 10.5 5.10007 10.3 5.50007 10.3C5.80007 10.3 6.10007 10.4 6.40007 10.5C6.90007 10.7 7.40007 10.9 7.90007 11.1C8.60007 11.4 9.30007 11.3 9.90007 10.8C10.1001 10.6 10.4001 10.4 10.7001 10.3C11.3001 9.9 11.9001 9.9 12.5001 10.3C12.8001 10.5 13.2001 10.7 13.5001 11C13.9001 11.3 14.4001 11.4 14.9001 11.3C15.5001 11.1 16.1001 10.9 16.7001 10.7C17.0001 10.6 17.3001 10.5 17.6001 10.5C18.0001 10.4 18.2001 10.6 18.2001 11C18.2001 11.4 18.1001 11.9 18.0001 12.3C17.6001 13.5 16.9001 14.5 16.2001 15.5C15.7001 16.2 15.2001 16.9 14.7001 17.6C14.6001 17.7 14.5001 17.8 14.4001 17.8C13.5001 17.7 9.70007 17.7 8.80007 17.7Z" fill="#FF8C00"/>
7
+ <path d="M31.1 7.8C31 8.1 30.7 8.2 30.4 8.3H27.6V14.5L23.6 18.5C23.1 19 23 19.7 23.2 20.3C23.5 20.9 24.1 21.3 24.7 21.3H26.6V38.3C26.6 38.6 26.7 38.8 26.8 39H20.3C19.9 39 19.6 38.7 19.5 38.3V8.3H16.7C16.4 8.3 16.1 8.1 16 7.8C16 7.5 16.1 7.2 16.3 7L23.1 0.2C23.2 0.1 23.4 0 23.6 0C23.8 0 24 0.1 24.1 0.2L30.9 7C31.1 7.2 31.2 7.5 31.1 7.8Z" fill="#1CA261"/>
8
+ <path d="M31.4598 12C31.6598 12 31.8598 12.1 31.9598 12.2L38.7598 19C38.9598 19.2 39.0598 19.5 38.9598 19.8C38.8598 20.1 38.5598 20.2 38.2598 20.3H35.4598V38.3C35.4598 38.7 35.1598 39 34.7598 39H28.2598C27.8598 39 27.5598 38.7 27.5598 38.3V20.3H24.7598C24.4598 20.3 24.1598 20.1 24.0598 19.8C23.9598 19.5 23.9598 19.2 24.2598 19L31.0598 12.2C31.0598 12.1 31.2598 12 31.4598 12Z" fill="#FF4444"/>
9
+ </g>
10
+ <defs>
11
+ <clipPath id="clip0_2813_38">
12
+ <rect width="39" height="39" fill="white"/>
13
+ </clipPath>
14
+ </defs>
15
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2792_16)">
3
+ <path d="M34.6224 19.9772C34.9209 20.0771 35.2194 19.9772 35.3189 19.7775L37.7066 15.6821C37.9056 15.3825 37.8061 15.0828 37.6071 14.883L35.1199 12.8853C35.2194 12.0862 35.2194 11.387 35.1199 10.5879L37.6071 8.59021C37.8061 8.49032 37.9056 8.19067 37.7066 7.99089L35.3189 3.89556C35.2194 3.5959 34.9209 3.49602 34.6224 3.5959L31.7372 4.79454C31.1403 4.2951 30.4439 3.99545 29.7474 3.69579L29.25 0.599317C29.25 0.199772 28.9515 0 28.6531 0H23.977C23.6786 0 23.4796 0.199772 23.3801 0.499431L22.9821 3.5959C22.5842 3.69579 22.2857 3.89556 21.9872 4.09533C21.6888 4.2951 21.2908 4.49488 21.0918 4.79454L18.2066 3.5959C17.9082 3.49602 17.6097 3.5959 17.5102 3.79567L15.023 7.99089C14.824 8.29055 14.9235 8.59021 15.1224 8.78998L17.6097 10.7877C17.5102 11.5868 17.5102 12.286 17.6097 13.0851L15.1224 15.0828C14.9235 15.2826 14.824 15.5822 15.023 15.8819L17.4107 19.9772C17.5102 20.2769 17.9082 20.3768 18.1071 20.2769L20.9923 19.0783C21.5893 19.5777 22.2857 19.8773 22.9821 20.177L23.4796 23.2735C23.5791 23.5731 23.7781 23.7729 24.0765 23.7729H28.7525C29.051 23.7729 29.25 23.5731 29.3495 23.2735L29.7474 20.177C30.1454 20.0771 30.4439 19.8773 30.7423 19.6776C31.1403 19.4778 31.4388 19.278 31.7372 19.0783L34.6224 19.9772ZM28.5536 15.6821C26.4643 16.8808 23.7781 16.1816 22.4847 14.0839C21.1913 11.9863 22.0867 9.18953 24.176 7.99089C26.2653 6.79226 28.9515 7.49146 30.2449 9.58907C31.4388 11.6867 30.6429 14.3836 28.5536 15.6821Z" fill="#FF8C00" style="fill:#FF8C00;fill:color(display-p3 1.0000 0.5490 0.0000);fill-opacity:1;"/>
4
+ <path d="M6.66582 29.4664C6.66582 29.9659 6.66582 30.4653 6.66582 30.9647C6.66582 31.4642 6.26786 31.9636 5.67092 31.9636C4.07908 31.9636 2.48724 31.9636 0.895408 31.9636C0.298469 31.9636 0 31.6639 0 31.0646C0 27.169 0 23.1736 0 19.1782C0 18.9784 0 18.8785 0.0994898 18.6787C0.19898 18.2792 0.497449 18.0794 0.895408 18.0794H5.77041C6.26786 18.0794 6.66582 18.3791 6.66582 18.9784V29.4664Z" fill="#2680EB" style="fill:#2680EB;fill:color(display-p3 0.1490 0.5020 0.9216);fill-opacity:1;"/>
5
+ <path d="M38.3036 37.3574C37.7066 38.2564 36.9107 38.8557 35.7168 38.9556C34.4235 39.0555 33.1301 38.9556 31.9362 38.9556C28.0561 38.9556 24.0765 38.9556 20.1964 38.9556C18.6046 38.9556 17.0128 38.9556 15.4209 38.9556C13.4311 38.8557 11.7398 38.2564 10.4464 36.7581C9.65051 35.959 9.15306 34.9602 8.7551 33.9613C8.55612 33.2621 8.35714 32.5629 8.25765 31.7638V19.5777C9.84949 19.4778 11.4413 19.5777 13.0332 19.8774C13.1327 19.8774 13.3316 19.9772 13.4311 19.9772C13.8291 20.0771 15.3214 20.5766 17.5102 22.2746C19.102 23.673 20.5944 24.9716 22.1862 26.37C22.7832 26.8694 23.3801 27.3688 23.8776 27.8682C23.977 27.9681 24.176 28.1679 24.375 28.2678C25.0714 28.967 25.8673 29.5663 26.6633 30.2655C26.7628 30.2655 26.7628 30.3654 26.8622 30.3654C26.8622 30.3654 26.8622 30.3654 26.9617 30.4653C26.9617 30.4653 26.9617 30.4653 27.0612 30.5652C27.2602 30.7649 27.3597 30.9647 27.5587 31.2644C27.5587 31.3643 27.6582 31.3643 27.6582 31.4642C27.7577 31.6639 27.8571 31.9636 27.8571 32.2632C27.9566 32.9624 27.7577 33.6616 27.2602 34.261C26.7628 34.8603 26.1658 35.1599 25.4694 35.2598C24.773 35.3597 24.0765 35.1599 23.4796 34.6605L14.3265 27.3688C14.0281 27.0692 13.5306 27.169 13.2321 27.4687C12.9337 27.7684 13.0332 28.2678 13.3316 28.5675L22.4847 35.8591C23.2806 36.4585 24.176 36.7581 25.1709 36.7581C25.3699 36.7581 25.4694 36.7581 25.6684 36.7581C26.7628 36.6582 27.8571 36.0589 28.5536 35.1599C29.25 34.261 29.5485 33.1622 29.449 32.1634H33.926C34.4235 32.1634 34.9209 32.1634 35.5179 32.1634C35.9158 32.2632 36.4133 32.2632 36.8112 32.463C37.9056 32.7627 38.801 33.9613 39 35.1599C38.9005 35.959 38.7015 36.6582 38.3036 37.3574Z" fill="#2680EB" style="fill:#2680EB;fill:color(display-p3 0.1490 0.5020 0.9216);fill-opacity:1;"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="clip0_2792_16">
9
+ <rect width="39" height="39" fill="white" style="fill:white;fill-opacity:1;"/>
10
+ </clipPath>
11
+ </defs>
12
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2792_17)">
3
+ <path d="M37 30H35.5V27C35.5 24 33 21.5 30 21.5H23.2C22.8 20.5 22 19.7 21 19.3V15H33C35.2 15 37 13.2 37 11V4C37 1.8 35.2 0 33 0H6C3.8 0 2 1.8 2 4V11C2 13.2 3.8 15 6 15H18V19.3C17 19.7 16.2 20.5 15.8 21.5H9C6 21.5 3.5 24 3.5 27V30H2C0.9 30 0 30.9 0 32V37C0 38.1 0.9 39 2 39H8C9.1 39 10 38.1 10 37V32C10 30.9 9.1 30 8 30H6.5V27C6.5 25.6 7.6 24.5 9 24.5H15.8C16.2 25.5 17 26.3 18 26.7V30H16C14.9 30 14 30.9 14 32V37C14 38.1 14.9 39 16 39H23C24.1 39 25 38.1 25 37V32C25 30.9 24.1 30 23 30H21V26.7C22 26.3 22.8 25.5 23.2 24.5H30C31.4 24.5 32.5 25.6 32.5 27V30H31C29.9 30 29 30.9 29 32V37C29 38.1 29.9 39 31 39H37C38.1 39 39 38.1 39 37V32C39 30.9 38.1 30 37 30ZM22.5 6H31.5C32.3 6 33 6.7 33 7.5C33 8.3 32.3 9 31.5 9H22.5C21.7 9 21 8.3 21 7.5C21 6.7 21.7 6 22.5 6ZM8.7 10.2C7.2 10.2 6 9 6 7.5C6 6 7.2 4.8 8.7 4.8C10.2 4.8 11.4 6 11.4 7.5C11.4 9 10.2 10.2 8.7 10.2ZM13.6 7.5C13.6 6 14.8 4.8 16.3 4.8C17.8 4.8 19 6 19 7.5C19 9 17.8 10.2 16.3 10.2C14.8 10.2 13.6 9 13.6 7.5ZM7 33V36H3V33H7ZM20.5 23C20.5 23.6 20.1 24 19.5 24C18.9 24 18.5 23.6 18.5 23C18.5 22.4 18.9 22 19.5 22C20.1 22 20.5 22.4 20.5 23ZM22 33V36H17V33H22ZM36 36H32V33H36V36Z" fill="#2680EB" style="fill:#2680EB;fill:color(display-p3 0.1490 0.5020 0.9216);fill-opacity:1;"/>
4
+ </g>
5
+ <defs>
6
+ <clipPath id="clip0_2792_17">
7
+ <rect width="39" height="39" fill="white" style="fill:white;fill-opacity:1;"/>
8
+ </clipPath>
9
+ </defs>
10
+ </svg>
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import { CircularProgress, Icon } from "./..";
4
+ import { CircularProgress, Icon, Tooltip } from "./..";
5
5
  import OptionWrapper from "../others/option-wrapper";
6
6
  import PropTypes from 'prop-types';
7
7
  import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
@@ -78,7 +78,8 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
78
78
  style,
79
79
  viewBox,
80
80
  viewType,
81
- width
81
+ width,
82
+ title
82
83
  } = props;
83
84
  const ref = useRef(null);
84
85
  const rippleRef = useRef(null);
@@ -109,7 +110,10 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
109
110
  return currentRef;
110
111
  });
111
112
  return useMemo(() => {
112
- return jsx("button", {
113
+ return jsx(Tooltip, {
114
+ title: title,
115
+ disableInteractive: !title
116
+ }, jsx("button", {
113
117
  css: [_ButtonRootCSS, _ButtonSizeCSS],
114
118
  ref: ref,
115
119
  id: id,
@@ -129,8 +133,8 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
129
133
  ref: rippleRef,
130
134
  color: getRippleColor(colorProp, viewType, colors),
131
135
  circular: circular
132
- }));
133
- }, [children, circular, className, colorHover, colorProp, disabled, height, id, loading, name, onClick, size, style, viewBox, viewType, width, theme]);
136
+ })));
137
+ }, [children, circular, className, colorHover, colorProp, disabled, height, id, loading, name, onClick, size, style, viewBox, viewType, width, theme, title]);
134
138
  }));
135
139
  const ButtonIconCSS = iconSize => css`
136
140
  ${displayFlex};
@@ -287,18 +291,6 @@ const ButtonRootCSS = (circular, colorHover, color, name, isColorDefault, viewTy
287
291
  filter: brightness(1);
288
292
  }
289
293
  `;
290
-
291
- // ButtonIcon.defaultProps = {
292
- // circular: false,
293
- // className: '',
294
- // color: 'default',
295
- // colorHover: 'system/active',
296
- // disabled: false,
297
- // size: 'medium',
298
- // viewBox: true,
299
- // viewType: 'outlined',
300
- // };
301
-
302
294
  ButtonIcon.propTypes = {
303
295
  /** The content of the component. */
304
296
  children: PropTypes.node,
@@ -314,20 +306,22 @@ ButtonIcon.propTypes = {
314
306
  disabled: PropTypes.bool,
315
307
  /** Height oof the component. */
316
308
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
309
+ /** Title of hover tooltip */
310
+ title: PropTypes.string,
317
311
  /** If `true`, the loading indicator is shown. */
318
312
  loading: PropTypes.bool,
319
313
  /** Callback fired when the component is clicked. */
320
314
  onClick: PropTypes.func,
321
315
  /** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
322
316
  name: PropTypes.string,
323
- /**
324
- * The size of the component.
325
- *
326
- * * tiny (button 24px, icon 16px)
327
- * * small (button 32px, icon 20px)
328
- * * medium (button 40px, icon 24px)
329
- * * large (button 48px, icon 32px)
330
- * * giant (button 56px, icon 40px)
317
+ /**
318
+ * The size of the component.
319
+ *
320
+ * * tiny (button 24px, icon 16px)
321
+ * * small (button 32px, icon 20px)
322
+ * * medium (button 40px, icon 24px)
323
+ * * large (button 48px, icon 32px)
324
+ * * giant (button 56px, icon 40px)
331
325
  * */
332
326
  size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant', 'extraGiant']),
333
327
  /** Style inline of component. */
@@ -338,19 +332,19 @@ ButtonIcon.propTypes = {
338
332
  viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
339
333
  /** Width of the component. */
340
334
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
341
- /**
342
- * ref methods (ref.current.instance.*method*)
343
- *
344
- * * option(): Gets all UI component properties
345
- * * Returns value - object
346
- * * option(optionName): Gets the value of a single property
347
- * * @param {optionName} - string
348
- * * Returns value - any
349
- * * option(optionName, optionValue): Updates the value of a single property
350
- * * @param {optionName} - string
351
- * * @param {optionValue} - any
352
- * * option(options): Updates the values of several properties
353
- * * @param {options} - object
335
+ /**
336
+ * ref methods (ref.current.instance.*method*)
337
+ *
338
+ * * option(): Gets all UI component properties
339
+ * * Returns value - object
340
+ * * option(optionName): Gets the value of a single property
341
+ * * @param {optionName} - string
342
+ * * Returns value - any
343
+ * * option(optionName, optionValue): Updates the value of a single property
344
+ * * @param {optionName} - string
345
+ * * @param {optionValue} - any
346
+ * * option(options): Updates the values of several properties
347
+ * * @param {options} - object
354
348
  */
355
349
  };
356
350
  export { ButtonIcon };
@@ -652,7 +652,7 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
652
652
  color: 'primary',
653
653
  type: 'h3',
654
654
  ref: refs.content,
655
- format: ['lowercase']
655
+ format: ['sentence']
656
656
  }))), jsx("div", {
657
657
  className: className.navigator.around
658
658
  }, jsx(ButtonIcon, {
@@ -226,7 +226,7 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
226
226
  * START EFFECT
227
227
  */
228
228
  useEffect(() => {
229
- if (defaultValue && defaultValue !== '' && isValidDate(defaultValue)) {
229
+ if (defaultValue && defaultValue !== '' && isValidDate(defaultValue) && !value) {
230
230
  if (isBeforeLimit(min, defaultValue)) {
231
231
  onUpdate(min);
232
232
  } else if (isAfterLimit(max, defaultValue)) {
@@ -1,13 +1,15 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import { ButtonIcon, InputBase, Label, Popover, PopoverBody } from "../..";
4
+ import { ButtonIcon, InputBase, Label, Popover, PopoverBody, HelperText } from "../..";
5
5
  import PropTypes from 'prop-types';
6
- import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
6
+ import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useMemo } from 'react';
7
7
  import { animation, borderColor, displayBlock, overflowHidden, parseHeight, parseMinWidth, positionRelative, scaleX } from "../../../styles/general";
8
8
  import { useTheme } from "../../../theme";
9
9
  import useThemeProps from "../../../theme/utils/useThemeProps";
10
10
  import { classNames, getProp } from "../../../utils";
11
+ const regexBetween = /[^{}]+(?=})/g;
12
+ const regexInclude = /{|}/g;
11
13
  const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
12
14
  if (!reference) reference = useRef(null);
13
15
  const theme = useTheme();
@@ -22,10 +24,14 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
22
24
  });
23
25
  const {
24
26
  action = {},
27
+ allowInput,
25
28
  bgColor: bgColorProp,
26
29
  children,
27
30
  className,
28
31
  delayOnInput,
32
+ disabled,
33
+ displayExpr: displayExprProp,
34
+ error,
29
35
  endIcon,
30
36
  inputProps,
31
37
  inputRef,
@@ -39,10 +45,19 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
39
45
  placeholder,
40
46
  startIcon,
41
47
  style,
42
- value,
43
- viewType
48
+ value: valueProps,
49
+ valueExpr,
50
+ viewType,
51
+ helperTextProps
44
52
  } = props;
53
+ let displayExpr = displayExprProp;
45
54
  const bgColor = typeof bgColorProp === 'string' ? getProp(colors, bgColorProp, bgColorProp) : bgColorProp;
55
+ const ErrorView = useMemo(() => {
56
+ return error ? jsx(HelperText, {
57
+ ...helperTextProps,
58
+ disabled: disabled
59
+ }, error) : null;
60
+ }, [disabled, error, helperTextProps]);
46
61
  const ref = useRef(null);
47
62
  const dropdownBoxRef = useRef(null);
48
63
  const timer = useRef(null);
@@ -85,6 +100,28 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
85
100
  onClosed === null || onClosed === void 0 ? void 0 : onClosed();
86
101
  }
87
102
  };
103
+
104
+ /**
105
+ * Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
106
+ * @param data {object} rowData of dataSource
107
+ * @return {string}
108
+ */
109
+ const displayValue = data => {
110
+ let text = '';
111
+ if (data || data === 0) {
112
+ displayExpr = displayExpr || valueExpr;
113
+ let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
114
+ // convert {id} - {name} to {<data[id]>} - {<data[name]>}
115
+ if (!mask && regexBetween.test(displayExpr)) {
116
+ var _displayExpr;
117
+ mask = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.replace(regexBetween, _ => (data === null || data === void 0 ? void 0 : data[_]) || '');
118
+ } else if (!mask) {
119
+ mask = typeof data !== 'object' ? data : '';
120
+ }
121
+ text = mask.toString().replace(regexInclude, '');
122
+ }
123
+ return text;
124
+ };
88
125
  useLayoutEffect(() => {
89
126
  if (ref.current) {
90
127
  const {
@@ -130,15 +167,17 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
130
167
  onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
131
168
  }) : null;
132
169
  };
170
+ const value = displayValue(valueProps);
133
171
  return jsx(Fragment, null, jsx("div", {
134
172
  ref: ref,
135
173
  css: _DropdownBoxRootCSS,
136
- className: classNames('DGN-UI-Dropdown-Box', className),
174
+ className: classNames('DGN-UI-Dropdown-Box', className, error && 'error'),
137
175
  style: style
138
176
  }, label ? jsx(Label, {
139
177
  ...labelProps
140
178
  }, label) : null, jsx(InputBase, {
141
179
  ...inputProps,
180
+ readOnly: !allowInput,
142
181
  style: inputStyle,
143
182
  viewType: viewType,
144
183
  inputRef: inputRef,
@@ -157,7 +196,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
157
196
  anchor: ref.current,
158
197
  width: popoverWidth,
159
198
  onClose: closeDropdownBox
160
- }, jsx(PopoverBody, null, children)));
199
+ }, jsx(PopoverBody, null, children)), ErrorView);
161
200
  }));
162
201
  const DropdownBoxRootCSS = (bgColorProp, {
163
202
  colors
@@ -166,6 +205,17 @@ const DropdownBoxRootCSS = (bgColorProp, {
166
205
  ${positionRelative};
167
206
  ${parseMinWidth(150)};
168
207
  ${parseHeight('max-content')};
208
+ &.error {
209
+ .DGN-UI-InputBase {
210
+ ${borderColor(getProp(colors, 'semantic/danger'))};
211
+ &::before {
212
+ ${borderColor(getProp(colors, 'semantic/danger'))};
213
+ }
214
+ &::after {
215
+ ${borderColor(getProp(colors, 'semantic/danger'))};
216
+ }
217
+ }
218
+ }
169
219
  .DGN-UI-InputBase {
170
220
  background: ${bgColorProp ? bgColorProp === true ? getProp(colors, 'fill/disabled') : bgColorProp : 'inherit'} !important;
171
221
  ${openState && css`
@@ -183,20 +233,6 @@ const DropdownBoxCSS = ({
183
233
  margin-top: ${spacing([1])};
184
234
  ${overflowHidden};
185
235
  `;
186
-
187
- // DropdownBox.defaultProps = {
188
- // className: '',
189
- // label: '',
190
- // placeholder: '',
191
- // startIcon: 'Search',
192
- // endIcon: 'ArrowDown',
193
- // openOnClickAt: 'icon',
194
- // viewType: 'underlined',
195
- // inputProps: {},
196
- // delayOnInput: 700,
197
- // zIndex: zIndexCORE(1),
198
- // };
199
-
200
236
  DropdownBox.propTypes = {
201
237
  /** class for dropdown */
202
238
  className: PropTypes.string,
@@ -233,6 +269,12 @@ DropdownBox.propTypes = {
233
269
  /** the function will run after open */
234
270
  onOpened: PropTypes.func,
235
271
  /** the function will run after close */
236
- onClosed: PropTypes.func
272
+ onClosed: PropTypes.func,
273
+ /** Error message displayed below the input. */
274
+ error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
275
+ /** If `true`, the component is disabled. */
276
+ disabled: PropTypes.bool,
277
+ /** If `true`, the input is enable. */
278
+ allowInput: PropTypes.bool
237
279
  };
238
280
  export default DropdownBox;
@@ -49,7 +49,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
49
49
  labelProps,
50
50
  max: maxProp,
51
51
  maxDigit,
52
- min,
52
+ min: minProp,
53
53
  nonStyle,
54
54
  onBlur,
55
55
  onChange,
@@ -69,9 +69,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
69
69
  viewType
70
70
  } = props;
71
71
  let max = maxProp;
72
+ let min = minProp;
72
73
  let thousandSymbol = thousandSeparator;
73
74
  let decimalSymbol = decimalSymbolProp;
74
75
  let valueProps = valueProp;
76
+ if (!min && min !== 0) min = -Infinity;
77
+ if (!max && max !== 0) max = Infinity;
75
78
  const pos = useRef(null);
76
79
  const ref = useRef(null);
77
80
  const globalRef = useRef({});
package/icons/basic.js CHANGED
@@ -7312,6 +7312,44 @@ export const Inheritance = /*#__PURE__*/memo(({
7312
7312
  fill: fillColor(color)
7313
7313
  }));
7314
7314
  });
7315
+ export const Import = /*#__PURE__*/memo(({
7316
+ width,
7317
+ height,
7318
+ color = 'system/rest',
7319
+ viewBox = false
7320
+ }) => {
7321
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
7322
+ width: width || 24,
7323
+ height: height || 24,
7324
+ viewBox: "0 0 24 24",
7325
+ fill: "none"
7326
+ }, /*#__PURE__*/React.createElement("path", {
7327
+ fillRule: "evenodd",
7328
+ clipRule: "evenodd",
7329
+ d: "M13 8.62059L8.28283 3.2307V6.41849L7.94949 6.39752L7.47475 6.36606C6.12121 6.28217 4.9697 5.97807 3.94949 5.43279C2.89899 4.87703 2 4.08008 1.23232 3L1 3.09438C1.41414 5.03432 2.24242 7.18398 3.85859 8.75691C4.81818 9.70067 6.07071 10.4452 7.68687 10.8122L7.86869 10.8541L8.28283 10.9485V14L13 8.62059Z",
7330
+ fill: fillColor(color)
7331
+ }), /*#__PURE__*/React.createElement("path", {
7332
+ fillRule: "evenodd",
7333
+ clipRule: "evenodd",
7334
+ d: "M5 11.4316V19C5 20.1046 5.89543 21 7 21H19C20.1046 21 21 20.1046 21 19V7C21 5.89543 20.1046 5 19 5H11.9165L13.6738 7H19V19H7V12.2796C6.54269 12.2796 5 11.5 5 11.4316Z",
7335
+ fill: fillColor(color)
7336
+ })) : /*#__PURE__*/React.createElement("svg", {
7337
+ width: width || 20,
7338
+ height: height || 18,
7339
+ viewBox: "0 0 20 18",
7340
+ fill: "none"
7341
+ }, /*#__PURE__*/React.createElement("path", {
7342
+ fillRule: "evenodd",
7343
+ clipRule: "evenodd",
7344
+ d: "M12 5.62059L7.28283 0.230696V3.41849L6.94949 3.39752L6.47475 3.36606C5.12121 3.28217 3.9697 2.97807 2.94949 2.43279C1.89899 1.87703 1 1.08008 0.232323 0L0 0.0943766C0.414141 2.03432 1.24242 4.18398 2.85859 5.75691C3.81818 6.70067 5.07071 7.44519 6.68687 7.8122L6.86869 7.85415L7.28283 7.94852V11L12 5.62059Z",
7345
+ fill: fillColor(color)
7346
+ }), /*#__PURE__*/React.createElement("path", {
7347
+ fillRule: "evenodd",
7348
+ clipRule: "evenodd",
7349
+ d: "M4 8.43156V16C4 17.1046 4.89543 18 6 18H18C19.1046 18 20 17.1046 20 16V4C20 2.89543 19.1046 2 18 2H10.9165L12.6738 4H18V16H6V9.27963C5.54269 9.27963 4 8.5 4 8.43156Z",
7350
+ fill: fillColor(color)
7351
+ }));
7352
+ });
7315
7353
  export const Warning = /*#__PURE__*/memo(({
7316
7354
  width,
7317
7355
  height,
package/package.json CHANGED
@@ -1,44 +1,78 @@
1
- {
2
- "name": "diginet-core-ui",
3
- "version": "1.4.65",
4
- "description": "The DigiNet core ui",
5
- "homepage": "https://diginet.com.vn",
6
- "main": "index.js",
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"
13
- },
14
- "dependencies": {
15
- "@emotion/core": "^10.0.35",
16
- "prop-types": "^15.7.2",
17
- "@emotion/css": "^11.11.0",
18
- "@emotion/react": "^11.10.6"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://diginetvn@bitbucket.org/diginetvn/diginet-core-ui.git"
23
- },
24
- "keywords": [
25
- "core ui",
26
- "diginet"
27
- ],
28
- "author": "rocachien",
29
- "contributors": [
30
- {
31
- "name": "Chien Do",
32
- "email": "rocachien@gmail.com"
33
- },
34
- {
35
- "name": "Nhat Tran",
36
- "email": "tranminhnhat1005@gmail.com"
37
- },
38
- {
39
- "name": "Thuan Nguyen",
40
- "email": "nt.thuan.hutech@gmail.com"
41
- }
42
- ],
43
- "license": "MIT"
44
- }
1
+ {
2
+ "name": "diginet-core-ui",
3
+ "version": "1.4.66-beta.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "license": "UNLICENSED",
7
+ "scripts": {
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
+ "freshtall": "npm cache clean --force && rm -rf node_modules && rm -f package-lock.json && npm install",
28
+ "test-storybook": "test-storybook --url http://localhost:9050",
29
+ "preinstall": "echo {} > package-lock.json"
30
+ },
31
+ "dependencies": {
32
+ "@emotion/core": "^10.0.35",
33
+ "@emotion/css": "^11.11.0",
34
+ "@emotion/react": "^11.10.6",
35
+ "babel-plugin-module-resolver": "^4.1.0",
36
+ "date-fns": "^2.30.0",
37
+ "prop-types": "^15.7.2"
38
+ },
39
+ "lint-staged": {
40
+ "*/**/*.{js,jsx,json}": [
41
+ "prettier --write",
42
+ "git add"
43
+ ]
44
+ },
45
+ "devDependencies": {
46
+ "@babel/cli": "^7.14.3",
47
+ "@babel/plugin-proposal-class-properties": "^7.13.0",
48
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.16.0",
49
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
50
+ "@babel/plugin-proposal-optional-chaining": "^7.14.2",
51
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
52
+ "@babel/plugin-proposal-private-property-in-object": "^7.18.6",
53
+ "@babel/preset-react": "^7.13.13",
54
+ "@storybook/addon-actions": "6.2.9",
55
+ "@storybook/addon-essentials": "6.2.9",
56
+ "@storybook/addon-links": "6.2.9",
57
+ "@storybook/addon-postcss": "^2.0.0",
58
+ "@storybook/react": "6.2.9",
59
+ "@storybook/test-runner": "^0.7.1",
60
+ "autoprefixer": "^10.3.1",
61
+ "babel-loader": "^8.2.2",
62
+ "eslint": "^8.4.1",
63
+ "eslint-plugin-react": "^7.27.1",
64
+ "eslint-plugin-regex": "^1.10.0",
65
+ "husky": "^7.0.4",
66
+ "jest": "^27.5.1",
67
+ "lint-staged": "^12.1.2",
68
+ "mkdirp": "^1.0.4",
69
+ "npm-run-all": "^4.1.5",
70
+ "onchange": "^7.1.0",
71
+ "postcss-flexbugs-fixes": "^5.0.2",
72
+ "react": "^17.0.1",
73
+ "react-dom": "^17.0.1",
74
+ "rimraf": "^3.0.2",
75
+ "run-script-os": "^1.1.6",
76
+ "sass": "1.58.3"
77
+ }
78
+ }
package/readme.md CHANGED
@@ -41,6 +41,12 @@ npm test
41
41
  ```
42
42
 
43
43
  ## Changelog
44
+
45
+ ## 1.4.66
46
+ - \[Added\]: Icon – Add Icon Import
47
+ - \[Added\]: Icon – Add IconMenu W109F1000, W110F1000
48
+ - \[Added\]: ButtonIcon – Use the title prop to show text on hover for the ButtonIcon
49
+
44
50
  ## 1.4.65
45
51
  - \[Added\]: Icon – Add Icon OpenNew
46
52
  - \[Added\]: Icon – Add IconMenu WEO53TR001, WEO53APP01