@vue-interface/btn-dropdown 2.0.0-beta.12 → 2.0.0-beta.13

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.
@@ -1,9 +1,8 @@
1
- import { defineComponent as m, openBlock as a, createBlock as d, resolveDynamicComponent as S, mergeProps as b, withCtx as n, renderSlot as s, resolveComponent as p, normalizeClass as l, normalizeProps as u, guardReactiveProps as c, createVNode as C, normalizeStyle as P, createTextVNode as w, toDisplayString as y, withKeys as D, withModifiers as T, createCommentVNode as g, createElementBlock as z, createSlots as F } from "vue";
2
- import { createPopper as K } from "@popperjs/core";
3
- import { Btn as M } from "@vue-interface/btn";
4
- import { BtnGroup as j } from "@vue-interface/btn-group";
5
- import { DropdownMenu as q } from "@vue-interface/dropdown-menu";
6
- const E = m({
1
+ import { defineComponent as M, openBlock as z, createBlock as I, resolveDynamicComponent as F, mergeProps as T, withCtx as d, renderSlot as a, ref as K, computed as k, onBeforeMount as Y, unref as e, normalizeClass as C, normalizeProps as S, guardReactiveProps as A, createVNode as B, createTextVNode as D, toDisplayString as E, withKeys as j, withModifiers as H, createCommentVNode as q, createElementVNode as Z, useSlots as x, createSlots as _ } from "vue";
2
+ import { BtnGroup as P } from "@vue-interface/btn-group";
3
+ import { DropdownMenu as L } from "@vue-interface/dropdown-menu";
4
+ import { createPopper as ee } from "@popperjs/core";
5
+ const te = M({
7
6
  props: {
8
7
  expanded: {
9
8
  type: Boolean,
@@ -27,575 +26,361 @@ const E = m({
27
26
  return this.to ? "router-link" : this.href ? "a" : "button";
28
27
  }
29
28
  }
30
- }), k = (e, t) => {
31
- const i = e.__vccOpts || e;
32
- for (const [h, f] of t)
33
- i[h] = f;
34
- return i;
29
+ }), oe = (t, c) => {
30
+ const r = t.__vccOpts || t;
31
+ for (const [u, n] of c)
32
+ r[u] = n;
33
+ return r;
35
34
  };
36
- function O(e, t, i, h, f, B) {
37
- return a(), d(S(e.is), b({ id: e.id }, e.to ? { to: e.to } : { href: e.href }, {
35
+ function ne(t, c, r, u, n, l) {
36
+ return z(), I(F(t.is), T({ id: t.id }, t.to ? { to: t.to } : { href: t.href }, {
38
37
  "aria-haspopup": "true",
39
- "aria-expanded": e.expanded,
40
- type: e.is === "button" ? "button" : void 0
38
+ "aria-expanded": t.expanded,
39
+ type: t.is === "button" ? "button" : void 0
41
40
  }), {
42
- default: n(() => [
43
- s(e.$slots, "default")
41
+ default: d(() => [
42
+ a(t.$slots, "default")
44
43
  ]),
45
44
  _: 3
46
45
  }, 16, ["id", "aria-expanded", "type"]);
47
46
  }
48
- const G = /* @__PURE__ */ k(E, [["render", O]]), A = m({
49
- components: {
50
- BtnDropdownAction: G,
51
- BtnGroup: j,
52
- DropdownMenu: q
53
- },
54
- extends: M,
55
- props: {
56
- /**
57
- * Display the dropdown menu aligned left or right
58
- *
59
- * @property String
60
- */
61
- align: {
62
- type: String,
63
- default: "left",
64
- validate(e) {
65
- return ["left", "right"].indexOf(e.toLowerCase()) !== -1;
66
- }
67
- },
68
- /**
69
- * Should animate the dropdown opening.
70
- *
71
- * @property {Boolean}
72
- */
73
- animated: {
74
- type: Boolean,
75
- default: !0
76
- },
77
- /**
78
- * Additional button classes.
79
- *
80
- * @property {Object|String}
81
- */
82
- buttonClass: [Object, String],
83
- /**
84
- * Show the caret.
85
- *
86
- * @property {Boolean}
87
- */
88
- caret: {
89
- type: Boolean,
90
- default: !0
91
- },
92
- /**
93
- * Should display the toggle button as a circle.
94
- *
95
- * @property Boolean
96
- */
97
- // circle: {
98
- // type: Boolean,
99
- // default: false
100
- // },
101
- /**
102
- * Display as a dropup instead of a dropdown.
103
- *
104
- * @property Boolean
105
- */
106
- dropup: {
107
- type: Boolean,
108
- default: !1
109
- },
110
- /**
111
- * Display as a dropright instead of a dropdown.
112
- *
113
- * @property Boolean
114
- */
115
- dropright: {
116
- type: Boolean,
117
- default: !1
118
- },
119
- /**
120
- * Display as a dropleft instead of a dropdown.
121
- *
122
- * @property Boolean
123
- */
124
- dropleft: {
125
- type: Boolean,
126
- default: !1
127
- },
128
- /**
129
- * The action height.
130
- *
131
- * @property {String}
132
- */
133
- height: String,
134
- /**
135
- * The href action.
136
- *
137
- * @property {String}
138
- */
139
- href: String,
140
- /**
141
- * Is the dropdown a nav item?
142
- *
143
- * @property {Boolean}
144
- */
145
- nav: Boolean,
146
- /**
147
- * The toggle button's label. If not defined as an attribute,
148
- * you can override with the component's slot (inner html).
149
- *
150
- * @property {String}
151
- */
152
- label: String,
153
- offset: {
154
- type: Number,
155
- default: 5
156
- },
157
- /**
158
- * Should rotate the toggle button when opened.
159
- *
160
- * @property {Boolean}
161
- */
162
- rotate: {
163
- type: Boolean,
164
- default: !1
165
- },
166
- /**
167
- * Display the dropdown button with a split toggle button.
168
- *
169
- * @property {Boolean}
170
- */
171
- split: {
172
- type: Boolean,
173
- default: !1
174
- },
175
- /**
176
- * The "to" path, used for vue-router.
177
- *
178
- * @property {String|Object}
179
- */
180
- to: [String, Object],
181
- /**
182
- * The button type attribute.
183
- *
184
- * @property {String}
185
- */
186
- type: {
187
- type: String,
188
- default: "button"
189
- },
190
- /**
191
- * The action width.
192
- *
193
- * @property {String}
194
- */
195
- width: String
196
- },
197
- emits: [
198
- "click-toggle",
199
- "show",
200
- "hide",
201
- "toggle"
202
- ],
203
- data() {
204
- return {
205
- popper: null,
206
- triggerAnimation: !1,
207
- expanded: !1
208
- };
209
- },
210
- computed: {
211
- scope() {
212
- return {
213
- // Pass the computed props.
214
- placement: this.placement,
215
- variantClassPrefix: this.variantClassPrefix,
216
- sizeableClassPrefix: this.sizeableClassPrefix,
217
- classes: this.classes,
218
- actionClasses: this.actionClasses,
219
- toggleStyle: this.toggleStyle,
220
- toggleClasses: this.toggleClasses,
221
- // Pass the methods
222
- focus: this.focus,
223
- queryFocusable: this.queryFocusable,
224
- isFocusable: this.isFocusable,
225
- toggle: this.toggle,
226
- show: this.show,
227
- hide: this.hide,
228
- onBlur: this.onBlur,
229
- onClickItem: this.onClickItem,
230
- onClickToggle: this.onClickToggle,
231
- expanded: this.expanded
232
- };
233
- },
234
- placement() {
235
- return this.dropup ? "top" : this.dropleft ? "left" : this.dropright ? "right" : "bottom";
236
- },
237
- variantClassPrefix() {
238
- return "btn" + (this.outline ? "-outline" : "");
239
- },
240
- sizeableClassPrefix() {
241
- return "btn";
242
- },
243
- classes() {
244
- return {
245
- dropdown: this.dropup && this.dropright && this.dropleft,
246
- dropup: this.dropup,
247
- dropright: this.dropright,
248
- dropleft: this.dropleft,
249
- "icon-only": !this.nav && !this.split && !!this.$slots.icon && !this.$slots.label,
250
- "hide-caret": !this.caret,
251
- expanded: this.expanded,
252
- "rotate-90": !this.nav && this.split && this.rotate && this.expanded
253
- };
254
- },
255
- actionClasses() {
256
- return Object.assign({
257
- btn: !this.nav,
258
- [this.variantClass]: !this.nav && !!this.variant,
259
- [this.sizeableClass]: !!this.size
260
- }, typeof this.buttonClass == "object" ? this.buttonClass : {
261
- [this.buttonClass]: !!this.buttonClass
262
- });
263
- },
264
- toggleStyle() {
265
- return {
266
- width: this.width,
267
- height: this.height
268
- };
269
- },
270
- toggleClasses() {
271
- return Object.assign({
272
- active: this.active,
273
- btn: !this.nav,
274
- "btn-block": !!this.block,
275
- "nav-link": !!this.nav,
276
- "rotate-90": !this.split && this.rotate && this.expanded,
277
- "dropdown-toggle": !0,
278
- "dropdown-toggle-split": !this.nav && this.split,
279
- [this.variantClass]: !this.nav && !!this.variant,
280
- [this.sizeableClass]: !!this.size
281
- }, typeof this.buttonClass == "object" ? this.buttonClass : {
282
- [this.buttonClass]: !!this.buttonClass
283
- });
284
- }
285
- },
286
- watch: {
287
- expanded(e) {
288
- this.$nextTick(() => {
289
- this.$emit(e ? "show" : "hide"), this.$emit("toggle", e);
290
- }), setTimeout(() => {
291
- e ? document.addEventListener("click", this.onClickDocument) : document.removeEventListener("click", this.onClickDocument);
292
- });
293
- }
294
- },
295
- beforeUnmount() {
296
- this.popper && this.popper.destroy();
297
- },
298
- methods: {
299
- /**
300
- * Focus on the the dropdown toggle button
301
- *
302
- * @return void
303
- */
304
- focus() {
305
- var e;
306
- (e = this.$el) == null || e.querySelector(".dropdown-toggle").focus();
307
- },
308
- /**
309
- * Focus on the the dropdown toggle button
310
- *
311
- * @return void
312
- */
313
- queryFocusable() {
314
- var e;
315
- return (e = this.$el) == null ? void 0 : e.querySelector(".dropdown-menu").querySelectorAll('label, input, select, textarea, [tabindex]:not([tabindex="-1"])');
316
- },
317
- /**
318
- * Method to check if the given element is focusable.
319
- *
320
- * @return void
321
- */
322
- isFocusable(e) {
323
- const t = this.queryFocusable();
324
- for (const i in t)
325
- if (e === t[i])
326
- return !0;
327
- return !1;
328
- },
329
- /**
330
- * Toggle the dropdown menu
331
- *
332
- * @return void
333
- */
334
- toggle() {
335
- this.expanded ? this.hide() : this.show();
336
- },
337
- /**
338
- * Show the dropdown menu
339
- *
340
- * @return void
341
- */
342
- show() {
343
- var t, i;
344
- this.expanded = !0;
345
- const e = this.$refs.split && ((t = this.$refs.split) == null ? void 0 : t.$el) || this.$el;
346
- !this.nav && !this.popper ? this.popper = K(e, (i = this.$refs.menu) == null ? void 0 : i.$el, {
347
- placement: `${this.placement}-${this.align === "left" ? "start" : "end"}`,
348
- onFirstUpdate: () => {
349
- this.triggerAnimation = this.animated;
350
- },
351
- modifiers: [
352
- {
353
- name: "offset",
354
- options: {
355
- offset: [0, this.nav ? 1 : this.offset]
356
- // offset: ['.125rem', !this.nav ? 4 : 1],
357
- }
47
+ const N = /* @__PURE__ */ oe(te, [["render", ne]]);
48
+ function O(t, c) {
49
+ const r = K(!1), u = K(!1), n = K(), l = K(), i = K(), w = k(
50
+ () => l.value instanceof HTMLElement ? l.value : l.value.$el
51
+ ), m = k(
52
+ () => i.value instanceof HTMLElement ? i.value : i.value.$el
53
+ ), $ = k(() => ({
54
+ [t.size]: !!t.size,
55
+ dropdown: t.dropdown || !(t.dropright || t.dropleft || t.dropup),
56
+ dropup: t.dropup,
57
+ dropright: t.dropright,
58
+ dropleft: t.dropleft,
59
+ // 'icon-only': !this.nav && !this.split && !!this.$slots.icon && !this.$slots.label,
60
+ // 'hide-caret': !this.caret,
61
+ expanded: r.value
62
+ // 'rotate-90': !this.nav && this.split && this.rotate && this.expanded,
63
+ })), g = k(() => ({
64
+ // [props.size]: !!props.size,
65
+ [t.variant]: !!t.variant,
66
+ ...v.value
67
+ })), v = k(() => typeof t.buttonClass == "object" ? { btn: !0, ...t.buttonClass } : {
68
+ btn: !0,
69
+ [t.buttonClass]: !0
70
+ }), y = k(() => ({
71
+ active: t.active,
72
+ "dropdown-toggle": !0,
73
+ "dropdown-toggle-split": t.split,
74
+ // [props.size]: !!props.size,
75
+ [t.variant]: !!t.variant,
76
+ ...v.value
77
+ // toggleClasses() {
78
+ // return Object.assign({
79
+ // 'active': this.active,
80
+ // 'btn': !this.nav,
81
+ // 'btn-block': !!this.block,
82
+ // 'nav-link': !!this.nav,
83
+ // 'rotate-90': !this.split && this.rotate && this.expanded,
84
+ // 'dropdown-toggle': true,
85
+ // 'dropdown-toggle-split': !this.nav && this.split,
86
+ // [this.variant]: !this.nav && !!this.variant,
87
+ // [this.size]: !!this.size,
88
+ // }, typeof this.buttonClass === 'object' ? this.buttonClass : {
89
+ // [this.buttonClass]: !!this.buttonClass
90
+ // });
91
+ // }
92
+ })), b = k(() => t.dropup ? "top" : t.dropleft ? "left" : t.dropright ? "right" : "bottom"), o = k(() => t.align && t.align === "right" ? "end" : "start");
93
+ function s() {
94
+ r.value = !0, n.value ? n.value.update() : n.value = ee(w.value, m.value.querySelector(".dropdown-menu"), {
95
+ placement: `${b.value}-${o.value}`,
96
+ onFirstUpdate: () => {
97
+ u.value = !0;
98
+ },
99
+ modifiers: [
100
+ {
101
+ name: "offset",
102
+ options: {
103
+ offset: [0, t.offset ?? 5]
358
104
  }
359
- ]
360
- }) : this.popper && this.popper.update();
361
- },
362
- /**
363
- * Hide the dropdown menu
364
- *
365
- * @return void
366
- */
367
- hide() {
368
- this.expanded = !1;
369
- },
370
- /**
371
- * A callback function for the `blur-item` event.
372
- *
373
- * @return void
374
- */
375
- onBlur(e) {
376
- var t;
377
- (this.$refs.menu && !((t = this.$refs.menu) != null && t.$el.contains(e.relatedTarget)) || !(this != null && this.$el.contains(e.relatedTarget))) && this.hide();
378
- },
379
- onClickDocument(e) {
380
- this != null && this.$el.contains(e.target) || this.hide();
381
- },
382
- /**
383
- * A callback function for the `click-item` event.
384
- *
385
- * @return void
386
- */
387
- onClickItem(e) {
388
- this.isFocusable(e.target) || this.hide();
389
- },
390
- /**
391
- * A callback function for the `click-toggle` event.
392
- *
393
- * @return void
394
- */
395
- onClickToggle(e) {
396
- e.target.dispatchEvent(new Event("focus", e)), this.$emit("click-toggle", e), e.defaultPrevented || this.toggle();
397
- },
398
- onKeydown(e) {
399
- e.target.parentElement.lastElementChild === e.target && this.hide();
400
- }
105
+ }
106
+ ]
107
+ });
401
108
  }
402
- }), I = m({
403
- mixins: [
404
- A
405
- ]
406
- });
407
- function N(e, t, i, h, f, B) {
408
- const o = p("BtnDropdownAction"), v = p("DropdownMenu"), $ = p("BtnGroup");
409
- return a(), d($, {
410
- class: l(e.classes)
411
- }, {
412
- default: n(() => [
413
- s(e.$slots, "button", u(c(e.scope)), () => [
414
- C(o, {
415
- id: e.$attrs.id,
416
- ref: "button",
417
- expanded: e.expanded,
418
- href: e.href,
419
- to: e.to,
420
- style: P(e.toggleStyle),
421
- class: l(e.toggleClasses),
422
- onBlur: e.onBlur,
423
- onClick: e.onClickToggle
424
- }, {
425
- default: n(() => [
426
- s(e.$slots, "icon"),
427
- s(e.$slots, "label", {}, () => [
428
- w(y(e.label), 1)
429
- ])
430
- ]),
431
- _: 3
432
- }, 8, ["id", "expanded", "href", "to", "style", "class", "onBlur", "onClick"])
433
- ]),
434
- C(v, {
435
- id: e.$attrs.id,
436
- ref: "menu",
437
- align: e.align,
438
- show: e.expanded,
439
- class: l({ animated: e.triggerAnimation }),
440
- onBlur: e.onBlur,
441
- onClick: e.onClickItem,
442
- onKeydown: D(e.onKeydown, ["tab"]),
443
- onMousedown: t[0] || (t[0] = T(() => {
444
- }, ["prevent"]))
445
- }, {
446
- default: n(() => [
447
- s(e.$slots, "default")
448
- ]),
449
- _: 3
450
- }, 8, ["id", "align", "show", "class", "onBlur", "onClick", "onKeydown"])
451
- ]),
452
- _: 3
453
- }, 8, ["class"]);
109
+ function p() {
110
+ r.value = !1;
111
+ }
112
+ function V() {
113
+ r.value ? p() : s();
114
+ }
115
+ function G() {
116
+ return m.value && m.value.querySelectorAll(
117
+ 'label, input, select, textarea, [tabindex]:not([tabindex="-1"])'
118
+ );
119
+ }
120
+ function R(f) {
121
+ const h = G();
122
+ for (const X in h)
123
+ if (f === h[X])
124
+ return !0;
125
+ return !1;
126
+ }
127
+ function U(f) {
128
+ (m.value && !m.value.contains(f.relatedTarget) || !m.value.contains(f.relatedTarget)) && p();
129
+ }
130
+ function J(f) {
131
+ R(f.target) || p();
132
+ }
133
+ function Q(f) {
134
+ f.target.dispatchEvent(new Event("focus", f)), c("click-toggle", f), f.defaultPrevented || V();
135
+ }
136
+ function W(f) {
137
+ var h;
138
+ ((h = w.value.parentElement) == null ? void 0 : h.lastElementChild) === f.target && p();
139
+ }
140
+ return Y(() => {
141
+ n.value && n.value.destroy();
142
+ }), {
143
+ actionClasses: g,
144
+ classes: $,
145
+ expanded: r,
146
+ menu: i,
147
+ target: l,
148
+ toggleClasses: y,
149
+ triggerAnimation: u,
150
+ hide: p,
151
+ show: s,
152
+ toggle: V,
153
+ onBlur: U,
154
+ onClickItem: J,
155
+ onClickToggle: Q,
156
+ onKeydown: W
157
+ };
454
158
  }
455
- const L = /* @__PURE__ */ k(I, [["render", N]]), V = m({
456
- mixins: [
457
- A
458
- ],
459
- emits: [
460
- "click"
461
- ]
462
- }), H = ["id", "aria-expanded"];
463
- function U(e, t, i, h, f, B) {
464
- const o = p("BtnDropdownAction"), v = p("DropdownMenu"), $ = p("BtnGroup");
465
- return a(), d($, {
466
- class: l([e.classes, "btn-dropdown-split"])
467
- }, {
468
- default: n(() => [
469
- e.dropleft ? g("", !0) : s(e.$slots, "button", u(b({ key: 0 }, e.scope)), () => [
470
- e.dropleft ? g("", !0) : (a(), d(o, {
471
- key: 0,
472
- id: e.$attrs.id,
473
- ref: "button",
474
- expanded: e.expanded,
475
- href: e.href,
476
- to: e.to,
477
- class: l(e.actionClasses),
478
- onClick: t[0] || (t[0] = (r) => e.$emit("click", r))
159
+ const le = /* @__PURE__ */ M({
160
+ __name: "BtnDropdownSingle",
161
+ props: {
162
+ active: { type: Boolean },
163
+ align: {},
164
+ buttonClass: {},
165
+ dropdown: { type: Boolean },
166
+ dropup: { type: Boolean },
167
+ dropleft: { type: Boolean },
168
+ dropright: { type: Boolean },
169
+ label: {},
170
+ offset: {},
171
+ size: {},
172
+ split: { type: Boolean },
173
+ variant: {}
174
+ },
175
+ emits: ["click", "click-toggle"],
176
+ setup(t, { emit: c }) {
177
+ const r = t, {
178
+ target: u,
179
+ classes: n,
180
+ expanded: l,
181
+ menu: i,
182
+ toggleClasses: w,
183
+ triggerAnimation: m,
184
+ toggle: $,
185
+ onBlur: g,
186
+ onClickToggle: v,
187
+ onClickItem: y,
188
+ onKeydown: b
189
+ } = O(r, c);
190
+ return (o, s) => (z(), I(e(P), {
191
+ ref_key: "target",
192
+ ref: u,
193
+ class: C(e(n))
194
+ }, {
195
+ default: d(() => [
196
+ a(o.$slots, "button", S(A({ expanded: e(l), target: e(u), toggle: e($), onBlur: e(g), onClickToggle: e(v), onClickItem: e(y), onKeydown: e(b) })), () => [
197
+ B(N, {
198
+ id: o.$attrs.id,
199
+ expanded: e(l),
200
+ class: C(e(w)),
201
+ onBlur: e(g),
202
+ onClick: e(v)
203
+ }, {
204
+ default: d(() => [
205
+ a(o.$slots, "icon"),
206
+ a(o.$slots, "label", {}, () => [
207
+ D(E(o.label), 1)
208
+ ])
209
+ ]),
210
+ _: 3
211
+ }, 8, ["id", "expanded", "class", "onBlur", "onClick"])
212
+ ]),
213
+ B(e(L), {
214
+ id: o.$attrs.id,
215
+ ref_key: "menu",
216
+ ref: i,
217
+ align: o.align,
218
+ show: e(l),
219
+ class: C({ animated: e(m) }),
220
+ onBlur: e(g),
221
+ onClick: e(y),
222
+ onKeydown: j(e(b), ["tab"]),
223
+ onMousedown: s[0] || (s[0] = H(() => {
224
+ }, ["prevent"]))
479
225
  }, {
480
- default: n(() => [
481
- s(e.$slots, "icon"),
482
- s(e.$slots, "label", {}, () => [
483
- w(y(e.label), 1)
484
- ])
226
+ default: d(() => [
227
+ a(o.$slots, "default")
485
228
  ]),
486
229
  _: 3
487
- }, 8, ["id", "expanded", "href", "to", "class"]))
230
+ }, 8, ["id", "align", "show", "class", "onBlur", "onClick", "onKeydown"])
488
231
  ]),
489
- C($, { ref: "split" }, {
490
- default: n(() => [
491
- s(e.$slots, "split", u(c(e.scope)), () => [
492
- e.split ? (a(), z("button", {
493
- key: 0,
494
- id: e.$attrs.id,
495
- type: "button",
496
- "aria-haspopup": "true",
497
- "aria-expanded": e.expanded,
498
- class: l(e.toggleClasses),
499
- onBlur: t[1] || (t[1] = (...r) => e.onBlur && e.onBlur(...r)),
500
- onClick: t[2] || (t[2] = (...r) => e.onClickToggle && e.onClickToggle(...r))
501
- }, null, 42, H)) : g("", !0)
502
- ]),
503
- C(v, {
504
- id: e.$attrs.id,
505
- ref: "menu",
506
- align: e.align,
507
- show: e.expanded,
508
- class: l({ animated: e.triggerAnimation }),
509
- onBlur: e.onBlur,
510
- onClick: e.onClickItem,
511
- onKeydown: D(e.onKeydown, ["tab"]),
512
- onMousedown: t[3] || (t[3] = T(() => {
513
- }, ["prevent"]))
232
+ _: 3
233
+ }, 8, ["class"]));
234
+ }
235
+ }), ae = ["id", "aria-expanded"], se = /* @__PURE__ */ M({
236
+ __name: "BtnDropdownSplit",
237
+ props: {
238
+ active: { type: Boolean },
239
+ align: {},
240
+ buttonClass: {},
241
+ dropdown: { type: Boolean },
242
+ dropup: { type: Boolean },
243
+ dropleft: { type: Boolean },
244
+ dropright: { type: Boolean },
245
+ label: {},
246
+ offset: {},
247
+ size: {},
248
+ split: { type: Boolean },
249
+ variant: {}
250
+ },
251
+ emits: ["click", "click-toggle"],
252
+ setup(t, { emit: c }) {
253
+ const r = t, {
254
+ actionClasses: u,
255
+ classes: n,
256
+ expanded: l,
257
+ menu: i,
258
+ target: w,
259
+ toggleClasses: m,
260
+ triggerAnimation: $,
261
+ onBlur: g,
262
+ onClickToggle: v,
263
+ onClickItem: y,
264
+ onKeydown: b
265
+ } = O(r, c);
266
+ return (o, s) => (z(), I(e(P), {
267
+ class: C([e(n), "btn-dropdown-split"])
268
+ }, {
269
+ default: d(() => [
270
+ o.dropleft ? q("", !0) : a(o.$slots, "button", S(T({ key: 0 }, { expanded: e(l), onBlur: e(g), onClickToggle: e(v), onClickItem: e(y), onKeydown: e(b) })), () => [
271
+ B(N, {
272
+ id: o.$attrs.id,
273
+ expanded: e(l),
274
+ class: C(e(u)),
275
+ onClick: s[0] || (s[0] = (p) => c("click", p))
514
276
  }, {
515
- default: n(() => [
516
- s(e.$slots, "default")
277
+ default: d(() => [
278
+ a(o.$slots, "icon"),
279
+ a(o.$slots, "label", {}, () => [
280
+ D(E(o.label), 1)
281
+ ])
517
282
  ]),
518
283
  _: 3
519
- }, 8, ["id", "align", "show", "class", "onBlur", "onClick", "onKeydown"])
284
+ }, 8, ["id", "expanded", "class"])
520
285
  ]),
521
- _: 3
522
- }, 512),
523
- e.dropleft ? s(e.$slots, "button", u(b({ key: 1 }, e.scope)), () => [
524
- e.dropleft ? (a(), d(o, {
525
- key: 0,
526
- id: e.$attrs.id,
527
- ref: "button",
528
- expanded: e.expanded,
529
- href: e.href,
530
- to: e.to,
531
- class: l(e.actionClasses),
532
- onClick: t[4] || (t[4] = (r) => e.$emit("click", r))
286
+ B(e(P), {
287
+ ref_key: "target",
288
+ ref: w
533
289
  }, {
534
- default: n(() => [
535
- s(e.$slots, "icon"),
536
- s(e.$slots, "label", {}, () => [
537
- w(y(e.label), 1)
538
- ])
290
+ default: d(() => [
291
+ a(o.$slots, "split", {}, () => [
292
+ Z("button", {
293
+ id: o.$attrs.id,
294
+ type: "button",
295
+ "aria-haspopup": "true",
296
+ "aria-expanded": e(l),
297
+ class: C(e(m)),
298
+ onBlur: s[1] || (s[1] = //@ts-ignore
299
+ (...p) => e(g) && e(g)(...p)),
300
+ onClick: s[2] || (s[2] = //@ts-ignore
301
+ (...p) => e(v) && e(v)(...p))
302
+ }, null, 42, ae)
303
+ ]),
304
+ B(e(L), {
305
+ ref_key: "menu",
306
+ ref: i,
307
+ align: o.align,
308
+ show: e(l),
309
+ class: C({ animated: e($) }),
310
+ onBlur: e(g),
311
+ onClick: e(y),
312
+ onKeydown: j(e(b), ["tab"]),
313
+ onMousedown: s[3] || (s[3] = H(() => {
314
+ }, ["prevent"]))
315
+ }, {
316
+ default: d(() => [
317
+ a(o.$slots, "default")
318
+ ]),
319
+ _: 3
320
+ }, 8, ["align", "show", "class", "onBlur", "onClick", "onKeydown"])
539
321
  ]),
540
322
  _: 3
541
- }, 8, ["id", "expanded", "href", "to", "class"])) : g("", !0)
542
- ]) : g("", !0)
543
- ]),
544
- _: 3
545
- }, 8, ["class"]);
546
- }
547
- const R = /* @__PURE__ */ k(V, [["render", U]]), J = m({
548
- name: "BtnDropdown",
549
- components: {
550
- BtnDropdownSplit: R,
551
- BtnDropdownSingle: L
323
+ }, 512),
324
+ o.dropleft ? a(o.$slots, "button", S(T({ key: 1 }, { expanded: e(l), onBlur: e(g), onClickToggle: e(v), onClickItem: e(y), onKeydown: e(b) })), () => [
325
+ B(N, {
326
+ id: o.$attrs.id,
327
+ expanded: e(l),
328
+ class: C(e(u)),
329
+ onClick: s[4] || (s[4] = (p) => c("click", p))
330
+ }, {
331
+ default: d(() => [
332
+ a(o.$slots, "icon"),
333
+ a(o.$slots, "label", {}, () => [
334
+ D(E(o.label), 1)
335
+ ])
336
+ ]),
337
+ _: 3
338
+ }, 8, ["id", "expanded", "class"])
339
+ ]) : q("", !0)
340
+ ]),
341
+ _: 3
342
+ }, 8, ["class"]));
343
+ }
344
+ }), pe = /* @__PURE__ */ M({
345
+ __name: "BtnDropdown",
346
+ props: {
347
+ label: {},
348
+ split: { type: Boolean }
552
349
  },
553
- inheritAttrs: !1,
554
- emits: [
555
- "click",
556
- "click-toggle",
557
- "dropdown",
558
- "show",
559
- "hide",
560
- "toggle"
561
- ]
562
- });
563
- function Q(e, t, i, h, f, B) {
564
- return a(), d(S(e.$attrs.split === void 0 || e.$attrs.nav ? "btn-dropdown-single" : "btn-dropdown-split"), b({ class: "btn-dropdown" }, e.$attrs, {
565
- onClick: t[0] || (t[0] = (...o) => e.$emit("click", ...o)),
566
- onClickToggle: t[1] || (t[1] = (...o) => e.$emit("click-toggle", ...o)),
567
- onDropdown: t[2] || (t[2] = (...o) => e.$emit("dropdown", ...o)),
568
- onShow: t[3] || (t[3] = (...o) => e.$emit("show", ...o)),
569
- onHide: t[4] || (t[4] = (...o) => e.$emit("hide", ...o)),
570
- onToggle: t[5] || (t[5] = (...o) => e.$emit("toggle", ...o))
571
- }), F({
572
- icon: n(() => [
573
- s(e.$slots, "icon")
574
- ]),
575
- button: n((o) => [
576
- s(e.$slots, "button", u(c(o)))
577
- ]),
578
- split: n((o) => [
579
- s(e.$slots, "split", u(c(o)))
580
- ]),
581
- default: n(() => [
582
- s(e.$slots, "default")
583
- ]),
584
- _: 2
585
- }, [
586
- e.$attrs.label || e.$slots.label ? {
587
- name: "label",
588
- fn: n(() => [
589
- s(e.$slots, "label", {}, () => [
590
- w(y(e.$attrs.label), 1)
591
- ])
350
+ emits: ["click"],
351
+ setup(t, { emit: c }) {
352
+ const r = t, u = x();
353
+ return (n, l) => (z(), I(F(n.split ? se : le), T(r, {
354
+ class: "btn-dropdown",
355
+ onClick: l[0] || (l[0] = (i) => c("click", i))
356
+ }), _({
357
+ icon: d(() => [
358
+ a(n.$slots, "icon")
592
359
  ]),
593
- key: "0"
594
- } : void 0
595
- ]), 1040);
596
- }
597
- const _ = /* @__PURE__ */ k(J, [["render", Q]]);
360
+ button: d((i) => [
361
+ a(n.$slots, "button", S(A(i)))
362
+ ]),
363
+ split: d((i) => [
364
+ a(n.$slots, "split", S(A(i)))
365
+ ]),
366
+ default: d(() => [
367
+ a(n.$slots, "default")
368
+ ]),
369
+ _: 2
370
+ }, [
371
+ n.label || e(u).label ? {
372
+ name: "label",
373
+ fn: d(() => [
374
+ a(n.$slots, "label", {}, () => [
375
+ D(E(n.label), 1)
376
+ ])
377
+ ]),
378
+ key: "0"
379
+ } : void 0
380
+ ]), 1040));
381
+ }
382
+ });
598
383
  export {
599
- _ as BtnDropdown
384
+ pe as BtnDropdown
600
385
  };
601
386
  //# sourceMappingURL=btn-dropdown.js.map