diginet-core-ui 1.3.73-beta.4 → 1.3.73-beta.5

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.
@@ -232,7 +232,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
232
232
  img.alt = '';
233
233
 
234
234
  img.onerror = () => {
235
- setSrcState(null);
235
+ setSrcState(defaultSrc);
236
236
  existed[unique] = false;
237
237
  };
238
238
 
@@ -6,9 +6,9 @@ import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import { ButtonIcon, Typography } from '../';
8
8
  import Icon from '../../icons';
9
- import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, whiteSpaceNoWrap, cursorNotAllowed, positionAbsolute, overflowHidden } from '../../styles/general';
9
+ import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, cursorNotAllowed, positionAbsolute, overflowHidden } from '../../styles/general';
10
10
  import { hexToRGBA } from '../../styles/color-helper';
11
- import { useTheme } from '../../theme';
11
+ import { useTheme, useColor as colors } from '../../theme';
12
12
  const {
13
13
  colors: {
14
14
  danger,
@@ -52,9 +52,10 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
52
52
  const ref = useRef(null);
53
53
  const IconRef = useRef(null);
54
54
  if (!onDbClick && onDoubleClick) onDbClick = onDoubleClick;
55
- const color = colorMap.get(colorProps) || colorProps;
55
+ let color = colorMap.get(colorProps) || colorProps;
56
+ if (colors[color]) color = colors[color];
56
57
  const infoChip = {
57
- color: colorMap.get(colorProps) || colorProps,
58
+ color: color,
58
59
  contentColor: viewType !== 'filled' ? color : white,
59
60
  backgroundColor: viewType !== 'filled' ? white : color,
60
61
  iconSize: iconSizeMap.get(size),
@@ -160,7 +161,6 @@ const ChipLabelCSS = css`
160
161
  ${alignCenter};
161
162
  ${positionRelative};
162
163
  ${userSelectNone};
163
- ${whiteSpaceNoWrap};
164
164
  `;
165
165
 
166
166
  const ChipRootCSS = (onClick, onDbClick, colorProps, info) => css`
@@ -268,7 +268,7 @@ Chip.propTypes = {
268
268
  viewType: PropTypes.oneOf(['ghost', 'outlined', 'filled']),
269
269
 
270
270
  /** color for text or background of Chip */
271
- color: PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']),
271
+ color: PropTypes.oneOfType([PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']), PropTypes.string]),
272
272
 
273
273
  /** size of Chip */
274
274
  size: PropTypes.oneOf(['small', 'medium', 'large']),
@@ -431,11 +431,11 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
431
431
  }
432
432
  }
433
433
 
434
- const trueWidth = width > 320 ? width < 633 ? 633 : width : 320;
434
+ const pickerWidth = window.innerWidth <= 633 ? 300 : 633;
435
435
 
436
- if (left + trueWidth > innerWidth) {
437
- if (innerWidth > trueWidth) {
438
- style.left = (innerWidth - trueWidth) / 2;
436
+ if (left + pickerWidth > innerWidth) {
437
+ if (innerWidth > pickerWidth) {
438
+ style.left = (innerWidth - pickerWidth) / 2;
439
439
  }
440
440
  }
441
441
 
@@ -894,6 +894,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
894
894
  value,
895
895
  data
896
896
  });
897
+ } else {
898
+ // Fix lost icon when select same value
899
+ triggerBlur(false);
897
900
  }
898
901
  }
899
902
 
@@ -1086,7 +1089,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1086
1089
  };
1087
1090
 
1088
1091
  const setSingleValueHandler = (data, keyArr) => {
1089
- const text = keyArr ? renderData(data, keyArr) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr || valueExpr] || data;
1092
+ const text = keyArr ? renderData(data, keyArr) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr] || data[valueExpr] || data;
1090
1093
 
1091
1094
  if (typeof renderSelectedItem === 'function') {
1092
1095
  inputRef.current.innerHTML = '';
@@ -1157,8 +1160,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1157
1160
  return currentRef;
1158
1161
  });
1159
1162
  useEffect(() => {
1160
- setShowClear(clearAble && checkHasValue(valueProp) && !disabled && !readOnly && !loading);
1161
- }, [clearAble, valueProp, disabled, readOnly, loading]);
1163
+ setShowClear(clearAble && checkHasValue(valueProp || defaultValue) && !disabled && !readOnly && !loading);
1164
+ }, [clearAble, valueProp, defaultValue, disabled, readOnly, loading]);
1162
1165
  useEffect(() => {
1163
1166
  if (valueObjectDefault) {
1164
1167
  if (Array.isArray(valueObjectDefault)) {
@@ -1369,7 +1372,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1369
1372
  if (data) {
1370
1373
  var _displayExpr4;
1371
1374
 
1372
- const mask = (_displayExpr4 = displayExpr) === null || _displayExpr4 === void 0 ? void 0 : _displayExpr4.replace(regexBetween, _ => data[_]);
1375
+ const mask = (data === null || data === void 0 ? void 0 : data[displayExpr]) || ((_displayExpr4 = displayExpr) === null || _displayExpr4 === void 0 ? void 0 : _displayExpr4.replace(regexBetween, _ => data[_]));
1373
1376
  text = mask === null || mask === void 0 ? void 0 : mask.replace(regexInclude, '');
1374
1377
  }
1375
1378
 
@@ -0,0 +1,164 @@
1
+ /** @jsxRuntime classic */
2
+
3
+ /** @jsx jsx */
4
+ import { forwardRef, Fragment, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { jsx, css, keyframes } from '@emotion/core';
7
+ import OptionWrapper from '../others/option-wrapper';
8
+ import { useIntersection } from '../../utils/intersectionObserver';
9
+ import { classNames } from '../../utils';
10
+ import AvatarDefault from '../../assets/avatar/default.svg';
11
+ import { alignCenter, inlineFlex, overflowHidden, parseWidthHeight, positionRelative } from '../../styles/general';
12
+ const blurKeyframe = keyframes`
13
+ 0% { -webkit-filter: blur(4px);}
14
+ 25% { -webkit-filter: blur(3px);}
15
+ 50% { -webkit-filter: blur(2px);}
16
+ 75% { -webkit-filter: blur(1px);}
17
+ 100% { -webkit-filter: blur(0px);}
18
+ `;
19
+ const Image = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
20
+ action = {},
21
+ alt,
22
+ circular,
23
+ className,
24
+ defaultSrc,
25
+ height,
26
+ id,
27
+ lazyLoading,
28
+ onError,
29
+ src,
30
+ style,
31
+ width
32
+ }, reference) => {
33
+ if (!defaultSrc) defaultSrc = AvatarDefault;
34
+ const ref = useRef(null);
35
+ const [srcState, setSrcState] = useState(src);
36
+ const [isInView, setIsInView] = useState(false);
37
+ const [onLoaded, setOnLoaded] = useState(false);
38
+ useIntersection(ref, () => {
39
+ setIsInView(true);
40
+ });
41
+
42
+ const _ImageCSS = ImageCSS(width, height, circular);
43
+
44
+ useEffect(() => {
45
+ if (src) {
46
+ if (isInView || !lazyLoading) {
47
+ const img = document.createElement('img');
48
+ img.src = src;
49
+ img.alt = '';
50
+
51
+ img.onerror = () => {
52
+ setSrcState(defaultSrc);
53
+ onError === null || onError === void 0 ? void 0 : onError();
54
+ };
55
+
56
+ img.onload = () => {
57
+ setSrcState(src);
58
+ };
59
+ }
60
+ }
61
+ }, [src]);
62
+ useImperativeHandle(reference, () => {
63
+ const currentRef = ref.current || {};
64
+ currentRef.element = ref.current;
65
+ const _instance = { ...action
66
+ }; // methods
67
+
68
+ _instance.__proto__ = {}; // hidden methods
69
+
70
+ currentRef.instance = _instance;
71
+ return currentRef;
72
+ });
73
+
74
+ const renderImage = () => {
75
+ const defaultImage = jsx("img", {
76
+ src: defaultSrc,
77
+ alt: '',
78
+ style: {
79
+ objectFit: 'cover'
80
+ },
81
+ width: width,
82
+ height: height
83
+ });
84
+ const image = jsx(Fragment, null, !onLoaded && defaultImage, jsx("img", {
85
+ css: blurAnimationCSS,
86
+ src: srcState,
87
+ alt: alt || srcState,
88
+ style: {
89
+ objectFit: 'cover'
90
+ },
91
+ onLoad: () => setOnLoaded(true),
92
+ width: width,
93
+ height: height
94
+ }));
95
+
96
+ if (lazyLoading) {
97
+ return isInView ? image : defaultImage;
98
+ } else return image;
99
+ };
100
+
101
+ return useMemo(() => {
102
+ return jsx("div", {
103
+ ref: ref,
104
+ css: _ImageCSS,
105
+ id: id,
106
+ className: classNames('DGN-UI-Image', className),
107
+ style: style
108
+ }, renderImage());
109
+ }, [alt, circular, className, defaultSrc, height, id, lazyLoading, src, style, width, isInView, onLoaded, srcState]);
110
+ }));
111
+
112
+ const ImageCSS = (width, height, circular) => css`
113
+ ${inlineFlex};
114
+ ${positionRelative};
115
+ ${alignCenter};
116
+ ${overflowHidden};
117
+ ${parseWidthHeight(width, height)};
118
+ ${circular && `border-radius: 50%`};
119
+ `;
120
+
121
+ const blurAnimationCSS = css`
122
+ animation: ${blurKeyframe} 1s ease;
123
+ `;
124
+ Image.defaultProps = {
125
+ circular: false,
126
+ className: '',
127
+ height: 200,
128
+ lazyLoading: false,
129
+ style: {},
130
+ width: 200
131
+ };
132
+ Image.propTypes = {
133
+ /** Image description. */
134
+ alt: PropTypes.string,
135
+
136
+ /** If `true`, image is circular.*/
137
+ circular: PropTypes.bool,
138
+
139
+ /** Class for component. */
140
+ className: PropTypes.string,
141
+
142
+ /** Default img when src error. */
143
+ defaultSrc: PropTypes.string,
144
+
145
+ /** Height of component. */
146
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
147
+
148
+ /** If `true`, lazy loading image.*/
149
+ lazyLoading: PropTypes.bool,
150
+
151
+ /** Callback fired when the src is error. */
152
+ onError: PropTypes.func,
153
+
154
+ /** Image path. */
155
+ src: PropTypes.string,
156
+
157
+ /** Style inline of component. */
158
+ style: PropTypes.object,
159
+
160
+ /** Width of component. */
161
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
162
+ };
163
+ export { Image };
164
+ export default OptionWrapper(Image);
@@ -64,7 +64,9 @@ export { default as Row } from './grid/Row';
64
64
  export { default as Col } from './grid/Col';
65
65
  export { default as Container } from './grid/Container'; //Icon
66
66
 
67
- export { default as Icon } from '../icons/index'; // List
67
+ export { default as Icon } from '../icons/index'; //Image
68
+
69
+ export { default as Image } from './image'; // List
68
70
 
69
71
  export { default as List } from './list/list';
70
72
  export { default as ListItem } from './list/list-item';
@@ -5,16 +5,16 @@ import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import { border, borderBox, displayBlock, overflowAuto, parseWidthHeight, positionRelative } from '../../styles/general';
8
- import { classNames, handleBreakpoints } from '../../utils';
8
+ import { classNames } from '../../utils';
9
9
  import theme from '../../theme/settings';
10
+ import { responsivePaddingCSS } from './header';
10
11
  const {
11
12
  colors: {
12
13
  fill: {
13
14
  'scrollbar-rest': scrollbarRest,
14
15
  'scrollbar-active': scrollbarActive
15
16
  }
16
- },
17
- spacing
17
+ }
18
18
  } = theme;
19
19
  const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
20
20
  action = {},
@@ -63,12 +63,7 @@ const ModalBodyCSS = css`
63
63
  background-color: ${scrollbarActive};
64
64
  }
65
65
  }
66
- ${handleBreakpoints({
67
- xs: 4,
68
- md: 6
69
- }, propValue => {
70
- return `padding: ${spacing([4, propValue])}`;
71
- })}
66
+ ${responsivePaddingCSS};
72
67
  `;
73
68
  ModalBody.defaultProps = {
74
69
  className: '',
@@ -5,11 +5,8 @@ import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import { alignCenter, borderBox, flexRow, justifyEnd, positionRelative } from '../../styles/general';
8
- import theme from '../../theme/settings';
9
- import { classNames, handleBreakpoints } from '../../utils';
10
- const {
11
- spacing
12
- } = theme;
8
+ import { classNames } from '../../utils';
9
+ import { responsivePaddingCSS } from './header';
13
10
  const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
11
  action = {},
15
12
  boxShadow,
@@ -53,12 +50,7 @@ const ModalFooterCSS = boxShadow => css`
53
50
  border-radius: 0px 0px 4px 4px;
54
51
  box-shadow: ${boxShadow};
55
52
  order: 3;
56
- ${handleBreakpoints({
57
- xs: 4,
58
- md: 6
59
- }, propValue => {
60
- return `padding: ${spacing([4, propValue])}`;
61
- })}
53
+ ${responsivePaddingCSS};
62
54
  `;
63
55
 
64
56
  ModalFooter.defaultProps = {
@@ -20,6 +20,12 @@ const {
20
20
  },
21
21
  spacing
22
22
  } = theme;
23
+ export const responsivePaddingCSS = handleBreakpoints({
24
+ xs: 4,
25
+ md: 6
26
+ }, propValue => {
27
+ return `padding: ${spacing([4, propValue])};`;
28
+ });
23
29
  const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
24
30
  action = {},
25
31
  children,
@@ -82,12 +88,7 @@ const ModalHeaderCSS = modal => css`
82
88
  box-shadow: ${smallBoxShadow};
83
89
  cursor: ${modal.onMoveModal ? 'move' : 'inherit'};
84
90
  order: 1;
85
- ${handleBreakpoints({
86
- xs: 4,
87
- md: 6
88
- }, propValue => {
89
- return `padding: ${spacing([4, propValue])}`;
90
- })}
91
+ ${responsivePaddingCSS};
91
92
  `;
92
93
 
93
94
  ModalHeader.defaultProps = {
@@ -8,7 +8,7 @@ import { jsx, css } from '@emotion/core';
8
8
  import OptionWrapper from '../others/option-wrapper';
9
9
  import { borderRadius4px, displayBlock, flexCol, justifyBetween, overflowAuto, parseWidthHeight, positionAbsolute, positionFixed, positionRelative } from '../../styles/general';
10
10
  import theme from '../../theme/settings';
11
- import { classNames, refType as ref } from '../../utils';
11
+ import { classNames, isMobile, refType as ref } from '../../utils';
12
12
  const {
13
13
  colors: {
14
14
  system: {
@@ -155,6 +155,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
155
155
  width,
156
156
  zIndex
157
157
  }, reference) => {
158
+ if (isMobile.any() && trigger === 'hover') trigger = 'click';
158
159
  const ref = useRef(null);
159
160
  const arrowRef = useRef(null);
160
161
  const [openState, setOpenState] = useState(open);
@@ -202,7 +203,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
202
203
 
203
204
  const _anchor = ((_anchor2 = anchor) === null || _anchor2 === void 0 ? void 0 : _anchor2.element) || ((_anchor3 = anchor) === null || _anchor3 === void 0 ? void 0 : (_anchor3$current = _anchor3.current) === null || _anchor3$current === void 0 ? void 0 : _anchor3$current.element) || ((_anchor4 = anchor) === null || _anchor4 === void 0 ? void 0 : _anchor4.current) || anchor;
204
205
 
205
- if (clickOutsideToClose && !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(event === null || event === void 0 ? void 0 : event.target)) && (!fullScreen || (_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && (_ref$current2$parentN = _ref$current2.parentNode) !== null && _ref$current2$parentN !== void 0 && _ref$current2$parentN.contains(event === null || event === void 0 ? void 0 : event.target)) && !(_anchor !== null && _anchor !== void 0 && _anchor.contains(event === null || event === void 0 ? void 0 : event.target)) && openState) {
206
+ if (clickOutsideToClose && !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains((event === null || event === void 0 ? void 0 : event.toElement) || (event === null || event === void 0 ? void 0 : event.target))) && (!fullScreen || (_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && (_ref$current2$parentN = _ref$current2.parentNode) !== null && _ref$current2$parentN !== void 0 && _ref$current2$parentN.contains(event === null || event === void 0 ? void 0 : event.target)) && !(_anchor !== null && _anchor !== void 0 && _anchor.contains((event === null || event === void 0 ? void 0 : event.toElement) || (event === null || event === void 0 ? void 0 : event.target))) && openState) {
206
207
  onClosePopover();
207
208
  }
208
209
  };
@@ -418,12 +419,11 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
418
419
  cb === null || cb === void 0 ? void 0 : cb();
419
420
  };
420
421
 
421
- const handleEventTrigger = () => {
422
+ const handleEventTrigger = e => {
422
423
  if (!openState) {
423
- setOpenState(true);
424
+ onOpenPopover();
424
425
  } else {
425
- onClose && onClose();
426
- setOpenState(false);
426
+ onClickOutside(e);
427
427
  }
428
428
  };
429
429
 
@@ -466,6 +466,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
466
466
  document.addEventListener('click', onClickOutside); // Update position popover on resize
467
467
 
468
468
  window.addEventListener('resize', updatePositionPopover);
469
+ if (trigger === 'hover') ref.current.addEventListener('mouseleave', handleEventTrigger, false);
469
470
  return () => {
470
471
  if (pressESCToClose) {
471
472
  document.removeEventListener('keydown', pressESCHandler);
@@ -473,6 +474,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
473
474
 
474
475
  document.removeEventListener('click', onClickOutside);
475
476
  window.removeEventListener('resize', updatePositionPopover);
477
+ if (trigger === 'hover' && ref.current) ref.current.removeEventListener('mouseleave', handleEventTrigger, false);
476
478
  };
477
479
  } else if (!openState) {
478
480
  document.documentElement.style.overflow = 'auto';
@@ -488,7 +490,10 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
488
490
  const currentRef = ref.current || {};
489
491
  currentRef.element = ref.current;
490
492
  const _instance = {
491
- show: el => !openState && el ? updatePositionPopover(el, onOpenPopover()) : onOpenPopover(),
493
+ show: el => {
494
+ if (el) setElement(el);
495
+ !openState && el ? updatePositionPopover(el, onOpenPopover()) : onOpenPopover();
496
+ },
492
497
  close: () => onClosePopover(),
493
498
  setPosition: el => updatePositionPopover(el),
494
499
  ...action
@@ -500,7 +505,10 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
500
505
 
501
506
  currentRef.instance = _instance;
502
507
 
503
- currentRef.show = el => !openState && el ? updatePositionPopover(el, onOpenPopover()) : onOpenPopover();
508
+ currentRef.show = el => {
509
+ if (el) setElement(el);
510
+ !openState && el ? updatePositionPopover(el, onOpenPopover()) : onOpenPopover();
511
+ };
504
512
 
505
513
  currentRef.close = onClosePopover;
506
514
 
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import { forwardRef, memo, useMemo, useRef } from 'react';
9
9
  import theme from '../../theme/settings';
10
10
  import { typography } from '../../styles/typography';
11
+ import { useColor as colors } from '../../theme';
11
12
 
12
13
  const validatePercent = percent => {
13
14
  let per = +percent.toString().replace('%', '');
@@ -341,21 +342,27 @@ const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
341
342
  direction,
342
343
  duration,
343
344
  percent,
344
- percentColor,
345
+ percentColor: percentColorProp,
345
346
  showValue,
347
+ color: colorProp,
346
348
  ...props
347
349
  }, ref) => {
348
350
  if (!ref) ref = useRef(null);
351
+ const color = colors[colorProp] || colorProp;
352
+ const percentColor = colors[percentColorProp] || percentColorProp;
349
353
  return determinate ? jsx(DeterminateCircularProgress, {
354
+ ref: ref,
355
+ color: color,
350
356
  direction: direction,
351
357
  duration: duration,
352
358
  percent: percent,
353
359
  percentColor: percentColor,
354
360
  showValue: true,
355
- ...props,
356
- ref: ref
357
- }) : jsx(IndeterminateCircularProgress, { ...props,
358
- ref: ref
361
+ ...props
362
+ }) : jsx(IndeterminateCircularProgress, {
363
+ ref: ref,
364
+ color: color,
365
+ ...props
359
366
  });
360
367
  }));
361
368
  CircularProgress.defaultProps = {
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import React, { forwardRef, useState, memo, useEffect, useRef, useImperativeHandle } from 'react';
4
+ import React, { forwardRef, useState, memo, useEffect, useRef, useImperativeHandle, useMemo } from 'react';
5
5
  import { jsx, css } from '@emotion/core';
6
6
  import PropTypes from 'prop-types';
7
7
  import { classNames, randomString, refType as ref } from '../../utils';
@@ -48,22 +48,24 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
48
  currentRef.instance = _instance;
49
49
  return currentRef;
50
50
  });
51
- return jsx("div", {
52
- css: _TabContainerCSS,
53
- ref: ref,
54
- id: `DGN-${id}-tab-button-container`,
55
- className: classNames('DGN-UI-Tab-Container', className),
56
- style: style,
57
- ...props
58
- }, jsx(TabContext.Provider, {
59
- value: {
60
- tabIndexState,
61
- setTabIndexState,
62
- direction
63
- }
64
- }, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
65
- level
66
- }))));
51
+ return useMemo(() => {
52
+ return jsx("div", {
53
+ css: _TabContainerCSS,
54
+ ref: ref,
55
+ id: `DGN-${id}-tab-button-container`,
56
+ className: classNames('DGN-UI-Tab-Container', className),
57
+ style: style,
58
+ ...props
59
+ }, jsx(TabContext.Provider, {
60
+ value: {
61
+ tabIndexState,
62
+ setTabIndexState,
63
+ direction
64
+ }
65
+ }, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
66
+ level
67
+ }))));
68
+ }, [children, className, direction, level, props, style, tabIndex, width, tabIndexState, value]);
67
69
  }));
68
70
 
69
71
  const TabContainerCSS = (direction, width) => css`
@@ -105,8 +107,8 @@ TabContainer.propTypes = {
105
107
  /** Any props else. */
106
108
  props: PropTypes.any,
107
109
 
108
- /**
109
- * Ref methods.
110
+ /**
111
+ * Ref methods.
110
112
  */
111
113
  reference: ref
112
114
  };
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import React, { memo, forwardRef, useContext, useRef, useState, useImperativeHandle } from 'react';
4
+ import React, { memo, forwardRef, useContext, useRef, useState, useImperativeHandle, useMemo } from 'react';
5
5
  import { jsx, css } from '@emotion/core';
6
6
  import PropTypes from 'prop-types';
7
7
  import TabContext from './context';
@@ -10,11 +10,6 @@ import { borderBox, displayNone, flexCol, flexRow, justifyCenter, overflowHidden
10
10
  import { classNames, refType as ref } from '../../utils';
11
11
  import theme from '../../theme/settings';
12
12
  const {
13
- colors: {
14
- line: {
15
- tab
16
- }
17
- },
18
13
  spacing
19
14
  } = theme;
20
15
  const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
@@ -63,40 +58,42 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
63
58
  currentRef.instance = _instance;
64
59
  return currentRef;
65
60
  });
66
- return jsx("div", {
67
- css: _ContainerCSS,
68
- id: `DGN-control`,
69
- className: classNames('DGN-UI-Tab-Header-Container', className),
70
- style: style,
71
- ...props
72
- }, scrollButtons && !isVertical && jsx(ButtonIcon, {
73
- css: scrollLeftButtonCSS,
74
- name: isVertical ? 'ArrowUp' : 'ArrowLeft',
75
- viewType: 'text',
76
- size: 'tiny',
77
- viewBox: true,
78
- disabled: !showScrollLeftButton,
79
- onClick: () => _onClickScrollButton(true)
80
- }), jsx("div", {
81
- css: _TabHeaderCSS,
82
- className: 'DGN-UI-Tab-Header',
83
- ref: ref,
84
- onScroll: e => {
85
- var _e$target;
86
-
87
- return scrollButtons && setScrollLeft((e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.scrollLeft) || 0);
88
- }
89
- }, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
90
- level
91
- }))), scrollButtons && !isVertical && jsx(ButtonIcon, {
92
- css: scrollRightButtonCSS,
93
- name: isVertical ? 'ArrowDown' : 'ArrowRight',
94
- viewType: 'text',
95
- size: 'tiny',
96
- viewBox: true,
97
- disabled: !showScrollRightButton,
98
- onClick: () => _onClickScrollButton(false)
99
- }));
61
+ return useMemo(() => {
62
+ return jsx("div", {
63
+ css: _ContainerCSS,
64
+ id: `DGN-control`,
65
+ className: classNames('DGN-UI-Tab-Header-Container', className),
66
+ style: style,
67
+ ...props
68
+ }, scrollButtons && !isVertical && jsx(ButtonIcon, {
69
+ css: scrollLeftButtonCSS,
70
+ name: isVertical ? 'ArrowUp' : 'ArrowLeft',
71
+ viewType: 'text',
72
+ size: 'tiny',
73
+ viewBox: true,
74
+ disabled: !showScrollLeftButton,
75
+ onClick: () => _onClickScrollButton(true)
76
+ }), jsx("div", {
77
+ css: _TabHeaderCSS,
78
+ className: 'DGN-UI-Tab-Header',
79
+ ref: ref,
80
+ onScroll: e => {
81
+ var _e$target;
82
+
83
+ return scrollButtons && setScrollLeft((e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.scrollLeft) || 0);
84
+ }
85
+ }, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
86
+ level
87
+ }))), scrollButtons && !isVertical && jsx(ButtonIcon, {
88
+ css: scrollRightButtonCSS,
89
+ name: isVertical ? 'ArrowDown' : 'ArrowRight',
90
+ viewType: 'text',
91
+ size: 'tiny',
92
+ viewBox: true,
93
+ disabled: !showScrollRightButton,
94
+ onClick: () => _onClickScrollButton(false)
95
+ }));
96
+ }, [centered, children, className, level, props, scrollButtons, style, width, direction, isVertical, scrollLeft]);
100
97
  }));
101
98
 
102
99
  const ContainerCSS = (centered, isVertical, width) => css`
@@ -109,7 +106,6 @@ const ContainerCSS = (centered, isVertical, width) => css`
109
106
  flex-direction: ${isVertical ? 'column' : 'row'};
110
107
  max-width: ${isVertical ? 'max-content' : '100%'};
111
108
  padding: 0;
112
- ${isVertical ? `border-right: solid 1px ${tab}` : `border-bottom: solid 1px ${tab}`};
113
109
  `;
114
110
 
115
111
  const TabHeaderCSS = (isVertical, width) => isVertical ? css`
@@ -173,8 +169,8 @@ TabHeader.propTypes = {
173
169
  /** Any props else. */
174
170
  props: PropTypes.any,
175
171
 
176
- /**
177
- * Ref methods.
172
+ /**
173
+ * Ref methods.
178
174
  */
179
175
  reference: ref
180
176
  };
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import { memo, forwardRef, useContext, useRef, useEffect, useState, useImperativeHandle } from 'react';
4
+ import { memo, forwardRef, useContext, useRef, useEffect, useState, useImperativeHandle, useMemo } from 'react';
5
5
  import { jsx, css } from '@emotion/core';
6
6
  import PropTypes from 'prop-types';
7
7
  import TabContext from './context';
@@ -50,16 +50,18 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
50
50
  currentRef.instance = _instance;
51
51
  return currentRef;
52
52
  });
53
- return jsx("div", {
54
- css: _TabPanelCSS,
55
- ref: ref,
56
- role: 'tab-panel',
57
- "aria-labelledby": `tab-${index}`,
58
- id: `tab-panel-${index}`,
59
- className: classNames('DGN-UI-Tab-Panel', className),
60
- style: style,
61
- ...props
62
- }, isActive || !lazyLoading || isRendered ? children : null);
53
+ return useMemo(() => {
54
+ return jsx("div", {
55
+ css: _TabPanelCSS,
56
+ ref: ref,
57
+ role: 'tab-panel',
58
+ "aria-labelledby": `tab-${index}`,
59
+ id: `tab-panel-${index}`,
60
+ className: classNames('DGN-UI-Tab-Panel', className),
61
+ style: style,
62
+ ...props
63
+ }, isActive || !lazyLoading || isRendered ? children : null);
64
+ }, [children, className, index, lazyLoading, props, style, isActive, isRendered, tabIndexState]);
63
65
  }));
64
66
 
65
67
  const TabPanelCSS = (isVertical, isActive) => css`
@@ -96,8 +98,8 @@ TabPanel.propTypes = {
96
98
  /** Any props else. */
97
99
  props: PropTypes.any,
98
100
 
99
- /**
100
- * Ref methods.
101
+ /**
102
+ * Ref methods.
101
103
  */
102
104
  reference: ref
103
105
  };
@@ -32,6 +32,7 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
32
32
  endIcon,
33
33
  index,
34
34
  label,
35
+ labelProps,
35
36
  level,
36
37
  onClick,
37
38
  startIcon,
@@ -95,20 +96,22 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
95
96
  className: 'end-icon'
96
97
  }, ' ', node, ' ');
97
98
  }, [endIcon]);
98
- return jsx("div", {
99
- css: _TabButtonCSS,
100
- ref: ref,
101
- className: classNames('DGN-UI-Tab-Item', disabled && 'disabled', index === tabIndexState && !disabled && 'selected', className),
102
- style: style,
103
- onClick: _onClick,
104
- ...props
105
- }, startIcon && StartIcon, jsx(Typography, {
106
- type: level,
107
- color: 'inherit'
108
- }, label), children, endIcon && EndIcon, jsx(Ripple, null), jsx("span", {
109
- css: _IndicatorCSS,
110
- className: 'Indicator'
111
- }));
99
+ return useMemo(() => {
100
+ return jsx("div", {
101
+ css: _TabButtonCSS,
102
+ ref: ref,
103
+ className: classNames('DGN-UI-Tab-Item', disabled && 'disabled', index === tabIndexState && !disabled && 'selected', className),
104
+ style: style,
105
+ onClick: _onClick,
106
+ ...props
107
+ }, startIcon && StartIcon, jsx(Typography, { ...labelProps,
108
+ type: level,
109
+ color: 'inherit'
110
+ }, label), children, endIcon && EndIcon, jsx(Ripple, null), jsx("span", {
111
+ css: _IndicatorCSS,
112
+ className: 'Indicator'
113
+ }));
114
+ }, [children, className, color, disabled, endIcon, index, label, labelProps, level, onClick, props, startIcon, style, isVertical, tabIndexState]);
112
115
  }));
113
116
 
114
117
  const TabButtonCSS = (color, isVertical) => css`
@@ -128,7 +131,7 @@ const TabButtonCSS = (color, isVertical) => css`
128
131
  background-color: ${white};
129
132
  border: 0;
130
133
  color: ${colors[color] || color || rest};
131
- max-width: 320px;
134
+ max-width: ${isVertical ? '100%' : '287px'};
132
135
  min-width: 80px;
133
136
  padding: ${isVertical ? spacing([3.5, 4]) : spacing([2.5, 4])};
134
137
  pointer-events: auto;
@@ -211,6 +214,9 @@ TabItem.propTypes = {
211
214
  /** Data string, if any. */
212
215
  label: PropTypes.string,
213
216
 
217
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/typography--title) applied to the `Typography` label. */
218
+ labelProps: PropTypes.object,
219
+
214
220
  /** Callback fired when a "click" event is detected. */
215
221
  onClick: PropTypes.func,
216
222
 
@@ -223,8 +229,8 @@ TabItem.propTypes = {
223
229
  /** Any props else. */
224
230
  props: PropTypes.any,
225
231
 
226
- /**
227
- * Ref methods.
232
+ /**
233
+ * Ref methods.
228
234
  */
229
235
  reference: ref
230
236
  };
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { randomString } from '../../utils';
8
8
  import { jsx, css } from '@emotion/core';
9
- import { borderBox, borderRadius4px, displayInlineBlock, flexRow, parseHeight, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
9
+ import { borderBox, borderRadius4px, displayInlineBlock, flexRow, parseWidthHeight, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
10
10
  import theme from '../../theme/settings';
11
11
  const {
12
12
  colors: {
@@ -499,8 +499,7 @@ const ContainerCSS = css`
499
499
  ${flexRow};
500
500
  ${positionRelative};
501
501
  ${borderBox};
502
- ${parseHeight('max-content')};
503
- width: auto;
502
+ ${parseWidthHeight('fit-content', 'fit-content')};
504
503
  `;
505
504
  const ArrowCSS = css`
506
505
  ${positionAbsolute};
@@ -113,7 +113,8 @@ const Typography = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
113
113
  className: classes(true),
114
114
  style: {
115
115
  color: textTooltip,
116
- padding: spacing([1, 1.5])
116
+ padding: spacing([1, 1.5]),
117
+ height: 'fit-content'
117
118
  }
118
119
  }));
119
120
  }, [openTooltip, capitalize, center, children, className, color, fullWidth, hoverTooltip, lineClamp, mapping, onClick, tooltipDirection, type, uppercase]);
package/icons/basic.js CHANGED
@@ -2318,6 +2318,34 @@ export const First = /*#__PURE__*/memo(({
2318
2318
  fill: colors[color] || color
2319
2319
  }));
2320
2320
  });
2321
+ export const FiveSquare = /*#__PURE__*/memo(({
2322
+ width,
2323
+ height,
2324
+ color = '#7F828E',
2325
+ viewBox = false
2326
+ }) => {
2327
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
2328
+ width: width || 24,
2329
+ height: height || 24,
2330
+ viewBox: "0 0 24 24",
2331
+ fill: "none"
2332
+ }, /*#__PURE__*/React.createElement("path", {
2333
+ fillRule: "evenodd",
2334
+ clipRule: "evenodd",
2335
+ d: "M5 3H19C20.1 3 21 3.9 21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3ZM11 9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9Z",
2336
+ fill: colors[color] || color
2337
+ })) : /*#__PURE__*/React.createElement("svg", {
2338
+ width: width || 18,
2339
+ height: height || 18,
2340
+ viewBox: "0 0 18 18",
2341
+ fill: "none"
2342
+ }, /*#__PURE__*/React.createElement("path", {
2343
+ fillRule: "evenodd",
2344
+ clipRule: "evenodd",
2345
+ d: "M2 0H16C17.1 0 18 0.9 18 2V16C18 17.1 17.1 18 16 18H2C0.9 18 0 17.1 0 16V2C0 0.9 0.9 0 2 0ZM8 6H12V4H6V10H10V12H6V14H10C11.1 14 12 13.11 12 12V10C12 8.89 11.1 8 10 8H8V6Z",
2346
+ fill: colors[color] || color
2347
+ }));
2348
+ });
2321
2349
  export const Flag = /*#__PURE__*/memo(({
2322
2350
  width,
2323
2351
  height,
@@ -2396,6 +2424,34 @@ export const FolderInsurance = /*#__PURE__*/memo(({
2396
2424
  fill: colors[color] || color
2397
2425
  }));
2398
2426
  });
2427
+ export const FourSquare = /*#__PURE__*/memo(({
2428
+ width,
2429
+ height,
2430
+ color = '#7F828E',
2431
+ viewBox = false
2432
+ }) => {
2433
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
2434
+ width: width || 24,
2435
+ height: height || 24,
2436
+ viewBox: "0 0 24 24",
2437
+ fill: "none"
2438
+ }, /*#__PURE__*/React.createElement("path", {
2439
+ fillRule: "evenodd",
2440
+ clipRule: "evenodd",
2441
+ d: "M4.83846 3H18.2785C19.3345 3 20.1985 3.9 20.1985 5V19C20.1985 20.1 19.3345 21 18.2785 21H4.83846C3.78246 21 2.91846 20.1 2.91846 19V5C2.91846 3.9 3.78246 3 4.83846 3ZM12.5185 17H14.4385V7H12.5185V11H10.5985V7H8.67846V13H12.5185V17Z",
2442
+ fill: colors[color] || color
2443
+ })) : /*#__PURE__*/React.createElement("svg", {
2444
+ width: width || 18,
2445
+ height: height || 18,
2446
+ viewBox: "0 0 18 18",
2447
+ fill: "none"
2448
+ }, /*#__PURE__*/React.createElement("path", {
2449
+ fillRule: "evenodd",
2450
+ clipRule: "evenodd",
2451
+ d: "M2.83846 0H16.2785C17.3345 0 18.1985 0.9 18.1985 2V16C18.1985 17.1 17.3345 18 16.2785 18H2.83846C1.78246 18 0.918457 17.1 0.918457 16V2C0.918457 0.9 1.78246 0 2.83846 0ZM10.5185 14H12.4385V4H10.5185V8H8.59846V4H6.67846V10H10.5185V14Z",
2452
+ fill: colors[color] || color
2453
+ }));
2454
+ });
2399
2455
  export const Gavel = /*#__PURE__*/memo(({
2400
2456
  width,
2401
2457
  height,
@@ -3804,6 +3860,34 @@ export const NotificationV2 = /*#__PURE__*/memo(({
3804
3860
  fill: colors[color] || color
3805
3861
  }));
3806
3862
  });
3863
+ export const OneSquare = /*#__PURE__*/memo(({
3864
+ width,
3865
+ height,
3866
+ color = '#7F828E',
3867
+ viewBox = false
3868
+ }) => {
3869
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
3870
+ width: width || 24,
3871
+ height: height || 24,
3872
+ viewBox: "0 0 24 24",
3873
+ fill: "none"
3874
+ }, /*#__PURE__*/React.createElement("path", {
3875
+ fillRule: "evenodd",
3876
+ clipRule: "evenodd",
3877
+ d: "M5 3H19C20.1 3 21 3.9 21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3ZM12 17H14V7H10V9H12V17Z",
3878
+ fill: colors[color] || color
3879
+ })) : /*#__PURE__*/React.createElement("svg", {
3880
+ width: width || 18,
3881
+ height: height || 18,
3882
+ viewBox: "0 0 18 18",
3883
+ fill: "none"
3884
+ }, /*#__PURE__*/React.createElement("path", {
3885
+ fillRule: "evenodd",
3886
+ clipRule: "evenodd",
3887
+ d: "M2 0H16C17.1 0 18 0.9 18 2V16C18 17.1 17.1 18 16 18H2C0.9 18 0 17.1 0 16V2C0 0.9 0.9 0 2 0ZM9 14H11V4H7V6H9V14Z",
3888
+ fill: colors[color] || color
3889
+ }));
3890
+ });
3807
3891
  export const Undo = /*#__PURE__*/memo(({
3808
3892
  width,
3809
3893
  height,
@@ -5613,6 +5697,34 @@ export const SyncHorizontal = /*#__PURE__*/memo(({
5613
5697
  fill: colors[color] || color
5614
5698
  }));
5615
5699
  });
5700
+ export const ThreeSquare = /*#__PURE__*/memo(({
5701
+ width,
5702
+ height,
5703
+ color = '#7F828E',
5704
+ viewBox = false
5705
+ }) => {
5706
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
5707
+ width: width || 24,
5708
+ height: height || 24,
5709
+ viewBox: "0 0 24 24",
5710
+ fill: "none"
5711
+ }, /*#__PURE__*/React.createElement("path", {
5712
+ fillRule: "evenodd",
5713
+ clipRule: "evenodd",
5714
+ d: "M5.01001 3H19.01C20.11 3 21 3.9 21 5V19C21 20.1 20.11 21 19.01 21H5.01001C3.91001 21 3.01001 20.1 3.01001 19V5C3.01001 3.9 3.91001 3 5.01001 3ZM13.51 12C14.34 12 15.01 11.33 15.01 10.5V9C15.01 7.89 14.11 7 13.01 7H9.00001V9H13V11H11V13H13V15H9.00001V17H13.01C14.11 17 15.01 16.11 15.01 15V13.5C15.01 12.67 14.34 12 13.51 12Z",
5715
+ fill: colors[color] || color
5716
+ })) : /*#__PURE__*/React.createElement("svg", {
5717
+ width: width || 18,
5718
+ height: height || 18,
5719
+ viewBox: "0 0 18 18",
5720
+ fill: "none"
5721
+ }, /*#__PURE__*/React.createElement("path", {
5722
+ fillRule: "evenodd",
5723
+ clipRule: "evenodd",
5724
+ d: "M2.01001 0H16.01C17.11 0 18 0.9 18 2V16C18 17.1 17.11 18 16.01 18H2.01001C0.91001 18 0.0100098 17.1 0.0100098 16V2C0.0100098 0.9 0.91001 0 2.01001 0ZM10.51 9C11.34 9 12.01 8.33 12.01 7.5V6C12.01 4.89 11.11 4 10.01 4H6.00001V6H10V8H8.00001V10H10V12H6.00001V14H10.01C11.11 14 12.01 13.11 12.01 12V10.5C12.01 9.67 11.34 9 10.51 9Z",
5725
+ fill: colors[color] || color
5726
+ }));
5727
+ });
5616
5728
  export const Touch = /*#__PURE__*/memo(({
5617
5729
  width,
5618
5730
  height,
@@ -5697,6 +5809,34 @@ export const Treeview = /*#__PURE__*/memo(({
5697
5809
  fill: colors[color] || color
5698
5810
  }));
5699
5811
  });
5812
+ export const TwoSquare = /*#__PURE__*/memo(({
5813
+ width,
5814
+ height,
5815
+ color = '#7F828E',
5816
+ viewBox = false
5817
+ }) => {
5818
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
5819
+ width: width || 24,
5820
+ height: height || 24,
5821
+ viewBox: "0 0 24 24",
5822
+ fill: "none"
5823
+ }, /*#__PURE__*/React.createElement("path", {
5824
+ fillRule: "evenodd",
5825
+ clipRule: "evenodd",
5826
+ d: "M5 3H19C20.1 3 21 3.9 21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3ZM13 13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15H11V13H13Z",
5827
+ fill: colors[color] || color
5828
+ })) : /*#__PURE__*/React.createElement("svg", {
5829
+ width: width || 18,
5830
+ height: height || 18,
5831
+ viewBox: "0 0 18 18",
5832
+ fill: "none"
5833
+ }, /*#__PURE__*/React.createElement("path", {
5834
+ fillRule: "evenodd",
5835
+ clipRule: "evenodd",
5836
+ d: "M2 0H16C17.1 0 18 0.9 18 2V16C18 17.1 17.1 18 16 18H2C0.9 18 0 17.1 0 16V2C0 0.9 0.9 0 2 0ZM10 10C11.1 10 12 9.11 12 8V6C12 4.89 11.1 4 10 4H6V6H10V8H8C6.9 8 6 8.89 6 10V14H12V12H8V10H10Z",
5837
+ fill: colors[color] || color
5838
+ }));
5839
+ });
5700
5840
  export const View = /*#__PURE__*/memo(({
5701
5841
  width,
5702
5842
  height,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.73-beta.4",
3
+ "version": "1.3.73-beta.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/theme/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { default as ThemeProvider } from './theme-provider';
2
- export { useTheme } from './set-theme';
2
+ export { useTheme, useColor } from './set-theme';
3
3
  export { default as makeStyles } from './make-styles';
@@ -36,4 +36,5 @@ export const setTheme = theme => {
36
36
  });
37
37
  }
38
38
  };
39
- export const useTheme = () => Settings;
39
+ export const useTheme = () => Settings;
40
+ export const useColor = Settings.colors;
package/utils/index.js CHANGED
@@ -24,4 +24,6 @@ export { default as refType } from './refType';
24
24
  export * from './sb-template';
25
25
  export { default as SbTemplate } from './sb-template';
26
26
  export { default as handleBreakpoints } from './handleBreakpoints';
27
+ export { default as useMediaQuery } from './useMediaQuery';
28
+ export { default as isMobile } from './isMobile';
27
29
  export default utils;
@@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'; // Usage:
4
4
  // return <div>{`The view port is ${matches ? 'at least' : 'less than'} 768 pixels wide`}</div>;
5
5
  // }
6
6
 
7
- export const useMediaQuery = query => {
7
+ const useMediaQuery = query => {
8
8
  const getMatches = query => {
9
9
  // Prevents SSR issues
10
10
  if (typeof window !== 'undefined') {
@@ -41,4 +41,6 @@ export const useMediaQuery = query => {
41
41
  };
42
42
  }, [query]);
43
43
  return matches;
44
- };
44
+ };
45
+
46
+ export default useMediaQuery;