@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.
@@ -188,6 +188,7 @@ import { CropTheme } from '../../crop/styles';
188
188
  import { SafeTopScrollbarTheme } from '../../_internal/safe-top-scrollbar/styles';
189
189
  import { HeaderTheme } from '../../header/styles';
190
190
  import { QrCodeTheme } from '../../qr-code/styles';
191
+ import { HeaderProps } from '../../header';
191
192
  export interface GlobalThemeWithoutCommon {
192
193
  Alert?: AlertTheme;
193
194
  Anchor?: AnchorTheme;
@@ -385,6 +386,7 @@ export interface GlobalComponentConfig {
385
386
  CardList?: CardListProps;
386
387
  Chat?: ChatProps;
387
388
  Text?: TextProps;
389
+ Header?: HeaderProps;
388
390
  InputOtp?: InputOtpProps;
389
391
  }
390
392
  export interface GlobalIconConfig {
@@ -12,7 +12,9 @@ export declare const headerProps: {
12
12
  type: PropType<HeaderPropsInterface["langOptions"]>;
13
13
  default: () => LangOption[];
14
14
  };
15
- defaultLang: PropType<HeaderPropsInterface["defaultLang"]>;
15
+ defaultLang: {
16
+ type: PropType<HeaderPropsInterface["defaultLang"]>;
17
+ };
16
18
  menuPlacement: {
17
19
  type: PropType<HeaderPropsInterface["menuPlacement"]>;
18
20
  default: string;
@@ -21,8 +23,13 @@ export declare const headerProps: {
21
23
  type: PropType<HeaderPropsInterface["menuTrigger"]>;
22
24
  default: string;
23
25
  };
24
- menuValue: PropType<HeaderPropsInterface["menuValue"]>;
25
- defaultMenuValue: PropType<HeaderPropsInterface["defaultMenuValue"]>;
26
+ menuValue: {
27
+ type: PropType<HeaderPropsInterface["menuValue"]>;
28
+ };
29
+ activeMenuKey: {
30
+ type: PropType<HeaderPropsInterface["activeMenuKey"]>;
31
+ default: null;
32
+ };
26
33
  menuTabsProps: {
27
34
  type: PropType<HeaderPropsInterface["menuTabsProps"]>;
28
35
  default: () => {};
@@ -186,7 +193,9 @@ declare const _default: import("vue").DefineComponent<{
186
193
  type: PropType<HeaderPropsInterface["langOptions"]>;
187
194
  default: () => LangOption[];
188
195
  };
189
- defaultLang: PropType<HeaderPropsInterface["defaultLang"]>;
196
+ defaultLang: {
197
+ type: PropType<HeaderPropsInterface["defaultLang"]>;
198
+ };
190
199
  menuPlacement: {
191
200
  type: PropType<HeaderPropsInterface["menuPlacement"]>;
192
201
  default: string;
@@ -195,8 +204,13 @@ declare const _default: import("vue").DefineComponent<{
195
204
  type: PropType<HeaderPropsInterface["menuTrigger"]>;
196
205
  default: string;
197
206
  };
198
- menuValue: PropType<HeaderPropsInterface["menuValue"]>;
199
- defaultMenuValue: PropType<HeaderPropsInterface["defaultMenuValue"]>;
207
+ menuValue: {
208
+ type: PropType<HeaderPropsInterface["menuValue"]>;
209
+ };
210
+ activeMenuKey: {
211
+ type: PropType<HeaderPropsInterface["activeMenuKey"]>;
212
+ default: null;
213
+ };
200
214
  menuTabsProps: {
201
215
  type: PropType<HeaderPropsInterface["menuTabsProps"]>;
202
216
  default: () => {};
@@ -396,7 +410,7 @@ declare const _default: import("vue").DefineComponent<{
396
410
  key: string | number;
397
411
  icon?: (() => import("vue").VNodeChild) | undefined;
398
412
  }>;
399
- isMobile: boolean | undefined;
413
+ isMobile: import("vue").Ref<boolean | undefined>;
400
414
  mobileMenuVisible: import("vue").Ref<boolean>;
401
415
  searchVisible: import("vue").Ref<boolean>;
402
416
  handleSelectLang: (key: string | number) => void;
@@ -425,7 +439,9 @@ declare const _default: import("vue").DefineComponent<{
425
439
  type: PropType<HeaderPropsInterface["langOptions"]>;
426
440
  default: () => LangOption[];
427
441
  };
428
- defaultLang: PropType<HeaderPropsInterface["defaultLang"]>;
442
+ defaultLang: {
443
+ type: PropType<HeaderPropsInterface["defaultLang"]>;
444
+ };
429
445
  menuPlacement: {
430
446
  type: PropType<HeaderPropsInterface["menuPlacement"]>;
431
447
  default: string;
@@ -434,8 +450,13 @@ declare const _default: import("vue").DefineComponent<{
434
450
  type: PropType<HeaderPropsInterface["menuTrigger"]>;
435
451
  default: string;
436
452
  };
437
- menuValue: PropType<HeaderPropsInterface["menuValue"]>;
438
- defaultMenuValue: PropType<HeaderPropsInterface["defaultMenuValue"]>;
453
+ menuValue: {
454
+ type: PropType<HeaderPropsInterface["menuValue"]>;
455
+ };
456
+ activeMenuKey: {
457
+ type: PropType<HeaderPropsInterface["activeMenuKey"]>;
458
+ default: null;
459
+ };
439
460
  menuTabsProps: {
440
461
  type: PropType<HeaderPropsInterface["menuTabsProps"]>;
441
462
  default: () => {};
@@ -604,6 +625,7 @@ declare const _default: import("vue").DefineComponent<{
604
625
  langOptions: LangOption[] | undefined;
605
626
  menuPlacement: import("./interface").HeaderMenuPlacement | undefined;
606
627
  menuTrigger: import("./interface").HeaderMenuTrigger | undefined;
628
+ activeMenuKey: string | number | null | undefined;
607
629
  menuTabsProps: Partial<import("../..").TabsProps> | undefined;
608
630
  menuCardMinColumnWidth: string | number | undefined;
609
631
  logoSrc: string | undefined;
@@ -45,13 +45,20 @@ export const headerProps = Object.assign(Object.assign({}, useTheme.props), { me
45
45
  }, langOptions: {
46
46
  type: Array,
47
47
  default: () => defaultLangOptions
48
- }, defaultLang: [String, Number], menuPlacement: {
48
+ }, defaultLang: {
49
+ type: [String, Number]
50
+ }, menuPlacement: {
49
51
  type: String,
50
52
  default: 'horizontal'
51
53
  }, menuTrigger: {
52
54
  type: String,
53
55
  default: 'hover'
54
- }, menuValue: [String, Number], defaultMenuValue: [String, Number], menuTabsProps: {
56
+ }, menuValue: {
57
+ type: [String, Number]
58
+ }, activeMenuKey: {
59
+ type: [String, Number],
60
+ default: null
61
+ }, menuTabsProps: {
55
62
  type: Object,
56
63
  default: () => ({})
57
64
  }, menuCardMinColumnWidth: {
@@ -102,10 +109,10 @@ export default defineComponent({
102
109
  'mobile-secondary-action'
103
110
  ],
104
111
  setup(props, { emit }) {
105
- var _a, _b, _c;
112
+ var _a, _b;
106
113
  const { mergedClsPrefixRef } = useConfig(props);
107
114
  const themeRef = useTheme('Header', '-header', style, headerLight, props, mergedClsPrefixRef);
108
- const isMobileRef = props.isMobile;
115
+ const isMobileRef = toRef(props, 'isMobile');
109
116
  const mobileMenuVisibleRef = ref(false);
110
117
  const searchVisibleRef = ref(false);
111
118
  onBeforeMount(() => {
@@ -130,7 +137,7 @@ export default defineComponent({
130
137
  ((_b = props.langOptions) === null || _b === void 0 ? void 0 : _b[0]) ||
131
138
  defaultLangOptions[0]);
132
139
  const controlledMenuValueRef = toRef(props, 'menuValue');
133
- const uncontrolledMenuValueRef = ref((_c = props.defaultMenuValue) !== null && _c !== void 0 ? _c : null);
140
+ const uncontrolledMenuValueRef = ref(null);
134
141
  const mergedMenuValueRef = useMergedState(controlledMenuValueRef, uncontrolledMenuValueRef);
135
142
  const normalizedMenuItemsRef = computed(() => {
136
143
  var _a;
@@ -289,7 +296,7 @@ export default defineComponent({
289
296
  this.logoSrc && `${blockClass}__logo--clickable`
290
297
  ].filter(Boolean), onClick: this.handleLogoClick },
291
298
  h("img", { src: this.logoSrc, alt: this.logoAlt })));
292
- const navigationNode = resolveWrappedSlot($slots.navigation, (children) => children !== null && children !== void 0 ? children : null) || (h(HeaderNavigation, { menuOptions: this.menuOptions, menuPlacement: this.menuPlacement, menuTrigger: this.menuTrigger, menuValue: this.mergedMenuValue, menuTabsProps: this.menuTabsProps, menuCardMinColumnWidth: this.menuCardMinColumnWidth, mergedClsPrefix: mergedClsPrefix, menuPaneClass: this.menuPaneClass, menuPaneWrapperClass: this.menuPaneWrapperClass, onUpdateMenuValue: this.handleMenuValueUpdate }));
299
+ const navigationNode = resolveWrappedSlot($slots.navigation, (children) => children !== null && children !== void 0 ? children : null) || (h(HeaderNavigation, { menuOptions: this.menuOptions, menuPlacement: this.menuPlacement, menuTrigger: this.menuTrigger, menuValue: this.mergedMenuValue, menuTabsProps: this.menuTabsProps, menuCardMinColumnWidth: this.menuCardMinColumnWidth, mergedClsPrefix: mergedClsPrefix, menuPaneClass: this.menuPaneClass, menuPaneWrapperClass: this.menuPaneWrapperClass, activeMenuKey: this.activeMenuKey, onUpdateMenuValue: this.handleMenuValueUpdate }));
293
300
  const mobileNode = this.responsive && this.isMobile ? (h(HeaderMobile, { visible: this.mobileMenuVisible, menuOptions: this.normalizedMenuItems, activeMenuValue: this.mergedMenuValue, langOptions: this.langOptions || defaultLangOptions, currentLang: this.currentLang, mergedClsPrefix: mergedClsPrefix, cssVars: this.cssVars, menuType: this.mobileMenuType, showFooterActions: this.mobileShowFooterActions, showHeaderActions: this.mobileShowHeaderActions, primaryActionText: this.mobilePrimaryActionText, secondaryActionText: this.mobileSecondaryActionText, onToggle: this.toggleMobileMenu, onClose: this.closeMobileMenu, onMenuItemClick: this.handleMobileMenuItemClick, onLanguageSelect: this.handleSelectLang, onPrimaryAction: this.handleMobilePrimaryAction, onSecondaryAction: this.handleMobileSecondaryAction, onSearchClick: this.handleSearchClick, onPreview: this.handlePreviewClick, onLogout: this.handleLogoutClick }, {
294
301
  actions: $slots['mobile-actions'],
295
302
  footer: $slots['mobile-footer']
@@ -39,6 +39,10 @@ export declare const headerNavigationProps: {
39
39
  readonly type: StringConstructor;
40
40
  readonly required: true;
41
41
  };
42
+ readonly activeMenuKey: {
43
+ readonly type: PropType<string | number | null>;
44
+ readonly default: null;
45
+ };
42
46
  readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
43
47
  readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
44
48
  };
@@ -76,6 +80,10 @@ declare const _default: import("vue").DefineComponent<{
76
80
  readonly type: StringConstructor;
77
81
  readonly required: true;
78
82
  };
83
+ readonly activeMenuKey: {
84
+ readonly type: PropType<string | number | null>;
85
+ readonly default: null;
86
+ };
79
87
  readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
80
88
  readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
81
89
  }, {
@@ -1679,6 +1687,10 @@ declare const _default: import("vue").DefineComponent<{
1679
1687
  "vector-effect"?: import("csstype").Property.VectorEffect | undefined;
1680
1688
  }>;
1681
1689
  hoveredKey: import("vue").Ref<string | number | null>;
1690
+ activeMenuKey: import("vue").Ref<string> | import("vue").Ref<number> | import("vue").Ref<null>;
1691
+ setActiveMenuKey: (key?: string | number | null) => void;
1692
+ handleMenuItemClick: (option: HeaderMenuOption) => void;
1693
+ checkedTopMenuKey: import("vue").ComputedRef<string | number | undefined>;
1682
1694
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1683
1695
  readonly menuOptions: {
1684
1696
  readonly type: PropType<HeaderMenuOption[]>;
@@ -1713,12 +1725,17 @@ declare const _default: import("vue").DefineComponent<{
1713
1725
  readonly type: StringConstructor;
1714
1726
  readonly required: true;
1715
1727
  };
1728
+ readonly activeMenuKey: {
1729
+ readonly type: PropType<string | number | null>;
1730
+ readonly default: null;
1731
+ };
1716
1732
  readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
1717
1733
  readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
1718
1734
  }>>, {
1719
1735
  readonly menuOptions: HeaderMenuOption[];
1720
1736
  readonly menuPlacement: HeaderMenuPlacement;
1721
1737
  readonly menuTrigger: "click" | "hover";
1738
+ readonly activeMenuKey: string | number | null;
1722
1739
  readonly menuTabsProps: Partial<import("../..").TabsProps>;
1723
1740
  readonly menuCardMinColumnWidth: string | number;
1724
1741
  }, {}>;
@@ -18,9 +18,9 @@ var __rest = (this && this.__rest) || function (s, e) {
18
18
  }
19
19
  return t;
20
20
  };
21
- import { h, defineComponent, computed, ref, watch, nextTick, onMounted, onBeforeUnmount } from 'vue';
21
+ import { h, defineComponent, computed, ref, watch, nextTick, onMounted, onBeforeUnmount, toRef } from 'vue';
22
22
  import { call } from '../../_utils';
23
- import { renderOptionLabel, renderBadge, getMenuItemKey, isDividerOption, isGroupOption, isColumnOption, isNotNull, isLeafMenuOption } from './utils';
23
+ import { renderOptionLabel, renderBadge, getMenuItemKey, resolveTopLevelMenuKey, isDividerOption, isGroupOption, isColumnOption, isNotNull, isLeafMenuOption } from './utils';
24
24
  export const headerNavigationProps = {
25
25
  menuOptions: {
26
26
  type: Array,
@@ -55,6 +55,10 @@ export const headerNavigationProps = {
55
55
  type: String,
56
56
  required: true
57
57
  },
58
+ activeMenuKey: {
59
+ type: [String, Number],
60
+ default: null
61
+ },
58
62
  'onUpdate:menuValue': [Function, Array],
59
63
  onUpdateMenuValue: [Function, Array]
60
64
  };
@@ -73,11 +77,16 @@ export default defineComponent({
73
77
  navRef.value = el;
74
78
  };
75
79
  const hoveredKeyRef = ref(null);
80
+ const activeMenuKeyRef = toRef(props.activeMenuKey);
76
81
  const tabRefs = ref({});
77
82
  const indicatorStyleRef = ref({
78
83
  width: '0px',
79
84
  transform: 'translateX(0)'
80
85
  });
86
+ const checkedTopMenuKey = computed(() => {
87
+ var _a;
88
+ return ((_a = resolveTopLevelMenuKey(props.menuOptions, activeMenuKeyRef.value)) !== null && _a !== void 0 ? _a : undefined);
89
+ });
81
90
  function updateIndicator() {
82
91
  var _a, _b;
83
92
  const navEl = navRef.value;
@@ -117,6 +126,14 @@ export default defineComponent({
117
126
  if (_onUpdateMenuValue)
118
127
  call(_onUpdateMenuValue, value);
119
128
  }
129
+ function setActiveMenuKey(key = null) {
130
+ activeMenuKeyRef.value = key;
131
+ }
132
+ function handleMenuItemClick(option) {
133
+ setActiveMenuKey(option === null || option === void 0 ? void 0 : option.key);
134
+ if (option.onClick)
135
+ option === null || option === void 0 ? void 0 : option.onClick();
136
+ }
120
137
  onMounted(() => __awaiter(this, void 0, void 0, function* () {
121
138
  yield nextTick(updateIndicator);
122
139
  window.addEventListener('resize', updateIndicator);
@@ -148,7 +165,11 @@ export default defineComponent({
148
165
  navRef,
149
166
  setTabRef,
150
167
  indicatorStyle: indicatorStyleRef,
151
- hoveredKey: hoveredKeyRef
168
+ hoveredKey: hoveredKeyRef,
169
+ activeMenuKey: activeMenuKeyRef,
170
+ setActiveMenuKey,
171
+ handleMenuItemClick,
172
+ checkedTopMenuKey
152
173
  };
153
174
  },
154
175
  render() {
@@ -167,7 +188,10 @@ export default defineComponent({
167
188
  return (h("div", Object.assign({ key: key, class: [
168
189
  `${blockClass}__menu-item`,
169
190
  option.disabled && `${blockClass}__menu-item--disabled`
170
- ], role: "button", tabindex: option.disabled ? undefined : 0, onClick: option.onClick }, $props),
191
+ ], role: "button", tabindex: option.disabled ? undefined : 0, onClick: (event) => {
192
+ event.stopPropagation();
193
+ this.handleMenuItemClick(option);
194
+ } }, $props),
171
195
  h("span", { class: `${blockClass}__menu-item-main` },
172
196
  icon ? (h("span", { class: `${blockClass}__menu-item-icon` }, icon)) : null,
173
197
  h("span", { class: `${blockClass}__menu-item-label` }, renderOptionLabel(option))),
@@ -201,7 +225,10 @@ export default defineComponent({
201
225
  const hasChildren = option.children && option.children.length > 0;
202
226
  if (!hasChildren) {
203
227
  return (h("div", { key: key, class: `${blockClass}__menu-column-section` },
204
- h("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: option.onClick }, renderOptionLabel(option))));
228
+ h("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: (event) => {
229
+ event.stopPropagation();
230
+ this.handleMenuItemClick(option);
231
+ } }, renderOptionLabel(option))));
205
232
  }
206
233
  const children = (_e = (_d = option.children) === null || _d === void 0 ? void 0 : _d.map((child, index) => renderMenuItem(child, `${key}-item-${index}`))) !== null && _e !== void 0 ? _e : [];
207
234
  const content = children.filter(isNotNull);
@@ -209,11 +236,17 @@ export default defineComponent({
209
236
  return null;
210
237
  if (asSection) {
211
238
  return (h("div", { key: key, class: `${blockClass}__menu-column-section` },
212
- h("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: option.onClick }, renderOptionLabel(option)),
239
+ h("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: (event) => {
240
+ event.stopPropagation();
241
+ this.handleMenuItemClick(option);
242
+ } }, renderOptionLabel(option)),
213
243
  h("div", { class: `${blockClass}__menu-column-list` }, content)));
214
244
  }
215
245
  return (h("div", { key: key, class: `${blockClass}__menu-column` },
216
- h("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: option.onClick }, renderOptionLabel(option)),
246
+ h("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: (event) => {
247
+ event.stopPropagation();
248
+ this.handleMenuItemClick(option);
249
+ } }, renderOptionLabel(option)),
217
250
  h("div", { class: `${blockClass}__menu-column-list` }, content)));
218
251
  }
219
252
  return (h("div", { key: key, class: [
@@ -287,6 +320,7 @@ export default defineComponent({
287
320
  h("div", { class: "u-tabs-pad", style: { width: tabsPaddingValue } }),
288
321
  menuItems.map((item, index) => {
289
322
  const isActive = activeValue === item.key;
323
+ const isChecked = this.checkedTopMenuKey === item.key;
290
324
  const isOpen = isHoverTrigger
291
325
  ? this.hoveredKey === item.key
292
326
  : isActive;
@@ -299,7 +333,8 @@ export default defineComponent({
299
333
  'u-tabs-tab',
300
334
  `${blockClass}__tab`,
301
335
  isActive && 'u-tabs-tab--active',
302
- isDisabled && 'u-tabs-tab--disabled'
336
+ isDisabled && 'u-tabs-tab--disabled',
337
+ isChecked && 'u-tabs-tab--checked'
303
338
  ], ref: this.setTabRef(item.key), role: "tab", "aria-selected": isActive, "aria-disabled": isDisabled, tabindex: isDisabled ? -1 : isActive ? 0 : -1, onKeydown: (event) => {
304
339
  if (!isDisabled &&
305
340
  !isHoverTrigger &&
@@ -317,9 +352,7 @@ export default defineComponent({
317
352
  if (!isHoverTrigger) {
318
353
  emitUpdate(item.key);
319
354
  }
320
- if (item.option.onClick) {
321
- item.option.onClick();
322
- }
355
+ this.handleMenuItemClick(item.option);
323
356
  }
324
357
  : undefined },
325
358
  icon ? (h("span", { class: `${blockClass}__tab-icon` }, icon)) : null,
@@ -9,7 +9,7 @@ export interface HeaderProps {
9
9
  menuPlacement?: HeaderMenuPlacement;
10
10
  menuTrigger?: HeaderMenuTrigger;
11
11
  menuValue?: string | number | null;
12
- defaultMenuValue?: string | number | null;
12
+ activeMenuKey?: string | number | null;
13
13
  menuTabsProps?: HeaderMenuTabsProps;
14
14
  menuCardMinColumnWidth?: string | number;
15
15
  logoSrc?: string;
@@ -52,9 +52,10 @@ export type HeaderMenuDividerOption = MenuDividerOption;
52
52
  export type HeaderSearchHandler = (query: string) => Promise<HeaderSearchResult[]> | HeaderSearchResult[];
53
53
  export type HeaderMenuChildOption = HeaderMenuColumnOption | HeaderMenuGroupOption | HeaderMenuDividerOption | HeaderMenuOption;
54
54
  export type HeaderMenuOption = Omit<BaseMenuOption, 'children'> & {
55
+ key?: string | number | null;
55
56
  children?: HeaderMenuChildOption[];
56
- onClick?: () => void;
57
57
  hide?: boolean;
58
+ onClick?: () => void;
58
59
  };
59
60
  export type HeaderMenuPlacement = 'horizontal' | 'vertical' | 'top' | 'bottom' | 'left' | 'right';
60
61
  export type HeaderMenuTrigger = 'click' | 'hover';
@@ -207,8 +207,8 @@ declare const _default: import("vue").DefineComponent<{
207
207
  }>>, {
208
208
  readonly primaryActionText: string;
209
209
  readonly secondaryActionText: string;
210
- readonly visible: boolean;
211
210
  readonly menuOptions: NormalizedMenuItem[];
211
+ readonly visible: boolean;
212
212
  readonly menuType: "drawer" | "dropdown";
213
213
  readonly drawerPlacement: "left" | "right";
214
214
  readonly drawerWidth: string;
@@ -126,6 +126,8 @@ export default cB('header', `
126
126
  cursor: not-allowed;
127
127
  pointer-events: none;
128
128
  opacity: .5;
129
+ `), c('& .u-tabs-tab--checked', `
130
+ color: var(--u-header-tab-text-color-active);
129
131
  `), c('& .u-tabs-tab:hover', `
130
132
  color: var(--u-header-tab-text-color-hover);
131
133
  `), c('& .u-tabs-bar', `
@@ -11,3 +11,4 @@ export declare function isColumnOption(option: HeaderMenuChildOption): option is
11
11
  export declare function isNotNull<T>(value: T | null): value is T;
12
12
  export declare function resolvePlacement(placement: HeaderMenuPlacement): TabsProps['placement'];
13
13
  export declare function isLeafMenuOption(option: HeaderMenuChildOption): option is Exclude<HeaderMenuChildOption, HeaderMenuColumnOption>;
14
+ export declare function resolveTopLevelMenuKey(menuOptions: HeaderMenuOption[], activeMenuKey: string | number | null | undefined): string | number | null;
@@ -48,3 +48,37 @@ export function resolvePlacement(placement) {
48
48
  export function isLeafMenuOption(option) {
49
49
  return option.type !== 'column';
50
50
  }
51
+ function isMenuValueInChildren(children, value) {
52
+ if (!children || children.length === 0)
53
+ return false;
54
+ for (const child of children) {
55
+ if (isDividerOption(child))
56
+ continue;
57
+ if (isColumnOption(child)) {
58
+ if (isMenuValueInChildren(child.children, value))
59
+ return true;
60
+ continue;
61
+ }
62
+ if (child.key === value)
63
+ return true;
64
+ if (isGroupOption(child) || hasChildren(child)) {
65
+ if (isMenuValueInChildren(child.children, value))
66
+ return true;
67
+ }
68
+ }
69
+ return false;
70
+ }
71
+ export function resolveTopLevelMenuKey(menuOptions, activeMenuKey) {
72
+ if (activeMenuKey === null || activeMenuKey === undefined)
73
+ return null;
74
+ for (let index = 0; index < menuOptions.length; index += 1) {
75
+ const option = menuOptions[index];
76
+ const optionKey = getMenuItemKey(option, index);
77
+ if (optionKey === activeMenuKey)
78
+ return optionKey;
79
+ if (isMenuValueInChildren(option.children, activeMenuKey)) {
80
+ return optionKey;
81
+ }
82
+ }
83
+ return null;
84
+ }
@@ -1,4 +1,4 @@
1
- import { h, withDirectives, Transition, ref, computed, defineComponent, provide, toRef, inject } from 'vue';
1
+ import { h, withDirectives, Transition, ref, computed, defineComponent, provide, toRef, inject, nextTick } from 'vue';
2
2
  import { zindexable } from 'vdirs';
3
3
  import { useIsMounted, useClicked, useClickPosition } from 'vooks';
4
4
  import { VLazyTeleport } from 'vueuc';
@@ -124,6 +124,13 @@ export default defineComponent({
124
124
  const { onBeforeLeave, onBeforeHide } = props;
125
125
  if (onBeforeLeave)
126
126
  call(onBeforeLeave);
127
+ void nextTick(() => {
128
+ if (document.activeElement &&
129
+ document.activeElement !== document.body) {
130
+ ;
131
+ document.activeElement.blur();
132
+ }
133
+ });
127
134
  // deprecated
128
135
  if (onBeforeHide)
129
136
  onBeforeHide();
@@ -132,6 +139,13 @@ export default defineComponent({
132
139
  const { onAfterLeave, onAfterHide } = props;
133
140
  if (onAfterLeave)
134
141
  call(onAfterLeave);
142
+ void nextTick(() => {
143
+ if (document.activeElement &&
144
+ document.activeElement !== document.body) {
145
+ ;
146
+ document.activeElement.blur();
147
+ }
148
+ });
135
149
  // deprecated
136
150
  if (onAfterHide)
137
151
  onAfterHide();
package/es/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.15";
1
+ declare const _default: "1.12.17";
2
2
  export default _default;
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.12.15';
1
+ export default '1.12.17';
@@ -188,6 +188,7 @@ import { CropTheme } from '../../crop/styles';
188
188
  import { SafeTopScrollbarTheme } from '../../_internal/safe-top-scrollbar/styles';
189
189
  import { HeaderTheme } from '../../header/styles';
190
190
  import { QrCodeTheme } from '../../qr-code/styles';
191
+ import { HeaderProps } from '../../header';
191
192
  export interface GlobalThemeWithoutCommon {
192
193
  Alert?: AlertTheme;
193
194
  Anchor?: AnchorTheme;
@@ -385,6 +386,7 @@ export interface GlobalComponentConfig {
385
386
  CardList?: CardListProps;
386
387
  Chat?: ChatProps;
387
388
  Text?: TextProps;
389
+ Header?: HeaderProps;
388
390
  InputOtp?: InputOtpProps;
389
391
  }
390
392
  export interface GlobalIconConfig {
@@ -12,7 +12,9 @@ export declare const headerProps: {
12
12
  type: PropType<HeaderPropsInterface["langOptions"]>;
13
13
  default: () => LangOption[];
14
14
  };
15
- defaultLang: PropType<HeaderPropsInterface["defaultLang"]>;
15
+ defaultLang: {
16
+ type: PropType<HeaderPropsInterface["defaultLang"]>;
17
+ };
16
18
  menuPlacement: {
17
19
  type: PropType<HeaderPropsInterface["menuPlacement"]>;
18
20
  default: string;
@@ -21,8 +23,13 @@ export declare const headerProps: {
21
23
  type: PropType<HeaderPropsInterface["menuTrigger"]>;
22
24
  default: string;
23
25
  };
24
- menuValue: PropType<HeaderPropsInterface["menuValue"]>;
25
- defaultMenuValue: PropType<HeaderPropsInterface["defaultMenuValue"]>;
26
+ menuValue: {
27
+ type: PropType<HeaderPropsInterface["menuValue"]>;
28
+ };
29
+ activeMenuKey: {
30
+ type: PropType<HeaderPropsInterface["activeMenuKey"]>;
31
+ default: null;
32
+ };
26
33
  menuTabsProps: {
27
34
  type: PropType<HeaderPropsInterface["menuTabsProps"]>;
28
35
  default: () => {};
@@ -186,7 +193,9 @@ declare const _default: import("vue").DefineComponent<{
186
193
  type: PropType<HeaderPropsInterface["langOptions"]>;
187
194
  default: () => LangOption[];
188
195
  };
189
- defaultLang: PropType<HeaderPropsInterface["defaultLang"]>;
196
+ defaultLang: {
197
+ type: PropType<HeaderPropsInterface["defaultLang"]>;
198
+ };
190
199
  menuPlacement: {
191
200
  type: PropType<HeaderPropsInterface["menuPlacement"]>;
192
201
  default: string;
@@ -195,8 +204,13 @@ declare const _default: import("vue").DefineComponent<{
195
204
  type: PropType<HeaderPropsInterface["menuTrigger"]>;
196
205
  default: string;
197
206
  };
198
- menuValue: PropType<HeaderPropsInterface["menuValue"]>;
199
- defaultMenuValue: PropType<HeaderPropsInterface["defaultMenuValue"]>;
207
+ menuValue: {
208
+ type: PropType<HeaderPropsInterface["menuValue"]>;
209
+ };
210
+ activeMenuKey: {
211
+ type: PropType<HeaderPropsInterface["activeMenuKey"]>;
212
+ default: null;
213
+ };
200
214
  menuTabsProps: {
201
215
  type: PropType<HeaderPropsInterface["menuTabsProps"]>;
202
216
  default: () => {};
@@ -396,7 +410,7 @@ declare const _default: import("vue").DefineComponent<{
396
410
  key: string | number;
397
411
  icon?: (() => import("vue").VNodeChild) | undefined;
398
412
  }>;
399
- isMobile: boolean | undefined;
413
+ isMobile: import("vue").Ref<boolean | undefined>;
400
414
  mobileMenuVisible: import("vue").Ref<boolean>;
401
415
  searchVisible: import("vue").Ref<boolean>;
402
416
  handleSelectLang: (key: string | number) => void;
@@ -425,7 +439,9 @@ declare const _default: import("vue").DefineComponent<{
425
439
  type: PropType<HeaderPropsInterface["langOptions"]>;
426
440
  default: () => LangOption[];
427
441
  };
428
- defaultLang: PropType<HeaderPropsInterface["defaultLang"]>;
442
+ defaultLang: {
443
+ type: PropType<HeaderPropsInterface["defaultLang"]>;
444
+ };
429
445
  menuPlacement: {
430
446
  type: PropType<HeaderPropsInterface["menuPlacement"]>;
431
447
  default: string;
@@ -434,8 +450,13 @@ declare const _default: import("vue").DefineComponent<{
434
450
  type: PropType<HeaderPropsInterface["menuTrigger"]>;
435
451
  default: string;
436
452
  };
437
- menuValue: PropType<HeaderPropsInterface["menuValue"]>;
438
- defaultMenuValue: PropType<HeaderPropsInterface["defaultMenuValue"]>;
453
+ menuValue: {
454
+ type: PropType<HeaderPropsInterface["menuValue"]>;
455
+ };
456
+ activeMenuKey: {
457
+ type: PropType<HeaderPropsInterface["activeMenuKey"]>;
458
+ default: null;
459
+ };
439
460
  menuTabsProps: {
440
461
  type: PropType<HeaderPropsInterface["menuTabsProps"]>;
441
462
  default: () => {};
@@ -604,6 +625,7 @@ declare const _default: import("vue").DefineComponent<{
604
625
  langOptions: LangOption[] | undefined;
605
626
  menuPlacement: import("./interface").HeaderMenuPlacement | undefined;
606
627
  menuTrigger: import("./interface").HeaderMenuTrigger | undefined;
628
+ activeMenuKey: string | number | null | undefined;
607
629
  menuTabsProps: Partial<import("../..").TabsProps> | undefined;
608
630
  menuCardMinColumnWidth: string | number | undefined;
609
631
  logoSrc: string | undefined;