@fluentui/react-badge 9.0.0-rc.9 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +170 -1
- package/CHANGELOG.md +63 -2
- package/MIGRATION.md +59 -0
- package/README.md +40 -2
- package/Spec.md +11 -74
- package/dist/index.d.ts +3 -16
- package/lib/components/Badge/Badge.js.map +1 -1
- package/lib/components/Badge/renderBadge.js.map +1 -1
- package/lib/components/Badge/useBadge.js +0 -1
- package/lib/components/Badge/useBadge.js.map +1 -1
- package/lib/components/Badge/useBadgeStyles.js +0 -5
- package/lib/components/Badge/useBadgeStyles.js.map +1 -1
- package/lib/components/CounterBadge/CounterBadge.js.map +1 -1
- package/lib/components/CounterBadge/useCounterBadge.js.map +1 -1
- package/lib/components/CounterBadge/useCounterBadgeStyles.js +0 -5
- package/lib/components/CounterBadge/useCounterBadgeStyles.js.map +1 -1
- package/lib/components/PresenceBadge/PresenceBadge.js.map +1 -1
- package/lib/components/PresenceBadge/PresenceBadge.types.js.map +1 -1
- package/lib/components/PresenceBadge/presenceIcons.js.map +1 -1
- package/lib/components/PresenceBadge/usePresenceBadge.js +12 -11
- package/lib/components/PresenceBadge/usePresenceBadge.js.map +1 -1
- package/lib/components/PresenceBadge/usePresenceBadgeStyles.js +10 -6
- package/lib/components/PresenceBadge/usePresenceBadgeStyles.js.map +1 -1
- package/lib/index.js +3 -6
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Badge/Badge.js.map +1 -1
- package/lib-commonjs/components/Badge/renderBadge.js.map +1 -1
- package/lib-commonjs/components/Badge/useBadge.js +0 -1
- package/lib-commonjs/components/Badge/useBadge.js.map +1 -1
- package/lib-commonjs/components/Badge/useBadgeStyles.js +1 -6
- package/lib-commonjs/components/Badge/useBadgeStyles.js.map +1 -1
- package/lib-commonjs/components/CounterBadge/CounterBadge.js.map +1 -1
- package/lib-commonjs/components/CounterBadge/useCounterBadge.js.map +1 -1
- package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.js +1 -6
- package/lib-commonjs/components/CounterBadge/useCounterBadgeStyles.js.map +1 -1
- package/lib-commonjs/components/PresenceBadge/PresenceBadge.js.map +1 -1
- package/lib-commonjs/components/PresenceBadge/presenceIcons.js.map +1 -1
- package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js +12 -11
- package/lib-commonjs/components/PresenceBadge/usePresenceBadge.js.map +1 -1
- package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.js +11 -7
- package/lib-commonjs/components/PresenceBadge/usePresenceBadgeStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -22
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -9
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,176 @@
|
|
2
2
|
"name": "@fluentui/react-badge",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 28 Jun 2022 15:09:31 GMT",
|
6
|
+
"tag": "@fluentui/react-badge_v9.0.0",
|
7
|
+
"version": "9.0.0",
|
8
|
+
"comments": {
|
9
|
+
"none": [
|
10
|
+
{
|
11
|
+
"author": "gcox@microsoft.com",
|
12
|
+
"package": "@fluentui/react-badge",
|
13
|
+
"commit": "328f900d4308598b83cbf1fde4f83ea74024d620",
|
14
|
+
"comment": "docs: Updated badge descriptions to be specific."
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "mgodbolt@microsoft.com",
|
18
|
+
"package": "@fluentui/react-badge",
|
19
|
+
"commit": "1822a0c64a0106f41b2c8e6c3b00804f1c78d72a",
|
20
|
+
"comment": "chore: Change story entry point to index.stories.tsx"
|
21
|
+
}
|
22
|
+
],
|
23
|
+
"patch": [
|
24
|
+
{
|
25
|
+
"author": "lingfangao@hotmail.com",
|
26
|
+
"package": "@fluentui/react-badge",
|
27
|
+
"commit": "c7b1348bdad7aa883c29bfbc96ef2a32e6ebc7dd",
|
28
|
+
"comment": "feat: Initial 9.0.0 release"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"author": "beachball",
|
32
|
+
"package": "@fluentui/react-badge",
|
33
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0",
|
34
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"author": "beachball",
|
38
|
+
"package": "@fluentui/react-badge",
|
39
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0",
|
40
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"author": "beachball",
|
44
|
+
"package": "@fluentui/react-badge",
|
45
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.9",
|
46
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
47
|
+
}
|
48
|
+
],
|
49
|
+
"prerelease": [
|
50
|
+
{
|
51
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
52
|
+
"package": "@fluentui/react-badge",
|
53
|
+
"commit": "bd64779b7d68775260b587f10265d64b916f6140",
|
54
|
+
"comment": "README, spec and migration guide cleanup."
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"author": "lingfangao@hotmail.com",
|
58
|
+
"package": "@fluentui/react-badge",
|
59
|
+
"commit": "675acea49c97f10837ddee9b8c4350ca27750125",
|
60
|
+
"comment": "Bump Griffel dependencies"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"author": "lingfangao@hotmail.com",
|
64
|
+
"package": "@fluentui/react-badge",
|
65
|
+
"commit": "e0aabd850b15adf9c151ebd4e332f7c50ad6cfdf",
|
66
|
+
"comment": "Update 9.0.0-rc dependencies to use caret range"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"author": "sarah.higley@microsoft.com",
|
70
|
+
"package": "@fluentui/react-badge",
|
71
|
+
"commit": "ba2c12557fea137cf744c65c296c0d50c06ed5ce",
|
72
|
+
"comment": "PresenceBadge accessibility: fix placement of aria-label, sort out Avatar usage and examples"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"author": "olfedias@microsoft.com",
|
76
|
+
"package": "@fluentui/react-badge",
|
77
|
+
"commit": "82bd30dd41ad58df1f325e9b721200ed15d674a2",
|
78
|
+
"comment": "chore: Update @fluentui/react-icons to latest version"
|
79
|
+
}
|
80
|
+
]
|
81
|
+
}
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"date": "Thu, 23 Jun 2022 14:25:31 GMT",
|
85
|
+
"tag": "@fluentui/react-badge_v9.0.0-rc.13",
|
86
|
+
"version": "9.0.0-rc.13",
|
87
|
+
"comments": {
|
88
|
+
"prerelease": [
|
89
|
+
{
|
90
|
+
"author": "beachball",
|
91
|
+
"package": "@fluentui/react-badge",
|
92
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.10",
|
93
|
+
"commit": "b00790b7a0ea1473d8c3cc49c7ca0088002957ed"
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"date": "Tue, 31 May 2022 21:28:36 GMT",
|
100
|
+
"tag": "@fluentui/react-badge_v9.0.0-rc.12",
|
101
|
+
"version": "9.0.0-rc.12",
|
102
|
+
"comments": {
|
103
|
+
"prerelease": [
|
104
|
+
{
|
105
|
+
"author": "olfedias@microsoft.com",
|
106
|
+
"package": "@fluentui/react-badge",
|
107
|
+
"commit": "0a5e9fa77a72eecafdd07034ccdc0b95fd49877c",
|
108
|
+
"comment": "chore: Update Griffel to latest version"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"author": "beachball",
|
112
|
+
"package": "@fluentui/react-badge",
|
113
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.10",
|
114
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"author": "beachball",
|
118
|
+
"package": "@fluentui/react-badge",
|
119
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.8",
|
120
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
121
|
+
}
|
122
|
+
]
|
123
|
+
}
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"date": "Thu, 26 May 2022 21:01:22 GMT",
|
127
|
+
"tag": "@fluentui/react-badge_v9.0.0-rc.11",
|
128
|
+
"version": "9.0.0-rc.11",
|
129
|
+
"comments": {
|
130
|
+
"prerelease": [
|
131
|
+
{
|
132
|
+
"author": "mgodbolt@microsoft.com",
|
133
|
+
"package": "@fluentui/react-badge",
|
134
|
+
"commit": "7c773e3f3f4a8991fee6af46277504378dbdf197",
|
135
|
+
"comment": "remove aria-hidden from badge"
|
136
|
+
}
|
137
|
+
]
|
138
|
+
}
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"date": "Mon, 23 May 2022 18:56:41 GMT",
|
142
|
+
"tag": "@fluentui/react-badge_v9.0.0-rc.10",
|
143
|
+
"version": "9.0.0-rc.10",
|
144
|
+
"comments": {
|
145
|
+
"prerelease": [
|
146
|
+
{
|
147
|
+
"author": "esteban.230@hotmail.com",
|
148
|
+
"package": "@fluentui/react-badge",
|
149
|
+
"commit": "5ed22515a7542b432ed694f22606ac3718d501cb",
|
150
|
+
"comment": "Removing <componentName>ClassName exports."
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"author": "seanmonahan@microsoft.com",
|
154
|
+
"package": "@fluentui/react-badge",
|
155
|
+
"commit": "5ed22515a7542b432ed694f22606ac3718d501cb",
|
156
|
+
"comment": "BREAKING: update string unions to use spinal-case"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"author": "beachball",
|
160
|
+
"package": "@fluentui/react-badge",
|
161
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.9",
|
162
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"author": "beachball",
|
166
|
+
"package": "@fluentui/react-badge",
|
167
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7",
|
168
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
169
|
+
}
|
170
|
+
]
|
171
|
+
}
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"date": "Mon, 23 May 2022 12:14:01 GMT",
|
6
175
|
"tag": "@fluentui/react-badge_v9.0.0-rc.9",
|
7
176
|
"version": "9.0.0-rc.9",
|
8
177
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,73 @@
|
|
1
1
|
# Change Log - @fluentui/react-badge
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 28 Jun 2022 15:09:31 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.0.0)
|
8
|
+
|
9
|
+
Tue, 28 Jun 2022 15:09:31 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.0.0-rc.13..@fluentui/react-badge_v9.0.0)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- feat: Initial 9.0.0 release ([PR #23733](https://github.com/microsoft/fluentui/pull/23733) by lingfangao@hotmail.com)
|
15
|
+
- Bump @fluentui/react-theme to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
16
|
+
- Bump @fluentui/react-utilities to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
17
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.9 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
18
|
+
|
19
|
+
### Changes
|
20
|
+
|
21
|
+
- README, spec and migration guide cleanup. ([PR #23424](https://github.com/microsoft/fluentui/pull/23424) by Humberto.Morimoto@microsoft.com)
|
22
|
+
- Bump Griffel dependencies ([PR #23688](https://github.com/microsoft/fluentui/pull/23688) by lingfangao@hotmail.com)
|
23
|
+
- Update 9.0.0-rc dependencies to use caret range ([PR #23732](https://github.com/microsoft/fluentui/pull/23732) by lingfangao@hotmail.com)
|
24
|
+
- PresenceBadge accessibility: fix placement of aria-label, sort out Avatar usage and examples ([PR #23256](https://github.com/microsoft/fluentui/pull/23256) by sarah.higley@microsoft.com)
|
25
|
+
- chore: Update @fluentui/react-icons to latest version ([PR #23459](https://github.com/microsoft/fluentui/pull/23459) by olfedias@microsoft.com)
|
26
|
+
|
27
|
+
## [9.0.0-rc.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.0.0-rc.13)
|
28
|
+
|
29
|
+
Thu, 23 Jun 2022 14:25:31 GMT
|
30
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.0.0-rc.12..@fluentui/react-badge_v9.0.0-rc.13)
|
31
|
+
|
32
|
+
### Changes
|
33
|
+
|
34
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.10 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
|
35
|
+
|
36
|
+
## [9.0.0-rc.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.0.0-rc.12)
|
37
|
+
|
38
|
+
Tue, 31 May 2022 21:28:36 GMT
|
39
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.0.0-rc.11..@fluentui/react-badge_v9.0.0-rc.12)
|
40
|
+
|
41
|
+
### Changes
|
42
|
+
|
43
|
+
- chore: Update Griffel to latest version ([PR #23275](https://github.com/microsoft/fluentui/pull/23275) by olfedias@microsoft.com)
|
44
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
45
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.8 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
46
|
+
|
47
|
+
## [9.0.0-rc.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.0.0-rc.11)
|
48
|
+
|
49
|
+
Thu, 26 May 2022 21:01:22 GMT
|
50
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.0.0-rc.10..@fluentui/react-badge_v9.0.0-rc.11)
|
51
|
+
|
52
|
+
### Changes
|
53
|
+
|
54
|
+
- remove aria-hidden from badge ([PR #22858](https://github.com/microsoft/fluentui/pull/22858) by mgodbolt@microsoft.com)
|
55
|
+
|
56
|
+
## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.0.0-rc.10)
|
57
|
+
|
58
|
+
Mon, 23 May 2022 18:56:41 GMT
|
59
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.0.0-rc.9..@fluentui/react-badge_v9.0.0-rc.10)
|
60
|
+
|
61
|
+
### Changes
|
62
|
+
|
63
|
+
- Removing <componentName>ClassName exports. ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by esteban.230@hotmail.com)
|
64
|
+
- BREAKING: update string unions to use spinal-case ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by seanmonahan@microsoft.com)
|
65
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
66
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
67
|
+
|
7
68
|
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.0.0-rc.9)
|
8
69
|
|
9
|
-
Mon, 23 May 2022 12:
|
70
|
+
Mon, 23 May 2022 12:14:01 GMT
|
10
71
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.0.0-rc.8..@fluentui/react-badge_v9.0.0-rc.9)
|
11
72
|
|
12
73
|
### Changes
|
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
|
-
**
|
3
|
+
**Badge components for [Fluent UI](https://aka.ms/fluentui-storybook)**
|
4
4
|
|
5
|
-
|
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
|
28
|
+
- Styles: `filled`, `outline`, `ghost`, `tint`
|
29
29
|
|
30
|
-
##
|
30
|
+
## API
|
31
31
|
|
32
|
-
|
33
|
-
type BadgeAppearance = 'filled' | 'outline' | 'ghost' | 'tint';
|
32
|
+
### Props
|
34
33
|
|
35
|
-
|
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
|
-
|
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
|
-
|
122
|
-
|
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
|
-
|
156
|
-
|
157
|
-
|
92
|
+
#### Props
|
93
|
+
|
94
|
+
See API at [CounterBadge.types.ts](./src/components/CounterBadge/CounterBadge.types.ts).
|
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
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';
|
@@ -10,11 +12,6 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
10
12
|
*/
|
11
13
|
export declare const Badge: ForwardRefComponent<BadgeProps>;
|
12
14
|
|
13
|
-
/**
|
14
|
-
* @deprecated Use `badgeClassNames.root` instead.
|
15
|
-
*/
|
16
|
-
export declare const badgeClassName = "fui-Badge";
|
17
|
-
|
18
15
|
export declare const badgeClassNames: SlotClassNames<BadgeSlots>;
|
19
16
|
|
20
17
|
export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & {
|
@@ -57,11 +54,6 @@ export declare type BadgeState = ComponentState<BadgeSlots> & Required<Pick<Badg
|
|
57
54
|
*/
|
58
55
|
export declare const CounterBadge: ForwardRefComponent<CounterBadgeProps>;
|
59
56
|
|
60
|
-
/**
|
61
|
-
* @deprecated Use `counterBadgeClassNames.root` instead.
|
62
|
-
*/
|
63
|
-
export declare const counterBadgeClassName = "fui-CounterBadge";
|
64
|
-
|
65
57
|
export declare const counterBadgeClassNames: SlotClassNames<BadgeSlots>;
|
66
58
|
|
67
59
|
export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'color' | 'shape'> & {
|
@@ -112,11 +104,6 @@ export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'color'
|
|
112
104
|
*/
|
113
105
|
export declare const PresenceBadge: ForwardRefComponent<PresenceBadgeProps>;
|
114
106
|
|
115
|
-
/**
|
116
|
-
* @deprecated Use `presenceBadgeClassNames.root` instead.
|
117
|
-
*/
|
118
|
-
export declare const presenceBadgeClassName = "fui-PresenceBadge";
|
119
|
-
|
120
107
|
export declare const presenceBadgeClassNames: SlotClassNames<BadgeSlots>;
|
121
108
|
|
122
109
|
export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root' | 'icon'>>, 'color'> & Pick<BadgeProps, 'size'> & {
|
@@ -135,7 +122,7 @@ export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'r
|
|
135
122
|
|
136
123
|
export declare type PresenceBadgeState = ComponentState<BadgeSlots> & BadgeState & Required<Pick<PresenceBadgeProps, 'status' | 'outOfOffice'>>;
|
137
124
|
|
138
|
-
export declare type PresenceBadgeStatus = 'busy' | '
|
125
|
+
export declare type PresenceBadgeStatus = 'busy' | 'out-of-office' | 'away' | 'available' | 'offline' | 'do-not-disturb' | 'unknown';
|
139
126
|
|
140
127
|
export declare const renderBadge_unstable: (state: BadgeState) => JSX.Element;
|
141
128
|
|
@@ -1 +1 @@
|
|
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;
|
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,"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;
|
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/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Badge/useBadge.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAGA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAA+D;
|
1
|
+
{"version":3,"sources":["components/Badge/useBadge.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAGA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAA+D;EAC9F,MAAM;IACJ,KAAK,GAAG,UADJ;IAEJ,IAAI,GAAG,QAFH;IAGJ,YAAY,GAAG,QAHX;IAIJ,UAAU,GAAG,QAJT;IAKJ,KAAK,GAAG;EALJ,IAMF,KANJ;EAQA,MAAM,KAAK,GAAe;IACxB,KADwB;IAExB,IAFwB;IAGxB,YAHwB;IAIxB,UAJwB;IAKxB,KALwB;IAMxB,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,IAAI,EAAE;IAFI,CANY;IAUxB,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;MACjC,GADiC;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,10 +1,5 @@
|
|
1
1
|
import { shorthands, mergeClasses, __styles } from '@griffel/react';
|
2
2
|
import { tokens } from '@fluentui/react-theme';
|
3
|
-
/**
|
4
|
-
* @deprecated Use `badgeClassNames.root` instead.
|
5
|
-
*/
|
6
|
-
|
7
|
-
export const badgeClassName = 'fui-Badge';
|
8
3
|
export const badgeClassNames = {
|
9
4
|
root: 'fui-Badge',
|
10
5
|
icon: 'fui-Badge__icon'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Badge/useBadgeStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAAG,WAAvB;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,UAAU,CAAC,kBAPoB,EAQjC,UAAU,CAAC,KAAK,CAAC,UAAP,CARuB,EASjC,UAAU,CAAC,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,KAAK,EAAnC,CATuB,EAUjC,KAAK,CAAC,IAAN,CAAW,SAVsB,CAAnC;AAaA,QAAM,UAAU,GAAG,aAAa,EAAhC;;AACA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,eAAe,CAAC,IADiB,EAEjC,UAAU,CAAC,IAFsB,EAGjC,UAAU,CAAC,KAAK,CAAC,IAAP,CAHuB,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;AAMD;;AAED,SAAO,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\n/**\n * @deprecated Use `badgeClassNames.root` instead.\n */\nexport const badgeClassName = 'fui-Badge';\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
|
+
{"version":3,"sources":["components/Badge/useBadgeStyles.ts"],"names":[],"mappings":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,IAAN,KAAe,aAAzC,IAA0D,KAAK,CAAC,IAAN,KAAe,MAD5E,KAEE,UAAU,CAAC,kBAPoB,EAQjC,UAAU,CAAC,KAAK,CAAC,UAAP,CARuB,EASjC,UAAU,CAAC,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,KAAK,EAAnC,CATuB,EAUjC,KAAK,CAAC,IAAN,CAAW,SAVsB,CAAnC;EAaA,MAAM,UAAU,GAAG,aAAa,EAAhC;;EACA,IAAI,KAAK,CAAC,IAAV,EAAgB;IACd,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,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":["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;
|
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/"}
|