@trackunit/react-form-components 0.1.106 → 0.1.108
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 +2 -2
- package/index.esm.js +3 -3
- package/package.json +1 -1
- package/src/components/Search/Search.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -1725,8 +1725,8 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
|
|
|
1725
1725
|
* @param {SearchProps} props - The props for the Search component
|
|
1726
1726
|
* @returns {JSX.Element} Search component
|
|
1727
1727
|
*/
|
|
1728
|
-
const Search = React.forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on",
|
|
1729
|
-
return (jsxRuntime.jsx(TextInput, { ...rest, autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, inputClassName: inputClassName, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix:
|
|
1728
|
+
const Search = React.forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, ...rest }, ref) => {
|
|
1729
|
+
return (jsxRuntime.jsx(TextInput, { ...rest, autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, inputClassName: inputClassName, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: loading ? jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", size: "small" }) : jsxRuntime.jsx(reactComponents.Icon, { name: "MagnifyingGlass", size: "medium" }), ref: ref, suffix:
|
|
1730
1730
|
//only show the clear button if there is a value and the onClear function is provided
|
|
1731
1731
|
onClear && value ? (jsxRuntime.jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
|
|
1732
1732
|
onClear();
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useNamespaceTranslation, registerTranslations, NamespaceTrans } from '@trackunit/i18n-library-translation';
|
|
3
|
-
import { IconButton, Icon, Tooltip, useIsTextCutOff, Heading, Text, MenuItem, Tag,
|
|
3
|
+
import { IconButton, Icon, Tooltip, useIsTextCutOff, Heading, Text, Spinner, MenuItem, Tag, useIsFirstRender } from '@trackunit/react-components';
|
|
4
4
|
import { useCopyToClipboard } from 'usehooks-ts';
|
|
5
5
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
6
6
|
import * as React from 'react';
|
|
@@ -1706,8 +1706,8 @@ const cvaSearch = cvaMerge([
|
|
|
1706
1706
|
* @param {SearchProps} props - The props for the Search component
|
|
1707
1707
|
* @returns {JSX.Element} Search component
|
|
1708
1708
|
*/
|
|
1709
|
-
const Search = forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on",
|
|
1710
|
-
return (jsx(TextInput, { ...rest, autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, inputClassName: inputClassName, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix:
|
|
1709
|
+
const Search = forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, ...rest }, ref) => {
|
|
1710
|
+
return (jsx(TextInput, { ...rest, autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, inputClassName: inputClassName, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: loading ? jsx(Spinner, { centering: "centered", size: "small" }) : jsx(Icon, { name: "MagnifyingGlass", size: "medium" }), ref: ref, suffix:
|
|
1711
1711
|
//only show the clear button if there is a value and the onClear function is provided
|
|
1712
1712
|
onClear && value ? (jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
|
|
1713
1713
|
onClear();
|
package/package.json
CHANGED
|
@@ -56,9 +56,9 @@ export interface SearchProps extends CommonProps, TextInputProps {
|
|
|
56
56
|
*/
|
|
57
57
|
inputClassName?: string;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Indicates whether a loading spinner should be displayed in the search box.
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
loading?: boolean;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* The Search component is used to render a search input field.
|