@televet/kibble-ui 1.4.1 → 1.5.0
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/build/components/DataDisplay/NotificationCounter/index.d.ts +2 -0
- package/build/components/DataDisplay/NotificationCounter/notificationCounter.component.d.ts +9 -0
- package/build/components/DataDisplay/NotificationCounter/notificationCounter.types.d.ts +1 -0
- package/build/components/DataDisplay/index.d.ts +1 -0
- package/build/index.js +35 -4
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
3
|
+
import { NotificationCounterSize } from './notificationCounter.types';
|
|
4
|
+
export interface NotificationCounterProps extends FlexProps {
|
|
5
|
+
count: number;
|
|
6
|
+
size?: NotificationCounterSize;
|
|
7
|
+
showCount?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const NotificationCounter: ({ count, size, showCount, ...rest }: NotificationCounterProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type NotificationCounterSize = 'lg' | 'md' | 'sm' | 'xs';
|
package/build/index.js
CHANGED
|
@@ -26,8 +26,8 @@ function _interopNamespace(e) {
|
|
|
26
26
|
return Object.freeze(n);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
31
|
|
|
32
32
|
/*! *****************************************************************************
|
|
33
33
|
Copyright (c) Microsoft Corporation.
|
|
@@ -67,6 +67,38 @@ function __rest(s, e) {
|
|
|
67
67
|
return t;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
var useTheme = function () { return react.useTheme(); };
|
|
71
|
+
|
|
72
|
+
var MAX_COUNT = 99;
|
|
73
|
+
var notificationCounterSizes = {
|
|
74
|
+
xs: '8px',
|
|
75
|
+
sm: '16px',
|
|
76
|
+
md: '20px',
|
|
77
|
+
lg: '24px',
|
|
78
|
+
};
|
|
79
|
+
var notificationCounterFontSizes = {
|
|
80
|
+
xs: '8px',
|
|
81
|
+
sm: '10px',
|
|
82
|
+
md: '12px',
|
|
83
|
+
lg: '14px',
|
|
84
|
+
};
|
|
85
|
+
var maxNotificationCounterSizes = {
|
|
86
|
+
xs: '1px',
|
|
87
|
+
sm: '2px',
|
|
88
|
+
md: '3px',
|
|
89
|
+
lg: '4px',
|
|
90
|
+
};
|
|
91
|
+
var NotificationCounter = function (_a) {
|
|
92
|
+
var count = _a.count, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.showCount, showCount = _c === void 0 ? true : _c, rest = __rest(_a, ["count", "size", "showCount"]);
|
|
93
|
+
var theme = useTheme();
|
|
94
|
+
var _showCount = size === 'xs' ? false : showCount; // By default the xs size doesn't show a label
|
|
95
|
+
if (count < 1) {
|
|
96
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
97
|
+
}
|
|
98
|
+
var counterContent = count > MAX_COUNT ? (React__default["default"].createElement(react.Box, { backgroundColor: theme.colors.white, borderRadius: theme.radii.full, height: maxNotificationCounterSizes[size], width: maxNotificationCounterSizes[size] })) : (count);
|
|
99
|
+
return (React__default["default"].createElement(react.Flex, __assign({}, rest, { alignItems: "center", backgroundColor: theme.colors.red[500], border: theme.borders['1px'], borderColor: theme.colors.white, borderRadius: theme.radii.full, color: theme.colors.white, fontSize: notificationCounterFontSizes[size], fontWeight: theme.fontWeights.semibold, height: notificationCounterSizes[size], justifyContent: "center", width: notificationCounterSizes[size] }), _showCount && counterContent));
|
|
100
|
+
};
|
|
101
|
+
|
|
70
102
|
const SvgAlertCircle = ({ color = "currentColor", height = "24px", width = "24px" }, ref) => (React__namespace.createElement("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: width, height: height, ref: ref },
|
|
71
103
|
React__namespace.createElement("path", { d: "M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 9 9 0 0 0 9-9 9 9 0 0 0-9-9Zm.9 12.6a.9.9 0 1 1-1.8 0 .9.9 0 0 1 1.8 0Zm0-3.15a.9.9 0 1 1-1.8 0V8.4a.9.9 0 1 1 1.8 0v4.05Z", fill: color })));
|
|
72
104
|
const ForwardRef$2x = React.forwardRef(SvgAlertCircle);
|
|
@@ -970,8 +1002,6 @@ var IconSizeMap = {
|
|
|
970
1002
|
'2xl': 38,
|
|
971
1003
|
};
|
|
972
1004
|
|
|
973
|
-
var useTheme = function () { return react.useTheme(); };
|
|
974
|
-
|
|
975
1005
|
var useAdaptiveColorMap = function (map, token) {
|
|
976
1006
|
return react.useColorModeValue(map.light[token], map.dark[token]);
|
|
977
1007
|
};
|
|
@@ -1109,7 +1139,7 @@ var coreColors = {
|
|
|
1109
1139
|
200: '#FEB2B2',
|
|
1110
1140
|
300: '#FC8181',
|
|
1111
1141
|
400: '#F56565',
|
|
1112
|
-
500: '#
|
|
1142
|
+
500: '#EC493F',
|
|
1113
1143
|
600: '#C53030',
|
|
1114
1144
|
700: '#9B2C2C',
|
|
1115
1145
|
800: '#822727',
|
|
@@ -6028,6 +6058,7 @@ exports.HeadingConfig = HeadingConfig;
|
|
|
6028
6058
|
exports.Icon = Icon;
|
|
6029
6059
|
exports.KibbleThemeProvider = KibbleThemeProvider;
|
|
6030
6060
|
exports.Logo = Logo;
|
|
6061
|
+
exports.NotificationCounter = NotificationCounter;
|
|
6031
6062
|
exports.RatingDot = RatingDot;
|
|
6032
6063
|
exports.RatingDots = RatingDots;
|
|
6033
6064
|
exports.Select = WrappedSelect;
|