edu-webcomponents 1.14.0 → 1.15.3

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.
package/CHANGELOG.md CHANGED
@@ -1,46 +1,58 @@
1
- # Change Log
1
+ # CHANGELOG
2
2
 
3
- ## 1.0.0 - 2024-05-25
4
- - (Initial commit) run npm init @open-wc and select these options: Scaffold a new project, scaffold a Web Component, add Linting (eslint & prettier) and Testing (web-test-runner), do not use typescript, use edu-webcomponents as tag name
3
+ ## 1.15.3 - 2025-08-02
4
+ - Fix EduButton is always disabled
5
5
 
6
- ## 1.1.0 - 2024-05-26
7
- - Setup Husky
6
+ ## 1.15.2 - 2025-08-02
7
+ - Fix EduButton is always disabled
8
8
 
9
- ## 1.2.0 - 2024-05-27
10
- - Setup the repository to be a library of web components
9
+ ## 1.15.1 - 2025-08-02
10
+ - Fix EduButton is always disabled
11
11
 
12
- ## 1.3.0 - 2024-05-28
13
- - Setup Storybook
12
+ ## 1.15.0 - 2025-08-02
13
+ - Improve EduButton component by adding aria-label and type attributes, disabled state and styles
14
14
 
15
- ## 1.4.0 - 2024-05-30
16
- - Setup GitHub Actions to publish Storybook built artifacts in GitHub Pages
15
+ ## 1.14.0 - 2024-06-21
16
+ - Update docs of publishing packages to npm registry with provenance
17
17
 
18
- ## 1.5.0 - 2024-05-30
19
- - Add docs to enable the deployment of GitHub Actions artifacts into GitHub Pages
18
+ ## 1.13.0 - 2024-06-20
19
+ - Fix provenance when publishing packages to npm registry
20
20
 
21
- ## 1.6.0 - 2024-06-01
22
- - Setup GitHub Actions to tag and release after merge into main
21
+ ## 1.12.0 - 2024-06-20
22
+ - Update dependencies
23
23
 
24
- ## 1.7.0 - 2024-06-02
25
- - Setup GitHub Actions to publish packages in npm registry
24
+ ## 1.11.0 - 2024-06-19
25
+ - Add provenance to packages in npm registry
26
26
 
27
- ## 1.8.0 - 2024-06-15
28
- - Setup [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) to manage updates of dependencies of package.json
27
+ ## 1.10.0 - 2024-06-17
28
+ - Add keywords to the repository
29
29
 
30
30
  ## 1.9.0 - 2024-06-16
31
31
  - Update dependencies
32
32
 
33
- ## 1.10.0 - 2024-06-17
34
- - Add keywords to the repository
33
+ ## 1.8.0 - 2024-06-15
34
+ - Setup [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) to manage updates of dependencies of package.json
35
35
 
36
- ## 1.11.0 - 2024-06-19
37
- - Add provenance to packages in npm registry
36
+ ## 1.7.0 - 2024-06-02
37
+ - Setup GitHub Actions to publish packages in npm registry
38
38
 
39
- ## 1.12.0 - 2024-06-20
40
- - Update dependencies
39
+ ## 1.6.0 - 2024-06-01
40
+ - Setup GitHub Actions to tag and release after merge into main
41
41
 
42
- ## 1.13.0 - 2024-06-20
43
- - Fix provenance when publishing packages to npm registry
42
+ ## 1.5.0 - 2024-05-30
43
+ - Add docs to enable the deployment of GitHub Actions artifacts into GitHub Pages
44
44
 
45
- ## 1.14.0 - 2024-06-21
46
- - Update docs of publishing packages to npm registry with provenance
45
+ ## 1.4.0 - 2024-05-30
46
+ - Setup GitHub Actions to publish Storybook built artifacts in GitHub Pages
47
+
48
+ ## 1.3.0 - 2024-05-28
49
+ - Setup Storybook
50
+
51
+ ## 1.2.0 - 2024-05-27
52
+ - Setup the repository to be a library of web components
53
+
54
+ ## 1.1.0 - 2024-05-26
55
+ - Setup Husky
56
+
57
+ ## 1.0.0 - 2024-05-25
58
+ - (Initial commit) run npm init @open-wc and select these options: Scaffold a new project, scaffold a Web Component, add Linting (eslint & prettier) and Testing (web-test-runner), do not use typescript, use edu-webcomponents as tag name
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "license": "MIT",
13
13
  "author": "edu-webcomponents",
14
- "version": "1.14.0",
14
+ "version": "1.15.3",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "https://github.com/eduardocruzpalacios/edu-webcomponents"
package/src/EduButton.js CHANGED
@@ -5,19 +5,52 @@ export class EduButton extends LitElement {
5
5
  :host {
6
6
  display: block;
7
7
  }
8
+
9
+ button {
10
+ padding: 0.5rem 1rem;
11
+ font-size: 1rem;
12
+ border: none;
13
+ border-radius: 4px;
14
+ background-color: #007acc;
15
+ color: white;
16
+ cursor: pointer;
17
+ transition: background-color 0.2s ease-in-out;
18
+ }
19
+
20
+ button:hover:not(:disabled) {
21
+ background-color: #005fa3;
22
+ }
23
+
24
+ button:disabled {
25
+ background-color: #ccc;
26
+ cursor: not-allowed;
27
+ }
8
28
  `;
9
29
 
10
30
  static properties = {
11
31
  text: { type: String },
32
+ type: { type: String },
33
+ ariaLabel: { type: String, attribute: 'aria-label' },
34
+ disabled: { type: Boolean, reflect: true },
12
35
  };
13
36
 
14
37
  constructor() {
15
38
  super();
16
39
  this.text = 'Default text';
40
+ this.type = 'button';
41
+ this.ariaLabel = this.text;
17
42
  }
18
43
 
19
44
  render() {
20
- return html` <button>${this.text}</button> `;
45
+ return html`
46
+ <button
47
+ type=${this.type}
48
+ aria-label=${this.ariaLabel}
49
+ ?disabled=${this.disabled}
50
+ >
51
+ ${this.text}
52
+ </button>
53
+ `;
21
54
  }
22
55
  }
23
56
 
@@ -4,13 +4,19 @@ import '../EduButton.js';
4
4
  export default {
5
5
  title: 'Edu web components/EduButton',
6
6
  tags: ['autodocs'],
7
- render: ({ text }) => html`<edu-button .text=${text}></edu-button>`,
7
+ render: ({ text, disabled }) =>
8
+ html`<edu-button .text=${text} ?disabled=${disabled}></edu-button>`,
8
9
  argTypes: {
9
10
  text: {
10
11
  control: 'text',
11
12
  description: 'Overwritten button text',
12
13
  name: 'text',
13
14
  },
15
+ disabled: {
16
+ control: 'boolean',
17
+ description: 'Disable button',
18
+ name: 'disabled',
19
+ },
14
20
  },
15
21
  args: {
16
22
  text: 'Default text',
@@ -26,3 +32,9 @@ export const ButtonWithTextChanged = {
26
32
  text: 'Custom text',
27
33
  },
28
34
  };
35
+
36
+ export const ButtonDisabled = {
37
+ args: {
38
+ disabled: true,
39
+ },
40
+ };
@@ -25,4 +25,32 @@ describe('EduButton', () => {
25
25
 
26
26
  await expect(el).shadowDom.to.be.accessible();
27
27
  });
28
+
29
+ it('reflects disabled property to attribute and disables button', async () => {
30
+ const el = await fixture(html`<edu-button ?disabled=${true}></edu-button>`);
31
+ expect(el.disabled).to.be.true;
32
+ const button = el.shadowRoot.querySelector('button');
33
+ expect(button.hasAttribute('disabled')).to.be.true;
34
+ expect(button.disabled).to.be.true;
35
+ });
36
+
37
+ it('allows disabling via attribute', async () => {
38
+ const el = await fixture(html`<edu-button disabled></edu-button>`);
39
+ expect(el.disabled).to.be.true;
40
+ });
41
+
42
+ it('sets aria-label equal to text by default', async () => {
43
+ const el = await fixture(html`<edu-button></edu-button>`);
44
+ const button = el.shadowRoot.querySelector('button');
45
+ expect(button.getAttribute('aria-label')).to.equal(textDefault);
46
+ });
47
+
48
+ it('allows overriding aria-label via attribute', async () => {
49
+ const ariaLabel = 'Custom label';
50
+ const el = await fixture(
51
+ html`<edu-button aria-label=${ariaLabel}></edu-button>`,
52
+ );
53
+ const button = el.shadowRoot.querySelector('button');
54
+ expect(button.getAttribute('aria-label')).to.equal(ariaLabel);
55
+ });
28
56
  });