/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module UiProvider
 */
import "./DefaultDialogGridContainer.scss";
import classnames from "classnames";
import * as React from "react";
import { ToolSettingsContentContext } from "../widgets/ToolSettingsContent";
var LayoutMode;
(function (LayoutMode) {
    LayoutMode[LayoutMode["Wide"] = 0] = "Wide";
    LayoutMode[LayoutMode["Narrow"] = 1] = "Narrow";
})(LayoutMode || (LayoutMode = {}));
/**
 * Component to provide grid of property editors
 * @public
 */
export function ToolSettingsGridContainer({ componentGenerator, }) {
    const { availableContentWidth } = React.useContext(ToolSettingsContentContext);
    const layoutMode = toLayoutMode(availableContentWidth);
    const className = classnames("uifw-tool-settings-grid-container", 
    // istanbul ignore next
    LayoutMode.Narrow === layoutMode && "uifw-default-narrow");
    return (React.createElement(DialogGridContainer, { componentGenerator: componentGenerator, containerClassName: className }));
}
/** @internal */
// istanbul ignore next
export function DialogGridContainer({ componentGenerator, containerClassName, }) {
    const className = classnames("uifw-default-container", containerClassName);
    return (React.createElement("div", { className: "uifw-default-resizer-parent" },
        React.createElement("div", { className: className }, componentGenerator.uiDataProvider.rows.map((row, index) => componentGenerator.getRow(row, index)))));
}
/** DefaultDialogGridContainer populates a React node with the items specified by the UiLayoutDataProvider
 * @public
 */
export function DefaultDialogGridContainer({ componentGenerator, isToolSettings, }) {
    return !!isToolSettings ? (React.createElement(ToolSettingsGridContainer, { componentGenerator: componentGenerator })) : (
    /* istanbul ignore next */
    React.createElement(DialogGridContainer, { componentGenerator: componentGenerator }));
}
const toLayoutMode = (width) => {
    return width < 250 && width > 0
        ? /* istanbul ignore next */ LayoutMode.Narrow
        : LayoutMode.Wide;
};
//# sourceMappingURL=DefaultDialogGridContainer.js.map