@kitten-science/kitten-scientists
Version:
Add-on for the wonderful incremental browser game: https://kittensgame.com/web/
36 lines • 1.48 kB
JavaScript
import { LimitedButton } from "./buttons/LimitedButton.js";
import { Container } from "./Container.js";
import stylesLabelListItem from "./LabelListItem.module.css";
import { SettingListItem } from "./SettingListItem.js";
export class SettingLimitedListItem extends SettingListItem {
limitedButton;
/**
* Create a UI element for a setting that can be limited.
* This will result in an element with a checkbox that has a "Limited" label.
*
* @param host The userscript instance.
* @param label The label for the setting.
* @param setting The setting model.
* @param options Options for the list item.
*/
constructor(parent, setting, label, options) {
super(parent, setting, label, options);
this.limitedButton = new LimitedButton(parent, setting, {
border: false,
onLimitedCheck: options?.onLimitedCheck
? () => options.onLimitedCheck?.call(this)
: undefined,
onLimitedUnCheck: options?.onLimitedUnCheck
? () => options.onLimitedUnCheck?.call(this)
: undefined,
});
this.addChildrenHead([
new Container(parent, { classes: [stylesLabelListItem.fillSpace] }),
this.limitedButton,
]);
}
toString() {
return `[${SettingLimitedListItem.name}#${this.componentId}]: '${this.elementLabel.text()}'`;
}
}
//# sourceMappingURL=SettingLimitedListItem.js.map