Skip to content
Open
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
17 changes: 16 additions & 1 deletion docs/guides/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,20 @@ type: example
</InstUISettingsProvider>
```

## API Changes
### Alert

```js
---
type: embed
---
<V12ChangelogTable
removed={[
{name:"boxShadow",note:"now uses sharedTokens.boxShadow.elevation4"},
{name:"contentPadding",note:"split into contentPaddingVertical and contentPaddingHorizontal"}
]}
/>

```

### Breadcrumb

Expand Down Expand Up @@ -367,6 +380,7 @@ type: embed
/>

```

### RadioInput

- Setting `readonly` does not set the low level `<input>` to disabled, but to `readonly`. This also means that the input is still focusable when `readonly`
Expand Down Expand Up @@ -604,6 +618,7 @@ type: embed
/>

```

### RangeInput

```js
Expand Down
20 changes: 11 additions & 9 deletions packages/ui-alerts/src/Alert/__tests__/Alert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import '@testing-library/jest-dom'
import userEvent from '@testing-library/user-event'
import { Alert } from '../index'
import type { AlertProps } from '../props'
import { IconGroupLine } from '@instructure/ui-icons'
import { GroupInstUIIcon } from '@instructure/ui-icons'

describe('<Alert />', () => {
let srdiv: HTMLDivElement | null
Expand Down Expand Up @@ -97,10 +97,10 @@ describe('<Alert />', () => {
NonNullable<AlertProps['variant']>,
string
> = {
error: 'IconNo',
info: 'IconInfoBorderless',
success: 'IconCheckMark',
warning: 'IconWarningBorderless'
error: 'CircleX',
info: 'Info',
success: 'CircleCheck',
warning: 'TriangleAlert'
}

;(
Expand All @@ -115,7 +115,7 @@ describe('<Alert />', () => {
Success: Sample alert text.
</Alert>
)
const icon = container.querySelector('svg[class$="-svgIcon"]')
const icon = container.querySelector('svg[class^="lucide"]')

expect(icon).toHaveAttribute('name', iconComponent)
})
Expand Down Expand Up @@ -167,10 +167,12 @@ describe('<Alert />', () => {
})

it('should render an icon when provided as the `renderIcon` prop', () => {
const { container } = render(<Alert renderCustomIcon={<IconGroupLine />} />)
const icon = container.querySelector('svg[class$="-svgIcon"]')
const { container } = render(
<Alert renderCustomIcon={<GroupInstUIIcon />} />
)
const icon = container.querySelector('svg[class^="lucide"]')

expect(icon).toHaveAttribute('name', 'IconGroup')
expect(icon).toHaveAttribute('name', 'Group')
expect(icon).toBeInTheDocument()
})

Expand Down
21 changes: 10 additions & 11 deletions packages/ui-alerts/src/Alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ import { View } from '@instructure/ui-view'
import type { ViewOwnProps } from '@instructure/ui-view'
import { ScreenReaderContent } from '@instructure/ui-a11y-content'
import {
IconCheckMarkSolid,
IconInfoBorderlessSolid,
IconWarningBorderlessSolid,
IconNoSolid
InfoInstUIIcon,
XCircleInstUIIcon,
CircleCheckInstUIIcon,
TriangleAlertInstUIIcon
} from '@instructure/ui-icons'
import { Transition } from '@instructure/ui-motion'
import { logError as error } from '@instructure/console'
import { withStyleRework as withStyle } from '@instructure/emotion'
import { withStyle } from '@instructure/emotion'

import generateStyle from './styles'
import generateComponentTheme from './theme'

import { allowedProps } from './props'
import type { AlertProps, AlertState } from './props'
Expand All @@ -57,7 +56,7 @@ category: components
---
**/
@withDeterministicId()
@withStyle(generateStyle, generateComponentTheme)
@withStyle(generateStyle)
class Alert extends Component<AlertProps, AlertState> {
static readonly componentId = 'Alert'

Expand Down Expand Up @@ -88,10 +87,10 @@ class Alert extends Component<AlertProps, AlertState> {
srid: string

variantUI = {
error: IconNoSolid,
info: IconInfoBorderlessSolid,
success: IconCheckMarkSolid,
warning: IconWarningBorderlessSolid
error: XCircleInstUIIcon,
info: InfoInstUIIcon,
success: CircleCheckInstUIIcon,
warning: TriangleAlertInstUIIcon
}

ref: Element | null = null
Expand Down
16 changes: 11 additions & 5 deletions packages/ui-alerts/src/Alert/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* SOFTWARE.
*/

import type { AlertTheme } from '@instructure/shared-types'
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
import { boxShadowObjectsToCSSString } from '@instructure/ui-themes'
import type { AlertProps, AlertStyle } from './props'

/**
Expand All @@ -36,8 +37,9 @@ import type { AlertProps, AlertStyle } from './props'
* @return {Object} The final style object, which will be used in the component
*/
const generateStyle = (
componentTheme: AlertTheme,
props: AlertProps
componentTheme: NewComponentTypes['Alert'],
props: AlertProps,
sharedTokens: SharedTokens
): AlertStyle => {
const { variant, hasShadow } = props

Expand Down Expand Up @@ -84,7 +86,11 @@ const generateStyle = (
borderStyle: componentTheme.borderStyle,
borderRadius: componentTheme.borderRadius,
...variantStyles[variant!].alert,
...(hasShadow && { boxShadow: componentTheme.boxShadow })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please put this change into the upgrade guide

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done it.

...(hasShadow && {
boxShadow: boxShadowObjectsToCSSString(
sharedTokens.boxShadow.elevation4
)
})
},
icon: {
color: componentTheme.iconColor,
Expand Down Expand Up @@ -116,7 +122,7 @@ const generateStyle = (
fontFamily: componentTheme.contentFontFamily,
fontWeight: componentTheme.contentFontWeight,
lineHeight: componentTheme.contentLineHeight,
padding: componentTheme.contentPadding
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please put this change into the upgeade guide

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done it

padding: `${componentTheme.contentPaddingVertical} ${componentTheme.contentPaddingHorizontal}`
},
variantScreenReaderLabel: {
position: 'absolute',
Expand Down
90 changes: 0 additions & 90 deletions packages/ui-alerts/src/Alert/theme.ts

This file was deleted.

Loading