@@ -20,10 +20,11 @@ export type FlagProps = {
2020 title : string
2121 description : string | JSX . Element
2222 appearance ?: FlagAppearance
23- inverted ?: boolean
23+ type ?: "default" | "inverted" | "pale"
2424 icon ?: JSX . Element
2525 actions ?: FlagActionType [ ]
2626 style ?: CSSProperties
27+ className ?: string
2728 id ?: string
2829 testId ?: string
2930}
@@ -36,7 +37,7 @@ export type FlagActionType = {
3637 testId ?: string | undefined
3738}
3839
39- const defaultStyle = "bg-text text-text-inverse"
40+ const defaultStyle = "bg-neutral-full text-text-inverse"
4041const warningStyle = "bg-warning-bold text-text-inverse"
4142const errorStyle = "bg-danger-bold text-text-inverse"
4243const successStyle = "bg-success-bold text-text-inverse"
@@ -65,11 +66,28 @@ export const FlagInvertedStyles: {
6566 information : informationInvertedStyle ,
6667} as const
6768
68- const defaultIconStyle = "text-text"
69- const warningIconStyle = "text-warning-bold"
70- const errorIconStyle = "text-danger-bold"
71- const successIconStyle = "text-success-bold"
72- const informationIconStyle = "text-information-bold"
69+ const paleDefaultStyle = "bg-neutral text-text border-border"
70+ const paleWarningStyle = "bg-warning text-warning-text border-warning-border"
71+ const paleErrorStyle = "bg-danger text-danger-text border-danger-border"
72+ const paleSuccessStyle = "bg-success text-success-text border-success-border"
73+ const paleInformationStyle =
74+ "bg-information text-information-text border-information-border"
75+
76+ export const FlagPaleStyles : {
77+ [ style in FlagAppearance ] : string
78+ } = {
79+ default : paleDefaultStyle ,
80+ warning : paleWarningStyle ,
81+ error : paleErrorStyle ,
82+ success : paleSuccessStyle ,
83+ information : paleInformationStyle ,
84+ } as const
85+
86+ const defaultIconStyle = "text-icon"
87+ const warningIconStyle = "text-warning-icon"
88+ const errorIconStyle = "text-danger-icon"
89+ const successIconStyle = "text-success-icon"
90+ const informationIconStyle = "text-information-icon"
7391
7492const IconStyles : { [ style in FlagAppearance ] : string } = {
7593 default : defaultIconStyle ,
@@ -80,10 +98,10 @@ const IconStyles: { [style in FlagAppearance]: string } = {
8098} as const
8199
82100const defaultIconInvertedStyle = "text-text"
83- const warningIconInvertedStyle = "text-warning-bold-hovered "
84- const errorIconInvertedStyle = "text-danger-bold-hovered "
85- const successIconInvertedStyle = "text-success-bold-hovered "
86- const informationIconInvertedStyle = "text-information-bold-hovered "
101+ const warningIconInvertedStyle = "text-warning-icon "
102+ const errorIconInvertedStyle = "text-danger-icon "
103+ const successIconInvertedStyle = "text-success-icon "
104+ const informationIconInvertedStyle = "text-information-icon "
87105
88106const IconInvertedStyles : { [ style in FlagAppearance ] : string } = {
89107 default : defaultIconInvertedStyle ,
@@ -95,14 +113,15 @@ const IconInvertedStyles: { [style in FlagAppearance]: string } = {
95113
96114function FlagIcon ( {
97115 appearance = "default" ,
98- invert ,
116+ type ,
99117} : {
100118 appearance ?: FlagAppearance
101- invert : boolean
119+ type : "default" | "inverted" | "pale"
102120} ) {
103- const iconStyle = invert
104- ? IconStyles [ appearance ]
105- : IconInvertedStyles [ appearance ]
121+ const iconStyle =
122+ type === "default" || type === "pale"
123+ ? IconStyles [ appearance ]
124+ : IconInvertedStyles [ appearance ]
106125
107126 switch ( appearance ) {
108127 case "default" : {
@@ -146,18 +165,22 @@ export function Flag({
146165 description,
147166 icon,
148167 appearance = "default" ,
149- inverted = false ,
168+ type = "default" ,
150169 actions,
151170 style,
171+ className,
152172 id,
153173 testId,
154174} : FlagProps ) {
155- const appStyle = inverted
156- ? FlagInvertedStyles [ appearance ]
157- : FlagStyles [ appearance ]
175+ const appStyle =
176+ type === "default"
177+ ? FlagStyles [ appearance ]
178+ : type === "inverted"
179+ ? FlagInvertedStyles [ appearance ]
180+ : FlagPaleStyles [ appearance ]
158181
159182 if ( ! icon ) {
160- icon = < FlagIcon appearance = { appearance } invert = { inverted } />
183+ icon = < FlagIcon appearance = { appearance } type = { type } />
161184 }
162185
163186 return (
@@ -169,8 +192,9 @@ export function Flag({
169192 className = { twMerge (
170193 appStyle ,
171194 `grid gap-4 rounded-sm p-4 shadow-md ${
172- inverted ? "border" : ""
195+ type === " inverted" || type === "pale" ? "border" : ""
173196 } `,
197+ className ,
174198 ) }
175199 id = { id }
176200 data-testid = { testId }
0 commit comments