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 ## 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 * `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 ## 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-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 * `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`: 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 ## Hooks

View file

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

View file

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