@banyan_cloud/roots 1.0.52 → 1.0.53

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/cjs/index.js CHANGED
@@ -103465,7 +103465,6 @@ var modules_a2cdc77c = {"root":"Toggle_module_root__c5dad2bc","theme-dark":"Togg
103465
103465
  n(css$1,{});
103466
103466
 
103467
103467
  var Toggle = /*#__PURE__*/React.forwardRef(function Toggle(props, ref) {
103468
- var _options$;
103469
103468
  // eslint-disable-next-line object-curly-newline
103470
103469
  var className = props.className,
103471
103470
  theme = props.theme,
@@ -103477,7 +103476,14 @@ var Toggle = /*#__PURE__*/React.forwardRef(function Toggle(props, ref) {
103477
103476
  color = props.color;
103478
103477
 
103479
103478
  // for uncontrolled input
103480
- var _useState = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : options === null || options === void 0 ? void 0 : (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value),
103479
+ var _useState = React.useState(function () {
103480
+ var _options$2;
103481
+ if (multi) {
103482
+ var _ref, _options$;
103483
+ return (_ref = defaultValue !== null && defaultValue !== void 0 ? defaultValue : options === null || options === void 0 ? void 0 : (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value) !== null && _ref !== void 0 ? _ref : [];
103484
+ }
103485
+ return defaultValue !== null && defaultValue !== void 0 ? defaultValue : options === null || options === void 0 ? void 0 : (_options$2 = options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.value;
103486
+ }),
103481
103487
  _useState2 = _slicedToArray(_useState, 2),
103482
103488
  uncontrolledValue = _useState2[0],
103483
103489
  setUncontrolledValue = _useState2[1];
@@ -103520,16 +103526,18 @@ var Toggle = /*#__PURE__*/React.forwardRef(function Toggle(props, ref) {
103520
103526
  } else {
103521
103527
  // if all are selected, select only the one being clicked
103522
103528
  if (allSelected) {
103529
+ var _newInputValue = [newValue];
103523
103530
  if (isControlled) {
103524
- onChange([newValue]);
103531
+ onChange(_newInputValue);
103525
103532
  } else {
103526
- setUncontrolledValue([newValue]);
103533
+ setUncontrolledValue(_newInputValue);
103527
103534
  }
103528
103535
  } else {
103536
+ var _newInputValue2 = [].concat(_toConsumableArray$1(inputValue), [newValue]);
103529
103537
  if (isControlled) {
103530
- onChange([].concat(_toConsumableArray$1(inputValue), [newValue]));
103538
+ onChange(_newInputValue2);
103531
103539
  } else {
103532
- setUncontrolledValue([].concat(_toConsumableArray$1(inputValue), [newValue]));
103540
+ setUncontrolledValue(_newInputValue2);
103533
103541
  }
103534
103542
  }
103535
103543
  }