@vue-interface/dropdown-menu 2.0.0-beta.2 → 2.0.0-beta.20

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.
@@ -0,0 +1,52 @@
1
+ import { openBlock as n, createElementBlock as t, renderSlot as r, defineComponent as l, createElementVNode as _, normalizeClass as i } from "vue";
2
+ const d = (o, e) => {
3
+ const s = o.__vccOpts || o;
4
+ for (const [c, a] of e)
5
+ s[c] = a;
6
+ return s;
7
+ }, p = {}, f = { class: "dropdown-header" };
8
+ function u(o, e) {
9
+ return n(), t("h3", f, [
10
+ r(o.$slots, "default")
11
+ ]);
12
+ }
13
+ const k = /* @__PURE__ */ d(p, [["render", u]]), m = {}, h = { class: "dropdown-item" };
14
+ function w(o, e) {
15
+ return n(), t("div", h, [
16
+ r(o.$slots, "default")
17
+ ]);
18
+ }
19
+ const B = /* @__PURE__ */ d(m, [["render", w]]), $ = {}, g = { class: "dropdown-item-text" };
20
+ function v(o, e) {
21
+ return n(), t("div", g, [
22
+ r(o.$slots, "default")
23
+ ]);
24
+ }
25
+ const C = /* @__PURE__ */ d($, [["render", v]]), D = { class: "dropdown" }, b = ["aria-labelledby"], E = /* @__PURE__ */ l({
26
+ __name: "DropdownMenu",
27
+ props: {
28
+ align: {},
29
+ show: { type: Boolean }
30
+ },
31
+ setup(o) {
32
+ return (e, s) => (n(), t("div", D, [
33
+ _("div", {
34
+ class: i(["dropdown-menu", {
35
+ "dropdown-menu-left": e.align === "left",
36
+ "dropdown-menu-right": e.align === "right",
37
+ show: e.show
38
+ }]),
39
+ "aria-labelledby": e.$attrs.id
40
+ }, [
41
+ r(e.$slots, "default")
42
+ ], 10, b)
43
+ ]));
44
+ }
45
+ });
46
+ export {
47
+ k as DropdownHeader,
48
+ B as DropdownItem,
49
+ C as DropdownItemText,
50
+ E as DropdownMenu
51
+ };
52
+ //# sourceMappingURL=dropdown-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-menu.js","sources":["../src/DropdownHeader.vue","../src/DropdownItem.vue","../src/DropdownItemText.vue"],"sourcesContent":["<template>\n <h3 class=\"dropdown-header\">\n <slot />\n </h3>\n</template>","<template>\n <div class=\"dropdown-item\">\n <slot />\n </div>\n</template>","<template>\n <div class=\"dropdown-item-text\">\n <slot />\n </div>\n</template>"],"names":["_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_hoisted_1"],"mappings":";;;;;;;AACI,SAAAA,EAAAC,GAAAC,GAAA;SACYC,EAAA,GAAAC,EAAA,MAAAC,GAAA;AAAA;;;;ACDZ,SAAAL,EAAAC,GAAAC,GAAA;SACYC,EAAA,GAAAC,EAAA,OAAAC,GAAA;AAAA;;;;ACDZ,SAAAL,EAAAC,GAAAC,GAAA;SACYC,EAAA,GAAAC,EAAA,OAAAC,GAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ (function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.DropdownMenu={},o.Vue))})(this,function(o,e){"use strict";const r=(t,n)=>{const d=t.__vccOpts||t;for(const[D,y]of n)d[D]=y;return d},s={},c={class:"dropdown-header"};function l(t,n){return e.openBlock(),e.createElementBlock("h3",c,[e.renderSlot(t.$slots,"default")])}const i=r(s,[["render",l]]),a={},p={class:"dropdown-item"};function _(t,n){return e.openBlock(),e.createElementBlock("div",p,[e.renderSlot(t.$slots,"default")])}const f=r(a,[["render",_]]),m={},h={class:"dropdown-item-text"};function u(t,n){return e.openBlock(),e.createElementBlock("div",h,[e.renderSlot(t.$slots,"default")])}const w=r(m,[["render",u]]),$={class:"dropdown"},k=["aria-labelledby"],B=e.defineComponent({__name:"DropdownMenu",props:{align:{},show:{type:Boolean}},setup(t){return(n,d)=>(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("div",{class:e.normalizeClass(["dropdown-menu",{"dropdown-menu-left":n.align==="left","dropdown-menu-right":n.align==="right",show:n.show}]),"aria-labelledby":n.$attrs.id},[e.renderSlot(n.$slots,"default")],10,k)]))}});o.DropdownHeader=i,o.DropdownItem=f,o.DropdownItemText=w,o.DropdownMenu=B,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=dropdown-menu.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-menu.umd.cjs","sources":["../src/DropdownHeader.vue","../src/DropdownItem.vue","../src/DropdownItemText.vue"],"sourcesContent":["<template>\n <h3 class=\"dropdown-header\">\n <slot />\n </h3>\n</template>","<template>\n <div class=\"dropdown-item\">\n <slot />\n </div>\n</template>","<template>\n <div class=\"dropdown-item-text\">\n <slot />\n </div>\n</template>"],"names":["_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_hoisted_1"],"mappings":"6WACI,SAAAA,EAAAC,EAAAC,EAAA,QACYC,YAAA,EAAAC,qBAAA,KAAAC,EAAA,+FCDZ,SAAAL,EAAAC,EAAAC,EAAA,QACYC,YAAA,EAAAC,qBAAA,MAAAC,EAAA,oGCDZ,SAAAL,EAAAC,EAAAC,EAAA,QACYC,YAAA,EAAAC,qBAAA,MAAAC,EAAA"}
@@ -0,0 +1,5 @@
1
+ import DropdownHeader from './src/DropdownHeader.vue';
2
+ import DropdownItem from './src/DropdownItem.vue';
3
+ import DropdownItemText from './src/DropdownItemText.vue';
4
+ import DropdownMenu from './src/DropdownMenu.vue';
5
+ export { DropdownHeader, DropdownItem, DropdownItemText, DropdownMenu };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
2
+ default?(_: {}): any;
3
+ }>;
4
+ export default _default;
5
+ type __VLS_WithTemplateSlots<T, S> = T & {
6
+ new (): {
7
+ $slots: S;
8
+ };
9
+ };
@@ -0,0 +1,9 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
2
+ default?(_: {}): any;
3
+ }>;
4
+ export default _default;
5
+ type __VLS_WithTemplateSlots<T, S> = T & {
6
+ new (): {
7
+ $slots: S;
8
+ };
9
+ };
@@ -0,0 +1,9 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
2
+ default?(_: {}): any;
3
+ }>;
4
+ export default _default;
5
+ type __VLS_WithTemplateSlots<T, S> = T & {
6
+ new (): {
7
+ $slots: S;
8
+ };
9
+ };
@@ -0,0 +1,22 @@
1
+ export type DropdownMenuProps = {
2
+ align: 'left' | 'right';
3
+ show?: boolean;
4
+ };
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<DropdownMenuProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DropdownMenuProps>>>, {}, {}>, {
6
+ default?(_: {}): any;
7
+ }>;
8
+ export default _default;
9
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
+ type __VLS_TypePropsToRuntimeProps<T> = {
11
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
12
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
+ } : {
14
+ type: import('vue').PropType<T[K]>;
15
+ required: true;
16
+ };
17
+ };
18
+ type __VLS_WithTemplateSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,4 @@
1
+ declare const DropdownMenuItems: (props: any, context: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ [key: string]: any;
3
+ }>;
4
+ export default DropdownMenuItems;
package/package.json CHANGED
@@ -1,25 +1,29 @@
1
1
  {
2
2
  "name": "@vue-interface/dropdown-menu",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.20",
4
4
  "description": "A Vue dropdown menu component.",
5
5
  "files": [
6
- "index.js",
7
6
  "dist",
8
- "src",
9
7
  "tailwindcss"
10
8
  ],
11
- "main": "./dist/dropdown-menu.umd.js",
12
- "module": "./index.js",
9
+ "type": "module",
10
+ "main": "./dist/dropdown-menu.umd.cjs",
11
+ "module": "./dist/dropdown-menu.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/dropdown-menu.js",
16
+ "require": "./dist/dropdown-menu.umd.cjs",
17
+ "types": "./dist/index.d.ts"
18
+ },
19
+ "./tailwindcss": "./tailwindcss/index.cjs",
20
+ "./tailwindcss/safelist": "./tailwindcss/safelist.cjs"
21
+ },
13
22
  "browserslist": "last 2 versions, > 0.5%, ie >= 11",
14
23
  "scripts": {
15
24
  "dev": "vite",
16
- "build": "vite build",
17
- "preview": "vite preview",
18
- "pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
19
- "release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
20
- "release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
21
- "release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
22
- "release": "git add . -A; git commit; git push --tags origin; npm publish;"
25
+ "build": "vite build && vue-tsc",
26
+ "preview": "vite preview"
23
27
  },
24
28
  "repository": {
25
29
  "type": "git",
@@ -39,27 +43,30 @@
39
43
  "url": "https://github.com/vue-interface/dropdown-menu/issues"
40
44
  },
41
45
  "homepage": "https://github.com/vue-interface/dropdown-menu",
42
- "dependencies": {
43
- "@vue-interface/variant": "^2.0.0-beta.0",
44
- "color": "^4.2.0"
45
- },
46
46
  "peerDependencies": {
47
- "vue": "^3.0.0"
47
+ "vue": "^3.3.4"
48
48
  },
49
49
  "devDependencies": {
50
- "@rollup/plugin-babel": "^6.0.0",
51
- "@vitejs/plugin-vue": "^3.1.2",
52
- "autoprefixer": "^10.4.12",
53
- "babel-eslint": "^10.1.0",
54
- "babel-preset-vue": "^2.0.2",
50
+ "@commitlint/config-conventional": "^17.7.0",
51
+ "@semantic-release/changelog": "^6.0.3",
52
+ "@semantic-release/git": "^10.0.1",
53
+ "@semantic-release/npm": "^10.0.5",
54
+ "@vitejs/plugin-vue": "^4.3.2",
55
+ "@vue-interface/eslint-config": "^1.0.0-beta.0",
56
+ "autoprefixer": "^10.4.15",
55
57
  "change-case": "^4.1.2",
56
- "eslint": "^8.25.0",
57
- "eslint-plugin-vue": "^9.6.0",
58
+ "commitlint": "^17.7.1",
59
+ "dotenv": "^16.3.1",
60
+ "eslint": "^8.47.0",
61
+ "eslint-plugin-tailwindcss": "^3.13.0",
62
+ "husky": "^8.0.3",
58
63
  "pascalcase": "^2.0.0",
59
- "postcss": "^8.4.18",
60
- "tailwindcss": "^3.1.8",
61
- "vite": "^3.1.7",
62
- "vue": "^3.2.40",
63
- "vue-router": "^4.1.5"
64
+ "postcss": "^8.4.6",
65
+ "semantic-release": "^21.0.7",
66
+ "tailwindcss": "^3.3.3",
67
+ "typescript": "^5.2.2",
68
+ "vite": "^4.4.9",
69
+ "vue": "^3.3.4",
70
+ "vue-tsc": "^1.8.8"
64
71
  }
65
72
  }
@@ -0,0 +1,136 @@
1
+ const plugin = require('tailwindcss/plugin');
2
+ const colors = require('tailwindcss/colors');
3
+
4
+ module.exports = plugin(function({ addComponents, theme }) {
5
+ addComponents(theme('dropdownMenu.css'));
6
+ }, {
7
+ theme: {
8
+ dropdownMenu: theme => ({
9
+ css: {
10
+ // The dropdown menu
11
+ '.dropdown-menu': {
12
+ position: 'absolute',
13
+ top: '100%',
14
+ left: 0,
15
+ zIndex: 1000,
16
+ display: 'none', // none by default, but block on "open" of the menu
17
+ minWidth: '10rem',
18
+ padding: '.5rem 0',
19
+ // margin: `${theme('dropdownMenu.spacer')} 0 0`, // override default ul
20
+ fontSize: '1rem',
21
+ // color: 'inherit',
22
+ textAlign: 'left', // Ensures proper alignment if parent has it changed (e.g., modal footer)
23
+ listStyle: 'none',
24
+ backgroundColor: colors.white,
25
+ backgroundClip: 'padding-box',
26
+ border: `1px solid ${colors.neutral[400]}`,
27
+ borderRadius: '.25rem',
28
+ boxShadow: '0 .25rem 1rem rgba(0, 0, 0, .5)',
29
+
30
+ '@apply dark:bg-neutral-800': {},
31
+ '@apply dark:border-neutral-700': {},
32
+
33
+ // The dropdown wrapper (`<div>`)
34
+ '.dropup:has(&), .dropright:has(&), .dropdown:has(&), .dropleft:has(&)': {
35
+ position: 'relative'
36
+ },
37
+
38
+ // When enabled Popper.js, reset basic dropdown position
39
+ // stylelint-disable-next-line no-duplicate-selectors
40
+ '&[x-placement^="top"], &[x-placement^="right"], &[x-placement^="bottom"], &[x-placement^="left"]': {
41
+ right: 'auto',
42
+ bottom: 'auto'
43
+ },
44
+
45
+ // Links, buttons, and more within the dropdown menu
46
+ //
47
+ // `<button>`-specific styles are denoted with `// For <button>s`
48
+ '.dropdown-item, & > :not(hr, .dropdown-header, .dropdown-item-text, .dropdown-item-plain, .dropdown-divider)': {
49
+ display: 'flex',
50
+ width: '100%', // For `<button>`s
51
+ padding: '.25rem 1rem',
52
+ clear: 'both',
53
+ fontWeight: 'normal',
54
+ color: theme('colors.neutral.800', colors.neutral[800]),
55
+ textAlign: 'inherit', // For `<button>`s
56
+ textDecoration: 'none',
57
+ whiteSpace: 'nowrap', // prevent links from randomly breaking onto new lines
58
+ backgroundColor: 'transparent', // For `<button>`s
59
+ border: 0, // For `<button>`s
60
+
61
+ '@apply dark:text-neutral-300': {},
62
+
63
+ '&:hover, &:focus': {
64
+ color: theme('colors.neutral.800', colors.neutral[900]),
65
+ textDecoration: 'none',
66
+ backgroundColor: theme('colors.neutral.100', colors.neutral[100]),
67
+
68
+ '@apply dark:bg-neutral-600 dark:text-neutral-200': {}
69
+ },
70
+
71
+ '&.active, &:active': {
72
+ color: theme('colors.white', colors.white),
73
+ textDecoration: 'none',
74
+ backgroundColor: theme('variations.primary', colors.blue[500]),
75
+
76
+ '@apply dark:bg-blue-500 dark:text-neutral-200': {}
77
+ },
78
+
79
+ '&.disabled, &:disabled': {
80
+ color: theme('colors.neutral.500', colors.neutral[500]),
81
+ pointerEvents: 'none',
82
+ backgroundColor: 'transparent',
83
+ backgroundImage: 'none'
84
+ },
85
+ },
86
+
87
+ // Dropdown section headers
88
+ '.dropdown-header, & > h1, & > h2, & > h3, & > h4, & > h5, & > h6': {
89
+ display: 'block',
90
+ padding: '.5rem',
91
+ marginBottom: 0, // for use with heading elements
92
+ fontSize: '.875rem',
93
+ fontWeight: 'bold',
94
+ color: theme('colors.neutral.500', colors.neutral[500]),
95
+ whiteSpace: 'nowrap', // as with > li > a
96
+
97
+ '@apply dark:text-neutral-400': {},
98
+ },
99
+
100
+ // Dividers (basically an `<hr>`) within the dropdown
101
+ '.dropdown-divider, & > hr': {
102
+ height: 0,
103
+ margin: 'calc(.125rem / 2) 0',
104
+ overflow: 'hidden',
105
+ borderTop: `1px solid ${theme('colors.neutral.200', colors.neutral[200])}`,
106
+
107
+ '@apply dark:border-neutral-700': {},
108
+ },
109
+
110
+ // Dropdown text
111
+ '.dropdown-item-text': {
112
+ display: 'block',
113
+ padding: '.25rem 1rem',
114
+ color: theme('colors.neutral.800', colors.neutral[800]),
115
+
116
+ '@apply dark:text-neutral-200': {},
117
+ },
118
+
119
+ '&.show': {
120
+ display: 'inline-block'
121
+ },
122
+
123
+ '&.dropdown-menu-left': {
124
+ right: 'auto',
125
+ left: 0
126
+ },
127
+
128
+ '&.dropdown-menu-right': {
129
+ right: 0,
130
+ left: 'auto'
131
+ }
132
+ }
133
+ }
134
+ })
135
+ }
136
+ });
@@ -1,71 +0,0 @@
1
- import { h as c, isVNode as d, resolveComponent as u, openBlock as m, createElementBlock as f, normalizeClass as w, createVNode as h, withCtx as _, renderSlot as g } from "vue";
2
- function s(e, t) {
3
- e.props.class = `${e.props.class || ""} ${t}`.trim();
4
- }
5
- function i(e, t) {
6
- return (o) => {
7
- typeof t == "function" && t(o), o.cancelBubble || e(o);
8
- };
9
- }
10
- function p(e, t) {
11
- return e.attrs.on[t] || e.type && e.type.listeners && e.componentOptions.listeners[t];
12
- }
13
- function b(e) {
14
- for (const t of e[0].children) {
15
- if (!d(t))
16
- continue;
17
- t.props = Object.assign({ class: void 0 }, t.props), t.attrs = Object.assign({}, t.attrs), t.attrs.on || (t.attrs.on = {});
18
- const o = t.props.class && t.props.class.match(/dropdown-item/), r = t.props.class && t.props.class.match(/dropdown-divider/);
19
- t.attrs.on.click = i((n) => {
20
- context.parent.$emit("click-item", n, t);
21
- }, p(t, "click")), t.attrs.on.blur = i((n) => {
22
- context.parent.$emit("blur-item", n, t);
23
- }, p(t, "blur")), typeof t.type == "string" && t.type.match(/^h\d$/) ? s(t, "dropdown-header") : t.type === "hr" && !r ? (t.type = "div", s(t, "dropdown-divider")) : !o && !r && s(t, "dropdown-item");
24
- }
25
- return e;
26
- }
27
- const y = (e, t) => c("div", {}, b(t.slots.default())), $ = y, k = (e, t) => {
28
- const o = e.__vccOpts || e;
29
- for (const [r, n] of t)
30
- o[r] = n;
31
- return o;
32
- }, C = {
33
- name: "DropdownMenu",
34
- components: {
35
- DropdownMenuItems: $
36
- },
37
- props: {
38
- align: {
39
- type: String,
40
- default: "left",
41
- validate(e) {
42
- return ["left", "right"].indexOf(e.toLowerCase()) !== -1;
43
- }
44
- },
45
- show: Boolean
46
- }
47
- }, v = ["aria-labelledby"];
48
- function D(e, t, o, r, n, I) {
49
- const l = u("dropdown-menu-items");
50
- return m(), f("div", {
51
- class: w(["dropdown-menu", {
52
- "dropdown-menu-left": o.align === "left",
53
- "dropdown-menu-right": o.align === "right",
54
- show: o.show
55
- }]),
56
- "aria-labelledby": e.$attrs.id
57
- }, [
58
- h(l, null, {
59
- default: _(() => [
60
- g(e.$slots, "default", {
61
- onClick: t[0] || (t[0] = (...a) => e.onItemClick && e.onItemClick(...a))
62
- })
63
- ]),
64
- _: 3
65
- })
66
- ], 10, v);
67
- }
68
- const O = /* @__PURE__ */ k(C, [["render", D]]);
69
- export {
70
- O as DropdownMenu
71
- };
@@ -1 +0,0 @@
1
- (function(s,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(s=typeof globalThis<"u"?globalThis:s||self,n(s.DropdownMenu={},s.Vue))})(this,function(s,n){"use strict";function d(t,e){t.props.class=`${t.props.class||""} ${e}`.trim()}function p(t,e){return o=>{typeof e=="function"&&e(o),o.cancelBubble||t(o)}}function l(t,e){return t.attrs.on[e]||t.type&&t.type.listeners&&t.componentOptions.listeners[e]}function c(t){for(const e of t[0].children){if(!n.isVNode(e))continue;e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const o=e.props.class&&e.props.class.match(/dropdown-item/),i=e.props.class&&e.props.class.match(/dropdown-divider/);e.attrs.on.click=p(r=>{context.parent.$emit("click-item",r,e)},l(e,"click")),e.attrs.on.blur=p(r=>{context.parent.$emit("blur-item",r,e)},l(e,"blur")),typeof e.type=="string"&&e.type.match(/^h\d$/)?d(e,"dropdown-header"):e.type==="hr"&&!i?(e.type="div",d(e,"dropdown-divider")):!o&&!i&&d(e,"dropdown-item")}return t}const a=(t,e)=>n.h("div",{},c(e.slots.default())),u=(t,e)=>{const o=t.__vccOpts||t;for(const[i,r]of e)o[i]=r;return o},f={name:"DropdownMenu",components:{DropdownMenuItems:a},props:{align:{type:String,default:"left",validate(t){return["left","right"].indexOf(t.toLowerCase())!==-1}},show:Boolean}},m=["aria-labelledby"];function w(t,e,o,i,r,g){const _=n.resolveComponent("dropdown-menu-items");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["dropdown-menu",{"dropdown-menu-left":o.align==="left","dropdown-menu-right":o.align==="right",show:o.show}]),"aria-labelledby":t.$attrs.id},[n.createVNode(_,null,{default:n.withCtx(()=>[n.renderSlot(t.$slots,"default",{onClick:e[0]||(e[0]=(...y)=>t.onItemClick&&t.onItemClick(...y))})]),_:3})],10,m)}const h=u(f,[["render",w]]);s.DropdownMenu=h,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- import DropdownMenu from './src/DropdownMenu.vue';
2
-
3
- export {
4
- DropdownMenu
5
- };
@@ -1,3 +0,0 @@
1
- <template>
2
- <hr class="dropdown-divider">
3
- </template>
@@ -1,5 +0,0 @@
1
- <template>
2
- <h3 class="dropdown-header">
3
- <slot />
4
- </h3>
5
- </template>
@@ -1,5 +0,0 @@
1
- <template>
2
- <div class="dropdown-item">
3
- <slot />
4
- </div>
5
- </template>
@@ -1,52 +0,0 @@
1
- <template>
2
- <div
3
- class="dropdown-menu"
4
- :aria-labelledby="$attrs.id"
5
- :class="{
6
- 'dropdown-menu-left': align === 'left',
7
- 'dropdown-menu-right': align === 'right',
8
- 'show': show
9
- }">
10
- <dropdown-menu-items>
11
- <slot @click="onItemClick" />
12
- </dropdown-menu-items>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- import DropdownMenuItems from './DropdownMenuItems.vue';
18
-
19
- export default {
20
-
21
- name: 'DropdownMenu',
22
-
23
- components: {
24
- DropdownMenuItems
25
- },
26
-
27
- props: {
28
-
29
- /**
30
- * Display the dropdown menu aligned left or right
31
- *
32
- * @property String
33
- */
34
- align: {
35
- type: String,
36
- default: 'left',
37
- validate(value) {
38
- return ['left', 'right'].indexOf(value.toLowerCase()) !== -1;
39
- }
40
- },
41
-
42
- /**
43
- * The default visibility of the dropdown menu.
44
- *
45
- * @property Object
46
- */
47
- show: Boolean
48
-
49
- }
50
-
51
- };
52
- </script>
@@ -1,80 +0,0 @@
1
- <script>
2
- import { h, isVNode } from 'vue';
3
-
4
- function appendClass(vnode, str) {
5
- vnode.props.class = `${vnode.props.class || ''} ${str}`.trim();
6
- }
7
-
8
- function wrap(wrapper, fn) {
9
- return (e) => {
10
- if(typeof fn === 'function') {
11
- fn(e);
12
- }
13
-
14
- if(!e.cancelBubble) {
15
- wrapper(e);
16
- }
17
- };
18
- }
19
-
20
- function listener(vnode, key) {
21
- return vnode.attrs.on[key] || (
22
- vnode.type &&
23
- vnode.type.listeners &&
24
- vnode.componentOptions.listeners[key]
25
- );
26
- }
27
- function isDropdownItem(vnode) {
28
- return vnode && vnode.type && vnode.type.name === 'DropdownItem';
29
- }
30
-
31
- // function isSymbol(vnode) {
32
- // // We'll go ahead and assume that if the type is a symbol, then the vnode is fragment.
33
- // // This may be a faulty assumption; if it is, it'll need to be changed.
34
- // return vnode && vnode.type && (vnode.type === 'fragment' || typeof vnode.type === 'symbol');
35
- // }
36
-
37
- function changeMenuItems(items) {
38
- for(const vnode of items[0].children) {
39
- if(!isVNode(vnode)) {
40
- continue;
41
- }
42
-
43
- vnode.props = Object.assign({ class: undefined }, vnode.props);
44
- vnode.attrs = Object.assign({}, vnode.attrs);
45
-
46
- if(!vnode.attrs.on) {
47
- vnode.attrs.on = {};
48
- }
49
-
50
- const isDropdownItem = vnode.props.class && vnode.props.class.match(/dropdown-item/);
51
- const isDropdownDivider = vnode.props.class && vnode.props.class.match(/dropdown-divider/);
52
-
53
- vnode.attrs.on.click = wrap(e => {
54
- context.parent.$emit('click-item', e, vnode);
55
- }, listener(vnode, 'click'));
56
-
57
- vnode.attrs.on.blur = wrap(e => {
58
- context.parent.$emit('blur-item', e, vnode);
59
- }, listener(vnode, 'blur'));
60
-
61
- if(typeof vnode.type === 'string' && vnode.type.match(/^h\d$/)) {
62
- appendClass(vnode, 'dropdown-header');
63
- }
64
- else if(vnode.type === 'hr' && !isDropdownDivider) {
65
- vnode.type = 'div';
66
-
67
- appendClass(vnode, 'dropdown-divider');
68
- }
69
- else if(!isDropdownItem && !isDropdownDivider) {
70
- appendClass(vnode, 'dropdown-item');
71
- }
72
- }
73
-
74
- return items;
75
- }
76
-
77
- const DropdownMenuItems = (props, context) => h('div', {}, changeMenuItems(context.slots.default()));
78
-
79
- export default DropdownMenuItems;
80
- </script>
@@ -1,302 +0,0 @@
1
- const Color = require('color');
2
- const plugin = require('tailwindcss/plugin');
3
- const colors = require('tailwindcss/colors');
4
- const variations = require('@vue-interface/variant/tailwindcss/variations');
5
-
6
- module.exports = plugin(function({ addComponents, theme }) {
7
- const component = {
8
- // ':root': {
9
- // '--dropdown-menu-z-index': theme('dropdownMenu.zIndex'),
10
- // '--dropdown-menu-min-width': theme('dropdownMenu.minWidth'),
11
- // '--dropdown-menu-padding-y': theme('dropdownMenu.paddingY'),
12
- // '--dropdown-menu-spacer': theme('dropdownMenu.spacer'),
13
- // '--dropdown-menu-font-size': theme('dropdownMenu.fontSize'),
14
- // '--dropdown-menu-color': theme('dropdownMenu.color'),
15
- // '--dropdown-menu-background-color': theme('dropdownMenu.backgroundColor'),
16
- // '--dropdown-menu-border-color': theme('dropdownMenu.borderColor'),
17
- // '--dropdown-menu-border-radius': theme('dropdownMenu.borderRadius'),
18
- // '--dropdown-menu-border-width': theme('dropdownMenu.borderWidth'),
19
- // '--dropdown-menu-box-shadow': theme('dropdownMenu.boxShadow'),
20
-
21
- // '--dropdown-menu-inner-border-radius': theme('dropdownMenu.inner.borderRadius'),
22
-
23
- // '--dropdown-menu-divider-background-color': theme('dropdownMenu.divider.backgroundColor'),
24
-
25
- // '--dropdown-menu-link-color': theme('dropdownMenu.link.color'),
26
-
27
- // '--dropdown-menu-link-hover-color': theme('dropdownMenu.link.hover.color'),
28
- // '--dropdown-menu-link-hover-background-color': theme('dropdownMenu.link.hover.backgroundColor'),
29
-
30
- // '--dropdown-menu-link-active-color': theme('dropdownMenu.link.active.color'),
31
- // '--dropdown-menu-link-active-background-color': theme('dropdownMenu.link.active.backgroundColor'),
32
-
33
- // '--dropdown-menu-link-disabled-color': theme('dropdownMenu.link.disabled.color'),
34
-
35
- // '--dropdown-menu-item-padding-x': theme('dropdownMenu.item.paddingX'),
36
-
37
- // '--dropdown-menu-header-color': theme('dropdownMenu.header.color'),
38
- // '--dropdown-menu-header-padding-y': theme('dropdownMenu.header.paddingY')
39
- // },
40
-
41
- // The dropdown wrapper (`<div>`)
42
- '.dropup, .dropright, .dropdown, .dropleft': {
43
- position: 'relative'
44
- },
45
-
46
- '.dropdown-toggle': {
47
- whiteSpace: 'nowrap',
48
- },
49
-
50
- '.dropdown-toggle::after': theme('dropdownMenu.enableCarets') ? {
51
- display: 'inline-block',
52
- marginLeft: '.3em',
53
- verticalAlign: 'calc(.3em * .85)',
54
- content: '""',
55
- borderTop: '.3em solid',
56
- borderRight: '.3em solid transparent',
57
- borderBottom: 0,
58
- borderLeft: '.3em solid transparent'
59
- } : undefined,
60
-
61
- // The dropdown menu
62
- '.dropdown-menu': {
63
- position: 'absolute',
64
- top: '100%',
65
- left: 0,
66
- zIndex: theme('dropdownMenu.zIndex'),
67
- display: 'none', // none by default, but block on "open" of the menu
68
- minWidth: theme('dropdownMenu.minWidth'),
69
- padding: `${theme('dropdownMenu.paddingY')} 0`,
70
- // margin: `${theme('dropdownMenu.spacer')} 0 0`, // override default ul
71
- fontSize: theme('dropdownMenu.fontSize'),
72
- color: theme('dropdownMenu.color'),
73
- textAlign: 'left', // Ensures proper alignment if parent has it changed (e.g., modal footer)
74
- listStyle: 'none',
75
- backgroundColor: theme('dropdownMenu.backgroundColor'),
76
- backgroundClip: 'padding-box',
77
- border: `${theme('dropdownMenu.borderWidth')} solid ${theme('dropdownMenu.borderColor')}`,
78
- borderRadius: `${theme('dropdownMenu.borderRadius')}`,
79
- boxShadow: theme('dropdownMenu.enableShadows') ? theme('dropdownMenu.boxShadow') : undefined,
80
-
81
- // When enabled Popper.js, reset basic dropdown position
82
- // stylelint-disable-next-line no-duplicate-selectors
83
- '&[x-placement^="top"], &[x-placement^="right"], &[x-placement^="bottom"], &[x-placement^="left"]': {
84
- right: 'auto',
85
- bottom: 'auto'
86
- }
87
- },
88
-
89
- // Allow for dropdowns to go bottom up (aka, dropup-menu)
90
- // Just add .dropup after the standard .dropdown class and you're set.
91
- '.dropup .dropdown-menu': {
92
- top: 'auto',
93
- bottom: '100%',
94
- marginTop: 0,
95
- // marginBottom: theme('dropdownMenu.spacer')
96
- },
97
-
98
- '.dropup .dropdown-toggle::after': theme('dropdownMenu.enableCarets') ? {
99
- display: 'inline-block',
100
- marginLeft: '.3em',
101
- verticalAlign: 'calc(.3em * .85)',
102
- content: '""',
103
- borderTop: 0,
104
- borderRight: '.3em solid transparent',
105
- borderBottom: '.3em solid',
106
- borderLeft: '.3em solid transparent'
107
- } : undefined,
108
-
109
- '.dropright .dropdown-menu': {
110
- top: 0,
111
- right: 'auto',
112
- left: '100%',
113
- marginTop: 0,
114
- // marginLeft: theme('dropdownMenu.spacer')
115
- },
116
-
117
- '.dropright .dropdown-toggle::after': theme('dropdownMenu.enableCarets') ? {
118
- display: 'inline-block',
119
- marginLeft: '.3em',
120
- verticalAlign: 'calc(.3em * .85)',
121
- content: '""',
122
- borderTop: '.3em solid transparent',
123
- borderRight: 0,
124
- borderBottom: '.3em solid transparent',
125
- borderLeft: '.3em solid',
126
- verticalAlign: 0
127
- } : undefined,
128
-
129
- '.dropleft .dropdown-menu': {
130
- top: 0,
131
- right: '100%',
132
- left: 'auto',
133
- marginTop: 0,
134
- // marginRight: theme('dropdownMenu.spacer')
135
- },
136
-
137
- '.dropleft .dropdown-toggle::after': {
138
- display: 'none'
139
- },
140
-
141
- '.dropleft .dropdown-toggle::before': {
142
- display: 'inline-block',
143
- marginRight: '.3em',
144
- verticalAlign: 'calc(.3em * .85)',
145
- content: '""',
146
- borderTop: '.3em solid transparent',
147
- borderLeft: 0,
148
- borderBottom: '.3em solid transparent',
149
- borderRight: '.3em solid',
150
- verticalAlign: 0
151
- },
152
-
153
- // Dividers (basically an `<hr>`) within the dropdown
154
- '.dropdown-divider': {
155
- height: 0,
156
- margin: `calc(${theme('dropdownMenu.spacer')} / 2) 0`,
157
- overflow: 'hidden',
158
- borderTop: `1px solid ${theme('dropdownMenu.divider.backgroundColor')}`,
159
- },
160
-
161
- // Links, buttons, and more within the dropdown menu
162
- //
163
- // `<button>`-specific styles are denoted with `// For <button>s`
164
- '.dropdown-item': {
165
- display: 'block',
166
- width: '100%', // For `<button>`s
167
- padding: `${theme('dropdownMenu.item.paddingY')} ${theme('dropdownMenu.item.paddingX')}`,
168
- clear: 'both',
169
- fontWeight: 'normal',
170
- color: theme('dropdownMenu.link.color'),
171
- textAlign: 'inherit', // For `<button>`s
172
- textDecoration: 'none',
173
- whiteSpace: 'nowrap', // prevent links from randomly breaking onto new lines
174
- backgroundColor: 'transparent', // For `<button>`s
175
- border: 0, // For `<button>`s
176
- },
177
-
178
- '.dropdown-item:hover, .dropdown-item:focus': {
179
- color: theme('dropdownMenu.link.hover.color'),
180
- textDecoration: 'none',
181
- backgroundColor: theme('dropdownMenu.link.hover.backgroundColor')
182
- },
183
-
184
- '.dropdown-item.active, .dropdown-item:active': {
185
- color: theme('dropdownMenu.link.active.color'),
186
- textDecoration: 'none',
187
- backgroundColor: theme('dropdownMenu.link.active.backgroundColor')
188
- },
189
-
190
- '.dropdown-item.disabled, .dropdown-item:disabled': {
191
- color: theme('dropdownMenu.link.disabled.color'),
192
- pointerEvents: 'none',
193
- backgroundColor: 'transparent',
194
- backgroundImage: 'none'
195
- },
196
-
197
- '.dropdown-menu.show': {
198
- display: 'block'
199
- },
200
-
201
- // Dropdown section headers
202
- '.dropdown-header': {
203
- display: theme('dropdownMenu.header.display'),
204
- padding: `${theme('dropdownMenu.header.paddingY')} ${theme('dropdownMenu.header.paddingX')}`,
205
- marginBottom: 0, // for use with heading elements
206
- fontSize: theme('dropdownMenu.header.fontSize'),
207
- fontWeight: theme('dropdownMenu.header.fontWeight'),
208
- color: theme('dropdownMenu.header.color'),
209
- whiteSpace: 'nowrap' // as with > li > a
210
- },
211
-
212
- // Dropdown text
213
- '.dropdown-item-text': {
214
- display: theme('dropdownMenu.item.display'),
215
- padding: `${theme('dropdownMenu.item.paddingY')} ${theme('dropdownMenu.item.paddingX')}`,
216
- color: theme('dropdownMenu.link.color'),
217
- },
218
-
219
- '.dropdown-menu-left': {
220
- right: 'auto',
221
- left: 0
222
- },
223
-
224
- '.dropdown-menu-right': {
225
- // right: 0,
226
- left: 'auto'
227
- }
228
- };
229
-
230
- if(theme('dropdownMenu.paddingY') === 0) {
231
- component['.dropdown-item']['&:first-child'] = {
232
- borderTopLeftRadius: theme('dropdownMenu.inner.borderRadius'),
233
- borderTopRightRadius: theme('dropdownMenu.inner.borderRadius'),
234
- };
235
-
236
- component['.dropdown-item']['&:last-child'] = {
237
- borderBottomLeftRadius: theme('dropdownMenu.inner.borderRadius'),
238
- borderBottomRightRadius: theme('dropdownMenu.inner.borderRadius'),
239
- };
240
- }
241
-
242
- addComponents(component);
243
- }, {
244
- theme: {
245
- dropdownMenu: theme => ({
246
- enableShadows: true,
247
- enableCarets: true,
248
- zIndex: 1000,
249
- minWidth: '10rem',
250
- paddingY: '.5rem',
251
- spacer: '.125rem',
252
- fontSize: '1rem',
253
- color: 'inherit',
254
- backgroundColor: theme('colors.white', colors.white),
255
- borderColor: Color(theme('colors.black', colors.black)).fade(.85),
256
- borderRadius: '.25rem',
257
- borderWidth: '1px',
258
- boxShadow: `0 .5rem 1rem ${Color(theme('colors.black', colors.black)).fade(.85)}`,
259
-
260
- inner: {
261
- borderRadius: 'calc(.25rem - 1px)'
262
- },
263
-
264
- divider: {
265
- backgroundColor: theme('colors.gray.100', colors.gray[100]),
266
- },
267
-
268
- link: {
269
- color: theme('colors.gray.800', colors.gray[800]),
270
-
271
- hover: {
272
- color: Color(theme('colors.gray.800', colors.gray[800])).darken(.5).hex(),
273
- backgroundColor: theme('colors.gray.100', colors.gray[100])
274
- },
275
-
276
- active: {
277
- color: theme('colors.white', colors.white),
278
- backgroundColor: theme('variations.primary', variations.primary),
279
- },
280
-
281
- disabled: {
282
- color: theme('colors.gray.500', colors.gray[500])
283
- }
284
- },
285
-
286
- item: {
287
- display: 'block',
288
- paddingY: '.25rem',
289
- paddingX: '1rem',
290
- },
291
-
292
- header: {
293
- color: theme('colors.gray.500', colors.gray[500]),
294
- display: 'block',
295
- fontSize: '.875rem',
296
- fontWeight: 'bold',
297
- paddingX: '.5rem',
298
- paddingY: '.5rem'
299
- }
300
- })
301
- }
302
- });
File without changes