UNPKG

@lanaco/lnc-react-ui

Version:

React component library

267 lines (266 loc) 6.93 kB
import { jsx as g } from "react/jsx-runtime"; import { P as e } from "./index-S5Cd7WrG.js"; import * as O from "react"; import { forwardRef as a, useCallback as S } from "react"; import { u as y, S as M, a as h } from "./CustomStyles-BwnfUVvi.js"; import { c as H } from "./CustomStyles-BwnfUVvi.js"; import { _ as C, u as I } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js"; import "./index-64mXPFBC.js"; import { d as x } from "./index-CkWvbrVT.js"; var T = /* @__PURE__ */ a(function(n, t) { var o = y(n); return /* @__PURE__ */ O.createElement(M, C({ ref: t }, o)); }), P = T; const V = a((n, t) => { const { // options, styles: o, debounceTime: l = 0, name: j, // hideSelectedOptions, // id, // inputId, // value, // readOnly, // tabIndex, isSearchable: s = !0, isClearable: r = !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, // onMenuOpen, // onMenuClose, // onBlur, // onFocus, size: u = "small", color: i = "primary", className: c = "", style: m = {}, // children, ...p } = n, b = I(); return S( x((f, d) => { onInputChange == null || onInputChange(f, d); }, l) ), /* @__PURE__ */ g( P, { ref: t, styles: o || h, size: u, color: i, theme: b, isSearchable: s, isClearable: r, className: c, style: m, ...p } ); }); V.propTypes = { options: e.array, 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.any, /** * 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, //--------------------------------------------------------------- className: e.string, style: e.object, color: e.oneOf([ "primary", "secondary", "success", "warning", "danger", "information", "neutral", "gray" ]), size: e.oneOf(["small", "medium", "large"]) }; export { H as components, V as default };