@trackunit/react-form-components 0.1.90 → 0.1.91
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 +2 -2
- package/package.json +1 -1
- package/src/components/Search/Search.d.ts +8 -0
package/index.cjs.js
CHANGED
|
@@ -1726,8 +1726,8 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
|
|
|
1726
1726
|
* @param {SearchProps} props - The props for the Search component
|
|
1727
1727
|
* @returns {JSX.Element} Search component
|
|
1728
1728
|
*/
|
|
1729
|
-
const Search = React.forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", ...rest }, ref) => {
|
|
1730
|
-
return (jsxRuntime.jsx(TextInput, { ...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:
|
|
1729
|
+
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) => {
|
|
1730
|
+
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:
|
|
1731
1731
|
//only show the clear button if there is a value and the onClear function is provided
|
|
1732
1732
|
onClear && value ? (jsxRuntime.jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
|
|
1733
1733
|
onClear();
|
package/index.esm.js
CHANGED
|
@@ -1707,8 +1707,8 @@ const cvaSearch = cvaMerge([
|
|
|
1707
1707
|
* @param {SearchProps} props - The props for the Search component
|
|
1708
1708
|
* @returns {JSX.Element} Search component
|
|
1709
1709
|
*/
|
|
1710
|
-
const Search = forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", ...rest }, ref) => {
|
|
1711
|
-
return (jsx(TextInput, { ...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:
|
|
1710
|
+
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) => {
|
|
1711
|
+
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:
|
|
1712
1712
|
//only show the clear button if there is a value and the onClear function is provided
|
|
1713
1713
|
onClear && value ? (jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
|
|
1714
1714
|
onClear();
|
package/package.json
CHANGED
|
@@ -51,6 +51,14 @@ export interface SearchProps extends CommonProps, TextInputProps {
|
|
|
51
51
|
* Event that search box is cleared.
|
|
52
52
|
*/
|
|
53
53
|
onClear?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* A custom class name to be attached to input element
|
|
56
|
+
*/
|
|
57
|
+
inputClassName?: string;
|
|
58
|
+
/**
|
|
59
|
+
* A React element to render before the text in the input.
|
|
60
|
+
*/
|
|
61
|
+
prefix?: React.ReactNode;
|
|
54
62
|
}
|
|
55
63
|
/**
|
|
56
64
|
* The Search component is used to render a search input field.
|