UNPKG

@harvest-profit/npk

Version:
22 lines 1.21 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const BaseInput_module_css_1 = __importDefault(require("./BaseInput.module.css")); const BaseInputLabel = ({ className = '', align, children, for: htmlFor, id, ...props }) => { const onClick = (event) => { if (htmlFor) return; if (id) { const queryResult = Array.prototype.filter.call(document.querySelectorAll(`[aria-labelledby~="${id}"`), elem => elem.offsetWidth > 0 || elem.offsetHeight > 0); const nextElem = queryResult[0]; nextElem?.focus(); event.preventDefault(); } }; return ((0, jsx_runtime_1.jsx)("label", { id: id, htmlFor: htmlFor, ...props, "data-label-align": align, className: `${BaseInput_module_css_1.default.CustomLabel} ${className}`, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { "data-component": "label", children: children }) })); }; exports.default = BaseInputLabel; //# sourceMappingURL=BaseInputLabel.js.map