@ledgerhq/lumen-ui-rnative 0.1.56 → 0.1.58
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/dist/module/lib/Components/core/Button/Button.js +1 -1
- package/dist/module/lib/Components/core/Button/Button.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.figma.js +17 -1
- package/dist/module/lib/Components/core/Card/Card.figma.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.js +22 -15
- package/dist/module/lib/Components/core/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.mdx +10 -1
- package/dist/module/lib/Components/core/Card/Card.stories.js +59 -0
- package/dist/module/lib/Components/core/Card/Card.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.test.js +23 -0
- package/dist/module/lib/Components/core/Card/Card.test.js.map +1 -1
- package/dist/module/lib/Components/core/IconButton/IconButton.js +1 -1
- package/dist/module/lib/Components/core/IconButton/IconButton.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.js +91 -66
- package/dist/module/lib/Components/core/Link/Link.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.mdx +23 -2
- package/dist/module/lib/Components/core/Link/Link.test.js +34 -7
- package/dist/module/lib/Components/core/Link/Link.test.js.map +1 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.js +1 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.js.map +1 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.test.js +29 -0
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.test.js.map +1 -1
- package/dist/module/lib/Components/core/Trend/Trend.js +1 -2
- package/dist/module/lib/Components/core/Trend/Trend.js.map +1 -1
- package/dist/module/lib/Components/core/Trend/Trend.test.js +5 -5
- package/dist/module/lib/Components/core/Trend/Trend.test.js.map +1 -1
- package/dist/module/lib/Components/{core/Button → internal/BaseButton}/BaseButton.js +1 -1
- package/dist/module/lib/Components/internal/BaseButton/BaseButton.js.map +1 -0
- package/dist/module/lib/Components/{core/Button → internal/BaseButton}/BaseButton.test.js +1 -1
- package/dist/module/lib/Components/internal/BaseButton/BaseButton.test.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseButton/index.js +5 -0
- package/dist/module/lib/Components/internal/BaseButton/index.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseButton/types.js +4 -0
- package/dist/module/lib/Components/internal/BaseButton/types.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/CalendarRefresh.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CalendarRefresh.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/CodeShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CodeShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/CoinStacked.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CoinStacked.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Craft.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Craft.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Equal.js +49 -0
- package/dist/module/lib/Components/symbols/icons/Equal.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/File.js +50 -0
- package/dist/module/lib/Components/symbols/icons/File.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/FileShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/FileShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Fire.js +51 -0
- package/dist/module/lib/Components/symbols/icons/Fire.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Handshake.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Handshake.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/MailShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/MailShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Merge.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Merge.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Minimize.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Minimize.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Nested.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Nested.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/NotEqual.js +49 -0
- package/dist/module/lib/Components/symbols/icons/NotEqual.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/PeopleShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/PeopleShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Pin.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Pin.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/PinFill.js +47 -0
- package/dist/module/lib/Components/symbols/icons/PinFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Receive.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Receive.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Retry.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Retry.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Send.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Send.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Servers.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Servers.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/SubArrow.js +50 -0
- package/dist/module/lib/Components/symbols/icons/SubArrow.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/UsbCircleFill.js +52 -0
- package/dist/module/lib/Components/symbols/icons/UsbCircleFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/WarningCircleFill.js +47 -0
- package/dist/module/lib/Components/symbols/icons/WarningCircleFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/index.js +24 -0
- package/dist/module/lib/Components/symbols/index.js.map +1 -1
- package/dist/module/lib/utils/index.js +0 -1
- package/dist/module/lib/utils/index.js.map +1 -1
- package/dist/typescript/src/lib/Components/core/Button/types.d.ts +7 -38
- package/dist/typescript/src/lib/Components/core/Button/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Card/Card.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Card/types.d.ts +6 -0
- package/dist/typescript/src/lib/Components/core/Card/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/IconButton/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/IconButton/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Link/Link.d.ts +4 -1
- package/dist/typescript/src/lib/Components/core/Link/Link.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Link/types.d.ts +11 -4
- package/dist/typescript/src/lib/Components/core/Link/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/MediaButton/types.d.ts +2 -6
- package/dist/typescript/src/lib/Components/core/MediaButton/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Trend/Trend.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseButton/BaseButton.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/internal/BaseButton/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/internal/BaseButton/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/internal/BaseButton/types.d.ts +39 -0
- package/dist/typescript/src/lib/Components/internal/BaseButton/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CalendarRefresh.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CalendarRefresh.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CodeShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CodeShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CoinStacked.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CoinStacked.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Craft.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Craft.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Equal.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Equal.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/File.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/File.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/FileShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/FileShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Fire.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Fire.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Handshake.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Handshake.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/MailShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/MailShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Merge.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Merge.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Minimize.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Minimize.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Nested.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Nested.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/NotEqual.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/NotEqual.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PeopleShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PeopleShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Pin.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Pin.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PinFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PinFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Receive.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Receive.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Retry.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Retry.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Send.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Send.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Servers.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Servers.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/SubArrow.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/SubArrow.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/UsbCircleFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/UsbCircleFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/WarningCircleFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/WarningCircleFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts +24 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/utils/index.d.ts +0 -1
- package/dist/typescript/src/lib/utils/index.d.ts.map +1 -1
- package/dist/typescript/src/styles/types/create.types.d.ts +1 -3
- package/dist/typescript/src/styles/types/create.types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/Components/core/Button/Button.tsx +1 -1
- package/src/lib/Components/core/Button/types.ts +7 -42
- package/src/lib/Components/core/Card/Card.figma.tsx +20 -0
- package/src/lib/Components/core/Card/Card.mdx +10 -1
- package/src/lib/Components/core/Card/Card.stories.tsx +44 -0
- package/src/lib/Components/core/Card/Card.test.tsx +25 -0
- package/src/lib/Components/core/Card/Card.tsx +26 -17
- package/src/lib/Components/core/Card/types.ts +7 -0
- package/src/lib/Components/core/IconButton/IconButton.tsx +1 -1
- package/src/lib/Components/core/IconButton/types.ts +1 -1
- package/src/lib/Components/core/Link/Link.mdx +23 -2
- package/src/lib/Components/core/Link/Link.test.tsx +64 -17
- package/src/lib/Components/core/Link/Link.tsx +92 -87
- package/src/lib/Components/core/Link/types.ts +11 -4
- package/src/lib/Components/core/MediaBanner/MediaBanner.test.tsx +31 -0
- package/src/lib/Components/core/MediaBanner/MediaBanner.tsx +1 -1
- package/src/lib/Components/core/MediaButton/types.ts +3 -6
- package/src/lib/Components/core/Trend/Trend.test.tsx +4 -5
- package/src/lib/Components/core/Trend/Trend.tsx +1 -3
- package/src/lib/Components/{core/Button → internal/BaseButton}/BaseButton.test.tsx +1 -1
- package/src/lib/Components/{core/Button → internal/BaseButton}/BaseButton.tsx +1 -1
- package/src/lib/Components/internal/BaseButton/index.ts +2 -0
- package/src/lib/Components/internal/BaseButton/types.ts +42 -0
- package/src/lib/Components/symbols/icons/CalendarRefresh.tsx +45 -0
- package/src/lib/Components/symbols/icons/CodeShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/CoinStacked.tsx +45 -0
- package/src/lib/Components/symbols/icons/Craft.tsx +45 -0
- package/src/lib/Components/symbols/icons/Equal.tsx +44 -0
- package/src/lib/Components/symbols/icons/File.tsx +45 -0
- package/src/lib/Components/symbols/icons/FileShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/Fire.tsx +46 -0
- package/src/lib/Components/symbols/icons/Handshake.tsx +45 -0
- package/src/lib/Components/symbols/icons/MailShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/Merge.tsx +45 -0
- package/src/lib/Components/symbols/icons/Minimize.tsx +45 -0
- package/src/lib/Components/symbols/icons/Nested.tsx +45 -0
- package/src/lib/Components/symbols/icons/NotEqual.tsx +44 -0
- package/src/lib/Components/symbols/icons/PeopleShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/Pin.tsx +45 -0
- package/src/lib/Components/symbols/icons/PinFill.tsx +42 -0
- package/src/lib/Components/symbols/icons/Receive.tsx +45 -0
- package/src/lib/Components/symbols/icons/Retry.tsx +45 -0
- package/src/lib/Components/symbols/icons/Send.tsx +45 -0
- package/src/lib/Components/symbols/icons/Servers.tsx +45 -0
- package/src/lib/Components/symbols/icons/SubArrow.tsx +45 -0
- package/src/lib/Components/symbols/icons/UsbCircleFill.tsx +48 -0
- package/src/lib/Components/symbols/icons/WarningCircleFill.tsx +42 -0
- package/src/lib/Components/symbols/index.ts +24 -0
- package/src/lib/utils/index.ts +0 -1
- package/src/styles/types/create.types.ts +6 -6
- package/dist/module/lib/Components/core/Button/BaseButton.js.map +0 -1
- package/dist/module/lib/Components/core/Button/BaseButton.test.js.map +0 -1
- package/dist/module/lib/utils/react/extractTextFromChildren.js +0 -23
- package/dist/module/lib/utils/react/extractTextFromChildren.js.map +0 -1
- package/dist/module/lib/utils/react/index.js +0 -4
- package/dist/module/lib/utils/react/index.js.map +0 -1
- package/dist/typescript/src/lib/Components/core/Button/BaseButton.d.ts.map +0 -1
- package/dist/typescript/src/lib/utils/react/extractTextFromChildren.d.ts +0 -8
- package/dist/typescript/src/lib/utils/react/extractTextFromChildren.d.ts.map +0 -1
- package/dist/typescript/src/lib/utils/react/index.d.ts +0 -2
- package/dist/typescript/src/lib/utils/react/index.d.ts.map +0 -1
- package/src/lib/utils/react/extractTextFromChildren.ts +0 -32
- package/src/lib/utils/react/index.ts +0 -1
- /package/dist/typescript/src/lib/Components/{core/Button → internal/BaseButton}/BaseButton.d.ts +0 -0
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CardContent,
|
|
10
10
|
CardContentDescription,
|
|
11
11
|
CardContentTitle,
|
|
12
|
+
CardFooter,
|
|
12
13
|
CardHeader,
|
|
13
14
|
CardLeading,
|
|
14
15
|
CardTrailing,
|
|
@@ -109,6 +110,25 @@ figma.connect(
|
|
|
109
110
|
},
|
|
110
111
|
);
|
|
111
112
|
|
|
113
|
+
// —— CardFooter ——
|
|
114
|
+
figma.connect(
|
|
115
|
+
CardFooter,
|
|
116
|
+
'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=14067-7402',
|
|
117
|
+
{
|
|
118
|
+
imports: ["import { CardFooter } from '@ledgerhq/lumen-ui-rnative'"],
|
|
119
|
+
props: {
|
|
120
|
+
appearance: figma.enum('appearance', {
|
|
121
|
+
'no-background': 'no-background',
|
|
122
|
+
plain: 'plain',
|
|
123
|
+
}),
|
|
124
|
+
children: figma.children('*'),
|
|
125
|
+
},
|
|
126
|
+
example: (props) => (
|
|
127
|
+
<CardFooter appearance={props.appearance}>{props.children}</CardFooter>
|
|
128
|
+
),
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
112
132
|
// —— Card (expandable/info variant) ——
|
|
113
133
|
figma.connect(
|
|
114
134
|
'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=14481-33979',
|
|
@@ -43,7 +43,7 @@ Card is a flexible container component that uses a composite pattern for display
|
|
|
43
43
|
- **CardContentTitle**: Primary text label with single-line truncation.
|
|
44
44
|
- **CardContentDescription**: Secondary muted text with single-line truncation.
|
|
45
45
|
- **CardTrailing**: Right section for trailing content (Button, Tag, right-aligned values, etc.).
|
|
46
|
-
- **CardFooter**: Footer container
|
|
46
|
+
- **CardFooter**: Footer container. `appearance="plain"` (default) uses a muted background; `appearance="no-background"` blends with the card surface. Collapses with a 300ms animation when `expanded === false`.
|
|
47
47
|
- **CardFooterActions**: Horizontal row for action buttons.
|
|
48
48
|
|
|
49
49
|
## Properties
|
|
@@ -66,6 +66,15 @@ The `disabled` prop cascades disabled styling to all sub-components via context.
|
|
|
66
66
|
|
|
67
67
|
<Canvas of={CardStories.StatesShowcase} />
|
|
68
68
|
|
|
69
|
+
## Appearance
|
|
70
|
+
|
|
71
|
+
`CardFooter` supports two appearances:
|
|
72
|
+
|
|
73
|
+
- **`"plain"`** (default): muted transparent background that visually separates the footer from the header.
|
|
74
|
+
- **`"no-background"`**: transparent, so the footer blends with the card surface.
|
|
75
|
+
|
|
76
|
+
<Canvas of={CardStories.FooterAppearance} />
|
|
77
|
+
|
|
69
78
|
## Expandable
|
|
70
79
|
|
|
71
80
|
Set `type="expandable"` with the `expanded` and `onPress` props. Only the header shows pressed states and handles the press. Footer actions (buttons) work independently.
|
|
@@ -243,6 +243,50 @@ export const StatesShowcase: Story = {
|
|
|
243
243
|
),
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
+
export const FooterAppearance: Story = {
|
|
247
|
+
render: () => (
|
|
248
|
+
<Box lx={{ flexDirection: 'column', gap: 's16' }}>
|
|
249
|
+
<Card type='info' lx={{ width: 's320' }}>
|
|
250
|
+
<CardHeader>
|
|
251
|
+
<CardLeading>
|
|
252
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
253
|
+
<CardContent>
|
|
254
|
+
<CardContentTitle>Plain</CardContentTitle>
|
|
255
|
+
<CardContentDescription>
|
|
256
|
+
Muted footer background
|
|
257
|
+
</CardContentDescription>
|
|
258
|
+
</CardContent>
|
|
259
|
+
</CardLeading>
|
|
260
|
+
</CardHeader>
|
|
261
|
+
<CardFooter appearance='plain'>
|
|
262
|
+
<CardContentDescription>
|
|
263
|
+
3 assets on 2 networks
|
|
264
|
+
</CardContentDescription>
|
|
265
|
+
</CardFooter>
|
|
266
|
+
</Card>
|
|
267
|
+
|
|
268
|
+
<Card type='info' lx={{ width: 's320' }}>
|
|
269
|
+
<CardHeader>
|
|
270
|
+
<CardLeading>
|
|
271
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
272
|
+
<CardContent>
|
|
273
|
+
<CardContentTitle>No background</CardContentTitle>
|
|
274
|
+
<CardContentDescription>
|
|
275
|
+
Blends with the card surface
|
|
276
|
+
</CardContentDescription>
|
|
277
|
+
</CardContent>
|
|
278
|
+
</CardLeading>
|
|
279
|
+
</CardHeader>
|
|
280
|
+
<CardFooter appearance='no-background'>
|
|
281
|
+
<CardContentDescription>
|
|
282
|
+
3 assets on 2 networks
|
|
283
|
+
</CardContentDescription>
|
|
284
|
+
</CardFooter>
|
|
285
|
+
</Card>
|
|
286
|
+
</Box>
|
|
287
|
+
),
|
|
288
|
+
};
|
|
289
|
+
|
|
246
290
|
export const DisabledWithSpot: Story = {
|
|
247
291
|
args: {
|
|
248
292
|
lx: { width: 's320' },
|
|
@@ -165,6 +165,31 @@ describe('Card', () => {
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
+
describe('CardFooter appearance', () => {
|
|
169
|
+
it.each(['plain', 'no-background'] as const)(
|
|
170
|
+
'renders with %s appearance',
|
|
171
|
+
(appearance) => {
|
|
172
|
+
render(
|
|
173
|
+
<TestWrapper>
|
|
174
|
+
<Card>
|
|
175
|
+
<CardHeader>
|
|
176
|
+
<CardLeading>
|
|
177
|
+
<CardContentTitle>Title</CardContentTitle>
|
|
178
|
+
</CardLeading>
|
|
179
|
+
</CardHeader>
|
|
180
|
+
<CardFooter appearance={appearance} testID='card-footer'>
|
|
181
|
+
<CardContentDescription>Footer text</CardContentDescription>
|
|
182
|
+
</CardFooter>
|
|
183
|
+
</Card>
|
|
184
|
+
</TestWrapper>,
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
expect(screen.getByTestId('card-footer')).toBeTruthy();
|
|
188
|
+
expect(screen.getByText('Footer text')).toBeTruthy();
|
|
189
|
+
},
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
|
|
168
193
|
describe('CardContentRow', () => {
|
|
169
194
|
it('renders title alongside additional content in a row', () => {
|
|
170
195
|
render(
|
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
CardContentTitleProps,
|
|
26
26
|
CardContextValue,
|
|
27
27
|
CardFooterActionsProps,
|
|
28
|
+
CardFooterAppearance,
|
|
28
29
|
CardFooterProps,
|
|
29
30
|
CardHeaderProps,
|
|
30
31
|
CardLeadingProps,
|
|
@@ -661,6 +662,7 @@ const useCardFooterAnimation = ({
|
|
|
661
662
|
export const CardFooter = ({
|
|
662
663
|
ref,
|
|
663
664
|
children,
|
|
665
|
+
appearance = 'plain',
|
|
664
666
|
lx = {},
|
|
665
667
|
style,
|
|
666
668
|
...props
|
|
@@ -675,24 +677,31 @@ export const CardFooter = ({
|
|
|
675
677
|
});
|
|
676
678
|
|
|
677
679
|
const footerStyles = useStyleSheet(
|
|
678
|
-
(t) =>
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
content: StyleSheet.flatten([
|
|
683
|
-
{
|
|
684
|
-
width: t.sizes.full,
|
|
685
|
-
flexDirection: 'column',
|
|
686
|
-
gap: t.spacings.s8,
|
|
687
|
-
paddingHorizontal: t.spacings.s12,
|
|
688
|
-
paddingVertical: t.spacings.s10,
|
|
680
|
+
(t) => {
|
|
681
|
+
const appearanceStyles = {
|
|
682
|
+
plain: {
|
|
683
|
+
backgroundColor: t.colors.bg.mutedTransparent,
|
|
689
684
|
},
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
685
|
+
'no-background': {},
|
|
686
|
+
} satisfies Record<CardFooterAppearance, ViewStyle>;
|
|
687
|
+
|
|
688
|
+
return {
|
|
689
|
+
wrapper: appearanceStyles[appearance],
|
|
690
|
+
content: StyleSheet.flatten([
|
|
691
|
+
{
|
|
692
|
+
width: t.sizes.full,
|
|
693
|
+
flexDirection: 'column',
|
|
694
|
+
gap: t.spacings.s8,
|
|
695
|
+
paddingHorizontal: t.spacings.s12,
|
|
696
|
+
paddingVertical: t.spacings.s10,
|
|
697
|
+
},
|
|
698
|
+
disabled && {
|
|
699
|
+
opacity: 0.5,
|
|
700
|
+
},
|
|
701
|
+
]),
|
|
702
|
+
};
|
|
703
|
+
},
|
|
704
|
+
[disabled, appearance],
|
|
696
705
|
);
|
|
697
706
|
|
|
698
707
|
return (
|
|
@@ -103,7 +103,14 @@ export type CardTrailingProps = {
|
|
|
103
103
|
children: ReactNode;
|
|
104
104
|
} & Omit<StyledViewProps, 'children'>;
|
|
105
105
|
|
|
106
|
+
export type CardFooterAppearance = 'plain' | 'no-background';
|
|
107
|
+
|
|
106
108
|
export type CardFooterProps = {
|
|
109
|
+
/**
|
|
110
|
+
* The visual appearance of the footer background.
|
|
111
|
+
* @default 'plain'
|
|
112
|
+
*/
|
|
113
|
+
appearance?: CardFooterAppearance;
|
|
107
114
|
/**
|
|
108
115
|
* The footer content (DescriptionList, Button, etc.).
|
|
109
116
|
*/
|
|
@@ -68,6 +68,12 @@ Links adapt to their container, truncating long text on a single line to prevent
|
|
|
68
68
|
|
|
69
69
|
<Canvas of={LinkStories.ResponsiveLayout} />
|
|
70
70
|
|
|
71
|
+
## Inline within text
|
|
72
|
+
|
|
73
|
+
Links render as text, so they can be nested inside a sentence and flow with it without affecting the line height:
|
|
74
|
+
|
|
75
|
+
<Canvas of={LinkStories.InTextUsage} />
|
|
76
|
+
|
|
71
77
|
## Accessibility
|
|
72
78
|
|
|
73
79
|
To be implemented:
|
|
@@ -173,13 +179,28 @@ function MyComponent() {
|
|
|
173
179
|
}
|
|
174
180
|
```
|
|
175
181
|
|
|
176
|
-
###
|
|
182
|
+
### Inline Within Text
|
|
183
|
+
|
|
184
|
+
The Link component is built on React Native's `Text`, so it can be nested inside a sentence without breaking the line height:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
188
|
+
By continuing, you agree to our{' '}
|
|
189
|
+
<Link size='sm' href='https://example.com/terms'>
|
|
190
|
+
Terms & Conditions
|
|
191
|
+
</Link>
|
|
192
|
+
.
|
|
193
|
+
</Text>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Text Integration
|
|
177
197
|
|
|
178
|
-
The Link component
|
|
198
|
+
The Link component accepts all `Text` props, e.g. press callbacks or line clamping:
|
|
179
199
|
|
|
180
200
|
```tsx
|
|
181
201
|
<Link
|
|
182
202
|
href='https://example.com'
|
|
203
|
+
numberOfLines={2}
|
|
183
204
|
onPressIn={() => console.log('Press started')}
|
|
184
205
|
onPressOut={() => console.log('Press ended')}
|
|
185
206
|
>
|
|
@@ -21,6 +21,25 @@ const renderWithProvider = (component: React.ReactElement) => {
|
|
|
21
21
|
);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
type LinkElement = ReturnType<typeof screen.getByText>;
|
|
25
|
+
type IconWrapperStyle = {
|
|
26
|
+
paddingLeft?: number;
|
|
27
|
+
paddingRight?: number;
|
|
28
|
+
transform?: { translateY: number }[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Icons are rendered inline as children of the link Text, so they are read from
|
|
32
|
+
// the element tree rather than queried by testID.
|
|
33
|
+
const getLinkChildren = (link: LinkElement): React.ReactNode[] =>
|
|
34
|
+
Children.toArray(link.props.children as React.ReactNode);
|
|
35
|
+
|
|
36
|
+
const getIconWrapperStyle = (link: LinkElement): IconWrapperStyle => {
|
|
37
|
+
const [iconWrapper] = getLinkChildren(link) as React.ReactElement<{
|
|
38
|
+
style: IconWrapperStyle;
|
|
39
|
+
}>[];
|
|
40
|
+
return iconWrapper.props.style;
|
|
41
|
+
};
|
|
42
|
+
|
|
24
43
|
const typographyTokens = ledgerLiveThemes.dark.typographies.sm;
|
|
25
44
|
const typographies = {
|
|
26
45
|
...typographyTokens.heading,
|
|
@@ -41,7 +60,7 @@ describe('Link Component', () => {
|
|
|
41
60
|
</Link>,
|
|
42
61
|
);
|
|
43
62
|
|
|
44
|
-
expect(screen.getByText('Click me')
|
|
63
|
+
expect(screen.getByText('Click me')).toBe(screen.getByTestId('link'));
|
|
45
64
|
expect(screen.getByTestId('link').props.accessibilityRole).toBe('link');
|
|
46
65
|
});
|
|
47
66
|
|
|
@@ -73,13 +92,17 @@ describe('Link Component', () => {
|
|
|
73
92
|
|
|
74
93
|
describe('Sizes', () => {
|
|
75
94
|
it.each([
|
|
76
|
-
['sm', typographies.body2SemiBold, spacings.s4],
|
|
77
|
-
['md', typographies.body1SemiBold, spacings.s8],
|
|
95
|
+
['sm', typographies.body2SemiBold, spacings.s4, 3],
|
|
96
|
+
['md', typographies.body1SemiBold, spacings.s8, 4],
|
|
78
97
|
])(
|
|
79
|
-
'should apply %s size with correct typography and
|
|
80
|
-
(size, typography, expectedGap) => {
|
|
98
|
+
'should apply %s size with correct typography and icon spacing',
|
|
99
|
+
(size, typography, expectedGap, expectedOffset) => {
|
|
81
100
|
renderWithProvider(
|
|
82
|
-
<Link
|
|
101
|
+
<Link
|
|
102
|
+
href='https://example.com'
|
|
103
|
+
size={size as LinkProps['size']}
|
|
104
|
+
icon={Information}
|
|
105
|
+
>
|
|
83
106
|
Link
|
|
84
107
|
</Link>,
|
|
85
108
|
);
|
|
@@ -87,9 +110,11 @@ describe('Link Component', () => {
|
|
|
87
110
|
const textStyle = screen.getByText('Link').props.style;
|
|
88
111
|
expect(textStyle.fontSize).toBe(typography.fontSize);
|
|
89
112
|
expect(textStyle.fontWeight).toBe(typography.fontWeight);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
);
|
|
113
|
+
|
|
114
|
+
const iconStyle = getIconWrapperStyle(screen.getByText('Link'));
|
|
115
|
+
expect(iconStyle.paddingRight).toBe(expectedGap);
|
|
116
|
+
// Keeps the inline icons optically centred on the text baseline.
|
|
117
|
+
expect(iconStyle.transform).toEqual([{ translateY: expectedOffset }]);
|
|
93
118
|
},
|
|
94
119
|
);
|
|
95
120
|
});
|
|
@@ -113,6 +138,31 @@ describe('Link Component', () => {
|
|
|
113
138
|
);
|
|
114
139
|
});
|
|
115
140
|
|
|
141
|
+
describe('States', () => {
|
|
142
|
+
it.each([
|
|
143
|
+
['base', colors.text.base, colors.text.basePressed],
|
|
144
|
+
['accent', colors.text.interactive, colors.text.interactivePressed],
|
|
145
|
+
])(
|
|
146
|
+
'should apply the %s pressed color while pressed',
|
|
147
|
+
(appearance, restingColor, pressedColor) => {
|
|
148
|
+
renderWithProvider(
|
|
149
|
+
<Link
|
|
150
|
+
href='https://example.com'
|
|
151
|
+
appearance={appearance as LinkProps['appearance']}
|
|
152
|
+
>
|
|
153
|
+
Link
|
|
154
|
+
</Link>,
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
fireEvent(screen.getByText('Link'), 'onPressIn');
|
|
158
|
+
expect(screen.getByText('Link').props.style.color).toBe(pressedColor);
|
|
159
|
+
|
|
160
|
+
fireEvent(screen.getByText('Link'), 'onPressOut');
|
|
161
|
+
expect(screen.getByText('Link').props.style.color).toBe(restingColor);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
116
166
|
describe('Icons', () => {
|
|
117
167
|
it('should render leading icon when provided', () => {
|
|
118
168
|
renderWithProvider(
|
|
@@ -121,10 +171,9 @@ describe('Link Component', () => {
|
|
|
121
171
|
</Link>,
|
|
122
172
|
);
|
|
123
173
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
);
|
|
127
|
-
expect(children.length).toBe(2); // icon + text wrapper
|
|
174
|
+
const link = screen.getByText('With Icon');
|
|
175
|
+
expect(getLinkChildren(link).length).toBe(2); // icon + label
|
|
176
|
+
expect(getIconWrapperStyle(link).paddingRight).toBe(spacings.s8);
|
|
128
177
|
});
|
|
129
178
|
|
|
130
179
|
it('should render external link icon when isExternal is true', () => {
|
|
@@ -134,10 +183,8 @@ describe('Link Component', () => {
|
|
|
134
183
|
</Link>,
|
|
135
184
|
);
|
|
136
185
|
|
|
137
|
-
const children =
|
|
138
|
-
|
|
139
|
-
);
|
|
140
|
-
expect(children.length).toBe(2); // text wrapper + external icon
|
|
186
|
+
const children = getLinkChildren(screen.getByText('External'));
|
|
187
|
+
expect(children.length).toBe(2); // label + external icon
|
|
141
188
|
});
|
|
142
189
|
});
|
|
143
190
|
|
|
@@ -1,17 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { Linking, StyleSheet, View } from 'react-native';
|
|
2
4
|
import { useStyleSheet } from '../../../../styles';
|
|
3
|
-
import {
|
|
5
|
+
import type { LumenTypographyTokenName } from '../../../../styles';
|
|
6
|
+
import { useHapticFeedbackWithPressIn } from '../../../Haptics';
|
|
7
|
+
import type { HapticFeedback } from '../../../Haptics/types';
|
|
8
|
+
import { Text } from '../../primitives/Text';
|
|
4
9
|
import { ExternalLink } from '../../symbols';
|
|
5
10
|
import type { IconSize } from '../../symbols/Icon';
|
|
6
11
|
import type { LinkProps } from './types';
|
|
7
12
|
|
|
13
|
+
type Appearance = NonNullable<LinkProps['appearance']>;
|
|
14
|
+
type Size = NonNullable<LinkProps['size']>;
|
|
15
|
+
|
|
8
16
|
const iconSizeMap: Record<Size, IconSize> = {
|
|
9
17
|
sm: 16,
|
|
10
18
|
md: 20,
|
|
11
19
|
};
|
|
12
20
|
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
const typographyMap: Record<Size, LumenTypographyTokenName> = {
|
|
22
|
+
sm: 'body2SemiBold',
|
|
23
|
+
md: 'body1SemiBold',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Icons nested in a Text are laid out as inline attachments sitting on the
|
|
28
|
+
* baseline, which places them above the text's optical centre. These offsets
|
|
29
|
+
* (`iconSize / 2 - 0.35 * fontSize`, rounded) push them back down.
|
|
30
|
+
*/
|
|
31
|
+
const iconOffsetMap: Record<Size, number> = {
|
|
32
|
+
sm: 3,
|
|
33
|
+
md: 4,
|
|
34
|
+
};
|
|
15
35
|
|
|
16
36
|
type StyleParams = {
|
|
17
37
|
appearance: Appearance;
|
|
@@ -33,35 +53,32 @@ const useStyles = ({ appearance, size, underline, pressed }: StyleParams) => {
|
|
|
33
53
|
accent: t.colors.text.interactivePressed,
|
|
34
54
|
};
|
|
35
55
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
: t.typographies.body1SemiBold;
|
|
56
|
+
const color = pressed
|
|
57
|
+
? pressedTextColors[appearance]
|
|
58
|
+
: textColors[appearance];
|
|
40
59
|
const gap = size === 'sm' ? t.spacings.s4 : t.spacings.s8;
|
|
60
|
+
const iconOffset = iconOffsetMap[size];
|
|
41
61
|
|
|
42
62
|
return {
|
|
43
|
-
|
|
44
|
-
flexDirection: 'row',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
gap,
|
|
47
|
-
},
|
|
48
|
-
textWrapper: {
|
|
63
|
+
text: {
|
|
49
64
|
flexShrink: 1,
|
|
65
|
+
color,
|
|
66
|
+
textDecorationLine: underline ? 'underline' : 'none',
|
|
50
67
|
},
|
|
51
|
-
text: StyleSheet.flatten([
|
|
52
|
-
typography,
|
|
53
|
-
{
|
|
54
|
-
color: pressed
|
|
55
|
-
? pressedTextColors[appearance]
|
|
56
|
-
: textColors[appearance],
|
|
57
|
-
textDecorationLine: underline ? 'underline' : 'none',
|
|
58
|
-
},
|
|
59
|
-
]),
|
|
60
68
|
icon: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
color,
|
|
70
|
+
},
|
|
71
|
+
// Inline attachments only reserve their own layout box, so the spacing
|
|
72
|
+
// has to be padding on a wrapper — a margin on the icon is dropped.
|
|
73
|
+
leadingIconWrapper: {
|
|
74
|
+
paddingRight: gap,
|
|
75
|
+
pointerEvents: 'none',
|
|
76
|
+
transform: [{ translateY: iconOffset }],
|
|
77
|
+
},
|
|
78
|
+
trailingIconWrapper: {
|
|
79
|
+
paddingLeft: gap,
|
|
80
|
+
pointerEvents: 'none',
|
|
81
|
+
transform: [{ translateY: iconOffset }],
|
|
65
82
|
},
|
|
66
83
|
};
|
|
67
84
|
},
|
|
@@ -73,6 +90,9 @@ const useStyles = ({ appearance, size, underline, pressed }: StyleParams) => {
|
|
|
73
90
|
* A customizable link component that supports base and accent color appearances, optional underline, sizes, icons, and external link handling.
|
|
74
91
|
* Opens URLs using React Native's Linking API.
|
|
75
92
|
*
|
|
93
|
+
* Rendered as a `Text`, so it can be nested inside a paragraph of text and flows
|
|
94
|
+
* with it (no extra line height) as well as used on its own.
|
|
95
|
+
*
|
|
76
96
|
* @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-link--docs Guidelines}
|
|
77
97
|
*
|
|
78
98
|
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
@@ -114,9 +134,35 @@ export const Link = ({
|
|
|
114
134
|
isExternal = false,
|
|
115
135
|
href,
|
|
116
136
|
onPress,
|
|
137
|
+
onPressIn,
|
|
138
|
+
onPressOut,
|
|
139
|
+
hapticFeedback,
|
|
140
|
+
numberOfLines = 1,
|
|
141
|
+
suppressHighlighting = true,
|
|
117
142
|
ref,
|
|
118
143
|
...props
|
|
119
144
|
}: LinkProps) => {
|
|
145
|
+
const [pressed, setPressed] = useState(false);
|
|
146
|
+
const styles = useStyles({ appearance, size, underline, pressed });
|
|
147
|
+
const calculatedIconSize = iconSizeMap[size];
|
|
148
|
+
const IconComponent = icon;
|
|
149
|
+
|
|
150
|
+
const intensity: HapticFeedback | undefined =
|
|
151
|
+
hapticFeedback === true ? 'medium' : (hapticFeedback ?? undefined);
|
|
152
|
+
|
|
153
|
+
const { handlePressIn } = useHapticFeedbackWithPressIn({
|
|
154
|
+
hapticFeedback: intensity,
|
|
155
|
+
onPressIn: (event: GestureResponderEvent) => {
|
|
156
|
+
setPressed(true);
|
|
157
|
+
onPressIn?.(event);
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const handlePressOut = (event: GestureResponderEvent) => {
|
|
162
|
+
setPressed(false);
|
|
163
|
+
onPressOut?.(event);
|
|
164
|
+
};
|
|
165
|
+
|
|
120
166
|
const handlePress = async () => {
|
|
121
167
|
if (onPress) {
|
|
122
168
|
onPress();
|
|
@@ -126,75 +172,34 @@ export const Link = ({
|
|
|
126
172
|
};
|
|
127
173
|
|
|
128
174
|
return (
|
|
129
|
-
<
|
|
175
|
+
<Text
|
|
130
176
|
ref={ref}
|
|
131
177
|
lx={lx}
|
|
132
|
-
|
|
178
|
+
typography={typographyMap[size]}
|
|
179
|
+
style={StyleSheet.flatten([styles.text, style])}
|
|
133
180
|
onPress={handlePress}
|
|
181
|
+
onPressIn={handlePressIn}
|
|
182
|
+
onPressOut={handlePressOut}
|
|
183
|
+
suppressHighlighting={suppressHighlighting}
|
|
184
|
+
numberOfLines={numberOfLines}
|
|
134
185
|
accessibilityRole='link'
|
|
135
186
|
{...props}
|
|
136
187
|
>
|
|
137
|
-
{({ pressed }) => (
|
|
138
|
-
<LinkContent
|
|
139
|
-
appearance={appearance}
|
|
140
|
-
size={size}
|
|
141
|
-
underline={underline}
|
|
142
|
-
pressed={pressed}
|
|
143
|
-
icon={icon}
|
|
144
|
-
isExternal={isExternal}
|
|
145
|
-
>
|
|
146
|
-
{children}
|
|
147
|
-
</LinkContent>
|
|
148
|
-
)}
|
|
149
|
-
</Pressable>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
type LinkContentProps = {
|
|
154
|
-
appearance: Appearance;
|
|
155
|
-
size: Size;
|
|
156
|
-
underline: boolean;
|
|
157
|
-
pressed: boolean;
|
|
158
|
-
icon: LinkProps['icon'];
|
|
159
|
-
isExternal: boolean;
|
|
160
|
-
children: React.ReactNode;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const LinkContent = ({
|
|
164
|
-
appearance,
|
|
165
|
-
size,
|
|
166
|
-
underline,
|
|
167
|
-
pressed,
|
|
168
|
-
icon,
|
|
169
|
-
isExternal,
|
|
170
|
-
children,
|
|
171
|
-
}: LinkContentProps) => {
|
|
172
|
-
const calculatedIconSize = iconSizeMap[size];
|
|
173
|
-
const IconComponent = icon;
|
|
174
|
-
const styles = useStyles({
|
|
175
|
-
appearance,
|
|
176
|
-
size,
|
|
177
|
-
underline,
|
|
178
|
-
pressed,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<View style={styles.container} testID='link-content'>
|
|
183
188
|
{IconComponent && (
|
|
184
|
-
<
|
|
189
|
+
<View style={styles.leadingIconWrapper}>
|
|
190
|
+
<IconComponent size={calculatedIconSize} style={styles.icon} />
|
|
191
|
+
</View>
|
|
185
192
|
)}
|
|
186
|
-
|
|
187
|
-
<Text style={styles.text} numberOfLines={1}>
|
|
188
|
-
{children}
|
|
189
|
-
</Text>
|
|
190
|
-
</View>
|
|
193
|
+
{children}
|
|
191
194
|
{isExternal && (
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
<View style={styles.trailingIconWrapper}>
|
|
196
|
+
<ExternalLink
|
|
197
|
+
size={calculatedIconSize}
|
|
198
|
+
style={styles.icon}
|
|
199
|
+
accessible={false}
|
|
200
|
+
/>
|
|
201
|
+
</View>
|
|
197
202
|
)}
|
|
198
|
-
</
|
|
203
|
+
</Text>
|
|
199
204
|
);
|
|
200
205
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
-
import type { StyleProp,
|
|
3
|
-
import type {
|
|
2
|
+
import type { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
import type { StyledTextProps } from '../../../../styles';
|
|
4
|
+
import type { ImpactFeedbackStyle } from '../../../Haptics';
|
|
4
5
|
import type { IconSize } from '../../symbols/Icon';
|
|
5
6
|
|
|
6
7
|
export type LinkProps = {
|
|
@@ -25,7 +26,7 @@ export type LinkProps = {
|
|
|
25
26
|
*/
|
|
26
27
|
icon?: React.ComponentType<{
|
|
27
28
|
size?: IconSize;
|
|
28
|
-
style?: StyleProp<
|
|
29
|
+
style?: StyleProp<TextStyle>;
|
|
29
30
|
}>;
|
|
30
31
|
/**
|
|
31
32
|
* If true, displays an external link icon next to the link text.
|
|
@@ -40,5 +41,11 @@ export type LinkProps = {
|
|
|
40
41
|
* Custom press handler (overrides default href navigation)
|
|
41
42
|
*/
|
|
42
43
|
onPress?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Triggers haptic feedback on press-in.
|
|
46
|
+
* - `true` — default medium intensity.
|
|
47
|
+
* - Impact style: `"light"` | `"medium"` | `"heavy"` | `"soft"` | `"rigid"`.
|
|
48
|
+
*/
|
|
49
|
+
hapticFeedback?: ImpactFeedbackStyle | true;
|
|
43
50
|
} & PropsWithChildren &
|
|
44
|
-
Omit<
|
|
51
|
+
Omit<StyledTextProps, 'onPress' | 'children'>;
|