Select Git revision
datatable.mjs
-
Volker Schukai authoredVolker Schukai authored
button.mjs 8.38 KiB
/**
* Copyright schukai GmbH and contributors 2023. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import { instanceSymbol } from "../../constants.mjs";
import { addAttributeToken } from "../../dom/attributes.mjs";
import {
ATTRIBUTE_ERRORMESSAGE,
ATTRIBUTE_ROLE,
} from "../../dom/constants.mjs";
import { CustomControl } from "../../dom/customcontrol.mjs";
import {
assembleMethodSymbol,
attributeObserverSymbol,
registerCustomElement,
} from "../../dom/customelement.mjs";
import { findTargetElementFromEvent } from "../../dom/events.mjs";
import { isFunction } from "../../types/is.mjs";
import { ATTRIBUTE_BUTTON_CLASS } from "./constants.mjs";
import { ButtonStyleSheet } from "./stylesheet/button.mjs";
import { RippleStyleSheet } from "../stylesheet/ripple.mjs";
import { fireCustomEvent } from "../../dom/events.mjs";
import { isString } from "../../types/is.mjs";
export { Button };
/**
* @private
* @type {symbol}
*/
export const buttonElementSymbol = Symbol("buttonElement");
/**
* This CustomControl creates a button element with a variety of options.
*
* <img src="./images/button.png">
*
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
*
* You can create this control either by specifying the HTML tag <monster-button />` directly in the HTML or using
* Javascript via the `document.createElement('monster-button');` method.
*
* ```html
* <monster-button></monster-button>
* ```
*
* Or you can create this CustomControl directly in Javascript:
*
* ```js
* import {Button} from '@schukai/component-form/source/button.js';
* document.createElement('monster-button');
* ```
*
* The `data-monster-button-class` attribute can be used to change the CSS class of the button.
*
* @externalExample ../../../example/components/form/button.mjs
* @startuml button.png
* skinparam monochrome true
* skinparam shadowing false
* HTMLElement <|-- CustomElement
* CustomElement <|-- CustomControl
* CustomControl <|-- Button
* @enduml
*
* @since 1.5.0
* @copyright schukai GmbH
* @memberOf Monster.Components.Form
* @summary A simple button