@vue-interface/dropdown-menu 2.0.0-beta.1 → 2.0.0-beta.11

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,29 @@
1
+ export type DropdownMenuProps = {
2
+ align: 'left' | 'right';
3
+ show?: boolean;
4
+ };
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
6
+ align: {
7
+ type: import("vue").PropType<"left" | "right">;
8
+ required: true;
9
+ };
10
+ show: {
11
+ type: import("vue").PropType<boolean>;
12
+ };
13
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
14
+ align: {
15
+ type: import("vue").PropType<"left" | "right">;
16
+ required: true;
17
+ };
18
+ show: {
19
+ type: import("vue").PropType<boolean>;
20
+ };
21
+ }>>, {}, {}>, {
22
+ default?(_: {}): any;
23
+ }>;
24
+ export default _default;
25
+ type __VLS_WithTemplateSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
@@ -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.1",
3
+ "version": "2.0.0-beta.11",
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",
@@ -44,22 +48,29 @@
44
48
  "color": "^4.2.0"
45
49
  },
46
50
  "peerDependencies": {
47
- "vue": "^3.0.0"
51
+ "vue": "^3.3.4"
48
52
  },
49
53
  "devDependencies": {
50
- "@rollup/plugin-babel": "^5.3.1",
51
- "@vitejs/plugin-vue": "^3.0.3",
52
- "autoprefixer": "^10.4.8",
53
- "babel-eslint": "^10.1.0",
54
- "babel-preset-vue": "^2.0.2",
54
+ "@commitlint/config-conventional": "^17.7.0",
55
+ "@semantic-release/changelog": "^6.0.3",
56
+ "@semantic-release/git": "^10.0.1",
57
+ "@semantic-release/npm": "^10.0.5",
58
+ "@types/color": "^3.0.3",
59
+ "@vitejs/plugin-vue": "^4.3.2",
60
+ "@vue-interface/eslint-config": "^1.0.0-beta.0",
61
+ "autoprefixer": "^10.4.15",
55
62
  "change-case": "^4.1.2",
56
- "eslint": "^8.22.0",
57
- "eslint-plugin-vue": "^9.4.0",
63
+ "commitlint": "^17.7.1",
64
+ "dotenv": "^16.3.1",
65
+ "eslint": "^8.47.0",
66
+ "husky": "^8.0.3",
58
67
  "pascalcase": "^2.0.0",
59
- "postcss": "^8.4.16",
60
- "tailwindcss": "^3.1.8",
61
- "vite": "^3.0.9",
62
- "vue": "^3.2.37",
63
- "vue-router": "^4.1.4"
68
+ "postcss": "^8.4.6",
69
+ "semantic-release": "^21.0.7",
70
+ "tailwindcss": "^3.3.3",
71
+ "typescript": "^5.2.2",
72
+ "vite": "^4.4.0",
73
+ "vue": "^3.3.4",
74
+ "vue-tsc": "^1.8.8"
64
75
  }
65
76
  }
@@ -0,0 +1,214 @@
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
+ // if(theme('dropdownMenu.paddingY') === 0) {
8
+ // component['.dropdown-item']['&:first-child'] = {
9
+ // borderTopLeftRadius: theme('dropdownMenu.inner.borderRadius'),
10
+ // borderTopRightRadius: theme('dropdownMenu.inner.borderRadius'),
11
+ // };
12
+
13
+ // component['.dropdown-item']['&:last-child'] = {
14
+ // borderBottomLeftRadius: theme('dropdownMenu.inner.borderRadius'),
15
+ // borderBottomRightRadius: theme('dropdownMenu.inner.borderRadius'),
16
+ // };
17
+ // }
18
+
19
+ addComponents(theme('dropdownMenu.css'));
20
+ addComponents({
21
+ '.btn-dropdown': theme('dropdownMenu.css')
22
+ })
23
+ }, {
24
+ theme: {
25
+ dropdownMenu: theme => ({
26
+ css: {
27
+ // The dropdown menu
28
+ '.dropdown-menu, .DropdownMenu': {
29
+ position: 'absolute',
30
+ top: '100%',
31
+ left: 0,
32
+ zIndex: 1000,
33
+ display: 'none', // none by default, but block on "open" of the menu
34
+ minWidth: '10rem',
35
+ padding: '.5rem 0',
36
+ // margin: `${theme('dropdownMenu.spacer')} 0 0`, // override default ul
37
+ fontSize: '1rem',
38
+ color: 'inherit',
39
+ textAlign: 'left', // Ensures proper alignment if parent has it changed (e.g., modal footer)
40
+ listStyle: 'none',
41
+ backgroundColor: colors.white,
42
+ backgroundClip: 'padding-box',
43
+ border: `1px solid ${colors.neutral[400]}`,
44
+ borderRadius: '.25rem',
45
+ boxShadow: `0 .25rem 1rem rgba(0, 0, 0, .5)`,
46
+
47
+ // The dropdown wrapper (`<div>`)
48
+ '.dropup:has(&), .dropright:has(&), .dropdown:has(&), .dropleft:has(&)': {
49
+ position: 'relative'
50
+ },
51
+
52
+ // When enabled Popper.js, reset basic dropdown position
53
+ // stylelint-disable-next-line no-duplicate-selectors
54
+ '&[x-placement^="top"], &[x-placement^="right"], &[x-placement^="bottom"], &[x-placement^="left"]': {
55
+ right: 'auto',
56
+ bottom: 'auto'
57
+ },
58
+
59
+ // Links, buttons, and more within the dropdown menu
60
+ //
61
+ // `<button>`-specific styles are denoted with `// For <button>s`
62
+ '.dropdown-item': {
63
+ display: 'block',
64
+ width: '100%', // For `<button>`s
65
+ padding: '.25rem 1rem',
66
+ clear: 'both',
67
+ fontWeight: 'normal',
68
+ color: theme('colors.gray.800', colors.gray[800]),
69
+ textAlign: 'inherit', // For `<button>`s
70
+ textDecoration: 'none',
71
+ whiteSpace: 'nowrap', // prevent links from randomly breaking onto new lines
72
+ backgroundColor: 'transparent', // For `<button>`s
73
+ border: 0, // For `<button>`s
74
+
75
+ '&:hover, &:focus': {
76
+ color: theme('colors.gray.800', colors.gray[900]),
77
+ textDecoration: 'none',
78
+ backgroundColor: theme('colors.gray.100', colors.gray[100])
79
+ },
80
+
81
+ '&.active, &:active': {
82
+ color: theme('colors.white', colors.white),
83
+ textDecoration: 'none',
84
+ backgroundColor: theme('variations.primary', colors.blue[500])
85
+ },
86
+
87
+ '&.disabled, &:disabled': {
88
+ color: theme('colors.gray.500', colors.gray[500]),
89
+ pointerEvents: 'none',
90
+ backgroundColor: 'transparent',
91
+ backgroundImage: 'none'
92
+ },
93
+ },
94
+
95
+ // Dropdown section headers
96
+ '.dropdown-header': {
97
+ display: 'block',
98
+ padding: '.5rem',
99
+ marginBottom: 0, // for use with heading elements
100
+ fontSize: '.875rem',
101
+ fontWeight: 'bold',
102
+ color: theme('colors.gray.500', colors.gray[500]),
103
+ whiteSpace: 'nowrap' // as with > li > a
104
+ },
105
+
106
+ // Dividers (basically an `<hr>`) within the dropdown
107
+ '.dropdown-divider': {
108
+ height: 0,
109
+ margin: 'calc(.125rem / 2) 0',
110
+ overflow: 'hidden',
111
+ borderTop: `1px solid ${theme('colors.gray.200', colors.gray[200])}`,
112
+ },
113
+
114
+ // Dropdown text
115
+ '.dropdown-item-text': {
116
+ display: 'block',
117
+ padding: '.25rem 1rem',
118
+ color: theme('colors.gray.800', colors.gray[800]),
119
+ },
120
+
121
+ '&.show': {
122
+ display: 'inline-block'
123
+ },
124
+
125
+ '&.dropdown-menu-left': {
126
+ right: 'auto',
127
+ left: 0
128
+ },
129
+
130
+ '&.dropdown-menu-right': {
131
+ right: 0,
132
+ left: 'auto'
133
+ },
134
+
135
+ // '.dropdown-toggle': {
136
+ // whiteSpace: 'nowrap',
137
+ // },
138
+
139
+ // '.dropdown-toggle::after': {
140
+ // display: 'inline-block',
141
+ // marginLeft: '.3em',
142
+ // verticalAlign: 'calc(.3em * .85)',
143
+ // content: '""',
144
+ // borderTop: '.3em solid',
145
+ // borderRight: '.3em solid transparent',
146
+ // borderBottom: 0,
147
+ // borderLeft: '.3em solid transparent'
148
+ // },
149
+
150
+ // Allow for dropdowns to go bottom up (aka, dropup-menu)
151
+ // Just add .dropup after the standard .dropdown class and you're set.
152
+ '.dropup &': {
153
+ top: 'auto',
154
+ bottom: '100%',
155
+ marginTop: 0,
156
+ },
157
+
158
+ // '.dropup .dropdown-toggle::after': {
159
+ // display: 'inline-block',
160
+ // marginLeft: '.3em',
161
+ // verticalAlign: 'calc(.3em * .85)',
162
+ // content: '""',
163
+ // borderTop: 0,
164
+ // borderRight: '.3em solid transparent',
165
+ // borderBottom: '.3em solid',
166
+ // borderLeft: '.3em solid transparent'
167
+ // },
168
+
169
+ '.dropright &': {
170
+ top: 0,
171
+ right: 'auto',
172
+ left: '100%',
173
+ marginTop: 0,
174
+ },
175
+
176
+ // '.dropright .dropdown-toggle::after': {
177
+ // display: 'inline-block',
178
+ // marginLeft: '.3em',
179
+ // verticalAlign: 'calc(.3em * .85)',
180
+ // content: '""',
181
+ // borderTop: '.3em solid transparent',
182
+ // borderRight: 0,
183
+ // borderBottom: '.3em solid transparent',
184
+ // borderLeft: '.3em solid',
185
+ // verticalAlign: 0
186
+ // },
187
+
188
+ '.dropleft &': {
189
+ top: 0,
190
+ right: '100%',
191
+ left: 'auto',
192
+ marginTop: 0,
193
+ },
194
+
195
+ // '.dropleft .dropdown-toggle::after': {
196
+ // display: 'none'
197
+ // },
198
+
199
+ // '.dropleft .dropdown-toggle::before': {
200
+ // display: 'inline-block',
201
+ // marginRight: '.3em',
202
+ // verticalAlign: 'calc(.3em * .85)',
203
+ // content: '""',
204
+ // borderTop: '.3em solid transparent',
205
+ // borderLeft: 0,
206
+ // borderBottom: '.3em solid transparent',
207
+ // borderRight: '.3em solid',
208
+ // verticalAlign: 0
209
+ // },
210
+ }
211
+ }
212
+ })
213
+ }
214
+ });
@@ -1,74 +0,0 @@
1
- import { h as d, resolveComponent as m, openBlock as u, createElementBlock as f, normalizeClass as w, createVNode as h, withCtx as y, 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 (n) => {
7
- typeof t == "function" && t(n), n.cancelBubble || e(n);
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 _(e) {
14
- return e && e.type && (e.type === "fragment" || typeof e.type == "symbol");
15
- }
16
- function a(e) {
17
- for (const t of e) {
18
- if (_(t))
19
- return a(t.children);
20
- t.props = Object.assign({ class: void 0 }, t.props), t.attrs = Object.assign({}, t.attrs), t.attrs.on || (t.attrs.on = {});
21
- const n = t.props.class && t.props.class.match(/dropdown-item/), r = t.props.class && t.props.class.match(/dropdown-divider/);
22
- t.attrs.on.click = i((o) => {
23
- context.parent.$emit("click-item", o, t);
24
- }, p(t, "click")), t.attrs.on.blur = i((o) => {
25
- context.parent.$emit("blur-item", o, t);
26
- }, 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")) : !n && !r && s(t, "dropdown-item");
27
- }
28
- return e;
29
- }
30
- const b = (e, t) => d("div", {}, a(t.slots.default())), $ = b, k = (e, t) => {
31
- const n = e.__vccOpts || e;
32
- for (const [r, o] of t)
33
- n[r] = o;
34
- return n;
35
- }, C = {
36
- name: "DropdownMenu",
37
- components: {
38
- DropdownMenuItems: $
39
- },
40
- props: {
41
- align: {
42
- type: String,
43
- default: "left",
44
- validate(e) {
45
- return ["left", "right"].indexOf(e.toLowerCase()) !== -1;
46
- }
47
- },
48
- show: Boolean
49
- }
50
- }, D = ["aria-labelledby"];
51
- function I(e, t, n, r, o, M) {
52
- const l = m("dropdown-menu-items");
53
- return u(), f("div", {
54
- class: w(["dropdown-menu", {
55
- "dropdown-menu-left": n.align === "left",
56
- "dropdown-menu-right": n.align === "right",
57
- show: n.show
58
- }]),
59
- "aria-labelledby": e.$attrs.id
60
- }, [
61
- h(l, null, {
62
- default: y(() => [
63
- g(e.$slots, "default", {
64
- onClick: t[0] || (t[0] = (...c) => e.onItemClick && e.onItemClick(...c))
65
- })
66
- ]),
67
- _: 3
68
- })
69
- ], 10, D);
70
- }
71
- const v = /* @__PURE__ */ k(C, [["render", I]]);
72
- export {
73
- v as DropdownMenu
74
- };
@@ -1 +0,0 @@
1
- (function(r,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.DropdownMenu={},r.Vue))})(this,function(r,n){"use strict";function p(t,e){t.props.class=`${t.props.class||""} ${e}`.trim()}function d(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){return t&&t.type&&(t.type==="fragment"||typeof t.type=="symbol")}function a(t){for(const e of t){if(c(e))return a(e.children);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=d(s=>{context.parent.$emit("click-item",s,e)},l(e,"click")),e.attrs.on.blur=d(s=>{context.parent.$emit("blur-item",s,e)},l(e,"blur")),typeof e.type=="string"&&e.type.match(/^h\d$/)?p(e,"dropdown-header"):e.type==="hr"&&!i?(e.type="div",p(e,"dropdown-divider")):!o&&!i&&p(e,"dropdown-item")}return t}const u=(t,e)=>n.h("div",{},a(e.slots.default())),f=(t,e)=>{const o=t.__vccOpts||t;for(const[i,s]of e)o[i]=s;return o},m={name:"DropdownMenu",components:{DropdownMenuItems:u},props:{align:{type:String,default:"left",validate(t){return["left","right"].indexOf(t.toLowerCase())!==-1}},show:Boolean}},w=["aria-labelledby"];function h(t,e,o,i,s,D){const g=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(g,null,{default:n.withCtx(()=>[n.renderSlot(t.$slots,"default",{onClick:e[0]||(e[0]=(..._)=>t.onItemClick&&t.onItemClick(..._))})]),_:3})],10,w)}const y=f(m,[["render",h]]);r.DropdownMenu=y,Object.defineProperties(r,{__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,77 +0,0 @@
1
- <script>
2
- import { h } 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
-
28
- function isFragment(vnode) {
29
- // We'll go ahead and assume that if the type is a symbol, then the vnode is fragment.
30
- // This may be a faulty assumption; if it is, it'll need to be changed.
31
- return vnode && vnode.type && (vnode.type === 'fragment' || typeof vnode.type === 'symbol');
32
- }
33
-
34
- function changeMenuItems(items) {
35
- for(const vnode of items) {
36
- if(isFragment(vnode)) {
37
- return changeMenuItems(vnode.children);
38
- }
39
-
40
- vnode.props = Object.assign({ class: undefined }, vnode.props);
41
- vnode.attrs = Object.assign({}, vnode.attrs);
42
-
43
- if(!vnode.attrs.on) {
44
- vnode.attrs.on = {};
45
- }
46
-
47
- const isDropdownItem = vnode.props.class && vnode.props.class.match(/dropdown-item/);
48
- const isDropdownDivider = vnode.props.class && vnode.props.class.match(/dropdown-divider/);
49
-
50
- vnode.attrs.on.click = wrap(e => {
51
- context.parent.$emit('click-item', e, vnode);
52
- }, listener(vnode, 'click'));
53
-
54
- vnode.attrs.on.blur = wrap(e => {
55
- context.parent.$emit('blur-item', e, vnode);
56
- }, listener(vnode, 'blur'));
57
-
58
- if(typeof vnode.type === 'string' && vnode.type.match(/^h\d$/)) {
59
- appendClass(vnode, 'dropdown-header');
60
- }
61
- else if(vnode.type === 'hr' && !isDropdownDivider) {
62
- vnode.type = 'div';
63
-
64
- appendClass(vnode, 'dropdown-divider');
65
- }
66
- else if(!isDropdownItem && !isDropdownDivider) {
67
- appendClass(vnode, 'dropdown-item');
68
- }
69
- }
70
-
71
- return items;
72
- }
73
-
74
- const DropdownMenuItems = (props, context) => h('div', {}, changeMenuItems(context.slots.default()));
75
-
76
- export default DropdownMenuItems;
77
- </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