@carbon/react
Version:
React components for the Carbon Design System
51 lines (49 loc) • 1.63 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 Search_default from "../Search/index.js";
import classNames from "classnames";
import { forwardRef } from "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/FluidSearch/FluidSearch.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 FluidSearch = forwardRef(({ className, ...other }, ref) => {
const classNames$1 = classNames(`${usePrefix()}--search--fluid`, className);
return /* @__PURE__ */ jsx(FormContext.Provider, {
value: { isFluid: true },
children: /* @__PURE__ */ jsx(Search_default, {
ref,
className: classNames$1,
...other
})
});
});
FluidSearch.propTypes = {
autoComplete: PropTypes.string,
className: PropTypes.string,
closeButtonLabelText: PropTypes.string,
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
disabled: PropTypes.bool,
id: PropTypes.string,
labelText: PropTypes.node.isRequired,
onChange: PropTypes.func,
onClear: PropTypes.func,
onKeyDown: PropTypes.func,
placeholder: PropTypes.string,
role: PropTypes.string,
type: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};
//#endregion
export { FluidSearch as default };