@trackunit/react-components 1.8.8 → 1.8.10
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 +94 -30
- package/index.esm.js +94 -32
- package/package.json +1 -1
- package/src/components/DetailsList/DetailsList.d.ts +17 -0
- package/src/components/DetailsList/DetailsList.variants.d.ts +4 -0
- package/src/components/ListItem/ListItem.d.ts +33 -0
- package/src/components/ListItem/ListItem.variants.d.ts +5 -0
- package/src/components/index.d.ts +2 -0
package/index.cjs.js
CHANGED
|
@@ -2132,6 +2132,29 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
|
2132
2132
|
return (jsxRuntime.jsx("span", { className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onAnimationEnd: () => setAnimating(false), onClick: handleOnClick, title: value, children: text }));
|
|
2133
2133
|
};
|
|
2134
2134
|
|
|
2135
|
+
const cvaDetailsList = cssClassVarianceUtilities.cvaMerge(["flex", "w-full", "min-w-0", "items-center", "truncate", "text-xs", "text-gray-600", "font-medium"], {
|
|
2136
|
+
variants: {
|
|
2137
|
+
density: {
|
|
2138
|
+
default: "pt-0",
|
|
2139
|
+
compact: "pt-1",
|
|
2140
|
+
},
|
|
2141
|
+
},
|
|
2142
|
+
});
|
|
2143
|
+
const cvaDetailsListItem = cssClassVarianceUtilities.cvaMerge(["last:truncate"]);
|
|
2144
|
+
|
|
2145
|
+
/**
|
|
2146
|
+
* Renders a one-line list of details separated by a Slash icon.
|
|
2147
|
+
*
|
|
2148
|
+
* @param {object} props - Component props.
|
|
2149
|
+
* @param {string[]} props.details - Values to render.
|
|
2150
|
+
* @param {string} [props.className] - Optional CSS class for customization.
|
|
2151
|
+
* @param {"compact" | "default"} [props.density="default"] - Visual density of the list.
|
|
2152
|
+
* @returns {ReactElement} The details list element.
|
|
2153
|
+
*/
|
|
2154
|
+
const DetailsList = ({ details, className, density = "default" }) => {
|
|
2155
|
+
return (jsxRuntime.jsx("div", { className: cvaDetailsList({ className, density }), children: details.map((value, index, array) => (jsxRuntime.jsxs(react.Fragment, { children: [jsxRuntime.jsx("span", { className: cvaDetailsListItem({ className }), children: value }), index < array.length - 1 && (jsxRuntime.jsx("div", { className: "mx-0.5 flex items-center", children: jsxRuntime.jsx(Icon, { className: "w-4 text-neutral-300", color: "neutral", name: "Slash", size: "small" }) }))] }, index))) }));
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2135
2158
|
const cvaSkeletonLine = cssClassVarianceUtilities.cvaMerge([
|
|
2136
2159
|
"rounded-md",
|
|
2137
2160
|
"h-3",
|
|
@@ -3024,36 +3047,6 @@ const cvaCardBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["grid",
|
|
|
3024
3047
|
},
|
|
3025
3048
|
});
|
|
3026
3049
|
|
|
3027
|
-
const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
|
|
3028
|
-
"shadow",
|
|
3029
|
-
"rounded-lg",
|
|
3030
|
-
"z-popover",
|
|
3031
|
-
"bg-white",
|
|
3032
|
-
"border",
|
|
3033
|
-
"border-slate-300",
|
|
3034
|
-
"grid",
|
|
3035
|
-
"min-w-[200px]",
|
|
3036
|
-
"max-w-[300px]",
|
|
3037
|
-
"p-1",
|
|
3038
|
-
], {
|
|
3039
|
-
variants: {
|
|
3040
|
-
stickyHeader: {
|
|
3041
|
-
true: "grid-rows-min-fr grid overflow-y-hidden",
|
|
3042
|
-
false: "",
|
|
3043
|
-
},
|
|
3044
|
-
},
|
|
3045
|
-
});
|
|
3046
|
-
const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
|
|
3047
|
-
const cvaMenuListMultiSelect = cssClassVarianceUtilities.cvaMerge("hover:!bg-blue-200");
|
|
3048
|
-
const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-full");
|
|
3049
|
-
|
|
3050
|
-
/**
|
|
3051
|
-
* The MenuDivider component is used to separate items in a menu list.
|
|
3052
|
-
*/
|
|
3053
|
-
const MenuDivider = () => {
|
|
3054
|
-
return jsxRuntime.jsx("div", { className: cvaMenuListDivider(), "data-testid": "menu-divider" });
|
|
3055
|
-
};
|
|
3056
|
-
|
|
3057
3050
|
/**
|
|
3058
3051
|
* Applies standardized interaction-related styles to an element.
|
|
3059
3052
|
*
|
|
@@ -3115,6 +3108,75 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
3115
3108
|
},
|
|
3116
3109
|
});
|
|
3117
3110
|
|
|
3111
|
+
const cvaListItem = cssClassVarianceUtilities.cvaMerge(["py-3", "px-4", "min-h-14", "w-full", "flex", "justify-between", "items-center"]);
|
|
3112
|
+
const cvaMainInformationClass = cssClassVarianceUtilities.cvaMerge(["grid", "items-center", "text-sm", "gap-2"], {
|
|
3113
|
+
variants: {
|
|
3114
|
+
hasThumbnail: {
|
|
3115
|
+
true: "grid-cols-min-fr",
|
|
3116
|
+
false: "grid-cols-1",
|
|
3117
|
+
},
|
|
3118
|
+
},
|
|
3119
|
+
});
|
|
3120
|
+
const cvaThumbnailContainer = cssClassVarianceUtilities.cvaMerge([
|
|
3121
|
+
"flex",
|
|
3122
|
+
"h-8",
|
|
3123
|
+
"w-8",
|
|
3124
|
+
"items-center",
|
|
3125
|
+
"justify-center",
|
|
3126
|
+
"overflow-hidden",
|
|
3127
|
+
"rounded-md",
|
|
3128
|
+
]);
|
|
3129
|
+
|
|
3130
|
+
/**
|
|
3131
|
+
* The ListItem is designed to present a concise set of items for quick scanning and navigation. It supports multiple content types and actions, and its flexible layout allows for customization based on the type of data being shown - assets, events, users, etc.
|
|
3132
|
+
*
|
|
3133
|
+
* @param { ListItemProps} props - The props for the ListItem component
|
|
3134
|
+
* @returns {Element} ListItem component
|
|
3135
|
+
*/
|
|
3136
|
+
const ListItem = ({ className, dataTestId, onClick, details, title, description, meta, thumbnail, thumbnailColor = "info-600", thumbnailBackground = "info-100", }) => {
|
|
3137
|
+
const baseClass = cvaListItem({ className });
|
|
3138
|
+
const interactableItemClass = onClick ? tailwindMerge.twMerge(baseClass, cvaInteractableItem({ cursor: "pointer" })) : baseClass;
|
|
3139
|
+
return (jsxRuntime.jsxs("div", { className: interactableItemClass, "data-testid": dataTestId, onClick: onClick, children: [jsxRuntime.jsxs("div", { className: cvaMainInformationClass({ hasThumbnail: !!thumbnail }), children: [thumbnail ? (jsxRuntime.jsx("div", { className: cvaThumbnailContainer({
|
|
3140
|
+
className: `text-${thumbnailColor} bg-${thumbnailBackground}`,
|
|
3141
|
+
}), children: thumbnail })) : null, jsxRuntime.jsxs("div", { className: "grid-rows-min-fr grid items-center text-sm", children: [jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center text-sm", children: typeof title === "string" ? (jsxRuntime.jsx(Text, { className: "truncate", dataTestId: dataTestId ? `${dataTestId}-title` : undefined, weight: "bold", children: title })) : (react.cloneElement(title, {
|
|
3142
|
+
className: tailwindMerge.twMerge(title.props.className, "neutral-900 text-sm font-medium truncate"),
|
|
3143
|
+
dataTestId: !title.props.dataTestId && dataTestId ? `${dataTestId}-title` : undefined,
|
|
3144
|
+
})) }), description ? (jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center", children: typeof description === "string" ? (jsxRuntime.jsx(Text, { className: "truncate text-xs text-neutral-500", dataTestId: dataTestId ? `${dataTestId}-description` : undefined, weight: "bold", children: description })) : (react.cloneElement(description, {
|
|
3145
|
+
className: tailwindMerge.twMerge(description.props.className, "text-neutral-500 text-xs font-medium truncate"),
|
|
3146
|
+
dataTestId: !description.props.dataTestId && dataTestId ? `${dataTestId}-description` : undefined,
|
|
3147
|
+
})) })) : null, meta ? (jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center pt-0.5", children: jsxRuntime.jsx(Text, { className: "truncate text-xs text-neutral-400", dataTestId: dataTestId ? `${dataTestId}-meta` : undefined, weight: "bold", children: meta }) })) : null] })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5 pl-2", children: [details, onClick ? jsxRuntime.jsx(Icon, { color: "neutral", name: "ChevronRight", size: "medium" }) : null] })] }));
|
|
3148
|
+
};
|
|
3149
|
+
|
|
3150
|
+
const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
|
|
3151
|
+
"shadow",
|
|
3152
|
+
"rounded-lg",
|
|
3153
|
+
"z-popover",
|
|
3154
|
+
"bg-white",
|
|
3155
|
+
"border",
|
|
3156
|
+
"border-slate-300",
|
|
3157
|
+
"grid",
|
|
3158
|
+
"min-w-[200px]",
|
|
3159
|
+
"max-w-[300px]",
|
|
3160
|
+
"p-1",
|
|
3161
|
+
], {
|
|
3162
|
+
variants: {
|
|
3163
|
+
stickyHeader: {
|
|
3164
|
+
true: "grid-rows-min-fr grid overflow-y-hidden",
|
|
3165
|
+
false: "",
|
|
3166
|
+
},
|
|
3167
|
+
},
|
|
3168
|
+
});
|
|
3169
|
+
const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
|
|
3170
|
+
const cvaMenuListMultiSelect = cssClassVarianceUtilities.cvaMerge("hover:!bg-blue-200");
|
|
3171
|
+
const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-full");
|
|
3172
|
+
|
|
3173
|
+
/**
|
|
3174
|
+
* The MenuDivider component is used to separate items in a menu list.
|
|
3175
|
+
*/
|
|
3176
|
+
const MenuDivider = () => {
|
|
3177
|
+
return jsxRuntime.jsx("div", { className: cvaMenuListDivider(), "data-testid": "menu-divider" });
|
|
3178
|
+
};
|
|
3179
|
+
|
|
3118
3180
|
/**
|
|
3119
3181
|
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
3120
3182
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
@@ -4310,6 +4372,7 @@ exports.CardHeader = CardHeader;
|
|
|
4310
4372
|
exports.Collapse = Collapse;
|
|
4311
4373
|
exports.CompletionStatusIndicator = CompletionStatusIndicator;
|
|
4312
4374
|
exports.CopyableText = CopyableText;
|
|
4375
|
+
exports.DetailsList = DetailsList;
|
|
4313
4376
|
exports.EmptyState = EmptyState;
|
|
4314
4377
|
exports.EmptyValue = EmptyValue;
|
|
4315
4378
|
exports.ExternalLink = ExternalLink;
|
|
@@ -4320,6 +4383,7 @@ exports.IconButton = IconButton;
|
|
|
4320
4383
|
exports.Indicator = Indicator;
|
|
4321
4384
|
exports.KPI = KPI;
|
|
4322
4385
|
exports.KPICard = KPICard;
|
|
4386
|
+
exports.ListItem = ListItem;
|
|
4323
4387
|
exports.MenuDivider = MenuDivider;
|
|
4324
4388
|
exports.MenuItem = MenuItem;
|
|
4325
4389
|
exports.MenuList = MenuList;
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useMemo, useEffect, useState, useCallback, createElement, useReducer, memo, forwardRef, createContext, useContext, isValidElement, cloneElement, Children } from 'react';
|
|
2
|
+
import { useRef, useMemo, useEffect, useState, useCallback, createElement, useReducer, Fragment as Fragment$1, memo, forwardRef, createContext, useContext, isValidElement, cloneElement, Children } from 'react';
|
|
3
3
|
import { objectKeys, uuidv4, objectEntries, objectValues, nonNullable } from '@trackunit/shared-utils';
|
|
4
4
|
import { intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, rentalStatusPalette, themeScreenSizeAsNumber, color } from '@trackunit/ui-design-tokens';
|
|
5
5
|
import { iconNames } from '@trackunit/ui-icons';
|
|
@@ -2130,6 +2130,29 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
|
2130
2130
|
return (jsx("span", { className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onAnimationEnd: () => setAnimating(false), onClick: handleOnClick, title: value, children: text }));
|
|
2131
2131
|
};
|
|
2132
2132
|
|
|
2133
|
+
const cvaDetailsList = cvaMerge(["flex", "w-full", "min-w-0", "items-center", "truncate", "text-xs", "text-gray-600", "font-medium"], {
|
|
2134
|
+
variants: {
|
|
2135
|
+
density: {
|
|
2136
|
+
default: "pt-0",
|
|
2137
|
+
compact: "pt-1",
|
|
2138
|
+
},
|
|
2139
|
+
},
|
|
2140
|
+
});
|
|
2141
|
+
const cvaDetailsListItem = cvaMerge(["last:truncate"]);
|
|
2142
|
+
|
|
2143
|
+
/**
|
|
2144
|
+
* Renders a one-line list of details separated by a Slash icon.
|
|
2145
|
+
*
|
|
2146
|
+
* @param {object} props - Component props.
|
|
2147
|
+
* @param {string[]} props.details - Values to render.
|
|
2148
|
+
* @param {string} [props.className] - Optional CSS class for customization.
|
|
2149
|
+
* @param {"compact" | "default"} [props.density="default"] - Visual density of the list.
|
|
2150
|
+
* @returns {ReactElement} The details list element.
|
|
2151
|
+
*/
|
|
2152
|
+
const DetailsList = ({ details, className, density = "default" }) => {
|
|
2153
|
+
return (jsx("div", { className: cvaDetailsList({ className, density }), children: details.map((value, index, array) => (jsxs(Fragment$1, { children: [jsx("span", { className: cvaDetailsListItem({ className }), children: value }), index < array.length - 1 && (jsx("div", { className: "mx-0.5 flex items-center", children: jsx(Icon, { className: "w-4 text-neutral-300", color: "neutral", name: "Slash", size: "small" }) }))] }, index))) }));
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2133
2156
|
const cvaSkeletonLine = cvaMerge([
|
|
2134
2157
|
"rounded-md",
|
|
2135
2158
|
"h-3",
|
|
@@ -3022,36 +3045,6 @@ const cvaCardBodyDensityContainer = cvaMerge(["grid", "grid-cols-[1fr_auto]"], {
|
|
|
3022
3045
|
},
|
|
3023
3046
|
});
|
|
3024
3047
|
|
|
3025
|
-
const cvaMenuList = cvaMerge([
|
|
3026
|
-
"shadow",
|
|
3027
|
-
"rounded-lg",
|
|
3028
|
-
"z-popover",
|
|
3029
|
-
"bg-white",
|
|
3030
|
-
"border",
|
|
3031
|
-
"border-slate-300",
|
|
3032
|
-
"grid",
|
|
3033
|
-
"min-w-[200px]",
|
|
3034
|
-
"max-w-[300px]",
|
|
3035
|
-
"p-1",
|
|
3036
|
-
], {
|
|
3037
|
-
variants: {
|
|
3038
|
-
stickyHeader: {
|
|
3039
|
-
true: "grid-rows-min-fr grid overflow-y-hidden",
|
|
3040
|
-
false: "",
|
|
3041
|
-
},
|
|
3042
|
-
},
|
|
3043
|
-
});
|
|
3044
|
-
const cvaMenuListDivider = cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
|
|
3045
|
-
const cvaMenuListMultiSelect = cvaMerge("hover:!bg-blue-200");
|
|
3046
|
-
const cvaMenuListItem = cvaMerge("max-w-full");
|
|
3047
|
-
|
|
3048
|
-
/**
|
|
3049
|
-
* The MenuDivider component is used to separate items in a menu list.
|
|
3050
|
-
*/
|
|
3051
|
-
const MenuDivider = () => {
|
|
3052
|
-
return jsx("div", { className: cvaMenuListDivider(), "data-testid": "menu-divider" });
|
|
3053
|
-
};
|
|
3054
|
-
|
|
3055
3048
|
/**
|
|
3056
3049
|
* Applies standardized interaction-related styles to an element.
|
|
3057
3050
|
*
|
|
@@ -3113,6 +3106,75 @@ const cvaInteractableItem = cvaMerge("", {
|
|
|
3113
3106
|
},
|
|
3114
3107
|
});
|
|
3115
3108
|
|
|
3109
|
+
const cvaListItem = cvaMerge(["py-3", "px-4", "min-h-14", "w-full", "flex", "justify-between", "items-center"]);
|
|
3110
|
+
const cvaMainInformationClass = cvaMerge(["grid", "items-center", "text-sm", "gap-2"], {
|
|
3111
|
+
variants: {
|
|
3112
|
+
hasThumbnail: {
|
|
3113
|
+
true: "grid-cols-min-fr",
|
|
3114
|
+
false: "grid-cols-1",
|
|
3115
|
+
},
|
|
3116
|
+
},
|
|
3117
|
+
});
|
|
3118
|
+
const cvaThumbnailContainer = cvaMerge([
|
|
3119
|
+
"flex",
|
|
3120
|
+
"h-8",
|
|
3121
|
+
"w-8",
|
|
3122
|
+
"items-center",
|
|
3123
|
+
"justify-center",
|
|
3124
|
+
"overflow-hidden",
|
|
3125
|
+
"rounded-md",
|
|
3126
|
+
]);
|
|
3127
|
+
|
|
3128
|
+
/**
|
|
3129
|
+
* The ListItem is designed to present a concise set of items for quick scanning and navigation. It supports multiple content types and actions, and its flexible layout allows for customization based on the type of data being shown - assets, events, users, etc.
|
|
3130
|
+
*
|
|
3131
|
+
* @param { ListItemProps} props - The props for the ListItem component
|
|
3132
|
+
* @returns {Element} ListItem component
|
|
3133
|
+
*/
|
|
3134
|
+
const ListItem = ({ className, dataTestId, onClick, details, title, description, meta, thumbnail, thumbnailColor = "info-600", thumbnailBackground = "info-100", }) => {
|
|
3135
|
+
const baseClass = cvaListItem({ className });
|
|
3136
|
+
const interactableItemClass = onClick ? twMerge(baseClass, cvaInteractableItem({ cursor: "pointer" })) : baseClass;
|
|
3137
|
+
return (jsxs("div", { className: interactableItemClass, "data-testid": dataTestId, onClick: onClick, children: [jsxs("div", { className: cvaMainInformationClass({ hasThumbnail: !!thumbnail }), children: [thumbnail ? (jsx("div", { className: cvaThumbnailContainer({
|
|
3138
|
+
className: `text-${thumbnailColor} bg-${thumbnailBackground}`,
|
|
3139
|
+
}), children: thumbnail })) : null, jsxs("div", { className: "grid-rows-min-fr grid items-center text-sm", children: [jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center text-sm", children: typeof title === "string" ? (jsx(Text, { className: "truncate", dataTestId: dataTestId ? `${dataTestId}-title` : undefined, weight: "bold", children: title })) : (cloneElement(title, {
|
|
3140
|
+
className: twMerge(title.props.className, "neutral-900 text-sm font-medium truncate"),
|
|
3141
|
+
dataTestId: !title.props.dataTestId && dataTestId ? `${dataTestId}-title` : undefined,
|
|
3142
|
+
})) }), description ? (jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center", children: typeof description === "string" ? (jsx(Text, { className: "truncate text-xs text-neutral-500", dataTestId: dataTestId ? `${dataTestId}-description` : undefined, weight: "bold", children: description })) : (cloneElement(description, {
|
|
3143
|
+
className: twMerge(description.props.className, "text-neutral-500 text-xs font-medium truncate"),
|
|
3144
|
+
dataTestId: !description.props.dataTestId && dataTestId ? `${dataTestId}-description` : undefined,
|
|
3145
|
+
})) })) : null, meta ? (jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center pt-0.5", children: jsx(Text, { className: "truncate text-xs text-neutral-400", dataTestId: dataTestId ? `${dataTestId}-meta` : undefined, weight: "bold", children: meta }) })) : null] })] }), jsxs("div", { className: "flex items-center gap-0.5 pl-2", children: [details, onClick ? jsx(Icon, { color: "neutral", name: "ChevronRight", size: "medium" }) : null] })] }));
|
|
3146
|
+
};
|
|
3147
|
+
|
|
3148
|
+
const cvaMenuList = cvaMerge([
|
|
3149
|
+
"shadow",
|
|
3150
|
+
"rounded-lg",
|
|
3151
|
+
"z-popover",
|
|
3152
|
+
"bg-white",
|
|
3153
|
+
"border",
|
|
3154
|
+
"border-slate-300",
|
|
3155
|
+
"grid",
|
|
3156
|
+
"min-w-[200px]",
|
|
3157
|
+
"max-w-[300px]",
|
|
3158
|
+
"p-1",
|
|
3159
|
+
], {
|
|
3160
|
+
variants: {
|
|
3161
|
+
stickyHeader: {
|
|
3162
|
+
true: "grid-rows-min-fr grid overflow-y-hidden",
|
|
3163
|
+
false: "",
|
|
3164
|
+
},
|
|
3165
|
+
},
|
|
3166
|
+
});
|
|
3167
|
+
const cvaMenuListDivider = cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
|
|
3168
|
+
const cvaMenuListMultiSelect = cvaMerge("hover:!bg-blue-200");
|
|
3169
|
+
const cvaMenuListItem = cvaMerge("max-w-full");
|
|
3170
|
+
|
|
3171
|
+
/**
|
|
3172
|
+
* The MenuDivider component is used to separate items in a menu list.
|
|
3173
|
+
*/
|
|
3174
|
+
const MenuDivider = () => {
|
|
3175
|
+
return jsx("div", { className: cvaMenuListDivider(), "data-testid": "menu-divider" });
|
|
3176
|
+
};
|
|
3177
|
+
|
|
3116
3178
|
/**
|
|
3117
3179
|
* Extends the cvaInteractableItem variant in order to set the padding, width, height, cursor, and other styles particular to the MenuItem component.
|
|
3118
3180
|
* The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
|
|
@@ -4295,4 +4357,4 @@ const cvaClickable = cvaMerge([
|
|
|
4295
4357
|
},
|
|
4296
4358
|
});
|
|
4297
4359
|
|
|
4298
|
-
export { ActionRenderer, Alert, Badge, Breadcrumb, BreadcrumbContainer, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, EmptyState, EmptyValue, ExternalLink, Heading, Highlight, Icon, IconButton, Indicator, KPI, KPICard, MenuDivider, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, PageHeaderKpiMetrics, PageHeaderSecondaryActions, PageHeaderTitle, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Portal, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, ToggleGroup, Tooltip, ValueBar, VirtualizedList, ZStack, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaContainerStyles, cvaIconButton, cvaImgStyles, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, cvaPageHeader, cvaPageHeaderContainer, cvaPageHeaderHeading, cvaToggleGroup, cvaToggleGroupWithSlidingBackground, cvaToggleItem, cvaToggleItemContent, cvaToggleItemText, cvaVirtualizedList, cvaVirtualizedListContainer, cvaVirtualizedListItem, cvaZStackContainer, cvaZStackItem, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, useClickOutside, useContainerBreakpoints, useContinuousTimeout, useDebounce, useDevicePixelRatio, useElevatedReducer, useElevatedState, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextTruncated, useModifierKey, useOverflowItems, usePopoverContext, usePrompt, useResize, useScrollDetection, useSelfUpdatingRef, useTimeout, useViewportBreakpoints, useWatch, useWindowActivity };
|
|
4360
|
+
export { ActionRenderer, Alert, Badge, Breadcrumb, BreadcrumbContainer, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, DetailsList, EmptyState, EmptyValue, ExternalLink, Heading, Highlight, Icon, IconButton, Indicator, KPI, KPICard, ListItem, MenuDivider, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, PageHeaderKpiMetrics, PageHeaderSecondaryActions, PageHeaderTitle, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Portal, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, ToggleGroup, Tooltip, ValueBar, VirtualizedList, ZStack, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaContainerStyles, cvaIconButton, cvaImgStyles, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, cvaPageHeader, cvaPageHeaderContainer, cvaPageHeaderHeading, cvaToggleGroup, cvaToggleGroupWithSlidingBackground, cvaToggleItem, cvaToggleItemContent, cvaToggleItemText, cvaVirtualizedList, cvaVirtualizedListContainer, cvaVirtualizedListItem, cvaZStackContainer, cvaZStackItem, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, useClickOutside, useContainerBreakpoints, useContinuousTimeout, useDebounce, useDevicePixelRatio, useElevatedReducer, useElevatedState, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextTruncated, useModifierKey, useOverflowItems, usePopoverContext, usePrompt, useResize, useScrollDetection, useSelfUpdatingRef, useTimeout, useViewportBreakpoints, useWatch, useWindowActivity };
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
interface DetailsListProps {
|
|
3
|
+
details: Array<string>;
|
|
4
|
+
className?: string;
|
|
5
|
+
density?: "compact" | "default";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Renders a one-line list of details separated by a Slash icon.
|
|
9
|
+
*
|
|
10
|
+
* @param {object} props - Component props.
|
|
11
|
+
* @param {string[]} props.details - Values to render.
|
|
12
|
+
* @param {string} [props.className] - Optional CSS class for customization.
|
|
13
|
+
* @param {"compact" | "default"} [props.density="default"] - Visual density of the list.
|
|
14
|
+
* @returns {ReactElement} The details list element.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DetailsList: ({ details, className, density }: DetailsListProps) => ReactElement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cvaDetailsList: (props?: ({
|
|
2
|
+
density?: "default" | "compact" | null | undefined;
|
|
3
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
|
+
export declare const cvaDetailsListItem: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { VariantProps } from "@trackunit/css-class-variance-utilities";
|
|
2
|
+
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
|
+
import { tailwindPalette, ThemeColors } from "@trackunit/ui-design-tokens";
|
|
4
|
+
import { MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
5
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
6
|
+
import { cvaListItem } from "./ListItem.variants";
|
|
7
|
+
type ThemeColorShades = `${keyof (typeof tailwindPalette)[keyof typeof tailwindPalette]}`;
|
|
8
|
+
export interface ListItemProps extends CommonProps, MappedOmit<VariantProps<typeof cvaListItem>, "className"> {
|
|
9
|
+
/**The main text line of the ListItem */
|
|
10
|
+
title: string | ReactElement<CommonProps>;
|
|
11
|
+
/**Optional description for the ListItem. Can be used for descriptions, metadata, or other important details. */
|
|
12
|
+
description?: string | ReactElement<CommonProps>;
|
|
13
|
+
/**Tertiary information. Can be used for timestamps or other less important details. */
|
|
14
|
+
meta?: string;
|
|
15
|
+
/**Optional thumbnail for the ListItem. Can be used to display an image or icon. */
|
|
16
|
+
thumbnail?: ReactElement;
|
|
17
|
+
/**Makes the items interactive. Can be used to navigate to a different page when an item is clicked. */
|
|
18
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
19
|
+
/**Details can be used to nest a component on the right side of the ListItem (can be used to display a tag, icon, highlight, text, etc.) */
|
|
20
|
+
details?: ReactNode;
|
|
21
|
+
/**If an icon is chosen as thumbnail, use this to set the color of the icon. */
|
|
22
|
+
thumbnailColor?: `${ThemeColors}-${ThemeColorShades}` | `${ThemeColors}`;
|
|
23
|
+
/**If an icon is chosen as thumbnail, use this to set the background color of the icon. */
|
|
24
|
+
thumbnailBackground?: `${ThemeColors}-${ThemeColorShades}` | `${ThemeColors}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The ListItem is designed to present a concise set of items for quick scanning and navigation. It supports multiple content types and actions, and its flexible layout allows for customization based on the type of data being shown - assets, events, users, etc.
|
|
28
|
+
*
|
|
29
|
+
* @param { ListItemProps} props - The props for the ListItem component
|
|
30
|
+
* @returns {Element} ListItem component
|
|
31
|
+
*/
|
|
32
|
+
export declare const ListItem: ({ className, dataTestId, onClick, details, title, description, meta, thumbnail, thumbnailColor, thumbnailBackground, }: ListItemProps) => ReactElement;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const cvaListItem: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaMainInformationClass: (props?: ({
|
|
3
|
+
hasThumbnail?: boolean | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const cvaThumbnailContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -6,6 +6,7 @@ export * from "./Card";
|
|
|
6
6
|
export * from "./Collapse";
|
|
7
7
|
export * from "./CompletionStatusIndicator/CompletionStatusIndicator";
|
|
8
8
|
export * from "./CopyableText";
|
|
9
|
+
export * from "./DetailsList/DetailsList";
|
|
9
10
|
export * from "./EmptyState/EmptyState";
|
|
10
11
|
export * from "./EmptyState/EmptyState.variants";
|
|
11
12
|
export * from "./EmptyValue/EmptyValue";
|
|
@@ -16,6 +17,7 @@ export * from "./Icon/Icon";
|
|
|
16
17
|
export * from "./Indicator";
|
|
17
18
|
export * from "./KPI/KPI";
|
|
18
19
|
export * from "./KPICard/KPICard";
|
|
20
|
+
export * from "./ListItem/ListItem";
|
|
19
21
|
export * from "./Menu";
|
|
20
22
|
export * from "./Notice";
|
|
21
23
|
export * from "./Page";
|