@carbon/vue 3.0.30 → 3.0.31

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.
@@ -3706,8 +3706,12 @@ __webpack_require__.d(__webpack_exports__, {
3706
3706
 
3707
3707
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js + 2 modules
3708
3708
  var defineProperty = __webpack_require__(9635);
3709
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
3710
+ var asyncToGenerator = __webpack_require__(6356);
3709
3711
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
3710
3712
  var objectSpread2 = __webpack_require__(2378);
3713
+ // EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
3714
+ var runtime = __webpack_require__(7452);
3711
3715
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js
3712
3716
  var es_array_includes = __webpack_require__(7746);
3713
3717
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
@@ -3728,6 +3732,8 @@ var cvContentSwitcherStore = __webpack_require__(7000);
3728
3732
 
3729
3733
 
3730
3734
 
3735
+
3736
+
3731
3737
  var _hoisted_1 = ["id"];
3732
3738
 
3733
3739
 
@@ -3754,6 +3760,26 @@ var _hoisted_1 = ["id"];
3754
3760
  var isLight = (0,cvTheme/* useIsLight */.I)(props);
3755
3761
  cvContentSwitcherStore/* default */.A.addParent(cvId.value);
3756
3762
  cvContentSwitcherStore/* default */.A.setContentSelected('global', undefined);
3763
+
3764
+ // Check for initial selection after child components have set up
3765
+ var hadInitialSelection = null;
3766
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(/*#__PURE__*/(0,asyncToGenerator/* default */.A)(/*#__PURE__*/regeneratorRuntime.mark(function _callee() {
3767
+ var _store$state$cvId$val, _store$state$cvId$val2;
3768
+ return regeneratorRuntime.wrap(function _callee$(_context) {
3769
+ while (1) {
3770
+ switch (_context.prev = _context.next) {
3771
+ case 0:
3772
+ _context.next = 2;
3773
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
3774
+ case 2:
3775
+ hadInitialSelection = ((_store$state$cvId$val = cvContentSwitcherStore/* default */.A.state[cvId.value]) === null || _store$state$cvId$val === void 0 ? void 0 : _store$state$cvId$val.selected) !== undefined && ((_store$state$cvId$val2 = cvContentSwitcherStore/* default */.A.state[cvId.value]) === null || _store$state$cvId$val2 === void 0 ? void 0 : _store$state$cvId$val2.selected) !== '';
3776
+ case 3:
3777
+ case "end":
3778
+ return _context.stop();
3779
+ }
3780
+ }
3781
+ }, _callee);
3782
+ })));
3757
3783
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onUnmounted)(function () {
3758
3784
  cvContentSwitcherStore/* default */.A.removeParent(cvId.value);
3759
3785
  });
@@ -3761,7 +3787,7 @@ var _hoisted_1 = ["id"];
3761
3787
  return cvContentSwitcherStore/* default */.A.state.global.latest;
3762
3788
  }, function (val, prev) {
3763
3789
  // if previous is not set, do not emit. This mimics the current v2 behaviour where the initial content does not generate an event
3764
- if (prev) emit('selected', val);
3790
+ if (prev || val && hadInitialSelection === false) emit('selected', val);
3765
3791
  });
3766
3792
  var ourLatest = undefined;
3767
3793
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(function () {
@@ -3769,17 +3795,18 @@ var _hoisted_1 = ["id"];
3769
3795
  }, function (val) {
3770
3796
  if (ourLatest !== (val === null || val === void 0 ? void 0 : val.latest)) {
3771
3797
  // if ourLatest is not set, do not emit. This mimics the current v2 behaviour where the initial content does not generate an event
3772
- if (ourLatest) emit('selected', val === null || val === void 0 ? void 0 : val.latest);
3798
+ // However, if there was no initial selection (selectedIndex=-1), we should emit on first click
3799
+ if (ourLatest || val !== null && val !== void 0 && val.latest && hadInitialSelection === false) emit('selected', val === null || val === void 0 ? void 0 : val.latest);
3773
3800
  ourLatest = val === null || val === void 0 ? void 0 : val.latest;
3774
3801
  }
3775
3802
  }, {
3776
3803
  deep: true
3777
3804
  });
3778
3805
  return function (_ctx, _cache) {
3779
- var _ref2;
3806
+ var _ref3;
3780
3807
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", {
3781
3808
  id: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(cvId),
3782
- class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.normalizeClass)(["cv-content-switcher ".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--content-switcher"), (_ref2 = {}, (0,defineProperty/* default */.A)(_ref2, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--content-switcher--light"), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(isLight)), (0,defineProperty/* default */.A)(_ref2, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--content-switcher--").concat(__props.size || 'md'), __props.size || 'md'), _ref2)]),
3809
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.normalizeClass)(["cv-content-switcher ".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--content-switcher"), (_ref3 = {}, (0,defineProperty/* default */.A)(_ref3, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--content-switcher--light"), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(isLight)), (0,defineProperty/* default */.A)(_ref3, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--content-switcher--").concat(__props.size || 'md'), __props.size || 'md'), _ref3)]),
3783
3810
  role: "tablist"
3784
3811
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderSlot)(_ctx.$slots, "default")], 10, _hoisted_1);
3785
3812
  };
@@ -21197,12 +21224,12 @@ __webpack_require__.d(__webpack_exports__, {
21197
21224
 
21198
21225
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js + 2 modules
21199
21226
  var defineProperty = __webpack_require__(9635);
21227
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.fixed.js
21228
+ var es_string_fixed = __webpack_require__(9607);
21200
21229
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
21201
21230
  var es_object_to_string = __webpack_require__(5086);
21202
21231
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
21203
21232
  var web_dom_collections_for_each = __webpack_require__(8379);
21204
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.fixed.js
21205
- var es_string_fixed = __webpack_require__(9607);
21206
21233
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
21207
21234
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(9274);
21208
21235
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
@@ -21348,6 +21375,9 @@ var CvSideNavvue_type_script_setup_true_lang_js_hoisted_1 = ["id", "aria-hidden"
21348
21375
  data.dataExpanded = val;
21349
21376
  }
21350
21377
  });
21378
+ var isHidden = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(function () {
21379
+ return !panelExpanded.value && !props.fixed && !props.rail;
21380
+ });
21351
21381
  /**
21352
21382
  * @type {CvHeaderPanel}
21353
21383
  */
@@ -21449,8 +21479,8 @@ var CvSideNavvue_type_script_setup_true_lang_js_hoisted_1 = ["id", "aria-hidden"
21449
21479
  ref_key: "el",
21450
21480
  ref: el,
21451
21481
  class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.normalizeClass)(["cv-side-nav", "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--side-nav"), "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--side-nav__navigation"), (_ref2 = {}, (0,defineProperty/* default */.A)(_ref2, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--side-nav--expanded"), panelExpanded.value), (0,defineProperty/* default */.A)(_ref2, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--side-nav--rail"), __props.rail), (0,defineProperty/* default */.A)(_ref2, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--side-nav--collapsed"), !panelExpanded.value && __props.fixed), (0,defineProperty/* default */.A)(_ref2, "".concat((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(settings/* carbonPrefix */.s), "--side-nav--ux"), isChildOfHeader.value), _ref2)]),
21452
- "aria-hidden": !panelExpanded.value && !__props.fixed ? 'true' : 'false',
21453
- inert: !panelExpanded.value && !__props.fixed,
21482
+ "aria-hidden": isHidden.value ? 'true' : 'false',
21483
+ inert: isHidden.value,
21454
21484
  onFocusout: onFocusout,
21455
21485
  onMousedown: onMouseDown,
21456
21486
  onMouseenter: _cache[0] || (_cache[0] = function ($event) {