Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
..
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Schmatzler <[email protected]>
  • Loading branch information
cschmatzler committed Jul 11, 2024
1 parent 087a797 commit f65522e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hooks/combobox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
id: this.el.id,
name: this.el.dataset.name,
collection: this.collection(),
inputBehavior: getOption(this.el, "inputBehavior", ["autohighlight", "autocomplete", "none"]) as InputBehavior,
inputBehavior: getOption(this.el, "inputBehavior", ["autocomplete", "autohighlight", "none"]) as InputBehavior,
selectionBehavior: getOption(this.el, "selectionBehavior", ["clear", "replace", "preserve"]) as SelectionBehavior,
multiple: getBooleanOption(this.el, "multiple"),
disabled: getBooleanOption(this.el, "disabled"),
Expand Down
4 changes: 2 additions & 2 deletions hooks/dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var renderPart = (root, name, api) => {
var getOption = (el, name, validOptions) => {
const kebabName = name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
let initial = el.dataset[kebabName];
if (initial !== void 0 && !validOptions.includes(initial)) {
if (validOptions && initial !== void 0 && !validOptions.includes(initial)) {
console.error(`Invalid '${name}' specified: '${initial}'. Expected one of '${validOptions.join("', '")}'.`);
initial = void 0;
}
Expand Down Expand Up @@ -408,7 +408,7 @@ var combobox_default = {
id: this.el.id,
name: this.el.dataset.name,
collection: this.collection(),
inputBehavior: getOption(this.el, "inputBehavior", ["autohighlight", "autocomplete", "none"]),
inputBehavior: getOption(this.el, "inputBehavior", ["autocomplete", "autohighlight", "none"]),
selectionBehavior: getOption(this.el, "selectionBehavior", ["clear", "replace", "preserve"]),
multiple: getBooleanOption(this.el, "multiple"),
disabled: getBooleanOption(this.el, "disabled"),
Expand Down
4 changes: 2 additions & 2 deletions hooks/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var renderPart = (root, name, api) => {
var getOption = (el, name, validOptions) => {
const kebabName = name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
let initial = el.dataset[kebabName];
if (initial !== void 0 && !validOptions.includes(initial)) {
if (validOptions && initial !== void 0 && !validOptions.includes(initial)) {
console.error(`Invalid '${name}' specified: '${initial}'. Expected one of '${validOptions.join("', '")}'.`);
initial = void 0;
}
Expand Down Expand Up @@ -365,7 +365,7 @@ var combobox_default = {
id: this.el.id,
name: this.el.dataset.name,
collection: this.collection(),
inputBehavior: getOption(this.el, "inputBehavior", ["autohighlight", "autocomplete", "none"]),
inputBehavior: getOption(this.el, "inputBehavior", ["autocomplete", "autohighlight", "none"]),
selectionBehavior: getOption(this.el, "selectionBehavior", ["clear", "replace", "preserve"]),
multiple: getBooleanOption(this.el, "multiple"),
disabled: getBooleanOption(this.el, "disabled"),
Expand Down
2 changes: 1 addition & 1 deletion hooks/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const getOption = (el: HTMLElement, name: string, validOptions: string[])
const kebabName = name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
let initial: string | undefined = el.dataset[kebabName];

if (initial !== undefined && !validOptions.includes(initial as any)) {
if (validOptions && initial !== undefined && !validOptions.includes(initial as any)) {
console.error(`Invalid '${name}' specified: '${initial}'. Expected one of '${validOptions.join("', '")}'.`);
initial = undefined;
}
Expand Down

0 comments on commit f65522e

Please sign in to comment.