@uzum-tech/ui 1.12.8 → 1.12.10

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.
@@ -77,8 +77,12 @@ export default c([cB('button', `
77
77
  borderColor: 'var(--u-border-color-hover)'
78
78
  })]), c('&:active', [cE('state-border', {
79
79
  borderColor: 'var(--u-border-color-pressed)'
80
+ })]), c('&:hover, &:active, &:focus', [cE('border', {
81
+ borderColor: 'transparent'
80
82
  })]), cM('pressed', [cE('state-border', {
81
83
  borderColor: 'var(--u-border-color-pressed)'
84
+ }), cE('border', {
85
+ borderColor: 'transparent'
82
86
  })])])]), cM('disabled', {
83
87
  backgroundColor: 'var(--u-color-disabled)',
84
88
  color: 'var(--u-text-color-disabled)'
@@ -89,6 +93,8 @@ export default c([cB('button', `
89
93
  color: 'var(--u-text-color-focus)'
90
94
  }, [cE('state-border', {
91
95
  border: 'var(--u-border-focus)'
96
+ }), cE('border', {
97
+ borderColor: 'transparent'
92
98
  })]), c('&:focus-visible', {
93
99
  backgroundColor: 'var(--u-color)',
94
100
  color: 'var(--u-text-color)',
@@ -100,16 +106,22 @@ export default c([cB('button', `
100
106
  color: 'var(--u-text-color-hover)'
101
107
  }, [cE('state-border', {
102
108
  border: 'var(--u-border-hover)'
109
+ }), cE('border', {
110
+ borderColor: 'transparent'
103
111
  })]), c('&:active', {
104
112
  backgroundColor: 'var(--u-color-pressed)',
105
113
  color: 'var(--u-text-color-pressed)'
106
114
  }, [cE('state-border', {
107
115
  border: 'var(--u-border-pressed)'
116
+ }), cE('border', {
117
+ borderColor: 'transparent'
108
118
  })]), cM('pressed', {
109
119
  backgroundColor: 'var(--u-color-pressed)',
110
120
  color: 'var(--u-text-color-pressed)'
111
121
  }, [cE('state-border', {
112
122
  border: 'var(--u-border-pressed)'
123
+ }), cE('border', {
124
+ borderColor: 'transparent'
113
125
  })])]), cM('loading', 'cursor: wait;'), cE('loading', null, [cM('skeleton', {
114
126
  width: 'calc(100% + 2px)',
115
127
  height: 'calc(100% + 2px)',
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  };
21
21
  import { h, defineComponent, computed, ref, watch, nextTick, onMounted, onBeforeUnmount } from 'vue';
22
22
  import { call } from '../../_utils';
23
- import { renderOptionLabel, renderBadge, getMenuItemKey, isDividerOption, isGroupOption, isColumnOption, isNotNull } from './utils';
23
+ import { renderOptionLabel, renderBadge, getMenuItemKey, isDividerOption, isGroupOption, isColumnOption, isNotNull, isLeafMenuOption } from './utils';
24
24
  export const headerNavigationProps = {
25
25
  menuOptions: {
26
26
  type: Array,
@@ -174,29 +174,46 @@ export default defineComponent({
174
174
  renderBadge(option, `${blockClass}__badge`)));
175
175
  };
176
176
  const renderMenuColumn = (option, key, asSection = false) => {
177
- var _a, _b, _c, _d;
177
+ var _a, _b, _c, _d, _e;
178
178
  if (isDividerOption(option)) {
179
179
  return asSection ? (h("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" })) : (h("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" }));
180
180
  }
181
181
  if (isColumnOption(option)) {
182
- const sections = (_b = (_a = option.children) === null || _a === void 0 ? void 0 : _a.map((child, index) => renderMenuColumn(child, `${key}-section-${index}`, true))) !== null && _b !== void 0 ? _b : [];
182
+ const children = (_a = option.children) !== null && _a !== void 0 ? _a : [];
183
+ const hasGroup = children.some(isGroupOption);
184
+ if (!hasGroup) {
185
+ const items = children
186
+ .filter(isLeafMenuOption)
187
+ .map((child, index) => renderMenuItem(child, `${key}-item-${index}`))
188
+ .filter(isNotNull);
189
+ if (!items.length)
190
+ return null;
191
+ return (h("div", { key: key, class: `${blockClass}__menu-column` },
192
+ h("div", { class: `${blockClass}__menu-column-list` }, items)));
193
+ }
194
+ const sections = (_c = (_b = option.children) === null || _b === void 0 ? void 0 : _b.map((child, index) => renderMenuColumn(child, `${key}-section-${index}`, true))) !== null && _c !== void 0 ? _c : [];
183
195
  const content = sections.filter(isNotNull);
184
196
  if (!content.length)
185
197
  return null;
186
198
  return (h("div", { key: key, class: `${blockClass}__menu-column` }, content));
187
199
  }
188
200
  if (isGroupOption(option)) {
189
- const children = (_d = (_c = option.children) === null || _c === void 0 ? void 0 : _c.map((child, index) => renderMenuItem(child, `${key}-item-${index}`))) !== null && _d !== void 0 ? _d : [];
201
+ const hasChildren = option.children && option.children.length > 0;
202
+ if (!hasChildren) {
203
+ 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))));
205
+ }
206
+ 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 : [];
190
207
  const content = children.filter(isNotNull);
191
208
  if (!content.length)
192
209
  return null;
193
210
  if (asSection) {
194
211
  return (h("div", { key: key, class: `${blockClass}__menu-column-section` },
195
- h("div", { class: `${blockClass}__menu-column-title` }, renderOptionLabel(option)),
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)),
196
213
  h("div", { class: `${blockClass}__menu-column-list` }, content)));
197
214
  }
198
215
  return (h("div", { key: key, class: `${blockClass}__menu-column` },
199
- h("div", { class: `${blockClass}__menu-column-title` }, renderOptionLabel(option)),
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)),
200
217
  h("div", { class: `${blockClass}__menu-column-list` }, content)));
201
218
  }
202
219
  return (h("div", { key: key, class: [
@@ -2,8 +2,6 @@ import { type VNodeChild } from 'vue';
2
2
  import type { MenuOption as BaseMenuOption, MenuGroupOption, MenuDividerOption, Key } from '../../menu/src/interface';
3
3
  import type { TabsProps } from '../../tabs';
4
4
  import { ImageProps } from '../../image';
5
- export type HeaderMenuGroupOption = MenuGroupOption;
6
- export type HeaderMenuDividerOption = MenuDividerOption;
7
5
  export interface HeaderProps {
8
6
  menuOptions?: HeaderMenuOption[];
9
7
  langOptions?: LangOption[];
@@ -46,6 +44,10 @@ export interface HeaderSearchResult {
46
44
  onClick?: () => void;
47
45
  disabled?: boolean;
48
46
  }
47
+ export type HeaderMenuGroupOption = MenuGroupOption & {
48
+ onClick?: () => void;
49
+ };
50
+ export type HeaderMenuDividerOption = MenuDividerOption;
49
51
  export type HeaderSearchHandler = (query: string) => Promise<HeaderSearchResult[]> | HeaderSearchResult[];
50
52
  export type HeaderMenuChildOption = HeaderMenuColumnOption | HeaderMenuGroupOption | HeaderMenuDividerOption | HeaderMenuOption;
51
53
  export type HeaderMenuOption = Omit<BaseMenuOption, 'children'> & {
@@ -172,6 +172,7 @@ export default cB('header', `
172
172
  left: 40%;
173
173
  transform: translateX(-40%);
174
174
  z-index: 1000;
175
+ cursor: default;
175
176
  `), cE('tab-pane', `
176
177
  padding: 0;
177
178
  `), cE('menu-card', `
@@ -184,7 +185,7 @@ export default cB('header', `
184
185
  `), cE('menu-column', `
185
186
  display: flex;
186
187
  flex-direction: column;
187
- gap: 16px;
188
+ gap: 32px;
188
189
  `, [cM('single', `
189
190
  gap: 8px;
190
191
  `)]), cE('menu-column-section', `
@@ -199,6 +200,9 @@ export default cB('header', `
199
200
  font-size: var(--u-font-title-small);
200
201
  font-weight: 600;
201
202
  color: var(--u-header-card-title-color);
203
+ cursor: text;
204
+ `), cE('menu-column-title[role="button"]', `
205
+ cursor: pointer;
202
206
  `), cE('menu-column-list', `
203
207
  display: flex;
204
208
  flex-direction: column;
@@ -5,8 +5,9 @@ export declare function renderOptionLabel(option: HeaderMenuOption | HeaderMenuG
5
5
  export declare function renderBadge(option: HeaderMenuOption | HeaderMenuGroupOption, className: string): VNodeChild | null;
6
6
  export declare function getMenuItemKey(option: HeaderMenuOption, index: number): string | number;
7
7
  export declare function hasChildren(option: HeaderMenuOption): boolean;
8
- export declare function isGroupOption(option: HeaderMenuOption): option is HeaderMenuGroupOption;
8
+ export declare function isGroupOption(option: HeaderMenuOption | HeaderMenuChildOption): option is HeaderMenuGroupOption;
9
9
  export declare function isDividerOption(option: HeaderMenuChildOption): option is HeaderMenuDividerOption;
10
10
  export declare function isColumnOption(option: HeaderMenuChildOption): option is HeaderMenuColumnOption;
11
11
  export declare function isNotNull<T>(value: T | null): value is T;
12
12
  export declare function resolvePlacement(placement: HeaderMenuPlacement): TabsProps['placement'];
13
+ export declare function isLeafMenuOption(option: HeaderMenuChildOption): option is Exclude<HeaderMenuChildOption, HeaderMenuColumnOption>;
@@ -45,3 +45,6 @@ export function resolvePlacement(placement) {
45
45
  return placement;
46
46
  }
47
47
  }
48
+ export function isLeafMenuOption(option) {
49
+ return option.type !== 'column';
50
+ }
package/es/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.8";
1
+ declare const _default: "1.12.10";
2
2
  export default _default;
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.12.8';
1
+ export default '1.12.10';
@@ -82,8 +82,12 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('button', `
82
82
  borderColor: 'var(--u-border-color-hover)'
83
83
  })]), (0, cssr_1.c)('&:active', [(0, cssr_1.cE)('state-border', {
84
84
  borderColor: 'var(--u-border-color-pressed)'
85
+ })]), (0, cssr_1.c)('&:hover, &:active, &:focus', [(0, cssr_1.cE)('border', {
86
+ borderColor: 'transparent'
85
87
  })]), (0, cssr_1.cM)('pressed', [(0, cssr_1.cE)('state-border', {
86
88
  borderColor: 'var(--u-border-color-pressed)'
89
+ }), (0, cssr_1.cE)('border', {
90
+ borderColor: 'transparent'
87
91
  })])])]), (0, cssr_1.cM)('disabled', {
88
92
  backgroundColor: 'var(--u-color-disabled)',
89
93
  color: 'var(--u-text-color-disabled)'
@@ -94,6 +98,8 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('button', `
94
98
  color: 'var(--u-text-color-focus)'
95
99
  }, [(0, cssr_1.cE)('state-border', {
96
100
  border: 'var(--u-border-focus)'
101
+ }), (0, cssr_1.cE)('border', {
102
+ borderColor: 'transparent'
97
103
  })]), (0, cssr_1.c)('&:focus-visible', {
98
104
  backgroundColor: 'var(--u-color)',
99
105
  color: 'var(--u-text-color)',
@@ -105,16 +111,22 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('button', `
105
111
  color: 'var(--u-text-color-hover)'
106
112
  }, [(0, cssr_1.cE)('state-border', {
107
113
  border: 'var(--u-border-hover)'
114
+ }), (0, cssr_1.cE)('border', {
115
+ borderColor: 'transparent'
108
116
  })]), (0, cssr_1.c)('&:active', {
109
117
  backgroundColor: 'var(--u-color-pressed)',
110
118
  color: 'var(--u-text-color-pressed)'
111
119
  }, [(0, cssr_1.cE)('state-border', {
112
120
  border: 'var(--u-border-pressed)'
121
+ }), (0, cssr_1.cE)('border', {
122
+ borderColor: 'transparent'
113
123
  })]), (0, cssr_1.cM)('pressed', {
114
124
  backgroundColor: 'var(--u-color-pressed)',
115
125
  color: 'var(--u-text-color-pressed)'
116
126
  }, [(0, cssr_1.cE)('state-border', {
117
127
  border: 'var(--u-border-pressed)'
128
+ }), (0, cssr_1.cE)('border', {
129
+ borderColor: 'transparent'
118
130
  })])]), (0, cssr_1.cM)('loading', 'cursor: wait;'), (0, cssr_1.cE)('loading', null, [(0, cssr_1.cM)('skeleton', {
119
131
  width: 'calc(100% + 2px)',
120
132
  height: 'calc(100% + 2px)',
@@ -177,29 +177,46 @@ exports.default = (0, vue_1.defineComponent)({
177
177
  (0, utils_1.renderBadge)(option, `${blockClass}__badge`)));
178
178
  };
179
179
  const renderMenuColumn = (option, key, asSection = false) => {
180
- var _a, _b, _c, _d;
180
+ var _a, _b, _c, _d, _e;
181
181
  if ((0, utils_1.isDividerOption)(option)) {
182
182
  return asSection ? ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" })) : ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" }));
183
183
  }
184
184
  if ((0, utils_1.isColumnOption)(option)) {
185
- const sections = (_b = (_a = option.children) === null || _a === void 0 ? void 0 : _a.map((child, index) => renderMenuColumn(child, `${key}-section-${index}`, true))) !== null && _b !== void 0 ? _b : [];
185
+ const children = (_a = option.children) !== null && _a !== void 0 ? _a : [];
186
+ const hasGroup = children.some(utils_1.isGroupOption);
187
+ if (!hasGroup) {
188
+ const items = children
189
+ .filter(utils_1.isLeafMenuOption)
190
+ .map((child, index) => renderMenuItem(child, `${key}-item-${index}`))
191
+ .filter(utils_1.isNotNull);
192
+ if (!items.length)
193
+ return null;
194
+ return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column` },
195
+ (0, vue_1.h)("div", { class: `${blockClass}__menu-column-list` }, items)));
196
+ }
197
+ const sections = (_c = (_b = option.children) === null || _b === void 0 ? void 0 : _b.map((child, index) => renderMenuColumn(child, `${key}-section-${index}`, true))) !== null && _c !== void 0 ? _c : [];
186
198
  const content = sections.filter(utils_1.isNotNull);
187
199
  if (!content.length)
188
200
  return null;
189
201
  return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column` }, content));
190
202
  }
191
203
  if ((0, utils_1.isGroupOption)(option)) {
192
- const children = (_d = (_c = option.children) === null || _c === void 0 ? void 0 : _c.map((child, index) => renderMenuItem(child, `${key}-item-${index}`))) !== null && _d !== void 0 ? _d : [];
204
+ const hasChildren = option.children && option.children.length > 0;
205
+ if (!hasChildren) {
206
+ return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column-section` },
207
+ (0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: option.onClick }, (0, utils_1.renderOptionLabel)(option))));
208
+ }
209
+ 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 : [];
193
210
  const content = children.filter(utils_1.isNotNull);
194
211
  if (!content.length)
195
212
  return null;
196
213
  if (asSection) {
197
214
  return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column-section` },
198
- (0, vue_1.h)("div", { class: `${blockClass}__menu-column-title` }, (0, utils_1.renderOptionLabel)(option)),
215
+ (0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: option.onClick }, (0, utils_1.renderOptionLabel)(option)),
199
216
  (0, vue_1.h)("div", { class: `${blockClass}__menu-column-list` }, content)));
200
217
  }
201
218
  return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column` },
202
- (0, vue_1.h)("div", { class: `${blockClass}__menu-column-title` }, (0, utils_1.renderOptionLabel)(option)),
219
+ (0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: option.onClick }, (0, utils_1.renderOptionLabel)(option)),
203
220
  (0, vue_1.h)("div", { class: `${blockClass}__menu-column-list` }, content)));
204
221
  }
205
222
  return ((0, vue_1.h)("div", { key: key, class: [
@@ -2,8 +2,6 @@ import { type VNodeChild } from 'vue';
2
2
  import type { MenuOption as BaseMenuOption, MenuGroupOption, MenuDividerOption, Key } from '../../menu/src/interface';
3
3
  import type { TabsProps } from '../../tabs';
4
4
  import { ImageProps } from '../../image';
5
- export type HeaderMenuGroupOption = MenuGroupOption;
6
- export type HeaderMenuDividerOption = MenuDividerOption;
7
5
  export interface HeaderProps {
8
6
  menuOptions?: HeaderMenuOption[];
9
7
  langOptions?: LangOption[];
@@ -46,6 +44,10 @@ export interface HeaderSearchResult {
46
44
  onClick?: () => void;
47
45
  disabled?: boolean;
48
46
  }
47
+ export type HeaderMenuGroupOption = MenuGroupOption & {
48
+ onClick?: () => void;
49
+ };
50
+ export type HeaderMenuDividerOption = MenuDividerOption;
49
51
  export type HeaderSearchHandler = (query: string) => Promise<HeaderSearchResult[]> | HeaderSearchResult[];
50
52
  export type HeaderMenuChildOption = HeaderMenuColumnOption | HeaderMenuGroupOption | HeaderMenuDividerOption | HeaderMenuOption;
51
53
  export type HeaderMenuOption = Omit<BaseMenuOption, 'children'> & {
@@ -178,6 +178,7 @@ exports.default = (0, cssr_1.cB)('header', `
178
178
  left: 40%;
179
179
  transform: translateX(-40%);
180
180
  z-index: 1000;
181
+ cursor: default;
181
182
  `), (0, cssr_1.cE)('tab-pane', `
182
183
  padding: 0;
183
184
  `), (0, cssr_1.cE)('menu-card', `
@@ -190,7 +191,7 @@ exports.default = (0, cssr_1.cB)('header', `
190
191
  `), (0, cssr_1.cE)('menu-column', `
191
192
  display: flex;
192
193
  flex-direction: column;
193
- gap: 16px;
194
+ gap: 32px;
194
195
  `, [(0, cssr_1.cM)('single', `
195
196
  gap: 8px;
196
197
  `)]), (0, cssr_1.cE)('menu-column-section', `
@@ -205,6 +206,9 @@ exports.default = (0, cssr_1.cB)('header', `
205
206
  font-size: var(--u-font-title-small);
206
207
  font-weight: 600;
207
208
  color: var(--u-header-card-title-color);
209
+ cursor: text;
210
+ `), (0, cssr_1.cE)('menu-column-title[role="button"]', `
211
+ cursor: pointer;
208
212
  `), (0, cssr_1.cE)('menu-column-list', `
209
213
  display: flex;
210
214
  flex-direction: column;
@@ -5,8 +5,9 @@ export declare function renderOptionLabel(option: HeaderMenuOption | HeaderMenuG
5
5
  export declare function renderBadge(option: HeaderMenuOption | HeaderMenuGroupOption, className: string): VNodeChild | null;
6
6
  export declare function getMenuItemKey(option: HeaderMenuOption, index: number): string | number;
7
7
  export declare function hasChildren(option: HeaderMenuOption): boolean;
8
- export declare function isGroupOption(option: HeaderMenuOption): option is HeaderMenuGroupOption;
8
+ export declare function isGroupOption(option: HeaderMenuOption | HeaderMenuChildOption): option is HeaderMenuGroupOption;
9
9
  export declare function isDividerOption(option: HeaderMenuChildOption): option is HeaderMenuDividerOption;
10
10
  export declare function isColumnOption(option: HeaderMenuChildOption): option is HeaderMenuColumnOption;
11
11
  export declare function isNotNull<T>(value: T | null): value is T;
12
12
  export declare function resolvePlacement(placement: HeaderMenuPlacement): TabsProps['placement'];
13
+ export declare function isLeafMenuOption(option: HeaderMenuChildOption): option is Exclude<HeaderMenuChildOption, HeaderMenuColumnOption>;
@@ -9,6 +9,7 @@ exports.isDividerOption = isDividerOption;
9
9
  exports.isColumnOption = isColumnOption;
10
10
  exports.isNotNull = isNotNull;
11
11
  exports.resolvePlacement = resolvePlacement;
12
+ exports.isLeafMenuOption = isLeafMenuOption;
12
13
  const vue_1 = require("vue");
13
14
  function renderOptionLabel(option) {
14
15
  var _a;
@@ -56,3 +57,6 @@ function resolvePlacement(placement) {
56
57
  return placement;
57
58
  }
58
59
  }
60
+ function isLeafMenuOption(option) {
61
+ return option.type !== 'column';
62
+ }
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.8";
1
+ declare const _default: "1.12.10";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.12.8';
3
+ exports.default = '1.12.10';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uzum-tech/ui",
3
- "version": "1.12.8",
3
+ "version": "1.12.10",
4
4
  "description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",