@fluentui/react-rating 9.3.0 → 9.3.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.
- package/CHANGELOG.md +13 -2
- package/lib/Rating.js.map +1 -1
- package/lib/RatingDisplay.js.map +1 -1
- package/lib/RatingItem.js.map +1 -1
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/Rating/Rating.types.js.map +1 -1
- package/lib/components/Rating/index.js.map +1 -1
- package/lib/components/Rating/renderRating.js.map +1 -1
- package/lib/components/Rating/useRating.js.map +1 -1
- package/lib/components/Rating/useRatingContextValues.js.map +1 -1
- package/lib/components/Rating/useRatingStyles.styles.raw.js.map +1 -1
- package/lib/components/RatingDisplay/RatingDisplay.js.map +1 -1
- package/lib/components/RatingDisplay/RatingDisplay.types.js.map +1 -1
- package/lib/components/RatingDisplay/index.js.map +1 -1
- package/lib/components/RatingDisplay/renderRatingDisplay.js.map +1 -1
- package/lib/components/RatingDisplay/useRatingDisplay.js.map +1 -1
- package/lib/components/RatingDisplay/useRatingDisplayContextValues.js.map +1 -1
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.raw.js.map +1 -1
- package/lib/components/RatingItem/RatingItem.js.map +1 -1
- package/lib/components/RatingItem/RatingItem.types.js.map +1 -1
- package/lib/components/RatingItem/index.js.map +1 -1
- package/lib/components/RatingItem/renderRatingItem.js.map +1 -1
- package/lib/components/RatingItem/useRatingItem.js.map +1 -1
- package/lib/components/RatingItem/useRatingItemStyles.styles.raw.js.map +1 -1
- package/lib/contexts/RatingItemContext.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Rating.js.map +1 -1
- package/lib-commonjs/RatingDisplay.js.map +1 -1
- package/lib-commonjs/RatingItem.js.map +1 -1
- package/lib-commonjs/components/Rating/Rating.js.map +1 -1
- package/lib-commonjs/components/Rating/Rating.types.js.map +1 -1
- package/lib-commonjs/components/Rating/index.js.map +1 -1
- package/lib-commonjs/components/Rating/renderRating.js.map +1 -1
- package/lib-commonjs/components/Rating/useRating.js.map +1 -1
- package/lib-commonjs/components/Rating/useRatingContextValues.js.map +1 -1
- package/lib-commonjs/components/Rating/useRatingStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Rating/useRatingStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/RatingDisplay.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/RatingDisplay.types.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/index.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/renderRatingDisplay.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplay.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayContextValues.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +1 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/RatingItem/RatingItem.js.map +1 -1
- package/lib-commonjs/components/RatingItem/RatingItem.types.js.map +1 -1
- package/lib-commonjs/components/RatingItem/index.js.map +1 -1
- package/lib-commonjs/components/RatingItem/renderRatingItem.js.map +1 -1
- package/lib-commonjs/components/RatingItem/useRatingItem.js.map +1 -1
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.js.map +1 -1
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/contexts/RatingItemContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-rating
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 28 Jul 2025 18:44:12 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating_v9.3.1)
|
|
8
|
+
|
|
9
|
+
Mon, 28 Jul 2025 18:44:12 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating_v9.3.0..@fluentui/react-rating_v9.3.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-jsx-runtime to v9.1.3 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
|
|
15
|
+
- Bump @fluentui/react-tabster to v9.26.1 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
|
|
16
|
+
- Bump @fluentui/react-utilities to v9.23.0 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
|
|
17
|
+
|
|
7
18
|
## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-rating_v9.3.0)
|
|
8
19
|
|
|
9
|
-
Thu, 17 Jul 2025 13:
|
|
20
|
+
Thu, 17 Jul 2025 13:49:45 GMT
|
|
10
21
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-rating_v9.2.3..@fluentui/react-rating_v9.3.0)
|
|
11
22
|
|
|
12
23
|
### Minor changes
|
package/lib/Rating.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Rating.ts"],"sourcesContent":["export type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './components/Rating/index';\nexport {\n Rating,\n ratingClassNames,\n renderRating_unstable,\n useRatingContextValues,\n useRatingStyles_unstable,\n useRating_unstable,\n} from './components/Rating/index';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingContextValues","useRatingStyles_unstable","useRating_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/Rating.ts"],"sourcesContent":["export type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './components/Rating/index';\nexport {\n Rating,\n ratingClassNames,\n renderRating_unstable,\n useRatingContextValues,\n useRatingStyles_unstable,\n useRating_unstable,\n} from './components/Rating/index';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingContextValues","useRatingStyles_unstable","useRating_unstable"],"mappings":"AAOA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,sBAAsB,EACtBC,wBAAwB,EACxBC,kBAAkB,QACb,4BAA4B"}
|
package/lib/RatingDisplay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RatingDisplay.ts"],"sourcesContent":["export type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './components/RatingDisplay/index';\nexport {\n RatingDisplay,\n ratingDisplayClassNames,\n renderRatingDisplay_unstable,\n useRatingDisplayContextValues,\n useRatingDisplayStyles_unstable,\n useRatingDisplay_unstable,\n} from './components/RatingDisplay/index';\n"],"names":["RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayContextValues","useRatingDisplayStyles_unstable","useRatingDisplay_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/RatingDisplay.ts"],"sourcesContent":["export type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './components/RatingDisplay/index';\nexport {\n RatingDisplay,\n ratingDisplayClassNames,\n renderRatingDisplay_unstable,\n useRatingDisplayContextValues,\n useRatingDisplayStyles_unstable,\n useRatingDisplay_unstable,\n} from './components/RatingDisplay/index';\n"],"names":["RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayContextValues","useRatingDisplayStyles_unstable","useRatingDisplay_unstable"],"mappings":"AAMA,SACEA,aAAa,EACbC,uBAAuB,EACvBC,4BAA4B,EAC5BC,6BAA6B,EAC7BC,+BAA+B,EAC/BC,yBAAyB,QACpB,mCAAmC"}
|
package/lib/RatingItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RatingItem.ts"],"sourcesContent":["export type {\n RatingItemContextValue,\n RatingItemProps,\n RatingItemSlots,\n RatingItemState,\n} from './components/RatingItem/index';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n} from './components/RatingItem/index';\n"],"names":["RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/RatingItem.ts"],"sourcesContent":["export type {\n RatingItemContextValue,\n RatingItemProps,\n RatingItemSlots,\n RatingItemState,\n} from './components/RatingItem/index';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n} from './components/RatingItem/index';\n"],"names":["RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable"],"mappings":"AAMA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useRatingStyles_unstable')(state);\n return renderRating_unstable(state, contextValues);\n});\n\nRating.displayName = 'Rating';\n"],"names":["React","useRating_unstable","renderRating_unstable","useRatingStyles_unstable","useRatingContextValues","useCustomStyleHook_unstable","Rating","forwardRef","props","ref","state","contextValues","displayName"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useRatingStyles_unstable')(state);\n return renderRating_unstable(state, contextValues);\n});\n\nRating.displayName = 'Rating';\n"],"names":["React","useRating_unstable","renderRating_unstable","useRatingStyles_unstable","useRatingContextValues","useCustomStyleHook_unstable","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;AAClE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQT,mBAAmBO,OAAOC;IACxC,MAAME,gBAAgBP,uBAAuBM;IAE7CP,yBAAyBO;IACzBL,4BAA4B,4BAA4BK;IACxD,OAAOR,sBAAsBQ,OAAOC;AACtC,GAAG;AAEHL,OAAOM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/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"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/index.ts"],"sourcesContent":["export { Rating } from './Rating';\nexport type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './Rating.types';\nexport { renderRating_unstable } from './renderRating';\nexport { useRating_unstable } from './useRating';\nexport { ratingClassNames, useRatingStyles_unstable } from './useRatingStyles.styles';\nexport { useRatingContextValues } from './useRatingContextValues';\n"],"names":["Rating","renderRating_unstable","useRating_unstable","ratingClassNames","useRatingStyles_unstable","useRatingContextValues"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/index.ts"],"sourcesContent":["export { Rating } from './Rating';\nexport type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './Rating.types';\nexport { renderRating_unstable } from './renderRating';\nexport { useRating_unstable } from './useRating';\nexport { ratingClassNames, useRatingStyles_unstable } from './useRatingStyles.styles';\nexport { useRatingContextValues } from './useRatingContextValues';\n"],"names":["Rating","renderRating_unstable","useRating_unstable","ratingClassNames","useRatingStyles_unstable","useRatingContextValues"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAQlC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,2BAA2B;AACtF,SAASC,sBAAsB,QAAQ,2BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/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"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRating.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isHTMLElement,\n mergeCallbacks,\n slot,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport type { RatingProps, RatingState } from './Rating.types';\nimport { RatingItem } from '../../RatingItem';\nimport { StarFilled, StarRegular } from '@fluentui/react-icons';\n\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 */\nexport const useRating_unstable = (props: RatingProps, ref: React.Ref<HTMLDivElement>): RatingState => {\n const generatedName = useId('rating-');\n const {\n color = 'neutral',\n iconFilled = StarFilled,\n iconOutline = StarRegular,\n max = 5,\n name = generatedName,\n onChange,\n step = 1,\n size = 'extra-large',\n itemLabel,\n } = props;\n\n const [value, setValue] = useControllableState({\n state: props.value,\n defaultState: props.defaultValue,\n initialState: 0,\n });\n\n const isRatingRadioItem = (target: EventTarget): target is HTMLInputElement =>\n isHTMLElement(target, { constructorName: 'HTMLInputElement' }) && target.type === 'radio' && target.name === name;\n\n const [hoveredValue, setHoveredValue] = React.useState<number | undefined>(undefined);\n\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) => <RatingItem value={i + 1} key={i + 1} />);\n }, [max]);\n\n const state: RatingState = {\n color,\n iconFilled,\n iconOutline,\n name,\n step,\n size,\n itemLabel,\n value,\n hoveredValue,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n ref,\n children: rootChildren,\n role: 'radiogroup',\n ...props,\n },\n ['onChange'],\n ),\n { elementType: 'div' },\n ),\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?.(ev, { type: 'change', event: ev, value: newValue });\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\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","isHTMLElement","mergeCallbacks","slot","useControllableState","useId","RatingItem","StarFilled","StarRegular","useRating_unstable","props","ref","generatedName","color","iconFilled","iconOutline","max","name","onChange","step","size","itemLabel","value","setValue","state","defaultState","defaultValue","initialState","isRatingRadioItem","target","constructorName","type","hoveredValue","setHoveredValue","useState","undefined","rootChildren","useMemo","Array","from","_","i","key","components","root","always","children","role","elementType","ev","newValue","parseFloat","isNaN","event","onMouseOver","onMouseLeave"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRating.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isHTMLElement,\n mergeCallbacks,\n slot,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport type { RatingProps, RatingState } from './Rating.types';\nimport { RatingItem } from '../../RatingItem';\nimport { StarFilled, StarRegular } from '@fluentui/react-icons';\n\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 */\nexport const useRating_unstable = (props: RatingProps, ref: React.Ref<HTMLDivElement>): RatingState => {\n const generatedName = useId('rating-');\n const {\n color = 'neutral',\n iconFilled = StarFilled,\n iconOutline = StarRegular,\n max = 5,\n name = generatedName,\n onChange,\n step = 1,\n size = 'extra-large',\n itemLabel,\n } = props;\n\n const [value, setValue] = useControllableState({\n state: props.value,\n defaultState: props.defaultValue,\n initialState: 0,\n });\n\n const isRatingRadioItem = (target: EventTarget): target is HTMLInputElement =>\n isHTMLElement(target, { constructorName: 'HTMLInputElement' }) && target.type === 'radio' && target.name === name;\n\n const [hoveredValue, setHoveredValue] = React.useState<number | undefined>(undefined);\n\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) => <RatingItem value={i + 1} key={i + 1} />);\n }, [max]);\n\n const state: RatingState = {\n color,\n iconFilled,\n iconOutline,\n name,\n step,\n size,\n itemLabel,\n value,\n hoveredValue,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n ref,\n children: rootChildren,\n role: 'radiogroup',\n ...props,\n },\n ['onChange'],\n ),\n { elementType: 'div' },\n ),\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?.(ev, { type: 'change', event: ev, value: newValue });\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\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","isHTMLElement","mergeCallbacks","slot","useControllableState","useId","RatingItem","StarFilled","StarRegular","useRating_unstable","props","ref","generatedName","color","iconFilled","iconOutline","max","name","onChange","step","size","itemLabel","value","setValue","state","defaultState","defaultValue","initialState","isRatingRadioItem","target","constructorName","type","hoveredValue","setHoveredValue","useState","undefined","rootChildren","useMemo","Array","from","_","i","key","components","root","always","children","role","elementType","ev","newValue","parseFloat","isNaN","event","onMouseOver","onMouseLeave"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EACxBC,aAAa,EACbC,cAAc,EACdC,IAAI,EACJC,oBAAoB,EACpBC,KAAK,QACA,4BAA4B;AAEnC,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,UAAU,EAAEC,WAAW,QAAQ,wBAAwB;AAEhE;;;;;;;;CAQC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AMF,WAAW;gBACpB3B,SAAS2B;gBACThC,qBAAAA,+BAAAA,SAAW+B,IAAI;oBAAElB,MAAM;oBAAUsB,OAAOJ;oBAAI3B,OAAO4B;gBAAS;YAC9D;QACF;IACF;IACA1B,MAAMoB,IAAI,CAACU,WAAW,GAAGpD,eAAeQ,MAAM4C,WAAW,EAAEL,CAAAA;QACzD,IAAIrB,kBAAkBqB,GAAGpB,MAAM,GAAG;YAChC,MAAMqB,WAAWC,WAAWF,GAAGpB,MAAM,CAACP,KAAK;YAC3C,IAAI,CAAC8B,MAAMF,WAAW;gBACpBjB,gBAAgBiB;YAClB;QACF;IACF;IACA1B,MAAMoB,IAAI,CAACW,YAAY,GAAGrD,eAAeQ,MAAM6C,YAAY,EAAEN,CAAAA;QAC3DhB,gBAAgBE;IAClB;IAEA,OAAOX;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRatingContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingContextValues, RatingState } from './Rating.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingContextValues = (ratingState: RatingState): RatingContextValues => {\n const { color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value } = ratingState;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n hoveredValue,\n iconFilled,\n iconOutline,\n interactive: true,\n itemLabel,\n name,\n step,\n size,\n value,\n }),\n [color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["React","useRatingContextValues","ratingState","color","hoveredValue","iconFilled","iconOutline","itemLabel","name","step","size","value","ratingItem","useMemo","interactive"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRatingContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingContextValues, RatingState } from './Rating.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingContextValues = (ratingState: RatingState): RatingContextValues => {\n const { color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value } = ratingState;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n hoveredValue,\n iconFilled,\n iconOutline,\n interactive: true,\n itemLabel,\n name,\n step,\n size,\n value,\n }),\n [color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["React","useRatingContextValues","ratingState","color","hoveredValue","iconFilled","iconOutline","itemLabel","name","step","size","value","ratingItem","useMemo","interactive"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGT;IAE7F,MAAMU,aAAaZ,MAAMa,OAAO,CAC9B,IAAO,CAAA;YACLV;YACAC;YACAC;YACAC;YACAQ,aAAa;YACbP;YACAC;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QAACR;QAAOC;QAAcC;QAAYC;QAAaC;QAAWC;QAAMC;QAAMC;QAAMC;KAAM;IAGpF,OAAO;QAAEC;IAAW;AACtB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRatingStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingSlots, RatingState } from './Rating.types';\n\nexport const ratingClassNames: SlotClassNames<RatingSlots> = {\n root: 'fui-Rating',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\n/**\n * Apply styling to the Rating slots based on the state\n */\nexport const useRatingStyles_unstable = (state: RatingState): RatingState => {\n 'use no memo';\n\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","ratingClassNames","root","useRootClassName","display","flexWrap","useRatingStyles_unstable","state","rootClassName","className"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRatingStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingSlots, RatingState } from './Rating.types';\n\nexport const ratingClassNames: SlotClassNames<RatingSlots> = {\n root: 'fui-Rating',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\n/**\n * Apply styling to the Rating slots based on the state\n */\nexport const useRatingStyles_unstable = (state: RatingState): RatingState => {\n 'use no memo';\n\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","ratingClassNames","root","useRootClassName","display","flexWrap","useRatingStyles_unstable","state","rootClassName","className"],"mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,QAAQ,iBAAiB;AAI/D,OAAO,MAAMC,mBAAgD;IAC3DC,MAAM;AACR,EAAE;AAEF;;CAEC,GAED,MAAMC,mBAAmBJ,gBAAgB;IACvCK,SAAS;IACTC,UAAU;AACZ;AAEA;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvC;IAEA,MAAMC,gBAAgBL;IACtBI,MAAML,IAAI,CAACO,SAAS,GAAGT,aAAaC,iBAAiBC,IAAI,EAAEM,eAAeD,MAAML,IAAI,CAACO,SAAS;IAC9F,OAAOF;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingDisplay_unstable } from './useRatingDisplay';\nimport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nimport { useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nimport type { RatingDisplayProps } from './RatingDisplay.types';\nimport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\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 */\nexport const RatingDisplay: ForwardRefComponent<RatingDisplayProps> = React.forwardRef((props, ref) => {\n const state = useRatingDisplay_unstable(props, ref);\n const contextValues = useRatingDisplayContextValues(state);\n\n useRatingDisplayStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingDisplayStyles_unstable')(state);\n\n return renderRatingDisplay_unstable(state, contextValues);\n});\n\nRatingDisplay.displayName = 'RatingDisplay';\n"],"names":["React","useRatingDisplay_unstable","renderRatingDisplay_unstable","useRatingDisplayStyles_unstable","useRatingDisplayContextValues","useCustomStyleHook_unstable","RatingDisplay","forwardRef","props","ref","state","contextValues","displayName"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingDisplay_unstable } from './useRatingDisplay';\nimport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nimport { useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nimport type { RatingDisplayProps } from './RatingDisplay.types';\nimport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\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 */\nexport const RatingDisplay: ForwardRefComponent<RatingDisplayProps> = React.forwardRef((props, ref) => {\n const state = useRatingDisplay_unstable(props, ref);\n const contextValues = useRatingDisplayContextValues(state);\n\n useRatingDisplayStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingDisplayStyles_unstable')(state);\n\n return renderRatingDisplay_unstable(state, contextValues);\n});\n\nRatingDisplay.displayName = 'RatingDisplay';\n"],"names":["React","useRatingDisplay_unstable","renderRatingDisplay_unstable","useRatingDisplayStyles_unstable","useRatingDisplayContextValues","useCustomStyleHook_unstable","RatingDisplay","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,+BAA+B,QAAQ,kCAAkC;AAElF,SAASC,6BAA6B,QAAQ,kCAAkC;AAChF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,8BAAyDN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC7F,MAAMC,QAAQT,0BAA0BO,OAAOC;IAC/C,MAAME,gBAAgBP,8BAA8BM;IAEpDP,gCAAgCO;IAChCL,4BAA4B,mCAAmCK;IAE/D,OAAOR,6BAA6BQ,OAAOC;AAC7C,GAAG;AAEHL,cAAcM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport type RatingDisplaySlots = {\n root: NonNullable<Slot<'div'>>;\n valueText?: Slot<'span'>;\n countText?: Slot<'span'>;\n};\n\n/**\n * RatingDisplay Props\n */\nexport type RatingDisplayProps = ComponentProps<RatingDisplaySlots> & {\n /**\n * Color of the rating items (stars).\n * @default neutral\n */\n color?: 'brand' | 'marigold' | 'neutral';\n /**\n * Renders a single filled star, with the value written next to it.\n * @default false\n */\n compact?: boolean;\n /**\n * The number of ratings represented by the rating value.\n * This will be formatted with a thousands separator (if applicable) and displayed next to the value.\n */\n count?: number;\n /**\n * The icon used for rating items.\n * @default StarFilled\n */\n icon?: React.ElementType;\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 * Sets the size of the RatingDisplay items.\n * @default medium\n */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /**\n * The value of the rating\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingDisplay\n */\nexport type RatingDisplayState = ComponentState<RatingDisplaySlots> &\n Required<Pick<RatingDisplayProps, 'color' | 'compact' | 'icon' | 'max' | 'size'>> &\n Pick<RatingDisplayProps, 'value'>;\n\nexport type RatingDisplayContextValues = { ratingItem: RatingItemContextValue };\n"],"names":["React"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport type RatingDisplaySlots = {\n root: NonNullable<Slot<'div'>>;\n valueText?: Slot<'span'>;\n countText?: Slot<'span'>;\n};\n\n/**\n * RatingDisplay Props\n */\nexport type RatingDisplayProps = ComponentProps<RatingDisplaySlots> & {\n /**\n * Color of the rating items (stars).\n * @default neutral\n */\n color?: 'brand' | 'marigold' | 'neutral';\n /**\n * Renders a single filled star, with the value written next to it.\n * @default false\n */\n compact?: boolean;\n /**\n * The number of ratings represented by the rating value.\n * This will be formatted with a thousands separator (if applicable) and displayed next to the value.\n */\n count?: number;\n /**\n * The icon used for rating items.\n * @default StarFilled\n */\n icon?: React.ElementType;\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 * Sets the size of the RatingDisplay items.\n * @default medium\n */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /**\n * The value of the rating\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingDisplay\n */\nexport type RatingDisplayState = ComponentState<RatingDisplaySlots> &\n Required<Pick<RatingDisplayProps, 'color' | 'compact' | 'icon' | 'max' | 'size'>> &\n Pick<RatingDisplayProps, 'value'>;\n\nexport type RatingDisplayContextValues = { ratingItem: RatingItemContextValue };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/index.ts"],"sourcesContent":["export { RatingDisplay } from './RatingDisplay';\nexport type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './RatingDisplay.types';\nexport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nexport { useRatingDisplay_unstable } from './useRatingDisplay';\nexport { ratingDisplayClassNames, useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nexport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n"],"names":["RatingDisplay","renderRatingDisplay_unstable","useRatingDisplay_unstable","ratingDisplayClassNames","useRatingDisplayStyles_unstable","useRatingDisplayContextValues"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/index.ts"],"sourcesContent":["export { RatingDisplay } from './RatingDisplay';\nexport type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './RatingDisplay.types';\nexport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nexport { useRatingDisplay_unstable } from './useRatingDisplay';\nexport { ratingDisplayClassNames, useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nexport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n"],"names":["RatingDisplay","renderRatingDisplay_unstable","useRatingDisplay_unstable","ratingDisplayClassNames","useRatingDisplayStyles_unstable","useRatingDisplayContextValues"],"mappings":"AAAA,SAASA,aAAa,QAAQ,kBAAkB;AAOhD,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,uBAAuB,EAAEC,+BAA+B,QAAQ,kCAAkC;AAC3G,SAASC,6BAA6B,QAAQ,kCAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/renderRatingDisplay.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingDisplayState, RatingDisplaySlots, RatingDisplayContextValues } from './RatingDisplay.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of RatingDisplay\n */\nexport const renderRatingDisplay_unstable = (state: RatingDisplayState, contextValues: RatingDisplayContextValues) => {\n assertSlots<RatingDisplaySlots>(state);\n\n return (\n <RatingItemProvider value={contextValues.ratingItem}>\n <state.root>\n {state.root.children}\n {state.valueText && <state.valueText />}\n {state.countText && <state.countText />}\n </state.root>\n </RatingItemProvider>\n );\n};\n"],"names":["assertSlots","RatingItemProvider","renderRatingDisplay_unstable","state","contextValues","value","ratingItem","root","children","valueText","countText"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/renderRatingDisplay.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingDisplayState, RatingDisplaySlots, RatingDisplayContextValues } from './RatingDisplay.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of RatingDisplay\n */\nexport const renderRatingDisplay_unstable = (state: RatingDisplayState, contextValues: RatingDisplayContextValues) => {\n assertSlots<RatingDisplaySlots>(state);\n\n return (\n <RatingItemProvider value={contextValues.ratingItem}>\n <state.root>\n {state.root.children}\n {state.valueText && <state.valueText />}\n {state.countText && <state.countText />}\n </state.root>\n </RatingItemProvider>\n );\n};\n"],"names":["assertSlots","RatingItemProvider","renderRatingDisplay_unstable","state","contextValues","value","ratingItem","root","children","valueText","countText"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,kBAAkB,QAAQ,mCAAmC;AAEtE;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAACC,OAA2BC;IACtEJ,YAAgCG;IAEhC,qBACE,KAACF;QAAmBI,OAAOD,cAAcE,UAAU;kBACjD,cAAA,MAACH,MAAMI,IAAI;;gBACRJ,MAAMI,IAAI,CAACC,QAAQ;gBACnBL,MAAMM,SAAS,kBAAI,KAACN,MAAMM,SAAS;gBACnCN,MAAMO,SAAS,kBAAI,KAACP,MAAMO,SAAS;;;;AAI5C,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId } from '@fluentui/react-utilities';\nimport type { RatingDisplayProps, RatingDisplayState } from './RatingDisplay.types';\nimport { StarFilled } from '@fluentui/react-icons';\nimport { RatingItem } from '../RatingItem/RatingItem';\n\n/**\n * Create the state required to render RatingDisplay.\n *\n * The returned state can be modified with hooks such as useRatingDisplayStyles_unstable,\n * before being passed to renderRatingDisplay_unstable.\n *\n * @param props - props from this instance of RatingDisplay\n * @param ref - reference to root HTMLDivElement of RatingDisplay\n */\nexport const useRatingDisplay_unstable = (\n props: RatingDisplayProps,\n ref: React.Ref<HTMLDivElement>,\n): RatingDisplayState => {\n const { color = 'neutral', count, compact = false, icon = StarFilled, max = 5, size = 'medium', value } = props;\n\n const valueTextId = useId('rating-value-');\n const countTextId = useId('rating-count-');\n\n // Generate the child RatingItems and memoize them to prevent unnecessary re-rendering\n const rootChildren = React.useMemo(() => {\n return compact ? (\n <RatingItem value={1} key={1} aria-hidden={true} />\n ) : (\n Array.from(Array(max), (_, i) => <RatingItem value={i + 1} key={i + 1} aria-hidden={true} />)\n );\n }, [compact, max]);\n\n const state: RatingDisplayState = {\n color,\n compact,\n icon,\n max,\n size,\n value,\n components: {\n root: 'div',\n valueText: 'span',\n countText: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n children: rootChildren,\n role: 'img',\n ...props,\n }),\n { elementType: 'div' },\n ),\n valueText: slot.optional(props.valueText, {\n renderByDefault: value !== undefined,\n defaultProps: { children: value, id: valueTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n countText: slot.optional(props.countText, {\n renderByDefault: count !== undefined,\n defaultProps: { children: count?.toLocaleString(), id: countTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n };\n if (!state.root['aria-label'] && !state.root['aria-labelledby']) {\n state.root['aria-labelledby'] = [state.valueText?.id, state.countText?.id].filter(Boolean).join(' ');\n }\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","slot","useId","StarFilled","RatingItem","useRatingDisplay_unstable","props","ref","color","count","compact","icon","max","size","value","valueTextId","countTextId","rootChildren","useMemo","key","aria-hidden","Array","from","_","i","state","components","root","valueText","countText","always","children","role","elementType","optional","renderByDefault","undefined","defaultProps","id","toLocaleString","filter","Boolean","join"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId } from '@fluentui/react-utilities';\nimport type { RatingDisplayProps, RatingDisplayState } from './RatingDisplay.types';\nimport { StarFilled } from '@fluentui/react-icons';\nimport { RatingItem } from '../RatingItem/RatingItem';\n\n/**\n * Create the state required to render RatingDisplay.\n *\n * The returned state can be modified with hooks such as useRatingDisplayStyles_unstable,\n * before being passed to renderRatingDisplay_unstable.\n *\n * @param props - props from this instance of RatingDisplay\n * @param ref - reference to root HTMLDivElement of RatingDisplay\n */\nexport const useRatingDisplay_unstable = (\n props: RatingDisplayProps,\n ref: React.Ref<HTMLDivElement>,\n): RatingDisplayState => {\n const { color = 'neutral', count, compact = false, icon = StarFilled, max = 5, size = 'medium', value } = props;\n\n const valueTextId = useId('rating-value-');\n const countTextId = useId('rating-count-');\n\n // Generate the child RatingItems and memoize them to prevent unnecessary re-rendering\n const rootChildren = React.useMemo(() => {\n return compact ? (\n <RatingItem value={1} key={1} aria-hidden={true} />\n ) : (\n Array.from(Array(max), (_, i) => <RatingItem value={i + 1} key={i + 1} aria-hidden={true} />)\n );\n }, [compact, max]);\n\n const state: RatingDisplayState = {\n color,\n compact,\n icon,\n max,\n size,\n value,\n components: {\n root: 'div',\n valueText: 'span',\n countText: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n children: rootChildren,\n role: 'img',\n ...props,\n }),\n { elementType: 'div' },\n ),\n valueText: slot.optional(props.valueText, {\n renderByDefault: value !== undefined,\n defaultProps: { children: value, id: valueTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n countText: slot.optional(props.countText, {\n renderByDefault: count !== undefined,\n defaultProps: { children: count?.toLocaleString(), id: countTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n };\n if (!state.root['aria-label'] && !state.root['aria-labelledby']) {\n state.root['aria-labelledby'] = [state.valueText?.id, state.countText?.id].filter(Boolean).join(' ');\n }\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","slot","useId","StarFilled","RatingItem","useRatingDisplay_unstable","props","ref","color","count","compact","icon","max","size","value","valueTextId","countTextId","rootChildren","useMemo","key","aria-hidden","Array","from","_","i","state","components","root","valueText","countText","always","children","role","elementType","optional","renderByDefault","undefined","defaultProps","id","toLocaleString","filter","Boolean","join"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,EAAEC,KAAK,QAAQ,4BAA4B;AAElF,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,UAAU,QAAQ,2BAA2B;AAEtD;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAM,EAAEC,QAAQ,SAAS,EAAEC,KAAK,EAAEC,UAAU,KAAK,EAAEC,OA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CAAAA,iBAAiBa,EAAE;aAAEb,mBAAAA,MAAMI,SAAS,cAAfJ,uCAAAA,iBAAiBa,EAAE;SAAC,CAACE,MAAM,CAACC,SAASC,IAAI,CAAC;IAClG;IACA,OAAOjB;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingDisplayContextValues, RatingDisplayState } from './RatingDisplay.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingDisplayContextValues = (state: RatingDisplayState): RatingDisplayContextValues => {\n const { color, compact, icon, size, value } = state;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n compact,\n iconFilled: icon,\n iconOutline: icon,\n interactive: false,\n step: 0.5,\n size,\n value,\n }),\n [color, compact, icon, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["React","useRatingDisplayContextValues","state","color","compact","icon","size","value","ratingItem","useMemo","iconFilled","iconOutline","interactive","step"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingDisplayContextValues, RatingDisplayState } from './RatingDisplay.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingDisplayContextValues = (state: RatingDisplayState): RatingDisplayContextValues => {\n const { color, compact, icon, size, value } = state;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n compact,\n iconFilled: icon,\n iconOutline: icon,\n interactive: false,\n step: 0.5,\n size,\n value,\n }),\n [color, compact, icon, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["React","useRatingDisplayContextValues","state","color","compact","icon","size","value","ratingItem","useMemo","iconFilled","iconOutline","interactive","step"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,OAAO,MAAMC,gCAAgC,CAACC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGL;IAE9C,MAAMM,aAAaR,MAAMS,OAAO,CAC9B,IAAO,CAAA;YACLN;YACAC;YACAM,YAAYL;YACZM,aAAaN;YACbO,aAAa;YACbC,MAAM;YACNP;YACAC;QACF,CAAA,GACA;QAACJ;QAAOC;QAASC;QAAMC;QAAMC;KAAM;IAGrC,OAAO;QAAEC;IAAW;AACtB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingDisplaySlots, RatingDisplayState } from './RatingDisplay.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const ratingDisplayClassNames: SlotClassNames<RatingDisplaySlots> = {\n root: 'fui-RatingDisplay',\n valueText: 'fui-RatingDisplay__valueText',\n countText: 'fui-RatingDisplay__countText',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n});\n\nconst useLabelClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n marginLeft: tokens.spacingHorizontalXS,\n ...typographyStyles.caption1,\n});\n\nconst useLabelStyles = makeStyles({\n large: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n marginLeft: tokens.spacingHorizontalSNudge,\n },\n extraLarge: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n marginLeft: tokens.spacingHorizontalS,\n },\n strong: {\n fontWeight: tokens.fontWeightSemibold,\n },\n divider: {\n '::before': {\n content: '\"· \"',\n },\n },\n});\n\n/**\n * Apply styling to the RatingDisplay slots based on the state\n */\nexport const useRatingDisplayStyles_unstable = (state: RatingDisplayState): RatingDisplayState => {\n 'use no memo';\n\n const { size } = state;\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n\n if (state.valueText) {\n state.valueText.className = mergeClasses(\n ratingDisplayClassNames.valueText,\n labelClassName,\n labelStyles.strong,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText.className,\n );\n }\n if (state.countText) {\n state.countText.className = mergeClasses(\n ratingDisplayClassNames.countText,\n labelClassName,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText && labelStyles.divider,\n state.countText.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","ratingDisplayClassNames","root","valueText","countText","useRootClassName","display","flexWrap","alignItems","useLabelClassName","color","colorNeutralForeground1","marginLeft","spacingHorizontalXS","caption1","useLabelStyles","large","fontSize","fontSizeBase300","lineHeight","lineHeightBase300","spacingHorizontalSNudge","extraLarge","fontSizeBase400","lineHeightBase400","spacingHorizontalS","strong","fontWeight","fontWeightSemibold","divider","content","useRatingDisplayStyles_unstable","state","size","rootClassName","className","labelClassName","labelStyles"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingDisplaySlots, RatingDisplayState } from './RatingDisplay.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const ratingDisplayClassNames: SlotClassNames<RatingDisplaySlots> = {\n root: 'fui-RatingDisplay',\n valueText: 'fui-RatingDisplay__valueText',\n countText: 'fui-RatingDisplay__countText',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n});\n\nconst useLabelClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n marginLeft: tokens.spacingHorizontalXS,\n ...typographyStyles.caption1,\n});\n\nconst useLabelStyles = makeStyles({\n large: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n marginLeft: tokens.spacingHorizontalSNudge,\n },\n extraLarge: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n marginLeft: tokens.spacingHorizontalS,\n },\n strong: {\n fontWeight: tokens.fontWeightSemibold,\n },\n divider: {\n '::before': {\n content: '\"· \"',\n },\n },\n});\n\n/**\n * Apply styling to the RatingDisplay slots based on the state\n */\nexport const useRatingDisplayStyles_unstable = (state: RatingDisplayState): RatingDisplayState => {\n 'use no memo';\n\n const { size } = state;\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n\n if (state.valueText) {\n state.valueText.className = mergeClasses(\n ratingDisplayClassNames.valueText,\n labelClassName,\n labelStyles.strong,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText.className,\n );\n }\n if (state.countText) {\n state.countText.className = mergeClasses(\n ratingDisplayClassNames.countText,\n labelClassName,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText && labelStyles.divider,\n state.countText.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","ratingDisplayClassNames","root","valueText","countText","useRootClassName","display","flexWrap","alignItems","useLabelClassName","color","colorNeutralForeground1","marginLeft","spacingHorizontalXS","caption1","useLabelStyles","large","fontSize","fontSizeBase300","lineHeight","lineHeightBase300","spacingHorizontalSNudge","extraLarge","fontSizeBase400","lineHeightBase400","spacingHorizontalS","strong","fontWeight","fontWeightSemibold","divider","content","useRatingDisplayStyles_unstable","state","size","rootClassName","className","labelClassName","labelStyles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AAYf,UAAU,EAChDU,MAAM7B,SAAS,CAACgC,SAAS;IAE7B;IACA,IAAIH,MAAM5B,SAAS,EAAE;QACnB4B,MAAM5B,SAAS,CAAC+B,SAAS,GAAGrC,aAC1BG,wBAAwBG,SAAS,EACjCgC,gBACAH,SAAS,WAAWI,YAAYrB,KAAK,EACrCiB,SAAS,iBAAiBI,YAAYf,UAAU,EAChDU,MAAM7B,SAAS,IAAIkC,YAAYR,OAAO,EACtCG,MAAM5B,SAAS,CAAC+B,SAAS;IAE7B;IAEA,OAAOH;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/RatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingItem_unstable } from './useRatingItem';\nimport { renderRatingItem_unstable } from './renderRatingItem';\nimport { useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\nimport type { RatingItemProps } from './RatingItem.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * RatingItem is an item that will be used to set or display a rating value.\n */\nexport const RatingItem: ForwardRefComponent<RatingItemProps> = React.forwardRef((props, ref) => {\n const state = useRatingItem_unstable(props, ref);\n\n useRatingItemStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingItemStyles_unstable')(state);\n\n return renderRatingItem_unstable(state);\n});\n\nRatingItem.displayName = 'RatingItem';\n"],"names":["React","useRatingItem_unstable","renderRatingItem_unstable","useRatingItemStyles_unstable","useCustomStyleHook_unstable","RatingItem","forwardRef","props","ref","state","displayName"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/RatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingItem_unstable } from './useRatingItem';\nimport { renderRatingItem_unstable } from './renderRatingItem';\nimport { useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\nimport type { RatingItemProps } from './RatingItem.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * RatingItem is an item that will be used to set or display a rating value.\n */\nexport const RatingItem: ForwardRefComponent<RatingItemProps> = React.forwardRef((props, ref) => {\n const state = useRatingItem_unstable(props, ref);\n\n useRatingItemStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingItemStyles_unstable')(state);\n\n return renderRatingItem_unstable(state);\n});\n\nRatingItem.displayName = 'RatingItem';\n"],"names":["React","useRatingItem_unstable","renderRatingItem_unstable","useRatingItemStyles_unstable","useCustomStyleHook_unstable","RatingItem","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,+BAA+B;AAE5E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,2BAAmDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQR,uBAAuBM,OAAOC;IAE5CL,6BAA6BM;IAC7BL,4BAA4B,gCAAgCK;IAE5D,OAAOP,0BAA0BO;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/RatingItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingState } from '../Rating/Rating.types';\nimport { RatingDisplayState } from '../RatingDisplay/RatingDisplay.types';\n\nexport type RatingItemSlots = {\n /**\n * The root slot of the RatingItem.\n * Default html element is span\n */\n root: NonNullable<Slot<'span'>>;\n /**\n * Icon displayed when the rating value is greater than or equal to the item's value.\n */\n selectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Icon displayed when the rating value is less than the item's value.\n */\n unselectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Radio input slot used for half star precision\n */\n halfValueInput?: NonNullable<Slot<'input'>>;\n /**\n * Radio input slot used for full star precision\n */\n fullValueInput?: NonNullable<Slot<'input'>>;\n};\n\n/**\n * RatingItem Props\n */\nexport type RatingItemProps = ComponentProps<Partial<RatingItemSlots>> & {\n /**\n * The positive whole number value that is displayed by this RatingItem\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingItem\n */\nexport type RatingItemState = ComponentState<RatingItemSlots> &\n Required<Pick<RatingItemProps, 'value'>> &\n Pick<RatingState, 'color' | 'step' | 'size'> & {\n iconFillWidth: number;\n appearance: 'outline' | 'filled';\n };\n\nexport type RatingItemContextValue = Partial<Pick<RatingState, 'name' | 'hoveredValue' | 'value'>> &\n Pick<RatingState, 'color' | 'iconFilled' | 'iconOutline' | 'itemLabel' | 'step' | 'size'> &\n Partial<Pick<RatingDisplayState, 'compact'>> & {\n interactive?: boolean;\n };\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/RatingItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingState } from '../Rating/Rating.types';\nimport { RatingDisplayState } from '../RatingDisplay/RatingDisplay.types';\n\nexport type RatingItemSlots = {\n /**\n * The root slot of the RatingItem.\n * Default html element is span\n */\n root: NonNullable<Slot<'span'>>;\n /**\n * Icon displayed when the rating value is greater than or equal to the item's value.\n */\n selectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Icon displayed when the rating value is less than the item's value.\n */\n unselectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Radio input slot used for half star precision\n */\n halfValueInput?: NonNullable<Slot<'input'>>;\n /**\n * Radio input slot used for full star precision\n */\n fullValueInput?: NonNullable<Slot<'input'>>;\n};\n\n/**\n * RatingItem Props\n */\nexport type RatingItemProps = ComponentProps<Partial<RatingItemSlots>> & {\n /**\n * The positive whole number value that is displayed by this RatingItem\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingItem\n */\nexport type RatingItemState = ComponentState<RatingItemSlots> &\n Required<Pick<RatingItemProps, 'value'>> &\n Pick<RatingState, 'color' | 'step' | 'size'> & {\n iconFillWidth: number;\n appearance: 'outline' | 'filled';\n };\n\nexport type RatingItemContextValue = Partial<Pick<RatingState, 'name' | 'hoveredValue' | 'value'>> &\n Pick<RatingState, 'color' | 'iconFilled' | 'iconOutline' | 'itemLabel' | 'step' | 'size'> &\n Partial<Pick<RatingDisplayState, 'compact'>> & {\n interactive?: boolean;\n };\n"],"names":[],"mappings":"AAgDA,WAII"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/index.ts"],"sourcesContent":["export { RatingItem } from './RatingItem';\nexport type { RatingItemContextValue, RatingItemProps, RatingItemSlots, RatingItemState } from './RatingItem.types';\nexport { renderRatingItem_unstable } from './renderRatingItem';\nexport { useRatingItem_unstable } from './useRatingItem';\nexport { ratingItemClassNames, useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\n"],"names":["RatingItem","renderRatingItem_unstable","useRatingItem_unstable","ratingItemClassNames","useRatingItemStyles_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/index.ts"],"sourcesContent":["export { RatingItem } from './RatingItem';\nexport type { RatingItemContextValue, RatingItemProps, RatingItemSlots, RatingItemState } from './RatingItem.types';\nexport { renderRatingItem_unstable } from './renderRatingItem';\nexport { useRatingItem_unstable } from './useRatingItem';\nexport { ratingItemClassNames, useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\n"],"names":["RatingItem","renderRatingItem_unstable","useRatingItem_unstable","ratingItemClassNames","useRatingItemStyles_unstable"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAe;AAE1C,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,+BAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/renderRatingItem.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingItemState, RatingItemSlots } from './RatingItem.types';\n\n/**\n * Render the final JSX of RatingItem\n */\nexport const renderRatingItem_unstable = (state: RatingItemState) => {\n assertSlots<RatingItemSlots>(state);\n\n return (\n <state.root>\n {state.halfValueInput && <state.halfValueInput />}\n {state.fullValueInput && <state.fullValueInput />}\n {state.unselectedIcon && <state.unselectedIcon />}\n {state.selectedIcon && <state.selectedIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderRatingItem_unstable","state","root","halfValueInput","fullValueInput","unselectedIcon","selectedIcon"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/renderRatingItem.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingItemState, RatingItemSlots } from './RatingItem.types';\n\n/**\n * Render the final JSX of RatingItem\n */\nexport const renderRatingItem_unstable = (state: RatingItemState) => {\n assertSlots<RatingItemSlots>(state);\n\n return (\n <state.root>\n {state.halfValueInput && <state.halfValueInput />}\n {state.fullValueInput && <state.fullValueInput />}\n {state.unselectedIcon && <state.unselectedIcon />}\n {state.selectedIcon && <state.selectedIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderRatingItem_unstable","state","root","halfValueInput","fullValueInput","unselectedIcon","selectedIcon"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,YAA6BE;IAE7B,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,cAAc,kBAAI,KAACF,MAAME,cAAc;YAC7CF,MAAMG,cAAc,kBAAI,KAACH,MAAMG,cAAc;YAC7CH,MAAMI,cAAc,kBAAI,KAACJ,MAAMI,cAAc;YAC7CJ,MAAMK,YAAY,kBAAI,KAACL,MAAMK,YAAY;;;AAGhD,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/useRatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RatingItemProps, RatingItemState } from './RatingItem.types';\nimport { useRatingItemContextValue_unstable } from '../../contexts/RatingItemContext';\n\nconst defaultItemLabel = (num: number) => num + '';\n\n/**\n * Create the state required to render RatingItem.\n *\n * The returned state can be modified with hooks such as useRatingItemStyles_unstable,\n * before being passed to renderRatingItem_unstable.\n *\n * @param props - props from this instance of RatingItem\n * @param ref - reference to root HTMLElement of RatingItem\n */\nexport const useRatingItem_unstable = (props: RatingItemProps, ref: React.Ref<HTMLSpanElement>): RatingItemState => {\n const context = useRatingItemContextValue_unstable();\n const { value = 0 } = props;\n const { itemLabel = defaultItemLabel, iconFilled: IconFilled, iconOutline: IconOutline } = context;\n\n const ratingValue = Math.round((context.value || 0) * 2) / 2; // round to the nearest 0.5\n\n const displayedRatingValue = context.hoveredValue ?? ratingValue;\n\n const appearance = context.interactive ? 'outline' : 'filled';\n\n let iconFillWidth;\n if (context.compact || displayedRatingValue >= value) {\n iconFillWidth = 1;\n } else if (displayedRatingValue >= value - 0.5) {\n iconFillWidth = 0.5;\n } else {\n iconFillWidth = 0;\n }\n\n const root = slot.always(\n getIntrinsicElementProps('span', {\n ref: useMergedRefs(useFocusWithin<HTMLSpanElement>(), ref),\n ...props,\n }),\n { elementType: 'span' },\n );\n\n let unselectedIcon;\n if (iconFillWidth < 1) {\n unselectedIcon = slot.always(props.unselectedIcon, {\n defaultProps: {\n children: appearance === 'filled' ? <IconFilled /> : <IconOutline />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let selectedIcon;\n if (iconFillWidth > 0) {\n selectedIcon = slot.always(props.selectedIcon, {\n defaultProps: {\n children: <IconFilled />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let halfValueInput;\n if (context.interactive && context.step === 0.5) {\n halfValueInput = slot.always(props.halfValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value: value - 0.5,\n checked: ratingValue === value - 0.5,\n 'aria-label': itemLabel(value - 0.5),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n elementType: 'input',\n });\n }\n\n let fullValueInput;\n if (context.interactive) {\n fullValueInput = slot.always(props.fullValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value,\n checked: ratingValue === value,\n 'aria-label': itemLabel(value),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n\n elementType: 'input',\n });\n }\n\n const state: RatingItemState = {\n appearance,\n color: context.color,\n step: context.step,\n size: context.size,\n iconFillWidth,\n value,\n components: {\n root: 'span',\n selectedIcon: 'div',\n unselectedIcon: 'div',\n halfValueInput: 'input',\n fullValueInput: 'input',\n },\n root,\n selectedIcon,\n unselectedIcon,\n halfValueInput,\n fullValueInput,\n };\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","slot","useMergedRefs","useFocusWithin","useRatingItemContextValue_unstable","defaultItemLabel","num","useRatingItem_unstable","props","ref","context","value","itemLabel","iconFilled","IconFilled","iconOutline","IconOutline","ratingValue","Math","round","displayedRatingValue","hoveredValue","appearance","interactive","iconFillWidth","compact","root","always","elementType","unselectedIcon","defaultProps","children","selectedIcon","halfValueInput","step","type","name","checked","onChange","fullValueInput","state","color","size","components"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/useRatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RatingItemProps, RatingItemState } from './RatingItem.types';\nimport { useRatingItemContextValue_unstable } from '../../contexts/RatingItemContext';\n\nconst defaultItemLabel = (num: number) => num + '';\n\n/**\n * Create the state required to render RatingItem.\n *\n * The returned state can be modified with hooks such as useRatingItemStyles_unstable,\n * before being passed to renderRatingItem_unstable.\n *\n * @param props - props from this instance of RatingItem\n * @param ref - reference to root HTMLElement of RatingItem\n */\nexport const useRatingItem_unstable = (props: RatingItemProps, ref: React.Ref<HTMLSpanElement>): RatingItemState => {\n const context = useRatingItemContextValue_unstable();\n const { value = 0 } = props;\n const { itemLabel = defaultItemLabel, iconFilled: IconFilled, iconOutline: IconOutline } = context;\n\n const ratingValue = Math.round((context.value || 0) * 2) / 2; // round to the nearest 0.5\n\n const displayedRatingValue = context.hoveredValue ?? ratingValue;\n\n const appearance = context.interactive ? 'outline' : 'filled';\n\n let iconFillWidth;\n if (context.compact || displayedRatingValue >= value) {\n iconFillWidth = 1;\n } else if (displayedRatingValue >= value - 0.5) {\n iconFillWidth = 0.5;\n } else {\n iconFillWidth = 0;\n }\n\n const root = slot.always(\n getIntrinsicElementProps('span', {\n ref: useMergedRefs(useFocusWithin<HTMLSpanElement>(), ref),\n ...props,\n }),\n { elementType: 'span' },\n );\n\n let unselectedIcon;\n if (iconFillWidth < 1) {\n unselectedIcon = slot.always(props.unselectedIcon, {\n defaultProps: {\n children: appearance === 'filled' ? <IconFilled /> : <IconOutline />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let selectedIcon;\n if (iconFillWidth > 0) {\n selectedIcon = slot.always(props.selectedIcon, {\n defaultProps: {\n children: <IconFilled />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let halfValueInput;\n if (context.interactive && context.step === 0.5) {\n halfValueInput = slot.always(props.halfValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value: value - 0.5,\n checked: ratingValue === value - 0.5,\n 'aria-label': itemLabel(value - 0.5),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n elementType: 'input',\n });\n }\n\n let fullValueInput;\n if (context.interactive) {\n fullValueInput = slot.always(props.fullValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value,\n checked: ratingValue === value,\n 'aria-label': itemLabel(value),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n\n elementType: 'input',\n });\n }\n\n const state: RatingItemState = {\n appearance,\n color: context.color,\n step: context.step,\n size: context.size,\n iconFillWidth,\n value,\n components: {\n root: 'span',\n selectedIcon: 'div',\n unselectedIcon: 'div',\n halfValueInput: 'input',\n fullValueInput: 'input',\n },\n root,\n selectedIcon,\n unselectedIcon,\n halfValueInput,\n fullValueInput,\n };\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","slot","useMergedRefs","useFocusWithin","useRatingItemContextValue_unstable","defaultItemLabel","num","useRatingItem_unstable","props","ref","context","value","itemLabel","iconFilled","IconFilled","iconOutline","IconOutline","ratingValue","Math","round","displayedRatingValue","hoveredValue","appearance","interactive","iconFillWidth","compact","root","always","elementType","unselectedIcon","defaultProps","children","selectedIcon","halfValueInput","step","type","name","checked","onChange","fullValueInput","state","color","size","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAC1F,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,kCAAkC,QAAQ,mCAAmC;AAEtF,MAAMC,mBAAmB,CAACC,MAAgBA,MAAM;AAEhD;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC;IAC7D,MAAMC,UAAUN;IAChB,MAAM,EAAEO,QAAQ,CAAC,EAAE,GAAGH;IACtB,M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;gBACf0B,SAASpB,gBAAgBN,QAAQ;gBACjC,cAAcC,UAAUD,QAAQ;gBAChC2B,UAAU;gBACR,mHAAmH;gBACnH,wGAAwG;gBAC1G;YACF;YACAV,aAAa;QACf;IACF;IAEA,IAAIW;IACJ,IAAI7B,QAAQa,WAAW,EAAE;QACvBgB,iBAAiBtC,KAAK0B,MAAM,CAACnB,MAAM+B,cAAc,EAAE;YACjDT,cAAc;gBACZK,MAAM;gBACNC,MAAM1B,QAAQ0B,IAAI;gBAClBzB;gBACA0B,SAASpB,gBAAgBN;gBACzB,cAAcC,UAAUD;gBACxB2B,UAAU;gBACR,mHAAmH;gBACnH,wGAAwG;gBAC1G;YACF;YAEAV,aAAa;QACf;IACF;IAEA,MAAMY,QAAyB;QAC7BlB;QACAmB,OAAO/B,QAAQ+B,KAAK;QACpBP,MAAMxB,QAAQwB,IAAI;QAClBQ,MAAMhC,QAAQgC,IAAI;QAClBlB;QACAb;QACAgC,YAAY;YACVjB,MAAM;YACNM,cAAc;YACdH,gBAAgB;YAChBI,gBAAgB;YAChBM,gBAAgB;QAClB;QACAb;QACAM;QACAH;QACAI;QACAM;IACF;IAEA,OAAOC;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/useRatingItemStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport type { RatingItemSlots, RatingItemState } from './RatingItem.types';\n\nexport const ratingItemClassNames: SlotClassNames<RatingItemSlots> = {\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/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n small: {\n fontSize: '12px',\n width: '12px',\n height: '12px',\n },\n\n medium: {\n fontSize: '16px',\n width: '16px',\n height: '16px',\n },\n\n large: {\n fontSize: '20px',\n width: '20px',\n height: '20px',\n },\n\n 'extra-large': {\n fontSize: '28px',\n width: '28px',\n height: '28px',\n },\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});\n\nconst useInputStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n },\n upperHalf: {\n left: '50%',\n },\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});\n\nconst useIndicatorStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n '& > svg': {\n 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/**\n * Apply styling to the RatingItem slots based on the state\n */\nexport const useRatingItemStyles_unstable = (state: RatingItemState): RatingItemState => {\n 'use no memo';\n\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\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n\n if (state.halfValueInput) {\n state.halfValueInput.className = mergeClasses(\n ratingItemClassNames.halfValueInput,\n inputBaseClassName,\n inputStyles.lowerHalf,\n state.halfValueInput.className,\n );\n }\n\n if (state.fullValueInput) {\n state.fullValueInput.className = mergeClasses(\n ratingItemClassNames.fullValueInput,\n inputBaseClassName,\n state.halfValueInput && inputStyles.upperHalf,\n state.fullValueInput.className,\n );\n }\n\n if (state.unselectedIcon) {\n state.unselectedIcon.className = mergeClasses(\n ratingItemClassNames.unselectedIcon,\n indicatorBaseClassName,\n appearance === 'filled' && indicatorStyles.filled,\n color === 'brand' && (appearance === 'filled' ? indicatorStyles.brandFilled : indicatorStyles.brand),\n color === 'marigold' && (appearance === 'filled' ? indicatorStyles.marigoldFilled : indicatorStyles.marigold),\n iconFillWidth === 0.5 && indicatorStyles.upperHalf,\n state.unselectedIcon.className,\n );\n }\n\n if (state.selectedIcon) {\n state.selectedIcon.className = mergeClasses(\n ratingItemClassNames.selectedIcon,\n indicatorBaseClassName,\n color === 'brand' && indicatorStyles.brand,\n color === 'marigold' && indicatorStyles.marigold,\n iconFillWidth === 0.5 && indicatorStyles.lowerHalf,\n state.selectedIcon.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","createFocusOutlineStyle","ratingItemClassNames","root","selectedIcon","unselectedIcon","halfValueInput","fullValueInput","useStyles","position","style","selector","small","fontSize","width","height","medium","large","useInputBaseClassName","left","top","right","bottom","boxSizing","margin","opacity","cursor","useInputStyles","lowerHalf","upperHalf","useIndicatorBaseClassName","display","overflow","color","colorNeutralForeground1","fill","pointerEvents","useIndicatorStyles","flex","marginLeft","brand","colorBrandForeground1","marigold","colorPaletteMarigoldBorderActive","filled","colorNeutralBackground6","stroke","colorTransparentStroke","brandFilled","colorBrandBackground2","marigoldFilled","colorPaletteMarigoldBackground2","useRatingItemStyles_unstable","state","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className"],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/useRatingItemStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport type { RatingItemSlots, RatingItemState } from './RatingItem.types';\n\nexport const ratingItemClassNames: SlotClassNames<RatingItemSlots> = {\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/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n small: {\n fontSize: '12px',\n width: '12px',\n height: '12px',\n },\n\n medium: {\n fontSize: '16px',\n width: '16px',\n height: '16px',\n },\n\n large: {\n fontSize: '20px',\n width: '20px',\n height: '20px',\n },\n\n 'extra-large': {\n fontSize: '28px',\n width: '28px',\n height: '28px',\n },\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});\n\nconst useInputStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n },\n upperHalf: {\n left: '50%',\n },\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});\n\nconst useIndicatorStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n '& > svg': {\n 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/**\n * Apply styling to the RatingItem slots based on the state\n */\nexport const useRatingItemStyles_unstable = (state: RatingItemState): RatingItemState => {\n 'use no memo';\n\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\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n\n if (state.halfValueInput) {\n state.halfValueInput.className = mergeClasses(\n ratingItemClassNames.halfValueInput,\n inputBaseClassName,\n inputStyles.lowerHalf,\n state.halfValueInput.className,\n );\n }\n\n if (state.fullValueInput) {\n state.fullValueInput.className = mergeClasses(\n ratingItemClassNames.fullValueInput,\n inputBaseClassName,\n state.halfValueInput && inputStyles.upperHalf,\n state.fullValueInput.className,\n );\n }\n\n if (state.unselectedIcon) {\n state.unselectedIcon.className = mergeClasses(\n ratingItemClassNames.unselectedIcon,\n indicatorBaseClassName,\n appearance === 'filled' && indicatorStyles.filled,\n color === 'brand' && (appearance === 'filled' ? indicatorStyles.brandFilled : indicatorStyles.brand),\n color === 'marigold' && (appearance === 'filled' ? indicatorStyles.marigoldFilled : indicatorStyles.marigold),\n iconFillWidth === 0.5 && indicatorStyles.upperHalf,\n state.unselectedIcon.className,\n );\n }\n\n if (state.selectedIcon) {\n state.selectedIcon.className = mergeClasses(\n ratingItemClassNames.selectedIcon,\n indicatorBaseClassName,\n color === 'brand' && indicatorStyles.brand,\n color === 'marigold' && indicatorStyles.marigold,\n iconFillWidth === 0.5 && indicatorStyles.lowerHalf,\n state.selectedIcon.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","createFocusOutlineStyle","ratingItemClassNames","root","selectedIcon","unselectedIcon","halfValueInput","fullValueInput","useStyles","position","style","selector","small","fontSize","width","height","medium","large","useInputBaseClassName","left","top","right","bottom","boxSizing","margin","opacity","cursor","useInputStyles","lowerHalf","upperHalf","useIndicatorBaseClassName","display","overflow","color","colorNeutralForeground1","fill","pointerEvents","useIndicatorStyles","flex","marginLeft","brand","colorBrandForeground1","marigold","colorPaletteMarigoldBorderActive","filled","colorNeutralBackground6","stroke","colorTransparentStroke","brandFilled","colorBrandBackground2","marigoldFilled","colorPaletteMarigoldBackground2","useRatingItemStyles_unstable","state","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className"],"mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAE3E,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,uBAAuB,QAAQ,0BAA0B;AAGlE,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,cAAc;IACdC,gBAAgB;IAChBC,gBAAgB;IAChBC,gBAAgB;AAClB,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYV,WAAW;IAC3BK,MAAM;QACJM,UAAU;QACV,GAAGR,wBAAwB;YAAES,OAAO,CAAC;YAAGC,UAAU;QAAe,EAAE;IACrE;IACAC,OAAO;QACLC,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;IAEAC,QAAQ;QACNH,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;IAEAE,OAAO;QACLJ,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;IAEA,eAAe;QACb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@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/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"],"
|
|
1
|
+
{"version":3,"sources":["../src/contexts/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export { RatingItemContext, RatingItemProvider, useRatingItemContextValue_unstable } from './RatingItemContext';\n"],"names":["RatingItemContext","RatingItemProvider","useRatingItemContextValue_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export { RatingItemContext, RatingItemProvider, useRatingItemContextValue_unstable } from './RatingItemContext';\n"],"names":["RatingItemContext","RatingItemProvider","useRatingItemContextValue_unstable"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,kBAAkB,EAAEC,kCAAkC,QAAQ,sBAAsB"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/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"],"
|
|
1
|
+
{"version":3,"sources":["../src/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Rating.ts"],"sourcesContent":["export type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './components/Rating/index';\nexport {\n Rating,\n ratingClassNames,\n renderRating_unstable,\n useRatingContextValues,\n useRatingStyles_unstable,\n useRating_unstable,\n} from './components/Rating/index';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingContextValues","useRatingStyles_unstable","useRating_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/Rating.ts"],"sourcesContent":["export type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './components/Rating/index';\nexport {\n Rating,\n ratingClassNames,\n renderRating_unstable,\n useRatingContextValues,\n useRatingStyles_unstable,\n useRating_unstable,\n} from './components/Rating/index';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingContextValues","useRatingStyles_unstable","useRating_unstable"],"mappings":";;;;;;;;;;;;eAQEA,aAAM;;;eACNC,uBAAgB;;;eAChBC,4BAAqB;;;eACrBC,6BAAsB;;;eACtBC,+BAAwB;;;eACxBC,yBAAkB;;;uBACb,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RatingDisplay.ts"],"sourcesContent":["export type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './components/RatingDisplay/index';\nexport {\n RatingDisplay,\n ratingDisplayClassNames,\n renderRatingDisplay_unstable,\n useRatingDisplayContextValues,\n useRatingDisplayStyles_unstable,\n useRatingDisplay_unstable,\n} from './components/RatingDisplay/index';\n"],"names":["RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayContextValues","useRatingDisplayStyles_unstable","useRatingDisplay_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/RatingDisplay.ts"],"sourcesContent":["export type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './components/RatingDisplay/index';\nexport {\n RatingDisplay,\n ratingDisplayClassNames,\n renderRatingDisplay_unstable,\n useRatingDisplayContextValues,\n useRatingDisplayStyles_unstable,\n useRatingDisplay_unstable,\n} from './components/RatingDisplay/index';\n"],"names":["RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayContextValues","useRatingDisplayStyles_unstable","useRatingDisplay_unstable"],"mappings":";;;;;;;;;;;;eAOEA,oBAAa;;;eACbC,8BAAuB;;;eACvBC,mCAA4B;;;eAC5BC,oCAA6B;;;eAC7BC,sCAA+B;;;eAC/BC,gCAAyB;;;uBACpB,mCAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RatingItem.ts"],"sourcesContent":["export type {\n RatingItemContextValue,\n RatingItemProps,\n RatingItemSlots,\n RatingItemState,\n} from './components/RatingItem/index';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n} from './components/RatingItem/index';\n"],"names":["RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/RatingItem.ts"],"sourcesContent":["export type {\n RatingItemContextValue,\n RatingItemProps,\n RatingItemSlots,\n RatingItemState,\n} from './components/RatingItem/index';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n} from './components/RatingItem/index';\n"],"names":["RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable"],"mappings":";;;;;;;;;;;;eAOEA,iBAAU;;;eACVC,2BAAoB;;;eACpBC,gCAAyB;;;eACzBC,mCAA4B;;;eAC5BC,6BAAsB;;;uBACjB,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useRatingStyles_unstable')(state);\n return renderRating_unstable(state, contextValues);\n});\n\nRating.displayName = 'Rating';\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useRatingStyles_unstable')(state);\n return renderRating_unstable(state, contextValues);\n});\n\nRating.displayName = 'Rating';\n"],"names":["React","useRating_unstable","renderRating_unstable","useRatingStyles_unstable","useRatingContextValues","useCustomStyleHook_unstable","Rating","forwardRef","props","ref","state","contextValues","displayName"],"mappings":";;;;+BAYaM;;;;;;;iEAZU,QAAQ;2BAEI,cAAc;8BACX,iBAAiB;uCACd,2BAA2B;wCAE7B,2BAA2B;qCACtB,kCAAkC;AAKvE,eAAMA,WAAAA,GAA2CN,OAAMO,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,YAAQT,6BAAAA,EAAmBO,OAAOC;IACxC,MAAME,oBAAgBP,8CAAAA,EAAuBM;QAE7CP,+CAAAA,EAAyBO;QACzBL,gDAAAA,EAA4B,4BAA4BK;IACxD,WAAOR,mCAAAA,EAAsBQ,OAAOC;AACtC,GAAG;AAEHL,OAAOM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/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":[
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/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":";;;;;iEAAuB,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/index.ts"],"sourcesContent":["export { Rating } from './Rating';\nexport type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './Rating.types';\nexport { renderRating_unstable } from './renderRating';\nexport { useRating_unstable } from './useRating';\nexport { ratingClassNames, useRatingStyles_unstable } from './useRatingStyles.styles';\nexport { useRatingContextValues } from './useRatingContextValues';\n"],"names":["Rating","
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/index.ts"],"sourcesContent":["export { Rating } from './Rating';\nexport type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingSlots,\n RatingState,\n} from './Rating.types';\nexport { renderRating_unstable } from './renderRating';\nexport { useRating_unstable } from './useRating';\nexport { ratingClassNames, useRatingStyles_unstable } from './useRatingStyles.styles';\nexport { useRatingContextValues } from './useRatingContextValues';\n"],"names":["Rating","renderRating_unstable","useRating_unstable","ratingClassNames","useRatingStyles_unstable","useRatingContextValues"],"mappings":";;;;;;;;;;;;eAASA,cAAM;;;eAUNG,uCAAgB;;;eAFhBF,mCAAqB;;;eAGrBI,8CAAsB;;;eADJD,+CAAwB;;;eAD1CF,6BAAkB;;;wBATJ,WAAW;8BAQI,iBAAiB;2BACpB,cAAc;uCACU,2BAA2B;wCAC/C,2BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/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":["
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/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":";;;;+BAUaE;;;;;;4BATb,gDAAiD;gCAErB,4BAA4B;mCAErB,mCAAmC;AAK/D,8BAA8B,CAACC,OAAoBC;QACxDJ,2BAAAA,EAAyBG;IAEzB,OAAA,WAAA,OACE,eAAA,EAACF,qCAAAA,EAAAA;QAAmBI,OAAOD,cAAcE,UAAU;kBACjD,WAAA,OAAA,eAAA,EAACH,MAAMI,IAAI,EAAA,CAAA;;AAGjB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRating.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isHTMLElement,\n mergeCallbacks,\n slot,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport type { RatingProps, RatingState } from './Rating.types';\nimport { RatingItem } from '../../RatingItem';\nimport { StarFilled, StarRegular } from '@fluentui/react-icons';\n\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 */\nexport const useRating_unstable = (props: RatingProps, ref: React.Ref<HTMLDivElement>): RatingState => {\n const generatedName = useId('rating-');\n const {\n color = 'neutral',\n iconFilled = StarFilled,\n iconOutline = StarRegular,\n max = 5,\n name = generatedName,\n onChange,\n step = 1,\n size = 'extra-large',\n itemLabel,\n } = props;\n\n const [value, setValue] = useControllableState({\n state: props.value,\n defaultState: props.defaultValue,\n initialState: 0,\n });\n\n const isRatingRadioItem = (target: EventTarget): target is HTMLInputElement =>\n isHTMLElement(target, { constructorName: 'HTMLInputElement' }) && target.type === 'radio' && target.name === name;\n\n const [hoveredValue, setHoveredValue] = React.useState<number | undefined>(undefined);\n\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) => <RatingItem value={i + 1} key={i + 1} />);\n }, [max]);\n\n const state: RatingState = {\n color,\n iconFilled,\n iconOutline,\n name,\n step,\n size,\n itemLabel,\n value,\n hoveredValue,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n ref,\n children: rootChildren,\n role: 'radiogroup',\n ...props,\n },\n ['onChange'],\n ),\n { elementType: 'div' },\n ),\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?.(ev, { type: 'change', event: ev, value: newValue });\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\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRating.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isHTMLElement,\n mergeCallbacks,\n slot,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport type { RatingProps, RatingState } from './Rating.types';\nimport { RatingItem } from '../../RatingItem';\nimport { StarFilled, StarRegular } from '@fluentui/react-icons';\n\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 */\nexport const useRating_unstable = (props: RatingProps, ref: React.Ref<HTMLDivElement>): RatingState => {\n const generatedName = useId('rating-');\n const {\n color = 'neutral',\n iconFilled = StarFilled,\n iconOutline = StarRegular,\n max = 5,\n name = generatedName,\n onChange,\n step = 1,\n size = 'extra-large',\n itemLabel,\n } = props;\n\n const [value, setValue] = useControllableState({\n state: props.value,\n defaultState: props.defaultValue,\n initialState: 0,\n });\n\n const isRatingRadioItem = (target: EventTarget): target is HTMLInputElement =>\n isHTMLElement(target, { constructorName: 'HTMLInputElement' }) && target.type === 'radio' && target.name === name;\n\n const [hoveredValue, setHoveredValue] = React.useState<number | undefined>(undefined);\n\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) => <RatingItem value={i + 1} key={i + 1} />);\n }, [max]);\n\n const state: RatingState = {\n color,\n iconFilled,\n iconOutline,\n name,\n step,\n size,\n itemLabel,\n value,\n hoveredValue,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n ref,\n children: rootChildren,\n role: 'radiogroup',\n ...props,\n },\n ['onChange'],\n ),\n { elementType: 'div' },\n ),\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?.(ev, { type: 'change', event: ev, value: newValue });\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\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","isHTMLElement","mergeCallbacks","slot","useControllableState","useId","RatingItem","StarFilled","StarRegular","useRating_unstable","props","ref","generatedName","color","iconFilled","iconOutline","max","name","onChange","step","size","itemLabel","value","setValue","state","defaultState","defaultValue","initialState","isRatingRadioItem","target","constructorName","type","hoveredValue","setHoveredValue","useState","undefined","rootChildren","useMemo","Array","from","_","i","key","components","root","always","children","role","elementType","ev","newValue","parseFloat","isNaN","event","onMouseOver","onMouseLeave"],"mappings":";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1B,QAAQ,GAAG+B,CAAAA;QACpB,IAAIrB,kBAAkBqB,GAAGpB,MAAM,GAAG;YAChC,MAAMqB,WAAWC,WAAWF,GAAGpB,MAAM,CAACP,KAAK;YAC3C,IAAI,CAAC8B,MAAMF,WAAW;gBACpB3B,SAAS2B;gBACThC,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAW+B,IAAI;oBAAElB,MAAM;oBAAUsB,OAAOJ;oBAAI3B,OAAO4B;gBAAS;YAC9D;QACF;IACF;IACA1B,MAAMoB,IAAI,CAACU,WAAW,OAAGpD,8BAAAA,EAAeQ,MAAM4C,WAAW,EAAEL,CAAAA;QACzD,IAAIrB,kBAAkBqB,GAAGpB,MAAM,GAAG;YAChC,MAAMqB,WAAWC,WAAWF,GAAGpB,MAAM,CAACP,KAAK;YAC3C,IAAI,CAAC8B,MAAMF,WAAW;gBACpBjB,gBAAgBiB;YAClB;QACF;IACF;IACA1B,MAAMoB,IAAI,CAACW,YAAY,OAAGrD,8BAAAA,EAAeQ,MAAM6C,YAAY,EAAEN,CAAAA;QAC3DhB,gBAAgBE;IAClB;IAEA,OAAOX;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRatingContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingContextValues, RatingState } from './Rating.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingContextValues = (ratingState: RatingState): RatingContextValues => {\n const { color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value } = ratingState;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n hoveredValue,\n iconFilled,\n iconOutline,\n interactive: true,\n itemLabel,\n name,\n step,\n size,\n value,\n }),\n [color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["useRatingContextValues","ratingState","color","hoveredValue","iconFilled","iconOutline","itemLabel","name","step","size","value","ratingItem","
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRatingContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingContextValues, RatingState } from './Rating.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingContextValues = (ratingState: RatingState): RatingContextValues => {\n const { color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value } = ratingState;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n hoveredValue,\n iconFilled,\n iconOutline,\n interactive: true,\n itemLabel,\n name,\n step,\n size,\n value,\n }),\n [color, hoveredValue, iconFilled, iconOutline, itemLabel, name, step, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["React","useRatingContextValues","ratingState","color","hoveredValue","iconFilled","iconOutline","itemLabel","name","step","size","value","ratingItem","useMemo","interactive"],"mappings":";;;;+BAIaC;;;;;;;iEAJU,QAAQ;AAIxB,+BAA+B,CAACC;IACrC,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGT;IAE7F,MAAMU,aAAaZ,OAAMa,OAAO,CAC9B,IAAO;YACLV;YACAC;YACAC;YACAC;YACAQ,aAAa;YACbP;YACAC;YACAC;YACAC;YACAC;SACF,CAAA,EACA;QAACR;QAAOC;QAAcC;QAAYC;QAAaC;QAAWC;QAAMC;QAAMC;QAAMC;KAAM;IAGpF,OAAO;QAAEC;IAAW;AACtB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useRatingStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nexport const ratingClassNames = {\n root: 'fui-Rating'\n};\n/**\n * Styles for the root slot\n */ const useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap'\n});\n/**\n * Apply styling to the Rating slots based on the state\n */ export const useRatingStyles_unstable = (state)=>{\n 'use no memo';\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useRatingStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nexport const ratingClassNames = {\n root: 'fui-Rating'\n};\n/**\n * Styles for the root slot\n */ const useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap'\n});\n/**\n * Apply styling to the Rating slots based on the state\n */ export const useRatingStyles_unstable = (state)=>{\n 'use no memo';\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n"],"names":["__resetStyles","mergeClasses","ratingClassNames","root","useRootClassName","useRatingStyles_unstable","state","rootClassName","className"],"mappings":";;;;;;;;;;;IACaE,gBAAgB;;;4BAWY;;;;uBAZK,gBAAgB;AACvD,yBAAyB;IAC5BC,IAAI,EAAE;AACV,CAAC;AACD;;CAEA,GAAI,MAAMC,gBAAgB,GAAA,WAAA,OAAGJ,oBAAA,EAAA,WAAA,MAAA;IAAA;CAG5B,CAAC;AAGS,MAAMK,4BAA4BC,KAAK,IAAG;IACjD,aAAa;IACb,MAAMC,aAAa,GAAGH,gBAAgB,CAAC,CAAC;IACxCE,KAAK,CAACH,IAAI,CAACK,SAAS,OAAGP,mBAAY,EAACC,gBAAgB,CAACC,IAAI,EAAEI,aAAa,EAAED,KAAK,CAACH,IAAI,CAACK,SAAS,CAAC;IAC/F,OAAOF,KAAK;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRatingStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingSlots, RatingState } from './Rating.types';\n\nexport const ratingClassNames: SlotClassNames<RatingSlots> = {\n root: 'fui-Rating',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\n/**\n * Apply styling to the Rating slots based on the state\n */\nexport const useRatingStyles_unstable = (state: RatingState): RatingState => {\n 'use no memo';\n\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRatingStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingSlots, RatingState } from './Rating.types';\n\nexport const ratingClassNames: SlotClassNames<RatingSlots> = {\n root: 'fui-Rating',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\n/**\n * Apply styling to the Rating slots based on the state\n */\nexport const useRatingStyles_unstable = (state: RatingState): RatingState => {\n 'use no memo';\n\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingClassNames.root, rootClassName, state.root.className);\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","ratingClassNames","root","useRootClassName","display","flexWrap","useRatingStyles_unstable","state","rootClassName","className"],"mappings":";;;;;;;;;;;IAIaE,gBAAAA;;;4BAgBAK;;;;uBApBiC,iBAAiB;AAIxD,yBAAsD;IAC3DJ,MAAM;AACR,EAAE;AAEF;;CAEC,GAED,MAAMC,uBAAmBJ,sBAAAA,EAAgB;IACvCK,SAAS;IACTC,UAAU;AACZ;AAKO,MAAMC,2BAA2B,CAACC;IACvC;IAEA,MAAMC,gBAAgBL;IACtBI,MAAML,IAAI,CAACO,SAAS,OAAGT,mBAAAA,EAAaC,iBAAiBC,IAAI,EAAEM,eAAeD,MAAML,IAAI,CAACO,SAAS;IAC9F,OAAOF;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingDisplay_unstable } from './useRatingDisplay';\nimport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nimport { useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nimport type { RatingDisplayProps } from './RatingDisplay.types';\nimport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\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 */\nexport const RatingDisplay: ForwardRefComponent<RatingDisplayProps> = React.forwardRef((props, ref) => {\n const state = useRatingDisplay_unstable(props, ref);\n const contextValues = useRatingDisplayContextValues(state);\n\n useRatingDisplayStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingDisplayStyles_unstable')(state);\n\n return renderRatingDisplay_unstable(state, contextValues);\n});\n\nRatingDisplay.displayName = 'RatingDisplay';\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingDisplay_unstable } from './useRatingDisplay';\nimport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nimport { useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nimport type { RatingDisplayProps } from './RatingDisplay.types';\nimport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\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 */\nexport const RatingDisplay: ForwardRefComponent<RatingDisplayProps> = React.forwardRef((props, ref) => {\n const state = useRatingDisplay_unstable(props, ref);\n const contextValues = useRatingDisplayContextValues(state);\n\n useRatingDisplayStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingDisplayStyles_unstable')(state);\n\n return renderRatingDisplay_unstable(state, contextValues);\n});\n\nRatingDisplay.displayName = 'RatingDisplay';\n"],"names":["React","useRatingDisplay_unstable","renderRatingDisplay_unstable","useRatingDisplayStyles_unstable","useRatingDisplayContextValues","useCustomStyleHook_unstable","RatingDisplay","forwardRef","props","ref","state","contextValues","displayName"],"mappings":";;;;+BAaaM;;;;;;;iEAbU,QAAQ;kCAEW,qBAAqB;qCAClB,wBAAwB;8CACrB,kCAAkC;+CAEpC,kCAAkC;qCACpC,kCAAkC;AAMvE,sBAAMA,WAAAA,GAAyDN,OAAMO,UAAU,CAAC,CAACC,OAAOC;IAC7F,MAAMC,YAAQT,2CAAAA,EAA0BO,OAAOC;IAC/C,MAAME,oBAAgBP,4DAAAA,EAA8BM;QAEpDP,6DAAAA,EAAgCO;QAChCL,gDAAAA,EAA4B,mCAAmCK;IAE/D,WAAOR,iDAAAA,EAA6BQ,OAAOC;AAC7C,GAAG;AAEHL,cAAcM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport type RatingDisplaySlots = {\n root: NonNullable<Slot<'div'>>;\n valueText?: Slot<'span'>;\n countText?: Slot<'span'>;\n};\n\n/**\n * RatingDisplay Props\n */\nexport type RatingDisplayProps = ComponentProps<RatingDisplaySlots> & {\n /**\n * Color of the rating items (stars).\n * @default neutral\n */\n color?: 'brand' | 'marigold' | 'neutral';\n /**\n * Renders a single filled star, with the value written next to it.\n * @default false\n */\n compact?: boolean;\n /**\n * The number of ratings represented by the rating value.\n * This will be formatted with a thousands separator (if applicable) and displayed next to the value.\n */\n count?: number;\n /**\n * The icon used for rating items.\n * @default StarFilled\n */\n icon?: React.ElementType;\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 * Sets the size of the RatingDisplay items.\n * @default medium\n */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /**\n * The value of the rating\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingDisplay\n */\nexport type RatingDisplayState = ComponentState<RatingDisplaySlots> &\n Required<Pick<RatingDisplayProps, 'color' | 'compact' | 'icon' | 'max' | 'size'>> &\n Pick<RatingDisplayProps, 'value'>;\n\nexport type RatingDisplayContextValues = { ratingItem: RatingItemContextValue };\n"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport type RatingDisplaySlots = {\n root: NonNullable<Slot<'div'>>;\n valueText?: Slot<'span'>;\n countText?: Slot<'span'>;\n};\n\n/**\n * RatingDisplay Props\n */\nexport type RatingDisplayProps = ComponentProps<RatingDisplaySlots> & {\n /**\n * Color of the rating items (stars).\n * @default neutral\n */\n color?: 'brand' | 'marigold' | 'neutral';\n /**\n * Renders a single filled star, with the value written next to it.\n * @default false\n */\n compact?: boolean;\n /**\n * The number of ratings represented by the rating value.\n * This will be formatted with a thousands separator (if applicable) and displayed next to the value.\n */\n count?: number;\n /**\n * The icon used for rating items.\n * @default StarFilled\n */\n icon?: React.ElementType;\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 * Sets the size of the RatingDisplay items.\n * @default medium\n */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /**\n * The value of the rating\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingDisplay\n */\nexport type RatingDisplayState = ComponentState<RatingDisplaySlots> &\n Required<Pick<RatingDisplayProps, 'color' | 'compact' | 'icon' | 'max' | 'size'>> &\n Pick<RatingDisplayProps, 'value'>;\n\nexport type RatingDisplayContextValues = { ratingItem: RatingItemContextValue };\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/index.ts"],"sourcesContent":["export { RatingDisplay } from './RatingDisplay';\nexport type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './RatingDisplay.types';\nexport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nexport { useRatingDisplay_unstable } from './useRatingDisplay';\nexport { ratingDisplayClassNames, useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nexport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n"],"names":["RatingDisplay","
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/index.ts"],"sourcesContent":["export { RatingDisplay } from './RatingDisplay';\nexport type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n} from './RatingDisplay.types';\nexport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nexport { useRatingDisplay_unstable } from './useRatingDisplay';\nexport { ratingDisplayClassNames, useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nexport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n"],"names":["RatingDisplay","renderRatingDisplay_unstable","useRatingDisplay_unstable","ratingDisplayClassNames","useRatingDisplayStyles_unstable","useRatingDisplayContextValues"],"mappings":";;;;;;;;;;;;eAASA,4BAAa;;;eASbG,qDAAuB;;;eAFvBF,iDAA4B;;;eAG5BI,4DAA6B;;;eADJD,6DAA+B;;;eADxDF,2CAAyB;;;+BARJ,kBAAkB;qCAOH,wBAAwB;kCAC3B,qBAAqB;8CACU,kCAAkC;+CAC7D,kCAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/renderRatingDisplay.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingDisplayState, RatingDisplaySlots, RatingDisplayContextValues } from './RatingDisplay.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of RatingDisplay\n */\nexport const renderRatingDisplay_unstable = (state: RatingDisplayState, contextValues: RatingDisplayContextValues) => {\n assertSlots<RatingDisplaySlots>(state);\n\n return (\n <RatingItemProvider value={contextValues.ratingItem}>\n <state.root>\n {state.root.children}\n {state.valueText && <state.valueText />}\n {state.countText && <state.countText />}\n </state.root>\n </RatingItemProvider>\n );\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/renderRatingDisplay.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingDisplayState, RatingDisplaySlots, RatingDisplayContextValues } from './RatingDisplay.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of RatingDisplay\n */\nexport const renderRatingDisplay_unstable = (state: RatingDisplayState, contextValues: RatingDisplayContextValues) => {\n assertSlots<RatingDisplaySlots>(state);\n\n return (\n <RatingItemProvider value={contextValues.ratingItem}>\n <state.root>\n {state.root.children}\n {state.valueText && <state.valueText />}\n {state.countText && <state.countText />}\n </state.root>\n </RatingItemProvider>\n );\n};\n"],"names":["assertSlots","RatingItemProvider","renderRatingDisplay_unstable","state","contextValues","value","ratingItem","root","children","valueText","countText"],"mappings":";;;;+BAUaE;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;mCAErB,mCAAmC;AAK/D,qCAAqC,CAACC,OAA2BC;QACtEJ,2BAAAA,EAAgCG;IAEhC,OAAA,WAAA,OACE,eAAA,EAACF,qCAAAA,EAAAA;QAAmBI,OAAOD,cAAcE,UAAU;kBACjD,WAAA,OAAA,gBAAA,EAACH,MAAMI,IAAI,EAAA;;gBACRJ,MAAMI,IAAI,CAACC,QAAQ;gBACnBL,MAAMM,SAAS,IAAA,WAAA,OAAI,eAAA,EAACN,MAAMM,SAAS,EAAA,CAAA;gBACnCN,MAAMO,SAAS,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,SAAS,EAAA,CAAA;;;;AAI5C,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId } from '@fluentui/react-utilities';\nimport type { RatingDisplayProps, RatingDisplayState } from './RatingDisplay.types';\nimport { StarFilled } from '@fluentui/react-icons';\nimport { RatingItem } from '../RatingItem/RatingItem';\n\n/**\n * Create the state required to render RatingDisplay.\n *\n * The returned state can be modified with hooks such as useRatingDisplayStyles_unstable,\n * before being passed to renderRatingDisplay_unstable.\n *\n * @param props - props from this instance of RatingDisplay\n * @param ref - reference to root HTMLDivElement of RatingDisplay\n */\nexport const useRatingDisplay_unstable = (\n props: RatingDisplayProps,\n ref: React.Ref<HTMLDivElement>,\n): RatingDisplayState => {\n const { color = 'neutral', count, compact = false, icon = StarFilled, max = 5, size = 'medium', value } = props;\n\n const valueTextId = useId('rating-value-');\n const countTextId = useId('rating-count-');\n\n // Generate the child RatingItems and memoize them to prevent unnecessary re-rendering\n const rootChildren = React.useMemo(() => {\n return compact ? (\n <RatingItem value={1} key={1} aria-hidden={true} />\n ) : (\n Array.from(Array(max), (_, i) => <RatingItem value={i + 1} key={i + 1} aria-hidden={true} />)\n );\n }, [compact, max]);\n\n const state: RatingDisplayState = {\n color,\n compact,\n icon,\n max,\n size,\n value,\n components: {\n root: 'div',\n valueText: 'span',\n countText: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n children: rootChildren,\n role: 'img',\n ...props,\n }),\n { elementType: 'div' },\n ),\n valueText: slot.optional(props.valueText, {\n renderByDefault: value !== undefined,\n defaultProps: { children: value, id: valueTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n countText: slot.optional(props.countText, {\n renderByDefault: count !== undefined,\n defaultProps: { children: count?.toLocaleString(), id: countTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n };\n if (!state.root['aria-label'] && !state.root['aria-labelledby']) {\n state.root['aria-labelledby'] = [state.valueText?.id, state.countText?.id].filter(Boolean).join(' ');\n }\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplay.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId } from '@fluentui/react-utilities';\nimport type { RatingDisplayProps, RatingDisplayState } from './RatingDisplay.types';\nimport { StarFilled } from '@fluentui/react-icons';\nimport { RatingItem } from '../RatingItem/RatingItem';\n\n/**\n * Create the state required to render RatingDisplay.\n *\n * The returned state can be modified with hooks such as useRatingDisplayStyles_unstable,\n * before being passed to renderRatingDisplay_unstable.\n *\n * @param props - props from this instance of RatingDisplay\n * @param ref - reference to root HTMLDivElement of RatingDisplay\n */\nexport const useRatingDisplay_unstable = (\n props: RatingDisplayProps,\n ref: React.Ref<HTMLDivElement>,\n): RatingDisplayState => {\n const { color = 'neutral', count, compact = false, icon = StarFilled, max = 5, size = 'medium', value } = props;\n\n const valueTextId = useId('rating-value-');\n const countTextId = useId('rating-count-');\n\n // Generate the child RatingItems and memoize them to prevent unnecessary re-rendering\n const rootChildren = React.useMemo(() => {\n return compact ? (\n <RatingItem value={1} key={1} aria-hidden={true} />\n ) : (\n Array.from(Array(max), (_, i) => <RatingItem value={i + 1} key={i + 1} aria-hidden={true} />)\n );\n }, [compact, max]);\n\n const state: RatingDisplayState = {\n color,\n compact,\n icon,\n max,\n size,\n value,\n components: {\n root: 'div',\n valueText: 'span',\n countText: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n children: rootChildren,\n role: 'img',\n ...props,\n }),\n { elementType: 'div' },\n ),\n valueText: slot.optional(props.valueText, {\n renderByDefault: value !== undefined,\n defaultProps: { children: value, id: valueTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n countText: slot.optional(props.countText, {\n renderByDefault: count !== undefined,\n defaultProps: { children: count?.toLocaleString(), id: countTextId, 'aria-hidden': true },\n elementType: 'span',\n }),\n };\n if (!state.root['aria-label'] && !state.root['aria-labelledby']) {\n state.root['aria-labelledby'] = [state.valueText?.id, state.countText?.id].filter(Boolean).join(' ');\n }\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","slot","useId","StarFilled","RatingItem","useRatingDisplay_unstable","props","ref","color","count","compact","icon","max","size","value","valueTextId","countTextId","rootChildren","useMemo","key","aria-hidden","Array","from","_","i","state","components","root","valueText","countText","always","children","role","elementType","optional","renderByDefault","undefined","defaultProps","id","toLocaleString","filter","Boolean","join"],"mappings":";;;;+BAeaM;;;;;;;iEAfU,QAAQ;gCACuB,4BAA4B;4BAEvD,wBAAwB;4BACxB,2BAA2B;AAW/C,kCAAkC,CACvCC,OACAC;IAEA,MAAM,EAAEC,QAAQ,SAAS,EAAEC,KAAK,EAAEC,UAAU,KAAK,EAAEC,OAAOR,sBAAU,EAAES,MAAM,CAAC,EAAEC,OAAO,QAAQ,EAAEC,KAAK,EAAE,GAAGR;IAE1G,MAAMS,kBAAcb,qBAAAA,EAAM;IAC1B,MAAMc,kBAAcd,qBAAAA,EAAM;IAE1B,sFAAsF;IACtF,MAAMe,eAAelB,OAAMmB,OAAO,CAAC;QACjC,OAAOR,UAAAA,WAAAA,GACL,OAAA,aAAA,CAACN,sBAAAA,EAAAA;YAAWU,OAAO;YAAGK,KAAK;YAAGC,eAAa;aAE3CC,MAAMC,IAAI,CAACD,MAAMT,MAAM,CAACW,GAAGC,IAAAA,WAAAA,GAAM,OAAA,aAAA,CAACpB,sBAAAA,EAAAA;gBAAWU,OAAOU,IAAI;gBAAGL,KAAKK,IAAI;gBAAGJ,eAAa;;IAExF,GAAG;QAACV;QAASE;KAAI;IAEjB,MAAMa,QAA4B;QAChCjB;QACAE;QACAC;QACAC;QACAC;QACAC;QACAY,YAAY;YACVC,MAAM;YACNC,WAAW;YACXC,WAAW;QACb;QACAF,MAAM1B,oBAAAA,CAAK6B,MAAM,KACf9B,wCAAAA,EAAyB,OAAO;YAC9BO;YACAwB,UAAUd;YACVe,MAAM;YACN,GAAG1B,KAAK;QACV,IACA;YAAE2B,aAAa;QAAM;QAEvBL,WAAW3B,oBAAAA,CAAKiC,QAAQ,CAAC5B,MAAMsB,SAAS,EAAE;YACxCO,iBAAiBrB,UAAUsB;YAC3BC,cAAc;gBAAEN,UAAUjB;gBAAOwB,IAAIvB;gBAAa,eAAe;YAAK;YACtEkB,aAAa;QACf;QACAJ,WAAW5B,oBAAAA,CAAKiC,QAAQ,CAAC5B,MAAMuB,SAAS,EAAE;YACxCM,iBAAiB1B,UAAU2B;YAC3BC,cAAc;gBAAEN,QAAQ,EAAEtB,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAO8B,cAAc;gBAAID,IAAItB;gBAAa,eAAe;YAAK;YACxFiB,aAAa;QACf;IACF;IACA,IAAI,CAACR,MAAME,IAAI,CAAC,aAAa,IAAI,CAACF,MAAME,IAAI,CAAC,kBAAkB,EAAE;YAC9BF,kBAAqBA;QAAtDA,MAAME,IAAI,CAAC,kBAAkB,GAAG;aAACF,mBAAAA,MAAMG,SAAAA,AAAS,MAAA,QAAfH,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAiBa,EAAE;aAAEb,mBAAAA,MAAMI,SAAAA,AAAS,MAAA,QAAfJ,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAiBa,EAAE;SAAC,CAACE,MAAM,CAACC,SAASC,IAAI,CAAC;IAClG;IACA,OAAOjB;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingDisplayContextValues, RatingDisplayState } from './RatingDisplay.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingDisplayContextValues = (state: RatingDisplayState): RatingDisplayContextValues => {\n const { color, compact, icon, size, value } = state;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n compact,\n iconFilled: icon,\n iconOutline: icon,\n interactive: false,\n step: 0.5,\n size,\n value,\n }),\n [color, compact, icon, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["useRatingDisplayContextValues","state","color","compact","icon","size","value","ratingItem","
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { RatingDisplayContextValues, RatingDisplayState } from './RatingDisplay.types';\nimport { RatingItemContextValue } from '../RatingItem/RatingItem.types';\n\nexport const useRatingDisplayContextValues = (state: RatingDisplayState): RatingDisplayContextValues => {\n const { color, compact, icon, size, value } = state;\n\n const ratingItem = React.useMemo<RatingItemContextValue>(\n () => ({\n color,\n compact,\n iconFilled: icon,\n iconOutline: icon,\n interactive: false,\n step: 0.5,\n size,\n value,\n }),\n [color, compact, icon, size, value],\n );\n\n return { ratingItem };\n};\n"],"names":["React","useRatingDisplayContextValues","state","color","compact","icon","size","value","ratingItem","useMemo","iconFilled","iconOutline","interactive","step"],"mappings":";;;;+BAIaC;;;;;;;iEAJU,QAAQ;AAIxB,sCAAsC,CAACC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGL;IAE9C,MAAMM,aAAaR,OAAMS,OAAO,CAC9B,IAAO,CAAA;YACLN;YACAC;YACAM,YAAYL;YACZM,aAAaN;YACbO,aAAa;YACbC,MAAM;YACNP;YACAC;SACF,CAAA,EACA;QAACJ;QAAOC;QAASC;QAAMC;QAAMC;KAAM;IAGrC,OAAO;QAAEC;IAAW;AACtB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useRatingDisplayStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const ratingDisplayClassNames = {\n root: 'fui-RatingDisplay',\n valueText: 'fui-RatingDisplay__valueText',\n countText: 'fui-RatingDisplay__countText'\n};\n/**\n * Styles for the root slot\n */ const useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center'\n});\nconst useLabelClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n marginLeft: tokens.spacingHorizontalXS,\n ...typographyStyles.caption1\n});\nconst useLabelStyles = makeStyles({\n large: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n marginLeft: tokens.spacingHorizontalSNudge\n },\n extraLarge: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n marginLeft: tokens.spacingHorizontalS\n },\n strong: {\n fontWeight: tokens.fontWeightSemibold\n },\n divider: {\n '::before': {\n content: '\"· \"'\n }\n }\n});\n/**\n * Apply styling to the RatingDisplay slots based on the state\n */ export const useRatingDisplayStyles_unstable = (state)=>{\n 'use no memo';\n const { size } = state;\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n if (state.valueText) {\n state.valueText.className = mergeClasses(ratingDisplayClassNames.valueText, labelClassName, labelStyles.strong, size === 'large' && labelStyles.large, size === 'extra-large' && labelStyles.extraLarge, state.valueText.className);\n }\n if (state.countText) {\n state.countText.className = mergeClasses(ratingDisplayClassNames.countText, labelClassName, size === 'large' && labelStyles.large, size === 'extra-large' && labelStyles.extraLarge, state.valueText && labelStyles.divider, state.countText.className);\n }\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useRatingDisplayStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const ratingDisplayClassNames = {\n root: 'fui-RatingDisplay',\n valueText: 'fui-RatingDisplay__valueText',\n countText: 'fui-RatingDisplay__countText'\n};\n/**\n * Styles for the root slot\n */ const useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center'\n});\nconst useLabelClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n marginLeft: tokens.spacingHorizontalXS,\n ...typographyStyles.caption1\n});\nconst useLabelStyles = makeStyles({\n large: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n marginLeft: tokens.spacingHorizontalSNudge\n },\n extraLarge: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n marginLeft: tokens.spacingHorizontalS\n },\n strong: {\n fontWeight: tokens.fontWeightSemibold\n },\n divider: {\n '::before': {\n content: '\"· \"'\n }\n }\n});\n/**\n * Apply styling to the RatingDisplay slots based on the state\n */ export const useRatingDisplayStyles_unstable = (state)=>{\n 'use no memo';\n const { size } = state;\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n if (state.valueText) {\n state.valueText.className = mergeClasses(ratingDisplayClassNames.valueText, labelClassName, labelStyles.strong, size === 'large' && labelStyles.large, size === 'extra-large' && labelStyles.extraLarge, state.valueText.className);\n }\n if (state.countText) {\n state.countText.className = mergeClasses(ratingDisplayClassNames.countText, labelClassName, size === 'large' && labelStyles.large, size === 'extra-large' && labelStyles.extraLarge, state.valueText && labelStyles.divider, state.countText.className);\n }\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","tokens","typographyStyles","ratingDisplayClassNames","root","valueText","countText","useRootClassName","useLabelClassName","useLabelStyles","large","Be2twd7","Bg96gwp","Frg6f3","extraLarge","strong","Bhrd7zp","divider","Ftih45","d","useRatingDisplayStyles_unstable","state","size","rootClassName","className","labelClassName","labelStyles"],"mappings":";;;;;;;;;;;IAEaK,uBAAuB;;;IAuCnBiB,+BAA+B;;;;uBAzCU,gBAAgB;AAEnE,gCAAgC;IACnChB,IAAI,EAAE,mBAAmB;IACzBC,SAAS,EAAE,8BAA8B;IACzCC,SAAS,EAAE;AACf,CAAC;AACD;;CAEA,GAAI,MAAMC,gBAAgB,GAAA,WAAA,OAAGT,oBAAA,EAAA,WAAA,MAAA;IAAA;CAI5B,CAAC;AACF,MAAMU,iBAAiB,GAAA,WAAA,GAAGV,wBAAA,EAAA,WAAA,WAAA;IAAA;IAAA;CAIzB,CAAC;AACF,MAAMW,cAAc,GAAA,WAAA,OAAGV,eAAA,EAAA;IAAAW,KAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,UAAA,EAAA;QAAAH,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;IAAA;IAAAE,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAmBtB,CAAC;AAGS,wCAAyCE,KAAK,IAAG;IACxD,aAAa;IACb,MAAM,EAAEC,IAAAA,EAAM,GAAGD,KAAK;IACtB,MAAME,aAAa,GAAGhB,gBAAgB,CAAC,CAAC;IACxCc,KAAK,CAACjB,IAAI,CAACoB,SAAS,GAAGxB,uBAAY,EAACG,uBAAuB,CAACC,IAAI,EAAEmB,aAAa,EAAEF,KAAK,CAACjB,IAAI,CAACoB,SAAS,CAAC;IACtG,MAAMC,cAAc,GAAGjB,iBAAiB,CAAC,CAAC;IAC1C,MAAMkB,WAAW,GAAGjB,cAAc,CAAC,CAAC;IACpC,IAAIY,KAAK,CAAChB,SAAS,EAAE;QACjBgB,KAAK,CAAChB,SAAS,CAACmB,SAAS,OAAGxB,mBAAY,EAACG,uBAAuB,CAACE,SAAS,EAAEoB,cAAc,EAAEC,WAAW,CAACX,MAAM,EAAEO,IAAI,KAAK,OAAO,IAAII,WAAW,CAAChB,KAAK,EAAEY,IAAI,KAAK,aAAa,IAAII,WAAW,CAACZ,UAAU,EAAEO,KAAK,CAAChB,SAAS,CAACmB,SAAS,CAAC;IACvO;IACA,IAAIH,KAAK,CAACf,SAAS,EAAE;QACjBe,KAAK,CAACf,SAAS,CAACkB,SAAS,OAAGxB,mBAAY,EAACG,uBAAuB,CAACG,SAAS,EAAEmB,cAAc,EAAEH,IAAI,KAAK,OAAO,IAAII,WAAW,CAAChB,KAAK,EAAEY,IAAI,KAAK,aAAa,IAAII,WAAW,CAACZ,UAAU,EAAEO,KAAK,CAAChB,SAAS,IAAIqB,WAAW,CAACT,OAAO,EAAEI,KAAK,CAACf,SAAS,CAACkB,SAAS,CAAC;IAC3P;IACA,OAAOH,KAAK;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingDisplaySlots, RatingDisplayState } from './RatingDisplay.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const ratingDisplayClassNames: SlotClassNames<RatingDisplaySlots> = {\n root: 'fui-RatingDisplay',\n valueText: 'fui-RatingDisplay__valueText',\n countText: 'fui-RatingDisplay__countText',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n});\n\nconst useLabelClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n marginLeft: tokens.spacingHorizontalXS,\n ...typographyStyles.caption1,\n});\n\nconst useLabelStyles = makeStyles({\n large: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n marginLeft: tokens.spacingHorizontalSNudge,\n },\n extraLarge: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n marginLeft: tokens.spacingHorizontalS,\n },\n strong: {\n fontWeight: tokens.fontWeightSemibold,\n },\n divider: {\n '::before': {\n content: '\"· \"',\n },\n },\n});\n\n/**\n * Apply styling to the RatingDisplay slots based on the state\n */\nexport const useRatingDisplayStyles_unstable = (state: RatingDisplayState): RatingDisplayState => {\n 'use no memo';\n\n const { size } = state;\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n\n if (state.valueText) {\n state.valueText.className = mergeClasses(\n ratingDisplayClassNames.valueText,\n labelClassName,\n labelStyles.strong,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText.className,\n );\n }\n if (state.countText) {\n state.countText.className = mergeClasses(\n ratingDisplayClassNames.countText,\n labelClassName,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText && labelStyles.divider,\n state.countText.className,\n );\n }\n\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { RatingDisplaySlots, RatingDisplayState } from './RatingDisplay.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const ratingDisplayClassNames: SlotClassNames<RatingDisplaySlots> = {\n root: 'fui-RatingDisplay',\n valueText: 'fui-RatingDisplay__valueText',\n countText: 'fui-RatingDisplay__countText',\n};\n\n/**\n * Styles for the root slot\n */\n\nconst useRootClassName = makeResetStyles({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n});\n\nconst useLabelClassName = makeResetStyles({\n color: tokens.colorNeutralForeground1,\n marginLeft: tokens.spacingHorizontalXS,\n ...typographyStyles.caption1,\n});\n\nconst useLabelStyles = makeStyles({\n large: {\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n marginLeft: tokens.spacingHorizontalSNudge,\n },\n extraLarge: {\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n marginLeft: tokens.spacingHorizontalS,\n },\n strong: {\n fontWeight: tokens.fontWeightSemibold,\n },\n divider: {\n '::before': {\n content: '\"· \"',\n },\n },\n});\n\n/**\n * Apply styling to the RatingDisplay slots based on the state\n */\nexport const useRatingDisplayStyles_unstable = (state: RatingDisplayState): RatingDisplayState => {\n 'use no memo';\n\n const { size } = state;\n const rootClassName = useRootClassName();\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n\n if (state.valueText) {\n state.valueText.className = mergeClasses(\n ratingDisplayClassNames.valueText,\n labelClassName,\n labelStyles.strong,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText.className,\n );\n }\n if (state.countText) {\n state.countText.className = mergeClasses(\n ratingDisplayClassNames.countText,\n labelClassName,\n size === 'large' && labelStyles.large,\n size === 'extra-large' && labelStyles.extraLarge,\n state.valueText && labelStyles.divider,\n state.countText.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","ratingDisplayClassNames","root","valueText","countText","useRootClassName","display","flexWrap","alignItems","useLabelClassName","color","colorNeutralForeground1","marginLeft","spacingHorizontalXS","caption1","useLabelStyles","large","fontSize","fontSizeBase300","lineHeight","lineHeightBase300","spacingHorizontalSNudge","extraLarge","fontSizeBase400","lineHeightBase400","spacingHorizontalS","strong","fontWeight","fontWeightSemibold","divider","content","useRatingDisplayStyles_unstable","state","size","rootClassName","className","labelClassName","labelStyles"],"mappings":";;;;;;;;;;;IAKaK,uBAAAA;;;IA8CA8B,+BAAAA;;;;uBAnD6C,iBAAiB;4BAGlC,wBAAwB;AAE1D,gCAAoE;IACzE7B,MAAM;IACNC,WAAW;IACXC,WAAW;AACb,EAAE;AAEF;;CAEC,GAED,MAAMC,uBAAmBT,sBAAAA,EAAgB;IACvCU,SAAS;IACTC,UAAU;IACVC,YAAY;AACd;AAEA,MAAMC,oBAAoBb,0BAAAA,EAAgB;IACxCc,OAAOX,kBAAAA,CAAOY,uBAAuB;IACrCC,YAAYb,kBAAAA,CAAOc,mBAAmB;IACtC,GAAGb,4BAAAA,CAAiBc,QAAQ;AAC9B;AAEA,MAAMC,qBAAiBlB,iBAAAA,EAAW;IAChCmB,OAAO;QACLC,UAAUlB,kBAAAA,CAAOmB,eAAe;QAChCC,YAAYpB,kBAAAA,CAAOqB,iBAAiB;QACpCR,YAAYb,kBAAAA,CAAOsB,uBAAuB;IAC5C;IACAC,YAAY;QACVL,UAAUlB,kBAAAA,CAAOwB,eAAe;QAChCJ,YAAYpB,kBAAAA,CAAOyB,iBAAiB;QACpCZ,YAAYb,kBAAAA,CAAO0B,kBAAkB;IACvC;IACAC,QAAQ;QACNC,YAAY5B,kBAAAA,CAAO6B,kBAAkB;IACvC;IACAC,SAAS;QACP,YAAY;YACVC,SAAS;QACX;IACF;AACF;AAKO,wCAAwC,CAACE;IAC9C;IAEA,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,MAAME,gBAAgB7B;IACtB2B,MAAM9B,IAAI,CAACiC,SAAS,OAAGrC,mBAAAA,EAAaG,wBAAwBC,IAAI,EAAEgC,eAAeF,MAAM9B,IAAI,CAACiC,SAAS;IACrG,MAAMC,iBAAiB3B;IACvB,MAAM4B,cAActB;IAEpB,IAAIiB,MAAM7B,SAAS,EAAE;QACnB6B,MAAM7B,SAAS,CAACgC,SAAS,OAAGrC,mBAAAA,EAC1BG,wBAAwBE,SAAS,EACjCiC,gBACAC,YAAYX,MAAM,EAClBO,SAAS,WAAWI,YAAYrB,KAAK,EACrCiB,SAAS,iBAAiBI,YAAYf,UAAU,EAChDU,MAAM7B,SAAS,CAACgC,SAAS;IAE7B;IACA,IAAIH,MAAM5B,SAAS,EAAE;QACnB4B,MAAM5B,SAAS,CAAC+B,SAAS,OAAGrC,mBAAAA,EAC1BG,wBAAwBG,SAAS,EACjCgC,gBACAH,SAAS,WAAWI,YAAYrB,KAAK,EACrCiB,SAAS,iBAAiBI,YAAYf,UAAU,EAChDU,MAAM7B,SAAS,IAAIkC,YAAYR,OAAO,EACtCG,MAAM5B,SAAS,CAAC+B,SAAS;IAE7B;IAEA,OAAOH;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/RatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingItem_unstable } from './useRatingItem';\nimport { renderRatingItem_unstable } from './renderRatingItem';\nimport { useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\nimport type { RatingItemProps } from './RatingItem.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * RatingItem is an item that will be used to set or display a rating value.\n */\nexport const RatingItem: ForwardRefComponent<RatingItemProps> = React.forwardRef((props, ref) => {\n const state = useRatingItem_unstable(props, ref);\n\n useRatingItemStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingItemStyles_unstable')(state);\n\n return renderRatingItem_unstable(state);\n});\n\nRatingItem.displayName = 'RatingItem';\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/RatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useRatingItem_unstable } from './useRatingItem';\nimport { renderRatingItem_unstable } from './renderRatingItem';\nimport { useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\nimport type { RatingItemProps } from './RatingItem.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * RatingItem is an item that will be used to set or display a rating value.\n */\nexport const RatingItem: ForwardRefComponent<RatingItemProps> = React.forwardRef((props, ref) => {\n const state = useRatingItem_unstable(props, ref);\n\n useRatingItemStyles_unstable(state);\n useCustomStyleHook_unstable('useRatingItemStyles_unstable')(state);\n\n return renderRatingItem_unstable(state);\n});\n\nRatingItem.displayName = 'RatingItem';\n"],"names":["React","useRatingItem_unstable","renderRatingItem_unstable","useRatingItemStyles_unstable","useCustomStyleHook_unstable","RatingItem","forwardRef","props","ref","state","displayName"],"mappings":";;;;+BAWaK;;;;;;;iEAXU,QAAQ;+BAEQ,kBAAkB;kCACf,qBAAqB;2CAClB,+BAA+B;qCAEhC,kCAAkC;AAKvE,mBAAMA,WAAAA,GAAmDL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQR,yCAAAA,EAAuBM,OAAOC;QAE5CL,uDAAAA,EAA6BM;QAC7BL,gDAAAA,EAA4B,gCAAgCK;IAE5D,WAAOP,2CAAAA,EAA0BO;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/RatingItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingState } from '../Rating/Rating.types';\nimport { RatingDisplayState } from '../RatingDisplay/RatingDisplay.types';\n\nexport type RatingItemSlots = {\n /**\n * The root slot of the RatingItem.\n * Default html element is span\n */\n root: NonNullable<Slot<'span'>>;\n /**\n * Icon displayed when the rating value is greater than or equal to the item's value.\n */\n selectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Icon displayed when the rating value is less than the item's value.\n */\n unselectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Radio input slot used for half star precision\n */\n halfValueInput?: NonNullable<Slot<'input'>>;\n /**\n * Radio input slot used for full star precision\n */\n fullValueInput?: NonNullable<Slot<'input'>>;\n};\n\n/**\n * RatingItem Props\n */\nexport type RatingItemProps = ComponentProps<Partial<RatingItemSlots>> & {\n /**\n * The positive whole number value that is displayed by this RatingItem\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingItem\n */\nexport type RatingItemState = ComponentState<RatingItemSlots> &\n Required<Pick<RatingItemProps, 'value'>> &\n Pick<RatingState, 'color' | 'step' | 'size'> & {\n iconFillWidth: number;\n appearance: 'outline' | 'filled';\n };\n\nexport type RatingItemContextValue = Partial<Pick<RatingState, 'name' | 'hoveredValue' | 'value'>> &\n Pick<RatingState, 'color' | 'iconFilled' | 'iconOutline' | 'itemLabel' | 'step' | 'size'> &\n Partial<Pick<RatingDisplayState, 'compact'>> & {\n interactive?: boolean;\n };\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/RatingItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RatingState } from '../Rating/Rating.types';\nimport { RatingDisplayState } from '../RatingDisplay/RatingDisplay.types';\n\nexport type RatingItemSlots = {\n /**\n * The root slot of the RatingItem.\n * Default html element is span\n */\n root: NonNullable<Slot<'span'>>;\n /**\n * Icon displayed when the rating value is greater than or equal to the item's value.\n */\n selectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Icon displayed when the rating value is less than the item's value.\n */\n unselectedIcon?: NonNullable<Slot<'div'>>;\n /**\n * Radio input slot used for half star precision\n */\n halfValueInput?: NonNullable<Slot<'input'>>;\n /**\n * Radio input slot used for full star precision\n */\n fullValueInput?: NonNullable<Slot<'input'>>;\n};\n\n/**\n * RatingItem Props\n */\nexport type RatingItemProps = ComponentProps<Partial<RatingItemSlots>> & {\n /**\n * The positive whole number value that is displayed by this RatingItem\n */\n value?: number;\n};\n\n/**\n * State used in rendering RatingItem\n */\nexport type RatingItemState = ComponentState<RatingItemSlots> &\n Required<Pick<RatingItemProps, 'value'>> &\n Pick<RatingState, 'color' | 'step' | 'size'> & {\n iconFillWidth: number;\n appearance: 'outline' | 'filled';\n };\n\nexport type RatingItemContextValue = Partial<Pick<RatingState, 'name' | 'hoveredValue' | 'value'>> &\n Pick<RatingState, 'color' | 'iconFilled' | 'iconOutline' | 'itemLabel' | 'step' | 'size'> &\n Partial<Pick<RatingDisplayState, 'compact'>> & {\n interactive?: boolean;\n };\n"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/index.ts"],"sourcesContent":["export { RatingItem } from './RatingItem';\nexport type { RatingItemContextValue, RatingItemProps, RatingItemSlots, RatingItemState } from './RatingItem.types';\nexport { renderRatingItem_unstable } from './renderRatingItem';\nexport { useRatingItem_unstable } from './useRatingItem';\nexport { ratingItemClassNames, useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\n"],"names":["RatingItem","
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/index.ts"],"sourcesContent":["export { RatingItem } from './RatingItem';\nexport type { RatingItemContextValue, RatingItemProps, RatingItemSlots, RatingItemState } from './RatingItem.types';\nexport { renderRatingItem_unstable } from './renderRatingItem';\nexport { useRatingItem_unstable } from './useRatingItem';\nexport { ratingItemClassNames, useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\n"],"names":["RatingItem","renderRatingItem_unstable","useRatingItem_unstable","ratingItemClassNames","useRatingItemStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,sBAAU;;;eAIVG,+CAAoB;;;eAFpBF,2CAAyB;;;eAEHG,uDAA4B;;;eADlDF,qCAAsB;;;4BAHJ,eAAe;kCAEA,qBAAqB;+BACxB,kBAAkB;2CACU,+BAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/renderRatingItem.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingItemState, RatingItemSlots } from './RatingItem.types';\n\n/**\n * Render the final JSX of RatingItem\n */\nexport const renderRatingItem_unstable = (state: RatingItemState) => {\n assertSlots<RatingItemSlots>(state);\n\n return (\n <state.root>\n {state.halfValueInput && <state.halfValueInput />}\n {state.fullValueInput && <state.fullValueInput />}\n {state.unselectedIcon && <state.unselectedIcon />}\n {state.selectedIcon && <state.selectedIcon />}\n </state.root>\n );\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/renderRatingItem.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { RatingItemState, RatingItemSlots } from './RatingItem.types';\n\n/**\n * Render the final JSX of RatingItem\n */\nexport const renderRatingItem_unstable = (state: RatingItemState) => {\n assertSlots<RatingItemSlots>(state);\n\n return (\n <state.root>\n {state.halfValueInput && <state.halfValueInput />}\n {state.fullValueInput && <state.fullValueInput />}\n {state.unselectedIcon && <state.unselectedIcon />}\n {state.selectedIcon && <state.selectedIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderRatingItem_unstable","state","root","halfValueInput","fullValueInput","unselectedIcon","selectedIcon"],"mappings":";;;;+BASaC;;;;;;4BARb,iCAAiD;gCAErB,4BAA4B;AAMjD,kCAAkC,CAACC;QACxCF,2BAAAA,EAA6BE;IAE7B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,cAAc,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,cAAc,EAAA,CAAA;YAC7CF,MAAMG,cAAc,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,cAAc,EAAA,CAAA;YAC7CH,MAAMI,cAAc,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,cAAc,EAAA,CAAA;YAC7CJ,MAAMK,YAAY,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,YAAY,EAAA,CAAA;;;AAGhD,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/useRatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RatingItemProps, RatingItemState } from './RatingItem.types';\nimport { useRatingItemContextValue_unstable } from '../../contexts/RatingItemContext';\n\nconst defaultItemLabel = (num: number) => num + '';\n\n/**\n * Create the state required to render RatingItem.\n *\n * The returned state can be modified with hooks such as useRatingItemStyles_unstable,\n * before being passed to renderRatingItem_unstable.\n *\n * @param props - props from this instance of RatingItem\n * @param ref - reference to root HTMLElement of RatingItem\n */\nexport const useRatingItem_unstable = (props: RatingItemProps, ref: React.Ref<HTMLSpanElement>): RatingItemState => {\n const context = useRatingItemContextValue_unstable();\n const { value = 0 } = props;\n const { itemLabel = defaultItemLabel, iconFilled: IconFilled, iconOutline: IconOutline } = context;\n\n const ratingValue = Math.round((context.value || 0) * 2) / 2; // round to the nearest 0.5\n\n const displayedRatingValue = context.hoveredValue ?? ratingValue;\n\n const appearance = context.interactive ? 'outline' : 'filled';\n\n let iconFillWidth;\n if (context.compact || displayedRatingValue >= value) {\n iconFillWidth = 1;\n } else if (displayedRatingValue >= value - 0.5) {\n iconFillWidth = 0.5;\n } else {\n iconFillWidth = 0;\n }\n\n const root = slot.always(\n getIntrinsicElementProps('span', {\n ref: useMergedRefs(useFocusWithin<HTMLSpanElement>(), ref),\n ...props,\n }),\n { elementType: 'span' },\n );\n\n let unselectedIcon;\n if (iconFillWidth < 1) {\n unselectedIcon = slot.always(props.unselectedIcon, {\n defaultProps: {\n children: appearance === 'filled' ? <IconFilled /> : <IconOutline />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let selectedIcon;\n if (iconFillWidth > 0) {\n selectedIcon = slot.always(props.selectedIcon, {\n defaultProps: {\n children: <IconFilled />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let halfValueInput;\n if (context.interactive && context.step === 0.5) {\n halfValueInput = slot.always(props.halfValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value: value - 0.5,\n checked: ratingValue === value - 0.5,\n 'aria-label': itemLabel(value - 0.5),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n elementType: 'input',\n });\n }\n\n let fullValueInput;\n if (context.interactive) {\n fullValueInput = slot.always(props.fullValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value,\n checked: ratingValue === value,\n 'aria-label': itemLabel(value),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n\n elementType: 'input',\n });\n }\n\n const state: RatingItemState = {\n appearance,\n color: context.color,\n step: context.step,\n size: context.size,\n iconFillWidth,\n value,\n components: {\n root: 'span',\n selectedIcon: 'div',\n unselectedIcon: 'div',\n halfValueInput: 'input',\n fullValueInput: 'input',\n },\n root,\n selectedIcon,\n unselectedIcon,\n halfValueInput,\n fullValueInput,\n };\n\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/useRatingItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RatingItemProps, RatingItemState } from './RatingItem.types';\nimport { useRatingItemContextValue_unstable } from '../../contexts/RatingItemContext';\n\nconst defaultItemLabel = (num: number) => num + '';\n\n/**\n * Create the state required to render RatingItem.\n *\n * The returned state can be modified with hooks such as useRatingItemStyles_unstable,\n * before being passed to renderRatingItem_unstable.\n *\n * @param props - props from this instance of RatingItem\n * @param ref - reference to root HTMLElement of RatingItem\n */\nexport const useRatingItem_unstable = (props: RatingItemProps, ref: React.Ref<HTMLSpanElement>): RatingItemState => {\n const context = useRatingItemContextValue_unstable();\n const { value = 0 } = props;\n const { itemLabel = defaultItemLabel, iconFilled: IconFilled, iconOutline: IconOutline } = context;\n\n const ratingValue = Math.round((context.value || 0) * 2) / 2; // round to the nearest 0.5\n\n const displayedRatingValue = context.hoveredValue ?? ratingValue;\n\n const appearance = context.interactive ? 'outline' : 'filled';\n\n let iconFillWidth;\n if (context.compact || displayedRatingValue >= value) {\n iconFillWidth = 1;\n } else if (displayedRatingValue >= value - 0.5) {\n iconFillWidth = 0.5;\n } else {\n iconFillWidth = 0;\n }\n\n const root = slot.always(\n getIntrinsicElementProps('span', {\n ref: useMergedRefs(useFocusWithin<HTMLSpanElement>(), ref),\n ...props,\n }),\n { elementType: 'span' },\n );\n\n let unselectedIcon;\n if (iconFillWidth < 1) {\n unselectedIcon = slot.always(props.unselectedIcon, {\n defaultProps: {\n children: appearance === 'filled' ? <IconFilled /> : <IconOutline />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let selectedIcon;\n if (iconFillWidth > 0) {\n selectedIcon = slot.always(props.selectedIcon, {\n defaultProps: {\n children: <IconFilled />,\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n }\n\n let halfValueInput;\n if (context.interactive && context.step === 0.5) {\n halfValueInput = slot.always(props.halfValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value: value - 0.5,\n checked: ratingValue === value - 0.5,\n 'aria-label': itemLabel(value - 0.5),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n elementType: 'input',\n });\n }\n\n let fullValueInput;\n if (context.interactive) {\n fullValueInput = slot.always(props.fullValueInput, {\n defaultProps: {\n type: 'radio',\n name: context.name,\n value,\n checked: ratingValue === value,\n 'aria-label': itemLabel(value),\n onChange: () => {\n // This empty onChange handler silences an incorrect React warning about not using onChange for a controlled input.\n // The parent Rating component has the real onChange handler to listen to change events from this input.\n },\n },\n\n elementType: 'input',\n });\n }\n\n const state: RatingItemState = {\n appearance,\n color: context.color,\n step: context.step,\n size: context.size,\n iconFillWidth,\n value,\n components: {\n root: 'span',\n selectedIcon: 'div',\n unselectedIcon: 'div',\n halfValueInput: 'input',\n fullValueInput: 'input',\n },\n root,\n selectedIcon,\n unselectedIcon,\n halfValueInput,\n fullValueInput,\n };\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","slot","useMergedRefs","useFocusWithin","useRatingItemContextValue_unstable","defaultItemLabel","num","useRatingItem_unstable","props","ref","context","value","itemLabel","iconFilled","IconFilled","iconOutline","IconOutline","ratingValue","Math","round","displayedRatingValue","hoveredValue","appearance","interactive","iconFillWidth","compact","root","always","elementType","unselectedIcon","defaultProps","children","selectedIcon","halfValueInput","step","type","name","checked","onChange","fullValueInput","state","color","size","components"],"mappings":";;;;+BAiBaQ;;;;;;;iEAjBU,QAAQ;gCAC+B,4BAA4B;8BAC3D,0BAA0B;mCAEN,mCAAmC;AAEtF,MAAMF,mBAAmB,CAACC,MAAgBA,MAAM;AAWzC,+BAA+B,CAACE,OAAwBC;IAC7D,MAAMC,cAAUN,qDAAAA;IAChB,MAAM,EAAEO,QAAQ,CAAC,EAAE,GAAGH;IACtB,MAAM,EAAEI,YAAYP,gBAAgB,EAAEQ,YAAYC,UAAU,EAAEC,aAAaC,WAAW,EAAE,GAAGN;IAE3F,MAAMO,cAAcC,KAAKC,KAAK,CAAET,CAAAA,QAAQC,KAAK,KAAI,CAAA,GAAK,KAAK,GAAG,2BAA2B;QAE5DD;IAA7B,MAAMU,uBAAuBV,CAAAA,wBAAAA,QAAQW,YAAAA,AAAY,MAAA,QAApBX,0BAAAA,KAAAA,IAAAA,wBAAwBO;IAErD,MAAMK,aAAaZ,QAAQa,WAAW,GAAG,YAAY;IAErD,IAAIC;IACJ,IA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gB,iBAAiBtC,oBAAAA,CAAK0B,MAAM,CAACnB,MAAM+B,cAAc,EAAE;YACjDT,cAAc;gBACZK,MAAM;gBACNC,MAAM1B,QAAQ0B,IAAI;gBAClBzB;gBACA0B,SAASpB,gBAAgBN;gBACzB,cAAcC,UAAUD;gBACxB2B,UAAU;gBACR,mHAAmH;gBACnH,wGAAwG;gBAC1G;YACF;YAEAV,aAAa;QACf;IACF;IAEA,MAAMY,QAAyB;QAC7BlB;QACAmB,OAAO/B,QAAQ+B,KAAK;QACpBP,MAAMxB,QAAQwB,IAAI;QAClBQ,MAAMhC,QAAQgC,IAAI;QAClBlB;QACAb;QACAgC,YAAY;YACVjB,MAAM;YACNM,cAAc;YACdH,gBAAgB;YAChBI,gBAAgB;YAChBM,gBAAgB;QAClB;QACAb;QACAM;QACAH;QACAI;QACAM;IACF;IAEA,OAAOC;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useRatingItemStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } 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 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 'use no memo';\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"],"names":["ratingItemClassNames","useRatingItemStyles_unstable","root","selectedIcon","unselectedIcon","halfValueInput","fullValueInput","useStyles","__styles","qhf8xq","Brovlpu","B486eqv","Bssx7fj","uh7if5","clntm0","Dlk2r6","Bm3wd5j","Bbrhkcr","f1oku","aywvf2","B2j2mmj","wigs8","pbfy6t","B0v4ure","Byrf0fs","Bsiemmq","Bwckmig","skfxo0","Iidy0u","B98u21t","Bvwlmkc","jo1ztg","Ba1iezr","Blmvk6g","B24cy0v","Bil7v7r","Br3gin4","nr063g","ghq09","Bbgo44z","Bseh09z","az1dzo","Ba3ybja","B6352mv","vppk2z","Biaj6j7","B2pnrqr","B29w5g4","Bhhzhcn","Bec0n69","small","Be2twd7","a9b677","Bqenvij","medium","large","d","p","f","i","m","useInputBaseClassName","__resetStyles","useInputStyles","lowerHalf","j35jbq","upperHalf","oyh7mz","useIndicatorBaseClassName","useIndicatorStyles","l5kjut","uoufgc","v39lw8","Bbwb3tu","Frg6f3","brand","sj55zd","marigold","filled","ojy3ng","Bbusuzp","B6jmk37","brandFilled","marigoldFilled","state","color","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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GC,IAAAA,mBAAY,EAAC/F,qBAAqBM,cAAc,EAAEoF,oBAAoBN,MAAM/E,cAAc,IAAIsF,YAAYzB,SAAS,EAAEkB,MAAM9E,cAAc,CAACwF,SAAS;IACxL;IACA,IAAIV,MAAMhF,cAAc,EAAE;QACtBgF,MAAMhF,cAAc,CAAC0F,SAAS,GAAGC,IAAAA,mBAAY,EAAC/F,qBAAqBI,cAAc,EAAEwF,wBAAwBJ,eAAe,YAAYK,gBAAgBf,MAAM,EAAEO,UAAU,WAAYG,CAAAA,eAAe,WAAWK,gBAAgBX,WAAW,GAAGW,gBAAgBlB,KAAK,AAALA,GAAQU,UAAU,cAAeG,CAAAA,eAAe,WAAWK,gBAAgBV,cAAc,GAAGU,gBAAgBhB,QAAQ,AAARA,GAAWU,kBAAkB,OAAOM,gBAAgB3B,SAAS,EAAEkB,MAAMhF,cAAc,CAAC0F,SAAS;IACzc;IACA,IAAIV,MAAMjF,YAAY,EAAE;QACpBiF,MAAMjF,YAAY,CAAC2F,SAAS,GAAGC,IAAAA,mBAAY,EAAC/F,qBAAqBG,YAAY,EAAEyF,wBAAwBP,UAAU,WAAWQ,gBAAgBlB,KAAK,EAAEU,UAAU,cAAcQ,gBAAgBhB,QAAQ,EAAEU,kBAAkB,OAAOM,gBAAgB7B,SAAS,EAAEoB,MAAMjF,YAAY,CAAC2F,SAAS;IACzR;IACA,OAAOV;AACX"}
|
|
1
|
+
{"version":3,"sources":["useRatingItemStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } 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 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 'use no memo';\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"],"names":["__resetStyles","__styles","mergeClasses","tokens","createFocusOutlineStyle","ratingItemClassNames","root","selectedIcon","unselectedIcon","halfValueInput","fullValueInput","useStyles","qhf8xq","Brovlpu","B486eqv","Bssx7fj","uh7if5","clntm0","Dlk2r6","Bm3wd5j","Bbrhkcr","f1oku","aywvf2","B2j2mmj","wigs8","pbfy6t","B0v4ure","Byrf0fs","Bsiemmq","Bwckmig","skfxo0","Iidy0u","B98u21t","Bvwlmkc","jo1ztg","Ba1iezr","Blmvk6g","B24cy0v","Bil7v7r","Br3gin4","nr063g","ghq09","Bbgo44z","Bseh09z","az1dzo","Ba3ybja","B6352mv","vppk2z","Biaj6j7","B2pnrqr","B29w5g4","Bhhzhcn","Bec0n69","small","Be2twd7","a9b677","Bqenvij","medium","large","d","p","f","i","m","useInputBaseClassName","useInputStyles","lowerHalf","j35jbq","upperHalf","oyh7mz","useIndicatorBaseClassName","useIndicatorStyles","l5kjut","uoufgc","v39lw8","Bbwb3tu","Frg6f3","brand","sj55zd","marigold","filled","ojy3ng","Bbusuzp","B6jmk37","brandFilled","marigoldFilled","useRatingItemStyles_unstable","state","color","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className"],"mappings":";;;;;;;;;;;IAGaK,oBAAoB;;;gCAwGY;eAA5BiF;;;uBA3GyC,gBAAgB;AAGnE,6BAA6B;IAChChF,IAAI,EAAE,gBAAgB;IACtBC,YAAY,EAAE,8BAA8B;IAC5CC,cAAc,EAAE,gCAAgC;IAChDC,cAAc,EAAE,gCAAgC;IAChDC,cAAc,EAAE;AACpB,CAAC;AACD;;CAEA,GAAI,MAAMC,SAAS,GAAA,WAAA,OAAGV,eAAA,EAAA;IAAAK,IAAA,EAAA;QAAAM,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,KAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,OAAA,EAAA;QAAAC,KAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,KAAA,EAAA;QAAAC,OAAA,EAAA;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UAAU,KAAK,QAAQ,GAAGK,eAAe,CAACZ,WAAW,GAAGY,eAAe,CAACnB,KAAAA,AAAK,CAAC,EAAEW,KAAK,KAAK,UAAU,KAAKG,UAAU,KAAK,QAAQ,GAAGK,eAAe,CAACX,cAAc,GAAGW,eAAe,CAACjB,QAAAA,AAAQ,CAAC,EAAEW,aAAa,KAAK,GAAG,IAAIM,eAAe,CAAC5B,SAAS,EAAEmB,KAAK,CAAC/E,cAAc,CAACyF,SAAS,CAAC;IAC1c;IACA,IAAIV,KAAK,CAAChF,YAAY,EAAE;QACpBgF,KAAK,CAAChF,YAAY,CAAC0F,SAAS,OAAG/F,mBAAY,EAACG,oBAAoB,CAACE,YAAY,EAAEwF,sBAAsB,EAAEP,KAAK,KAAK,OAAO,IAAIQ,eAAe,CAACnB,KAAK,EAAEW,KAAK,KAAK,UAAU,IAAIQ,eAAe,CAACjB,QAAQ,EAAEW,aAAa,KAAK,GAAG,IAAIM,eAAe,CAAC9B,SAAS,EAAEqB,KAAK,CAAChF,YAAY,CAAC0F,SAAS,CAAC;IAC1R;IACA,OAAOV,KAAK;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/useRatingItemStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport type { RatingItemSlots, RatingItemState } from './RatingItem.types';\n\nexport const ratingItemClassNames: SlotClassNames<RatingItemSlots> = {\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/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n small: {\n fontSize: '12px',\n width: '12px',\n height: '12px',\n },\n\n medium: {\n fontSize: '16px',\n width: '16px',\n height: '16px',\n },\n\n large: {\n fontSize: '20px',\n width: '20px',\n height: '20px',\n },\n\n 'extra-large': {\n fontSize: '28px',\n width: '28px',\n height: '28px',\n },\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});\n\nconst useInputStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n },\n upperHalf: {\n left: '50%',\n },\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});\n\nconst useIndicatorStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n '& > svg': {\n 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/**\n * Apply styling to the RatingItem slots based on the state\n */\nexport const useRatingItemStyles_unstable = (state: RatingItemState): RatingItemState => {\n 'use no memo';\n\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\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n\n if (state.halfValueInput) {\n state.halfValueInput.className = mergeClasses(\n ratingItemClassNames.halfValueInput,\n inputBaseClassName,\n inputStyles.lowerHalf,\n state.halfValueInput.className,\n );\n }\n\n if (state.fullValueInput) {\n state.fullValueInput.className = mergeClasses(\n ratingItemClassNames.fullValueInput,\n inputBaseClassName,\n state.halfValueInput && inputStyles.upperHalf,\n state.fullValueInput.className,\n );\n }\n\n if (state.unselectedIcon) {\n state.unselectedIcon.className = mergeClasses(\n ratingItemClassNames.unselectedIcon,\n indicatorBaseClassName,\n appearance === 'filled' && indicatorStyles.filled,\n color === 'brand' && (appearance === 'filled' ? indicatorStyles.brandFilled : indicatorStyles.brand),\n color === 'marigold' && (appearance === 'filled' ? indicatorStyles.marigoldFilled : indicatorStyles.marigold),\n iconFillWidth === 0.5 && indicatorStyles.upperHalf,\n state.unselectedIcon.className,\n );\n }\n\n if (state.selectedIcon) {\n state.selectedIcon.className = mergeClasses(\n ratingItemClassNames.selectedIcon,\n indicatorBaseClassName,\n color === 'brand' && indicatorStyles.brand,\n color === 'marigold' && indicatorStyles.marigold,\n iconFillWidth === 0.5 && indicatorStyles.lowerHalf,\n state.selectedIcon.className,\n );\n }\n\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/useRatingItemStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport type { RatingItemSlots, RatingItemState } from './RatingItem.types';\n\nexport const ratingItemClassNames: SlotClassNames<RatingItemSlots> = {\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/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n small: {\n fontSize: '12px',\n width: '12px',\n height: '12px',\n },\n\n medium: {\n fontSize: '16px',\n width: '16px',\n height: '16px',\n },\n\n large: {\n fontSize: '20px',\n width: '20px',\n height: '20px',\n },\n\n 'extra-large': {\n fontSize: '28px',\n width: '28px',\n height: '28px',\n },\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});\n\nconst useInputStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n },\n upperHalf: {\n left: '50%',\n },\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});\n\nconst useIndicatorStyles = makeStyles({\n lowerHalf: {\n right: '50%',\n '& > svg': {\n 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/**\n * Apply styling to the RatingItem slots based on the state\n */\nexport const useRatingItemStyles_unstable = (state: RatingItemState): RatingItemState => {\n 'use no memo';\n\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\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n\n if (state.halfValueInput) {\n state.halfValueInput.className = mergeClasses(\n ratingItemClassNames.halfValueInput,\n inputBaseClassName,\n inputStyles.lowerHalf,\n state.halfValueInput.className,\n );\n }\n\n if (state.fullValueInput) {\n state.fullValueInput.className = mergeClasses(\n ratingItemClassNames.fullValueInput,\n inputBaseClassName,\n state.halfValueInput && inputStyles.upperHalf,\n state.fullValueInput.className,\n );\n }\n\n if (state.unselectedIcon) {\n state.unselectedIcon.className = mergeClasses(\n ratingItemClassNames.unselectedIcon,\n indicatorBaseClassName,\n appearance === 'filled' && indicatorStyles.filled,\n color === 'brand' && (appearance === 'filled' ? indicatorStyles.brandFilled : indicatorStyles.brand),\n color === 'marigold' && (appearance === 'filled' ? indicatorStyles.marigoldFilled : indicatorStyles.marigold),\n iconFillWidth === 0.5 && indicatorStyles.upperHalf,\n state.unselectedIcon.className,\n );\n }\n\n if (state.selectedIcon) {\n state.selectedIcon.className = mergeClasses(\n ratingItemClassNames.selectedIcon,\n indicatorBaseClassName,\n color === 'brand' && indicatorStyles.brand,\n color === 'marigold' && indicatorStyles.marigold,\n iconFillWidth === 0.5 && indicatorStyles.lowerHalf,\n state.selectedIcon.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","createFocusOutlineStyle","ratingItemClassNames","root","selectedIcon","unselectedIcon","halfValueInput","fullValueInput","useStyles","position","style","selector","small","fontSize","width","height","medium","large","useInputBaseClassName","left","top","right","bottom","boxSizing","margin","opacity","cursor","useInputStyles","lowerHalf","upperHalf","useIndicatorBaseClassName","display","overflow","color","colorNeutralForeground1","fill","pointerEvents","useIndicatorStyles","flex","marginLeft","brand","colorBrandForeground1","marigold","colorPaletteMarigoldBorderActive","filled","colorNeutralBackground6","stroke","colorTransparentStroke","brandFilled","colorBrandBackground2","marigoldFilled","colorPaletteMarigoldBackground2","useRatingItemStyles_unstable","state","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className"],"mappings":";;;;;;;;;;;IAMaK,oBAAAA;;;gCAgHAkD;eAAAA;;;uBAtH6C,iBAAiB;4BAEpD,wBAAwB;8BACP,0BAA0B;AAG3D,6BAA8D;IACnEjD,MAAM;IACNC,cAAc;IACdC,gBAAgB;IAChBC,gBAAgB;IAChBC,gBAAgB;AAClB,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAYV,iBAAAA,EAAW;IAC3BK,MAAM;QACJM,UAAU;QACV,OAAGR,qCAAAA,EAAwB;YAAES,OAAO,CAAC;YAAGC,UAAU;QAAe,EAAE;IACrE;IACAC,OAAO;QACLC,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;IAEAC,QAAQ;QACNH,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;IAEAE,OAAO;QACLJ,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;IAEA,eAAe;QACbF,UAAU;QACVC,OAAO;QACPC,QAAQ;IACV;AACF;AAEA,MAAMG,4BAAwBrB,sBAAAA,EAAgB;IAC5CY,UAAU;IACVU,MAAM;IACNC,KAAK;IACLC,OAAO;IACPC,QAAQ;IACRC,WAAW;IACXC,QAAQ;IACRC,SAAS;IACTC,QAAQ;IACRX,QAAQ;AACV;AAEA,MAAMY,qBAAiB7B,iBAAAA,EAAW;IAChC8B,WAAW;QACTP,OAAO;IACT;IACAQ,WAAW;QACTV,MAAM;IACR;AACF;AAEA,MAAMW,gCAA4BjC,sBAAAA,EAAgB;IAChDkC,SAAS;IACTC,UAAU;IACVC,OAAOjC,kBAAAA,CAAOkC,uBAAuB;IACrCC,MAAM;IACNC,eAAe;IACf3B,UAAU;IACVU,MAAM;IACNE,OAAO;IACPD,KAAK;IACLE,QAAQ;AACV;AAEA,MAAMe,yBAAqBvC,iB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AS,EAC7CwB,MAAM9C,cAAc,CAACuD,SAAS;IAElC;IAEA,IAAIT,MAAMhD,cAAc,EAAE;QACxBgD,MAAMhD,cAAc,CAACyD,SAAS,GAAG/D,uBAAAA,EAC/BG,qBAAqBG,cAAc,EACnCuD,wBACAJ,eAAe,YAAYK,gBAAgBjB,MAAM,EACjDX,UAAU,WAAYuB,CAAAA,eAAe,WAAWK,gBAAgBb,WAAW,GAAGa,gBAAgBrB,KAAAA,AAAI,GAClGP,UAAU,cAAeuB,CAAAA,eAAe,WAAWK,gBAAgBX,cAAc,GAAGW,gBAAgBnB,QAAAA,AAAO,GAC3Ga,kBAAkB,OAAOM,gBAAgBhC,SAAS,EAClDwB,MAAMhD,cAAc,CAACyD,SAAS;IAElC;IAEA,IAAIT,MAAMjD,YAAY,EAAE;QACtBiD,MAAMjD,YAAY,CAAC0D,SAAS,OAAG/D,mBAAAA,EAC7BG,qBAAqBE,YAAY,EACjCwD,wBACA3B,UAAU,WAAW4B,gBAAgBrB,KAAK,EAC1CP,UAAU,cAAc4B,gBAAgBnB,QAAQ,EAChDa,kBAAkB,OAAOM,gBAAgBjC,SAAS,EAClDyB,MAAMjD,YAAY,CAAC0D,SAAS;IAEhC;IAEA,OAAOT;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/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":["
|
|
1
|
+
{"version":3,"sources":["../src/contexts/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":";;;;;;;;;;;IAOaG,iBAAAA;;;sBAQAS;;;sCAKAE;;;;;iEApBU,QAAQ;4BAES,wBAAwB;AAKzD,0BAAMX,WAAAA,GAAoBH,OAAMI,aAAa,CAAqCC,WAAW;AACpG,MAAMC,gCAAwD;IAC5DC,OAAO;IACPC,YAAYP,sBAAAA;IACZQ,aAAaP,uBAAAA;IACbQ,MAAM;IACNC,MAAM;AACR;AACO,MAAMC,qBAAqBT,kBAAkBU,QAAQ,CAAC;AAKtD,MAAMC,qCAAqC,IAChDd,OAAMe,UAAU,CAACZ,sBAAsBG,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export { RatingItemContext, RatingItemProvider, useRatingItemContextValue_unstable } from './RatingItemContext';\n"],"names":["RatingItemContext","RatingItemProvider","useRatingItemContextValue_unstable"],"
|
|
1
|
+
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export { RatingItemContext, RatingItemProvider, useRatingItemContextValue_unstable } from './RatingItemContext';\n"],"names":["RatingItemContext","RatingItemProvider","useRatingItemContextValue_unstable"],"mappings":";;;;;;;;;;;;eAASA,oCAAiB;;;eAAEC,qCAAkB;;;eAAEC,qDAAkC;;;mCAAQ,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/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","
|
|
1
|
+
{"version":3,"sources":["../src/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":";;;;;;;;;;;IACEA,MAAM;;;;eAkBNa,4BAAa;;;eATbP,sBAAU;;IAOHK,kBAAkB;;;;eAfzBV,wBAAgB;;IAkBhBa,uBAAuB;;;;eATvBP,gCAAoB;;;eAUpBQ,2CAA4B;;;eAT5BP,qCAAyB;;;eATzBN,6BAAqB;;;eAGrBG,8BAAsB;;;eAkBtBa,4CAA6B;;;eAF7BF,8CAA+B;;;eAC/BC,wCAAyB;;;eANEL,yCAAkC;;;eAJ7DH,wCAA4B;;;eAC5BC,kCAAsB;;;eAVtBP,gCAAwB;;sBACN;eAAlBC;;;wBAEK,WAAW;4BAQX,eAAe;uBAEiD,mBAAmB;+BAQnF,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-rating",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.1",
|
|
4
4
|
"description": "Rating component for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"@fluentui/scripts-api-extractor": "*"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@fluentui/react-jsx-runtime": "^9.1.
|
|
21
|
+
"@fluentui/react-jsx-runtime": "^9.1.3",
|
|
22
22
|
"@fluentui/react-icons": "^2.0.245",
|
|
23
23
|
"@fluentui/react-shared-contexts": "^9.24.0",
|
|
24
24
|
"@fluentui/react-theme": "^9.1.24",
|
|
25
|
-
"@fluentui/react-tabster": "^9.26.
|
|
26
|
-
"@fluentui/react-utilities": "^9.
|
|
25
|
+
"@fluentui/react-tabster": "^9.26.1",
|
|
26
|
+
"@fluentui/react-utilities": "^9.23.0",
|
|
27
27
|
"@griffel/react": "^1.5.22",
|
|
28
28
|
"@swc/helpers": "^0.5.1"
|
|
29
29
|
},
|