@fluentui-copilot/react-reference 0.0.0-nightly-20250708-1433-52f2b6b1.1 → 0.0.0-nightly-20250710-0405-e728c4d6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +3 -3
- package/CHANGELOG.md +4 -4
- package/lib/Citation.js +1 -0
- package/lib/Reference.js +1 -0
- package/lib/ReferenceList.js +1 -0
- package/lib/ReferenceOverflowButton.js +1 -0
- package/lib/components/Citation/Citation.js +6 -5
- package/lib/components/Citation/Citation.types.js +2 -1
- package/lib/components/Citation/index.js +1 -0
- package/lib/components/Citation/renderCitation.js +6 -4
- package/lib/components/Citation/useCitation.js +28 -22
- package/lib/components/Reference/Reference.js +5 -4
- package/lib/components/Reference/Reference.types.js +2 -1
- package/lib/components/Reference/index.js +1 -0
- package/lib/components/Reference/renderReference.js +17 -20
- package/lib/components/Reference/useReference.js +59 -53
- package/lib/components/ReferenceList/ReferenceList.js +6 -5
- package/lib/components/ReferenceList/ReferenceList.types.js +2 -1
- package/lib/components/ReferenceList/index.js +1 -0
- package/lib/components/ReferenceList/renderReferenceList.js +17 -17
- package/lib/components/ReferenceList/useReferenceList.js +80 -70
- package/lib/components/ReferenceList/useReferenceListContextValues.js +21 -13
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.js +5 -4
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js +2 -1
- package/lib/components/ReferenceOverflowButton/index.js +1 -0
- package/lib/components/ReferenceOverflowButton/renderReferenceOverflowButton.js +14 -9
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButton.js +77 -77
- package/lib/contexts/index.js +1 -0
- package/lib/contexts/referenceListContext.js +12 -11
- package/lib/index.js +25 -12
- package/lib/utilities/generateReferenceCitationPreview.js +86 -75
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/useReferenceCitationPreview.js +5 -5
- package/lib-commonjs/Citation.js +1 -0
- package/lib-commonjs/Reference.js +1 -0
- package/lib-commonjs/ReferenceList.js +1 -0
- package/lib-commonjs/ReferenceOverflowButton.js +1 -0
- package/lib-commonjs/components/Citation/Citation.js +1 -1
- package/lib-commonjs/components/Citation/Citation.js.map +1 -1
- package/lib-commonjs/components/Citation/Citation.types.js +1 -0
- package/lib-commonjs/components/Citation/index.js +1 -0
- package/lib-commonjs/components/Citation/renderCitation.js +1 -1
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitation.js +1 -1
- package/lib-commonjs/components/Citation/useCitation.js.map +1 -1
- package/lib-commonjs/components/Reference/Reference.js +1 -1
- package/lib-commonjs/components/Reference/Reference.js.map +1 -1
- package/lib-commonjs/components/Reference/Reference.types.js +1 -0
- package/lib-commonjs/components/Reference/index.js +1 -0
- package/lib-commonjs/components/Reference/renderReference.js +1 -1
- package/lib-commonjs/components/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReference.js +1 -1
- package/lib-commonjs/components/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js +1 -0
- package/lib-commonjs/components/ReferenceList/index.js +1 -0
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListContextValues.js +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListContextValues.js.map +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/index.js +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/contexts/index.js +1 -0
- package/lib-commonjs/contexts/referenceListContext.js +1 -1
- package/lib-commonjs/contexts/referenceListContext.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/useReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js.map +1 -1
- package/package.json +6 -6
- package/lib/components/Citation/useCitationStyles.styles.raw.js +0 -69
- package/lib/components/Citation/useCitationStyles.styles.raw.js.map +0 -1
- package/lib/components/Reference/useReferenceStyles.styles.raw.js +0 -110
- package/lib/components/Reference/useReferenceStyles.styles.raw.js.map +0 -1
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js +0 -47
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +0 -1
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +0 -45
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js +0 -85
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js +0 -132
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js +0 -63
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +0 -61
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.graphic && <state.graphic />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["renderReference_unstable","state","assertSlots","id","
|
|
1
|
+
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.graphic && <state.graphic />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["renderReference_unstable","state","assertSlots","id","divider","_jsxs","root","content","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMaA;;;eAAAA;;;4BALb;iCAE0C;AAGnC,MAAMA,2BAA2BC,CAAAA;oCACtCC,EAAAA;UAEA,EAEAC,EAAA;sBAGWC,WAAO,GAAAC,IAAAA,gBAAA,EAAAJ,MAAIK,IAACL,EAAAA;kBAClBA;YAAAA,MAAMM,QAAO,IAAA,WACZ,GAAAC,IAAAA,eAACP,EAAAA,MAAMM,QAAO,EAAA,CAAA;YAAAN,MAAAG,OAAA,IAAA,WAAA,GAAAI,IAAAA,eAAA,EAAAP,MAAAG,OAAA,EAAA,CAAA;YAAAH,MAAAM,OAAA,IAAA,WAAA,GAAAF,IAAAA,gBAAA,EAAAJ,MAAAM,OAAA,EAAA;;;;;;;;;;;;8CASSJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../contexts/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { as, children, id } = props;\n\n const designVersion = useDesignVersion(props.designVersion);\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const elementType = as || ((props as JSX.IntrinsicElements['a']).href ? 'a' : 'button');\n const propsWithAssignedAs = {\n type: elementType === 'button' ? 'button' : undefined,\n ...props,\n as: elementType,\n id: referenceId,\n } as ReferenceProps;\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n designVersion,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: elementType,\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n ...propsWithAssignedAs,\n }),\n { elementType },\n ),\n citation,\n divider,\n content,\n graphic,\n };\n\n if (state.graphic && React.isValidElement<HTMLElement>(state.graphic.children)) {\n state.graphic.children = React.cloneElement(state.graphic.children, {\n className: mergeClasses(state.graphic.children.props.className, referenceExtraClassNames.graphicChild),\n });\n }\n\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../contexts/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { as, children, id } = props;\n\n const designVersion = useDesignVersion(props.designVersion);\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const elementType = as || ((props as JSX.IntrinsicElements['a']).href ? 'a' : 'button');\n const propsWithAssignedAs = {\n type: elementType === 'button' ? 'button' : undefined,\n ...props,\n as: elementType,\n id: referenceId,\n } as ReferenceProps;\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n designVersion,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: elementType,\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n ...propsWithAssignedAs,\n }),\n { elementType },\n ),\n citation,\n divider,\n content,\n graphic,\n };\n\n if (state.graphic && React.isValidElement<HTMLElement>(state.graphic.children)) {\n state.graphic.children = React.cloneElement(state.graphic.children, {\n className: mergeClasses(state.graphic.children.props.className, referenceExtraClassNames.graphicChild),\n });\n }\n\n return state;\n};\n"],"names":["as","props","children","referenceId","id","type","elementType","designVersion","undefined","shouldUseOverflow","useReferenceListContext_unstable","ctx","propsWithAssignedAs","citation","optional","slot","content","renderByDefault","graphic","root","ref","always","getIntrinsicElementProps","divider","state","React","cloneElement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBUA;;;eAAAA;;;;iEApBa;iCAC6C;sCACnB;0CACR;+BAER;AAe/B,MAAQA,wBAAqBC,CAAAA,OAAAA;UAE7B,EAEAD,EAAA,EAEAE,QAAMC,EAENC,EAAA,KACAH;UACEI,gBAAMC,IAAAA,+BAAgB,EAAWL,MAAAM,aAAWC;UAC5CC,oBAAQC,IAAAA,sDAAA,EAAAC,CAAAA,MAAAA,IAAAF,iBAAA;UACRT,cAAIM,IAAAA,sBAAAA,EAAAA,cAAAA;UACJF,cAAID,MAAAA,CAAAA,MAAAA,IAAAA,GAAAA,MAAAA,QAAAA;UACNS,sBAAA;QAEAP,MAAMQ,gBAAgBC,WAASb,WAAMY;gBAAYP;QAAoBN,IAAAM;QACrEF,IAAAD;;UAAmEU,WAAAE,qBAAA,CAAAD,QAAA,CAAAb,MAAAY,QAAA,EAAA;QACnEP,aAAMU;;UAEJC,UAAAA,qBAAAA,CAAAA,QAAiBC,CAAAA,MAAYV,OAAAA,EAAAA;QAC/BF,aAAA;;UAEEA,UAAAA,qBAAa,CAAAQ,QAAA,CAAAb,MAAAe,OAAA,EAAA;qBACbC;QACFA,iBAAAC,YAAAV,aAAA,CAAA,CAAAN;;UAGEK,UAAAA,qBAAAA,CAAAA,QAAAA,CAAAA,MAAAA,OAAAA,EAAAA;qBACIJ;yBACJM,aAAAA,aAAAA,YAAAA;;kBAGEU;;;;oBAIAH;kBACFV;sBAEMS;qBAEFK;qBACGR;qBAEL;;cAAcG,qBAAA,CAAAM,MAAA,CAAAC,IAAAA,yCAAA,EAAAhB,aAAA;;eAGhBiB,mBAAAA;YACAP;;QAEF;QAEAH;;;;;QAMAW,MAAOA,OAAAA,kBAAAA,OAAAA,cAAAA,CAAAA,MAAAA,OAAAA,CAAAA,QAAAA,GAAAA;QACPA,MAAAN,OAAA,CAAAhB,QAAA,iBAAAuB,OAAAC,YAAA,CAAAF,MAAAN,OAAA,CAAAhB,QAAA,EAAA"}
|
|
@@ -20,4 +20,4 @@ const ReferenceList = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
|
20
20
|
(0, _useReferenceListStylesstyles.useReferenceListStyles_unstable)(state);
|
|
21
21
|
return (0, _renderReferenceList.renderReferenceList_unstable)(state, referenceListContextValues);
|
|
22
22
|
});
|
|
23
|
-
ReferenceList.displayName = 'ReferenceList';
|
|
23
|
+
ReferenceList.displayName = 'ReferenceList'; //# sourceMappingURL=ReferenceList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { renderReferenceList_unstable } from './renderReferenceList';\nimport { useReferenceList_unstable } from './useReferenceList';\nimport { useReferenceListStyles_unstable } from './useReferenceListStyles.styles';\nimport { useReferenceListContextValues_unstable } from './useReferenceListContextValues';\nimport type { ReferenceListProps } from './ReferenceList.types';\n\nexport const ReferenceList: ForwardRefComponent<ReferenceListProps> = React.forwardRef((props, ref) => {\n const state = useReferenceList_unstable(props, ref);\n const referenceListContextValues = useReferenceListContextValues_unstable(state);\n\n useReferenceListStyles_unstable(state);\n\n return renderReferenceList_unstable(state, referenceListContextValues);\n});\n\nReferenceList.displayName = 'ReferenceList';\n"],"names":["ReferenceList","React","forwardRef","props","
|
|
1
|
+
{"version":3,"sources":["ReferenceList.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { renderReferenceList_unstable } from './renderReferenceList';\nimport { useReferenceList_unstable } from './useReferenceList';\nimport { useReferenceListStyles_unstable } from './useReferenceListStyles.styles';\nimport { useReferenceListContextValues_unstable } from './useReferenceListContextValues';\nimport type { ReferenceListProps } from './ReferenceList.types';\n\nexport const ReferenceList: ForwardRefComponent<ReferenceListProps> = React.forwardRef((props, ref) => {\n const state = useReferenceList_unstable(props, ref);\n const referenceListContextValues = useReferenceListContextValues_unstable(state);\n\n useReferenceListStyles_unstable(state);\n\n return renderReferenceList_unstable(state, referenceListContextValues);\n});\n\nReferenceList.displayName = 'ReferenceList';\n"],"names":["ReferenceList","React","forwardRef","props","state","useReferenceList_unstable","referenceListContextValues","useReferenceListContextValues_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;qCAEsB;kCACH;8CACM;+CACO;AAGhD,MAAMA,gBAAAA,WAAAA,GAAAA,OAAyDC,UAAMC,CAAU,CAACC,OAACA;UACtFC,QAAMA,IAAAA,2CAAQC,EAAAA,OAA0BF;UACxCG,6BAAMA,IAAAA,qEAA6BC,EAAAA;qEAEnCC,EAAAA;WAEAC,IAAAA,iDAAOA,EAAAA,OAA6BL;AACtC;AAEAJ,cAAcU,WAAW,GAAG"}
|
|
@@ -29,3 +29,4 @@ const _ReferenceList = require("./ReferenceList");
|
|
|
29
29
|
const _renderReferenceList = require("./renderReferenceList");
|
|
30
30
|
const _useReferenceList = require("./useReferenceList");
|
|
31
31
|
const _useReferenceListStylesstyles = require("./useReferenceListStyles.styles");
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState, contextValues: ReferenceListContextValues) => {\n assertSlots<ReferenceListSlots>(state);\n\n const { minVisibleReferences } = state;\n\n return (\n <ReferenceListContextProvider value={contextValues.referenceList}>\n <Overflow minimumVisible={minVisibleReferences}>\n <state.root>\n <state.arrowableRegion />\n {state.showMoreButton && <state.showMoreButton />}\n {state.showLessButton && <state.showLessButton />}\n </state.root>\n </Overflow>\n </ReferenceListContextProvider>\n );\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState, contextValues: ReferenceListContextValues) => {\n assertSlots<ReferenceListSlots>(state);\n\n const { minVisibleReferences } = state;\n\n return (\n <ReferenceListContextProvider value={contextValues.referenceList}>\n <Overflow minimumVisible={minVisibleReferences}>\n <state.root>\n <state.arrowableRegion />\n {state.showMoreButton && <state.showMoreButton />}\n {state.showLessButton && <state.showLessButton />}\n </state.root>\n </Overflow>\n </ReferenceListContextProvider>\n );\n};\n"],"names":["assertSlots","state","minVisibleReferences","contextValues","minimumVisible","referenceList","showMoreButton","root","showLessButton","arrowableRegion","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWEA;;;eAAAA;;;4BAVF;iCAEsC;sCAEO;AAM3CA,MAAAA,+BAAgCC,CAAAA,OAAAA;oCAExBC,EAAAA;UAER,sBACuCC;sBACzBC,GAAAA,IAAAA,eAAAA,EAAAA,kDAAgBF,EAAAA;6BACxBG,aAAA;;;iCAESC,GAAAA,IAAAA,gBAAAA,EAAAA,MAAcC,IAAA,EAAA;;+BACdC,GAAAA,IAAAA,eAAAA,EAAAA,MAAcC,eAAI,EAAA,CAAA;oBAACR,MAAMO,cAAc,IAAA,WAAA,GAAAE,IAAAA,eAAA,EAAAT,MAAAK,cAAA,EAAA,CAAA;oBAAAL,MAAAO,cAAA,IAAA,WAAA,GAAAE,IAAAA,eAAA,EAAAT,MAAAO,cAAA,EAAA,CAAA;iBAAA;;;;GAKxD,+CAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useArrowNavigationGroup,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport { useOverflowMaxVisibleItems } from '@fluentui-copilot/react-utilities';\nimport { useRootStyles } from '../Reference/useReferenceStyles.styles';\nimport type { ReferenceListProps, ReferenceListState } from './ReferenceList.types';\n\n/**\n * Create the state required to render ReferenceList.\n *\n * The returned state can be modified with hooks such as useReferenceListStyles_unstable,\n * before being passed to renderReferenceList_unstable.\n *\n * @param props - props from this instance of ReferenceList\n * @param ref - reference to root HTMLElement of ReferenceList\n */\nexport const useReferenceList_unstable = (\n props: ReferenceListProps,\n ref: React.Ref<HTMLDivElement>,\n): ReferenceListState => {\n const {\n arrowableRegion,\n children,\n maxVisibleReferences,\n minVisibleReferences,\n showLessButton,\n showMoreButton,\n ...rest\n } = props;\n\n const [areReferencesExpanded, setAreReferencesExpanded] = React.useState(false);\n const referenceListRef = React.useRef<HTMLDivElement>(null);\n\n const totalReferencesCount = React.Children.count(children);\n const styles = useRootStyles();\n const resolvedChildren = useOverflowMaxVisibleItems({\n additionalCondition: !areReferencesExpanded,\n children,\n maxVisibleItems: maxVisibleReferences,\n minVisibleItems: minVisibleReferences,\n overflowClassName: styles.overflow,\n });\n\n // We keep track of whether we are interacting with the overflow button via keyboard or not.\n const overflowButtonTriggeredViaKeyboard = React.useRef(false);\n\n const focusAttributes = useArrowNavigationGroup({\n axis: 'both',\n circular: true,\n memorizeCurrent: true,\n });\n\n const onShowMoreButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(true);\n }, []);\n\n const onShowLessButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(false);\n }, []);\n\n const shouldUseOverflow =\n (minVisibleReferences === undefined || minVisibleReferences < totalReferencesCount) &&\n maxVisibleReferences !== undefined &&\n !areReferencesExpanded;\n\n // Since the overflow button is an OverflowItem that's always visible, we need to account for it.\n const minVisibleOverflowItems = minVisibleReferences ? minVisibleReferences + 1 : 1;\n\n const state: ReferenceListState = {\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n maxVisibleReferences,\n minVisibleReferences: minVisibleOverflowItems,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n\n components: {\n root: 'div',\n arrowableRegion: 'div',\n showMoreButton: 'span',\n showLessButton: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, referenceListRef),\n ...rest,\n }),\n { elementType: 'div' },\n ),\n arrowableRegion: slot.always(arrowableRegion, {\n defaultProps: { ...focusAttributes, children: resolvedChildren },\n elementType: 'div',\n }),\n showMoreButton: shouldUseOverflow ? slot.optional(showMoreButton, { elementType: 'span' }) : undefined,\n showLessButton: areReferencesExpanded ? slot.optional(showLessButton, { elementType: 'span' }) : undefined,\n };\n\n if (state.showMoreButton) {\n state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);\n }\n\n if (state.showLessButton) {\n state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);\n }\n\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useReferenceList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useArrowNavigationGroup,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport { useOverflowMaxVisibleItems } from '@fluentui-copilot/react-utilities';\nimport { useRootStyles } from '../Reference/useReferenceStyles.styles';\nimport type { ReferenceListProps, ReferenceListState } from './ReferenceList.types';\n\n/**\n * Create the state required to render ReferenceList.\n *\n * The returned state can be modified with hooks such as useReferenceListStyles_unstable,\n * before being passed to renderReferenceList_unstable.\n *\n * @param props - props from this instance of ReferenceList\n * @param ref - reference to root HTMLElement of ReferenceList\n */\nexport const useReferenceList_unstable = (\n props: ReferenceListProps,\n ref: React.Ref<HTMLDivElement>,\n): ReferenceListState => {\n const {\n arrowableRegion,\n children,\n maxVisibleReferences,\n minVisibleReferences,\n showLessButton,\n showMoreButton,\n ...rest\n } = props;\n\n const [areReferencesExpanded, setAreReferencesExpanded] = React.useState(false);\n const referenceListRef = React.useRef<HTMLDivElement>(null);\n\n const totalReferencesCount = React.Children.count(children);\n const styles = useRootStyles();\n const resolvedChildren = useOverflowMaxVisibleItems({\n additionalCondition: !areReferencesExpanded,\n children,\n maxVisibleItems: maxVisibleReferences,\n minVisibleItems: minVisibleReferences,\n overflowClassName: styles.overflow,\n });\n\n // We keep track of whether we are interacting with the overflow button via keyboard or not.\n const overflowButtonTriggeredViaKeyboard = React.useRef(false);\n\n const focusAttributes = useArrowNavigationGroup({\n axis: 'both',\n circular: true,\n memorizeCurrent: true,\n });\n\n const onShowMoreButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(true);\n }, []);\n\n const onShowLessButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(false);\n }, []);\n\n const shouldUseOverflow =\n (minVisibleReferences === undefined || minVisibleReferences < totalReferencesCount) &&\n maxVisibleReferences !== undefined &&\n !areReferencesExpanded;\n\n // Since the overflow button is an OverflowItem that's always visible, we need to account for it.\n const minVisibleOverflowItems = minVisibleReferences ? minVisibleReferences + 1 : 1;\n\n const state: ReferenceListState = {\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n maxVisibleReferences,\n minVisibleReferences: minVisibleOverflowItems,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n\n components: {\n root: 'div',\n arrowableRegion: 'div',\n showMoreButton: 'span',\n showLessButton: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, referenceListRef),\n ...rest,\n }),\n { elementType: 'div' },\n ),\n arrowableRegion: slot.always(arrowableRegion, {\n defaultProps: { ...focusAttributes, children: resolvedChildren },\n elementType: 'div',\n }),\n showMoreButton: shouldUseOverflow ? slot.optional(showMoreButton, { elementType: 'span' }) : undefined,\n showLessButton: areReferencesExpanded ? slot.optional(showLessButton, { elementType: 'span' }) : undefined,\n };\n\n if (state.showMoreButton) {\n state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);\n }\n\n if (state.showLessButton) {\n state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);\n }\n\n return state;\n};\n"],"names":["arrowableRegion","maxVisibleReferences","referenceListRef","children","totalReferencesCount","useRootStyles","minVisibleReferences","resolvedChildren","additionalCondition","overflowClassName","styles","React","useState","useRef","Children","count","overflowButtonTriggeredViaKeyboard","focusAttributes","areReferencesExpanded","memorizeCurrent","minVisibleItems","onShowMoreButtonClick","useCallback","setAreReferencesExpanded","axis","circular","shouldUseOverflow","components","root","minVisibleOverflowItems","elementType","defaultProps","ref","showMoreButton","undefined","showLessButton","slot","optional","state"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA0BIA;;;eAAAA;;;;iEA1BmB;iCAOhB;gCACoC;0CACb;AAgB5B,MACEA,4BAEAC,CAAAA,OAAAA;UAOF,EACAD,eAAME,EAENC,QAAMC,EACNH,oBAAeI,EACfC,oBAAMC,gBACJC,gBACAL;UAGAM,CAAAA,uBAAmBC,yBAAe,GAAAC,OAAAC,QAAA,CAAA;UACpCV,mBAAAS,OAAAE,MAAA,CAAA;UAEAT,uBAAAO,OAAAG,QAAA,CAAAC,KAAA,CAAAZ;UACAO,SAAMM,IAAAA,uCAAAA;UAENT,mBAAMU,IAAAA,0CAA0C,EAAA;6BACxC,CAAAC;;yBAENC;QACFC,iBAAAd;QAEAG,mBAAMY,OAAAA,QAAwBV;;gGAEzB;UAELK,qCAAoCM,OAAWT,MAA6C,CAAA;UAC1FU,kBAAAA,IAAAA,wCAAyB,EAAA;QAC3BC,MAAK;QAELC,UAAMC;QAKNP,iBAAA;;UAGAE,wBAAkCV,OAAAW,WAAA,CAAA;iCAChCJ;;UAEAjB,wBAAAA,OAAAA,WAAAA,CAAAA;iCACAK;;UAEAoB,oBAAAA,CAAAA,yBAAAA,aAAAA,uBAAAA,oBAAAA,KAAAA,yBAAAA,aAAAA,CAAAA;qGACAtB;UAEAuB,0BAAYrB,uBAAAA,uBAAA,IAAA;kBACVsB;;;;8BAIFC;;;;oBAME;kBAAEC;6BAAmB;4BAEvB9B;4BACE+B;;0CAAoC5B,CAAAA,IAAAA,yCAAUI,EAAAA,OAAAA;mDAAiB,EAAAyB,KAAA9B;mBAC/D4B;YACF;yBACAG;;yBAA6FC,qBAAAA,CAAAA,MAAAA,CAAAA,iBAAAA;0BAC7FC;kCAAqF;gBAAOhC,UAAK+B;YACnG;YAEAJ,aAAUG;;QAEVA,gBAAAP,oBAAAU,qBAAA,CAAAC,QAAA,CAAAJ,gBAAA;YAEAH,aAAUK;aACRG;QACFH,gBAAAjB,wBAAAkB,qBAAA,CAAAC,QAAA,CAAAF,gBAAA;YAEAL,aAAOQ;QACP,KAAAJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceListContextValues.ts"],"sourcesContent":["import type { ReferenceListState, ReferenceListContextValues } from './ReferenceList.types';\n\nexport function useReferenceListContextValues_unstable(state: ReferenceListState): ReferenceListContextValues {\n const {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const referenceList = {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n };\n\n return { referenceList };\n}\n"],"names":["useReferenceListContextValues_unstable","state","areReferencesExpanded","maxVisibleReferences","
|
|
1
|
+
{"version":3,"sources":["useReferenceListContextValues.ts"],"sourcesContent":["import type { ReferenceListState, ReferenceListContextValues } from './ReferenceList.types';\n\nexport function useReferenceListContextValues_unstable(state: ReferenceListState): ReferenceListContextValues {\n const {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const referenceList = {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n };\n\n return { referenceList };\n}\n"],"names":["useReferenceListContextValues_unstable","state","areReferencesExpanded","maxVisibleReferences","referenceList","overflowButtonTriggeredViaKeyboard","referenceListRef","totalReferencesCount"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,uCAAuCC,KAAyB;UAC9E,EASAC,qBAAA,EACAC,oBAAMC,oCACJF,kBACAC,mBACAE,sBACAC;uGAEAC;UACFH,gBAAA;QAEAF;;QAAuBG;QACzBC"}
|
|
@@ -18,4 +18,4 @@ const ReferenceOverflowButton = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
|
18
18
|
(0, _useReferenceOverflowButtonStylesstyles.useReferenceOverflowButtonStyles_unstable)(state);
|
|
19
19
|
return (0, _renderReferenceOverflowButton.renderReferenceOverflowButton_unstable)(state);
|
|
20
20
|
});
|
|
21
|
-
ReferenceOverflowButton.displayName = 'ReferenceOverflowButton';
|
|
21
|
+
ReferenceOverflowButton.displayName = 'ReferenceOverflowButton'; //# sourceMappingURL=ReferenceOverflowButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceOverflowButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceOverflowButton_unstable } from './useReferenceOverflowButton';\nimport { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';\nimport { useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles.styles';\nimport type { ReferenceOverflowButtonProps } from './ReferenceOverflowButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// ReferenceOverflowButton component - TODO: add more docs\nexport const ReferenceOverflowButton: ForwardRefComponent<ReferenceOverflowButtonProps> = React.forwardRef(\n (props, ref) => {\n const state = useReferenceOverflowButton_unstable(props, ref);\n\n useReferenceOverflowButtonStyles_unstable(state);\n return renderReferenceOverflowButton_unstable(state);\n },\n);\n\nReferenceOverflowButton.displayName = 'ReferenceOverflowButton';\n"],"names":["ReferenceOverflowButton","React","forwardRef","props","
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceOverflowButton_unstable } from './useReferenceOverflowButton';\nimport { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';\nimport { useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles.styles';\nimport type { ReferenceOverflowButtonProps } from './ReferenceOverflowButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// ReferenceOverflowButton component - TODO: add more docs\nexport const ReferenceOverflowButton: ForwardRefComponent<ReferenceOverflowButtonProps> = React.forwardRef(\n (props, ref) => {\n const state = useReferenceOverflowButton_unstable(props, ref);\n\n useReferenceOverflowButtonStyles_unstable(state);\n return renderReferenceOverflowButton_unstable(state);\n },\n);\n\nReferenceOverflowButton.displayName = 'ReferenceOverflowButton';\n"],"names":["ReferenceOverflowButton","React","forwardRef","props","state","useReferenceOverflowButton_unstable","useReferenceOverflowButtonStyles_unstable","renderReferenceOverflowButton_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;4CAC6B;+CACG;wDACG;AAKnD,MAAMA,0BAAAA,WAAAA,GAAAA,OAA6EC,UAAMC,CAAU,CACxGC,OAACA;UACCC,QAAMA,IAAAA,+DAAQC,EAAAA,OAAoCF;yFAElDG,EAAAA;WACAC,IAAAA,qEAAOA,EAAAA;AACT;AAGFP,wBAAwBQ,WAAW,GAAG"}
|
|
@@ -29,3 +29,4 @@ const _ReferenceOverflowButton = require("./ReferenceOverflowButton");
|
|
|
29
29
|
const _renderReferenceOverflowButton = require("./renderReferenceOverflowButton");
|
|
30
30
|
const _useReferenceOverflowButton = require("./useReferenceOverflowButton");
|
|
31
31
|
const _useReferenceOverflowButtonStylesstyles = require("./useReferenceOverflowButtonStyles.styles");
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState) => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState) => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["assertSlots","state","id","_jsx","OverflowItem"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":";;;;+BAUEA;;;eAAAA;;;4BAVwB;iCAGgB;AAOxCA,MAAAA,yCAA0CC,CAAAA;oCAClCC,EAAED;UAEV,gCAC2C;WAAtBC,6BAGjB,WAAA,GAAAC,IAAAA,eAAA,EAAAC,6BAAA,EAAA;QACJF,IAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceOverflowButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useFocusFinders,\n useId,\n useMergedRefs,\n useOverflowMenu,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport { useReferenceListContext_unstable } from '../../contexts/referenceListContext';\nimport type { ReferenceOverflowButtonProps, ReferenceOverflowButtonState } from './ReferenceOverflowButton.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render ReferenceOverflowButton.\n *\n * The returned state can be modified with hooks such as useReferenceOverflowButtonStyles_unstable,\n * before being passed to renderReferenceOverflowButton_unstable.\n *\n * @param props - props from this instance of ReferenceOverflowButton\n * @param ref - reference to root HTMLElement of ReferenceOverflowButton\n */\nexport const useReferenceOverflowButton_unstable = (\n props: ReferenceOverflowButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): ReferenceOverflowButtonState => {\n 'use no memo';\n\n const { children, id, text } = props;\n const designVersion = useDesignVersion(props.designVersion);\n\n const rootRef = React.useRef<HTMLButtonElement>(null);\n\n const [setTimeout] = useTimeout();\n\n const referenceOverflowButtonId = useId('reference-overflow-button-', id);\n\n const areReferencesExpanded = useReferenceListContext_unstable(ctx => ctx.areReferencesExpanded);\n const maxVisibleReferences = useReferenceListContext_unstable(ctx => ctx.maxVisibleReferences);\n const referenceListRef = useReferenceListContext_unstable(ctx => ctx.referenceListRef);\n const totalReferencesCount = useReferenceListContext_unstable(ctx => ctx.totalReferencesCount);\n const triggeredViaKeyboard = useReferenceListContext_unstable(ctx => ctx.overflowButtonTriggeredViaKeyboard);\n\n const { isOverflowing, overflowCount } = useOverflowMenu();\n\n const processedText = children ?? (typeof text === 'function' ? text(overflowCount) : text);\n\n const { findFirstFocusable, findNextFocusable } = useFocusFinders();\n const onKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLButtonElement>>(\n ev => {\n if (ev.key === Enter || ev.key === Space) {\n triggeredViaKeyboard.current = true;\n }\n },\n [triggeredViaKeyboard],\n );\n\n // We keep track of the previous overflow count to help determine the element to move focus to when expanding the references via keyboard.\n const previousOverflow = React.useRef(0);\n\n // When the references are expanded or collapsed via keyboard, we need to move focus to the appropriate element.\n React.useEffect(() => {\n // We only try to move focus if maxVisibleReferences is set and the overflow button was triggered via keyboard.\n if (maxVisibleReferences !== undefined && triggeredViaKeyboard.current) {\n let elementToFocus: HTMLElement | null | undefined;\n\n // If the references are collapsed, we move focus to the overflow button.\n if (!areReferencesExpanded) {\n elementToFocus = rootRef.current;\n previousOverflow.current = overflowCount;\n }\n // If the references are expanded, we move focus to the first reference that was hidden when they were collapsed.\n // We do this by moving focus according to the following heuristics:\n // - If maxVisibleReferences is what determines what overflows, focus is moved to the element that is in the maxVisibleReferences position of the ReferenceList's children.\n // - If the space available is what is determines what overflows, focus is moved to the element that is in the (totalReferencesCount - overflowCount) position of the ReferenceList's children.\n else if (rootRef.current && referenceListRef.current) {\n const positionToFocus =\n maxVisibleReferences < totalReferencesCount - previousOverflow.current\n ? maxVisibleReferences\n : totalReferencesCount - previousOverflow.current;\n\n let currentElement: HTMLElement | null | undefined = findFirstFocusable(referenceListRef.current);\n for (let i = 0; i < positionToFocus && currentElement; i++) {\n currentElement = findNextFocusable(currentElement);\n }\n\n elementToFocus = currentElement;\n }\n\n // We focus on the element and reset the triggeredViaKeyboard flag after a timeout to ensure that this is pushed at the end of the event queue.\n setTimeout(() => {\n elementToFocus?.focus();\n triggeredViaKeyboard.current = false;\n }, 0);\n }\n }, [\n areReferencesExpanded,\n findFirstFocusable,\n findNextFocusable,\n isOverflowing,\n maxVisibleReferences,\n overflowCount,\n referenceListRef,\n setTimeout,\n totalReferencesCount,\n triggeredViaKeyboard,\n ]);\n\n const state: ReferenceOverflowButtonState = {\n designVersion,\n id: referenceOverflowButtonId,\n shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,\n\n components: {\n root: 'button',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref: useMergedRefs(rootRef, ref),\n ...props,\n }),\n {\n defaultProps: {\n children: processedText,\n },\n elementType: 'button',\n },\n ),\n };\n\n state.root.onKeyDown = mergeCallbacks(onKeyDown, props.onKeyDown);\n\n return state;\n};\n"],"names":["useReferenceOverflowButton_unstable","props","ref","children","id","text","designVersion","
|
|
1
|
+
{"version":3,"sources":["useReferenceOverflowButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useFocusFinders,\n useId,\n useMergedRefs,\n useOverflowMenu,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport { useReferenceListContext_unstable } from '../../contexts/referenceListContext';\nimport type { ReferenceOverflowButtonProps, ReferenceOverflowButtonState } from './ReferenceOverflowButton.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render ReferenceOverflowButton.\n *\n * The returned state can be modified with hooks such as useReferenceOverflowButtonStyles_unstable,\n * before being passed to renderReferenceOverflowButton_unstable.\n *\n * @param props - props from this instance of ReferenceOverflowButton\n * @param ref - reference to root HTMLElement of ReferenceOverflowButton\n */\nexport const useReferenceOverflowButton_unstable = (\n props: ReferenceOverflowButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): ReferenceOverflowButtonState => {\n 'use no memo';\n\n const { children, id, text } = props;\n const designVersion = useDesignVersion(props.designVersion);\n\n const rootRef = React.useRef<HTMLButtonElement>(null);\n\n const [setTimeout] = useTimeout();\n\n const referenceOverflowButtonId = useId('reference-overflow-button-', id);\n\n const areReferencesExpanded = useReferenceListContext_unstable(ctx => ctx.areReferencesExpanded);\n const maxVisibleReferences = useReferenceListContext_unstable(ctx => ctx.maxVisibleReferences);\n const referenceListRef = useReferenceListContext_unstable(ctx => ctx.referenceListRef);\n const totalReferencesCount = useReferenceListContext_unstable(ctx => ctx.totalReferencesCount);\n const triggeredViaKeyboard = useReferenceListContext_unstable(ctx => ctx.overflowButtonTriggeredViaKeyboard);\n\n const { isOverflowing, overflowCount } = useOverflowMenu();\n\n const processedText = children ?? (typeof text === 'function' ? text(overflowCount) : text);\n\n const { findFirstFocusable, findNextFocusable } = useFocusFinders();\n const onKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLButtonElement>>(\n ev => {\n if (ev.key === Enter || ev.key === Space) {\n triggeredViaKeyboard.current = true;\n }\n },\n [triggeredViaKeyboard],\n );\n\n // We keep track of the previous overflow count to help determine the element to move focus to when expanding the references via keyboard.\n const previousOverflow = React.useRef(0);\n\n // When the references are expanded or collapsed via keyboard, we need to move focus to the appropriate element.\n React.useEffect(() => {\n // We only try to move focus if maxVisibleReferences is set and the overflow button was triggered via keyboard.\n if (maxVisibleReferences !== undefined && triggeredViaKeyboard.current) {\n let elementToFocus: HTMLElement | null | undefined;\n\n // If the references are collapsed, we move focus to the overflow button.\n if (!areReferencesExpanded) {\n elementToFocus = rootRef.current;\n previousOverflow.current = overflowCount;\n }\n // If the references are expanded, we move focus to the first reference that was hidden when they were collapsed.\n // We do this by moving focus according to the following heuristics:\n // - If maxVisibleReferences is what determines what overflows, focus is moved to the element that is in the maxVisibleReferences position of the ReferenceList's children.\n // - If the space available is what is determines what overflows, focus is moved to the element that is in the (totalReferencesCount - overflowCount) position of the ReferenceList's children.\n else if (rootRef.current && referenceListRef.current) {\n const positionToFocus =\n maxVisibleReferences < totalReferencesCount - previousOverflow.current\n ? maxVisibleReferences\n : totalReferencesCount - previousOverflow.current;\n\n let currentElement: HTMLElement | null | undefined = findFirstFocusable(referenceListRef.current);\n for (let i = 0; i < positionToFocus && currentElement; i++) {\n currentElement = findNextFocusable(currentElement);\n }\n\n elementToFocus = currentElement;\n }\n\n // We focus on the element and reset the triggeredViaKeyboard flag after a timeout to ensure that this is pushed at the end of the event queue.\n setTimeout(() => {\n elementToFocus?.focus();\n triggeredViaKeyboard.current = false;\n }, 0);\n }\n }, [\n areReferencesExpanded,\n findFirstFocusable,\n findNextFocusable,\n isOverflowing,\n maxVisibleReferences,\n overflowCount,\n referenceListRef,\n setTimeout,\n totalReferencesCount,\n triggeredViaKeyboard,\n ]);\n\n const state: ReferenceOverflowButtonState = {\n designVersion,\n id: referenceOverflowButtonId,\n shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,\n\n components: {\n root: 'button',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref: useMergedRefs(rootRef, ref),\n ...props,\n }),\n {\n defaultProps: {\n children: processedText,\n },\n elementType: 'button',\n },\n ),\n };\n\n state.root.onKeyDown = mergeCallbacks(onKeyDown, props.onKeyDown);\n\n return state;\n};\n"],"names":["useReferenceOverflowButton_unstable","props","ref","children","setTimeout","id","text","designVersion","referenceListRef","useReferenceListContext_unstable","rootRef","totalReferencesCount","triggeredViaKeyboard","referenceOverflowButtonId","overflowCount","useOverflowMenu","areReferencesExpanded","maxVisibleReferences","useFocusFinders","React","ev","Enter","ctx","overflowButtonTriggeredViaKeyboard","isOverflowing","processedText","findFirstFocusable","onKeyDown","undefined","elementToFocus","current","currentElement","findNextFocusable","previousOverflow","i","positionToFocus","state","shouldRenderOverflowButton","components","slot","always","getIntrinsicElementProps","root","defaultProps","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA6BEA;;;eAAAA;;;;iEA7BqB;8BACM;iCAStB;gCACoB;sCACsB;+BAEhB;AAe/B,MAAAA,sCAAA,CAAAC,OAAAC;;UAKA,EAEAC,QAAOC,EAEPC,EAAA,EAEAC,IAAA,KACAL;UACAM,gBAAMC,IAAAA,+BAAmBC,EAAAA,MAAAA,aAAAA;UACzBC,UAAMC,OAAAA,MAAAA,CAAAA;UACN,CAAAP,WAAMQ,GAAAA,IAAAA,0BAAuBH;UAE7BI,4BAAuBC,IAAAA,sBAAa,EAAE,8BAAGC;UAEzCC,wBAAsBb,IAAAA,sDAAAA,EAAAA,CAAAA,MAAAA,IAAAA,qBAA6B;UAEnDc,uBAA0BR,IAAAA,sDAAwBS,EAAAA,CAAAA,MAAAA,IAAAA,oBAAAA;UAClDV,mBAAkBW,IAAAA,sDAChBC,EAAAA,CAAAA,MAAAA,IAAAA,gBAAAA;UACET,uBAAeU,IAAAA,sDAA2B,EAAAC,CAAAA,MAAAA,IAAAX,oBAAA;iCACxCC,IAAAA,sDAA+B,EAAAU,CAAAA,MAAAA,IAAAC,kCAAA;UACjC,EACFC,aACA,eAACZ,KAAqBG,IAAAA,gCAAA;UAGxBU,gBAAAtB,aAAA,QAAAA,aAAA,KAAA,IAAAA,WAAA,OAAAG,SAAA,aAAAA,KAAAQ,iBAAAR;UACA,EAEAoB,kBAAA,EACAP,iBAAgB,yCACd;UACAQ,YAAIV,OAAAA,WAAyBW,CAAAA,CAAAA;kBAC3B,KAAIC,mBAAAA,IAAAA,GAAAA,GAAAA,KAAAA,mBAAAA,EAAAA;iCAEJC,OAAA,GAAA;;;;KAEED;8IAC2Bf;6BAMpBJ,OAAQoB,MAAO,CAAA;oHAGhBb;oBAGN,CAAA;uHAC4D;qCAC1Dc,aAAiBC,qBAAkBD,OAAAA,EAAAA;;qFAGpBA;wCACnB;iCAEArB,QAAAoB,OAAA;iCACWA,OAAA,GAAAhB;uBACTe,QAAAA,OAAAA,IAAAA,iBAAAA,OAAAA,EAAAA;wCACAjB,uBAA+BD,uBAAAsB,iBAAAH,OAAA,GAAAb,uBAAAN,uBAAAsB,iBAAAH,OAAA;oBACjCC,iBAAGL,mBAAAlB,iBAAAsB,OAAA;gBACL,IAAA,IAAAI,IAAA,GAAAA,IAAAC,mBAAAJ,gBAAAG,IAAA;oBACCH,iBAAAC,kBAAAD;gBACDf;gBACAU,iBAAAA;;2JAEAF;uBACAP;gBACAH,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAAA,KAAAA;gBACAN,qBAAAA,OAAAA,GAAAA;eACAJ;;;;QAEAQ;QAAAA;QAAAA;QAAAA;QAAAA;QAAAA;QAAAA;QAAAA;QAAAA;KAAAA;UACDwB,QAAA;QAED7B;YACEA;oCACIM,iBAAAA;oBACJwB;kBAEAC;;cAEAC,qBAAA,CAAAC,MAAA,CAAAC,IAAAA,yCAAA,EAAA,UAAA;iBAEAC,IAAAA,8BAAWF,EAAM9B,SACf+B;oBACEvC;;0BAGF;0BACEyC;;yBAEA;;;UAIND,IAAA,CAAAf,SAAA,GAAAiB,IAAAA,+BAAA,EAAAjB,WAAA1B,MAAA0B,SAAA;WAEAS;GAGF,sDAAE"}
|
|
@@ -34,4 +34,4 @@ const referenceListContextDefaultValue = {
|
|
|
34
34
|
totalReferencesCount: 0
|
|
35
35
|
};
|
|
36
36
|
const ReferenceListContextProvider = ReferenceListContext.Provider;
|
|
37
|
-
const useReferenceListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(ReferenceListContext, (ctx = referenceListContextDefaultValue)=>selector(ctx));
|
|
37
|
+
const useReferenceListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(ReferenceListContext, (ctx = referenceListContextDefaultValue)=>selector(ctx)); //# sourceMappingURL=referenceListContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>) =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","createContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiBaA,oBAAAA;eAAAA;;IAaAC,4BAAAA;eAAAA;;IAEAC,gCAAAA;eAAAA;;;sCAhCqC;AAiB3C,MAAMF,uBAA2DG,IAAAA,mCAAAA,EAEtEC;AAEF,MAAMC,mCAA8D;
|
|
1
|
+
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>) =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","createContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiBaA,oBAAAA;eAAAA;;IAaAC,4BAAAA;eAAAA;;IAEAC,gCAAAA;eAAAA;;;sCAhCqC;AAiB3C,MAAMF,uBAA2DG,IAAAA,mCAAAA,EAEtEC;AAEF,MAAMC,mCAA8D;2BAClEC;0BACAC;wCACAC;iBAAsCC;;sBACtCC;iBAAoBD;;uBACpBE;0BACAC;AACF;AAEO,MAAMX,+BAA+BD,qBAAqBa,QAAQ;AAElE,MAAMX,mCAAmCY,CAAAA,WAC9CC,IAAAA,wCAAAA,EAAmBf,sBAAsB,CAACgB,MAAMX,gCAAgC,GAAKS,SAASE"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -142,3 +142,4 @@ const _contexts = require("./contexts");
|
|
|
142
142
|
/** @deprecated use useReferenceListStyles_unstable */ const useReferenceListV2Styles_unstable = _ReferenceList.useReferenceListStyles_unstable;
|
|
143
143
|
/** @deprecated use useReferenceList_unstable */ const useReferenceListV2_unstable = _ReferenceList.useReferenceList_unstable;
|
|
144
144
|
/** @deprecated use useReferenceCitationPreview */ const useReferenceCitationPreviewV2 = _utilities.useReferenceCitationPreview;
|
|
145
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["import type { ReferenceProps, ReferenceSlots, ReferenceState } from './Reference';\nimport {\n Reference,\n referenceClassNames,\n referenceExtraClassNames,\n renderReference_unstable,\n useReferenceStyles_unstable,\n useReference_unstable,\n} from './Reference';\nimport type {\n ReferenceListContextValues,\n ReferenceListProps,\n ReferenceListSlots,\n ReferenceListState,\n} from './ReferenceList';\nimport {\n ReferenceList,\n referenceListClassNames,\n renderReferenceList_unstable,\n useReferenceListStyles_unstable,\n useReferenceList_unstable,\n} from './ReferenceList';\nimport type {\n PackagedCitation,\n PackagedPreviewContentProps,\n PackagedReference,\n ReferenceCitationPreviewGenerator,\n ReferenceCitationPreviewGeneratorProps,\n UseReferenceCitationPreview,\n UseReferenceCitationPreviewProps,\n} from './utilities';\nimport { generateReferenceCitationPreview, useReferenceCitationPreview } from './utilities';\n\nexport type { CitationSlots, CitationProps, CitationState } from './Citation';\nexport {\n Citation,\n citationClassNames,\n renderCitation_unstable,\n useCitation_unstable,\n useCitationStyles_unstable,\n} from './Citation';\n\n/** @deprecated use ReferenceProps */\ntype ReferenceV2Props = ReferenceProps;\n/** @deprecated use ReferenceSlots */\ntype ReferenceV2Slots = ReferenceSlots;\n/** @deprecated use ReferenceState */\ntype ReferenceV2State = ReferenceState;\n\n/** @deprecated use Reference */\nconst ReferenceV2 = Reference;\n/** @deprecated use referenceClassNames */\nconst referenceV2ClassNames = referenceClassNames;\n/** @deprecated use referenceExtraClassNames */\nconst referenceV2ExtraClassNames = referenceExtraClassNames;\n/** @deprecated use renderReference_unstable */\nconst renderReferenceV2_unstable = renderReference_unstable;\n/** @deprecated use useReferenceStyles_unstable */\nconst useReferenceV2Styles_unstable = useReferenceStyles_unstable;\n/** @deprecated use useReference_unstable */\nconst useReferenceV2_unstable = useReference_unstable;\n\n// reference-v2 exports\nexport type { ReferenceProps, ReferenceV2Props, ReferenceSlots, ReferenceV2Slots, ReferenceState, ReferenceV2State };\nexport {\n Reference,\n ReferenceV2,\n referenceClassNames,\n referenceV2ClassNames,\n referenceExtraClassNames,\n referenceV2ExtraClassNames,\n renderReference_unstable,\n renderReferenceV2_unstable,\n useReferenceStyles_unstable,\n useReferenceV2Styles_unstable,\n useReference_unstable,\n useReferenceV2_unstable,\n};\n\n/** @deprecated use ReferenceListContextValues */\ntype ReferenceListV2ContextValues = ReferenceListContextValues;\n/** @deprecated use ReferenceListProps */\ntype ReferenceListV2Props = ReferenceListProps;\n/** @deprecated use ReferenceListSlots */\ntype ReferenceListV2Slots = ReferenceListSlots;\n/** @deprecated use ReferenceListState */\ntype ReferenceListV2State = ReferenceListState;\n\n/** @deprecated use ReferenceList */\nconst ReferenceListV2 = ReferenceList;\n/** @deprecated use referenceListClassNames */\nconst referenceListV2ClassNames = referenceListClassNames;\n/** @deprecated use renderReferenceList_unstable */\nconst renderReferenceListV2_unstable = renderReferenceList_unstable;\n/** @deprecated use useReferenceListStyles_unstable */\nconst useReferenceListV2Styles_unstable = useReferenceListStyles_unstable;\n/** @deprecated use useReferenceList_unstable */\nconst useReferenceListV2_unstable = useReferenceList_unstable;\n\nexport type {\n ReferenceListContextValues,\n ReferenceListV2ContextValues,\n ReferenceListProps,\n ReferenceListV2Props,\n ReferenceListSlots,\n ReferenceListV2Slots,\n ReferenceListState,\n ReferenceListV2State,\n};\nexport {\n ReferenceList,\n ReferenceListV2,\n referenceListClassNames,\n referenceListV2ClassNames,\n renderReferenceList_unstable,\n renderReferenceListV2_unstable,\n useReferenceListStyles_unstable,\n useReferenceListV2Styles_unstable,\n useReferenceList_unstable,\n useReferenceListV2_unstable,\n};\n\nexport type {\n ReferenceOverflowButtonProps,\n ReferenceOverflowButtonSlots,\n ReferenceOverflowButtonState,\n} from './ReferenceOverflowButton';\nexport {\n ReferenceOverflowButton,\n referenceOverflowButtonClassNames,\n renderReferenceOverflowButton_unstable,\n useReferenceOverflowButtonStyles_unstable,\n useReferenceOverflowButton_unstable,\n} from './ReferenceOverflowButton';\n\nexport type { ReferenceListContextValue } from './contexts';\nexport { ReferenceListContext, ReferenceListContextProvider, useReferenceListContext_unstable } from './contexts';\n\n/** @deprecated use PackagedCitation */\ntype PackagedCitationV2 = PackagedCitation;\n/** @deprecated use PackagedPreviewContentProps */\ntype PackagedPreviewContentV2Props = PackagedPreviewContentProps;\n/** @deprecated use PackagedReference */\ntype PackagedReferenceV2 = PackagedReference;\n/** @deprecated use UseReferenceCitationPreview */\ntype UseReferenceCitationPreviewV2 = UseReferenceCitationPreview;\n/** @deprecated use UseReferenceCitationPreviewProps */\ntype UseReferenceCitationPreviewV2Props = UseReferenceCitationPreviewProps;\n\n/** @deprecated use useReferenceCitationPreview */\nconst useReferenceCitationPreviewV2 = useReferenceCitationPreview;\n\nexport type {\n PackagedCitation,\n PackagedCitationV2,\n PackagedPreviewContentProps,\n PackagedPreviewContentV2Props,\n PackagedReference,\n PackagedReferenceV2,\n ReferenceCitationPreviewGenerator,\n ReferenceCitationPreviewGeneratorProps,\n UseReferenceCitationPreview,\n UseReferenceCitationPreviewV2,\n UseReferenceCitationPreviewProps,\n UseReferenceCitationPreviewV2Props,\n};\nexport { generateReferenceCitationPreview, useReferenceCitationPreview, useReferenceCitationPreviewV2 };\n"],"names":["Citation","
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["import type { ReferenceProps, ReferenceSlots, ReferenceState } from './Reference';\nimport {\n Reference,\n referenceClassNames,\n referenceExtraClassNames,\n renderReference_unstable,\n useReferenceStyles_unstable,\n useReference_unstable,\n} from './Reference';\nimport type {\n ReferenceListContextValues,\n ReferenceListProps,\n ReferenceListSlots,\n ReferenceListState,\n} from './ReferenceList';\nimport {\n ReferenceList,\n referenceListClassNames,\n renderReferenceList_unstable,\n useReferenceListStyles_unstable,\n useReferenceList_unstable,\n} from './ReferenceList';\nimport type {\n PackagedCitation,\n PackagedPreviewContentProps,\n PackagedReference,\n ReferenceCitationPreviewGenerator,\n ReferenceCitationPreviewGeneratorProps,\n UseReferenceCitationPreview,\n UseReferenceCitationPreviewProps,\n} from './utilities';\nimport { generateReferenceCitationPreview, useReferenceCitationPreview } from './utilities';\n\nexport type { CitationSlots, CitationProps, CitationState } from './Citation';\nexport {\n Citation,\n citationClassNames,\n renderCitation_unstable,\n useCitation_unstable,\n useCitationStyles_unstable,\n} from './Citation';\n\n/** @deprecated use ReferenceProps */\ntype ReferenceV2Props = ReferenceProps;\n/** @deprecated use ReferenceSlots */\ntype ReferenceV2Slots = ReferenceSlots;\n/** @deprecated use ReferenceState */\ntype ReferenceV2State = ReferenceState;\n\n/** @deprecated use Reference */\nconst ReferenceV2 = Reference;\n/** @deprecated use referenceClassNames */\nconst referenceV2ClassNames = referenceClassNames;\n/** @deprecated use referenceExtraClassNames */\nconst referenceV2ExtraClassNames = referenceExtraClassNames;\n/** @deprecated use renderReference_unstable */\nconst renderReferenceV2_unstable = renderReference_unstable;\n/** @deprecated use useReferenceStyles_unstable */\nconst useReferenceV2Styles_unstable = useReferenceStyles_unstable;\n/** @deprecated use useReference_unstable */\nconst useReferenceV2_unstable = useReference_unstable;\n\n// reference-v2 exports\nexport type { ReferenceProps, ReferenceV2Props, ReferenceSlots, ReferenceV2Slots, ReferenceState, ReferenceV2State };\nexport {\n Reference,\n ReferenceV2,\n referenceClassNames,\n referenceV2ClassNames,\n referenceExtraClassNames,\n referenceV2ExtraClassNames,\n renderReference_unstable,\n renderReferenceV2_unstable,\n useReferenceStyles_unstable,\n useReferenceV2Styles_unstable,\n useReference_unstable,\n useReferenceV2_unstable,\n};\n\n/** @deprecated use ReferenceListContextValues */\ntype ReferenceListV2ContextValues = ReferenceListContextValues;\n/** @deprecated use ReferenceListProps */\ntype ReferenceListV2Props = ReferenceListProps;\n/** @deprecated use ReferenceListSlots */\ntype ReferenceListV2Slots = ReferenceListSlots;\n/** @deprecated use ReferenceListState */\ntype ReferenceListV2State = ReferenceListState;\n\n/** @deprecated use ReferenceList */\nconst ReferenceListV2 = ReferenceList;\n/** @deprecated use referenceListClassNames */\nconst referenceListV2ClassNames = referenceListClassNames;\n/** @deprecated use renderReferenceList_unstable */\nconst renderReferenceListV2_unstable = renderReferenceList_unstable;\n/** @deprecated use useReferenceListStyles_unstable */\nconst useReferenceListV2Styles_unstable = useReferenceListStyles_unstable;\n/** @deprecated use useReferenceList_unstable */\nconst useReferenceListV2_unstable = useReferenceList_unstable;\n\nexport type {\n ReferenceListContextValues,\n ReferenceListV2ContextValues,\n ReferenceListProps,\n ReferenceListV2Props,\n ReferenceListSlots,\n ReferenceListV2Slots,\n ReferenceListState,\n ReferenceListV2State,\n};\nexport {\n ReferenceList,\n ReferenceListV2,\n referenceListClassNames,\n referenceListV2ClassNames,\n renderReferenceList_unstable,\n renderReferenceListV2_unstable,\n useReferenceListStyles_unstable,\n useReferenceListV2Styles_unstable,\n useReferenceList_unstable,\n useReferenceListV2_unstable,\n};\n\nexport type {\n ReferenceOverflowButtonProps,\n ReferenceOverflowButtonSlots,\n ReferenceOverflowButtonState,\n} from './ReferenceOverflowButton';\nexport {\n ReferenceOverflowButton,\n referenceOverflowButtonClassNames,\n renderReferenceOverflowButton_unstable,\n useReferenceOverflowButtonStyles_unstable,\n useReferenceOverflowButton_unstable,\n} from './ReferenceOverflowButton';\n\nexport type { ReferenceListContextValue } from './contexts';\nexport { ReferenceListContext, ReferenceListContextProvider, useReferenceListContext_unstable } from './contexts';\n\n/** @deprecated use PackagedCitation */\ntype PackagedCitationV2 = PackagedCitation;\n/** @deprecated use PackagedPreviewContentProps */\ntype PackagedPreviewContentV2Props = PackagedPreviewContentProps;\n/** @deprecated use PackagedReference */\ntype PackagedReferenceV2 = PackagedReference;\n/** @deprecated use UseReferenceCitationPreview */\ntype UseReferenceCitationPreviewV2 = UseReferenceCitationPreview;\n/** @deprecated use UseReferenceCitationPreviewProps */\ntype UseReferenceCitationPreviewV2Props = UseReferenceCitationPreviewProps;\n\n/** @deprecated use useReferenceCitationPreview */\nconst useReferenceCitationPreviewV2 = useReferenceCitationPreview;\n\nexport type {\n PackagedCitation,\n PackagedCitationV2,\n PackagedPreviewContentProps,\n PackagedPreviewContentV2Props,\n PackagedReference,\n PackagedReferenceV2,\n ReferenceCitationPreviewGenerator,\n ReferenceCitationPreviewGeneratorProps,\n UseReferenceCitationPreview,\n UseReferenceCitationPreviewV2,\n UseReferenceCitationPreviewProps,\n UseReferenceCitationPreviewV2Props,\n};\nexport { generateReferenceCitationPreview, useReferenceCitationPreview, useReferenceCitationPreviewV2 };\n"],"names":["Citation","ReferenceList","ReferenceListV2","citationClassNames","referenceListClassNames","referenceListV2ClassNames","renderReferenceList_unstable","renderReferenceListV2_unstable","renderCitation_unstable","useReferenceListStyles_unstable","useCitationStyles_unstable","useCitation_unstable","useReferenceListV2Styles_unstable","useReferenceList_unstable","useReferenceListV2_unstable","ReferenceV2","Reference","referenceV2ClassNames","referenceClassNames","referenceV2ExtraClassNames","referenceExtraClassNames","useReferenceV2_unstable","renderReferenceV2_unstable","renderReference_unstable","useReferenceV2Styles_unstable","useReferenceStyles_unstable","useReference_unstable","referenceOverflowButtonClassNames","ReferenceListContext","ReferenceListContextProvider","generateReferenceCitationPreview","useReferenceCitationPreview"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAmCEA,QAAQ;eAARA,kBAAQ;;IA2ERC,SAAAA;eAAAA,oBAAAA;;;;;;;;;;;;;;;;;IAAAA,WACAC;eADAD;;IA1EAE,kBAAkB;eAAlBA,4BAAkB;;;;;IA2ElBD,mBACAE;eADAF,8BACAE;;IACAC,wBACAC;eADAD,mCACAC;;;;;;;;;;;IAFAF,qBACAC;eADAD;;IAEAE,0BACAC;eADAD;;IA7EAE,uBAAuB;eAAvBA,iCAAuB;;;;;;;;;;;IA+EvBC,0BAAAA;eAAAA;;IADAF,wBACAE;eADAF,mCACAE;;IA7EAC,0BAA0B;eAA1BA,oCAA0B;;IAD1BC,oBAAoB;eAApBA,8BAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8EpBF,2BACAG;eADAH,sCACAG;;IAAAA,6BACAC;eADAD;;IAEAE,uBACA;eADAA;;IADAD,qBACAC;eADAD,gCACAC;;;2BA/GK;+BAaA;2BAUuE;0BASvE;;;AASP,8BAA8B,GAE9B,MAAAC,cAAAC,oBAAA;AAEA,wCAAA,GAEA,MAAAC,wBAAAC,8BACA;AACA,6CAAA,GAEA,MAAAC,6BAAAC,mCACMC;AAIN,6CAGEH,GAqBF,MAAAI,6BAAkCC,mCAC5BrB;AACN,gDACA,GACA,MAAAsB,gCAAAC,sCACMlB;AACN,0CAAA,GAEA,MAAAc,0BAAAK,gCACA;AA8BA,kCAEEC,GAOF,MAAAzB,kBAAS0B,4BAAsBC;AAa/B,4CAAA,GAiBA,MAAAxB,4BAASyB,sCAAkCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["generateReferenceCitationPreview.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../Citation';\nimport { Reference } from '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type ReferenceCitationPreviewGeneratorProps = {\n citationPreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type ReferenceCitationPreviewGenerator = (props: ReferenceCitationPreviewGeneratorProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\n/**\n * Function to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the function.\n * Props can either be passed in to the function or applied directly to the generated components in JSX.\n *\n * A `useReferenceCitationPreview` hook exists that calls this function and memoizes its return value based on the props.\n * You should use the hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const generateReferenceCitationPreview: ReferenceCitationPreviewGenerator = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n previewHeaderProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"above\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const ReferenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"above\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n {...previewHeaderProps}\n >\n {previewHeaderProps?.children ?? referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const components = {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\n };\n\n return components;\n};\n"],"names":["generateReferenceCitationPreview","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","onCitationCloseButtonClick","mergeCallbacks","onClick","createElement","Citation","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","previewHeaderProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","CitationWithPreview","Preview","closeOnScroll","positioning","size","trapFocus","withArrow","PreviewTrigger","PreviewSurface","PreviewContent","PreviewHeader","citation","aria-label","referenceHref","tabIndex","media","graphic","children","PreviewMetadata","icon","primaryText","secondaryText","tertiaryText","SensitivityLabel","content","ReferenceWithPreview","mergedReferenceProps","Reference","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
|
|
1
|
+
{"version":3,"sources":["generateReferenceCitationPreview.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../Citation';\nimport { Reference } from '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type ReferenceCitationPreviewGeneratorProps = {\n citationPreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type ReferenceCitationPreviewGenerator = (props: ReferenceCitationPreviewGeneratorProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\n/**\n * Function to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the function.\n * Props can either be passed in to the function or applied directly to the generated components in JSX.\n *\n * A `useReferenceCitationPreview` hook exists that calls this function and memoizes its return value based on the props.\n * You should use the hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const generateReferenceCitationPreview: ReferenceCitationPreviewGenerator = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n previewHeaderProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"above\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const ReferenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"above\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n {...previewHeaderProps}\n >\n {previewHeaderProps?.children ?? referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const components = {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\n };\n\n return components;\n};\n"],"names":["CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","createElement","Citation","onCitationCloseButtonClick","onClick","citationPreviewProps","citationPreviewSurfaceProps","CitationWithPreview","previewContentProps","closeOnScroll","positioning","trapFocus","withArrow","props","index","Preview","citation","aria-label","tabIndex","referenceProps","children","primaryText","secondaryText","PreviewHeader","tertiaryText","sensitivityLabelProps","referenceHref","ReferenceWithPreview","PreviewMetadata","icon","previewHeaderProps","referencePreviewProps","_previewContentProps_content","media","PreviewSurface","referencePreviewSurfaceProps","PreviewContent","Reference","_previewHeaderProps_children","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport {\n generateReferenceCitationPreview,\n type ReferenceCitationPreviewGenerator,\n type ReferenceCitationPreviewGeneratorProps,\n} from './generateReferenceCitationPreview';\n\nexport type UseReferenceCitationPreviewProps = ReferenceCitationPreviewGeneratorProps;\n\nexport type UseReferenceCitationPreview = ReferenceCitationPreviewGenerator;\n\n/**\n * Hook to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the hook.\n * Props can either be passed in to the hook or applied directly to the generated components in JSX.\n *\n * This hook internally calls the `generateReferenceCitationPreview` function and memoizes its return value based on the props.\n * You should only use this hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n return React.useMemo(() => generateReferenceCitationPreview(props), [props]);\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport {\n generateReferenceCitationPreview,\n type ReferenceCitationPreviewGenerator,\n type ReferenceCitationPreviewGeneratorProps,\n} from './generateReferenceCitationPreview';\n\nexport type UseReferenceCitationPreviewProps = ReferenceCitationPreviewGeneratorProps;\n\nexport type UseReferenceCitationPreview = ReferenceCitationPreviewGenerator;\n\n/**\n * Hook to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the hook.\n * Props can either be passed in to the hook or applied directly to the generated components in JSX.\n *\n * This hook internally calls the `generateReferenceCitationPreview` function and memoizes its return value based on the props.\n * You should only use this hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n return React.useMemo(() => generateReferenceCitationPreview(props), [props]);\n};\n"],"names":["React","generateReferenceCitationPreview","props"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BA4BSA;;;eAAAA;;;;iEA5BT;kDASO;AAmBL,MAAOA,8BAAoBC,CAAAA;WAA0CC,OAAAA,OAAAA,CAAAA,IAAAA,IAAAA,kEAAAA,EAAAA,QAAAA;QAAAA;KAAAA;GACvE,uDAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20250710-0405-e728c4d6.1",
|
|
4
4
|
"description": "Fluent AI controls for citations and references",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/react-preview": "0.0.0-nightly-
|
|
16
|
-
"@fluentui-copilot/react-provider": "0.0.0-nightly-
|
|
17
|
-
"@fluentui-copilot/react-sensitivity-label": "0.0.0-nightly-
|
|
18
|
-
"@fluentui-copilot/react-utilities": "0.0.0-nightly-
|
|
19
|
-
"@fluentui-copilot/tokens": "0.0.0-nightly-
|
|
15
|
+
"@fluentui-copilot/react-preview": "0.0.0-nightly-20250710-0405-e728c4d6.1",
|
|
16
|
+
"@fluentui-copilot/react-provider": "0.0.0-nightly-20250710-0405-e728c4d6.1",
|
|
17
|
+
"@fluentui-copilot/react-sensitivity-label": "0.0.0-nightly-20250710-0405-e728c4d6.1",
|
|
18
|
+
"@fluentui-copilot/react-utilities": "0.0.0-nightly-20250710-0405-e728c4d6.1",
|
|
19
|
+
"@fluentui-copilot/tokens": "0.0.0-nightly-20250710-0405-e728c4d6.1",
|
|
20
20
|
"@swc/helpers": "^0.5.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@fluentui/react-components';
|
|
2
|
-
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
-
export const citationClassNames = {
|
|
4
|
-
root: 'fai-Citation'
|
|
5
|
-
};
|
|
6
|
-
const useCitationBaseClassName = makeResetStyles({
|
|
7
|
-
display: 'inline-flex',
|
|
8
|
-
justifyContent: 'center',
|
|
9
|
-
boxSizing: 'border-box',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
cursor: 'pointer',
|
|
12
|
-
...typographyStyles.caption2Strong,
|
|
13
|
-
backgroundColor: tokens.colorNeutralBackground3,
|
|
14
|
-
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,
|
|
15
|
-
color: tokens.colorNeutralForeground2,
|
|
16
|
-
minWidth: '14px',
|
|
17
|
-
height: '14px',
|
|
18
|
-
verticalAlign: `calc((${typographyStyles.caption2Strong.lineHeight} - ${typographyStyles.caption2Strong.fontSize}) / 2)`,
|
|
19
|
-
paddingInline: tokens.spacingHorizontalXXS,
|
|
20
|
-
borderRadius: tokens.borderRadiusMedium,
|
|
21
|
-
textDecoration: 'none',
|
|
22
|
-
marginLeft: tokens.spacingHorizontalXXS,
|
|
23
|
-
marginRight: tokens.spacingHorizontalXXS,
|
|
24
|
-
':hover': {
|
|
25
|
-
cursor: 'pointer',
|
|
26
|
-
color: tokens.colorBrandForeground2Hover,
|
|
27
|
-
borderColor: tokens.colorBrandStroke2Hover,
|
|
28
|
-
backgroundColor: tokens.colorBrandBackground2Hover
|
|
29
|
-
},
|
|
30
|
-
':hover:active': {
|
|
31
|
-
cursor: 'pointer',
|
|
32
|
-
color: tokens.colorBrandForeground2Pressed,
|
|
33
|
-
borderColor: tokens.colorBrandStroke2Pressed,
|
|
34
|
-
backgroundColor: tokens.colorBrandBackground2Pressed
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const useCitationRootStyles = makeStyles({
|
|
38
|
-
isBlock: {
|
|
39
|
-
display: 'flex',
|
|
40
|
-
marginLeft: 0,
|
|
41
|
-
marginRight: 0
|
|
42
|
-
},
|
|
43
|
-
isPopoverLocked: {
|
|
44
|
-
color: tokens.colorBrandForeground2Pressed,
|
|
45
|
-
...shorthands.borderColor(tokens.colorBrandStroke2Pressed),
|
|
46
|
-
backgroundColor: tokens.colorBrandBackground2,
|
|
47
|
-
':hover': {
|
|
48
|
-
color: tokens.colorBrandForeground2Pressed,
|
|
49
|
-
...shorthands.borderColor(tokens.colorBrandStroke2Pressed),
|
|
50
|
-
backgroundColor: tokens.colorBrandBackground2
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
const useNextStyles = makeStyles({
|
|
55
|
-
root: {
|
|
56
|
-
borderRadius: tokens.borderRadiusXLarge
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
/**
|
|
60
|
-
* Apply styling to the Citation slots based on the state
|
|
61
|
-
*/ export const useCitationStyles_unstable = (state)=>{
|
|
62
|
-
'use no memo';
|
|
63
|
-
const { designVersion } = state;
|
|
64
|
-
const rootBaseClassName = useCitationBaseClassName();
|
|
65
|
-
const rootStyles = useCitationRootStyles();
|
|
66
|
-
const nextStyles = useNextStyles();
|
|
67
|
-
state.root.className = mergeClasses(citationClassNames.root, state.isPopoverLocked && rootStyles.isPopoverLocked, state.block && rootStyles.isBlock, rootBaseClassName, designVersion === 'next' && nextStyles.root, state.root.className);
|
|
68
|
-
return state;
|
|
69
|
-
};
|