"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const core_1 = require("@bluebase/core");
const react_1 = tslib_1.__importDefault(require("react"));
const components_1 = require("@bluebase/components");
class ThemeDarkModeSwitch extends react_1.default.PureComponent {
    async toggleDarkMode(changeTheme, BB) {
        const theme = BB.Configs.getValue('theme.name');
        const altTheme = await BB.Themes.resolveAlternate(theme);
        changeTheme(altTheme.key);
    }
    render() {
        const BB = this.context;
        return (react_1.default.createElement(core_1.ThemeContext.Consumer, null, ({ changeTheme, theme }) => (react_1.default.createElement(components_1.Switch
        // label="Dark Mode"
        // labelPlacement="start"
        , { 
            // label="Dark Mode"
            // labelPlacement="start"
            checked: theme.mode === 'dark', onValueChange: () => this.toggleDarkMode(changeTheme, BB) }))));
    }
}
ThemeDarkModeSwitch.contextType = core_1.BlueBaseContext;
exports.ThemeDarkModeSwitch = ThemeDarkModeSwitch;
