@unif/react-native-design 0.37.0 → 0.39.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.
Files changed (51) hide show
  1. package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js +62 -18
  2. package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js.map +1 -1
  3. package/lib/module/components/ui/ActionMenuContent/ActionMenuItem.js +57 -0
  4. package/lib/module/components/ui/ActionMenuContent/ActionMenuItem.js.map +1 -0
  5. package/lib/module/components/ui/ActionMenuContent/ActionMenuSheetCard.js +25 -0
  6. package/lib/module/components/ui/ActionMenuContent/ActionMenuSheetCard.js.map +1 -0
  7. package/lib/module/components/ui/ActionMenuContent/styles.js +50 -2
  8. package/lib/module/components/ui/ActionMenuContent/styles.js.map +1 -1
  9. package/lib/module/components/ui/ActionMenuContent/useMenuMousePress.js +26 -0
  10. package/lib/module/components/ui/ActionMenuContent/useMenuMousePress.js.map +1 -0
  11. package/lib/module/components/ui/ImagePreview/ImagePreview.js +81 -72
  12. package/lib/module/components/ui/ImagePreview/ImagePreview.js.map +1 -1
  13. package/lib/module/components/ui/ImagePreview/constants.js +2 -0
  14. package/lib/module/components/ui/ImagePreview/constants.js.map +1 -1
  15. package/lib/module/components/ui/ImagePreview/styles.js +5 -1
  16. package/lib/module/components/ui/ImagePreview/styles.js.map +1 -1
  17. package/lib/module/components/ui/Sheet/Sheet.js +2 -1
  18. package/lib/module/components/ui/Sheet/Sheet.js.map +1 -1
  19. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts +1 -1
  20. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts.map +1 -1
  21. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuItem.d.ts +3 -0
  22. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuItem.d.ts.map +1 -0
  23. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuSheetCard.d.ts +3 -0
  24. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuSheetCard.d.ts.map +1 -0
  25. package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts +57 -2
  26. package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts.map +1 -1
  27. package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts +15 -1
  28. package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts.map +1 -1
  29. package/lib/typescript/src/components/ui/ActionMenuContent/useMenuMousePress.d.ts +10 -0
  30. package/lib/typescript/src/components/ui/ActionMenuContent/useMenuMousePress.d.ts.map +1 -0
  31. package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts.map +1 -1
  32. package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts +1 -0
  33. package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts.map +1 -1
  34. package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts +4 -1
  35. package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts.map +1 -1
  36. package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts +1 -1
  37. package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts.map +1 -1
  38. package/lib/typescript/src/components/ui/Sheet/types.d.ts +1 -0
  39. package/lib/typescript/src/components/ui/Sheet/types.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/src/components/ui/ActionMenuContent/ActionMenuContent.tsx +108 -50
  42. package/src/components/ui/ActionMenuContent/ActionMenuItem.tsx +56 -0
  43. package/src/components/ui/ActionMenuContent/ActionMenuSheetCard.tsx +28 -0
  44. package/src/components/ui/ActionMenuContent/styles.ts +50 -3
  45. package/src/components/ui/ActionMenuContent/types.ts +17 -1
  46. package/src/components/ui/ActionMenuContent/useMenuMousePress.ts +30 -0
  47. package/src/components/ui/ImagePreview/ImagePreview.tsx +92 -76
  48. package/src/components/ui/ImagePreview/constants.ts +3 -0
  49. package/src/components/ui/ImagePreview/styles.ts +5 -1
  50. package/src/components/ui/Sheet/Sheet.tsx +4 -1
  51. package/src/components/ui/Sheet/types.ts +1 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { StyleSheet } from 'react-native';
4
4
  import { fontMono, radius, space, type as typography } from "../../../theme/index.js";
5
+ import { IMAGE_COUNTER_HEIGHT } from "./constants.js";
5
6
  export const makeStyles = colors => StyleSheet.create({
6
7
  container: {
7
8
  alignItems: 'center',
@@ -35,8 +36,11 @@ export const makeStyles = colors => StyleSheet.create({
35
36
  textAlign: 'center'
36
37
  },
37
38
  counter: {
39
+ position: 'absolute',
40
+ bottom: 0,
38
41
  alignSelf: 'center',
39
- paddingVertical: space[1],
42
+ height: IMAGE_COUNTER_HEIGHT,
43
+ justifyContent: 'center',
40
44
  paddingHorizontal: space[3],
41
45
  borderRadius: radius.pill,
42
46
  borderWidth: StyleSheet.hairlineWidth,
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSheet","fontMono","radius","space","type","typography","makeStyles","colors","create","container","alignItems","gap","media","backgroundColor","borderRadius","xl","overflow","border","absoluteFill","borderColor","outline","borderWidth","hairlineWidth","image","placeholder","width","height","justifyContent","paddingHorizontal","placeholderText","color","fontSize","sm","textAlign","counter","alignSelf","paddingVertical","pill","glassPillBorder","glassHighlight","counterText","foreground","fontFamily","deleteButton"],"sourceRoot":"../../../../../src","sources":["components/ui/ImagePreview/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,EAAEC,IAAI,IAAIC,UAAU,QAAQ,yBAAgB;AAG5E,OAAO,MAAMC,UAAU,GAAIC,MAAmB,IAC5CP,UAAU,CAACQ,MAAM,CAAC;EAChBC,SAAS,EAAE;IAAEC,UAAU,EAAE,QAAQ;IAAEC,GAAG,EAAER,KAAK,CAAC,CAAC;EAAE,CAAC;EAClDS,KAAK,EAAE;IACLC,eAAe,EAAE,OAAO;IACxBC,YAAY,EAAEZ,MAAM,CAACa,EAAE;IACvBC,QAAQ,EAAE;EACZ,CAAC;EACDC,MAAM,EAAE;IACN,GAAGjB,UAAU,CAACkB,YAAY;IAC1BC,WAAW,EAAEZ,MAAM,CAACa,OAAO;IAC3BC,WAAW,EAAErB,UAAU,CAACsB,aAAa;IACrCR,YAAY,EAAEZ,MAAM,CAACa;EACvB,CAAC;EACDQ,KAAK,EAAE;IAAEV,eAAe,EAAE;EAAQ,CAAC;EACnCW,WAAW,EAAE;IACXC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdb,eAAe,EAAE,OAAO;IACxBc,cAAc,EAAE,QAAQ;IACxBjB,UAAU,EAAE,QAAQ;IACpBkB,iBAAiB,EAAEzB,KAAK,CAAC,CAAC;EAC5B,CAAC;EACD0B,eAAe,EAAE;IACfC,KAAK,EAAE,OAAO;IACdC,QAAQ,EAAE1B,UAAU,CAAC2B,EAAE;IACvBC,SAAS,EAAE;EACb,CAAC;EACDC,OAAO,EAAE;IACPC,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAEjC,KAAK,CAAC,CAAC,CAAC;IACzByB,iBAAiB,EAAEzB,KAAK,CAAC,CAAC,CAAC;IAC3BW,YAAY,EAAEZ,MAAM,CAACmC,IAAI;IACzBhB,WAAW,EAAErB,UAAU,CAACsB,aAAa;IACrCH,WAAW,EAAEZ,MAAM,CAAC+B,eAAe;IACnCzB,eAAe,EAAEN,MAAM,CAACgC;EAC1B,CAAC;EACDC,WAAW,EAAE;IACXV,KAAK,EAAEvB,MAAM,CAACkC,UAAU;IACxBV,QAAQ,EAAE1B,UAAU,CAAC2B,EAAE;IACvBU,UAAU,EAAEzC;EACd,CAAC;EACD0C,YAAY,EAAE;IAAE7B,YAAY,EAAEZ,MAAM,CAACmC;EAAK;AAC5C,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["StyleSheet","fontMono","radius","space","type","typography","IMAGE_COUNTER_HEIGHT","makeStyles","colors","create","container","alignItems","gap","media","backgroundColor","borderRadius","xl","overflow","border","absoluteFill","borderColor","outline","borderWidth","hairlineWidth","image","placeholder","width","height","justifyContent","paddingHorizontal","placeholderText","color","fontSize","sm","textAlign","counter","position","bottom","alignSelf","pill","glassPillBorder","glassHighlight","counterText","foreground","fontFamily","deleteButton"],"sourceRoot":"../../../../../src","sources":["components/ui/ImagePreview/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,EAAEC,IAAI,IAAIC,UAAU,QAAQ,yBAAgB;AAE5E,SAASC,oBAAoB,QAAQ,gBAAa;AAElD,OAAO,MAAMC,UAAU,GAAIC,MAAmB,IAC5CR,UAAU,CAACS,MAAM,CAAC;EAChBC,SAAS,EAAE;IAAEC,UAAU,EAAE,QAAQ;IAAEC,GAAG,EAAET,KAAK,CAAC,CAAC;EAAE,CAAC;EAClDU,KAAK,EAAE;IACLC,eAAe,EAAE,OAAO;IACxBC,YAAY,EAAEb,MAAM,CAACc,EAAE;IACvBC,QAAQ,EAAE;EACZ,CAAC;EACDC,MAAM,EAAE;IACN,GAAGlB,UAAU,CAACmB,YAAY;IAC1BC,WAAW,EAAEZ,MAAM,CAACa,OAAO;IAC3BC,WAAW,EAAEtB,UAAU,CAACuB,aAAa;IACrCR,YAAY,EAAEb,MAAM,CAACc;EACvB,CAAC;EACDQ,KAAK,EAAE;IAAEV,eAAe,EAAE;EAAQ,CAAC;EACnCW,WAAW,EAAE;IACXC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdb,eAAe,EAAE,OAAO;IACxBc,cAAc,EAAE,QAAQ;IACxBjB,UAAU,EAAE,QAAQ;IACpBkB,iBAAiB,EAAE1B,KAAK,CAAC,CAAC;EAC5B,CAAC;EACD2B,eAAe,EAAE;IACfC,KAAK,EAAE,OAAO;IACdC,QAAQ,EAAE3B,UAAU,CAAC4B,EAAE;IACvBC,SAAS,EAAE;EACb,CAAC;EACDC,OAAO,EAAE;IACPC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,SAAS,EAAE,QAAQ;IACnBX,MAAM,EAAErB,oBAAoB;IAC5BsB,cAAc,EAAE,QAAQ;IACxBC,iBAAiB,EAAE1B,KAAK,CAAC,CAAC,CAAC;IAC3BY,YAAY,EAAEb,MAAM,CAACqC,IAAI;IACzBjB,WAAW,EAAEtB,UAAU,CAACuB,aAAa;IACrCH,WAAW,EAAEZ,MAAM,CAACgC,eAAe;IACnC1B,eAAe,EAAEN,MAAM,CAACiC;EAC1B,CAAC;EACDC,WAAW,EAAE;IACXX,KAAK,EAAEvB,MAAM,CAACmC,UAAU;IACxBX,QAAQ,EAAE3B,UAAU,CAAC4B,EAAE;IACvBW,UAAU,EAAE3C;EACd,CAAC;EACD4C,YAAY,EAAE;IAAE9B,YAAY,EAAEb,MAAM,CAACqC;EAAK;AAC5C,CAAC,CAAC","ignoreList":[]}
@@ -11,6 +11,7 @@ export function Sheet({
11
11
  footer,
12
12
  contentMode = 'fixed',
13
13
  contentContainerStyle,
14
+ footerStyle,
14
15
  style,
15
16
  testID
16
17
  }) {
@@ -32,7 +33,7 @@ export function Sheet({
32
33
  style: [styles.contentRegion, styles.content, contentContainerStyle],
33
34
  children: children
34
35
  }), footer ? /*#__PURE__*/_jsx(View, {
35
- style: styles.footer,
36
+ style: [styles.footer, footerStyle],
36
37
  children: footer
37
38
  }) : null]
38
39
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","ScrollView","View","useThemedStyles","makeStyles","jsx","_jsx","jsxs","_jsxs","Sheet","children","header","footer","contentMode","contentContainerStyle","style","testID","styles","root","grabberContainer","grabber","contentRegion","content","keyboardShouldPersistTaps"],"sourceRoot":"../../../../../src","sources":["components/ui/Sheet/Sheet.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,eAAe,QAAQ,yBAAgB;AAChD,SAASC,UAAU,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGtC,OAAO,SAASC,KAAKA,CAAC;EACpBC,QAAQ;EACRC,MAAM;EACNC,MAAM;EACNC,WAAW,GAAG,OAAO;EACrBC,qBAAqB;EACrBC,KAAK;EACLC;AACU,CAAC,EAAqB;EAChC,MAAMC,MAAM,GAAGd,eAAe,CAACC,UAAU,CAAC;EAE1C,oBACEI,KAAA,CAACN,IAAI;IAACa,KAAK,EAAE,CAACE,MAAM,CAACC,IAAI,EAAEH,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAO;IAAAN,QAAA,GAC/CC,MAAM,iBACLL,IAAA,CAACJ,IAAI;MAACa,KAAK,EAAEE,MAAM,CAACE,gBAAiB;MAAAT,QAAA,eACnCJ,IAAA,CAACJ,IAAI;QAACa,KAAK,EAAEE,MAAM,CAACG;MAAQ,CAAE;IAAC,CAC3B,CACP,EACAP,WAAW,KAAK,QAAQ,gBACvBP,IAAA,CAACL,UAAU;MACTc,KAAK,EAAEE,MAAM,CAACI,aAAc;MAC5BP,qBAAqB,EAAE,CAACG,MAAM,CAACK,OAAO,EAAER,qBAAqB,CAAE;MAC/DS,yBAAyB,EAAC,SAAS;MAAAb,QAAA,EAElCA;IAAQ,CACC,CAAC,gBAEbJ,IAAA,CAACJ,IAAI;MACHa,KAAK,EAAE,CAACE,MAAM,CAACI,aAAa,EAAEJ,MAAM,CAACK,OAAO,EAAER,qBAAqB,CAAE;MAAAJ,QAAA,EAEpEA;IAAQ,CACL,CACP,EACAE,MAAM,gBAAGN,IAAA,CAACJ,IAAI;MAACa,KAAK,EAAEE,MAAM,CAACL,MAAO;MAAAF,QAAA,EAAEE;IAAM,CAAO,CAAC,GAAG,IAAI;EAAA,CACxD,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["React","ScrollView","View","useThemedStyles","makeStyles","jsx","_jsx","jsxs","_jsxs","Sheet","children","header","footer","contentMode","contentContainerStyle","footerStyle","style","testID","styles","root","grabberContainer","grabber","contentRegion","content","keyboardShouldPersistTaps"],"sourceRoot":"../../../../../src","sources":["components/ui/Sheet/Sheet.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,eAAe,QAAQ,yBAAgB;AAChD,SAASC,UAAU,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGtC,OAAO,SAASC,KAAKA,CAAC;EACpBC,QAAQ;EACRC,MAAM;EACNC,MAAM;EACNC,WAAW,GAAG,OAAO;EACrBC,qBAAqB;EACrBC,WAAW;EACXC,KAAK;EACLC;AACU,CAAC,EAAqB;EAChC,MAAMC,MAAM,GAAGf,eAAe,CAACC,UAAU,CAAC;EAE1C,oBACEI,KAAA,CAACN,IAAI;IAACc,KAAK,EAAE,CAACE,MAAM,CAACC,IAAI,EAAEH,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAO;IAAAP,QAAA,GAC/CC,MAAM,iBACLL,IAAA,CAACJ,IAAI;MAACc,KAAK,EAAEE,MAAM,CAACE,gBAAiB;MAAAV,QAAA,eACnCJ,IAAA,CAACJ,IAAI;QAACc,KAAK,EAAEE,MAAM,CAACG;MAAQ,CAAE;IAAC,CAC3B,CACP,EACAR,WAAW,KAAK,QAAQ,gBACvBP,IAAA,CAACL,UAAU;MACTe,KAAK,EAAEE,MAAM,CAACI,aAAc;MAC5BR,qBAAqB,EAAE,CAACI,MAAM,CAACK,OAAO,EAAET,qBAAqB,CAAE;MAC/DU,yBAAyB,EAAC,SAAS;MAAAd,QAAA,EAElCA;IAAQ,CACC,CAAC,gBAEbJ,IAAA,CAACJ,IAAI;MACHc,KAAK,EAAE,CAACE,MAAM,CAACI,aAAa,EAAEJ,MAAM,CAACK,OAAO,EAAET,qBAAqB,CAAE;MAAAJ,QAAA,EAEpEA;IAAQ,CACL,CACP,EACAE,MAAM,gBACLN,IAAA,CAACJ,IAAI;MAACc,KAAK,EAAE,CAACE,MAAM,CAACN,MAAM,EAAEG,WAAW,CAAE;MAAAL,QAAA,EAAEE;IAAM,CAAO,CAAC,GACxD,IAAI;EAAA,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { ActionMenuContentProps } from './types';
3
- export declare function ActionMenuContent({ actions, onClose, presentation, title, cancelLabel, style, testID, }: ActionMenuContentProps): React.JSX.Element;
3
+ export declare function ActionMenuContent({ actions, onClose, presentation, title, cancelLabel, style, contentStyle, testID, }: ActionMenuContentProps): React.JSX.Element;
4
4
  //# sourceMappingURL=ActionMenuContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionMenuContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/ActionMenuContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,YAAuB,EACvB,KAAK,EACL,WAAkB,EAClB,KAAK,EACL,MAAsB,GACvB,EAAE,sBAAsB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAqG5C"}
1
+ {"version":3,"file":"ActionMenuContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/ActionMenuContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAKtD,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,YAAuB,EACvB,KAAK,EACL,WAAkB,EAClB,KAAK,EACL,YAAY,EACZ,MAAsB,GACvB,EAAE,sBAAsB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6J5C"}
@@ -0,0 +1,3 @@
1
+ import type { ActionMenuItemProps } from './types';
2
+ export declare function ActionMenuItem({ action, onPress }: ActionMenuItemProps): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=ActionMenuItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionMenuItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/ActionMenuItem.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,2CA+CtE"}
@@ -0,0 +1,3 @@
1
+ import type { ActionMenuSheetCardProps } from './types';
2
+ export declare function ActionMenuSheetCard({ children, contentStyle, testID, }: ActionMenuSheetCardProps): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=ActionMenuSheetCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionMenuSheetCard.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/ActionMenuSheetCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,MAAM,GACP,EAAE,wBAAwB,2CAiB1B"}
@@ -1,5 +1,60 @@
1
- import type { ColorTokens } from '../../../theme';
2
- export declare const makeStyles: (c: ColorTokens) => Readonly<{
1
+ import type { ColorTokens, ShadowTokens } from '../../../theme';
2
+ export declare const makeStyles: (c: ColorTokens, shadows: ShadowTokens) => Readonly<{
3
+ popoverRoot: {
4
+ shadowColor: string;
5
+ shadowOffset: {
6
+ readonly width: number;
7
+ readonly height: number;
8
+ };
9
+ shadowOpacity: number;
10
+ shadowRadius: number;
11
+ elevation: number;
12
+ width: number;
13
+ maxWidth: string;
14
+ borderRadius: number;
15
+ borderWidth: number;
16
+ borderColor: string;
17
+ backgroundColor: string;
18
+ };
19
+ popoverCard: {
20
+ borderRadius: number;
21
+ overflow: "hidden";
22
+ paddingVertical: number;
23
+ };
24
+ popoverRow: {
25
+ minHeight: 44;
26
+ flexDirection: "row";
27
+ alignItems: "center";
28
+ gap: number;
29
+ paddingVertical: number;
30
+ paddingHorizontal: number;
31
+ };
32
+ popoverRowPressed: {
33
+ backgroundColor: string;
34
+ };
35
+ popoverRowDisabled: {
36
+ opacity: number;
37
+ };
38
+ popoverIcon: {
39
+ width: number;
40
+ height: number;
41
+ borderRadius: number;
42
+ alignItems: "center";
43
+ justifyContent: "center";
44
+ backgroundColor: string;
45
+ };
46
+ popoverLabel: {
47
+ flex: number;
48
+ minWidth: number;
49
+ fontSize: number;
50
+ color: string;
51
+ };
52
+ popoverDanger: {
53
+ color: string;
54
+ };
55
+ popoverConfirmationActions: {
56
+ paddingTop: number;
57
+ };
3
58
  dialogRoot: {
4
59
  flex: number;
5
60
  justifyContent: "center";
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,eAAO,MAAM,UAAU,GAAI,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CrC,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/styles.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,eAAO,MAAM,UAAU,GAAI,GAAG,WAAW,EAAE,SAAS,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmF5D,CAAC"}
@@ -1,4 +1,6 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { StyleProp, ViewStyle } from 'react-native';
3
+ import type { IconName } from '../Icon';
2
4
  export interface ActionMenuConfirmation {
3
5
  message: string;
4
6
  confirmLabel: string;
@@ -6,6 +8,8 @@ export interface ActionMenuConfirmation {
6
8
  export interface ActionMenuAction {
7
9
  id: string;
8
10
  label: string;
11
+ icon?: IconName;
12
+ accessibilityHint?: string;
9
13
  onPress(): void;
10
14
  disabled?: boolean;
11
15
  loading?: boolean;
@@ -15,11 +19,21 @@ export interface ActionMenuAction {
15
19
  /** 操作、确认有效性和宿主关闭由调用方负责。 */
16
20
  export interface ActionMenuContentProps {
17
21
  actions: readonly ActionMenuAction[];
18
- presentation?: 'dialog' | 'sheet';
22
+ presentation?: 'dialog' | 'sheet' | 'popover';
19
23
  title?: string;
20
24
  cancelLabel?: string;
21
25
  onClose(): void;
22
26
  style?: StyleProp<ViewStyle>;
27
+ contentStyle?: StyleProp<ViewStyle>;
23
28
  testID?: string;
24
29
  }
30
+ export interface ActionMenuItemProps {
31
+ action: ActionMenuAction;
32
+ onPress(): void;
33
+ }
34
+ export interface ActionMenuSheetCardProps {
35
+ children: ReactNode;
36
+ contentStyle?: StyleProp<ViewStyle>;
37
+ testID: string;
38
+ }
25
39
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED,2BAA2B;AAC3B,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED,2BAA2B;AAC3B,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,10 @@
1
+ import type { PointerEvent } from 'react-native';
2
+ /** Web 菜单按下时保留原输入焦点;实际选择只由 Pressable.onPress 交付。 */
3
+ export declare function useMenuMousePress(disabled: boolean): {
4
+ mousePressed: boolean;
5
+ onPointerDown: (event: PointerEvent) => void;
6
+ onPointerUp: () => void;
7
+ onPointerCancel: () => void;
8
+ onPointerLeave: () => void;
9
+ };
10
+ //# sourceMappingURL=useMenuMousePress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMenuMousePress.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ActionMenuContent/useMenuMousePress.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO;;2BAM3B,YAAY;;;;EAkBnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImagePreview.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ImagePreview/ImagePreview.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,YAAY,kHA2NxB,CAAC"}
1
+ {"version":3,"file":"ImagePreview.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ImagePreview/ImagePreview.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,YAAY,kHAuOxB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export declare const IMAGE_UNAVAILABLE = "\u56FE\u7247\u6682\u4E0D\u53EF\u9884\u89C8";
2
2
  export declare const DELETE_LABEL = "\u5220\u9664\u5F53\u524D\u7167\u7247";
3
+ export declare const IMAGE_COUNTER_HEIGHT: number;
3
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ImagePreview/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,+CAAY,CAAC;AAC3C,eAAO,MAAM,YAAY,yCAAW,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ImagePreview/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,+CAAY,CAAC;AAC3C,eAAO,MAAM,YAAY,yCAAW,CAAC;AACrC,eAAO,MAAM,oBAAoB,QAAQ,CAAC"}
@@ -36,8 +36,11 @@ export declare const makeStyles: (colors: ColorTokens) => Readonly<{
36
36
  textAlign: "center";
37
37
  };
38
38
  counter: {
39
+ position: "absolute";
40
+ bottom: number;
39
41
  alignSelf: "center";
40
- paddingVertical: number;
42
+ height: number;
43
+ justifyContent: "center";
41
44
  paddingHorizontal: number;
42
45
  borderRadius: 999;
43
46
  borderWidth: number;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ImagePreview/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,QAAQ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2C1C,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/ImagePreview/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,eAAO,MAAM,UAAU,GAAI,QAAQ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8C1C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { SheetProps } from './types';
3
- export declare function Sheet({ children, header, footer, contentMode, contentContainerStyle, style, testID, }: SheetProps): React.JSX.Element;
3
+ export declare function Sheet({ children, header, footer, contentMode, contentContainerStyle, footerStyle, style, testID, }: SheetProps): React.JSX.Element;
4
4
  //# sourceMappingURL=Sheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/Sheet/Sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,WAAqB,EACrB,qBAAqB,EACrB,KAAK,EACL,MAAM,GACP,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4BhC"}
1
+ {"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/Sheet/Sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,WAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,KAAK,EACL,MAAM,GACP,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA8BhC"}
@@ -7,6 +7,7 @@ export interface SheetProps {
7
7
  footer?: ReactNode;
8
8
  contentMode?: SheetContentMode;
9
9
  contentContainerStyle?: StyleProp<ViewStyle>;
10
+ footerStyle?: StyleProp<ViewStyle>;
10
11
  style?: StyleProp<ViewStyle>;
11
12
  testID?: string;
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/Sheet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAEtE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/Sheet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAEtE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unif/react-native-design",
3
- "version": "0.37.0",
3
+ "version": "0.39.0",
4
4
  "description": "Unif React Native 设计系统:基础组件、主题、字体和图标",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { Pressable, Text, View } from 'react-native';
3
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
- import { space, useThemedStyles } from '../../../theme';
3
+ import { useThemedStyles } from '../../../theme';
5
4
  import { Button } from '../Button';
6
5
  import type { ActionMenuContentProps } from './types';
7
6
  import { makeStyles } from './styles';
7
+ import { ActionMenuItem } from './ActionMenuItem';
8
+ import { ActionMenuSheetCard } from './ActionMenuSheetCard';
8
9
 
9
10
  export function ActionMenuContent({
10
11
  actions,
@@ -13,31 +14,31 @@ export function ActionMenuContent({
13
14
  title,
14
15
  cancelLabel = '取消',
15
16
  style,
17
+ contentStyle,
16
18
  testID = 'action-menu',
17
19
  }: ActionMenuContentProps): React.JSX.Element {
18
20
  const styles = useThemedStyles(makeStyles);
19
- const insets = useSafeAreaInsets();
20
21
  const [confirmationId, setConfirmationId] = useState<string | null>(null);
21
22
  const isSheet = presentation === 'sheet';
23
+ const isPopover = presentation === 'popover';
22
24
  const confirming = actions.find(
23
25
  (action) =>
24
26
  action.id === confirmationId && action.confirmation !== undefined
25
27
  );
26
28
 
29
+ const cancelConfirmation = () => setConfirmationId(null);
30
+ const confirmSelected = () => {
31
+ if (!confirming) return;
32
+ onClose();
33
+ confirming.onPress();
34
+ };
35
+
27
36
  useEffect(() => {
28
37
  if (!confirming) setConfirmationId(null);
29
38
  }, [confirming]);
30
39
 
31
- const content = (
32
- <Pressable
33
- accessible={false}
34
- testID={`${testID}-card`}
35
- style={[
36
- isSheet ? styles.sheetCard : styles.dialogCard,
37
- isSheet && { paddingBottom: insets.bottom + space[5] },
38
- ]}
39
- onPress={(event) => event.stopPropagation()}
40
- >
40
+ const body = (
41
+ <>
41
42
  {title ? (
42
43
  <Text
43
44
  testID={`${testID}-title`}
@@ -53,25 +54,44 @@ export function ActionMenuContent({
53
54
  <Text style={styles.confirmation} accessibilityLiveRegion="polite">
54
55
  {confirming.confirmation.message}
55
56
  </Text>
56
- <View style={styles.sheetActions}>
57
- <Button
58
- label={cancelLabel}
59
- variant="neutral"
60
- style={styles.sheetAction}
61
- onPress={() => setConfirmationId(null)}
62
- />
63
- <Button
64
- label={confirming.confirmation.confirmLabel}
65
- variant="danger"
66
- disabled={confirming.disabled}
67
- loading={confirming.loading}
68
- style={styles.sheetAction}
69
- onPress={() => {
70
- onClose();
71
- confirming.onPress();
72
- }}
73
- />
74
- </View>
57
+ {isPopover ? (
58
+ <View style={styles.popoverConfirmationActions}>
59
+ <ActionMenuItem
60
+ action={{
61
+ id: 'cancel-confirmation',
62
+ label: cancelLabel,
63
+ onPress: cancelConfirmation,
64
+ }}
65
+ onPress={cancelConfirmation}
66
+ />
67
+ <ActionMenuItem
68
+ action={{
69
+ ...confirming,
70
+ label: confirming.confirmation.confirmLabel,
71
+ icon: undefined,
72
+ tone: 'danger',
73
+ }}
74
+ onPress={confirmSelected}
75
+ />
76
+ </View>
77
+ ) : (
78
+ <View style={styles.sheetActions}>
79
+ <Button
80
+ label={cancelLabel}
81
+ variant="neutral"
82
+ style={styles.sheetAction}
83
+ onPress={cancelConfirmation}
84
+ />
85
+ <Button
86
+ label={confirming.confirmation.confirmLabel}
87
+ variant="danger"
88
+ disabled={confirming.disabled}
89
+ loading={confirming.loading}
90
+ style={styles.sheetAction}
91
+ onPress={confirmSelected}
92
+ />
93
+ </View>
94
+ )}
75
95
  </>
76
96
  ) : (
77
97
  <>
@@ -79,32 +99,70 @@ export function ActionMenuContent({
79
99
  testID={`${testID}-actions`}
80
100
  style={isSheet ? styles.sheetActions : undefined}
81
101
  >
82
- {actions.map((action) => (
83
- <Button
84
- key={action.id}
85
- label={action.label}
86
- disabled={action.disabled}
87
- loading={action.loading}
88
- variant={isSheet ? (action.tone ?? 'neutral') : 'text'}
89
- style={isSheet ? styles.sheetAction : undefined}
90
- onPress={() => {
91
- if (action.confirmation) {
92
- setConfirmationId(action.id);
93
- return;
94
- }
95
- action.onPress();
96
- }}
97
- />
98
- ))}
102
+ {actions.map((action) =>
103
+ isPopover ? (
104
+ <ActionMenuItem
105
+ key={action.id}
106
+ action={action}
107
+ onPress={() => {
108
+ if (action.confirmation) setConfirmationId(action.id);
109
+ else action.onPress();
110
+ }}
111
+ />
112
+ ) : (
113
+ <Button
114
+ key={action.id}
115
+ label={action.label}
116
+ leftIcon={action.icon}
117
+ accessibilityHint={action.accessibilityHint}
118
+ disabled={action.disabled}
119
+ loading={action.loading}
120
+ variant={isSheet ? (action.tone ?? 'neutral') : 'text'}
121
+ style={isSheet ? styles.sheetAction : undefined}
122
+ onPress={() => {
123
+ if (action.confirmation) {
124
+ setConfirmationId(action.id);
125
+ return;
126
+ }
127
+ action.onPress();
128
+ }}
129
+ />
130
+ )
131
+ )}
99
132
  </View>
100
- {!isSheet ? (
133
+ {!isSheet && !isPopover ? (
101
134
  <Button label={cancelLabel} variant="text" onPress={onClose} />
102
135
  ) : null}
103
136
  </>
104
137
  )}
138
+ </>
139
+ );
140
+ const content = isSheet ? (
141
+ <ActionMenuSheetCard contentStyle={contentStyle} testID={`${testID}-card`}>
142
+ {body}
143
+ </ActionMenuSheetCard>
144
+ ) : isPopover ? (
145
+ <View testID={`${testID}-card`} style={[styles.popoverCard, contentStyle]}>
146
+ {body}
147
+ </View>
148
+ ) : (
149
+ <Pressable
150
+ accessible={false}
151
+ testID={`${testID}-card`}
152
+ style={[styles.dialogCard, contentStyle]}
153
+ onPress={(event) => event.stopPropagation()}
154
+ >
155
+ {body}
105
156
  </Pressable>
106
157
  );
107
158
 
159
+ if (isPopover)
160
+ return (
161
+ <View testID={testID} style={[styles.popoverRoot, style]}>
162
+ {content}
163
+ </View>
164
+ );
165
+
108
166
  return (
109
167
  <Pressable
110
168
  accessible={false}
@@ -0,0 +1,56 @@
1
+ import { ActivityIndicator, Pressable, Text, View } from 'react-native';
2
+ import { useColors, useThemedStyles } from '../../../theme';
3
+ import { Icon } from '../Icon';
4
+ import { normalizeNonBlankText } from '../shared/accessibilityName';
5
+ import { useMenuMousePress } from './useMenuMousePress';
6
+ import { makeStyles } from './styles';
7
+ import type { ActionMenuItemProps } from './types';
8
+
9
+ export function ActionMenuItem({ action, onPress }: ActionMenuItemProps) {
10
+ const styles = useThemedStyles(makeStyles);
11
+ const colors = useColors();
12
+ const label = normalizeNonBlankText(action.label);
13
+ const busy = action.loading === true;
14
+ const disabled = action.disabled === true || busy || !label;
15
+ const { mousePressed, ...mouseHandlers } = useMenuMousePress(disabled);
16
+ const color = action.tone === 'danger' ? colors.error : colors.foreground;
17
+ return (
18
+ <Pressable
19
+ accessible={Boolean(label)}
20
+ accessibilityRole={label ? 'button' : undefined}
21
+ accessibilityLabel={label}
22
+ accessibilityHint={action.accessibilityHint}
23
+ accessibilityState={{ disabled, busy }}
24
+ disabled={disabled}
25
+ onPress={disabled ? undefined : onPress}
26
+ {...mouseHandlers}
27
+ style={({ pressed }) => [
28
+ styles.popoverRow,
29
+ (pressed || mousePressed) && styles.popoverRowPressed,
30
+ disabled && styles.popoverRowDisabled,
31
+ ]}
32
+ >
33
+ {action.icon || busy ? (
34
+ <View
35
+ style={styles.popoverIcon}
36
+ accessibilityElementsHidden
37
+ importantForAccessibility="no-hide-descendants"
38
+ >
39
+ {busy ? (
40
+ <ActivityIndicator size="small" color={colors.foregroundMuted} />
41
+ ) : action.icon ? (
42
+ <Icon name={action.icon} size={20} color={color} />
43
+ ) : null}
44
+ </View>
45
+ ) : null}
46
+ <Text
47
+ style={[
48
+ styles.popoverLabel,
49
+ action.tone === 'danger' && styles.popoverDanger,
50
+ ]}
51
+ >
52
+ {action.label}
53
+ </Text>
54
+ </Pressable>
55
+ );
56
+ }
@@ -0,0 +1,28 @@
1
+ import { Pressable } from 'react-native';
2
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
+ import { space, useThemedStyles } from '../../../theme';
4
+ import { makeStyles } from './styles';
5
+ import type { ActionMenuSheetCardProps } from './types';
6
+
7
+ export function ActionMenuSheetCard({
8
+ children,
9
+ contentStyle,
10
+ testID,
11
+ }: ActionMenuSheetCardProps) {
12
+ const styles = useThemedStyles(makeStyles);
13
+ const insets = useSafeAreaInsets();
14
+ return (
15
+ <Pressable
16
+ accessible={false}
17
+ testID={testID}
18
+ style={[
19
+ styles.sheetCard,
20
+ { paddingBottom: insets.bottom + space[5] },
21
+ contentStyle,
22
+ ]}
23
+ onPress={(event) => event.stopPropagation()}
24
+ >
25
+ {children}
26
+ </Pressable>
27
+ );
28
+ }