@aotearoan/neon 21.0.2 → 22.0.0
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/components/navigation/dropdown-menu/NeonDropdownMenu.cjs.js +1 -1
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.cjs.js.map +1 -1
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.es.js +30 -31
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.es.js.map +1 -1
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.vue.cjs.js +1 -1
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.vue.cjs.js.map +1 -1
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.vue.es.js +23 -23
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.vue.es.js.map +1 -1
- package/dist/components/navigation/menu/NeonMenu.cjs.js +1 -1
- package/dist/components/navigation/menu/NeonMenu.cjs.js.map +1 -1
- package/dist/components/navigation/menu/NeonMenu.es.js +57 -55
- package/dist/components/navigation/menu/NeonMenu.es.js.map +1 -1
- package/dist/components/navigation/menu/NeonMenu.vue.cjs.js +1 -1
- package/dist/components/navigation/menu/NeonMenu.vue.cjs.js.map +1 -1
- package/dist/components/navigation/menu/NeonMenu.vue.es.js +20 -21
- package/dist/components/navigation/menu/NeonMenu.vue.es.js.map +1 -1
- package/dist/components/presentation/dropdown/NeonDropdown.cjs.js +1 -1
- package/dist/components/presentation/dropdown/NeonDropdown.cjs.js.map +1 -1
- package/dist/components/presentation/dropdown/NeonDropdown.es.js +38 -47
- package/dist/components/presentation/dropdown/NeonDropdown.es.js.map +1 -1
- package/dist/components/user-input/search/NeonSearch.cjs.js +1 -1
- package/dist/components/user-input/search/NeonSearch.cjs.js.map +1 -1
- package/dist/components/user-input/search/NeonSearch.es.js +95 -82
- package/dist/components/user-input/search/NeonSearch.es.js.map +1 -1
- package/dist/components/user-input/search/NeonSearch.vue.cjs.js +1 -1
- package/dist/components/user-input/search/NeonSearch.vue.cjs.js.map +1 -1
- package/dist/components/user-input/search/NeonSearch.vue.es.js +19 -19
- package/dist/components/user-input/search/NeonSearch.vue.es.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.cjs.js +1 -1
- package/dist/components/user-input/toggle/NeonToggle.cjs.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.es.js +10 -10
- package/dist/components/user-input/toggle/NeonToggle.es.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.cjs.js +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.cjs.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.es.js +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.es.js.map +1 -1
- package/dist/src/components/navigation/dropdown-menu/NeonDropdownMenu.d.ts +134 -83
- package/dist/src/components/navigation/menu/NeonMenu.d.ts +38 -18
- package/dist/src/components/navigation/mobile-menu/NeonMobileMenu.d.ts +14 -11
- package/dist/src/components/presentation/dropdown/NeonDropdown.d.ts +34 -27
- package/dist/src/components/user-input/date-picker/NeonDatePicker.d.ts +5 -18
- package/dist/src/components/user-input/search/NeonSearch.d.ts +188 -208
- package/dist/src/components/user-input/select/NeonSelect.d.ts +21 -110
- package/dist/src/components/user-input/toggle/NeonToggle.d.ts +1 -1
- package/package.json +1 -1
- package/src/sass/components/_badge.scss +1 -0
- package/src/sass/components/_card.scss +7 -7
- package/src/sass/components/_skeleton-loader.scss +3 -4
- package/src/sass/components/_slider.scss +1 -1
- package/src/sass/components/_toggle.scss +9 -3
- package/src/sass/variables.scss +10 -7
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { NeonFunctionalColor as
|
|
5
|
-
import { NeonSize as
|
|
6
|
-
import
|
|
7
|
-
import { useRoute as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as W, ref as s, onMounted as x, nextTick as g, onUnmounted as C } from "vue";
|
|
2
|
+
import L from "../link/NeonLink.vue.es.js";
|
|
3
|
+
import z from "../dropdown-menu/NeonDropdownMenu.vue.es.js";
|
|
4
|
+
import { NeonFunctionalColor as I } from "../../../common/enums/NeonFunctionalColor.es.js";
|
|
5
|
+
import { NeonSize as _ } from "../../../common/enums/NeonSize.es.js";
|
|
6
|
+
import B from "../../presentation/icon/NeonIcon.vue.es.js";
|
|
7
|
+
import { useRoute as F } from "vue-router";
|
|
8
|
+
const P = W({
|
|
9
9
|
name: "NeonMenu",
|
|
10
10
|
components: {
|
|
11
|
-
NeonDropdownMenu:
|
|
12
|
-
NeonLink:
|
|
13
|
-
NeonIcon:
|
|
11
|
+
NeonDropdownMenu: z,
|
|
12
|
+
NeonLink: L,
|
|
13
|
+
NeonIcon: B
|
|
14
14
|
},
|
|
15
15
|
props: {
|
|
16
16
|
/**
|
|
@@ -21,11 +21,11 @@ const T = x({
|
|
|
21
21
|
/**
|
|
22
22
|
* The menu highlight color (excludes low-contrast and neutral).
|
|
23
23
|
*/
|
|
24
|
-
color: { type: String, default:
|
|
24
|
+
color: { type: String, default: I.Brand },
|
|
25
25
|
/**
|
|
26
26
|
* The menu size.
|
|
27
27
|
*/
|
|
28
|
-
size: { type: String, default:
|
|
28
|
+
size: { type: String, default: _.Large },
|
|
29
29
|
/**
|
|
30
30
|
* Whether to enable the priority menu which automatically calculates the available screen space and displays
|
|
31
31
|
* as many of the menu items as possible, moving the remaining items into the overflow menu.
|
|
@@ -39,61 +39,63 @@ const T = x({
|
|
|
39
39
|
*/
|
|
40
40
|
"click"
|
|
41
41
|
],
|
|
42
|
-
setup(
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
return Math.ceil(
|
|
46
|
-
},
|
|
47
|
-
key:
|
|
48
|
-
element:
|
|
49
|
-
width: p(
|
|
50
|
-
}),
|
|
51
|
-
const
|
|
52
|
-
(
|
|
42
|
+
setup(d, { emit: w }) {
|
|
43
|
+
const m = F(), c = s(null), f = s(null), l = s([]), y = s([]), u = s([]), p = (n) => {
|
|
44
|
+
const e = window.getComputedStyle(n), o = parseFloat(e.marginLeft || "0") + parseFloat(e.marginRight || "0");
|
|
45
|
+
return Math.ceil(n.offsetWidth + o);
|
|
46
|
+
}, M = (n, e) => ({
|
|
47
|
+
key: n,
|
|
48
|
+
element: e,
|
|
49
|
+
width: p(e)
|
|
50
|
+
}), k = () => {
|
|
51
|
+
const n = d.menu.map(
|
|
52
|
+
(e, o) => f.value && M(e.key, f.value[o]) || null
|
|
53
53
|
);
|
|
54
|
-
l.value =
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
if (
|
|
59
|
-
return
|
|
60
|
-
let
|
|
61
|
-
for (let i = 0; i <
|
|
62
|
-
const a =
|
|
63
|
-
if (
|
|
64
|
-
i === 1 && (
|
|
54
|
+
l.value = n.filter((e) => e !== null);
|
|
55
|
+
}, b = (n) => n && (m == null ? void 0 : m.path.indexOf(n)) >= 0, E = (n) => {
|
|
56
|
+
w("click", n);
|
|
57
|
+
}, N = (n, e, o) => {
|
|
58
|
+
if (o.map((i) => i.width).reduce((i, a) => i ? i + a : 0) <= n - e)
|
|
59
|
+
return o.map((i) => i.key);
|
|
60
|
+
let t = n - e, r = [];
|
|
61
|
+
for (let i = 0; i < o.length; i = i + 1) {
|
|
62
|
+
const a = o[i];
|
|
63
|
+
if (t < a.width) {
|
|
64
|
+
i === 1 && (r = r.filter((S) => S !== o[0].key));
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
t = t - a.width, r.push(a.key);
|
|
68
68
|
}
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
return r;
|
|
70
|
+
}, h = async () => {
|
|
71
|
+
var v;
|
|
72
|
+
await g();
|
|
73
|
+
const n = c.value && p(c.value) || 0, e = (v = c.value) == null ? void 0 : v.getElementsByClassName(
|
|
74
|
+
"neon-menu__responsive-menu"
|
|
75
|
+
)[0], o = e && p(e) || 0;
|
|
76
|
+
u.value = N(n, o, l.value), y.value = d.menu.filter((t) => u.value.indexOf(t.key) < 0).flatMap((t) => [
|
|
77
|
+
{ ...t, isGroup: t.children && t.children.length > 0 },
|
|
78
|
+
...(t.children || []).map((r) => ({ ...r, grouped: !0 }))
|
|
79
|
+
]), l.value.forEach((t) => {
|
|
80
|
+
t.element.hidden = u.value.indexOf(t.key) < 0;
|
|
81
|
+
}), e && (e.hidden = l.value.length === u.value.length);
|
|
79
82
|
};
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
}),
|
|
83
|
-
|
|
83
|
+
return x(async () => {
|
|
84
|
+
d.priorityMenuEnabled && (await g(), k(), await h(), window.addEventListener("resize", h));
|
|
85
|
+
}), C(() => {
|
|
86
|
+
d.priorityMenuEnabled && window.removeEventListener("resize", h);
|
|
84
87
|
}), {
|
|
85
|
-
menuWrapper:
|
|
88
|
+
menuWrapper: c,
|
|
86
89
|
menuItem: f,
|
|
87
90
|
menuItems: l,
|
|
88
|
-
responsiveButton: r,
|
|
89
91
|
responsiveMenuItems: y,
|
|
90
92
|
visible: u,
|
|
91
|
-
onClick:
|
|
92
|
-
routeMatches:
|
|
93
|
+
onClick: E,
|
|
94
|
+
routeMatches: b
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
97
|
});
|
|
96
98
|
export {
|
|
97
|
-
|
|
99
|
+
P as default
|
|
98
100
|
};
|
|
99
101
|
//# sourceMappingURL=NeonMenu.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonMenu.es.js","sources":["../../../../src/components/navigation/menu/NeonMenu.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { defineComponent, nextTick, onMounted, onUnmounted, ref } from 'vue';\nimport type { NeonMenuModel } from '@/common/models/NeonMenuModel';\nimport NeonLink from '@/components/navigation/link/NeonLink.vue';\nimport NeonDropdownMenu from '@/components/navigation/dropdown-menu/NeonDropdownMenu.vue';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport type { NeonPriorityMenuItem } from './NeonPriorityMenuItem';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport { useRoute } from 'vue-router';\n\n/**\n * <p>\n * <strong>NeonMenu</strong> is a responsive aware menu that progressively collapses options into the mobile menu as\n * the screen size gets smaller. This is a more flexible option than moving directly to a hamburger menu at tablet and\n * below. It is a best effort approach to keep displaying the most important menu items for as long as possible,\n * giving the user a better experience.\n * </p>\n */\nexport default defineComponent({\n name: 'NeonMenu',\n components: {\n NeonDropdownMenu,\n NeonLink,\n NeonIcon,\n },\n props: {\n /**\n * The menu configuration. This can have two levels, i.e. a top level horizontal menu and, if required, a dropdown\n * menu containing the second level. The highlighted 'active' menu is determined by the current Vue route.\n */\n menu: { type: Array as () => Array<NeonMenuModel>, required: true },\n /**\n * The menu highlight color (excludes low-contrast and neutral).\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Brand },\n /**\n * The menu size.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Large },\n /**\n * Whether to enable the priority menu which automatically calculates the available screen space and displays\n * as many of the menu items as possible, moving the remaining items into the overflow menu.\n */\n priorityMenuEnabled: { type: Boolean, default: true },\n },\n emits: [\n /**\n * Emitted when a user clicks on a menu item.\n * @type {string} the key of the menu item clicked.\n */\n 'click',\n ],\n setup(props, { emit }) {\n const route = useRoute();\n const menuWrapper = ref<HTMLElement | null>(null);\n const menuItem = ref<Array<HTMLElement> | null>(null);\n
|
|
1
|
+
{"version":3,"file":"NeonMenu.es.js","sources":["../../../../src/components/navigation/menu/NeonMenu.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { defineComponent, nextTick, onMounted, onUnmounted, ref } from 'vue';\nimport type { NeonMenuModel } from '@/common/models/NeonMenuModel';\nimport NeonLink from '@/components/navigation/link/NeonLink.vue';\nimport NeonDropdownMenu from '@/components/navigation/dropdown-menu/NeonDropdownMenu.vue';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport type { NeonPriorityMenuItem } from './NeonPriorityMenuItem';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport { useRoute } from 'vue-router';\n\n/**\n * <p>\n * <strong>NeonMenu</strong> is a responsive aware menu that progressively collapses options into the mobile menu as\n * the screen size gets smaller. This is a more flexible option than moving directly to a hamburger menu at tablet and\n * below. It is a best effort approach to keep displaying the most important menu items for as long as possible,\n * giving the user a better experience.\n * </p>\n */\nexport default defineComponent({\n name: 'NeonMenu',\n components: {\n NeonDropdownMenu,\n NeonLink,\n NeonIcon,\n },\n props: {\n /**\n * The menu configuration. This can have two levels, i.e. a top level horizontal menu and, if required, a dropdown\n * menu containing the second level. The highlighted 'active' menu is determined by the current Vue route.\n */\n menu: { type: Array as () => Array<NeonMenuModel>, required: true },\n /**\n * The menu highlight color (excludes low-contrast and neutral).\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Brand },\n /**\n * The menu size.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Large },\n /**\n * Whether to enable the priority menu which automatically calculates the available screen space and displays\n * as many of the menu items as possible, moving the remaining items into the overflow menu.\n */\n priorityMenuEnabled: { type: Boolean, default: true },\n },\n emits: [\n /**\n * Emitted when a user clicks on a menu item.\n * @type {string} the key of the menu item clicked.\n */\n 'click',\n ],\n setup(props, { emit }) {\n const route = useRoute();\n const menuWrapper = ref<HTMLElement | null>(null);\n const menuItem = ref<Array<HTMLElement> | null>(null);\n\n const menuItems = ref<Array<NeonPriorityMenuItem>>([]);\n const responsiveMenuItems = ref<Array<NeonMenuModel>>([]);\n const visible = ref<Array<string>>([]);\n\n const getWidth = (el: HTMLElement) => {\n const styles = window.getComputedStyle(el);\n const margin = parseFloat(styles.marginLeft || '0') + parseFloat(styles.marginRight || '0');\n return Math.ceil(el.offsetWidth + margin);\n };\n\n const toPriorityMenuItem = (key: string, element: HTMLElement): NeonPriorityMenuItem => {\n return {\n key,\n element,\n width: getWidth(element),\n };\n };\n\n const initMenuItems = () => {\n const results = props.menu.map(\n (item, index) => (menuItem.value && toPriorityMenuItem(item.key, menuItem.value[index])) || null,\n );\n menuItems.value = results.filter((item) => item !== null) as NeonPriorityMenuItem[];\n };\n\n const routeMatches = (path?: string) => {\n return path && route?.path.indexOf(path) >= 0;\n };\n\n const onClick = (key: string) => {\n emit('click', key);\n };\n\n const determineVisibleMenuItems = (\n menuWidth: number,\n responsiveMenuWidth: number,\n menuItems: NeonPriorityMenuItem[],\n ) => {\n const itemWidthSum = menuItems.map((item) => item.width).reduce((acc: number, width) => (acc ? acc + width : 0));\n\n // no responsive menu\n if (itemWidthSum <= menuWidth - responsiveMenuWidth) {\n return menuItems.map((menuItem) => menuItem.key);\n }\n\n // with responsive menu\n let availableWidth = menuWidth - responsiveMenuWidth;\n let visible: string[] = [];\n\n for (let i = 0; i < menuItems.length; i = i + 1) {\n const menuItem = menuItems[i];\n if (availableWidth < menuItem.width) {\n // if the second menu item should be hidden, also hide the first one to improve how it looks\n if (i === 1) {\n visible = visible.filter((key) => key !== menuItems[0].key);\n }\n break;\n }\n\n availableWidth = availableWidth - menuItem.width;\n visible.push(menuItem.key);\n }\n\n return visible;\n };\n\n const refreshVisibleMenu = async () => {\n await nextTick();\n const menuWidth = (menuWrapper.value && getWidth(menuWrapper.value)) || 0;\n const responsiveDropdown = menuWrapper.value?.getElementsByClassName(\n 'neon-menu__responsive-menu',\n )[0] as HTMLElement;\n const responsiveMenuWidth = (responsiveDropdown && getWidth(responsiveDropdown)) || 0;\n visible.value = determineVisibleMenuItems(menuWidth, responsiveMenuWidth, menuItems.value);\n\n responsiveMenuItems.value = props.menu\n .filter((item) => visible.value.indexOf(item.key) < 0)\n .flatMap((item) => [\n { ...item, isGroup: item.children && item.children.length > 0 },\n ...(item.children || []).map((item) => ({ ...item, grouped: true })),\n ]);\n\n menuItems.value.forEach((item) => {\n item.element.hidden = visible.value.indexOf(item.key) < 0;\n });\n\n if (responsiveDropdown) {\n responsiveDropdown.hidden = menuItems.value.length === visible.value.length;\n }\n };\n\n onMounted(async () => {\n if (props.priorityMenuEnabled) {\n await nextTick();\n initMenuItems();\n await refreshVisibleMenu();\n window.addEventListener('resize', refreshVisibleMenu);\n }\n });\n\n onUnmounted(() => {\n if (props.priorityMenuEnabled) {\n window.removeEventListener('resize', refreshVisibleMenu);\n }\n });\n\n return {\n menuWrapper,\n menuItem,\n menuItems,\n responsiveMenuItems,\n visible,\n onClick,\n routeMatches,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonDropdownMenu","NeonLink","NeonIcon","NeonFunctionalColor","NeonSize","props","emit","route","useRoute","menuWrapper","ref","menuItem","menuItems","responsiveMenuItems","visible","getWidth","el","styles","margin","toPriorityMenuItem","key","element","initMenuItems","results","item","index","routeMatches","path","onClick","determineVisibleMenuItems","menuWidth","responsiveMenuWidth","acc","width","availableWidth","refreshVisibleMenu","nextTick","responsiveDropdown","_a","onMounted","onUnmounted"],"mappings":";;;;;;;AAkBA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,kBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,MAAM,EAAE,MAAM,OAAqC,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAI7D,OAAO,EAAE,MAAM,QAAqC,SAASC,EAAoB,MAAA;AAAA;AAAA;AAAA;AAAA,IAIjF,MAAM,EAAE,MAAM,QAA0B,SAASC,EAAS,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAK1D,qBAAqB,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA,EAAK;AAAA,EAEtD,OAAO;AAA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,EAAA,GACA,MAAMa,EAAA,GACN,OAAO,iBAAiB,UAAUA,CAAkB;AAAA,IAExD,CAAC,GAEDK,EAAY,MAAM;AAChB,MAAInC,EAAM,uBACR,OAAO,oBAAoB,UAAU8B,CAAkB;AAAA,IAE3D,CAAC,GAEM;AAAA,MACL,aAAA1B;AAAA,MACA,UAAAE;AAAA,MACA,WAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,SAAAC;AAAA,MACA,SAAAc;AAAA,MACA,cAAAF;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const c=require("./NeonMenu.cjs.js"),e=require("vue"),
|
|
1
|
+
"use strict";const c=require("./NeonMenu.cjs.js"),e=require("vue"),t=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),i={ref:"menuWrapper",class:"neon-menu__wrapper"},d={class:"neon-menu__item-label"};function u(o,k,m,_,y,b){const l=e.resolveComponent("neon-dropdown-menu"),r=e.resolveComponent("neon-icon"),a=e.resolveComponent("neon-link");return e.openBlock(),e.createElementBlock("nav",i,[e.createElementVNode("ul",{class:e.normalizeClass([[`neon-menu--${o.color}`,`neon-menu--${o.size}`],"neon-menu no-style"]),role:"menubar"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.menu,n=>(e.openBlock(),e.createElementBlock("li",{key:n.key,ref_for:!0,ref:"menuItem",class:e.normalizeClass([{"neon-menu__item--disabled":n.disabled},"neon-menu__item"])},[n.children?(e.openBlock(),e.createBlock(l,{key:`${n.key}DropdownMenu`,class:e.normalizeClass({"router-link-active":o.routeMatches(n.href)}),color:o.color,disabled:n.disabled,icon:n.icon,label:n.label,model:n.children,openOnHover:!n.disabled,size:o.size,"dropdown-style":"text"},null,8,["class","color","disabled","icon","label","model","openOnHover","size"])):(e.openBlock(),e.createBlock(a,{key:`${n.key}Link`,class:e.normalizeClass({"router-link-active":o.routeMatches(n.href)}),href:n.href,"no-style":!0,tabindex:n.disabled?-1:0,"outline-style":"none",role:"menuitem",onClick:s=>!n.disabled&&o.onClick(n.key),onKeydown:[e.withKeys(s=>!n.disabled&&o.onClick(n.key),["enter"]),e.withKeys(e.withModifiers(s=>!n.disabled&&o.onClick(n.key),["prevent"]),["space"])]},{default:e.withCtx(()=>[n.icon?(e.openBlock(),e.createBlock(r,{key:`${n.key}LinkIcon`,name:n.icon,class:"neon-menu__item-icon",color:"neutral"},null,8,["name"])):e.createCommentVNode("",!0),e.createElementVNode("span",d,e.toDisplayString(n.label),1)]),_:2},1032,["class","href","tabindex","onClick","onKeydown"]))],2))),128))],2),e.createVNode(l,{class:e.normalizeClass([{"neon-menu__responsive-menu--hidden":o.responsiveMenuItems.length===0},"neon-menu__responsive-menu"]),color:o.color,indicator:!1,model:o.responsiveMenuItems,openOnHover:!0,size:o.size,"dropdown-style":"text",icon:"ellipsis",placement:"bottom-right"},null,8,["class","color","model","size"])],512)}const p=t(c,[["render",u]]);module.exports=p;
|
|
2
2
|
//# sourceMappingURL=NeonMenu.vue.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonMenu.vue.cjs.js","sources":["../../../../src/components/navigation/menu/NeonMenu.vue"],"sourcesContent":["<template>\n <nav ref=\"menuWrapper\" class=\"neon-menu__wrapper\">\n <ul :class=\"[`neon-menu--${color}`, `neon-menu--${size}`]\" class=\"neon-menu no-style\" role=\"menubar\">\n <li\n v-for=\"item in menu\"\n :key=\"item.key\"\n ref=\"menuItem\"\n :class=\"{ 'neon-menu__item--disabled': item.disabled }\"\n class=\"neon-menu__item\"\n >\n <neon-dropdown-menu\n v-if=\"item.children\"\n :key=\"`${item.key}DropdownMenu`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :color=\"color\"\n :disabled=\"item.disabled\"\n :icon=\"item.icon\"\n :label=\"item.label\"\n :model=\"item.children\"\n :openOnHover=\"!item.disabled\"\n :size=\"size\"\n dropdown-style=\"text\"\n />\n <neon-link\n v-else\n :key=\"`${item.key}Link`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :href=\"item.href\"\n :no-style=\"true\"\n :tabindex=\"item.disabled ? -1 : 0\"\n outline-style=\"none\"\n role=\"menuitem\"\n @click=\"!item.disabled && onClick(item.key)\"\n @keydown.enter=\"!item.disabled && onClick(item.key)\"\n @keydown.space.prevent=\"!item.disabled && onClick(item.key)\"\n >\n <neon-icon\n v-if=\"item.icon\"\n :key=\"`${item.key}LinkIcon`\"\n :name=\"item.icon\"\n class=\"neon-menu__item-icon\"\n color=\"neutral\"\n />\n <span class=\"neon-menu__item-label\">{{ item.label }}</span>\n </neon-link>\n </li>\n </ul>\n <neon-dropdown-menu\n :class=\"{ 'neon-menu__responsive-menu--hidden': responsiveMenuItems.length === 0 }\"\n :color=\"color\"\n :indicator=\"false\"\n :model=\"responsiveMenuItems\"\n :openOnHover=\"true\"\n :size=\"size\"\n class=\"neon-menu__responsive-menu\"\n dropdown-style=\"text\"\n icon=\"ellipsis\"\n placement=\"bottom-right\"\n
|
|
1
|
+
{"version":3,"file":"NeonMenu.vue.cjs.js","sources":["../../../../src/components/navigation/menu/NeonMenu.vue"],"sourcesContent":["<template>\n <nav ref=\"menuWrapper\" class=\"neon-menu__wrapper\">\n <ul :class=\"[`neon-menu--${color}`, `neon-menu--${size}`]\" class=\"neon-menu no-style\" role=\"menubar\">\n <li\n v-for=\"item in menu\"\n :key=\"item.key\"\n ref=\"menuItem\"\n :class=\"{ 'neon-menu__item--disabled': item.disabled }\"\n class=\"neon-menu__item\"\n >\n <neon-dropdown-menu\n v-if=\"item.children\"\n :key=\"`${item.key}DropdownMenu`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :color=\"color\"\n :disabled=\"item.disabled\"\n :icon=\"item.icon\"\n :label=\"item.label\"\n :model=\"item.children\"\n :openOnHover=\"!item.disabled\"\n :size=\"size\"\n dropdown-style=\"text\"\n />\n <neon-link\n v-else\n :key=\"`${item.key}Link`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :href=\"item.href\"\n :no-style=\"true\"\n :tabindex=\"item.disabled ? -1 : 0\"\n outline-style=\"none\"\n role=\"menuitem\"\n @click=\"!item.disabled && onClick(item.key)\"\n @keydown.enter=\"!item.disabled && onClick(item.key)\"\n @keydown.space.prevent=\"!item.disabled && onClick(item.key)\"\n >\n <neon-icon\n v-if=\"item.icon\"\n :key=\"`${item.key}LinkIcon`\"\n :name=\"item.icon\"\n class=\"neon-menu__item-icon\"\n color=\"neutral\"\n />\n <span class=\"neon-menu__item-label\">{{ item.label }}</span>\n </neon-link>\n </li>\n </ul>\n <neon-dropdown-menu\n :class=\"{ 'neon-menu__responsive-menu--hidden': responsiveMenuItems.length === 0 }\"\n :color=\"color\"\n :indicator=\"false\"\n :model=\"responsiveMenuItems\"\n :openOnHover=\"true\"\n :size=\"size\"\n class=\"neon-menu__responsive-menu\"\n dropdown-style=\"text\"\n icon=\"ellipsis\"\n placement=\"bottom-right\"\n />\n </nav>\n</template>\n\n<script lang=\"ts\" src=\"./NeonMenu.ts\" />\n"],"names":["_hoisted_2","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_normalizeClass","_ctx","_Fragment","_renderList","item","_createBlock","_component_neon_dropdown_menu","_component_neon_link","$event","_withKeys","_withModifiers","_component_neon_icon","_toDisplayString","_createVNode"],"mappings":"sIACO,IAAI,cAAc,MAAM,sBA0CfA,EAAA,CAAA,MAAM,uBAAuB,+IA1C3C,OAAAC,YAAA,EAAAC,qBA0DM,MA1DNC,EA0DM,CAzDJC,EAAAA,mBA4CK,KAAA,CA5CA,MAAKC,EAAAA,eAAA,CAAA,CAAA,cAAiBC,EAAA,KAAK,GAAA,cAAkBA,EAAA,IAAI,IAAW,oBAAoB,CAAA,EAAC,KAAK,6BACzFJ,EAAAA,mBA0CKK,EAAAA,SAAA,KAAAC,EAAAA,WAzCYF,EAAA,KAARG,kBADTP,EAAAA,mBA0CK,KAAA,CAxCF,IAAKO,EAAK,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CAAA,EALjC,MAAOA,EAAA,MACP,UAAW,GACX,MAAOA,EAAA,oBACP,YAAa,GACb,KAAMA,EAAA,KAEP,iBAAe,OACf,KAAK,WACL,UAAU"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { resolveComponent as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import m from "./NeonMenu.es.js";
|
|
2
|
+
import { resolveComponent as r, openBlock as o, createElementBlock as s, createElementVNode as c, normalizeClass as l, Fragment as k, renderList as _, createBlock as a, withKeys as t, withModifiers as f, withCtx as y, createCommentVNode as b, toDisplayString as h, createVNode as v } from "vue";
|
|
3
|
+
import $ from "../../../_virtual/_plugin-vue_export-helper.es.js";
|
|
4
|
+
const w = {
|
|
5
5
|
ref: "menuWrapper",
|
|
6
6
|
class: "neon-menu__wrapper"
|
|
7
|
-
},
|
|
8
|
-
function
|
|
9
|
-
const d =
|
|
10
|
-
return o(),
|
|
7
|
+
}, C = { class: "neon-menu__item-label" };
|
|
8
|
+
function z(n, M, g, I, N, B) {
|
|
9
|
+
const d = r("neon-dropdown-menu"), u = r("neon-icon"), p = r("neon-link");
|
|
10
|
+
return o(), s("nav", w, [
|
|
11
11
|
c("ul", {
|
|
12
12
|
class: l([[`neon-menu--${n.color}`, `neon-menu--${n.size}`], "neon-menu no-style"]),
|
|
13
13
|
role: "menubar"
|
|
14
14
|
}, [
|
|
15
|
-
(o(!0),
|
|
15
|
+
(o(!0), s(k, null, _(n.menu, (e) => (o(), s("li", {
|
|
16
16
|
key: e.key,
|
|
17
17
|
ref_for: !0,
|
|
18
18
|
ref: "menuItem",
|
|
@@ -29,7 +29,7 @@ function M(n, i, B, g, I, N) {
|
|
|
29
29
|
openOnHover: !e.disabled,
|
|
30
30
|
size: n.size,
|
|
31
31
|
"dropdown-style": "text"
|
|
32
|
-
}, null, 8, ["class", "color", "disabled", "icon", "label", "model", "openOnHover", "size"])) : (o(), a(
|
|
32
|
+
}, null, 8, ["class", "color", "disabled", "icon", "label", "model", "openOnHover", "size"])) : (o(), a(p, {
|
|
33
33
|
key: `${e.key}Link`,
|
|
34
34
|
class: l({ "router-link-active": n.routeMatches(e.href) }),
|
|
35
35
|
href: e.href,
|
|
@@ -37,26 +37,26 @@ function M(n, i, B, g, I, N) {
|
|
|
37
37
|
tabindex: e.disabled ? -1 : 0,
|
|
38
38
|
"outline-style": "none",
|
|
39
39
|
role: "menuitem",
|
|
40
|
-
onClick: (
|
|
40
|
+
onClick: (i) => !e.disabled && n.onClick(e.key),
|
|
41
41
|
onKeydown: [
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
t((i) => !e.disabled && n.onClick(e.key), ["enter"]),
|
|
43
|
+
t(f((i) => !e.disabled && n.onClick(e.key), ["prevent"]), ["space"])
|
|
44
44
|
]
|
|
45
45
|
}, {
|
|
46
|
-
default:
|
|
47
|
-
e.icon ? (o(), a(
|
|
46
|
+
default: y(() => [
|
|
47
|
+
e.icon ? (o(), a(u, {
|
|
48
48
|
key: `${e.key}LinkIcon`,
|
|
49
49
|
name: e.icon,
|
|
50
50
|
class: "neon-menu__item-icon",
|
|
51
51
|
color: "neutral"
|
|
52
|
-
}, null, 8, ["name"])) :
|
|
53
|
-
c("span",
|
|
52
|
+
}, null, 8, ["name"])) : b("", !0),
|
|
53
|
+
c("span", C, h(e.label), 1)
|
|
54
54
|
]),
|
|
55
55
|
_: 2
|
|
56
56
|
}, 1032, ["class", "href", "tabindex", "onClick", "onKeydown"]))
|
|
57
57
|
], 2))), 128))
|
|
58
58
|
], 2),
|
|
59
|
-
|
|
59
|
+
v(d, {
|
|
60
60
|
class: l([{ "neon-menu__responsive-menu--hidden": n.responsiveMenuItems.length === 0 }, "neon-menu__responsive-menu"]),
|
|
61
61
|
color: n.color,
|
|
62
62
|
indicator: !1,
|
|
@@ -65,12 +65,11 @@ function M(n, i, B, g, I, N) {
|
|
|
65
65
|
size: n.size,
|
|
66
66
|
"dropdown-style": "text",
|
|
67
67
|
icon: "ellipsis",
|
|
68
|
-
placement: "bottom-right"
|
|
69
|
-
onButtonRef: i[0] || (i[0] = (e) => n.responsiveButton = e)
|
|
68
|
+
placement: "bottom-right"
|
|
70
69
|
}, null, 8, ["class", "color", "model", "size"])
|
|
71
70
|
], 512);
|
|
72
71
|
}
|
|
73
|
-
const O = /* @__PURE__ */
|
|
72
|
+
const O = /* @__PURE__ */ $(m, [["render", z]]);
|
|
74
73
|
export {
|
|
75
74
|
O as default
|
|
76
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonMenu.vue.es.js","sources":["../../../../src/components/navigation/menu/NeonMenu.vue"],"sourcesContent":["<template>\n <nav ref=\"menuWrapper\" class=\"neon-menu__wrapper\">\n <ul :class=\"[`neon-menu--${color}`, `neon-menu--${size}`]\" class=\"neon-menu no-style\" role=\"menubar\">\n <li\n v-for=\"item in menu\"\n :key=\"item.key\"\n ref=\"menuItem\"\n :class=\"{ 'neon-menu__item--disabled': item.disabled }\"\n class=\"neon-menu__item\"\n >\n <neon-dropdown-menu\n v-if=\"item.children\"\n :key=\"`${item.key}DropdownMenu`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :color=\"color\"\n :disabled=\"item.disabled\"\n :icon=\"item.icon\"\n :label=\"item.label\"\n :model=\"item.children\"\n :openOnHover=\"!item.disabled\"\n :size=\"size\"\n dropdown-style=\"text\"\n />\n <neon-link\n v-else\n :key=\"`${item.key}Link`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :href=\"item.href\"\n :no-style=\"true\"\n :tabindex=\"item.disabled ? -1 : 0\"\n outline-style=\"none\"\n role=\"menuitem\"\n @click=\"!item.disabled && onClick(item.key)\"\n @keydown.enter=\"!item.disabled && onClick(item.key)\"\n @keydown.space.prevent=\"!item.disabled && onClick(item.key)\"\n >\n <neon-icon\n v-if=\"item.icon\"\n :key=\"`${item.key}LinkIcon`\"\n :name=\"item.icon\"\n class=\"neon-menu__item-icon\"\n color=\"neutral\"\n />\n <span class=\"neon-menu__item-label\">{{ item.label }}</span>\n </neon-link>\n </li>\n </ul>\n <neon-dropdown-menu\n :class=\"{ 'neon-menu__responsive-menu--hidden': responsiveMenuItems.length === 0 }\"\n :color=\"color\"\n :indicator=\"false\"\n :model=\"responsiveMenuItems\"\n :openOnHover=\"true\"\n :size=\"size\"\n class=\"neon-menu__responsive-menu\"\n dropdown-style=\"text\"\n icon=\"ellipsis\"\n placement=\"bottom-right\"\n
|
|
1
|
+
{"version":3,"file":"NeonMenu.vue.es.js","sources":["../../../../src/components/navigation/menu/NeonMenu.vue"],"sourcesContent":["<template>\n <nav ref=\"menuWrapper\" class=\"neon-menu__wrapper\">\n <ul :class=\"[`neon-menu--${color}`, `neon-menu--${size}`]\" class=\"neon-menu no-style\" role=\"menubar\">\n <li\n v-for=\"item in menu\"\n :key=\"item.key\"\n ref=\"menuItem\"\n :class=\"{ 'neon-menu__item--disabled': item.disabled }\"\n class=\"neon-menu__item\"\n >\n <neon-dropdown-menu\n v-if=\"item.children\"\n :key=\"`${item.key}DropdownMenu`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :color=\"color\"\n :disabled=\"item.disabled\"\n :icon=\"item.icon\"\n :label=\"item.label\"\n :model=\"item.children\"\n :openOnHover=\"!item.disabled\"\n :size=\"size\"\n dropdown-style=\"text\"\n />\n <neon-link\n v-else\n :key=\"`${item.key}Link`\"\n :class=\"{ 'router-link-active': routeMatches(item.href) }\"\n :href=\"item.href\"\n :no-style=\"true\"\n :tabindex=\"item.disabled ? -1 : 0\"\n outline-style=\"none\"\n role=\"menuitem\"\n @click=\"!item.disabled && onClick(item.key)\"\n @keydown.enter=\"!item.disabled && onClick(item.key)\"\n @keydown.space.prevent=\"!item.disabled && onClick(item.key)\"\n >\n <neon-icon\n v-if=\"item.icon\"\n :key=\"`${item.key}LinkIcon`\"\n :name=\"item.icon\"\n class=\"neon-menu__item-icon\"\n color=\"neutral\"\n />\n <span class=\"neon-menu__item-label\">{{ item.label }}</span>\n </neon-link>\n </li>\n </ul>\n <neon-dropdown-menu\n :class=\"{ 'neon-menu__responsive-menu--hidden': responsiveMenuItems.length === 0 }\"\n :color=\"color\"\n :indicator=\"false\"\n :model=\"responsiveMenuItems\"\n :openOnHover=\"true\"\n :size=\"size\"\n class=\"neon-menu__responsive-menu\"\n dropdown-style=\"text\"\n icon=\"ellipsis\"\n placement=\"bottom-right\"\n />\n </nav>\n</template>\n\n<script lang=\"ts\" src=\"./NeonMenu.ts\" />\n"],"names":["_hoisted_2","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_normalizeClass","_ctx","_Fragment","_renderList","item","_createBlock","_component_neon_dropdown_menu","_component_neon_link","$event","_withKeys","_withModifiers","_component_neon_icon","_toDisplayString","_createVNode"],"mappings":";;;;EACO,KAAI;AAAA,EAAc,OAAM;GA0CfA,IAAA,EAAA,OAAM,wBAAuB;;;AA1C3C,SAAAC,EAAA,GAAAC,EA0DM,OA1DNC,GA0DM;AAAA,IAzDJC,EA4CK,MAAA;AAAA,MA5CA,OAAKC,EAAA,CAAA,CAAA,cAAiBC,EAAA,KAAK,IAAA,cAAkBA,EAAA,IAAI,KAAW,oBAAoB,CAAA;AAAA,MAAC,MAAK;AAAA;cACzFJ,EA0CKK,GAAA,MAAAC,EAzCYF,EAAA,MAAI,CAAZG,YADTP,EA0CK,MAAA;AAAA,QAxCF,KAAKO,EAAK;AAAA;QACX,KAAI;AAAA,QACH,OAAKJ,EAAA,CAAA,EAAA,6BAAiCI,EAAK,SAAQ,GAC9C,iBAAiB,CAAA;AAAA;QAGfA,EAAK,iBADbC,EAYEC,GAAA;AAAA,UAVC,KAAG,GAAKF,EAAK,GAAG;AAAA,UAChB,OAAKJ,EAAA,EAAA,sBAA0BC,EAAA,aAAaG,EAAK,IAAI,GAAA;AAAA,UACrD,OAAOH,EAAA;AAAA,UACP,UAAUG,EAAK;AAAA,UACf,MAAMA,EAAK;AAAA,UACX,OAAOA,EAAK;AAAA,UACZ,OAA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),w=require("../../../common/enums/NeonDropdownPlacement.cjs.js"),y=require("../../../common/utils/NeonDropdownPlacementUtils.cjs.js"),S=require("../../../common/utils/NeonClosableUtils.cjs.js"),g=require("../../../common/enums/NeonSize.cjs.js"),N=require("../../../common/enums/NeonFunctionalColor.cjs.js"),C=require("../../../common/enums/NeonDropdownStyle.cjs.js"),b=require("../badge/NeonBadge.vue.cjs.js"),q=require("../../user-input/button/NeonButton.vue.cjs.js"),B=require("../expansion-indicator/NeonExpansionIndicator.vue.cjs.js"),L=n.defineComponent({name:"NeonDropdown",components:{NeonBadge:b,NeonButton:q,NeonExpansionIndicator:B},props:{id:{type:String},modelValue:{type:Boolean,required:!0},label:{type:String,default:null},image:{type:String,default:null},imageAlt:{type:String,default:null},icon:{type:String,default:null},iconAriaLabel:{type:String},indicator:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{type:String,default:g.NeonSize.Medium},color:{type:String,default:N.NeonFunctionalColor.LowContrast},alternateColor:{type:String,default:null},dropdownStyle:{type:String,default:C.NeonDropdownStyle.SolidButton},placement:{type:String,default:w.NeonDropdownPlacement.BottomLeft},placementContainer:{type:Object,default:null},openOnHover:{type:Boolean,default:!1}},emits:["update:modelValue","dropdown-placement","blur","focus"
|
|
1
|
+
"use strict";const n=require("vue"),w=require("../../../common/enums/NeonDropdownPlacement.cjs.js"),y=require("../../../common/utils/NeonDropdownPlacementUtils.cjs.js"),S=require("../../../common/utils/NeonClosableUtils.cjs.js"),g=require("../../../common/enums/NeonSize.cjs.js"),N=require("../../../common/enums/NeonFunctionalColor.cjs.js"),C=require("../../../common/enums/NeonDropdownStyle.cjs.js"),b=require("../badge/NeonBadge.vue.cjs.js"),q=require("../../user-input/button/NeonButton.vue.cjs.js"),B=require("../expansion-indicator/NeonExpansionIndicator.vue.cjs.js"),L=n.defineComponent({name:"NeonDropdown",components:{NeonBadge:b,NeonButton:q,NeonExpansionIndicator:B},props:{id:{type:String},modelValue:{type:Boolean,required:!0},label:{type:String,default:null},image:{type:String,default:null},imageAlt:{type:String,default:null},icon:{type:String,default:null},iconAriaLabel:{type:String},indicator:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{type:String,default:g.NeonSize.Medium},color:{type:String,default:N.NeonFunctionalColor.LowContrast},alternateColor:{type:String,default:null},dropdownStyle:{type:String,default:C.NeonDropdownStyle.SolidButton},placement:{type:String,default:w.NeonDropdownPlacement.BottomLeft},placementContainer:{type:Object,default:null},openOnHover:{type:Boolean,default:!1}},emits:["update:modelValue","dropdown-placement","blur","focus"],setup(e,{emit:l,expose:s}){const i=n.ref(null),o=n.ref(null),a=n.ref(e.placement),r=n.ref(null),d=()=>{l("update:modelValue",!1)},c=()=>{e.modelValue&&d()},t=()=>{if(e.modelValue&&i.value&&o.value){const u=a.value;a.value=y.NeonDropdownPlacementUtils.calculatePlacement(i.value,o.value,e.placement,e.placementContainer),u!==a.value&&l("dropdown-placement",a.value)}},m=()=>{!e.disabled&&!e.openOnHover&&(l("update:modelValue",!e.modelValue),setTimeout(t))},f=n.computed(()=>{var u;return((u=e.dropdownStyle)==null?void 0:u.indexOf("badge"))===-1}),p=()=>{l("blur")},v=()=>{l("focus")};return n.onMounted(()=>{!e.openOnHover&&o.value&&(r.value=new S.NeonClosableUtils(o.value,c)),window.addEventListener("resize",t,{passive:!0}),window.addEventListener("scroll",t,{passive:!0}),e.placementContainer&&e.placementContainer.addEventListener("scroll",t,{passive:!0})}),n.onUnmounted(()=>{e.openOnHover||r.value&&r.value.destroy(),window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.placementContainer&&e.placementContainer.removeEventListener("scroll",t)}),s({dropdownContent:o}),{dropdownButton:i,dropdownContent:o,dropdownPlacement:a,closableUtils:r,isButtonStyle:f,onClose:d,close:c,toggleOpen:m,onBlur:p,onFocus:v}}});module.exports=L;
|
|
2
2
|
//# sourceMappingURL=NeonDropdown.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDropdown.cjs.js","sources":["../../../../src/components/presentation/dropdown/NeonDropdown.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonDropdownPlacementUtils } from '@/common/utils/NeonDropdownPlacementUtils';\nimport { NeonClosableUtils } from '@/common/utils/NeonClosableUtils';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonDropdownStyle } from '@/common/enums/NeonDropdownStyle';\nimport NeonBadge from '@/components/presentation/badge/NeonBadge.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonExpansionIndicator from '@/components/presentation/expansion-indicator/NeonExpansionIndicator.vue';\n\n/**\n * <p>A general purpose dropdown component. This component consists of a button, to trigger the dropdown to open, and\n * the dropdown content which is displayed above the page when the user clicks the button.</p>\n * <p>This can be useful for secondary (perhaps more complex) actions for which there is not enough space on the page or\n * the action is asynchronous allowing the user to perform the action and continue what they were doing. Examples are\n * providing links to copy and letting the user send feedback.</p>\n * <p><strong>NeonDropdown</strong> is the basis for the <strong>NeonDropdownMenu</strong> component and the\n * <strong>NeonSelect</strong> form component.</p>\n */\nexport default defineComponent({\n name: 'NeonDropdown',\n components: {\n NeonBadge,\n NeonButton,\n NeonExpansionIndicator,\n },\n props: {\n /**\n * Id for the dropdown button.\n */\n id: { type: String },\n /**\n * Whether the dropdown is currently open.\n */\n modelValue: { type: Boolean, required: true },\n /**\n * The label for the dropdown button.\n */\n label: { type: String, default: null },\n /**\n * URL of image to display if the button style is a square or circular badge.\n */\n image: { type: String, default: null },\n /**\n * Badge image ALT text.\n */\n imageAlt: { type: String, default: null },\n /**\n * An icon to display on the dropdown button. This will be to the left of any label, but can also be used on its own.\n */\n icon: { type: String, default: null },\n /**\n * aria label of the button icon\n */\n iconAriaLabel: { type: String },\n /**\n * Show the dropdown button's indicator (chevron).\n */\n indicator: { type: Boolean, default: true },\n /**\n * Disable the dropdown button\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown button - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the dropdown button\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n /**\n * The alternate color of the dropdown button (for gradient buttons).\n */\n alternateColor: { type: String as () => NeonFunctionalColor, default: null },\n /**\n * The style of the dropdown button\n */\n dropdownStyle: { type: String as () => NeonDropdownStyle, default: NeonDropdownStyle.SolidButton },\n /**\n * Placement of the dropdown contents.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Restrict placement to within this container.\n */\n placementContainer: { type: Object as () => HTMLElement, default: null },\n /**\n * Instead of opening on click (default), open on hover.\n */\n openOnHover: { type: Boolean, default: false },\n },\n emits: [\n /**\n * Emitted when the dropdown button is toggled.\n * @type {boolean} the open state of the dropdown.\n */\n 'update:modelValue',\n /**\n * Emitted on initialisation.\n * @type {NeonDropdownPlacement} the placement of the dropdown.\n */\n 'dropdown-placement',\n /**\n * Emitted when the dropdown button is blurred.\n * @type {void}\n */\n 'blur',\n /**\n * Emitted when the dropdown button is focussed.\n * @type {void}\n */\n 'focus',\n /**\n * emitted on initialisation\n * @type {HTMLElement} the reference to the HTMLElement for the dropdown menu button.\n */\n 'button-ref',\n ],\n setup(props, { emit, expose }) {\n const dropdownButton = ref<HTMLElement | null>(null);\n const dropdownContent = ref<HTMLDivElement | null>(null);\n\n const dropdownPlacement = ref<NeonDropdownPlacement>(props.placement);\n const closableUtils = ref<NeonClosableUtils | null>(null);\n\n const onClose = () => {\n emit('update:modelValue', false);\n };\n\n const close = () => {\n if (props.modelValue) {\n onClose();\n }\n };\n\n const recalculatePlacement = () => {\n if (props.modelValue && dropdownButton.value && dropdownContent.value) {\n const previousValue = dropdownPlacement.value;\n dropdownPlacement.value = NeonDropdownPlacementUtils.calculatePlacement(\n dropdownButton.value,\n dropdownContent.value,\n props.placement,\n props.placementContainer,\n );\n\n if (previousValue !== dropdownPlacement.value) {\n emit('dropdown-placement', dropdownPlacement.value);\n }\n }\n };\n\n const toggleOpen = () => {\n if (!props.disabled && !props.openOnHover) {\n emit('update:modelValue', !props.modelValue);\n setTimeout(recalculatePlacement);\n }\n };\n\n const isButtonStyle = computed<boolean>(() => props.dropdownStyle?.indexOf('badge') === -1);\n\n const onBlur = () => {\n emit('blur');\n };\n\n const onFocus = () => {\n emit('focus');\n };\n\n onMounted(() => {\n if (!props.openOnHover && dropdownContent.value) {\n closableUtils.value = new NeonClosableUtils(dropdownContent.value, close);\n }\n window.addEventListener('resize', recalculatePlacement, { passive: true });\n window.addEventListener('scroll', recalculatePlacement, { passive: true });\n if (props.placementContainer) {\n props.placementContainer.addEventListener('scroll', recalculatePlacement, { passive: true });\n }\n });\n\n onUnmounted(() => {\n if (!props.openOnHover) {\n closableUtils.value && closableUtils.value.destroy();\n }\n window.removeEventListener('resize', recalculatePlacement);\n window.removeEventListener('scroll', recalculatePlacement);\n if (props.placementContainer) {\n props.placementContainer.removeEventListener('scroll', recalculatePlacement);\n }\n });\n\n watch(\n () => dropdownButton.value,\n (value) => emit('button-ref', value),\n { immediate: true },\n );\n\n expose({ dropdownContent });\n\n return {\n dropdownButton,\n dropdownContent,\n dropdownPlacement,\n closableUtils,\n isButtonStyle,\n onClose,\n close,\n toggleOpen,\n onBlur,\n onFocus,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonBadge","NeonButton","NeonExpansionIndicator","NeonSize","NeonFunctionalColor","NeonDropdownStyle","NeonDropdownPlacement","props","emit","expose","dropdownButton","ref","dropdownContent","dropdownPlacement","closableUtils","onClose","close","recalculatePlacement","previousValue","NeonDropdownPlacementUtils","toggleOpen","isButtonStyle","computed","_a","onBlur","onFocus","onMounted","NeonClosableUtils","onUnmounted","watch","value"],"mappings":"8jBAoBAA,EAAeC,kBAAgB,CAC7B,KA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nB,CACL,eAAAF,EACA,gBAAAE,EACA,kBAAAC,EACA,cAAAC,EACA,cAAAO,EACA,QAAAN,EACA,MAAAC,EACA,WAAAI,EACA,OAAAI,EACA,QAAAC,CAAA,CAEJ,CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"NeonDropdown.cjs.js","sources":["../../../../src/components/presentation/dropdown/NeonDropdown.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref } from 'vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonDropdownPlacementUtils } from '@/common/utils/NeonDropdownPlacementUtils';\nimport { NeonClosableUtils } from '@/common/utils/NeonClosableUtils';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonDropdownStyle } from '@/common/enums/NeonDropdownStyle';\nimport NeonBadge from '@/components/presentation/badge/NeonBadge.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonExpansionIndicator from '@/components/presentation/expansion-indicator/NeonExpansionIndicator.vue';\n\n/**\n * <p>A general purpose dropdown component. This component consists of a button, to trigger the dropdown to open, and\n * the dropdown content which is displayed above the page when the user clicks the button.</p>\n * <p>This can be useful for secondary (perhaps more complex) actions for which there is not enough space on the page or\n * the action is asynchronous allowing the user to perform the action and continue what they were doing. Examples are\n * providing links to copy and letting the user send feedback.</p>\n * <p><strong>NeonDropdown</strong> is the basis for the <strong>NeonDropdownMenu</strong> component and the\n * <strong>NeonSelect</strong> form component.</p>\n */\nexport default defineComponent({\n name: 'NeonDropdown',\n components: {\n NeonBadge,\n NeonButton,\n NeonExpansionIndicator,\n },\n props: {\n /**\n * Id for the dropdown button.\n */\n id: { type: String },\n /**\n * Whether the dropdown is currently open.\n */\n modelValue: { type: Boolean, required: true },\n /**\n * The label for the dropdown button.\n */\n label: { type: String, default: null },\n /**\n * URL of image to display if the button style is a square or circular badge.\n */\n image: { type: String, default: null },\n /**\n * Badge image ALT text.\n */\n imageAlt: { type: String, default: null },\n /**\n * An icon to display on the dropdown button. This will be to the left of any label, but can also be used on its own.\n */\n icon: { type: String, default: null },\n /**\n * aria label of the button icon\n */\n iconAriaLabel: { type: String },\n /**\n * Show the dropdown button's indicator (chevron).\n */\n indicator: { type: Boolean, default: true },\n /**\n * Disable the dropdown button\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown button - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the dropdown button\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n /**\n * The alternate color of the dropdown button (for gradient buttons).\n */\n alternateColor: { type: String as () => NeonFunctionalColor, default: null },\n /**\n * The style of the dropdown button\n */\n dropdownStyle: { type: String as () => NeonDropdownStyle, default: NeonDropdownStyle.SolidButton },\n /**\n * Placement of the dropdown contents.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Restrict placement to within this container.\n */\n placementContainer: { type: Object as () => HTMLElement, default: null },\n /**\n * Instead of opening on click (default), open on hover.\n */\n openOnHover: { type: Boolean, default: false },\n },\n emits: [\n /**\n * Emitted when the dropdown button is toggled.\n * @type {boolean} the open state of the dropdown.\n */\n 'update:modelValue',\n /**\n * Emitted on initialisation.\n * @type {NeonDropdownPlacement} the placement of the dropdown.\n */\n 'dropdown-placement',\n /**\n * Emitted when the dropdown button is blurred.\n * @type {void}\n */\n 'blur',\n /**\n * Emitted when the dropdown button is focussed.\n * @type {void}\n */\n 'focus',\n ],\n setup(props, { emit, expose }) {\n const dropdownButton = ref<HTMLElement | null>(null);\n const dropdownContent = ref<HTMLDivElement | null>(null);\n\n const dropdownPlacement = ref<NeonDropdownPlacement>(props.placement);\n const closableUtils = ref<NeonClosableUtils | null>(null);\n\n const onClose = () => {\n emit('update:modelValue', false);\n };\n\n const close = () => {\n if (props.modelValue) {\n onClose();\n }\n };\n\n const recalculatePlacement = () => {\n if (props.modelValue && dropdownButton.value && dropdownContent.value) {\n const previousValue = dropdownPlacement.value;\n dropdownPlacement.value = NeonDropdownPlacementUtils.calculatePlacement(\n dropdownButton.value,\n dropdownContent.value,\n props.placement,\n props.placementContainer,\n );\n\n if (previousValue !== dropdownPlacement.value) {\n emit('dropdown-placement', dropdownPlacement.value);\n }\n }\n };\n\n const toggleOpen = () => {\n if (!props.disabled && !props.openOnHover) {\n emit('update:modelValue', !props.modelValue);\n setTimeout(recalculatePlacement);\n }\n };\n\n const isButtonStyle = computed<boolean>(() => props.dropdownStyle?.indexOf('badge') === -1);\n\n const onBlur = () => {\n emit('blur');\n };\n\n const onFocus = () => {\n emit('focus');\n };\n\n onMounted(() => {\n if (!props.openOnHover && dropdownContent.value) {\n closableUtils.value = new NeonClosableUtils(dropdownContent.value, close);\n }\n window.addEventListener('resize', recalculatePlacement, { passive: true });\n window.addEventListener('scroll', recalculatePlacement, { passive: true });\n if (props.placementContainer) {\n props.placementContainer.addEventListener('scroll', recalculatePlacement, { passive: true });\n }\n });\n\n onUnmounted(() => {\n if (!props.openOnHover) {\n closableUtils.value && closableUtils.value.destroy();\n }\n window.removeEventListener('resize', recalculatePlacement);\n window.removeEventListener('scroll', recalculatePlacement);\n if (props.placementContainer) {\n props.placementContainer.removeEventListener('scroll', recalculatePlacement);\n }\n });\n\n expose({ dropdownContent });\n\n return {\n dropdownButton,\n dropdownContent,\n dropdownPlacement,\n closableUtils,\n isButtonStyle,\n onClose,\n close,\n toggleOpen,\n onBlur,\n onFocus,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonBadge","NeonButton","NeonExpansionIndicator","NeonSize","NeonFunctionalColor","NeonDropdownStyle","NeonDropdownPlacement","props","emit","expose","dropdownButton","ref","dropdownContent","dropdownPlacement","closableUtils","onClose","close","recalculatePlacement","previousValue","NeonDropdownPlacementUtils","toggleOpen","isButtonStyle","computed","_a","onBlur","onFocus","onMounted","NeonClosableUtils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ACA,cAAAO,EACA,QAAAN,EACA,MAAAC,EACA,WAAAI,EACA,OAAAI,EACA,QAAAC,CAAA,CAEJ,CACF,CAAC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as w, ref as i, computed as y, onMounted as g, onUnmounted as S
|
|
2
|
-
import { NeonDropdownPlacement as
|
|
1
|
+
import { defineComponent as w, ref as i, computed as y, onMounted as g, onUnmounted as S } from "vue";
|
|
2
|
+
import { NeonDropdownPlacement as C } from "../../../common/enums/NeonDropdownPlacement.es.js";
|
|
3
3
|
import { NeonDropdownPlacementUtils as B } from "../../../common/utils/NeonDropdownPlacementUtils.es.js";
|
|
4
|
-
import { NeonClosableUtils as
|
|
5
|
-
import { NeonSize as
|
|
6
|
-
import { NeonFunctionalColor as
|
|
7
|
-
import { NeonDropdownStyle as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
4
|
+
import { NeonClosableUtils as b } from "../../../common/utils/NeonClosableUtils.es.js";
|
|
5
|
+
import { NeonSize as N } from "../../../common/enums/NeonSize.es.js";
|
|
6
|
+
import { NeonFunctionalColor as L } from "../../../common/enums/NeonFunctionalColor.es.js";
|
|
7
|
+
import { NeonDropdownStyle as V } from "../../../common/enums/NeonDropdownStyle.es.js";
|
|
8
|
+
import E from "../badge/NeonBadge.vue.es.js";
|
|
9
|
+
import O from "../../user-input/button/NeonButton.vue.es.js";
|
|
10
|
+
import P from "../expansion-indicator/NeonExpansionIndicator.vue.es.js";
|
|
11
11
|
const q = w({
|
|
12
12
|
name: "NeonDropdown",
|
|
13
13
|
components: {
|
|
14
|
-
NeonBadge:
|
|
15
|
-
NeonButton:
|
|
16
|
-
NeonExpansionIndicator:
|
|
14
|
+
NeonBadge: E,
|
|
15
|
+
NeonButton: O,
|
|
16
|
+
NeonExpansionIndicator: P
|
|
17
17
|
},
|
|
18
18
|
props: {
|
|
19
19
|
/**
|
|
@@ -55,11 +55,11 @@ const q = w({
|
|
|
55
55
|
/**
|
|
56
56
|
* The size of the dropdown button - Small, Medium or Large.
|
|
57
57
|
*/
|
|
58
|
-
size: { type: String, default:
|
|
58
|
+
size: { type: String, default: N.Medium },
|
|
59
59
|
/**
|
|
60
60
|
* The color of the dropdown button
|
|
61
61
|
*/
|
|
62
|
-
color: { type: String, default:
|
|
62
|
+
color: { type: String, default: L.LowContrast },
|
|
63
63
|
/**
|
|
64
64
|
* The alternate color of the dropdown button (for gradient buttons).
|
|
65
65
|
*/
|
|
@@ -67,11 +67,11 @@ const q = w({
|
|
|
67
67
|
/**
|
|
68
68
|
* The style of the dropdown button
|
|
69
69
|
*/
|
|
70
|
-
dropdownStyle: { type: String, default:
|
|
70
|
+
dropdownStyle: { type: String, default: V.SolidButton },
|
|
71
71
|
/**
|
|
72
72
|
* Placement of the dropdown contents.
|
|
73
73
|
*/
|
|
74
|
-
placement: { type: String, default:
|
|
74
|
+
placement: { type: String, default: C.BottomLeft },
|
|
75
75
|
/**
|
|
76
76
|
* Restrict placement to within this container.
|
|
77
77
|
*/
|
|
@@ -101,51 +101,42 @@ const q = w({
|
|
|
101
101
|
* Emitted when the dropdown button is focussed.
|
|
102
102
|
* @type {void}
|
|
103
103
|
*/
|
|
104
|
-
"focus"
|
|
105
|
-
/**
|
|
106
|
-
* emitted on initialisation
|
|
107
|
-
* @type {HTMLElement} the reference to the HTMLElement for the dropdown menu button.
|
|
108
|
-
*/
|
|
109
|
-
"button-ref"
|
|
104
|
+
"focus"
|
|
110
105
|
],
|
|
111
|
-
setup(e, { emit:
|
|
112
|
-
const
|
|
113
|
-
|
|
106
|
+
setup(e, { emit: o, expose: c }) {
|
|
107
|
+
const u = i(null), n = i(null), l = i(e.placement), a = i(null), d = () => {
|
|
108
|
+
o("update:modelValue", !1);
|
|
114
109
|
}, m = () => {
|
|
115
110
|
e.modelValue && d();
|
|
116
111
|
}, t = () => {
|
|
117
|
-
if (e.modelValue &&
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
if (e.modelValue && u.value && n.value) {
|
|
113
|
+
const r = l.value;
|
|
114
|
+
l.value = B.calculatePlacement(
|
|
115
|
+
u.value,
|
|
116
|
+
n.value,
|
|
122
117
|
e.placement,
|
|
123
118
|
e.placementContainer
|
|
124
|
-
),
|
|
119
|
+
), r !== l.value && o("dropdown-placement", l.value);
|
|
125
120
|
}
|
|
126
121
|
}, s = () => {
|
|
127
|
-
!e.disabled && !e.openOnHover && (
|
|
122
|
+
!e.disabled && !e.openOnHover && (o("update:modelValue", !e.modelValue), setTimeout(t));
|
|
128
123
|
}, f = y(() => {
|
|
129
|
-
var
|
|
130
|
-
return ((
|
|
124
|
+
var r;
|
|
125
|
+
return ((r = e.dropdownStyle) == null ? void 0 : r.indexOf("badge")) === -1;
|
|
131
126
|
}), p = () => {
|
|
132
|
-
|
|
127
|
+
o("blur");
|
|
133
128
|
}, v = () => {
|
|
134
|
-
|
|
129
|
+
o("focus");
|
|
135
130
|
};
|
|
136
131
|
return g(() => {
|
|
137
|
-
!e.openOnHover &&
|
|
132
|
+
!e.openOnHover && n.value && (a.value = new b(n.value, m)), window.addEventListener("resize", t, { passive: !0 }), window.addEventListener("scroll", t, { passive: !0 }), e.placementContainer && e.placementContainer.addEventListener("scroll", t, { passive: !0 });
|
|
138
133
|
}), S(() => {
|
|
139
|
-
e.openOnHover ||
|
|
140
|
-
}),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
dropdownButton: r,
|
|
146
|
-
dropdownContent: o,
|
|
147
|
-
dropdownPlacement: a,
|
|
148
|
-
closableUtils: u,
|
|
134
|
+
e.openOnHover || a.value && a.value.destroy(), window.removeEventListener("resize", t), window.removeEventListener("scroll", t), e.placementContainer && e.placementContainer.removeEventListener("scroll", t);
|
|
135
|
+
}), c({ dropdownContent: n }), {
|
|
136
|
+
dropdownButton: u,
|
|
137
|
+
dropdownContent: n,
|
|
138
|
+
dropdownPlacement: l,
|
|
139
|
+
closableUtils: a,
|
|
149
140
|
isButtonStyle: f,
|
|
150
141
|
onClose: d,
|
|
151
142
|
close: m,
|