@ledgerhq/lumen-ui-rnative 0.1.41 → 0.1.43
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/Banner/Banner.js +5 -9
- package/dist/module/lib/Components/Banner/Banner.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.js +17 -21
- package/dist/module/lib/Components/MediaButton/MediaButton.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.test.js +26 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.test.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.test.js +162 -66
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.test.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/usePillLayout.js +19 -15
- package/dist/module/lib/Components/SegmentedControl/usePillLayout.js.map +1 -1
- package/dist/module/lib/Components/Trend/Trend.js +19 -16
- package/dist/module/lib/Components/Trend/Trend.js.map +1 -1
- package/dist/typescript/src/lib/Components/Banner/Banner.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Banner/types.d.ts +3 -3
- package/dist/typescript/src/lib/Components/Banner/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/usePillLayout.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Trend/Trend.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/Components/Banner/Banner.tsx +8 -11
- package/src/lib/Components/Banner/types.ts +3 -3
- package/src/lib/Components/MediaButton/MediaButton.test.tsx +41 -1
- package/src/lib/Components/MediaButton/MediaButton.tsx +17 -21
- package/src/lib/Components/SegmentedControl/SegmentedControl.test.tsx +152 -60
- package/src/lib/Components/SegmentedControl/usePillLayout.ts +21 -12
- package/src/lib/Components/Trend/Trend.tsx +24 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Children","isValidElement","useCallback","useEffect","useMemo","useRef","useAnimatedStyle","useSharedValue","withTiming","useTimingConfig","useSegmentedControlSelectedIndex","selectedValue","children","toArray","findIndex","child","props","value","_worklet_6098626077169_init_data","code","location","sourceMap","usePillLayout","selectedIndex","tabLayout","pillTranslateX","pillWidth","pillHeight","hasLayoutRef","buttonLayoutsRef","Map","timingConfig","duration","easing","onLayout","e","width","height","nativeEvent","layout","count","slotWidth","current","registerButtonLayout","set","
|
|
1
|
+
{"version":3,"names":["React","Children","isValidElement","useCallback","useEffect","useMemo","useRef","useState","useAnimatedStyle","useSharedValue","withTiming","useTimingConfig","useSegmentedControlSelectedIndex","selectedValue","children","toArray","findIndex","child","props","value","_worklet_6098626077169_init_data","code","location","sourceMap","usePillLayout","selectedIndex","tabLayout","pillTranslateX","pillWidth","pillHeight","hasLayoutRef","animatePillRef","buttonLayoutsRef","Map","layoutReady","setLayoutReady","timingConfig","duration","easing","onLayout","e","width","height","nativeEvent","layout","count","slotWidth","current","registerButtonLayout","set","skipAnimation","config","get","x","animatedPillStyle","usePillLayoutTs1Factory","_e","global","Error","usePillLayoutTs1","transform","translateX","__closure","__workletHash","__pluginVersion","__initData","__stackDetails"],"sourceRoot":"../../../../../src","sources":["lib/Components/SegmentedControl/usePillLayout.ts"],"mappings":";;AACA,OAAOA,KAAK,IACVC,QAAQ,EACRC,cAAc,EACdC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAChC,SAASC,eAAe,QAAQ,qCAAkC;AAGlE,OAAO,SAASC,gCAAgCA,CAC9CC,aAAqB,EACrBC,QAAmB,EACX;EACR,OAAOT,OAAO,CACZ,MACEJ,QAAQ,CAACc,OAAO,CAACD,QAAQ,CAAC,CAACE,SAAS,CAAEC,KAAK,IAAK;IAC9C,IAAI,aAAAf,cAAc,CAACe,KAAK,CAAC,IAAIA,KAAK,CAAC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,KAAK,GAAG,CAAC,EAAE;QAC7CQ,cAAc,CAACR,KAAK,GAAGT,UAAU,CAC/Be,aAAa,GAAGG,SAAS,CAACT,KAAK,EAC/BgC,MACF,CAAC;MACH;IACF;EACF,CAAC,EAAE,CACD1B,aAAa,EACbZ,aAAa,EACba,SAAS,EACTE,SAAS,EACTD,cAAc,EACdS,YAAY,EACZF,WAAW,CACZ,CAAC;EAEF,MAAMoB,iBAAiB,GAAG9C,gBAAgB,CACxC,SAAA+C,wBAAA;IAAAnC,gCAAA;IAC4BO,cAAc;IACjCC,SAAS;IACRC;EAAU;IAAA,MAAA2B,EAAA,QAAAC,MAAA,CAAAC,KAAA;IAAA,MAAAC,gBAAA,GAHpBA,CAAA,MAAO;MACLC,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAElC,cAAc,CAACR;MAAM,CAAC,CAAC;MACjDsB,KAAK,EAAEb,SAAS,CAACT,KAAK;MACtBuB,MAAM,EAAEb,UAAU,CAACV;IACrB,CAAC,CAAC;IAAAwC,gBAAA,CAAAG,SAAA;MAH0BnC,cAAc;MACjCC,SAAS;MACRC;IAAU;IAAA8B,gBAAA,CAAAI,aAAA;IAAAJ,gBAAA,CAAAK,eAAA;IAAAL,gBAAA,CAAAM,UAAA,GAAA7C,gCAAA;IAAAuC,gBAAA,CAAAO,cAAA,GAAAV,EAAA;IAAA,OAAAG,gBAAA;EAAA,CAHpB;IAAAvC,gCAAA;IAC4BO,cAAc;IACjCC,SAAS;IACRC;EAAU,IAEpB,CAACF,cAAc,EAAEC,SAAS,EAAEC,UAAU,CACxC,CAAC;EAED,OAAO;IAAEU,QAAQ;IAAEe,iBAAiB;IAAEN;EAAqB,CAAC;AAC9D","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
|
4
4
|
import { StyleSheet } from 'react-native';
|
|
5
5
|
import { useCommonTranslation } from "../../../i18n/index.js";
|
|
6
6
|
import { useStyleSheet } from "../../../styles/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { TriangleDown, TriangleUp } from "../../Symbols/index.js";
|
|
8
8
|
import { Box, Text } from "../Utility/index.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
function getVariant(value) {
|
|
@@ -13,6 +13,20 @@ function getVariant(value) {
|
|
|
13
13
|
}
|
|
14
14
|
return value > 0 ? 'positive' : 'negative';
|
|
15
15
|
}
|
|
16
|
+
const iconMap = {
|
|
17
|
+
positive: TriangleUp,
|
|
18
|
+
negative: TriangleDown,
|
|
19
|
+
neutral: null
|
|
20
|
+
};
|
|
21
|
+
const iconSizeMap = {
|
|
22
|
+
md: 16,
|
|
23
|
+
sm: 12
|
|
24
|
+
};
|
|
25
|
+
const iconColorMap = {
|
|
26
|
+
positive: 'success',
|
|
27
|
+
negative: 'error',
|
|
28
|
+
neutral: 'muted'
|
|
29
|
+
};
|
|
16
30
|
export function Trend({
|
|
17
31
|
value,
|
|
18
32
|
size = 'md',
|
|
@@ -36,20 +50,9 @@ export function Trend({
|
|
|
36
50
|
variant,
|
|
37
51
|
disabled
|
|
38
52
|
});
|
|
39
|
-
const Icon =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
neutral: Minus
|
|
43
|
-
}[variant];
|
|
44
|
-
const iconSize = {
|
|
45
|
-
md: 16,
|
|
46
|
-
sm: 12
|
|
47
|
-
}[size];
|
|
48
|
-
const iconColor = {
|
|
49
|
-
positive: 'success',
|
|
50
|
-
negative: 'error',
|
|
51
|
-
neutral: 'muted'
|
|
52
|
-
}[variant];
|
|
53
|
+
const Icon = iconMap[variant];
|
|
54
|
+
const iconSize = iconSizeMap[size];
|
|
55
|
+
const iconColor = iconColorMap[variant];
|
|
53
56
|
const absoluteFormattedValue = `${Math.abs(value).toFixed(2)}%`;
|
|
54
57
|
const formattedValue = value < 0 ? `-${absoluteFormattedValue}` : absoluteFormattedValue;
|
|
55
58
|
return /*#__PURE__*/_jsxs(Box, {
|
|
@@ -63,7 +66,7 @@ export function Trend({
|
|
|
63
66
|
lx: lx,
|
|
64
67
|
style: [styles.container, style],
|
|
65
68
|
...props,
|
|
66
|
-
children: [/*#__PURE__*/_jsx(Icon, {
|
|
69
|
+
children: [Icon && /*#__PURE__*/_jsx(Icon, {
|
|
67
70
|
size: iconSize,
|
|
68
71
|
color: disabled ? 'disabled' : iconColor
|
|
69
72
|
}), /*#__PURE__*/_jsx(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDisabledContext","StyleSheet","useCommonTranslation","useStyleSheet","
|
|
1
|
+
{"version":3,"names":["useDisabledContext","StyleSheet","useCommonTranslation","useStyleSheet","TriangleDown","TriangleUp","Box","Text","jsx","_jsx","jsxs","_jsxs","getVariant","value","iconMap","positive","negative","neutral","iconSizeMap","md","sm","iconColorMap","Trend","size","lx","disabled","disabledProp","style","props","variant","consumerName","mergeWith","t","styles","useStyles","Icon","iconSize","iconColor","absoluteFormattedValue","Math","abs","toFixed","formattedValue","accessible","accessibilityLabel","accessibilityState","container","children","color","text","colors","success","error","muted","sizeMap","typographies","body3","body2","flexDirection","alignItems","gap","spacings","s2","flatten"],"sourceRoot":"../../../../../src","sources":["lib/Components/Trend/Trend.tsx"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,oBAAoB,QAAQ,wBAAe;AAEpD,SAASC,aAAa,QAAQ,0BAAiB;AAC/C,SAASC,YAAY,EAAEC,UAAU,QAAQ,wBAAe;AAExD,SAASC,GAAG,EAAEC,IAAI,QAAQ,qBAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKvC,SAASC,UAAUA,CAACC,KAAa,EAAgB;EAC/C,IAAIA,KAAK,KAAK,CAAC,EAAE;IACf,OAAO,SAAS;EAClB;EACA,OAAOA,KAAK,GAAG,CAAC,GAAG,UAAU,GAAG,UAAU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AO,CAAC,CACvB;MACE,GAAGT,OAAO;MACVN;IACF,CAAC,EACDvB,QAAQ,IAAI;MAAEuB,KAAK,EAAEhB,CAAC,CAACkB,MAAM,CAACD,IAAI,CAACxB;IAAS,CAAC,CAC9C;EACH,CAAC;AACH,CAAC,EACD,CAACF,IAAI,EAAEM,OAAO,EAAEJ,QAAQ,CAC1B,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Banner/Banner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Banner/Banner.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoF3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,MAAM,GAAI,uHAYpB,WAAW,4CAyDb,CAAC"}
|
|
@@ -8,7 +8,7 @@ export type BannerProps = {
|
|
|
8
8
|
/**
|
|
9
9
|
* The main title of the banner.
|
|
10
10
|
*/
|
|
11
|
-
title?:
|
|
11
|
+
title?: ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* Optional descriptive text.
|
|
14
14
|
*/
|
|
@@ -16,11 +16,11 @@ export type BannerProps = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Optional primary action.
|
|
18
18
|
*/
|
|
19
|
-
primaryAction?:
|
|
19
|
+
primaryAction?: ReactNode;
|
|
20
20
|
/**
|
|
21
21
|
* Optional secondary action.
|
|
22
22
|
*/
|
|
23
|
-
secondaryAction?:
|
|
23
|
+
secondaryAction?: ReactNode;
|
|
24
24
|
/**
|
|
25
25
|
* Optional close action.
|
|
26
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Banner/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtD;;OAEG;IACH,KAAK,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Banner/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaButton.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaButton/MediaButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MediaButton.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaButton/MediaButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA2HhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,GAAI,6HAYzB,gBAAgB,4CA8BlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePillLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/SegmentedControl/usePillLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"usePillLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/SegmentedControl/usePillLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,SAAS,GAClB,MAAM,CAWR;AAED,KAAK,mBAAmB,GAAG;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,KAAK,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,aAAa,EACb,aAAa,EACb,QAAQ,EACR,SAAS,GACV,EAAE,mBAAmB;kBAcC,iBAAiB,KAAG,IAAI;;;;;;;;kCAiBnC,MAAM,UAAU,YAAY,KAAG,IAAI;EA0D9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trend.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Trend/Trend.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Trend.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Trend/Trend.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA4B1C,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAW,EACX,EAAO,EACP,QAAQ,EAAE,YAAoB,EAC9B,KAAK,EACL,GAAG,KAAK,EACT,EAAE,UAAU,2CAoCZ"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import type { IconProps } from '../Icon';
|
|
14
14
|
import { IconButton } from '../IconButton';
|
|
15
15
|
import { Box } from '../Utility';
|
|
16
|
-
import { Wrap } from '../Wrap';
|
|
17
16
|
import type { BannerProps } from './types';
|
|
18
17
|
|
|
19
18
|
type Appearance = NonNullable<BannerProps['appearance']>;
|
|
@@ -82,6 +81,7 @@ const useStyles = ({ appearance }: { appearance: Appearance }) => {
|
|
|
82
81
|
]),
|
|
83
82
|
actionsWrapper: {
|
|
84
83
|
flexDirection: 'row',
|
|
84
|
+
flexWrap: 'wrap',
|
|
85
85
|
gap: t.spacings.s4,
|
|
86
86
|
},
|
|
87
87
|
};
|
|
@@ -169,16 +169,13 @@ export const Banner = ({
|
|
|
169
169
|
)}
|
|
170
170
|
{description && (
|
|
171
171
|
<View>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
>
|
|
180
|
-
{description}
|
|
181
|
-
</Wrap>
|
|
172
|
+
{isTextChildren(description) ? (
|
|
173
|
+
<Text style={styles.description} numberOfLines={5}>
|
|
174
|
+
{description}
|
|
175
|
+
</Text>
|
|
176
|
+
) : (
|
|
177
|
+
description
|
|
178
|
+
)}
|
|
182
179
|
</View>
|
|
183
180
|
)}
|
|
184
181
|
</View>
|
|
@@ -9,7 +9,7 @@ export type BannerProps = {
|
|
|
9
9
|
/**
|
|
10
10
|
* The main title of the banner.
|
|
11
11
|
*/
|
|
12
|
-
title?:
|
|
12
|
+
title?: ReactNode;
|
|
13
13
|
/**
|
|
14
14
|
* Optional descriptive text.
|
|
15
15
|
*/
|
|
@@ -17,11 +17,11 @@ export type BannerProps = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Optional primary action.
|
|
19
19
|
*/
|
|
20
|
-
primaryAction?:
|
|
20
|
+
primaryAction?: ReactNode;
|
|
21
21
|
/**
|
|
22
22
|
* Optional secondary action.
|
|
23
23
|
*/
|
|
24
|
-
secondaryAction?:
|
|
24
|
+
secondaryAction?: ReactNode;
|
|
25
25
|
/**
|
|
26
26
|
* Optional close action.
|
|
27
27
|
*/
|
|
@@ -29,11 +29,21 @@ describe('MediaButton', () => {
|
|
|
29
29
|
expect(trigger.props.accessibilityRole).toBe('button');
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
it('should
|
|
32
|
+
it('should render a chevron icon by default', () => {
|
|
33
33
|
renderWithProvider(<MediaButton testID='trigger'>Label</MediaButton>);
|
|
34
34
|
expect(screen.getByTestId('button-trigger-chevron')).toBeTruthy();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
it('should not render a chevron icon when hideChevron is true', () => {
|
|
38
|
+
renderWithProvider(
|
|
39
|
+
<MediaButton testID='trigger' hideChevron>
|
|
40
|
+
Label
|
|
41
|
+
</MediaButton>,
|
|
42
|
+
);
|
|
43
|
+
expect(screen.queryByTestId('button-trigger-chevron')).toBeNull();
|
|
44
|
+
expect(screen.getByText('Label')).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
|
|
37
47
|
it.each(['gray', 'transparent', 'no-background'] as const)(
|
|
38
48
|
'should render without errors for appearance "%s"',
|
|
39
49
|
(appearance) => {
|
|
@@ -57,6 +67,36 @@ describe('MediaButton', () => {
|
|
|
57
67
|
expect(screen.getByTestId('trigger')).toBeTruthy();
|
|
58
68
|
},
|
|
59
69
|
);
|
|
70
|
+
|
|
71
|
+
const sizeShapeMatrix: ['sm' | 'md', 'flat' | 'rounded' | 'none'][] = [
|
|
72
|
+
['sm', 'flat'],
|
|
73
|
+
['sm', 'rounded'],
|
|
74
|
+
['sm', 'none'],
|
|
75
|
+
['md', 'flat'],
|
|
76
|
+
['md', 'rounded'],
|
|
77
|
+
['md', 'none'],
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
it.each(sizeShapeMatrix)(
|
|
81
|
+
'should render with hideChevron for size "%s" and shape "%s"',
|
|
82
|
+
(size, shape) => {
|
|
83
|
+
const leadingContent =
|
|
84
|
+
shape === 'none' ? undefined : <View testID='leading' />;
|
|
85
|
+
renderWithProvider(
|
|
86
|
+
<MediaButton
|
|
87
|
+
testID='trigger'
|
|
88
|
+
size={size}
|
|
89
|
+
leadingContent={leadingContent}
|
|
90
|
+
leadingContentShape={shape === 'none' ? undefined : shape}
|
|
91
|
+
hideChevron
|
|
92
|
+
>
|
|
93
|
+
Label
|
|
94
|
+
</MediaButton>,
|
|
95
|
+
);
|
|
96
|
+
expect(screen.getByTestId('trigger')).toBeTruthy();
|
|
97
|
+
expect(screen.queryByTestId('button-trigger-chevron')).toBeNull();
|
|
98
|
+
},
|
|
99
|
+
);
|
|
60
100
|
});
|
|
61
101
|
|
|
62
102
|
describe('Icons', () => {
|
|
@@ -15,12 +15,14 @@ const useStyles = ({
|
|
|
15
15
|
disabled,
|
|
16
16
|
pressed,
|
|
17
17
|
leadingContentShape,
|
|
18
|
+
hideChevron,
|
|
18
19
|
}: {
|
|
19
20
|
appearance: Appearance;
|
|
20
21
|
size: Size;
|
|
21
22
|
disabled: boolean;
|
|
22
23
|
pressed: boolean;
|
|
23
24
|
leadingContentShape: LeadingContentShape;
|
|
25
|
+
hideChevron: boolean;
|
|
24
26
|
}) => {
|
|
25
27
|
return useStyleSheet(
|
|
26
28
|
(t) => {
|
|
@@ -39,8 +41,7 @@ const useStyles = ({
|
|
|
39
41
|
const textColor = disabled ? t.colors.text.disabled : t.colors.text.base;
|
|
40
42
|
|
|
41
43
|
type PaddingStyle = {
|
|
42
|
-
|
|
43
|
-
paddingBottom: number;
|
|
44
|
+
paddingVertical: number;
|
|
44
45
|
paddingLeft: number;
|
|
45
46
|
paddingRight: number;
|
|
46
47
|
};
|
|
@@ -51,42 +52,36 @@ const useStyles = ({
|
|
|
51
52
|
> = {
|
|
52
53
|
md: {
|
|
53
54
|
flat: {
|
|
54
|
-
|
|
55
|
-
paddingBottom: t.spacings.s12,
|
|
55
|
+
paddingVertical: t.spacings.s12,
|
|
56
56
|
paddingLeft: t.spacings.s16,
|
|
57
|
-
paddingRight: t.spacings.s16,
|
|
57
|
+
paddingRight: hideChevron ? t.spacings.s16 : t.spacings.s12,
|
|
58
58
|
},
|
|
59
59
|
rounded: {
|
|
60
|
-
|
|
61
|
-
paddingBottom: t.spacings.s8,
|
|
60
|
+
paddingVertical: t.spacings.s8,
|
|
62
61
|
paddingLeft: t.spacings.s8,
|
|
63
|
-
paddingRight: t.spacings.s16,
|
|
62
|
+
paddingRight: hideChevron ? t.spacings.s16 : t.spacings.s12,
|
|
64
63
|
},
|
|
65
64
|
none: {
|
|
66
|
-
|
|
67
|
-
paddingBottom: t.spacings.s14,
|
|
65
|
+
paddingVertical: t.spacings.s14,
|
|
68
66
|
paddingLeft: t.spacings.s16,
|
|
69
|
-
paddingRight: t.spacings.s16,
|
|
67
|
+
paddingRight: hideChevron ? t.spacings.s16 : t.spacings.s12,
|
|
70
68
|
},
|
|
71
69
|
},
|
|
72
70
|
sm: {
|
|
73
71
|
flat: {
|
|
74
|
-
|
|
75
|
-
paddingBottom: t.spacings.s10,
|
|
72
|
+
paddingVertical: t.spacings.s10,
|
|
76
73
|
paddingLeft: t.spacings.s12,
|
|
77
|
-
paddingRight: t.spacings.s12,
|
|
74
|
+
paddingRight: hideChevron ? t.spacings.s12 : t.spacings.s8,
|
|
78
75
|
},
|
|
79
76
|
rounded: {
|
|
80
|
-
|
|
81
|
-
paddingBottom: t.spacings.s8,
|
|
77
|
+
paddingVertical: t.spacings.s8,
|
|
82
78
|
paddingLeft: t.spacings.s8,
|
|
83
|
-
paddingRight: t.spacings.s10,
|
|
79
|
+
paddingRight: hideChevron ? t.spacings.s10 : t.spacings.s8,
|
|
84
80
|
},
|
|
85
81
|
none: {
|
|
86
|
-
|
|
87
|
-
paddingBottom: t.spacings.s10,
|
|
82
|
+
paddingVertical: t.spacings.s10,
|
|
88
83
|
paddingLeft: t.spacings.s12,
|
|
89
|
-
paddingRight: t.spacings.s12,
|
|
84
|
+
paddingRight: hideChevron ? t.spacings.s12 : t.spacings.s8,
|
|
90
85
|
},
|
|
91
86
|
},
|
|
92
87
|
};
|
|
@@ -127,7 +122,7 @@ const useStyles = ({
|
|
|
127
122
|
},
|
|
128
123
|
};
|
|
129
124
|
},
|
|
130
|
-
[appearance, size, disabled, pressed, leadingContentShape],
|
|
125
|
+
[appearance, size, disabled, pressed, leadingContentShape, hideChevron],
|
|
131
126
|
);
|
|
132
127
|
};
|
|
133
128
|
|
|
@@ -221,6 +216,7 @@ const MediaButtonContent = ({
|
|
|
221
216
|
disabled,
|
|
222
217
|
pressed,
|
|
223
218
|
leadingContentShape,
|
|
219
|
+
hideChevron,
|
|
224
220
|
});
|
|
225
221
|
|
|
226
222
|
return (
|
|
@@ -12,72 +12,164 @@ const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
describe('SegmentedControl', () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
15
|
+
describe('Rendering', () => {
|
|
16
|
+
it('renders segments with labels', () => {
|
|
17
|
+
const { getByText } = render(
|
|
18
|
+
<TestWrapper>
|
|
19
|
+
<SegmentedControl
|
|
20
|
+
selectedValue='send'
|
|
21
|
+
onSelectedChange={() => {
|
|
22
|
+
/* empty */
|
|
23
|
+
}}
|
|
24
|
+
accessibilityLabel='Transaction type'
|
|
25
|
+
>
|
|
26
|
+
<SegmentedControlButton value='send'>Send</SegmentedControlButton>
|
|
27
|
+
<SegmentedControlButton value='receive'>
|
|
28
|
+
Receive
|
|
29
|
+
</SegmentedControlButton>
|
|
30
|
+
</SegmentedControl>
|
|
31
|
+
</TestWrapper>,
|
|
32
|
+
);
|
|
33
|
+
expect(getByText('Send')).toBeTruthy();
|
|
34
|
+
expect(getByText('Receive')).toBeTruthy();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('renders trailingContent inside segment buttons', () => {
|
|
38
|
+
const { getByLabelText } = render(
|
|
39
|
+
<TestWrapper>
|
|
40
|
+
<SegmentedControl
|
|
41
|
+
selectedValue='tokens'
|
|
42
|
+
onSelectedChange={() => {
|
|
43
|
+
/* empty */
|
|
44
|
+
}}
|
|
45
|
+
accessibilityLabel='Asset section'
|
|
46
|
+
>
|
|
47
|
+
<SegmentedControlButton
|
|
48
|
+
value='tokens'
|
|
49
|
+
trailingContent={
|
|
50
|
+
<DotCount value={3} accessibilityLabel='3 tokens' />
|
|
51
|
+
}
|
|
52
|
+
>
|
|
53
|
+
Tokens
|
|
54
|
+
</SegmentedControlButton>
|
|
55
|
+
<SegmentedControlButton value='nfts'>NFTs</SegmentedControlButton>
|
|
56
|
+
</SegmentedControl>
|
|
57
|
+
</TestWrapper>,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect(getByLabelText('3 tokens')).toBeTruthy();
|
|
61
|
+
});
|
|
34
62
|
});
|
|
35
63
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
describe('States', () => {
|
|
65
|
+
it('marks the selected segment with accessibilityState', () => {
|
|
66
|
+
const { getByTestId } = render(
|
|
67
|
+
<TestWrapper>
|
|
68
|
+
<SegmentedControl
|
|
69
|
+
selectedValue='receive'
|
|
70
|
+
onSelectedChange={() => {}}
|
|
71
|
+
accessibilityLabel='Transaction type'
|
|
72
|
+
>
|
|
73
|
+
<SegmentedControlButton value='send' testID='seg-send'>
|
|
74
|
+
Send
|
|
75
|
+
</SegmentedControlButton>
|
|
76
|
+
<SegmentedControlButton value='receive' testID='seg-receive'>
|
|
77
|
+
Receive
|
|
78
|
+
</SegmentedControlButton>
|
|
79
|
+
</SegmentedControl>
|
|
80
|
+
</TestWrapper>,
|
|
81
|
+
);
|
|
52
82
|
|
|
53
|
-
|
|
83
|
+
expect(getByTestId('seg-send').props.accessibilityState).toMatchObject({
|
|
84
|
+
selected: false,
|
|
85
|
+
});
|
|
86
|
+
expect(getByTestId('seg-receive').props.accessibilityState).toMatchObject(
|
|
87
|
+
{ selected: true },
|
|
88
|
+
);
|
|
89
|
+
});
|
|
54
90
|
|
|
55
|
-
|
|
56
|
-
|
|
91
|
+
it('marks a pre-selected non-first segment as selected on initial render (fixed layout)', () => {
|
|
92
|
+
const { getByTestId } = render(
|
|
93
|
+
<TestWrapper>
|
|
94
|
+
<SegmentedControl
|
|
95
|
+
selectedValue='blame'
|
|
96
|
+
onSelectedChange={() => {}}
|
|
97
|
+
tabLayout='fixed'
|
|
98
|
+
accessibilityLabel='File view'
|
|
99
|
+
>
|
|
100
|
+
<SegmentedControlButton value='preview' testID='seg-preview'>
|
|
101
|
+
Preview
|
|
102
|
+
</SegmentedControlButton>
|
|
103
|
+
<SegmentedControlButton value='raw' testID='seg-raw'>
|
|
104
|
+
Raw
|
|
105
|
+
</SegmentedControlButton>
|
|
106
|
+
<SegmentedControlButton value='blame' testID='seg-blame'>
|
|
107
|
+
Blame
|
|
108
|
+
</SegmentedControlButton>
|
|
109
|
+
</SegmentedControl>
|
|
110
|
+
</TestWrapper>,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
expect(getByTestId('seg-preview').props.accessibilityState).toMatchObject(
|
|
114
|
+
{ selected: false },
|
|
115
|
+
);
|
|
116
|
+
expect(getByTestId('seg-blame').props.accessibilityState).toMatchObject({
|
|
117
|
+
selected: true,
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('marks a pre-selected non-first segment as selected on initial render (fit layout)', () => {
|
|
122
|
+
const { getByTestId } = render(
|
|
123
|
+
<TestWrapper>
|
|
124
|
+
<SegmentedControl
|
|
125
|
+
selectedValue='blame'
|
|
126
|
+
onSelectedChange={() => {}}
|
|
127
|
+
tabLayout='fit'
|
|
128
|
+
accessibilityLabel='File view'
|
|
129
|
+
>
|
|
130
|
+
<SegmentedControlButton value='preview' testID='seg-preview'>
|
|
131
|
+
Preview
|
|
132
|
+
</SegmentedControlButton>
|
|
133
|
+
<SegmentedControlButton value='raw' testID='seg-raw'>
|
|
134
|
+
Raw
|
|
135
|
+
</SegmentedControlButton>
|
|
136
|
+
<SegmentedControlButton value='blame' testID='seg-blame'>
|
|
137
|
+
Blame
|
|
138
|
+
</SegmentedControlButton>
|
|
139
|
+
</SegmentedControl>
|
|
140
|
+
</TestWrapper>,
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
expect(getByTestId('seg-preview').props.accessibilityState).toMatchObject(
|
|
144
|
+
{ selected: false },
|
|
145
|
+
);
|
|
146
|
+
expect(getByTestId('seg-blame').props.accessibilityState).toMatchObject({
|
|
147
|
+
selected: true,
|
|
148
|
+
});
|
|
149
|
+
});
|
|
57
150
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
>
|
|
68
|
-
<SegmentedControlButton
|
|
69
|
-
value='tokens'
|
|
70
|
-
trailingContent={
|
|
71
|
-
<DotCount value={3} accessibilityLabel='3 tokens' />
|
|
72
|
-
}
|
|
151
|
+
it('can change selection away from a pre-selected non-first segment (fit layout)', () => {
|
|
152
|
+
const onSelectedChange = jest.fn();
|
|
153
|
+
const { getByText } = render(
|
|
154
|
+
<TestWrapper>
|
|
155
|
+
<SegmentedControl
|
|
156
|
+
selectedValue='blame'
|
|
157
|
+
onSelectedChange={onSelectedChange}
|
|
158
|
+
tabLayout='fit'
|
|
159
|
+
accessibilityLabel='File view'
|
|
73
160
|
>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
161
|
+
<SegmentedControlButton value='preview'>
|
|
162
|
+
Preview
|
|
163
|
+
</SegmentedControlButton>
|
|
164
|
+
<SegmentedControlButton value='raw'>Raw</SegmentedControlButton>
|
|
165
|
+
<SegmentedControlButton value='blame'>Blame</SegmentedControlButton>
|
|
166
|
+
</SegmentedControl>
|
|
167
|
+
</TestWrapper>,
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
fireEvent.press(getByText('Preview'));
|
|
80
171
|
|
|
81
|
-
|
|
172
|
+
expect(onSelectedChange).toHaveBeenCalledWith('preview');
|
|
173
|
+
});
|
|
82
174
|
});
|
|
83
175
|
});
|