Update TS definitions

This commit is contained in:
Talia 2025-08-07 15:06:24 +02:00
parent 03d321fbe8
commit 7b73207744
3 changed files with 20 additions and 10 deletions

View file

@ -5,17 +5,26 @@
## Slots
* `placeholder`: Only shown when nothing is selected (replaces attribute placeholder if present)
* `clear`: Overrides the default "x" clear button
* `loading`: Hidden by default, shown instead of items while `populate()` runs
* `placeholder`: Only shown when nothing is selected (replaces attribute placeholder if present)
* `top`: Insert content at the top of the drop-down
* `below-search`: Insert content beltween the search box and item list
* `bottom`: Insert content at the bottom of the drop-down
## Parts
* `display`: The outer display box that is always shown
* `clear`: The slot containing the clear button
* `display-text`: The text representing the currently selected value
* `display`: The outer display box that is always shown
* `drop-down`: The dialog element that pops up when the list is opened
* `search`: The search input box
* `list`: The wrapper containing the items
* `item`: The individual selectable list items
* `item disabled`: Any item corresponding to a disabled option
* `item enabled`: Any item correesponding to a not disabled option
* `list`: The wrapper containing the items
* `placeholder`: The slot containing the placeholder text
* `search`: The search input box
## Hooks

View file

@ -45,7 +45,8 @@ export class BetterSelect extends HTMLElement {
* @param {string} state
*/
setValue(value: string, state?: string): void;
set value(arg: any);
updateClearButton(): void;
set value(value: any);
get value(): any;
get valueText(): any;
setOptions(): void;
@ -60,7 +61,7 @@ export class BetterSelect extends HTMLElement {
/**
* @param {String} name
*/
set name(arg: string);
set name(name: string);
/**
* @return {String}
*/
@ -70,7 +71,7 @@ export class BetterSelect extends HTMLElement {
/**
* @param {Boolean} disabled
*/
set disabled(arg: boolean);
set disabled(disabled: boolean);
get disabled(): boolean;
/**
* @param {ValidityConstraint} _constraint
@ -84,7 +85,7 @@ export class BetterSelect extends HTMLElement {
/**
* @param {Boolean} required
*/
set required(arg: boolean);
set required(required: boolean);
get required(): boolean;
reportValidity(): boolean;
requiredChanged(): void;

View file

@ -239,8 +239,8 @@ export class BetterSelect extends HTMLElement {
this.attachShadow({mode: "open"}).innerHTML = `
<div id="display" part="display">
<span part="display-text" id="text"></span>
<slot name="placeholder" aria-hidden="true">
<span part="placeholder" id="placeholder" aria-hidden="true"></span>
<slot part="placeholder" name="placeholder" aria-hidden="true">
<span id="placeholder" aria-hidden="true"></span>
</slot>
<template id="clear-template">
<slot name="clear" part="clear">