@fluentui/react-table 9.0.0-alpha.12 → 9.0.0-alpha.14
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 +227 -1
- package/CHANGELOG.md +50 -2
- package/dist/index.d.ts +103 -53
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
- package/lib/components/DataGrid/useDataGrid.js +30 -6
- package/lib/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib/components/DataGrid/useDataGridContextValues.js +4 -1
- package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib/components/DataGridBody/useDataGridBody.js +12 -2
- package/lib/components/DataGridBody/useDataGridBody.js.map +1 -1
- package/lib/components/DataGridCell/useDataGridCell.js +1 -1
- package/lib/components/DataGridCell/useDataGridCell.js.map +1 -1
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +25 -2
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -1
- package/lib/components/DataGridRow/renderDataGridRow.js +9 -2
- package/lib/components/DataGridRow/renderDataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRow.js +62 -5
- package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRowStyles.js +7 -1
- package/lib/components/DataGridRow/useDataGridRowStyles.js.map +1 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +37 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib/components/Table/Table.types.js.map +1 -1
- package/lib/components/TableCell/TableCell.types.js.map +1 -1
- package/lib/components/TableCell/useTableCell.js +4 -2
- package/lib/components/TableCell/useTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCellStyles.js +31 -5
- package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActions.js +2 -3
- package/lib/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActionsStyles.js +2 -8
- package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayout.js +3 -2
- package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +20 -6
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCell.js +11 -6
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +17 -7
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib/components/TableRow/TableRow.types.js.map +1 -1
- package/lib/components/TableRow/useTableRow.js +3 -2
- package/lib/components/TableRow/useTableRow.js.map +1 -1
- package/lib/components/TableRow/useTableRowStyles.js +14 -29
- package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +12 -6
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib/contexts/columnIdContext.js +10 -0
- package/lib/contexts/columnIdContext.js.map +1 -0
- package/lib/contexts/dataGridContext.js +3 -0
- package/lib/contexts/dataGridContext.js.map +1 -1
- package/lib/contexts/rowIdContext.js +10 -0
- package/lib/contexts/rowIdContext.js.map +1 -0
- package/lib/hooks/index.js +3 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/{useTable.js → useTableFeatures.js} +4 -4
- package/lib/hooks/useTableFeatures.js.map +1 -0
- package/lib/hooks/{useSelection.js → useTableSelection.js} +10 -6
- package/lib/hooks/useTableSelection.js.map +1 -0
- package/lib/hooks/{useSort.js → useTableSort.js} +4 -4
- package/lib/hooks/useTableSort.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGrid.js +30 -6
- package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +4 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js +15 -2
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js.map +1 -1
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js +1 -1
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js.map +1 -1
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +29 -2
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js +10 -2
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js +69 -5
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js +7 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js.map +1 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +41 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCell.js +4 -2
- package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCellStyles.js +32 -5
- package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js +1 -3
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +2 -9
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +3 -2
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +21 -6
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +11 -5
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +18 -7
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRow.js +2 -1
- package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRowStyles.js +14 -29
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +13 -6
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib-commonjs/contexts/columnIdContext.js +21 -0
- package/lib-commonjs/contexts/columnIdContext.js.map +1 -0
- package/lib-commonjs/contexts/dataGridContext.js +3 -0
- package/lib-commonjs/contexts/dataGridContext.js.map +1 -1
- package/lib-commonjs/contexts/rowIdContext.js +21 -0
- package/lib-commonjs/contexts/rowIdContext.js.map +1 -0
- package/lib-commonjs/hooks/index.js +3 -3
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/{useTable.js → useTableFeatures.js} +10 -10
- package/lib-commonjs/hooks/useTableFeatures.js.map +1 -0
- package/lib-commonjs/hooks/{useSelection.js → useTableSelection.js} +13 -9
- package/lib-commonjs/hooks/useTableSelection.js.map +1 -0
- package/lib-commonjs/hooks/{useSort.js → useTableSort.js} +7 -7
- package/lib-commonjs/hooks/useTableSort.js.map +1 -0
- package/lib-commonjs/index.js +7 -7
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -9
- package/lib/hooks/useSelection.js.map +0 -1
- package/lib/hooks/useSort.js.map +0 -1
- package/lib/hooks/useTable.js.map +0 -1
- package/lib-commonjs/hooks/useSelection.js.map +0 -1
- package/lib-commonjs/hooks/useSort.js.map +0 -1
- package/lib-commonjs/hooks/useTable.js.map +0 -1
|
@@ -5,9 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridRow_unstable = void 0;
|
|
7
7
|
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
+
|
|
12
|
+
const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
|
13
|
+
|
|
8
14
|
const useTableRow_1 = /*#__PURE__*/require("../TableRow/useTableRow");
|
|
9
15
|
|
|
10
16
|
const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext");
|
|
17
|
+
|
|
18
|
+
const columnIdContext_1 = /*#__PURE__*/require("../../contexts/columnIdContext");
|
|
19
|
+
|
|
20
|
+
const DataGridSelectionCell_1 = /*#__PURE__*/require("../DataGridSelectionCell/DataGridSelectionCell");
|
|
21
|
+
|
|
22
|
+
const rowIdContext_1 = /*#__PURE__*/require("../../contexts/rowIdContext");
|
|
23
|
+
|
|
24
|
+
const tableHeaderContext_1 = /*#__PURE__*/require("../../contexts/tableHeaderContext");
|
|
11
25
|
/**
|
|
12
26
|
* Create the state required to render DataGridRow.
|
|
13
27
|
*
|
|
@@ -20,15 +34,65 @@ const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext")
|
|
|
20
34
|
|
|
21
35
|
|
|
22
36
|
const useDataGridRow_unstable = (props, ref) => {
|
|
37
|
+
const rowId = rowIdContext_1.useRowIdContext();
|
|
38
|
+
const isHeader = tableHeaderContext_1.useIsInTableHeader();
|
|
23
39
|
const columnDefs = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.columns);
|
|
40
|
+
const selectable = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selectableRows);
|
|
41
|
+
const selected = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));
|
|
42
|
+
const tabbable = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.focusMode === 'row_unstable');
|
|
43
|
+
const appearance = dataGridContext_1.useDataGridContext_unstable(ctx => {
|
|
44
|
+
if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {
|
|
45
|
+
return ctx.selectionAppearance;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return 'none';
|
|
49
|
+
});
|
|
50
|
+
const toggleRow = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.toggleRow);
|
|
24
51
|
const cellRenderFunction = props.children;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
52
|
+
const cells = columnDefs.map(columnDef => {
|
|
53
|
+
return React.createElement(columnIdContext_1.ColumnIdContextProvider, {
|
|
54
|
+
value: columnDef.columnId,
|
|
55
|
+
key: columnDef.columnId
|
|
56
|
+
}, cellRenderFunction(columnDef));
|
|
57
|
+
});
|
|
58
|
+
const onClick = react_utilities_1.useEventCallback(e => {
|
|
59
|
+
var _a;
|
|
60
|
+
|
|
61
|
+
if (selectable && !isHeader) {
|
|
62
|
+
toggleRow(e, rowId);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
66
|
+
});
|
|
67
|
+
const onKeyDown = react_utilities_1.useEventCallback(e => {
|
|
68
|
+
var _a;
|
|
69
|
+
|
|
70
|
+
if (selectable && !isHeader && e.key === keyboard_keys_1.Space && !react_utilities_1.isInteractiveHTMLElement(e.target)) {
|
|
71
|
+
// stop scrolling
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
toggleRow(e, rowId);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
27
77
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
78
|
+
const baseState = useTableRow_1.useTableRow_unstable({
|
|
79
|
+
appearance,
|
|
80
|
+
'aria-selected': selectable ? selected : undefined,
|
|
81
|
+
...props,
|
|
82
|
+
onClick,
|
|
83
|
+
onKeyDown,
|
|
84
|
+
children: cells,
|
|
85
|
+
as: 'div',
|
|
86
|
+
tabIndex: tabbable && !isHeader ? 0 : undefined
|
|
31
87
|
}, ref);
|
|
88
|
+
return { ...baseState,
|
|
89
|
+
components: { ...baseState.components,
|
|
90
|
+
selectionCell: DataGridSelectionCell_1.DataGridSelectionCell
|
|
91
|
+
},
|
|
92
|
+
selectionCell: react_utilities_1.resolveShorthand(props.selectionCell, {
|
|
93
|
+
required: selectable
|
|
94
|
+
})
|
|
95
|
+
};
|
|
32
96
|
};
|
|
33
97
|
|
|
34
98
|
exports.useDataGridRow_unstable = useDataGridRow_unstable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,gDAAA,CAAA;;AACA,MAAA,cAAA,gBAA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EACV,GAAG,SAAS,CAAC,UADH;MAEV,aAAa,EAAE,uBAAA,CAAA;IAFL,CAFP;IAML,aAAa,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,aAAvB,EAAsC;MAAE,QAAQ,EAAE;IAAZ,CAAtC;EANV,CAAP;AAQD,CAjEM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, resolveShorthand } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { ColumnIdContextProvider } from '../../contexts/columnIdContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\n\n/**\n * Create the state required to render DataGridRow.\n *\n * The returned state can be modified with hooks such as useDataGridRowStyles_unstable,\n * before being passed to renderDataGridRow_unstable.\n *\n * @param props - props from this instance of DataGridRow\n * @param ref - reference to root HTMLElement of DataGridRow\n */\nexport const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => {\n const rowId = useRowIdContext();\n const isHeader = useIsInTableHeader();\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);\n const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));\n const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode === 'row_unstable');\n const appearance = useDataGridContext_unstable(ctx => {\n if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {\n return ctx.selectionAppearance;\n }\n\n return 'none';\n });\n const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);\n\n const cellRenderFunction = props.children;\n const cells = columnDefs.map(columnDef => {\n return (\n <ColumnIdContextProvider value={columnDef.columnId} key={columnDef.columnId}>\n {cellRenderFunction(columnDef)}\n </ColumnIdContextProvider>\n );\n });\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n\n props.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target as HTMLElement)) {\n // stop scrolling\n e.preventDefault();\n toggleRow(e, rowId);\n }\n\n props.onKeyDown?.(e);\n });\n\n const baseState = useTableRow_unstable(\n {\n appearance,\n 'aria-selected': selectable ? selected : undefined,\n ...props,\n onClick,\n onKeyDown,\n children: cells,\n as: 'div',\n tabIndex: tabbable && !isHeader ? 0 : undefined,\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: resolveShorthand(props.selectionCell, { required: selectable }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -10,7 +10,8 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
10
10
|
const useTableRowStyles_1 = /*#__PURE__*/require("../TableRow/useTableRowStyles");
|
|
11
11
|
|
|
12
12
|
exports.dataGridRowClassNames = {
|
|
13
|
-
root: 'fui-DataGridRow'
|
|
13
|
+
root: 'fui-DataGridRow',
|
|
14
|
+
selectionCell: 'fui-DataGridRow__selectionCell'
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* Apply styling to the DataGridRow slots based on the state
|
|
@@ -19,6 +20,11 @@ exports.dataGridRowClassNames = {
|
|
|
19
20
|
const useDataGridRowStyles_unstable = state => {
|
|
20
21
|
useTableRowStyles_1.useTableRowStyles_unstable(state);
|
|
21
22
|
state.root.className = react_1.mergeClasses(exports.dataGridRowClassNames.root, state.root.className);
|
|
23
|
+
|
|
24
|
+
if (state.selectionCell) {
|
|
25
|
+
state.selectionCell.className = react_1.mergeClasses(exports.dataGridRowClassNames.selectionCell, state.selectionCell.className);
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
return state;
|
|
23
29
|
};
|
|
24
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAA,mBAAA,gBAAA,OAAA,CAAA,+BAAA,CAAA;;AAEa,OAAA,CAAA,qBAAA,GAA0D;EACrE,IAAI,EAAE
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAA,mBAAA,gBAAA,OAAA,CAAA,+BAAA,CAAA;;AAEa,OAAA,CAAA,qBAAA,GAA0D;EACrE,IAAI,EAAE,iBAD+D;EAErE,aAAa,EAAE;AAFsD,CAA1D;AAKb;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA8C;EACzF,mBAAA,CAAA,0BAAA,CAA2B,KAA3B;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,qBAAA,CAAsB,IAAnC,EAAyC,KAAK,CAAC,IAAN,CAAW,SAApD,CAAvB;;EACA,IAAI,KAAK,CAAC,aAAV,EAAyB;IACvB,KAAK,CAAC,aAAN,CAAoB,SAApB,GAAgC,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,qBAAA,CAAsB,aAAnC,EAAkD,KAAK,CAAC,aAAN,CAAoB,SAAtE,CAAhC;EACD;;EAED,OAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport type { DataGridRowSlots, DataGridRowState } from './DataGridRow.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { useTableRowStyles_unstable } from '../TableRow/useTableRowStyles';\n\nexport const dataGridRowClassNames: SlotClassNames<DataGridRowSlots> = {\n root: 'fui-DataGridRow',\n selectionCell: 'fui-DataGridRow__selectionCell',\n};\n\n/**\n * Apply styling to the DataGridRow slots based on the state\n */\nexport const useDataGridRowStyles_unstable = (state: DataGridRowState): DataGridRowState => {\n useTableRowStyles_unstable(state);\n state.root.className = mergeClasses(dataGridRowClassNames.root, state.root.className);\n if (state.selectionCell) {\n state.selectionCell.className = mergeClasses(dataGridRowClassNames.selectionCell, state.selectionCell.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -5,6 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridSelectionCell_unstable = void 0;
|
|
7
7
|
|
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
+
|
|
10
|
+
const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext");
|
|
11
|
+
|
|
12
|
+
const rowIdContext_1 = /*#__PURE__*/require("../../contexts/rowIdContext");
|
|
13
|
+
|
|
14
|
+
const tableHeaderContext_1 = /*#__PURE__*/require("../../contexts/tableHeaderContext");
|
|
15
|
+
|
|
8
16
|
const useTableSelectionCell_1 = /*#__PURE__*/require("../TableSelectionCell/useTableSelectionCell");
|
|
9
17
|
/**
|
|
10
18
|
* Create the state required to render DataGridSelectionCell.
|
|
@@ -18,10 +26,42 @@ const useTableSelectionCell_1 = /*#__PURE__*/require("../TableSelectionCell/useT
|
|
|
18
26
|
|
|
19
27
|
|
|
20
28
|
const useDataGridSelectionCell_unstable = (props, ref) => {
|
|
29
|
+
const isHeader = tableHeaderContext_1.useIsInTableHeader();
|
|
30
|
+
const rowId = rowIdContext_1.useRowIdContext();
|
|
31
|
+
const subtle = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.subtleSelection);
|
|
32
|
+
const checked = dataGridContext_1.useDataGridContext_unstable(ctx => {
|
|
33
|
+
if (isHeader && ctx.selection.selectionMode === 'multiselect') {
|
|
34
|
+
return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return ctx.selection.isRowSelected(rowId);
|
|
38
|
+
});
|
|
39
|
+
const toggleAllRows = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);
|
|
40
|
+
const type = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');
|
|
41
|
+
const onClick = react_utilities_1.useEventCallback(e => {
|
|
42
|
+
var _a;
|
|
43
|
+
|
|
44
|
+
if (isHeader) {
|
|
45
|
+
toggleAllRows(e);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
49
|
+
});
|
|
21
50
|
return useTableSelectionCell_1.useTableSelectionCell_unstable({
|
|
22
51
|
as: 'div',
|
|
23
52
|
role: 'gridcell',
|
|
24
|
-
|
|
53
|
+
checked,
|
|
54
|
+
type,
|
|
55
|
+
tabIndex: 0,
|
|
56
|
+
hidden: isHeader && type === 'radio',
|
|
57
|
+
'aria-checked': isHeader ? checked : undefined,
|
|
58
|
+
'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,
|
|
59
|
+
subtle,
|
|
60
|
+
checkboxIndicator: {
|
|
61
|
+
tabIndex: -1
|
|
62
|
+
},
|
|
63
|
+
...props,
|
|
64
|
+
onClick
|
|
25
65
|
}, ref);
|
|
26
66
|
};
|
|
27
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":";;;;;;;AAC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Ac,aAAjD,CAAtB;EACA,MAAM,IAAI,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAC1C,GAAG,CAAC,SAAJ,CAAc,aAAd,KAAgC,aAAhC,GAAgD,UAAhD,GAA6D,OADlD,CAAb;EAIA,MAAM,OAAO,GAAG,iBAAA,CAAA,gBAAA,CAAkB,CAAD,IAA8C;;;IAC7E,IAAI,QAAJ,EAAc;MACZ,aAAa,CAAC,CAAD,CAAb;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CANe,CAAhB;EAQA,OAAO,uBAAA,CAAA,8BAAA,CACL;IACE,EAAE,EAAE,KADN;IAEE,IAAI,EAAE,UAFR;IAGE,OAHF;IAIE,IAJF;IAKE,QAAQ,EAAE,CALZ;IAME,MAAM,EAAE,QAAQ,IAAI,IAAI,KAAK,OAN/B;IAOE,gBAAgB,QAAQ,GAAG,OAAH,GAAa,SAPvC;IAQE,iBAAiB,QAAQ,IAAI,OAAO,KAAK,OAAxB,GAAkC,SAAlC,GAA8C,OARjE;IASE,MATF;IAUE,iBAAiB,EAAE;MAAE,QAAQ,EAAE,CAAC;IAAb,CAVrB;IAWE,GAAG,KAXL;IAYE;EAZF,CADK,EAeL,GAfK,CAAP;AAiBD,CA7CM;;AAAM,OAAA,CAAA,iCAAA,GAAiC,iCAAjC","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n const isHeader = useIsInTableHeader();\n const rowId = useRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === 'multiselect') {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n\n return ctx.selection.isRowSelected(rowId);\n });\n\n const toggleAllRows = useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable(ctx =>\n ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio',\n );\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableCellElement>) => {\n if (isHeader) {\n toggleAllRows(e);\n }\n\n props.onClick?.(e);\n });\n\n return useTableSelectionCell_unstable(\n {\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n tabIndex: 0,\n hidden: isHeader && type === 'radio',\n 'aria-checked': isHeader ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n checkboxIndicator: { tabIndex: -1 },\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -23,7 +23,8 @@ const useTableCell_unstable = (props, ref) => {
|
|
|
23
23
|
var _a;
|
|
24
24
|
|
|
25
25
|
const {
|
|
26
|
-
noNativeElements
|
|
26
|
+
noNativeElements,
|
|
27
|
+
size
|
|
27
28
|
} = tableContext_1.useTableContext();
|
|
28
29
|
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'td';
|
|
29
30
|
return {
|
|
@@ -35,7 +36,8 @@ const useTableCell_unstable = (props, ref) => {
|
|
|
35
36
|
role: rootComponent === 'div' ? 'cell' : undefined,
|
|
36
37
|
...props
|
|
37
38
|
}),
|
|
38
|
-
noNativeElements
|
|
39
|
+
noNativeElements,
|
|
40
|
+
size
|
|
39
41
|
};
|
|
40
42
|
};
|
|
41
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE,gBAAF;IAAoB;EAApB,IAA6B,cAAA,CAAA,eAAA,EAAnC;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;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,MAA1B,GAAmC,SAFA;MAGzC,GAAG;IAHsC,CAArC,CAJD;IASL,gBATK;IAUL;EAVK,CAAP;AAYD,CAjBM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableCellProps, TableCellState } from './TableCell.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableCell.\n *\n * The returned state can be modified with hooks such as useTableCellStyles_unstable,\n * before being passed to renderTableCell_unstable.\n *\n * @param props - props from this instance of TableCell\n * @param ref - reference to root HTMLElement of TableCell\n */\nexport const useTableCell_unstable = (props: TableCellProps, ref: React.Ref<HTMLElement>): TableCellState => {\n const { noNativeElements, size } = useTableContext();\n\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'td';\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'cell' : undefined,\n ...props,\n }),\n noNativeElements,\n size,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,6 +9,8 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
9
9
|
|
|
10
10
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
11
11
|
|
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
13
|
+
|
|
12
14
|
exports.tableCellClassName = 'fui-TableCell';
|
|
13
15
|
exports.tableCellClassNames = {
|
|
14
16
|
root: exports.tableCellClassName
|
|
@@ -18,9 +20,18 @@ const useTableLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
|
18
20
|
"root": {
|
|
19
21
|
"mc9l5x": "f15pt5es",
|
|
20
22
|
"ha4doy": "fmrv4ls"
|
|
23
|
+
},
|
|
24
|
+
"medium": {
|
|
25
|
+
"Bqenvij": "f1ft4266"
|
|
26
|
+
},
|
|
27
|
+
"small": {
|
|
28
|
+
"Bqenvij": "fbsu25e"
|
|
29
|
+
},
|
|
30
|
+
"extra-small": {
|
|
31
|
+
"Bqenvij": "frvgh55"
|
|
21
32
|
}
|
|
22
33
|
}, {
|
|
23
|
-
"d": [".f15pt5es{display:table-cell;}", ".fmrv4ls{vertical-align:middle;}"]
|
|
34
|
+
"d": [".f15pt5es{display:table-cell;}", ".fmrv4ls{vertical-align:middle;}", ".f1ft4266{height:44px;}", ".fbsu25e{height:34px;}", ".frvgh55{height:24px;}"]
|
|
24
35
|
});
|
|
25
36
|
|
|
26
37
|
const useFlexLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
@@ -31,9 +42,18 @@ const useFlexLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
|
31
42
|
"Bh6795r": "fqerorx",
|
|
32
43
|
"Bnnss6s": "f1neuvcm",
|
|
33
44
|
"xawz": "fkjuxzh"
|
|
45
|
+
},
|
|
46
|
+
"medium": {
|
|
47
|
+
"sshi5w": "f5pgtk9"
|
|
48
|
+
},
|
|
49
|
+
"small": {
|
|
50
|
+
"sshi5w": "fcep9tg"
|
|
51
|
+
},
|
|
52
|
+
"extra-small": {
|
|
53
|
+
"sshi5w": "f1pha7fy"
|
|
34
54
|
}
|
|
35
55
|
}, {
|
|
36
|
-
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10tiqix{min-width:0px;}", ".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;}"]
|
|
56
|
+
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10tiqix{min-width:0px;}", ".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;}", ".f5pgtk9{min-height:44px;}", ".fcep9tg{min-height:34px;}", ".f1pha7fy{min-height:24px;}"]
|
|
37
57
|
});
|
|
38
58
|
/**
|
|
39
59
|
* Styles for the root slot
|
|
@@ -46,10 +66,17 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
46
66
|
"z8tnut": "f1nbblvp",
|
|
47
67
|
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
48
68
|
"Byoj8tv": "f1ov4xf1",
|
|
49
|
-
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"]
|
|
69
|
+
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"],
|
|
70
|
+
"Bn4voq9": "fz36nt7",
|
|
71
|
+
"g9k6zt": "f9znhxp",
|
|
72
|
+
"Bfpq7zp": "fqrak0z",
|
|
73
|
+
"kdpuga": ["f1o2ludy", "f1kjnpwc"],
|
|
74
|
+
"Bw81rd7": ["f1kjnpwc", "f1o2ludy"],
|
|
75
|
+
"B6xbmo0": ["fxmnebo", "f1witrsb"],
|
|
76
|
+
"dm238s": ["f1witrsb", "fxmnebo"]
|
|
50
77
|
}
|
|
51
78
|
}, {
|
|
52
|
-
"d": [".f10pi13n{position:relative;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}"]
|
|
79
|
+
"d": [".f10pi13n{position:relative;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}", ".fz36nt7[data-fui-focus-visible]{outline-width:2px;}", ".f9znhxp[data-fui-focus-visible]{outline-style:solid;}", ".fqrak0z[data-fui-focus-visible]{outline-color:var(--colorStrokeFocus2);}", ".f1o2ludy[data-fui-focus-visible]{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1kjnpwc[data-fui-focus-visible]{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fxmnebo[data-fui-focus-visible]{border-top-right-radius:var(--borderRadiusMedium);}", ".f1witrsb[data-fui-focus-visible]{border-top-left-radius:var(--borderRadiusMedium);}"]
|
|
53
80
|
});
|
|
54
81
|
/**
|
|
55
82
|
* Apply styling to the TableCell slots based on the state
|
|
@@ -62,7 +89,7 @@ const useTableCellStyles_unstable = state => {
|
|
|
62
89
|
table: useTableLayoutStyles(),
|
|
63
90
|
flex: useFlexLayoutStyles()
|
|
64
91
|
};
|
|
65
|
-
state.root.className = react_1.mergeClasses(exports.tableCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
|
|
92
|
+
state.root.className = react_1.mergeClasses(exports.tableCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.noNativeElements ? layoutStyles.flex[state.size] : layoutStyles.table[state.size], state.root.className);
|
|
66
93
|
return state;
|
|
67
94
|
};
|
|
68
95
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCellStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAIa,OAAA,CAAA,kBAAA,GAAqB,eAArB;AACA,OAAA,CAAA,mBAAA,GAAsD;EACjE,IAAI,EAAE,OAAA,CAAA;AAD2D,CAAtD;;AAIb,MAAM,oBAAoB,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EA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Ab,CAAmB,IAHhD,EAIrB,KAAK,CAAC,gBAAN,GAAyB,YAAY,CAAC,IAAb,CAAkB,KAAK,CAAC,IAAxB,CAAzB,GAAyD,YAAY,CAAC,KAAb,CAAmB,KAAK,CAAC,IAAzB,CAJpC,EAKrB,KAAK,CAAC,IAAN,CAAW,SALU,CAAvB;EAOA,OAAO,KAAP;AACD,CAdM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport type { TableCellSlots, TableCellState } from './TableCell.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableCellClassName = 'fui-TableCell';\nexport const tableCellClassNames: SlotClassNames<TableCellSlots> = {\n root: tableCellClassName,\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-cell',\n verticalAlign: 'middle',\n },\n\n medium: {\n height: '44px',\n },\n\n small: {\n height: '34px',\n },\n\n 'extra-small': {\n height: '24px',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n minWidth: '0px',\n alignItems: 'center',\n ...shorthands.flex(1, 1, '0px'),\n },\n\n medium: {\n minHeight: '44px',\n },\n\n small: {\n minHeight: '34px',\n },\n\n 'extra-small': {\n minHeight: '24px',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n ...shorthands.padding('0px', tokens.spacingHorizontalS),\n\n ...createCustomFocusIndicatorStyle(\n {\n ...shorthands.outline('2px', 'solid', tokens.colorStrokeFocus2),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n { selector: 'focus', enableOutline: true },\n ),\n },\n});\n\n/**\n * Apply styling to the TableCell slots based on the state\n */\nexport const useTableCellStyles_unstable = (state: TableCellState): TableCellState => {\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableCellClassNames.root,\n styles.root,\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n state.noNativeElements ? layoutStyles.flex[state.size] : layoutStyles.table[state.size],\n state.root.className,\n );\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useTableCellActions_unstable = void 0;
|
|
7
7
|
|
|
8
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
-
|
|
10
|
-
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
11
9
|
/**
|
|
12
10
|
* Create the state required to render TableCellActions.
|
|
13
11
|
*
|
|
@@ -27,7 +25,7 @@ const useTableCellActions_unstable = (props, ref) => {
|
|
|
27
25
|
root: 'div'
|
|
28
26
|
},
|
|
29
27
|
root: react_utilities_1.getNativeElementProps('div', {
|
|
30
|
-
ref
|
|
28
|
+
ref,
|
|
31
29
|
...props
|
|
32
30
|
}),
|
|
33
31
|
visible: (_a = props.visible) !== null && _a !== void 0 ? _a : false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActions.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActions.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,4BAA4B,GAAG,CAC1C,KAD0C,EAE1C,GAF0C,KAGjB;;;EACzB,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;MACjC,GADiC;MAEjC,GAAG;IAF8B,CAA7B,CAJD;IAQL,OAAO,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,EAAb,GAAiB;EARrB,CAAP;AAUD,CAdM;;AAAM,OAAA,CAAA,4BAAA,GAA4B,4BAA5B","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableCellActionsProps, TableCellActionsState } from './TableCellActions.types';\n\n/**\n * Create the state required to render TableCellActions.\n *\n * The returned state can be modified with hooks such as useTableCellActionsStyles_unstable,\n * before being passed to renderTableCellActions_unstable.\n *\n * @param props - props from this instance of TableCellActions\n * @param ref - reference to root HTMLElement of TableCellActions\n */\nexport const useTableCellActions_unstable = (\n props: TableCellActionsProps,\n ref: React.Ref<HTMLElement>,\n): TableCellActionsState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n visible: props.visible ?? false,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -7,8 +7,6 @@ exports.useTableCellActionsStyles_unstable = exports.tableCellActionsClassNames
|
|
|
7
7
|
|
|
8
8
|
const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
9
9
|
|
|
10
|
-
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
11
|
-
|
|
12
10
|
exports.tableCellActionsClassNames = {
|
|
13
11
|
root: 'fui-TableCellActions'
|
|
14
12
|
};
|
|
@@ -23,18 +21,13 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
23
21
|
"Bhzewxz": "f1i1t8d1",
|
|
24
22
|
"Bz10aip": "f188r07x",
|
|
25
23
|
"abs64n": "fk73vx1",
|
|
26
|
-
"Frg6f3": ["fcgxt0o", "f1ujusj6"]
|
|
27
|
-
"Brovlpu": "ftqa4ok",
|
|
28
|
-
"B486eqv": "f2hkw1w",
|
|
29
|
-
"B113ap8": "f1upwfw9"
|
|
24
|
+
"Frg6f3": ["fcgxt0o", "f1ujusj6"]
|
|
30
25
|
},
|
|
31
26
|
"visible": {
|
|
32
27
|
"abs64n": "f5p0z4x"
|
|
33
28
|
}
|
|
34
29
|
}, {
|
|
35
|
-
"d": [".f1euv43f{position:absolute;}", ".f10k790i{right:0px;}", ".f1xynx9j{left:0px;}", ".f1i1t8d1{top:50%;}", ".f188r07x{-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}", ".fk73vx1{opacity:0;}", ".fcgxt0o{margin-left:auto;}", ".f1ujusj6{margin-right:auto;}", ".
|
|
36
|
-
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
37
|
-
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
|
30
|
+
"d": [".f1euv43f{position:absolute;}", ".f10k790i{right:0px;}", ".f1xynx9j{left:0px;}", ".f1i1t8d1{top:50%;}", ".f188r07x{-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}", ".fk73vx1{opacity:0;}", ".fcgxt0o{margin-left:auto;}", ".f1ujusj6{margin-right:auto;}", ".f5p0z4x{opacity:1;}"]
|
|
38
31
|
});
|
|
39
32
|
/**
|
|
40
33
|
* Apply styling to the TableCellActions slots based on the state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActionsStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellActions/useTableCellActionsStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAIa,OAAA,CAAA,0BAAA,GAAoE;EAC/E,IAAI,EAAE;AADyE,CAApE;AAIb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAeA;;AAEG;;;AACI,MAAM,kCAAkC,GAAI,KAAD,IAAwD;EACxG,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,0BAAA,CAA2B,IADN,EAErB,MAAM,CAAC,IAFc,EAGrB,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAHH,EAIrB,KAAK,CAAC,IAAN,CAAW,SAJU,CAAvB;EAOA,OAAO,KAAP;AACD,CAVM;;AAAM,OAAA,CAAA,kCAAA,GAAkC,kCAAlC","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport type { TableCellActionsSlots, TableCellActionsState } from './TableCellActions.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableCellActionsClassNames: SlotClassNames<TableCellActionsSlots> = {\n root: 'fui-TableCellActions',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n position: 'absolute',\n right: '0px',\n top: '50%',\n transform: 'translateY(-50%)',\n opacity: 0,\n marginLeft: 'auto',\n },\n\n visible: {\n opacity: 1,\n },\n});\n\n/**\n * Apply styling to the TableCellActions slots based on the state\n */\nexport const useTableCellActionsStyles_unstable = (state: TableCellActionsState): TableCellActionsState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n tableCellActionsClassNames.root,\n styles.root,\n state.visible && styles.visible,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -12,7 +12,7 @@ const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
|
|
|
12
12
|
const tableAvatarSizeMap = {
|
|
13
13
|
medium: 32,
|
|
14
14
|
small: 24,
|
|
15
|
-
|
|
15
|
+
'extra-small': 20
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Create the state required to render TableCellLayout.
|
|
@@ -49,7 +49,8 @@ const useTableCellLayout_unstable = (props, ref) => {
|
|
|
49
49
|
wrapper: react_utilities_1.resolveShorthand(props.wrapper, {
|
|
50
50
|
required: !!props.description || !!props.children
|
|
51
51
|
}),
|
|
52
|
-
avatarSize: tableAvatarSizeMap[size]
|
|
52
|
+
avatarSize: tableAvatarSizeMap[size],
|
|
53
|
+
size
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellLayout/useTableCellLayout.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,MAAM,kBAAkB,GAAG;EACzB,MAAM,EAAE,EADiB;EAEzB,KAAK,EAAE,EAFkB;EAGzB,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellLayout/useTableCellLayout.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,MAAM,kBAAkB,GAAG;EACzB,MAAM,EAAE,EADiB;EAEzB,KAAK,EAAE,EAFkB;EAGzB,eAAe;AAHU,CAA3B;AAMA;;;;;;;;AAQG;;AACI,MAAM,2BAA2B,GAAG,CACzC,KADyC,EAEzC,GAFyC,KAGjB;EACxB,MAAM;IAAE;EAAF,IAAW,cAAA,CAAA,eAAA,EAAjB;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,IAAI,EAAE,MAFI;MAGV,WAAW,EAAE,MAHH;MAIV,OAAO,EAAE,KAJC;MAKV,KAAK,EAAE;IALG,CADP;IAQL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;MAAE,GAAF;MAAO,GAAG;IAAV,CAA7B,CARD;IASL,UAAU,EAAE,KAAK,CAAC,UATb;IAUL,IAAI,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,IAAvB,EAA6B;MAAE,QAAQ,EAAE;IAAZ,CAA7B,CAVD;IAWL,KAAK,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,KAAvB,CAXF;IAYL,WAAW,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,WAAvB,CAZR;IAaL,OAAO,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,OAAvB,EAAgC;MAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,WAAR,IAAuB,CAAC,CAAC,KAAK,CAAC;IAA3C,CAAhC,CAbJ;IAcL,UAAU,EAAE,kBAAkB,CAAC,IAAD,CAdzB;IAeL;EAfK,CAAP;AAiBD,CAvBM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { TableCellLayoutProps, TableCellLayoutState } from './TableCellLayout.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\nconst tableAvatarSizeMap = {\n medium: 32,\n small: 24,\n 'extra-small': 20,\n} as const;\n\n/**\n * Create the state required to render TableCellLayout.\n *\n * The returned state can be modified with hooks such as useTableCellLayoutStyles_unstable,\n * before being passed to renderTableCellLayout_unstable.\n *\n * @param props - props from this instance of TableCellLayout\n * @param ref - reference to root HTMLElement of TableCellLayout\n */\nexport const useTableCellLayout_unstable = (\n props: TableCellLayoutProps,\n ref: React.Ref<HTMLElement>,\n): TableCellLayoutState => {\n const { size } = useTableContext();\n\n return {\n components: {\n root: 'div',\n main: 'span',\n description: 'span',\n wrapper: 'div',\n media: 'span',\n },\n root: getNativeElementProps('div', { ref, ...props }),\n appearance: props.appearance,\n main: resolveShorthand(props.main, { required: true }),\n media: resolveShorthand(props.media),\n description: resolveShorthand(props.description),\n wrapper: resolveShorthand(props.wrapper, { required: !!props.description || !!props.children }),\n avatarSize: tableAvatarSizeMap[size],\n size,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,6 +9,8 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
9
9
|
|
|
10
10
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
11
11
|
|
|
12
|
+
const react_theme_2 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
13
|
+
|
|
12
14
|
exports.tableCellLayoutClassNames = {
|
|
13
15
|
root: 'fui-TableCellLayout',
|
|
14
16
|
media: 'fui-TableCellLayout__media',
|
|
@@ -38,19 +40,27 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
38
40
|
"mc9l5x": "f22iagw",
|
|
39
41
|
"Bt984gj": "f122n59"
|
|
40
42
|
},
|
|
43
|
+
"mediaExtraSmall": {
|
|
44
|
+
"Be2twd7": "f4ybsrx"
|
|
45
|
+
},
|
|
46
|
+
"mediaSmallAndMedium": {
|
|
47
|
+
"Be2twd7": "fe5j1ua"
|
|
48
|
+
},
|
|
41
49
|
"mediaPrimary": {
|
|
42
|
-
"
|
|
43
|
-
"p4uzdd": "fppfxz8"
|
|
50
|
+
"Be2twd7": "f1rt2boy"
|
|
44
51
|
},
|
|
45
52
|
"mainPrimary": {
|
|
46
53
|
"Bhrd7zp": "fl43uef"
|
|
47
54
|
},
|
|
48
55
|
"description": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
56
|
+
"sj55zd": "fkfq4zb",
|
|
57
|
+
"Bahqtrf": "fk6fouc",
|
|
58
|
+
"Be2twd7": "fy9rknc",
|
|
59
|
+
"Bhrd7zp": "figsok6",
|
|
60
|
+
"Bg96gwp": "fwrc4pm"
|
|
51
61
|
}
|
|
52
62
|
}, {
|
|
53
|
-
"d": [".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;}", ".fsnqrgy{-webkit-column-gap:var(--spacingHorizontalS);column-gap:var(--spacingHorizontalS);}", ".fylz90v{row-gap:var(--spacingHorizontalS);}", ".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;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".
|
|
63
|
+
"d": [".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;}", ".fsnqrgy{-webkit-column-gap:var(--spacingHorizontalS);column-gap:var(--spacingHorizontalS);}", ".fylz90v{row-gap:var(--spacingHorizontalS);}", ".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;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f4ybsrx{font-size:16px;}", ".fe5j1ua{font-size:20px;}", ".f1rt2boy{font-size:24px;}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}"]
|
|
54
64
|
});
|
|
55
65
|
/**
|
|
56
66
|
* Apply styling to the TableCellLayout slots based on the state
|
|
@@ -63,7 +73,12 @@ const useTableCellLayoutStyles_unstable = state => {
|
|
|
63
73
|
const primary = state.appearance === 'primary';
|
|
64
74
|
|
|
65
75
|
if (state.media) {
|
|
66
|
-
|
|
76
|
+
const mediaSizedStyles = {
|
|
77
|
+
small: styles.mediaSmallAndMedium,
|
|
78
|
+
medium: styles.mediaSmallAndMedium,
|
|
79
|
+
'extra-small': styles.mediaExtraSmall
|
|
80
|
+
};
|
|
81
|
+
state.media.className = react_1.mergeClasses(exports.tableCellLayoutClassNames.media, styles.media, mediaSizedStyles[state.size], primary && styles.mediaPrimary, state.media.className);
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
if (state.main) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellLayout/useTableCellLayoutStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCellLayout/useTableCellLayoutStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAGA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAEa,OAAA,CAAA,yBAAA,GAAkE;EAC7E,IAAI,EAAE,qBADuE;EAE7E,KAAK,EAAE,4BAFsE;EAG7E,IAAI,EAAE,2BAHuE;EAI7E,WAAW,EAAE,kCAJgE;EAK7E,OAAO,EAAE;AALoE,CAAlE;AAQb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA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ADE,EAE5B,MAAM,CAAC,WAFqB,EAG5B,KAAK,CAAC,WAAN,CAAkB,SAHU,CAA9B;EAKD;;EAED,IAAI,KAAK,CAAC,OAAV,EAAmB;IACjB,KAAK,CAAC,OAAN,CAAc,SAAd,GAA0B,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,yBAAA,CAA0B,OAAvC,EAAgD,MAAM,CAAC,OAAvD,EAAgE,KAAK,CAAC,OAAN,CAAc,SAA9E,CAA1B;EACD;;EAED,OAAO,KAAP;AACD,CA1CM;;AAAM,OAAA,CAAA,iCAAA,GAAiC,iCAAjC","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TableCellLayoutSlots, TableCellLayoutState } from './TableCellLayout.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { typographyStyles } from '@fluentui/react-theme';\n\nexport const tableCellLayoutClassNames: SlotClassNames<TableCellLayoutSlots> = {\n root: 'fui-TableCellLayout',\n media: 'fui-TableCellLayout__media',\n main: 'fui-TableCellLayout__main',\n description: 'fui-TableCellLayout__description',\n wrapper: 'fui-TableCellLayout__wrapper',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n ...shorthands.gap(tokens.spacingHorizontalS),\n ...shorthands.flex(1, 1, '0px'),\n },\n wrapper: {\n display: 'flex',\n flexDirection: 'column',\n },\n\n media: {\n display: 'flex',\n alignItems: 'center',\n },\n\n mediaExtraSmall: {\n fontSize: '16px',\n },\n\n mediaSmallAndMedium: {\n fontSize: '20px',\n },\n\n mediaPrimary: {\n fontSize: '24px',\n },\n\n mainPrimary: {\n fontWeight: tokens.fontWeightSemibold,\n },\n\n description: {\n color: tokens.colorNeutralForeground2,\n ...typographyStyles.caption1,\n },\n});\n\n/**\n * Apply styling to the TableCellLayout slots based on the state\n */\nexport const useTableCellLayoutStyles_unstable = (state: TableCellLayoutState): TableCellLayoutState => {\n const styles = useStyles();\n state.root.className = mergeClasses(tableCellLayoutClassNames.root, styles.root, state.root.className);\n const primary = state.appearance === 'primary';\n\n if (state.media) {\n const mediaSizedStyles = {\n small: styles.mediaSmallAndMedium,\n medium: styles.mediaSmallAndMedium,\n 'extra-small': styles.mediaExtraSmall,\n };\n\n state.media.className = mergeClasses(\n tableCellLayoutClassNames.media,\n styles.media,\n mediaSizedStyles[state.size],\n primary && styles.mediaPrimary,\n state.media.className,\n );\n }\n\n if (state.main) {\n state.main.className = mergeClasses(\n tableCellLayoutClassNames.main,\n primary && styles.mainPrimary,\n state.main.className,\n );\n }\n\n if (state.description) {\n state.description.className = mergeClasses(\n tableCellLayoutClassNames.description,\n styles.description,\n state.description.className,\n );\n }\n\n if (state.wrapper) {\n state.wrapper.className = mergeClasses(tableCellLayoutClassNames.wrapper, styles.wrapper, state.wrapper.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,6 +9,8 @@ const React = /*#__PURE__*/require("react");
|
|
|
9
9
|
|
|
10
10
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
11
|
|
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
13
|
+
|
|
12
14
|
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
|
13
15
|
|
|
14
16
|
const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
|
|
@@ -16,8 +18,12 @@ const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
|
|
|
16
18
|
const react_aria_1 = /*#__PURE__*/require("@fluentui/react-aria");
|
|
17
19
|
|
|
18
20
|
const sortIcons = {
|
|
19
|
-
ascending: /*#__PURE__*/React.createElement(react_icons_1.ArrowUpRegular,
|
|
20
|
-
|
|
21
|
+
ascending: /*#__PURE__*/React.createElement(react_icons_1.ArrowUpRegular, {
|
|
22
|
+
fontSize: 12
|
|
23
|
+
}),
|
|
24
|
+
descending: /*#__PURE__*/React.createElement(react_icons_1.ArrowDownRegular, {
|
|
25
|
+
fontSize: 12
|
|
26
|
+
})
|
|
21
27
|
};
|
|
22
28
|
/**
|
|
23
29
|
* Create the state required to render TableHeaderCell.
|
|
@@ -30,7 +36,7 @@ const sortIcons = {
|
|
|
30
36
|
*/
|
|
31
37
|
|
|
32
38
|
const useTableHeaderCell_unstable = (props, ref) => {
|
|
33
|
-
var _a;
|
|
39
|
+
var _a, _b;
|
|
34
40
|
|
|
35
41
|
const {
|
|
36
42
|
noNativeElements,
|
|
@@ -44,9 +50,9 @@ const useTableHeaderCell_unstable = (props, ref) => {
|
|
|
44
50
|
sortIcon: 'span'
|
|
45
51
|
},
|
|
46
52
|
root: react_utilities_1.getNativeElementProps(rootComponent, {
|
|
47
|
-
ref,
|
|
53
|
+
ref: react_utilities_1.useMergedRefs(ref, react_tabster_1.useFocusWithin()),
|
|
48
54
|
role: rootComponent === 'div' ? 'columnheader' : undefined,
|
|
49
|
-
'aria-sort': props.sortDirection,
|
|
55
|
+
'aria-sort': sortable ? (_b = props.sortDirection) !== null && _b !== void 0 ? _b : 'none' : undefined,
|
|
50
56
|
...props
|
|
51
57
|
}),
|
|
52
58
|
sortIcon: react_utilities_1.resolveShorthand(props.sortIcon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableHeaderCell/useTableHeaderCell.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AAEA,MAAM,SAAS,GAAG;EAChB,SAAS,eAAE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,cAAD,EAAe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,aAAa,KAAK,KAAlB,GAA0B,cAA1B,GAA2C,SAFR;MAGzC,aAAa,QAAQ,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,aAAN,MAAmB,IAAnB,IAAmB,EAAA,KAAA,KAAA,CAAnB,GAAmB,EAAnB,GAAuB,MAA1B,GAAmC,SAHf;MAIzC,GAAG;IAJsC,CAArC,CAND;IAYL,QAAQ,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,QAAvB,EAAiC;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,CAAjC,CAZL;IAgBL,MAAM,EAAE,YAAA,CAAA,sBAAA,CAAuB,KAAK,CAAC,MAA7B,EAAqC;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,CAArC,CAhBH;IA4BL,QA5BK;IA6BL;EA7BK,CAAP;AA+BD,CAtCM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\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 fontSize={12} />,\n descending: <ArrowDownRegular fontSize={12} />,\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, sortable } = useTableContext();\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: useMergedRefs(ref, useFocusWithin()),\n role: rootComponent === 'div' ? 'columnheader' : undefined,\n 'aria-sort': sortable ? props.sortDirection ?? 'none' : undefined,\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 noNativeElements,\n };\n};\n"],"sourceRoot":"../src/"}
|