1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.ButtonGridBase = void 0;
|
4 | var tslib_1 = require("tslib");
|
5 | var React = require("react");
|
6 | var Utilities_1 = require("../../Utilities");
|
7 | var FocusZone_1 = require("../../FocusZone");
|
8 | var react_hooks_1 = require("@fluentui/react-hooks");
|
9 | var getClassNames = Utilities_1.classNamesFunction();
|
10 | exports.ButtonGridBase = React.forwardRef(function (props, forwardedRef) {
|
11 | var id = react_hooks_1.useId(undefined, props.id);
|
12 | var items = props.items, columnCount = props.columnCount, onRenderItem = props.onRenderItem, isSemanticRadio = props.isSemanticRadio,
|
13 |
|
14 | _a = props.ariaPosInSet,
|
15 |
|
16 | ariaPosInSet = _a === void 0 ? props.positionInSet : _a,
|
17 |
|
18 | _b = props.ariaSetSize,
|
19 |
|
20 | ariaSetSize = _b === void 0 ? props.setSize : _b, styles = props.styles, doNotContainWithinFocusZone = props.doNotContainWithinFocusZone;
|
21 | var htmlProps = Utilities_1.getNativeProps(props, Utilities_1.htmlElementProperties,
|
22 |
|
23 | doNotContainWithinFocusZone ? [] : ['onBlur']);
|
24 | var classNames = getClassNames(styles, { theme: props.theme });
|
25 |
|
26 | var rowsOfItems = Utilities_1.toMatrix(items, columnCount);
|
27 | var content = (React.createElement("table", tslib_1.__assign({ "aria-posinset": ariaPosInSet, "aria-setsize": ariaSetSize, id: id, role: isSemanticRadio ? 'radiogroup' : 'grid' }, htmlProps, { className: classNames.root }),
|
28 | React.createElement("tbody", { role: isSemanticRadio ? 'presentation' : 'rowgroup' }, rowsOfItems.map(function (rows, rowIndex) {
|
29 | return (React.createElement("tr", { role: isSemanticRadio ? 'presentation' : 'row', key: rowIndex }, rows.map(function (cell, cellIndex) {
|
30 | return (React.createElement("td", { role: "presentation", key: cellIndex + '-cell', className: classNames.tableCell }, onRenderItem(cell, cellIndex)));
|
31 | })));
|
32 | }))));
|
33 | return doNotContainWithinFocusZone ? (content) : (React.createElement(FocusZone_1.FocusZone, { elementRef: forwardedRef, isCircularNavigation: props.shouldFocusCircularNavigate, className: classNames.focusedContainer, onBlur: props.onBlur }, content));
|
34 | });
|
35 |
|
\ | No newline at end of file |