@fluentui/react-rating 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +172 -0
- package/LICENSE +15 -0
- package/README.md +38 -0
- package/dist/index.d.ts +291 -0
- package/lib/Rating.js +1 -0
- package/lib/Rating.js.map +1 -0
- package/lib/RatingDisplay.js +1 -0
- package/lib/RatingDisplay.js.map +1 -0
- package/lib/RatingItem.js +1 -0
- package/lib/RatingItem.js.map +1 -0
- package/lib/components/Rating/Rating.js +14 -0
- package/lib/components/Rating/Rating.js.map +1 -0
- package/lib/components/Rating/Rating.types.js +1 -0
- package/lib/components/Rating/Rating.types.js.map +1 -0
- package/lib/components/Rating/index.js +6 -0
- package/lib/components/Rating/index.js.map +1 -0
- package/lib/components/Rating/renderRating.js +12 -0
- package/lib/components/Rating/renderRating.js.map +1 -0
- package/lib/components/Rating/useRating.js +82 -0
- package/lib/components/Rating/useRating.js.map +1 -0
- package/lib/components/Rating/useRatingContextValues.js +29 -0
- package/lib/components/Rating/useRatingContextValues.js.map +1 -0
- package/lib/components/Rating/useRatingStyles.styles.js +17 -0
- package/lib/components/Rating/useRatingStyles.styles.js.map +1 -0
- package/lib/components/RatingDisplay/RatingDisplay.js +15 -0
- package/lib/components/RatingDisplay/RatingDisplay.js.map +1 -0
- package/lib/components/RatingDisplay/RatingDisplay.types.js +1 -0
- package/lib/components/RatingDisplay/RatingDisplay.types.js.map +1 -0
- package/lib/components/RatingDisplay/index.js +6 -0
- package/lib/components/RatingDisplay/index.js.map +1 -0
- package/lib/components/RatingDisplay/renderRatingDisplay.js +18 -0
- package/lib/components/RatingDisplay/renderRatingDisplay.js.map +1 -0
- package/lib/components/RatingDisplay/useRatingDisplay.js +79 -0
- package/lib/components/RatingDisplay/useRatingDisplay.js.map +1 -0
- package/lib/components/RatingDisplay/useRatingDisplayContextValues.js +23 -0
- package/lib/components/RatingDisplay/useRatingDisplayContextValues.js.map +1 -0
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.js +50 -0
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +1 -0
- package/lib/components/RatingItem/RatingItem.js +12 -0
- package/lib/components/RatingItem/RatingItem.js.map +1 -0
- package/lib/components/RatingItem/RatingItem.types.js +1 -0
- package/lib/components/RatingItem/RatingItem.types.js.map +1 -0
- package/lib/components/RatingItem/index.js +5 -0
- package/lib/components/RatingItem/index.js.map +1 -0
- package/lib/components/RatingItem/renderRatingItem.js +15 -0
- package/lib/components/RatingItem/renderRatingItem.js.map +1 -0
- package/lib/components/RatingItem/useRatingItem.js +111 -0
- package/lib/components/RatingItem/useRatingItem.js.map +1 -0
- package/lib/components/RatingItem/useRatingItemStyles.styles.js +163 -0
- package/lib/components/RatingItem/useRatingItemStyles.styles.js.map +1 -0
- package/lib/contexts/RatingItemContext.js +16 -0
- package/lib/contexts/RatingItemContext.js.map +1 -0
- package/lib/contexts/index.js +1 -0
- package/lib/contexts/index.js.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -0
- package/lib-commonjs/Rating.js +6 -0
- package/lib-commonjs/Rating.js.map +1 -0
- package/lib-commonjs/RatingDisplay.js +6 -0
- package/lib-commonjs/RatingDisplay.js.map +1 -0
- package/lib-commonjs/RatingItem.js +6 -0
- package/lib-commonjs/RatingItem.js.map +1 -0
- package/lib-commonjs/components/Rating/Rating.js +23 -0
- package/lib-commonjs/components/Rating/Rating.js.map +1 -0
- package/lib-commonjs/components/Rating/Rating.types.js +6 -0
- package/lib-commonjs/components/Rating/Rating.types.js.map +1 -0
- package/lib-commonjs/components/Rating/index.js +11 -0
- package/lib-commonjs/components/Rating/index.js.map +1 -0
- package/lib-commonjs/components/Rating/renderRating.js +20 -0
- package/lib-commonjs/components/Rating/renderRating.js.map +1 -0
- package/lib-commonjs/components/Rating/useRating.js +85 -0
- package/lib-commonjs/components/Rating/useRating.js.map +1 -0
- package/lib-commonjs/components/Rating/useRatingContextValues.js +40 -0
- package/lib-commonjs/components/Rating/useRatingContextValues.js.map +1 -0
- package/lib-commonjs/components/Rating/useRatingStyles.styles.js +32 -0
- package/lib-commonjs/components/Rating/useRatingStyles.styles.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/RatingDisplay.js +23 -0
- package/lib-commonjs/components/RatingDisplay/RatingDisplay.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/RatingDisplay.types.js +6 -0
- package/lib-commonjs/components/RatingDisplay/RatingDisplay.types.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/index.js +11 -0
- package/lib-commonjs/components/RatingDisplay/index.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/renderRatingDisplay.js +26 -0
- package/lib-commonjs/components/RatingDisplay/renderRatingDisplay.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/useRatingDisplay.js +82 -0
- package/lib-commonjs/components/RatingDisplay/useRatingDisplay.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayContextValues.js +34 -0
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayContextValues.js.map +1 -0
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.js +72 -0
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +1 -0
- package/lib-commonjs/components/RatingItem/RatingItem.js +21 -0
- package/lib-commonjs/components/RatingItem/RatingItem.js.map +1 -0
- package/lib-commonjs/components/RatingItem/RatingItem.types.js +4 -0
- package/lib-commonjs/components/RatingItem/RatingItem.types.js.map +1 -0
- package/lib-commonjs/components/RatingItem/index.js +10 -0
- package/lib-commonjs/components/RatingItem/index.js.map +1 -0
- package/lib-commonjs/components/RatingItem/renderRatingItem.js +23 -0
- package/lib-commonjs/components/RatingItem/renderRatingItem.js.map +1 -0
- package/lib-commonjs/components/RatingItem/useRatingItem.js +114 -0
- package/lib-commonjs/components/RatingItem/useRatingItem.js.map +1 -0
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.js +323 -0
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.js.map +1 -0
- package/lib-commonjs/contexts/RatingItemContext.js +34 -0
- package/lib-commonjs/contexts/RatingItemContext.js.map +1 -0
- package/lib-commonjs/contexts/index.js +6 -0
- package/lib-commonjs/contexts/index.js.map +1 -0
- package/lib-commonjs/index.js +73 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Change Log - @fluentui/react-rating
|
|
2
|
+
|
|
3
|
+
This log was last generated on Fri, 15 Mar 2024 21:37:57 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating_v9.0.0)
|
|
8
|
+
|
|
9
|
+
Fri, 15 Mar 2024 21:37:57 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.4.0..@fluentui/react-rating_v9.0.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- 'feat: Release Rating to stable. ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by ololubek@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.33 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
16
|
+
- Bump @fluentui/react-theme to v9.1.18 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
17
|
+
- Bump @fluentui/react-tabster to v9.19.4 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
18
|
+
- Bump @fluentui/react-utilities to v9.18.4 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
19
|
+
|
|
20
|
+
## [0.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.4.0)
|
|
21
|
+
|
|
22
|
+
Thu, 07 Mar 2024 19:33:24 GMT
|
|
23
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.3.2..@fluentui/react-rating-preview_v0.4.0)
|
|
24
|
+
|
|
25
|
+
### Minor changes
|
|
26
|
+
|
|
27
|
+
- breaking: Update icon api type to ElementType ([PR #30666](https://github.com/microsoft/fluentui/pull/30666) by ololubek@microsoft.com)
|
|
28
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.32 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
29
|
+
- Bump @fluentui/react-theme to v9.1.17 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
30
|
+
- Bump @fluentui/react-tabster to v9.19.3 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
31
|
+
- Bump @fluentui/react-utilities to v9.18.3 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
32
|
+
|
|
33
|
+
### Patches
|
|
34
|
+
|
|
35
|
+
- chore: Update jsdocs and stories in Rating ([PR #30653](https://github.com/microsoft/fluentui/pull/30653) by ololubek@microsoft.com)
|
|
36
|
+
|
|
37
|
+
## [0.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.3.2)
|
|
38
|
+
|
|
39
|
+
Wed, 28 Feb 2024 02:34:18 GMT
|
|
40
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.3.1..@fluentui/react-rating-preview_v0.3.2)
|
|
41
|
+
|
|
42
|
+
### Patches
|
|
43
|
+
|
|
44
|
+
- fix: Add focus border styling to Rating ([PR #30581](https://github.com/microsoft/fluentui/pull/30581) by ololubek@microsoft.com)
|
|
45
|
+
- fix: update RatingItem styling to use flex to align all items properly ([PR #30638](https://github.com/microsoft/fluentui/pull/30638) by ololubek@microsoft.com)
|
|
46
|
+
- fix: Add flex wrap to Rating and RatingDisplay ([PR #30639](https://github.com/microsoft/fluentui/pull/30639) by ololubek@microsoft.com)
|
|
47
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.31 ([PR #30639](https://github.com/microsoft/fluentui/pull/30639) by beachball)
|
|
48
|
+
- Bump @fluentui/react-tabster to v9.19.2 ([PR #30639](https://github.com/microsoft/fluentui/pull/30639) by beachball)
|
|
49
|
+
- Bump @fluentui/react-utilities to v9.18.2 ([PR #30639](https://github.com/microsoft/fluentui/pull/30639) by beachball)
|
|
50
|
+
|
|
51
|
+
## [0.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.3.1)
|
|
52
|
+
|
|
53
|
+
Tue, 20 Feb 2024 14:22:24 GMT
|
|
54
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.3.0..@fluentui/react-rating-preview_v0.3.1)
|
|
55
|
+
|
|
56
|
+
### Patches
|
|
57
|
+
|
|
58
|
+
- fix: remove component assignment from prop destructuring ([PR #30520](https://github.com/microsoft/fluentui/pull/30520) by seanmonahan@microsoft.com)
|
|
59
|
+
- fix: update vertical styling for RatingDisplay to fix vertical alignment ([PR #30465](https://github.com/microsoft/fluentui/pull/30465) by ololubek@microsoft.com)
|
|
60
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.30 ([PR #30543](https://github.com/microsoft/fluentui/pull/30543) by beachball)
|
|
61
|
+
- Bump @fluentui/react-tabster to v9.19.1 ([PR #30543](https://github.com/microsoft/fluentui/pull/30543) by beachball)
|
|
62
|
+
- Bump @fluentui/react-utilities to v9.18.1 ([PR #30543](https://github.com/microsoft/fluentui/pull/30543) by beachball)
|
|
63
|
+
|
|
64
|
+
## [0.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.3.0)
|
|
65
|
+
|
|
66
|
+
Tue, 06 Feb 2024 17:55:19 GMT
|
|
67
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.2.1..@fluentui/react-rating-preview_v0.3.0)
|
|
68
|
+
|
|
69
|
+
### Minor changes
|
|
70
|
+
|
|
71
|
+
- chore: Simplify high contrast visuals for RatingItem, and remove iconOutline from RatingDisplay ([PR #30457](https://github.com/microsoft/fluentui/pull/30457) by behowell@microsoft.com)
|
|
72
|
+
- Bump @fluentui/react-tabster to v9.19.0 ([PR #30392](https://github.com/microsoft/fluentui/pull/30392) by beachball)
|
|
73
|
+
|
|
74
|
+
### Patches
|
|
75
|
+
|
|
76
|
+
- chore: add accesibility props to Rating and RatingDisplay ([PR #30414](https://github.com/microsoft/fluentui/pull/30414) by ololubek@microsoft.com)
|
|
77
|
+
- chore: add accessibility props to Rating and RatingDisplay ([PR #30421](https://github.com/microsoft/fluentui/pull/30421) by ololubek@microsoft.com)
|
|
78
|
+
|
|
79
|
+
## [0.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.2.1)
|
|
80
|
+
|
|
81
|
+
Tue, 30 Jan 2024 23:16:54 GMT
|
|
82
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.2.0..@fluentui/react-rating-preview_v0.2.1)
|
|
83
|
+
|
|
84
|
+
### Patches
|
|
85
|
+
|
|
86
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.29 ([PR #29983](https://github.com/microsoft/fluentui/pull/29983) by beachball)
|
|
87
|
+
- Bump @fluentui/react-tabster to v9.18.0 ([PR #29983](https://github.com/microsoft/fluentui/pull/29983) by beachball)
|
|
88
|
+
- Bump @fluentui/react-utilities to v9.18.0 ([PR #29983](https://github.com/microsoft/fluentui/pull/29983) by beachball)
|
|
89
|
+
|
|
90
|
+
## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.2.0)
|
|
91
|
+
|
|
92
|
+
Fri, 26 Jan 2024 10:40:21 GMT
|
|
93
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.6..@fluentui/react-rating-preview_v0.2.0)
|
|
94
|
+
|
|
95
|
+
### Minor changes
|
|
96
|
+
|
|
97
|
+
- feat: Add RatingDisplay component ([PR #30323](https://github.com/microsoft/fluentui/pull/30323) by ololubek@microsoft.com)
|
|
98
|
+
|
|
99
|
+
## [0.1.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.6)
|
|
100
|
+
|
|
101
|
+
Tue, 23 Jan 2024 15:11:00 GMT
|
|
102
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.5..@fluentui/react-rating-preview_v0.1.6)
|
|
103
|
+
|
|
104
|
+
### Patches
|
|
105
|
+
|
|
106
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.28 ([PR #30359](https://github.com/microsoft/fluentui/pull/30359) by beachball)
|
|
107
|
+
- Bump @fluentui/react-tabster to v9.17.4 ([PR #30359](https://github.com/microsoft/fluentui/pull/30359) by beachball)
|
|
108
|
+
- Bump @fluentui/react-utilities to v9.17.0 ([PR #30359](https://github.com/microsoft/fluentui/pull/30359) by beachball)
|
|
109
|
+
|
|
110
|
+
## [0.1.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.5)
|
|
111
|
+
|
|
112
|
+
Thu, 18 Jan 2024 14:25:03 GMT
|
|
113
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.4..@fluentui/react-rating-preview_v0.1.5)
|
|
114
|
+
|
|
115
|
+
### Patches
|
|
116
|
+
|
|
117
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.27 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
|
|
118
|
+
- Bump @fluentui/react-tabster to v9.17.3 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
|
|
119
|
+
- Bump @fluentui/react-utilities to v9.16.1 ([PR #30046](https://github.com/microsoft/fluentui/pull/30046) by beachball)
|
|
120
|
+
|
|
121
|
+
## [0.1.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.4)
|
|
122
|
+
|
|
123
|
+
Wed, 17 Jan 2024 16:18:50 GMT
|
|
124
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.3..@fluentui/react-rating-preview_v0.1.4)
|
|
125
|
+
|
|
126
|
+
### Patches
|
|
127
|
+
|
|
128
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.26 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
|
|
129
|
+
- Bump @fluentui/react-tabster to v9.17.2 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
|
|
130
|
+
- Bump @fluentui/react-utilities to v9.16.0 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
|
|
131
|
+
|
|
132
|
+
## [0.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.3)
|
|
133
|
+
|
|
134
|
+
Tue, 16 Jan 2024 13:14:23 GMT
|
|
135
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.2..@fluentui/react-rating-preview_v0.1.3)
|
|
136
|
+
|
|
137
|
+
### Patches
|
|
138
|
+
|
|
139
|
+
- Scaffold RatingDisplay ([PR #30283](https://github.com/microsoft/fluentui/pull/30283) by ololubek@microsoft.com)
|
|
140
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.25 ([PR #30299](https://github.com/microsoft/fluentui/pull/30299) by beachball)
|
|
141
|
+
- Bump @fluentui/react-tabster to v9.17.1 ([PR #30299](https://github.com/microsoft/fluentui/pull/30299) by beachball)
|
|
142
|
+
|
|
143
|
+
## [0.1.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.2)
|
|
144
|
+
|
|
145
|
+
Thu, 11 Jan 2024 09:04:29 GMT
|
|
146
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.1..@fluentui/react-rating-preview_v0.1.2)
|
|
147
|
+
|
|
148
|
+
### Patches
|
|
149
|
+
|
|
150
|
+
- chore: Updating doc stories and API. ([PR #30092](https://github.com/microsoft/fluentui/pull/30092) by ololubek@microsoft.com)
|
|
151
|
+
|
|
152
|
+
## [0.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.1)
|
|
153
|
+
|
|
154
|
+
Mon, 08 Jan 2024 16:24:24 GMT
|
|
155
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating-preview_v0.1.0..@fluentui/react-rating-preview_v0.1.1)
|
|
156
|
+
|
|
157
|
+
### Patches
|
|
158
|
+
|
|
159
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.24 ([PR #30179](https://github.com/microsoft/fluentui/pull/30179) by beachball)
|
|
160
|
+
- Bump @fluentui/react-tabster to v9.17.0 ([PR #30179](https://github.com/microsoft/fluentui/pull/30179) by beachball)
|
|
161
|
+
- Bump @fluentui/react-utilities to v9.15.6 ([PR #30179](https://github.com/microsoft/fluentui/pull/30179) by beachball)
|
|
162
|
+
|
|
163
|
+
## [0.1.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating-preview_v0.1.0)
|
|
164
|
+
|
|
165
|
+
Wed, 03 Jan 2024 09:26:43 GMT
|
|
166
|
+
|
|
167
|
+
### Minor changes
|
|
168
|
+
|
|
169
|
+
- 'feat: release rating to preview ([PR #30153](https://github.com/microsoft/fluentui/pull/30153) by ololubek@microsoft.com)
|
|
170
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.23 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
|
|
171
|
+
- Bump @fluentui/react-tabster to v9.16.1 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
|
|
172
|
+
- Bump @fluentui/react-utilities to v9.15.5 ([PR #30163](https://github.com/microsoft/fluentui/pull/30163) by beachball)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@fluentui/react-rating-preview
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
14
|
+
|
|
15
|
+
Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @fluentui/react-rating
|
|
2
|
+
|
|
3
|
+
**React Rating components for [Fluent UI React](https://react.fluentui.dev)**
|
|
4
|
+
|
|
5
|
+
A `Rating` component allows users to provide a rating for a particular item.
|
|
6
|
+
|
|
7
|
+
This component displays a set of stars or other symbols that represent the rating value. Users can interact with the component to select a rating by clicking on the stars or using touch gestures.
|
|
8
|
+
|
|
9
|
+
### Usage
|
|
10
|
+
|
|
11
|
+
Import `Rating` or `RatingDisplay`:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// From @fluentui/react-components
|
|
15
|
+
import { Rating, RatingDisplay } from '@fluentui/react-components';
|
|
16
|
+
|
|
17
|
+
// Directly from @fluentui/react-rating
|
|
18
|
+
import { Rating, RatingDisplay } from '@fluentui/react-rating';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### Examples
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<Rating />
|
|
25
|
+
|
|
26
|
+
<RatingDisplay />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
See [Fluent UI Storybook](https://react.fluentui.dev/) for more detailed usage examples.
|
|
30
|
+
|
|
31
|
+
Alternatively, run Storybook locally with:
|
|
32
|
+
|
|
33
|
+
1. `yarn start`
|
|
34
|
+
2. Select `react-rating` from the list.
|
|
35
|
+
|
|
36
|
+
### Specification
|
|
37
|
+
|
|
38
|
+
See [Spec.md](./docs/Spec.md).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
4
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
5
|
+
import type { EventData } from '@fluentui/react-utilities';
|
|
6
|
+
import type { EventHandler } from '@fluentui/react-utilities';
|
|
7
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
8
|
+
import * as React_2 from 'react';
|
|
9
|
+
import type { Slot } from '@fluentui/react-utilities';
|
|
10
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Rating is a wrapper for one or more rating items that will be used to set a rating value.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Rating: ForwardRefComponent<RatingProps>;
|
|
16
|
+
|
|
17
|
+
export declare const ratingClassNames: SlotClassNames<RatingSlots>;
|
|
18
|
+
|
|
19
|
+
export declare type RatingContextValues = {
|
|
20
|
+
ratingItem: RatingItemContextValue;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* RatingDisplay is a wrapper for one or more rating items that will be used to display a rating value
|
|
25
|
+
* as well as the label for the rating.
|
|
26
|
+
*/
|
|
27
|
+
export declare const RatingDisplay: ForwardRefComponent<RatingDisplayProps>;
|
|
28
|
+
|
|
29
|
+
export declare const ratingDisplayClassNames: SlotClassNames<RatingDisplaySlots>;
|
|
30
|
+
|
|
31
|
+
export declare type RatingDisplayContextValues = {
|
|
32
|
+
ratingItem: RatingItemContextValue;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* RatingDisplay Props
|
|
37
|
+
*/
|
|
38
|
+
export declare type RatingDisplayProps = ComponentProps<RatingDisplaySlots> & {
|
|
39
|
+
/**
|
|
40
|
+
* Color of the rating items (stars).
|
|
41
|
+
* @default neutral
|
|
42
|
+
*/
|
|
43
|
+
color?: 'brand' | 'marigold' | 'neutral';
|
|
44
|
+
/**
|
|
45
|
+
* Renders a single filled star, with the value written next to it.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
compact?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The number of ratings represented by the rating value.
|
|
51
|
+
* This will be formatted with a thousands separator (if applicable) and displayed next to the value.
|
|
52
|
+
*/
|
|
53
|
+
count?: number;
|
|
54
|
+
/**
|
|
55
|
+
* The icon used for rating items.
|
|
56
|
+
* @default StarFilled
|
|
57
|
+
*/
|
|
58
|
+
icon?: React_2.ElementType;
|
|
59
|
+
/**
|
|
60
|
+
* The max value of the rating. This controls the number of rating items displayed.
|
|
61
|
+
* Must be a whole number greater than 1.
|
|
62
|
+
* @default 5
|
|
63
|
+
*/
|
|
64
|
+
max?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the size of the RatingDisplay items.
|
|
67
|
+
* @default medium
|
|
68
|
+
*/
|
|
69
|
+
size?: 'small' | 'medium' | 'large' | 'extra-large';
|
|
70
|
+
/**
|
|
71
|
+
* The value of the rating
|
|
72
|
+
*/
|
|
73
|
+
value?: number;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export declare type RatingDisplaySlots = {
|
|
77
|
+
root: NonNullable<Slot<'div'>>;
|
|
78
|
+
valueText?: Slot<'span'>;
|
|
79
|
+
countText?: Slot<'span'>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* State used in rendering RatingDisplay
|
|
84
|
+
*/
|
|
85
|
+
export declare type RatingDisplayState = ComponentState<RatingDisplaySlots> & Required<Pick<RatingDisplayProps, 'color' | 'compact' | 'icon' | 'max' | 'size'>> & Pick<RatingDisplayProps, 'value'>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* RatingItem is an item that will be used to set or display a rating value.
|
|
89
|
+
*/
|
|
90
|
+
export declare const RatingItem: ForwardRefComponent<RatingItemProps>;
|
|
91
|
+
|
|
92
|
+
export declare const ratingItemClassNames: SlotClassNames<RatingItemSlots>;
|
|
93
|
+
|
|
94
|
+
declare type RatingItemContextValue = Partial<Pick<RatingState, 'name' | 'hoveredValue' | 'value'>> & Pick<RatingState, 'color' | 'iconFilled' | 'iconOutline' | 'itemLabel' | 'step' | 'size'> & Partial<Pick<RatingDisplayState, 'compact'>> & {
|
|
95
|
+
interactive?: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* RatingItem Props
|
|
100
|
+
*/
|
|
101
|
+
export declare type RatingItemProps = ComponentProps<Partial<RatingItemSlots>> & {
|
|
102
|
+
/**
|
|
103
|
+
* The positive whole number value that is displayed by this RatingItem
|
|
104
|
+
*/
|
|
105
|
+
value?: number;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export declare const RatingItemProvider: React_2.Provider<RatingItemContextValue | undefined>;
|
|
109
|
+
|
|
110
|
+
export declare type RatingItemSlots = {
|
|
111
|
+
/**
|
|
112
|
+
* The root slot of the RatingItem.
|
|
113
|
+
* Default html element is span
|
|
114
|
+
*/
|
|
115
|
+
root: NonNullable<Slot<'span'>>;
|
|
116
|
+
/**
|
|
117
|
+
* Icon displayed when the rating value is greater than or equal to the item's value.
|
|
118
|
+
*/
|
|
119
|
+
selectedIcon?: NonNullable<Slot<'div'>>;
|
|
120
|
+
/**
|
|
121
|
+
* Icon displayed when the rating value is less than the item's value.
|
|
122
|
+
*/
|
|
123
|
+
unselectedIcon?: NonNullable<Slot<'div'>>;
|
|
124
|
+
/**
|
|
125
|
+
* Radio input slot used for half star precision
|
|
126
|
+
*/
|
|
127
|
+
halfValueInput?: NonNullable<Slot<'input'>>;
|
|
128
|
+
/**
|
|
129
|
+
* Radio input slot used for full star precision
|
|
130
|
+
*/
|
|
131
|
+
fullValueInput?: NonNullable<Slot<'input'>>;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* State used in rendering RatingItem
|
|
136
|
+
*/
|
|
137
|
+
export declare type RatingItemState = ComponentState<RatingItemSlots> & Required<Pick<RatingItemProps, 'value'>> & Pick<RatingState, 'color' | 'step' | 'size'> & {
|
|
138
|
+
iconFillWidth: number;
|
|
139
|
+
appearance: 'outline' | 'filled';
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Data for the onChange event for Rating.
|
|
144
|
+
*/
|
|
145
|
+
export declare type RatingOnChangeEventData = EventData<'change', React_2.FormEvent<HTMLDivElement>> & {
|
|
146
|
+
/**
|
|
147
|
+
* The new value of the rating.
|
|
148
|
+
*/
|
|
149
|
+
value: number;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Rating Props
|
|
154
|
+
*/
|
|
155
|
+
export declare type RatingProps = Omit<ComponentProps<Partial<RatingSlots>>, 'onChange'> & {
|
|
156
|
+
/**
|
|
157
|
+
* Controls the color of the Rating.
|
|
158
|
+
* @default neutral
|
|
159
|
+
*/
|
|
160
|
+
color?: 'brand' | 'marigold' | 'neutral';
|
|
161
|
+
/**
|
|
162
|
+
* Default value of the Rating
|
|
163
|
+
*/
|
|
164
|
+
defaultValue?: number;
|
|
165
|
+
/**
|
|
166
|
+
* The icon to display when the rating value is greater than or equal to the item's value.
|
|
167
|
+
*/
|
|
168
|
+
iconFilled?: React_2.ElementType;
|
|
169
|
+
/**
|
|
170
|
+
* The icon to display when the rating value is less than the item's value.
|
|
171
|
+
*/
|
|
172
|
+
iconOutline?: React_2.ElementType;
|
|
173
|
+
/**
|
|
174
|
+
* Prop to generate the aria-label for the rating inputs.
|
|
175
|
+
* @default (rating) =\> `${rating}`
|
|
176
|
+
*/
|
|
177
|
+
itemLabel?: (rating: number) => string;
|
|
178
|
+
/**
|
|
179
|
+
* The max value of the rating. This controls the number of rating items displayed.
|
|
180
|
+
* Must be a whole number greater than 1.
|
|
181
|
+
* @default 5
|
|
182
|
+
*/
|
|
183
|
+
max?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Name for the Radio inputs. If not provided, one will be automatically generated
|
|
186
|
+
*/
|
|
187
|
+
name?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Callback when the rating value is changed by the user.
|
|
190
|
+
*/
|
|
191
|
+
onChange?: EventHandler<RatingOnChangeEventData>;
|
|
192
|
+
/**
|
|
193
|
+
* Sets the precision to allow half-filled shapes in Rating
|
|
194
|
+
* @default 1
|
|
195
|
+
*/
|
|
196
|
+
step?: 0.5 | 1;
|
|
197
|
+
/**
|
|
198
|
+
* Sets the size of the Rating items.
|
|
199
|
+
* @default extra-large
|
|
200
|
+
*/
|
|
201
|
+
size?: 'small' | 'medium' | 'large' | 'extra-large';
|
|
202
|
+
/**
|
|
203
|
+
* The value of the rating
|
|
204
|
+
*/
|
|
205
|
+
value?: number;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export declare type RatingSlots = {
|
|
209
|
+
root: NonNullable<Slot<'div'>>;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* State used in rendering Rating
|
|
214
|
+
*/
|
|
215
|
+
export declare type RatingState = ComponentState<RatingSlots> & Required<Pick<RatingProps, 'color' | 'iconFilled' | 'iconOutline' | 'name' | 'step' | 'size' | 'value'>> & Pick<RatingProps, 'itemLabel'> & {
|
|
216
|
+
hoveredValue?: number | undefined;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Render the final JSX of Rating
|
|
221
|
+
*/
|
|
222
|
+
export declare const renderRating_unstable: (state: RatingState, contextValues: RatingContextValues) => JSX.Element;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Render the final JSX of RatingDisplay
|
|
226
|
+
*/
|
|
227
|
+
export declare const renderRatingDisplay_unstable: (state: RatingDisplayState, contextValues: RatingDisplayContextValues) => JSX.Element;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Render the final JSX of RatingItem
|
|
231
|
+
*/
|
|
232
|
+
export declare const renderRatingItem_unstable: (state: RatingItemState) => JSX.Element;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Create the state required to render Rating.
|
|
236
|
+
*
|
|
237
|
+
* The returned state can be modified with hooks such as useRatingStyles_unstable,
|
|
238
|
+
* before being passed to renderRating_unstable.
|
|
239
|
+
*
|
|
240
|
+
* @param props - props from this instance of Rating
|
|
241
|
+
* @param ref - reference to root HTMLElement of Rating
|
|
242
|
+
*/
|
|
243
|
+
export declare const useRating_unstable: (props: RatingProps, ref: React_2.Ref<HTMLDivElement>) => RatingState;
|
|
244
|
+
|
|
245
|
+
export declare const useRatingContextValues: (ratingState: RatingState) => RatingContextValues;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Create the state required to render RatingDisplay.
|
|
249
|
+
*
|
|
250
|
+
* The returned state can be modified with hooks such as useRatingDisplayStyles_unstable,
|
|
251
|
+
* before being passed to renderRatingDisplay_unstable.
|
|
252
|
+
*
|
|
253
|
+
* @param props - props from this instance of RatingDisplay
|
|
254
|
+
* @param ref - reference to root HTMLDivElement of RatingDisplay
|
|
255
|
+
*/
|
|
256
|
+
export declare const useRatingDisplay_unstable: (props: RatingDisplayProps, ref: React_2.Ref<HTMLDivElement>) => RatingDisplayState;
|
|
257
|
+
|
|
258
|
+
export declare const useRatingDisplayContextValues: (state: RatingDisplayState) => RatingDisplayContextValues;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Apply styling to the RatingDisplay slots based on the state
|
|
262
|
+
*/
|
|
263
|
+
export declare const useRatingDisplayStyles_unstable: (state: RatingDisplayState) => RatingDisplayState;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Create the state required to render RatingItem.
|
|
267
|
+
*
|
|
268
|
+
* The returned state can be modified with hooks such as useRatingItemStyles_unstable,
|
|
269
|
+
* before being passed to renderRatingItem_unstable.
|
|
270
|
+
*
|
|
271
|
+
* @param props - props from this instance of RatingItem
|
|
272
|
+
* @param ref - reference to root HTMLElement of RatingItem
|
|
273
|
+
*/
|
|
274
|
+
export declare const useRatingItem_unstable: (props: RatingItemProps, ref: React_2.Ref<HTMLSpanElement>) => RatingItemState;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Get the value of the RatingContext.
|
|
278
|
+
*/
|
|
279
|
+
export declare const useRatingItemContextValue_unstable: () => RatingItemContextValue;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Apply styling to the RatingItem slots based on the state
|
|
283
|
+
*/
|
|
284
|
+
export declare const useRatingItemStyles_unstable: (state: RatingItemState) => RatingItemState;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Apply styling to the Rating slots based on the state
|
|
288
|
+
*/
|
|
289
|
+
export declare const useRatingStyles_unstable: (state: RatingState) => RatingState;
|
|
290
|
+
|
|
291
|
+
export { }
|
package/lib/Rating.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/Rating/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Rating.ts"],"sourcesContent":["export * from './components/Rating/index';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/RatingDisplay/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["RatingDisplay.ts"],"sourcesContent":["export * from './components/RatingDisplay/index';\n"],"names":[],"mappings":"AAAA,cAAc,mCAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/RatingItem/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["RatingItem.ts"],"sourcesContent":["export * from './components/RatingItem/index';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRating_unstable } from './useRating';
|
|
3
|
+
import { renderRating_unstable } from './renderRating';
|
|
4
|
+
import { useRatingStyles_unstable } from './useRatingStyles.styles';
|
|
5
|
+
import { useRatingContextValues } from './useRatingContextValues';
|
|
6
|
+
/**
|
|
7
|
+
* Rating is a wrapper for one or more rating items that will be used to set a rating value.
|
|
8
|
+
*/ export const Rating = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
9
|
+
const state = useRating_unstable(props, ref);
|
|
10
|
+
const contextValues = useRatingContextValues(state);
|
|
11
|
+
useRatingStyles_unstable(state);
|
|
12
|
+
return renderRating_unstable(state, contextValues);
|
|
13
|
+
});
|
|
14
|
+
Rating.displayName = 'Rating';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Rating.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRating_unstable } from './useRating';\nimport { renderRating_unstable } from './renderRating';\nimport { useRatingStyles_unstable } from './useRatingStyles.styles';\nimport type { RatingProps } from './Rating.types';\nimport { useRatingContextValues } from './useRatingContextValues';\n\n/**\n * Rating is a wrapper for one or more rating items that will be used to set a rating value.\n */\nexport const Rating: ForwardRefComponent<RatingProps> = React.forwardRef((props, ref) => {\n const state = useRating_unstable(props, ref);\n const contextValues = useRatingContextValues(state);\n\n useRatingStyles_unstable(state);\n return renderRating_unstable(state, contextValues);\n});\n\nRating.displayName = 'Rating';\n"],"names":["React","useRating_unstable","renderRating_unstable","useRatingStyles_unstable","useRatingContextValues","Rating","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,2BAA2B;AAEpE,SAASC,sBAAsB,QAAQ,2BAA2B;AAElE;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQR,mBAAmBM,OAAOC;IACxC,MAAME,gBAAgBN,uBAAuBK;IAE7CN,yBAAyBM;IACzB,OAAOP,sBAAsBO,OAAOC;AACtC,GAAG;AAEHL,OAAOM,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Rating.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, EventData, EventHandler, Slot } from '@fluentui/react-utilities';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport type RatingSlots = {\n root: NonNullable<Slot<'div'>>;\n};\n\n/**\n * Rating Props\n */\nexport type RatingProps = Omit<ComponentProps<Partial<RatingSlots>>, 'onChange'> & {\n /**\n * Controls the color of the Rating.\n * @default neutral\n */\n color?: 'brand' | 'marigold' | 'neutral';\n /**\n * Default value of the Rating\n */\n defaultValue?: number;\n /**\n * The icon to display when the rating value is greater than or equal to the item's value.\n */\n iconFilled?: React.ElementType;\n /**\n * The icon to display when the rating value is less than the item's value.\n */\n iconOutline?: React.ElementType;\n /**\n * Prop to generate the aria-label for the rating inputs.\n * @default (rating) =\\> `${rating}`\n */\n itemLabel?: (rating: number) => string;\n /**\n * The max value of the rating. This controls the number of rating items displayed.\n * Must be a whole number greater than 1.\n * @default 5\n */\n max?: number;\n /**\n * Name for the Radio inputs. If not provided, one will be automatically generated\n */\n name?: string;\n /**\n * Callback when the rating value is changed by the user.\n */\n onChange?: EventHandler<RatingOnChangeEventData>;\n /**\n * Sets the precision to allow half-filled shapes in Rating\n * @default 1\n */\n step?: 0.5 | 1;\n /**\n * Sets the size of the Rating items.\n * @default extra-large\n */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /**\n * The value of the rating\n */\n value?: number;\n};\n\n/**\n * Data for the onChange event for Rating.\n */\nexport type RatingOnChangeEventData = EventData<'change', React.FormEvent<HTMLDivElement>> & {\n /**\n * The new value of the rating.\n */\n value: number;\n};\n\n/**\n * State used in rendering Rating\n */\nexport type RatingState = ComponentState<RatingSlots> &\n Required<Pick<RatingProps, 'color' | 'iconFilled' | 'iconOutline' | 'name' | 'step' | 'size' | 'value'>> &\n Pick<RatingProps, 'itemLabel'> & {\n hoveredValue?: number | undefined;\n };\n\nexport type RatingContextValues = {\n ratingItem: RatingItemContextValue;\n};\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Rating';\nexport * from './Rating.types';\nexport * from './renderRating';\nexport * from './useRating';\nexport * from './useRatingStyles.styles';\nexport * from './useRatingContextValues';\n"],"names":[],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,2BAA2B;AACzC,cAAc,2BAA2B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
|
+
import { RatingItemProvider } from '../../contexts/RatingItemContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of Rating
|
|
6
|
+
*/ export const renderRating_unstable = (state, contextValues)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/ _jsx(RatingItemProvider, {
|
|
9
|
+
value: contextValues.ratingItem,
|
|
10
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderRating.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingState, RatingSlots, RatingContextValues } from './Rating.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of Rating\n */\nexport const renderRating_unstable = (state: RatingState, contextValues: RatingContextValues) => {\n assertSlots<RatingSlots>(state);\n\n return (\n <RatingItemProvider value={contextValues.ratingItem}>\n <state.root />\n </RatingItemProvider>\n );\n};\n"],"names":["assertSlots","RatingItemProvider","renderRating_unstable","state","contextValues","value","ratingItem","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,kBAAkB,QAAQ,mCAAmC;AAEtE;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAoBC;IACxDJ,YAAyBG;IAEzB,qBACE,KAACF;QAAmBI,OAAOD,cAAcE,UAAU;kBACjD,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}
|