diginet-core-ui 1.3.90-beta.4 → 1.3.90-beta.6
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.
- package/components/button/icon.js +21 -21
- package/components/form-control/date-picker/index.js +28 -62
- package/components/form-control/date-range-picker/index.js +18 -47
- package/components/form-control/number-input/index2.js +18 -18
- package/components/form-control/radio/index.js +5 -5
- package/components/form-control/toggle/index.js +4 -4
- package/components/popup/v2/index.js +2 -2
- package/components/rating/index.js +8 -8
- package/components/tab/tab-container.js +2 -2
- package/components/tab/tab-header.js +2 -2
- package/components/tab/tab-panel.js +2 -2
- package/components/tab/tab.js +2 -2
- package/components/transfer/index.js +3 -3
- package/components/typography/index.js +12 -12
- package/package.json +1 -1
- package/styles/general.js +2 -2
- package/styles/utils.js +15 -15
|
@@ -321,14 +321,14 @@ ButtonIcon.propTypes = {
|
|
|
321
321
|
onClick: PropTypes.func,
|
|
322
322
|
/** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
|
|
323
323
|
name: PropTypes.string,
|
|
324
|
-
/**
|
|
325
|
-
* The size of the component.
|
|
326
|
-
*
|
|
327
|
-
* * tiny (button 24px, icon 16px)
|
|
328
|
-
* * small (button 32px, icon 20px)
|
|
329
|
-
* * medium (button 40px, icon 24px)
|
|
330
|
-
* * large (button 48px, icon 32px)
|
|
331
|
-
* * giant (button 56px, icon 40px)
|
|
324
|
+
/**
|
|
325
|
+
* The size of the component.
|
|
326
|
+
*
|
|
327
|
+
* * tiny (button 24px, icon 16px)
|
|
328
|
+
* * small (button 32px, icon 20px)
|
|
329
|
+
* * medium (button 40px, icon 24px)
|
|
330
|
+
* * large (button 48px, icon 32px)
|
|
331
|
+
* * giant (button 56px, icon 40px)
|
|
332
332
|
* */
|
|
333
333
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant', 'extraGiant']),
|
|
334
334
|
/** Style inline of component. */
|
|
@@ -339,19 +339,19 @@ ButtonIcon.propTypes = {
|
|
|
339
339
|
viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
|
|
340
340
|
/** Width of the component. */
|
|
341
341
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
342
|
-
/**
|
|
343
|
-
* ref methods (ref.current.instance.*method*)
|
|
344
|
-
*
|
|
345
|
-
* * option(): Gets all UI component properties
|
|
346
|
-
* * Returns value - object
|
|
347
|
-
* * option(optionName): Gets the value of a single property
|
|
348
|
-
* * @param {optionName} - string
|
|
349
|
-
* * Returns value - any
|
|
350
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
351
|
-
* * @param {optionName} - string
|
|
352
|
-
* * @param {optionValue} - any
|
|
353
|
-
* * option(options): Updates the values of several properties
|
|
354
|
-
* * @param {options} - object
|
|
342
|
+
/**
|
|
343
|
+
* ref methods (ref.current.instance.*method*)
|
|
344
|
+
*
|
|
345
|
+
* * option(): Gets all UI component properties
|
|
346
|
+
* * Returns value - object
|
|
347
|
+
* * option(optionName): Gets the value of a single property
|
|
348
|
+
* * @param {optionName} - string
|
|
349
|
+
* * Returns value - any
|
|
350
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
351
|
+
* * @param {optionName} - string
|
|
352
|
+
* * @param {optionValue} - any
|
|
353
|
+
* * option(options): Updates the values of several properties
|
|
354
|
+
* * @param {options} - object
|
|
355
355
|
*/
|
|
356
356
|
reference: ref
|
|
357
357
|
};
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
|
|
4
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { Button, ButtonIcon, HelperText, InputBase, Label, Tooltip } from "../..";
|
|
5
|
+
import { getGlobal } from "../../../global";
|
|
6
|
+
import locale from "../../../locale";
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
9
|
import { render } from 'react-dom';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexRow, itemsCenter, justifyEnd, left, mg, parseMaxWidth, parseMinWidth, parseWidthHeight, positionFixed, scale, top, z } from "../../../styles/general";
|
|
11
|
+
import { useTheme } from "../../../theme";
|
|
12
|
+
import { capitalizeSentenceCase, date as moment, randomString, updatePosition } from "../../../utils";
|
|
10
13
|
import CalendarComp from "../calendar";
|
|
11
|
-
import ControlComp from "../control";
|
|
12
|
-
import { ButtonIcon, HelperText, InputBase, Label } from "../../index";
|
|
13
|
-
import Button from "../../button";
|
|
14
|
-
import Tooltip from "../../tooltip";
|
|
15
14
|
import { isValidDate } from "../calendar/function";
|
|
16
|
-
import
|
|
17
|
-
import theme from "../../../theme/settings";
|
|
15
|
+
import ControlComp from "../control";
|
|
18
16
|
const {
|
|
19
|
-
colors: {
|
|
20
|
-
system: {
|
|
21
|
-
white
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
spacing,
|
|
25
17
|
zIndex: zIndexCORE
|
|
26
|
-
} =
|
|
18
|
+
} = useTheme();
|
|
27
19
|
const confirmText = getGlobal(['confirm']);
|
|
28
20
|
const cancelText = getGlobal(['cancel']);
|
|
29
21
|
const formatValue = (value, format, utc = false) => {
|
|
30
22
|
return moment(value).format(format, utc);
|
|
31
23
|
};
|
|
32
24
|
const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
25
|
+
action = {},
|
|
33
26
|
actionIconAt,
|
|
34
27
|
clearAble,
|
|
35
28
|
controls,
|
|
@@ -153,16 +146,6 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
153
146
|
}
|
|
154
147
|
return PickerCSS.picker(style, left + 400 > innerWidth ? innerWidth - 400 : left, width).styles;
|
|
155
148
|
};
|
|
156
|
-
// const createPortal = () => {
|
|
157
|
-
// let portal = document.getElementById(unique.portal);
|
|
158
|
-
// if (!portal) {
|
|
159
|
-
// portal = document.createElement('div');
|
|
160
|
-
// portal.id = unique.portal;
|
|
161
|
-
// document.body.appendChild(portal);
|
|
162
|
-
// }
|
|
163
|
-
// portal.style.cssText = pickerCSS.portal;
|
|
164
|
-
// return portal;
|
|
165
|
-
// };
|
|
166
149
|
const createBackground = () => {
|
|
167
150
|
let background = document.getElementById(unique.backGr);
|
|
168
151
|
if (!background) {
|
|
@@ -256,26 +239,6 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
256
239
|
// iconRef.current && onSwap(true);
|
|
257
240
|
ipRef.current && ipRef.current.blur();
|
|
258
241
|
};
|
|
259
|
-
// const updatePicker = () => {
|
|
260
|
-
// const portal = document.body.querySelector(`#${unique.portal}`);
|
|
261
|
-
// if (!portal) return;
|
|
262
|
-
// const backGr = portal.querySelector(`#${unique.backGr}`);
|
|
263
|
-
// if (!backGr) return;
|
|
264
|
-
// const node = portal.querySelector(`#${unique.picker}`);
|
|
265
|
-
// if (!node || !node.firstChild) return;
|
|
266
|
-
// unmountComponentAtNode(node);
|
|
267
|
-
// render(
|
|
268
|
-
// <CalendarComp
|
|
269
|
-
// ref={calRef}
|
|
270
|
-
// actions={footerMemo}
|
|
271
|
-
// defaultValue={displayValue.current}
|
|
272
|
-
// value={focusedValue.current}
|
|
273
|
-
// max={max}
|
|
274
|
-
// min={min}
|
|
275
|
-
// displayAnotherMonth={displayAnotherMonth}
|
|
276
|
-
// onClick={onCalendarClick}
|
|
277
|
-
// />, node);
|
|
278
|
-
// };
|
|
279
242
|
const onSwap = open => {
|
|
280
243
|
const t = iconRef.current.childNodes[+open];
|
|
281
244
|
if (open) {
|
|
@@ -448,6 +411,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
448
411
|
useImperativeHandle(reference, () => {
|
|
449
412
|
const currentRef = ref.current || {};
|
|
450
413
|
const _instance = {
|
|
414
|
+
...action,
|
|
451
415
|
get: () => {
|
|
452
416
|
return ref.current;
|
|
453
417
|
},
|
|
@@ -479,11 +443,11 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
479
443
|
error: isError,
|
|
480
444
|
ref: ref,
|
|
481
445
|
style: style
|
|
482
|
-
},
|
|
446
|
+
}, label ? jsx(Label, {
|
|
483
447
|
disabled: disabled,
|
|
484
448
|
required: required,
|
|
485
449
|
...labelProps
|
|
486
|
-
}, label), jsx(Tooltip, {
|
|
450
|
+
}, label) : null, jsx(Tooltip, {
|
|
487
451
|
title: (ipRef === null || ipRef === void 0 ? void 0 : (_ipRef$current = ipRef.current) === null || _ipRef$current === void 0 ? void 0 : _ipRef$current.clientWidth) < 200 ? ipRef === null || ipRef === void 0 ? void 0 : (_ipRef$current2 = ipRef.current) === null || _ipRef$current2 === void 0 ? void 0 : _ipRef$current2.value : ''
|
|
488
452
|
}, jsx(InputBase, {
|
|
489
453
|
inputProps: {
|
|
@@ -502,7 +466,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
502
466
|
endIcon: endIcon,
|
|
503
467
|
onKeyDown: e => e.preventDefault(),
|
|
504
468
|
readOnly: true
|
|
505
|
-
})), isError
|
|
469
|
+
})), isError ? jsx(HelperText, {
|
|
506
470
|
...errorProps,
|
|
507
471
|
style: {
|
|
508
472
|
minHeight: 16,
|
|
@@ -510,7 +474,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
510
474
|
top: '100%'
|
|
511
475
|
},
|
|
512
476
|
disabled: disabled
|
|
513
|
-
}, error));
|
|
477
|
+
}, error) : null);
|
|
514
478
|
}));
|
|
515
479
|
const hiddenStyle = {
|
|
516
480
|
opacity: 0,
|
|
@@ -522,6 +486,7 @@ const activeStyle = {
|
|
|
522
486
|
display: 'block'
|
|
523
487
|
};
|
|
524
488
|
const IconAreaCSS = unique => css`
|
|
489
|
+
${displayFlex};
|
|
525
490
|
${flexRow};
|
|
526
491
|
${itemsCenter};
|
|
527
492
|
color: inherit;
|
|
@@ -538,27 +503,28 @@ const IconAreaCSS = unique => css`
|
|
|
538
503
|
}
|
|
539
504
|
`;
|
|
540
505
|
const ControlContainerCSS = css`
|
|
506
|
+
${displayFlex};
|
|
541
507
|
${flexRow};
|
|
542
508
|
${justifyEnd};
|
|
543
|
-
|
|
509
|
+
${mg([0, 4, 4])};
|
|
544
510
|
`;
|
|
545
511
|
const PickerCSS = {
|
|
546
512
|
backGr: `background-color: transparent; inset: 0px; pointer-events: auto; position: fixed; z-index: ${zIndexCORE(1)};`,
|
|
547
|
-
picker: (position,
|
|
513
|
+
picker: (position, positionLeft, width) => css`
|
|
548
514
|
${positionFixed};
|
|
549
515
|
${borderRadius4px};
|
|
550
|
-
${
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
516
|
+
${bgColor('system.white')};
|
|
517
|
+
${parseWidthHeight(width, 'max-content')};
|
|
518
|
+
${parseMinWidth(window.innerWidth <= 599 ? 280 : 314)};
|
|
519
|
+
${parseMaxWidth(400)};
|
|
520
|
+
${scale(0)};
|
|
521
|
+
${left(positionLeft)};
|
|
522
|
+
${top(position.top)};
|
|
555
523
|
transform-origin: ${position.transformOrigin};
|
|
556
|
-
max-width: 400px;
|
|
557
|
-
min-width: ${window.innerWidth <= 599 ? 280 : 314}px;
|
|
558
524
|
opacity: 0;
|
|
559
525
|
transform: scale(0);
|
|
560
526
|
transition: opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
561
|
-
|
|
527
|
+
${z(2)};
|
|
562
528
|
`,
|
|
563
529
|
active: {
|
|
564
530
|
opacity: 1,
|
|
@@ -576,12 +542,12 @@ DatePicker.defaultProps = {
|
|
|
576
542
|
controls: false,
|
|
577
543
|
disabled: false,
|
|
578
544
|
displayAnotherMonth: true,
|
|
579
|
-
displayFormat: '
|
|
545
|
+
displayFormat: locale.get() === 'vi' ? 'DD/MM/YYYY' : 'MM/DD/YYYY',
|
|
580
546
|
pressESCToClose: true,
|
|
581
547
|
readOnly: false,
|
|
582
548
|
required: false,
|
|
583
|
-
textAlign: 'start',
|
|
584
549
|
returnFormat: 'YYYY-MM-DD',
|
|
550
|
+
textAlign: 'start',
|
|
585
551
|
viewType: 'underlined'
|
|
586
552
|
};
|
|
587
553
|
DatePicker.propTypes = {
|
|
@@ -7,17 +7,12 @@ import locale from "../../../locale";
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
9
|
import { render } from 'react-dom';
|
|
10
|
-
import {
|
|
10
|
+
import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexCol, flexRow, justifyEnd, left, mg, parseHeight, parseMaxWidth, parseMinWidth, parseWidthHeight, pd, pointerEventsNone, positionFixed, textCenter, top, userSelectNone, whiteSpaceNoWrap } from "../../../styles/general";
|
|
11
11
|
import { useTheme } from "../../../theme";
|
|
12
12
|
import { capitalizeSentenceCase, classNames, date as moment, isEqual, randomString, updatePosition } from "../../../utils";
|
|
13
13
|
import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from "../calendar/function";
|
|
14
14
|
import ControlComp from "../control";
|
|
15
15
|
const {
|
|
16
|
-
colors: {
|
|
17
|
-
system: {
|
|
18
|
-
white: systemWhite
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
16
|
boxShadows: {
|
|
22
17
|
large: boxShadowsLarge
|
|
23
18
|
},
|
|
@@ -811,32 +806,11 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
811
806
|
if (ipRef.current.value !== '') {
|
|
812
807
|
update(values.current);
|
|
813
808
|
}
|
|
814
|
-
// if (disabled) {
|
|
815
|
-
// iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
816
|
-
// closePicker();
|
|
817
|
-
// } else if (!readOnly) {
|
|
818
|
-
// ipRef.current.addEventListener('focus', onInputFocus);
|
|
819
|
-
// } else {
|
|
820
|
-
// iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
821
|
-
// closePicker();
|
|
822
|
-
// }
|
|
823
|
-
|
|
824
809
|
if (isEnable) {
|
|
825
|
-
// iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
826
810
|
closePicker();
|
|
827
811
|
}
|
|
828
812
|
return () => {
|
|
829
813
|
if (!iconRef.current || !ipRef.current) return;
|
|
830
|
-
// if (disabled) {
|
|
831
|
-
// iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
832
|
-
// } else if (!readOnly) {
|
|
833
|
-
// ipRef.current.removeEventListener('focus', onInputFocus);
|
|
834
|
-
// } else {
|
|
835
|
-
// iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
836
|
-
// }
|
|
837
|
-
// if (isEnable) {
|
|
838
|
-
// iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
839
|
-
// }
|
|
840
814
|
closePicker();
|
|
841
815
|
};
|
|
842
816
|
}, [actionIconAt, clearAble, controls, disabled, displayFormat, max, min, pressESCToClose, readOnly, startFromZero, unitCount, viewType]);
|
|
@@ -861,7 +835,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
861
835
|
onClick: triggerFocus,
|
|
862
836
|
className: `${unique.icon} ${unique.icon}-accept`,
|
|
863
837
|
viewBox: true,
|
|
864
|
-
name: '
|
|
838
|
+
name: 'Calendar'
|
|
865
839
|
}), jsx(ButtonIcon, {
|
|
866
840
|
viewType: 'ghost',
|
|
867
841
|
onClick: onClear,
|
|
@@ -911,7 +885,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
911
885
|
className: unique.tooltip,
|
|
912
886
|
ref: tooltipRef
|
|
913
887
|
}, jsx(Typography, {
|
|
914
|
-
color:
|
|
888
|
+
color: 'system.white',
|
|
915
889
|
type: 'p2'
|
|
916
890
|
}));
|
|
917
891
|
const pickerComp = jsx("div", {
|
|
@@ -1021,13 +995,6 @@ const buttonProps = {
|
|
|
1021
995
|
}
|
|
1022
996
|
};
|
|
1023
997
|
const IconAreaCSS = css`
|
|
1024
|
-
${flexRow};
|
|
1025
|
-
${itemsCenter};
|
|
1026
|
-
${parseWidth(24)};
|
|
1027
|
-
color: inherit;
|
|
1028
|
-
& span {
|
|
1029
|
-
padding: 0;
|
|
1030
|
-
}
|
|
1031
998
|
.${unique.icon} {
|
|
1032
999
|
${displayNone};
|
|
1033
1000
|
${cursorPointer};
|
|
@@ -1041,9 +1008,10 @@ const IconAreaCSS = css`
|
|
|
1041
1008
|
}
|
|
1042
1009
|
`;
|
|
1043
1010
|
const ControlContainerCSS = css`
|
|
1011
|
+
${displayFlex};
|
|
1044
1012
|
${flexRow};
|
|
1045
1013
|
${justifyEnd};
|
|
1046
|
-
|
|
1014
|
+
${mg([0, 4, 4])};
|
|
1047
1015
|
`;
|
|
1048
1016
|
const pickerCSS = {
|
|
1049
1017
|
backGr: `
|
|
@@ -1052,11 +1020,13 @@ const pickerCSS = {
|
|
|
1052
1020
|
position: fixed;
|
|
1053
1021
|
z-index: ${zIndexCORE(1)};`,
|
|
1054
1022
|
container: css`
|
|
1023
|
+
${displayFlex};
|
|
1055
1024
|
${flexCol};
|
|
1056
1025
|
${borderRadius4px};
|
|
1057
|
-
|
|
1026
|
+
${bgColor('system.white')};
|
|
1058
1027
|
box-shadow: ${boxShadowsLarge};
|
|
1059
1028
|
.${unique.wrapper} {
|
|
1029
|
+
${displayFlex};
|
|
1060
1030
|
${flexRow};
|
|
1061
1031
|
${parseMinWidth(633)};
|
|
1062
1032
|
}
|
|
@@ -1069,8 +1039,8 @@ const pickerCSS = {
|
|
|
1069
1039
|
${whiteSpaceNoWrap};
|
|
1070
1040
|
${parseHeight(18)};
|
|
1071
1041
|
${parseMinWidth(65)};
|
|
1072
|
-
|
|
1073
|
-
|
|
1042
|
+
${bgColor('rgba(21, 26, 48, 0.9)')};
|
|
1043
|
+
${pd([0.75, 1.5])};
|
|
1074
1044
|
transition: left 0.05s ease-in, top 0.05s ease-in;
|
|
1075
1045
|
vertical-align: middle;
|
|
1076
1046
|
visibility: hidden;
|
|
@@ -1080,7 +1050,8 @@ const pickerCSS = {
|
|
|
1080
1050
|
@media only screen and (max-width: 599px) {
|
|
1081
1051
|
${parseMaxWidth(400)};
|
|
1082
1052
|
.${unique.wrapper} {
|
|
1083
|
-
|
|
1053
|
+
${displayFlex};
|
|
1054
|
+
${flexCol};
|
|
1084
1055
|
${parseMinWidth(260)};
|
|
1085
1056
|
}
|
|
1086
1057
|
.${unique.divider} {
|
|
@@ -1096,8 +1067,8 @@ const pickerCSS = {
|
|
|
1096
1067
|
${parseWidthHeight(width, 'max-content')};
|
|
1097
1068
|
${parseMinWidth(window.innerWidth <= 633 ? 300 : 633)};
|
|
1098
1069
|
${parseMaxWidth(805)};
|
|
1099
|
-
|
|
1100
|
-
|
|
1070
|
+
${top(position.top)};
|
|
1071
|
+
${left(position.left)};
|
|
1101
1072
|
opacity: 0;
|
|
1102
1073
|
transform: scale(0);
|
|
1103
1074
|
transform-origin: ${position.transformOrigin};
|
|
@@ -1138,8 +1109,6 @@ DateRangePicker.propTypes = {
|
|
|
1138
1109
|
clearAble: PropTypes.bool,
|
|
1139
1110
|
/** If `true`, the calendar will have a footer controls. */
|
|
1140
1111
|
controls: PropTypes.bool,
|
|
1141
|
-
/** The count unit when select. */
|
|
1142
|
-
unitCount: PropTypes.oneOf(['day', 'night']),
|
|
1143
1112
|
/** Default value of the component. */
|
|
1144
1113
|
defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(Date)), PropTypes.arrayOf(PropTypes.string)]),
|
|
1145
1114
|
/** If `true`, the component is disabled. */
|
|
@@ -1158,10 +1127,10 @@ DateRangePicker.propTypes = {
|
|
|
1158
1127
|
label: PropTypes.string,
|
|
1159
1128
|
/** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label--simple) of label. */
|
|
1160
1129
|
labelProps: PropTypes.object,
|
|
1161
|
-
/** Min value of date picker. */
|
|
1162
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
1163
1130
|
/** Max value of date picker. */
|
|
1164
1131
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
1132
|
+
/** Min value of date picker. */
|
|
1133
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
1165
1134
|
/** Callback fired when the value is changed. */
|
|
1166
1135
|
onChange: PropTypes.func,
|
|
1167
1136
|
/** The short hint displayed in the input before the user enters a value. */
|
|
@@ -1182,6 +1151,8 @@ DateRangePicker.propTypes = {
|
|
|
1182
1151
|
style: PropTypes.object,
|
|
1183
1152
|
/** Text align of the input. */
|
|
1184
1153
|
textAlign: PropTypes.oneOf(['center', 'end', 'start']),
|
|
1154
|
+
/** The count unit when select. */
|
|
1155
|
+
unitCount: PropTypes.oneOf(['day', 'night']),
|
|
1185
1156
|
/** The value of the input element, required for a controlled component. String must be [Date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date): YYYY/MM/DD, MM/DD/YYYY,...*/
|
|
1186
1157
|
value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])),
|
|
1187
1158
|
/** The variant to use. */
|
|
@@ -77,13 +77,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
77
77
|
}
|
|
78
78
|
if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* Convert number to format money
|
|
82
|
-
* @param vl {number} - value
|
|
83
|
-
* @type {function}
|
|
84
|
-
* @return {string}
|
|
85
|
-
* @example 1200300.123 => 1,200,300.123
|
|
86
|
-
* @example 1200300,123 => 1.200.300,123
|
|
80
|
+
/**
|
|
81
|
+
* Convert number to format money
|
|
82
|
+
* @param vl {number} - value
|
|
83
|
+
* @type {function}
|
|
84
|
+
* @return {string}
|
|
85
|
+
* @example 1200300.123 => 1,200,300.123
|
|
86
|
+
* @example 1200300,123 => 1.200.300,123
|
|
87
87
|
*/
|
|
88
88
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
89
89
|
var _number, _number2, _number$, _number3;
|
|
@@ -114,13 +114,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
114
114
|
return number;
|
|
115
115
|
}, [decimalSymbol, max, value]);
|
|
116
116
|
|
|
117
|
-
/**
|
|
118
|
-
* Convert money to format number
|
|
119
|
-
* @param vl {string} - value
|
|
120
|
-
* @type {function}
|
|
121
|
-
* @return {number}
|
|
122
|
-
* @example 1,200,300.123 => 1200300.123
|
|
123
|
-
* @example 1.200.300,123 => 1200300.123
|
|
117
|
+
/**
|
|
118
|
+
* Convert money to format number
|
|
119
|
+
* @param vl {string} - value
|
|
120
|
+
* @type {function}
|
|
121
|
+
* @return {number}
|
|
122
|
+
* @example 1,200,300.123 => 1200300.123
|
|
123
|
+
* @example 1.200.300,123 => 1200300.123
|
|
124
124
|
*/
|
|
125
125
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
126
126
|
var _number4, _number4$toString, _number4$toString$rep, _number4$toString$rep2, _number4$toString$rep3;
|
|
@@ -414,10 +414,10 @@ NumberInput.propTypes = {
|
|
|
414
414
|
style: PropTypes.object,
|
|
415
415
|
/** Thousand separator character. */
|
|
416
416
|
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
417
|
-
/** Validation value, argument can:<br/>
|
|
418
|
-
* * string: the validation rule. Example required.<br/>
|
|
419
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
420
|
-
* * array: the validation rule list, insist object/string
|
|
417
|
+
/** Validation value, argument can:<br/>
|
|
418
|
+
* * string: the validation rule. Example required.<br/>
|
|
419
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
420
|
+
* * array: the validation rule list, insist object/string
|
|
421
421
|
*/
|
|
422
422
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
423
423
|
/** The value of the input element, required for a controlled component. */
|
|
@@ -191,11 +191,11 @@ Radio.propTypes = {
|
|
|
191
191
|
className: PropTypes.string,
|
|
192
192
|
/** Props for input. */
|
|
193
193
|
inputProps: PropTypes.object,
|
|
194
|
-
/** Callback fired when the state is changed.
|
|
195
|
-
*
|
|
196
|
-
* @param {object} event The event source of the callback.
|
|
197
|
-
* You can pull out the new value by accessing `event.target.value` (string).
|
|
198
|
-
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
194
|
+
/** Callback fired when the state is changed.
|
|
195
|
+
*
|
|
196
|
+
* @param {object} event The event source of the callback.
|
|
197
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
198
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
199
199
|
* */
|
|
200
200
|
onChange: PropTypes.func,
|
|
201
201
|
/** Prevent all event if true. */
|
|
@@ -226,10 +226,10 @@ Toggle.propTypes = {
|
|
|
226
226
|
lineClamp: PropTypes.number,
|
|
227
227
|
/** Shows tooltip containing Label on hover */
|
|
228
228
|
hoverTooltip: PropTypes.bool,
|
|
229
|
-
/** * Callback fired when the state is changed.
|
|
230
|
-
*
|
|
231
|
-
* @param {object} event The event source of the callback.
|
|
232
|
-
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
229
|
+
/** * Callback fired when the state is changed.
|
|
230
|
+
*
|
|
231
|
+
* @param {object} event The event source of the callback.
|
|
232
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
233
233
|
*/
|
|
234
234
|
onChange: PropTypes.func,
|
|
235
235
|
/** If `true`, the label will indicate that the checkbox is required. */
|
|
@@ -8,7 +8,7 @@ import { forwardRef, Fragment, memo, useCallback, useEffect, useImperativeHandle
|
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
import { animations } from "../../../styles/animation";
|
|
10
10
|
import { hexToRGBA } from "../../../styles/color-helper";
|
|
11
|
-
import { bgColor, border, borderRadius, borderRadius50, boxBorder, breakWord, cursorPointer, displayBlock, displayFlex, flexCol, flexRow, inset, itemsCenter, justifyCenter, justifyEnd, mg, mgb, mgr, mgt, overflowAuto, overflowHidden, parseHeight, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseWidth, parseWidthHeight, pd, positionFixed, positionRelative, textColor, textEllipsis,
|
|
11
|
+
import { bgColor, border, borderRadius, borderRadius50, boxBorder, breakWord, cursorPointer, displayBlock, displayFlex, flexCol, flexRow, inset, itemsCenter, justifyCenter, justifyEnd, mg, mgb, mgr, mgt, overflowAuto, overflowHidden, parseHeight, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseWidth, parseWidthHeight, pd, positionFixed, positionRelative, textColor, textEllipsis, textUnderline, truncate, z } from "../../../styles/general";
|
|
12
12
|
import { useTheme } from "../../../theme";
|
|
13
13
|
import { classNames, refType as ref, useDelayUnmount } from "../../../utils";
|
|
14
14
|
const {
|
|
@@ -327,7 +327,7 @@ const PopupRootCSS = (width, top, type, description, subtitle, showMoreDescripti
|
|
|
327
327
|
${parseWidth('fit-content')};
|
|
328
328
|
${mgt([4])};
|
|
329
329
|
${mgb([type === 'yesno' ? 0 : 2])};
|
|
330
|
-
${
|
|
330
|
+
${textUnderline};
|
|
331
331
|
${textColor('semantic.info')};
|
|
332
332
|
}
|
|
333
333
|
}
|
|
@@ -243,14 +243,14 @@ Rating.propTypes = {
|
|
|
243
243
|
className: PropTypes.string,
|
|
244
244
|
/** Style inline of component. */
|
|
245
245
|
style: PropTypes.object,
|
|
246
|
-
/**
|
|
247
|
-
* Callback fired when the value changes.
|
|
248
|
-
*
|
|
249
|
-
|
|
250
|
-
*
|
|
251
|
-
* event: The event source of the callback.
|
|
252
|
-
*
|
|
253
|
-
* value: The new value.
|
|
246
|
+
/**
|
|
247
|
+
* Callback fired when the value changes.
|
|
248
|
+
*
|
|
249
|
+
function(event: React.SyntheticEvent, value: number) => void
|
|
250
|
+
*
|
|
251
|
+
* event: The event source of the callback.
|
|
252
|
+
*
|
|
253
|
+
* value: The new value.
|
|
254
254
|
*/
|
|
255
255
|
onRating: PropTypes.func
|
|
256
256
|
};
|
package/components/tab/tab.js
CHANGED
|
@@ -416,9 +416,9 @@ Transfer.propTypes = {
|
|
|
416
416
|
height: oneOfType([string, number]),
|
|
417
417
|
/** field name used for icon display */
|
|
418
418
|
iconExpr: string,
|
|
419
|
-
/** field name used for text display<br/>
|
|
420
|
-
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
421
|
-
* Note: don't use 'id - name', return undefined
|
|
419
|
+
/** field name used for text display<br/>
|
|
420
|
+
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
421
|
+
* Note: don't use 'id - name', return undefined
|
|
422
422
|
*/
|
|
423
423
|
displayExpr: oneOfType([string, array]),
|
|
424
424
|
/** display header to select all choices if true */
|
|
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
|
|
|
4
4
|
import { Popover } from "./..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { forwardRef, Fragment, memo, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
|
-
import { breakAll, breakWord, cursorPointer, displayBlock, displayInlineBlock, italic, overflowHidden, parseHeight, parseMaxWidth, parseMinWidth, pd, positionRelative, textCapitalize, textCenter, textColor, textLineThrough, textLowercase,
|
|
7
|
+
import { breakAll, breakWord, cursorPointer, displayBlock, displayInlineBlock, italic, overflowHidden, parseHeight, parseMaxWidth, parseMinWidth, pd, positionRelative, textCapitalize, textCenter, textColor, textLineThrough, textLowercase, textUnderline, textUppercase, whiteSpaceBreakSpaces } from "../../styles/general";
|
|
8
8
|
import { useTheme, useTypography as typography } from "../../theme";
|
|
9
9
|
import { classNames, renderHTML } from "../../utils";
|
|
10
10
|
const {
|
|
@@ -18,7 +18,7 @@ const {
|
|
|
18
18
|
}
|
|
19
19
|
} = useTheme();
|
|
20
20
|
const colorMap = new Map([['default', textMain]]);
|
|
21
|
-
const formatMap = new Map([['capitalize', textCapitalize], ['uppercase', textUppercase], ['lowercase', textLowercase], ['italic', italic], ['line-through', textLineThrough], ['underline',
|
|
21
|
+
const formatMap = new Map([['capitalize', textCapitalize], ['uppercase', textUppercase], ['lowercase', textLowercase], ['italic', italic], ['line-through', textLineThrough], ['underline', textUnderline]]);
|
|
22
22
|
const isTextClamped = elm => (elm === null || elm === void 0 ? void 0 : elm.scrollHeight) > (elm === null || elm === void 0 ? void 0 : elm.clientHeight);
|
|
23
23
|
const Typography = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
24
24
|
action = {},
|
|
@@ -143,16 +143,16 @@ Typography.defaultProps = {
|
|
|
143
143
|
type: 'p1'
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
/** type of text<br/>
|
|
147
|
-
* h1: Title <br/>
|
|
148
|
-
* h2: Header Popup <br/>
|
|
149
|
-
* h3: Header popup <br/>
|
|
150
|
-
* h4: Button, Tab, Title group <br/>
|
|
151
|
-
* h5: Label column, Title group <br/>
|
|
152
|
-
* h6: Label form <br/>
|
|
153
|
-
* p1: Body text <br/>
|
|
154
|
-
* p2: Body text <br/>
|
|
155
|
-
* p3: Notice, Tooltip <br/>
|
|
146
|
+
/** type of text<br/>
|
|
147
|
+
* h1: Title <br/>
|
|
148
|
+
* h2: Header Popup <br/>
|
|
149
|
+
* h3: Header popup <br/>
|
|
150
|
+
* h4: Button, Tab, Title group <br/>
|
|
151
|
+
* h5: Label column, Title group <br/>
|
|
152
|
+
* h6: Label form <br/>
|
|
153
|
+
* p1: Body text <br/>
|
|
154
|
+
* p2: Body text <br/>
|
|
155
|
+
* p3: Notice, Tooltip <br/>
|
|
156
156
|
*/
|
|
157
157
|
export const arrTypeTypography = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
|
|
158
158
|
Typography.propTypes = {
|
package/package.json
CHANGED
package/styles/general.js
CHANGED
|
@@ -413,7 +413,7 @@ const textLowercase = css`
|
|
|
413
413
|
const textRight = css`
|
|
414
414
|
text-align: right;
|
|
415
415
|
`;
|
|
416
|
-
const
|
|
416
|
+
const textUnderline = css`
|
|
417
417
|
text-decoration: underline;
|
|
418
418
|
`;
|
|
419
419
|
const textUppercase = css`
|
|
@@ -445,4 +445,4 @@ const whiteSpacePreWrap = css`
|
|
|
445
445
|
const z = vl => css`
|
|
446
446
|
z-index: ${zIndex(vl)};
|
|
447
447
|
`;
|
|
448
|
-
export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight,
|
|
448
|
+
export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|
package/styles/utils.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { color as colors } from "./colors";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Parse css value
|
|
5
|
-
*
|
|
6
|
-
* @param {string | number} vl
|
|
7
|
-
* @returns {string | number}
|
|
3
|
+
/**
|
|
4
|
+
* Parse css value
|
|
5
|
+
*
|
|
6
|
+
* @param {string | number} vl
|
|
7
|
+
* @returns {string | number}
|
|
8
8
|
*/
|
|
9
9
|
export const parseCSSValue = vl => {
|
|
10
10
|
return isNaN(vl) ? vl : vl + 'px';
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Parse to pixel
|
|
15
|
-
*
|
|
16
|
-
* @param {number} vl
|
|
17
|
-
* @returns {string}
|
|
13
|
+
/**
|
|
14
|
+
* Parse to pixel
|
|
15
|
+
*
|
|
16
|
+
* @param {number} vl
|
|
17
|
+
* @returns {string}
|
|
18
18
|
*/
|
|
19
19
|
export const parseToPixel = vl => {
|
|
20
20
|
if (!vl) return '1px';
|
|
21
21
|
return typeof vl === 'string' ? vl : `${vl}px`;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Get color from CORE colors
|
|
26
|
-
*
|
|
27
|
-
* @param {string} cl
|
|
28
|
-
* @returns {string}
|
|
24
|
+
/**
|
|
25
|
+
* Get color from CORE colors
|
|
26
|
+
*
|
|
27
|
+
* @param {string} cl
|
|
28
|
+
* @returns {string}
|
|
29
29
|
*/
|
|
30
30
|
export const getColor = cl => {
|
|
31
31
|
if (typeof cl !== 'string') return;
|