@fluentui/react-badge 9.1.4 → 9.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +73 -1
  3. package/CHANGELOG.md +27 -2
  4. package/lib/Badge.js.map +1 -1
  5. package/lib/CounterBadge.js.map +1 -1
  6. package/lib/PresenceBadge.js.map +1 -1
  7. package/lib/components/Badge/Badge.js.map +1 -1
  8. package/lib/components/Badge/Badge.types.js.map +1 -1
  9. package/lib/components/Badge/index.js.map +1 -1
  10. package/lib/components/Badge/renderBadge.js +1 -7
  11. package/lib/components/Badge/renderBadge.js.map +1 -1
  12. package/lib/components/Badge/useBadge.js +1 -0
  13. package/lib/components/Badge/useBadge.js.map +1 -1
  14. package/lib/components/Badge/useBadgeStyles.js.map +1 -1
  15. package/lib/components/CounterBadge/CounterBadge.js.map +1 -1
  16. package/lib/components/CounterBadge/CounterBadge.types.js.map +1 -1
  17. package/lib/components/CounterBadge/index.js.map +1 -1
  18. package/lib/components/CounterBadge/useCounterBadge.js +1 -0
  19. package/lib/components/CounterBadge/useCounterBadge.js.map +1 -1
  20. package/lib/components/CounterBadge/useCounterBadgeStyles.js.map +1 -1
  21. package/lib/components/PresenceBadge/PresenceBadge.js.map +1 -1
  22. package/lib/components/PresenceBadge/PresenceBadge.types.js.map +1 -1
  23. package/lib/components/PresenceBadge/index.js.map +1 -1
  24. package/lib/components/PresenceBadge/presenceIcons.js +34 -41
  25. package/lib/components/PresenceBadge/presenceIcons.js.map +1 -1
  26. package/lib/components/PresenceBadge/usePresenceBadge.js +2 -2
  27. package/lib/components/PresenceBadge/usePresenceBadge.js.map +1 -1
  28. package/lib/components/PresenceBadge/usePresenceBadgeStyles.js +1 -1
  29. package/lib/components/PresenceBadge/usePresenceBadgeStyles.js.map +1 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib-commonjs/Badge.js +5 -4
  32. package/lib-commonjs/Badge.js.map +1 -1
  33. package/lib-commonjs/CounterBadge.js +5 -4
  34. package/lib-commonjs/CounterBadge.js.map +1 -1
  35. package/lib-commonjs/PresenceBadge.js +5 -4
  36. package/lib-commonjs/PresenceBadge.js.map +1 -1
  37. package/lib-commonjs/components/Badge/Badge.js +19 -20
  38. package/lib-commonjs/components/Badge/Badge.js.map +1 -1
  39. package/lib-commonjs/components/Badge/Badge.types.js +3 -2
  40. package/lib-commonjs/components/Badge/Badge.types.js.map +1 -1
  41. package/lib-commonjs/components/Badge/index.js +8 -7
  42. package/lib-commonjs/components/Badge/index.js.map +1 -1
  43. package/lib-commonjs/components/Badge/renderBadge.js +13 -19
  44. package/lib-commonjs/components/Badge/renderBadge.js.map +1 -1
  45. package/lib-commonjs/components/Badge/useBadge.js +29 -34
  46. package/lib-commonjs/components/Badge/useBadge.js.map +1 -1
  47. package/lib-commonjs/components/Badge/useBadgeStyles.js +608 -310
  48. package/lib-commonjs/components/Badge/useBadgeStyles.js.map +1 -1
  49. package/lib-commonjs/components/CounterBadge/CounterBadge.js +19 -20
  50. package/lib-commonjs/components/CounterBadge/CounterBadge.js.map +1 -1
  51. package/lib-commonjs/components/CounterBadge/CounterBadge.types.js +3 -2
  52. package/lib-commonjs/components/CounterBadge/CounterBadge.types.js.map +1 -1
  53. package/lib-commonjs/components/CounterBadge/index.js +8 -7
  54. package/lib-commonjs/components/CounterBadge/index.js.map +1 -1
  55. package/lib-commonjs/components/CounterBadge/useCounterBadge.js +24 -30
  56. package/lib-commonjs/components/CounterBadge/useCounterBadge.js.map +1 -1
  57. package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.js +54 -34
  58. package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.js.map +1 -1
  59. package/lib-commonjs/components/PresenceBadge/PresenceBadge.js +19 -20
  60. package/lib-commonjs/components/PresenceBadge/PresenceBadge.js.map +1 -1
  61. package/lib-commonjs/components/PresenceBadge/PresenceBadge.types.js +3 -2
  62. package/lib-commonjs/components/PresenceBadge/PresenceBadge.types.js.map +1 -1
  63. package/lib-commonjs/components/PresenceBadge/index.js +8 -7
  64. package/lib-commonjs/components/PresenceBadge/index.js.map +1 -1
  65. package/lib-commonjs/components/PresenceBadge/presenceIcons.js +146 -134
  66. package/lib-commonjs/components/PresenceBadge/presenceIcons.js.map +1 -1
  67. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js +61 -65
  68. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js.map +1 -1
  69. package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.js +102 -78
  70. package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.js.map +1 -1
  71. package/lib-commonjs/index.js +28 -85
  72. package/lib-commonjs/index.js.map +1 -1
  73. package/package.json +9 -8
  74. package/lib-amd/Badge.js +0 -6
  75. package/lib-amd/Badge.js.map +0 -1
  76. package/lib-amd/CounterBadge.js +0 -6
  77. package/lib-amd/CounterBadge.js.map +0 -1
  78. package/lib-amd/PresenceBadge.js +0 -6
  79. package/lib-amd/PresenceBadge.js.map +0 -1
  80. package/lib-amd/components/Badge/Badge.js +0 -17
  81. package/lib-amd/components/Badge/Badge.js.map +0 -1
  82. package/lib-amd/components/Badge/Badge.types.js +0 -5
  83. package/lib-amd/components/Badge/Badge.types.js.map +0 -1
  84. package/lib-amd/components/Badge/index.js +0 -9
  85. package/lib-amd/components/Badge/index.js.map +0 -1
  86. package/lib-amd/components/Badge/renderBadge.js +0 -14
  87. package/lib-amd/components/Badge/renderBadge.js.map +0 -1
  88. package/lib-amd/components/Badge/useBadge.js +0 -27
  89. package/lib-amd/components/Badge/useBadge.js.map +0 -1
  90. package/lib-amd/components/Badge/useBadgeStyles.js +0 -212
  91. package/lib-amd/components/Badge/useBadgeStyles.js.map +0 -1
  92. package/lib-amd/components/CounterBadge/CounterBadge.js +0 -17
  93. package/lib-amd/components/CounterBadge/CounterBadge.js.map +0 -1
  94. package/lib-amd/components/CounterBadge/CounterBadge.types.js +0 -5
  95. package/lib-amd/components/CounterBadge/CounterBadge.types.js.map +0 -1
  96. package/lib-amd/components/CounterBadge/index.js +0 -9
  97. package/lib-amd/components/CounterBadge/index.js.map +0 -1
  98. package/lib-amd/components/CounterBadge/useCounterBadge.js +0 -18
  99. package/lib-amd/components/CounterBadge/useCounterBadge.js.map +0 -1
  100. package/lib-amd/components/CounterBadge/useCounterBadgeStyles.js +0 -28
  101. package/lib-amd/components/CounterBadge/useCounterBadgeStyles.js.map +0 -1
  102. package/lib-amd/components/PresenceBadge/PresenceBadge.js +0 -17
  103. package/lib-amd/components/PresenceBadge/PresenceBadge.js.map +0 -1
  104. package/lib-amd/components/PresenceBadge/PresenceBadge.types.js +0 -5
  105. package/lib-amd/components/PresenceBadge/PresenceBadge.types.js.map +0 -1
  106. package/lib-amd/components/PresenceBadge/index.js +0 -9
  107. package/lib-amd/components/PresenceBadge/index.js.map +0 -1
  108. package/lib-amd/components/PresenceBadge/presenceIcons.js +0 -146
  109. package/lib-amd/components/PresenceBadge/presenceIcons.js.map +0 -1
  110. package/lib-amd/components/PresenceBadge/usePresenceBadge.js +0 -53
  111. package/lib-amd/components/PresenceBadge/usePresenceBadge.js.map +0 -1
  112. package/lib-amd/components/PresenceBadge/usePresenceBadgeStyles.js +0 -101
  113. package/lib-amd/components/PresenceBadge/usePresenceBadgeStyles.js.map +0 -1
  114. package/lib-amd/index.js +0 -19
  115. package/lib-amd/index.js.map +0 -1
@@ -1,53 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "./presenceIcons", "../Badge/index"], function (require, exports, tslib_1, React, react_utilities_1, presenceIcons_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePresenceBadge_unstable = void 0;
5
- var iconMap = function (status, outOfOffice, size) {
6
- switch (status) {
7
- case 'available':
8
- return outOfOffice ? presenceIcons_1.presenceAvailableRegular[size] : presenceIcons_1.presenceAvailableFilled[size];
9
- case 'away':
10
- return outOfOffice ? presenceIcons_1.presenceOofRegular[size] : presenceIcons_1.presenceAwayFilled[size];
11
- case 'blocked':
12
- return presenceIcons_1.presenceBlockedRegular[size];
13
- case 'busy':
14
- return outOfOffice ? presenceIcons_1.presenceUnknownRegular[size] : presenceIcons_1.presenceBusyFilled[size];
15
- case 'do-not-disturb':
16
- return outOfOffice ? presenceIcons_1.presenceDndRegular[size] : presenceIcons_1.presenceDndFilled[size];
17
- case 'offline':
18
- return presenceIcons_1.presenceOfflineRegular[size];
19
- case 'out-of-office':
20
- return presenceIcons_1.presenceOofRegular[size];
21
- case 'unknown':
22
- return presenceIcons_1.presenceUnknownRegular[size];
23
- }
24
- };
25
- var DEFAULT_STRINGS = {
26
- busy: 'busy',
27
- 'out-of-office': 'out of office',
28
- away: 'away',
29
- available: 'available',
30
- offline: 'offline',
31
- 'do-not-disturb': 'do not disturb',
32
- unknown: 'unknown',
33
- blocked: 'blocked',
34
- };
35
- /**
36
- * Returns the props and state required to render the component
37
- */
38
- var usePresenceBadge_unstable = function (props, ref) {
39
- var _a = props.size, size = _a === void 0 ? 'medium' : _a, _b = props.status, status = _b === void 0 ? 'available' : _b, _c = props.outOfOffice, outOfOffice = _c === void 0 ? false : _c;
40
- var statusText = DEFAULT_STRINGS[status];
41
- var oofText = props.outOfOffice && props.status !== 'out-of-office' ? " " + DEFAULT_STRINGS['out-of-office'] : '';
42
- var IconElement = iconMap(status, outOfOffice, size);
43
- var state = tslib_1.__assign(tslib_1.__assign({}, index_1.useBadge_unstable(tslib_1.__assign(tslib_1.__assign({ 'aria-label': statusText + oofText, role: 'img' }, props), { size: size, icon: react_utilities_1.resolveShorthand(props.icon, {
44
- defaultProps: {
45
- children: IconElement ? React.createElement(IconElement, null) : null,
46
- },
47
- required: true,
48
- }) }), ref)), { status: status, outOfOffice: outOfOffice });
49
- return state;
50
- };
51
- exports.usePresenceBadge_unstable = usePresenceBadge_unstable;
52
- });
53
- //# sourceMappingURL=usePresenceBadge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePresenceBadge.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-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C,KAAyB,EACzB,GAA2B;QAEnB,IAAA,KAA+D,KAAK,KAArD,EAAf,IAAI,mBAAG,QAAQ,KAAA,EAAE,KAA8C,KAAK,OAA/B,EAApB,MAAM,mBAAG,WAAW,KAAA,EAAE,KAAwB,KAAK,YAAV,EAAnB,WAAW,mBAAG,KAAK,KAAA,CAAW;QAE7E,IAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAM,OAAO,GAAG,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,eAAe,CAAC,CAAC,CAAC,MAAI,eAAe,CAAC,eAAe,CAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpH,IAAM,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAEvD,IAAM,KAAK,yCACN,yBAAiB,qCAEhB,YAAY,EAAE,UAAU,GAAG,OAAO,EAClC,IAAI,EAAE,KAAK,IACR,KAAK,KACR,IAAI,MAAA,EACJ,IAAI,EAAE,kCAAgB,CAAC,KAAK,CAAC,IAAI,EAAE;gBACjC,YAAY,EAAE;oBACZ,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,oBAAC,WAAW,OAAG,CAAC,CAAC,CAAC,IAAI;iBAC/C;gBACD,QAAQ,EAAE,IAAI;aACf,CAAC,KAEJ,GAAG,CACJ,KACD,MAAM,QAAA,EACN,WAAW,aAAA,GACZ,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAhCW,QAAA,yBAAyB,6BAgCpC","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport {\n presenceAvailableFilled,\n presenceAvailableRegular,\n presenceAwayFilled,\n presenceBlockedRegular,\n presenceBusyFilled,\n presenceDndFilled,\n presenceDndRegular,\n presenceOfflineRegular,\n presenceOofRegular,\n presenceUnknownRegular,\n} from './presenceIcons';\nimport { useBadge_unstable } from '../Badge/index';\nimport type { PresenceBadgeProps, PresenceBadgeState } from './PresenceBadge.types';\n\nconst iconMap = (status: PresenceBadgeState['status'], outOfOffice: boolean, size: PresenceBadgeState['size']) => {\n switch (status) {\n case 'available':\n return outOfOffice ? presenceAvailableRegular[size] : presenceAvailableFilled[size];\n case 'away':\n return outOfOffice ? presenceOofRegular[size] : presenceAwayFilled[size];\n case 'blocked':\n return presenceBlockedRegular[size];\n case 'busy':\n return outOfOffice ? presenceUnknownRegular[size] : presenceBusyFilled[size];\n case 'do-not-disturb':\n return outOfOffice ? presenceDndRegular[size] : presenceDndFilled[size];\n case 'offline':\n return presenceOfflineRegular[size];\n case 'out-of-office':\n return presenceOofRegular[size];\n case 'unknown':\n return presenceUnknownRegular[size];\n }\n};\n\nconst DEFAULT_STRINGS = {\n busy: 'busy',\n 'out-of-office': 'out of office',\n away: 'away',\n available: 'available',\n offline: 'offline',\n 'do-not-disturb': 'do not disturb',\n unknown: 'unknown',\n blocked: 'blocked',\n};\n\n/**\n * Returns the props and state required to render the component\n */\nexport const usePresenceBadge_unstable = (\n props: PresenceBadgeProps,\n ref: React.Ref<HTMLElement>,\n): PresenceBadgeState => {\n const { size = 'medium', status = 'available', outOfOffice = false } = props;\n\n const statusText = DEFAULT_STRINGS[status];\n const oofText = props.outOfOffice && props.status !== 'out-of-office' ? ` ${DEFAULT_STRINGS['out-of-office']}` : '';\n\n const IconElement = iconMap(status, outOfOffice, size);\n\n const state: PresenceBadgeState = {\n ...useBadge_unstable(\n {\n 'aria-label': statusText + oofText,\n role: 'img',\n ...props,\n size,\n icon: resolveShorthand(props.icon, {\n defaultProps: {\n children: IconElement ? <IconElement /> : null,\n },\n required: true,\n }),\n },\n ref,\n ),\n status,\n outOfOffice,\n };\n\n return state;\n};\n"]}
@@ -1,101 +0,0 @@
1
- define(["require", "exports", "@griffel/react", "@fluentui/react-theme"], function (require, exports, react_1, react_theme_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePresenceBadgeStyles_unstable = exports.presenceBadgeClassNames = void 0;
5
- exports.presenceBadgeClassNames = {
6
- root: 'fui-PresenceBadge',
7
- icon: 'fui-PresenceBadge__icon',
8
- };
9
- var getIsBusy = function (status) {
10
- if (status === 'busy' || status === 'do-not-disturb' || status === 'blocked') {
11
- return true;
12
- }
13
- return false;
14
- };
15
- var useRootClassName = react_1.makeResetStyles({
16
- padding: 0,
17
- display: 'inline-flex',
18
- boxSizing: 'border-box',
19
- alignItems: 'center',
20
- justifyContent: 'center',
21
- '& span': {
22
- display: 'flex',
23
- },
24
- borderRadius: react_theme_1.tokens.borderRadiusCircular,
25
- backgroundColor: react_theme_1.tokens.colorNeutralBackground1,
26
- });
27
- var useStyles = react_1.makeStyles({
28
- statusBusy: {
29
- color: react_theme_1.tokens.colorPaletteRedBackground3,
30
- },
31
- statusAway: {
32
- color: react_theme_1.tokens.colorPaletteMarigoldBackground3,
33
- },
34
- statusAvailable: {
35
- color: react_theme_1.tokens.colorPaletteLightGreenForeground3,
36
- },
37
- statusOffline: {
38
- color: react_theme_1.tokens.colorNeutralForeground3,
39
- },
40
- statusOutOfOffice: {
41
- color: react_theme_1.tokens.colorPaletteBerryForeground3,
42
- },
43
- statusUnknown: {
44
- color: react_theme_1.tokens.colorNeutralForeground3,
45
- },
46
- outOfOffice: {
47
- color: react_theme_1.tokens.colorNeutralBackground1,
48
- },
49
- outOfOfficeAvailable: {
50
- color: react_theme_1.tokens.colorPaletteLightGreenForeground3,
51
- },
52
- outOfOfficeBusy: {
53
- color: react_theme_1.tokens.colorPaletteRedBackground3,
54
- },
55
- outOfOfficeUnknown: {
56
- color: react_theme_1.tokens.colorNeutralForeground3,
57
- },
58
- // Icons are not resizeable, and these sizes are currently missing
59
- // use `!important` to size the currently available icons to the missing ones
60
- //
61
- tiny: {
62
- aspectRatio: '1',
63
- width: '6px',
64
- '& svg': {
65
- width: '6px !important',
66
- height: '6px !important',
67
- },
68
- },
69
- large: {
70
- aspectRatio: '1',
71
- width: '20px',
72
- '& svg': {
73
- width: '20px !important',
74
- height: '20px !important',
75
- },
76
- },
77
- extraLarge: {
78
- aspectRatio: '1',
79
- width: '28px',
80
- '& svg': {
81
- width: '28px !important',
82
- height: '28px !important',
83
- },
84
- },
85
- });
86
- /**
87
- * Applies style classnames to slots
88
- */
89
- var usePresenceBadgeStyles_unstable = function (state) {
90
- var rootClassName = useRootClassName();
91
- var styles = useStyles();
92
- var isBusy = getIsBusy(state.status);
93
- state.root.className = react_1.mergeClasses(exports.presenceBadgeClassNames.root, rootClassName, isBusy && styles.statusBusy, state.status === 'away' && styles.statusAway, state.status === 'available' && styles.statusAvailable, state.status === 'offline' && styles.statusOffline, state.status === 'out-of-office' && styles.statusOutOfOffice, state.status === 'unknown' && styles.statusUnknown, state.outOfOffice && styles.outOfOffice, state.outOfOffice && state.status === 'available' && styles.outOfOfficeAvailable, state.outOfOffice && isBusy && styles.outOfOfficeBusy, state.outOfOffice && state.status === 'away' && styles.statusOutOfOffice, state.outOfOffice && state.status === 'offline' && styles.statusOffline, state.outOfOffice && state.status === 'out-of-office' && styles.statusOutOfOffice, state.outOfOffice && state.status === 'unknown' && styles.outOfOfficeUnknown, state.size === 'tiny' && styles.tiny, state.size === 'large' && styles.large, state.size === 'extra-large' && styles.extraLarge, state.root.className);
94
- if (state.icon) {
95
- state.icon.className = react_1.mergeClasses(exports.presenceBadgeClassNames.icon, state.icon.className);
96
- }
97
- return state;
98
- };
99
- exports.usePresenceBadgeStyles_unstable = usePresenceBadgeStyles_unstable;
100
- });
101
- //# sourceMappingURL=usePresenceBadgeStyles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePresenceBadgeStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-badge/src/components/PresenceBadge/usePresenceBadgeStyles.ts"],"names":[],"mappings":";;;;IAMa,QAAA,uBAAuB,GAA+B;QACjE,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,yBAAyB;KAChC,CAAC;IAEF,IAAM,SAAS,GAAG,U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C,eAAe,EACrD,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,iBAAiB,EACxE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,aAAa,EACvE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,eAAe,IAAI,MAAM,CAAC,iBAAiB,EACjF,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,kBAAkB,EAC5E,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,EACpC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,KAAK,EACtC,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,MAAM,CAAC,UAAU,EACjD,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,IAAI,KAAK,CAAC,IAAI,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CAAC,+BAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACzF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA/BW,QAAA,+BAA+B,mCA+B1C","sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { BadgeSlots } from '../Badge/Badge.types';\nimport type { PresenceBadgeState, PresenceBadgeStatus } from './PresenceBadge.types';\n\nexport const presenceBadgeClassNames: SlotClassNames<BadgeSlots> = {\n root: 'fui-PresenceBadge',\n icon: 'fui-PresenceBadge__icon',\n};\n\nconst getIsBusy = (status: PresenceBadgeStatus): boolean => {\n if (status === 'busy' || status === 'do-not-disturb' || status === 'blocked') {\n return true;\n }\n\n return false;\n};\n\nconst useRootClassName = makeResetStyles({\n padding: 0,\n display: 'inline-flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n justifyContent: 'center',\n\n '& span': {\n display: 'flex',\n },\n borderRadius: tokens.borderRadiusCircular,\n backgroundColor: tokens.colorNeutralBackground1,\n});\n\nconst useStyles = makeStyles({\n statusBusy: {\n color: tokens.colorPaletteRedBackground3,\n },\n statusAway: {\n color: tokens.colorPaletteMarigoldBackground3,\n },\n statusAvailable: {\n color: tokens.colorPaletteLightGreenForeground3,\n },\n statusOffline: {\n color: tokens.colorNeutralForeground3,\n },\n statusOutOfOffice: {\n color: tokens.colorPaletteBerryForeground3,\n },\n statusUnknown: {\n color: tokens.colorNeutralForeground3,\n },\n outOfOffice: {\n color: tokens.colorNeutralBackground1,\n },\n outOfOfficeAvailable: {\n color: tokens.colorPaletteLightGreenForeground3,\n },\n outOfOfficeBusy: {\n color: tokens.colorPaletteRedBackground3,\n },\n outOfOfficeUnknown: {\n color: tokens.colorNeutralForeground3,\n },\n\n // Icons are not resizeable, and these sizes are currently missing\n // use `!important` to size the currently available icons to the missing ones\n //\n tiny: {\n aspectRatio: '1',\n width: '6px',\n '& svg': {\n width: '6px !important',\n height: '6px !important',\n },\n },\n large: {\n aspectRatio: '1',\n width: '20px',\n '& svg': {\n width: '20px !important',\n height: '20px !important',\n },\n },\n extraLarge: {\n aspectRatio: '1',\n width: '28px',\n '& svg': {\n width: '28px !important',\n height: '28px !important',\n },\n },\n});\n\n/**\n * Applies style classnames to slots\n */\nexport const usePresenceBadgeStyles_unstable = (state: PresenceBadgeState): PresenceBadgeState => {\n const rootClassName = useRootClassName();\n const styles = useStyles();\n const isBusy = getIsBusy(state.status);\n state.root.className = mergeClasses(\n presenceBadgeClassNames.root,\n rootClassName,\n isBusy && styles.statusBusy,\n state.status === 'away' && styles.statusAway,\n state.status === 'available' && styles.statusAvailable,\n state.status === 'offline' && styles.statusOffline,\n state.status === 'out-of-office' && styles.statusOutOfOffice,\n state.status === 'unknown' && styles.statusUnknown,\n state.outOfOffice && styles.outOfOffice,\n state.outOfOffice && state.status === 'available' && styles.outOfOfficeAvailable,\n state.outOfOffice && isBusy && styles.outOfOfficeBusy,\n state.outOfOffice && state.status === 'away' && styles.statusOutOfOffice,\n state.outOfOffice && state.status === 'offline' && styles.statusOffline,\n state.outOfOffice && state.status === 'out-of-office' && styles.statusOutOfOffice,\n state.outOfOffice && state.status === 'unknown' && styles.outOfOfficeUnknown,\n state.size === 'tiny' && styles.tiny,\n state.size === 'large' && styles.large,\n state.size === 'extra-large' && styles.extraLarge,\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(presenceBadgeClassNames.icon, state.icon.className);\n }\n\n return state;\n};\n"]}
package/lib-amd/index.js DELETED
@@ -1,19 +0,0 @@
1
- define(["require", "exports", "./Badge", "./PresenceBadge", "./CounterBadge"], function (require, exports, Badge_1, PresenceBadge_1, CounterBadge_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useCounterBadge_unstable = exports.useCounterBadgeStyles_unstable = exports.counterBadgeClassNames = exports.CounterBadge = exports.usePresenceBadge_unstable = exports.usePresenceBadgeStyles_unstable = exports.presenceBadgeClassNames = exports.PresenceBadge = exports.useBadge_unstable = exports.useBadgeStyles_unstable = exports.renderBadge_unstable = exports.badgeClassNames = exports.Badge = void 0;
5
- Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return Badge_1.Badge; } });
6
- Object.defineProperty(exports, "badgeClassNames", { enumerable: true, get: function () { return Badge_1.badgeClassNames; } });
7
- Object.defineProperty(exports, "renderBadge_unstable", { enumerable: true, get: function () { return Badge_1.renderBadge_unstable; } });
8
- Object.defineProperty(exports, "useBadgeStyles_unstable", { enumerable: true, get: function () { return Badge_1.useBadgeStyles_unstable; } });
9
- Object.defineProperty(exports, "useBadge_unstable", { enumerable: true, get: function () { return Badge_1.useBadge_unstable; } });
10
- Object.defineProperty(exports, "PresenceBadge", { enumerable: true, get: function () { return PresenceBadge_1.PresenceBadge; } });
11
- Object.defineProperty(exports, "presenceBadgeClassNames", { enumerable: true, get: function () { return PresenceBadge_1.presenceBadgeClassNames; } });
12
- Object.defineProperty(exports, "usePresenceBadgeStyles_unstable", { enumerable: true, get: function () { return PresenceBadge_1.usePresenceBadgeStyles_unstable; } });
13
- Object.defineProperty(exports, "usePresenceBadge_unstable", { enumerable: true, get: function () { return PresenceBadge_1.usePresenceBadge_unstable; } });
14
- Object.defineProperty(exports, "CounterBadge", { enumerable: true, get: function () { return CounterBadge_1.CounterBadge; } });
15
- Object.defineProperty(exports, "counterBadgeClassNames", { enumerable: true, get: function () { return CounterBadge_1.counterBadgeClassNames; } });
16
- Object.defineProperty(exports, "useCounterBadgeStyles_unstable", { enumerable: true, get: function () { return CounterBadge_1.useCounterBadgeStyles_unstable; } });
17
- Object.defineProperty(exports, "useCounterBadge_unstable", { enumerable: true, get: function () { return CounterBadge_1.useCounterBadge_unstable; } });
18
- });
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-badge/src/index.ts"],"names":[],"mappings":";;;;IAAS,8FAAA,KAAK,OAAA;IAAE,wGAAA,eAAe,OAAA;IAAE,6GAAA,oBAAoB,OAAA;IAAE,gHAAA,uBAAuB,OAAA;IAAE,0GAAA,iBAAiB,OAAA;IAG/F,8GAAA,aAAa,OAAA;IACb,wHAAA,uBAAuB,OAAA;IACvB,gIAAA,+BAA+B,OAAA;IAC/B,0HAAA,yBAAyB,OAAA;IAIzB,4GAAA,YAAY,OAAA;IACZ,sHAAA,sBAAsB,OAAA;IACtB,8HAAA,8BAA8B,OAAA;IAC9B,wHAAA,wBAAwB,OAAA","sourcesContent":["export { Badge, badgeClassNames, renderBadge_unstable, useBadgeStyles_unstable, useBadge_unstable } from './Badge';\nexport type { BadgeProps, BadgeSlots, BadgeState } from './Badge';\nexport {\n PresenceBadge,\n presenceBadgeClassNames,\n usePresenceBadgeStyles_unstable,\n usePresenceBadge_unstable,\n} from './PresenceBadge';\nexport type { PresenceBadgeProps, PresenceBadgeState, PresenceBadgeStatus } from './PresenceBadge';\nexport {\n CounterBadge,\n counterBadgeClassNames,\n useCounterBadgeStyles_unstable,\n useCounterBadge_unstable,\n} from './CounterBadge';\nexport type { CounterBadgeProps, CounterBadgeState } from './CounterBadge';\n"]}