@trackunit/react-date-and-time-components 1.3.25 → 1.3.30
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.cjs.js +24 -24
- package/index.esm.js +10 -10
- package/package.json +12 -12
- package/src/DayPicker/DayPicker.d.ts +4 -4
- package/src/DayPicker/DayRangePicker.d.ts +3 -2
- package/src/DayPicker/DayRangePickerPopover.d.ts +2 -1
- package/src/Timeline/Timeline.d.ts +4 -4
- package/src/Timeline/TimelineElement.d.ts +5 -5
package/index.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
|
5
5
|
var dateAndTimeUtils = require('@trackunit/date-and-time-utils');
|
|
6
6
|
var reactDateAndTimeHooks = require('@trackunit/react-date-and-time-hooks');
|
|
7
7
|
var uiDesignTokens = require('@trackunit/ui-design-tokens');
|
|
8
|
-
var
|
|
8
|
+
var react = require('react');
|
|
9
9
|
var reactComponents = require('@trackunit/react-components');
|
|
10
10
|
var sharedUtils = require('@trackunit/shared-utils');
|
|
11
11
|
var reactDayPicker = require('react-day-picker');
|
|
@@ -91,18 +91,18 @@ const MS_PER_HOUR = 60 * 60 * 1000;
|
|
|
91
91
|
const DateTime = ({ value, format, className, fromNow, withTitle, titleFormat, timezone, subtle, calendar, }) => {
|
|
92
92
|
const { t } = useTranslation();
|
|
93
93
|
const locale = reactDateAndTimeHooks.useLocale();
|
|
94
|
-
const nowDate =
|
|
94
|
+
const nowDate = react.useMemo(() => new Date(), []);
|
|
95
95
|
const date = value ? dateAndTimeUtils.toDateUtil(value) : nowDate;
|
|
96
96
|
const newDateTime = dateAndTimeUtils.formatDateUtil(date, format, timezone?.id, locale);
|
|
97
97
|
const titleDateTime = withTitle ? dateAndTimeUtils.formatDateUtil(date, titleFormat, timezone?.id, locale) : undefined;
|
|
98
|
-
const getTimeSince =
|
|
98
|
+
const getTimeSince = react.useCallback((from, to) => {
|
|
99
99
|
const same = dateAndTimeUtils.isEqualUtil(from, to);
|
|
100
100
|
if (same) {
|
|
101
101
|
return t("dateTime.instant.now");
|
|
102
102
|
}
|
|
103
103
|
return dateAndTimeUtils.timeSinceAuto(from, to, timezone?.id, locale);
|
|
104
104
|
}, [locale, t, timezone?.id]);
|
|
105
|
-
const dateValue =
|
|
105
|
+
const dateValue = react.useMemo(() => {
|
|
106
106
|
return fromNow ? getTimeSince(date, nowDate) : newDateTime;
|
|
107
107
|
}, [date, fromNow, getTimeSince, newDateTime, nowDate]);
|
|
108
108
|
return (jsxRuntime.jsx("time", { className: className, dateTime: newDateTime, style: subtle ? { color: uiDesignTokens.color("NEUTRAL", 600, "CSS") } : undefined, title: titleDateTime, children: dateValue }));
|
|
@@ -153,9 +153,9 @@ const useLocale = (language) => {
|
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* The DayPicker component is used when the user needs to select a date.
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
158
|
-
* @returns {
|
|
158
|
+
* @returns {ReactElement} DayPicker component
|
|
159
159
|
*/
|
|
160
160
|
const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
|
|
161
161
|
const locale = useLocale(language);
|
|
@@ -166,18 +166,18 @@ const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, classNam
|
|
|
166
166
|
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
167
167
|
*
|
|
168
168
|
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
169
|
-
* @returns {
|
|
169
|
+
* @returns {ReactElement} DayRangePicker component
|
|
170
170
|
*/
|
|
171
171
|
const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, showQuickOptions, timezone, onClose, }) => {
|
|
172
|
-
const [newRange, setNewRange] =
|
|
172
|
+
const [newRange, setNewRange] = react.useState(selectedDays ?? { from: undefined, to: undefined });
|
|
173
173
|
const [t] = useTranslation();
|
|
174
174
|
const locale = useLocale(language);
|
|
175
|
-
|
|
175
|
+
react.useEffect(() => {
|
|
176
176
|
if (selectedDays) {
|
|
177
177
|
setNewRange(selectedDays);
|
|
178
178
|
}
|
|
179
179
|
}, [selectedDays]);
|
|
180
|
-
const handleOnRangeSelect =
|
|
180
|
+
const handleOnRangeSelect = react.useCallback((range) => {
|
|
181
181
|
if (range && range.from) {
|
|
182
182
|
if (range.to === undefined) {
|
|
183
183
|
setNewRange({ from: range.from, to: range.from });
|
|
@@ -190,7 +190,7 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
|
|
|
190
190
|
setNewRange({ from: undefined, to: undefined });
|
|
191
191
|
}
|
|
192
192
|
}, []);
|
|
193
|
-
const handleCancel =
|
|
193
|
+
const handleCancel = react.useCallback(() => {
|
|
194
194
|
if (selectedDays) {
|
|
195
195
|
setNewRange(selectedDays);
|
|
196
196
|
}
|
|
@@ -199,7 +199,7 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
|
|
|
199
199
|
const clearSelectedDays = () => {
|
|
200
200
|
setNewRange({ from: undefined, to: undefined });
|
|
201
201
|
};
|
|
202
|
-
const handleApply =
|
|
202
|
+
const handleApply = react.useCallback(() => {
|
|
203
203
|
onRangeSelect && onRangeSelect(newRange);
|
|
204
204
|
onClose && onClose();
|
|
205
205
|
}, [onRangeSelect, newRange, onClose]);
|
|
@@ -222,7 +222,7 @@ const calcQuickOptions = (numberOfDays) => {
|
|
|
222
222
|
const QuickOptionButton = ({ option, onClick, timezone }) => {
|
|
223
223
|
const [t] = useTranslation();
|
|
224
224
|
const { nowDate, startOf, endOf, subtract } = reactDateAndTimeHooks.useDateAndTime();
|
|
225
|
-
const handleClick =
|
|
225
|
+
const handleClick = react.useCallback(() => {
|
|
226
226
|
const from = subtract(startOf(nowDate, "day"), option.includeExtraDay ? option.last : option.last - 1, option.unit);
|
|
227
227
|
onClick({
|
|
228
228
|
from,
|
|
@@ -282,7 +282,7 @@ const QuickOptionButton = ({ option, onClick, timezone }) => {
|
|
|
282
282
|
const DayRangePickerPopover = ({ interval = { from: undefined, to: undefined }, showQuickOptions, disabledDays, className, dataTestId, onRangeSelect, variant = "ghost-neutral", size = "small", placement, timezone, fullwidth, bindTo, buttonContent, max, disabled, }) => {
|
|
283
283
|
const { language } = reactCoreHooks.useCurrentUserLanguage();
|
|
284
284
|
const [t] = useTranslation();
|
|
285
|
-
const handleOnRangeSelect =
|
|
285
|
+
const handleOnRangeSelect = react.useCallback((range) => {
|
|
286
286
|
if (range) {
|
|
287
287
|
onRangeSelect(range);
|
|
288
288
|
}
|
|
@@ -375,28 +375,28 @@ const cvaTimelineElementTime = cssClassVarianceUtilities.cvaMerge([
|
|
|
375
375
|
* The Timeline component offers a visual representation of events or milestones in chronological order, helping users easily follow the progression of activities, tasks, or data points over time.
|
|
376
376
|
*
|
|
377
377
|
* @param {TimelineProps} props - The props for the Timeline component
|
|
378
|
-
* @returns {
|
|
378
|
+
* @returns {ReactElement} Timeline component
|
|
379
379
|
*/
|
|
380
380
|
const Timeline = ({ className, dataTestId, children, dateHeader, customHeader, toggleButton, }) => {
|
|
381
|
-
const ref =
|
|
382
|
-
const [isOpen, setIsOpen] =
|
|
381
|
+
const ref = react.useRef(null);
|
|
382
|
+
const [isOpen, setIsOpen] = react.useState(false);
|
|
383
383
|
const { formatDate, formatRange } = reactDateAndTimeHooks.useDateAndTime();
|
|
384
384
|
const locale = reactDateAndTimeHooks.useLocale();
|
|
385
385
|
const hourCycle = dateAndTimeUtils.getHourCycle(locale);
|
|
386
|
-
const childrenArray =
|
|
386
|
+
const childrenArray = react.useMemo(() => react.Children.toArray(children), [children]);
|
|
387
387
|
const [firstChild, ...remainingChildren] = childrenArray;
|
|
388
|
-
const childProps =
|
|
388
|
+
const childProps = react.isValidElement(firstChild) ? firstChild.props : {};
|
|
389
389
|
const lastChild = remainingChildren.pop();
|
|
390
390
|
const middleChildren = remainingChildren;
|
|
391
|
-
|
|
391
|
+
react.useEffect(() => {
|
|
392
392
|
// Set maxHeight dynamically for smooth animation
|
|
393
393
|
if (ref.current) {
|
|
394
394
|
ref.current.style.maxHeight = isOpen ? `${ref.current.scrollHeight}px` : "0px";
|
|
395
395
|
}
|
|
396
396
|
}, [isOpen]);
|
|
397
|
-
const renderToggleButton = () => (jsxRuntime.jsxs("div", { className: cvaTimelineElement(), children: [childProps
|
|
397
|
+
const renderToggleButton = () => (jsxRuntime.jsxs("div", { className: cvaTimelineElement(), children: [childProps.date ? (jsxRuntime.jsx("div", { className: cvaTimelineElementTime({
|
|
398
398
|
width: hourCycle === "h12" || hourCycle === "h11" ? "large" : "small",
|
|
399
|
-
}) })) : null, jsxRuntime.jsx("div", { className: cvaDotWrapper(), children: jsxRuntime.jsx("div", { className: cvaLine({ lineStyle: childProps
|
|
399
|
+
}) })) : null, jsxRuntime.jsx("div", { className: cvaDotWrapper(), children: jsxRuntime.jsx("div", { className: cvaLine({ lineStyle: childProps.lineStyle }) }) }), jsxRuntime.jsxs("div", { className: "text-secondary-500 hover:text-secondary-600 flex min-h-8 cursor-pointer items-center text-sm", "data-testid": "timeline-toggle-btn", onClick: () => {
|
|
400
400
|
toggleButton?.onClick && toggleButton.onClick();
|
|
401
401
|
setIsOpen(!isOpen);
|
|
402
402
|
}, children: [jsxRuntime.jsx(reactComponents.Icon, { className: cvaToggleBtnIcon({ rotated: isOpen }), name: "ChevronDown", size: "small" }), jsxRuntime.jsx("span", { children: isOpen ? toggleButton?.collapsedLabel : toggleButton?.expandedLabel })] })] }));
|
|
@@ -418,10 +418,10 @@ const Timeline = ({ className, dataTestId, children, dateHeader, customHeader, t
|
|
|
418
418
|
* - a date as the header and the children provided as body.
|
|
419
419
|
*
|
|
420
420
|
* @param {TimeLineElementProps} props the props
|
|
421
|
-
* @returns {
|
|
421
|
+
* @returns {ReactElement} component
|
|
422
422
|
*/
|
|
423
423
|
const TimelineElement = ({ date, children, className, dataTestId = "timeline-element", header, onClick, actionButton, selected, customDot, lineStyle = "solid", hoverBehavior = false, }) => {
|
|
424
|
-
const [isHovered, setIsHovered] =
|
|
424
|
+
const [isHovered, setIsHovered] = react.useState(false);
|
|
425
425
|
const { formatDate } = reactDateAndTimeHooks.useDateAndTime();
|
|
426
426
|
const locale = reactDateAndTimeHooks.useLocale();
|
|
427
427
|
const formattedDate = date ? formatDate(date, { selectFormat: "timeOnly", timeFormat: "short" }) : null;
|
package/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-l
|
|
|
3
3
|
import { toDateUtil, formatDateUtil, isEqualUtil, timeSinceAuto, getHourCycle } from '@trackunit/date-and-time-utils';
|
|
4
4
|
import { useLocale as useLocale$1, useDateAndTime } from '@trackunit/react-date-and-time-hooks';
|
|
5
5
|
import { color } from '@trackunit/ui-design-tokens';
|
|
6
|
-
import
|
|
6
|
+
import { useMemo, useCallback, useState, useEffect, useRef, Children, isValidElement } from 'react';
|
|
7
7
|
import { Tooltip, IconButton, Icon, Button, Popover, PopoverTrigger, PopoverContent, Card, Text } from '@trackunit/react-components';
|
|
8
8
|
import { DateTimeFormat } from '@trackunit/shared-utils';
|
|
9
9
|
import { DayPicker as DayPicker$1 } from 'react-day-picker';
|
|
@@ -151,9 +151,9 @@ const useLocale = (language) => {
|
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* The DayPicker component is used when the user needs to select a date.
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
156
|
-
* @returns {
|
|
156
|
+
* @returns {ReactElement} DayPicker component
|
|
157
157
|
*/
|
|
158
158
|
const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
|
|
159
159
|
const locale = useLocale(language);
|
|
@@ -164,7 +164,7 @@ const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, classNam
|
|
|
164
164
|
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
165
165
|
*
|
|
166
166
|
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
167
|
-
* @returns {
|
|
167
|
+
* @returns {ReactElement} DayRangePicker component
|
|
168
168
|
*/
|
|
169
169
|
const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, showQuickOptions, timezone, onClose, }) => {
|
|
170
170
|
const [newRange, setNewRange] = useState(selectedDays ?? { from: undefined, to: undefined });
|
|
@@ -373,7 +373,7 @@ const cvaTimelineElementTime = cvaMerge([
|
|
|
373
373
|
* The Timeline component offers a visual representation of events or milestones in chronological order, helping users easily follow the progression of activities, tasks, or data points over time.
|
|
374
374
|
*
|
|
375
375
|
* @param {TimelineProps} props - The props for the Timeline component
|
|
376
|
-
* @returns {
|
|
376
|
+
* @returns {ReactElement} Timeline component
|
|
377
377
|
*/
|
|
378
378
|
const Timeline = ({ className, dataTestId, children, dateHeader, customHeader, toggleButton, }) => {
|
|
379
379
|
const ref = useRef(null);
|
|
@@ -381,9 +381,9 @@ const Timeline = ({ className, dataTestId, children, dateHeader, customHeader, t
|
|
|
381
381
|
const { formatDate, formatRange } = useDateAndTime();
|
|
382
382
|
const locale = useLocale$1();
|
|
383
383
|
const hourCycle = getHourCycle(locale);
|
|
384
|
-
const childrenArray = useMemo(() =>
|
|
384
|
+
const childrenArray = useMemo(() => Children.toArray(children), [children]);
|
|
385
385
|
const [firstChild, ...remainingChildren] = childrenArray;
|
|
386
|
-
const childProps =
|
|
386
|
+
const childProps = isValidElement(firstChild) ? firstChild.props : {};
|
|
387
387
|
const lastChild = remainingChildren.pop();
|
|
388
388
|
const middleChildren = remainingChildren;
|
|
389
389
|
useEffect(() => {
|
|
@@ -392,9 +392,9 @@ const Timeline = ({ className, dataTestId, children, dateHeader, customHeader, t
|
|
|
392
392
|
ref.current.style.maxHeight = isOpen ? `${ref.current.scrollHeight}px` : "0px";
|
|
393
393
|
}
|
|
394
394
|
}, [isOpen]);
|
|
395
|
-
const renderToggleButton = () => (jsxs("div", { className: cvaTimelineElement(), children: [childProps
|
|
395
|
+
const renderToggleButton = () => (jsxs("div", { className: cvaTimelineElement(), children: [childProps.date ? (jsx("div", { className: cvaTimelineElementTime({
|
|
396
396
|
width: hourCycle === "h12" || hourCycle === "h11" ? "large" : "small",
|
|
397
|
-
}) })) : null, jsx("div", { className: cvaDotWrapper(), children: jsx("div", { className: cvaLine({ lineStyle: childProps
|
|
397
|
+
}) })) : null, jsx("div", { className: cvaDotWrapper(), children: jsx("div", { className: cvaLine({ lineStyle: childProps.lineStyle }) }) }), jsxs("div", { className: "text-secondary-500 hover:text-secondary-600 flex min-h-8 cursor-pointer items-center text-sm", "data-testid": "timeline-toggle-btn", onClick: () => {
|
|
398
398
|
toggleButton?.onClick && toggleButton.onClick();
|
|
399
399
|
setIsOpen(!isOpen);
|
|
400
400
|
}, children: [jsx(Icon, { className: cvaToggleBtnIcon({ rotated: isOpen }), name: "ChevronDown", size: "small" }), jsx("span", { children: isOpen ? toggleButton?.collapsedLabel : toggleButton?.expandedLabel })] })] }));
|
|
@@ -416,7 +416,7 @@ const Timeline = ({ className, dataTestId, children, dateHeader, customHeader, t
|
|
|
416
416
|
* - a date as the header and the children provided as body.
|
|
417
417
|
*
|
|
418
418
|
* @param {TimeLineElementProps} props the props
|
|
419
|
-
* @returns {
|
|
419
|
+
* @returns {ReactElement} component
|
|
420
420
|
*/
|
|
421
421
|
const TimelineElement = ({ date, children, className, dataTestId = "timeline-element", header, onClick, actionButton, selected, customDot, lineStyle = "solid", hoverBehavior = false, }) => {
|
|
422
422
|
const [isHovered, setIsHovered] = useState(false);
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-date-and-time-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.30",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"react-day-picker": "^8.9.1",
|
|
11
10
|
"date-fns": "^2.30.0",
|
|
12
11
|
"tailwind-merge": "^2.0.0",
|
|
13
|
-
"react": "
|
|
14
|
-
"
|
|
15
|
-
"@trackunit/react-
|
|
16
|
-
"@trackunit/react-
|
|
17
|
-
"@trackunit/
|
|
18
|
-
"@trackunit/
|
|
19
|
-
"@trackunit/
|
|
20
|
-
"@trackunit/ui-
|
|
21
|
-
"@trackunit/
|
|
22
|
-
"@trackunit/
|
|
12
|
+
"react-day-picker": "9.5.1",
|
|
13
|
+
"react": "19.0.0",
|
|
14
|
+
"@trackunit/react-components": "1.4.28",
|
|
15
|
+
"@trackunit/react-date-and-time-hooks": "1.3.29",
|
|
16
|
+
"@trackunit/react-core-hooks": "1.3.29",
|
|
17
|
+
"@trackunit/date-and-time-utils": "1.3.28",
|
|
18
|
+
"@trackunit/css-class-variance-utilities": "1.3.28",
|
|
19
|
+
"@trackunit/ui-icons": "1.3.28",
|
|
20
|
+
"@trackunit/ui-design-tokens": "1.3.28",
|
|
21
|
+
"@trackunit/shared-utils": "1.5.28",
|
|
22
|
+
"@trackunit/i18n-library-translation": "1.3.29"
|
|
23
23
|
},
|
|
24
24
|
"module": "./index.esm.js",
|
|
25
25
|
"main": "./index.cjs.js",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Matcher } from "react-day-picker";
|
|
2
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
+
import { DateRange, Matcher } from "react-day-picker";
|
|
3
3
|
export interface DayPickerProps extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* A callback function for when a date is selected
|
|
@@ -12,7 +12,7 @@ export interface DayPickerProps extends CommonProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Set any days which are selected
|
|
14
14
|
*/
|
|
15
|
-
selectedDays?:
|
|
15
|
+
selectedDays?: DateRange;
|
|
16
16
|
/**
|
|
17
17
|
* Set the language
|
|
18
18
|
*/
|
|
@@ -24,8 +24,8 @@ export interface DayPickerProps extends CommonProps {
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* The DayPicker component is used when the user needs to select a date.
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
29
|
-
* @returns {
|
|
29
|
+
* @returns {ReactElement} DayPicker component
|
|
30
30
|
*/
|
|
31
31
|
export declare const DayPicker: ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }: DayPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
import { DateRange, Matcher } from "react-day-picker";
|
|
3
4
|
import { TimeZone } from "./index";
|
|
4
5
|
export interface ShowQuickOption {
|
|
@@ -46,6 +47,6 @@ export interface DayRangePickerProps extends CommonProps {
|
|
|
46
47
|
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
47
48
|
*
|
|
48
49
|
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
49
|
-
* @returns {
|
|
50
|
+
* @returns {ReactElement} DayRangePicker component
|
|
50
51
|
*/
|
|
51
|
-
export declare const DayRangePicker: ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, showQuickOptions, timezone, onClose, }: DayRangePickerProps) =>
|
|
52
|
+
export declare const DayRangePicker: ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, showQuickOptions, timezone, onClose, }: DayRangePickerProps) => ReactElement;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ButtonVariant, CommonProps, PopoverPlacement, Size } from "@trackunit/react-components";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
import { Matcher } from "react-day-picker";
|
|
3
4
|
import { IDateRange, ShowQuickOption } from "./DayRangePicker";
|
|
4
5
|
import { TimeZone } from "./index";
|
|
@@ -17,7 +18,7 @@ export interface DayRangePickerPopoverProps extends CommonProps {
|
|
|
17
18
|
timezone?: TimeZone;
|
|
18
19
|
/** An element to use as the portal root for the popover component */
|
|
19
20
|
bindTo?: HTMLElement;
|
|
20
|
-
buttonContent:
|
|
21
|
+
buttonContent: ReactElement;
|
|
21
22
|
max?: number;
|
|
22
23
|
disabled?: boolean;
|
|
23
24
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DateRange } from "@trackunit/date-and-time-utils";
|
|
2
2
|
import { CommonProps } from "@trackunit/react-components";
|
|
3
|
-
import
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
4
|
export interface TimelineProps extends CommonProps {
|
|
5
|
-
children:
|
|
5
|
+
children: ReactNode;
|
|
6
6
|
toggleButton?: {
|
|
7
7
|
expandedLabel: string;
|
|
8
8
|
collapsedLabel: string;
|
|
@@ -17,12 +17,12 @@ export interface TimelineProps extends CommonProps {
|
|
|
17
17
|
}) & {
|
|
18
18
|
showTime?: boolean;
|
|
19
19
|
};
|
|
20
|
-
customHeader?:
|
|
20
|
+
customHeader?: ReactNode;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* The Timeline component offers a visual representation of events or milestones in chronological order, helping users easily follow the progression of activities, tasks, or data points over time.
|
|
24
24
|
*
|
|
25
25
|
* @param {TimelineProps} props - The props for the Timeline component
|
|
26
|
-
* @returns {
|
|
26
|
+
* @returns {ReactElement} Timeline component
|
|
27
27
|
*/
|
|
28
28
|
export declare const Timeline: ({ className, dataTestId, children, dateHeader, customHeader, toggleButton, }: TimelineProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { CommonProps, IconColors } from "@trackunit/react-components";
|
|
2
2
|
import { IconName } from "@trackunit/ui-icons";
|
|
3
|
-
import
|
|
3
|
+
import { ReactNode, MouseEvent } from "react";
|
|
4
4
|
interface TimeLineElementProps extends CommonProps {
|
|
5
5
|
date?: Date;
|
|
6
|
-
header?:
|
|
7
|
-
children?:
|
|
6
|
+
header?: ReactNode;
|
|
7
|
+
children?: ReactNode;
|
|
8
8
|
customDot?: {
|
|
9
9
|
name: IconName;
|
|
10
10
|
color: IconColors;
|
|
11
11
|
keepOnSelection?: boolean;
|
|
12
12
|
};
|
|
13
|
-
onClick?: (e?:
|
|
13
|
+
onClick?: (e?: MouseEvent<HTMLDivElement>) => void;
|
|
14
14
|
actionButton?: {
|
|
15
15
|
label: string;
|
|
16
16
|
iconName: IconName;
|
|
@@ -24,7 +24,7 @@ interface TimeLineElementProps extends CommonProps {
|
|
|
24
24
|
* - a date as the header and the children provided as body.
|
|
25
25
|
*
|
|
26
26
|
* @param {TimeLineElementProps} props the props
|
|
27
|
-
* @returns {
|
|
27
|
+
* @returns {ReactElement} component
|
|
28
28
|
*/
|
|
29
29
|
export declare const TimelineElement: ({ date, children, className, dataTestId, header, onClick, actionButton, selected, customDot, lineStyle, hoverBehavior, }: TimeLineElementProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
export {};
|