@pontive/pontkit-core 1.26.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/pont2/core/attrs.d.ts +22 -0
- package/dist/pont2/core/controllers/action.d.ts +79 -0
- package/dist/pont2/core/controllers/copy.d.ts +34 -0
- package/dist/pont2/core/controllers/roving-focus.d.ts +38 -0
- package/dist/pont2/core/events.d.ts +28 -0
- package/dist/pont2/core/form-control.d.ts +70 -0
- package/dist/pont2/core/host-element.d.ts +129 -0
- package/dist/pont2/core/icons.d.ts +28 -0
- package/dist/pont2/core/ids.d.ts +6 -0
- package/dist/pont2/core/index.d.ts +10 -0
- package/dist/pont2/core/names.d.ts +78 -0
- package/dist/pont2/core/popup/anchored.d.ts +48 -0
- package/dist/pont2/core/popup/index.d.ts +5 -0
- package/dist/pont2/core/popup/list.d.ts +38 -0
- package/dist/pont2/core/popup/popup-content.d.ts +68 -0
- package/dist/pont2/core/popup/popup-root.d.ts +94 -0
- package/dist/pont2/core/popup/position.d.ts +73 -0
- package/dist/pont2/globals.css +109 -0
- package/dist/pont2/index.d.ts +44 -0
- package/dist/pont2/index.mjs +5660 -0
- package/dist/pont2/index.mjs.map +1 -0
- package/dist/pont2/kit/alert/alert.d.ts +62 -0
- package/dist/pont2/kit/aliases.d.ts +33 -0
- package/dist/pont2/kit/auth-button/auth-button.d.ts +185 -0
- package/dist/pont2/kit/auth-button/providers.d.ts +15 -0
- package/dist/pont2/kit/auth-field/auth-field.d.ts +267 -0
- package/dist/pont2/kit/auth-field/password-field.d.ts +124 -0
- package/dist/pont2/kit/avatar/avatar.d.ts +52 -0
- package/dist/pont2/kit/block/block.d.ts +64 -0
- package/dist/pont2/kit/block/branding.d.ts +36 -0
- package/dist/pont2/kit/container/container.d.ts +40 -0
- package/dist/pont2/kit/countdown/countdown.d.ts +64 -0
- package/dist/pont2/kit/divider/divider.d.ts +30 -0
- package/dist/pont2/kit/edit-identifier/edit-identifier.d.ts +47 -0
- package/dist/pont2/kit/flow-widget/flow-widget.d.ts +151 -0
- package/dist/pont2/kit/gap/gap.d.ts +36 -0
- package/dist/pont2/kit/header/header.d.ts +37 -0
- package/dist/pont2/kit/index.d.ts +26 -0
- package/dist/pont2/kit/input-otp/input-otp.d.ts +59 -0
- package/dist/pont2/kit/layout/flow-error.d.ts +21 -0
- package/dist/pont2/kit/layout/layout.d.ts +120 -0
- package/dist/pont2/kit/link/link.d.ts +62 -0
- package/dist/pont2/kit/logo/logo.d.ts +57 -0
- package/dist/pont2/kit/otp-field/otp-field.d.ts +93 -0
- package/dist/pont2/kit/otp-field/otp-resend.d.ts +61 -0
- package/dist/pont2/kit/provider-field/provider-field.d.ts +87 -0
- package/dist/pont2/kit/qr-code/qr-code.d.ts +86 -0
- package/dist/pont2/kit/recovery-codes/recovery-codes.d.ts +64 -0
- package/dist/pont2/kit/scope-list/scope-list.d.ts +69 -0
- package/dist/pont2/kit/scope-list/scope-value.d.ts +16 -0
- package/dist/pont2/kit/secret/secret.d.ts +67 -0
- package/dist/pont2/kit/story-helpers.d.ts +9 -0
- package/dist/pont2/kit/typography/typography.d.ts +70 -0
- package/dist/pont2/kit/watermark/pontive-logo.d.ts +8 -0
- package/dist/pont2/kit/watermark/watermark.d.ts +42 -0
- package/dist/pont2/primitives/alert/alert.d.ts +49 -0
- package/dist/pont2/primitives/avatar/avatar.d.ts +89 -0
- package/dist/pont2/primitives/badge/badge.d.ts +30 -0
- package/dist/pont2/primitives/button/button.d.ts +113 -0
- package/dist/pont2/primitives/button-group/button-group.d.ts +55 -0
- package/dist/pont2/primitives/card/card.d.ts +63 -0
- package/dist/pont2/primitives/checkbox/checkbox.d.ts +54 -0
- package/dist/pont2/primitives/combobox/combobox.d.ts +213 -0
- package/dist/pont2/primitives/dropdown-menu/dropdown-menu.d.ts +267 -0
- package/dist/pont2/primitives/empty/empty.d.ts +60 -0
- package/dist/pont2/primitives/field/field.d.ts +146 -0
- package/dist/pont2/primitives/input/input.d.ts +47 -0
- package/dist/pont2/primitives/input-group/input-group.d.ts +97 -0
- package/dist/pont2/primitives/input-otp/input-otp.d.ts +121 -0
- package/dist/pont2/primitives/input-otp/otp.d.ts +22 -0
- package/dist/pont2/primitives/item/item.d.ts +100 -0
- package/dist/pont2/primitives/kbd/kbd.d.ts +29 -0
- package/dist/pont2/primitives/label/label.d.ts +37 -0
- package/dist/pont2/primitives/native-select/native-select.d.ts +59 -0
- package/dist/pont2/primitives/popover/popover.d.ts +85 -0
- package/dist/pont2/primitives/progress/progress.d.ts +80 -0
- package/dist/pont2/primitives/radio-group/radio-group.d.ts +93 -0
- package/dist/pont2/primitives/select/select.d.ts +184 -0
- package/dist/pont2/primitives/separator/separator.d.ts +34 -0
- package/dist/pont2/primitives/skeleton/skeleton.d.ts +18 -0
- package/dist/pont2/primitives/slider/slider-math.d.ts +42 -0
- package/dist/pont2/primitives/slider/slider.d.ts +85 -0
- package/dist/pont2/primitives/spinner/spinner.d.ts +29 -0
- package/dist/pont2/primitives/switch/switch.d.ts +55 -0
- package/dist/pont2/primitives/table/table.d.ts +55 -0
- package/dist/pont2/primitives/tabs/tabs.d.ts +126 -0
- package/dist/pont2/primitives/textarea/textarea.d.ts +41 -0
- package/dist/pont2/primitives/tooltip/tooltip.d.ts +69 -0
- package/dist/pont2/styles.css +4839 -0
- package/dist/pont2/with-legacy.css +10 -0
- package/package.json +16 -4
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { AttrMap } from '../../core/attrs';
|
|
3
|
+
import { NativeEnhancer, ShellElement } from '../../core/host-element';
|
|
4
|
+
/**
|
|
5
|
+
* # Button: Tier 3 (native-bound)
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Button variant size>` → Base UI `<Button>` → a native `<button>`
|
|
8
|
+
* (or, through `render`, the author's `<a>`), with `data-slot="button"`.
|
|
9
|
+
*
|
|
10
|
+
* A button's root must stay native: implicit form submission,
|
|
11
|
+
* `SubmitEvent.submitter`, `name=value` in FormData, password-manager
|
|
12
|
+
* heuristics, middle-click on links. So the styled element is always a native
|
|
13
|
+
* `<button>`/`<a>`, reachable four ways that all share one recipe
|
|
14
|
+
* (button.css, keyed on `[data-pont2-button]`):
|
|
15
|
+
*
|
|
16
|
+
* | Entry point | You write | DOM nodes |
|
|
17
|
+
* |-------------|------------------------------------------------------------------|-----------|
|
|
18
|
+
* | Recipe | `<button data-pont2-button data-variant="outline">` | 1 |
|
|
19
|
+
* | Part | `button({ variant: "outline" }, content)` inside a Lit template | 1 |
|
|
20
|
+
* | Enhancer | `<pont2-prim-button variant="outline"><button>…</button></pont2-prim-button>` | shell + 1 |
|
|
21
|
+
* | Base class | `class ProviderButton extends ButtonBase` | shell + 1 |
|
|
22
|
+
*/
|
|
23
|
+
export declare const BUTTON_VARIANTS: readonly ["default", "outline", "secondary", "ghost", "destructive", "link"];
|
|
24
|
+
export declare const BUTTON_SIZES: readonly ["default", "xs", "sm", "lg", "icon", "icon-xs", "icon-sm", "icon-lg"];
|
|
25
|
+
export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
|
|
26
|
+
export type ButtonSize = (typeof BUTTON_SIZES)[number];
|
|
27
|
+
export interface ButtonRecipe {
|
|
28
|
+
variant?: ButtonVariant;
|
|
29
|
+
size?: ButtonSize;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Base UI `focusableWhenDisabled`: stay in the tab order while disabled
|
|
33
|
+
* (`aria-disabled` instead of `disabled`). Use it for loading states, so
|
|
34
|
+
* focus is not lost mid-submit.
|
|
35
|
+
*/
|
|
36
|
+
focusableWhenDisabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ButtonOptions extends ButtonRecipe {
|
|
39
|
+
type?: "button" | "submit" | "reset";
|
|
40
|
+
name?: string;
|
|
41
|
+
value?: string;
|
|
42
|
+
/** Renders an `<a>` instead of a `<button>` (shadcn `render={<a/>}`). */
|
|
43
|
+
href?: string;
|
|
44
|
+
target?: string;
|
|
45
|
+
rel?: string;
|
|
46
|
+
/** Overrides `data-slot` (shadcn `<Button data-slot="…">`). */
|
|
47
|
+
slot?: string;
|
|
48
|
+
/** Extra attributes on the same native element: the `{...props}` spread. */
|
|
49
|
+
attrs?: AttrMap;
|
|
50
|
+
onClick?: (e: MouseEvent) => void;
|
|
51
|
+
}
|
|
52
|
+
export declare function applyButton(el: HTMLElement, o: ButtonRecipe): void;
|
|
53
|
+
/** True when a click on `el` must be swallowed (aria-disabled buttons and links). */
|
|
54
|
+
export declare function isSoftDisabled(el: Element): boolean;
|
|
55
|
+
export declare function button(o: ButtonOptions, content: unknown): import('lit-html').TemplateResult<1>;
|
|
56
|
+
/**
|
|
57
|
+
* `<pont2-prim-button>`: applies the button recipe to the native `<button>` or
|
|
58
|
+
* `<a>` you put inside it.
|
|
59
|
+
*
|
|
60
|
+
* ```html
|
|
61
|
+
* <pont2-prim-button variant="outline"><button type="submit">Continue</button></pont2-prim-button>
|
|
62
|
+
* <pont2-prim-button variant="link"><a href="/forgot">Forgot password?</a></pont2-prim-button>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @tag pont2-prim-button
|
|
66
|
+
* @attr variant - default | outline | secondary | ghost | destructive | link
|
|
67
|
+
* @attr size - default | xs | sm | lg | icon | icon-xs | icon-sm | icon-lg
|
|
68
|
+
* @attr disabled - Disables the native child (or sets aria-disabled on a link).
|
|
69
|
+
* @attr focusable-when-disabled - Keep the disabled button in the tab order.
|
|
70
|
+
*/
|
|
71
|
+
export declare class Pont2Button extends NativeEnhancer<HTMLButtonElement | HTMLAnchorElement> {
|
|
72
|
+
static nativeSelector: string;
|
|
73
|
+
static properties: PropertyDeclarations;
|
|
74
|
+
variant: ButtonVariant;
|
|
75
|
+
size: ButtonSize;
|
|
76
|
+
disabled: boolean;
|
|
77
|
+
focusableWhenDisabled: boolean;
|
|
78
|
+
constructor();
|
|
79
|
+
private guard;
|
|
80
|
+
protected apply(control: HTMLButtonElement | HTMLAnchorElement): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Extend this when your component *is* a button whose content it generates
|
|
84
|
+
* (a provider sign-in button, a submit button with a spinner). Subclasses
|
|
85
|
+
* inherit `variant`/`size`/`disabled`/`type`/`href`… so nothing is forwarded
|
|
86
|
+
* by hand; they implement `renderContent()` and may override
|
|
87
|
+
* `buttonOptions()`. The DOM is always
|
|
88
|
+
* `<host data-pont2-shell> > <button|a data-pont2-button>`.
|
|
89
|
+
*/
|
|
90
|
+
export declare abstract class ButtonBase extends ShellElement {
|
|
91
|
+
static properties: PropertyDeclarations;
|
|
92
|
+
variant: ButtonVariant;
|
|
93
|
+
size: ButtonSize;
|
|
94
|
+
disabled: boolean;
|
|
95
|
+
focusableWhenDisabled: boolean;
|
|
96
|
+
type: "button" | "submit" | "reset";
|
|
97
|
+
name?: string;
|
|
98
|
+
value?: string;
|
|
99
|
+
href?: string;
|
|
100
|
+
target?: string;
|
|
101
|
+
rel?: string;
|
|
102
|
+
constructor();
|
|
103
|
+
/** The native element. Focus, tooltips and popovers anchor here, never on the shell. */
|
|
104
|
+
get control(): HTMLButtonElement | HTMLAnchorElement | null;
|
|
105
|
+
protected buttonOptions(): ButtonOptions;
|
|
106
|
+
protected abstract renderContent(): unknown;
|
|
107
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
108
|
+
}
|
|
109
|
+
declare global {
|
|
110
|
+
interface HTMLElementTagNameMap {
|
|
111
|
+
"pont2-prim-button": Pont2Button;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { Separator } from '../separator/separator';
|
|
4
|
+
export type ButtonGroupOrientation = "horizontal" | "vertical";
|
|
5
|
+
/**
|
|
6
|
+
* # ButtonGroup: Tier 1 (structural)
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<ButtonGroup orientation>` → `<div role="group" data-slot="button-group"
|
|
9
|
+
* data-orientation>`; `ButtonGroupText` (Base UI `useRender`, a div);
|
|
10
|
+
* `ButtonGroupSeparator` (a vertical `Separator`).
|
|
11
|
+
*
|
|
12
|
+
* pont2: host-as-root. Children are whatever you write: recipe buttons,
|
|
13
|
+
* `<pont2-prim-button>` shells, inputs, nested groups. The join rules (square inner
|
|
14
|
+
* corners, collapsed borders) see through Tier 3 shells, because a shell has
|
|
15
|
+
* no box. `ButtonGroupSeparator extends Separator`.
|
|
16
|
+
*
|
|
17
|
+
* @tag pont2-prim-button-group
|
|
18
|
+
* @attr orientation - horizontal (default) | vertical
|
|
19
|
+
*/
|
|
20
|
+
export declare class ButtonGroup extends HostElement {
|
|
21
|
+
static identity: string;
|
|
22
|
+
static slotName: string;
|
|
23
|
+
static role: string;
|
|
24
|
+
static properties: PropertyDeclarations;
|
|
25
|
+
orientation: ButtonGroupOrientation;
|
|
26
|
+
constructor();
|
|
27
|
+
protected willUpdate(): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* For a link or label instead of a div, use the recipe on that element:
|
|
31
|
+
* `<label data-pont2-button-group-text data-slot="button-group-text">`.
|
|
32
|
+
*
|
|
33
|
+
* @tag pont2-prim-button-group-text
|
|
34
|
+
*/
|
|
35
|
+
export declare class ButtonGroupText extends HostElement {
|
|
36
|
+
static identity: string;
|
|
37
|
+
static slotName: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A Separator whose default orientation is vertical.
|
|
41
|
+
*
|
|
42
|
+
* @tag pont2-prim-button-group-separator
|
|
43
|
+
*/
|
|
44
|
+
export declare class ButtonGroupSeparator extends Separator {
|
|
45
|
+
static identity: string;
|
|
46
|
+
static slotName: string;
|
|
47
|
+
constructor();
|
|
48
|
+
}
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
"pont2-prim-button-group": ButtonGroup;
|
|
52
|
+
"pont2-prim-button-group-text": ButtonGroupText;
|
|
53
|
+
"pont2-prim-button-group-separator": ButtonGroupSeparator;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type CardSize = "default" | "sm";
|
|
4
|
+
/**
|
|
5
|
+
* # Card: Tier 1 (structural)
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Card size>` → `<div data-slot="card" data-size>` and the
|
|
8
|
+
* `CardHeader | CardTitle | CardDescription | CardAction | CardContent |
|
|
9
|
+
* CardFooter` divs. Every part here is host-as-root: same depth as shadcn.
|
|
10
|
+
*
|
|
11
|
+
* @tag pont2-prim-card
|
|
12
|
+
* @attr size - default | sm
|
|
13
|
+
* @cssprop --pont2-card-spacing - padding/gap unit (1.5rem, 1rem when size="sm")
|
|
14
|
+
*/
|
|
15
|
+
export declare class Card extends HostElement {
|
|
16
|
+
static identity: string;
|
|
17
|
+
static slotName: string;
|
|
18
|
+
static properties: PropertyDeclarations;
|
|
19
|
+
size: CardSize;
|
|
20
|
+
constructor();
|
|
21
|
+
protected willUpdate(): void;
|
|
22
|
+
}
|
|
23
|
+
/** @tag pont2-prim-card-header */
|
|
24
|
+
export declare class CardHeader extends HostElement {
|
|
25
|
+
static identity: string;
|
|
26
|
+
static slotName: string;
|
|
27
|
+
}
|
|
28
|
+
/** @tag pont2-prim-card-title */
|
|
29
|
+
export declare class CardTitle extends HostElement {
|
|
30
|
+
static identity: string;
|
|
31
|
+
static slotName: string;
|
|
32
|
+
}
|
|
33
|
+
/** @tag pont2-prim-card-description */
|
|
34
|
+
export declare class CardDescription extends HostElement {
|
|
35
|
+
static identity: string;
|
|
36
|
+
static slotName: string;
|
|
37
|
+
}
|
|
38
|
+
/** @tag pont2-prim-card-action */
|
|
39
|
+
export declare class CardAction extends HostElement {
|
|
40
|
+
static identity: string;
|
|
41
|
+
static slotName: string;
|
|
42
|
+
}
|
|
43
|
+
/** @tag pont2-prim-card-content */
|
|
44
|
+
export declare class CardContent extends HostElement {
|
|
45
|
+
static identity: string;
|
|
46
|
+
static slotName: string;
|
|
47
|
+
}
|
|
48
|
+
/** @tag pont2-prim-card-footer */
|
|
49
|
+
export declare class CardFooter extends HostElement {
|
|
50
|
+
static identity: string;
|
|
51
|
+
static slotName: string;
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
"pont2-prim-card": Card;
|
|
56
|
+
"pont2-prim-card-header": CardHeader;
|
|
57
|
+
"pont2-prim-card-title": CardTitle;
|
|
58
|
+
"pont2-prim-card-description": CardDescription;
|
|
59
|
+
"pont2-prim-card-action": CardAction;
|
|
60
|
+
"pont2-prim-card-content": CardContent;
|
|
61
|
+
"pont2-prim-card-footer": CardFooter;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { FormControlElement, ValidityResult } from '../../core/form-control';
|
|
3
|
+
/**
|
|
4
|
+
* # Checkbox: Tier 2 (widget, form-associated)
|
|
5
|
+
*
|
|
6
|
+
* shadcn: `<Checkbox>` → Base UI `<Checkbox.Root>` (`<span role="checkbox">`
|
|
7
|
+
* plus a hidden `<input type="checkbox">`) > `<Checkbox.Indicator>` > icon.
|
|
8
|
+
*
|
|
9
|
+
* pont2: the host **is** the `role="checkbox"` root, and it is a
|
|
10
|
+
* form-associated custom element, so there is no hidden input:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* shadcn/Base UI: span[role=checkbox] > span[data-slot=checkbox-indicator] > svg + input[hidden]
|
|
14
|
+
* pont2: pont2-prim-checkbox > span[data-slot=checkbox-indicator] > svg
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* State attributes are Base UI's: `data-checked` | `data-unchecked`,
|
|
18
|
+
* `data-indeterminate`, `data-disabled`, `data-readonly`, `data-required`.
|
|
19
|
+
* The CustomStateSet mirrors them (`:state(checked)`).
|
|
20
|
+
*
|
|
21
|
+
* @tag pont2-prim-checkbox
|
|
22
|
+
* @attr checked - Initial checked state (`defaultChecked`); `.checked` is the live state.
|
|
23
|
+
* @attr indeterminate - Mixed state (`aria-checked="mixed"`).
|
|
24
|
+
* @attr name, value, unchecked-value, disabled, required, readonly
|
|
25
|
+
* @fires input - The checked state changed through interaction.
|
|
26
|
+
* @fires change - Same moment as `input`, like a native checkbox.
|
|
27
|
+
*/
|
|
28
|
+
export declare class Checkbox extends FormControlElement {
|
|
29
|
+
static identity: string;
|
|
30
|
+
static slotName: string;
|
|
31
|
+
static role: string;
|
|
32
|
+
static properties: PropertyDeclarations;
|
|
33
|
+
checked: boolean;
|
|
34
|
+
indeterminate: boolean;
|
|
35
|
+
value: string;
|
|
36
|
+
uncheckedValue: string | undefined;
|
|
37
|
+
constructor();
|
|
38
|
+
/** Toggle as if the user clicked (fires input/change). */
|
|
39
|
+
toggle(): void;
|
|
40
|
+
protected formValue(): string | null;
|
|
41
|
+
protected resetToDefault(): void;
|
|
42
|
+
protected restoreState(state: string | File | FormData | null): void;
|
|
43
|
+
protected validate(): ValidityResult | null;
|
|
44
|
+
private onClick;
|
|
45
|
+
private onKeyDown;
|
|
46
|
+
private onKeyUp;
|
|
47
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
48
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
"pont2-prim-checkbox": Checkbox;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { PopupContent } from '../../core/popup/popup-content';
|
|
4
|
+
import { PopupRoot } from '../../core/popup/popup-root';
|
|
5
|
+
import { Separator } from '../separator/separator';
|
|
6
|
+
/**
|
|
7
|
+
* # Combobox (single selection)
|
|
8
|
+
*
|
|
9
|
+
* shadcn: `<Combobox>` = Base UI `Combobox.Root` (a hidden `<input>` for
|
|
10
|
+
* forms, nothing else) > `<ComboboxInput>` (InputGroup > `<input
|
|
11
|
+
* role=combobox>` + addon > trigger/clear buttons) + `<ComboboxContent>`
|
|
12
|
+
* (Portal > Positioner > Popup) > `<ComboboxList role=listbox>` > items,
|
|
13
|
+
* `<ComboboxEmpty>`, groups.
|
|
14
|
+
*
|
|
15
|
+
* pont2:
|
|
16
|
+
* ```html
|
|
17
|
+
* <pont2-prim-combobox name="framework"> coordinator + form-associated, display: contents
|
|
18
|
+
* <pont2-prim-combobox-input placeholder="Select a framework"></pont2-prim-combobox-input> is the InputGroup; renders the native input + buttons
|
|
19
|
+
* <pont2-prim-combobox-content> the popup: [popover]
|
|
20
|
+
* <pont2-prim-combobox-empty>No items found.</pont2-prim-combobox-empty>
|
|
21
|
+
* <pont2-prim-combobox-list> role=listbox
|
|
22
|
+
* <pont2-prim-combobox-item value="next">Next.js</pont2-prim-combobox-item>
|
|
23
|
+
* </pont2-prim-combobox-list>
|
|
24
|
+
* </pont2-prim-combobox-content>
|
|
25
|
+
* </pont2-prim-combobox>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* **Which element submits?** The root (a form-associated custom element)
|
|
29
|
+
* submits `name` = the *selected item's value*, exactly what Base UI's hidden
|
|
30
|
+
* input submits. The native `<input>` is the typing surface (IME, caret,
|
|
31
|
+
* mobile keyboards, screen-reader combobox semantics) and has no `name`, so
|
|
32
|
+
* the half-typed query never reaches the server.
|
|
33
|
+
*
|
|
34
|
+
* Focus stays in the input; the highlighted item is announced with
|
|
35
|
+
* `aria-activedescendant` (virtual focus), as in Base UI.
|
|
36
|
+
*
|
|
37
|
+
* Not implemented yet: `multiple` with chips (`ComboboxChips`), async items,
|
|
38
|
+
* `autoHighlight`, creatable items. See docs/primitives/combobox.md.
|
|
39
|
+
*
|
|
40
|
+
* @tag pont2-prim-combobox
|
|
41
|
+
* @attr value - selected value (initially: Base UI `defaultValue`)
|
|
42
|
+
* @attr name, required, disabled, open
|
|
43
|
+
* @fires input, change - the user picked (or cleared) a value
|
|
44
|
+
* @fires pont2-open-change - cancelable `{ open, reason }`
|
|
45
|
+
*/
|
|
46
|
+
export declare class Combobox extends PopupRoot {
|
|
47
|
+
static formAssociated: boolean;
|
|
48
|
+
static identity: string;
|
|
49
|
+
static properties: PropertyDeclarations;
|
|
50
|
+
value: string;
|
|
51
|
+
name: string;
|
|
52
|
+
required: boolean;
|
|
53
|
+
/** What the user typed since the popup opened; filters the items. */
|
|
54
|
+
query: string;
|
|
55
|
+
protected formDisabled: boolean;
|
|
56
|
+
/** The virtually focused item. */
|
|
57
|
+
highlighted: ComboboxItem | null;
|
|
58
|
+
constructor();
|
|
59
|
+
get inputHost(): ComboboxInput | null;
|
|
60
|
+
get inputElement(): HTMLInputElement | null;
|
|
61
|
+
/** The input is the combobox element: it gets aria-expanded/controls and receives focus back. */
|
|
62
|
+
get triggerElement(): HTMLInputElement | null;
|
|
63
|
+
get contentElement(): ComboboxContent | null;
|
|
64
|
+
get listElement(): ComboboxList | null;
|
|
65
|
+
protected get popupKind(): "listbox";
|
|
66
|
+
protected anchorElement(): Element | null;
|
|
67
|
+
protected extraInsideElements(): (Element | null)[];
|
|
68
|
+
get allItems(): ComboboxItem[];
|
|
69
|
+
/** Items matching the current query. */
|
|
70
|
+
get items(): ComboboxItem[];
|
|
71
|
+
get selectedItem(): ComboboxItem | null;
|
|
72
|
+
get form(): HTMLFormElement | null;
|
|
73
|
+
get labels(): NodeList;
|
|
74
|
+
get validity(): ValidityState;
|
|
75
|
+
get isDisabled(): boolean;
|
|
76
|
+
checkValidity(): boolean;
|
|
77
|
+
reportValidity(): boolean;
|
|
78
|
+
formResetCallback(): void;
|
|
79
|
+
formDisabledCallback(disabled: boolean): void;
|
|
80
|
+
formStateRestoreCallback(state: string | null): void;
|
|
81
|
+
/** Base UI default filter: case- and accent-insensitive "contains". */
|
|
82
|
+
static filter(label: string, query: string): boolean;
|
|
83
|
+
select(item: ComboboxItem | null): void;
|
|
84
|
+
/** Show the selected item's label in the input (after select/close/reset). */
|
|
85
|
+
syncInputText(): void;
|
|
86
|
+
highlight(item: ComboboxItem | null, scroll?: boolean): void;
|
|
87
|
+
/** From the input: the user typed. */
|
|
88
|
+
handleQuery(text: string): void;
|
|
89
|
+
/** From the input: keyboard. */
|
|
90
|
+
handleKey(e: KeyboardEvent): void;
|
|
91
|
+
/** Hide items (and empty groups) that do not match the query. */
|
|
92
|
+
applyFilter(): void;
|
|
93
|
+
wire(): void;
|
|
94
|
+
protected afterOpen(): void;
|
|
95
|
+
protected afterClose(): void;
|
|
96
|
+
protected updated(changed: PropertyValues): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* shadcn `ComboboxInput`: an InputGroup holding the native `<input>` and an
|
|
100
|
+
* inline-end addon with the trigger (and optionally clear) button. The host
|
|
101
|
+
* **is** the InputGroup (`role=group`, `data-slot="input-group"`); it renders
|
|
102
|
+
* the input and buttons because shadcn's ComboboxInput generates them too.
|
|
103
|
+
*
|
|
104
|
+
* ```
|
|
105
|
+
* shadcn: div[data-slot=input-group] > input + div[data-slot=input-group-addon] > button[data-slot=input-group-button]
|
|
106
|
+
* pont2: pont2-prim-combobox-input > input + div[data-slot=input-group-addon] > button[data-slot=input-group-button]
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @tag pont2-prim-combobox-input
|
|
110
|
+
* @attr placeholder
|
|
111
|
+
* @attr show-trigger - default true; `="false"` hides the chevron button
|
|
112
|
+
* @attr show-clear - shows a clear (×) button while a value is selected
|
|
113
|
+
*/
|
|
114
|
+
export declare class ComboboxInput extends HostElement {
|
|
115
|
+
static identity: string;
|
|
116
|
+
static slotName: string;
|
|
117
|
+
static role: string;
|
|
118
|
+
static properties: PropertyDeclarations;
|
|
119
|
+
placeholder: string;
|
|
120
|
+
showTrigger: boolean;
|
|
121
|
+
showClear: boolean;
|
|
122
|
+
private readonly inputId;
|
|
123
|
+
constructor();
|
|
124
|
+
get root(): Combobox | null;
|
|
125
|
+
get control(): HTMLInputElement | null;
|
|
126
|
+
focus(options?: FocusOptions): void;
|
|
127
|
+
protected updated(): void;
|
|
128
|
+
private onInput;
|
|
129
|
+
private onKeyDown;
|
|
130
|
+
private onInputClick;
|
|
131
|
+
private onFocusOut;
|
|
132
|
+
private onTrigger;
|
|
133
|
+
private onClear;
|
|
134
|
+
private onAddonClick;
|
|
135
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The popup (Base UI `Combobox.Popup`, no role of its own: the list inside
|
|
139
|
+
* is the listbox). Opens below the input, start-aligned, 6px away.
|
|
140
|
+
*
|
|
141
|
+
* @tag pont2-prim-combobox-content
|
|
142
|
+
*/
|
|
143
|
+
export declare class ComboboxContent extends PopupContent {
|
|
144
|
+
static identity: string;
|
|
145
|
+
static slotName: string;
|
|
146
|
+
constructor();
|
|
147
|
+
}
|
|
148
|
+
/** Base UI `Combobox.List` (`role=listbox`). @tag pont2-prim-combobox-list */
|
|
149
|
+
export declare class ComboboxList extends HostElement {
|
|
150
|
+
static identity: string;
|
|
151
|
+
static slotName: string;
|
|
152
|
+
static role: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Base UI `Combobox.Item` (`role=option`), host-as-root, never focused
|
|
156
|
+
* (virtual focus). The check indicator is rendered after your content when
|
|
157
|
+
* selected.
|
|
158
|
+
*
|
|
159
|
+
* @tag pont2-prim-combobox-item
|
|
160
|
+
* @attr value, label, disabled
|
|
161
|
+
*/
|
|
162
|
+
export declare class ComboboxItem extends HostElement {
|
|
163
|
+
static identity: string;
|
|
164
|
+
static slotName: string;
|
|
165
|
+
static role: string;
|
|
166
|
+
static properties: PropertyDeclarations;
|
|
167
|
+
value: string;
|
|
168
|
+
disabled: boolean;
|
|
169
|
+
constructor();
|
|
170
|
+
get root(): Combobox | null;
|
|
171
|
+
get selected(): boolean;
|
|
172
|
+
get label(): string;
|
|
173
|
+
setHighlighted(on: boolean): void;
|
|
174
|
+
connectedCallback(): void;
|
|
175
|
+
protected willUpdate(): void;
|
|
176
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
177
|
+
}
|
|
178
|
+
/** Base UI `Combobox.Empty`: shown only while no item matches. @tag pont2-prim-combobox-empty */
|
|
179
|
+
export declare class ComboboxEmpty extends HostElement {
|
|
180
|
+
static identity: string;
|
|
181
|
+
static slotName: string;
|
|
182
|
+
connectedCallback(): void;
|
|
183
|
+
}
|
|
184
|
+
/** Base UI `Combobox.Group`. @tag pont2-prim-combobox-group */
|
|
185
|
+
export declare class ComboboxGroup extends HostElement {
|
|
186
|
+
static identity: string;
|
|
187
|
+
static slotName: string;
|
|
188
|
+
static role: string;
|
|
189
|
+
connectedCallback(): void;
|
|
190
|
+
}
|
|
191
|
+
/** Base UI `Combobox.GroupLabel`. @tag pont2-prim-combobox-label */
|
|
192
|
+
export declare class ComboboxLabel extends HostElement {
|
|
193
|
+
static identity: string;
|
|
194
|
+
static slotName: string;
|
|
195
|
+
}
|
|
196
|
+
/** Base UI `Combobox.Separator`; is-a Separator. @tag pont2-prim-combobox-separator */
|
|
197
|
+
export declare class ComboboxSeparator extends Separator {
|
|
198
|
+
static identity: string;
|
|
199
|
+
static slotName: string;
|
|
200
|
+
}
|
|
201
|
+
declare global {
|
|
202
|
+
interface HTMLElementTagNameMap {
|
|
203
|
+
"pont2-prim-combobox": Combobox;
|
|
204
|
+
"pont2-prim-combobox-input": ComboboxInput;
|
|
205
|
+
"pont2-prim-combobox-content": ComboboxContent;
|
|
206
|
+
"pont2-prim-combobox-list": ComboboxList;
|
|
207
|
+
"pont2-prim-combobox-item": ComboboxItem;
|
|
208
|
+
"pont2-prim-combobox-empty": ComboboxEmpty;
|
|
209
|
+
"pont2-prim-combobox-group": ComboboxGroup;
|
|
210
|
+
"pont2-prim-combobox-label": ComboboxLabel;
|
|
211
|
+
"pont2-prim-combobox-separator": ComboboxSeparator;
|
|
212
|
+
}
|
|
213
|
+
}
|