@trackunit/react-components 0.1.22 → 0.1.24
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.css +3 -6
- package/index.js +35 -33
- package/package.json +1 -1
- package/src/components/Checkbox/Checkbox.d.ts +4 -0
- package/src/components/Menu/MenuItem/MenuItem.d.ts +13 -6
- package/src/components/Menu/MenuList/MenuList.d.ts +8 -2
- package/src/components/RadioGroup/RadioItem.d.ts +1 -2
- package/src/components/Search/Search.d.ts +3 -2
package/index.css
CHANGED
|
@@ -197,17 +197,14 @@
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
/* CSS related to the
|
|
200
|
+
/* CSS related to the Label component */
|
|
201
201
|
|
|
202
202
|
.tu-label {
|
|
203
|
-
@apply
|
|
204
|
-
text-base
|
|
203
|
+
@apply text-base
|
|
205
204
|
text-slate-700
|
|
205
|
+
overflow-hidden
|
|
206
206
|
whitespace-nowrap
|
|
207
207
|
text-ellipsis
|
|
208
|
-
items-center
|
|
209
|
-
grid
|
|
210
|
-
gap-2
|
|
211
208
|
hover:text-slate-800
|
|
212
209
|
group-hover:text-slate-800
|
|
213
210
|
active:text-slate-800
|
package/index.js
CHANGED
|
@@ -211,7 +211,7 @@ const IconSizeClassMap = {
|
|
|
211
211
|
* @param {IconProps} props - The props for the Icon component
|
|
212
212
|
* @returns {JSX.Element} Icon component
|
|
213
213
|
*/
|
|
214
|
-
const Icon
|
|
214
|
+
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
215
215
|
const iconSizeClassName = React.useMemo(() => IconSizeClassMap[size], [size]);
|
|
216
216
|
const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
217
217
|
const colorClassNames = React.useMemo(() => (correctIconType === "solid" ? tws `fill-current stroke-transparent` : tws `fill-transparent stroke-current`), [correctIconType]);
|
|
@@ -307,7 +307,7 @@ const ActionButton = ({ type, value, dataTestId, iconSize }) => {
|
|
|
307
307
|
return window.open(`tel:${value}`);
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
|
-
return (jsx(ActionContainer, { children: jsx(StyledIconButton, { "$fieldSize": iconSize, dataTestId: dataTestId || "testIconButtonId", size: "small", color: "tertiary", icon: jsx(Icon
|
|
310
|
+
return (jsx(ActionContainer, { children: jsx(StyledIconButton, { "$fieldSize": iconSize, dataTestId: dataTestId || "testIconButtonId", size: "small", color: "tertiary", icon: jsx(Icon, { size: "small", name: getIconName() }), onClick: ButtonAction }) }));
|
|
311
311
|
};
|
|
312
312
|
const ActionContainer = tw.div `
|
|
313
313
|
tu-action-container
|
|
@@ -330,7 +330,7 @@ const Flex$2 = tw.div `
|
|
|
330
330
|
flex
|
|
331
331
|
items-center
|
|
332
332
|
`;
|
|
333
|
-
const CustomIcon = twx(Icon
|
|
333
|
+
const CustomIcon = twx(Icon) `
|
|
334
334
|
cursor-pointer
|
|
335
335
|
w-5
|
|
336
336
|
h-5
|
|
@@ -403,13 +403,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
403
403
|
const getIconFromColor = () => {
|
|
404
404
|
switch (color) {
|
|
405
405
|
case "danger":
|
|
406
|
-
return jsx(Icon
|
|
406
|
+
return jsx(Icon, { name: "ExclamationIcon", color: "danger" });
|
|
407
407
|
case "warning":
|
|
408
|
-
return jsx(Icon
|
|
408
|
+
return jsx(Icon, { name: "ExclamationCircleIcon", color: "warning" });
|
|
409
409
|
case "success":
|
|
410
|
-
return jsx(Icon
|
|
410
|
+
return jsx(Icon, { name: "CheckCircleIcon", color: "success" });
|
|
411
411
|
default:
|
|
412
|
-
return jsx(Icon
|
|
412
|
+
return jsx(Icon, { name: "InformationCircleIcon" });
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
const getButtonColor = () => {
|
|
@@ -428,7 +428,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
428
428
|
ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
|
|
429
429
|
}
|
|
430
430
|
}, [ref, autoScroll]);
|
|
431
|
-
return (jsxs(Container$8, Object.assign({ "$color": color, className: className, "data-testid": dataTestId, "$inline": inline, ref: ref, role: "alert" }, { children: [jsx(IconContainer$1, Object.assign({ "$inline": inline }, { children: getIconFromColor() })), jsxs(Content$1, Object.assign({ "$inline": inline }, { children: [jsxs(ContentDetails, { children: [jsx(ContentBody, { children: body }), onClose && !inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon
|
|
431
|
+
return (jsxs(Container$8, Object.assign({ "$color": color, className: className, "data-testid": dataTestId, "$inline": inline, ref: ref, role: "alert" }, { children: [jsx(IconContainer$1, Object.assign({ "$inline": inline }, { children: getIconFromColor() })), jsxs(Content$1, Object.assign({ "$inline": inline }, { children: [jsxs(ContentDetails, { children: [jsx(ContentBody, { children: body }), onClose && !inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] }), (primaryAction || secondaryAction || onClose) && (jsxs(RightAligned, Object.assign({ "$inline": inline }, { children: [secondaryAction && (jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
|
|
432
432
|
};
|
|
433
433
|
const CloseButtonContainer = tw.div `
|
|
434
434
|
${p => (p.$inline ? tws `tu-alert__close-button-container--inline` : tws `tu-alert__close-button-container`)}
|
|
@@ -705,7 +705,7 @@ const StyledHeading = tw.div `
|
|
|
705
705
|
* @returns {JSX.Element} CardHeader component
|
|
706
706
|
*/
|
|
707
707
|
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
|
|
708
|
-
return (jsx(Root$8, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxs(Container$6, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs(HeadingContainer$1, { children: [jsx(Heading$1, Object.assign({ variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon
|
|
708
|
+
return (jsx(Root$8, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxs(Container$6, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs(HeadingContainer$1, { children: [jsx(Heading$1, Object.assign({ variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XIcon", size: "small" }), className: "self-start" }))] }) })));
|
|
709
709
|
};
|
|
710
710
|
const Root$8 = twx(DensityContainer) `
|
|
711
711
|
tu-card__header-density-container
|
|
@@ -872,7 +872,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
872
872
|
}, [expanded, onToggle]);
|
|
873
873
|
return (jsxs(StyledCollapse, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsx(CollapseLabel, Object.assign({ role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxs(LabelContainer$2, { children: [jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsx(IconButton, { icon: jsx(Rotate, { name: "ChevronDownIcon", size: "small", "$expanded": expanded }), size: "medium", variant: "transparent", color: "secondary" })] }) })), jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
874
874
|
};
|
|
875
|
-
const Rotate = twx(Icon
|
|
875
|
+
const Rotate = twx(Icon) `
|
|
876
876
|
${p => (p.$expanded ? tws `tu-icon--animated-rotate-expanded` : null)}
|
|
877
877
|
tu-icon--animated-rotate
|
|
878
878
|
`;
|
|
@@ -930,7 +930,7 @@ const DateInput = forwardRef((_a, ref) => {
|
|
|
930
930
|
// window.chrome doesn't exist in TS but is available on chrome browsers.
|
|
931
931
|
// If it fails it will just show our icon.
|
|
932
932
|
const hideOnChrome = () => (window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "");
|
|
933
|
-
return (jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: jsx(Icon
|
|
933
|
+
return (jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: jsx(Icon, { dataTestId: "calendar", name: "CalendarIcon", size: "medium", type: "solid", className: hideOnChrome() }) }, rest)));
|
|
934
934
|
});
|
|
935
935
|
|
|
936
936
|
/**
|
|
@@ -1070,7 +1070,7 @@ const Content = tw.div `
|
|
|
1070
1070
|
*/
|
|
1071
1071
|
const Tip = ({ children, iconProps, dataTestId, link, renderAs = "span", className, placement = "bottom", mode, }) => {
|
|
1072
1072
|
const ifAnchorTag = renderAs === "a";
|
|
1073
|
-
return (jsx(TipContainer, Object.assign({ "data-testid": dataTestId, "$as": renderAs, href: ifAnchorTag ? link : undefined, target: ifAnchorTag ? "_blank" : undefined, className: className }, { children: jsx(Tooltip, Object.assign({ label: children, dataTestId: `${dataTestId}-tooltip`, mode: mode, className: "tu-tip-tooltip", placement: placement }, { children: jsx(Icon
|
|
1073
|
+
return (jsx(TipContainer, Object.assign({ "data-testid": dataTestId, "$as": renderAs, href: ifAnchorTag ? link : undefined, target: ifAnchorTag ? "_blank" : undefined, className: className }, { children: jsx(Tooltip, Object.assign({ label: children, dataTestId: `${dataTestId}-tooltip`, mode: mode, className: "tu-tip-tooltip", placement: placement }, { children: jsx(Icon, Object.assign({ name: "QuestionMarkCircleIcon", size: "medium", dataTestId: `${dataTestId}-icon` }, iconProps)) })) })));
|
|
1074
1074
|
};
|
|
1075
1075
|
const TipContainer = tw.text `
|
|
1076
1076
|
tu-tip
|
|
@@ -1169,7 +1169,7 @@ const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, classNam
|
|
|
1169
1169
|
* @returns {JSX.Element} DayPickerPopover component
|
|
1170
1170
|
*/
|
|
1171
1171
|
const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
|
|
1172
|
-
return (jsx(Popover, Object.assign({ placement: placement, render: () => (jsx(PopoverList, { children: jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) })) }, { children: jsx(Button, Object.assign({ color: color, size: size, className: className, prefix: jsx(Icon
|
|
1172
|
+
return (jsx(Popover, Object.assign({ placement: placement, render: () => (jsx(PopoverList, { children: jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) })) }, { children: jsx(Button, Object.assign({ color: color, size: size, className: className, prefix: jsx(Icon, { name: "CalendarIcon", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker" }, { children: buttonContent })) })));
|
|
1173
1173
|
};
|
|
1174
1174
|
|
|
1175
1175
|
/**
|
|
@@ -1377,12 +1377,12 @@ const Indicator = tw.div `
|
|
|
1377
1377
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
1378
1378
|
* @returns {JSX.Element} MenuItem component
|
|
1379
1379
|
*/
|
|
1380
|
-
const MenuItem = ({ className, dataTestId, label, selected, focused, prefix,
|
|
1380
|
+
const MenuItem = ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, }) => {
|
|
1381
1381
|
const containerProps = useContainerProps({ className, dataTestId });
|
|
1382
1382
|
return (jsxs(Container$3, Object.assign({}, containerProps, { onClick: e => {
|
|
1383
1383
|
e.stopPropagation();
|
|
1384
1384
|
onClick && onClick(e);
|
|
1385
|
-
}, "$selected": selected, "$focused": focused, tabIndex: 0, "$disabled": disabled }, { children: [prefix && (jsx(Prefix, Object.assign({ "$selected": selected, "data-testid": `${dataTestId}-prefix` }, { children: prefix }))), jsx(Label, Object.assign({ "data-testid": `${dataTestId}-label` }, { children: label })),
|
|
1385
|
+
}, "$selected": selected, "$focused": focused, tabIndex: 0, "$disabled": disabled }, { children: [prefix && (jsx(Prefix, Object.assign({ "$selected": selected, "data-testid": `${dataTestId}-prefix` }, { children: prefix }))), children !== null && children !== void 0 ? children : jsx(Label, Object.assign({ "data-testid": `${dataTestId}-label` }, { children: label })), suffix && (jsx(Suffix, Object.assign({ "$selected": selected, "data-testid": `${dataTestId}-suffix` }, { children: suffix })))] })));
|
|
1386
1386
|
};
|
|
1387
1387
|
const Container$3 = tw.div `
|
|
1388
1388
|
group tu-menu-item
|
|
@@ -1391,9 +1391,9 @@ const Container$3 = tw.div `
|
|
|
1391
1391
|
${({ $disabled }) => ($disabled ? tws `tu-menu-item--disabled ` : "")}
|
|
1392
1392
|
|
|
1393
1393
|
`;
|
|
1394
|
-
const
|
|
1395
|
-
tu-menu-
|
|
1396
|
-
${({ $selected }) => ($selected ? tws `tu-menu-
|
|
1394
|
+
const Suffix = tw.div `
|
|
1395
|
+
tu-menu-item__suffix
|
|
1396
|
+
${({ $selected }) => ($selected ? tws `tu-menu-item__suffix--selected ` : "")}
|
|
1397
1397
|
`;
|
|
1398
1398
|
const Prefix = tw.div `
|
|
1399
1399
|
tu-menu-item__prefix
|
|
@@ -1410,13 +1410,14 @@ const Label = tw.div `
|
|
|
1410
1410
|
* @returns {JSX.Element} MenuList component
|
|
1411
1411
|
*/
|
|
1412
1412
|
const MenuList = (_a) => {
|
|
1413
|
-
var { dataTestId, className, children, showDivider = false } = _a; __rest(_a, ["dataTestId", "className", "children", "showDivider"]);
|
|
1413
|
+
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a; __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
1414
1414
|
const childrenArr = Children.toArray(children);
|
|
1415
1415
|
const isLastItem = (index) => index === childrenArr.length - 1;
|
|
1416
|
-
return (jsx(Container$2, Object.assign({ "data-testid": dataTestId, className: className, tabIndex: 0 }, { children: Children.map(childrenArr, (menuItem, index) => (jsxs(Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsx(Divider, {})] }))) })));
|
|
1416
|
+
return (jsx(Container$2, Object.assign({ "$withStickyHeader": withStickyHeader, "data-testid": dataTestId, className: className, tabIndex: 0 }, { children: Children.map(childrenArr, (menuItem, index) => (jsxs(Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsx(Divider, {})] }))) })));
|
|
1417
1417
|
};
|
|
1418
1418
|
const Container$2 = tw.div `
|
|
1419
1419
|
tu-menu-list
|
|
1420
|
+
${props => props.$withStickyHeader && tws `tu-menu-list--sticky-header`}
|
|
1420
1421
|
`;
|
|
1421
1422
|
const Divider = tw.hr `
|
|
1422
1423
|
tu-menu-list__divider
|
|
@@ -1443,7 +1444,7 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1443
1444
|
useClickOutside(actionMenuRef, () => {
|
|
1444
1445
|
setActionMenuIsOpen(false);
|
|
1445
1446
|
});
|
|
1446
|
-
return (jsx(Root$4, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsx(Popover, Object.assign({ render: () => children, placement: menuPlacement }, { children: jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsx(Icon
|
|
1447
|
+
return (jsx(Root$4, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsx(Popover, Object.assign({ render: () => children, placement: menuPlacement }, { children: jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsx(Icon, Object.assign({ name: dotsName }, iconProps)), onClick: () => {
|
|
1447
1448
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1448
1449
|
} })) })) })));
|
|
1449
1450
|
};
|
|
@@ -1562,7 +1563,7 @@ const Tag = React.forwardRef((_a, ref) => {
|
|
|
1562
1563
|
var { className, dataTestId, children, size = "medium", onClose, color = "primary" } = _a; __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
1563
1564
|
return (jsxs(StyledText, Object.assign({ className: className, "$size": size, "data-testid": `${dataTestId}-tag`, "$as": "span", "$color": color, "$withXIcon": !!onClose, ref: ref }, { children: [children, onClose && (
|
|
1564
1565
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
1565
|
-
jsx(IconContainer, Object.assign({ onMouseDown: onClose }, { children: jsx(Icon
|
|
1566
|
+
jsx(IconContainer, Object.assign({ onMouseDown: onClose }, { children: jsx(Icon, { name: "XCircleIcon", dataTestId: dataTestId + "Icon", type: "solid", style: { WebkitTransition: "-webkit-transform 0.150s" }, className: size === "medium" ? tws `tu-tag__icon` : tws `tu-tag__icon tu-tag__icon--small` }) })))] })));
|
|
1566
1567
|
});
|
|
1567
1568
|
const getSizeModifierClass = () => ({ $size, $withXIcon }) => {
|
|
1568
1569
|
const tagSizeModifierClass = {
|
|
@@ -1609,7 +1610,7 @@ const IconContainer = tw.div `
|
|
|
1609
1610
|
* @returns {JSX.Element} PageHeader component
|
|
1610
1611
|
*/
|
|
1611
1612
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, children, }) => {
|
|
1612
|
-
return (jsxs(StyledPageHeader, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxs(HeadingAndAccessoriesContainer, Object.assign({ "data-testid": `${dataTestId}-heading-container` }, { children: [jsxs(HeadingContainer, { children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon
|
|
1613
|
+
return (jsxs(StyledPageHeader, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxs(HeadingAndAccessoriesContainer, Object.assign({ "data-testid": `${dataTestId}-heading-container` }, { children: [jsxs(HeadingContainer, { children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeftIcon" }) })), jsx(Heading, Object.assign({ "data-testid": `${dataTestId}-heading` }, { children: title })), description && (jsx(StyledTip, Object.assign({ link: isValidHttpUrl(link) ? link : undefined, dataTestId: `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircleIcon" }, renderAs: link ? "a" : "span" }, { children: description })))] }), tag && jsx(Tag, Object.assign({ dataTestId: dataTestId }, { children: tag })), showLoading && jsx(Spinner, { dataTestId: `${dataTestId}-spinner`, centered: true }), action] })), jsx(ChildContainer$1, { children: children })] })));
|
|
1613
1614
|
};
|
|
1614
1615
|
function isValidHttpUrl(link) {
|
|
1615
1616
|
if (!link) {
|
|
@@ -1746,11 +1747,11 @@ const Pagination = ({ gotoPage, previousPage, nextPage, pageCount, pageIndex, ca
|
|
|
1746
1747
|
if (loading) {
|
|
1747
1748
|
return (jsx(Root$3, Object.assign({ className: className }, { children: jsx(SkeletonLines, { height: 16, width: 150 }) })));
|
|
1748
1749
|
}
|
|
1749
|
-
return (jsxs(Root$3, Object.assign({ "data-testid": dataTestId, className: className }, { children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon
|
|
1750
|
+
return (jsxs(Root$3, Object.assign({ "data-testid": dataTestId, className: className }, { children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "ChevronLeftIcon", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxs(Fragment, { children: [jsx(Text$1, { children: getTranslatedPage() }), jsx(PageInput, { type: "number", min: 1,
|
|
1750
1751
|
// max={amountOfPages}
|
|
1751
1752
|
value: pageInputValue, onFocus: handleOnFocus, onBlur: handleOnBlur, onChange: handleOnChange, onKeyPress: handleOnKeyPress, "data-testid": "page-input" }), jsx(TextStyled, Object.assign({ dataTestId: "page-count" }, { children: pageCount !== null && pageCount !== undefined && getTranslatedCount(pageCount) }))] })), jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
1752
1753
|
? false
|
|
1753
|
-
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon
|
|
1754
|
+
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "ChevronRightIcon", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] })));
|
|
1754
1755
|
};
|
|
1755
1756
|
const Root$3 = tw.div `
|
|
1756
1757
|
tu-pagination
|
|
@@ -1953,10 +1954,11 @@ const TextInput = forwardRef((props, ref) => (jsx(BaseInput, Object.assign({ ref
|
|
|
1953
1954
|
* @param {SearchProps} props - The props for the Search component
|
|
1954
1955
|
* @returns {JSX.Element} Search component
|
|
1955
1956
|
*/
|
|
1956
|
-
const Search = (
|
|
1957
|
-
|
|
1957
|
+
const Search = (_a) => {
|
|
1958
|
+
var { className, placeholder = "Search", value, widenInputOnFocus, showBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", ref } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "showBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete", "ref"]);
|
|
1959
|
+
return (jsx(StyledTextInput, Object.assign({}, rest, { ref: ref, dataTestId: dataTestId, name: name, className: className, "$widenOnFocus": widenInputOnFocus, "$showBorderWhenNotInFocus": showBorderWhenNotInFocus, placeholder: placeholder, prefix: jsx(Icon, { name: "SearchIcon", size: "medium" }), suffix: onClear ? (jsx("button", Object.assign({ "data-testid": `${dataTestId}_suffix_component`, onClick: () => {
|
|
1958
1960
|
onClear();
|
|
1959
|
-
} }, { children: jsx(Icon
|
|
1961
|
+
} }, { children: jsx(Icon, { name: "XIcon", size: "small" }) }))) : undefined, value: value, disabled: disabled, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, autoComplete: autoComplete })));
|
|
1960
1962
|
};
|
|
1961
1963
|
const StyledTextInput = twx(TextInput) `
|
|
1962
1964
|
tu-search
|
|
@@ -2078,7 +2080,7 @@ const SelectPrefix = tw.div `
|
|
|
2078
2080
|
* @returns {JSX.Element} SingleSelectMenuItem
|
|
2079
2081
|
*/
|
|
2080
2082
|
const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, focused, disabled, }) => {
|
|
2081
|
-
return (jsx(MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused,
|
|
2083
|
+
return (jsx(MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused, suffix: selected ? jsx(Icon, { name: "CheckIcon", size: "small" }) : undefined }));
|
|
2082
2084
|
};
|
|
2083
2085
|
/**
|
|
2084
2086
|
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
@@ -2235,12 +2237,12 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
2235
2237
|
}, LoadingIndicator: props => {
|
|
2236
2238
|
return jsx(Spinner, { size: "small", className: tws `mt-1.5 mr-1` });
|
|
2237
2239
|
}, DropdownIndicator: props => {
|
|
2238
|
-
return props.selectProps.isLoading ? null : (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(StyledIcon, { children: dropdownIcon ? (dropdownIcon) : menuIsOpen ? (jsx(Icon
|
|
2240
|
+
return props.selectProps.isLoading ? null : (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx(StyledIcon, { children: dropdownIcon ? (dropdownIcon) : menuIsOpen ? (jsx(Icon, { name: "ChevronUpIcon", size: "medium" })) : (jsx(Icon, { name: "ChevronDownIcon", size: "medium" })) }) })));
|
|
2239
2241
|
}, IndicatorSeparator: () => null, ClearIndicator: props => {
|
|
2240
2242
|
if (disabled) {
|
|
2241
2243
|
return null;
|
|
2242
2244
|
}
|
|
2243
|
-
return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(XIcon, Object.assign({ onClick: props.clearValue, "data-testid": `${dataTestId}-XIcon` }, { children: jsx(Icon
|
|
2245
|
+
return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx(XIcon, Object.assign({ onClick: props.clearValue, "data-testid": `${dataTestId}-XIcon` }, { children: jsx(Icon, { name: "XCircleIcon", size: "medium" }) })) })));
|
|
2244
2246
|
}, Control: props => {
|
|
2245
2247
|
return (jsx(components.Control, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { onTouchEnd: () => null }), className: props.isDisabled ? tws `tu-select__control--disabled` : "" })));
|
|
2246
2248
|
}, SingleValue: props => {
|
|
@@ -2642,7 +2644,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
2642
2644
|
* @param {TimeLineElementProps} props the props
|
|
2643
2645
|
* @returns {JSX.Element} component
|
|
2644
2646
|
*/
|
|
2645
|
-
const TimelineElement = ({ date, children, className, dataTestId = "timeline-date", dot = jsx(Indicator$1, { className: tws `mt-[-1px]`, color: "neutral", icon: jsx(Icon
|
|
2647
|
+
const TimelineElement = ({ date, children, className, dataTestId = "timeline-date", dot = jsx(Indicator$1, { 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, }) => {
|
|
2646
2648
|
var _a;
|
|
2647
2649
|
return (jsxs("li", Object.assign({ className: `${tws `tu-timeline-element`}${(_a = " " + className) !== null && _a !== void 0 ? _a : ""} `, "data-date": `${date}`, "data-testid": `${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 }) })] })));
|
|
2648
2650
|
};
|
|
@@ -3107,4 +3109,4 @@ const Layout = tw.div `
|
|
|
3107
3109
|
tu-layout-TwoColumnLayout
|
|
3108
3110
|
`;
|
|
3109
3111
|
|
|
3110
|
-
export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, ContentGridArea, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon
|
|
3112
|
+
export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, ContentGridArea, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, MultiSelectMenuItem, NavGridArea, NumberField, NumberInput, PageHeader, Pagination, PieChart, 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, ValueBar, docs, getDevicePixelRatio, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useDevicePixelRatio, useLocalStorage, useModal, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -9,6 +9,10 @@ export interface CheckboxProps extends CommonProps, React.InputHTMLAttributes<HT
|
|
|
9
9
|
* Children to be displayed
|
|
10
10
|
*/
|
|
11
11
|
children?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* An boolean flag to set checkbox to checked state
|
|
14
|
+
*/
|
|
15
|
+
checked?: boolean;
|
|
12
16
|
/**
|
|
13
17
|
* An boolean flag to set checkbox to disabled state
|
|
14
18
|
*/
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps } from "../../../common";
|
|
3
3
|
export interface MenuItemProps extends CommonProps {
|
|
4
|
-
/**
|
|
5
|
-
* The icon to be rendered in the menu item.
|
|
6
|
-
*/
|
|
7
|
-
icon?: JSX.Element;
|
|
8
4
|
/**
|
|
9
5
|
* Label of the menu item
|
|
10
6
|
*/
|
|
11
7
|
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The children element is a custom element that can be used to override the label.
|
|
10
|
+
* If you use this prop, the label prop will be ignored.
|
|
11
|
+
*/
|
|
12
|
+
children?: JSX.Element;
|
|
12
13
|
/**
|
|
13
14
|
* Additional tailwind classes to be applied to the component.
|
|
14
15
|
*/
|
|
@@ -22,7 +23,13 @@ export interface MenuItemProps extends CommonProps {
|
|
|
22
23
|
* This is typically used to render an icon.
|
|
23
24
|
*
|
|
24
25
|
*/
|
|
25
|
-
prefix?:
|
|
26
|
+
prefix?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* An React element to render after the label.
|
|
29
|
+
* This is typically used to render an icon.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
suffix?: JSX.Element;
|
|
26
33
|
/**
|
|
27
34
|
* An boolean flag to turn on/off selected state
|
|
28
35
|
* This is typically used highlight that item is selected
|
|
@@ -55,4 +62,4 @@ export interface MenuItemProps extends CommonProps {
|
|
|
55
62
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
56
63
|
* @returns {JSX.Element} MenuItem component
|
|
57
64
|
*/
|
|
58
|
-
export declare const MenuItem: ({ className, dataTestId, label, selected, focused, prefix,
|
|
65
|
+
export declare const MenuItem: ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, }: MenuItemProps) => JSX.Element;
|
|
@@ -15,11 +15,17 @@ export interface MenuListProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* List of menu items to be rendered.
|
|
17
17
|
*/
|
|
18
|
-
children:
|
|
18
|
+
children: React.ReactNode;
|
|
19
19
|
/**
|
|
20
20
|
* List of menu items to be rendered.
|
|
21
21
|
*/
|
|
22
22
|
showDivider?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When enabled the menu list padding will be removed, and a grid will be applied to keep the first column "sticky".
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
withStickyHeader?: boolean;
|
|
23
29
|
}
|
|
24
30
|
/**
|
|
25
31
|
* The MenuList component is used for menus and selects.
|
|
@@ -27,4 +33,4 @@ export interface MenuListProps {
|
|
|
27
33
|
* @param {MenuListProps} props - The props for the MenuList component
|
|
28
34
|
* @returns {JSX.Element} MenuList component
|
|
29
35
|
*/
|
|
30
|
-
export declare const MenuList: ({ dataTestId, className, children, showDivider, ...args }: MenuListProps) => JSX.Element;
|
|
36
|
+
export declare const MenuList: ({ dataTestId, className, children, withStickyHeader, showDivider, ...args }: MenuListProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
interface RadioItemProps extends CommonProps {
|
|
3
|
+
export interface RadioItemProps extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* The label of the radio item.
|
|
6
6
|
*/
|
|
@@ -21,4 +21,3 @@ interface RadioItemProps extends CommonProps {
|
|
|
21
21
|
* @returns {JSX.Element} RadioItem component
|
|
22
22
|
*/
|
|
23
23
|
export declare const RadioItem: ({ label, value, dataTestId, className, description }: RadioItemProps) => JSX.Element;
|
|
24
|
-
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
|
|
3
|
+
import { TextInputProps } from "../TextInput/TextInput";
|
|
4
|
+
export interface SearchProps extends CommonProps, TextInputProps {
|
|
4
5
|
/**
|
|
5
6
|
* The name for the HTML element.
|
|
6
7
|
*/
|
|
@@ -58,4 +59,4 @@ export interface SearchProps extends CommonProps {
|
|
|
58
59
|
* @param {SearchProps} props - The props for the Search component
|
|
59
60
|
* @returns {JSX.Element} Search component
|
|
60
61
|
*/
|
|
61
|
-
export declare const Search: ({ className, placeholder, value, widenInputOnFocus, showBorderWhenNotInFocus, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete, ref, }: SearchProps) => JSX.Element;
|
|
62
|
+
export declare const Search: ({ className, placeholder, value, widenInputOnFocus, showBorderWhenNotInFocus, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete, ref, ...rest }: SearchProps) => JSX.Element;
|