@vue-interface/dropdown-menu 2.0.0-beta.5 → 2.0.0-beta.7

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,65 @@
1
+ import { h as a, Fragment as i, defineComponent as l, resolveComponent as c, openBlock as f, createElementBlock as m, normalizeClass as u, createVNode as w, withCtx as h, renderSlot as g } from "vue";
2
+ function s(e, o) {
3
+ e.props.class = `${e.props.class || ""} ${o}`.trim();
4
+ }
5
+ function p(e) {
6
+ for (const o of e) {
7
+ o.type === i && p(o.children), o.props = Object.assign({ class: void 0 }, o.props), o.attrs = Object.assign({}, o.attrs), o.attrs.on || (o.attrs.on = {});
8
+ const t = o.props.class && o.props.class.match(/dropdown-item/), n = o.props.class && o.props.class.match(/dropdown-divider/);
9
+ typeof o.type == "string" && o.type.match(/^h\d$/) ? s(o, "dropdown-header") : o.type === "hr" && !n ? (o.type = "div", s(o, "dropdown-divider")) : !t && !n && s(o, "dropdown-item");
10
+ }
11
+ return e;
12
+ }
13
+ const _ = (e, o) => a("div", {}, p(o.slots.default())), v = l({
14
+ name: "DropdownMenu",
15
+ components: {
16
+ DropdownMenuItems: _
17
+ },
18
+ props: {
19
+ /**
20
+ * Display the dropdown menu aligned left or right
21
+ *
22
+ * @property String
23
+ */
24
+ align: {
25
+ type: String,
26
+ default: "left",
27
+ validate(e) {
28
+ return ["left", "right"].indexOf(e.toLowerCase()) !== -1;
29
+ }
30
+ },
31
+ /**
32
+ * The default visibility of the dropdown menu.
33
+ *
34
+ * @property Object
35
+ */
36
+ show: Boolean
37
+ }
38
+ }), y = (e, o) => {
39
+ const t = e.__vccOpts || e;
40
+ for (const [n, r] of o)
41
+ t[n] = r;
42
+ return t;
43
+ }, $ = ["aria-labelledby"];
44
+ function b(e, o, t, n, r, C) {
45
+ const d = c("dropdown-menu-items");
46
+ return f(), m("div", {
47
+ class: u(["dropdown-menu", {
48
+ "dropdown-menu-left": e.align === "left",
49
+ "dropdown-menu-right": e.align === "right",
50
+ show: e.show
51
+ }]),
52
+ "aria-labelledby": e.$attrs.id
53
+ }, [
54
+ w(d, null, {
55
+ default: h(() => [
56
+ g(e.$slots, "default")
57
+ ]),
58
+ _: 3
59
+ })
60
+ ], 10, $);
61
+ }
62
+ const M = /* @__PURE__ */ y(v, [["render", b]]);
63
+ export {
64
+ M as DropdownMenu
65
+ };
@@ -0,0 +1 @@
1
+ (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t.DropdownMenu={},t.Vue))})(this,function(t,n){"use strict";function d(o,e){o.props.class=`${o.props.class||""} ${e}`.trim()}function p(o){for(const e of o){e.type===n.Fragment&&p(e.children),e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const s=e.props.class&&e.props.class.match(/dropdown-item/),r=e.props.class&&e.props.class.match(/dropdown-divider/);typeof e.type=="string"&&e.type.match(/^h\d$/)?d(e,"dropdown-header"):e.type==="hr"&&!r?(e.type="div",d(e,"dropdown-divider")):!s&&!r&&d(e,"dropdown-item")}return o}const a=(o,e)=>n.h("div",{},p(e.slots.default())),l=n.defineComponent({name:"DropdownMenu",components:{DropdownMenuItems:a},props:{align:{type:String,default:"left",validate(o){return["left","right"].indexOf(o.toLowerCase())!==-1}},show:Boolean}}),c=(o,e)=>{const s=o.__vccOpts||o;for(const[r,i]of e)s[r]=i;return s},f=["aria-labelledby"];function u(o,e,s,r,i,h){const w=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":o.$attrs.id},[n.createVNode(w,null,{default:n.withCtx(()=>[n.renderSlot(o.$slots,"default")]),_:3})],10,f)}const m=c(l,[["render",u]]);t.DropdownMenu=m,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,2 @@
1
1
  import DropdownMenu from './src/DropdownMenu.vue';
2
-
3
- export {
4
- DropdownMenu
5
- };
2
+ export { DropdownMenu };
@@ -0,0 +1,39 @@
1
+ declare const _sfc_main: import("vue").DefineComponent<{
2
+ /**
3
+ * Display the dropdown menu aligned left or right
4
+ *
5
+ * @property String
6
+ */
7
+ align: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ validate(value: any): boolean;
11
+ };
12
+ /**
13
+ * The default visibility of the dropdown menu.
14
+ *
15
+ * @property Object
16
+ */
17
+ show: BooleanConstructor;
18
+ }, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
+ /**
20
+ * Display the dropdown menu aligned left or right
21
+ *
22
+ * @property String
23
+ */
24
+ align: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ validate(value: any): boolean;
28
+ };
29
+ /**
30
+ * The default visibility of the dropdown menu.
31
+ *
32
+ * @property Object
33
+ */
34
+ show: BooleanConstructor;
35
+ }>>, {
36
+ align: string;
37
+ show: boolean;
38
+ }>;
39
+ export default _sfc_main;
@@ -0,0 +1,4 @@
1
+ declare const _sfc_main: (props: any, context: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ [key: string]: any;
3
+ }>;
4
+ export default _sfc_main;
package/package.json CHANGED
@@ -1,15 +1,24 @@
1
1
  {
2
2
  "name": "@vue-interface/dropdown-menu",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
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.js",
20
+ "./tailwindcss/safelist": "./tailwindcss/safelist.js"
21
+ },
13
22
  "browserslist": "last 2 versions, > 0.5%, ie >= 11",
14
23
  "scripts": {
15
24
  "dev": "vite",
@@ -48,18 +57,21 @@
48
57
  },
49
58
  "devDependencies": {
50
59
  "@rollup/plugin-babel": "^6.0.0",
51
- "@vitejs/plugin-vue": "^3.1.2",
52
- "autoprefixer": "^10.4.12",
60
+ "@vitejs/plugin-vue": "^4.0.0",
61
+ "@vue/eslint-config-typescript": "^11.0.2",
62
+ "autoprefixer": "^10.4.2",
53
63
  "babel-eslint": "^10.1.0",
54
64
  "babel-preset-vue": "^2.0.2",
55
65
  "change-case": "^4.1.2",
56
66
  "eslint": "^8.25.0",
57
67
  "eslint-plugin-vue": "^9.6.0",
58
68
  "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"
69
+ "postcss": "^8.4.6",
70
+ "tailwindcss": "^3.1.0",
71
+ "ts-vue": "^0.1.0",
72
+ "typescript": "^4.9.4",
73
+ "vite": "^4.0.0",
74
+ "vite-plugin-dts": "^1.7.1",
75
+ "vue": "^3.2.41"
64
76
  }
65
77
  }
@@ -1,57 +0,0 @@
1
- import { h as i, Fragment as l, resolveComponent as c, openBlock as m, createElementBlock as f, normalizeClass as u, createVNode as w, withCtx as h, renderSlot as g } from "vue";
2
- function s(e, o) {
3
- e.props.class = `${e.props.class || ""} ${o}`.trim();
4
- }
5
- function d(e) {
6
- for (const o of e) {
7
- o.type === l && d(o.children), o.props = Object.assign({ class: void 0 }, o.props), o.attrs = Object.assign({}, o.attrs), o.attrs.on || (o.attrs.on = {});
8
- const n = o.props.class && o.props.class.match(/dropdown-item/), t = o.props.class && o.props.class.match(/dropdown-divider/);
9
- typeof o.type == "string" && o.type.match(/^h\d$/) ? s(o, "dropdown-header") : o.type === "hr" && !t ? (o.type = "div", s(o, "dropdown-divider")) : !n && !t && s(o, "dropdown-item");
10
- }
11
- return e;
12
- }
13
- const _ = (e, o) => i("div", {}, d(o.slots.default())), v = _, y = (e, o) => {
14
- const n = e.__vccOpts || e;
15
- for (const [t, r] of o)
16
- n[t] = r;
17
- return n;
18
- }, C = {
19
- name: "DropdownMenu",
20
- components: {
21
- DropdownMenuItems: v
22
- },
23
- props: {
24
- align: {
25
- type: String,
26
- default: "left",
27
- validate(e) {
28
- return ["left", "right"].indexOf(e.toLowerCase()) !== -1;
29
- }
30
- },
31
- show: Boolean
32
- }
33
- }, D = ["aria-labelledby"];
34
- function $(e, o, n, t, r, b) {
35
- const p = c("dropdown-menu-items");
36
- return m(), f("div", {
37
- class: u(["dropdown-menu", {
38
- "dropdown-menu-left": n.align === "left",
39
- "dropdown-menu-right": n.align === "right",
40
- show: n.show
41
- }]),
42
- "aria-labelledby": e.$attrs.id
43
- }, [
44
- w(p, null, {
45
- default: h(() => [
46
- g(e.$slots, "default", {
47
- onClick: o[0] || (o[0] = (...a) => e.onItemClick && e.onItemClick(...a))
48
- })
49
- ]),
50
- _: 3
51
- })
52
- ], 10, D);
53
- }
54
- const I = /* @__PURE__ */ y(C, [["render", $]]);
55
- export {
56
- I as DropdownMenu
57
- };
@@ -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(o,e){o.props.class=`${o.props.class||""} ${e}`.trim()}function i(o){for(const e of o){e.type===n.Fragment&&i(e.children),e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const t=e.props.class&&e.props.class.match(/dropdown-item/),r=e.props.class&&e.props.class.match(/dropdown-divider/);typeof e.type=="string"&&e.type.match(/^h\d$/)?d(e,"dropdown-header"):e.type==="hr"&&!r?(e.type="div",d(e,"dropdown-divider")):!t&&!r&&d(e,"dropdown-item")}return o}const a=(o,e)=>n.h("div",{},i(e.slots.default())),l=(o,e)=>{const t=o.__vccOpts||o;for(const[r,p]of e)t[r]=p;return t},c={name:"DropdownMenu",components:{DropdownMenuItems:a},props:{align:{type:String,default:"left",validate(o){return["left","right"].indexOf(o.toLowerCase())!==-1}},show:Boolean}},f=["aria-labelledby"];function u(o,e,t,r,p,g){const w=n.resolveComponent("dropdown-menu-items");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["dropdown-menu",{"dropdown-menu-left":t.align==="left","dropdown-menu-right":t.align==="right",show:t.show}]),"aria-labelledby":o.$attrs.id},[n.createVNode(w,null,{default:n.withCtx(()=>[n.renderSlot(o.$slots,"default",{onClick:e[0]||(e[0]=(...h)=>o.onItemClick&&o.onItemClick(...h))})]),_:3})],10,f)}const m=l(c,[["render",u]]);s.DropdownMenu=m,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -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,43 +0,0 @@
1
- <script>
2
- import { Fragment, h } from 'vue';
3
-
4
- function appendClass(vnode, str) {
5
- vnode.props.class = `${vnode.props.class || ''} ${str}`.trim();
6
- }
7
-
8
- function changeMenuItems(items) {
9
- for(const vnode of items) {
10
- if(vnode.type === Fragment) {
11
- changeMenuItems(vnode.children);
12
- }
13
-
14
- vnode.props = Object.assign({ class: undefined }, vnode.props);
15
- vnode.attrs = Object.assign({}, vnode.attrs);
16
-
17
- if(!vnode.attrs.on) {
18
- vnode.attrs.on = {};
19
- }
20
-
21
- const isDropdownItem = vnode.props.class && vnode.props.class.match(/dropdown-item/);
22
- const isDropdownDivider = vnode.props.class && vnode.props.class.match(/dropdown-divider/);
23
-
24
- if(typeof vnode.type === 'string' && vnode.type.match(/^h\d$/)) {
25
- appendClass(vnode, 'dropdown-header');
26
- }
27
- else if(vnode.type === 'hr' && !isDropdownDivider) {
28
- vnode.type = 'div';
29
-
30
- appendClass(vnode, 'dropdown-divider');
31
- }
32
- else if(!isDropdownItem && !isDropdownDivider) {
33
- appendClass(vnode, 'dropdown-item');
34
- }
35
- }
36
-
37
- return items;
38
- }
39
-
40
- const DropdownMenuItems = (props, context) => h('div', {}, changeMenuItems(context.slots.default()));
41
-
42
- export default DropdownMenuItems;
43
- </script>