Private
Public Access
1
0
Files
power-apps-codeapps-blog-part2/node_modules/@fluentui/react-dialog/lib/components/DialogActions/useDialogActions.js

30 lines
1.0 KiB
JavaScript

import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
/**
* Create the state required to render DialogActions.
*
* The returned state can be modified with hooks such as useDialogActionsStyles_unstable,
* before being passed to renderDialogActions_unstable.
*
* @param props - props from this instance of DialogActions
* @param ref - reference to root HTMLElement of DialogActions
*/ export const useDialogActions_unstable = (props, ref)=>{
const { position = 'end', fluid = false } = props;
return {
components: {
root: 'div'
},
root: slot.always(getIntrinsicElementProps('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
...props
}), {
elementType: 'div'
}),
position,
fluid
};
};