@trackunit/react-form-components 0.0.260 → 0.0.262

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/README.md CHANGED
@@ -9,7 +9,7 @@ This library is exposed publicly for use in the the Trackunit [Iris App SDK](ht
9
9
 
10
10
  To view other Trackunit public react components, visit this [repository](https://www.npmjs.com/package/@trackunit/react-components).
11
11
 
12
- To browse all available components visit our [Public Storybook](https://developers.trackunit.com/page/ui-components).
12
+ To browse all available components visit our [Public Storybook](https://apps.iris.trackunit.com/storybook/).
13
13
 
14
14
  For more info and a full guide on Iris App SDK Development, please visit our [Developer Hub](https://developers.trackunit.com/).
15
15
 
package/index.cjs.js CHANGED
@@ -478,7 +478,7 @@ const IndeterminateIcon = ({ className }) => (jsxRuntime.jsx("svg", { xmlns: "ht
478
478
  * @returns {JSX.Element} Checkbox component
479
479
  */
480
480
  const Checkbox = React__namespace.forwardRef((_a, ref) => {
481
- var { className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, onLabelRefChange } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex", "onLabelRefChange"]);
481
+ var { className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, onLabelRefChange, stopPropagation } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex", "onLabelRefChange", "stopPropagation"]);
482
482
  const icon = indeterminate ? (jsxRuntime.jsx(IndeterminateIcon, { className: cvaCheckboxIcon() })) : (checked && jsxRuntime.jsx(CheckIcon, { className: cvaCheckboxIcon() }));
483
483
  const internalRef = React__namespace.useRef(null);
484
484
  const isReadonly = disabled || readOnly;
@@ -497,7 +497,7 @@ const Checkbox = React__namespace.forwardRef((_a, ref) => {
497
497
  onLabelRefChange && labelRef && onLabelRefChange(labelRef);
498
498
  }, [labelRef, onLabelRefChange]);
499
499
  const uuid = rest.id;
500
- 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({
500
+ return (jsxRuntime.jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef, onKeyDown: onKeyPress, onClick: e => stopPropagation && e.stopPropagation(), 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({
501
501
  disabled: isReadonly,
502
502
  invalid: isReadonly ? false : isInvalid,
503
503
  state: indeterminate ? "indeterminate" : checked ? "selected" : "deselected",
package/index.esm.js CHANGED
@@ -448,7 +448,7 @@ const IndeterminateIcon = ({ className }) => (jsx("svg", { xmlns: "http://www.w3
448
448
  * @returns {JSX.Element} Checkbox component
449
449
  */
450
450
  const Checkbox = React.forwardRef((_a, ref) => {
451
- var { className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, onLabelRefChange } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex", "onLabelRefChange"]);
451
+ var { className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, onLabelRefChange, stopPropagation } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex", "onLabelRefChange", "stopPropagation"]);
452
452
  const icon = indeterminate ? (jsx(IndeterminateIcon, { className: cvaCheckboxIcon() })) : (checked && jsx(CheckIcon, { className: cvaCheckboxIcon() }));
453
453
  const internalRef = React.useRef(null);
454
454
  const isReadonly = disabled || readOnly;
@@ -467,7 +467,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
467
467
  onLabelRefChange && labelRef && onLabelRefChange(labelRef);
468
468
  }, [labelRef, onLabelRefChange]);
469
469
  const uuid = rest.id;
470
- 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({
470
+ return (jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef, onKeyDown: onKeyPress, onClick: e => stopPropagation && e.stopPropagation(), 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({
471
471
  disabled: isReadonly,
472
472
  invalid: isReadonly ? false : isInvalid,
473
473
  state: indeterminate ? "indeterminate" : checked ? "selected" : "deselected",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "0.0.260",
3
+ "version": "0.0.262",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -34,6 +34,10 @@ export interface CheckboxProps extends CommonProps, React.InputHTMLAttributes<HT
34
34
  * A function returning the label ref
35
35
  */
36
36
  onLabelRefChange?: (label: HTMLElement) => void;
37
+ /**
38
+ * An boolean flag to stop propagation of the click event
39
+ */
40
+ stopPropagation?: boolean;
37
41
  }
38
42
  /**
39
43
  * Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.