package.dist.ToggleButton.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webcomponents Show documentation
Show all versions of webcomponents Show documentation
UI5 Web Components: webcomponents.main
The newest version!
{"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../src/ToggleButton.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,oBAAoB,MAAM,mDAAmD,CAAC;AAErF,SAAS;AACT,OAAO,YAAY,MAAM,wCAAwC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,MAAM;IAAjC;;QACC;;;;WAIG;QAEH,YAAO,GAAG,KAAK,CAAC;IAkBjB,CAAC;IAhBA,QAAQ;QACP,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,QAAQ,EAAE,EAAE;YACf,IAAI,CAAC,SAAS,EAAG,CAAC,KAAK,EAAE,CAAC;SAC1B;IACF,CAAC;IAED,QAAQ,CAAC,CAAgB;QACxB,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE;YACpB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO;SACP;QAED,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;CACD,CAAA;AAlBA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CACZ;AAPX,YAAY;IALjB,aAAa,CAAC;QACd,GAAG,EAAE,mBAAmB;QACxB,QAAQ,EAAE,oBAAoB;QAC9B,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;KACrC,CAAC;GACI,YAAY,CAyBjB;AAED,YAAY,CAAC,MAAM,EAAE,CAAC;AAEtB,eAAe,YAAY,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\n\nimport { isSpaceShift } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { isSafari } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport Button from \"./Button.js\";\nimport ToggleButtonTemplate from \"./generated/templates/ToggleButtonTemplate.lit.js\";\n\n// Styles\nimport toggleBtnCss from \"./generated/themes/ToggleButton.css.js\";\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-toggle-button` component is an enhanced `ui5-button`\n * that can be toggled between pressed and normal states.\n * Users can use the `ui5-toggle-button` as a switch to turn a setting on or off.\n * It can also be used to represent an independent choice similar to a check box.\n *\n * Clicking or tapping on a `ui5-toggle-button` changes its state to `pressed`. The button returns to\n * its initial state when the user clicks or taps on it again.\n * By applying additional custom CSS-styling classes, apps can give a different style to any `ui5-toggle-button`.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/ToggleButton.js\";`\n * @constructor\n * @extends Button\n * @public\n */\n@customElement({\n\ttag: \"ui5-toggle-button\",\n\ttemplate: ToggleButtonTemplate,\n\tstyles: [Button.styles, toggleBtnCss],\n})\nclass ToggleButton extends Button {\n\t/**\n\t * Determines whether the component is displayed as pressed.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tpressed = false;\n\n\t_onclick() {\n\t\tthis.pressed = !this.pressed;\n\n\t\tif (isSafari()) {\n\t\t\tthis.getDomRef()!.focus();\n\t\t}\n\t}\n\n\t_onkeyup(e: KeyboardEvent) {\n\t\tif (isSpaceShift(e)) {\n\t\t\te.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tsuper._onkeyup(e);\n\t}\n}\n\nToggleButton.define();\n\nexport default ToggleButton;\n"]}