@blend-ui/core
Version:
Blend core cmponents
112 lines (106 loc) • 3.05 kB
JavaScript
import { objectSpread2 as _objectSpread2, extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js';
import React, { forwardRef } from 'react';
import styled, { css } from 'styled-components';
import { compose, layout, space, typography } from 'styled-system';
import styledProps from '@styled-system/prop-types';
import PropTypes from 'prop-types';
var systemProps = compose(layout, space, typography);
var nowrap = function nowrap(props) {
return props.nowrap ? {
whiteSpace: "nowrap"
} : null;
};
var pointer = function pointer(props) {
return props.pointer ? {
cursor: "pointer"
} : null;
};
var hidden = function hidden(props) {
return props.hidden ? {
visibility: "hidden"
} : null;
};
/*
const VisuallyHidden = styled(Box)`
border: 0px;
clip: rect(0px, 0px, 0px, 0px);
height: 1px;
width: 1px;
margin: -1px;
padding: 0px;
overflow: hidden;
white-space: nowrap;
position: absolute;
`;
*/
var LabelTheme = css(["font-size:", ";letter-spacing:", ";display:", ";width:100%;margin:0;color:", ";font-weight:", ";line-height:", ";", ";", " ", " ", ""], function (props) {
return props.theme.textStyles[props.textStyle].fontSize;
}, function (props) {
return props.theme.textStyles[props.textStyle].letterSpacing;
}, function (props) {
return props.variation;
}, function (props) {
return props.theme.textStyles[props.textStyle].color;
}, function (props) {
return props.theme.textStyles[props.textStyle].fontWeight;
}, function (props) {
return props.theme.textStyles[props.textStyle].lineHeight;
}, systemProps, nowrap, pointer, hidden);
var LabelElement = styled("label").withConfig({
displayName: "Label__LabelElement",
componentId: "sc-1r8ik4v-0"
})(["", ""], LabelTheme);
var Label = /*#__PURE__*/forwardRef(function (props, ref) {
return /*#__PURE__*/React.createElement(LabelElement, _extends({}, props, {
ref: ref
}));
});
Label.propTypes = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, styledProps.space), styledProps.layout), styledProps.typography), {}, {
variation: PropTypes.oneOf(["block", "inline", "none"]),
pointer: PropTypes.bool
});
Label.defaultProps = {
textStyle: "body"
};
Label.displayName = "Label";
Label.isLabel = true;
Label.__docgenInfo = {
"description": "",
"methods": [],
"displayName": "Label",
"props": {
"textStyle": {
"defaultValue": {
"value": "\"body\"",
"computed": false
},
"required": false
},
"variation": {
"description": "",
"type": {
"name": "enum",
"value": [{
"value": "\"block\"",
"computed": false
}, {
"value": "\"inline\"",
"computed": false
}, {
"value": "\"none\"",
"computed": false
}]
},
"required": false
},
"pointer": {
"description": "",
"type": {
"name": "bool"
},
"required": false
}
},
"composes": ["@styled-system/prop-types"]
};
export { Label as default };