@zag-js/popover 0.0.0-dev-20220704095222 → 0.0.0-dev-20220704163406
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/index.js +24 -24
- package/dist/index.mjs +24 -24
- package/dist/popover.dom.d.ts +1 -1
- package/dist/popover.machine.d.ts +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -46,6 +46,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
46
46
|
var dataAttr = (guard) => {
|
|
47
47
|
return guard ? "" : void 0;
|
|
48
48
|
};
|
|
49
|
+
var runIfFn = (v, ...a) => {
|
|
50
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
51
|
+
return res != null ? res : void 0;
|
|
52
|
+
};
|
|
53
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
49
54
|
function isWindow(value) {
|
|
50
55
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
51
56
|
}
|
|
@@ -75,6 +80,7 @@ function isVisible(el) {
|
|
|
75
80
|
return false;
|
|
76
81
|
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
77
82
|
}
|
|
83
|
+
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
78
84
|
function hasNegativeTabIndex(element) {
|
|
79
85
|
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
80
86
|
return tabIndex < 0;
|
|
@@ -133,11 +139,6 @@ function getLastTabbable(container, includeContainer) {
|
|
|
133
139
|
const elements = getTabbables(container, includeContainer);
|
|
134
140
|
return elements[elements.length - 1] || null;
|
|
135
141
|
}
|
|
136
|
-
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
137
|
-
var runIfFn = (v, ...a) => {
|
|
138
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
139
|
-
return res != null ? res : void 0;
|
|
140
|
-
};
|
|
141
142
|
var isRef = (v) => hasProp(v, "current");
|
|
142
143
|
function addDomEvent(target, eventName, handler, options) {
|
|
143
144
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
@@ -186,7 +187,6 @@ function nextIndex(v, idx, opts = {}) {
|
|
|
186
187
|
function next(v, idx, opts = {}) {
|
|
187
188
|
return v[nextIndex(v, idx, opts)];
|
|
188
189
|
}
|
|
189
|
-
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
190
190
|
var runIfFn2 = (v, ...a) => {
|
|
191
191
|
const res = typeof v === "function" ? v(...a) : v;
|
|
192
192
|
return res != null ? res : void 0;
|
|
@@ -344,6 +344,20 @@ var import_aria_hidden = require("@zag-js/aria-hidden");
|
|
|
344
344
|
var import_core = require("@zag-js/core");
|
|
345
345
|
|
|
346
346
|
// ../../utilities/interact-outside/dist/index.mjs
|
|
347
|
+
var runIfFn3 = (v, ...a) => {
|
|
348
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
349
|
+
return res != null ? res : void 0;
|
|
350
|
+
};
|
|
351
|
+
var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
352
|
+
var isDom = () => typeof window !== "undefined";
|
|
353
|
+
function getPlatform() {
|
|
354
|
+
var _a;
|
|
355
|
+
const agent = navigator.userAgentData;
|
|
356
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
357
|
+
}
|
|
358
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
359
|
+
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
360
|
+
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
347
361
|
function isWindow2(value) {
|
|
348
362
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
349
363
|
}
|
|
@@ -374,6 +388,10 @@ function isVisible2(el) {
|
|
|
374
388
|
return false;
|
|
375
389
|
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
376
390
|
}
|
|
391
|
+
var isContextMenuEvent = (e) => {
|
|
392
|
+
return e.button === 2 || isCtrlKey(e) && e.button === 0;
|
|
393
|
+
};
|
|
394
|
+
var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
|
|
377
395
|
function fireCustomEvent(el, type, init) {
|
|
378
396
|
if (!el)
|
|
379
397
|
return;
|
|
@@ -386,11 +404,6 @@ function isFocusable2(element) {
|
|
|
386
404
|
return false;
|
|
387
405
|
return element.matches(focusableSelector2) && isVisible2(element);
|
|
388
406
|
}
|
|
389
|
-
var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
390
|
-
var runIfFn3 = (v, ...a) => {
|
|
391
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
392
|
-
return res != null ? res : void 0;
|
|
393
|
-
};
|
|
394
407
|
var isRef2 = (v) => hasProp2(v, "current");
|
|
395
408
|
function addDomEvent2(target, eventName, handler, options) {
|
|
396
409
|
const node = isRef2(target) ? target.current : runIfFn3(target);
|
|
@@ -399,19 +412,6 @@ function addDomEvent2(target, eventName, handler, options) {
|
|
|
399
412
|
node == null ? void 0 : node.removeEventListener(eventName, handler, options);
|
|
400
413
|
};
|
|
401
414
|
}
|
|
402
|
-
var isDom = () => typeof window !== "undefined";
|
|
403
|
-
function getPlatform() {
|
|
404
|
-
var _a;
|
|
405
|
-
const agent = navigator.userAgentData;
|
|
406
|
-
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
407
|
-
}
|
|
408
|
-
var pt = (v) => isDom() && v.test(getPlatform());
|
|
409
|
-
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
410
|
-
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
411
|
-
var isContextMenuEvent = (e) => {
|
|
412
|
-
return e.button === 2 || isCtrlKey(e) && e.button === 0;
|
|
413
|
-
};
|
|
414
|
-
var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
|
|
415
415
|
var POINTER_OUTSIDE_EVENT = "pointerdown.outside";
|
|
416
416
|
var FOCUS_OUTSIDE_EVENT = "focus.outside";
|
|
417
417
|
function trackInteractOutside(node, options) {
|
package/dist/index.mjs
CHANGED
|
@@ -22,6 +22,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
22
22
|
var dataAttr = (guard) => {
|
|
23
23
|
return guard ? "" : void 0;
|
|
24
24
|
};
|
|
25
|
+
var runIfFn = (v, ...a) => {
|
|
26
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
27
|
+
return res != null ? res : void 0;
|
|
28
|
+
};
|
|
29
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
25
30
|
function isWindow(value) {
|
|
26
31
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
27
32
|
}
|
|
@@ -51,6 +56,7 @@ function isVisible(el) {
|
|
|
51
56
|
return false;
|
|
52
57
|
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
53
58
|
}
|
|
59
|
+
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
54
60
|
function hasNegativeTabIndex(element) {
|
|
55
61
|
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
56
62
|
return tabIndex < 0;
|
|
@@ -109,11 +115,6 @@ function getLastTabbable(container, includeContainer) {
|
|
|
109
115
|
const elements = getTabbables(container, includeContainer);
|
|
110
116
|
return elements[elements.length - 1] || null;
|
|
111
117
|
}
|
|
112
|
-
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
113
|
-
var runIfFn = (v, ...a) => {
|
|
114
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
115
|
-
return res != null ? res : void 0;
|
|
116
|
-
};
|
|
117
118
|
var isRef = (v) => hasProp(v, "current");
|
|
118
119
|
function addDomEvent(target, eventName, handler, options) {
|
|
119
120
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
@@ -162,7 +163,6 @@ function nextIndex(v, idx, opts = {}) {
|
|
|
162
163
|
function next(v, idx, opts = {}) {
|
|
163
164
|
return v[nextIndex(v, idx, opts)];
|
|
164
165
|
}
|
|
165
|
-
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
166
166
|
var runIfFn2 = (v, ...a) => {
|
|
167
167
|
const res = typeof v === "function" ? v(...a) : v;
|
|
168
168
|
return res != null ? res : void 0;
|
|
@@ -320,6 +320,20 @@ import { ariaHidden } from "@zag-js/aria-hidden";
|
|
|
320
320
|
import { createMachine, guards, ref } from "@zag-js/core";
|
|
321
321
|
|
|
322
322
|
// ../../utilities/interact-outside/dist/index.mjs
|
|
323
|
+
var runIfFn3 = (v, ...a) => {
|
|
324
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
325
|
+
return res != null ? res : void 0;
|
|
326
|
+
};
|
|
327
|
+
var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
328
|
+
var isDom = () => typeof window !== "undefined";
|
|
329
|
+
function getPlatform() {
|
|
330
|
+
var _a;
|
|
331
|
+
const agent = navigator.userAgentData;
|
|
332
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
333
|
+
}
|
|
334
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
335
|
+
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
336
|
+
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
323
337
|
function isWindow2(value) {
|
|
324
338
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
325
339
|
}
|
|
@@ -350,6 +364,10 @@ function isVisible2(el) {
|
|
|
350
364
|
return false;
|
|
351
365
|
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
352
366
|
}
|
|
367
|
+
var isContextMenuEvent = (e) => {
|
|
368
|
+
return e.button === 2 || isCtrlKey(e) && e.button === 0;
|
|
369
|
+
};
|
|
370
|
+
var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
|
|
353
371
|
function fireCustomEvent(el, type, init) {
|
|
354
372
|
if (!el)
|
|
355
373
|
return;
|
|
@@ -362,11 +380,6 @@ function isFocusable2(element) {
|
|
|
362
380
|
return false;
|
|
363
381
|
return element.matches(focusableSelector2) && isVisible2(element);
|
|
364
382
|
}
|
|
365
|
-
var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
366
|
-
var runIfFn3 = (v, ...a) => {
|
|
367
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
368
|
-
return res != null ? res : void 0;
|
|
369
|
-
};
|
|
370
383
|
var isRef2 = (v) => hasProp2(v, "current");
|
|
371
384
|
function addDomEvent2(target, eventName, handler, options) {
|
|
372
385
|
const node = isRef2(target) ? target.current : runIfFn3(target);
|
|
@@ -375,19 +388,6 @@ function addDomEvent2(target, eventName, handler, options) {
|
|
|
375
388
|
node == null ? void 0 : node.removeEventListener(eventName, handler, options);
|
|
376
389
|
};
|
|
377
390
|
}
|
|
378
|
-
var isDom = () => typeof window !== "undefined";
|
|
379
|
-
function getPlatform() {
|
|
380
|
-
var _a;
|
|
381
|
-
const agent = navigator.userAgentData;
|
|
382
|
-
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
383
|
-
}
|
|
384
|
-
var pt = (v) => isDom() && v.test(getPlatform());
|
|
385
|
-
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
386
|
-
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
387
|
-
var isContextMenuEvent = (e) => {
|
|
388
|
-
return e.button === 2 || isCtrlKey(e) && e.button === 0;
|
|
389
|
-
};
|
|
390
|
-
var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
|
|
391
391
|
var POINTER_OUTSIDE_EVENT = "pointerdown.outside";
|
|
392
392
|
var FOCUS_OUTSIDE_EVENT = "focus.outside";
|
|
393
393
|
function trackInteractOutside(node, options) {
|
package/dist/popover.dom.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MachineContext, MachineState, UserDefinedContext } from "./popover.types";
|
|
1
|
+
import type { MachineContext, MachineState, UserDefinedContext } from "./popover.types";
|
|
2
2
|
export declare function machine(ctx?: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popover",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20220704163406",
|
|
4
4
|
"description": "Core logic for the popover widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@zag-js/aria-hidden": "0.1.0",
|
|
33
|
-
"@zag-js/core": "0.0.0-dev-
|
|
34
|
-
"@zag-js/dom-utils": "0.0.0-dev-
|
|
35
|
-
"@zag-js/popper": "0.0.0-dev-
|
|
36
|
-
"@zag-js/remove-scroll": "0.
|
|
37
|
-
"@zag-js/types": "0.0.0-dev-
|
|
33
|
+
"@zag-js/core": "0.0.0-dev-20220704163406",
|
|
34
|
+
"@zag-js/dom-utils": "0.0.0-dev-20220704163406",
|
|
35
|
+
"@zag-js/popper": "0.0.0-dev-20220704163406",
|
|
36
|
+
"@zag-js/remove-scroll": "0.0.0-dev-20220704163406",
|
|
37
|
+
"@zag-js/types": "0.0.0-dev-20220704163406",
|
|
38
38
|
"@zag-js/utils": "0.1.2",
|
|
39
39
|
"focus-trap": "6.9.4"
|
|
40
40
|
},
|