@fluentui/react-rating 9.4.2 → 9.4.4
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 +28 -2
- package/dist/index.d.cts +350 -0
- package/lib/Rating.js +1 -1
- package/lib/Rating.js.map +1 -1
- package/lib/RatingDisplay.js +1 -1
- package/lib/RatingDisplay.js.map +1 -1
- package/lib/RatingItem.js +1 -1
- package/lib/RatingItem.js.map +1 -1
- package/lib/components/Rating/Rating.js +6 -6
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/Rating/index.js +5 -5
- package/lib/components/Rating/index.js.map +1 -1
- package/lib/components/Rating/renderRating.js +2 -2
- package/lib/components/Rating/renderRating.js.map +1 -1
- package/lib/components/Rating/useRating.js +4 -4
- package/lib/components/Rating/useRating.js.map +1 -1
- package/lib/components/Rating/useRatingContextValues.js +1 -1
- package/lib/components/Rating/useRatingStyles.styles.js +1 -3
- package/lib/components/Rating/useRatingStyles.styles.js.map +1 -1
- package/lib/components/Rating/useRatingStyles.styles.raw.js +1 -2
- package/lib/components/Rating/useRatingStyles.styles.raw.js.map +1 -1
- package/lib/components/RatingDisplay/RatingDisplay.js +6 -6
- package/lib/components/RatingDisplay/RatingDisplay.js.map +1 -1
- package/lib/components/RatingDisplay/index.js +5 -5
- package/lib/components/RatingDisplay/index.js.map +1 -1
- package/lib/components/RatingDisplay/renderRatingDisplay.js +2 -2
- package/lib/components/RatingDisplay/renderRatingDisplay.js.map +1 -1
- package/lib/components/RatingDisplay/useRatingDisplay.js +4 -4
- package/lib/components/RatingDisplay/useRatingDisplay.js.map +1 -1
- package/lib/components/RatingDisplay/useRatingDisplayContextValues.js +1 -1
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.js +2 -4
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +1 -1
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.raw.js +2 -3
- package/lib/components/RatingDisplay/useRatingDisplayStyles.styles.raw.js.map +1 -1
- package/lib/components/RatingItem/RatingItem.js +5 -5
- package/lib/components/RatingItem/RatingItem.js.map +1 -1
- package/lib/components/RatingItem/index.js +4 -4
- package/lib/components/RatingItem/index.js.map +1 -1
- package/lib/components/RatingItem/renderRatingItem.js +1 -1
- package/lib/components/RatingItem/useRatingItem.js +4 -4
- package/lib/components/RatingItem/useRatingItem.js.map +1 -1
- package/lib/components/RatingItem/useRatingItemStyles.styles.js +3 -5
- package/lib/components/RatingItem/useRatingItemStyles.styles.js.map +1 -1
- package/lib/components/RatingItem/useRatingItemStyles.styles.raw.js +3 -4
- package/lib/components/RatingItem/useRatingItemStyles.styles.raw.js.map +1 -1
- package/lib/contexts/RatingItemContext.js +1 -1
- package/lib/contexts/index.js +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib-commonjs/{Rating.js → Rating.cjs} +1 -1
- package/lib-commonjs/{Rating.js.map → Rating.cjs.map} +1 -1
- package/lib-commonjs/{RatingDisplay.js → RatingDisplay.cjs} +1 -1
- package/lib-commonjs/{RatingDisplay.js.map → RatingDisplay.cjs.map} +1 -1
- package/lib-commonjs/{RatingItem.js → RatingItem.cjs} +1 -1
- package/lib-commonjs/{RatingItem.js.map → RatingItem.cjs.map} +1 -1
- package/lib-commonjs/components/Rating/{Rating.js → Rating.cjs} +4 -4
- package/lib-commonjs/components/Rating/{Rating.js.map → Rating.cjs.map} +1 -1
- package/lib-commonjs/components/Rating/{index.js → index.cjs} +5 -5
- package/lib-commonjs/components/Rating/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Rating/{renderRating.js → renderRating.cjs} +1 -1
- package/lib-commonjs/components/Rating/{renderRating.js.map → renderRating.cjs.map} +1 -1
- package/lib-commonjs/components/Rating/{useRating.js → useRating.cjs} +1 -1
- package/lib-commonjs/components/Rating/{useRating.js.map → useRating.cjs.map} +1 -1
- package/lib-commonjs/components/Rating/{useRatingStyles.styles.js → useRatingStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/Rating/useRatingStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Rating/{useRatingStyles.styles.raw.js → useRatingStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/Rating/useRatingStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/RatingDisplay/{RatingDisplay.js → RatingDisplay.cjs} +4 -4
- package/lib-commonjs/components/RatingDisplay/{RatingDisplay.js.map → RatingDisplay.cjs.map} +1 -1
- package/lib-commonjs/components/RatingDisplay/{index.js → index.cjs} +5 -5
- package/lib-commonjs/components/RatingDisplay/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/RatingDisplay/{renderRatingDisplay.js → renderRatingDisplay.cjs} +1 -1
- package/lib-commonjs/components/RatingDisplay/{renderRatingDisplay.js.map → renderRatingDisplay.cjs.map} +1 -1
- package/lib-commonjs/components/RatingDisplay/{useRatingDisplay.js → useRatingDisplay.cjs} +1 -1
- package/lib-commonjs/components/RatingDisplay/{useRatingDisplay.js.map → useRatingDisplay.cjs.map} +1 -1
- package/lib-commonjs/components/RatingDisplay/{useRatingDisplayStyles.styles.js → useRatingDisplayStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/RatingDisplay/{useRatingDisplayStyles.styles.raw.js → useRatingDisplayStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/RatingItem/{RatingItem.js → RatingItem.cjs} +3 -3
- package/lib-commonjs/components/RatingItem/{RatingItem.js.map → RatingItem.cjs.map} +1 -1
- package/lib-commonjs/components/RatingItem/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/RatingItem/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/RatingItem/{useRatingItem.js → useRatingItem.cjs} +1 -1
- package/lib-commonjs/components/RatingItem/{useRatingItem.js.map → useRatingItem.cjs.map} +1 -1
- package/lib-commonjs/components/RatingItem/{useRatingItemStyles.styles.js → useRatingItemStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/RatingItem/{useRatingItemStyles.styles.raw.js → useRatingItemStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/contexts/{index.js → index.cjs} +1 -1
- package/lib-commonjs/contexts/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/{index.js → index.cjs} +4 -4
- package/lib-commonjs/{index.js.map → index.cjs.map} +1 -1
- package/package.json +18 -12
- package/lib-commonjs/components/Rating/useRatingStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Rating/useRatingStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.js.map +0 -1
- package/lib-commonjs/components/RatingDisplay/useRatingDisplayStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.js.map +0 -1
- package/lib-commonjs/components/RatingItem/useRatingItemStyles.styles.raw.js.map +0 -1
- /package/lib-commonjs/components/Rating/{Rating.types.js → Rating.types.cjs} +0 -0
- /package/lib-commonjs/components/Rating/{Rating.types.js.map → Rating.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Rating/{useRatingContextValues.js → useRatingContextValues.cjs} +0 -0
- /package/lib-commonjs/components/Rating/{useRatingContextValues.js.map → useRatingContextValues.cjs.map} +0 -0
- /package/lib-commonjs/components/RatingDisplay/{RatingDisplay.types.js → RatingDisplay.types.cjs} +0 -0
- /package/lib-commonjs/components/RatingDisplay/{RatingDisplay.types.js.map → RatingDisplay.types.cjs.map} +0 -0
- /package/lib-commonjs/components/RatingDisplay/{useRatingDisplayContextValues.js → useRatingDisplayContextValues.cjs} +0 -0
- /package/lib-commonjs/components/RatingDisplay/{useRatingDisplayContextValues.js.map → useRatingDisplayContextValues.cjs.map} +0 -0
- /package/lib-commonjs/components/RatingItem/{RatingItem.types.js → RatingItem.types.cjs} +0 -0
- /package/lib-commonjs/components/RatingItem/{RatingItem.types.js.map → RatingItem.types.cjs.map} +0 -0
- /package/lib-commonjs/components/RatingItem/{renderRatingItem.js → renderRatingItem.cjs} +0 -0
- /package/lib-commonjs/components/RatingItem/{renderRatingItem.js.map → renderRatingItem.cjs.map} +0 -0
- /package/lib-commonjs/contexts/{RatingItemContext.js → RatingItemContext.cjs} +0 -0
- /package/lib-commonjs/contexts/{RatingItemContext.js.map → RatingItemContext.cjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/Rating.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;2BAEI,
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/Rating.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;2BAEI,iBAAc;8BACX,oBAAiB;uCACd,8BAA2B;wCAE7B,8BAA2B;qCACtB,kCAAkC;AAKvE,MAAMM,SAAAA,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"}
|
|
@@ -31,8 +31,8 @@ _export(exports, {
|
|
|
31
31
|
return _useRating.useRating_unstable;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
const _Rating = require("./Rating");
|
|
35
|
-
const _renderRating = require("./renderRating");
|
|
36
|
-
const _useRating = require("./useRating");
|
|
37
|
-
const _useRatingStylesstyles = require("./useRatingStyles.styles");
|
|
38
|
-
const _useRatingContextValues = require("./useRatingContextValues");
|
|
34
|
+
const _Rating = require("./Rating.cjs");
|
|
35
|
+
const _renderRating = require("./renderRating.cjs");
|
|
36
|
+
const _useRating = require("./useRating.cjs");
|
|
37
|
+
const _useRatingStylesstyles = require("./useRatingStyles.styles.cjs");
|
|
38
|
+
const _useRatingContextValues = require("./useRatingContextValues.cjs");
|
|
@@ -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 RatingBaseProps,\n RatingSlots,\n RatingState,\n RatingBaseState,\n} from './Rating.types';\nexport { renderRating_unstable } from './renderRating';\nexport { useRating_unstable, useRatingBase_unstable } from './useRating';\nexport { ratingClassNames, useRatingStyles_unstable } from './useRatingStyles.styles';\nexport { useRatingContextValues } from './useRatingContextValues';\n"],"names":["Rating","renderRating_unstable","useRating_unstable","useRatingBase_unstable","ratingClassNames","useRatingStyles_unstable","useRatingContextValues"],"mappings":";;;;;;;;;;;IAASA;6BAAM;;IAYNI;sDAAgB;;;eAFhBH,mCAAqB;;;eACDE,iCAAsB;;;eAE1CG,8CAAsB;;;eADJD,+CAAwB;;;eAD1CH,6BAAkB;;;wBAXJ,
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/index.ts"],"sourcesContent":["export { Rating } from './Rating';\nexport type {\n RatingContextValues,\n RatingOnChangeEventData,\n RatingProps,\n RatingBaseProps,\n RatingSlots,\n RatingState,\n RatingBaseState,\n} from './Rating.types';\nexport { renderRating_unstable } from './renderRating';\nexport { useRating_unstable, useRatingBase_unstable } from './useRating';\nexport { ratingClassNames, useRatingStyles_unstable } from './useRatingStyles.styles';\nexport { useRatingContextValues } from './useRatingContextValues';\n"],"names":["Rating","renderRating_unstable","useRating_unstable","useRatingBase_unstable","ratingClassNames","useRatingStyles_unstable","useRatingContextValues"],"mappings":";;;;;;;;;;;IAASA;6BAAM;;IAYNI;sDAAgB;;;eAFhBH,mCAAqB;;;eACDE,iCAAsB;;;eAE1CG,8CAAsB;;;eADJD,+CAAwB;;;eAD1CH,6BAAkB;;;wBAXJ,cAAW;8BAUI,oBAAiB;2BACI,iBAAc;uCACd,8BAA2B;wCAC/C,8BAA2B"}
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "renderRating_unstable", {
|
|
|
10
10
|
});
|
|
11
11
|
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
12
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
13
|
-
const _RatingItemContext = require("../../contexts/RatingItemContext");
|
|
13
|
+
const _RatingItemContext = require("../../contexts/RatingItemContext.cjs");
|
|
14
14
|
const renderRating_unstable = (state, contextValues)=>{
|
|
15
15
|
(0, _reactutilities.assertSlots)(state);
|
|
16
16
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RatingItemContext.RatingItemProvider, {
|
|
@@ -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 { JSXElement } from '@fluentui/react-utilities';\nimport type { RatingBaseState, 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: RatingBaseState, contextValues: RatingContextValues): JSXElement => {\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":";;;;+BAWaE;;;;;;4BAVb,gDAAiD;gCAErB,4BAA4B;mCAGrB,
|
|
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 { JSXElement } from '@fluentui/react-utilities';\nimport type { RatingBaseState, 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: RatingBaseState, contextValues: RatingContextValues): JSXElement => {\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":";;;;+BAWaE;;;;;;4BAVb,gDAAiD;gCAErB,4BAA4B;mCAGrB,sCAAmC;AAK/D,8BAA8B,CAACC,OAAwBC;QAC5DJ,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"}
|
|
@@ -20,7 +20,7 @@ _export(exports, {
|
|
|
20
20
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
22
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
23
|
-
const _RatingItem = require("../../RatingItem");
|
|
23
|
+
const _RatingItem = require("../../RatingItem.cjs");
|
|
24
24
|
const _reacticons = require("@fluentui/react-icons");
|
|
25
25
|
const useRating_unstable = (props, ref)=>{
|
|
26
26
|
var _state_root;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Rating/useRating.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isHTMLElement,\n mergeCallbacks,\n slot,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport type { RatingBaseProps, RatingBaseState, 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 {\n color = 'neutral',\n size = 'extra-large',\n iconFilled = StarFilled,\n iconOutline = StarRegular,\n max = 5,\n ...baseProps\n } = props;\n const state = useRatingBase_unstable({ iconFilled, iconOutline, ...baseProps }, ref);\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 state.root.children ??= rootChildren;\n\n return {\n ...state,\n color,\n size,\n };\n};\n\n/**\n * Base hook for Rating component. Manages state related to controlled/uncontrolled\n * rating value, hover state, radiogroup ARIA role, and keyboard/mouse interaction —\n * without design props (color, size).\n *\n * @param props - props from this instance of Rating (without color, size)\n * @param ref - reference to root HTMLElement of Rating\n */\nexport const useRatingBase_unstable = (props: RatingBaseProps, ref: React.Ref<HTMLDivElement>): RatingBaseState => {\n const generatedName = useId('rating-');\n const { iconFilled = 'span', iconOutline = 'span', name = generatedName, onChange, step = 1, itemLabel } = 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 const state: RatingBaseState = {\n iconFilled,\n iconOutline,\n name,\n step,\n itemLabel,\n value,\n hoveredValue,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n ref,\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","state","color","size","iconFilled","iconOutline","max","baseProps","useRatingBase_unstable","rootChildren","useMemo","Array","from","_","i","value","key","root","children","generatedName","name","onChange","step","itemLabel","setValue","defaultState","defaultValue","initialState","isRatingRadioItem","target","constructorName","type","hoveredValue","setHoveredValue","useState","undefined","components","always","role","elementType","ev","newValue","parseFloat","isNaN","event","onMouseOver","onMouseLeave"],"mappings":"AAAA;;;;;;;;;;;;0BAyDaoB;eAAAA;;IAjCAV,kBAAAA;;;;;iEAtBU,QAAQ;gCAQxB,4BAA4B;4BAER,
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRating.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isHTMLElement,\n mergeCallbacks,\n slot,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport type { RatingBaseProps, RatingBaseState, 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 {\n color = 'neutral',\n size = 'extra-large',\n iconFilled = StarFilled,\n iconOutline = StarRegular,\n max = 5,\n ...baseProps\n } = props;\n const state = useRatingBase_unstable({ iconFilled, iconOutline, ...baseProps }, ref);\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 state.root.children ??= rootChildren;\n\n return {\n ...state,\n color,\n size,\n };\n};\n\n/**\n * Base hook for Rating component. Manages state related to controlled/uncontrolled\n * rating value, hover state, radiogroup ARIA role, and keyboard/mouse interaction —\n * without design props (color, size).\n *\n * @param props - props from this instance of Rating (without color, size)\n * @param ref - reference to root HTMLElement of Rating\n */\nexport const useRatingBase_unstable = (props: RatingBaseProps, ref: React.Ref<HTMLDivElement>): RatingBaseState => {\n const generatedName = useId('rating-');\n const { iconFilled = 'span', iconOutline = 'span', name = generatedName, onChange, step = 1, itemLabel } = 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 const state: RatingBaseState = {\n iconFilled,\n iconOutline,\n name,\n step,\n itemLabel,\n value,\n hoveredValue,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n ref,\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","state","color","size","iconFilled","iconOutline","max","baseProps","useRatingBase_unstable","rootChildren","useMemo","Array","from","_","i","value","key","root","children","generatedName","name","onChange","step","itemLabel","setValue","defaultState","defaultValue","initialState","isRatingRadioItem","target","constructorName","type","hoveredValue","setHoveredValue","useState","undefined","components","always","role","elementType","ev","newValue","parseFloat","isNaN","event","onMouseOver","onMouseLeave"],"mappings":"AAAA;;;;;;;;;;;;0BAyDaoB;eAAAA;;IAjCAV,kBAAAA;;;;;iEAtBU,QAAQ;gCAQxB,4BAA4B;4BAER,sBAAmB;4BACN,wBAAwB;AAWzD,2BAA2B,CAACC,OAAoBC;QAgBrDC;IAfA,MAAM,EACJC,QAAQ,SAAS,EACjBC,OAAO,aAAa,EACpBC,aAAaR,sBAAU,EACvBS,cAAcR,uBAAW,EACzBS,MAAM,CAAC,EACP,GAAGC,WACJ,GAAGR;IACJ,MAAME,QAAQO,uBAAuB;QAAEJ;QAAYC;QAAa,GAAGE,SAAS;IAAC,GAAGP;IAEhF,sFAAsF;IACtF,MAAMS,eAAerB,OAAMsB,OAAO,CAAC;QACjC,OAAOC,MAAMC,IAAI,CAACD,MAAML,MAAM,CAACO,GAAGC,IAAAA,WAAAA,GAAM,OAAA,aAAA,CAACnB,sBAAAA,EAAAA;gBAAWoB,OAAOD,IAAI;gBAAGE,KAAKF,IAAI;;IAC7E,GAAG;QAACR;KAAI;;IAERL,CAA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KAAAA,IAAAA,SAAWmB,IAAI;oBAAET,MAAM;oBAAUa,OAAOJ;oBAAIzB,OAAO0B;gBAAS;YAC9D;QACF;IACF;IACAxC,MAAMgB,IAAI,CAAC4B,WAAW,OAAGtD,8BAAAA,EAAeQ,MAAM8C,WAAW,EAAEL,CAAAA;QACzD,IAAIZ,kBAAkBY,GAAGX,MAAM,GAAG;YAChC,MAAMY,WAAWC,WAAWF,GAAGX,MAAM,CAACd,KAAK;YAC3C,IAAI,CAAC4B,MAAMF,WAAW;gBACpBR,gBAAgBQ;YAClB;QACF;IACF;IACAxC,MAAMgB,IAAI,CAAC6B,YAAY,OAAGvD,8BAAAA,EAAeQ,MAAM+C,YAAY,EAAEN,CAAAA;QAC3DP,gBAAgBE;IAClB;IAEA,OAAOlC;AACT,EAAE"}
|
package/lib-commonjs/components/Rating/{useRatingStyles.styles.js → useRatingStyles.styles.cjs}
RENAMED
|
@@ -27,7 +27,6 @@ const ratingClassNames = {
|
|
|
27
27
|
".r2imjyh{display:flex;flex-wrap:wrap;}"
|
|
28
28
|
]);
|
|
29
29
|
const useRatingStyles_unstable = (state)=>{
|
|
30
|
-
'use no memo';
|
|
31
30
|
const rootClassName = useRootClassName();
|
|
32
31
|
// eslint-disable-next-line react-hooks/immutability
|
|
33
32
|
state.root.className = (0, _react.mergeClasses)(ratingClassNames.root, rootClassName, state.root.className);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useRatingStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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 const rootClassName = useRootClassName();\n // eslint-disable-next-line react-hooks/immutability\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":"AAAA,YAAY;;;;;;;;;;;;oBAEiB;;;4BAWY;;;;uBAZK,gBAAgB;AACvD,MAAME,mBAAmB;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,MAAMC,aAAa,GAAGH,gBAAgB,CAAC,CAAC;IACxC,oDAAA;IACAE,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"}
|
|
@@ -28,7 +28,6 @@ const ratingClassNames = {
|
|
|
28
28
|
flexWrap: 'wrap'
|
|
29
29
|
});
|
|
30
30
|
const useRatingStyles_unstable = (state)=>{
|
|
31
|
-
'use no memo';
|
|
32
31
|
const rootClassName = useRootClassName();
|
|
33
32
|
// eslint-disable-next-line react-hooks/immutability
|
|
34
33
|
state.root.className = (0, _react.mergeClasses)(ratingClassNames.root, rootClassName, state.root.className);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Rating/useRatingStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { 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 const rootClassName = useRootClassName();\n // eslint-disable-next-line react-hooks/immutability\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;;;;;;;;;;;;oBAMaE;;;IAgBAK,wBAAAA;;;;uBApBiC,iBAAiB;AAIxD,MAAML,mBAAgD;IAC3DC,MAAM;AACR,EAAE;AAEF;;CAEC,GAED,MAAMC,uBAAmBJ,sBAAAA,EAAgB;IACvCK,SAAS;IACTC,UAAU;AACZ;AAKO,iCAAiC,CAACE;IACvC,MAAMC,gBAAgBL;IACtB,oDAAoD;IACpDI,MAAML,IAAI,CAACO,SAAS,OAAGT,mBAAAA,EAAaC,iBAAiBC,IAAI,EAAEM,eAAeD,MAAML,IAAI,CAACO,SAAS;IAC9F,OAAOF;AACT,EAAE"}
|
|
@@ -11,10 +11,10 @@ Object.defineProperty(exports, "RatingDisplay", {
|
|
|
11
11
|
});
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
-
const _useRatingDisplay = require("./useRatingDisplay");
|
|
15
|
-
const _renderRatingDisplay = require("./renderRatingDisplay");
|
|
16
|
-
const _useRatingDisplayStylesstyles = require("./useRatingDisplayStyles.styles");
|
|
17
|
-
const _useRatingDisplayContextValues = require("./useRatingDisplayContextValues");
|
|
14
|
+
const _useRatingDisplay = require("./useRatingDisplay.cjs");
|
|
15
|
+
const _renderRatingDisplay = require("./renderRatingDisplay.cjs");
|
|
16
|
+
const _useRatingDisplayStylesstyles = require("./useRatingDisplayStyles.styles.cjs");
|
|
17
|
+
const _useRatingDisplayContextValues = require("./useRatingDisplayContextValues.cjs");
|
|
18
18
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
19
19
|
const RatingDisplay = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
20
20
|
const state = (0, _useRatingDisplay.useRatingDisplay_unstable)(props, ref);
|
package/lib-commonjs/components/RatingDisplay/{RatingDisplay.js.map → RatingDisplay.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;kCAEW,
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/RatingDisplay.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;kCAEW,wBAAqB;qCAClB,2BAAwB;8CACrB,qCAAkC;+CAEpC,qCAAkC;qCACpC,kCAAkC;AAMvE,MAAMM,gBAAAA,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"}
|
|
@@ -31,8 +31,8 @@ _export(exports, {
|
|
|
31
31
|
return _useRatingDisplay.useRatingDisplay_unstable;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
const _RatingDisplay = require("./RatingDisplay");
|
|
35
|
-
const _renderRatingDisplay = require("./renderRatingDisplay");
|
|
36
|
-
const _useRatingDisplay = require("./useRatingDisplay");
|
|
37
|
-
const _useRatingDisplayStylesstyles = require("./useRatingDisplayStyles.styles");
|
|
38
|
-
const _useRatingDisplayContextValues = require("./useRatingDisplayContextValues");
|
|
34
|
+
const _RatingDisplay = require("./RatingDisplay.cjs");
|
|
35
|
+
const _renderRatingDisplay = require("./renderRatingDisplay.cjs");
|
|
36
|
+
const _useRatingDisplay = require("./useRatingDisplay.cjs");
|
|
37
|
+
const _useRatingDisplayStylesstyles = require("./useRatingDisplayStyles.styles.cjs");
|
|
38
|
+
const _useRatingDisplayContextValues = require("./useRatingDisplayContextValues.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/index.ts"],"sourcesContent":["export { RatingDisplay } from './RatingDisplay';\nexport type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplayBaseProps,\n RatingDisplaySlots,\n RatingDisplayState,\n RatingDisplayBaseState,\n} from './RatingDisplay.types';\nexport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nexport { useRatingDisplay_unstable, useRatingDisplayBase_unstable } from './useRatingDisplay';\nexport { ratingDisplayClassNames, useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nexport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n"],"names":["RatingDisplay","renderRatingDisplay_unstable","useRatingDisplay_unstable","useRatingDisplayBase_unstable","ratingDisplayClassNames","useRatingDisplayStyles_unstable","useRatingDisplayContextValues"],"mappings":";;;;;;;;;;;IAASA;2CAAa;;IAWbI;oEAAuB;;;eAFvBH,iDAA4B;;;eACDE,+CAA6B;;;eAExDG,4DAA6B;;;eADJD,6DAA+B;;;eADxDH,2CAAyB;;;+BAVJ,
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/index.ts"],"sourcesContent":["export { RatingDisplay } from './RatingDisplay';\nexport type {\n RatingDisplayContextValues,\n RatingDisplayProps,\n RatingDisplayBaseProps,\n RatingDisplaySlots,\n RatingDisplayState,\n RatingDisplayBaseState,\n} from './RatingDisplay.types';\nexport { renderRatingDisplay_unstable } from './renderRatingDisplay';\nexport { useRatingDisplay_unstable, useRatingDisplayBase_unstable } from './useRatingDisplay';\nexport { ratingDisplayClassNames, useRatingDisplayStyles_unstable } from './useRatingDisplayStyles.styles';\nexport { useRatingDisplayContextValues } from './useRatingDisplayContextValues';\n"],"names":["RatingDisplay","renderRatingDisplay_unstable","useRatingDisplay_unstable","useRatingDisplayBase_unstable","ratingDisplayClassNames","useRatingDisplayStyles_unstable","useRatingDisplayContextValues"],"mappings":";;;;;;;;;;;IAASA;2CAAa;;IAWbI;oEAAuB;;;eAFvBH,iDAA4B;;;eACDE,+CAA6B;;;eAExDG,4DAA6B;;;eADJD,6DAA+B;;;eADxDH,2CAAyB;;;+BAVJ,qBAAkB;qCASH,2BAAwB;kCACI,wBAAqB;8CACrB,qCAAkC;+CAC7D,qCAAkC"}
|
package/lib-commonjs/components/RatingDisplay/{renderRatingDisplay.js → renderRatingDisplay.cjs}
RENAMED
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "renderRatingDisplay_unstable", {
|
|
|
10
10
|
});
|
|
11
11
|
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
12
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
13
|
-
const _RatingItemContext = require("../../contexts/RatingItemContext");
|
|
13
|
+
const _RatingItemContext = require("../../contexts/RatingItemContext.cjs");
|
|
14
14
|
const renderRatingDisplay_unstable = (state, contextValues)=>{
|
|
15
15
|
(0, _reactutilities.assertSlots)(state);
|
|
16
16
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RatingItemContext.RatingItemProvider, {
|
|
@@ -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 { JSXElement } from '@fluentui/react-utilities';\nimport type { RatingDisplayBaseState, RatingDisplaySlots, RatingDisplayContextValues } from './RatingDisplay.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of RatingDisplay\n */\nexport const renderRatingDisplay_unstable = (\n state: RatingDisplayBaseState,\n contextValues: RatingDisplayContextValues,\n): JSXElement => {\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":";;;;+BAWaE;;;;;;4BAVb,iCAAiD;gCAErB,4BAA4B;mCAGrB,
|
|
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 { JSXElement } from '@fluentui/react-utilities';\nimport type { RatingDisplayBaseState, RatingDisplaySlots, RatingDisplayContextValues } from './RatingDisplay.types';\nimport { RatingItemProvider } from '../../contexts/RatingItemContext';\n\n/**\n * Render the final JSX of RatingDisplay\n */\nexport const renderRatingDisplay_unstable = (\n state: RatingDisplayBaseState,\n contextValues: RatingDisplayContextValues,\n): JSXElement => {\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":";;;;+BAWaE;;;;;;4BAVb,iCAAiD;gCAErB,4BAA4B;mCAGrB,sCAAmC;AAK/D,qCAAqC,CAC1CC,OACAC;QAEAJ,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"}
|
|
@@ -21,7 +21,7 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
21
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
22
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
23
23
|
const _reacticons = require("@fluentui/react-icons");
|
|
24
|
-
const _RatingItem = require("../RatingItem/RatingItem");
|
|
24
|
+
const _RatingItem = require("../RatingItem/RatingItem.cjs");
|
|
25
25
|
const useRatingDisplay_unstable = (props, ref)=>{
|
|
26
26
|
const { color = 'neutral', size = 'medium', icon = _reacticons.StarFilled, ...baseProps } = props;
|
|
27
27
|
const state = useRatingDisplayBase_unstable({
|
package/lib-commonjs/components/RatingDisplay/{useRatingDisplay.js.map → useRatingDisplay.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplay.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId } from '@fluentui/react-utilities';\nimport type {\n RatingDisplayBaseProps,\n RatingDisplayBaseState,\n RatingDisplayProps,\n RatingDisplayState,\n} 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', size = 'medium', icon = StarFilled, ...baseProps } = props;\n const state = useRatingDisplayBase_unstable({ icon, ...baseProps }, ref);\n\n const { compact, max } = state;\n\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 return {\n ...state,\n root: {\n children: rootChildren,\n ...state.root,\n },\n icon,\n color,\n size,\n };\n};\n\n/**\n * Base hook for RatingDisplay component. Manages state related to ARIA img role,\n * aria-labelledby composition from valueText/countText IDs, slot structure, and\n * compact/full display modes — without design props (color, size).\n *\n * @param props - props from this instance of RatingDisplay (without color, size)\n * @param ref - reference to root HTMLDivElement of RatingDisplay\n */\nexport const useRatingDisplayBase_unstable = (\n props: RatingDisplayBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): RatingDisplayBaseState => {\n const { count, compact = false, icon, max = 5, value } = props;\n\n const valueTextId = useId('rating-value-');\n const countTextId = useId('rating-count-');\n\n const state: RatingDisplayBaseState = {\n compact,\n icon,\n max,\n value,\n components: {\n root: 'div',\n valueText: 'span',\n countText: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\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","size","icon","baseProps","state","useRatingDisplayBase_unstable","compact","max","rootChildren","useMemo","value","key","aria-hidden","Array","from","_","i","root","children","count","valueTextId","countTextId","components","valueText","countText","always","role","elementType","optional","renderByDefault","undefined","defaultProps","id","toLocaleString","filter","Boolean","join"],"mappings":"AAAA;;;;;;;;;;;;iCA2Dac;eAAAA;;IArCAR,yBAAAA;;;;;iEApBU,QAAQ;gCACuB,4BAA4B;4BAOvD,wBAAwB;4BACxB,
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplay.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, slot, useId } from '@fluentui/react-utilities';\nimport type {\n RatingDisplayBaseProps,\n RatingDisplayBaseState,\n RatingDisplayProps,\n RatingDisplayState,\n} 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', size = 'medium', icon = StarFilled, ...baseProps } = props;\n const state = useRatingDisplayBase_unstable({ icon, ...baseProps }, ref);\n\n const { compact, max } = state;\n\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 return {\n ...state,\n root: {\n children: rootChildren,\n ...state.root,\n },\n icon,\n color,\n size,\n };\n};\n\n/**\n * Base hook for RatingDisplay component. Manages state related to ARIA img role,\n * aria-labelledby composition from valueText/countText IDs, slot structure, and\n * compact/full display modes — without design props (color, size).\n *\n * @param props - props from this instance of RatingDisplay (without color, size)\n * @param ref - reference to root HTMLDivElement of RatingDisplay\n */\nexport const useRatingDisplayBase_unstable = (\n props: RatingDisplayBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): RatingDisplayBaseState => {\n const { count, compact = false, icon, max = 5, value } = props;\n\n const valueTextId = useId('rating-value-');\n const countTextId = useId('rating-count-');\n\n const state: RatingDisplayBaseState = {\n compact,\n icon,\n max,\n value,\n components: {\n root: 'div',\n valueText: 'span',\n countText: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\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","size","icon","baseProps","state","useRatingDisplayBase_unstable","compact","max","rootChildren","useMemo","value","key","aria-hidden","Array","from","_","i","root","children","count","valueTextId","countTextId","components","valueText","countText","always","role","elementType","optional","renderByDefault","undefined","defaultProps","id","toLocaleString","filter","Boolean","join"],"mappings":"AAAA;;;;;;;;;;;;iCA2Dac;eAAAA;;IArCAR,yBAAAA;;;;;iEApBU,QAAQ;gCACuB,4BAA4B;4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AA,CAAKmC,QAAQ,CAAC9B,MAAMyB,SAAS,EAAE;YACxCM,iBAAiBnB,UAAUoB;YAC3BC,cAAc;gBAAEb,UAAUR;gBAAOsB,IAAIZ;gBAAa,eAAe;YAAK;YACtEO,aAAa;QACf;QACAH,WAAW/B,oBAAAA,CAAKmC,QAAQ,CAAC9B,MAAM0B,SAAS,EAAE;YACxCK,iBAAiBV,UAAUW;YAC3BC,cAAc;gBAAEb,QAAQ,EAAEC,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOc,cAAc;gBAAID,IAAIX;gBAAa,eAAe;YAAK;YACxFM,aAAa;QACf;IACF;IACA,IAAI,CAACvB,MAAMa,IAAI,CAAC,aAAa,IAAI,CAACb,MAAMa,IAAI,CAAC,kBAAkB,EAAE;YAC9Bb,kBAAqBA;QAAtDA,MAAMa,IAAI,CAAC,kBAAkB,GAAG;aAACb,mBAAAA,MAAMmB,SAAAA,AAAS,MAAA,QAAfnB,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAiB4B,EAAE;aAAE5B,mBAAAA,MAAMoB,SAAAA,AAAS,MAAA,QAAfpB,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAiB4B,EAAE;SAAC,CAACE,MAAM,CAACC,SAASC,IAAI,CAAC;IAClG;IACA,OAAOhC;AACT,EAAE"}
|
|
@@ -70,7 +70,6 @@ const useLabelStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
70
70
|
]
|
|
71
71
|
});
|
|
72
72
|
const useRatingDisplayStyles_unstable = (state)=>{
|
|
73
|
-
'use no memo';
|
|
74
73
|
const { size } = state;
|
|
75
74
|
const rootClassName = useRootClassName();
|
|
76
75
|
// eslint-disable-next-line react-hooks/immutability
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useRatingDisplayStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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 const { size } = state;\n const rootClassName = useRootClassName();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(ratingDisplayClassNames.root, rootClassName, state.root.className);\n const labelClassName = useLabelClassName();\n const labelStyles = useLabelStyles();\n if (state.valueText) {\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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":"AAAA,YAAY;;;;;;;;;;;;IAGCK,uBAAuB;;;mCAuCY;eAA/BiB;;;uBAzCyC,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,OAAGV,oBAAA,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,yCAAyCE,KAAK,IAAG;IACxD,MAAM,EAAEC,IAAAA,EAAM,GAAGD,KAAK;IACtB,MAAME,aAAa,GAAGhB,gBAAgB,CAAC,CAAC;IACxC,oDAAA;IACAc,KAAK,CAACjB,IAAI,CAACoB,SAAS,OAAGxB,mBAAY,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;QACjB,oDAAA;QACAgB,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;QACjB,oDAAA;QACAe,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingDisplay/useRatingDisplayStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { 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 const { size } = state;\n const rootClassName = useRootClassName();\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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":"AAAA;;;;;;;;;;;;IAOaK,uBAAAA;;;mCA8CA8B;;;;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,wBAAoBb,sBAAAA,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,MAAMC,kCAAkC,CAACC;IAC9C,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,MAAME,gBAAgB7B;IACtB,oDAAoD;IACpD2B,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;QACnB,oDAAoD;QACpD6B,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;QACnB,oDAAoD;QACpD4B,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"}
|
|
@@ -11,9 +11,9 @@ Object.defineProperty(exports, "RatingItem", {
|
|
|
11
11
|
});
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
-
const _useRatingItem = require("./useRatingItem");
|
|
15
|
-
const _renderRatingItem = require("./renderRatingItem");
|
|
16
|
-
const _useRatingItemStylesstyles = require("./useRatingItemStyles.styles");
|
|
14
|
+
const _useRatingItem = require("./useRatingItem.cjs");
|
|
15
|
+
const _renderRatingItem = require("./renderRatingItem.cjs");
|
|
16
|
+
const _useRatingItemStylesstyles = require("./useRatingItemStyles.styles.cjs");
|
|
17
17
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
18
18
|
const RatingItem = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
19
19
|
const state = (0, _useRatingItem.useRatingItem_unstable)(props, ref);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/RatingItem.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;+BAEQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/RatingItem.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;+BAEQ,qBAAkB;kCACf,wBAAqB;2CAClB,kCAA+B;qCAEhC,kCAAkC;AAKvE,MAAMK,aAAAA,WAAAA,GAAmDL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,YAAQR,qCAAAA,EAAuBM,OAAOC;QAE5CL,uDAAAA,EAA6BM;QAC7BL,gDAAAA,EAA4B,gCAAgCK;IAE5D,WAAOP,2CAAAA,EAA0BO;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
|
|
@@ -28,7 +28,7 @@ _export(exports, {
|
|
|
28
28
|
return _useRatingItem.useRatingItem_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
const _RatingItem = require("./RatingItem");
|
|
32
|
-
const _renderRatingItem = require("./renderRatingItem");
|
|
33
|
-
const _useRatingItem = require("./useRatingItem");
|
|
34
|
-
const _useRatingItemStylesstyles = require("./useRatingItemStyles.styles");
|
|
31
|
+
const _RatingItem = require("./RatingItem.cjs");
|
|
32
|
+
const _renderRatingItem = require("./renderRatingItem.cjs");
|
|
33
|
+
const _useRatingItem = require("./useRatingItem.cjs");
|
|
34
|
+
const _useRatingItemStylesstyles = require("./useRatingItemStyles.styles.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/index.ts"],"sourcesContent":["export { RatingItem } from './RatingItem';\nexport type {\n RatingItemContextValue,\n RatingItemProps,\n RatingItemBaseProps,\n RatingItemSlots,\n RatingItemState,\n RatingItemBaseState,\n} from './RatingItem.types';\nexport { renderRatingItem_unstable } from './renderRatingItem';\nexport { useRatingItem_unstable, useRatingItemBase_unstable } from './useRatingItem';\nexport { ratingItemClassNames, useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\n"],"names":["RatingItem","renderRatingItem_unstable","useRatingItem_unstable","useRatingItemBase_unstable","ratingItemClassNames","useRatingItemStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,sBAAU;;;eAWVI,+CAAoB;;;eAFpBH,2CAAyB;;;eACDE,yCAA0B;;;eAC5BE,uDAA4B;;;eADlDH,qCAAsB;;;4BAVJ,
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/index.ts"],"sourcesContent":["export { RatingItem } from './RatingItem';\nexport type {\n RatingItemContextValue,\n RatingItemProps,\n RatingItemBaseProps,\n RatingItemSlots,\n RatingItemState,\n RatingItemBaseState,\n} from './RatingItem.types';\nexport { renderRatingItem_unstable } from './renderRatingItem';\nexport { useRatingItem_unstable, useRatingItemBase_unstable } from './useRatingItem';\nexport { ratingItemClassNames, useRatingItemStyles_unstable } from './useRatingItemStyles.styles';\n"],"names":["RatingItem","renderRatingItem_unstable","useRatingItem_unstable","useRatingItemBase_unstable","ratingItemClassNames","useRatingItemStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,sBAAU;;;eAWVI,+CAAoB;;;eAFpBH,2CAAyB;;;eACDE,yCAA0B;;;eAC5BE,uDAA4B;;;eADlDH,qCAAsB;;;4BAVJ,kBAAe;kCASA,wBAAqB;+BACI,qBAAkB;2CAClB,kCAA+B"}
|
|
@@ -21,7 +21,7 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
21
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
22
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
23
23
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
24
|
-
const _RatingItemContext = require("../../contexts/RatingItemContext");
|
|
24
|
+
const _RatingItemContext = require("../../contexts/RatingItemContext.cjs");
|
|
25
25
|
const defaultItemLabel = (num)=>num + '';
|
|
26
26
|
const useRatingItem_unstable = (props, ref)=>{
|
|
27
27
|
const context = (0, _RatingItemContext.useRatingItemContextValue_unstable)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RatingItem/useRatingItem.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RatingItemBaseProps, RatingItemBaseState, 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 state = useRatingItemBase_unstable(props, ref);\n\n return {\n ...state,\n color: context.color,\n size: context.size,\n };\n};\n\n/**\n * Base hook for RatingItem component. Manages state related to fill width calculation,\n * radio input slots (for ARIA rating interaction), icon slots, and interactive mode —\n * without design props (color, size from context).\n *\n * @param props - props from this instance of RatingItem\n * @param ref - reference to root HTMLElement of RatingItem\n */\nexport const useRatingItemBase_unstable = (\n props: RatingItemBaseProps,\n ref: React.Ref<HTMLSpanElement>,\n): RatingItemBaseState => {\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 return {\n appearance,\n step: context.step,\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"],"names":["React","getIntrinsicElementProps","slot","useMergedRefs","useFocusWithin","useRatingItemContextValue_unstable","defaultItemLabel","num","useRatingItem_unstable","props","ref","context","state","useRatingItemBase_unstable","color","size","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","components"],"mappings":"AAAA;;;;;;;;;;;;8BAsCaa;;;IAnBAL,sBAAAA;;;;;iEAjBU,QAAQ;gCAC+B,4BAA4B;8BAC3D,0BAA0B;mCAEN,
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/useRatingItem.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RatingItemBaseProps, RatingItemBaseState, 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 state = useRatingItemBase_unstable(props, ref);\n\n return {\n ...state,\n color: context.color,\n size: context.size,\n };\n};\n\n/**\n * Base hook for RatingItem component. Manages state related to fill width calculation,\n * radio input slots (for ARIA rating interaction), icon slots, and interactive mode —\n * without design props (color, size from context).\n *\n * @param props - props from this instance of RatingItem\n * @param ref - reference to root HTMLElement of RatingItem\n */\nexport const useRatingItemBase_unstable = (\n props: RatingItemBaseProps,\n ref: React.Ref<HTMLSpanElement>,\n): RatingItemBaseState => {\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 return {\n appearance,\n step: context.step,\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"],"names":["React","getIntrinsicElementProps","slot","useMergedRefs","useFocusWithin","useRatingItemContextValue_unstable","defaultItemLabel","num","useRatingItem_unstable","props","ref","context","state","useRatingItemBase_unstable","color","size","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","components"],"mappings":"AAAA;;;;;;;;;;;;8BAsCaa;;;IAnBAL,sBAAAA;;;;;iEAjBU,QAAQ;gCAC+B,4BAA4B;8BAC3D,0BAA0B;mCAEN,sCAAmC;AAEtF,MAAMF,mBAAmB,CAACC,MAAgBA,MAAM;AAWzC,+BAA+B,CAACE,OAAwBC;IAC7D,MAAMC,cAAUN,qDAAAA;IAChB,MAAMO,QAAQC,2BAA2BJ,OAAOC;IAEhD,OAAO;QACL,GAAGE,KAAK;QACRE,OAAOH,QAAQG,KAAK;QACpBC,MAAMJ,QAAQI,IAAI;IACpB;AACF,EAAE;AAUK,MAAMF,6BAA6B,CACxCJ,OACAC;IAEA,MAAMC,cAAUN,qDAAAA;IAChB,MAAM,EAAEW,QAAQ,CAAC,EAAE,GAAGP;IACtB,MAAM,EAAEQ,YAAYX,gBAAgB,EAAEY,YAAYC,UAAU,EAAEC,aAAaC,WAAW,EAAE,GAAGV;IAE3F,MAAMW,cAAcC,KAAKC,KAAK,CAAEb,CAAAA,QAAQK,KAAK,KAAI,CAAA,GAAK,KAAK,GAAG,2BAA2B;QAE5DL;IAA7B,MAAMc,uBAAuBd,CAAAA,wBAAAA,QAAQe,YAAAA,AAAY,MAAA,QAApBf,0BAAAA,KAAAA,IAAAA,wBAAwBW;IAErD,MAAMK,aAAahB,QAAQiB,WAAW,GAAG,YAAY;IAErD,IAAIC;IACJ,IAAIlB,QAAQmB,OAAO,IAAIL,wBAAwBT,OAAO;QACpDa,gBAAgB;IAClB,OAAO,IAAIJ,wBAAwBT,QAA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MAAM;gBACNC,MAAM9B,QAAQ8B,IAAI;gBAClBzB;gBACA0B,SAASpB,gBAAgBN;gBACzB,cAAcC,UAAUD;gBACxB2B,UAAU;gBACR,mHAAmH;gBACnH,wGAAwG;gBAC1G;YACF;YAEAV,aAAa;QACf;IACF;IAEA,OAAO;QACLN;QACAY,MAAM5B,QAAQ4B,IAAI;QAClBV;QACAb;QACA6B,YAAY;YACVd,MAAM;YACNM,cAAc;YACdH,gBAAgB;YAChBI,gBAAgB;YAChBM,gBAAgB;QAClB;QACAb;QACAM;QACAH;QACAI;QACAM;IACF;AACF,EAAE"}
|
|
@@ -277,7 +277,6 @@ const useIndicatorStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
277
277
|
]
|
|
278
278
|
});
|
|
279
279
|
const useRatingItemStyles_unstable = (state)=>{
|
|
280
|
-
'use no memo';
|
|
281
280
|
const { color, size, iconFillWidth, appearance } = state;
|
|
282
281
|
const styles = useStyles();
|
|
283
282
|
const inputBaseClassName = useInputBaseClassName();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useRatingItemStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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 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 // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n if (state.halfValueInput) {\n // eslint-disable-next-line react-hooks/immutability\n state.halfValueInput.className = mergeClasses(ratingItemClassNames.halfValueInput, inputBaseClassName, inputStyles.lowerHalf, state.halfValueInput.className);\n }\n if (state.fullValueInput) {\n // eslint-disable-next-line react-hooks/immutability\n state.fullValueInput.className = mergeClasses(ratingItemClassNames.fullValueInput, inputBaseClassName, state.halfValueInput && inputStyles.upperHalf, state.fullValueInput.className);\n }\n if (state.unselectedIcon) {\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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","h6p2u","I6qiy5","yzno9d","By0wis0","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","B7iucu3","Biw2w6l","brandFilled","marigoldFilled","useRatingItemStyles_unstable","state","color","size","iconFillWidth","appearance","styles","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAICK,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,KAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,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;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA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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;QACpB,oDAAA;QACAgF,KAAK,CAAChF,YAAY,CAAC0F,SAAS,GAAG/F,uBAAY,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"}
|
|
@@ -123,7 +123,6 @@ const useIndicatorStyles = (0, _react.makeStyles)({
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
const useRatingItemStyles_unstable = (state)=>{
|
|
126
|
-
'use no memo';
|
|
127
126
|
const { color, size, iconFillWidth, appearance } = state;
|
|
128
127
|
const styles = useStyles();
|
|
129
128
|
const inputBaseClassName = useInputBaseClassName();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingItem/useRatingItemStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { 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 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 // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(ratingItemClassNames.root, styles.root, styles[size], state.root.className);\n\n if (state.halfValueInput) {\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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;;;;;;;;;;;;IAQaK,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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/C,cAAc,CAACwD,SAAS,OAAG/D,mBAAAA,EAC/BG,qBAAqBI,cAAc,EACnCoD,oBACAC,YAAY/B,SAAS,EACrByB,MAAM/C,cAAc,CAACwD,SAAS;IAElC;IAEA,IAAIT,MAAM9C,cAAc,EAAE;QACxB,oDAAoD;QACpD8C,MAAM9C,cAAc,CAACuD,SAAS,OAAG/D,mBAAAA,EAC/BG,qBAAqBK,cAAc,EACnCmD,oBACAL,MAAM/C,cAAc,IAAIqD,YAAY9B,SAAS,EAC7CwB,MAAM9C,cAAc,CAACuD,SAAS;IAElC;IAEA,IAAIT,MAAMhD,cAAc,EAAE;QACxB,oDAAoD;QACpDgD,MAAMhD,cAAc,CAACyD,SAAS,OAAG/D,mBAAAA,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;QACtB,oDAAoD;QACpDiD,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/index.ts"],"sourcesContent":["export { RatingItemContext, RatingItemProvider, useRatingItemContextValue_unstable } from './RatingItemContext';\n"],"names":["RatingItemContext","RatingItemProvider","useRatingItemContextValue_unstable"],"mappings":";;;;;;;;;;;;eAASA,oCAAiB;;;eAAEC,qCAAkB;;;eAAEC,qDAAkC;;;mCAAQ,
|
|
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,yBAAsB"}
|
|
@@ -76,7 +76,7 @@ _export(exports, {
|
|
|
76
76
|
return _Rating.useRating_unstable;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
const _Rating = require("./Rating");
|
|
80
|
-
const _RatingItem = require("./RatingItem");
|
|
81
|
-
const _index = require("./contexts/index");
|
|
82
|
-
const _RatingDisplay = require("./RatingDisplay");
|
|
79
|
+
const _Rating = require("./Rating.cjs");
|
|
80
|
+
const _RatingItem = require("./RatingItem.cjs");
|
|
81
|
+
const _index = require("./contexts/index.cjs");
|
|
82
|
+
const _RatingDisplay = require("./RatingDisplay.cjs");
|
|
@@ -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 useRatingBase_unstable,\n} from './Rating';\nexport type {\n RatingProps,\n RatingSlots,\n RatingState,\n RatingOnChangeEventData,\n RatingContextValues,\n RatingBaseProps,\n RatingBaseState,\n} from './Rating';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n useRatingItemBase_unstable,\n} from './RatingItem';\nexport type {\n RatingItemProps,\n RatingItemSlots,\n RatingItemState,\n RatingItemBaseProps,\n RatingItemBaseState,\n} 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 useRatingDisplayBase_unstable,\n} from './RatingDisplay';\nexport type {\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n RatingDisplayContextValues,\n RatingDisplayBaseProps,\n RatingDisplayBaseState,\n} from './RatingDisplay';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingStyles_unstable","useRating_unstable","useRatingContextValues","useRatingBase_unstable","RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable","useRatingItemBase_unstable","RatingItemProvider","useRatingItemContextValue_unstable","RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayStyles_unstable","useRatingDisplay_unstable","useRatingDisplayContextValues","useRatingDisplayBase_unstable"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;iBAkCO;eAAbe;;;eAhBAR,sBAAU;;IAcHM;wCAAkB;;;eA/BzBZ,wBAAgB;;;eAkChBe,sCAAuB;;;eAhBvBR,gCAAoB;;;eAiBpBS,2CAA4B;;;eAhB5BR,qCAAyB;;;eAlBzBP,6BAAqB;;;eAIrBI,8BAAsB;;;eADtBD,8BAAsB;;;eAmCtBgB,4CAA6B;;;eAD7BD,4CAA6B;;;eAF7BF,8CAA+B;;;eAC/BC,wCAAyB;;;eAfzBP,sCAA0B;;IASCE,kCAAkC;;;;eAX7DJ,wCAA4B;;;eAC5BC,kCAAsB;;;eAnBtBR,gCAAwB;;;eACxBC,0BAAkB;;;wBAGb,
|
|
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 useRatingBase_unstable,\n} from './Rating';\nexport type {\n RatingProps,\n RatingSlots,\n RatingState,\n RatingOnChangeEventData,\n RatingContextValues,\n RatingBaseProps,\n RatingBaseState,\n} from './Rating';\nexport {\n RatingItem,\n ratingItemClassNames,\n renderRatingItem_unstable,\n useRatingItemStyles_unstable,\n useRatingItem_unstable,\n useRatingItemBase_unstable,\n} from './RatingItem';\nexport type {\n RatingItemProps,\n RatingItemSlots,\n RatingItemState,\n RatingItemBaseProps,\n RatingItemBaseState,\n} 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 useRatingDisplayBase_unstable,\n} from './RatingDisplay';\nexport type {\n RatingDisplayProps,\n RatingDisplaySlots,\n RatingDisplayState,\n RatingDisplayContextValues,\n RatingDisplayBaseProps,\n RatingDisplayBaseState,\n} from './RatingDisplay';\n"],"names":["Rating","ratingClassNames","renderRating_unstable","useRatingStyles_unstable","useRating_unstable","useRatingContextValues","useRatingBase_unstable","RatingItem","ratingItemClassNames","renderRatingItem_unstable","useRatingItemStyles_unstable","useRatingItem_unstable","useRatingItemBase_unstable","RatingItemProvider","useRatingItemContextValue_unstable","RatingDisplay","ratingDisplayClassNames","renderRatingDisplay_unstable","useRatingDisplayStyles_unstable","useRatingDisplay_unstable","useRatingDisplayContextValues","useRatingDisplayBase_unstable"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;iBAkCO;eAAbe;;;eAhBAR,sBAAU;;IAcHM;wCAAkB;;;eA/BzBZ,wBAAgB;;;eAkChBe,sCAAuB;;;eAhBvBR,gCAAoB;;;eAiBpBS,2CAA4B;;;eAhB5BR,qCAAyB;;;eAlBzBP,6BAAqB;;;eAIrBI,8BAAsB;;;eADtBD,8BAAsB;;;eAmCtBgB,4CAA6B;;;eAD7BD,4CAA6B;;;eAF7BF,8CAA+B;;;eAC/BC,wCAAyB;;;eAfzBP,sCAA0B;;IASCE,kCAAkC;;;;eAX7DJ,wCAA4B;;;eAC5BC,kCAAsB;;;eAnBtBR,gCAAwB;;;eACxBC,0BAAkB;;;wBAGb,cAAW;4BAiBX,kBAAe;uBAQiD,sBAAmB;+BASnF,qBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-rating",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.4",
|
|
4
4
|
"description": "Rating component for building web experiences",
|
|
5
|
-
"main": "lib-commonjs/index.
|
|
5
|
+
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui/react-jsx-runtime": "^9.4.3",
|
|
16
15
|
"@fluentui/react-icons": "^2.0.245",
|
|
17
|
-
"@fluentui/react-
|
|
18
|
-
"@fluentui/react-
|
|
19
|
-
"@fluentui/react-tabster": "^9.26.
|
|
20
|
-
"@fluentui/react-
|
|
16
|
+
"@fluentui/react-jsx-runtime": "^9.4.5",
|
|
17
|
+
"@fluentui/react-shared-contexts": "^9.26.3",
|
|
18
|
+
"@fluentui/react-tabster": "^9.26.17",
|
|
19
|
+
"@fluentui/react-theme": "^9.2.2",
|
|
20
|
+
"@fluentui/react-utilities": "^9.26.6",
|
|
21
21
|
"@griffel/react": "^1.5.32",
|
|
22
22
|
"@swc/helpers": "^0.5.1"
|
|
23
23
|
},
|
|
@@ -29,10 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./lib/index.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/index.d.cts",
|
|
38
|
+
"default": "./lib-commonjs/index.cjs"
|
|
39
|
+
}
|
|
36
40
|
},
|
|
37
41
|
"./package.json": "./package.json"
|
|
38
42
|
},
|
|
@@ -45,7 +49,9 @@
|
|
|
45
49
|
"files": [
|
|
46
50
|
"*.md",
|
|
47
51
|
"dist/*.d.ts",
|
|
52
|
+
"dist/*.d.cts",
|
|
48
53
|
"lib",
|
|
49
54
|
"lib-commonjs"
|
|
50
|
-
]
|
|
55
|
+
],
|
|
56
|
+
"type": "module"
|
|
51
57
|
}
|