UNPKG

@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

35 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildAriaDescribedBy = void 0; /** * Build the aria-describedby attribute for the checkbox * @param extraAriaDescribedBy * @param label * @param checkBoxLabelId * @param helpContent * @param checkBoxkHelpContentId * @param textError * @param hasError * @param checkBoxErrorId * @param screenReaderId * @returns {string} * @constructor */ const buildAriaDescribedBy = ({ extraAriaDescribedBy, label, checkBoxLabelId, helpContent, checkBoxkHelpContentId, errorText, hasError, checkBoxErrorId, screenReaderText, screenReaderId, }) => { let res = extraAriaDescribedBy; if (label) { res += ` ${checkBoxLabelId}`; } if (screenReaderText) { res += ` ${screenReaderId}`; } if (helpContent) { res += ` ${checkBoxkHelpContentId}`; } if (hasError && errorText) { res += ` ${checkBoxErrorId}`; } return res.trim(); }; exports.buildAriaDescribedBy = buildAriaDescribedBy; //# sourceMappingURL=aria.utils.js.map