@activecollab/components 2.0.559 → 2.0.561

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
@@ -23850,10 +23850,10 @@
23850
23850
  var RadioButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
23851
23851
  var _ref$className = _ref.className,
23852
23852
  className = _ref$className === void 0 ? "" : _ref$className,
23853
- _ref$id = _ref.id,
23854
- id = _ref$id === void 0 ? "radio" : _ref$id,
23853
+ id = _ref.id,
23855
23854
  hover = _ref.hover,
23856
23855
  props = _objectWithoutProperties(_ref, _excluded$1p);
23856
+ var inputId = useStableId(id);
23857
23857
  return /*#__PURE__*/React__default["default"].createElement(StyledRadioButton$1, {
23858
23858
  className: classnames__default["default"]("c-radio-btn", {
23859
23859
  "c-radio-btn__hover": hover,
@@ -23862,12 +23862,12 @@
23862
23862
  $isHovered: hover,
23863
23863
  $isControlled: typeof hover === "boolean"
23864
23864
  }, /*#__PURE__*/React__default["default"].createElement(StyledRadioInput, _extends({
23865
- id: id,
23865
+ id: inputId,
23866
23866
  className: "c-radio-btn--input",
23867
23867
  type: "radio",
23868
23868
  ref: ref
23869
23869
  }, props)), /*#__PURE__*/React__default["default"].createElement(StyledRadioLabel, {
23870
- htmlFor: id,
23870
+ htmlFor: inputId,
23871
23871
  className: "c-radio-btn--label"
23872
23872
  }, /*#__PURE__*/React__default["default"].createElement(RadioButtonIcon$1, {
23873
23873
  width: "16",
@@ -25443,6 +25443,16 @@
25443
25443
  by: "mouse"
25444
25444
  });
25445
25445
  }, []);
25446
+
25447
+ // React bubbles events from an option's portal content through the list, so only presses inside the list are kept.
25448
+ var keepFocusInSearchField = React.useCallback(function (e) {
25449
+ var _inputEl$current2;
25450
+ if (e.button !== 0 || !e.currentTarget.contains(e.target)) {
25451
+ return;
25452
+ }
25453
+ e.preventDefault();
25454
+ inputEl === null || inputEl === void 0 || (_inputEl$current2 = inputEl.current) === null || _inputEl$current2 === void 0 || _inputEl$current2.focus();
25455
+ }, [inputEl]);
25446
25456
  React.useEffect(function () {
25447
25457
  if (hover.by === "keyboard" && hover.item !== undefined) {
25448
25458
  var index = virtualItems.findIndex(function (item) {
@@ -25601,7 +25611,8 @@
25601
25611
  var _onScroll = _ref2.onScroll;
25602
25612
  return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteBody, {
25603
25613
  key: "body",
25604
- onMouseLeave: handleOnMouseLeave
25614
+ onMouseLeave: handleOnMouseLeave,
25615
+ onMouseDown: inputEl ? keepFocusInSearchField : undefined
25605
25616
  }, /*#__PURE__*/React__default["default"].createElement("div", {
25606
25617
  ref: listContainerRef,
25607
25618
  style: {
@@ -30232,6 +30243,7 @@
30232
30243
  var internalRef = React.useRef(null);
30233
30244
  var flexContainerRef = React.useRef(null);
30234
30245
  var handleRef = useForkRef(ref, internalRef);
30246
+ var instanceId = useStableId();
30235
30247
  var _useState = React.useState(false),
30236
30248
  _useState2 = _slicedToArray(_useState, 2),
30237
30249
  useVerticalLayout = _useState2[0],
@@ -30299,6 +30311,7 @@
30299
30311
  width: "100%"
30300
30312
  }
30301
30313
  }), useVerticalLayout ? /*#__PURE__*/React__default["default"].createElement(StyledVerticalContainer, null, options.map(function (option) {
30314
+ var inputId = "".concat(instanceId, "-").concat(option.id);
30302
30315
  return /*#__PURE__*/React__default["default"].createElement(StyledRadioOption, {
30303
30316
  $disabled: !!option.disabled,
30304
30317
  key: option.id,
@@ -30309,20 +30322,20 @@
30309
30322
  onChange: function onChange() {
30310
30323
  return !option.disabled && handleSelect(option.id);
30311
30324
  },
30312
- name: "choose-v2-".concat(option.id),
30313
- id: "choose-v2-".concat(option.id)
30325
+ name: inputId,
30326
+ id: inputId
30314
30327
  }) : /*#__PURE__*/React__default["default"].createElement(RadioButton, {
30315
30328
  checked: selected.includes(option.id),
30316
30329
  disabled: option.disabled,
30317
30330
  onChange: function onChange() {
30318
30331
  return !option.disabled && handleSelect(option.id);
30319
30332
  },
30320
- id: "choose-v2-".concat(option.id),
30321
- name: "choose-v2-".concat(option.id)
30333
+ id: inputId,
30334
+ name: instanceId
30322
30335
  }), /*#__PURE__*/React__default["default"].createElement(StyledLabel, {
30323
30336
  $disabled: !!option.disabled,
30324
30337
  weight: "regular",
30325
- htmlFor: "choose-v2-".concat(option.id)
30338
+ htmlFor: inputId
30326
30339
  }, option.name));
30327
30340
  })) : /*#__PURE__*/React__default["default"].createElement(StyledFlexContainer, {
30328
30341
  ref: flexContainerRef