UNPKG

@lanaco/lnc-react-ui

Version:

React component library

275 lines (274 loc) 7.27 kB
import { jsx as g } from "react/jsx-runtime"; import { P as e } from "./index-S5Cd7WrG.js"; import { forwardRef as y, useCallback as h } from "react"; import { a as M } from "./CustomStyles-BwnfUVvi.js"; import { d as S } from "./index-CkWvbrVT.js"; import C from "./DropdownLookup.js"; import { u as I } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js"; const T = y((l, t) => { const { // defaultOptions, // cacheOptions, // loadOptions, styles: n, debounceTime: s = 0, // name, // hideSelectedOptions, // id, // inputId, // value, // readOnly, // tabIndex, isSearchable: u = !0, isClearable: a = !0, // isLoading, // isRtl, // isDisabled, // closeMenuOnSelect, // closeMenuOnScroll, // escapeClearsValue, // filterOption, // formatGroupLabel, // formatOptionLabel, // getOptionLabel, // getOptionValue, // isOptionDisabled, // isOptionSelected, // loadingMessage, // minMenuHeight, // maxMenuHeight, // menuPlacement, // menuPosition, // menuShouldBlockScroll, // menuShouldScrollIntoView, // openMenuOnFocus, // openMenuOnClick, // autoFocus, // placeholder, // noOptionsMessage, // menuIsOpen, // components, // defaultValue, // defaultInputValue, // defaultMenuIsOpen, // delimiter, // onChange, onInputChange: o, // onMenuOpen, // onMenuClose, // onBlur, // onFocus, // onKeyDown, size: r = "small", color: i = "primary", className: c = "", style: m = {}, // children, ...p } = l, f = I(), b = h( S((d, O) => { o == null || o(d, O); }, s) ); return /* @__PURE__ */ g( C, { isMulti: !0, ref: t, styles: n || M, size: r, color: i, theme: f, isSearchable: u, isClearable: a, onInputChange: b, className: c, style: m, ...p } ); }); T.propTypes = { /** * The default set of options to show before the user starts searching. When set to true, the results for loadOptions('') will be autoloaded. */ defaultOptions: e.oneOfType([e.bool, e.array]), /** * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value. */ cacheOptions: e.any, /** * Function that returns a promise, which is the set of options to be used once the promise resolves. */ loadOptions: e.func, styles: e.object, debounceTime: e.number, name: e.string, value: e.any, /** * Sets the tabIndex attribute on the input */ tabIndex: e.number, /** * Whether to enable search functionality */ isSearchable: e.bool, isClearable: e.bool, /** * Is the select in a state of loading (async) */ isLoading: e.bool, /** * Is the select direction right-to-left */ isRtl: e.bool, isDisabled: e.bool, readOnly: e.bool, /** * Close the select menu when the user selects an option */ closeMenuOnSelect: e.bool, /** * If true, close the select menu when the user scrolls the document/body. * If a function, takes a standard javascript ScrollEvent you return a boolean: * true => The menu closes * false => The menu stays open * This is useful when you have a scrollable modal and want to portal the menu out, but want to avoid graphical issues. */ closeMenuOnScroll: e.oneOfType([e.bool, e.func]), /** * Clear all values when the user presses escape AND the menu is closed */ escapeClearsValue: e.bool, /** * Custom method to filter whether an option should be displayed in the menu. Type: `null` or `() => boolean` */ filterOption: e.func, /** * Formats group labels in the menu as React components */ formatGroupLabel: e.func, /** * Formats option labels in the menu and control as React components */ formatOptionLabel: e.func, /** * Resolves option data to a string to be displayed as the label by components * Note: Failure to resolve to a string type can interfere with filtering and screen reader support. */ getOptionLabel: e.func, /** * Resolves option data to a string to compare options and specify value attributes */ getOptionValue: e.func, /** * Hide the selected option from the menu */ hideSelectedOptions: e.bool, /** * The id to set on the SelectContainer component */ id: e.string, /** * The id of the search input */ inputId: e.string, /** * Override the built-in logic to detect whether an option is disabled. `(...) => boolean` */ isOptionDisabled: e.func, /** * Override the built-in logic to detect whether an option is selected. `(...) => boolean` */ isOptionSelected: e.func, /** * Async: Text to display when loading options `(...) => ...` */ loadingMessage: e.func, /** * Minimum height of the menu before flipping */ minMenuHeight: e.number, /** * Maximum height of the menu before flipping */ maxMenuHeight: e.number, /** * Default placement of the menu in relation to the control. 'auto' will flip when there isn't enough space below the control. */ menuPlacement: e.oneOf(["bottom", "auto", "top"]), /** *The CSS position value of the menu, when "fixed" extra layout management is required. */ menuPosition: e.oneOf(["absolute", "fixed"]), /** * Whether to block scroll events when the menu is open */ menuShouldBlockScroll: e.bool, /** * Whether the menu should be scrolled into view when it opens */ menuShouldScrollIntoView: e.bool, /** * Allows control of whether the menu is opened when the Select is focused */ openMenuOnFocus: e.bool, /** * Allows control of whether the menu is opened when the Select is clicked */ openMenuOnClick: e.bool, //---- autoFocus: e.bool, placeholder: e.any, noOptionsMessage: e.string, menuIsOpen: e.bool, /** * This complex object includes all the compositional components that are used in react-select. If you wish to overwrite a component, pass in an object with the appropriate namespace. * If you only wish to restyle a component, we recommend using the styles prop instead. */ components: e.object, /** * initial value of the control */ defaultValue: e.string, /** * initial value of the search input */ defaultInputValue: e.string, /** * initial open value of the menu */ defaultMenuIsOpen: e.bool, /** * Delimiter used to join multiple values into a single HTML Input value */ delimiter: e.string, //--------------------------------------------------------------- onChange: e.func, /** * control the value of the search input (changing this will update the available options) */ onInputChange: e.func, onMenuOpen: e.func, onMenuClose: e.func, onFocus: e.func, onBlur: e.func, onKeyDown: e.func, //--------------------------------------------------------------- className: e.string, style: e.object, color: e.oneOf([ "primary", "secondary", "success", "warning", "danger", "information", "neutral", "gray" ]), size: e.oneOf(["small", "medium", "large"]) }; export { T as default };