@fluentui/react-alert 9.0.0-beta.13 → 9.0.0-beta.131

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 (47) hide show
  1. package/CHANGELOG.md +1455 -3
  2. package/README.md +5 -3
  3. package/dist/index.d.ts +12 -3
  4. package/lib/Alert.js +1 -2
  5. package/lib/Alert.js.map +1 -1
  6. package/lib/components/Alert/Alert.js +13 -8
  7. package/lib/components/Alert/Alert.js.map +1 -1
  8. package/lib/components/Alert/Alert.types.js +5 -2
  9. package/lib/components/Alert/Alert.types.js.map +1 -1
  10. package/lib/components/Alert/index.js +4 -6
  11. package/lib/components/Alert/index.js.map +1 -1
  12. package/lib/components/Alert/renderAlert.js +16 -13
  13. package/lib/components/Alert/renderAlert.js.map +1 -1
  14. package/lib/components/Alert/useAlert.js +64 -69
  15. package/lib/components/Alert/useAlert.js.map +1 -1
  16. package/lib/components/Alert/useAlertStyles.styles.js +167 -0
  17. package/lib/components/Alert/useAlertStyles.styles.js.map +1 -0
  18. package/lib/components/Alert/useAlertStyles.styles.raw.js +107 -0
  19. package/lib/components/Alert/useAlertStyles.styles.raw.js.map +1 -0
  20. package/lib/index.js +1 -1
  21. package/lib/index.js.map +1 -1
  22. package/lib-commonjs/Alert.js +26 -8
  23. package/lib-commonjs/Alert.js.map +1 -1
  24. package/lib-commonjs/components/Alert/Alert.js +23 -23
  25. package/lib-commonjs/components/Alert/Alert.js.map +1 -1
  26. package/lib-commonjs/components/Alert/Alert.types.js +5 -3
  27. package/lib-commonjs/components/Alert/Alert.types.js.map +1 -1
  28. package/lib-commonjs/components/Alert/index.js +29 -16
  29. package/lib-commonjs/components/Alert/index.js.map +1 -1
  30. package/lib-commonjs/components/Alert/renderAlert.js +20 -21
  31. package/lib-commonjs/components/Alert/renderAlert.js.map +1 -1
  32. package/lib-commonjs/components/Alert/useAlert.js +74 -92
  33. package/lib-commonjs/components/Alert/useAlert.js.map +1 -1
  34. package/lib-commonjs/components/Alert/useAlertStyles.styles.js +258 -0
  35. package/lib-commonjs/components/Alert/useAlertStyles.styles.js.map +1 -0
  36. package/lib-commonjs/components/Alert/useAlertStyles.styles.raw.js +120 -0
  37. package/lib-commonjs/components/Alert/useAlertStyles.styles.raw.js.map +1 -0
  38. package/lib-commonjs/index.js +25 -36
  39. package/lib-commonjs/index.js.map +1 -1
  40. package/package.json +33 -30
  41. package/CHANGELOG.json +0 -552
  42. package/Migration.md +0 -0
  43. package/Spec.md +0 -97
  44. package/lib/components/Alert/useAlertStyles.js +0 -112
  45. package/lib/components/Alert/useAlertStyles.js.map +0 -1
  46. package/lib-commonjs/components/Alert/useAlertStyles.js +0 -123
  47. package/lib-commonjs/components/Alert/useAlertStyles.js.map +0 -1
@@ -0,0 +1,107 @@
1
+ 'use client';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
4
+ import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
5
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
6
+ export const alertClassNames = {
7
+ root: 'fui-Alert',
8
+ icon: 'fui-Alert__icon',
9
+ action: 'fui-Alert__action',
10
+ avatar: 'fui-Alert__avatar'
11
+ };
12
+ const useStyles = makeStyles({
13
+ root: {
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ minHeight: '44px',
17
+ padding: '0 12px',
18
+ borderRadius: '4px',
19
+ border: `1px solid ${tokens.colorTransparentStroke}`,
20
+ boxShadow: tokens.shadow8,
21
+ fontSize: tokens.fontSizeBase300,
22
+ fontWeight: tokens.fontWeightSemibold,
23
+ color: tokens.colorNeutralForeground1,
24
+ backgroundColor: tokens.colorNeutralBackground1
25
+ },
26
+ inverted: {
27
+ color: tokens.colorNeutralForegroundInverted2,
28
+ backgroundColor: tokens.colorNeutralBackgroundInverted
29
+ },
30
+ icon: {
31
+ height: '16px',
32
+ fontSize: '16px',
33
+ padding: '0 8px 0 0'
34
+ },
35
+ avatar: {
36
+ margin: '0 8px 0 0'
37
+ },
38
+ action: {
39
+ padding: '5px 10px',
40
+ minWidth: 0,
41
+ marginLeft: 'auto',
42
+ color: tokens.colorBrandForeground1
43
+ }
44
+ });
45
+ const useIntentIconStyles = makeStyles({
46
+ success: {
47
+ color: tokens.colorPaletteGreenForeground3
48
+ },
49
+ error: {
50
+ color: tokens.colorPaletteRedForeground3
51
+ },
52
+ warning: {
53
+ color: tokens.colorPaletteYellowForeground2
54
+ },
55
+ info: {
56
+ color: tokens.colorNeutralForeground2
57
+ }
58
+ });
59
+ const useIntentIconStylesInverted = makeStyles({
60
+ success: {
61
+ color: tokens.colorPaletteGreenForegroundInverted
62
+ },
63
+ error: {
64
+ color: tokens.colorPaletteRedForegroundInverted
65
+ },
66
+ warning: {
67
+ color: tokens.colorPaletteYellowForegroundInverted
68
+ },
69
+ info: {
70
+ color: tokens.colorNeutralForegroundInverted2
71
+ }
72
+ });
73
+ const useActionButtonColorInverted = makeStyles({
74
+ action: {
75
+ color: tokens.colorBrandForegroundInverted,
76
+ ...createCustomFocusIndicatorStyle({
77
+ ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),
78
+ outlineColor: tokens.colorNeutralBackground5Pressed
79
+ }, {
80
+ enableOutline: true
81
+ })
82
+ }
83
+ });
84
+ /**
85
+ * @deprecated please use the Toast or MessageBar component
86
+ * Apply styling to the Alert slots based on the state
87
+ */ // eslint-disable-next-line @typescript-eslint/no-deprecated
88
+ export const useAlertStyles_unstable = (state)=>{
89
+ const inverted = state.appearance === 'inverted';
90
+ const styles = useStyles();
91
+ const intentIconStylesPrimary = useIntentIconStyles();
92
+ const intentIconStylesInverted = useIntentIconStylesInverted();
93
+ const actionStylesInverted = useActionButtonColorInverted();
94
+ // eslint-disable-next-line react-compiler/react-compiler
95
+ state.root.className = mergeClasses(alertClassNames.root, styles.root, inverted && styles.inverted, state.root.className);
96
+ if (state.icon) {
97
+ state.icon.className = mergeClasses(alertClassNames.icon, styles.icon, state.intent && (inverted ? intentIconStylesInverted[state.intent] : intentIconStylesPrimary[state.intent]), state.icon.className);
98
+ }
99
+ if (state.avatar) {
100
+ state.avatar.className = mergeClasses(alertClassNames.avatar, styles.avatar, state.avatar.className);
101
+ }
102
+ if (state.action) {
103
+ // Note: inverted && actionStylesInverted.action has the highest piority and must be merged last
104
+ state.action.className = mergeClasses(alertClassNames.action, styles.action, inverted && actionStylesInverted.action, state.action.className);
105
+ }
106
+ return state;
107
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Alert/useAlertStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport type { AlertSlots, AlertState } from './Alert.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const alertClassNames: SlotClassNames<AlertSlots> = {\n root: 'fui-Alert',\n icon: 'fui-Alert__icon',\n action: 'fui-Alert__action',\n avatar: 'fui-Alert__avatar',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n minHeight: '44px',\n padding: '0 12px',\n borderRadius: '4px',\n border: `1px solid ${tokens.colorTransparentStroke}`,\n boxShadow: tokens.shadow8,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1,\n },\n inverted: {\n color: tokens.colorNeutralForegroundInverted2,\n backgroundColor: tokens.colorNeutralBackgroundInverted,\n },\n icon: {\n height: '16px',\n fontSize: '16px',\n padding: '0 8px 0 0',\n },\n avatar: { margin: '0 8px 0 0' },\n action: {\n padding: '5px 10px',\n minWidth: 0,\n marginLeft: 'auto',\n color: tokens.colorBrandForeground1,\n },\n});\n\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorPaletteGreenForeground3,\n },\n error: {\n color: tokens.colorPaletteRedForeground3,\n },\n warning: {\n color: tokens.colorPaletteYellowForeground2,\n },\n info: {\n color: tokens.colorNeutralForeground2,\n },\n});\n\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorPaletteGreenForegroundInverted,\n },\n error: {\n color: tokens.colorPaletteRedForegroundInverted,\n },\n warning: {\n color: tokens.colorPaletteYellowForegroundInverted,\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n});\n\nconst useActionButtonColorInverted = makeStyles({\n action: {\n color: tokens.colorBrandForegroundInverted,\n ...createCustomFocusIndicatorStyle(\n {\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n outlineColor: tokens.colorNeutralBackground5Pressed,\n },\n { enableOutline: true },\n ),\n },\n});\n\n/**\n * @deprecated please use the Toast or MessageBar component\n * Apply styling to the Alert slots based on the state\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const useAlertStyles_unstable = (state: AlertState): AlertState => {\n const inverted = state.appearance === 'inverted';\n const styles = useStyles();\n const intentIconStylesPrimary = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const actionStylesInverted = useActionButtonColorInverted();\n\n // eslint-disable-next-line react-compiler/react-compiler\n state.root.className = mergeClasses(\n alertClassNames.root,\n styles.root,\n inverted && styles.inverted,\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n alertClassNames.icon,\n styles.icon,\n state.intent && (inverted ? intentIconStylesInverted[state.intent] : intentIconStylesPrimary[state.intent]),\n state.icon.className,\n );\n }\n\n if (state.avatar) {\n state.avatar.className = mergeClasses(alertClassNames.avatar, styles.avatar, state.avatar.className);\n }\n\n if (state.action) {\n // Note: inverted && actionStylesInverted.action has the highest piority and must be merged last\n state.action.className = mergeClasses(\n alertClassNames.action,\n styles.action,\n inverted && actionStylesInverted.action,\n state.action.className,\n );\n }\n\n return state;\n};\n"],"names":["tokens","makeStyles","mergeClasses","shorthands","createCustomFocusIndicatorStyle","alertClassNames","root","icon","action","avatar","useStyles","display","alignItems","minHeight","padding","borderRadius","border","colorTransparentStroke","boxShadow","shadow8","fontSize","fontSizeBase300","fontWeight","fontWeightSemibold","color","colorNeutralForeground1","backgroundColor","colorNeutralBackground1","inverted","colorNeutralForegroundInverted2","colorNeutralBackgroundInverted","height","margin","minWidth","marginLeft","colorBrandForeground1","useIntentIconStyles","success","colorPaletteGreenForeground3","error","colorPaletteRedForeground3","warning","colorPaletteYellowForeground2","info","colorNeutralForeground2","useIntentIconStylesInverted","colorPaletteGreenForegroundInverted","colorPaletteRedForegroundInverted","colorPaletteYellowForegroundInverted","useActionButtonColorInverted","colorBrandForegroundInverted","borderColor","colorTransparentStrokeInteractive","outlineColor","colorNeutralBackground5Pressed","enableOutline","useAlertStyles_unstable","state","appearance","styles","intentIconStylesPrimary","intentIconStylesInverted","actionStylesInverted","className","intent"],"mappings":"AAAA;AAEA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACtE,SAASC,+BAA+B,QAAQ,0BAA0B;AAI1E,4DAA4D;AAC5D,OAAO,MAAMC,kBAA8C;IACzDC,MAAM;IACNC,MAAM;IACNC,QAAQ;IACRC,QAAQ;AACV,EAAE;AAEF,MAAMC,YAAYT,WAAW;IAC3BK,MAAM;QACJK,SAAS;QACTC,YAAY;QACZC,WAAW;QACXC,SAAS;QACTC,cAAc;QACdC,QAAQ,CAAC,UAAU,EAAEhB,OAAOiB,sBAAsB,EAAE;QACpDC,WAAWlB,OAAOmB,OAAO;QACzBC,UAAUpB,OAAOqB,eAAe;QAChCC,YAAYtB,OAAOuB,kBAAkB;QACrCC,OAAOxB,OAAOyB,uBAAuB;QACrCC,iBAAiB1B,OAAO2B,uBAAuB;IACjD;IACAC,UAAU;QACRJ,OAAOxB,OAAO6B,+BAA+B;QAC7CH,iBAAiB1B,OAAO8B,8BAA8B;IACxD;IACAvB,MAAM;QACJwB,QAAQ;QACRX,UAAU;QACVN,SAAS;IACX;IACAL,QAAQ;QAAEuB,QAAQ;IAAY;IAC9BxB,QAAQ;QACNM,SAAS;QACTmB,UAAU;QACVC,YAAY;QACZV,OAAOxB,OAAOmC,qBAAqB;IACrC;AACF;AAEA,MAAMC,sBAAsBnC,WAAW;IACrCoC,SAAS;QACPb,OAAOxB,OAAOsC,4BAA4B;IAC5C;IACAC,OAAO;QACLf,OAAOxB,OAAOwC,0BAA0B;IAC1C;IACAC,SAAS;QACPjB,OAAOxB,OAAO0C,6BAA6B;IAC7C;IACAC,MAAM;QACJnB,OAAOxB,OAAO4C,uBAAuB;IACvC;AACF;AAEA,MAAMC,8BAA8B5C,WAAW;IAC7CoC,SAAS;QACPb,OAAOxB,OAAO8C,mCAAmC;IACnD;IACAP,OAAO;QACLf,OAAOxB,OAAO+C,iCAAiC;IACjD;IACAN,SAAS;QACPjB,OAAOxB,OAAOgD,oCAAoC;IACpD;IACAL,MAAM;QACJnB,OAAOxB,OAAO6B,+BAA+B;IAC/C;AACF;AAEA,MAAMoB,+BAA+BhD,WAAW;IAC9CO,QAAQ;QACNgB,OAAOxB,OAAOkD,4BAA4B;QAC1C,GAAG9C,gCACD;YACE,GAAGD,WAAWgD,WAAW,CAACnD,OAAOoD,iCAAiC,CAAC;YACnEC,cAAcrD,OAAOsD,8BAA8B;QACrD,GACA;YAAEC,eAAe;QAAK,EACvB;IACH;AACF;AAEA;;;CAGC,GACD,4DAA4D;AAC5D,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAM7B,WAAW6B,MAAMC,UAAU,KAAK;IACtC,MAAMC,SAASjD;IACf,MAAMkD,0BAA0BxB;IAChC,MAAMyB,2BAA2BhB;IACjC,MAAMiB,uBAAuBb;IAE7B,yDAAyD;IACzDQ,MAAMnD,IAAI,CAACyD,SAAS,GAAG7D,aACrBG,gBAAgBC,IAAI,EACpBqD,OAAOrD,IAAI,EACXsB,YAAY+B,OAAO/B,QAAQ,EAC3B6B,MAAMnD,IAAI,CAACyD,SAAS;IAGtB,IAAIN,MAAMlD,IAAI,EAAE;QACdkD,MAAMlD,IAAI,CAACwD,SAAS,GAAG7D,aACrBG,gBAAgBE,IAAI,EACpBoD,OAAOpD,IAAI,EACXkD,MAAMO,MAAM,IAAKpC,CAAAA,WAAWiC,wBAAwB,CAACJ,MAAMO,MAAM,CAAC,GAAGJ,uBAAuB,CAACH,MAAMO,MAAM,CAAC,AAAD,GACzGP,MAAMlD,IAAI,CAACwD,SAAS;IAExB;IAEA,IAAIN,MAAMhD,MAAM,EAAE;QAChBgD,MAAMhD,MAAM,CAACsD,SAAS,GAAG7D,aAAaG,gBAAgBI,MAAM,EAAEkD,OAAOlD,MAAM,EAAEgD,MAAMhD,MAAM,CAACsD,SAAS;IACrG;IAEA,IAAIN,MAAMjD,MAAM,EAAE;QAChB,gGAAgG;QAChGiD,MAAMjD,MAAM,CAACuD,SAAS,GAAG7D,aACvBG,gBAAgBG,MAAM,EACtBmD,OAAOnD,MAAM,EACboB,YAAYkC,qBAAqBtD,MAAM,EACvCiD,MAAMjD,MAAM,CAACuD,SAAS;IAE1B;IAEA,OAAON;AACT,EAAE"}
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
1
2
  export { Alert, alertClassNames, renderAlert_unstable, useAlertStyles_unstable, useAlert_unstable } from './Alert';
2
- //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { Alert, alertClassNames, renderAlert_unstable, useAlertStyles_unstable, useAlert_unstable } from './Alert';\nexport type { AlertProps, AlertSlots, AlertState } from './Alert';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport { Alert, alertClassNames, renderAlert_unstable, useAlertStyles_unstable, useAlert_unstable } from './Alert';\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type { AlertProps, AlertSlots, AlertState } from './Alert';\n"],"names":["Alert","alertClassNames","renderAlert_unstable","useAlertStyles_unstable","useAlert_unstable"],"mappings":"AAAA,4DAA4D;AAC5D,SAASA,KAAK,EAAEC,eAAe,EAAEC,oBAAoB,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ,UAAU"}
@@ -1,10 +1,28 @@
1
- "use strict";
2
-
1
+ /* eslint-disable @typescript-eslint/no-deprecated */ "use strict";
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
-
7
- const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
- tslib_1.__exportStar(require("./components/Alert/index"), exports);
10
- //# sourceMappingURL=Alert.js.map
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Alert: function() {
13
+ return _index.Alert;
14
+ },
15
+ alertClassNames: function() {
16
+ return _index.alertClassNames;
17
+ },
18
+ renderAlert_unstable: function() {
19
+ return _index.renderAlert_unstable;
20
+ },
21
+ useAlertStyles_unstable: function() {
22
+ return _index.useAlertStyles_unstable;
23
+ },
24
+ useAlert_unstable: function() {
25
+ return _index.useAlert_unstable;
26
+ }
27
+ });
28
+ const _index = require("./components/Alert/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["Alert.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Alert/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/Alert.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-deprecated */\nexport type { AlertProps, AlertSlots, AlertState } from './components/Alert/index';\nexport {\n Alert,\n alertClassNames,\n renderAlert_unstable,\n useAlertStyles_unstable,\n useAlert_unstable,\n} from './components/Alert/index';\n"],"names":["Alert","alertClassNames","renderAlert_unstable","useAlertStyles_unstable","useAlert_unstable"],"mappings":"AAAA,mDAAmD,GAEnD;;;;;;;;;;;;eACEA,YAAK;;;eACLC,sBAAe;;;eACfC,2BAAoB;;;eACpBC,8BAAuB;;;eACvBC,wBAAiB;;;uBACZ,2BAA2B"}
@@ -1,27 +1,27 @@
1
+ 'use client';
1
2
  "use strict";
2
-
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
- exports.Alert = void 0;
7
-
8
- const React = /*#__PURE__*/require("react");
9
-
10
- const renderAlert_1 = /*#__PURE__*/require("./renderAlert");
11
-
12
- const useAlert_1 = /*#__PURE__*/require("./useAlert");
13
-
14
- const useAlertStyles_1 = /*#__PURE__*/require("./useAlertStyles");
15
- /**
16
- * An Alert component displays a brief, important message to attract a user's attention
17
- * without interrupting their current task.
18
- */
19
-
20
-
21
- exports.Alert = /*#__PURE__*/React.forwardRef((props, ref) => {
22
- const state = useAlert_1.useAlert_unstable(props, ref);
23
- useAlertStyles_1.useAlertStyles_unstable(state);
24
- return renderAlert_1.renderAlert_unstable(state);
6
+ Object.defineProperty(exports, "Alert", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return Alert;
10
+ }
25
11
  });
26
- exports.Alert.displayName = 'Alert';
27
- //# sourceMappingURL=Alert.js.map
12
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
+ const _renderAlert = require("./renderAlert");
15
+ const _useAlert = require("./useAlert");
16
+ const _useAlertStylesstyles = require("./useAlertStyles.styles");
17
+ const Alert = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
18
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
19
+ const state = (0, _useAlert.useAlert_unstable)(props, ref);
20
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
21
+ (0, _useAlertStylesstyles.useAlertStyles_unstable)(state);
22
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
23
+ return (0, _renderAlert.renderAlert_unstable)(state);
24
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
25
+ });
26
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
27
+ Alert.displayName = 'Alert';
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Alert/Alert.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAKA;;;AAGG;;;AACU,OAAA,CAAA,KAAA,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpF,MAAM,KAAK,GAAG,UAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAAd;EAEA,gBAAA,CAAA,uBAAA,CAAwB,KAAxB;EACA,OAAO,aAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CALqD,CAAzC;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\n\nimport { renderAlert_unstable } from './renderAlert';\nimport { useAlert_unstable } from './useAlert';\nimport { useAlertStyles_unstable } from './useAlertStyles';\n\nimport type { AlertProps } from './Alert.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * An Alert component displays a brief, important message to attract a user's attention\n * without interrupting their current task.\n */\nexport const Alert: ForwardRefComponent<AlertProps> = React.forwardRef((props, ref) => {\n const state = useAlert_unstable(props, ref);\n\n useAlertStyles_unstable(state);\n return renderAlert_unstable(state);\n}) as ForwardRefComponent<AlertProps>;\n\nAlert.displayName = 'Alert';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/components/Alert/Alert.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { renderAlert_unstable } from './renderAlert';\nimport { useAlert_unstable } from './useAlert';\nimport { useAlertStyles_unstable } from './useAlertStyles.styles';\n\nimport type { AlertProps } from './Alert.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * @deprecated please use the Toast or MessageBar component\n * An Alert component displays a brief, important message to attract a user's attention\n * without interrupting their current task.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const Alert: ForwardRefComponent<AlertProps> = React.forwardRef((props, ref) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const state = useAlert_unstable(props, ref);\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n useAlertStyles_unstable(state);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return renderAlert_unstable(state);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n}) as ForwardRefComponent<AlertProps>;\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nAlert.displayName = 'Alert';\n"],"names":["React","renderAlert_unstable","useAlert_unstable","useAlertStyles_unstable","Alert","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;6BAEM,gBAAgB;0BACnB,aAAa;sCACP,0BAA0B;AAW3D,MAAMI,QAAAA,WAAAA,GAAyCJ,OAAMK,UAAU,CAAC,CAACC,OAAOC;IAC7E,4DAA4D;IAC5D,MAAMC,YAAQN,2BAAAA,EAAkBI,OAAOC;IAEvC,4DAA4D;QAC5DJ,6CAAAA,EAAwBK;IACxB,4DAA4D;IAC5D,WAAOP,iCAAAA,EAAqBO;AAC5B,4DAA4D;AAC9D,GAAsC;AAEtC,4DAA4D;AAC5DJ,MAAMK,WAAW,GAAG"}
@@ -1,6 +1,8 @@
1
+ /**
2
+ * State used in rendering Alert
3
+ * @deprecated please use the Toast or MessageBar component
4
+ */ // eslint-disable-next-line @typescript-eslint/no-deprecated
1
5
  "use strict";
2
-
3
6
  Object.defineProperty(exports, "__esModule", {
4
- value: true
7
+ value: true
5
8
  });
6
- //# sourceMappingURL=Alert.types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/components/Alert/Alert.types.ts"],"sourcesContent":["import { Avatar } from '@fluentui/react-avatar';\nimport { Button } from '@fluentui/react-button';\n\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * @deprecated please use the Toast or MessageBar component\n */\nexport type AlertSlots = {\n /**\n * The root slot is the top level container for the alert component\n */\n root: NonNullable<Slot<'div'>>;\n /**\n * The icon slot renders the icon determined by the `icon` or `intent` prop\n */\n icon?: Slot<'span'>;\n /**\n * The action slot renders a button that prompts the user to take action on the alert\n */\n action?: Slot<typeof Button>;\n /**\n * The avatar slot renders an avatar before the contents of the alert\n */\n avatar?: Slot<typeof Avatar>;\n};\n\n/**\n * Alert Props\n * @deprecated please use the Toast or MessageBar component\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type AlertProps = ComponentProps<AlertSlots> & {\n /**\n * The intent prop, if present, determines the icon to be rendered in the icon slot. The icon prop\n * overrides the intent prop\n */\n intent?: 'info' | 'success' | 'error' | 'warning';\n /**\n * The appearance of the Alert.\n * @default 'primary'\n */\n appearance?: 'primary' | 'inverted';\n};\n\n/**\n * State used in rendering Alert\n * @deprecated please use the Toast or MessageBar component\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type AlertState = ComponentState<AlertSlots> &\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Pick<AlertProps, 'intent'> &\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Required<Pick<AlertProps, 'appearance'>>;\n"],"names":[],"mappings":"AA6CA;;;CAGC,GACD,4DAA4D"}
@@ -1,18 +1,31 @@
1
- "use strict";
2
-
1
+ /* eslint-disable @typescript-eslint/no-deprecated */ "use strict";
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
-
7
- const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
- tslib_1.__exportStar(require("./Alert"), exports);
10
-
11
- tslib_1.__exportStar(require("./Alert.types"), exports);
12
-
13
- tslib_1.__exportStar(require("./renderAlert"), exports);
14
-
15
- tslib_1.__exportStar(require("./useAlert"), exports);
16
-
17
- tslib_1.__exportStar(require("./useAlertStyles"), exports);
18
- //# sourceMappingURL=index.js.map
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Alert: function() {
13
+ return _Alert.Alert;
14
+ },
15
+ alertClassNames: function() {
16
+ return _useAlertStylesstyles.alertClassNames;
17
+ },
18
+ renderAlert_unstable: function() {
19
+ return _renderAlert.renderAlert_unstable;
20
+ },
21
+ useAlertStyles_unstable: function() {
22
+ return _useAlertStylesstyles.useAlertStyles_unstable;
23
+ },
24
+ useAlert_unstable: function() {
25
+ return _useAlert.useAlert_unstable;
26
+ }
27
+ });
28
+ const _Alert = require("./Alert");
29
+ const _renderAlert = require("./renderAlert");
30
+ const _useAlert = require("./useAlert");
31
+ const _useAlertStylesstyles = require("./useAlertStyles.styles");
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Alert/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Alert';\nexport * from './Alert.types';\nexport * from './renderAlert';\nexport * from './useAlert';\nexport * from './useAlertStyles';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/components/Alert/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-deprecated */\nexport { Alert } from './Alert';\nexport type { AlertProps, AlertSlots, AlertState } from './Alert.types';\nexport { renderAlert_unstable } from './renderAlert';\nexport { useAlert_unstable } from './useAlert';\nexport { alertClassNames, useAlertStyles_unstable } from './useAlertStyles.styles';\n"],"names":["Alert","renderAlert_unstable","useAlert_unstable","alertClassNames","useAlertStyles_unstable"],"mappings":"AAAA,mDAAmD,GACnD;;;;;;;;;;;;eAASA,YAAK;;;eAILG,qCAAe;;;eAFfF,iCAAoB;;;eAEHG,6CAAuB;;;eADxCF,2BAAiB;;;uBAHJ,UAAU;6BAEK,gBAAgB;0BACnB,aAAa;sCACU,0BAA0B"}
@@ -1,25 +1,24 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.renderAlert_unstable = void 0;
7
-
8
- const React = /*#__PURE__*/require("react");
9
-
10
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
-
12
- const renderAlert_unstable = state => {
13
- const {
14
- slots,
15
- slotProps
16
- } = react_utilities_1.getSlots(state);
17
- return React.createElement(slots.root, { ...slotProps.root
18
- }, slots.icon && React.createElement(slots.icon, { ...slotProps.icon
19
- }), slots.avatar && React.createElement(slots.avatar, { ...slotProps.avatar
20
- }), slotProps.root.children, slots.action && React.createElement(slots.action, { ...slotProps.action
21
- }));
5
+ Object.defineProperty(exports, "renderAlert_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderAlert_unstable;
9
+ }
10
+ });
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const renderAlert_unstable = (state)=>{
14
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
15
+ (0, _reactutilities.assertSlots)(state);
16
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
17
+ children: [
18
+ state.icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.icon, {}),
19
+ state.avatar && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.avatar, {}),
20
+ state.root.children,
21
+ state.action && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.action, {})
22
+ ]
23
+ });
22
24
  };
23
-
24
- exports.renderAlert_unstable = renderAlert_unstable;
25
- //# sourceMappingURL=renderAlert.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Alert/renderAlert.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAIO,MAAM,oBAAoB,GAAI,KAAD,IAAsB;EACxD,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAqB,KAArB,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,IAAN,IAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADjB,EAEG,KAAK,CAAC,MAAN,IAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAFnB,EAGG,SAAS,CAAC,IAAV,CAAe,QAHlB,EAIG,KAAK,CAAC,MAAN,IAAgB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;EAAf,CAAb,CAJnB,CADF;AAQD,CAXM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\n\nimport { getSlots } from '@fluentui/react-utilities';\n\nimport type { AlertState, AlertSlots } from './Alert.types';\n\nexport const renderAlert_unstable = (state: AlertState) => {\n const { slots, slotProps } = getSlots<AlertSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {slots.avatar && <slots.avatar {...slotProps.avatar} />}\n {slotProps.root.children}\n {slots.action && <slots.action {...slotProps.action} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/components/Alert/renderAlert.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type * as React from 'react';\n\nimport type { AlertState, AlertSlots } from './Alert.types';\n\n/**\n * @deprecated please use the Toast or MessageBar component\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const renderAlert_unstable = (state: AlertState): React.ReactElement => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n assertSlots<AlertSlots>(state);\n\n return (\n <state.root>\n {state.icon && <state.icon />}\n {state.avatar && <state.avatar />}\n {state.root.children}\n {state.action && <state.action />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderAlert_unstable","state","root","icon","avatar","children","action"],"mappings":";;;;+BAWaC;;;;;;4BAVb,iCAAiD;gCACrB,4BAA4B;AASjD,6BAA6B,CAACC;IACnC,4DAA4D;QAC5DF,2BAAAA,EAAwBE;IAExB,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,IAAI,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,IAAI,EAAA,CAAA;YACzBF,MAAMG,MAAM,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,MAAM,EAAA,CAAA;YAC7BH,MAAMC,IAAI,CAACG,QAAQ;YACnBJ,MAAMK,MAAM,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,MAAM,EAAA,CAAA;;;AAGpC,EAAE"}
@@ -1,98 +1,80 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.useAlert_unstable = void 0;
7
-
8
- const React = /*#__PURE__*/require("react");
9
-
10
- const react_avatar_1 = /*#__PURE__*/require("@fluentui/react-avatar");
11
-
12
- const react_button_1 = /*#__PURE__*/require("@fluentui/react-button");
13
-
14
- const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
15
-
16
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
17
- /**
18
- * Create the state required to render Alert.
19
- *
20
- * The returned state can be modified with hooks such as useAlertStyles_unstable,
21
- * before being passed to renderAlert_unstable.
22
- *
23
- * @param props - props from this instance of Alert
24
- * @param ref - reference to root HTMLElement of Alert
25
- */
26
-
27
-
28
- const useAlert_unstable = (props, ref) => {
29
- const {
30
- appearance = 'primary',
31
- intent
32
- } = props;
33
- /** Determine the role and icon to render based on the intent */
34
-
35
- let defaultIcon;
36
- let defaultRole = 'status';
37
-
38
- switch (intent) {
39
- case 'success':
40
- defaultIcon = React.createElement(react_icons_1.CheckmarkCircleFilled, null);
41
- break;
42
-
43
- case 'error':
44
- defaultIcon = React.createElement(react_icons_1.DismissCircleFilled, null);
45
- defaultRole = 'alert';
46
- break;
47
-
48
- case 'warning':
49
- defaultIcon = React.createElement(react_icons_1.WarningFilled, null);
50
- defaultRole = 'alert';
51
- break;
52
-
53
- case 'info':
54
- defaultIcon = React.createElement(react_icons_1.InfoFilled, null);
55
- break;
56
- }
57
-
58
- const action = react_utilities_1.resolveShorthand(props.action, {
59
- defaultProps: {
60
- appearance: 'transparent'
5
+ Object.defineProperty(exports, "useAlert_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useAlert_unstable;
61
9
  }
62
- });
63
- const avatar = react_utilities_1.resolveShorthand(props.avatar);
64
- let icon;
65
- /** Avatar prop takes precedence over the icon or intent prop */
66
-
67
- if (!avatar) {
68
- icon = react_utilities_1.resolveShorthand(props.icon, {
69
- defaultProps: {
70
- children: defaultIcon
71
- },
72
- required: !!props.intent
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactavatar = require("@fluentui/react-avatar");
14
+ const _reactbutton = require("@fluentui/react-button");
15
+ const _reacticons = require("@fluentui/react-icons");
16
+ const _reactutilities = require("@fluentui/react-utilities");
17
+ const useAlert_unstable = (props, ref)=>{
18
+ const { appearance = 'primary', intent } = props;
19
+ /** Determine the role and icon to render based on the intent */ let defaultIcon;
20
+ let defaultRole = 'status';
21
+ switch(intent){
22
+ case 'success':
23
+ defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.CheckmarkCircleFilled, null);
24
+ break;
25
+ case 'error':
26
+ defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.DismissCircleFilled, null);
27
+ defaultRole = 'alert';
28
+ break;
29
+ case 'warning':
30
+ defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.WarningFilled, null);
31
+ defaultRole = 'alert';
32
+ break;
33
+ case 'info':
34
+ defaultIcon = /*#__PURE__*/ _react.createElement(_reacticons.InfoFilled, null);
35
+ break;
36
+ }
37
+ const action = _reactutilities.slot.optional(props.action, {
38
+ defaultProps: {
39
+ appearance: 'transparent'
40
+ },
41
+ elementType: _reactbutton.Button
73
42
  });
74
- }
75
-
76
- return {
77
- action,
78
- appearance,
79
- avatar,
80
- components: {
81
- root: 'div',
82
- icon: 'span',
83
- action: react_button_1.Button,
84
- avatar: react_avatar_1.Avatar
85
- },
86
- icon,
87
- intent,
88
- root: react_utilities_1.getNativeElementProps('div', {
89
- ref,
90
- role: defaultRole,
91
- children: props.children,
92
- ...props
93
- })
94
- };
43
+ const avatar = _reactutilities.slot.optional(props.avatar, {
44
+ elementType: _reactavatar.Avatar
45
+ });
46
+ let icon;
47
+ /** Avatar prop takes precedence over the icon or intent prop */ if (!avatar) {
48
+ icon = _reactutilities.slot.optional(props.icon, {
49
+ defaultProps: {
50
+ children: defaultIcon
51
+ },
52
+ renderByDefault: !!props.intent,
53
+ elementType: 'span'
54
+ });
55
+ }
56
+ return {
57
+ action,
58
+ appearance,
59
+ avatar,
60
+ components: {
61
+ root: 'div',
62
+ icon: 'span',
63
+ action: _reactbutton.Button,
64
+ avatar: _reactavatar.Avatar
65
+ },
66
+ icon,
67
+ intent,
68
+ root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
69
+ // FIXME:
70
+ // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
71
+ // but since it would be a breaking change to fix it, we are casting ref to it's proper type
72
+ ref: ref,
73
+ role: defaultRole,
74
+ children: props.children,
75
+ ...props
76
+ }), {
77
+ elementType: 'div'
78
+ })
79
+ };
95
80
  };
96
-
97
- exports.useAlert_unstable = useAlert_unstable;
98
- //# sourceMappingURL=useAlert.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Alert/useAlert.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAIA;;;;;;;;AAQG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAA+D;EAC9F,MAAM;IAAE,UAAU,GAAG,SAAf;IAA0B;EAA1B,IAAqC,KAA3C;EAEA;;EACA,IAAI,WAAJ;EACA,IAAI,WAAW,GAAG,QAAlB;;EACA,QAAQ,MAAR;IACE,KAAK,SAAL;MACE,WAAW,GAAG,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,qBAAD,EAAsB,IAAtB,CAAd;MACA;;IACF,KAAK,OAAL;MACE,WAAW,GAAG,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,mBAAD,EAAoB,IAApB,CAAd;MACA,WAAW,GAAG,OAAd;MACA;;IACF,KAAK,SAAL;MACE,WAAW,GAAG,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,aAAD,EAAc,IAAd,CAAd;MACA,WAAW,GAAG,OAAd;MACA;;IACF,KAAK,MAAL;MACE,WAAW,GAAG,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,UAAD,EAAW,IAAX,CAAd;MACA;EAdJ;;EAiBA,MAAM,MAAM,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,MAAvB,EAA+B;IAAE,YAAY,EAAE;MAAE,UAAU,EAAE;IAAd;EAAhB,CAA/B,CAAf;EACA,MAAM,MAAM,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,MAAvB,CAAf;EACA,IAAI,IAAJ;EACA;;EACA,IAAI,CAAC,MAAL,EAAa;IACX,IAAI,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,IAAvB,EAA6B;MAClC,YAAY,EAAE;QACZ,QAAQ,EAAE;MADE,CADoB;MAIlC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;IAJgB,CAA7B,CAAP;EAMD;;EAED,OAAO;IACL,MADK;IAEL,UAFK;IAGL,MAHK;IAIL,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,IAAI,EAAE,MAFI;MAGV,MAAM,EAAE,cAAA,CAAA,MAHE;MAIV,MAAM,EAAE,cAAA,CAAA;IAJE,CAJP;IAUL,IAVK;IAWL,MAXK;IAYL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;MACjC,GADiC;MAEjC,IAAI,EAAE,WAF2B;MAGjC,QAAQ,EAAE,KAAK,CAAC,QAHiB;MAIjC,GAAG;IAJ8B,CAA7B;EAZD,CAAP;AAmBD,CAvDM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\n\nimport { Avatar } from '@fluentui/react-avatar';\nimport { Button } from '@fluentui/react-button';\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\n\nimport type { AlertProps, AlertState } from './Alert.types';\n\n/**\n * Create the state required to render Alert.\n *\n * The returned state can be modified with hooks such as useAlertStyles_unstable,\n * before being passed to renderAlert_unstable.\n *\n * @param props - props from this instance of Alert\n * @param ref - reference to root HTMLElement of Alert\n */\nexport const useAlert_unstable = (props: AlertProps, ref: React.Ref<HTMLElement>): AlertState => {\n const { appearance = 'primary', intent } = props;\n\n /** Determine the role and icon to render based on the intent */\n let defaultIcon;\n let defaultRole = 'status';\n switch (intent) {\n case 'success':\n defaultIcon = <CheckmarkCircleFilled />;\n break;\n case 'error':\n defaultIcon = <DismissCircleFilled />;\n defaultRole = 'alert';\n break;\n case 'warning':\n defaultIcon = <WarningFilled />;\n defaultRole = 'alert';\n break;\n case 'info':\n defaultIcon = <InfoFilled />;\n break;\n }\n\n const action = resolveShorthand(props.action, { defaultProps: { appearance: 'transparent' } });\n const avatar = resolveShorthand(props.avatar);\n let icon;\n /** Avatar prop takes precedence over the icon or intent prop */\n if (!avatar) {\n icon = resolveShorthand(props.icon, {\n defaultProps: {\n children: defaultIcon,\n },\n required: !!props.intent,\n });\n }\n\n return {\n action,\n appearance,\n avatar,\n components: {\n root: 'div',\n icon: 'span',\n action: Button,\n avatar: Avatar,\n },\n icon,\n intent,\n root: getNativeElementProps('div', {\n ref,\n role: defaultRole,\n children: props.children,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["../src/components/Alert/useAlert.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Avatar } from '@fluentui/react-avatar';\nimport { Button } from '@fluentui/react-button';\nimport { CheckmarkCircleFilled, DismissCircleFilled, InfoFilled, WarningFilled } from '@fluentui/react-icons';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport type { AlertProps, AlertState } from './Alert.types';\n\n/**\n * @deprecated please use the Toast or MessageBar component\n * Create the state required to render Alert.\n *\n * The returned state can be modified with hooks such as useAlertStyles_unstable,\n * before being passed to renderAlert_unstable.\n *\n * @param props - props from this instance of Alert\n * @param ref - reference to root HTMLElement of Alert\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const useAlert_unstable = (props: AlertProps, ref: React.Ref<HTMLElement>): AlertState => {\n const { appearance = 'primary', intent } = props;\n\n /** Determine the role and icon to render based on the intent */\n let defaultIcon;\n let defaultRole = 'status';\n switch (intent) {\n case 'success':\n defaultIcon = <CheckmarkCircleFilled />;\n break;\n case 'error':\n defaultIcon = <DismissCircleFilled />;\n defaultRole = 'alert';\n break;\n case 'warning':\n defaultIcon = <WarningFilled />;\n defaultRole = 'alert';\n break;\n case 'info':\n defaultIcon = <InfoFilled />;\n break;\n }\n\n const action = slot.optional(props.action, { defaultProps: { appearance: 'transparent' }, elementType: Button });\n const avatar = slot.optional(props.avatar, { elementType: Avatar });\n let icon;\n /** Avatar prop takes precedence over the icon or intent prop */ if (!avatar) {\n icon = slot.optional(props.icon, {\n defaultProps: { children: defaultIcon },\n renderByDefault: !!props.intent,\n elementType: 'span',\n });\n }\n return {\n action,\n appearance,\n avatar,\n components: { root: 'div', icon: 'span', action: Button, avatar: Avatar },\n icon,\n intent,\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 role: defaultRole,\n children: props.children,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","Avatar","Button","CheckmarkCircleFilled","DismissCircleFilled","InfoFilled","WarningFilled","getIntrinsicElementProps","slot","useAlert_unstable","props","ref","appearance","intent","defaultIcon","defaultRole","action","optional","defaultProps","elementType","avatar","icon","children","renderByDefault","components","root","always","role"],"mappings":";;;;+BAoBaS;;;;;;;iEApBU,QAAQ;6BAER,yBAAyB;6BACzB,yBAAyB;4BACsC,wBAAwB;gCAC/D,4BAA4B;AAepE,0BAA0B,CAACC,OAAmBC;IACnD,MAAM,EAAEC,aAAa,SAAS,EAAEC,MAAM,EAAE,GAAGH;IAE3C,8DAA8D,GAC9D,IAAII;IACJ,IAAIC,cAAc;IAClB,OAAQF;QACN,KAAK;YACHC,cAAAA,WAAAA,GAAc,OAAA,aAAA,CAACX,iCAAAA,EAAAA;YACf;QACF,KAAK;YACHW,cAAAA,WAAAA,GAAc,OAAA,aAAA,CAACV,+BAAAA,EAAAA;YACfW,cAAc;YACd;QACF,KAAK;YACHD,cAAAA,WAAAA,GAAc,OAAA,aAAA,CAACR,yBAAAA,EAAAA;YACfS,cAAc;YACd;QACF,KAAK;YACHD,cAAAA,WAAAA,GAAc,OAAA,aAAA,CAACT,sBAAAA,EAAAA;YACf;IACJ;IAEA,MAAMW,SAASR,oBAAAA,CAAKS,QAAQ,CAACP,MAAMM,MAAM,EAAE;QAAEE,cAAc;YAAEN,YAAY;QAAc;QAAGO,aAAajB,mBAAAA;IAAO;IAC9G,MAAMkB,SAASZ,oBAAAA,CAAKS,QAAQ,CAACP,MAAMU,MAAM,EAAE;QAAED,aAAalB,mBAAAA;IAAO;IACjE,IAAIoB;IACJ,8DAA8D,GAAG,IAAI,CAACD,QAAQ;QAC5EC,OAAOb,oBAAAA,CAAKS,QAAQ,CAACP,MAAMW,IAAI,EAAE;YAC/BH,cAAc;gBAAEI,UAAUR;YAAY;YACtCS,iBAAiB,CAAC,CAACb,MAAMG,MAAM;YAC/BM,aAAa;QACf;IACF;IACA,OAAO;QACLH;QACAJ;QACAQ;QACAI,YAAY;YAAEC,MAAM;YAAOJ,MAAM;YAAQL,QAAQd,mBAAAA;YAAQkB,QAAQnB,mBAAAA;QAAO;QACxEoB;QACAR;QACAY,MAAMjB,oBAAAA,CAAKkB,MAAM,KACfnB,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FI,KAAKA;YACLgB,MAAMZ;YACNO,UAAUZ,MAAMY,QAAQ;YACxB,GAAGZ,KAAK;QACV,IACA;YAAES,aAAa;QAAM;IAEzB;AACF,EAAE"}