@coinbase/cds-web 9.15.0 → 9.16.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 +6 -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 +50 -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.map +1 -1
- package/dts/chips/ChipProps.d.ts +36 -2
- package/dts/chips/ChipProps.d.ts.map +1 -1
- package/dts/chips/InputChip.d.ts.map +1 -1
- package/esm/alpha/select-chip/SelectChip.js +58 -29
- package/esm/alpha/select-chip/SelectChipControl.js +41 -11
- package/esm/alpha/select-chip/index.js +1 -1
- package/esm/alpha/tabbed-chips/TabbedChips.js +3 -2
- package/esm/chips/Chip.js +15 -7
- package/esm/chips/InputChip.js +25 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 9.16.0 (8/13/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Deprecate invertColorScheme in favor of new, canoncical active prop for the Chip family of props. [[#843](https://github.com/coinbase/cds/pull/843)]
|
|
16
|
+
|
|
11
17
|
## 9.15.0 (8/11/2026 PST)
|
|
12
18
|
|
|
13
19
|
#### 🚀 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,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectChip.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/SelectChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,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;AAE7B,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;AAuIJ,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,13 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ChipBaseProps } from '../../chips/ChipProps';
|
|
2
3
|
import { type SelectControlProps, type SelectType } from '../select/types';
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Chip props accepted by {@link SelectChipControl} and forwarded to {@link MediaChip}.
|
|
6
|
+
* Includes selection state, layout, borders, and `displayValue` for the control label.
|
|
7
|
+
*/
|
|
8
|
+
export type SelectChipControlChipProps = Pick<
|
|
9
|
+
ChipBaseProps,
|
|
10
|
+
| 'active'
|
|
11
|
+
| 'activeBackground'
|
|
12
|
+
| 'activeColor'
|
|
13
|
+
| 'background'
|
|
14
|
+
| 'color'
|
|
15
|
+
| 'invertColorScheme'
|
|
16
|
+
| 'inverted'
|
|
17
|
+
| 'numberOfLines'
|
|
18
|
+
| 'maxWidth'
|
|
19
|
+
| 'size'
|
|
20
|
+
| 'compact'
|
|
21
|
+
| 'borderWidth'
|
|
22
|
+
| 'borderColor'
|
|
23
|
+
| 'bordered'
|
|
24
|
+
| 'borderRadius'
|
|
25
|
+
> & {
|
|
26
|
+
/**
|
|
27
|
+
* Override the displayed value in the chip control.
|
|
28
|
+
* Useful for avoiding truncation, especially in multi-select scenarios where multiple option labels might be too long to display.
|
|
29
|
+
* When provided, this value takes precedence over the default label generation.
|
|
30
|
+
*/
|
|
31
|
+
displayValue?: React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* SelectControlProps fields superseded by {@link SelectChipControlChipProps}.
|
|
35
|
+
* Omit is required: intersection would merge overlapping keys (e.g. `size` as SelectSize &
|
|
36
|
+
* ChipSize, `background` as responsive Box vs chip tokens) instead of replacing select-scale
|
|
37
|
+
* 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. */
|
|
4
49
|
export declare const SelectChipControl: <
|
|
5
50
|
Type extends SelectType,
|
|
6
51
|
SelectOptionValue extends string = string,
|
|
7
52
|
>(
|
|
8
|
-
props:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
53
|
+
props: SelectChipControlProps<Type, SelectOptionValue> & {
|
|
54
|
+
ref?: React.Ref<HTMLElement>;
|
|
55
|
+
},
|
|
12
56
|
) => React.ReactElement;
|
|
57
|
+
export {};
|
|
13
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,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectChipControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/SelectChipControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,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;;;;;GAKG;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;AA0K7B,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,WAAW,CAAC,CAAC;CAC9B,KACE,KAAK,CAAC,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alpha/select-chip/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -15,11 +15,14 @@ export type TabbedChipProps<TabId extends string = string> = Omit<
|
|
|
15
15
|
Component?: React.FC<Omit<ChipProps, 'children'> & TabValue<TabId>>;
|
|
16
16
|
/**
|
|
17
17
|
* Custom background color applied to the chip when it is the active tab.
|
|
18
|
-
*
|
|
18
|
+
* Skips color-scheme inversion and paints this token directly. Any `start`,
|
|
19
|
+
* `end`, or custom tab content must set explicit colors to match.
|
|
19
20
|
*/
|
|
20
21
|
activeBackground?: MediaChipBaseProps['background'];
|
|
21
22
|
/**
|
|
22
23
|
* Custom foreground color applied to the chip label when it is the active tab.
|
|
24
|
+
* Skips color-scheme inversion when set. Any `start`, `end`, or custom tab
|
|
25
|
+
* content must set explicit colors to match.
|
|
23
26
|
*/
|
|
24
27
|
activeColor?: MediaChipBaseProps['color'];
|
|
25
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabbedChips.d.ts","sourceRoot":"","sources":["../../../src/alpha/tabbed-chips/Tab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IG;AACH,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/chips/Chip.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAqBpC;;;;GAIG;AACH,eAAO,MAAM,IAAI,4JAiJhB,CAAC"}
|
package/dts/chips/ChipProps.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { ThemeVars } from '@coinbase/cds-common/core/theme';
|
|
1
2
|
import type { SharedAccessibilityProps } from '@coinbase/cds-common/types/SharedAccessibilityProps';
|
|
2
3
|
import type { SharedProps } from '@coinbase/cds-common/types/SharedProps';
|
|
4
|
+
import type { StyleProps } from '../styles/styleProps';
|
|
3
5
|
import type {
|
|
4
6
|
PressableBaseProps,
|
|
5
7
|
PressableDefaultElement,
|
|
@@ -30,18 +32,50 @@ export type ChipBaseProps = SharedProps &
|
|
|
30
32
|
* @default 200
|
|
31
33
|
*/
|
|
32
34
|
maxWidth?: PressableBaseProps['maxWidth'];
|
|
35
|
+
/**
|
|
36
|
+
* When true, emphasizes the Chip with higher contrast by inverting the color
|
|
37
|
+
* scheme for everything rendered inside the Chip — including `background`,
|
|
38
|
+
* `color`, icons, and other token-based colors. Those props are resolved
|
|
39
|
+
* against the opposite color scheme, matching the legacy `invertColorScheme`
|
|
40
|
+
* behavior.
|
|
41
|
+
*
|
|
42
|
+
* Set `activeBackground` and/or `activeColor` to opt out of inversion and
|
|
43
|
+
* paint explicit active colors instead.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
active?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Background color applied when `active` is true. When set, the Chip skips
|
|
49
|
+
* color-scheme inversion and uses this token directly.
|
|
50
|
+
*
|
|
51
|
+
* **Warning:** `start`, `end`, and `children` ReactNodes are not updated
|
|
52
|
+
* automatically — pass explicit `color` props on nested icons and other
|
|
53
|
+
* content so they match the active palette.
|
|
54
|
+
*/
|
|
55
|
+
activeBackground?: ThemeVars.Color;
|
|
56
|
+
/**
|
|
57
|
+
* Foreground color applied when `active` is true. When set, the Chip skips
|
|
58
|
+
* color-scheme inversion and uses this token for string labels.
|
|
59
|
+
*
|
|
60
|
+
* **Warning:** `start`, `end`, and `children` ReactNodes are not updated
|
|
61
|
+
* automatically — pass explicit `color` props on nested icons and other
|
|
62
|
+
* content so they match the active palette.
|
|
63
|
+
*/
|
|
64
|
+
activeColor?: StyleProps['color'];
|
|
33
65
|
/**
|
|
34
66
|
* Invert the foreground and background colors to emphasize the Chip.
|
|
35
67
|
* Depending on your theme, it may be dangerous to use this prop in conjunction with `transparentWhileInactive`.
|
|
36
68
|
* @default false
|
|
37
|
-
* @deprecated Use the
|
|
38
|
-
* @deprecationExpectedRemoval
|
|
69
|
+
* @deprecated Use the `active` prop instead. This will be removed in a future major release.
|
|
70
|
+
* @deprecationExpectedRemoval v11
|
|
39
71
|
*/
|
|
40
72
|
inverted?: boolean;
|
|
41
73
|
/**
|
|
42
74
|
* Invert the foreground and background colors to emphasize the Chip.
|
|
43
75
|
* Depending on your theme, it may be dangerous to use this prop in conjunction with `transparentWhileInactive`.
|
|
44
76
|
* @default false
|
|
77
|
+
* @deprecated Use the `active` prop instead. This will be removed in a future major release.
|
|
78
|
+
* @deprecationExpectedRemoval v11
|
|
45
79
|
*/
|
|
46
80
|
invertColorScheme?: boolean;
|
|
47
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipProps.d.ts","sourceRoot":"","sources":["../../src/chips/ChipProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACv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MAAM,SAAS,GAAG,aAAa,CAAC;AAEtC,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAC7C,SAAS,GAAG;IACV;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputChip.d.ts","sourceRoot":"","sources":["../../src/chips/InputChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAKhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"InputChip.d.ts","sourceRoot":"","sources":["../../src/chips/InputChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAKhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,SAAS,kGA8CrB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const _excluded = ["
|
|
1
|
+
const _excluded = ["active", "invertColorScheme", "inverted", "value"],
|
|
2
|
+
_excluded2 = ["active", "activeBackground", "activeColor", "background", "color", "numberOfLines", "maxWidth", "displayValue", "size", "compact", "borderWidth", "borderColor", "bordered", "borderRadius", "invertColorScheme", "inverted"];
|
|
2
3
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
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; }
|
|
4
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -7,33 +8,22 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
7
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
8
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
10
|
import React, { forwardRef, memo, useMemo } from 'react';
|
|
11
|
+
import { getSelectChipActive } from '@coinbase/cds-common/chips/getSelectChipActive';
|
|
10
12
|
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
11
13
|
import { Select } from '../select/Select';
|
|
12
14
|
import { SelectChipControl } from './SelectChipControl';
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
/**
|
|
15
|
-
* Creates a wrapper component that injects
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* Creates a wrapper component that injects chip-specific props into SelectChipControl.
|
|
18
|
+
* Select only forwards generic control props to `SelectControlComponent`; chip styling
|
|
19
|
+
* and `active` are owned by SelectChip and must be closed over here.
|
|
18
20
|
*/
|
|
19
|
-
function createSelectChipControlWrapper(
|
|
20
|
-
let {
|
|
21
|
-
invertColorScheme,
|
|
22
|
-
numberOfLines,
|
|
23
|
-
maxWidth,
|
|
24
|
-
displayValue,
|
|
25
|
-
size,
|
|
26
|
-
compact
|
|
27
|
-
} = _ref;
|
|
21
|
+
function createSelectChipControlWrapper(chipProps) {
|
|
28
22
|
return /*#__PURE__*/memo(/*#__PURE__*/forwardRef((controlProps, controlRef) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
invertColorScheme: invertColorScheme,
|
|
34
|
-
maxWidth: maxWidth,
|
|
35
|
-
numberOfLines: numberOfLines,
|
|
36
|
-
size: size
|
|
23
|
+
// Chip props are spread last so they win at runtime; the cast bridges overlapping keys
|
|
24
|
+
// (`size`, borders) where SelectControlProps and SelectChipBaseProps use different types.
|
|
25
|
+
return /*#__PURE__*/_jsx(SelectChipControl, _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, controlProps), chipProps)), {}, {
|
|
26
|
+
ref: controlRef
|
|
37
27
|
}));
|
|
38
28
|
}));
|
|
39
29
|
}
|
|
@@ -43,24 +33,63 @@ function createSelectChipControlWrapper(_ref) {
|
|
|
43
33
|
* Supports both single and multi selection via Select's `type` prop.
|
|
44
34
|
*/
|
|
45
35
|
const SelectChipComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
46
|
-
|
|
36
|
+
// Resolve `active` from instance props before config merge so state-aware resolvers
|
|
37
|
+
// (active vs inactive border styling) see the final selection state. `value` and
|
|
38
|
+
// legacy invert props are pulled out with `active` and passed back explicitly because
|
|
39
|
+
// they feed that resolution and must remain available to the config resolver input.
|
|
47
40
|
const {
|
|
41
|
+
active: activeProp,
|
|
48
42
|
invertColorScheme,
|
|
43
|
+
inverted,
|
|
44
|
+
value
|
|
45
|
+
} = _props,
|
|
46
|
+
restProps = _objectWithoutProperties(_props, _excluded);
|
|
47
|
+
const resolvedActive = getSelectChipActive(activeProp, value, invertColorScheme, inverted);
|
|
48
|
+
const mergedProps = useComponentConfig('SelectChip', _objectSpread(_objectSpread({}, restProps), {}, {
|
|
49
|
+
value,
|
|
50
|
+
active: resolvedActive,
|
|
51
|
+
invertColorScheme,
|
|
52
|
+
inverted
|
|
53
|
+
}));
|
|
54
|
+
// SelectChip composes Select + MediaChip; peel chip props off merged props so the rest
|
|
55
|
+
// can flow to `<Select>` without chip-only fields leaking into the select interface.
|
|
56
|
+
const {
|
|
57
|
+
active,
|
|
58
|
+
activeBackground,
|
|
59
|
+
activeColor,
|
|
60
|
+
background,
|
|
61
|
+
color,
|
|
49
62
|
numberOfLines,
|
|
50
63
|
maxWidth,
|
|
51
64
|
displayValue,
|
|
52
65
|
size,
|
|
53
|
-
compact
|
|
66
|
+
compact,
|
|
67
|
+
borderWidth,
|
|
68
|
+
borderColor,
|
|
69
|
+
bordered,
|
|
70
|
+
borderRadius,
|
|
71
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
72
|
+
inverted: mergedInverted
|
|
54
73
|
} = mergedProps,
|
|
55
|
-
|
|
74
|
+
selectProps = _objectWithoutProperties(mergedProps, _excluded2);
|
|
56
75
|
const WrappedSelectChipControl = useMemo(() => createSelectChipControlWrapper({
|
|
57
|
-
|
|
76
|
+
active,
|
|
77
|
+
activeBackground,
|
|
78
|
+
activeColor,
|
|
79
|
+
background,
|
|
80
|
+
color,
|
|
58
81
|
numberOfLines,
|
|
59
82
|
maxWidth,
|
|
60
83
|
displayValue,
|
|
61
84
|
size,
|
|
62
|
-
compact
|
|
63
|
-
|
|
85
|
+
compact,
|
|
86
|
+
borderWidth,
|
|
87
|
+
borderColor,
|
|
88
|
+
bordered,
|
|
89
|
+
borderRadius,
|
|
90
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
91
|
+
inverted: mergedInverted
|
|
92
|
+
}), [active, activeBackground, activeColor, background, color, displayValue, numberOfLines, maxWidth, size, compact, borderWidth, borderColor, bordered, borderRadius, mergedInvertColorScheme, mergedInverted]);
|
|
64
93
|
return /*#__PURE__*/_jsx(Select, _objectSpread({
|
|
65
94
|
ref: ref,
|
|
66
95
|
SelectControlComponent: WrappedSelectChipControl,
|
|
@@ -68,8 +97,8 @@ const SelectChipComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, r
|
|
|
68
97
|
dropdown: {
|
|
69
98
|
width: 'max-content'
|
|
70
99
|
}
|
|
71
|
-
},
|
|
72
|
-
},
|
|
100
|
+
}, selectProps.styles)
|
|
101
|
+
}, selectProps));
|
|
73
102
|
}));
|
|
74
103
|
SelectChipComponent.displayName = 'SelectChip';
|
|
75
104
|
export const SelectChip = SelectChipComponent;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import React, { forwardRef, 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 responsive Box vs chip tokens) instead of replacing select-scale
|
|
16
|
+
* definitions.
|
|
17
|
+
*/
|
|
5
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
19
|
const SelectChipControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
7
20
|
let {
|
|
@@ -20,16 +33,26 @@ const SelectChipControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_r
|
|
|
20
33
|
maxSelectedOptionsToShow = 2,
|
|
21
34
|
hiddenSelectedOptionsLabel = 'more',
|
|
22
35
|
label,
|
|
36
|
+
disabled,
|
|
23
37
|
compact,
|
|
24
38
|
size,
|
|
39
|
+
active,
|
|
40
|
+
activeBackground,
|
|
41
|
+
activeColor,
|
|
42
|
+
background,
|
|
43
|
+
color,
|
|
25
44
|
invertColorScheme,
|
|
45
|
+
inverted,
|
|
26
46
|
numberOfLines,
|
|
27
|
-
disabled,
|
|
28
47
|
maxWidth,
|
|
29
|
-
displayValue
|
|
48
|
+
displayValue,
|
|
49
|
+
borderWidth,
|
|
50
|
+
borderColor,
|
|
51
|
+
bordered,
|
|
52
|
+
borderRadius
|
|
30
53
|
} = _ref;
|
|
31
54
|
const isMultiSelect = type === 'multi';
|
|
32
|
-
const hasValue =
|
|
55
|
+
const hasValue = getSelectChipHasValue(value);
|
|
33
56
|
|
|
34
57
|
// Map of options to their values
|
|
35
58
|
// If multiple options share the same value, the first occurrence wins (matches native HTML select behavior)
|
|
@@ -84,32 +107,36 @@ const SelectChipControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_r
|
|
|
84
107
|
const opt = optionsMap.get(value);
|
|
85
108
|
return (_ref6 = (_ref7 = (_ref8 = (_opt$label2 = opt === null || opt === void 0 ? void 0 : opt.label) !== null && _opt$label2 !== void 0 ? _opt$label2 : opt === null || opt === void 0 ? void 0 : opt.description) !== null && _ref8 !== void 0 ? _ref8 : opt === null || opt === void 0 ? void 0 : opt.value) !== null && _ref7 !== void 0 ? _ref7 : placeholder) !== null && _ref6 !== void 0 ? _ref6 : null;
|
|
86
109
|
}, [hasValue, label, placeholder, displayValue, isMultiSelect, optionsMap, value, maxSelectedOptionsToShow, hiddenSelectedOptionsLabel]);
|
|
110
|
+
const resolvedColor = active && activeColor !== undefined ? activeColor : color;
|
|
87
111
|
const endNode = useMemo(() => {
|
|
112
|
+
// Match Chip's label color. `fg` still inverts with the chip when active uses theme inversion.
|
|
88
113
|
return customEndNode !== null && customEndNode !== void 0 ? customEndNode : /*#__PURE__*/_jsx(AnimatedCaret, {
|
|
89
114
|
active: true,
|
|
90
|
-
color:
|
|
115
|
+
color: resolvedColor !== null && resolvedColor !== void 0 ? resolvedColor : 'fg',
|
|
91
116
|
rotate: open ? 0 : 180,
|
|
92
117
|
size: "xs"
|
|
93
118
|
});
|
|
94
|
-
}, [customEndNode,
|
|
95
|
-
const color = useMemo(() => {
|
|
96
|
-
return hasValue ? 'fgInverse' : 'fg';
|
|
97
|
-
}, [hasValue]);
|
|
98
|
-
const background = useMemo(() => {
|
|
99
|
-
return hasValue ? 'bgInverse' : 'bgSecondary';
|
|
100
|
-
}, [hasValue]);
|
|
119
|
+
}, [customEndNode, open, resolvedColor]);
|
|
101
120
|
return /*#__PURE__*/_jsx(MediaChip, {
|
|
102
121
|
ref: ref,
|
|
103
122
|
noScaleOnPress: true,
|
|
104
123
|
accessibilityLabel: accessibilityLabel,
|
|
124
|
+
active: active,
|
|
125
|
+
activeBackground: activeBackground,
|
|
126
|
+
activeColor: activeColor,
|
|
105
127
|
"aria-haspopup": ariaHaspopup,
|
|
106
128
|
background: background,
|
|
129
|
+
bordered: bordered,
|
|
130
|
+
borderColor: borderColor,
|
|
131
|
+
borderRadius: borderRadius,
|
|
132
|
+
borderWidth: borderWidth,
|
|
107
133
|
className: className,
|
|
108
134
|
color: color,
|
|
109
135
|
compact: compact,
|
|
110
136
|
disabled: disabled,
|
|
111
137
|
end: endNode,
|
|
112
138
|
invertColorScheme: invertColorScheme,
|
|
139
|
+
inverted: inverted,
|
|
113
140
|
maxWidth: maxWidth,
|
|
114
141
|
numberOfLines: numberOfLines,
|
|
115
142
|
onClick: () => setOpen(s => !s),
|
|
@@ -119,4 +146,7 @@ const SelectChipControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_r
|
|
|
119
146
|
children: labelContent
|
|
120
147
|
});
|
|
121
148
|
}));
|
|
149
|
+
SelectChipControlComponent.displayName = 'SelectChipControl';
|
|
150
|
+
|
|
151
|
+
/** Generic memo components need an explicit cast for the public polymorphic signature. */
|
|
122
152
|
export const SelectChipControl = SelectChipControlComponent;
|
|
@@ -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 = ["tabs", "activeTab", "onChange", "TabComponent", "testID", "background", "gap", "previousArrowAccessibilityLabel", "nextArrowAccessibilityLabel", "width", "TabsActiveIndicatorComponent", "disabled", "compact", "size", "styles", "classNames", "autoScrollOffset"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -23,6 +23,7 @@ const DefaultTabComponent = _ref => {
|
|
|
23
23
|
let {
|
|
24
24
|
label = '',
|
|
25
25
|
id,
|
|
26
|
+
Component: _Component,
|
|
26
27
|
activeBackground,
|
|
27
28
|
activeColor,
|
|
28
29
|
color
|
|
@@ -47,10 +48,10 @@ const DefaultTabComponent = _ref => {
|
|
|
47
48
|
}, [isActive]);
|
|
48
49
|
return /*#__PURE__*/_jsx(MediaChip, _objectSpread(_objectSpread({
|
|
49
50
|
ref: chipRef,
|
|
51
|
+
active: isActive && !activeBackground,
|
|
50
52
|
"aria-selected": isActive,
|
|
51
53
|
background: isActive && activeBackground ? activeBackground : undefined,
|
|
52
54
|
color: isActive && activeColor ? activeColor : color,
|
|
53
|
-
invertColorScheme: isActive && !activeBackground,
|
|
54
55
|
onClick: handleClick,
|
|
55
56
|
role: "tab",
|
|
56
57
|
width: "max-content"
|
package/esm/chips/Chip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["as", "alignItems", "width", "height", "compact", "size", "gap", "start", "end", "paddingX", "paddingY", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "justifyContent", "children", "maxWidth", "invertColorScheme", "inverted", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "className", "styles", "classNames", "font", "color", "onClick"];
|
|
1
|
+
const _excluded = ["as", "alignItems", "width", "height", "compact", "size", "gap", "start", "end", "paddingX", "paddingY", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "justifyContent", "children", "maxWidth", "active", "activeBackground", "activeColor", "invertColorScheme", "inverted", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "className", "styles", "classNames", "font", "color", "onClick"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -64,6 +64,9 @@ export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_pro
|
|
|
64
64
|
justifyContent,
|
|
65
65
|
children,
|
|
66
66
|
maxWidth = chipMaxWidth,
|
|
67
|
+
active = false,
|
|
68
|
+
activeBackground,
|
|
69
|
+
activeColor,
|
|
67
70
|
invertColorScheme,
|
|
68
71
|
inverted,
|
|
69
72
|
numberOfLines = 1,
|
|
@@ -80,9 +83,14 @@ export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_pro
|
|
|
80
83
|
onClick
|
|
81
84
|
} = mergedProps,
|
|
82
85
|
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
83
|
-
const
|
|
86
|
+
const hasActiveColorOverrides = activeBackground !== undefined || activeColor !== undefined;
|
|
87
|
+
const activeUsesThemeInversion = active && !hasActiveColorOverrides;
|
|
88
|
+
const shouldInvert = Boolean(invertColorScheme !== null && invertColorScheme !== void 0 ? invertColorScheme : inverted) || activeUsesThemeInversion;
|
|
89
|
+
const WrapperComponent = shouldInvert ? InvertedThemeProvider : Fragment;
|
|
90
|
+
const resolvedBackground = active && activeBackground !== undefined ? activeBackground : background;
|
|
91
|
+
const resolvedColor = active && activeColor !== undefined ? activeColor : color;
|
|
84
92
|
const containerProps = {
|
|
85
|
-
background,
|
|
93
|
+
background: resolvedBackground,
|
|
86
94
|
borderRadius,
|
|
87
95
|
className: cx(transitionCss, className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
88
96
|
style: _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root),
|
|
@@ -107,19 +115,19 @@ export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_pro
|
|
|
107
115
|
paddingY: paddingY,
|
|
108
116
|
style: _objectSpread(_objectSpread({}, contentStyle), styles === null || styles === void 0 ? void 0 : styles.content),
|
|
109
117
|
children: [start, typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
110
|
-
color:
|
|
118
|
+
color: resolvedColor,
|
|
111
119
|
flexShrink: 1,
|
|
112
120
|
font: font,
|
|
113
121
|
numberOfLines: numberOfLines,
|
|
114
122
|
children: children
|
|
115
123
|
}) : children ? /*#__PURE__*/_jsx(Box, {
|
|
116
|
-
color:
|
|
124
|
+
color: resolvedColor,
|
|
117
125
|
flexShrink: 1,
|
|
118
126
|
children: children
|
|
119
127
|
}) : null, end]
|
|
120
128
|
});
|
|
121
|
-
}, [alignItems, classNames === null || classNames === void 0 ? void 0 : classNames.content, gap, justifyContent, maxWidth, padding, paddingBottom, paddingEnd, paddingStart, paddingTop, paddingX, paddingY, contentStyle, styles === null || styles === void 0 ? void 0 : styles.content, start, children,
|
|
122
|
-
return /*#__PURE__*/_jsx(WrapperComponent, _objectSpread(_objectSpread({}, inverted ? {
|
|
129
|
+
}, [alignItems, classNames === null || classNames === void 0 ? void 0 : classNames.content, gap, justifyContent, maxWidth, padding, paddingBottom, paddingEnd, paddingStart, paddingTop, paddingX, paddingY, contentStyle, styles === null || styles === void 0 ? void 0 : styles.content, start, children, resolvedColor, font, numberOfLines, end]);
|
|
130
|
+
return /*#__PURE__*/_jsx(WrapperComponent, _objectSpread(_objectSpread({}, shouldInvert && inverted ? {
|
|
123
131
|
display: 'content'
|
|
124
132
|
} : {}), {}, {
|
|
125
133
|
children: onClick ? /*#__PURE__*/_jsx(Pressable, _objectSpread(_objectSpread(_objectSpread({
|
package/esm/chips/InputChip.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const _excluded = ["
|
|
1
|
+
const _excluded = ["active", "invertColorScheme", "inverted"],
|
|
2
|
+
_excluded2 = ["value", "children", "accessibilityLabel", "testID", "active", "invertColorScheme", "inverted"];
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -12,18 +13,34 @@ import { Icon } from '../icons/Icon';
|
|
|
12
13
|
import { MediaChip } from './MediaChip';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
export const InputChip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
15
|
-
const
|
|
16
|
+
const {
|
|
17
|
+
active: activeProp,
|
|
18
|
+
invertColorScheme,
|
|
19
|
+
inverted
|
|
20
|
+
} = _props,
|
|
21
|
+
restProps = _objectWithoutProperties(_props, _excluded);
|
|
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 !== void 0 ? activeProp : invertColorScheme === undefined && inverted === undefined ? true : false;
|
|
25
|
+
const mergedProps = useComponentConfig('InputChip', _objectSpread(_objectSpread({}, 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 ".concat(children) : 'Remove option',
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
testID = 'input-chip',
|
|
35
|
+
active: _active,
|
|
36
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
37
|
+
inverted: mergedInverted
|
|
22
38
|
} = mergedProps,
|
|
23
|
-
props = _objectWithoutProperties(mergedProps,
|
|
39
|
+
props = _objectWithoutProperties(mergedProps, _excluded2);
|
|
24
40
|
return /*#__PURE__*/_jsx(MediaChip, _objectSpread(_objectSpread({
|
|
25
41
|
ref: ref,
|
|
26
42
|
accessibilityLabel: accessibilityLabel,
|
|
43
|
+
active: active,
|
|
27
44
|
end: /*#__PURE__*/_jsx(Icon, {
|
|
28
45
|
active: true,
|
|
29
46
|
color: "fg",
|
|
@@ -31,7 +48,9 @@ export const InputChip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref)
|
|
|
31
48
|
size: "xs",
|
|
32
49
|
testID: testID ? "".concat(testID, "-close-icon") : 'input-chip-close-icon'
|
|
33
50
|
}),
|
|
34
|
-
invertColorScheme:
|
|
51
|
+
invertColorScheme: mergedInvertColorScheme,
|
|
52
|
+
inverted: mergedInverted,
|
|
53
|
+
testID: testID
|
|
35
54
|
}, props), {}, {
|
|
36
55
|
children: children
|
|
37
56
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.16.0",
|
|
4
4
|
"description": "Coinbase Design System - Web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -227,9 +227,9 @@
|
|
|
227
227
|
"react-dom": "^18.0.0 || ~19.1.2"
|
|
228
228
|
},
|
|
229
229
|
"dependencies": {
|
|
230
|
-
"@coinbase/cds-common": "^9.
|
|
230
|
+
"@coinbase/cds-common": "^9.16.0",
|
|
231
231
|
"@coinbase/cds-icons": "^5.21.0",
|
|
232
|
-
"@coinbase/cds-illustrations": "^4.
|
|
232
|
+
"@coinbase/cds-illustrations": "^4.48.0",
|
|
233
233
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
234
234
|
"@coinbase/cds-utils": "^2.3.5",
|
|
235
235
|
"@floating-ui/react-dom": "^2.1.1",
|