diginet-core-ui 1.4.45-beta.1 → 1.4.45-beta.2
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/accordion/details.js +1 -1
- package/components/accordion/group.js +1 -1
- package/components/accordion/index.js +1 -1
- package/components/accordion/summary.js +1 -1
- package/components/alert/index.js +1 -1
- package/components/alert/notify.js +1 -1
- package/components/avatar/index.js +2 -2
- package/components/badge/index.js +1 -1
- package/components/breadcrumb/index.js +1 -1
- package/components/button/icon.js +1 -1
- package/components/button/index.js +1 -1
- package/components/button/more.js +2 -2
- package/components/button/ripple-effect.js +1 -1
- package/components/card/body.js +1 -1
- package/components/card/extra.js +1 -1
- package/components/card/footer.js +1 -1
- package/components/card/header.js +1 -1
- package/components/card/index.js +1 -1
- package/components/chart/Pie/Circle.js +1 -1
- package/components/chart/Pie/Sector.js +1 -1
- package/components/chart/Pie/index.js +1 -1
- package/components/chart/Pie-v2/Circle.js +1 -1
- package/components/chart/Pie-v2/Sector.js +1 -1
- package/components/chart/Pie-v2/index.js +1 -1
- package/components/chart/bar/Bar.js +1 -1
- package/components/chart/bar/index.js +1 -1
- package/components/chart/bar-v2/Bar.js +1 -1
- package/components/chart/bar-v2/index.js +1 -1
- package/components/chart/line/index.js +1 -1
- package/components/chart/line-v2/index.js +1 -1
- package/components/check-text/index.js +1 -1
- package/components/check-text/interview-confirmation.js +1 -1
- package/components/check-text/interview-status.js +1 -1
- package/components/chip/index.js +1 -1
- package/components/collapse/index.js +1 -1
- package/components/divider/index.js +1 -1
- package/components/form-control/attachment/index.js +1 -1
- package/components/form-control/calendar/index.js +1 -1
- package/components/form-control/calendar/range.js +1 -1
- package/components/form-control/checkbox/index.js +1 -1
- package/components/form-control/control/index.js +1 -1
- package/components/form-control/date-input/index.js +1 -1
- package/components/form-control/date-picker/index.js +1 -1
- package/components/form-control/date-range-picker/index.js +1 -1
- package/components/form-control/dropdown/index.js +196 -29
- package/components/form-control/dropdown-box/index.js +1 -1
- package/components/form-control/form-group/index.js +1 -1
- package/components/form-control/helper-text/index.js +1 -1
- package/components/form-control/input-base/UncontrolledInputBase.js +1 -1
- package/components/form-control/input-base/index.js +1 -1
- package/components/form-control/label/index.js +1 -1
- package/components/form-control/money-input/index.js +1 -1
- package/components/form-control/password-input/index.js +1 -1
- package/components/form-control/phone-input/index.js +1 -1
- package/components/form-control/radio/index.js +1 -1
- package/components/form-control/text-input/index.js +1 -1
- package/components/form-control/time-picker/index.js +1 -1
- package/components/form-control/time-picker/v2/index.js +1 -1
- package/components/form-control/toggle/index.js +1 -1
- package/components/form-view/input.js +1 -1
- package/components/grid/index.js +1 -1
- package/components/image/index.js +1 -1
- package/components/list/list-item-action.js +1 -1
- package/components/list/list-item-icon.js +1 -1
- package/components/list/list-item-text.js +1 -1
- package/components/list/list-item.js +1 -1
- package/components/list/list.js +1 -1
- package/components/list/sub-header.js +1 -1
- package/components/modal/body.js +1 -1
- package/components/modal/footer.js +1 -1
- package/components/modal/header.js +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.js +1 -1
- package/components/others/option-wrapper/index.js +1 -1
- package/components/paging/page-info.js +1 -1
- package/components/paging/page-selector.js +1 -1
- package/components/paper/index.js +1 -1
- package/components/popover/body.js +1 -1
- package/components/popover/footer.js +1 -1
- package/components/popover/header.js +1 -1
- package/components/popover/index.js +1 -1
- package/components/popup/index.js +1 -1
- package/components/popup/v2/index.js +1 -1
- package/components/progress/circular.js +1 -1
- package/components/progress/linear.js +1 -1
- package/components/rating/index.js +1 -1
- package/components/skeleton/index.js +1 -1
- package/components/slider/slider-container.js +1 -1
- package/components/slider/slider-item.js +1 -1
- package/components/status/index.js +1 -1
- package/components/tab/tab-container.js +1 -1
- package/components/tab/tab-header.js +1 -1
- package/components/tab/tab-panel.js +1 -1
- package/components/tab/tab.js +1 -1
- package/components/tooltip/index.js +1 -1
- package/components/transfer/index.js +1 -1
- package/components/tree-view/index.js +1 -1
- package/components/typography/index.js +1 -1
- package/icons/effect.js +1 -1
- package/icons/menu/v2/index.js +1 -1
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ const uniqBy = (arr, iteratee) => {
|
|
|
47
47
|
return true;
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
50
|
+
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
51
51
|
if (!reference) reference = useRef(null);
|
|
52
52
|
const theme = useTheme();
|
|
53
53
|
const {
|
|
@@ -88,6 +88,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
88
88
|
onInput,
|
|
89
89
|
onKeyDown,
|
|
90
90
|
onLoadMore,
|
|
91
|
+
oneLiner,
|
|
91
92
|
placeholder: placeholderProp,
|
|
92
93
|
readOnly,
|
|
93
94
|
renderItem,
|
|
@@ -157,9 +158,13 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
157
158
|
valueTemp = convertData(valueTemp, valueExpr);
|
|
158
159
|
}
|
|
159
160
|
const [valueMulti, setValueMulti] = useState(valueTemp);
|
|
161
|
+
const [valueMultiDisplay, setValueMultiDisplay] = useState([]);
|
|
162
|
+
const [valueMultiOverflow, setValueMultiOverflow] = useState([]);
|
|
163
|
+
const [openMultipleOverflow, setOpenMultipleOverflow] = useState(false);
|
|
160
164
|
const _isMobile = isMobile.any();
|
|
161
165
|
const _InputCSS = InputCSS(multiple, typeof renderSelectedItem === 'function');
|
|
162
166
|
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, disabled, readOnly, multilineSelectedItem, theme);
|
|
167
|
+
const _OverFlowPopoverCSS = OverFlowPopoverCSS(theme);
|
|
163
168
|
const _IconCSS = IconCSS(viewType, theme);
|
|
164
169
|
const _DropdownFormCSS = viewType === 'outlined' ? DropdownFormOutlinedCSS(disabled, readOnly, placeholder, theme) : DropdownFormCSS(viewType, multiple, disabled, readOnly, placeholder, _DropdownInputCSS.name, theme);
|
|
165
170
|
const _DropdownListCSS = DropdownListCSS(loadingState, theme);
|
|
@@ -923,6 +928,14 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
923
928
|
}
|
|
924
929
|
if (multiple && valueProp) {
|
|
925
930
|
setValueMulti(convertData(valueProp, valueExpr));
|
|
931
|
+
if (oneLiner) {
|
|
932
|
+
const valueArray = sortMultiple(valueProp);
|
|
933
|
+
setValueMultiDisplay(valueArray === null || valueArray === void 0 ? void 0 : valueArray.display);
|
|
934
|
+
setValueMultiOverflow(valueArray === null || valueArray === void 0 ? void 0 : valueArray.overflow);
|
|
935
|
+
if ((valueArray === null || valueArray === void 0 ? void 0 : valueArray.overflow.length) === 0 && openMultipleOverflow) {
|
|
936
|
+
setOpenMultipleOverflow(false);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
926
939
|
}
|
|
927
940
|
// Close dropdown treeview by children when select item
|
|
928
941
|
if (children && (closeAfterSelect === true || closeAfterSelect === undefined && !multiple)) {
|
|
@@ -932,6 +945,14 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
932
945
|
useEffect(() => {
|
|
933
946
|
if (valueProp !== undefined && (!dropdownListRef.current || children || JSON.stringify(valueProp) !== JSON.stringify(currentValue[unique]))) {
|
|
934
947
|
setValueIntoInput(valueProp);
|
|
948
|
+
if (oneLiner && multiple) {
|
|
949
|
+
const valueArray = sortMultiple(valueProp);
|
|
950
|
+
setValueMultiDisplay(valueArray === null || valueArray === void 0 ? void 0 : valueArray.display);
|
|
951
|
+
setValueMultiOverflow(valueArray === null || valueArray === void 0 ? void 0 : valueArray.overflow);
|
|
952
|
+
if ((valueArray === null || valueArray === void 0 ? void 0 : valueArray.overflow.length) === 0 && openMultipleOverflow) {
|
|
953
|
+
setOpenMultipleOverflow(false);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
935
956
|
}
|
|
936
957
|
}, [valueProp, dataSourceState, vlObjDefaultState]);
|
|
937
958
|
useEffect(() => {
|
|
@@ -1029,16 +1050,168 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
1029
1050
|
dataFilter = uniqBy([...vlObjDefaultState, ...dataFilter], data => data === null || data === void 0 ? void 0 : data[valueExpr]);
|
|
1030
1051
|
return dataFilter;
|
|
1031
1052
|
};
|
|
1053
|
+
const getTextWidth = text => {
|
|
1054
|
+
// re-use canvas object for better performance
|
|
1055
|
+
const canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement('canvas'));
|
|
1056
|
+
const context = canvas.getContext('2d');
|
|
1057
|
+
context.font = getCanvasFont();
|
|
1058
|
+
const metrics = context.measureText(text);
|
|
1059
|
+
// chip width = text width + 42 (padding and X button inside chip)
|
|
1060
|
+
return metrics.width + 42;
|
|
1061
|
+
};
|
|
1062
|
+
const getCanvasFont = () => {
|
|
1063
|
+
const fontWeight = 'normal';
|
|
1064
|
+
const fontSize = '14px';
|
|
1065
|
+
const fontFamily = 'SF Pro Display';
|
|
1066
|
+
return `${fontWeight} ${fontSize} ${fontFamily}`;
|
|
1067
|
+
};
|
|
1068
|
+
const sortMultiple = value => {
|
|
1069
|
+
let totalWidth = 0;
|
|
1070
|
+
let displayArray = [];
|
|
1071
|
+
const overflowArray = [];
|
|
1072
|
+
const inputElement = document.getElementById(unique);
|
|
1073
|
+
// Độ rộng của input
|
|
1074
|
+
const inputWidth = inputElement === null || inputElement === void 0 ? void 0 : inputElement.clientWidth;
|
|
1075
|
+
const items = [];
|
|
1076
|
+
if ((valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) > 0) {
|
|
1077
|
+
value.map((vl, index) => {
|
|
1078
|
+
const dataFilter = getData();
|
|
1079
|
+
const data = dataFilter.find(v => v[valueExpr] === vl || v === vl);
|
|
1080
|
+
if (data) {
|
|
1081
|
+
const displayText = displayValue(data);
|
|
1082
|
+
let item;
|
|
1083
|
+
if (typeof renderSelectedItem === 'function') {
|
|
1084
|
+
item = renderSelectedItem({
|
|
1085
|
+
data,
|
|
1086
|
+
index
|
|
1087
|
+
});
|
|
1088
|
+
} else {
|
|
1089
|
+
item = jsx(Chip, {
|
|
1090
|
+
css: [parseWidth('100%'), parseMaxWidth('max-content')],
|
|
1091
|
+
key: index,
|
|
1092
|
+
startIcon: getIconFromData(data, true),
|
|
1093
|
+
label: displayText,
|
|
1094
|
+
size: 'medium',
|
|
1095
|
+
disabled: disabled,
|
|
1096
|
+
clearAble: !readOnly && !disabled,
|
|
1097
|
+
onRemove: e => onRemove(e, vl)
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
items.push(item);
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
for (var i = 0; i < items.length; i++) {
|
|
1105
|
+
// calculate chip width before render
|
|
1106
|
+
let chipWidth = getTextWidth(items[i].props.label);
|
|
1107
|
+
const overflowChipWidth = getTextWidth(overflowArray.length);
|
|
1108
|
+
if (getIconFromData(value[i], true)) {
|
|
1109
|
+
// chip width with icon inside
|
|
1110
|
+
chipWidth += 24;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// if chip width is larger than remaining, push the item into overflow array
|
|
1114
|
+
if (inputWidth - totalWidth - chipWidth < overflowChipWidth) {
|
|
1115
|
+
overflowArray.push(value[i]);
|
|
1116
|
+
} else {
|
|
1117
|
+
displayArray.push(value[i]);
|
|
1118
|
+
// add chip width and 2px of gap between 2 chips
|
|
1119
|
+
totalWidth += chipWidth + 2;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
const multipleObjArray = {
|
|
1123
|
+
display: displayArray,
|
|
1124
|
+
overflow: overflowArray
|
|
1125
|
+
};
|
|
1126
|
+
return multipleObjArray;
|
|
1127
|
+
};
|
|
1128
|
+
const renderMultipleItem = value => {
|
|
1129
|
+
const items = [];
|
|
1130
|
+
if ((valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) > 0) {
|
|
1131
|
+
value.map((vl, index) => {
|
|
1132
|
+
const dataFilter = getData();
|
|
1133
|
+
const data = dataFilter.find(v => v[valueExpr] === vl || v === vl);
|
|
1134
|
+
if (data) {
|
|
1135
|
+
const displayText = displayValue(data);
|
|
1136
|
+
let item;
|
|
1137
|
+
if (typeof renderSelectedItem === 'function') {
|
|
1138
|
+
item = renderSelectedItem({
|
|
1139
|
+
data,
|
|
1140
|
+
index
|
|
1141
|
+
});
|
|
1142
|
+
} else {
|
|
1143
|
+
item = jsx(Chip, {
|
|
1144
|
+
css: [parseWidth('100%'), parseMaxWidth('max-content')],
|
|
1145
|
+
key: index,
|
|
1146
|
+
startIcon: getIconFromData(data, true),
|
|
1147
|
+
label: displayText,
|
|
1148
|
+
size: 'medium',
|
|
1149
|
+
disabled: disabled,
|
|
1150
|
+
clearAble: !readOnly && !disabled,
|
|
1151
|
+
onRemove: e => onRemove(e, vl)
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
items.push(item);
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
return items;
|
|
1159
|
+
};
|
|
1160
|
+
const onOpenOverflowPopover = () => {
|
|
1161
|
+
setOpenMultipleOverflow(true);
|
|
1162
|
+
};
|
|
1163
|
+
const onCloseOverflowPopover = () => {
|
|
1164
|
+
setOpenMultipleOverflow(false);
|
|
1165
|
+
};
|
|
1166
|
+
const renderMultipleOverflow = value => {
|
|
1167
|
+
return value.length > 0 ? jsx(Chip, {
|
|
1168
|
+
css: [parseWidth('100%'), parseMaxWidth('max-content')],
|
|
1169
|
+
label: `+${value.length}`,
|
|
1170
|
+
size: 'medium',
|
|
1171
|
+
disabled: disabled,
|
|
1172
|
+
onClick: onOpenOverflowPopover,
|
|
1173
|
+
viewType: "filled",
|
|
1174
|
+
color: "system/rest"
|
|
1175
|
+
}) : null;
|
|
1176
|
+
};
|
|
1177
|
+
const renderOverflowPopover = value => {
|
|
1178
|
+
const items = [];
|
|
1179
|
+
if ((valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) > 0) {
|
|
1180
|
+
value.map((vl, index) => {
|
|
1181
|
+
const dataFilter = getData();
|
|
1182
|
+
const data = dataFilter.find(v => v[valueExpr] === vl || v === vl);
|
|
1183
|
+
if (data) {
|
|
1184
|
+
const displayText = displayValue(data);
|
|
1185
|
+
let item = jsx(Chip, {
|
|
1186
|
+
css: [parseWidth('100%'), parseMaxWidth('max-content')],
|
|
1187
|
+
key: index,
|
|
1188
|
+
startIcon: getIconFromData(data, true),
|
|
1189
|
+
label: displayText,
|
|
1190
|
+
size: 'medium',
|
|
1191
|
+
disabled: disabled,
|
|
1192
|
+
clearAble: !readOnly && !disabled,
|
|
1193
|
+
onRemove: e => onRemove(e, vl)
|
|
1194
|
+
});
|
|
1195
|
+
items.push(item);
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
return items;
|
|
1200
|
+
};
|
|
1032
1201
|
const InputView = jsx("div", {
|
|
1033
1202
|
css: _DropdownFormCSS,
|
|
1034
1203
|
ref: formRef,
|
|
1035
1204
|
className: classNames('DGN-UI-Dropdown-Form', openState && 'dropdown-showing')
|
|
1036
1205
|
}, jsx("div", {
|
|
1206
|
+
id: unique,
|
|
1037
1207
|
css: _InputCSS,
|
|
1038
1208
|
className: 'DGN-UI-Dropdown-Form-Input'
|
|
1039
1209
|
}, multiple && valueMulti !== null && valueMulti !== void 0 && valueMulti.length ? jsx("div", {
|
|
1040
1210
|
...inputProps,
|
|
1041
|
-
style:
|
|
1211
|
+
style: {
|
|
1212
|
+
width: 'fit-content',
|
|
1213
|
+
...inputStyle
|
|
1214
|
+
},
|
|
1042
1215
|
ref: inputRef,
|
|
1043
1216
|
css: [_DropdownInputCSS],
|
|
1044
1217
|
className: classNames('dgn-dropdown-multiple', inputProps.className),
|
|
@@ -1046,34 +1219,21 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
1046
1219
|
e.preventDefault();
|
|
1047
1220
|
return false;
|
|
1048
1221
|
}
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
});
|
|
1060
|
-
} else {
|
|
1061
|
-
item = jsx(Chip, {
|
|
1062
|
-
css: [parseWidth('100%'), parseMaxWidth('max-content')],
|
|
1063
|
-
key: index,
|
|
1064
|
-
startIcon: getIconFromData(data, true),
|
|
1065
|
-
label: displayText,
|
|
1066
|
-
size: 'medium',
|
|
1067
|
-
disabled: disabled,
|
|
1068
|
-
clearAble: !readOnly && !disabled,
|
|
1069
|
-
onRemove: e => onRemove(e, vl)
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
return item;
|
|
1073
|
-
}
|
|
1074
|
-
})) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", {
|
|
1222
|
+
}, renderMultipleItem(oneLiner ? valueMultiDisplay : valueMulti), oneLiner && jsx(Popover, {
|
|
1223
|
+
css: [_OverFlowPopoverCSS],
|
|
1224
|
+
width: 400,
|
|
1225
|
+
style: {
|
|
1226
|
+
padding: '8px 2px 8px 8px'
|
|
1227
|
+
},
|
|
1228
|
+
open: openMultipleOverflow,
|
|
1229
|
+
anchor: renderMultipleOverflow(valueMultiOverflow),
|
|
1230
|
+
onClose: onCloseOverflowPopover
|
|
1231
|
+
}, renderOverflowPopover(valueMultiOverflow))) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", {
|
|
1075
1232
|
...inputProps,
|
|
1076
|
-
style:
|
|
1233
|
+
style: {
|
|
1234
|
+
width: 'fit-content',
|
|
1235
|
+
...inputStyle
|
|
1236
|
+
},
|
|
1077
1237
|
ref: inputRef,
|
|
1078
1238
|
css: _DropdownInputCSS,
|
|
1079
1239
|
className: classNames('dgn-dropdown-multiple', inputProps.className),
|
|
@@ -1217,6 +1377,11 @@ const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly, m
|
|
|
1217
1377
|
${disabled && textColor(getProp(colors, 'system/disabled'))};
|
|
1218
1378
|
}
|
|
1219
1379
|
`;
|
|
1380
|
+
const OverFlowPopoverCSS = ({
|
|
1381
|
+
spacing
|
|
1382
|
+
}) => css`
|
|
1383
|
+
gap: ${spacing([1])};
|
|
1384
|
+
`;
|
|
1220
1385
|
const IconCSS = (viewType, {
|
|
1221
1386
|
spacing
|
|
1222
1387
|
}) => css`
|
|
@@ -1561,6 +1726,8 @@ Dropdown.propTypes = {
|
|
|
1561
1726
|
onKeyDown: PropTypes.func,
|
|
1562
1727
|
/** Callback function fired when scrolling near the end of the dropdown. */
|
|
1563
1728
|
onLoadMore: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
1729
|
+
/** If `true`, the Dropdown selected items when `multiple` is `true` is displayed on one line. */
|
|
1730
|
+
oneLiner: PropTypes.bool,
|
|
1564
1731
|
/** The short hint displayed in the input before the user selects a value. */
|
|
1565
1732
|
placeholder: PropTypes.string,
|
|
1566
1733
|
/** If `true`, the component is read-only. */
|
|
@@ -10,7 +10,7 @@ import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
11
|
const regexBetween = /[^{}]+(?=})/g;
|
|
12
12
|
const regexInclude = /{|}/g;
|
|
13
|
-
const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
|
+
const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
14
14
|
if (!reference) reference = useRef(null);
|
|
15
15
|
const theme = useTheme();
|
|
16
16
|
const {
|
|
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Children, forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';
|
|
6
6
|
import { useTheme } from "../../../theme";
|
|
7
|
-
const FormGroup = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
7
|
+
const FormGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
8
8
|
fullWidth,
|
|
9
9
|
oneHelperText,
|
|
10
10
|
marginRight,
|
|
@@ -9,7 +9,7 @@ import { useTheme } from "../../../theme";
|
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
11
|
const colorMap = new Map([['default', 'semantic/danger'], ['success', 'semantic/success'], ['warning', 'semantic/warning'], ['danger', 'semantic/danger'], ['info', 'semantic/info']]);
|
|
12
|
-
const HelperText = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const HelperText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -9,7 +9,7 @@ import { bgColor, border, borderBottom, borderBottomColor, borderColor, borderNo
|
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, refType as ref, getProp } from "../../../utils";
|
|
12
|
-
const UncontrolledInputBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const UncontrolledInputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -9,7 +9,7 @@ import { bgColor, bgTransparent, border, borderBottom, borderBottomColor, border
|
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, refType as ref, useInput, getProp } from "../../../utils";
|
|
12
|
-
const InputBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -9,7 +9,7 @@ import { flexRow, parseMinHeight, typographyTypes } from "../../../styles/genera
|
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, getProp } from "../../../utils";
|
|
12
|
-
const Label = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -72,7 +72,7 @@ const num2WordsEn = n => {
|
|
|
72
72
|
if (n === '0') return 'zero';
|
|
73
73
|
return comp(chunk(3))(reverse)(arr(n)).map(makeGroup).map(thousand).filter(comp(not)(isEmpty)).reverse().join(' ');
|
|
74
74
|
};
|
|
75
|
-
const MoneyInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
75
|
+
const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
76
76
|
if (!reference) reference = useRef(null);
|
|
77
77
|
|
|
78
78
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -8,7 +8,7 @@ import { cursorNotAllowed, displayBlock, positionRelative } from "../../../style
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, onValidate, refType as ref } from "../../../utils";
|
|
11
|
-
const PasswordInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
11
|
+
const PasswordInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ import { boxBorder, cursorNoDrop, cursorPointer, displayBlock, displayNone, posi
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp, randomString } from "../../../utils";
|
|
11
|
-
const Radio = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
11
|
+
const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
const {
|
|
@@ -8,7 +8,7 @@ import { cursorNotAllowed, displayBlock, positionRelative } from "../../../style
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, onValidate, refType as ref } from "../../../utils";
|
|
11
|
-
const TextInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
11
|
+
const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|
|
@@ -9,7 +9,7 @@ import { bgColor, border, borderColor, borderNone, borderRadius4px, displayFlex,
|
|
|
9
9
|
import { useTheme } from "../../../../theme";
|
|
10
10
|
import useThemeProps from "../../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, date, getProp, hexToRGBA } from "../../../../utils";
|
|
12
|
-
const TimePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
|
|
15
15
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -8,7 +8,7 @@ import { borderRadius, cursorNoDrop, cursorPointer, displayBlock, flexRow, items
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
|
-
const Toggle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
11
|
+
const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|
|
@@ -6,7 +6,7 @@ import { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
|
|
6
6
|
import { border, borderBottom, borderRadius, bottom, boxBorder, displayFlex, inset, insetX, itemsCenter, parseHeight, pointerEventsNone, positionAbsolute, positionRelative, scale } from "../../styles/general";
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
8
|
import { formatDate, getProp } from "../../utils";
|
|
9
|
-
const InputView = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
9
|
+
const InputView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
10
10
|
inputProps,
|
|
11
11
|
inputStyleProps,
|
|
12
12
|
value,
|
package/components/grid/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { breakpointKeys } from "../../theme/createBreakpoints";
|
|
|
10
10
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, handleBreakpoints } from "../../utils";
|
|
12
12
|
import GridContext from "./context";
|
|
13
|
-
const Grid = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
|
+
const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
14
14
|
if (!reference) reference = useRef(null);
|
|
15
15
|
const theme = useTheme();
|
|
16
16
|
const {
|
|
@@ -15,7 +15,7 @@ const blurKeyframe = keyframes`
|
|
|
15
15
|
75% { -webkit-filter: blur(1px);}
|
|
16
16
|
100% { -webkit-filter: blur(0px);}
|
|
17
17
|
`;
|
|
18
|
-
const Image = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
18
|
+
const Image = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
19
19
|
if (!reference) reference = useRef(null);
|
|
20
20
|
|
|
21
21
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
|
7
7
|
import { bgColor, boxBorder, displayFlex, itemsCenter, order, parseMaxHeight, positionRelative, textColor, z } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, getProp } from "../../utils";
|
|
10
|
-
const ListItemAction = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
|
+
const ListItemAction = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
11
|
children,
|
|
12
12
|
name,
|
|
13
13
|
className,
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
|
7
7
|
import { bgColor, boxBorder, displayFlex, itemsCenter, order, parseMinWidth, positionRelative, textColor, z } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, getProp } from "../../utils";
|
|
10
|
-
const ListItemIcon = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
|
+
const ListItemIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
11
|
className,
|
|
12
12
|
children,
|
|
13
13
|
name,
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
7
|
import { bgColor, boxBorder, displayFlex, itemsCenter, order, positionRelative } from "../../styles/general";
|
|
8
8
|
import { classNames } from "../../utils";
|
|
9
|
-
const ListItemText = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
9
|
+
const ListItemText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
10
10
|
className,
|
|
11
11
|
children,
|
|
12
12
|
style,
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } fro
|
|
|
7
7
|
import { bgColor, boxBorder, cursorPointer, displayFlex, flexRow, itemsCenter, overflowHidden, parseMaxWidth, parseMinHeight, parseWidthHeight, positionRelative, textColor, userSelectNone } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, getProp } from "../../utils";
|
|
10
|
-
const ListItem = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
|
+
const ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
11
|
children,
|
|
12
12
|
className,
|
|
13
13
|
style,
|
package/components/list/list.js
CHANGED
|
@@ -7,7 +7,7 @@ import { bgColor, borderRadius, boxBorder, displayBlock, parseMaxHeight, parseMa
|
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
8
|
import { classNames, getProp } from "../../utils";
|
|
9
9
|
const levels = [0, 1, 'second', 'third', 'fourth', 'fifth'];
|
|
10
|
-
const List = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
|
+
const List = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
11
|
className,
|
|
12
12
|
width,
|
|
13
13
|
maxWidth,
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
7
|
import { bgColor, boxBorder, displayBlock, parseWidthHeight, positionSticky, textLeft, top, userSelectNone, z } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
|
-
const ListSubHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
9
|
+
const ListSubHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
10
10
|
children,
|
|
11
11
|
style,
|
|
12
12
|
...props
|
package/components/modal/body.js
CHANGED
|
@@ -9,7 +9,7 @@ import sx from "../../styles/sx";
|
|
|
9
9
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames } from "../../utils";
|
|
11
11
|
import { sxResponsivePadding } from "./header";
|
|
12
|
-
const ModalBody = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
|
|
15
15
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -9,7 +9,7 @@ import sx from "../../styles/sx";
|
|
|
9
9
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames } from "../../utils";
|
|
11
11
|
import { sxResponsivePadding } from "./header";
|
|
12
|
-
const ModalFooter = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
|
|
15
15
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -17,7 +17,7 @@ export const sxResponsivePadding = {
|
|
|
17
17
|
md: [4, 6]
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const ModalHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
20
|
+
const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
21
21
|
if (!reference) reference = useRef(null);
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
const {
|
|
@@ -5,7 +5,7 @@ import Body from "./body";
|
|
|
5
5
|
import Footer from "./footer";
|
|
6
6
|
import Header from "./header";
|
|
7
7
|
import Modal from "./modal";
|
|
8
|
-
const ModalSample = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
8
|
+
const ModalSample = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
9
|
action = {},
|
|
10
10
|
bodyStyle,
|
|
11
11
|
children,
|
|
@@ -13,7 +13,7 @@ import { classNames, getProp, hexToRGBA, useDelayUnmount } from "../../utils";
|
|
|
13
13
|
import ModalContext from "./context";
|
|
14
14
|
const fadeInDown = animations.fadeInDown;
|
|
15
15
|
const fadeOutUp = animations.fadeOutUp;
|
|
16
|
-
const Modal = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
16
|
+
const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
17
17
|
if (!reference) reference = useRef(null);
|
|
18
18
|
const theme = useTheme();
|
|
19
19
|
const {
|
|
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/core';
|
|
|
4
4
|
import { forwardRef, memo, useEffect, useState } from 'react';
|
|
5
5
|
import sx from "../../../styles/sx";
|
|
6
6
|
const OptionWrapper = Component => {
|
|
7
|
-
const WrappedComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((props, ref) => {
|
|
7
|
+
const WrappedComponent = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const [options, setOptions] = useState({});
|
|
9
9
|
const option = (option, optionValue) => {
|
|
10
10
|
if (typeof option === 'undefined') {
|
|
@@ -17,7 +17,7 @@ const getLastPage = (totalItems, itemsPerPage) => {
|
|
|
17
17
|
}
|
|
18
18
|
return _lastPage + 1;
|
|
19
19
|
};
|
|
20
|
-
const PagingInfo = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
20
|
+
const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
21
21
|
action = {},
|
|
22
22
|
bgColor: bgColorProp,
|
|
23
23
|
className,
|
|
@@ -17,7 +17,7 @@ const getLastPage = (totalItems, itemsPerPage) => {
|
|
|
17
17
|
}
|
|
18
18
|
return _lastPage + 1;
|
|
19
19
|
};
|
|
20
|
-
const PagingSelector = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
20
|
+
const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
21
21
|
action = {},
|
|
22
22
|
className,
|
|
23
23
|
currentPage,
|
|
@@ -5,7 +5,7 @@ import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } fro
|
|
|
5
5
|
import { bgColor, border, borderRadius, parseMaxHeight, parseWidth, parseWidthHeight, shadowSmall } from "../../styles/general";
|
|
6
6
|
import { useTheme } from "../../theme";
|
|
7
7
|
import { classNames, getProp, renderHTML } from "../../utils";
|
|
8
|
-
const Paper = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
8
|
+
const Paper = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
9
|
width,
|
|
10
10
|
height,
|
|
11
11
|
mapping,
|
|
@@ -8,7 +8,7 @@ import { bgColor, border, borderRadius, displayFlex, flexCol, order, overflowAut
|
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../utils";
|
|
11
|
-
const PopoverBody = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
11
|
+
const PopoverBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|