Skip to content

Commit

Permalink
refactor: move combobox component to components package (#141)
Browse files Browse the repository at this point in the history
* refactor: move combobox component to components package

* ci: deploy preview on PRs to all branches

* deps: add `@smileid/components` as dependency of `@smileid/embed`

* refactor: use local paths for workspace dependencies

* refactor: extract `end-user-consent` component to `components` package (#142)
  • Loading branch information
tamssokari authored Nov 26, 2023
1 parent d9ecbff commit a9f2cc6
Show file tree
Hide file tree
Showing 13 changed files with 924 additions and 894 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: deploy-preview
on:
workflow_call:
pull_request:
branches:
- main
types:
- opened
- synchronize
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ class ComboboxTrigger extends HTMLElement {
this.innerHTML = `${
this.type === "text"
? `
<div>
<input ${this.value ? `value="${this.value}" ` : ""}${
<div>
<input ${this.value ? `value="${this.value}" ` : ""}${
this.disabled ? " disabled " : ""
}type="text" placeholder="${this.label}" />
<button ${this.disabled ? "disabled " : ""}tabindex='-1' type='button'>
<span class="visually-hidden">Toggle</span>
</button>
</div>
`
<button ${this.disabled ? "disabled " : ""}tabindex='-1' type='button'>
<span class="visually-hidden">Toggle</span>
</button>
</div>
`
: `<button ${this.disabled ? "disabled " : ""}type="button">${
this.value || this.label
}</button>`
Expand Down Expand Up @@ -335,10 +335,10 @@ class ComboboxListbox extends HTMLElement {

get emptyState() {
return `
<p id='empty-state' style="text-align: center;">
${this.emptyLabel || "No items"}
</p>
`;
<p id='empty-state' style="text-align: center;">
${this.emptyLabel || "No items"}
</p>
`;
}

connectedCallback() {
Expand Down Expand Up @@ -571,9 +571,21 @@ class ComboboxOption extends HTMLElement {
}
}

export default {
Root: ComboboxRoot,
Trigger: ComboboxTrigger,
List: ComboboxListbox,
Option: ComboboxOption,
const Root = ComboboxRoot;
const Trigger = ComboboxTrigger;
const List = ComboboxListbox;
const Option = ComboboxOption;

if ("customElements" in window) {
window.customElements.define('smileid-combobox', Root);
window.customElements.define('smileid-combobox-trigger', Trigger);
window.customElements.define('smileid-combobox-listbox', List);
window.customElements.define('smileid-combobox-option', Option);
}

export {
Root,
Trigger,
List,
Option,
};
6 changes: 6 additions & 0 deletions packages/components/combobox/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export {
Root,
Trigger,
List,
Option,
} from './Combobox';
Loading

0 comments on commit a9f2cc6

Please sign in to comment.