@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.
@@ -3696,8 +3696,12 @@ __webpack_require__.d(__webpack_exports__, {
3696
3696
 
3697
3697
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js + 2 modules
3698
3698
  var defineProperty = __webpack_require__(139);
3699
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
3700
+ var asyncToGenerator = __webpack_require__(698);
3699
3701
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
3700
3702
  var objectSpread2 = __webpack_require__(8844);
3703
+ // EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
3704
+ var runtime = __webpack_require__(7452);
3701
3705
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js
3702
3706
  var es_array_includes = __webpack_require__(7746);
3703
3707
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
@@ -3718,6 +3722,8 @@ var cvContentSwitcherStore = __webpack_require__(5246);
3718
3722
 
3719
3723
 
3720
3724
 
3725
+
3726
+
3721
3727
  var _hoisted_1 = ["id"];
3722
3728
 
3723
3729
 
@@ -3744,6 +3750,26 @@ var _hoisted_1 = ["id"];
3744
3750
  var isLight = (0,cvTheme/* useIsLight */.I)(props);
3745
3751
  cvContentSwitcherStore/* default */.A.addParent(cvId.value);
3746
3752
  cvContentSwitcherStore/* default */.A.setContentSelected('global', undefined);
3753
+
3754
+ // Check for initial selection after child components have set up
3755
+ var hadInitialSelection = null;
3756
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(/*#__PURE__*/(0,asyncToGenerator/* default */.A)(/*#__PURE__*/regeneratorRuntime.mark(function _callee() {
3757
+ var _store$state$cvId$val, _store$state$cvId$val2;
3758
+ return regeneratorRuntime.wrap(function _callee$(_context) {
3759
+ while (1) {
3760
+ switch (_context.prev = _context.next) {
3761
+ case 0:
3762
+ _context.next = 2;
3763
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
3764
+ case 2:
3765
+ 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) !== '';
3766
+ case 3:
3767
+ case "end":
3768
+ return _context.stop();
3769
+ }
3770
+ }
3771
+ }, _callee);
3772
+ })));
3747
3773
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onUnmounted)(function () {
3748
3774
  cvContentSwitcherStore/* default */.A.removeParent(cvId.value);
3749
3775
  });
@@ -3751,7 +3777,7 @@ var _hoisted_1 = ["id"];
3751
3777
  return cvContentSwitcherStore/* default */.A.state.global.latest;
3752
3778
  }, function (val, prev) {
3753
3779
  // if previous is not set, do not emit. This mimics the current v2 behaviour where the initial content does not generate an event
3754
- if (prev) emit('selected', val);
3780
+ if (prev || val && hadInitialSelection === false) emit('selected', val);
3755
3781
  });
3756
3782
  var ourLatest = undefined;
3757
3783
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(function () {
@@ -3759,17 +3785,18 @@ var _hoisted_1 = ["id"];
3759
3785
  }, function (val) {
3760
3786
  if (ourLatest !== (val === null || val === void 0 ? void 0 : val.latest)) {
3761
3787
  // if ourLatest is not set, do not emit. This mimics the current v2 behaviour where the initial content does not generate an event
3762
- if (ourLatest) emit('selected', val === null || val === void 0 ? void 0 : val.latest);
3788
+ // However, if there was no initial selection (selectedIndex=-1), we should emit on first click
3789
+ if (ourLatest || val !== null && val !== void 0 && val.latest && hadInitialSelection === false) emit('selected', val === null || val === void 0 ? void 0 : val.latest);
3763
3790
  ourLatest = val === null || val === void 0 ? void 0 : val.latest;
3764
3791
  }
3765
3792
  }, {
3766
3793
  deep: true
3767
3794
  });
3768
3795
  return function (_ctx, _cache) {
3769
- var _ref2;
3796
+ var _ref3;
3770
3797
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", {
3771
3798
  id: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(cvId),
3772
- 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)]),
3799
+ 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)]),
3773
3800
  role: "tablist"
3774
3801
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderSlot)(_ctx.$slots, "default")], 10, _hoisted_1);
3775
3802
  };
@@ -21187,12 +21214,12 @@ __webpack_require__.d(__webpack_exports__, {
21187
21214
 
21188
21215
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js + 2 modules
21189
21216
  var defineProperty = __webpack_require__(139);
21217
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.fixed.js
21218
+ var es_string_fixed = __webpack_require__(9607);
21190
21219
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
21191
21220
  var es_object_to_string = __webpack_require__(5086);
21192
21221
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
21193
21222
  var web_dom_collections_for_each = __webpack_require__(8379);
21194
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.fixed.js
21195
- var es_string_fixed = __webpack_require__(9607);
21196
21223
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
21197
21224
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(4100);
21198
21225
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
@@ -21338,6 +21365,9 @@ var CvSideNavvue_type_script_setup_true_lang_js_hoisted_1 = ["id", "aria-hidden"
21338
21365
  data.dataExpanded = val;
21339
21366
  }
21340
21367
  });
21368
+ var isHidden = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(function () {
21369
+ return !panelExpanded.value && !props.fixed && !props.rail;
21370
+ });
21341
21371
  /**
21342
21372
  * @type {CvHeaderPanel}
21343
21373
  */
@@ -21439,8 +21469,8 @@ var CvSideNavvue_type_script_setup_true_lang_js_hoisted_1 = ["id", "aria-hidden"
21439
21469
  ref_key: "el",
21440
21470
  ref: el,
21441
21471
  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)]),
21442
- "aria-hidden": !panelExpanded.value && !__props.fixed ? 'true' : 'false',
21443
- inert: !panelExpanded.value && !__props.fixed,
21472
+ "aria-hidden": isHidden.value ? 'true' : 'false',
21473
+ inert: isHidden.value,
21444
21474
  onFocusout: onFocusout,
21445
21475
  onMousedown: onMouseDown,
21446
21476
  onMouseenter: _cache[0] || (_cache[0] = function ($event) {