@coinbase/cds-mobile 9.15.0 → 9.17.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/alpha/select-chip/SelectChip.d.ts +6 -12
- package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -1
- package/dts/alpha/select-chip/SelectChipControl.d.ts +49 -5
- package/dts/alpha/select-chip/SelectChipControl.d.ts.map +1 -1
- package/dts/alpha/select-chip/index.d.ts +1 -1
- package/dts/alpha/select-chip/index.d.ts.map +1 -1
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts +4 -1
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts.map +1 -1
- package/dts/chips/Chip.d.ts +3 -0
- package/dts/chips/Chip.d.ts.map +1 -1
- package/dts/chips/ChipProps.d.ts +35 -2
- package/dts/chips/ChipProps.d.ts.map +1 -1
- package/dts/chips/InputChip.d.ts.map +1 -1
- package/dts/chips/MediaChip.d.ts +3 -0
- package/dts/chips/MediaChip.d.ts.map +1 -1
- package/dts/visualizations/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- package/dts/visualizations/chart/utils/bar.d.ts.map +1 -1
- package/dts/visualizations/chart/utils/gradient.d.ts +9 -0
- package/dts/visualizations/chart/utils/gradient.d.ts.map +1 -1
- package/esm/alpha/select-chip/SelectChip.js +73 -21
- package/esm/alpha/select-chip/SelectChipControl.js +39 -10
- package/esm/alpha/select-chip/__stories__/AlphaSelectChip.stories.js +4 -4
- package/esm/alpha/select-chip/index.js +1 -1
- package/esm/alpha/tabbed-chips/TabbedChips.js +2 -2
- package/esm/chips/Chip.js +16 -7
- package/esm/chips/InputChip.js +24 -6
- package/esm/chips/__stories__/Chip.stories.js +2 -2
- package/esm/chips/__stories__/MediaChip.stories.js +2 -2
- package/esm/visualizations/chart/scrubber/ScrubberProvider.js +8 -0
- package/esm/visualizations/chart/utils/bar.js +8 -2
- package/esm/visualizations/chart/utils/gradient.js +105 -74
- package/package.json +3 -3
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
|
+
## 9.17.0 (8/14/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Feat: support charts gradients for bars. [[#844](https://github.com/coinbase/cds/pull/844)]
|
|
16
|
+
|
|
17
|
+
## 9.16.0 (8/13/2026 PST)
|
|
18
|
+
|
|
19
|
+
#### 🚀 Updates
|
|
20
|
+
|
|
21
|
+
- Deprecate invertColorScheme in favor of new, canoncical active prop for the Chip family of props. [[#843](https://github.com/coinbase/cds/pull/843)]
|
|
22
|
+
|
|
11
23
|
## 9.15.0 (8/11/2026 PST)
|
|
12
24
|
|
|
13
25
|
#### 🚀 Updates
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ChipBaseProps } from '../../chips/ChipProps';
|
|
3
2
|
import { type SelectRef } from '../select/Select';
|
|
4
3
|
import type { SelectProps, SelectType } from '../select/types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'invertColorScheme' | 'numberOfLines' | 'maxWidth' | 'size' | 'compact'
|
|
8
|
-
> & {
|
|
9
|
-
/**
|
|
10
|
-
* Override the displayed value in the chip control.
|
|
11
|
-
* Useful for avoiding truncation, especially in multi-select scenarios where multiple option labels might be too long to display.
|
|
12
|
-
* When provided, this value takes precedence over the default label generation.
|
|
13
|
-
*/
|
|
14
|
-
displayValue?: React.ReactNode;
|
|
15
|
-
};
|
|
4
|
+
import { type SelectChipControlChipProps, type SelectChipControlProps } from './SelectChipControl';
|
|
5
|
+
export type SelectChipBaseProps = Pick<SelectChipControlProps, keyof SelectChipControlChipProps>;
|
|
16
6
|
export type SelectChipProps<
|
|
17
7
|
Type extends SelectType = 'single',
|
|
18
8
|
SelectOptionValue extends string = string,
|
|
@@ -26,6 +16,10 @@ export type SelectChipProps<
|
|
|
26
16
|
| 'maxWidth'
|
|
27
17
|
| 'size'
|
|
28
18
|
| 'compact'
|
|
19
|
+
| 'bordered'
|
|
20
|
+
| 'borderWidth'
|
|
21
|
+
| 'borderColor'
|
|
22
|
+
| 'borderRadius'
|
|
29
23
|
>;
|
|
30
24
|
export declare const SelectChip: <
|
|
31
25
|
Type extends SelectType = 'single',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectChip.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/SelectChip.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectChip.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/SelectChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAI7C,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAsB,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAI7B,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,EAAE,MAAM,0BAA0B,CAAC,CAAC;AAEjG,MAAM,MAAM,eAAe,CACzB,IAAI,SAAS,UAAU,GAAG,QAAQ,EAClC,iBAAiB,SAAS,MAAM,GAAG,MAAM,IACvC,mBAAmB,GACrB,IAAI,CACF,WAAW,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAClC,wBAAwB,GACxB,YAAY,GACZ,cAAc,GACd,SAAS,GACT,UAAU,GACV,MAAM,GACN,SAAS,GACT,UAAU,GACV,aAAa,GACb,aAAa,GACb,cAAc,CACjB,CAAC;AAuHJ,eAAO,MAAM,UAAU,EAA0B,CAC/C,IAAI,SAAS,UAAU,GAAG,QAAQ,EAClC,iBAAiB,SAAS,MAAM,GAAG,MAAM,EAEzC,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;CAAE,KAC7E,KAAK,CAAC,YAAY,CAAC"}
|
|
@@ -1,14 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
|
+
import type { ChipBaseProps } from '../../chips/ChipProps';
|
|
3
4
|
import { type SelectControlProps, type SelectType } from '../select/types';
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Chip props accepted by {@link SelectChipControl} and forwarded to {@link MediaChip}.
|
|
7
|
+
* Includes selection state, layout, borders, and `displayValue` for the control label.
|
|
8
|
+
*/
|
|
9
|
+
export type SelectChipControlChipProps = Pick<
|
|
10
|
+
ChipBaseProps,
|
|
11
|
+
| 'active'
|
|
12
|
+
| 'activeBackground'
|
|
13
|
+
| 'activeColor'
|
|
14
|
+
| 'background'
|
|
15
|
+
| 'color'
|
|
16
|
+
| 'invertColorScheme'
|
|
17
|
+
| 'inverted'
|
|
18
|
+
| 'numberOfLines'
|
|
19
|
+
| 'maxWidth'
|
|
20
|
+
| 'size'
|
|
21
|
+
| 'compact'
|
|
22
|
+
| 'borderWidth'
|
|
23
|
+
| 'borderColor'
|
|
24
|
+
| 'bordered'
|
|
25
|
+
| 'borderRadius'
|
|
26
|
+
> & {
|
|
27
|
+
/**
|
|
28
|
+
* Override the displayed value in the chip control.
|
|
29
|
+
* Useful for avoiding truncation, especially in multi-select scenarios where multiple option labels might be too long to display.
|
|
30
|
+
* When provided, this value takes precedence over the default label generation.
|
|
31
|
+
*/
|
|
32
|
+
displayValue?: React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* SelectControlProps fields superseded by {@link SelectChipControlChipProps}.
|
|
36
|
+
* Omit is required: intersection would merge overlapping keys (e.g. `size` as SelectSize &
|
|
37
|
+
* ChipSize, `background` as Box vs chip tokens) instead of replacing select-scale definitions.
|
|
38
|
+
*/
|
|
39
|
+
type SelectControlPropsReplacedByChipProps = keyof Pick<
|
|
40
|
+
SelectControlProps,
|
|
41
|
+
'size' | 'compact' | 'borderWidth' | 'borderColor' | 'bordered' | 'borderRadius'
|
|
42
|
+
>;
|
|
43
|
+
export type SelectChipControlProps<
|
|
44
|
+
Type extends SelectType = 'single',
|
|
45
|
+
SelectOptionValue extends string = string,
|
|
46
|
+
> = Omit<SelectControlProps<Type, SelectOptionValue>, SelectControlPropsReplacedByChipProps> &
|
|
47
|
+
SelectChipControlChipProps;
|
|
48
|
+
/** Generic memo components need an explicit cast for the public polymorphic signature. */
|
|
5
49
|
export declare const SelectChipControl: <
|
|
6
50
|
Type extends SelectType,
|
|
7
51
|
SelectOptionValue extends string = string,
|
|
8
52
|
>(
|
|
9
|
-
props:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
53
|
+
props: SelectChipControlProps<Type, SelectOptionValue> & {
|
|
54
|
+
ref?: React.Ref<View>;
|
|
55
|
+
},
|
|
13
56
|
) => React.ReactElement;
|
|
57
|
+
export {};
|
|
14
58
|
//# sourceMappingURL=SelectChipControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectChipControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/SelectChipControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectChipControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/SelectChipControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,aAAa,EACX,QAAQ,GACR,kBAAkB,GAClB,aAAa,GACb,YAAY,GACZ,OAAO,GACP,mBAAmB,GACnB,UAAU,GACV,eAAe,GACf,UAAU,GACV,MAAM,GACN,SAAS,GACT,aAAa,GACb,aAAa,GACb,UAAU,GACV,cAAc,CACjB,GAAG;IACF;;;;OAIG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF;;;;GAIG;AACH,KAAK,qCAAqC,GAAG,MAAM,IAAI,CACrD,kBAAkB,EAClB,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,UAAU,GAAG,cAAc,CACjF,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAChC,IAAI,SAAS,UAAU,GAAG,QAAQ,EAClC,iBAAiB,SAAS,MAAM,GAAG,MAAM,IACvC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAAE,qCAAqC,CAAC,GAC1F,0BAA0B,CAAC;AAmK7B,0FAA0F;AAC1F,eAAO,MAAM,iBAAiB,EAAiC,CAC7D,IAAI,SAAS,UAAU,EACvB,iBAAiB,SAAS,MAAM,GAAG,MAAM,EAEzC,KAAK,EAAE,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IACvD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;CACvB,KACE,KAAK,CAAC,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -16,11 +16,14 @@ export type TabbedChipProps<TabId extends string = string> = Omit<
|
|
|
16
16
|
Component?: React.FC<Omit<ChipProps, 'children'> & TabValue<TabId>>;
|
|
17
17
|
/**
|
|
18
18
|
* Custom background color applied to the chip when it is the active tab.
|
|
19
|
-
*
|
|
19
|
+
* Skips color-scheme inversion and paints this token directly. Any `start`,
|
|
20
|
+
* `end`, or custom tab content must set explicit colors to match.
|
|
20
21
|
*/
|
|
21
22
|
activeBackground?: MediaChipBaseProps['background'];
|
|
22
23
|
/**
|
|
23
24
|
* Custom foreground color applied to the chip label when it is the active tab.
|
|
25
|
+
* Skips color-scheme inversion when set. Any `start`, `end`, or custom tab
|
|
26
|
+
* content must set explicit colors to match.
|
|
24
27
|
*/
|
|
25
28
|
activeColor?: MediaChipBaseProps['color'];
|
|
26
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabbedChips.d.ts","sourceRoot":"","sources":["../../../src/alpha/tabbed-chips/TabbedChips.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAa,KAAK,kBAAkB,EAAE,MAAM,uBAAuB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AAE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,YAAY,CAAC;AAoFxB,eAAO,MAAM,WAAW,EAA2B,aAAa,CAAC"}
|
package/dts/chips/Chip.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare const Chip: React.NamedExoticComponent<
|
|
|
13
13
|
start?: React.ReactNode;
|
|
14
14
|
end?: React.ReactNode;
|
|
15
15
|
maxWidth?: import('react-native').DimensionValue;
|
|
16
|
+
active?: boolean;
|
|
17
|
+
activeBackground?: import('../styles/styleProps').StyleProps['background'];
|
|
18
|
+
activeColor?: import('../styles/styleProps').StyleProps['color'];
|
|
16
19
|
inverted?: boolean;
|
|
17
20
|
invertColorScheme?: boolean;
|
|
18
21
|
compact?: boolean;
|
package/dts/chips/Chip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/chips/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/chips/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAUzC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAiBpC;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;YAuGP,CAAP;eAGmB,CAAC;;;UAtGf,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;EAwGrB,CAAC"}
|
package/dts/chips/ChipProps.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DimensionValue, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
2
|
import { type SharedAccessibilityProps } from '@coinbase/cds-common/types/SharedAccessibilityProps';
|
|
3
3
|
import { type SharedProps } from '@coinbase/cds-common/types/SharedProps';
|
|
4
|
+
import type { StyleProps } from '../styles/styleProps';
|
|
4
5
|
import type { PressableProps } from '../system/Pressable';
|
|
5
6
|
export type ChipSize = 'xs' | 's';
|
|
6
7
|
export type ChipBaseProps = SharedProps &
|
|
@@ -17,18 +18,50 @@ export type ChipBaseProps = SharedProps &
|
|
|
17
18
|
* @default 200
|
|
18
19
|
*/
|
|
19
20
|
maxWidth?: DimensionValue;
|
|
21
|
+
/**
|
|
22
|
+
* When true, emphasizes the Chip with higher contrast by inverting the color
|
|
23
|
+
* scheme for everything rendered inside the Chip — including `background`,
|
|
24
|
+
* `color`, icons, and other token-based colors. Those props are resolved
|
|
25
|
+
* against the opposite color scheme, matching the legacy `invertColorScheme`
|
|
26
|
+
* behavior.
|
|
27
|
+
*
|
|
28
|
+
* Set `activeBackground` and/or `activeColor` to opt out of inversion and
|
|
29
|
+
* paint explicit active colors instead.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
active?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Background color applied when `active` is true. When set, the Chip skips
|
|
35
|
+
* color-scheme inversion and uses this token directly.
|
|
36
|
+
*
|
|
37
|
+
* **Warning:** `start`, `end`, and `children` ReactNodes are not updated
|
|
38
|
+
* automatically — pass explicit `color` props on nested icons and other
|
|
39
|
+
* content so they match the active palette.
|
|
40
|
+
*/
|
|
41
|
+
activeBackground?: StyleProps['background'];
|
|
42
|
+
/**
|
|
43
|
+
* Foreground color applied when `active` is true. When set, the Chip skips
|
|
44
|
+
* color-scheme inversion and uses this token for string labels.
|
|
45
|
+
*
|
|
46
|
+
* **Warning:** `start`, `end`, and `children` ReactNodes are not updated
|
|
47
|
+
* automatically — pass explicit `color` props on nested icons and other
|
|
48
|
+
* content so they match the active palette.
|
|
49
|
+
*/
|
|
50
|
+
activeColor?: StyleProps['color'];
|
|
20
51
|
/**
|
|
21
52
|
* Invert the foreground and background colors to emphasize the Chip.
|
|
22
53
|
* Depending on your theme, it may be dangerous to use this prop in conjunction with `transparentWhileInactive`.
|
|
23
54
|
* @default false
|
|
24
|
-
* @deprecated Use the
|
|
25
|
-
* @deprecationExpectedRemoval
|
|
55
|
+
* @deprecated Use the `active` prop instead. This will be removed in a future major release.
|
|
56
|
+
* @deprecationExpectedRemoval v11
|
|
26
57
|
*/
|
|
27
58
|
inverted?: boolean;
|
|
28
59
|
/**
|
|
29
60
|
* Invert the foreground and background colors to emphasize the Chip.
|
|
30
61
|
* Depending on your theme, it may be dangerous to use this prop in conjunction with `transparentWhileInactive`.
|
|
31
62
|
* @default false
|
|
63
|
+
* @deprecated Use the `active` prop instead. This will be removed in a future major release.
|
|
64
|
+
* @deprecationExpectedRemoval v11
|
|
32
65
|
*/
|
|
33
66
|
invertColorScheme?: boolean;
|
|
34
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipProps.d.ts","sourceRoot":"","sources":["../../src/chips/ChipProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,GAAG,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG,WAAW,GACrC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC,GACjF,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,CAAC,GAAG;IACrD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,wCAAwC;I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,CAAC;CACvB,
|
|
1
|
+
{"version":3,"file":"InputChip.d.ts","sourceRoot":"","sources":["../../src/chips/InputChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAKzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,SAAS,iDAIjB,cAAc,GAAG;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;CACvB,6CA6CF,CAAC"}
|
package/dts/chips/MediaChip.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export declare const MediaChip: import('react').NamedExoticComponent<
|
|
|
10
10
|
start?: React.ReactNode;
|
|
11
11
|
end?: React.ReactNode;
|
|
12
12
|
maxWidth?: import('react-native').DimensionValue;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
activeBackground?: import('../styles/styleProps').StyleProps['background'];
|
|
15
|
+
activeColor?: import('../styles/styleProps').StyleProps['color'];
|
|
13
16
|
inverted?: boolean;
|
|
14
17
|
invertColorScheme?: boolean;
|
|
15
18
|
compact?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaChip.d.ts","sourceRoot":"","sources":["../../src/chips/MediaChip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMzC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,SAAS,CAAC;AAE5D,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"MediaChip.d.ts","sourceRoot":"","sources":["../../src/chips/MediaChip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMzC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,SAAS,CAAC;AAE5D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;YAmEo7D,CAAC;eAAkE,CAAC;;;UA/DtgE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;EA8DrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../../src/visualizations/chart/scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,GAAG;IAC3F,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC;
|
|
1
|
+
{"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../../src/visualizations/chart/scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,GAAG;IAC3F,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,qBAAqB,C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OAAO,CAAC;IACxB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,YAAY,CAAC;CACpC;;;;;;;;;;;;;;;;;;IA5uBC,uFAAuF;cAC7E,MAAM;IAChB,mFAAmF;YAC3E,MAAM;IACd,8FAA8F;eACnF,CAAC,MAAM,EAAE,MAAM,CAAC;IAC3B,yEAAyE;qBACxD,OAAO;IAo6BzB"}
|
|
@@ -97,6 +97,15 @@ export declare const evaluateGradientAtValue: (
|
|
|
97
97
|
dataValue: number,
|
|
98
98
|
scale: SerializableScale | ChartScaleFunction,
|
|
99
99
|
) => string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Evaluates the opacity at a specific data value based on gradient stops.
|
|
102
|
+
* Returns undefined when no stops define opacity.
|
|
103
|
+
*/
|
|
104
|
+
export declare const evaluateGradientOpacityAtValue: (
|
|
105
|
+
stops: GradientStop[],
|
|
106
|
+
dataValue: number,
|
|
107
|
+
scale: SerializableScale | ChartScaleFunction,
|
|
108
|
+
) => number | undefined;
|
|
100
109
|
/**
|
|
101
110
|
* Determines the baseline value for the gradient area by finding the value
|
|
102
111
|
* within the axis bounds that is closest to the target baseline.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../../../src/visualizations/chart/utils/gradient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU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GAGG;AACH,eAAO,MAAM,8BAA8B,GACzC,OAAO,YAAY,EAAE,EACrB,WAAW,MAAM,EACjB,OAAO,iBAAiB,GAAG,kBAAkB,KAC5C,MAAM,GAAG,SAgBX,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,YAAY,UAAU,EAAE,WAAU,MAAU,KAAG,MAc1E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,UAAU,EACtB,eAAe,MAAM,EACrB,MAAM,MAAM,EACZ,aAAa,MAAM,EACnB,iBAAiB,MAAM,EACvB,OAAM,GAAG,GAAG,GAAS,KACpB,kBA0BF,CAAC"}
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
const _excluded = ["ref"],
|
|
2
|
-
_excluded2 = ["
|
|
3
|
-
|
|
2
|
+
_excluded2 = ["active", "invertColorScheme", "inverted", "value"],
|
|
3
|
+
_excluded3 = ["active", "activeBackground", "activeColor", "background", "color", "numberOfLines", "maxWidth", "displayValue", "size", "compact", "borderWidth", "borderColor", "bordered", "borderRadius", "invertColorScheme", "inverted"];
|
|
4
4
|
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; }
|
|
5
|
-
|
|
5
|
+
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); }
|
|
6
|
+
import React, { memo, useMemo } from 'react';
|
|
7
|
+
import { getSelectChipActive } from '@coinbase/cds-common/chips/getSelectChipActive';
|
|
6
8
|
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
7
9
|
import { Select } from '../select/Select';
|
|
8
10
|
import { SelectChipControl } from './SelectChipControl';
|
|
11
|
+
|
|
12
|
+
// TODO(CDS-2544): SelectChipBaseProps should also compose SelectBaseProps.
|
|
13
|
+
// https://linear.app/coinbase/issue/CDS-2544/selectchipbaseprops-should-compose-selectbaseprops
|
|
9
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
/**
|
|
16
|
+
* Creates a wrapper component that injects chip-specific props into SelectChipControl.
|
|
17
|
+
* Select only forwards generic control props to `SelectControlComponent`; chip styling
|
|
18
|
+
* and `active` are owned by SelectChip and must be closed over here.
|
|
19
|
+
*/
|
|
20
|
+
function createSelectChipControlWrapper(chipProps) {
|
|
21
|
+
return /*#__PURE__*/memo(controlProps => {
|
|
22
|
+
// Chip props are spread last so they win at runtime; the cast bridges overlapping keys
|
|
23
|
+
// (`size`, borders) where SelectControlProps and SelectChipBaseProps use different types.
|
|
24
|
+
return /*#__PURE__*/_jsx(SelectChipControl, _extends({}, _extends({}, controlProps, chipProps)));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
10
28
|
/**
|
|
11
29
|
* Chip-styled Select control built on top of the Alpha Select.
|
|
12
30
|
* Supports both single and multi selection via Select's `type` prop.
|
|
@@ -16,33 +34,67 @@ const SelectChipComponent = /*#__PURE__*/memo(_ref => {
|
|
|
16
34
|
ref
|
|
17
35
|
} = _ref,
|
|
18
36
|
_props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
19
|
-
|
|
37
|
+
// Resolve `active` from instance props before config merge so state-aware resolvers
|
|
38
|
+
// (active vs inactive border styling) see the final selection state. `value` and
|
|
39
|
+
// legacy invert props are pulled out with `active` and passed back explicitly because
|
|
40
|
+
// they feed that resolution and must remain available to the config resolver input.
|
|
20
41
|
const {
|
|
42
|
+
active: activeProp,
|
|
21
43
|
invertColorScheme,
|
|
44
|
+
inverted,
|
|
45
|
+
value
|
|
46
|
+
} = _props,
|
|
47
|
+
restProps = _objectWithoutPropertiesLoose(_props, _excluded2);
|
|
48
|
+
const resolvedActive = getSelectChipActive(activeProp, value, invertColorScheme, inverted);
|
|
49
|
+
const mergedProps = useComponentConfig('SelectChip', _extends({}, restProps, {
|
|
50
|
+
value,
|
|
51
|
+
active: resolvedActive,
|
|
52
|
+
invertColorScheme,
|
|
53
|
+
inverted
|
|
54
|
+
}));
|
|
55
|
+
// SelectChip composes Select + MediaChip; peel chip props off merged props so the rest
|
|
56
|
+
// can flow to `<Select>` without chip-only fields leaking into the select interface.
|
|
57
|
+
const {
|
|
58
|
+
active,
|
|
59
|
+
activeBackground,
|
|
60
|
+
activeColor,
|
|
61
|
+
background,
|
|
62
|
+
color,
|
|
22
63
|
numberOfLines,
|
|
23
64
|
maxWidth,
|
|
24
65
|
displayValue,
|
|
25
66
|
size,
|
|
26
|
-
compact
|
|
67
|
+
compact,
|
|
68
|
+
borderWidth,
|
|
69
|
+
borderColor,
|
|
70
|
+
bordered,
|
|
71
|
+
borderRadius,
|
|
72
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
73
|
+
inverted: mergedInverted
|
|
27
74
|
} = mergedProps,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
75
|
+
selectProps = _objectWithoutPropertiesLoose(mergedProps, _excluded3);
|
|
76
|
+
const WrappedSelectChipControl = useMemo(() => createSelectChipControlWrapper({
|
|
77
|
+
active,
|
|
78
|
+
activeBackground,
|
|
79
|
+
activeColor,
|
|
80
|
+
background,
|
|
81
|
+
color,
|
|
82
|
+
numberOfLines,
|
|
83
|
+
maxWidth,
|
|
84
|
+
displayValue,
|
|
85
|
+
size,
|
|
86
|
+
compact,
|
|
87
|
+
borderWidth,
|
|
88
|
+
borderColor,
|
|
89
|
+
bordered,
|
|
90
|
+
borderRadius,
|
|
91
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
92
|
+
inverted: mergedInverted
|
|
93
|
+
}), [active, activeBackground, activeColor, background, color, displayValue, numberOfLines, maxWidth, size, compact, borderWidth, borderColor, bordered, borderRadius, mergedInvertColorScheme, mergedInverted]);
|
|
42
94
|
return /*#__PURE__*/_jsx(Select, _extends({
|
|
43
95
|
ref: ref,
|
|
44
|
-
SelectControlComponent:
|
|
45
|
-
},
|
|
96
|
+
SelectControlComponent: WrappedSelectChipControl
|
|
97
|
+
}, selectProps));
|
|
46
98
|
});
|
|
47
99
|
SelectChipComponent.displayName = 'SelectChip';
|
|
48
100
|
export const SelectChip = SelectChipComponent;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { getSelectChipHasValue } from '@coinbase/cds-common/chips/getSelectChipActive';
|
|
2
3
|
import { MediaChip } from '../../chips/MediaChip';
|
|
3
4
|
import { AnimatedCaret } from '../../motion/AnimatedCaret';
|
|
4
5
|
import { isSelectOptionGroup } from '../select/types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Chip props accepted by {@link SelectChipControl} and forwarded to {@link MediaChip}.
|
|
9
|
+
* Includes selection state, layout, borders, and `displayValue` for the control label.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SelectControlProps fields superseded by {@link SelectChipControlChipProps}.
|
|
14
|
+
* Omit is required: intersection would merge overlapping keys (e.g. `size` as SelectSize &
|
|
15
|
+
* ChipSize, `background` as Box vs chip tokens) instead of replacing select-scale definitions.
|
|
16
|
+
*/
|
|
5
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
18
|
const SelectChipControlComponent = /*#__PURE__*/memo(_ref => {
|
|
7
19
|
let {
|
|
@@ -22,13 +34,23 @@ const SelectChipControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
22
34
|
label,
|
|
23
35
|
compact,
|
|
24
36
|
size,
|
|
37
|
+
active,
|
|
38
|
+
activeBackground,
|
|
39
|
+
activeColor,
|
|
40
|
+
background,
|
|
41
|
+
color,
|
|
25
42
|
invertColorScheme,
|
|
43
|
+
inverted,
|
|
26
44
|
numberOfLines,
|
|
27
45
|
maxWidth,
|
|
28
|
-
displayValue
|
|
46
|
+
displayValue,
|
|
47
|
+
borderWidth,
|
|
48
|
+
borderColor,
|
|
49
|
+
bordered,
|
|
50
|
+
borderRadius
|
|
29
51
|
} = _ref;
|
|
30
52
|
const isMultiSelect = type === 'multi';
|
|
31
|
-
const hasValue =
|
|
53
|
+
const hasValue = getSelectChipHasValue(value);
|
|
32
54
|
|
|
33
55
|
// Map of options to their values
|
|
34
56
|
// If multiple options share the same value, the first occurrence wins (matches native HTML select behavior)
|
|
@@ -83,30 +105,34 @@ const SelectChipControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
83
105
|
const opt = optionsMap.get(value);
|
|
84
106
|
return (_ref6 = (_ref7 = (_ref8 = (_opt$label2 = opt == null ? void 0 : opt.label) != null ? _opt$label2 : opt == null ? void 0 : opt.description) != null ? _ref8 : opt == null ? void 0 : opt.value) != null ? _ref7 : placeholder) != null ? _ref6 : null;
|
|
85
107
|
}, [hasValue, label, placeholder, displayValue, isMultiSelect, optionsMap, value, maxSelectedOptionsToShow, hiddenSelectedOptionsLabel]);
|
|
108
|
+
const resolvedColor = active && activeColor !== undefined ? activeColor : color;
|
|
86
109
|
const endNode = useMemo(() => {
|
|
110
|
+
// Match Chip's label color. `fg` still inverts with the chip when active uses theme inversion.
|
|
87
111
|
return customEndNode != null ? customEndNode : /*#__PURE__*/_jsx(AnimatedCaret, {
|
|
88
112
|
active: true,
|
|
89
|
-
color:
|
|
113
|
+
color: resolvedColor != null ? resolvedColor : 'fg',
|
|
90
114
|
rotate: open ? 0 : 180,
|
|
91
115
|
size: "xs"
|
|
92
116
|
});
|
|
93
|
-
}, [customEndNode, open,
|
|
94
|
-
const color = useMemo(() => {
|
|
95
|
-
return hasValue ? 'fgInverse' : 'fg';
|
|
96
|
-
}, [hasValue]);
|
|
97
|
-
const background = useMemo(() => {
|
|
98
|
-
return hasValue ? 'bgInverse' : 'bgSecondary';
|
|
99
|
-
}, [hasValue]);
|
|
117
|
+
}, [customEndNode, open, resolvedColor]);
|
|
100
118
|
return /*#__PURE__*/_jsx(MediaChip, {
|
|
101
119
|
ref: ref,
|
|
102
120
|
accessibilityHint: accessibilityHint,
|
|
103
121
|
accessibilityLabel: accessibilityLabel,
|
|
122
|
+
active: active,
|
|
123
|
+
activeBackground: activeBackground,
|
|
124
|
+
activeColor: activeColor,
|
|
104
125
|
background: background,
|
|
126
|
+
bordered: bordered,
|
|
127
|
+
borderColor: borderColor,
|
|
128
|
+
borderRadius: borderRadius,
|
|
129
|
+
borderWidth: borderWidth,
|
|
105
130
|
color: color,
|
|
106
131
|
compact: compact,
|
|
107
132
|
disabled: disabled,
|
|
108
133
|
end: endNode,
|
|
109
134
|
invertColorScheme: invertColorScheme,
|
|
135
|
+
inverted: inverted,
|
|
110
136
|
maxWidth: maxWidth,
|
|
111
137
|
numberOfLines: numberOfLines,
|
|
112
138
|
onPress: () => setOpen(s => !s),
|
|
@@ -115,4 +141,7 @@ const SelectChipControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
115
141
|
children: labelContent
|
|
116
142
|
});
|
|
117
143
|
});
|
|
144
|
+
SelectChipControlComponent.displayName = 'SelectChipControl';
|
|
145
|
+
|
|
146
|
+
/** Generic memo components need an explicit cast for the public polymorphic signature. */
|
|
118
147
|
export const SelectChipControl = SelectChipControlComponent;
|
|
@@ -217,7 +217,7 @@ export const MultiSelectWithAssets = () => {
|
|
|
217
217
|
value: value
|
|
218
218
|
});
|
|
219
219
|
};
|
|
220
|
-
export const
|
|
220
|
+
export const Active = () => {
|
|
221
221
|
const exampleOptions = [{
|
|
222
222
|
value: '1',
|
|
223
223
|
label: 'Option 1'
|
|
@@ -231,7 +231,7 @@ export const InvertColorScheme = () => {
|
|
|
231
231
|
borderRadius: 200,
|
|
232
232
|
padding: 2,
|
|
233
233
|
children: /*#__PURE__*/_jsx(SelectChip, {
|
|
234
|
-
|
|
234
|
+
active: true,
|
|
235
235
|
onChange: setValue,
|
|
236
236
|
options: exampleOptions,
|
|
237
237
|
placeholder: "Choose an option",
|
|
@@ -587,8 +587,8 @@ const SelectChipScreen = () => {
|
|
|
587
587
|
title: "Multi-Select with Assets",
|
|
588
588
|
children: /*#__PURE__*/_jsx(MultiSelectWithAssets, {})
|
|
589
589
|
}), /*#__PURE__*/_jsx(Example, {
|
|
590
|
-
title: "
|
|
591
|
-
children: /*#__PURE__*/_jsx(
|
|
590
|
+
title: "Active",
|
|
591
|
+
children: /*#__PURE__*/_jsx(Active, {})
|
|
592
592
|
}), /*#__PURE__*/_jsx(Example, {
|
|
593
593
|
title: "Empty Options",
|
|
594
594
|
children: /*#__PURE__*/_jsx(EmptyOptions, {})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './SelectChip';
|
|
2
|
-
export
|
|
2
|
+
export { SelectChipControl } from './SelectChipControl';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["label", "id", "activeBackground", "activeColor", "color"],
|
|
1
|
+
const _excluded = ["label", "id", "Component", "activeBackground", "activeColor", "color"],
|
|
2
2
|
_excluded2 = ["ref"],
|
|
3
3
|
_excluded3 = ["tabs", "activeTab", "testID", "TabComponent", "onChange", "width", "gap", "compact", "size", "styles", "autoScrollOffset"];
|
|
4
4
|
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); }
|
|
@@ -32,9 +32,9 @@ const DefaultTabComponent = _ref => {
|
|
|
32
32
|
accessibilityState: {
|
|
33
33
|
selected: isActive
|
|
34
34
|
},
|
|
35
|
+
active: isActive && !activeBackground,
|
|
35
36
|
background: isActive && activeBackground ? activeBackground : undefined,
|
|
36
37
|
color: isActive && activeColor ? activeColor : color,
|
|
37
|
-
invertColorScheme: isActive && !activeBackground,
|
|
38
38
|
onPress: handlePress
|
|
39
39
|
}, tabProps, {
|
|
40
40
|
children: label
|
package/esm/chips/Chip.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const _excluded = ["ref"],
|
|
2
|
-
_excluded2 = ["alignSelf", "children", "start", "end", "invertColorScheme", "inverted", "maxWidth", "compact", "size", "gap", "paddingX", "paddingY", "alignItems", "justifyContent", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "styles", "onPress", "color", "font"];
|
|
2
|
+
_excluded2 = ["alignSelf", "children", "start", "end", "active", "activeBackground", "activeColor", "invertColorScheme", "inverted", "maxWidth", "compact", "size", "gap", "paddingX", "paddingY", "alignItems", "justifyContent", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "styles", "onPress", "color", "font"];
|
|
3
3
|
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); }
|
|
4
4
|
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; }
|
|
5
|
-
import React, { Fragment, memo } from 'react';
|
|
5
|
+
import React, { Fragment, memo, useMemo } from 'react';
|
|
6
6
|
import { chipMaxWidth } from '@coinbase/cds-common/tokens/chip';
|
|
7
7
|
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
8
8
|
import { Box } from '../layout/Box';
|
|
@@ -44,6 +44,9 @@ export const Chip = /*#__PURE__*/memo(function Chip(_ref) {
|
|
|
44
44
|
children,
|
|
45
45
|
start,
|
|
46
46
|
end,
|
|
47
|
+
active = false,
|
|
48
|
+
activeBackground,
|
|
49
|
+
activeColor,
|
|
47
50
|
invertColorScheme,
|
|
48
51
|
inverted,
|
|
49
52
|
maxWidth = chipMaxWidth,
|
|
@@ -69,14 +72,20 @@ export const Chip = /*#__PURE__*/memo(function Chip(_ref) {
|
|
|
69
72
|
font = sizeConfig.font
|
|
70
73
|
} = mergedProps,
|
|
71
74
|
props = _objectWithoutPropertiesLoose(mergedProps, _excluded2);
|
|
72
|
-
const
|
|
75
|
+
const hasActiveColorOverrides = activeBackground !== undefined || activeColor !== undefined;
|
|
76
|
+
const activeUsesThemeInversion = active && !hasActiveColorOverrides;
|
|
77
|
+
const shouldInvert = Boolean(invertColorScheme != null ? invertColorScheme : inverted) || activeUsesThemeInversion;
|
|
78
|
+
const WrapperComponent = shouldInvert ? InvertedThemeProvider : Fragment;
|
|
79
|
+
const resolvedBackground = active && activeBackground !== undefined ? activeBackground : background;
|
|
80
|
+
const resolvedColor = active && activeColor !== undefined ? activeColor : color;
|
|
81
|
+
const containerStyle = useMemo(() => [style, styles == null ? void 0 : styles.root], [style, styles == null ? void 0 : styles.root]);
|
|
73
82
|
const containerProps = {
|
|
74
83
|
testID,
|
|
75
|
-
background,
|
|
84
|
+
background: resolvedBackground,
|
|
76
85
|
borderRadius,
|
|
77
86
|
ref,
|
|
78
87
|
alignSelf,
|
|
79
|
-
style:
|
|
88
|
+
style: containerStyle
|
|
80
89
|
};
|
|
81
90
|
const content = /*#__PURE__*/_jsxs(HStack, {
|
|
82
91
|
alignItems: alignItems,
|
|
@@ -93,13 +102,13 @@ export const Chip = /*#__PURE__*/memo(function Chip(_ref) {
|
|
|
93
102
|
style: [contentStyle, styles == null ? void 0 : styles.content],
|
|
94
103
|
testID: testID ? testID + "-content" : undefined,
|
|
95
104
|
children: [start, typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
96
|
-
color:
|
|
105
|
+
color: resolvedColor,
|
|
97
106
|
flexShrink: 1,
|
|
98
107
|
font: font,
|
|
99
108
|
numberOfLines: numberOfLines,
|
|
100
109
|
children: children
|
|
101
110
|
}) : children ? /*#__PURE__*/_jsx(Box, {
|
|
102
|
-
color:
|
|
111
|
+
color: resolvedColor,
|
|
103
112
|
flexShrink: 1,
|
|
104
113
|
children: children
|
|
105
114
|
}) : null, end]
|
package/esm/chips/InputChip.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const _excluded = ["ref"],
|
|
2
|
-
_excluded2 = ["
|
|
2
|
+
_excluded2 = ["active", "invertColorScheme", "inverted"],
|
|
3
|
+
_excluded3 = ["value", "children", "accessibilityLabel", "testID", "active", "invertColorScheme", "inverted"];
|
|
3
4
|
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); }
|
|
4
5
|
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; }
|
|
5
6
|
import React, { memo } from 'react';
|
|
@@ -12,18 +13,33 @@ export const InputChip = /*#__PURE__*/memo(_ref => {
|
|
|
12
13
|
ref
|
|
13
14
|
} = _ref,
|
|
14
15
|
_props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
15
|
-
const
|
|
16
|
+
const {
|
|
17
|
+
active: activeProp,
|
|
18
|
+
invertColorScheme,
|
|
19
|
+
inverted
|
|
20
|
+
} = _props,
|
|
21
|
+
restProps = _objectWithoutPropertiesLoose(_props, _excluded2);
|
|
22
|
+
// Default before component config so state-aware resolvers (active borders) see the
|
|
23
|
+
// same active semantics as the rendered chip.
|
|
24
|
+
const active = activeProp != null ? activeProp : invertColorScheme === undefined && inverted === undefined ? true : false;
|
|
25
|
+
const mergedProps = useComponentConfig('InputChip', _extends({}, restProps, {
|
|
26
|
+
active,
|
|
27
|
+
invertColorScheme,
|
|
28
|
+
inverted
|
|
29
|
+
}));
|
|
16
30
|
const {
|
|
17
31
|
value,
|
|
18
32
|
children = value,
|
|
19
33
|
accessibilityLabel = typeof children === 'string' ? "Remove " + children : 'Remove option',
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
testID = 'input-chip',
|
|
35
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
36
|
+
inverted: mergedInverted
|
|
22
37
|
} = mergedProps,
|
|
23
|
-
props = _objectWithoutPropertiesLoose(mergedProps,
|
|
38
|
+
props = _objectWithoutPropertiesLoose(mergedProps, _excluded3);
|
|
24
39
|
return /*#__PURE__*/_jsx(MediaChip, _extends({
|
|
25
40
|
ref: ref,
|
|
26
41
|
accessibilityLabel: accessibilityLabel,
|
|
42
|
+
active: active,
|
|
27
43
|
end: /*#__PURE__*/_jsx(Icon, {
|
|
28
44
|
active: true,
|
|
29
45
|
color: "fg",
|
|
@@ -31,7 +47,9 @@ export const InputChip = /*#__PURE__*/memo(_ref => {
|
|
|
31
47
|
size: "xs",
|
|
32
48
|
testID: testID ? testID + "-close-icon" : 'input-chip-close-icon'
|
|
33
49
|
}),
|
|
34
|
-
invertColorScheme:
|
|
50
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
51
|
+
inverted: mergedInverted,
|
|
52
|
+
testID: testID
|
|
35
53
|
}, props, {
|
|
36
54
|
children: children
|
|
37
55
|
}));
|
|
@@ -107,9 +107,9 @@ const ChipScreen = () => /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
|
107
107
|
title: "Default",
|
|
108
108
|
children: /*#__PURE__*/_jsx(ChipExamples, {})
|
|
109
109
|
}), /*#__PURE__*/_jsx(Example, {
|
|
110
|
-
title: "
|
|
110
|
+
title: "Active",
|
|
111
111
|
children: /*#__PURE__*/_jsx(ChipExamples, {
|
|
112
|
-
|
|
112
|
+
active: true
|
|
113
113
|
})
|
|
114
114
|
}), /*#__PURE__*/_jsx(Example, {
|
|
115
115
|
title: "Size xs",
|
|
@@ -81,9 +81,9 @@ const MediaChipScreen = () => /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
|
81
81
|
title: "Default (Automatic Spacing)",
|
|
82
82
|
children: /*#__PURE__*/_jsx(MediaChipExamples, {})
|
|
83
83
|
}), /*#__PURE__*/_jsx(Example, {
|
|
84
|
-
title: "
|
|
84
|
+
title: "Active",
|
|
85
85
|
children: /*#__PURE__*/_jsx(MediaChipExamples, {
|
|
86
|
-
|
|
86
|
+
active: true
|
|
87
87
|
})
|
|
88
88
|
}), /*#__PURE__*/_jsx(Example, {
|
|
89
89
|
title: "Compact",
|
|
@@ -99,6 +99,8 @@ const EnabledScrubberProvider = _ref => {
|
|
|
99
99
|
pan.failOffsetX([-15, 15]);
|
|
100
100
|
}
|
|
101
101
|
return pan.onStart(function onStart(event) {
|
|
102
|
+
'worklet';
|
|
103
|
+
|
|
102
104
|
runOnJS(handleStartEndHaptics)();
|
|
103
105
|
|
|
104
106
|
// Android does not trigger onUpdate when the gesture starts. This achieves consistent behavior across both iOS and Android
|
|
@@ -110,15 +112,21 @@ const EnabledScrubberProvider = _ref => {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
}).onUpdate(function onUpdate(event) {
|
|
115
|
+
'worklet';
|
|
116
|
+
|
|
113
117
|
const pointerPosition = categoryAxisIsX ? event.x : event.y;
|
|
114
118
|
const newScrubberPosition = getDataIndexFromPosition(pointerPosition);
|
|
115
119
|
if (newScrubberPosition !== scrubberPosition.value) {
|
|
116
120
|
scrubberPosition.value = newScrubberPosition;
|
|
117
121
|
}
|
|
118
122
|
}).onEnd(function onEnd() {
|
|
123
|
+
'worklet';
|
|
124
|
+
|
|
119
125
|
runOnJS(handleStartEndHaptics)();
|
|
120
126
|
scrubberPosition.value = undefined;
|
|
121
127
|
}).onTouchesCancelled(function onTouchesCancelled() {
|
|
128
|
+
'worklet';
|
|
129
|
+
|
|
122
130
|
scrubberPosition.value = undefined;
|
|
123
131
|
});
|
|
124
132
|
}, [allowOverflowGestures, handleStartEndHaptics, getDataIndexFromPosition, categoryAxisIsX, scrubberPosition]);
|
|
@@ -2,7 +2,7 @@ const _excluded = ["staggerDelay"];
|
|
|
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 { defaultAxisId as fallbackAxisId } from './axis';
|
|
5
|
-
import { evaluateGradientAtValue } from './gradient';
|
|
5
|
+
import { evaluateGradientAtValue, evaluateGradientOpacityAtValue } from './gradient';
|
|
6
6
|
import { defaultTransition } from './transition';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -827,6 +827,7 @@ export function getBars(params) {
|
|
|
827
827
|
const valuePos = Math.min(edgeBottom, edgeTop);
|
|
828
828
|
if (length <= 0) return;
|
|
829
829
|
let barFill = s.color || defaultFill;
|
|
830
|
+
let barFillOpacity = defaultFillOpacity;
|
|
830
831
|
const seriesGradientConfig = seriesGradients.find(g => (g == null ? void 0 : g.seriesId) === s.id);
|
|
831
832
|
if (seriesGradientConfig && originalValue !== null && originalValue !== undefined) {
|
|
832
833
|
var _seriesGradientConfig;
|
|
@@ -841,6 +842,10 @@ export function getBars(params) {
|
|
|
841
842
|
if (evaluatedColor) {
|
|
842
843
|
barFill = evaluatedColor;
|
|
843
844
|
}
|
|
845
|
+
const evaluatedOpacity = evaluateGradientOpacityAtValue(seriesGradientConfig.stops, evalValue, seriesGradientConfig.scale);
|
|
846
|
+
if (evaluatedOpacity !== undefined) {
|
|
847
|
+
barFillOpacity = defaultFillOpacity !== undefined ? defaultFillOpacity * evaluatedOpacity : evaluatedOpacity;
|
|
848
|
+
}
|
|
844
849
|
}
|
|
845
850
|
allBars.push({
|
|
846
851
|
seriesId: s.id,
|
|
@@ -848,6 +853,7 @@ export function getBars(params) {
|
|
|
848
853
|
length,
|
|
849
854
|
dataValue: value,
|
|
850
855
|
fill: barFill,
|
|
856
|
+
fillOpacity: barFillOpacity,
|
|
851
857
|
roundTop,
|
|
852
858
|
roundBottom,
|
|
853
859
|
shouldApplyGap,
|
|
@@ -897,7 +903,7 @@ export function getBars(params) {
|
|
|
897
903
|
dataY: layout === 'vertical' ? bar.dataValue : categoryValue,
|
|
898
904
|
origin: barOrigins[i],
|
|
899
905
|
borderRadius,
|
|
900
|
-
fillOpacity:
|
|
906
|
+
fillOpacity: bar.fillOpacity,
|
|
901
907
|
stroke: defaultStroke,
|
|
902
908
|
strokeWidth: defaultStrokeWidth,
|
|
903
909
|
minSize: initialBarMinSizes[i],
|
|
@@ -90,6 +90,86 @@ export const getColorWithOpacity = (color1, opacity) => {
|
|
|
90
90
|
return "rgba(" + c[0] * 255 + ", " + c[1] * 255 + ", " + c[2] * 255 + ", " + opacity + ")";
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Returns stop indices and blend progress for a data value.
|
|
95
|
+
* When startIndex === endIndex, use that stop directly; otherwise blend with t.
|
|
96
|
+
*/
|
|
97
|
+
const getGradientStopInterpolation = (stops, dataValue, scale) => {
|
|
98
|
+
'worklet';
|
|
99
|
+
|
|
100
|
+
if (stops.length === 0) return;
|
|
101
|
+
|
|
102
|
+
// Determine range based on scale type
|
|
103
|
+
let rangeMin;
|
|
104
|
+
let rangeMax;
|
|
105
|
+
if (isSerializableScale(scale)) {
|
|
106
|
+
// SerializableScale has range as [number, number]
|
|
107
|
+
[rangeMin, rangeMax] = scale.range;
|
|
108
|
+
} else {
|
|
109
|
+
// ChartScaleFunction has range() method
|
|
110
|
+
const scaleRange = scale.range();
|
|
111
|
+
[rangeMin, rangeMax] = Array.isArray(scaleRange) ? scaleRange : [scaleRange, scaleRange]; // fallback for band scales
|
|
112
|
+
}
|
|
113
|
+
const rangeSpan = Math.abs(rangeMax - rangeMin);
|
|
114
|
+
if (rangeSpan === 0) return [0, 0, 0];
|
|
115
|
+
|
|
116
|
+
// Map dataValue through scale to get position
|
|
117
|
+
let dataPosition;
|
|
118
|
+
if (isSerializableScale(scale)) {
|
|
119
|
+
dataPosition = applySerializableScale(dataValue, scale);
|
|
120
|
+
} else {
|
|
121
|
+
const result = scale(dataValue);
|
|
122
|
+
if (result === undefined) return [0, 0, 0];
|
|
123
|
+
dataPosition = result;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Normalize to 0-1 based on range
|
|
127
|
+
const normalizedValue = Math.max(0, Math.min(1, Math.abs(dataPosition - rangeMin) / rangeSpan));
|
|
128
|
+
|
|
129
|
+
// Map stop offsets through scale and normalize to 0-1
|
|
130
|
+
const positions = stops.map(stop => {
|
|
131
|
+
let stopPosition;
|
|
132
|
+
if (isSerializableScale(scale)) {
|
|
133
|
+
stopPosition = applySerializableScale(stop.offset, scale);
|
|
134
|
+
} else {
|
|
135
|
+
const result = scale(stop.offset);
|
|
136
|
+
if (result === undefined) return 0;
|
|
137
|
+
stopPosition = result;
|
|
138
|
+
}
|
|
139
|
+
return Math.max(0, Math.min(1, Math.abs(stopPosition - rangeMin) / rangeSpan));
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Find which segment we're in
|
|
143
|
+
if (normalizedValue < positions[0]) return [0, 0, 0];
|
|
144
|
+
const lastIndex = stops.length - 1;
|
|
145
|
+
if (normalizedValue >= positions[lastIndex]) return [lastIndex, lastIndex, 0];
|
|
146
|
+
|
|
147
|
+
// Check if dataValue matches any stop offset exactly (for hard transitions)
|
|
148
|
+
for (let i = 0; i < stops.length; i++) {
|
|
149
|
+
if (dataValue === stops[i].offset) {
|
|
150
|
+
// Found exact match - check if there are multiple stops at this offset (hard transition)
|
|
151
|
+
// Use the LAST stop at this offset for hard transitions
|
|
152
|
+
let lastIndexAtOffset = i;
|
|
153
|
+
while (lastIndexAtOffset + 1 < stops.length && stops[lastIndexAtOffset + 1].offset === stops[i].offset) {
|
|
154
|
+
lastIndexAtOffset++;
|
|
155
|
+
}
|
|
156
|
+
return [lastIndexAtOffset, lastIndexAtOffset, 0];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Find the segment to interpolate between
|
|
161
|
+
for (let i = 0; i < positions.length - 1; i++) {
|
|
162
|
+
if (normalizedValue >= positions[i] && normalizedValue <= positions[i + 1]) {
|
|
163
|
+
const segmentStart = positions[i];
|
|
164
|
+
const segmentEnd = positions[i + 1];
|
|
165
|
+
if (segmentEnd === segmentStart) return [i, i, 0];
|
|
166
|
+
const t = (normalizedValue - segmentStart) / (segmentEnd - segmentStart);
|
|
167
|
+
return [i, i + 1, t];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return [0, 0, 0];
|
|
171
|
+
};
|
|
172
|
+
|
|
93
173
|
/**
|
|
94
174
|
* Creates a gradient configuration for SVG components.
|
|
95
175
|
* Processes a GradientDefinition into a renderable GradientConfig.
|
|
@@ -157,82 +237,33 @@ export const getGradientConfig = (gradient, xScale, yScale, layout) => {
|
|
|
157
237
|
export const evaluateGradientAtValue = (stops, dataValue, scale) => {
|
|
158
238
|
'worklet';
|
|
159
239
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// SerializableScale has range as [number, number]
|
|
167
|
-
[rangeMin, rangeMax] = scale.range;
|
|
168
|
-
} else {
|
|
169
|
-
// ChartScaleFunction has range() method
|
|
170
|
-
const scaleRange = scale.range();
|
|
171
|
-
[rangeMin, rangeMax] = Array.isArray(scaleRange) ? scaleRange : [scaleRange, scaleRange]; // fallback for band scales
|
|
172
|
-
}
|
|
173
|
-
const rangeSpan = Math.abs(rangeMax - rangeMin);
|
|
174
|
-
if (rangeSpan === 0) return stops[0].color;
|
|
175
|
-
|
|
176
|
-
// Map dataValue through scale to get position
|
|
177
|
-
let dataPosition;
|
|
178
|
-
if (isSerializableScale(scale)) {
|
|
179
|
-
dataPosition = applySerializableScale(dataValue, scale);
|
|
180
|
-
} else {
|
|
181
|
-
const result = scale(dataValue);
|
|
182
|
-
if (result === undefined) return stops[0].color;
|
|
183
|
-
dataPosition = result;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Normalize to 0-1 based on range
|
|
187
|
-
const normalizedValue = Math.max(0, Math.min(1, Math.abs(dataPosition - rangeMin) / rangeSpan));
|
|
188
|
-
|
|
189
|
-
// Map stop offsets through scale and normalize to 0-1
|
|
190
|
-
const positions = stops.map(stop => {
|
|
191
|
-
let stopPosition;
|
|
192
|
-
if (isSerializableScale(scale)) {
|
|
193
|
-
stopPosition = applySerializableScale(stop.offset, scale);
|
|
194
|
-
} else {
|
|
195
|
-
const result = scale(stop.offset);
|
|
196
|
-
if (result === undefined) return 0;
|
|
197
|
-
stopPosition = result;
|
|
198
|
-
}
|
|
199
|
-
return Math.max(0, Math.min(1, Math.abs(stopPosition - rangeMin) / rangeSpan));
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// Find which segment we're in
|
|
203
|
-
if (normalizedValue < positions[0]) {
|
|
204
|
-
return stops[0].color;
|
|
205
|
-
}
|
|
206
|
-
if (normalizedValue >= positions[positions.length - 1]) {
|
|
207
|
-
return stops[stops.length - 1].color;
|
|
208
|
-
}
|
|
240
|
+
const interpolation = getGradientStopInterpolation(stops, dataValue, scale);
|
|
241
|
+
if (!interpolation) return;
|
|
242
|
+
const [startIndex, endIndex, t] = interpolation;
|
|
243
|
+
if (startIndex === endIndex) return stops[startIndex].color;
|
|
244
|
+
return interpolateColor(stops[startIndex].color, stops[endIndex].color, t);
|
|
245
|
+
};
|
|
209
246
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
while (lastIndexAtOffset + 1 < stops.length && stops[lastIndexAtOffset + 1].offset === stops[i].offset) {
|
|
217
|
-
lastIndexAtOffset++;
|
|
218
|
-
}
|
|
219
|
-
return stops[lastIndexAtOffset].color;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
247
|
+
/**
|
|
248
|
+
* Evaluates the opacity at a specific data value based on gradient stops.
|
|
249
|
+
* Returns undefined when no stops define opacity.
|
|
250
|
+
*/
|
|
251
|
+
export const evaluateGradientOpacityAtValue = (stops, dataValue, scale) => {
|
|
252
|
+
'worklet';
|
|
222
253
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return
|
|
254
|
+
var _stops$startIndex$opa, _stops$endIndex$opaci;
|
|
255
|
+
if (stops.length === 0) return;
|
|
256
|
+
if (stops.every(stop => {
|
|
257
|
+
var _stop$opacity2;
|
|
258
|
+
return ((_stop$opacity2 = stop.opacity) != null ? _stop$opacity2 : 1) === 1;
|
|
259
|
+
})) return;
|
|
260
|
+
const interpolation = getGradientStopInterpolation(stops, dataValue, scale);
|
|
261
|
+
if (!interpolation) return;
|
|
262
|
+
const [startIndex, endIndex, t] = interpolation;
|
|
263
|
+
const startOpacity = (_stops$startIndex$opa = stops[startIndex].opacity) != null ? _stops$startIndex$opa : 1;
|
|
264
|
+
if (startIndex === endIndex) return startOpacity;
|
|
265
|
+
const endOpacity = (_stops$endIndex$opaci = stops[endIndex].opacity) != null ? _stops$endIndex$opaci : 1;
|
|
266
|
+
return startOpacity + (endOpacity - startOpacity) * t;
|
|
236
267
|
};
|
|
237
268
|
|
|
238
269
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.17.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -218,9 +218,9 @@
|
|
|
218
218
|
"react-native-worklets": "0.5.2"
|
|
219
219
|
},
|
|
220
220
|
"dependencies": {
|
|
221
|
-
"@coinbase/cds-common": "^9.
|
|
221
|
+
"@coinbase/cds-common": "^9.17.0",
|
|
222
222
|
"@coinbase/cds-icons": "^5.21.0",
|
|
223
|
-
"@coinbase/cds-illustrations": "^4.
|
|
223
|
+
"@coinbase/cds-illustrations": "^4.48.0",
|
|
224
224
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
225
225
|
"@coinbase/cds-utils": "^2.3.5",
|
|
226
226
|
"@floating-ui/react-native": "^0.10.5",
|