@xaui/native 0.9.1-alpha.37 → 0.9.1-alpha.39
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/{chunk-OULTSBKU.js → chunk-26OGEFQI.js} +1 -1
- package/dist/chunk-2EGR4LWD.js +145 -0
- package/dist/{chunk-TJHYSSBZ.js → chunk-346QBNUD.js} +1 -1
- package/dist/chunk-37L7YGZV.cjs +425 -0
- package/dist/{chunk-PPWXLZGL.js → chunk-3GFRSZYR.js} +15 -23
- package/dist/{chunk-DKH6BNPF.cjs → chunk-3JXI2IHV.cjs} +13 -13
- package/dist/{chunk-7B3UBUC6.cjs → chunk-4KFKWBN5.cjs} +23 -2
- package/dist/{chunk-IGLKACSR.cjs → chunk-4KSKQD37.cjs} +5 -5
- package/dist/{chunk-UBOXW5WO.cjs → chunk-54CWXA34.cjs} +61 -61
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/{chunk-ZJWEVFAO.cjs → chunk-66FOASTP.cjs} +9 -9
- package/dist/{chunk-5PPNDKRX.js → chunk-6CO6FM67.js} +16 -16
- package/dist/{chunk-DVDQSW7U.cjs → chunk-76XDVA24.cjs} +65 -190
- package/dist/{chunk-54FJOKAN.cjs → chunk-7GHM4GKL.cjs} +25 -25
- package/dist/chunk-7KLBTMXV.cjs +478 -0
- package/dist/{chunk-AP6RVIIK.cjs → chunk-7TOG4TVU.cjs} +21 -21
- package/dist/{chunk-LEWW24RQ.cjs → chunk-A7YB7YWX.cjs} +3 -3
- package/dist/{chunk-3P6M2R4S.cjs → chunk-AAVCMCJ3.cjs} +4 -4
- package/dist/{chunk-VFTT3Q4B.cjs → chunk-BNFIFRQA.cjs} +3 -3
- package/dist/{chunk-JXNFOOKC.js → chunk-DY3SUG5P.js} +5 -5
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/{chunk-EOJ5MYAQ.js → chunk-EYD4H4X6.js} +4 -4
- package/dist/{chunk-RGKWNK4T.js → chunk-FBCWNXZC.js} +58 -58
- package/dist/{chunk-HXW4ANVB.js → chunk-FHUYHV6J.js} +25 -4
- package/dist/chunk-GJSFKH4L.js +586 -0
- package/dist/{chunk-6G3XWPNP.js → chunk-HA6BFY3A.js} +3 -3
- package/dist/{chunk-FTQHDJYL.cjs → chunk-HOI5425P.cjs} +9 -9
- package/dist/{chunk-XWY4DF37.js → chunk-JKP4TPIL.js} +86 -289
- package/dist/{chunk-YXPYOOHU.js → chunk-K72UDPVN.js} +27 -27
- package/dist/{chunk-NTD3NPRX.cjs → chunk-KSUV74BE.cjs} +2 -2
- package/dist/{chunk-UGF35NSE.js → chunk-LIUO6D3D.js} +75 -75
- package/dist/{chunk-E3X5ODKQ.js → chunk-LTX6TB5I.js} +1 -1
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/{chunk-BORJJYDW.js → chunk-MXGER5PI.js} +2 -2
- package/dist/{chunk-GTT4NHS2.cjs → chunk-NCCRQK3P.cjs} +11 -11
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/{chunk-NKPTXTTS.js → chunk-QZ24MZRX.js} +3 -3
- package/dist/{chunk-7LSY4WFL.js → chunk-R7BU4CPS.js} +2 -2
- package/dist/{chunk-JB5LGQ54.cjs → chunk-RKCWYUGA.cjs} +3 -3
- package/dist/{chunk-SMW6ZWMH.js → chunk-S2WNWMNT.js} +1 -1
- package/dist/{chunk-WVLSQO6K.cjs → chunk-S4QUM4EE.cjs} +9 -9
- package/dist/{chunk-SO5UAGIU.js → chunk-SACDOFGF.js} +15 -15
- package/dist/{chunk-CUQTAPBU.cjs → chunk-SIP5J7HU.cjs} +17 -17
- package/dist/{chunk-O3A3DBSZ.js → chunk-SZLXPF3G.js} +1 -1
- package/dist/{chunk-437QULXO.cjs → chunk-TDTUAIFF.cjs} +5 -5
- package/dist/{chunk-DRMT346W.cjs → chunk-TGMVEHV7.cjs} +64 -64
- package/dist/{chunk-TDYPY2J7.js → chunk-TRETQZEW.js} +7 -7
- package/dist/{chunk-ITURCQMQ.cjs → chunk-URA25DU4.cjs} +5 -5
- package/dist/{chunk-4PTWZCOK.js → chunk-USF6EWYR.js} +7 -7
- package/dist/{chunk-P747CRAY.cjs → chunk-VZK3NLBH.cjs} +9 -9
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-XAFP5JLK.js +425 -0
- package/dist/{chunk-RVRVGG73.js → chunk-XNMZQSY5.js} +2 -2
- package/dist/{chunk-K4TWKF5U.cjs → chunk-XSQPVDFH.cjs} +15 -25
- package/dist/{chunk-JDSE4TQL.js → chunk-XTC2SLFT.js} +1 -1
- package/dist/{chunk-C5VDFRAD.cjs → chunk-XWNG2U4K.cjs} +2 -2
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -0
- package/dist/components/alert/index.cjs +7 -7
- package/dist/components/alert/index.d.cts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +6 -6
- package/dist/components/avatar/index.cjs +4 -4
- package/dist/components/avatar/index.d.cts +3 -3
- package/dist/components/avatar/index.d.ts +3 -3
- package/dist/components/avatar/index.js +3 -3
- package/dist/components/badge/index.cjs +3 -3
- package/dist/components/badge/index.d.cts +1 -1
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.js +2 -2
- package/dist/components/button/index.cjs +8 -7
- package/dist/components/button/index.d.cts +204 -204
- package/dist/components/button/index.d.ts +204 -204
- package/dist/components/button/index.js +7 -6
- package/dist/components/card/index.cjs +5 -5
- package/dist/components/card/index.d.cts +206 -206
- package/dist/components/card/index.d.ts +206 -206
- package/dist/components/card/index.js +4 -4
- package/dist/components/checkbox/index.cjs +5 -5
- package/dist/components/checkbox/index.d.cts +408 -408
- package/dist/components/checkbox/index.d.ts +408 -408
- package/dist/components/checkbox/index.js +4 -4
- package/dist/components/chip/index.cjs +7 -7
- package/dist/components/chip/index.d.cts +205 -205
- package/dist/components/chip/index.d.ts +205 -205
- package/dist/components/chip/index.js +6 -6
- package/dist/components/divider/index.cjs +3 -3
- package/dist/components/divider/index.d.cts +3 -3
- package/dist/components/divider/index.d.ts +3 -3
- package/dist/components/divider/index.js +2 -2
- package/dist/components/field-group/index.cjs +5 -5
- package/dist/components/field-group/index.d.cts +8 -8
- package/dist/components/field-group/index.d.ts +8 -8
- package/dist/components/field-group/index.js +4 -4
- package/dist/components/input-otp/index.cjs +3 -3
- package/dist/components/input-otp/index.d.cts +2 -2
- package/dist/components/input-otp/index.d.ts +2 -2
- package/dist/components/input-otp/index.js +2 -2
- package/dist/components/popover/index.cjs +37 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +37 -0
- package/dist/components/radio/index.cjs +5 -5
- package/dist/components/radio/index.d.cts +419 -419
- package/dist/components/radio/index.d.ts +419 -419
- package/dist/components/radio/index.js +4 -4
- package/dist/components/select/index.cjs +10 -7
- package/dist/components/select/index.d.cts +24 -45
- package/dist/components/select/index.d.ts +24 -45
- package/dist/components/select/index.js +9 -6
- package/dist/components/skeleton/index.d.cts +1 -1
- package/dist/components/skeleton/index.d.ts +1 -1
- package/dist/components/spinner/index.cjs +5 -4
- package/dist/components/spinner/index.d.cts +1 -1
- package/dist/components/spinner/index.d.ts +1 -1
- package/dist/components/spinner/index.js +4 -3
- package/dist/components/switch/index.cjs +5 -5
- package/dist/components/switch/index.d.cts +409 -409
- package/dist/components/switch/index.d.ts +409 -409
- package/dist/components/switch/index.js +4 -4
- package/dist/components/text-area/index.cjs +4 -4
- package/dist/components/text-area/index.js +3 -3
- package/dist/components/text-field/index.cjs +3 -3
- package/dist/components/text-field/index.d.cts +3 -3
- package/dist/components/text-field/index.d.ts +3 -3
- package/dist/components/text-field/index.js +2 -2
- package/dist/components/typography/index.cjs +3 -3
- package/dist/components/typography/index.d.cts +5 -5
- package/dist/components/typography/index.d.ts +5 -5
- package/dist/components/typography/index.js +2 -2
- package/dist/components/view/index.cjs +3 -3
- package/dist/components/view/index.d.cts +8 -8
- package/dist/components/view/index.d.ts +8 -8
- package/dist/components/view/index.js +2 -2
- package/dist/index.cjs +89 -28
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +109 -48
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -0
- package/dist/system/index.cjs +24 -8
- package/dist/system/index.d.cts +83 -34
- package/dist/system/index.d.ts +83 -34
- package/dist/system/index.js +24 -8
- package/package.json +21 -1
- /package/dist/{chunk-OJCCV65P.cjs → chunk-GGW43Q37.cjs} +0 -0
- /package/dist/{chunk-MESKS6AI.js → chunk-WHJTBTYM.js} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PortalContext
|
|
3
|
+
} from "./chunk-2PMXMKS5.js";
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-anchored-position.ts
|
|
6
|
+
import { useCallback, useContext, useState } from "react";
|
|
7
|
+
import { useWindowDimensions } from "react-native";
|
|
8
|
+
|
|
9
|
+
// src/utils/placement.ts
|
|
10
|
+
var OPPOSITE = {
|
|
11
|
+
top: "bottom",
|
|
12
|
+
bottom: "top",
|
|
13
|
+
start: "end",
|
|
14
|
+
end: "start"
|
|
15
|
+
};
|
|
16
|
+
function axisOf(placement) {
|
|
17
|
+
return placement === "top" || placement === "bottom" ? "vertical" : "horizontal";
|
|
18
|
+
}
|
|
19
|
+
function resolvePlacement(input) {
|
|
20
|
+
const { anchor, content, window, offset, alignOffset, insets } = input;
|
|
21
|
+
const available = window.width - insets.start - insets.end;
|
|
22
|
+
const width = Math.min(resolveWidth(input), Math.max(available, 0));
|
|
23
|
+
const placement = choosePlacement(input);
|
|
24
|
+
const room = Math.max(roomFor(placement, input), 0);
|
|
25
|
+
const vertical = axisOf(placement) === "vertical";
|
|
26
|
+
const maxHeight = vertical ? room : Math.max(window.height - insets.top - insets.bottom, 0);
|
|
27
|
+
const height = Math.min(content.height, maxHeight);
|
|
28
|
+
const top = clamp(
|
|
29
|
+
vertical ? placement === "bottom" ? anchor.y + anchor.height + offset : anchor.y - offset - height : alignedCross(input, height) + alignOffset,
|
|
30
|
+
insets.top,
|
|
31
|
+
Math.max(window.height - insets.bottom - height, insets.top)
|
|
32
|
+
);
|
|
33
|
+
const start = clamp(
|
|
34
|
+
vertical ? alignedCross(input, width) + alignOffset : placement === "end" ? anchor.x + anchor.width + offset : anchor.x - offset - width,
|
|
35
|
+
insets.start,
|
|
36
|
+
Math.max(window.width - insets.end - width, insets.start)
|
|
37
|
+
);
|
|
38
|
+
return { top, start, width, maxHeight, placement };
|
|
39
|
+
}
|
|
40
|
+
function resolveWidth(input) {
|
|
41
|
+
const { width, anchor, content, placement, window, insets } = input;
|
|
42
|
+
if (width === "trigger") {
|
|
43
|
+
return axisOf(placement) === "vertical" ? anchor.width : content.width;
|
|
44
|
+
}
|
|
45
|
+
if (width === "full") return Math.max(window.width - insets.start - insets.end, 0);
|
|
46
|
+
if (width === "content-fit") return content.width;
|
|
47
|
+
return width;
|
|
48
|
+
}
|
|
49
|
+
function choosePlacement(input) {
|
|
50
|
+
const { placement, avoidCollisions, content } = input;
|
|
51
|
+
if (!avoidCollisions) return placement;
|
|
52
|
+
const wanted = axisOf(placement) === "vertical" ? content.height : content.width;
|
|
53
|
+
if (roomFor(placement, input) >= wanted) return placement;
|
|
54
|
+
const other = OPPOSITE[placement];
|
|
55
|
+
return roomFor(other, input) > roomFor(placement, input) ? other : placement;
|
|
56
|
+
}
|
|
57
|
+
function roomFor(placement, input) {
|
|
58
|
+
const { anchor, window, offset, insets } = input;
|
|
59
|
+
switch (placement) {
|
|
60
|
+
case "bottom":
|
|
61
|
+
return window.height - insets.bottom - (anchor.y + anchor.height) - offset;
|
|
62
|
+
case "top":
|
|
63
|
+
return anchor.y - insets.top - offset;
|
|
64
|
+
case "end":
|
|
65
|
+
return window.width - insets.end - (anchor.x + anchor.width) - offset;
|
|
66
|
+
case "start":
|
|
67
|
+
return anchor.x - insets.start - offset;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function alignedCross({ align, anchor, placement }, size) {
|
|
71
|
+
const vertical = axisOf(placement) === "vertical";
|
|
72
|
+
const origin = vertical ? anchor.x : anchor.y;
|
|
73
|
+
const extent = vertical ? anchor.width : anchor.height;
|
|
74
|
+
if (align === "start") return origin;
|
|
75
|
+
if (align === "end") return origin + extent - size;
|
|
76
|
+
return origin + (extent - size) / 2;
|
|
77
|
+
}
|
|
78
|
+
function clamp(value, min, max) {
|
|
79
|
+
return Math.min(Math.max(value, min), max);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/hooks/use-anchored-position.ts
|
|
83
|
+
function useAnchoredPosition({
|
|
84
|
+
anchor,
|
|
85
|
+
isOpen,
|
|
86
|
+
onLayout,
|
|
87
|
+
...options
|
|
88
|
+
}) {
|
|
89
|
+
const window = useWindowDimensions();
|
|
90
|
+
const origin = useContext(PortalContext)?.origin ?? ZERO;
|
|
91
|
+
const [measured, setMeasured] = useState(null);
|
|
92
|
+
const onContentLayout = useCallback(
|
|
93
|
+
(event) => {
|
|
94
|
+
onLayout?.(event);
|
|
95
|
+
const { width, height } = event.nativeEvent.layout;
|
|
96
|
+
setMeasured(
|
|
97
|
+
(current) => current !== null && current.width === width && current.height === height ? current : { width, height }
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
[onLayout]
|
|
101
|
+
);
|
|
102
|
+
if (!isOpen && measured !== null) setMeasured(null);
|
|
103
|
+
const local = anchor && {
|
|
104
|
+
...anchor,
|
|
105
|
+
x: anchor.x - origin.x,
|
|
106
|
+
y: anchor.y - origin.y
|
|
107
|
+
};
|
|
108
|
+
const position = local && measured ? resolvePlacement({
|
|
109
|
+
anchor: local,
|
|
110
|
+
content: measured,
|
|
111
|
+
window: {
|
|
112
|
+
width: window.width - origin.x,
|
|
113
|
+
height: window.height - origin.y
|
|
114
|
+
},
|
|
115
|
+
...options
|
|
116
|
+
}) : null;
|
|
117
|
+
return {
|
|
118
|
+
position,
|
|
119
|
+
onContentLayout,
|
|
120
|
+
measuringStyle: {
|
|
121
|
+
// Invisible, and at the start of the host, so the reader never sees the panel at
|
|
122
|
+
// the wrong place during the frame it is being measured in.
|
|
123
|
+
opacity: 0,
|
|
124
|
+
top: 0,
|
|
125
|
+
start: 0,
|
|
126
|
+
...measuringWidth(options, local?.width, window)
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function measuringWidth({
|
|
131
|
+
width,
|
|
132
|
+
maxWidth,
|
|
133
|
+
insets
|
|
134
|
+
}, anchorWidth, window) {
|
|
135
|
+
const screen = Math.max(window.width - insets.start - insets.end, 0);
|
|
136
|
+
if (width === "trigger") return { width: anchorWidth };
|
|
137
|
+
if (width === "full") return { width: screen };
|
|
138
|
+
if (typeof width === "number") return { width };
|
|
139
|
+
return { maxWidth: Math.min(maxWidth ?? Number.POSITIVE_INFINITY, screen) };
|
|
140
|
+
}
|
|
141
|
+
var ZERO = { x: 0, y: 0 };
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
useAnchoredPosition
|
|
145
|
+
};
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkLUPCPLNDcjs = require('./chunk-LUPCPLND.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWDDXU3OHcjs = require('./chunk-WDDXU3OH.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkEKS3W46Mcjs = require('./chunk-EKS3W46M.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkTGMVEHV7cjs = require('./chunk-TGMVEHV7.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
38
|
+
|
|
39
|
+
// src/components/popover/popover-close.tsx
|
|
40
|
+
var _react = require('react');
|
|
41
|
+
|
|
42
|
+
// src/components/popover/popover.context.ts
|
|
43
|
+
var [PopoverProvider, usePopover] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Popover");
|
|
44
|
+
|
|
45
|
+
// src/components/popover/popover-close.tsx
|
|
46
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
47
|
+
var PopoverClose = _react.forwardRef.call(void 0,
|
|
48
|
+
function PopoverClose2({
|
|
49
|
+
children,
|
|
50
|
+
asChild = false,
|
|
51
|
+
accessibilityRole = "button",
|
|
52
|
+
style,
|
|
53
|
+
onPress,
|
|
54
|
+
onPressIn,
|
|
55
|
+
onPressOut,
|
|
56
|
+
...props
|
|
57
|
+
}, ref) {
|
|
58
|
+
const { close } = usePopover();
|
|
59
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
60
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
61
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
62
|
+
(event) => {
|
|
63
|
+
_optionalChain([onPress, 'optionalCall', _ => _(event)]);
|
|
64
|
+
close();
|
|
65
|
+
},
|
|
66
|
+
[close, onPress]
|
|
67
|
+
);
|
|
68
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
69
|
+
_chunkTGMVEHV7cjs.PressableFeedback,
|
|
70
|
+
{
|
|
71
|
+
ref,
|
|
72
|
+
isPressed,
|
|
73
|
+
asChild,
|
|
74
|
+
accessibilityRole,
|
|
75
|
+
...rest,
|
|
76
|
+
style: [
|
|
77
|
+
styleProps,
|
|
78
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
79
|
+
],
|
|
80
|
+
onPress: handlePress,
|
|
81
|
+
onPressIn: press.onPressIn,
|
|
82
|
+
onPressOut: press.onPressOut,
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
PopoverClose.displayName = "XAUI.Popover.Close";
|
|
89
|
+
|
|
90
|
+
// src/components/popover/popover-content.tsx
|
|
91
|
+
|
|
92
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
93
|
+
|
|
94
|
+
// src/components/popover/popover.recipe.ts
|
|
95
|
+
var SLOTS = ["trigger", "overlay", "content", "title", "description"];
|
|
96
|
+
function popoverMeasure(fontSize) {
|
|
97
|
+
return fontSize * 13;
|
|
98
|
+
}
|
|
99
|
+
var popoverRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
100
|
+
slots: SLOTS,
|
|
101
|
+
base: (theme) => ({
|
|
102
|
+
overlay: { position: "absolute", top: 0, bottom: 0, start: 0, end: 0 },
|
|
103
|
+
content: {
|
|
104
|
+
position: "absolute",
|
|
105
|
+
backgroundColor: theme.colors.overlay,
|
|
106
|
+
// HeroUI's twelve by sixteen: a panel is read, not scanned, so it is wider-padded
|
|
107
|
+
// than it is tall-padded.
|
|
108
|
+
paddingVertical: theme.spacing(3),
|
|
109
|
+
paddingHorizontal: theme.spacing(4),
|
|
110
|
+
// Their `--radius-3xl` on a base of 8 is 24 points; our base is 12, so the same 24
|
|
111
|
+
// is `2xl`. Reading their key rather than their number puts a pill on it.
|
|
112
|
+
borderRadius: theme.radius["2xl"],
|
|
113
|
+
borderCurve: "continuous",
|
|
114
|
+
gap: theme.spacing(1.5),
|
|
115
|
+
...theme.shadows.overlay
|
|
116
|
+
},
|
|
117
|
+
title: {
|
|
118
|
+
fontFamily: theme.fontFamilies.body,
|
|
119
|
+
fontWeight: theme.fontWeights.medium,
|
|
120
|
+
fontSize: theme.fontSizes.lg,
|
|
121
|
+
lineHeight: theme.lineHeights.lg,
|
|
122
|
+
color: theme.colors.overlayForeground
|
|
123
|
+
},
|
|
124
|
+
description: {
|
|
125
|
+
fontFamily: theme.fontFamilies.body,
|
|
126
|
+
fontSize: theme.fontSizes.md,
|
|
127
|
+
lineHeight: theme.lineHeights.md,
|
|
128
|
+
color: theme.colors.muted
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
variantTokens: { default: {} },
|
|
132
|
+
variants: { radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "content") },
|
|
133
|
+
states: {
|
|
134
|
+
disabled: (theme) => ({ trigger: { opacity: theme.opacity.disabled } })
|
|
135
|
+
},
|
|
136
|
+
defaultVariants: { variant: "default" }
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// src/components/popover/popover-content.tsx
|
|
140
|
+
|
|
141
|
+
var DEFAULT_OFFSET = 9;
|
|
142
|
+
var DEFAULT_INSETS = {
|
|
143
|
+
top: 12,
|
|
144
|
+
bottom: 12,
|
|
145
|
+
start: 12,
|
|
146
|
+
end: 12
|
|
147
|
+
};
|
|
148
|
+
var PopoverContent = _react.forwardRef.call(void 0,
|
|
149
|
+
function PopoverContent2({
|
|
150
|
+
children,
|
|
151
|
+
placement = "bottom",
|
|
152
|
+
align = "center",
|
|
153
|
+
width = "content-fit",
|
|
154
|
+
offset = DEFAULT_OFFSET,
|
|
155
|
+
alignOffset = 0,
|
|
156
|
+
avoidCollisions = true,
|
|
157
|
+
insets,
|
|
158
|
+
style,
|
|
159
|
+
onLayout,
|
|
160
|
+
...props
|
|
161
|
+
}, ref) {
|
|
162
|
+
const context = usePopover();
|
|
163
|
+
const { contentStyle, isOpen, anchor } = context;
|
|
164
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
165
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
166
|
+
const { position, onContentLayout, measuringStyle } = _chunkLUPCPLNDcjs.useAnchoredPosition.call(void 0, {
|
|
167
|
+
anchor,
|
|
168
|
+
isOpen,
|
|
169
|
+
placement,
|
|
170
|
+
align,
|
|
171
|
+
width,
|
|
172
|
+
offset,
|
|
173
|
+
alignOffset,
|
|
174
|
+
avoidCollisions,
|
|
175
|
+
insets: { ...DEFAULT_INSETS, ...insets },
|
|
176
|
+
maxWidth: popoverMeasure(theme.fontSizes.md),
|
|
177
|
+
onLayout
|
|
178
|
+
});
|
|
179
|
+
if (!isOpen || anchor === null) return null;
|
|
180
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
181
|
+
_reactnativereanimated2.default.View,
|
|
182
|
+
{
|
|
183
|
+
ref,
|
|
184
|
+
entering: position ? _chunkEKS3W46Mcjs.anchoredEntering.call(void 0, position.placement) : void 0,
|
|
185
|
+
exiting: position ? _chunkEKS3W46Mcjs.anchoredExiting.call(void 0, position.placement) : void 0,
|
|
186
|
+
onLayout: onContentLayout,
|
|
187
|
+
...rest,
|
|
188
|
+
style: [
|
|
189
|
+
contentStyle,
|
|
190
|
+
position === null ? measuringStyle : {
|
|
191
|
+
top: position.top,
|
|
192
|
+
start: position.start,
|
|
193
|
+
width: position.width,
|
|
194
|
+
maxHeight: position.maxHeight
|
|
195
|
+
},
|
|
196
|
+
styleProps,
|
|
197
|
+
style
|
|
198
|
+
],
|
|
199
|
+
children
|
|
200
|
+
},
|
|
201
|
+
_nullishCoalesce(_optionalChain([position, 'optionalAccess', _2 => _2.placement]), () => ( "measuring"))
|
|
202
|
+
) }) });
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
PopoverContent.displayName = "XAUI.Popover.Content";
|
|
206
|
+
|
|
207
|
+
// src/components/popover/popover-description.tsx
|
|
208
|
+
|
|
209
|
+
var _reactnative = require('react-native');
|
|
210
|
+
|
|
211
|
+
var PopoverDescription = _react.forwardRef.call(void 0,
|
|
212
|
+
function PopoverDescription2({ children, style, ...props }, ref) {
|
|
213
|
+
const { descriptionStyle } = usePopover();
|
|
214
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
215
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, ...rest, style: [descriptionStyle, styleProps, style], children });
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
PopoverDescription.displayName = "XAUI.Popover.Description";
|
|
219
|
+
|
|
220
|
+
// src/components/popover/popover-overlay.tsx
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
|
|
226
|
+
var PopoverOverlay = _react.forwardRef.call(void 0,
|
|
227
|
+
function PopoverOverlay2({ children, isDismissable = true, style, ...props }, ref) {
|
|
228
|
+
const context = usePopover();
|
|
229
|
+
const { overlayStyle, isOpen, close } = context;
|
|
230
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
231
|
+
if (!isOpen) return null;
|
|
232
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
233
|
+
AnimatedPressable,
|
|
234
|
+
{
|
|
235
|
+
ref,
|
|
236
|
+
entering: _chunkEKS3W46Mcjs.overlayEntering,
|
|
237
|
+
exiting: _chunkEKS3W46Mcjs.overlayExiting,
|
|
238
|
+
accessibilityRole: "none",
|
|
239
|
+
importantForAccessibility: "no",
|
|
240
|
+
onPress: isDismissable ? close : void 0,
|
|
241
|
+
...rest,
|
|
242
|
+
style: [overlayStyle, styleProps, style],
|
|
243
|
+
children
|
|
244
|
+
}
|
|
245
|
+
) }) });
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
PopoverOverlay.displayName = "XAUI.Popover.Overlay";
|
|
249
|
+
|
|
250
|
+
// src/components/popover/popover-title.tsx
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
var PopoverTitle = _react.forwardRef.call(void 0,
|
|
255
|
+
function PopoverTitle2({ children, accessibilityRole = "header", style, ...props }, ref) {
|
|
256
|
+
const { titleStyle } = usePopover();
|
|
257
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
258
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
259
|
+
_reactnative.Text,
|
|
260
|
+
{
|
|
261
|
+
ref,
|
|
262
|
+
accessibilityRole,
|
|
263
|
+
...rest,
|
|
264
|
+
style: [titleStyle, styleProps, style],
|
|
265
|
+
children
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
PopoverTitle.displayName = "XAUI.Popover.Title";
|
|
271
|
+
|
|
272
|
+
// src/components/popover/popover-trigger.tsx
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
// src/hooks/use-anchor-ref.ts
|
|
276
|
+
|
|
277
|
+
function useAnchorRef({ isOpen, onAnchor, onLayout }) {
|
|
278
|
+
const node = _react.useRef.call(void 0, null);
|
|
279
|
+
const latest = _react.useRef.call(void 0, onAnchor);
|
|
280
|
+
latest.current = onAnchor;
|
|
281
|
+
const measure = _react.useCallback.call(void 0, () => {
|
|
282
|
+
_optionalChain([node, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.measureInWindow, 'call', _5 => _5((x, y, width, height) => {
|
|
283
|
+
latest.current({ x, y, width, height });
|
|
284
|
+
})]);
|
|
285
|
+
}, []);
|
|
286
|
+
const handleLayout = _react.useCallback.call(void 0,
|
|
287
|
+
(event) => {
|
|
288
|
+
_optionalChain([onLayout, 'optionalCall', _6 => _6(event)]);
|
|
289
|
+
measure();
|
|
290
|
+
},
|
|
291
|
+
[measure, onLayout]
|
|
292
|
+
);
|
|
293
|
+
_react.useEffect.call(void 0, () => {
|
|
294
|
+
if (isOpen) measure();
|
|
295
|
+
}, [isOpen, measure]);
|
|
296
|
+
return { node, measure, onLayout: handleLayout };
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// src/components/popover/popover-trigger.tsx
|
|
300
|
+
|
|
301
|
+
var PopoverTrigger = _react.forwardRef.call(void 0,
|
|
302
|
+
function PopoverTrigger2({
|
|
303
|
+
children,
|
|
304
|
+
asChild = false,
|
|
305
|
+
accessibilityRole = "button",
|
|
306
|
+
accessibilityState,
|
|
307
|
+
style,
|
|
308
|
+
onLayout,
|
|
309
|
+
onPress,
|
|
310
|
+
onPressIn,
|
|
311
|
+
onPressOut,
|
|
312
|
+
...props
|
|
313
|
+
}, ref) {
|
|
314
|
+
const { triggerStyle, isOpen, isDisabled, toggle, setAnchor } = usePopover();
|
|
315
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
316
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
317
|
+
const anchor = useAnchorRef({ isOpen, onAnchor: setAnchor, onLayout });
|
|
318
|
+
const refs = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, anchor.node, ref);
|
|
319
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
320
|
+
(event) => {
|
|
321
|
+
_optionalChain([onPress, 'optionalCall', _7 => _7(event)]);
|
|
322
|
+
anchor.measure();
|
|
323
|
+
toggle();
|
|
324
|
+
},
|
|
325
|
+
[anchor, onPress, toggle]
|
|
326
|
+
);
|
|
327
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
328
|
+
_chunkTGMVEHV7cjs.PressableFeedback,
|
|
329
|
+
{
|
|
330
|
+
ref: refs,
|
|
331
|
+
isPressed,
|
|
332
|
+
isDisabled,
|
|
333
|
+
asChild,
|
|
334
|
+
accessibilityRole,
|
|
335
|
+
accessibilityState: {
|
|
336
|
+
disabled: isDisabled,
|
|
337
|
+
expanded: isOpen,
|
|
338
|
+
...accessibilityState
|
|
339
|
+
},
|
|
340
|
+
...rest,
|
|
341
|
+
onLayout: anchor.onLayout,
|
|
342
|
+
style: [
|
|
343
|
+
triggerStyle,
|
|
344
|
+
styleProps,
|
|
345
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
346
|
+
],
|
|
347
|
+
onPress: handlePress,
|
|
348
|
+
onPressIn: press.onPressIn,
|
|
349
|
+
onPressOut: press.onPressOut,
|
|
350
|
+
children
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
PopoverTrigger.displayName = "XAUI.Popover.Trigger";
|
|
356
|
+
|
|
357
|
+
// src/components/popover/popover.tsx
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
function Popover({
|
|
361
|
+
children,
|
|
362
|
+
radius,
|
|
363
|
+
isOpen: controlledOpen,
|
|
364
|
+
defaultOpen = false,
|
|
365
|
+
onOpenChange,
|
|
366
|
+
isDisabled = false
|
|
367
|
+
}) {
|
|
368
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
369
|
+
const [anchor, setAnchor] = _react.useState.call(void 0, null);
|
|
370
|
+
const [isOpen, setOpen] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
371
|
+
value: controlledOpen,
|
|
372
|
+
defaultValue: defaultOpen,
|
|
373
|
+
onChange: onOpenChange
|
|
374
|
+
});
|
|
375
|
+
const styles = popoverRecipe.resolve({
|
|
376
|
+
theme,
|
|
377
|
+
selection: { radius },
|
|
378
|
+
states: { disabled: isDisabled }
|
|
379
|
+
});
|
|
380
|
+
const open = _react.useCallback.call(void 0, () => setOpen(true), [setOpen]);
|
|
381
|
+
const close = _react.useCallback.call(void 0, () => setOpen(false), [setOpen]);
|
|
382
|
+
const toggle = _react.useCallback.call(void 0, () => setOpen((current) => !current), [setOpen]);
|
|
383
|
+
const context = _react.useMemo.call(void 0,
|
|
384
|
+
() => ({
|
|
385
|
+
triggerStyle: styles.trigger,
|
|
386
|
+
overlayStyle: styles.overlay,
|
|
387
|
+
contentStyle: styles.content,
|
|
388
|
+
titleStyle: styles.title,
|
|
389
|
+
descriptionStyle: styles.description,
|
|
390
|
+
isOpen,
|
|
391
|
+
isDisabled,
|
|
392
|
+
open,
|
|
393
|
+
close,
|
|
394
|
+
toggle,
|
|
395
|
+
anchor,
|
|
396
|
+
setAnchor
|
|
397
|
+
}),
|
|
398
|
+
[styles, isOpen, isDisabled, open, close, toggle, anchor]
|
|
399
|
+
);
|
|
400
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverProvider, { value: context, children });
|
|
401
|
+
}
|
|
402
|
+
Popover.displayName = "XAUI.Popover.Root";
|
|
403
|
+
|
|
404
|
+
// src/components/popover/index.ts
|
|
405
|
+
var Popover2 = Object.assign(Popover, {
|
|
406
|
+
Trigger: PopoverTrigger,
|
|
407
|
+
Overlay: PopoverOverlay,
|
|
408
|
+
Content: PopoverContent,
|
|
409
|
+
Title: PopoverTitle,
|
|
410
|
+
Description: PopoverDescription,
|
|
411
|
+
Close: PopoverClose
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
exports.usePopover = usePopover; exports.PopoverClose = PopoverClose; exports.popoverRecipe = popoverRecipe; exports.PopoverContent = PopoverContent; exports.PopoverDescription = PopoverDescription; exports.PopoverOverlay = PopoverOverlay; exports.PopoverTitle = PopoverTitle; exports.PopoverTrigger = PopoverTrigger; exports.Popover = Popover; exports.Popover2 = Popover2;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import { mergeRefs } from "./chunk-36PRYGAM.js";
|
|
2
|
-
|
|
3
|
-
// src/hooks/use-merged-ref.ts
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
function useMergedRef(...refs) {
|
|
6
|
-
return useMemo(() => mergeRefs(...refs), refs);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
1
|
// src/hooks/use-previous.ts
|
|
10
2
|
import { useEffect, useRef } from "react";
|
|
11
3
|
function usePrevious(value) {
|
|
@@ -20,10 +12,10 @@ function usePrevious(value) {
|
|
|
20
12
|
import { useEffect as useEffect2 } from "react";
|
|
21
13
|
import { Easing, cancelAnimation, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from "react-native-reanimated";
|
|
22
14
|
var ROTATION_DURATION = 900;
|
|
23
|
-
const
|
|
24
|
-
code: "function
|
|
25
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
26
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
15
|
+
const _worklet_6356758416325_init_data = {
|
|
16
|
+
code: "function chunk3GFRSZYRJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
17
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-3GFRSZYR.js",
|
|
18
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk3GFRSZYRJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-3GFRSZYR.js\"],\"mappings\":\"AA+B0B,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE5B,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
27
19
|
};
|
|
28
20
|
function useRotation() {
|
|
29
21
|
const angle = useSharedValue(0);
|
|
@@ -34,29 +26,29 @@ function useRotation() {
|
|
|
34
26
|
}), -1, false);
|
|
35
27
|
return () => cancelAnimation(angle);
|
|
36
28
|
}, [angle]);
|
|
37
|
-
return useAnimatedStyle(function
|
|
38
|
-
|
|
29
|
+
return useAnimatedStyle(function chunk3GFRSZYRJs1Factory({
|
|
30
|
+
_worklet_6356758416325_init_data,
|
|
39
31
|
angle
|
|
40
32
|
}) {
|
|
41
33
|
const _e = [new global.Error(), -2, -27];
|
|
42
|
-
const
|
|
34
|
+
const chunk3GFRSZYRJs1 = function () {
|
|
43
35
|
return {
|
|
44
36
|
transform: [{
|
|
45
37
|
rotate: `${angle.value}deg`
|
|
46
38
|
}]
|
|
47
39
|
};
|
|
48
40
|
};
|
|
49
|
-
|
|
41
|
+
chunk3GFRSZYRJs1.__closure = {
|
|
50
42
|
angle
|
|
51
43
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
44
|
+
chunk3GFRSZYRJs1.__workletHash = 6356758416325;
|
|
45
|
+
chunk3GFRSZYRJs1.__pluginVersion = "0.7.4";
|
|
46
|
+
chunk3GFRSZYRJs1.__initData = _worklet_6356758416325_init_data;
|
|
47
|
+
chunk3GFRSZYRJs1.__stackDetails = _e;
|
|
48
|
+
return chunk3GFRSZYRJs1;
|
|
57
49
|
}({
|
|
58
|
-
|
|
50
|
+
_worklet_6356758416325_init_data,
|
|
59
51
|
angle
|
|
60
52
|
}), [angle]);
|
|
61
53
|
}
|
|
62
|
-
export {
|
|
54
|
+
export { usePrevious, ROTATION_DURATION, useRotation };
|