@fluentui/react-badge 0.0.0-nightlyfc5cfdc52420220215.1 → 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/CHANGELOG.json +407 -12
  2. package/CHANGELOG.md +238 -104
  3. package/MIGRATION.md +59 -0
  4. package/README.md +40 -2
  5. package/Spec.md +11 -74
  6. package/dist/{react-badge.d.ts → index.d.ts} +42 -42
  7. package/{lib → dist}/tsdoc-metadata.json +0 -0
  8. package/lib/Badge.js.map +1 -1
  9. package/lib/CounterBadge.js.map +1 -1
  10. package/lib/PresenceBadge.js.map +1 -1
  11. package/lib/components/Badge/Badge.js.map +1 -1
  12. package/lib/components/Badge/Badge.types.js.map +1 -1
  13. package/lib/components/Badge/index.js.map +1 -1
  14. package/lib/components/Badge/renderBadge.js.map +1 -1
  15. package/lib/components/Badge/useBadge.js +0 -1
  16. package/lib/components/Badge/useBadge.js.map +1 -1
  17. package/lib/components/Badge/useBadgeStyles.js +6 -3
  18. package/lib/components/Badge/useBadgeStyles.js.map +1 -1
  19. package/lib/components/CounterBadge/CounterBadge.js.map +1 -1
  20. package/lib/components/CounterBadge/CounterBadge.types.js.map +1 -1
  21. package/lib/components/CounterBadge/index.js.map +1 -1
  22. package/lib/components/CounterBadge/useCounterBadge.js +1 -2
  23. package/lib/components/CounterBadge/useCounterBadge.js.map +1 -1
  24. package/lib/components/CounterBadge/useCounterBadgeStyles.js +10 -2
  25. package/lib/components/CounterBadge/useCounterBadgeStyles.js.map +1 -1
  26. package/lib/components/PresenceBadge/PresenceBadge.js.map +1 -1
  27. package/lib/components/PresenceBadge/PresenceBadge.types.js.map +1 -1
  28. package/lib/components/PresenceBadge/index.js.map +1 -1
  29. package/lib/components/PresenceBadge/presenceIcons.js.map +1 -1
  30. package/lib/components/PresenceBadge/usePresenceBadge.js +23 -7
  31. package/lib/components/PresenceBadge/usePresenceBadge.js.map +1 -1
  32. package/lib/components/PresenceBadge/usePresenceBadgeStyles.js +19 -2
  33. package/lib/components/PresenceBadge/usePresenceBadgeStyles.js.map +1 -1
  34. package/lib/index.js +3 -5
  35. package/lib/index.js.map +1 -1
  36. package/lib-commonjs/Badge.js.map +1 -1
  37. package/lib-commonjs/CounterBadge.js.map +1 -1
  38. package/lib-commonjs/PresenceBadge.js.map +1 -1
  39. package/lib-commonjs/components/Badge/Badge.js.map +1 -1
  40. package/lib-commonjs/components/Badge/Badge.types.js.map +1 -1
  41. package/lib-commonjs/components/Badge/index.js.map +1 -1
  42. package/lib-commonjs/components/Badge/renderBadge.js.map +1 -1
  43. package/lib-commonjs/components/Badge/useBadge.js +0 -1
  44. package/lib-commonjs/components/Badge/useBadge.js.map +1 -1
  45. package/lib-commonjs/components/Badge/useBadgeStyles.js +7 -4
  46. package/lib-commonjs/components/Badge/useBadgeStyles.js.map +1 -1
  47. package/lib-commonjs/components/CounterBadge/CounterBadge.js.map +1 -1
  48. package/lib-commonjs/components/CounterBadge/CounterBadge.types.js.map +1 -1
  49. package/lib-commonjs/components/CounterBadge/index.js.map +1 -1
  50. package/lib-commonjs/components/CounterBadge/useCounterBadge.js +1 -2
  51. package/lib-commonjs/components/CounterBadge/useCounterBadge.js.map +1 -1
  52. package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.js +11 -3
  53. package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.js.map +1 -1
  54. package/lib-commonjs/components/PresenceBadge/PresenceBadge.js.map +1 -1
  55. package/lib-commonjs/components/PresenceBadge/PresenceBadge.types.js.map +1 -1
  56. package/lib-commonjs/components/PresenceBadge/index.js.map +1 -1
  57. package/lib-commonjs/components/PresenceBadge/presenceIcons.js.map +1 -1
  58. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js +23 -7
  59. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js.map +1 -1
  60. package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.js +20 -3
  61. package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.js.map +1 -1
  62. package/lib-commonjs/index.js +82 -6
  63. package/lib-commonjs/index.js.map +1 -1
  64. package/package.json +18 -23
  65. package/lib/Badge.d.ts +0 -1
  66. package/lib/CounterBadge.d.ts +0 -1
  67. package/lib/PresenceBadge.d.ts +0 -1
  68. package/lib/components/Badge/Badge.d.ts +0 -6
  69. package/lib/components/Badge/Badge.types.d.ts +0 -34
  70. package/lib/components/Badge/index.d.ts +0 -5
  71. package/lib/components/Badge/renderBadge.d.ts +0 -2
  72. package/lib/components/Badge/useBadge.d.ts +0 -6
  73. package/lib/components/Badge/useBadgeStyles.d.ts +0 -6
  74. package/lib/components/CounterBadge/CounterBadge.d.ts +0 -6
  75. package/lib/components/CounterBadge/CounterBadge.types.d.ts +0 -41
  76. package/lib/components/CounterBadge/index.d.ts +0 -4
  77. package/lib/components/CounterBadge/useCounterBadge.d.ts +0 -6
  78. package/lib/components/CounterBadge/useCounterBadgeStyles.d.ts +0 -6
  79. package/lib/components/PresenceBadge/PresenceBadge.d.ts +0 -6
  80. package/lib/components/PresenceBadge/PresenceBadge.types.d.ts +0 -19
  81. package/lib/components/PresenceBadge/index.d.ts +0 -4
  82. package/lib/components/PresenceBadge/presenceIcons.d.ts +0 -11
  83. package/lib/components/PresenceBadge/usePresenceBadge.d.ts +0 -6
  84. package/lib/components/PresenceBadge/usePresenceBadgeStyles.d.ts +0 -6
  85. package/lib/index.d.ts +0 -5
  86. package/lib-commonjs/Badge.d.ts +0 -1
  87. package/lib-commonjs/CounterBadge.d.ts +0 -1
  88. package/lib-commonjs/PresenceBadge.d.ts +0 -1
  89. package/lib-commonjs/components/Badge/Badge.d.ts +0 -6
  90. package/lib-commonjs/components/Badge/Badge.types.d.ts +0 -34
  91. package/lib-commonjs/components/Badge/index.d.ts +0 -5
  92. package/lib-commonjs/components/Badge/renderBadge.d.ts +0 -2
  93. package/lib-commonjs/components/Badge/useBadge.d.ts +0 -6
  94. package/lib-commonjs/components/Badge/useBadgeStyles.d.ts +0 -6
  95. package/lib-commonjs/components/CounterBadge/CounterBadge.d.ts +0 -6
  96. package/lib-commonjs/components/CounterBadge/CounterBadge.types.d.ts +0 -41
  97. package/lib-commonjs/components/CounterBadge/index.d.ts +0 -4
  98. package/lib-commonjs/components/CounterBadge/useCounterBadge.d.ts +0 -6
  99. package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.d.ts +0 -6
  100. package/lib-commonjs/components/PresenceBadge/PresenceBadge.d.ts +0 -6
  101. package/lib-commonjs/components/PresenceBadge/PresenceBadge.types.d.ts +0 -19
  102. package/lib-commonjs/components/PresenceBadge/index.d.ts +0 -4
  103. package/lib-commonjs/components/PresenceBadge/presenceIcons.d.ts +0 -11
  104. package/lib-commonjs/components/PresenceBadge/usePresenceBadge.d.ts +0 -6
  105. package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.d.ts +0 -6
  106. package/lib-commonjs/index.d.ts +0 -5
package/MIGRATION.md ADDED
@@ -0,0 +1,59 @@
1
+ # Badge Migration
2
+
3
+ ## Migration from v8
4
+
5
+ v8 does not offer a component equivalent to v9's `Badge`. However, it does offer a `PersonaCoin` component that is similar in concept to v9's `PresenceBadge` component.
6
+
7
+ Here's how the API of v8's `PersonaCoin` compares to the one from v9's `PresenceBadge` component:
8
+
9
+ - `className` => `className`
10
+ - `coinProps` => Use native HTML props sent directly to `root` slot instead
11
+ - `coinSize` => `size`
12
+ - `componentRef` => NOT SUPPORTED - use `ref` instead
13
+ - `isOutOfOffice` => `outOfOffice`
14
+ - `onRenderPersonaCoin` => Use slots customization instead
15
+ - `presence` => `status`
16
+ - `presenceTitle` => NOT SUPPORTED
17
+ - `styles` => Use style customization through `className` instead
18
+
19
+ ## Migration from v0
20
+
21
+ v0 does not offer a component equivalent to v9's `Badge`. However, it does offer an `AvatarStatus` component that is similar in concept to v9's `PresenceBadge` component.
22
+
23
+ Here's how the API of v0's `AvatarStatus` compares to the one from v9's `PresenceBadge` component:
24
+
25
+ - `accessibility` => NOT SUPPORTED
26
+ - `as` => `as`
27
+ - `className` => `className`
28
+ - `color` => Use style customization through `className` instead
29
+ - `design` => NOT SUPPORTED
30
+ - `icon` => Use `icon` slot
31
+ - `image` => NOT SUPPORTED
32
+ - `key` => NOT SUPPORTED
33
+ - `ref` => `ref`
34
+ - `size` => `size`
35
+ - `state` => `status`
36
+ - `styles` => Use style customization through `className` instead
37
+ - `variables` => NOT SUPPORTED
38
+
39
+ ## Property Mapping
40
+
41
+ | v8 `PersonaCoin` | v0 `AvatarStatus` | v9 `PresenceBadge` |
42
+ | --------------------- | ----------------- | ------------------ |
43
+ | | `acessibility` | |
44
+ | | `as` | `as` |
45
+ | `className` | `className` | `className` |
46
+ | `coinProps` | | `root` slot |
47
+ | `coinSize` | `size` | `size` |
48
+ | | `color` | |
49
+ | `componentRef` | `ref` | `ref` |
50
+ | | `design` | |
51
+ | | `icon` | `icon` slot |
52
+ | | `image` | |
53
+ | `isOutOfOffice` | | `outOfOffice` |
54
+ | | `key` | |
55
+ | `onRenderPersonaCoin` | | `root` slot |
56
+ | `presence` | `state` | `status` |
57
+ | `presenceTitle` | | |
58
+ | `styles` | `styles` | |
59
+ | | `variables` | |
package/README.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @fluentui/react-badge
2
2
 
3
- **React Badge components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
3
+ **Badge components for [Fluent UI](https://aka.ms/fluentui-storybook)**
4
4
 
5
- These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
5
+ A badge is an additional visual descriptor for UI elements. It can be used to denote numerical value, status or general information.
6
+
7
+ ## Usage
8
+
9
+ To import Badge:
10
+
11
+ ```js
12
+ import { Badge, CounterBadge, PresenceBadge } from '@fluentui/react-components';
13
+ ```
14
+
15
+ ### Examples
16
+
17
+ ```jsx
18
+ <Badge>999+</Badge>
19
+ <Badge appearance="filled">999+</Badge>
20
+ <Badge shape="rounded" />
21
+ <Badge size="medium" icon={<PasteIcon />} />
22
+ <CounterBadge count={5} appearance="ghost" />
23
+ <CounterBadge count={0} dot />
24
+ <CounterBadge count={5} size="extra-large" />
25
+ <PresenceBadge status="available" />
26
+ <PresenceBadge status="away" />
27
+ <PresenceBadge outOfOffice status="do-not-disturb" />
28
+ ```
29
+
30
+ See [Fluent UI Storybook](https://aka.ms/fluentui-storybook) for more detailed usage examples.
31
+
32
+ Alternatively, run Storybook locally with:
33
+
34
+ 1. `yarn start`
35
+ 2. Select `react-badge` from the list.
36
+
37
+ ### Specification
38
+
39
+ See [SPEC.md](./SPEC.md).
40
+
41
+ ### Migration Guide
42
+
43
+ If you're upgrading to Fluent UI v9 see [MIGRATION.md](./MIGRATION.md) for guidance on updating to the latest Badge component implementations.
package/Spec.md CHANGED
@@ -25,44 +25,13 @@ A badge is an additional visual descriptor for UI elements. It can be used to de
25
25
 
26
26
  - Appearance: `default`, `rounded` and `circular`
27
27
  - Size: `tiny`, `extra-small`, `small`, `medium`, `large`, `extra-large`.
28
- - Styles: `filled`, `outline`, `ghost`, `tint`, `inverted filled`
28
+ - Styles: `filled`, `outline`, `ghost`, `tint`
29
29
 
30
- ## PROPS
30
+ ## API
31
31
 
32
- ```typescript
33
- type BadgeAppearance = 'filled' | 'outline' | 'ghost' | 'tint';
32
+ ### Props
34
33
 
35
- type BadgeShape = 'rounded' | 'square' | 'circular';
36
-
37
- type BadgeSize = 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
38
-
39
- type BadgeProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
40
- /**
41
- * A Badge can be sized.
42
- */
43
- size?: BadgeSize;
44
-
45
- /**
46
- * A Badge can be square, circular or rounded
47
- */
48
- shape?: BadgeShape;
49
-
50
- /**
51
- * A Badge can be filled, outline, ghost, inverted
52
- */
53
- appearance?: BadgeAppearance;
54
-
55
- /**
56
- * Icon slot
57
- */
58
- icon?: ShorthandProps<HTMLElement>;
59
-
60
- /**
61
- * Position for Icon to be rendered
62
- */
63
- iconPosition?: 'before' | 'after';
64
- }
65
- ```
34
+ See API at [Badge.types.ts](./src/components/Badge/Badge.types.ts).
66
35
 
67
36
  ## Structure
68
37
 
@@ -86,13 +55,7 @@ type BadgeProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
86
55
 
87
56
  ## Migration
88
57
 
89
- - _Migration from v8_
90
-
91
- `Badge` can be passed to `Avatar`'s `badge` slot. The `PresenceBadge` will be the best replacement for `Persona` presence mapping status, icon and colors.
92
-
93
- - _Migration from v0_
94
-
95
- `Badge` can be passed to `Avatar`'s `badge` slot.
58
+ See [MIGRATION.md](./MIGRATION.md).
96
59
 
97
60
  ## Behaviors
98
61
 
@@ -118,40 +81,14 @@ type BadgeProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
118
81
 
119
82
  A Presence Badge represents someone's availbility or status
120
83
 
121
- ```typescript
122
- export type PresenceBadgeStatus = 'busy' | 'oof' | 'away' | 'available' | 'offline';
123
-
124
- export type PresenceBadgeProps = Omit<BadgeProps, 'shape' | 'appearance'> & {
125
- /**
126
- * A PresenceBadge can represent several status
127
- * @defaultvalue available
128
- */
129
- status?: PresenceBadgeStatus;
130
- /**
131
- * A PresenceBadge can represent status of someone out of the office
132
- * @defaultvalue true
133
- */
134
- inOffice?: boolean;
135
- };
136
-
137
- export type PresenceBadgeState = BadgeState & {
138
- /**
139
- * A PresenceBadge can represent several status
140
- * @defaultvalue available
141
- */
142
- status: PresenceBadgeStatus;
143
- /**
144
- * A PresenceBadge can represent status of someone out of the office
145
- * @defaultvalue true
146
- */
147
- inOffice: boolean;
148
- };
149
- ```
84
+ #### Props
85
+
86
+ See API at [PresenceBadge.types.ts](./src/components/PresenceBadge/PresenceBadge.types.ts).
150
87
 
151
88
  ### Counter Badge
152
89
 
153
90
  A Counter Badge is a visual indicator for numeric values such as tallies and scores.
154
91
 
155
- ```typescript
156
- export type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'shape'> & Partial<CounterBadgeCommons>;
157
- ```
92
+ #### Props
93
+
94
+ See API at [CounterBadge.types.ts](./src/components/CounterBadge/CounterBadge.types.ts).
@@ -1,128 +1,128 @@
1
+ /// <reference types="react" />
2
+
1
3
  import type { ComponentProps } from '@fluentui/react-utilities';
2
4
  import type { ComponentState } from '@fluentui/react-utilities';
3
5
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
6
  import * as React_2 from 'react';
5
7
  import type { Slot } from '@fluentui/react-utilities';
8
+ import type { SlotClassNames } from '@fluentui/react-utilities';
6
9
 
7
10
  /**
8
11
  * Define a styled Badge, using the `useBadge_unstable` hook.
9
12
  */
10
13
  export declare const Badge: ForwardRefComponent<BadgeProps>;
11
14
 
12
- export declare const badgeClassName = "fui-Badge";
15
+ export declare const badgeClassNames: SlotClassNames<BadgeSlots>;
13
16
 
14
- declare type BadgeCommons = {
17
+ export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & {
15
18
  /**
16
19
  * A Badge can be filled, outline, ghost, inverted
17
20
  * @defaultvalue filled
18
21
  */
19
- appearance: 'filled' | 'ghost' | 'outline' | 'tint';
22
+ appearance?: 'filled' | 'ghost' | 'outline' | 'tint';
20
23
  /**
21
24
  * A Badge can be one of preset colors
22
25
  * @defaultvalue brand
23
26
  */
24
- color: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
27
+ color?: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
25
28
  /**
26
29
  * A Badge can position the icon before or after the content.
27
30
  * @defaultvalue before
28
31
  */
29
- iconPosition: 'before' | 'after';
32
+ iconPosition?: 'before' | 'after';
30
33
  /**
31
34
  * A Badge can be square, circular or rounded.
32
35
  * @defaultvalue circular
33
36
  */
34
- shape: 'circular' | 'rounded' | 'square';
37
+ shape?: 'circular' | 'rounded' | 'square';
35
38
  /**
36
39
  * A Badge can be on of several preset sizes.
37
40
  * @defaultvalue medium
38
41
  */
39
- size: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
42
+ size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
40
43
  };
41
44
 
42
- export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & Partial<BadgeCommons>;
43
-
44
45
  export declare type BadgeSlots = {
45
46
  root: Slot<'div'>;
46
47
  icon?: Slot<'span'>;
47
48
  };
48
49
 
49
- export declare type BadgeState = ComponentState<BadgeSlots> & BadgeCommons;
50
+ export declare type BadgeState = ComponentState<BadgeSlots> & Required<Pick<BadgeProps, 'appearance' | 'color' | 'iconPosition' | 'shape' | 'size'>>;
50
51
 
51
52
  /**
52
53
  * Define a styled CounterBadge, using the `useCounterBadge_unstable` hook.
53
54
  */
54
55
  export declare const CounterBadge: ForwardRefComponent<CounterBadgeProps>;
55
56
 
56
- export declare const counterBadgeClassName = "fui-CounterBadge";
57
+ export declare const counterBadgeClassNames: SlotClassNames<BadgeSlots>;
57
58
 
58
- declare type CounterBadgeCommons = {
59
+ export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'color' | 'shape'> & {
59
60
  /**
60
- * Max number to be displayed
61
- * @default 99
61
+ * A Badge can have different appearances that emphasize certain parts of it:
62
+ * - filled: The default appearance if one is not specified.
63
+ * The badge background is filled with color with a contrasting foreground text to match.
64
+ * - ghost: The badge background is transparent, with the foreground text taking color to emphasize it.
65
+ * @default filled
62
66
  */
63
- overflowCount: number;
67
+ appearance?: 'filled' | 'ghost';
68
+ /**
69
+ * Semantic colors for a counter badge
70
+ * @default brand
71
+ */
72
+ color?: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;
64
73
  /**
65
74
  * Value displayed by the Badge
66
75
  * @default 0
67
76
  */
68
- count: number;
77
+ count?: number;
69
78
  /**
70
- * If the badge should be shown when count is 0
79
+ * If a dot should be displayed without the count
71
80
  * @default false
72
81
  */
73
- showZero: boolean;
82
+ dot?: boolean;
74
83
  /**
75
- * If a dot should be displayed without the count
76
- * @default false
84
+ * Max number to be displayed
85
+ * @default 99
77
86
  */
78
- dot: boolean;
87
+ overflowCount?: number;
79
88
  /**
80
89
  * A Badge can be circular or rounded
81
90
  * @default circular
82
91
  */
83
- shape: 'circular' | 'rounded';
84
- /**
85
- * A Badge can be filled, ghost
86
- * @default filled
87
- */
88
- appearance: 'filled' | 'ghost';
92
+ shape?: 'circular' | 'rounded';
89
93
  /**
90
- * Semantic colors for a counter badge
91
- * @default brand
94
+ * If the badge should be shown when count is 0
95
+ * @default false
92
96
  */
93
- color: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;
97
+ showZero?: boolean;
94
98
  };
95
99
 
96
- export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'shape' | 'color'> & Partial<CounterBadgeCommons>;
97
-
98
- export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'shape' | 'color'> & CounterBadgeCommons;
100
+ export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'color' | 'shape'> & Required<Pick<CounterBadgeProps, 'appearance' | 'color' | 'count' | 'dot' | 'shape' | 'showZero'>>;
99
101
 
100
102
  /**
101
103
  * Define a styled Badge, using the `useBadge_unstable` hook.
102
104
  */
103
105
  export declare const PresenceBadge: ForwardRefComponent<PresenceBadgeProps>;
104
106
 
105
- export declare const presenceBadgeClassName = "fui-PresenceBadge";
107
+ export declare const presenceBadgeClassNames: SlotClassNames<BadgeSlots>;
106
108
 
107
- declare type PresenceBadgeCommons = {
109
+ export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root' | 'icon'>>, 'color'> & Pick<BadgeProps, 'size'> & {
108
110
  /**
109
111
  * Represents several status
110
112
  * @default available
111
113
  */
112
- status: PresenceBadgeStatus;
114
+ status?: PresenceBadgeStatus;
113
115
  /**
114
116
  * Modifies the display to indicate that the user is out of office.
115
117
  * This can be combined with any status to display an out-of-office version of that status
116
118
  * @default false
117
119
  */
118
- outOfOffice: boolean;
119
- } & BadgeCommons;
120
-
121
- export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root'>>, 'color'> & Partial<Pick<PresenceBadgeCommons, 'status' | 'outOfOffice' | 'size'>>;
120
+ outOfOffice?: boolean;
121
+ };
122
122
 
123
- export declare type PresenceBadgeState = PresenceBadgeCommons & ComponentState<BadgeSlots>;
123
+ export declare type PresenceBadgeState = ComponentState<BadgeSlots> & BadgeState & Required<Pick<PresenceBadgeProps, 'status' | 'outOfOffice'>>;
124
124
 
125
- export declare type PresenceBadgeStatus = 'busy' | 'outOfOffice' | 'away' | 'available' | 'offline' | 'doNotDisturb';
125
+ export declare type PresenceBadgeStatus = 'busy' | 'out-of-office' | 'away' | 'available' | 'offline' | 'do-not-disturb' | 'unknown';
126
126
 
127
127
  export declare const renderBadge_unstable: (state: BadgeState) => JSX.Element;
128
128
 
File without changes
package/lib/Badge.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../src/Badge.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"Badge.js","sourceRoot":"../src/","sources":["Badge.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './components/Badge/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CounterBadge.js","sourceRoot":"","sources":["../src/CounterBadge.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"CounterBadge.js","sourceRoot":"../src/","sources":["CounterBadge.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './components/CounterBadge/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PresenceBadge.js","sourceRoot":"","sources":["../src/PresenceBadge.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"PresenceBadge.js","sourceRoot":"../src/","sources":["PresenceBadge.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './components/PresenceBadge/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,YAAlC;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,oBAAT,QAAqC,eAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,KAAK,gBAAoC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpF,QAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AACA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALqD,CAA/C;AAOP,KAAK,CAAC,WAAN,GAAoB,OAApB","sourceRoot":""}
1
+ {"version":3,"sources":["components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,YAAlC;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,oBAAT,QAAqC,eAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,KAAK,gBAAoC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpF,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;EACA,uBAAuB,CAAC,KAAD,CAAvB;EAEA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALqD,CAA/C;AAOP,KAAK,CAAC,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\nimport { useBadge_unstable } from './useBadge';\nimport { useBadgeStyles_unstable } from './useBadgeStyles';\nimport { renderBadge_unstable } from './renderBadge';\nimport type { BadgeProps } from './Badge.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled Badge, using the `useBadge_unstable` hook.\n */\nexport const Badge: ForwardRefComponent<BadgeProps> = React.forwardRef((props, ref) => {\n const state = useBadge_unstable(props, ref);\n useBadgeStyles_unstable(state);\n\n return renderBadge_unstable(state);\n});\n\nBadge.displayName = 'Badge';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.types.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.types.ts"],"names":[],"mappings":""}
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":"index.js","sourceRoot":"","sources":["../../../src/components/Badge/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAGxB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Badge/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAGxB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './Badge';\n// Explicit exports to omit BadgeCommons\nexport type { BadgeProps, BadgeSlots, BadgeState } from './Badge.types';\nexport * from './renderBadge';\nexport * from './useBadge';\nexport * from './useBadgeStyles';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Badge/renderBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAAsB;AACxD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAa,KAAb,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,YAAN,KAAuB,QAAvB,IAAmC,KAAK,CAAC,IAAzC,iBAAiD,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADpD,EAEG,KAAK,CAAC,IAAN,CAAW,QAFd,EAGG,KAAK,CAAC,YAAN,KAAuB,OAAvB,IAAkC,KAAK,CAAC,IAAxC,iBAAgD,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAHnD,CADF;AAOD,CAVM","sourceRoot":""}
1
+ {"version":3,"sources":["components/Badge/renderBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAAsB;EACxD,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAa,KAAb,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,YAAN,KAAuB,QAAvB,IAAmC,KAAK,CAAC,IAAzC,iBAAiD,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADpD,EAEG,KAAK,CAAC,IAAN,CAAW,QAFd,EAGG,KAAK,CAAC,YAAN,KAAuB,OAAvB,IAAkC,KAAK,CAAC,IAAxC,iBAAgD,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAHnD,CADF;AAOD,CAVM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { BadgeState, BadgeSlots } from './Badge.types';\n\nexport const renderBadge_unstable = (state: BadgeState) => {\n const { slots, slotProps } = getSlots<BadgeSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.iconPosition === 'before' && slots.icon && <slots.icon {...slotProps.icon} />}\n {state.root.children}\n {state.iconPosition === 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -23,7 +23,6 @@ export const useBadge_unstable = (props, ref) => {
23
23
  },
24
24
  root: getNativeElementProps('div', {
25
25
  ref,
26
- 'aria-hidden': true,
27
26
  ...props
28
27
  }),
29
28
  icon: resolveShorthand(props.icon)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Badge/useBadge.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAGA;;AAEG;;AACH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iC;MAEjC,GAAG;IAF8B,CAAR,CAVH;IAcxB,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAP;EAdE,CAA1B;EAiBA,OAAO,KAAP;AACD,CA3BM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { BadgeProps, BadgeState } from './Badge.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useBadge_unstable = (props: BadgeProps, ref: React.Ref<HTMLElement>): BadgeState => {\n const {\n shape = 'circular',\n size = 'medium',\n iconPosition = 'before',\n appearance = 'filled',\n color = 'brand',\n } = props;\n\n const state: BadgeState = {\n shape,\n size,\n iconPosition,\n appearance,\n color,\n components: {\n root: 'div',\n icon: 'span',\n },\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n icon: resolveShorthand(props.icon),\n };\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,9 @@
1
1
  import { shorthands, mergeClasses, __styles } from '@griffel/react';
2
2
  import { tokens } from '@fluentui/react-theme';
3
- export const badgeClassName = 'fui-Badge';
3
+ export const badgeClassNames = {
4
+ root: 'fui-Badge',
5
+ icon: 'fui-Badge__icon'
6
+ };
4
7
 
5
8
  const useRootStyles = /*#__PURE__*/__styles({
6
9
  "base": {
@@ -319,11 +322,11 @@ const useIconStyles = /*#__PURE__*/__styles({
319
322
 
320
323
  export const useBadgeStyles_unstable = state => {
321
324
  const rootStyles = useRootStyles();
322
- state.root.className = mergeClasses(badgeClassName, rootStyles.base, rootStyles[state.size], rootStyles[state.shape], state.shape === 'rounded' && (state.size === 'small' || state.size === 'extra-small' || state.size === 'tiny') && rootStyles.roundedSmallToTiny, rootStyles[state.appearance], rootStyles[`${state.appearance}-${state.color}`], state.root.className);
325
+ state.root.className = mergeClasses(badgeClassNames.root, rootStyles.base, rootStyles[state.size], rootStyles[state.shape], state.shape === 'rounded' && (state.size === 'small' || state.size === 'extra-small' || state.size === 'tiny') && rootStyles.roundedSmallToTiny, rootStyles[state.appearance], rootStyles[`${state.appearance}-${state.color}`], state.root.className);
323
326
  const iconStyles = useIconStyles();
324
327
 
325
328
  if (state.icon) {
326
- state.icon.className = mergeClasses(iconStyles.base, iconStyles[state.size], state.icon.className);
329
+ state.icon.className = mergeClasses(badgeClassNames.icon, iconStyles.base, iconStyles[state.size], state.icon.className);
327
330
  }
328
331
 
329
332
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Badge/useBadgeStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAGA,OAAO,MAAM,cAAc,GAAG,WAAvB;;AAEP,MAAM,aAAa,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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YAAY,CACjC,eAAe,CAAC,IADiB,EAEjC,UAAU,CAAC,IAFsB,EAGjC,UAAU,CAAC,KAAK,CAAC,IAAP,CAHuB,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;EAMD;;EAED,OAAO,KAAP;AACD,CA3BM","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { BadgeSlots, BadgeState } from './Badge.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const badgeClassNames: SlotClassNames<BadgeSlots> = {\n root: 'fui-Badge',\n icon: 'fui-Badge__icon',\n};\n\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n justifyContent: 'center',\n fontWeight: tokens.fontWeightSemibold,\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n ...shorthands.borderStyle('solid'),\n fontFamily: tokens.fontFamilyBase,\n position: 'relative',\n },\n\n // size\n\n tiny: {\n width: '6px',\n height: '6px',\n fontSize: '4px',\n },\n 'extra-small': {\n width: '10px',\n height: '10px',\n fontSize: '6px',\n },\n small: {\n minWidth: '16px',\n height: '16px',\n ...shorthands.padding('2px'),\n ...shorthands.gap('4px'),\n fontSize: '8px',\n },\n medium: {\n height: '20px',\n minWidth: '20px',\n ...shorthands.gap('4px'),\n ...shorthands.padding('4px'),\n fontSize: '10px',\n },\n large: {\n minWidth: '24px',\n height: '24px',\n ...shorthands.padding('4px'),\n fontSize: '12px',\n ...shorthands.gap('4px'),\n },\n 'extra-large': {\n minWidth: '32px',\n height: '32px',\n ...shorthands.padding('6px'),\n ...shorthands.gap('6px'),\n fontSize: '12px',\n ...shorthands.borderWidth(tokens.strokeWidthThick),\n },\n\n // shape\n\n square: {\n // Default border radius\n },\n rounded: {\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n roundedSmallToTiny: {\n ...shorthands.borderRadius(tokens.borderRadiusSmall),\n },\n circular: {\n ...shorthands.borderRadius('99px'),\n },\n\n // appearance: filled\n\n filled: {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n 'filled-brand': {\n backgroundColor: tokens.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand,\n ...shorthands.borderColor(tokens.colorBrandBackground),\n },\n 'filled-danger': {\n backgroundColor: tokens.colorPaletteRedBackground3,\n color: tokens.colorNeutralForegroundOnBrand,\n ...shorthands.borderColor(tokens.colorPaletteRedBackground3),\n },\n 'filled-important': {\n backgroundColor: tokens.colorNeutralForeground1,\n color: tokens.colorNeutralBackground1,\n },\n 'filled-informative': {\n backgroundColor: tokens.colorNeutralBackground5,\n color: tokens.colorNeutralForeground3,\n },\n 'filled-severe': {\n backgroundColor: tokens.colorPaletteDarkOrangeBackground3,\n color: tokens.colorNeutralForegroundOnBrand,\n },\n 'filled-subtle': {\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n },\n 'filled-success': {\n backgroundColor: tokens.colorPaletteGreenBackground3,\n color: tokens.colorNeutralForegroundOnBrand,\n },\n 'filled-warning': {\n backgroundColor: tokens.colorPaletteYellowBackground3,\n color: tokens.colorNeutralForeground1,\n ...shorthands.borderColor(tokens.colorPaletteYellowBackground3),\n },\n\n // appearance: ghost\n\n ghost: {\n ...shorthands.borderStyle('none'),\n },\n 'ghost-brand': {\n color: tokens.colorBrandBackground,\n },\n 'ghost-danger': {\n color: tokens.colorPaletteRedForeground3,\n },\n 'ghost-important': {\n color: tokens.colorNeutralForeground1,\n },\n 'ghost-informative': {\n color: tokens.colorNeutralForeground3,\n },\n 'ghost-severe': {\n color: tokens.colorPaletteDarkOrangeForeground3,\n },\n 'ghost-subtle': {\n color: tokens.colorNeutralForegroundInverted,\n },\n 'ghost-success': {\n color: tokens.colorPaletteGreenForeground3,\n },\n 'ghost-warning': {\n color: tokens.colorPaletteYellowForeground2,\n },\n\n // appearance: outline\n\n outline: {\n ...shorthands.borderColor('currentColor'),\n },\n 'outline-brand': {\n color: tokens.colorBrandBackground,\n },\n 'outline-danger': {\n color: tokens.colorPaletteRedForeground3,\n },\n 'outline-important': {\n color: tokens.colorNeutralForeground3,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n 'outline-informative': {\n color: tokens.colorNeutralForeground3,\n ...shorthands.borderColor(tokens.colorNeutralStroke2),\n },\n 'outline-severe': {\n color: tokens.colorPaletteDarkOrangeForeground3,\n },\n 'outline-subtle': {\n color: tokens.colorNeutralForegroundInverted,\n },\n 'outline-success': {\n color: tokens.colorPaletteGreenForeground2,\n },\n 'outline-warning': {\n color: tokens.colorPaletteYellowForeground2,\n },\n\n // appearance: tint\n\n tint: {\n // No shared colors between tint appearances\n },\n 'tint-brand': {\n backgroundColor: tokens.colorBrandBackground2,\n color: tokens.colorBrandForeground2,\n ...shorthands.borderColor(tokens.colorBrandStroke2),\n },\n 'tint-danger': {\n backgroundColor: tokens.colorPaletteRedBackground1,\n color: tokens.colorPaletteRedForeground1,\n ...shorthands.borderColor(tokens.colorPaletteRedBorder1),\n },\n 'tint-important': {\n backgroundColor: tokens.colorNeutralForeground3,\n color: tokens.colorNeutralBackground1,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n 'tint-informative': {\n backgroundColor: tokens.colorNeutralBackground4,\n color: tokens.colorNeutralForeground3,\n ...shorthands.borderColor(tokens.colorNeutralStroke2),\n },\n 'tint-severe': {\n backgroundColor: tokens.colorPaletteDarkOrangeBackground1,\n color: tokens.colorPaletteDarkOrangeForeground1,\n ...shorthands.borderColor(tokens.colorPaletteDarkOrangeForeground2),\n },\n 'tint-subtle': {\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground3,\n ...shorthands.borderColor(tokens.colorNeutralStroke2),\n },\n 'tint-success': {\n backgroundColor: tokens.colorPaletteGreenBackground1,\n color: tokens.colorPaletteGreenForeground1,\n ...shorthands.borderColor(tokens.colorPaletteGreenBackground2),\n },\n 'tint-warning': {\n backgroundColor: tokens.colorPaletteYellowBackground1,\n color: tokens.colorPaletteYellowForeground2,\n ...shorthands.borderColor(tokens.colorPaletteYellowBackground2),\n },\n});\n\nconst useIconStyles = makeStyles({\n base: {\n display: 'flex',\n alignContent: 'center',\n alignItems: 'center',\n height: '100%',\n },\n\n // size\n\n tiny: {\n fontSize: '6px',\n },\n 'extra-small': {\n fontSize: '10px',\n },\n small: {\n fontSize: '12px',\n },\n medium: {\n fontSize: '12px',\n },\n large: {\n fontSize: '16px',\n },\n 'extra-large': {\n fontSize: '20px',\n },\n});\n\n/**\n * Applies style classnames to slots\n */\nexport const useBadgeStyles_unstable = (state: BadgeState): BadgeState => {\n const rootStyles = useRootStyles();\n\n state.root.className = mergeClasses(\n badgeClassNames.root,\n rootStyles.base,\n rootStyles[state.size],\n rootStyles[state.shape],\n state.shape === 'rounded' &&\n (state.size === 'small' || state.size === 'extra-small' || state.size === 'tiny') &&\n rootStyles.roundedSmallToTiny,\n rootStyles[state.appearance],\n rootStyles[`${state.appearance}-${state.color}` as const],\n state.root.className,\n );\n\n const iconStyles = useIconStyles();\n if (state.icon) {\n state.icon.className = mergeClasses(\n badgeClassNames.icon,\n iconStyles.base,\n iconStyles[state.size],\n state.icon.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CounterBadge/CounterBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AACA,SAAS,8BAAT,QAA+C,yBAA/C;AACA,SAAS,oBAAT,QAAqC,gBAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,YAAY,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAClG,QAAM,KAAK,GAAG,wBAAwB,CAAC,KAAD,EAAQ,GAAR,CAAtC;AACA,EAAA,8BAA8B,CAAC,KAAD,CAA9B;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALmE,CAA7D;AAOP,YAAY,CAAC,WAAb,GAA2B,cAA3B","sourceRoot":""}
1
+ {"version":3,"sources":["components/CounterBadge/CounterBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AACA,SAAS,8BAAT,QAA+C,yBAA/C;AACA,SAAS,oBAAT,QAAqC,gBAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,YAAY,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAClG,MAAM,KAAK,GAAG,wBAAwB,CAAC,KAAD,EAAQ,GAAR,CAAtC;EACA,8BAA8B,CAAC,KAAD,CAA9B;EAEA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALmE,CAA7D;AAOP,YAAY,CAAC,WAAb,GAA2B,cAA3B","sourcesContent":["import * as React from 'react';\nimport { useCounterBadge_unstable } from './useCounterBadge';\nimport { useCounterBadgeStyles_unstable } from './useCounterBadgeStyles';\nimport { renderBadge_unstable } from '../Badge/index';\nimport type { CounterBadgeProps } from './CounterBadge.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled CounterBadge, using the `useCounterBadge_unstable` hook.\n */\nexport const CounterBadge: ForwardRefComponent<CounterBadgeProps> = React.forwardRef((props, ref) => {\n const state = useCounterBadge_unstable(props, ref);\n useCounterBadgeStyles_unstable(state);\n\n return renderBadge_unstable(state);\n});\n\nCounterBadge.displayName = 'CounterBadge';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"CounterBadge.types.js","sourceRoot":"","sources":["../../../src/components/CounterBadge/CounterBadge.types.ts"],"names":[],"mappings":""}
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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CounterBadge/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/CounterBadge/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './CounterBadge';\nexport * from './CounterBadge.types';\nexport * from './useCounterBadge';\nexport * from './useCounterBadgeStyles';\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":["../../../src/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","sourceRoot":""}
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;EACnH,MAAM;IACJ,KAAK,GAAG,UADJ;IAEJ,UAAU,GAAG,QAFT;IAGJ,QAAQ,GAAG,KAHP;IAIJ,aAAa,GAAG,EAJZ;IAKJ,KAAK,GAAG,CALJ;IAMJ,GAAG,GAAG;EANF,IAOF,KAPJ;EASA,MAAM,KAAK,GAAsB,EAC/B,GAAI,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CADU;IAE/B,KAF+B;IAG/B,UAH+B;IAI/B,QAJ+B;IAK/B,KAL+B;IAM/B;EAN+B,CAAjC;;EASA,IAAI,CAAC,KAAK,CAAC,GAAP,IAAc,CAAC,KAAK,CAAC,IAAN,CAAW,QAA9B,EAAwC;IACtC,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,KAAK,CAAC,KAAN,GAAc,aAAd,GAA8B,GAAG,aAAa,GAA9C,GAAoD,GAAG,KAAK,CAAC,KAAK,EAAxF;EACD;;EAED,OAAO,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,6 +1,9 @@
1
1
  import { shorthands, mergeClasses, __styles } from '@griffel/react';
2
2
  import { useBadgeStyles_unstable } from '../Badge/useBadgeStyles';
3
- export const counterBadgeClassName = 'fui-CounterBadge';
3
+ export const counterBadgeClassNames = {
4
+ root: 'fui-CounterBadge',
5
+ icon: 'fui-CounterBadge__icon'
6
+ };
4
7
 
5
8
  const useStyles = /*#__PURE__*/__styles({
6
9
  "dot": {
@@ -25,7 +28,12 @@ const useStyles = /*#__PURE__*/__styles({
25
28
 
26
29
  export const useCounterBadgeStyles_unstable = state => {
27
30
  const styles = useStyles();
28
- state.root.className = mergeClasses(counterBadgeClassName, state.dot && styles.dot, !state.showZero && state.count === 0 && !state.dot && styles.hide, state.root.className);
31
+ state.root.className = mergeClasses(counterBadgeClassNames.root, state.dot && styles.dot, !state.showZero && state.count === 0 && !state.dot && styles.hide, state.root.className);
32
+
33
+ if (state.icon) {
34
+ state.icon.className = mergeClasses(counterBadgeClassNames.icon, state.icon.className);
35
+ }
36
+
29
37
  return useBadgeStyles_unstable(state);
30
38
  };
31
39
  //# sourceMappingURL=useCounterBadgeStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CounterBadge/useCounterBadgeStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AAGA,OAAO,MAAM,qBAAqB,GAAG,kBAA9B;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAYA;;AAEG;;;AACH,OAAO,MAAM,8BAA8B,GAAI,KAAD,IAAgD;AAC5F,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,qBADiC,EAEjC,KAAK,CAAC,GAAN,IAAa,MAAM,CAAC,GAFa,EAGjC,CAAC,KAAK,CAAC,QAAP,IAAmB,KAAK,CAAC,KAAN,KAAgB,CAAnC,IAAwC,CAAC,KAAK,CAAC,GAA/C,IAAsD,MAAM,CAAC,IAH5B,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;AAMA,SAAO,uBAAuB,CAAC,KAAD,CAA9B;AACD,CATM","sourceRoot":""}
1
+ {"version":3,"sources":["components/CounterBadge/useCounterBadgeStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AAKA,OAAO,MAAM,sBAAsB,GAA+B;EAChE,IAAI,EAAE,kBAD0D;EAEhE,IAAI,EAAE;AAF0D,CAA3D;;AAKP,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAYA;;AAEG;;;AACH,OAAO,MAAM,8BAA8B,GAAI,KAAD,IAAgD;EAC5F,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,sBAAsB,CAAC,IADU,EAEjC,KAAK,CAAC,GAAN,IAAa,MAAM,CAAC,GAFa,EAGjC,CAAC,KAAK,CAAC,QAAP,IAAmB,KAAK,CAAC,KAAN,KAAgB,CAAnC,IAAwC,CAAC,KAAK,CAAC,GAA/C,IAAsD,MAAM,CAAC,IAH5B,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;;EAOA,IAAI,KAAK,CAAC,IAAV,EAAgB;IACd,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,sBAAsB,CAAC,IAAxB,EAA8B,KAAK,CAAC,IAAN,CAAW,SAAzC,CAAnC;EACD;;EAED,OAAO,uBAAuB,CAAC,KAAD,CAA9B;AACD,CAdM","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useBadgeStyles_unstable } from '../Badge/useBadgeStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { BadgeSlots } from '../Badge/Badge.types';\nimport type { CounterBadgeState } from './CounterBadge.types';\n\nexport const counterBadgeClassNames: SlotClassNames<BadgeSlots> = {\n root: 'fui-CounterBadge',\n icon: 'fui-CounterBadge__icon',\n};\n\nconst useStyles = makeStyles({\n dot: {\n minWidth: 'auto',\n width: '6px',\n height: '6px',\n ...shorthands.padding('0'),\n },\n hide: {\n display: 'none',\n },\n});\n\n/**\n * Applies style classnames to slots\n */\nexport const useCounterBadgeStyles_unstable = (state: CounterBadgeState): CounterBadgeState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n counterBadgeClassNames.root,\n state.dot && styles.dot,\n !state.showZero && state.count === 0 && !state.dot && styles.hide,\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(counterBadgeClassNames.icon, state.icon.className);\n }\n\n return useBadgeStyles_unstable(state) as CounterBadgeState;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PresenceBadge/PresenceBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AACA,SAAS,+BAAT,QAAgD,0BAAhD;AACA,SAAS,oBAAT,QAAqC,aAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpG,QAAM,KAAK,GAAG,yBAAyB,CAAC,KAAD,EAAQ,GAAR,CAAvC;AACA,EAAA,+BAA+B,CAAC,KAAD,CAA/B;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALqE,CAA/D;AAOP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourceRoot":""}
1
+ {"version":3,"sources":["components/PresenceBadge/PresenceBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AACA,SAAS,+BAAT,QAAgD,0BAAhD;AACA,SAAS,oBAAT,QAAqC,aAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,yBAAyB,CAAC,KAAD,EAAQ,GAAR,CAAvC;EACA,+BAA+B,CAAC,KAAD,CAA/B;EAEA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALqE,CAA/D;AAOP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { usePresenceBadge_unstable } from './usePresenceBadge';\nimport { usePresenceBadgeStyles_unstable } from './usePresenceBadgeStyles';\nimport { renderBadge_unstable } from '../../Badge';\nimport type { PresenceBadgeProps } from './PresenceBadge.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled Badge, using the `useBadge_unstable` hook.\n */\nexport const PresenceBadge: ForwardRefComponent<PresenceBadgeProps> = React.forwardRef((props, ref) => {\n const state = usePresenceBadge_unstable(props, ref);\n usePresenceBadgeStyles_unstable(state);\n\n return renderBadge_unstable(state);\n});\n\nPresenceBadge.displayName = 'PresenceBadge';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"PresenceBadge.types.js","sourceRoot":"","sources":["../../../src/components/PresenceBadge/PresenceBadge.types.ts"],"names":[],"mappings":""}
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 | 'out-of-office'\n | 'away'\n | 'available'\n | 'offline'\n | 'do-not-disturb'\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PresenceBadge/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PresenceBadge/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './PresenceBadge';\nexport * from './PresenceBadge.types';\nexport * from './usePresenceBadge';\nexport * from './usePresenceBadgeStyles';\n"]}