@hjmds/react-native 1.13.0 → 1.14.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/dist/agreement.d.ts.map +1 -1
- package/dist/agreement.js +22 -6
- package/dist/agreement.js.map +1 -1
- package/dist/content-transition.d.ts +3 -1
- package/dist/content-transition.d.ts.map +1 -1
- package/dist/content-transition.js +39 -7
- package/dist/content-transition.js.map +1 -1
- package/dist/data-display.d.ts +11 -1
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-display.js +13 -3
- package/dist/data-display.js.map +1 -1
- package/dist/date-entry.d.ts +7 -0
- package/dist/date-entry.d.ts.map +1 -0
- package/dist/date-entry.js +27 -0
- package/dist/date-entry.js.map +1 -0
- package/dist/document-resource.d.ts +3 -0
- package/dist/document-resource.d.ts.map +1 -0
- package/dist/document-resource.js +2 -0
- package/dist/document-resource.js.map +1 -0
- package/dist/effect-surface.js +3 -3
- package/dist/effect-surface.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/field-group.d.ts +21 -0
- package/dist/field-group.d.ts.map +1 -0
- package/dist/field-group.js +24 -0
- package/dist/field-group.js.map +1 -0
- package/dist/image-comparison.d.ts +10 -0
- package/dist/image-comparison.d.ts.map +1 -0
- package/dist/image-comparison.js +22 -0
- package/dist/image-comparison.js.map +1 -0
- package/dist/image-viewer.d.ts +29 -0
- package/dist/image-viewer.d.ts.map +1 -1
- package/dist/image-viewer.js +57 -23
- package/dist/image-viewer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inputs.d.ts +4 -0
- package/dist/inputs.d.ts.map +1 -1
- package/dist/inputs.js +102 -57
- package/dist/inputs.js.map +1 -1
- package/dist/internal/document-resource.d.ts +9 -0
- package/dist/internal/document-resource.d.ts.map +1 -0
- package/dist/internal/document-resource.js +14 -0
- package/dist/internal/document-resource.js.map +1 -0
- package/dist/internal/fixed-glyph.d.ts +11 -0
- package/dist/internal/fixed-glyph.d.ts.map +1 -0
- package/dist/internal/fixed-glyph.js +16 -0
- package/dist/internal/fixed-glyph.js.map +1 -0
- package/dist/internal/image-inspection.d.ts +43 -0
- package/dist/internal/image-inspection.d.ts.map +1 -0
- package/dist/internal/image-inspection.js +69 -0
- package/dist/internal/image-inspection.js.map +1 -0
- package/dist/internal/message-reactions.js +3 -3
- package/dist/internal/message-reactions.js.map +1 -1
- package/dist/overlays.d.ts +4 -1
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +77 -14
- package/dist/overlays.js.map +1 -1
- package/dist/progressive-blur.d.ts +13 -0
- package/dist/progressive-blur.d.ts.map +1 -0
- package/dist/progressive-blur.js +25 -0
- package/dist/progressive-blur.js.map +1 -0
- package/dist/rating.d.ts +14 -0
- package/dist/rating.d.ts.map +1 -0
- package/dist/rating.js +31 -0
- package/dist/rating.js.map +1 -0
- package/dist/screen-flows.d.ts +4 -1
- package/dist/screen-flows.d.ts.map +1 -1
- package/dist/screen-flows.js +18 -7
- package/dist/screen-flows.js.map +1 -1
- package/dist/screens.d.ts.map +1 -1
- package/dist/screens.js +2 -1
- package/dist/screens.js.map +1 -1
- package/dist/tags-input.d.ts.map +1 -1
- package/dist/tags-input.js +2 -1
- package/dist/tags-input.js.map +1 -1
- package/dist/task-list.d.ts +6 -1
- package/dist/task-list.d.ts.map +1 -1
- package/dist/task-list.js +8 -3
- package/dist/task-list.js.map +1 -1
- package/package.json +39 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ImageInspectionMode } from "@hjmds/design-contracts/components/image";
|
|
3
|
+
export type ImageViewerInspection = Readonly<{
|
|
4
|
+
mode: ImageInspectionMode;
|
|
5
|
+
onModeChange: (mode: ImageInspectionMode) => void;
|
|
6
|
+
labels: Readonly<{
|
|
7
|
+
mode: string;
|
|
8
|
+
fit: string;
|
|
9
|
+
double: string;
|
|
10
|
+
pixels: string;
|
|
11
|
+
left: string;
|
|
12
|
+
right: string;
|
|
13
|
+
up: string;
|
|
14
|
+
down: string;
|
|
15
|
+
center: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** Image-relative viewport offset and limits, in layout units; products localize the result. */
|
|
18
|
+
getPositionText: (position: Readonly<{
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
maxX: number;
|
|
22
|
+
maxY: number;
|
|
23
|
+
}>) => string;
|
|
24
|
+
}>;
|
|
25
|
+
/** Internal exact-size viewport; the parent owns lifetime, modes, feedback and image readiness. */
|
|
26
|
+
export declare function ImageInspection({ imageSize, config, controlsInset, feedbackLabels, renderImage }: {
|
|
27
|
+
imageSize: {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
config: ImageViewerInspection;
|
|
32
|
+
controlsInset: {
|
|
33
|
+
paddingLeft: number;
|
|
34
|
+
paddingRight: number;
|
|
35
|
+
};
|
|
36
|
+
feedbackLabels: {
|
|
37
|
+
loading: string;
|
|
38
|
+
error: string;
|
|
39
|
+
retry: string;
|
|
40
|
+
};
|
|
41
|
+
renderImage: (width: number, height: number, report: (status: "loading" | "ready" | "error") => void) => ReactNode;
|
|
42
|
+
}): import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=image-inspection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-inspection.d.ts","sourceRoot":"","sources":["../../src/internal/image-inspection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGnF,OAAO,EAAkC,KAAK,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAIpH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,YAAY,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD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s as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { AccessibilityInfo, Platform, View } from "react-native";
|
|
4
|
+
import { ResumableZoom } from "react-native-zoom-toolkit";
|
|
5
|
+
import { resolveImageInspectionGeometry } from "@hjmds/design-contracts/components/image";
|
|
6
|
+
import { Button } from "../actions.js";
|
|
7
|
+
import { Surface, Text } from "../primitives.js";
|
|
8
|
+
/** Internal exact-size viewport; the parent owns lifetime, modes, feedback and image readiness. */
|
|
9
|
+
export function ImageInspection({ imageSize, config, controlsInset, feedbackLabels, renderImage }) {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const [viewport, setViewport] = useState({ width: 0, height: 0 });
|
|
12
|
+
const [attempt, setAttempt] = useState(0);
|
|
13
|
+
const geometry = viewport.width > 0 && viewport.height > 0
|
|
14
|
+
? resolveImageInspectionGeometry(imageSize, viewport, config.mode) : null;
|
|
15
|
+
const key = JSON.stringify([viewport.width, viewport.height, config.mode, attempt]);
|
|
16
|
+
const identity = useMemo(() => ({}), [key]);
|
|
17
|
+
const active = useRef(null);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
active.current = identity;
|
|
20
|
+
return () => { active.current = null; };
|
|
21
|
+
}, [identity]);
|
|
22
|
+
const [reported, setReported] = useState(null);
|
|
23
|
+
const [position, setPosition] = useState({ identity, x: 0, y: 0 });
|
|
24
|
+
const status = reported?.identity === identity ? reported.status : "loading";
|
|
25
|
+
const ready = status === "ready";
|
|
26
|
+
function commitPosition(x, y) {
|
|
27
|
+
if (active.current !== identity)
|
|
28
|
+
return;
|
|
29
|
+
setPosition({ identity, x, y });
|
|
30
|
+
// iOS does not read React Native live regions; announce only completed user
|
|
31
|
+
// movements, never every animation frame or initial layout measurement.
|
|
32
|
+
if (Platform.OS === "ios")
|
|
33
|
+
AccessibilityInfo.announceForAccessibility(config.getPositionText({
|
|
34
|
+
x, y, maxX: geometry?.panBounds.x ?? 0, maxY: geometry?.panBounds.y ?? 0,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function move(dx, dy) {
|
|
38
|
+
const current = ref.current?.getState();
|
|
39
|
+
if (!current || !ready || !geometry)
|
|
40
|
+
return;
|
|
41
|
+
// Viewport-sized steps retain 20% context for inspecting seams; stepping a
|
|
42
|
+
// whole image width would skip detail. Physical directions do not mirror in RTL.
|
|
43
|
+
const x = Math.max(-geometry.panBounds.x, Math.min(geometry.panBounds.x, current.translateX - dx * viewport.width * 0.8));
|
|
44
|
+
const y = Math.max(-geometry.panBounds.y, Math.min(geometry.panBounds.y, current.translateY - dy * viewport.height * 0.8));
|
|
45
|
+
ref.current?.setTransformState({ translateX: x, translateY: y, scale: 1 }, false);
|
|
46
|
+
commitPosition(-x, -y);
|
|
47
|
+
}
|
|
48
|
+
function center() {
|
|
49
|
+
if (!ready)
|
|
50
|
+
return;
|
|
51
|
+
ref.current?.reset(false);
|
|
52
|
+
commitPosition(0, 0);
|
|
53
|
+
}
|
|
54
|
+
const positionText = config.getPositionText({ x: position.identity === identity ? position.x : 0,
|
|
55
|
+
y: position.identity === identity ? position.y : 0,
|
|
56
|
+
maxX: geometry?.panBounds.x ?? 0, maxY: geometry?.panBounds.y ?? 0 });
|
|
57
|
+
if (!positionText.trim())
|
|
58
|
+
throw new TypeError("Image inspection position text must not be empty");
|
|
59
|
+
return _jsxs(View, { style: { flex: 1, minHeight: 0 }, children: [_jsxs(View, { style: { flex: 1, minHeight: 0, overflow: "hidden" }, onLayout: event => {
|
|
60
|
+
const { width, height } = event.nativeEvent.layout;
|
|
61
|
+
if (width >= 0 && height >= 0)
|
|
62
|
+
setViewport({ width, height });
|
|
63
|
+
}, children: [geometry ? _jsx(ResumableZoom, { ref: ref, style: { flex: 1 }, minScale: 1, maxScale: 1, pinchEnabled: false, tapsEnabled: false, panEnabled: ready, panMode: "clamp", onGestureEnd: () => {
|
|
64
|
+
const current = ref.current?.getState();
|
|
65
|
+
if (current)
|
|
66
|
+
commitPosition(-current.translateX, -current.translateY);
|
|
67
|
+
}, children: renderImage(geometry.width, geometry.height, status => setReported({ identity, status })) }, key) : null, status !== "ready" ? _jsx(View, { pointerEvents: "box-none", style: { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, justifyContent: "center", alignItems: "center", ...controlsInset }, children: _jsxs(Surface, { padding: "md", children: [_jsx(Text, { accessibilityLiveRegion: status === "error" ? "assertive" : "polite", children: status === "error" ? feedbackLabels.error : feedbackLabels.loading }), status === "error" ? _jsx(Button, { growWithContent: true, onPress: () => setAttempt(value => value + 1), children: feedbackLabels.retry }) : null] }) }) : null] }), _jsxs(View, { style: controlsInset, children: [_jsxs(View, { style: { flexDirection: "row", flexWrap: "wrap" }, children: [_jsx(Button, { growWithContent: true, tone: "ghost", disabled: !ready || !geometry?.panBounds.x, onPress: () => move(-1, 0), children: config.labels.left }), _jsx(Button, { growWithContent: true, tone: "ghost", disabled: !ready || !geometry?.panBounds.x, onPress: () => move(1, 0), children: config.labels.right }), _jsx(Button, { growWithContent: true, tone: "ghost", disabled: !ready || !geometry?.panBounds.y, onPress: () => move(0, -1), children: config.labels.up }), _jsx(Button, { growWithContent: true, tone: "ghost", disabled: !ready || !geometry?.panBounds.y, onPress: () => move(0, 1), children: config.labels.down }), _jsx(Button, { growWithContent: true, tone: "ghost", disabled: !ready, onPress: center, children: config.labels.center })] }), _jsx(Text, { accessibilityLiveRegion: "polite", accessibilityLabel: positionText, numberOfLines: 1, variant: "caption", children: positionText })] })] });
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=image-inspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-inspection.js","sourceRoot":"","sources":["../../src/internal/image-inspection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EA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AAC,MAAM,IAAC,eAAe,QAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,YAAG,MAAM,CAAC,MAAM,CAAC,KAAK,GAAU,EAC1I,KAAC,MAAM,IAAC,eAAe,QAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAU,EACxI,KAAC,MAAM,IAAC,eAAe,QAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,YAAG,MAAM,CAAC,MAAM,CAAC,IAAI,GAAU,EACzI,KAAC,MAAM,IAAC,eAAe,QAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,YAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAU,IAClG,EAGP,KAAC,IAAI,IAAC,uBAAuB,EAAC,QAAQ,EAAC,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,EAAE,OAAO,EAAC,SAAS,YAAE,YAAY,GAAQ,IAC7H,IACF,CAAC;AACV,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { scrim } from "@hjmds/design-contracts/foundations";
|
|
|
5
5
|
import { screenPatternRecipe } from "@hjmds/design-contracts/screen-patterns";
|
|
6
6
|
import { useHjmNativeSafeAreaInsets, useHjmNativeTheme } from "../provider.js";
|
|
7
7
|
import { Button, IconButton } from "../actions.js";
|
|
8
|
-
import {
|
|
8
|
+
import { FixedGlyph } from "./fixed-glyph.js";
|
|
9
9
|
import { ReactionPicker } from "../reaction-picker.js";
|
|
10
10
|
/** Core RN composition: no optional context-menu/Expo dependency enters the screens subpath. */
|
|
11
11
|
export function MessageReactions({ children, closeLabel, replyAction, menuAction, interactiveContent = false, ...picker }) {
|
|
@@ -43,7 +43,7 @@ export function MessageReactions({ children, closeLabel, replyAction, menuAction
|
|
|
43
43
|
}
|
|
44
44
|
else if (!picker.disabled)
|
|
45
45
|
setAnchor(height / 2); }, children: children }), interactiveContent ? _jsx(IconButton, { label: picker.label, tone: "ghost", size: "small", disabled: picker.disabled ?? false, onPress: () => setAnchor(height / 2), accessibilityActions: replyAction && !replyAction.disabled ? [{ name: "reply", label: replyAction.label }] : [], onAccessibilityAction: event => { if (event.nativeEvent.actionName === "reply" && replyAction && !replyAction.disabled)
|
|
46
|
-
replyAction.onPress(); }, children: _jsx(
|
|
47
|
-
close(); }, style: { alignSelf: "flex-start", backgroundColor: colors.bg, borderRadius: tokens.radius.full }, children: _jsx(IconButton, { label: closeLabel, tone: "ghost", onPress: close, children: _jsx(
|
|
46
|
+
replyAction.onPress(); }, children: _jsx(FixedGlyph, { children: "\u00B7\u00B7\u00B7" }) }) : null, _jsx(Modal, { visible: open, transparent: true, statusBarTranslucent: true, animationType: environment.reducedMotion ? "none" : "fade", onRequestClose: close, onDismiss: () => { restore(); runQueuedAction(); }, onShow: focusPicker, children: _jsxs(View, { style: { flex: 1 }, children: [_jsx(Pressable, { accessible: false, importantForAccessibility: "no-hide-descendants", onPress: close, style: { position: "absolute", inset: 0, backgroundColor: scrim } }), _jsxs(View, { accessibilityViewIsModal: true, onAccessibilityEscape: close, style: { position: "absolute", top, left: tokens.spacing.md, width: Math.min(width - tokens.spacing.md * 2, screenPatternRecipe.reactionMenuWidth), gap: tokens.spacing.sm, maxHeight: Math.max(0, height - top - (insets.bottom ?? 0) - tokens.spacing.sm) }, children: [_jsxs(ScrollView, { style: { flexShrink: 1 }, contentContainerStyle: { gap: tokens.spacing.sm }, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, children: [_jsx(View, { style: { backgroundColor: colors.bg, borderRadius: picker.more ? tokens.radius.lg : tokens.radius.full, padding: tokens.spacing.xs }, children: _jsx(ReactionPicker, { ...picker, layout: "strip", onValueChange: value => { picker.onValueChange(value); close(); } }) }), _jsx(View, { style: { backgroundColor: colors.bg, borderRadius: tokens.radius.lg, padding: tokens.spacing.sm }, children: children }), menuAction ? _jsx(Button, { tone: "secondary", disabled: menuAction.disabled ?? false, onPress: () => { queuedAction.current = menuAction.onPress; close(); }, children: menuAction.label }) : null] }), _jsx(View, { ref: firstAction, accessible: true, accessibilityRole: "button", accessibilityLabel: closeLabel, accessibilityActions: [{ name: "activate" }], onAccessibilityAction: event => { if (event.nativeEvent.actionName === "activate")
|
|
47
|
+
close(); }, style: { alignSelf: "flex-start", backgroundColor: colors.bg, borderRadius: tokens.radius.full }, children: _jsx(IconButton, { label: closeLabel, tone: "ghost", onPress: close, children: _jsx(FixedGlyph, { children: "\u00D7" }) }) })] })] }) })] });
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=message-reactions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-reactions.js","sourceRoot":"","sources":["../../src/internal/message-reactions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACpI,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAA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YAChG,KAAC,UAAU,IAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,KAAK,YAAE,KAAC,UAAU,yBAAe,GAAa,GAC9F,IACF,IACF,GACD,IACP,CAAC;AACN,CAAC"}
|
package/dist/overlays.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TransitionRect } from "@hjmds/design-contracts/content-transition";
|
|
1
2
|
import { type AlertDialogOpenChangeReason, type AlertDialogRequest, type AlertDialogResult } from "@hjmds/design-contracts/components/alert-dialog";
|
|
2
3
|
import { type HjmCompositionStyleProp } from "./composition-style.js";
|
|
3
4
|
import { type SheetDismissPolicy, type SheetDismissReason, type SheetOpenChangeDetails } from "@hjmds/design-contracts/components/sheet";
|
|
@@ -59,6 +60,8 @@ export type DialogProps = NativeModalProps & ReasonedOpenProps<DialogOpenChangeR
|
|
|
59
60
|
onActionError?: (error: unknown) => void;
|
|
60
61
|
dismissible?: boolean;
|
|
61
62
|
busy?: boolean;
|
|
63
|
+
/** Trigger bounds measured in window coordinates immediately before opening. */
|
|
64
|
+
motionOrigin?: TransitionRect;
|
|
62
65
|
size?: DialogSize;
|
|
63
66
|
/** Localized accessible name for the close action. */
|
|
64
67
|
closeLabel: string;
|
|
@@ -67,7 +70,7 @@ export type DialogProps = NativeModalProps & ReasonedOpenProps<DialogOpenChangeR
|
|
|
67
70
|
contentStyle?: HjmCompositionStyleProp;
|
|
68
71
|
}>;
|
|
69
72
|
/** Native modal boundary with one reasoned close intent for each user attempt. */
|
|
70
|
-
export declare function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTitle, description, children, primaryAction, secondaryAction, dismissible, busy: externalBusy, onActionError, size, closeLabel, returnFocusRef, contentStyle, onShow, ...modalProps }: DialogProps): import("react").JSX.Element;
|
|
73
|
+
export declare function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTitle, description, children, primaryAction, secondaryAction, dismissible, busy: externalBusy, onActionError, size, motionOrigin, closeLabel, returnFocusRef, contentStyle, onShow, ...modalProps }: DialogProps): import("react").JSX.Element;
|
|
71
74
|
export type AlertDialogProps = NativeModalProps & ReasonedOpenProps<AlertDialogOpenChangeReason> & Readonly<{
|
|
72
75
|
request: AlertDialogRequest;
|
|
73
76
|
returnFocusRef?: RefObject<View | null>;
|
package/dist/overlays.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlays.d.ts","sourceRoot":"","sources":["../src/overlays.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEvB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAGL,WAAW,EACX,KAAK,UAAU,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"overlays.d.ts","sourceRoot":"","sources":["../src/overlays.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC1G,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEvB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAGL,WAAW,EACX,KAAK,UAAU,EAChB,MAAM,iCAAiC,CAAC;AACzC,O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AC;IACpC,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC,CAAC;AAEL,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,KAAK,EACL,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,MAAM,EACN,SAAoB,EACpB,IAAgC,EAChC,IAAY,EACZ,aAAa,EACb,UAAU,EACV,cAAc,EACd,cAAc,EAAE,sBAAsB,EACtC,iBAAiB,EACjB,YAAY,EACZ,iBAAyB,EACzB,UAAkB,EAClB,MAAM,EACN,GAAG,UAAU,EACd,EAAE,UAAU,+BAibZ"}
|
package/dist/overlays.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { resolveOriginTransition } from "@hjmds/design-contracts/content-transition";
|
|
2
3
|
import { createAlertDialogSession, getAlertDialogInitialFocus, validateAlertDialogRequest, } from "@hjmds/design-contracts/components/alert-dialog";
|
|
3
4
|
import { hjmCompositionStyleKeys } from "./composition-style.js";
|
|
4
5
|
import { canDismissSheet, createSheetLifecycle, sheetBehaviorDefaults, } from "@hjmds/design-contracts/components/sheet";
|
|
@@ -6,18 +7,17 @@ import { resolveColorReference } from "@hjmds/design-contracts/color-references"
|
|
|
6
7
|
import { backdrop, easing, glyph, radius, spacing } from "@hjmds/design-contracts/foundations";
|
|
7
8
|
import { alertDialogRecipe, dialogRecipe, sheetRecipe, } from "@hjmds/design-contracts/recipes";
|
|
8
9
|
import { useCallback, useEffect, useRef, useState, useSyncExternalStore, } from "react";
|
|
9
|
-
import { AccessibilityInfo, Animated, Easing, Keyboard, Modal, Platform, ScrollView,
|
|
10
|
+
import { AccessibilityInfo, Animated, Easing, Keyboard, Modal, Platform, ScrollView, Pressable, StyleSheet, View, findNodeHandle, useWindowDimensions, } from "react-native";
|
|
10
11
|
import { Button, IconButton } from "./actions.js";
|
|
11
12
|
import { scheduleAfterNativeModalTeardown, shouldAwaitNativeModalDismiss, } from "./internal/modal-lifecycle.js";
|
|
12
13
|
import { isDevelopment, warnDeprecatedStyleProps } from "./internal/deprecated-style.js";
|
|
14
|
+
import { FixedGlyph } from "./internal/fixed-glyph.js";
|
|
13
15
|
import { minimumTargetStyle } from "./internal/styles.js";
|
|
14
16
|
import { Text } from "./primitives.js";
|
|
15
17
|
import { useHjmNativeSafeAreaInsets, useHjmNativeTheme } from "./provider.js";
|
|
16
|
-
// A close glyph is icon artwork, not body copy
|
|
17
|
-
// even with allowFontScaling=false, which clipped × in the fixed icon frame at 200%.
|
|
18
|
+
// A close glyph is icon artwork, not body copy; FixedGlyph keeps it inside IconButton's fixed frame.
|
|
18
19
|
function CloseGlyph() {
|
|
19
|
-
|
|
20
|
-
return _jsx(NativeText, { accessible: false, allowFontScaling: false, style: { color: colors.text, fontSize: glyph.sm, lineHeight: glyph.sm }, children: "\u00D7" });
|
|
20
|
+
return _jsx(FixedGlyph, { fontSize: glyph.sm, children: "\u00D7" });
|
|
21
21
|
}
|
|
22
22
|
// BT-QA-027: maximum text made a centered BurnTok confirmation taller than the
|
|
23
23
|
// window, putting its title/cancel off-screen. Keep full copy in a bounded scroll
|
|
@@ -102,7 +102,7 @@ function resolveOverlayAccessibleTitle(title, accessibilityTitle) {
|
|
|
102
102
|
throw new TypeError("An element `title` requires `accessibilityTitle` for the modal accessible name");
|
|
103
103
|
}
|
|
104
104
|
/** Native modal boundary with one reasoned close intent for each user attempt. */
|
|
105
|
-
export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTitle, description, children, primaryAction, secondaryAction, dismissible = true, busy: externalBusy = false, onActionError, size = dialogRecipe.defaults.size, closeLabel, returnFocusRef, contentStyle, onShow, ...modalProps }) {
|
|
105
|
+
export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTitle, description, children, primaryAction, secondaryAction, dismissible = true, busy: externalBusy = false, onActionError, size = dialogRecipe.defaults.size, motionOrigin, closeLabel, returnFocusRef, contentStyle, onShow, ...modalProps }) {
|
|
106
106
|
const [actionPending, setActionPending] = useState(null);
|
|
107
107
|
const actionRun = useRef(null);
|
|
108
108
|
const busy = externalBusy || actionPending !== null;
|
|
@@ -141,14 +141,49 @@ export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTi
|
|
|
141
141
|
exitFallbackTask.current?.cancel();
|
|
142
142
|
exitFallbackTask.current = null;
|
|
143
143
|
}, []);
|
|
144
|
+
const originContentRef = useRef(null);
|
|
145
|
+
const originLayout = useRef(null);
|
|
146
|
+
const originRef = useRef(motionOrigin);
|
|
147
|
+
originRef.current = motionOrigin;
|
|
148
|
+
const measurementRun = useRef(0);
|
|
149
|
+
const measurementDeadline = useRef(null);
|
|
150
|
+
const [originTransform, setOriginTransform] = useState(null);
|
|
144
151
|
const startEnter = useCallback(() => {
|
|
152
|
+
const run = ++measurementRun.current;
|
|
153
|
+
if (measurementDeadline.current)
|
|
154
|
+
clearTimeout(measurementDeadline.current);
|
|
155
|
+
let measured = false;
|
|
145
156
|
motionProgress.stopAnimation();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
157
|
+
const play = (destination) => {
|
|
158
|
+
if (measured || run !== measurementRun.current || !visibleRef.current)
|
|
159
|
+
return;
|
|
160
|
+
measured = true;
|
|
161
|
+
if (measurementDeadline.current)
|
|
162
|
+
clearTimeout(measurementDeadline.current);
|
|
163
|
+
measurementDeadline.current = null;
|
|
164
|
+
setOriginTransform(resolveOriginTransition(originRef.current, destination, reducedMotionRef.current));
|
|
165
|
+
Animated.timing(motionProgress, {
|
|
166
|
+
toValue: 1,
|
|
167
|
+
duration: dialogRecipe.transition.enter.duration,
|
|
168
|
+
easing: Easing.bezier(...easing[dialogRecipe.transition.enter.easing]),
|
|
169
|
+
useNativeDriver: true,
|
|
170
|
+
}).start();
|
|
171
|
+
};
|
|
172
|
+
// Measure the actual modal window, never infer its center from the app window:
|
|
173
|
+
// safe areas and keyboards change the destination independently of the trigger.
|
|
174
|
+
if (originRef.current && !reducedMotionRef.current && originContentRef.current?.measureInWindow) {
|
|
175
|
+
// Optional geometry must not leave an invisible modal if a host drops the callback.
|
|
176
|
+
// Limit that wait to the existing enter interval; late results cannot restart it.
|
|
177
|
+
measurementDeadline.current = setTimeout(() => play(), dialogRecipe.transition.enter.duration);
|
|
178
|
+
try {
|
|
179
|
+
originContentRef.current.measureInWindow((x, y, width, height) => play({ x, y, width, height }));
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
play();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else
|
|
186
|
+
play();
|
|
152
187
|
}, [motionProgress]);
|
|
153
188
|
const completeExit = useCallback((token) => {
|
|
154
189
|
if (pendingExitRef.current?.token !== token)
|
|
@@ -169,6 +204,10 @@ export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTi
|
|
|
169
204
|
focusNativeTarget(returnFocusRef);
|
|
170
205
|
}, [cancelExitFallback, motionProgress, returnFocusRef, startEnter]);
|
|
171
206
|
const startExit = useCallback((token) => {
|
|
207
|
+
measurementRun.current += 1;
|
|
208
|
+
if (measurementDeadline.current)
|
|
209
|
+
clearTimeout(measurementDeadline.current);
|
|
210
|
+
measurementDeadline.current = null;
|
|
172
211
|
motionProgress.stopAnimation();
|
|
173
212
|
Animated.timing(motionProgress, {
|
|
174
213
|
toValue: 0,
|
|
@@ -224,6 +263,9 @@ export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTi
|
|
|
224
263
|
return cancelExitFallback;
|
|
225
264
|
}, [cancelExitFallback, completeExit, nativeVisible]);
|
|
226
265
|
useEffect(() => () => {
|
|
266
|
+
measurementRun.current += 1;
|
|
267
|
+
if (measurementDeadline.current)
|
|
268
|
+
clearTimeout(measurementDeadline.current);
|
|
227
269
|
cancelExitFallback();
|
|
228
270
|
motionProgress.stopAnimation();
|
|
229
271
|
}, [cancelExitFallback, motionProgress]);
|
|
@@ -282,7 +324,15 @@ export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTi
|
|
|
282
324
|
justifyContent: "center",
|
|
283
325
|
opacity: motionProgress,
|
|
284
326
|
...viewportPadding,
|
|
285
|
-
}, children: [_jsx(Scrim, {}), dismissible ? (_jsx(Pressable, { accessible: false, importantForAccessibility: "no-hide-descendants", onPress: () => requestClose("outside"), style: { bottom: 0, left: 0, position: "absolute", right: 0, top: 0 } })) : null, _jsxs(View, {
|
|
327
|
+
}, children: [_jsx(Scrim, {}), dismissible ? (_jsx(Pressable, { accessible: false, importantForAccessibility: "no-hide-descendants", onPress: () => requestClose("outside"), style: { bottom: 0, left: 0, position: "absolute", right: 0, top: 0 } })) : null, _jsxs(Animated.View, { ref: originContentRef, onLayout: (event) => {
|
|
328
|
+
const { width, height } = event.nativeEvent.layout;
|
|
329
|
+
const previous = originLayout.current;
|
|
330
|
+
originLayout.current = { width, height };
|
|
331
|
+
// Error copy, keyboard or rotation may change the destination after entry.
|
|
332
|
+
// Fade instead of returning through stale dimensions; a later open remeasures.
|
|
333
|
+
if (previous && (previous.width !== width || previous.height !== height))
|
|
334
|
+
setOriginTransform(null);
|
|
335
|
+
}, accessibilityLabel: [accessibleTitle, description].filter(Boolean).join(", "), accessibilityState: { busy }, accessibilityViewIsModal: true, importantForAccessibility: "yes", role: "dialog", style: [
|
|
286
336
|
{
|
|
287
337
|
alignSelf: "center",
|
|
288
338
|
backgroundColor: contentBackground,
|
|
@@ -301,6 +351,12 @@ export function Dialog({ open, defaultOpen, onOpenChange, title, accessibilityTi
|
|
|
301
351
|
shadowRadius: dialogRecipe.content.shadow.radius,
|
|
302
352
|
width: "100%",
|
|
303
353
|
},
|
|
354
|
+
originTransform && !environment.reducedMotion ? { transform: [
|
|
355
|
+
{ translateX: motionProgress.interpolate({ inputRange: [0, 1], outputRange: [originTransform.translateX, 0] }) },
|
|
356
|
+
{ translateY: motionProgress.interpolate({ inputRange: [0, 1], outputRange: [originTransform.translateY, 0] }) },
|
|
357
|
+
{ scaleX: motionProgress.interpolate({ inputRange: [0, 1], outputRange: [originTransform.scaleX, 1] }) },
|
|
358
|
+
{ scaleY: motionProgress.interpolate({ inputRange: [0, 1], outputRange: [originTransform.scaleY, 1] }) },
|
|
359
|
+
] } : undefined,
|
|
304
360
|
contentStyle,
|
|
305
361
|
], children: [_jsxs(View, { style: { flexShrink: 1, gap: description ? spacing.xs : dialogRecipe.content.gap }, children: [_jsxs(View, { style: {
|
|
306
362
|
alignItems: "flex-start",
|
|
@@ -841,6 +897,13 @@ export function Sheet({ open, defaultOpen, onOpenChange, title, accessibilityTit
|
|
|
841
897
|
inputRange: [0, 1],
|
|
842
898
|
outputRange: [hiddenTranslation, 0],
|
|
843
899
|
});
|
|
900
|
+
// A fixed-height sheet (side, or a `size` step) gives the body the height left after header and footer,
|
|
901
|
+
// as Web `.hjm-sheet__body { flex: 1 1 auto }` does, so a `flex: 1` child (a SearchScreen, a list) fills it.
|
|
902
|
+
// The content-sized body collapsed such a child to 0pt and only the search field painted (utilverse chat
|
|
903
|
+
// tool picker, 1.13.0 adoption 2026-10-06; the product patched it with a window-height flexBasis).
|
|
904
|
+
// `auto` stays content-sized: growing there has no free space to take. The ScrollView body grows too, so the
|
|
905
|
+
// footer sits at the bottom on both platforms; its content container does not, so scroll content keeps its height.
|
|
906
|
+
const bodyFill = side || sizeRatio !== null ? { flexGrow: 1, minHeight: 0 } : {};
|
|
844
907
|
const contentBackground = resolveColorReference(sheetRecipe.content.background, palette);
|
|
845
908
|
const contentBorder = resolveColorReference(sheetRecipe.content.border, palette);
|
|
846
909
|
return (_jsx(Modal, { ...modalProps, animationType: "none", onDismiss: () => {
|
|
@@ -910,7 +973,7 @@ export function Sheet({ open, defaultOpen, onOpenChange, title, accessibilityTit
|
|
|
910
973
|
direction: environment.direction,
|
|
911
974
|
flexDirection: "row",
|
|
912
975
|
gap: spacing.sm,
|
|
913
|
-
}, children: [_jsxs(View, { style: { flex: 1, gap: spacing.xs }, children: [_jsx(Text, { accessibilityRole: "header", tone: "primary", variant: "title", children: title }), description ? _jsx(Text, { tone: "muted", children: description }) : null] }), policy.dismissible ? (_jsx(IconButton, { disabled: busy && !policy.dismissWhileBusy, label: closeLabel, onPress: () => requestClose("close-action"), children: _jsx(CloseGlyph, {}) })) : null] }), scrollable ? (_jsx(ScrollView, { style: { flexShrink: 1, minHeight: 0 }, contentContainerStyle: { gap: sheetRecipe.body.gap }, keyboardShouldPersistTaps: "handled", keyboardDismissMode: Platform.OS === "ios" ? "interactive" : "on-drag", automaticallyAdjustKeyboardInsets: false, children: children })) : _jsx(View, { style: { gap: sheetRecipe.body.gap, flexShrink: 1 }, children: children }), footer ? (_jsx(View, { style: {
|
|
976
|
+
}, children: [_jsxs(View, { style: { flex: 1, gap: spacing.xs }, children: [_jsx(Text, { accessibilityRole: "header", tone: "primary", variant: "title", children: title }), description ? _jsx(Text, { tone: "muted", children: description }) : null] }), policy.dismissible ? (_jsx(IconButton, { disabled: busy && !policy.dismissWhileBusy, label: closeLabel, onPress: () => requestClose("close-action"), children: _jsx(CloseGlyph, {}) })) : null] }), scrollable ? (_jsx(ScrollView, { style: { flexShrink: 1, minHeight: 0, ...bodyFill }, contentContainerStyle: { gap: sheetRecipe.body.gap }, keyboardShouldPersistTaps: "handled", keyboardDismissMode: Platform.OS === "ios" ? "interactive" : "on-drag", automaticallyAdjustKeyboardInsets: false, children: children })) : _jsx(View, { style: { gap: sheetRecipe.body.gap, flexShrink: 1, ...bodyFill }, children: children }), footer ? (_jsx(View, { style: {
|
|
914
977
|
gap: sheetRecipe.footer.gap,
|
|
915
978
|
flexShrink: 0,
|
|
916
979
|
paddingTop: sheetRecipe.footer.paddingTop,
|