@trackunit/react-components 0.1.108 → 0.1.111

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 CHANGED
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
7
6
  var React = require('react');
7
+ var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
8
8
  var uiIcons = require('@trackunit/ui-icons');
9
+ var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
9
10
  var reactUse = require('react-use');
10
11
  var reactDayPicker = require('react-day-picker');
11
12
  var locale = require('date-fns/locale');
@@ -109,7 +110,7 @@ function __rest(s, e) {
109
110
  * @returns {JSX.Element} Spinner component
110
111
  */
111
112
  const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
112
- return (jsxRuntime.jsx(Container$7, Object.assign({ "$mode": mode, "$centering": centering, className: containerClassName }, { children: jsxRuntime.jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
113
+ return (jsxRuntime.jsx(Container$4, Object.assign({ "$mode": mode, "$centering": centering, className: containerClassName }, { children: jsxRuntime.jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
113
114
  };
114
115
  const getSpinnerStyles = () => ({ $size }) => {
115
116
  switch ($size) {
@@ -139,7 +140,7 @@ const StyledSpinner$1 = tailwindStyledComponents.tw.span `
139
140
  ${p => (p.$mode === "dark" ? tailwindStyledComponents.tws `tu-spinner--dark` : null)}
140
141
  ${getSpinnerStyles()}
141
142
  `;
142
- const Container$7 = tailwindStyledComponents.tw.div `
143
+ const Container$4 = tailwindStyledComponents.tw.div `
143
144
  tu-spinner--container
144
145
  ${getCenteringStyles()}
145
146
 
@@ -211,12 +212,12 @@ const StyledSpinner = tailwindStyledComponents.twx(Spinner) `
211
212
 
212
213
  const IconButton = React__namespace.forwardRef((_a, ref) => {
213
214
  var { icon, size = "small", square = true, circular, loading, disabled } = _a, rest = __rest(_a, ["icon", "size", "square", "circular", "loading", "disabled"]);
214
- return (jsxRuntime.jsx(StyledButton, Object.assign({ size: size, square: square, "$circular": circular, disabled: disabled || loading, ref: ref }, rest, { children: jsxRuntime.jsx(IconContainer$2, { children: loading ? jsxRuntime.jsx(Spinner, { size: size }) : icon }) })));
215
+ return (jsxRuntime.jsx(StyledButton, Object.assign({ size: size, square: square, "$circular": circular, disabled: disabled || loading, ref: ref }, rest, { children: jsxRuntime.jsx(IconContainer$1, { children: loading ? jsxRuntime.jsx(Spinner, { size: size }) : icon }) })));
215
216
  });
216
217
  const StyledButton = tailwindStyledComponents.twx(Button) `
217
218
  ${p => (p.$circular ? tailwindStyledComponents.tws `tu-button--rounded` : null)}
218
219
  `;
219
- const IconContainer$2 = tailwindStyledComponents.tw.div `
220
+ const IconContainer$1 = tailwindStyledComponents.tw.div `
220
221
  tu-button__container
221
222
  ${p => (p.$size === "small" ? tailwindStyledComponents.tws `tu-button__container--small` : null)}
222
223
  `;
@@ -249,12 +250,12 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
249
250
  if (!IconComponent) {
250
251
  return null;
251
252
  }
252
- return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsxRuntime.jsx(Root$6, Object.assign({ "$color": color, onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsxRuntime.jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: `${iconSizeClassName} ${colorClassNames} ${className !== null && className !== void 0 ? className : ""} ${name} aspect-square`, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
253
+ return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsxRuntime.jsx(Root$5, Object.assign({ "$color": color, onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsxRuntime.jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: `${iconSizeClassName} ${colorClassNames} ${className !== null && className !== void 0 ? className : ""} ${name} aspect-square`, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
253
254
  };
254
255
  const LoadingDot = tailwindStyledComponents.tw.span `
255
256
  tu-loading-dot
256
257
  `;
257
- const Root$6 = tailwindStyledComponents.tw.span `
258
+ const Root$5 = tailwindStyledComponents.tw.span `
258
259
  tu-icon
259
260
  ${({ $color }) => {
260
261
  switch ($color) {
@@ -373,6 +374,71 @@ const StyledText$3 = tailwindStyledComponents.tw.text `
373
374
  ${getTextWeight()}
374
375
  `;
375
376
 
377
+ const cvaAlert = cssClassVarianceUtilities.cvaMerge(["flex", "relative", "p-4", "rounded"], {
378
+ variants: {
379
+ color: {
380
+ danger: "bg-danger-100",
381
+ warning: "bg-warning-100",
382
+ success: "bg-success-100",
383
+ info: "bg-info-100",
384
+ },
385
+ layout: {
386
+ default: "items-start",
387
+ inline: "items-center",
388
+ },
389
+ },
390
+ defaultVariants: {
391
+ layout: "default",
392
+ color: "info",
393
+ },
394
+ });
395
+ const cvaAlertDetails = cssClassVarianceUtilities.cvaMerge(["flex"]);
396
+ const cvaAlertContentBody = cssClassVarianceUtilities.cvaMerge(["grid", "gap-2", "flex-grow"]);
397
+ const cvaAlertRightAligned = cssClassVarianceUtilities.cvaMerge(["flex", "justify-end", "gap-2", "ml-2", "mt-4"], {
398
+ variants: {
399
+ layout: {
400
+ default: "",
401
+ inline: "mt-0 ml-auto items-center",
402
+ },
403
+ },
404
+ defaultVariants: {
405
+ layout: "default",
406
+ },
407
+ });
408
+ const cvaAlertContent = cssClassVarianceUtilities.cvaMerge(["grow"], {
409
+ variants: {
410
+ layout: {
411
+ default: "",
412
+ inline: "flex items-center w-full",
413
+ },
414
+ },
415
+ defaultVariants: {
416
+ layout: "default",
417
+ },
418
+ });
419
+ const cvaAlertCloseButtonContainer = cssClassVarianceUtilities.cvaMerge(["flex", "self-start", "w-min", "shrink-0"], {
420
+ variants: {
421
+ layout: {
422
+ default: "",
423
+ inline: "ml-4",
424
+ },
425
+ },
426
+ defaultVariants: {
427
+ layout: "default",
428
+ },
429
+ });
430
+ const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start", "mr-3", "shrink-0", "grid", "w-min"], {
431
+ variants: {
432
+ layout: {
433
+ default: "",
434
+ inline: "self-center",
435
+ },
436
+ },
437
+ defaultVariants: {
438
+ layout: "default",
439
+ },
440
+ });
441
+
376
442
  /**
377
443
  * The Alert component should be used to inform the user of important information.
378
444
  *
@@ -380,7 +446,7 @@ const StyledText$3 = tailwindStyledComponents.tw.text `
380
446
  * @returns {JSX.Element} Alert component
381
447
  */
382
448
  const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline = false, }) => {
383
- const ref = React__namespace.useRef();
449
+ const ref = React__namespace.useRef(null);
384
450
  const getIconFromColor = () => {
385
451
  switch (color) {
386
452
  case "danger":
@@ -403,51 +469,15 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
403
469
  return "primary";
404
470
  }
405
471
  };
406
- const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsxRuntime.jsx(Description, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsxRuntime.jsx(Description, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] }));
472
+ const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && jsxRuntime.jsx(Text$1, Object.assign({ weight: !title ? "bold" : "normal" }, { children: children }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && jsxRuntime.jsx(Text$1, Object.assign({ weight: !title ? "bold" : "normal" }, { children: children }))] }));
407
473
  React__namespace.useEffect(() => {
408
474
  if (autoScroll) {
409
475
  ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
410
476
  }
411
477
  }, [ref, autoScroll]);
412
- return (jsxRuntime.jsxs(Container$6, Object.assign({ "$color": color, className: className, "data-testid": dataTestId, "$inline": inline, ref: ref, role: "alert" }, { children: [jsxRuntime.jsx(IconContainer$1, Object.assign({ "$inline": inline }, { children: getIconFromColor() })), jsxRuntime.jsxs(Content$1, Object.assign({ "$inline": inline }, { children: [jsxRuntime.jsxs(ContentDetails, { children: [jsxRuntime.jsx(ContentBody, { children: body }), onClose && !inline ? (jsxRuntime.jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] }), (primaryAction || secondaryAction || onClose) && (jsxRuntime.jsxs(RightAligned, Object.assign({ "$inline": inline }, { children: [secondaryAction && (jsxRuntime.jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsxRuntime.jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsxRuntime.jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
413
- };
414
- const CloseButtonContainer = tailwindStyledComponents.tw.div `
415
- ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__close-button-container--inline` : tailwindStyledComponents.tws `tu-alert__close-button-container`)}
416
- `;
417
- const getBackgroundColor = () => ({ $color }) => {
418
- const colors = {
419
- danger: tailwindStyledComponents.tws `tu-alert--danger`,
420
- warning: tailwindStyledComponents.tws `tu-alert--warning`,
421
- success: tailwindStyledComponents.tws `tu-alert--success`,
422
- info: tailwindStyledComponents.tws `tu-alert--info`,
423
- };
424
- return colors[$color];
425
- };
426
- const Container$6 = tailwindStyledComponents.tw.div `
427
- tu-alert
428
- ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert--inline` : null)}
429
- ${getBackgroundColor()}
430
- `;
431
- const Content$1 = tailwindStyledComponents.tw.div `
432
- ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__content--inline` : tailwindStyledComponents.tws `tu-alert__content`)}
433
- `;
434
- const ContentDetails = tailwindStyledComponents.tw.div `
435
- tu-alert__content-details
436
- `;
437
- const ContentBody = tailwindStyledComponents.tw.div `
438
- tu-alert__content-body
439
- `;
440
- const Description = tailwindStyledComponents.twx(Text$1) `
441
- ${p => (p.$hasTitle ? tailwindStyledComponents.tws `tu-alert__description` : null)}
442
- `;
443
- const RightAligned = tailwindStyledComponents.tw.div `
444
- tu-alert__right-aligned
445
- ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__right-aligned--inline` : null)}
446
- `;
447
- const IconContainer$1 = tailwindStyledComponents.tw.div `
448
- tu-alert__icon-container
449
- ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__icon-container--inline` : null)}
450
- `;
478
+ const layout = inline ? "inline" : "default";
479
+ return (jsxRuntime.jsxs("div", Object.assign({ className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert" }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaAlertIconContainer({ layout }) }, { children: getIconFromColor() })), jsxRuntime.jsxs("div", Object.assign({ className: cvaAlertContent({ layout }) }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaAlertDetails() }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaAlertContentBody() }, { children: body })), onClose && !inline ? (jsxRuntime.jsx("div", Object.assign({ className: cvaAlertCloseButtonContainer({ layout }) }, { children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })), (primaryAction || secondaryAction || onClose) && (jsxRuntime.jsxs("div", Object.assign({ className: cvaAlertRightAligned({ layout }) }, { children: [secondaryAction && (jsxRuntime.jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsxRuntime.jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsxRuntime.jsx("div", Object.assign({ className: cvaAlertCloseButtonContainer({ layout }) }, { children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
480
+ };
451
481
 
452
482
  /**
453
483
  * The Badge component is used to display a notification badge with an optional number value.
@@ -476,6 +506,58 @@ const StyledText$2 = tailwindStyledComponents.tw.text `
476
506
  ${getBadgeModifierClass()}
477
507
  `;
478
508
 
509
+ const cvaCard = cssClassVarianceUtilities.cvaMerge([
510
+ "flex",
511
+ "border",
512
+ "flex-col",
513
+ "relative",
514
+ "bg-white",
515
+ "component-card-shadow",
516
+ "component-card-border",
517
+ "transition-shadow",
518
+ "ease-in-out",
519
+ ], {
520
+ variants: {
521
+ clickable: {
522
+ false: "",
523
+ true: "cursor-pointer hover:shadow-md",
524
+ },
525
+ fullHeight: {
526
+ false: "",
527
+ true: "h-full",
528
+ },
529
+ },
530
+ defaultVariants: {
531
+ clickable: false,
532
+ fullHeight: false,
533
+ },
534
+ });
535
+ const cvaCardBody = cssClassVarianceUtilities.cvaMerge(["flex-grow", "overflow-auto"]);
536
+ const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["border-t-2", "border-neutral-200", "justify-end"], {
537
+ variants: {
538
+ border: {
539
+ default: "",
540
+ borderless: "border-t-0",
541
+ },
542
+ },
543
+ defaultVariants: {
544
+ border: "default",
545
+ },
546
+ });
547
+ const cvaCardHeader = cssClassVarianceUtilities.cvaMerge(["flex", "justify-between"]);
548
+ const cvaCardHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-4", "items-center"]);
549
+ const cvaCardHeaderDensityContainer = cssClassVarianceUtilities.cvaMerge(["border-b-2", "border-neutral-200"], {
550
+ variants: {
551
+ border: {
552
+ default: "",
553
+ borderless: "border-b-0",
554
+ },
555
+ },
556
+ defaultVariants: {
557
+ border: "default",
558
+ },
559
+ });
560
+
479
561
  const ROLE_CARD = "region";
480
562
  /**
481
563
  * The Card component is a container for UI elements, and is the main component of the modal.
@@ -485,28 +567,9 @@ const ROLE_CARD = "region";
485
567
  * @returns {JSX.Element} Card component
486
568
  */
487
569
  const Card = (_a) => {
488
- var { children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, overflow = "visible", gridArea } = _a, rest = __rest(_a, ["children", "onClick", "fullHeight", "onMouseEnter", "onMouseLeave", "className", "dataTestId", "overflow", "gridArea"]);
489
- return (jsxRuntime.jsx(StyledCard$2, Object.assign({}, rest, { "$fullHeight": fullHeight, "$overflow": overflow, onClick: onClick, className: className, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD, style: { gridArea } }, { children: children })));
490
- };
491
- const getOverflow$1 = () => ({ $overflow }) => {
492
- if (!$overflow) {
493
- return null;
494
- }
495
- const overflows = {
496
- visible: tailwindStyledComponents.tws `overflow-visible`,
497
- hidden: tailwindStyledComponents.tws `overflow-hidden`,
498
- scroll: tailwindStyledComponents.tws `overflow-scroll`,
499
- auto: tailwindStyledComponents.tws `overflow-auto`,
500
- };
501
- return overflows[$overflow];
502
- };
503
- const StyledCard$2 = tailwindStyledComponents.tw.div `
504
- tu-card
505
- ${p => (p.$fullHeight ? `h-full` : null)}
506
-
507
- ${p => p.onClick && `tu-card--clickable`}
508
- ${getOverflow$1()}
509
- `;
570
+ var { children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, gridArea } = _a, rest = __rest(_a, ["children", "onClick", "fullHeight", "onMouseEnter", "onMouseLeave", "className", "dataTestId", "gridArea"]);
571
+ return (jsxRuntime.jsx("div", Object.assign({}, rest, { onClick: onClick, className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD, style: { gridArea } }, { children: children })));
572
+ };
510
573
 
511
574
  /**
512
575
  * The DensityContainer component applies gap and padding.
@@ -517,7 +580,7 @@ const StyledCard$2 = tailwindStyledComponents.tw.div `
517
580
  * @returns {JSX.Element} DensityContainer component
518
581
  */
519
582
  const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
520
- return (jsxRuntime.jsx(StyledDensityContainer$1, Object.assign({ "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className }, { children: children })));
583
+ return (jsxRuntime.jsx(StyledDensityContainer, Object.assign({ "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className }, { children: children })));
521
584
  };
522
585
  const getDirection = () => ({ $direction }) => {
523
586
  $direction = $direction !== null && $direction !== void 0 ? $direction : "column";
@@ -549,7 +612,7 @@ const DensityFinder = ({ $density }) => {
549
612
  return densityAuto;
550
613
  }
551
614
  };
552
- const StyledDensityContainer$1 = tailwindStyledComponents.tw.div `
615
+ const StyledDensityContainer = tailwindStyledComponents.tw.div `
553
616
  flex
554
617
  ${getDirection()}
555
618
  ${p => (p.$disableGap ? tailwindStyledComponents.tws `gap-0` : null)}
@@ -564,25 +627,9 @@ ${DensityFinder}
564
627
  * @param {CardBodyProps} props - The props for the CardBody component
565
628
  * @returns {JSX.Element} CardBody component
566
629
  */
567
- const CardBody = ({ density = "auto", overflow = "auto", children, dataTestId, className, disableGap, }) => {
568
- return (jsxRuntime.jsx(StyledDensityContainer, Object.assign({ "$overflow": overflow, density: density, dataTestId: dataTestId, className: className, disableGap: disableGap }, { children: children })));
569
- };
570
- const getOverflow = () => ({ $overflow }) => {
571
- if (!$overflow) {
572
- return null;
573
- }
574
- const overflows = {
575
- visible: tailwindStyledComponents.tws `overflow-visible`,
576
- hidden: tailwindStyledComponents.tws `overflow-hidden`,
577
- scroll: tailwindStyledComponents.tws `overflow-scroll`,
578
- auto: tailwindStyledComponents.tws `overflow-auto`,
579
- };
580
- return overflows[$overflow];
581
- };
582
- const StyledDensityContainer = tailwindStyledComponents.twx(DensityContainer) `
583
- ${getOverflow()}
584
- tu-card__body
585
- `;
630
+ const CardBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
631
+ return (jsxRuntime.jsx(DensityContainer, Object.assign({ density: density, dataTestId: dataTestId, className: cvaCardBody({ className }), disableGap: disableGap }, { children: children })));
632
+ };
586
633
 
587
634
  /**
588
635
  * A simple footer intended to use with Cards and Modals.
@@ -593,12 +640,8 @@ const StyledDensityContainer = tailwindStyledComponents.twx(DensityContainer) `
593
640
  * @returns {JSX.Element} CardFooter component
594
641
  */
595
642
  const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
596
- return (jsxRuntime.jsx(Container$5, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density, direction: "row" }, { children: children })));
597
- };
598
- const Container$5 = tailwindStyledComponents.twx(DensityContainer) `
599
- tu-card__footer-density-container
600
- ${p => p.$hideSeparator && tailwindStyledComponents.tws `tu-card__footer-density-container--borderless`}
601
- `;
643
+ return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardFooterDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, direction: "row" }, { children: children })));
644
+ };
602
645
 
603
646
  /**
604
647
  * The Heading is used for a heading of a section (h1,h2,h3,h4).
@@ -642,18 +685,37 @@ const StyledHeading = tailwindStyledComponents.tw.div `
642
685
  * @returns {JSX.Element} CardHeader component
643
686
  */
644
687
  const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
645
- return (jsxRuntime.jsx(Root$5, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxRuntime.jsxs(Container$4, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs(HeadingContainer$1, { children: [jsxRuntime.jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsxRuntime.jsx(Heading$1, Object.assign({ 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: "XMarkIcon", size: "small" }), className: "!h-min" }))] }) })));
646
- };
647
- const Root$5 = tailwindStyledComponents.twx(DensityContainer) `
648
- tu-card__header-density-container
649
- ${p => p.$hideSeparator && tailwindStyledComponents.tws `tu-card__header-density-container--borderless`}
650
- `;
651
- const Container$4 = tailwindStyledComponents.tw.div `
652
- tu-card__header
653
- `;
654
- const HeadingContainer$1 = tailwindStyledComponents.tw.div `
655
- tu-card__header-heading-container
656
- `;
688
+ return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsxRuntime.jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsxRuntime.jsx(Heading$1, Object.assign({ 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: "XMarkIcon", size: "small" }), className: "!h-min" }))] })) })));
689
+ };
690
+
691
+ const cvaCollapse = cssClassVarianceUtilities.cvaMerge([
692
+ "block",
693
+ "w-full",
694
+ "border-b",
695
+ "border-solid",
696
+ "border-neutral-100",
697
+ "pb-3",
698
+ "mb-4",
699
+ "last:border-0",
700
+ "last:m-0",
701
+ "only:border-0",
702
+ "only:m-0",
703
+ ]);
704
+ const cvaCollapseLabel = cssClassVarianceUtilities.cvaMerge(["block", "w-full", "cursor-pointer"]);
705
+ const cvaCollapseLabelContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "justify-between"]);
706
+ cssClassVarianceUtilities.cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
707
+ const cvaCollapseAnimated = cssClassVarianceUtilities.cvaMerge(["overflow-y-hidden", "transition-all"]);
708
+ const cvaCollapseIcon = cssClassVarianceUtilities.cvaMerge(["ease-in-out", "duration-200"], {
709
+ variants: {
710
+ expanded: {
711
+ false: "",
712
+ true: "rotate-180",
713
+ },
714
+ },
715
+ defaultVariants: {
716
+ expanded: false,
717
+ },
718
+ });
657
719
 
658
720
  /**
659
721
  * The Collapse component is used to condense non-important information.
@@ -669,31 +731,37 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
669
731
  }
670
732
  setExpanded(!expanded);
671
733
  }, [expanded, onToggle]);
672
- return (jsxRuntime.jsxs(StyledCollapse, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxRuntime.jsx(CollapseLabel, Object.assign({ role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs(LabelContainer, { children: [jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Rotate, { name: "ChevronDownIcon", size: "small", "$expanded": expanded }), size: "medium", variant: "transparent", color: "secondary" })] }) })), jsxRuntime.jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
734
+ return (jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] })) })), jsxRuntime.jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
673
735
  };
674
- const Rotate = tailwindStyledComponents.twx(Icon) `
675
- ${p => (p.$expanded ? tailwindStyledComponents.tws `tu-icon--animated-rotate-expanded` : null)}
676
- tu-icon--animated-rotate
677
- `;
678
- const StyledCollapse = tailwindStyledComponents.tw.div `
679
- tu-collapse
680
- `;
681
- const CollapseLabel = tailwindStyledComponents.tw.div `
682
- tu-collapse__label
683
- `;
684
- const LabelContainer = tailwindStyledComponents.tw.div `
685
- tu-collapse__label__container
686
- `;
687
736
  const Collapsible = ({ children, expanded, id }) => {
688
737
  const [ref, { height }] = reactUse.useMeasure();
689
- return (jsxRuntime.jsx(AnimatedCollapsible, Object.assign({ id: id, style: { height: expanded ? height : "0" } }, { children: jsxRuntime.jsx(StyledCollapsible, Object.assign({ ref: ref }, { children: children })) })));
690
- };
691
- const AnimatedCollapsible = tailwindStyledComponents.tw.div `
692
- tu-collapsible--animated
693
- `;
694
- const StyledCollapsible = tailwindStyledComponents.tw.div `
695
- tu-collapsible
696
- `;
738
+ return (jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" } }, { children: jsxRuntime.jsx("div", Object.assign({ className: cvaCollapse(), ref: ref }, { children: children })) })));
739
+ };
740
+
741
+ const cvaCopyableText = cssClassVarianceUtilities.cvaMerge([
742
+ "py-1",
743
+ "px-2",
744
+ "border",
745
+ "border-dashed",
746
+ "border-neutral-600",
747
+ "rounded",
748
+ "cursor-pointer",
749
+ "inline",
750
+ "transition-all",
751
+ "ease-in-out",
752
+ "leading-7",
753
+ "break-words",
754
+ ], {
755
+ variants: {
756
+ animating: {
757
+ false: "",
758
+ true: "animate-copy",
759
+ },
760
+ },
761
+ defaultVariants: {
762
+ animating: false,
763
+ },
764
+ });
697
765
 
698
766
  /**
699
767
  * The CopyableText component is used where the user should have easy access to copy information.
@@ -710,11 +778,8 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
710
778
  copyToClipboard(value);
711
779
  setAnimating(true);
712
780
  };
713
- return (jsxRuntime.jsx(StyledCopyableText, Object.assign({ className: className, "data-testid": dataTestId, onClick: handleOnClick, onAnimationEnd: () => setAnimating(false), "$animating": animating, title: value }, { children: text })));
714
- };
715
- const StyledCopyableText = tailwindStyledComponents.tw.span `
716
- tu-copyable-text
717
- ${p => (p.$animating ? tailwindStyledComponents.tws `tu-copyable-text--animating` : null)}`;
781
+ return (jsxRuntime.jsx("span", Object.assign({ className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onClick: handleOnClick, onAnimationEnd: () => setAnimating(false), title: value }, { children: text })));
782
+ };
718
783
 
719
784
  const localeLookup = {
720
785
  en: locale.enGB,
@@ -2057,6 +2122,30 @@ const Bar = tailwindStyledComponents.tw.rect `
2057
2122
  tu-value-bar__bar
2058
2123
  `;
2059
2124
 
2125
+ const cvaClickable = cssClassVarianceUtilities.cvaMerge([
2126
+ "shadow-lg",
2127
+ "rounded-lg",
2128
+ "p-3",
2129
+ "bg-neutral-50",
2130
+ "transition-all",
2131
+ "border-2",
2132
+ "border-solid",
2133
+ "border-neutral-100",
2134
+ "cursor-pointer",
2135
+ "hover:border-primary-500",
2136
+ "hover:bg-primary-200",
2137
+ ], {
2138
+ variants: {
2139
+ disabled: {
2140
+ false: "",
2141
+ true: "cursor-default hover:border-neutral-100 hover:bg-neutral-50",
2142
+ },
2143
+ },
2144
+ defaultVariants: {
2145
+ disabled: false,
2146
+ },
2147
+ });
2148
+
2060
2149
  /**
2061
2150
  * The MinTopFullContentLayout component.
2062
2151
  *
@@ -2299,6 +2388,7 @@ exports.TitleNavContentLayout = TitleNavContentLayout;
2299
2388
  exports.Tooltip = Tooltip;
2300
2389
  exports.TwoColumnLayout = TwoColumnLayout;
2301
2390
  exports.ValueBar = ValueBar;
2391
+ exports.cvaClickable = cvaClickable;
2302
2392
  exports.docs = docs;
2303
2393
  exports.getDevicePixelRatio = getDevicePixelRatio;
2304
2394
  exports.getValueBarColorByValue = getValueBarColorByValue;
package/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { tw, tws, twx } from '@trackunit/tailwind-styled-components';
3
2
  import * as React from 'react';
4
3
  import React__default, { useState, useMemo, createContext, useContext, forwardRef, isValidElement, cloneElement, useCallback, useEffect, Children, useRef, useReducer, memo } from 'react';
4
+ import { tw, tws, twx } from '@trackunit/tailwind-styled-components';
5
5
  import { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
6
+ import { cvaMerge } from '@trackunit/css-class-variance-utilities';
6
7
  import { useMeasure, useCopyToClipboard } from 'react-use';
7
8
  import { DayPicker as DayPicker$1 } from 'react-day-picker';
8
9
  import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
@@ -82,7 +83,7 @@ function __rest(s, e) {
82
83
  * @returns {JSX.Element} Spinner component
83
84
  */
84
85
  const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
85
- return (jsx(Container$7, Object.assign({ "$mode": mode, "$centering": centering, className: containerClassName }, { children: jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
86
+ return (jsx(Container$4, Object.assign({ "$mode": mode, "$centering": centering, className: containerClassName }, { children: jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
86
87
  };
87
88
  const getSpinnerStyles = () => ({ $size }) => {
88
89
  switch ($size) {
@@ -112,7 +113,7 @@ const StyledSpinner$1 = tw.span `
112
113
  ${p => (p.$mode === "dark" ? tws `tu-spinner--dark` : null)}
113
114
  ${getSpinnerStyles()}
114
115
  `;
115
- const Container$7 = tw.div `
116
+ const Container$4 = tw.div `
116
117
  tu-spinner--container
117
118
  ${getCenteringStyles()}
118
119
 
@@ -184,12 +185,12 @@ const StyledSpinner = twx(Spinner) `
184
185
 
185
186
  const IconButton = React.forwardRef((_a, ref) => {
186
187
  var { icon, size = "small", square = true, circular, loading, disabled } = _a, rest = __rest(_a, ["icon", "size", "square", "circular", "loading", "disabled"]);
187
- return (jsx(StyledButton, Object.assign({ size: size, square: square, "$circular": circular, disabled: disabled || loading, ref: ref }, rest, { children: jsx(IconContainer$2, { children: loading ? jsx(Spinner, { size: size }) : icon }) })));
188
+ return (jsx(StyledButton, Object.assign({ size: size, square: square, "$circular": circular, disabled: disabled || loading, ref: ref }, rest, { children: jsx(IconContainer$1, { children: loading ? jsx(Spinner, { size: size }) : icon }) })));
188
189
  });
189
190
  const StyledButton = twx(Button) `
190
191
  ${p => (p.$circular ? tws `tu-button--rounded` : null)}
191
192
  `;
192
- const IconContainer$2 = tw.div `
193
+ const IconContainer$1 = tw.div `
193
194
  tu-button__container
194
195
  ${p => (p.$size === "small" ? tws `tu-button__container--small` : null)}
195
196
  `;
@@ -222,12 +223,12 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
222
223
  if (!IconComponent) {
223
224
  return null;
224
225
  }
225
- return (jsx(React.Suspense, Object.assign({ fallback: jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsx(Root$6, Object.assign({ "$color": color, onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: `${iconSizeClassName} ${colorClassNames} ${className !== null && className !== void 0 ? className : ""} ${name} aspect-square`, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
226
+ return (jsx(React.Suspense, Object.assign({ fallback: jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsx(Root$5, Object.assign({ "$color": color, onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: `${iconSizeClassName} ${colorClassNames} ${className !== null && className !== void 0 ? className : ""} ${name} aspect-square`, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
226
227
  };
227
228
  const LoadingDot = tw.span `
228
229
  tu-loading-dot
229
230
  `;
230
- const Root$6 = tw.span `
231
+ const Root$5 = tw.span `
231
232
  tu-icon
232
233
  ${({ $color }) => {
233
234
  switch ($color) {
@@ -346,6 +347,71 @@ const StyledText$3 = tw.text `
346
347
  ${getTextWeight()}
347
348
  `;
348
349
 
350
+ const cvaAlert = cvaMerge(["flex", "relative", "p-4", "rounded"], {
351
+ variants: {
352
+ color: {
353
+ danger: "bg-danger-100",
354
+ warning: "bg-warning-100",
355
+ success: "bg-success-100",
356
+ info: "bg-info-100",
357
+ },
358
+ layout: {
359
+ default: "items-start",
360
+ inline: "items-center",
361
+ },
362
+ },
363
+ defaultVariants: {
364
+ layout: "default",
365
+ color: "info",
366
+ },
367
+ });
368
+ const cvaAlertDetails = cvaMerge(["flex"]);
369
+ const cvaAlertContentBody = cvaMerge(["grid", "gap-2", "flex-grow"]);
370
+ const cvaAlertRightAligned = cvaMerge(["flex", "justify-end", "gap-2", "ml-2", "mt-4"], {
371
+ variants: {
372
+ layout: {
373
+ default: "",
374
+ inline: "mt-0 ml-auto items-center",
375
+ },
376
+ },
377
+ defaultVariants: {
378
+ layout: "default",
379
+ },
380
+ });
381
+ const cvaAlertContent = cvaMerge(["grow"], {
382
+ variants: {
383
+ layout: {
384
+ default: "",
385
+ inline: "flex items-center w-full",
386
+ },
387
+ },
388
+ defaultVariants: {
389
+ layout: "default",
390
+ },
391
+ });
392
+ const cvaAlertCloseButtonContainer = cvaMerge(["flex", "self-start", "w-min", "shrink-0"], {
393
+ variants: {
394
+ layout: {
395
+ default: "",
396
+ inline: "ml-4",
397
+ },
398
+ },
399
+ defaultVariants: {
400
+ layout: "default",
401
+ },
402
+ });
403
+ const cvaAlertIconContainer = cvaMerge(["self-start", "mr-3", "shrink-0", "grid", "w-min"], {
404
+ variants: {
405
+ layout: {
406
+ default: "",
407
+ inline: "self-center",
408
+ },
409
+ },
410
+ defaultVariants: {
411
+ layout: "default",
412
+ },
413
+ });
414
+
349
415
  /**
350
416
  * The Alert component should be used to inform the user of important information.
351
417
  *
@@ -353,7 +419,7 @@ const StyledText$3 = tw.text `
353
419
  * @returns {JSX.Element} Alert component
354
420
  */
355
421
  const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline = false, }) => {
356
- const ref = React.useRef();
422
+ const ref = React.useRef(null);
357
423
  const getIconFromColor = () => {
358
424
  switch (color) {
359
425
  case "danger":
@@ -376,51 +442,15 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
376
442
  return "primary";
377
443
  }
378
444
  };
379
- const body = inline ? (jsxs("div", { children: [title && jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsx(Description, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] })) : (jsxs(Fragment, { children: [title && jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsx(Description, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] }));
445
+ const body = inline ? (jsxs("div", { children: [title && jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && jsx(Text$1, Object.assign({ weight: !title ? "bold" : "normal" }, { children: children }))] })) : (jsxs(Fragment, { children: [title && jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && jsx(Text$1, Object.assign({ weight: !title ? "bold" : "normal" }, { children: children }))] }));
380
446
  React.useEffect(() => {
381
447
  if (autoScroll) {
382
448
  ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
383
449
  }
384
450
  }, [ref, autoScroll]);
385
- return (jsxs(Container$6, Object.assign({ "$color": color, className: className, "data-testid": dataTestId, "$inline": inline, ref: ref, role: "alert" }, { children: [jsx(IconContainer$1, Object.assign({ "$inline": inline }, { children: getIconFromColor() })), jsxs(Content$1, Object.assign({ "$inline": inline }, { children: [jsxs(ContentDetails, { children: [jsx(ContentBody, { children: body }), onClose && !inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] }), (primaryAction || secondaryAction || onClose) && (jsxs(RightAligned, Object.assign({ "$inline": inline }, { children: [secondaryAction && (jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
386
- };
387
- const CloseButtonContainer = tw.div `
388
- ${p => (p.$inline ? tws `tu-alert__close-button-container--inline` : tws `tu-alert__close-button-container`)}
389
- `;
390
- const getBackgroundColor = () => ({ $color }) => {
391
- const colors = {
392
- danger: tws `tu-alert--danger`,
393
- warning: tws `tu-alert--warning`,
394
- success: tws `tu-alert--success`,
395
- info: tws `tu-alert--info`,
396
- };
397
- return colors[$color];
398
- };
399
- const Container$6 = tw.div `
400
- tu-alert
401
- ${p => (p.$inline ? tws `tu-alert--inline` : null)}
402
- ${getBackgroundColor()}
403
- `;
404
- const Content$1 = tw.div `
405
- ${p => (p.$inline ? tws `tu-alert__content--inline` : tws `tu-alert__content`)}
406
- `;
407
- const ContentDetails = tw.div `
408
- tu-alert__content-details
409
- `;
410
- const ContentBody = tw.div `
411
- tu-alert__content-body
412
- `;
413
- const Description = twx(Text$1) `
414
- ${p => (p.$hasTitle ? tws `tu-alert__description` : null)}
415
- `;
416
- const RightAligned = tw.div `
417
- tu-alert__right-aligned
418
- ${p => (p.$inline ? tws `tu-alert__right-aligned--inline` : null)}
419
- `;
420
- const IconContainer$1 = tw.div `
421
- tu-alert__icon-container
422
- ${p => (p.$inline ? tws `tu-alert__icon-container--inline` : null)}
423
- `;
451
+ const layout = inline ? "inline" : "default";
452
+ return (jsxs("div", Object.assign({ className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert" }, { children: [jsx("div", Object.assign({ className: cvaAlertIconContainer({ layout }) }, { children: getIconFromColor() })), jsxs("div", Object.assign({ className: cvaAlertContent({ layout }) }, { children: [jsxs("div", Object.assign({ className: cvaAlertDetails() }, { children: [jsx("div", Object.assign({ className: cvaAlertContentBody() }, { children: body })), onClose && !inline ? (jsx("div", Object.assign({ className: cvaAlertCloseButtonContainer({ layout }) }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })), (primaryAction || secondaryAction || onClose) && (jsxs("div", Object.assign({ className: cvaAlertRightAligned({ layout }) }, { children: [secondaryAction && (jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsx("div", Object.assign({ className: cvaAlertCloseButtonContainer({ layout }) }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
453
+ };
424
454
 
425
455
  /**
426
456
  * The Badge component is used to display a notification badge with an optional number value.
@@ -449,6 +479,58 @@ const StyledText$2 = tw.text `
449
479
  ${getBadgeModifierClass()}
450
480
  `;
451
481
 
482
+ const cvaCard = cvaMerge([
483
+ "flex",
484
+ "border",
485
+ "flex-col",
486
+ "relative",
487
+ "bg-white",
488
+ "component-card-shadow",
489
+ "component-card-border",
490
+ "transition-shadow",
491
+ "ease-in-out",
492
+ ], {
493
+ variants: {
494
+ clickable: {
495
+ false: "",
496
+ true: "cursor-pointer hover:shadow-md",
497
+ },
498
+ fullHeight: {
499
+ false: "",
500
+ true: "h-full",
501
+ },
502
+ },
503
+ defaultVariants: {
504
+ clickable: false,
505
+ fullHeight: false,
506
+ },
507
+ });
508
+ const cvaCardBody = cvaMerge(["flex-grow", "overflow-auto"]);
509
+ const cvaCardFooterDensityContainer = cvaMerge(["border-t-2", "border-neutral-200", "justify-end"], {
510
+ variants: {
511
+ border: {
512
+ default: "",
513
+ borderless: "border-t-0",
514
+ },
515
+ },
516
+ defaultVariants: {
517
+ border: "default",
518
+ },
519
+ });
520
+ const cvaCardHeader = cvaMerge(["flex", "justify-between"]);
521
+ const cvaCardHeaderHeadingContainer = cvaMerge(["flex", "gap-4", "items-center"]);
522
+ const cvaCardHeaderDensityContainer = cvaMerge(["border-b-2", "border-neutral-200"], {
523
+ variants: {
524
+ border: {
525
+ default: "",
526
+ borderless: "border-b-0",
527
+ },
528
+ },
529
+ defaultVariants: {
530
+ border: "default",
531
+ },
532
+ });
533
+
452
534
  const ROLE_CARD = "region";
453
535
  /**
454
536
  * The Card component is a container for UI elements, and is the main component of the modal.
@@ -458,28 +540,9 @@ const ROLE_CARD = "region";
458
540
  * @returns {JSX.Element} Card component
459
541
  */
460
542
  const Card = (_a) => {
461
- var { children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, overflow = "visible", gridArea } = _a, rest = __rest(_a, ["children", "onClick", "fullHeight", "onMouseEnter", "onMouseLeave", "className", "dataTestId", "overflow", "gridArea"]);
462
- return (jsx(StyledCard$2, Object.assign({}, rest, { "$fullHeight": fullHeight, "$overflow": overflow, onClick: onClick, className: className, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD, style: { gridArea } }, { children: children })));
463
- };
464
- const getOverflow$1 = () => ({ $overflow }) => {
465
- if (!$overflow) {
466
- return null;
467
- }
468
- const overflows = {
469
- visible: tws `overflow-visible`,
470
- hidden: tws `overflow-hidden`,
471
- scroll: tws `overflow-scroll`,
472
- auto: tws `overflow-auto`,
473
- };
474
- return overflows[$overflow];
475
- };
476
- const StyledCard$2 = tw.div `
477
- tu-card
478
- ${p => (p.$fullHeight ? `h-full` : null)}
479
-
480
- ${p => p.onClick && `tu-card--clickable`}
481
- ${getOverflow$1()}
482
- `;
543
+ var { children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, gridArea } = _a, rest = __rest(_a, ["children", "onClick", "fullHeight", "onMouseEnter", "onMouseLeave", "className", "dataTestId", "gridArea"]);
544
+ return (jsx("div", Object.assign({}, rest, { onClick: onClick, className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD, style: { gridArea } }, { children: children })));
545
+ };
483
546
 
484
547
  /**
485
548
  * The DensityContainer component applies gap and padding.
@@ -490,7 +553,7 @@ const StyledCard$2 = tw.div `
490
553
  * @returns {JSX.Element} DensityContainer component
491
554
  */
492
555
  const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
493
- return (jsx(StyledDensityContainer$1, Object.assign({ "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className }, { children: children })));
556
+ return (jsx(StyledDensityContainer, Object.assign({ "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className }, { children: children })));
494
557
  };
495
558
  const getDirection = () => ({ $direction }) => {
496
559
  $direction = $direction !== null && $direction !== void 0 ? $direction : "column";
@@ -522,7 +585,7 @@ const DensityFinder = ({ $density }) => {
522
585
  return densityAuto;
523
586
  }
524
587
  };
525
- const StyledDensityContainer$1 = tw.div `
588
+ const StyledDensityContainer = tw.div `
526
589
  flex
527
590
  ${getDirection()}
528
591
  ${p => (p.$disableGap ? tws `gap-0` : null)}
@@ -537,25 +600,9 @@ ${DensityFinder}
537
600
  * @param {CardBodyProps} props - The props for the CardBody component
538
601
  * @returns {JSX.Element} CardBody component
539
602
  */
540
- const CardBody = ({ density = "auto", overflow = "auto", children, dataTestId, className, disableGap, }) => {
541
- return (jsx(StyledDensityContainer, Object.assign({ "$overflow": overflow, density: density, dataTestId: dataTestId, className: className, disableGap: disableGap }, { children: children })));
542
- };
543
- const getOverflow = () => ({ $overflow }) => {
544
- if (!$overflow) {
545
- return null;
546
- }
547
- const overflows = {
548
- visible: tws `overflow-visible`,
549
- hidden: tws `overflow-hidden`,
550
- scroll: tws `overflow-scroll`,
551
- auto: tws `overflow-auto`,
552
- };
553
- return overflows[$overflow];
554
- };
555
- const StyledDensityContainer = twx(DensityContainer) `
556
- ${getOverflow()}
557
- tu-card__body
558
- `;
603
+ const CardBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
604
+ return (jsx(DensityContainer, Object.assign({ density: density, dataTestId: dataTestId, className: cvaCardBody({ className }), disableGap: disableGap }, { children: children })));
605
+ };
559
606
 
560
607
  /**
561
608
  * A simple footer intended to use with Cards and Modals.
@@ -566,12 +613,8 @@ const StyledDensityContainer = twx(DensityContainer) `
566
613
  * @returns {JSX.Element} CardFooter component
567
614
  */
568
615
  const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
569
- return (jsx(Container$5, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density, direction: "row" }, { children: children })));
570
- };
571
- const Container$5 = twx(DensityContainer) `
572
- tu-card__footer-density-container
573
- ${p => p.$hideSeparator && tws `tu-card__footer-density-container--borderless`}
574
- `;
616
+ return (jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardFooterDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, direction: "row" }, { children: children })));
617
+ };
575
618
 
576
619
  /**
577
620
  * The Heading is used for a heading of a section (h1,h2,h3,h4).
@@ -615,18 +658,37 @@ const StyledHeading = tw.div `
615
658
  * @returns {JSX.Element} CardHeader component
616
659
  */
617
660
  const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
618
- return (jsx(Root$5, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxs(Container$4, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs(HeadingContainer$1, { children: [jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), className: "!h-min" }))] }) })));
619
- };
620
- const Root$5 = twx(DensityContainer) `
621
- tu-card__header-density-container
622
- ${p => p.$hideSeparator && tws `tu-card__header-density-container--borderless`}
623
- `;
624
- const Container$4 = tw.div `
625
- tu-card__header
626
- `;
627
- const HeadingContainer$1 = tw.div `
628
- tu-card__header-heading-container
629
- `;
661
+ return (jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMarkIcon", size: "small" }), className: "!h-min" }))] })) })));
662
+ };
663
+
664
+ const cvaCollapse = cvaMerge([
665
+ "block",
666
+ "w-full",
667
+ "border-b",
668
+ "border-solid",
669
+ "border-neutral-100",
670
+ "pb-3",
671
+ "mb-4",
672
+ "last:border-0",
673
+ "last:m-0",
674
+ "only:border-0",
675
+ "only:m-0",
676
+ ]);
677
+ const cvaCollapseLabel = cvaMerge(["block", "w-full", "cursor-pointer"]);
678
+ const cvaCollapseLabelContainer = cvaMerge(["flex", "items-center", "justify-between"]);
679
+ cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
680
+ const cvaCollapseAnimated = cvaMerge(["overflow-y-hidden", "transition-all"]);
681
+ const cvaCollapseIcon = cvaMerge(["ease-in-out", "duration-200"], {
682
+ variants: {
683
+ expanded: {
684
+ false: "",
685
+ true: "rotate-180",
686
+ },
687
+ },
688
+ defaultVariants: {
689
+ expanded: false,
690
+ },
691
+ });
630
692
 
631
693
  /**
632
694
  * The Collapse component is used to condense non-important information.
@@ -642,31 +704,37 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
642
704
  }
643
705
  setExpanded(!expanded);
644
706
  }, [expanded, onToggle]);
645
- return (jsxs(StyledCollapse, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsx(CollapseLabel, Object.assign({ role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxs(LabelContainer, { children: [jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsx(IconButton, { icon: jsx(Rotate, { name: "ChevronDownIcon", size: "small", "$expanded": expanded }), size: "medium", variant: "transparent", color: "secondary" })] }) })), jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
707
+ return (jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsx(IconButton, { icon: jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] })) })), jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
646
708
  };
647
- const Rotate = twx(Icon) `
648
- ${p => (p.$expanded ? tws `tu-icon--animated-rotate-expanded` : null)}
649
- tu-icon--animated-rotate
650
- `;
651
- const StyledCollapse = tw.div `
652
- tu-collapse
653
- `;
654
- const CollapseLabel = tw.div `
655
- tu-collapse__label
656
- `;
657
- const LabelContainer = tw.div `
658
- tu-collapse__label__container
659
- `;
660
709
  const Collapsible = ({ children, expanded, id }) => {
661
710
  const [ref, { height }] = useMeasure();
662
- return (jsx(AnimatedCollapsible, Object.assign({ id: id, style: { height: expanded ? height : "0" } }, { children: jsx(StyledCollapsible, Object.assign({ ref: ref }, { children: children })) })));
663
- };
664
- const AnimatedCollapsible = tw.div `
665
- tu-collapsible--animated
666
- `;
667
- const StyledCollapsible = tw.div `
668
- tu-collapsible
669
- `;
711
+ return (jsx("div", Object.assign({ className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" } }, { children: jsx("div", Object.assign({ className: cvaCollapse(), ref: ref }, { children: children })) })));
712
+ };
713
+
714
+ const cvaCopyableText = cvaMerge([
715
+ "py-1",
716
+ "px-2",
717
+ "border",
718
+ "border-dashed",
719
+ "border-neutral-600",
720
+ "rounded",
721
+ "cursor-pointer",
722
+ "inline",
723
+ "transition-all",
724
+ "ease-in-out",
725
+ "leading-7",
726
+ "break-words",
727
+ ], {
728
+ variants: {
729
+ animating: {
730
+ false: "",
731
+ true: "animate-copy",
732
+ },
733
+ },
734
+ defaultVariants: {
735
+ animating: false,
736
+ },
737
+ });
670
738
 
671
739
  /**
672
740
  * The CopyableText component is used where the user should have easy access to copy information.
@@ -683,11 +751,8 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
683
751
  copyToClipboard(value);
684
752
  setAnimating(true);
685
753
  };
686
- return (jsx(StyledCopyableText, Object.assign({ className: className, "data-testid": dataTestId, onClick: handleOnClick, onAnimationEnd: () => setAnimating(false), "$animating": animating, title: value }, { children: text })));
687
- };
688
- const StyledCopyableText = tw.span `
689
- tu-copyable-text
690
- ${p => (p.$animating ? tws `tu-copyable-text--animating` : null)}`;
754
+ return (jsx("span", Object.assign({ className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onClick: handleOnClick, onAnimationEnd: () => setAnimating(false), title: value }, { children: text })));
755
+ };
691
756
 
692
757
  const localeLookup = {
693
758
  en: enGB,
@@ -2030,6 +2095,30 @@ const Bar = tw.rect `
2030
2095
  tu-value-bar__bar
2031
2096
  `;
2032
2097
 
2098
+ const cvaClickable = cvaMerge([
2099
+ "shadow-lg",
2100
+ "rounded-lg",
2101
+ "p-3",
2102
+ "bg-neutral-50",
2103
+ "transition-all",
2104
+ "border-2",
2105
+ "border-solid",
2106
+ "border-neutral-100",
2107
+ "cursor-pointer",
2108
+ "hover:border-primary-500",
2109
+ "hover:bg-primary-200",
2110
+ ], {
2111
+ variants: {
2112
+ disabled: {
2113
+ false: "",
2114
+ true: "cursor-default hover:border-neutral-100 hover:bg-neutral-50",
2115
+ },
2116
+ },
2117
+ defaultVariants: {
2118
+ disabled: false,
2119
+ },
2120
+ });
2121
+
2033
2122
  /**
2034
2123
  * The MinTopFullContentLayout component.
2035
2124
  *
@@ -2217,4 +2306,4 @@ const Layout = tw.div `
2217
2306
  tu-layout-TwoColumnLayout
2218
2307
  `;
2219
2308
 
2220
- export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, ContentGridArea, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator, IntrinsicallyResponsiveGrid, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, NavGridArea, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Tooltip, TwoColumnLayout, ValueBar, docs, getDevicePixelRatio, getValueBarColorByValue, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout };
2309
+ export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, ContentGridArea, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator, IntrinsicallyResponsiveGrid, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, NavGridArea, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Tooltip, TwoColumnLayout, ValueBar, cvaClickable, docs, getDevicePixelRatio, getValueBarColorByValue, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.108",
3
+ "version": "0.1.111",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@floating-ui/react": "0.22.2",
11
+ "@trackunit/css-class-variance-utilities": "0.0.5",
11
12
  "@trackunit/css-core": "0.0.85",
12
13
  "@trackunit/tailwind-styled-components": "0.0.57",
13
14
  "@trackunit/ui-design-tokens": "0.0.69",
@@ -0,0 +1,18 @@
1
+ export declare const cvaAlert: (props?: ({
2
+ color?: "danger" | "warning" | "success" | "info" | null | undefined;
3
+ layout?: "default" | "inline" | null | undefined;
4
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
+ export declare const cvaAlertDetails: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
+ export declare const cvaAlertContentBody: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
+ export declare const cvaAlertRightAligned: (props?: ({
8
+ layout?: "default" | "inline" | null | undefined;
9
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
+ export declare const cvaAlertContent: (props?: ({
11
+ layout?: "default" | "inline" | null | undefined;
12
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
13
+ export declare const cvaAlertCloseButtonContainer: (props?: ({
14
+ layout?: "default" | "inline" | null | undefined;
15
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
16
+ export declare const cvaAlertIconContainer: (props?: ({
17
+ layout?: "default" | "inline" | null | undefined;
18
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,16 +1,11 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  export declare const ROLE_CARD = "region";
4
- type Overflow = "visible" | "hidden" | "scroll" | "auto";
5
4
  export interface CardProps extends CommonProps, React.InputHTMLAttributes<HTMLDivElement> {
6
5
  /**
7
6
  * Whether the card should have full height or not.
8
7
  */
9
8
  fullHeight?: boolean;
10
- /**
11
- * Whether the card should overflow contents.
12
- */
13
- overflow?: Overflow;
14
9
  /**
15
10
  * The css grid area to place the card.
16
11
  *
@@ -41,5 +36,4 @@ export interface CardProps extends CommonProps, React.InputHTMLAttributes<HTMLDi
41
36
  * @param {CardProps} props - The props for the Card component
42
37
  * @returns {JSX.Element} Card component
43
38
  */
44
- export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, overflow, gridArea, ...rest }: CardProps) => JSX.Element;
45
- export {};
39
+ export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, gridArea, ...rest }: CardProps) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ export declare const cvaCard: (props?: ({
2
+ clickable?: boolean | null | undefined;
3
+ fullHeight?: boolean | null | undefined;
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
+ export declare const cvaCardFooterDensityContainer: (props?: ({
7
+ border?: "default" | "borderless" | null | undefined;
8
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
9
+ export declare const cvaCardHeader: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
10
+ export declare const cvaCardHeaderHeadingContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
11
+ export declare const cvaCardHeaderDensityContainer: (props?: ({
12
+ border?: "default" | "borderless" | null | undefined;
13
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,12 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps, Density } from "../../common/CommonProps";
3
- type Overflow = "visible" | "hidden" | "scroll" | "auto" | "inherit";
4
3
  export interface CardBodyProps extends CommonProps {
5
- /**
6
- * Tells the body how to handle overflowing elements.
7
- * Directly mapped to the overflow css property.
8
- */
9
- overflow?: Overflow;
10
4
  /**
11
5
  * Sets gap, padding and margin.
12
6
  */
@@ -28,5 +22,4 @@ export interface CardBodyProps extends CommonProps {
28
22
  * @param {CardBodyProps} props - The props for the CardBody component
29
23
  * @returns {JSX.Element} CardBody component
30
24
  */
31
- export declare const CardBody: ({ density, overflow, children, dataTestId, className, disableGap, }: CardBodyProps) => JSX.Element;
32
- export {};
25
+ export declare const CardBody: ({ density, children, dataTestId, className, disableGap }: CardBodyProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const cvaClickable: (props?: ({
2
+ disabled?: boolean | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,8 @@
1
+ export declare const cvaCollapse: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
+ export declare const cvaCollapseLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaCollapseLabelContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
4
+ export declare const cvaCollapsible: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
5
+ export declare const cvaCollapseAnimated: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
+ export declare const cvaCollapseIcon: (props?: ({
7
+ expanded?: boolean | null | undefined;
8
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,3 @@
1
+ export declare const cvaCopyableText: (props?: ({
2
+ animating?: boolean | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
package/src/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./common";
2
2
  export * from "./components";
3
+ export * from "./components/Clickable/Clickable.variants";
3
4
  export * from "./hooks";
4
5
  export * from "./layout";