Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement minified js system #199

Merged
merged 4 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ import "@aurodesignsystem/auro-hyperlink";
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->

```html
<auro-hyperlink>Hello World</auro-hyperlink>
```
<auro-hyperlink>No href supplied</auro-hyperlink><br>
Welcome to <auro-hyperlink href="https://www.alaskaair.com">Alaska Airlines</auro-hyperlink>.
```
<!-- AURO-GENERATED-CONTENT:END -->

## Install bundled assets from CDN
Expand Down Expand Up @@ -129,8 +130,9 @@ The `<auro-hyperlink>` elements should be used in situations where users may:
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->

```html
<auro-hyperlink>Hello World</auro-hyperlink>
```
<auro-hyperlink>No href supplied</auro-hyperlink><br>
Welcome to <auro-hyperlink href="https://www.alaskaair.com">Alaska Airlines</auro-hyperlink>.
```
<!-- AURO-GENERATED-CONTENT:END -->

## Development
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion apiExamples/basic.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<auro-hyperlink>Hello World</auro-hyperlink>
<auro-hyperlink>No href supplied</auro-hyperlink><br>
Welcome to <auro-hyperlink href="https://www.alaskaair.com">Alaska Airlines</auro-hyperlink>.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions apiExamples/roleButton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<auro-hyperlink href="http://www.alaskaair.com" role="button" id="roleButton">Cancel button</auro-hyperlink>
20 changes: 20 additions & 0 deletions apiExamples/roleButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export function roleButtonExample() {
const roleButton = document.getElementById('roleButton');

roleButton.addEventListener('click', () => {
alert(`You clicked the role button!`);
});

roleButton.addEventListener('keydown', handleKeyPress);
}

function handleKeyPress(event) {
if(event.key === 'Enter') {
event.preventDefault();
alert('Win for a11y! The return key submits!')
}
else if(event.key === ' ') {
event.preventDefault();
alert('Win for a11y! The spacebar submits!')
}
}
8 changes: 2 additions & 6 deletions demo/a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See LICENSE in the project root for license information.

HTML in this document is standardized and NOT to be edited.
All demo code should be added/edited in ./demo/demo.md
All demo code should be added/edited in ./demo/index.md

With the exception of adding custom elements if needed for the demo.

Expand Down Expand Up @@ -40,15 +40,11 @@
Prism.highlightAll();
});
</script>
<script type="module" src="../src/auro-hyperlink.js"></script>
<script type="module" src="../index.js"></script>

<!-- If additional elements are needed for the demo, add them here. -->
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest/dist/auro-accordion__bundled.js" type="module"></script>
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-icon@latest/dist/auro-icon__bundled.js" type="module"></script>
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/dist/auro-button__bundled.js" type="module"></script>

<!-- This reference will need to be addressed with the demo wrapper of the hyperlink docsite page-->
<script src="./util.js"></script>
<script src="./util_focus.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion demo/a11y.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Reference [Accessibility Techniques for Links](https://dequeuniversity.com/check
<td>Links versus buttons</td>
<td>Links SHOULD be used only for actions that take the user to other locations, and SHOULD NOT be used for button-like functionality.</td>
<td>best practice</td>
<td>Find <auro-hyperlink href="https://www.alaskaair.com/en/flights-to-mexico">low-fare flights to Mexico</auro-hyperlink> on Alaska Airlines.<br><br><auro-button onclick="sayHello()">Save changes</auro-button></td>
<td>Find <auro-hyperlink href="https://www.alaskaair.com/en/flights-to-mexico">low-fare flights to Mexico</auro-hyperlink> on Alaska Airlines.</td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 6 additions & 6 deletions demo/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See LICENSE in the project root for license information.

HTML in this document is standardized and NOT to be edited.
All demo code should be added/edited in ./demo/demo.md
All demo code should be added/edited in ./demo/index.md

With the exception of adding custom elements if needed for the demo.

Expand Down Expand Up @@ -33,7 +33,7 @@
<script type="module">
import 'https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js';
import 'https://cdn.jsdelivr.net/npm/prismjs@latest/prism.js';
fetch('../docs/api.md')
fetch('/demo/api.md')
.then((response) => response.text())
.then((text) => {
const rawHtml = marked.parse(text);
Expand All @@ -47,9 +47,9 @@
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest/dist/auro-accordion__bundled.js" type="module"></script>
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-icon@latest/dist/auro-icon__bundled.js" type="module"></script>
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/dist/auro-button__bundled.js" type="module"></script>

<!-- This reference will need to be addressed with the demo wrapper of the hyperlink docsite page-->
<script src="./util.js"></script>
<script src="./util_focus.js"></script>
<script src="./api.min.js"></script>
<script>
initHyperlinkApiExamples();
</script>
</body>
</html>
13 changes: 13 additions & 0 deletions demo/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function initHyperlinkApiExamples(initCount) {
initCount = initCount || 0;

try {
} catch {
if (initCount <= 20) {
// setTimeout handles issue where content is sometimes loaded after the functions get called
setTimeout(() => {
initHyperlinkApiExamples(initCount + 1);
}, 100);
}
}
}
Loading