@flexilla/alpine-dropdown 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cdn.js CHANGED
@@ -119,9 +119,12 @@
119
119
  */
120
120
  constructor(e, t, n = {}) {
121
121
  p(this, "reference"), p(this, "popper"), p(this, "offsetDistance"), p(this, "placement"), p(this, "disableOnResize"), p(this, "disableOnScroll"), p(this, "onUpdate"), p(this, "isWindowEventsRegistered"), p(this, "validateElements", () => {
122
- if (!(this.reference instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Reference Element");
123
- if (!(this.popper instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Popper");
124
- if (typeof this.offsetDistance != "number") throw new Error("OffsetDistance must be a number");
122
+ if (!(this.reference instanceof HTMLElement))
123
+ throw new Error("Invalid HTMLElement for Reference Element");
124
+ if (!(this.popper instanceof HTMLElement))
125
+ throw new Error("Invalid HTMLElement for Popper");
126
+ if (typeof this.offsetDistance != "number")
127
+ throw new Error("OffsetDistance must be a number");
125
128
  }), p(this, "setPopperStyleProperty", (c, f) => {
126
129
  this.popper.style.setProperty("--fx-popper-placement-x", `${c}px`), this.popper.style.setProperty("--fx-popper-placement-y", `${f}px`);
127
130
  }), p(this, "setInitialStyles", () => {
@@ -161,9 +164,12 @@
161
164
  eventEffect: r = {},
162
165
  onUpdate: a
163
166
  } = n;
164
- if (!(e instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Reference Element");
165
- if (!(t instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Popper");
166
- if (n.offsetDistance && typeof n.offsetDistance != "number") throw new Error("OffsetDistance must be a number");
167
+ if (!(e instanceof HTMLElement))
168
+ throw new Error("Invalid HTMLElement for Reference Element");
169
+ if (!(t instanceof HTMLElement))
170
+ throw new Error("Invalid HTMLElement for Popper");
171
+ if (n.offsetDistance && typeof n.offsetDistance != "number")
172
+ throw new Error("OffsetDistance must be a number");
167
173
  const { disableOnResize: m, disableOnScroll: d } = r;
168
174
  this.isWindowEventsRegistered = false, this.reference = e, this.popper = t, this.offsetDistance = o, this.placement = i, this.disableOnResize = m || false, this.disableOnScroll = d || false, this.onUpdate = a;
169
175
  }
@@ -263,8 +269,10 @@
263
269
  this.triggerElement.removeEventListener("click", this.toggleStateOnClick), this.triggerStrategy === "hover" && this.triggerElement.removeEventListener("mouseenter", this.showOnMouseEnter);
264
270
  });
265
271
  var o;
266
- if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement)) throw new Error("Trigger element must be a valid HTML element");
267
- if (!(this.contentElement instanceof HTMLElement)) throw new Error("Content element must be a valid HTML element");
272
+ if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
273
+ throw new Error("Trigger element must be a valid HTML element");
274
+ if (!(this.contentElement instanceof HTMLElement))
275
+ throw new Error("Content element must be a valid HTML element");
268
276
  this.options = n, this.triggerStrategy = this.options.triggerStrategy || "click", this.placement = this.options.placement || "bottom", this.offsetDistance = this.options.offsetDistance || 6, this.preventFromCloseOutside = this.options.preventFromCloseOutside || false, this.preventFromCloseInside = this.options.preventCloseFromInside || false, this.defaultState = this.options.defaultState || "close", this.eventEffect = (o = this.options.popper) == null ? void 0 : o.eventEffect, this.popper = new re(
269
277
  this.triggerElement,
270
278
  this.contentElement,
@@ -327,7 +335,8 @@
327
335
  var pe = ({ containerElement: s, targetChildren: e = "a:not([disabled]), button:not([disabled])", direction: t }) => {
328
336
  let n = false;
329
337
  const o = de(s) || document.body, i = typeof e == "string" ? U(e, o) : e, r = (a) => {
330
- if (a.preventDefault(), o.focus(), i.length === 0) return;
338
+ if (a.preventDefault(), o.focus(), i.length === 0)
339
+ return;
331
340
  const m = a.key, d = document.activeElement;
332
341
  let c = i.findIndex((g) => g === d);
333
342
  if (c === -1) {
@@ -493,7 +502,8 @@
493
502
  };
494
503
  l(S, "autoInit", (e = "[data-fx-dropdown]") => {
495
504
  const t = U(e);
496
- for (const n of t) new S(n);
505
+ for (const n of t)
506
+ new S(n);
497
507
  });
498
508
  var z = S;
499
509
 
@@ -143,9 +143,12 @@ var re = class {
143
143
  */
144
144
  constructor(e, t, n = {}) {
145
145
  p(this, "reference"), p(this, "popper"), p(this, "offsetDistance"), p(this, "placement"), p(this, "disableOnResize"), p(this, "disableOnScroll"), p(this, "onUpdate"), p(this, "isWindowEventsRegistered"), p(this, "validateElements", () => {
146
- if (!(this.reference instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Reference Element");
147
- if (!(this.popper instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Popper");
148
- if (typeof this.offsetDistance != "number") throw new Error("OffsetDistance must be a number");
146
+ if (!(this.reference instanceof HTMLElement))
147
+ throw new Error("Invalid HTMLElement for Reference Element");
148
+ if (!(this.popper instanceof HTMLElement))
149
+ throw new Error("Invalid HTMLElement for Popper");
150
+ if (typeof this.offsetDistance != "number")
151
+ throw new Error("OffsetDistance must be a number");
149
152
  }), p(this, "setPopperStyleProperty", (c, f) => {
150
153
  this.popper.style.setProperty("--fx-popper-placement-x", `${c}px`), this.popper.style.setProperty("--fx-popper-placement-y", `${f}px`);
151
154
  }), p(this, "setInitialStyles", () => {
@@ -185,9 +188,12 @@ var re = class {
185
188
  eventEffect: r = {},
186
189
  onUpdate: a
187
190
  } = n;
188
- if (!(e instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Reference Element");
189
- if (!(t instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Popper");
190
- if (n.offsetDistance && typeof n.offsetDistance != "number") throw new Error("OffsetDistance must be a number");
191
+ if (!(e instanceof HTMLElement))
192
+ throw new Error("Invalid HTMLElement for Reference Element");
193
+ if (!(t instanceof HTMLElement))
194
+ throw new Error("Invalid HTMLElement for Popper");
195
+ if (n.offsetDistance && typeof n.offsetDistance != "number")
196
+ throw new Error("OffsetDistance must be a number");
191
197
  const { disableOnResize: m, disableOnScroll: d } = r;
192
198
  this.isWindowEventsRegistered = false, this.reference = e, this.popper = t, this.offsetDistance = o, this.placement = i, this.disableOnResize = m || false, this.disableOnScroll = d || false, this.onUpdate = a;
193
199
  }
@@ -287,8 +293,10 @@ var ce = class {
287
293
  this.triggerElement.removeEventListener("click", this.toggleStateOnClick), this.triggerStrategy === "hover" && this.triggerElement.removeEventListener("mouseenter", this.showOnMouseEnter);
288
294
  });
289
295
  var o;
290
- if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement)) throw new Error("Trigger element must be a valid HTML element");
291
- if (!(this.contentElement instanceof HTMLElement)) throw new Error("Content element must be a valid HTML element");
296
+ if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
297
+ throw new Error("Trigger element must be a valid HTML element");
298
+ if (!(this.contentElement instanceof HTMLElement))
299
+ throw new Error("Content element must be a valid HTML element");
292
300
  this.options = n, this.triggerStrategy = this.options.triggerStrategy || "click", this.placement = this.options.placement || "bottom", this.offsetDistance = this.options.offsetDistance || 6, this.preventFromCloseOutside = this.options.preventFromCloseOutside || false, this.preventFromCloseInside = this.options.preventCloseFromInside || false, this.defaultState = this.options.defaultState || "close", this.eventEffect = (o = this.options.popper) == null ? void 0 : o.eventEffect, this.popper = new re(
293
301
  this.triggerElement,
294
302
  this.contentElement,
@@ -351,7 +359,8 @@ var de = (s) => typeof s == "string" ? W(s) : s;
351
359
  var pe = ({ containerElement: s, targetChildren: e = "a:not([disabled]), button:not([disabled])", direction: t }) => {
352
360
  let n = false;
353
361
  const o = de(s) || document.body, i = typeof e == "string" ? U(e, o) : e, r = (a) => {
354
- if (a.preventDefault(), o.focus(), i.length === 0) return;
362
+ if (a.preventDefault(), o.focus(), i.length === 0)
363
+ return;
355
364
  const m = a.key, d = document.activeElement;
356
365
  let c = i.findIndex((g) => g === d);
357
366
  if (c === -1) {
@@ -517,7 +526,8 @@ var S = class S2 {
517
526
  };
518
527
  l(S, "autoInit", (e = "[data-fx-dropdown]") => {
519
528
  const t = U(e);
520
- for (const n of t) new S(n);
529
+ for (const n of t)
530
+ new S(n);
521
531
  });
522
532
  var z = S;
523
533
 
@@ -118,9 +118,12 @@ var re = class {
118
118
  */
119
119
  constructor(e, t, n = {}) {
120
120
  p(this, "reference"), p(this, "popper"), p(this, "offsetDistance"), p(this, "placement"), p(this, "disableOnResize"), p(this, "disableOnScroll"), p(this, "onUpdate"), p(this, "isWindowEventsRegistered"), p(this, "validateElements", () => {
121
- if (!(this.reference instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Reference Element");
122
- if (!(this.popper instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Popper");
123
- if (typeof this.offsetDistance != "number") throw new Error("OffsetDistance must be a number");
121
+ if (!(this.reference instanceof HTMLElement))
122
+ throw new Error("Invalid HTMLElement for Reference Element");
123
+ if (!(this.popper instanceof HTMLElement))
124
+ throw new Error("Invalid HTMLElement for Popper");
125
+ if (typeof this.offsetDistance != "number")
126
+ throw new Error("OffsetDistance must be a number");
124
127
  }), p(this, "setPopperStyleProperty", (c, f) => {
125
128
  this.popper.style.setProperty("--fx-popper-placement-x", `${c}px`), this.popper.style.setProperty("--fx-popper-placement-y", `${f}px`);
126
129
  }), p(this, "setInitialStyles", () => {
@@ -160,9 +163,12 @@ var re = class {
160
163
  eventEffect: r = {},
161
164
  onUpdate: a
162
165
  } = n;
163
- if (!(e instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Reference Element");
164
- if (!(t instanceof HTMLElement)) throw new Error("Invalid HTMLElement for Popper");
165
- if (n.offsetDistance && typeof n.offsetDistance != "number") throw new Error("OffsetDistance must be a number");
166
+ if (!(e instanceof HTMLElement))
167
+ throw new Error("Invalid HTMLElement for Reference Element");
168
+ if (!(t instanceof HTMLElement))
169
+ throw new Error("Invalid HTMLElement for Popper");
170
+ if (n.offsetDistance && typeof n.offsetDistance != "number")
171
+ throw new Error("OffsetDistance must be a number");
166
172
  const { disableOnResize: m, disableOnScroll: d } = r;
167
173
  this.isWindowEventsRegistered = false, this.reference = e, this.popper = t, this.offsetDistance = o, this.placement = i, this.disableOnResize = m || false, this.disableOnScroll = d || false, this.onUpdate = a;
168
174
  }
@@ -262,8 +268,10 @@ var ce = class {
262
268
  this.triggerElement.removeEventListener("click", this.toggleStateOnClick), this.triggerStrategy === "hover" && this.triggerElement.removeEventListener("mouseenter", this.showOnMouseEnter);
263
269
  });
264
270
  var o;
265
- if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement)) throw new Error("Trigger element must be a valid HTML element");
266
- if (!(this.contentElement instanceof HTMLElement)) throw new Error("Content element must be a valid HTML element");
271
+ if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
272
+ throw new Error("Trigger element must be a valid HTML element");
273
+ if (!(this.contentElement instanceof HTMLElement))
274
+ throw new Error("Content element must be a valid HTML element");
267
275
  this.options = n, this.triggerStrategy = this.options.triggerStrategy || "click", this.placement = this.options.placement || "bottom", this.offsetDistance = this.options.offsetDistance || 6, this.preventFromCloseOutside = this.options.preventFromCloseOutside || false, this.preventFromCloseInside = this.options.preventCloseFromInside || false, this.defaultState = this.options.defaultState || "close", this.eventEffect = (o = this.options.popper) == null ? void 0 : o.eventEffect, this.popper = new re(
268
276
  this.triggerElement,
269
277
  this.contentElement,
@@ -326,7 +334,8 @@ var de = (s) => typeof s == "string" ? W(s) : s;
326
334
  var pe = ({ containerElement: s, targetChildren: e = "a:not([disabled]), button:not([disabled])", direction: t }) => {
327
335
  let n = false;
328
336
  const o = de(s) || document.body, i = typeof e == "string" ? U(e, o) : e, r = (a) => {
329
- if (a.preventDefault(), o.focus(), i.length === 0) return;
337
+ if (a.preventDefault(), o.focus(), i.length === 0)
338
+ return;
330
339
  const m = a.key, d = document.activeElement;
331
340
  let c = i.findIndex((g) => g === d);
332
341
  if (c === -1) {
@@ -492,7 +501,8 @@ var S = class S2 {
492
501
  };
493
502
  l(S, "autoInit", (e = "[data-fx-dropdown]") => {
494
503
  const t = U(e);
495
- for (const n of t) new S(n);
504
+ for (const n of t)
505
+ new S(n);
496
506
  });
497
507
  var z = S;
498
508
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexilla/alpine-dropdown",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "AlpineJS plugin for adding Dropdown functionality to your AlpineJS components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -60,5 +60,5 @@
60
60
  "dependencies": {
61
61
  "@flexilla/dropdown": "^2.1.0"
62
62
  },
63
- "gitHead": "3c7ea3f74d67ac5d9ab2817d747ad7127eb542b5"
63
+ "gitHead": "2de9f4208852d8b159dfd7a84c4e8d03f9d53a86"
64
64
  }