@smart-react-components/ui
Version:
SRC UI includes React and Styled components.
72 lines (64 loc) • 1.95 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Label_1 = __importDefault(require("@smart-react-components/core/Element/Label"));
const styled_components_1 = __importDefault(require("styled-components"));
const css_1 = require("../../util/css");
const form_1 = require("../../util/form");
exports.default = (0, styled_components_1.default)(Label_1.default).attrs(({ display = 'block', isBlock }) => ({
display,
getFormSize: (v, t) => `
${isBlock
? `
> span {
margin-bottom: ${t.$.size.form.blockLabel[v].margin};
}
`
: `
margin-bottom: ${t.$.size.form.blockLabel[v].margin};
> span {
margin-right: ${(0, css_1.toCSSValue)(t.$.size.form.blockLabel[v].margin)(form_1.calculateFormLabelMarginX)};
}
`}
> span {
font-size: ${t.$.size.form.blockLabel[v].fontSize};
}
`,
}))(({ theme, cursorKey, isBlock, isDisabled, palette }) => {
var _a, _b, _c;
return `
> span {
color: ${(_c = (_b = (_a = theme.$.palette[palette].form) === null || _a === void 0 ? void 0 : _a.blockLabel) === null || _b === void 0 ? void 0 : _b.font) !== null && _c !== void 0 ? _c : theme.$.color.dynamic.bodyFont};
display: block;
word-break: break-word;
word-wrap: break-word;
-webkit-tap-highlight-color: transparent;
${cursorKey
? `
cursor: ${theme.$.cursor[cursorKey]};
`
: ''}
}
${!isBlock
? `
display: flex;
> span {
align-self: center;
}
> div {
align-self: flex-start;
}
`
: ''}
${isDisabled
? `
> span {
opacity: ${theme.$.opacity.formDisabled};
pointer-events: none;
}
`
: ''}
`;
});
;