Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
@@ -0,0 +1,14 @@
import * as React from 'react';
import { useTableBody_unstable } from './useTableBody';
import { renderTableBody_unstable } from './renderTableBody';
import { useTableBodyStyles_unstable } from './useTableBodyStyles.styles';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* TableBody component
*/ export const TableBody = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useTableBody_unstable(props, ref);
useTableBodyStyles_unstable(state);
useCustomStyleHook_unstable('useTableBodyStyles_unstable')(state);
return renderTableBody_unstable(state);
});
TableBody.displayName = 'TableBody';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/TableBody/TableBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTableBody_unstable } from './useTableBody';\nimport { renderTableBody_unstable } from './renderTableBody';\nimport { useTableBodyStyles_unstable } from './useTableBodyStyles.styles';\nimport type { TableBodyProps } from './TableBody.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * TableBody component\n */\nexport const TableBody: ForwardRefComponent<TableBodyProps> = React.forwardRef((props, ref) => {\n const state = useTableBody_unstable(props, ref);\n\n useTableBodyStyles_unstable(state);\n\n useCustomStyleHook_unstable('useTableBodyStyles_unstable')(state);\n\n return renderTableBody_unstable(state);\n});\n\nTableBody.displayName = 'TableBody';\n"],"names":["React","useTableBody_unstable","renderTableBody_unstable","useTableBodyStyles_unstable","useCustomStyleHook_unstable","TableBody","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,8BAA8B;AAG1E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,0BAAiDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACrF,MAAMC,QAAQR,sBAAsBM,OAAOC;IAE3CL,4BAA4BM;IAE5BL,4BAA4B,+BAA+BK;IAE3D,OAAOP,yBAAyBO;AAClC,GAAG;AAEHJ,UAAUK,WAAW,GAAG"}
@@ -0,0 +1,3 @@
/**
* State used in rendering TableBody
*/ export { };
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/TableBody/TableBody.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableBodySlots = {\n root: Slot<'tbody', 'div'>;\n};\n\n/**\n * TableBody Props\n */\nexport type TableBodyProps = ComponentProps<TableBodySlots>;\n\n/**\n * State used in rendering TableBody\n */\nexport type TableBodyState = ComponentState<TableBodySlots> & Pick<TableContextValue, 'noNativeElements'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAYA;;CAEC,GACD,WAA0G"}
+4
View File
@@ -0,0 +1,4 @@
export { TableBody } from './TableBody';
export { renderTableBody_unstable } from './renderTableBody';
export { useTableBody_unstable } from './useTableBody';
export { tableBodyClassName, tableBodyClassNames, useTableBodyStyles_unstable } from './useTableBodyStyles.styles';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/TableBody/index.ts"],"sourcesContent":["export { TableBody } from './TableBody';\nexport type { TableBodyProps, TableBodySlots, TableBodyState } from './TableBody.types';\nexport { renderTableBody_unstable } from './renderTableBody';\nexport { useTableBody_unstable } from './useTableBody';\nexport { tableBodyClassName, tableBodyClassNames, useTableBodyStyles_unstable } from './useTableBodyStyles.styles';\n"],"names":["TableBody","renderTableBody_unstable","useTableBody_unstable","tableBodyClassName","tableBodyClassNames","useTableBodyStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,EAAEC,mBAAmB,EAAEC,2BAA2B,QAAQ,8BAA8B"}
@@ -0,0 +1,8 @@
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
/**
* Render the final JSX of TableBody
*/ export const renderTableBody_unstable = (state)=>{
assertSlots(state);
return /*#__PURE__*/ _jsx(state.root, {});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/TableBody/renderTableBody.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { TableBodyState, TableBodySlots } from './TableBody.types';\n\n/**\n * Render the final JSX of TableBody\n */\nexport const renderTableBody_unstable = (state: TableBodyState) => {\n assertSlots<TableBodySlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderTableBody_unstable","state","root"],"rangeMappings":";;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvCF,YAA4BE;IAE5B,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
@@ -0,0 +1,32 @@
import * as React from 'react';
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
import { useTableContext } from '../../contexts/tableContext';
/**
* Create the state required to render TableBody.
*
* The returned state can be modified with hooks such as useTableBodyStyles_unstable,
* before being passed to renderTableBody_unstable.
*
* @param props - props from this instance of TableBody
* @param ref - reference to root HTMLElement of TableBody
*/ export const useTableBody_unstable = (props, ref)=>{
const { noNativeElements } = useTableContext();
var _props_as;
const rootComponent = ((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : noNativeElements) ? 'div' : 'tbody';
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' ? 'rowgroup' : undefined,
...props
}), {
elementType: rootComponent
}),
noNativeElements
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/TableBody/useTableBody.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { TableBodyProps, TableBodyState } from './TableBody.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableBody.\n *\n * The returned state can be modified with hooks such as useTableBodyStyles_unstable,\n * before being passed to renderTableBody_unstable.\n *\n * @param props - props from this instance of TableBody\n * @param ref - reference to root HTMLElement of TableBody\n */\nexport const useTableBody_unstable = (props: TableBodyProps, ref: React.Ref<HTMLElement>): TableBodyState => {\n const { noNativeElements } = useTableContext();\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'tbody';\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' ? 'rowgroup' : undefined,\n ...props,\n }),\n { elementType: rootComponent },\n ),\n noNativeElements,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useTableContext","useTableBody_unstable","props","ref","noNativeElements","rootComponent","as","components","root","always","role","undefined","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE3E,SAASC,eAAe,QAAQ,8BAA8B;AAE9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EAAEC,gBAAgB,EAAE,GAAGJ;QACPE;IAAtB,MAAMG,gBAAgBH,CAAAA,CAAAA,YAAAA,MAAMI,EAAE,cAARJ,uBAAAA,YAAYE,gBAAe,IAAI,QAAQ;IAE7D,OAAO;QACLG,YAAY;YACVC,MAAMH;QACR;QACAG,MAAMT,KAAKU,MAAM,CACfX,yBAAyBO,eAAe;YACtC,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FF,KAAKA;YACLO,MAAML,kBAAkB,QAAQ,aAAaM;YAC7C,GAAGT,KAAK;QACV,IACA;YAAEU,aAAaP;QAAc;QAE/BD;IACF;AACF,EAAE"}
@@ -0,0 +1,32 @@
import { mergeClasses, __styles } from '@griffel/react';
const useTableLayoutStyles = /*#__PURE__*/__styles({
root: {
mc9l5x: "f1tp1avn"
}
}, {
d: [".f1tp1avn{display:table-row-group;}"]
});
const useFlexLayoutStyles = /*#__PURE__*/__styles({
root: {
mc9l5x: "ftgm304"
}
}, {
d: [".ftgm304{display:block;}"]
});
export const tableBodyClassName = 'fui-TableBody';
export const tableBodyClassNames = {
root: 'fui-TableBody'
};
/**
* Apply styling to the TableBody slots based on the state
*/
export const useTableBodyStyles_unstable = state => {
'use no memo';
const layoutStyles = {
table: useTableLayoutStyles(),
flex: useFlexLayoutStyles()
};
state.root.className = mergeClasses(tableBodyClassName, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"names":["mergeClasses","__styles","useTableLayoutStyles","root","mc9l5x","d","useFlexLayoutStyles","tableBodyClassName","tableBodyClassNames","useTableBodyStyles_unstable","state","layoutStyles","table","flex","className","noNativeElements"],"sources":["useTableBodyStyles.styles.js"],"sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-row-group'\n }\n});\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'block'\n }\n});\nexport const tableBodyClassName = 'fui-TableBody';\nexport const tableBodyClassNames = {\n root: 'fui-TableBody'\n};\n/**\n * Apply styling to the TableBody slots based on the state\n */ export const useTableBodyStyles_unstable = (state)=>{\n 'use no memo';\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles()\n };\n state.root.className = mergeClasses(tableBodyClassName, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAASA,YAAY,EAAAC,QAAA,QAAoB,gBAAgB;AACzD,MAAMC,oBAAoB,gBAAGD,QAAA;EAAAE,IAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAI5B,CAAC;AACF,MAAMC,mBAAmB,gBAAGL,QAAA;EAAAE,IAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAI3B,CAAC;AACF,OAAO,MAAME,kBAAkB,GAAG,eAAe;AACjD,OAAO,MAAMC,mBAAmB,GAAG;EAC/BL,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,OAAO,MAAMM,2BAA2B,GAAIC,KAAK,IAAG;EACpD,aAAa;;EACb,MAAMC,YAAY,GAAG;IACjBC,KAAK,EAAEV,oBAAoB,CAAC,CAAC;IAC7BW,IAAI,EAAEP,mBAAmB,CAAC;EAC9B,CAAC;EACDI,KAAK,CAACP,IAAI,CAACW,SAAS,GAAGd,YAAY,CAACO,kBAAkB,EAAEG,KAAK,CAACK,gBAAgB,GAAGJ,YAAY,CAACE,IAAI,CAACV,IAAI,GAAGQ,YAAY,CAACC,KAAK,CAACT,IAAI,EAAEO,KAAK,CAACP,IAAI,CAACW,SAAS,CAAC;EACxJ,OAAOJ,KAAK;AAChB,CAAC","ignoreList":[]}