@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
22 lines • 2.3 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoadingStateStandAlone = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const text_1 = require("../../components/text/text");
const component_1 = require("../../components/text/types/component");
const screenReaderOnly_1 = require("../screenReaderOnly/screenReaderOnly");
const thirdPartyAnimation_1 = require("../thirdPartyAnimation/thirdPartyAnimation");
const loadingState_styled_1 = require("./loadingState.styled");
const LoadingStateStandAloneComponent = ({ description, hideText = false, styles, title, screenReaderText, state, dataTestId = 'loading-state', ...props }, ref) => {
const stateStyles = styles.states?.[state];
const hasTitle = title && !hideText;
return ((0, jsx_runtime_1.jsxs)(loadingState_styled_1.LoadingStateStyled, { ref: ref, "data-testid": dataTestId, children: [stateStyles?.thirdPartyAnimation?.height &&
stateStyles?.thirdPartyAnimation?.variant &&
stateStyles?.thirdPartyAnimation?.width && ((0, jsx_runtime_1.jsx)(thirdPartyAnimation_1.ThirdPartyAnimation, { "aria-label": props['aria-label'], height: stateStyles.thirdPartyAnimation.height, variant: stateStyles.thirdPartyAnimation.variant, width: stateStyles.thirdPartyAnimation.width })), hasTitle && ((0, jsx_runtime_1.jsx)(loadingState_styled_1.TitleWrapperStyled, { styles: styles, children: (0, jsx_runtime_1.jsx)(text_1.Text, { customTypography: styles.title, ...title, children: title.content }) })), description && !hideText && ((0, jsx_runtime_1.jsx)(loadingState_styled_1.DescriptionWrapperStyled, { styles: styles, children: (0, jsx_runtime_1.jsx)(text_1.Text, { component: component_1.TextComponentType.PARAGRAPH, customTypography: styles.description, ...description, children: description.content }) })), (0, jsx_runtime_1.jsx)(screenReaderOnly_1.ScreenReaderOnly, { show: !hasTitle, children: screenReaderText })] }));
};
exports.LoadingStateStandAlone = react_1.default.forwardRef(LoadingStateStandAloneComponent);
//# sourceMappingURL=loadingStateStandAlone.js.map