@metamask-previews/design-system-react-native 0.27.0-preview.f5c2542 → 0.28.0-preview.1f40f69f
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.
- package/CHANGELOG.md +15 -1
- package/dist/components/AvatarBase/AvatarBase.cjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs +2 -2
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.cts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.mts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs +2 -2
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs +2 -2
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.cts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.mts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs +2 -2
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.cjs +2 -2
- package/dist/components/AvatarToken/AvatarToken.cjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.cts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.mts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.mjs +2 -2
- package/dist/components/AvatarToken/AvatarToken.mjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.cjs +47 -24
- package/dist/components/SectionHeader/SectionHeader.cjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.d.cts +16 -13
- package/dist/components/SectionHeader/SectionHeader.d.cts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.d.mts +16 -13
- package/dist/components/SectionHeader/SectionHeader.d.mts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.mjs +48 -25
- package/dist/components/SectionHeader/SectionHeader.mjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.cjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.d.cts +16 -9
- package/dist/components/SectionHeader/SectionHeader.types.d.cts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.d.mts +16 -9
- package/dist/components/SectionHeader/SectionHeader.types.d.mts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.cjs +3 -7
- package/dist/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.d.cts +158 -163
- package/dist/components/TextArea/TextArea.d.cts.map +1 -1
- package/dist/components/TextArea/TextArea.d.mts +158 -163
- package/dist/components/TextArea/TextArea.d.mts.map +1 -1
- package/dist/components/TextArea/TextArea.mjs +4 -8
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.types.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.types.d.cts +12 -45
- package/dist/components/TextArea/TextArea.types.d.cts.map +1 -1
- package/dist/components/TextArea/TextArea.types.d.mts +12 -45
- package/dist/components/TextArea/TextArea.types.d.mts.map +1 -1
- package/dist/components/TextArea/TextArea.types.mjs.map +1 -1
- package/dist/components/Toast/Toast.constants.cjs +4 -7
- package/dist/components/Toast/Toast.constants.cjs.map +1 -1
- package/dist/components/Toast/Toast.constants.d.cts +1 -6
- package/dist/components/Toast/Toast.constants.d.cts.map +1 -1
- package/dist/components/Toast/Toast.constants.d.mts +1 -6
- package/dist/components/Toast/Toast.constants.d.mts.map +1 -1
- package/dist/components/Toast/Toast.constants.mjs +1 -6
- package/dist/components/Toast/Toast.constants.mjs.map +1 -1
- package/dist/components/Toast/index.cjs +1 -3
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts +1 -1
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.mts +1 -1
- package/dist/components/Toast/index.d.mts.map +1 -1
- package/dist/components/Toast/index.mjs +1 -1
- package/dist/components/Toast/index.mjs.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.cjs.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts +2 -2
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts +2 -2
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -4,41 +4,64 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
-
import { IconColor, IconSize, TextColor, TextVariant } from "@metamask-previews/design-system-shared";
|
|
7
|
+
import { IconColor, IconName, IconSize, TextColor, TextVariant } from "@metamask-previews/design-system-shared";
|
|
8
|
+
import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
|
|
8
9
|
import $React from "react";
|
|
9
10
|
const React = $importDefault($React);
|
|
11
|
+
import { Pressable } from "react-native";
|
|
10
12
|
import { BoxRow } from "../BoxRow/index.mjs";
|
|
11
13
|
import { Icon } from "../Icon/index.mjs";
|
|
12
14
|
/**
|
|
13
15
|
* Horizontal section header: optional start/end icons or accessories, and a title row with optional inline accessory.
|
|
14
|
-
*
|
|
16
|
+
* When `isInteractive` is `true`, the header is wrapped in a `Pressable` and remaining `PressableProps` are forwarded to it.
|
|
17
|
+
* Otherwise, remaining `View` props are forwarded to the outer {@link BoxRow}.
|
|
15
18
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
19
|
+
* @param sectionHeaderProps - Component props
|
|
20
|
+
* @param sectionHeaderProps.title - Title content for the inner row (required)
|
|
21
|
+
* @param sectionHeaderProps.titleAccessory - Optional node to the right of `title` in the inner row
|
|
22
|
+
* @param sectionHeaderProps.titleProps - Optional props merged into inner row `Text` when `title` is a string
|
|
23
|
+
* @param sectionHeaderProps.titleWrapperProps - Optional props spread onto the inner `BoxRow`
|
|
24
|
+
* @param sectionHeaderProps.startAccessory - Optional custom node before the title row on the outer row; used when no start icon is resolved
|
|
25
|
+
* @param sectionHeaderProps.startIconName - Optional start icon; takes precedence over `startAccessory` when set
|
|
26
|
+
* @param sectionHeaderProps.startIconProps - Props merged into the start `Icon` (defaults include medium size and default icon color)
|
|
27
|
+
* @param sectionHeaderProps.endAccessory - Optional custom node after the title row on the outer row; used when no end icon is resolved
|
|
28
|
+
* @param sectionHeaderProps.endIconName - Optional end icon; takes precedence over `endAccessory` when set. Defaults to `IconName.ArrowRight` when `isInteractive` is `true` and no end icon or `endAccessory` is provided
|
|
29
|
+
* @param sectionHeaderProps.endIconProps - Props merged into the end `Icon`
|
|
30
|
+
* @param sectionHeaderProps.isInteractive - When `true`, wraps the header in a `Pressable` with reduced opacity on press
|
|
31
|
+
* @param sectionHeaderProps.style - Optional style on the outer wrapper (`View` or `Pressable` style, including function form when interactive)
|
|
32
|
+
* @param sectionHeaderProps.twClassName - Optional Tailwind classes on the outer row
|
|
28
33
|
*
|
|
29
34
|
* @returns The rendered SectionHeader layout.
|
|
30
35
|
*/
|
|
31
|
-
export const SectionHeader = (
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
export const SectionHeader = (sectionHeaderProps) => {
|
|
37
|
+
const { title, titleAccessory, titleProps, titleWrapperProps, startAccessory, startIconName, startIconProps, endAccessory, endIconName, endIconProps, isInteractive, twClassName = '', style, ...props } = sectionHeaderProps;
|
|
38
|
+
const tw = useTailwind();
|
|
39
|
+
const resolvedEndIconName = endIconName ??
|
|
40
|
+
(isInteractive && !endAccessory ? IconName.ArrowRight : undefined);
|
|
41
|
+
const resolvedStartAccessory = startIconName ? (<Icon size={IconSize.Md} color={IconColor.IconDefault} twClassName="shrink-0" {...startIconProps} name={startIconName}/>) : (startAccessory);
|
|
42
|
+
const resolvedEndAccessory = resolvedEndIconName ? (<Icon size={IconSize.Md} color={IconColor.IconAlternative} twClassName="shrink-0" {...endIconProps} name={resolvedEndIconName}/>) : (endAccessory);
|
|
43
|
+
const titleRow = title ? (<BoxRow {...titleWrapperProps} gap={1} endAccessory={titleAccessory} textProps={{
|
|
44
|
+
variant: TextVariant.HeadingMd,
|
|
45
|
+
color: TextColor.TextDefault,
|
|
46
|
+
...titleProps,
|
|
47
|
+
}}>
|
|
48
|
+
{title}
|
|
49
|
+
</BoxRow>) : null;
|
|
50
|
+
if (isInteractive) {
|
|
51
|
+
const { disabled, accessibilityRole = 'button' } = sectionHeaderProps;
|
|
52
|
+
const isDisabled = Boolean(disabled);
|
|
53
|
+
return (<Pressable accessibilityRole={accessibilityRole} style={({ pressed }) => {
|
|
54
|
+
const baseStyle = tw.style('px-4 pb-2 pt-3', twClassName, pressed && !isDisabled && 'opacity-70');
|
|
55
|
+
const additionalStyle = typeof style === 'function' ? style({ pressed }) : style;
|
|
56
|
+
return additionalStyle ? [baseStyle, additionalStyle] : baseStyle;
|
|
57
|
+
}} {...props}>
|
|
58
|
+
<BoxRow gap={1} startAccessory={resolvedStartAccessory} endAccessory={resolvedEndAccessory}>
|
|
59
|
+
{titleRow}
|
|
60
|
+
</BoxRow>
|
|
61
|
+
</Pressable>);
|
|
62
|
+
}
|
|
63
|
+
return (<BoxRow {...props} gap={1} style={style} twClassName={`px-4 pb-2 pt-3 ${twClassName}`} startAccessory={resolvedStartAccessory} endAccessory={resolvedEndAccessory}>
|
|
64
|
+
{titleRow}
|
|
42
65
|
</BoxRow>);
|
|
43
66
|
};
|
|
44
67
|
SectionHeader.displayName = 'SectionHeader';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.mjs","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACZ,gDAAgD;AACjD,OAAO,MAAK,cAAc;;
|
|
1
|
+
{"version":3,"file":"SectionHeader.mjs","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.tsx"],"names":[],"mappings":"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","sourcesContent":["import {\n IconColor,\n IconName,\n IconSize,\n TextColor,\n TextVariant,\n} from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { Pressable } from 'react-native';\n\nimport { BoxRow } from '../BoxRow';\nimport { Icon } from '../Icon';\n\nimport type { SectionHeaderProps } from './SectionHeader.types';\n\n/**\n * Horizontal section header: optional start/end icons or accessories, and a title row with optional inline accessory.\n * When `isInteractive` is `true`, the header is wrapped in a `Pressable` and remaining `PressableProps` are forwarded to it.\n * Otherwise, remaining `View` props are forwarded to the outer {@link BoxRow}.\n *\n * @param sectionHeaderProps - Component props\n * @param sectionHeaderProps.title - Title content for the inner row (required)\n * @param sectionHeaderProps.titleAccessory - Optional node to the right of `title` in the inner row\n * @param sectionHeaderProps.titleProps - Optional props merged into inner row `Text` when `title` is a string\n * @param sectionHeaderProps.titleWrapperProps - Optional props spread onto the inner `BoxRow`\n * @param sectionHeaderProps.startAccessory - Optional custom node before the title row on the outer row; used when no start icon is resolved\n * @param sectionHeaderProps.startIconName - Optional start icon; takes precedence over `startAccessory` when set\n * @param sectionHeaderProps.startIconProps - Props merged into the start `Icon` (defaults include medium size and default icon color)\n * @param sectionHeaderProps.endAccessory - Optional custom node after the title row on the outer row; used when no end icon is resolved\n * @param sectionHeaderProps.endIconName - Optional end icon; takes precedence over `endAccessory` when set. Defaults to `IconName.ArrowRight` when `isInteractive` is `true` and no end icon or `endAccessory` is provided\n * @param sectionHeaderProps.endIconProps - Props merged into the end `Icon`\n * @param sectionHeaderProps.isInteractive - When `true`, wraps the header in a `Pressable` with reduced opacity on press\n * @param sectionHeaderProps.style - Optional style on the outer wrapper (`View` or `Pressable` style, including function form when interactive)\n * @param sectionHeaderProps.twClassName - Optional Tailwind classes on the outer row\n *\n * @returns The rendered SectionHeader layout.\n */\nexport const SectionHeader: React.FC<SectionHeaderProps> = (\n sectionHeaderProps,\n) => {\n const {\n title,\n titleAccessory,\n titleProps,\n titleWrapperProps,\n startAccessory,\n startIconName,\n startIconProps,\n endAccessory,\n endIconName,\n endIconProps,\n isInteractive,\n twClassName = '',\n style,\n ...props\n } = sectionHeaderProps;\n\n const tw = useTailwind();\n const resolvedEndIconName =\n endIconName ??\n (isInteractive && !endAccessory ? IconName.ArrowRight : undefined);\n\n const resolvedStartAccessory = startIconName ? (\n <Icon\n size={IconSize.Md}\n color={IconColor.IconDefault}\n twClassName=\"shrink-0\"\n {...startIconProps}\n name={startIconName}\n />\n ) : (\n startAccessory\n );\n\n const resolvedEndAccessory = resolvedEndIconName ? (\n <Icon\n size={IconSize.Md}\n color={IconColor.IconAlternative}\n twClassName=\"shrink-0\"\n {...endIconProps}\n name={resolvedEndIconName}\n />\n ) : (\n endAccessory\n );\n\n const titleRow = title ? (\n <BoxRow\n {...titleWrapperProps}\n gap={1}\n endAccessory={titleAccessory}\n textProps={{\n variant: TextVariant.HeadingMd,\n color: TextColor.TextDefault,\n ...titleProps,\n }}\n >\n {title}\n </BoxRow>\n ) : null;\n\n if (isInteractive) {\n const { disabled, accessibilityRole = 'button' } = sectionHeaderProps;\n const isDisabled = Boolean(disabled);\n\n return (\n <Pressable\n accessibilityRole={accessibilityRole}\n style={({ pressed }) => {\n const baseStyle = tw.style(\n 'px-4 pb-2 pt-3',\n twClassName,\n pressed && !isDisabled && 'opacity-70',\n );\n const additionalStyle =\n typeof style === 'function' ? style({ pressed }) : style;\n\n return additionalStyle ? [baseStyle, additionalStyle] : baseStyle;\n }}\n {...props}\n >\n <BoxRow\n gap={1}\n startAccessory={resolvedStartAccessory}\n endAccessory={resolvedEndAccessory}\n >\n {titleRow}\n </BoxRow>\n </Pressable>\n );\n }\n\n return (\n <BoxRow\n {...props}\n gap={1}\n style={style}\n twClassName={`px-4 pb-2 pt-3 ${twClassName}`}\n startAccessory={resolvedStartAccessory}\n endAccessory={resolvedEndAccessory}\n >\n {titleRow}\n </BoxRow>\n );\n};\n\nSectionHeader.displayName = 'SectionHeader';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.types.cjs","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { SectionHeaderPropsShared } from '@metamask-previews/design-system-shared';\nimport type { ViewProps } from 'react-native';\n\n// Internal dependencies.\nimport type { BoxRowProps } from '../BoxRow/BoxRow.types';\nimport type { IconProps } from '../Icon';\nimport type { TextProps } from '../Text/Text.types';\n\
|
|
1
|
+
{"version":3,"file":"SectionHeader.types.cjs","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { SectionHeaderPropsShared } from '@metamask-previews/design-system-shared';\nimport type { PressableProps, ViewProps } from 'react-native';\n\n// Internal dependencies.\nimport type { BoxRowProps } from '../BoxRow/BoxRow.types';\nimport type { IconProps } from '../Icon';\nimport type { TextProps } from '../Text/Text.types';\n\ntype SectionHeaderPropsBase = SectionHeaderPropsShared & {\n /**\n * Optional props merged into {@link BoxRow} `textProps` when `title` is a string.\n */\n titleProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional props spread onto the title row {@link BoxRow}. Omits `children`, `endAccessory`, and `textProps` (SectionHeader sets those via `title`, `titleAccessory`, and `titleProps`).\n */\n titleWrapperProps?: Omit<\n Partial<BoxRowProps>,\n 'children' | 'endAccessory' | 'textProps'\n >;\n /**\n * Optional prop to pass additional properties to the start icon.\n */\n startIconProps?: Omit<Partial<IconProps>, 'name'>;\n /**\n * Optional prop to pass additional properties to the end icon.\n */\n endIconProps?: Omit<Partial<IconProps>, 'name'>;\n /**\n * Optional Tailwind class name to apply to the outer row.\n */\n twClassName?: string;\n};\n\n/**\n * SectionHeader component props (React Native).\n * Extends {@link SectionHeaderPropsShared} with platform `Text` / `Icon` passthroughs, `twClassName`, and wrapper props.\n * When `isInteractive` is `true`, the outer wrapper is a `Pressable`; otherwise it is a {@link BoxRow} with `ViewProps`.\n */\nexport type SectionHeaderProps =\n | (SectionHeaderPropsBase & {\n isInteractive?: false;\n } & Omit<ViewProps, 'children'>)\n | (SectionHeaderPropsBase & {\n isInteractive: true;\n } & Omit<PressableProps, 'children'>);\n"]}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { SectionHeaderPropsShared } from "@metamask-previews/design-system-shared";
|
|
2
|
-
import type { ViewProps } from "react-native";
|
|
2
|
+
import type { PressableProps, ViewProps } from "react-native";
|
|
3
3
|
import type { BoxRowProps } from "../BoxRow/BoxRow.types.cjs";
|
|
4
4
|
import type { IconProps } from "../Icon/index.cjs";
|
|
5
5
|
import type { TextProps } from "../Text/Text.types.cjs";
|
|
6
|
-
|
|
7
|
-
* SectionHeader component props (React Native).
|
|
8
|
-
* Extends {@link SectionHeaderPropsShared} with platform `Text` / `Icon` passthroughs, `twClassName`, and `View` props.
|
|
9
|
-
*/
|
|
10
|
-
export type SectionHeaderProps = SectionHeaderPropsShared & {
|
|
6
|
+
type SectionHeaderPropsBase = SectionHeaderPropsShared & {
|
|
11
7
|
/**
|
|
12
8
|
* Optional props merged into {@link BoxRow} `textProps` when `title` is a string.
|
|
13
9
|
*/
|
|
@@ -19,14 +15,25 @@ export type SectionHeaderProps = SectionHeaderPropsShared & {
|
|
|
19
15
|
/**
|
|
20
16
|
* Optional prop to pass additional properties to the start icon.
|
|
21
17
|
*/
|
|
22
|
-
startIconProps?: Partial<IconProps>;
|
|
18
|
+
startIconProps?: Omit<Partial<IconProps>, 'name'>;
|
|
23
19
|
/**
|
|
24
20
|
* Optional prop to pass additional properties to the end icon.
|
|
25
21
|
*/
|
|
26
|
-
endIconProps?: Partial<IconProps>;
|
|
22
|
+
endIconProps?: Omit<Partial<IconProps>, 'name'>;
|
|
27
23
|
/**
|
|
28
24
|
* Optional Tailwind class name to apply to the outer row.
|
|
29
25
|
*/
|
|
30
26
|
twClassName?: string;
|
|
31
|
-
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* SectionHeader component props (React Native).
|
|
30
|
+
* Extends {@link SectionHeaderPropsShared} with platform `Text` / `Icon` passthroughs, `twClassName`, and wrapper props.
|
|
31
|
+
* When `isInteractive` is `true`, the outer wrapper is a `Pressable`; otherwise it is a {@link BoxRow} with `ViewProps`.
|
|
32
|
+
*/
|
|
33
|
+
export type SectionHeaderProps = (SectionHeaderPropsBase & {
|
|
34
|
+
isInteractive?: false;
|
|
35
|
+
} & Omit<ViewProps, 'children'>) | (SectionHeaderPropsBase & {
|
|
36
|
+
isInteractive: true;
|
|
37
|
+
} & Omit<PressableProps, 'children'>);
|
|
38
|
+
export {};
|
|
32
39
|
//# sourceMappingURL=SectionHeader.types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.types.d.cts","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gDAAgD;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;
|
|
1
|
+
{"version":3,"file":"SectionHeader.types.d.cts","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gDAAgD;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB;AAG9D,OAAO,KAAK,EAAE,WAAW,EAAE,mCAA+B;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD,KAAK,sBAAsB,GAAG,wBAAwB,GAAG;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IAClD;;OAEG;IACH,iBAAiB,CAAC,EAAE,IAAI,CACtB,OAAO,CAAC,WAAW,CAAC,EACpB,UAAU,GAAG,cAAc,GAAG,WAAW,CAC1C,CAAC;IACF;;OAEG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAClD;;OAEG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAChD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B,CAAC,sBAAsB,GAAG;IACxB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,GAChC,CAAC,sBAAsB,GAAG;IACxB,aAAa,EAAE,IAAI,CAAC;CACrB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { SectionHeaderPropsShared } from "@metamask-previews/design-system-shared";
|
|
2
|
-
import type { ViewProps } from "react-native";
|
|
2
|
+
import type { PressableProps, ViewProps } from "react-native";
|
|
3
3
|
import type { BoxRowProps } from "../BoxRow/BoxRow.types.mjs";
|
|
4
4
|
import type { IconProps } from "../Icon/index.mjs";
|
|
5
5
|
import type { TextProps } from "../Text/Text.types.mjs";
|
|
6
|
-
|
|
7
|
-
* SectionHeader component props (React Native).
|
|
8
|
-
* Extends {@link SectionHeaderPropsShared} with platform `Text` / `Icon` passthroughs, `twClassName`, and `View` props.
|
|
9
|
-
*/
|
|
10
|
-
export type SectionHeaderProps = SectionHeaderPropsShared & {
|
|
6
|
+
type SectionHeaderPropsBase = SectionHeaderPropsShared & {
|
|
11
7
|
/**
|
|
12
8
|
* Optional props merged into {@link BoxRow} `textProps` when `title` is a string.
|
|
13
9
|
*/
|
|
@@ -19,14 +15,25 @@ export type SectionHeaderProps = SectionHeaderPropsShared & {
|
|
|
19
15
|
/**
|
|
20
16
|
* Optional prop to pass additional properties to the start icon.
|
|
21
17
|
*/
|
|
22
|
-
startIconProps?: Partial<IconProps>;
|
|
18
|
+
startIconProps?: Omit<Partial<IconProps>, 'name'>;
|
|
23
19
|
/**
|
|
24
20
|
* Optional prop to pass additional properties to the end icon.
|
|
25
21
|
*/
|
|
26
|
-
endIconProps?: Partial<IconProps>;
|
|
22
|
+
endIconProps?: Omit<Partial<IconProps>, 'name'>;
|
|
27
23
|
/**
|
|
28
24
|
* Optional Tailwind class name to apply to the outer row.
|
|
29
25
|
*/
|
|
30
26
|
twClassName?: string;
|
|
31
|
-
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* SectionHeader component props (React Native).
|
|
30
|
+
* Extends {@link SectionHeaderPropsShared} with platform `Text` / `Icon` passthroughs, `twClassName`, and wrapper props.
|
|
31
|
+
* When `isInteractive` is `true`, the outer wrapper is a `Pressable`; otherwise it is a {@link BoxRow} with `ViewProps`.
|
|
32
|
+
*/
|
|
33
|
+
export type SectionHeaderProps = (SectionHeaderPropsBase & {
|
|
34
|
+
isInteractive?: false;
|
|
35
|
+
} & Omit<ViewProps, 'children'>) | (SectionHeaderPropsBase & {
|
|
36
|
+
isInteractive: true;
|
|
37
|
+
} & Omit<PressableProps, 'children'>);
|
|
38
|
+
export {};
|
|
32
39
|
//# sourceMappingURL=SectionHeader.types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.types.d.mts","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gDAAgD;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;
|
|
1
|
+
{"version":3,"file":"SectionHeader.types.d.mts","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gDAAgD;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB;AAG9D,OAAO,KAAK,EAAE,WAAW,EAAE,mCAA+B;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD,KAAK,sBAAsB,GAAG,wBAAwB,GAAG;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IAClD;;OAEG;IACH,iBAAiB,CAAC,EAAE,IAAI,CACtB,OAAO,CAAC,WAAW,CAAC,EACpB,UAAU,GAAG,cAAc,GAAG,WAAW,CAC1C,CAAC;IACF;;OAEG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAClD;;OAEG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAChD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B,CAAC,sBAAsB,GAAG;IACxB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,GAChC,CAAC,sBAAsB,GAAG;IACxB,aAAa,EAAE,IAAI,CAAC;CACrB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.types.mjs","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { SectionHeaderPropsShared } from '@metamask-previews/design-system-shared';\nimport type { ViewProps } from 'react-native';\n\n// Internal dependencies.\nimport type { BoxRowProps } from '../BoxRow/BoxRow.types';\nimport type { IconProps } from '../Icon';\nimport type { TextProps } from '../Text/Text.types';\n\
|
|
1
|
+
{"version":3,"file":"SectionHeader.types.mjs","sourceRoot":"","sources":["../../../src/components/SectionHeader/SectionHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { SectionHeaderPropsShared } from '@metamask-previews/design-system-shared';\nimport type { PressableProps, ViewProps } from 'react-native';\n\n// Internal dependencies.\nimport type { BoxRowProps } from '../BoxRow/BoxRow.types';\nimport type { IconProps } from '../Icon';\nimport type { TextProps } from '../Text/Text.types';\n\ntype SectionHeaderPropsBase = SectionHeaderPropsShared & {\n /**\n * Optional props merged into {@link BoxRow} `textProps` when `title` is a string.\n */\n titleProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional props spread onto the title row {@link BoxRow}. Omits `children`, `endAccessory`, and `textProps` (SectionHeader sets those via `title`, `titleAccessory`, and `titleProps`).\n */\n titleWrapperProps?: Omit<\n Partial<BoxRowProps>,\n 'children' | 'endAccessory' | 'textProps'\n >;\n /**\n * Optional prop to pass additional properties to the start icon.\n */\n startIconProps?: Omit<Partial<IconProps>, 'name'>;\n /**\n * Optional prop to pass additional properties to the end icon.\n */\n endIconProps?: Omit<Partial<IconProps>, 'name'>;\n /**\n * Optional Tailwind class name to apply to the outer row.\n */\n twClassName?: string;\n};\n\n/**\n * SectionHeader component props (React Native).\n * Extends {@link SectionHeaderPropsShared} with platform `Text` / `Icon` passthroughs, `twClassName`, and wrapper props.\n * When `isInteractive` is `true`, the outer wrapper is a `Pressable`; otherwise it is a {@link BoxRow} with `ViewProps`.\n */\nexport type SectionHeaderProps =\n | (SectionHeaderPropsBase & {\n isInteractive?: false;\n } & Omit<ViewProps, 'children'>)\n | (SectionHeaderPropsBase & {\n isInteractive: true;\n } & Omit<PressableProps, 'children'>);\n"]}
|
|
@@ -4,9 +4,8 @@ exports.TextArea = void 0;
|
|
|
4
4
|
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const Box_1 = require("../Box/index.cjs");
|
|
8
7
|
const Input_1 = require("../Input/index.cjs");
|
|
9
|
-
exports.TextArea = (0, react_1.forwardRef)(({ value, onChangeText, placeholder, isReadOnly, onBlur, onFocus, autoFocus = false,
|
|
8
|
+
exports.TextArea = (0, react_1.forwardRef)(({ value, onChangeText, placeholder, isReadOnly, onBlur, onFocus, autoFocus = false, isDisabled = false, isError = false, textVariant, style, twClassName, testID, ...props }, ref) => {
|
|
10
9
|
const [isFocused, setIsFocused] = (0, react_1.useState)(autoFocus);
|
|
11
10
|
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
12
11
|
(0, react_1.useEffect)(() => {
|
|
@@ -14,7 +13,6 @@ exports.TextArea = (0, react_1.forwardRef)(({ value, onChangeText, placeholder,
|
|
|
14
13
|
setIsFocused(false);
|
|
15
14
|
}
|
|
16
15
|
}, [isDisabled, isReadOnly]);
|
|
17
|
-
const { twClassName: inputTwClassNameFromProps, ...inputRestWithoutTwClassName } = inputProps ?? {};
|
|
18
16
|
const onBlurHandler = (0, react_1.useCallback)((e) => {
|
|
19
17
|
if (!isDisabled) {
|
|
20
18
|
setIsFocused(false);
|
|
@@ -27,12 +25,10 @@ exports.TextArea = (0, react_1.forwardRef)(({ value, onChangeText, placeholder,
|
|
|
27
25
|
onFocus?.(e);
|
|
28
26
|
}
|
|
29
27
|
}, [isDisabled, onFocus]);
|
|
30
|
-
return (<
|
|
28
|
+
return (<Input_1.Input ref={ref} {...props} testID={testID} value={value} onChangeText={onChangeText} placeholder={placeholder} isReadOnly={isReadOnly} textVariant={textVariant} isDisabled={isDisabled} autoFocus={autoFocus} onBlur={onBlurHandler} onFocus={onFocusHandler} isStateStylesDisabled multiline textAlignVertical="top" style={[
|
|
31
29
|
tw.style('rounded-lg', 'min-h-24', 'border', 'px-4', 'py-3', 'bg-muted', isDisabled && 'border-muted', !isDisabled && isError && 'border-error-default', !isDisabled && !isError && isFocused && 'border-default', !isDisabled && !isError && !isFocused && 'border-muted', isDisabled && 'opacity-50', twClassName),
|
|
32
30
|
style,
|
|
33
|
-
]}
|
|
34
|
-
{inputElement || (<Input_1.Input {...inputRestWithoutTwClassName} ref={inputRef} value={value} onChangeText={onChangeText} placeholder={placeholder} isReadOnly={isReadOnly} textVariant={textVariant} isDisabled={isDisabled} autoFocus={autoFocus} onBlur={onBlurHandler} onFocus={onFocusHandler} isStateStylesDisabled multiline textAlignVertical="top" twClassName={`min-h-[88px] w-full flex-1 self-stretch bg-transparent border-0 py-1${inputTwClassNameFromProps ? ` ${inputTwClassNameFromProps}` : ''}`}/>)}
|
|
35
|
-
</Box_1.Box>);
|
|
31
|
+
]}/>);
|
|
36
32
|
});
|
|
37
33
|
exports.TextArea.displayName = 'TextArea';
|
|
38
34
|
//# sourceMappingURL=TextArea.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.cjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";;;AAAA,8FAA4E;AAC5E,iCAAqE;AACrE,+
|
|
1
|
+
{"version":3,"file":"TextArea.cjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";;;AAAA,8FAA4E;AAC5E,iCAAqE;AACrE,+CAAyC;AAEzC,8CAAiC;AAKpB,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,CACE,EACE,KAAK,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,KAAK,EACL,WAAW,EACX,MAAM,EACN,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,UAAU,IAAI,UAAU,EAAE;YAC5B,YAAY,CAAC,KAAK,CAAC,CAAC;SACrB;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAE7B,MAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,CAAC,CAAmD,EAAE,EAAE;QACtD,IAAI,CAAC,UAAU,EAAE;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;SACb;IACH,CAAC,EACD,CAAC,UAAU,EAAE,MAAM,CAAC,CACrB,CAAC;IAEF,MAAM,cAAc,GAAG,IAAA,mBAAW,EAChC,CAAC,CAAoD,EAAE,EAAE;QACvD,IAAI,CAAC,UAAU,EAAE;YACf,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;SACd;IACH,CAAC,EACD,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB,CAAC;IAEF,OAAO,CACL,CAAC,aAAK,CACJ,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,IAAI,KAAK,CAAC,CACV,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,MAAM,CAAC,CAAC,aAAa,CAAC,CACtB,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,qBAAqB,CACrB,SAAS,CACT,iBAAiB,CAAC,KAAK,CACvB,KAAK,CAAC,CAAC;YACL,EAAE,CAAC,KAAK,CACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,IAAI,cAAc,EAC5B,CAAC,UAAU,IAAI,OAAO,IAAI,sBAAsB,EAChD,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,SAAS,IAAI,gBAAgB,EACxD,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,cAAc,EACvD,UAAU,IAAI,YAAY,EAC1B,WAAW,CACZ;YACD,KAAK;SACN,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\nimport { TextInput } from 'react-native';\n\nimport { Input } from '../Input';\nimport type { InputProps } from '../Input/Input.types';\n\nimport type { TextAreaProps } from './TextArea.types';\n\nexport const TextArea = forwardRef<TextInput, TextAreaProps>(\n (\n {\n value,\n onChangeText,\n placeholder,\n isReadOnly,\n onBlur,\n onFocus,\n autoFocus = false,\n isDisabled = false,\n isError = false,\n textVariant,\n style,\n twClassName,\n testID,\n ...props\n },\n ref,\n ) => {\n const [isFocused, setIsFocused] = useState(autoFocus);\n const tw = useTailwind();\n\n useEffect(() => {\n if (isDisabled || isReadOnly) {\n setIsFocused(false);\n }\n }, [isDisabled, isReadOnly]);\n\n const onBlurHandler = useCallback(\n (e: Parameters<NonNullable<InputProps['onBlur']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(false);\n onBlur?.(e);\n }\n },\n [isDisabled, onBlur],\n );\n\n const onFocusHandler = useCallback(\n (e: Parameters<NonNullable<InputProps['onFocus']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(true);\n onFocus?.(e);\n }\n },\n [isDisabled, onFocus],\n );\n\n return (\n <Input\n ref={ref}\n {...props}\n testID={testID}\n value={value}\n onChangeText={onChangeText}\n placeholder={placeholder}\n isReadOnly={isReadOnly}\n textVariant={textVariant}\n isDisabled={isDisabled}\n autoFocus={autoFocus}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n isStateStylesDisabled\n multiline\n textAlignVertical=\"top\"\n style={[\n tw.style(\n 'rounded-lg',\n 'min-h-24',\n 'border',\n 'px-4',\n 'py-3',\n 'bg-muted',\n isDisabled && 'border-muted',\n !isDisabled && isError && 'border-error-default',\n !isDisabled && !isError && isFocused && 'border-default',\n !isDisabled && !isError && !isFocused && 'border-muted',\n isDisabled && 'opacity-50',\n twClassName,\n ),\n style,\n ]}\n />\n );\n },\n);\n\nTextArea.displayName = 'TextArea';\n"]}
|