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,16 @@
'use client';
import * as React from 'react';
import { useTable_unstable } from './useTable';
import { renderTable_unstable } from './renderTable';
import { useTableStyles_unstable } from './useTableStyles.styles';
import { useTableContextValues_unstable } from './useTableContextValues';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* Table component
*/ export const Table = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useTable_unstable(props, ref);
useTableStyles_unstable(state);
useCustomStyleHook_unstable('useTableStyles_unstable')(state);
return renderTable_unstable(state, useTableContextValues_unstable(state));
});
Table.displayName = 'Table';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/Table.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useTable_unstable } from './useTable';\nimport { renderTable_unstable } from './renderTable';\nimport { useTableStyles_unstable } from './useTableStyles.styles';\nimport type { TableProps } from './Table.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTableContextValues_unstable } from './useTableContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Table component\n */\nexport const Table: ForwardRefComponent<TableProps> = React.forwardRef((props, ref) => {\n const state = useTable_unstable(props, ref);\n\n useTableStyles_unstable(state);\n\n useCustomStyleHook_unstable('useTableStyles_unstable')(state);\n\n return renderTable_unstable(state, useTableContextValues_unstable(state));\n});\n\nTable.displayName = 'Table';\n"],"names":["React","useTable_unstable","renderTable_unstable","useTableStyles_unstable","useTableContextValues_unstable","useCustomStyleHook_unstable","Table","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,0BAA0B;AAGlE,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,sBAAyCN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC7E,MAAMC,QAAQT,kBAAkBO,OAAOC;IAEvCN,wBAAwBO;IAExBL,4BAA4B,2BAA2BK;IAEvD,OAAOR,qBAAqBQ,OAAON,+BAA+BM;AACpE,GAAG;AAEHJ,MAAMK,WAAW,GAAG"}

View File

@@ -0,0 +1,3 @@
/**
* State used in rendering Table
*/ export { };

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/Table.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TableSlots = {\n root: Slot<'table', 'div'>;\n};\n\nexport type TableContextValue = {\n /**\n * Affects the sizes of all table subcomponents\n * @default medium\n */\n size: 'extra-small' | 'small' | 'medium';\n\n /**\n * Render all table elements as divs instead of semantic table elements\n * Using divs no longer uses `display: table` layout but `display: flex`\n * @default false\n */\n noNativeElements: boolean;\n\n /**\n * Whether the table is sortable\n * @default false\n */\n sortable: boolean;\n};\n\nexport type SortDirection = 'ascending' | 'descending';\n\nexport type TableContextValues = {\n table: TableContextValue;\n};\n\n/**\n * Table Props\n */\nexport type TableProps = ComponentProps<TableSlots> & Partial<TableContextValue>;\n\n/**\n * State used in rendering Table\n */\nexport type TableState = ComponentState<TableSlots> &\n Pick<Required<TableProps>, 'size' | 'noNativeElements'> &\n TableContextValue;\n"],"names":[],"mappings":"AAsCA;;CAEC,GACD,WAEoB"}

View File

@@ -0,0 +1,4 @@
export { Table } from './Table';
export { renderTable_unstable } from './renderTable';
export { useTable_unstable } from './useTable';
export { tableClassName, tableClassNames, useTableStyles_unstable } from './useTableStyles.styles';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/index.ts"],"sourcesContent":["export { Table } from './Table';\nexport type {\n SortDirection,\n TableContextValue,\n TableContextValues,\n TableProps,\n TableSlots,\n TableState,\n} from './Table.types';\nexport { renderTable_unstable } from './renderTable';\nexport { useTable_unstable } from './useTable';\nexport { tableClassName, tableClassNames, useTableStyles_unstable } from './useTableStyles.styles';\n"],"names":["Table","renderTable_unstable","useTable_unstable","tableClassName","tableClassNames","useTableStyles_unstable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAShC,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,cAAc,EAAEC,eAAe,EAAEC,uBAAuB,QAAQ,0BAA0B"}

View File

@@ -0,0 +1,12 @@
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
import { TableContextProvider } from '../../contexts/tableContext';
/**
* Render the final JSX of Table
*/ export const renderTable_unstable = (state, contextValues)=>{
assertSlots(state);
return /*#__PURE__*/ _jsx(TableContextProvider, {
value: contextValues.table,
children: /*#__PURE__*/ _jsx(state.root, {})
});
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/renderTable.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TableState, TableSlots, TableContextValues } from './Table.types';\nimport { TableContextProvider } from '../../contexts/tableContext';\n\n/**\n * Render the final JSX of Table\n */\nexport const renderTable_unstable = (state: TableState, contextValues: TableContextValues): JSXElement => {\n assertSlots<TableSlots>(state);\n\n return (\n <TableContextProvider value={contextValues.table}>\n <state.root />\n </TableContextProvider>\n );\n};\n"],"names":["assertSlots","TableContextProvider","renderTable_unstable","state","contextValues","value","table","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,oBAAoB,QAAQ,8BAA8B;AAEnE;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAmBC;IACtDJ,YAAwBG;IAExB,qBACE,KAACF;QAAqBI,OAAOD,cAAcE,KAAK;kBAC9C,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}

View File

@@ -0,0 +1,33 @@
import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
/**
* Create the state required to render Table.
*
* The returned state can be modified with hooks such as useTableStyles_unstable,
* before being passed to renderTable_unstable.
*
* @param props - props from this instance of Table
* @param ref - reference to root HTMLElement of Table
*/ export const useTable_unstable = (props, ref)=>{
var _props_as;
const rootComponent = ((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : props.noNativeElements) ? 'div' : 'table';
var _props_size, _props_noNativeElements, _props_sortable;
return {
components: {
root: rootComponent
},
root: slot.always(getIntrinsicElementProps(rootComponent, {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
role: rootComponent === 'div' ? 'table' : undefined,
...props
}), {
elementType: rootComponent
}),
size: (_props_size = props.size) !== null && _props_size !== void 0 ? _props_size : 'medium',
noNativeElements: (_props_noNativeElements = props.noNativeElements) !== null && _props_noNativeElements !== void 0 ? _props_noNativeElements : false,
sortable: (_props_sortable = props.sortable) !== null && _props_sortable !== void 0 ? _props_sortable : false
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/useTable.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { TableProps, TableState } from './Table.types';\n\n/**\n * Create the state required to render Table.\n *\n * The returned state can be modified with hooks such as useTableStyles_unstable,\n * before being passed to renderTable_unstable.\n *\n * @param props - props from this instance of Table\n * @param ref - reference to root HTMLElement of Table\n */\nexport const useTable_unstable = (props: TableProps, ref: React.Ref<HTMLElement>): TableState => {\n const rootComponent = props.as ?? props.noNativeElements ? 'div' : 'table';\n\n return {\n components: {\n root: rootComponent,\n },\n root: slot.always(\n getIntrinsicElementProps(rootComponent, {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role: rootComponent === 'div' ? 'table' : undefined,\n ...props,\n }),\n { elementType: rootComponent },\n ),\n size: props.size ?? 'medium',\n noNativeElements: props.noNativeElements ?? false,\n sortable: props.sortable ?? false,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useTable_unstable","props","ref","rootComponent","as","noNativeElements","components","root","always","role","undefined","elementType","size","sortable"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAG3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC;QAC7BD;IAAtB,MAAME,gBAAgBF,CAAAA,CAAAA,YAAAA,MAAMG,EAAE,cAARH,uBAAAA,YAAYA,MAAMI,gBAAgB,AAAD,IAAI,QAAQ;QAiB3DJ,aACYA,yBACRA;IAjBZ,OAAO;QACLK,YAAY;YACVC,MAAMJ;QACR;QACAI,MAAMR,KAAKS,MAAM,CACfV,yBAAyBK,eAAe;YACtC,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FD,KAAKA;YACLO,MAAMN,kBAAkB,QAAQ,UAAUO;YAC1C,GAAGT,KAAK;QACV,IACA;YAAEU,aAAaR;QAAc;QAE/BS,MAAMX,CAAAA,cAAAA,MAAMW,IAAI,cAAVX,yBAAAA,cAAc;QACpBI,kBAAkBJ,CAAAA,0BAAAA,MAAMI,gBAAgB,cAAtBJ,qCAAAA,0BAA0B;QAC5CY,UAAUZ,CAAAA,kBAAAA,MAAMY,QAAQ,cAAdZ,6BAAAA,kBAAkB;IAC9B;AACF,EAAE"}

View File

@@ -0,0 +1,17 @@
'use client';
import * as React from 'react';
export function useTableContextValues_unstable(state) {
const { size, noNativeElements, sortable } = state;
const tableContext = React.useMemo(()=>({
noNativeElements,
size,
sortable
}), [
noNativeElements,
size,
sortable
]);
return {
table: tableContext
};
}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/useTableContextValues.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { TableContextValues, TableState } from './Table.types';\n\nexport function useTableContextValues_unstable(state: TableState): TableContextValues {\n const { size, noNativeElements, sortable } = state;\n\n const tableContext = React.useMemo(\n () => ({\n noNativeElements,\n size,\n sortable,\n }),\n [noNativeElements, size, sortable],\n );\n\n return {\n table: tableContext,\n };\n}\n"],"names":["React","useTableContextValues_unstable","state","size","noNativeElements","sortable","tableContext","useMemo","table"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAG/B,OAAO,SAASC,+BAA+BC,KAAiB;IAC9D,MAAM,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGH;IAE7C,MAAMI,eAAeN,MAAMO,OAAO,CAChC,IAAO,CAAA;YACLH;YACAD;YACAE;QACF,CAAA,GACA;QAACD;QAAkBD;QAAME;KAAS;IAGpC,OAAO;QACLG,OAAOF;IACT;AACF"}

View File

@@ -0,0 +1,50 @@
'use client';
import { __styles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const tableClassName = 'fui-Table';
export const tableClassNames = {
root: 'fui-Table'
};
const useTableLayoutStyles = /*#__PURE__*/__styles({
root: {
mc9l5x: "f1w4nmp0",
ha4doy: "fmrv4ls",
a9b677: "fly5x3f",
B73mfa3: "f14m3nip"
}
}, {
d: [".f1w4nmp0{display:table;}", ".fmrv4ls{vertical-align:middle;}", ".fly5x3f{width:100%;}", ".f14m3nip{table-layout:fixed;}"]
});
const useFlexLayoutStyles = /*#__PURE__*/__styles({
root: {
mc9l5x: "ftgm304"
}
}, {
d: [".ftgm304{display:block;}"]
});
/**
* Styles for the root slot
*/
const useStyles = /*#__PURE__*/__styles({
root: {
po53p8: "fgkb47j",
De3pzq: "fhovq9v"
}
}, {
d: [".fgkb47j{border-collapse:collapse;}", ".fhovq9v{background-color:var(--colorSubtleBackground);}"]
});
/**
* Apply styling to the Table slots based on the state
*/
export const useTableStyles_unstable = state => {
'use no memo';
const styles = useStyles();
const layoutStyles = {
table: useTableLayoutStyles(),
flex: useFlexLayoutStyles()
};
state.root.className = mergeClasses(tableClassName, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["__styles","mergeClasses","tokens","tableClassName","tableClassNames","root","useTableLayoutStyles","mc9l5x","ha4doy","a9b677","B73mfa3","d","useFlexLayoutStyles","useStyles","po53p8","De3pzq","useTableStyles_unstable","state","styles","layoutStyles","table","flex","className","noNativeElements"],"sources":["useTableStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const tableClassName = 'fui-Table';\nexport const tableClassNames = {\n root: 'fui-Table'\n};\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table',\n verticalAlign: 'middle',\n width: '100%',\n tableLayout: 'fixed'\n }\n});\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'block'\n }\n});\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n borderCollapse: 'collapse',\n backgroundColor: tokens.colorSubtleBackground\n }\n});\n/**\n * Apply styling to the Table slots based on the state\n */ export const useTableStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles()\n };\n state.root.className = mergeClasses(tableClassName, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,cAAc,GAAG,WAAW;AACzC,OAAO,MAAMC,eAAe,GAAG;EAC3BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGN,QAAA;EAAAK,IAAA;IAAAE,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAO5B,CAAC;AACF,MAAMC,mBAAmB,gBAAGZ,QAAA;EAAAK,IAAA;IAAAE,MAAA;EAAA;AAAA;EAAAI,CAAA;AAAA,CAI3B,CAAC;AACF;AACA;AACA;AAAI,MAAME,SAAS,gBAAGb,QAAA;EAAAK,IAAA;IAAAS,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAJ,CAAA;AAAA,CAKrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,uBAAuB,GAAIC,KAAK,IAAG;EAChD,aAAa;;EACb,MAAMC,MAAM,GAAGL,SAAS,CAAC,CAAC;EAC1B,MAAMM,YAAY,GAAG;IACjBC,KAAK,EAAEd,oBAAoB,CAAC,CAAC;IAC7Be,IAAI,EAAET,mBAAmB,CAAC;EAC9B,CAAC;EACDK,KAAK,CAACZ,IAAI,CAACiB,SAAS,GAAGrB,YAAY,CAACE,cAAc,EAAEe,MAAM,CAACb,IAAI,EAAEY,KAAK,CAACM,gBAAgB,GAAGJ,YAAY,CAACE,IAAI,CAAChB,IAAI,GAAGc,YAAY,CAACC,KAAK,CAACf,IAAI,EAAEY,KAAK,CAACZ,IAAI,CAACiB,SAAS,CAAC;EACjK,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,40 @@
'use client';
import { makeStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
export const tableClassName = 'fui-Table';
export const tableClassNames = {
root: 'fui-Table'
};
const useTableLayoutStyles = makeStyles({
root: {
display: 'table',
verticalAlign: 'middle',
width: '100%',
tableLayout: 'fixed'
}
});
const useFlexLayoutStyles = makeStyles({
root: {
display: 'block'
}
});
/**
* Styles for the root slot
*/ const useStyles = makeStyles({
root: {
borderCollapse: 'collapse',
backgroundColor: tokens.colorSubtleBackground
}
});
/**
* Apply styling to the Table slots based on the state
*/ export const useTableStyles_unstable = (state)=>{
'use no memo';
const styles = useStyles();
const layoutStyles = {
table: useTableLayoutStyles(),
flex: useFlexLayoutStyles()
};
state.root.className = mergeClasses(tableClassName, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
return state;
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Table/useTableStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TableSlots, TableState } from './Table.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableClassName = 'fui-Table';\nexport const tableClassNames: SlotClassNames<TableSlots> = {\n root: 'fui-Table',\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table',\n verticalAlign: 'middle',\n width: '100%',\n tableLayout: 'fixed',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'block',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n borderCollapse: 'collapse',\n backgroundColor: tokens.colorSubtleBackground,\n },\n});\n\n/**\n * Apply styling to the Table slots based on the state\n */\nexport const useTableStyles_unstable = (state: TableState): TableState => {\n 'use no memo';\n\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableClassName,\n styles.root,\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","tokens","tableClassName","tableClassNames","root","useTableLayoutStyles","display","verticalAlign","width","tableLayout","useFlexLayoutStyles","useStyles","borderCollapse","backgroundColor","colorSubtleBackground","useTableStyles_unstable","state","styles","layoutStyles","table","flex","className","noNativeElements"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,OAAO,MAAMC,iBAAiB,YAAY;AAC1C,OAAO,MAAMC,kBAA8C;IACzDC,MAAM;AACR,EAAE;AAEF,MAAMC,uBAAuBN,WAAW;IACtCK,MAAM;QACJE,SAAS;QACTC,eAAe;QACfC,OAAO;QACPC,aAAa;IACf;AACF;AAEA,MAAMC,sBAAsBX,WAAW;IACrCK,MAAM;QACJE,SAAS;IACX;AACF;AAEA;;CAEC,GACD,MAAMK,YAAYZ,WAAW;IAC3BK,MAAM;QACJQ,gBAAgB;QAChBC,iBAAiBZ,OAAOa,qBAAqB;IAC/C;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtC;IAEA,MAAMC,SAASN;IACf,MAAMO,eAAe;QACnBC,OAAOd;QACPe,MAAMV;IACR;IACAM,MAAMZ,IAAI,CAACiB,SAAS,GAAGrB,aACrBE,gBACAe,OAAOb,IAAI,EACXY,MAAMM,gBAAgB,GAAGJ,aAAaE,IAAI,CAAChB,IAAI,GAAGc,aAAaC,KAAK,CAACf,IAAI,EACzEY,MAAMZ,IAAI,CAACiB,SAAS;IAGtB,OAAOL;AACT,EAAE"}