@hzblj/kara-components 0.15.3 → 0.17.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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # @hzblj/kara-components
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#54](https://github.com/hzblj/kara-ui/pull/54) [`76f14b5`](https://github.com/hzblj/kara-ui/commit/76f14b5e71bdbb8fb431502a987e776243015177) Thanks [@hzblj](https://github.com/hzblj)! - `Picker` takes `pickerStyle` on iOS: `wheel`, as before and still the default, or `menu`, a button with the selection, in the accent, that opens the options as a menu. A screen with more than one picker, or a picker in a row, no longer has to give the screen to wheels. Android ignores it: its exposed dropdown is a menu already.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @hzblj/kara-theme@0.17.0
13
+ - @hzblj/kara-sx@0.17.0
14
+ - @hzblj/kara-native@0.17.0
15
+
16
+ ## 0.16.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#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.
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [[`1b82690`](https://github.com/hzblj/kara-ui/commit/1b826908a729399b4b9ef8038836b60539d1fa41)]:
25
+ - @hzblj/kara-native@0.16.0
26
+ - @hzblj/kara-sx@0.16.0
27
+ - @hzblj/kara-theme@0.16.0
28
+
29
+ ## 0.15.4
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [[`15aa9db`](https://github.com/hzblj/kara-ui/commit/15aa9db0b1c22dd4a55cb301982643449ad28dd0)]:
34
+ - @hzblj/kara-native@0.15.4
35
+ - @hzblj/kara-theme@0.15.4
36
+ - @hzblj/kara-sx@0.15.4
37
+
3
38
  ## 0.15.3
4
39
 
5
40
  ### Patch Changes
@@ -1,39 +1,51 @@
1
1
  "use strict";
2
2
 
3
3
  import { Picker as NativePicker } from '@expo/ui/community/picker';
4
- import { Picker as SwiftUIPicker, Text as SwiftUIText } from '@expo/ui/swift-ui';
5
- import { disabled as disabledModifier, foregroundStyle, pickerStyle, tag } from '@expo/ui/swift-ui/modifiers';
4
+ import { Host, Picker as SwiftUIPicker, Text as SwiftUIText } from '@expo/ui/swift-ui';
5
+ import { disabled as disabledModifier, foregroundStyle, pickerStyle as pickerStyleModifier, tag, tint } from '@expo/ui/swift-ui/modifiers';
6
6
  import { useAppTheme } from '@hzblj/kara-theme';
7
7
  import { useCallback, useMemo } from 'react';
8
8
  import { useInsideHost } from "../../host-context.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  /**
11
- * A SwiftUI wheel. On its own it is `@expo/ui`'s community picker, which brings a host of its own. Inside a `Screen` or
12
- * `Island` it is the same wheel rendered into that host instead (see `useInsideHost`): a host nested in the island's
13
- * stack is given no height there, and the wheel spills over the views around it.
11
+ * A SwiftUI picker: a wheel, or with `pickerStyle="menu"` a button with the selection that opens the options as a
12
+ * menu, in the accent. On its own the wheel is `@expo/ui`'s community picker, which brings a host of its own, and the
13
+ * menu sits in a host sized to its button on both axes, as the date picker's pill does, so it drops into a row the way
14
+ * a `Text` does. Inside a `Screen` or `Island` either renders into that host instead (see `useInsideHost`): a host
15
+ * nested in the island's stack is given no height there, and the wheel spills over the views around it.
14
16
  */
15
17
  export const Picker = ({
16
18
  disabled = false,
17
19
  onValueChange,
18
20
  options,
21
+ pickerStyle = 'wheel',
19
22
  testID,
20
23
  value
21
24
  }) => {
22
25
  const theme = useAppTheme();
23
26
  const insideHost = useInsideHost();
24
27
  const color = theme.colorString('content.primary');
28
+ const menu = pickerStyle === 'menu';
25
29
  const onChange = useCallback(next => onValueChange?.(String(next)), [onValueChange]);
26
- const wheelModifiers = useMemo(() => [pickerStyle('wheel'), ...(disabled ? [disabledModifier(true)] : [])], [disabled]);
30
+ const modifiers = useMemo(() => [pickerStyleModifier(pickerStyle), ...(menu ? [tint(theme.color('fill.accent.primary'))] : []), ...(disabled ? [disabledModifier(true)] : [])], [disabled, menu, pickerStyle, theme]);
31
+ const picker = /*#__PURE__*/_jsx(SwiftUIPicker, {
32
+ modifiers: modifiers,
33
+ onSelectionChange: onChange,
34
+ selection: value,
35
+ testID: testID,
36
+ children: options.map(option => /*#__PURE__*/_jsx(SwiftUIText, {
37
+ modifiers: [tag(option.value), foregroundStyle(color)],
38
+ children: option.label
39
+ }, option.value))
40
+ });
27
41
  if (insideHost) {
28
- return /*#__PURE__*/_jsx(SwiftUIPicker, {
29
- modifiers: wheelModifiers,
30
- onSelectionChange: onChange,
31
- selection: value,
32
- testID: testID,
33
- children: options.map(option => /*#__PURE__*/_jsx(SwiftUIText, {
34
- modifiers: [tag(option.value), foregroundStyle(color)],
35
- children: option.label
36
- }, option.value))
42
+ return picker;
43
+ }
44
+ if (menu) {
45
+ return /*#__PURE__*/_jsx(Host, {
46
+ colorScheme: theme.dark ? 'dark' : 'light',
47
+ matchContents: true,
48
+ children: picker
37
49
  });
38
50
  }
39
51
  return /*#__PURE__*/_jsx(NativePicker, {
@@ -1 +1 @@
1
- {"version":3,"names":["Picker","NativePicker","SwiftUIPicker","Text","SwiftUIText","disabled","disabledModifier","foregroundStyle","pickerStyle","tag","useAppTheme","useCallback","useMemo","useInsideHost","jsx","_jsx","onValueChange","options","testID","value","theme","insideHost","color","colorString","onChange","next","String","wheelModifiers","modifiers","onSelectionChange","selection","children","map","option","label","enabled","selectedValue","Item"],"sourceRoot":"../../../../src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,CAACC,MAAM,iBACjBlB,IAAA,CAACX,WAAW;QAAoBwB,SAAS,EAAE,CAACnB,GAAG,CAACwB,MAAM,CAACd,KAAK,CAAC,EAAEZ,eAAe,CAACe,KAAK,CAAC,CAAE;QAAAS,QAAA,EACpFE,MAAM,CAACC;MAAK,GADGD,MAAM,CAACd,KAEZ,CACd;IAAC,CACW,CAAC;EAEpB;EAEA,oBACEJ,IAAA,CAACd,YAAY;IAACkC,OAAO,EAAE,CAAC9B,QAAS;IAACW,aAAa,EAAEQ,QAAS;IAACY,aAAa,EAAEjB,KAAM;IAACD,MAAM,EAAEA,MAAO;IAAAa,QAAA,EAC7Fd,OAAO,CAACe,GAAG,CAACC,MAAM,iBACjBlB,IAAA,CAACd,YAAY,CAACoC,IAAI;MAACf,KAAK,EAAEA,KAAM;MAAoBY,KAAK,EAAED,MAAM,CAACC,KAAM;MAACf,KAAK,EAAEc,MAAM,CAACd;IAAM,GAAvDc,MAAM,CAACd,KAAkD,CAChG;EAAC,CACU,CAAC;AAEnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Picker","NativePicker","Host","SwiftUIPicker","Text","SwiftUIText","disabled","disabledModifier","foregroundStyle","pickerStyle","pickerStyleModifier","tag","tint","useAppTheme","useCallback","useMemo","useInsideHost","jsx","_jsx","onValueChange","options","testID","value","theme","insideHost","color","colorString","menu","onChange","next","String","modifiers","picker","onSelectionChange","selection","children","map","option","label","colorScheme","dark","matchContents","enabled","selectedValue","Item"],"sourceRoot":"../../../../src","sources":["atoms/picker/picker.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,YAAY,QAAO,2BAA2B;AAChE,SAAQC,IAAI,EAAEF,MAAM,IAAIG,aAAa,EAAEC,IAAI,IAAIC,WAAW,QAAO,mBAAmB;AACpF,SACEC,QAAQ,IAAIC,gBAAgB,EAC5BC,eAAe,EACfC,WAAW,IAAIC,mBAAmB,EAClCC,GAAG,EACHC,IAAI,QACC,6BAA6B;AACpC,SAAQC,WAA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W;MAAoB0B,SAAS,EAAE,CAACpB,GAAG,CAAC0B,MAAM,CAACf,KAAK,CAAC,EAAEd,eAAe,CAACiB,KAAK,CAAC,CAAE;MAAAU,QAAA,EACpFE,MAAM,CAACC;IAAK,GADGD,MAAM,CAACf,KAEZ,CACd;EAAC,CACW,CAChB;EAED,IAAIE,UAAU,EAAE;IACd,OAAOQ,MAAM;EACf;EAEA,IAAIL,IAAI,EAAE;IACR,oBACET,IAAA,CAAChB,IAAI;MAACqC,WAAW,EAAEhB,KAAK,CAACiB,IAAI,GAAG,MAAM,GAAG,OAAQ;MAACC,aAAa;MAAAN,QAAA,EAC5DH;IAAM,CACH,CAAC;EAEX;EAEA,oBACEd,IAAA,CAACjB,YAAY;IAACyC,OAAO,EAAE,CAACpC,QAAS;IAACa,aAAa,EAAES,QAAS;IAACe,aAAa,EAAErB,KAAM;IAACD,MAAM,EAAEA,MAAO;IAAAc,QAAA,EAC7Ff,OAAO,CAACgB,GAAG,CAACC,MAAM,iBACjBnB,IAAA,CAACjB,YAAY,CAAC2C,IAAI;MAACnB,KAAK,EAAEA,KAAM;MAAoBa,KAAK,EAAED,MAAM,CAACC,KAAM;MAAChB,KAAK,EAAEe,MAAM,CAACf;IAAM,GAAvDe,MAAM,CAACf,KAAkD,CAChG;EAAC,CACU,CAAC;AAEnB,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` and `previewTransition` are iOS-only.
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,EAA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OAAQ;YAAA/C,QAAA,eACjGjB,IAAA,CAACjB,YAAY,CAAC4F,KAAK;cAAA1D,QAAA,EAChBW,OAAO,CAACgD,GAAG,CAAClE,MAAM,iBACjBV,IAAA,CAACS,OAAO;gBAACC,MAAM,EAAEA,MAAO;gBAAoBC,SAAS,EAAEqD;cAAQ,GAAjCtD,MAAM,CAACY,KAA4B,CAClE;YAAC,CACgB;UAAC,CACT;QAAC,CACH;MAAC,CACX,CAAC,GACL,IAAI;IAAA,CACC;EAAC,CACR,CAAC;AAEX,CAAC;;AAED;AACA,MAAMuD,SAAS,GAAGA,CAAC;EAAC5D;AAAmC,CAAC,kBAAKjB,IAAA,CAACL,IAAI;EAAAsB,QAAA,EAAEA;AAAQ,CAAO,CAAC;AAEpF,OAAO,MAAM6D,WAAiC,GAAGC,MAAM,CAACC,MAAM,CAACrD,eAAe,EAAE;EAACkD;AAAS,CAAC,CAAC","ignoreList":[]}
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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,MAAM,gBACLL,IAAA,CAACf,IAAI;QACHyF,WAAW,EAAE9D,KAAK,CAAC+D,IAAI,GAAG,MAAM,GAAG,OAAQ;QAC3CH,aAAa,EAAC,MAAM;QACpBI,SAAS,EAAEhE,KAAK,CAACiE,YAAa;QAC9B1D,KAAK,EAAE,CAAChB,MAAM,CAACE,MAAM,EAAE;UAAC2D,IAAI,EAAE3D,MAAM,CAAC6D,CAAC;UAAED,GAAG,EAAE5D,MAAM,CAAC8D;QAAC,CAAC,CAAE;QAAAlD,QAAA,eAExDjB,IAAA,CAACH,YAAY;UAAAoB,QAAA,eACXjB,IAAA,CAACjB,YAAY;YAAC8B,KAAK,EAAED,KAAK,CAACC,KAAK,CAAC,iBAAiB,CAAE;YAACgC,QAAQ,EAAEA,QAAS;YAACiC,gBAAgB,EAAEV,OAAQ;YAAAnD,QAAA,eACjGjB,IAAA,CAACjB,YAAY,CAACgG,KAAK;cAAA9D,QAAA,EAChBW,OAAO,CAACoD,GAAG,CAACtE,MAAM,iBACjBV,IAAA,CAACS,OAAO;gBAACC,MAAM,EAAEA,MAAO;gBAAoBC,SAAS,EAAEyD;cAAQ,GAAjC1D,MAAM,CAACY,KAA4B,CAClE;YAAC,CACgB;UAAC,CACT;QAAC,CACH;MAAC,CACX,CAAC,GACL,IAAI;IAAA,CACC;EAAC,CACR,CAAC;AAEX,CAAC;;AAED;AACA,MAAM2D,SAAS,GAAGA,CAAC;EAAChE;AAAmC,CAAC,kBAAKjB,IAAA,CAACL,IAAI;EAAAsB,QAAA,EAAEA;AAAQ,CAAO,CAAC;AAEpF,OAAO,MAAMiE,WAAiC,GAAGC,MAAM,CAACC,MAAM,CAACzD,eAAe,EAAE;EAACsD;AAAS,CAAC,CAAC","ignoreList":[]}
@@ -8,7 +8,9 @@ import { jsx 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,GAAGb,KAAK,CAACY,EAAE,CAAC;;EAEvB;EACA,MAAME,KAAK,GAAGZ,OAAO,CACnB,MACEI,OAAO,CAACS,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,MAAM;IAC9BC,WAAW,EAAEF,MAAM,CAACE,WAAW;IAC/BC,EAAE,EAAEC,MAAM,CAACH,KAAK,CAAC;IACjBI,KAAK,EAAEL,MAAM,CAACM,IAAI,GAAG3B,gBAAgB,CAACqB,MAAM,CAACM,IAAI,CAAC,GAAGC,SAAS;IAC9DC,KAAK,EAAER,MAAM,CAACS;EAChB,CAAC,CAAC,CAAC,EACL,CAACnB,OAAO,CACV,CAAC;EAED,MAAMoB,YAAY,GAAGzB,WAAW,CAAEkB,EAAU,IAAKb,OAAO,CAACqB,MAAM,CAACR,EAAE,CAAC,CAAC,EAAES,OAAO,CAAC,CAAC,EAAE,CAACtB,OAAO,CAAC,CAAC;EAE3F,oBACEF,IAAA,CAACP,iBAAiB;IAChBiB,KAAK,EAAEA,KAAM;IACbN,cAAc,EAAEA,cAAe;IAC/BkB,YAAY,EAAEA,YAAa;IAC3BjB,OAAO,EAAEA,OAAQ;IACjBC,iBAAiB,EAAEA,iBAAkB;IACrCG,KAAK,EAAEA,KAAM;IACbF,MAAM,EAAEA,MAAO;IAAAJ,QAAA,EAEdA;EAAQ,CACQ,CAAC;AAExB,CAAC;AAED,MAAMsB,SAAS,GAAGA,CAAC;EAACtB;AAAmC,CAAC,kBACtDH,IAAA,CAACL,0BAA0B;EAAAQ,QAAA,EAAEA;AAAQ,CAA6B,CACnE;AAED,OAAO,MAAMX,WAAiC,GAAGkC,MAAM,CAACC,MAAM,CAAC1B,eAAe,EAAE;EAACwB;AAAS,CAAC,CAAC","ignoreList":[]}
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,WAAW;IAC/BC,EAAE,EAAEC,MAAM,CAACH,KAAK,CAAC;IACjBI,KAAK,EAAEL,MAAM,CAACM,IAAI,GAAG7B,gBAAgB,CAACuB,MAAM,CAACM,IAAI,CAAC,GAAGC,SAAS;IAC9DC,KAAK,EAAER,MAAM,CAACS;EAChB,CAAC,CAAC,CAAC,EACL,CAACrB,OAAO,CACV,CAAC;EAED,MAAMsB,YAAY,GAAG3B,WAAW,CAAEoB,EAAU,IAAKf,OAAO,CAACuB,MAAM,CAACR,EAAE,CAAC,CAAC,EAAES,OAAO,CAAC,CAAC,EAAE,CAACxB,OAAO,CAAC,CAAC;EAE3F,MAAMyB,UAAU,GAAG9B,WAAW,CAAC,MAAMO,YAAY,GAAG,IAAI,CAAC,EAAE,CAACA,YAAY,CAAC,CAAC;EAE1E,MAAMwB,WAAW,GAAG/B,WAAW,CAC5BgC,WAAoB,IAAK;IACxB,IAAI,CAACA,WAAW,EAAE;MAChBzB,YAAY,GAAG,KAAK,CAAC;IACvB;EACF,CAAC,EACD,CAACA,YAAY,CACf,CAAC;EAED,oBACEJ,IAAA,CAACP,iBAAiB;IAChBmB,KAAK,EAAEA,KAAM;IACbgB,WAAW,EAAExB,YAAY,GAAGwB,WAAW,GAAGP,SAAU;IACpDM,UAAU,EAAEvB,YAAY,GAAGuB,UAAU,GAAGN,SAAU;IAClDhB,cAAc,EAAEA,cAAe;IAC/BmB,YAAY,EAAEA,YAAa;IAC3BlB,iBAAiB,EAAEA,iBAAkB;IACrCC,OAAO,EAAEA,OAAQ;IACjBC,iBAAiB,EAAEA,iBAAkB;IACrCG,KAAK,EAAEA,KAAM;IACbF,MAAM,EAAEA,MAAO;IAAAN,QAAA,EAEdA;EAAQ,CACQ,CAAC;AAExB,CAAC;AAED,MAAM2B,SAAS,GAAGA,CAAC;EAAC3B;AAAmC,CAAC,kBACtDH,IAAA,CAACL,0BAA0B;EAAAQ,QAAA,EAAEA;AAAQ,CAA6B,CACnE;AAED,OAAO,MAAMX,WAAiC,GAAGuC,MAAM,CAACC,MAAM,CAAC/B,eAAe,EAAE;EAAC6B;AAAS,CAAC,CAAC","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import type { PickerComponent } from './picker.types';
2
2
  /**
3
- * A SwiftUI wheel. On its own it is `@expo/ui`'s community picker, which brings a host of its own. Inside a `Screen` or
4
- * `Island` it is the same wheel rendered into that host instead (see `useInsideHost`): a host nested in the island's
5
- * stack is given no height there, and the wheel spills over the views around it.
3
+ * A SwiftUI picker: a wheel, or with `pickerStyle="menu"` a button with the selection that opens the options as a
4
+ * menu, in the accent. On its own the wheel is `@expo/ui`'s community picker, which brings a host of its own, and the
5
+ * menu sits in a host sized to its button on both axes, as the date picker's pill does, so it drops into a row the way
6
+ * a `Text` does. Inside a `Screen` or `Island` either renders into that host instead (see `useInsideHost`): a host
7
+ * nested in the island's stack is given no height there, and the wheel spills over the views around it.
6
8
  */
7
9
  export declare const Picker: PickerComponent;
@@ -6,10 +6,12 @@ export type PickerOption = {
6
6
  /** What `onValueChange` reports. It also keys the option, so it must be unique. */
7
7
  value: string;
8
8
  };
9
+ /** How SwiftUI shows the picker: a wheel, or a button that opens the options as a menu. */
10
+ export type PickerStyleName = 'menu' | 'wheel';
9
11
  /**
10
- * A single choice from a list: a SwiftUI wheel picker on iOS, Material's exposed dropdown on Android. It brings its
11
- * own host, so it renders outside `Screen` and `Island` as well. Inside one it renders into that host instead, so it
12
- * can share a stack with other native views.
12
+ * A single choice from a list: a SwiftUI picker on iOS (a wheel, or a menu with `pickerStyle`), Material's exposed
13
+ * dropdown on Android. It brings its own host, so it renders outside `Screen` and `Island` as well. Inside one it
14
+ * renders into that host instead, so it can share a stack with other native views.
13
15
  */
14
16
  export type PickerProps = {
15
17
  /** Stops the user changing the selection, and dims the picker. */
@@ -18,6 +20,12 @@ export type PickerProps = {
18
20
  onValueChange?: (value: string) => void;
19
21
  /** The choices, in order. */
20
22
  options: PickerOption[];
23
+ /**
24
+ * SwiftUI's picker style. `wheel` by default: the options on a wheel, always in view. `menu` is a button with the
25
+ * selection, in the accent, that opens the options as a menu: what a screen with more than one picker, or a picker
26
+ * in a row, wants. iOS only. Android ignores it: its exposed dropdown is a menu already.
27
+ */
28
+ pickerStyle?: PickerStyleName;
21
29
  /**
22
30
  * Android: the dropdown field's test tag. iOS: the wheel's, inside a `Screen` or `Island` only; on its own,
23
31
  * `@expo/ui`'s wheel picker drops it.
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzblj/kara-components",
3
- "version": "0.15.3",
3
+ "version": "0.17.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.15.3",
65
- "@hzblj/kara-sx": "^0.15.3",
66
- "@hzblj/kara-theme": "^0.15.3",
64
+ "@hzblj/kara-native": "^0.17.0",
65
+ "@hzblj/kara-sx": "^0.17.0",
66
+ "@hzblj/kara-theme": "^0.17.0",
67
67
  "sf-symbols-typescript": "^2.2.0"
68
68
  },
69
69
  "peerDependencies": {
@@ -1,6 +1,12 @@
1
1
  import {Picker as NativePicker} from '@expo/ui/community/picker'
2
- import {Picker as SwiftUIPicker, Text as SwiftUIText} from '@expo/ui/swift-ui'
3
- import {disabled as disabledModifier, foregroundStyle, pickerStyle, tag} from '@expo/ui/swift-ui/modifiers'
2
+ import {Host, Picker as SwiftUIPicker, Text as SwiftUIText} from '@expo/ui/swift-ui'
3
+ import {
4
+ disabled as disabledModifier,
5
+ foregroundStyle,
6
+ pickerStyle as pickerStyleModifier,
7
+ tag,
8
+ tint,
9
+ } from '@expo/ui/swift-ui/modifiers'
4
10
  import {useAppTheme} from '@hzblj/kara-theme'
5
11
  import {useCallback, useMemo} from 'react'
6
12
 
@@ -8,30 +14,54 @@ import {useInsideHost} from '../../host-context'
8
14
  import type {PickerComponent, PickerProps} from './picker.types'
9
15
 
10
16
  /**
11
- * A SwiftUI wheel. On its own it is `@expo/ui`'s community picker, which brings a host of its own. Inside a `Screen` or
12
- * `Island` it is the same wheel rendered into that host instead (see `useInsideHost`): a host nested in the island's
13
- * stack is given no height there, and the wheel spills over the views around it.
17
+ * A SwiftUI picker: a wheel, or with `pickerStyle="menu"` a button with the selection that opens the options as a
18
+ * menu, in the accent. On its own the wheel is `@expo/ui`'s community picker, which brings a host of its own, and the
19
+ * menu sits in a host sized to its button on both axes, as the date picker's pill does, so it drops into a row the way
20
+ * a `Text` does. Inside a `Screen` or `Island` either renders into that host instead (see `useInsideHost`): a host
21
+ * nested in the island's stack is given no height there, and the wheel spills over the views around it.
14
22
  */
15
- export const Picker: PickerComponent = ({disabled = false, onValueChange, options, testID, value}: PickerProps) => {
23
+ export const Picker: PickerComponent = ({
24
+ disabled = false,
25
+ onValueChange,
26
+ options,
27
+ pickerStyle = 'wheel',
28
+ testID,
29
+ value,
30
+ }: PickerProps) => {
16
31
  const theme = useAppTheme()
17
32
  const insideHost = useInsideHost()
18
33
  const color = theme.colorString('content.primary')
34
+ const menu = pickerStyle === 'menu'
19
35
 
20
36
  const onChange = useCallback((next: string | number | null) => onValueChange?.(String(next)), [onValueChange])
21
- const wheelModifiers = useMemo(
22
- () => [pickerStyle('wheel'), ...(disabled ? [disabledModifier(true)] : [])],
23
- [disabled]
37
+ const modifiers = useMemo(
38
+ () => [
39
+ pickerStyleModifier(pickerStyle),
40
+ ...(menu ? [tint(theme.color('fill.accent.primary'))] : []),
41
+ ...(disabled ? [disabledModifier(true)] : []),
42
+ ],
43
+ [disabled, menu, pickerStyle, theme]
44
+ )
45
+
46
+ const picker = (
47
+ <SwiftUIPicker modifiers={modifiers} onSelectionChange={onChange} selection={value} testID={testID}>
48
+ {options.map(option => (
49
+ <SwiftUIText key={option.value} modifiers={[tag(option.value), foregroundStyle(color)]}>
50
+ {option.label}
51
+ </SwiftUIText>
52
+ ))}
53
+ </SwiftUIPicker>
24
54
  )
25
55
 
26
56
  if (insideHost) {
57
+ return picker
58
+ }
59
+
60
+ if (menu) {
27
61
  return (
28
- <SwiftUIPicker modifiers={wheelModifiers} onSelectionChange={onChange} selection={value} testID={testID}>
29
- {options.map(option => (
30
- <SwiftUIText key={option.value} modifiers={[tag(option.value), foregroundStyle(color)]}>
31
- {option.label}
32
- </SwiftUIText>
33
- ))}
34
- </SwiftUIPicker>
62
+ <Host colorScheme={theme.dark ? 'dark' : 'light'} matchContents>
63
+ {picker}
64
+ </Host>
35
65
  )
36
66
  }
37
67
 
@@ -8,10 +8,13 @@ export type PickerOption = {
8
8
  value: string
9
9
  }
10
10
 
11
+ /** How SwiftUI shows the picker: a wheel, or a button that opens the options as a menu. */
12
+ export type PickerStyleName = 'menu' | 'wheel'
13
+
11
14
  /**
12
- * A single choice from a list: a SwiftUI wheel picker on iOS, Material's exposed dropdown on Android. It brings its
13
- * own host, so it renders outside `Screen` and `Island` as well. Inside one it renders into that host instead, so it
14
- * can share a stack with other native views.
15
+ * A single choice from a list: a SwiftUI picker on iOS (a wheel, or a menu with `pickerStyle`), Material's exposed
16
+ * dropdown on Android. It brings its own host, so it renders outside `Screen` and `Island` as well. Inside one it
17
+ * renders into that host instead, so it can share a stack with other native views.
15
18
  */
16
19
  export type PickerProps = {
17
20
  /** Stops the user changing the selection, and dims the picker. */
@@ -20,6 +23,12 @@ export type PickerProps = {
20
23
  onValueChange?: (value: string) => void
21
24
  /** The choices, in order. */
22
25
  options: PickerOption[]
26
+ /**
27
+ * SwiftUI's picker style. `wheel` by default: the options on a wheel, always in view. `menu` is a button with the
28
+ * selection, in the accent, that opens the options as a menu: what a screen with more than one picker, or a picker
29
+ * in a row, wants. iOS only. Android ignores it: its exposed dropdown is a menu already.
30
+ */
31
+ pickerStyle?: PickerStyleName
23
32
  /**
24
33
  * Android: the dropdown field's test tag. iOS: the wheel's, inside a `Screen` or `Island` only; on its own,
25
34
  * `@expo/ui`'s wheel picker drops it.
@@ -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` and `previewTransition` are iOS-only.
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 {onPreviewPress: _onPreviewPress, preview: _preview, previewTransition: _previewTransition, ...sx} = props
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