@fluentui/react-dialog 9.5.17 → 9.5.19
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 +61 -1
- package/CHANGELOG.md +25 -2
- package/lib/components/DialogTrigger/useDialogTrigger.js +3 -2
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib/utils/useDisableBodyScroll.js +1 -1
- package/lib/utils/useDisableBodyScroll.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +3 -2
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/utils/useDisableBodyScroll.js +1 -1
- package/lib-commonjs/utils/useDisableBodyScroll.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,67 @@
|
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 01 Aug 2023 10:14:29 GMT",
|
|
6
|
+
"tag": "@fluentui/react-dialog_v9.5.19",
|
|
7
|
+
"version": "9.5.19",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-dialog",
|
|
13
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.7.0",
|
|
14
|
+
"commit": "412d815f88863bde8bb16abc8fd9c4140a37f1f5"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-dialog",
|
|
19
|
+
"comment": "Bump @fluentui/react-tabster to v9.11.1",
|
|
20
|
+
"commit": "412d815f88863bde8bb16abc8fd9c4140a37f1f5"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-dialog",
|
|
25
|
+
"comment": "Bump @fluentui/react-portal to v9.3.4",
|
|
26
|
+
"commit": "412d815f88863bde8bb16abc8fd9c4140a37f1f5"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Tue, 25 Jul 2023 13:29:18 GMT",
|
|
33
|
+
"tag": "@fluentui/react-dialog_v9.5.18",
|
|
34
|
+
"version": "9.5.18",
|
|
35
|
+
"comments": {
|
|
36
|
+
"patch": [
|
|
37
|
+
{
|
|
38
|
+
"author": "ololubek@microsoft.com",
|
|
39
|
+
"package": "@fluentui/react-dialog",
|
|
40
|
+
"commit": "1082207b08959996cd736725735cadc01d0849b0",
|
|
41
|
+
"comment": "chore: Update react-icons version to pick up fowardref change."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "lingfan.gao@microsoft.com",
|
|
45
|
+
"package": "@fluentui/react-dialog",
|
|
46
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2",
|
|
47
|
+
"comment": "fix: Focus should restore to a DialogTrigger outside of a Dialog"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@fluentui/react-dialog",
|
|
52
|
+
"comment": "Bump @fluentui/react-tabster to v9.11.0",
|
|
53
|
+
"commit": "e59b4b305eb656c5af005fefbfa2b1f69afcdc43"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-dialog",
|
|
58
|
+
"comment": "Bump @fluentui/react-portal to v9.3.3",
|
|
59
|
+
"commit": "e59b4b305eb656c5af005fefbfa2b1f69afcdc43"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Thu, 20 Jul 2023 18:27:28 GMT",
|
|
6
66
|
"tag": "@fluentui/react-dialog_v9.5.17",
|
|
7
67
|
"version": "9.5.17",
|
|
8
68
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-dialog
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 01 Aug 2023 10:14:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.5.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.5.19)
|
|
8
|
+
|
|
9
|
+
Tue, 01 Aug 2023 10:14:29 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.5.18..@fluentui/react-dialog_v9.5.19)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-shared-contexts to v9.7.0 ([PR #28689](https://github.com/microsoft/fluentui/pull/28689) by beachball)
|
|
15
|
+
- Bump @fluentui/react-tabster to v9.11.1 ([PR #28689](https://github.com/microsoft/fluentui/pull/28689) by beachball)
|
|
16
|
+
- Bump @fluentui/react-portal to v9.3.4 ([PR #28689](https://github.com/microsoft/fluentui/pull/28689) by beachball)
|
|
17
|
+
|
|
18
|
+
## [9.5.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.5.18)
|
|
19
|
+
|
|
20
|
+
Tue, 25 Jul 2023 13:29:18 GMT
|
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.5.17..@fluentui/react-dialog_v9.5.18)
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- chore: Update react-icons version to pick up fowardref change. ([PR #28590](https://github.com/microsoft/fluentui/pull/28590) by ololubek@microsoft.com)
|
|
26
|
+
- fix: Focus should restore to a DialogTrigger outside of a Dialog ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by lingfan.gao@microsoft.com)
|
|
27
|
+
- Bump @fluentui/react-tabster to v9.11.0 ([PR #28622](https://github.com/microsoft/fluentui/pull/28622) by beachball)
|
|
28
|
+
- Bump @fluentui/react-portal to v9.3.3 ([PR #28622](https://github.com/microsoft/fluentui/pull/28622) by beachball)
|
|
29
|
+
|
|
7
30
|
## [9.5.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.5.17)
|
|
8
31
|
|
|
9
|
-
Thu, 20 Jul 2023 18:
|
|
32
|
+
Thu, 20 Jul 2023 18:27:28 GMT
|
|
10
33
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.5.16..@fluentui/react-dialog_v9.5.17)
|
|
11
34
|
|
|
12
35
|
### Patches
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';
|
|
3
3
|
import { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';
|
|
4
4
|
import { useARIAButtonProps } from '@fluentui/react-aria';
|
|
5
|
+
import { useModalAttributes } from '@fluentui/react-tabster';
|
|
5
6
|
/**
|
|
6
7
|
* Create the state required to render DialogTrigger.
|
|
7
8
|
* Clones the only child component and adds necessary event handling behaviours to open a popup Dialog
|
|
@@ -12,10 +13,10 @@ import { useARIAButtonProps } from '@fluentui/react-aria';
|
|
|
12
13
|
const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;
|
|
13
14
|
const child = getTriggerChild(children);
|
|
14
15
|
const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);
|
|
15
|
-
const triggerAttributes =
|
|
16
|
+
const { triggerAttributes } = useModalAttributes();
|
|
16
17
|
const handleClick = useEventCallback((event)=>{
|
|
17
18
|
var _child_props, _child_props_onClick;
|
|
18
|
-
(_child_props_onClick =
|
|
19
|
+
(_child_props_onClick = _child_props = child === null || child === void 0 ? void 0 : child.props.onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
|
|
19
20
|
if (!event.isDefaultPrevented()) {
|
|
20
21
|
requestOpenChange({
|
|
21
22
|
event,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const triggerAttributes =
|
|
1
|
+
{"version":3,"sources":["useDialogTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useModalAttributes","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","child","requestOpenChange","ctx","triggerAttributes","handleClick","event","onClick","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAE3G,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ,iBAAiB;AAC7F,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D;;;;;CAKC,GACD,OAAO,MAAMC,4BAA4B,CAACC,QAAkD;IAC1F,MAAMC,wBAAwBL;IAE9B,MAAM,EAAEM,SAAQ,EAAEC,0BAA2B,KAAK,CAAA,EAAEC,QAASH,wBAAwB,UAAU,MAAM,CAAA,EAAE,GAAGD;IAE1G,MAAMK,QAAQZ,gBAAgBS;IAE9B,MAAMI,oBAAoBX,0BAA0BY,CAAAA,MAAOA,IAAID,iBAAiB;IAChF,MAAM,EAAEE,kBAAiB,EAAE,GAAGV;IAE9B,MAAMW,cAAcf,iBAClB,CAACgB,QAAoF;YACnFL,cAAAA;QAAAA,CAAAA,uBAAAA,eAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOL,KAAK,CAACW,OAAO,cAApBN,kCAAAA,KAAAA,IAAAA,qBAAAA,KAAAA,cAAuBK;QACvB,IAAI,CAACA,MAAME,kBAAkB,IAAI;YAC/BN,kBAAkB;gBAChBI;gBACAG,MAAM;gBACNC,MAAMV,WAAW;YACnB;QACF,CAAC;IACH;IAGF,MAAMW,oBAAoB;QACxB,GAAGV,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOL,KAAK;QACfgB,KAAKX,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOW,GAAG;QACfL,SAASF;QACT,GAAGD,iBAAiB;IACtB;IAEA,MAAMS,8BAA8BpB,mBAClCQ,CAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAD,MAAM,YAAYR,CAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAD,MAAM,MAAMR,MAAMQ,IAAI,GAAG,KAAK,EACpE;QACE,GAAGE,iBAAiB;QACpBF,MAAM;IACR;IAGF,OAAO;QACLX,UAAUV,4BACRU,UACAC,2BAA2BY,oBAAoBE,2BAA2B;IAE9E;AACF,EAAE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _element, _disableScrollElementProp;
|
|
2
1
|
import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
3
2
|
import { useCallback } from 'react';
|
|
4
3
|
const disableScrollElementProp = '__fluentDisableScrollElement';
|
|
@@ -38,6 +37,7 @@ const disableScrollElementProp = '__fluentDisableScrollElement';
|
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
39
|
function assertIsDisableScrollElement(element) {
|
|
40
|
+
var _element, _disableScrollElementProp;
|
|
41
41
|
var _;
|
|
42
42
|
(_ = (_element = element)[_disableScrollElementProp = disableScrollElementProp]) !== null && _ !== void 0 ? _ : _element[_disableScrollElementProp] = {
|
|
43
43
|
count: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDisableBodyScroll.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useDisableBodyScroll.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\n\nconst disableScrollElementProp = '__fluentDisableScrollElement' as const;\n\ntype FluentDisableScrollElement = HTMLElement & {\n [disableScrollElementProp]: {\n count: number;\n previousOverflowStyle: string;\n previousPaddingRightStyle: string;\n };\n};\n\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */\nexport function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(() => {\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [targetDocument]);\n}\n\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */\nexport function disableScroll(target: HTMLElement) {\n const { clientWidth } = target.ownerDocument.documentElement;\n const innerWidth = target.ownerDocument.defaultView?.innerWidth ?? 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return () => {\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\n\nfunction assertIsDisableScrollElement(element: HTMLElement): asserts element is FluentDisableScrollElement {\n (element as FluentDisableScrollElement)[disableScrollElementProp] ??= {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight,\n };\n}\n"],"names":["useFluent_unstable","useCallback","disableScrollElementProp","useDisableBodyScroll","targetDocument","disableScroll","body","target","clientWidth","ownerDocument","documentElement","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,WAAW,QAAQ,QAAQ;AAEpC,MAAMC,2BAA2B;AAUjC;;CAEC,GACD,OAAO,SAASC,uBAAuB;IACrC,MAAM,EAAEC,eAAc,EAAE,GAAGJ;IAC3B,OAAOC,YAAY,IAAM;QACvB,IAAIG,gBAAgB;YAClB,OAAOC,cAAcD,eAAeE,IAAI;QAC1C,CAAC;IACH,GAAG;QAACF;KAAe;AACrB,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASC,cAAcE,MAAmB,EAAE;QAE9BA;IADnB,MAAM,EAAEC,YAAW,EAAE,GAAGD,OAAOE,aAAa,CAACC,eAAe;QACzCH;IAAnB,MAAMI,aAAaJ,CAAAA,+CAAAA,CAAAA,oCAAAA,OAAOE,aAAa,CAACG,WAAW,cAAhCL,+CAAAA,KAAAA,IAAAA,kCAAkCI,UAAU,cAA5CJ,0DAAAA,+CAAgD,CAAC;IACpEM,6BAA6BN;IAC7B,IAAIA,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;QAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAG;QACxBT,OAAOQ,KAAK,CAACE,YAAY,GAAG,CAAC,EAAEN,aAAaH,YAAY,EAAE,CAAC;IAC7D,CAAC;IACDD,MAAM,CAACL,yBAAyB,CAACY,KAAK;IACtC,OAAO,IAAM;QACXP,MAAM,CAACL,yBAAyB,CAACY,KAAK;QACtC,IAAIP,MAAM,CAACL,yBAAyB,CAACY,KAAK,KAAK,GAAG;YAChDP,OAAOQ,KAAK,CAACC,QAAQ,GAAGT,MAAM,CAACL,yBAAyB,CAACgB,qBAAqB;YAC9EX,OAAOQ,KAAK,CAACE,YAAY,GAAGV,MAAM,CAACL,yBAAyB,CAACiB,yBAAyB;QACxF,CAAC;IACH;AACF,CAAC;AAED,SAASN,6BAA6BO,OAAoB,EAAiD;QACxGA,UAAuClB;;IAAxC,MAACkB,WAAAA,QAAsC,CAAClB,4BAAAA,yBAAyB,iCAAhEkB,QAAsC,CAAClB,0BAAyB,GAAK;QACpEY,OAAO;QACPI,uBAAuBE,QAAQL,KAAK,CAACC,QAAQ;QAC7CG,2BAA2BC,QAAQL,KAAK,CAACE,YAAY;IACvD,CAAC;AACH"}
|
|
@@ -11,15 +11,16 @@ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
|
11
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
12
|
const _contexts = require("../../contexts");
|
|
13
13
|
const _reactAria = require("@fluentui/react-aria");
|
|
14
|
+
const _reactTabster = require("@fluentui/react-tabster");
|
|
14
15
|
const useDialogTrigger_unstable = (props)=>{
|
|
15
16
|
const isInsideSurfaceDialog = (0, _contexts.useDialogSurfaceContext_unstable)();
|
|
16
17
|
const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;
|
|
17
18
|
const child = (0, _reactUtilities.getTriggerChild)(children);
|
|
18
19
|
const requestOpenChange = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.requestOpenChange);
|
|
19
|
-
const triggerAttributes = (0,
|
|
20
|
+
const { triggerAttributes } = (0, _reactTabster.useModalAttributes)();
|
|
20
21
|
const handleClick = (0, _reactUtilities.useEventCallback)((event)=>{
|
|
21
22
|
var _child_props, _child_props_onClick;
|
|
22
|
-
(_child_props_onClick =
|
|
23
|
+
(_child_props_onClick = _child_props = child === null || child === void 0 ? void 0 : child.props.onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);
|
|
23
24
|
if (!event.isDefaultPrevented()) {
|
|
24
25
|
requestOpenChange({
|
|
25
26
|
event,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */ export const useDialogTrigger_unstable = (props)=>{\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;\n const child = getTriggerChild(children);\n const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);\n const triggerAttributes =
|
|
1
|
+
{"version":3,"sources":["useDialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { useModalAttributes } from '@fluentui/react-tabster';\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */ export const useDialogTrigger_unstable = (props)=>{\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;\n const child = getTriggerChild(children);\n const requestOpenChange = useDialogContext_unstable((ctx)=>ctx.requestOpenChange);\n const { triggerAttributes } = useModalAttributes();\n const handleClick = useEventCallback((event)=>{\n var _child_props, _child_props_onClick;\n (_child_props_onClick = _child_props = child === null || child === void 0 ? void 0 : child.props.onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open'\n });\n }\n });\n const triggerChildProps = {\n ...child === null || child === void 0 ? void 0 : child.props,\n ref: child === null || child === void 0 ? void 0 : child.ref,\n onClick: handleClick,\n ...triggerAttributes\n };\n const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {\n ...triggerChildProps,\n type: 'button'\n });\n return {\n children: applyTriggerPropsToChildren(children, disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\n"],"names":["useDialogTrigger_unstable","props","isInsideSurfaceDialog","useDialogSurfaceContext_unstable","children","disableButtonEnhancement","action","child","getTriggerChild","requestOpenChange","useDialogContext_unstable","ctx","triggerAttributes","useModalAttributes","handleClick","useEventCallback","event","_child_props","_child_props_onClick","onClick","call","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToChildren"],"mappings":";;;;+BAUiBA;;aAAAA;;;6DAVM;gCACwD;0BACH;2BACzC;8BACA;AAMxB,MAAMA,4BAA4B,CAACC,QAAQ;IAClD,MAAMC,wBAAwBC,IAAAA,0CAAgC;IAC9D,MAAM,EAAEC,SAAQ,EAAGC,0BAA0B,KAAK,CAAA,EAAGC,QAAQJ,wBAAwB,UAAU,MAAM,CAAA,EAAG,GAAGD;IAC3G,MAAMM,QAAQC,IAAAA,+BAAe,EAACJ;IAC9B,MAAMK,oBAAoBC,IAAAA,mCAAyB,EAAC,CAACC,MAAMA,IAAIF,iBAAiB;IAChF,MAAM,EAAEG,kBAAiB,EAAG,GAAGC,IAAAA,gCAAkB;IACjD,MAAMC,cAAcC,IAAAA,gCAAgB,EAAC,CAACC,QAAQ;QAC1C,IAAIC,cAAcC;QACjBA,CAAAA,uBAAuBD,eAAeV,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMN,KAAK,CAACkB,OAAO,AAAD,MAAO,IAAI,IAAID,yBAAyB,KAAK,IAAI,KAAK,IAAIA,qBAAqBE,IAAI,CAACH,cAAcD,MAAM;QAC/M,IAAI,CAACA,MAAMK,kBAAkB,IAAI;YAC7BZ,kBAAkB;gBACdO;gBACAM,MAAM;gBACNC,MAAMjB,WAAW;YACrB;QACJ,CAAC;IACL;IACA,MAAMkB,oBAAoB;QACtB,GAAGjB,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMN,KAAK;QAC5DwB,KAAKlB,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMkB,GAAG;QAC5DN,SAASL;QACT,GAAGF,iBAAiB;IACxB;IACA,MAAMc,8BAA8BC,IAAAA,6BAAkB,EAAC,AAACpB,CAAAA,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMe,IAAI,AAAD,MAAO,YAAY,AAACf,CAAAA,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMe,IAAI,AAAD,MAAO,MAAMf,MAAMe,IAAI,GAAG,KAAK,EAAE;QACvN,GAAGE,iBAAiB;QACpBF,MAAM;IACV;IACA,OAAO;QACHlB,UAAUwB,IAAAA,2CAA2B,EAACxB,UAAUC,2BAA2BmB,oBAAoBE,2BAA2B;IAC9H;AACJ"}
|
|
@@ -14,7 +14,6 @@ _export(exports, {
|
|
|
14
14
|
});
|
|
15
15
|
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
|
16
16
|
const _react = require("react");
|
|
17
|
-
var _element, _disableScrollElementProp;
|
|
18
17
|
const disableScrollElementProp = '__fluentDisableScrollElement';
|
|
19
18
|
function useDisableBodyScroll() {
|
|
20
19
|
const { targetDocument } = (0, _reactSharedContexts.useFluent_unstable)();
|
|
@@ -46,6 +45,7 @@ function disableScroll(target) {
|
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
function assertIsDisableScrollElement(element) {
|
|
48
|
+
var _element, _disableScrollElementProp;
|
|
49
49
|
var _;
|
|
50
50
|
(_ = (_element = element)[_disableScrollElementProp = disableScrollElementProp]) !== null && _ !== void 0 ? _ : _element[_disableScrollElementProp] = {
|
|
51
51
|
count: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDisableBodyScroll.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["useDisableBodyScroll.js"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useCallback } from 'react';\nconst disableScrollElementProp = '__fluentDisableScrollElement';\n/**\n * hook that disables body scrolling through `overflow: hidden` CSS property\n */ export function useDisableBodyScroll() {\n const { targetDocument } = useFluent_unstable();\n return useCallback(()=>{\n if (targetDocument) {\n return disableScroll(targetDocument.body);\n }\n }, [\n targetDocument\n ]);\n}\n/**\n * disables scrolling from a given element through `overflow: hidden` CSS property\n * @param target - element to disable scrolling from\n * @returns a method for enabling scrolling again\n */ export function disableScroll(target) {\n var _target_ownerDocument_defaultView;\n const { clientWidth } = target.ownerDocument.documentElement;\n var _target_ownerDocument_defaultView_innerWidth;\n const innerWidth = (_target_ownerDocument_defaultView_innerWidth = (_target_ownerDocument_defaultView = target.ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.innerWidth) !== null && _target_ownerDocument_defaultView_innerWidth !== void 0 ? _target_ownerDocument_defaultView_innerWidth : 0;\n assertIsDisableScrollElement(target);\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = 'hidden';\n target.style.paddingRight = `${innerWidth - clientWidth}px`;\n }\n target[disableScrollElementProp].count++;\n return ()=>{\n target[disableScrollElementProp].count--;\n if (target[disableScrollElementProp].count === 0) {\n target.style.overflow = target[disableScrollElementProp].previousOverflowStyle;\n target.style.paddingRight = target[disableScrollElementProp].previousPaddingRightStyle;\n }\n };\n}\nfunction assertIsDisableScrollElement(element) {\n var _element, _disableScrollElementProp;\n var _;\n (_ = (_element = element)[_disableScrollElementProp = disableScrollElementProp]) !== null && _ !== void 0 ? _ : _element[_disableScrollElementProp] = {\n count: 0,\n previousOverflowStyle: element.style.overflow,\n previousPaddingRightStyle: element.style.paddingRight\n };\n}\n"],"names":["useDisableBodyScroll","disableScroll","disableScrollElementProp","targetDocument","useFluent_unstable","useCallback","body","target","_target_ownerDocument_defaultView","clientWidth","ownerDocument","documentElement","_target_ownerDocument_defaultView_innerWidth","innerWidth","defaultView","assertIsDisableScrollElement","count","style","overflow","paddingRight","previousOverflowStyle","previousPaddingRightStyle","element","_element","_disableScrollElementProp","_"],"mappings":";;;;;;;;;;;IAKoBA,oBAAoB,MAApBA;IAcAC,aAAa,MAAbA;;qCAnBe;uBACP;AAC5B,MAAMC,2BAA2B;AAGtB,SAASF,uBAAuB;IACvC,MAAM,EAAEG,eAAc,EAAG,GAAGC,IAAAA,uCAAkB;IAC9C,OAAOC,IAAAA,kBAAW,EAAC,IAAI;QACnB,IAAIF,gBAAgB;YAChB,OAAOF,cAAcE,eAAeG,IAAI;QAC5C,CAAC;IACL,GAAG;QACCH;KACH;AACL;AAKW,SAASF,cAAcM,MAAM,EAAE;IACtC,IAAIC;IACJ,MAAM,EAAEC,YAAW,EAAG,GAAGF,OAAOG,aAAa,CAACC,eAAe;IAC7D,IAAIC;IACJ,MAAMC,aAAa,AAACD,CAAAA,+CAA+C,AAACJ,CAAAA,oCAAoCD,OAAOG,aAAa,CAACI,WAAW,AAAD,MAAO,IAAI,IAAIN,sCAAsC,KAAK,IAAI,KAAK,IAAIA,kCAAkCK,UAAU,AAAD,MAAO,IAAI,IAAID,iDAAiD,KAAK,IAAIA,+CAA+C,CAAC;IAClXG,6BAA6BR;IAC7B,IAAIA,MAAM,CAACL,yBAAyB,CAACc,KAAK,KAAK,GAAG;QAC9CT,OAAOU,KAAK,CAACC,QAAQ,GAAG;QACxBX,OAAOU,KAAK,CAACE,YAAY,GAAG,CAAC,EAAEN,aAAaJ,YAAY,EAAE,CAAC;IAC/D,CAAC;IACDF,MAAM,CAACL,yBAAyB,CAACc,KAAK;IACtC,OAAO,IAAI;QACPT,MAAM,CAACL,yBAAyB,CAACc,KAAK;QACtC,IAAIT,MAAM,CAACL,yBAAyB,CAACc,KAAK,KAAK,GAAG;YAC9CT,OAAOU,KAAK,CAACC,QAAQ,GAAGX,MAAM,CAACL,yBAAyB,CAACkB,qBAAqB;YAC9Eb,OAAOU,KAAK,CAACE,YAAY,GAAGZ,MAAM,CAACL,yBAAyB,CAACmB,yBAAyB;QAC1F,CAAC;IACL;AACJ;AACA,SAASN,6BAA6BO,OAAO,EAAE;IAC3C,IAAIC,UAAUC;IACd,IAAIC;IACHA,CAAAA,IAAI,AAACF,CAAAA,WAAWD,OAAM,CAAE,CAACE,4BAA4BtB,yBAAyB,AAAD,MAAO,IAAI,IAAIuB,MAAM,KAAK,IAAIA,IAAIF,QAAQ,CAACC,0BAA0B,GAAG;QAClJR,OAAO;QACPI,uBAAuBE,QAAQL,KAAK,CAACC,QAAQ;QAC7CG,2BAA2BC,QAAQL,KAAK,CAACE,YAAY;IACzD,CAAC;AACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.19",
|
|
4
4
|
"description": "Dialog component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"@fluentui/react-jsx-runtime": "9.0.0-alpha.12",
|
|
41
41
|
"@fluentui/keyboard-keys": "^9.0.3",
|
|
42
42
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
43
|
-
"@fluentui/react-shared-contexts": "^9.
|
|
43
|
+
"@fluentui/react-shared-contexts": "^9.7.0",
|
|
44
44
|
"@fluentui/react-aria": "^9.3.27",
|
|
45
|
-
"@fluentui/react-icons": "^2.0.
|
|
46
|
-
"@fluentui/react-tabster": "^9.
|
|
45
|
+
"@fluentui/react-icons": "^2.0.207",
|
|
46
|
+
"@fluentui/react-tabster": "^9.11.1",
|
|
47
47
|
"@fluentui/react-theme": "^9.1.9",
|
|
48
|
-
"@fluentui/react-portal": "^9.3.
|
|
48
|
+
"@fluentui/react-portal": "^9.3.4",
|
|
49
49
|
"@griffel/react": "^1.5.7",
|
|
50
50
|
"@swc/helpers": "^0.4.14"
|
|
51
51
|
},
|