Skip to content

Commit

Permalink
fix(core/form/inputs): rename autofocus > autoFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed May 30, 2023
1 parent 02feb8d commit fb88521
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const DefaultAnnotationComponent = (props: BlockAnnotationProps) => {
boundaryElement={__unstable_boundaryElement}
defaultType="popover"
onClose={onClose}
autofocus={focused}
autoFocus={focused}
referenceElement={__unstable_referenceElement}
schemaType={schemaType}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export const DefaultBlockObjectComponent = (props: BlockProps) => {
boundaryElement={__unstable_boundaryElement}
defaultType="dialog"
onClose={onClose}
autofocus={focused}
autoFocus={focused}
schemaType={schemaType}
referenceElement={__unstable_referenceElement}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export const DefaultInlineObjectComponent = (props: BlockProps) => {
boundaryElement={__unstable_boundaryElement}
defaultType="popover"
onClose={onClose}
autofocus={focused}
autoFocus={focused}
referenceElement={__unstable_referenceElement}
schemaType={schemaType}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ interface DefaultEditDialogProps {
onClose: () => void
title: string | React.ReactNode
width?: ModalWidth
autofocus?: boolean
autoFocus?: boolean
}

export function DefaultEditDialog(props: DefaultEditDialogProps) {
const {onClose, children, title, width = 1, autofocus} = props
const {onClose, children, title, width = 1, autoFocus} = props
const dialogId = useId()
// This seems to work with regular refs as well, but it might be safer to use state.
const [contentElement, setContentElement] = useState<HTMLDivElement | null>(null)
Expand All @@ -27,7 +27,7 @@ export function DefaultEditDialog(props: DefaultEditDialogProps) {
portal="default"
width={width}
contentRef={setContentElement}
__unstable_autoFocus={autofocus}
__unstable_autoFocus={autoFocus}
>
<PresenceOverlay margins={[0, 0, 1, 0]}>
<VirtualizerScrollInstanceProvider scrollElement={contentElement}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import {DefaultEditDialog} from './DialogModal'
import {PopoverEditDialog} from './PopoverModal'

export function ObjectEditModal(props: {
autofocus?: boolean
autoFocus?: boolean
boundaryElement: HTMLElement | undefined
children: React.ReactNode
defaultType: 'dialog' | 'popover'
onClose: () => void
referenceElement: HTMLElement | undefined
schemaType: ObjectSchemaType
}) {
const {onClose, defaultType, referenceElement, boundaryElement, schemaType, autofocus} = props
const {onClose, defaultType, referenceElement, boundaryElement, schemaType, autoFocus} = props

const schemaModalOption = useMemo(() => _getModalOption(schemaType), [schemaType])
const modalType = schemaModalOption?.type || defaultType
Expand All @@ -29,7 +29,7 @@ export function ObjectEditModal(props: {
if (modalType === 'popover') {
return (
<PopoverEditDialog
autofocus={autofocus}
autoFocus={autoFocus}
boundaryElement={boundaryElement}
onClose={handleClose}
referenceElement={referenceElement}
Expand All @@ -46,7 +46,7 @@ export function ObjectEditModal(props: {
onClose={handleClose}
title={modalTitle}
width={modalWidth}
autofocus={autofocus}
autoFocus={autoFocus}
>
{props.children}
</DefaultEditDialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './PopoverModal.styles'

interface PopoverEditDialogProps {
autofocus?: boolean
autoFocus?: boolean
boundaryElement?: PortableTextEditorElement
children: React.ReactNode
onClose: () => void
Expand Down Expand Up @@ -53,7 +53,7 @@ export function PopoverEditDialog(props: PopoverEditDialogProps) {
}

function Content(props: PopoverEditDialogProps) {
const {onClose, referenceElement, width = 0, title, boundaryElement, autofocus} = props
const {onClose, referenceElement, width = 0, title, boundaryElement, autoFocus} = props

useGlobalKeyDown(
useCallback(
Expand Down Expand Up @@ -82,7 +82,7 @@ function Content(props: PopoverEditDialogProps) {
</Box>

<Button
autoFocus={Boolean(autofocus)}
autoFocus={Boolean(autoFocus)}
icon={CloseIcon}
mode="bleed"
onClick={onClose}
Expand Down

0 comments on commit fb88521

Please sign in to comment.