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 +41 -29
- package/package.json +1 -1
- package/src/EduButton.js +34 -1
- package/src/stories/EduButton.stories.js +13 -1
- package/test/EduButton.test.js +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,46 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
4
|
-
-
|
|
3
|
+
## 1.15.3 - 2025-08-02
|
|
4
|
+
- Fix EduButton is always disabled
|
|
5
5
|
|
|
6
|
-
## 1.
|
|
7
|
-
-
|
|
6
|
+
## 1.15.2 - 2025-08-02
|
|
7
|
+
- Fix EduButton is always disabled
|
|
8
8
|
|
|
9
|
-
## 1.
|
|
10
|
-
-
|
|
9
|
+
## 1.15.1 - 2025-08-02
|
|
10
|
+
- Fix EduButton is always disabled
|
|
11
11
|
|
|
12
|
-
## 1.
|
|
13
|
-
-
|
|
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.
|
|
16
|
-
-
|
|
15
|
+
## 1.14.0 - 2024-06-21
|
|
16
|
+
- Update docs of publishing packages to npm registry with provenance
|
|
17
17
|
|
|
18
|
-
## 1.
|
|
19
|
-
-
|
|
18
|
+
## 1.13.0 - 2024-06-20
|
|
19
|
+
- Fix provenance when publishing packages to npm registry
|
|
20
20
|
|
|
21
|
-
## 1.
|
|
22
|
-
-
|
|
21
|
+
## 1.12.0 - 2024-06-20
|
|
22
|
+
- Update dependencies
|
|
23
23
|
|
|
24
|
-
## 1.
|
|
25
|
-
-
|
|
24
|
+
## 1.11.0 - 2024-06-19
|
|
25
|
+
- Add provenance to packages in npm registry
|
|
26
26
|
|
|
27
|
-
## 1.
|
|
28
|
-
-
|
|
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.
|
|
34
|
-
-
|
|
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.
|
|
37
|
-
-
|
|
36
|
+
## 1.7.0 - 2024-06-02
|
|
37
|
+
- Setup GitHub Actions to publish packages in npm registry
|
|
38
38
|
|
|
39
|
-
## 1.
|
|
40
|
-
-
|
|
39
|
+
## 1.6.0 - 2024-06-01
|
|
40
|
+
- Setup GitHub Actions to tag and release after merge into main
|
|
41
41
|
|
|
42
|
-
## 1.
|
|
43
|
-
-
|
|
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.
|
|
46
|
-
-
|
|
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
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`
|
|
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 }) =>
|
|
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
|
+
};
|
package/test/EduButton.test.js
CHANGED
|
@@ -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
|
});
|