@uzum-tech/ui 1.12.16 → 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
@@ -124706,6 +124706,8 @@
124706
124706
  cursor: not-allowed;
124707
124707
  pointer-events: none;
124708
124708
  opacity: .5;
124709
+ `), c$1("& .u-tabs-tab--checked", `
124710
+ color: var(--u-header-tab-text-color-active);
124709
124711
  `), c$1("& .u-tabs-tab:hover", `
124710
124712
  color: var(--u-header-tab-text-color-hover);
124711
124713
  `), c$1("& .u-tabs-bar", `
@@ -125248,6 +125250,33 @@
125248
125250
  function isLeafMenuOption(option) {
125249
125251
  return option.type !== "column";
125250
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
+ }
125251
125280
 
125252
125281
  const headerNavigationProps = {
125253
125282
  menuOptions: {
@@ -125283,6 +125312,10 @@
125283
125312
  type: String,
125284
125313
  required: true
125285
125314
  },
125315
+ activeMenuKey: {
125316
+ type: [String, Number],
125317
+ default: null
125318
+ },
125286
125319
  "onUpdate:menuValue": [Function, Array],
125287
125320
  onUpdateMenuValue: [Function, Array]
125288
125321
  };
@@ -125301,11 +125334,15 @@
125301
125334
  navRef.value = el;
125302
125335
  };
125303
125336
  const hoveredKeyRef = vue.ref(null);
125337
+ const activeMenuKeyRef = vue.toRef(props.activeMenuKey);
125304
125338
  const tabRefs = vue.ref({});
125305
125339
  const indicatorStyleRef = vue.ref({
125306
125340
  width: "0px",
125307
125341
  transform: "translateX(0)"
125308
125342
  });
125343
+ const checkedTopMenuKey = vue.computed(() => {
125344
+ return resolveTopLevelMenuKey(props.menuOptions, activeMenuKeyRef.value) ?? void 0;
125345
+ });
125309
125346
  function updateIndicator() {
125310
125347
  const navEl = navRef.value;
125311
125348
  if (!navEl) return;
@@ -125338,6 +125375,13 @@
125338
125375
  if (onUpdateMenuValue) call(onUpdateMenuValue, value);
125339
125376
  if (_onUpdateMenuValue) call(_onUpdateMenuValue, value);
125340
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
+ }
125341
125385
  vue.onMounted(async () => {
125342
125386
  await vue.nextTick(updateIndicator);
125343
125387
  window.addEventListener("resize", updateIndicator);
@@ -125377,7 +125421,11 @@
125377
125421
  navRef,
125378
125422
  setTabRef,
125379
125423
  indicatorStyle: indicatorStyleRef,
125380
- hoveredKey: hoveredKeyRef
125424
+ hoveredKey: hoveredKeyRef,
125425
+ activeMenuKey: activeMenuKeyRef,
125426
+ setActiveMenuKey,
125427
+ handleMenuItemClick,
125428
+ checkedTopMenuKey
125381
125429
  };
125382
125430
  },
125383
125431
  render() {
@@ -125409,7 +125457,10 @@
125409
125457
  ],
125410
125458
  role: "button",
125411
125459
  tabindex: option.disabled ? void 0 : 0,
125412
- onClick: option.onClick,
125460
+ onClick: (event) => {
125461
+ event.stopPropagation();
125462
+ this.handleMenuItemClick(option);
125463
+ },
125413
125464
  ...$props
125414
125465
  },
125415
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))),
@@ -125460,7 +125511,10 @@
125460
125511
  class: `${blockClass}__menu-column-title`,
125461
125512
  role: option.onClick ? "button" : void 0,
125462
125513
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125463
- onClick: option.onClick
125514
+ onClick: (event) => {
125515
+ event.stopPropagation();
125516
+ this.handleMenuItemClick(option);
125517
+ }
125464
125518
  },
125465
125519
  renderOptionLabel(option)
125466
125520
  ));
@@ -125477,7 +125531,10 @@
125477
125531
  class: `${blockClass}__menu-column-title`,
125478
125532
  role: option.onClick ? "button" : void 0,
125479
125533
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125480
- onClick: option.onClick
125534
+ onClick: (event) => {
125535
+ event.stopPropagation();
125536
+ this.handleMenuItemClick(option);
125537
+ }
125481
125538
  },
125482
125539
  renderOptionLabel(option)
125483
125540
  ), /* @__PURE__ */ vue.h("div", { class: `${blockClass}__menu-column-list` }, content));
@@ -125488,7 +125545,10 @@
125488
125545
  class: `${blockClass}__menu-column-title`,
125489
125546
  role: option.onClick ? "button" : void 0,
125490
125547
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125491
- onClick: option.onClick
125548
+ onClick: (event) => {
125549
+ event.stopPropagation();
125550
+ this.handleMenuItemClick(option);
125551
+ }
125492
125552
  },
125493
125553
  renderOptionLabel(option)
125494
125554
  ), /* @__PURE__ */ vue.h("div", { class: `${blockClass}__menu-column-list` }, content));
@@ -125612,6 +125672,7 @@
125612
125672
  /* @__PURE__ */ vue.h("div", { class: "u-tabs-pad", style: { width: tabsPaddingValue } }),
125613
125673
  menuItems.map((item, index) => {
125614
125674
  const isActive = activeValue === item.key;
125675
+ const isChecked = this.checkedTopMenuKey === item.key;
125615
125676
  const isOpen = isHoverTrigger ? this.hoveredKey === item.key : isActive;
125616
125677
  const isDisabled = !!item.option.disabled;
125617
125678
  const icon = typeof item.option.icon === "function" ? item.option.icon() : item.option.icon;
@@ -125624,7 +125685,8 @@
125624
125685
  "u-tabs-tab",
125625
125686
  `${blockClass}__tab`,
125626
125687
  isActive && "u-tabs-tab--active",
125627
- isDisabled && "u-tabs-tab--disabled"
125688
+ isDisabled && "u-tabs-tab--disabled",
125689
+ isChecked && "u-tabs-tab--checked"
125628
125690
  ],
125629
125691
  ref: this.setTabRef(item.key),
125630
125692
  role: "tab",
@@ -125645,9 +125707,7 @@
125645
125707
  if (!isHoverTrigger) {
125646
125708
  emitUpdate(item.key);
125647
125709
  }
125648
- if (item.option.onClick) {
125649
- item.option.onClick();
125650
- }
125710
+ this.handleMenuItemClick(item.option);
125651
125711
  } : void 0
125652
125712
  },
125653
125713
  icon ? /* @__PURE__ */ vue.h("span", { class: `${blockClass}__tab-icon` }, icon) : null,
@@ -126492,7 +126552,9 @@
126492
126552
  type: Array,
126493
126553
  default: () => defaultLangOptions
126494
126554
  },
126495
- defaultLang: [String, Number],
126555
+ defaultLang: {
126556
+ type: [String, Number]
126557
+ },
126496
126558
  menuPlacement: {
126497
126559
  type: String,
126498
126560
  default: "horizontal"
@@ -126501,8 +126563,13 @@
126501
126563
  type: String,
126502
126564
  default: "hover"
126503
126565
  },
126504
- menuValue: [String, Number],
126505
- defaultMenuValue: [String, Number],
126566
+ menuValue: {
126567
+ type: [String, Number]
126568
+ },
126569
+ activeMenuKey: {
126570
+ type: [String, Number],
126571
+ default: null
126572
+ },
126506
126573
  menuTabsProps: {
126507
126574
  type: Object,
126508
126575
  default: () => ({})
@@ -126603,9 +126670,7 @@
126603
126670
  props.langOptions?.find((opt) => opt.key === props.defaultLang) || props.langOptions?.[0] || defaultLangOptions[0]
126604
126671
  );
126605
126672
  const controlledMenuValueRef = vue.toRef(props, "menuValue");
126606
- const uncontrolledMenuValueRef = vue.ref(
126607
- props.defaultMenuValue ?? null
126608
- );
126673
+ const uncontrolledMenuValueRef = vue.ref(null);
126609
126674
  const mergedMenuValueRef = useMergedState(
126610
126675
  controlledMenuValueRef,
126611
126676
  uncontrolledMenuValueRef
@@ -126805,6 +126870,7 @@
126805
126870
  mergedClsPrefix,
126806
126871
  menuPaneClass: this.menuPaneClass,
126807
126872
  menuPaneWrapperClass: this.menuPaneWrapperClass,
126873
+ activeMenuKey: this.activeMenuKey,
126808
126874
  onUpdateMenuValue: this.handleMenuValueUpdate
126809
126875
  }
126810
126876
  );
@@ -128552,6 +128618,7 @@
128552
128618
  renderBadge: renderBadge,
128553
128619
  renderOptionLabel: renderOptionLabel,
128554
128620
  resolvePlacement: resolvePlacement,
128621
+ resolveTopLevelMenuKey: resolveTopLevelMenuKey,
128555
128622
  resultProps: resultProps,
128556
128623
  rowProps: rowProps,
128557
128624
  safeTopScrollbarProps: safeTopScrollbarProps,
@@ -128593,7 +128660,7 @@
128593
128660
  watermarkProps: watermarkProps
128594
128661
  });
128595
128662
 
128596
- var version = "1.12.16";
128663
+ var version = "1.12.17";
128597
128664
 
128598
128665
  function useExposeProxy(targetRef) {
128599
128666
  return new Proxy({}, {
@@ -129843,6 +129910,7 @@
129843
129910
  exports.renderBadge = renderBadge;
129844
129911
  exports.renderOptionLabel = renderOptionLabel;
129845
129912
  exports.resolvePlacement = resolvePlacement;
129913
+ exports.resolveTopLevelMenuKey = resolveTopLevelMenuKey;
129846
129914
  exports.resultDark = resultDark;
129847
129915
  exports.resultProps = resultProps;
129848
129916
  exports.rowProps = rowProps;