@fluentui/react-toast 9.3.63 → 9.3.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -2
- package/dist/index.d.ts +1 -0
- package/lib/components/Toast/Toast.types.js.map +1 -1
- package/lib/components/Toast/useToast.js +4 -1
- package/lib/components/Toast/useToast.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Toast/Toast.types.js.map +1 -1
- package/lib-commonjs/components/Toast/useToast.js +4 -1
- package/lib-commonjs/components/Toast/useToast.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-toast
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 08 Jan 2025 18:29:15 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.64](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.3.64)
|
|
8
|
+
|
|
9
|
+
Wed, 08 Jan 2025 18:29:15 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.63..@fluentui/react-toast_v9.3.64)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- feat: Add intent property to Toast state and useToast hook. Correct media className assignment in useToastTitleStyles. ([PR #33550](https://github.com/microsoft/fluentui/pull/33550) by soumya_tripathy@outlook.com)
|
|
15
|
+
- Bump @fluentui/react-aria to v9.13.13 ([PR #33550](https://github.com/microsoft/fluentui/pull/33550) by beachball)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.49 ([PR #33550](https://github.com/microsoft/fluentui/pull/33550) by beachball)
|
|
17
|
+
- Bump @fluentui/react-motion to v9.6.6 ([PR #33550](https://github.com/microsoft/fluentui/pull/33550) by beachball)
|
|
18
|
+
- Bump @fluentui/react-motion-components-preview to v0.4.2 ([PR #33550](https://github.com/microsoft/fluentui/pull/33550) by beachball)
|
|
19
|
+
- Bump @fluentui/react-portal to v9.4.41 ([PR #33550](https://github.com/microsoft/fluentui/pull/33550) by beachball)
|
|
20
|
+
|
|
7
21
|
## [9.3.63](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.3.63)
|
|
8
22
|
|
|
9
|
-
Mon, 16 Dec 2024 16:
|
|
23
|
+
Mon, 16 Dec 2024 16:26:49 GMT
|
|
10
24
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.62..@fluentui/react-toast_v9.3.63)
|
|
11
25
|
|
|
12
26
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -327,6 +327,7 @@ export declare type ToastSlots = {
|
|
|
327
327
|
*/
|
|
328
328
|
export declare type ToastState = ComponentState<ToastSlots> & {
|
|
329
329
|
backgroundAppearance: BackgroundAppearanceContextValue;
|
|
330
|
+
intent?: ToastIntent | undefined;
|
|
330
331
|
};
|
|
331
332
|
|
|
332
333
|
export declare type ToastStatus = 'queued' | 'visible' | 'dismissed' | 'unmounted';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\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};\n"],"names":[],"rangeMappings":";;","mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { 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":[],"rangeMappings":";;","mappings":"AAmBA;;CAEC,GACD,WAGE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
3
|
+
import { useToastContainerContext } from '../../contexts/toastContainerContext';
|
|
3
4
|
/**
|
|
4
5
|
* Create the state required to render Toast.
|
|
5
6
|
*
|
|
@@ -9,6 +10,7 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
|
9
10
|
* @param props - props from this instance of Toast
|
|
10
11
|
* @param ref - reference to root HTMLElement of Toast
|
|
11
12
|
*/ export const useToast_unstable = (props, ref)=>{
|
|
13
|
+
const { intent } = useToastContainerContext();
|
|
12
14
|
return {
|
|
13
15
|
components: {
|
|
14
16
|
root: 'div'
|
|
@@ -22,6 +24,7 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
|
22
24
|
}), {
|
|
23
25
|
elementType: 'div'
|
|
24
26
|
}),
|
|
25
|
-
backgroundAppearance: props.appearance
|
|
27
|
+
backgroundAppearance: props.appearance,
|
|
28
|
+
intent
|
|
26
29
|
};
|
|
27
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastProps, ToastState } from './Toast.types';\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 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 };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useToast_unstable","props","ref","components","root","always","elementType","backgroundAppearance","appearance"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["import * 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":["React","getIntrinsicElementProps","slot","useToastContainerContext","useToast_unstable","props","ref","intent","components","root","always","elementType","backgroundAppearance","appearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,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"}
|
|
@@ -70,7 +70,7 @@ export const useToastTitleStyles_unstable = state => {
|
|
|
70
70
|
const invertedStyles = useInvertedStyles();
|
|
71
71
|
state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
|
|
72
72
|
if (state.media) {
|
|
73
|
-
state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media,
|
|
73
|
+
state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent], state.media.className);
|
|
74
74
|
}
|
|
75
75
|
if (state.action) {
|
|
76
76
|
state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","__resetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"],"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word'\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media,
|
|
1
|
+
{"version":3,"names":["__styles","__resetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"],"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word'\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent], state.media.className);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAAC,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,CAAC,CAAC;EAC9D,MAAM;IAAEQ;EAAO,CAAC,GAAGN,KAAK;EACxB,MAAMO,cAAc,GAAGjB,iBAAiB,CAAC,CAAC;EAC1CU,KAAK,CAAChB,IAAI,CAACwB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACC,IAAI,EAAEiB,iBAAiB,EAAED,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACvB,IAAI,EAAEgB,KAAK,CAAChB,IAAI,CAACwB,SAAS,CAAC;EACzK,IAAIR,KAAK,CAACf,KAAK,EAAE;IACbe,KAAK,CAACf,KAAK,CAACuB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACE,KAAK,EAAEkB,kBAAkB,EAAEH,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACtB,KAAK,EAAEqB,MAAM,IAAIF,gBAAgB,CAACE,MAAM,CAAC,EAAEA,MAAM,IAAIN,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIJ,wBAAwB,CAACC,MAAM,CAAC,EAAEN,KAAK,CAACf,KAAK,CAACuB,SAAS,CAAC;EAC/S;EACA,IAAIR,KAAK,CAACd,MAAM,EAAE;IACdc,KAAK,CAACd,MAAM,CAACsB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACG,MAAM,EAAEgB,mBAAmB,EAAEF,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACrB,MAAM,EAAEc,KAAK,CAACd,MAAM,CAACsB,SAAS,CAAC;EACvL;EACA,OAAOR,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\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};\n"],"names":[],"rangeMappings":";;","mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/Toast/Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { 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":[],"rangeMappings":";;","mappings":"AAmBA;;CAEC"}
|
|
@@ -11,7 +11,9 @@ Object.defineProperty(exports, "useToast_unstable", {
|
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
+
const _toastContainerContext = require("../../contexts/toastContainerContext");
|
|
14
15
|
const useToast_unstable = (props, ref)=>{
|
|
16
|
+
const { intent } = (0, _toastContainerContext.useToastContainerContext)();
|
|
15
17
|
return {
|
|
16
18
|
components: {
|
|
17
19
|
root: 'div'
|
|
@@ -25,6 +27,7 @@ const useToast_unstable = (props, ref)=>{
|
|
|
25
27
|
}), {
|
|
26
28
|
elementType: 'div'
|
|
27
29
|
}),
|
|
28
|
-
backgroundAppearance: props.appearance
|
|
30
|
+
backgroundAppearance: props.appearance,
|
|
31
|
+
intent
|
|
29
32
|
};
|
|
30
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { ToastProps, ToastState } from './Toast.types';\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 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 };\n};\n"],"names":["useToast_unstable","props","ref","components","root","slot","always","getIntrinsicElementProps","elementType","backgroundAppearance","appearance"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/Toast/useToast.ts"],"sourcesContent":["import * 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":["useToast_unstable","props","ref","intent","useToastContainerContext","components","root","slot","always","getIntrinsicElementProps","elementType","backgroundAppearance","appearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;gCACwB;uCAEN;AAWlC,MAAMA,oBAAoB,CAACC,OAAmBC;IACnD,MAAM,EAAEC,MAAM,EAAE,GAAGC,IAAAA,+CAAAA;IAEnB,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FP,KAAKA;YACL,GAAGD,KAAK;QACV,IACA;YAAES,aAAa;QAAM;QAEvBC,sBAAsBV,MAAMW,UAAU;QACtCT;IACF;AACF"}
|
|
@@ -103,7 +103,7 @@ const useToastTitleStyles_unstable = (state)=>{
|
|
|
103
103
|
const invertedStyles = useInvertedStyles();
|
|
104
104
|
state.root.className = (0, _react.mergeClasses)(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
|
|
105
105
|
if (state.media) {
|
|
106
|
-
state.media.className = (0, _react.mergeClasses)(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media,
|
|
106
|
+
state.media.className = (0, _react.mergeClasses)(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent], state.media.className);
|
|
107
107
|
}
|
|
108
108
|
if (state.action) {
|
|
109
109
|
state.action.className = (0, _react.mergeClasses)(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word'\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media,
|
|
1
|
+
{"version":3,"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word'\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1\n },\n error: {\n color: tokens.colorStatusDangerForeground1\n },\n warning: {\n color: tokens.colorStatusWarningForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent], state.media.className);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n"],"names":["toastTitleClassNames","useToastTitleStyles_unstable","root","media","action","useRootBaseClassName","__resetStyles","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","__styles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","mergeClasses","backgroundAppearance"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,oBAAoB;eAApBA;;IAmEIC,4BAA4B;eAA5BA;;;uBArEyC;AAEnD,MAAMD,uBAAuB;IAChCE,MAAM;IACNC,OAAO;IACPC,QAAQ;AACZ;AACA,MAAMC,uBAAoB,WAAA,GAAGC,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mBAAmBD,MAAMU,oBAAoB,KAAK,cAAcH,eAAexB,IAAI,EAAEiB,MAAMjB,IAAI,CAACyB,SAAS;IACxK,IAAIR,MAAMhB,KAAK,EAAE;QACbgB,MAAMhB,KAAK,CAACwB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBG,KAAK,EAAEmB,oBAAoBH,MAAMU,oBAAoB,KAAK,cAAcH,eAAevB,KAAK,EAAEsB,UAAUF,gBAAgB,CAACE,OAAO,EAAEA,UAAUN,MAAMU,oBAAoB,KAAK,cAAcL,wBAAwB,CAACC,OAAO,EAAEN,MAAMhB,KAAK,CAACwB,SAAS;IAC9S;IACA,IAAIR,MAAMf,MAAM,EAAE;QACde,MAAMf,MAAM,CAACuB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,qBAAqBI,MAAM,EAAEiB,qBAAqBF,MAAMU,oBAAoB,KAAK,cAAcH,eAAetB,MAAM,EAAEe,MAAMf,MAAM,CAACuB,SAAS;IACtL;IACA,OAAOR;AACX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-toast",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.64",
|
|
4
4
|
"description": "Toast component for Fluent UI",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@fluentui/keyboard-keys": "^9.0.8",
|
|
24
|
-
"@fluentui/react-aria": "^9.13.
|
|
24
|
+
"@fluentui/react-aria": "^9.13.13",
|
|
25
25
|
"@fluentui/react-icons": "^2.0.245",
|
|
26
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
27
|
-
"@fluentui/react-motion": "^9.6.
|
|
28
|
-
"@fluentui/react-motion-components-preview": "^0.4.
|
|
29
|
-
"@fluentui/react-portal": "^9.4.
|
|
26
|
+
"@fluentui/react-jsx-runtime": "^9.0.49",
|
|
27
|
+
"@fluentui/react-motion": "^9.6.6",
|
|
28
|
+
"@fluentui/react-motion-components-preview": "^0.4.2",
|
|
29
|
+
"@fluentui/react-portal": "^9.4.41",
|
|
30
30
|
"@fluentui/react-shared-contexts": "^9.21.2",
|
|
31
31
|
"@fluentui/react-tabster": "^9.23.2",
|
|
32
32
|
"@fluentui/react-theme": "^9.1.24",
|