@televet/kibble-ui 1.12.6-beta.37pzzaj.1 → 1.12.7
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,5 +1,4 @@
|
|
|
1
1
|
import { AvatarProps as CAvatarProps, Placement } from '@chakra-ui/react';
|
|
2
|
-
import { IconName } from 'components/MediaAndIcons/Icon';
|
|
3
2
|
import React, { CSSProperties } from 'react';
|
|
4
3
|
import { AvatarSize } from './avatar.types';
|
|
5
4
|
export declare enum AvatarVariant {
|
|
@@ -9,21 +8,7 @@ export declare enum AvatarVariant {
|
|
|
9
8
|
Comet = "comet",
|
|
10
9
|
Number = "number",
|
|
11
10
|
Dashed = "dashed",
|
|
12
|
-
Image = "image"
|
|
13
|
-
Icon = "icon"
|
|
14
|
-
}
|
|
15
|
-
export declare enum AvatarBadgePosition {
|
|
16
|
-
TopLeft = "topLeft",
|
|
17
|
-
TopRight = "topRight",
|
|
18
|
-
BottomLeft = "bottomLeft",
|
|
19
|
-
BottomRight = "bottomRight"
|
|
20
|
-
}
|
|
21
|
-
export interface AvatarBadgeProps {
|
|
22
|
-
badgeIconName?: IconName;
|
|
23
|
-
badgeBackgroundColor?: string;
|
|
24
|
-
badgeBorderColor?: string;
|
|
25
|
-
badgeIconColor?: string;
|
|
26
|
-
badgePosition?: AvatarBadgePosition;
|
|
11
|
+
Image = "image"
|
|
27
12
|
}
|
|
28
13
|
export interface AvatarProps extends CAvatarProps {
|
|
29
14
|
name: string;
|
|
@@ -36,30 +21,6 @@ export interface AvatarProps extends CAvatarProps {
|
|
|
36
21
|
showRemoveButton?: boolean;
|
|
37
22
|
handleRemoveButtonClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
38
23
|
variant?: AvatarVariant;
|
|
39
|
-
iconName?: IconName;
|
|
40
|
-
tooltipText?: string;
|
|
41
|
-
showBadge?: boolean;
|
|
42
|
-
badgeProps?: AvatarBadgeProps;
|
|
43
|
-
}
|
|
44
|
-
export interface AvatarStoryProps {
|
|
45
|
-
name: string;
|
|
46
|
-
size?: AvatarSize;
|
|
47
|
-
isClinic?: boolean;
|
|
48
|
-
showTooltip?: boolean;
|
|
49
|
-
tooltipPlacement?: Placement;
|
|
50
|
-
style?: CSSProperties;
|
|
51
|
-
handleClick?: React.MouseEventHandler<HTMLSpanElement>;
|
|
52
|
-
showRemoveButton?: boolean;
|
|
53
|
-
handleRemoveButtonClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
54
|
-
variant?: AvatarVariant;
|
|
55
|
-
iconName?: IconName;
|
|
56
24
|
tooltipText?: string;
|
|
57
|
-
showBadge?: boolean;
|
|
58
|
-
badgeProps?: AvatarBadgeProps;
|
|
59
|
-
badgeIconName?: IconName;
|
|
60
|
-
badgeBackgroundColor?: string;
|
|
61
|
-
badgeBorderColor?: string;
|
|
62
|
-
badgeIconColor?: string;
|
|
63
|
-
badgePosition?: AvatarBadgePosition;
|
|
64
25
|
}
|
|
65
|
-
export declare const Avatar: ({ name, src, isClinic, size, showTooltip, tooltipPlacement, style, handleClick, showRemoveButton, handleRemoveButtonClick, variant,
|
|
26
|
+
export declare const Avatar: ({ name, src, isClinic, size, showTooltip, tooltipPlacement, style, handleClick, showRemoveButton, handleRemoveButtonClick, variant, tooltipText, ...rest }: AvatarProps) => JSX.Element;
|
package/build/index.js
CHANGED
|
@@ -1606,39 +1606,6 @@ var toTitleCase = function (s) {
|
|
|
1606
1606
|
.join('');
|
|
1607
1607
|
};
|
|
1608
1608
|
|
|
1609
|
-
var getNextIconSize = function (size, larger, count) {
|
|
1610
|
-
if (larger === void 0) { larger = true; }
|
|
1611
|
-
if (count === void 0) { count = 1; }
|
|
1612
|
-
var nextSize;
|
|
1613
|
-
switch (size) {
|
|
1614
|
-
case 'xs':
|
|
1615
|
-
nextSize = larger ? 'sm' : 'xs';
|
|
1616
|
-
break;
|
|
1617
|
-
case 'sm':
|
|
1618
|
-
nextSize = larger ? 'md' : 'xs';
|
|
1619
|
-
break;
|
|
1620
|
-
case 'md':
|
|
1621
|
-
nextSize = larger ? 'lg' : 'sm';
|
|
1622
|
-
break;
|
|
1623
|
-
case 'lg':
|
|
1624
|
-
nextSize = larger ? 'xl' : 'md';
|
|
1625
|
-
break;
|
|
1626
|
-
case 'xl':
|
|
1627
|
-
nextSize = larger ? '2xl' : 'lg';
|
|
1628
|
-
break;
|
|
1629
|
-
case '2xl':
|
|
1630
|
-
nextSize = larger ? '2xl' : 'xl';
|
|
1631
|
-
break;
|
|
1632
|
-
default:
|
|
1633
|
-
nextSize = size;
|
|
1634
|
-
break;
|
|
1635
|
-
}
|
|
1636
|
-
if (count > 1) {
|
|
1637
|
-
nextSize = getNextIconSize(nextSize, larger, count - 1);
|
|
1638
|
-
}
|
|
1639
|
-
return nextSize;
|
|
1640
|
-
};
|
|
1641
|
-
|
|
1642
1609
|
var Tooltip = function (_a) {
|
|
1643
1610
|
var children = _a.children, label = _a.label, _b = _a.openDelay, openDelay = _b === void 0 ? 350 : _b, _c = _a.placement, placement = _c === void 0 ? 'top' : _c, _d = _a.titleCaseLabel, titleCaseLabel = _d === void 0 ? true : _d, rest = __rest(_a, ["children", "label", "openDelay", "placement", "titleCaseLabel"]);
|
|
1644
1611
|
var components = useTheme().components;
|
|
@@ -1678,6 +1645,59 @@ var TooltipConfig = {
|
|
|
1678
1645
|
},
|
|
1679
1646
|
};
|
|
1680
1647
|
|
|
1648
|
+
exports.AvatarVariant = void 0;
|
|
1649
|
+
(function (AvatarVariant) {
|
|
1650
|
+
AvatarVariant["Green"] = "green";
|
|
1651
|
+
AvatarVariant["Red"] = "red";
|
|
1652
|
+
AvatarVariant["Blue"] = "blue";
|
|
1653
|
+
AvatarVariant["Comet"] = "comet";
|
|
1654
|
+
AvatarVariant["Number"] = "number";
|
|
1655
|
+
AvatarVariant["Dashed"] = "dashed";
|
|
1656
|
+
AvatarVariant["Image"] = "image";
|
|
1657
|
+
})(exports.AvatarVariant || (exports.AvatarVariant = {}));
|
|
1658
|
+
var getAvatarVariant = function (charCode) {
|
|
1659
|
+
if (charCode >= 65 && charCode <= 71) {
|
|
1660
|
+
return exports.AvatarVariant.Blue;
|
|
1661
|
+
}
|
|
1662
|
+
else if (charCode >= 72 && charCode <= 77) {
|
|
1663
|
+
return exports.AvatarVariant.Red;
|
|
1664
|
+
}
|
|
1665
|
+
else if (charCode >= 78 && charCode <= 84) {
|
|
1666
|
+
return exports.AvatarVariant.Green;
|
|
1667
|
+
}
|
|
1668
|
+
else {
|
|
1669
|
+
return exports.AvatarVariant.Comet;
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
var Avatar = function (_a) {
|
|
1673
|
+
var name = _a.name, src = _a.src, _b = _a.isClinic, isClinic = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, _d = _a.showTooltip, showTooltip = _d === void 0 ? true : _d, _e = _a.tooltipPlacement, tooltipPlacement = _e === void 0 ? 'bottom' : _e, style = _a.style, handleClick = _a.handleClick, showRemoveButton = _a.showRemoveButton, handleRemoveButtonClick = _a.handleRemoveButtonClick, variant = _a.variant, tooltipText = _a.tooltipText, rest = __rest(_a, ["name", "src", "isClinic", "size", "showTooltip", "tooltipPlacement", "style", "handleClick", "showRemoveButton", "handleRemoveButtonClick", "variant", "tooltipText"]);
|
|
1674
|
+
var theme = useTheme();
|
|
1675
|
+
var _f = __read(React.useState(!!src), 2), isSrcValid = _f[0], setIsSrcValid = _f[1];
|
|
1676
|
+
var _g = __read(React.useState(false), 2), isHoveringAvatar = _g[0], setIsHoveringAvatar = _g[1];
|
|
1677
|
+
var _h = __read(React.useState(false), 2), isHoveringRemoveButton = _h[0], setIsHoveringRemoveButton = _h[1];
|
|
1678
|
+
var shouldHideRemoveButton = size === 'xs' || variant === exports.AvatarVariant.Dashed || variant === exports.AvatarVariant.Number;
|
|
1679
|
+
var _variant = isClinic ? 'comet' : getAvatarVariant(name.charCodeAt(0));
|
|
1680
|
+
if (isSrcValid) {
|
|
1681
|
+
_variant = 'image';
|
|
1682
|
+
}
|
|
1683
|
+
var avatarDynamicStyles = __assign({ cursor: handleClick ? 'pointer' : 'auto' }, style);
|
|
1684
|
+
var avatarMarkup = (React__default["default"].createElement(react.Avatar, __assign({}, rest, { name: name, src: src, size: size, style: avatarDynamicStyles, variant: variant || _variant, onClick: handleClick, onError: function () { return setIsSrcValid(false); }, onMouseEnter: function () { return setIsHoveringAvatar(true); }, onMouseLeave: function () { return setIsHoveringAvatar(false); } }), showRemoveButton && isHoveringAvatar && !shouldHideRemoveButton && (React__default["default"].createElement(react.Box, { backgroundColor: theme.colors.white, borderRadius: "9999px", cursor: "pointer", position: "absolute", top: "-4px", right: "-4px", onClick: handleRemoveButtonClick, onMouseEnter: function () { return setIsHoveringRemoveButton(true); }, onMouseLeave: function () { return setIsHoveringRemoveButton(false); } },
|
|
1685
|
+
React__default["default"].createElement(Icon, { name: "closeCircle", size: isHoveringRemoveButton ? 'sm' : 'xs', color: "default" })))));
|
|
1686
|
+
if (showTooltip) {
|
|
1687
|
+
return (React__default["default"].createElement(Tooltip, { label: tooltipText || name, placement: tooltipPlacement }, avatarMarkup));
|
|
1688
|
+
}
|
|
1689
|
+
return avatarMarkup;
|
|
1690
|
+
};
|
|
1691
|
+
|
|
1692
|
+
var AvatarGroup = function (_a) {
|
|
1693
|
+
var avatars = _a.avatars, _b = _a.max, max = _b === void 0 ? 3 : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, handleAddButtonClick = _a.handleAddButtonClick, _d = _a.showAddButton, showAddButton = _d === void 0 ? true : _d, addButtonTooltipText = _a.addButtonTooltipText, _e = _a.showRemoveAvatarButton, showRemoveAvatarButton = _e === void 0 ? false : _e, handleRemoveButtonClick = _a.handleRemoveButtonClick;
|
|
1694
|
+
var mergedNames = React.useMemo(function () { return avatars.map(function (avatar) { return avatar.name; }).join(', '); }, [avatars]);
|
|
1695
|
+
var spacing = size === 'lg' || size === 'md' ? -2 : -1;
|
|
1696
|
+
return (React__default["default"].createElement(react.AvatarGroup, { size: size, spacing: spacing },
|
|
1697
|
+
avatars.length > max ? (React__default["default"].createElement(Avatar, { name: "".concat(avatars.length), size: size, variant: exports.AvatarVariant.Number, tooltipText: mergedNames })) : (avatars.map(function (avatar) { return (React__default["default"].createElement(Avatar, __assign({}, avatar, { key: avatar.name, size: size, showRemoveButton: showRemoveAvatarButton, handleRemoveButtonClick: handleRemoveButtonClick }))); })),
|
|
1698
|
+
showAddButton && (React__default["default"].createElement(Avatar, { name: "", variant: exports.AvatarVariant.Dashed, icon: React__default["default"].createElement(Icon, { name: "plus", color: "subtle", size: size }), onClick: handleAddButtonClick, tooltipText: addButtonTooltipText, size: size }))));
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1681
1701
|
var AvatarConfig = {
|
|
1682
1702
|
baseStyle: {
|
|
1683
1703
|
container: {
|
|
@@ -1829,116 +1849,9 @@ var AvatarConfig = {
|
|
|
1829
1849
|
},
|
|
1830
1850
|
},
|
|
1831
1851
|
},
|
|
1832
|
-
icon: {
|
|
1833
|
-
container: {
|
|
1834
|
-
border: 0,
|
|
1835
|
-
color: adaptiveColors.icon.light.default,
|
|
1836
|
-
backgroundColor: coreColors.comet[50],
|
|
1837
|
-
opacity: 1,
|
|
1838
|
-
_hover: {
|
|
1839
|
-
backgroundColor: coreColors.comet[100],
|
|
1840
|
-
},
|
|
1841
|
-
_active: {
|
|
1842
|
-
backgroundColor: coreColors.comet[200],
|
|
1843
|
-
},
|
|
1844
|
-
},
|
|
1845
|
-
},
|
|
1846
1852
|
},
|
|
1847
1853
|
};
|
|
1848
1854
|
|
|
1849
|
-
exports.AvatarVariant = void 0;
|
|
1850
|
-
(function (AvatarVariant) {
|
|
1851
|
-
AvatarVariant["Green"] = "green";
|
|
1852
|
-
AvatarVariant["Red"] = "red";
|
|
1853
|
-
AvatarVariant["Blue"] = "blue";
|
|
1854
|
-
AvatarVariant["Comet"] = "comet";
|
|
1855
|
-
AvatarVariant["Number"] = "number";
|
|
1856
|
-
AvatarVariant["Dashed"] = "dashed";
|
|
1857
|
-
AvatarVariant["Image"] = "image";
|
|
1858
|
-
AvatarVariant["Icon"] = "icon";
|
|
1859
|
-
})(exports.AvatarVariant || (exports.AvatarVariant = {}));
|
|
1860
|
-
exports.AvatarBadgePosition = void 0;
|
|
1861
|
-
(function (AvatarBadgePosition) {
|
|
1862
|
-
AvatarBadgePosition["TopLeft"] = "topLeft";
|
|
1863
|
-
AvatarBadgePosition["TopRight"] = "topRight";
|
|
1864
|
-
AvatarBadgePosition["BottomLeft"] = "bottomLeft";
|
|
1865
|
-
AvatarBadgePosition["BottomRight"] = "bottomRight";
|
|
1866
|
-
})(exports.AvatarBadgePosition || (exports.AvatarBadgePosition = {}));
|
|
1867
|
-
var getAvatarVariant = function (charCode) {
|
|
1868
|
-
if (charCode >= 65 && charCode <= 71) {
|
|
1869
|
-
return exports.AvatarVariant.Blue;
|
|
1870
|
-
}
|
|
1871
|
-
else if (charCode >= 72 && charCode <= 77) {
|
|
1872
|
-
return exports.AvatarVariant.Red;
|
|
1873
|
-
}
|
|
1874
|
-
else if (charCode >= 78 && charCode <= 84) {
|
|
1875
|
-
return exports.AvatarVariant.Green;
|
|
1876
|
-
}
|
|
1877
|
-
else {
|
|
1878
|
-
return exports.AvatarVariant.Comet;
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
var Avatar = function (_a) {
|
|
1882
|
-
var name = _a.name, src = _a.src, _b = _a.isClinic, isClinic = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, _d = _a.showTooltip, showTooltip = _d === void 0 ? true : _d, _e = _a.tooltipPlacement, tooltipPlacement = _e === void 0 ? 'bottom' : _e, style = _a.style, handleClick = _a.handleClick, showRemoveButton = _a.showRemoveButton, handleRemoveButtonClick = _a.handleRemoveButtonClick, variant = _a.variant, iconName = _a.iconName, tooltipText = _a.tooltipText, showBadge = _a.showBadge, badgeProps = _a.badgeProps, rest = __rest(_a, ["name", "src", "isClinic", "size", "showTooltip", "tooltipPlacement", "style", "handleClick", "showRemoveButton", "handleRemoveButtonClick", "variant", "iconName", "tooltipText", "showBadge", "badgeProps"]);
|
|
1883
|
-
var theme = useTheme();
|
|
1884
|
-
var _f = __read(React.useState(!!src), 2), isSrcValid = _f[0], setIsSrcValid = _f[1];
|
|
1885
|
-
var _g = __read(React.useState(false), 2), isHoveringAvatar = _g[0], setIsHoveringAvatar = _g[1];
|
|
1886
|
-
var _h = __read(React.useState(false), 2), isHoveringRemoveButton = _h[0], setIsHoveringRemoveButton = _h[1];
|
|
1887
|
-
var shouldHideRemoveButton = size === 'xs' || variant === exports.AvatarVariant.Dashed || variant === exports.AvatarVariant.Number;
|
|
1888
|
-
var _variant = isClinic ? 'comet' : getAvatarVariant(name.charCodeAt(0));
|
|
1889
|
-
var useSmallBadge = React.useMemo(function () { return size === 'xs' || !(badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgeIconName); }, [badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgeIconName, size]);
|
|
1890
|
-
if (isSrcValid) {
|
|
1891
|
-
_variant = exports.AvatarVariant.Image;
|
|
1892
|
-
}
|
|
1893
|
-
if (iconName) {
|
|
1894
|
-
_variant = exports.AvatarVariant.Icon;
|
|
1895
|
-
}
|
|
1896
|
-
console.log('DEBUG: ', rest);
|
|
1897
|
-
var getBadgeTransform = function (position) {
|
|
1898
|
-
var _a, _b, _c;
|
|
1899
|
-
// type is actually SystemStyleInterpolation, which Chakra doesn't export, so use any instead
|
|
1900
|
-
var parentSizeString = (_c = (_b = (_a = AvatarConfig.sizes) === null || _a === void 0 ? void 0 : _a[size]) === null || _b === void 0 ? void 0 : _b.container) === null || _c === void 0 ? void 0 : _c.height;
|
|
1901
|
-
var parentSize = parentSizeString.replace('px', '');
|
|
1902
|
-
var translation = parentSize / 2;
|
|
1903
|
-
switch (position) {
|
|
1904
|
-
case exports.AvatarBadgePosition.TopLeft:
|
|
1905
|
-
return useSmallBadge && size !== 'xs'
|
|
1906
|
-
? "translate(".concat(translation * -1.35, "px, ").concat(translation * -1.35, "px)")
|
|
1907
|
-
: "translate(".concat(translation * -1.2, "px, ").concat(translation * -1.2, "px)");
|
|
1908
|
-
case exports.AvatarBadgePosition.TopRight:
|
|
1909
|
-
return useSmallBadge && size !== 'xs'
|
|
1910
|
-
? "translate(".concat(translation / 10, "px, ").concat(translation * -1.35, "px)")
|
|
1911
|
-
: "translate(".concat(translation / 5, "px, ").concat(translation * -1.2, "px)");
|
|
1912
|
-
case exports.AvatarBadgePosition.BottomLeft:
|
|
1913
|
-
return useSmallBadge && size !== 'xs'
|
|
1914
|
-
? "translate(".concat(translation * -1.35, "px, ").concat(translation / 10, "px)")
|
|
1915
|
-
: "translate(".concat(translation * -1.2, "px, ").concat(translation / 5, "px)");
|
|
1916
|
-
default:
|
|
1917
|
-
return useSmallBadge && size !== 'xs'
|
|
1918
|
-
? "translate(".concat(translation / 10, "px, ").concat(translation / 10, "px)")
|
|
1919
|
-
: "translate(".concat(translation / 3, "px, ").concat(translation / 3, "px)");
|
|
1920
|
-
}
|
|
1921
|
-
};
|
|
1922
|
-
var avatarDynamicStyles = __assign({ cursor: handleClick ? 'pointer' : 'auto' }, style);
|
|
1923
|
-
var avatarMarkup = (React__default["default"].createElement(react.Avatar, __assign({}, rest, { name: iconName ? '' : name, src: src, size: size, style: avatarDynamicStyles, variant: variant || _variant, icon: iconName && React__default["default"].createElement(Icon, { name: iconName, size: getNextIconSize(size, true, size === 'sm' || size === 'xs' ? 2 : 1) }), onClick: handleClick, onError: function () { return setIsSrcValid(false); }, onMouseEnter: function () { return setIsHoveringAvatar(true); }, onMouseLeave: function () { return setIsHoveringAvatar(false); } }),
|
|
1924
|
-
showRemoveButton && isHoveringAvatar && !shouldHideRemoveButton && (React__default["default"].createElement(react.Box, { backgroundColor: theme.colors.white, borderRadius: "9999px", cursor: "pointer", position: "absolute", top: "-4px", right: "-4px", onClick: handleRemoveButtonClick, onMouseEnter: function () { return setIsHoveringRemoveButton(true); }, onMouseLeave: function () { return setIsHoveringRemoveButton(false); } },
|
|
1925
|
-
React__default["default"].createElement(Icon, { name: "closeCircle", size: isHoveringRemoveButton ? 'sm' : 'xs', color: "default" }))),
|
|
1926
|
-
showBadge && (React__default["default"].createElement(react.AvatarBadge, { color: (badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgeIconColor) || adaptiveColors.icon.light.active, borderColor: (badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgeBorderColor) || coreColors.white, borderWidth: "1px", bg: (badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgeBackgroundColor) || semanticColors.background.info, boxSize: useSmallBadge ? '10px' : '18px', transform: getBadgeTransform((badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgePosition) || exports.AvatarBadgePosition.BottomRight) }, !useSmallBadge && (badgeProps === null || badgeProps === void 0 ? void 0 : badgeProps.badgeIconName) && React__default["default"].createElement(Icon, { name: badgeProps.badgeIconName, size: 'xs' })))));
|
|
1927
|
-
if (showTooltip) {
|
|
1928
|
-
return (React__default["default"].createElement(Tooltip, { label: tooltipText || name, placement: tooltipPlacement }, avatarMarkup));
|
|
1929
|
-
}
|
|
1930
|
-
return avatarMarkup;
|
|
1931
|
-
};
|
|
1932
|
-
|
|
1933
|
-
var AvatarGroup = function (_a) {
|
|
1934
|
-
var avatars = _a.avatars, _b = _a.max, max = _b === void 0 ? 3 : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, handleAddButtonClick = _a.handleAddButtonClick, _d = _a.showAddButton, showAddButton = _d === void 0 ? true : _d, addButtonTooltipText = _a.addButtonTooltipText, _e = _a.showRemoveAvatarButton, showRemoveAvatarButton = _e === void 0 ? false : _e, handleRemoveButtonClick = _a.handleRemoveButtonClick;
|
|
1935
|
-
var mergedNames = React.useMemo(function () { return avatars.map(function (avatar) { return avatar.name; }).join(', '); }, [avatars]);
|
|
1936
|
-
var spacing = size === 'lg' || size === 'md' ? -2 : -1;
|
|
1937
|
-
return (React__default["default"].createElement(react.AvatarGroup, { size: size, spacing: spacing },
|
|
1938
|
-
avatars.length > max ? (React__default["default"].createElement(Avatar, { name: "".concat(avatars.length), size: size, variant: exports.AvatarVariant.Number, tooltipText: mergedNames })) : (avatars.map(function (avatar) { return (React__default["default"].createElement(Avatar, __assign({}, avatar, { key: avatar.name, size: size, showRemoveButton: showRemoveAvatarButton, handleRemoveButtonClick: handleRemoveButtonClick }))); })),
|
|
1939
|
-
showAddButton && (React__default["default"].createElement(Avatar, { name: "", variant: exports.AvatarVariant.Dashed, icon: React__default["default"].createElement(Icon, { name: "plus", color: "subtle", size: size }), onClick: handleAddButtonClick, tooltipText: addButtonTooltipText, size: size }))));
|
|
1940
|
-
};
|
|
1941
|
-
|
|
1942
1855
|
var _path$k, _path2$7;
|
|
1943
1856
|
|
|
1944
1857
|
function _extends$k() { _extends$k = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
|
|
@@ -3679,12 +3592,13 @@ function withFormControl(Component) {
|
|
|
3679
3592
|
var _b = _a.errorText, errorText = _b === void 0 ? 'Field is invalid' : _b, helperText = _a.helperText, isDisabled = _a.isDisabled, _c = _a.isFieldInline, isFieldInline = _c === void 0 ? false : _c, isInvalid = _a.isInvalid, isReadOnly = _a.isReadOnly, isRequired = _a.isRequired, label = _a.label, labelStyle = _a.labelStyle, formControlStyle = _a.formControlStyle, _d = _a.helperTextAlignment, helperTextAlignment = _d === void 0 ? 'start' : _d, props = __rest(_a, ["errorText", "helperText", "isDisabled", "isFieldInline", "isInvalid", "isReadOnly", "isRequired", "label", "labelStyle", "formControlStyle", "helperTextAlignment"]);
|
|
3680
3593
|
var _e = useTheme(), colors = _e.colors, fontSizes = _e.fontSizes;
|
|
3681
3594
|
var alignment = isInvalid && helperText ? 'space-between' : helperTextAlignment;
|
|
3595
|
+
var shouldShowBottomContent = isInvalid || helperText;
|
|
3682
3596
|
return (React__default["default"].createElement(react.FormControl, __assign({}, formControlStyle, { isInvalid: isInvalid, isRequired: isRequired, isReadOnly: isReadOnly, isDisabled: isDisabled }),
|
|
3683
3597
|
label && (React__default["default"].createElement(react.FormLabel, __assign({ display: isFieldInline ? 'inline-block' : 'block', color: colors.text.light.default }, labelStyle), label)),
|
|
3684
3598
|
React__default["default"].createElement(Component, __assign({}, props, { "$isFieldInline": isFieldInline, errorBorderColor: colors.border.light.error, focusBorderColor: colors.border.light.focus })),
|
|
3685
|
-
React__default["default"].createElement(react.Flex, { mt:
|
|
3599
|
+
shouldShowBottomContent && (React__default["default"].createElement(react.Flex, { mt: 2, w: "100%", justifyContent: alignment, alignItems: "center" },
|
|
3686
3600
|
React__default["default"].createElement(react.FormErrorMessage, { m: 0, fontSize: fontSizes.xs, color: colors.text.light.error }, errorText),
|
|
3687
|
-
helperText && (React__default["default"].createElement(react.FormHelperText, { m: 0, color: isInvalid ? colors.text.light.error : colors.text.light.subtle, fontSize: fontSizes.xs }, helperText)))));
|
|
3601
|
+
helperText && (React__default["default"].createElement(react.FormHelperText, { m: 0, color: isInvalid ? colors.text.light.error : colors.text.light.subtle, fontSize: fontSizes.xs }, helperText))))));
|
|
3688
3602
|
}
|
|
3689
3603
|
WithFormControl.displayName = "withFormControl(".concat(Component.displayName || Component.name);
|
|
3690
3604
|
return WithFormControl;
|