@fluentui/react-dialog 9.0.0-beta.7 → 9.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +189 -5
- package/CHANGELOG.md +44 -6
- package/Spec.md +44 -25
- package/dist/index.d.ts +99 -55
- package/lib/Dialog.js.map +1 -1
- package/lib/DialogActions.js.map +1 -1
- package/lib/DialogBody.js.map +1 -1
- package/lib/DialogContent.js +2 -0
- package/lib/DialogContent.js.map +1 -0
- package/lib/DialogSurface.js.map +1 -1
- package/lib/DialogTitle.js.map +1 -1
- package/lib/DialogTrigger.js.map +1 -1
- package/lib/components/Dialog/Dialog.js +0 -2
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/index.js +0 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/Dialog/renderDialog.js +2 -10
- package/lib/components/Dialog/renderDialog.js.map +1 -1
- package/lib/components/Dialog/useDialog.js +19 -129
- package/lib/components/Dialog/useDialog.js.map +1 -1
- package/lib/components/Dialog/useDialogContextValues.js +4 -4
- package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib/components/DialogActions/DialogActions.js.map +1 -1
- package/lib/components/DialogActions/DialogActions.types.js.map +1 -1
- package/lib/components/DialogActions/index.js.map +1 -1
- package/lib/components/DialogActions/renderDialogActions.js.map +1 -1
- package/lib/components/DialogActions/useDialogActions.js.map +1 -1
- package/lib/components/DialogActions/useDialogActionsStyles.js +3 -5
- package/lib/components/DialogActions/useDialogActionsStyles.js.map +1 -1
- package/lib/components/DialogBody/DialogBody.js.map +1 -1
- package/lib/components/DialogBody/DialogBody.types.js.map +1 -1
- package/lib/components/DialogBody/index.js.map +1 -1
- package/lib/components/DialogBody/renderDialogBody.js.map +1 -1
- package/lib/components/DialogBody/useDialogBody.js.map +1 -1
- package/lib/components/DialogBody/useDialogBodyStyles.js +5 -5
- package/lib/components/DialogBody/useDialogBodyStyles.js.map +1 -1
- package/lib/components/DialogContent/DialogContent.js +15 -0
- package/lib/components/DialogContent/DialogContent.js.map +1 -0
- package/lib/components/DialogContent/DialogContent.types.js +2 -0
- package/lib/components/DialogContent/DialogContent.types.js.map +1 -0
- package/lib/components/DialogContent/index.js +6 -0
- package/lib/components/DialogContent/index.js.map +1 -0
- package/lib/components/DialogContent/renderDialogContent.js +16 -0
- package/lib/components/DialogContent/renderDialogContent.js.map +1 -0
- package/lib/components/DialogContent/useDialogContent.js +27 -0
- package/lib/components/DialogContent/useDialogContent.js.map +1 -0
- package/lib/components/DialogContent/useDialogContentStyles.js +26 -0
- package/lib/components/DialogContent/useDialogContentStyles.js.map +1 -0
- package/lib/components/DialogSurface/DialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/DialogSurface.types.js.map +1 -1
- package/lib/components/DialogSurface/index.js.map +1 -1
- package/lib/components/DialogSurface/renderDialogSurface.js +4 -2
- package/lib/components/DialogSurface/renderDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurface.js +120 -21
- package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
- package/lib/components/DialogSurface/useDialogSurfaceStyles.js +57 -7
- package/lib/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
- package/lib/components/DialogTitle/DialogTitle.js +2 -3
- package/lib/components/DialogTitle/DialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/DialogTitle.types.js.map +1 -1
- package/lib/components/DialogTitle/index.js.map +1 -1
- package/lib/components/DialogTitle/renderDialogTitle.js +2 -5
- package/lib/components/DialogTitle/renderDialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitle.js +15 -9
- package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib/components/DialogTitle/useDialogTitleStyles.js +61 -54
- package/lib/components/DialogTitle/useDialogTitleStyles.js.map +1 -1
- package/lib/components/DialogTrigger/DialogTrigger.js.map +1 -1
- package/lib/components/DialogTrigger/DialogTrigger.types.js.map +1 -1
- package/lib/components/DialogTrigger/index.js.map +1 -1
- package/lib/components/DialogTrigger/renderDialogTrigger.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +3 -22
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/contexts/constants.js +1 -1
- package/lib/contexts/constants.js.map +1 -1
- package/lib/contexts/dialogContext.js +2 -4
- package/lib/contexts/dialogContext.js.map +1 -1
- package/lib/contexts/dialogSurfaceContext.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +4 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isEscapeKeyDown.js +5 -4
- package/lib/utils/isEscapeKeyDown.js.map +1 -1
- package/lib/utils/isHTMLDialogElement.js +4 -0
- package/lib/utils/isHTMLDialogElement.js.map +1 -0
- package/lib/utils/useControlNativeDialogOpenState.js +20 -0
- package/lib/utils/useControlNativeDialogOpenState.js.map +1 -0
- package/lib/utils/useDisableBodyScroll.js +60 -0
- package/lib/utils/useDisableBodyScroll.js.map +1 -0
- package/lib/utils/useFocusFirstElement.js +41 -0
- package/lib/utils/useFocusFirstElement.js.map +1 -0
- package/lib-commonjs/Dialog.js.map +1 -1
- package/lib-commonjs/DialogActions.js.map +1 -1
- package/lib-commonjs/DialogBody.js.map +1 -1
- package/lib-commonjs/DialogContent.js +10 -0
- package/lib-commonjs/DialogContent.js.map +1 -0
- package/lib-commonjs/DialogSurface.js.map +1 -1
- package/lib-commonjs/DialogTitle.js.map +1 -1
- package/lib-commonjs/DialogTrigger.js.map +1 -1
- package/lib-commonjs/components/Dialog/Dialog.js +0 -3
- package/lib-commonjs/components/Dialog/Dialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/index.js +0 -2
- package/lib-commonjs/components/Dialog/index.js.map +1 -1
- package/lib-commonjs/components/Dialog/renderDialog.js +2 -12
- package/lib-commonjs/components/Dialog/renderDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialog.js +18 -128
- package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
- package/lib-commonjs/components/Dialog/useDialogContextValues.js +4 -4
- package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogActions/DialogActions.js.map +1 -1
- package/lib-commonjs/components/DialogActions/index.js.map +1 -1
- package/lib-commonjs/components/DialogActions/renderDialogActions.js.map +1 -1
- package/lib-commonjs/components/DialogActions/useDialogActions.js.map +1 -1
- package/lib-commonjs/components/DialogActions/useDialogActionsStyles.js +3 -6
- package/lib-commonjs/components/DialogActions/useDialogActionsStyles.js.map +1 -1
- package/lib-commonjs/components/DialogBody/DialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/index.js.map +1 -1
- package/lib-commonjs/components/DialogBody/renderDialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/useDialogBody.js.map +1 -1
- package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js +4 -5
- package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js.map +1 -1
- package/lib-commonjs/components/DialogContent/DialogContent.js +26 -0
- package/lib-commonjs/components/DialogContent/DialogContent.js.map +1 -0
- package/lib-commonjs/components/DialogContent/DialogContent.types.js +6 -0
- package/lib-commonjs/components/DialogContent/DialogContent.types.js.map +1 -0
- package/lib-commonjs/components/DialogContent/index.js +18 -0
- package/lib-commonjs/components/DialogContent/index.js.map +1 -0
- package/lib-commonjs/components/DialogContent/renderDialogContent.js +27 -0
- package/lib-commonjs/components/DialogContent/renderDialogContent.js.map +1 -0
- package/lib-commonjs/components/DialogContent/useDialogContent.js +37 -0
- package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -0
- package/lib-commonjs/components/DialogContent/useDialogContentStyles.js +36 -0
- package/lib-commonjs/components/DialogContent/useDialogContentStyles.js.map +1 -0
- package/lib-commonjs/components/DialogSurface/DialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/index.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/renderDialogSurface.js +5 -2
- package/lib-commonjs/components/DialogSurface/renderDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js +120 -21
- package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceContextValues.js.map +1 -1
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js +57 -6
- package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/DialogTitle.js +2 -3
- package/lib-commonjs/components/DialogTitle/DialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/index.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/renderDialogTitle.js +2 -6
- package/lib-commonjs/components/DialogTitle/renderDialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js +18 -10
- package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js +62 -56
- package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/DialogTrigger.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/index.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/renderDialogTrigger.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +4 -24
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/contexts/constants.js +2 -2
- package/lib-commonjs/contexts/constants.js.map +1 -1
- package/lib-commonjs/contexts/dialogContext.js +2 -4
- package/lib-commonjs/contexts/dialogContext.js.map +1 -1
- package/lib-commonjs/contexts/dialogSurfaceContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/index.js +34 -13
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +5 -3
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isEscapeKeyDown.js +5 -4
- package/lib-commonjs/utils/isEscapeKeyDown.js.map +1 -1
- package/lib-commonjs/utils/isHTMLDialogElement.js +13 -0
- package/lib-commonjs/utils/isHTMLDialogElement.js.map +1 -0
- package/lib-commonjs/utils/useControlNativeDialogOpenState.js +31 -0
- package/lib-commonjs/utils/useControlNativeDialogOpenState.js.map +1 -0
- package/lib-commonjs/utils/useDisableBodyScroll.js +73 -0
- package/lib-commonjs/utils/useDisableBodyScroll.js.map +1 -0
- package/lib-commonjs/utils/useFocusFirstElement.js +54 -0
- package/lib-commonjs/utils/useFocusFirstElement.js.map +1 -0
- package/package.json +15 -16
- package/dist/tsdoc-metadata.json +0 -11
- package/lib/components/Dialog/useDialogStyles.js +0 -41
- package/lib/components/Dialog/useDialogStyles.js.map +0 -1
- package/lib/utils/isTargetDisabled.js +0 -14
- package/lib/utils/isTargetDisabled.js.map +0 -1
- package/lib/utils/localShorthands.js +0 -9
- package/lib/utils/localShorthands.js.map +0 -1
- package/lib/utils/normalizeDefaultPrevented.js +0 -11
- package/lib/utils/normalizeDefaultPrevented.js.map +0 -1
- package/lib-commonjs/components/Dialog/useDialogStyles.js +0 -53
- package/lib-commonjs/components/Dialog/useDialogStyles.js.map +0 -1
- package/lib-commonjs/utils/isTargetDisabled.js +0 -23
- package/lib-commonjs/utils/isTargetDisabled.js.map +0 -1
- package/lib-commonjs/utils/localShorthands.js +0 -18
- package/lib-commonjs/utils/localShorthands.js.map +0 -1
- package/lib-commonjs/utils/normalizeDefaultPrevented.js +0 -20
- package/lib-commonjs/utils/normalizeDefaultPrevented.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogContent/useDialogContentStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAIa,OAAA,CAAA,uBAAA,GAA8D;EACzE,IAAI,EAAE,mBADmE,CAEzE;EACA;;AAHyE,CAA9D;AAMb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;AAAA,MAAlB;AAQA;;AAEG;;;AACI,MAAM,+BAA+B,GAAI,KAAD,IAAkD;EAC/F,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,uBAAA,CAAwB,IAArC,EAA2C,MAAM,CAAC,IAAlD,EAAwD,KAAK,CAAC,IAAN,CAAW,SAAnE,CAAvB,CAF+F,CAI/F;EACA;;EAEA,OAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport type { DialogContentSlots, DialogContentState } from './DialogContent.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const dialogContentClassNames: SlotClassNames<DialogContentSlots> = {\n root: 'fui-DialogContent',\n // TODO: add class names for all slots on DialogContentSlots.\n // Should be of the form `<slotName>: 'fui-DialogContent__<slotName>`\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n // TODO Add default styles for the root element\n },\n\n // TODO add additional classes for different states and/or slots\n});\n\n/**\n * Apply styling to the DialogContent slots based on the state\n */\nexport const useDialogContentStyles_unstable = (state: DialogContentState): DialogContentState => {\n const styles = useStyles();\n state.root.className = mergeClasses(dialogContentClassNames.root, styles.root, state.root.className);\n\n // TODO Add class names to slots, for example:\n // state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogSurface/DialogSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AAGA,MAAA,+BAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;AAEA;;;AAGG;;;AACU,OAAA,CAAA,aAAA,gBAAyD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,kBAAA,CAAA,yBAAA,CAA0B,KAA1B,EAAiC,GAAjC,CAAd;EACA,MAAM,aAAa,GAAG,+BAAA,CAAA,sCAAA,CAAuC,KAAvC,CAAtB;EAEA,wBAAA,CAAA,+BAAA,CAAgC,KAAhC;EACA,OAAO,qBAAA,CAAA,4BAAA,CAA6B,KAA7B,EAAoC,aAApC,CAAP;AACD,CANqE,CAAzD;AAQb,OAAA,CAAA,aAAA,CAAc,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { useDialogSurface_unstable } from './useDialogSurface';\nimport { renderDialogSurface_unstable } from './renderDialogSurface';\nimport { useDialogSurfaceStyles_unstable } from './useDialogSurfaceStyles';\nimport type { DialogSurfaceProps } from './DialogSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useDialogSurfaceContextValues_unstable } from './useDialogSurfaceContextValues';\n\n/**\n * DialogSurface component represents the visual part of a `Dialog` as a whole,\n * it contains everything that should be visible.\n */\nexport const DialogSurface: ForwardRefComponent<DialogSurfaceProps> = React.forwardRef((props, ref) => {\n const state = useDialogSurface_unstable(props, ref);\n const contextValues = useDialogSurfaceContextValues_unstable(state);\n\n useDialogSurfaceStyles_unstable(state);\n return renderDialogSurface_unstable(state, contextValues);\n});\n\nDialogSurface.displayName = 'DialogSurface';\n"],"sourceRoot":"../src/"}
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/DialogSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AAGA,MAAA,+BAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;AAEA;;;AAGG;;;AACU,OAAA,CAAA,aAAA,gBAAyD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,kBAAA,CAAA,yBAAA,CAA0B,KAA1B,EAAiC,GAAjC,CAAd;EACA,MAAM,aAAa,GAAG,+BAAA,CAAA,sCAAA,CAAuC,KAAvC,CAAtB;EAEA,wBAAA,CAAA,+BAAA,CAAgC,KAAhC;EACA,OAAO,qBAAA,CAAA,4BAAA,CAA6B,KAA7B,EAAoC,aAApC,CAAP;AACD,CANqE,CAAzD;AAQb,OAAA,CAAA,aAAA,CAAc,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { useDialogSurface_unstable } from './useDialogSurface';\nimport { renderDialogSurface_unstable } from './renderDialogSurface';\nimport { useDialogSurfaceStyles_unstable } from './useDialogSurfaceStyles';\nimport type { DialogSurfaceProps } from './DialogSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useDialogSurfaceContextValues_unstable } from './useDialogSurfaceContextValues';\n\n/**\n * DialogSurface component represents the visual part of a `Dialog` as a whole,\n * it contains everything that should be visible.\n */\nexport const DialogSurface: ForwardRefComponent<DialogSurfaceProps> = React.forwardRef((props, ref) => {\n const state = useDialogSurface_unstable(props, ref);\n const contextValues = useDialogSurfaceContextValues_unstable(state);\n\n useDialogSurfaceStyles_unstable(state);\n return renderDialogSurface_unstable(state, contextValues);\n});\n\nDialogSurface.displayName = 'DialogSurface';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogSurface/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './DialogSurface';\nexport * from './DialogSurface.types';\nexport * from './renderDialogSurface';\nexport * from './useDialogSurface';\nexport * from './useDialogSurfaceStyles';\n"],"sourceRoot":"../src/"}
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './DialogSurface';\nexport * from './DialogSurface.types';\nexport * from './renderDialogSurface';\nexport * from './useDialogSurface';\nexport * from './useDialogSurfaceStyles';\n"],"sourceRoot":"../src/"}
|
|
@@ -10,6 +10,8 @@ const React = /*#__PURE__*/require("react");
|
|
|
10
10
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
11
|
|
|
12
12
|
const contexts_1 = /*#__PURE__*/require("../../contexts");
|
|
13
|
+
|
|
14
|
+
const react_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
|
|
13
15
|
/**
|
|
14
16
|
* Render the final JSX of DialogSurface
|
|
15
17
|
*/
|
|
@@ -20,10 +22,11 @@ const renderDialogSurface_unstable = (state, contextValues) => {
|
|
|
20
22
|
slots,
|
|
21
23
|
slotProps
|
|
22
24
|
} = react_utilities_1.getSlots(state);
|
|
23
|
-
return React.createElement(
|
|
25
|
+
return React.createElement(react_portal_1.Portal, null, slots.backdrop && React.createElement(slots.backdrop, { ...slotProps.backdrop
|
|
26
|
+
}), React.createElement(contexts_1.DialogSurfaceProvider, {
|
|
24
27
|
value: contextValues.dialogSurface
|
|
25
28
|
}, React.createElement(slots.root, { ...slotProps.root
|
|
26
|
-
}));
|
|
29
|
+
})));
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
exports.renderDialogSurface_unstable = renderDialogSurface_unstable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogSurface/renderDialogSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,4BAA4B,GAAG,CAAC,KAAD,EAA4B,aAA5B,KAAyE;EACnH,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAA6B,KAA7B,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,UAAA,CAAA,qBAAD,EAAsB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAtB,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADF,CADF;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/renderDialogSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,UAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,4BAA4B,GAAG,CAAC,KAAD,EAA4B,aAA5B,KAAyE;EACnH,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAA6B,KAA7B,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,MAAD,EAAO,IAAP,EACG,KAAK,CAAC,QAAN,IAAkB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;EAAf,CAAf,CADrB,EAEE,KAAA,CAAA,aAAA,CAAC,UAAA,CAAA,qBAAD,EAAsB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAtB,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADF,CAFF,CADF;AAQD,CAXM;;AAAM,OAAA,CAAA,4BAAA,GAA4B,4BAA5B","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DialogSurfaceState, DialogSurfaceSlots, DialogSurfaceContextValues } from './DialogSurface.types';\nimport { DialogSurfaceProvider } from '../../contexts';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of DialogSurface\n */\nexport const renderDialogSurface_unstable = (state: DialogSurfaceState, contextValues: DialogSurfaceContextValues) => {\n const { slots, slotProps } = getSlots<DialogSurfaceSlots>(state);\n\n return (\n <Portal>\n {slots.backdrop && <slots.backdrop {...slotProps.backdrop} />}\n <DialogSurfaceProvider value={contextValues.dialogSurface}>\n <slots.root {...slotProps.root} />\n </DialogSurfaceProvider>\n </Portal>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -7,11 +7,11 @@ exports.useDialogSurface_unstable = void 0;
|
|
|
7
7
|
|
|
8
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
9
|
|
|
10
|
-
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
11
|
-
|
|
12
10
|
const contexts_1 = /*#__PURE__*/require("../../contexts");
|
|
13
11
|
|
|
14
12
|
const utils_1 = /*#__PURE__*/require("../../utils");
|
|
13
|
+
|
|
14
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
15
15
|
/**
|
|
16
16
|
* Create the state required to render DialogSurface.
|
|
17
17
|
*
|
|
@@ -24,20 +24,98 @@ const utils_1 = /*#__PURE__*/require("../../utils");
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
const useDialogSurface_unstable = (props, ref) => {
|
|
27
|
-
const modalType = contexts_1.useDialogContext_unstable(ctx => ctx.modalType);
|
|
28
27
|
const {
|
|
29
|
-
|
|
28
|
+
backdrop,
|
|
29
|
+
as
|
|
30
30
|
} = props;
|
|
31
|
-
const
|
|
31
|
+
const isNativeDialog = as === 'dialog' || as === undefined;
|
|
32
|
+
const modalType = contexts_1.useDialogContext_unstable(ctx => ctx.modalType);
|
|
33
|
+
const dialogRef = contexts_1.useDialogContext_unstable(ctx => ctx.dialogRef);
|
|
34
|
+
const open = contexts_1.useDialogContext_unstable(ctx => ctx.open);
|
|
35
|
+
const requestOpenChange = contexts_1.useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
32
36
|
const dialogTitleID = contexts_1.useDialogContext_unstable(ctx => ctx.dialogTitleID);
|
|
33
37
|
const dialogBodyID = contexts_1.useDialogContext_unstable(ctx => ctx.dialogBodyID);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const handleNativeClick = react_utilities_1.useEventCallback(event => {
|
|
39
|
+
var _a;
|
|
40
|
+
|
|
41
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
42
|
+
|
|
43
|
+
if (modalType === 'alert' || event.target !== event.currentTarget) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
clientX,
|
|
49
|
+
clientY
|
|
50
|
+
} = event;
|
|
51
|
+
const {
|
|
52
|
+
top,
|
|
53
|
+
left,
|
|
54
|
+
width,
|
|
55
|
+
height
|
|
56
|
+
} = event.currentTarget.getBoundingClientRect();
|
|
57
|
+
const isBackdropClick = top > clientY || clientY > top + height || left > clientX || clientX > left + width;
|
|
58
|
+
|
|
59
|
+
if (isBackdropClick) {
|
|
60
|
+
requestOpenChange({
|
|
61
|
+
event,
|
|
62
|
+
open: false,
|
|
63
|
+
type: 'backdropClick'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const handleNativeCancel = react_utilities_1.useEventCallback(event => {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
|
|
70
|
+
(_b = (_a = props).onCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
71
|
+
|
|
72
|
+
if (event.currentTarget !== event.target) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (modalType !== 'alert') {
|
|
77
|
+
requestOpenChange({
|
|
78
|
+
event,
|
|
79
|
+
open: false,
|
|
80
|
+
type: 'dialogCancel'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
event.preventDefault();
|
|
39
85
|
});
|
|
40
|
-
const
|
|
86
|
+
const handleNativeClose = react_utilities_1.useEventCallback(event => {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
|
|
89
|
+
(_b = (_a = props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a, event); // Ensure dialog remains open if force closed by close event
|
|
90
|
+
|
|
91
|
+
if (event.currentTarget.open !== open) {
|
|
92
|
+
if (open) {
|
|
93
|
+
if (modalType === 'non-modal') {
|
|
94
|
+
event.currentTarget.show();
|
|
95
|
+
} else {
|
|
96
|
+
event.currentTarget.showModal();
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
event.currentTarget.close();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const handledBackdropClick = react_utilities_1.useEventCallback(event => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
|
|
106
|
+
if (react_utilities_1.isResolvedShorthand(props.backdrop)) {
|
|
107
|
+
(_b = (_a = props.backdrop).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (modalType === 'modal' && !event.isDefaultPrevented()) {
|
|
111
|
+
requestOpenChange({
|
|
112
|
+
event,
|
|
113
|
+
open: false,
|
|
114
|
+
type: 'backdropClick'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const handleKeyDown = react_utilities_1.useEventCallback(event => {
|
|
41
119
|
var _a;
|
|
42
120
|
|
|
43
121
|
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
@@ -47,23 +125,44 @@ const useDialogSurface_unstable = (props, ref) => {
|
|
|
47
125
|
event,
|
|
48
126
|
open: false,
|
|
49
127
|
type: 'escapeKeyDown'
|
|
50
|
-
});
|
|
51
|
-
|
|
128
|
+
}); // stop propagation to avoid conflicting with other elements that listen for `Escape`
|
|
129
|
+
// e,g: nested Dialog, Popover, Menu and Tooltip
|
|
130
|
+
|
|
131
|
+
event.stopPropagation();
|
|
52
132
|
}
|
|
53
133
|
});
|
|
134
|
+
const {
|
|
135
|
+
modalAttributes
|
|
136
|
+
} = react_tabster_1.useModalAttributes({
|
|
137
|
+
trapFocus: modalType !== 'non-modal'
|
|
138
|
+
});
|
|
54
139
|
return {
|
|
55
140
|
components: {
|
|
56
|
-
|
|
141
|
+
backdrop: 'div',
|
|
142
|
+
root: 'dialog'
|
|
57
143
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
144
|
+
backdrop: react_utilities_1.resolveShorthand(backdrop, {
|
|
145
|
+
required: !isNativeDialog && open && modalType !== 'non-modal',
|
|
146
|
+
defaultProps: {
|
|
147
|
+
'aria-hidden': 'true',
|
|
148
|
+
onClick: handledBackdropClick
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
151
|
+
root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : 'dialog', { ...(isNativeDialog ? {
|
|
152
|
+
role: modalType === 'alert' ? 'alertdialog' : undefined,
|
|
153
|
+
onClose: handleNativeClose,
|
|
154
|
+
onClick: handleNativeClick,
|
|
155
|
+
onCancel: handleNativeCancel
|
|
156
|
+
} : {
|
|
157
|
+
'aria-modal': modalType !== 'non-modal',
|
|
158
|
+
role: modalType === 'alert' ? 'alertdialog' : 'dialog'
|
|
159
|
+
}),
|
|
64
160
|
...props,
|
|
65
161
|
...modalAttributes,
|
|
66
|
-
onKeyDown:
|
|
162
|
+
onKeyDown: handleKeyDown,
|
|
163
|
+
'aria-describedby': dialogBodyID,
|
|
164
|
+
'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,
|
|
165
|
+
ref: react_utilities_1.useMergedRefs(ref, dialogRef)
|
|
67
166
|
})
|
|
68
167
|
};
|
|
69
168
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogSurface/useDialogSurface.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDial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yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n resolveShorthand,\n useEventCallback,\n useMergedRefs,\n isResolvedShorthand,\n} from '@fluentui/react-utilities';\nimport type {\n DialogSurfaceElement,\n DialogSurfaceElementIntersection,\n DialogSurfaceProps,\n DialogSurfaceState,\n} from './DialogSurface.types';\nimport { useDialogContext_unstable } from '../../contexts';\nimport { isEscapeKeyDismiss, HTMLDialogElementProps } from '../../utils';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n/**\n * Create the state required to render DialogSurface.\n *\n * The returned state can be modified with hooks such as useDialogSurfaceStyles_unstable,\n * before being passed to renderDialogSurface_unstable.\n *\n * @param props - props from this instance of DialogSurface\n * @param ref - reference to root HTMLElement of DialogSurface\n */\nexport const useDialogSurface_unstable = (\n props: DialogSurfaceProps,\n ref: React.Ref<DialogSurfaceElement>,\n): DialogSurfaceState => {\n const { backdrop, as } = props;\n const isNativeDialog = as === 'dialog' || as === undefined;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const dialogRef = useDialogContext_unstable(ctx => ctx.dialogRef);\n const open = useDialogContext_unstable(ctx => ctx.open);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const dialogTitleID = useDialogContext_unstable(ctx => ctx.dialogTitleID);\n const dialogBodyID = useDialogContext_unstable(ctx => ctx.dialogBodyID);\n\n const handleNativeClick = useEventCallback((event: React.MouseEvent<DialogSurfaceElementIntersection>) => {\n props.onClick?.(event);\n if (modalType === 'alert' || event.target !== event.currentTarget) {\n return;\n }\n const { clientX, clientY } = event;\n const { top, left, width, height } = event.currentTarget.getBoundingClientRect();\n const isBackdropClick = top > clientY || clientY > top + height || left > clientX || clientX > left + width;\n if (isBackdropClick) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick',\n });\n }\n });\n\n const handleNativeCancel = useEventCallback((event: React.SyntheticEvent<DialogSurfaceElementIntersection>) => {\n (props as HTMLDialogElementProps).onCancel?.(event);\n if (event.currentTarget !== event.target) {\n return;\n }\n if (modalType !== 'alert') {\n requestOpenChange({\n event,\n open: false,\n type: 'dialogCancel',\n });\n }\n event.preventDefault();\n });\n\n const handleNativeClose = useEventCallback((event: React.SyntheticEvent<DialogSurfaceElementIntersection>) => {\n (props as HTMLDialogElementProps).onClose?.(event);\n // Ensure dialog remains open if force closed by close event\n if (event.currentTarget.open !== open) {\n if (open) {\n if (modalType === 'non-modal') {\n event.currentTarget.show();\n } else {\n event.currentTarget.showModal();\n }\n } else {\n event.currentTarget.close();\n }\n }\n });\n\n const handledBackdropClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.backdrop)) {\n props.backdrop.onClick?.(event);\n }\n if (modalType === 'modal' && !event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n open: false,\n type: 'backdropClick',\n });\n }\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<DialogSurfaceElementIntersection>) => {\n props.onKeyDown?.(event);\n\n if (isEscapeKeyDismiss(event, modalType)) {\n requestOpenChange({\n event,\n open: false,\n type: 'escapeKeyDown',\n });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: nested Dialog, Popover, Menu and Tooltip\n event.stopPropagation();\n }\n });\n\n const { modalAttributes } = useModalAttributes({ trapFocus: modalType !== 'non-modal' });\n\n return {\n components: {\n backdrop: 'div',\n root: 'dialog',\n },\n backdrop: resolveShorthand(backdrop, {\n required: !isNativeDialog && open && modalType !== 'non-modal',\n defaultProps: {\n 'aria-hidden': 'true',\n onClick: handledBackdropClick,\n },\n }),\n root: getNativeElementProps(as ?? 'dialog', {\n ...(isNativeDialog\n ? {\n role: modalType === 'alert' ? 'alertdialog' : undefined,\n onClose: handleNativeClose,\n onClick: handleNativeClick,\n onCancel: handleNativeCancel,\n }\n : {\n 'aria-modal': modalType !== 'non-modal',\n role: modalType === 'alert' ? 'alertdialog' : 'dialog',\n }),\n ...props,\n ...modalAttributes,\n onKeyDown: handleKeyDown,\n 'aria-describedby': dialogBodyID,\n 'aria-labelledby': props['aria-label'] ? undefined : dialogTitleID,\n ref: useMergedRefs(ref, dialogRef),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogSurface/useDialogSurfaceContextValues.ts"],"names":[],"mappings":";;;;;;;AAGA,SAAgB,sCAAhB,CAAuD,KAAvD,EAAgF;EAC9E,MAAM,aAAa,GAA8B,IAAjD;EAEA,OAAO;IAAE;EAAF,CAAP;AACD;;AAJD,OAAA,CAAA,sCAAA,GAAA,sCAAA","sourcesContent":["import type { DialogSurfaceContextValues, DialogSurfaceState } from './DialogSurface.types';\nimport type { DialogSurfaceContextValue } from '../../contexts';\n\nexport function useDialogSurfaceContextValues_unstable(state: DialogSurfaceState): DialogSurfaceContextValues {\n const dialogSurface: DialogSurfaceContextValue = true;\n\n return { dialogSurface };\n}\n"],"sourceRoot":"../src/"}
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurfaceContextValues.ts"],"names":[],"mappings":";;;;;;;AAGA,SAAgB,sCAAhB,CAAuD,KAAvD,EAAgF;EAC9E,MAAM,aAAa,GAA8B,IAAjD;EAEA,OAAO;IAAE;EAAF,CAAP;AACD;;AAJD,OAAA,CAAA,sCAAA,GAAA,sCAAA","sourcesContent":["import type { DialogSurfaceContextValues, DialogSurfaceState } from './DialogSurface.types';\nimport type { DialogSurfaceContextValue } from '../../contexts';\n\nexport function useDialogSurfaceContextValues_unstable(state: DialogSurfaceState): DialogSurfaceContextValues {\n const dialogSurface: DialogSurfaceContextValue = true;\n\n return { dialogSurface };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -11,8 +11,11 @@ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
|
11
11
|
|
|
12
12
|
const constants_1 = /*#__PURE__*/require("../../contexts/constants");
|
|
13
13
|
|
|
14
|
+
const dialogContext_1 = /*#__PURE__*/require("../../contexts/dialogContext");
|
|
15
|
+
|
|
14
16
|
exports.dialogSurfaceClassNames = {
|
|
15
|
-
root: 'fui-DialogSurface'
|
|
17
|
+
root: 'fui-DialogSurface',
|
|
18
|
+
backdrop: 'fui-DialogSurface__backdrop'
|
|
16
19
|
};
|
|
17
20
|
/**
|
|
18
21
|
* Styles for the root slot
|
|
@@ -21,9 +24,6 @@ exports.dialogSurfaceClassNames = {
|
|
|
21
24
|
const useStyles = /*#__PURE__*/react_1.__styles({
|
|
22
25
|
"root": {
|
|
23
26
|
"qhf8xq": "f19dog8a",
|
|
24
|
-
"Bhzewxz": "f1i1t8d1",
|
|
25
|
-
"oyh7mz": ["f1ktbn1t", "ffenbu1"],
|
|
26
|
-
"Bz10aip": ["foouk8k", "fd9rb4b"],
|
|
27
27
|
"a9b677": "fly5x3f",
|
|
28
28
|
"Bqenvij": "f3052tw",
|
|
29
29
|
"B2u0y6b": "fvgz9i8",
|
|
@@ -31,6 +31,7 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
31
31
|
"B7ck84d": "f1ewtqcl",
|
|
32
32
|
"E5pizo": "f10nrhrw",
|
|
33
33
|
"De3pzq": "fxugw4r",
|
|
34
|
+
"sj55zd": "f19n0e5",
|
|
34
35
|
"i8kkvl": "f4px1ci",
|
|
35
36
|
"Belr9w4": "fn67r4l",
|
|
36
37
|
"B4j52fo": "f5ogflp",
|
|
@@ -64,9 +65,53 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
64
65
|
"B5xtmjs": "ff54dml",
|
|
65
66
|
"Bqu9lor": "f52bj20",
|
|
66
67
|
"B06wobe": "f1dangjo"
|
|
68
|
+
},
|
|
69
|
+
"dialog": {
|
|
70
|
+
"mc9l5x": "ftgm304",
|
|
71
|
+
"qhf8xq": "f19dog8a",
|
|
72
|
+
"oyh7mz": ["f1vgc2s3", "f1e31b4d"],
|
|
73
|
+
"j35jbq": ["f1e31b4d", "f1vgc2s3"],
|
|
74
|
+
"Bhzewxz": "f15twtuk",
|
|
75
|
+
"B5kzvoi": "f1yab3r1",
|
|
76
|
+
"a9b677": "f1acs6jw",
|
|
77
|
+
"Bqenvij": "f3052tw",
|
|
78
|
+
"De3pzq": "f1k92xex",
|
|
79
|
+
"B2u0y6b": "fheyfof",
|
|
80
|
+
"Bxyxcbc": "f1xxuklu",
|
|
81
|
+
"famaaq": "f1c515w",
|
|
82
|
+
"Bcdw1i0": "f1bitti",
|
|
83
|
+
"z8tnut": "f1g0x7ka",
|
|
84
|
+
"z189sj": ["fhxju0i", "f1cnd47f"],
|
|
85
|
+
"Byoj8tv": "f1qch9an",
|
|
86
|
+
"uwmqm3": ["f1cnd47f", "fhxju0i"],
|
|
87
|
+
"B6of3ja": "fgr6219",
|
|
88
|
+
"t21cq0": ["f1ujusj6", "fcgxt0o"],
|
|
89
|
+
"jrapky": "f10jk5vf",
|
|
90
|
+
"Frg6f3": ["fcgxt0o", "f1ujusj6"],
|
|
91
|
+
"icvyot": "f1ern45e",
|
|
92
|
+
"vrafjx": ["f1n71otn", "f1deefiw"],
|
|
93
|
+
"oivjwe": "f1h8hb77",
|
|
94
|
+
"wvpqe5": ["f1deefiw", "f1n71otn"],
|
|
95
|
+
"B68tc82": "f1ln0qer",
|
|
96
|
+
"Bmxbyg5": "fa2wlxz",
|
|
97
|
+
"fshzfu": "f120kxnn"
|
|
98
|
+
},
|
|
99
|
+
"backdrop": {
|
|
100
|
+
"qhf8xq": "f19dog8a",
|
|
101
|
+
"De3pzq": "fju19wo",
|
|
102
|
+
"Bhzewxz": "f113wtx2",
|
|
103
|
+
"j35jbq": ["f10k790i", "f1xynx9j"],
|
|
104
|
+
"B5kzvoi": "f5gq2j6",
|
|
105
|
+
"oyh7mz": ["f1xynx9j", "f10k790i"]
|
|
106
|
+
},
|
|
107
|
+
"nestedDialogBackdrop": {
|
|
108
|
+
"De3pzq": "f3rmtva"
|
|
109
|
+
},
|
|
110
|
+
"nestedNativeDialogBackdrop": {
|
|
111
|
+
"fshzfu": "foe20jx"
|
|
67
112
|
}
|
|
68
113
|
}, {
|
|
69
|
-
"d": [".f19dog8a{position:fixed;}", ".
|
|
114
|
+
"d": [".f19dog8a{position:fixed;}", ".fly5x3f{width:100%;}", ".f3052tw{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;}", ".fvgz9i8{max-width:600px;}", ".f6a9g1z{max-height:100vh;}", ".f1ewtqcl{box-sizing:border-box;}", ".f10nrhrw{box-shadow:var(--shadow64);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".fn67r4l{row-gap:8px;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f1erghxr{border-bottom-right-radius:8px;}", ".f1ehz9de{border-bottom-left-radius:8px;}", ".f1spoy8{border-top-right-radius:8px;}", ".fmb70yw{border-top-left-radius:8px;}", ".fgr6219{margin-top:auto;}", ".f1ujusj6{margin-right:auto;}", ".fcgxt0o{margin-left:auto;}", ".f10jk5vf{margin-bottom:auto;}", ".f13qh94s{display:grid;}", ".f874eam{grid-template-rows:auto 1fr auto;}", ".fjj47a5{grid-template-columns:1fr 1fr auto;}", ".f16o7v7l{grid-template-areas:\"title title close-button\" \"body body body\" \"actions-start actions-end actions-end\";}", ".fuq56rw{padding-top:24px;}", ".f15kemlc{padding-right:24px;}", ".fdgang7{padding-left:24px;}", ".fl2zwns{padding-bottom:24px;}", ".ftgm304{display:block;}", ".f1vgc2s3{left:0;}", ".f1e31b4d{right:0;}", ".f15twtuk{top:0;}", ".f1yab3r1{bottom:0;}", ".f1acs6jw{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;}", ".f1k92xex{background-color:unset;}", ".fheyfof{max-width:unset;}", ".f1xxuklu{max-height:unset;}", ".f1c515w{-webkit-user-select:unset;-moz-user-select:unset;-ms-user-select:unset;user-select:unset;}", ".f1bitti{visibility:unset;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1h8hb77{border-bottom-style:none;}", ".f1ln0qer{overflow-x:unset;}", ".fa2wlxz{overflow-y:unset;}", ".f120kxnn::backdrop{background-color:rgba(0, 0, 0, 0.4);}", ".fju19wo{background-color:rgba(0, 0, 0, 0.4);}", ".f113wtx2{top:0px;}", ".f10k790i{right:0px;}", ".f1xynx9j{left:0px;}", ".f5gq2j6{bottom:0px;}", ".f3rmtva{background-color:transparent;}", ".foe20jx::backdrop{background-color:transparent;}"],
|
|
70
115
|
"m": [["@media screen and (max-width: 480px){.ff54dml{max-width:100vw;}}", {
|
|
71
116
|
"m": "screen and (max-width: 480px)"
|
|
72
117
|
}], ["@media screen and (max-width: 480px){.f52bj20{grid-template-rows:auto 1fr auto auto;}}", {
|
|
@@ -82,7 +127,13 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
82
127
|
|
|
83
128
|
const useDialogSurfaceStyles_unstable = state => {
|
|
84
129
|
const styles = useStyles();
|
|
85
|
-
|
|
130
|
+
const isNestedDialog = dialogContext_1.useDialogContext_unstable(ctx => ctx.isNestedDialog);
|
|
131
|
+
state.root.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.root, styles.dialog, styles.root, isNestedDialog && styles.nestedNativeDialogBackdrop, state.root.className);
|
|
132
|
+
|
|
133
|
+
if (state.backdrop) {
|
|
134
|
+
state.backdrop.className = react_1.mergeClasses(exports.dialogSurfaceClassNames.backdrop, styles.backdrop, isNestedDialog && styles.nestedDialogBackdrop, state.backdrop.className);
|
|
135
|
+
}
|
|
136
|
+
|
|
86
137
|
return state;
|
|
87
138
|
};
|
|
88
139
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogSurface/useDialogSurfaceStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogSurface/useDialogSurfaceStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AAYA,MAAA,eAAA,gBAAA,OAAA,CAAA,8BAAA,CAAA;;AAGa,OAAA,CAAA,uBAAA,GAA8D;EACzE,IAAI,EAAE,mBADmE;EAEzE,QAAQ,EAAE;AAF+D,CAA9D;AAKb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;EAAA;IAAA;EAAA;IAAA;EAAA;IAAA;EAAA;AAAA,EAAlB;AAwEA;;AAEG;;;AACI,MAAM,+BAA+B,GAAI,KAAD,IAAkD;EAC/F,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM,cAAc,GAAG,eAAA,CAAA,yBAAA,CAA0B,GAAG,IAAI,GAAG,CAAC,cAArC,CAAvB;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,uBAAA,CAAwB,IADH,EAErB,MAAM,CAAC,MAFc,EAGrB,MAAM,CAAC,IAHc,EAIrB,cAAc,IAAI,MAAM,CAAC,0BAJJ,EAKrB,KAAK,CAAC,IAAN,CAAW,SALU,CAAvB;;EAOA,IAAI,KAAK,CAAC,QAAV,EAAoB;IAClB,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,OAAA,CAAA,YAAA,CACzB,OAAA,CAAA,uBAAA,CAAwB,QADC,EAEzB,MAAM,CAAC,QAFkB,EAGzB,cAAc,IAAI,MAAM,CAAC,oBAHA,EAIzB,KAAK,CAAC,QAAN,CAAe,SAJU,CAA3B;EAMD;;EACD,OAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,+BAAA,GAA+B,+BAA/B","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport {\n TITLE_GRID_AREA,\n ACTIONS_END_GRID_AREA,\n ACTIONS_START_GRID_AREA,\n SURFACE_BORDER_RADIUS,\n SURFACE_BORDER_WIDTH,\n SURFACE_PADDING,\n DIALOG_GAP,\n MEDIA_QUERY_BREAKPOINT_SELECTOR,\n BODY_GRID_AREA,\n TITLE_ACTION_GRID_AREA,\n} from '../../contexts/constants';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport type { DialogSurfaceSlots, DialogSurfaceState } from './DialogSurface.types';\n\nexport const dialogSurfaceClassNames: SlotClassNames<DialogSurfaceSlots> = {\n root: 'fui-DialogSurface',\n backdrop: 'fui-DialogSurface__backdrop',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'fixed',\n width: '100%',\n height: 'fit-content',\n maxWidth: '600px',\n maxHeight: '100vh',\n boxSizing: 'border-box',\n boxShadow: tokens.shadow64,\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n ...shorthands.gap(DIALOG_GAP),\n ...shorthands.border(SURFACE_BORDER_WIDTH, 'solid', tokens.colorTransparentStroke),\n ...shorthands.borderRadius(SURFACE_BORDER_RADIUS),\n ...shorthands.margin('auto'),\n display: 'grid',\n gridTemplateRows: 'auto 1fr auto',\n gridTemplateColumns: '1fr 1fr auto',\n gridTemplateAreas: `\n \"${TITLE_GRID_AREA} ${TITLE_GRID_AREA} ${TITLE_ACTION_GRID_AREA}\"\n \"${BODY_GRID_AREA} ${BODY_GRID_AREA} ${BODY_GRID_AREA}\"\n \"${ACTIONS_START_GRID_AREA} ${ACTIONS_END_GRID_AREA} ${ACTIONS_END_GRID_AREA}\"\n `,\n ...shorthands.padding(SURFACE_PADDING),\n [MEDIA_QUERY_BREAKPOINT_SELECTOR]: {\n maxWidth: '100vw',\n gridTemplateRows: 'auto 1fr auto auto',\n gridTemplateAreas: `\n \"${TITLE_GRID_AREA} ${TITLE_GRID_AREA} ${TITLE_ACTION_GRID_AREA}\"\n \"${BODY_GRID_AREA} ${BODY_GRID_AREA} ${BODY_GRID_AREA}\"\n \"${ACTIONS_START_GRID_AREA} ${ACTIONS_START_GRID_AREA} ${ACTIONS_START_GRID_AREA}\"\n \"${ACTIONS_END_GRID_AREA} ${ACTIONS_END_GRID_AREA} ${ACTIONS_END_GRID_AREA}\"\n `,\n },\n },\n dialog: {\n display: 'block',\n position: 'fixed',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n width: 'fit-content',\n height: 'fit-content',\n backgroundColor: 'unset',\n maxWidth: 'unset',\n maxHeight: 'unset',\n userSelect: 'unset',\n visibility: 'unset',\n ...shorthands.padding(0),\n ...shorthands.margin('auto'),\n ...shorthands.borderStyle('none'),\n ...shorthands.overflow('unset'),\n '&::backdrop': {\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n },\n },\n backdrop: {\n position: 'fixed',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n ...shorthands.inset('0px'),\n },\n nestedDialogBackdrop: {\n backgroundColor: 'transparent',\n },\n nestedNativeDialogBackdrop: {\n '&::backdrop': {\n backgroundColor: 'transparent',\n },\n },\n});\n\n/**\n * Apply styling to the DialogSurface slots based on the state\n */\nexport const useDialogSurfaceStyles_unstable = (state: DialogSurfaceState): DialogSurfaceState => {\n const styles = useStyles();\n const isNestedDialog = useDialogContext_unstable(ctx => ctx.isNestedDialog);\n\n state.root.className = mergeClasses(\n dialogSurfaceClassNames.root,\n styles.dialog,\n styles.root,\n isNestedDialog && styles.nestedNativeDialogBackdrop,\n state.root.className,\n );\n if (state.backdrop) {\n state.backdrop.className = mergeClasses(\n dialogSurfaceClassNames.backdrop,\n styles.backdrop,\n isNestedDialog && styles.nestedDialogBackdrop,\n state.backdrop.className,\n );\n }\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -13,9 +13,8 @@ const renderDialogTitle_1 = /*#__PURE__*/require("./renderDialogTitle");
|
|
|
13
13
|
|
|
14
14
|
const useDialogTitleStyles_1 = /*#__PURE__*/require("./useDialogTitleStyles");
|
|
15
15
|
/**
|
|
16
|
-
* The `DialogTitle` component
|
|
17
|
-
* and
|
|
18
|
-
* Apart from styling and presenting `closeButton`, this component does not have other behavior.
|
|
16
|
+
* The `DialogTitle` component expects to have a title/header
|
|
17
|
+
* and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.
|
|
19
18
|
*/
|
|
20
19
|
|
|
21
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogTitle/DialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTitle/DialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA;;;AAGG;;;AACU,OAAA,CAAA,WAAA,gBAAqD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAChG,MAAM,KAAK,GAAG,gBAAA,CAAA,uBAAA,CAAwB,KAAxB,EAA+B,GAA/B,CAAd;EAEA,sBAAA,CAAA,6BAAA,CAA8B,KAA9B;EACA,OAAO,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAP;AACD,CALiE,CAArD;AAOb,OAAA,CAAA,WAAA,CAAY,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { useDialogTitle_unstable } from './useDialogTitle';\nimport { renderDialogTitle_unstable } from './renderDialogTitle';\nimport { useDialogTitleStyles_unstable } from './useDialogTitleStyles';\nimport type { DialogTitleProps } from './DialogTitle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * The `DialogTitle` component expects to have a title/header\n * and when `Dialog` is `non-modal` a close (X icon) button is provided through `action` slot by default.\n */\nexport const DialogTitle: ForwardRefComponent<DialogTitleProps> = React.forwardRef((props, ref) => {\n const state = useDialogTitle_unstable(props, ref);\n\n useDialogTitleStyles_unstable(state);\n return renderDialogTitle_unstable(state);\n});\n\nDialogTitle.displayName = 'DialogTitle';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogTitle/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './DialogTitle';\nexport * from './DialogTitle.types';\nexport * from './renderDialogTitle';\nexport * from './useDialogTitle';\nexport * from './useDialogTitleStyles';\n"],"sourceRoot":"../src/"}
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTitle/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './DialogTitle';\nexport * from './DialogTitle.types';\nexport * from './renderDialogTitle';\nexport * from './useDialogTitle';\nexport * from './useDialogTitleStyles';\n"],"sourceRoot":"../src/"}
|
|
@@ -8,8 +8,6 @@ exports.renderDialogTitle_unstable = void 0;
|
|
|
8
8
|
const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
|
10
10
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
-
|
|
12
|
-
const DialogTrigger_1 = /*#__PURE__*/require("../DialogTrigger");
|
|
13
11
|
/**
|
|
14
12
|
* Render the final JSX of DialogTitle
|
|
15
13
|
*/
|
|
@@ -21,10 +19,8 @@ const renderDialogTitle_unstable = state => {
|
|
|
21
19
|
slotProps
|
|
22
20
|
} = react_utilities_1.getSlots(state);
|
|
23
21
|
return React.createElement(React.Fragment, null, React.createElement(slots.root, { ...slotProps.root
|
|
24
|
-
}, slotProps.root.children), slots.
|
|
25
|
-
|
|
26
|
-
}, React.createElement(slots.closeButton, { ...slotProps.closeButton
|
|
27
|
-
})));
|
|
22
|
+
}, slotProps.root.children), slots.action && React.createElement(slots.action, { ...slotProps.action
|
|
23
|
+
}));
|
|
28
24
|
};
|
|
29
25
|
|
|
30
26
|
exports.renderDialogTitle_unstable = renderDialogTitle_unstable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogTitle/renderDialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogTitle/renderDialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,0BAA0B,GAAI,KAAD,IAA4B;EACpE,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAA2B,KAA3B,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EAAiC,SAAS,CAAC,IAAV,CAAe,QAAhD,CADF,EAEG,KAAK,CAAC,MAAN,IAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAFnB,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DialogTitleState, DialogTitleSlots } from './DialogTitle.types';\n\n/**\n * Render the final JSX of DialogTitle\n */\nexport const renderDialogTitle_unstable = (state: DialogTitleState) => {\n const { slots, slotProps } = getSlots<DialogTitleSlots>(state);\n\n return (\n <>\n <slots.root {...slotProps.root}>{slotProps.root.children}</slots.root>\n {slots.action && <slots.action {...slotProps.action} />}\n </>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,11 +9,15 @@ const React = /*#__PURE__*/require("react");
|
|
|
9
9
|
|
|
10
10
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
11
|
|
|
12
|
-
const react_aria_1 = /*#__PURE__*/require("@fluentui/react-aria");
|
|
13
|
-
|
|
14
12
|
const dialogContext_1 = /*#__PURE__*/require("../../contexts/dialogContext");
|
|
15
13
|
|
|
16
14
|
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
|
15
|
+
|
|
16
|
+
const react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
17
|
+
|
|
18
|
+
const DialogTrigger_1 = /*#__PURE__*/require("../DialogTrigger/DialogTrigger");
|
|
19
|
+
|
|
20
|
+
const useDialogTitleStyles_1 = /*#__PURE__*/require("./useDialogTitleStyles");
|
|
17
21
|
/**
|
|
18
22
|
* Create the state required to render DialogTitle.
|
|
19
23
|
*
|
|
@@ -27,26 +31,30 @@ const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
|
|
27
31
|
|
|
28
32
|
const useDialogTitle_unstable = (props, ref) => {
|
|
29
33
|
const {
|
|
30
|
-
as
|
|
31
|
-
|
|
34
|
+
as,
|
|
35
|
+
action
|
|
32
36
|
} = props;
|
|
33
37
|
const modalType = dialogContext_1.useDialogContext_unstable(ctx => ctx.modalType);
|
|
38
|
+
const internalStyles = useDialogTitleStyles_1.useDialogTitleInternalStyles();
|
|
34
39
|
return {
|
|
35
40
|
components: {
|
|
36
41
|
root: 'div',
|
|
37
|
-
|
|
42
|
+
action: 'div'
|
|
38
43
|
},
|
|
39
|
-
root: react_utilities_1.getNativeElementProps(as, {
|
|
44
|
+
root: react_utilities_1.getNativeElementProps(as !== null && as !== void 0 ? as : 'div', {
|
|
40
45
|
ref,
|
|
41
46
|
id: dialogContext_1.useDialogContext_unstable(ctx => ctx.dialogTitleID),
|
|
42
47
|
...props
|
|
43
48
|
}),
|
|
44
|
-
|
|
49
|
+
action: react_utilities_2.resolveShorthand(action, {
|
|
45
50
|
required: modalType === 'non-modal',
|
|
46
51
|
defaultProps: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
children: React.createElement(DialogTrigger_1.DialogTrigger, {
|
|
53
|
+
action: "close"
|
|
54
|
+
}, React.createElement("button", {
|
|
55
|
+
className: internalStyles.button,
|
|
56
|
+
"aria-label": "close"
|
|
57
|
+
}, React.createElement(react_icons_1.Dismiss24Regular, null)))
|
|
50
58
|
}
|
|
51
59
|
})
|
|
52
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/DialogTitle/useDialogTitle.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA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B,YAAY,EAAE;QACZ,QAAQ,EACN,KAAA,CAAA,aAAA,CAAC,eAAA,CAAA,aAAD,EAAc;UAAC,MAAM,EAAC;QAAR,CAAd,EACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;UACE,SAAS,EAAE,cAAc,CAAC,MAD5B;UACkC,cAErB;QAHb,CAAA,EAKE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,gBAAD,EAAiB,IAAjB,CALF,CADF;MAFU;IAFiB,CAAzB;EAVH,CAAP;AA2BD,CAhCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogTitleProps, DialogTitleState } from './DialogTitle.types';\nimport { useDialogContext_unstable } from '../../contexts/dialogContext';\nimport { Dismiss24Regular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { DialogTrigger } from '../DialogTrigger/DialogTrigger';\nimport { useDialogTitleInternalStyles } from './useDialogTitleStyles';\n\n/**\n * Create the state required to render DialogTitle.\n *\n * The returned state can be modified with hooks such as useDialogTitleStyles_unstable,\n * before being passed to renderDialogTitle_unstable.\n *\n * @param props - props from this instance of DialogTitle\n * @param ref - reference to root HTMLElement of DialogTitle\n */\nexport const useDialogTitle_unstable = (props: DialogTitleProps, ref: React.Ref<HTMLElement>): DialogTitleState => {\n const { as, action } = props;\n const modalType = useDialogContext_unstable(ctx => ctx.modalType);\n const internalStyles = useDialogTitleInternalStyles();\n\n return {\n components: {\n root: 'div',\n action: 'div',\n },\n root: getNativeElementProps(as ?? 'div', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogTitleID),\n ...props,\n }),\n action: resolveShorthand(action, {\n required: modalType === 'non-modal',\n defaultProps: {\n children: (\n <DialogTrigger action=\"close\">\n <button\n className={internalStyles.button}\n // TODO: find a better way to add internal labels\n aria-label=\"close\"\n >\n <Dismiss24Regular />\n </button>\n </DialogTrigger>\n ),\n },\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|