MCPcopy
hub / github.com/tdewolff/minify / ScrollNumber

Function ScrollNumber

_benchmarks/sample_antd.js:3454–3513  ·  view source on GitHub ↗
(_a)

Source from the content-addressed store, hash-verified

3452
3453
3454var ScrollNumber = function ScrollNumber(_a) {
3455 var customizePrefixCls = _a.prefixCls,
3456 count = _a.count,
3457 className = _a.className,
3458 motionClassName = _a.motionClassName,
3459 style = _a.style,
3460 title = _a.title,
3461 show = _a.show,
3462 _a$component = _a.component,
3463 component = _a$component === void 0 ? 'sup' : _a$component,
3464 children = _a.children,
3465 restProps = __rest(_a, ["prefixCls", "count", "className", "motionClassName", "style", "title", "show", "component", "children"]);
3466
3467 var _React$useContext = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](_config_provider__WEBPACK_IMPORTED_MODULE_3__[/* ConfigContext */ "b"]),
3468 getPrefixCls = _React$useContext.getPrefixCls;
3469
3470 var prefixCls = getPrefixCls('scroll-number', customizePrefixCls); // ============================ Render ============================
3471
3472 var newProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, restProps), {
3473 'data-show': show,
3474 style: style,
3475 className: classnames__WEBPACK_IMPORTED_MODULE_2___default()(prefixCls, className, motionClassName),
3476 title: title
3477 }); // Only integer need motion
3478
3479
3480 var numberNodes = count;
3481
3482 if (count && Number(count) % 1 === 0) {
3483 var numberList = String(count).split('');
3484 numberNodes = numberList.map(function (num, i) {
3485 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_SingleNumber__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
3486 prefixCls: prefixCls,
3487 count: Number(count),
3488 value: num // eslint-disable-next-line react/no-array-index-key
3489 ,
3490 key: numberList.length - i
3491 });
3492 });
3493 } // allow specify the border
3494 // mock border-color by box-shadow for compatible with old usage:
3495 // <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
3496
3497
3498 if (style && style.borderColor) {
3499 newProps.style = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, style), {
3500 boxShadow: "0 0 0 1px ".concat(style.borderColor, " inset")
3501 });
3502 }
3503
3504 if (children) {
3505 return Object(_util_reactNode__WEBPACK_IMPORTED_MODULE_4__[/* cloneElement */ "a"])(children, function (oriProps) {
3506 return {
3507 className: classnames__WEBPACK_IMPORTED_MODULE_2___default()("".concat(prefixCls, "-custom-component"), oriProps === null || oriProps === void 0 ? void 0 : oriProps.className, motionClassName)
3508 };
3509 });
3510 }
3511

Callers

nothing calls this directly

Calls 1

NumberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…