@trackunit/react-components 0.0.67 → 0.0.70

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.
@@ -28,8 +28,6 @@ export interface CheckboxProps extends CommonProps, React.InputHTMLAttributes<HT
28
28
  indeterminate?: boolean;
29
29
  }
30
30
  /**
31
- * Checkbox are interactive elements that represent the boolean logical value (true or false) that can be used for boolean inputs, selectors etc.
32
- *
33
31
  * Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
34
32
  *
35
33
  * Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
@@ -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
  }, {
@@ -1432,8 +1432,6 @@ const IndeterminateIcon = ({
1432
1432
  }));
1433
1433
 
1434
1434
  /**
1435
- * Checkbox are interactive elements that represent the boolean logical value (true or false) that can be used for boolean inputs, selectors etc.
1436
- *
1437
1435
  * Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
1438
1436
  *
1439
1437
  * Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
@@ -1466,6 +1464,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
1466
1464
 
1467
1465
  const icon = indeterminate ? jsx(StyledIndeterminateIcon, {}) : checked && jsx(StyledCheckIcon, {});
1468
1466
  const internalRef = React.useRef(null);
1467
+ const isReadonly = disabled || readOnly;
1469
1468
 
1470
1469
  const onKeyPress = e => {
1471
1470
  var _a;
@@ -1494,20 +1493,20 @@ const Checkbox = React.forwardRef((_a, ref) => {
1494
1493
  }, rest, {
1495
1494
  ref: ref
1496
1495
  })), jsx(CheckboxWrapper, Object.assign({
1497
- "$disabled": disabled,
1496
+ "$disabled": isReadonly,
1498
1497
  "$checked": checked,
1499
1498
  "$indeterminate": indeterminate,
1500
- "$isInvalid": disabled ? false : isInvalid,
1499
+ "$isInvalid": isReadonly ? false : isInvalid,
1501
1500
  className: className,
1502
- tabIndex: disabled ? -1 : tabIndex,
1501
+ tabIndex: isReadonly ? -1 : tabIndex,
1503
1502
  onKeyPress: onKeyPress
1504
1503
  }, {
1505
1504
  children: icon
1506
1505
  })), label && jsx(Label$4, Object.assign({
1507
1506
  ref: internalRef,
1508
1507
  htmlFor: uuid,
1509
- "$disabled": disabled,
1510
- "$isInvalid": disabled ? false : isInvalid,
1508
+ "$disabled": isReadonly,
1509
+ "$isInvalid": isReadonly ? false : isInvalid,
1511
1510
  "data-testid": dataTestId ? `${dataTestId}Label` : ""
1512
1511
  }, {
1513
1512
  children: label
@@ -1988,6 +1987,7 @@ const DateField = forwardRef(({
1988
1987
  defaultValue,
1989
1988
  onChange,
1990
1989
  disabled = false,
1990
+ readOnly = false,
1991
1991
  id,
1992
1992
  dataTestId,
1993
1993
  placeholder,
@@ -2019,6 +2019,7 @@ const DateField = forwardRef(({
2019
2019
  value: (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) || "",
2020
2020
  onChange: () => {},
2021
2021
  disabled: disabled,
2022
+ readOnly: readOnly,
2022
2023
  dataTestId: dataTestId,
2023
2024
  id: id,
2024
2025
  ref: ref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.67",
3
+ "version": "0.0.70",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "MIT",
6
6
  "dependencies": {