@uzum-tech/ui 1.12.15 → 1.12.17

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
@@ -97588,11 +97588,21 @@
97588
97588
  function handleBeforeLeave() {
97589
97589
  const { onBeforeLeave, onBeforeHide } = props;
97590
97590
  if (onBeforeLeave) call(onBeforeLeave);
97591
+ void vue.nextTick(() => {
97592
+ if (document.activeElement && document.activeElement !== document.body) {
97593
+ document.activeElement.blur();
97594
+ }
97595
+ });
97591
97596
  if (onBeforeHide) onBeforeHide();
97592
97597
  }
97593
97598
  function handleAfterLeave() {
97594
97599
  const { onAfterLeave, onAfterHide } = props;
97595
97600
  if (onAfterLeave) call(onAfterLeave);
97601
+ void vue.nextTick(() => {
97602
+ if (document.activeElement && document.activeElement !== document.body) {
97603
+ document.activeElement.blur();
97604
+ }
97605
+ });
97596
97606
  if (onAfterHide) onAfterHide();
97597
97607
  }
97598
97608
  function handleClickoutside(e) {
@@ -124696,6 +124706,8 @@
124696
124706
  cursor: not-allowed;
124697
124707
  pointer-events: none;
124698
124708
  opacity: .5;
124709
+ `), c$1("& .u-tabs-tab--checked", `
124710
+ color: var(--u-header-tab-text-color-active);
124699
124711
  `), c$1("& .u-tabs-tab:hover", `
124700
124712
  color: var(--u-header-tab-text-color-hover);
124701
124713
  `), c$1("& .u-tabs-bar", `
@@ -125238,6 +125250,33 @@
125238
125250
  function isLeafMenuOption(option) {
125239
125251
  return option.type !== "column";
125240
125252
  }
125253
+ function isMenuValueInChildren(children, value) {
125254
+ if (!children || children.length === 0) return false;
125255
+ for (const child of children) {
125256
+ if (isDividerOption(child)) continue;
125257
+ if (isColumnOption(child)) {
125258
+ if (isMenuValueInChildren(child.children, value)) return true;
125259
+ continue;
125260
+ }
125261
+ if (child.key === value) return true;
125262
+ if (isGroupOption(child) || hasChildren(child)) {
125263
+ if (isMenuValueInChildren(child.children, value)) return true;
125264
+ }
125265
+ }
125266
+ return false;
125267
+ }
125268
+ function resolveTopLevelMenuKey(menuOptions, activeMenuKey) {
125269
+ if (activeMenuKey === null || activeMenuKey === void 0) return null;
125270
+ for (let index = 0; index < menuOptions.length; index += 1) {
125271
+ const option = menuOptions[index];
125272
+ const optionKey = getMenuItemKey(option, index);
125273
+ if (optionKey === activeMenuKey) return optionKey;
125274
+ if (isMenuValueInChildren(option.children, activeMenuKey)) {
125275
+ return optionKey;
125276
+ }
125277
+ }
125278
+ return null;
125279
+ }
125241
125280
 
125242
125281
  const headerNavigationProps = {
125243
125282
  menuOptions: {
@@ -125273,6 +125312,10 @@
125273
125312
  type: String,
125274
125313
  required: true
125275
125314
  },
125315
+ activeMenuKey: {
125316
+ type: [String, Number],
125317
+ default: null
125318
+ },
125276
125319
  "onUpdate:menuValue": [Function, Array],
125277
125320
  onUpdateMenuValue: [Function, Array]
125278
125321
  };
@@ -125291,11 +125334,15 @@
125291
125334
  navRef.value = el;
125292
125335
  };
125293
125336
  const hoveredKeyRef = vue.ref(null);
125337
+ const activeMenuKeyRef = vue.toRef(props.activeMenuKey);
125294
125338
  const tabRefs = vue.ref({});
125295
125339
  const indicatorStyleRef = vue.ref({
125296
125340
  width: "0px",
125297
125341
  transform: "translateX(0)"
125298
125342
  });
125343
+ const checkedTopMenuKey = vue.computed(() => {
125344
+ return resolveTopLevelMenuKey(props.menuOptions, activeMenuKeyRef.value) ?? void 0;
125345
+ });
125299
125346
  function updateIndicator() {
125300
125347
  const navEl = navRef.value;
125301
125348
  if (!navEl) return;
@@ -125328,6 +125375,13 @@
125328
125375
  if (onUpdateMenuValue) call(onUpdateMenuValue, value);
125329
125376
  if (_onUpdateMenuValue) call(_onUpdateMenuValue, value);
125330
125377
  }
125378
+ function setActiveMenuKey(key = null) {
125379
+ activeMenuKeyRef.value = key;
125380
+ }
125381
+ function handleMenuItemClick(option) {
125382
+ setActiveMenuKey(option?.key);
125383
+ if (option.onClick) option?.onClick();
125384
+ }
125331
125385
  vue.onMounted(async () => {
125332
125386
  await vue.nextTick(updateIndicator);
125333
125387
  window.addEventListener("resize", updateIndicator);
@@ -125367,7 +125421,11 @@
125367
125421
  navRef,
125368
125422
  setTabRef,
125369
125423
  indicatorStyle: indicatorStyleRef,
125370
- hoveredKey: hoveredKeyRef
125424
+ hoveredKey: hoveredKeyRef,
125425
+ activeMenuKey: activeMenuKeyRef,
125426
+ setActiveMenuKey,
125427
+ handleMenuItemClick,
125428
+ checkedTopMenuKey
125371
125429
  };
125372
125430
  },
125373
125431
  render() {
@@ -125399,7 +125457,10 @@
125399
125457
  ],
125400
125458
  role: "button",
125401
125459
  tabindex: option.disabled ? void 0 : 0,
125402
- onClick: option.onClick,
125460
+ onClick: (event) => {
125461
+ event.stopPropagation();
125462
+ this.handleMenuItemClick(option);
125463
+ },
125403
125464
  ...$props
125404
125465
  },
125405
125466
  /* @__PURE__ */ vue.h("span", { class: `${blockClass}__menu-item-main` }, icon ? /* @__PURE__ */ vue.h("span", { class: `${blockClass}__menu-item-icon` }, icon) : null, /* @__PURE__ */ vue.h("span", { class: `${blockClass}__menu-item-label` }, renderOptionLabel(option))),
@@ -125450,7 +125511,10 @@
125450
125511
  class: `${blockClass}__menu-column-title`,
125451
125512
  role: option.onClick ? "button" : void 0,
125452
125513
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125453
- onClick: option.onClick
125514
+ onClick: (event) => {
125515
+ event.stopPropagation();
125516
+ this.handleMenuItemClick(option);
125517
+ }
125454
125518
  },
125455
125519
  renderOptionLabel(option)
125456
125520
  ));
@@ -125467,7 +125531,10 @@
125467
125531
  class: `${blockClass}__menu-column-title`,
125468
125532
  role: option.onClick ? "button" : void 0,
125469
125533
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125470
- onClick: option.onClick
125534
+ onClick: (event) => {
125535
+ event.stopPropagation();
125536
+ this.handleMenuItemClick(option);
125537
+ }
125471
125538
  },
125472
125539
  renderOptionLabel(option)
125473
125540
  ), /* @__PURE__ */ vue.h("div", { class: `${blockClass}__menu-column-list` }, content));
@@ -125478,7 +125545,10 @@
125478
125545
  class: `${blockClass}__menu-column-title`,
125479
125546
  role: option.onClick ? "button" : void 0,
125480
125547
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125481
- onClick: option.onClick
125548
+ onClick: (event) => {
125549
+ event.stopPropagation();
125550
+ this.handleMenuItemClick(option);
125551
+ }
125482
125552
  },
125483
125553
  renderOptionLabel(option)
125484
125554
  ), /* @__PURE__ */ vue.h("div", { class: `${blockClass}__menu-column-list` }, content));
@@ -125602,6 +125672,7 @@
125602
125672
  /* @__PURE__ */ vue.h("div", { class: "u-tabs-pad", style: { width: tabsPaddingValue } }),
125603
125673
  menuItems.map((item, index) => {
125604
125674
  const isActive = activeValue === item.key;
125675
+ const isChecked = this.checkedTopMenuKey === item.key;
125605
125676
  const isOpen = isHoverTrigger ? this.hoveredKey === item.key : isActive;
125606
125677
  const isDisabled = !!item.option.disabled;
125607
125678
  const icon = typeof item.option.icon === "function" ? item.option.icon() : item.option.icon;
@@ -125614,7 +125685,8 @@
125614
125685
  "u-tabs-tab",
125615
125686
  `${blockClass}__tab`,
125616
125687
  isActive && "u-tabs-tab--active",
125617
- isDisabled && "u-tabs-tab--disabled"
125688
+ isDisabled && "u-tabs-tab--disabled",
125689
+ isChecked && "u-tabs-tab--checked"
125618
125690
  ],
125619
125691
  ref: this.setTabRef(item.key),
125620
125692
  role: "tab",
@@ -125635,9 +125707,7 @@
125635
125707
  if (!isHoverTrigger) {
125636
125708
  emitUpdate(item.key);
125637
125709
  }
125638
- if (item.option.onClick) {
125639
- item.option.onClick();
125640
- }
125710
+ this.handleMenuItemClick(item.option);
125641
125711
  } : void 0
125642
125712
  },
125643
125713
  icon ? /* @__PURE__ */ vue.h("span", { class: `${blockClass}__tab-icon` }, icon) : null,
@@ -126482,7 +126552,9 @@
126482
126552
  type: Array,
126483
126553
  default: () => defaultLangOptions
126484
126554
  },
126485
- defaultLang: [String, Number],
126555
+ defaultLang: {
126556
+ type: [String, Number]
126557
+ },
126486
126558
  menuPlacement: {
126487
126559
  type: String,
126488
126560
  default: "horizontal"
@@ -126491,8 +126563,13 @@
126491
126563
  type: String,
126492
126564
  default: "hover"
126493
126565
  },
126494
- menuValue: [String, Number],
126495
- defaultMenuValue: [String, Number],
126566
+ menuValue: {
126567
+ type: [String, Number]
126568
+ },
126569
+ activeMenuKey: {
126570
+ type: [String, Number],
126571
+ default: null
126572
+ },
126496
126573
  menuTabsProps: {
126497
126574
  type: Object,
126498
126575
  default: () => ({})
@@ -126568,7 +126645,7 @@
126568
126645
  props,
126569
126646
  mergedClsPrefixRef
126570
126647
  );
126571
- const isMobileRef = props.isMobile;
126648
+ const isMobileRef = vue.toRef(props, "isMobile");
126572
126649
  const mobileMenuVisibleRef = vue.ref(false);
126573
126650
  const searchVisibleRef = vue.ref(false);
126574
126651
  vue.onBeforeMount(() => {
@@ -126593,9 +126670,7 @@
126593
126670
  props.langOptions?.find((opt) => opt.key === props.defaultLang) || props.langOptions?.[0] || defaultLangOptions[0]
126594
126671
  );
126595
126672
  const controlledMenuValueRef = vue.toRef(props, "menuValue");
126596
- const uncontrolledMenuValueRef = vue.ref(
126597
- props.defaultMenuValue ?? null
126598
- );
126673
+ const uncontrolledMenuValueRef = vue.ref(null);
126599
126674
  const mergedMenuValueRef = useMergedState(
126600
126675
  controlledMenuValueRef,
126601
126676
  uncontrolledMenuValueRef
@@ -126795,6 +126870,7 @@
126795
126870
  mergedClsPrefix,
126796
126871
  menuPaneClass: this.menuPaneClass,
126797
126872
  menuPaneWrapperClass: this.menuPaneWrapperClass,
126873
+ activeMenuKey: this.activeMenuKey,
126798
126874
  onUpdateMenuValue: this.handleMenuValueUpdate
126799
126875
  }
126800
126876
  );
@@ -128542,6 +128618,7 @@
128542
128618
  renderBadge: renderBadge,
128543
128619
  renderOptionLabel: renderOptionLabel,
128544
128620
  resolvePlacement: resolvePlacement,
128621
+ resolveTopLevelMenuKey: resolveTopLevelMenuKey,
128545
128622
  resultProps: resultProps,
128546
128623
  rowProps: rowProps,
128547
128624
  safeTopScrollbarProps: safeTopScrollbarProps,
@@ -128583,7 +128660,7 @@
128583
128660
  watermarkProps: watermarkProps
128584
128661
  });
128585
128662
 
128586
- var version = "1.12.15";
128663
+ var version = "1.12.17";
128587
128664
 
128588
128665
  function useExposeProxy(targetRef) {
128589
128666
  return new Proxy({}, {
@@ -129833,6 +129910,7 @@
129833
129910
  exports.renderBadge = renderBadge;
129834
129911
  exports.renderOptionLabel = renderOptionLabel;
129835
129912
  exports.resolvePlacement = resolvePlacement;
129913
+ exports.resolveTopLevelMenuKey = resolveTopLevelMenuKey;
129836
129914
  exports.resultDark = resultDark;
129837
129915
  exports.resultProps = resultProps;
129838
129916
  exports.rowProps = rowProps;