@hzblj/kara-components 0.26.2 → 0.27.1
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 +32 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js +3 -4
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -1
- package/lib/module/atoms/date-picker/date-picker.android.js +3 -4
- package/lib/module/atoms/date-picker/date-picker.android.js.map +1 -1
- package/lib/module/atoms/island/island.android.js +2 -6
- package/lib/module/atoms/island/island.android.js.map +1 -1
- package/lib/module/atoms/picker/picker.android.js +3 -4
- package/lib/module/atoms/picker/picker.android.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +5 -4
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.android.js +3 -4
- package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
- package/lib/module/hooks/compose-host.js +27 -0
- package/lib/module/hooks/compose-host.js.map +1 -0
- package/lib/module/molecules/navigation-bar/bar-search-field.js +80 -0
- package/lib/module/molecules/navigation-bar/bar-search-field.js.map +1 -0
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js +94 -22
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
- package/lib/module/molecules/rn-list-item/rn-list-item.js +3 -2
- package/lib/module/molecules/rn-list-item/rn-list-item.js.map +1 -1
- package/lib/module/molecules/rn-tooltip/rn-tooltip.android.js +3 -4
- package/lib/module/molecules/rn-tooltip/rn-tooltip.android.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.android.js +4 -5
- package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
- package/lib/module/organisms/header/header-options.android.js +2 -6
- package/lib/module/organisms/header/header-options.android.js.map +1 -1
- package/lib/module/organisms/header/header-search-accessory.android.js +29 -2
- package/lib/module/organisms/header/header-search-accessory.android.js.map +1 -1
- package/lib/module/organisms/header/header-search-input.android.js +11 -51
- package/lib/module/organisms/header/header-search-input.android.js.map +1 -1
- package/lib/module/organisms/header/use-header-search.js +19 -11
- package/lib/module/organisms/header/use-header-search.js.map +1 -1
- package/lib/module/organisms/sheet/sheet.js +17 -1
- package/lib/module/organisms/sheet/sheet.js.map +1 -1
- package/lib/module/organisms/sheet/use-sheet-header.js +7 -1
- package/lib/module/organisms/sheet/use-sheet-header.js.map +1 -1
- package/lib/module/templates/screen/screen.android.js +3 -6
- package/lib/module/templates/screen/screen.android.js.map +1 -1
- package/lib/typescript/hooks/compose-host.d.ts +8 -0
- package/lib/typescript/molecules/navigation-bar/bar-search-field.d.ts +29 -0
- package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -6
- package/lib/typescript/organisms/header/header.types.d.ts +20 -10
- package/lib/typescript/organisms/header/use-header-search.d.ts +5 -3
- package/lib/typescript/organisms/sheet/sheet.types.d.ts +1 -1
- package/package.json +4 -4
- package/src/atoms/activity-indicator/activity-indicator.android.tsx +3 -6
- package/src/atoms/date-picker/date-picker.android.tsx +3 -12
- package/src/atoms/island/island.android.tsx +3 -7
- package/src/atoms/picker/picker.android.tsx +3 -3
- package/src/atoms/pressable/pressable.tsx +5 -7
- package/src/atoms/segmented-control/segmented-control.android.tsx +3 -6
- package/src/hooks/compose-host.tsx +20 -0
- package/src/molecules/navigation-bar/bar-search-field.tsx +94 -0
- package/src/molecules/navigation-bar/navigation-bar.android.tsx +119 -19
- package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -6
- package/src/molecules/rn-list-item/rn-list-item.tsx +2 -1
- package/src/molecules/rn-tooltip/rn-tooltip.android.tsx +4 -3
- package/src/organisms/context-menu/context-menu.android.tsx +5 -9
- package/src/organisms/header/header-options.android.tsx +3 -7
- package/src/organisms/header/header-search-accessory.android.tsx +37 -3
- package/src/organisms/header/header-search-input.android.tsx +14 -53
- package/src/organisms/header/header.types.ts +20 -10
- package/src/organisms/header/use-header-search.tsx +18 -10
- package/src/organisms/sheet/sheet.tsx +19 -2
- package/src/organisms/sheet/sheet.types.ts +1 -1
- package/src/organisms/sheet/use-sheet-header.tsx +7 -1
- package/src/templates/screen/screen.android.tsx +4 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAppTheme","useCallback","useMemo","useRef","useState","Platform","headerColor","HeaderSearchAccessory","HEADER_SEARCH_ROW_HEIGHT","HeaderSearchInput","HeaderSearchScrim","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PLACEMENT_OPTIONS","integratedButton","allowToolbarIntegration","hideNavigationBar","stacked","useHeaderSearch","cancelIcon","clearIcon","enabled","placeholder","placement","voice","theme","query","setQuery","focused","setFocused","searchBarRef","inputRef","lastSetText","voiceRef","current","cancelVoice","listening","onCancel","changeQuery","text","reset","searchBar","
|
|
1
|
+
{"version":3,"names":["useAppTheme","useCallback","useMemo","useRef","useState","Platform","headerColor","HeaderSearchAccessory","HEADER_SEARCH_ROW_HEIGHT","HeaderSearchInput","HeaderSearchScrim","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PLACEMENT_OPTIONS","integratedButton","allowToolbarIntegration","hideNavigationBar","stacked","useHeaderSearch","cancelIcon","clearIcon","enabled","placeholder","placement","voice","theme","query","setQuery","focused","setFocused","searchBarRef","inputRef","lastSetText","voiceRef","headerField","OS","current","cancelVoice","listening","onCancel","changeQuery","text","reset","searchBar","undefined","autoCapitalize","headerIconColor","hideWhenScrolling","hintTextColor","obscureBackground","onBlur","onCancelButtonPress","onChangeText","event","nativeEvent","onClose","onFocus","onOpen","ref","textColor","tintColor","searchInput","onFocusChange","clear","cancelSearch","blur","setText","dimmed","trim","length","scrim","children","onPress","topOffset"],"sourceRoot":"../../../../src","sources":["organisms/header/use-header-search.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAQC,QAAQ,QAAO,cAAc;AAIrC,S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,OAAO,GAAGK,IAAI;IAC1Bd,QAAQ,CAACc,IAAI,CAAC;IACdX,YAAY,CAACM,OAAO,EAAE8B,OAAO,CAACzB,IAAI,CAAC;IACnCV,QAAQ,CAACK,OAAO,EAAE8B,OAAO,CAACzB,IAAI,CAAC;EACjC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAM0B,MAAM,GAAG9C,OAAO,IAAIO,OAAO,IAAIF,KAAK,CAAC0C,IAAI,CAAC,CAAC,CAACC,MAAM,KAAK,CAAC;EAE9D,MAAMC,KAAK,GAAGxE,OAAO,CAAC,MAAM;IAC1B,IAAI,CAACuB,OAAO,EAAE;MACZ,OAAO,IAAI;IACb;IAEA,oBACET,KAAA,CAAAF,SAAA;MAAA6D,QAAA,GACGJ,MAAM,gBAAG3D,IAAA,CAACF,iBAAiB;QAACkE,OAAO,EAAET,KAAM;QAACU,SAAS,EAAEvC,WAAW,GAAG,CAAC,GAAG9B;MAAyB,CAAE,CAAC,GAAG,IAAI,EAC5G8B,WAAW,gBAAG1B,IAAA,CAACL,qBAAqB;QAACgB,UAAU,EAAEA,UAAW;QAACC,SAAS,EAAEA,SAAU;QAACI,KAAK,EAAEA;MAAM,CAAE,CAAC,GAAG,IAAI;IAAA,CAC3G,CAAC;EAEP,CAAC,EAAE,CAACL,UAAU,EAAE4C,KAAK,EAAE3C,SAAS,EAAE+C,MAAM,EAAE9C,OAAO,EAAEa,WAAW,EAAEV,KAAK,CAAC,CAAC;EAEvE,OAAO;IAACuC,KAAK;IAAErC,KAAK;IAAE4C,KAAK;IAAE3B,SAAS;IAAEkB,WAAW;IAAEK;EAAO,CAAC;AAC/D,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useAppTheme } from '@hzblj/kara-theme';
|
|
3
|
+
import { useAppTheme, withOpacity } from '@hzblj/kara-theme';
|
|
4
4
|
import { TrueSheet } from '@lodev09/react-native-true-sheet';
|
|
5
5
|
import { useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
@@ -47,6 +47,21 @@ const SheetRoot = ({
|
|
|
47
47
|
header: headerProps,
|
|
48
48
|
scrollable
|
|
49
49
|
});
|
|
50
|
+
const inverted = headerProps?.inverted ?? false;
|
|
51
|
+
/**
|
|
52
|
+
* Material's drag handle, `onSurfaceVariant` at 40 %, in the app's theme. TrueSheet's own Android grabber picks black
|
|
53
|
+
* or white by the system's night mode, so an app themed apart from the device drew it in the sheet's own colour.
|
|
54
|
+
*/
|
|
55
|
+
const grabberOptions = useMemo(() => {
|
|
56
|
+
if (Platform.OS !== 'android') {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const color = inverted ? theme.color('content.on.accent:o40') : withOpacity(String(theme.color('content.secondary')), 'o40');
|
|
60
|
+
return {
|
|
61
|
+
adaptive: false,
|
|
62
|
+
color
|
|
63
|
+
};
|
|
64
|
+
}, [inverted, theme]);
|
|
50
65
|
const sheetRef = useRef(null);
|
|
51
66
|
const presented = useRef(false);
|
|
52
67
|
/** A dismissal we asked for: `onDismiss` reports the user's, never ours. */
|
|
@@ -108,6 +123,7 @@ const SheetRoot = ({
|
|
|
108
123
|
draggable: draggable,
|
|
109
124
|
footer: footer,
|
|
110
125
|
grabber: grabber,
|
|
126
|
+
grabberOptions: grabberOptions,
|
|
111
127
|
header: sheetHeader.header,
|
|
112
128
|
headerStyle: sheetHeader.headerStyle,
|
|
113
129
|
onDetentChange: handleDetentChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAppTheme","TrueSheet","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","Platform","StyleSheet","View","SheetHeader","SheetScrollContext","SheetScrollView","splitSheetChildren","useSheetHeader","jsxs","_jsxs","jsx","_jsx","FIT_CONTENT","CORNER_RADIUS","OS","undefined","styles","create","host","position","SheetRoot","bg","children","detents","dimmed","dismissible","draggable","footer","grabber","onDetentChange","onDismiss","onPresent","ref","scrollable","systemBackground","testID","visible","theme","content","header","headerProps","sheetHeader","sheetRef","presented","programmaticDismiss","dismiss","current","Promise","resolve","present","detentIndex","resize","sheet","handleDidDismiss","handleDetentChange","event","nativeEvent","index","collapsable","pointerEvents","style","backgroundColor","
|
|
1
|
+
{"version":3,"names":["useAppTheme","withOpacity","TrueSheet","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","Platform","StyleSheet","View","SheetHeader","SheetScrollContext","SheetScrollView","splitSheetChildren","useSheetHeader","jsxs","_jsxs","jsx","_jsx","FIT_CONTENT","CORNER_RADIUS","OS","undefined","styles","create","host","position","SheetRoot","bg","children","detents","dimmed","dismissible","draggable","footer","grabber","onDetentChange","onDismiss","onPresent","ref","scrollable","systemBackground","testID","visible","theme","content","header","headerProps","sheetHeader","inverted","grabberOptions","color","String","adaptive","sheetRef","presented","programmaticDismiss","dismiss","current","Promise","resolve","present","detentIndex","resize","sheet","handleDidDismiss","handleDetentChange","event","nativeEvent","index","collapsable","pointerEvents","style","backgroundColor","cornerRadius","headerStyle","onDidDismiss","onDidPresent","scrollableOptions","Provider","value","scrollContext","staticLargeTitle","Sheet","Object","assign","Header","ScrollView"],"sourceRoot":"../../../../src","sources":["organisms/sheet/sheet.tsx"],"mappings":";;AAAA,SAAQA,WAAW,EAAEC,WAAW,QAAO,mBAAmB;AAC1D,SAAqDC,SAAS,QAAO,kCAAkC;AACvG,SAAQC,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAO,OAAO;AACnG,SAAQC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AAEvD,SAAQC,WAAW,QAAO,mBAAgB;AAC1C,SAAQC,kBAAkB,EAAEC,eAAe,QAAO,mBAAgB;AAClE,SAAQC,kBAAkB,QAAO,2BAAwB;AACzD,SAAQC,cAAc,QAAO,u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MAAM,EAAEA,MAAO;MACfC,WAAW,EAAEA,WAAY;MACzBC,SAAS,EAAEA,SAAU;MACrBC,MAAM,EAAEA,MAAO;MACfC,OAAO,EAAEA,OAAQ;MACjBe,cAAc,EAAEA,cAAe;MAC/BJ,MAAM,EAAEE,WAAW,CAACF,MAAO;MAC3B6B,WAAW,EAAE3B,WAAW,CAAC2B,WAAY;MACrCvC,cAAc,EAAE8B,kBAAmB;MACnCU,YAAY,EAAEX,gBAAiB;MAC/BY,YAAY,EAAEvC,SAAU;MACxBC,GAAG,EAAEe,QAAS;MACdd,UAAU,EAAEA,UAAW;MACvBsC,iBAAiB,EAAE9B,WAAW,CAAC8B,iBAAkB;MACjDpC,MAAM,EAAEA,MAAO;MAAAb,QAAA,eAEfb,KAAA,CAACL,kBAAkB,CAACoE,QAAQ;QAACC,KAAK,EAAEhC,WAAW,CAACiC,aAAc;QAAApD,QAAA,GAC3DmB,WAAW,CAACkC,gBAAgB,EAC5BrC,OAAO;MAAA,CACmB;IAAC,CACrB;EAAC,CACR,CAAC;AAEX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMsC,KAAqB,GAAGC,MAAM,CAACC,MAAM,CAAC1D,SAAS,EAAE;EAAC2D,MAAM,EAAE5E,WAAW;EAAE6E,UAAU,EAAE3E;AAAe,CAAC,CAAC","ignoreList":[]}
|
|
@@ -12,6 +12,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
/** The bar's own height (`NavigationBar`) plus the room above it, before the header has been measured. */
|
|
13
13
|
const ESTIMATED_HEADER_HEIGHT = (Platform.OS === 'ios' ? 56 : 64) + spacing.s16;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Above a header with no bar. Android's grabber is drawn over the sheet's content, 16 dp from the top and 4 dp tall, so
|
|
17
|
+
* there the header starts 8 dp under it. iOS's grabber ends 10 pt from the top, inside the usual 16 pt.
|
|
18
|
+
*/
|
|
19
|
+
const HEADER_TOP_WITHOUT_BAR = Platform.OS === 'android' ? 's28' : 's16';
|
|
20
|
+
|
|
15
21
|
/** Where a large title's bar title appears once it has scrolled away: the platform's own place for it. */
|
|
16
22
|
const COLLAPSED_TITLE_ALIGNMENT = Platform.OS === 'ios' ? 'center' : 'leading';
|
|
17
23
|
|
|
@@ -87,7 +93,7 @@ export const useSheetHeader = ({
|
|
|
87
93
|
}
|
|
88
94
|
return /*#__PURE__*/_jsxs(Box, {
|
|
89
95
|
onLayout: isOverlay ? handleHeaderLayout : undefined,
|
|
90
|
-
pt:
|
|
96
|
+
pt: hasBar ? 's16' : HEADER_TOP_WITHOUT_BAR,
|
|
91
97
|
children: [hasBar ? /*#__PURE__*/_jsx(NavigationBar, {
|
|
92
98
|
inverted: inverted,
|
|
93
99
|
leadingItems: leadingItems,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isScrollEdgeEffectAvailable","spacing","useCallback","useMemo","useRef","useState","Platform","Box","RnText","NavigationBar","SEARCH_ROW_HEIGHT","jsx","_jsx","jsxs","_jsxs","ESTIMATED_HEADER_HEIGHT","OS","s16","COLLAPSED_TITLE_ALIGNMENT","OVERLAY_HEADER_STYLE","left","position","right","top","zIndex","SOFT_EDGE_EFFECTS","bottomScrollEdgeEffect","topScrollEdgeEffect","SheetLargeTitle","onLayout","title","pb","pt","px","children","accessibilityRole","variant","useSheetHeader","header","headerProps","scrollable","titleStyle","leadingItems","trailingItems","inverted","search","accessory","hasBar","undefined","length","searchRowHeight","placement","hasHeader","isOverlay","isLargeTitle","headerHeight","setHeaderHeight","largeTitleScrolledAway","setLargeTitleScrolledAway","largeTitleHeight","handleHeaderLayout","event","nativeEvent","layout","height","handleLargeTitleLayout","current","handleScroll","contentOffset","y","titleAlignment","titleVisible","headerElement","largeTitle","scrollContext","onScroll","topInset","headerStyle","scrollableOptions","staticLargeTitle"],"sourceRoot":"../../../../src","sources":["organisms/sheet/use-sheet-header.tsx"],"mappings":";;AAAA,SAAQA,2BAA2B,QAAO,oBAAoB;AAC9D,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAgCC,QAAQ,QAAuB,cAAc;AAE7E,SAAQC,GAAG,QAAO,0BAAiB;AACnC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,aAAa,QAAyC,yCAAgC;AAC9F,SAAQC,iBAAiB,QAAO,4DAAyD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQzF;AACA,MAAMC,uBAAuB,GAAG,CAACT,QAAQ,CAACU,EAAE,KAAK,KAAK,GAAG,EAAE,GAAG,EAAE,IAAIf,OAAO,CAACgB,GAAG;;AAE/E;AACA,MAAMC,
|
|
1
|
+
{"version":3,"names":["isScrollEdgeEffectAvailable","spacing","useCallback","useMemo","useRef","useState","Platform","Box","RnText","NavigationBar","SEARCH_ROW_HEIGHT","jsx","_jsx","jsxs","_jsxs","ESTIMATED_HEADER_HEIGHT","OS","s16","HEADER_TOP_WITHOUT_BAR","COLLAPSED_TITLE_ALIGNMENT","OVERLAY_HEADER_STYLE","left","position","right","top","zIndex","SOFT_EDGE_EFFECTS","bottomScrollEdgeEffect","topScrollEdgeEffect","SheetLargeTitle","onLayout","title","pb","pt","px","children","accessibilityRole","variant","useSheetHeader","header","headerProps","scrollable","titleStyle","leadingItems","trailingItems","inverted","search","accessory","hasBar","undefined","length","searchRowHeight","placement","hasHeader","isOverlay","isLargeTitle","headerHeight","setHeaderHeight","largeTitleScrolledAway","setLargeTitleScrolledAway","largeTitleHeight","handleHeaderLayout","event","nativeEvent","layout","height","handleLargeTitleLayout","current","handleScroll","contentOffset","y","titleAlignment","titleVisible","headerElement","largeTitle","scrollContext","onScroll","topInset","headerStyle","scrollableOptions","staticLargeTitle"],"sourceRoot":"../../../../src","sources":["organisms/sheet/use-sheet-header.tsx"],"mappings":";;AAAA,SAAQ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a,EAAEA;MAAc,CAC9B,CAAC,GACA,IAAI,EACPG,SAAS;IAAA,CACP,CAAC;EAEV,CAAC,EAAE,CACDA,SAAS,EACTc,kBAAkB,EAClBb,MAAM,EACNK,SAAS,EACTR,QAAQ,EACRS,SAAS,EACTX,YAAY,EACZG,MAAM,EACNf,KAAK,EACLwC,cAAc,EACdC,YAAY,EACZ5B,aAAa,CACd,CAAC;EAEF,MAAM8B,UAAU,GAAGvE,OAAO,CACxB,MAAO4B,KAAK,IAAIwB,YAAY,gBAAG3C,IAAA,CAACiB,eAAe;IAACC,QAAQ,EAAEoC,sBAAuB;IAACnC,KAAK,EAAEA;EAAM,CAAE,CAAC,GAAG,IAAK,EAC1G,CAACmC,sBAAsB,EAAEX,YAAY,EAAExB,KAAK,CAC9C,CAAC;EAED,MAAM4C,aAAa,GAAGxE,OAAO,CAC3B,OAAO;IACLuE,UAAU,EAAEjC,UAAU,GAAGiC,UAAU,GAAG,IAAI;IAC1CE,QAAQ,EAAEnC,UAAU,IAAIc,YAAY,GAAGa,YAAY,GAAGnB,SAAS;IAC/D4B,QAAQ,EAAEvB,SAAS,GAAGE,YAAY,GAAG;EACvC,CAAC,CAAC,EACF,CAACY,YAAY,EAAEZ,YAAY,EAAED,YAAY,EAAED,SAAS,EAAEoB,UAAU,EAAEjC,UAAU,CAC9E,CAAC;EAED,OAAO;IACLF,MAAM,EAAEkC,aAAa;IACrBK,WAAW,EAAExB,SAAS,GAAGlC,oBAAoB,GAAG6B,SAAS;IACzD8B,iBAAiB,EAAEzB,SAAS,GAAG5B,iBAAiB,GAAGuB,SAAS;IAC5D0B,aAAa;IACb;IACAK,gBAAgB,EAAEvC,UAAU,GAAG,IAAI,GAAGiC;EACxC,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Column
|
|
3
|
+
import { Column } from '@expo/ui/jetpack-compose';
|
|
4
4
|
import { padding } from '@expo/ui/jetpack-compose/modifiers';
|
|
5
5
|
import { useSxModifiers } from '@hzblj/kara-sx';
|
|
6
|
-
import { useAppTheme } from '@hzblj/kara-theme';
|
|
7
6
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
8
7
|
import { StatusBar, StyleSheet, View } from 'react-native';
|
|
8
|
+
import { ComposeHost } from "../../hooks/compose-host.js";
|
|
9
9
|
import { HostBoundary } from "../../hooks/host-context.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
/**
|
|
@@ -19,7 +19,6 @@ export const Screen = ({
|
|
|
19
19
|
ignoreSafeArea = 'none',
|
|
20
20
|
testID
|
|
21
21
|
}) => {
|
|
22
|
-
const theme = useAppTheme();
|
|
23
22
|
const frame = useRef(null);
|
|
24
23
|
const [statusBarOverlap, setStatusBarOverlap] = useState(0);
|
|
25
24
|
const sx = useSxModifiers({
|
|
@@ -38,10 +37,8 @@ export const Screen = ({
|
|
|
38
37
|
ref: frame,
|
|
39
38
|
style: StyleSheet.absoluteFill,
|
|
40
39
|
testID: testID,
|
|
41
|
-
children: /*#__PURE__*/_jsx(
|
|
42
|
-
colorScheme: theme.dark ? 'dark' : 'light',
|
|
40
|
+
children: /*#__PURE__*/_jsx(ComposeHost, {
|
|
43
41
|
ignoreSafeAreaKeyboardInsets: ignoreSafeArea === 'all' || ignoreSafeArea === 'keyboard',
|
|
44
|
-
seedColor: theme.materialSeed,
|
|
45
42
|
style: StyleSheet.absoluteFill,
|
|
46
43
|
children: /*#__PURE__*/_jsx(Column, {
|
|
47
44
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Column","
|
|
1
|
+
{"version":3,"names":["Column","padding","useSxModifiers","useCallback","useMemo","useRef","useState","StatusBar","StyleSheet","View","ComposeHost","HostBoundary","jsx","_jsx","Screen","bg","children","ignoreSafeArea","testID","frame","statusBarOverlap","setStatusBarOverlap","sx","tall","wide","modifiers","onLayout","current","measureInWindow","_x","y","Math","max","round","currentHeight","ref","style","absoluteFill","ignoreSafeAreaKeyboardInsets"],"sourceRoot":"../../../../src","sources":["templates/screen/screen.android.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,0BAA0B;AAC/C,SAAQC,OAAO,QAAO,oCAAoC;AAC1D,SAAQC,cAAc,QAAO,gBAAgB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAQC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AACxD,SAAQC,WAAW,QAAO,6BAA0B;AACpD,SAAQC,YAAY,QAAO,6BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGrD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EACtCC,EAAE,GAAG,cAAc;EACnBC,QAAQ;EACRC,cAAc,GAAG,MAAM;EACvBC;AACW,CAAC,KAAK;EACjB,MAAMC,KAAK,GAAGd,MAAM,CAAO,IAAI,CAAC;EAChC,MAAM,CAACe,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGf,QAAQ,CAAC,CAAC,CAAC;EAC3D,MAAMgB,EAAE,GAAGpB,cAAc,CAAC;IAACa,EAAE;IAAEQ,IAAI,EAAE,IAAI;IAAEC,IAAI,EAAE;EAAI,CAAC,CAAC;EACvD,MAAMC,SAAS,GAAGrB,OAAO,CACvB,MAAOgB,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAGE,EAAE,EAAErB,OAAO,CAAC,CAAC,EAAEmB,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGE,EAAG,EAC/E,CAACF,gBAAgB,EAAEE,EAAE,CACvB,CAAC;EAED,MAAMI,QAAQ,GAAGvB,WAAW,CAAC,MAAM;IACjCgB,KAAK,CAACQ,OAAO,EAAEC,eAAe,CAAC,CAACC,EAAE,EAAEC,CAAC,KAAK;MACxCT,mBAAmB,CAACU,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAAC,CAAC1B,SAAS,CAAC2B,aAAa,IAAI,CAAC,IAAIJ,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEjB,IAAA,CAACJ,IAAI;IAACiB,QAAQ,EAAEA,QAAS;IAACS,GAAG,EAAEhB,KAAM;IAACiB,KAAK,EAAE5B,UAAU,CAAC6B,YAAa;IAACnB,MAAM,EAAEA,MAAO;IAAAF,QAAA,eACnFH,IAAA,CAACH,WAAW;MACV4B,4BAA4B,EAAErB,cAAc,KAAK,KAAK,IAAIA,cAAc,KAAK,UAAW;MACxFmB,KAAK,EAAE5B,UAAU,CAAC6B,YAAa;MAAArB,QAAA,eAE/BH,IAAA,CAACb,MAAM;QAACyB,SAAS,EAAEA,SAAU;QAAAT,QAAA,eAC3BH,IAAA,CAACF,YAAY;UAAAK,QAAA,EAAEA;QAAQ,CAAe;MAAC,CACjC;IAAC,CACE;EAAC,CACV,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HostProps } from '@expo/ui/jetpack-compose';
|
|
2
|
+
export type ComposeHostProps = Omit<HostProps, 'colorScheme' | 'seedColor'>;
|
|
3
|
+
/**
|
|
4
|
+
* Every Compose tree kara draws on Android: the theme's appearance and Material seed, and `fill.ripple` as the ripple of
|
|
5
|
+
* every Material control inside, so a press looks the same on a button, a chip and a list row. Import it only from
|
|
6
|
+
* `.android` files.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ComposeHost: ({ children, ...props }: ComposeHostProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type SearchFieldRef } from '@hzblj/kara-native/jetpack-compose';
|
|
2
|
+
import { type ReactNode, type Ref } from 'react';
|
|
3
|
+
import type { IconName } from '../../atoms/icon';
|
|
4
|
+
import type { SearchFieldVoice } from './navigation-bar.types';
|
|
5
|
+
/** A search row's height under a bar, for what is laid out below it. */
|
|
6
|
+
export declare const BAR_SEARCH_ROW_HEIGHT: number;
|
|
7
|
+
export type BarSearchFieldProps = {
|
|
8
|
+
/** Focuses the field and shows the keyboard as soon as it is composed. */
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
/** The text button beside a focused field that empties and blurs it. `Cancel` by default. */
|
|
11
|
+
cancelLabel?: string;
|
|
12
|
+
clearIcon?: IconName;
|
|
13
|
+
onChangeText: (text: string) => void;
|
|
14
|
+
onFocusChange?: (focused: boolean, hasText: boolean) => void;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
ref?: Ref<SearchFieldRef>;
|
|
17
|
+
testID?: string;
|
|
18
|
+
voice?: SearchFieldVoice;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The search field kara draws on Android, in a header row or inside a bar: Material's input field in the theme's
|
|
22
|
+
* colours and body face, with the app's icons and the voice. A Compose view, so the caller brings the host. Import it
|
|
23
|
+
* only from `.android` files.
|
|
24
|
+
*/
|
|
25
|
+
export declare const BarSearchField: ({ autoFocus, cancelLabel, clearIcon, onChangeText, onFocusChange, placeholder, ref, testID, voice, }: BarSearchFieldProps) => import("react").JSX.Element;
|
|
26
|
+
/** A search field's own row under a bar, in its own host. */
|
|
27
|
+
export declare const BarSearchRow: ({ children }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}) => import("react").JSX.Element;
|
|
@@ -72,18 +72,20 @@ export type NavigationBarSearchRef = {
|
|
|
72
72
|
setText: (text: string) => void;
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
|
-
* Where the search field goes
|
|
76
|
-
*
|
|
75
|
+
* Where the search field goes, as a native-stack header places its search: `stacked` in a row of its own under the
|
|
76
|
+
* title, `integratedButton` as a search item that turns the bar into the field.
|
|
77
77
|
*/
|
|
78
78
|
export type NavigationBarSearchPlacement = 'integratedButton' | 'stacked';
|
|
79
79
|
/**
|
|
80
80
|
* Where `integratedButton` puts its search button: beside the trailing items, or after the leading ones. On iOS 26 the
|
|
81
|
-
* button grows into the field and the cancel splits off its end, the way the system's own search does
|
|
81
|
+
* button grows into the field and the cancel splits off its end, the way the system's own search does; on Android the
|
|
82
|
+
* field grows over the bar from its trailing edge.
|
|
82
83
|
*/
|
|
83
84
|
export type NavigationBarSearchButtonPlacement = 'leading' | 'trailing';
|
|
84
85
|
/**
|
|
85
|
-
* A search field in the bar.
|
|
86
|
-
*
|
|
86
|
+
* A search field in the bar. A focused field gets a cancel that empties it and ends the search: a bar item on iOS,
|
|
87
|
+
* Material's text button beside the field on Android. An `integratedButton` search closes again once the field is
|
|
88
|
+
* cancelled, cleared or left empty.
|
|
87
89
|
*/
|
|
88
90
|
export type NavigationBarSearch = {
|
|
89
91
|
/** `integratedButton`: the search item's icon, one of the app's icons; the system magnifying glass unset. */
|
|
@@ -126,7 +128,7 @@ export type NavigationBarProps = {
|
|
|
126
128
|
inverted?: boolean;
|
|
127
129
|
/** In screen order, from the leading edge. */
|
|
128
130
|
leadingItems?: NavigationBarItem[];
|
|
129
|
-
/** A search field
|
|
131
|
+
/** A search field: under the title, or behind a search item that turns the bar into the field. */
|
|
130
132
|
search?: NavigationBarSearch;
|
|
131
133
|
/** Test identifier, forwarded to the native bar. iOS only; Android ignores it. */
|
|
132
134
|
testID?: string;
|
|
@@ -281,8 +281,12 @@ export type HeaderOptionsResult = HeaderContent & {
|
|
|
281
281
|
export type HeaderSearchBarOptions = {
|
|
282
282
|
allowToolbarIntegration?: boolean;
|
|
283
283
|
autoCapitalize?: 'characters' | 'none' | 'sentences' | 'words';
|
|
284
|
+
/** Android: the toolbar search's magnifier and X. */
|
|
285
|
+
headerIconColor?: string;
|
|
284
286
|
hideNavigationBar?: boolean;
|
|
285
287
|
hideWhenScrolling?: boolean;
|
|
288
|
+
/** Android: the placeholder's colour. */
|
|
289
|
+
hintTextColor?: string;
|
|
286
290
|
obscureBackground?: boolean;
|
|
287
291
|
onBlur?: () => void;
|
|
288
292
|
onCancelButtonPress?: () => void;
|
|
@@ -291,16 +295,22 @@ export type HeaderSearchBarOptions = {
|
|
|
291
295
|
text: string;
|
|
292
296
|
};
|
|
293
297
|
}) => void;
|
|
298
|
+
/** Android: the toolbar search closed (back, or the X on an empty field). */
|
|
299
|
+
onClose?: () => void;
|
|
294
300
|
onFocus?: () => void;
|
|
301
|
+
/** Android: the toolbar search opened. */
|
|
302
|
+
onOpen?: () => void;
|
|
295
303
|
placeholder?: string;
|
|
296
304
|
placement?: 'automatic' | 'inline' | 'integrated' | 'integratedButton' | 'integratedCentered' | 'stacked';
|
|
297
305
|
ref?: RefObject<SearchBarCommands | null>;
|
|
306
|
+
/** Android: the typed text. */
|
|
307
|
+
textColor?: string;
|
|
298
308
|
tintColor?: string;
|
|
299
309
|
};
|
|
300
310
|
/**
|
|
301
|
-
* Where the search goes
|
|
302
|
-
*
|
|
303
|
-
*
|
|
311
|
+
* Where the search goes: `stacked` in a row under the title (title and items kept); `integratedButton` as a search
|
|
312
|
+
* button in the bar's trailing corner that opens the field in the bar, the title and items hidden meanwhile. On iOS the
|
|
313
|
+
* integrated field's close is the system's, which takes no other glyph; on Android back closes it.
|
|
304
314
|
*/
|
|
305
315
|
export type HeaderSearchPlacement = 'integratedButton' | 'stacked';
|
|
306
316
|
export type HeaderSearchParams = {
|
|
@@ -312,15 +322,15 @@ export type HeaderSearchParams = {
|
|
|
312
322
|
enabled?: boolean;
|
|
313
323
|
/** Shown while the field is empty. `Search` by default. */
|
|
314
324
|
placeholder?: string;
|
|
315
|
-
/**
|
|
325
|
+
/** `stacked` by default. */
|
|
316
326
|
placement?: HeaderSearchPlacement;
|
|
317
327
|
/** A microphone in the field: see `SearchFieldVoice`. Write what it hears with `setText`. */
|
|
318
328
|
voice?: SearchFieldVoice;
|
|
319
329
|
};
|
|
320
330
|
/**
|
|
321
|
-
* A header's search: what to give `useHeader` (`searchBar
|
|
322
|
-
* the scrim that washes the content out while the field is focused and empty (render it last, over
|
|
323
|
-
* the query to filter by.
|
|
331
|
+
* A header's search: what to give `useHeader` (`searchBar`), the row Android puts under its bar for `stacked`
|
|
332
|
+
* (`searchInput`), the scrim that washes the content out while the field is focused and empty (render it last, over
|
|
333
|
+
* the content), and the query to filter by.
|
|
324
334
|
*/
|
|
325
335
|
export type HeaderSearch = {
|
|
326
336
|
/** Empties the field and ends the search. */
|
|
@@ -328,13 +338,13 @@ export type HeaderSearch = {
|
|
|
328
338
|
/** The field's text. */
|
|
329
339
|
query: string;
|
|
330
340
|
/**
|
|
331
|
-
* Over the content while the field is focused and empty; a tap on it ends the search.
|
|
341
|
+
* Over the content while the field is focused and empty; a tap on it ends the search. It also carries the header
|
|
332
342
|
* field's glyphs and voice, which have to sit in the screen's tree. Render it last.
|
|
333
343
|
*/
|
|
334
344
|
scrim: ReactElement | null;
|
|
335
|
-
/** Android
|
|
345
|
+
/** Android, `stacked`: the Material search field, a row to put right under the bar. `null` otherwise. */
|
|
336
346
|
searchInput: ReactElement | null;
|
|
337
|
-
/**
|
|
347
|
+
/** `search` for `useHeader`: always on iOS, for `integratedButton` on Android. `undefined` otherwise. */
|
|
338
348
|
searchBar: HeaderSearchBarOptions | undefined;
|
|
339
349
|
/** Puts text into the field and the query, the way dictation fills it in. */
|
|
340
350
|
setText: (text: string) => void;
|
|
@@ -2,9 +2,11 @@ import type { HeaderSearch, HeaderSearchParams } from './header.types';
|
|
|
2
2
|
/**
|
|
3
3
|
* A search field for a screen's header. iOS: UIKit's search bar stacked under the title, with the title and items kept
|
|
4
4
|
* and nothing dimmed by the system, so a list can filter live, or behind a search button in the bar's corner
|
|
5
|
-
* (`placement`); pass `searchBar` to `useHeader` as `search`. Android: Material's search field with its
|
|
6
|
-
* as a row for the screen to put right under the top app bar (`searchInput`)
|
|
7
|
-
*
|
|
5
|
+
* (`placement`); pass `searchBar` to `useHeader` as `search`. Android: `stacked` is Material's search field with its
|
|
6
|
+
* cancel button, as a row for the screen to put right under the top app bar (`searchInput`); `integratedButton` is the
|
|
7
|
+
* toolbar's own search, a magnifier in the bar's corner that expands over the title (`searchBar`, as on iOS). Both
|
|
8
|
+
* report the `query`; `scrim` washes the content out while the field is focused and empty and carries the header
|
|
9
|
+
* field's glyphs and voice.
|
|
8
10
|
*
|
|
9
11
|
* With `voice` the field has a microphone; the app runs the dictation and writes what it hears with `setText`. Typing
|
|
10
12
|
* over it, or ending the search, calls `voice.onCancel`.
|
|
@@ -60,7 +60,7 @@ export type SheetProps = {
|
|
|
60
60
|
draggable?: boolean;
|
|
61
61
|
/** Pinned to the bottom, above the content and the keyboard. */
|
|
62
62
|
footer?: ReactElement;
|
|
63
|
-
/** The drag handle. On by default. */
|
|
63
|
+
/** The drag handle. On by default. On Android it is Material's handle, coloured by the app's theme. */
|
|
64
64
|
grabber?: boolean;
|
|
65
65
|
/** The user dismissed it; `visible` going false does not call this. */
|
|
66
66
|
onDismiss: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzblj/kara-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
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",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@hzblj/expo-native-icons": "^0.2.0",
|
|
68
68
|
"@hzblj/expo-rich-haptics": "^0.1.0",
|
|
69
|
-
"@hzblj/kara-native": "^0.
|
|
70
|
-
"@hzblj/kara-sx": "^0.
|
|
71
|
-
"@hzblj/kara-theme": "^0.
|
|
69
|
+
"@hzblj/kara-native": "^0.27.1",
|
|
70
|
+
"@hzblj/kara-sx": "^0.27.1",
|
|
71
|
+
"@hzblj/kara-theme": "^0.27.1",
|
|
72
72
|
"sf-symbols-typescript": "^2.2.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {LoadingIndicator} from '@expo/ui/jetpack-compose'
|
|
2
2
|
import {fillMaxSize, size as sizeModifier, testID as testIdModifier} from '@expo/ui/jetpack-compose/modifiers'
|
|
3
3
|
import {useAccessibilityModifiers} from '@hzblj/kara-sx'
|
|
4
4
|
import {useAppTheme} from '@hzblj/kara-theme'
|
|
5
5
|
import {useMemo} from 'react'
|
|
6
6
|
import {StyleSheet} from 'react-native'
|
|
7
7
|
|
|
8
|
+
import {ComposeHost} from '../../hooks/compose-host'
|
|
8
9
|
import {useInsideHost} from '../../hooks/host-context'
|
|
9
10
|
import type {ActivityIndicatorComponent, ActivityIndicatorProps} from './activity-indicator.types'
|
|
10
11
|
|
|
@@ -43,9 +44,5 @@ export const ActivityIndicator: ActivityIndicatorComponent = ({
|
|
|
43
44
|
return indicator
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
return
|
|
47
|
-
<Host colorScheme={theme.dark ? 'dark' : 'light'} seedColor={theme.materialSeed} style={styles[size]}>
|
|
48
|
-
{indicator}
|
|
49
|
-
</Host>
|
|
50
|
-
)
|
|
47
|
+
return <ComposeHost style={styles[size]}>{indicator}</ComposeHost>
|
|
51
48
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {DateTimePicker} from '@expo/ui/community/datetime-picker'
|
|
2
|
-
import {DateTimePicker as ComposeDateTimePicker,
|
|
2
|
+
import {DateTimePicker as ComposeDateTimePicker, RNHostView} from '@expo/ui/jetpack-compose'
|
|
3
3
|
import {alpha, testID as testIdModifier} from '@expo/ui/jetpack-compose/modifiers'
|
|
4
4
|
import {opacity, useAppTheme} from '@hzblj/kara-theme'
|
|
5
5
|
import {useCallback, useMemo, useState} from 'react'
|
|
6
6
|
|
|
7
|
+
import {ComposeHost} from '../../hooks/compose-host'
|
|
7
8
|
import {useInsideHost} from '../../hooks/host-context'
|
|
8
9
|
import {Box} from '../box'
|
|
9
10
|
import {Pressable} from '../pressable'
|
|
@@ -104,17 +105,7 @@ export const DatePicker: DatePickerComponent = (props: DatePickerProps) => {
|
|
|
104
105
|
if (datePickerStyle === 'graphical' && mode !== 'time') {
|
|
105
106
|
const calendar = <Calendar {...props} disabled={disabled} />
|
|
106
107
|
|
|
107
|
-
return insideHost ?
|
|
108
|
-
calendar
|
|
109
|
-
) : (
|
|
110
|
-
<Host
|
|
111
|
-
colorScheme={theme.dark ? 'dark' : 'light'}
|
|
112
|
-
matchContents={MATCH_HEIGHT_ONLY}
|
|
113
|
-
seedColor={theme.materialSeed}
|
|
114
|
-
>
|
|
115
|
-
{calendar}
|
|
116
|
-
</Host>
|
|
117
|
-
)
|
|
108
|
+
return insideHost ? calendar : <ComposeHost matchContents={MATCH_HEIGHT_ONLY}>{calendar}</ComposeHost>
|
|
118
109
|
}
|
|
119
110
|
|
|
120
111
|
const field = (
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {Host} from '@expo/ui/jetpack-compose'
|
|
2
1
|
import {useSx} from '@hzblj/kara-sx'
|
|
3
|
-
import {useAppTheme} from '@hzblj/kara-theme'
|
|
4
2
|
|
|
3
|
+
import {ComposeHost} from '../../hooks/compose-host'
|
|
5
4
|
import {HostBoundary} from '../../hooks/host-context'
|
|
6
5
|
import type {IslandComponent, IslandProps} from './island.types'
|
|
7
6
|
|
|
@@ -17,18 +16,15 @@ export const Island: IslandComponent = ({
|
|
|
17
16
|
testID: _testID,
|
|
18
17
|
...sx
|
|
19
18
|
}: IslandProps) => {
|
|
20
|
-
const theme = useAppTheme()
|
|
21
19
|
const resolved = useSx(sx)
|
|
22
20
|
|
|
23
21
|
return (
|
|
24
|
-
<
|
|
25
|
-
colorScheme={theme.dark ? 'dark' : 'light'}
|
|
22
|
+
<ComposeHost
|
|
26
23
|
ignoreSafeAreaKeyboardInsets={ignoreSafeArea === 'all' || ignoreSafeArea === 'keyboard'}
|
|
27
24
|
matchContents={matchContents ? MATCH_HEIGHT_ONLY : MATCH_NEITHER}
|
|
28
|
-
seedColor={theme.materialSeed}
|
|
29
25
|
style={style ? [resolved, style] : resolved}
|
|
30
26
|
>
|
|
31
27
|
<HostBoundary>{children}</HostBoundary>
|
|
32
|
-
</
|
|
28
|
+
</ComposeHost>
|
|
33
29
|
)
|
|
34
30
|
}
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
DropdownMenuItem,
|
|
4
4
|
ExposedDropdownMenu,
|
|
5
5
|
ExposedDropdownMenuBox,
|
|
6
|
-
Host,
|
|
7
6
|
OutlinedTextField,
|
|
8
7
|
useNativeState,
|
|
9
8
|
} from '@expo/ui/jetpack-compose'
|
|
10
9
|
import {fillMaxWidth, menuAnchor, testID as testIdModifier} from '@expo/ui/jetpack-compose/modifiers'
|
|
11
10
|
import {useAppTheme} from '@hzblj/kara-theme'
|
|
12
11
|
import {useEffect, useMemo, useState} from 'react'
|
|
12
|
+
import {ComposeHost} from '../../hooks/compose-host'
|
|
13
13
|
import {HostBoundary, useInsideHost} from '../../hooks/host-context'
|
|
14
14
|
import {Glyph} from '../glyph'
|
|
15
15
|
import type {PickerComponent, PickerProps} from './picker.types'
|
|
@@ -89,8 +89,8 @@ export const Picker: PickerComponent = ({disabled = false, onValueChange, option
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
return (
|
|
92
|
-
<
|
|
92
|
+
<ComposeHost matchContents={MATCH_HEIGHT_ONLY}>
|
|
93
93
|
<HostBoundary>{menu}</HostBoundary>
|
|
94
|
-
</
|
|
94
|
+
</ComposeHost>
|
|
95
95
|
)
|
|
96
96
|
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
timing,
|
|
10
10
|
useSplitSxMotion,
|
|
11
11
|
} from '@hzblj/kara-sx'
|
|
12
|
-
import {opacity, type SpringName, springs, useAppTheme, useReducedMotion
|
|
12
|
+
import {opacity, type SpringName, springs, useAppTheme, useReducedMotion} from '@hzblj/kara-theme'
|
|
13
13
|
import {useCallback, useMemo} from 'react'
|
|
14
14
|
import {Platform, Pressable as RNPressable, type ViewStyle} from 'react-native'
|
|
15
15
|
import Animated, {useAnimatedStyle, useSharedValue, withSpring, withTiming} from 'react-native-reanimated'
|
|
@@ -100,13 +100,11 @@ export const Pressable: PressableComponent = markMotionComponent(
|
|
|
100
100
|
return effect === 'opacity' ? {opacity: 1 - (1 - dimmed) * pressed.value} : {}
|
|
101
101
|
}, [dimmed, effect, pressedScale])
|
|
102
102
|
|
|
103
|
-
// Android's press is Material's: a ripple over the content
|
|
104
|
-
// the shape by an outer view (`splitForRipple`). The effect, when there is one,
|
|
103
|
+
// Android's press is Material's: a ripple over the content in the theme's `fill.ripple`, the colour every Compose
|
|
104
|
+
// control ripples in too, clipped to the shape by an outer view (`splitForRipple`). The effect, when there is one,
|
|
105
|
+
// moves that outer view, ripple and all.
|
|
105
106
|
const ripple = useMemo(
|
|
106
|
-
() =>
|
|
107
|
-
isAndroid && withRipple
|
|
108
|
-
? {color: withOpacity(String(theme.color('content.primary')), 'o10'), foreground: true}
|
|
109
|
-
: undefined,
|
|
107
|
+
() => (isAndroid && withRipple ? {color: theme.color('fill.ripple'), foreground: true} : undefined),
|
|
110
108
|
[isAndroid, theme, withRipple]
|
|
111
109
|
)
|
|
112
110
|
const androidStyle = useMemo(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {SegmentedButton, SingleChoiceSegmentedButtonRow, Text} from '@expo/ui/jetpack-compose'
|
|
2
2
|
import {fillMaxWidth, height, testID as testIdModifier, weight} from '@expo/ui/jetpack-compose/modifiers'
|
|
3
3
|
import {iconResourceName} from '@hzblj/expo-native-icons'
|
|
4
4
|
import {haptics} from '@hzblj/expo-rich-haptics'
|
|
@@ -6,6 +6,7 @@ import {DrawableIcon, NativeImage} from '@hzblj/kara-native/jetpack-compose'
|
|
|
6
6
|
import {spacing as spacingTokens, type TextVariant, useAppTheme} from '@hzblj/kara-theme'
|
|
7
7
|
import {useCallback, useMemo} from 'react'
|
|
8
8
|
|
|
9
|
+
import {ComposeHost} from '../../hooks/compose-host'
|
|
9
10
|
import {useInsideHost} from '../../hooks/host-context'
|
|
10
11
|
import {HStack} from '../h-stack'
|
|
11
12
|
import type {SegmentedControlComponent, SegmentedControlProps, SegmentedControlSegment} from './segmented-control.types'
|
|
@@ -147,9 +148,5 @@ export const SegmentedControl: SegmentedControlComponent = ({
|
|
|
147
148
|
return row
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
return
|
|
151
|
-
<Host colorScheme={theme.dark ? 'dark' : 'light'} matchContents={MATCH_HEIGHT_ONLY} seedColor={theme.materialSeed}>
|
|
152
|
-
{row}
|
|
153
|
-
</Host>
|
|
154
|
-
)
|
|
151
|
+
return <ComposeHost matchContents={MATCH_HEIGHT_ONLY}>{row}</ComposeHost>
|
|
155
152
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {Host, type HostProps} from '@expo/ui/jetpack-compose'
|
|
2
|
+
import {RippleConfiguration} from '@hzblj/kara-native/jetpack-compose'
|
|
3
|
+
import {useAppTheme} from '@hzblj/kara-theme'
|
|
4
|
+
|
|
5
|
+
export type ComposeHostProps = Omit<HostProps, 'colorScheme' | 'seedColor'>
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Every Compose tree kara draws on Android: the theme's appearance and Material seed, and `fill.ripple` as the ripple of
|
|
9
|
+
* every Material control inside, so a press looks the same on a button, a chip and a list row. Import it only from
|
|
10
|
+
* `.android` files.
|
|
11
|
+
*/
|
|
12
|
+
export const ComposeHost = ({children, ...props}: ComposeHostProps) => {
|
|
13
|
+
const theme = useAppTheme()
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Host colorScheme={theme.dark ? 'dark' : 'light'} seedColor={theme.materialSeed} {...props}>
|
|
17
|
+
<RippleConfiguration color={theme.color('fill.ripple')}>{children}</RippleConfiguration>
|
|
18
|
+
</Host>
|
|
19
|
+
)
|
|
20
|
+
}
|