@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":["useReferenceGroupToggleStyles.
|
|
1
|
+
{"version":3,"sources":["useReferenceGroupToggleStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ReferenceGroupToggleSlots, ReferenceGroupToggleState } from './ReferenceGroupToggle.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceGroupToggleClassNames: SlotClassNames<ReferenceGroupToggleSlots> = {\n root: 'fai-ReferenceGroupToggle',\n icon: 'fai-ReferenceGroupToggle__icon',\n};\n\nconst useButtonBaseClassName = makeResetStyles({\n display: 'inline-flex',\n columnGap: tokens.spacingHorizontalSNudge,\n alignItems: 'center',\n ...typographyStyles.caption1,\n border: 0,\n backgroundColor: tokens.colorTransparentBackground,\n color: tokens.colorNeutralForeground3,\n cursor: 'pointer',\n width: 'max-content',\n ...shorthands.padding(tokens.spacingVerticalXS, 0),\n});\n\nconst useIconBaseClassName = makeResetStyles({\n display: 'inline-flex',\n alignItems: 'center',\n});\n\n/**\n * Apply styling to the ReferenceGroupToggle slots based on the state\n */\nexport const useReferenceGroupToggleStyles_unstable = (state: ReferenceGroupToggleState): ReferenceGroupToggleState => {\n const iconBaseClassName = useIconBaseClassName();\n const buttonBaseClassName = useButtonBaseClassName();\n state.root.className = mergeClasses(referenceGroupToggleClassNames.root, buttonBaseClassName, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(referenceGroupToggleClassNames.icon, iconBaseClassName, state.icon.className);\n }\n\n return state;\n};\n"],"names":["referenceGroupToggleClassNames","useReferenceGroupToggleStyles_unstable","root","icon","useButtonBaseClassName","makeResetStyles","display","__resetStyles","border","state","backgroundColor","colorTransparentBackground","color","colorNeutralForeground3","cursor","className","mergeClasses","buttonBaseClassName","width","shorthands","padding","tokens","spacingVerticalXS","iconBaseClassName","useIconBaseClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,8BAAAA;eAAAA;;IAUHC,sCAAA;eAAAA;;;iCAdkE;AAIrE,MAAMD,iCAA4E;UACvFE;UACAC;AACF;AAEA,MAAMC,yBAAyBC,IAAAA,8BAAAA,EAAAA,WAAgB,WAAA;IAAA;IAAA;CAAA;MAC7CC,uBAASC,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;CAAA;AAITC,MAAQP,yCAAAQ,CAAAA;UACRC,oBAAwBC;UACxBC,sBAAcC;UACdC,IAAQ,CAAAC,SAAA,GAAAC,IAAAA,6BAAA,EAAAhB,+BAAAE,IAAA,EAAAe,qBAAAR,MAAAP,IAAA,CAAAa,SAAA;QACRG,MAAOf,IAAA,EAAA;QACPM,MAAGU,IAAAA,CAAAA,SAAWC,GAAQC,IAAAA,6BAAOC,EAAAA,+BAAqBnB,IAAA,EAAAoB,mBAAAd,MAAAN,IAAA,CAAAY,SAAA;IACpD;IAEA,OAAMS;4DAEQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.
|
|
1
|
+
{"version":3,"sources":["ReferenceList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceList_unstable } from './useReferenceList';\nimport { renderReferenceList_unstable } from './renderReferenceList';\nimport { useReferenceListStyles_unstable } from './useReferenceListStyles';\nimport type { ReferenceListProps } from './ReferenceList.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { useCustomStyleHook } from '@fluentui-copilot/react-provider';\n\n//ReferenceList component - TODO: add more docs\nexport const ReferenceList: ForwardRefComponent<ReferenceListProps> = React.forwardRef((props, ref) => {\n const state = useReferenceList_unstable(props, ref);\n\n useReferenceListStyles_unstable(state);\n useCustomStyleHook('useReferenceListStyles')(state);\n\n return renderReferenceList_unstable(state);\n});\n\nReferenceList.displayName = 'ReferenceList';\n"],"names":["ReferenceList","React","forwardRef","props","state","useReferenceList_unstable","useReferenceListStyles_unstable","useCustomStyleHook","renderReferenceList_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;;iEATU;kCACmB;qCACG;wCACG;+BAGb;AAG5B,MAAMA,gBAAAA,WAAAA,GAAAA,OAAyDC,UAAMC,CAAU,CAACC,OAACA;UACtFC,QAAMA,IAAAA,2CAAQC,EAAAA,OAA0BF;+DAExCG,EAAAA;yCACAC,EAAAA,0BAAmBH;WAEnBI,IAAAA,iDAAOA,EAAAA;AACT;AAEAR,cAAcS,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.types.
|
|
1
|
+
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceListSlots = {\n /**\n * The root slot.\n */\n root: Slot<'ol'>;\n};\n\n/**\n * ReferenceList Props\n */\nexport type ReferenceListProps = ComponentProps<ReferenceListSlots>;\n\n/**\n * State used in rendering ReferenceList\n */\nexport type ReferenceListState = ComponentState<ReferenceListSlots>;\n"],"names":[],"rangeMappings":";;","mappings":"AAcA;;CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ReferenceList';\nexport * from './ReferenceList.types';\nexport * from './renderReferenceList';\nexport * from './useReferenceList';\nexport * from './useReferenceListStyles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceList.
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots } from './ReferenceList.types';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState) => {\n assertSlots<ReferenceListSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","state","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAUEA;;;eAAAA;;;4BAVwB;iCAGE;AAO1BA,MAAAA,+BAAgCC,CAAAA;oCAEhC,EAAAA;IACA,OAAA,WAAA,GAAAC,IAAAA,eAAA,EAAAD,MAAAE,IAAA,EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceList.
|
|
1
|
+
{"version":3,"sources":["useReferenceList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport type { ReferenceListProps, ReferenceListState } from './ReferenceList.types';\nimport { referenceListItemClassName } from './useReferenceListStyles';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render ReferenceList.\n *\n * The returned state can be modified with hooks such as useReferenceListStyles_unstable,\n * before being passed to renderReferenceList_unstable.\n *\n * @param props - props from this instance of ReferenceList\n * @param ref - reference to root HTMLElement of ReferenceList\n */\nexport const useReferenceList_unstable = (\n props: ReferenceListProps,\n ref: React.Ref<HTMLOListElement>,\n): ReferenceListState => {\n return {\n components: {\n root: 'ol',\n },\n root: slot.always(\n getIntrinsicElementProps('ol', {\n ref,\n ...props,\n children: React.Children.map(props.children, child => <li className={referenceListItemClassName}>{child}</li>),\n }),\n { elementType: 'ol' },\n ),\n };\n};\n"],"names":["useReferenceList_unstable","props","ref","components","root","children","className","referenceListItemClassName","child"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBSA;;;eAAAA;;;;iEApBc;iCACwB;wCAEJ;AAiBzC,MAAOA,4BAAA,CAAAC,OAAAC;WACLC;oBACEC;kBACF;;mCAGIF,CAAAA,MAAAA,CAAAA,IAAAA,yCAAAA,EAAAA,MAAAA;;oBAEAG;6BAA0DC,QAAAA,CAAWC,GAAAA,CAAAA,MAAAA,QAAAA,EAAAA,CAAAA,QAAAA,WAAAA,GAAAA,OAAAA,aAAAA,CAAAA,MAAAA;+BAA6BC,kDAAAA;mBACpGA;;yBACoB;QAExB;IACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceListStyles.
|
|
1
|
+
{"version":3,"sources":["useReferenceListStyles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens } from '@fluentui/react-components';\nimport type { ReferenceListSlots, ReferenceListState } from './ReferenceList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceListClassNames: SlotClassNames<ReferenceListSlots> = {\n root: 'fai-ReferenceList',\n};\n\nexport const referenceListItemClassName = 'fai-ReferenceList__item';\n\n/**\n * Styles for the root slot\n */\nconst useRootClassName = makeResetStyles({\n padding: 0,\n margin: 0,\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalS,\n\n [`> .${referenceListItemClassName}`]: {\n listStyleType: 'none',\n },\n});\n\n/**\n * Apply styling to the ReferenceList slots based on the state\n */\nexport const useReferenceListStyles_unstable = (state: ReferenceListState): ReferenceListState => {\n state.root.className = mergeClasses(referenceListClassNames.root, useRootClassName(), state.root.className);\n\n return state;\n};\n"],"names":["referenceListClassNames","referenceListItemClassName","tokens","root","padding","__resetStyles","gap","state","useRootClassName","className","listStyleType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,uBAAAA;eAAAA;;IAIAC,0BAAAA;eAAAA;;IAUNC,+BAAuB;eAAvBA;;;iCAlBuC;AAIvC,MAAMF,0BAA8D;UACzEG;AACF;AAEO,MAAMF,6BAA6B;AAE1C;;CAEC,SAECG,mBAASC,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;IAAA;CAAA;AAITC,MAAKJ,kCAAuBK,CAAAA;UAE1BJ,IAAKF,CAAAA,SAAAA,GAAAA,IAAAA,6BAAAA,EAA2BD,wBAAIG,IAAA,EAAAK,oBAAAD,MAAAJ,IAAA,CAAAM,SAAA;WACpCC;GAEJ,kDAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Reference", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Reference;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _useReference = require("./useReference");
|
|
14
|
+
const _renderReference = require("./renderReference");
|
|
15
|
+
const _useReferenceStyles = require("./useReferenceStyles");
|
|
16
|
+
const Reference = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
|
+
const state = (0, _useReference.useReference_unstable)(props, ref);
|
|
18
|
+
(0, _useReferenceStyles.useReferenceStyles_unstable)(state);
|
|
19
|
+
return (0, _renderReference.renderReference_unstable)(state);
|
|
20
|
+
});
|
|
21
|
+
Reference.displayName = 'Reference'; //# sourceMappingURL=Reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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';\n\nexport const Reference: ForwardRefComponent<ReferenceProps> = React.forwardRef((props, ref) => {\n const state = useReference_unstable(props, ref);\n\n useReferenceStyles_unstable(state);\n return renderReference_unstable(state);\n});\n\nReference.displayName = 'Reference';\n"],"names":["Reference","React","forwardRef","props","state","useReference_unstable","useReferenceStyles_unstable","renderReference_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;8BACe;iCACG;oCACG;AAIrC,MAAMA,YAAAA,WAAAA,GAAAA,OAAiDC,UAAMC,CAAU,CAACC,OAACA;UAC9EC,QAAMA,IAAAA,mCAAQC,EAAAA,OAAsBF;uDAEpCG,EAAAA;WACAC,IAAAA,yCAAOA,EAAAA;AACT;AAEAP,UAAUQ,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n media?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {\n /**\n * The appearance of the reference.\n * @default 'lighter'\n */\n appearance?: 'lighter' | 'darker';\n};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'appearance' | 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
referenceClassNames: function() {
|
|
13
|
+
return _useReferenceStyles.referenceClassNames;
|
|
14
|
+
},
|
|
15
|
+
referenceExtraClassNames: function() {
|
|
16
|
+
return _useReferenceStyles.referenceExtraClassNames;
|
|
17
|
+
},
|
|
18
|
+
useReferenceStyles_unstable: function() {
|
|
19
|
+
return _useReferenceStyles.useReferenceStyles_unstable;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
23
|
+
_export_star._(require("./Reference"), exports);
|
|
24
|
+
_export_star._(require("./Reference.types"), exports);
|
|
25
|
+
_export_star._(require("./renderReference"), exports);
|
|
26
|
+
_export_star._(require("./useReference"), exports);
|
|
27
|
+
const _useReferenceStyles = require("./useReferenceStyles");
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Reference';\nexport * from './Reference.types';\nexport * from './renderReference';\nexport * from './useReference';\nexport { referenceClassNames, referenceExtraClassNames, useReferenceStyles_unstable } from './useReferenceStyles';\n"],"names":["referenceClassNames","referenceExtraClassNames","useReferenceStyles_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAISA,mBAAmB;eAAnBA,uCAAmB;;IAAEC,wBAAwB;eAAxBA,4CAAwB;;IAAEC,2BAA2B;eAA3BA,+CAA2B;;;;uBAJrE;uBACA;uBACA;uBACA;oCAC6E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "renderReference_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return renderReference_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
13
|
+
const renderReference_unstable = (state)=>{
|
|
14
|
+
(0, _reactcomponents.assertSlots)(state);
|
|
15
|
+
const { id, shouldUseOverflow } = state;
|
|
16
|
+
const reference = /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
|
17
|
+
children: [
|
|
18
|
+
state.citation && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.citation, {}),
|
|
19
|
+
state.divider && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.divider, {}),
|
|
20
|
+
state.content && /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.content, {
|
|
21
|
+
children: [
|
|
22
|
+
state.media && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.media, {}),
|
|
23
|
+
state.root.children
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
return shouldUseOverflow ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.OverflowItem, {
|
|
29
|
+
id: id,
|
|
30
|
+
children: reference
|
|
31
|
+
}, id) : reference;
|
|
32
|
+
}; //# sourceMappingURL=renderReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.media && <state.media />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["renderReference_unstable","state","assertSlots","id","divider","_jsxs","root","content","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMaA;;;eAAAA;;;4BALb;iCAE0C;AAGnC,MAAMA,2BAA2BC,CAAAA;oCACtCC,EAAAA;UAEA,EAEAC,EAAA;sBAGWC,WAAO,GAAAC,IAAAA,gBAAA,EAAAJ,MAAIK,IAACL,EAAAA;kBAClBA;YAAAA,MAAMM,QAAO,IAAA,WACZ,GAAAC,IAAAA,eAACP,EAAAA,MAAMM,QAAO,EAAA,CAAA;YAAAN,MAAAG,OAAA,IAAA,WAAA,GAAAI,IAAAA,eAAA,EAAAP,MAAAG,OAAA,EAAA,CAAA;YAAAH,MAAAM,OAAA,IAAA,WAAA,GAAAF,IAAAA,gBAAA,EAAAJ,MAAAM,OAAA,EAAA;;;;;;;;;;;;8CASSJ"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useReference_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useReference_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
14
|
+
const _referenceListContext = require("../../../contexts/reference-v2/referenceListContext");
|
|
15
|
+
const _useReferenceStyles = require("./useReferenceStyles");
|
|
16
|
+
const useReference_unstable = (props, ref)=>{
|
|
17
|
+
const { children, id } = props;
|
|
18
|
+
const { ctxAppearance, shouldUseOverflow } = (0, _referenceListContext.useReferenceListContext_unstable)((ctx)=>({
|
|
19
|
+
ctxAppearance: ctx.appearance,
|
|
20
|
+
shouldUseOverflow: ctx.shouldUseOverflow
|
|
21
|
+
}));
|
|
22
|
+
const appearance = props.appearance || ctxAppearance;
|
|
23
|
+
const referenceId = (0, _reactcomponents.useId)('reference-', id);
|
|
24
|
+
const citation = _reactcomponents.slot.optional(props.citation, {
|
|
25
|
+
elementType: 'span'
|
|
26
|
+
});
|
|
27
|
+
const media = _reactcomponents.slot.optional(props.media, {
|
|
28
|
+
elementType: 'span'
|
|
29
|
+
});
|
|
30
|
+
const content = _reactcomponents.slot.optional(props.content, {
|
|
31
|
+
elementType: 'span',
|
|
32
|
+
renderByDefault: media !== undefined || !!children
|
|
33
|
+
});
|
|
34
|
+
const divider = _reactcomponents.slot.optional(props.divider, {
|
|
35
|
+
elementType: 'span',
|
|
36
|
+
renderByDefault: citation !== undefined && content !== undefined
|
|
37
|
+
});
|
|
38
|
+
const state = {
|
|
39
|
+
appearance,
|
|
40
|
+
id: referenceId,
|
|
41
|
+
shouldUseOverflow,
|
|
42
|
+
components: {
|
|
43
|
+
root: 'button',
|
|
44
|
+
citation: 'span',
|
|
45
|
+
divider: 'span',
|
|
46
|
+
media: 'span',
|
|
47
|
+
content: 'span'
|
|
48
|
+
},
|
|
49
|
+
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('button', {
|
|
50
|
+
ref,
|
|
51
|
+
...props,
|
|
52
|
+
id: referenceId
|
|
53
|
+
}), {
|
|
54
|
+
elementType: 'button'
|
|
55
|
+
}),
|
|
56
|
+
citation,
|
|
57
|
+
divider,
|
|
58
|
+
content,
|
|
59
|
+
media
|
|
60
|
+
};
|
|
61
|
+
if (state.media && /*#__PURE__*/ _react.isValidElement(state.media.children)) {
|
|
62
|
+
state.media.children = /*#__PURE__*/ _react.cloneElement(state.media.children, {
|
|
63
|
+
className: (0, _reactcomponents.mergeClasses)(state.media.children.props.className, _useReferenceStyles.referenceExtraClassNames.mediaChild)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return state;
|
|
67
|
+
}; //# sourceMappingURL=useReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\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<HTMLButtonElement>): ReferenceState => {\n const { children, id } = props;\n\n const { ctxAppearance, shouldUseOverflow } = useReferenceListContext_unstable(ctx => ({\n ctxAppearance: ctx.appearance,\n shouldUseOverflow: ctx.shouldUseOverflow,\n }));\n const appearance = props.appearance || ctxAppearance;\n\n const referenceId = useId('reference-', id);\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const media = slot.optional(props.media, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: media !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n appearance,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n media: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n ...props,\n id: referenceId,\n }),\n { elementType: 'button' },\n ),\n citation,\n divider,\n content,\n media,\n };\n\n if (state.media && React.isValidElement<HTMLElement>(state.media.children)) {\n state.media.children = React.cloneElement(state.media.children, {\n className: mergeClasses(state.media.children.props.className, referenceExtraClassNames.mediaChild),\n });\n }\n\n return state;\n};\n"],"names":["children","props","ctxAppearance","referenceId","shouldUseOverflow","slot","ctx","appearance","optional","content","elementType","citation","renderByDefault","media","divider","state","components","undefined","ref","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBUA;;;eAAAA;;;;iEAhBa;iCAC6C;sCACnB;oCACR;AAavC,MAAQA,wBAAiBC,CAAAA,OAAAA;UAEzB,UACEC;UAGF,EAEAA,aAAMC,EAENC,iBAAiBC,+DAA6C,EAAAC,CAAAA,MAAA,CAAA;YAAOJ,eAAAI,IAAAC,UAAA;YACrEH,mBAAmBI,IAAAA,iBAAoB;;UAAwBD,aAAAN,MAAAM,UAAA,IAAAL;UAC/DC,cAAgBE,IAAAA,sBAAKG,EAAAA,cAAeC;UAClCC,WAAAA,qBAAa,CAAAF,QAAA,CAAAP,MAAAU,QAAA,EAAA;qBACbC;;UAEFC,QAAMC,qBAAUT,CAAAA,QAAKG,CAAAA,MAASP,KAAMa,EAAAA;qBAClCJ;;UAEFD,UAAAJ,qBAAA,CAAAG,QAAA,CAAAP,MAAAQ,OAAA,EAAA;QAEAC,aAAMK;yBACJR,UAAAA,aAAAA,CAAAA,CAAAA;;UAEAH,UAAAA,qBAAAA,CAAAA,QAAAA,CAAAA,MAAAA,OAAAA,EAAAA;qBAEAY;yBACQL,aAAAM,aAAAR,YAAAQ;;kBAENH;;;;oBAKIT;kBAEFa;sBACGjB;qBACHkB;mBAEF;qBAAET;;cAEJC,qBAAAA,CAAAA,MAAAA,CAAAA,IAAAA,yCAAAA,EAAAA,UAAAA;;eAEAF,KAAAA;gBACAI;QACF,IAAA;YAEAH,aAAe;;;;QAIfD;QAEAI;IACA"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
referenceClassNames: function() {
|
|
13
|
+
return referenceClassNames;
|
|
14
|
+
},
|
|
15
|
+
referenceExtraClassNames: function() {
|
|
16
|
+
return referenceExtraClassNames;
|
|
17
|
+
},
|
|
18
|
+
useReferenceStyles_unstable: function() {
|
|
19
|
+
return useReferenceStyles_unstable;
|
|
20
|
+
},
|
|
21
|
+
useRootStyles: function() {
|
|
22
|
+
return useRootStyles;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
26
|
+
const referenceClassNames = {
|
|
27
|
+
root: 'fai-Reference',
|
|
28
|
+
citation: 'fai-Reference__citation',
|
|
29
|
+
divider: 'fai-Reference__divider',
|
|
30
|
+
media: 'fai-Reference__media',
|
|
31
|
+
content: 'fai-Reference__content'
|
|
32
|
+
};
|
|
33
|
+
const referenceExtraClassNames = {
|
|
34
|
+
mediaChild: 'fai-Reference__mediaChild'
|
|
35
|
+
};
|
|
36
|
+
const MEDIA_SIZE = '16px';
|
|
37
|
+
const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r1aeqif9", null, [
|
|
38
|
+
".r1aeqif9{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);}",
|
|
39
|
+
".r1aeqif9:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}",
|
|
40
|
+
".r1aeqif9:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}",
|
|
41
|
+
".r1aeqif9:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}",
|
|
42
|
+
".r1aeqif9:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}"
|
|
43
|
+
]);
|
|
44
|
+
const useRootStyles = (0, _reactcomponents.__styles)({
|
|
45
|
+
darker: {
|
|
46
|
+
De3pzq: "f3vzo32",
|
|
47
|
+
g2u3we: "fj3muxo",
|
|
48
|
+
h3c5rm: [
|
|
49
|
+
"f1akhkt",
|
|
50
|
+
"f1lxtadh"
|
|
51
|
+
],
|
|
52
|
+
B9xav0g: "f1aperda",
|
|
53
|
+
zhjwy3: [
|
|
54
|
+
"f1lxtadh",
|
|
55
|
+
"f1akhkt"
|
|
56
|
+
],
|
|
57
|
+
Jwef8y: "f14vf7cg",
|
|
58
|
+
iro3zm: "fho4vwd"
|
|
59
|
+
},
|
|
60
|
+
overflow: {
|
|
61
|
+
a9b677: "fly5x3f"
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
d: [
|
|
65
|
+
".f3vzo32{background-color:var(--colorNeutralBackground5);}",
|
|
66
|
+
".fj3muxo{border-top-color:var(--colorNeutralStroke1);}",
|
|
67
|
+
".f1akhkt{border-right-color:var(--colorNeutralStroke1);}",
|
|
68
|
+
".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}",
|
|
69
|
+
".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}",
|
|
70
|
+
".fly5x3f{width:100%;}"
|
|
71
|
+
],
|
|
72
|
+
h: [
|
|
73
|
+
".f14vf7cg:hover{background-color:var(--colorNeutralBackground5Hover);}",
|
|
74
|
+
".fho4vwd:hover:active{background-color:var(--colorNeutralBackground5Pressed);}"
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
const useCitationBaseClassName = (0, _reactcomponents.__resetStyles)("rzdip90", null, [
|
|
78
|
+
".rzdip90{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightSemibold);line-height:var(--lineHeightBase100);}"
|
|
79
|
+
]);
|
|
80
|
+
const useDividerBaseClassName = (0, _reactcomponents.__resetStyles)("r1eyqaw5", null, [
|
|
81
|
+
".r1eyqaw5{background-color:var(--colorNeutralStroke2);height:16px;margin:var(--spacingVerticalNone) var(--spacingHorizontalXS);width:1px;}"
|
|
82
|
+
]);
|
|
83
|
+
const useDividerStyles = (0, _reactcomponents.__styles)({
|
|
84
|
+
darker: {
|
|
85
|
+
De3pzq: "f1d3jkam"
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
d: [
|
|
89
|
+
".f1d3jkam{background-color:var(--colorNeutralStroke1);}"
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
const useMediaBaseClassName = (0, _reactcomponents.__resetStyles)("r4nw7iy", null, [
|
|
93
|
+
".r4nw7iy{font-size:16px;height:16px;line-height:16px;width:16px;}",
|
|
94
|
+
".r4nw7iy>.fai-Reference__mediaChild{height:16px;width:16px;}"
|
|
95
|
+
]);
|
|
96
|
+
const useContentBaseClassName = (0, _reactcomponents.__resetStyles)("r1yvxokd", null, [
|
|
97
|
+
".r1yvxokd{column-gap:var(--spacingHorizontalSNudge);display:inline-flex;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
|
|
98
|
+
]);
|
|
99
|
+
const useReferenceStyles_unstable = (state)=>{
|
|
100
|
+
const { appearance } = state;
|
|
101
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
102
|
+
const citationBaseClassName = useCitationBaseClassName();
|
|
103
|
+
const dividerBaseClassName = useDividerBaseClassName();
|
|
104
|
+
const contentBaseClassName = useContentBaseClassName();
|
|
105
|
+
const mediaBaseClassName = useMediaBaseClassName();
|
|
106
|
+
const rootStyles = useRootStyles();
|
|
107
|
+
const dividerStyles = useDividerStyles();
|
|
108
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.root, rootBaseClassName, appearance === 'darker' && rootStyles.darker, state.root.className);
|
|
109
|
+
if (state.citation) {
|
|
110
|
+
state.citation.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.citation, citationBaseClassName, state.citation.className);
|
|
111
|
+
}
|
|
112
|
+
if (state.divider) {
|
|
113
|
+
state.divider.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.divider, dividerBaseClassName, appearance === 'darker' && dividerStyles.darker, state.divider.className);
|
|
114
|
+
}
|
|
115
|
+
if (state.content) {
|
|
116
|
+
state.content.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
117
|
+
}
|
|
118
|
+
if (state.media) {
|
|
119
|
+
state.media.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.media, mediaBaseClassName, state.media.className);
|
|
120
|
+
}
|
|
121
|
+
return state;
|
|
122
|
+
}; //# sourceMappingURL=useReferenceStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\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 divider: 'fai-Reference__divider',\n media: 'fai-Reference__media',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n mediaChild: 'fai-Reference__mediaChild',\n};\n\nconst MEDIA_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n darker: {\n backgroundColor: tokens.colorNeutralBackground5,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground5Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground5Pressed,\n },\n },\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useDividerStyles = makeStyles({\n darker: {\n backgroundColor: tokens.colorNeutralStroke1,\n },\n});\n\nconst useMediaBaseClassName = makeResetStyles({\n fontSize: MEDIA_SIZE,\n height: MEDIA_SIZE,\n lineHeight: MEDIA_SIZE,\n width: MEDIA_SIZE,\n\n [`> .${referenceExtraClassNames.mediaChild}`]: {\n height: MEDIA_SIZE,\n width: MEDIA_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n const { appearance } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n\n const rootStyles = useRootStyles();\n const dividerStyles = useDividerStyles();\n\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootBaseClassName,\n appearance === 'darker' && rootStyles.darker,\n state.root.className,\n );\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(\n referenceClassNames.divider,\n dividerBaseClassName,\n appearance === 'darker' && dividerStyles.darker,\n state.divider.className,\n );\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.media) {\n state.media.className = mergeClasses(referenceClassNames.media, mediaBaseClassName, state.media.className);\n }\n\n return state;\n};\n"],"names":["referenceClassNames","referenceExtraClassNames","shorthands","tokens","alignItems","root","citation","divider","media","content","mediaChild","MEDIA_SIZE","useRootBaseClassName","makeResetStyles","__styles","backgroundColor","border","borderRadius","boxSizing","color","columnGap","spacingHorizontalXXS","display","flexShrink","padding","a9b677","__resetStyles","useDividerBaseClassName","useDividerStyles","borderColor","useMediaBaseClassName","useContentBaseClassName","colorNeutralStroke1","rootBaseClassName","dividerBaseClassName","contentBaseClassName","overflow","width","useRootStyles","dividerStyles","state","className","mergeClasses","appearance","rootStyles","darker","useCitationBaseClassName","typographyStyles","caption2Strong","citationBaseClassName","colorNeutralStroke2","margin","mediaBaseClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAWaA,mBAAAA;eAAAA;;IAQAC,wBAAAA;eAAAA;;IA2CNC,2BAAuBC;eAAvBD;;IApCLE,aAAY;eAAZA;;;iCApBgB;AAKX,MAAMJ,sBAAsD;UACjEK;cACAC;aACAC;WACAC;aACAC;AACF;AAEO,MAAMR,2BAA2B;gBACtCS;AACF;AAEA,MAAMC,aAAa;AAEnB,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,YAAgB,MAAA;IAAA;IAAA;IAAA;IAAA;IAAA;CAAA;AAC3CT,MAAAA,gBAAYU,IAAAA,yBAAA,EAAA;YACZC;QACAC,QAAQ;QACRC,QAAAA;QACAC,QAAAA;YAAAA;YAAW;SAAA;QACXC,SAAOhB;QACPiB,QAAAA;YAAAA;YAAkBC;SAAAA;QAClBC,QAAAA;QACAC,QAAAA;;cAEAC;QAEAC,QAAA;;;;;QAG4C;QAAA;QAAA;QAAA;QAAA;KAAA;;;QAEH;KAAA;;iCAEvCC,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;CAAA;MACFC,0BAAAD,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MAEAE,mBAAiBd,IAAAA,yBAAA,EAAA;YACfC;gBACAc;;;;;KAIoD;;MAEtDC,wBAAAJ,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;IAAA;CAAA;AACF,MAAAK,0BAAAL,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MAKOxB,8BAA8B8B,CAAAA;UAEjC,YACEjB;UAGFkB,oBAAiBrB;kCACET;UACnB+B,uBAAAP;UACFQ,uBAAAJ;UACAK,qBAAUN;UACRO,aAAOC;UACTC,gBAAAX;IACFY,MAAGnC,IAAA,CAAAoC,SAAA,GAAAC,IAAAA,6BAAA,EAAA1C,oBAAAK,IAAA,EAAA4B,mBAAAU,eAAA,YAAAC,WAAAC,MAAA,EAAAL,MAAAnC,IAAA,CAAAoC,SAAA;IAEH,IAAMK,MAAAA,QAAAA,EAAAA;QACJN,MAAGO,QAAAA,CAAAA,SAAiBC,GAAAA,IAAAA,6BAAc,EAAAhD,oBAAAM,QAAA,EAAA2C,uBAAAT,MAAAlC,QAAA,CAAAmC,SAAA;IACpC;IAEA,IAAMd,MAAAA,OAAAA,EAAAA;QACJZ,MAAAA,OAAAA,CAAAA,SAAiBZ,GAAO+C,IAAAA,6BAAAA,EAAAA,oBAAmB3C,OAAA,EAAA2B,sBAAAS,eAAA,YAAAJ,cAAAM,MAAA,EAAAL,MAAAjC,OAAA,CAAAkC,SAAA;;QAE3CU,MAAQ1C,OAAGN,EAAAA;QACXkC,MAAAA,OAAO,CAAAI,SAAA,GAAAC,IAAAA,6BAAA,EAAA1C,oBAAAS,OAAA,EAAA0B,sBAAAK,MAAA/B,OAAA,CAAAgC,SAAA;IACT;IAEA,IAAMb,MAAAA,KAAAA,EAAAA;QACJiB,MAAAA,KAAQ,CAAAJ,SAAA,GAAAC,IAAAA,6BAAA,EAAA1C,oBAAAQ,KAAA,EAAA4C,oBAAAZ,MAAAhC,KAAA,CAAAiC,SAAA;;WAERD;AACF,GAEA,8CAA8C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ReferenceList", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ReferenceList;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _renderReferenceList = require("./renderReferenceList");
|
|
14
|
+
const _useReferenceList = require("./useReferenceList");
|
|
15
|
+
const _useReferenceListStyles = require("./useReferenceListStyles");
|
|
16
|
+
const _useReferenceListContextValues = require("./useReferenceListContextValues");
|
|
17
|
+
const ReferenceList = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
18
|
+
const state = (0, _useReferenceList.useReferenceList_unstable)(props, ref);
|
|
19
|
+
const referenceListContextValues = (0, _useReferenceListContextValues.useReferenceListContextValues_unstable)(state);
|
|
20
|
+
(0, _useReferenceListStyles.useReferenceListStyles_unstable)(state);
|
|
21
|
+
return (0, _renderReferenceList.renderReferenceList_unstable)(state, referenceListContextValues);
|
|
22
|
+
});
|
|
23
|
+
ReferenceList.displayName = 'ReferenceList'; //# sourceMappingURL=ReferenceList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceList.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { renderReferenceList_unstable } from './renderReferenceList';\nimport { useReferenceList_unstable } from './useReferenceList';\nimport { useReferenceListStyles_unstable } from './useReferenceListStyles';\nimport { useReferenceListContextValues_unstable } from './useReferenceListContextValues';\nimport type { ReferenceListProps } from './ReferenceList.types';\n\nexport const ReferenceList: ForwardRefComponent<ReferenceListProps> = React.forwardRef((props, ref) => {\n const state = useReferenceList_unstable(props, ref);\n const referenceListContextValues = useReferenceListContextValues_unstable(state);\n\n useReferenceListStyles_unstable(state);\n\n return renderReferenceList_unstable(state, referenceListContextValues);\n});\n\nReferenceList.displayName = 'ReferenceList';\n"],"names":["ReferenceList","React","forwardRef","props","state","useReferenceList_unstable","referenceListContextValues","useReferenceListContextValues_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;qCAEsB;kCACH;wCACM;+CACO;AAGhD,MAAMA,gBAAAA,WAAAA,GAAAA,OAAyDC,UAAMC,CAAU,CAACC,OAACA;UACtFC,QAAMA,IAAAA,2CAAQC,EAAAA,OAA0BF;UACxCG,6BAAMA,IAAAA,qEAA6BC,EAAAA;+DAEnCC,EAAAA;WAEAC,IAAAA,iDAAOA,EAAAA,OAA6BL;AACtC;AAEAJ,cAAcU,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../../contexts/reference-v2/referenceListContext';\n\nexport type ReferenceListSlots = {\n root: NonNullable<Slot<'div'>>;\n showMoreButton?: Slot<'span'>;\n showLessButton?: Slot<'span'>;\n};\n\nexport type ReferenceListProps = ComponentProps<ReferenceListSlots> & {\n /**\n * The appearance of the reference.\n * @default 'lighter'\n */\n appearance?: 'lighter' | 'darker';\n\n /**\n * The maximum number of references to display before the overflow button is shown even if there is\n * enough space available to show more.\n * If not set, the overflow functionality will be disabled.\n * @default undefined\n */\n maxVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Required<Pick<ReferenceListProps, 'appearance'>> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n previousOverflowCount: React.MutableRefObject<number>;\n shouldUseOverflow: boolean;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./ReferenceList"), exports);
|
|
7
|
+
_export_star._(require("./ReferenceList.types"), exports);
|
|
8
|
+
_export_star._(require("./renderReferenceList"), exports);
|
|
9
|
+
_export_star._(require("./useReferenceList"), exports);
|
|
10
|
+
_export_star._(require("./useReferenceListStyles"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ReferenceList';\nexport * from './ReferenceList.types';\nexport * from './renderReferenceList';\nexport * from './useReferenceList';\nexport * from './useReferenceListStyles';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "renderReferenceList_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return renderReferenceList_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
13
|
+
const _referenceListContext = require("../../../contexts/reference-v2/referenceListContext");
|
|
14
|
+
const renderReferenceList_unstable = (state, contextValues)=>{
|
|
15
|
+
(0, _reactcomponents.assertSlots)(state);
|
|
16
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_referenceListContext.ReferenceListContextProvider, {
|
|
17
|
+
value: contextValues.referenceList,
|
|
18
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.Overflow, {
|
|
19
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
|
20
|
+
children: [
|
|
21
|
+
state.root.children,
|
|
22
|
+
state.showMoreButton && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.showMoreButton, {}),
|
|
23
|
+
state.showLessButton && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.showLessButton, {})
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}; //# sourceMappingURL=renderReferenceList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../../contexts/reference-v2/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState, contextValues: ReferenceListContextValues) => {\n assertSlots<ReferenceListSlots>(state);\n\n return (\n <ReferenceListContextProvider value={contextValues.referenceList}>\n <Overflow>\n <state.root>\n {state.root.children}\n {state.showMoreButton && <state.showMoreButton />}\n {state.showLessButton && <state.showLessButton />}\n </state.root>\n </Overflow>\n </ReferenceListContextProvider>\n );\n};\n"],"names":["assertSlots","state","value","contextValues","referenceList","Overflow","_jsx","root","children","showMoreButton","showLessButton"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWEA;;;eAAAA;;;4BAVF;iCAEsC;sCAEO;AAM3CA,MAAAA,+BAAgCC,CAAAA,OAAAA;oCAEhC,EAAAA;WACgCC,WAAOC,GAAAA,IAAAA,eAAAA,EAAAA,kDAA2B,EAAA;6BAC9DC,aAACC;6BACC,GAAAC,IAAAA,eAAA,EAAAD,yBAAA,EAACJ;;;0BACEA,IAAMM,CAAIC,QAACA;oBAAQP,MAAAQ,cAAA,IAAA,WAAA,GAAAH,IAAAA,eAAA,EAAAL,MAAAQ,cAAA,EAAA,CAAA;oBAAAR,MAAAS,cAAA,IAAA,WAAA,GAAAJ,IAAAA,eAAA,EAAAL,MAAAS,cAAA,EAAA,CAAA;iBAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useReferenceList_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useReferenceList_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
14
|
+
const _useReferenceStyles = require("../Reference/useReferenceStyles");
|
|
15
|
+
const useReferenceList_unstable = (props, ref)=>{
|
|
16
|
+
const { appearance = 'lighter', children, maxVisibleReferences, showLessButton, showMoreButton, ...rest } = props;
|
|
17
|
+
const [areReferencesExpanded, setAreReferencesExpanded] = _react.useState(false);
|
|
18
|
+
const referenceInOverflowClassName = (0, _useReferenceStyles.useRootStyles)().overflow;
|
|
19
|
+
const resolvedChildren = _react.useMemo(()=>{
|
|
20
|
+
if (maxVisibleReferences !== undefined && !areReferencesExpanded) {
|
|
21
|
+
const results = [];
|
|
22
|
+
const childrenArray = _react.Children.toArray(children);
|
|
23
|
+
for(let index = 0; index < childrenArray.length; index++){
|
|
24
|
+
const child = childrenArray[index];
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
if (index >= maxVisibleReferences && /*#__PURE__*/ _react.isValidElement(child)) {
|
|
27
|
+
results.push(/*#__PURE__*/ _react.cloneElement(child, {
|
|
28
|
+
...child.props,
|
|
29
|
+
className: (0, _reactcomponents.mergeClasses)(child.props.className, referenceInOverflowClassName)
|
|
30
|
+
}));
|
|
31
|
+
} else {
|
|
32
|
+
results.push(child);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return results;
|
|
36
|
+
}
|
|
37
|
+
return children;
|
|
38
|
+
}, [
|
|
39
|
+
areReferencesExpanded,
|
|
40
|
+
children,
|
|
41
|
+
maxVisibleReferences,
|
|
42
|
+
referenceInOverflowClassName
|
|
43
|
+
]);
|
|
44
|
+
// We keep track of the previous overflow count to determine element to move focus to when expanding the references via keyboard.
|
|
45
|
+
const previousOverflowCount = _react.useRef(0);
|
|
46
|
+
// We keep track of whether we are interacting with the overflow button via keyboard or not.
|
|
47
|
+
const overflowButtonTriggeredViaKeyboard = _react.useRef(false);
|
|
48
|
+
const focusAttributes = (0, _reactcomponents.useArrowNavigationGroup)({
|
|
49
|
+
axis: 'both',
|
|
50
|
+
circular: true,
|
|
51
|
+
memorizeCurrent: true
|
|
52
|
+
});
|
|
53
|
+
const onShowMoreButtonClick = _react.useCallback(()=>{
|
|
54
|
+
setAreReferencesExpanded(true);
|
|
55
|
+
}, []);
|
|
56
|
+
const onShowLessButtonClick = _react.useCallback(()=>{
|
|
57
|
+
setAreReferencesExpanded(false);
|
|
58
|
+
}, []);
|
|
59
|
+
const shouldUseOverflow = maxVisibleReferences !== undefined && !areReferencesExpanded;
|
|
60
|
+
const state = {
|
|
61
|
+
appearance,
|
|
62
|
+
areReferencesExpanded,
|
|
63
|
+
overflowButtonTriggeredViaKeyboard,
|
|
64
|
+
previousOverflowCount,
|
|
65
|
+
shouldUseOverflow,
|
|
66
|
+
components: {
|
|
67
|
+
root: 'div',
|
|
68
|
+
showMoreButton: 'span',
|
|
69
|
+
showLessButton: 'span'
|
|
70
|
+
},
|
|
71
|
+
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
|
|
72
|
+
ref,
|
|
73
|
+
...focusAttributes,
|
|
74
|
+
...rest,
|
|
75
|
+
children: resolvedChildren
|
|
76
|
+
}), {
|
|
77
|
+
elementType: 'div'
|
|
78
|
+
}),
|
|
79
|
+
showMoreButton: shouldUseOverflow ? _reactcomponents.slot.optional(showMoreButton, {
|
|
80
|
+
elementType: 'span'
|
|
81
|
+
}) : undefined,
|
|
82
|
+
showLessButton: areReferencesExpanded ? _reactcomponents.slot.optional(showLessButton, {
|
|
83
|
+
elementType: 'span'
|
|
84
|
+
}) : undefined
|
|
85
|
+
};
|
|
86
|
+
if (state.showMoreButton) {
|
|
87
|
+
state.showMoreButton.onClick = (0, _reactcomponents.mergeCallbacks)(onShowMoreButtonClick, state.showMoreButton.onClick);
|
|
88
|
+
}
|
|
89
|
+
if (state.showLessButton) {
|
|
90
|
+
state.showLessButton.onClick = (0, _reactcomponents.mergeCallbacks)(onShowLessButtonClick, state.showLessButton.onClick);
|
|
91
|
+
}
|
|
92
|
+
return state;
|
|
93
|
+
}; //# sourceMappingURL=useReferenceList.js.map
|