@carbon/react
Version:
React components for the Carbon Design System
90 lines (82 loc) • 2.84 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var PropTypes = require('prop-types');
var cx = require('classnames');
var DatePicker = require('../DatePicker/DatePicker.js');
require('../DatePicker/DatePicker.Skeleton.js');
var usePrefix = require('../../internal/usePrefix.js');
var FormContext = require('../FluidForm/FormContext.js');
var React = require('react');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
const FluidDatePicker = /*#__PURE__*/React__default["default"].forwardRef(function FluidDatePicker({
className,
children,
invalid,
invalidText,
readOnly,
warn,
warnText,
...other
}, ref) {
const prefix = usePrefix.usePrefix();
const classNames = cx__default["default"](className, {
[`${prefix}--date-picker--fluid`]: true,
[`${prefix}--date-picker--fluid--invalid`]: invalid,
[`${prefix}--date-picker--fluid--readonly`]: readOnly,
[`${prefix}--date-picker--fluid--warn`]: warn
});
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
value: {
isFluid: true
}
}, /*#__PURE__*/React__default["default"].createElement(DatePicker["default"], _rollupPluginBabelHelpers["extends"]({
invalid: invalid,
invalidText: invalidText,
readOnly: readOnly,
warn: warn,
warnText: warnText,
className: classNames,
ref: ref
}, other), children));
});
FluidDatePicker.propTypes = {
/**
* The child node(s)
*/
children: PropTypes__default["default"].node,
/**
* Specify an optional className to be applied to the outer FluidForm wrapper
*/
className: PropTypes__default["default"].string,
/**
* Specify whether or not the control is invalid
*/
invalid: PropTypes__default["default"].bool,
/**
* Provide the text that is displayed when the control is in error state
*/
invalidText: PropTypes__default["default"].node,
/**
* Whether the input should be read-only
*/
readOnly: PropTypes__default["default"].bool,
/**
* Specify whether the control is currently in warning state
*/
warn: PropTypes__default["default"].bool,
/**
* Provide the text that is displayed when the control is in warning state
*/
warnText: PropTypes__default["default"].node
};
exports["default"] = FluidDatePicker;