@fluentui/react-dialog 9.0.0-beta.9 → 9.0.1-0

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.
Files changed (86) hide show
  1. package/CHANGELOG.json +156 -2
  2. package/CHANGELOG.md +56 -3
  3. package/README.md +41 -1
  4. package/dist/index.d.ts +30 -19
  5. package/lib/components/Dialog/Dialog.types.js.map +1 -1
  6. package/lib/components/Dialog/useDialog.js +5 -6
  7. package/lib/components/Dialog/useDialog.js.map +1 -1
  8. package/lib/components/Dialog/useDialogContextValues.js +4 -4
  9. package/lib/components/Dialog/useDialogContextValues.js.map +1 -1
  10. package/lib/components/DialogBody/useDialogBody.js +3 -3
  11. package/lib/components/DialogBody/useDialogBody.js.map +1 -1
  12. package/lib/components/DialogBody/useDialogBodyStyles.js +25 -17
  13. package/lib/components/DialogBody/useDialogBodyStyles.js.map +1 -1
  14. package/lib/components/DialogContent/DialogContent.js +2 -1
  15. package/lib/components/DialogContent/DialogContent.js.map +1 -1
  16. package/lib/components/DialogContent/DialogContent.types.js.map +1 -1
  17. package/lib/components/DialogContent/renderDialogContent.js +1 -2
  18. package/lib/components/DialogContent/renderDialogContent.js.map +1 -1
  19. package/lib/components/DialogContent/useDialogContent.js +11 -10
  20. package/lib/components/DialogContent/useDialogContent.js.map +1 -1
  21. package/lib/components/DialogContent/useDialogContentStyles.js +23 -9
  22. package/lib/components/DialogContent/useDialogContentStyles.js.map +1 -1
  23. package/lib/components/DialogSurface/DialogSurface.types.js.map +1 -1
  24. package/lib/components/DialogSurface/useDialogSurface.js +10 -81
  25. package/lib/components/DialogSurface/useDialogSurface.js.map +1 -1
  26. package/lib/components/DialogSurface/useDialogSurfaceStyles.js +61 -59
  27. package/lib/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
  28. package/lib/components/DialogTitle/DialogTitle.types.js.map +1 -1
  29. package/lib/components/DialogTitle/useDialogTitle.js +2 -1
  30. package/lib/components/DialogTitle/useDialogTitle.js.map +1 -1
  31. package/lib/components/DialogTitle/useDialogTitleStyles.js +29 -29
  32. package/lib/components/DialogTrigger/DialogTrigger.types.js.map +1 -1
  33. package/lib/components/DialogTrigger/useDialogTrigger.js +12 -8
  34. package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  35. package/lib/contexts/constants.js +1 -1
  36. package/lib/contexts/constants.js.map +1 -1
  37. package/lib/contexts/dialogContext.js.map +1 -1
  38. package/lib/utils/index.js +0 -2
  39. package/lib/utils/index.js.map +1 -1
  40. package/lib/utils/isEscapeKeyDown.js +1 -4
  41. package/lib/utils/isEscapeKeyDown.js.map +1 -1
  42. package/lib/utils/useFocusFirstElement.js +7 -8
  43. package/lib/utils/useFocusFirstElement.js.map +1 -1
  44. package/lib-commonjs/components/Dialog/useDialog.js +3 -4
  45. package/lib-commonjs/components/Dialog/useDialog.js.map +1 -1
  46. package/lib-commonjs/components/Dialog/useDialogContextValues.js +4 -4
  47. package/lib-commonjs/components/Dialog/useDialogContextValues.js.map +1 -1
  48. package/lib-commonjs/components/DialogBody/useDialogBody.js +3 -4
  49. package/lib-commonjs/components/DialogBody/useDialogBody.js.map +1 -1
  50. package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js +25 -18
  51. package/lib-commonjs/components/DialogBody/useDialogBodyStyles.js.map +1 -1
  52. package/lib-commonjs/components/DialogContent/DialogContent.js +2 -1
  53. package/lib-commonjs/components/DialogContent/DialogContent.js.map +1 -1
  54. package/lib-commonjs/components/DialogContent/renderDialogContent.js +1 -2
  55. package/lib-commonjs/components/DialogContent/renderDialogContent.js.map +1 -1
  56. package/lib-commonjs/components/DialogContent/useDialogContent.js +12 -10
  57. package/lib-commonjs/components/DialogContent/useDialogContent.js.map +1 -1
  58. package/lib-commonjs/components/DialogContent/useDialogContentStyles.js +24 -8
  59. package/lib-commonjs/components/DialogContent/useDialogContentStyles.js.map +1 -1
  60. package/lib-commonjs/components/DialogSurface/useDialogSurface.js +10 -81
  61. package/lib-commonjs/components/DialogSurface/useDialogSurface.js.map +1 -1
  62. package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js +62 -60
  63. package/lib-commonjs/components/DialogSurface/useDialogSurfaceStyles.js.map +1 -1
  64. package/lib-commonjs/components/DialogTitle/useDialogTitle.js +2 -1
  65. package/lib-commonjs/components/DialogTitle/useDialogTitle.js.map +1 -1
  66. package/lib-commonjs/components/DialogTitle/useDialogTitleStyles.js +29 -29
  67. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +12 -9
  68. package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
  69. package/lib-commonjs/contexts/constants.js +2 -2
  70. package/lib-commonjs/contexts/constants.js.map +1 -1
  71. package/lib-commonjs/contexts/dialogContext.js.map +1 -1
  72. package/lib-commonjs/utils/index.js +0 -4
  73. package/lib-commonjs/utils/index.js.map +1 -1
  74. package/lib-commonjs/utils/isEscapeKeyDown.js +1 -5
  75. package/lib-commonjs/utils/isEscapeKeyDown.js.map +1 -1
  76. package/lib-commonjs/utils/useFocusFirstElement.js +7 -9
  77. package/lib-commonjs/utils/useFocusFirstElement.js.map +1 -1
  78. package/package.json +9 -11
  79. package/lib/utils/isHTMLDialogElement.js +0 -4
  80. package/lib/utils/isHTMLDialogElement.js.map +0 -1
  81. package/lib/utils/useControlNativeDialogOpenState.js +0 -20
  82. package/lib/utils/useControlNativeDialogOpenState.js.map +0 -1
  83. package/lib-commonjs/utils/isHTMLDialogElement.js +0 -13
  84. package/lib-commonjs/utils/isHTMLDialogElement.js.map +0 -1
  85. package/lib-commonjs/utils/useControlNativeDialogOpenState.js +0 -31
  86. package/lib-commonjs/utils/useControlNativeDialogOpenState.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,161 @@
2
2
  "name": "@fluentui/react-dialog",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 20 Sep 2022 20:54:06 GMT",
5
+ "date": "Thu, 13 Oct 2022 12:55:51 GMT",
6
+ "tag": "@fluentui/react-dialog_v9.0.1-0",
7
+ "version": "9.0.1-0",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "bernardo.sunderhus@gmail.com",
12
+ "package": "@fluentui/react-dialog",
13
+ "commit": "e563f3daaea9b7cc62f50bc15edd44edf5045107",
14
+ "comment": "feat: adds disableButtonEnhancement property on DialogTrigger"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 13 Oct 2022 11:02:48 GMT",
21
+ "tag": "@fluentui/react-dialog_v9.0.0",
22
+ "version": "9.0.0",
23
+ "comments": {
24
+ "prerelease": [
25
+ {
26
+ "author": "olfedias@microsoft.com",
27
+ "package": "@fluentui/react-dialog",
28
+ "commit": "1a527d440e0497ef8046b3ce240492241e7a04ac",
29
+ "comment": "chore: Update Griffel to latest version"
30
+ },
31
+ {
32
+ "author": "bernardo.sunderhus@gmail.com",
33
+ "package": "@fluentui/react-dialog",
34
+ "commit": "12222c2cfb1851ac6fbf57d17a1573432e842ec7",
35
+ "comment": "feat: focus on surface if no focusable element is available"
36
+ },
37
+ {
38
+ "author": "bernardo.sunderhus@gmail.com",
39
+ "package": "@fluentui/react-dialog",
40
+ "commit": "17c5fe742918bbc41ed22f492a289f53bffc5008",
41
+ "comment": "chore: improves DialogTrigger types"
42
+ },
43
+ {
44
+ "author": "bernardo.sunderhus@gmail.com",
45
+ "package": "@fluentui/react-dialog",
46
+ "commit": "443c503b94e602e55857e4e311413c6257d60766",
47
+ "comment": "chore: cleanups in types"
48
+ },
49
+ {
50
+ "author": "bernardo.sunderhus@gmail.com",
51
+ "package": "@fluentui/react-dialog",
52
+ "commit": "b48083b3009bc75f28c328de0024eb400b989145",
53
+ "comment": "fix: aria-* properties should be reassignable"
54
+ }
55
+ ],
56
+ "patch": [
57
+ {
58
+ "author": "bernardo.sunderhus@gmail.com",
59
+ "package": "@fluentui/react-dialog",
60
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a",
61
+ "comment": "feat: react-dialog stable release"
62
+ },
63
+ {
64
+ "author": "beachball",
65
+ "package": "@fluentui/react-dialog",
66
+ "comment": "Bump @fluentui/react-utilities to v9.1.1",
67
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
68
+ },
69
+ {
70
+ "author": "beachball",
71
+ "package": "@fluentui/react-dialog",
72
+ "comment": "Bump @fluentui/react-context-selector to v9.0.4",
73
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
74
+ },
75
+ {
76
+ "author": "beachball",
77
+ "package": "@fluentui/react-dialog",
78
+ "comment": "Bump @fluentui/react-aria to v9.2.2",
79
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
80
+ },
81
+ {
82
+ "author": "beachball",
83
+ "package": "@fluentui/react-dialog",
84
+ "comment": "Bump @fluentui/react-tabster to v9.1.3",
85
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
86
+ },
87
+ {
88
+ "author": "beachball",
89
+ "package": "@fluentui/react-dialog",
90
+ "comment": "Bump @fluentui/react-portal to v9.0.7",
91
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
92
+ },
93
+ {
94
+ "author": "beachball",
95
+ "package": "@fluentui/react-dialog",
96
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.15",
97
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
98
+ }
99
+ ],
100
+ "none": [
101
+ {
102
+ "author": "email not defined",
103
+ "package": "@fluentui/react-dialog",
104
+ "commit": "42acccd4445b42c806f957de00e5f2567589279f",
105
+ "comment": "chore: updates stories and tests"
106
+ }
107
+ ]
108
+ }
109
+ },
110
+ {
111
+ "date": "Mon, 03 Oct 2022 22:24:36 GMT",
112
+ "tag": "@fluentui/react-dialog_v9.0.0-beta.11",
113
+ "version": "9.0.0-beta.11",
114
+ "comments": {
115
+ "prerelease": [
116
+ {
117
+ "author": "bernardo.sunderhus@gmail.com",
118
+ "package": "@fluentui/react-dialog",
119
+ "commit": "da8a1d4d97efdb6d95818b605136415d9428e811",
120
+ "comment": "feat: removes DialogSurface native dialog support "
121
+ },
122
+ {
123
+ "author": "beachball",
124
+ "package": "@fluentui/react-dialog",
125
+ "comment": "Bump @fluentui/react-aria to v9.2.1",
126
+ "commit": "67a8c98b8d53cd2fa14d668cf639b867b68ad18a"
127
+ },
128
+ {
129
+ "author": "beachball",
130
+ "package": "@fluentui/react-dialog",
131
+ "comment": "Bump @fluentui/react-tabster to v9.1.2",
132
+ "commit": "67a8c98b8d53cd2fa14d668cf639b867b68ad18a"
133
+ },
134
+ {
135
+ "author": "beachball",
136
+ "package": "@fluentui/react-dialog",
137
+ "comment": "Bump @fluentui/react-portal to v9.0.6",
138
+ "commit": "67a8c98b8d53cd2fa14d668cf639b867b68ad18a"
139
+ }
140
+ ]
141
+ }
142
+ },
143
+ {
144
+ "date": "Fri, 23 Sep 2022 10:32:29 GMT",
145
+ "tag": "@fluentui/react-dialog_v9.0.0-beta.10",
146
+ "version": "9.0.0-beta.10",
147
+ "comments": {
148
+ "prerelease": [
149
+ {
150
+ "author": "bernardo.sunderhus@gmail.com",
151
+ "package": "@fluentui/react-dialog",
152
+ "commit": "4dd18085b968e10d512c179705d31148e28148b4",
153
+ "comment": "feat: implements DialogContent as a swap of DialogBody"
154
+ }
155
+ ]
156
+ }
157
+ },
158
+ {
159
+ "date": "Tue, 20 Sep 2022 20:55:44 GMT",
6
160
  "tag": "@fluentui/react-dialog_v9.0.0-beta.9",
7
161
  "version": "9.0.0-beta.9",
8
162
  "comments": {
@@ -17,7 +171,7 @@
17
171
  "author": "beachball",
18
172
  "package": "@fluentui/react-dialog",
19
173
  "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.14",
20
- "commit": "9617a5a46ef4c5e310a066a5374ff2ed61db3c66"
174
+ "commit": "4ceba844c804a2f49b0465389100e7a3dabf116e"
21
175
  }
22
176
  ],
23
177
  "none": [
package/CHANGELOG.md CHANGED
@@ -1,18 +1,71 @@
1
1
  # Change Log - @fluentui/react-dialog
2
2
 
3
- This log was last generated on Tue, 20 Sep 2022 20:54:06 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 13 Oct 2022 12:55:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.1-0](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.0.1-0)
8
+
9
+ Thu, 13 Oct 2022 12:55:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.0.0..@fluentui/react-dialog_v9.0.1-0)
11
+
12
+ ### Changes
13
+
14
+ - feat: adds disableButtonEnhancement property on DialogTrigger ([PR #25112](https://github.com/microsoft/fluentui/pull/25112) by bernardo.sunderhus@gmail.com)
15
+
16
+ ## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.0.0)
17
+
18
+ Thu, 13 Oct 2022 11:02:48 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.0.0-beta.11..@fluentui/react-dialog_v9.0.0)
20
+
21
+ ### Patches
22
+
23
+ - feat: react-dialog stable release ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by bernardo.sunderhus@gmail.com)
24
+ - Bump @fluentui/react-utilities to v9.1.1 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
25
+ - Bump @fluentui/react-context-selector to v9.0.4 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
26
+ - Bump @fluentui/react-aria to v9.2.2 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
27
+ - Bump @fluentui/react-tabster to v9.1.3 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
28
+ - Bump @fluentui/react-portal to v9.0.7 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
29
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.15 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
30
+
31
+ ### Changes
32
+
33
+ - chore: Update Griffel to latest version ([PR #25075](https://github.com/microsoft/fluentui/pull/25075) by olfedias@microsoft.com)
34
+ - feat: focus on surface if no focusable element is available ([PR #25173](https://github.com/microsoft/fluentui/pull/25173) by bernardo.sunderhus@gmail.com)
35
+ - chore: improves DialogTrigger types ([PR #25044](https://github.com/microsoft/fluentui/pull/25044) by bernardo.sunderhus@gmail.com)
36
+ - chore: cleanups in types ([PR #25070](https://github.com/microsoft/fluentui/pull/25070) by bernardo.sunderhus@gmail.com)
37
+ - fix: aria-* properties should be reassignable ([PR #25092](https://github.com/microsoft/fluentui/pull/25092) by bernardo.sunderhus@gmail.com)
38
+
39
+ ## [9.0.0-beta.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.0.0-beta.11)
40
+
41
+ Mon, 03 Oct 2022 22:24:36 GMT
42
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.0.0-beta.10..@fluentui/react-dialog_v9.0.0-beta.11)
43
+
44
+ ### Changes
45
+
46
+ - feat: removes DialogSurface native dialog support ([PR #24979](https://github.com/microsoft/fluentui/pull/24979) by bernardo.sunderhus@gmail.com)
47
+ - Bump @fluentui/react-aria to v9.2.1 ([PR #25055](https://github.com/microsoft/fluentui/pull/25055) by beachball)
48
+ - Bump @fluentui/react-tabster to v9.1.2 ([PR #25055](https://github.com/microsoft/fluentui/pull/25055) by beachball)
49
+ - Bump @fluentui/react-portal to v9.0.6 ([PR #25055](https://github.com/microsoft/fluentui/pull/25055) by beachball)
50
+
51
+ ## [9.0.0-beta.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.0.0-beta.10)
52
+
53
+ Fri, 23 Sep 2022 10:32:29 GMT
54
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.0.0-beta.9..@fluentui/react-dialog_v9.0.0-beta.10)
55
+
56
+ ### Changes
57
+
58
+ - feat: implements DialogContent as a swap of DialogBody ([PR #24855](https://github.com/microsoft/fluentui/pull/24855) by bernardo.sunderhus@gmail.com)
59
+
7
60
  ## [9.0.0-beta.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.0.0-beta.9)
8
61
 
9
- Tue, 20 Sep 2022 20:54:06 GMT
62
+ Tue, 20 Sep 2022 20:55:44 GMT
10
63
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.0.0-beta.8..@fluentui/react-dialog_v9.0.0-beta.9)
11
64
 
12
65
  ### Changes
13
66
 
14
67
  - bugfix(react-dialog): Adds color style to DialogSurface ([PR #24832](https://github.com/microsoft/fluentui/pull/24832) by bernardo.sunderhus@gmail.com)
15
- - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.14 ([PR #24870](https://github.com/microsoft/fluentui/pull/24870) by beachball)
68
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.14 ([PR #24869](https://github.com/microsoft/fluentui/pull/24869) by beachball)
16
69
 
17
70
  ## [9.0.0-beta.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.0.0-beta.8)
18
71
 
package/README.md CHANGED
@@ -2,4 +2,44 @@
2
2
 
3
3
  **React Dialog components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
4
 
5
- These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
5
+ To import React Dialog components:
6
+
7
+ ```jsx
8
+ import * as React from 'react';
9
+ import {
10
+ Button,
11
+ Dialog,
12
+ DialogTrigger,
13
+ DialogSurface,
14
+ DialogTitle,
15
+ DialogBody,
16
+ DialogActions,
17
+ DialogContent,
18
+ } from '@fluentui/react-components';
19
+
20
+ export const DialogExample = () => {
21
+ return (
22
+ <Dialog>
23
+ <DialogTrigger>
24
+ <Button>Open dialog</Button>
25
+ </DialogTrigger>
26
+ <DialogSurface>
27
+ <DialogBody>
28
+ <DialogTitle>Dialog title</DialogTitle>
29
+ <DialogContent>
30
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam exercitationem cumque repellendus eaque
31
+ est dolor eius expedita nulla ullam? Tenetur reprehenderit aut voluptatum impedit voluptates in natus iure
32
+ cumque eaque?
33
+ </DialogContent>
34
+ <DialogActions>
35
+ <DialogTrigger>
36
+ <Button appearance="secondary">Close</Button>
37
+ </DialogTrigger>
38
+ <Button appearance="primary">Do Something</Button>
39
+ </DialogActions>
40
+ </DialogBody>
41
+ </DialogSurface>
42
+ </Dialog>
43
+ );
44
+ };
45
+ ```
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import * as React_2 from 'react';
11
11
  import { ReactElement } from 'react';
12
12
  import type { Slot } from '@fluentui/react-utilities';
13
13
  import type { SlotClassNames } from '@fluentui/react-utilities';
14
+ import type { TriggerProps } from '@fluentui/react-utilities';
14
15
 
15
16
  /**
16
17
  * The `Dialog` root level component serves as an interface for interaction with all possible behaviors exposed.
@@ -76,7 +77,8 @@ export declare type DialogBodySlots = {
76
77
  export declare type DialogBodyState = ComponentState<DialogBodySlots>;
77
78
 
78
79
  /**
79
- * DialogContent component - TODO: add more docs
80
+ * The `DialogContent` is a container where the content of the dialog is rendered.
81
+ * Apart from styling, this component does not have other behavior.
80
82
  */
81
83
  export declare const DialogContent: ForwardRefComponent<DialogContentProps>;
82
84
 
@@ -85,7 +87,7 @@ export declare const dialogContentClassNames: SlotClassNames<DialogContentSlots>
85
87
  /**
86
88
  * DialogContent Props
87
89
  */
88
- export declare type DialogContentProps = ComponentProps<DialogContentSlots> & {};
90
+ export declare type DialogContentProps = ComponentProps<DialogContentSlots>;
89
91
 
90
92
  export declare type DialogContentSlots = {
91
93
  root: Slot<'div'>;
@@ -98,8 +100,8 @@ export declare type DialogContentState = ComponentState<DialogContentSlots>;
98
100
 
99
101
  declare type DialogContextValue = {
100
102
  open: boolean;
101
- dialogBodyID?: string;
102
- dialogTitleID?: string;
103
+ dialogContentId?: string;
104
+ dialogTitleId?: string;
103
105
  isNestedDialog: boolean;
104
106
  dialogRef: React_2.Ref<DialogSurfaceElement>;
105
107
  modalType: DialogModalType;
@@ -147,7 +149,8 @@ export declare type DialogOpenChangeEvent = DialogOpenChangeData['event'];
147
149
  * Callback fired when the component changes value from open state.
148
150
  *
149
151
  * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`
150
- * @param data - A data object with relevant information, such as open value and type
152
+ * @param data - A data object with relevant information,
153
+ * such as open value and type of interaction that created the event
151
154
  */
152
155
  export declare type DialogOpenChangeEventHandler = (event: DialogOpenChangeEvent, data: DialogOpenChangeData) => void;
153
156
 
@@ -181,6 +184,13 @@ export declare type DialogProps = ComponentProps<Partial<DialogSlots>> & {
181
184
  * @default false
182
185
  */
183
186
  defaultOpen?: boolean;
187
+ /**
188
+ * Callback fired when the component changes value from open state.
189
+ *
190
+ * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`
191
+ * @param data - A data object with relevant information,
192
+ * such as open value and type of interaction that created the event
193
+ */
184
194
  onOpenChange?: DialogOpenChangeEventHandler;
185
195
  /**
186
196
  * Can contain two children including {@link DialogTrigger} and {@link DialogSurface}.
@@ -234,7 +244,7 @@ export declare type DialogSurfaceSlots = {
234
244
  * since native `<dialog>` element supports [::backdrop](https://developer.mozilla.org/en-US/docs/Web/CSS/::backdrop)
235
245
  */
236
246
  backdrop?: Slot<'div'>;
237
- root: NonNullable<Slot<'dialog', 'div'>>;
247
+ root: Slot<'div'>;
238
248
  };
239
249
 
240
250
  /**
@@ -253,7 +263,7 @@ export declare const dialogTitleClassNames: SlotClassNames<DialogTitleSlots>;
253
263
  /**
254
264
  * DialogTitle Props
255
265
  */
256
- export declare type DialogTitleProps = ComponentProps<DialogTitleSlots> & {};
266
+ export declare type DialogTitleProps = ComponentProps<DialogTitleSlots>;
257
267
 
258
268
  export declare type DialogTitleSlots = {
259
269
  /**
@@ -289,23 +299,24 @@ export declare type DialogTriggerAction = 'open' | 'close';
289
299
  * Props that are passed to the child of the DialogTrigger when cloned to ensure correct behaviour for the Dialog
290
300
  */
291
301
  export declare type DialogTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<Type, Props & {
292
- ref: React_2.Ref<unknown>;
293
302
  'aria-haspopup'?: 'dialog';
294
303
  }>;
295
304
 
296
- export declare type DialogTriggerProps = {
305
+ export declare type DialogTriggerProps = TriggerProps<DialogTriggerChildProps> & {
297
306
  /**
298
307
  * Explicitly declare if the trigger is responsible for opening or
299
308
  * closing a Dialog visibility state.
300
- * @default 'open' // if it's outside DialogSurface
301
- * @default 'close' // if it's inside DialogSurface
309
+ *
310
+ * If `DialogTrigger` is outside `DialogSurface` then it'll be `open` by default
311
+ *
312
+ * If `DialogTrigger` is inside `DialogSurface` then it'll be `close` by default
302
313
  */
303
314
  action?: DialogTriggerAction;
304
315
  /**
305
- * Explicitly require single child or render function
306
- * to inject properties
316
+ * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.
317
+ * @default false
307
318
  */
308
- children: React_2.ReactElement | ((props: DialogTriggerChildProps) => React_2.ReactElement | null);
319
+ disableButtonEnhancement?: boolean;
309
320
  };
310
321
 
311
322
  export declare type DialogTriggerState = {
@@ -392,13 +403,13 @@ export declare const useDialogBody_unstable: (props: DialogBodyProps, ref: React
392
403
  export declare const useDialogBodyStyles_unstable: (state: DialogBodyState) => DialogBodyState;
393
404
 
394
405
  /**
395
- * Create the state required to render DialogContent.
406
+ * Create the state required to render DialogBody.
396
407
  *
397
- * The returned state can be modified with hooks such as useDialogContentStyles_unstable,
398
- * before being passed to renderDialogContent_unstable.
408
+ * The returned state can be modified with hooks such as useDialogBodyStyles_unstable,
409
+ * before being passed to renderDialogBody_unstable.
399
410
  *
400
- * @param props - props from this instance of DialogContent
401
- * @param ref - reference to root HTMLElement of DialogContent
411
+ * @param props - props from this instance of DialogBody
412
+ * @param ref - reference to root HTMLElement of DialogBody
402
413
  */
403
414
  export declare const useDialogContent_unstable: (props: DialogContentProps, ref: React_2.Ref<HTMLElement>) => DialogContentState;
404
415
 
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface/DialogSurface.types';\n\nexport type DialogSlots = {};\n\nexport type DialogOpenChangeEvent = DialogOpenChangeData['event'];\n\nexport type DialogOpenChangeData =\n | {\n /**\n * triggered when Escape key is pressed in a native `dialog`\n */\n type: 'dialogCancel';\n open: boolean;\n event: React.SyntheticEvent<DialogSurfaceElement>;\n }\n | {\n type: 'escapeKeyDown';\n open: boolean;\n event: React.KeyboardEvent<DialogSurfaceElement>;\n }\n | {\n type: 'backdropClick';\n open: boolean;\n event: React.MouseEvent<DialogSurfaceElement>;\n }\n | {\n type: 'triggerClick';\n open: boolean;\n event: React.MouseEvent<DialogSurfaceElement>;\n };\n\nexport type DialogModalType = 'modal' | 'non-modal' | 'alert';\n\n/**\n * Callback fired when the component changes value from open state.\n *\n * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`\n * @param data - A data object with relevant information, such as open value and type\n */\nexport type DialogOpenChangeEventHandler = (event: DialogOpenChangeEvent, data: DialogOpenChangeData) => void;\n\nexport type DialogContextValues = {\n dialog: DialogContextValue;\n /**\n * dialogSurface context is provided by Dialog as false\n * to ensure components inside Dialog but outside DialogSurface will consume this as false\n */\n dialogSurface: DialogSurfaceContextValue;\n};\n\nexport type DialogProps = ComponentProps<Partial<DialogSlots>> & {\n /**\n * Dialog variations.\n *\n * `modal`: When this type of dialog is open, the rest of the page is dimmed out and cannot be interacted with.\n * The tab sequence is kept within the dialog and moving the focus outside\n * the dialog will imply closing it. This is the default type of the component.\n *\n * `non-modal`: When a non-modal dialog is open, the rest of the page is not dimmed out\n * and users can interact with the rest of the page.\n * This also implies that the tab focus can move outside the dialog when it reaches the last focusable element.\n *\n * `alert`: is a special type of modal dialogs that interrupts the user's workflow\n * to communicate an important message or ask for a decision.\n * Unlike a typical modal dialog, the user must take an action through the options given to dismiss the dialog,\n * and it cannot be dismissed through the dimmed background or escape key.\n *\n * @default modal\n */\n modalType?: DialogModalType;\n /**\n * Controls the open state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Default value for the uncontrolled open state of the dialog.\n * @default false\n */\n defaultOpen?: boolean;\n onOpenChange?: DialogOpenChangeEventHandler;\n /**\n * Can contain two children including {@link DialogTrigger} and {@link DialogSurface}.\n * Alternatively can only contain {@link DialogSurface} if using trigger outside dialog, or controlling state.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n};\n\nexport type DialogState = ComponentState<DialogSlots> &\n DialogContextValue & {\n content: React.ReactNode;\n trigger: React.ReactNode;\n };\n"]}
1
+ {"version":3,"file":"Dialog.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-dialog/src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogSurfaceElement } from '../DialogSurface/DialogSurface.types';\n\nexport type DialogSlots = {};\n\nexport type DialogOpenChangeEvent = DialogOpenChangeData['event'];\n\nexport type DialogOpenChangeData =\n | {\n /**\n * triggered when Escape key is pressed in a native `dialog`\n */\n type: 'dialogCancel';\n open: boolean;\n event: React.SyntheticEvent<DialogSurfaceElement>;\n }\n | {\n type: 'escapeKeyDown';\n open: boolean;\n event: React.KeyboardEvent<DialogSurfaceElement>;\n }\n | {\n type: 'backdropClick';\n open: boolean;\n event: React.MouseEvent<DialogSurfaceElement>;\n }\n | {\n type: 'triggerClick';\n open: boolean;\n event: React.MouseEvent<DialogSurfaceElement>;\n };\n\nexport type DialogModalType = 'modal' | 'non-modal' | 'alert';\n\n/**\n * Callback fired when the component changes value from open state.\n *\n * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event\n */\nexport type DialogOpenChangeEventHandler = (event: DialogOpenChangeEvent, data: DialogOpenChangeData) => void;\n\nexport type DialogContextValues = {\n dialog: DialogContextValue;\n /**\n * dialogSurface context is provided by Dialog as false\n * to ensure components inside Dialog but outside DialogSurface will consume this as false\n */\n dialogSurface: DialogSurfaceContextValue;\n};\n\nexport type DialogProps = ComponentProps<Partial<DialogSlots>> & {\n /**\n * Dialog variations.\n *\n * `modal`: When this type of dialog is open, the rest of the page is dimmed out and cannot be interacted with.\n * The tab sequence is kept within the dialog and moving the focus outside\n * the dialog will imply closing it. This is the default type of the component.\n *\n * `non-modal`: When a non-modal dialog is open, the rest of the page is not dimmed out\n * and users can interact with the rest of the page.\n * This also implies that the tab focus can move outside the dialog when it reaches the last focusable element.\n *\n * `alert`: is a special type of modal dialogs that interrupts the user's workflow\n * to communicate an important message or ask for a decision.\n * Unlike a typical modal dialog, the user must take an action through the options given to dismiss the dialog,\n * and it cannot be dismissed through the dimmed background or escape key.\n *\n * @default modal\n */\n modalType?: DialogModalType;\n /**\n * Controls the open state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Default value for the uncontrolled open state of the dialog.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Callback fired when the component changes value from open state.\n *\n * @param event - a React's Synthetic event or a KeyboardEvent in case of `documentEscapeKeyDown`\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event\n */\n onOpenChange?: DialogOpenChangeEventHandler;\n /**\n * Can contain two children including {@link DialogTrigger} and {@link DialogSurface}.\n * Alternatively can only contain {@link DialogSurface} if using trigger outside dialog, or controlling state.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n};\n\nexport type DialogState = ComponentState<DialogSlots> &\n DialogContextValue & {\n content: React.ReactNode;\n trigger: React.ReactNode;\n };\n"]}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect, useMergedRefs } from '@fluentui/react-utilities';
2
+ import { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
3
3
  import { useHasParentContext } from '@fluentui/react-context-selector';
4
- import { useControlNativeDialogOpenState, useDisableBodyScroll, useFocusFirstElement } from '../../utils';
4
+ import { useDisableBodyScroll, useFocusFirstElement } from '../../utils';
5
5
  import { DialogContext } from '../../contexts';
6
6
  /**
7
7
  * Create the state required to render Dialog.
@@ -33,7 +33,6 @@ export const useDialog_unstable = props => {
33
33
  }
34
34
  });
35
35
  const focusRef = useFocusFirstElement(open, modalType);
36
- const nativeControlRef = useControlNativeDialogOpenState(open, modalType);
37
36
  const disableBodyScroll = useDisableBodyScroll();
38
37
  const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');
39
38
  useIsomorphicLayoutEffect(() => {
@@ -50,10 +49,10 @@ export const useDialog_unstable = props => {
50
49
  content: open ? content : null,
51
50
  trigger,
52
51
  requestOpenChange,
53
- dialogBodyID: useId('dialog-body-'),
54
- dialogTitleID: useId('dialog-title-'),
52
+ dialogContentId: useId('dialog-content-'),
53
+ dialogTitleId: useId('dialog-title-'),
55
54
  isNestedDialog: useHasParentContext(DialogContext),
56
- dialogRef: useMergedRefs(focusRef, nativeControlRef)
55
+ dialogRef: focusRef
57
56
  };
58
57
  };
59
58
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,oBADF,EAEE,gBAFF,EAGE,KAHF,EAIE,yBAJF,EAKE,aALF,QAMO,2BANP;AAOA,SAAS,mBAAT,QAAoC,kCAApC;AACA,SAAS,+BAAT,EAA0C,oBAA1C,EAAgE,oBAAhE,QAA4F,aAA5F;AACA,SAAS,aAAT,QAA8B,gBAA9B;AAIA;;;;;;;AAOG;;AACH,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoC;EACpE,MAAM;IAAE,QAAF;IAAY,SAAS,GAAG,OAAxB;IAAiC;EAAjC,IAAkD,KAAxD;EAEA,MAAM,CAAC,OAAD,EAAU,OAAV,IAAqB,2BAA2B,CAAC,QAAD,CAAtD;EAEA,MAAM,CAAC,IAAD,EAAO,OAAP,IAAkB,oBAAoB,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC,IAD8B;IAE3C,YAAY,EAAE,KAAK,CAAC,WAFuB;IAG3C,YAAY,EAAE;EAH6B,CAAD,CAA5C;EAMA,MAAM,iBAAiB,GAAG,gBAAgB,CAAE,IAAD,IAA+B;IACxE,YAAY,KAAA,IAAZ,IAAA,YAAY,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAA,YAAY,CAAG,IAAI,CAAC,KAAR,EAAe,IAAf,CAAZ,CADwE,CAGxE;IACA;;IACA,IAAI,CAAC,IAAI,CAAC,KAAL,CAAW,kBAAX,EAAL,EAAsC;MACpC,OAAO,CAAC,IAAI,CAAC,IAAN,CAAP;IACD;EACF,CARyC,CAA1C;EAUA,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAD,EAAO,SAAP,CAArC;EACA,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,IAAD,EAAO,SAAP,CAAxD;EACA,MAAM,iBAAiB,GAAG,oBAAoB,EAA9C;EACA,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,KAAK,WAAvB,CAAlC;EAEA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,kBAAJ,EAAwB;MACtB,OAAO,iBAAiB,EAAxB;IACD;EACF,CAJwB,EAItB,CAAC,iBAAD,EAAoB,kBAApB,CAJsB,CAAzB;EAMA,OAAO;IACL,UAAU,EAAE;MACV,QAAQ,EAAE;IADA,CADP;IAIL,IAJK;IAKL,SALK;IAML,OAAO,EAAE,IAAI,GAAG,OAAH,GAAa,IANrB;IAOL,OAPK;IAQL,iBARK;IASL,YAAY,EAAE,KAAK,CAAC,cAAD,CATd;IAUL,aAAa,EAAE,KAAK,CAAC,eAAD,CAVf;IAWL,cAAc,EAAE,mBAAmB,CAAC,aAAD,CAX9B;IAYL,SAAS,EAAE,aAAa,CAAC,QAAD,EAAW,gBAAX;EAZnB,CAAP;AAcD,CA9CM;AAgDP;;AAEG;;AACH,SAAS,2BAAT,CACE,QADF,EAC2B;EAEzB,MAAM,aAAa,GAAG,KAAK,CAAC,QAAN,CAAe,OAAf,CAAuB,QAAvB,CAAtB;;EACA,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;IACzC,IAAI,aAAa,CAAC,MAAd,KAAyB,CAAzB,IAA8B,aAAa,CAAC,MAAd,KAAyB,CAA3D,EAA8D;MAC5D;MACA,OAAO,CAAC,IAAR,CACE,+DACE,4EAFJ;IAID;EACF;;EACD,QAAQ,aAAa,CAAC,MAAtB;IACE;IACA,KAAK,CAAL;MACE,OAAO,aAAP;IACF;;IACA,KAAK,CAAL;MACE,OAAO,CAAC,SAAD,EAAY,aAAa,CAAC,CAAD,CAAzB,CAAP;IACF;;IACA;MACE,OAAO,CAAC,SAAD,EAAY,SAAZ,CAAP;EATJ;AAWD","sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useControlNativeDialogOpenState, useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\n\nimport type { DialogOpenChangeData, DialogProps, DialogState } from './Dialog.types';\n\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */\nexport const useDialog_unstable = (props: DialogProps): DialogState => {\n const { children, modalType = 'modal', onOpenChange } = props;\n\n const [trigger, content] = childrenToTriggerAndContent(children);\n\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false,\n });\n\n const requestOpenChange = useEventCallback((data: DialogOpenChangeData) => {\n onOpenChange?.(data.event, data);\n\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n\n const focusRef = useFocusFirstElement(open, modalType);\n const nativeControlRef = useControlNativeDialogOpenState(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n\n useIsomorphicLayoutEffect(() => {\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [disableBodyScroll, isBodyScrollLocked]);\n\n return {\n components: {\n backdrop: 'div',\n },\n open,\n modalType,\n content: open ? content : null,\n trigger,\n requestOpenChange,\n dialogBodyID: useId('dialog-body-'),\n dialogTitleID: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: useMergedRefs(focusRef, nativeControlRef),\n };\n};\n\n/**\n * Extracts trigger and content from children\n */\nfunction childrenToTriggerAndContent(\n children: React.ReactNode,\n): readonly [trigger: React.ReactNode, content: React.ReactNode] {\n const childrenArray = React.Children.toArray(children) as React.ReactElement[];\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length !== 1 && childrenArray.length !== 2) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Dialog must contain at least one child <DialogSurface/>,\\n' +\n 'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)',\n );\n }\n }\n switch (childrenArray.length) {\n // case where there's a trigger followed by content\n case 2:\n return childrenArray as [trigger: React.ReactNode, content: React.ReactNode];\n // case where there's only content\n case 1:\n return [undefined, childrenArray[0]];\n // unknown case\n default:\n return [undefined, undefined];\n }\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,EAA+B,gBAA/B,EAAiD,KAAjD,EAAwD,yBAAxD,QAAyF,2BAAzF;AACA,SAAS,mBAAT,QAAoC,kCAApC;AACA,SAAS,oBAAT,EAA+B,oBAA/B,QAA2D,aAA3D;AACA,SAAS,aAAT,QAA8B,gBAA9B;AAIA;;;;;;;AAOG;;AACH,OAAO,MAAM,kBAAkB,GAAI,KAAD,IAAoC;EACpE,MAAM;IAAE,QAAF;IAAY,SAAS,GAAG,OAAxB;IAAiC;EAAjC,IAAkD,KAAxD;EAEA,MAAM,CAAC,OAAD,EAAU,OAAV,IAAqB,2BAA2B,CAAC,QAAD,CAAtD;EAEA,MAAM,CAAC,IAAD,EAAO,OAAP,IAAkB,oBAAoB,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC,IAD8B;IAE3C,YAAY,EAAE,KAAK,CAAC,WAFuB;IAG3C,YAAY,EAAE;EAH6B,CAAD,CAA5C;EAMA,MAAM,iBAAiB,GAAG,gBAAgB,CAAE,IAAD,IAA+B;IACxE,YAAY,KAAA,IAAZ,IAAA,YAAY,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAA,YAAY,CAAG,IAAI,CAAC,KAAR,EAAe,IAAf,CAAZ,CADwE,CAGxE;IACA;;IACA,IAAI,CAAC,IAAI,CAAC,KAAL,CAAW,kBAAX,EAAL,EAAsC;MACpC,OAAO,CAAC,IAAI,CAAC,IAAN,CAAP;IACD;EACF,CARyC,CAA1C;EAUA,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAD,EAAO,SAAP,CAArC;EACA,MAAM,iBAAiB,GAAG,oBAAoB,EAA9C;EACA,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,KAAK,WAAvB,CAAlC;EAEA,yBAAyB,CAAC,MAAK;IAC7B,IAAI,kBAAJ,EAAwB;MACtB,OAAO,iBAAiB,EAAxB;IACD;EACF,CAJwB,EAItB,CAAC,iBAAD,EAAoB,kBAApB,CAJsB,CAAzB;EAMA,OAAO;IACL,UAAU,EAAE;MACV,QAAQ,EAAE;IADA,CADP;IAIL,IAJK;IAKL,SALK;IAML,OAAO,EAAE,IAAI,GAAG,OAAH,GAAa,IANrB;IAOL,OAPK;IAQL,iBARK;IASL,eAAe,EAAE,KAAK,CAAC,iBAAD,CATjB;IAUL,aAAa,EAAE,KAAK,CAAC,eAAD,CAVf;IAWL,cAAc,EAAE,mBAAmB,CAAC,aAAD,CAX9B;IAYL,SAAS,EAAE;EAZN,CAAP;AAcD,CA7CM;AA+CP;;AAEG;;AACH,SAAS,2BAAT,CACE,QADF,EAC2B;EAEzB,MAAM,aAAa,GAAG,KAAK,CAAC,QAAN,CAAe,OAAf,CAAuB,QAAvB,CAAtB;;EACA,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;IACzC,IAAI,aAAa,CAAC,MAAd,KAAyB,CAAzB,IAA8B,aAAa,CAAC,MAAd,KAAyB,CAA3D,EAA8D;MAC5D;MACA,OAAO,CAAC,IAAR,CACE,+DACE,4EAFJ;IAID;EACF;;EACD,QAAQ,aAAa,CAAC,MAAtB;IACE;IACA,KAAK,CAAL;MACE,OAAO,aAAP;IACF;;IACA,KAAK,CAAL;MACE,OAAO,CAAC,SAAD,EAAY,aAAa,CAAC,CAAD,CAAzB,CAAP;IACF;;IACA;MACE,OAAO,CAAC,SAAD,EAAY,SAAZ,CAAP;EATJ;AAWD","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useId, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useDisableBodyScroll, useFocusFirstElement } from '../../utils';\nimport { DialogContext } from '../../contexts';\n\nimport type { DialogOpenChangeData, DialogProps, DialogState } from './Dialog.types';\n\n/**\n * Create the state required to render Dialog.\n *\n * The returned state can be modified with hooks such as useDialogStyles_unstable,\n * before being passed to renderDialog_unstable.\n *\n * @param props - props from this instance of Dialog\n */\nexport const useDialog_unstable = (props: DialogProps): DialogState => {\n const { children, modalType = 'modal', onOpenChange } = props;\n\n const [trigger, content] = childrenToTriggerAndContent(children);\n\n const [open, setOpen] = useControllableState({\n state: props.open,\n defaultState: props.defaultOpen,\n initialState: false,\n });\n\n const requestOpenChange = useEventCallback((data: DialogOpenChangeData) => {\n onOpenChange?.(data.event, data);\n\n // if user prevents default then do not change state value\n // otherwise updates state value and trigger reference to the element that caused the opening\n if (!data.event.isDefaultPrevented()) {\n setOpen(data.open);\n }\n });\n\n const focusRef = useFocusFirstElement(open, modalType);\n const disableBodyScroll = useDisableBodyScroll();\n const isBodyScrollLocked = Boolean(open && modalType !== 'non-modal');\n\n useIsomorphicLayoutEffect(() => {\n if (isBodyScrollLocked) {\n return disableBodyScroll();\n }\n }, [disableBodyScroll, isBodyScrollLocked]);\n\n return {\n components: {\n backdrop: 'div',\n },\n open,\n modalType,\n content: open ? content : null,\n trigger,\n requestOpenChange,\n dialogContentId: useId('dialog-content-'),\n dialogTitleId: useId('dialog-title-'),\n isNestedDialog: useHasParentContext(DialogContext),\n dialogRef: focusRef,\n };\n};\n\n/**\n * Extracts trigger and content from children\n */\nfunction childrenToTriggerAndContent(\n children: React.ReactNode,\n): readonly [trigger: React.ReactNode, content: React.ReactNode] {\n const childrenArray = React.Children.toArray(children) as React.ReactElement[];\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length !== 1 && childrenArray.length !== 2) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Dialog must contain at least one child <DialogSurface/>,\\n' +\n 'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)',\n );\n }\n }\n switch (childrenArray.length) {\n // case where there's a trigger followed by content\n case 2:\n return childrenArray as [trigger: React.ReactNode, content: React.ReactNode];\n // case where there's only content\n case 1:\n return [undefined, childrenArray[0]];\n // unknown case\n default:\n return [undefined, undefined];\n }\n}\n"],"sourceRoot":"../src/"}
@@ -2,9 +2,9 @@ export function useDialogContextValues_unstable(state) {
2
2
  const {
3
3
  modalType,
4
4
  open,
5
- dialogBodyID,
5
+ dialogContentId,
6
6
  dialogRef,
7
- dialogTitleID,
7
+ dialogTitleId,
8
8
  isNestedDialog,
9
9
  requestOpenChange
10
10
  } = state;
@@ -17,8 +17,8 @@ export function useDialogContextValues_unstable(state) {
17
17
  open,
18
18
  modalType,
19
19
  dialogRef,
20
- dialogBodyID,
21
- dialogTitleID,
20
+ dialogContentId,
21
+ dialogTitleId,
22
22
  isNestedDialog,
23
23
  requestOpenChange
24
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":"AAGA,OAAM,SAAU,+BAAV,CAA0C,KAA1C,EAA4D;EAChE,MAAM;IAAE,SAAF;IAAa,IAAb;IAAmB,YAAnB;IAAiC,SAAjC;IAA4C,aAA5C;IAA2D,cAA3D;IAA2E;EAA3E,IAAiG,KAAvG;EAEA;;;AAGG;;EACH,MAAM,MAAM,GAAuB;IACjC,IADiC;IAEjC,SAFiC;IAGjC,SAHiC;IAIjC,YAJiC;IAKjC,aALiC;IAMjC,cANiC;IAOjC;EAPiC,CAAnC;EAUA,MAAM,aAAa,GAA8B,KAAjD;EAEA,OAAO;IAAE,MAAF;IAAU;EAAV,CAAP;AACD","sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const { modalType, open, dialogBodyID, dialogRef, dialogTitleID, isNestedDialog, requestOpenChange } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog: DialogContextValue = {\n open,\n modalType,\n dialogRef,\n dialogBodyID,\n dialogTitleID,\n isNestedDialog,\n requestOpenChange,\n };\n\n const dialogSurface: DialogSurfaceContextValue = false;\n\n return { dialog, dialogSurface };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-dialog/src/components/Dialog/useDialogContextValues.ts"],"names":[],"mappings":"AAGA,OAAM,SAAU,+BAAV,CAA0C,KAA1C,EAA4D;EAChE,MAAM;IAAE,SAAF;IAAa,IAAb;IAAmB,eAAnB;IAAoC,SAApC;IAA+C,aAA/C;IAA8D,cAA9D;IAA8E;EAA9E,IAAoG,KAA1G;EAEA;;;AAGG;;EACH,MAAM,MAAM,GAAuB;IACjC,IADiC;IAEjC,SAFiC;IAGjC,SAHiC;IAIjC,eAJiC;IAKjC,aALiC;IAMjC,cANiC;IAOjC;EAPiC,CAAnC;EAUA,MAAM,aAAa,GAA8B,KAAjD;EAEA,OAAO;IAAE,MAAF;IAAU;EAAV,CAAP;AACD","sourcesContent":["import type { DialogContextValue, DialogSurfaceContextValue } from '../../contexts';\nimport type { DialogContextValues, DialogState } from './Dialog.types';\n\nexport function useDialogContextValues_unstable(state: DialogState): DialogContextValues {\n const { modalType, open, dialogContentId, dialogRef, dialogTitleId, isNestedDialog, requestOpenChange } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const dialog: DialogContextValue = {\n open,\n modalType,\n dialogRef,\n dialogContentId,\n dialogTitleId,\n isNestedDialog,\n requestOpenChange,\n };\n\n const dialogSurface: DialogSurfaceContextValue = false;\n\n return { dialog, dialogSurface };\n}\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,4 @@
1
1
  import { getNativeElementProps } from '@fluentui/react-utilities';
2
- import { useDialogContext_unstable } from '../../contexts';
3
2
  /**
4
3
  * Create the state required to render DialogBody.
5
4
  *
@@ -11,13 +10,14 @@ import { useDialogContext_unstable } from '../../contexts';
11
10
  */
12
11
 
13
12
  export const useDialogBody_unstable = (props, ref) => {
13
+ var _a;
14
+
14
15
  return {
15
16
  components: {
16
17
  root: 'div'
17
18
  },
18
- root: getNativeElementProps('div', {
19
+ root: getNativeElementProps((_a = props.as) !== null && _a !== void 0 ? _a : 'div', {
19
20
  ref,
20
- id: useDialogContext_unstable(ctx => ctx.dialogBodyID),
21
21
  ...props
22
22
  })
23
23
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogBody/useDialogBody.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,yBAAT,QAA0C,gBAA1C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAyB,GAAzB,KAAyE;EAC7G,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;MACjC,GADiC;MAEjC,EAAE,EAAE,yBAAyB,CAAC,GAAG,IAAI,GAAG,CAAC,YAAZ,CAFI;MAGjC,GAAG;IAH8B,CAAR;EAJtB,CAAP;AAUD,CAXM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogBodyProps, DialogBodyState } from './DialogBody.types';\nimport { useDialogContext_unstable } from '../../contexts';\n\n/**\n * Create the state required to render DialogBody.\n *\n * The returned state can be modified with hooks such as useDialogBodyStyles_unstable,\n * before being passed to renderDialogBody_unstable.\n *\n * @param props - props from this instance of DialogBody\n * @param ref - reference to root HTMLElement of DialogBody\n */\nexport const useDialogBody_unstable = (props: DialogBodyProps, ref: React.Ref<HTMLElement>): DialogBodyState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref,\n id: useDialogContext_unstable(ctx => ctx.dialogBodyID),\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-dialog/src/components/DialogBody/useDialogBody.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAyB,GAAzB,KAAyE;;;EAC7G,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,KAAb,EAAoB;MAC7C,GAD6C;MAE7C,GAAG;IAF0C,CAApB;EAJtB,CAAP;AASD,CAVM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { DialogBodyProps, DialogBodyState } from './DialogBody.types';\n\n/**\n * Create the state required to render DialogBody.\n *\n * The returned state can be modified with hooks such as useDialogBodyStyles_unstable,\n * before being passed to renderDialogBody_unstable.\n *\n * @param props - props from this instance of DialogBody\n * @param ref - reference to root HTMLElement of DialogBody\n */\nexport const useDialogBody_unstable = (props: DialogBodyProps, ref: React.Ref<HTMLElement>): DialogBodyState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps(props.as ?? 'div', {\n ref,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,5 @@
1
1
  import { __styles, mergeClasses, shorthands } from '@griffel/react';
2
- import { typographyStyles } from '@fluentui/react-theme';
3
- import { BODY_GRID_AREA } from '../../contexts/constants';
2
+ import { ACTIONS_END_GRID_AREA, ACTIONS_START_GRID_AREA, CONTENT_GRID_AREA, DIALOG_GAP, MEDIA_QUERY_BREAKPOINT_SELECTOR, SURFACE_PADDING, TITLE_ACTION_GRID_AREA, TITLE_GRID_AREA } from '../../contexts';
4
3
  export const dialogBodyClassNames = {
5
4
  root: 'fui-DialogBody'
6
5
  };
@@ -10,22 +9,33 @@ export const dialogBodyClassNames = {
10
9
 
11
10
  const useStyles = /*#__PURE__*/__styles({
12
11
  "root": {
12
+ "mc9l5x": "f13qh94s",
13
+ "fshzfu": "f120kxnn",
13
14
  "a9b677": "fly5x3f",
14
- "Bqenvij": "f1l02sjl",
15
- "Bmxbyg5": "f5zp4f",
16
- "sshi5w": "f1nxs5xn",
15
+ "Bqenvij": "f3052tw",
16
+ "B2u0y6b": "fvgz9i8",
17
+ "Bxyxcbc": "flnwrvu",
17
18
  "B7ck84d": "f1ewtqcl",
18
- "Ijaq50": "f6owso0",
19
- "Br312pm": "fupswjn",
20
- "nk6f5a": "foucsne",
21
- "Bw0ie65": "f1ka72gx",
22
- "Bahqtrf": "fk6fouc",
23
- "Be2twd7": "fkhj508",
24
- "Bhrd7zp": "figsok6",
25
- "Bg96gwp": "f1i3iumi"
19
+ "wkccdc": "f874eam",
20
+ "Budl1dq": "fjj47a5",
21
+ "zoa1oz": "fe34spp",
22
+ "B68tc82": "f1ln0qer",
23
+ "Bmxbyg5": "fa2wlxz",
24
+ "i8kkvl": "f4px1ci",
25
+ "Belr9w4": "fn67r4l",
26
+ "B5xtmjs": "ff54dml",
27
+ "Bqu9lor": "f52bj20",
28
+ "B06wobe": "f1dangjo"
26
29
  }
27
30
  }, {
28
- "d": [".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f5zp4f{overflow-y:auto;}", ".f1nxs5xn{min-height:32px;}", ".f1ewtqcl{box-sizing:border-box;}", ".f6owso0{grid-row-start:body;}", ".fupswjn{grid-column-start:body;}", ".foucsne{grid-row-end:body;}", ".f1ka72gx{grid-column-end:body;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}"]
31
+ "d": [".f13qh94s{display:grid;}", ".f120kxnn::backdrop{background-color:rgba(0, 0, 0, 0.4);}", ".fly5x3f{width:100%;}", ".f3052tw{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;}", ".fvgz9i8{max-width:600px;}", ".flnwrvu{max-height:calc(100vh - 2 * 24px);}", ".f1ewtqcl{box-sizing:border-box;}", ".f874eam{grid-template-rows:auto 1fr auto;}", ".fjj47a5{grid-template-columns:1fr 1fr auto;}", ".fe34spp{grid-template-areas:\"title title close-button\" \"body body body\" \"actions-start actions-end actions-end\";}", ".f1ln0qer{overflow-x:unset;}", ".fa2wlxz{overflow-y:unset;}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".fn67r4l{row-gap:8px;}"],
32
+ "m": [["@media screen and (max-width: 480px){.ff54dml{max-width:100vw;}}", {
33
+ "m": "screen and (max-width: 480px)"
34
+ }], ["@media screen and (max-width: 480px){.f52bj20{grid-template-rows:auto 1fr auto auto;}}", {
35
+ "m": "screen and (max-width: 480px)"
36
+ }], ["@media screen and (max-width: 480px){.f1dangjo{grid-template-areas:\"title title close-button\" \"body body body\" \"actions-start actions-start actions-start\" \"actions-end actions-end actions-end\";}}", {
37
+ "m": "screen and (max-width: 480px)"
38
+ }]]
29
39
  });
30
40
  /**
31
41
  * Apply styling to the DialogBody slots based on the state
@@ -34,9 +44,7 @@ const useStyles = /*#__PURE__*/__styles({
34
44
 
35
45
  export const useDialogBodyStyles_unstable = state => {
36
46
  const styles = useStyles();
37
- state.root.className = mergeClasses(dialogBodyClassNames.root, styles.root, state.root.className); // TODO Add class names to slots, for example:
38
- // state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className);
39
-
47
+ state.root.className = mergeClasses(dialogBodyClassNames.root, styles.root, state.root.className);
40
48
  return state;
41
49
  };
42
50
  //# sourceMappingURL=useDialogBodyStyles.js.map