@fluentui-copilot/react-reference 0.11.0 → 0.11.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 +22 -1
- package/CHANGELOG.md +12 -2
- package/dist/index.d.ts +219 -0
- package/lib/Citation.js.map +1 -1
- package/lib/Reference.js.map +1 -1
- package/lib/ReferenceGroupToggle.js.map +1 -1
- package/lib/ReferenceList.js.map +1 -1
- package/lib/ReferenceListV2.js +2 -0
- package/lib/ReferenceListV2.js.map +1 -0
- package/lib/ReferenceOverflowButton.js +2 -0
- package/lib/ReferenceOverflowButton.js.map +1 -0
- package/lib/ReferenceV2.js +2 -0
- package/lib/ReferenceV2.js.map +1 -0
- package/lib/components/Citation/Citation.js.map +1 -1
- package/lib/components/Citation/Citation.types.js +3 -1
- package/lib/components/Citation/Citation.types.js.map +1 -1
- package/lib/components/Citation/index.js.map +1 -1
- package/lib/components/Citation/renderCitation.js.map +1 -1
- package/lib/components/Citation/useCitation.js.map +1 -1
- package/lib/components/Citation/useCitationStyles.js.map +1 -1
- package/lib/components/Reference/Reference.js.map +1 -1
- package/lib/components/Reference/Reference.types.js +3 -1
- package/lib/components/Reference/Reference.types.js.map +1 -1
- package/lib/components/Reference/index.js.map +1 -1
- package/lib/components/Reference/renderReference.js.map +1 -1
- package/lib/components/Reference/useReference.js +1 -1
- package/lib/components/Reference/useReference.js.map +1 -1
- package/lib/components/Reference/useReferenceStyles.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js +3 -1
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/index.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/renderReferenceGroupToggle.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggle.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.js.map +1 -1
- package/lib/components/ReferenceList/ReferenceList.js.map +1 -1
- package/lib/components/ReferenceList/ReferenceList.types.js +3 -1
- package/lib/components/ReferenceList/ReferenceList.types.js.map +1 -1
- package/lib/components/ReferenceList/index.js.map +1 -1
- package/lib/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib/components/ReferenceList/useReferenceList.js.map +1 -1
- package/lib/components/ReferenceList/useReferenceListStyles.js.map +1 -1
- package/lib/components/reference-v2/Reference/Reference.js +11 -0
- package/lib/components/reference-v2/Reference/Reference.js.map +1 -0
- package/lib/components/reference-v2/Reference/Reference.types.js +2 -0
- package/lib/components/reference-v2/Reference/Reference.types.js.map +1 -0
- package/lib/components/reference-v2/Reference/index.js +6 -0
- package/lib/components/reference-v2/Reference/index.js.map +1 -0
- package/lib/components/reference-v2/Reference/renderReference.js +19 -0
- package/lib/components/reference-v2/Reference/renderReference.js.map +1 -0
- package/lib/components/reference-v2/Reference/useReference.js +72 -0
- package/lib/components/reference-v2/Reference/useReference.js.map +1 -0
- package/lib/components/reference-v2/Reference/useReferenceStyles.js +71 -0
- package/lib/components/reference-v2/Reference/useReferenceStyles.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.js +13 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js +2 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/index.js +6 -0
- package/lib/components/reference-v2/ReferenceList/index.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/renderReferenceList.js +18 -0
- package/lib/components/reference-v2/ReferenceList/renderReferenceList.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceList.js +94 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceList.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListContextValues.js +21 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.js +39 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +12 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +4 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/index.js +6 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/index.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +10 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +91 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js +35 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js.map +1 -0
- package/lib/components/reference-v2/index.js +4 -0
- package/lib/components/reference-v2/index.js.map +1 -0
- package/lib/{context → contexts}/ReferenceGroupContext.js.map +1 -1
- package/lib/contexts/reference-v2/index.js +2 -0
- package/lib/contexts/reference-v2/index.js.map +1 -0
- package/lib/contexts/reference-v2/referenceListContext.js +16 -0
- package/lib/contexts/reference-v2/referenceListContext.js.map +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/reference-v2/index.js +2 -0
- package/lib/hooks/reference-v2/index.js.map +1 -0
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js +120 -0
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -0
- package/lib/hooks/useReferenceCitationPreview.js.map +1 -1
- package/lib/hooks/useReferenceGroup.js.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Citation.js.map +1 -1
- package/lib-commonjs/Reference.js.map +1 -1
- package/lib-commonjs/ReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/ReferenceList.js.map +1 -1
- package/lib-commonjs/ReferenceListV2.js +7 -0
- package/lib-commonjs/ReferenceListV2.js.map +1 -0
- package/lib-commonjs/ReferenceOverflowButton.js +7 -0
- package/lib-commonjs/ReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/ReferenceV2.js +7 -0
- package/lib-commonjs/ReferenceV2.js.map +1 -0
- package/lib-commonjs/components/Citation/Citation.js.map +1 -1
- package/lib-commonjs/components/Citation/Citation.types.js +3 -1
- package/lib-commonjs/components/Citation/Citation.types.js.map +1 -1
- package/lib-commonjs/components/Citation/index.js.map +1 -1
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitationStyles.js.map +1 -1
- package/lib-commonjs/components/Reference/Reference.js.map +1 -1
- package/lib-commonjs/components/Reference/Reference.types.js +3 -1
- package/lib-commonjs/components/Reference/Reference.types.js.map +1 -1
- package/lib-commonjs/components/Reference/index.js.map +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/Reference/useReferenceStyles.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js +3 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/index.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/renderReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js +3 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/index.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.js +21 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js +5 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/index.js +28 -0
- package/lib-commonjs/components/reference-v2/Reference/index.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js +32 -0
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/useReference.js +67 -0
- package/lib-commonjs/components/reference-v2/Reference/useReference.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.js +122 -0
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js +23 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js +5 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/index.js +11 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/index.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js +28 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js +93 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js +24 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.js +55 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +21 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +7 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/index.js +11 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/index.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +16 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +84 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js +65 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js.map +1 -0
- package/lib-commonjs/components/reference-v2/index.js +9 -0
- package/lib-commonjs/components/reference-v2/index.js.map +1 -0
- package/lib-commonjs/contexts/ReferenceGroupContext.js.map +1 -0
- package/lib-commonjs/contexts/reference-v2/index.js +7 -0
- package/lib-commonjs/contexts/reference-v2/index.js.map +1 -0
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js +36 -0
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js.map +1 -0
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/reference-v2/index.js +7 -0
- package/lib-commonjs/hooks/reference-v2/index.js.map +1 -0
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js +148 -0
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -0
- package/lib-commonjs/hooks/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/hooks/useReferenceGroup.js.map +1 -1
- package/lib-commonjs/index.js +95 -30
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +11 -11
- package/lib-commonjs/context/ReferenceGroupContext.js.map +0 -1
- /package/lib/{context → contexts}/ReferenceGroupContext.js +0 -0
- /package/lib-commonjs/{context → contexts}/ReferenceGroupContext.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport {\n Caption1,\n assertSlots,\n mergeCallbacks,\n slot,\n useId,\n usePopoverContext_unstable,\n} from '@fluentui/react-components';\nimport type { Slot } 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 { PreviewProps, PreviewSurfaceProps } 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\n/**\n * Props for a \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> &\n Partial<Pick<CitationProps, 'referenceHref'>>;\n\n/**\n * A \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitation = React.FC<PackagedCitationProps>;\n\ntype PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';\n\n/**\n * Props for a \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> &\n Partial<Pick<ReferenceProps, PartialReferenceProps>>;\n\n/**\n * A \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReference = React.FC<PackagedReferenceProps>;\n\n/**\n * Data used to package a `Citation` and `Reference` together with\n * the `useReferenceCitation` hook.\n */\nexport type ReferenceCitationData = {\n index: number;\n referenceId?: string;\n citationId?: string;\n citationProps?: PackagedCitationProps;\n referenceProps?: PackagedReferenceProps;\n previewProps?: PreviewProps;\n previewSurfaceProps?: PreviewSurfaceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (data: ReferenceCitationData) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\ntype PreviewExtraSlots = {\n content: Slot<'div'>;\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 * Hook to package a `Citation` and `Reference` together in an\n * accessibly by default manner.\n *\n * When using citations and references, prefer using them via this\n * hook to ensure props are wired up correctly.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = ({\n index,\n referenceId: propsRefId,\n citationId: propsCiteId,\n citationProps,\n referenceProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n}) => {\n const refId = useId();\n const citeId = useId();\n\n const referenceId = propsRefId ?? refId;\n const citationId = propsCiteId ?? citeId;\n\n const components = React.useMemo(() => {\n const citationHref = `#${citationId}`;\n\n const PackagedReference: PackagedReference = props => {\n const referenceIndex = props.index ?? referenceProps?.index ?? index;\n\n return (\n <Reference\n {...referenceProps}\n index={referenceIndex}\n referenceId={referenceId}\n citationHref={citationHref}\n {...props}\n />\n );\n };\n\n const CitationWithPreview: PackagedCitation = props => {\n // We assert content as a slot to use it with its resolved props object and the correct defaults below.\n const content = slot.always(referenceProps ? referenceProps.content : undefined, {\n defaultProps: {\n children: referenceProps?.excerpt && <Caption1>{referenceProps.excerpt}</Caption1>,\n },\n elementType: 'div',\n });\n const citationWithPreviewState = {\n components: {\n content: 'div',\n },\n content,\n };\n assertSlots<PreviewExtraSlots>(citationWithPreviewState);\n\n // We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.\n const sensitivity = slot.optional(referenceProps?.sensitivity, { elementType: 'span' });\n const title = slot.optional(referenceProps?.label, { elementType: 'div' });\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...previewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} id={citationId} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...previewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media}\n >\n {title?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={referenceProps?.icon}\n primaryText={referenceProps?.primaryText}\n secondaryText={referenceProps?.secondaryText}\n tertiaryText={referenceProps?.tertiaryText}\n />\n {sensitivity && (\n <SensitivityLabel description={sensitivityLabelProps?.description ?? ''}>\n {sensitivity.children}\n </SensitivityLabel>\n )}\n <citationWithPreviewState.content />\n {previewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: PackagedReference,\n };\n }, [\n index,\n referenceId,\n citationId,\n referenceProps,\n citationProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","Caption1","assertSlots","mergeCallbacks","slot","useId","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","index","referenceId","propsRefId","citationId","propsCiteId","citationProps","referenceProps","previewProps","previewSurfaceProps","sensitivityLabelProps","refId","citeId","components","useMemo","citationHref","PackagedReference","props","referenceIndex","CitationWithPreview","content","always","undefined","defaultProps","children","excerpt","elementType","citationWithPreviewState","sensitivity","optional","title","label","closeOnScroll","positioning","size","trapFocus","withArrow","id","citation","aria-label","referenceHref","tabIndex","media","icon","primaryText","secondaryText","tertiaryText","description"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAC/B,SACEC,QAAQ,EACRC,WAAW,EACXC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,0BAA0B,QACrB,6BAA6B;AAGpC,SACEC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,cAAc,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;oCAC5CC,YAAY,EAAEvC,2BAAAA,qCAAAA,eAAgBuC,YAAY;;gCAE3ClB,6BACC,KAAC1C;oCAAiB6D,aAAarC,CAAAA,qCAAAA,kCAAAA,4CAAAA,sBAAuBqC,WAAW,cAAlCrC,gDAAAA,qCAAsC;8CAClEkB,YAAYJ,QAAQ;;8CAGzB,KAACG,yBAAyBP,OAAO;gCAChCZ,yBAAAA,mCAAAA,aAAcgB,QAAQ;;;;;;QAKjC;QAEA,OAAO;YACLrC,UAAUgC;YACV/B,WAAW4B;QACb;IACF,GAAG;QACDf;QACAC;QACAE;QACAG;QACAD;QACAE;QACAC;QACAC;KACD;IAED,OAAOG;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport {\n Caption1,\n assertSlots,\n mergeCallbacks,\n slot,\n useId,\n usePopoverContext_unstable,\n} from '@fluentui/react-components';\nimport type { Slot } 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 { PreviewProps, PreviewSurfaceProps } 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\n/**\n * Props for a \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> &\n Partial<Pick<CitationProps, 'referenceHref'>>;\n\n/**\n * A \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitation = React.FC<PackagedCitationProps>;\n\ntype PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';\n\n/**\n * Props for a \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> &\n Partial<Pick<ReferenceProps, PartialReferenceProps>>;\n\n/**\n * A \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReference = React.FC<PackagedReferenceProps>;\n\n/**\n * Data used to package a `Citation` and `Reference` together with\n * the `useReferenceCitation` hook.\n */\nexport type ReferenceCitationData = {\n index: number;\n referenceId?: string;\n citationId?: string;\n citationProps?: PackagedCitationProps;\n referenceProps?: PackagedReferenceProps;\n previewProps?: PreviewProps;\n previewSurfaceProps?: PreviewSurfaceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (data: ReferenceCitationData) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\ntype PreviewExtraSlots = {\n content: Slot<'div'>;\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 * Hook to package a `Citation` and `Reference` together in an\n * accessibly by default manner.\n *\n * When using citations and references, prefer using them via this\n * hook to ensure props are wired up correctly.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = ({\n index,\n referenceId: propsRefId,\n citationId: propsCiteId,\n citationProps,\n referenceProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n}) => {\n const refId = useId();\n const citeId = useId();\n\n const referenceId = propsRefId ?? refId;\n const citationId = propsCiteId ?? citeId;\n\n const components = React.useMemo(() => {\n const citationHref = `#${citationId}`;\n\n const PackagedReference: PackagedReference = props => {\n const referenceIndex = props.index ?? referenceProps?.index ?? index;\n\n return (\n <Reference\n {...referenceProps}\n index={referenceIndex}\n referenceId={referenceId}\n citationHref={citationHref}\n {...props}\n />\n );\n };\n\n const CitationWithPreview: PackagedCitation = props => {\n // We assert content as a slot to use it with its resolved props object and the correct defaults below.\n const content = slot.always(referenceProps ? referenceProps.content : undefined, {\n defaultProps: {\n children: referenceProps?.excerpt && <Caption1>{referenceProps.excerpt}</Caption1>,\n },\n elementType: 'div',\n });\n const citationWithPreviewState = {\n components: {\n content: 'div',\n },\n content,\n };\n assertSlots<PreviewExtraSlots>(citationWithPreviewState);\n\n // We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.\n const sensitivity = slot.optional(referenceProps?.sensitivity, { elementType: 'span' });\n const title = slot.optional(referenceProps?.label, { elementType: 'div' });\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...previewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} id={citationId} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...previewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media}\n >\n {title?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={referenceProps?.icon}\n primaryText={referenceProps?.primaryText}\n secondaryText={referenceProps?.secondaryText}\n tertiaryText={referenceProps?.tertiaryText}\n />\n {sensitivity && (\n <SensitivityLabel description={sensitivityLabelProps?.description ?? ''}>\n {sensitivity.children}\n </SensitivityLabel>\n )}\n <citationWithPreviewState.content />\n {previewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: PackagedReference,\n };\n }, [\n index,\n referenceId,\n citationId,\n referenceProps,\n citationProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","Caption1","assertSlots","mergeCallbacks","slot","useId","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","index","referenceId","propsRefId","citationId","propsCiteId","citationProps","referenceProps","previewProps","previewSurfaceProps","sensitivityLabelProps","refId","citeId","components","useMemo","citationHref","PackagedReference","props","referenceIndex","CitationWithPreview","content","always","undefined","defaultProps","children","excerpt","elementType","citationWithPreviewState","sensitivity","optional","title","label","closeOnScroll","positioning","size","trapFocus","withArrow","id","citation","aria-label","referenceHref","tabIndex","media","icon","primaryText","secondaryText","tertiaryText","description"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAC/B,SACEC,QAAQ,EACRC,WAAW,EACXC,cAAc,EACdC,IAAI,EACJC,KAAK,EACLC,0BAA0B,QACrB,6BAA6B;AAGpC,SACEC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,cAAc,QACT,kCAAkC;AACzC,SAASC,gBAAgB,QAAQ,4CAA4C;AAI7E,SAASC,QAAQ,QAAQ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KAAC1C;oCAAiB6D,aAAarC,CAAAA,qCAAAA,kCAAAA,4CAAAA,sBAAuBqC,WAAW,cAAlCrC,gDAAAA,qCAAsC;8CAClEkB,YAAYJ,QAAQ;;8CAGzB,KAACG,yBAAyBP,OAAO;gCAChCZ,yBAAAA,mCAAAA,aAAcgB,QAAQ;;;;;;QAKjC;QAEA,OAAO;YACLrC,UAAUgC;YACV/B,WAAW4B;QACb;IACF,GAAG;QACDf;QACAC;QACAE;QACAG;QACAD;QACAE;QACAC;QACAC;KACD;IAED,OAAOG;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport { makeStyles, useId } from '@fluentui/react-components';\nimport type { ReferenceListProps } from '../ReferenceList';\nimport type { ReferenceGroupToggleProps } from '../ReferenceGroupToggle';\n\nexport type UseReferenceGroupProps = { referenceListId?: string };\nexport type UseReferenceGroup = (props: UseReferenceGroupProps) => {\n referenceGroupToggleProps: ReferenceGroupToggleProps;\n referenceListProps: ReferenceListProps;\n};\n\nconst useStyles = makeStyles({\n hidden: {\n display: 'none',\n },\n});\n\n/**\n * Hook to package a `ReferenceGroupToggle` and `ReferenceList` together and\n * maintain their `isOpen` state.\n *\n * When rendering a group of references, prefer to use this hook\n * hook to ensure state is maintained correctly\n */\nexport const useReferenceGroup: UseReferenceGroup = props => {\n const [isOpen, setIsOpen] = React.useState(false);\n const styles = useStyles();\n const referenceListId = useId('reference-list', props.referenceListId);\n\n return React.useMemo(() => {\n const handleClick = () => {\n setIsOpen(isOpen => !isOpen);\n };\n\n const referenceGroupToggleProps = {\n 'aria-controls': referenceListId,\n isOpen,\n onClick: handleClick,\n };\n\n const referenceListProps = {\n className: isOpen ? undefined : styles.hidden,\n id: referenceListId,\n };\n\n return { referenceGroupToggleProps, referenceListProps };\n }, [isOpen, referenceListId, styles.hidden]);\n};\n"],"names":["React","makeStyles","useId","useStyles","hidden","display","useReferenceGroup","props","isOpen","setIsOpen","useState","styles","referenceListId","useMemo","handleClick","referenceGroupToggleProps","onClick","referenceListProps","className","undefined","id"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,UAAU,EAAEC,KAAK,QAAQ,6BAA6B;AAU/D,MAAMC,YAAYF,WAAW;IAC3BG,QAAQ;QACNC,SAAS;IACX;AACF;AAEA;;;;;;CAMC,GACD,OAAO,MAAMC,oBAAuCC,CAAAA;IAClD,MAAM,CAACC,QAAQC,UAAU,GAAGT,MAAMU,QAAQ,CAAC;IAC3C,MAAMC,SAASR;IACf,MAAMS,kBAAkBV,MAAM,kBAAkBK,MAAMK,eAAe;IAErE,OAAOZ,MAAMa,OAAO,CAAC;QACnB,MAAMC,cAAc;YAClBL,UAAUD,CAAAA,SAAU,CAACA;QACvB;QAEA,MAAMO,4BAA4B;YAChC,iBAAiBH;YACjBJ;YACAQ,SAASF;QACX;QAEA,MAAMG,qBAAqB;YACzBC,WAAWV,SAASW,YAAYR,OAAOP,MAAM;YAC7CgB,IAAIR;QACN;QAEA,OAAO;YAAEG;YAA2BE;QAAmB;IACzD,GAAG;QAACT;QAAQI;QAAiBD,OAAOP,MAAM;KAAC;AAC7C,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useReferenceGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport { makeStyles, useId } from '@fluentui/react-components';\nimport type { ReferenceListProps } from '../ReferenceList';\nimport type { ReferenceGroupToggleProps } from '../ReferenceGroupToggle';\n\nexport type UseReferenceGroupProps = { referenceListId?: string };\nexport type UseReferenceGroup = (props: UseReferenceGroupProps) => {\n referenceGroupToggleProps: ReferenceGroupToggleProps;\n referenceListProps: ReferenceListProps;\n};\n\nconst useStyles = makeStyles({\n hidden: {\n display: 'none',\n },\n});\n\n/**\n * Hook to package a `ReferenceGroupToggle` and `ReferenceList` together and\n * maintain their `isOpen` state.\n *\n * When rendering a group of references, prefer to use this hook\n * hook to ensure state is maintained correctly\n */\nexport const useReferenceGroup: UseReferenceGroup = props => {\n const [isOpen, setIsOpen] = React.useState(false);\n const styles = useStyles();\n const referenceListId = useId('reference-list', props.referenceListId);\n\n return React.useMemo(() => {\n const handleClick = () => {\n setIsOpen(isOpen => !isOpen);\n };\n\n const referenceGroupToggleProps = {\n 'aria-controls': referenceListId,\n isOpen,\n onClick: handleClick,\n };\n\n const referenceListProps = {\n className: isOpen ? undefined : styles.hidden,\n id: referenceListId,\n };\n\n return { referenceGroupToggleProps, referenceListProps };\n }, [isOpen, referenceListId, styles.hidden]);\n};\n"],"names":["React","makeStyles","useId","useStyles","hidden","display","useReferenceGroup","props","isOpen","setIsOpen","useState","styles","referenceListId","useMemo","handleClick","referenceGroupToggleProps","onClick","referenceListProps","className","undefined","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,UAAU,EAAEC,KAAK,QAAQ,6BAA6B;AAU/D,MAAMC,YAAYF,WAAW;IAC3BG,QAAQ;QACNC,SAAS;IACX;AACF;AAEA;;;;;;CAMC,GACD,OAAO,MAAMC,oBAAuCC,CAAAA;IAClD,MAAM,CAACC,QAAQC,UAAU,GAAGT,MAAMU,QAAQ,CAAC;IAC3C,MAAMC,SAASR;IACf,MAAMS,kBAAkBV,MAAM,kBAAkBK,MAAMK,eAAe;IAErE,OAAOZ,MAAMa,OAAO,CAAC;QACnB,MAAMC,cAAc;YAClBL,UAAUD,CAAAA,SAAU,CAACA;QACvB;QAEA,MAAMO,4BAA4B;YAChC,iBAAiBH;YACjBJ;YACAQ,SAASF;QACX;QAEA,MAAMG,qBAAqB;YACzBC,WAAWV,SAASW,YAAYR,OAAOP,MAAM;YAC7CgB,IAAIR;QACN;QAEA,OAAO;YAAEG;YAA2BE;QAAmB;IACzD,GAAG;QAACT;QAAQI;QAAiBD,OAAOP,MAAM;KAAC;AAC7C,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -3,4 +3,9 @@ export { Reference, referenceClassNames, renderReference_unstable, useReference_
|
|
|
3
3
|
export { useReferenceCitationPreview, useReferenceGroup } from './hooks';
|
|
4
4
|
export { ReferenceList, referenceListClassNames, useReferenceList_unstable, useReferenceListStyles_unstable, renderReferenceList_unstable } from './ReferenceList';
|
|
5
5
|
export { ReferenceGroupToggle, referenceGroupToggleClassNames, renderReferenceGroupToggle_unstable, useReferenceGroupToggleStyles_unstable, useReferenceGroupToggle_unstable } from './ReferenceGroupToggle';
|
|
6
|
+
export { Reference as ReferenceV2, referenceClassNames as referenceV2ClassNames, referenceExtraClassNames as referenceV2ExtraClassNames, renderReference_unstable as renderReferenceV2_unstable, useReferenceStyles_unstable as useReferenceStylesV2_unstable, useReference_unstable as useReferenceV2_unstable } from './ReferenceV2';
|
|
7
|
+
export { ReferenceList as ReferenceListV2, referenceListClassNames as referenceListV2ClassNames, renderReferenceList_unstable as renderReferenceListV2_unstable, useReferenceListStyles_unstable as useReferenceListStylesV2_unstable, useReferenceList_unstable as useReferenceListV2_unstable } from './ReferenceListV2';
|
|
8
|
+
export { ReferenceOverflowButton, referenceOverflowButtonClassNames, renderReferenceOverflowButton_unstable, useReferenceOverflowButtonStyles_unstable, useReferenceOverflowButton_unstable } from './ReferenceOverflowButton';
|
|
9
|
+
export { ReferenceListContext, ReferenceListContextProvider, useReferenceListContext_unstable } from './contexts/reference-v2';
|
|
10
|
+
export { useReferenceCitationPreview as useReferenceCitationPreviewV2 } from './hooks/reference-v2';
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n Citation,\n citationClassNames,\n renderCitation_unstable,\n useCitation_unstable,\n useCitationStyles_unstable,\n} from './Citation';\nexport {\n Reference,\n referenceClassNames,\n renderReference_unstable,\n useReference_unstable,\n useReferenceStyles_unstable,\n} from './Reference';\nexport { useReferenceCitationPreview, useReferenceGroup } from './hooks';\nexport {\n ReferenceList,\n referenceListClassNames,\n useReferenceList_unstable,\n useReferenceListStyles_unstable,\n renderReferenceList_unstable,\n} from './ReferenceList';\nexport {\n ReferenceGroupToggle,\n referenceGroupToggleClassNames,\n renderReferenceGroupToggle_unstable,\n useReferenceGroupToggleStyles_unstable,\n useReferenceGroupToggle_unstable,\n} from './ReferenceGroupToggle';\n\n// Types\n\nexport type { CitationSlots, CitationProps, CitationState } from './Citation';\nexport type { ReferenceSlots, ReferenceProps, ReferenceState } from './Reference';\nexport type { ReferenceListSlots, ReferenceListProps, ReferenceListState } from './ReferenceList';\nexport type {\n ReferenceGroupToggleSlots,\n ReferenceGroupToggleProps,\n ReferenceGroupToggleState,\n} from './ReferenceGroupToggle';\n\nexport type {\n PackagedCitationProps,\n PackagedCitation,\n PackagedReferenceProps,\n PackagedReference,\n ReferenceCitationData,\n UseReferenceCitationPreview,\n UseReferenceGroup,\n UseReferenceGroupProps,\n} from './hooks';\n"],"names":["Citation","citationClassNames","renderCitation_unstable","useCitation_unstable","useCitationStyles_unstable","Reference","referenceClassNames","renderReference_unstable","useReference_unstable","useReferenceStyles_unstable","useReferenceCitationPreview","useReferenceGroup","ReferenceList","referenceListClassNames","useReferenceList_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","ReferenceGroupToggle","referenceGroupToggleClassNames","renderReferenceGroupToggle_unstable","useReferenceGroupToggleStyles_unstable","useReferenceGroupToggle_unstable"],"mappings":"AAAA,SACEA,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,0BAA0B,QACrB,aAAa;AACpB,SACEC,SAAS,EACTC,mBAAmB,EACnBC,wBAAwB,EACxBC,qBAAqB,EACrBC,2BAA2B,QACtB,cAAc;AACrB,SAASC,2BAA2B,EAAEC,iBAAiB,QAAQ,UAAU;AACzE,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,kBAAkB;AACzB,SACEC,oBAAoB,EACpBC,8BAA8B,EAC9BC,mCAAmC,EACnCC,sCAAsC,EACtCC,gCAAgC,QAC3B,yBAAyB"}
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n Citation,\n citationClassNames,\n renderCitation_unstable,\n useCitation_unstable,\n useCitationStyles_unstable,\n} from './Citation';\nexport {\n Reference,\n referenceClassNames,\n renderReference_unstable,\n useReference_unstable,\n useReferenceStyles_unstable,\n} from './Reference';\nexport { useReferenceCitationPreview, useReferenceGroup } from './hooks';\nexport {\n ReferenceList,\n referenceListClassNames,\n useReferenceList_unstable,\n useReferenceListStyles_unstable,\n renderReferenceList_unstable,\n} from './ReferenceList';\nexport {\n ReferenceGroupToggle,\n referenceGroupToggleClassNames,\n renderReferenceGroupToggle_unstable,\n useReferenceGroupToggleStyles_unstable,\n useReferenceGroupToggle_unstable,\n} from './ReferenceGroupToggle';\n\n// Types\n\nexport type { CitationSlots, CitationProps, CitationState } from './Citation';\nexport type { ReferenceSlots, ReferenceProps, ReferenceState } from './Reference';\nexport type { ReferenceListSlots, ReferenceListProps, ReferenceListState } from './ReferenceList';\nexport type {\n ReferenceGroupToggleSlots,\n ReferenceGroupToggleProps,\n ReferenceGroupToggleState,\n} from './ReferenceGroupToggle';\n\nexport type {\n PackagedCitationProps,\n PackagedCitation,\n PackagedReferenceProps,\n PackagedReference,\n ReferenceCitationData,\n UseReferenceCitationPreview,\n UseReferenceGroup,\n UseReferenceGroupProps,\n} from './hooks';\n\n// reference-v2 exports\nexport type {\n ReferenceProps as ReferenceV2Props,\n ReferenceSlots as ReferenceV2Slots,\n ReferenceState as ReferenceV2State,\n} from './ReferenceV2';\nexport {\n Reference as ReferenceV2,\n referenceClassNames as referenceV2ClassNames,\n referenceExtraClassNames as referenceV2ExtraClassNames,\n renderReference_unstable as renderReferenceV2_unstable,\n useReferenceStyles_unstable as useReferenceStylesV2_unstable,\n useReference_unstable as useReferenceV2_unstable,\n} from './ReferenceV2';\n\nexport type {\n ReferenceListContextValues as ReferenceListV2ContextValues,\n ReferenceListProps as ReferenceListV2Props,\n ReferenceListSlots as ReferenceListV2Slots,\n ReferenceListState as ReferenceListV2State,\n} from './ReferenceListV2';\nexport {\n ReferenceList as ReferenceListV2,\n referenceListClassNames as referenceListV2ClassNames,\n renderReferenceList_unstable as renderReferenceListV2_unstable,\n useReferenceListStyles_unstable as useReferenceListStylesV2_unstable,\n useReferenceList_unstable as useReferenceListV2_unstable,\n} from './ReferenceListV2';\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/reference-v2';\nexport {\n ReferenceListContext,\n ReferenceListContextProvider,\n useReferenceListContext_unstable,\n} from './contexts/reference-v2';\n\nexport type {\n PackagedCitation as PackagedCitationV2,\n PackagedPreviewContentProps as PackagedPreviewContentV2Props,\n PackagedReference as PackagedReferenceV2,\n UseReferenceCitationPreview as UseReferenceCitationPreviewV2,\n UseReferenceCitationPreviewProps as UseReferenceCitationPreviewV2Props,\n} from './hooks/reference-v2';\nexport { useReferenceCitationPreview as useReferenceCitationPreviewV2 } from './hooks/reference-v2';\n"],"names":["Citation","citationClassNames","renderCitation_unstable","useCitation_unstable","useCitationStyles_unstable","Reference","referenceClassNames","renderReference_unstable","useReference_unstable","useReferenceStyles_unstable","useReferenceCitationPreview","useReferenceGroup","ReferenceList","referenceListClassNames","useReferenceList_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","ReferenceGroupToggle","referenceGroupToggleClassNames","renderReferenceGroupToggle_unstable","useReferenceGroupToggleStyles_unstable","useReferenceGroupToggle_unstable","ReferenceV2","referenceV2ClassNames","referenceExtraClassNames","referenceV2ExtraClassNames","renderReferenceV2_unstable","useReferenceStylesV2_unstable","useReferenceV2_unstable","ReferenceListV2","referenceListV2ClassNames","renderReferenceListV2_unstable","useReferenceListStylesV2_unstable","useReferenceListV2_unstable","ReferenceOverflowButton","referenceOverflowButtonClassNames","renderReferenceOverflowButton_unstable","useReferenceOverflowButtonStyles_unstable","useReferenceOverflowButton_unstable","ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","useReferenceCitationPreviewV2"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,SACEA,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,0BAA0B,QACrB,aAAa;AACpB,SACEC,SAAS,EACTC,mBAAmB,EACnBC,wBAAwB,EACxBC,qBAAqB,EACrBC,2BAA2B,QACtB,cAAc;AACrB,SAASC,2BAA2B,EAAEC,iBAAiB,QAAQ,UAAU;AACzE,SACEC,aAAa,EACbC,uBAAuB,EACvBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,4BAA4B,QACvB,kBAAkB;AACzB,SACEC,oBAAoB,EACpBC,8BAA8B,EAC9BC,mCAAmC,EACnCC,sCAAsC,EACtCC,gCAAgC,QAC3B,yBAAyB;AA8BhC,SACEhB,aAAaiB,WAAW,EACxBhB,uBAAuBiB,qBAAqB,EAC5CC,4BAA4BC,0BAA0B,EACtDlB,4BAA4BmB,0BAA0B,EACtDjB,+BAA+BkB,6BAA6B,EAC5DnB,yBAAyBoB,uBAAuB,QAC3C,gBAAgB;AAQvB,SACEhB,iBAAiBiB,eAAe,EAChChB,2BAA2BiB,yBAAyB,EACpDd,gCAAgCe,8BAA8B,EAC9DhB,mCAAmCiB,iCAAiC,EACpElB,6BAA6BmB,2BAA2B,QACnD,oBAAoB;AAO3B,SACEC,uBAAuB,EACvBC,iCAAiC,EACjCC,sCAAsC,EACtCC,yCAAyC,EACzCC,mCAAmC,QAC9B,4BAA4B;AAGnC,SACEC,oBAAoB,EACpBC,4BAA4B,EAC5BC,gCAAgC,QAC3B,0BAA0B;AASjC,SAAS/B,+BAA+BgC,6BAA6B,QAAQ,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Citation.
|
|
1
|
+
{"version":3,"sources":["Citation.ts"],"sourcesContent":["export * from './components/Citation/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.
|
|
1
|
+
{"version":3,"sources":["Reference.ts"],"sourcesContent":["export * from './components/Reference/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceGroupToggle.
|
|
1
|
+
{"version":3,"sources":["ReferenceGroupToggle.ts"],"sourcesContent":["export * from './components/ReferenceGroupToggle/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.
|
|
1
|
+
{"version":3,"sources":["ReferenceList.ts"],"sourcesContent":["export * from './components/ReferenceList/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/reference-v2/ReferenceList"), exports);
|
|
7
|
+
//# sourceMappingURL=ReferenceListV2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceListV2.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceList';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./components/reference-v2/ReferenceOverflowButton"), exports);
|
|
7
|
+
//# sourceMappingURL=ReferenceOverflowButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceOverflowButton';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceV2.ts"],"sourcesContent":["export * from './components/reference-v2/Reference';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Citation.
|
|
1
|
+
{"version":3,"sources":["Citation.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCitation_unstable } from './useCitation';\nimport { renderCitation_unstable } from './renderCitation';\nimport { useCitationStyles_unstable } from './useCitationStyles';\nimport type { CitationProps } from './Citation.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { useCustomStyleHook } from '@fluentui-copilot/react-provider';\n\n// Citation component - TODO: add more docs\nexport const Citation: ForwardRefComponent<CitationProps> = React.forwardRef((props, ref) => {\n const state = useCitation_unstable(props, ref);\n\n useCitationStyles_unstable(state);\n useCustomStyleHook('useCitationStyles')(state);\n\n return renderCitation_unstable(state);\n});\n\nCitation.displayName = 'Citation';\n"],"names":["Citation","React","forwardRef","props","state","useCitation_unstable","useCitationStyles_unstable","useCustomStyleHook","renderCitation_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;;iEATU;6BACc;gCACG;mCACG;+BAGR;AAG5B,MAAMA,WAAAA,WAAAA,GAAAA,OAA+CC,UAAMC,CAAU,CAACC,OAACA;UAC5EC,QAAMA,IAAAA,iCAAQC,EAAAA,OAAqBF;qDAEnCG,EAAAA;yCACAC,EAAAA,qBAAmBH;WAEnBI,IAAAA,uCAAOA,EAAAA;AACT;AAEAR,SAASS,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Citation.types.
|
|
1
|
+
{"version":3,"sources":["Citation.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type CitationSlots = {\n /**\n * The root slot.\n */\n root: NonNullable<Slot<'a'>>;\n};\n\n/**\n * Citation Props\n */\nexport type CitationProps = ComponentProps<Partial<CitationSlots>> & {\n /**\n * HREF to the associated `Reference`.\n */\n referenceHref?: string;\n\n /**\n * Whether the citation is a block citation and has no built in margins.\n * Citations are inline by default with margins to separate them from inline text.\n */\n block?: boolean;\n};\n\n/**\n * State used in rendering Citation\n */\nexport type CitationState = ComponentState<CitationSlots> &\n Required<Pick<CitationProps, 'block'>> & {\n isPopoverLocked: boolean;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAyBA;;CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Citation';\nexport * from './Citation.types';\nexport * from './renderCitation';\nexport * from './useCitation';\nexport * from './useCitationStyles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderCitation.
|
|
1
|
+
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { CitationState, CitationSlots } from './Citation.types';\n/**\n * Render the final JSX of Citation\n */\nexport const renderCitation_unstable = (state: CitationState) => {\n assertSlots<CitationSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","state","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BASEA;;;eAAAA;;;4BATwB;iCAGE;AAM1BA,MAAAA,0BAA2BC,CAAAA;oCAE3B,EAAAA;IACA,OAAA,WAAA,GAAAC,IAAAA,eAAA,EAAAD,MAAAE,IAAA,EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCitation.
|
|
1
|
+
{"version":3,"sources":["useCitation.ts"],"sourcesContent":["import { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport { usePreviewContext_unstable } from '@fluentui-copilot/react-preview';\nimport type { CitationProps, CitationState } from './Citation.types';\n/**\n * Create the state required to render Citation.\n *\n * The returned state can be modified with hooks such as useCitationStyles_unstable,\n * before being passed to renderCitation_unstable.\n *\n * @param props - props from this instance of Citation\n * @param ref - reference to root HTMLElement of Citation\n */\nexport const useCitation_unstable = (props: CitationProps, ref: React.Ref<HTMLAnchorElement>): CitationState => {\n const { referenceHref, block = false, ...otherProps } = props;\n\n const isPopoverLocked = usePreviewContext_unstable(ctx => ctx.isPreviewLocked) && (props['aria-expanded'] as boolean);\n\n const state: CitationState = {\n block,\n isPopoverLocked,\n components: {\n root: 'a',\n },\n root: slot.always(\n getIntrinsicElementProps('a', {\n ref,\n href: referenceHref,\n role: undefined,\n 'aria-expanded': undefined,\n ...otherProps,\n }),\n { elementType: 'a' },\n ),\n };\n\n return state;\n};\n"],"names":["referenceHref","props","ref","state","block","usePreviewContext_unstable","ctx","isPreviewLocked","href","role","otherProps","elementType","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaUA;;;eAAAA;;;iCAbqC;8BACJ;AAYzC,MAAQA,uBAAuB,CAAAC,OAAOC;UAEtC,EAEAF,aAAMG,UACJC,KAAAA;4BAGQC,IAAAA,wCAAA,EAAAC,CAAAA,MAAAA,IAAAC,eAAA,KAAAN,KAAA,CAAA,gBAAA;UACRE,QAAA;;;oBAIIK;kBACAC;;mCAEA,CAAGC,MAAAA,CAAAA,IAAAA,yCAAU,EAAA,KAAA;;kBAEbC;kBAAiBC;YAEvB,iBAAAA;YAEA,GAAAF,UAAOP;QACP,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCitationStyles.
|
|
1
|
+
{"version":3,"sources":["useCitationStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { CitationSlots, CitationState } from './Citation.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const citationClassNames: SlotClassNames<CitationSlots> = {\n root: 'fai-Citation',\n};\n\nconst useCitationBaseClassName = makeResetStyles({\n display: 'inline-flex',\n justifyContent: 'center',\n boxSizing: 'border-box',\n alignItems: 'center',\n ...typographyStyles.caption2Strong,\n\n color: tokens.colorNeutralForeground2,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n\n minWidth: '14px',\n height: '14px',\n verticalAlign: `calc((${typographyStyles.caption2Strong.lineHeight} - ${typographyStyles.caption2Strong.fontSize}) / 2)`,\n\n borderRadius: tokens.borderRadiusMedium,\n\n textDecoration: 'none',\n\n marginLeft: tokens.spacingHorizontalXXS,\n marginRight: tokens.spacingHorizontalXXS,\n\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Hover,\n borderColor: tokens.colorBrandStroke2Hover,\n backgroundColor: tokens.colorBrandBackground2Hover,\n },\n\n ':hover:active': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Pressed,\n borderColor: tokens.colorBrandStroke2Pressed,\n backgroundColor: tokens.colorBrandBackground2Pressed,\n },\n});\n\nconst useCitationRootStyles = makeStyles({\n isBlock: {\n display: 'flex',\n marginLeft: 0,\n marginRight: 0,\n },\n isPopoverLocked: {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n ':hover': {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n },\n },\n});\n\n/**\n * Apply styling to the Citation slots based on the state\n */\nexport const useCitationStyles_unstable = (state: CitationState): CitationState => {\n const rootBaseClassName = useCitationBaseClassName();\n const rootStyles = useCitationRootStyles();\n\n state.root.className = mergeClasses(\n citationClassNames.root,\n state.isPopoverLocked && rootStyles.isPopoverLocked,\n state.block && rootStyles.isBlock,\n rootBaseClassName,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["citationClassNames","useCitationRootStyles","makeStyles","root","useCitationBaseClassName","makeResetStyles","display","__styles","justifyContent","boxSizing","alignItems","t21cq0","typographyStyles","caption2Strong","tokens","minWidth","height","verticalAlign","borderRadius","textDecoration","marginLeft","marginRight","Bgoe8wy","cursor","color","borderColor","colorBrandStroke2Hover","backgroundColor","state","isBlock","mergeClasses","isPopoverLocked","rootStyles","block","rootBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAWaA,kBAAAA;eAAAA;;IAwCPC,0BAAwBC;eAAxBD;;;iCA7CY;AAKX,MAAMD,qBAAoD;UAC/DG;AACF;AAEA,MAAMC,2BAA2BC,IAAAA,8BAAAA,EAAAA,WAAgB,YAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;CAAA;MAC/CC,wBAASC,IAAAA,yBAAA,EAAA;aACTC;QACAC,QAAAA;QACAC,QAAAA;YAAAA;YAAY;SAAA;QACZC,QAAGC;YAAAA;YAAiBC;SAAAA;;qBAGTC;QAEXC,QAAAA;QACAC,QAAQ;QACRC,QAAAA;YAAAA;YAAgB;SAAQL;QAExBM,SAAAA;QAEAC,QAAAA;YAAAA;YAAgB;SAAA;QAEhBC,QAAAA;QACAC,SAAAA;QAEAC,SAAA;iBACEC;YAAAA;YAAQ;SAAA;gBACRC;gBACAC;YAAAA;YAAaX;SAAOY;gBACpBC;;;;;QAIQ;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;;;QACkC;QAAA;QAAA;QAAA;QAAA;KAAA;;AAMxC1B,MAAAA,6BAAmC2B,CAAAA;UACvCC,oBAASzB;UACPE,aAASL;UACTmB,IAAAA,CAAAA,SAAY,GAAAU,IAAAA,6BAAA,EAAA9B,mBAAAG,IAAA,EAAAyB,MAAAG,eAAA,IAAAC,WAAAD,eAAA,EAAAH,MAAAK,KAAA,IAAAD,WAAAH,OAAA,EAAAK,mBAAAN,MAAAzB,IAAA,CAAAgC,SAAA;WACZd;gDAEe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.
|
|
1
|
+
{"version":3,"sources":["Reference.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReference_unstable } from './useReference';\nimport { renderReference_unstable } from './renderReference';\nimport { useReferenceStyles_unstable } from './useReferenceStyles';\nimport type { ReferenceProps } from './Reference.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { useCustomStyleHook } from '@fluentui-copilot/react-provider';\n\n// Reference component - TODO: add more docs\nexport const Reference: ForwardRefComponent<ReferenceProps> = React.forwardRef((props, ref) => {\n const state = useReference_unstable(props, ref);\n\n useReferenceStyles_unstable(state);\n useCustomStyleHook('useReferenceStyles')(state);\n\n return renderReference_unstable(state);\n});\n\nReference.displayName = 'Reference';\n"],"names":["Reference","React","forwardRef","props","state","useReference_unstable","useReferenceStyles_unstable","useCustomStyleHook","renderReference_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;;iEATU;8BACe;iCACG;oCACG;+BAGT;AAG5B,MAAMA,YAAAA,WAAAA,GAAAA,OAAiDC,UAAMC,CAAU,CAACC,OAACA;UAC9EC,QAAMA,IAAAA,mCAAQC,EAAAA,OAAsBF;uDAEpCG,EAAAA;yCACAC,EAAAA,sBAAmBH;WAEnBI,IAAAA,yCAAOA,EAAAA;AACT;AAEAR,UAAUS,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.types.
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { Button, ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceSlots = {\n /**\n * The root slot.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Citation slot. Displays a `Citation`. Set the `null` to hide the citation.\n */\n citation: Slot<'div'>;\n\n /**\n * Media slot. Used to display Avatars, Icons, etc.\n */\n media: Slot<'div'>;\n\n /**\n * Actions slot.\n */\n actions: Slot<'div'>;\n\n /**\n * Label slot. Primary description of the reference.\n */\n label: NonNullable<Slot<'div'>>;\n\n /**\n * Sensitivity slot. Used to display a `SensitivityLabel`.\n */\n sensitivity: Slot<'span'>;\n\n /**\n * Metadata slot. Container for `primaryText`, `secondaryText`, `tertiaryText` and `icon`.\n */\n metadata: NonNullable<Slot<'div'>>;\n\n /**\n * Primary text slot. First displayed metadata text.\n */\n primaryText: Slot<'span'>;\n\n /**\n * Secondary text slot. Second displayed metadata text.\n */\n secondaryText: Slot<'span'>;\n\n /**\n * Tertiary text slot. Third displayed metadata text.\n */\n tertiaryText: Slot<'span'>;\n\n /**\n * Icon slot. Icon displayed in metadata area.\n */\n icon: Slot<'span'>;\n\n /**\n * Content slot.\n */\n content: NonNullable<Slot<'div'>>;\n\n /**\n * Details button slot. Used to expand/collapse the reference.\n */\n detailsButton: Slot<typeof Button>;\n};\n\n/**\n * Reference Props\n */\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> &\n CopilotMode & {\n /**\n * Numeric index associated with `Citation`.\n */\n index: number;\n\n /**\n * HREF back to the `Citation` this `Reference` is associated with.\n */\n citationHref?: string;\n\n /**\n * Unique ID associated with this `Reference`.\n */\n referenceId?: string;\n\n /**\n * Text snippet from the reference source.\n */\n excerpt?: string;\n\n /**\n * @deprecated Inline layout is the only one that is available, use `Preview` component instead for an equivalent to a `Reference` with a popover layout inside of a `Popover`.\n */\n layout?: 'inline' | 'popover';\n };\n\n/**\n * State used in rendering Reference\n */\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'mode' | 'layout' | 'index'>> & {\n /**\n * State used to renderer the `Reference` in an expanded state.\n */\n isExpanded: boolean;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAqGA;;CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Reference';\nexport * from './Reference.types';\nexport * from './renderReference';\nexport * from './useReference';\nexport * from './useReferenceStyles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReference.
|
|
1
|
+
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\n\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\n/**\n * Render the final JSX of Reference\n */\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n return (\n <state.root>\n {state.citation && <state.citation />}\n {state.media && <state.media />}\n <state.label />\n {state.actions && (\n <state.actions>\n {state.actions.children}\n {state.detailsButton && <state.detailsButton />}\n </state.actions>\n )}\n {state.sensitivity && <state.sensitivity />}\n <state.metadata>\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.tertiaryText && <state.tertiaryText />}\n {state.icon && <state.icon />}\n {state.metadata.children}\n </state.metadata>\n <state.content />\n </state.root>\n );\n};\n"],"names":["assertSlots","state","citation","_jsx","media","label","actions","_jsxs","children","detailsButton","sensitivity","metadata","primaryText","secondaryText","tertiaryText","icon"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWEA;;;eAAAA;;;4BAVF;iCAE4B;AAQ1BA,MAAAA,2BAA4BC,CAAAA;oCAE5B,EAAAA;;kBAEKA;YAAAA,MAAMC,QAAQ,IAAA,WAAI,GAAAC,IAAAA,eAACF,EAAAA,MAAMC,QAAQ,EAAA,CAAA;YAAAD,MAAAG,KAAA,IAAA,WAAA,GAAAD,IAAAA,eAAA,EAAAF,MAAAG,KAAA,EAAA,CAAA;YAAA,WAAA,GAAAD,IAAAA,eAAA,EAAAF,MAAAI,KAAA,EAAA,CAAA;YAAAJ,MAAAK,OAAA,IAAA,WAAA,GAAAC,IAAAA,gBAAA,EAAAN,MAAAK,OAAA,EAAA;0BACjCL;oBAAAA,MAAWK,OAAA,CAAAE,QAAA;oBAAIP,MAACA,aAAW,IAAA,WAAA,GAAAE,IAAAA,eAAA,EAAAF,MAAAQ,aAAA,EAAA,CAAA;iBAAA;;iCAC5B,WAAOJ,GAAKF,IAAAA,eAAA,EAAAF,MAAAS,WAAA,EAAA,CAAA;YAAA,WAAA,GAAAH,IAAAA,gBAAA,EAAAN,MAAAU,QAAA,EAAA;0BACXV;oBAAAA,MAAMK,WAAO,IAAA,WACXL,GAAAA,IAAAA,eAAMK,EAAAA,MAAOM,WAAA,EAAA,CAAA;oBAAAX,MAAAY,aAAA,IAAA,WAAA,GAAAV,IAAAA,eAAA,EAAAF,MAAAY,aAAA,EAAA,CAAA;oBAAAZ,MAAAa,YAAA,IAAA,WAAA,GAAAX,IAAAA,eAAA,EAAAF,MAAAa,YAAA,EAAA,CAAA;oBAAAb,MAAAc,IAAA,IAAA,WAAA,GAAAZ,IAAAA,eAAA,EAAAF,MAAAc,IAAA,EAAA,CAAA;oBAAAd,MAAAU,QAAA,CAAAH,QAAA;iBAAA"}
|
|
@@ -14,7 +14,7 @@ const _reactcomponents = require("@fluentui/react-components");
|
|
|
14
14
|
const _reacticons = require("@fluentui/react-icons");
|
|
15
15
|
const _useReferenceStyles = require("./useReferenceStyles");
|
|
16
16
|
const _Citation = require("../Citation");
|
|
17
|
-
const _ReferenceGroupContext = require("../../
|
|
17
|
+
const _ReferenceGroupContext = require("../../contexts/ReferenceGroupContext");
|
|
18
18
|
const _reactprovider = require("@fluentui-copilot/react-provider");
|
|
19
19
|
const useReference_unstable = (props, ref)=>{
|
|
20
20
|
const { index, referenceId, citationHref, excerpt, layout = 'inline' } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.js"],"sourcesContent":["import * as React from 'react';\nimport { Button, Caption1, getIntrinsicElementProps, mergeCallbacks, mergeClasses, slot, useId, usePopoverContext_unstable as usePopoverContext } from '@fluentui/react-components';\nimport { ChevronDown24Regular, ChevronUp24Regular, ChevronDown16Regular, ChevronUp16Regular } from '@fluentui/react-icons';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport { Citation } from '../Citation';\nimport { useReferenceGroupSetOpen } from '../../context/ReferenceGroupContext';\nimport { useCopilotMode } from '@fluentui-copilot/react-provider';\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 = (props, ref) => {\n const {\n index,\n referenceId,\n citationHref,\n excerpt,\n layout = 'inline'\n } = props;\n const mode = useCopilotMode(props.mode);\n const labelId = useId();\n const mediaId = useId();\n const [isExpanded, setIsExpanded] = React.useState(layout === 'popover' ? true : false);\n const setPopoverOpen = usePopoverContext(context => context.setOpen);\n const onExpandClick = _e => {\n setIsExpanded(!isExpanded);\n };\n const label = slot.always(props.label, {\n defaultProps: {\n id: labelId\n },\n elementType: 'div'\n });\n const media = slot.optional(props.media, {\n defaultProps: {\n id: mediaId\n },\n elementType: 'div'\n });\n if (media && /*#__PURE__*/React.isValidElement(media.children)) {\n media.children = /*#__PURE__*/React.cloneElement(media.children, {\n className: mergeClasses(media.children.props.className, referenceExtraClassNames.mediaChild)\n });\n }\n if (media === null || media === void 0 ? void 0 : media.id) {\n var _label_ariadescribedby;\n var _label_ariadescribedby_concat;\n label['aria-describedby'] = (_label_ariadescribedby_concat = (_label_ariadescribedby = label['aria-describedby']) === null || _label_ariadescribedby === void 0 ? void 0 : _label_ariadescribedby.concat(media.id)) !== null && _label_ariadescribedby_concat !== void 0 ? _label_ariadescribedby_concat : media.id;\n }\n const ariaLabelledByProp = props['aria-labelledby'];\n const groupSemantics = React.useMemo(() => {\n return layout === 'inline' ? {\n role: 'group',\n 'aria-labelledby': `${ariaLabelledByProp !== null && ariaLabelledByProp !== void 0 ? ariaLabelledByProp : ''} ${label.id}`,\n tabIndex: -1\n } : {};\n }, [layout, ariaLabelledByProp, label.id]);\n // Within a popup, a citation should function as a close button\n const citationProps = React.useMemo(() => {\n const onPopoverCloseClick = e => {\n setPopoverOpen(e, false);\n // don't navigate\n e.preventDefault();\n };\n return layout === 'popover' ? {\n referenceHref: '#',\n tabIndex: -1,\n 'aria-label': `Reference ${index}, close`,\n onClick: onPopoverCloseClick\n } : {\n referenceHref: citationHref\n };\n }, [layout, citationHref, index, setPopoverOpen]);\n const state = {\n isExpanded,\n mode: layout === 'popover' ? 'sidecar' : mode,\n layout,\n index,\n components: {\n root: 'div',\n citation: 'div',\n media: 'div',\n actions: 'div',\n label: 'div',\n sensitivity: 'span',\n metadata: 'div',\n content: 'div',\n primaryText: 'span',\n secondaryText: 'span',\n tertiaryText: 'span',\n icon: 'span',\n detailsButton: Button\n },\n root: slot.always(getIntrinsicElementProps('div', {\n ref,\n id: referenceId,\n ...groupSemantics,\n ...props\n }), {\n elementType: 'div'\n }),\n citation: slot.optional(props.citation, {\n defaultProps: {\n children: /*#__PURE__*/React.createElement(Citation, {\n block: true,\n ...citationProps\n }, index)\n },\n renderByDefault: true,\n elementType: 'div'\n }),\n media,\n actions: slot.optional(layout === 'inline' ? props.actions : null, {\n renderByDefault: true,\n elementType: 'div'\n }),\n label,\n sensitivity: slot.optional(props.sensitivity, {\n elementType: 'span'\n }),\n metadata: slot.always(props.metadata, {\n elementType: 'div'\n }),\n primaryText: slot.optional(props.primaryText, {\n defaultProps: {\n hidden: !isExpanded\n },\n elementType: 'span'\n }),\n secondaryText: slot.optional(props.secondaryText, {\n defaultProps: {\n hidden: !isExpanded\n },\n elementType: 'span'\n }),\n tertiaryText: slot.optional(props.tertiaryText, {\n defaultProps: {\n hidden: !isExpanded\n },\n elementType: 'span'\n }),\n icon: slot.optional(props.icon, {\n elementType: 'span'\n }),\n content: slot.always(props.content, {\n defaultProps: {\n children: excerpt && /*#__PURE__*/React.createElement(Caption1, null, excerpt)\n },\n elementType: 'div'\n }),\n detailsButton: slot.optional(layout === 'inline' ? props.detailsButton : null, {\n defaultProps: {\n appearance: 'transparent',\n 'aria-expanded': isExpanded,\n 'aria-label': 'show details',\n size: mode === 'sidecar' ? 'small' : 'medium',\n icon: {\n children: getIcon(isExpanded, mode)\n }\n },\n renderByDefault: true,\n elementType: Button\n })\n };\n if (state.detailsButton) {\n const onClick = state.detailsButton.onClick;\n state.detailsButton.onClick = mergeCallbacks(onClick, onExpandClick);\n }\n const referenceGroupSetOpen = useReferenceGroupSetOpen();\n const onTargettedByCitation = e => {\n var _e_relatedTarget;\n const relatedTargetHash = (_e_relatedTarget = e.relatedTarget) === null || _e_relatedTarget === void 0 ? void 0 : _e_relatedTarget.hash;\n if (relatedTargetHash && relatedTargetHash.substring(1) === referenceId) {\n referenceGroupSetOpen();\n setIsExpanded(true);\n }\n };\n state.root.onFocus = mergeCallbacks(state.root.onFocus, onTargettedByCitation);\n return state;\n};\nconst getIcon = (isExpanded, mode) => {\n if (mode === 'sidecar') {\n return !isExpanded ? /*#__PURE__*/React.createElement(ChevronDown16Regular, null) : /*#__PURE__*/React.createElement(ChevronUp16Regular, null);\n }\n return !isExpanded ? /*#__PURE__*/React.createElement(ChevronDown24Regular, null) : /*#__PURE__*/React.createElement(ChevronUp24Regular, null);\n};\n//# sourceMappingURL=useReference.js.map"],"names":["useReference_unstable","props","ref","index","referenceId","citationHref","excerpt","layout","mode","useCopilotMode","labelId","useId","mediaId","isExpanded","setIsExpanded","React","useState","setPopoverOpen","usePopoverContext","context","setOpen","onExpandClick","_e","label","slot","always","defaultProps","id","elementType","media","optional","isValidElement","children","cloneElement","className","mergeClasses","referenceExtraClassNames","mediaChild","_label_ariadescribedby","_label_ariadescribedby_concat","concat","ariaLabelledByProp","groupSemantics","useMemo","role","tabIndex","citationProps","onPopoverCloseClick","e","preventDefault","referenceHref","onClick","state","components","root","citation","actions","sensitivity","metadata","content","primaryText","secondaryText","tertiaryText","icon","detailsButton","Button","getIntrinsicElementProps","createElement","Citation","block","renderByDefault","hidden","Caption1","appearance","size","getIcon","mergeCallbacks","referenceGroupSetOpen","useReferenceGroupSetOpen","onTargettedByCitation","_e_relatedTarget","relatedTargetHash","relatedTarget","hash","substring","onFocus","ChevronDown16Regular","ChevronUp16Regular","ChevronDown24Regular","ChevronUp24Regular"],"mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;iCACgI;4BACpD;oCAC1D;0BAChB;uCACgB;+BACV;AAUxB,MAAMA,wBAAwB,CAACC,OAAOC;IAC3C,MAAM,EACJC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,SAAS,QAAQ,EAClB,GAAGN;IACJ,MAAMO,OAAOC,IAAAA,6BAAc,EAACR,MAAMO,IAAI;IACtC,MAAME,UAAUC,IAAAA,sBAAK;IACrB,MAAMC,UAAUD,IAAAA,sBAAK;IACrB,MAAM,CAACE,YAAYC,cAAc,GAAGC,OAAMC,QAAQ,CAACT,WAAW,YAAY,OAAO;IACjF,MAAMU,iBAAiBC,IAAAA,2CAAiB,EAACC,CAAAA,UAAWA,QAAQC,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IAAAA,+CAAwB;IACtD,MAAMC,wBAAwB/B,CAAAA;QAC5B,IAAIgC;QACJ,MAAMC,oBAAoB,AAACD,CAAAA,mBAAmBhC,EAAEkC,aAAa,AAAD,MAAO,QAAQF,qBAAqB,KAAK,IAAI,KAAK,IAAIA,iBAAiBG,IAAI;QACvI,IAAIF,qBAAqBA,kBAAkBG,SAAS,CAAC,OAAOhF,aAAa;YACvEyE;YACA/D,cAAc;QAChB;IACF;IACAsC,MAAME,IAAI,CAAC+B,OAAO,GAAGT,IAAAA,+BAAc,EAACxB,MAAME,IAAI,CAAC+B,OAAO,EAAEN;IACxD,OAAO3B;AACT;AACA,MAAMuB,UAAU,CAAC9D,YAAYL;IAC3B,IAAIA,SAAS,WAAW;QACtB,OAAO,CAACK,aAAa,WAAW,GAAEE,OAAMoD,aAAa,CAACmB,gCAAoB,EAAE,QAAQ,WAAW,GAAEvE,OAAMoD,aAAa,CAACoB,8BAAkB,EAAE;IAC3I;IACA,OAAO,CAAC1E,aAAa,WAAW,GAAEE,OAAMoD,aAAa,CAACqB,gCAAoB,EAAE,QAAQ,WAAW,GAAEzE,OAAMoD,aAAa,CAACsB,8BAAkB,EAAE;AAC3I,GACA,wCAAwC"}
|
|
1
|
+
{"version":3,"sources":["useReference.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Button,\n Caption1,\n getIntrinsicElementProps,\n mergeCallbacks,\n mergeClasses,\n slot,\n useId,\n usePopoverContext_unstable as usePopoverContext,\n} from '@fluentui/react-components';\nimport {\n ChevronDown24Regular,\n ChevronUp24Regular,\n ChevronDown16Regular,\n ChevronUp16Regular,\n} from '@fluentui/react-icons';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport { Citation } from '../Citation';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\nimport { useReferenceGroupSetOpen } from '../../contexts/ReferenceGroupContext';\nimport { useCopilotMode } 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 = (props: ReferenceProps, ref: React.Ref<HTMLDivElement>): ReferenceState => {\n const { index, referenceId, citationHref, excerpt, layout = 'inline' } = props;\n\n const mode = useCopilotMode(props.mode);\n\n const labelId = useId();\n const mediaId = useId();\n const [isExpanded, setIsExpanded] = React.useState(layout === 'popover' ? true : false);\n\n const setPopoverOpen = usePopoverContext(context => context.setOpen);\n\n const onExpandClick: React.MouseEventHandler<HTMLButtonElement> = _e => {\n setIsExpanded(!isExpanded);\n };\n\n const label = slot.always(props.label, {\n defaultProps: { id: labelId },\n elementType: 'div',\n });\n const media = slot.optional(props.media, { defaultProps: { id: mediaId }, elementType: 'div' });\n if (media && React.isValidElement<HTMLElement>(media.children)) {\n media.children = React.cloneElement(media.children, {\n className: mergeClasses(media.children.props.className, referenceExtraClassNames.mediaChild),\n });\n }\n\n if (media?.id) {\n label['aria-describedby'] = label['aria-describedby']?.concat(media.id) ?? media.id;\n }\n\n const ariaLabelledByProp = props['aria-labelledby'];\n const groupSemantics = React.useMemo(() => {\n return layout === 'inline'\n ? {\n role: 'group',\n 'aria-labelledby': `${ariaLabelledByProp ?? ''} ${label.id}`,\n tabIndex: -1,\n }\n : {};\n }, [layout, ariaLabelledByProp, label.id]);\n\n // Within a popup, a citation should function as a close button\n const citationProps = React.useMemo(() => {\n const onPopoverCloseClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n setPopoverOpen(e, false);\n\n // don't navigate\n e.preventDefault();\n };\n\n return layout === 'popover'\n ? {\n referenceHref: '#',\n tabIndex: -1,\n 'aria-label': `Reference ${index}, close`,\n onClick: onPopoverCloseClick,\n }\n : {\n referenceHref: citationHref,\n };\n }, [layout, citationHref, index, setPopoverOpen]);\n\n const state: ReferenceState = {\n isExpanded,\n mode: layout === 'popover' ? 'sidecar' : mode,\n layout,\n index,\n components: {\n root: 'div',\n citation: 'div',\n media: 'div',\n actions: 'div',\n label: 'div',\n sensitivity: 'span',\n metadata: 'div',\n content: 'div',\n primaryText: 'span',\n secondaryText: 'span',\n tertiaryText: 'span',\n icon: 'span',\n detailsButton: Button,\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n id: referenceId,\n ...groupSemantics,\n ...props,\n }),\n { elementType: 'div' },\n ),\n citation: slot.optional(props.citation, {\n defaultProps: {\n children: (\n <Citation block {...citationProps}>\n {index}\n </Citation>\n ),\n },\n renderByDefault: true,\n elementType: 'div',\n }),\n media,\n actions: slot.optional(layout === 'inline' ? props.actions : null, {\n renderByDefault: true,\n elementType: 'div',\n }),\n label,\n sensitivity: slot.optional(props.sensitivity, { elementType: 'span' }),\n metadata: slot.always(props.metadata, { elementType: 'div' }),\n primaryText: slot.optional(props.primaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n tertiaryText: slot.optional(props.tertiaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n content: slot.always(props.content, {\n defaultProps: {\n children: excerpt && <Caption1>{excerpt}</Caption1>,\n },\n elementType: 'div',\n }),\n detailsButton: slot.optional(layout === 'inline' ? props.detailsButton : null, {\n defaultProps: {\n appearance: 'transparent',\n 'aria-expanded': isExpanded,\n 'aria-label': 'show details',\n size: mode === 'sidecar' ? 'small' : 'medium',\n icon: {\n children: getIcon(isExpanded, mode),\n },\n },\n renderByDefault: true,\n elementType: Button,\n }),\n };\n\n if (state.detailsButton) {\n const onClick = state.detailsButton.onClick as React.MouseEventHandler<HTMLButtonElement>;\n state.detailsButton.onClick = mergeCallbacks(onClick, onExpandClick);\n }\n\n const referenceGroupSetOpen = useReferenceGroupSetOpen();\n const onTargettedByCitation = (e: React.FocusEvent<HTMLElement>) => {\n const relatedTargetHash: string | undefined = (e.relatedTarget as HTMLAnchorElement)?.hash;\n if (relatedTargetHash && relatedTargetHash.substring(1) === referenceId) {\n referenceGroupSetOpen();\n setIsExpanded(true);\n }\n };\n state.root.onFocus = mergeCallbacks(state.root.onFocus, onTargettedByCitation);\n\n return state;\n};\n\nconst getIcon = (isExpanded: boolean, mode: ReferenceProps['mode']): JSX.Element => {\n if (mode === 'sidecar') {\n return !isExpanded ? <ChevronDown16Regular /> : <ChevronUp16Regular />;\n }\n\n return !isExpanded ? <ChevronDown24Regular /> : <ChevronUp24Regular />;\n};\n"],"names":["index","citationHref","ref","referenceId","mediaId","isExpanded","excerpt","setPopoverOpen","layout","onExpandClick","mode","useCopilotMode","props","labelId","slot","always","defaultProps","usePopoverContext","context","setOpen","elementType","_e","setIsExpanded","label","media","children","React","className","mergeClasses","referenceExtraClassNames","mediaChild","id","_label_ariadescribedby_concat","_label_ariadescribedby","concat","ariaLabelledByProp","tabIndex","onPopoverCloseClick","e","useMemo","referenceHref","state","components","root","citation","actions","sensitivity","metadata","primaryText","secondaryText","tertiaryText","detailsButton","Button","optional","Citation","hidden","icon","content","createElement","Caption1","appearance","size","onClick","mergeCallbacks","onTargettedByCitation","_e_relatedTarget","relatedTargetHash","onFocus","getIcon","ChevronDown24Regular","ChevronDown16Regular","ChevronUp24Regular","ChevronUp16Regular"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiCUA;;;eAAAA;;;;iEAjCa;iCAUhB;4BAMA;oCACkC;0BAChB;uCAEgB;+BACV;AAY7B,MAAQA,wBAAoBC,CAAAA,OAAYC;UAExC,EAEAF,KAAA,EACA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,8BAAAA,EAAAA;;WAElC,CAAAL,aAAQA,WAAAA,GAAAA,OAAAA,aAAa,CAAAgE,gCAACC,EAAAA,QAAAA,WAAAA,GAAAA,OAAAA,aAA0B,CAAAC,8BAACC,EAAAA;2CAG9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceStyles.js"],"sourcesContent":["import { buttonClassNames, __resetStyles, __styles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nexport const referenceClassNames = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n media: 'fai-Reference__media',\n actions: 'fai-Reference__actions',\n sensitivity: 'fai-Reference__sensitivity',\n metadata: 'fai-Reference__metadata',\n primaryText: 'fai-Reference__primaryText',\n secondaryText: 'fai-Reference__secondaryText',\n tertiaryText: 'fai-Reference__tertiaryText',\n icon: 'fai-Reference__icon',\n label: 'fai-Reference__label',\n content: 'fai-Reference__content',\n detailsButton: 'fai-Reference__detailsButton'\n};\nexport const referenceExtraClassNames = {\n text: 'fai-Reference__text',\n mediaChild: 'fai-Reference__mediaChild'\n};\nconst labelFontSize = typographyStyles.caption1Strong.fontSize;\nconst labelLineHeight = typographyStyles.caption1Strong.lineHeight;\nconst maxPopoverWidth = '256px';\nconst useReferenceClassName = __resetStyles(\"r8mog99\", null, [\".r8mog99{box-sizing:border-box;width:100%;display:grid;grid-template-areas:\\\"citation media title actions\\\" \\\". . title .\\\" \\\"sensitivityLabel sensitivityLabel sensitivityLabel sensitivityLabel\\\" \\\"metadata metadata metadata metadata\\\" \\\"content content content content\\\";grid-template-columns:min-content min-content 1fr min-content;grid-template-rows:32px auto auto auto auto;border:var(--strokeWidthThin) solid var(--colorNeutralStroke1);border-radius:var(--borderRadiusMedium);padding:var(--spacingVerticalS) var(--spacingHorizontalS);box-shadow:none;column-gap:var(--spacingHorizontalXS);align-items:center;}\"]);\nconst useStyles = __styles({\n canvas: {},\n sidecar: {\n wkccdc: \"f2e0fxj\",\n z8tnut: \"f1ywm7hm\",\n z189sj: [\"f1vdfbxk\", \"f1f5gg8d\"],\n Byoj8tv: \"f14wxoun\",\n uwmqm3: [\"f1f5gg8d\", \"f1vdfbxk\"]\n },\n inline: {},\n popover: {\n B4j52fo: \"f1pit55b\",\n Bekrc4i: [\"f1orqat1\", \"ffbvwxd\"],\n Bn0qgzm: \"f136mcbi\",\n ibv6hh: [\"ffbvwxd\", \"f1orqat1\"],\n a9b677: \"f1uniyfe\",\n z8tnut: \"f1nbblvp\",\n z189sj: [\"fifp7yv\", \"f1asdtw4\"],\n Byoj8tv: \"f1ov4xf1\",\n uwmqm3: [\"f1asdtw4\", \"fifp7yv\"]\n },\n closed: {\n Belr9w4: \"f1sff6ri\"\n },\n citation: {\n Ijaq50: \"fwllpr6\",\n Br312pm: \"fx0qcsv\",\n nk6f5a: \"f1ldxewp\",\n Bw0ie65: \"ftmncab\"\n },\n media: {\n Ijaq50: \"f11uok23\",\n Br312pm: \"f1qdfnnj\",\n nk6f5a: \"f1s27gz\",\n Bw0ie65: \"f86d0yl\",\n mc9l5x: \"f22iagw\",\n Bt984gj: \"f122n59\",\n Brf1p80: \"f4d9j23\"\n },\n mediaPopover: {\n a9b677: \"fjw5fx7\",\n Bqenvij: \"fd461yt\",\n psn4ub: \"fe9dio4\",\n vf399t: \"f1ojxjpn\"\n },\n actions: {\n Ijaq50: \"f16hsg94\",\n Br312pm: \"f35n22n\",\n nk6f5a: \"fh3uimt\",\n Bw0ie65: \"fnh4yke\",\n Bdqf98w: \"f1a7i8kp\",\n mc9l5x: \"f22iagw\"\n },\n detailsButton: {\n D5xksd: \"fzmnlw3\"\n },\n sensitivity: {\n Ijaq50: \"fpymh5q\",\n Br312pm: \"fjieyc3\",\n nk6f5a: \"f18utan\",\n Bw0ie65: \"f15c84mf\",\n Bdqf98w: \"fsxvdwy\"\n },\n metadata: {\n B6of3ja: \"fww94b8\",\n Ijaq50: \"f1md2vp3\",\n Br312pm: \"f1y0qc5c\",\n nk6f5a: \"f179ty8e\",\n Bw0ie65: \"f83o9dc\",\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"f13mqy1h\",\n Bhrd7zp: \"figsok6\",\n Bg96gwp: \"fcpl73t\"\n },\n metadataSubsequentText: {\n qhf8xq: \"f10pi13n\",\n Frg6f3: [\"foyynoy\", \"f1vcna3q\"],\n Ftih45: \"f1wl9k8s\",\n Br0sdwz: \"f1aocrix\",\n Brfgrao: \"f1j7ml58\",\n Fbdkly: [\"f1s1fjay\", \"f15a459s\"],\n Bciustq: \"f1wl9tmt\",\n Baz25je: \"f8pn7wt\",\n uvfttm: [\"f1x8pvcy\", \"f9sc749\"],\n Bbv0w2i: [\"f1jpmc5p\", \"f1yq6w5o\"],\n Bm6vgfq: [\"fjml6kk\", \"f1geml7w\"]\n },\n icon: {\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"f13mqy1h\",\n Bhrd7zp: \"figsok6\",\n Bg96gwp: \"fcpl73t\",\n ha4doy: \"fmrv4ls\"\n },\n content: {\n B6of3ja: \"fww94b8\",\n Ijaq50: \"fxwmwwq\",\n Br312pm: \"f1e0gndy\",\n nk6f5a: \"f4zz6gv\",\n Bw0ie65: \"f7idnck\",\n mc9l5x: \"f22iagw\",\n Beiy3e4: \"f1vx9l62\",\n Belr9w4: \"f1wn3y0l\",\n sj55zd: \"f11d4kpn\",\n Biipf1f: \"f9ijwd5\"\n },\n hidden: {\n mc9l5x: \"fjseox\"\n }\n}, {\n d: [\".f2e0fxj{grid-template-rows:24px auto auto auto;}\", \".f1ywm7hm{padding-top:var(--spacingVerticalXS);}\", \".f1vdfbxk{padding-right:var(--spacingHorizontalS);}\", \".f1f5gg8d{padding-left:var(--spacingHorizontalS);}\", \".f14wxoun{padding-bottom:var(--spacingVerticalXS);}\", \".f1pit55b{border-top-width:0px;}\", \".f1orqat1{border-right-width:0px;}\", \".ffbvwxd{border-left-width:0px;}\", \".f136mcbi{border-bottom-width:0px;}\", \".f1uniyfe{width:calc(256px - (var(--spacingHorizontalM) * 2));}\", \".f1nbblvp{padding-top:0px;}\", \".fifp7yv{padding-right:0px;}\", \".f1asdtw4{padding-left:0px;}\", \".f1ov4xf1{padding-bottom:0px;}\", \".f1sff6ri{row-gap:0;}\", \".fwllpr6{grid-row-start:citation;}\", \".fx0qcsv{grid-column-start:citation;}\", \".f1ldxewp{grid-row-end:citation;}\", \".ftmncab{grid-column-end:citation;}\", \".f11uok23{grid-row-start:media;}\", \".f1qdfnnj{grid-column-start:media;}\", \".f1s27gz{grid-row-end:media;}\", \".f86d0yl{grid-column-end:media;}\", \".f22iagw{display:flex;}\", \".f122n59{align-items:center;}\", \".f4d9j23{justify-content:center;}\", \".fjw5fx7{width:16px;}\", \".fd461yt{height:16px;}\", \".fe9dio4>.fai-Reference__mediaChild{width:16px;}\", \".f1ojxjpn>.fai-Reference__mediaChild{height:16px;}\", \".f16hsg94{grid-row-start:1;}\", \".f35n22n{grid-column-start:actions;}\", \".fh3uimt{grid-row-end:actions;}\", \".fnh4yke{grid-column-end:actions;}\", \".f1a7i8kp{justify-self:end;}\", \".fzmnlw3>fui-Button__icon{color:var(--colorNeutralForeground3);}\", \".fpymh5q{grid-row-start:sensitivityLabel;}\", \".fjieyc3{grid-column-start:sensitivityLabel;}\", \".f18utan{grid-row-end:sensitivityLabel;}\", \".f15c84mf{grid-column-end:sensitivityLabel;}\", \".fsxvdwy{justify-self:start;}\", \".fww94b8{margin-top:var(--spacingVerticalXS);}\", \".f1md2vp3{grid-row-start:metadata;}\", \".f1y0qc5c{grid-column-start:metadata;}\", \".f179ty8e{grid-row-end:metadata;}\", \".f83o9dc{grid-column-end:metadata;}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".f13mqy1h{font-size:var(--fontSizeBase100);}\", \".figsok6{font-weight:var(--fontWeightRegular);}\", \".fcpl73t{line-height:var(--lineHeightBase100);}\", \".f10pi13n{position:relative;}\", \".foyynoy{margin-left:var(--spacingHorizontalS);}\", \".f1vcna3q{margin-right:var(--spacingHorizontalS);}\", \".f1wl9k8s::before{content:\\\"\\\";}\", \".f1aocrix::before{display:block;}\", \".f1j7ml58::before{position:absolute;}\", \".f1s1fjay::before{left:calc(var(--spacingHorizontalS) / -2);}\", \".f15a459s::before{right:calc(var(--spacingHorizontalS) / -2);}\", \".f1wl9tmt::before{top:calc((var(--lineHeightBase100) - var(--fontSizeBase100)) / 2);}\", \".f8pn7wt::before{height:var(--fontSizeBase100);}\", \".f1x8pvcy::before{border-left-width:var(--strokeWidthThin);}\", \".f9sc749::before{border-right-width:var(--strokeWidthThin);}\", \".f1jpmc5p::before{border-left-style:solid;}\", \".f1yq6w5o::before{border-right-style:solid;}\", \".fjml6kk::before{border-left-color:var(--colorNeutralStroke2);}\", \".f1geml7w::before{border-right-color:var(--colorNeutralStroke2);}\", \".fmrv4ls{vertical-align:middle;}\", \".fxwmwwq{grid-row-start:content;}\", \".f1e0gndy{grid-column-start:content;}\", \".f4zz6gv{grid-row-end:content;}\", \".f7idnck{grid-column-end:content;}\", \".f1vx9l62{flex-direction:column;}\", \".f1wn3y0l{row-gap:var(--spacingVerticalS);}\", \".f11d4kpn{color:var(--colorNeutralForeground3);}\", \".f9ijwd5{word-break:break-word;}\", \".fjseox{display:none;}\"]\n});\nconst useLabelStyles = __styles({\n root: {\n Ijaq50: \"faq1aip\",\n Br312pm: \"f1m489tg\",\n nk6f5a: \"fv2srd9\",\n Bw0ie65: \"f1tz6hh8\",\n qb2dma: \"f9h729m\",\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fy9rknc\",\n Bhrd7zp: \"fl43uef\",\n Bg96gwp: \"fwrc4pm\",\n Biipf1f: \"f9ijwd5\",\n Fd1uvx: \"fpfc2by\",\n Bh9c35c: \"f1lvsx7g\",\n mc9l5x: \"f1rvi9lw\",\n Bmxbyg5: \"f1sil6mw\"\n },\n canvas: {\n z8tnut: \"f1vd4pcd\"\n },\n sidecar: {\n z8tnut: \"f1u9e4k4\"\n },\n closed: {\n B2u0y6b: \"f6dzj5z\",\n Bh9c35c: \"fvvof4m\"\n }\n}, {\n d: [\".faq1aip{grid-row-start:title;}\", \".f1m489tg{grid-column-start:title;}\", \".fv2srd9{grid-row-end:title;}\", \".f1tz6hh8{grid-column-end:title;}\", \".f9h729m{align-self:start;}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fy9rknc{font-size:var(--fontSizeBase200);}\", \".fl43uef{font-weight:var(--fontWeightSemibold);}\", \".fwrc4pm{line-height:var(--lineHeightBase200);}\", \".f9ijwd5{word-break:break-word;}\", \".fpfc2by{-webkit-box-orient:vertical;}\", \".f1lvsx7g{-webkit-line-clamp:2;}\", \".f1rvi9lw{display:-webkit-box;}\", \".f1sil6mw{overflow-y:hidden;}\", \".f1vd4pcd{padding-top:calc((24px / 2 ) - (var(--lineHeightBase200) - var(--fontSizeBase200)));}\", \".f1u9e4k4{padding-top:calc((16px / 2 ) - (var(--lineHeightBase200) - var(--fontSizeBase200)));}\", \".f6dzj5z{max-width:100%;}\", \".fvvof4m{-webkit-line-clamp:1;}\"]\n});\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = state => {\n const {\n isExpanded,\n mode,\n layout\n } = state;\n const rootClassName = useReferenceClassName();\n const styles = useStyles();\n const labelStyles = useLabelStyles();\n state.root.className = mergeClasses(referenceClassNames.root, rootClassName, styles[mode], styles[layout], !isExpanded && styles.closed, state.root.className);\n if (state.citation) {\n state.citation.className = mergeClasses(referenceClassNames.citation, styles.citation, state.citation.className);\n }\n if (state.media) {\n state.media.className = mergeClasses(referenceClassNames.media, styles.media, layout === 'popover' && styles.mediaPopover, state.media.className);\n }\n if (state.actions) {\n state.actions.className = mergeClasses(referenceClassNames.actions, styles.actions, state.actions.className);\n }\n state.label.className = mergeClasses(referenceClassNames.label, labelStyles.root, labelStyles[mode], !isExpanded && labelStyles.closed, state.label.className);\n if (state.sensitivity) {\n state.sensitivity.className = mergeClasses(referenceClassNames.sensitivity, styles.sensitivity, !isExpanded && styles.hidden, state.sensitivity.className);\n }\n state.metadata.className = mergeClasses(referenceClassNames.metadata, styles.metadata, !isExpanded && styles.hidden, state.metadata.className);\n let isSubsequentText = false;\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(referenceClassNames.primaryText, referenceExtraClassNames.text, isSubsequentText && styles.metadataSubsequentText, state.primaryText.className);\n isSubsequentText = true;\n }\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(referenceClassNames.secondaryText, referenceExtraClassNames.text, isSubsequentText && styles.metadataSubsequentText, state.secondaryText.className);\n isSubsequentText = true;\n }\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(referenceClassNames.tertiaryText, referenceExtraClassNames.text, isSubsequentText && styles.metadataSubsequentText, state.tertiaryText.className);\n isSubsequentText = true;\n }\n if (state.icon) {\n state.icon.className = mergeClasses(referenceClassNames.icon, styles.icon, state.icon.className);\n }\n state.content.className = mergeClasses(referenceClassNames.content, styles.content, !isExpanded && styles.hidden, state.content.className);\n if (state.detailsButton) {\n state.detailsButton.className = mergeClasses(referenceClassNames.detailsButton, styles.detailsButton, state.detailsButton.className);\n }\n return state;\n};\n//# sourceMappingURL=useReferenceStyles.js.map"],"names":["referenceClassNames","referenceExtraClassNames","useReferenceStyles_unstable","root","citation","media","actions","sensitivity","metadata","primaryText","secondaryText","tertiaryText","icon","label","content","detailsButton","text","mediaChild","labelFontSize","typographyStyles","caption1Strong","fontSize","labelLineHeight","lineHeight","maxPopoverWidth","useReferenceClassName","__resetStyles","useStyles","__styles","canvas","sidecar","wkccdc","z8tnut","z189sj","Byoj8tv","uwmqm3","inline","popover","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","a9b677","closed","Belr9w4","Ijaq50","Br312pm","nk6f5a","Bw0ie65","mc9l5x","Bt984gj","Brf1p80","mediaPopover","Bqenvij","psn4ub","vf399t","Bdqf98w","D5xksd","B6of3ja","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","metadataSubsequentText","qhf8xq","Frg6f3","Ftih45","Br0sdwz","Brfgrao","Fbdkly","Bciustq","Baz25je","uvfttm","Bbv0w2i","Bm6vgfq","ha4doy","Beiy3e4","sj55zd","Biipf1f","hidden","d","useLabelStyles","qb2dma","Fd1uvx","Bh9c35c","Bmxbyg5","B2u0y6b","state","isExpanded","mode","layout","rootClassName","styles","labelStyles","className","mergeClasses","isSubsequentText"],"mappings":";;;;;;;;;;;IACaA,mBAAmB;eAAnBA;;IAeAC,wBAAwB;eAAxBA;;IAyJAC,2BAA2B;eAA3BA;;;iCAzKiG;AACvG,MAAMF,sBAAsB;IACjCG,MAAM;IACNC,UAAU;IACVC,OAAO;IACPC,SAAS;IACTC,aAAa;IACbC,UAAU;IACVC,aAAa;IACbC,eAAe;IACfC,cAAc;IACdC,MAAM;IACNC,OAAO;IACPC,SAAS;IACTC,eAAe;AACjB;AACO,MAAMd,2BAA2B;IACtCe,MAAM;IACNC,YAAY;AACd;AACA,MAAMC,gBAAgBC,iCAAgB,CAACC,cAAc,CAACC,QAAQ;AAC9D,MAAMC,kBAAkBH,iCAAgB,CAACC,cAAc,CAACG,UAAU;AAClE,MAAMC,kBAAkB;AACxB,MAAMC,wBAAwBC,IAAAA,8BAAa,EAAC,WAAW,MAAM;IAAC;CAAkuB;AAChyB,MAAMC,YAAYC,IAAAA,yBAAQ,EAAC;IACzBC,QAAQ,CAAC;IACTC,SAAS;QACPC,QAAQ;QACRC,QAAQ;QACRC,QAAQ;YAAC;YAAY;SAAW;QAChCC,SAAS;QACTC,QAAQ;YAAC;YAAY;SAAW;IAClC;IACAC,QAAQ,CAAC;IACTC,SAAS;QACPC,SAAS;QACTC,SAAS;YAAC;YAAY;SAAU;QAChCC,SAAS;QACTC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,QAAQ;QACRV,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,SAAS;QACTC,QAAQ;YAAC;YAAY;SAAU;IACjC;IACAQ,QAAQ;QACNC,SAAS;IACX;IACAxC,UAAU;QACRyC,QA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AAE6E,OAAO7E,aAAa,EAAEwE,MAAMxE,aAAa,CAAC+E,SAAS;IACrI;IACA,OAAOP;AACT,GACA,8CAA8C"}
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n buttonClassNames,\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n media: 'fai-Reference__media',\n actions: 'fai-Reference__actions',\n sensitivity: 'fai-Reference__sensitivity',\n metadata: 'fai-Reference__metadata',\n primaryText: 'fai-Reference__primaryText',\n secondaryText: 'fai-Reference__secondaryText',\n tertiaryText: 'fai-Reference__tertiaryText',\n icon: 'fai-Reference__icon',\n label: 'fai-Reference__label',\n content: 'fai-Reference__content',\n detailsButton: 'fai-Reference__detailsButton',\n};\n\nexport const referenceExtraClassNames = {\n text: 'fai-Reference__text',\n mediaChild: 'fai-Reference__mediaChild',\n};\n\nconst labelFontSize = typographyStyles.caption1Strong.fontSize;\nconst labelLineHeight = typographyStyles.caption1Strong.lineHeight;\n\nconst maxPopoverWidth = '256px';\n\nconst useReferenceClassName = makeResetStyles({\n boxSizing: 'border-box',\n width: '100%',\n display: 'grid',\n gridTemplateAreas: `\n \"citation media title actions\"\n \". . title .\"\n \"sensitivityLabel sensitivityLabel sensitivityLabel sensitivityLabel\"\n \"metadata metadata metadata metadata\"\n \"content content content content\"\n `,\n gridTemplateColumns: 'min-content min-content 1fr min-content',\n gridTemplateRows: '32px auto auto auto auto',\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderRadius: tokens.borderRadiusMedium,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n boxShadow: 'none',\n columnGap: tokens.spacingHorizontalXS,\n alignItems: 'center',\n});\n\nconst useStyles = makeStyles({\n canvas: {},\n sidecar: {\n gridTemplateRows: '24px auto auto auto',\n ...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalS),\n },\n inline: {},\n popover: {\n ...shorthands.borderWidth('0px'),\n width: `calc(${maxPopoverWidth} - (${tokens.spacingHorizontalM} * 2))`,\n ...shorthands.padding('0px'),\n },\n closed: {\n rowGap: 0,\n },\n citation: {\n ...shorthands.gridArea('citation'),\n },\n media: {\n ...shorthands.gridArea('media'),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n mediaPopover: {\n width: '16px',\n height: '16px',\n\n [`> .${referenceExtraClassNames.mediaChild}`]: {\n width: '16px',\n height: '16px',\n },\n },\n actions: {\n ...shorthands.gridArea('actions'),\n justifySelf: 'end',\n display: 'flex',\n gridRowStart: 1,\n },\n detailsButton: {\n [`> ${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground3,\n },\n },\n sensitivity: {\n ...shorthands.gridArea('sensitivityLabel'),\n justifySelf: 'start',\n },\n metadata: {\n marginTop: tokens.spacingVerticalXS,\n\n ...shorthands.gridArea('metadata'),\n ...typographyStyles.caption2,\n },\n metadataSubsequentText: {\n position: 'relative',\n marginLeft: tokens.spacingHorizontalS,\n\n '&::before': {\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n left: `calc(${tokens.spacingHorizontalS} / -2)`,\n top: `calc((${typographyStyles.caption2.lineHeight} - ${typographyStyles.caption2.fontSize}) / 2)`,\n height: typographyStyles.caption2.fontSize,\n ...shorthands.borderLeft(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n },\n icon: {\n ...typographyStyles.caption2,\n verticalAlign: 'middle',\n },\n content: {\n marginTop: tokens.spacingVerticalXS,\n ...shorthands.gridArea('content'),\n display: 'flex',\n flexDirection: 'column',\n rowGap: tokens.spacingVerticalS,\n color: tokens.colorNeutralForeground3,\n wordBreak: 'break-word',\n },\n hidden: {\n display: 'none',\n },\n});\n\nconst useLabelStyles = makeStyles({\n root: {\n ...shorthands.gridArea('title'),\n alignSelf: 'start',\n ...typographyStyles.caption1Strong,\n wordBreak: 'break-word',\n '-webkit-box-orient': 'vertical',\n '-webkit-line-clamp': '2',\n display: '-webkit-box',\n overflowY: 'hidden',\n },\n\n canvas: {\n // 24px is the height of the tallest element within the reference\n paddingTop: `calc((24px / 2 ) - (${labelLineHeight} - ${labelFontSize}))`,\n },\n\n sidecar: {\n // 16px is the height of the tallest element within the reference\n paddingTop: `calc((16px / 2 ) - (${labelLineHeight} - ${labelFontSize}))`,\n },\n\n closed: {\n maxWidth: '100%',\n '-webkit-line-clamp': '1',\n },\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n const { isExpanded, mode, layout } = state;\n\n const rootClassName = useReferenceClassName();\n const styles = useStyles();\n const labelStyles = useLabelStyles();\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootClassName,\n styles[mode],\n styles[layout],\n !isExpanded && styles.closed,\n state.root.className,\n );\n\n if (state.citation) {\n state.citation.className = mergeClasses(referenceClassNames.citation, styles.citation, state.citation.className);\n }\n\n if (state.media) {\n state.media.className = mergeClasses(\n referenceClassNames.media,\n styles.media,\n layout === 'popover' && styles.mediaPopover,\n state.media.className,\n );\n }\n\n if (state.actions) {\n state.actions.className = mergeClasses(referenceClassNames.actions, styles.actions, state.actions.className);\n }\n\n state.label.className = mergeClasses(\n referenceClassNames.label,\n labelStyles.root,\n labelStyles[mode],\n !isExpanded && labelStyles.closed,\n state.label.className,\n );\n\n if (state.sensitivity) {\n state.sensitivity.className = mergeClasses(\n referenceClassNames.sensitivity,\n styles.sensitivity,\n !isExpanded && styles.hidden,\n state.sensitivity.className,\n );\n }\n\n state.metadata.className = mergeClasses(\n referenceClassNames.metadata,\n styles.metadata,\n !isExpanded && styles.hidden,\n state.metadata.className,\n );\n\n let isSubsequentText = false;\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n referenceClassNames.primaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.primaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n referenceClassNames.secondaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.secondaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n referenceClassNames.tertiaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.tertiaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(referenceClassNames.icon, styles.icon, state.icon.className);\n }\n state.content.className = mergeClasses(\n referenceClassNames.content,\n styles.content,\n !isExpanded && styles.hidden,\n state.content.className,\n );\n\n if (state.detailsButton) {\n state.detailsButton.className = mergeClasses(\n referenceClassNames.detailsButton,\n styles.detailsButton,\n state.detailsButton.className,\n );\n }\n\n return state;\n};\n"],"names":["referenceClassNames","referenceExtraClassNames","useReferenceStyles_unstable","root","citation","media","actions","sensitivity","metadata","primaryText","secondaryText","tertiaryText","icon","label","content","detailsButton","text","mediaChild","labelFontSize","typographyStyles","caption1Strong","fontSize","labelLineHeight","lineHeight","maxPopoverWidth","useReferenceClassName","makeResetStyles","boxSizing","__styles","width","display","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","border","strokeWidthThin","borderRadius","padding","spacingVerticalS","boxShadow","columnGap","alignItems","Byoj8tv","uwmqm3","useStyles","makeStyles","sidecar","inline","popover","shorthands","closed","rowGap","nk6f5a","Bt984gj","justifyContent","psn4ub","mediaPopover","height","Bdqf98w","justifySelf","color","Ijaq50","marginTop","Be2twd7","metadataSubsequentText","position","left","top","uvfttm","flexDirection","wordBreak","hidden","Bw0ie65","mc9l5x","Beiy3e4","useLabelStyles","alignSelf","canvas","paddingTop","Br312pm","Bahqtrf","maxWidth","Biipf1f","Fd1uvx","Bh9c35c","Bmxbyg5","rootClassName","z8tnut","styles","state","B2u0y6b","mergeClasses","className","isExpanded","isSubsequentText","mode","layout","labelStyles"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAYaA,mBAAAA;eAAAA;;IAgBAC,wBAAAA;eAAAA;;IAmMXC,2BAAA;eAAAA;;;iCAxNgB;AAKX,MAAMF,sBAAsD;UACjEG;cACAC;WACAC;aACAC;iBACAC;cACAC;iBACAC;mBACAC;kBACAC;UACAC;WACAC;aACAC;mBACAC;AACF;AAEO,MAAMd,2BAA2B;UACtCe;gBACAC;AACF;AAEA,MAAMC,gBAAgBC,iCAAAA,CAAiBC,cAAc,CAACC,QAAQ;AAC9D,MAAMC,kBAAkBH,iCAAAA,CAAiBC,cAAc,CAACG,UAAU;AAElE,MAAMC,kBAAkB;AAExB,MAAMC,wBAAwBC,IAAAA,8BAAAA,EAAAA,WAAgB,MAAA;IAAA;CAAA;MAC5CC,YAAWC,IAAAA,yBAAA,EAAA;YACXC,CAAO;aACPC;QACAC,QAAAA;;;;;;;;;;;;YAMG,CAAA;aACHC;QACAC,SAAAA;QACAC,SAAS;YAAA;YAASC;SAAAA;QAClBC,SAAAA;QACAC,QAAAA;YAAS;YAAUC;SAAAA;QACnBC,QAAAA;QACAC,QAAAA;QACAC,QAAAA;YAAAA;YA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,OAAA,CAAAsF,SAAA,GAAAD,IAAAA,6BAAA,EAAA3F,oBAAAM,OAAA,EAAAkF,OAAAlF,OAAA,EAAAmF,MAAAnF,OAAA,CAAAsF,SAAA;;UAQIH,KAAAA,CAAM1E,SAAAA,GAAAA,IAAAA,6BAAe,EAAAf,oBAAAa,KAAA,EAAAoF,YAAA9F,IAAA,EAAA8F,WAAA,CAAAF,KAAA,EAAA,CAAAF,cAAAI,YAAA/C,MAAA,EAAAuC,MAAA5E,KAAA,CAAA+E,SAAA;cACvBH,WAAM1E,EAAAA;QAKR0E,MAAAlF,WAAA,CAAAqF,SAAA,GAAAD,IAAAA,6BAAA,EAAA3F,oBAAAO,WAAA,EAAAiF,OAAAjF,WAAA,EAAA,CAAAsF,cAAAL,OAAAjB,MAAA,EAAAkB,MAAAlF,WAAA,CAAAqF,SAAA;;IAGAH,MAAAjF,QAAA,CAAAoF,SAAA,GAAAD,IAAAA,6BAAA,EAAA3F,oBAAAQ,QAAA,EAAAgF,OAAAhF,QAAA,EAAA,CAAAqF,cAAAL,OAAAjB,MAAA,EAAAkB,MAAAjF,QAAA,CAAAoF,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceGroupToggle.
|
|
1
|
+
{"version":3,"sources":["ReferenceGroupToggle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceGroupToggle_unstable } from './useReferenceGroupToggle';\nimport { renderReferenceGroupToggle_unstable } from './renderReferenceGroupToggle';\nimport { useReferenceGroupToggleStyles_unstable } from './useReferenceGroupToggleStyles';\nimport type { ReferenceGroupToggleProps } from './ReferenceGroupToggle.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// ReferenceGroupToggle component - TODO: add more docs\nexport const ReferenceGroupToggle: ForwardRefComponent<ReferenceGroupToggleProps> = React.forwardRef((props, ref) => {\n const state = useReferenceGroupToggle_unstable(props, ref);\n\n useReferenceGroupToggleStyles_unstable(state);\n return renderReferenceGroupToggle_unstable(state);\n});\n\nReferenceGroupToggle.displayName = 'ReferenceGroupToggle';\n"],"names":["ReferenceGroupToggle","React","forwardRef","props","state","useReferenceGroupToggle_unstable","useReferenceGroupToggleStyles_unstable","renderReferenceGroupToggle_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;yCAC0B;4CACG;+CACG;AAKhD,MAAMA,uBAAAA,WAAAA,GAAAA,OAAuEC,UAAMC,CAAU,CAACC,OAACA;UACpGC,QAAMA,IAAAA,yDAAQC,EAAAA,OAAiCF;6EAE/CG,EAAAA;WACAC,IAAAA,+DAAOA,EAAAA;AACT;AAEAP,qBAAqBQ,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceGroupToggle.types.
|
|
1
|
+
{"version":3,"sources":["ReferenceGroupToggle.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceGroupToggleSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n};\n\n/**\n * ReferenceGroupToggle Props\n */\nexport type ReferenceGroupToggleProps = ComponentProps<ReferenceGroupToggleSlots> & {\n isOpen?: boolean;\n};\n\n/**\n * State used in rendering ReferenceGroupToggle\n */\nexport type ReferenceGroupToggleState = ComponentState<ReferenceGroupToggleSlots> &\n Required<Pick<ReferenceGroupToggleProps, 'isOpen'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAcA;;CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ReferenceGroupToggle';\nexport * from './ReferenceGroupToggle.types';\nexport * from './renderReferenceGroupToggle';\nexport * from './useReferenceGroupToggle';\nexport * from './useReferenceGroupToggleStyles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceGroupToggle.
|
|
1
|
+
{"version":3,"sources":["renderReferenceGroupToggle.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { ReferenceGroupToggleState, ReferenceGroupToggleSlots } from './ReferenceGroupToggle.types';\n\n/**\n * Render the final JSX of ReferenceGroupToggle\n */\nexport const renderReferenceGroupToggle_unstable = (state: ReferenceGroupToggleState) => {\n assertSlots<ReferenceGroupToggleSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.icon && <state.icon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","state","root","children","icon","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUEA;;;eAAAA;;;4BATF;iCAE4B;AAO1BA,MAAAA,sCAAuCC,CAAAA;oCAEvC,EAAAA;;kBAEKA;YAAAA,MAAMC,IAAKC,CAAAA,QAAQ;YAAAF,MAAAG,IAAA,IAAA,WAAA,GAAAC,IAAAA,eAAA,EAAAJ,MAAAG,IAAA,EAAA,CAAA;SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceGroupToggle.
|
|
1
|
+
{"version":3,"sources":["useReferenceGroupToggle.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport { ChevronDown16Regular, ChevronUp16Regular } from '@fluentui/react-icons';\nimport type { ReferenceGroupToggleProps, ReferenceGroupToggleState } from './ReferenceGroupToggle.types';\n\n/**\n * Create the state required to render ReferenceGroupToggle.\n *\n * The returned state can be modified with hooks such as useReferenceGroupToggleStyles_unstable,\n * before being passed to renderReferenceGroupToggle_unstable.\n *\n * @param props - props from this instance of ReferenceGroupToggle\n * @param ref - reference to root HTMLElement of ReferenceGroupToggle\n */\nexport const useReferenceGroupToggle_unstable = (\n props: ReferenceGroupToggleProps,\n ref: React.Ref<HTMLButtonElement>,\n): ReferenceGroupToggleState => {\n const { isOpen = false } = props;\n\n return {\n isOpen,\n components: {\n root: 'button',\n icon: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n 'aria-expanded': isOpen,\n type: 'button',\n ...props,\n }),\n { elementType: 'button' },\n ),\n icon: slot.optional(props.icon, {\n defaultProps: {\n children: isOpen ? <ChevronUp16Regular /> : <ChevronDown16Regular />,\n },\n renderByDefault: true,\n elementType: 'span',\n }),\n };\n};\n"],"names":["isOpen","props","root","ref","type","getIntrinsicElementProps","elementType","icon","defaultProps","optional","renderByDefault","React","createElement","ChevronUp16Regular","ChevronDown16Regular"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBUA;;;eAAAA;;;;iEAlBa;iCACwB;4BACU;AAgBvD,MAAQA,mCAAmBC,CAAAA,OAAAA;UAE3B,WACED,KAAAA;;;oBAIA;kBACAE;kBAEIC;;mCAEAC,CAAAA,MAAM,CAAAC,IAAAA,yCAAA,EAAA,UAAA;;6BAGRL;kBAAEM;eAAsBL,KAAA;YAE1BM;yBACEC;;mCAEA,CAAAC,QAAA,CAAAR,MAAAM,IAAA,EAAA;0BACAG;0BACAJ,SAAa,WAAA,GAAAK,OAAAC,aAAA,CAAAC,8BAAA,EAAA,QAAA,WAAA,GAAAF,OAAAC,aAAA,CAAAE,gCAAA,EAAA;;YAEjBJ,iBAAA;YACAJ,aAAA"}
|