diginet-core-ui 1.4.7 → 1.4.8

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.
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
9
9
  import { forwardRef, Fragment, isValidElement, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
10
10
  import { borderNone, borderRadius, boxContent, cursorInherit, cursorPointer, displayBlock, displayFlex, displayInlineFlex, displayNone, flexCol, itemsCenter, overflowHidden, parseMinWidth, parseWidthHeight, pd, positionAbsolute, positionRelative, userSelectNone, z } from "../../styles/general";
11
11
  import { useTheme } from "../../theme";
12
- import { classNames, isMobile } from "../../utils";
12
+ import { classNames, isMobile, refType as ref } from "../../utils";
13
13
  const {
14
14
  colors: {
15
15
  system: {
@@ -364,7 +364,7 @@ Avatar.propTypes = {
364
364
  /** the error to show on wrong type */
365
365
  wrongTypeError: PropTypes.string,
366
366
  /**
367
- * ref methods
367
+ * ref methods (ref.current.instance.*method*)
368
368
  *
369
369
  * * option(): Gets all UI component properties
370
370
  * * Returns value - object
@@ -377,9 +377,7 @@ Avatar.propTypes = {
377
377
  * * option(options): Updates the values of several properties
378
378
  * * @param {options} - object
379
379
  */
380
- reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
381
- current: PropTypes.instanceOf(Element)
382
- })])
380
+ ref: ref
383
381
  };
384
382
  export { Avatar };
385
383
  export default OptionWrapper(Avatar);
@@ -4,7 +4,7 @@ import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { jsx } from '@emotion/core';
6
6
  import OptionWrapper from "../others/option-wrapper";
7
- import { classNames } from "../../utils";
7
+ import { classNames, refType as ref } from "../../utils";
8
8
  const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
9
  action = {},
10
10
  children,
@@ -45,7 +45,22 @@ CardBody.propTypes = {
45
45
  /** If `true`, will have divider between body and footer. */
46
46
  style: PropTypes.object,
47
47
  /** The title of the component's header. */
48
- title: PropTypes.string
48
+ title: PropTypes.string,
49
+ /**
50
+ * ref methods (ref.current.instance.*method*)
51
+ *
52
+ * * option(): Gets all UI component properties
53
+ * * Returns value - object
54
+ * * option(optionName): Gets the value of a single property
55
+ * * @param {optionName} - string
56
+ * * Returns value - any
57
+ * * option(optionName, optionValue): Updates the value of a single property
58
+ * * @param {optionName} - string
59
+ * * @param {optionValue} - any
60
+ * * option(options): Updates the values of several properties
61
+ * * @param {options} - object
62
+ */
63
+ ref: ref
49
64
  };
50
65
  export { CardBody };
51
66
  export default OptionWrapper(CardBody);
@@ -4,7 +4,7 @@ import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { jsx } from '@emotion/core';
6
6
  import OptionWrapper from "../others/option-wrapper";
7
- import { classNames } from "../../utils";
7
+ import { classNames, refType as ref } from "../../utils";
8
8
  const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
9
  action = {},
10
10
  children,
@@ -45,7 +45,22 @@ CardExtra.propTypes = {
45
45
  /** If `true`, will have divider between body and footer. */
46
46
  style: PropTypes.object,
47
47
  /** The title of the component's header. */
48
- title: PropTypes.string
48
+ title: PropTypes.string,
49
+ /**
50
+ * ref methods (ref.current.instance.*method*)
51
+ *
52
+ * * option(): Gets all UI component properties
53
+ * * Returns value - object
54
+ * * option(optionName): Gets the value of a single property
55
+ * * @param {optionName} - string
56
+ * * Returns value - any
57
+ * * option(optionName, optionValue): Updates the value of a single property
58
+ * * @param {optionName} - string
59
+ * * @param {optionValue} - any
60
+ * * option(options): Updates the values of several properties
61
+ * * @param {options} - object
62
+ */
63
+ ref: ref
49
64
  };
50
65
  export { CardExtra };
51
66
  export default OptionWrapper(CardExtra);
@@ -4,7 +4,7 @@ import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { jsx } from '@emotion/core';
6
6
  import OptionWrapper from "../others/option-wrapper";
7
- import { classNames } from "../../utils";
7
+ import { classNames, refType as ref } from "../../utils";
8
8
  const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
9
  action = {},
10
10
  children,
@@ -45,7 +45,22 @@ CardFooter.propTypes = {
45
45
  /** If `true`, will have divider between body and footer. */
46
46
  style: PropTypes.object,
47
47
  /** The title of the component's header. */
48
- title: PropTypes.string
48
+ title: PropTypes.string,
49
+ /**
50
+ * ref methods (ref.current.instance.*method*)
51
+ *
52
+ * * option(): Gets all UI component properties
53
+ * * Returns value - object
54
+ * * option(optionName): Gets the value of a single property
55
+ * * @param {optionName} - string
56
+ * * Returns value - any
57
+ * * option(optionName, optionValue): Updates the value of a single property
58
+ * * @param {optionName} - string
59
+ * * @param {optionValue} - any
60
+ * * option(options): Updates the values of several properties
61
+ * * @param {options} - object
62
+ */
63
+ ref: ref
49
64
  };
50
65
  export { CardFooter };
51
66
  export default OptionWrapper(CardFooter);
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import { jsx } from '@emotion/core';
6
6
  import OptionWrapper from "../others/option-wrapper";
7
7
  import Typography from "../typography";
8
- import { classNames } from "../../utils";
8
+ import { classNames, refType as ref } from "../../utils";
9
9
  const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
10
  action = {},
11
11
  children,
@@ -48,7 +48,22 @@ CardHeader.propTypes = {
48
48
  /** If `true`, will have divider between body and footer. */
49
49
  style: PropTypes.object,
50
50
  /** The title of the component's header. */
51
- title: PropTypes.string
51
+ title: PropTypes.string,
52
+ /**
53
+ * ref methods (ref.current.instance.*method*)
54
+ *
55
+ * * option(): Gets all UI component properties
56
+ * * Returns value - object
57
+ * * option(optionName): Gets the value of a single property
58
+ * * @param {optionName} - string
59
+ * * Returns value - any
60
+ * * option(optionName, optionValue): Updates the value of a single property
61
+ * * @param {optionName} - string
62
+ * * @param {optionValue} - any
63
+ * * option(options): Updates the values of several properties
64
+ * * @param {options} - object
65
+ */
66
+ ref: ref
52
67
  };
53
68
  export { CardHeader };
54
69
  export default OptionWrapper(CardHeader);
@@ -10,7 +10,7 @@ import CardHeader from "./header";
10
10
  import { CardFooter } from "./footer";
11
11
  import { CardBody } from "./body";
12
12
  import { getColor } from "../../styles/utils";
13
- import { classNames } from "../../utils";
13
+ import { classNames, refType as ref } from "../../utils";
14
14
  const {
15
15
  colors: {
16
16
  system: {
@@ -173,7 +173,22 @@ Card.propTypes = {
173
173
  /** The title of the component's header. */
174
174
  title: PropTypes.string,
175
175
  /** Width of the component. */
176
- width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
176
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
177
+ /**
178
+ * ref methods (ref.current.instance.*method*)
179
+ *
180
+ * * option(): Gets all UI component properties
181
+ * * Returns value - object
182
+ * * option(optionName): Gets the value of a single property
183
+ * * @param {optionName} - string
184
+ * * Returns value - any
185
+ * * option(optionName, optionValue): Updates the value of a single property
186
+ * * @param {optionName} - string
187
+ * * @param {optionValue} - any
188
+ * * option(options): Updates the values of several properties
189
+ * * @param {options} - object
190
+ */
191
+ ref: ref
177
192
  };
178
193
  export { Card };
179
194
  export default OptionWrapper(Card);
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import { jsx, css } from '@emotion/core';
6
6
  import { ButtonIcon, Typography } from "../";
7
7
  import Icon from "../../icons";
8
- import { itemsCenter, border, boxBorder, flexRow, displayInlineFlex, justifyCenter, positionRelative, userSelectNone, cursorNotAllowed, positionAbsolute, overflowHidden } from "../../styles/general";
8
+ import { itemsCenter, border, boxBorder, flexRow, displayInlineFlex, justifyCenter, positionRelative, userSelectNone, cursorNotAllowed, positionAbsolute, overflowHidden, pointerEventsNone } from "../../styles/general";
9
9
  import { hexToRGBA } from "../../styles/color-helper";
10
10
  import { useTheme, useColor as colors } from "../../theme";
11
11
  const {
@@ -183,6 +183,7 @@ const ChipRootCSS = (onClick, onDbClick, colorProps, info) => css`
183
183
  content: '';
184
184
  width: 100%;
185
185
  height: 100%;
186
+ ${pointerEventsNone};
186
187
  }
187
188
  &:hover::after,
188
189
  &:focus::after {
@@ -5,7 +5,7 @@ import { Button, ButtonIcon, Typography } from "../..";
5
5
  import { getGlobal } from "../../../global";
6
6
  import locale from "../../../locale";
7
7
  import { render } from 'react-dom';
8
- import { bgColor, border, borderRadius, boxBorder, cursorDefault, cursorPointer, displayFlex, flexCol, flexRow, inset, itemsCenter, justifyBetween, mg, mgt, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, parseWidthHeight, pd, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
8
+ import { bgColor, border, borderRadius, boxBorder, cursorDefault, cursorPointer, displayFlex, flexCol, flexRow, insetX, insetY, itemsCenter, justifyBetween, mg, mgt, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, parseWidthHeight, pd, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
9
9
  import { useTheme } from "../../../theme";
10
10
  import { date as moment } from "../../../utils";
11
11
  const {
@@ -131,7 +131,8 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
131
131
  }
132
132
  ::before {
133
133
  ${positionAbsolute};
134
- ${inset('1px -2px')};
134
+ ${insetY(1)};
135
+ ${insetX(-2)};
135
136
  content: '';
136
137
  }
137
138
  }
@@ -511,7 +511,7 @@ const ControlContainerCSS = css`
511
511
  ${mg([0, 4, 4])};
512
512
  `;
513
513
  const PickerCSS = {
514
- backGr: `background-color: transparent; inset: 0px; pointer-events: auto; position: fixed; z-index: ${zIndexCORE(1)};`,
514
+ backGr: `background-color: transparent; top: 0px; bottom: 0px; left: 0px; right: 0px; pointer-events: auto; position: fixed; z-index: ${zIndexCORE(1)};`,
515
515
  picker: (position, positionLeft, width) => css`
516
516
  ${positionFixed};
517
517
  ${borderRadius4px};
@@ -1024,7 +1024,7 @@ const ControlContainerCSS = css`
1024
1024
  const pickerCSS = {
1025
1025
  backGr: `
1026
1026
  background-color: transparent;
1027
- inset: 0px; pointer-events: auto;
1027
+ top: 0px; bottom: 0px; left: 0px; right: 0px; pointer-events: auto;
1028
1028
  position: fixed;
1029
1029
  z-index: ${zIndexCORE(1)};`,
1030
1030
  container: css`
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
7
7
  import { createPortal } from 'react-dom';
8
8
  import { animations } from "../../styles/animation";
9
- import { bgColor, borderRadius, boxBorder, cursorMove, displayFlex, flexCol, flexRow, justifyCenter, left, parseMaxWidthHeight, parseMinWidth, parseWidthHeight, pdt, positionAbsolute, positionRelative, top } from "../../styles/general";
9
+ import { bgColor, borderRadius, boxBorder, cursorMove, displayFlex, flexCol, flexRow, inset, justifyCenter, left, parseMaxWidthHeight, parseMinWidth, parseWidthHeight, pdt, positionAbsolute, positionFixed, positionRelative, top } from "../../styles/general";
10
10
  import { makeStyles, useTheme } from "../../theme";
11
11
  import { classNames, useDelayUnmount } from "../../utils";
12
12
  import ModalContext from "./context";
@@ -49,6 +49,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
49
  const modalBoxRef = useRef(null);
50
50
  const [openState, setOpenState] = useState(open);
51
51
  const showModal = useDelayUnmount(openState, 200);
52
+ const _ModalCSS = ModalCSS(zIndex);
52
53
  const _ModalContainerCSS = ModalContainerCSS(zIndex, alignment, darkTheme);
53
54
  const _ModalBoxCSS = ModalBoxCSS(width, moveable, dragAnyWhere);
54
55
  const onShowModal = () => {
@@ -163,11 +164,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
163
164
  if (showModal) {
164
165
  const node = jsx("div", {
165
166
  className: 'DGN-UI-Portal DGN-UI-Modal',
166
- style: {
167
- position: 'fixed',
168
- zIndex,
169
- inset: 0
170
- }
167
+ css: _ModalCSS
171
168
  }, jsx("div", {
172
169
  id: id,
173
170
  css: _ModalContainerCSS,
@@ -191,6 +188,11 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
191
188
  return null;
192
189
  }, [alignment, autoFocus, children, className, darkTheme, dragAnyWhere, id, moveable, moveOutScreen, onClose, open, pressESCToClose, style, width, zIndex, openState, showModal]);
193
190
  }));
191
+ const ModalCSS = zIndex => css`
192
+ ${positionFixed};
193
+ z-index: ${zIndex};
194
+ ${inset(0)};
195
+ `;
194
196
  const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
195
197
  ${displayFlex};
196
198
  ${flexRow};
@@ -1,10 +1,10 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { useState, forwardRef, useEffect } from 'react';
3
+ import { useState, forwardRef, useEffect, memo } from 'react';
4
4
  import { jsx } from '@emotion/core';
5
5
  import sx from "../../../styles/sx";
6
6
  const OptionWrapper = WrappedComponent => {
7
- return /*#__PURE__*/forwardRef((props, ref) => {
7
+ return /*#__PURE__*/memo( /*#__PURE__*/forwardRef((props, ref) => {
8
8
  const [options, setOptions] = useState({});
9
9
  const option = (option, optionValue) => {
10
10
  if (typeof option === 'undefined') {
@@ -32,6 +32,6 @@ const OptionWrapper = WrappedComponent => {
32
32
  ref: ref,
33
33
  css: sx(props === null || props === void 0 ? void 0 : props.sx)
34
34
  });
35
- });
35
+ }));
36
36
  };
37
37
  export default OptionWrapper;
@@ -273,6 +273,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
273
273
  }
274
274
  };
275
275
  return useMemo(() => {
276
+ var _lastPage$toString;
276
277
  const lastPage = getLastPage(totalItemsState, itemsPerPageState);
277
278
  let listPerPageData = !listPerPageState.includes(itemsPerPageState) ? [{
278
279
  name: itemsPerPageState,
@@ -348,7 +349,8 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
348
349
  placeholder: '',
349
350
  max: lastPage,
350
351
  onKeyDown: checkKeyPress,
351
- onChange: onTypePaging
352
+ onChange: onTypePaging,
353
+ maxDigit: (_lastPage$toString = lastPage.toString()) === null || _lastPage$toString === void 0 ? void 0 : _lastPage$toString.length
352
354
  }), "/", jsx(Typography, {
353
355
  ref: refs => {
354
356
  totalRef.current = refs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
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,12 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.4.8
42
+ - \[Changed\]: Storybook – Update storybook of some components
43
+ - \[Fixed\]: General – Fix bug css inset cannot use on Safari below 14
44
+ - \[Fixed\]: PagingInfo – Fix stretch UI NumberInput
45
+ - \[Fixed\]: Chip – Fix clear button cannot with viewType filled
46
+
41
47
  ## 1.4.7
42
48
  - \[Changed\]: Button – Remove attribute disabled in button tag
43
49
 
package/styles/general.js CHANGED
@@ -208,7 +208,8 @@ const gapY = vl => css`
208
208
  column-gap: ${getSpacing(vl)};
209
209
  `;
210
210
  const inset = vl => css`
211
- inset: ${parseCSSValue(vl)};
211
+ ${insetX(vl)};
212
+ ${insetY(vl)};
212
213
  `;
213
214
  const insetX = vl => css`
214
215
  right: ${parseCSSValue(vl)};
@@ -11,7 +11,7 @@ export const getPortal = () => {
11
11
  if (portal) return portal;
12
12
  const node = document.createElement('div');
13
13
  node.id = idPortal;
14
- node.style.cssText = `position: fixed; inset: 0; pointer-events: none; z-index: ${zIndex()};`;
14
+ node.style.cssText = `position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; pointer-events: none; z-index: ${zIndex()};`;
15
15
  return document.body.appendChild(node);
16
16
  };
17
17
  export const isLastChildNode = node => {