@trackunit/react-form-components 0.0.216 → 0.0.218
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
|
@@ -485,7 +485,7 @@ const Checkbox = React__namespace.forwardRef((_a, ref) => {
|
|
|
485
485
|
onLabelRefChange && labelRef && onLabelRefChange(labelRef);
|
|
486
486
|
}, [labelRef, onLabelRefChange]);
|
|
487
487
|
const uuid = rest.id;
|
|
488
|
-
return (jsxRuntime.jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef,
|
|
488
|
+
return (jsxRuntime.jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef, onKeyDown: onKeyPress, children: [jsxRuntime.jsx("input", Object.assign({ type: "checkbox", className: cvaCheckboxInput(), checked: !indeterminate && checked, onChange: onChange, disabled: disabled, "data-testid": dataTestId, readOnly: readOnly, "aria-checked": !indeterminate && checked, id: uuid }, rest, { ref: ref })), jsxRuntime.jsx("span", { id: uuid, tabIndex: isReadonly ? -1 : tabIndex, className: cvaCheckbox({
|
|
489
489
|
disabled: isReadonly,
|
|
490
490
|
invalid: isReadonly ? false : isInvalid,
|
|
491
491
|
state: indeterminate ? "indeterminate" : checked ? "selected" : "deselected",
|
|
@@ -547,7 +547,7 @@ const cvaHelpAddon = cssClassVarianceUtilities.cvaMerge(["ml-auto"]);
|
|
|
547
547
|
* @returns {JSX.Element} FormGroup component
|
|
548
548
|
*/
|
|
549
549
|
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, tipIconProps, disabled = false, }) => {
|
|
550
|
-
return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(
|
|
550
|
+
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.Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: tipIconProps, children: tip }))] }), 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 }))] })] }));
|
|
551
551
|
};
|
|
552
552
|
|
|
553
553
|
/**
|
|
@@ -736,7 +736,7 @@ const cvaOptionCardLabel = cssClassVarianceUtilities.cvaMerge([
|
|
|
736
736
|
"gap-2",
|
|
737
737
|
"justify-center",
|
|
738
738
|
"items-center",
|
|
739
|
-
"p-
|
|
739
|
+
"p-responsive-space",
|
|
740
740
|
"w-full",
|
|
741
741
|
"peer-checked:bg-primary-50",
|
|
742
742
|
"peer-checked:border-primary-600",
|
|
@@ -987,7 +987,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
987
987
|
const isLast = index === items.length;
|
|
988
988
|
const counterRequired = requiredSpace > availableSpace && counter !== 0;
|
|
989
989
|
if (isLast && counterRequired) {
|
|
990
|
-
return (jsxRuntime.jsx(TagWithWidth, { onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "
|
|
990
|
+
return (jsxRuntime.jsx(TagWithWidth, { onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "white", disabled: disabled, children: jsxRuntime.jsxs("div", { "data-testid": "select-counter", className: cvaSelectCounter(), children: ["+", counter] }) }, item.text + index));
|
|
991
991
|
}
|
|
992
992
|
if (isLast) {
|
|
993
993
|
return null;
|
|
@@ -1235,7 +1235,7 @@ const CreatableSelect = (props) => {
|
|
|
1235
1235
|
*/
|
|
1236
1236
|
const Select = (props) => {
|
|
1237
1237
|
const { className } = props, propsNoClassName = __rest(props, ["className"]);
|
|
1238
|
-
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable, readOnly, } = props;
|
|
1238
|
+
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, } = props;
|
|
1239
1239
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1240
1240
|
const selectProps = {
|
|
1241
1241
|
value,
|
package/index.esm.js
CHANGED
|
@@ -455,7 +455,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
|
|
|
455
455
|
onLabelRefChange && labelRef && onLabelRefChange(labelRef);
|
|
456
456
|
}, [labelRef, onLabelRefChange]);
|
|
457
457
|
const uuid = rest.id;
|
|
458
|
-
return (jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef,
|
|
458
|
+
return (jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef, onKeyDown: onKeyPress, children: [jsx("input", Object.assign({ type: "checkbox", className: cvaCheckboxInput(), checked: !indeterminate && checked, onChange: onChange, disabled: disabled, "data-testid": dataTestId, readOnly: readOnly, "aria-checked": !indeterminate && checked, id: uuid }, rest, { ref: ref })), jsx("span", { id: uuid, tabIndex: isReadonly ? -1 : tabIndex, className: cvaCheckbox({
|
|
459
459
|
disabled: isReadonly,
|
|
460
460
|
invalid: isReadonly ? false : isInvalid,
|
|
461
461
|
state: indeterminate ? "indeterminate" : checked ? "selected" : "deselected",
|
|
@@ -517,7 +517,7 @@ const cvaHelpAddon = cvaMerge(["ml-auto"]);
|
|
|
517
517
|
* @returns {JSX.Element} FormGroup component
|
|
518
518
|
*/
|
|
519
519
|
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, tipIconProps, disabled = false, }) => {
|
|
520
|
-
return (jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaFormGroupContainerBefore(
|
|
520
|
+
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(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: tipIconProps, children: tip }))] }), 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 }))] })] }));
|
|
521
521
|
};
|
|
522
522
|
|
|
523
523
|
/**
|
|
@@ -706,7 +706,7 @@ const cvaOptionCardLabel = cvaMerge([
|
|
|
706
706
|
"gap-2",
|
|
707
707
|
"justify-center",
|
|
708
708
|
"items-center",
|
|
709
|
-
"p-
|
|
709
|
+
"p-responsive-space",
|
|
710
710
|
"w-full",
|
|
711
711
|
"peer-checked:bg-primary-50",
|
|
712
712
|
"peer-checked:border-primary-600",
|
|
@@ -957,7 +957,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
957
957
|
const isLast = index === items.length;
|
|
958
958
|
const counterRequired = requiredSpace > availableSpace && counter !== 0;
|
|
959
959
|
if (isLast && counterRequired) {
|
|
960
|
-
return (jsx(TagWithWidth, { onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "
|
|
960
|
+
return (jsx(TagWithWidth, { onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "white", disabled: disabled, children: jsxs("div", { "data-testid": "select-counter", className: cvaSelectCounter(), children: ["+", counter] }) }, item.text + index));
|
|
961
961
|
}
|
|
962
962
|
if (isLast) {
|
|
963
963
|
return null;
|
|
@@ -1205,7 +1205,7 @@ const CreatableSelect = (props) => {
|
|
|
1205
1205
|
*/
|
|
1206
1206
|
const Select = (props) => {
|
|
1207
1207
|
const { className } = props, propsNoClassName = __rest(props, ["className"]);
|
|
1208
|
-
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable, readOnly, } = props;
|
|
1208
|
+
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = dataTestId ? dataTestId : "select", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable = false, readOnly, } = props;
|
|
1209
1209
|
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
1210
1210
|
const selectProps = {
|
|
1211
1211
|
value,
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { CheckboxProps } from "../Checkbox/Checkbox";
|
|
3
|
+
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
4
|
+
type FormGroupExposedProps = Pick<FormGroupProps, "tip" | "helpText" | "helpAddon">;
|
|
5
|
+
export interface CheckboxFieldProps extends CheckboxProps, FormGroupExposedProps {
|
|
6
|
+
checkboxLabel?: string | ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The checkbox field component is used for entering boolean values.
|
|
10
|
+
*
|
|
11
|
+
* _**Do use**_ the CheckboxField for boolean input.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CheckboxField: import("react").ForwardRefExoticComponent<CheckboxFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
14
|
+
export {};
|