@trackunit/react-components 0.1.296 → 0.1.298

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 CHANGED
@@ -268,13 +268,16 @@ const cvaTag = cssClassVarianceUtilities.cvaMerge([
268
268
  unknown: "bg-unknown-100 text-unknown-700",
269
269
  moving: "bg-neutral-100 text-neutral-700",
270
270
  active: "bg-neutral-100 text-neutral-700",
271
- contractor: "bg-contractor-100 text-contractor-700",
272
- dealer: "bg-dealer-100 text-dealer-700",
273
- rental: "bg-rental-100 text-rental-700",
274
- oem: "bg-oem-100 text-oem-700",
275
- service: "bg-service-100 text-service-700",
276
- distributor: "bg-distributor-100 text-distributor-700",
277
- other_customer_type: "bg-other_customer_type-100 text-other_customer_type-700",
271
+ customer_type_contractor: "bg-customer_type_contractor-100 text-customer_type_contractor-700",
272
+ customer_type_dealer: "bg-customer_type_dealer-100 text-customer_type_dealer-700",
273
+ customer_type_rental: "bg-customer_type_rental-100 text-customer_type_rental-700",
274
+ customer_type_oem: "bg-customer_type_oem-100 text-customer_type_oem-700",
275
+ customer_type_service: "bg-customer_type_service-100 text-customer_type_service-700",
276
+ customer_type_distributor: "bg-customer_type_distributor-100 text-customer_type_distributor-700",
277
+ customer_type_other_customer_type: "bg-customer_type_other_customer_type-100 text-customer_type_other_customer_type-700",
278
+ customer_source_user_defined: "bg-customer_source_user_defined-100 text-customer_source_user_defined-700",
279
+ customer_source_classic_migration: "bg-customer_source_classic_migration-100 text-customer_source_classic_migration-700",
280
+ customer_source_system_defined: "bg-customer_source_system_defined-100 text-customer_source_system_defined-700",
278
281
  },
279
282
  },
280
283
  defaultVariants: {
@@ -4523,8 +4526,10 @@ const cvaVirtualizedListItem = cssClassVarianceUtilities.cvaMerge(["absolute", "
4523
4526
  * @property {RelayPagination | undefined} pagination - Pagination configuration for the list.
4524
4527
  * @property {separator} [separator="line"] - The separator style between items in the list.
4525
4528
  * @property {(index: number) => JSX.Element} children - A function that takes an index and returns the JSX element to be rendered at said index.
4529
+ * @property {loadingIndicator} [loadingIndicator="spinner"] - The type of loading indicator in the list.
4530
+ * @property {skeletonLinesHeight} [skeletonLinesHeight="2rem"] - The height of the skeleton lines.
4526
4531
  */
4527
- const VirtualizedList = ({ count, rowHeight = 40, pagination, children, className, dataTestId, separator = "none", }) => {
4532
+ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, className, dataTestId, separator = "none", loadingIndicator = "spinner", skeletonLinesHeight = "2rem", }) => {
4528
4533
  var _a;
4529
4534
  const containerRef = React.useRef(null);
4530
4535
  const { fetchMoreOnBottomReached, getVirtualItems, getTotalSize, measureElement } = reactTablePagination.useInfiniteScroll({
@@ -4539,7 +4544,7 @@ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, classNam
4539
4544
  const isLoaderRow = virtualRow.index > count - 1;
4540
4545
  return (jsxRuntime.jsx("li", { className: cvaVirtualizedListItem({ separator }), "data-index": virtualRow.index, ref: measureElement, style: {
4541
4546
  transform: `translateY(${virtualRow.start}px)`,
4542
- }, children: isLoaderRow ? ((pagination === null || pagination === void 0 ? void 0 : pagination.isLoading) ? (jsxRuntime.jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" })) : null) : (children(virtualRow.index)) }, virtualRow.key));
4547
+ }, children: isLoaderRow ? ((pagination === null || pagination === void 0 ? void 0 : pagination.isLoading) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [loadingIndicator === "spinner" && jsxRuntime.jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" }), loadingIndicator === "skeletonLines" && (jsxRuntime.jsx(SkeletonLines, { height: skeletonLinesHeight, lines: 3, width: "full" }))] })) : null) : (children(virtualRow.index)) }, virtualRow.key));
4543
4548
  }) }) }));
4544
4549
  };
4545
4550
 
package/index.esm.js CHANGED
@@ -237,13 +237,16 @@ const cvaTag = cvaMerge([
237
237
  unknown: "bg-unknown-100 text-unknown-700",
238
238
  moving: "bg-neutral-100 text-neutral-700",
239
239
  active: "bg-neutral-100 text-neutral-700",
240
- contractor: "bg-contractor-100 text-contractor-700",
241
- dealer: "bg-dealer-100 text-dealer-700",
242
- rental: "bg-rental-100 text-rental-700",
243
- oem: "bg-oem-100 text-oem-700",
244
- service: "bg-service-100 text-service-700",
245
- distributor: "bg-distributor-100 text-distributor-700",
246
- other_customer_type: "bg-other_customer_type-100 text-other_customer_type-700",
240
+ customer_type_contractor: "bg-customer_type_contractor-100 text-customer_type_contractor-700",
241
+ customer_type_dealer: "bg-customer_type_dealer-100 text-customer_type_dealer-700",
242
+ customer_type_rental: "bg-customer_type_rental-100 text-customer_type_rental-700",
243
+ customer_type_oem: "bg-customer_type_oem-100 text-customer_type_oem-700",
244
+ customer_type_service: "bg-customer_type_service-100 text-customer_type_service-700",
245
+ customer_type_distributor: "bg-customer_type_distributor-100 text-customer_type_distributor-700",
246
+ customer_type_other_customer_type: "bg-customer_type_other_customer_type-100 text-customer_type_other_customer_type-700",
247
+ customer_source_user_defined: "bg-customer_source_user_defined-100 text-customer_source_user_defined-700",
248
+ customer_source_classic_migration: "bg-customer_source_classic_migration-100 text-customer_source_classic_migration-700",
249
+ customer_source_system_defined: "bg-customer_source_system_defined-100 text-customer_source_system_defined-700",
247
250
  },
248
251
  },
249
252
  defaultVariants: {
@@ -4492,8 +4495,10 @@ const cvaVirtualizedListItem = cvaMerge(["absolute", "top-0", "left-0", "w-full"
4492
4495
  * @property {RelayPagination | undefined} pagination - Pagination configuration for the list.
4493
4496
  * @property {separator} [separator="line"] - The separator style between items in the list.
4494
4497
  * @property {(index: number) => JSX.Element} children - A function that takes an index and returns the JSX element to be rendered at said index.
4498
+ * @property {loadingIndicator} [loadingIndicator="spinner"] - The type of loading indicator in the list.
4499
+ * @property {skeletonLinesHeight} [skeletonLinesHeight="2rem"] - The height of the skeleton lines.
4495
4500
  */
4496
- const VirtualizedList = ({ count, rowHeight = 40, pagination, children, className, dataTestId, separator = "none", }) => {
4501
+ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, className, dataTestId, separator = "none", loadingIndicator = "spinner", skeletonLinesHeight = "2rem", }) => {
4497
4502
  var _a;
4498
4503
  const containerRef = useRef(null);
4499
4504
  const { fetchMoreOnBottomReached, getVirtualItems, getTotalSize, measureElement } = useInfiniteScroll({
@@ -4508,7 +4513,7 @@ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, classNam
4508
4513
  const isLoaderRow = virtualRow.index > count - 1;
4509
4514
  return (jsx("li", { className: cvaVirtualizedListItem({ separator }), "data-index": virtualRow.index, ref: measureElement, style: {
4510
4515
  transform: `translateY(${virtualRow.start}px)`,
4511
- }, children: isLoaderRow ? ((pagination === null || pagination === void 0 ? void 0 : pagination.isLoading) ? (jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" })) : null) : (children(virtualRow.index)) }, virtualRow.key));
4516
+ }, children: isLoaderRow ? ((pagination === null || pagination === void 0 ? void 0 : pagination.isLoading) ? (jsxs(Fragment, { children: [loadingIndicator === "spinner" && jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" }), loadingIndicator === "skeletonLines" && (jsx(SkeletonLines, { height: skeletonLinesHeight, lines: 3, width: "full" }))] })) : null) : (children(virtualRow.index)) }, virtualRow.key));
4512
4517
  }) }) }));
4513
4518
  };
4514
4519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.296",
3
+ "version": "0.1.298",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import React, { ReactElement } from "react";
1
+ import React, { ReactElement, ReactNode } from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import { TabListProps } from "../Tabs/TabList";
4
4
  import { TagColors } from "../Tag";
@@ -28,7 +28,7 @@ export interface PageHeaderProps extends CommonProps {
28
28
  * A RectNode passed into the tag will be rendered as such.
29
29
  * A string passed into the tag will render it using the tag component.
30
30
  */
31
- tag?: string;
31
+ tag?: string | ReactNode;
32
32
  /**
33
33
  * A theme color value can be used for tag component
34
34
  */
@@ -1,8 +1,8 @@
1
- import { ActivityColors, CriticalityColors, CustomerTypeColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
1
+ import { ActivityColors, CriticalityColors, CustomerDataSourceColors, CustomerTypeColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
2
2
  import * as React from "react";
3
3
  import { CommonProps, Size } from "../../common/CommonProps";
4
4
  export type TagSize = Extract<Size, "small" | "medium">;
5
- export type TagColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors | CustomerTypeColors;
5
+ export type TagColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors | CustomerTypeColors | CustomerDataSourceColors;
6
6
  export interface TagProps extends CommonProps {
7
7
  /**
8
8
  * The color of the tag.
@@ -1,7 +1,7 @@
1
1
  export declare const cvaTag: (props?: ({
2
2
  size?: "small" | "medium" | null | undefined;
3
3
  layout?: "default" | "withIcon" | null | undefined;
4
- color?: "primary" | "secondary" | "accent" | "neutral" | "black" | "white" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "stopped" | "idle" | "unknown" | "moving" | "active" | "contractor" | "dealer" | "rental" | "oem" | "service" | "distributor" | "other_customer_type" | null | undefined;
4
+ color?: "primary" | "secondary" | "accent" | "neutral" | "black" | "white" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "stopped" | "idle" | "unknown" | "moving" | "active" | "customer_type_contractor" | "customer_type_dealer" | "customer_type_rental" | "customer_type_oem" | "customer_type_service" | "customer_type_distributor" | "customer_type_other_customer_type" | "customer_source_user_defined" | "customer_source_classic_migration" | "customer_source_system_defined" | null | undefined;
5
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
6
  export declare const cvaTagIconContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
7
  export declare const cvaTagIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -4,12 +4,15 @@ import { RelayPagination } from "@trackunit/react-table-pagination";
4
4
  import { CommonProps } from "../../common/CommonProps";
5
5
  import { cvaVirtualizedListItem } from "./VirtualizedList.variants";
6
6
  type Separator = NonNullable<VariantProps<typeof cvaVirtualizedListItem>["separator"]>;
7
+ type LoadingIndicator = "spinner" | "skeletonLines";
7
8
  export interface VirtualizedListProps extends CommonProps {
8
9
  count: number;
9
10
  rowHeight?: number;
10
11
  pagination?: RelayPagination;
11
12
  children: (index: number) => JSX.Element;
12
13
  separator?: Separator;
14
+ loadingIndicator?: LoadingIndicator;
15
+ skeletonLinesHeight?: string;
13
16
  }
14
17
  /**
15
18
  * Render a performant virtualized list of items. Optionally with infinite scrolling.
@@ -19,6 +22,8 @@ export interface VirtualizedListProps extends CommonProps {
19
22
  * @property {RelayPagination | undefined} pagination - Pagination configuration for the list.
20
23
  * @property {separator} [separator="line"] - The separator style between items in the list.
21
24
  * @property {(index: number) => JSX.Element} children - A function that takes an index and returns the JSX element to be rendered at said index.
25
+ * @property {loadingIndicator} [loadingIndicator="spinner"] - The type of loading indicator in the list.
26
+ * @property {skeletonLinesHeight} [skeletonLinesHeight="2rem"] - The height of the skeleton lines.
22
27
  */
23
- export declare const VirtualizedList: ({ count, rowHeight, pagination, children, className, dataTestId, separator, }: VirtualizedListProps) => JSX.Element;
28
+ export declare const VirtualizedList: ({ count, rowHeight, pagination, children, className, dataTestId, separator, loadingIndicator, skeletonLinesHeight, }: VirtualizedListProps) => JSX.Element;
24
29
  export {};