@fluentui/react-badge 9.0.0-rc.6 → 9.0.0-rc.9

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 (58) hide show
  1. package/CHANGELOG.json +117 -4
  2. package/CHANGELOG.md +141 -104
  3. package/dist/{react-badge.d.ts → index.d.ts} +35 -38
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/components/Badge/Badge.types.js.map +1 -1
  6. package/lib/components/CounterBadge/CounterBadge.types.js.map +1 -1
  7. package/lib/components/CounterBadge/useCounterBadge.js +1 -2
  8. package/lib/components/CounterBadge/useCounterBadge.js.map +1 -1
  9. package/lib/components/PresenceBadge/PresenceBadge.types.js.map +1 -1
  10. package/lib/components/PresenceBadge/usePresenceBadge.js +15 -3
  11. package/lib/components/PresenceBadge/usePresenceBadge.js.map +1 -1
  12. package/lib-commonjs/components/CounterBadge/useCounterBadge.js +1 -2
  13. package/lib-commonjs/components/CounterBadge/useCounterBadge.js.map +1 -1
  14. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js +15 -3
  15. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js.map +1 -1
  16. package/package.json +8 -8
  17. package/lib/Badge.d.ts +0 -1
  18. package/lib/CounterBadge.d.ts +0 -1
  19. package/lib/PresenceBadge.d.ts +0 -1
  20. package/lib/components/Badge/Badge.d.ts +0 -6
  21. package/lib/components/Badge/Badge.types.d.ts +0 -34
  22. package/lib/components/Badge/index.d.ts +0 -5
  23. package/lib/components/Badge/renderBadge.d.ts +0 -2
  24. package/lib/components/Badge/useBadge.d.ts +0 -6
  25. package/lib/components/Badge/useBadgeStyles.d.ts +0 -11
  26. package/lib/components/CounterBadge/CounterBadge.d.ts +0 -6
  27. package/lib/components/CounterBadge/CounterBadge.types.d.ts +0 -41
  28. package/lib/components/CounterBadge/index.d.ts +0 -4
  29. package/lib/components/CounterBadge/useCounterBadge.d.ts +0 -6
  30. package/lib/components/CounterBadge/useCounterBadgeStyles.d.ts +0 -12
  31. package/lib/components/PresenceBadge/PresenceBadge.d.ts +0 -6
  32. package/lib/components/PresenceBadge/PresenceBadge.types.d.ts +0 -19
  33. package/lib/components/PresenceBadge/index.d.ts +0 -4
  34. package/lib/components/PresenceBadge/presenceIcons.d.ts +0 -11
  35. package/lib/components/PresenceBadge/usePresenceBadge.d.ts +0 -6
  36. package/lib/components/PresenceBadge/usePresenceBadgeStyles.d.ts +0 -12
  37. package/lib/index.d.ts +0 -6
  38. package/lib-commonjs/Badge.d.ts +0 -1
  39. package/lib-commonjs/CounterBadge.d.ts +0 -1
  40. package/lib-commonjs/PresenceBadge.d.ts +0 -1
  41. package/lib-commonjs/components/Badge/Badge.d.ts +0 -6
  42. package/lib-commonjs/components/Badge/Badge.types.d.ts +0 -34
  43. package/lib-commonjs/components/Badge/index.d.ts +0 -5
  44. package/lib-commonjs/components/Badge/renderBadge.d.ts +0 -2
  45. package/lib-commonjs/components/Badge/useBadge.d.ts +0 -6
  46. package/lib-commonjs/components/Badge/useBadgeStyles.d.ts +0 -11
  47. package/lib-commonjs/components/CounterBadge/CounterBadge.d.ts +0 -6
  48. package/lib-commonjs/components/CounterBadge/CounterBadge.types.d.ts +0 -41
  49. package/lib-commonjs/components/CounterBadge/index.d.ts +0 -4
  50. package/lib-commonjs/components/CounterBadge/useCounterBadge.d.ts +0 -6
  51. package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.d.ts +0 -12
  52. package/lib-commonjs/components/PresenceBadge/PresenceBadge.d.ts +0 -6
  53. package/lib-commonjs/components/PresenceBadge/PresenceBadge.types.d.ts +0 -19
  54. package/lib-commonjs/components/PresenceBadge/index.d.ts +0 -4
  55. package/lib-commonjs/components/PresenceBadge/presenceIcons.d.ts +0 -11
  56. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.d.ts +0 -6
  57. package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.d.ts +0 -12
  58. package/lib-commonjs/index.d.ts +0 -6
@@ -17,42 +17,40 @@ export declare const badgeClassName = "fui-Badge";
17
17
 
18
18
  export declare const badgeClassNames: SlotClassNames<BadgeSlots>;
19
19
 
20
- declare type BadgeCommons = {
20
+ export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & {
21
21
  /**
22
22
  * A Badge can be filled, outline, ghost, inverted
23
23
  * @defaultvalue filled
24
24
  */
25
- appearance: 'filled' | 'ghost' | 'outline' | 'tint';
25
+ appearance?: 'filled' | 'ghost' | 'outline' | 'tint';
26
26
  /**
27
27
  * A Badge can be one of preset colors
28
28
  * @defaultvalue brand
29
29
  */
30
- color: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
30
+ color?: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
31
31
  /**
32
32
  * A Badge can position the icon before or after the content.
33
33
  * @defaultvalue before
34
34
  */
35
- iconPosition: 'before' | 'after';
35
+ iconPosition?: 'before' | 'after';
36
36
  /**
37
37
  * A Badge can be square, circular or rounded.
38
38
  * @defaultvalue circular
39
39
  */
40
- shape: 'circular' | 'rounded' | 'square';
40
+ shape?: 'circular' | 'rounded' | 'square';
41
41
  /**
42
42
  * A Badge can be on of several preset sizes.
43
43
  * @defaultvalue medium
44
44
  */
45
- size: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
45
+ size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
46
46
  };
47
47
 
48
- export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & Partial<BadgeCommons>;
49
-
50
48
  export declare type BadgeSlots = {
51
49
  root: Slot<'div'>;
52
50
  icon?: Slot<'span'>;
53
51
  };
54
52
 
55
- export declare type BadgeState = ComponentState<BadgeSlots> & BadgeCommons;
53
+ export declare type BadgeState = ComponentState<BadgeSlots> & Required<Pick<BadgeProps, 'appearance' | 'color' | 'iconPosition' | 'shape' | 'size'>>;
56
54
 
57
55
  /**
58
56
  * Define a styled CounterBadge, using the `useCounterBadge_unstable` hook.
@@ -66,47 +64,48 @@ export declare const counterBadgeClassName = "fui-CounterBadge";
66
64
 
67
65
  export declare const counterBadgeClassNames: SlotClassNames<BadgeSlots>;
68
66
 
69
- declare type CounterBadgeCommons = {
67
+ export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'color' | 'shape'> & {
70
68
  /**
71
- * Max number to be displayed
72
- * @default 99
69
+ * A Badge can have different appearances that emphasize certain parts of it:
70
+ * - filled: The default appearance if one is not specified.
71
+ * The badge background is filled with color with a contrasting foreground text to match.
72
+ * - ghost: The badge background is transparent, with the foreground text taking color to emphasize it.
73
+ * @default filled
74
+ */
75
+ appearance?: 'filled' | 'ghost';
76
+ /**
77
+ * Semantic colors for a counter badge
78
+ * @default brand
73
79
  */
74
- overflowCount: number;
80
+ color?: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;
75
81
  /**
76
82
  * Value displayed by the Badge
77
83
  * @default 0
78
84
  */
79
- count: number;
85
+ count?: number;
80
86
  /**
81
- * If the badge should be shown when count is 0
87
+ * If a dot should be displayed without the count
82
88
  * @default false
83
89
  */
84
- showZero: boolean;
90
+ dot?: boolean;
85
91
  /**
86
- * If a dot should be displayed without the count
87
- * @default false
92
+ * Max number to be displayed
93
+ * @default 99
88
94
  */
89
- dot: boolean;
95
+ overflowCount?: number;
90
96
  /**
91
97
  * A Badge can be circular or rounded
92
98
  * @default circular
93
99
  */
94
- shape: 'circular' | 'rounded';
95
- /**
96
- * A Badge can be filled, ghost
97
- * @default filled
98
- */
99
- appearance: 'filled' | 'ghost';
100
+ shape?: 'circular' | 'rounded';
100
101
  /**
101
- * Semantic colors for a counter badge
102
- * @default brand
102
+ * If the badge should be shown when count is 0
103
+ * @default false
103
104
  */
104
- color: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;
105
+ showZero?: boolean;
105
106
  };
106
107
 
107
- export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'shape' | 'color'> & Partial<CounterBadgeCommons>;
108
-
109
- export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'shape' | 'color'> & CounterBadgeCommons;
108
+ export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'color' | 'shape'> & Required<Pick<CounterBadgeProps, 'appearance' | 'color' | 'count' | 'dot' | 'shape' | 'showZero'>>;
110
109
 
111
110
  /**
112
111
  * Define a styled Badge, using the `useBadge_unstable` hook.
@@ -120,23 +119,21 @@ export declare const presenceBadgeClassName = "fui-PresenceBadge";
120
119
 
121
120
  export declare const presenceBadgeClassNames: SlotClassNames<BadgeSlots>;
122
121
 
123
- declare type PresenceBadgeCommons = {
122
+ export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root' | 'icon'>>, 'color'> & Pick<BadgeProps, 'size'> & {
124
123
  /**
125
124
  * Represents several status
126
125
  * @default available
127
126
  */
128
- status: PresenceBadgeStatus;
127
+ status?: PresenceBadgeStatus;
129
128
  /**
130
129
  * Modifies the display to indicate that the user is out of office.
131
130
  * This can be combined with any status to display an out-of-office version of that status
132
131
  * @default false
133
132
  */
134
- outOfOffice: boolean;
135
- } & BadgeCommons;
136
-
137
- export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root'>>, 'color'> & Partial<Pick<PresenceBadgeCommons, 'status' | 'outOfOffice' | 'size'>>;
133
+ outOfOffice?: boolean;
134
+ };
138
135
 
139
- export declare type PresenceBadgeState = PresenceBadgeCommons & ComponentState<BadgeSlots>;
136
+ export declare type PresenceBadgeState = ComponentState<BadgeSlots> & BadgeState & Required<Pick<PresenceBadgeProps, 'status' | 'outOfOffice'>>;
140
137
 
141
138
  export declare type PresenceBadgeStatus = 'busy' | 'outOfOffice' | 'away' | 'available' | 'offline' | 'doNotDisturb' | 'unknown';
142
139
 
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.types.js","sourceRoot":"../src/","sources":["components/Badge/Badge.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type BadgeSlots = {\n root: Slot<'div'>;\n icon?: Slot<'span'>;\n};\n\nexport type BadgeCommons = {\n /**\n * A Badge can be filled, outline, ghost, inverted\n * @defaultvalue filled\n */\n appearance: 'filled' | 'ghost' | 'outline' | 'tint';\n\n /**\n * A Badge can be one of preset colors\n * @defaultvalue brand\n */\n color: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';\n\n /**\n * A Badge can position the icon before or after the content.\n * @defaultvalue before\n */\n iconPosition: 'before' | 'after';\n\n /**\n * A Badge can be square, circular or rounded.\n * @defaultvalue circular\n */\n shape: 'circular' | 'rounded' | 'square';\n\n /**\n * A Badge can be on of several preset sizes.\n * @defaultvalue medium\n */\n size: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';\n};\n\n// react has a non-standard `color` attribute in its types\n// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a4ab0fa432320e70da9e51c8ae2e47377f65804b/types/react/index.d.ts#L1868\nexport type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & Partial<BadgeCommons>;\nexport type BadgeState = ComponentState<BadgeSlots> & BadgeCommons;\n"]}
1
+ {"version":3,"file":"Badge.types.js","sourceRoot":"../src/","sources":["components/Badge/Badge.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type BadgeSlots = {\n root: Slot<'div'>;\n icon?: Slot<'span'>;\n};\n\n// react has a non-standard `color` attribute in its types\n// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a4ab0fa432320e70da9e51c8ae2e47377f65804b/types/react/index.d.ts#L1868\nexport type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & {\n /**\n * A Badge can be filled, outline, ghost, inverted\n * @defaultvalue filled\n */\n appearance?: 'filled' | 'ghost' | 'outline' | 'tint';\n\n /**\n * A Badge can be one of preset colors\n * @defaultvalue brand\n */\n color?: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';\n\n /**\n * A Badge can position the icon before or after the content.\n * @defaultvalue before\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A Badge can be square, circular or rounded.\n * @defaultvalue circular\n */\n shape?: 'circular' | 'rounded' | 'square';\n\n /**\n * A Badge can be on of several preset sizes.\n * @defaultvalue medium\n */\n size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';\n};\n\nexport type BadgeState = ComponentState<BadgeSlots> &\n Required<Pick<BadgeProps, 'appearance' | 'color' | 'iconPosition' | 'shape' | 'size'>>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CounterBadge.types.js","sourceRoot":"../src/","sources":["components/CounterBadge/CounterBadge.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeProps, BadgeState } from '../Badge/index';\n\ntype CounterBadgeCommons = {\n /**\n * Max number to be displayed\n * @default 99\n */\n overflowCount: number;\n\n /**\n * Value displayed by the Badge\n * @default 0\n */\n count: number;\n\n /**\n * If the badge should be shown when count is 0\n * @default false\n */\n showZero: boolean;\n\n /**\n * If a dot should be displayed without the count\n * @default false\n */\n dot: boolean;\n\n /**\n * A Badge can be circular or rounded\n * @default circular\n */\n shape: 'circular' | 'rounded';\n\n /**\n * A Badge can be filled, ghost\n * @default filled\n */\n appearance: 'filled' | 'ghost';\n\n /**\n * Semantic colors for a counter badge\n * @default brand\n */\n color: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;\n};\n\nexport type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'shape' | 'color'> & Partial<CounterBadgeCommons>;\n\nexport type CounterBadgeState = Omit<BadgeState, 'appearance' | 'shape' | 'color'> & CounterBadgeCommons;\n"]}
1
+ {"version":3,"file":"CounterBadge.types.js","sourceRoot":"../src/","sources":["components/CounterBadge/CounterBadge.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeProps, BadgeState } from '../Badge/index';\n\nexport type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'color' | 'shape'> & {\n /**\n * A Badge can have different appearances that emphasize certain parts of it:\n * - filled: The default appearance if one is not specified.\n * The badge background is filled with color with a contrasting foreground text to match.\n * - ghost: The badge background is transparent, with the foreground text taking color to emphasize it.\n * @default filled\n */\n appearance?: 'filled' | 'ghost';\n\n /**\n * Semantic colors for a counter badge\n * @default brand\n */\n color?: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;\n\n /**\n * Value displayed by the Badge\n * @default 0\n */\n count?: number;\n\n /**\n * If a dot should be displayed without the count\n * @default false\n */\n dot?: boolean;\n\n /**\n * Max number to be displayed\n * @default 99\n */\n overflowCount?: number;\n\n /**\n * A Badge can be circular or rounded\n * @default circular\n */\n shape?: 'circular' | 'rounded';\n\n /**\n * If the badge should be shown when count is 0\n * @default false\n */\n showZero?: boolean;\n};\n\nexport type CounterBadgeState = Omit<BadgeState, 'appearance' | 'color' | 'shape'> &\n Required<Pick<CounterBadgeProps, 'appearance' | 'color' | 'count' | 'dot' | 'shape' | 'showZero'>>;\n"]}
@@ -16,13 +16,12 @@ export const useCounterBadge_unstable = (props, ref) => {
16
16
  shape,
17
17
  appearance,
18
18
  showZero,
19
- overflowCount,
20
19
  count,
21
20
  dot
22
21
  };
23
22
 
24
23
  if (!state.dot && !state.root.children) {
25
- state.root.children = state.count > state.overflowCount ? `${state.overflowCount}+` : `${state.count}`;
24
+ state.root.children = state.count > overflowCount ? `${overflowCount}+` : `${state.count}`;
26
25
  }
27
26
 
28
27
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CounterBadge/useCounterBadge.ts"],"names":[],"mappings":"AACA,SAAS,iBAAT,QAAkC,gBAAlC;AAGA;;AAEG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;AACnH,QAAM;AACJ,IAAA,KAAK,GAAG,UADJ;AAEJ,IAAA,UAAU,GAAG,QAFT;AAGJ,IAAA,QAAQ,GAAG,KAHP;AAIJ,IAAA,aAAa,GAAG,EAJZ;AAKJ,IAAA,KAAK,GAAG,CALJ;AAMJ,IAAA,GAAG,GAAG;AANF,MAOF,KAPJ;AASA,QAAM,KAAK,GAAsB,EAC/B,GAAI,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CADU;AAE/B,IAAA,KAF+B;AAG/B,IAAA,UAH+B;AAI/B,IAAA,QAJ+B;AAK/B,IAAA,aAL+B;AAM/B,IAAA,KAN+B;AAO/B,IAAA;AAP+B,GAAjC;;AAUA,MAAI,CAAC,KAAK,CAAC,GAAP,IAAc,CAAC,KAAK,CAAC,IAAN,CAAW,QAA9B,EAAwC;AACtC,IAAA,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,KAAK,CAAC,KAAN,GAAc,KAAK,CAAC,aAApB,GAAoC,GAAG,KAAK,CAAC,aAAa,GAA1D,GAAgE,GAAG,KAAK,CAAC,KAAK,EAApG;AACD;;AAED,SAAO,KAAP;AACD,CAzBM","sourcesContent":["import * as React from 'react';\nimport { useBadge_unstable } from '../Badge/index';\nimport type { CounterBadgeProps, CounterBadgeState } from './CounterBadge.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useCounterBadge_unstable = (props: CounterBadgeProps, ref: React.Ref<HTMLElement>): CounterBadgeState => {\n const {\n shape = 'circular',\n appearance = 'filled',\n showZero = false,\n overflowCount = 99,\n count = 0,\n dot = false,\n } = props;\n\n const state: CounterBadgeState = {\n ...(useBadge_unstable(props, ref) as CounterBadgeState),\n shape,\n appearance,\n showZero,\n overflowCount,\n count,\n dot,\n };\n\n if (!state.dot && !state.root.children) {\n state.root.children = state.count > state.overflowCount ? `${state.overflowCount}+` : `${state.count}`;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/CounterBadge/useCounterBadge.ts"],"names":[],"mappings":"AACA,SAAS,iBAAT,QAAkC,gBAAlC;AAGA;;AAEG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;AACnH,QAAM;AACJ,IAAA,KAAK,GAAG,UADJ;AAEJ,IAAA,UAAU,GAAG,QAFT;AAGJ,IAAA,QAAQ,GAAG,KAHP;AAIJ,IAAA,aAAa,GAAG,EAJZ;AAKJ,IAAA,KAAK,GAAG,CALJ;AAMJ,IAAA,GAAG,GAAG;AANF,MAOF,KAPJ;AASA,QAAM,KAAK,GAAsB,EAC/B,GAAI,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CADU;AAE/B,IAAA,KAF+B;AAG/B,IAAA,UAH+B;AAI/B,IAAA,QAJ+B;AAK/B,IAAA,KAL+B;AAM/B,IAAA;AAN+B,GAAjC;;AASA,MAAI,CAAC,KAAK,CAAC,GAAP,IAAc,CAAC,KAAK,CAAC,IAAN,CAAW,QAA9B,EAAwC;AACtC,IAAA,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,KAAK,CAAC,KAAN,GAAc,aAAd,GAA8B,GAAG,aAAa,GAA9C,GAAoD,GAAG,KAAK,CAAC,KAAK,EAAxF;AACD;;AAED,SAAO,KAAP;AACD,CAxBM","sourcesContent":["import * as React from 'react';\nimport { useBadge_unstable } from '../Badge/index';\nimport type { CounterBadgeProps, CounterBadgeState } from './CounterBadge.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useCounterBadge_unstable = (props: CounterBadgeProps, ref: React.Ref<HTMLElement>): CounterBadgeState => {\n const {\n shape = 'circular',\n appearance = 'filled',\n showZero = false,\n overflowCount = 99,\n count = 0,\n dot = false,\n } = props;\n\n const state: CounterBadgeState = {\n ...(useBadge_unstable(props, ref) as CounterBadgeState),\n shape,\n appearance,\n showZero,\n count,\n dot,\n };\n\n if (!state.dot && !state.root.children) {\n state.root.children = state.count > overflowCount ? `${overflowCount}+` : `${state.count}`;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"PresenceBadge.types.js","sourceRoot":"../src/","sources":["components/PresenceBadge/PresenceBadge.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { BadgeCommons, BadgeSlots } from '../Badge/Badge.types';\n\nexport type PresenceBadgeStatus =\n | 'busy'\n | 'outOfOffice'\n | 'away'\n | 'available'\n | 'offline'\n | 'doNotDisturb'\n | 'unknown';\n\ntype PresenceBadgeCommons = {\n /**\n * Represents several status\n * @default available\n */\n status: PresenceBadgeStatus;\n /**\n * Modifies the display to indicate that the user is out of office.\n * This can be combined with any status to display an out-of-office version of that status\n * @default false\n */\n outOfOffice: boolean;\n} & BadgeCommons;\n\nexport type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root'>>, 'color'> &\n Partial<Pick<PresenceBadgeCommons, 'status' | 'outOfOffice' | 'size'>>;\n\nexport type PresenceBadgeState = PresenceBadgeCommons & ComponentState<BadgeSlots>;\n"]}
1
+ {"version":3,"file":"PresenceBadge.types.js","sourceRoot":"../src/","sources":["components/PresenceBadge/PresenceBadge.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { BadgeProps, BadgeState, BadgeSlots } from '../Badge/Badge.types';\n\nexport type PresenceBadgeStatus =\n | 'busy'\n | 'outOfOffice'\n | 'away'\n | 'available'\n | 'offline'\n | 'doNotDisturb'\n | 'unknown';\n\nexport type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root' | 'icon'>>, 'color'> &\n Pick<BadgeProps, 'size'> & {\n /**\n * Represents several status\n * @default available\n */\n status?: PresenceBadgeStatus;\n\n /**\n * Modifies the display to indicate that the user is out of office.\n * This can be combined with any status to display an out-of-office version of that status\n * @default false\n */\n outOfOffice?: boolean;\n };\n\nexport type PresenceBadgeState = ComponentState<BadgeSlots> &\n BadgeState &\n Required<Pick<PresenceBadgeProps, 'status' | 'outOfOffice'>>;\n"]}
@@ -27,19 +27,31 @@ const iconMap = (status, outOfOffice, size) => {
27
27
  return presenceUnknownRegular[size];
28
28
  }
29
29
  };
30
+
31
+ const DEFAULT_STRINGS = {
32
+ busy: 'busy',
33
+ outOfOffice: 'out of office',
34
+ away: 'away',
35
+ available: 'available',
36
+ offline: 'offline',
37
+ doNotDisturb: 'do not disturb',
38
+ unknown: 'unknown'
39
+ };
30
40
  /**
31
41
  * Returns the props and state required to render the component
32
42
  */
33
43
 
34
-
35
44
  export const usePresenceBadge_unstable = (props, ref) => {
36
45
  var _a, _b;
37
46
 
38
47
  const state = { ...useBadge_unstable({
39
48
  size: 'medium',
40
49
  ...props,
41
- icon: resolveShorthand(undefined, {
42
- required: true
50
+ icon: resolveShorthand(props.icon, {
51
+ required: true,
52
+ defaultProps: {
53
+ 'aria-label': props.status && DEFAULT_STRINGS[props.status]
54
+ }
43
55
  })
44
56
  }, ref),
45
57
  status: (_a = props.status) !== null && _a !== void 0 ? _a : 'available',
@@ -1 +1 @@
1
- {"version":3,"sources":["components/PresenceBadge/usePresenceBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SACE,uBADF,EAEE,wBAFF,EAGE,kBAHF,EAIE,kBAJF,EAKE,iBALF,EAME,kBANF,EAOE,sBAPF,EAQE,kBARF,EASE,sBATF,QAUO,iBAVP;AAWA,SAAS,iBAAT,QAA8C,gBAA9C;;AAGA,MAAM,OAAO,GAAG,CACd,MADc,EAEd,WAFc,EAGd,IAHc,KAIoB;AAClC,UAAQ,MAAR;AACE,SAAK,WAAL;AACE,aAAO,WAAW,GAAG,wBAAwB,CAAC,IAAD,CAA3B,GAAoC,uBAAuB,CAAC,IAAD,CAA7E;;AACF,SAAK,MAAL;AACE,aAAO,WAAW,GAAG,sBAAsB,CAAC,IAAD,CAAzB,GAAkC,kBAAkB,CAAC,IAAD,CAAtE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O,KAAP;AACD,CAzBM","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport {\n presenceAvailableFilled,\n presenceAvailableRegular,\n presenceAwayFilled,\n presenceBusyFilled,\n presenceDndFilled,\n presenceDndRegular,\n presenceOfflineRegular,\n presenceOofRegular,\n presenceUnknownRegular,\n} from './presenceIcons';\nimport { useBadge_unstable, BadgeProps } from '../Badge/index';\nimport type { PresenceBadgeProps, PresenceBadgeState } from './PresenceBadge.types';\n\nconst iconMap = (\n status: PresenceBadgeState['status'],\n outOfOffice: boolean,\n size: PresenceBadgeState['size'],\n): React.FunctionComponent | null => {\n switch (status) {\n case 'available':\n return outOfOffice ? presenceAvailableRegular[size] : presenceAvailableFilled[size];\n case 'away':\n return outOfOffice ? presenceOfflineRegular[size] : presenceAwayFilled[size];\n case 'busy':\n return outOfOffice ? presenceUnknownRegular[size] : presenceBusyFilled[size];\n case 'doNotDisturb':\n return outOfOffice ? presenceDndRegular[size] : presenceDndFilled[size];\n case 'offline':\n return presenceOfflineRegular[size];\n case 'outOfOffice':\n return presenceOofRegular[size];\n case 'unknown':\n return presenceUnknownRegular[size];\n }\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 state: PresenceBadgeState = {\n ...useBadge_unstable(\n {\n size: 'medium',\n ...props,\n icon: resolveShorthand(undefined as BadgeProps['icon'], {\n required: true,\n }),\n },\n ref,\n ),\n status: props.status ?? 'available',\n outOfOffice: props.outOfOffice ?? false,\n };\n\n const IconElement = iconMap(state.status, state.outOfOffice, state.size);\n if (IconElement) {\n state.icon!.children = <IconElement />;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/PresenceBadge/usePresenceBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,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AiB,CAClB;AACE,MAAA,IAAI,EAAE,QADR;AAEE,SAAG,KAFL;AAGE,MAAA,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAP,EAAa;AACjC,QAAA,QAAQ,EAAE,IADuB;AAEjC,QAAA,YAAY,EAAE;AACZ,wBAAc,KAAK,CAAC,MAAN,IAAgB,eAAe,CAAC,KAAK,CAAC,MAAP;AADjC;AAFmB,OAAb;AAHxB,KADkB,EAWlB,GAXkB,CADY;AAchC,IAAA,MAAM,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,MAAN,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,EAAZ,GAAgB,WAdQ;AAehC,IAAA,WAAW,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,WAAN,MAAiB,IAAjB,IAAiB,EAAA,KAAA,KAAA,CAAjB,GAAiB,EAAjB,GAAqB;AAfF,GAAlC;AAkBA,QAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,MAAP,EAAe,KAAK,CAAC,WAArB,EAAkC,KAAK,CAAC,IAAxC,CAA3B;;AACA,MAAI,WAAJ,EAAiB;AACf,IAAA,KAAK,CAAC,IAAN,CAAY,QAAZ,gBAAuB,KAAA,CAAA,aAAA,CAAC,WAAD,EAAY,IAAZ,CAAvB;AACD;;AAED,SAAO,KAAP;AACD,CA5BM","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport {\n presenceAvailableFilled,\n presenceAvailableRegular,\n presenceAwayFilled,\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 = (\n status: PresenceBadgeState['status'],\n outOfOffice: boolean,\n size: PresenceBadgeState['size'],\n): React.FunctionComponent | null => {\n switch (status) {\n case 'available':\n return outOfOffice ? presenceAvailableRegular[size] : presenceAvailableFilled[size];\n case 'away':\n return outOfOffice ? presenceOfflineRegular[size] : presenceAwayFilled[size];\n case 'busy':\n return outOfOffice ? presenceUnknownRegular[size] : presenceBusyFilled[size];\n case 'doNotDisturb':\n return outOfOffice ? presenceDndRegular[size] : presenceDndFilled[size];\n case 'offline':\n return presenceOfflineRegular[size];\n case 'outOfOffice':\n return presenceOofRegular[size];\n case 'unknown':\n return presenceUnknownRegular[size];\n }\n};\n\nconst DEFAULT_STRINGS = {\n busy: 'busy',\n outOfOffice: 'out of office',\n away: 'away',\n available: 'available',\n offline: 'offline',\n doNotDisturb: 'do not disturb',\n unknown: 'unknown',\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 state: PresenceBadgeState = {\n ...useBadge_unstable(\n {\n size: 'medium',\n ...props,\n icon: resolveShorthand(props.icon, {\n required: true,\n defaultProps: {\n 'aria-label': props.status && DEFAULT_STRINGS[props.status],\n },\n }),\n },\n ref,\n ),\n status: props.status ?? 'available',\n outOfOffice: props.outOfOffice ?? false,\n };\n\n const IconElement = iconMap(state.status, state.outOfOffice, state.size);\n if (IconElement) {\n state.icon!.children = <IconElement />;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -24,13 +24,12 @@ const useCounterBadge_unstable = (props, ref) => {
24
24
  shape,
25
25
  appearance,
26
26
  showZero,
27
- overflowCount,
28
27
  count,
29
28
  dot
30
29
  };
31
30
 
32
31
  if (!state.dot && !state.root.children) {
33
- state.root.children = state.count > state.overflowCount ? `${state.overflowCount}+` : `${state.count}`;
32
+ state.root.children = state.count > overflowCount ? `${overflowCount}+` : `${state.count}`;
34
33
  }
35
34
 
36
35
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CounterBadge/useCounterBadge.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;AACnH,QAAM;AACJ,IAAA,KAAK,GAAG,UADJ;AAEJ,IAAA,UAAU,GAAG,QAFT;AAGJ,IAAA,QAAQ,GAAG,KAHP;AAIJ,IAAA,aAAa,GAAG,EAJZ;AAKJ,IAAA,KAAK,GAAG,CALJ;AAMJ,IAAA,GAAG,GAAG;AANF,MAOF,KAPJ;AASA,QAAM,KAAK,GAAsB,EAC/B,GAAI,OAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAD2B;AAE/B,IAAA,KAF+B;AAG/B,IAAA,UAH+B;AAI/B,IAAA,QAJ+B;AAK/B,IAAA,aAL+B;AAM/B,IAAA,KAN+B;AAO/B,IAAA;AAP+B,GAAjC;;AAUA,MAAI,CAAC,KAAK,CAAC,GAAP,IAAc,CAAC,KAAK,CAAC,IAAN,CAAW,QAA9B,EAAwC;AACtC,IAAA,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,KAAK,CAAC,KAAN,GAAc,KAAK,CAAC,aAApB,GAAoC,GAAG,KAAK,CAAC,aAAa,GAA1D,GAAgE,GAAG,KAAK,CAAC,KAAK,EAApG;AACD;;AAED,SAAO,KAAP;AACD,CAzBM;;AAAM,OAAA,CAAA,wBAAA,GAAwB,wBAAxB","sourcesContent":["import * as React from 'react';\nimport { useBadge_unstable } from '../Badge/index';\nimport type { CounterBadgeProps, CounterBadgeState } from './CounterBadge.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useCounterBadge_unstable = (props: CounterBadgeProps, ref: React.Ref<HTMLElement>): CounterBadgeState => {\n const {\n shape = 'circular',\n appearance = 'filled',\n showZero = false,\n overflowCount = 99,\n count = 0,\n dot = false,\n } = props;\n\n const state: CounterBadgeState = {\n ...(useBadge_unstable(props, ref) as CounterBadgeState),\n shape,\n appearance,\n showZero,\n overflowCount,\n count,\n dot,\n };\n\n if (!state.dot && !state.root.children) {\n state.root.children = state.count > state.overflowCount ? `${state.overflowCount}+` : `${state.count}`;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/CounterBadge/useCounterBadge.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;AACnH,QAAM;AACJ,IAAA,KAAK,GAAG,UADJ;AAEJ,IAAA,UAAU,GAAG,QAFT;AAGJ,IAAA,QAAQ,GAAG,KAHP;AAIJ,IAAA,aAAa,GAAG,EAJZ;AAKJ,IAAA,KAAK,GAAG,CALJ;AAMJ,IAAA,GAAG,GAAG;AANF,MAOF,KAPJ;AASA,QAAM,KAAK,GAAsB,EAC/B,GAAI,OAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAD2B;AAE/B,IAAA,KAF+B;AAG/B,IAAA,UAH+B;AAI/B,IAAA,QAJ+B;AAK/B,IAAA,KAL+B;AAM/B,IAAA;AAN+B,GAAjC;;AASA,MAAI,CAAC,KAAK,CAAC,GAAP,IAAc,CAAC,KAAK,CAAC,IAAN,CAAW,QAA9B,EAAwC;AACtC,IAAA,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,KAAK,CAAC,KAAN,GAAc,aAAd,GAA8B,GAAG,aAAa,GAA9C,GAAoD,GAAG,KAAK,CAAC,KAAK,EAAxF;AACD;;AAED,SAAO,KAAP;AACD,CAxBM;;AAAM,OAAA,CAAA,wBAAA,GAAwB,wBAAxB","sourcesContent":["import * as React from 'react';\nimport { useBadge_unstable } from '../Badge/index';\nimport type { CounterBadgeProps, CounterBadgeState } from './CounterBadge.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useCounterBadge_unstable = (props: CounterBadgeProps, ref: React.Ref<HTMLElement>): CounterBadgeState => {\n const {\n shape = 'circular',\n appearance = 'filled',\n showZero = false,\n overflowCount = 99,\n count = 0,\n dot = false,\n } = props;\n\n const state: CounterBadgeState = {\n ...(useBadge_unstable(props, ref) as CounterBadgeState),\n shape,\n appearance,\n showZero,\n count,\n dot,\n };\n\n if (!state.dot && !state.root.children) {\n state.root.children = state.count > overflowCount ? `${overflowCount}+` : `${state.count}`;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -37,19 +37,31 @@ const iconMap = (status, outOfOffice, size) => {
37
37
  return presenceIcons_1.presenceUnknownRegular[size];
38
38
  }
39
39
  };
40
+
41
+ const DEFAULT_STRINGS = {
42
+ busy: 'busy',
43
+ outOfOffice: 'out of office',
44
+ away: 'away',
45
+ available: 'available',
46
+ offline: 'offline',
47
+ doNotDisturb: 'do not disturb',
48
+ unknown: 'unknown'
49
+ };
40
50
  /**
41
51
  * Returns the props and state required to render the component
42
52
  */
43
53
 
44
-
45
54
  const usePresenceBadge_unstable = (props, ref) => {
46
55
  var _a, _b;
47
56
 
48
57
  const state = { ...index_1.useBadge_unstable({
49
58
  size: 'medium',
50
59
  ...props,
51
- icon: react_utilities_1.resolveShorthand(undefined, {
52
- required: true
60
+ icon: react_utilities_1.resolveShorthand(props.icon, {
61
+ required: true,
62
+ defaultProps: {
63
+ 'aria-label': props.status && DEFAULT_STRINGS[props.status]
64
+ }
53
65
  })
54
66
  }, ref),
55
67
  status: (_a = props.status) !== null && _a !== void 0 ? _a : 'available',
@@ -1 +1 @@
1
- {"version":3,"sources":["components/PresenceBadge/usePresenceBadge.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAWA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAM,OAAO,GAAG,CACd,MADc,EAEd,W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;AAYhC,IAAA,WAAW,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,WAAN,MAAiB,IAAjB,IAAiB,EAAA,KAAA,KAAA,CAAjB,GAAiB,EAAjB,GAAqB;AAZF,GAAlC;AAeA,QAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,MAAP,EAAe,KAAK,CAAC,WAArB,EAAkC,KAAK,CAAC,IAAxC,CAA3B;;AACA,MAAI,WAAJ,EAAiB;AACf,IAAA,KAAK,CAAC,IAAN,CAAY,QAAZ,GAAuB,KAAA,CAAA,aAAA,CAAC,WAAD,EAAY,IAAZ,CAAvB;AACD;;AAED,SAAO,KAAP;AACD,CAzBM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport {\n presenceAvailableFilled,\n presenceAvailableRegular,\n presenceAwayFilled,\n presenceBusyFilled,\n presenceDndFilled,\n presenceDndRegular,\n presenceOfflineRegular,\n presenceOofRegular,\n presenceUnknownRegular,\n} from './presenceIcons';\nimport { useBadge_unstable, BadgeProps } from '../Badge/index';\nimport type { PresenceBadgeProps, PresenceBadgeState } from './PresenceBadge.types';\n\nconst iconMap = (\n status: PresenceBadgeState['status'],\n outOfOffice: boolean,\n size: PresenceBadgeState['size'],\n): React.FunctionComponent | null => {\n switch (status) {\n case 'available':\n return outOfOffice ? presenceAvailableRegular[size] : presenceAvailableFilled[size];\n case 'away':\n return outOfOffice ? presenceOfflineRegular[size] : presenceAwayFilled[size];\n case 'busy':\n return outOfOffice ? presenceUnknownRegular[size] : presenceBusyFilled[size];\n case 'doNotDisturb':\n return outOfOffice ? presenceDndRegular[size] : presenceDndFilled[size];\n case 'offline':\n return presenceOfflineRegular[size];\n case 'outOfOffice':\n return presenceOofRegular[size];\n case 'unknown':\n return presenceUnknownRegular[size];\n }\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 state: PresenceBadgeState = {\n ...useBadge_unstable(\n {\n size: 'medium',\n ...props,\n icon: resolveShorthand(undefined as BadgeProps['icon'], {\n required: true,\n }),\n },\n ref,\n ),\n status: props.status ?? 'available',\n outOfOffice: props.outOfOffice ?? false,\n };\n\n const IconElement = iconMap(state.status, state.outOfOffice, state.size);\n if (IconElement) {\n state.icon!.children = <IconElement />;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/PresenceBadge/usePresenceBadge.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAWA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAM,OAAO,GAAG,CACd,MADc,EAEd,WAFc,EAGd,IAHc,KAIoB;AAClC,UAAQ,MAAR;AACE,SAAK,WAAL;AACE,aAAO,WAAW,GAAG,eAAA,CAAA,wBAAA,CAAyB,IAAzB,CAAH,GAAoC,eAAA,CAAA,uBAAA,CAAwB,IAAxB,CAAtD;;AACF,SAAK,MAAL;AACE,aAAO,WAAW,GAAG,eAAA,CAAA,sBAAA,CAAuB,IAAvB,CAAH,GAAkC,eAAA,CAAA,kBAAA,CAAmB,IAAnB,CAApD;;AACF,SAAK,MAAL;AACE,aAAO,WAAW,GAAG,eAAA,CAAA,sBAAA,CAAuB,IAAvB,CAAH,GAAkC,eAAA,CAAA,kBAAA,CAAmB,IAAnB,CAApD;;AACF,SAAK,cAAL;AACE,aAAO,WAAW,GAAG,eAAA,CAAA,kBAAA,CAAmB,IAAnB,CAAH,GAA8B,eAAA,CAAA,iBAAA,CAAkB,IAAlB,CAAhD;;AACF,SAAK,SAAL;AACE,aAAO,eAAA,CAAA,sBAAA,C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CAAC,IAAxC,CAA3B;;AACA,MAAI,WAAJ,EAAiB;AACf,IAAA,KAAK,CAAC,IAAN,CAAY,QAAZ,GAAuB,KAAA,CAAA,aAAA,CAAC,WAAD,EAAY,IAAZ,CAAvB;AACD;;AAED,SAAO,KAAP;AACD,CA5BM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport {\n presenceAvailableFilled,\n presenceAvailableRegular,\n presenceAwayFilled,\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 = (\n status: PresenceBadgeState['status'],\n outOfOffice: boolean,\n size: PresenceBadgeState['size'],\n): React.FunctionComponent | null => {\n switch (status) {\n case 'available':\n return outOfOffice ? presenceAvailableRegular[size] : presenceAvailableFilled[size];\n case 'away':\n return outOfOffice ? presenceOfflineRegular[size] : presenceAwayFilled[size];\n case 'busy':\n return outOfOffice ? presenceUnknownRegular[size] : presenceBusyFilled[size];\n case 'doNotDisturb':\n return outOfOffice ? presenceDndRegular[size] : presenceDndFilled[size];\n case 'offline':\n return presenceOfflineRegular[size];\n case 'outOfOffice':\n return presenceOofRegular[size];\n case 'unknown':\n return presenceUnknownRegular[size];\n }\n};\n\nconst DEFAULT_STRINGS = {\n busy: 'busy',\n outOfOffice: 'out of office',\n away: 'away',\n available: 'available',\n offline: 'offline',\n doNotDisturb: 'do not disturb',\n unknown: 'unknown',\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 state: PresenceBadgeState = {\n ...useBadge_unstable(\n {\n size: 'medium',\n ...props,\n icon: resolveShorthand(props.icon, {\n required: true,\n defaultProps: {\n 'aria-label': props.status && DEFAULT_STRINGS[props.status],\n },\n }),\n },\n ref,\n ),\n status: props.status ?? 'available',\n outOfOffice: props.outOfOffice ?? false,\n };\n\n const IconElement = iconMap(state.status, state.outOfOffice, state.size);\n if (IconElement) {\n state.icon!.children = <IconElement />;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fluentui/react-badge",
3
- "version": "9.0.0-rc.6",
3
+ "version": "9.0.0-rc.9",
4
4
  "description": "React components for building web experiences",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
7
- "typings": "lib/index.d.ts",
7
+ "typings": "dist/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
@@ -21,21 +21,21 @@
21
21
  "start": "yarn storybook",
22
22
  "test": "jest --passWithNoTests",
23
23
  "docs": "api-extractor run --config=config/api-extractor.local.json --local",
24
- "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-badge/src && yarn docs",
25
- "storybook": "node ../../scripts/storybook/runner",
24
+ "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-badge/src && yarn docs",
25
+ "storybook": "node ../../../scripts/storybook/runner",
26
26
  "type-check": "tsc -b tsconfig.json"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@fluentui/eslint-plugin": "*",
30
30
  "@fluentui/react-conformance": "*",
31
- "@fluentui/react-conformance-griffel": "9.0.0-beta.4",
31
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.6",
32
32
  "@fluentui/scripts": "^1.0.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "@fluentui/react-icons": "^2.0.166-rc.3",
36
- "@griffel/react": "1.0.3",
37
- "@fluentui/react-theme": "9.0.0-rc.5",
38
- "@fluentui/react-utilities": "9.0.0-rc.6",
36
+ "@griffel/react": "1.0.5",
37
+ "@fluentui/react-theme": "9.0.0-rc.8",
38
+ "@fluentui/react-utilities": "9.0.0-rc.9",
39
39
  "tslib": "^2.1.0"
40
40
  },
41
41
  "peerDependencies": {
package/lib/Badge.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/Badge/index';
@@ -1 +0,0 @@
1
- export * from './components/CounterBadge/index';
@@ -1 +0,0 @@
1
- export * from './components/PresenceBadge/index';
@@ -1,6 +0,0 @@
1
- import type { BadgeProps } from './Badge.types';
2
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
- /**
4
- * Define a styled Badge, using the `useBadge_unstable` hook.
5
- */
6
- export declare const Badge: ForwardRefComponent<BadgeProps>;
@@ -1,34 +0,0 @@
1
- import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
- export declare type BadgeSlots = {
3
- root: Slot<'div'>;
4
- icon?: Slot<'span'>;
5
- };
6
- export declare type BadgeCommons = {
7
- /**
8
- * A Badge can be filled, outline, ghost, inverted
9
- * @defaultvalue filled
10
- */
11
- appearance: 'filled' | 'ghost' | 'outline' | 'tint';
12
- /**
13
- * A Badge can be one of preset colors
14
- * @defaultvalue brand
15
- */
16
- color: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
17
- /**
18
- * A Badge can position the icon before or after the content.
19
- * @defaultvalue before
20
- */
21
- iconPosition: 'before' | 'after';
22
- /**
23
- * A Badge can be square, circular or rounded.
24
- * @defaultvalue circular
25
- */
26
- shape: 'circular' | 'rounded' | 'square';
27
- /**
28
- * A Badge can be on of several preset sizes.
29
- * @defaultvalue medium
30
- */
31
- size: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
32
- };
33
- export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & Partial<BadgeCommons>;
34
- export declare type BadgeState = ComponentState<BadgeSlots> & BadgeCommons;
@@ -1,5 +0,0 @@
1
- export * from './Badge';
2
- export type { BadgeProps, BadgeSlots, BadgeState } from './Badge.types';
3
- export * from './renderBadge';
4
- export * from './useBadge';
5
- export * from './useBadgeStyles';
@@ -1,2 +0,0 @@
1
- import type { BadgeState } from './Badge.types';
2
- export declare const renderBadge_unstable: (state: BadgeState) => JSX.Element;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import type { BadgeProps, BadgeState } from './Badge.types';
3
- /**
4
- * Returns the props and state required to render the component
5
- */
6
- export declare const useBadge_unstable: (props: BadgeProps, ref: React.Ref<HTMLElement>) => BadgeState;
@@ -1,11 +0,0 @@
1
- import type { BadgeSlots, BadgeState } from './Badge.types';
2
- import type { SlotClassNames } from '@fluentui/react-utilities';
3
- /**
4
- * @deprecated Use `badgeClassNames.root` instead.
5
- */
6
- export declare const badgeClassName = "fui-Badge";
7
- export declare const badgeClassNames: SlotClassNames<BadgeSlots>;
8
- /**
9
- * Applies style classnames to slots
10
- */
11
- export declare const useBadgeStyles_unstable: (state: BadgeState) => BadgeState;
@@ -1,6 +0,0 @@
1
- import type { CounterBadgeProps } from './CounterBadge.types';
2
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
- /**
4
- * Define a styled CounterBadge, using the `useCounterBadge_unstable` hook.
5
- */
6
- export declare const CounterBadge: ForwardRefComponent<CounterBadgeProps>;
@@ -1,41 +0,0 @@
1
- import type { BadgeProps, BadgeState } from '../Badge/index';
2
- declare type CounterBadgeCommons = {
3
- /**
4
- * Max number to be displayed
5
- * @default 99
6
- */
7
- overflowCount: number;
8
- /**
9
- * Value displayed by the Badge
10
- * @default 0
11
- */
12
- count: number;
13
- /**
14
- * If the badge should be shown when count is 0
15
- * @default false
16
- */
17
- showZero: boolean;
18
- /**
19
- * If a dot should be displayed without the count
20
- * @default false
21
- */
22
- dot: boolean;
23
- /**
24
- * A Badge can be circular or rounded
25
- * @default circular
26
- */
27
- shape: 'circular' | 'rounded';
28
- /**
29
- * A Badge can be filled, ghost
30
- * @default filled
31
- */
32
- appearance: 'filled' | 'ghost';
33
- /**
34
- * Semantic colors for a counter badge
35
- * @default brand
36
- */
37
- color: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;
38
- };
39
- export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'shape' | 'color'> & Partial<CounterBadgeCommons>;
40
- export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'shape' | 'color'> & CounterBadgeCommons;
41
- export {};
@@ -1,4 +0,0 @@
1
- export * from './CounterBadge';
2
- export * from './CounterBadge.types';
3
- export * from './useCounterBadge';
4
- export * from './useCounterBadgeStyles';
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import type { CounterBadgeProps, CounterBadgeState } from './CounterBadge.types';
3
- /**
4
- * Returns the props and state required to render the component
5
- */
6
- export declare const useCounterBadge_unstable: (props: CounterBadgeProps, ref: React.Ref<HTMLElement>) => CounterBadgeState;
@@ -1,12 +0,0 @@
1
- import type { SlotClassNames } from '@fluentui/react-utilities';
2
- import type { BadgeSlots } from '../Badge/Badge.types';
3
- import type { CounterBadgeState } from './CounterBadge.types';
4
- /**
5
- * @deprecated Use `counterBadgeClassNames.root` instead.
6
- */
7
- export declare const counterBadgeClassName = "fui-CounterBadge";
8
- export declare const counterBadgeClassNames: SlotClassNames<BadgeSlots>;
9
- /**
10
- * Applies style classnames to slots
11
- */
12
- export declare const useCounterBadgeStyles_unstable: (state: CounterBadgeState) => CounterBadgeState;
@@ -1,6 +0,0 @@
1
- import type { PresenceBadgeProps } from './PresenceBadge.types';
2
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
- /**
4
- * Define a styled Badge, using the `useBadge_unstable` hook.
5
- */
6
- export declare const PresenceBadge: ForwardRefComponent<PresenceBadgeProps>;
@@ -1,19 +0,0 @@
1
- import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';
2
- import type { BadgeCommons, BadgeSlots } from '../Badge/Badge.types';
3
- export declare type PresenceBadgeStatus = 'busy' | 'outOfOffice' | 'away' | 'available' | 'offline' | 'doNotDisturb' | 'unknown';
4
- declare type PresenceBadgeCommons = {
5
- /**
6
- * Represents several status
7
- * @default available
8
- */
9
- status: PresenceBadgeStatus;
10
- /**
11
- * Modifies the display to indicate that the user is out of office.
12
- * This can be combined with any status to display an out-of-office version of that status
13
- * @default false
14
- */
15
- outOfOffice: boolean;
16
- } & BadgeCommons;
17
- export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root'>>, 'color'> & Partial<Pick<PresenceBadgeCommons, 'status' | 'outOfOffice' | 'size'>>;
18
- export declare type PresenceBadgeState = PresenceBadgeCommons & ComponentState<BadgeSlots>;
19
- export {};
@@ -1,4 +0,0 @@
1
- export * from './PresenceBadge';
2
- export * from './PresenceBadge.types';
3
- export * from './usePresenceBadge';
4
- export * from './usePresenceBadgeStyles';
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import type { PresenceBadgeState } from './PresenceBadge.types';
3
- export declare const presenceAwayFilled: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
4
- export declare const presenceAvailableRegular: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
5
- export declare const presenceAvailableFilled: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
6
- export declare const presenceBusyFilled: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
7
- export declare const presenceDndFilled: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
8
- export declare const presenceDndRegular: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
9
- export declare const presenceOofRegular: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
10
- export declare const presenceOfflineRegular: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;
11
- export declare const presenceUnknownRegular: Record<PresenceBadgeState['size'], React.FunctionComponent | null>;