DocSpace-client/packages/components/label/index.js
Alexey Safronov 03b03ed910 Merge branch 'develop' into feature/sso
# Conflicts:
#	packages/client/public/images/actions.upload.react.svg
#	packages/client/public/images/empty_screen_privacy.png
#	packages/client/public/locales/en/SingleSignOn.json
#	packages/client/public/locales/ru/SingleSignOn.json
#	packages/client/src/helpers/constants.js
#	packages/client/src/pages/PortalSettings/categories/integration/index.js
#	packages/client/src/pages/PortalSettings/categories/integration/sub-components/consumerItem.js
#	packages/client/src/pages/PortalSettings/categories/integration/sub-components/consumerModalDialog.js
#	packages/client/src/pages/PortalSettings/categories/integration/sub-components/consumerToggle.js
#	packages/client/src/pages/PortalSettings/categories/integration/sub-components/modalDialogContainer.js
#	packages/client/src/pages/PortalSettings/categories/integration/sub-components/ssoLoader.js
#	packages/client/src/pages/PortalSettings/categories/integration/thirdPartyServicesSettings.js
#	packages/client/src/store/SsoFormStore.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/ThirdPartyServicesSettings/index.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/ThirdPartyServicesSettings/sub-components/consumerItem.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/ThirdPartyServicesSettings/sub-components/consumerModalDialog.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/ThirdPartyServicesSettings/sub-components/consumerToggle.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/ThirdPartyServicesSettings/sub-components/modalDialogContainer.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/sub-components/consumerItem.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/sub-components/consumerModalDialog.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/sub-components/consumerToggle.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/sub-components/modalDialogContainer.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/integration/thirdPartyServicesSettings.js
2022-08-02 12:05:15 +03:00

76 lines
1.7 KiB
JavaScript

import React from "react";
import PropTypes from "prop-types";
import Text from "../text";
const Label = (props) => {
const {
isRequired,
error,
title,
truncate,
isInline,
htmlFor,
text,
display,
className,
id,
style,
children,
theme,
} = props;
const errorProp = error ? { color: "#c30" } : {};
return (
<Text
as="label"
id={id}
style={style}
htmlFor={htmlFor}
isInline={isInline}
display={display}
{...errorProp}
fontWeight={600}
truncate={truncate}
title={title}
className={className}
>
{text} {isRequired && " *"} {children}
</Text>
);
};
Label.propTypes = {
/** Indicates that the field to which the label is attached is required to fill */
isRequired: PropTypes.bool,
/** Indicates that the field to which the label is attached is incorrect */
error: PropTypes.bool,
/** Sets the 'display: inline-block' property */
isInline: PropTypes.bool,
/** Title */
title: PropTypes.string,
/** Disables word wrapping */
truncate: PropTypes.bool,
/** The field ID to which the label is attached */
htmlFor: PropTypes.string,
/** Text or element */
text: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
/** Sets the 'display' property */
display: PropTypes.string,
/** Class name */
className: PropTypes.string,
/** Accepts id */
id: PropTypes.string,
/** Accepts css style */
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
children: PropTypes.node,
};
Label.defaultProps = {
isRequired: false,
error: false,
isInline: false,
truncate: false,
};
export default Label;