Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions packages/shared-types/src/ComponentThemeVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1390,15 +1390,18 @@ export type TagTheme = {
}

export type TextTheme = Typography & {
primaryInverseColor: Colors['contrasts']['white1010']
primaryColor: Colors['contrasts']['grey125125']
secondaryColor: Colors['contrasts']['grey4570']
secondaryInverseColor: Colors['contrasts']['grey1111']
brandColor: Colors['contrasts']['blue4570']
dangerColor: Colors['contrasts']['red4570']
successColor: Colors['contrasts']['green4570']
alertColor: Colors['contrasts']['blue4570']
warningColor: Colors['contrasts']['orange5782']
primaryInverseColor: string
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the color properties from specific Colors references to a generic string type could reduce type safety. Consider maintaining the original color type definitions or adding validation to ensure consistency in the color values.

Copilot uses AI. Check for mistakes.
primaryColor: string
secondaryColor: string
secondaryInverseColor: string
brandColor: string
dangerColor: string
successColor: string
alertColor: string
warningColor: string
aiColor: string

aiBackgroundColor: string
paragraphMargin: string | 0
}

Expand Down
35 changes: 18 additions & 17 deletions packages/ui-text/src/Text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ type: example
</div>
```

### Text colors

```js
---
type: example
---
<div>
<Text color="primary">I&#39;m primary text</Text><br/>
<Text color="secondary">I&#39;m secondary text</Text><br/>
<Text color="brand">I&#39;m brand text</Text><br />
<Text color="success">I&#39;m success text</Text><br/>
<Text color="warning">I&#39;m warning text</Text><br />
<Text color="danger">I&#39;m danger text</Text><br />
<Text color="ai-highlight">I&#39;m a highlighted text (by AI)</Text><br />
<Text color="alert">I&#39;m alert text - DEPRECATED - DO NOT USE</Text>
</div>
```

### Font sizes

```js
Expand Down Expand Up @@ -134,23 +152,6 @@ type: example
</div>
```

### Text colors

```js
---
type: example
---
<div>
<Text color="primary">I&#39;m primary text</Text><br/>
<Text color="secondary">I&#39;m secondary text</Text><br/>
<Text color="brand">I&#39;m brand text</Text><br />
<Text color="success">I&#39;m success text</Text><br/>
<Text color="warning">I&#39;m warning text</Text><br />
<Text color="danger">I&#39;m danger text</Text><br />
<Text color="alert">I&#39;m alert text - DEPRECATED - DO NOT USE</Text>
</div>
```

```js
---
type: example
Expand Down
4 changes: 3 additions & 1 deletion packages/ui-text/src/Text/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type TextOwnProps = {
| 'warning'
| 'primary-inverse'
| 'secondary-inverse'
| 'ai-highlight'
/**
* Provides a reference to the underlying HTML element
*/
Expand Down Expand Up @@ -119,7 +120,8 @@ const propTypes: PropValidators<PropKeys> = {
'warning',
'alert',
'primary-inverse',
'secondary-inverse'
'secondary-inverse',
'ai-highlight'
]),
elementRef: PropTypes.func,
fontStyle: PropTypes.oneOf(['italic', 'normal']),
Expand Down
6 changes: 5 additions & 1 deletion packages/ui-text/src/Text/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ const generateStyle = (
brand: { color: componentTheme.brandColor },
danger: { color: componentTheme.dangerColor },
alert: { color: componentTheme.alertColor },
warning: { color: componentTheme.warningColor }
warning: { color: componentTheme.warningColor },
'ai-highlight': {
color: componentTheme.aiColor,
background: componentTheme.aiBackgroundColor
}
}

const wrapStyle = {
Expand Down
3 changes: 3 additions & 0 deletions packages/ui-text/src/Text/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const generateComponentTheme = (theme: Theme): TextTheme => {
successColor: colors?.contrasts?.green5782,
alertColor: colors?.contrasts?.blue5782,
warningColor: colors?.contrasts?.orange5782,
aiColor: colors?.contrasts?.violet5790,

aiBackgroundColor: colors?.contrasts?.violet1212,

paragraphMargin: `${spacing.medium} 0`
}
Expand Down
Loading