@trackunit/react-form-components 0.0.271 → 0.0.273
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
|
@@ -553,13 +553,13 @@ const cvaHelpAddon = cssClassVarianceUtilities.cvaMerge(["ml-auto"]);
|
|
|
553
553
|
|
|
554
554
|
/**
|
|
555
555
|
* The FormGroup component should be used to wrap any Input element that needs a label.
|
|
556
|
-
* Besides a label the component supplies an optional
|
|
556
|
+
* Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
|
|
557
557
|
*
|
|
558
558
|
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
559
559
|
* @returns {JSX.Element} FormGroup component
|
|
560
560
|
*/
|
|
561
561
|
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, tipIconProps, disabled = false, }) => {
|
|
562
|
-
return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxRuntime.jsx(Label, { className: "component-formGroup-font", dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), tip && (jsxRuntime.jsx(reactComponents.
|
|
562
|
+
return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxRuntime.jsx(Label, { className: "component-formGroup-font", dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), tip && (jsxRuntime.jsx(reactComponents.Tooltip, { dataTestId: dataTestId && `${dataTestId}-tooltip`, iconProps: tipIconProps, label: tip, placement: "bottom" }))] }), children, jsxRuntime.jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid }), children: [helpText && jsxRuntime.jsx("span", { "data-testid": dataTestId && `${dataTestId}-helpText`, children: helpText }), helpAddon && (jsxRuntime.jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId && `${dataTestId}-helpAddon`, children: helpAddon }))] })] }));
|
|
563
563
|
};
|
|
564
564
|
|
|
565
565
|
/**
|
|
@@ -1072,7 +1072,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
1072
1072
|
return (jsxRuntime.jsx(TagWithWidth, { onWidthKnown: onWidthKnownHandler, className: "inline-flex shrink-0", onClose: e => {
|
|
1073
1073
|
e.stopPropagation();
|
|
1074
1074
|
item.onClick();
|
|
1075
|
-
}, color: item.disabled ? "unknown" : "primary", dataTestId: item.text
|
|
1075
|
+
}, color: item.disabled ? "unknown" : "primary", dataTestId: `${item.text}-tag`, disabled: disabled, children: item.text }, item.text + index));
|
|
1076
1076
|
}
|
|
1077
1077
|
const fromTheItems = item.text !== "";
|
|
1078
1078
|
if (fromTheItems) {
|
|
@@ -1133,8 +1133,8 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
1133
1133
|
e.stopPropagation();
|
|
1134
1134
|
refMenuIsEnabled.current = false;
|
|
1135
1135
|
((_a = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _a === void 0 ? void 0 : _a.onClick) && ((_b = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _b === void 0 ? void 0 : _b.onClick(e));
|
|
1136
|
-
}, color: disabled ? "unknown" : "primary", dataTestId: (_a = tagProps.children) === null || _a === void 0 ? void 0 : _a.toString(), children: tagProps.children }, (_b = tagProps.children) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
1137
|
-
}), tags && tags.length > maxSelectedDisplayCount && (jsxRuntime.jsxs(reactComponents.Tag, { color: "neutral", dataTestId: "counter", children: ["+", tags.length - maxSelectedDisplayCount] })), searchInput] })) })));
|
|
1136
|
+
}, color: disabled ? "unknown" : "primary", dataTestId: tagProps.children ? `${(_a = tagProps.children) === null || _a === void 0 ? void 0 : _a.toString()}-tag` : undefined, children: tagProps.children }, (_b = tagProps.children) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
1137
|
+
}), tags && tags.length > maxSelectedDisplayCount && (jsxRuntime.jsxs(reactComponents.Tag, { color: "neutral", dataTestId: "counter-tag", children: ["+", tags.length - maxSelectedDisplayCount] })), searchInput] })) })));
|
|
1138
1138
|
}
|
|
1139
1139
|
return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: props.children })));
|
|
1140
1140
|
}, LoadingIndicator: props => {
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useNamespaceTranslation, registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
|
-
import { IconButton, Icon,
|
|
3
|
+
import { IconButton, Icon, Tooltip, Heading, Text, MenuItem, Tag, Spinner } from '@trackunit/react-components';
|
|
4
4
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { useMemo, forwardRef, useCallback, cloneElement, useState, useEffect, useRef } from 'react';
|
|
@@ -523,13 +523,13 @@ const cvaHelpAddon = cvaMerge(["ml-auto"]);
|
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
525
|
* The FormGroup component should be used to wrap any Input element that needs a label.
|
|
526
|
-
* Besides a label the component supplies an optional
|
|
526
|
+
* Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
|
|
527
527
|
*
|
|
528
528
|
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
529
529
|
* @returns {JSX.Element} FormGroup component
|
|
530
530
|
*/
|
|
531
531
|
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, tipIconProps, disabled = false, }) => {
|
|
532
|
-
return (jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsx(Label, { className: "component-formGroup-font", dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), tip && (jsx(
|
|
532
|
+
return (jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsx(Label, { className: "component-formGroup-font", dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), tip && (jsx(Tooltip, { dataTestId: dataTestId && `${dataTestId}-tooltip`, iconProps: tipIconProps, label: tip, placement: "bottom" }))] }), children, jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid }), children: [helpText && jsx("span", { "data-testid": dataTestId && `${dataTestId}-helpText`, children: helpText }), helpAddon && (jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId && `${dataTestId}-helpAddon`, children: helpAddon }))] })] }));
|
|
533
533
|
};
|
|
534
534
|
|
|
535
535
|
/**
|
|
@@ -1042,7 +1042,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
1042
1042
|
return (jsx(TagWithWidth, { onWidthKnown: onWidthKnownHandler, className: "inline-flex shrink-0", onClose: e => {
|
|
1043
1043
|
e.stopPropagation();
|
|
1044
1044
|
item.onClick();
|
|
1045
|
-
}, color: item.disabled ? "unknown" : "primary", dataTestId: item.text
|
|
1045
|
+
}, color: item.disabled ? "unknown" : "primary", dataTestId: `${item.text}-tag`, disabled: disabled, children: item.text }, item.text + index));
|
|
1046
1046
|
}
|
|
1047
1047
|
const fromTheItems = item.text !== "";
|
|
1048
1048
|
if (fromTheItems) {
|
|
@@ -1103,8 +1103,8 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
1103
1103
|
e.stopPropagation();
|
|
1104
1104
|
refMenuIsEnabled.current = false;
|
|
1105
1105
|
((_a = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _a === void 0 ? void 0 : _a.onClick) && ((_b = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _b === void 0 ? void 0 : _b.onClick(e));
|
|
1106
|
-
}, color: disabled ? "unknown" : "primary", dataTestId: (_a = tagProps.children) === null || _a === void 0 ? void 0 : _a.toString(), children: tagProps.children }, (_b = tagProps.children) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
1107
|
-
}), tags && tags.length > maxSelectedDisplayCount && (jsxs(Tag, { color: "neutral", dataTestId: "counter", children: ["+", tags.length - maxSelectedDisplayCount] })), searchInput] })) })));
|
|
1106
|
+
}, color: disabled ? "unknown" : "primary", dataTestId: tagProps.children ? `${(_a = tagProps.children) === null || _a === void 0 ? void 0 : _a.toString()}-tag` : undefined, children: tagProps.children }, (_b = tagProps.children) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
1107
|
+
}), tags && tags.length > maxSelectedDisplayCount && (jsxs(Tag, { color: "neutral", dataTestId: "counter-tag", children: ["+", tags.length - maxSelectedDisplayCount] })), searchInput] })) })));
|
|
1108
1108
|
}
|
|
1109
1109
|
return (jsx(components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: props.children })));
|
|
1110
1110
|
}, LoadingIndicator: props => {
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ export interface FormGroupProps extends CommonProps {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* The FormGroup component should be used to wrap any Input element that needs a label.
|
|
38
|
-
* Besides a label the component supplies an optional
|
|
38
|
+
* Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
|
|
39
39
|
*
|
|
40
40
|
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
41
41
|
* @returns {JSX.Element} FormGroup component
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GroupBase } from "react-select";
|
|
3
3
|
import { SelectProps } from "./useSelect";
|
|
4
|
-
export interface SelectOption<T extends string> {
|
|
4
|
+
export interface SelectOption<T extends string | number> {
|
|
5
5
|
label: string;
|
|
6
6
|
value: T;
|
|
7
7
|
disabled?: boolean;
|