29 lines
963 B
JavaScript
29 lines
963 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "useCounterBadge_unstable", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return useCounterBadge_unstable;
|
|
}
|
|
});
|
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
const _index = require("../Badge/index");
|
|
const useCounterBadge_unstable = (props, ref)=>{
|
|
const { shape = 'circular', appearance = 'filled', showZero = false, overflowCount = 99, count = 0, dot = false } = props;
|
|
const state = {
|
|
...(0, _index.useBadge_unstable)(props, ref),
|
|
shape,
|
|
appearance,
|
|
showZero,
|
|
count,
|
|
dot
|
|
};
|
|
if ((count !== 0 || showZero) && !dot && !state.root.children) {
|
|
state.root.children = count > overflowCount ? `${overflowCount}+` : `${count}`;
|
|
}
|
|
return state;
|
|
};
|