@trackunit/react-components 0.0.68 → 0.0.69
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/components/DateField/DateField.d.ts +1 -1
- package/index.js +9 -6
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Matcher } from "react-day-picker";
|
|
3
3
|
import { BaseInputProps } from "../BaseInput";
|
|
4
|
-
export interface DateFieldProps extends Pick<BaseInputProps, "placeholder" | "id" | "dataTestId" | "onChange"> {
|
|
4
|
+
export interface DateFieldProps extends Pick<BaseInputProps, "placeholder" | "id" | "dataTestId" | "onChange" | "readOnly"> {
|
|
5
5
|
/**
|
|
6
6
|
* A text label to be displayed next to the indicator
|
|
7
7
|
*/
|
package/index.js
CHANGED
|
@@ -875,7 +875,7 @@ const BaseInput = React.forwardRef((_a, ref) => {
|
|
|
875
875
|
return jsxs(InputContainer, Object.assign({
|
|
876
876
|
"$fieldSize": fieldSize,
|
|
877
877
|
"$invalid": isInvalid,
|
|
878
|
-
"$disabled": rest.disabled,
|
|
878
|
+
"$disabled": rest.disabled || rest.readOnly,
|
|
879
879
|
className: className,
|
|
880
880
|
"data-testid": `${dataTestId}-container`
|
|
881
881
|
}, {
|
|
@@ -1466,6 +1466,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
|
|
|
1466
1466
|
|
|
1467
1467
|
const icon = indeterminate ? jsx(StyledIndeterminateIcon, {}) : checked && jsx(StyledCheckIcon, {});
|
|
1468
1468
|
const internalRef = React.useRef(null);
|
|
1469
|
+
const isReadonly = disabled || readOnly;
|
|
1469
1470
|
|
|
1470
1471
|
const onKeyPress = e => {
|
|
1471
1472
|
var _a;
|
|
@@ -1494,20 +1495,20 @@ const Checkbox = React.forwardRef((_a, ref) => {
|
|
|
1494
1495
|
}, rest, {
|
|
1495
1496
|
ref: ref
|
|
1496
1497
|
})), jsx(CheckboxWrapper, Object.assign({
|
|
1497
|
-
"$disabled":
|
|
1498
|
+
"$disabled": isReadonly,
|
|
1498
1499
|
"$checked": checked,
|
|
1499
1500
|
"$indeterminate": indeterminate,
|
|
1500
|
-
"$isInvalid":
|
|
1501
|
+
"$isInvalid": isReadonly ? false : isInvalid,
|
|
1501
1502
|
className: className,
|
|
1502
|
-
tabIndex:
|
|
1503
|
+
tabIndex: isReadonly ? -1 : tabIndex,
|
|
1503
1504
|
onKeyPress: onKeyPress
|
|
1504
1505
|
}, {
|
|
1505
1506
|
children: icon
|
|
1506
1507
|
})), label && jsx(Label$4, Object.assign({
|
|
1507
1508
|
ref: internalRef,
|
|
1508
1509
|
htmlFor: uuid,
|
|
1509
|
-
"$disabled":
|
|
1510
|
-
"$isInvalid":
|
|
1510
|
+
"$disabled": isReadonly,
|
|
1511
|
+
"$isInvalid": isReadonly ? false : isInvalid,
|
|
1511
1512
|
"data-testid": dataTestId ? `${dataTestId}Label` : ""
|
|
1512
1513
|
}, {
|
|
1513
1514
|
children: label
|
|
@@ -1988,6 +1989,7 @@ const DateField = forwardRef(({
|
|
|
1988
1989
|
defaultValue,
|
|
1989
1990
|
onChange,
|
|
1990
1991
|
disabled = false,
|
|
1992
|
+
readOnly = false,
|
|
1991
1993
|
id,
|
|
1992
1994
|
dataTestId,
|
|
1993
1995
|
placeholder,
|
|
@@ -2019,6 +2021,7 @@ const DateField = forwardRef(({
|
|
|
2019
2021
|
value: (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) || "",
|
|
2020
2022
|
onChange: () => {},
|
|
2021
2023
|
disabled: disabled,
|
|
2024
|
+
readOnly: readOnly,
|
|
2022
2025
|
dataTestId: dataTestId,
|
|
2023
2026
|
id: id,
|
|
2024
2027
|
ref: ref,
|