@onereach/ui-components-vue2 18.4.0 → 18.4.1
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/bundled/components/OrMenuItemV3/OrMenuItem.js +24 -11
- package/dist/bundled/components/OrMenuItemV3/styles.d.ts +2 -0
- package/dist/bundled/components/OrMenuItemV3/styles.js +9 -1
- package/dist/bundled/index.js +1 -1
- package/dist/esm/components/or-menu-item-v3/index.js +31 -11
- package/dist/esm/components/or-menu-item-v3/styles.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { defineComponent, ref, computed } from 'vue-demi';
|
|
2
2
|
import { n as useIntersectionObserver } from '../../index-fe4d407a.js';
|
|
3
|
-
import { MenuItem } from './styles.js';
|
|
3
|
+
import { MenuItem, MenuItemIcon, MenuItemIconSelected } from './styles.js';
|
|
4
4
|
import __vue_component__$1 from '../OrIconV3/OrIcon.js';
|
|
5
5
|
import __vue_component__$2 from '../OrIconButtonV3/OrIconButton.js';
|
|
6
6
|
import __vue_component__$3 from '../OrTooltipV3/OrTooltip.js';
|
|
7
|
+
import { IconVariant } from '../OrIconV3/props.js';
|
|
7
8
|
import { n as normalizeComponent } from '../../normalize-component-cf2db48b.js';
|
|
8
9
|
|
|
9
10
|
var script = defineComponent({
|
|
@@ -11,7 +12,7 @@ var script = defineComponent({
|
|
|
11
12
|
components: {
|
|
12
13
|
OrIcon: __vue_component__$1,
|
|
13
14
|
OrIconButton: __vue_component__$2,
|
|
14
|
-
|
|
15
|
+
OrTooltip: __vue_component__$3
|
|
15
16
|
},
|
|
16
17
|
props: {
|
|
17
18
|
icon: {
|
|
@@ -37,7 +38,7 @@ var script = defineComponent({
|
|
|
37
38
|
},
|
|
38
39
|
emits: ['click', 'focus', 'blur', 'close'],
|
|
39
40
|
expose: ['root'],
|
|
40
|
-
setup() {
|
|
41
|
+
setup(props) {
|
|
41
42
|
// Refs
|
|
42
43
|
const root = ref();
|
|
43
44
|
const content = ref();
|
|
@@ -52,8 +53,18 @@ var script = defineComponent({
|
|
|
52
53
|
});
|
|
53
54
|
// Styles
|
|
54
55
|
const rootStyles = computed(() => ['or-menu-item-v3', ...MenuItem]);
|
|
55
|
-
|
|
56
|
-
const
|
|
56
|
+
const iconStyles = computed(() => [...MenuItemIcon, ...(props.selected ? MenuItemIconSelected : [])]);
|
|
57
|
+
const iconProps = computed(() => {
|
|
58
|
+
return typeof props.icon === 'string' ? {
|
|
59
|
+
icon: props.icon,
|
|
60
|
+
variant: IconVariant.Inherit
|
|
61
|
+
} : {
|
|
62
|
+
variant: IconVariant.Inherit,
|
|
63
|
+
...props.icon
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
// Tooltip display logic
|
|
67
|
+
const isTooltipShown = computed(() => {
|
|
57
68
|
if (isRootVisible.value) {
|
|
58
69
|
return content.value !== undefined && content.value.clientWidth < content.value.scrollWidth;
|
|
59
70
|
}
|
|
@@ -64,7 +75,9 @@ var script = defineComponent({
|
|
|
64
75
|
root,
|
|
65
76
|
tooltip,
|
|
66
77
|
rootStyles,
|
|
67
|
-
|
|
78
|
+
iconStyles,
|
|
79
|
+
isTooltipShown,
|
|
80
|
+
iconProps,
|
|
68
81
|
isRootVisible,
|
|
69
82
|
stop
|
|
70
83
|
};
|
|
@@ -83,7 +96,7 @@ var __vue_render__ = function () {
|
|
|
83
96
|
ref: 'root',
|
|
84
97
|
class: _vm.rootStyles,
|
|
85
98
|
attrs: {
|
|
86
|
-
"tabindex": !_vm.disabled ? 0 :
|
|
99
|
+
"tabindex": !_vm.disabled ? 0 : undefined,
|
|
87
100
|
"selected": _vm.selected,
|
|
88
101
|
"disabled": _vm.disabled
|
|
89
102
|
},
|
|
@@ -98,9 +111,9 @@ var __vue_render__ = function () {
|
|
|
98
111
|
return _vm.$emit('blur', $event);
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
|
-
}, [_vm.icon ? [_c('OrIcon', _vm._b({
|
|
102
|
-
|
|
103
|
-
}
|
|
114
|
+
}, [_vm.icon && _vm.iconProps.icon ? [_c('OrIcon', _vm._b({
|
|
115
|
+
class: _vm.iconStyles
|
|
116
|
+
}, 'OrIcon', _vm.iconProps, false))] : _vm._e(), _vm._v(" "), _c('div', {
|
|
104
117
|
ref: "content",
|
|
105
118
|
class: ['truncate', 'w-full'],
|
|
106
119
|
on: {
|
|
@@ -124,7 +137,7 @@ var __vue_render__ = function () {
|
|
|
124
137
|
return _vm.$emit('close');
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
|
-
})] : _vm._e(), _vm._v(" "), _vm.
|
|
140
|
+
})] : _vm._e(), _vm._v(" "), _vm.isTooltipShown ? _c('OrTooltip', {
|
|
128
141
|
ref: "tooltip",
|
|
129
142
|
attrs: {
|
|
130
143
|
"content": _vm.tooltipText,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const MenuItem = [
|
|
2
|
+
// Group
|
|
3
|
+
'group',
|
|
2
4
|
// Layout
|
|
3
5
|
'layout-row',
|
|
4
6
|
// Spacing
|
|
@@ -17,5 +19,11 @@ const MenuItem = [
|
|
|
17
19
|
'hover:md:theme-foreground-default', 'dark:hover:md:theme-foreground-default-dark',
|
|
18
20
|
// Theme (active)
|
|
19
21
|
'active:theme-foreground-default', 'dark:active:theme-foreground-default-dark'];
|
|
22
|
+
const MenuItemIcon = [
|
|
23
|
+
// Iconography (hover)
|
|
24
|
+
'group-hover:iconography-filled'];
|
|
25
|
+
const MenuItemIconSelected = [
|
|
26
|
+
// Iconography (selected)
|
|
27
|
+
'selected:iconography-filled'];
|
|
20
28
|
|
|
21
|
-
export { MenuItem };
|
|
29
|
+
export { MenuItem, MenuItemIcon, MenuItemIconSelected };
|