@neovici/cosmoz-button 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { normalize } from '@neovici/cosmoz-tokens/normalize';
2
- import { component, html } from '@pionjs/pion';
2
+ import { component, html, useEffect } from '@pionjs/pion';
3
3
  import { styles } from './styles';
4
4
  const observedAttributes = [
5
5
  'variant',
@@ -28,6 +28,14 @@ const observedAttributes = [
28
28
  const CosmozButton = (host) => {
29
29
  const disabled = host.hasAttribute('disabled');
30
30
  const type = host.getAttribute('type') || 'button';
31
+ useEffect(() => {
32
+ const handler = (e) => {
33
+ if (host.hasAttribute('disabled'))
34
+ e.stopImmediatePropagation();
35
+ };
36
+ host.addEventListener('click', handler, { capture: true });
37
+ return () => host.removeEventListener('click', handler, { capture: true });
38
+ }, []);
31
39
  return html `
32
40
  <button type=${type} class="button" ?disabled=${disabled} part="button">
33
41
  <slot name="prefix"></slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-button",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A customizable button web component built with Untitled UI design tokens",
5
5
  "keywords": [
6
6
  "web-components",