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,74 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
SSRContext: function() {
return SSRContext;
},
SSRProvider: function() {
return SSRProvider;
},
defaultSSRContextValue: function() {
return defaultSSRContextValue;
},
useIsSSR: function() {
return useIsSSR;
},
useSSRContext: function() {
return useSSRContext;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _canUseDOM = require("./canUseDOM");
const defaultSSRContextValue = {
current: 0
};
const SSRContext = /*#__PURE__*/ _react.createContext(undefined);
function useSSRContext() {
var _React_useContext;
return (_React_useContext = _react.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;
}
const SSRProvider = (props)=>{
const [value] = _react.useState(()=>({
current: 0
}));
return /*#__PURE__*/ _react.createElement(SSRContext.Provider, {
value: value
}, props.children);
};
function useIsSSR() {
const isInSSRContext = useSSRContext() !== defaultSSRContextValue;
const [isSSR, setIsSSR] = _react.useState(isInSSRContext);
// If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
// developer to add one.
if (process.env.NODE_ENV !== 'production') {
if (!isInSSRContext && !(0, _canUseDOM.canUseDOM)()) {
// eslint-disable-next-line no-console
console.error(`@fluentui/react-components [${useIsSSR.name}]:
When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.
Check documentation at https://aka.ms/fluentui-ssr.`);
}
}
// If on the client, and the component was initially server rendered, then schedule a layout effect to update the
// component after hydration.
if ((0, _canUseDOM.canUseDOM)() && isInSSRContext) {
// This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
// mounting.
// eslint-disable-next-line
_react.useLayoutEffect(()=>{
setIsSSR(false);
}, []);
}
return isSSR;
}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/ssr/SSRContext.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC<{ children: React.ReactNode }> = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(/** #__DE-INDENT__ */ `\n @fluentui/react-components [${useIsSSR.name}]:\n When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.\n\n\n Check documentation at https://aka.ms/fluentui-ssr.\n `);\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"names":["SSRContext","SSRProvider","defaultSSRContextValue","useIsSSR","useSSRContext","current","React","createContext","undefined","useContext","props","value","useState","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","name","useLayoutEffect"],"mappings":"AAAA;;;;;;;;;;;;IAwBaA,UAAU;eAAVA;;IAeAC,WAAW;eAAXA;;IAnBAC,sBAAsB;eAAtBA;;IA6BGC,QAAQ;eAARA;;IApBAC,aAAa;eAAbA;;;;iEA3BO;2BACG;AAiBnB,MAAMF,yBAA0C;IACrDG,SAAS;AACX;AAEO,MAAML,2BAAaM,OAAMC,aAAa,CAA8BC;AAKpE,SAASJ;QACPE;IAAP,OAAOA,CAAAA,oBAAAA,OAAMG,UAAU,CAACT,yBAAjBM,+BAAAA,oBAAgCJ;AACzC;AAQO,MAAMD,cAAuDS,CAAAA;IAClE,MAAM,CAACC,MAAM,GAAGL,OAAMM,QAAQ,CAAkB,IAAO,CAAA;YAAEP,SAAS;QAAE,CAAA;IAEpE,qBAAO,qBAACL,WAAWa,QAAQ;QAACF,OAAOA;OAAQD,MAAMI,QAAQ;AAC3D;AAMO,SAASX;IACd,MAAMY,iBAAiBX,oBAAoBF;IAC3C,MAAM,CAACc,OAAOC,SAAS,GAAGX,OAAMM,QAAQ,CAACG;IAEzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,CAACL,kBAAkB,CAACM,IAAAA,oBAAS,KAAI;YACnC,sCAAsC;YACtCC,QAAQC,KAAK,CAAuB,CAAC,4BACP,EAAEpB,SAASqB,IAAI,CAAC;;;;mDAK9C,CAAC;QACH;IACF;IAEA,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIH,IAAAA,oBAAS,OAAMN,gBAAgB;QACjC,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BT,OAAMmB,eAAe,CAAC;YACpBR,SAAS;QACX,GAAG,EAAE;IACP;IAEA,OAAOD;AACT"}

View File

@@ -0,0 +1,15 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "canUseDOM", {
enumerable: true,
get: function() {
return canUseDOM;
}
});
function canUseDOM() {
return /* eslint-disable @nx/workspace-no-restricted-globals -- expected ignore ( SSR friendly acquisition of globals )*/ typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line @typescript-eslint/no-deprecated
window.document.createElement);
}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/ssr/canUseDOM.ts"],"sourcesContent":["'use client';\n\n/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n /* eslint-disable @nx/workspace-no-restricted-globals -- expected ignore ( SSR friendly acquisition of globals )*/\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n window.document.createElement\n )\n /* eslint-enable @nx/workspace-no-restricted-globals */\n );\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;;;;+BAKgBA;;;eAAAA;;;AAAT,SAASA;IACd,OACE,gHAAgH,GAChH,OAAOC,WAAW,eAClB,CAAC,CACCA,CAAAA,OAAOC,QAAQ,IACf,4DAA4D;IAC5DD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAIlC"}

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
SSRContext: function() {
return _SSRContext.SSRContext;
},
SSRProvider: function() {
return _SSRContext.SSRProvider;
},
canUseDOM: function() {
return _canUseDOM.canUseDOM;
},
defaultSSRContextValue: function() {
return _SSRContext.defaultSSRContextValue;
},
useIsSSR: function() {
return _SSRContext.useIsSSR;
},
useSSRContext: function() {
return _SSRContext.useSSRContext;
}
});
const _canUseDOM = require("./canUseDOM");
const _SSRContext = require("./SSRContext");

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/ssr/index.ts"],"sourcesContent":["export { canUseDOM } from './canUseDOM';\nexport type { SSRContextValue } from './SSRContext';\nexport { SSRContext, SSRProvider, defaultSSRContextValue, useIsSSR, useSSRContext } from './SSRContext';\n"],"names":["SSRContext","SSRProvider","canUseDOM","defaultSSRContextValue","useIsSSR","useSSRContext"],"mappings":";;;;;;;;;;;IAESA,UAAU;eAAVA,sBAAU;;IAAEC,WAAW;eAAXA,uBAAW;;IAFvBC,SAAS;eAATA,oBAAS;;IAEgBC,sBAAsB;eAAtBA,kCAAsB;;IAAEC,QAAQ;eAARA,oBAAQ;;IAAEC,aAAa;eAAbA,yBAAa;;;2BAFvD;4BAE+D"}