@trackunit/react-form-components 0.0.139 → 0.0.140
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 +10 -10
- package/index.esm.js +10 -10
- package/package.json +3 -2
package/index.cjs.js
CHANGED
|
@@ -97,12 +97,12 @@ const ActionButton = ({ type, value, dataTestId, iconSize, disabled, className,
|
|
|
97
97
|
const getIconName = () => {
|
|
98
98
|
switch (type) {
|
|
99
99
|
case "PHONE_NUMBER":
|
|
100
|
-
return "
|
|
100
|
+
return "PhoneArrowUpRight";
|
|
101
101
|
case "WEB_ADDRESS":
|
|
102
|
-
return "
|
|
102
|
+
return "ArrowTopRightOnSquare";
|
|
103
103
|
case "EMAIL":
|
|
104
104
|
default:
|
|
105
|
-
return "
|
|
105
|
+
return "Envelope";
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
const ButtonAction = () => {
|
|
@@ -2922,7 +2922,7 @@ const DateInput = React.forwardRef((_a, ref) => {
|
|
|
2922
2922
|
const formatDateToInputString = (date) => date instanceof Date ? format(date, "yyyy-MM-dd") : date;
|
|
2923
2923
|
// Chrome and Firefox need their default icon to have datepicker functionality.
|
|
2924
2924
|
const showIcon = !/Chrome/.test(navigator.userAgent) && !/Firefox/.test(navigator.userAgent);
|
|
2925
|
-
return (jsxRuntime.jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: showIcon && jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "calendar", name: "
|
|
2925
|
+
return (jsxRuntime.jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: showIcon && jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "calendar", name: "Calendar", size: "medium", type: "solid" }) }, rest)));
|
|
2926
2926
|
});
|
|
2927
2927
|
|
|
2928
2928
|
/**
|
|
@@ -3063,7 +3063,7 @@ const DropZone = (_a) => {
|
|
|
3063
3063
|
e.preventDefault();
|
|
3064
3064
|
e.stopPropagation();
|
|
3065
3065
|
}
|
|
3066
|
-
} }, rest, { children: [jsxRuntime.jsx("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxRuntime.jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsxRuntime.jsx(reactComponents.Icon, { type: "solid", name: "
|
|
3066
|
+
} }, rest, { children: [jsxRuntime.jsx("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxRuntime.jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsxRuntime.jsx(reactComponents.Icon, { type: "solid", name: "ArrowUpCircle", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsxRuntime.jsx("span", { children: label })] })] })));
|
|
3067
3067
|
};
|
|
3068
3068
|
|
|
3069
3069
|
/**
|
|
@@ -14090,7 +14090,7 @@ const getOrderedOptions = (options, value) => {
|
|
|
14090
14090
|
* @returns {JSX.Element} SingleSelectMenuItem
|
|
14091
14091
|
*/
|
|
14092
14092
|
const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, focused, disabled, }) => {
|
|
14093
|
-
return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { name: "
|
|
14093
|
+
return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { name: "Check", size: "small" }) : undefined }));
|
|
14094
14094
|
};
|
|
14095
14095
|
/**
|
|
14096
14096
|
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
@@ -14239,13 +14239,13 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
14239
14239
|
}, LoadingIndicator: props => {
|
|
14240
14240
|
return jsxRuntime.jsx(reactComponents.Spinner, { size: "small", className: "mt-1.5 mr-1" });
|
|
14241
14241
|
}, DropdownIndicator: props => {
|
|
14242
|
-
const icon = props.selectProps.menuIsOpen ? (jsxRuntime.jsx(reactComponents.Icon, { name: "
|
|
14242
|
+
const icon = props.selectProps.menuIsOpen ? (jsxRuntime.jsx(reactComponents.Icon, { name: "ChevronUp", size: "medium" })) : (jsxRuntime.jsx(reactComponents.Icon, { name: "ChevronDown", size: "medium" }));
|
|
14243
14243
|
return props.selectProps.isLoading ? null : (jsxRuntime.jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx("div", { className: cvaSelectIcon(), children: dropdownIcon ? dropdownIcon : icon }) })));
|
|
14244
14244
|
}, IndicatorSeparator: () => null, ClearIndicator: props => {
|
|
14245
14245
|
if (disabled) {
|
|
14246
14246
|
return null;
|
|
14247
14247
|
}
|
|
14248
|
-
return (jsxRuntime.jsx(components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx("div", { className: cvaSelectXIcon(), onClick: props.clearValue, "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, children: jsxRuntime.jsx(reactComponents.Icon, { name: "
|
|
14248
|
+
return (jsxRuntime.jsx(components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx("div", { className: cvaSelectXIcon(), onClick: props.clearValue, "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, children: jsxRuntime.jsx(reactComponents.Icon, { name: "XCircle", size: "medium" }) }) })));
|
|
14249
14249
|
}, Control: props => {
|
|
14250
14250
|
return jsxRuntime.jsx(components.Control, Object.assign({}, props, { className: props.isDisabled ? "bg-slate-100" : "" }));
|
|
14251
14251
|
}, SingleValue: props => {
|
|
@@ -14801,9 +14801,9 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
|
|
|
14801
14801
|
*/
|
|
14802
14802
|
const Search = (_a) => {
|
|
14803
14803
|
var { className, placeholder = "Search", value, widenInputOnFocus, showBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on" } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "showBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete"]);
|
|
14804
|
-
return (jsxRuntime.jsx(TextInput, Object.assign({}, rest, { dataTestId: dataTestId, name: name, className: cvaSearch({ className, border: showBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), placeholder: placeholder, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "
|
|
14804
|
+
return (jsxRuntime.jsx(TextInput, Object.assign({}, rest, { dataTestId: dataTestId, name: name, className: cvaSearch({ className, border: showBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), placeholder: placeholder, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "MagnifyingGlass", size: "medium" }), suffix: onClear ? (jsxRuntime.jsx("button", { "data-testid": dataTestId && `${dataTestId}_suffix_component`, onClick: () => {
|
|
14805
14805
|
onClear();
|
|
14806
|
-
}, children: jsxRuntime.jsx(reactComponents.Icon, { name: "
|
|
14806
|
+
}, children: jsxRuntime.jsx(reactComponents.Icon, { name: "XMark", size: "small" }) })) : undefined, value: value, disabled: disabled, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, autoComplete: autoComplete })));
|
|
14807
14807
|
};
|
|
14808
14808
|
|
|
14809
14809
|
const cvaTextArea = cssClassVarianceUtilities.cvaMerge([
|
package/index.esm.js
CHANGED
|
@@ -71,12 +71,12 @@ const ActionButton = ({ type, value, dataTestId, iconSize, disabled, className,
|
|
|
71
71
|
const getIconName = () => {
|
|
72
72
|
switch (type) {
|
|
73
73
|
case "PHONE_NUMBER":
|
|
74
|
-
return "
|
|
74
|
+
return "PhoneArrowUpRight";
|
|
75
75
|
case "WEB_ADDRESS":
|
|
76
|
-
return "
|
|
76
|
+
return "ArrowTopRightOnSquare";
|
|
77
77
|
case "EMAIL":
|
|
78
78
|
default:
|
|
79
|
-
return "
|
|
79
|
+
return "Envelope";
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
const ButtonAction = () => {
|
|
@@ -2896,7 +2896,7 @@ const DateInput = forwardRef((_a, ref) => {
|
|
|
2896
2896
|
const formatDateToInputString = (date) => date instanceof Date ? format(date, "yyyy-MM-dd") : date;
|
|
2897
2897
|
// Chrome and Firefox need their default icon to have datepicker functionality.
|
|
2898
2898
|
const showIcon = !/Chrome/.test(navigator.userAgent) && !/Firefox/.test(navigator.userAgent);
|
|
2899
|
-
return (jsx$1(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: showIcon && jsx$1(Icon, { dataTestId: "calendar", name: "
|
|
2899
|
+
return (jsx$1(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: showIcon && jsx$1(Icon, { dataTestId: "calendar", name: "Calendar", size: "medium", type: "solid" }) }, rest)));
|
|
2900
2900
|
});
|
|
2901
2901
|
|
|
2902
2902
|
/**
|
|
@@ -3037,7 +3037,7 @@ const DropZone = (_a) => {
|
|
|
3037
3037
|
e.preventDefault();
|
|
3038
3038
|
e.stopPropagation();
|
|
3039
3039
|
}
|
|
3040
|
-
} }, rest, { children: [jsx$1("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsx$1(Icon, { type: "solid", name: "
|
|
3040
|
+
} }, rest, { children: [jsx$1("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsx$1(Icon, { type: "solid", name: "ArrowUpCircle", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsx$1("span", { children: label })] })] })));
|
|
3041
3041
|
};
|
|
3042
3042
|
|
|
3043
3043
|
/**
|
|
@@ -14064,7 +14064,7 @@ const getOrderedOptions = (options, value) => {
|
|
|
14064
14064
|
* @returns {JSX.Element} SingleSelectMenuItem
|
|
14065
14065
|
*/
|
|
14066
14066
|
const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, focused, disabled, }) => {
|
|
14067
|
-
return (jsx$1(MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused, suffix: selected ? jsx$1(Icon, { name: "
|
|
14067
|
+
return (jsx$1(MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused, suffix: selected ? jsx$1(Icon, { name: "Check", size: "small" }) : undefined }));
|
|
14068
14068
|
};
|
|
14069
14069
|
/**
|
|
14070
14070
|
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
@@ -14213,13 +14213,13 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
14213
14213
|
}, LoadingIndicator: props => {
|
|
14214
14214
|
return jsx$1(Spinner, { size: "small", className: "mt-1.5 mr-1" });
|
|
14215
14215
|
}, DropdownIndicator: props => {
|
|
14216
|
-
const icon = props.selectProps.menuIsOpen ? (jsx$1(Icon, { name: "
|
|
14216
|
+
const icon = props.selectProps.menuIsOpen ? (jsx$1(Icon, { name: "ChevronUp", size: "medium" })) : (jsx$1(Icon, { name: "ChevronDown", size: "medium" }));
|
|
14217
14217
|
return props.selectProps.isLoading ? null : (jsx$1(components.DropdownIndicator, Object.assign({}, props, { children: jsx$1("div", { className: cvaSelectIcon(), children: dropdownIcon ? dropdownIcon : icon }) })));
|
|
14218
14218
|
}, IndicatorSeparator: () => null, ClearIndicator: props => {
|
|
14219
14219
|
if (disabled) {
|
|
14220
14220
|
return null;
|
|
14221
14221
|
}
|
|
14222
|
-
return (jsx$1(components.ClearIndicator, Object.assign({}, props, { children: jsx$1("div", { className: cvaSelectXIcon(), onClick: props.clearValue, "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, children: jsx$1(Icon, { name: "
|
|
14222
|
+
return (jsx$1(components.ClearIndicator, Object.assign({}, props, { children: jsx$1("div", { className: cvaSelectXIcon(), onClick: props.clearValue, "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, children: jsx$1(Icon, { name: "XCircle", size: "medium" }) }) })));
|
|
14223
14223
|
}, Control: props => {
|
|
14224
14224
|
return jsx$1(components.Control, Object.assign({}, props, { className: props.isDisabled ? "bg-slate-100" : "" }));
|
|
14225
14225
|
}, SingleValue: props => {
|
|
@@ -14775,9 +14775,9 @@ const cvaSearch = cvaMerge([
|
|
|
14775
14775
|
*/
|
|
14776
14776
|
const Search = (_a) => {
|
|
14777
14777
|
var { className, placeholder = "Search", value, widenInputOnFocus, showBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on" } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "showBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete"]);
|
|
14778
|
-
return (jsx$1(TextInput, Object.assign({}, rest, { dataTestId: dataTestId, name: name, className: cvaSearch({ className, border: showBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), placeholder: placeholder, prefix: jsx$1(Icon, { name: "
|
|
14778
|
+
return (jsx$1(TextInput, Object.assign({}, rest, { dataTestId: dataTestId, name: name, className: cvaSearch({ className, border: showBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), placeholder: placeholder, prefix: jsx$1(Icon, { name: "MagnifyingGlass", size: "medium" }), suffix: onClear ? (jsx$1("button", { "data-testid": dataTestId && `${dataTestId}_suffix_component`, onClick: () => {
|
|
14779
14779
|
onClear();
|
|
14780
|
-
}, children: jsx$1(Icon, { name: "
|
|
14780
|
+
}, children: jsx$1(Icon, { name: "XMark", size: "small" }) })) : undefined, value: value, disabled: disabled, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, autoComplete: autoComplete })));
|
|
14781
14781
|
};
|
|
14782
14782
|
|
|
14783
14783
|
const cvaTextArea = cvaMerge([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.140",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@trackunit/css-class-variance-utilities": "0.0.14",
|
|
11
11
|
"@trackunit/i18n-library-translation": "0.0.77",
|
|
12
|
-
"@trackunit/react-components": "0.1.
|
|
12
|
+
"@trackunit/react-components": "0.1.157",
|
|
13
13
|
"@trackunit/shared-utils": "0.0.7",
|
|
14
|
+
"@trackunit/ui-icons": "0.0.76",
|
|
14
15
|
"date-fns": "2.29.3",
|
|
15
16
|
"libphonenumber-js": "1.10.36",
|
|
16
17
|
"react": "18.2.0",
|