@hzblj/kara-components 0.15.2 → 0.16.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/CHANGELOG.md +33 -0
- package/lib/module/atoms/h-stack/h-stack.ios.js +2 -2
- package/lib/module/atoms/h-stack/h-stack.ios.js.map +1 -1
- package/lib/module/atoms/v-stack/v-stack.ios.js +2 -2
- package/lib/module/atoms/v-stack/v-stack.ios.js.map +1 -1
- package/lib/module/atoms/z-stack/z-stack.ios.js +2 -2
- package/lib/module/atoms/z-stack/z-stack.ios.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.android.js +4 -1
- package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.ios.js +11 -0
- package/lib/module/organisms/context-menu/context-menu.ios.js.map +1 -1
- package/lib/module/tap-modifiers.js +11 -0
- package/lib/module/tap-modifiers.js.map +1 -0
- package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +12 -0
- package/lib/typescript/tap-modifiers.d.ts +7 -0
- package/package.json +4 -4
- package/src/atoms/h-stack/h-stack.ios.tsx +2 -2
- package/src/atoms/v-stack/v-stack.ios.tsx +2 -2
- package/src/atoms/z-stack/z-stack.ios.tsx +2 -2
- package/src/organisms/context-menu/context-menu.android.tsx +10 -2
- package/src/organisms/context-menu/context-menu.ios.tsx +16 -0
- package/src/organisms/context-menu/context-menu.types.ts +12 -0
- package/src/tap-modifiers.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @hzblj/kara-components
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#49](https://github.com/hzblj/kara-ui/pull/49) [`1b82690`](https://github.com/hzblj/kara-ui/commit/1b826908a729399b4b9ef8038836b60539d1fa41) Thanks [@hzblj](https://github.com/hzblj)! - A tapped `ContextMenu` preview can morph into a screen that is already loaded, the way Apple's apps open a preview. Preload the detail in the new `onOpenChange` (React Navigation's `preload`) and pass its route key as `preloadedScreenId`: the screen is pushed natively in the same frame, and with `zoom` the whole preview grows into it, rounded and shadowed like the menu's platter, while the menu fades away. `pop` and `dismiss` push it as soon as UIKit's commit animation ends. Uses `@hzblj/expo-zoom-transition` 0.2.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`1b82690`](https://github.com/hzblj/kara-ui/commit/1b826908a729399b4b9ef8038836b60539d1fa41)]:
|
|
12
|
+
- @hzblj/kara-native@0.16.0
|
|
13
|
+
- @hzblj/kara-sx@0.16.0
|
|
14
|
+
- @hzblj/kara-theme@0.16.0
|
|
15
|
+
|
|
16
|
+
## 0.15.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`15aa9db`](https://github.com/hzblj/kara-ui/commit/15aa9db0b1c22dd4a55cb301982643449ad28dd0)]:
|
|
21
|
+
- @hzblj/kara-native@0.15.4
|
|
22
|
+
- @hzblj/kara-theme@0.15.4
|
|
23
|
+
- @hzblj/kara-sx@0.15.4
|
|
24
|
+
|
|
25
|
+
## 0.15.3
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [`91f4285`](https://github.com/hzblj/kara-ui/commit/91f42856d2acc0d03fb9836a718c5deba758a29f) Thanks [@hzblj](https://github.com/hzblj)! - A pressable `HStack`, `VStack` or `ZStack` on iOS now takes a tap anywhere in its frame, padding and a `Spacer`'s gap included, as it already did on Android. Before, a `LabeledContent` row pressed in its empty middle did nothing.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies []:
|
|
32
|
+
- @hzblj/kara-theme@0.15.3
|
|
33
|
+
- @hzblj/kara-sx@0.15.3
|
|
34
|
+
- @hzblj/kara-native@0.15.3
|
|
35
|
+
|
|
3
36
|
## 0.15.2
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { HStack as SwiftUIHStack } from '@expo/ui/swift-ui';
|
|
4
|
-
import { onTapGesture } from '@expo/ui/swift-ui/modifiers';
|
|
5
4
|
import { splitAccessibility, useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
|
|
6
5
|
import { spacing } from '@hzblj/kara-theme';
|
|
7
6
|
import { useMemo } from 'react';
|
|
8
7
|
import { useHostGuard } from "../../host-context.js";
|
|
8
|
+
import { tapModifiers } from "../../tap-modifiers.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const ALIGNMENT = {
|
|
11
11
|
center: 'center',
|
|
@@ -29,7 +29,7 @@ export const HStack = ({
|
|
|
29
29
|
const [accessibility, sx] = splitAccessibility(props);
|
|
30
30
|
const sxModifiers = useSxModifiers(sx, FRAME_ALIGNMENT[align]);
|
|
31
31
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined);
|
|
32
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(onPress
|
|
32
|
+
const modifiers = useMemo(() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers], [accessibilityModifiers, onPress, sxModifiers]);
|
|
33
33
|
return /*#__PURE__*/_jsx(SwiftUIHStack, {
|
|
34
34
|
alignment: ALIGNMENT[align],
|
|
35
35
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HStack","SwiftUIHStack","
|
|
1
|
+
{"version":3,"names":["HStack","SwiftUIHStack","splitAccessibility","useAccessibilityModifiers","useSxModifiers","spacing","useMemo","useHostGuard","tapModifiers","jsx","_jsx","ALIGNMENT","center","end","start","FRAME_ALIGNMENT","align","children","onPress","gap","testID","props","accessibility","sx","sxModifiers","accessibilityModifiers","undefined","modifiers","alignment"],"sourceRoot":"../../../../src","sources":["atoms/h-stack/h-stack.ios.tsx"],"mapp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AAEA,SAAU;IACrBtB,OAAO,EAAEc,GAAG,KAAKO,SAAS,GAAGA,SAAS,GAAGrB,OAAO,CAACc,GAAG,CAAE;IACtDC,MAAM,EAAEA,MAAO;IAAAH,QAAA,EAEdA;EAAQ,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { VStack as SwiftUIVStack } from '@expo/ui/swift-ui';
|
|
4
|
-
import { onTapGesture } from '@expo/ui/swift-ui/modifiers';
|
|
5
4
|
import { splitAccessibility, useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
|
|
6
5
|
import { spacing } from '@hzblj/kara-theme';
|
|
7
6
|
import { useMemo } from 'react';
|
|
8
7
|
import { useHostGuard } from "../../host-context.js";
|
|
8
|
+
import { tapModifiers } from "../../tap-modifiers.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const ALIGNMENT = {
|
|
11
11
|
center: 'center',
|
|
@@ -24,7 +24,7 @@ export const VStack = ({
|
|
|
24
24
|
const [accessibility, sx] = splitAccessibility(props);
|
|
25
25
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align]);
|
|
26
26
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined);
|
|
27
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(onPress
|
|
27
|
+
const modifiers = useMemo(() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers], [accessibilityModifiers, onPress, sxModifiers]);
|
|
28
28
|
return /*#__PURE__*/_jsx(SwiftUIVStack, {
|
|
29
29
|
alignment: ALIGNMENT[align],
|
|
30
30
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VStack","SwiftUIVStack","
|
|
1
|
+
{"version":3,"names":["VStack","SwiftUIVStack","splitAccessibility","useAccessibilityModifiers","useSxModifiers","spacing","useMemo","useHostGuard","tapModifiers","jsx","_jsx","ALIGNMENT","center","end","start","align","children","onPress","gap","testID","props","accessibility","sx","sxModifiers","accessibilityModifiers","undefined","modifiers","alignment"],"sourceRoot":"../../../../src","sources":["atoms/v-stack/v-stack.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,QAAO,mBAAmB;AACzD,SAA6BC,kBAAkB,EAAEC,yBAAyB,EAAEC,cAAc,QAAO,gBAAgB;AACjH,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,YAAY,QAAO,wBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGhD,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,UAAU;EACfC,KAAK,EAAE;AACT,CAAwD;AAExD,OAAO,MAAMd,MAAuB,GAAGA,CAAC;EACtCe,KAAK,GAAG,OAAO;EACfC,QAAQ;EACRC,OAAO;EACPZ,OAAO,EAAEa,GAAG;EACZC,MAAM;EACN,GAAGC;AACQ,CAAC,KAAK;EACjBb,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAM,CAACc,aAAa,EAAEC,EAAE,CAAC,GAAGpB,kBAAkB,CAACkB,KAAK,CAAC;EACrD,MAAMG,WAAW,GAAGnB,cAAc,CAACkB,EAAE,EAAEX,SAAS,CAACI,KAAK,CAAC,CAAC;EACxD,MAAMS,sBAAsB,GAAGrB,yBAAyB,CAACkB,aAAa,EAAEJ,OAAO,KAAKQ,SAAS,CAAC;EAC9F,MAAMC,SAAS,GAAGpB,OAAO,CACvB,MAAM,CAAC,GAAGiB,WAAW,EAAE,GAAGf,YAAY,CAACS,OAAO,CAAC,EAAE,GAAGO,sBAAsB,CAAC,EAC3E,CAACA,sBAAsB,EAAEP,OAAO,EAAEM,WAAW,CAC/C,CAAC;EAED,oBACEb,IAAA,CAACT,aAAa;IACZ0B,SAAS,EAAEhB,SAAS,CAACI,KAAK,CAAE;IAC5BW,SAAS,EAAEA,SAAU;IACrBrB,OAAO,EAAEa,GAAG,KAAKO,SAAS,GAAGA,SAAS,GAAGpB,OAAO,CAACa,GAAG,CAAE;IACtDC,MAAM,EAAEA,MAAO;IAAAH,QAAA,EAEdA;EAAQ,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { ZStack as SwiftUIZStack } from '@expo/ui/swift-ui';
|
|
4
|
-
import { onTapGesture } from '@expo/ui/swift-ui/modifiers';
|
|
5
4
|
import { splitAccessibility, useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
|
|
6
5
|
import { useMemo } from 'react';
|
|
7
6
|
import { useHostGuard } from "../../host-context.js";
|
|
7
|
+
import { tapModifiers } from "../../tap-modifiers.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
const ALIGNMENT = {
|
|
10
10
|
bottom: 'bottom',
|
|
@@ -22,7 +22,7 @@ export const ZStack = ({
|
|
|
22
22
|
const [accessibility, sx] = splitAccessibility(props);
|
|
23
23
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align]);
|
|
24
24
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined);
|
|
25
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(onPress
|
|
25
|
+
const modifiers = useMemo(() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers], [accessibilityModifiers, onPress, sxModifiers]);
|
|
26
26
|
return /*#__PURE__*/_jsx(SwiftUIZStack, {
|
|
27
27
|
alignment: ALIGNMENT[align],
|
|
28
28
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ZStack","SwiftUIZStack","
|
|
1
|
+
{"version":3,"names":["ZStack","SwiftUIZStack","splitAccessibility","useAccessibilityModifiers","useSxModifiers","useMemo","useHostGuard","tapModifiers","jsx","_jsx","ALIGNMENT","bottom","center","top","align","children","onPress","testID","props","accessibility","sx","sxModifiers","accessibilityModifiers","undefined","modifiers","alignment"],"sourceRoot":"../../../../src","sources":["atoms/z-stack/z-stack.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,QAAO,mBAAmB;AACzD,SAA6BC,kBAAkB,EAAEC,yBAAyB,EAAEC,cAAc,QAAO,gBAAgB;AACjH,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,YAAY,QAAO,wBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGhD,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE;AACP,CAAwD;AAExD,OAAO,MAAMb,MAAuB,GAAGA,CAAC;EAACc,KAAK,GAAG,QAAQ;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,MAAM;EAAE,GAAGC;AAAkB,CAAC,KAAK;EAC/GZ,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAM,CAACa,aAAa,EAAEC,EAAE,CAAC,GAAGlB,kBAAkB,CAACgB,KAAK,CAAC;EACrD,MAAMG,WAAW,GAAGjB,cAAc,CAACgB,EAAE,EAAEV,SAAS,CAACI,KAAK,CAAC,CAAC;EACxD,MAAMQ,sBAAsB,GAAGnB,yBAAyB,CAACgB,aAAa,EAAEH,OAAO,KAAKO,SAAS,CAAC;EAC9F,MAAMC,SAAS,GAAGnB,OAAO,CACvB,MAAM,CAAC,GAAGgB,WAAW,EAAE,GAAGd,YAAY,CAACS,OAAO,CAAC,EAAE,GAAGM,sBAAsB,CAAC,EAC3E,CAACA,sBAAsB,EAAEN,OAAO,EAAEK,WAAW,CAC/C,CAAC;EAED,oBACEZ,IAAA,CAACR,aAAa;IAACwB,SAAS,EAAEf,SAAS,CAACI,KAAK,CAAE;IAACU,SAAS,EAAEA,SAAU;IAACP,MAAM,EAAEA,MAAO;IAAAF,QAAA,EAC9EA;EAAQ,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -51,7 +51,8 @@ const MenuRow = ({
|
|
|
51
51
|
* Android's own take on a context menu, since Material has no lifted preview: a long press ripples the trigger, ticks
|
|
52
52
|
* the long-press haptic, and opens a Material dropdown where the finger is — the trigger stays highlighted while the
|
|
53
53
|
* menu is up. The host behind the menu mounts on the first long press and stays, so a list of triggers that are only
|
|
54
|
-
* scrolled past never builds one. `preview`, `onPreviewPress
|
|
54
|
+
* scrolled past never builds one. `preview`, `onPreviewPress`, `previewTransition`, `onOpenChange` and
|
|
55
|
+
* `preloadedScreenId` are iOS-only.
|
|
55
56
|
*/
|
|
56
57
|
const ContextMenuRoot = ({
|
|
57
58
|
actions,
|
|
@@ -60,7 +61,9 @@ const ContextMenuRoot = ({
|
|
|
60
61
|
...props
|
|
61
62
|
}) => {
|
|
62
63
|
const {
|
|
64
|
+
onOpenChange: _onOpenChange,
|
|
63
65
|
onPreviewPress: _onPreviewPress,
|
|
66
|
+
preloadedScreenId: _preloadedScreenId,
|
|
64
67
|
preview: _preview,
|
|
65
68
|
previewTransition: _previewTransition,
|
|
66
69
|
...sx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","ComposeText","DropdownMenu","DropdownMenuItem","Host","haptics","useSx","useAppTheme","useCallback","useMemo","useRef","useState","Pressable","StyleSheet","View","Icon","HostBoundary","splitForRipple","jsx","_jsx","jsxs","_jsxs","styles","create","anchor","height","position","width","MenuRow","action","onDismiss","theme","color","destructive","onClick","onPress","children","colorString","style","typography","body","label","icon","LeadingIcon","name","size","ContextMenuRoot","actions","testID","props","onPreviewPress","_onPreviewPress","preview","_preview","previewTransition","_previewTransition","sx","resolved","trigger","setAnchor","expanded","setExpanded","inner","outer","ripple","highlight","backgroundColor","open","event","pageX","pageY","nativeEvent","longPress","current","measure","_x","_y","_width","_height","left","top","x","y","dismiss","android_ripple","onLongPress","ref","pointerEvents","absoluteFill","colorScheme","dark","seedColor","materialSeed","onDismissRequest","Items","map","Exclusion","ContextMenu","Object","assign"],"sourceRoot":"../../../../src","sources":["organisms/context-menu/context-menu.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,IAAI,QAAO,0BAA0B;AAClG,SAAQC,OAAO,QAAO,0BAA0B;AAChD,SAAQC,KAAK,QAAO,gBAAgB;AACpC,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAoCC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AACpF,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,cAAc,QAAO,sBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMhD,MAAMC,MAAM,GAAGT,UAAU,CAACU,MAAM,CAAC;EAC/B;EACAC,MAAM,EAAE;IAACC,MAAM,EAAE,CAAC;IAAEC,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE;EAAC;AACpD,CAAC,CAAC;AAOF;AACA,MAAMC,OAAO,GAAGA,CAAC;EAACC,MAAM;EAAEC;AAAuB,CAAC,KAAK;EACrD,MAAMC,KAAK,GAAGxB,WAAW,CAAC,CAAC;EAC3B,MAAMyB,KAAK,GAAGH,MAAM,CAACI,WAAW,GAAG,qBAAqB,GAAG,iBAAiB;EAE5E,MAAMC,OAAO,GAAG1B,WAAW,CAAC,MAAM;IAChCsB,SAAS,CAAC,CAAC;IACXD,MAAM,CAACM,OAAO,CAAC,CAAC;EAClB,CAAC,EAAE,CAACN,MAAM,EAAEC,SAAS,CAAC,CAAC;EAEvB,oBACET,KAAA,CAAClB,gBAAgB;IAAC+B,OAAO,EAAEA,OAAQ;IAAAE,QAAA,gBACjCjB,IAAA,CAAChB,gBAAgB,CAACH,IAAI;MAAAoC,QAAA,eACpBjB,IAAA,CAAClB,WAAW;QAAC+B,KAAK,EAAED,KAAK,CAACM,WAAW,CAACL,KAAK,CAAE;QAACM,KAAK,EAAEP,KAAK,CAACQ,UAAU,CAACC,IAAK;QAAAJ,QAAA,EACxEP,MAAM,CAACY;MAAK,CACF;IAAC,CACO,CAAC,EACvBZ,MAAM,CAACa,IAAI,gBACVvB,IAAA,CAAChB,gBAAgB,CAACwC,WAAW;MAAAP,QAAA,eAC3BjB,IAAA,CAACJ,IAAI;QAACiB,KAAK,EAAEA,KAAM;QAACY,IAAI,EAAEf,MAAM,CAACa,IAAK;QAACG,IAAI,EAAC;MAAK,CAAE;IAAC,CACxB,CAAC,GAC7B,IAAI;EAAA,CACQ,CAAC;AAEvB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAGA,CAAC;EAACC,OAAO;EAAEX,QAAQ;EAAEY,MAAM;EAAE,GAAGC;AAAuB,CAAC,KAAK;EACnF,MAAM;
|
|
1
|
+
{"version":3,"names":["Text","ComposeText","DropdownMenu","DropdownMenuItem","Host","haptics","useSx","useAppTheme","useCallback","useMemo","useRef","useState","Pressable","StyleSheet","View","Icon","HostBoundary","splitForRipple","jsx","_jsx","jsxs","_jsxs","styles","create","anchor","height","position","width","MenuRow","action","onDismiss","theme","color","destructive","onClick","onPress","children","colorString","style","typography","body","label","icon","LeadingIcon","name","size","ContextMenuRoot","actions","testID","props","onOpenChange","_onOpenChange","onPreviewPress","_onPreviewPress","preloadedScreenId","_preloadedScreenId","preview","_preview","previewTransition","_previewTransition","sx","resolved","trigger","setAnchor","expanded","setExpanded","inner","outer","ripple","highlight","backgroundColor","open","event","pageX","pageY","nativeEvent","longPress","current","measure","_x","_y","_width","_height","left","top","x","y","dismiss","android_ripple","onLongPress","ref","pointerEvents","absoluteFill","colorScheme","dark","seedColor","materialSeed","onDismissRequest","Items","map","Exclusion","ContextMenu","Object","assign"],"sourceRoot":"../../../../src","sources":["organisms/context-menu/context-menu.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,IAAI,QAAO,0BAA0B;AAClG,SAAQC,OAAO,QAAO,0BAA0B;AAChD,SAAQC,KAAK,QAAO,gBAAgB;AACpC,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAoCC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AACpF,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,cAAc,QAAO,sBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMhD,MAAMC,MAAM,GAAGT,UAAU,CAACU,MAAM,CAAC;EAC/B;EACAC,MAAM,EAAE;IAACC,MAAM,EAAE,CAAC;IAAEC,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE;EAAC;AACpD,CAAC,CAAC;AAOF;AACA,MAAMC,OAAO,GAAGA,CAAC;EAACC,MAAM;EAAEC;AAAuB,CAAC,KAAK;EACrD,MAAMC,KAAK,GAAGxB,WAAW,CAAC,CAAC;EAC3B,MAAMyB,KAAK,GAAGH,MAAM,CAACI,WAAW,GAAG,qBAAqB,GAAG,iBAAiB;EAE5E,MAAMC,OAAO,GAAG1B,WAAW,CAAC,MAAM;IAChCsB,SAAS,CAAC,CAAC;IACXD,MAAM,CAACM,OAAO,CAAC,CAAC;EAClB,CAAC,EAAE,CAACN,MAAM,EAAEC,SAAS,CAAC,CAAC;EAEvB,oBACET,KAAA,CAAClB,gBAAgB;IAAC+B,OAAO,EAAEA,OAAQ;IAAAE,QAAA,gBACjCjB,IAAA,CAAChB,gBAAgB,CAACH,IAA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sx as _jsx } from "react/jsx-runtime";
|
|
|
8
8
|
const ContextMenuRoot = ({
|
|
9
9
|
actions,
|
|
10
10
|
children,
|
|
11
|
+
onOpenChange,
|
|
11
12
|
onPreviewPress,
|
|
13
|
+
preloadedScreenId,
|
|
12
14
|
preview,
|
|
13
15
|
previewTransition,
|
|
14
16
|
testID,
|
|
@@ -24,10 +26,19 @@ const ContextMenuRoot = ({
|
|
|
24
26
|
title: action.label
|
|
25
27
|
})), [actions]);
|
|
26
28
|
const onSelectItem = useCallback(id => actions[Number(id)]?.onPress(), [actions]);
|
|
29
|
+
const onMenuOpen = useCallback(() => onOpenChange?.(true), [onOpenChange]);
|
|
30
|
+
const onMenuClose = useCallback(isCommitted => {
|
|
31
|
+
if (!isCommitted) {
|
|
32
|
+
onOpenChange?.(false);
|
|
33
|
+
}
|
|
34
|
+
}, [onOpenChange]);
|
|
27
35
|
return /*#__PURE__*/_jsx(NativeContextMenu, {
|
|
28
36
|
items: items,
|
|
37
|
+
onMenuClose: onOpenChange ? onMenuClose : undefined,
|
|
38
|
+
onMenuOpen: onOpenChange ? onMenuOpen : undefined,
|
|
29
39
|
onPreviewPress: onPreviewPress,
|
|
30
40
|
onSelectItem: onSelectItem,
|
|
41
|
+
preloadedScreenId: preloadedScreenId,
|
|
31
42
|
preview: preview,
|
|
32
43
|
previewTransition: previewTransition,
|
|
33
44
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["iconResourceName","ContextMenu","NativeContextMenu","ContextMenuExclusion","NativeContextMenuExclusion","useSx","useCallback","useMemo","jsx","_jsx","ContextMenuRoot","actions","children","onPreviewPress","preview","previewTransition","testID","sx","style","items","map","action","index","destructive","id","String","image","icon","undefined","title","label","onSelectItem","Number","onPress","Exclusion","Object","assign"],"sourceRoot":"../../../../src","sources":["organisms/context-menu/context-menu.ios.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,QAAO,0BAA0B;AACzD,SAEEC,WAAW,IAAIC,iBAAiB,EAChCC,oBAAoB,IAAIC,0BAA0B,QAC7C,6BAA6B;AACpC,SAAQC,KAAK,QAAO,gBAAgB;AACpC,SAAQC,WAAW,EAAEC,OAAO,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG1C,MAAMC,eAAe,GAAGA,CAAC;EACvBC,OAAO;EACPC,QAAQ;EACRC,cAAc;EACdC,OAAO;EACPC,iBAAiB;EACjBC,MAAM;EACN,GAAGC;AACa,CAAC,KAAK;EACtB,MAAMC,KAAK,
|
|
1
|
+
{"version":3,"names":["iconResourceName","ContextMenu","NativeContextMenu","ContextMenuExclusion","NativeContextMenuExclusion","useSx","useCallback","useMemo","jsx","_jsx","ContextMenuRoot","actions","children","onOpenChange","onPreviewPress","preloadedScreenId","preview","previewTransition","testID","sx","style","items","map","action","index","destructive","id","String","image","icon","undefined","title","label","onSelectItem","Number","onPress","onMenuOpen","onMenuClose","isCommitted","Exclusion","Object","assign"],"sourceRoot":"../../../../src","sources":["organisms/context-menu/context-menu.ios.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,QAAO,0BAA0B;AACzD,SAEEC,WAAW,IAAIC,iBAAiB,EAChCC,oBAAoB,IAAIC,0BAA0B,QAC7C,6BAA6B;AACpC,SAAQC,KAAK,QAAO,gBAAgB;AACpC,SAAQC,WAAW,EAAEC,OAAO,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG1C,MAAMC,eAAe,GAAGA,CAAC;EACvBC,OAAO;EACPC,QAAQ;EACRC,YAAY;EACZC,cAAc;EACdC,iBAAiB;EACjBC,OAAO;EACPC,iBAAiB;EACjBC,MAAM;EACN,GAAGC;AACa,CAAC,KAAK;EACtB,MAAMC,KAAK,GAAGf,KAAK,CAACc,EAAE,CAAC;;EAEvB;EACA,MAAME,KAAK,GAAGd,OAAO,CACnB,MACEI,OAAO,CAACW,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,MAAM;IAC9BC,WAAW,EAAEF,MAAM,CAACE,W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,GAAGuC,MAAM,CAACC,MAAM,CAAC/B,eAAe,EAAE;EAAC6B;AAAS,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { contentShape, onTapGesture, shapes } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A SwiftUI stack's `onPress`: the whole frame takes the tap, padding and a `Spacer`'s gap included. `onTapGesture`
|
|
7
|
+
* alone hit-tests only what draws, so a `LabeledContent` row pressed in its empty middle did nothing; the rectangle
|
|
8
|
+
* content shape makes it answer anywhere, as the Compose stacks' `clickable` already does.
|
|
9
|
+
*/
|
|
10
|
+
export const tapModifiers = onPress => onPress ? [contentShape(shapes.rectangle()), onTapGesture(onPress)] : [];
|
|
11
|
+
//# sourceMappingURL=tap-modifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["contentShape","onTapGesture","shapes","tapModifiers","onPress","rectangle"],"sourceRoot":"../../src","sources":["tap-modifiers.ts"],"mappings":";;AAAA,SAAQA,YAAY,EAAuBC,YAAY,EAAEC,MAAM,QAAO,6BAA6B;;AAEnG;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAIC,OAAiC,IAC5DA,OAAO,GAAG,CAACJ,YAAY,CAACE,MAAM,CAACG,SAAS,CAAC,CAAC,CAAC,EAAEJ,YAAY,CAACG,OAAO,CAAC,CAAC,GAAG,EAAE","ignoreList":[]}
|
|
@@ -13,8 +13,20 @@ export type ContextMenuProps = ResponsiveViewSx & {
|
|
|
13
13
|
actions: MenuAction[];
|
|
14
14
|
/** The trigger, laid out as usual. */
|
|
15
15
|
children: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* iOS: `true` when the menu appears, `false` when it ends without a tap on the preview. Preload the detail the card
|
|
18
|
+
* stands for here, and drop the preload on `false`.
|
|
19
|
+
*/
|
|
20
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
16
21
|
/** iOS: the user tapped the lifted preview, committing to it. Open the detail the card stands for. */
|
|
17
22
|
onPreviewPress?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* iOS: the route key of that detail, preloaded in the enclosing native stack while the menu is open (React
|
|
25
|
+
* Navigation's `preload`, Expo Router's `router.prefetch`). A tapped preview pushes it natively in the same frame
|
|
26
|
+
* and, with `zoom`, morphs the whole preview into it, the way Apple's apps open a preview. Move the route into the
|
|
27
|
+
* stack in `onPreviewPress`.
|
|
28
|
+
*/
|
|
29
|
+
preloadedScreenId?: string;
|
|
18
30
|
/**
|
|
19
31
|
* iOS: lifted in place of the trigger while the menu is open (a larger version of the card, say). A snapshot of the
|
|
20
32
|
* trigger when unset. Mounted only once a finger has rested on the trigger, so a list of cards does not pay for
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ModifierConfig } from '@expo/ui/swift-ui/modifiers';
|
|
2
|
+
/**
|
|
3
|
+
* A SwiftUI stack's `onPress`: the whole frame takes the tap, padding and a `Spacer`'s gap included. `onTapGesture`
|
|
4
|
+
* alone hit-tests only what draws, so a `LabeledContent` row pressed in its empty middle did nothing; the rectangle
|
|
5
|
+
* content shape makes it answer anywhere, as the Compose stacks' `clickable` already does.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tapModifiers: (onPress: (() => void) | undefined) => ModifierConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzblj/kara-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "The atoms, molecules, organisms and templates of @hzblj/kara-ui — real SwiftUI and Jetpack Compose views through @expo/ui.",
|
|
5
5
|
"author": "Jan Blazej",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@hzblj/expo-native-icons": "^0.1.0",
|
|
63
63
|
"@hzblj/expo-rich-haptics": "^0.1.0",
|
|
64
|
-
"@hzblj/kara-native": "^0.
|
|
65
|
-
"@hzblj/kara-sx": "^0.
|
|
66
|
-
"@hzblj/kara-theme": "^0.
|
|
64
|
+
"@hzblj/kara-native": "^0.16.0",
|
|
65
|
+
"@hzblj/kara-sx": "^0.16.0",
|
|
66
|
+
"@hzblj/kara-theme": "^0.16.0",
|
|
67
67
|
"sf-symbols-typescript": "^2.2.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {HStack as SwiftUIHStack} from '@expo/ui/swift-ui'
|
|
2
|
-
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
2
|
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
3
|
import {spacing} from '@hzblj/kara-theme'
|
|
5
4
|
import {useMemo} from 'react'
|
|
6
5
|
import {useHostGuard} from '../../host-context'
|
|
6
|
+
import {tapModifiers} from '../../tap-modifiers'
|
|
7
7
|
import type {HStackAlign, HStackComponent, HStackProps} from './h-stack.types'
|
|
8
8
|
|
|
9
9
|
const ALIGNMENT = {
|
|
@@ -31,7 +31,7 @@ export const HStack: HStackComponent = ({
|
|
|
31
31
|
const sxModifiers = useSxModifiers(sx, FRAME_ALIGNMENT[align])
|
|
32
32
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
33
33
|
const modifiers = useMemo(
|
|
34
|
-
() => [...sxModifiers, ...(onPress
|
|
34
|
+
() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers],
|
|
35
35
|
[accessibilityModifiers, onPress, sxModifiers]
|
|
36
36
|
)
|
|
37
37
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {VStack as SwiftUIVStack} from '@expo/ui/swift-ui'
|
|
2
|
-
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
2
|
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
3
|
import {spacing} from '@hzblj/kara-theme'
|
|
5
4
|
import {useMemo} from 'react'
|
|
6
5
|
import {useHostGuard} from '../../host-context'
|
|
6
|
+
import {tapModifiers} from '../../tap-modifiers'
|
|
7
7
|
import type {VStackAlign, VStackComponent, VStackProps} from './v-stack.types'
|
|
8
8
|
|
|
9
9
|
const ALIGNMENT = {
|
|
@@ -25,7 +25,7 @@ export const VStack: VStackComponent = ({
|
|
|
25
25
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
|
|
26
26
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
27
27
|
const modifiers = useMemo(
|
|
28
|
-
() => [...sxModifiers, ...(onPress
|
|
28
|
+
() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers],
|
|
29
29
|
[accessibilityModifiers, onPress, sxModifiers]
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {ZStack as SwiftUIZStack} from '@expo/ui/swift-ui'
|
|
2
|
-
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
2
|
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
3
|
import {useMemo} from 'react'
|
|
5
4
|
import {useHostGuard} from '../../host-context'
|
|
5
|
+
import {tapModifiers} from '../../tap-modifiers'
|
|
6
6
|
import type {ZStackAlign, ZStackComponent, ZStackProps} from './z-stack.types'
|
|
7
7
|
|
|
8
8
|
const ALIGNMENT = {
|
|
@@ -17,7 +17,7 @@ export const ZStack: ZStackComponent = ({align = 'center', children, onPress, te
|
|
|
17
17
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
|
|
18
18
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
19
19
|
const modifiers = useMemo(
|
|
20
|
-
() => [...sxModifiers, ...(onPress
|
|
20
|
+
() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers],
|
|
21
21
|
[accessibilityModifiers, onPress, sxModifiers]
|
|
22
22
|
)
|
|
23
23
|
|
|
@@ -52,10 +52,18 @@ const MenuRow = ({action, onDismiss}: MenuRowProps) => {
|
|
|
52
52
|
* Android's own take on a context menu, since Material has no lifted preview: a long press ripples the trigger, ticks
|
|
53
53
|
* the long-press haptic, and opens a Material dropdown where the finger is — the trigger stays highlighted while the
|
|
54
54
|
* menu is up. The host behind the menu mounts on the first long press and stays, so a list of triggers that are only
|
|
55
|
-
* scrolled past never builds one. `preview`, `onPreviewPress
|
|
55
|
+
* scrolled past never builds one. `preview`, `onPreviewPress`, `previewTransition`, `onOpenChange` and
|
|
56
|
+
* `preloadedScreenId` are iOS-only.
|
|
56
57
|
*/
|
|
57
58
|
const ContextMenuRoot = ({actions, children, testID, ...props}: ContextMenuProps) => {
|
|
58
|
-
const {
|
|
59
|
+
const {
|
|
60
|
+
onOpenChange: _onOpenChange,
|
|
61
|
+
onPreviewPress: _onPreviewPress,
|
|
62
|
+
preloadedScreenId: _preloadedScreenId,
|
|
63
|
+
preview: _preview,
|
|
64
|
+
previewTransition: _previewTransition,
|
|
65
|
+
...sx
|
|
66
|
+
} = props
|
|
59
67
|
const theme = useAppTheme()
|
|
60
68
|
const resolved = useSx(sx)
|
|
61
69
|
const trigger = useRef<View>(null)
|
|
@@ -11,7 +11,9 @@ import type {ContextMenuComponent, ContextMenuExclusionProps, ContextMenuProps}
|
|
|
11
11
|
const ContextMenuRoot = ({
|
|
12
12
|
actions,
|
|
13
13
|
children,
|
|
14
|
+
onOpenChange,
|
|
14
15
|
onPreviewPress,
|
|
16
|
+
preloadedScreenId,
|
|
15
17
|
preview,
|
|
16
18
|
previewTransition,
|
|
17
19
|
testID,
|
|
@@ -33,11 +35,25 @@ const ContextMenuRoot = ({
|
|
|
33
35
|
|
|
34
36
|
const onSelectItem = useCallback((id: string) => actions[Number(id)]?.onPress(), [actions])
|
|
35
37
|
|
|
38
|
+
const onMenuOpen = useCallback(() => onOpenChange?.(true), [onOpenChange])
|
|
39
|
+
|
|
40
|
+
const onMenuClose = useCallback(
|
|
41
|
+
(isCommitted: boolean) => {
|
|
42
|
+
if (!isCommitted) {
|
|
43
|
+
onOpenChange?.(false)
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[onOpenChange]
|
|
47
|
+
)
|
|
48
|
+
|
|
36
49
|
return (
|
|
37
50
|
<NativeContextMenu
|
|
38
51
|
items={items}
|
|
52
|
+
onMenuClose={onOpenChange ? onMenuClose : undefined}
|
|
53
|
+
onMenuOpen={onOpenChange ? onMenuOpen : undefined}
|
|
39
54
|
onPreviewPress={onPreviewPress}
|
|
40
55
|
onSelectItem={onSelectItem}
|
|
56
|
+
preloadedScreenId={preloadedScreenId}
|
|
41
57
|
preview={preview}
|
|
42
58
|
previewTransition={previewTransition}
|
|
43
59
|
style={style}
|
|
@@ -14,8 +14,20 @@ export type ContextMenuProps = ResponsiveViewSx & {
|
|
|
14
14
|
actions: MenuAction[]
|
|
15
15
|
/** The trigger, laid out as usual. */
|
|
16
16
|
children: ReactNode
|
|
17
|
+
/**
|
|
18
|
+
* iOS: `true` when the menu appears, `false` when it ends without a tap on the preview. Preload the detail the card
|
|
19
|
+
* stands for here, and drop the preload on `false`.
|
|
20
|
+
*/
|
|
21
|
+
onOpenChange?: (isOpen: boolean) => void
|
|
17
22
|
/** iOS: the user tapped the lifted preview, committing to it. Open the detail the card stands for. */
|
|
18
23
|
onPreviewPress?: () => void
|
|
24
|
+
/**
|
|
25
|
+
* iOS: the route key of that detail, preloaded in the enclosing native stack while the menu is open (React
|
|
26
|
+
* Navigation's `preload`, Expo Router's `router.prefetch`). A tapped preview pushes it natively in the same frame
|
|
27
|
+
* and, with `zoom`, morphs the whole preview into it, the way Apple's apps open a preview. Move the route into the
|
|
28
|
+
* stack in `onPreviewPress`.
|
|
29
|
+
*/
|
|
30
|
+
preloadedScreenId?: string
|
|
19
31
|
/**
|
|
20
32
|
* iOS: lifted in place of the trigger while the menu is open (a larger version of the card, say). A snapshot of the
|
|
21
33
|
* trigger when unset. Mounted only once a finger has rested on the trigger, so a list of cards does not pay for
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {contentShape, type ModifierConfig, onTapGesture, shapes} from '@expo/ui/swift-ui/modifiers'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A SwiftUI stack's `onPress`: the whole frame takes the tap, padding and a `Spacer`'s gap included. `onTapGesture`
|
|
5
|
+
* alone hit-tests only what draws, so a `LabeledContent` row pressed in its empty middle did nothing; the rectangle
|
|
6
|
+
* content shape makes it answer anywhere, as the Compose stacks' `clickable` already does.
|
|
7
|
+
*/
|
|
8
|
+
export const tapModifiers = (onPress: (() => void) | undefined): ModifierConfig[] =>
|
|
9
|
+
onPress ? [contentShape(shapes.rectangle()), onTapGesture(onPress)] : []
|