Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Form.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
  3. import classNames from 'classnames';
  4. import React from 'react';
  5. import FormCheck from './FormCheck';
  6. import FormControl from './FormControl';
  7. import FormGroup from './FormGroup';
  8. import FormLabel from './FormLabel';
  9. import FormText from './FormText';
  10. import Switch from './Switch';
  11. import { useBootstrapPrefix } from './ThemeProvider';
  12. import createWithBsPrefix from './utils/createWithBsPrefix';
  13. var defaultProps = {
  14. inline: false
  15. };
  16. var Form = React.forwardRef(function (_ref, ref) {
  17. var bsPrefix = _ref.bsPrefix,
  18. inline = _ref.inline,
  19. className = _ref.className,
  20. validated = _ref.validated,
  21. _ref$as = _ref.as,
  22. Component = _ref$as === void 0 ? 'form' : _ref$as,
  23. props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "inline", "className", "validated", "as"]);
  24. bsPrefix = useBootstrapPrefix(bsPrefix, 'form');
  25. return React.createElement(Component, _extends({}, props, {
  26. ref: ref,
  27. className: classNames(className, validated && 'was-validated', inline && bsPrefix + "-inline")
  28. }));
  29. });
  30. Form.displayName = 'Form';
  31. Form.defaultProps = defaultProps;
  32. Form.Row = createWithBsPrefix('form-row');
  33. Form.Group = FormGroup;
  34. Form.Control = FormControl;
  35. Form.Check = FormCheck;
  36. Form.Switch = Switch;
  37. Form.Label = FormLabel;
  38. Form.Text = FormText;
  39. export default Form;