@trackunit/react-components 0.1.169 → 0.1.172

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
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
8
7
  var uiDesignTokens = require('@trackunit/ui-design-tokens');
9
8
  var uiIcons = require('@trackunit/ui-icons');
10
9
  var IconSpriteOutline = require('@trackunit/ui-icons/icons-sprite-outline.svg');
11
10
  var IconSpriteSolid = require('@trackunit/ui-icons/icons-sprite-solid.svg');
11
+ var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
12
12
  var ReactDOM = require('react-dom');
13
13
  var reactRouterDom = require('react-router-dom');
14
14
 
@@ -65,6 +65,114 @@ const useContainerProps = ({ className, dataTestId }) => {
65
65
  return containerProps;
66
66
  };
67
67
 
68
+ const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
69
+ variants: {
70
+ color: {
71
+ primary: "text-primary-600",
72
+ secondary: "text-secondary-600",
73
+ accent: "text-accent-600",
74
+ neutral: "text-neutral-600",
75
+ info: "text-info-600",
76
+ success: "text-success-600",
77
+ warning: "text-warning-600",
78
+ danger: "text-danger-600",
79
+ good: "text-good-600",
80
+ low: "text-low-600",
81
+ critical: "text-critical-600",
82
+ working: "text-working-600",
83
+ idle: "text-idle-600",
84
+ moving: "text-moving",
85
+ active: "text-active",
86
+ stopped: "text-stopped-600",
87
+ unknown: "text-unknown-600",
88
+ default: "text-current",
89
+ black: "text-black",
90
+ white: "text-white",
91
+ unused: {
92
+ 300: "text-red-300",
93
+ 400: "text-red-400",
94
+ },
95
+ utilized: { 400: "text-blue-400", 600: "text-blue-600" },
96
+ heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
97
+ unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
98
+ site: {
99
+ area: "text-blue-600",
100
+ classic_poi: "text-neutral-500",
101
+ classic_zone: "text-neutral-500",
102
+ depot: "text-emerald-500",
103
+ work_place: "text-violet-600",
104
+ construction_site: "text-amber-500",
105
+ unknown: "text-neutral-500",
106
+ },
107
+ on_rent: { 100: uiDesignTokens.rentalStatusPalette.ON_RENT[100], 600: uiDesignTokens.rentalStatusPalette.ON_RENT[600] },
108
+ returned: { 100: uiDesignTokens.rentalStatusPalette.RETURNED[100], 600: uiDesignTokens.rentalStatusPalette.RETURNED[600] },
109
+ available: { 100: uiDesignTokens.rentalStatusPalette.AVAILABLE[100], 600: uiDesignTokens.rentalStatusPalette.AVAILABLE[600] },
110
+ pickup_ready: { 100: uiDesignTokens.rentalStatusPalette.PICKUP_READY[100], 600: uiDesignTokens.rentalStatusPalette.PICKUP_READY[600] },
111
+ transfer: { 100: uiDesignTokens.rentalStatusPalette.TRANSFER[100], 600: uiDesignTokens.rentalStatusPalette.TRANSFER[600] },
112
+ in_repair: { 100: uiDesignTokens.rentalStatusPalette.IN_REPAIR[100], 600: uiDesignTokens.rentalStatusPalette.IN_REPAIR[600] },
113
+ other_rental_status: {
114
+ 100: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
115
+ 600: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
116
+ },
117
+ },
118
+ size: {
119
+ small: "w-4",
120
+ medium: "w-5",
121
+ large: "w-6",
122
+ font: "w-[1em]",
123
+ },
124
+ },
125
+ defaultVariants: {
126
+ color: "default",
127
+ size: "large",
128
+ },
129
+ });
130
+ cssClassVarianceUtilities.cvaMerge([], {
131
+ variants: {
132
+ iconType: {
133
+ solid: "fill-current stroke-transparent",
134
+ outline: "fill-transparent stroke-current",
135
+ },
136
+ },
137
+ });
138
+ cssClassVarianceUtilities.cvaMerge([
139
+ "relative",
140
+ "aspect-square",
141
+ "after:content-['']",
142
+ "after:absolute",
143
+ "after:h-2",
144
+ "after:w-2",
145
+ "after:bg-current",
146
+ "after:rounded-full",
147
+ "after:inset-1/2",
148
+ "after:-translate-x-1/2",
149
+ "after:-translate-y-1/2",
150
+ "after:opacity-50",
151
+ ]);
152
+
153
+ const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, uiDesignTokens.intentPalette), uiDesignTokens.generalPalette), uiDesignTokens.criticalityPalette), uiDesignTokens.activityPalette), uiDesignTokens.utilizationPalette), uiDesignTokens.sitesPalette), uiDesignTokens.rentalStatusPalette);
154
+ const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
155
+ /**
156
+ * - The Icon component is used to display an Icon.
157
+ * - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
158
+ * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
159
+ *
160
+ * @param {IconProps} props - The props for the Icon component
161
+ * @returns {JSX.Element} Icon component
162
+ */
163
+ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
164
+ const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
165
+ const iconName = uiIcons.iconNames[name];
166
+ if (!iconName) {
167
+ return null;
168
+ }
169
+ const href = {
170
+ solid: `${IconSpriteSolid__default["default"]}#${iconName}`,
171
+ outline: `${IconSpriteOutline__default["default"]}#${iconName}`,
172
+ };
173
+ return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsxRuntime.jsx("use", { href: href[correctIconType] }) }) }));
174
+ };
175
+
68
176
  /******************************************************************************
69
177
  Copyright (c) Microsoft Corporation.
70
178
 
@@ -102,6 +210,85 @@ function __awaiter(thisArg, _arguments, P, generator) {
102
210
  });
103
211
  }
104
212
 
213
+ const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
214
+ variants: {
215
+ align: {
216
+ left: "text-left",
217
+ right: "text-right",
218
+ center: "text-center",
219
+ },
220
+ italic: {
221
+ true: "italic",
222
+ false: "",
223
+ },
224
+ uppercase: {
225
+ true: "uppercase",
226
+ false: "",
227
+ },
228
+ underline: {
229
+ true: [
230
+ "underline",
231
+ "after:bg-inherit",
232
+ "after:content-none",
233
+ "after:absolute",
234
+ "after:w-full",
235
+ "after:h-0.5",
236
+ "after:bottom-0",
237
+ "after:left-0",
238
+ ],
239
+ false: "",
240
+ },
241
+ weight: {
242
+ normal: "font-normal",
243
+ bold: "font-medium",
244
+ thick: "font-semibold",
245
+ },
246
+ size: {
247
+ small: "text-xs",
248
+ medium: "text-sm",
249
+ large: "text-base",
250
+ },
251
+ inverted: {
252
+ true: "text-white",
253
+ false: "",
254
+ },
255
+ subtle: {
256
+ true: "opacity-70",
257
+ false: "",
258
+ },
259
+ disabled: {
260
+ true: "opacity-50",
261
+ false: "",
262
+ },
263
+ },
264
+ });
265
+
266
+ /**
267
+ * The Text component is used to apply Trackunit default typography styles to text.
268
+ *
269
+ * ### When to use
270
+ *
271
+ * Use Text when you want to show a text section, use Heading if you want to show a heading.
272
+ *
273
+ * @param {TextProps} props - The props for the Text component
274
+ * @returns {JSX.Element} Text component
275
+ */
276
+ const Text = (_a) => {
277
+ var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "disabled", "className", "dataTestId"]);
278
+ return React__namespace.createElement(type, Object.assign({ className: cvaText({
279
+ inverted,
280
+ uppercase,
281
+ align,
282
+ italic: italicize,
283
+ size,
284
+ underline,
285
+ weight,
286
+ subtle,
287
+ disabled,
288
+ className,
289
+ }), "data-testid": dataTestId, children }, rest));
290
+ };
291
+
105
292
  const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
106
293
  "bg-transparent",
107
294
  "rounded-full",
@@ -368,114 +555,6 @@ const IconButton = React__namespace.forwardRef((_a, ref) => {
368
555
  return (jsxRuntime.jsx(Button$1, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsxRuntime.jsx("div", { className: cvaIconButtonContainer({ size }), children: loading ? jsxRuntime.jsx(Spinner, { size: size }) : icon }) })));
369
556
  });
370
557
 
371
- const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
372
- variants: {
373
- color: {
374
- primary: "text-primary-600",
375
- secondary: "text-secondary-600",
376
- accent: "text-accent-600",
377
- neutral: "text-neutral-600",
378
- info: "text-info-600",
379
- success: "text-success-600",
380
- warning: "text-warning-600",
381
- danger: "text-danger-600",
382
- good: "text-good-600",
383
- low: "text-low-600",
384
- critical: "text-critical-600",
385
- working: "text-working-600",
386
- idle: "text-idle-600",
387
- moving: "text-moving",
388
- active: "text-active",
389
- stopped: "text-stopped-600",
390
- unknown: "text-unknown-600",
391
- default: "text-current",
392
- black: "text-black",
393
- white: "text-white",
394
- unused: {
395
- 300: "text-red-300",
396
- 400: "text-red-400",
397
- },
398
- utilized: { 400: "text-blue-400", 600: "text-blue-600" },
399
- heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
400
- unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
401
- site: {
402
- area: "text-blue-600",
403
- classic_poi: "text-neutral-500",
404
- classic_zone: "text-neutral-500",
405
- depot: "text-emerald-500",
406
- work_place: "text-violet-600",
407
- construction_site: "text-amber-500",
408
- unknown: "text-neutral-500",
409
- },
410
- on_rent: { 100: uiDesignTokens.rentalStatusPalette.ON_RENT[100], 600: uiDesignTokens.rentalStatusPalette.ON_RENT[600] },
411
- returned: { 100: uiDesignTokens.rentalStatusPalette.RETURNED[100], 600: uiDesignTokens.rentalStatusPalette.RETURNED[600] },
412
- available: { 100: uiDesignTokens.rentalStatusPalette.AVAILABLE[100], 600: uiDesignTokens.rentalStatusPalette.AVAILABLE[600] },
413
- pickup_ready: { 100: uiDesignTokens.rentalStatusPalette.PICKUP_READY[100], 600: uiDesignTokens.rentalStatusPalette.PICKUP_READY[600] },
414
- transfer: { 100: uiDesignTokens.rentalStatusPalette.TRANSFER[100], 600: uiDesignTokens.rentalStatusPalette.TRANSFER[600] },
415
- in_repair: { 100: uiDesignTokens.rentalStatusPalette.IN_REPAIR[100], 600: uiDesignTokens.rentalStatusPalette.IN_REPAIR[600] },
416
- other_rental_status: {
417
- 100: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
418
- 600: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
419
- },
420
- },
421
- size: {
422
- small: "w-4",
423
- medium: "w-5",
424
- large: "w-6",
425
- font: "w-[1em]",
426
- },
427
- },
428
- defaultVariants: {
429
- color: "default",
430
- size: "large",
431
- },
432
- });
433
- cssClassVarianceUtilities.cvaMerge([], {
434
- variants: {
435
- iconType: {
436
- solid: "fill-current stroke-transparent",
437
- outline: "fill-transparent stroke-current",
438
- },
439
- },
440
- });
441
- cssClassVarianceUtilities.cvaMerge([
442
- "relative",
443
- "aspect-square",
444
- "after:content-['']",
445
- "after:absolute",
446
- "after:h-2",
447
- "after:w-2",
448
- "after:bg-current",
449
- "after:rounded-full",
450
- "after:inset-1/2",
451
- "after:-translate-x-1/2",
452
- "after:-translate-y-1/2",
453
- "after:opacity-50",
454
- ]);
455
-
456
- const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, uiDesignTokens.intentPalette), uiDesignTokens.generalPalette), uiDesignTokens.criticalityPalette), uiDesignTokens.activityPalette), uiDesignTokens.utilizationPalette), uiDesignTokens.sitesPalette), uiDesignTokens.rentalStatusPalette);
457
- const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
458
- /**
459
- * - The Icon component is used to display an Icon.
460
- * - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
461
- * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
462
- *
463
- * @param {IconProps} props - The props for the Icon component
464
- * @returns {JSX.Element} Icon component
465
- */
466
- const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
467
- const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
468
- const iconName = uiIcons.iconNames[name];
469
- if (!iconName) {
470
- return null;
471
- }
472
- const href = {
473
- solid: `${IconSpriteSolid__default["default"]}#${iconName}`,
474
- outline: `${IconSpriteOutline__default["default"]}#${iconName}`,
475
- };
476
- return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsxRuntime.jsx("use", { href: href[correctIconType] }) }) }));
477
- };
478
-
479
558
  /**
480
559
  * The StarButton component is used for favorite actions or similar.
481
560
  *
@@ -486,69 +565,6 @@ const StarButton = ({ starred, onClick }) => {
486
565
  return (jsxRuntime.jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsxRuntime.jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
487
566
  };
488
567
 
489
- const cvaText = cssClassVarianceUtilities.cvaMerge(["m-0", "relative", "text-sm", "font-normal"], {
490
- variants: {
491
- align: {
492
- left: "text-left",
493
- right: "text-right",
494
- center: "text-center",
495
- },
496
- italic: {
497
- true: "italic",
498
- false: "",
499
- },
500
- uppercase: {
501
- true: "uppercase",
502
- false: "",
503
- },
504
- underline: {
505
- true: [
506
- "underline",
507
- "after:bg-inherit",
508
- "after:content-none",
509
- "after:absolute",
510
- "after:w-full",
511
- "after:h-0.5",
512
- "after:bottom-0",
513
- "after:left-0",
514
- ],
515
- false: "",
516
- },
517
- weight: {
518
- normal: "font-normal",
519
- bold: "font-medium",
520
- thick: "font-semibold",
521
- },
522
- size: {
523
- small: "text-xs",
524
- medium: "text-sm",
525
- large: "text-base",
526
- },
527
- color: {
528
- default: "text-black",
529
- subtleInverted: "text-neutral-300",
530
- subtle: "text-neutral-600",
531
- inverted: "text-white",
532
- },
533
- },
534
- });
535
-
536
- /**
537
- * The Text component is used to apply Trackunit default typography styles to text.
538
- *
539
- * ### When to use
540
- *
541
- * Use Text when you want to show a text section, use Heading if you want to show a heading.
542
- *
543
- * @param {TextProps} props - The props for the Text component
544
- * @returns {JSX.Element} Text component
545
- */
546
- const Text = (_a) => {
547
- var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "className", "dataTestId"]);
548
- const color = inverted && subtle ? "subtleInverted" : inverted ? "inverted" : subtle ? "subtle" : "default";
549
- return React__namespace.createElement(type, Object.assign({ className: cvaText({ color, uppercase, align, italic: italicize, size, underline, weight, className }), "data-testid": dataTestId, children }, rest));
550
- };
551
-
552
568
  const cvaAlert = cssClassVarianceUtilities.cvaMerge(["flex", "relative", "p-4", "rounded"], {
553
569
  variants: {
554
570
  color: {
@@ -727,16 +743,23 @@ const cvaCard = cssClassVarianceUtilities.cvaMerge([
727
743
  fullHeight: false,
728
744
  },
729
745
  });
730
- const cvaCardBody = cssClassVarianceUtilities.cvaMerge(["flex-grow", "overflow-auto"]);
731
- const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["border-t-2", "border-neutral-200", "justify-end"], {
746
+ const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["border-t-2", "border-neutral-200", "justify-end", "flex-row"], {
732
747
  variants: {
733
748
  border: {
734
749
  default: "",
735
750
  borderless: "border-t-0",
736
751
  },
752
+ density: {
753
+ none: "",
754
+ compact: "gap-3 p-3",
755
+ comfortable: "gap-4 p-4",
756
+ spacious: "gap-4 p-6",
757
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
758
+ },
737
759
  },
738
760
  defaultVariants: {
739
761
  border: "default",
762
+ density: "auto",
740
763
  },
741
764
  });
742
765
  const cvaCardHeader = cssClassVarianceUtilities.cvaMerge(["flex", "justify-between"]);
@@ -747,12 +770,20 @@ const cvaCardHeaderDensityContainer = cssClassVarianceUtilities.cvaMerge(["borde
747
770
  default: "",
748
771
  borderless: "border-b-0",
749
772
  },
773
+ density: {
774
+ none: "",
775
+ compact: "gap-3 p-3",
776
+ comfortable: "gap-4 p-4",
777
+ spacious: "gap-4 p-6",
778
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
779
+ },
750
780
  },
751
781
  defaultVariants: {
752
782
  border: "default",
783
+ density: "auto",
753
784
  },
754
785
  });
755
- const cvaCardDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex"], {
786
+ const cvaCardBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-grow", "overflow-auto"], {
756
787
  variants: {
757
788
  disableGap: {
758
789
  true: "gap-0",
@@ -792,18 +823,6 @@ const Card = (_a) => {
792
823
  return (jsxRuntime.jsx("div", Object.assign({ onClick: onClick, className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD }, rest, { children: children })));
793
824
  };
794
825
 
795
- /**
796
- * The DensityContainer component applies gap and padding.
797
- * The padding should live here, and not on the Card itself, as to not inset the scrollbar in case of overflow.
798
- *
799
- * @summary For applying auto padding and gap to a Card or Modal or whatever.
800
- * @param {ContainerProps} props - The props for the DensityContainer component
801
- * @returns {JSX.Element} DensityContainer component
802
- */
803
- const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
804
- return (jsxRuntime.jsx("div", { className: cvaCardDensityContainer({ className, disableGap, density, direction }), "data-testid": dataTestId, children: children }));
805
- };
806
-
807
826
  /**
808
827
  * The CardBody component should be used to inform the user of important information.
809
828
  *
@@ -813,7 +832,7 @@ const DensityContainer = ({ children, className, dataTestId, density, disableGap
813
832
  * @returns {JSX.Element} CardBody component
814
833
  */
815
834
  const CardBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
816
- return (jsxRuntime.jsx(DensityContainer, { density: density, dataTestId: dataTestId, className: cvaCardBody({ className }), disableGap: disableGap, children: children }));
835
+ return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaCardBodyDensityContainer({ density, disableGap, className }), children: children }));
817
836
  };
818
837
 
819
838
  /**
@@ -825,7 +844,11 @@ const CardBody = ({ density = "auto", children, dataTestId, className, disableGa
825
844
  * @returns {JSX.Element} CardFooter component
826
845
  */
827
846
  const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
828
- return (jsxRuntime.jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardFooterDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, direction: "row", children: children }));
847
+ return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaCardFooterDensityContainer({
848
+ density,
849
+ border: hideSeparator ? "borderless" : "default",
850
+ className,
851
+ }), children: children }));
829
852
  };
830
853
 
831
854
  const cvaHeading = cssClassVarianceUtilities.cvaMerge(["m-0", "leading-normal", "text-black"], {
@@ -883,7 +906,11 @@ const Heading = (_a) => {
883
906
  * @returns {JSX.Element} CardHeader component
884
907
  */
885
908
  const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
886
- return (jsxRuntime.jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { className: extraClassName, children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" }))] }) }));
909
+ return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaCardHeaderDensityContainer({
910
+ density,
911
+ border: hideSeparator ? "borderless" : "default",
912
+ className,
913
+ }), children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { className: extraClassName, children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" }))] }) }));
887
914
  };
888
915
 
889
916
  function useMountedState() {
@@ -19776,7 +19803,7 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
19776
19803
  * @returns {JSX.Element} PageHeader component
19777
19804
  */
19778
19805
  const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, }) => {
19779
- return (jsxRuntime.jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })), jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsxRuntime.jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && jsxRuntime.jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag }), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
19806
+ return (jsxRuntime.jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })), jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsxRuntime.jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && (jsxRuntime.jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag })), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
19780
19807
  };
19781
19808
 
19782
19809
  const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
@@ -39211,7 +39238,6 @@ exports.CopyableText = CopyableText;
39211
39238
  exports.DayPicker = DayPicker;
39212
39239
  exports.DayPickerPopover = DayPickerPopover;
39213
39240
  exports.DayRangePicker = DayRangePicker;
39214
- exports.DensityContainer = DensityContainer;
39215
39241
  exports.Drawer = Drawer;
39216
39242
  exports.EmptyState = EmptyState;
39217
39243
  exports.ExternalLink = ExternalLink;
package/index.esm.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { useRef, useCallback, useEffect, useState, useLayoutEffect, useMemo, createContext, forwardRef, useContext, isValidElement, cloneElement, memo, Children, Component, useReducer } from 'react';
4
- import { cvaMerge } from '@trackunit/css-class-variance-utilities';
5
4
  import { rentalStatusPalette, intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, color } from '@trackunit/ui-design-tokens';
6
5
  import { iconNames } from '@trackunit/ui-icons';
7
6
  import IconSpriteOutline from '@trackunit/ui-icons/icons-sprite-outline.svg';
8
7
  import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
8
+ import { cvaMerge } from '@trackunit/css-class-variance-utilities';
9
9
  import * as ReactDOM from 'react-dom';
10
10
  import ReactDOM__default, { createPortal } from 'react-dom';
11
11
  import { UNSAFE_NavigationContext } from 'react-router-dom';
@@ -36,6 +36,114 @@ const useContainerProps = ({ className, dataTestId }) => {
36
36
  return containerProps;
37
37
  };
38
38
 
39
+ const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
40
+ variants: {
41
+ color: {
42
+ primary: "text-primary-600",
43
+ secondary: "text-secondary-600",
44
+ accent: "text-accent-600",
45
+ neutral: "text-neutral-600",
46
+ info: "text-info-600",
47
+ success: "text-success-600",
48
+ warning: "text-warning-600",
49
+ danger: "text-danger-600",
50
+ good: "text-good-600",
51
+ low: "text-low-600",
52
+ critical: "text-critical-600",
53
+ working: "text-working-600",
54
+ idle: "text-idle-600",
55
+ moving: "text-moving",
56
+ active: "text-active",
57
+ stopped: "text-stopped-600",
58
+ unknown: "text-unknown-600",
59
+ default: "text-current",
60
+ black: "text-black",
61
+ white: "text-white",
62
+ unused: {
63
+ 300: "text-red-300",
64
+ 400: "text-red-400",
65
+ },
66
+ utilized: { 400: "text-blue-400", 600: "text-blue-600" },
67
+ heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
68
+ unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
69
+ site: {
70
+ area: "text-blue-600",
71
+ classic_poi: "text-neutral-500",
72
+ classic_zone: "text-neutral-500",
73
+ depot: "text-emerald-500",
74
+ work_place: "text-violet-600",
75
+ construction_site: "text-amber-500",
76
+ unknown: "text-neutral-500",
77
+ },
78
+ on_rent: { 100: rentalStatusPalette.ON_RENT[100], 600: rentalStatusPalette.ON_RENT[600] },
79
+ returned: { 100: rentalStatusPalette.RETURNED[100], 600: rentalStatusPalette.RETURNED[600] },
80
+ available: { 100: rentalStatusPalette.AVAILABLE[100], 600: rentalStatusPalette.AVAILABLE[600] },
81
+ pickup_ready: { 100: rentalStatusPalette.PICKUP_READY[100], 600: rentalStatusPalette.PICKUP_READY[600] },
82
+ transfer: { 100: rentalStatusPalette.TRANSFER[100], 600: rentalStatusPalette.TRANSFER[600] },
83
+ in_repair: { 100: rentalStatusPalette.IN_REPAIR[100], 600: rentalStatusPalette.IN_REPAIR[600] },
84
+ other_rental_status: {
85
+ 100: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
86
+ 600: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
87
+ },
88
+ },
89
+ size: {
90
+ small: "w-4",
91
+ medium: "w-5",
92
+ large: "w-6",
93
+ font: "w-[1em]",
94
+ },
95
+ },
96
+ defaultVariants: {
97
+ color: "default",
98
+ size: "large",
99
+ },
100
+ });
101
+ cvaMerge([], {
102
+ variants: {
103
+ iconType: {
104
+ solid: "fill-current stroke-transparent",
105
+ outline: "fill-transparent stroke-current",
106
+ },
107
+ },
108
+ });
109
+ cvaMerge([
110
+ "relative",
111
+ "aspect-square",
112
+ "after:content-['']",
113
+ "after:absolute",
114
+ "after:h-2",
115
+ "after:w-2",
116
+ "after:bg-current",
117
+ "after:rounded-full",
118
+ "after:inset-1/2",
119
+ "after:-translate-x-1/2",
120
+ "after:-translate-y-1/2",
121
+ "after:opacity-50",
122
+ ]);
123
+
124
+ const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
125
+ const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
126
+ /**
127
+ * - The Icon component is used to display an Icon.
128
+ * - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
129
+ * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
130
+ *
131
+ * @param {IconProps} props - The props for the Icon component
132
+ * @returns {JSX.Element} Icon component
133
+ */
134
+ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
135
+ const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
136
+ const iconName = iconNames[name];
137
+ if (!iconName) {
138
+ return null;
139
+ }
140
+ const href = {
141
+ solid: `${IconSpriteSolid}#${iconName}`,
142
+ outline: `${IconSpriteOutline}#${iconName}`,
143
+ };
144
+ return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsx("use", { href: href[correctIconType] }) }) }));
145
+ };
146
+
39
147
  /******************************************************************************
40
148
  Copyright (c) Microsoft Corporation.
41
149
 
@@ -73,6 +181,85 @@ function __awaiter(thisArg, _arguments, P, generator) {
73
181
  });
74
182
  }
75
183
 
184
+ const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
185
+ variants: {
186
+ align: {
187
+ left: "text-left",
188
+ right: "text-right",
189
+ center: "text-center",
190
+ },
191
+ italic: {
192
+ true: "italic",
193
+ false: "",
194
+ },
195
+ uppercase: {
196
+ true: "uppercase",
197
+ false: "",
198
+ },
199
+ underline: {
200
+ true: [
201
+ "underline",
202
+ "after:bg-inherit",
203
+ "after:content-none",
204
+ "after:absolute",
205
+ "after:w-full",
206
+ "after:h-0.5",
207
+ "after:bottom-0",
208
+ "after:left-0",
209
+ ],
210
+ false: "",
211
+ },
212
+ weight: {
213
+ normal: "font-normal",
214
+ bold: "font-medium",
215
+ thick: "font-semibold",
216
+ },
217
+ size: {
218
+ small: "text-xs",
219
+ medium: "text-sm",
220
+ large: "text-base",
221
+ },
222
+ inverted: {
223
+ true: "text-white",
224
+ false: "",
225
+ },
226
+ subtle: {
227
+ true: "opacity-70",
228
+ false: "",
229
+ },
230
+ disabled: {
231
+ true: "opacity-50",
232
+ false: "",
233
+ },
234
+ },
235
+ });
236
+
237
+ /**
238
+ * The Text component is used to apply Trackunit default typography styles to text.
239
+ *
240
+ * ### When to use
241
+ *
242
+ * Use Text when you want to show a text section, use Heading if you want to show a heading.
243
+ *
244
+ * @param {TextProps} props - The props for the Text component
245
+ * @returns {JSX.Element} Text component
246
+ */
247
+ const Text = (_a) => {
248
+ var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "disabled", "className", "dataTestId"]);
249
+ return React.createElement(type, Object.assign({ className: cvaText({
250
+ inverted,
251
+ uppercase,
252
+ align,
253
+ italic: italicize,
254
+ size,
255
+ underline,
256
+ weight,
257
+ subtle,
258
+ disabled,
259
+ className,
260
+ }), "data-testid": dataTestId, children }, rest));
261
+ };
262
+
76
263
  const cvaSpinner = cvaMerge([
77
264
  "bg-transparent",
78
265
  "rounded-full",
@@ -339,114 +526,6 @@ const IconButton = React.forwardRef((_a, ref) => {
339
526
  return (jsx(Button$1, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsx("div", { className: cvaIconButtonContainer({ size }), children: loading ? jsx(Spinner, { size: size }) : icon }) })));
340
527
  });
341
528
 
342
- const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
343
- variants: {
344
- color: {
345
- primary: "text-primary-600",
346
- secondary: "text-secondary-600",
347
- accent: "text-accent-600",
348
- neutral: "text-neutral-600",
349
- info: "text-info-600",
350
- success: "text-success-600",
351
- warning: "text-warning-600",
352
- danger: "text-danger-600",
353
- good: "text-good-600",
354
- low: "text-low-600",
355
- critical: "text-critical-600",
356
- working: "text-working-600",
357
- idle: "text-idle-600",
358
- moving: "text-moving",
359
- active: "text-active",
360
- stopped: "text-stopped-600",
361
- unknown: "text-unknown-600",
362
- default: "text-current",
363
- black: "text-black",
364
- white: "text-white",
365
- unused: {
366
- 300: "text-red-300",
367
- 400: "text-red-400",
368
- },
369
- utilized: { 400: "text-blue-400", 600: "text-blue-600" },
370
- heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
371
- unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
372
- site: {
373
- area: "text-blue-600",
374
- classic_poi: "text-neutral-500",
375
- classic_zone: "text-neutral-500",
376
- depot: "text-emerald-500",
377
- work_place: "text-violet-600",
378
- construction_site: "text-amber-500",
379
- unknown: "text-neutral-500",
380
- },
381
- on_rent: { 100: rentalStatusPalette.ON_RENT[100], 600: rentalStatusPalette.ON_RENT[600] },
382
- returned: { 100: rentalStatusPalette.RETURNED[100], 600: rentalStatusPalette.RETURNED[600] },
383
- available: { 100: rentalStatusPalette.AVAILABLE[100], 600: rentalStatusPalette.AVAILABLE[600] },
384
- pickup_ready: { 100: rentalStatusPalette.PICKUP_READY[100], 600: rentalStatusPalette.PICKUP_READY[600] },
385
- transfer: { 100: rentalStatusPalette.TRANSFER[100], 600: rentalStatusPalette.TRANSFER[600] },
386
- in_repair: { 100: rentalStatusPalette.IN_REPAIR[100], 600: rentalStatusPalette.IN_REPAIR[600] },
387
- other_rental_status: {
388
- 100: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
389
- 600: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
390
- },
391
- },
392
- size: {
393
- small: "w-4",
394
- medium: "w-5",
395
- large: "w-6",
396
- font: "w-[1em]",
397
- },
398
- },
399
- defaultVariants: {
400
- color: "default",
401
- size: "large",
402
- },
403
- });
404
- cvaMerge([], {
405
- variants: {
406
- iconType: {
407
- solid: "fill-current stroke-transparent",
408
- outline: "fill-transparent stroke-current",
409
- },
410
- },
411
- });
412
- cvaMerge([
413
- "relative",
414
- "aspect-square",
415
- "after:content-['']",
416
- "after:absolute",
417
- "after:h-2",
418
- "after:w-2",
419
- "after:bg-current",
420
- "after:rounded-full",
421
- "after:inset-1/2",
422
- "after:-translate-x-1/2",
423
- "after:-translate-y-1/2",
424
- "after:opacity-50",
425
- ]);
426
-
427
- const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
428
- const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
429
- /**
430
- * - The Icon component is used to display an Icon.
431
- * - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
432
- * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
433
- *
434
- * @param {IconProps} props - The props for the Icon component
435
- * @returns {JSX.Element} Icon component
436
- */
437
- const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
438
- const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
439
- const iconName = iconNames[name];
440
- if (!iconName) {
441
- return null;
442
- }
443
- const href = {
444
- solid: `${IconSpriteSolid}#${iconName}`,
445
- outline: `${IconSpriteOutline}#${iconName}`,
446
- };
447
- return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsx("use", { href: href[correctIconType] }) }) }));
448
- };
449
-
450
529
  /**
451
530
  * The StarButton component is used for favorite actions or similar.
452
531
  *
@@ -457,69 +536,6 @@ const StarButton = ({ starred, onClick }) => {
457
536
  return (jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
458
537
  };
459
538
 
460
- const cvaText = cvaMerge(["m-0", "relative", "text-sm", "font-normal"], {
461
- variants: {
462
- align: {
463
- left: "text-left",
464
- right: "text-right",
465
- center: "text-center",
466
- },
467
- italic: {
468
- true: "italic",
469
- false: "",
470
- },
471
- uppercase: {
472
- true: "uppercase",
473
- false: "",
474
- },
475
- underline: {
476
- true: [
477
- "underline",
478
- "after:bg-inherit",
479
- "after:content-none",
480
- "after:absolute",
481
- "after:w-full",
482
- "after:h-0.5",
483
- "after:bottom-0",
484
- "after:left-0",
485
- ],
486
- false: "",
487
- },
488
- weight: {
489
- normal: "font-normal",
490
- bold: "font-medium",
491
- thick: "font-semibold",
492
- },
493
- size: {
494
- small: "text-xs",
495
- medium: "text-sm",
496
- large: "text-base",
497
- },
498
- color: {
499
- default: "text-black",
500
- subtleInverted: "text-neutral-300",
501
- subtle: "text-neutral-600",
502
- inverted: "text-white",
503
- },
504
- },
505
- });
506
-
507
- /**
508
- * The Text component is used to apply Trackunit default typography styles to text.
509
- *
510
- * ### When to use
511
- *
512
- * Use Text when you want to show a text section, use Heading if you want to show a heading.
513
- *
514
- * @param {TextProps} props - The props for the Text component
515
- * @returns {JSX.Element} Text component
516
- */
517
- const Text = (_a) => {
518
- var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "className", "dataTestId"]);
519
- const color = inverted && subtle ? "subtleInverted" : inverted ? "inverted" : subtle ? "subtle" : "default";
520
- return React.createElement(type, Object.assign({ className: cvaText({ color, uppercase, align, italic: italicize, size, underline, weight, className }), "data-testid": dataTestId, children }, rest));
521
- };
522
-
523
539
  const cvaAlert = cvaMerge(["flex", "relative", "p-4", "rounded"], {
524
540
  variants: {
525
541
  color: {
@@ -698,16 +714,23 @@ const cvaCard = cvaMerge([
698
714
  fullHeight: false,
699
715
  },
700
716
  });
701
- const cvaCardBody = cvaMerge(["flex-grow", "overflow-auto"]);
702
- const cvaCardFooterDensityContainer = cvaMerge(["border-t-2", "border-neutral-200", "justify-end"], {
717
+ const cvaCardFooterDensityContainer = cvaMerge(["border-t-2", "border-neutral-200", "justify-end", "flex-row"], {
703
718
  variants: {
704
719
  border: {
705
720
  default: "",
706
721
  borderless: "border-t-0",
707
722
  },
723
+ density: {
724
+ none: "",
725
+ compact: "gap-3 p-3",
726
+ comfortable: "gap-4 p-4",
727
+ spacious: "gap-4 p-6",
728
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
729
+ },
708
730
  },
709
731
  defaultVariants: {
710
732
  border: "default",
733
+ density: "auto",
711
734
  },
712
735
  });
713
736
  const cvaCardHeader = cvaMerge(["flex", "justify-between"]);
@@ -718,12 +741,20 @@ const cvaCardHeaderDensityContainer = cvaMerge(["border-b-2", "border-neutral-20
718
741
  default: "",
719
742
  borderless: "border-b-0",
720
743
  },
744
+ density: {
745
+ none: "",
746
+ compact: "gap-3 p-3",
747
+ comfortable: "gap-4 p-4",
748
+ spacious: "gap-4 p-6",
749
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
750
+ },
721
751
  },
722
752
  defaultVariants: {
723
753
  border: "default",
754
+ density: "auto",
724
755
  },
725
756
  });
726
- const cvaCardDensityContainer = cvaMerge(["flex"], {
757
+ const cvaCardBodyDensityContainer = cvaMerge(["flex", "flex-grow", "overflow-auto"], {
727
758
  variants: {
728
759
  disableGap: {
729
760
  true: "gap-0",
@@ -763,18 +794,6 @@ const Card = (_a) => {
763
794
  return (jsx("div", Object.assign({ onClick: onClick, className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD }, rest, { children: children })));
764
795
  };
765
796
 
766
- /**
767
- * The DensityContainer component applies gap and padding.
768
- * The padding should live here, and not on the Card itself, as to not inset the scrollbar in case of overflow.
769
- *
770
- * @summary For applying auto padding and gap to a Card or Modal or whatever.
771
- * @param {ContainerProps} props - The props for the DensityContainer component
772
- * @returns {JSX.Element} DensityContainer component
773
- */
774
- const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
775
- return (jsx("div", { className: cvaCardDensityContainer({ className, disableGap, density, direction }), "data-testid": dataTestId, children: children }));
776
- };
777
-
778
797
  /**
779
798
  * The CardBody component should be used to inform the user of important information.
780
799
  *
@@ -784,7 +803,7 @@ const DensityContainer = ({ children, className, dataTestId, density, disableGap
784
803
  * @returns {JSX.Element} CardBody component
785
804
  */
786
805
  const CardBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
787
- return (jsx(DensityContainer, { density: density, dataTestId: dataTestId, className: cvaCardBody({ className }), disableGap: disableGap, children: children }));
806
+ return (jsx("div", { "data-testid": dataTestId, className: cvaCardBodyDensityContainer({ density, disableGap, className }), children: children }));
788
807
  };
789
808
 
790
809
  /**
@@ -796,7 +815,11 @@ const CardBody = ({ density = "auto", children, dataTestId, className, disableGa
796
815
  * @returns {JSX.Element} CardFooter component
797
816
  */
798
817
  const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
799
- return (jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardFooterDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, direction: "row", children: children }));
818
+ return (jsx("div", { "data-testid": dataTestId, className: cvaCardFooterDensityContainer({
819
+ density,
820
+ border: hideSeparator ? "borderless" : "default",
821
+ className,
822
+ }), children: children }));
800
823
  };
801
824
 
802
825
  const cvaHeading = cvaMerge(["m-0", "leading-normal", "text-black"], {
@@ -854,7 +877,11 @@ const Heading = (_a) => {
854
877
  * @returns {JSX.Element} CardHeader component
855
878
  */
856
879
  const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
857
- return (jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { className: extraClassName, children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsx(Heading, { 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: "XMark", size: "small" }), className: "!h-min" }))] }) }));
880
+ return (jsx("div", { "data-testid": dataTestId, className: cvaCardHeaderDensityContainer({
881
+ density,
882
+ border: hideSeparator ? "borderless" : "default",
883
+ className,
884
+ }), children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { className: extraClassName, children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsx(Heading, { 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: "XMark", size: "small" }), className: "!h-min" }))] }) }));
858
885
  };
859
886
 
860
887
  function useMountedState() {
@@ -19747,7 +19774,7 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
19747
19774
  * @returns {JSX.Element} PageHeader component
19748
19775
  */
19749
19776
  const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, }) => {
19750
- return (jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag }), showLoading && jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
19777
+ return (jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && (jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag })), showLoading && jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
19751
19778
  };
19752
19779
 
19753
19780
  const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
@@ -39170,4 +39197,4 @@ const useVisibilityChange = ({ onChange, targetState }) => {
39170
39197
  }, [onChange, targetState]);
39171
39198
  };
39172
39199
 
39173
- export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
39200
+ export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.169",
3
+ "version": "0.1.172",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,10 +9,10 @@
9
9
  "dependencies": {
10
10
  "@floating-ui/react": "0.25.4",
11
11
  "@trackunit/css-class-variance-utilities": "0.0.14",
12
- "@trackunit/css-core": "0.0.95",
13
- "@trackunit/shared-utils": "0.0.10",
14
- "@trackunit/ui-design-tokens": "0.0.77",
15
- "@trackunit/ui-icons": "0.0.77",
12
+ "@trackunit/css-core": "0.0.96",
13
+ "@trackunit/shared-utils": "0.0.11",
14
+ "@trackunit/ui-design-tokens": "0.0.78",
15
+ "@trackunit/ui-icons": "0.0.78",
16
16
  "date-fns": "2.29.3",
17
17
  "lodash": "4.17.21",
18
18
  "react": "18.2.0",
@@ -2,16 +2,17 @@ export declare const cvaCard: (props?: ({
2
2
  clickable?: boolean | null | undefined;
3
3
  fullHeight?: boolean | null | undefined;
4
4
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
- export declare const cvaCardBody: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
5
  export declare const cvaCardFooterDensityContainer: (props?: ({
7
6
  border?: "default" | "borderless" | null | undefined;
7
+ density?: "none" | "compact" | "comfortable" | "spacious" | "auto" | null | undefined;
8
8
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
9
9
  export declare const cvaCardHeader: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
10
10
  export declare const cvaCardHeaderHeadingContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
11
11
  export declare const cvaCardHeaderDensityContainer: (props?: ({
12
12
  border?: "default" | "borderless" | null | undefined;
13
+ density?: "none" | "compact" | "comfortable" | "spacious" | "auto" | null | undefined;
13
14
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
14
- export declare const cvaCardDensityContainer: (props?: ({
15
+ export declare const cvaCardBodyDensityContainer: (props?: ({
15
16
  disableGap?: boolean | null | undefined;
16
17
  direction?: "row" | "row-reverse" | "column" | "column-reverse" | null | undefined;
17
18
  density?: "none" | "compact" | "comfortable" | "spacious" | "auto" | null | undefined;
@@ -2,4 +2,3 @@ export * from "./Card";
2
2
  export * from "./CardBody";
3
3
  export * from "./CardFooter";
4
4
  export * from "./CardHeader";
5
- export * from "./DensityContainer";
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { Matcher } from "react-day-picker";
3
3
  import { CommonProps, Size } from "../../common/CommonProps";
4
- import { ButtonColor } from "../buttons";
5
4
  import { PopoverPlacement } from "../Popover";
5
+ import { ButtonColor } from "../buttons";
6
6
  export interface DayPickerPopoverProps extends CommonProps {
7
7
  disabledDays?: Matcher | Matcher[] | undefined;
8
8
  onDaySelect: (day: Date) => void;
@@ -190,7 +190,12 @@ export declare const iconPalette: {
190
190
  readonly 300: "212 212 212";
191
191
  readonly 400: "163 163 163";
192
192
  readonly 500: "115 115 115";
193
- readonly 600: "82 82 82";
193
+ readonly 600: "82 82 82"; /**
194
+ * The size of the icon.
195
+ * Small = 16x16px, medium = 20x20px, Large = 24x24px.
196
+ * Default value is Large.
197
+ * If a custom size is needed, set it in the className.
198
+ */
194
199
  readonly 700: "64 64 64";
195
200
  readonly 800: "38 38 38";
196
201
  readonly 900: "23 23 23";
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { MenuItemProps } from "../MenuItem/MenuItem";
3
2
  import { CommonProps } from "../../../common";
3
+ import { MenuItemProps } from "../MenuItem/MenuItem";
4
4
  export interface MenuListItemProps extends MenuItemProps {
5
5
  showDivider?: boolean;
6
6
  }
@@ -44,6 +44,10 @@ export interface TextProps extends CommonProps {
44
44
  * Whether text is underlined or not.
45
45
  */
46
46
  underline?: boolean;
47
+ /**
48
+ * Whether text is disabled or not.
49
+ */
50
+ disabled?: boolean;
47
51
  }
48
52
  /**
49
53
  * The Text component is used to apply Trackunit default typography styles to text.
@@ -55,4 +59,4 @@ export interface TextProps extends CommonProps {
55
59
  * @param {TextProps} props - The props for the Text component
56
60
  * @returns {JSX.Element} Text component
57
61
  */
58
- export declare const Text: ({ children, type, size, align, weight, underline, inverted, subtle, italicize, uppercase, className, dataTestId, ...rest }: TextProps) => JSX.Element;
62
+ export declare const Text: ({ children, type, size, align, weight, underline, inverted, subtle, italicize, uppercase, disabled, className, dataTestId, ...rest }: TextProps) => JSX.Element;
@@ -5,5 +5,7 @@ export declare const cvaText: (props?: ({
5
5
  underline?: boolean | null | undefined;
6
6
  weight?: "normal" | "bold" | "thick" | null | undefined;
7
7
  size?: "small" | "medium" | "large" | null | undefined;
8
- color?: "default" | "subtleInverted" | "subtle" | "inverted" | null | undefined;
8
+ inverted?: boolean | null | undefined;
9
+ subtle?: boolean | null | undefined;
10
+ disabled?: boolean | null | undefined;
9
11
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,3 +1,3 @@
1
1
  export * from "./ValueBar";
2
- export * from "./ValueBarTypes";
3
2
  export { getValueBarColorByValue } from "./ValueBarHelper";
3
+ export * from "./ValueBarTypes";
@@ -1,4 +1,4 @@
1
1
  export * from "./Button/Button";
2
2
  export * from "./IconButton/IconButton";
3
- export * from "./shared/ButtonProps";
4
3
  export * from "./StarButton/StarButton";
4
+ export * from "./shared/ButtonProps";
@@ -1,6 +1,5 @@
1
1
  export * from "./Alert";
2
2
  export * from "./Badge";
3
- export * from "./buttons";
4
3
  export * from "./Card";
5
4
  export * from "./Collapse";
6
5
  export * from "./CopyableText";
@@ -29,3 +28,4 @@ export * from "./Timeline/Timeline";
29
28
  export * from "./Tip";
30
29
  export * from "./Tooltip";
31
30
  export * from "./ValueBar";
31
+ export * from "./buttons";
package/src/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "./common";
2
2
  export * from "./components";
3
- export * from "./components/buttons/shared/Button.variants";
4
3
  export * from "./components/Clickable/Clickable.variants";
5
4
  export * from "./components/Indicator/Indicator.variants";
6
5
  export * from "./components/Menu/MenuItem/MenuItem.variants";
6
+ export * from "./components/buttons/shared/Button.variants";
7
7
  export * from "./hooks";
@@ -1,30 +0,0 @@
1
- import * as React from "react";
2
- import { CommonProps, Density } from "../../common/CommonProps";
3
- interface ContainerProps extends CommonProps {
4
- /**
5
- * The density of the card components.
6
- * "compact" = 12px gap and padding.
7
- * "comfortable" = 16px gap and padding.
8
- * "spacious" = 16px gap, 26px padding.
9
- */
10
- density?: Density;
11
- /**
12
- * Set gap to be 0px (not preferable)
13
- */
14
- disableGap?: boolean;
15
- /**
16
- * The flex direction of the Card. Defaults to "column".
17
- */
18
- direction?: "row" | "row-reverse" | "column" | "column-reverse";
19
- children?: React.ReactNode;
20
- }
21
- /**
22
- * The DensityContainer component applies gap and padding.
23
- * The padding should live here, and not on the Card itself, as to not inset the scrollbar in case of overflow.
24
- *
25
- * @summary For applying auto padding and gap to a Card or Modal or whatever.
26
- * @param {ContainerProps} props - The props for the DensityContainer component
27
- * @returns {JSX.Element} DensityContainer component
28
- */
29
- export declare const DensityContainer: ({ children, className, dataTestId, density, disableGap, direction, }: ContainerProps) => JSX.Element;
30
- export {};