@@ -2,11 +2,13 @@ import { cloneElement, forwardRef, isValidElement } from "react";
2
2
import {
3
3
mergeStyles ,
4
4
useDefaultProps ,
5
+ useTheme ,
5
6
type ExtractNames ,
6
7
} from "@hitachivantara/uikit-react-utils" ;
7
8
import {
8
9
getColor ,
9
10
theme ,
11
+ type HvColor ,
10
12
type HvColorAny ,
11
13
type HvSize ,
12
14
} from "@hitachivantara/uikit-styles" ;
@@ -23,6 +25,13 @@ export { staticClasses as tagClasses };
23
25
24
26
export type HvTagClasses = ExtractNames < typeof useClasses > ;
25
27
28
+ const colorMap : Partial < Record < HvColorAny , HvColor > > = {
29
+ positive_20 : "positive" ,
30
+ negative_20 : "negative" ,
31
+ warning_20 : "warning" ,
32
+ neutral_20 : "info" ,
33
+ } ;
34
+
26
35
export interface HvTagProps
27
36
extends Omit <
28
37
HvButtonBaseProps ,
@@ -89,7 +98,7 @@ export const HvTag = forwardRef<
89
98
selected,
90
99
defaultSelected = false ,
91
100
showSelectIcon = selectable ,
92
- color,
101
+ color : colorProp ,
93
102
icon : iconProp ,
94
103
deleteIcon : deleteIconProp ,
95
104
onDelete,
@@ -101,6 +110,7 @@ export const HvTag = forwardRef<
101
110
...others
102
111
} = useDefaultProps ( "HvTag" , props ) ;
103
112
const { classes, cx } = useClasses ( classesProp ) ;
113
+ const { activeTheme } = useTheme ( ) ;
104
114
105
115
const [ isSelected , setIsSelected ] = useControlled (
106
116
selected ,
@@ -113,6 +123,9 @@ export const HvTag = forwardRef<
113
123
onDelete ?.( event ) ;
114
124
} ;
115
125
126
+ const color =
127
+ ( activeTheme ?. name === "pentahoPlus" && colorMap [ colorProp ! ] ) || colorProp ;
128
+
116
129
const tagColor =
117
130
// backwards-compatibility for `type` prop
118
131
( type === "categorical" && theme . alpha ( color || "cat1" , 0.2 ) ) ||
0 commit comments