@trackunit/react-components 0.1.320 → 0.1.321-alpha-797ddc62e6a.0
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 +1 -69
- package/index.esm.js +2 -68
- package/package.json +1 -2
- package/src/components/index.d.ts +0 -1
- package/src/components/DayPicker/DayPicker.d.ts +0 -32
- package/src/components/DayPicker/DayRangePicker.d.ts +0 -33
- package/src/components/DayPicker/index.d.ts +0 -20
- package/src/components/DayPicker/useLocale.d.ts +0 -8
package/index.cjs.js
CHANGED
|
@@ -17,13 +17,11 @@ var uuid = require('uuid');
|
|
|
17
17
|
var isEqual = require('lodash/isEqual');
|
|
18
18
|
var reactUse = require('react-use');
|
|
19
19
|
var reactRouter = require('@tanstack/react-router');
|
|
20
|
-
var reactDayPicker = require('react-day-picker');
|
|
21
|
-
var tailwindMerge = require('tailwind-merge');
|
|
22
|
-
var locale = require('date-fns/locale');
|
|
23
20
|
var react = require('@floating-ui/react');
|
|
24
21
|
var omit = require('lodash/omit');
|
|
25
22
|
var usePortal = require('react-useportal');
|
|
26
23
|
var reactHelmetAsync = require('react-helmet-async');
|
|
24
|
+
var tailwindMerge = require('tailwind-merge');
|
|
27
25
|
var reactTabs = require('@radix-ui/react-tabs');
|
|
28
26
|
var dateFns = require('date-fns');
|
|
29
27
|
var reactTablePagination = require('@trackunit/react-table-pagination');
|
|
@@ -1810,70 +1808,6 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
|
1810
1808
|
return (jsxRuntime.jsx("span", { className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onAnimationEnd: () => setAnimating(false), onClick: handleOnClick, title: value, children: text }));
|
|
1811
1809
|
};
|
|
1812
1810
|
|
|
1813
|
-
const localeLookup = {
|
|
1814
|
-
en: locale.enGB,
|
|
1815
|
-
"en-US": locale.enUS,
|
|
1816
|
-
"en-GB": locale.enGB,
|
|
1817
|
-
da: locale.da,
|
|
1818
|
-
de: locale.de,
|
|
1819
|
-
cs: locale.cs,
|
|
1820
|
-
nl: locale.nl,
|
|
1821
|
-
fr: locale.fr,
|
|
1822
|
-
fi: locale.fi,
|
|
1823
|
-
hu: locale.hu,
|
|
1824
|
-
it: locale.it,
|
|
1825
|
-
nb: locale.nb,
|
|
1826
|
-
pl: locale.pl,
|
|
1827
|
-
pt: locale.pt,
|
|
1828
|
-
ru: locale.ru,
|
|
1829
|
-
ro: locale.ro,
|
|
1830
|
-
es: locale.es,
|
|
1831
|
-
sv: locale.sv,
|
|
1832
|
-
ja: locale.ja,
|
|
1833
|
-
th: locale.th,
|
|
1834
|
-
};
|
|
1835
|
-
/**
|
|
1836
|
-
* A helper function to get the matching Locale object for a given language.
|
|
1837
|
-
*
|
|
1838
|
-
* @param {string} language The language to match
|
|
1839
|
-
* @returns {Locale} The corresponding Locale object
|
|
1840
|
-
*/
|
|
1841
|
-
const useLocale = (language) => {
|
|
1842
|
-
return localeLookup[language] || localeLookup.en || locale.enGB;
|
|
1843
|
-
};
|
|
1844
|
-
|
|
1845
|
-
/**
|
|
1846
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
1847
|
-
|
|
1848
|
-
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
1849
|
-
* @returns {JSX.Element} DayPicker component
|
|
1850
|
-
*/
|
|
1851
|
-
const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
|
|
1852
|
-
const locale = useLocale(language);
|
|
1853
|
-
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { className: tailwindMerge.twMerge("custom-day-picker", className), disabled: disabledDays, footer: jsxRuntime.jsx("div", { "data-testid": dataTestId }), locale: locale, max: max, onDayClick: onDaySelect, selected: selectedDays }));
|
|
1854
|
-
};
|
|
1855
|
-
|
|
1856
|
-
/**
|
|
1857
|
-
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
1858
|
-
|
|
1859
|
-
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
1860
|
-
* @returns {JSX.Element} DayRangePicker component
|
|
1861
|
-
*/
|
|
1862
|
-
const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, }) => {
|
|
1863
|
-
const locale = useLocale(language);
|
|
1864
|
-
const onSelect = React.useCallback((range) => {
|
|
1865
|
-
if (onRangeSelect && range === undefined) {
|
|
1866
|
-
onRangeSelect(undefined);
|
|
1867
|
-
}
|
|
1868
|
-
if (onRangeSelect && range) {
|
|
1869
|
-
const from = range.from;
|
|
1870
|
-
const to = range.to ? range.to : range.from;
|
|
1871
|
-
onRangeSelect({ from, to });
|
|
1872
|
-
}
|
|
1873
|
-
}, [onRangeSelect]);
|
|
1874
|
-
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { className: tailwindMerge.twMerge("custom-day-picker", "range-picker", className), defaultMonth: selectedDays ? selectedDays.from : undefined, disabled: disabledDays, footer: jsxRuntime.jsx("div", { "data-testid": dataTestId }), locale: locale, max: max, mode: "range", onSelect: onSelect, selected: selectedDays }));
|
|
1875
|
-
};
|
|
1876
|
-
|
|
1877
1811
|
const cvaDrawerOverlay = cssClassVarianceUtilities.cvaMerge([
|
|
1878
1812
|
"bg-black/30",
|
|
1879
1813
|
"block",
|
|
@@ -4688,8 +4622,6 @@ exports.CardHeader = CardHeader;
|
|
|
4688
4622
|
exports.Collapse = Collapse;
|
|
4689
4623
|
exports.CompletionStatusIndicator = CompletionStatusIndicator;
|
|
4690
4624
|
exports.CopyableText = CopyableText;
|
|
4691
|
-
exports.DayPicker = DayPicker;
|
|
4692
|
-
exports.DayRangePicker = DayRangePicker;
|
|
4693
4625
|
exports.Drawer = Drawer;
|
|
4694
4626
|
exports.EmptyState = EmptyState;
|
|
4695
4627
|
exports.ExternalLink = ExternalLink;
|
package/index.esm.js
CHANGED
|
@@ -14,13 +14,11 @@ import { v4 } from 'uuid';
|
|
|
14
14
|
import isEqual from 'lodash/isEqual';
|
|
15
15
|
import { usePrevious, useMeasure, useCopyToClipboard } from 'react-use';
|
|
16
16
|
import { Link, useBlocker } from '@tanstack/react-router';
|
|
17
|
-
import { DayPicker as DayPicker$1 } from 'react-day-picker';
|
|
18
|
-
import { twMerge } from 'tailwind-merge';
|
|
19
|
-
import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
|
|
20
17
|
import { useFloating, FloatingFocusManager, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover as useHover$1, useRole, useInteractions, useMergeRefs, FloatingPortal, arrow, useTransitionStatus, FloatingArrow } from '@floating-ui/react';
|
|
21
18
|
import omit from 'lodash/omit';
|
|
22
19
|
import usePortal from 'react-useportal';
|
|
23
20
|
import { HelmetProvider, Helmet } from 'react-helmet-async';
|
|
21
|
+
import { twMerge } from 'tailwind-merge';
|
|
24
22
|
import { Trigger, Content, List, Root } from '@radix-ui/react-tabs';
|
|
25
23
|
import { format, formatDistance } from 'date-fns';
|
|
26
24
|
import { useInfiniteScroll, noPagination } from '@trackunit/react-table-pagination';
|
|
@@ -1778,70 +1776,6 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
|
1778
1776
|
return (jsx("span", { className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onAnimationEnd: () => setAnimating(false), onClick: handleOnClick, title: value, children: text }));
|
|
1779
1777
|
};
|
|
1780
1778
|
|
|
1781
|
-
const localeLookup = {
|
|
1782
|
-
en: enGB,
|
|
1783
|
-
"en-US": enUS,
|
|
1784
|
-
"en-GB": enGB,
|
|
1785
|
-
da,
|
|
1786
|
-
de,
|
|
1787
|
-
cs,
|
|
1788
|
-
nl,
|
|
1789
|
-
fr,
|
|
1790
|
-
fi,
|
|
1791
|
-
hu,
|
|
1792
|
-
it,
|
|
1793
|
-
nb,
|
|
1794
|
-
pl,
|
|
1795
|
-
pt,
|
|
1796
|
-
ru,
|
|
1797
|
-
ro,
|
|
1798
|
-
es,
|
|
1799
|
-
sv,
|
|
1800
|
-
ja,
|
|
1801
|
-
th,
|
|
1802
|
-
};
|
|
1803
|
-
/**
|
|
1804
|
-
* A helper function to get the matching Locale object for a given language.
|
|
1805
|
-
*
|
|
1806
|
-
* @param {string} language The language to match
|
|
1807
|
-
* @returns {Locale} The corresponding Locale object
|
|
1808
|
-
*/
|
|
1809
|
-
const useLocale = (language) => {
|
|
1810
|
-
return localeLookup[language] || localeLookup.en || enGB;
|
|
1811
|
-
};
|
|
1812
|
-
|
|
1813
|
-
/**
|
|
1814
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
1815
|
-
|
|
1816
|
-
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
1817
|
-
* @returns {JSX.Element} DayPicker component
|
|
1818
|
-
*/
|
|
1819
|
-
const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
|
|
1820
|
-
const locale = useLocale(language);
|
|
1821
|
-
return (jsx(DayPicker$1, { className: twMerge("custom-day-picker", className), disabled: disabledDays, footer: jsx("div", { "data-testid": dataTestId }), locale: locale, max: max, onDayClick: onDaySelect, selected: selectedDays }));
|
|
1822
|
-
};
|
|
1823
|
-
|
|
1824
|
-
/**
|
|
1825
|
-
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
1826
|
-
|
|
1827
|
-
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
1828
|
-
* @returns {JSX.Element} DayRangePicker component
|
|
1829
|
-
*/
|
|
1830
|
-
const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, }) => {
|
|
1831
|
-
const locale = useLocale(language);
|
|
1832
|
-
const onSelect = useCallback((range) => {
|
|
1833
|
-
if (onRangeSelect && range === undefined) {
|
|
1834
|
-
onRangeSelect(undefined);
|
|
1835
|
-
}
|
|
1836
|
-
if (onRangeSelect && range) {
|
|
1837
|
-
const from = range.from;
|
|
1838
|
-
const to = range.to ? range.to : range.from;
|
|
1839
|
-
onRangeSelect({ from, to });
|
|
1840
|
-
}
|
|
1841
|
-
}, [onRangeSelect]);
|
|
1842
|
-
return (jsx(DayPicker$1, { className: twMerge("custom-day-picker", "range-picker", className), defaultMonth: selectedDays ? selectedDays.from : undefined, disabled: disabledDays, footer: jsx("div", { "data-testid": dataTestId }), locale: locale, max: max, mode: "range", onSelect: onSelect, selected: selectedDays }));
|
|
1843
|
-
};
|
|
1844
|
-
|
|
1845
1779
|
const cvaDrawerOverlay = cvaMerge([
|
|
1846
1780
|
"bg-black/30",
|
|
1847
1781
|
"block",
|
|
@@ -4643,4 +4577,4 @@ const cvaClickable = cvaMerge([
|
|
|
4643
4577
|
},
|
|
4644
4578
|
});
|
|
4645
4579
|
|
|
4646
|
-
export { Alert, Badge, Breadcrumb, BreadcrumbContainer, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText,
|
|
4580
|
+
export { Alert, Badge, Breadcrumb, BreadcrumbContainer, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.321-alpha-797ddc62e6a.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"react": "^18.2.0",
|
|
13
13
|
"@trackunit/css-class-variance-utilities": "*",
|
|
14
14
|
"react-use": "^17.4.0",
|
|
15
|
-
"react-day-picker": "^8.9.1",
|
|
16
15
|
"date-fns": "^2.30.0",
|
|
17
16
|
"@radix-ui/react-tabs": "^1.0.4",
|
|
18
17
|
"@trackunit/ui-icons": "*",
|
|
@@ -5,7 +5,6 @@ export * from "./Card";
|
|
|
5
5
|
export * from "./Collapse";
|
|
6
6
|
export * from "./CompletionStatusIndicator/CompletionStatusIndicator";
|
|
7
7
|
export * from "./CopyableText";
|
|
8
|
-
export * from "./DayPicker";
|
|
9
8
|
export * from "./Drawer/Drawer";
|
|
10
9
|
export * from "./EmptyState/EmptyState";
|
|
11
10
|
export * from "./ExternalLink/ExternalLink";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Matcher } from "react-day-picker";
|
|
3
|
-
import { CommonProps } from "../../common/CommonProps";
|
|
4
|
-
export interface DayPickerProps extends CommonProps {
|
|
5
|
-
/**
|
|
6
|
-
* A callback function for when a date is selected
|
|
7
|
-
*/
|
|
8
|
-
onDaySelect?: (day: Date) => void;
|
|
9
|
-
/**
|
|
10
|
-
* Define any days which may not be selected
|
|
11
|
-
*/
|
|
12
|
-
disabledDays?: Matcher | Matcher[];
|
|
13
|
-
/**
|
|
14
|
-
* Set any days which are selected
|
|
15
|
-
*/
|
|
16
|
-
selectedDays?: Matcher | Matcher[];
|
|
17
|
-
/**
|
|
18
|
-
* Set the language
|
|
19
|
-
*/
|
|
20
|
-
language: string;
|
|
21
|
-
/**
|
|
22
|
-
* The maximum amount of days that can be selected
|
|
23
|
-
*/
|
|
24
|
-
max?: number;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
28
|
-
|
|
29
|
-
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
30
|
-
* @returns {JSX.Element} DayPicker component
|
|
31
|
-
*/
|
|
32
|
-
export declare const DayPicker: ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }: DayPickerProps) => JSX.Element;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DateRange, Matcher } from "react-day-picker";
|
|
3
|
-
import { CommonProps } from "../../common/CommonProps";
|
|
4
|
-
export type IDateRange = DateRange;
|
|
5
|
-
export interface DayRangePickerProps extends CommonProps {
|
|
6
|
-
/**
|
|
7
|
-
* A callback function for when a range is selected
|
|
8
|
-
*/
|
|
9
|
-
onRangeSelect?: (range: IDateRange | undefined) => void;
|
|
10
|
-
/**
|
|
11
|
-
* Define any days which may not be selected
|
|
12
|
-
*/
|
|
13
|
-
disabledDays?: Matcher | Matcher[];
|
|
14
|
-
/**
|
|
15
|
-
* Set any days which are selected
|
|
16
|
-
*/
|
|
17
|
-
selectedDays?: IDateRange;
|
|
18
|
-
/**
|
|
19
|
-
* Set the language
|
|
20
|
-
*/
|
|
21
|
-
language: string;
|
|
22
|
-
/**
|
|
23
|
-
* The maximum amount of days that can be selected
|
|
24
|
-
*/
|
|
25
|
-
max?: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
29
|
-
|
|
30
|
-
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
31
|
-
* @returns {JSX.Element} DayRangePicker component
|
|
32
|
-
*/
|
|
33
|
-
export declare const DayRangePicker: ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, }: DayRangePickerProps) => JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface TimeZone {
|
|
2
|
-
/**
|
|
3
|
-
* The unique id of the timezone
|
|
4
|
-
*
|
|
5
|
-
* @example "America/Denver"
|
|
6
|
-
*/
|
|
7
|
-
id: string;
|
|
8
|
-
/**
|
|
9
|
-
* The human-readable name of the timezone. Combines id and offset.
|
|
10
|
-
*
|
|
11
|
-
* @example "America/Denver (-06:00 MDT)"
|
|
12
|
-
*/
|
|
13
|
-
name: string;
|
|
14
|
-
/**
|
|
15
|
-
* @example "-06:00 MDT"
|
|
16
|
-
*/
|
|
17
|
-
offset: string;
|
|
18
|
-
}
|
|
19
|
-
export * from "./DayPicker";
|
|
20
|
-
export * from "./DayRangePicker";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Locale } from "date-fns";
|
|
2
|
-
/**
|
|
3
|
-
* A helper function to get the matching Locale object for a given language.
|
|
4
|
-
*
|
|
5
|
-
* @param {string} language The language to match
|
|
6
|
-
* @returns {Locale} The corresponding Locale object
|
|
7
|
-
*/
|
|
8
|
-
export declare const useLocale: (language: string) => Locale;
|