@trackunit/react-form-components 1.0.30 → 1.0.31

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
@@ -1801,12 +1801,12 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
1801
1801
  * @param {SearchProps} props - The props for the Search component
1802
1802
  * @returns {JSX.Element} Search component
1803
1803
  */
1804
- const Search = React.forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, iconName = "MagnifyingGlass", ...rest }, ref) => {
1804
+ const Search = React.forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, iconName = "MagnifyingGlass", xMarkRef, ...rest }, ref) => {
1805
1805
  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: rest.fieldSize ?? undefined })) : (jsxRuntime.jsx(reactComponents.Icon, { name: iconName, size: rest.fieldSize ?? undefined })), ref: ref, suffix:
1806
1806
  //only show the clear button if there is a value and the onClear function is provided
1807
1807
  onClear && value ? (jsxRuntime.jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
1808
1808
  onClear();
1809
- }, type: "button", children: jsxRuntime.jsx(reactComponents.Icon, { name: "XMark", size: "small" }) })) : undefined, value: value }));
1809
+ }, ref: xMarkRef, type: "button", children: jsxRuntime.jsx(reactComponents.Icon, { name: "XMark", size: "small" }) })) : undefined, value: value }));
1810
1810
  });
1811
1811
  Search.displayName = "Search";
1812
1812
 
package/index.esm.js CHANGED
@@ -1782,12 +1782,12 @@ const cvaSearch = cvaMerge([
1782
1782
  * @param {SearchProps} props - The props for the Search component
1783
1783
  * @returns {JSX.Element} Search component
1784
1784
  */
1785
- const Search = forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, iconName = "MagnifyingGlass", ...rest }, ref) => {
1785
+ const Search = forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, iconName = "MagnifyingGlass", xMarkRef, ...rest }, ref) => {
1786
1786
  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: rest.fieldSize ?? undefined })) : (jsx(Icon, { name: iconName, size: rest.fieldSize ?? undefined })), ref: ref, suffix:
1787
1787
  //only show the clear button if there is a value and the onClear function is provided
1788
1788
  onClear && value ? (jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
1789
1789
  onClear();
1790
- }, type: "button", children: jsx(Icon, { name: "XMark", size: "small" }) })) : undefined, value: value }));
1790
+ }, ref: xMarkRef, type: "button", children: jsx(Icon, { name: "XMark", size: "small" }) })) : undefined, value: value }));
1791
1791
  });
1792
1792
  Search.displayName = "Search";
1793
1793
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -18,7 +18,7 @@
18
18
  "react-hook-form": "7.53.1",
19
19
  "tailwind-merge": "^2.0.0",
20
20
  "@trackunit/css-class-variance-utilities": "1.0.8",
21
- "@trackunit/react-components": "1.1.12",
21
+ "@trackunit/react-components": "1.1.13",
22
22
  "@trackunit/ui-icons": "1.0.11",
23
23
  "@trackunit/shared-utils": "1.2.5",
24
24
  "@trackunit/i18n-library-translation": "1.0.17"
@@ -65,6 +65,10 @@ export interface SearchProps extends CommonProps, TextInputProps {
65
65
  */
66
66
  iconName?: IconName;
67
67
  style?: React.CSSProperties;
68
+ /**
69
+ * Ref object for the "Clear" button (with the XMark icon), allowing external control of the button.
70
+ */
71
+ xMarkRef?: React.RefObject<HTMLButtonElement>;
68
72
  }
69
73
  /**
70
74
  * The Search component is used to render a search input field.