Private
Public Access
1
0

feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
2026-04-14 18:52:25 +00:00
parent 1199eff6c3
commit dfa4010406
34820 changed files with 1003813 additions and 205 deletions

View File

@@ -0,0 +1,15 @@
'use client';
import * as React from 'react';
import { usePopoverSurface_unstable } from './usePopoverSurface';
import { renderPopoverSurface_unstable } from './renderPopoverSurface';
import { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles.styles';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* PopoverSurface component renders react children in a positioned box
*/ export const PopoverSurface = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = usePopoverSurface_unstable(props, ref);
usePopoverSurfaceStyles_unstable(state);
useCustomStyleHook_unstable('usePopoverSurfaceStyles_unstable')(state);
return renderPopoverSurface_unstable(state);
});
PopoverSurface.displayName = 'PopoverSurface';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/PopoverSurface/PopoverSurface.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles.styles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePopoverSurface_unstable(props, ref);\n\n usePopoverSurfaceStyles_unstable(state);\n\n useCustomStyleHook_unstable('usePopoverSurfaceStyles_unstable')(state);\n\n return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"names":["React","usePopoverSurface_unstable","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","useCustomStyleHook_unstable","PopoverSurface","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,+BAA2DL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQR,2BAA2BM,OAAOC;IAEhDL,iCAAiCM;IAEjCL,4BAA4B,oCAAoCK;IAEhE,OAAOP,8BAA8BO;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}

View File

@@ -0,0 +1 @@
export { };

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/PopoverSurface/PopoverSurface.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverContextValue } from '../../popoverContext';\n\n/**\n * PopoverSurface Props\n */\nexport type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;\n\n/**\n * Names of the slots in PopoverSurfaceProps\n */\nexport type PopoverSurfaceSlots = {\n root: Slot<'div'>;\n};\n\nexport type PopoverSurfaceBaseProps = PopoverSurfaceProps;\n\n/**\n * PopoverSurface State\n */\nexport type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &\n Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'size' | 'withArrow'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n\nexport type PopoverSurfaceBaseState = Omit<PopoverSurfaceState, 'appearance' | 'size'>;\n"],"names":[],"mappings":"AA4BA,WAAuF"}

View File

@@ -0,0 +1,4 @@
export { PopoverSurface } from './PopoverSurface';
export { renderPopoverSurface_unstable } from './renderPopoverSurface';
export { usePopoverSurface_unstable, usePopoverSurfaceBase_unstable } from './usePopoverSurface';
export { arrowHeights, popoverSurfaceClassNames, usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles.styles';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/PopoverSurface/index.ts"],"sourcesContent":["export { PopoverSurface } from './PopoverSurface';\nexport type {\n PopoverSurfaceBaseProps,\n PopoverSurfaceProps,\n PopoverSurfaceSlots,\n PopoverSurfaceBaseState,\n PopoverSurfaceState,\n} from './PopoverSurface.types';\nexport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nexport { usePopoverSurface_unstable, usePopoverSurfaceBase_unstable } from './usePopoverSurface';\nexport {\n arrowHeights,\n popoverSurfaceClassNames,\n usePopoverSurfaceStyles_unstable,\n} from './usePopoverSurfaceStyles.styles';\n"],"names":["PopoverSurface","renderPopoverSurface_unstable","usePopoverSurface_unstable","usePopoverSurfaceBase_unstable","arrowHeights","popoverSurfaceClassNames","usePopoverSurfaceStyles_unstable"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAQlD,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,0BAA0B,EAAEC,8BAA8B,QAAQ,sBAAsB;AACjG,SACEC,YAAY,EACZC,wBAAwB,EACxBC,gCAAgC,QAC3B,mCAAmC"}

View File

@@ -0,0 +1,24 @@
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
import { Portal } from '@fluentui/react-portal';
/**
* Render the final JSX of PopoverSurface
*/ export const renderPopoverSurface_unstable = (state)=>{
assertSlots(state);
const surface = /*#__PURE__*/ _jsxs(state.root, {
children: [
state.withArrow && /*#__PURE__*/ _jsx("div", {
ref: state.arrowRef,
className: state.arrowClassName
}),
state.root.children
]
});
if (state.inline) {
return surface;
}
return /*#__PURE__*/ _jsx(Portal, {
mountNode: state.mountNode,
children: surface
});
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/PopoverSurface/renderPopoverSurface.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState): JSXElement => {\n assertSlots<PopoverSurfaceSlots>(state);\n\n const surface = (\n <state.root>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.root.children}\n </state.root>\n );\n\n if (state.inline) {\n return surface;\n }\n\n return <Portal mountNode={state.mountNode}>{surface}</Portal>;\n};\n"],"names":["assertSlots","Portal","renderPopoverSurface_unstable","state","surface","root","withArrow","div","ref","arrowRef","className","arrowClassName","children","inline","mountNode"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,MAAM,QAAQ,yBAAyB;AAGhD;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5CH,YAAiCG;IAEjC,MAAMC,wBACJ,MAACD,MAAME,IAAI;;YACRF,MAAMG,SAAS,kBAAI,KAACC;gBAAIC,KAAKL,MAAMM,QAAQ;gBAAEC,WAAWP,MAAMQ,cAAc;;YAC5ER,MAAME,IAAI,CAACO,QAAQ;;;IAIxB,IAAIT,MAAMU,MAAM,EAAE;QAChB,OAAOT;IACT;IAEA,qBAAO,KAACH;QAAOa,WAAWX,MAAMW,SAAS;kBAAGV;;AAC9C,EAAE"}

View File

@@ -0,0 +1,89 @@
'use client';
import * as React from 'react';
import { useMergedRefs, slot } from '@fluentui/react-utilities';
import { useModalAttributes } from '@fluentui/react-tabster';
import { usePopoverContext_unstable } from '../../popoverContext';
import { useMotionForwardedRef } from '@fluentui/react-motion';
/**
* Create the state required to render PopoverSurface.
*
* The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
* before being passed to renderPopoverSurface_unstable.
*
* @param props - props from this instance of PopoverSurface
* @param ref - reference to root HTMLDivElement of PopoverSurface
*/ export const usePopoverSurface_unstable = (props, ref)=>{
const size = usePopoverContext_unstable((context)=>context.size);
const appearance = usePopoverContext_unstable((context)=>context.appearance);
const motionForwardedRef = useMotionForwardedRef();
const state = usePopoverSurfaceBase_unstable(props, useMergedRefs(ref, motionForwardedRef));
return {
appearance,
size,
...state
};
};
/**
* Base hook that builds PopoverSurface state for behavior and structure only.
*
* @internal
* @param props - User provided props to the PopoverSurface component.
* @param ref - User provided ref to be passed to the PopoverSurface component.
*/ export const usePopoverSurfaceBase_unstable = (props, ref)=>{
const contentRef = usePopoverContext_unstable((context)=>context.contentRef);
const openOnHover = usePopoverContext_unstable((context)=>context.openOnHover);
const setOpen = usePopoverContext_unstable((context)=>context.setOpen);
const mountNode = usePopoverContext_unstable((context)=>context.mountNode);
const arrowRef = usePopoverContext_unstable((context)=>context.arrowRef);
const withArrow = usePopoverContext_unstable((context)=>context.withArrow);
const trapFocus = usePopoverContext_unstable((context)=>context.trapFocus);
const inertTrapFocus = usePopoverContext_unstable((context)=>context.inertTrapFocus);
const inline = usePopoverContext_unstable((context)=>context.inline);
const { modalAttributes } = useModalAttributes({
trapFocus,
legacyTrapFocus: !inertTrapFocus,
alwaysFocusable: !trapFocus
});
const state = {
inline,
withArrow,
arrowRef,
mountNode,
components: {
root: 'div'
},
root: slot.always({
ref: useMergedRefs(ref, contentRef),
role: trapFocus ? 'dialog' : 'group',
'aria-modal': trapFocus ? true : undefined,
...modalAttributes,
...props
}, {
elementType: 'div'
})
};
const { onMouseEnter: onMouseEnterOriginal, onMouseLeave: onMouseLeaveOriginal, onKeyDown: onKeyDownOriginal } = state.root;
state.root.onMouseEnter = (e)=>{
if (openOnHover) {
setOpen(e, true);
}
onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
};
state.root.onMouseLeave = (e)=>{
if (openOnHover) {
setOpen(e, false);
}
onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
};
state.root.onKeyDown = (e)=>{
var _contentRef_current;
// only close if the event happened inside the current popover
// If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
if (e.key === 'Escape' && ((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.contains(e.target))) {
e.preventDefault();
setOpen(e, false);
}
onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
};
return state;
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,164 @@
'use client';
import { __styles, mergeClasses } from '@griffel/react';
import { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';
import { tokens, typographyStyles } from '@fluentui/react-theme';
export const popoverSurfaceClassNames = {
root: 'fui-PopoverSurface'
};
export const arrowHeights = {
small: 6,
medium: 8,
large: 8
};
/**
* Styles for the root slot
*/
const useStyles = /*#__PURE__*/__styles({
root: {
sj55zd: "f19n0e5",
De3pzq: "fxugw4r",
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "ft85np5",
Bgfg5da: 0,
B9xav0g: 0,
oivjwe: 0,
Bn0qgzm: 0,
B4g9neb: 0,
zhjwy3: 0,
wvpqe5: 0,
ibv6hh: 0,
u1mtju: 0,
h3c5rm: 0,
vrafjx: 0,
Bekrc4i: 0,
i8vvqc: 0,
g2u3we: 0,
icvyot: 0,
B4j52fo: 0,
irswps: "f9ggezi",
Bahqtrf: "fk6fouc",
Be2twd7: "fkhj508",
Bhrd7zp: "figsok6",
Bg96gwp: "f1i3iumi",
Bhu2qc9: "fymb6k8"
},
inline: {
Bj3rh1h: "f19g0ac"
},
inverted: {
De3pzq: "fg3r6xk",
sj55zd: "fonrgv7"
},
brand: {
De3pzq: "ffp7eso",
sj55zd: "f1phragk"
},
smallPadding: {
Byoj8tv: 0,
uwmqm3: 0,
z189sj: 0,
z8tnut: 0,
B0ocmuz: "f1sy4kr4"
},
mediumPadding: {
Byoj8tv: 0,
uwmqm3: 0,
z189sj: 0,
z8tnut: 0,
B0ocmuz: "f4zyqsv"
},
largePadding: {
Byoj8tv: 0,
uwmqm3: 0,
z189sj: 0,
z8tnut: 0,
B0ocmuz: "fop8ug2"
},
smallArrow: {
rhnwrx: "f1s3jn22",
Bdy53xb: "fv40uqz"
},
mediumLargeArrow: {
rhnwrx: "f1f72gjr",
Bdy53xb: "f69yoe5"
},
arrow: {
B7ck84d: "f1ewtqcl",
qhf8xq: "f1euv43f",
Bj3rh1h: "f1bsuimh",
De3pzq: "f1u2r49w",
B2eet1l: "fqhgnl",
Beyfa6y: "f17bz04i",
Bz10aip: "f36o3x3",
Bqenvij: "fzofk8q",
a9b677: "f1wbx1ie",
Ftih45: "f1wl9k8s",
Br0sdwz: "f1aocrix",
cmx5o7: "f1ljr5q2",
susq4k: 0,
Biibvgv: 0,
Bicfajf: 0,
qehafq: 0,
Brs5u8j: "f155f1qt",
Ccq8qp: "f9mhzq7",
Baz25je: "fr6rhvx",
Bcgcnre: 0,
Bqjgrrk: 0,
qa3bma: 0,
y0oebl: 0,
Biqmznv: 0,
Bm6vgfq: 0,
Bbv0w2i: 0,
uvfttm: 0,
eqrjj: 0,
Bk5zm6e: 0,
m598lv: 0,
B4f6apu: 0,
ydt019: 0,
Bq4z7u6: 0,
Bdkvgpv: 0,
B0qfbqy: 0,
kj8mxx: "f1kc0wz4",
r59vdv: "fgq90dz",
Bkw5xw4: "fq0y47f",
hl6cv3: "f1pwrbz6",
aea9ga: "f1hxxcvm",
yayu3t: "fw8rgyo",
Bhsv975: "f1wnzycx",
rhl9o9: "f1730wal",
B7gxrvb: "f1fy4ixr",
B6q6orb: "fobkauc",
B0lu1f8: "f16bqv1l"
}
}, {
d: [".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", [".ft85np5{border-radius:var(--borderRadiusMedium);}", {
p: -1
}], [".f9ggezi{border:1px solid var(--colorTransparentStroke);}", {
p: -2
}], ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fymb6k8{filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 8px 16px var(--colorNeutralShadowKey));}", ".f19g0ac{z-index:1;}", ".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}", ".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1phragk{color:var(--colorNeutralForegroundOnBrand);}", [".f1sy4kr4{padding:12px;}", {
p: -1
}], [".f4zyqsv{padding:16px;}", {
p: -1
}], [".fop8ug2{padding:20px;}", {
p: -1
}], ".f1s3jn22{--fui-positioning-arrow-height:8.484px;}", ".fv40uqz{--fui-positioning-arrow-offset:-4.242px;}", ".f1f72gjr{--fui-positioning-arrow-height:11.312px;}", ".f69yoe5{--fui-positioning-arrow-offset:-5.656px;}", ".f1ewtqcl{box-sizing:border-box;}", ".f1euv43f{position:absolute;}", ".f1bsuimh{z-index:-1;}", ".f1u2r49w{background-color:inherit;}", ".fqhgnl{background-clip:content-box;}", ".f17bz04i{border-bottom-left-radius:var(--borderRadiusSmall);}", ".f36o3x3{transform:rotate(var(--fui-positioning-arrow-angle));}", ".fzofk8q{height:var(--fui-positioning-arrow-height);}", ".f1wbx1ie{width:var(--fui-positioning-arrow-height);}", ".f1wl9k8s::before{content:\"\";}", ".f1aocrix::before{display:block;}", ".f1ljr5q2::before{background-color:inherit;}", [".f155f1qt::before{margin:-1px;}", {
p: -1
}], ".f9mhzq7::before{width:100%;}", ".fr6rhvx::before{height:100%;}", [".f1kc0wz4::before{border:1px solid var(--colorTransparentStroke);}", {
p: -2
}], ".fgq90dz::before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fq0y47f::before{clip-path:polygon(0% 0%, 100% 100%, 0% 100%);}", "[data-popper-placement^=\"top\"] .f1pwrbz6{bottom:var(--fui-positioning-arrow-offset);}", "[data-popper-placement^=\"top\"] .f1hxxcvm{--fui-positioning-arrow-angle:-45deg;}", "[data-popper-placement^=\"right\"] .fw8rgyo{left:var(--fui-positioning-arrow-offset);}", "[data-popper-placement^=\"right\"] .f1wnzycx{--fui-positioning-arrow-angle:45deg;}", "[data-popper-placement^=\"bottom\"] .f1730wal{top:var(--fui-positioning-arrow-offset);}", "[data-popper-placement^=\"bottom\"] .f1fy4ixr{--fui-positioning-arrow-angle:135deg;}", "[data-popper-placement^=\"left\"] .fobkauc{right:var(--fui-positioning-arrow-offset);}", "[data-popper-placement^=\"left\"] .f16bqv1l{--fui-positioning-arrow-angle:225deg;}"]
});
/**
* Apply styling to the PopoverSurface slots based on the state
*/
export const usePopoverSurfaceStyles_unstable = state => {
'use no memo';
const styles = useStyles();
state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.inline && styles.inline, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
return state;
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,61 @@
'use client';
import { makeStyles, mergeClasses } from '@griffel/react';
import { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';
import { tokens, typographyStyles } from '@fluentui/react-theme';
export const popoverSurfaceClassNames = {
root: 'fui-PopoverSurface'
};
export const arrowHeights = {
small: 6,
medium: 8,
large: 8
};
/**
* Styles for the root slot
*/ const useStyles = makeStyles({
root: {
color: tokens.colorNeutralForeground1,
backgroundColor: tokens.colorNeutralBackground1,
borderRadius: tokens.borderRadiusMedium,
border: `1px solid ${tokens.colorTransparentStroke}`,
...typographyStyles.body1,
// TODO need to add versions of tokens.alias.shadow.shadow16, etc. that work with filter
filter: `drop-shadow(0 0 2px ${tokens.colorNeutralShadowAmbient}) ` + `drop-shadow(0 8px 16px ${tokens.colorNeutralShadowKey})`
},
inline: {
// When rendering inline, the PopoverSurface will be rendered under relatively positioned elements such as Input.
// This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.
zIndex: 1
},
inverted: {
backgroundColor: tokens.colorNeutralBackgroundStatic,
color: tokens.colorNeutralForegroundStaticInverted
},
brand: {
backgroundColor: tokens.colorBrandBackground,
color: tokens.colorNeutralForegroundOnBrand
},
smallPadding: {
padding: '12px'
},
mediumPadding: {
padding: '16px'
},
largePadding: {
padding: '20px'
},
smallArrow: createArrowHeightStyles(arrowHeights.small),
mediumLargeArrow: createArrowHeightStyles(arrowHeights.medium),
arrow: createArrowStyles({
arrowHeight: undefined
})
});
/**
* Apply styling to the PopoverSurface slots based on the state
*/ export const usePopoverSurfaceStyles_unstable = (state)=>{
'use no memo';
const styles = useStyles();
state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.inline && styles.inline, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
return state;
};

File diff suppressed because one or more lines are too long