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

24 lines 1.58 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LabelStandAlone = exports.LabelStandAloneComponent = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = __importDefault(require("react")); const text_1 = require("../../components/text/text"); const useId_1 = require("../../hooks/useId/useId"); const component_1 = require("../text/types/component"); const LabelStandAloneComponent = ({ children, inputId, required, requiredSymbol, textVariant, weight, color, cursor, asteriskVariant, asteriskWeight, asteriskColor, dataTestId = 'label', id, }, ref) => { const uniqueId = (0, useId_1.useId)('label'); const labelId = id ?? uniqueId; return ((0, jsx_runtime_1.jsxs)(text_1.Text, { ref: ref, color: color, component: component_1.TextComponentType.LABEL, cursor: cursor, dataTestId: dataTestId, htmlFor: inputId, id: labelId, variant: textVariant, weight: weight, children: [children, required && ((0, jsx_runtime_1.jsx)(text_1.Text, { "aria-hidden": true, color: asteriskColor, component: component_1.TextComponentType.SPAN, variant: asteriskVariant, weight: asteriskWeight, children: requiredSymbol }))] })); }; exports.LabelStandAloneComponent = LabelStandAloneComponent; /** * @description * Label component to show labels * @internal */ exports.LabelStandAlone = react_1.default.forwardRef(exports.LabelStandAloneComponent); //# sourceMappingURL=labelStandAlone.js.map