@fluentui/react-rating 0.0.0-nightly-20240318-0408.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/LICENSE +15 -0
  3. package/README.md +38 -0
  4. package/dist/index.d.ts +291 -0
  5. package/lib/Rating.js +1 -0
  6. package/lib/Rating.js.map +1 -0
  7. package/lib/RatingDisplay.js +1 -0
  8. package/lib/RatingDisplay.js.map +1 -0
  9. package/lib/RatingItem.js +1 -0
  10. package/lib/RatingItem.js.map +1 -0
  11. package/lib/components/Rating/Rating.js +14 -0
  12. package/lib/components/Rating/Rating.js.map +1 -0
  13. package/lib/components/Rating/Rating.types.js +1 -0
  14. package/lib/components/Rating/Rating.types.js.map +1 -0
  15. package/lib/components/Rating/index.js +6 -0
  16. package/lib/components/Rating/index.js.map +1 -0
  17. package/lib/components/Rating/renderRating.js +12 -0
  18. package/lib/components/Rating/renderRating.js.map +1 -0
  19. package/lib/components/Rating/useRating.js +82 -0
  20. package/lib/components/Rating/useRating.js.map +1 -0
  21. package/lib/components/Rating/useRatingContextValues.js +29 -0
  22. package/lib/components/Rating/useRatingContextValues.js.map +1 -0
  23. package/lib/components/Rating/useRatingStyles.styles.js +17 -0
  24. package/lib/components/Rating/useRatingStyles.styles.js.map +1 -0
  25. package/lib/components/RatingDisplay/RatingDisplay.js +15 -0
  26. package/lib/components/RatingDisplay/RatingDisplay.js.map +1 -0
  27. package/lib/components/RatingDisplay/RatingDisplay.types.js +1 -0
  28. package/lib/components/RatingDisplay/RatingDisplay.types.js.map +1 -0
  29. package/lib/components/RatingDisplay/index.js +6 -0
  30. package/lib/components/RatingDisplay/index.js.map +1 -0
  31. package/lib/components/RatingDisplay/renderRatingDisplay.js +18 -0
  32. package/lib/components/RatingDisplay/renderRatingDisplay.js.map +1 -0
  33. package/lib/components/RatingDisplay/useRatingDisplay.js +79 -0
  34. package/lib/components/RatingDisplay/useRatingDisplay.js.map +1 -0
  35. package/lib/components/RatingDisplay/useRatingDisplayContextValues.js +23 -0
  36. package/lib/components/RatingDisplay/useRatingDisplayContextValues.js.map +1 -0
  37. package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.js +50 -0
  38. package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +1 -0
  39. package/lib/components/RatingItem/RatingItem.js +12 -0
  40. package/lib/components/RatingItem/RatingItem.js.map +1 -0
  41. package/lib/components/RatingItem/RatingItem.types.js +1 -0
  42. package/lib/components/RatingItem/RatingItem.types.js.map +1 -0
  43. package/lib/components/RatingItem/index.js +5 -0
  44. package/lib/components/RatingItem/index.js.map +1 -0
  45. package/lib/components/RatingItem/renderRatingItem.js +15 -0
  46. package/lib/components/RatingItem/renderRatingItem.js.map +1 -0
  47. package/lib/components/RatingItem/useRatingItem.js +111 -0
  48. package/lib/components/RatingItem/useRatingItem.js.map +1 -0
  49. package/lib/components/RatingItem/useRatingItemStyles.styles.js +163 -0
  50. package/lib/components/RatingItem/useRatingItemStyles.styles.js.map +1 -0
  51. package/lib/contexts/RatingItemContext.js +16 -0
  52. package/lib/contexts/RatingItemContext.js.map +1 -0
  53. package/lib/contexts/index.js +1 -0
  54. package/lib/contexts/index.js.map +1 -0
  55. package/lib/index.js +4 -0
  56. package/lib/index.js.map +1 -0
  57. package/lib-commonjs/Rating.js +6 -0
  58. package/lib-commonjs/Rating.js.map +1 -0
  59. package/lib-commonjs/RatingDisplay.js +6 -0
  60. package/lib-commonjs/RatingDisplay.js.map +1 -0
  61. package/lib-commonjs/RatingItem.js +6 -0
  62. package/lib-commonjs/RatingItem.js.map +1 -0
  63. package/lib-commonjs/components/Rating/Rating.js +23 -0
  64. package/lib-commonjs/components/Rating/Rating.js.map +1 -0
  65. package/lib-commonjs/components/Rating/Rating.types.js +6 -0
  66. package/lib-commonjs/components/Rating/Rating.types.js.map +1 -0
  67. package/lib-commonjs/components/Rating/index.js +11 -0
  68. package/lib-commonjs/components/Rating/index.js.map +1 -0
  69. package/lib-commonjs/components/Rating/renderRating.js +20 -0
  70. package/lib-commonjs/components/Rating/renderRating.js.map +1 -0
  71. package/lib-commonjs/components/Rating/useRating.js +85 -0
  72. package/lib-commonjs/components/Rating/useRating.js.map +1 -0
  73. package/lib-commonjs/components/Rating/useRatingContextValues.js +40 -0
  74. package/lib-commonjs/components/Rating/useRatingContextValues.js.map +1 -0
  75. package/lib-commonjs/components/Rating/useRatingStyles.styles.js +32 -0
  76. package/lib-commonjs/components/Rating/useRatingStyles.styles.js.map +1 -0
  77. package/lib-commonjs/components/RatingDisplay/RatingDisplay.js +23 -0
  78. package/lib-commonjs/components/RatingDisplay/RatingDisplay.js.map +1 -0
  79. package/lib-commonjs/components/RatingDisplay/RatingDisplay.types.js +6 -0
  80. package/lib-commonjs/components/RatingDisplay/RatingDisplay.types.js.map +1 -0
  81. package/lib-commonjs/components/RatingDisplay/index.js +11 -0
  82. package/lib-commonjs/components/RatingDisplay/index.js.map +1 -0
  83. package/lib-commonjs/components/RatingDisplay/renderRatingDisplay.js +26 -0
  84. package/lib-commonjs/components/RatingDisplay/renderRatingDisplay.js.map +1 -0
  85. package/lib-commonjs/components/RatingDisplay/useRatingDisplay.js +82 -0
  86. package/lib-commonjs/components/RatingDisplay/useRatingDisplay.js.map +1 -0
  87. package/lib-commonjs/components/RatingDisplay/useRatingDisplayContextValues.js +34 -0
  88. package/lib-commonjs/components/RatingDisplay/useRatingDisplayContextValues.js.map +1 -0
  89. package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.js +72 -0
  90. package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +1 -0
  91. package/lib-commonjs/components/RatingItem/RatingItem.js +21 -0
  92. package/lib-commonjs/components/RatingItem/RatingItem.js.map +1 -0
  93. package/lib-commonjs/components/RatingItem/RatingItem.types.js +4 -0
  94. package/lib-commonjs/components/RatingItem/RatingItem.types.js.map +1 -0
  95. package/lib-commonjs/components/RatingItem/index.js +10 -0
  96. package/lib-commonjs/components/RatingItem/index.js.map +1 -0
  97. package/lib-commonjs/components/RatingItem/renderRatingItem.js +23 -0
  98. package/lib-commonjs/components/RatingItem/renderRatingItem.js.map +1 -0
  99. package/lib-commonjs/components/RatingItem/useRatingItem.js +114 -0
  100. package/lib-commonjs/components/RatingItem/useRatingItem.js.map +1 -0
  101. package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.js +323 -0
  102. package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.js.map +1 -0
  103. package/lib-commonjs/contexts/RatingItemContext.js +34 -0
  104. package/lib-commonjs/contexts/RatingItemContext.js.map +1 -0
  105. package/lib-commonjs/contexts/index.js +6 -0
  106. package/lib-commonjs/contexts/index.js.map +1 -0
  107. package/lib-commonjs/index.js +73 -0
  108. package/lib-commonjs/index.js.map +1 -0
  109. package/package.json +63 -0
@@ -0,0 +1,163 @@
1
+ import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ import { createFocusOutlineStyle } from '@fluentui/react-tabster';
4
+ export const ratingItemClassNames = {
5
+ root: 'fui-RatingItem',
6
+ selectedIcon: 'fui-RatingItem__selectedIcon',
7
+ unselectedIcon: 'fui-RatingItem__unselectedIcon',
8
+ halfValueInput: 'fui-RatingItem__halfValueInput',
9
+ fullValueInput: 'fui-RatingItem__fullValueInput'
10
+ };
11
+ /**
12
+ * Styles for the root slot
13
+ */
14
+ const useStyles = /*#__PURE__*/__styles({
15
+ root: {
16
+ qhf8xq: "f10pi13n",
17
+ Brovlpu: "ftqa4ok",
18
+ B486eqv: "f2hkw1w",
19
+ Bssx7fj: "f1b1k54r",
20
+ uh7if5: ["f4ne723", "fqqcjud"],
21
+ clntm0: "fh7aioi",
22
+ Dlk2r6: ["fqqcjud", "f4ne723"],
23
+ Bm3wd5j: "f1k55ka9",
24
+ Bbrhkcr: ["fgclinu", "f16pcs8n"],
25
+ f1oku: "fycbxed",
26
+ aywvf2: ["f16pcs8n", "fgclinu"],
27
+ B2j2mmj: "ffht0p2",
28
+ wigs8: "f1p0ul1q",
29
+ pbfy6t: "f1c901ms",
30
+ B0v4ure: "f1alokd7",
31
+ ghq09: "f78i1la",
32
+ B24cy0v: ["f1kvsw7t", "f1bw8brt"],
33
+ Bwckmig: "f8k7e5g",
34
+ Bvwlmkc: ["f1bw8brt", "f1kvsw7t"],
35
+ Bbgo44z: "f1pmxfrl",
36
+ Bil7v7r: ["fszkfcr", "f1ap5ily"],
37
+ skfxo0: "f57dp0y",
38
+ jo1ztg: ["f1ap5ily", "fszkfcr"],
39
+ Ba3ybja: ["f11dm2qb", "f136rfnd"],
40
+ az1dzo: ["f136rfnd", "f11dm2qb"],
41
+ vppk2z: ["fdsq1qd", "f1khssms"],
42
+ B6352mv: ["f1khssms", "fdsq1qd"],
43
+ nr063g: "fq4eyks",
44
+ Blmvk6g: ["f1ya6x16", "ftuszwa"],
45
+ Bsiemmq: "f1e2iu44",
46
+ B98u21t: ["ftuszwa", "f1ya6x16"],
47
+ B2pnrqr: "f1spmvte",
48
+ B29w5g4: ["fgp7k2s", "f13pb23"],
49
+ Bhhzhcn: "f1ihbrwi",
50
+ Bec0n69: ["f13pb23", "fgp7k2s"]
51
+ },
52
+ small: {
53
+ Be2twd7: "f1ugzwwg",
54
+ a9b677: "frx94fk",
55
+ Bqenvij: "fvblgha"
56
+ },
57
+ medium: {
58
+ Be2twd7: "f4ybsrx",
59
+ a9b677: "fjw5fx7",
60
+ Bqenvij: "fd461yt"
61
+ },
62
+ large: {
63
+ Be2twd7: "fe5j1ua",
64
+ a9b677: "f64fuq3",
65
+ Bqenvij: "fjamq6b"
66
+ },
67
+ "extra-large": {
68
+ Be2twd7: "f24l1pt",
69
+ a9b677: "f1w9dchk",
70
+ Bqenvij: "fxldao9"
71
+ }
72
+ }, {
73
+ d: [".f10pi13n{position:relative;}", ".f1b1k54r[data-fui-focus-within]:focus-within{border-top-color:transparent;}", ".f4ne723[data-fui-focus-within]:focus-within{border-right-color:transparent;}", ".fqqcjud[data-fui-focus-within]:focus-within{border-left-color:transparent;}", ".fh7aioi[data-fui-focus-within]:focus-within{border-bottom-color:transparent;}", ".ffht0p2[data-fui-focus-within]:focus-within::after{content:\"\";}", ".f1p0ul1q[data-fui-focus-within]:focus-within::after{position:absolute;}", ".f1c901ms[data-fui-focus-within]:focus-within::after{pointer-events:none;}", ".f1alokd7[data-fui-focus-within]:focus-within::after{z-index:1;}", ".f78i1la[data-fui-focus-within]:focus-within::after{border-top-style:solid;}", ".f1kvsw7t[data-fui-focus-within]:focus-within::after{border-right-style:solid;}", ".f1bw8brt[data-fui-focus-within]:focus-within::after{border-left-style:solid;}", ".f8k7e5g[data-fui-focus-within]:focus-within::after{border-bottom-style:solid;}", ".f1pmxfrl[data-fui-focus-within]:focus-within::after{border-top-width:2px;}", ".fszkfcr[data-fui-focus-within]:focus-within::after{border-right-width:2px;}", ".f1ap5ily[data-fui-focus-within]:focus-within::after{border-left-width:2px;}", ".f57dp0y[data-fui-focus-within]:focus-within::after{border-bottom-width:2px;}", ".f11dm2qb[data-fui-focus-within]:focus-within::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f136rfnd[data-fui-focus-within]:focus-within::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fdsq1qd[data-fui-focus-within]:focus-within::after{border-top-right-radius:var(--borderRadiusMedium);}", ".f1khssms[data-fui-focus-within]:focus-within::after{border-top-left-radius:var(--borderRadiusMedium);}", ".fq4eyks[data-fui-focus-within]:focus-within::after{border-top-color:var(--colorStrokeFocus2);}", ".f1ya6x16[data-fui-focus-within]:focus-within::after{border-right-color:var(--colorStrokeFocus2);}", ".ftuszwa[data-fui-focus-within]:focus-within::after{border-left-color:var(--colorStrokeFocus2);}", ".f1e2iu44[data-fui-focus-within]:focus-within::after{border-bottom-color:var(--colorStrokeFocus2);}", ".f1spmvte[data-fui-focus-within]:focus-within::after{top:calc(2px * -1);}", ".fgp7k2s[data-fui-focus-within]:focus-within::after{right:calc(2px * -1);}", ".f13pb23[data-fui-focus-within]:focus-within::after{left:calc(2px * -1);}", ".f1ihbrwi[data-fui-focus-within]:focus-within::after{bottom:calc(2px * -1);}", ".f1ugzwwg{font-size:12px;}", ".frx94fk{width:12px;}", ".fvblgha{height:12px;}", ".f4ybsrx{font-size:16px;}", ".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".fe5j1ua{font-size:20px;}", ".f64fuq3{width:20px;}", ".fjamq6b{height:20px;}", ".f24l1pt{font-size:28px;}", ".f1w9dchk{width:28px;}", ".fxldao9{height:28px;}"],
74
+ f: [".ftqa4ok:focus{outline-style:none;}"],
75
+ i: [".f2hkw1w:focus-visible{outline-style:none;}"],
76
+ m: [["@media (forced-colors: active){.f1k55ka9[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;}}", {
77
+ m: "(forced-colors: active)"
78
+ }], ["@media (forced-colors: active){.f16pcs8n[data-fui-focus-within]:focus-within::after{border-left-color:Highlight;}.fgclinu[data-fui-focus-within]:focus-within::after{border-right-color:Highlight;}}", {
79
+ m: "(forced-colors: active)"
80
+ }], ["@media (forced-colors: active){.fycbxed[data-fui-focus-within]:focus-within::after{border-bottom-color:Highlight;}}", {
81
+ m: "(forced-colors: active)"
82
+ }]]
83
+ });
84
+ const useInputBaseClassName = /*#__PURE__*/__resetStyles("r1qfsv1p", "rh8pzaz", [".r1qfsv1p{position:absolute;left:0;top:0;right:0;bottom:0;box-sizing:border-box;margin:0;opacity:0;cursor:pointer;height:100%;}", ".rh8pzaz{position:absolute;right:0;top:0;left:0;bottom:0;box-sizing:border-box;margin:0;opacity:0;cursor:pointer;height:100%;}"]);
85
+ const useInputStyles = /*#__PURE__*/__styles({
86
+ lowerHalf: {
87
+ j35jbq: ["ffenbu1", "f1ktbn1t"]
88
+ },
89
+ upperHalf: {
90
+ oyh7mz: ["f1ktbn1t", "ffenbu1"]
91
+ }
92
+ }, {
93
+ d: [".ffenbu1{right:50%;}", ".f1ktbn1t{left:50%;}"]
94
+ });
95
+ const useIndicatorBaseClassName = /*#__PURE__*/__resetStyles("r1420l2m", "r1yt29v5", [".r1420l2m{display:flex;overflow:hidden;color:var(--colorNeutralForeground1);fill:currentColor;pointer-events:none;position:absolute;left:0;right:0;top:0;bottom:0;}", ".r1yt29v5{display:flex;overflow:hidden;color:var(--colorNeutralForeground1);fill:currentColor;pointer-events:none;position:absolute;right:0;left:0;top:0;bottom:0;}"]);
96
+ const useIndicatorStyles = /*#__PURE__*/__styles({
97
+ lowerHalf: {
98
+ j35jbq: ["ffenbu1", "f1ktbn1t"],
99
+ Csf7o1: "f1r2mfmy",
100
+ Bm69ki9: "f1t868b2",
101
+ Bchtypk: "fq3i0c1"
102
+ },
103
+ upperHalf: {
104
+ oyh7mz: ["f1ktbn1t", "ffenbu1"],
105
+ Frg6f3: ["fbm7ezh", "f3ev47i"]
106
+ },
107
+ brand: {
108
+ sj55zd: "f16muhyy"
109
+ },
110
+ marigold: {
111
+ sj55zd: "f1whvut0"
112
+ },
113
+ filled: {
114
+ sj55zd: "f1qaymga",
115
+ ojy3ng: "f13qq9og",
116
+ Bbusuzp: "f1cg6951",
117
+ B6jmk37: "f1am6ztc"
118
+ },
119
+ brandFilled: {
120
+ sj55zd: "f1kdv6iu"
121
+ },
122
+ marigoldFilled: {
123
+ sj55zd: "f1ymbmfq"
124
+ }
125
+ }, {
126
+ d: [".ffenbu1{right:50%;}", ".f1ktbn1t{left:50%;}", ".f1r2mfmy>svg{flex-grow:0;}", ".f1t868b2>svg{flex-shrink:0;}", ".fq3i0c1>svg{flex-basis:auto;}", ".fbm7ezh{margin-left:-50%;}", ".f3ev47i{margin-right:-50%;}", ".f16muhyy{color:var(--colorBrandForeground1);}", ".f1whvut0{color:var(--colorPaletteMarigoldBorderActive);}", ".f1qaymga{color:var(--colorNeutralBackground6);}", ".f13qq9og{stroke:var(--colorTransparentStroke);}", ".f1kdv6iu{color:var(--colorBrandBackground2);}", ".f1ymbmfq{color:var(--colorPaletteMarigoldBackground2);}"],
127
+ m: [["@media (forced-colors: active){.f1cg6951{color:Canvas;}}", {
128
+ m: "(forced-colors: active)"
129
+ }], ["@media (forced-colors: active){.f1am6ztc{stroke:CanvasText;}}", {
130
+ m: "(forced-colors: active)"
131
+ }]]
132
+ });
133
+ /**
134
+ * Apply styling to the RatingItem slots based on the state
135
+ */
136
+ export const useRatingItemStyles_unstable = state => {
137
+ const {
138
+ color,
139
+ size,
140
+ iconFillWidth,
141
+ appearance
142
+ } = state;
143
+ const styles = useStyles();
144
+ const inputBaseClassName = useInputBaseClassName();
145
+ const inputStyles = useInputStyles();
146
+ const indicatorBaseClassName = useIndicatorBaseClassName();
147
+ const indicatorStyles = useIndicatorStyles();
148
+ state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);
149
+ if (state.halfValueInput) {
150
+ state.halfValueInput.className = mergeClasses(ratingItemClassNames.halfValueInput, inputBaseClassName, inputStyles.lowerHalf, state.halfValueInput.className);
151
+ }
152
+ if (state.fullValueInput) {
153
+ state.fullValueInput.className = mergeClasses(ratingItemClassNames.fullValueInput, inputBaseClassName, state.halfValueInput && inputStyles.upperHalf, state.fullValueInput.className);
154
+ }
155
+ if (state.unselectedIcon) {
156
+ state.unselectedIcon.className = mergeClasses(ratingItemClassNames.unselectedIcon, indicatorBaseClassName, appearance === 'filled' && indicatorStyles.filled, color === 'brand' && (appearance === 'filled' ? indicatorStyles.brandFilled : indicatorStyles.brand), color === 'marigold' && (appearance === 'filled' ? indicatorStyles.marigoldFilled : indicatorStyles.marigold), iconFillWidth === 0.5 && indicatorStyles.upperHalf, state.unselectedIcon.className);
157
+ }
158
+ if (state.selectedIcon) {
159
+ state.selectedIcon.className = mergeClasses(ratingItemClassNames.selectedIcon, indicatorBaseClassName, color === 'brand' && indicatorStyles.brand, color === 'marigold' && indicatorStyles.marigold, iconFillWidth === 0.5 && indicatorStyles.lowerHalf, state.selectedIcon.className);
160
+ }
161
+ return state;
162
+ };
163
+ //# sourceMappingURL=useRatingItemStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","shorthands","tokens","createFocusOutlineStyle","ratingItemClassNames","root","selectedIcon","unselectedIcon","halfValueInput","fullValueInput","useStyles","qhf8xq","Brovlpu","B486eqv","Bssx7fj","uh7if5","clntm0","Dlk2r6","Bm3wd5j","Bbrhkcr","f1oku","aywvf2","B2j2mmj","wigs8","pbfy6t","B0v4ure","ghq09","B24cy0v","Bwckmig","Bvwlmkc","Bbgo44z","Bil7v7r","skfxo0","jo1ztg","Ba3ybja","az1dzo","vppk2z","B6352mv","nr063g","Blmvk6g","Bsiemmq","B98u21t","B2pnrqr","B29w5g4","Bhhzhcn","Bec0n69","small","Be2twd7","a9b677","Bqenvij","medium","large","d","f","i","m","useInputBaseClassName","useInputStyles","lowerHalf","j35jbq","upperHalf","oyh7mz","useIndicatorBaseClassName","useIndicatorStyles","Csf7o1","Bm69ki9","Bchtypk","Frg6f3","brand","sj55zd","marigold","filled","ojy3ng","Bbusuzp","B6jmk37","brandFilled","marigoldFilled","useRatingItemStyles_unstable","state","color","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className"],"sources":["useRatingItemStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nexport const ratingItemClassNames = {\n root: 'fui-RatingItem',\n selectedIcon: 'fui-RatingItem__selectedIcon',\n unselectedIcon: 'fui-RatingItem__unselectedIcon',\n halfValueInput: 'fui-RatingItem__halfValueInput',\n fullValueInput: 'fui-RatingItem__fullValueInput'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n position: 'relative',\n ...createFocusOutlineStyle({\n style: {},\n selector: 'focus-within'\n })\n },\n small: {\n fontSize: '12px',\n width: '12px',\n height: '12px'\n },\n medium: {\n fontSize: '16px',\n width: '16px',\n height: '16px'\n },\n large: {\n fontSize: '20px',\n width: '20px',\n height: '20px'\n },\n 'extra-large': {\n fontSize: '28px',\n width: '28px',\n height: '28px'\n }\n});\nconst useInputBaseClassName = makeResetStyles({\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n boxSizing: 'border-box',\n margin: 0,\n opacity: 0,\n cursor: 'pointer',\n height: '100%'\n});\nconst useInputStyles = makeStyles({\n lowerHalf: {\n right: '50%'\n },\n upperHalf: {\n left: '50%'\n }\n});\nconst useIndicatorBaseClassName = makeResetStyles({\n display: 'flex',\n overflow: 'hidden',\n color: tokens.colorNeutralForeground1,\n fill: 'currentColor',\n pointerEvents: 'none',\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n});\nconst useIndicatorStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n '& > svg': {\n ...shorthands.flex(0, 0, 'auto')\n }\n },\n upperHalf: {\n left: '50%',\n marginLeft: '-50%'\n },\n brand: {\n color: tokens.colorBrandForeground1\n },\n marigold: {\n color: tokens.colorPaletteMarigoldBorderActive\n },\n filled: {\n color: tokens.colorNeutralBackground6,\n stroke: tokens.colorTransparentStroke,\n '@media (forced-colors: active)': {\n color: 'Canvas',\n stroke: 'CanvasText'\n }\n },\n brandFilled: {\n color: tokens.colorBrandBackground2\n },\n marigoldFilled: {\n color: tokens.colorPaletteMarigoldBackground2\n }\n});\n/**\n * Apply styling to the RatingItem slots based on the state\n */ export const useRatingItemStyles_unstable = (state)=>{\n const { color, size, iconFillWidth, appearance } = state;\n const styles = useStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n if (state.halfValueInput) {\n state.halfValueInput.className = mergeClasses(ratingItemClassNames.halfValueInput, inputBaseClassName, inputStyles.lowerHalf, state.halfValueInput.className);\n }\n if (state.fullValueInput) {\n state.fullValueInput.className = mergeClasses(ratingItemClassNames.fullValueInput, inputBaseClassName, state.halfValueInput && inputStyles.upperHalf, state.fullValueInput.className);\n }\n if (state.unselectedIcon) {\n state.unselectedIcon.className = mergeClasses(ratingItemClassNames.unselectedIcon, indicatorBaseClassName, appearance === 'filled' && indicatorStyles.filled, color === 'brand' && (appearance === 'filled' ? indicatorStyles.brandFilled : indicatorStyles.brand), color === 'marigold' && (appearance === 'filled' ? indicatorStyles.marigoldFilled : indicatorStyles.marigold), iconFillWidth === 0.5 && indicatorStyles.upperHalf, state.unselectedIcon.className);\n }\n if (state.selectedIcon) {\n state.selectedIcon.className = mergeClasses(ratingItemClassNames.selectedIcon, indicatorBaseClassName, color === 'brand' && indicatorStyles.brand, color === 'marigold' && indicatorStyles.marigold, iconFillWidth === 0.5 && indicatorStyles.lowerHalf, state.selectedIcon.className);\n }\n return state;\n};\n"],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { StarFilled, StarRegular } from '@fluentui/react-icons';
3
+ /**
4
+ * RatingContext is provided by Rating, and is consumed by Rating to determine default values of some props.
5
+ */ export const RatingItemContext = /*#__PURE__*/ React.createContext(undefined);
6
+ const ratingItemContextDefaultValue = {
7
+ color: 'neutral',
8
+ iconFilled: StarFilled,
9
+ iconOutline: StarRegular,
10
+ step: 1,
11
+ size: 'medium'
12
+ };
13
+ export const RatingItemProvider = RatingItemContext.Provider;
14
+ /**
15
+ * Get the value of the RatingContext.
16
+ */ export const useRatingItemContextValue_unstable = ()=>React.useContext(RatingItemContext) || ratingItemContextDefaultValue;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RatingItemContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { RatingItemContextValue } from '../RatingItem';\nimport { StarFilled, StarRegular } from '@fluentui/react-icons';\n\n/**\n * RatingContext is provided by Rating, and is consumed by Rating to determine default values of some props.\n */\nexport const RatingItemContext = React.createContext<RatingItemContextValue | undefined>(undefined);\nconst ratingItemContextDefaultValue: RatingItemContextValue = {\n color: 'neutral',\n iconFilled: StarFilled,\n iconOutline: StarRegular,\n step: 1,\n size: 'medium',\n};\nexport const RatingItemProvider = RatingItemContext.Provider;\n\n/**\n * Get the value of the RatingContext.\n */\nexport const useRatingItemContextValue_unstable = () =>\n React.useContext(RatingItemContext) || ratingItemContextDefaultValue;\n"],"names":["React","StarFilled","StarRegular","RatingItemContext","createContext","undefined","ratingItemContextDefaultValue","color","iconFilled","iconOutline","step","size","RatingItemProvider","Provider","useRatingItemContextValue_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,UAAU,EAAEC,WAAW,QAAQ,wBAAwB;AAEhE;;CAEC,GACD,OAAO,MAAMC,kCAAoBH,MAAMI,aAAa,CAAqCC,WAAW;AACpG,MAAMC,gCAAwD;IAC5DC,OAAO;IACPC,YAAYP;IACZQ,aAAaP;IACbQ,MAAM;IACNC,MAAM;AACR;AACA,OAAO,MAAMC,qBAAqBT,kBAAkBU,QAAQ,CAAC;AAE7D;;CAEC,GACD,OAAO,MAAMC,qCAAqC,IAChDd,MAAMe,UAAU,CAACZ,sBAAsBG,8BAA8B"}
@@ -0,0 +1 @@
1
+ export * from './RatingItemContext';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './RatingItemContext';\n"],"names":[],"mappings":"AAAA,cAAc,sBAAsB"}
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { Rating, ratingClassNames, renderRating_unstable, useRatingStyles_unstable, useRating_unstable, useRatingContextValues } from './Rating';
2
+ export { RatingItem, ratingItemClassNames, renderRatingItem_unstable, useRatingItemStyles_unstable, useRatingItem_unstable } from './RatingItem';
3
+ export { RatingItemProvider, useRatingItemContextValue_unstable } from './contexts/index';
4
+ export { RatingDisplay, ratingDisplayClassNames, renderRatingDisplay_unstable, useRatingDisplayStyles_unstable, useRatingDisplay_unstable, useRatingDisplayContextValues } from './RatingDisplay';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n Rating,\n ratingClassNames,\n renderRating_unstable,\n useRatingStyles_unstable,\n useRating_unstable,\n useRatingContextValues,\n} from './Rating';\nexport type { RatingProps, RatingSlots, RatingState, RatingOnChangeEventData, RatingContextValues } from './Rating';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n} from './RatingItem';\nexport type { RatingItemProps, RatingItemSlots, RatingItemState } from './RatingItem';\nexport { RatingItemProvider, useRatingItemContextValue_unstable } from './contexts/index';\nexport {\n RatingDisplay,\n ratingDisplayClassNames,\n renderRatingDisplay_unstable,\n useRatingDisplayStyles_unstable,\n useRatingDisplay_unstable,\n useRatingDisplayContextValues,\n} from './RatingDisplay';\nexport type {\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n RatingDisplayContextValues,\n} from './RatingDisplay';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingStyles_unstable","useRating_unstable","useRatingContextValues","RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable","RatingItemProvider","useRatingItemContextValue_unstable","RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayStyles_unstable","useRatingDisplay_unstable","useRatingDisplayContextValues"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB,WAAW;AAElB,SACEC,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAEtB,SAASC,kBAAkB,EAAEC,kCAAkC,QAAQ,mBAAmB;AAC1F,SACEC,aAAa,EACbC,uBAAuB,EACvBC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,yBAAyB,EACzBC,6BAA6B,QACxB,kBAAkB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/Rating/index"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Rating.js"],"sourcesContent":["export * from './components/Rating/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/RatingDisplay/index"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RatingDisplay.js"],"sourcesContent":["export * from './components/RatingDisplay/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/RatingItem/index"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RatingItem.js"],"sourcesContent":["export * from './components/RatingItem/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Rating", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return Rating;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _useRating = require("./useRating");
14
+ const _renderRating = require("./renderRating");
15
+ const _useRatingStylesstyles = require("./useRatingStyles.styles");
16
+ const _useRatingContextValues = require("./useRatingContextValues");
17
+ const Rating = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
18
+ const state = (0, _useRating.useRating_unstable)(props, ref);
19
+ const contextValues = (0, _useRatingContextValues.useRatingContextValues)(state);
20
+ (0, _useRatingStylesstyles.useRatingStyles_unstable)(state);
21
+ return (0, _renderRating.renderRating_unstable)(state, contextValues);
22
+ });
23
+ Rating.displayName = 'Rating';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Rating.js"],"sourcesContent":["import * as React from 'react';\nimport { useRating_unstable } from './useRating';\nimport { renderRating_unstable } from './renderRating';\nimport { useRatingStyles_unstable } from './useRatingStyles.styles';\nimport { useRatingContextValues } from './useRatingContextValues';\n/**\n * Rating is a wrapper for one or more rating items that will be used to set a rating value.\n */ export const Rating = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useRating_unstable(props, ref);\n const contextValues = useRatingContextValues(state);\n useRatingStyles_unstable(state);\n return renderRating_unstable(state, contextValues);\n});\nRating.displayName = 'Rating';\n"],"names":["Rating","React","forwardRef","props","ref","state","useRating_unstable","contextValues","useRatingContextValues","useRatingStyles_unstable","renderRating_unstable","displayName"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;2BACY;8BACG;uCACG;wCACF;AAG5B,MAAMA,SAAS,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC7D,MAAMC,QAAQC,IAAAA,6BAAkB,EAACH,OAAOC;IACxC,MAAMG,gBAAgBC,IAAAA,8CAAsB,EAACH;IAC7CI,IAAAA,+CAAwB,EAACJ;IACzB,OAAOK,IAAAA,mCAAqB,EAACL,OAAOE;AACxC;AACAP,OAAOW,WAAW,GAAG"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Rating.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./Rating"), exports);
7
+ _export_star._(require("./Rating.types"), exports);
8
+ _export_star._(require("./renderRating"), exports);
9
+ _export_star._(require("./useRating"), exports);
10
+ _export_star._(require("./useRatingStyles.styles"), exports);
11
+ _export_star._(require("./useRatingContextValues"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './Rating';\nexport * from './Rating.types';\nexport * from './renderRating';\nexport * from './useRating';\nexport * from './useRatingStyles.styles';\nexport * from './useRatingContextValues';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderRating_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderRating_unstable;
9
+ }
10
+ });
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const _RatingItemContext = require("../../contexts/RatingItemContext");
14
+ const renderRating_unstable = (state, contextValues)=>{
15
+ (0, _reactutilities.assertSlots)(state);
16
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RatingItemContext.RatingItemProvider, {
17
+ value: contextValues.ratingItem,
18
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
19
+ });
20
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderRating.js"],"sourcesContent":[" import { jsx as _jsx } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n/**\n * Render the final JSX of Rating\n */ export const renderRating_unstable = (state, contextValues)=>{\n assertSlots(state);\n return /*#__PURE__*/ _jsx(RatingItemProvider, {\n value: contextValues.ratingItem,\n children: /*#__PURE__*/ _jsx(state.root, {})\n });\n};\n"],"names":["renderRating_unstable","state","contextValues","assertSlots","_jsx","RatingItemProvider","value","ratingItem","children","root"],"mappings":";;;;+BAKiBA;;;eAAAA;;;4BALa;gCACF;mCACO;AAGxB,MAAMA,wBAAwB,CAACC,OAAOC;IAC7CC,IAAAA,2BAAW,EAACF;IACZ,OAAO,WAAW,GAAGG,IAAAA,eAAI,EAACC,qCAAkB,EAAE;QAC1CC,OAAOJ,cAAcK,UAAU;QAC/BC,UAAU,WAAW,GAAGJ,IAAAA,eAAI,EAACH,MAAMQ,IAAI,EAAE,CAAC;IAC9C;AACJ"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useRating_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useRating_unstable;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactutilities = require("@fluentui/react-utilities");
14
+ const _RatingItem = require("../../RatingItem");
15
+ const _reacticons = require("@fluentui/react-icons");
16
+ const useRating_unstable = (props, ref)=>{
17
+ const generatedName = (0, _reactutilities.useId)('rating-');
18
+ const { color = 'neutral', iconFilled = _reacticons.StarFilled, iconOutline = _reacticons.StarRegular, max = 5, name = generatedName, onChange, step = 1, size = 'extra-large' } = props;
19
+ const [value, setValue] = (0, _reactutilities.useControllableState)({
20
+ state: props.value,
21
+ defaultState: props.defaultValue,
22
+ initialState: 0
23
+ });
24
+ const isRatingRadioItem = (target)=>(0, _reactutilities.isHTMLElement)(target, {
25
+ constructorName: 'HTMLInputElement'
26
+ }) && target.type === 'radio' && target.name === name;
27
+ const [hoveredValue, setHoveredValue] = _react.useState(undefined);
28
+ // Generate the child RatingItems and memoize them to prevent unnecessary re-rendering
29
+ const rootChildren = _react.useMemo(()=>{
30
+ return Array.from(Array(max), (_, i)=>/*#__PURE__*/ _react.createElement(_RatingItem.RatingItem, {
31
+ value: i + 1,
32
+ key: i + 1
33
+ }));
34
+ }, [
35
+ max
36
+ ]);
37
+ const state = {
38
+ color,
39
+ iconFilled,
40
+ iconOutline,
41
+ name,
42
+ step,
43
+ size,
44
+ value,
45
+ hoveredValue,
46
+ components: {
47
+ root: 'div'
48
+ },
49
+ root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
50
+ ref,
51
+ children: rootChildren,
52
+ role: 'radiogroup',
53
+ ...props
54
+ }, [
55
+ 'onChange'
56
+ ]), {
57
+ elementType: 'div'
58
+ })
59
+ };
60
+ state.root.onChange = (ev)=>{
61
+ if (isRatingRadioItem(ev.target)) {
62
+ const newValue = parseFloat(ev.target.value);
63
+ if (!isNaN(newValue)) {
64
+ setValue(newValue);
65
+ onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
66
+ type: 'change',
67
+ event: ev,
68
+ value: newValue
69
+ });
70
+ }
71
+ }
72
+ };
73
+ state.root.onMouseOver = (0, _reactutilities.mergeCallbacks)(props.onMouseOver, (ev)=>{
74
+ if (isRatingRadioItem(ev.target)) {
75
+ const newValue = parseFloat(ev.target.value);
76
+ if (!isNaN(newValue)) {
77
+ setHoveredValue(newValue);
78
+ }
79
+ }
80
+ });
81
+ state.root.onMouseLeave = (0, _reactutilities.mergeCallbacks)(props.onMouseLeave, (ev)=>{
82
+ setHoveredValue(undefined);
83
+ });
84
+ return state;
85
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRating.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, isHTMLElement, mergeCallbacks, slot, useControllableState, useId } from '@fluentui/react-utilities';\nimport { RatingItem } from '../../RatingItem';\nimport { StarFilled, StarRegular } from '@fluentui/react-icons';\n/**\n * Create the state required to render Rating.\n *\n * The returned state can be modified with hooks such as useRatingStyles_unstable,\n * before being passed to renderRating_unstable.\n *\n * @param props - props from this instance of Rating\n * @param ref - reference to root HTMLElement of Rating\n */ export const useRating_unstable = (props, ref)=>{\n const generatedName = useId('rating-');\n const { color = 'neutral', iconFilled = StarFilled, iconOutline = StarRegular, max = 5, name = generatedName, onChange, step = 1, size = 'extra-large' } = props;\n const [value, setValue] = useControllableState({\n state: props.value,\n defaultState: props.defaultValue,\n initialState: 0\n });\n const isRatingRadioItem = (target)=>isHTMLElement(target, {\n constructorName: 'HTMLInputElement'\n }) && target.type === 'radio' && target.name === name;\n const [hoveredValue, setHoveredValue] = React.useState(undefined);\n // Generate the child RatingItems and memoize them to prevent unnecessary re-rendering\n const rootChildren = React.useMemo(()=>{\n return Array.from(Array(max), (_, i)=>/*#__PURE__*/ React.createElement(RatingItem, {\n value: i + 1,\n key: i + 1\n }));\n }, [\n max\n ]);\n const state = {\n color,\n iconFilled,\n iconOutline,\n name,\n step,\n size,\n value,\n hoveredValue,\n components: {\n root: 'div'\n },\n root: slot.always(getIntrinsicElementProps('div', {\n ref,\n children: rootChildren,\n role: 'radiogroup',\n ...props\n }, [\n 'onChange'\n ]), {\n elementType: 'div'\n })\n };\n state.root.onChange = (ev)=>{\n if (isRatingRadioItem(ev.target)) {\n const newValue = parseFloat(ev.target.value);\n if (!isNaN(newValue)) {\n setValue(newValue);\n onChange === null || onChange === void 0 ? void 0 : onChange(ev, {\n type: 'change',\n event: ev,\n value: newValue\n });\n }\n }\n };\n state.root.onMouseOver = mergeCallbacks(props.onMouseOver, (ev)=>{\n if (isRatingRadioItem(ev.target)) {\n const newValue = parseFloat(ev.target.value);\n if (!isNaN(newValue)) {\n setHoveredValue(newValue);\n }\n }\n });\n state.root.onMouseLeave = mergeCallbacks(props.onMouseLeave, (ev)=>{\n setHoveredValue(undefined);\n });\n return state;\n};\n"],"names":["useRating_unstable","props","ref","generatedName","useId","color","iconFilled","StarFilled","iconOutline","StarRegular","max","name","onChange","step","size","value","setValue","useControllableState","state","defaultState","defaultValue","initialState","isRatingRadioItem","target","isHTMLElement","constructorName","type","hoveredValue","setHoveredValue","React","useState","undefined","rootChildren","useMemo","Array","from","_","i","createElement","RatingItem","key","components","root","slot","always","getIntrinsicElementProps","children","role","elementType","ev","newValue","parseFloat","isNaN","event","onMouseOver","mergeCallbacks","onMouseLeave"],"mappings":";;;;+BAYiBA;;;eAAAA;;;;iEAZM;gCACoF;4BAChF;4BACa;AAS7B,MAAMA,qBAAqB,CAACC,OAAOC;IAC1C,MAAMC,gBAAgBC,IAAAA,qBAAK,EAAC;IAC5B,MAAM,EAAEC,QAAQ,SAAS,EAAEC,aAAaC,sBAAU,EAAEC,cAAcC,uBAAW,EAAEC,MAAM,CAAC,EAAEC,OAAOR,aAAa,EAAES,QAAQ,EAAEC,OAAO,CAAC,EAAEC,OAAO,aAAa,EAAE,GAAGb;IAC3J,MAAM,CAACc,OAAOC,SAAS,GAAGC,IAAAA,oCAAoB,EAAC;QAC3CC,OAAOjB,MAAMc,KAAK;QAClBI,cAAclB,MAAMmB,YAAY;QAChCC,cAAc;IAClB;IACA,MAAMC,oBAAoB,CAACC,SAASC,IAAAA,6BAAa,EAACD,QAAQ;YAClDE,iBAAiB;QACrB,MAAMF,OAAOG,IAAI,KAAK,WAAWH,OAAOZ,IAAI,KAAKA;IACrD,MAAM,CAACgB,cAAcC,gBAAgB,GAAGC,OAAMC,QAAQ,CAACC;IACvD,sFAAsF;IACtF,MAAMC,eAAeH,OAAMI,OAAO,CAAC;QAC/B,OAAOC,MAAMC,IAAI,CAACD,MAAMxB,MAAM,CAAC0B,GAAGC,IAAI,WAAW,GAAGR,OAAMS,aAAa,CAACC,sBAAU,EAAE;gBAC5ExB,OAAOsB,IAAI;gBACXG,KAAKH,IAAI;YACb;IACR,GAAG;QACC3B;KACH;IACD,MAAMQ,QAAQ;QACVb;QACAC;QACAE;QACAG;QACAE;QACAC;QACAC;QACAY;QACAc,YAAY;YACRC,MAAM;QACV;QACAA,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,wCAAwB,EAAC,OAAO;YAC9C3C;YACA4C,UAAUd;YACVe,MAAM;YACN,GAAG9C,KAAK;QACZ,GAAG;YACC;SACH,GAAG;YACA+C,aAAa;QACjB;IACJ;IACA9B,MAAMwB,IAAI,CAAC9B,QAAQ,GAAG,CAACqC;QACnB,IAAI3B,kBAAkB2B,GAAG1B,MAAM,GAAG;YAC9B,MAAM2B,WAAWC,WAAWF,GAAG1B,MAAM,CAACR,KAAK;YAC3C,IAAI,CAACqC,MAAMF,WAAW;gBAClBlC,SAASkC;gBACTtC,aAAa,QAAQA,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASqC,IAAI;oBAC7DvB,MAAM;oBACN2B,OAAOJ;oBACPlC,OAAOmC;gBACX;YACJ;QACJ;IACJ;IACAhC,MAAMwB,IAAI,CAACY,WAAW,GAAGC,IAAAA,8BAAc,EAACtD,MAAMqD,WAAW,EAAE,CAACL;QACxD,IAAI3B,kBAAkB2B,GAAG1B,MAAM,GAAG;YAC9B,MAAM2B,WAAWC,WAAWF,GAAG1B,MAAM,CAACR,KAAK;YAC3C,IAAI,CAACqC,MAAMF,WAAW;gBAClBtB,gBAAgBsB;YACpB;QACJ;IACJ;IACAhC,MAAMwB,IAAI,CAACc,YAAY,GAAGD,IAAAA,8BAAc,EAACtD,MAAMuD,YAAY,EAAE,CAACP;QAC1DrB,gBAAgBG;IACpB;IACA,OAAOb;AACX"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useRatingContextValues", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useRatingContextValues;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const useRatingContextValues = (ratingState)=>{
14
+ const { color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value } = ratingState;
15
+ const ratingItem = _react.useMemo(()=>({
16
+ color,
17
+ hoveredValue,
18
+ iconFilled,
19
+ iconOutline,
20
+ interactive: true,
21
+ itemLabel,
22
+ name,
23
+ step,
24
+ size,
25
+ value
26
+ }), [
27
+ color,
28
+ hoveredValue,
29
+ iconFilled,
30
+ iconOutline,
31
+ itemLabel,
32
+ name,
33
+ step,
34
+ size,
35
+ value
36
+ ]);
37
+ return {
38
+ ratingItem
39
+ };
40
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRatingContextValues.js"],"sourcesContent":["import * as React from 'react';\nexport const useRatingContextValues = (ratingState)=>{\n const { color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value } = ratingState;\n const ratingItem = React.useMemo(()=>({\n color,\n hoveredValue,\n iconFilled,\n iconOutline,\n interactive: true,\n itemLabel,\n name,\n step,\n size,\n value\n }), [\n color,\n hoveredValue,\n iconFilled,\n iconOutline,\n itemLabel,\n name,\n step,\n size,\n value\n ]);\n return {\n ratingItem\n };\n};\n"],"names":["useRatingContextValues","ratingState","color","hoveredValue","iconFilled","iconOutline","itemLabel","name","step","size","value","ratingItem","React","useMemo","interactive"],"mappings":";;;;+BACaA;;;eAAAA;;;;iEADU;AAChB,MAAMA,yBAAyB,CAACC;IACnC,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGT;IAC7F,MAAMU,aAAaC,OAAMC,OAAO,CAAC,IAAK,CAAA;YAC9BX;YACAC;YACAC;YACAC;YACAS,aAAa;YACbR;YACAC;YACAC;YACAC;YACAC;QACJ,CAAA,GAAI;QACJR;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;IACD,OAAO;QACHC;IACJ;AACJ"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ratingClassNames: function() {
13
+ return ratingClassNames;
14
+ },
15
+ useRatingStyles_unstable: function() {
16
+ return useRatingStyles_unstable;
17
+ }
18
+ });
19
+ const _react = require("@griffel/react");
20
+ const ratingClassNames = {
21
+ root: 'fui-Rating'
22
+ };
23
+ /**
24
+ * Styles for the root slot
25
+ */ const useRootClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r2imjyh", null, [
26
+ ".r2imjyh{display:flex;flex-wrap:wrap;}"
27
+ ]);
28
+ const useRatingStyles_unstable = (state)=>{
29
+ const rootClassName = useRootClassName();
30
+ state.root.className = (0, _react.mergeClasses)(ratingClassNames.root, rootClassName, state.root.className);
31
+ return state;
32
+ }; //# sourceMappingURL=useRatingStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRatingStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses } from '@griffel/react';\nexport const ratingClassNames = {\n root: 'fui-Rating'\n};\n/**\n * Styles for the root slot\n */\nconst useRootClassName = /*#__PURE__*/__resetStyles(\"r2imjyh\", null, [\".r2imjyh{display:flex;flex-wrap:wrap;}\"]);\n/**\n * Apply styling to the Rating slots based on the state\n */\nexport const useRatingStyles_unstable = state => {\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n//# sourceMappingURL=useRatingStyles.styles.js.map"],"names":["ratingClassNames","useRatingStyles_unstable","root","useRootClassName","__resetStyles","state","rootClassName","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,gBAAgB;eAAhBA;;IAUAC,wBAAwB;eAAxBA;;;uBAX+B;AACrC,MAAMD,mBAAmB;IAC9BE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,mBAAmB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,WAAW,MAAM;IAAC;CAAyC;AAIxG,MAAMH,2BAA2BI,CAAAA;IACtC,MAAMC,gBAAgBH;IACtBE,MAAMH,IAAI,CAACK,SAAS,GAAGC,IAAAA,mBAAY,EAACR,iBAAiBE,IAAI,EAAEI,eAAeD,MAAMH,IAAI,CAACK,SAAS;IAC9F,OAAOF;AACT,GACA,kDAAkD"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "RatingDisplay", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return RatingDisplay;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _useRatingDisplay = require("./useRatingDisplay");
14
+ const _renderRatingDisplay = require("./renderRatingDisplay");
15
+ const _useRatingDisplayStylesstyles = require("./useRatingDisplayStyles.styles");
16
+ const _useRatingDisplayContextValues = require("./useRatingDisplayContextValues");
17
+ const RatingDisplay = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
18
+ const state = (0, _useRatingDisplay.useRatingDisplay_unstable)(props, ref);
19
+ const contextValues = (0, _useRatingDisplayContextValues.useRatingDisplayContextValues)(state);
20
+ (0, _useRatingDisplayStylesstyles.useRatingDisplayStyles_unstable)(state);
21
+ return (0, _renderRatingDisplay.renderRatingDisplay_unstable)(state, contextValues);
22
+ });
23
+ RatingDisplay.displayName = 'RatingDisplay';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RatingDisplay.js"],"sourcesContent":["import * as React from 'react';\nimport { useRatingDisplay_unstable } from './useRatingDisplay';\nimport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nimport { useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nimport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n/**\n * RatingDisplay is a wrapper for one or more rating items that will be used to display a rating value\n * as well as the label for the rating.\n */ export const RatingDisplay = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useRatingDisplay_unstable(props, ref);\n const contextValues = useRatingDisplayContextValues(state);\n useRatingDisplayStyles_unstable(state);\n return renderRatingDisplay_unstable(state, contextValues);\n});\nRatingDisplay.displayName = 'RatingDisplay';\n"],"names":["RatingDisplay","React","forwardRef","props","ref","state","useRatingDisplay_unstable","contextValues","useRatingDisplayContextValues","useRatingDisplayStyles_unstable","renderRatingDisplay_unstable","displayName"],"mappings":";;;;+BAQiBA;;;eAAAA;;;;iEARM;kCACmB;qCACG;8CACG;+CACF;AAInC,MAAMA,gBAAgB,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACpE,MAAMC,QAAQC,IAAAA,2CAAyB,EAACH,OAAOC;IAC/C,MAAMG,gBAAgBC,IAAAA,4DAA6B,EAACH;IACpDI,IAAAA,6DAA+B,EAACJ;IAChC,OAAOK,IAAAA,iDAA4B,EAACL,OAAOE;AAC/C;AACAP,cAAcW,WAAW,GAAG"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RatingDisplay.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./RatingDisplay"), exports);
7
+ _export_star._(require("./RatingDisplay.types"), exports);
8
+ _export_star._(require("./renderRatingDisplay"), exports);
9
+ _export_star._(require("./useRatingDisplay"), exports);
10
+ _export_star._(require("./useRatingDisplayStyles.styles"), exports);
11
+ _export_star._(require("./useRatingDisplayContextValues"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './RatingDisplay';\nexport * from './RatingDisplay.types';\nexport * from './renderRatingDisplay';\nexport * from './useRatingDisplay';\nexport * from './useRatingDisplayStyles.styles';\nexport * from './useRatingDisplayContextValues';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderRatingDisplay_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderRatingDisplay_unstable;
9
+ }
10
+ });
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const _RatingItemContext = require("../../contexts/RatingItemContext");
14
+ const renderRatingDisplay_unstable = (state, contextValues)=>{
15
+ (0, _reactutilities.assertSlots)(state);
16
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RatingItemContext.RatingItemProvider, {
17
+ value: contextValues.ratingItem,
18
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
19
+ children: [
20
+ state.root.children,
21
+ state.valueText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.valueText, {}),
22
+ state.countText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.countText, {})
23
+ ]
24
+ })
25
+ });
26
+ };