@carbon/react
Version:
React components for the Carbon Design System
54 lines (52 loc) • 1.66 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { usePrefix } from "../../internal/usePrefix.js";
import { FormContext } from "../FluidForm/FormContext.js";
import DatePicker_default from "../DatePicker/index.js";
import classNames from "classnames";
import React from "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/FluidDatePicker/FluidDatePicker.tsx
/**
* Copyright IBM Corp. 2022, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const FluidDatePicker = React.forwardRef(function FluidDatePicker({ className, children, invalid, readOnly, warn, ...other }, ref) {
const prefix = usePrefix();
const classNames$1 = classNames(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__ */ jsx(FormContext.Provider, {
value: { isFluid: true },
children: /* @__PURE__ */ jsx(DatePicker_default, {
invalid,
readOnly,
warn,
className: classNames$1,
ref,
...other,
children
})
});
});
FluidDatePicker.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
invalid: PropTypes.bool,
invalidText: PropTypes.node,
readOnly: PropTypes.bool,
warn: PropTypes.bool,
warnText: PropTypes.node
};
//#endregion
export { FluidDatePicker as default };