@hamster-note/components 0.2.1-beta.3 → 0.4.0-beta.0
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/README.md +341 -73
- package/dist/Icon-BuZRZcjv.js +1143 -0
- package/dist/button-mmBNcoG1.js +45 -0
- package/dist/button.js +1 -1
- package/dist/components/button/Button.d.ts +5 -3
- package/dist/components/dialog/Dialog.d.ts +3 -1
- package/dist/components/drawer/Drawer.d.ts +3 -1
- package/dist/components/icon/icon-names.d.ts +1 -15
- package/dist/components/menu/Menu.d.ts +11 -19
- package/dist/components/menu/Menu.placement.test.d.ts +1 -0
- package/dist/components/menu/MenuSubmenu.d.ts +13 -0
- package/dist/components/menu/MenuSurface.d.ts +12 -0
- package/dist/components/menu/menu-tree-context.d.ts +9 -0
- package/dist/components/popover/use-anchor-position.d.ts +16 -1
- package/dist/components/popover/use-anchor-position.test.d.ts +1 -0
- package/dist/components/theme/theme-context.d.ts +10 -0
- package/dist/components/theme/theme.d.ts +1 -87
- package/dist/{confirm-3eBmopl8.js → confirm-DKgVMWkR.js} +4 -5
- package/dist/confirm.js +1 -1
- package/dist/dialog-DI_yumUn.js +102 -0
- package/dist/dialog.js +1 -1
- package/dist/drawer-Cpe3Yf3K.js +120 -0
- package/dist/drawer.js +1 -1
- package/dist/hamster-note-components.css +1 -1
- package/dist/icon-u7jiIYal.js +5 -0
- package/dist/icon.js +2 -1
- package/dist/index.js +10 -9
- package/dist/menu-B4WwCQyw.js +179 -0
- package/dist/menu.js +1 -1
- package/dist/{popover-baLHE3lf.js → popover-D00SlGpL.js} +1 -1
- package/dist/popover.js +1 -1
- package/dist/shared/icon-names.d.ts +15 -0
- package/dist/shared/icons.d.ts +1216 -0
- package/dist/shared/theme.d.ts +87 -0
- package/dist/shared/tokens.d.ts +67 -0
- package/dist/test/fields-and-cards.test.d.ts +1 -0
- package/dist/test/imperative-apis.test.d.ts +1 -0
- package/dist/test/modals.test.d.ts +1 -0
- package/dist/test/primitives.test.d.ts +1 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/shared-data.test.d.ts +1 -0
- package/dist/test/theme-and-popover.test.d.ts +1 -0
- package/dist/{theme-C0p_hpKk.js → theme-DNK-xd31.js} +30 -22
- package/dist/theme-context-CdWvVVP8.js +8 -0
- package/dist/theme.js +1 -1
- package/dist/use-anchor-position-D3QBcIet.js +166 -0
- package/dist-native/badge.d.ts +10 -0
- package/dist-native/badge.js +7 -0
- package/dist-native/button.d.ts +16 -0
- package/dist-native/button.js +7 -0
- package/dist-native/chunk-6RD26X3W.js +78 -0
- package/dist-native/chunk-6SR5ZHDD.js +13 -0
- package/dist-native/chunk-6VYUVVCP.js +27 -0
- package/dist-native/chunk-7LN4VNRB.js +124 -0
- package/dist-native/chunk-CF76TWL4.js +85 -0
- package/dist-native/chunk-ENTYQ6M4.js +256 -0
- package/dist-native/chunk-GSG6CXIE.js +1688 -0
- package/dist-native/chunk-JHT74YG3.js +186 -0
- package/dist-native/chunk-KPDK62A5.js +106 -0
- package/dist-native/chunk-PLFX4RVR.js +134 -0
- package/dist-native/chunk-QUGLAOXA.js +49 -0
- package/dist-native/chunk-S2EUKEYI.js +35 -0
- package/dist-native/chunk-VTE5RPMO.js +38 -0
- package/dist-native/chunk-YJ4H3ZBQ.js +145 -0
- package/dist-native/chunk-ZTQATW6Y.js +127 -0
- package/dist-native/confirm.d.ts +24 -0
- package/dist-native/confirm.js +14 -0
- package/dist-native/dialog.d.ts +8 -0
- package/dist-native/dialog.js +10 -0
- package/dist-native/drawer.d.ts +13 -0
- package/dist-native/drawer.js +10 -0
- package/dist-native/focus-C0k0lLui.d.ts +9 -0
- package/dist-native/icon.d.ts +28 -0
- package/dist-native/icon.js +9 -0
- package/dist-native/index.d.ts +20 -0
- package/dist-native/index.js +84 -0
- package/dist-native/kbd.d.ts +9 -0
- package/dist-native/kbd.js +7 -0
- package/dist-native/loading.d.ts +19 -0
- package/dist-native/loading.js +11 -0
- package/dist-native/menu.d.ts +31 -0
- package/dist-native/menu.js +17 -0
- package/dist-native/modal-panel-BOpp1oRC.d.ts +23 -0
- package/dist-native/note-card.d.ts +13 -0
- package/dist-native/note-card.js +7 -0
- package/dist-native/popover.d.ts +34 -0
- package/dist-native/popover.js +8 -0
- package/dist-native/position-CkPoZ5AD.d.ts +3 -0
- package/dist-native/text-field.d.ts +13 -0
- package/dist-native/text-field.js +7 -0
- package/dist-native/theme.d.ts +120 -0
- package/dist-native/theme.js +16 -0
- package/dist-native/tokens-DHoNd-yT.d.ts +41 -0
- package/package.json +151 -6
- package/dist/button-DRz0VTkf.js +0 -18
- package/dist/dialog-B4xS5zlK.js +0 -53
- package/dist/drawer-DoeuGAHD.js +0 -60
- package/dist/icon-DNZLJUqH.js +0 -517
- package/dist/menu-Dj-Dje_l.js +0 -153
- package/dist/use-anchor-position-DWle8yoL.js +0 -87
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// native/modal-lifecycle.ts
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { Platform as Platform2 } from "react-native";
|
|
4
|
+
|
|
5
|
+
// native/focus.ts
|
|
6
|
+
import { AccessibilityInfo, Platform, findNodeHandle } from "react-native";
|
|
7
|
+
function focusTarget(ref) {
|
|
8
|
+
const node = ref?.current;
|
|
9
|
+
if (!node) return false;
|
|
10
|
+
if (Platform.OS === "web") {
|
|
11
|
+
if (!node.focus) return false;
|
|
12
|
+
node.focus();
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
const handle = findNodeHandle(node);
|
|
16
|
+
if (handle == null) return false;
|
|
17
|
+
node.focus?.();
|
|
18
|
+
AccessibilityInfo.setAccessibilityFocus(handle);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// native/modal-lifecycle.ts
|
|
23
|
+
function useModalLifecycle({
|
|
24
|
+
open,
|
|
25
|
+
onClose,
|
|
26
|
+
onBack,
|
|
27
|
+
focusKey = "",
|
|
28
|
+
triggerRef,
|
|
29
|
+
fallbackFocusRef,
|
|
30
|
+
initialFocusRef
|
|
31
|
+
}) {
|
|
32
|
+
const titleRef = useRef(null);
|
|
33
|
+
const closeRef = useRef(null);
|
|
34
|
+
const mounted = useRef(true);
|
|
35
|
+
const closeRequested = useRef(false);
|
|
36
|
+
const generation = useRef(0);
|
|
37
|
+
const frames = useRef(/* @__PURE__ */ new Set());
|
|
38
|
+
const wasOpen = useRef(false);
|
|
39
|
+
const shown = useRef(false);
|
|
40
|
+
const laidOut = useRef(false);
|
|
41
|
+
const focusedKey = useRef(null);
|
|
42
|
+
const liveOpen = useRef(open);
|
|
43
|
+
liveOpen.current = open;
|
|
44
|
+
const focusTargets = useRef({ initialFocusRef, triggerRef, fallbackFocusRef, focusKey });
|
|
45
|
+
focusTargets.current = { initialFocusRef, triggerRef, fallbackFocusRef, focusKey };
|
|
46
|
+
const schedule = useCallback((fn) => {
|
|
47
|
+
if (!mounted.current) return;
|
|
48
|
+
const epoch = generation.current;
|
|
49
|
+
const id = requestAnimationFrame(() => {
|
|
50
|
+
frames.current.delete(id);
|
|
51
|
+
if (mounted.current && generation.current === epoch) fn();
|
|
52
|
+
});
|
|
53
|
+
frames.current.add(id);
|
|
54
|
+
}, []);
|
|
55
|
+
const enterFocus = useCallback(() => {
|
|
56
|
+
const key = focusTargets.current.focusKey;
|
|
57
|
+
if (shown.current && laidOut.current && liveOpen.current && focusedKey.current !== key)
|
|
58
|
+
schedule(() => {
|
|
59
|
+
if (!liveOpen.current || focusTargets.current.focusKey !== key || focusedKey.current === key)
|
|
60
|
+
return;
|
|
61
|
+
focusedKey.current = key;
|
|
62
|
+
if (!focusTarget(focusTargets.current.initialFocusRef))
|
|
63
|
+
focusTarget(titleRef) || focusTarget(closeRef);
|
|
64
|
+
});
|
|
65
|
+
}, [schedule]);
|
|
66
|
+
const restore = useCallback(() => {
|
|
67
|
+
if (!liveOpen.current)
|
|
68
|
+
schedule(() => {
|
|
69
|
+
if (!liveOpen.current)
|
|
70
|
+
focusTarget(focusTargets.current.triggerRef) || focusTarget(focusTargets.current.fallbackFocusRef);
|
|
71
|
+
});
|
|
72
|
+
}, [schedule]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
mounted.current = true;
|
|
75
|
+
return () => {
|
|
76
|
+
mounted.current = false;
|
|
77
|
+
generation.current++;
|
|
78
|
+
frames.current.forEach(cancelAnimationFrame);
|
|
79
|
+
frames.current.clear();
|
|
80
|
+
};
|
|
81
|
+
}, []);
|
|
82
|
+
useLayoutEffect(() => {
|
|
83
|
+
generation.current++;
|
|
84
|
+
frames.current.forEach(cancelAnimationFrame);
|
|
85
|
+
frames.current.clear();
|
|
86
|
+
if (open) {
|
|
87
|
+
closeRequested.current = false;
|
|
88
|
+
wasOpen.current = true;
|
|
89
|
+
shown.current = false;
|
|
90
|
+
laidOut.current = false;
|
|
91
|
+
focusedKey.current = null;
|
|
92
|
+
} else if (wasOpen.current) {
|
|
93
|
+
wasOpen.current = false;
|
|
94
|
+
if (Platform2.OS !== "ios") restore();
|
|
95
|
+
}
|
|
96
|
+
}, [open, restore]);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (open) enterFocus();
|
|
99
|
+
}, [focusKey, open, enterFocus]);
|
|
100
|
+
const requestClose = () => {
|
|
101
|
+
if (!mounted.current || !liveOpen.current || closeRequested.current) return;
|
|
102
|
+
if (onBack?.()) return;
|
|
103
|
+
closeRequested.current = true;
|
|
104
|
+
onClose();
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
titleRef,
|
|
108
|
+
closeRef,
|
|
109
|
+
requestClose,
|
|
110
|
+
onShow() {
|
|
111
|
+
shown.current = true;
|
|
112
|
+
enterFocus();
|
|
113
|
+
},
|
|
114
|
+
onLayout() {
|
|
115
|
+
laidOut.current = true;
|
|
116
|
+
enterFocus();
|
|
117
|
+
},
|
|
118
|
+
onDismiss: restore
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
useModalLifecycle
|
|
124
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useTheme
|
|
3
|
+
} from "./chunk-YJ4H3ZBQ.js";
|
|
4
|
+
|
|
5
|
+
// native/text-field.tsx
|
|
6
|
+
import { forwardRef, useEffect, useId } from "react";
|
|
7
|
+
import {
|
|
8
|
+
AccessibilityInfo,
|
|
9
|
+
Text,
|
|
10
|
+
TextInput,
|
|
11
|
+
View
|
|
12
|
+
} from "react-native";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var TextField = forwardRef(function TextField2({
|
|
15
|
+
label,
|
|
16
|
+
hint,
|
|
17
|
+
error,
|
|
18
|
+
disabled,
|
|
19
|
+
containerStyle,
|
|
20
|
+
style,
|
|
21
|
+
accessibilityLabel,
|
|
22
|
+
accessibilityHint,
|
|
23
|
+
editable,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) {
|
|
26
|
+
const t = useTheme();
|
|
27
|
+
const id = useId();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (error) AccessibilityInfo.announceForAccessibility(error);
|
|
30
|
+
}, [error]);
|
|
31
|
+
return /* @__PURE__ */ jsxs(View, { style: [{ gap: t.spacing.fieldGap, alignSelf: "stretch" }, containerStyle], children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
Text,
|
|
34
|
+
{
|
|
35
|
+
nativeID: id,
|
|
36
|
+
style: { color: t.colors.text, fontSize: t.fontSize.small, fontWeight: "600" },
|
|
37
|
+
children: label
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
TextInput,
|
|
42
|
+
{
|
|
43
|
+
...props,
|
|
44
|
+
ref,
|
|
45
|
+
editable: disabled ? false : editable,
|
|
46
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
47
|
+
accessibilityHint: error || accessibilityHint || hint,
|
|
48
|
+
accessibilityState: {
|
|
49
|
+
...props.accessibilityState,
|
|
50
|
+
disabled: Boolean(disabled || editable === false)
|
|
51
|
+
},
|
|
52
|
+
placeholderTextColor: t.colors.textMuted,
|
|
53
|
+
style: [
|
|
54
|
+
{
|
|
55
|
+
minHeight: 44,
|
|
56
|
+
color: t.colors.text,
|
|
57
|
+
backgroundColor: t.colors.surface,
|
|
58
|
+
borderWidth: 1,
|
|
59
|
+
borderColor: error ? t.colors.danger : t.colors.border,
|
|
60
|
+
borderRadius: t.radius.medium,
|
|
61
|
+
padding: t.spacing.fieldPadding,
|
|
62
|
+
fontSize: t.fontSize.large,
|
|
63
|
+
opacity: disabled ? 0.48 : 1
|
|
64
|
+
},
|
|
65
|
+
style
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
error || hint ? /* @__PURE__ */ jsx(
|
|
70
|
+
Text,
|
|
71
|
+
{
|
|
72
|
+
accessibilityLiveRegion: error ? "polite" : "none",
|
|
73
|
+
style: {
|
|
74
|
+
color: error ? t.colors.danger : t.colors.textMuted,
|
|
75
|
+
fontSize: t.fontSize.small
|
|
76
|
+
},
|
|
77
|
+
children: error || hint
|
|
78
|
+
}
|
|
79
|
+
) : null
|
|
80
|
+
] });
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
TextField
|
|
85
|
+
};
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useModalLifecycle
|
|
3
|
+
} from "./chunk-7LN4VNRB.js";
|
|
4
|
+
import {
|
|
5
|
+
ThemeProvider,
|
|
6
|
+
useTheme
|
|
7
|
+
} from "./chunk-YJ4H3ZBQ.js";
|
|
8
|
+
|
|
9
|
+
// native/popover.tsx
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import {
|
|
12
|
+
Keyboard,
|
|
13
|
+
Modal,
|
|
14
|
+
Platform,
|
|
15
|
+
Pressable,
|
|
16
|
+
ScrollView,
|
|
17
|
+
StatusBar,
|
|
18
|
+
StyleSheet,
|
|
19
|
+
Text,
|
|
20
|
+
View,
|
|
21
|
+
useWindowDimensions
|
|
22
|
+
} from "react-native";
|
|
23
|
+
|
|
24
|
+
// native/position.ts
|
|
25
|
+
function placePanel(anchor, panel, bounds, placement, offset) {
|
|
26
|
+
let x = bounds.x + (bounds.width - panel.width) / 2;
|
|
27
|
+
let y = bounds.y + (bounds.height - panel.height) / 2;
|
|
28
|
+
if (anchor && [anchor.x, anchor.y, anchor.width, anchor.height].every(Number.isFinite) && anchor.width > 0 && anchor.height > 0) {
|
|
29
|
+
x = anchor.x + (anchor.width - panel.width) / 2;
|
|
30
|
+
y = anchor.y + (anchor.height - panel.height) / 2;
|
|
31
|
+
if (placement === "bottom" || placement === "top") {
|
|
32
|
+
const below = anchor.y + anchor.height + offset;
|
|
33
|
+
const above = anchor.y - panel.height - offset;
|
|
34
|
+
const fitsBelow = below + panel.height <= bounds.y + bounds.height;
|
|
35
|
+
const fitsAbove = above >= bounds.y;
|
|
36
|
+
y = placement === "bottom" ? fitsBelow || !fitsAbove ? below : above : fitsAbove || !fitsBelow ? above : below;
|
|
37
|
+
} else {
|
|
38
|
+
const right = anchor.x + anchor.width + offset;
|
|
39
|
+
const left = anchor.x - panel.width - offset;
|
|
40
|
+
const fitsRight = right + panel.width <= bounds.x + bounds.width;
|
|
41
|
+
const fitsLeft = left >= bounds.x;
|
|
42
|
+
x = placement === "right" ? fitsRight || !fitsLeft ? right : left : fitsLeft || !fitsRight ? left : right;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
left: Math.max(bounds.x, Math.min(x, bounds.x + bounds.width - panel.width)),
|
|
47
|
+
top: Math.max(bounds.y, Math.min(y, bounds.y + bounds.height - panel.height))
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// native/popover.tsx
|
|
52
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
53
|
+
function Popover({
|
|
54
|
+
open,
|
|
55
|
+
onClose,
|
|
56
|
+
children,
|
|
57
|
+
accessibilityLabel,
|
|
58
|
+
anchorRef,
|
|
59
|
+
triggerRef,
|
|
60
|
+
fallbackFocusRef,
|
|
61
|
+
initialFocusRef,
|
|
62
|
+
placement = "bottom",
|
|
63
|
+
anchorOffset = 8,
|
|
64
|
+
viewportMargin = 12,
|
|
65
|
+
safeAreaInsets,
|
|
66
|
+
style,
|
|
67
|
+
onBack,
|
|
68
|
+
focusKey = "",
|
|
69
|
+
closeLabel = "\u5173\u95ED"
|
|
70
|
+
}) {
|
|
71
|
+
const theme = useTheme();
|
|
72
|
+
const dimensions = useWindowDimensions();
|
|
73
|
+
const modal = useModalLifecycle({
|
|
74
|
+
open,
|
|
75
|
+
onClose,
|
|
76
|
+
onBack,
|
|
77
|
+
focusKey,
|
|
78
|
+
initialFocusRef,
|
|
79
|
+
triggerRef,
|
|
80
|
+
fallbackFocusRef
|
|
81
|
+
});
|
|
82
|
+
const [anchor, setAnchor] = useState(null);
|
|
83
|
+
const [panel, setPanel] = useState({ width: 280, height: 100 });
|
|
84
|
+
const [keyboardTop, setKeyboardTop] = useState(null);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!open) {
|
|
87
|
+
setKeyboardTop(null);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setKeyboardTop(Keyboard.metrics?.()?.screenY ?? null);
|
|
91
|
+
const show = Keyboard.addListener(
|
|
92
|
+
"keyboardDidShow",
|
|
93
|
+
(e) => setKeyboardTop(e.endCoordinates.screenY)
|
|
94
|
+
);
|
|
95
|
+
const hide = Keyboard.addListener("keyboardDidHide", () => setKeyboardTop(null));
|
|
96
|
+
return () => {
|
|
97
|
+
show.remove();
|
|
98
|
+
hide.remove();
|
|
99
|
+
};
|
|
100
|
+
}, [open]);
|
|
101
|
+
const insets = safeAreaInsets ?? {
|
|
102
|
+
top: Platform.OS === "android" ? StatusBar.currentHeight ?? 0 : 0,
|
|
103
|
+
right: 0,
|
|
104
|
+
bottom: 0,
|
|
105
|
+
left: 0
|
|
106
|
+
};
|
|
107
|
+
const bounds = {
|
|
108
|
+
x: insets.left + viewportMargin,
|
|
109
|
+
y: insets.top + viewportMargin,
|
|
110
|
+
width: Math.max(1, dimensions.width - insets.left - insets.right - 2 * viewportMargin),
|
|
111
|
+
height: Math.max(
|
|
112
|
+
1,
|
|
113
|
+
Math.min(dimensions.height - insets.bottom, keyboardTop ?? dimensions.height) - insets.top - 2 * viewportMargin
|
|
114
|
+
)
|
|
115
|
+
};
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!open) return;
|
|
118
|
+
let active = true;
|
|
119
|
+
const node = anchorRef?.current;
|
|
120
|
+
setAnchor(null);
|
|
121
|
+
node?.measureInWindow?.((x, y, width, height) => {
|
|
122
|
+
if (active && anchorRef?.current === node) setAnchor({ x, y, width, height });
|
|
123
|
+
});
|
|
124
|
+
return () => {
|
|
125
|
+
active = false;
|
|
126
|
+
};
|
|
127
|
+
}, [
|
|
128
|
+
open,
|
|
129
|
+
anchorRef,
|
|
130
|
+
dimensions.width,
|
|
131
|
+
dimensions.height,
|
|
132
|
+
keyboardTop,
|
|
133
|
+
insets.top,
|
|
134
|
+
insets.right,
|
|
135
|
+
insets.bottom,
|
|
136
|
+
insets.left,
|
|
137
|
+
focusKey
|
|
138
|
+
]);
|
|
139
|
+
const position = placePanel(
|
|
140
|
+
anchorRef?.current ? anchor : null,
|
|
141
|
+
{ width: Math.min(panel.width, bounds.width), height: Math.min(panel.height, bounds.height) },
|
|
142
|
+
bounds,
|
|
143
|
+
placement,
|
|
144
|
+
anchorOffset
|
|
145
|
+
);
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
Modal,
|
|
148
|
+
{
|
|
149
|
+
visible: open,
|
|
150
|
+
transparent: true,
|
|
151
|
+
animationType: "none",
|
|
152
|
+
statusBarTranslucent: true,
|
|
153
|
+
onShow: modal.onShow,
|
|
154
|
+
onDismiss: modal.onDismiss,
|
|
155
|
+
onRequestClose: modal.requestClose,
|
|
156
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs(
|
|
157
|
+
View,
|
|
158
|
+
{
|
|
159
|
+
style: StyleSheet.absoluteFill,
|
|
160
|
+
accessibilityViewIsModal: true,
|
|
161
|
+
onAccessibilityEscape: modal.requestClose,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsx(
|
|
164
|
+
Pressable,
|
|
165
|
+
{
|
|
166
|
+
accessible: false,
|
|
167
|
+
importantForAccessibility: "no",
|
|
168
|
+
style: [StyleSheet.absoluteFill, { backgroundColor: "rgba(0,0,0,0.2)" }],
|
|
169
|
+
onPress: modal.requestClose
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ jsxs(
|
|
173
|
+
View,
|
|
174
|
+
{
|
|
175
|
+
onLayout: (e) => {
|
|
176
|
+
setPanel(e.nativeEvent.layout);
|
|
177
|
+
modal.onLayout();
|
|
178
|
+
},
|
|
179
|
+
style: [
|
|
180
|
+
{
|
|
181
|
+
position: "absolute",
|
|
182
|
+
width: Math.min(320, bounds.width),
|
|
183
|
+
maxWidth: bounds.width,
|
|
184
|
+
maxHeight: bounds.height,
|
|
185
|
+
backgroundColor: theme.colors.surface,
|
|
186
|
+
borderRadius: theme.radius.large,
|
|
187
|
+
borderWidth: 1,
|
|
188
|
+
borderColor: theme.colors.border,
|
|
189
|
+
zIndex: theme.layer.popover,
|
|
190
|
+
padding: theme.spacing.panelPadding
|
|
191
|
+
},
|
|
192
|
+
style,
|
|
193
|
+
{ ...position, maxWidth: bounds.width, maxHeight: bounds.height }
|
|
194
|
+
],
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsxs(
|
|
197
|
+
View,
|
|
198
|
+
{
|
|
199
|
+
style: {
|
|
200
|
+
flexDirection: "row",
|
|
201
|
+
alignItems: "center",
|
|
202
|
+
justifyContent: "space-between"
|
|
203
|
+
},
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
Text,
|
|
207
|
+
{
|
|
208
|
+
...Platform.OS === "web" ? { tabIndex: -1 } : {},
|
|
209
|
+
ref: modal.titleRef,
|
|
210
|
+
accessible: true,
|
|
211
|
+
accessibilityRole: "header",
|
|
212
|
+
style: { color: theme.colors.text, fontSize: theme.fontSize.large, flexShrink: 1 },
|
|
213
|
+
children: accessibilityLabel
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
Pressable,
|
|
218
|
+
{
|
|
219
|
+
ref: modal.closeRef,
|
|
220
|
+
accessibilityRole: "button",
|
|
221
|
+
accessibilityLabel: closeLabel,
|
|
222
|
+
onPress: modal.requestClose,
|
|
223
|
+
style: {
|
|
224
|
+
minWidth: 44,
|
|
225
|
+
minHeight: 44,
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
justifyContent: "center"
|
|
228
|
+
},
|
|
229
|
+
children: /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.text }, children: "\xD7" })
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
ScrollView,
|
|
237
|
+
{
|
|
238
|
+
keyboardShouldPersistTaps: "handled",
|
|
239
|
+
style: { flexShrink: 1 },
|
|
240
|
+
contentContainerStyle: { gap: 4 },
|
|
241
|
+
children
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
) })
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export {
|
|
255
|
+
Popover
|
|
256
|
+
};
|