UNPKG

@spaced-out/ui-design-system

Version:
72 lines (71 loc) 3.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmptyState = void 0; var React = _interopRequireWildcard(require("react")); var _classify = _interopRequireDefault(require("../../utils/classify")); var _qa = require("../../utils/qa"); var _EmptyImages = require("./EmptyImages"); var _EmptyStateModule = _interopRequireDefault(require("./EmptyState.module.css")); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } const EmptyState = exports.EmptyState = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { classNames, children, imageVariant, title, description, customImageUrl, testId, ...props } = _ref; return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { ...props, "data-testid": (0, _qa.generateTestId)({ base: testId, slot: 'emptyState' }), className: (0, _classify.default)(_EmptyStateModule.default.wrapper, classNames?.wrapper), ref: ref, children: [!!imageVariant && !customImageUrl && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { "data-testid": (0, _qa.generateTestId)({ base: testId, slot: 'image' }), className: (0, _classify.default)(_EmptyStateModule.default.image, classNames?.image), children: [imageVariant === 'calendar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.CalendarEmptyImage, {}), imageVariant === 'data' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.DataEmptyImage, {}), imageVariant === 'file' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.FileEmptyImage, {}), imageVariant === 'message' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.MessageEmptyImage, {}), imageVariant === 'upload' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.UploadEmptyImage, {}), imageVariant === 'chart' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.ChartEmptyImage, {}), imageVariant === 'analytics' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.AnalyticsEmptyImage, {}), imageVariant === 'voice' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyImages.VoiceEmptyImage, {})] }), customImageUrl && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", { "data-testid": (0, _qa.generateTestId)({ base: testId, slot: 'image' }), className: (0, _classify.default)(_EmptyStateModule.default.image, classNames?.image), src: customImageUrl, alt: "Empty State" }), !!title && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { "data-testid": (0, _qa.generateTestId)({ base: testId, slot: 'title' }), className: (0, _classify.default)(_EmptyStateModule.default.title, classNames?.title), children: title }), !!description && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { "data-testid": (0, _qa.generateTestId)({ base: testId, slot: 'description' }), className: (0, _classify.default)(_EmptyStateModule.default.description, classNames?.description), children: description }), !!children && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { "data-testid": (0, _qa.generateTestId)({ base: testId, slot: 'children' }), className: (0, _classify.default)(_EmptyStateModule.default.childrenWrapper, classNames?.children), children: children })] }); });