@televet/kibble-ui 1.17.5 → 1.17.6-beta.43w39py.1

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.
@@ -1,11 +1,13 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { AlertProps as CAlertProps } from '@chakra-ui/react';
3
3
  import { IconProps } from 'components/MediaAndIcons';
4
4
  import { AlertVariant } from './alert.types';
5
5
  import { ButtonProps } from 'components/Forms/Button';
6
6
  import { TextProps } from 'components/Typography/Text';
7
7
  import { Status } from '../feedback.types';
8
+ import { HeadingProps } from '../../Typography';
8
9
  export interface AlertProps extends CAlertProps {
10
+ children?: ReactNode;
9
11
  status?: AlertVariant | Status;
10
12
  showIcon?: boolean;
11
13
  iconProps?: IconProps;
@@ -13,10 +15,10 @@ export interface AlertProps extends CAlertProps {
13
15
  buttonProps?: ButtonProps;
14
16
  buttonTitle?: string;
15
17
  alertTitle: string;
16
- titleProps?: TextProps;
18
+ titleProps?: HeadingProps;
17
19
  description?: string;
18
20
  descriptionProps?: TextProps;
19
21
  showCloseButton?: boolean;
20
22
  onClose?: React.MouseEventHandler<HTMLButtonElement>;
21
23
  }
22
- export declare const Alert: ({ status, showIcon, iconProps, showButton, buttonProps, buttonTitle, alertTitle, titleProps, description, descriptionProps, showCloseButton, onClose, ...rest }: AlertProps) => JSX.Element;
24
+ export declare const Alert: ({ children, status, showIcon, iconProps, showButton, buttonProps, buttonTitle, alertTitle, titleProps, description, descriptionProps, showCloseButton, onClose, ...rest }: AlertProps) => JSX.Element;
@@ -1,5 +1,4 @@
1
1
  export { Alert as CAlert } from '@chakra-ui/react';
2
- export * from './components/AlertButton/alertButton.component';
3
2
  export * from './components/AlertIcon/alertIcon.component';
4
3
  export * from './alert.component';
5
4
  export * from './alert.types';
@@ -0,0 +1,3 @@
1
+ import { Status } from './feedback.types';
2
+ export declare const LightStatusVariantMap: Record<Status, string>;
3
+ export declare const DarkStatusVariantMap: Record<Status, string>;
@@ -1,3 +1,5 @@
1
1
  export * from './Alert';
2
2
  export * from './Toast';
3
3
  export * from './Spinner';
4
+ export * from './feedback.types';
5
+ export * from './feedback.model';
@@ -1,2 +1,4 @@
1
1
  export * from './useTheme';
2
2
  export * from './useDisclosure';
3
+ export * from './useAdaptiveColor';
4
+ export * from './useAdaptiveColorMap';
package/build/index.js CHANGED
@@ -572,6 +572,10 @@ var TagConfig = {
572
572
 
573
573
  var useTheme = function () { return react.useTheme(); };
574
574
 
575
+ var useAdaptiveColor = function (color) { return react.useColorModeValue(color.light, color.dark); };
576
+
577
+ var useAdaptiveColorMap = function (map, token, darkMode) { return react.useColorModeValue(map[darkMode ? 'dark' : 'light'][token], map.dark[token]); };
578
+
575
579
  exports.NotificationCounterVariant = void 0;
576
580
  (function (NotificationCounterVariant) {
577
581
  NotificationCounterVariant["Red"] = "red";
@@ -1576,8 +1580,6 @@ var IconSizeMap$1 = {
1576
1580
  '2xl': 38,
1577
1581
  };
1578
1582
 
1579
- var useAdaptiveColorMap = function (map, token, darkMode) { return react.useColorModeValue(map[darkMode ? 'dark' : 'light'][token], map.dark[token]); };
1580
-
1581
1583
  var Icon = React.forwardRef(function (_a, ref) {
1582
1584
  var name = _a.name, _b = _a.size, size = _b === void 0 ? 'lg' : _b, _c = _a.color, color = _c === void 0 ? 'currentColor' : _c;
1583
1585
  var colors = useTheme().colors;
@@ -1588,7 +1590,32 @@ var Icon = React.forwardRef(function (_a, ref) {
1588
1590
  });
1589
1591
  Icon.displayName = 'Icon';
1590
1592
 
1591
- var useAdaptiveColor = function (color) { return react.useColorModeValue(color.light, color.dark); };
1593
+ var AlertIconColorMap = {
1594
+ info: 'active',
1595
+ success: 'success',
1596
+ error: 'error',
1597
+ warning: 'warning',
1598
+ };
1599
+ var AlertIcon = function (_a) {
1600
+ var status = _a.status, rest = __rest(_a, ["status"]);
1601
+ var color = react.useColorModeValue(AlertIconColorMap[status], 'currentColor');
1602
+ return React__default["default"].createElement(Icon, __assign({ color: color, size: "lg" }, rest));
1603
+ };
1604
+
1605
+ exports.AlertVariant = void 0;
1606
+ (function (AlertVariant) {
1607
+ AlertVariant["Error"] = "error";
1608
+ AlertVariant["Warning"] = "warning";
1609
+ AlertVariant["Success"] = "success";
1610
+ AlertVariant["Info"] = "info";
1611
+ })(exports.AlertVariant || (exports.AlertVariant = {}));
1612
+ exports.AlertStatusIcon = void 0;
1613
+ (function (AlertStatusIcon) {
1614
+ AlertStatusIcon["error"] = "warningSign";
1615
+ AlertStatusIcon["warning"] = "warningSign";
1616
+ AlertStatusIcon["success"] = "checkmark";
1617
+ AlertStatusIcon["info"] = "infoCircleOutlined";
1618
+ })(exports.AlertStatusIcon || (exports.AlertStatusIcon = {}));
1592
1619
 
1593
1620
  var camelCaseToLabel = function (s) {
1594
1621
  return s.replace(/([A-Z])/g, ' $1').replace(/^\w/, function (c) { return c.toUpperCase(); });
@@ -3493,38 +3520,6 @@ var ButtonSizeConfig = {
3493
3520
  },
3494
3521
  };
3495
3522
 
3496
- var AlertButton = function (_a) {
3497
- var alignment = _a.alignment, _b = _a.variant, variant = _b === void 0 ? 'secondary' : _b, _c = _a.size, size = _c === void 0 ? 'xs' : _c, _d = _a.pairedWithCloseButton, pairedWithCloseButton = _d === void 0 ? false : _d, rest = __rest(_a, ["alignment", "variant", "size", "pairedWithCloseButton"]);
3498
- return (React__default["default"].createElement(Button, __assign({ size: size, variant: variant }, rest, (alignment === 'bottom' && { mt: 2, mb: 1 }), (alignment === 'right' && pairedWithCloseButton && { mr: 2 })), rest.children));
3499
- };
3500
-
3501
- var AlertIconColorMap = {
3502
- info: 'active',
3503
- success: 'success',
3504
- error: 'error',
3505
- warning: 'warning',
3506
- };
3507
- var AlertIcon = function (_a) {
3508
- var status = _a.status, rest = __rest(_a, ["status"]);
3509
- var color = react.useColorModeValue(AlertIconColorMap[status], 'currentColor');
3510
- return React__default["default"].createElement(Icon, __assign({ color: color, size: "lg" }, rest));
3511
- };
3512
-
3513
- exports.AlertVariant = void 0;
3514
- (function (AlertVariant) {
3515
- AlertVariant["Error"] = "error";
3516
- AlertVariant["Warning"] = "warning";
3517
- AlertVariant["Success"] = "success";
3518
- AlertVariant["Info"] = "info";
3519
- })(exports.AlertVariant || (exports.AlertVariant = {}));
3520
- exports.AlertStatusIcon = void 0;
3521
- (function (AlertStatusIcon) {
3522
- AlertStatusIcon["error"] = "warningSign";
3523
- AlertStatusIcon["warning"] = "warningSign";
3524
- AlertStatusIcon["success"] = "checkmark";
3525
- AlertStatusIcon["info"] = "infoCircleOutlined";
3526
- })(exports.AlertStatusIcon || (exports.AlertStatusIcon = {}));
3527
-
3528
3523
  var Text = function (_a) {
3529
3524
  var children = _a.children, _b = _a.variant, variant = _b === void 0 ? 'regular' : _b, _c = _a.as, as = _c === void 0 ? 'span' : _c, color = _a.color, _d = _a.colorToken, colorToken = _d === void 0 ? 'default' : _d, _e = _a.darkMode, darkMode = _e === void 0 ? false : _e, rest = __rest(_a, ["children", "variant", "as", "color", "colorToken", "darkMode"]);
3530
3525
  var colors = useTheme().colors;
@@ -3585,70 +3580,161 @@ var TextConfig = {
3585
3580
  },
3586
3581
  };
3587
3582
 
3588
- function useWindowSize() {
3589
- // Initialize state with undefined width/height so server and client renders match
3590
- // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
3591
- var _a = __read(React.useState({
3592
- width: undefined,
3593
- height: undefined,
3594
- }), 2), windowSize = _a[0], setWindowSize = _a[1];
3595
- React.useEffect(function () {
3596
- // Handler to call on window resize
3597
- function handleResize() {
3598
- // Set window width/height to state
3599
- setWindowSize({
3600
- width: window.innerWidth,
3601
- height: window.innerHeight,
3602
- });
3603
- }
3604
- // Add event listener
3605
- window.addEventListener('resize', handleResize);
3606
- // Call handler right away so state gets updated with initial window size
3607
- handleResize();
3608
- // Remove event listener on cleanup
3609
- return function () { return window.removeEventListener('resize', handleResize); };
3610
- }, []); // Empty array ensures that effect is only run on mount
3611
- return windowSize;
3612
- }
3613
-
3614
- var useOverflowingText = function (text, textRef) {
3615
- var size = useWindowSize();
3616
- var _a = __read(React.useState(false), 2), isTextOverFlowing = _a[0], setIsTextOverFlowing = _a[1];
3583
+ var Heading = function (_a) {
3584
+ var children = _a.children, _b = _a.size, size = _b === void 0 ? 'lg' : _b, color = _a.color, _c = _a.colorToken, colorToken = _c === void 0 ? 'headline' : _c, _d = _a.darkMode, darkMode = _d === void 0 ? false : _d, rest = __rest(_a, ["children", "size", "color", "colorToken", "darkMode"]);
3585
+ var _e = useTheme(), components = _e.components, colors = _e.colors;
3586
+ var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
3587
+ var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
3588
+ var sizes = components.Heading.variants[variant].sizes;
3589
+ var sizeProps = !sizes ? undefined : sizes[size];
3590
+ return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
3591
+ };
3592
+
3593
+ var HeadingConfig = {
3594
+ variants: {
3595
+ large: {
3596
+ sizes: {
3597
+ xs: {
3598
+ fontSize: '14px',
3599
+ lineHeight: '120%',
3600
+ fontWeight: fontWeights.semibold,
3601
+ },
3602
+ sm: {
3603
+ fontSize: '16px',
3604
+ lineHeight: '120%',
3605
+ fontWeight: fontWeights.semibold,
3606
+ },
3607
+ md: {
3608
+ fontSize: '20px',
3609
+ lineHeight: '120%',
3610
+ fontWeight: fontWeights.semibold,
3611
+ },
3612
+ lg: {
3613
+ fontSize: '30px',
3614
+ lineHeight: '133%',
3615
+ fontWeight: fontWeights.semibold,
3616
+ },
3617
+ xl: {
3618
+ fontSize: '36px',
3619
+ lineHeight: '133%',
3620
+ fontWeight: fontWeights.semibold,
3621
+ },
3622
+ '2xl': {
3623
+ fontSize: '48px',
3624
+ lineHeight: '120%',
3625
+ fontWeight: fontWeights.semibold,
3626
+ },
3627
+ '3xl': {
3628
+ fontSize: '60px',
3629
+ lineHeight: '100%',
3630
+ fontWeight: fontWeights.semibold,
3631
+ },
3632
+ '4xl': {
3633
+ fontSize: '72px',
3634
+ lineHeight: '100%',
3635
+ fontWeight: fontWeights.semibold,
3636
+ },
3637
+ },
3638
+ },
3639
+ small: {
3640
+ sizes: {
3641
+ xs: {
3642
+ fontSize: '14px',
3643
+ lineHeight: '120%',
3644
+ fontWeight: fontWeights.semibold,
3645
+ },
3646
+ sm: {
3647
+ fontSize: '16px',
3648
+ lineHeight: '120%',
3649
+ fontWeight: fontWeights.semibold,
3650
+ },
3651
+ md: {
3652
+ fontSize: '20px',
3653
+ lineHeight: '120%',
3654
+ fontWeight: fontWeights.semibold,
3655
+ },
3656
+ lg: {
3657
+ fontSize: '24px',
3658
+ lineHeight: '133%',
3659
+ fontWeight: fontWeights.semibold,
3660
+ },
3661
+ xl: {
3662
+ fontSize: '30px',
3663
+ lineHeight: '133%',
3664
+ fontWeight: fontWeights.semibold,
3665
+ },
3666
+ '2xl': {
3667
+ fontSize: '36px',
3668
+ lineHeight: '120%',
3669
+ fontWeight: fontWeights.semibold,
3670
+ },
3671
+ '3xl': {
3672
+ fontSize: '48px',
3673
+ lineHeight: '100%',
3674
+ fontWeight: fontWeights.semibold,
3675
+ },
3676
+ '4xl': {
3677
+ fontSize: '60px',
3678
+ lineHeight: '100%',
3679
+ fontWeight: fontWeights.semibold,
3680
+ },
3681
+ },
3682
+ },
3683
+ },
3684
+ };
3685
+
3686
+ var TruncatedText = function (_a) {
3687
+ var _b = _a.noOfLines, noOfLines = _b === void 0 ? 1 : _b, textContent = _a.textContent, placement = _a.placement, titleCaseTooltipLabel = _a.titleCaseTooltipLabel, rest = __rest(_a, ["noOfLines", "textContent", "placement", "titleCaseTooltipLabel"]);
3688
+ var _c = __read(React.useState(false), 2), isTextOverFlowing = _c[0], setIsTextOverFlowing = _c[1];
3689
+ var containerRef = React.useRef(null);
3617
3690
  var onCheckTextOverFlowing = React.useCallback(function (containerRefValue) {
3618
- var _a;
3691
+ var _a, _b;
3619
3692
  if (containerRefValue && containerRefValue.current) {
3620
- var lines = (_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].getClientRects().length;
3621
- return lines > 1;
3693
+ var textScrollHeight = ((_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].scrollHeight) || 0;
3694
+ var containerOffsetHeight = ((_b = containerRefValue.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
3695
+ return textScrollHeight > containerOffsetHeight;
3622
3696
  }
3623
3697
  return false;
3624
3698
  }, []);
3625
3699
  React.useEffect(function () {
3626
- // if size of window changes, or if title length changes, check if text is overflowing
3627
- var isOverFlowing = onCheckTextOverFlowing(textRef);
3628
- setIsTextOverFlowing(isOverFlowing);
3629
- }, [size, text, onCheckTextOverFlowing, textRef]);
3630
- return isTextOverFlowing;
3700
+ var checkValue = onCheckTextOverFlowing(containerRef);
3701
+ setIsTextOverFlowing(checkValue);
3702
+ }, [containerRef, onCheckTextOverFlowing]);
3703
+ return (React__default["default"].createElement(react.Box, { ref: containerRef, className: "TruncatedText__Wrapper" },
3704
+ React__default["default"].createElement(Tooltip, { className: "TruncatedText__Tooltip", label: textContent || '', isDisabled: !isTextOverFlowing, placement: placement, titleCaseLabel: titleCaseTooltipLabel },
3705
+ React__default["default"].createElement(react.Text, __assign({ className: "TruncatedText__TextContent", noOfLines: noOfLines, as: "p" }, rest), textContent))));
3706
+ };
3707
+
3708
+ var LightStatusVariantMap = {
3709
+ info: 'info',
3710
+ success: 'success',
3711
+ warning: 'warning',
3712
+ error: 'error',
3713
+ };
3714
+ var DarkStatusVariantMap = {
3715
+ info: 'infoDark',
3716
+ success: 'successDark',
3717
+ warning: 'warningDark',
3718
+ error: 'errorDark',
3631
3719
  };
3632
3720
 
3633
3721
  var Alert = function (_a) {
3634
- var _b = _a.status, status = _b === void 0 ? exports.AlertVariant.Success : _b, _c = _a.showIcon, showIcon = _c === void 0 ? true : _c, iconProps = _a.iconProps, _d = _a.showButton, showButton = _d === void 0 ? false : _d, buttonProps = _a.buttonProps, buttonTitle = _a.buttonTitle, alertTitle = _a.alertTitle, titleProps = _a.titleProps, description = _a.description, descriptionProps = _a.descriptionProps, _e = _a.showCloseButton, showCloseButton = _e === void 0 ? true : _e, onClose = _a.onClose, rest = __rest(_a, ["status", "showIcon", "iconProps", "showButton", "buttonProps", "buttonTitle", "alertTitle", "titleProps", "description", "descriptionProps", "showCloseButton", "onClose"]);
3635
- var titleRef = React.useRef(null);
3636
- var isTitleOverflowing = useOverflowingText(alertTitle, titleRef);
3637
- var showButtonInline = showButton && !description && !isTitleOverflowing;
3638
- var showButtonBottom = (showButton && description) || (showButton && !description && isTitleOverflowing);
3639
- return (React__default["default"].createElement(react.Alert, __assign({ justifyContent: "space-between", overflow: "visible", variant: status, pl: 3, pr: showCloseButton ? 2 : 3 }, rest),
3640
- React__default["default"].createElement(react.HStack, { justifyContent: "space-between", w: "100%" },
3641
- showIcon && (React__default["default"].createElement(react.Flex, { alignSelf: "flex-start" },
3722
+ var children = _a.children, _b = _a.status, status = _b === void 0 ? exports.AlertVariant.Success : _b, _c = _a.showIcon, showIcon = _c === void 0 ? true : _c, iconProps = _a.iconProps, _d = _a.showButton, showButton = _d === void 0 ? false : _d, buttonProps = _a.buttonProps, buttonTitle = _a.buttonTitle, alertTitle = _a.alertTitle, titleProps = _a.titleProps, description = _a.description, descriptionProps = _a.descriptionProps, _e = _a.showCloseButton, showCloseButton = _e === void 0 ? true : _e, onClose = _a.onClose, rest = __rest(_a, ["children", "status", "showIcon", "iconProps", "showButton", "buttonProps", "buttonTitle", "alertTitle", "titleProps", "description", "descriptionProps", "showCloseButton", "onClose"]);
3723
+ var variant = react.useColorModeValue(LightStatusVariantMap[status], DarkStatusVariantMap[status]);
3724
+ return (React__default["default"].createElement(react.Alert, __assign({ justifyContent: "space-between", overflow: "visible", variant: variant, pl: 3, pr: showCloseButton ? 2 : 3 }, rest),
3725
+ React__default["default"].createElement(react.Flex, { w: "100%" },
3726
+ showIcon && (React__default["default"].createElement(react.Box, { mr: 2 },
3642
3727
  React__default["default"].createElement(AlertIcon, __assign({ status: status, name: (iconProps === null || iconProps === void 0 ? void 0 : iconProps.name) || exports.AlertStatusIcon[status] }, iconProps)))),
3643
- React__default["default"].createElement(react.Flex, __assign({ width: "100%", flexDirection: "column" }, (showIcon && { ml: 2 })),
3644
- React__default["default"].createElement(react.Flex, { alignItems: "flex-start", w: "100%", justifyContent: "space-between" },
3645
- React__default["default"].createElement(react.Box, { ref: titleRef, mr: showButtonInline || showCloseButton ? 2 : 0 },
3646
- React__default["default"].createElement(Text, __assign({ size: "md", variant: "semibold" }, titleProps), alertTitle)),
3647
- React__default["default"].createElement(react.Flex, { alignItems: "center" },
3648
- showButtonInline && (React__default["default"].createElement(AlertButton, __assign({ alignment: "right" }, buttonProps, { pairedWithCloseButton: showCloseButton }), buttonTitle)),
3649
- showCloseButton && React__default["default"].createElement(Button, { variant: "ghostNeutral", iconName: "close", size: "xs", onClick: onClose }))),
3650
- description && (React__default["default"].createElement(Text, __assign({ size: "md" }, descriptionProps), description)),
3651
- React__default["default"].createElement(react.Box, null, showButtonBottom && (React__default["default"].createElement(AlertButton, __assign({ alignment: "bottom" }, buttonProps), buttonTitle)))))));
3728
+ React__default["default"].createElement(react.Flex, { flexGrow: 1 },
3729
+ React__default["default"].createElement(react.Flex, { alignItems: "flex-start", flexDirection: description ? 'column' : 'row', flexWrap: "wrap", w: "100%", justify: "space-between", align: "center" },
3730
+ React__default["default"].createElement(react.Box, { pt: 0.5, pr: 1, flexGrow: 1 },
3731
+ React__default["default"].createElement(Heading, __assign({ size: "sm", colorToken: "default" }, titleProps), alertTitle)),
3732
+ description && (React__default["default"].createElement(react.Box, { flexGrow: 1, pb: 2 },
3733
+ React__default["default"].createElement(Text, __assign({ as: "p", size: "md" }, descriptionProps), description))),
3734
+ children,
3735
+ showButton && (React__default["default"].createElement(Button, __assign({ size: "xs", variant: "secondary" }, buttonProps), buttonTitle)))),
3736
+ showCloseButton && (React__default["default"].createElement(react.Box, { ml: 2 },
3737
+ React__default["default"].createElement(Button, { variant: "ghostNeutral", iconName: "close", size: "xs", onClick: onClose }))))));
3652
3738
  };
3653
3739
 
3654
3740
  var AlertConfig = {
@@ -14228,17 +14314,11 @@ function getToastPlacement(position, dir) {
14228
14314
  return (_a = logical === null || logical === void 0 ? void 0 : logical[dir]) !== null && _a !== void 0 ? _a : position;
14229
14315
  }
14230
14316
 
14231
- var StatusVariantMap = {
14232
- info: 'infoDark',
14233
- success: 'successDark',
14234
- warning: 'warningDark',
14235
- error: 'errorDark',
14236
- };
14237
14317
  var Toast = function (props) {
14238
14318
  var _a = props.status, status = _a === void 0 ? 'info' : _a, id = props.id, title = props.title, isClosable = props.isClosable, onClose = props.onClose, description = props.description, buttonTitle = props.buttonTitle, onButtonClick = props.onButtonClick, _b = props.hideIcon, hideIcon = _b === void 0 ? false : _b;
14239
14319
  var buttonProps = { onClick: onButtonClick };
14240
14320
  return (React__namespace.createElement(react.DarkMode, null,
14241
- React__namespace.createElement(Alert, { id: id, alertTitle: title, buttonTitle: buttonTitle, description: description, showIcon: !hideIcon, status: status, showCloseButton: isClosable, onClose: onClose, variant: StatusVariantMap[status], showButton: !!onButtonClick && !!buttonTitle, buttonProps: buttonProps })));
14321
+ React__namespace.createElement(Alert, { id: id, alertTitle: title, buttonTitle: buttonTitle, description: description, showIcon: !hideIcon, status: status, showCloseButton: isClosable, onClose: onClose, variant: DarkStatusVariantMap[status], showButton: !!onButtonClick && !!buttonTitle, buttonProps: buttonProps })));
14242
14322
  };
14243
14323
  var defaults = {
14244
14324
  title: '',
@@ -14809,131 +14889,6 @@ var RatingDot = function (_a) {
14809
14889
  } }, number))) : (React__default["default"].createElement(react.Flex, { as: "div", bgColor: colors.background.brand, h: "40px", w: "40px", borderRadius: "20px", border: "2px solid ".concat(colors.background.brand), color: colors.text.dark.default, mr: 1, mb: 1, justifyContent: "center", alignItems: "center", fontSize: "lg", cursor: "default" }, number))));
14810
14890
  };
14811
14891
 
14812
- var Heading = function (_a) {
14813
- var children = _a.children, _b = _a.size, size = _b === void 0 ? 'lg' : _b, color = _a.color, _c = _a.colorToken, colorToken = _c === void 0 ? 'headline' : _c, _d = _a.darkMode, darkMode = _d === void 0 ? false : _d, rest = __rest(_a, ["children", "size", "color", "colorToken", "darkMode"]);
14814
- var _e = useTheme(), components = _e.components, colors = _e.colors;
14815
- var adaptiveColor = useAdaptiveColorMap(colors.text, colorToken, darkMode);
14816
- var variant = react.useBreakpointValue({ base: 'small', md: 'large' }) || 'small';
14817
- var sizes = components.Heading.variants[variant].sizes;
14818
- var sizeProps = !sizes ? undefined : sizes[size];
14819
- return (React__default["default"].createElement(react.Heading, __assign({ variant: variant }, sizeProps, { color: color || adaptiveColor }, rest), children));
14820
- };
14821
-
14822
- var HeadingConfig = {
14823
- variants: {
14824
- large: {
14825
- sizes: {
14826
- xs: {
14827
- fontSize: '14px',
14828
- lineHeight: '120%',
14829
- fontWeight: fontWeights.semibold,
14830
- },
14831
- sm: {
14832
- fontSize: '16px',
14833
- lineHeight: '120%',
14834
- fontWeight: fontWeights.semibold,
14835
- },
14836
- md: {
14837
- fontSize: '20px',
14838
- lineHeight: '120%',
14839
- fontWeight: fontWeights.semibold,
14840
- },
14841
- lg: {
14842
- fontSize: '30px',
14843
- lineHeight: '133%',
14844
- fontWeight: fontWeights.semibold,
14845
- },
14846
- xl: {
14847
- fontSize: '36px',
14848
- lineHeight: '133%',
14849
- fontWeight: fontWeights.semibold,
14850
- },
14851
- '2xl': {
14852
- fontSize: '48px',
14853
- lineHeight: '120%',
14854
- fontWeight: fontWeights.semibold,
14855
- },
14856
- '3xl': {
14857
- fontSize: '60px',
14858
- lineHeight: '100%',
14859
- fontWeight: fontWeights.semibold,
14860
- },
14861
- '4xl': {
14862
- fontSize: '72px',
14863
- lineHeight: '100%',
14864
- fontWeight: fontWeights.semibold,
14865
- },
14866
- },
14867
- },
14868
- small: {
14869
- sizes: {
14870
- xs: {
14871
- fontSize: '14px',
14872
- lineHeight: '120%',
14873
- fontWeight: fontWeights.semibold,
14874
- },
14875
- sm: {
14876
- fontSize: '16px',
14877
- lineHeight: '120%',
14878
- fontWeight: fontWeights.semibold,
14879
- },
14880
- md: {
14881
- fontSize: '20px',
14882
- lineHeight: '120%',
14883
- fontWeight: fontWeights.semibold,
14884
- },
14885
- lg: {
14886
- fontSize: '24px',
14887
- lineHeight: '133%',
14888
- fontWeight: fontWeights.semibold,
14889
- },
14890
- xl: {
14891
- fontSize: '30px',
14892
- lineHeight: '133%',
14893
- fontWeight: fontWeights.semibold,
14894
- },
14895
- '2xl': {
14896
- fontSize: '36px',
14897
- lineHeight: '120%',
14898
- fontWeight: fontWeights.semibold,
14899
- },
14900
- '3xl': {
14901
- fontSize: '48px',
14902
- lineHeight: '100%',
14903
- fontWeight: fontWeights.semibold,
14904
- },
14905
- '4xl': {
14906
- fontSize: '60px',
14907
- lineHeight: '100%',
14908
- fontWeight: fontWeights.semibold,
14909
- },
14910
- },
14911
- },
14912
- },
14913
- };
14914
-
14915
- var TruncatedText = function (_a) {
14916
- var _b = _a.noOfLines, noOfLines = _b === void 0 ? 1 : _b, textContent = _a.textContent, placement = _a.placement, titleCaseTooltipLabel = _a.titleCaseTooltipLabel, rest = __rest(_a, ["noOfLines", "textContent", "placement", "titleCaseTooltipLabel"]);
14917
- var _c = __read(React.useState(false), 2), isTextOverFlowing = _c[0], setIsTextOverFlowing = _c[1];
14918
- var containerRef = React.useRef(null);
14919
- var onCheckTextOverFlowing = React.useCallback(function (containerRefValue) {
14920
- var _a, _b;
14921
- if (containerRefValue && containerRefValue.current) {
14922
- var textScrollHeight = ((_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].scrollHeight) || 0;
14923
- var containerOffsetHeight = ((_b = containerRefValue.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
14924
- return textScrollHeight > containerOffsetHeight;
14925
- }
14926
- return false;
14927
- }, []);
14928
- React.useEffect(function () {
14929
- var checkValue = onCheckTextOverFlowing(containerRef);
14930
- setIsTextOverFlowing(checkValue);
14931
- }, [containerRef, onCheckTextOverFlowing]);
14932
- return (React__default["default"].createElement(react.Box, { ref: containerRef, className: "TruncatedText__Wrapper" },
14933
- React__default["default"].createElement(Tooltip, { className: "TruncatedText__Tooltip", label: textContent || '', isDisabled: !isTextOverFlowing, placement: placement, titleCaseLabel: titleCaseTooltipLabel },
14934
- React__default["default"].createElement(react.Text, __assign({ className: "TruncatedText__TextContent", noOfLines: noOfLines, as: "p" }, rest), textContent))));
14935
- };
14936
-
14937
14892
  var RatingDots = function (_a) {
14938
14893
  var minValue = _a.minValue, maxValue = _a.maxValue, minLabel = _a.minLabel, maxLabel = _a.maxLabel, centeredLabel = _a.centeredLabel, isDisabled = _a.isDisabled, isInteractive = _a.isInteractive, onClick = _a.onClick, selected = _a.selected;
14939
14894
  var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
@@ -24585,7 +24540,6 @@ Object.defineProperty(exports, 'useRadioGroup', {
24585
24540
  get: function () { return react.useRadioGroup; }
24586
24541
  });
24587
24542
  exports.Alert = Alert;
24588
- exports.AlertButton = AlertButton;
24589
24543
  exports.AlertConfig = AlertConfig;
24590
24544
  exports.AlertIcon = AlertIcon;
24591
24545
  exports.Avatar = Avatar;
@@ -24599,6 +24553,7 @@ exports.ButtonVariantConfig = ButtonVariantConfig;
24599
24553
  exports.Checkbox = Checkbox;
24600
24554
  exports.CheckboxConfig = CheckboxConfig;
24601
24555
  exports.CheckboxGroup = WrappedCheckboxGroup;
24556
+ exports.DarkStatusVariantMap = DarkStatusVariantMap;
24602
24557
  exports.DatePicker = DatePicker;
24603
24558
  exports.DatePickerContext = DatePickerContext;
24604
24559
  exports.DrawerConfig = DrawerConfig;
@@ -24606,6 +24561,7 @@ exports.Heading = Heading;
24606
24561
  exports.HeadingConfig = HeadingConfig;
24607
24562
  exports.Icon = Icon;
24608
24563
  exports.KibbleThemeProvider = KibbleThemeProvider;
24564
+ exports.LightStatusVariantMap = LightStatusVariantMap;
24609
24565
  exports.Logo = Logo;
24610
24566
  exports.MenuConfig = MenuConfig;
24611
24567
  exports.MenuContext = MenuContext;
@@ -24652,6 +24608,8 @@ exports.TruncatedText = TruncatedText;
24652
24608
  exports.createStandaloneToast = createStandaloneToast;
24653
24609
  exports.defaultStandaloneParam = defaultStandaloneParam;
24654
24610
  exports.theme = theme;
24611
+ exports.useAdaptiveColor = useAdaptiveColor;
24612
+ exports.useAdaptiveColorMap = useAdaptiveColorMap;
24655
24613
  exports.useDatePickerContext = useDatePickerContext;
24656
24614
  exports.useMenuContext = useMenuContext;
24657
24615
  exports.useTheme = useTheme;