@coinbase/cds-mobile 8.33.0 → 8.34.0
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 +12 -0
- package/dts/buttons/DefaultSlideButtonBackground.d.ts +1 -1
- package/dts/buttons/DefaultSlideButtonBackground.d.ts.map +1 -1
- package/dts/buttons/DefaultSlideButtonHandle.d.ts +11 -6
- package/dts/buttons/DefaultSlideButtonHandle.d.ts.map +1 -1
- package/dts/buttons/SlideButton.d.ts +16 -2
- package/dts/buttons/SlideButton.d.ts.map +1 -1
- package/dts/media/RemoteImageGroup.d.ts.map +1 -1
- package/esm/alpha/select-chip/__stories__/AlphaSelectChip.stories.js +55 -43
- package/esm/buttons/DefaultSlideButtonBackground.js +5 -3
- package/esm/buttons/DefaultSlideButtonHandle.js +17 -7
- package/esm/buttons/SlideButton.js +6 -3
- package/esm/buttons/__figma__/SlideButton.figma.js +2 -1
- package/esm/buttons/__stories__/SlideButton.stories.js +17 -0
- package/esm/media/RemoteImageGroup.js +3 -3
- package/esm/media/__stories__/RemoteImageGroup.stories.js +0 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 8.34.0 (12/19/2025 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Feat: support compact SlideButtons. [[#264](https://github.com/coinbase/cds/pull/264)]
|
|
16
|
+
|
|
17
|
+
## 8.33.1 (12/19/2025 PST)
|
|
18
|
+
|
|
19
|
+
#### 🐞 Fixes
|
|
20
|
+
|
|
21
|
+
- Fix RemoteImageGroup zIndex and trailing space issue. [[#170](https://github.com/coinbase/cds/pull/170)]
|
|
22
|
+
|
|
11
23
|
## 8.33.0 (12/18/2025 PST)
|
|
12
24
|
|
|
13
25
|
#### 🚀 Updates
|
|
@@ -12,7 +12,7 @@ export declare const DefaultSlideButtonBackground: React.MemoExoticComponent<
|
|
|
12
12
|
React.ForwardRefExoticComponent<
|
|
13
13
|
Pick<
|
|
14
14
|
import('./SlideButton').SlideButtonBaseProps,
|
|
15
|
-
'borderRadius' | 'disabled' | 'checked' | 'variant' | 'uncheckedLabel'
|
|
15
|
+
'borderRadius' | 'disabled' | 'checked' | 'variant' | 'compact' | 'uncheckedLabel'
|
|
16
16
|
> & {
|
|
17
17
|
progress: import('@react-spring/core').SpringValue<number>;
|
|
18
18
|
style?: import('react-native').StyleProp<import('react-native').ViewStyle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSlideButtonBackground.d.ts","sourceRoot":"","sources":["../../src/buttons/DefaultSlideButtonBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAC;AAQhD,eAAO,MAAM,MAAM;;;;;;;CAOjB,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;+
|
|
1
|
+
{"version":3,"file":"DefaultSlideButtonBackground.d.ts","sourceRoot":"","sources":["../../src/buttons/DefaultSlideButtonBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAC;AAQhD,eAAO,MAAM,MAAM;;;;;;;CAOjB,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;+BA2CxC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SlideButtonBaseProps } from './SlideButton';
|
|
4
4
|
export declare const animationConfig: {
|
|
5
5
|
readonly tension: 300;
|
|
6
6
|
readonly clamp: true;
|
|
7
7
|
};
|
|
8
|
-
export type SlideButtonHandleCheckedProps = Pick<
|
|
8
|
+
export type SlideButtonHandleCheckedProps = Pick<SlideButtonBaseProps, 'variant' | 'compact'> & {
|
|
9
9
|
label?: React.ReactNode;
|
|
10
10
|
end?: React.ReactNode;
|
|
11
11
|
disabled?: boolean;
|
|
@@ -13,7 +13,7 @@ export type SlideButtonHandleCheckedProps = Pick<ButtonProps, 'variant'> & {
|
|
|
13
13
|
export type SlideButtonHandleCheckedComponent = (
|
|
14
14
|
props: SlideButtonHandleCheckedProps,
|
|
15
15
|
) => React.ReactElement | null;
|
|
16
|
-
export type SlideButtonHandleUncheckedProps = Pick<
|
|
16
|
+
export type SlideButtonHandleUncheckedProps = Pick<SlideButtonBaseProps, 'variant' | 'compact'> & {
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
start?: React.ReactNode;
|
|
19
19
|
};
|
|
@@ -38,10 +38,14 @@ export declare const styles: {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
export declare const SlideButtonHandleChecked: React.MemoExoticComponent<
|
|
41
|
-
({
|
|
41
|
+
({
|
|
42
|
+
label,
|
|
43
|
+
end,
|
|
44
|
+
compact,
|
|
45
|
+
}: SlideButtonHandleCheckedProps) => import('react/jsx-runtime').JSX.Element
|
|
42
46
|
>;
|
|
43
47
|
export declare const SlideButtonHandleUnchecked: React.MemoExoticComponent<
|
|
44
|
-
({ start }: SlideButtonHandleUncheckedProps) => import('react/jsx-runtime').JSX.Element
|
|
48
|
+
({ start, compact }: SlideButtonHandleUncheckedProps) => import('react/jsx-runtime').JSX.Element
|
|
45
49
|
>;
|
|
46
50
|
export declare const DefaultSlideButtonHandle: React.MemoExoticComponent<
|
|
47
51
|
React.ForwardRefExoticComponent<
|
|
@@ -58,10 +62,11 @@ export declare const DefaultSlideButtonHandle: React.MemoExoticComponent<
|
|
|
58
62
|
disableDebounce?: boolean;
|
|
59
63
|
} & import('react-native').PressableProps &
|
|
60
64
|
Pick<
|
|
61
|
-
|
|
65
|
+
SlideButtonBaseProps,
|
|
62
66
|
| 'disabled'
|
|
63
67
|
| 'checked'
|
|
64
68
|
| 'variant'
|
|
69
|
+
| 'compact'
|
|
65
70
|
| 'checkedLabel'
|
|
66
71
|
| 'startUncheckedNode'
|
|
67
72
|
| 'endCheckedNode'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSlideButtonHandle.d.ts","sourceRoot":"","sources":["../../src/buttons/DefaultSlideButtonHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAiBzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultSlideButtonHandle.d.ts","sourceRoot":"","sources":["../../src/buttons/DefaultSlideButtonHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAiBzC,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,eAAe,CAAC;AAElF,eAAO,MAAM,eAAe;;;CAAgE,CAAC;AAE7F,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,SAAS,CAAC,GAAG;IAC9F,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,CAC9C,KAAK,EAAE,6BAA6B,KACjC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAE/B,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,SAAS,CAAC,GAAG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,CAChD,KAAK,EAAE,+BAA+B,KACnC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAE/B,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAgBjB,CAAC;AAEH,eAAO,MAAM,wBAAwB,sDACT,6BAA6B,6CAmBxD,CAAC;AAEF,eAAO,MAAM,0BAA0B,iDAChB,+BAA+B,6CAgBrD,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;+BA+EpC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import type { PressableProps } from '../system/Pressable';
|
|
|
6
6
|
export declare const slideButtonTestID = 'slide-button';
|
|
7
7
|
export type SlideButtonBackgroundProps = Pick<
|
|
8
8
|
SlideButtonBaseProps,
|
|
9
|
-
'borderRadius' | 'checked' | 'disabled' | 'uncheckedLabel' | 'variant'
|
|
9
|
+
'borderRadius' | 'checked' | 'compact' | 'disabled' | 'uncheckedLabel' | 'variant'
|
|
10
10
|
> & {
|
|
11
11
|
progress: SpringValue<number>;
|
|
12
12
|
style?: StyleProp<ViewStyle>;
|
|
@@ -14,7 +14,13 @@ export type SlideButtonBackgroundProps = Pick<
|
|
|
14
14
|
export type SlideButtonHandleProps = PressableProps &
|
|
15
15
|
Pick<
|
|
16
16
|
SlideButtonBaseProps,
|
|
17
|
-
|
|
17
|
+
| 'checked'
|
|
18
|
+
| 'checkedLabel'
|
|
19
|
+
| 'compact'
|
|
20
|
+
| 'disabled'
|
|
21
|
+
| 'startUncheckedNode'
|
|
22
|
+
| 'endCheckedNode'
|
|
23
|
+
| 'variant'
|
|
18
24
|
> & {
|
|
19
25
|
progress: SpringValue<number>;
|
|
20
26
|
style?: StyleProp<ViewStyle>;
|
|
@@ -65,6 +71,10 @@ export type SlideButtonBaseProps = Omit<PressableProps, 'loading'> & {
|
|
|
65
71
|
* When true, prevents gesture events from firing.
|
|
66
72
|
*/
|
|
67
73
|
disabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Reduces the height, borderRadius and inner padding within the button.
|
|
76
|
+
*/
|
|
77
|
+
compact?: boolean;
|
|
68
78
|
/**
|
|
69
79
|
* Height of the entire button component (background and handle).
|
|
70
80
|
* If you pass a custom SlideButtonBackgroundComponent or SlideButtonHandleComponent,
|
|
@@ -172,6 +182,10 @@ export declare const SlideButton: React.MemoExoticComponent<
|
|
|
172
182
|
* When true, prevents gesture events from firing.
|
|
173
183
|
*/
|
|
174
184
|
disabled?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Reduces the height, borderRadius and inner padding within the button.
|
|
187
|
+
*/
|
|
188
|
+
compact?: boolean;
|
|
175
189
|
/**
|
|
176
190
|
* Height of the entire button component (background and handle).
|
|
177
191
|
* If you pass a custom SlideButtonBackgroundComponent or SlideButtonHandleComponent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlideButton.d.ts","sourceRoot":"","sources":["../../src/buttons/SlideButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAiC,KAAK,SAAS,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAInG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,oBAAoB,EACpB,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"SlideButton.d.ts","sourceRoot":"","sources":["../../src/buttons/SlideButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAiC,KAAK,SAAS,EAAE,IAAI,EAAE,KAA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E,OAAO,KAAK,IAAI;IACrC;;OAEG;qBACc,KAAK,CAAC,SAAS;IAChC;;OAEG;mBACY,KAAK,CAAC,SAAS;IAC9B;;OAEG;mBACY,MAAM,IAAI;IACzB;;;;OAIG;oBACa,MAAM,IAAI;IAC1B;;;OAGG;iBACU,MAAM,IAAI;IACvB;;;;OAIG;sBACe,MAAM,IAAI;IAC5B;;;OAGG;eACQ,OAAO;IAClB;;OAEG;cACO,OAAO;IACjB;;;;OAIG;aACM,MAAM;IACf;;;OAGG;cACO,OAAO,CAAC,aAAa,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IACrE;;;OAGG;iCAC0B,0BAA0B;IACvD;;;OAGG;qCAC8B,8BAA8B;IAC/D;;;;OAIG;qBACc,MAAM;IACvB;;;OAGG;sCAC+B,OAAO;IACzC;;OAEG;aACM;QACP;;WAEG;QACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC;;WAEG;QACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC;;WAEG;QACH,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAC/B;IACD;;;OAGG;yBACkB,KAAK,CAAC,SAAS;IACpC;;;OAGG;qBACc,KAAK,CAAC,SAAS;+BAsLjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteImageGroup.d.ts","sourceRoot":"","sources":["../../src/media/RemoteImageGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EACV,UAAU,
|
|
1
|
+
{"version":3,"file":"RemoteImageGroup.d.ts","sourceRoot":"","sources":["../../src/media/RemoteImageGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EACV,UAAU,EAEV,KAAK,EACL,wBAAwB,EACxB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAOpC,MAAM,MAAM,yBAAyB,GAAG,WAAW,GACjD,wBAAwB,GAAG;IACzB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,uBAAuB;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE9D,eAAO,MAAM,gBAAgB,GAAI,kDAO9B,qBAAqB,4CAqFvB,CAAC;AAQF,eAAO,MAAM,WAAW,0BAgBtB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
2
|
import { assets } from '@coinbase/cds-common/internal/data/assets';
|
|
3
3
|
import { useMultiSelect } from '@coinbase/cds-common/select/useMultiSelect';
|
|
4
4
|
import { Example, ExampleScreen } from '../../../examples/ExampleScreen';
|
|
5
5
|
import { HStack } from '../../../layout/HStack';
|
|
6
6
|
import { VStack } from '../../../layout/VStack';
|
|
7
|
-
import { RemoteImage } from '../../../media';
|
|
7
|
+
import { RemoteImage, RemoteImageGroup } from '../../../media';
|
|
8
8
|
import { Text } from '../../../typography/Text';
|
|
9
9
|
import { SelectChip } from '../SelectChip';
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -138,49 +138,58 @@ const assetImageMap = {
|
|
|
138
138
|
ltc: assets.ltc.imageUrl,
|
|
139
139
|
xrp: assets.xrp.imageUrl
|
|
140
140
|
};
|
|
141
|
+
export const MultiSelectWithAssets = () => {
|
|
142
|
+
const exampleOptions = [{
|
|
143
|
+
value: 'btc',
|
|
144
|
+
label: assets.btc.name
|
|
145
|
+
}, {
|
|
146
|
+
value: 'eth',
|
|
147
|
+
label: assets.eth.name
|
|
148
|
+
}, {
|
|
149
|
+
value: 'dai',
|
|
150
|
+
label: assets.dai.name
|
|
151
|
+
}, {
|
|
152
|
+
value: 'ltc',
|
|
153
|
+
label: assets.ltc.name
|
|
154
|
+
}, {
|
|
155
|
+
value: 'xrp',
|
|
156
|
+
label: assets.xrp.name
|
|
157
|
+
}];
|
|
158
|
+
const {
|
|
159
|
+
value,
|
|
160
|
+
onChange
|
|
161
|
+
} = useMultiSelect({
|
|
162
|
+
initialValue: ['eth', 'btc']
|
|
163
|
+
});
|
|
141
164
|
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// { value: 'btc', label: assets.btc.name },
|
|
146
|
-
// { value: 'eth', label: assets.eth.name },
|
|
147
|
-
// { value: 'dai', label: assets.dai.name },
|
|
148
|
-
// { value: 'ltc', label: assets.ltc.name },
|
|
149
|
-
// { value: 'xrp', label: assets.xrp.name },
|
|
150
|
-
// ];
|
|
151
|
-
// const { value, onChange } = useMultiSelect({
|
|
152
|
-
// initialValue: ['eth', 'btc'],
|
|
153
|
-
// });
|
|
154
|
-
|
|
155
|
-
// // Get startNode based on selected assets
|
|
156
|
-
// const startNode = useMemo(() => {
|
|
157
|
-
// if (value.length === 0) return null;
|
|
158
|
-
|
|
159
|
-
// // Multiple assets selected - use RemoteImageGroup
|
|
160
|
-
// return (
|
|
161
|
-
// <RemoteImageGroup shape="circle" size={24}>
|
|
162
|
-
// {value.map((assetValue) => {
|
|
163
|
-
// const imageUrl = assetImageMap[assetValue];
|
|
164
|
-
// if (!imageUrl) return null;
|
|
165
|
-
// return <RemoteImage key={assetValue} source={imageUrl} />;
|
|
166
|
-
// })}
|
|
167
|
-
// </RemoteImageGroup>
|
|
168
|
-
// );
|
|
169
|
-
// }, [value]);
|
|
170
|
-
|
|
171
|
-
// return (
|
|
172
|
-
// <SelectChip
|
|
173
|
-
// accessibilityLabel="Select multiple assets"
|
|
174
|
-
// onChange={onChange}
|
|
175
|
-
// options={exampleOptions}
|
|
176
|
-
// placeholder="Choose assets"
|
|
177
|
-
// startNode={startNode}
|
|
178
|
-
// type="multi"
|
|
179
|
-
// value={value}
|
|
180
|
-
// />
|
|
181
|
-
// );
|
|
182
|
-
// };
|
|
165
|
+
// Get startNode based on selected assets
|
|
166
|
+
const startNode = useMemo(() => {
|
|
167
|
+
if (value.length === 0) return null;
|
|
183
168
|
|
|
169
|
+
// Multiple assets selected - use RemoteImageGroup
|
|
170
|
+
return /*#__PURE__*/_jsx(RemoteImageGroup, {
|
|
171
|
+
shape: "circle",
|
|
172
|
+
size: 24,
|
|
173
|
+
children: value.map(assetValue => {
|
|
174
|
+
const imageUrl = assetImageMap[assetValue];
|
|
175
|
+
if (!imageUrl) return null;
|
|
176
|
+
return /*#__PURE__*/_jsx(RemoteImage, {
|
|
177
|
+
source: imageUrl
|
|
178
|
+
}, assetValue);
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}, [value]);
|
|
182
|
+
return /*#__PURE__*/_jsx(SelectChip, {
|
|
183
|
+
accessibilityLabel: "Select multiple assets",
|
|
184
|
+
maxWidth: 400,
|
|
185
|
+
onChange: onChange,
|
|
186
|
+
options: exampleOptions,
|
|
187
|
+
placeholder: "Choose assets",
|
|
188
|
+
startNode: startNode,
|
|
189
|
+
type: "multi",
|
|
190
|
+
value: value
|
|
191
|
+
});
|
|
192
|
+
};
|
|
184
193
|
export const InvertColorScheme = () => {
|
|
185
194
|
const exampleOptions = [{
|
|
186
195
|
value: '1',
|
|
@@ -544,6 +553,9 @@ const SelectChipScreen = () => {
|
|
|
544
553
|
}), /*#__PURE__*/_jsx(Example, {
|
|
545
554
|
title: "With Start End Nodes",
|
|
546
555
|
children: /*#__PURE__*/_jsx(WithStartEndNodes, {})
|
|
556
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
557
|
+
title: "Multi-Select with Assets",
|
|
558
|
+
children: /*#__PURE__*/_jsx(MultiSelectWithAssets, {})
|
|
547
559
|
}), /*#__PURE__*/_jsx(Example, {
|
|
548
560
|
title: "Invert Color Scheme",
|
|
549
561
|
children: /*#__PURE__*/_jsx(InvertColorScheme, {})
|
|
@@ -17,10 +17,12 @@ export const DefaultSlideButtonBackground = /*#__PURE__*/memo(/*#__PURE__*/forwa
|
|
|
17
17
|
progress,
|
|
18
18
|
uncheckedLabel,
|
|
19
19
|
disabled,
|
|
20
|
+
compact,
|
|
20
21
|
style,
|
|
21
|
-
borderRadius
|
|
22
|
+
borderRadius
|
|
22
23
|
} = _ref;
|
|
23
24
|
const theme = useTheme();
|
|
25
|
+
const horizontalPadding = compact ? 7 : 9;
|
|
24
26
|
const containerStyle = useMemo(() => [styles.base, {
|
|
25
27
|
backgroundColor: theme.color.bgSecondary,
|
|
26
28
|
borderRadius
|
|
@@ -36,8 +38,8 @@ export const DefaultSlideButtonBackground = /*#__PURE__*/memo(/*#__PURE__*/forwa
|
|
|
36
38
|
style: animatedStyle,
|
|
37
39
|
children: typeof uncheckedLabel !== 'string' ? uncheckedLabel : /*#__PURE__*/_jsx(TextHeadline, {
|
|
38
40
|
numberOfLines: 1,
|
|
39
|
-
paddingEnd:
|
|
40
|
-
paddingStart:
|
|
41
|
+
paddingEnd: horizontalPadding,
|
|
42
|
+
paddingStart: horizontalPadding,
|
|
41
43
|
children: uncheckedLabel
|
|
42
44
|
})
|
|
43
45
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["checked", "disabled", "style", "variant", "startUncheckedNode", "endCheckedNode", "checkedLabel", "borderRadius"];
|
|
1
|
+
const _excluded = ["checked", "compact", "disabled", "style", "variant", "startUncheckedNode", "endCheckedNode", "checkedLabel", "borderRadius"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, memo, useMemo } from 'react';
|
|
@@ -36,9 +36,11 @@ export const styles = StyleSheet.create({
|
|
|
36
36
|
export const SlideButtonHandleChecked = /*#__PURE__*/memo(_ref => {
|
|
37
37
|
let {
|
|
38
38
|
label,
|
|
39
|
-
end
|
|
39
|
+
end,
|
|
40
|
+
compact
|
|
40
41
|
} = _ref;
|
|
41
42
|
const theme = useTheme();
|
|
43
|
+
const handleWidth = compact ? 40 : 56;
|
|
42
44
|
return /*#__PURE__*/_jsxs(Box, {
|
|
43
45
|
alignItems: "center",
|
|
44
46
|
height: "100%",
|
|
@@ -49,9 +51,10 @@ export const SlideButtonHandleChecked = /*#__PURE__*/memo(_ref => {
|
|
|
49
51
|
children: label
|
|
50
52
|
}), /*#__PURE__*/_jsx(Box, {
|
|
51
53
|
alignItems: "center",
|
|
54
|
+
height: "100%",
|
|
52
55
|
justifyContent: "center",
|
|
53
|
-
padding: 2,
|
|
54
56
|
pin: "right",
|
|
57
|
+
width: handleWidth,
|
|
55
58
|
children: end != null ? end : /*#__PURE__*/_jsx(Spinner, {
|
|
56
59
|
color: theme.color.fgInverse,
|
|
57
60
|
size: "small"
|
|
@@ -61,30 +64,35 @@ export const SlideButtonHandleChecked = /*#__PURE__*/memo(_ref => {
|
|
|
61
64
|
});
|
|
62
65
|
export const SlideButtonHandleUnchecked = /*#__PURE__*/memo(_ref2 => {
|
|
63
66
|
let {
|
|
64
|
-
start
|
|
67
|
+
start,
|
|
68
|
+
compact
|
|
65
69
|
} = _ref2;
|
|
70
|
+
const iconSize = compact ? 's' : 'm';
|
|
71
|
+
const handleWidth = compact ? 40 : 56;
|
|
66
72
|
return /*#__PURE__*/_jsx(Box, {
|
|
67
73
|
alignItems: "center",
|
|
74
|
+
height: "100%",
|
|
68
75
|
justifyContent: "center",
|
|
69
|
-
padding: 2,
|
|
70
76
|
pin: "right",
|
|
77
|
+
width: handleWidth,
|
|
71
78
|
children: start != null ? start : /*#__PURE__*/_jsx(Icon, {
|
|
72
79
|
color: "fgInverse",
|
|
73
80
|
name: "forwardArrow",
|
|
74
|
-
size:
|
|
81
|
+
size: iconSize
|
|
75
82
|
})
|
|
76
83
|
});
|
|
77
84
|
});
|
|
78
85
|
export const DefaultSlideButtonHandle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
79
86
|
let {
|
|
80
87
|
checked,
|
|
88
|
+
compact,
|
|
81
89
|
disabled,
|
|
82
90
|
style,
|
|
83
91
|
variant = 'primary',
|
|
84
92
|
startUncheckedNode,
|
|
85
93
|
endCheckedNode,
|
|
86
94
|
checkedLabel,
|
|
87
|
-
borderRadius
|
|
95
|
+
borderRadius
|
|
88
96
|
} = _ref3,
|
|
89
97
|
props = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
90
98
|
const backgroundColor = variants[variant].background;
|
|
@@ -121,6 +129,7 @@ export const DefaultSlideButtonHandle = /*#__PURE__*/memo(/*#__PURE__*/forwardRe
|
|
|
121
129
|
children: [/*#__PURE__*/_jsx(animated.View, {
|
|
122
130
|
style: animatedCheckedStyle,
|
|
123
131
|
children: /*#__PURE__*/_jsx(SlideButtonHandleChecked, {
|
|
132
|
+
compact: compact,
|
|
124
133
|
disabled: disabled,
|
|
125
134
|
end: endCheckedNode,
|
|
126
135
|
label: checkedLabel,
|
|
@@ -129,6 +138,7 @@ export const DefaultSlideButtonHandle = /*#__PURE__*/memo(/*#__PURE__*/forwardRe
|
|
|
129
138
|
}), /*#__PURE__*/_jsx(animated.View, {
|
|
130
139
|
style: animatedUncheckedStyle,
|
|
131
140
|
children: /*#__PURE__*/_jsx(SlideButtonHandleUnchecked, {
|
|
141
|
+
compact: compact,
|
|
132
142
|
disabled: disabled,
|
|
133
143
|
start: startUncheckedNode,
|
|
134
144
|
variant: variant
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["
|
|
1
|
+
const _excluded = ["checked", "compact", "borderRadius", "uncheckedLabel", "checkedLabel", "onSlideStart", "onSlideCancel", "onSlideEnd", "onSlideComplete", "onChange", "disabled", "height", "checkThreshold", "SlideButtonHandleComponent", "SlideButtonBackgroundComponent", "styles", "testID", "autoCompleteSlideOnThresholdMet", "variant", "startUncheckedNode", "endCheckedNode"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, memo, useCallback, useId, useMemo } from 'react';
|
|
@@ -13,8 +13,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
export const slideButtonTestID = 'slide-button';
|
|
14
14
|
export const SlideButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
15
15
|
let {
|
|
16
|
-
borderRadius,
|
|
17
16
|
checked,
|
|
17
|
+
compact,
|
|
18
|
+
borderRadius = compact ? 700 : 900,
|
|
18
19
|
uncheckedLabel,
|
|
19
20
|
checkedLabel,
|
|
20
21
|
onSlideStart,
|
|
@@ -43,7 +44,7 @@ export const SlideButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
43
44
|
progress: checked ? 1 : 0,
|
|
44
45
|
config: animationConfig
|
|
45
46
|
});
|
|
46
|
-
const buttonMinHeight = interactableHeight
|
|
47
|
+
const buttonMinHeight = interactableHeight[compact ? 'compact' : 'regular'];
|
|
47
48
|
const buttonMinWidth = buttonMinHeight;
|
|
48
49
|
const handleComplete = useCallback(() => {
|
|
49
50
|
void progress.start(1);
|
|
@@ -110,6 +111,7 @@ export const SlideButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
110
111
|
children: [/*#__PURE__*/_jsx(SlideButtonBackgroundComponent, {
|
|
111
112
|
borderRadius: borderRadius,
|
|
112
113
|
checked: checked,
|
|
114
|
+
compact: compact,
|
|
113
115
|
disabled: disabled,
|
|
114
116
|
progress: progress,
|
|
115
117
|
style: styles == null ? void 0 : styles.background,
|
|
@@ -130,6 +132,7 @@ export const SlideButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
130
132
|
borderRadius: borderRadius,
|
|
131
133
|
checked: checked,
|
|
132
134
|
checkedLabel: checkedLabel,
|
|
135
|
+
compact: compact,
|
|
133
136
|
disabled: disabled,
|
|
134
137
|
endCheckedNode: endCheckedNode,
|
|
135
138
|
onAccessibilityAction: handleAccessibilityAction,
|
|
@@ -103,6 +103,12 @@ export const SlideButtonStories = () => {
|
|
|
103
103
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
104
104
|
uncheckedLabel: "Super long label that will get truncated when it exceeds the available space"
|
|
105
105
|
})
|
|
106
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
107
|
+
title: "Compact & long label",
|
|
108
|
+
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
109
|
+
compact: true,
|
|
110
|
+
uncheckedLabel: "Super long label that will get truncated when it exceeds the available space"
|
|
111
|
+
})
|
|
106
112
|
}), /*#__PURE__*/_jsx(Example, {
|
|
107
113
|
title: "Auto complete slide on threshold met",
|
|
108
114
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
@@ -161,6 +167,17 @@ export const SlideButtonStories = () => {
|
|
|
161
167
|
checked: true,
|
|
162
168
|
disabled: true
|
|
163
169
|
})
|
|
170
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
171
|
+
title: "Compact",
|
|
172
|
+
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
173
|
+
compact: true
|
|
174
|
+
})
|
|
175
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
176
|
+
title: "Compact and disabled",
|
|
177
|
+
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
178
|
+
compact: true,
|
|
179
|
+
disabled: true
|
|
180
|
+
})
|
|
164
181
|
}), /*#__PURE__*/_jsx(Example, {
|
|
165
182
|
title: "Custom components",
|
|
166
183
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
@@ -23,7 +23,7 @@ export const RemoteImageGroup = _ref => {
|
|
|
23
23
|
} = useTheme();
|
|
24
24
|
const shapeStyle = shapeStyles[shape];
|
|
25
25
|
const sizeAsNumber = typeof size === 'number' ? size : avatarSize[size];
|
|
26
|
-
const overlapSpacing = sizeAsNumber <= 40 ?
|
|
26
|
+
const overlapSpacing = sizeAsNumber <= 40 ? -1 : -2;
|
|
27
27
|
const excess = Children.count(children) - max;
|
|
28
28
|
const groupChildren = useMemo(() => {
|
|
29
29
|
const arrayChildren = Children.toArray(children);
|
|
@@ -63,7 +63,7 @@ export const RemoteImageGroup = _ref => {
|
|
|
63
63
|
// zIndex is progressively lower so that each child is stacked below the previous one
|
|
64
64
|
const zIndex = -index;
|
|
65
65
|
return /*#__PURE__*/_jsx(Box, {
|
|
66
|
-
|
|
66
|
+
marginStart: index === 0 ? undefined : overlapSpacing,
|
|
67
67
|
position: "relative",
|
|
68
68
|
testID: (testID ? testID + "-" : '') + "inner-box-" + index,
|
|
69
69
|
zIndex: zIndex,
|
|
@@ -74,7 +74,7 @@ export const RemoteImageGroup = _ref => {
|
|
|
74
74
|
background: "bgOverlay",
|
|
75
75
|
height: sizeAsNumber,
|
|
76
76
|
justifyContent: "center",
|
|
77
|
-
|
|
77
|
+
marginStart: overlapSpacing,
|
|
78
78
|
position: "relative",
|
|
79
79
|
style: shapeStyle,
|
|
80
80
|
width: sizeAsNumber,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.34.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"react-native-svg": "^14.1.0"
|
|
199
199
|
},
|
|
200
200
|
"dependencies": {
|
|
201
|
-
"@coinbase/cds-common": "^8.
|
|
201
|
+
"@coinbase/cds-common": "^8.34.0",
|
|
202
202
|
"@coinbase/cds-icons": "^5.8.0",
|
|
203
203
|
"@coinbase/cds-illustrations": "^4.29.0",
|
|
204
204
|
"@coinbase/cds-lottie-files": "^3.3.4",
|