@fluentui/react-table 9.0.0-alpha.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 +80 -0
- package/CHANGELOG.md +36 -0
- package/LICENSE +15 -0
- package/README.md +5 -0
- package/Spec.md +63 -0
- package/dist/index.d.ts +321 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/Table.js +2 -0
- package/lib/Table.js.map +1 -0
- package/lib/TableBody.js +2 -0
- package/lib/TableBody.js.map +1 -0
- package/lib/TableCell.js +2 -0
- package/lib/TableCell.js.map +1 -0
- package/lib/TableHeader.js +2 -0
- package/lib/TableHeader.js.map +1 -0
- package/lib/TableHeaderCell.js +2 -0
- package/lib/TableHeaderCell.js.map +1 -0
- package/lib/TableRow.js +2 -0
- package/lib/TableRow.js.map +1 -0
- package/lib/components/Table/Table.js +16 -0
- package/lib/components/Table/Table.js.map +1 -0
- package/lib/components/Table/Table.types.js +2 -0
- package/lib/components/Table/Table.types.js.map +1 -0
- package/lib/components/Table/index.js +6 -0
- package/lib/components/Table/index.js.map +1 -0
- package/lib/components/Table/renderTable.js +18 -0
- package/lib/components/Table/renderTable.js.map +1 -0
- package/lib/components/Table/useTable.js +30 -0
- package/lib/components/Table/useTable.js.map +1 -0
- package/lib/components/Table/useTableContextValues.js +15 -0
- package/lib/components/Table/useTableContextValues.js.map +1 -0
- package/lib/components/Table/useTableStyles.js +27 -0
- package/lib/components/Table/useTableStyles.js.map +1 -0
- package/lib/components/TableBody/TableBody.js +15 -0
- package/lib/components/TableBody/TableBody.js.map +1 -0
- package/lib/components/TableBody/TableBody.types.js +2 -0
- package/lib/components/TableBody/TableBody.types.js.map +1 -0
- package/lib/components/TableBody/index.js +6 -0
- package/lib/components/TableBody/index.js.map +1 -0
- package/lib/components/TableBody/renderTableBody.js +16 -0
- package/lib/components/TableBody/renderTableBody.js.map +1 -0
- package/lib/components/TableBody/useTableBody.js +29 -0
- package/lib/components/TableBody/useTableBody.js.map +1 -0
- package/lib/components/TableBody/useTableBodyStyles.js +14 -0
- package/lib/components/TableBody/useTableBodyStyles.js.map +1 -0
- package/lib/components/TableCell/TableCell.js +15 -0
- package/lib/components/TableCell/TableCell.js.map +1 -0
- package/lib/components/TableCell/TableCell.types.js +2 -0
- package/lib/components/TableCell/TableCell.types.js.map +1 -0
- package/lib/components/TableCell/index.js +6 -0
- package/lib/components/TableCell/index.js.map +1 -0
- package/lib/components/TableCell/renderTableCell.js +17 -0
- package/lib/components/TableCell/renderTableCell.js.map +1 -0
- package/lib/components/TableCell/useTableCell.js +31 -0
- package/lib/components/TableCell/useTableCell.js.map +1 -0
- package/lib/components/TableCell/useTableCellStyles.js +48 -0
- package/lib/components/TableCell/useTableCellStyles.js.map +1 -0
- package/lib/components/TableHeader/TableHeader.js +15 -0
- package/lib/components/TableHeader/TableHeader.js.map +1 -0
- package/lib/components/TableHeader/TableHeader.types.js +2 -0
- package/lib/components/TableHeader/TableHeader.types.js.map +1 -0
- package/lib/components/TableHeader/index.js +6 -0
- package/lib/components/TableHeader/index.js.map +1 -0
- package/lib/components/TableHeader/renderTableHeader.js +15 -0
- package/lib/components/TableHeader/renderTableHeader.js.map +1 -0
- package/lib/components/TableHeader/useTableHeader.js +36 -0
- package/lib/components/TableHeader/useTableHeader.js.map +1 -0
- package/lib/components/TableHeader/useTableHeaderStyles.js +14 -0
- package/lib/components/TableHeader/useTableHeaderStyles.js.map +1 -0
- package/lib/components/TableHeaderCell/TableHeaderCell.js +15 -0
- package/lib/components/TableHeaderCell/TableHeaderCell.js.map +1 -0
- package/lib/components/TableHeaderCell/TableHeaderCell.types.js +2 -0
- package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -0
- package/lib/components/TableHeaderCell/index.js +6 -0
- package/lib/components/TableHeaderCell/index.js.map +1 -0
- package/lib/components/TableHeaderCell/renderTableHeaderCell.js +17 -0
- package/lib/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -0
- package/lib/components/TableHeaderCell/useTableHeaderCell.js +59 -0
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -0
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +80 -0
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -0
- package/lib/components/TableRow/TableRow.js +15 -0
- package/lib/components/TableRow/TableRow.js.map +1 -0
- package/lib/components/TableRow/TableRow.types.js +2 -0
- package/lib/components/TableRow/TableRow.types.js.map +1 -0
- package/lib/components/TableRow/index.js +6 -0
- package/lib/components/TableRow/index.js.map +1 -0
- package/lib/components/TableRow/renderTableRow.js +16 -0
- package/lib/components/TableRow/renderTableRow.js.map +1 -0
- package/lib/components/TableRow/useTableRow.js +31 -0
- package/lib/components/TableRow/useTableRow.js.map +1 -0
- package/lib/components/TableRow/useTableRowStyles.js +47 -0
- package/lib/components/TableRow/useTableRowStyles.js.map +1 -0
- package/lib/contexts/tableContext.js +10 -0
- package/lib/contexts/tableContext.js.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib-commonjs/Table.js +10 -0
- package/lib-commonjs/Table.js.map +1 -0
- package/lib-commonjs/TableBody.js +10 -0
- package/lib-commonjs/TableBody.js.map +1 -0
- package/lib-commonjs/TableCell.js +10 -0
- package/lib-commonjs/TableCell.js.map +1 -0
- package/lib-commonjs/TableHeader.js +10 -0
- package/lib-commonjs/TableHeader.js.map +1 -0
- package/lib-commonjs/TableHeaderCell.js +10 -0
- package/lib-commonjs/TableHeaderCell.js.map +1 -0
- package/lib-commonjs/TableRow.js +10 -0
- package/lib-commonjs/TableRow.js.map +1 -0
- package/lib-commonjs/components/Table/Table.js +28 -0
- package/lib-commonjs/components/Table/Table.js.map +1 -0
- package/lib-commonjs/components/Table/Table.types.js +6 -0
- package/lib-commonjs/components/Table/Table.types.js.map +1 -0
- package/lib-commonjs/components/Table/index.js +18 -0
- package/lib-commonjs/components/Table/index.js.map +1 -0
- package/lib-commonjs/components/Table/renderTable.js +30 -0
- package/lib-commonjs/components/Table/renderTable.js.map +1 -0
- package/lib-commonjs/components/Table/useTable.js +40 -0
- package/lib-commonjs/components/Table/useTable.js.map +1 -0
- package/lib-commonjs/components/Table/useTableContextValues.js +24 -0
- package/lib-commonjs/components/Table/useTableContextValues.js.map +1 -0
- package/lib-commonjs/components/Table/useTableStyles.js +37 -0
- package/lib-commonjs/components/Table/useTableStyles.js.map +1 -0
- package/lib-commonjs/components/TableBody/TableBody.js +26 -0
- package/lib-commonjs/components/TableBody/TableBody.js.map +1 -0
- package/lib-commonjs/components/TableBody/TableBody.types.js +6 -0
- package/lib-commonjs/components/TableBody/TableBody.types.js.map +1 -0
- package/lib-commonjs/components/TableBody/index.js +18 -0
- package/lib-commonjs/components/TableBody/index.js.map +1 -0
- package/lib-commonjs/components/TableBody/renderTableBody.js +27 -0
- package/lib-commonjs/components/TableBody/renderTableBody.js.map +1 -0
- package/lib-commonjs/components/TableBody/useTableBody.js +40 -0
- package/lib-commonjs/components/TableBody/useTableBody.js.map +1 -0
- package/lib-commonjs/components/TableBody/useTableBodyStyles.js +24 -0
- package/lib-commonjs/components/TableBody/useTableBodyStyles.js.map +1 -0
- package/lib-commonjs/components/TableCell/TableCell.js +26 -0
- package/lib-commonjs/components/TableCell/TableCell.js.map +1 -0
- package/lib-commonjs/components/TableCell/TableCell.types.js +6 -0
- package/lib-commonjs/components/TableCell/TableCell.types.js.map +1 -0
- package/lib-commonjs/components/TableCell/index.js +18 -0
- package/lib-commonjs/components/TableCell/index.js.map +1 -0
- package/lib-commonjs/components/TableCell/renderTableCell.js +28 -0
- package/lib-commonjs/components/TableCell/renderTableCell.js.map +1 -0
- package/lib-commonjs/components/TableCell/useTableCell.js +42 -0
- package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -0
- package/lib-commonjs/components/TableCell/useTableCellStyles.js +59 -0
- package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -0
- package/lib-commonjs/components/TableHeader/TableHeader.js +26 -0
- package/lib-commonjs/components/TableHeader/TableHeader.js.map +1 -0
- package/lib-commonjs/components/TableHeader/TableHeader.types.js +6 -0
- package/lib-commonjs/components/TableHeader/TableHeader.types.js.map +1 -0
- package/lib-commonjs/components/TableHeader/index.js +18 -0
- package/lib-commonjs/components/TableHeader/index.js.map +1 -0
- package/lib-commonjs/components/TableHeader/renderTableHeader.js +26 -0
- package/lib-commonjs/components/TableHeader/renderTableHeader.js.map +1 -0
- package/lib-commonjs/components/TableHeader/useTableHeader.js +48 -0
- package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -0
- package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js +24 -0
- package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js.map +1 -0
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js +26 -0
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js.map +1 -0
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.types.js +6 -0
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -0
- package/lib-commonjs/components/TableHeaderCell/index.js +18 -0
- package/lib-commonjs/components/TableHeaderCell/index.js.map +1 -0
- package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js +28 -0
- package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -0
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +73 -0
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -0
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +91 -0
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -0
- package/lib-commonjs/components/TableRow/TableRow.js +26 -0
- package/lib-commonjs/components/TableRow/TableRow.js.map +1 -0
- package/lib-commonjs/components/TableRow/TableRow.types.js +6 -0
- package/lib-commonjs/components/TableRow/TableRow.types.js.map +1 -0
- package/lib-commonjs/components/TableRow/index.js +18 -0
- package/lib-commonjs/components/TableRow/index.js.map +1 -0
- package/lib-commonjs/components/TableRow/renderTableRow.js +27 -0
- package/lib-commonjs/components/TableRow/renderTableRow.js.map +1 -0
- package/lib-commonjs/components/TableRow/useTableRow.js +42 -0
- package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -0
- package/lib-commonjs/components/TableRow/useTableRowStyles.js +58 -0
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -0
- package/lib-commonjs/contexts/tableContext.js +21 -0
- package/lib-commonjs/contexts/tableContext.js.map +1 -0
- package/lib-commonjs/index.js +256 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
|
|
3
|
+
import { ArrowUpRegular, ArrowDownRegular } from '@fluentui/react-icons';
|
|
4
|
+
import { useTableContext } from '../../contexts/tableContext';
|
|
5
|
+
import { useARIAButtonShorthand } from '@fluentui/react-aria';
|
|
6
|
+
const sortIcons = {
|
|
7
|
+
ascending: /*#__PURE__*/React.createElement(ArrowUpRegular, null),
|
|
8
|
+
descending: /*#__PURE__*/React.createElement(ArrowDownRegular, null)
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Create the state required to render TableHeaderCell.
|
|
12
|
+
*
|
|
13
|
+
* The returned state can be modified with hooks such as useTableHeaderCellStyles_unstable,
|
|
14
|
+
* before being passed to renderTableHeaderCell_unstable.
|
|
15
|
+
*
|
|
16
|
+
* @param props - props from this instance of TableHeaderCell
|
|
17
|
+
* @param ref - reference to root HTMLElement of TableHeaderCell
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const useTableHeaderCell_unstable = (props, ref) => {
|
|
21
|
+
var _a;
|
|
22
|
+
|
|
23
|
+
const noNativeElements = useTableContext(ctx => ctx.noNativeElements);
|
|
24
|
+
const sortable = useTableContext(ctx => ctx.sortable);
|
|
25
|
+
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'th';
|
|
26
|
+
return {
|
|
27
|
+
components: {
|
|
28
|
+
root: rootComponent,
|
|
29
|
+
button: 'button',
|
|
30
|
+
sortIcon: 'span'
|
|
31
|
+
},
|
|
32
|
+
root: getNativeElementProps(rootComponent, {
|
|
33
|
+
ref,
|
|
34
|
+
role: rootComponent === 'div' ? 'columnheader' : undefined,
|
|
35
|
+
'aria-sort': props.sortDirection,
|
|
36
|
+
...props
|
|
37
|
+
}),
|
|
38
|
+
sortIcon: resolveShorthand(props.sortIcon, {
|
|
39
|
+
required: !!props.sortDirection,
|
|
40
|
+
defaultProps: {
|
|
41
|
+
children: props.sortDirection ? sortIcons[props.sortDirection] : undefined
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
button: useARIAButtonShorthand(props.button, {
|
|
45
|
+
required: true,
|
|
46
|
+
defaultProps: {
|
|
47
|
+
role: 'presentation',
|
|
48
|
+
tabIndex: -1,
|
|
49
|
+
type: 'button',
|
|
50
|
+
...(sortable && {
|
|
51
|
+
role: undefined,
|
|
52
|
+
tabIndex: undefined
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
sortable
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useTableHeaderCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TableHeaderCell/useTableHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AACA,SAAS,cAAT,EAAyB,gBAAzB,QAAiD,uBAAjD;AAEA,SAAS,eAAT,QAAgC,6BAAhC;AACA,SAAS,sBAAT,QAAuC,sBAAvC;AAEA,MAAM,SAAS,GAAG;EAChB,SAAS,eAAE,KAAA,CAAA,aAAA,CAAC,cAAD,EAAe,IAAf,CADK;EAEhB,UAAU,eAAE,KAAA,CAAA,aAAA,CAAC,gBAAD,EAAiB,IAAjB;AAFI,CAAlB;AAKA;;;;;;;;AAQG;;AACH,OAAO,MAAM,2BAA2B,GAAG,CACzC,KADyC,EAEzC,GAFyC,KAGjB;;;EACxB,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,gBAAZ,CAAxC;EACA,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,QAAZ,CAAhC;EAEA,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,gBAAZ,IAA+B,KAA/B,GAAuC,IAA7D;EACA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE,aADI;MAEV,MAAM,EAAE,QAFE;MAGV,QAAQ,EAAE;IAHA,CADP;IAML,IAAI,EAAE,qBAAqB,CAAC,aAAD,EAAgB;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,cAA1B,GAA2C,SAFR;MAGzC,aAAa,KAAK,CAAC,aAHsB;MAIzC,GAAG;IAJsC,CAAhB,CANtB;IAYL,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,QAAP,EAAiB;MACzC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aADuB;MAEzC,YAAY,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,aAAN,GAAsB,SAAS,CAAC,KAAK,CAAC,aAAP,CAA/B,GAAuD;MAAnE;IAF2B,CAAjB,CAZrB;IAgBL,MAAM,EAAE,sBAAsB,CAAC,KAAK,CAAC,MAAP,EAAe;MAC3C,QAAQ,EAAE,IADiC;MAE3C,YAAY,EAAE;QACZ,IAAI,EAAE,cADM;QAEZ,QAAQ,EAAE,CAAC,CAFC;QAGZ,IAAI,EAAE,QAHM;QAIZ,IAAI,QAAQ,IAAI;UACd,IAAI,EAAE,SADQ;UAEd,QAAQ,EAAE;QAFI,CAAhB;MAJY;IAF6B,CAAf,CAhBzB;IA4BL;EA5BK,CAAP;AA8BD,CAtCM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { ArrowUpRegular, ArrowDownRegular } from '@fluentui/react-icons';\nimport type { TableHeaderCellProps, TableHeaderCellState } from './TableHeaderCell.types';\nimport { useTableContext } from '../../contexts/tableContext';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\n\nconst sortIcons = {\n ascending: <ArrowUpRegular />,\n descending: <ArrowDownRegular />,\n};\n\n/**\n * Create the state required to render TableHeaderCell.\n *\n * The returned state can be modified with hooks such as useTableHeaderCellStyles_unstable,\n * before being passed to renderTableHeaderCell_unstable.\n *\n * @param props - props from this instance of TableHeaderCell\n * @param ref - reference to root HTMLElement of TableHeaderCell\n */\nexport const useTableHeaderCell_unstable = (\n props: TableHeaderCellProps,\n ref: React.Ref<HTMLElement>,\n): TableHeaderCellState => {\n const noNativeElements = useTableContext(ctx => ctx.noNativeElements);\n const sortable = useTableContext(ctx => ctx.sortable);\n\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'th';\n return {\n components: {\n root: rootComponent,\n button: 'button',\n sortIcon: 'span',\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'columnheader' : undefined,\n 'aria-sort': props.sortDirection,\n ...props,\n }),\n sortIcon: resolveShorthand(props.sortIcon, {\n required: !!props.sortDirection,\n defaultProps: { children: props.sortDirection ? sortIcons[props.sortDirection] : undefined },\n }),\n button: useARIAButtonShorthand(props.button, {\n required: true,\n defaultProps: {\n role: 'presentation',\n tabIndex: -1,\n type: 'button',\n ...(sortable && {\n role: undefined,\n tabIndex: undefined,\n }),\n },\n }),\n sortable,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
export const tableHeaderCellClassName = 'fui-TableHeaderCell';
|
|
4
|
+
export const tableHeaderCellClassNames = {
|
|
5
|
+
root: 'fui-TableHeaderCell',
|
|
6
|
+
button: 'fui-TableHeaderCell__button',
|
|
7
|
+
sortIcon: 'fui-TableHeaderCell__sortIcon'
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Styles for the root slot
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
14
|
+
"root": {
|
|
15
|
+
"sshi5w": "f5pgtk9",
|
|
16
|
+
"z8tnut": "f1nbblvp",
|
|
17
|
+
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
18
|
+
"Byoj8tv": "f1ov4xf1",
|
|
19
|
+
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"],
|
|
20
|
+
"mc9l5x": "f22iagw",
|
|
21
|
+
"Bt984gj": "f122n59",
|
|
22
|
+
"Bh6795r": "fqerorx",
|
|
23
|
+
"Bnnss6s": "f1neuvcm",
|
|
24
|
+
"xawz": "fkjuxzh"
|
|
25
|
+
},
|
|
26
|
+
"resetButton": {
|
|
27
|
+
"B7ck84d": "f1e4lqlz",
|
|
28
|
+
"De3pzq": "f1u2r49w",
|
|
29
|
+
"sj55zd": "f1ym3bx4",
|
|
30
|
+
"Bahqtrf": "f1mo0ibp",
|
|
31
|
+
"Be2twd7": "fjoy568",
|
|
32
|
+
"Bg96gwp": "fytdu2e",
|
|
33
|
+
"B68tc82": "f1mtd64y",
|
|
34
|
+
"Bmxbyg5": "f1y7q3j9",
|
|
35
|
+
"z8tnut": "f1g0x7ka",
|
|
36
|
+
"z189sj": ["fhxju0i", "f1cnd47f"],
|
|
37
|
+
"Byoj8tv": "f1qch9an",
|
|
38
|
+
"uwmqm3": ["f1cnd47f", "fhxju0i"],
|
|
39
|
+
"icvyot": "f1ern45e",
|
|
40
|
+
"vrafjx": ["f1n71otn", "f1deefiw"],
|
|
41
|
+
"oivjwe": "f1h8hb77",
|
|
42
|
+
"wvpqe5": ["f1deefiw", "f1n71otn"],
|
|
43
|
+
"Bv0vk6g": "f37px4s",
|
|
44
|
+
"fsow6f": "fgusgyc"
|
|
45
|
+
},
|
|
46
|
+
"button": {
|
|
47
|
+
"mc9l5x": "f22iagw",
|
|
48
|
+
"Bh6795r": "fqerorx",
|
|
49
|
+
"Bqenvij": "f1l02sjl",
|
|
50
|
+
"Bt984gj": "f122n59",
|
|
51
|
+
"i8kkvl": "fsnqrgy",
|
|
52
|
+
"Belr9w4": "fylz90v"
|
|
53
|
+
},
|
|
54
|
+
"sortable": {
|
|
55
|
+
"Bceei9c": "f1k6fduh"
|
|
56
|
+
},
|
|
57
|
+
"sortIcon": {
|
|
58
|
+
"mc9l5x": "f22iagw",
|
|
59
|
+
"Bt984gj": "f122n59"
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
"d": [".f5pgtk9{min-height:44px;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1neuvcm{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", ".fkjuxzh{-webkit-flex-basis:0px;-ms-flex-preferred-size:0px;flex-basis:0px;}", ".f1e4lqlz{box-sizing:content-box;}", ".f1u2r49w{background-color:inherit;}", ".f1ym3bx4{color:inherit;}", ".f1mo0ibp{font-family:inherit;}", ".fjoy568{font-size:inherit;}", ".fytdu2e{line-height:normal;}", ".f1mtd64y{overflow-x:visible;}", ".f1y7q3j9{overflow-y:visible;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1h8hb77{border-bottom-style:none;}", ".f37px4s{-webkit-appearance:button;}", ".fgusgyc{text-align:unset;}", ".f1l02sjl{height:100%;}", ".fsnqrgy{-webkit-column-gap:var(--spacingHorizontalS);column-gap:var(--spacingHorizontalS);}", ".fylz90v{row-gap:var(--spacingHorizontalS);}", ".f1k6fduh{cursor:pointer;}"]
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Apply styling to the TableHeaderCell slots based on the state
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export const useTableHeaderCellStyles_unstable = state => {
|
|
70
|
+
const styles = useStyles();
|
|
71
|
+
state.root.className = mergeClasses(tableHeaderCellClassNames.root, styles.root, state.root.className);
|
|
72
|
+
state.button.className = mergeClasses(tableHeaderCellClassNames.button, styles.resetButton, styles.button, state.sortable && styles.sortable, state.button.className);
|
|
73
|
+
|
|
74
|
+
if (state.sortIcon) {
|
|
75
|
+
state.sortIcon.className = mergeClasses(tableHeaderCellClassNames.sortIcon, styles.sortIcon, state.sortIcon.className);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return state;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=useTableHeaderCellStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TableHeaderCell/useTableHeaderCellStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,wBAAwB,GAAG,qBAAjC;AACP,OAAO,MAAM,yBAAyB,GAAyC;EAC7E,IAAI,EAAE,qBADuE;EAE7E,MAAM,EAAE,6BAFqE;EAG7E,QAAQ,EAAE;AAHmE,CAAxE;AAMP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAuCA;;AAEG;;;AACH,OAAO,MAAM,iCAAiC,GAAI,KAAD,IAAsD;EACrG,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,yBAAyB,CAAC,IAA3B,EAAiC,MAAM,CAAC,IAAxC,EAA8C,KAAK,CAAC,IAAN,CAAW,SAAzD,CAAnC;EACA,KAAK,CAAC,MAAN,CAAa,SAAb,GAAyB,YAAY,CACnC,yBAAyB,CAAC,MADS,EAEnC,MAAM,CAAC,WAF4B,EAGnC,MAAM,CAAC,MAH4B,EAInC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAJU,EAKnC,KAAK,CAAC,MAAN,CAAa,SALsB,CAArC;;EAQA,IAAI,KAAK,CAAC,QAAV,EAAoB;IAClB,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CACrC,yBAAyB,CAAC,QADW,EAErC,MAAM,CAAC,QAF8B,EAGrC,KAAK,CAAC,QAAN,CAAe,SAHsB,CAAvC;EAKD;;EAED,OAAO,KAAP;AACD,CApBM","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TableHeaderCellSlots, TableHeaderCellState } from './TableHeaderCell.types';\n\nexport const tableHeaderCellClassName = 'fui-TableHeaderCell';\nexport const tableHeaderCellClassNames: SlotClassNames<TableHeaderCellSlots> = {\n root: 'fui-TableHeaderCell',\n button: 'fui-TableHeaderCell__button',\n sortIcon: 'fui-TableHeaderCell__sortIcon',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n minHeight: '44px',\n ...shorthands.padding('0px', tokens.spacingHorizontalS),\n display: 'flex',\n alignItems: 'center',\n ...shorthands.flex(1, 1, '0px'),\n },\n\n resetButton: {\n boxSizing: 'content-box',\n backgroundColor: 'inherit',\n color: 'inherit',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n lineHeight: 'normal',\n ...shorthands.overflow('visible'),\n ...shorthands.padding(0),\n ...shorthands.borderStyle('none'),\n WebkitAppearance: 'button',\n textAlign: 'unset',\n },\n button: {\n display: 'flex',\n flexGrow: 1,\n height: '100%',\n alignItems: 'center',\n ...shorthands.gap(tokens.spacingHorizontalS),\n },\n sortable: {\n cursor: 'pointer',\n },\n\n sortIcon: {\n display: 'flex',\n alignItems: 'center',\n },\n});\n\n/**\n * Apply styling to the TableHeaderCell slots based on the state\n */\nexport const useTableHeaderCellStyles_unstable = (state: TableHeaderCellState): TableHeaderCellState => {\n const styles = useStyles();\n state.root.className = mergeClasses(tableHeaderCellClassNames.root, styles.root, state.root.className);\n state.button.className = mergeClasses(\n tableHeaderCellClassNames.button,\n styles.resetButton,\n styles.button,\n state.sortable && styles.sortable,\n state.button.className,\n );\n\n if (state.sortIcon) {\n state.sortIcon.className = mergeClasses(\n tableHeaderCellClassNames.sortIcon,\n styles.sortIcon,\n state.sortIcon.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTableRow_unstable } from './useTableRow';
|
|
3
|
+
import { renderTableRow_unstable } from './renderTableRow';
|
|
4
|
+
import { useTableRowStyles_unstable } from './useTableRowStyles';
|
|
5
|
+
/**
|
|
6
|
+
* TableRow component - TODO: add more docs
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const TableRow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
10
|
+
const state = useTableRow_unstable(props, ref);
|
|
11
|
+
useTableRowStyles_unstable(state);
|
|
12
|
+
return renderTableRow_unstable(state);
|
|
13
|
+
});
|
|
14
|
+
TableRow.displayName = 'TableRow';
|
|
15
|
+
//# sourceMappingURL=TableRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TableRow/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,QAAqC,eAArC;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAIA;;AAEG;;AACH,OAAO,MAAM,QAAQ,gBAAuC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAC1F,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAD,EAAQ,GAAR,CAAlC;EAEA,0BAA0B,CAAC,KAAD,CAA1B;EACA,OAAO,uBAAuB,CAAC,KAAD,CAA9B;AACD,CAL2D,CAArD;AAOP,QAAQ,CAAC,WAAT,GAAuB,UAAvB","sourcesContent":["import * as React from 'react';\nimport { useTableRow_unstable } from './useTableRow';\nimport { renderTableRow_unstable } from './renderTableRow';\nimport { useTableRowStyles_unstable } from './useTableRowStyles';\nimport type { TableRowProps } from './TableRow.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * TableRow component - TODO: add more docs\n */\nexport const TableRow: ForwardRefComponent<TableRowProps> = React.forwardRef((props, ref) => {\n const state = useTableRow_unstable(props, ref);\n\n useTableRowStyles_unstable(state);\n return renderTableRow_unstable(state);\n});\n\nTableRow.displayName = 'TableRow';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableRow.types.js","sourceRoot":"../src/","sources":["components/TableRow/TableRow.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TableState } from '../Table/Table.types';\n\nexport type TableRowSlots = {\n root: Slot<'tr', 'div'>;\n};\n\n/**\n * TableRow Props\n */\nexport type TableRowProps = ComponentProps<TableRowSlots> & {};\n\n/**\n * State used in rendering TableRow\n */\nexport type TableRowState = ComponentState<TableRowSlots> & { size: TableState['size'] };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/TableRow/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './TableRow';\nexport * from './TableRow.types';\nexport * from './renderTableRow';\nexport * from './useTableRow';\nexport * from './useTableRowStyles';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of TableRow
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const renderTableRow_unstable = state => {
|
|
8
|
+
const {
|
|
9
|
+
slots,
|
|
10
|
+
slotProps
|
|
11
|
+
} = getSlots(state); // TODO Add additional slots in the appropriate place
|
|
12
|
+
|
|
13
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=renderTableRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TableRow/renderTableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAyB;EAC9D,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAgB,KAAhB,CAArC,CAD8D,CAG9D;;EACA,oBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAAP;AACD,CALM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TableRowState, TableRowSlots } from './TableRow.types';\n\n/**\n * Render the final JSX of TableRow\n */\nexport const renderTableRow_unstable = (state: TableRowState) => {\n const { slots, slotProps } = getSlots<TableRowSlots>(state);\n\n // TODO Add additional slots in the appropriate place\n return <slots.root {...slotProps.root} />;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getNativeElementProps } from '@fluentui/react-utilities';
|
|
2
|
+
import { useTableContext } from '../../contexts/tableContext';
|
|
3
|
+
/**
|
|
4
|
+
* Create the state required to render TableRow.
|
|
5
|
+
*
|
|
6
|
+
* The returned state can be modified with hooks such as useTableRowStyles_unstable,
|
|
7
|
+
* before being passed to renderTableRow_unstable.
|
|
8
|
+
*
|
|
9
|
+
* @param props - props from this instance of TableRow
|
|
10
|
+
* @param ref - reference to root HTMLElement of TableRow
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const useTableRow_unstable = (props, ref) => {
|
|
14
|
+
var _a;
|
|
15
|
+
|
|
16
|
+
const noNativeElements = useTableContext(ctx => ctx.noNativeElements);
|
|
17
|
+
const size = useTableContext(ctx => ctx.size);
|
|
18
|
+
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'tr';
|
|
19
|
+
return {
|
|
20
|
+
components: {
|
|
21
|
+
root: rootComponent
|
|
22
|
+
},
|
|
23
|
+
root: getNativeElementProps(rootComponent, {
|
|
24
|
+
ref,
|
|
25
|
+
role: rootComponent === 'div' ? 'row' : undefined,
|
|
26
|
+
...props
|
|
27
|
+
}),
|
|
28
|
+
size
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useTableRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TableRow/useTableRow.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;;;EACvG,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,gBAAZ,CAAxC;EACA,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,IAAZ,CAA5B;EACA,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,gBAAZ,IAA+B,KAA/B,GAAuC,IAA7D;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,aAAD,EAAgB;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,KAA1B,GAAkC,SAFC;MAGzC,GAAG;IAHsC,CAAhB,CAJtB;IASL;EATK,CAAP;AAWD,CAhBM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableRowProps, TableRowState } from './TableRow.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableRow.\n *\n * The returned state can be modified with hooks such as useTableRowStyles_unstable,\n * before being passed to renderTableRow_unstable.\n *\n * @param props - props from this instance of TableRow\n * @param ref - reference to root HTMLElement of TableRow\n */\nexport const useTableRow_unstable = (props: TableRowProps, ref: React.Ref<HTMLElement>): TableRowState => {\n const noNativeElements = useTableContext(ctx => ctx.noNativeElements);\n const size = useTableContext(ctx => ctx.size);\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'tr';\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'row' : undefined,\n ...props,\n }),\n size,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
export const tableRowClassName = 'fui-TableRow';
|
|
4
|
+
export const tableRowClassNames = {
|
|
5
|
+
root: tableRowClassName
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Styles for the root slot
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
12
|
+
"root": {
|
|
13
|
+
"mc9l5x": "f22iagw",
|
|
14
|
+
"sj55zd": "f19n0e5",
|
|
15
|
+
"Jwef8y": "f1knas48"
|
|
16
|
+
},
|
|
17
|
+
"medium": {
|
|
18
|
+
"sshi5w": "f5pgtk9",
|
|
19
|
+
"Bn0qgzm": "f1vxd6vx",
|
|
20
|
+
"oivjwe": "fg706s2",
|
|
21
|
+
"B9xav0g": "frpde29"
|
|
22
|
+
},
|
|
23
|
+
"small": {
|
|
24
|
+
"sshi5w": "fcep9tg",
|
|
25
|
+
"Bn0qgzm": "f1vxd6vx",
|
|
26
|
+
"oivjwe": "fg706s2",
|
|
27
|
+
"B9xav0g": "frpde29"
|
|
28
|
+
},
|
|
29
|
+
"smaller": {
|
|
30
|
+
"sshi5w": "f1pha7fy",
|
|
31
|
+
"Be2twd7": "fy9rknc"
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f5pgtk9{min-height:44px;}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fg706s2{border-bottom-style:solid;}", ".frpde29{border-bottom-color:var(--colorNeutralStroke2);}", ".fcep9tg{min-height:34px;}", ".f1pha7fy{min-height:24px;}", ".fy9rknc{font-size:var(--fontSizeBase200);}"],
|
|
35
|
+
"h": [".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}"]
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Apply styling to the TableRow slots based on the state
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export const useTableRowStyles_unstable = state => {
|
|
43
|
+
const styles = useStyles();
|
|
44
|
+
state.root.className = mergeClasses(tableRowClassNames.root, styles.root, styles[state.size], state.root.className);
|
|
45
|
+
return state;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=useTableRowStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/TableRow/useTableRowStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,iBAAiB,GAAG,cAA1B;AACP,OAAO,MAAM,kBAAkB,GAAkC;EAC/D,IAAI,EAAE;AADyD,CAA1D;AAIP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;EAAA;AAAA,EAAlB;AAyBA;;AAEG;;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAAwC;EAChF,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,kBAAkB,CAAC,IAApB,EAA0B,MAAM,CAAC,IAAjC,EAAuC,MAAM,CAAC,KAAK,CAAC,IAAP,CAA7C,EAA2D,KAAK,CAAC,IAAN,CAAW,SAAtE,CAAnC;EAEA,OAAO,KAAP;AACD,CALM","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TableRowSlots, TableRowState } from './TableRow.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableRowClassName = 'fui-TableRow';\nexport const tableRowClassNames: SlotClassNames<TableRowSlots> = {\n root: tableRowClassName,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n color: tokens.colorNeutralForeground1,\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n },\n },\n\n medium: {\n minHeight: '44px',\n ...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n\n small: {\n minHeight: '34px',\n ...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n\n smaller: {\n minHeight: '24px',\n fontSize: tokens.fontSizeBase200,\n },\n});\n\n/**\n * Apply styling to the TableRow slots based on the state\n */\nexport const useTableRowStyles_unstable = (state: TableRowState): TableRowState => {\n const styles = useStyles();\n state.root.className = mergeClasses(tableRowClassNames.root, styles.root, styles[state.size], state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
|
2
|
+
const tableContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
+
export const tableContextDefaultValue = {
|
|
4
|
+
size: 'medium',
|
|
5
|
+
noNativeElements: false,
|
|
6
|
+
sortable: false
|
|
7
|
+
};
|
|
8
|
+
export const TableContextProvider = tableContext.Provider;
|
|
9
|
+
export const useTableContext = selector => useContextSelector(tableContext, (ctx = tableContextDefaultValue) => selector(ctx));
|
|
10
|
+
//# sourceMappingURL=tableContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["contexts/tableContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,kBAAxB,QAAmE,kCAAnE;AAGA,MAAM,YAAY,gBAAG,aAAa,CAAgC,SAAhC,CAAlC;AAEA,OAAO,MAAM,wBAAwB,GAAsB;EACzD,IAAI,EAAE,QADmD;EAEzD,gBAAgB,EAAE,KAFuC;EAGzD,QAAQ,EAAE;AAH+C,CAApD;AAMP,OAAO,MAAM,oBAAoB,GAAG,YAAY,CAAC,QAA1C;AACP,OAAO,MAAM,eAAe,GAAO,QAAJ,IAC7B,kBAAkB,CAAC,YAAD,EAAe,CAAC,GAAG,GAAG,wBAAP,KAAoC,QAAQ,CAAC,GAAD,CAA3D,CADb","sourcesContent":["import { createContext, useContextSelector, ContextSelector } from '@fluentui/react-context-selector';\nimport { TableContextValue } from '../components/Table/Table.types';\n\nconst tableContext = createContext<TableContextValue | undefined>(undefined);\n\nexport const tableContextDefaultValue: TableContextValue = {\n size: 'medium',\n noNativeElements: false,\n sortable: false,\n};\n\nexport const TableContextProvider = tableContext.Provider;\nexport const useTableContext = <T>(selector: ContextSelector<TableContextValue, T>) =>\n useContextSelector(tableContext, (ctx = tableContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { TableCell, tableCellClassNames, tableCellClassName, useTableCellStyles_unstable, useTableCell_unstable, renderTableCell_unstable } from './TableCell';
|
|
2
|
+
export { TableRow, tableRowClassNames, tableRowClassName, useTableRowStyles_unstable, useTableRow_unstable, renderTableRow_unstable } from './TableRow';
|
|
3
|
+
export { TableBody, tableBodyClassName, tableBodyClassNames, useTableBodyStyles_unstable, useTableBody_unstable, renderTableBody_unstable } from './TableBody';
|
|
4
|
+
export { Table, tableClassName, tableClassNames, useTableStyles_unstable, useTable_unstable, renderTable_unstable } from './Table';
|
|
5
|
+
export { TableHeader, tableHeaderClassNames, tableHeaderClassName, useTableHeaderStyles_unstable, useTableHeader_unstable, renderTableHeader_unstable } from './TableHeader';
|
|
6
|
+
export { TableHeaderCell, tableHeaderCellClassName, tableHeaderCellClassNames, useTableHeaderCellStyles_unstable, useTableHeaderCell_unstable, renderTableHeaderCell_unstable } from './TableHeaderCell';
|
|
7
|
+
export { TableContextProvider, useTableContext } from './contexts/tableContext';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,SADF,EAEE,mBAFF,EAGE,kBAHF,EAIE,2BAJF,EAKE,qBALF,EAME,wBANF,QAOO,aAPP;AAUA,SACE,QADF,EAEE,kBAFF,EAGE,iBAHF,EAIE,0BAJF,EAKE,oBALF,EAME,uBANF,QAOO,YAPP;AAUA,SACE,SADF,EAEE,kBAFF,EAGE,mBAHF,EAIE,2BAJF,EAKE,qBALF,EAME,wBANF,QAOO,aAPP;AAUA,SACE,KADF,EAEE,cAFF,EAGE,eAHF,EAIE,uBAJF,EAKE,iBALF,EAME,oBANF,QAOO,SAPP;AAUA,SACE,WADF,EAEE,qBAFF,EAGE,oBAHF,EAIE,6BAJF,EAKE,uBALF,EAME,0BANF,QAOO,eAPP;AAUA,SACE,eADF,EAEE,wBAFF,EAGE,yBAHF,EAIE,iCAJF,EAKE,2BALF,EAME,8BANF,QAOO,mBAPP;AAUA,SAAS,oBAAT,EAA+B,eAA/B,QAAsD,yBAAtD","sourcesContent":["export {\n TableCell,\n tableCellClassNames,\n tableCellClassName,\n useTableCellStyles_unstable,\n useTableCell_unstable,\n renderTableCell_unstable,\n} from './TableCell';\nexport type { TableCellProps, TableCellState, TableCellSlots } from './TableCell';\n\nexport {\n TableRow,\n tableRowClassNames,\n tableRowClassName,\n useTableRowStyles_unstable,\n useTableRow_unstable,\n renderTableRow_unstable,\n} from './TableRow';\nexport type { TableRowProps, TableRowState, TableRowSlots } from './TableRow';\n\nexport {\n TableBody,\n tableBodyClassName,\n tableBodyClassNames,\n useTableBodyStyles_unstable,\n useTableBody_unstable,\n renderTableBody_unstable,\n} from './TableBody';\nexport type { TableBodyProps, TableBodyState, TableBodySlots } from './TableBody';\n\nexport {\n Table,\n tableClassName,\n tableClassNames,\n useTableStyles_unstable,\n useTable_unstable,\n renderTable_unstable,\n} from './Table';\nexport type { TableProps, TableSlots, TableState, TableContextValue, TableContextValues, SortDirection } from './Table';\n\nexport {\n TableHeader,\n tableHeaderClassNames,\n tableHeaderClassName,\n useTableHeaderStyles_unstable,\n useTableHeader_unstable,\n renderTableHeader_unstable,\n} from './TableHeader';\nexport type { TableHeaderProps, TableHeaderSlots, TableHeaderState } from './TableHeader';\n\nexport {\n TableHeaderCell,\n tableHeaderCellClassName,\n tableHeaderCellClassNames,\n useTableHeaderCellStyles_unstable,\n useTableHeaderCell_unstable,\n renderTableHeaderCell_unstable,\n} from './TableHeaderCell';\nexport type { TableHeaderCellProps, TableHeaderCellSlots, TableHeaderCellState } from './TableHeaderCell';\n\nexport { TableContextProvider, useTableContext } from './contexts/tableContext';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Table.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Table/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TableBody.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,8BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/TableBody/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TableCell.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,8BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/TableCell/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TableHeader.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/TableHeader/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
|
+
|
|
9
|
+
tslib_1.__exportStar(require("./components/TableHeaderCell/index"), exports);
|
|
10
|
+
//# sourceMappingURL=TableHeaderCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TableHeaderCell.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/TableHeaderCell/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TableRow.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,6BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/TableRow/index';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Table = void 0;
|
|
7
|
+
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const useTable_1 = /*#__PURE__*/require("./useTable");
|
|
11
|
+
|
|
12
|
+
const renderTable_1 = /*#__PURE__*/require("./renderTable");
|
|
13
|
+
|
|
14
|
+
const useTableStyles_1 = /*#__PURE__*/require("./useTableStyles");
|
|
15
|
+
|
|
16
|
+
const useTableContextValues_1 = /*#__PURE__*/require("./useTableContextValues");
|
|
17
|
+
/**
|
|
18
|
+
* Table component - TODO: add more docs
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.Table = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
23
|
+
const state = useTable_1.useTable_unstable(props, ref);
|
|
24
|
+
useTableStyles_1.useTableStyles_unstable(state);
|
|
25
|
+
return renderTable_1.renderTable_unstable(state, useTableContextValues_1.useTableContextValues_unstable(state));
|
|
26
|
+
});
|
|
27
|
+
exports.Table.displayName = 'Table';
|
|
28
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Table/Table.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AAGA,MAAA,uBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAEA;;AAEG;;;AACU,OAAA,CAAA,KAAA,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpF,MAAM,KAAK,GAAG,UAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAAd;EAEA,gBAAA,CAAA,uBAAA,CAAwB,KAAxB;EACA,OAAO,aAAA,CAAA,oBAAA,CAAqB,KAArB,EAA4B,uBAAA,CAAA,8BAAA,CAA+B,KAA/B,CAA5B,CAAP;AACD,CALqD,CAAzC;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\nimport { useTable_unstable } from './useTable';\nimport { renderTable_unstable } from './renderTable';\nimport { useTableStyles_unstable } from './useTableStyles';\nimport type { TableProps } from './Table.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTableContextValues_unstable } from './useTableContextValues';\n\n/**\n * Table component - TODO: add more docs\n */\nexport const Table: ForwardRefComponent<TableProps> = React.forwardRef((props, ref) => {\n const state = useTable_unstable(props, ref);\n\n useTableStyles_unstable(state);\n return renderTable_unstable(state, useTableContextValues_unstable(state));\n});\n\nTable.displayName = 'Table';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
|
+
|
|
9
|
+
tslib_1.__exportStar(require("./Table"), exports);
|
|
10
|
+
|
|
11
|
+
tslib_1.__exportStar(require("./Table.types"), exports);
|
|
12
|
+
|
|
13
|
+
tslib_1.__exportStar(require("./renderTable"), exports);
|
|
14
|
+
|
|
15
|
+
tslib_1.__exportStar(require("./useTable"), exports);
|
|
16
|
+
|
|
17
|
+
tslib_1.__exportStar(require("./useTableStyles"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Table/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Table';\nexport * from './Table.types';\nexport * from './renderTable';\nexport * from './useTable';\nexport * from './useTableStyles';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderTable_unstable = void 0;
|
|
7
|
+
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
+
|
|
12
|
+
const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
|
|
13
|
+
/**
|
|
14
|
+
* Render the final JSX of Table
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const renderTable_unstable = (state, contextValues) => {
|
|
19
|
+
const {
|
|
20
|
+
slots,
|
|
21
|
+
slotProps
|
|
22
|
+
} = react_utilities_1.getSlots(state);
|
|
23
|
+
return React.createElement(tableContext_1.TableContextProvider, {
|
|
24
|
+
value: contextValues.table
|
|
25
|
+
}, React.createElement(slots.root, { ...slotProps.root
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.renderTable_unstable = renderTable_unstable;
|
|
30
|
+
//# sourceMappingURL=renderTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Table/renderTable.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAoB,aAApB,KAAyD;EAC3F,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAqB,KAArB,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,oBAAD,EAAqB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAArB,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADF,CADF;AAKD,CARM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getSlots } 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) => {\n const { slots, slotProps } = getSlots<TableSlots>(state);\n\n return (\n <TableContextProvider value={contextValues.table}>\n <slots.root {...slotProps.root} />\n </TableContextProvider>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTable_unstable = void 0;
|
|
7
|
+
|
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
+
/**
|
|
10
|
+
* Create the state required to render Table.
|
|
11
|
+
*
|
|
12
|
+
* The returned state can be modified with hooks such as useTableStyles_unstable,
|
|
13
|
+
* before being passed to renderTable_unstable.
|
|
14
|
+
*
|
|
15
|
+
* @param props - props from this instance of Table
|
|
16
|
+
* @param ref - reference to root HTMLElement of Table
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const useTable_unstable = (props, ref) => {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
|
|
23
|
+
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : props.noNativeElements) ? 'div' : 'table';
|
|
24
|
+
return {
|
|
25
|
+
components: {
|
|
26
|
+
root: rootComponent
|
|
27
|
+
},
|
|
28
|
+
root: react_utilities_1.getNativeElementProps(rootComponent, {
|
|
29
|
+
ref,
|
|
30
|
+
role: rootComponent === 'div' ? 'table' : undefined,
|
|
31
|
+
...props
|
|
32
|
+
}),
|
|
33
|
+
size: (_b = props.size) !== null && _b !== void 0 ? _b : 'medium',
|
|
34
|
+
noNativeElements: (_c = props.noNativeElements) !== null && _c !== void 0 ? _c : false,
|
|
35
|
+
sortable: (_d = props.sortable) !== null && _d !== void 0 ? _d : false
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.useTable_unstable = useTable_unstable;
|
|
40
|
+
//# sourceMappingURL=useTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/Table/useTable.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAA+D;;;EAC9F,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,KAAK,CAAC,gBAAlB,IAAqC,KAArC,GAA6C,OAAnE;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,aAAtB,EAAqC;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,OAA1B,GAAoC,SAFD;MAGzC,GAAG;IAHsC,CAArC,CAJD;IASL,IAAI,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,IAAN,MAAU,IAAV,IAAU,EAAA,KAAA,KAAA,CAAV,GAAU,EAAV,GAAc,QATf;IAUL,gBAAgB,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,gBAAN,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,EAAtB,GAA0B,KAVvC;IAWL,QAAQ,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,QAAN,MAAc,IAAd,IAAc,EAAA,KAAA,KAAA,CAAd,GAAc,EAAd,GAAkB;EAXvB,CAAP;AAaD,CAhBM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } 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: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'table' : undefined,\n ...props,\n }),\n size: props.size ?? 'medium',\n noNativeElements: props.noNativeElements ?? false,\n sortable: props.sortable ?? false,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTableContextValues_unstable = void 0;
|
|
7
|
+
|
|
8
|
+
function useTableContextValues_unstable(state) {
|
|
9
|
+
const {
|
|
10
|
+
size,
|
|
11
|
+
noNativeElements,
|
|
12
|
+
sortable
|
|
13
|
+
} = state;
|
|
14
|
+
return {
|
|
15
|
+
table: {
|
|
16
|
+
noNativeElements,
|
|
17
|
+
size,
|
|
18
|
+
sortable
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.useTableContextValues_unstable = useTableContextValues_unstable;
|
|
24
|
+
//# sourceMappingURL=useTableContextValues.js.map
|