edu-webcomponents 1.13.0 → 1.15.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.
@@ -14,6 +14,6 @@ jobs:
14
14
  - name: release
15
15
  uses: dexwritescode/release-on-merge-action@v1
16
16
  with:
17
- version-increment-strategy: minor
17
+ version-increment-strategy: patch
18
18
  initial-version: '1.6.0'
19
19
  tag-prefix: v
package/CHANGELOG.md CHANGED
@@ -1,43 +1,55 @@
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.2 - 2025-08-02
4
+ - Fix EduButton is always disabled
5
5
 
6
- ## 1.1.0 - 2024-05-26
7
- - Setup Husky
6
+ ## 1.15.1 - 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.0 - 2025-08-02
10
+ - Improve EduButton component by adding aria-label and type attributes, disabled state and styles
11
11
 
12
- ## 1.3.0 - 2024-05-28
13
- - Setup Storybook
12
+ ## 1.14.0 - 2024-06-21
13
+ - Update docs of publishing packages to npm registry with provenance
14
14
 
15
- ## 1.4.0 - 2024-05-30
16
- - Setup GitHub Actions to publish Storybook built artifacts in GitHub Pages
15
+ ## 1.13.0 - 2024-06-20
16
+ - Fix provenance when publishing packages to npm registry
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.12.0 - 2024-06-20
19
+ - Update dependencies
20
20
 
21
- ## 1.6.0 - 2024-06-01
22
- - Setup GitHub Actions to tag and release after merge into main
21
+ ## 1.11.0 - 2024-06-19
22
+ - Add provenance to packages in npm registry
23
23
 
24
- ## 1.7.0 - 2024-06-02
25
- - Setup GitHub Actions to publish packages in npm registry
24
+ ## 1.10.0 - 2024-06-17
25
+ - Add keywords to the repository
26
+
27
+ ## 1.9.0 - 2024-06-16
28
+ - Update dependencies
26
29
 
27
30
  ## 1.8.0 - 2024-06-15
28
31
  - Setup [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) to manage updates of dependencies of package.json
29
32
 
30
- ## 1.9.0 - 2024-06-16
31
- - Update dependencies
33
+ ## 1.7.0 - 2024-06-02
34
+ - Setup GitHub Actions to publish packages in npm registry
32
35
 
33
- ## 1.10.0 - 2024-06-17
34
- - Add keywords to the repository
36
+ ## 1.6.0 - 2024-06-01
37
+ - Setup GitHub Actions to tag and release after merge into main
35
38
 
36
- ## 1.11.0 - 2024-06-19
37
- - Add provenance to packages in npm registry
39
+ ## 1.5.0 - 2024-05-30
40
+ - Add docs to enable the deployment of GitHub Actions artifacts into GitHub Pages
38
41
 
39
- ## 1.12.0 - 2024-06-20
40
- - Update dependencies
42
+ ## 1.4.0 - 2024-05-30
43
+ - Setup GitHub Actions to publish Storybook built artifacts in GitHub Pages
41
44
 
42
- ## 1.13.0 - 2024-06-20
43
- - Fix provenance when publishing packages to npm registry
45
+ ## 1.3.0 - 2024-05-28
46
+ - Setup Storybook
47
+
48
+ ## 1.2.0 - 2024-05-27
49
+ - Setup the repository to be a library of web components
50
+
51
+ ## 1.1.0 - 2024-05-26
52
+ - Setup Husky
53
+
54
+ ## 1.0.0 - 2024-05-25
55
+ - (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,3 +3,44 @@
3
3
  - Add PAT created to GitHub secrets
4
4
  - Use workflow from [here](https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry)
5
5
 
6
+ ## Provenance
7
+
8
+ ### What is is?
9
+
10
+ You can generate provenance statements for the packages you publish. This allows you to publicly establish where a package was built and who published a package, which can increase supply-chain security for your packages.
11
+
12
+ More info: [https://docs.npmjs.com/generating-provenance-statements](https://docs.npmjs.com/generating-provenance-statements).
13
+
14
+ ### How to
15
+ Add permissions and provenance flag to the workflow job that publishes packages to npm registry, as you can see here:
16
+ ```
17
+ name: Publish Package to npmjs
18
+ on:
19
+ release:
20
+ types: [published]
21
+ jobs:
22
+ build:
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: read
26
+ id-token: write
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-node@v4
30
+ with:
31
+ node-version: '20.x'
32
+ registry-url: 'https://registry.npmjs.org'
33
+ - run: npm install -g npm
34
+ - run: npm ci
35
+ - run: npm publish --provenance --access public
36
+ env:
37
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38
+ ```
39
+
40
+ Add repository object with type and url properties to the package.json, as you can see here:
41
+ ```
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/eduardocruzpalacios/edu-webcomponents"
45
+ },
46
+ ```
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "license": "MIT",
13
13
  "author": "edu-webcomponents",
14
- "version": "1.13.0",
14
+ "version": "1.15.2",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "https://github.com/eduardocruzpalacios/edu-webcomponents"
package/src/EduButton.js CHANGED
@@ -5,19 +5,53 @@ 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;
42
+ this.disabled = true;
17
43
  }
18
44
 
19
45
  render() {
20
- return html` <button>${this.text}</button> `;
46
+ return html`
47
+ <button
48
+ type=${this.type}
49
+ aria-label=${this.ariaLabel}
50
+ ?disabled=${this.disabled}
51
+ >
52
+ ${this.text}
53
+ </button>
54
+ `;
21
55
  }
22
56
  }
23
57
 
@@ -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
  });