@trackunit/react-components 0.0.146 → 0.0.151
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps } from "../../common";
|
|
3
|
+
import { EChartsType } from "echarts";
|
|
3
4
|
export interface IOptionsType {
|
|
4
5
|
[key: string]: any;
|
|
5
6
|
}
|
|
@@ -32,6 +33,10 @@ export interface ChartProps extends CommonProps {
|
|
|
32
33
|
* Event fired when mouse leaves the chart.
|
|
33
34
|
*/
|
|
34
35
|
mouseLeaveChart?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Event fired when mouse is moving over the chart.
|
|
38
|
+
*/
|
|
39
|
+
mouseMoveChart?: (event: any, chart: EChartsType | undefined) => void;
|
|
35
40
|
/**
|
|
36
41
|
* CSS styles for the chart.
|
|
37
42
|
*/
|
|
@@ -73,4 +78,4 @@ export interface ChartProps extends CommonProps {
|
|
|
73
78
|
* @param {ChartProps} props - The props for the Chart component
|
|
74
79
|
* @returns {JSX.Element} Chart component
|
|
75
80
|
*/
|
|
76
|
-
export declare const Chart: ({ options, showLoading, className, style, onChartReady, onClick, onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, merge, loadingOption, timezoneLabel, renderer, dataTestId, }: ChartProps) => JSX.Element;
|
|
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,24 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Matcher } from "react-day-picker";
|
|
3
2
|
import { BaseInputProps } from "../BaseInput";
|
|
4
|
-
declare type BaseInputExposedProps = Omit<BaseInputProps, "defaultValue" | "
|
|
3
|
+
declare type BaseInputExposedProps = Omit<BaseInputProps, "defaultValue" | "min" | "max" | "value">;
|
|
5
4
|
export interface DateInputProps extends BaseInputExposedProps {
|
|
6
5
|
/**
|
|
7
|
-
* A
|
|
6
|
+
* A min value in type Date
|
|
8
7
|
*/
|
|
9
|
-
|
|
8
|
+
min?: Date;
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* A max date value in type Date
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
max?: Date;
|
|
14
13
|
/**
|
|
15
|
-
* A
|
|
14
|
+
* A default value in type Date
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
defaultValue?: Date;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
18
|
+
* A value in type Date
|
|
20
19
|
*/
|
|
21
|
-
|
|
20
|
+
value?: Date;
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* A wrapper around BaseInput with a pop-up day picker.
|
package/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { tw, tws, twx } from '@trackunit/tailwind-styled-components';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { useState, forwardRef,
|
|
4
|
+
import React__default, { useState, forwardRef, useRef, Fragment as Fragment$1, useCallback, createElement, useEffect, useContext, memo } from 'react';
|
|
5
5
|
import { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
|
|
6
6
|
import EChart from 'echarts-for-react';
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
8
|
import { useMeasure, useCopyToClipboard, useKeyPressEvent } from 'react-use';
|
|
9
|
-
import {
|
|
10
|
-
import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
|
|
9
|
+
import { format, formatDistance } from 'date-fns';
|
|
11
10
|
import { useSpring, animated } from '@react-spring/web';
|
|
12
11
|
import usePortal from 'react-useportal';
|
|
13
12
|
import { createPopper } from '@popperjs/core';
|
|
13
|
+
import { DayPicker as DayPicker$1 } from 'react-day-picker';
|
|
14
|
+
import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
|
|
14
15
|
import { Helmet } from 'react-helmet';
|
|
15
16
|
import { UNSAFE_NavigationContext } from 'react-router-dom';
|
|
16
17
|
import ReactSelect, { components } from 'react-select';
|
|
@@ -18,7 +19,6 @@ export { default as ValueType } from 'react-select';
|
|
|
18
19
|
import ReactAsyncCreatableSelect from 'react-select/async-creatable';
|
|
19
20
|
import ReactCreatableSelect from 'react-select/creatable';
|
|
20
21
|
import ReactAsyncSelect from 'react-select/async';
|
|
21
|
-
import { format, formatDistance } from 'date-fns';
|
|
22
22
|
import { getColorValue } from '@trackunit/ui-design-tokens';
|
|
23
23
|
|
|
24
24
|
const docs = {
|
|
@@ -1412,6 +1412,7 @@ const Chart = ({
|
|
|
1412
1412
|
onBrush,
|
|
1413
1413
|
onBrushSelected,
|
|
1414
1414
|
mouseLeaveChart,
|
|
1415
|
+
mouseMoveChart,
|
|
1415
1416
|
merge = true,
|
|
1416
1417
|
loadingOption,
|
|
1417
1418
|
timezoneLabel,
|
|
@@ -1440,8 +1441,16 @@ const Chart = ({
|
|
|
1440
1441
|
values.globalout = mouseLeaveChart;
|
|
1441
1442
|
}
|
|
1442
1443
|
|
|
1444
|
+
if (mouseMoveChart !== undefined) {
|
|
1445
|
+
values.mouseMove = event => {
|
|
1446
|
+
var _a;
|
|
1447
|
+
|
|
1448
|
+
mouseMoveChart(event, (_a = echartsRef === null || echartsRef === void 0 ? void 0 : echartsRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance());
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1443
1452
|
return values;
|
|
1444
|
-
}, [onDataZoom, onBrush, onBrushSelected, mouseLeaveChart]);
|
|
1453
|
+
}, [onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart]);
|
|
1445
1454
|
React.useEffect(() => {
|
|
1446
1455
|
var _a;
|
|
1447
1456
|
|
|
@@ -1506,7 +1515,7 @@ const ChartContainer = tw.div`
|
|
|
1506
1515
|
* @returns {JSX.Element} Label component
|
|
1507
1516
|
*/
|
|
1508
1517
|
|
|
1509
|
-
const Label$
|
|
1518
|
+
const Label$2 = ({
|
|
1510
1519
|
id,
|
|
1511
1520
|
htmlFor,
|
|
1512
1521
|
children,
|
|
@@ -1659,7 +1668,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
|
|
|
1659
1668
|
onKeyPress: onKeyPress
|
|
1660
1669
|
}, {
|
|
1661
1670
|
children: icon
|
|
1662
|
-
})), label && jsx(Label$
|
|
1671
|
+
})), label && jsx(Label$2, Object.assign({
|
|
1663
1672
|
className: tws`cursor-pointer`,
|
|
1664
1673
|
htmlFor: uuid,
|
|
1665
1674
|
disabled: isReadonly,
|
|
@@ -1833,64 +1842,45 @@ const StyledCopyableText = tw.span`
|
|
|
1833
1842
|
tu-copyable-text
|
|
1834
1843
|
${p => p.$animating ? tws`tu-copyable-text--animating` : null}`;
|
|
1835
1844
|
|
|
1836
|
-
const localeLookup = {
|
|
1837
|
-
en: enGB,
|
|
1838
|
-
"en-US": enUS,
|
|
1839
|
-
"en-GB": enGB,
|
|
1840
|
-
da,
|
|
1841
|
-
de,
|
|
1842
|
-
cs,
|
|
1843
|
-
nl,
|
|
1844
|
-
fr,
|
|
1845
|
-
fi,
|
|
1846
|
-
hu,
|
|
1847
|
-
it,
|
|
1848
|
-
nb,
|
|
1849
|
-
pl,
|
|
1850
|
-
pt,
|
|
1851
|
-
ru,
|
|
1852
|
-
ro,
|
|
1853
|
-
es,
|
|
1854
|
-
sv,
|
|
1855
|
-
ja,
|
|
1856
|
-
th
|
|
1857
|
-
};
|
|
1858
1845
|
/**
|
|
1859
|
-
* A
|
|
1860
|
-
*
|
|
1861
|
-
* @param {string} language The language to match
|
|
1862
|
-
* @returns {Locale} The corresponding Locale object
|
|
1863
|
-
*/
|
|
1864
|
-
|
|
1865
|
-
const useLocale = language => {
|
|
1866
|
-
return localeLookup[language] || localeLookup.en;
|
|
1867
|
-
};
|
|
1868
|
-
|
|
1869
|
-
/**
|
|
1870
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
1846
|
+
* A wrapper around BaseInput with a pop-up day picker.
|
|
1871
1847
|
*
|
|
1872
|
-
*
|
|
1873
|
-
* @returns {JSX.Element} DayPicker component
|
|
1848
|
+
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
1874
1849
|
*/
|
|
1875
1850
|
|
|
1876
|
-
const
|
|
1851
|
+
const DateInput = forwardRef((_a, ref) => {
|
|
1877
1852
|
var {
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1853
|
+
min,
|
|
1854
|
+
max,
|
|
1855
|
+
defaultValue,
|
|
1856
|
+
value
|
|
1882
1857
|
} = _a,
|
|
1883
|
-
rest = __rest(_a, ["
|
|
1858
|
+
rest = __rest(_a, ["min", "max", "defaultValue", "value"]);
|
|
1884
1859
|
|
|
1885
|
-
const
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1860
|
+
const formatDateToInputString = date => date ? format(date, "yyyy-MM-dd") : date; // @ts-ignore
|
|
1861
|
+
// Chrome needs it's default icon to have datepicker functionality.
|
|
1862
|
+
// window.chrome doesn't exist in TS but is available on chrome browsers.
|
|
1863
|
+
// If it fails it will just show our icon.
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
const hideOnChrome = () => window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "";
|
|
1867
|
+
|
|
1868
|
+
return jsx(BaseInput, Object.assign({
|
|
1869
|
+
type: "date",
|
|
1870
|
+
value: formatDateToInputString(value),
|
|
1871
|
+
defaultValue: formatDateToInputString(defaultValue),
|
|
1872
|
+
min: formatDateToInputString(min),
|
|
1873
|
+
max: formatDateToInputString(max),
|
|
1874
|
+
ref: ref,
|
|
1875
|
+
suffix: jsx(Icon$1, {
|
|
1876
|
+
dataTestId: "calendar",
|
|
1877
|
+
name: "CalendarIcon",
|
|
1878
|
+
size: "medium",
|
|
1879
|
+
type: "solid",
|
|
1880
|
+
className: hideOnChrome()
|
|
1881
|
+
})
|
|
1892
1882
|
}, rest));
|
|
1893
|
-
};
|
|
1883
|
+
});
|
|
1894
1884
|
|
|
1895
1885
|
var PopoverLifecycle;
|
|
1896
1886
|
|
|
@@ -2096,101 +2086,6 @@ const StyledCardBody = twx(CardBody)`
|
|
|
2096
2086
|
tu-popover-list-body
|
|
2097
2087
|
`;
|
|
2098
2088
|
|
|
2099
|
-
/**
|
|
2100
|
-
* A wrapper around BaseInput with a pop-up day picker.
|
|
2101
|
-
*
|
|
2102
|
-
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
2103
|
-
*/
|
|
2104
|
-
|
|
2105
|
-
const DateInput = forwardRef((_a, ref) => {
|
|
2106
|
-
var {
|
|
2107
|
-
defaultValue,
|
|
2108
|
-
disabledDays,
|
|
2109
|
-
disabled,
|
|
2110
|
-
preventDeselect,
|
|
2111
|
-
onChange
|
|
2112
|
-
} = _a,
|
|
2113
|
-
rest = __rest(_a, ["defaultValue", "disabledDays", "disabled", "preventDeselect", "onChange"]);
|
|
2114
|
-
|
|
2115
|
-
const [selectedDay, setSelectedDay] = useState(defaultValue);
|
|
2116
|
-
const onChangeHandler = useCallback(value => {
|
|
2117
|
-
const newValue = (value === null || value === void 0 ? void 0 : value.toLocaleDateString()) === (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) && !preventDeselect ? undefined : value;
|
|
2118
|
-
setSelectedDay(newValue);
|
|
2119
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
2120
|
-
}, [selectedDay, preventDeselect, onChange]);
|
|
2121
|
-
const target = useRef(null);
|
|
2122
|
-
const popover = useRef(null);
|
|
2123
|
-
const {
|
|
2124
|
-
popoverRef,
|
|
2125
|
-
targetRef,
|
|
2126
|
-
onShow,
|
|
2127
|
-
onHide,
|
|
2128
|
-
popoverProps
|
|
2129
|
-
} = usePopover({
|
|
2130
|
-
targetRef: target,
|
|
2131
|
-
popoverRef: popover,
|
|
2132
|
-
placement: "bottom"
|
|
2133
|
-
});
|
|
2134
|
-
return jsxs(Fragment, {
|
|
2135
|
-
children: [jsx(BaseInput, Object.assign({
|
|
2136
|
-
ref: ref,
|
|
2137
|
-
value: (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) || "",
|
|
2138
|
-
onChange: () => {}
|
|
2139
|
-
}, rest, {
|
|
2140
|
-
dataTestId: "dateInput",
|
|
2141
|
-
onFocus: () => {
|
|
2142
|
-
onShow();
|
|
2143
|
-
},
|
|
2144
|
-
nonInteractive: true,
|
|
2145
|
-
suffix: jsx(Icon$1, {
|
|
2146
|
-
dataTestId: "calendar",
|
|
2147
|
-
name: "CalendarIcon",
|
|
2148
|
-
size: "medium",
|
|
2149
|
-
type: "solid",
|
|
2150
|
-
onClick: !disabled ? onShow : undefined,
|
|
2151
|
-
forwardedRef: targetRef
|
|
2152
|
-
}),
|
|
2153
|
-
actions: selectedDay && jsx(RemoveValueContainer, {
|
|
2154
|
-
children: jsx(Button, Object.assign({
|
|
2155
|
-
color: "tertiary",
|
|
2156
|
-
onClick: e => {
|
|
2157
|
-
e.preventDefault();
|
|
2158
|
-
setSelectedDay(undefined);
|
|
2159
|
-
}
|
|
2160
|
-
}, {
|
|
2161
|
-
children: jsx(Icon$1, {
|
|
2162
|
-
name: "XIcon",
|
|
2163
|
-
size: "small"
|
|
2164
|
-
})
|
|
2165
|
-
}))
|
|
2166
|
-
}),
|
|
2167
|
-
onClick: e => e.preventDefault()
|
|
2168
|
-
})), jsx(AnimatedPopover, Object.assign({
|
|
2169
|
-
ref: popoverRef,
|
|
2170
|
-
onRequestClose: () => {
|
|
2171
|
-
var _a;
|
|
2172
|
-
|
|
2173
|
-
onHide();
|
|
2174
|
-
(_a = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
2175
|
-
}
|
|
2176
|
-
}, popoverProps, {
|
|
2177
|
-
children: jsx(PopoverList, Object.assign({
|
|
2178
|
-
dataTestId: "datePickerPopover"
|
|
2179
|
-
}, {
|
|
2180
|
-
children: jsx(DayPicker, {
|
|
2181
|
-
onDaySelect: onChangeHandler,
|
|
2182
|
-
disabledDays: disabledDays,
|
|
2183
|
-
selectedDays: selectedDay,
|
|
2184
|
-
language: navigator.language
|
|
2185
|
-
})
|
|
2186
|
-
}))
|
|
2187
|
-
}))]
|
|
2188
|
-
});
|
|
2189
|
-
});
|
|
2190
|
-
const RemoveValueContainer = tw.div`
|
|
2191
|
-
tu-date__remove
|
|
2192
|
-
`;
|
|
2193
|
-
|
|
2194
2089
|
/**
|
|
2195
2090
|
* The PopoverListItem component.
|
|
2196
2091
|
*
|
|
@@ -2428,7 +2323,7 @@ const FormGroup = ({
|
|
|
2428
2323
|
"$disabled": disabled
|
|
2429
2324
|
}, {
|
|
2430
2325
|
children: [jsxs(ContainerBefore, {
|
|
2431
|
-
children: [jsx(Label$
|
|
2326
|
+
children: [jsx(Label$2, Object.assign({
|
|
2432
2327
|
"data-testid": `${dataTestId}-label`
|
|
2433
2328
|
}, {
|
|
2434
2329
|
children: label
|
|
@@ -2516,6 +2411,65 @@ const DateField = forwardRef((_a, ref) => {
|
|
|
2516
2411
|
}));
|
|
2517
2412
|
});
|
|
2518
2413
|
|
|
2414
|
+
const localeLookup = {
|
|
2415
|
+
en: enGB,
|
|
2416
|
+
"en-US": enUS,
|
|
2417
|
+
"en-GB": enGB,
|
|
2418
|
+
da,
|
|
2419
|
+
de,
|
|
2420
|
+
cs,
|
|
2421
|
+
nl,
|
|
2422
|
+
fr,
|
|
2423
|
+
fi,
|
|
2424
|
+
hu,
|
|
2425
|
+
it,
|
|
2426
|
+
nb,
|
|
2427
|
+
pl,
|
|
2428
|
+
pt,
|
|
2429
|
+
ru,
|
|
2430
|
+
ro,
|
|
2431
|
+
es,
|
|
2432
|
+
sv,
|
|
2433
|
+
ja,
|
|
2434
|
+
th
|
|
2435
|
+
};
|
|
2436
|
+
/**
|
|
2437
|
+
* A helper function to get the matching Locale object for a given language.
|
|
2438
|
+
*
|
|
2439
|
+
* @param {string} language The language to match
|
|
2440
|
+
* @returns {Locale} The corresponding Locale object
|
|
2441
|
+
*/
|
|
2442
|
+
|
|
2443
|
+
const useLocale = language => {
|
|
2444
|
+
return localeLookup[language] || localeLookup.en;
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
/**
|
|
2448
|
+
* The DayPicker component is used when the user needs to select a date.
|
|
2449
|
+
*
|
|
2450
|
+
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
2451
|
+
* @returns {JSX.Element} DayPicker component
|
|
2452
|
+
*/
|
|
2453
|
+
|
|
2454
|
+
const DayPicker = _a => {
|
|
2455
|
+
var {
|
|
2456
|
+
onDaySelect,
|
|
2457
|
+
disabledDays,
|
|
2458
|
+
selectedDays,
|
|
2459
|
+
language
|
|
2460
|
+
} = _a,
|
|
2461
|
+
rest = __rest(_a, ["onDaySelect", "disabledDays", "selectedDays", "language"]);
|
|
2462
|
+
|
|
2463
|
+
const locale = useLocale(language);
|
|
2464
|
+
return jsx(DayPicker$1, Object.assign({
|
|
2465
|
+
onDayClick: onDaySelect,
|
|
2466
|
+
selected: selectedDays,
|
|
2467
|
+
locale: locale,
|
|
2468
|
+
disabled: disabledDays,
|
|
2469
|
+
className: "custom-day-picker"
|
|
2470
|
+
}, rest));
|
|
2471
|
+
};
|
|
2472
|
+
|
|
2519
2473
|
/**
|
|
2520
2474
|
* The DayPickerPopover component returns a button which when clicked shows the daypicker.
|
|
2521
2475
|
*
|
|
@@ -2665,7 +2619,7 @@ const Indicator$1 = _a => {
|
|
|
2665
2619
|
children: [ping && jsx(Ping, {
|
|
2666
2620
|
"data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping"
|
|
2667
2621
|
}), icon]
|
|
2668
|
-
})), label !== undefined && withLabel && jsx(Label$
|
|
2622
|
+
})), label !== undefined && withLabel && jsx(Label$1, Object.assign({
|
|
2669
2623
|
"data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
|
|
2670
2624
|
}, {
|
|
2671
2625
|
children: label
|
|
@@ -2723,6 +2677,24 @@ const Container$4 = tw.div`
|
|
|
2723
2677
|
case colors.UNKNOWN:
|
|
2724
2678
|
return tws`tu-indicator--unknown`;
|
|
2725
2679
|
|
|
2680
|
+
case colors.ON_RENT:
|
|
2681
|
+
return tws`tu-indicator--on-rent`;
|
|
2682
|
+
|
|
2683
|
+
case colors.AVAILABLE:
|
|
2684
|
+
return tws`tu-indicator--available`;
|
|
2685
|
+
|
|
2686
|
+
case colors.PICKUP_READY:
|
|
2687
|
+
return tws`tu-indicator--pickup-ready`;
|
|
2688
|
+
|
|
2689
|
+
case colors.TRANSFER:
|
|
2690
|
+
return tws`tu-indicator--transfer`;
|
|
2691
|
+
|
|
2692
|
+
case colors.IN_REPAIR:
|
|
2693
|
+
return tws`tu-indicator--in-repair`;
|
|
2694
|
+
|
|
2695
|
+
case colors.OTHER_RENTAL_STATUS:
|
|
2696
|
+
return tws`tu-indicator--other-rental-status`;
|
|
2697
|
+
|
|
2726
2698
|
default:
|
|
2727
2699
|
return "";
|
|
2728
2700
|
}
|
|
@@ -2737,7 +2709,7 @@ const IconBackground = tw.div`
|
|
|
2737
2709
|
return $withBackground ? "" : "tu-indicator__icon-background--none";
|
|
2738
2710
|
}}
|
|
2739
2711
|
`;
|
|
2740
|
-
const Label$
|
|
2712
|
+
const Label$1 = tw.div`
|
|
2741
2713
|
tu-indicator__label
|
|
2742
2714
|
`;
|
|
2743
2715
|
const Ping = tw.span`
|
|
@@ -2763,16 +2735,17 @@ const LegendItem = ({
|
|
|
2763
2735
|
const handleOnClick = onClick && !disabled ? () => onClick() : undefined;
|
|
2764
2736
|
return jsxs(Root$2, Object.assign({
|
|
2765
2737
|
"data-testid": dataTestId,
|
|
2766
|
-
disabled: disabled,
|
|
2738
|
+
"$disabled": disabled,
|
|
2767
2739
|
className: className,
|
|
2768
|
-
selected: selected,
|
|
2740
|
+
"$selected": selected,
|
|
2769
2741
|
onClick: handleOnClick
|
|
2770
2742
|
}, {
|
|
2771
2743
|
children: [jsx(Indicator, {
|
|
2772
2744
|
style: {
|
|
2773
2745
|
backgroundColor: color
|
|
2774
|
-
}
|
|
2775
|
-
|
|
2746
|
+
},
|
|
2747
|
+
"$selected": selected
|
|
2748
|
+
}), label && jsx("p", {
|
|
2776
2749
|
children: label
|
|
2777
2750
|
})]
|
|
2778
2751
|
}));
|
|
@@ -2784,19 +2757,18 @@ const Root$2 = tw.div`
|
|
|
2784
2757
|
ease-in-out
|
|
2785
2758
|
duration-200
|
|
2786
2759
|
text-neutral-500
|
|
2787
|
-
|
|
2788
|
-
|
|
2760
|
+
hover:text-neutral-700
|
|
2761
|
+
text-sm
|
|
2762
|
+
gap-2
|
|
2763
|
+
${p => p.$disabled ? tws`text-neutral-300` : p.$selected ? tws`text-black` : ""}
|
|
2764
|
+
${p => p.$selected ? tws`font-medium` : null}
|
|
2789
2765
|
${p => p.onClick ? tws`cursor-pointer` : tws`cursor-default`}
|
|
2790
2766
|
`;
|
|
2791
|
-
const Indicator = tw.
|
|
2792
|
-
block
|
|
2767
|
+
const Indicator = tw.div`
|
|
2793
2768
|
w-3
|
|
2794
2769
|
h-3
|
|
2795
2770
|
rounded-[50%]
|
|
2796
|
-
|
|
2797
|
-
`;
|
|
2798
|
-
const Label$1 = tw.span`
|
|
2799
|
-
text-sm
|
|
2771
|
+
${p => p.$selected ? tws`border border-black border-opacity-50` : null}
|
|
2800
2772
|
`;
|
|
2801
2773
|
|
|
2802
2774
|
/**
|
|
@@ -3363,7 +3335,7 @@ const RadioItem = ({
|
|
|
3363
3335
|
"data-testid": dataTestId,
|
|
3364
3336
|
"$checked": isChecked
|
|
3365
3337
|
}), jsxs(LabelContainer$1, {
|
|
3366
|
-
children: [jsx(Label$
|
|
3338
|
+
children: [jsx(Label$2, Object.assign({
|
|
3367
3339
|
htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${uuid}`,
|
|
3368
3340
|
dataTestId: `${dataTestId}-Label`,
|
|
3369
3341
|
disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
|
|
@@ -3425,7 +3397,7 @@ const SelectContainer$1 = ({
|
|
|
3425
3397
|
"$hasError": hasError,
|
|
3426
3398
|
"$isDisabled": isDisabled
|
|
3427
3399
|
}, {
|
|
3428
|
-
children: [label && !hideLabel && jsx(Label$
|
|
3400
|
+
children: [label && !hideLabel && jsx(Label$2, Object.assign({
|
|
3429
3401
|
htmlFor: id
|
|
3430
3402
|
}, {
|
|
3431
3403
|
children: label
|
|
@@ -4787,7 +4759,7 @@ const Toggle = React.forwardRef(({
|
|
|
4787
4759
|
})
|
|
4788
4760
|
}))]
|
|
4789
4761
|
})), jsxs(LabelContainer, {
|
|
4790
|
-
children: [jsx(Label$
|
|
4762
|
+
children: [jsx(Label$2, Object.assign({
|
|
4791
4763
|
htmlFor: id,
|
|
4792
4764
|
dataTestId: `${dataTestId}-Label`,
|
|
4793
4765
|
disabled: disabled
|
|
@@ -5353,4 +5325,4 @@ const Layout = tw.div`
|
|
|
5353
5325
|
tu-layout-TwoColumnLayout
|
|
5354
5326
|
`;
|
|
5355
5327
|
|
|
5356
|
-
export { ActionButton, Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$
|
|
5328
|
+
export { ActionButton, Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SelectPrefix, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, activityColors, colors, criticalityColors, docs, generalColors, getOrderedOptions, getValueBarColorByValue, intentColors, isMultiValue, rentalStatusColors, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.151",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"react": "17.0.2",
|
|
10
10
|
"@trackunit/ui-design-tokens": "0.0.43",
|
|
11
11
|
"echarts-for-react": "^3.0.2",
|
|
12
|
+
"echarts": "^5.4.0",
|
|
12
13
|
"uuid": "^8.3.2",
|
|
13
14
|
"react-use": "^17.4.0",
|
|
14
|
-
"react-day-picker": "^8.3.0",
|
|
15
15
|
"date-fns": "^2.29.3",
|
|
16
|
+
"react-day-picker": "^8.3.0",
|
|
16
17
|
"@trackunit/ui-icons": "0.0.46",
|
|
17
18
|
"react-useportal": "1.0.16",
|
|
18
19
|
"react-helmet": "^6.1.0",
|