@carbon/ibm-products
Version:
Carbon for IBM Products
119 lines (117 loc) • 3.48 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 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.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_devtools = require("../../global/js/utils/devtools.js");
const require_props_helper = require("../../global/js/utils/props-helper.js");
const require_AddSelect = require("../AddSelect/AddSelect.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
//#region src/components/SingleAddSelect/SingleAddSelect.tsx
const componentName = "SingleAddSelect";
/**
* Used to add or select one or more items from larger lists or hierarchies.
*/
const SingleAddSelect = (0, react.forwardRef)((props, ref) => {
const validProps = require_props_helper.prepareProps(props, [
"columnInputPlaceholder",
"globalFilters",
"globalFiltersIconDescription",
"globalFiltersPlaceholderText",
"globalFiltersPrimaryButtonText",
"globalFiltersSecondaryButtonText",
"influencerTitle",
"multi",
"noSelectionDescription",
"noSelectionTitle",
"removeIconDescription"
]);
return /* @__PURE__ */ react.default.createElement(require_AddSelect.AddSelect, {
...validProps,
ref,
...require_devtools.getDevtoolsProps(componentName),
multi: false
});
});
SingleAddSelect.propTypes = {
/**
* optional class name
*/
/**@ts-ignore */
className: prop_types.default.string,
/**
* text description that appears under the title
*/
description: prop_types.default.string,
/**
* label for global search input
*/
globalSearchLabel: prop_types.default.string,
/**
* placeholder for global search input
*/
globalSearchPlaceholder: prop_types.default.string,
/**
* object that contains the item data. for more information reference the
* "Structuring items" section in the docs tab
*/
/**@ts-ignore */
items: prop_types.default.shape({ entries: prop_types.default.arrayOf(prop_types.default.shape({
children: prop_types.default.object,
id: prop_types.default.string.isRequired,
title: prop_types.default.string.isRequired,
value: prop_types.default.string.isRequired
})) }),
/**
* label that display above the list of items
*/
itemsLabel: prop_types.default.string,
/**
* text to display when no results are found from the global search
*/
noResultsDescription: prop_types.default.string,
/**
* title to display when no results are found from the global search
*/
noResultsTitle: prop_types.default.string,
/**
* Determines if the component should be rendered within a Tearsheet component
*/
noTearsheet: prop_types.default.bool,
/**
* function to call when the close button clicked
*/
onClose: prop_types.default.func,
/**
* text for close button
*/
onCloseButtonText: prop_types.default.string,
/**
* function to call when the submit button is clicked. returns a selection
*/
onSubmit: prop_types.default.func,
/**
* text for the submit button
*/
onSubmitButtonText: prop_types.default.string,
/**
* specifies if the component is open or not
*/
open: prop_types.default.bool,
/**
* text that displays when displaying filtered items
*/
searchResultsLabel: prop_types.default.string,
/**
* header text
*/
title: prop_types.default.string
};
SingleAddSelect.displayName = componentName;
//#endregion
exports.SingleAddSelect = SingleAddSelect;