UNPKG

@fluentui/react-northstar

Version:
76 lines (75 loc) 2.7 kB
import { formFieldBehavior } from '@fluentui/accessibility'; import * as PropTypes from 'prop-types'; import * as React from 'react'; import { commonPropTypes } from '../../utils'; import { getElementType, useUnhandledProps, useTelemetry, useFluentContext, useStyles, useAccessibility } from '@fluentui/react-bindings'; export var formFieldCustomClassName = 'ui-form__fieldcustom'; /** * A FormFieldCustom represents a Form element containing a label and an input. */ export var FormFieldCustom = /*#__PURE__*/function () { var FormFieldCustom = /*#__PURE__*/React.forwardRef(function (props, ref) { var context = useFluentContext(); var _useTelemetry = useTelemetry(FormFieldCustom.displayName, context.telemetry), setStart = _useTelemetry.setStart, setEnd = _useTelemetry.setEnd; setStart(); var children = props.children, required = props.required, type = props.type, className = props.className, design = props.design, styles = props.styles, variables = props.variables, inline = props.inline; var ElementType = getElementType(props); var unhandledProps = useUnhandledProps(FormFieldCustom.handledProps, props); var getA11yProps = useAccessibility(props.accessibility, { debugName: FormFieldCustom.displayName, rtl: context.rtl }); var _useStyles = useStyles(FormFieldCustom.displayName, { className: formFieldCustomClassName, mapPropsToStyles: function mapPropsToStyles() { return { type: type, inline: inline, required: required }; }, mapPropsToInlineStyles: function mapPropsToInlineStyles() { return { className: className, design: design, styles: styles, variables: variables }; }, rtl: context.rtl }), classes = _useStyles.classes; var element = /*#__PURE__*/React.createElement(ElementType, getA11yProps('root', Object.assign({ className: classes.root, ref: ref }, unhandledProps)), children); setEnd(); return element; }); FormFieldCustom.displayName = 'FormFieldCustom'; FormFieldCustom.propTypes = Object.assign({}, commonPropTypes.createCommon({ content: false, children: false }), { id: PropTypes.string, inline: PropTypes.bool, name: PropTypes.string, required: PropTypes.bool, type: PropTypes.string }); FormFieldCustom.handledProps = Object.keys(FormFieldCustom.propTypes); FormFieldCustom.defaultProps = { accessibility: formFieldBehavior }; return FormFieldCustom; }(); //# sourceMappingURL=FormFieldCustom.js.map