@trackunit/react-form-components 0.0.423 → 0.0.425
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 +11 -8
- package/index.esm.js +11 -8
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -319,7 +319,7 @@ const BaseInput = React__namespace.forwardRef((_a, ref) => {
|
|
|
319
319
|
className,
|
|
320
320
|
}), "data-testid": dataTestId && `${dataTestId}-container`, children: [addonBefore && addonBefore !== undefined ? (jsxRuntime.jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId && `${dataTestId}-addonBefore`, children: addonBefore })) : null, prefix && addonBefore !== prefix ? (jsxRuntime.jsx("div", { className: cvaInputPrefix({
|
|
321
321
|
disabled: renderAsDisabled,
|
|
322
|
-
}), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsxRuntime.jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), "data-testid": dataTestId, placeholder:
|
|
322
|
+
}), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsxRuntime.jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsxRuntime.jsx("div", { className: cvaInputSuffix({
|
|
323
323
|
disabled: renderAsDisabled,
|
|
324
324
|
}), "data-testid": dataTestId && `${dataTestId}-suffix`, children: suffix })) : null, rest.readOnly === true &&
|
|
325
325
|
showDefaultActions &&
|
|
@@ -1473,6 +1473,7 @@ const cvaSelect = cssClassVarianceUtilities.cvaMerge([
|
|
|
1473
1473
|
"hover:bg-slate-50",
|
|
1474
1474
|
"bg-white",
|
|
1475
1475
|
"transition",
|
|
1476
|
+
"overflow-hidden",
|
|
1476
1477
|
], {
|
|
1477
1478
|
variants: {
|
|
1478
1479
|
invalid: {
|
|
@@ -1767,7 +1768,7 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
|
|
|
1767
1768
|
return Object.assign({ control: base => {
|
|
1768
1769
|
return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
|
|
1769
1770
|
border: "0",
|
|
1770
|
-
},
|
|
1771
|
+
}, backgroundColor: "" });
|
|
1771
1772
|
}, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign(Object.assign({}, base), (disabled && { display: "none" }))), indicatorSeparator: () => ({
|
|
1772
1773
|
width: "0px",
|
|
1773
1774
|
}), menu: base => {
|
|
@@ -1776,7 +1777,7 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
|
|
|
1776
1777
|
return Object.assign(Object.assign({}, base), { position: "relative", padding: "var(--spacing-1)", display: "grid", gap: "var(--spacing-1)", width: "100%", borderRadius: "0px", boxShadow: "none", paddingTop: "0px" });
|
|
1777
1778
|
}, valueContainer: base => {
|
|
1778
1779
|
return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
|
|
1779
|
-
}, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "
|
|
1780
|
+
}, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
|
|
1780
1781
|
return Object.assign(Object.assign({}, base), { padding: "0px" });
|
|
1781
1782
|
} }, styles);
|
|
1782
1783
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1840,8 +1841,8 @@ const useSelect = (_a) => {
|
|
|
1840
1841
|
* @returns {JSX.Element} CreatableSelect component
|
|
1841
1842
|
*/
|
|
1842
1843
|
const CreatableSelect = (props) => {
|
|
1843
|
-
const { className } = props,
|
|
1844
|
-
const { id, dataTestId = "creatableSelect", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "creatableSelect", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, allowCreateWhileLoading, onCreateOption, } =
|
|
1844
|
+
const { className, placeholder } = props, rest = __rest(props, ["className", "placeholder"]);
|
|
1845
|
+
const { id, dataTestId = "creatableSelect", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "creatableSelect", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, allowCreateWhileLoading, onCreateOption, } = rest;
|
|
1845
1846
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1846
1847
|
const creatableSelectProps = {
|
|
1847
1848
|
value,
|
|
@@ -1872,7 +1873,8 @@ const CreatableSelect = (props) => {
|
|
|
1872
1873
|
allowCreateWhileLoading,
|
|
1873
1874
|
onCreateOption,
|
|
1874
1875
|
};
|
|
1875
|
-
|
|
1876
|
+
const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
|
|
1877
|
+
return (jsxRuntime.jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsxRuntime.jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncCreatableSelect__default["default"], Object.assign({}, rest, creatableSelectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsxRuntime.jsx(ReactCreatableSelect__default["default"], Object.assign({}, rest, creatableSelectProps, { hideSelectedOptions: false, isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
|
|
1876
1878
|
};
|
|
1877
1879
|
CreatableSelect.displayName = "CreatableSelect";
|
|
1878
1880
|
|
|
@@ -1883,7 +1885,7 @@ CreatableSelect.displayName = "CreatableSelect";
|
|
|
1883
1885
|
* @returns {JSX.Element} Select component
|
|
1884
1886
|
*/
|
|
1885
1887
|
const Select = (props) => {
|
|
1886
|
-
const { className } = props,
|
|
1888
|
+
const { className, placeholder } = props, rest = __rest(props, ["className", "placeholder"]);
|
|
1887
1889
|
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
|
|
1888
1890
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1889
1891
|
const selectProps = {
|
|
@@ -1914,7 +1916,8 @@ const Select = (props) => {
|
|
|
1914
1916
|
onInputChange,
|
|
1915
1917
|
hideSelectedOptions,
|
|
1916
1918
|
};
|
|
1917
|
-
|
|
1919
|
+
const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
|
|
1920
|
+
return (jsxRuntime.jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsxRuntime.jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncSelect__default["default"], Object.assign({}, rest, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsxRuntime.jsx(ReactSelect__default["default"], Object.assign({}, rest, selectProps, { isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
|
|
1918
1921
|
};
|
|
1919
1922
|
Select.displayName = "Select";
|
|
1920
1923
|
|
package/index.esm.js
CHANGED
|
@@ -289,7 +289,7 @@ const BaseInput = React.forwardRef((_a, ref) => {
|
|
|
289
289
|
className,
|
|
290
290
|
}), "data-testid": dataTestId && `${dataTestId}-container`, children: [addonBefore && addonBefore !== undefined ? (jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId && `${dataTestId}-addonBefore`, children: addonBefore })) : null, prefix && addonBefore !== prefix ? (jsx("div", { className: cvaInputPrefix({
|
|
291
291
|
disabled: renderAsDisabled,
|
|
292
|
-
}), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), "data-testid": dataTestId, placeholder:
|
|
292
|
+
}), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsx("div", { className: cvaInputSuffix({
|
|
293
293
|
disabled: renderAsDisabled,
|
|
294
294
|
}), "data-testid": dataTestId && `${dataTestId}-suffix`, children: suffix })) : null, rest.readOnly === true &&
|
|
295
295
|
showDefaultActions &&
|
|
@@ -1443,6 +1443,7 @@ const cvaSelect = cvaMerge([
|
|
|
1443
1443
|
"hover:bg-slate-50",
|
|
1444
1444
|
"bg-white",
|
|
1445
1445
|
"transition",
|
|
1446
|
+
"overflow-hidden",
|
|
1446
1447
|
], {
|
|
1447
1448
|
variants: {
|
|
1448
1449
|
invalid: {
|
|
@@ -1737,7 +1738,7 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
|
|
|
1737
1738
|
return Object.assign({ control: base => {
|
|
1738
1739
|
return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
|
|
1739
1740
|
border: "0",
|
|
1740
|
-
},
|
|
1741
|
+
}, backgroundColor: "" });
|
|
1741
1742
|
}, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign(Object.assign({}, base), (disabled && { display: "none" }))), indicatorSeparator: () => ({
|
|
1742
1743
|
width: "0px",
|
|
1743
1744
|
}), menu: base => {
|
|
@@ -1746,7 +1747,7 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
|
|
|
1746
1747
|
return Object.assign(Object.assign({}, base), { position: "relative", padding: "var(--spacing-1)", display: "grid", gap: "var(--spacing-1)", width: "100%", borderRadius: "0px", boxShadow: "none", paddingTop: "0px" });
|
|
1747
1748
|
}, valueContainer: base => {
|
|
1748
1749
|
return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
|
|
1749
|
-
}, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "
|
|
1750
|
+
}, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
|
|
1750
1751
|
return Object.assign(Object.assign({}, base), { padding: "0px" });
|
|
1751
1752
|
} }, styles);
|
|
1752
1753
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1810,8 +1811,8 @@ const useSelect = (_a) => {
|
|
|
1810
1811
|
* @returns {JSX.Element} CreatableSelect component
|
|
1811
1812
|
*/
|
|
1812
1813
|
const CreatableSelect = (props) => {
|
|
1813
|
-
const { className } = props,
|
|
1814
|
-
const { id, dataTestId = "creatableSelect", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "creatableSelect", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, allowCreateWhileLoading, onCreateOption, } =
|
|
1814
|
+
const { className, placeholder } = props, rest = __rest(props, ["className", "placeholder"]);
|
|
1815
|
+
const { id, dataTestId = "creatableSelect", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "creatableSelect", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, allowCreateWhileLoading, onCreateOption, } = rest;
|
|
1815
1816
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1816
1817
|
const creatableSelectProps = {
|
|
1817
1818
|
value,
|
|
@@ -1842,7 +1843,8 @@ const CreatableSelect = (props) => {
|
|
|
1842
1843
|
allowCreateWhileLoading,
|
|
1843
1844
|
onCreateOption,
|
|
1844
1845
|
};
|
|
1845
|
-
|
|
1846
|
+
const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
|
|
1847
|
+
return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx(ReactAsyncCreatableSelect, Object.assign({}, rest, creatableSelectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsx(ReactCreatableSelect, Object.assign({}, rest, creatableSelectProps, { hideSelectedOptions: false, isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
|
|
1846
1848
|
};
|
|
1847
1849
|
CreatableSelect.displayName = "CreatableSelect";
|
|
1848
1850
|
|
|
@@ -1853,7 +1855,7 @@ CreatableSelect.displayName = "CreatableSelect";
|
|
|
1853
1855
|
* @returns {JSX.Element} Select component
|
|
1854
1856
|
*/
|
|
1855
1857
|
const Select = (props) => {
|
|
1856
|
-
const { className } = props,
|
|
1858
|
+
const { className, placeholder } = props, rest = __rest(props, ["className", "placeholder"]);
|
|
1857
1859
|
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId !== null && dataTestId !== void 0 ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
|
|
1858
1860
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1859
1861
|
const selectProps = {
|
|
@@ -1884,7 +1886,8 @@ const Select = (props) => {
|
|
|
1884
1886
|
onInputChange,
|
|
1885
1887
|
hideSelectedOptions,
|
|
1886
1888
|
};
|
|
1887
|
-
|
|
1889
|
+
const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
|
|
1890
|
+
return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx(ReactAsyncSelect, Object.assign({}, rest, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsx(ReactSelect, Object.assign({}, rest, selectProps, { isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
|
|
1888
1891
|
};
|
|
1889
1892
|
Select.displayName = "Select";
|
|
1890
1893
|
|