Skip to content

Commit

Permalink
chore: add support for sx to components
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack committed Jun 20, 2024
1 parent 9e6ad57 commit 813845c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 38 deletions.
37 changes: 20 additions & 17 deletions packages/react/src/live-region/AriaAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import React, {type ElementType} from 'react'
import {Announce} from './Announce'
import type {SxProp} from '../sx'

export type AriaAlertProps<As extends ElementType> = React.PropsWithChildren<{
/**
* Customize the element type of the rendered container
*/
as?: As
export type AriaAlertProps<As extends ElementType> = React.PropsWithChildren<
{
/**
* Customize the element type of the rendered container
*/
as?: As

/**
* Specify if the content of the element should be announced when this
* component is rendered and is not hidden
* @default true
*/
announceOnShow?: boolean
/**
* Specify if the content of the element should be announced when this
* component is rendered and is not hidden
* @default true
*/
announceOnShow?: boolean

/**
* Specify if the element is hidden
* @default false
*/
hidden?: boolean
}>
/**
* Specify if the element is hidden
* @default false
*/
hidden?: boolean
} & SxProp
>

export function AriaAlert<As extends ElementType>({
announceOnShow = true,
Expand Down
45 changes: 24 additions & 21 deletions packages/react/src/live-region/AriaStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
import React, {type ElementType} from 'react'
import {Announce} from './Announce'
import type {SxProp} from '../sx'

export type AriaStatusProps<As extends ElementType> = React.PropsWithChildren<{
/**
* Customize the element type of the rendered container
*/
as?: As
export type AriaStatusProps<As extends ElementType> = React.PropsWithChildren<
{
/**
* Customize the element type of the rendered container
*/
as?: As

/**
* Specify if the content of the element should be announced when this
* component is rendered and is not hidden
* @default false
*/
announceOnShow?: boolean
/**
* Specify if the content of the element should be announced when this
* component is rendered and is not hidden
* @default false
*/
announceOnShow?: boolean

/**
* Specify if the element is hidden
* @default false
*/
hidden?: boolean
/**
* Specify if the element is hidden
* @default false
*/
hidden?: boolean

/**
* Provide a delay in milliseconds before the announcement is made
*/
delayMs?: number
}>
/**
* Provide a delay in milliseconds before the announcement is made
*/
delayMs?: number
} & SxProp
>

export function AriaStatus<As extends ElementType>({
announceOnShow = false,
Expand Down

0 comments on commit 813845c

Please sign in to comment.