@fluentui/react-toast 9.7.17 → 9.8.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 (124) hide show
  1. package/CHANGELOG.md +33 -9
  2. package/dist/index.d.ts +155 -50
  3. package/lib/Toast.js +1 -1
  4. package/lib/Toast.js.map +1 -1
  5. package/lib/ToastBody.js +1 -1
  6. package/lib/ToastBody.js.map +1 -1
  7. package/lib/ToastTitle.js +1 -1
  8. package/lib/ToastTitle.js.map +1 -1
  9. package/lib/Toaster.js +1 -1
  10. package/lib/Toaster.js.map +1 -1
  11. package/lib/components/AriaLive/useAriaLiveStyles.styles.js +2 -0
  12. package/lib/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
  13. package/lib/components/AriaLive/useAriaLiveStyles.styles.raw.js +2 -0
  14. package/lib/components/AriaLive/useAriaLiveStyles.styles.raw.js.map +1 -1
  15. package/lib/components/Toast/Toast.types.js +1 -1
  16. package/lib/components/Toast/Toast.types.js.map +1 -1
  17. package/lib/components/Toast/index.js +1 -1
  18. package/lib/components/Toast/index.js.map +1 -1
  19. package/lib/components/Toast/useToast.js +18 -7
  20. package/lib/components/Toast/useToast.js.map +1 -1
  21. package/lib/components/Toast/useToastStyles.styles.js +1 -0
  22. package/lib/components/Toast/useToastStyles.styles.js.map +1 -1
  23. package/lib/components/Toast/useToastStyles.styles.raw.js +1 -0
  24. package/lib/components/Toast/useToastStyles.styles.raw.js.map +1 -1
  25. package/lib/components/ToastBody/ToastBody.types.js +1 -1
  26. package/lib/components/ToastBody/ToastBody.types.js.map +1 -1
  27. package/lib/components/ToastBody/index.js +1 -1
  28. package/lib/components/ToastBody/index.js.map +1 -1
  29. package/lib/components/ToastBody/useToastBody.js +17 -7
  30. package/lib/components/ToastBody/useToastBody.js.map +1 -1
  31. package/lib/components/ToastBody/useToastBodyStyles.styles.js +2 -0
  32. package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  33. package/lib/components/ToastBody/useToastBodyStyles.styles.raw.js +2 -0
  34. package/lib/components/ToastBody/useToastBodyStyles.styles.raw.js.map +1 -1
  35. package/lib/components/ToastContainer/useToastContainerStyles.styles.js +1 -0
  36. package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  37. package/lib/components/ToastContainer/useToastContainerStyles.styles.raw.js +1 -0
  38. package/lib/components/ToastContainer/useToastContainerStyles.styles.raw.js.map +1 -1
  39. package/lib/components/ToastFooter/useToastFooterStyles.styles.js +1 -0
  40. package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  41. package/lib/components/ToastFooter/useToastFooterStyles.styles.raw.js +1 -0
  42. package/lib/components/ToastFooter/useToastFooterStyles.styles.raw.js.map +1 -1
  43. package/lib/components/ToastTitle/ToastTitle.types.js +1 -1
  44. package/lib/components/ToastTitle/ToastTitle.types.js.map +1 -1
  45. package/lib/components/ToastTitle/index.js +1 -1
  46. package/lib/components/ToastTitle/index.js.map +1 -1
  47. package/lib/components/ToastTitle/useToastTitle.js +39 -23
  48. package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
  49. package/lib/components/ToastTitle/useToastTitleStyles.styles.js +3 -0
  50. package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  51. package/lib/components/ToastTitle/useToastTitleStyles.styles.raw.js +3 -0
  52. package/lib/components/ToastTitle/useToastTitleStyles.styles.raw.js.map +1 -1
  53. package/lib/components/Toaster/index.js +1 -0
  54. package/lib/components/Toaster/index.js.map +1 -1
  55. package/lib/components/Toaster/useToastAnnounce.js +1 -1
  56. package/lib/components/Toaster/useToastAnnounce.js.map +1 -1
  57. package/lib/components/Toaster/useToasterStyles.styles.js +6 -0
  58. package/lib/components/Toaster/useToasterStyles.styles.js.map +1 -1
  59. package/lib/components/Toaster/useToasterStyles.styles.raw.js +6 -0
  60. package/lib/components/Toaster/useToasterStyles.styles.raw.js.map +1 -1
  61. package/lib/index.js +7 -5
  62. package/lib/index.js.map +1 -1
  63. package/lib/state/types.js.map +1 -1
  64. package/lib-commonjs/Toast.js +3 -0
  65. package/lib-commonjs/Toast.js.map +1 -1
  66. package/lib-commonjs/ToastBody.js +3 -0
  67. package/lib-commonjs/ToastBody.js.map +1 -1
  68. package/lib-commonjs/ToastTitle.js +3 -0
  69. package/lib-commonjs/ToastTitle.js.map +1 -1
  70. package/lib-commonjs/Toaster.js +3 -0
  71. package/lib-commonjs/Toaster.js.map +1 -1
  72. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +2 -0
  73. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
  74. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.raw.js +2 -0
  75. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.raw.js.map +1 -1
  76. package/lib-commonjs/components/Toast/Toast.types.js +1 -1
  77. package/lib-commonjs/components/Toast/Toast.types.js.map +1 -1
  78. package/lib-commonjs/components/Toast/index.js +3 -0
  79. package/lib-commonjs/components/Toast/index.js.map +1 -1
  80. package/lib-commonjs/components/Toast/useToast.js +19 -5
  81. package/lib-commonjs/components/Toast/useToast.js.map +1 -1
  82. package/lib-commonjs/components/Toast/useToastStyles.styles.js +1 -0
  83. package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
  84. package/lib-commonjs/components/Toast/useToastStyles.styles.raw.js +1 -0
  85. package/lib-commonjs/components/Toast/useToastStyles.styles.raw.js.map +1 -1
  86. package/lib-commonjs/components/ToastBody/ToastBody.types.js +1 -1
  87. package/lib-commonjs/components/ToastBody/ToastBody.types.js.map +1 -1
  88. package/lib-commonjs/components/ToastBody/index.js +3 -0
  89. package/lib-commonjs/components/ToastBody/index.js.map +1 -1
  90. package/lib-commonjs/components/ToastBody/useToastBody.js +19 -6
  91. package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
  92. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +2 -0
  93. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  94. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.raw.js +2 -0
  95. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.raw.js.map +1 -1
  96. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +1 -0
  97. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  98. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.raw.js +1 -0
  99. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.raw.js.map +1 -1
  100. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +1 -0
  101. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  102. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.raw.js +1 -0
  103. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.raw.js.map +1 -1
  104. package/lib-commonjs/components/ToastTitle/ToastTitle.types.js +1 -1
  105. package/lib-commonjs/components/ToastTitle/ToastTitle.types.js.map +1 -1
  106. package/lib-commonjs/components/ToastTitle/index.js +3 -0
  107. package/lib-commonjs/components/ToastTitle/index.js.map +1 -1
  108. package/lib-commonjs/components/ToastTitle/useToastTitle.js +43 -24
  109. package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
  110. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +3 -0
  111. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.raw.js +3 -0
  113. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.raw.js.map +1 -1
  114. package/lib-commonjs/components/Toaster/index.js +4 -0
  115. package/lib-commonjs/components/Toaster/index.js.map +1 -1
  116. package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -1
  117. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +6 -0
  118. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -1
  119. package/lib-commonjs/components/Toaster/useToasterStyles.styles.raw.js +6 -0
  120. package/lib-commonjs/components/Toaster/useToasterStyles.styles.raw.js.map +1 -1
  121. package/lib-commonjs/index.js +31 -0
  122. package/lib-commonjs/index.js.map +1 -1
  123. package/lib-commonjs/state/types.js.map +1 -1
  124. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,23 +1,47 @@
1
1
  # Change Log - @fluentui/react-toast
2
2
 
3
- This log was last generated on Thu, 23 Apr 2026 11:59:36 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 27 May 2026 11:18:30 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.8.0)
8
+
9
+ Wed, 27 May 2026 11:18:30 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.7.18..@fluentui/react-toast_v9.8.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: export toast base hooks and types ([PR #35914](https://github.com/microsoft/fluentui/pull/35914) by dmytrokirpa@microsoft.com)
15
+
16
+ ## [9.7.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.7.18)
17
+
18
+ Tue, 26 May 2026 09:39:13 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.7.17..@fluentui/react-toast_v9.7.18)
20
+
21
+ ### Patches
22
+
23
+ - Bump @fluentui/react-aria to v9.17.12 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
24
+ - Bump @fluentui/react-jsx-runtime to v9.4.3 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
25
+ - Bump @fluentui/react-motion to v9.16.0 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
26
+ - Bump @fluentui/react-motion-components-preview to v0.15.5 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
27
+ - Bump @fluentui/react-portal to v9.8.13 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
28
+ - Bump @fluentui/react-tabster to v9.26.15 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
29
+ - Bump @fluentui/react-utilities to v9.26.4 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
30
+
7
31
  ## [9.7.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.7.17)
8
32
 
9
- Thu, 23 Apr 2026 11:59:36 GMT
33
+ Thu, 23 Apr 2026 14:21:09 GMT
10
34
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.7.16..@fluentui/react-toast_v9.7.17)
11
35
 
12
36
  ### Patches
13
37
 
14
- - Bump @fluentui/react-aria to v9.17.11 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
15
- - Bump @fluentui/react-jsx-runtime to v9.4.2 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
16
- - Bump @fluentui/react-motion to v9.15.0 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
17
- - Bump @fluentui/react-motion-components-preview to v0.15.4 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
18
- - Bump @fluentui/react-portal to v9.8.12 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
19
- - Bump @fluentui/react-tabster to v9.26.14 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
20
- - Bump @fluentui/react-utilities to v9.26.3 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
38
+ - Bump @fluentui/react-aria to v9.17.11 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
39
+ - Bump @fluentui/react-jsx-runtime to v9.4.2 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
40
+ - Bump @fluentui/react-motion to v9.15.0 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
41
+ - Bump @fluentui/react-motion-components-preview to v0.15.4 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
42
+ - Bump @fluentui/react-portal to v9.8.12 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
43
+ - Bump @fluentui/react-tabster to v9.26.14 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
44
+ - Bump @fluentui/react-utilities to v9.26.3 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
21
45
 
22
46
  ## [9.7.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.7.16)
23
47
 
package/dist/index.d.ts CHANGED
@@ -11,19 +11,13 @@ import type { Slot } from '@fluentui/react-utilities';
11
11
  import type { SlotClassNames } from '@fluentui/react-utilities';
12
12
  import type { TriggerProps } from '@fluentui/react-utilities';
13
13
 
14
- declare type Announce = (message: string, options: AnnounceOptions) => void;
15
-
16
- declare type AnnounceOptions = {
17
- politeness: AriaLivePoliteness;
18
- };
19
-
20
14
  declare type AriaLivePoliteness = 'polite' | 'assertive';
21
15
 
22
16
  /**
23
17
  * AriaLive Props
24
18
  */
25
19
  declare type AriaLiveProps = ComponentProps<Partial<AriaLiveSlots>> & {
26
- announceRef: React_2.Ref<Announce>;
20
+ announceRef: React_2.Ref<ToastAnnounce>;
27
21
  children?: React_2.ReactNode;
28
22
  };
29
23
 
@@ -36,10 +30,6 @@ declare interface CommonToastDetail {
36
30
  toasterId?: ToasterId;
37
31
  }
38
32
 
39
- declare interface DispatchToastOptions extends Partial<Omit<ToastOptions, 'toasterId'>> {
40
- root?: RootSlot;
41
- }
42
-
43
33
  /**
44
34
  * Render the final JSX of Toast
45
35
  */
@@ -50,6 +40,11 @@ export declare const renderToast_unstable: (state: ToastState, contextValues: To
50
40
  */
51
41
  export declare const renderToastBody_unstable: (state: ToastBodyState) => JSXElement;
52
42
 
43
+ /**
44
+ * Render the final JSX of ToastContainer
45
+ */
46
+ export declare const renderToastContainer_unstable: (state: ToastContainerState, contextValues: ToastContainerContextValues) => JSXElement;
47
+
53
48
  /**
54
49
  * Render the final JSX of Toaster
55
50
  */
@@ -72,8 +67,6 @@ export declare const renderToastTitle_unstable: (state: ToastTitleState) => JSXE
72
67
  */
73
68
  export declare const renderToastTrigger_unstable: (state: ToastTriggerState) => JSXElement | null;
74
69
 
75
- declare type RootSlot = Slot<'div'>;
76
-
77
70
  declare type TimerProps = {
78
71
  running: boolean;
79
72
  timeout: number;
@@ -86,32 +79,37 @@ declare type TimerProps = {
86
79
  */
87
80
  export declare const Toast: ForwardRefComponent<ToastProps>;
88
81
 
89
- declare interface Toast_2<TData = object> extends ToastOptions<TData> {
90
- /**
91
- * Determines the visiblity of a toast
92
- */
93
- close: () => void;
94
- /**
95
- * Removes a toast completely
96
- */
97
- remove: () => void;
98
- /**
99
- * A number used to track updates immutably
100
- */
101
- updateId: number;
102
- /**
103
- * Used to determine default priority when the user does not set one
104
- * Simple counter of toasts dispatched.
105
- */
106
- order: number;
107
- imperativeRef: React_2.RefObject<ToastImperativeRef | null>;
108
- }
82
+ export declare type ToastAnnounce = (message: string, options: ToastAnnounceOptions) => void;
83
+
84
+ export declare type ToastAnnounceOptions = {
85
+ politeness: AriaLivePoliteness;
86
+ };
87
+
88
+ /**
89
+ * Toast Props without design-only props.
90
+ */
91
+ export declare type ToastBaseProps = Omit<ToastProps, 'appearance'>;
92
+
93
+ /**
94
+ * State used in rendering Toast, without design-only state.
95
+ */
96
+ export declare type ToastBaseState = Omit<ToastState, 'backgroundAppearance'>;
109
97
 
110
98
  /**
111
99
  * ToastBody component
112
100
  */
113
101
  export declare const ToastBody: ForwardRefComponent<ToastBodyProps>;
114
102
 
103
+ /**
104
+ * ToastBody Props without design-only props.
105
+ */
106
+ export declare type ToastBodyBaseProps = ToastBodyProps;
107
+
108
+ /**
109
+ * State used in rendering ToastBody, without design-only state.
110
+ */
111
+ export declare type ToastBodyBaseState = Omit<ToastBodyState, 'backgroundAppearance'>;
112
+
115
113
  export declare const toastBodyClassNames: SlotClassNames<ToastBodySlots>;
116
114
 
117
115
  /**
@@ -131,34 +129,40 @@ export declare type ToastBodyState = ComponentState<ToastBodySlots> & {
131
129
  backgroundAppearance: BackgroundAppearanceContextValue;
132
130
  };
133
131
 
134
- declare interface ToastChangeData extends ToastOptions, Pick<Toast_2, 'updateId'> {
132
+ export declare interface ToastChangeData extends ToastOptions, Pick<ToastData, 'updateId'> {
135
133
  status: ToastStatus;
136
134
  }
137
135
 
138
- declare type ToastChangeHandler = (event: null, data: ToastChangeData) => void;
136
+ export declare type ToastChangeHandler = (event: null, data: ToastChangeData) => void;
139
137
 
140
138
  export declare const toastClassNames: SlotClassNames<ToastSlots>;
141
139
 
142
140
  export declare const toastContainerClassNames: SlotClassNames<ToastContainerSlots>;
143
141
 
144
- declare type ToastContainerContextValue = {
142
+ export declare const ToastContainerContextProvider: React_2.Provider<ToastContainerContextValue | undefined>;
143
+
144
+ export declare type ToastContainerContextValue = {
145
145
  close: () => void;
146
146
  intent: ToastIntent | undefined;
147
147
  bodyId: string;
148
148
  titleId: string;
149
149
  };
150
150
 
151
+ declare type ToastContainerContextValues = {
152
+ toast: ToastContainerContextValue;
153
+ };
154
+
151
155
  /**
152
156
  * ToastContainer Props
153
157
  */
154
- declare type ToastContainerProps = Omit<ComponentProps<Partial<ToastContainerSlots>>, 'content'> & Toast_2 & {
158
+ export declare type ToastContainerProps = Omit<ComponentProps<Partial<ToastContainerSlots>>, 'content'> & ToastData & {
155
159
  visible: boolean;
156
- announce: Announce;
160
+ announce: ToastAnnounce;
157
161
  intent: ToastIntent | undefined;
158
162
  tryRestoreFocus: () => void;
159
163
  };
160
164
 
161
- declare type ToastContainerSlots = {
165
+ export declare type ToastContainerSlots = {
162
166
  root: NonNullable<Slot<'div'>>;
163
167
  timer: NonNullable<Slot<TimerProps>>;
164
168
  };
@@ -190,6 +194,31 @@ declare type ToastContextValues = {
190
194
  backgroundAppearance: BackgroundAppearanceContextValue;
191
195
  };
192
196
 
197
+ export declare interface ToastData<TData = object> extends ToastOptions<TData> {
198
+ /**
199
+ * Determines the visiblity of a toast
200
+ */
201
+ close: () => void;
202
+ /**
203
+ * Removes a toast completely
204
+ */
205
+ remove: () => void;
206
+ /**
207
+ * A number used to track updates immutably
208
+ */
209
+ updateId: number;
210
+ /**
211
+ * Used to determine default priority when the user does not set one
212
+ * Simple counter of toasts dispatched.
213
+ */
214
+ order: number;
215
+ imperativeRef: React_2.RefObject<ToastImperativeRef | null>;
216
+ }
217
+
218
+ export declare interface ToastDispatchOptions extends Partial<Omit<ToastOptions, 'toasterId'>> {
219
+ root?: Slot<'div'>;
220
+ }
221
+
193
222
  /**
194
223
  * Toaster component - renders a collection of toasts dispatched imperatively
195
224
  */
@@ -197,9 +226,9 @@ export declare const Toaster: React_2.FC<ToasterProps>;
197
226
 
198
227
  export declare const toasterClassNames: SlotClassNames<ToasterSlots>;
199
228
 
200
- declare type ToasterId = string;
229
+ export declare type ToasterId = string;
201
230
 
202
- declare interface ToasterOptions extends Pick<ToastOptions, 'position' | 'timeout' | 'pauseOnWindowBlur' | 'pauseOnHover' | 'priority'> {
231
+ export declare interface ToasterOptions extends Pick<ToastOptions, 'position' | 'timeout' | 'pauseOnWindowBlur' | 'pauseOnHover' | 'priority'> {
203
232
  offset?: ToastOffset;
204
233
  toasterId?: ToasterId;
205
234
  limit?: number;
@@ -213,11 +242,11 @@ export declare type ToasterProps = Omit<ComponentProps<ToasterSlots>, 'children'
213
242
  /**
214
243
  * User override API for aria-live narration for toasts
215
244
  */
216
- announce?: Announce;
245
+ announce?: ToastAnnounce;
217
246
  inline?: boolean;
218
247
  };
219
248
 
220
- declare interface ToasterShortcuts {
249
+ export declare interface ToasterShortcuts {
221
250
  focus: (e: KeyboardEvent) => boolean;
222
251
  }
223
252
 
@@ -270,7 +299,7 @@ export declare type ToastFooterState = ComponentState<ToastFooterSlots>;
270
299
 
271
300
  export declare type ToastId = string;
272
301
 
273
- declare type ToastImperativeRef = {
302
+ export declare type ToastImperativeRef = {
274
303
  /**
275
304
  * Focuses the Toast.
276
305
  * If there are no focusable elements in the Toast, the Toast itself is focused.
@@ -288,6 +317,12 @@ declare type ToastImperativeRef = {
288
317
 
289
318
  export declare type ToastIntent = 'info' | 'success' | 'error' | 'warning';
290
319
 
320
+ export declare type ToastLiveMessage = {
321
+ message: string;
322
+ createdAt: number;
323
+ politeness: AriaLivePoliteness;
324
+ };
325
+
291
326
  export declare type ToastOffset = Partial<Record<ToastPosition, ToastOffsetObject>> | ToastOffsetObject;
292
327
 
293
328
  declare interface ToastOffsetObject {
@@ -295,7 +330,7 @@ declare interface ToastOffsetObject {
295
330
  vertical?: number;
296
331
  }
297
332
 
298
- declare interface ToastOptions<TData = object> {
333
+ export declare interface ToastOptions<TData = object> {
299
334
  /**
300
335
  * Uniquely identifies a toast, used for update and dismiss operations
301
336
  */
@@ -382,6 +417,16 @@ export declare type ToastStatus = 'queued' | 'visible' | 'dismissed' | 'unmounte
382
417
  */
383
418
  export declare const ToastTitle: ForwardRefComponent<ToastTitleProps>;
384
419
 
420
+ /**
421
+ * ToastTitle Props without design-only props.
422
+ */
423
+ export declare type ToastTitleBaseProps = ToastTitleProps;
424
+
425
+ /**
426
+ * State used in rendering ToastTitle, without design-only state.
427
+ */
428
+ export declare type ToastTitleBaseState = Omit<ToastTitleState, 'backgroundAppearance'>;
429
+
385
430
  export declare const toastTitleClassNames: SlotClassNames<ToastTitleSlots>;
386
431
 
387
432
  /**
@@ -424,12 +469,12 @@ export declare type ToastTriggerState = {
424
469
  children: React_2.ReactElement | null;
425
470
  };
426
471
 
427
- declare interface UpdateToastEventDetail extends Partial<ToastOptions>, CommonToastDetail {
472
+ export declare interface ToastUpdateEventDetail extends Partial<ToastOptions>, CommonToastDetail {
428
473
  toastId: ToastId;
429
474
  }
430
475
 
431
- declare interface UpdateToastOptions extends UpdateToastEventDetail {
432
- root?: RootSlot;
476
+ export declare interface ToastUpdateOptions extends ToastUpdateEventDetail {
477
+ root?: Slot<'div'>;
433
478
  }
434
479
 
435
480
  /**
@@ -443,6 +488,26 @@ declare interface UpdateToastOptions extends UpdateToastEventDetail {
443
488
  */
444
489
  export declare const useToast_unstable: (props: ToastProps, ref: React_2.Ref<HTMLElement>) => ToastState;
445
490
 
491
+ /**
492
+ * Wraps an aria live announcement function.
493
+ * Aria live announcements can be detrimental once the user is already navigating
494
+ * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.
495
+ * @param announce - The aria live announcement function to wrap
496
+ * @returns A function to announce a toast and a ref to attach to the toaster element
497
+ */
498
+ export declare function useToastAnnounce(announce: ToastAnnounce): {
499
+ announceToast: ToastAnnounce;
500
+ toasterRef: React_2.RefCallback<HTMLDivElement>;
501
+ };
502
+
503
+ /**
504
+ * Create the base state required to render Toast, without design-only props.
505
+ *
506
+ * @param props - props from this instance of Toast (without appearance)
507
+ * @param ref - reference to root HTMLElement of Toast
508
+ */
509
+ export declare const useToastBase_unstable: (props: ToastBaseProps, ref: React_2.Ref<HTMLElement>) => ToastBaseState;
510
+
446
511
  /**
447
512
  * Create the state required to render ToastBody.
448
513
  *
@@ -454,24 +519,56 @@ export declare const useToast_unstable: (props: ToastProps, ref: React_2.Ref<HTM
454
519
  */
455
520
  export declare const useToastBody_unstable: (props: ToastBodyProps, ref: React_2.Ref<HTMLElement>) => ToastBodyState;
456
521
 
522
+ /**
523
+ * Create the base state required to render ToastBody, without design-only props.
524
+ *
525
+ * @param props - props from this instance of ToastBody
526
+ * @param ref - reference to root HTMLElement of ToastBody
527
+ */
528
+ export declare const useToastBodyBase_unstable: (props: ToastBodyBaseProps, ref: React_2.Ref<HTMLElement>) => ToastBodyBaseState;
529
+
457
530
  /**
458
531
  * Apply styling to the ToastBody slots based on the state
459
532
  */
460
533
  export declare const useToastBodyStyles_unstable: (state: ToastBodyState) => ToastBodyState;
461
534
 
535
+ /**
536
+ * Create the state required to render ToastContainer.
537
+ *
538
+ * The returned state can be modified with hooks such as useToastContainerStyles_unstable,
539
+ * before being passed to renderToastContainer_unstable.
540
+ *
541
+ * @param props - props from this instance of ToastContainer
542
+ * @param ref - reference to root HTMLElement of ToastContainer
543
+ */
544
+ export declare const useToastContainer_unstable: (props: ToastContainerProps, ref: React_2.Ref<HTMLElement>) => ToastContainerState;
545
+
546
+ export declare const useToastContainerContext: () => ToastContainerContextValue;
547
+
548
+ export declare function useToastContainerContextValues_unstable(state: ToastContainerState): ToastContainerContextValues;
549
+
462
550
  /**
463
551
  * @param toasterId - If an id is provided all imperative methods control that specific toaster
464
552
  * @returns Imperative methods to control toasts
465
553
  */
466
554
  export declare function useToastController(toasterId?: ToasterId): {
467
- dispatchToast: (content: React_2.ReactNode, options?: DispatchToastOptions) => void;
555
+ dispatchToast: (content: React_2.ReactNode, options?: ToastDispatchOptions) => void;
468
556
  dismissToast: (toastId: ToastId) => void;
469
557
  dismissAllToasts: () => void;
470
- updateToast: (options: UpdateToastOptions) => void;
558
+ updateToast: (options: ToastUpdateOptions) => void;
471
559
  pauseToast: (toastId: ToastId) => void;
472
560
  playToast: (toastId: ToastId) => void;
473
561
  };
474
562
 
563
+ export declare function useToaster<TElement extends HTMLElement = HTMLDivElement>(options?: Partial<ToasterOptions>): {
564
+ isToastVisible: (toastId: ToastId) => boolean;
565
+ toastsToRender: Map<ToastPosition, ToastData[]>;
566
+ pauseAllToasts: () => void;
567
+ playAllToasts: () => void;
568
+ tryRestoreFocus: () => void;
569
+ closeAllToasts: () => void;
570
+ };
571
+
475
572
  /**
476
573
  * Create the state required to render Toaster.
477
574
  *
@@ -516,6 +613,14 @@ export declare const useToastStyles_unstable: (state: ToastState) => ToastState;
516
613
  */
517
614
  export declare const useToastTitle_unstable: (props: ToastTitleProps, ref: React_2.Ref<HTMLElement>) => ToastTitleState;
518
615
 
616
+ /**
617
+ * Create the base state required to render ToastTitle, without design-only props.
618
+ *
619
+ * @param props - props from this instance of ToastTitle
620
+ * @param ref - reference to root HTMLElement of ToastTitle
621
+ */
622
+ export declare const useToastTitleBase_unstable: (props: ToastTitleBaseProps, ref: React_2.Ref<HTMLElement>) => ToastTitleBaseState;
623
+
519
624
  /**
520
625
  * Apply styling to the ToastTitle slots based on the state
521
626
  */
package/lib/Toast.js CHANGED
@@ -1 +1 @@
1
- export { Toast, renderToast_unstable, toastClassNames, useToastStyles_unstable, useToast_unstable } from './components/Toast/index';
1
+ export { Toast, renderToast_unstable, toastClassNames, useToastStyles_unstable, useToastBase_unstable, useToast_unstable } from './components/Toast/index';
package/lib/Toast.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Toast.ts"],"sourcesContent":["export type { ToastContextValues, ToastProps, ToastSlots, ToastState } from './components/Toast/index';\nexport {\n Toast,\n renderToast_unstable,\n toastClassNames,\n useToastStyles_unstable,\n useToast_unstable,\n} from './components/Toast/index';\n"],"names":["Toast","renderToast_unstable","toastClassNames","useToastStyles_unstable","useToast_unstable"],"mappings":"AACA,SACEA,KAAK,EACLC,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,EACvBC,iBAAiB,QACZ,2BAA2B"}
1
+ {"version":3,"sources":["../src/Toast.ts"],"sourcesContent":["export type {\n ToastBaseProps,\n ToastBaseState,\n ToastContextValues,\n ToastProps,\n ToastSlots,\n ToastState,\n} from './components/Toast/index';\nexport {\n Toast,\n renderToast_unstable,\n toastClassNames,\n useToastStyles_unstable,\n useToastBase_unstable,\n useToast_unstable,\n} from './components/Toast/index';\n"],"names":["Toast","renderToast_unstable","toastClassNames","useToastStyles_unstable","useToastBase_unstable","useToast_unstable"],"mappings":"AAQA,SACEA,KAAK,EACLC,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,EACvBC,qBAAqB,EACrBC,iBAAiB,QACZ,2BAA2B"}
package/lib/ToastBody.js CHANGED
@@ -1 +1 @@
1
- export { ToastBody, renderToastBody_unstable, toastBodyClassNames, useToastBodyStyles_unstable, useToastBody_unstable } from './components/ToastBody/index';
1
+ export { ToastBody, renderToastBody_unstable, toastBodyClassNames, useToastBodyStyles_unstable, useToastBodyBase_unstable, useToastBody_unstable } from './components/ToastBody/index';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ToastBody.ts"],"sourcesContent":["export type { ToastBodyProps, ToastBodySlots, ToastBodyState } from './components/ToastBody/index';\nexport {\n ToastBody,\n renderToastBody_unstable,\n toastBodyClassNames,\n useToastBodyStyles_unstable,\n useToastBody_unstable,\n} from './components/ToastBody/index';\n"],"names":["ToastBody","renderToastBody_unstable","toastBodyClassNames","useToastBodyStyles_unstable","useToastBody_unstable"],"mappings":"AACA,SACEA,SAAS,EACTC,wBAAwB,EACxBC,mBAAmB,EACnBC,2BAA2B,EAC3BC,qBAAqB,QAChB,+BAA+B"}
1
+ {"version":3,"sources":["../src/ToastBody.ts"],"sourcesContent":["export type {\n ToastBodyBaseProps,\n ToastBodyBaseState,\n ToastBodyProps,\n ToastBodySlots,\n ToastBodyState,\n} from './components/ToastBody/index';\nexport {\n ToastBody,\n renderToastBody_unstable,\n toastBodyClassNames,\n useToastBodyStyles_unstable,\n useToastBodyBase_unstable,\n useToastBody_unstable,\n} from './components/ToastBody/index';\n"],"names":["ToastBody","renderToastBody_unstable","toastBodyClassNames","useToastBodyStyles_unstable","useToastBodyBase_unstable","useToastBody_unstable"],"mappings":"AAOA,SACEA,SAAS,EACTC,wBAAwB,EACxBC,mBAAmB,EACnBC,2BAA2B,EAC3BC,yBAAyB,EACzBC,qBAAqB,QAChB,+BAA+B"}
package/lib/ToastTitle.js CHANGED
@@ -1 +1 @@
1
- export { ToastTitle, renderToastTitle_unstable, toastTitleClassNames, useToastTitleStyles_unstable, useToastTitle_unstable } from './components/ToastTitle/index';
1
+ export { ToastTitle, renderToastTitle_unstable, toastTitleClassNames, useToastTitleStyles_unstable, useToastTitleBase_unstable, useToastTitle_unstable } from './components/ToastTitle/index';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ToastTitle.ts"],"sourcesContent":["export type { ToastTitleProps, ToastTitleSlots, ToastTitleState } from './components/ToastTitle/index';\nexport {\n ToastTitle,\n renderToastTitle_unstable,\n toastTitleClassNames,\n useToastTitleStyles_unstable,\n useToastTitle_unstable,\n} from './components/ToastTitle/index';\n"],"names":["ToastTitle","renderToastTitle_unstable","toastTitleClassNames","useToastTitleStyles_unstable","useToastTitle_unstable"],"mappings":"AACA,SACEA,UAAU,EACVC,yBAAyB,EACzBC,oBAAoB,EACpBC,4BAA4B,EAC5BC,sBAAsB,QACjB,gCAAgC"}
1
+ {"version":3,"sources":["../src/ToastTitle.ts"],"sourcesContent":["export type {\n ToastTitleBaseProps,\n ToastTitleBaseState,\n ToastTitleProps,\n ToastTitleSlots,\n ToastTitleState,\n} from './components/ToastTitle/index';\nexport {\n ToastTitle,\n renderToastTitle_unstable,\n toastTitleClassNames,\n useToastTitleStyles_unstable,\n useToastTitleBase_unstable,\n useToastTitle_unstable,\n} from './components/ToastTitle/index';\n"],"names":["ToastTitle","renderToastTitle_unstable","toastTitleClassNames","useToastTitleStyles_unstable","useToastTitleBase_unstable","useToastTitle_unstable"],"mappings":"AAOA,SACEA,UAAU,EACVC,yBAAyB,EACzBC,oBAAoB,EACpBC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,sBAAsB,QACjB,gCAAgC"}
package/lib/Toaster.js CHANGED
@@ -1 +1 @@
1
- export { Toaster, renderToaster_unstable, toasterClassNames, useToasterStyles_unstable, useToaster_unstable } from './components/Toaster/index';
1
+ export { Toaster, renderToaster_unstable, toasterClassNames, useToasterStyles_unstable, useToaster_unstable, useToastAnnounce } from './components/Toaster/index';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Toaster.ts"],"sourcesContent":["export type { ToasterProps, ToasterSlots, ToasterSlotsInternal, ToasterState } from './components/Toaster/index';\nexport {\n Toaster,\n renderToaster_unstable,\n toasterClassNames,\n useToasterStyles_unstable,\n useToaster_unstable,\n} from './components/Toaster/index';\n"],"names":["Toaster","renderToaster_unstable","toasterClassNames","useToasterStyles_unstable","useToaster_unstable"],"mappings":"AACA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,QACd,6BAA6B"}
1
+ {"version":3,"sources":["../src/Toaster.ts"],"sourcesContent":["export type { ToasterProps, ToasterSlots, ToasterSlotsInternal, ToasterState } from './components/Toaster/index';\nexport {\n Toaster,\n renderToaster_unstable,\n toasterClassNames,\n useToasterStyles_unstable,\n useToaster_unstable,\n useToastAnnounce,\n} from './components/Toaster/index';\n"],"names":["Toaster","renderToaster_unstable","toasterClassNames","useToasterStyles_unstable","useToaster_unstable","useToastAnnounce"],"mappings":"AACA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,EACnBC,gBAAgB,QACX,6BAA6B"}
@@ -16,7 +16,9 @@ export const useAriaLiveStyles_unstable = state => {
16
16
  'use no memo';
17
17
 
18
18
  const visuallyHidden = useResetStyles();
19
+ // eslint-disable-next-line react-hooks/immutability
19
20
  state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);
21
+ // eslint-disable-next-line react-hooks/immutability
20
22
  state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);
21
23
  return state;
22
24
  };
@@ -1 +1 @@
1
- {"version":3,"names":["mergeClasses","__resetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"sources":["useAriaLiveStyles.styles.js"],"sourcesContent":["'use client';\nimport { mergeClasses, makeResetStyles } from '@griffel/react';\nexport const ariaLiveClassNames = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite'\n};\n/**\n * Styles for the root slot\n */ const useResetStyles = makeResetStyles({\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute'\n});\n/**\n * Apply styling to the AriaLive slots based on the state\n */ export const useAriaLiveStyles_unstable = (state)=>{\n 'use no memo';\n const visuallyHidden = useResetStyles();\n state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);\n state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,YAAY,EAAAC,aAAA,QAAyB,gBAAgB;AAC9D,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,SAAS,EAAE,yBAAyB;EACpCC,MAAM,EAAE;AACZ,CAAC;AACD;AACA;AACA;AAAI,MAAMC,cAAc,gBAAGJ,aAAA,6IAQ1B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,0BAA0B,GAAIC,KAAK,IAAG;EACnD,aAAa;;EACb,MAAMC,cAAc,GAAGH,cAAc,CAAC,CAAC;EACvCE,KAAK,CAACJ,SAAS,CAACM,SAAS,GAAGT,YAAY,CAACQ,cAAc,EAAEN,kBAAkB,CAACC,SAAS,EAAEI,KAAK,CAACJ,SAAS,CAACM,SAAS,CAAC;EACjHF,KAAK,CAACH,MAAM,CAACK,SAAS,GAAGT,YAAY,CAACQ,cAAc,EAAEN,kBAAkB,CAACE,MAAM,EAAEG,KAAK,CAACH,MAAM,CAACK,SAAS,CAAC;EACxG,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["mergeClasses","__resetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"sources":["useAriaLiveStyles.styles.js"],"sourcesContent":["'use client';\nimport { mergeClasses, makeResetStyles } from '@griffel/react';\nexport const ariaLiveClassNames = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite'\n};\n/**\n * Styles for the root slot\n */ const useResetStyles = makeResetStyles({\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute'\n});\n/**\n * Apply styling to the AriaLive slots based on the state\n */ export const useAriaLiveStyles_unstable = (state)=>{\n 'use no memo';\n const visuallyHidden = useResetStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);\n // eslint-disable-next-line react-hooks/immutability\n state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,YAAY,EAAAC,aAAA,QAAyB,gBAAgB;AAC9D,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,SAAS,EAAE,yBAAyB;EACpCC,MAAM,EAAE;AACZ,CAAC;AACD;AACA;AACA;AAAI,MAAMC,cAAc,gBAAGJ,aAAA,6IAQ1B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,0BAA0B,GAAIC,KAAK,IAAG;EACnD,aAAa;;EACb,MAAMC,cAAc,GAAGH,cAAc,CAAC,CAAC;EACvC;EACAE,KAAK,CAACJ,SAAS,CAACM,SAAS,GAAGT,YAAY,CAACQ,cAAc,EAAEN,kBAAkB,CAACC,SAAS,EAAEI,KAAK,CAACJ,SAAS,CAACM,SAAS,CAAC;EACjH;EACAF,KAAK,CAACH,MAAM,CAACK,SAAS,GAAGT,YAAY,CAACQ,cAAc,EAAEN,kBAAkB,CAACE,MAAM,EAAEG,KAAK,CAACH,MAAM,CAACK,SAAS,CAAC;EACxG,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -20,7 +20,9 @@ export const ariaLiveClassNames = {
20
20
  */ export const useAriaLiveStyles_unstable = (state)=>{
21
21
  'use no memo';
22
22
  const visuallyHidden = useResetStyles();
23
+ // eslint-disable-next-line react-hooks/immutability
23
24
  state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);
25
+ // eslint-disable-next-line react-hooks/immutability
24
26
  state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);
25
27
  return state;
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/AriaLive/useAriaLiveStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { mergeClasses, makeResetStyles } from '@griffel/react';\nimport type { AriaLiveSlots, AriaLiveState } from './AriaLive.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const ariaLiveClassNames: SlotClassNames<AriaLiveSlots> = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite',\n};\n\n/**\n * Styles for the root slot\n */\nconst useResetStyles = makeResetStyles({\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute',\n});\n\n/**\n * Apply styling to the AriaLive slots based on the state\n */\nexport const useAriaLiveStyles_unstable = (state: AriaLiveState): AriaLiveState => {\n 'use no memo';\n\n const visuallyHidden = useResetStyles();\n state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);\n state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);\n\n return state;\n};\n"],"names":["mergeClasses","makeResetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","clip","height","margin","overflow","padding","width","position","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"mappings":"AAAA;AAEA,SAASA,YAAY,EAAEC,eAAe,QAAQ,iBAAiB;AAI/D,OAAO,MAAMC,qBAAoD;IAC/DC,WAAW;IACXC,QAAQ;AACV,EAAE;AAEF;;CAEC,GACD,MAAMC,iBAAiBJ,gBAAgB;IACrCK,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,UAAU;IACVC,SAAS;IACTC,OAAO;IACPC,UAAU;AACZ;AAEA;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzC;IAEA,MAAMC,iBAAiBV;IACvBS,MAAMX,SAAS,CAACa,SAAS,GAAGhB,aAAae,gBAAgBb,mBAAmBC,SAAS,EAAEW,MAAMX,SAAS,CAACa,SAAS;IAChHF,MAAMV,MAAM,CAACY,SAAS,GAAGhB,aAAae,gBAAgBb,mBAAmBE,MAAM,EAAEU,MAAMV,MAAM,CAACY,SAAS;IAEvG,OAAOF;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/AriaLive/useAriaLiveStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { mergeClasses, makeResetStyles } from '@griffel/react';\nimport type { AriaLiveSlots, AriaLiveState } from './AriaLive.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const ariaLiveClassNames: SlotClassNames<AriaLiveSlots> = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite',\n};\n\n/**\n * Styles for the root slot\n */\nconst useResetStyles = makeResetStyles({\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute',\n});\n\n/**\n * Apply styling to the AriaLive slots based on the state\n */\nexport const useAriaLiveStyles_unstable = (state: AriaLiveState): AriaLiveState => {\n 'use no memo';\n\n const visuallyHidden = useResetStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);\n // eslint-disable-next-line react-hooks/immutability\n state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);\n\n return state;\n};\n"],"names":["mergeClasses","makeResetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","clip","height","margin","overflow","padding","width","position","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"mappings":"AAAA;AAEA,SAASA,YAAY,EAAEC,eAAe,QAAQ,iBAAiB;AAI/D,OAAO,MAAMC,qBAAoD;IAC/DC,WAAW;IACXC,QAAQ;AACV,EAAE;AAEF;;CAEC,GACD,MAAMC,iBAAiBJ,gBAAgB;IACrCK,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,UAAU;IACVC,SAAS;IACTC,OAAO;IACPC,UAAU;AACZ;AAEA;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzC;IAEA,MAAMC,iBAAiBV;IACvB,oDAAoD;IACpDS,MAAMX,SAAS,CAACa,SAAS,GAAGhB,aAAae,gBAAgBb,mBAAmBC,SAAS,EAAEW,MAAMX,SAAS,CAACa,SAAS;IAChH,oDAAoD;IACpDF,MAAMV,MAAM,CAACY,SAAS,GAAGhB,aAAae,gBAAgBb,mBAAmBE,MAAM,EAAEU,MAAMV,MAAM,CAACY,SAAS;IAEvG,OAAOF;AACT,EAAE"}
@@ -1,3 +1,3 @@
1
1
  /**
2
- * State used in rendering Toast
2
+ * State used in rendering Toast, without design-only state.
3
3
  */ export { };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\nimport type { ToastIntent } from '../../state/types';\n\nexport type ToastSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToastContextValues = {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n\n/**\n * Toast Props\n */\nexport type ToastProps = ComponentProps<ToastSlots> & {\n appearance?: BackgroundAppearanceContextValue;\n};\n\n/**\n * State used in rendering Toast\n */\nexport type ToastState = ComponentState<ToastSlots> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n intent?: ToastIntent | undefined;\n};\n"],"names":[],"mappings":"AAmBA;;CAEC,GACD,WAGE"}
1
+ {"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\nimport type { ToastIntent } from '../../state/types';\n\nexport type ToastSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToastContextValues = {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n\n/**\n * Toast Props\n */\nexport type ToastProps = ComponentProps<ToastSlots> & {\n appearance?: BackgroundAppearanceContextValue;\n};\n\n/**\n * Toast Props without design-only props.\n */\nexport type ToastBaseProps = Omit<ToastProps, 'appearance'>;\n\n/**\n * State used in rendering Toast\n */\nexport type ToastState = ComponentState<ToastSlots> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n intent?: ToastIntent | undefined;\n};\n\n/**\n * State used in rendering Toast, without design-only state.\n */\nexport type ToastBaseState = Omit<ToastState, 'backgroundAppearance'>;\n"],"names":[],"mappings":"AAgCA;;CAEC,GACD,WAAsE"}
@@ -1,4 +1,4 @@
1
1
  export { Toast } from './Toast';
2
2
  export { renderToast_unstable } from './renderToast';
3
- export { useToast_unstable } from './useToast';
3
+ export { useToastBase_unstable, useToast_unstable } from './useToast';
4
4
  export { toastClassNames, useToastStyles_unstable } from './useToastStyles.styles';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toast/index.ts"],"sourcesContent":["export { Toast } from './Toast';\nexport type { ToastContextValues, ToastProps, ToastSlots, ToastState } from './Toast.types';\nexport { renderToast_unstable } from './renderToast';\nexport { useToast_unstable } from './useToast';\nexport { toastClassNames, useToastStyles_unstable } from './useToastStyles.styles';\n"],"names":["Toast","renderToast_unstable","useToast_unstable","toastClassNames","useToastStyles_unstable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAEhC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,0BAA0B"}
1
+ {"version":3,"sources":["../src/components/Toast/index.ts"],"sourcesContent":["export { Toast } from './Toast';\nexport type {\n ToastBaseProps,\n ToastBaseState,\n ToastContextValues,\n ToastProps,\n ToastSlots,\n ToastState,\n} from './Toast.types';\nexport { renderToast_unstable } from './renderToast';\nexport { useToastBase_unstable, useToast_unstable } from './useToast';\nexport { toastClassNames, useToastStyles_unstable } from './useToastStyles.styles';\n"],"names":["Toast","renderToast_unstable","useToastBase_unstable","useToast_unstable","toastClassNames","useToastStyles_unstable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAShC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,qBAAqB,EAAEC,iBAAiB,QAAQ,aAAa;AACtE,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,0BAA0B"}
@@ -2,14 +2,11 @@
2
2
  import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
3
3
  import { useToastContainerContext } from '../../contexts/toastContainerContext';
4
4
  /**
5
- * Create the state required to render Toast.
5
+ * Create the base state required to render Toast, without design-only props.
6
6
  *
7
- * The returned state can be modified with hooks such as useToastStyles_unstable,
8
- * before being passed to renderToast_unstable.
9
- *
10
- * @param props - props from this instance of Toast
7
+ * @param props - props from this instance of Toast (without appearance)
11
8
  * @param ref - reference to root HTMLElement of Toast
12
- */ export const useToast_unstable = (props, ref)=>{
9
+ */ export const useToastBase_unstable = (props, ref)=>{
13
10
  const { intent } = useToastContainerContext();
14
11
  return {
15
12
  components: {
@@ -24,7 +21,21 @@ import { useToastContainerContext } from '../../contexts/toastContainerContext';
24
21
  }), {
25
22
  elementType: 'div'
26
23
  }),
27
- backgroundAppearance: props.appearance,
28
24
  intent
29
25
  };
30
26
  };
27
+ /**
28
+ * Create the state required to render Toast.
29
+ *
30
+ * The returned state can be modified with hooks such as useToastStyles_unstable,
31
+ * before being passed to renderToast_unstable.
32
+ *
33
+ * @param props - props from this instance of Toast
34
+ * @param ref - reference to root HTMLElement of Toast
35
+ */ export const useToast_unstable = (props, ref)=>{
36
+ const state = useToastBase_unstable(props, ref);
37
+ return {
38
+ ...state,
39
+ backgroundAppearance: props.appearance
40
+ };
41
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastProps, ToastState } from './Toast.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the state required to render Toast.\n *\n * The returned state can be modified with hooks such as useToastStyles_unstable,\n * before being passed to renderToast_unstable.\n *\n * @param props - props from this instance of Toast\n * @param ref - reference to root HTMLElement of Toast\n */\nexport const useToast_unstable = (props: ToastProps, ref: React.Ref<HTMLElement>): ToastState => {\n const { intent } = useToastContainerContext();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n ...props,\n }),\n { elementType: 'div' },\n ),\n backgroundAppearance: props.appearance,\n intent,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useToastContainerContext","useToast_unstable","props","ref","intent","components","root","always","elementType","backgroundAppearance","appearance"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE3E,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,MAAM,EAAE,GAAGJ;IAEnB,OAAO;QACLK,YAAY;YACVC,MAAM;QACR;QACAA,MAAMP,KAAKQ,MAAM,CACfT,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FK,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAEM,aAAa;QAAM;QAEvBC,sBAAsBP,MAAMQ,UAAU;QACtCN;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastBaseProps, ToastBaseState, ToastProps, ToastState } from './Toast.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * Create the base state required to render Toast, without design-only props.\n *\n * @param props - props from this instance of Toast (without appearance)\n * @param ref - reference to root HTMLElement of Toast\n */\nexport const useToastBase_unstable = (props: ToastBaseProps, ref: React.Ref<HTMLElement>): ToastBaseState => {\n const { intent } = useToastContainerContext();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n ...props,\n }),\n { elementType: 'div' },\n ),\n intent,\n };\n};\n\n/**\n * Create the state required to render Toast.\n *\n * The returned state can be modified with hooks such as useToastStyles_unstable,\n * before being passed to renderToast_unstable.\n *\n * @param props - props from this instance of Toast\n * @param ref - reference to root HTMLElement of Toast\n */\nexport const useToast_unstable = (props: ToastProps, ref: React.Ref<HTMLElement>): ToastState => {\n const state = useToastBase_unstable(props, ref);\n return {\n ...state,\n backgroundAppearance: props.appearance,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useToastContainerContext","useToastBase_unstable","props","ref","intent","components","root","always","elementType","useToast_unstable","state","backgroundAppearance","appearance"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE3E,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;CAKC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,MAAM,EAAE,GAAGJ;IAEnB,OAAO;QACLK,YAAY;YACVC,MAAM;QACR;QACAA,MAAMP,KAAKQ,MAAM,CACfT,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FK,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAEM,aAAa;QAAM;QAEvBJ;IACF;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMK,oBAAoB,CAACP,OAAmBC;IACnD,MAAMO,QAAQT,sBAAsBC,OAAOC;IAC3C,OAAO;QACL,GAAGO,KAAK;QACRC,sBAAsBT,MAAMU,UAAU;IACxC;AACF,EAAE"}
@@ -22,6 +22,7 @@ export const useToastStyles_unstable = state => {
22
22
 
23
23
  const rootBaseClassName = useRootBaseClassName();
24
24
  const styles = useStyles();
25
+ // eslint-disable-next-line react-hooks/immutability
25
26
  state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);
26
27
  return state;
27
28
  };
@@ -1 +1 @@
1
- {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","toastClassNames","root","useRootBaseClassName","useStyles","inverted","sj55zd","De3pzq","d","useToastStyles_unstable","state","rootBaseClassName","styles","className","backgroundAppearance"],"sources":["useToastStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastClassNames = {\n root: 'fui-Toast'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n padding: '12px',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n boxShadow: tokens.shadow8,\n fontSize: tokens.fontSizeBase300,\n lineHeight: '20px',\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1\n});\nconst useStyles = makeStyles({\n inverted: {\n color: tokens.colorNeutralForegroundInverted2,\n backgroundColor: tokens.colorNeutralBackgroundInverted\n }\n});\n/**\n * Apply styling to the Toast slots based on the state\n */ export const useToastStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,eAAe,GAAG;EAC3BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGN,aAAA,4XAY5B,CAAC;AACF,MAAMO,SAAS,gBAAGN,QAAA;EAAAO,QAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAKjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,uBAAuB,GAAIC,KAAK,IAAG;EAChD,aAAa;;EACb,MAAMC,iBAAiB,GAAGR,oBAAoB,CAAC,CAAC;EAChD,MAAMS,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1BM,KAAK,CAACR,IAAI,CAACW,SAAS,GAAGd,YAAY,CAACE,eAAe,CAACC,IAAI,EAAES,iBAAiB,EAAED,KAAK,CAACI,oBAAoB,KAAK,UAAU,IAAIF,MAAM,CAACP,QAAQ,EAAEK,KAAK,CAACR,IAAI,CAACW,SAAS,CAAC;EAChK,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","toastClassNames","root","useRootBaseClassName","useStyles","inverted","sj55zd","De3pzq","d","useToastStyles_unstable","state","rootBaseClassName","styles","className","backgroundAppearance"],"sources":["useToastStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastClassNames = {\n root: 'fui-Toast'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n padding: '12px',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n boxShadow: tokens.shadow8,\n fontSize: tokens.fontSizeBase300,\n lineHeight: '20px',\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1\n});\nconst useStyles = makeStyles({\n inverted: {\n color: tokens.colorNeutralForegroundInverted2,\n backgroundColor: tokens.colorNeutralBackgroundInverted\n }\n});\n/**\n * Apply styling to the Toast slots based on the state\n */ export const useToastStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,eAAe,GAAG;EAC3BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGN,aAAA,4XAY5B,CAAC;AACF,MAAMO,SAAS,gBAAGN,QAAA;EAAAO,QAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAKjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,uBAAuB,GAAIC,KAAK,IAAG;EAChD,aAAa;;EACb,MAAMC,iBAAiB,GAAGR,oBAAoB,CAAC,CAAC;EAChD,MAAMS,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1B;EACAM,KAAK,CAACR,IAAI,CAACW,SAAS,GAAGd,YAAY,CAACE,eAAe,CAACC,IAAI,EAAES,iBAAiB,EAAED,KAAK,CAACI,oBAAoB,KAAK,UAAU,IAAIF,MAAM,CAACP,QAAQ,EAAEK,KAAK,CAACR,IAAI,CAACW,SAAS,CAAC;EAChK,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}