@trackunit/react-components 0.1.59 → 0.1.61
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/index.js +64 -158
- package/package.json +1 -3
- package/src/components/DropZone/DropZone.d.ts +34 -0
- package/src/components/index.d.ts +1 -3
- package/src/components/Chart/Chart.d.ts +0 -81
- package/src/components/Chart/index.d.ts +0 -1
- package/src/components/LegendItem/LegendItem.d.ts +0 -17
- package/src/components/LegendItem/index.d.ts +0 -1
- package/src/components/PieChart/PieChart.d.ts +0 -55
- package/src/components/PieChart/index.d.ts +0 -1
package/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { tw, tws, twx } from '@trackunit/tailwind-styled-components';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, forwardRef, useMemo, cloneElement, useCallback, useEffect, Children, useRef, memo, useContext } from 'react';
|
|
5
5
|
import { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
|
|
6
|
-
import EChart from 'echarts-for-react';
|
|
7
6
|
import { useMeasure, useCopyToClipboard } from 'react-use';
|
|
8
7
|
import { format, formatDistance } from 'date-fns';
|
|
9
8
|
import { useFloating, offset, flip, size, shift, autoUpdate, useInteractions, useClick, useHover, useRole, useDismiss, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
|
@@ -717,62 +716,6 @@ const HeadingContainer$1 = tw.div `
|
|
|
717
716
|
tu-card__header-heading-container
|
|
718
717
|
`;
|
|
719
718
|
|
|
720
|
-
/**
|
|
721
|
-
* The Chart component is a wrapper component for ECharts.
|
|
722
|
-
*
|
|
723
|
-
* Handles events and click functionality.
|
|
724
|
-
*
|
|
725
|
-
* For more information see the [eCharts documentation](https://github.com/hustcc/echarts-for-react).
|
|
726
|
-
*
|
|
727
|
-
* @param {ChartProps} props - The props for the Chart component
|
|
728
|
-
* @returns {JSX.Element} Chart component
|
|
729
|
-
*/
|
|
730
|
-
const Chart = ({ options, showLoading, className, style, onChartReady, onClick, onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart, merge = true, loadingOption, timezoneLabel, renderer = "canvas", dataTestId, }) => {
|
|
731
|
-
var _a, _b;
|
|
732
|
-
const echartsRef = React.useRef(null);
|
|
733
|
-
const eventHandlers = React.useMemo(() => {
|
|
734
|
-
const values = {};
|
|
735
|
-
if (onDataZoom !== undefined) {
|
|
736
|
-
values.dataZoom = onDataZoom;
|
|
737
|
-
}
|
|
738
|
-
if (onBrush !== undefined) {
|
|
739
|
-
values.brush = onBrush;
|
|
740
|
-
}
|
|
741
|
-
if (onBrushSelected !== undefined) {
|
|
742
|
-
values.brushSelected = onBrushSelected;
|
|
743
|
-
}
|
|
744
|
-
if (mouseLeaveChart !== undefined) {
|
|
745
|
-
values.globalout = mouseLeaveChart;
|
|
746
|
-
}
|
|
747
|
-
if (mouseMoveChart !== undefined) {
|
|
748
|
-
values.mouseMove = (event) => {
|
|
749
|
-
var _a;
|
|
750
|
-
mouseMoveChart(event, (_a = echartsRef === null || echartsRef === void 0 ? void 0 : echartsRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance());
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
return values;
|
|
754
|
-
}, [onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart]);
|
|
755
|
-
React.useEffect(() => {
|
|
756
|
-
var _a;
|
|
757
|
-
const instance = (_a = echartsRef === null || echartsRef === void 0 ? void 0 : echartsRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance();
|
|
758
|
-
if (instance && onClick) {
|
|
759
|
-
instance.on("click", onClick);
|
|
760
|
-
}
|
|
761
|
-
return () => {
|
|
762
|
-
if (instance && !instance.isDisposed()) {
|
|
763
|
-
instance.off("click", onClick);
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
}, [onClick, echartsRef]);
|
|
767
|
-
return (jsx(ChartContainer, Object.assign({ style: { height: (_a = style === null || style === void 0 ? void 0 : style.height) !== null && _a !== void 0 ? _a : "300px", width: (_b = style === null || style === void 0 ? void 0 : style.width) !== null && _b !== void 0 ? _b : "100%" }, "data-testid": dataTestId }, { children: showLoading ? (jsxs(SpinnerContainer, { children: [jsx(Spinner, { centering: "centered" }), (loadingOption === null || loadingOption === void 0 ? void 0 : loadingOption.text) && (jsx(Text$1, Object.assign({ align: "center", subtle: true }, { children: loadingOption.text })))] })) : (jsxs(Fragment, { children: [jsx(EChart, { ref: echartsRef, option: options, opts: { width: "auto", height: "auto", renderer: renderer }, notMerge: !merge, onEvents: eventHandlers, className: className, style: style, onChartReady: onChartReady }), timezoneLabel] })) })));
|
|
768
|
-
};
|
|
769
|
-
const SpinnerContainer = tw.div `
|
|
770
|
-
tu-chart-spinner-container
|
|
771
|
-
`;
|
|
772
|
-
const ChartContainer = tw.div `
|
|
773
|
-
tu-chart-container
|
|
774
|
-
`;
|
|
775
|
-
|
|
776
719
|
/**
|
|
777
720
|
* The Label component is used for labels for input fields.
|
|
778
721
|
* This component is **not used directly**, but is part of the FormGroup and Field components.
|
|
@@ -1257,6 +1200,66 @@ const Overlay = tw.div `
|
|
|
1257
1200
|
${({ $open }) => $open && tws `tu-drawer__overlay--open`}
|
|
1258
1201
|
`;
|
|
1259
1202
|
|
|
1203
|
+
/**
|
|
1204
|
+
* The Drop Zone can be used to drag and drop files
|
|
1205
|
+
*
|
|
1206
|
+
* @param {DropZoneProps} props - The props for the DropZone component
|
|
1207
|
+
* @returns {JSX.Element} DropZone component
|
|
1208
|
+
*/
|
|
1209
|
+
const DropZone = (_a) => {
|
|
1210
|
+
var { className, dataTestId, filesSelected, label, size = "large", isInvalid = false, disabled = false } = _a, rest = __rest(_a, ["className", "dataTestId", "filesSelected", "label", "size", "isInvalid", "disabled"]);
|
|
1211
|
+
const [dragActive, setDragActive] = React__default.useState(false);
|
|
1212
|
+
const [fileDropped, setFileDropped] = React__default.useState(false);
|
|
1213
|
+
// function that handles drag enter, drag leave and drag over
|
|
1214
|
+
const handleDrag = (e) => {
|
|
1215
|
+
e.preventDefault();
|
|
1216
|
+
e.stopPropagation();
|
|
1217
|
+
if ((e.type === "dragenter" || e.type === "dragover") && !disabled) {
|
|
1218
|
+
setDragActive(true);
|
|
1219
|
+
}
|
|
1220
|
+
else if (e.type === "dragleave") {
|
|
1221
|
+
setDragActive(false);
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
//function to handle when user clicks on dropzone to upload
|
|
1225
|
+
const handleChange = (e) => {
|
|
1226
|
+
e.preventDefault();
|
|
1227
|
+
e.stopPropagation();
|
|
1228
|
+
if (e.target.files && !disabled) {
|
|
1229
|
+
filesSelected(e.target.files);
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
//funtion to handle drop
|
|
1233
|
+
const handleDrop = (e) => {
|
|
1234
|
+
e.preventDefault();
|
|
1235
|
+
e.stopPropagation();
|
|
1236
|
+
setDragActive(false);
|
|
1237
|
+
if (e.dataTransfer.files && e.dataTransfer.files[0] && !disabled) {
|
|
1238
|
+
filesSelected(e.dataTransfer.files);
|
|
1239
|
+
setFileDropped(true);
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
return (jsxs(Root$5, Object.assign({ "$disabled": disabled, "$isInvalid": isInvalid, "$dragActive": dragActive, "$fileDropped": fileDropped, "$size": size, className: className, "data-testid": dataTestId, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, onClick: e => {
|
|
1243
|
+
if (disabled) {
|
|
1244
|
+
e.preventDefault();
|
|
1245
|
+
e.stopPropagation();
|
|
1246
|
+
}
|
|
1247
|
+
} }, rest, { children: [jsx("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxs(DropZoneLabel, Object.assign({ htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label` }, { children: [jsx(Icon, { type: "solid", name: "ArrowUpCircleIcon", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsx("span", { children: label })] }))] })));
|
|
1248
|
+
};
|
|
1249
|
+
const Root$5 = tw.div `
|
|
1250
|
+
tu-drop-zone
|
|
1251
|
+
${({ $size }) => ($size === "small" ? tws `tu-drop-zone--small` : null)}
|
|
1252
|
+
${({ $size }) => ($size === "medium" ? tws `tu-drop-zone--medium` : null)}
|
|
1253
|
+
${({ $size }) => ($size === "large" ? tws `tu-drop-zone--large` : null)}
|
|
1254
|
+
${({ $dragActive }) => ($dragActive ? tws `tu-drop-zone--drag-active` : null)}
|
|
1255
|
+
${({ $fileDropped }) => ($fileDropped ? tws `tu-drop-zone--drop-complete` : null)}
|
|
1256
|
+
${({ $isInvalid }) => ($isInvalid ? tws `tu-drop-zone--invalid` : null)}
|
|
1257
|
+
${({ $disabled }) => ($disabled ? tws `tu-drop-zone--disabled` : null)}
|
|
1258
|
+
`;
|
|
1259
|
+
const DropZoneLabel = tw.label `
|
|
1260
|
+
tu-drop-zone__label
|
|
1261
|
+
`;
|
|
1262
|
+
|
|
1260
1263
|
/**
|
|
1261
1264
|
* A Email Input component is used for input of the type Email.
|
|
1262
1265
|
*
|
|
@@ -1315,7 +1318,7 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
1315
1318
|
* @param {IndicatorProps} props - The props for the Indicator component
|
|
1316
1319
|
* @returns {JSX.Element} Indicator component
|
|
1317
1320
|
*/
|
|
1318
|
-
const Indicator
|
|
1321
|
+
const Indicator = (_a) => {
|
|
1319
1322
|
var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false } = _a, rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
|
|
1320
1323
|
return (jsxs(Container$4, Object.assign({ "$color": color, "data-testid": dataTestId }, rest, { title: !withLabel ? label : undefined }, { children: [jsxs(IconBackground, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", "$withBackground": withBackground }, { children: [ping && jsx(Ping, { "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" }), icon] })), label !== undefined && withLabel && (jsx(Label$1, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label" }, { children: label })))] })));
|
|
1321
1324
|
};
|
|
@@ -1394,37 +1397,6 @@ const Ping = tw.span `
|
|
|
1394
1397
|
tu-indicator__ping
|
|
1395
1398
|
`;
|
|
1396
1399
|
|
|
1397
|
-
/**
|
|
1398
|
-
* The LegendItem component is used to show form legends.
|
|
1399
|
-
*
|
|
1400
|
-
* @param {ILegendItem} props - The props for the LegendItem component
|
|
1401
|
-
* @returns {JSX.Element} LegendItem component
|
|
1402
|
-
*/
|
|
1403
|
-
const LegendItem = ({ className, label, disabled, selected, onClick, color, dataTestId }) => {
|
|
1404
|
-
const handleOnClick = onClick && !disabled ? () => onClick() : undefined;
|
|
1405
|
-
return (jsxs(Root$5, Object.assign({ "data-testid": dataTestId, "$disabled": disabled, className: className, "$selected": selected, onClick: handleOnClick }, { children: [jsx(Indicator, { style: { backgroundColor: color }, "$selected": selected }), label && jsx("p", { children: label })] })));
|
|
1406
|
-
};
|
|
1407
|
-
const Root$5 = tw.div `
|
|
1408
|
-
inline-flex
|
|
1409
|
-
items-center
|
|
1410
|
-
transition-all
|
|
1411
|
-
ease-in-out
|
|
1412
|
-
duration-200
|
|
1413
|
-
text-neutral-500
|
|
1414
|
-
hover:text-neutral-700
|
|
1415
|
-
text-sm
|
|
1416
|
-
gap-2
|
|
1417
|
-
${p => (p.$disabled ? tws `text-neutral-300` : p.$selected ? tws `text-black` : "")}
|
|
1418
|
-
${p => (p.$selected ? tws `font-medium` : null)}
|
|
1419
|
-
${p => (p.onClick ? tws `cursor-pointer` : tws `cursor-default`)}
|
|
1420
|
-
`;
|
|
1421
|
-
const Indicator = tw.div `
|
|
1422
|
-
w-3
|
|
1423
|
-
h-3
|
|
1424
|
-
rounded-[50%]
|
|
1425
|
-
${p => (p.$selected ? tws `border border-black border-opacity-50` : null)}
|
|
1426
|
-
`;
|
|
1427
|
-
|
|
1428
1400
|
/**
|
|
1429
1401
|
* The MenuItem component is used to display a menu, primarily meant to be used in a list form.
|
|
1430
1402
|
*
|
|
@@ -1740,7 +1712,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1740
1712
|
useEffect(() => {
|
|
1741
1713
|
if (pageIndex !== undefined && (isNaN(pageIndex) || pageIndex < 0)) {
|
|
1742
1714
|
setPage(pageIndex);
|
|
1743
|
-
|
|
1715
|
+
setCurrentPage(String(pageIndex + 1));
|
|
1744
1716
|
}
|
|
1745
1717
|
}, [pageIndex, setPage, setCurrentPage, pageCount]);
|
|
1746
1718
|
const handlePageChange = useCallback((action) => {
|
|
@@ -1798,72 +1770,6 @@ const PhoneInput = React.forwardRef((_a, ref) => {
|
|
|
1798
1770
|
return (jsx(BaseInput, Object.assign({ ref: ref, dataTestId: dataTestId, fieldSize: fieldSize, type: "tel", onChange: e => setPhoneNumber(e.target.value), actions: !disableAction && (jsx(ActionButton, { value: phoneNumber, type: "PHONE_NUMBER", onClick: callNumber, dataTestId: dataTestId && `${dataTestId}-phoneIcon`, iconSize: fieldSize })) }, rest)));
|
|
1799
1771
|
});
|
|
1800
1772
|
|
|
1801
|
-
/**
|
|
1802
|
-
* Create a PieChart with legends based on our current Chart component
|
|
1803
|
-
*
|
|
1804
|
-
* @param {PieChartProps} props - The props for the Chart component
|
|
1805
|
-
* @returns {JSX.Element} Chart component
|
|
1806
|
-
*/
|
|
1807
|
-
const PieChart = ({ data, size = "full", loading, onClick, className, dataTestId, }) => (jsxs(ChartRoot, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsx("div", { children: size === "full" && (jsx("div", Object.assign({ className: "flex flex-col", "data-testid": "legend" }, { children: data === null || data === void 0 ? void 0 : data.map(item => (jsx(LegendItem, { dataTestId: `legend-${item.id}`, label: (item === null || item === void 0 ? void 0 : item.count) !== undefined ? `${item.name} (${item.count})` : item.name, onClick: onClick ? () => onClick(item) : undefined, selected: item.selected, color: item.color }, item.id))) }))) }), jsx(Chart, { showLoading: loading, style: size === "full" ? { height: 110, width: 110 } : { height: 60, width: 60 }, onClick: evt => {
|
|
1808
|
-
const clickedEntry = data === null || data === void 0 ? void 0 : data.find(x => x.id === evt.data.id);
|
|
1809
|
-
if (onClick && clickedEntry) {
|
|
1810
|
-
onClick(clickedEntry);
|
|
1811
|
-
}
|
|
1812
|
-
}, options: {
|
|
1813
|
-
legend: {
|
|
1814
|
-
show: false,
|
|
1815
|
-
},
|
|
1816
|
-
tooltip: {
|
|
1817
|
-
show: false,
|
|
1818
|
-
},
|
|
1819
|
-
series: [
|
|
1820
|
-
{
|
|
1821
|
-
type: "pie",
|
|
1822
|
-
radius: ["50%", "75%"],
|
|
1823
|
-
center: ["50%", "50%"],
|
|
1824
|
-
minAngle: 10,
|
|
1825
|
-
selectedOffset: 8,
|
|
1826
|
-
itemStyle: {
|
|
1827
|
-
borderColor: "#ffffff",
|
|
1828
|
-
borderWidth: 2,
|
|
1829
|
-
},
|
|
1830
|
-
avoidLabelOverlap: false,
|
|
1831
|
-
label: {
|
|
1832
|
-
show: false,
|
|
1833
|
-
position: "center",
|
|
1834
|
-
fontSize: "18",
|
|
1835
|
-
fontWeight: "bold",
|
|
1836
|
-
},
|
|
1837
|
-
emphasis: {
|
|
1838
|
-
label: {
|
|
1839
|
-
show: true,
|
|
1840
|
-
formatter: "{c}",
|
|
1841
|
-
},
|
|
1842
|
-
},
|
|
1843
|
-
labelLine: {
|
|
1844
|
-
show: false,
|
|
1845
|
-
},
|
|
1846
|
-
data: data === null || data === void 0 ? void 0 : data.map(item => {
|
|
1847
|
-
var _a;
|
|
1848
|
-
return ({
|
|
1849
|
-
id: item.id,
|
|
1850
|
-
name: item.name,
|
|
1851
|
-
value: (_a = item === null || item === void 0 ? void 0 : item.count) !== null && _a !== void 0 ? _a : 0,
|
|
1852
|
-
itemStyle: { color: item.color },
|
|
1853
|
-
});
|
|
1854
|
-
}),
|
|
1855
|
-
},
|
|
1856
|
-
],
|
|
1857
|
-
} })] })));
|
|
1858
|
-
const ChartRoot = tw.div `
|
|
1859
|
-
flex
|
|
1860
|
-
flex-direction-col
|
|
1861
|
-
flex-wrap-reverse
|
|
1862
|
-
justify-between
|
|
1863
|
-
items-center
|
|
1864
|
-
h-full
|
|
1865
|
-
`;
|
|
1866
|
-
|
|
1867
1773
|
function useConfirmExit(confirmExit, when = true) {
|
|
1868
1774
|
const { navigator } = useContext(UNSAFE_NavigationContext);
|
|
1869
1775
|
useEffect(() => {
|
|
@@ -2675,7 +2581,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
2675
2581
|
* @param {TimeLineElementProps} props the props
|
|
2676
2582
|
* @returns {JSX.Element} component
|
|
2677
2583
|
*/
|
|
2678
|
-
const TimelineElement = ({ date, children, className, dataTestId = "timeline-date", dot = jsx(Indicator
|
|
2584
|
+
const TimelineElement = ({ date, children, className, dataTestId = "timeline-date", dot = jsx(Indicator, { className: tws `mt-[-1px]`, color: "neutral", icon: jsx(Icon, { name: "CalendarIcon", size: "large" }) }), header = `${format(date, "MMM d, yyyy")} (${formatDistance(date, new Date(), { addSuffix: true })})`, onClick, }) => {
|
|
2679
2585
|
var _a;
|
|
2680
2586
|
return (jsxs("li", Object.assign({ className: `${tws `tu-timeline-element`}${(_a = " " + className) !== null && _a !== void 0 ? _a : ""} `, "data-date": `${date}`, "data-testid": dataTestId && `${dataTestId}`, onClick: () => onClick && onClick() }, { children: [jsx("div", Object.assign({ className: tws `tu-timeline-element__dot` }, { children: dot })), jsx("div", { children: header }), jsx("div", {}), jsx("div", { children: jsx("div", { children: children }) })] })));
|
|
2681
2587
|
};
|
|
@@ -3179,4 +3085,4 @@ const Layout = tw.div `
|
|
|
3179
3085
|
tu-layout-TwoColumnLayout
|
|
3180
3086
|
`;
|
|
3181
3087
|
|
|
3182
|
-
export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader,
|
|
3088
|
+
export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Collapse, ContentGridArea, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, DropZone, EmailField, EmailInput, ExternalLink, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, MultiSelectMenuItem, NavGridArea, NumberField, NumberInput, PageHeader, Pagination, PhoneInput, Popover, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Search, SectionHeader, Select, SelectPrefix, Sidebar, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, UploadField, UploadInput, ValueBar, docs, getDevicePixelRatio, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useDevicePixelRatio, useLocalStorage, useModal, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
"@trackunit/tailwind-styled-components": "0.0.54",
|
|
9
9
|
"react": "18.2.0",
|
|
10
10
|
"@trackunit/ui-design-tokens": "0.0.60",
|
|
11
|
-
"echarts": "5.4.0",
|
|
12
|
-
"echarts-for-react": "3.0.2",
|
|
13
11
|
"react-use": "17.4.0",
|
|
14
12
|
"date-fns": "2.29.3",
|
|
15
13
|
"react-day-picker": "8.3.7",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CommonProps, Size } from "../../common";
|
|
3
|
+
import { BaseInputProps } from "../BaseInput";
|
|
4
|
+
type BaseInputExposedProps = Omit<BaseInputProps, "type" | "suffix" | "prefix" | "addonAfter" | "addonBefore" | "actions" | "placeholder" | "fieldSize" | "size" | "nonInteractive">;
|
|
5
|
+
export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
|
|
6
|
+
/**
|
|
7
|
+
* A string to set the label in Drop Zone.
|
|
8
|
+
*/
|
|
9
|
+
label: string;
|
|
10
|
+
/**
|
|
11
|
+
* A flag to disable the drop zone.
|
|
12
|
+
*/
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The size of the dropZone
|
|
16
|
+
* small - padding:8px, medium - padding:16px large - padding:32px
|
|
17
|
+
*/
|
|
18
|
+
size?: Size;
|
|
19
|
+
/**
|
|
20
|
+
* The files dropped can be accessed within filesSelected
|
|
21
|
+
*
|
|
22
|
+
* @param file
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
filesSelected: (file: FileList) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The Drop Zone can be used to drag and drop files
|
|
29
|
+
*
|
|
30
|
+
* @param {DropZoneProps} props - The props for the DropZone component
|
|
31
|
+
* @returns {JSX.Element} DropZone component
|
|
32
|
+
*/
|
|
33
|
+
export declare const DropZone: ({ className, dataTestId, filesSelected, label, size, isInvalid, disabled, ...rest }: DropZoneProps) => JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -4,7 +4,6 @@ export * from "./Badge";
|
|
|
4
4
|
export * from "./BaseInput";
|
|
5
5
|
export * from "./buttons";
|
|
6
6
|
export * from "./Card";
|
|
7
|
-
export * from "./Chart";
|
|
8
7
|
export * from "./Checkbox";
|
|
9
8
|
export * from "./Collapse";
|
|
10
9
|
export * from "./CopyableText";
|
|
@@ -12,6 +11,7 @@ export * from "./DateField/DateField";
|
|
|
12
11
|
export * from "./DateInput/DateInput";
|
|
13
12
|
export * from "./DayPicker";
|
|
14
13
|
export * from "./Drawer/Drawer";
|
|
14
|
+
export * from "./DropZone/DropZone";
|
|
15
15
|
export * from "./EmailField/EmailField";
|
|
16
16
|
export * from "./EmailInput";
|
|
17
17
|
export * from "./ExternalLink/ExternalLink";
|
|
@@ -20,7 +20,6 @@ export * from "./Heading";
|
|
|
20
20
|
export * from "./Icon/Icon";
|
|
21
21
|
export * from "./Indicator";
|
|
22
22
|
export * from "./Label";
|
|
23
|
-
export * from "./LegendItem";
|
|
24
23
|
export * from "./Menu";
|
|
25
24
|
export * from "./Modal";
|
|
26
25
|
export * from "./NumberField/NumberField";
|
|
@@ -28,7 +27,6 @@ export * from "./NumberInput/NumberInput";
|
|
|
28
27
|
export * from "./PageHeader";
|
|
29
28
|
export * from "./Pagination/Pagination";
|
|
30
29
|
export * from "./PhoneInput";
|
|
31
|
-
export * from "./PieChart";
|
|
32
30
|
export * from "./Popover";
|
|
33
31
|
export * from "./Popover/Popover";
|
|
34
32
|
export * from "./Prompt";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { EChartsType } from "echarts";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { CommonProps } from "../../common";
|
|
4
|
-
export interface IOptionsType {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface ChartProps extends CommonProps {
|
|
8
|
-
/**
|
|
9
|
-
* Option values for EChart.
|
|
10
|
-
*/
|
|
11
|
-
options: IOptionsType;
|
|
12
|
-
/**
|
|
13
|
-
* Whether or not to low the preloader.
|
|
14
|
-
*/
|
|
15
|
-
showLoading?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* onClick event.
|
|
18
|
-
*/
|
|
19
|
-
onClick?: (event: any) => void;
|
|
20
|
-
/**
|
|
21
|
-
* onDataZoom event.
|
|
22
|
-
*/
|
|
23
|
-
onDataZoom?: (event: any) => void;
|
|
24
|
-
/**
|
|
25
|
-
* onBrush event.
|
|
26
|
-
*/
|
|
27
|
-
onBrush?: (event: any) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Event fired when brush is selected.
|
|
30
|
-
*/
|
|
31
|
-
onBrushSelected?: (event: any) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Event fired when mouse leaves the chart.
|
|
34
|
-
*/
|
|
35
|
-
mouseLeaveChart?: () => void;
|
|
36
|
-
/**
|
|
37
|
-
* Event fired when mouse is moving over the chart.
|
|
38
|
-
*/
|
|
39
|
-
mouseMoveChart?: (event: any, chart: EChartsType | undefined) => void;
|
|
40
|
-
/**
|
|
41
|
-
* CSS styles for the chart.
|
|
42
|
-
*/
|
|
43
|
-
style?: Record<string, string | number>;
|
|
44
|
-
/**
|
|
45
|
-
* To denote of chart is ready or not.
|
|
46
|
-
*/
|
|
47
|
-
onChartReady?: (chart: any) => void;
|
|
48
|
-
/**
|
|
49
|
-
* Whether to merge with previous option.
|
|
50
|
-
*/
|
|
51
|
-
merge?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Values for the loading component.
|
|
54
|
-
*/
|
|
55
|
-
loadingOption?: {
|
|
56
|
-
text: string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Time-zone label.
|
|
60
|
-
*/
|
|
61
|
-
timezoneLabel?: React.ReactNode;
|
|
62
|
-
/**
|
|
63
|
-
* Type of rendered used. Either "svg" or "canvas".
|
|
64
|
-
*/
|
|
65
|
-
renderer?: "svg" | "canvas";
|
|
66
|
-
/**
|
|
67
|
-
* Value used to find element by `data-testid` attribute.
|
|
68
|
-
*/
|
|
69
|
-
dataTestId?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* The Chart component is a wrapper component for ECharts.
|
|
73
|
-
*
|
|
74
|
-
* Handles events and click functionality.
|
|
75
|
-
*
|
|
76
|
-
* For more information see the [eCharts documentation](https://github.com/hustcc/echarts-for-react).
|
|
77
|
-
*
|
|
78
|
-
* @param {ChartProps} props - The props for the Chart component
|
|
79
|
-
* @returns {JSX.Element} Chart component
|
|
80
|
-
*/
|
|
81
|
-
export declare const Chart: ({ options, showLoading, className, style, onChartReady, onClick, onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart, merge, loadingOption, timezoneLabel, renderer, dataTestId, }: ChartProps) => JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Chart";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface ILegendItem {
|
|
3
|
-
label?: string;
|
|
4
|
-
selected?: boolean;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
onClick?: () => void;
|
|
7
|
-
color: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
dataTestId?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The LegendItem component is used to show form legends.
|
|
13
|
-
*
|
|
14
|
-
* @param {ILegendItem} props - The props for the LegendItem component
|
|
15
|
-
* @returns {JSX.Element} LegendItem component
|
|
16
|
-
*/
|
|
17
|
-
export declare const LegendItem: ({ className, label, disabled, selected, onClick, color, dataTestId }: ILegendItem) => JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./LegendItem";
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
type Size = "compact" | "full";
|
|
4
|
-
export interface ChartData<T extends object = object> {
|
|
5
|
-
/**
|
|
6
|
-
* Unique ID for this entry. Not visibile for the user
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
/**
|
|
10
|
-
* The text to show for to the user
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* Number of elements with wrapped under this item
|
|
15
|
-
*/
|
|
16
|
-
count?: number;
|
|
17
|
-
/**
|
|
18
|
-
* The color to use in the chart and legends for this item
|
|
19
|
-
*/
|
|
20
|
-
color: string;
|
|
21
|
-
/**
|
|
22
|
-
* If selected, it'll be highlighted
|
|
23
|
-
*/
|
|
24
|
-
selected?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Supply the original object that this chart data item was constructed from. It'll be available on callbacks
|
|
27
|
-
*/
|
|
28
|
-
original?: T;
|
|
29
|
-
}
|
|
30
|
-
export interface PieChartProps<T extends object> extends CommonProps {
|
|
31
|
-
/**
|
|
32
|
-
* Array of data points to show
|
|
33
|
-
*/
|
|
34
|
-
data: ChartData<T>[] | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* onClick handler which includes the data object clicked on
|
|
37
|
-
*/
|
|
38
|
-
onClick?: (data: ChartData<T>) => void;
|
|
39
|
-
/**
|
|
40
|
-
* Show chart as loading
|
|
41
|
-
*/
|
|
42
|
-
loading?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* When compact, the chart is smaller and legends are hidden.
|
|
45
|
-
*/
|
|
46
|
-
size?: Size;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Create a PieChart with legends based on our current Chart component
|
|
50
|
-
*
|
|
51
|
-
* @param {PieChartProps} props - The props for the Chart component
|
|
52
|
-
* @returns {JSX.Element} Chart component
|
|
53
|
-
*/
|
|
54
|
-
export declare const PieChart: <T extends object>({ data, size, loading, onClick, className, dataTestId, }: PieChartProps<T>) => JSX.Element;
|
|
55
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./PieChart";
|