@activecollab/components 2.0.561 → 2.0.562

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/dist/index.js CHANGED
@@ -18832,6 +18832,32 @@
18832
18832
  });
18833
18833
  StyledCheckbox$1.displayName = "StyledCheckbox";
18834
18834
 
18835
+ /**
18836
+ * Stable id generator for a single element.
18837
+ *
18838
+ * `React.useId` only exists in React 18+. This package still declares React
18839
+ * 16/17 in `peerDependencies`, so we must not call `React.useId` directly.
18840
+ * Instead we read it off the React export once, at module load, and fall back
18841
+ * to a module-level counter when it is absent. Which branch runs is fixed for
18842
+ * the life of the module, so the hook call order stays stable across renders.
18843
+ *
18844
+ * Intentionally NOT re-exported from `src/utils/index.ts`: the package root
18845
+ * re-exports `./utils`, and this helper is internal to the design-system
18846
+ * components.
18847
+ */
18848
+ var counter = 0;
18849
+ var reactUseId = React__namespace.useId;
18850
+ function useStableId(providedId) {
18851
+ var generatedId = reactUseId ?
18852
+ // eslint-disable-next-line react-hooks/rules-of-hooks
18853
+ reactUseId() :
18854
+ // eslint-disable-next-line react-hooks/rules-of-hooks
18855
+ React__namespace.useMemo(function () {
18856
+ return "ds-".concat(counter += 1);
18857
+ }, []);
18858
+ return providedId !== null && providedId !== void 0 ? providedId : generatedId;
18859
+ }
18860
+
18835
18861
  var _excluded$1S = ["className", "hover", "id", "mixed", "checked", "onChange", "disabled"];
18836
18862
  /**
18837
18863
  * Checkbox component
@@ -18839,14 +18865,14 @@
18839
18865
  var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
18840
18866
  var className = _ref.className,
18841
18867
  hover = _ref.hover,
18842
- _ref$id = _ref.id,
18843
- id = _ref$id === void 0 ? "checkbox" : _ref$id,
18868
+ id = _ref.id,
18844
18869
  _ref$mixed = _ref.mixed,
18845
18870
  mixed = _ref$mixed === void 0 ? false : _ref$mixed,
18846
18871
  checked = _ref.checked,
18847
18872
  onChange = _ref.onChange,
18848
18873
  disabled = _ref.disabled,
18849
18874
  rest = _objectWithoutProperties(_ref, _excluded$1S);
18875
+ var inputId = useStableId(id);
18850
18876
  var _useState = React.useState(mixed && !checked),
18851
18877
  _useState2 = _slicedToArray(_useState, 2),
18852
18878
  indeterminate = _useState2[0],
@@ -18886,7 +18912,7 @@
18886
18912
  $disabled: disabled
18887
18913
  }, /*#__PURE__*/React__default["default"].createElement(StyledInput$5, _extends({
18888
18914
  role: "checkbox",
18889
- id: id,
18915
+ id: inputId,
18890
18916
  className: "c-checkbox--input",
18891
18917
  type: "checkbox",
18892
18918
  ref: ref
@@ -18895,7 +18921,7 @@
18895
18921
  onChange: handleChange,
18896
18922
  disabled: disabled
18897
18923
  })), /*#__PURE__*/React__default["default"].createElement(StyledLabel$1, {
18898
- htmlFor: id,
18924
+ htmlFor: inputId,
18899
18925
  className: "c-checkbox--label"
18900
18926
  }, /*#__PURE__*/React__default["default"].createElement(CheckboxIcon$1, {
18901
18927
  "data-testid": "checkbox-icon",
@@ -19070,31 +19096,6 @@
19070
19096
  };
19071
19097
  DialogContentDivider.displayName = "DialogContentDivider";
19072
19098
 
19073
- /**
19074
- * Stable id generator for a single element.
19075
- *
19076
- * `React.useId` only exists in React 18+. This package still declares React
19077
- * 16/17 in `peerDependencies`, so we must not call `React.useId` directly.
19078
- * Instead we read it off the React export once, at module load, and fall back
19079
- * to a module-level counter when it is absent. Which branch runs is fixed for
19080
- * the life of the module, so the hook call order stays stable across renders.
19081
- *
19082
- * Intentionally NOT re-exported from `src/utils/index.ts`: the package root
19083
- * re-exports `./utils`, and this helper is internal to the radio components.
19084
- */
19085
- var counter = 0;
19086
- var reactUseId = React__namespace.useId;
19087
- function useStableId(providedId) {
19088
- var generatedId = reactUseId ?
19089
- // eslint-disable-next-line react-hooks/rules-of-hooks
19090
- reactUseId() :
19091
- // eslint-disable-next-line react-hooks/rules-of-hooks
19092
- React__namespace.useMemo(function () {
19093
- return "ds-".concat(counter += 1);
19094
- }, []);
19095
- return providedId !== null && providedId !== void 0 ? providedId : generatedId;
19096
- }
19097
-
19098
19099
  var listeners = new Set();
19099
19100
  var stack = [];
19100
19101
  var lastId = 0;
@@ -24733,6 +24734,9 @@
24733
24734
  onMouseEnter(id);
24734
24735
  }
24735
24736
  }, [onMouseEnter, id]);
24737
+ var handleOnClick = React.useCallback(function (e) {
24738
+ return onClick(e, id);
24739
+ }, [onClick, id]);
24736
24740
  return /*#__PURE__*/React__default["default"].createElement(StyledOption, {
24737
24741
  ref: hover ? ref : null,
24738
24742
  title: tooltip === false ? undefined : tooltip || name,
@@ -24740,7 +24744,7 @@
24740
24744
  onTouchStart: handleOnMouseEnter,
24741
24745
  className: classnames__default["default"]("c-option", className),
24742
24746
  hover: hover,
24743
- onClick: onClick
24747
+ onClick: handleOnClick
24744
24748
  }, /*#__PURE__*/React__default["default"].createElement(StyledOptionContent, null, renderOption ? renderOption : name));
24745
24749
  });
24746
24750
  Option.displayName = "Option";
@@ -25390,10 +25394,14 @@
25390
25394
  by: "mouse"
25391
25395
  });
25392
25396
  }, []);
25393
- var handleClick = React.useCallback(function (e) {
25397
+ var handleClick = React.useCallback(function (e, id) {
25394
25398
  e.preventDefault();
25395
- toggleSelected(hover.item);
25396
- }, [toggleSelected, hover]);
25399
+ toggleSelected(id);
25400
+ setHover({
25401
+ item: id,
25402
+ by: "mouse"
25403
+ });
25404
+ }, [toggleSelected]);
25397
25405
  var handleRenderOption = React.useCallback(function (item, index) {
25398
25406
  if (isOptionGroup(item)) {
25399
25407
  return /*#__PURE__*/React__default["default"].createElement(OptionGroup, {