@metamask-previews/design-system-react-native 0.46.0-preview.fa32350 → 0.51.0-preview.01bfd7c

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 (133) hide show
  1. package/CHANGELOG.md +89 -1
  2. package/dist/components/AvatarBase/AvatarBase.constants.cjs +1 -1
  3. package/dist/components/AvatarBase/AvatarBase.constants.cjs.map +1 -1
  4. package/dist/components/AvatarBase/AvatarBase.constants.mjs +1 -1
  5. package/dist/components/AvatarBase/AvatarBase.constants.mjs.map +1 -1
  6. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs +1 -1
  7. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs.map +1 -1
  8. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs +1 -1
  9. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs.map +1 -1
  10. package/dist/components/ButtonBase/ButtonBase.cjs +2 -4
  11. package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
  12. package/dist/components/ButtonBase/ButtonBase.constants.cjs +9 -14
  13. package/dist/components/ButtonBase/ButtonBase.constants.cjs.map +1 -1
  14. package/dist/components/ButtonBase/ButtonBase.constants.d.cts +1 -3
  15. package/dist/components/ButtonBase/ButtonBase.constants.d.cts.map +1 -1
  16. package/dist/components/ButtonBase/ButtonBase.constants.d.mts +1 -3
  17. package/dist/components/ButtonBase/ButtonBase.constants.d.mts.map +1 -1
  18. package/dist/components/ButtonBase/ButtonBase.constants.mjs +8 -12
  19. package/dist/components/ButtonBase/ButtonBase.constants.mjs.map +1 -1
  20. package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
  21. package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
  22. package/dist/components/ButtonBase/ButtonBase.mjs +3 -5
  23. package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
  24. package/dist/components/ButtonFilter/ButtonFilter.cjs +14 -2
  25. package/dist/components/ButtonFilter/ButtonFilter.cjs.map +1 -1
  26. package/dist/components/ButtonFilter/ButtonFilter.d.cts +11 -0
  27. package/dist/components/ButtonFilter/ButtonFilter.d.cts.map +1 -1
  28. package/dist/components/ButtonFilter/ButtonFilter.d.mts +11 -0
  29. package/dist/components/ButtonFilter/ButtonFilter.d.mts.map +1 -1
  30. package/dist/components/ButtonFilter/ButtonFilter.mjs +14 -2
  31. package/dist/components/ButtonFilter/ButtonFilter.mjs.map +1 -1
  32. package/dist/components/ButtonHero/ButtonHero.cjs +3 -0
  33. package/dist/components/ButtonHero/ButtonHero.cjs.map +1 -1
  34. package/dist/components/ButtonHero/ButtonHero.d.cts +3 -0
  35. package/dist/components/ButtonHero/ButtonHero.d.cts.map +1 -1
  36. package/dist/components/ButtonHero/ButtonHero.d.mts +3 -0
  37. package/dist/components/ButtonHero/ButtonHero.d.mts.map +1 -1
  38. package/dist/components/ButtonHero/ButtonHero.mjs +3 -0
  39. package/dist/components/ButtonHero/ButtonHero.mjs.map +1 -1
  40. package/dist/components/ButtonIcon/ButtonIcon.cjs +1 -2
  41. package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
  42. package/dist/components/ButtonIcon/ButtonIcon.d.cts.map +1 -1
  43. package/dist/components/ButtonIcon/ButtonIcon.d.mts.map +1 -1
  44. package/dist/components/ButtonIcon/ButtonIcon.mjs +1 -2
  45. package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
  46. package/dist/components/Card/Card.cjs +15 -9
  47. package/dist/components/Card/Card.cjs.map +1 -1
  48. package/dist/components/Card/Card.d.cts +1 -1
  49. package/dist/components/Card/Card.d.cts.map +1 -1
  50. package/dist/components/Card/Card.d.mts +1 -1
  51. package/dist/components/Card/Card.d.mts.map +1 -1
  52. package/dist/components/Card/Card.mjs +16 -10
  53. package/dist/components/Card/Card.mjs.map +1 -1
  54. package/dist/components/Card/Card.types.cjs.map +1 -1
  55. package/dist/components/Card/Card.types.d.cts +11 -18
  56. package/dist/components/Card/Card.types.d.cts.map +1 -1
  57. package/dist/components/Card/Card.types.d.mts +11 -18
  58. package/dist/components/Card/Card.types.d.mts.map +1 -1
  59. package/dist/components/Card/Card.types.mjs.map +1 -1
  60. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  61. package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
  62. package/dist/components/Checkbox/Checkbox.mjs +1 -1
  63. package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
  64. package/dist/components/HeaderBase/HeaderBase.cjs +7 -7
  65. package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -1
  66. package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -1
  67. package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -1
  68. package/dist/components/HeaderBase/HeaderBase.mjs +7 -7
  69. package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -1
  70. package/dist/components/HeaderSubpage/HeaderSubpage.types.cjs.map +1 -1
  71. package/dist/components/HeaderSubpage/HeaderSubpage.types.d.cts +2 -22
  72. package/dist/components/HeaderSubpage/HeaderSubpage.types.d.cts.map +1 -1
  73. package/dist/components/HeaderSubpage/HeaderSubpage.types.d.mts +2 -22
  74. package/dist/components/HeaderSubpage/HeaderSubpage.types.d.mts.map +1 -1
  75. package/dist/components/HeaderSubpage/HeaderSubpage.types.mjs.map +1 -1
  76. package/dist/components/Icon/Icon.assets.cjs +8 -0
  77. package/dist/components/Icon/Icon.assets.cjs.map +1 -1
  78. package/dist/components/Icon/Icon.assets.d.cts.map +1 -1
  79. package/dist/components/Icon/Icon.assets.d.mts.map +1 -1
  80. package/dist/components/Icon/Icon.assets.mjs +8 -0
  81. package/dist/components/Icon/Icon.assets.mjs.map +1 -1
  82. package/dist/components/Icon/assets/arrow-square-out.svg +1 -0
  83. package/dist/components/Icon/assets/clipboard.svg +1 -0
  84. package/dist/components/Icon/assets/copy-success.svg +1 -1
  85. package/dist/components/Icon/assets/infinity.svg +5 -0
  86. package/dist/components/Icon/assets/list-arrow.svg +1 -1
  87. package/dist/components/Icon/assets/more-vertical.svg +1 -1
  88. package/dist/components/Icon/assets/people-filled.svg +5 -0
  89. package/dist/components/KeyValueSelect/KeyValueSelect.cjs +1 -1
  90. package/dist/components/KeyValueSelect/KeyValueSelect.cjs.map +1 -1
  91. package/dist/components/KeyValueSelect/KeyValueSelect.mjs +1 -1
  92. package/dist/components/KeyValueSelect/KeyValueSelect.mjs.map +1 -1
  93. package/dist/components/MainActionButton/MainActionButton.cjs +1 -1
  94. package/dist/components/MainActionButton/MainActionButton.cjs.map +1 -1
  95. package/dist/components/MainActionButton/MainActionButton.mjs +1 -1
  96. package/dist/components/MainActionButton/MainActionButton.mjs.map +1 -1
  97. package/dist/components/SectionHeader/SectionHeader.cjs +2 -2
  98. package/dist/components/SectionHeader/SectionHeader.cjs.map +1 -1
  99. package/dist/components/SectionHeader/SectionHeader.mjs +2 -2
  100. package/dist/components/SectionHeader/SectionHeader.mjs.map +1 -1
  101. package/dist/components/SegmentedControl/SegmentedControl.cjs +1 -2
  102. package/dist/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
  103. package/dist/components/SegmentedControl/SegmentedControl.d.cts.map +1 -1
  104. package/dist/components/SegmentedControl/SegmentedControl.d.mts.map +1 -1
  105. package/dist/components/SegmentedControl/SegmentedControl.mjs +1 -2
  106. package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  107. package/dist/components/SelectButton/SelectButton.cjs +18 -4
  108. package/dist/components/SelectButton/SelectButton.cjs.map +1 -1
  109. package/dist/components/SelectButton/SelectButton.d.cts +1 -1
  110. package/dist/components/SelectButton/SelectButton.d.cts.map +1 -1
  111. package/dist/components/SelectButton/SelectButton.d.mts +1 -1
  112. package/dist/components/SelectButton/SelectButton.d.mts.map +1 -1
  113. package/dist/components/SelectButton/SelectButton.mjs +19 -5
  114. package/dist/components/SelectButton/SelectButton.mjs.map +1 -1
  115. package/dist/components/TextArea/TextArea.d.cts +2 -2
  116. package/dist/components/TextArea/TextArea.d.mts +2 -2
  117. package/dist/components/TextField/TextField.cjs +1 -1
  118. package/dist/components/TextField/TextField.cjs.map +1 -1
  119. package/dist/components/TextField/TextField.d.cts +2 -2
  120. package/dist/components/TextField/TextField.d.mts +2 -2
  121. package/dist/components/TextField/TextField.mjs +1 -1
  122. package/dist/components/TextField/TextField.mjs.map +1 -1
  123. package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +2 -2
  124. package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +2 -2
  125. package/package.json +20 -19
  126. package/dist/components/SegmentedControl/SegmentedControl.constants.cjs +0 -12
  127. package/dist/components/SegmentedControl/SegmentedControl.constants.cjs.map +0 -1
  128. package/dist/components/SegmentedControl/SegmentedControl.constants.d.cts +0 -4
  129. package/dist/components/SegmentedControl/SegmentedControl.constants.d.cts.map +0 -1
  130. package/dist/components/SegmentedControl/SegmentedControl.constants.d.mts +0 -4
  131. package/dist/components/SegmentedControl/SegmentedControl.constants.d.mts.map +0 -1
  132. package/dist/components/SegmentedControl/SegmentedControl.constants.mjs +0 -8
  133. package/dist/components/SegmentedControl/SegmentedControl.constants.mjs.map +0 -1
@@ -1,25 +1,18 @@
1
1
  import type { ReactNode } from "react";
2
- import type { TouchableOpacityProps } from "react-native";
2
+ import type { PressableProps, ViewProps } from "react-native";
3
3
  /**
4
4
  * Card component props.
5
+ *
6
+ * When `isInteractive` is `false` (default), the root is a `View`.
7
+ * When `true`, the root is a `Pressable` and all `PressableProps` are available.
5
8
  */
6
- export type CardProps = {
7
- /**
8
- * Content to display inside the card.
9
- */
9
+ export type CardProps = ({
10
10
  children: ReactNode;
11
- /**
12
- * Optional callback when the card is pressed.
13
- * When provided, the card wraps content in a TouchableOpacity.
14
- */
15
- onPress?: () => void;
16
- /**
17
- * Optional prop to add twrnc overriding classNames.
18
- */
19
11
  twClassName?: string;
20
- /**
21
- * Optional props to pass to the underlying TouchableOpacity when onPress is provided.
22
- */
23
- touchableOpacityProps?: Omit<TouchableOpacityProps, 'onPress' | 'style' | 'children'>;
24
- } & TouchableOpacityProps;
12
+ isInteractive?: false;
13
+ } & ViewProps) | ({
14
+ children: ReactNode;
15
+ twClassName?: string;
16
+ isInteractive: true;
17
+ } & Omit<PressableProps, 'children'>);
25
18
  //# sourceMappingURL=Card.types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.types.d.cts","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB;AAE1D;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,qBAAqB,CAAC,EAAE,IAAI,CAC1B,qBAAqB,EACrB,SAAS,GAAG,OAAO,GAAG,UAAU,CACjC,CAAC;CACH,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"Card.types.d.cts","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,CAAC;IACC,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GAAG,SAAS,CAAC,GACd,CAAC;IACC,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,IAAI,CAAC;CACrB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC"}
@@ -1,25 +1,18 @@
1
1
  import type { ReactNode } from "react";
2
- import type { TouchableOpacityProps } from "react-native";
2
+ import type { PressableProps, ViewProps } from "react-native";
3
3
  /**
4
4
  * Card component props.
5
+ *
6
+ * When `isInteractive` is `false` (default), the root is a `View`.
7
+ * When `true`, the root is a `Pressable` and all `PressableProps` are available.
5
8
  */
6
- export type CardProps = {
7
- /**
8
- * Content to display inside the card.
9
- */
9
+ export type CardProps = ({
10
10
  children: ReactNode;
11
- /**
12
- * Optional callback when the card is pressed.
13
- * When provided, the card wraps content in a TouchableOpacity.
14
- */
15
- onPress?: () => void;
16
- /**
17
- * Optional prop to add twrnc overriding classNames.
18
- */
19
11
  twClassName?: string;
20
- /**
21
- * Optional props to pass to the underlying TouchableOpacity when onPress is provided.
22
- */
23
- touchableOpacityProps?: Omit<TouchableOpacityProps, 'onPress' | 'style' | 'children'>;
24
- } & TouchableOpacityProps;
12
+ isInteractive?: false;
13
+ } & ViewProps) | ({
14
+ children: ReactNode;
15
+ twClassName?: string;
16
+ isInteractive: true;
17
+ } & Omit<PressableProps, 'children'>);
25
18
  //# sourceMappingURL=Card.types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.types.d.mts","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB;AAE1D;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,qBAAqB,CAAC,EAAE,IAAI,CAC1B,qBAAqB,EACrB,SAAS,GAAG,OAAO,GAAG,UAAU,CACjC,CAAC;CACH,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"Card.types.d.mts","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,CAAC;IACC,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GAAG,SAAS,CAAC,GACd,CAAC;IACC,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,IAAI,CAAC;CACrB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Card.types.mjs","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\nimport type { TouchableOpacityProps } from 'react-native';\n\n/**\n * Card component props.\n */\nexport type CardProps = {\n /**\n * Content to display inside the card.\n */\n children: ReactNode;\n /**\n * Optional callback when the card is pressed.\n * When provided, the card wraps content in a TouchableOpacity.\n */\n onPress?: () => void;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional props to pass to the underlying TouchableOpacity when onPress is provided.\n */\n touchableOpacityProps?: Omit<\n TouchableOpacityProps,\n 'onPress' | 'style' | 'children'\n >;\n} & TouchableOpacityProps;\n"]}
1
+ {"version":3,"file":"Card.types.mjs","sourceRoot":"","sources":["../../../src/components/Card/Card.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\nimport type { PressableProps, ViewProps } from 'react-native';\n\n/**\n * Card component props.\n *\n * When `isInteractive` is `false` (default), the root is a `View`.\n * When `true`, the root is a `Pressable` and all `PressableProps` are available.\n */\nexport type CardProps =\n | ({\n children: ReactNode;\n twClassName?: string;\n isInteractive?: false;\n } & ViewProps)\n | ({\n children: ReactNode;\n twClassName?: string;\n isInteractive: true;\n } & Omit<PressableProps, 'children'>);\n"]}
@@ -101,7 +101,7 @@ exports.Checkbox = (0, react_1.forwardRef)(({ isSelected, isDisabled = false, is
101
101
  ]}>
102
102
  {({ pressed }) => (<>
103
103
  <AnimatedView {...checkboxContainerProps} style={[
104
- tw `${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,
104
+ tw `${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded-full border-2`,
105
105
  { transform: [{ scale: scaleAnim }] },
106
106
  ]}>
107
107
  {/* Always render icon, opacity driven by iconAnim */}
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.cjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AAEf,+CAA2D;AAE3D,4CAA8D;AAC9D,gFAAmE;AAInE,MAAM,YAAY,GAAG,uBAAQ,CAAC,IAAI,CAAC;AAEtB,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,CACE,EACE,UAAU,EACV,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,mBAAmB;IACnB,MAAM,SAAS,GAAG,IAAA,cAAM,EAAC,IAAI,uBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACxD,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAC,IAAI,uBAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAExE,+CAA+C;IAC/C,IAAA,i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n useRef,\n useImperativeHandle,\n useCallback,\n useEffect,\n} from 'react';\nimport type { PressableStateCallbackType } from 'react-native';\nimport { Pressable, Animated, Easing } from 'react-native';\n\nimport { Icon, IconName, IconColor, IconSize } from '../Icon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { CheckboxProps } from './Checkbox.types';\n\nconst AnimatedView = Animated.View;\n\nexport const Checkbox = forwardRef<{ toggle: () => void }, CheckboxProps>(\n (\n {\n isSelected,\n isDisabled = false,\n isInvalid = false,\n label = '',\n labelProps,\n onChange,\n checkboxContainerProps,\n checkedIconProps,\n twClassName,\n style,\n ...props\n },\n ref,\n ) => {\n // Animation values\n const scaleAnim = useRef(new Animated.Value(1)).current;\n const iconAnim = useRef(new Animated.Value(isSelected ? 1 : 0)).current;\n\n // Sync icon opacity whenever selection changes\n useEffect(() => {\n Animated.timing(iconAnim, {\n toValue: isSelected ? 1 : 0,\n duration: 300,\n easing: Easing.ease,\n useNativeDriver: true,\n }).start();\n }, [isSelected, iconAnim]);\n\n // Bounce effect when toggling\n const animateScale = useCallback(() => {\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 1.15,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n ]).start();\n }, [scaleAnim]);\n\n // Press handler: notify parent, then bounce\n const handlePress = () => {\n if (isDisabled) {\n return;\n }\n onChange?.(!isSelected);\n animateScale();\n };\n\n useImperativeHandle(ref, () => ({ toggle: handlePress }), [handlePress]);\n\n const tw = useTailwind();\n const twContainerClassNames = tw.style(\n 'flex-row items-center',\n isDisabled ? 'opacity-50' : 'opacity-100',\n twClassName,\n );\n\n const getCheckboxContainerStyle = useCallback(\n (pressed: boolean): string => {\n const baseBg = isSelected ? 'bg-icon-default' : 'bg-transparent';\n let baseBorder = 'border-default';\n if (isSelected) {\n baseBorder = 'border-icon-default';\n } else if (isInvalid) {\n baseBorder = 'border-error-default';\n }\n const pressedBg = isSelected ? 'bg-icon-default-pressed' : 'bg-pressed';\n let pressedBorder = 'border-default';\n if (isSelected) {\n pressedBorder = 'border-icon-default-pressed';\n } else if (isInvalid) {\n pressedBorder = 'border-error-default';\n }\n return pressed\n ? `${pressedBg} ${pressedBorder}`\n : `${baseBg} ${baseBorder}`;\n },\n [isSelected, isInvalid],\n );\n\n return (\n <Pressable\n onPress={handlePress}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityState={{\n checked: isSelected,\n disabled: isDisabled,\n }}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n disabled={isDisabled}\n {...props}\n style={(state: PressableStateCallbackType) => [\n twContainerClassNames,\n typeof style === 'function' ? style(state) : style,\n ]}\n >\n {({ pressed }) => (\n <>\n <AnimatedView\n {...checkboxContainerProps}\n style={[\n tw`${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,\n { transform: [{ scale: scaleAnim }] },\n ]}\n >\n {/* Always render icon, opacity driven by iconAnim */}\n <Animated.View style={{ opacity: iconAnim }}>\n <Icon\n name={IconName.Check}\n color={IconColor.IconInverse}\n size={IconSize.Sm}\n {...checkedIconProps}\n />\n </Animated.View>\n </AnimatedView>\n {label ? (\n <TextOrChildren\n textProps={{ ...labelProps, twClassName: 'ml-3' }}\n >\n {label}\n </TextOrChildren>\n ) : null}\n </>\n )}\n </Pressable>\n );\n },\n);\n"]}
1
+ {"version":3,"file":"Checkbox.cjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AAEf,+CAA2D;AAE3D,4CAA8D;AAC9D,gFAAmE;AAInE,MAAM,YAAY,GAAG,uBAAQ,CAAC,IAAI,CAAC;AAEtB,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,CACE,EACE,UAAU,EACV,UAAU,GAAG,KAAK,EACl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EAAE,CAAC,CAClB,IAAI,gBAAgB,CAAC,EAEzB;cAAA,EAAE,uBAAQ,CAAC,IAAI,CACjB;YAAA,EAAE,YAAY,CACd;YAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CACP,CAAC,+BAAc,CACb,SAAS,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAElD;gBAAA,CAAC,KAAK,CACR;cAAA,EAAE,+BAAc,CAAC,CAClB,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,wBAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useRef,\n useImperativeHandle,\n useCallback,\n useEffect,\n} from 'react';\nimport type { PressableStateCallbackType } from 'react-native';\nimport { Pressable, Animated, Easing } from 'react-native';\n\nimport { Icon, IconName, IconColor, IconSize } from '../Icon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { CheckboxProps } from './Checkbox.types';\n\nconst AnimatedView = Animated.View;\n\nexport const Checkbox = forwardRef<{ toggle: () => void }, CheckboxProps>(\n (\n {\n isSelected,\n isDisabled = false,\n isInvalid = false,\n label = '',\n labelProps,\n onChange,\n checkboxContainerProps,\n checkedIconProps,\n twClassName,\n style,\n ...props\n },\n ref,\n ) => {\n // Animation values\n const scaleAnim = useRef(new Animated.Value(1)).current;\n const iconAnim = useRef(new Animated.Value(isSelected ? 1 : 0)).current;\n\n // Sync icon opacity whenever selection changes\n useEffect(() => {\n Animated.timing(iconAnim, {\n toValue: isSelected ? 1 : 0,\n duration: 300,\n easing: Easing.ease,\n useNativeDriver: true,\n }).start();\n }, [isSelected, iconAnim]);\n\n // Bounce effect when toggling\n const animateScale = useCallback(() => {\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 1.15,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n ]).start();\n }, [scaleAnim]);\n\n // Press handler: notify parent, then bounce\n const handlePress = () => {\n if (isDisabled) {\n return;\n }\n onChange?.(!isSelected);\n animateScale();\n };\n\n useImperativeHandle(ref, () => ({ toggle: handlePress }), [handlePress]);\n\n const tw = useTailwind();\n const twContainerClassNames = tw.style(\n 'flex-row items-center',\n isDisabled ? 'opacity-50' : 'opacity-100',\n twClassName,\n );\n\n const getCheckboxContainerStyle = useCallback(\n (pressed: boolean): string => {\n const baseBg = isSelected ? 'bg-icon-default' : 'bg-transparent';\n let baseBorder = 'border-default';\n if (isSelected) {\n baseBorder = 'border-icon-default';\n } else if (isInvalid) {\n baseBorder = 'border-error-default';\n }\n const pressedBg = isSelected ? 'bg-icon-default-pressed' : 'bg-pressed';\n let pressedBorder = 'border-default';\n if (isSelected) {\n pressedBorder = 'border-icon-default-pressed';\n } else if (isInvalid) {\n pressedBorder = 'border-error-default';\n }\n return pressed\n ? `${pressedBg} ${pressedBorder}`\n : `${baseBg} ${baseBorder}`;\n },\n [isSelected, isInvalid],\n );\n\n return (\n <Pressable\n onPress={handlePress}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityState={{\n checked: isSelected,\n disabled: isDisabled,\n }}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n disabled={isDisabled}\n {...props}\n style={(state: PressableStateCallbackType) => [\n twContainerClassNames,\n typeof style === 'function' ? style(state) : style,\n ]}\n >\n {({ pressed }) => (\n <>\n <AnimatedView\n {...checkboxContainerProps}\n style={[\n tw`${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded-full border-2`,\n { transform: [{ scale: scaleAnim }] },\n ]}\n >\n {/* Always render icon, opacity driven by iconAnim */}\n <Animated.View style={{ opacity: iconAnim }}>\n <Icon\n name={IconName.Check}\n color={IconColor.IconInverse}\n size={IconSize.Sm}\n {...checkedIconProps}\n />\n </Animated.View>\n </AnimatedView>\n {label ? (\n <TextOrChildren\n textProps={{ ...labelProps, twClassName: 'ml-3' }}\n >\n {label}\n </TextOrChildren>\n ) : null}\n </>\n )}\n </Pressable>\n );\n },\n);\n"]}
@@ -82,7 +82,7 @@ export const Checkbox = forwardRef(({ isSelected, isDisabled = false, isInvalid
82
82
  ]}>
83
83
  {({ pressed }) => (<>
84
84
  <AnimatedView {...checkboxContainerProps} style={[
85
- tw `${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,
85
+ tw `${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded-full border-2`,
86
86
  { transform: [{ scale: scaleAnim }] },
87
87
  ]}>
88
88
  {/* Always render icon, opacity driven by iconAnim */}
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EACZ,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACV,cAAc;;AAEf,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,qBAAqB;AAE3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,0BAAgB;AAC9D,OAAO,EAAE,cAAc,EAAE,oDAA0C;AAInE,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,UAAU,EACV,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,mBAAmB;IACnB,MAAM,SAAS,GAAG,M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ACR;cAAA,EAAE,cAAc,CAAC,CAClB,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useRef,\n useImperativeHandle,\n useCallback,\n useEffect,\n} from 'react';\nimport type { PressableStateCallbackType } from 'react-native';\nimport { Pressable, Animated, Easing } from 'react-native';\n\nimport { Icon, IconName, IconColor, IconSize } from '../Icon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { CheckboxProps } from './Checkbox.types';\n\nconst AnimatedView = Animated.View;\n\nexport const Checkbox = forwardRef<{ toggle: () => void }, CheckboxProps>(\n (\n {\n isSelected,\n isDisabled = false,\n isInvalid = false,\n label = '',\n labelProps,\n onChange,\n checkboxContainerProps,\n checkedIconProps,\n twClassName,\n style,\n ...props\n },\n ref,\n ) => {\n // Animation values\n const scaleAnim = useRef(new Animated.Value(1)).current;\n const iconAnim = useRef(new Animated.Value(isSelected ? 1 : 0)).current;\n\n // Sync icon opacity whenever selection changes\n useEffect(() => {\n Animated.timing(iconAnim, {\n toValue: isSelected ? 1 : 0,\n duration: 300,\n easing: Easing.ease,\n useNativeDriver: true,\n }).start();\n }, [isSelected, iconAnim]);\n\n // Bounce effect when toggling\n const animateScale = useCallback(() => {\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 1.15,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n ]).start();\n }, [scaleAnim]);\n\n // Press handler: notify parent, then bounce\n const handlePress = () => {\n if (isDisabled) {\n return;\n }\n onChange?.(!isSelected);\n animateScale();\n };\n\n useImperativeHandle(ref, () => ({ toggle: handlePress }), [handlePress]);\n\n const tw = useTailwind();\n const twContainerClassNames = tw.style(\n 'flex-row items-center',\n isDisabled ? 'opacity-50' : 'opacity-100',\n twClassName,\n );\n\n const getCheckboxContainerStyle = useCallback(\n (pressed: boolean): string => {\n const baseBg = isSelected ? 'bg-icon-default' : 'bg-transparent';\n let baseBorder = 'border-default';\n if (isSelected) {\n baseBorder = 'border-icon-default';\n } else if (isInvalid) {\n baseBorder = 'border-error-default';\n }\n const pressedBg = isSelected ? 'bg-icon-default-pressed' : 'bg-pressed';\n let pressedBorder = 'border-default';\n if (isSelected) {\n pressedBorder = 'border-icon-default-pressed';\n } else if (isInvalid) {\n pressedBorder = 'border-error-default';\n }\n return pressed\n ? `${pressedBg} ${pressedBorder}`\n : `${baseBg} ${baseBorder}`;\n },\n [isSelected, isInvalid],\n );\n\n return (\n <Pressable\n onPress={handlePress}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityState={{\n checked: isSelected,\n disabled: isDisabled,\n }}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n disabled={isDisabled}\n {...props}\n style={(state: PressableStateCallbackType) => [\n twContainerClassNames,\n typeof style === 'function' ? style(state) : style,\n ]}\n >\n {({ pressed }) => (\n <>\n <AnimatedView\n {...checkboxContainerProps}\n style={[\n tw`${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded border-2`,\n { transform: [{ scale: scaleAnim }] },\n ]}\n >\n {/* Always render icon, opacity driven by iconAnim */}\n <Animated.View style={{ opacity: iconAnim }}>\n <Icon\n name={IconName.Check}\n color={IconColor.IconInverse}\n size={IconSize.Sm}\n {...checkedIconProps}\n />\n </Animated.View>\n </AnimatedView>\n {label ? (\n <TextOrChildren\n textProps={{ ...labelProps, twClassName: 'ml-3' }}\n >\n {label}\n </TextOrChildren>\n ) : null}\n </>\n )}\n </Pressable>\n );\n },\n);\n"]}
1
+ {"version":3,"file":"Checkbox.mjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE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AE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE;aACtC,CAAC,CAEF;cAAA,CAAC,oDAAoD,CACrD;cAAA,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAC1C;gBAAA,CAAC,IAAI,CACH,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACrB,KAAK,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAC7B,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAClB,IAAI,gBAAgB,CAAC,EAEzB;cAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;YAAA,EAAE,YAAY,CACd;YAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CACP,CAAC,cAAc,CACb,SAAS,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAElD;gBAAA,CAAC,KAAK,CACR;cAAA,EAAE,cAAc,CAAC,CAClB,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,GAAG,CACJ,CACH;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useRef,\n useImperativeHandle,\n useCallback,\n useEffect,\n} from 'react';\nimport type { PressableStateCallbackType } from 'react-native';\nimport { Pressable, Animated, Easing } from 'react-native';\n\nimport { Icon, IconName, IconColor, IconSize } from '../Icon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { CheckboxProps } from './Checkbox.types';\n\nconst AnimatedView = Animated.View;\n\nexport const Checkbox = forwardRef<{ toggle: () => void }, CheckboxProps>(\n (\n {\n isSelected,\n isDisabled = false,\n isInvalid = false,\n label = '',\n labelProps,\n onChange,\n checkboxContainerProps,\n checkedIconProps,\n twClassName,\n style,\n ...props\n },\n ref,\n ) => {\n // Animation values\n const scaleAnim = useRef(new Animated.Value(1)).current;\n const iconAnim = useRef(new Animated.Value(isSelected ? 1 : 0)).current;\n\n // Sync icon opacity whenever selection changes\n useEffect(() => {\n Animated.timing(iconAnim, {\n toValue: isSelected ? 1 : 0,\n duration: 300,\n easing: Easing.ease,\n useNativeDriver: true,\n }).start();\n }, [isSelected, iconAnim]);\n\n // Bounce effect when toggling\n const animateScale = useCallback(() => {\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 1.15,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 100,\n easing: Easing.ease,\n useNativeDriver: true,\n }),\n ]).start();\n }, [scaleAnim]);\n\n // Press handler: notify parent, then bounce\n const handlePress = () => {\n if (isDisabled) {\n return;\n }\n onChange?.(!isSelected);\n animateScale();\n };\n\n useImperativeHandle(ref, () => ({ toggle: handlePress }), [handlePress]);\n\n const tw = useTailwind();\n const twContainerClassNames = tw.style(\n 'flex-row items-center',\n isDisabled ? 'opacity-50' : 'opacity-100',\n twClassName,\n );\n\n const getCheckboxContainerStyle = useCallback(\n (pressed: boolean): string => {\n const baseBg = isSelected ? 'bg-icon-default' : 'bg-transparent';\n let baseBorder = 'border-default';\n if (isSelected) {\n baseBorder = 'border-icon-default';\n } else if (isInvalid) {\n baseBorder = 'border-error-default';\n }\n const pressedBg = isSelected ? 'bg-icon-default-pressed' : 'bg-pressed';\n let pressedBorder = 'border-default';\n if (isSelected) {\n pressedBorder = 'border-icon-default-pressed';\n } else if (isInvalid) {\n pressedBorder = 'border-error-default';\n }\n return pressed\n ? `${pressedBg} ${pressedBorder}`\n : `${baseBg} ${baseBorder}`;\n },\n [isSelected, isInvalid],\n );\n\n return (\n <Pressable\n onPress={handlePress}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityState={{\n checked: isSelected,\n disabled: isDisabled,\n }}\n accessibilityLabel={typeof label === 'string' ? label : undefined}\n disabled={isDisabled}\n {...props}\n style={(state: PressableStateCallbackType) => [\n twContainerClassNames,\n typeof style === 'function' ? style(state) : style,\n ]}\n >\n {({ pressed }) => (\n <>\n <AnimatedView\n {...checkboxContainerProps}\n style={[\n tw`${getCheckboxContainerStyle(pressed)} flex size-[22px] items-center justify-center rounded-full border-2`,\n { transform: [{ scale: scaleAnim }] },\n ]}\n >\n {/* Always render icon, opacity driven by iconAnim */}\n <Animated.View style={{ opacity: iconAnim }}>\n <Icon\n name={IconName.Check}\n color={IconColor.IconInverse}\n size={IconSize.Sm}\n {...checkedIconProps}\n />\n </Animated.View>\n </AnimatedView>\n {label ? (\n <TextOrChildren\n textProps={{ ...labelProps, twClassName: 'ml-3' }}\n >\n {label}\n </TextOrChildren>\n ) : null}\n </>\n )}\n </Pressable>\n );\n },\n);\n"]}
@@ -127,13 +127,13 @@ const HeaderBase = ({ children, style, startAccessory, endAccessory, startButton
127
127
 
128
128
  {/* Title */}
129
129
  <react_native_1.View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>
130
- <TextOrChildren_1.TextOrChildren textProps={{
131
- variant: design_system_shared_1.TextVariant.HeadingSm,
132
- ...textProps,
133
- style: [tw.style('text-center'), textProps?.style],
134
- }}>
135
- {children}
136
- </TextOrChildren_1.TextOrChildren>
130
+ {children && (<TextOrChildren_1.TextOrChildren textProps={{
131
+ variant: design_system_shared_1.TextVariant.HeadingSm,
132
+ ...textProps,
133
+ style: [tw.style('text-center'), textProps?.style],
134
+ }}>
135
+ {children}
136
+ </TextOrChildren_1.TextOrChildren>)}
137
137
  </react_native_1.View>
138
138
 
139
139
  {/* End accessory */}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderBase.cjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B,kFAAsE;AACtE,8FAA4E;AAC5E,+CAAqD;AAErD,+CAAoC;AACpC,mFAAmE;AAEnE,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S,EAAE,aAAa;YACxB,QAAQ,EAAE,0BAA0B;YACpC,OAAO,EAAE,sBAAsB;SAChC,CAAC,CAEF;;MAAA,CAAC,WAAW,CACZ;MAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,oBAAoB,CAAC,CACrE;QAAA,CAAC,+BAAc,CACb,SAAS,CAAC,CAAC;YACT,OAAO,EAAE,kCAAW,CAAC,SAAS;YAC9B,GAAG,SAAS;YACZ,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC;SACnD,CAAC,CAEF;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,+BAAc,CAClB;MAAA,EAAE,mBAAI,CAEN;;MAAA,CAAC,mBAAmB,CACpB;MAAA,CAAC,sBAAsB,CAAC;YACtB,YAAY,EAAE,wBAAwB;YACtC,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,wBAAwB;YAClC,OAAO,EAAE,oBAAoB;YAC7B,oBAAoB,EAAE,qBAAqB;gBACzC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;gBAC5B,CAAC,CAAC,SAAS;SACd,CAAC,CACJ;IAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AA7HW,QAAA,UAAU,cA6HrB;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport { TextVariant } from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback, useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { HeaderBaseProps } from './HeaderBase.types';\n\n// `startAccessory` is the primary escape hatch. `startButtonIconProps`\n// remains as a convenience path for the common single-back-button case.\nconst resolveStartAccessory = ({\n startAccessory,\n startButtonIconProps,\n}: Pick<HeaderBaseProps, 'startAccessory' | 'startButtonIconProps'>) => {\n if (startAccessory) {\n return startAccessory;\n }\n\n if (startButtonIconProps) {\n return <ButtonIcon size={ButtonIconSize.Md} {...startButtonIconProps} />;\n }\n\n return null;\n};\n\n// Only the end side supports built-in multiple buttons. More complex\n// start-side layouts should be composed explicitly with `startAccessory`.\nconst renderEndButtonIcons = (endButtonIconProps: ButtonIconProps[]) =>\n endButtonIconProps\n .map((iconProps, originalIndex) => ({\n iconProps,\n originalIndex,\n }))\n .reverse()\n .map(({ iconProps, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...iconProps}\n />\n ));\n\n// `endAccessory` takes precedence over the shorthand icon-props array.\nconst resolveEndAccessory = ({\n endAccessory,\n endButtonIconProps,\n}: Pick<HeaderBaseProps, 'endAccessory' | 'endButtonIconProps'>) => {\n if (endAccessory) {\n return {\n resolvedEndAccessory: endAccessory,\n hasMultipleEndButtons: false,\n };\n }\n\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n return {\n resolvedEndAccessory: renderEndButtonIcons(endButtonIconProps),\n hasMultipleEndButtons: endButtonIconProps.length > 1,\n };\n }\n\n return {\n resolvedEndAccessory: null,\n hasMultipleEndButtons: false,\n };\n};\n\nexport const HeaderBase: React.FC<HeaderBaseProps> = ({\n children,\n style,\n startAccessory,\n endAccessory,\n startButtonIconProps,\n endButtonIconProps,\n includesTopInset = false,\n startAccessoryWrapperProps,\n endAccessoryWrapperProps,\n childrenWrapperProps,\n textProps,\n twClassName,\n ...props\n}) => {\n const tw = useTailwind();\n const insets = useSafeAreaInsets();\n\n const [startAccessoryWidth, setStartAccessoryWidth] = useState(0);\n const [endAccessoryWidth, setEndAccessoryWidth] = useState(0);\n\n const handleStartAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setStartAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n const handleEndAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setEndAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n // Normalize the public API into resolved slots so the render path only deals\n // with layout and title rendering.\n const resolvedStartAccessory = resolveStartAccessory({\n startAccessory,\n startButtonIconProps,\n });\n const { resolvedEndAccessory, hasMultipleEndButtons } = resolveEndAccessory({\n endAccessory,\n endButtonIconProps,\n });\n\n const hasStartAccessory = Boolean(resolvedStartAccessory);\n const hasEndAccessory = Boolean(resolvedEndAccessory);\n const hasAnyAccessory = hasStartAccessory || hasEndAccessory;\n\n // Calculate equal width for both accessory wrappers to ensure title stays centered.\n const accessoryWrapperWidth =\n hasAnyAccessory && (startAccessoryWidth || endAccessoryWidth)\n ? Math.max(startAccessoryWidth, endAccessoryWidth)\n : undefined;\n\n const renderAccessoryWrapper = ({\n wrapperProps,\n alignment,\n onLayout,\n content,\n measuredContentStyle,\n }: {\n wrapperProps?: HeaderBaseProps['startAccessoryWrapperProps'];\n alignment: 'items-start' | 'items-end';\n onLayout: (e: LayoutChangeEvent) => void;\n content: React.ReactNode;\n measuredContentStyle?: ReturnType<typeof tw.style>;\n }) => {\n if (!hasAnyAccessory) {\n return null;\n }\n\n return (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style(alignment, { width: accessoryWrapperWidth })\n : undefined\n }\n {...wrapperProps}\n >\n <View onLayout={onLayout} style={measuredContentStyle}>\n {content}\n </View>\n </View>\n );\n };\n\n return (\n <View\n style={[\n tw.style('flex-row items-center gap-4 h-14', twClassName),\n includesTopInset && { marginTop: insets.top },\n style,\n ]}\n {...props}\n >\n {/* Start accessory */}\n {renderAccessoryWrapper({\n wrapperProps: startAccessoryWrapperProps,\n alignment: 'items-start',\n onLayout: handleStartAccessoryLayout,\n content: resolvedStartAccessory,\n })}\n\n {/* Title */}\n <View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>\n <TextOrChildren\n textProps={{\n variant: TextVariant.HeadingSm,\n ...textProps,\n style: [tw.style('text-center'), textProps?.style],\n }}\n >\n {children}\n </TextOrChildren>\n </View>\n\n {/* End accessory */}\n {renderAccessoryWrapper({\n wrapperProps: endAccessoryWrapperProps,\n alignment: 'items-end',\n onLayout: handleEndAccessoryLayout,\n content: resolvedEndAccessory,\n measuredContentStyle: hasMultipleEndButtons\n ? tw.style('flex-row gap-2')\n : undefined,\n })}\n </View>\n );\n};\n\nHeaderBase.displayName = 'HeaderBase';\n"]}
1
+ {"version":3,"file":"HeaderBase.cjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B,kFAAsE;AACtE,8FAA4E;AAC5E,+CAAqD;AAErD,+CAAoC;AACpC,mFAAmE;AAEnE,yBAAyB;AACzB,wDAA2D;AAE3D,gFAAmE;AAInE,uEAAuE;AACvE,wEAAwE;AACxE,MAAM,qBAAqB,GAAG,CAAC,EAC7B,cAAc,EACd,oBAAoB,GAC6C,EAAE,EAAE;IACrE,IAAI,cAAc,EAAE;QAClB,OAAO,cAAc,CAAC;KACvB;IAED,IAAI,oBAAoB,EAAE;QACxB,OAAO,CAAC,uBAAU,CAAC,IAAI,CAAC,CAAC,2BAAc,CAAC,EAAE,CAAC,CAAC,IAAI,oBAAoB,CAAC,EAAG,CAAC;KAC1E;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,qEAAqE;AACrE,0EAA0E;AAC1E,MAAM,oBAAoB,GAAG,CAAC,kBAAqC,EAAE,EAAE,CACrE,kBAAkB;KACf,GAAG,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IAClC,SAAS;IACT,aAAa;CACd,CAAC,CAAC;KACF,OAAO,EAAE;KACT,GAAG,CAAC,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E,wBAAwB;YACtC,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,wBAAwB;YAClC,OAAO,EAAE,oBAAoB;YAC7B,oBAAoB,EAAE,qBAAqB;gBACzC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;gBAC5B,CAAC,CAAC,SAAS;SACd,CAAC,CACJ;IAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AA/HW,QAAA,UAAU,cA+HrB;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport { TextVariant } from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback, useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { HeaderBaseProps } from './HeaderBase.types';\n\n// `startAccessory` is the primary escape hatch. `startButtonIconProps`\n// remains as a convenience path for the common single-back-button case.\nconst resolveStartAccessory = ({\n startAccessory,\n startButtonIconProps,\n}: Pick<HeaderBaseProps, 'startAccessory' | 'startButtonIconProps'>) => {\n if (startAccessory) {\n return startAccessory;\n }\n\n if (startButtonIconProps) {\n return <ButtonIcon size={ButtonIconSize.Md} {...startButtonIconProps} />;\n }\n\n return null;\n};\n\n// Only the end side supports built-in multiple buttons. More complex\n// start-side layouts should be composed explicitly with `startAccessory`.\nconst renderEndButtonIcons = (endButtonIconProps: ButtonIconProps[]) =>\n endButtonIconProps\n .map((iconProps, originalIndex) => ({\n iconProps,\n originalIndex,\n }))\n .reverse()\n .map(({ iconProps, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...iconProps}\n />\n ));\n\n// `endAccessory` takes precedence over the shorthand icon-props array.\nconst resolveEndAccessory = ({\n endAccessory,\n endButtonIconProps,\n}: Pick<HeaderBaseProps, 'endAccessory' | 'endButtonIconProps'>) => {\n if (endAccessory) {\n return {\n resolvedEndAccessory: endAccessory,\n hasMultipleEndButtons: false,\n };\n }\n\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n return {\n resolvedEndAccessory: renderEndButtonIcons(endButtonIconProps),\n hasMultipleEndButtons: endButtonIconProps.length > 1,\n };\n }\n\n return {\n resolvedEndAccessory: null,\n hasMultipleEndButtons: false,\n };\n};\n\nexport const HeaderBase: React.FC<HeaderBaseProps> = ({\n children,\n style,\n startAccessory,\n endAccessory,\n startButtonIconProps,\n endButtonIconProps,\n includesTopInset = false,\n startAccessoryWrapperProps,\n endAccessoryWrapperProps,\n childrenWrapperProps,\n textProps,\n twClassName,\n ...props\n}) => {\n const tw = useTailwind();\n const insets = useSafeAreaInsets();\n\n const [startAccessoryWidth, setStartAccessoryWidth] = useState(0);\n const [endAccessoryWidth, setEndAccessoryWidth] = useState(0);\n\n const handleStartAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setStartAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n const handleEndAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setEndAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n // Normalize the public API into resolved slots so the render path only deals\n // with layout and title rendering.\n const resolvedStartAccessory = resolveStartAccessory({\n startAccessory,\n startButtonIconProps,\n });\n const { resolvedEndAccessory, hasMultipleEndButtons } = resolveEndAccessory({\n endAccessory,\n endButtonIconProps,\n });\n\n const hasStartAccessory = Boolean(resolvedStartAccessory);\n const hasEndAccessory = Boolean(resolvedEndAccessory);\n const hasAnyAccessory = hasStartAccessory || hasEndAccessory;\n\n // Calculate equal width for both accessory wrappers to ensure title stays centered.\n const accessoryWrapperWidth =\n hasAnyAccessory && (startAccessoryWidth || endAccessoryWidth)\n ? Math.max(startAccessoryWidth, endAccessoryWidth)\n : undefined;\n\n const renderAccessoryWrapper = ({\n wrapperProps,\n alignment,\n onLayout,\n content,\n measuredContentStyle,\n }: {\n wrapperProps?: HeaderBaseProps['startAccessoryWrapperProps'];\n alignment: 'items-start' | 'items-end';\n onLayout: (e: LayoutChangeEvent) => void;\n content: React.ReactNode;\n measuredContentStyle?: ReturnType<typeof tw.style>;\n }) => {\n if (!hasAnyAccessory) {\n return null;\n }\n\n return (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style(alignment, { width: accessoryWrapperWidth })\n : undefined\n }\n {...wrapperProps}\n >\n <View onLayout={onLayout} style={measuredContentStyle}>\n {content}\n </View>\n </View>\n );\n };\n\n return (\n <View\n style={[\n tw.style('flex-row items-center gap-4 h-14', twClassName),\n includesTopInset && { marginTop: insets.top },\n style,\n ]}\n {...props}\n >\n {/* Start accessory */}\n {renderAccessoryWrapper({\n wrapperProps: startAccessoryWrapperProps,\n alignment: 'items-start',\n onLayout: handleStartAccessoryLayout,\n content: resolvedStartAccessory,\n })}\n\n {/* Title */}\n <View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>\n {children && (\n <TextOrChildren\n textProps={{\n variant: TextVariant.HeadingSm,\n ...textProps,\n style: [tw.style('text-center'), textProps?.style],\n }}\n >\n {children}\n </TextOrChildren>\n )}\n </View>\n\n {/* End accessory */}\n {renderAccessoryWrapper({\n wrapperProps: endAccessoryWrapperProps,\n alignment: 'items-end',\n onLayout: handleEndAccessoryLayout,\n content: resolvedEndAccessory,\n measuredContentStyle: hasMultipleEndButtons\n ? tw.style('flex-row gap-2')\n : undefined,\n })}\n </View>\n );\n};\n\nHeaderBase.displayName = 'HeaderBase';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderBase.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgC,cAAc;AAUrD,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AA6D1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6HhD,CAAC"}
1
+ {"version":3,"file":"HeaderBase.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgC,cAAc;AAUrD,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AA6D1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA+HhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderBase.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgC,cAAc;AAUrD,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AA6D1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6HhD,CAAC"}
1
+ {"version":3,"file":"HeaderBase.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgC,cAAc;AAUrD,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AA6D1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA+HhD,CAAC"}
@@ -108,13 +108,13 @@ export const HeaderBase = ({ children, style, startAccessory, endAccessory, star
108
108
 
109
109
  {/* Title */}
110
110
  <View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>
111
- <TextOrChildren textProps={{
112
- variant: TextVariant.HeadingSm,
113
- ...textProps,
114
- style: [tw.style('text-center'), textProps?.style],
115
- }}>
116
- {children}
117
- </TextOrChildren>
111
+ {children && (<TextOrChildren textProps={{
112
+ variant: TextVariant.HeadingSm,
113
+ ...textProps,
114
+ style: [tw.style('text-center'), textProps?.style],
115
+ }}>
116
+ {children}
117
+ </TextOrChildren>)}
118
118
  </View>
119
119
 
120
120
  {/* End accessory */}
@@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AAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport { TextVariant } from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback, useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { HeaderBaseProps } from './HeaderBase.types';\n\n// `startAccessory` is the primary escape hatch. `startButtonIconProps`\n// remains as a convenience path for the common single-back-button case.\nconst resolveStartAccessory = ({\n startAccessory,\n startButtonIconProps,\n}: Pick<HeaderBaseProps, 'startAccessory' | 'startButtonIconProps'>) => {\n if (startAccessory) {\n return startAccessory;\n }\n\n if (startButtonIconProps) {\n return <ButtonIcon size={ButtonIconSize.Md} {...startButtonIconProps} />;\n }\n\n return null;\n};\n\n// Only the end side supports built-in multiple buttons. More complex\n// start-side layouts should be composed explicitly with `startAccessory`.\nconst renderEndButtonIcons = (endButtonIconProps: ButtonIconProps[]) =>\n endButtonIconProps\n .map((iconProps, originalIndex) => ({\n iconProps,\n originalIndex,\n }))\n .reverse()\n .map(({ iconProps, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...iconProps}\n />\n ));\n\n// `endAccessory` takes precedence over the shorthand icon-props array.\nconst resolveEndAccessory = ({\n endAccessory,\n endButtonIconProps,\n}: Pick<HeaderBaseProps, 'endAccessory' | 'endButtonIconProps'>) => {\n if (endAccessory) {\n return {\n resolvedEndAccessory: endAccessory,\n hasMultipleEndButtons: false,\n };\n }\n\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n return {\n resolvedEndAccessory: renderEndButtonIcons(endButtonIconProps),\n hasMultipleEndButtons: endButtonIconProps.length > 1,\n };\n }\n\n return {\n resolvedEndAccessory: null,\n hasMultipleEndButtons: false,\n };\n};\n\nexport const HeaderBase: React.FC<HeaderBaseProps> = ({\n children,\n style,\n startAccessory,\n endAccessory,\n startButtonIconProps,\n endButtonIconProps,\n includesTopInset = false,\n startAccessoryWrapperProps,\n endAccessoryWrapperProps,\n childrenWrapperProps,\n textProps,\n twClassName,\n ...props\n}) => {\n const tw = useTailwind();\n const insets = useSafeAreaInsets();\n\n const [startAccessoryWidth, setStartAccessoryWidth] = useState(0);\n const [endAccessoryWidth, setEndAccessoryWidth] = useState(0);\n\n const handleStartAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setStartAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n const handleEndAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setEndAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n // Normalize the public API into resolved slots so the render path only deals\n // with layout and title rendering.\n const resolvedStartAccessory = resolveStartAccessory({\n startAccessory,\n startButtonIconProps,\n });\n const { resolvedEndAccessory, hasMultipleEndButtons } = resolveEndAccessory({\n endAccessory,\n endButtonIconProps,\n });\n\n const hasStartAccessory = Boolean(resolvedStartAccessory);\n const hasEndAccessory = Boolean(resolvedEndAccessory);\n const hasAnyAccessory = hasStartAccessory || hasEndAccessory;\n\n // Calculate equal width for both accessory wrappers to ensure title stays centered.\n const accessoryWrapperWidth =\n hasAnyAccessory && (startAccessoryWidth || endAccessoryWidth)\n ? Math.max(startAccessoryWidth, endAccessoryWidth)\n : undefined;\n\n const renderAccessoryWrapper = ({\n wrapperProps,\n alignment,\n onLayout,\n content,\n measuredContentStyle,\n }: {\n wrapperProps?: HeaderBaseProps['startAccessoryWrapperProps'];\n alignment: 'items-start' | 'items-end';\n onLayout: (e: LayoutChangeEvent) => void;\n content: React.ReactNode;\n measuredContentStyle?: ReturnType<typeof tw.style>;\n }) => {\n if (!hasAnyAccessory) {\n return null;\n }\n\n return (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style(alignment, { width: accessoryWrapperWidth })\n : undefined\n }\n {...wrapperProps}\n >\n <View onLayout={onLayout} style={measuredContentStyle}>\n {content}\n </View>\n </View>\n );\n };\n\n return (\n <View\n style={[\n tw.style('flex-row items-center gap-4 h-14', twClassName),\n includesTopInset && { marginTop: insets.top },\n style,\n ]}\n {...props}\n >\n {/* Start accessory */}\n {renderAccessoryWrapper({\n wrapperProps: startAccessoryWrapperProps,\n alignment: 'items-start',\n onLayout: handleStartAccessoryLayout,\n content: resolvedStartAccessory,\n })}\n\n {/* Title */}\n <View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>\n <TextOrChildren\n textProps={{\n variant: TextVariant.HeadingSm,\n ...textProps,\n style: [tw.style('text-center'), textProps?.style],\n }}\n >\n {children}\n </TextOrChildren>\n </View>\n\n {/* End accessory */}\n {renderAccessoryWrapper({\n wrapperProps: endAccessoryWrapperProps,\n alignment: 'items-end',\n onLayout: handleEndAccessoryLayout,\n content: resolvedEndAccessory,\n measuredContentStyle: hasMultipleEndButtons\n ? tw.style('flex-row gap-2')\n : undefined,\n })}\n </View>\n );\n};\n\nHeaderBase.displayName = 'HeaderBase';\n"]}
1
+ {"version":3,"file":"HeaderBase.mjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,gDAAgD;AACtE,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc;;AAErD,OAAO,EAAE,IAAI,EAAE,qBAAqB;AACpC,OAAO,EAAE,iBAAiB,EAAE,uCAAuC;AAEnE,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gCAAsB;AAE3D,OAAO,EAAE,cAAc,EAAE,oDAA0C;AAInE,uEAAuE;AACvE,wEAAwE;AACxE,MAAM,qBAAqB,GAAG,CAAC,EAC7B,cAAc,EACd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E,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,oBAAoB,CAAC,CACrE;QAAA,CAAC,QAAQ,IAAI,CACX,CAAC,cAAc,CACb,SAAS,CAAC,CAAC;gBACT,OAAO,EAAE,WAAW,CAAC,SAAS;gBAC9B,GAAG,SAAS;gBACZ,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC;aACnD,CAAC,CAEF;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,cAAc,CAAC,CAClB,CACH;MAAA,EAAE,IAAI,CAEN;;MAAA,CAAC,mBAAmB,CACpB;MAAA,CAAC,sBAAsB,CAAC;YACtB,YAAY,EAAE,wBAAwB;YACtC,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,wBAAwB;YAClC,OAAO,EAAE,oBAAoB;YAC7B,oBAAoB,EAAE,qBAAqB;gBACzC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;gBAC5B,CAAC,CAAC,SAAS;SACd,CAAC,CACJ;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport { TextVariant } from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback, useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { HeaderBaseProps } from './HeaderBase.types';\n\n// `startAccessory` is the primary escape hatch. `startButtonIconProps`\n// remains as a convenience path for the common single-back-button case.\nconst resolveStartAccessory = ({\n startAccessory,\n startButtonIconProps,\n}: Pick<HeaderBaseProps, 'startAccessory' | 'startButtonIconProps'>) => {\n if (startAccessory) {\n return startAccessory;\n }\n\n if (startButtonIconProps) {\n return <ButtonIcon size={ButtonIconSize.Md} {...startButtonIconProps} />;\n }\n\n return null;\n};\n\n// Only the end side supports built-in multiple buttons. More complex\n// start-side layouts should be composed explicitly with `startAccessory`.\nconst renderEndButtonIcons = (endButtonIconProps: ButtonIconProps[]) =>\n endButtonIconProps\n .map((iconProps, originalIndex) => ({\n iconProps,\n originalIndex,\n }))\n .reverse()\n .map(({ iconProps, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...iconProps}\n />\n ));\n\n// `endAccessory` takes precedence over the shorthand icon-props array.\nconst resolveEndAccessory = ({\n endAccessory,\n endButtonIconProps,\n}: Pick<HeaderBaseProps, 'endAccessory' | 'endButtonIconProps'>) => {\n if (endAccessory) {\n return {\n resolvedEndAccessory: endAccessory,\n hasMultipleEndButtons: false,\n };\n }\n\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n return {\n resolvedEndAccessory: renderEndButtonIcons(endButtonIconProps),\n hasMultipleEndButtons: endButtonIconProps.length > 1,\n };\n }\n\n return {\n resolvedEndAccessory: null,\n hasMultipleEndButtons: false,\n };\n};\n\nexport const HeaderBase: React.FC<HeaderBaseProps> = ({\n children,\n style,\n startAccessory,\n endAccessory,\n startButtonIconProps,\n endButtonIconProps,\n includesTopInset = false,\n startAccessoryWrapperProps,\n endAccessoryWrapperProps,\n childrenWrapperProps,\n textProps,\n twClassName,\n ...props\n}) => {\n const tw = useTailwind();\n const insets = useSafeAreaInsets();\n\n const [startAccessoryWidth, setStartAccessoryWidth] = useState(0);\n const [endAccessoryWidth, setEndAccessoryWidth] = useState(0);\n\n const handleStartAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setStartAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n const handleEndAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setEndAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n // Normalize the public API into resolved slots so the render path only deals\n // with layout and title rendering.\n const resolvedStartAccessory = resolveStartAccessory({\n startAccessory,\n startButtonIconProps,\n });\n const { resolvedEndAccessory, hasMultipleEndButtons } = resolveEndAccessory({\n endAccessory,\n endButtonIconProps,\n });\n\n const hasStartAccessory = Boolean(resolvedStartAccessory);\n const hasEndAccessory = Boolean(resolvedEndAccessory);\n const hasAnyAccessory = hasStartAccessory || hasEndAccessory;\n\n // Calculate equal width for both accessory wrappers to ensure title stays centered.\n const accessoryWrapperWidth =\n hasAnyAccessory && (startAccessoryWidth || endAccessoryWidth)\n ? Math.max(startAccessoryWidth, endAccessoryWidth)\n : undefined;\n\n const renderAccessoryWrapper = ({\n wrapperProps,\n alignment,\n onLayout,\n content,\n measuredContentStyle,\n }: {\n wrapperProps?: HeaderBaseProps['startAccessoryWrapperProps'];\n alignment: 'items-start' | 'items-end';\n onLayout: (e: LayoutChangeEvent) => void;\n content: React.ReactNode;\n measuredContentStyle?: ReturnType<typeof tw.style>;\n }) => {\n if (!hasAnyAccessory) {\n return null;\n }\n\n return (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style(alignment, { width: accessoryWrapperWidth })\n : undefined\n }\n {...wrapperProps}\n >\n <View onLayout={onLayout} style={measuredContentStyle}>\n {content}\n </View>\n </View>\n );\n };\n\n return (\n <View\n style={[\n tw.style('flex-row items-center gap-4 h-14', twClassName),\n includesTopInset && { marginTop: insets.top },\n style,\n ]}\n {...props}\n >\n {/* Start accessory */}\n {renderAccessoryWrapper({\n wrapperProps: startAccessoryWrapperProps,\n alignment: 'items-start',\n onLayout: handleStartAccessoryLayout,\n content: resolvedStartAccessory,\n })}\n\n {/* Title */}\n <View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>\n {children && (\n <TextOrChildren\n textProps={{\n variant: TextVariant.HeadingSm,\n ...textProps,\n style: [tw.style('text-center'), textProps?.style],\n }}\n >\n {children}\n </TextOrChildren>\n )}\n </View>\n\n {/* End accessory */}\n {renderAccessoryWrapper({\n wrapperProps: endAccessoryWrapperProps,\n alignment: 'items-end',\n onLayout: handleEndAccessoryLayout,\n content: resolvedEndAccessory,\n measuredContentStyle: hasMultipleEndButtons\n ? tw.style('flex-row gap-2')\n : undefined,\n })}\n </View>\n );\n};\n\nHeaderBase.displayName = 'HeaderBase';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderSubpage.types.cjs","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { ListItemProps } from '../ListItem';\n\n/**\n * HeaderSubpage component props.\n *\n * Subpage navigation row built on {@link ListItem} with optional back/close\n * shortcuts matching {@link HeaderStandard}.\n */\nexport type HeaderSubpageProps = Omit<\n ListItemProps,\n 'startAccessory' | 'endAccessory' | 'isInteractive' | 'children'\n> & {\n /**\n * Callback when the back button is pressed.\n * If provided, a back button will be rendered as the start accessory.\n */\n onBack?: () => void;\n /**\n * Additional props to pass to the back ButtonIcon.\n * If provided, a back button will be rendered with these props spread.\n */\n backButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Callback when the close button is pressed.\n * If provided, a close button will be added to the end accessories.\n */\n onClose?: () => void;\n /**\n * Additional props to pass to the close ButtonIcon.\n * If provided, a close button will be added with these props spread.\n */\n closeButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Optional ButtonIcon props to render as the start accessory.\n * Only used if `startAccessory` is not provided.\n */\n startButtonIconProps?: ButtonIconProps;\n /**\n * Optional array of ButtonIcon props to render as additional end accessories.\n * Rendered in reverse order (first item appears rightmost).\n * Only used if `endAccessory` is not provided.\n */\n endButtonIconProps?: ButtonIconProps[];\n /**\n * Optional content before the ListItem content row.\n * Takes priority over `startButtonIconProps` and back shortcuts.\n */\n startAccessory?: ReactNode;\n /**\n * Optional content after the ListItem content row.\n * Takes priority over `endButtonIconProps` and close shortcuts.\n */\n endAccessory?: ReactNode;\n /**\n * When true, applies top safe-area inset as `marginTop` on the root ListItem.\n *\n * @default false\n */\n includesTopInset?: boolean;\n};\n"]}
1
+ {"version":3,"file":"HeaderSubpage.types.cjs","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HeaderSubpagePropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { ListItemProps } from '../ListItem';\n\n/**\n * HeaderSubpage component props.\n *\n * Subpage navigation row built on {@link ListItem} with optional back/close\n * shortcuts matching {@link HeaderStandard}.\n */\nexport type HeaderSubpageProps = Omit<\n ListItemProps,\n | 'startAccessory'\n | 'endAccessory'\n | 'isInteractive'\n | 'children'\n | keyof HeaderSubpagePropsShared\n> &\n HeaderSubpagePropsShared & {\n /**\n * Additional props to pass to the back ButtonIcon.\n * If provided, a back button will be rendered with these props spread.\n */\n backButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Additional props to pass to the close ButtonIcon.\n * If provided, a close button will be added with these props spread.\n */\n closeButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Optional ButtonIcon props to render as the start accessory.\n * Only used if `startAccessory` is not provided.\n */\n startButtonIconProps?: ButtonIconProps;\n /**\n * Optional array of ButtonIcon props to render as additional end accessories.\n * Rendered in reverse order (first item appears rightmost).\n * Only used if `endAccessory` is not provided.\n */\n endButtonIconProps?: ButtonIconProps[];\n /**\n * When true, applies top safe-area inset as `marginTop` on the root ListItem.\n *\n * @default false\n */\n includesTopInset?: boolean;\n };\n"]}
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import type { HeaderSubpagePropsShared } from "@metamask-previews/design-system-shared";
2
2
  import type { ButtonIconProps } from "../ButtonIcon/index.cjs";
3
3
  import type { ListItemProps } from "../ListItem/index.cjs";
4
4
  /**
@@ -7,22 +7,12 @@ import type { ListItemProps } from "../ListItem/index.cjs";
7
7
  * Subpage navigation row built on {@link ListItem} with optional back/close
8
8
  * shortcuts matching {@link HeaderStandard}.
9
9
  */
10
- export type HeaderSubpageProps = Omit<ListItemProps, 'startAccessory' | 'endAccessory' | 'isInteractive' | 'children'> & {
11
- /**
12
- * Callback when the back button is pressed.
13
- * If provided, a back button will be rendered as the start accessory.
14
- */
15
- onBack?: () => void;
10
+ export type HeaderSubpageProps = Omit<ListItemProps, 'startAccessory' | 'endAccessory' | 'isInteractive' | 'children' | keyof HeaderSubpagePropsShared> & HeaderSubpagePropsShared & {
16
11
  /**
17
12
  * Additional props to pass to the back ButtonIcon.
18
13
  * If provided, a back button will be rendered with these props spread.
19
14
  */
20
15
  backButtonProps?: Omit<ButtonIconProps, 'iconName'>;
21
- /**
22
- * Callback when the close button is pressed.
23
- * If provided, a close button will be added to the end accessories.
24
- */
25
- onClose?: () => void;
26
16
  /**
27
17
  * Additional props to pass to the close ButtonIcon.
28
18
  * If provided, a close button will be added with these props spread.
@@ -39,16 +29,6 @@ export type HeaderSubpageProps = Omit<ListItemProps, 'startAccessory' | 'endAcce
39
29
  * Only used if `endAccessory` is not provided.
40
30
  */
41
31
  endButtonIconProps?: ButtonIconProps[];
42
- /**
43
- * Optional content before the ListItem content row.
44
- * Takes priority over `startButtonIconProps` and back shortcuts.
45
- */
46
- startAccessory?: ReactNode;
47
- /**
48
- * Optional content after the ListItem content row.
49
- * Takes priority over `endButtonIconProps` and close shortcuts.
50
- */
51
- endAccessory?: ReactNode;
52
32
  /**
53
33
  * When true, applies top safe-area inset as `marginTop` on the root ListItem.
54
34
  *
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderSubpage.types.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,8BAAoB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACb,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,CACjE,GAAG;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACrD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC"}
1
+ {"version":3,"file":"HeaderSubpage.types.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gDAAgD;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,8BAAoB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACX,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,UAAU,GACV,MAAM,wBAAwB,CACjC,GACC,wBAAwB,GAAG;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACpD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACrD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import type { HeaderSubpagePropsShared } from "@metamask-previews/design-system-shared";
2
2
  import type { ButtonIconProps } from "../ButtonIcon/index.mjs";
3
3
  import type { ListItemProps } from "../ListItem/index.mjs";
4
4
  /**
@@ -7,22 +7,12 @@ import type { ListItemProps } from "../ListItem/index.mjs";
7
7
  * Subpage navigation row built on {@link ListItem} with optional back/close
8
8
  * shortcuts matching {@link HeaderStandard}.
9
9
  */
10
- export type HeaderSubpageProps = Omit<ListItemProps, 'startAccessory' | 'endAccessory' | 'isInteractive' | 'children'> & {
11
- /**
12
- * Callback when the back button is pressed.
13
- * If provided, a back button will be rendered as the start accessory.
14
- */
15
- onBack?: () => void;
10
+ export type HeaderSubpageProps = Omit<ListItemProps, 'startAccessory' | 'endAccessory' | 'isInteractive' | 'children' | keyof HeaderSubpagePropsShared> & HeaderSubpagePropsShared & {
16
11
  /**
17
12
  * Additional props to pass to the back ButtonIcon.
18
13
  * If provided, a back button will be rendered with these props spread.
19
14
  */
20
15
  backButtonProps?: Omit<ButtonIconProps, 'iconName'>;
21
- /**
22
- * Callback when the close button is pressed.
23
- * If provided, a close button will be added to the end accessories.
24
- */
25
- onClose?: () => void;
26
16
  /**
27
17
  * Additional props to pass to the close ButtonIcon.
28
18
  * If provided, a close button will be added with these props spread.
@@ -39,16 +29,6 @@ export type HeaderSubpageProps = Omit<ListItemProps, 'startAccessory' | 'endAcce
39
29
  * Only used if `endAccessory` is not provided.
40
30
  */
41
31
  endButtonIconProps?: ButtonIconProps[];
42
- /**
43
- * Optional content before the ListItem content row.
44
- * Takes priority over `startButtonIconProps` and back shortcuts.
45
- */
46
- startAccessory?: ReactNode;
47
- /**
48
- * Optional content after the ListItem content row.
49
- * Takes priority over `endButtonIconProps` and close shortcuts.
50
- */
51
- endAccessory?: ReactNode;
52
32
  /**
53
33
  * When true, applies top safe-area inset as `marginTop` on the root ListItem.
54
34
  *
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderSubpage.types.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,8BAAoB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACb,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,CACjE,GAAG;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACrD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC"}
1
+ {"version":3,"file":"HeaderSubpage.types.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gDAAgD;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,8BAAoB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACX,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,UAAU,GACV,MAAM,wBAAwB,CACjC,GACC,wBAAwB,GAAG;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACpD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACrD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderSubpage.types.mjs","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { ListItemProps } from '../ListItem';\n\n/**\n * HeaderSubpage component props.\n *\n * Subpage navigation row built on {@link ListItem} with optional back/close\n * shortcuts matching {@link HeaderStandard}.\n */\nexport type HeaderSubpageProps = Omit<\n ListItemProps,\n 'startAccessory' | 'endAccessory' | 'isInteractive' | 'children'\n> & {\n /**\n * Callback when the back button is pressed.\n * If provided, a back button will be rendered as the start accessory.\n */\n onBack?: () => void;\n /**\n * Additional props to pass to the back ButtonIcon.\n * If provided, a back button will be rendered with these props spread.\n */\n backButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Callback when the close button is pressed.\n * If provided, a close button will be added to the end accessories.\n */\n onClose?: () => void;\n /**\n * Additional props to pass to the close ButtonIcon.\n * If provided, a close button will be added with these props spread.\n */\n closeButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Optional ButtonIcon props to render as the start accessory.\n * Only used if `startAccessory` is not provided.\n */\n startButtonIconProps?: ButtonIconProps;\n /**\n * Optional array of ButtonIcon props to render as additional end accessories.\n * Rendered in reverse order (first item appears rightmost).\n * Only used if `endAccessory` is not provided.\n */\n endButtonIconProps?: ButtonIconProps[];\n /**\n * Optional content before the ListItem content row.\n * Takes priority over `startButtonIconProps` and back shortcuts.\n */\n startAccessory?: ReactNode;\n /**\n * Optional content after the ListItem content row.\n * Takes priority over `endButtonIconProps` and close shortcuts.\n */\n endAccessory?: ReactNode;\n /**\n * When true, applies top safe-area inset as `marginTop` on the root ListItem.\n *\n * @default false\n */\n includesTopInset?: boolean;\n};\n"]}
1
+ {"version":3,"file":"HeaderSubpage.types.mjs","sourceRoot":"","sources":["../../../src/components/HeaderSubpage/HeaderSubpage.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HeaderSubpagePropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { ListItemProps } from '../ListItem';\n\n/**\n * HeaderSubpage component props.\n *\n * Subpage navigation row built on {@link ListItem} with optional back/close\n * shortcuts matching {@link HeaderStandard}.\n */\nexport type HeaderSubpageProps = Omit<\n ListItemProps,\n | 'startAccessory'\n | 'endAccessory'\n | 'isInteractive'\n | 'children'\n | keyof HeaderSubpagePropsShared\n> &\n HeaderSubpagePropsShared & {\n /**\n * Additional props to pass to the back ButtonIcon.\n * If provided, a back button will be rendered with these props spread.\n */\n backButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Additional props to pass to the close ButtonIcon.\n * If provided, a close button will be added with these props spread.\n */\n closeButtonProps?: Omit<ButtonIconProps, 'iconName'>;\n /**\n * Optional ButtonIcon props to render as the start accessory.\n * Only used if `startAccessory` is not provided.\n */\n startButtonIconProps?: ButtonIconProps;\n /**\n * Optional array of ButtonIcon props to render as additional end accessories.\n * Rendered in reverse order (first item appears rightmost).\n * Only used if `endAccessory` is not provided.\n */\n endButtonIconProps?: ButtonIconProps[];\n /**\n * When true, applies top safe-area inset as `marginTop` on the root ListItem.\n *\n * @default false\n */\n includesTopInset?: boolean;\n };\n"]}
@@ -26,6 +26,7 @@ const arrow_double_right_svg_1 = __importDefault(require("./assets/arrow-double-
26
26
  const arrow_down_svg_1 = __importDefault(require("./assets/arrow-down.svg"));
27
27
  const arrow_left_svg_1 = __importDefault(require("./assets/arrow-left.svg"));
28
28
  const arrow_right_svg_1 = __importDefault(require("./assets/arrow-right.svg"));
29
+ const arrow_square_out_svg_1 = __importDefault(require("./assets/arrow-square-out.svg"));
29
30
  const arrow_up_svg_1 = __importDefault(require("./assets/arrow-up.svg"));
30
31
  const attach_money_svg_1 = __importDefault(require("./assets/attach-money.svg"));
31
32
  const backspace_svg_1 = __importDefault(require("./assets/backspace.svg"));
@@ -49,6 +50,7 @@ const chart_svg_1 = __importDefault(require("./assets/chart.svg"));
49
50
  const check_bold_svg_1 = __importDefault(require("./assets/check-bold.svg"));
50
51
  const check_svg_1 = __importDefault(require("./assets/check.svg"));
51
52
  const circle_x_svg_1 = __importDefault(require("./assets/circle-x.svg"));
53
+ const clipboard_svg_1 = __importDefault(require("./assets/clipboard.svg"));
52
54
  const clock_filled_svg_1 = __importDefault(require("./assets/clock-filled.svg"));
53
55
  const clock_svg_1 = __importDefault(require("./assets/clock.svg"));
54
56
  const close_svg_1 = __importDefault(require("./assets/close.svg"));
@@ -99,6 +101,7 @@ const hierarchy_svg_1 = __importDefault(require("./assets/hierarchy.svg"));
99
101
  const home_filled_svg_1 = __importDefault(require("./assets/home-filled.svg"));
100
102
  const home_svg_1 = __importDefault(require("./assets/home.svg"));
101
103
  const image_svg_1 = __importDefault(require("./assets/image.svg"));
104
+ const infinity_svg_1 = __importDefault(require("./assets/infinity.svg"));
102
105
  const info_svg_1 = __importDefault(require("./assets/info.svg"));
103
106
  const keep_svg_1 = __importDefault(require("./assets/keep.svg"));
104
107
  const key_svg_1 = __importDefault(require("./assets/key.svg"));
@@ -126,6 +129,7 @@ const musd_filled_svg_1 = __importDefault(require("./assets/musd-filled.svg"));
126
129
  const musd_svg_1 = __importDefault(require("./assets/musd.svg"));
127
130
  const no_photography_svg_1 = __importDefault(require("./assets/no-photography.svg"));
128
131
  const notification_svg_1 = __importDefault(require("./assets/notification.svg"));
132
+ const people_filled_svg_1 = __importDefault(require("./assets/people-filled.svg"));
129
133
  const people_svg_1 = __importDefault(require("./assets/people.svg"));
130
134
  const pin_svg_1 = __importDefault(require("./assets/pin.svg"));
131
135
  const plant_svg_1 = __importDefault(require("./assets/plant.svg"));
@@ -214,6 +218,7 @@ exports.assetByIconName = {
214
218
  ArrowDown: arrow_down_svg_1.default,
215
219
  ArrowLeft: arrow_left_svg_1.default,
216
220
  ArrowRight: arrow_right_svg_1.default,
221
+ ArrowSquareOut: arrow_square_out_svg_1.default,
217
222
  ArrowUp: arrow_up_svg_1.default,
218
223
  AttachMoney: attach_money_svg_1.default,
219
224
  Backspace: backspace_svg_1.default,
@@ -237,6 +242,7 @@ exports.assetByIconName = {
237
242
  CheckBold: check_bold_svg_1.default,
238
243
  Check: check_svg_1.default,
239
244
  CircleX: circle_x_svg_1.default,
245
+ Clipboard: clipboard_svg_1.default,
240
246
  ClockFilled: clock_filled_svg_1.default,
241
247
  Clock: clock_svg_1.default,
242
248
  Close: close_svg_1.default,
@@ -287,6 +293,7 @@ exports.assetByIconName = {
287
293
  HomeFilled: home_filled_svg_1.default,
288
294
  Home: home_svg_1.default,
289
295
  Image: image_svg_1.default,
296
+ Infinity: infinity_svg_1.default,
290
297
  Info: info_svg_1.default,
291
298
  Keep: keep_svg_1.default,
292
299
  Key: key_svg_1.default,
@@ -314,6 +321,7 @@ exports.assetByIconName = {
314
321
  Musd: musd_svg_1.default,
315
322
  NoPhotography: no_photography_svg_1.default,
316
323
  Notification: notification_svg_1.default,
324
+ PeopleFilled: people_filled_svg_1.default,
317
325
  People: people_svg_1.default,
318
326
  Pin: pin_svg_1.default,
319
327
  Plant: plant_svg_1.default,