@hzblj/kara-components 0.5.0 → 0.7.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 +71 -0
- package/README.md +31 -3
- package/lib/module/atoms/checkbox/checkbox.android.js +7 -3
- package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
- package/lib/module/atoms/chip/chip.js +1 -1
- package/lib/module/atoms/chip/chip.js.map +1 -1
- package/lib/module/atoms/date-picker/date-picker.ios.js +32 -11
- package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
- package/lib/module/atoms/index.js +0 -1
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +11 -5
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/module/atoms/rn-flat-list/rn-flat-list.js +10 -9
- package/lib/module/atoms/rn-flat-list/rn-flat-list.js.map +1 -1
- package/lib/module/atoms/rn-section-list/rn-section-list.js +5 -8
- package/lib/module/atoms/rn-section-list/rn-section-list.js.map +1 -1
- package/lib/module/atoms/segmented-control/index.js +1 -1
- package/lib/module/atoms/segmented-control/index.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.android.js +74 -0
- package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -0
- package/lib/module/atoms/segmented-control/segmented-control.ios.js +44 -0
- package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -0
- package/lib/module/atoms/slider/slider.android.js +26 -2
- package/lib/module/atoms/slider/slider.android.js.map +1 -1
- package/lib/module/atoms/switch/switch.android.js +14 -4
- package/lib/module/atoms/switch/switch.android.js.map +1 -1
- package/lib/module/haptics/haptics.js +56 -0
- package/lib/module/haptics/haptics.js.map +1 -0
- package/lib/module/haptics/index.js +5 -0
- package/lib/module/haptics/index.js.map +1 -0
- package/lib/module/haptics/use-haptic-feedback.js +33 -0
- package/lib/module/haptics/use-haptic-feedback.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/molecules/search-bar/search-bar.js +15 -2
- package/lib/module/molecules/search-bar/search-bar.js.map +1 -1
- package/lib/module/molecules/tooltip/tooltip.android.js +16 -5
- package/lib/module/molecules/tooltip/tooltip.android.js.map +1 -1
- package/lib/module/organisms/action-sheet/action-sheet.android.js +41 -20
- package/lib/module/organisms/action-sheet/action-sheet.android.js.map +1 -1
- package/lib/module/organisms/action-sheet/action-sheet.ios.js +24 -8
- package/lib/module/organisms/action-sheet/action-sheet.ios.js.map +1 -1
- package/lib/module/organisms/alert/alert.ios.js +15 -2
- package/lib/module/organisms/alert/alert.ios.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.android.js +2 -2
- package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
- package/lib/module/organisms/form/form.android.js +22 -9
- package/lib/module/organisms/form/form.android.js.map +1 -1
- package/lib/module/organisms/swipe-actions/swipe-actions.android.js +125 -11
- package/lib/module/organisms/swipe-actions/swipe-actions.android.js.map +1 -1
- package/lib/module/organisms/swipe-actions/swipe-actions.ios.js +46 -18
- package/lib/module/organisms/swipe-actions/swipe-actions.ios.js.map +1 -1
- package/lib/module/templates/screen/screen.android.js +31 -10
- package/lib/module/templates/screen/screen.android.js.map +1 -1
- package/lib/typescript/atoms/avatar/avatar.types.d.ts +5 -0
- package/lib/typescript/atoms/badge/badge.types.d.ts +3 -0
- package/lib/typescript/atoms/button/button.types.d.ts +12 -0
- package/lib/typescript/atoms/card/card.types.d.ts +6 -0
- package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +5 -0
- package/lib/typescript/atoms/chip/chip.types.d.ts +5 -0
- package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -0
- package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +6 -1
- package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +14 -0
- package/lib/typescript/atoms/divider/divider.types.d.ts +3 -0
- package/lib/typescript/atoms/fab/fab.types.d.ts +7 -0
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +1 -0
- package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +6 -0
- package/lib/typescript/atoms/icon/icon.types.d.ts +8 -0
- package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +5 -0
- package/lib/typescript/atoms/index.d.ts +0 -1
- package/lib/typescript/atoms/island/island.types.d.ts +4 -0
- package/lib/typescript/atoms/list/list.types.d.ts +2 -0
- package/lib/typescript/atoms/picker/picker.types.d.ts +12 -0
- package/lib/typescript/atoms/pressable/pressable.types.d.ts +11 -1
- package/lib/typescript/atoms/progress/progress.types.d.ts +6 -0
- package/lib/typescript/atoms/rn-flat-list/rn-flat-list.d.ts +5 -8
- package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +3 -1
- package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +4 -0
- package/lib/typescript/atoms/rn-section-list/rn-section-list.d.ts +2 -8
- package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +3 -1
- package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +4 -0
- package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +2 -0
- package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +4 -0
- package/lib/typescript/atoms/segmented-control/segmented-control.d.ts +1 -2
- package/lib/typescript/atoms/segmented-control/segmented-control.ios.d.ts +7 -0
- package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +13 -0
- package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +5 -0
- package/lib/typescript/atoms/slider/slider.types.d.ts +7 -0
- package/lib/typescript/atoms/spacer/spacer.types.d.ts +3 -0
- package/lib/typescript/atoms/surface/surface.types.d.ts +7 -0
- package/lib/typescript/atoms/switch/switch.types.d.ts +8 -0
- package/lib/typescript/atoms/text/text.types.d.ts +12 -0
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +12 -0
- package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +9 -0
- package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +8 -0
- package/lib/typescript/haptics/haptics.d.ts +61 -0
- package/lib/typescript/haptics/index.d.ts +2 -0
- package/lib/typescript/haptics/use-haptic-feedback.d.ts +15 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +8 -0
- package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +5 -0
- package/lib/typescript/molecules/label/label.types.d.ts +6 -0
- package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +6 -0
- package/lib/typescript/molecules/link/link.types.d.ts +6 -0
- package/lib/typescript/molecules/list-item/list-item.types.d.ts +9 -0
- package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -0
- package/lib/typescript/molecules/pager/pager.types.d.ts +2 -0
- package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +10 -0
- package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
- package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +11 -0
- package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -0
- package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +8 -0
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +13 -0
- package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +12 -0
- package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +8 -0
- package/lib/typescript/organisms/alert/alert.types.d.ts +11 -0
- package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +4 -0
- package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +2 -0
- package/lib/typescript/organisms/form/form.types.d.ts +6 -0
- package/lib/typescript/organisms/menu/menu.types.d.ts +17 -0
- package/lib/typescript/organisms/sheet/sheet.types.d.ts +19 -0
- package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +8 -0
- package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +36 -13
- package/lib/typescript/templates/screen/screen.types.d.ts +9 -0
- package/package.json +5 -9
- package/src/atoms/avatar/avatar.types.ts +5 -0
- package/src/atoms/badge/badge.types.ts +3 -0
- package/src/atoms/button/button.types.ts +12 -0
- package/src/atoms/card/card.types.ts +6 -0
- package/src/atoms/checkbox/checkbox.android.tsx +7 -3
- package/src/atoms/checkbox/checkbox.types.ts +5 -0
- package/src/atoms/chip/chip.tsx +1 -1
- package/src/atoms/chip/chip.types.ts +5 -0
- package/src/atoms/color-picker/color-picker.types.ts +4 -0
- package/src/atoms/date-picker/date-picker.ios.tsx +33 -13
- package/src/atoms/date-picker/date-picker.types.ts +14 -0
- package/src/atoms/divider/divider.types.ts +3 -0
- package/src/atoms/fab/fab.types.ts +7 -0
- package/src/atoms/glass-view/glass-view.types.ts +1 -0
- package/src/atoms/h-stack/h-stack.types.ts +6 -0
- package/src/atoms/icon/icon.types.ts +8 -0
- package/src/atoms/icon-button/icon-button.types.ts +5 -0
- package/src/atoms/index.ts +0 -1
- package/src/atoms/island/island.types.ts +4 -0
- package/src/atoms/list/list.types.ts +2 -0
- package/src/atoms/picker/picker.types.ts +12 -0
- package/src/atoms/pressable/pressable.tsx +12 -5
- package/src/atoms/pressable/pressable.types.ts +12 -1
- package/src/atoms/progress/progress.types.ts +6 -0
- package/src/atoms/rn-flat-list/rn-flat-list.tsx +8 -8
- package/src/atoms/rn-flat-list/rn-flat-list.types.ts +3 -1
- package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +4 -0
- package/src/atoms/rn-section-list/rn-section-list.tsx +5 -8
- package/src/atoms/rn-section-list/rn-section-list.types.ts +3 -1
- package/src/atoms/rn-text/rn-text.types.ts +4 -0
- package/src/atoms/rn-view/rn-view.types.ts +2 -0
- package/src/atoms/scroll-view/scroll-view.types.ts +4 -0
- package/src/atoms/segmented-control/segmented-control.android.tsx +79 -0
- package/src/atoms/segmented-control/segmented-control.ios.tsx +47 -0
- package/src/atoms/segmented-control/segmented-control.types.ts +13 -0
- package/src/atoms/skeleton/skeleton.types.ts +5 -0
- package/src/atoms/slider/slider.android.tsx +33 -2
- package/src/atoms/slider/slider.types.ts +7 -0
- package/src/atoms/spacer/spacer.types.ts +3 -0
- package/src/atoms/surface/surface.types.ts +7 -0
- package/src/atoms/switch/switch.android.tsx +18 -5
- package/src/atoms/switch/switch.types.ts +8 -0
- package/src/atoms/text/text.types.ts +12 -0
- package/src/atoms/text-field/text-field.types.ts +12 -0
- package/src/atoms/v-stack/v-stack.types.ts +9 -0
- package/src/atoms/z-stack/z-stack.types.ts +8 -0
- package/src/haptics/haptics.ts +68 -0
- package/src/haptics/index.ts +2 -0
- package/src/haptics/use-haptic-feedback.ts +36 -0
- package/src/index.ts +1 -0
- package/src/molecules/collapsible/collapsible.types.ts +8 -0
- package/src/molecules/empty-state/empty-state.types.ts +5 -0
- package/src/molecules/label/label.types.ts +6 -0
- package/src/molecules/labeled-content/labeled-content.types.ts +6 -0
- package/src/molecules/link/link.types.ts +6 -0
- package/src/molecules/list-item/list-item.types.ts +9 -0
- package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -0
- package/src/molecules/pager/pager.types.ts +2 -0
- package/src/molecules/radio-group/radio-group.types.ts +10 -0
- package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
- package/src/molecules/rn-tooltip/rn-tooltip.types.ts +11 -0
- package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -0
- package/src/molecules/search-bar/search-bar.tsx +9 -2
- package/src/molecules/search-bar/search-bar.types.ts +8 -0
- package/src/molecules/stepper/stepper.types.ts +13 -0
- package/src/molecules/tooltip/tooltip.android.tsx +17 -9
- package/src/molecules/tooltip/tooltip.types.ts +12 -0
- package/src/organisms/action-sheet/action-sheet.android.tsx +37 -19
- package/src/organisms/action-sheet/action-sheet.ios.tsx +22 -9
- package/src/organisms/action-sheet/action-sheet.types.ts +8 -0
- package/src/organisms/alert/alert.ios.tsx +11 -1
- package/src/organisms/alert/alert.types.ts +11 -0
- package/src/organisms/context-menu/context-menu.android.tsx +2 -2
- package/src/organisms/context-menu/context-menu.types.ts +4 -0
- package/src/organisms/fab-menu/fab-menu.types.ts +2 -0
- package/src/organisms/form/form.android.tsx +15 -7
- package/src/organisms/form/form.types.ts +6 -0
- package/src/organisms/menu/menu.types.ts +17 -0
- package/src/organisms/sheet/sheet.types.ts +19 -0
- package/src/organisms/snackbar/snackbar.types.ts +8 -0
- package/src/organisms/swipe-actions/swipe-actions.android.tsx +129 -9
- package/src/organisms/swipe-actions/swipe-actions.ios.tsx +45 -11
- package/src/organisms/swipe-actions/swipe-actions.types.ts +37 -14
- package/src/templates/screen/screen.android.tsx +33 -12
- package/src/templates/screen/screen.types.ts +9 -0
- package/lib/module/atoms/flash-list/flash-list.js +0 -31
- package/lib/module/atoms/flash-list/flash-list.js.map +0 -1
- package/lib/module/atoms/flash-list/flash-list.types.js +0 -4
- package/lib/module/atoms/flash-list/flash-list.types.js.map +0 -1
- package/lib/module/atoms/flash-list/index.js +0 -5
- package/lib/module/atoms/flash-list/index.js.map +0 -1
- package/lib/module/atoms/segmented-control/segmented-control.js +0 -28
- package/lib/module/atoms/segmented-control/segmented-control.js.map +0 -1
- package/lib/typescript/atoms/flash-list/flash-list.d.ts +0 -8
- package/lib/typescript/atoms/flash-list/flash-list.types.d.ts +0 -18
- package/lib/typescript/atoms/flash-list/index.d.ts +0 -2
- package/src/atoms/flash-list/flash-list.tsx +0 -28
- package/src/atoms/flash-list/flash-list.types.ts +0 -20
- package/src/atoms/flash-list/index.ts +0 -2
- package/src/atoms/segmented-control/segmented-control.tsx +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Card","Text","VStack","useHostGuard","jsx","_jsx","jsxs","_jsxs","FormRoot","children","testID","spacing","wide","FormSection","footer","title","color","transform","variant","Form","Object","assign","Section"],"sourceRoot":"../../../../src","sources":["organisms/form/form.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,QAAO,2BAAkB;AACrC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,MAAMC,QAAQ,GAAGA,CAAC;EAACC,QAAQ;EAAEC;AAAiB,CAAC,KAAK;EAClDP,YAAY,CAAC,MAAM,CAAC;EAEpB,oBACEE,IAAA,CAACH,MAAM;IAACS,OAAO,EAAC,KAAK;
|
|
1
|
+
{"version":3,"names":["Card","Text","VStack","useHostGuard","jsx","_jsx","jsxs","_jsxs","FormRoot","children","testID","p","spacing","wide","FormSection","footer","title","px","color","transform","variant","Form","Object","assign","Section"],"sourceRoot":"../../../../src","sources":["organisms/form/form.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,QAAO,2BAAkB;AACrC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAGA,CAAC;EAACC,QAAQ;EAAEC;AAAiB,CAAC,KAAK;EAClDP,YAAY,CAAC,MAAM,CAAC;EAEpB,oBACEE,IAAA,CAACH,MAAM;IAACS,CAAC,EAAC,KAAK;IAACC,OAAO,EAAC,KAAK;IAACF,MAAM,EAAEA,MAAO;IAACG,IAAI;IAAAJ,QAAA,EAC/CA;EAAQ,CACH,CAAC;AAEb,CAAC;AAED,MAAMK,WAAW,GAAGA,CAAC;EAACL,QAAQ;EAAEM,MAAM;EAAEC;AAAuB,CAAC,kBAC9DT,KAAA,CAACL,MAAM;EAACU,OAAO,EAAC,IAAI;EAACC,IAAI;EAAAJ,QAAA,GACtBO,KAAK,gBACJX,IAAA,CAACH,MAAM;IAACe,EAAE,EAAC,KAAK;IAACJ,IAAI;IAAAJ,QAAA,eACnBJ,IAAA,CAACJ,IAAI;MAACiB,KAAK,EAAC,mBAAmB;MAACC,SAAS,EAAC,WAAW;MAACC,OAAO,EAAC,aAAa;MAAAX,QAAA,EACxEO;IAAK,CACF;EAAC,CACD,CAAC,GACP,IAAI,eACRX,IAAA,CAACL,IAAI;IAACa,IAAI;IAAAJ,QAAA,EAAEA;EAAQ,CAAO,CAAC,EAC3BM,MAAM,gBACLV,IAAA,CAACH,MAAM;IAACe,EAAE,EAAC,KAAK;IAACJ,IAAI;IAAAJ,QAAA,eACnBJ,IAAA,CAACJ,IAAI;MAACiB,KAAK,EAAC,kBAAkB;MAACE,OAAO,EAAC,UAAU;MAAAX,QAAA,EAC9CM;IAAM,CACH;EAAC,CACD,CAAC,GACP,IAAI;AAAA,CACF,CACT;AAED,OAAO,MAAMM,IAAmB,GAAGC,MAAM,CAACC,MAAM,CAACf,QAAQ,EAAE;EAACgB,OAAO,EAAEV;AAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,17 +1,131 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { FilledIconButton } from '@expo/ui/jetpack-compose';
|
|
4
|
+
import { size } from '@expo/ui/jetpack-compose/modifiers';
|
|
5
|
+
import { SwipeActionsBox } from '@hzblj/kara-native/jetpack-compose';
|
|
6
|
+
import { spacing, useAppTheme } from '@hzblj/kara-theme';
|
|
7
|
+
import { useCallback, useEffect, useId, useState, useSyncExternalStore } from 'react';
|
|
8
|
+
import { HStack } from "../../atoms/h-stack/index.js";
|
|
9
|
+
import { Icon } from "../../atoms/icon/index.js";
|
|
10
|
+
import { Text } from "../../atoms/text/index.js";
|
|
11
|
+
import { VStack } from "../../atoms/v-stack/index.js";
|
|
12
|
+
import { useHostGuard } from "../../host-context.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
/** A Material 3 Expressive wide icon button: wider than tall, a stadium, the label under it. */
|
|
15
|
+
const BUTTON = [size(52, 32)];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Which row is open, app-wide — SwiftUI's list keeps one row open, and so does this: opening one closes the last.
|
|
19
|
+
* React state cannot be shared between rows that know nothing of each other, so it lives in the module.
|
|
20
|
+
*/
|
|
21
|
+
let openRow = null;
|
|
22
|
+
const listeners = new Set();
|
|
23
|
+
const setOpenRow = row => {
|
|
24
|
+
if (openRow === row) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
openRow = row;
|
|
28
|
+
for (const listener of listeners) {
|
|
29
|
+
listener();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const subscribe = listener => {
|
|
33
|
+
listeners.add(listener);
|
|
34
|
+
return () => {
|
|
35
|
+
listeners.delete(listener);
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const getOpenRow = () => openRow;
|
|
39
|
+
const ActionButton = ({
|
|
40
|
+
action,
|
|
41
|
+
onDone
|
|
7
42
|
}) => {
|
|
8
|
-
|
|
9
|
-
|
|
43
|
+
const theme = useAppTheme();
|
|
44
|
+
const fill = action.tint ?? (action.destructive ? 'fill.destructive.primary' : 'fill.accent.primary');
|
|
45
|
+
const content = !action.tint && action.destructive ? 'content.on.destructive' : 'content.on.bg';
|
|
46
|
+
const onClick = useCallback(() => {
|
|
47
|
+
onDone();
|
|
48
|
+
action.onPress();
|
|
49
|
+
}, [action, onDone]);
|
|
50
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
51
|
+
align: "center",
|
|
52
|
+
spacing: "s2",
|
|
53
|
+
children: [/*#__PURE__*/_jsx(FilledIconButton, {
|
|
54
|
+
colors: {
|
|
55
|
+
containerColor: theme.color(fill),
|
|
56
|
+
contentColor: theme.color(content)
|
|
57
|
+
},
|
|
58
|
+
modifiers: BUTTON,
|
|
59
|
+
onClick: onClick,
|
|
60
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
61
|
+
accessibilityLabel: action.label,
|
|
62
|
+
color: content,
|
|
63
|
+
name: action.icon,
|
|
64
|
+
size: "s20"
|
|
65
|
+
})
|
|
66
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
67
|
+
color: "content.secondary",
|
|
68
|
+
variant: "labelMedium",
|
|
69
|
+
children: action.label
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
10
72
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
73
|
+
const Actions = ({
|
|
74
|
+
actions,
|
|
75
|
+
onDone
|
|
76
|
+
}) => /*#__PURE__*/_jsx(HStack, {
|
|
77
|
+
align: "center",
|
|
78
|
+
spacing: "s8",
|
|
79
|
+
children: actions.map(action => /*#__PURE__*/_jsx(ActionButton, {
|
|
80
|
+
action: action,
|
|
81
|
+
onDone: onDone
|
|
82
|
+
}, action.label))
|
|
16
83
|
});
|
|
84
|
+
const close = () => setOpenRow(null);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* kara's `SwipeActionsBox`: the row slides on an anchored drag and the buttons show in the strip it leaves, fading in.
|
|
88
|
+
* Controlled from here so one row is open at a time; a press closes the row before the action runs.
|
|
89
|
+
*/
|
|
90
|
+
export const SwipeActions = ({
|
|
91
|
+
children,
|
|
92
|
+
leading = [],
|
|
93
|
+
trailing = []
|
|
94
|
+
}) => {
|
|
95
|
+
useHostGuard('SwipeActions');
|
|
96
|
+
const row = useId();
|
|
97
|
+
const isOpenRow = useSyncExternalStore(subscribe, getOpenRow) === row;
|
|
98
|
+
const [edge, setEdge] = useState(null);
|
|
99
|
+
const onOpenChange = useCallback(next => {
|
|
100
|
+
setEdge(next);
|
|
101
|
+
if (next) {
|
|
102
|
+
setOpenRow(row);
|
|
103
|
+
} else if (openRow === row) {
|
|
104
|
+
setOpenRow(null);
|
|
105
|
+
}
|
|
106
|
+
}, [row]);
|
|
107
|
+
|
|
108
|
+
// A row that goes away open must not keep the others from opening.
|
|
109
|
+
useEffect(() => () => {
|
|
110
|
+
if (openRow === row) {
|
|
111
|
+
setOpenRow(null);
|
|
112
|
+
}
|
|
113
|
+
}, [row]);
|
|
114
|
+
return /*#__PURE__*/_jsxs(SwipeActionsBox, {
|
|
115
|
+
actionsSpacing: spacing.s12,
|
|
116
|
+
onOpenChange: onOpenChange,
|
|
117
|
+
openEdge: isOpenRow ? edge : null,
|
|
118
|
+
children: [leading.length > 0 ? /*#__PURE__*/_jsx(SwipeActionsBox.Leading, {
|
|
119
|
+
children: /*#__PURE__*/_jsx(Actions, {
|
|
120
|
+
actions: leading,
|
|
121
|
+
onDone: close
|
|
122
|
+
})
|
|
123
|
+
}) : null, trailing.length > 0 ? /*#__PURE__*/_jsx(SwipeActionsBox.Trailing, {
|
|
124
|
+
children: /*#__PURE__*/_jsx(Actions, {
|
|
125
|
+
actions: [...trailing].reverse(),
|
|
126
|
+
onDone: close
|
|
127
|
+
})
|
|
128
|
+
}) : null, children]
|
|
129
|
+
});
|
|
130
|
+
};
|
|
17
131
|
//# sourceMappingURL=swipe-actions.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["FilledIconButton","size","SwipeActionsBox","spacing","useAppTheme","useCallback","useEffect","useId","useState","useSyncExternalStore","HStack","Icon","Text","VStack","useHostGuard","jsx","_jsx","jsxs","_jsxs","BUTTON","openRow","listeners","Set","setOpenRow","row","listener","subscribe","add","delete","getOpenRow","ActionButton","action","onDone","theme","fill","tint","destructive","content","onClick","onPress","align","children","colors","containerColor","color","contentColor","modifiers","accessibilityLabel","label","name","icon","variant","Actions","actions","map","close","SwipeActions","leading","trailing","isOpenRow","edge","setEdge","onOpenChange","next","actionsSpacing","s12","openEdge","length","Leading","Trailing","reverse"],"sourceRoot":"../../../../src","sources":["organisms/swipe-actions/swipe-actions.android.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,QAAO,0BAA0B;AACzD,SAAQC,IAAI,QAAO,oCAAoC;AACvD,SAAQC,eAAe,QAAiC,oCAAoC;A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,CAAE;IAAC,CACrB,CAAC,GACxB,IAAI,EACPG,QAAQ,CAACS,MAAM,GAAG,CAAC,gBAClBnD,IAAA,CAACd,eAAe,CAACmE,QAAQ;MAAA5B,QAAA,eAEvBzB,IAAA,CAACoC,OAAO;QAACC,OAAO,EAAE,CAAC,GAAGK,QAAQ,CAAC,CAACY,OAAO,CAAC,CAAE;QAACtC,MAAM,EAAEuB;MAAM,CAAE;IAAC,CACpC,CAAC,GACzB,IAAI,EACPd,QAAQ;EAAA,CACM,CAAC;AAEtB,CAAC","ignoreList":[]}
|
|
@@ -1,28 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { SwipeActions as SwiftUISwipeActions } from '@expo/ui/swift-ui';
|
|
3
|
+
import { Button, Image, Label, SwipeActions as SwiftUISwipeActions } from '@expo/ui/swift-ui';
|
|
4
|
+
import { tint } from '@expo/ui/swift-ui/modifiers';
|
|
5
|
+
import { iconResourceName } from '@hzblj/kara-native';
|
|
6
|
+
import { useAppTheme } from '@hzblj/kara-theme';
|
|
4
7
|
import { useHostGuard } from "../../host-context.js";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* The edge's buttons, a `Label` each — iOS 26 draws its icon on a round button with the title under it; earlier
|
|
11
|
+
* versions, in a row of the usual height, the icon alone. No `destructive` role: SwiftUI would animate the row out by itself, and whether it goes is
|
|
12
|
+
* the list's data to say.
|
|
13
|
+
*/
|
|
14
|
+
const Actions = ({
|
|
15
|
+
actions,
|
|
16
|
+
allowsFullSwipe,
|
|
17
|
+
edge
|
|
18
|
+
}) => {
|
|
19
|
+
const theme = useAppTheme();
|
|
20
|
+
return /*#__PURE__*/_jsx(SwiftUISwipeActions.Actions, {
|
|
21
|
+
allowsFullSwipe: allowsFullSwipe,
|
|
22
|
+
edge: edge,
|
|
23
|
+
children: actions.map(action => /*#__PURE__*/_jsx(Button, {
|
|
24
|
+
modifiers: [tint(theme.color(action.tint ?? (action.destructive ? 'fill.destructive.primary' : 'fill.accent.primary')))],
|
|
25
|
+
onPress: action.onPress,
|
|
26
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
27
|
+
icon: /*#__PURE__*/_jsx(Image, {
|
|
28
|
+
assetName: iconResourceName(action.icon)
|
|
29
|
+
}),
|
|
30
|
+
title: action.label
|
|
31
|
+
})
|
|
32
|
+
}, action.label))
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export const SwipeActions = ({
|
|
36
|
+
allowsFullSwipe = true,
|
|
7
37
|
children,
|
|
8
|
-
|
|
38
|
+
leading = [],
|
|
39
|
+
testID,
|
|
40
|
+
trailing = []
|
|
9
41
|
}) => {
|
|
10
42
|
useHostGuard('SwipeActions');
|
|
11
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_jsxs(SwiftUISwipeActions, {
|
|
12
44
|
testID: testID,
|
|
13
|
-
children: children
|
|
45
|
+
children: [children, leading.length > 0 ? /*#__PURE__*/_jsx(Actions, {
|
|
46
|
+
actions: leading,
|
|
47
|
+
allowsFullSwipe: allowsFullSwipe,
|
|
48
|
+
edge: "leading"
|
|
49
|
+
}) : null, trailing.length > 0 ? /*#__PURE__*/_jsx(Actions, {
|
|
50
|
+
actions: trailing,
|
|
51
|
+
allowsFullSwipe: allowsFullSwipe,
|
|
52
|
+
edge: "trailing"
|
|
53
|
+
}) : null]
|
|
14
54
|
});
|
|
15
55
|
};
|
|
16
|
-
const SwipeActionsGroup = ({
|
|
17
|
-
allowsFullSwipe = true,
|
|
18
|
-
children,
|
|
19
|
-
edge = 'trailing'
|
|
20
|
-
}) => /*#__PURE__*/_jsx(SwiftUISwipeActions.Actions, {
|
|
21
|
-
allowsFullSwipe: allowsFullSwipe,
|
|
22
|
-
edge: edge,
|
|
23
|
-
children: children
|
|
24
|
-
});
|
|
25
|
-
export const SwipeActions = Object.assign(SwipeActionsRoot, {
|
|
26
|
-
Actions: SwipeActionsGroup
|
|
27
|
-
});
|
|
28
56
|
//# sourceMappingURL=swipe-actions.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SwipeActions","SwiftUISwipeActions","useHostGuard","jsx","_jsx","
|
|
1
|
+
{"version":3,"names":["Button","Image","Label","SwipeActions","SwiftUISwipeActions","tint","iconResourceName","useAppTheme","useHostGuard","jsx","_jsx","jsxs","_jsxs","Actions","actions","allowsFullSwipe","edge","theme","children","map","action","modifiers","color","destructive","onPress","icon","assetName","title","label","leading","testID","trailing","length"],"sourceRoot":"../../../../src","sources":["organisms/swipe-actions/swipe-actions.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,YAAY,IAAIC,mBAAmB,QAAO,mBAAmB;AAC3F,SAAQC,IAAI,QAAO,6BAA6B;AAChD,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,WAAW,QAAO,mBAAmB;AAE7C,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAK/C;AACA;AACA;AACA;AACA;AACA,MAAMC,OAAO,GAAGA,CAAC;EAACC,OAAO;EAAEC,eAAe;EAAEC;AAAkB,CAAC,KAAK;EAClE,MAAMC,KAAK,GAAGV,WAAW,CAAC,CAAC;EAE3B,oBACEG,IAAA,CAACN,mBAAmB,CAACS,OAAO;IAACE,eAAe,EAAEA,eAAgB;IAACC,IAAI,EAAEA,IAAK;IAAAE,QAAA,EACvEJ,OAAO,CAACK,GAAG,CAACC,MAAM,iBACjBV,IAAA,CAACV,MAAM;MAELqB,SAAS,EAAE,CACThB,IAAI,CAACY,KAAK,CAACK,KAAK,CAACF,MAAM,CAACf,IAAI,KAAKe,MAAM,CAACG,WAAW,GAAG,0BAA0B,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAC3G;MACFC,OAAO,EAAEJ,MAAM,CAACI,OAAQ;MAAAN,QAAA,eAExBR,IAAA,CAACR,KAAK;QAACuB,IAAI,eAAEf,IAAA,CAACT,KAAK;UAACyB,SAAS,EAAEpB,gBAAgB,CAACc,MAAM,CAACK,IAAI;QAAE,CAAE,CAAE;QAACE,KAAK,EAAEP,MAAM,CAACQ;MAAM,CAAE;IAAC,GANpFR,MAAM,CAACQ,KAON,CACT;EAAC,CACyB,CAAC;AAElC,CAAC;AAED,OAAO,MAAMzB,YAAmC,GAAGA,CAAC;EAClDY,eAAe,GAAG,IAAI;EACtBG,QAAQ;EACRW,OAAO,GAAG,EAAE;EACZC,MAAM;EACNC,QAAQ,GAAG;AACM,CAAC,KAAK;EACvBvB,YAAY,CAAC,cAAc,CAAC;EAE5B,oBACEI,KAAA,CAACR,mBAAmB;IAAC0B,MAAM,EAAEA,MAAO;IAAAZ,QAAA,GACjCA,QAAQ,EACRW,OAAO,CAACG,MAAM,GAAG,CAAC,gBAAGtB,IAAA,CAACG,OAAO;MAACC,OAAO,EAAEe,OAAQ;MAACd,eAAe,EAAEA,eAAgB;MAACC,IAAI,EAAC;IAAS,CAAE,CAAC,GAAG,IAAI,EAC1Ge,QAAQ,CAACC,MAAM,GAAG,CAAC,gBAAGtB,IAAA,CAACG,OAAO;MAACC,OAAO,EAAEiB,QAAS;MAAChB,eAAe,EAAEA,eAAgB;MAACC,IAAI,EAAC;IAAU,CAAE,CAAC,GAAG,IAAI;EAAA,CAC3F,CAAC;AAE1B,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Column, Host } from '@expo/ui/jetpack-compose';
|
|
4
|
+
import { padding } from '@expo/ui/jetpack-compose/modifiers';
|
|
4
5
|
import { useSxModifiers } from '@hzblj/kara-sx';
|
|
5
6
|
import { useAppTheme } from '@hzblj/kara-theme';
|
|
6
|
-
import {
|
|
7
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { StatusBar, StyleSheet, View } from 'react-native';
|
|
7
9
|
import { HostBoundary } from "../../host-context.js";
|
|
8
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* The content keeps clear of as much of the status bar as the screen covers — all of it when nothing sits above the
|
|
13
|
+
* screen, none under a navigation bar — the way a SwiftUI host keeps to the safe area. Compose would draw under it:
|
|
14
|
+
* the app is edge to edge, and `Host` pads for nothing. The background still runs to the edge.
|
|
15
|
+
*/
|
|
9
16
|
export const Screen = ({
|
|
10
17
|
bg = 'surface.base',
|
|
11
18
|
children,
|
|
@@ -13,20 +20,34 @@ export const Screen = ({
|
|
|
13
20
|
testID
|
|
14
21
|
}) => {
|
|
15
22
|
const theme = useAppTheme();
|
|
16
|
-
const
|
|
23
|
+
const frame = useRef(null);
|
|
24
|
+
const [statusBarOverlap, setStatusBarOverlap] = useState(0);
|
|
25
|
+
const sx = useSxModifiers({
|
|
17
26
|
bg,
|
|
18
27
|
tall: true,
|
|
19
28
|
wide: true
|
|
20
29
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
const modifiers = useMemo(() => statusBarOverlap > 0 ? [...sx, padding(0, statusBarOverlap, 0, 0)] : sx, [statusBarOverlap, sx]);
|
|
31
|
+
const onLayout = useCallback(() => {
|
|
32
|
+
frame.current?.measureInWindow((_x, y) => {
|
|
33
|
+
setStatusBarOverlap(Math.max(0, Math.round((StatusBar.currentHeight ?? 0) - y)));
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
return /*#__PURE__*/_jsx(View, {
|
|
37
|
+
onLayout: onLayout,
|
|
38
|
+
ref: frame,
|
|
25
39
|
style: StyleSheet.absoluteFill,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
testID: testID,
|
|
41
|
+
children: /*#__PURE__*/_jsx(Host, {
|
|
42
|
+
colorScheme: theme.dark ? 'dark' : 'light',
|
|
43
|
+
ignoreSafeAreaKeyboardInsets: ignoreKeyboardInset,
|
|
44
|
+
seedColor: theme.materialSeed,
|
|
45
|
+
style: StyleSheet.absoluteFill,
|
|
46
|
+
children: /*#__PURE__*/_jsx(Column, {
|
|
47
|
+
modifiers: modifiers,
|
|
48
|
+
children: /*#__PURE__*/_jsx(HostBoundary, {
|
|
49
|
+
children: children
|
|
50
|
+
})
|
|
30
51
|
})
|
|
31
52
|
})
|
|
32
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Column","Host","useSxModifiers","useAppTheme","StyleSheet","HostBoundary","jsx","_jsx","Screen","bg","children","ignoreKeyboardInset","testID","theme","
|
|
1
|
+
{"version":3,"names":["Column","Host","padding","useSxModifiers","useAppTheme","useCallback","useMemo","useRef","useState","StatusBar","StyleSheet","View","HostBoundary","jsx","_jsx","Screen","bg","children","ignoreKeyboardInset","testID","theme","frame","statusBarOverlap","setStatusBarOverlap","sx","tall","wide","modifiers","onLayout","current","measureInWindow","_x","y","Math","max","round","currentHeight","ref","style","absoluteFill","colorScheme","dark","ignoreSafeAreaKeyboardInsets","seedColor","materialSeed"],"sourceRoot":"../../../../src","sources":["templates/screen/screen.android.tsx"],"mappings":";;AAAA,SAAQA,MAAM,EAAEC,IAAI,QAAO,0BAA0B;AACrD,SAAQC,OAAO,QAAO,oCAAoC;AAC1D,SAAQC,cAAc,QAAO,gBAAgB;AAC7C,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAQC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AACxD,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG/C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EAACC,EAAE,GAAG,cAAc;EAAEC,QAA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a;MAC9BN,KAAK,EAAE5B,UAAU,CAAC6B,YAAa;MAAAtB,QAAA,eAE/BH,IAAA,CAACd,MAAM;QAAC2B,SAAS,EAAEA,SAAU;QAAAV,QAAA,eAC3BH,IAAA,CAACF,YAAY;UAAAK,QAAA,EAAEA;QAAQ,CAAe;MAAC,CACjC;IAAC,CACL;EAAC,CACH,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ImageSourcePropType } from 'react-native';
|
|
3
3
|
export type AvatarSize = 'lg' | 'md' | 'sm';
|
|
4
|
+
/** A round avatar: the image in `source`, or `initials` without one. The React Native tier — it needs no host. */
|
|
4
5
|
export type AvatarProps = {
|
|
6
|
+
/** Shown in place of the image when there is no `source`. */
|
|
5
7
|
initials?: string;
|
|
8
|
+
/** The diameter — `sm` is `s24`, `md` `s40`, `lg` `s64`. `md` by default. */
|
|
6
9
|
size?: AvatarSize;
|
|
10
|
+
/** The image, cropped to the circle. */
|
|
7
11
|
source?: ImageSourcePropType;
|
|
12
|
+
/** Test identifier, forwarded to the view. */
|
|
8
13
|
testID?: string;
|
|
9
14
|
};
|
|
10
15
|
export type AvatarComponent = (props: AvatarProps) => ReactNode;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export type BadgeTone = 'accent' | 'destructive' | 'neutral' | 'success';
|
|
3
|
+
/** A small status label in a capsule — a SwiftUI `HStack` in the tone's fill on iOS, Material's `Badge` on Android. */
|
|
3
4
|
export type BadgeProps = {
|
|
5
|
+
/** The text inside. */
|
|
4
6
|
label: string;
|
|
7
|
+
/** The fill and text colours. `neutral` by default. */
|
|
5
8
|
tone?: BadgeTone;
|
|
6
9
|
};
|
|
7
10
|
export type BadgeComponent = (props: BadgeProps) => ReactNode;
|
|
@@ -11,12 +11,22 @@ export type ButtonStyleName = 'automatic' | 'bordered' | 'borderedProminent' | '
|
|
|
11
11
|
* whatever the surrounding SwiftUI environment provides.
|
|
12
12
|
*/
|
|
13
13
|
export type ButtonControlSize = 'extraLarge' | 'large' | 'mini' | 'regular' | 'small';
|
|
14
|
+
/** A text button — SwiftUI `Button` on iOS, Material's filled button (outlined for `glass`) on Android. */
|
|
14
15
|
export type ButtonProps = {
|
|
16
|
+
/**
|
|
17
|
+
* Replaces the style the variant picks — `borderedProminent` for `accent` and `destructive`, `bordered` for
|
|
18
|
+
* `secondary`, `glass` for `glass`. iOS only — Android ignores it.
|
|
19
|
+
*/
|
|
15
20
|
buttonStyle?: ButtonStyleName;
|
|
21
|
+
/** SwiftUI's control size. `large` by default. iOS only — Android ignores it. */
|
|
16
22
|
controlSize?: ButtonControlSize;
|
|
23
|
+
/** Draws the button in its disabled colours and stops it responding to presses. */
|
|
17
24
|
disabled?: boolean;
|
|
25
|
+
/** The button's text. */
|
|
18
26
|
label: string;
|
|
27
|
+
/** Called when the button is pressed. */
|
|
19
28
|
onPress?: () => void;
|
|
29
|
+
/** Test identifier, forwarded to the native view. */
|
|
20
30
|
testID?: string;
|
|
21
31
|
/**
|
|
22
32
|
* Overrides the variant's own tint. A prominent style takes it as the fill and picks a contrasting
|
|
@@ -24,7 +34,9 @@ export type ButtonProps = {
|
|
|
24
34
|
* the stock `.glass` style — see the iOS implementation.
|
|
25
35
|
*/
|
|
26
36
|
tint?: ColorToken;
|
|
37
|
+
/** The look. `accent` by default. Material has no glass, so on Android `glass` is an outlined button. */
|
|
27
38
|
variant?: ButtonVariant;
|
|
39
|
+
/** Stretches the button to the full width it is offered. On by default. */
|
|
28
40
|
wide?: boolean;
|
|
29
41
|
};
|
|
30
42
|
export type ButtonComponent = (props: ButtonProps) => ReactNode;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ResponsiveSx } from '@hzblj/kara-sx';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* A raised container — SwiftUI `VStack` / Compose `Column` on `surface.primary`, with a large radius, `s16` padding and
|
|
5
|
+
* the `card` shadow. Any `sx` prop overrides its default.
|
|
6
|
+
*/
|
|
3
7
|
export type CardProps = ResponsiveSx & {
|
|
8
|
+
/** Native views, stacked vertically from the leading edge. */
|
|
4
9
|
children?: ReactNode;
|
|
10
|
+
/** Test identifier, forwarded to the native view. */
|
|
5
11
|
testID?: string;
|
|
6
12
|
};
|
|
7
13
|
export type CardComponent = (props: CardProps) => ReactNode;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** Material's `Checkbox` on Android. iOS has none, so there it is a SwiftUI `Toggle` — the same switch as `Switch`. */
|
|
2
3
|
export type CheckboxProps = {
|
|
4
|
+
/** Dims the control and ignores taps. */
|
|
3
5
|
disabled?: boolean;
|
|
6
|
+
/** Text beside the control. On Android the whole labelled row toggles it. */
|
|
4
7
|
label?: string;
|
|
8
|
+
/** Called with the new value when the user toggles it. */
|
|
5
9
|
onValueChange?: (value: boolean) => void;
|
|
10
|
+
/** Whether it is checked. Controlled — update it from `onValueChange`. */
|
|
6
11
|
value: boolean;
|
|
7
12
|
};
|
|
8
13
|
export type CheckboxComponent = (props: CheckboxProps) => ReactNode;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** A filter pill on a `Pressable`, not a native control — the React Native tier, so it needs no host. */
|
|
2
3
|
export type ChipProps = {
|
|
4
|
+
/** The text in the pill. */
|
|
3
5
|
label: string;
|
|
6
|
+
/** Called when the chip is pressed, with the `selection` haptic. */
|
|
4
7
|
onPress?: () => void;
|
|
8
|
+
/** Draws the chip in the accent colours. Off by default. */
|
|
5
9
|
selected?: boolean;
|
|
10
|
+
/** Test identifier, forwarded to the view. */
|
|
6
11
|
testID?: string;
|
|
7
12
|
};
|
|
8
13
|
export type ChipComponent = (props: ChipProps) => ReactNode;
|
|
@@ -4,9 +4,13 @@ import type { ReactNode } from 'react';
|
|
|
4
4
|
* renders nothing and says so in dev. Branch on `Platform.OS` if the screen needs a fallback.
|
|
5
5
|
*/
|
|
6
6
|
export type ColorPickerProps = {
|
|
7
|
+
/** Text beside the colour well. */
|
|
7
8
|
label?: string;
|
|
9
|
+
/** Called with the colour the user picks. */
|
|
8
10
|
onValueChange?: (color: string) => void;
|
|
11
|
+
/** Lets the user pick an opacity as well. Off by default. */
|
|
9
12
|
supportsOpacity?: boolean;
|
|
13
|
+
/** Test identifier, forwarded to the native view. */
|
|
10
14
|
testID?: string;
|
|
11
15
|
/** `#RRGGBB` or `#RRGGBBAA`. */
|
|
12
16
|
value: string | null;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { DatePickerComponent } from './date-picker.types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The system's compact date picker: the value in a pill, and a tap on it opens the calendar popover UIKit owns. Its own
|
|
4
|
+
* host, sized to the pill on both axes — a host that took the width it was given would lay the pill out against the
|
|
5
|
+
* far edge of it, or past its container's — so it drops into a row the way a `Text` does. The label is the caller's,
|
|
6
|
+
* beside it; the calendar is in the accent.
|
|
7
|
+
*/
|
|
3
8
|
export declare const DatePicker: DatePickerComponent;
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export type DatePickerMode = 'date' | 'datetime' | 'time';
|
|
3
|
+
/**
|
|
4
|
+
* A date or time picker — SwiftUI's compact `DatePicker` on iOS, a field that opens Material's picker dialog on a tap
|
|
5
|
+
* on Android. The React Native tier: it brings its own host and sizes itself to the value, so it sits in a row beside
|
|
6
|
+
* its label like a `Text`.
|
|
7
|
+
*/
|
|
3
8
|
export type DatePickerProps = {
|
|
9
|
+
/** The latest date that can be picked. Android ignores it in `time` mode. */
|
|
4
10
|
max?: Date;
|
|
11
|
+
/** The earliest date that can be picked. Android ignores it in `time` mode. */
|
|
5
12
|
min?: Date;
|
|
13
|
+
/**
|
|
14
|
+
* What it picks. `date` by default. Android has no combined dialog, so there `datetime` picks the date and keeps
|
|
15
|
+
* `value`'s time of day.
|
|
16
|
+
*/
|
|
6
17
|
mode?: DatePickerMode;
|
|
18
|
+
/** Called with the new date — on iOS as it changes, on Android when the dialog is confirmed. */
|
|
7
19
|
onValueChange?: (date: Date) => void;
|
|
20
|
+
/** Test identifier — on the native picker on iOS, on the tappable field on Android. */
|
|
8
21
|
testID?: string;
|
|
22
|
+
/** The selected date. Controlled — update it from `onValueChange`. */
|
|
9
23
|
value: Date;
|
|
10
24
|
};
|
|
11
25
|
export type DatePickerComponent = (props: DatePickerProps) => ReactNode;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ColorToken } from '@hzblj/kara-theme';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
/** A horizontal hairline — SwiftUI `Divider` / Compose `HorizontalDivider`. */
|
|
3
4
|
export type DividerProps = {
|
|
5
|
+
/** The line's colour. `border.tertiary` by default. */
|
|
4
6
|
color?: ColorToken;
|
|
7
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
5
8
|
testID?: string;
|
|
6
9
|
};
|
|
7
10
|
export type DividerComponent = (props: DividerProps) => ReactNode;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { IconName } from '../icon';
|
|
3
|
+
/**
|
|
4
|
+
* A floating action button — Material's `FloatingActionButton` on Android, a 56pt accent circle (a plain SwiftUI
|
|
5
|
+
* `Button`) on iOS. It renders inline; pinning it to a corner is up to the screen.
|
|
6
|
+
*/
|
|
3
7
|
export type FabProps = {
|
|
8
|
+
/** The icon, one of the app's, drawn in `content.on.bg`. */
|
|
4
9
|
name: IconName;
|
|
10
|
+
/** Called when the button is pressed. */
|
|
5
11
|
onPress?: () => void;
|
|
12
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
6
13
|
testID?: string;
|
|
7
14
|
};
|
|
8
15
|
export type FabComponent = (props: FabProps) => ReactNode;
|
|
@@ -11,6 +11,7 @@ export type GlassViewProps = ResponsiveViewSx & {
|
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
/** Swells toward the finger on touch, carrying the children with it. Wrap the view in a `Pressable` for the press. */
|
|
13
13
|
interactive?: boolean;
|
|
14
|
+
/** Test identifier, forwarded to the view. */
|
|
14
15
|
testID?: string;
|
|
15
16
|
/** Tints the material. Unset leaves it clear. */
|
|
16
17
|
tint?: ColorToken;
|
|
@@ -2,11 +2,17 @@ import type { ResponsiveSx } from '@hzblj/kara-sx';
|
|
|
2
2
|
import type { SpaceSize } from '@hzblj/kara-theme';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
export type HStackAlign = 'center' | 'end' | 'start';
|
|
5
|
+
/** A horizontal stack — SwiftUI `HStack` / Compose `Row`. */
|
|
5
6
|
export type HStackProps = ResponsiveSx & {
|
|
7
|
+
/** How the children line up vertically — `start` is the top, `end` the bottom. `start` by default. */
|
|
6
8
|
align?: HStackAlign;
|
|
9
|
+
/** Native views, laid out from the leading edge. */
|
|
7
10
|
children?: ReactNode;
|
|
11
|
+
/** Makes the stack pressable — a tap gesture on iOS, a `clickable` with Material's ripple on Android. */
|
|
8
12
|
onPress?: () => void;
|
|
13
|
+
/** The gap between children. Unset, SwiftUI puts its default spacing between them and Compose none. */
|
|
9
14
|
spacing?: SpaceSize;
|
|
15
|
+
/** Test identifier, forwarded to the native view. */
|
|
10
16
|
testID?: string;
|
|
11
17
|
};
|
|
12
18
|
export type HStackComponent = (props: HStackProps) => ReactNode;
|
|
@@ -15,12 +15,20 @@ type DeclaredIconName = keyof KaraIcons & string;
|
|
|
15
15
|
* from the folder fails at every call site. Before that, any string, so a project can adopt icons gradually.
|
|
16
16
|
*/
|
|
17
17
|
export type IconName = [DeclaredIconName] extends [never] ? string : DeclaredIconName;
|
|
18
|
+
/**
|
|
19
|
+
* One of the app's icons, in a host — SwiftUI `Image` from the asset catalog on iOS, Material's `Icon` with the vector
|
|
20
|
+
* drawable on Android. `RnIcon` draws the same asset outside one.
|
|
21
|
+
*/
|
|
18
22
|
export type IconProps = {
|
|
19
23
|
/** What a screen reader says. Unset, the icon is decorative and hidden from it. */
|
|
20
24
|
accessibilityLabel?: string;
|
|
25
|
+
/** The icon's tint. `content.primary` by default. */
|
|
21
26
|
color?: ColorToken;
|
|
27
|
+
/** Which of the app's icons — a key of `KaraIcons`. */
|
|
22
28
|
name: IconName;
|
|
29
|
+
/** Its width and height, a spacing token. `s24` by default. */
|
|
23
30
|
size?: SpaceSize;
|
|
31
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
24
32
|
testID?: string;
|
|
25
33
|
};
|
|
26
34
|
export type IconComponent = (props: IconProps) => ReactNode;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { IconName } from '../icon';
|
|
3
|
+
/** A button that is just an icon — a plain SwiftUI `Button` on iOS, Material's `IconButton` on Android. */
|
|
3
4
|
export type IconButtonProps = {
|
|
5
|
+
/** Draws the icon in `btn.content.disabled` and stops the button responding to presses. */
|
|
4
6
|
disabled?: boolean;
|
|
7
|
+
/** The icon, one of the app's. */
|
|
5
8
|
name: IconName;
|
|
9
|
+
/** Called when the button is pressed. */
|
|
6
10
|
onPress?: () => void;
|
|
11
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
7
12
|
testID?: string;
|
|
8
13
|
};
|
|
9
14
|
export type IconButtonComponent = (props: IconButtonProps) => ReactNode;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
/** A host for native atoms in a React Native layout — the SwiftUI / Compose `Host` an `@expo/ui` tree mounts into. */
|
|
3
4
|
export type IslandProps = {
|
|
5
|
+
/** The native views it hosts. */
|
|
4
6
|
children?: ReactNode;
|
|
5
7
|
/**
|
|
6
8
|
* Sizes the island's height to its native content while the width still comes from the parent, which
|
|
@@ -14,7 +16,9 @@ export type IslandProps = {
|
|
|
14
16
|
* hangs the main thread as soon as the views lay out on screen.
|
|
15
17
|
*/
|
|
16
18
|
matchContents?: boolean;
|
|
19
|
+
/** A React Native style for the host view — its size and placement. It needs a height when `matchContents` is off. */
|
|
17
20
|
style?: StyleProp<ViewStyle>;
|
|
21
|
+
/** Test identifier, forwarded to the host view on iOS — Android ignores it. */
|
|
18
22
|
testID?: string;
|
|
19
23
|
};
|
|
20
24
|
export type IslandComponent = (props: IslandProps) => ReactNode;
|
|
@@ -9,12 +9,14 @@ import type { ReactNode } from 'react';
|
|
|
9
9
|
* the children is one too many: on iOS it becomes an empty row of its own.
|
|
10
10
|
*/
|
|
11
11
|
export type ListProps = {
|
|
12
|
+
/** The rows — native views, one row each. */
|
|
12
13
|
children: ReactNode;
|
|
13
14
|
/**
|
|
14
15
|
* Enables pull-to-refresh. Async on purpose — see `ScrollViewProps.onRefresh`: the spinner runs
|
|
15
16
|
* until the promise settles, so neither platform needs a `refreshing` flag kept in sync by hand.
|
|
16
17
|
*/
|
|
17
18
|
onRefresh?: () => Promise<void>;
|
|
19
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
18
20
|
testID?: string;
|
|
19
21
|
};
|
|
20
22
|
export type ListComponent = (props: ListProps) => ReactNode;
|