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

feat(api): add register static method #136 #132 #137

Merged
merged 16 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions apiExamples/custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<custom-flight
flights='["AS 1436"]'
duration="161"
departureTime="2022-07-13T12:15:00-07:00"
departureStation="SEA"
arrivalTime="2022-07-13T14:56:00-07:00"
arrivalStation="LAX">
<auro-flightline></auro-flightline>
</custom-flight>
1 change: 0 additions & 1 deletion demo/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<script type="module" src="../index.js"></script>

<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-alert@latest/dist/auro-alert__bundled.js" type="module"></script>
sun-mota marked this conversation as resolved.
Show resolved Hide resolved
</body>
</html>
3 changes: 1 addition & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
Prism.highlightAll();
});
</script>
<script type="module" src="../index.js"></script>
<script type="module" src="./index.min.js"></script>

<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-alert@latest/dist/auro-alert__bundled.js" type="module"></script>
sun-mota marked this conversation as resolved.
Show resolved Hide resolved
</body>
</html>
4 changes: 4 additions & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { AuroFlight } from '../src/auro-flight.js';

AuroFlight.register();
AuroFlight.register('custom-flight');
49 changes: 48 additions & 1 deletion demo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,51 @@ Department of Transportation regulations mandate that the arrival and departure

## Accessibility

The `<auro-flight>` custom element is accessible by screen readers by default. Due to the style of content within, while this is accessible, it's up to the user of the element to determine if information is useable and/or necessary for a screen reader experience. If this element is being used for illustrative purposes and the details of the flight are outlined in greater detail outside the scope of this element, `aria-hidden='true'` is recommended.
The `<auro-flight>` custom element is accessible by screen readers by default. Due to the style of content within, while this is accessible, it's up to the user of the element to determine if information is useable and/or necessary for a screen reader experience. If this element is being used for illustrative purposes and the details of the flight are outlined in greater detail outside the scope of this element, `aria-hidden='true'` is recommended.

## Recommended Use and Version Control

There are two important parts of every Auro component. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom element. The class is exported and then used as part of defining the Web Component. When importing this component as described in the <a href="#install">install</a> section, the class is imported and the `auro-flight` custom element is defined automatically.

To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `AuroFlight.register(name)` method and pass in a unique name.

```js
import { AuroFlight } from './src/auro-flight.js';
sun-mota marked this conversation as resolved.
Show resolved Hide resolved

AuroFlight.register('custom-flight');
```

This will create a new custom element that you can use in your HTML that will function identically to the `<auro-flight>` element.

<div class="exampleWrapper exampleWrapper--flex">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/custom.html) -->
<!-- The below content is automatically added from ./../../apiExamples/custom.html -->
<custom-flight
flights='["AS 1436"]'
duration="161"
departureTime="2022-07-13T12:15:00-07:00"
departureStation="SEA"
arrivalTime="2022-07-13T14:56:00-07:00"
arrivalStation="LAX">
<auro-flightline></auro-flightline>
</custom-flight>
<!-- AURO-GENERATED-CONTENT:END -->
</div>
<auro-accordion alignRight>
<span slot="trigger">See code</span>
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/custom.html) -->
<!-- The below code snippet is automatically added from ./../../apiExamples/custom.html -->

```html
<custom-flight
flights='["AS 1436"]'
duration="161"
departureTime="2022-07-13T12:15:00-07:00"
departureStation="SEA"
arrivalTime="2022-07-13T14:56:00-07:00"
arrivalStation="LAX">
<auro-flightline></auro-flightline>
</custom-flight>
```
<!-- AURO-GENERATED-CONTENT:END -->
</auro-accordion>
Loading