@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 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", prefix = jsxRuntime.jsx(reactComponents.Icon, { name: "MagnifyingGlass", size: "medium" }), 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: prefix, ref: ref, suffix:
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, Spinner, useIsFirstRender } from '@trackunit/react-components';
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", prefix = jsx(Icon, { name: "MagnifyingGlass", size: "medium" }), 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: prefix, ref: ref, suffix:
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "0.1.106",
3
+ "version": "0.1.108",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -56,9 +56,9 @@ export interface SearchProps extends CommonProps, TextInputProps {
56
56
  */
57
57
  inputClassName?: string;
58
58
  /**
59
- * A React element to render before the text in the input.
59
+ * Indicates whether a loading spinner should be displayed in the search box.
60
60
  */
61
- prefix?: React.ReactNode;
61
+ loading?: boolean;
62
62
  }
63
63
  /**
64
64
  * The Search component is used to render a search input field.