@metamask-previews/design-system-react-native 0.11.0-preview.3aca0bd → 0.11.0-preview.9c677c4

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 (57) hide show
  1. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.cjs +33 -0
  2. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.cjs.map +1 -0
  3. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.d.cts +14 -0
  4. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.d.cts.map +1 -0
  5. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.d.mts +14 -0
  6. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.d.mts.map +1 -0
  7. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.mjs +35 -0
  8. package/dist/components/KeyValueRow/KeyValueLabel/KeyValueLabel.mjs.map +1 -0
  9. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.cjs +39 -0
  10. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.cjs.map +1 -0
  11. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.d.cts +25 -0
  12. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.d.cts.map +1 -0
  13. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.d.mts +25 -0
  14. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.d.mts.map +1 -0
  15. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.mjs +41 -0
  16. package/dist/components/KeyValueRow/KeyValueRoot/KeyValueRoot.mjs.map +1 -0
  17. package/dist/components/KeyValueRow/KeyValueRow.cjs +76 -0
  18. package/dist/components/KeyValueRow/KeyValueRow.cjs.map +1 -0
  19. package/dist/components/KeyValueRow/KeyValueRow.d.cts +25 -0
  20. package/dist/components/KeyValueRow/KeyValueRow.d.cts.map +1 -0
  21. package/dist/components/KeyValueRow/KeyValueRow.d.mts +25 -0
  22. package/dist/components/KeyValueRow/KeyValueRow.d.mts.map +1 -0
  23. package/dist/components/KeyValueRow/KeyValueRow.mjs +77 -0
  24. package/dist/components/KeyValueRow/KeyValueRow.mjs.map +1 -0
  25. package/dist/components/KeyValueRow/KeyValueRow.types.cjs +29 -0
  26. package/dist/components/KeyValueRow/KeyValueRow.types.cjs.map +1 -0
  27. package/dist/components/KeyValueRow/KeyValueRow.types.d.cts +177 -0
  28. package/dist/components/KeyValueRow/KeyValueRow.types.d.cts.map +1 -0
  29. package/dist/components/KeyValueRow/KeyValueRow.types.d.mts +177 -0
  30. package/dist/components/KeyValueRow/KeyValueRow.types.d.mts.map +1 -0
  31. package/dist/components/KeyValueRow/KeyValueRow.types.mjs +26 -0
  32. package/dist/components/KeyValueRow/KeyValueRow.types.mjs.map +1 -0
  33. package/dist/components/KeyValueRow/KeyValueRow.utils.cjs +6 -0
  34. package/dist/components/KeyValueRow/KeyValueRow.utils.cjs.map +1 -0
  35. package/dist/components/KeyValueRow/KeyValueRow.utils.d.cts +3 -0
  36. package/dist/components/KeyValueRow/KeyValueRow.utils.d.cts.map +1 -0
  37. package/dist/components/KeyValueRow/KeyValueRow.utils.d.mts +3 -0
  38. package/dist/components/KeyValueRow/KeyValueRow.utils.d.mts.map +1 -0
  39. package/dist/components/KeyValueRow/KeyValueRow.utils.mjs +2 -0
  40. package/dist/components/KeyValueRow/KeyValueRow.utils.mjs.map +1 -0
  41. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.cjs +29 -0
  42. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.cjs.map +1 -0
  43. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.d.cts +17 -0
  44. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.d.cts.map +1 -0
  45. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.d.mts +17 -0
  46. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.d.mts.map +1 -0
  47. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.mjs +31 -0
  48. package/dist/components/KeyValueRow/KeyValueSection/KeyValueSection.mjs.map +1 -0
  49. package/dist/components/KeyValueRow/index.cjs +15 -0
  50. package/dist/components/KeyValueRow/index.cjs.map +1 -0
  51. package/dist/components/KeyValueRow/index.d.cts +3 -0
  52. package/dist/components/KeyValueRow/index.d.cts.map +1 -0
  53. package/dist/components/KeyValueRow/index.d.mts +3 -0
  54. package/dist/components/KeyValueRow/index.d.mts.map +1 -0
  55. package/dist/components/KeyValueRow/index.mjs +3 -0
  56. package/dist/components/KeyValueRow/index.mjs.map +1 -0
  57. package/package.json +4 -4
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
7
+ const react_1 = __importDefault(require("react"));
8
+ const react_native_1 = require("react-native/index.js");
9
+ const ButtonIcon_1 = require("../../ButtonIcon/index.cjs");
10
+ const Icon_1 = require("../../Icon/index.cjs");
11
+ const Text_1 = require("../../Text/index.cjs");
12
+ const KeyValueRow_utils_1 = require("../KeyValueRow.utils.cjs");
13
+ /**
14
+ * A label and optional tooltip button component.
15
+ *
16
+ * @param props - Component props.
17
+ * @param props.label - The label content to display.
18
+ * @param props.tooltip - Optional tooltip to render to the right of the label.
19
+ *
20
+ * @returns The rendered KeyValueRowLabel component.
21
+ */
22
+ const KeyValueRowLabel = ({ label, tooltip, }) => {
23
+ const tw = (0, design_system_twrnc_preset_1.useTailwind)();
24
+ const hasTooltip = Boolean(tooltip?.title && tooltip?.content);
25
+ return (<react_native_1.View style={tw.style('flex-row items-center')}>
26
+ {(0, KeyValueRow_utils_1.isPreDefinedKeyValueRowLabel)(label) ? (<Text_1.Text variant={label.variant ?? Text_1.TextVariant.BodyMd} color={label.color ?? Text_1.TextColor.TextDefault}>
27
+ {label.text}
28
+ </Text_1.Text>) : (label)}
29
+ {hasTooltip && tooltip && (<ButtonIcon_1.ButtonIcon size={tooltip.size ?? ButtonIcon_1.ButtonIconSize.Md} iconName={tooltip.iconName ?? Icon_1.IconName.Question} accessibilityLabel={`${tooltip.title} tooltip`} onPress={() => tooltip?.onPress?.()}/>)}
30
+ </react_native_1.View>);
31
+ };
32
+ exports.default = KeyValueRowLabel;
33
+ //# sourceMappingURL=KeyValueLabel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueLabel.cjs","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueLabel/KeyValueLabel.tsx"],"names":[],"mappings":";;;;;AAAA,8FAA4E;AAC5E,kDAA0B;AAC1B,wDAAoC;AAEpC,2DAA8D;AAC9D,+CAAsC;AACtC,+CAA0D;AAE1D,gEAAoE;AAEpE;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAoC,CAAC,EACzD,KAAK,EACL,OAAO,GACR,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,OAAO,CAAC,CAAC;IAE/D,OAAO,CACL,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAC7C;MAAA,CAAC,IAAA,gDAA4B,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACrC,CAAC,WAAI,CACH,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,kBAAW,CAAC,MAAM,CAAC,CAC7C,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,gBAAS,CAAC,WAAW,CAAC,CAE5C;UAAA,CAAC,KAAK,CAAC,IAAI,CACb;QAAA,EAAE,WAAI,CAAC,CACR,CAAC,CAAC,CAAC,CACF,KAAK,CACN,CACD;MAAA,CAAC,UAAU,IAAI,OAAO,IAAI,CACxB,CAAC,uBAAU,CACT,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,2BAAc,CAAC,EAAE,CAAC,CACxC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,eAAQ,CAAC,QAAQ,CAAC,CAChD,kBAAkB,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,UAAU,CAAC,CAC/C,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EACpC,CACH,CACH;IAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { ButtonIcon, ButtonIconSize } from '../../ButtonIcon';\nimport { IconName } from '../../Icon';\nimport { Text, TextColor, TextVariant } from '../../Text';\nimport type { KeyValueRowLabelProps } from '../KeyValueRow.types';\nimport { isPreDefinedKeyValueRowLabel } from '../KeyValueRow.utils';\n\n/**\n * A label and optional tooltip button component.\n *\n * @param props - Component props.\n * @param props.label - The label content to display.\n * @param props.tooltip - Optional tooltip to render to the right of the label.\n *\n * @returns The rendered KeyValueRowLabel component.\n */\nconst KeyValueRowLabel: React.FC<KeyValueRowLabelProps> = ({\n label,\n tooltip,\n}) => {\n const tw = useTailwind();\n\n const hasTooltip = Boolean(tooltip?.title && tooltip?.content);\n\n return (\n <View style={tw.style('flex-row items-center')}>\n {isPreDefinedKeyValueRowLabel(label) ? (\n <Text\n variant={label.variant ?? TextVariant.BodyMd}\n color={label.color ?? TextColor.TextDefault}\n >\n {label.text}\n </Text>\n ) : (\n label\n )}\n {hasTooltip && tooltip && (\n <ButtonIcon\n size={tooltip.size ?? ButtonIconSize.Md}\n iconName={tooltip.iconName ?? IconName.Question}\n accessibilityLabel={`${tooltip.title} tooltip`}\n onPress={() => tooltip?.onPress?.()}\n />\n )}\n </View>\n );\n};\n\nexport default KeyValueRowLabel;\n"]}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import type { KeyValueRowLabelProps } from "../KeyValueRow.types.cjs";
3
+ /**
4
+ * A label and optional tooltip button component.
5
+ *
6
+ * @param props - Component props.
7
+ * @param props.label - The label content to display.
8
+ * @param props.tooltip - Optional tooltip to render to the right of the label.
9
+ *
10
+ * @returns The rendered KeyValueRowLabel component.
11
+ */
12
+ declare const KeyValueRowLabel: React.FC<KeyValueRowLabelProps>;
13
+ export default KeyValueRowLabel;
14
+ //# sourceMappingURL=KeyValueLabel.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueLabel.d.cts","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueLabel/KeyValueLabel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAM1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,iCAA6B;AAGlE;;;;;;;;GAQG;AACH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8BrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import type { KeyValueRowLabelProps } from "../KeyValueRow.types.mjs";
3
+ /**
4
+ * A label and optional tooltip button component.
5
+ *
6
+ * @param props - Component props.
7
+ * @param props.label - The label content to display.
8
+ * @param props.tooltip - Optional tooltip to render to the right of the label.
9
+ *
10
+ * @returns The rendered KeyValueRowLabel component.
11
+ */
12
+ declare const KeyValueRowLabel: React.FC<KeyValueRowLabelProps>;
13
+ export default KeyValueRowLabel;
14
+ //# sourceMappingURL=KeyValueLabel.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueLabel.d.mts","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueLabel/KeyValueLabel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAM1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,iCAA6B;AAGlE;;;;;;;;GAQG;AACH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8BrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,35 @@
1
+ function $importDefault(module) {
2
+ if (module?.__esModule) {
3
+ return module.default;
4
+ }
5
+ return module;
6
+ }
7
+ import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
8
+ import $React from "react";
9
+ const React = $importDefault($React);
10
+ import { View } from "react-native/index.js";
11
+ import { ButtonIcon, ButtonIconSize } from "../../ButtonIcon/index.mjs";
12
+ import { IconName } from "../../Icon/index.mjs";
13
+ import { Text, TextColor, TextVariant } from "../../Text/index.mjs";
14
+ import { isPreDefinedKeyValueRowLabel } from "../KeyValueRow.utils.mjs";
15
+ /**
16
+ * A label and optional tooltip button component.
17
+ *
18
+ * @param props - Component props.
19
+ * @param props.label - The label content to display.
20
+ * @param props.tooltip - Optional tooltip to render to the right of the label.
21
+ *
22
+ * @returns The rendered KeyValueRowLabel component.
23
+ */
24
+ const KeyValueRowLabel = ({ label, tooltip, }) => {
25
+ const tw = useTailwind();
26
+ const hasTooltip = Boolean(tooltip?.title && tooltip?.content);
27
+ return (<View style={tw.style('flex-row items-center')}>
28
+ {isPreDefinedKeyValueRowLabel(label) ? (<Text variant={label.variant ?? TextVariant.BodyMd} color={label.color ?? TextColor.TextDefault}>
29
+ {label.text}
30
+ </Text>) : (label)}
31
+ {hasTooltip && tooltip && (<ButtonIcon size={tooltip.size ?? ButtonIconSize.Md} iconName={tooltip.iconName ?? IconName.Question} accessibilityLabel={`${tooltip.title} tooltip`} onPress={() => tooltip?.onPress?.()}/>)}
32
+ </View>);
33
+ };
34
+ export default KeyValueRowLabel;
35
+ //# sourceMappingURL=KeyValueLabel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueLabel.mjs","sourceRoot":"","s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C,CAChD,kBAAkB,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,UAAU,CAAC,CAC/C,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EACpC,CACH,CACH;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { ButtonIcon, ButtonIconSize } from '../../ButtonIcon';\nimport { IconName } from '../../Icon';\nimport { Text, TextColor, TextVariant } from '../../Text';\nimport type { KeyValueRowLabelProps } from '../KeyValueRow.types';\nimport { isPreDefinedKeyValueRowLabel } from '../KeyValueRow.utils';\n\n/**\n * A label and optional tooltip button component.\n *\n * @param props - Component props.\n * @param props.label - The label content to display.\n * @param props.tooltip - Optional tooltip to render to the right of the label.\n *\n * @returns The rendered KeyValueRowLabel component.\n */\nconst KeyValueRowLabel: React.FC<KeyValueRowLabelProps> = ({\n label,\n tooltip,\n}) => {\n const tw = useTailwind();\n\n const hasTooltip = Boolean(tooltip?.title && tooltip?.content);\n\n return (\n <View style={tw.style('flex-row items-center')}>\n {isPreDefinedKeyValueRowLabel(label) ? (\n <Text\n variant={label.variant ?? TextVariant.BodyMd}\n color={label.color ?? TextColor.TextDefault}\n >\n {label.text}\n </Text>\n ) : (\n label\n )}\n {hasTooltip && tooltip && (\n <ButtonIcon\n size={tooltip.size ?? ButtonIconSize.Md}\n iconName={tooltip.iconName ?? IconName.Question}\n accessibilityLabel={`${tooltip.title} tooltip`}\n onPress={() => tooltip?.onPress?.()}\n />\n )}\n </View>\n );\n};\n\nexport default KeyValueRowLabel;\n"]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
7
+ const react_1 = __importDefault(require("react"));
8
+ const react_native_1 = require("react-native/index.js");
9
+ /**
10
+ * The main container for the KeyValueRow component.
11
+ * When creating custom KeyValueRow components, this must be the outermost component
12
+ * wrapping the two <KeyValueSection/> components.
13
+ *
14
+ * e.g.
15
+ * ```
16
+ * <KeyValueRowRoot>
17
+ * <KeyValueSection></KeyValueSection>
18
+ * <KeyValueSection></KeyValueSection>
19
+ * </KeyValueRowRoot>
20
+ * ```
21
+ *
22
+ * @param props - Component props.
23
+ * @param props.children - The two <KeyValueSection> children.
24
+ * @param props.twClassName - Optional Tailwind class names to override root styles.
25
+ * @param props.style - Optional additional styles for the root element.
26
+ *
27
+ * @returns The rendered Root component.
28
+ */
29
+ const KeyValueRowRoot = ({ children, twClassName, style, ...props }) => {
30
+ const tw = (0, design_system_twrnc_preset_1.useTailwind)();
31
+ return (<react_native_1.View style={[
32
+ tw.style('flex-row justify-between items-center overflow-hidden', twClassName),
33
+ style,
34
+ ]} {...props}>
35
+ {children}
36
+ </react_native_1.View>);
37
+ };
38
+ exports.default = KeyValueRowRoot;
39
+ //# sourceMappingURL=KeyValueRoot.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRoot.cjs","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueRoot/KeyValueRoot.tsx"],"names":[],"mappings":";;;;;AAAA,8FAA4E;AAC5E,kDAA0B;AAC1B,wDAAoC;AAIpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,eAAe,GAAmC,CAAC,EACvD,QAAQ,EACR,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,OAAO,CACL,CAAC,mBAAI,CACH,KAAK,CAAC,CAAC;YACL,EAAE,CAAC,KAAK,CACN,uDAAuD,EACvD,WAAW,CACZ;YACD,KAAK;SACN,CAAC,CACF,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport type { KeyValueRowRootProps } from '../KeyValueRow.types';\n\n/**\n * The main container for the KeyValueRow component.\n * When creating custom KeyValueRow components, this must be the outermost component\n * wrapping the two <KeyValueSection/> components.\n *\n * e.g.\n * ```\n * <KeyValueRowRoot>\n * <KeyValueSection></KeyValueSection>\n * <KeyValueSection></KeyValueSection>\n * </KeyValueRowRoot>\n * ```\n *\n * @param props - Component props.\n * @param props.children - The two <KeyValueSection> children.\n * @param props.twClassName - Optional Tailwind class names to override root styles.\n * @param props.style - Optional additional styles for the root element.\n *\n * @returns The rendered Root component.\n */\nconst KeyValueRowRoot: React.FC<KeyValueRowRootProps> = ({\n children,\n twClassName,\n style,\n ...props\n}) => {\n const tw = useTailwind();\n\n return (\n <View\n style={[\n tw.style(\n 'flex-row justify-between items-center overflow-hidden',\n twClassName,\n ),\n style,\n ]}\n {...props}\n >\n {children}\n </View>\n );\n};\n\nexport default KeyValueRowRoot;\n"]}
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import type { KeyValueRowRootProps } from "../KeyValueRow.types.cjs";
3
+ /**
4
+ * The main container for the KeyValueRow component.
5
+ * When creating custom KeyValueRow components, this must be the outermost component
6
+ * wrapping the two <KeyValueSection/> components.
7
+ *
8
+ * e.g.
9
+ * ```
10
+ * <KeyValueRowRoot>
11
+ * <KeyValueSection></KeyValueSection>
12
+ * <KeyValueSection></KeyValueSection>
13
+ * </KeyValueRowRoot>
14
+ * ```
15
+ *
16
+ * @param props - Component props.
17
+ * @param props.children - The two <KeyValueSection> children.
18
+ * @param props.twClassName - Optional Tailwind class names to override root styles.
19
+ * @param props.style - Optional additional styles for the root element.
20
+ *
21
+ * @returns The rendered Root component.
22
+ */
23
+ declare const KeyValueRowRoot: React.FC<KeyValueRowRootProps>;
24
+ export default KeyValueRowRoot;
25
+ //# sourceMappingURL=KeyValueRoot.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRoot.d.cts","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueRoot/KeyValueRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAG1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,iCAA6B;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsBnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import type { KeyValueRowRootProps } from "../KeyValueRow.types.mjs";
3
+ /**
4
+ * The main container for the KeyValueRow component.
5
+ * When creating custom KeyValueRow components, this must be the outermost component
6
+ * wrapping the two <KeyValueSection/> components.
7
+ *
8
+ * e.g.
9
+ * ```
10
+ * <KeyValueRowRoot>
11
+ * <KeyValueSection></KeyValueSection>
12
+ * <KeyValueSection></KeyValueSection>
13
+ * </KeyValueRowRoot>
14
+ * ```
15
+ *
16
+ * @param props - Component props.
17
+ * @param props.children - The two <KeyValueSection> children.
18
+ * @param props.twClassName - Optional Tailwind class names to override root styles.
19
+ * @param props.style - Optional additional styles for the root element.
20
+ *
21
+ * @returns The rendered Root component.
22
+ */
23
+ declare const KeyValueRowRoot: React.FC<KeyValueRowRootProps>;
24
+ export default KeyValueRowRoot;
25
+ //# sourceMappingURL=KeyValueRoot.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRoot.d.mts","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueRoot/KeyValueRoot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAG1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,iCAA6B;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsBnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,41 @@
1
+ function $importDefault(module) {
2
+ if (module?.__esModule) {
3
+ return module.default;
4
+ }
5
+ return module;
6
+ }
7
+ import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
8
+ import $React from "react";
9
+ const React = $importDefault($React);
10
+ import { View } from "react-native/index.js";
11
+ /**
12
+ * The main container for the KeyValueRow component.
13
+ * When creating custom KeyValueRow components, this must be the outermost component
14
+ * wrapping the two <KeyValueSection/> components.
15
+ *
16
+ * e.g.
17
+ * ```
18
+ * <KeyValueRowRoot>
19
+ * <KeyValueSection></KeyValueSection>
20
+ * <KeyValueSection></KeyValueSection>
21
+ * </KeyValueRowRoot>
22
+ * ```
23
+ *
24
+ * @param props - Component props.
25
+ * @param props.children - The two <KeyValueSection> children.
26
+ * @param props.twClassName - Optional Tailwind class names to override root styles.
27
+ * @param props.style - Optional additional styles for the root element.
28
+ *
29
+ * @returns The rendered Root component.
30
+ */
31
+ const KeyValueRowRoot = ({ children, twClassName, style, ...props }) => {
32
+ const tw = useTailwind();
33
+ return (<View style={[
34
+ tw.style('flex-row justify-between items-center overflow-hidden', twClassName),
35
+ style,
36
+ ]} {...props}>
37
+ {children}
38
+ </View>);
39
+ };
40
+ export default KeyValueRowRoot;
41
+ //# sourceMappingURL=KeyValueRoot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRoot.mjs","sourceRoot":"","sources":["../../../../src/components/KeyValueRow/KeyValueRoot/KeyValueRoot.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAIpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,eAAe,GAAmC,CAAC,EACvD,QAAQ,EACR,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;YACL,EAAE,CAAC,KAAK,CACN,uDAAuD,EACvD,WAAW,CACZ;YACD,KAAK;SACN,CAAC,CACF,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport type { KeyValueRowRootProps } from '../KeyValueRow.types';\n\n/**\n * The main container for the KeyValueRow component.\n * When creating custom KeyValueRow components, this must be the outermost component\n * wrapping the two <KeyValueSection/> components.\n *\n * e.g.\n * ```\n * <KeyValueRowRoot>\n * <KeyValueSection></KeyValueSection>\n * <KeyValueSection></KeyValueSection>\n * </KeyValueRowRoot>\n * ```\n *\n * @param props - Component props.\n * @param props.children - The two <KeyValueSection> children.\n * @param props.twClassName - Optional Tailwind class names to override root styles.\n * @param props.style - Optional additional styles for the root element.\n *\n * @returns The rendered Root component.\n */\nconst KeyValueRowRoot: React.FC<KeyValueRowRootProps> = ({\n children,\n twClassName,\n style,\n ...props\n}) => {\n const tw = useTailwind();\n\n return (\n <View\n style={[\n tw.style(\n 'flex-row justify-between items-center overflow-hidden',\n twClassName,\n ),\n style,\n ]}\n {...props}\n >\n {children}\n </View>\n );\n};\n\nexport default KeyValueRowRoot;\n"]}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.KeyValueRowStubs = void 0;
7
+ const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
8
+ const react_1 = __importDefault(require("react"));
9
+ const react_native_1 = require("react-native/index.js");
10
+ const Icon_1 = require("../Icon/index.cjs");
11
+ const KeyValueLabel_1 = __importDefault(require("./KeyValueLabel/KeyValueLabel.cjs"));
12
+ const KeyValueRoot_1 = __importDefault(require("./KeyValueRoot/KeyValueRoot.cjs"));
13
+ const KeyValueRow_types_1 = require("./KeyValueRow.types.cjs");
14
+ const KeyValueSection_1 = __importDefault(require("./KeyValueSection/KeyValueSection.cjs"));
15
+ const renderIcon = (icon) => {
16
+ const { side: _side, ...iconProps } = icon;
17
+ return <Icon_1.Icon {...iconProps}/>;
18
+ };
19
+ /**
20
+ * Prebuilt convenience component to format and render a key/value label pair.
21
+ * The KeyValueRowLabel component has props to display a tooltip and icon.
22
+ *
23
+ * @param props - Component props
24
+ * @param props.field - Represents the left side of the key value row pair
25
+ * @param props.value - Represents the right side of the key value row pair
26
+ * @param props.twClassName - Optional Tailwind class names for the root element
27
+ * @param props.style - Optional additional styles for the root element
28
+ *
29
+ * @returns The rendered KeyValueRow component.
30
+ */
31
+ const KeyValueRow = ({ field, value, twClassName, style, ...props }) => {
32
+ const tw = (0, design_system_twrnc_preset_1.useTailwind)();
33
+ const fieldIcon = field?.icon;
34
+ const valueIcon = value?.icon;
35
+ return (<KeyValueRoot_1.default twClassName={twClassName} style={style} {...props}>
36
+ <KeyValueSection_1.default>
37
+ <react_native_1.View style={tw.style('flex-row items-center gap-2')}>
38
+ {fieldIcon?.name &&
39
+ (fieldIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Left ||
40
+ fieldIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Both ||
41
+ !fieldIcon.side) &&
42
+ renderIcon(fieldIcon)}
43
+ <KeyValueLabel_1.default label={field.label} tooltip={field.tooltip}/>
44
+ {fieldIcon?.name &&
45
+ (fieldIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Right ||
46
+ fieldIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Both) &&
47
+ renderIcon(fieldIcon)}
48
+ </react_native_1.View>
49
+ </KeyValueSection_1.default>
50
+ <KeyValueSection_1.default align={KeyValueRow_types_1.KeyValueRowSectionAlignments.Right}>
51
+ <react_native_1.View style={tw.style('flex-row items-center gap-2')}>
52
+ {valueIcon?.name &&
53
+ (valueIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Left ||
54
+ valueIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Both ||
55
+ !valueIcon.side) &&
56
+ renderIcon(valueIcon)}
57
+ <KeyValueLabel_1.default label={value.label} tooltip={value.tooltip}/>
58
+ {valueIcon?.name &&
59
+ (valueIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Right ||
60
+ valueIcon.side === KeyValueRow_types_1.KeyValueRowFieldIconSides.Both) &&
61
+ renderIcon(valueIcon)}
62
+ </react_native_1.View>
63
+ </KeyValueSection_1.default>
64
+ </KeyValueRoot_1.default>);
65
+ };
66
+ KeyValueRow.displayName = 'KeyValueRow';
67
+ /**
68
+ * Exported sub-components to provide a base for new KeyValueRow variants.
69
+ */
70
+ exports.KeyValueRowStubs = {
71
+ Root: KeyValueRoot_1.default,
72
+ Section: KeyValueSection_1.default,
73
+ Label: KeyValueLabel_1.default,
74
+ };
75
+ exports.default = KeyValueRow;
76
+ //# sourceMappingURL=KeyValueRow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRow.cjs","sourceRoot":"","sources":["../../../src/components/KeyValueRow/KeyValueRow.tsx"],"names":[],"mappings":";;;;;;AAAA,8FAA4E;AAC5E,kDAA0B;AAC1B,wDAAoC;AAEpC,4CAA+B;AAG/B,sFAA6D;AAC7D,mFAA0D;AAE1D,+DAG6B;AAC7B,4FAAgE;AAIhE,MAAM,UAAU,GAAG,CAAC,IAAkB,EAAE,EAAE;IACxC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE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AAC,KAAK,CAAC,CAAC,gDAA4B,CAAC,KAAK,CAAC,CACzD;QAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CACnD;UAAA,CAAC,SAAS,EAAE,IAAI;YACd,CAAC,SAAS,CAAC,IAAI,KAAK,6CAAyB,CAAC,IAAI;gBAChD,SAAS,CAAC,IAAI,KAAK,6CAAyB,CAAC,IAAI;gBACjD,CAAC,SAAS,CAAC,IAAI,CAAC;YAClB,UAAU,CAAC,SAAS,CAAC,CACvB;UAAA,CAAC,uBAAgB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAC7D;UAAA,CAAC,SAAS,EAAE,IAAI;YACd,CAAC,SAAS,CAAC,IAAI,KAAK,6CAAyB,CAAC,KAAK;gBACjD,SAAS,CAAC,IAAI,KAAK,6CAAyB,CAAC,IAAI,CAAC;YACpD,UAAU,CAAC,SAAS,CAAC,CACzB;QAAA,EAAE,mBAAI,CACR;MAAA,EAAE,yBAAe,CACnB;IAAA,EAAE,sBAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,sBAAe;IACrB,OAAO,EAAE,yBAAe;IACxB,KAAK,EAAE,uBAAgB;CACxB,CAAC;AAEF,kBAAe,WAAW,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { Icon } from '../Icon';\nimport type { IconProps } from '../Icon';\n\nimport KeyValueRowLabel from './KeyValueLabel/KeyValueLabel';\nimport KeyValueRowRoot from './KeyValueRoot/KeyValueRoot';\nimport type { KeyValueRowProps } from './KeyValueRow.types';\nimport {\n KeyValueRowFieldIconSides,\n KeyValueRowSectionAlignments,\n} from './KeyValueRow.types';\nimport KeyValueSection from './KeyValueSection/KeyValueSection';\n\ntype IconWithSide = IconProps & { side?: KeyValueRowFieldIconSides };\n\nconst renderIcon = (icon: IconWithSide) => {\n const { side: _side, ...iconProps } = icon;\n return <Icon {...iconProps} />;\n};\n\n/**\n * Prebuilt convenience component to format and render a key/value label pair.\n * The KeyValueRowLabel component has props to display a tooltip and icon.\n *\n * @param props - Component props\n * @param props.field - Represents the left side of the key value row pair\n * @param props.value - Represents the right side of the key value row pair\n * @param props.twClassName - Optional Tailwind class names for the root element\n * @param props.style - Optional additional styles for the root element\n *\n * @returns The rendered KeyValueRow component.\n */\nconst KeyValueRow: React.FC<KeyValueRowProps> = ({\n field,\n value,\n twClassName,\n style,\n ...props\n}) => {\n const tw = useTailwind();\n\n const fieldIcon = field?.icon;\n const valueIcon = value?.icon;\n\n return (\n <KeyValueRowRoot twClassName={twClassName} style={style} {...props}>\n <KeyValueSection>\n <View style={tw.style('flex-row items-center gap-2')}>\n {fieldIcon?.name &&\n (fieldIcon.side === KeyValueRowFieldIconSides.Left ||\n fieldIcon.side === KeyValueRowFieldIconSides.Both ||\n !fieldIcon.side) &&\n renderIcon(fieldIcon)}\n <KeyValueRowLabel label={field.label} tooltip={field.tooltip} />\n {fieldIcon?.name &&\n (fieldIcon.side === KeyValueRowFieldIconSides.Right ||\n fieldIcon.side === KeyValueRowFieldIconSides.Both) &&\n renderIcon(fieldIcon)}\n </View>\n </KeyValueSection>\n <KeyValueSection align={KeyValueRowSectionAlignments.Right}>\n <View style={tw.style('flex-row items-center gap-2')}>\n {valueIcon?.name &&\n (valueIcon.side === KeyValueRowFieldIconSides.Left ||\n valueIcon.side === KeyValueRowFieldIconSides.Both ||\n !valueIcon.side) &&\n renderIcon(valueIcon)}\n <KeyValueRowLabel label={value.label} tooltip={value.tooltip} />\n {valueIcon?.name &&\n (valueIcon.side === KeyValueRowFieldIconSides.Right ||\n valueIcon.side === KeyValueRowFieldIconSides.Both) &&\n renderIcon(valueIcon)}\n </View>\n </KeyValueSection>\n </KeyValueRowRoot>\n );\n};\n\nKeyValueRow.displayName = 'KeyValueRow';\n\n/**\n * Exported sub-components to provide a base for new KeyValueRow variants.\n */\nexport const KeyValueRowStubs = {\n Root: KeyValueRowRoot,\n Section: KeyValueSection,\n Label: KeyValueRowLabel,\n};\n\nexport default KeyValueRow;\n"]}
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import type { KeyValueRowProps } from "./KeyValueRow.types.cjs";
3
+ /**
4
+ * Prebuilt convenience component to format and render a key/value label pair.
5
+ * The KeyValueRowLabel component has props to display a tooltip and icon.
6
+ *
7
+ * @param props - Component props
8
+ * @param props.field - Represents the left side of the key value row pair
9
+ * @param props.value - Represents the right side of the key value row pair
10
+ * @param props.twClassName - Optional Tailwind class names for the root element
11
+ * @param props.style - Optional additional styles for the root element
12
+ *
13
+ * @returns The rendered KeyValueRow component.
14
+ */
15
+ declare const KeyValueRow: React.FC<KeyValueRowProps>;
16
+ /**
17
+ * Exported sub-components to provide a base for new KeyValueRow variants.
18
+ */
19
+ export declare const KeyValueRowStubs: {
20
+ Root: React.FC<import("./KeyValueRow.types.cjs").KeyValueRowRootProps>;
21
+ Section: React.FC<import("./KeyValueRow.types.cjs").KeyValueSectionProps>;
22
+ Label: React.FC<import("./KeyValueRow.types.cjs").KeyValueRowLabelProps>;
23
+ };
24
+ export default KeyValueRow;
25
+ //# sourceMappingURL=KeyValueRow.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRow.d.cts","sourceRoot":"","sources":["../../../src/components/KeyValueRow/KeyValueRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAQ1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAA4B;AAc5D;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA4C3C,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import type { KeyValueRowProps } from "./KeyValueRow.types.mjs";
3
+ /**
4
+ * Prebuilt convenience component to format and render a key/value label pair.
5
+ * The KeyValueRowLabel component has props to display a tooltip and icon.
6
+ *
7
+ * @param props - Component props
8
+ * @param props.field - Represents the left side of the key value row pair
9
+ * @param props.value - Represents the right side of the key value row pair
10
+ * @param props.twClassName - Optional Tailwind class names for the root element
11
+ * @param props.style - Optional additional styles for the root element
12
+ *
13
+ * @returns The rendered KeyValueRow component.
14
+ */
15
+ declare const KeyValueRow: React.FC<KeyValueRowProps>;
16
+ /**
17
+ * Exported sub-components to provide a base for new KeyValueRow variants.
18
+ */
19
+ export declare const KeyValueRowStubs: {
20
+ Root: React.FC<import("./KeyValueRow.types.mjs").KeyValueRowRootProps>;
21
+ Section: React.FC<import("./KeyValueRow.types.mjs").KeyValueSectionProps>;
22
+ Label: React.FC<import("./KeyValueRow.types.mjs").KeyValueRowLabelProps>;
23
+ };
24
+ export default KeyValueRow;
25
+ //# sourceMappingURL=KeyValueRow.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRow.d.mts","sourceRoot":"","sources":["../../../src/components/KeyValueRow/KeyValueRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAQ1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAA4B;AAc5D;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA4C3C,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,77 @@
1
+ function $importDefault(module) {
2
+ if (module?.__esModule) {
3
+ return module.default;
4
+ }
5
+ return module;
6
+ }
7
+ import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
8
+ import $React from "react";
9
+ const React = $importDefault($React);
10
+ import { View } from "react-native/index.js";
11
+ import { Icon } from "../Icon/index.mjs";
12
+ import KeyValueRowLabel from "./KeyValueLabel/KeyValueLabel.mjs";
13
+ import KeyValueRowRoot from "./KeyValueRoot/KeyValueRoot.mjs";
14
+ import { KeyValueRowFieldIconSides, KeyValueRowSectionAlignments } from "./KeyValueRow.types.mjs";
15
+ import KeyValueSection from "./KeyValueSection/KeyValueSection.mjs";
16
+ const renderIcon = (icon) => {
17
+ const { side: _side, ...iconProps } = icon;
18
+ return <Icon {...iconProps}/>;
19
+ };
20
+ /**
21
+ * Prebuilt convenience component to format and render a key/value label pair.
22
+ * The KeyValueRowLabel component has props to display a tooltip and icon.
23
+ *
24
+ * @param props - Component props
25
+ * @param props.field - Represents the left side of the key value row pair
26
+ * @param props.value - Represents the right side of the key value row pair
27
+ * @param props.twClassName - Optional Tailwind class names for the root element
28
+ * @param props.style - Optional additional styles for the root element
29
+ *
30
+ * @returns The rendered KeyValueRow component.
31
+ */
32
+ const KeyValueRow = ({ field, value, twClassName, style, ...props }) => {
33
+ const tw = useTailwind();
34
+ const fieldIcon = field?.icon;
35
+ const valueIcon = value?.icon;
36
+ return (<KeyValueRowRoot twClassName={twClassName} style={style} {...props}>
37
+ <KeyValueSection>
38
+ <View style={tw.style('flex-row items-center gap-2')}>
39
+ {fieldIcon?.name &&
40
+ (fieldIcon.side === KeyValueRowFieldIconSides.Left ||
41
+ fieldIcon.side === KeyValueRowFieldIconSides.Both ||
42
+ !fieldIcon.side) &&
43
+ renderIcon(fieldIcon)}
44
+ <KeyValueRowLabel label={field.label} tooltip={field.tooltip}/>
45
+ {fieldIcon?.name &&
46
+ (fieldIcon.side === KeyValueRowFieldIconSides.Right ||
47
+ fieldIcon.side === KeyValueRowFieldIconSides.Both) &&
48
+ renderIcon(fieldIcon)}
49
+ </View>
50
+ </KeyValueSection>
51
+ <KeyValueSection align={KeyValueRowSectionAlignments.Right}>
52
+ <View style={tw.style('flex-row items-center gap-2')}>
53
+ {valueIcon?.name &&
54
+ (valueIcon.side === KeyValueRowFieldIconSides.Left ||
55
+ valueIcon.side === KeyValueRowFieldIconSides.Both ||
56
+ !valueIcon.side) &&
57
+ renderIcon(valueIcon)}
58
+ <KeyValueRowLabel label={value.label} tooltip={value.tooltip}/>
59
+ {valueIcon?.name &&
60
+ (valueIcon.side === KeyValueRowFieldIconSides.Right ||
61
+ valueIcon.side === KeyValueRowFieldIconSides.Both) &&
62
+ renderIcon(valueIcon)}
63
+ </View>
64
+ </KeyValueSection>
65
+ </KeyValueRowRoot>);
66
+ };
67
+ KeyValueRow.displayName = 'KeyValueRow';
68
+ /**
69
+ * Exported sub-components to provide a base for new KeyValueRow variants.
70
+ */
71
+ export const KeyValueRowStubs = {
72
+ Root: KeyValueRowRoot,
73
+ Section: KeyValueSection,
74
+ Label: KeyValueRowLabel,
75
+ };
76
+ export default KeyValueRow;
77
+ //# sourceMappingURL=KeyValueRow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRow.mjs","sourceRoot":"","sources":["../../../src/components/KeyValueRow/KeyValueRow.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAEpC,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAG/B,OAAO,gBAAgB,0CAAsC;AAC7D,OAAO,eAAe,wCAAoC;AAE1D,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC7B,gCAA4B;AAC7B,OAAO,eAAe,8CAA0C;AAIhE,MAAM,UAAU,GAAG,CAAC,IAAkB,EAAE,EAAE;IACxC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACjC,CAAC,CAAC;AAEF;;;;;;;;;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;UAAA,CAAC,SAAS,EAAE,IAAI;YACd,CAAC,SAAS,CAAC,IAAI,KAAK,yBAAyB,CAAC,IAAI;gBAChD,SAAS,CAAC,IAAI,KAAK,yBAAyB,CAAC,IAAI;gBACjD,CAAC,SAAS,CAAC,IAAI,CAAC;YAClB,UAAU,CAAC,SAAS,CAAC,CACvB;UAAA,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAC7D;UAAA,CAAC,SAAS,EAAE,IAAI;YACd,CAAC,SAAS,CAAC,IAAI,KAAK,yBAAyB,CAAC,KAAK;gBACjD,SAAS,CAAC,IAAI,KAAK,yBAAyB,CAAC,IAAI,CAAC;YACpD,UAAU,CAAC,SAAS,CAAC,CACzB;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,eAAe,CACnB;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { Icon } from '../Icon';\nimport type { IconProps } from '../Icon';\n\nimport KeyValueRowLabel from './KeyValueLabel/KeyValueLabel';\nimport KeyValueRowRoot from './KeyValueRoot/KeyValueRoot';\nimport type { KeyValueRowProps } from './KeyValueRow.types';\nimport {\n KeyValueRowFieldIconSides,\n KeyValueRowSectionAlignments,\n} from './KeyValueRow.types';\nimport KeyValueSection from './KeyValueSection/KeyValueSection';\n\ntype IconWithSide = IconProps & { side?: KeyValueRowFieldIconSides };\n\nconst renderIcon = (icon: IconWithSide) => {\n const { side: _side, ...iconProps } = icon;\n return <Icon {...iconProps} />;\n};\n\n/**\n * Prebuilt convenience component to format and render a key/value label pair.\n * The KeyValueRowLabel component has props to display a tooltip and icon.\n *\n * @param props - Component props\n * @param props.field - Represents the left side of the key value row pair\n * @param props.value - Represents the right side of the key value row pair\n * @param props.twClassName - Optional Tailwind class names for the root element\n * @param props.style - Optional additional styles for the root element\n *\n * @returns The rendered KeyValueRow component.\n */\nconst KeyValueRow: React.FC<KeyValueRowProps> = ({\n field,\n value,\n twClassName,\n style,\n ...props\n}) => {\n const tw = useTailwind();\n\n const fieldIcon = field?.icon;\n const valueIcon = value?.icon;\n\n return (\n <KeyValueRowRoot twClassName={twClassName} style={style} {...props}>\n <KeyValueSection>\n <View style={tw.style('flex-row items-center gap-2')}>\n {fieldIcon?.name &&\n (fieldIcon.side === KeyValueRowFieldIconSides.Left ||\n fieldIcon.side === KeyValueRowFieldIconSides.Both ||\n !fieldIcon.side) &&\n renderIcon(fieldIcon)}\n <KeyValueRowLabel label={field.label} tooltip={field.tooltip} />\n {fieldIcon?.name &&\n (fieldIcon.side === KeyValueRowFieldIconSides.Right ||\n fieldIcon.side === KeyValueRowFieldIconSides.Both) &&\n renderIcon(fieldIcon)}\n </View>\n </KeyValueSection>\n <KeyValueSection align={KeyValueRowSectionAlignments.Right}>\n <View style={tw.style('flex-row items-center gap-2')}>\n {valueIcon?.name &&\n (valueIcon.side === KeyValueRowFieldIconSides.Left ||\n valueIcon.side === KeyValueRowFieldIconSides.Both ||\n !valueIcon.side) &&\n renderIcon(valueIcon)}\n <KeyValueRowLabel label={value.label} tooltip={value.tooltip} />\n {valueIcon?.name &&\n (valueIcon.side === KeyValueRowFieldIconSides.Right ||\n valueIcon.side === KeyValueRowFieldIconSides.Both) &&\n renderIcon(valueIcon)}\n </View>\n </KeyValueSection>\n </KeyValueRowRoot>\n );\n};\n\nKeyValueRow.displayName = 'KeyValueRow';\n\n/**\n * Exported sub-components to provide a base for new KeyValueRow variants.\n */\nexport const KeyValueRowStubs = {\n Root: KeyValueRowRoot,\n Section: KeyValueSection,\n Label: KeyValueRowLabel,\n};\n\nexport default KeyValueRow;\n"]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyValueRowSectionAlignments = exports.TooltipSizes = exports.IconSizes = exports.KeyValueRowFieldIconSides = void 0;
4
+ const ButtonIcon_1 = require("../ButtonIcon/index.cjs");
5
+ const Icon_1 = require("../Icon/index.cjs");
6
+ /**
7
+ * Used to position an icon in a KeyValueRowField.
8
+ */
9
+ exports.KeyValueRowFieldIconSides = {
10
+ Left: 'left',
11
+ Right: 'right',
12
+ Both: 'both',
13
+ };
14
+ /**
15
+ * Re-exported for backwards compatibility.
16
+ */
17
+ exports.IconSizes = Icon_1.IconSize;
18
+ /**
19
+ * Re-exported for backwards compatibility.
20
+ */
21
+ exports.TooltipSizes = ButtonIcon_1.ButtonIconSize;
22
+ /**
23
+ * Represents the valid KeyValueSection alignments.
24
+ */
25
+ exports.KeyValueRowSectionAlignments = {
26
+ Left: 'items-start',
27
+ Right: 'items-end',
28
+ };
29
+ //# sourceMappingURL=KeyValueRow.types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyValueRow.types.cjs","sourceRoot":"","sources":["../../../src/components/KeyValueRow/KeyValueRow.types.ts"],"names":[],"mappings":";;;AAGA,wDAA+C;AAC/C,4CAA6C;AAsC7C;;GAEG;AACU,QAAA,yBAAyB,GAAG;IACvC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACJ,CAAC;AAuBX;;GAEG;AACU,QAAA,SAAS,GAAG,eAAQ,CAAC;AAElC;;GAEG;AACU,QAAA,YAAY,GAAG,2BAAc,CAAC;AAsC3C;;GAEG;AACU,QAAA,4BAA4B,GAAG;IAC1C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,WAAW;CACV,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport type { ViewProps } from 'react-native';\n\nimport { ButtonIconSize } from '../ButtonIcon';\nimport { IconName, IconSize } from '../Icon';\nimport type { IconProps } from '../Icon';\nimport type { TextProps } from '../Text';\n\n/**\n * The optional tooltip that can be displayed within a KeyValueRowField.\n */\nexport type KeyValueRowTooltip = {\n /**\n * The title displayed at the top of the tooltip.\n */\n title: string;\n /**\n * The content displayed within the tooltip body.\n */\n content: string | ReactNode;\n /**\n * Optional size of the tooltip icon button.\n *\n * @default ButtonIconSize.Md\n */\n size?: ButtonIconSize;\n /**\n * Optional icon name for the tooltip icon.\n *\n * @default IconName.Question\n */\n iconName?: IconName;\n /**\n * Optional onPress handler called when the tooltip icon is pressed.\n */\n onPress?: (...args: unknown[]) => unknown;\n /**\n * Optional bottom padding for the tooltip modal.\n */\n bottomPadding?: number;\n};\n\n/**\n * Used to position an icon in a KeyValueRowField.\n */\nexport const KeyValueRowFieldIconSides = {\n Left: 'left',\n Right: 'right',\n Both: 'both',\n} as const;\n\nexport type KeyValueRowFieldIconSides =\n (typeof KeyValueRowFieldIconSides)[keyof typeof KeyValueRowFieldIconSides];\n\n/**\n * Represents a field displayed within KeyValueRowProps.\n */\nexport type KeyValueRowField = {\n /**\n * The label content displayed.\n */\n label: PreDefinedKeyValueRowLabel | ReactNode;\n /**\n * Optional icon to display. If undefined, no icon is displayed.\n */\n icon?: IconProps & { side?: KeyValueRowFieldIconSides };\n /**\n * Optional tooltip to display. If undefined, no tooltip is displayed.\n */\n tooltip?: KeyValueRowTooltip;\n};\n\n/**\n * Re-exported for backwards compatibility.\n */\nexport const IconSizes = IconSize;\n\n/**\n * Re-exported for backwards compatibility.\n */\nexport const TooltipSizes = ButtonIconSize;\n\n/**\n * A predefined label object with text, variant, and color.\n */\nexport type PreDefinedKeyValueRowLabel = {\n /**\n * Text to display.\n */\n text: string;\n /**\n * Optional text variant.\n *\n * @default TextVariant.BodyMd\n */\n variant?: TextProps['variant'];\n /**\n * Optional text color.\n *\n * @default TextColor.TextDefault\n */\n color?: TextProps['color'];\n};\n\n/**\n * The KeyValueRowLabel component props.\n */\nexport type KeyValueRowLabelProps = {\n /**\n * The label content displayed.\n */\n label: PreDefinedKeyValueRowLabel | ReactNode;\n /**\n * Optional tooltip. If undefined, the tooltip won't be displayed.\n */\n tooltip?: KeyValueRowTooltip;\n};\n\n/**\n * Represents the valid KeyValueSection alignments.\n */\nexport const KeyValueRowSectionAlignments = {\n Left: 'items-start',\n Right: 'items-end',\n} as const;\n\nexport type KeyValueRowSectionAlignments =\n (typeof KeyValueRowSectionAlignments)[keyof typeof KeyValueRowSectionAlignments];\n\n/**\n * Represents the main container for the KeyValueRow component.\n *\n * Extends `ViewProps` so the root View inherits standard React Native\n * props such as `testID` and `accessibilityLabel`.\n */\nexport type KeyValueRowRootProps = {\n /**\n * Must have exactly two children. Adding more will lead to an undesired outcome.\n */\n children: [ReactNode, ReactNode];\n /**\n * Optional Tailwind class names to override default styles on the root element.\n */\n twClassName?: string;\n} & ViewProps;\n\n/**\n * The KeyValueSection component props.\n *\n * Extends `ViewProps` so the root View inherits standard React Native\n * props such as `testID` and `accessibilityLabel`.\n */\nexport type KeyValueSectionProps = {\n /**\n * Child components.\n */\n children: ReactNode;\n /**\n * Optional content alignment.\n *\n * @default KeyValueRowSectionAlignments.Left\n */\n align?: KeyValueRowSectionAlignments;\n /**\n * Optional Tailwind class names to override default styles on the root element.\n */\n twClassName?: string;\n} & ViewProps;\n\n/**\n * The KeyValueRow component props.\n *\n * Extends `ViewProps` so the root View inherits standard React Native\n * props such as `testID` and `accessibilityLabel`.\n */\nexport type KeyValueRowProps = {\n /**\n * The \"key\" portion of the KeyValueRow (left side).\n * Using the variable name field because key is reserved.\n */\n field: KeyValueRowField;\n /**\n * The \"value\" portion of the KeyValueRow (right side).\n */\n value: KeyValueRowField;\n /**\n * Optional Tailwind class names to override default styles on the root element.\n */\n twClassName?: string;\n} & ViewProps;\n"]}