@metamask-previews/design-system-react-native 0.16.0-preview.d854123 → 0.18.0-preview.ba86146

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 (257) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/components/AvatarFavicon/AvatarFavicon.cjs +1 -2
  3. package/dist/components/AvatarFavicon/AvatarFavicon.cjs.map +1 -1
  4. package/dist/components/AvatarFavicon/AvatarFavicon.d.cts.map +1 -1
  5. package/dist/components/AvatarFavicon/AvatarFavicon.d.mts.map +1 -1
  6. package/dist/components/AvatarFavicon/AvatarFavicon.mjs +1 -2
  7. package/dist/components/AvatarFavicon/AvatarFavicon.mjs.map +1 -1
  8. package/dist/components/AvatarFavicon/AvatarFavicon.types.cjs.map +1 -1
  9. package/dist/components/AvatarFavicon/AvatarFavicon.types.d.cts +5 -7
  10. package/dist/components/AvatarFavicon/AvatarFavicon.types.d.cts.map +1 -1
  11. package/dist/components/AvatarFavicon/AvatarFavicon.types.d.mts +5 -7
  12. package/dist/components/AvatarFavicon/AvatarFavicon.types.d.mts.map +1 -1
  13. package/dist/components/AvatarFavicon/AvatarFavicon.types.mjs.map +1 -1
  14. package/dist/components/AvatarFavicon/index.cjs +2 -2
  15. package/dist/components/AvatarFavicon/index.cjs.map +1 -1
  16. package/dist/components/AvatarFavicon/index.d.cts +1 -1
  17. package/dist/components/AvatarFavicon/index.d.cts.map +1 -1
  18. package/dist/components/AvatarFavicon/index.d.mts +1 -1
  19. package/dist/components/AvatarFavicon/index.d.mts.map +1 -1
  20. package/dist/components/AvatarFavicon/index.mjs +1 -1
  21. package/dist/components/AvatarFavicon/index.mjs.map +1 -1
  22. package/dist/components/BannerAlert/BannerAlert.cjs +2 -1
  23. package/dist/components/BannerAlert/BannerAlert.cjs.map +1 -1
  24. package/dist/components/BannerAlert/BannerAlert.constants.cjs +8 -8
  25. package/dist/components/BannerAlert/BannerAlert.constants.cjs.map +1 -1
  26. package/dist/components/BannerAlert/BannerAlert.constants.d.cts +2 -2
  27. package/dist/components/BannerAlert/BannerAlert.constants.d.cts.map +1 -1
  28. package/dist/components/BannerAlert/BannerAlert.constants.d.mts +2 -2
  29. package/dist/components/BannerAlert/BannerAlert.constants.d.mts.map +1 -1
  30. package/dist/components/BannerAlert/BannerAlert.constants.mjs +2 -2
  31. package/dist/components/BannerAlert/BannerAlert.constants.mjs.map +1 -1
  32. package/dist/components/BannerAlert/BannerAlert.d.cts.map +1 -1
  33. package/dist/components/BannerAlert/BannerAlert.d.mts.map +1 -1
  34. package/dist/components/BannerAlert/BannerAlert.mjs +2 -1
  35. package/dist/components/BannerAlert/BannerAlert.mjs.map +1 -1
  36. package/dist/components/BannerBase/BannerBase.cjs +4 -4
  37. package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
  38. package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
  39. package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
  40. package/dist/components/BannerBase/BannerBase.mjs +2 -2
  41. package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
  42. package/dist/components/BottomSheet/BottomSheet.d.cts +10 -5
  43. package/dist/components/BottomSheet/BottomSheet.d.cts.map +1 -1
  44. package/dist/components/BottomSheet/BottomSheet.d.mts +10 -5
  45. package/dist/components/BottomSheet/BottomSheet.d.mts.map +1 -1
  46. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs +0 -1
  47. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs.map +1 -1
  48. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts +10 -5
  49. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts.map +1 -1
  50. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts +10 -5
  51. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts.map +1 -1
  52. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs +0 -1
  53. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs.map +1 -1
  54. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts +1 -0
  55. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts.map +1 -1
  56. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts +1 -0
  57. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts.map +1 -1
  58. package/dist/components/ButtonBase/ButtonBase.types.d.cts +1 -0
  59. package/dist/components/ButtonBase/ButtonBase.types.d.cts.map +1 -1
  60. package/dist/components/ButtonBase/ButtonBase.types.d.mts +1 -0
  61. package/dist/components/ButtonBase/ButtonBase.types.d.mts.map +1 -1
  62. package/dist/components/Checkbox/Checkbox.d.cts +1 -6
  63. package/dist/components/Checkbox/Checkbox.d.cts.map +1 -1
  64. package/dist/components/Checkbox/Checkbox.d.mts +1 -6
  65. package/dist/components/Checkbox/Checkbox.d.mts.map +1 -1
  66. package/dist/components/Checkbox/Checkbox.types.cjs.map +1 -1
  67. package/dist/components/Checkbox/Checkbox.types.d.cts +2 -28
  68. package/dist/components/Checkbox/Checkbox.types.d.cts.map +1 -1
  69. package/dist/components/Checkbox/Checkbox.types.d.mts +2 -28
  70. package/dist/components/Checkbox/Checkbox.types.d.mts.map +1 -1
  71. package/dist/components/Checkbox/Checkbox.types.mjs.map +1 -1
  72. package/dist/components/HeaderRoot/HeaderRoot.cjs +6 -15
  73. package/dist/components/HeaderRoot/HeaderRoot.cjs.map +1 -1
  74. package/dist/components/HeaderRoot/HeaderRoot.d.cts.map +1 -1
  75. package/dist/components/HeaderRoot/HeaderRoot.d.mts.map +1 -1
  76. package/dist/components/HeaderRoot/HeaderRoot.mjs +6 -15
  77. package/dist/components/HeaderRoot/HeaderRoot.mjs.map +1 -1
  78. package/dist/components/Icon/Icon.assets.cjs +283 -283
  79. package/dist/components/Icon/Icon.assets.cjs.map +1 -1
  80. package/dist/components/Icon/Icon.assets.mjs +2 -2
  81. package/dist/components/Icon/Icon.assets.mjs.map +1 -1
  82. package/dist/components/Icon/Icon.cjs +4 -3
  83. package/dist/components/Icon/Icon.cjs.map +1 -1
  84. package/dist/components/Icon/Icon.constants.cjs +6 -6
  85. package/dist/components/Icon/Icon.constants.cjs.map +1 -1
  86. package/dist/components/Icon/Icon.constants.d.cts +1 -1
  87. package/dist/components/Icon/Icon.constants.d.cts.map +1 -1
  88. package/dist/components/Icon/Icon.constants.d.mts +1 -1
  89. package/dist/components/Icon/Icon.constants.d.mts.map +1 -1
  90. package/dist/components/Icon/Icon.constants.mjs +1 -1
  91. package/dist/components/Icon/Icon.constants.mjs.map +1 -1
  92. package/dist/components/Icon/Icon.d.cts.map +1 -1
  93. package/dist/components/Icon/Icon.d.mts.map +1 -1
  94. package/dist/components/Icon/Icon.mjs +3 -2
  95. package/dist/components/Icon/Icon.mjs.map +1 -1
  96. package/dist/components/Icon/Icon.types.cjs.map +1 -1
  97. package/dist/components/Icon/Icon.types.d.cts +3 -4
  98. package/dist/components/Icon/Icon.types.d.cts.map +1 -1
  99. package/dist/components/Icon/Icon.types.d.mts +3 -4
  100. package/dist/components/Icon/Icon.types.d.mts.map +1 -1
  101. package/dist/components/Icon/Icon.types.mjs.map +1 -1
  102. package/dist/components/Icon/assets/after-hours.svg +1 -1
  103. package/dist/components/Icon/index.cjs +4 -4
  104. package/dist/components/Icon/index.cjs.map +1 -1
  105. package/dist/components/Icon/index.d.cts +1 -1
  106. package/dist/components/Icon/index.d.cts.map +1 -1
  107. package/dist/components/Icon/index.d.mts +1 -1
  108. package/dist/components/Icon/index.d.mts.map +1 -1
  109. package/dist/components/Icon/index.mjs +1 -1
  110. package/dist/components/Icon/index.mjs.map +1 -1
  111. package/dist/components/IconAlert/IconAlert.cjs +16 -0
  112. package/dist/components/IconAlert/IconAlert.cjs.map +1 -0
  113. package/dist/components/IconAlert/IconAlert.constants.cjs +24 -0
  114. package/dist/components/IconAlert/IconAlert.constants.cjs.map +1 -0
  115. package/dist/components/IconAlert/IconAlert.constants.d.cts +7 -0
  116. package/dist/components/IconAlert/IconAlert.constants.d.cts.map +1 -0
  117. package/dist/components/IconAlert/IconAlert.constants.d.mts +7 -0
  118. package/dist/components/IconAlert/IconAlert.constants.d.mts.map +1 -0
  119. package/dist/components/IconAlert/IconAlert.constants.mjs +21 -0
  120. package/dist/components/IconAlert/IconAlert.constants.mjs.map +1 -0
  121. package/dist/components/IconAlert/IconAlert.d.cts +7 -0
  122. package/dist/components/IconAlert/IconAlert.d.cts.map +1 -0
  123. package/dist/components/IconAlert/IconAlert.d.mts +7 -0
  124. package/dist/components/IconAlert/IconAlert.d.mts.map +1 -0
  125. package/dist/components/IconAlert/IconAlert.mjs +16 -0
  126. package/dist/components/IconAlert/IconAlert.mjs.map +1 -0
  127. package/dist/components/IconAlert/IconAlert.types.cjs +3 -0
  128. package/dist/components/IconAlert/IconAlert.types.cjs.map +1 -0
  129. package/dist/components/IconAlert/IconAlert.types.d.cts +4 -0
  130. package/dist/components/IconAlert/IconAlert.types.d.cts.map +1 -0
  131. package/dist/components/IconAlert/IconAlert.types.d.mts +4 -0
  132. package/dist/components/IconAlert/IconAlert.types.d.mts.map +1 -0
  133. package/dist/components/IconAlert/IconAlert.types.mjs +2 -0
  134. package/dist/components/IconAlert/IconAlert.types.mjs.map +1 -0
  135. package/dist/components/IconAlert/index.cjs +8 -0
  136. package/dist/components/IconAlert/index.cjs.map +1 -0
  137. package/dist/components/IconAlert/index.d.cts +4 -0
  138. package/dist/components/IconAlert/index.d.cts.map +1 -0
  139. package/dist/components/IconAlert/index.d.mts +4 -0
  140. package/dist/components/IconAlert/index.d.mts.map +1 -0
  141. package/dist/components/IconAlert/index.mjs +3 -0
  142. package/dist/components/IconAlert/index.mjs.map +1 -0
  143. package/dist/components/Input/Input.cjs +4 -4
  144. package/dist/components/Input/Input.cjs.map +1 -1
  145. package/dist/components/Input/Input.constants.cjs +15 -15
  146. package/dist/components/Input/Input.constants.cjs.map +1 -1
  147. package/dist/components/Input/Input.constants.d.cts +1 -1
  148. package/dist/components/Input/Input.constants.d.cts.map +1 -1
  149. package/dist/components/Input/Input.constants.d.mts +1 -1
  150. package/dist/components/Input/Input.constants.d.mts.map +1 -1
  151. package/dist/components/Input/Input.constants.mjs +1 -1
  152. package/dist/components/Input/Input.constants.mjs.map +1 -1
  153. package/dist/components/Input/Input.d.cts +3 -2
  154. package/dist/components/Input/Input.d.cts.map +1 -1
  155. package/dist/components/Input/Input.d.mts +3 -2
  156. package/dist/components/Input/Input.d.mts.map +1 -1
  157. package/dist/components/Input/Input.mjs +3 -3
  158. package/dist/components/Input/Input.mjs.map +1 -1
  159. package/dist/components/Input/Input.types.cjs.map +1 -1
  160. package/dist/components/Input/Input.types.d.cts +1 -1
  161. package/dist/components/Input/Input.types.d.cts.map +1 -1
  162. package/dist/components/Input/Input.types.d.mts +1 -1
  163. package/dist/components/Input/Input.types.d.mts.map +1 -1
  164. package/dist/components/Input/Input.types.mjs.map +1 -1
  165. package/dist/components/KeyValueColumn/KeyValueColumn.cjs +7 -6
  166. package/dist/components/KeyValueColumn/KeyValueColumn.cjs.map +1 -1
  167. package/dist/components/KeyValueColumn/KeyValueColumn.d.cts.map +1 -1
  168. package/dist/components/KeyValueColumn/KeyValueColumn.d.mts.map +1 -1
  169. package/dist/components/KeyValueColumn/KeyValueColumn.mjs +2 -1
  170. package/dist/components/KeyValueColumn/KeyValueColumn.mjs.map +1 -1
  171. package/dist/components/KeyValueRow/KeyValueRow.cjs +6 -6
  172. package/dist/components/KeyValueRow/KeyValueRow.cjs.map +1 -1
  173. package/dist/components/KeyValueRow/KeyValueRow.d.cts.map +1 -1
  174. package/dist/components/KeyValueRow/KeyValueRow.d.mts.map +1 -1
  175. package/dist/components/KeyValueRow/KeyValueRow.mjs +2 -2
  176. package/dist/components/KeyValueRow/KeyValueRow.mjs.map +1 -1
  177. package/dist/components/RadioButton/RadioButton.types.d.cts +1 -0
  178. package/dist/components/RadioButton/RadioButton.types.d.cts.map +1 -1
  179. package/dist/components/RadioButton/RadioButton.types.d.mts +1 -0
  180. package/dist/components/RadioButton/RadioButton.types.d.mts.map +1 -1
  181. package/dist/components/SensitiveText/SensitiveText.types.d.cts +1 -0
  182. package/dist/components/SensitiveText/SensitiveText.types.d.cts.map +1 -1
  183. package/dist/components/SensitiveText/SensitiveText.types.d.mts +1 -0
  184. package/dist/components/SensitiveText/SensitiveText.types.d.mts.map +1 -1
  185. package/dist/components/Text/Text.cjs +5 -5
  186. package/dist/components/Text/Text.cjs.map +1 -1
  187. package/dist/components/Text/Text.constants.cjs +20 -25
  188. package/dist/components/Text/Text.constants.cjs.map +1 -1
  189. package/dist/components/Text/Text.constants.d.cts +2 -2
  190. package/dist/components/Text/Text.constants.d.cts.map +1 -1
  191. package/dist/components/Text/Text.constants.d.mts +2 -2
  192. package/dist/components/Text/Text.constants.d.mts.map +1 -1
  193. package/dist/components/Text/Text.constants.mjs +16 -21
  194. package/dist/components/Text/Text.constants.mjs.map +1 -1
  195. package/dist/components/Text/Text.d.cts.map +1 -1
  196. package/dist/components/Text/Text.d.mts.map +1 -1
  197. package/dist/components/Text/Text.mjs +3 -3
  198. package/dist/components/Text/Text.mjs.map +1 -1
  199. package/dist/components/Text/Text.types.cjs.map +1 -1
  200. package/dist/components/Text/Text.types.d.cts +3 -35
  201. package/dist/components/Text/Text.types.d.cts.map +1 -1
  202. package/dist/components/Text/Text.types.d.mts +3 -35
  203. package/dist/components/Text/Text.types.d.mts.map +1 -1
  204. package/dist/components/Text/Text.types.mjs.map +1 -1
  205. package/dist/components/Text/index.cjs +7 -7
  206. package/dist/components/Text/index.cjs.map +1 -1
  207. package/dist/components/Text/index.d.cts +1 -1
  208. package/dist/components/Text/index.d.cts.map +1 -1
  209. package/dist/components/Text/index.d.mts +1 -1
  210. package/dist/components/Text/index.d.mts.map +1 -1
  211. package/dist/components/Text/index.mjs +1 -1
  212. package/dist/components/Text/index.mjs.map +1 -1
  213. package/dist/components/TextButton/TextButton.cjs +3 -3
  214. package/dist/components/TextButton/TextButton.cjs.map +1 -1
  215. package/dist/components/TextButton/TextButton.d.cts.map +1 -1
  216. package/dist/components/TextButton/TextButton.d.mts.map +1 -1
  217. package/dist/components/TextButton/TextButton.mjs +1 -1
  218. package/dist/components/TextButton/TextButton.mjs.map +1 -1
  219. package/dist/components/TextButton/TextButton.types.d.cts +1 -0
  220. package/dist/components/TextButton/TextButton.types.d.cts.map +1 -1
  221. package/dist/components/TextButton/TextButton.types.d.mts +1 -0
  222. package/dist/components/TextButton/TextButton.types.d.mts.map +1 -1
  223. package/dist/components/TextField/TextField.cjs +2 -2
  224. package/dist/components/TextField/TextField.cjs.map +1 -1
  225. package/dist/components/TextField/TextField.d.cts +1 -0
  226. package/dist/components/TextField/TextField.d.cts.map +1 -1
  227. package/dist/components/TextField/TextField.d.mts +1 -0
  228. package/dist/components/TextField/TextField.d.mts.map +1 -1
  229. package/dist/components/TextField/TextField.mjs +1 -1
  230. package/dist/components/TextField/TextField.mjs.map +1 -1
  231. package/dist/components/Toast/Toast.cjs +0 -1
  232. package/dist/components/Toast/Toast.cjs.map +1 -1
  233. package/dist/components/Toast/Toast.d.cts.map +1 -1
  234. package/dist/components/Toast/Toast.d.mts.map +1 -1
  235. package/dist/components/Toast/Toast.mjs +0 -1
  236. package/dist/components/Toast/Toast.mjs.map +1 -1
  237. package/dist/components/index.cjs +5 -2
  238. package/dist/components/index.cjs.map +1 -1
  239. package/dist/components/index.d.cts +2 -0
  240. package/dist/components/index.d.cts.map +1 -1
  241. package/dist/components/index.d.mts +2 -0
  242. package/dist/components/index.d.mts.map +1 -1
  243. package/dist/components/index.mjs +1 -0
  244. package/dist/components/index.mjs.map +1 -1
  245. package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts +1 -0
  246. package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts.map +1 -1
  247. package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts +1 -0
  248. package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts.map +1 -1
  249. package/dist/types/index.cjs +354 -112
  250. package/dist/types/index.cjs.map +1 -1
  251. package/dist/types/index.d.cts +321 -75
  252. package/dist/types/index.d.cts.map +1 -1
  253. package/dist/types/index.d.mts +321 -75
  254. package/dist/types/index.d.mts.map +1 -1
  255. package/dist/types/index.mjs +349 -103
  256. package/dist/types/index.mjs.map +1 -1
  257. package/package.json +23 -20
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HeaderRoot = void 0;
7
7
  // Third party dependencies.
8
- const design_system_shared_1 = require("@metamask-previews/design-system-shared");
9
8
  const react_1 = __importDefault(require("react"));
10
9
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
11
10
  // External dependencies.
@@ -15,10 +14,6 @@ const ButtonIcon_1 = require("../ButtonIcon/index.cjs");
15
14
  const Text_1 = require("../Text/index.cjs");
16
15
  const HeaderRoot = ({ children, title, titleProps, titleAccessory, endAccessory, endButtonIconProps, includesTopInset = false, style, testID, twClassName, ...viewProps }) => {
17
16
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
18
- const hasRenderableChildren = (0, design_system_shared_1.isReactNodeRenderable)(children);
19
- const hasTitleContent = title !== false &&
20
- ((0, design_system_shared_1.isReactNodeRenderable)(title) || (0, design_system_shared_1.isReactNodeRenderable)(titleAccessory));
21
- const shouldRenderTitleRow = !hasRenderableChildren && hasTitleContent;
22
17
  const endSectionContent = (() => {
23
18
  if (endAccessory) {
24
19
  return endAccessory;
@@ -31,27 +26,23 @@ const HeaderRoot = ({ children, title, titleProps, titleAccessory, endAccessory,
31
26
  }
32
27
  return null;
33
28
  })();
34
- const hasEndSection = Boolean(endSectionContent);
35
29
  const renderLeftSection = () => {
36
- if (hasRenderableChildren) {
30
+ if (children) {
37
31
  return children;
38
32
  }
39
- if (shouldRenderTitleRow) {
40
- const titleNode = (0, design_system_shared_1.isReactNodeRenderable)(title) && title !== '' ? title : null;
33
+ if (title) {
41
34
  return (<BoxRow_1.BoxRow endAccessory={titleAccessory} textProps={{
42
35
  variant: Text_1.TextVariant.HeadingLg,
43
36
  ...titleProps,
44
- }}>
45
- {titleNode}
37
+ }} twClassName="flex-1">
38
+ {title}
46
39
  </BoxRow_1.BoxRow>);
47
40
  }
48
41
  return null;
49
42
  };
50
43
  return (<Box_1.Box flexDirection={Box_1.BoxFlexDirection.Row} alignItems={Box_1.BoxAlignItems.Center} gap={4} paddingLeft={4} paddingRight={2} twClassName={`min-h-14 ${twClassName ?? ''}`.trim()} style={[includesTopInset && { marginTop: insets.top }, style]} testID={testID} {...viewProps}>
51
- <Box_1.Box alignItems={Box_1.BoxAlignItems.Start} style={{ flex: 1 }}>
52
- {renderLeftSection()}
53
- </Box_1.Box>
54
- {hasEndSection ? (<Box_1.Box flexDirection={Box_1.BoxFlexDirection.Row} gap={2}>
44
+ {renderLeftSection()}
45
+ {endSectionContent ? (<Box_1.Box flexDirection={Box_1.BoxFlexDirection.Row} gap={2} twClassName="ml-auto">
55
46
  {endSectionContent}
56
47
  </Box_1.Box>) : null}
57
48
  </Box_1.Box>);
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderRoot.cjs","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,kFAAgF;AAChF,kDAA0B;AAC1B,mFAAmE;AAEnE,yBAAyB;AACzB,0CAA8D;AAC9D,gDAAmC;AACnC,wDAA2D;AAC3D,4CAAsC;AAK/B,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GAAG,KAAK,EACxB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,SAAS,EACI,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,IAAA,kDAAiB,GAAE,CAAC;IAEnC,MAAM,qBAAqB,GAAG,IAAA,4CAAqB,EAAC,QAAQ,CAAC,CAAC;IA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Third party dependencies.\nimport { isReactNodeRenderable } from '@metamask-previews/design-system-shared';\nimport React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { Box, BoxAlignItems, BoxFlexDirection } from '../Box';\nimport { BoxRow } from '../BoxRow';\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { TextVariant } from '../Text';\n\n// Internal dependencies.\nimport type { HeaderRootProps } from './HeaderRoot.types';\n\nexport const HeaderRoot = ({\n children,\n title,\n titleProps,\n titleAccessory,\n endAccessory,\n endButtonIconProps,\n includesTopInset = false,\n style,\n testID,\n twClassName,\n ...viewProps\n}: HeaderRootProps) => {\n const insets = useSafeAreaInsets();\n\n const hasRenderableChildren = isReactNodeRenderable(children);\n\n const hasTitleContent =\n title !== false &&\n (isReactNodeRenderable(title) || isReactNodeRenderable(titleAccessory));\n\n const shouldRenderTitleRow = !hasRenderableChildren && hasTitleContent;\n\n const endSectionContent = (() => {\n if (endAccessory) {\n return endAccessory;\n }\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n const reversedProps = endButtonIconProps\n .map((props, originalIndex) => ({ props, originalIndex }))\n .reverse();\n return reversedProps.map(({ props, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...props}\n />\n ));\n }\n return null;\n })();\n\n const hasEndSection = Boolean(endSectionContent);\n\n const renderLeftSection = () => {\n if (hasRenderableChildren) {\n return children;\n }\n if (shouldRenderTitleRow) {\n const titleNode =\n isReactNodeRenderable(title) && title !== '' ? title : null;\n return (\n <BoxRow\n endAccessory={titleAccessory}\n textProps={{\n variant: TextVariant.HeadingLg,\n ...titleProps,\n }}\n >\n {titleNode}\n </BoxRow>\n );\n }\n return null;\n };\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={4}\n paddingLeft={4}\n paddingRight={2}\n twClassName={`min-h-14 ${twClassName ?? ''}`.trim()}\n style={[includesTopInset && { marginTop: insets.top }, style]}\n testID={testID}\n {...viewProps}\n >\n <Box alignItems={BoxAlignItems.Start} style={{ flex: 1 }}>\n {renderLeftSection()}\n </Box>\n {hasEndSection ? (\n <Box flexDirection={BoxFlexDirection.Row} gap={2}>\n {endSectionContent}\n </Box>\n ) : null}\n </Box>\n );\n};\n\nHeaderRoot.displayName = 'HeaderRoot';\n"]}
1
+ {"version":3,"file":"HeaderRoot.cjs","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,kDAA0B;AAC1B,mFAAmE;AAEnE,yBAAyB;AACzB,0CAA8D;AAC9D,gDAAmC;AACnC,wDAA2D;AAC3D,4CAAsC;AAK/B,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GAAG,KAAK,EACxB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,SAAS,EACI,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,IAAA,kDAAiB,GAAE,CAAC;IAEnC,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE;QAC9B,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC;SACrB;QACD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;YACvD,MAAM,aAAa,GAAG,kBAAkB;iBACrC,GAAG,CAAC,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;iBACzD,OAAO,EAAE,CAAC;YACb,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CACrD,CAAC,uBAAU,CACT,GAAG,CAAC,CAAC,mBAAmB,aAAa,EAAE,CAAC,CACxC,IAAI,CAAC,CAAC,2BA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AA,CAAC,iBAAiB,CACpB;QAAA,EAAE,SAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,SAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AA3EW,QAAA,UAAU,cA2ErB;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { Box, BoxAlignItems, BoxFlexDirection } from '../Box';\nimport { BoxRow } from '../BoxRow';\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { TextVariant } from '../Text';\n\n// Internal dependencies.\nimport type { HeaderRootProps } from './HeaderRoot.types';\n\nexport const HeaderRoot = ({\n children,\n title,\n titleProps,\n titleAccessory,\n endAccessory,\n endButtonIconProps,\n includesTopInset = false,\n style,\n testID,\n twClassName,\n ...viewProps\n}: HeaderRootProps) => {\n const insets = useSafeAreaInsets();\n\n const endSectionContent = (() => {\n if (endAccessory) {\n return endAccessory;\n }\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n const reversedProps = endButtonIconProps\n .map((props, originalIndex) => ({ props, originalIndex }))\n .reverse();\n return reversedProps.map(({ props, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...props}\n />\n ));\n }\n return null;\n })();\n\n const renderLeftSection = () => {\n if (children) {\n return children;\n }\n if (title) {\n return (\n <BoxRow\n endAccessory={titleAccessory}\n textProps={{\n variant: TextVariant.HeadingLg,\n ...titleProps,\n }}\n twClassName=\"flex-1\"\n >\n {title}\n </BoxRow>\n );\n }\n return null;\n };\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={4}\n paddingLeft={4}\n paddingRight={2}\n twClassName={`min-h-14 ${twClassName ?? ''}`.trim()}\n style={[includesTopInset && { marginTop: insets.top }, style]}\n testID={testID}\n {...viewProps}\n >\n {renderLeftSection()}\n {endSectionContent ? (\n <Box flexDirection={BoxFlexDirection.Row} gap={2} twClassName=\"ml-auto\">\n {endSectionContent}\n </Box>\n ) : null}\n </Box>\n );\n};\n\nHeaderRoot.displayName = 'HeaderRoot';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderRoot.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAU1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU;oJAYpB,eAAe;;CA4EjB,CAAC"}
1
+ {"version":3,"file":"HeaderRoot.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAU1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU;oJAYpB,eAAe;;CA+DjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderRoot.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAU1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU;oJAYpB,eAAe;;CA4EjB,CAAC"}
1
+ {"version":3,"file":"HeaderRoot.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAU1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU;oJAYpB,eAAe;;CA+DjB,CAAC"}
@@ -5,7 +5,6 @@ function $importDefault(module) {
5
5
  return module;
6
6
  }
7
7
  // Third party dependencies.
8
- import { isReactNodeRenderable } from "@metamask-previews/design-system-shared";
9
8
  import $React from "react";
10
9
  const React = $importDefault($React);
11
10
  import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -16,10 +15,6 @@ import { ButtonIcon, ButtonIconSize } from "../ButtonIcon/index.mjs";
16
15
  import { TextVariant } from "../Text/index.mjs";
17
16
  export const HeaderRoot = ({ children, title, titleProps, titleAccessory, endAccessory, endButtonIconProps, includesTopInset = false, style, testID, twClassName, ...viewProps }) => {
18
17
  const insets = useSafeAreaInsets();
19
- const hasRenderableChildren = isReactNodeRenderable(children);
20
- const hasTitleContent = title !== false &&
21
- (isReactNodeRenderable(title) || isReactNodeRenderable(titleAccessory));
22
- const shouldRenderTitleRow = !hasRenderableChildren && hasTitleContent;
23
18
  const endSectionContent = (() => {
24
19
  if (endAccessory) {
25
20
  return endAccessory;
@@ -32,27 +27,23 @@ export const HeaderRoot = ({ children, title, titleProps, titleAccessory, endAcc
32
27
  }
33
28
  return null;
34
29
  })();
35
- const hasEndSection = Boolean(endSectionContent);
36
30
  const renderLeftSection = () => {
37
- if (hasRenderableChildren) {
31
+ if (children) {
38
32
  return children;
39
33
  }
40
- if (shouldRenderTitleRow) {
41
- const titleNode = isReactNodeRenderable(title) && title !== '' ? title : null;
34
+ if (title) {
42
35
  return (<BoxRow endAccessory={titleAccessory} textProps={{
43
36
  variant: TextVariant.HeadingLg,
44
37
  ...titleProps,
45
- }}>
46
- {titleNode}
38
+ }} twClassName="flex-1">
39
+ {title}
47
40
  </BoxRow>);
48
41
  }
49
42
  return null;
50
43
  };
51
44
  return (<Box flexDirection={BoxFlexDirection.Row} alignItems={BoxAlignItems.Center} gap={4} paddingLeft={4} paddingRight={2} twClassName={`min-h-14 ${twClassName ?? ''}`.trim()} style={[includesTopInset && { marginTop: insets.top }, style]} testID={testID} {...viewProps}>
52
- <Box alignItems={BoxAlignItems.Start} style={{ flex: 1 }}>
53
- {renderLeftSection()}
54
- </Box>
55
- {hasEndSection ? (<Box flexDirection={BoxFlexDirection.Row} gap={2}>
45
+ {renderLeftSection()}
46
+ {endSectionContent ? (<Box flexDirection={BoxFlexDirection.Row} gap={2} twClassName="ml-auto">
56
47
  {endSectionContent}
57
48
  </Box>) : null}
58
49
  </Box>);
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderRoot.mjs","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,qBAAqB,EAAE,gDAAgD;AAChF,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,iBAAiB,EAAE,uCAAuC;AAEnE,yBAAyB;AACzB,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,gBAAgB,EAAE,yBAAe;AAC9D,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gCAAsB;AAC3D,OAAO,EAAE,WAAW,EAAE,0BAAgB;AAKtC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GAAG,KAAK,EACxB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,SAAS,EACI,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IAEnC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAE9D,MAAM,eAAe,GACnB,KAAK,KAAK,KAAK;QACf,CAAC,qBAAqB,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC;IAE1E,MAAM,oBAAoB,GAAG,CAAC,qBAAqB,IAAI,eAAe,CAAC;IAEvE,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE;QAC9B,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC;SACrB;QACD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;YACvD,MAAM,aAAa,GAAG,kBAAkB;iBACrC,GAA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C,CAAC,CAChB,WAAW,CAAC,CAAC,YAAY,WAAW,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CACpD,KAAK,CAAC,CAAC,CAAC,gBAAgB,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAC9D,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,IAAI,SAAS,CAAC,CAEd;MAAA,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACvD;QAAA,CAAC,iBAAiB,EAAE,CACtB;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,aAAa,CAAC,CAAC,CAAC,CACf,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAC/C;UAAA,CAAC,iBAAiB,CACpB;QAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport { isReactNodeRenderable } from '@metamask-previews/design-system-shared';\nimport React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { Box, BoxAlignItems, BoxFlexDirection } from '../Box';\nimport { BoxRow } from '../BoxRow';\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { TextVariant } from '../Text';\n\n// Internal dependencies.\nimport type { HeaderRootProps } from './HeaderRoot.types';\n\nexport const HeaderRoot = ({\n children,\n title,\n titleProps,\n titleAccessory,\n endAccessory,\n endButtonIconProps,\n includesTopInset = false,\n style,\n testID,\n twClassName,\n ...viewProps\n}: HeaderRootProps) => {\n const insets = useSafeAreaInsets();\n\n const hasRenderableChildren = isReactNodeRenderable(children);\n\n const hasTitleContent =\n title !== false &&\n (isReactNodeRenderable(title) || isReactNodeRenderable(titleAccessory));\n\n const shouldRenderTitleRow = !hasRenderableChildren && hasTitleContent;\n\n const endSectionContent = (() => {\n if (endAccessory) {\n return endAccessory;\n }\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n const reversedProps = endButtonIconProps\n .map((props, originalIndex) => ({ props, originalIndex }))\n .reverse();\n return reversedProps.map(({ props, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...props}\n />\n ));\n }\n return null;\n })();\n\n const hasEndSection = Boolean(endSectionContent);\n\n const renderLeftSection = () => {\n if (hasRenderableChildren) {\n return children;\n }\n if (shouldRenderTitleRow) {\n const titleNode =\n isReactNodeRenderable(title) && title !== '' ? title : null;\n return (\n <BoxRow\n endAccessory={titleAccessory}\n textProps={{\n variant: TextVariant.HeadingLg,\n ...titleProps,\n }}\n >\n {titleNode}\n </BoxRow>\n );\n }\n return null;\n };\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={4}\n paddingLeft={4}\n paddingRight={2}\n twClassName={`min-h-14 ${twClassName ?? ''}`.trim()}\n style={[includesTopInset && { marginTop: insets.top }, style]}\n testID={testID}\n {...viewProps}\n >\n <Box alignItems={BoxAlignItems.Start} style={{ flex: 1 }}>\n {renderLeftSection()}\n </Box>\n {hasEndSection ? (\n <Box flexDirection={BoxFlexDirection.Row} gap={2}>\n {endSectionContent}\n </Box>\n ) : null}\n </Box>\n );\n};\n\nHeaderRoot.displayName = 'HeaderRoot';\n"]}
1
+ {"version":3,"file":"HeaderRoot.mjs","sourceRoot":"","sources":["../../../src/components/HeaderRoot/HeaderRoot.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,iBAAiB,EAAE,uCAAuC;AAEnE,yBAAyB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M,CACL,YAAY,CAAC,CAAC,cAAc,CAAC,CAC7B,SAAS,CAAC,CAAC;oBACT,OAAO,EAAE,WAAW,CAAC,SAAS;oBAC9B,GAAG,UAAU;iBACd,CAAC,CACF,WAAW,CAAC,QAAQ,CAEpB;UAAA,CAAC,KAAK,CACR;QAAA,EAAE,MAAM,CAAC,CACV,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CACF,aAAa,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CACpC,UAAU,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CACjC,GAAG,CAAC,CAAC,CAAC,CAAC,CACP,WAAW,CAAC,CAAC,CAAC,CAAC,CACf,YAAY,CAAC,CAAC,CAAC,CAAC,CAChB,WAAW,CAAC,CAAC,YAAY,WAAW,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CACpD,KAAK,CAAC,CAAC,CAAC,gBAAgB,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAC9D,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,IAAI,SAAS,CAAC,CAEd;MAAA,CAAC,iBAAiB,EAAE,CACpB;MAAA,CAAC,iBAAiB,CAAC,CAAC,CAAC,CACnB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CACrE;UAAA,CAAC,iBAAiB,CACpB;QAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["// Third party dependencies.\nimport React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { Box, BoxAlignItems, BoxFlexDirection } from '../Box';\nimport { BoxRow } from '../BoxRow';\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { TextVariant } from '../Text';\n\n// Internal dependencies.\nimport type { HeaderRootProps } from './HeaderRoot.types';\n\nexport const HeaderRoot = ({\n children,\n title,\n titleProps,\n titleAccessory,\n endAccessory,\n endButtonIconProps,\n includesTopInset = false,\n style,\n testID,\n twClassName,\n ...viewProps\n}: HeaderRootProps) => {\n const insets = useSafeAreaInsets();\n\n const endSectionContent = (() => {\n if (endAccessory) {\n return endAccessory;\n }\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n const reversedProps = endButtonIconProps\n .map((props, originalIndex) => ({ props, originalIndex }))\n .reverse();\n return reversedProps.map(({ props, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...props}\n />\n ));\n }\n return null;\n })();\n\n const renderLeftSection = () => {\n if (children) {\n return children;\n }\n if (title) {\n return (\n <BoxRow\n endAccessory={titleAccessory}\n textProps={{\n variant: TextVariant.HeadingLg,\n ...titleProps,\n }}\n twClassName=\"flex-1\"\n >\n {title}\n </BoxRow>\n );\n }\n return null;\n };\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={4}\n paddingLeft={4}\n paddingRight={2}\n twClassName={`min-h-14 ${twClassName ?? ''}`.trim()}\n style={[includesTopInset && { marginTop: insets.top }, style]}\n testID={testID}\n {...viewProps}\n >\n {renderLeftSection()}\n {endSectionContent ? (\n <Box flexDirection={BoxFlexDirection.Row} gap={2} twClassName=\"ml-auto\">\n {endSectionContent}\n </Box>\n ) : null}\n </Box>\n );\n};\n\nHeaderRoot.displayName = 'HeaderRoot';\n"]}