@trackunit/react-form-components 0.0.355 → 0.0.359
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js
CHANGED
|
@@ -1360,7 +1360,7 @@ const TextInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput, Ob
|
|
|
1360
1360
|
|
|
1361
1361
|
const cvaSearch = cssClassVarianceUtilities.cvaMerge([
|
|
1362
1362
|
"shadow-none",
|
|
1363
|
-
"component-search-
|
|
1363
|
+
"component-search-border",
|
|
1364
1364
|
"component-search-background",
|
|
1365
1365
|
"hover:component-search-background",
|
|
1366
1366
|
"hover:component-search-focus-hover",
|
|
@@ -1370,7 +1370,7 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
|
|
|
1370
1370
|
"duration-300",
|
|
1371
1371
|
], {
|
|
1372
1372
|
variants: {
|
|
1373
|
-
border: { true: ["!component-search-
|
|
1373
|
+
border: { true: ["!component-search-borderless"], false: "" },
|
|
1374
1374
|
widenOnFocus: {
|
|
1375
1375
|
true: [
|
|
1376
1376
|
"component-search-width",
|
|
@@ -1391,8 +1391,8 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
|
|
|
1391
1391
|
* @returns {JSX.Element} Search component
|
|
1392
1392
|
*/
|
|
1393
1393
|
const Search = React.forwardRef((_a, ref) => {
|
|
1394
|
-
var { className, placeholder = "Search", value, widenInputOnFocus,
|
|
1395
|
-
return (jsxRuntime.jsx(TextInput, Object.assign({}, rest, { autoComplete: autoComplete, className: cvaSearch({ className, border:
|
|
1394
|
+
var { className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on" } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "hideBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete"]);
|
|
1395
|
+
return (jsxRuntime.jsx(TextInput, Object.assign({}, rest, { autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "MagnifyingGlass", size: "medium" }), ref: ref, suffix: onClear ? (jsxRuntime.jsx("button", { className: "flex", "data-testid": dataTestId && `${dataTestId}_suffix_component`, onClick: () => {
|
|
1396
1396
|
onClear();
|
|
1397
1397
|
}, children: jsxRuntime.jsx(reactComponents.Icon, { name: "XMark", size: "small" }) })) : undefined, value: value })));
|
|
1398
1398
|
});
|
|
@@ -1823,7 +1823,7 @@ CreatableSelect.displayName = "CreatableSelect";
|
|
|
1823
1823
|
*/
|
|
1824
1824
|
const Select = (props) => {
|
|
1825
1825
|
const { className } = props, propsNoClassName = __rest(props, ["className"]);
|
|
1826
|
-
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, } = props;
|
|
1826
|
+
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
|
|
1827
1827
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1828
1828
|
const selectProps = {
|
|
1829
1829
|
value,
|
|
@@ -1851,8 +1851,9 @@ const Select = (props) => {
|
|
|
1851
1851
|
id,
|
|
1852
1852
|
onMenuScrollToBottom,
|
|
1853
1853
|
onInputChange,
|
|
1854
|
+
hideSelectedOptions,
|
|
1854
1855
|
};
|
|
1855
|
-
return (jsxRuntime.jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsxRuntime.jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncSelect__default["default"], Object.assign({}, propsNoClassName, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler }))) : (jsxRuntime.jsx(ReactSelect__default["default"], Object.assign({}, propsNoClassName, selectProps, {
|
|
1856
|
+
return (jsxRuntime.jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsxRuntime.jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncSelect__default["default"], Object.assign({}, propsNoClassName, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler }))) : (jsxRuntime.jsx(ReactSelect__default["default"], Object.assign({}, propsNoClassName, selectProps, { isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options })))] }));
|
|
1856
1857
|
};
|
|
1857
1858
|
Select.displayName = "Select";
|
|
1858
1859
|
|
package/index.esm.js
CHANGED
|
@@ -1330,7 +1330,7 @@ const TextInput = forwardRef((props, ref) => (jsx(BaseInput, Object.assign({ ref
|
|
|
1330
1330
|
|
|
1331
1331
|
const cvaSearch = cvaMerge([
|
|
1332
1332
|
"shadow-none",
|
|
1333
|
-
"component-search-
|
|
1333
|
+
"component-search-border",
|
|
1334
1334
|
"component-search-background",
|
|
1335
1335
|
"hover:component-search-background",
|
|
1336
1336
|
"hover:component-search-focus-hover",
|
|
@@ -1340,7 +1340,7 @@ const cvaSearch = cvaMerge([
|
|
|
1340
1340
|
"duration-300",
|
|
1341
1341
|
], {
|
|
1342
1342
|
variants: {
|
|
1343
|
-
border: { true: ["!component-search-
|
|
1343
|
+
border: { true: ["!component-search-borderless"], false: "" },
|
|
1344
1344
|
widenOnFocus: {
|
|
1345
1345
|
true: [
|
|
1346
1346
|
"component-search-width",
|
|
@@ -1361,8 +1361,8 @@ const cvaSearch = cvaMerge([
|
|
|
1361
1361
|
* @returns {JSX.Element} Search component
|
|
1362
1362
|
*/
|
|
1363
1363
|
const Search = forwardRef((_a, ref) => {
|
|
1364
|
-
var { className, placeholder = "Search", value, widenInputOnFocus,
|
|
1365
|
-
return (jsx(TextInput, Object.assign({}, rest, { autoComplete: autoComplete, className: cvaSearch({ className, border:
|
|
1364
|
+
var { className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on" } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "hideBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete"]);
|
|
1365
|
+
return (jsx(TextInput, Object.assign({}, rest, { autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: jsx(Icon, { name: "MagnifyingGlass", size: "medium" }), ref: ref, suffix: onClear ? (jsx("button", { className: "flex", "data-testid": dataTestId && `${dataTestId}_suffix_component`, onClick: () => {
|
|
1366
1366
|
onClear();
|
|
1367
1367
|
}, children: jsx(Icon, { name: "XMark", size: "small" }) })) : undefined, value: value })));
|
|
1368
1368
|
});
|
|
@@ -1793,7 +1793,7 @@ CreatableSelect.displayName = "CreatableSelect";
|
|
|
1793
1793
|
*/
|
|
1794
1794
|
const Select = (props) => {
|
|
1795
1795
|
const { className } = props, propsNoClassName = __rest(props, ["className"]);
|
|
1796
|
-
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, } = props;
|
|
1796
|
+
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
|
|
1797
1797
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1798
1798
|
const selectProps = {
|
|
1799
1799
|
value,
|
|
@@ -1821,8 +1821,9 @@ const Select = (props) => {
|
|
|
1821
1821
|
id,
|
|
1822
1822
|
onMenuScrollToBottom,
|
|
1823
1823
|
onInputChange,
|
|
1824
|
+
hideSelectedOptions,
|
|
1824
1825
|
};
|
|
1825
|
-
return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx(ReactAsyncSelect, Object.assign({}, propsNoClassName, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler }))) : (jsx(ReactSelect, Object.assign({}, propsNoClassName, selectProps, {
|
|
1826
|
+
return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx(ReactAsyncSelect, Object.assign({}, propsNoClassName, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler }))) : (jsx(ReactSelect, Object.assign({}, propsNoClassName, selectProps, { isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options })))] }));
|
|
1826
1827
|
};
|
|
1827
1828
|
Select.displayName = "Select";
|
|
1828
1829
|
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export interface SearchProps extends CommonProps, TextInputProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* Whether the border for the search box should be displayed while the search box is not in focus.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
hideBorderWhenNotInFocus?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* Value rendered in the search box.
|
|
24
24
|
*/
|
|
@@ -34,6 +34,7 @@ export declare const CreatableSelect: {
|
|
|
34
34
|
isClearable?: boolean | undefined;
|
|
35
35
|
isSearchable?: boolean | undefined;
|
|
36
36
|
isAsync?: IsAsync | undefined;
|
|
37
|
+
hideSelectedOptions?: boolean | undefined;
|
|
37
38
|
} & CreatableSelectProps): JSX.Element;
|
|
38
39
|
displayName: string;
|
|
39
40
|
};
|
|
@@ -113,6 +113,13 @@ export type SelectProps<Option, IsAsync extends boolean, IsMulti extends boolean
|
|
|
113
113
|
* @memberof SelectProps
|
|
114
114
|
*/
|
|
115
115
|
isAsync?: IsAsync;
|
|
116
|
+
/**
|
|
117
|
+
* A handler for menu close event
|
|
118
|
+
* use if you want to trigger custom logic
|
|
119
|
+
*
|
|
120
|
+
* @memberof SelectProps
|
|
121
|
+
*/
|
|
122
|
+
hideSelectedOptions?: boolean;
|
|
116
123
|
};
|
|
117
124
|
interface IUseSelect<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> {
|
|
118
125
|
customStyles: StylesConfig<Option, IsMulti, Group>;
|