PromoCursed/node_modules/antd/lib/empty/index.js
2024-08-20 23:25:37 +04:00

78 lines
3.3 KiB
JavaScript

"use strict";
"use client";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _configProvider = require("../config-provider");
var _locale = require("../locale");
var _empty = _interopRequireDefault(require("./empty"));
var _simple = _interopRequireDefault(require("./simple"));
var _style = _interopRequireDefault(require("./style"));
var __rest = void 0 && (void 0).__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const defaultEmptyImg = /*#__PURE__*/React.createElement(_empty.default, null);
const simpleEmptyImg = /*#__PURE__*/React.createElement(_simple.default, null);
const Empty = _a => {
var {
className,
rootClassName,
prefixCls: customizePrefixCls,
image = defaultEmptyImg,
description,
children,
imageStyle,
style
} = _a,
restProps = __rest(_a, ["className", "rootClassName", "prefixCls", "image", "description", "children", "imageStyle", "style"]);
const {
getPrefixCls,
direction,
empty
} = React.useContext(_configProvider.ConfigContext);
const prefixCls = getPrefixCls('empty', customizePrefixCls);
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls);
const [locale] = (0, _locale.useLocale)('Empty');
const des = typeof description !== 'undefined' ? description : locale === null || locale === void 0 ? void 0 : locale.description;
const alt = typeof des === 'string' ? des : 'empty';
let imageNode = null;
if (typeof image === 'string') {
imageNode = /*#__PURE__*/React.createElement("img", {
alt: alt,
src: image
});
} else {
imageNode = image;
}
return wrapCSSVar( /*#__PURE__*/React.createElement("div", Object.assign({
className: (0, _classnames.default)(hashId, cssVarCls, prefixCls, empty === null || empty === void 0 ? void 0 : empty.className, {
[`${prefixCls}-normal`]: image === simpleEmptyImg,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName),
style: Object.assign(Object.assign({}, empty === null || empty === void 0 ? void 0 : empty.style), style)
}, restProps), /*#__PURE__*/React.createElement("div", {
className: `${prefixCls}-image`,
style: imageStyle
}, imageNode), des && /*#__PURE__*/React.createElement("div", {
className: `${prefixCls}-description`
}, des), children && /*#__PURE__*/React.createElement("div", {
className: `${prefixCls}-footer`
}, children)));
};
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
if (process.env.NODE_ENV !== 'production') {
Empty.displayName = 'Empty';
}
var _default = exports.default = Empty;