@planningcenter/chat-react-native 3.42.3-qa-856.0 → 3.42.3-qa-858.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 (33) hide show
  1. package/build/components/display/platform_modal_header_buttons.d.ts +28 -8
  2. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  3. package/build/components/display/platform_modal_header_buttons.js +86 -45
  4. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  5. package/build/components/primitive/form_sheet.js +2 -2
  6. package/build/components/primitive/form_sheet.js.map +1 -1
  7. package/build/navigation/index.d.ts +48 -51
  8. package/build/navigation/index.d.ts.map +1 -1
  9. package/build/navigation/index.js +38 -48
  10. package/build/navigation/index.js.map +1 -1
  11. package/build/screens/bug_report_screen.d.ts.map +1 -1
  12. package/build/screens/bug_report_screen.js +9 -3
  13. package/build/screens/bug_report_screen.js.map +1 -1
  14. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  15. package/build/screens/conversation_details_screen.js +2 -1
  16. package/build/screens/conversation_details_screen.js.map +1 -1
  17. package/build/screens/conversation_screen.d.ts.map +1 -1
  18. package/build/screens/conversation_screen.js +6 -2
  19. package/build/screens/conversation_screen.js.map +1 -1
  20. package/build/screens/message_report_screen.js +5 -3
  21. package/build/screens/message_report_screen.js.map +1 -1
  22. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  23. package/build/screens/notification_settings_screen.js +0 -2
  24. package/build/screens/notification_settings_screen.js.map +1 -1
  25. package/package.json +4 -3
  26. package/src/components/display/platform_modal_header_buttons.tsx +145 -77
  27. package/src/components/primitive/form_sheet.tsx +2 -2
  28. package/src/navigation/index.tsx +46 -53
  29. package/src/screens/bug_report_screen.tsx +9 -3
  30. package/src/screens/conversation_details_screen.tsx +2 -1
  31. package/src/screens/conversation_screen.tsx +7 -2
  32. package/src/screens/message_report_screen.tsx +5 -3
  33. package/src/screens/notification_settings_screen.tsx +1 -4
@@ -1,5 +1,6 @@
1
- import type { NativeStackHeaderLeftProps, NativeStackNavigationOptions } from '@react-navigation/native-stack';
1
+ import type { NativeStackNavigationOptions } from '@react-navigation/native-stack';
2
2
  import { ColorValue } from 'react-native';
3
+ import { type IconString } from './icon';
3
4
  interface HeaderTextButtonProps {
4
5
  onPress: () => void;
5
6
  title?: string;
@@ -20,22 +21,41 @@ interface TextButtonDecoratorProps {
20
21
  disabled?: boolean;
21
22
  }
22
23
  export declare const withRightText: ({ text, onPress, disabled }: TextButtonDecoratorProps) => OptionsDecorator;
23
- export declare const withLeftText: ({ text, onPress }: TextButtonDecoratorProps) => OptionsDecorator;
24
+ export declare const useHeaderSlotReserve: () => number;
25
+ export interface HeaderIconProps {
26
+ icon: IconString;
27
+ accessibilityLabel: string;
28
+ onPress: () => void;
29
+ disabled?: boolean;
30
+ prominent?: boolean;
31
+ tintColor?: ColorValue;
32
+ }
33
+ export declare const withRightIcon: (props: HeaderIconProps) => OptionsDecorator;
34
+ export declare const withLeftIcon: (props: HeaderIconProps) => OptionsDecorator;
24
35
  export declare const withRightClose: ({ onPress }: {
25
36
  onPress: () => void;
26
37
  }) => OptionsDecorator;
27
- export declare const createMinimalHeaderBackButton: ({ onPress }: {
38
+ export declare const withLeftClose: ({ onPress }: {
39
+ onPress: () => void;
40
+ }) => OptionsDecorator;
41
+ export declare const withRightDone: ({ onPress }: {
28
42
  onPress: () => void;
29
- }) => (props: NativeStackHeaderLeftProps) => import("react/jsx-runtime").JSX.Element;
43
+ }) => OptionsDecorator;
30
44
  export declare const withMinimalBack: ({ onPress }: {
31
45
  onPress: () => void;
32
46
  }) => OptionsDecorator;
33
- interface UseHeaderRightOptions {
34
- title: string;
47
+ type UseHeaderRightOptions = {
35
48
  onPress: () => void;
36
49
  disabled?: boolean;
37
50
  enabled?: boolean;
38
- }
39
- export declare const useHeaderRight: ({ title, onPress, disabled, enabled, }: UseHeaderRightOptions) => void;
51
+ } & ((Omit<HeaderIconProps, 'tintColor'> & {
52
+ title?: never;
53
+ }) | {
54
+ title: string;
55
+ icon?: never;
56
+ accessibilityLabel?: never;
57
+ prominent?: never;
58
+ });
59
+ export declare const useHeaderRight: (options: UseHeaderRightOptions) => void;
40
60
  export {};
41
61
  //# sourceMappingURL=platform_modal_header_buttons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAE1B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAA;AAM/D,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,GAAI,8BAI9B,qBAAqB,4CAavB,CAAA;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,yCAKjC,wBAAwB,4CAoB1B,CAAA;AAYD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,4BAA4B,KAClC,4BAA4B,CAAA;AAEjC,eAAO,MAAM,cAAc,GACzB,MAAM,4BAA4B,EAClC,GAAG,YAAY,gBAAgB,EAAE,KAChC,4BAAiG,CAAA;AAEpG,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAKD,eAAO,MAAM,aAAa,GACvB,6BAA6B,wBAAwB,KAAG,gBAKvD,CAAA;AAEJ,eAAO,MAAM,YAAY,GACtB,mBAAmB,wBAAwB,KAAG,gBAK7C,CAAA;AAeJ,eAAO,MAAM,cAAc,GACxB,aAAa;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,KAAG,gBAYtC,CAAA;AAWJ,eAAO,MAAM,6BAA6B,GACvC,aAAa;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,MACpC,OAAO,0BAA0B,4CAejC,CAAA;AAIH,eAAO,MAAM,eAAe,GACzB,aAAa;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,KAAG,gBAItC,CAAA;AAEJ,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAID,eAAO,MAAM,cAAc,GAAI,wCAK5B,qBAAqB,SAWvB,CAAA"}
1
+ {"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAA;AAI/D,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAA;AAG9C,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,GAAI,8BAI9B,qBAAqB,4CAavB,CAAA;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,yCAKjC,wBAAwB,4CAoB1B,CAAA;AAQD,MAAM,MAAM,g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,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,CACA,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GACxD;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,CACjF,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,SAAS,qBAAqB,SA2B5D,CAAA"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { HeaderBackButton, HeaderButton } from '@react-navigation/elements';
2
+ import { HeaderBackButton, HeaderButton, PlatformPressable } from '@react-navigation/elements';
3
3
  import { useNavigation } from '@react-navigation/native';
4
4
  import { useLayoutEffect } from 'react';
5
5
  import { Platform, StyleSheet } from 'react-native';
6
- import { useTheme } from '../../hooks';
7
- import { isLiquidGlassEnabled } from '../../utils/liquid_glass';
6
+ import { useFontScale, useTheme } from '../../hooks';
7
+ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils';
8
8
  import { Icon } from './icon';
9
9
  import { TextButton } from './text_button';
10
10
  export const HeaderTextButton = ({ onPress, title = 'Submit', ...props }) => {
@@ -19,67 +19,108 @@ export const HeaderDismissButton = ({ onPress, title = 'Cancel', tintColor, ...p
19
19
  });
20
20
  };
21
21
  const createTextHeaderRight = ({ onPress, title, disabled }) => (props) => (_jsx(HeaderTextButton, { ...props, onPress: onPress, title: title, disabled: disabled }));
22
- const createDismissHeaderLeft = ({ onPress, title }) => () => _jsx(HeaderDismissButton, { title: title, onPress: onPress });
23
22
  export const composeOptions = (base, ...decorators) => decorators.reduce((options, decorate) => decorate(options), base);
24
- // Native bar items pick up liquid glass on iOS 26; hosts on an older
25
- // react-navigation ignore the unstable option and keep using the
26
- // headerRight/headerLeft fallbacks, as does Android.
27
23
  export const withRightText = ({ text, onPress, disabled }) => options => ({
28
24
  ...options,
29
25
  headerRight: createTextHeaderRight({ onPress, title: text, disabled }),
30
26
  unstable_headerRightItems: () => [{ type: 'button', label: text, onPress, disabled }],
31
27
  });
32
- export const withLeftText = ({ text, onPress }) => options => ({
28
+ const HEADER_ICON_SIZE = 17;
29
+ const HEADER_GLASS_BUTTON_SIZE = 44;
30
+ const HEADER_BAR_INSET = 16;
31
+ const HEADER_SLOT_GAP = 12;
32
+ export const useHeaderSlotReserve = () => {
33
+ const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER_LANDMARK });
34
+ return HEADER_BAR_INSET + HEADER_GLASS_BUTTON_SIZE * fontScale + HEADER_SLOT_GAP;
35
+ };
36
+ const HEADER_FALLBACK_HIT_SLOP = 14;
37
+ const iconStyles = StyleSheet.create({
38
+ disabled: {
39
+ opacity: 0.4,
40
+ },
41
+ fallbackButton: {
42
+ alignItems: 'center',
43
+ justifyContent: 'center',
44
+ paddingHorizontal: 8,
45
+ },
46
+ fallbackButtonLeft: {
47
+ marginRight: Platform.select({ android: 16, default: 0 }),
48
+ },
49
+ });
50
+ const SF_SYMBOL_NAMES = {
51
+ 'general.x': 'xmark',
52
+ 'general.check': 'checkmark',
53
+ 'general.upArrow': 'arrow.up',
54
+ 'general.leftChevron': 'chevron.left',
55
+ };
56
+ const sfSymbolFor = (icon) => {
57
+ const name = SF_SYMBOL_NAMES[icon];
58
+ if (!name)
59
+ throw new Error(`No SF Symbol mapped for icon "${icon}" — add one to SF_SYMBOL_NAMES.`);
60
+ return name;
61
+ };
62
+ const createHeaderIconItem = ({ icon, accessibilityLabel, onPress, disabled, prominent, tintColor, }) => ({
63
+ type: 'button',
64
+ label: '',
65
+ accessibilityLabel,
66
+ onPress,
67
+ disabled,
68
+ icon: { type: 'sfSymbol', name: sfSymbolFor(icon) },
69
+ ...(prominent ? { variant: 'prominent', tintColor } : {}),
70
+ });
71
+ const createHeaderIconElement = (position) => ({ icon, accessibilityLabel, onPress, disabled, tintColor }) => () => (_jsx(PlatformPressable, { onPress: onPress, disabled: disabled, hitSlop: HEADER_FALLBACK_HIT_SLOP, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, style: [
72
+ iconStyles.fallbackButton,
73
+ position === 'left' && iconStyles.fallbackButtonLeft,
74
+ disabled && iconStyles.disabled,
75
+ ], children: _jsx(Icon, { name: icon, size: HEADER_ICON_SIZE, color: tintColor }) }));
76
+ export const withRightIcon = (props) => options => ({
33
77
  ...options,
34
- headerLeft: createDismissHeaderLeft({ title: text, onPress }),
35
- unstable_headerLeftItems: () => [{ type: 'button', label: text, onPress }],
78
+ headerRight: createHeaderIconElement('right')(props),
79
+ unstable_headerRightItems: () => [createHeaderIconItem(props)],
36
80
  });
37
- const renderCloseImage = ({ tintColor }) => (_jsx(Icon, { name: "general.x", size: 18, color: tintColor }));
38
- const createCloseHeaderRight = ({ onPress }) => (props) => (_jsx(HeaderBackButton, { backImage: renderCloseImage, onPress: onPress, ...props }));
39
- // The native slot takes only SF Symbols or bundled rasters — we have no way
40
- // to systematize rasterizing our SVG icon library, and xmark matches
41
- // general.x closely. The fallback keeps our icon.
42
- export const withRightClose = ({ onPress }) => options => ({
81
+ export const withLeftIcon = (props) => options => ({
43
82
  ...options,
44
- headerRight: createCloseHeaderRight({ onPress }),
45
- unstable_headerRightItems: () => [
46
- {
47
- type: 'button',
48
- label: 'Close',
49
- icon: { type: 'sfSymbol', name: 'xmark' },
50
- onPress,
51
- },
52
- ],
83
+ headerLeft: createHeaderIconElement('left')(props),
84
+ unstable_headerLeftItems: () => [createHeaderIconItem(props)],
53
85
  });
54
- // The default back icon reserves trailing space for a label that
55
- // displayMode="minimal" never shows; a custom image skips it so the glass
56
- // capsule hugs the glyph.
57
- const renderGlassBackImage = ({ tintColor }) => (_jsx(Icon, { name: "general.leftChevron", size: 18, color: tintColor }));
58
- // The iOS 26 glass capsule manages its own insets — negative margins clip
59
- // the button against the capsule edge.
60
- export const createMinimalHeaderBackButton = ({ onPress }) => (props) => (_jsx(HeaderBackButton, { style: isLiquidGlassEnabled()
61
- ? undefined
62
- : {
63
- marginLeft: Platform.select({ ios: -8, default: -3 }),
64
- marginRight: Platform.select({ ios: 0, default: 30 }),
65
- }, backImage: isLiquidGlassEnabled() ? renderGlassBackImage : undefined, displayMode: "minimal", onPress: onPress, ...props }));
66
- // Under glass the native minimal back button suffices; pre-26 needs the
67
- // custom button and its layout nudges.
86
+ export const withRightClose = ({ onPress }) => withRightIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress });
87
+ export const withLeftClose = ({ onPress }) => withLeftIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress });
88
+ export const withRightDone = ({ onPress }) => withRightIcon({ icon: 'general.check', accessibilityLabel: 'Done', onPress });
89
+ const createMinimalHeaderBackElement = ({ onPress }) => (props) => (_jsx(HeaderBackButton, { style: Platform.select({
90
+ ios: { marginLeft: -8 },
91
+ default: { marginLeft: -3, marginRight: 30 },
92
+ }), displayMode: "minimal", onPress: onPress, ...props }));
68
93
  export const withMinimalBack = ({ onPress }) => options => ({
69
94
  ...options,
70
- ...(isLiquidGlassEnabled() ? {} : { headerLeft: createMinimalHeaderBackButton({ onPress }) }),
95
+ headerLeft: createMinimalHeaderBackElement({ onPress }),
96
+ unstable_headerLeftItems: () => [
97
+ createHeaderIconItem({ icon: 'general.leftChevron', accessibilityLabel: 'Back', onPress }),
98
+ ],
71
99
  });
72
- // For screens whose header button depends on live state (form validity,
73
- // mutation callbacks). Static buttons belong in the navigator options.
74
- export const useHeaderRight = ({ title, onPress, disabled, enabled = true, }) => {
100
+ export const useHeaderRight = (options) => {
75
101
  const navigation = useNavigation();
102
+ const { colors } = useTheme();
103
+ const { onPress, disabled, enabled = true } = options;
104
+ const icon = options.icon;
105
+ const label = options.icon !== undefined ? options.accessibilityLabel : options.title;
106
+ const prominent = options.icon !== undefined ? options.prominent : undefined;
76
107
  useLayoutEffect(() => {
77
108
  if (!enabled) {
78
109
  navigation.setOptions({ headerRight: () => null, unstable_headerRightItems: undefined });
79
110
  return;
80
111
  }
81
- navigation.setOptions(withRightText({ text: title, onPress, disabled })({}));
82
- }, [disabled, enabled, navigation, onPress, title]);
112
+ const decorate = icon
113
+ ? withRightIcon({
114
+ icon,
115
+ accessibilityLabel: label,
116
+ onPress,
117
+ disabled,
118
+ prominent,
119
+ tintColor: prominent ? colors.interaction : undefined,
120
+ })
121
+ : withRightText({ text: label, onPress, disabled });
122
+ navigation.setOptions(decorate({}));
123
+ }, [colors.interaction, disabled, enabled, icon, label, navigation, onPress, prominent]);
83
124
  };
84
125
  const useStyles = () => {
85
126
  const { colors } = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAMxD,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACc,EAAE,EAAE;IAC1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,KAAC,UAAU,IACT,qBAAqB,EAAE,CAAC,EACxB,OAAO,EAAE,OAAO,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E,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,MAAM,CAAC,6BAA6B;gBACzC,OAAO,EAAE,MAAM,CAAC,iCAAiC;aAClD,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderBackButton, HeaderButton } from '@react-navigation/elements'\nimport { useNavigation } from '@react-navigation/native'\nimport type {\n NativeStackHeaderLeftProps,\n NativeStackHeaderRightProps,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack'\nimport { useLayoutEffect } from 'react'\nimport { ColorValue, Platform, StyleSheet } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { isLiquidGlassEnabled } from '../../utils/liquid_glass'\nimport { Icon } from './icon'\nimport { TextButton } from './text_button'\n\ninterface HeaderTextButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderTextButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderTextButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderDismissButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderDismissButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderDismissButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\nconst createTextHeaderRight =\n ({ onPress, title, disabled }: HeaderTextButtonProps) =>\n (props: NativeStackHeaderRightProps) => (\n <HeaderTextButton {...props} onPress={onPress} title={title} disabled={disabled} />\n )\n\nconst createDismissHeaderLeft =\n ({ onPress, title }: { onPress: () => void; title: string }) =>\n () => <HeaderDismissButton title={title} onPress={onPress} />\n\nexport type OptionsDecorator = (\n options: NativeStackNavigationOptions\n) => NativeStackNavigationOptions\n\nexport const composeOptions = (\n base: NativeStackNavigationOptions,\n ...decorators: OptionsDecorator[]\n): NativeStackNavigationOptions => decorators.reduce((options, decorate) => decorate(options), base)\n\ninterface TextButtonDecoratorProps {\n text: string\n onPress: () => void\n disabled?: boolean\n}\n\n// Native bar items pick up liquid glass on iOS 26; hosts on an older\n// react-navigation ignore the unstable option and keep using the\n// headerRight/headerLeft fallbacks, as does Android.\nexport const withRightText =\n ({ text, onPress, disabled }: TextButtonDecoratorProps): OptionsDecorator =>\n options => ({\n ...options,\n headerRight: createTextHeaderRight({ onPress, title: text, disabled }),\n unstable_headerRightItems: () => [{ type: 'button' as const, label: text, onPress, disabled }],\n })\n\nexport const withLeftText =\n ({ text, onPress }: TextButtonDecoratorProps): OptionsDecorator =>\n options => ({\n ...options,\n headerLeft: createDismissHeaderLeft({ title: text, onPress }),\n unstable_headerLeftItems: () => [{ type: 'button' as const, label: text, onPress }],\n })\n\nconst renderCloseImage = ({ tintColor }: { tintColor: string }) => (\n <Icon name=\"general.x\" size={18} color={tintColor} />\n)\n\nconst createCloseHeaderRight =\n ({ onPress }: { onPress: () => void }) =>\n (props: NativeStackHeaderRightProps) => (\n <HeaderBackButton backImage={renderCloseImage} onPress={onPress} {...props} />\n )\n\n// The native slot takes only SF Symbols or bundled rasters — we have no way\n// to systematize rasterizing our SVG icon library, and xmark matches\n// general.x closely. The fallback keeps our icon.\nexport const withRightClose =\n ({ onPress }: { onPress: () => void }): OptionsDecorator =>\n options => ({\n ...options,\n headerRight: createCloseHeaderRight({ onPress }),\n unstable_headerRightItems: () => [\n {\n type: 'button' as const,\n label: 'Close',\n icon: { type: 'sfSymbol' as const, name: 'xmark' as const },\n onPress,\n },\n ],\n })\n\n// The default back icon reserves trailing space for a label that\n// displayMode=\"minimal\" never shows; a custom image skips it so the glass\n// capsule hugs the glyph.\nconst renderGlassBackImage = ({ tintColor }: { tintColor: string }) => (\n <Icon name=\"general.leftChevron\" size={18} color={tintColor} />\n)\n\n// The iOS 26 glass capsule manages its own insets — negative margins clip\n// the button against the capsule edge.\nexport const createMinimalHeaderBackButton =\n ({ onPress }: { onPress: () => void }) =>\n (props: NativeStackHeaderLeftProps) => (\n <HeaderBackButton\n style={\n isLiquidGlassEnabled()\n ? undefined\n : {\n marginLeft: Platform.select({ ios: -8, default: -3 }),\n marginRight: Platform.select({ ios: 0, default: 30 }),\n }\n }\n backImage={isLiquidGlassEnabled() ? renderGlassBackImage : undefined}\n displayMode=\"minimal\"\n onPress={onPress}\n {...props}\n />\n )\n\n// Under glass the native minimal back button suffices; pre-26 needs the\n// custom button and its layout nudges.\nexport const withMinimalBack =\n ({ onPress }: { onPress: () => void }): OptionsDecorator =>\n options => ({\n ...options,\n ...(isLiquidGlassEnabled() ? {} : { headerLeft: createMinimalHeaderBackButton({ onPress }) }),\n })\n\ninterface UseHeaderRightOptions {\n title: string\n onPress: () => void\n disabled?: boolean\n enabled?: boolean\n}\n\n// For screens whose header button depends on live state (form validity,\n// mutation callbacks). Static buttons belong in the navigator options.\nexport const useHeaderRight = ({\n title,\n onPress,\n disabled,\n enabled = true,\n}: UseHeaderRightOptions) => {\n const navigation = useNavigation()\n\n useLayoutEffect(() => {\n if (!enabled) {\n navigation.setOptions({ headerRight: () => null, unstable_headerRightItems: undefined })\n return\n }\n\n navigation.setOptions(withRightText({ text: title, onPress, disabled })({}))\n }, [disabled, enabled, navigation, onPress, title])\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: colors.iOSModalHeaderButtonTextColor,\n android: colors.androidModalHeaderButtonTextColor,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAKxD,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE/D,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAmB,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACc,EAAE,EAAE;IAC1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,KAAC,UAAU,IACT,qBAAqB,EAAE,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,KACxE,KAAK,YAER,KAAK,G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WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC,CAAA;YACxF,OAAM;QACR,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI;YACnB,CAAC,CAAC,aAAa,CAAC;gBACZ,IAAI;gBACJ,kBAAkB,EAAE,KAAK;gBACzB,OAAO;gBACP,QAAQ;gBACR,SAAS;gBACT,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;aACtD,CAAC;YACJ,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;QAErD,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;AAC1F,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,MAAM,CAAC,6BAA6B;gBACzC,OAAO,EAAE,MAAM,CAAC,iCAAiC;aAClD,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderBackButton, HeaderButton, PlatformPressable } from '@react-navigation/elements'\nimport { useNavigation } from '@react-navigation/native'\nimport type {\n NativeStackHeaderItemProps,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack'\nimport { useLayoutEffect } from 'react'\nimport { ColorValue, Platform, StyleSheet } from 'react-native'\nimport type { SFSymbol } from 'sf-symbols-typescript'\nimport { useFontScale, useTheme } from '../../hooks'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport { Icon, type IconString } from './icon'\nimport { TextButton } from './text_button'\n\ninterface HeaderTextButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderTextButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderTextButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderDismissButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderDismissButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderDismissButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\nconst createTextHeaderRight =\n ({ onPress, title, disabled }: HeaderTextButtonProps) =>\n (props: NativeStackHeaderItemProps) => (\n <HeaderTextButton {...props} onPress={onPress} title={title} disabled={disabled} />\n )\n\nexport type OptionsDecorator = (\n options: NativeStackNavigationOptions\n) => NativeStackNavigationOptions\n\nexport const composeOptions = (\n base: NativeStackNavigationOptions,\n ...decorators: OptionsDecorator[]\n): NativeStackNavigationOptions => decorators.reduce((options, decorate) => decorate(options), base)\n\ninterface TextButtonDecoratorProps {\n text: string\n onPress: () => void\n disabled?: boolean\n}\n\nexport const withRightText =\n ({ text, onPress, disabled }: TextButtonDecoratorProps): OptionsDecorator =>\n options => ({\n ...options,\n headerRight: createTextHeaderRight({ onPress, title: text, disabled }),\n unstable_headerRightItems: () => [{ type: 'button' as const, label: text, onPress, disabled }],\n })\n\nconst HEADER_ICON_SIZE = 17\nconst HEADER_GLASS_BUTTON_SIZE = 44\nconst HEADER_BAR_INSET = 16\nconst HEADER_SLOT_GAP = 12\n\nexport const useHeaderSlotReserve = (): number => {\n const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER_LANDMARK })\n\n return HEADER_BAR_INSET + HEADER_GLASS_BUTTON_SIZE * fontScale + HEADER_SLOT_GAP\n}\n\nconst HEADER_FALLBACK_HIT_SLOP = 14\n\nconst iconStyles = StyleSheet.create({\n disabled: {\n opacity: 0.4,\n },\n fallbackButton: {\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 8,\n },\n fallbackButtonLeft: {\n marginRight: Platform.select({ android: 16, default: 0 }),\n },\n})\n\nconst SF_SYMBOL_NAMES: Partial<Record<IconString, SFSymbol>> = {\n 'general.x': 'xmark',\n 'general.check': 'checkmark',\n 'general.upArrow': 'arrow.up',\n 'general.leftChevron': 'chevron.left',\n}\n\nconst sfSymbolFor = (icon: IconString): SFSymbol => {\n const name = SF_SYMBOL_NAMES[icon]\n\n if (!name) throw new Error(`No SF Symbol mapped for icon \"${icon}\" — add one to SF_SYMBOL_NAMES.`)\n\n return name\n}\n\nexport interface HeaderIconProps {\n icon: IconString\n accessibilityLabel: string\n onPress: () => void\n disabled?: boolean\n prominent?: boolean\n tintColor?: ColorValue\n}\n\nconst createHeaderIconItem = ({\n icon,\n accessibilityLabel,\n onPress,\n disabled,\n prominent,\n tintColor,\n}: HeaderIconProps) => ({\n type: 'button' as const,\n label: '',\n accessibilityLabel,\n onPress,\n disabled,\n icon: { type: 'sfSymbol' as const, name: sfSymbolFor(icon) },\n ...(prominent ? { variant: 'prominent' as const, tintColor } : {}),\n})\n\nconst createHeaderIconElement =\n (position: 'left' | 'right') =>\n ({ icon, accessibilityLabel, onPress, disabled, tintColor }: HeaderIconProps) =>\n () => (\n <PlatformPressable\n onPress={onPress}\n disabled={disabled}\n hitSlop={HEADER_FALLBACK_HIT_SLOP}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n style={[\n iconStyles.fallbackButton,\n position === 'left' && iconStyles.fallbackButtonLeft,\n disabled && iconStyles.disabled,\n ]}\n >\n <Icon name={icon} size={HEADER_ICON_SIZE} color={tintColor} />\n </PlatformPressable>\n )\n\nexport const withRightIcon =\n (props: HeaderIconProps): OptionsDecorator =>\n options => ({\n ...options,\n headerRight: createHeaderIconElement('right')(props),\n unstable_headerRightItems: () => [createHeaderIconItem(props)],\n })\n\nexport const withLeftIcon =\n (props: HeaderIconProps): OptionsDecorator =>\n options => ({\n ...options,\n headerLeft: createHeaderIconElement('left')(props),\n unstable_headerLeftItems: () => [createHeaderIconItem(props)],\n })\n\nexport const withRightClose = ({ onPress }: { onPress: () => void }) =>\n withRightIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress })\n\nexport const withLeftClose = ({ onPress }: { onPress: () => void }) =>\n withLeftIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress })\n\nexport const withRightDone = ({ onPress }: { onPress: () => void }) =>\n withRightIcon({ icon: 'general.check', accessibilityLabel: 'Done', onPress })\n\nconst createMinimalHeaderBackElement =\n ({ onPress }: { onPress: () => void }) =>\n (props: NativeStackHeaderItemProps) => (\n <HeaderBackButton\n style={Platform.select({\n ios: { marginLeft: -8 },\n default: { marginLeft: -3, marginRight: 30 },\n })}\n displayMode=\"minimal\"\n onPress={onPress}\n {...props}\n />\n )\n\nexport const withMinimalBack =\n ({ onPress }: { onPress: () => void }): OptionsDecorator =>\n options => ({\n ...options,\n headerLeft: createMinimalHeaderBackElement({ onPress }),\n unstable_headerLeftItems: () => [\n createHeaderIconItem({ icon: 'general.leftChevron', accessibilityLabel: 'Back', onPress }),\n ],\n })\n\ntype UseHeaderRightOptions = {\n onPress: () => void\n disabled?: boolean\n enabled?: boolean\n} & (\n | (Omit<HeaderIconProps, 'tintColor'> & { title?: never })\n | { title: string; icon?: never; accessibilityLabel?: never; prominent?: never }\n)\n\nexport const useHeaderRight = (options: UseHeaderRightOptions) => {\n const navigation = useNavigation()\n const { colors } = useTheme()\n const { onPress, disabled, enabled = true } = options\n const icon = options.icon\n const label = options.icon !== undefined ? options.accessibilityLabel : options.title\n const prominent = options.icon !== undefined ? options.prominent : undefined\n\n useLayoutEffect(() => {\n if (!enabled) {\n navigation.setOptions({ headerRight: () => null, unstable_headerRightItems: undefined })\n return\n }\n\n const decorate = icon\n ? withRightIcon({\n icon,\n accessibilityLabel: label,\n onPress,\n disabled,\n prominent,\n tintColor: prominent ? colors.interaction : undefined,\n })\n : withRightText({ text: label, onPress, disabled })\n\n navigation.setOptions(decorate({}))\n }, [colors.interaction, disabled, enabled, icon, label, navigation, onPress, prominent])\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: colors.iOSModalHeaderButtonTextColor,\n android: colors.androidModalHeaderButtonTextColor,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
@@ -3,7 +3,7 @@ import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements';
3
3
  import { Platform, StyleSheet, View, useWindowDimensions, } from 'react-native';
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
  import { useTheme } from '../../hooks';
6
- import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils';
6
+ import { isLiquidGlassEnabled, MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils';
7
7
  import { Button, Heading, Icon, Text, TextButton } from '../display';
8
8
  // =================================
9
9
  // ====== Exports ==================
@@ -19,7 +19,7 @@ export const getFormSheetScreenOptions = ({ headerTitle, sheetAllowedDetents = [
19
19
  presentation: 'formSheet',
20
20
  headerShown: false,
21
21
  sheetAllowedDetents,
22
- sheetCornerRadius: 16,
22
+ sheetCornerRadius: isLiquidGlassEnabled() ? undefined : 16,
23
23
  sheetGrabberVisible: true,
24
24
  headerTitle,
25
25
  ...rest,
@@ -1 +1 @@
1
- {"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG/E,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEhF,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB;IACnB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,IAAI;IACzB,WAAW;IACX,GAAG,IAAI;CACR,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE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A2B;YACnD,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SAC9F;QACD,eAAe,EAAE;YACf,IAAI,EAAE,CAAC;SACR;QACD,WAAW,EAAE;YACX,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SAC9F;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,wBAAwB;YACtC,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName?: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n disabledReason?: string\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n disabledReason,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance, disabled })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={\n accessibilityHint ?? (disabled && disabledReason ? disabledReason : undefined)\n }\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n {iconName && (\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n )}\n <View style={styles.actionTextBlock}>\n <Text style={styles.actionTitle}>{title}</Text>\n {disabled && disabledReason && (\n <Text style={styles.actionDisabledReason}>{disabledReason}</Text>\n )}\n </View>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nconst useStyles = ({ appearance = 'neutral', disabled = false }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].iconColor,\n },\n actionTextBlock: {\n flex: 1,\n },\n actionTitle: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].textColor,\n },\n actionDisabledReason: {\n color: colors.textColorDefaultDisabled,\n fontSize: 12,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG/E,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAErF,OAAO,EAAE,MAAM,EAA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9F;QACD,eAAe,EAAE;YACf,IAAI,EAAE,CAAC;SACR;QACD,WAAW,EAAE;YACX,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SAC9F;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,wBAAwB;YACtC,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { isLiquidGlassEnabled, MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: isLiquidGlassEnabled() ? undefined : 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName?: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n disabledReason?: string\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n disabledReason,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance, disabled })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={\n accessibilityHint ?? (disabled && disabledReason ? disabledReason : undefined)\n }\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n {iconName && (\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n )}\n <View style={styles.actionTextBlock}>\n <Text style={styles.actionTitle}>{title}</Text>\n {disabled && disabledReason && (\n <Text style={styles.actionDisabledReason}>{disabledReason}</Text>\n )}\n </View>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nconst useStyles = ({ appearance = 'neutral', disabled = false }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].iconColor,\n },\n actionTextBlock: {\n flex: 1,\n },\n actionTitle: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].textColor,\n },\n actionDisabledReason: {\n color: colors.textColorDefaultDisabled,\n fontSize: 12,\n },\n })\n}\n"]}