@pontive/pontkit-core 1.25.0 → 1.27.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/README.md +4 -0
- package/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -8
- package/dist/index.mjs.map +1 -1
- package/dist/pont2/core/attrs.d.ts +22 -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 +20 -0
- package/dist/pont2/core/ids.d.ts +6 -0
- package/dist/pont2/core/index.d.ts +8 -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 +3805 -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/avatar/avatar.d.ts +52 -0
- package/dist/pont2/kit/index.d.ts +3 -0
- package/dist/pont2/kit/input-otp/input-otp.d.ts +52 -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 +4137 -0
- package/dist/pont2/with-legacy.css +10 -0
- package/dist/styles.css +6 -0
- package/package.json +16 -4
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { PopupContent } from '../../core/popup/popup-content';
|
|
4
|
+
import { PopupRoot, PopupTrigger } from '../../core/popup/popup-root';
|
|
5
|
+
import { Separator } from '../separator/separator';
|
|
6
|
+
type FocusTarget = "first" | "last" | "popup";
|
|
7
|
+
/**
|
|
8
|
+
* # DropdownMenu
|
|
9
|
+
*
|
|
10
|
+
* shadcn: `<DropdownMenu>` = Base UI `Menu.Root` (renders nothing).
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <pont2-prim-dropdown-menu>
|
|
14
|
+
* <pont2-prim-dropdown-menu-trigger><button data-pont2-button data-variant="outline">Open</button></pont2-prim-dropdown-menu-trigger>
|
|
15
|
+
* <pont2-prim-dropdown-menu-content>
|
|
16
|
+
* <pont2-prim-dropdown-menu-group>
|
|
17
|
+
* <pont2-prim-dropdown-menu-label>My Account</pont2-prim-dropdown-menu-label>
|
|
18
|
+
* <pont2-prim-dropdown-menu-item>Profile <pont2-prim-dropdown-menu-shortcut>⇧⌘P</pont2-prim-dropdown-menu-shortcut></pont2-prim-dropdown-menu-item>
|
|
19
|
+
* </pont2-prim-dropdown-menu-group>
|
|
20
|
+
* </pont2-prim-dropdown-menu-content>
|
|
21
|
+
* </pont2-prim-dropdown-menu>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @tag pont2-prim-dropdown-menu
|
|
25
|
+
* @fires pont2-open-change - cancelable `{ open, reason }`
|
|
26
|
+
*/
|
|
27
|
+
export declare class DropdownMenu extends PopupRoot {
|
|
28
|
+
static identity: string;
|
|
29
|
+
/** Where focus goes when the menu opens (set by the trigger's key handling). */
|
|
30
|
+
focusOnOpen: FocusTarget;
|
|
31
|
+
get triggerElement(): HTMLElement | null;
|
|
32
|
+
get contentElement(): DropdownMenuContent | null;
|
|
33
|
+
protected get popupKind(): "menu";
|
|
34
|
+
openWith(focus: FocusTarget, reason?: "trigger-press" | "list-navigation"): void;
|
|
35
|
+
toggle(reason?: "trigger-press", opts?: {
|
|
36
|
+
keyboard?: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
protected afterOpen(): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* # DropdownMenuSub
|
|
42
|
+
*
|
|
43
|
+
* Base UI `Menu.SubmenuRoot` (renders nothing). Its trigger is a
|
|
44
|
+
* `pont2-prim-dropdown-menu-sub-trigger` (a menuitem), its popup a
|
|
45
|
+
* `pont2-prim-dropdown-menu-sub-content`.
|
|
46
|
+
*
|
|
47
|
+
* @tag pont2-prim-dropdown-menu-sub
|
|
48
|
+
*/
|
|
49
|
+
export declare class DropdownMenuSub extends PopupRoot {
|
|
50
|
+
static identity: string;
|
|
51
|
+
focusOnOpen: FocusTarget;
|
|
52
|
+
get triggerElement(): DropdownMenuSubTrigger | null;
|
|
53
|
+
get contentElement(): DropdownMenuSubContent | null;
|
|
54
|
+
protected get popupKind(): "menu";
|
|
55
|
+
openWith(focus: FocusTarget, reason: "trigger-press" | "trigger-hover" | "list-navigation"): void;
|
|
56
|
+
protected afterOpen(): void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Tier 3 enhancer around a native `<button>`; combine freely with the
|
|
60
|
+
* button recipe (`<button data-pont2-button data-variant="outline">`).
|
|
61
|
+
* ArrowDown/ArrowUp open the menu and highlight the first/last item.
|
|
62
|
+
*
|
|
63
|
+
* @tag pont2-prim-dropdown-menu-trigger
|
|
64
|
+
*/
|
|
65
|
+
export declare class DropdownMenuTrigger extends PopupTrigger {
|
|
66
|
+
static rootTag: string;
|
|
67
|
+
static controlSlot: string;
|
|
68
|
+
protected onKeyDown(e: KeyboardEvent): void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The menu popup: Base UI `Menu.Popup` (`role="menu"`). Items get real
|
|
72
|
+
* focus (roving), so the highlighted item is `document.activeElement`.
|
|
73
|
+
*
|
|
74
|
+
* @tag pont2-prim-dropdown-menu-content
|
|
75
|
+
* @attr side - bottom (default) … @attr align - start (default) …
|
|
76
|
+
* @attr side-offset - 4 @attr align-offset - 0
|
|
77
|
+
*/
|
|
78
|
+
export declare class DropdownMenuContent extends PopupContent {
|
|
79
|
+
static identity: string;
|
|
80
|
+
static slotName: string;
|
|
81
|
+
static role: string;
|
|
82
|
+
private typeahead;
|
|
83
|
+
private subCloseTimer;
|
|
84
|
+
constructor();
|
|
85
|
+
/** This menu's own items (not its submenus'), visible, in order. */
|
|
86
|
+
get items(): MenuItemBase[];
|
|
87
|
+
connectedCallback(): void;
|
|
88
|
+
show(): void;
|
|
89
|
+
hide(): Promise<void>;
|
|
90
|
+
focusTarget(target: FocusTarget): void;
|
|
91
|
+
/** Close open submenus of this menu, optionally keeping one. */
|
|
92
|
+
closeSubs(except?: Element | null): void;
|
|
93
|
+
/** Called when the pointer rests on one of this menu's items. */
|
|
94
|
+
scheduleSubClose(keep: Element | null): void;
|
|
95
|
+
cancelSubClose(): void;
|
|
96
|
+
private onPointerLeave;
|
|
97
|
+
private onKeyDown;
|
|
98
|
+
}
|
|
99
|
+
/** @tag pont2-prim-dropdown-menu-sub-content */
|
|
100
|
+
export declare class DropdownMenuSubContent extends DropdownMenuContent {
|
|
101
|
+
static identity: string;
|
|
102
|
+
static slotName: string;
|
|
103
|
+
constructor();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Shared behaviour of every menu item (Base UI `Menu.Item` and friends):
|
|
107
|
+
* host-as-root `role=menuitem*`, `tabindex=-1`, focus ⇄ `data-highlighted`,
|
|
108
|
+
* pointer hover highlights, click activates and (optionally) closes the menu.
|
|
109
|
+
*/
|
|
110
|
+
export declare abstract class MenuItemBase extends HostElement {
|
|
111
|
+
static identity: string;
|
|
112
|
+
static role: string;
|
|
113
|
+
static properties: PropertyDeclarations;
|
|
114
|
+
disabled: boolean;
|
|
115
|
+
inset: boolean;
|
|
116
|
+
closeOnClick: boolean;
|
|
117
|
+
constructor();
|
|
118
|
+
/** Text used by typeahead (Base UI `label`): the `label` attribute, else the text content. */
|
|
119
|
+
get label(): string;
|
|
120
|
+
connectedCallback(): void;
|
|
121
|
+
protected get menu(): DropdownMenuContent | null;
|
|
122
|
+
private onPointerMove;
|
|
123
|
+
private onClick;
|
|
124
|
+
/** What pressing the item does beyond firing `click`. */
|
|
125
|
+
protected activate(): void;
|
|
126
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Base UI `Menu.Item`. Listen for `click` to act on it.
|
|
130
|
+
*
|
|
131
|
+
* @tag pont2-prim-dropdown-menu-item
|
|
132
|
+
* @attr variant - default | destructive
|
|
133
|
+
* @attr inset, disabled, close-on-click="false"
|
|
134
|
+
*/
|
|
135
|
+
export declare class DropdownMenuItem extends MenuItemBase {
|
|
136
|
+
static identity: string;
|
|
137
|
+
static slotName: string;
|
|
138
|
+
static properties: PropertyDeclarations;
|
|
139
|
+
variant: "default" | "destructive";
|
|
140
|
+
constructor();
|
|
141
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Base UI `Menu.CheckboxItem` (`role=menuitemcheckbox`). Stays open on
|
|
145
|
+
* click by default, like Base UI. Fires `change` when toggled.
|
|
146
|
+
*
|
|
147
|
+
* @tag pont2-prim-dropdown-menu-checkbox-item
|
|
148
|
+
* @attr checked
|
|
149
|
+
* @fires change
|
|
150
|
+
*/
|
|
151
|
+
export declare class DropdownMenuCheckboxItem extends MenuItemBase {
|
|
152
|
+
static identity: string;
|
|
153
|
+
static slotName: string;
|
|
154
|
+
static role: string;
|
|
155
|
+
static properties: PropertyDeclarations;
|
|
156
|
+
checked: boolean;
|
|
157
|
+
constructor();
|
|
158
|
+
protected activate(): void;
|
|
159
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
160
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Base UI `Menu.RadioGroup` (`role=group`). Holds `value`; fires `change`
|
|
164
|
+
* when a radio item is picked.
|
|
165
|
+
*
|
|
166
|
+
* @tag pont2-prim-dropdown-menu-radio-group
|
|
167
|
+
* @attr value
|
|
168
|
+
* @fires change
|
|
169
|
+
*/
|
|
170
|
+
export declare class DropdownMenuRadioGroup extends HostElement {
|
|
171
|
+
static identity: string;
|
|
172
|
+
static slotName: string;
|
|
173
|
+
static role: string;
|
|
174
|
+
static properties: PropertyDeclarations;
|
|
175
|
+
value: string;
|
|
176
|
+
constructor();
|
|
177
|
+
select(value: string): void;
|
|
178
|
+
protected updated(): void;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Base UI `Menu.RadioItem` (`role=menuitemradio`).
|
|
182
|
+
*
|
|
183
|
+
* @tag pont2-prim-dropdown-menu-radio-item
|
|
184
|
+
* @attr value
|
|
185
|
+
*/
|
|
186
|
+
export declare class DropdownMenuRadioItem extends MenuItemBase {
|
|
187
|
+
static identity: string;
|
|
188
|
+
static slotName: string;
|
|
189
|
+
static role: string;
|
|
190
|
+
static properties: PropertyDeclarations;
|
|
191
|
+
value: string;
|
|
192
|
+
constructor();
|
|
193
|
+
get group(): DropdownMenuRadioGroup | null;
|
|
194
|
+
get checked(): boolean;
|
|
195
|
+
protected activate(): void;
|
|
196
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
197
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Base UI `Menu.SubmenuTrigger`: a menuitem that opens a submenu on hover
|
|
201
|
+
* (100 ms), click, Enter/Space, or ArrowRight (ArrowLeft in RTL). Renders the
|
|
202
|
+
* chevron after your content, as shadcn does.
|
|
203
|
+
*
|
|
204
|
+
* @tag pont2-prim-dropdown-menu-sub-trigger
|
|
205
|
+
*/
|
|
206
|
+
export declare class DropdownMenuSubTrigger extends MenuItemBase {
|
|
207
|
+
static identity: string;
|
|
208
|
+
static slotName: string;
|
|
209
|
+
private hoverTimer;
|
|
210
|
+
constructor();
|
|
211
|
+
get sub(): DropdownMenuSub | null;
|
|
212
|
+
get isSubOpen(): boolean;
|
|
213
|
+
protected activate(): void;
|
|
214
|
+
private onEnter;
|
|
215
|
+
private onKey;
|
|
216
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
217
|
+
}
|
|
218
|
+
/** Base UI `Menu.Group` (`role=group`, labelled by its label). @tag pont2-prim-dropdown-menu-group */
|
|
219
|
+
export declare class DropdownMenuGroup extends HostElement {
|
|
220
|
+
static identity: string;
|
|
221
|
+
static slotName: string;
|
|
222
|
+
static role: string;
|
|
223
|
+
connectedCallback(): void;
|
|
224
|
+
}
|
|
225
|
+
/** Base UI `Menu.GroupLabel`. @tag pont2-prim-dropdown-menu-label @attr inset */
|
|
226
|
+
export declare class DropdownMenuLabel extends HostElement {
|
|
227
|
+
static identity: string;
|
|
228
|
+
static slotName: string;
|
|
229
|
+
static properties: PropertyDeclarations;
|
|
230
|
+
inset: boolean;
|
|
231
|
+
constructor();
|
|
232
|
+
protected willUpdate(): void;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Base UI `Menu.Separator`. **Is a** Separator (`extends Separator`), so it
|
|
236
|
+
* carries `data-pont2-separator` (the look) and its own slot.
|
|
237
|
+
*
|
|
238
|
+
* @tag pont2-prim-dropdown-menu-separator
|
|
239
|
+
*/
|
|
240
|
+
export declare class DropdownMenuSeparator extends Separator {
|
|
241
|
+
static identity: string;
|
|
242
|
+
static slotName: string;
|
|
243
|
+
}
|
|
244
|
+
/** shadcn `DropdownMenuShortcut` (a `<span>`). @tag pont2-prim-dropdown-menu-shortcut */
|
|
245
|
+
export declare class DropdownMenuShortcut extends HostElement {
|
|
246
|
+
static identity: string;
|
|
247
|
+
static slotName: string;
|
|
248
|
+
}
|
|
249
|
+
declare global {
|
|
250
|
+
interface HTMLElementTagNameMap {
|
|
251
|
+
"pont2-prim-dropdown-menu": DropdownMenu;
|
|
252
|
+
"pont2-prim-dropdown-menu-sub": DropdownMenuSub;
|
|
253
|
+
"pont2-prim-dropdown-menu-trigger": DropdownMenuTrigger;
|
|
254
|
+
"pont2-prim-dropdown-menu-content": DropdownMenuContent;
|
|
255
|
+
"pont2-prim-dropdown-menu-sub-content": DropdownMenuSubContent;
|
|
256
|
+
"pont2-prim-dropdown-menu-item": DropdownMenuItem;
|
|
257
|
+
"pont2-prim-dropdown-menu-checkbox-item": DropdownMenuCheckboxItem;
|
|
258
|
+
"pont2-prim-dropdown-menu-radio-group": DropdownMenuRadioGroup;
|
|
259
|
+
"pont2-prim-dropdown-menu-radio-item": DropdownMenuRadioItem;
|
|
260
|
+
"pont2-prim-dropdown-menu-sub-trigger": DropdownMenuSubTrigger;
|
|
261
|
+
"pont2-prim-dropdown-menu-group": DropdownMenuGroup;
|
|
262
|
+
"pont2-prim-dropdown-menu-label": DropdownMenuLabel;
|
|
263
|
+
"pont2-prim-dropdown-menu-separator": DropdownMenuSeparator;
|
|
264
|
+
"pont2-prim-dropdown-menu-shortcut": DropdownMenuShortcut;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type EmptyMediaVariant = "default" | "icon";
|
|
4
|
+
/**
|
|
5
|
+
* # Empty: Tier 1 (structural)
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Empty>` → `<div data-slot="empty">` with `EmptyHeader`,
|
|
8
|
+
* `EmptyMedia` (`data-slot="empty-icon"`, `data-variant`), `EmptyTitle`,
|
|
9
|
+
* `EmptyDescription`, `EmptyContent`, all divs. All host-as-root here.
|
|
10
|
+
*
|
|
11
|
+
* @tag pont2-prim-empty
|
|
12
|
+
*/
|
|
13
|
+
export declare class Empty extends HostElement {
|
|
14
|
+
static identity: string;
|
|
15
|
+
static slotName: string;
|
|
16
|
+
}
|
|
17
|
+
/** @tag pont2-prim-empty-header */
|
|
18
|
+
export declare class EmptyHeader extends HostElement {
|
|
19
|
+
static identity: string;
|
|
20
|
+
static slotName: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Note shadcn's slot name for the media part is `empty-icon` (kept verbatim).
|
|
24
|
+
*
|
|
25
|
+
* @tag pont2-prim-empty-media
|
|
26
|
+
* @attr variant - default | icon
|
|
27
|
+
*/
|
|
28
|
+
export declare class EmptyMedia extends HostElement {
|
|
29
|
+
static identity: string;
|
|
30
|
+
static slotName: string;
|
|
31
|
+
static properties: PropertyDeclarations;
|
|
32
|
+
variant: EmptyMediaVariant;
|
|
33
|
+
constructor();
|
|
34
|
+
protected willUpdate(): void;
|
|
35
|
+
}
|
|
36
|
+
/** @tag pont2-prim-empty-title */
|
|
37
|
+
export declare class EmptyTitle extends HostElement {
|
|
38
|
+
static identity: string;
|
|
39
|
+
static slotName: string;
|
|
40
|
+
}
|
|
41
|
+
/** @tag pont2-prim-empty-description */
|
|
42
|
+
export declare class EmptyDescription extends HostElement {
|
|
43
|
+
static identity: string;
|
|
44
|
+
static slotName: string;
|
|
45
|
+
}
|
|
46
|
+
/** @tag pont2-prim-empty-content */
|
|
47
|
+
export declare class EmptyContent extends HostElement {
|
|
48
|
+
static identity: string;
|
|
49
|
+
static slotName: string;
|
|
50
|
+
}
|
|
51
|
+
declare global {
|
|
52
|
+
interface HTMLElementTagNameMap {
|
|
53
|
+
"pont2-prim-empty": Empty;
|
|
54
|
+
"pont2-prim-empty-header": EmptyHeader;
|
|
55
|
+
"pont2-prim-empty-media": EmptyMedia;
|
|
56
|
+
"pont2-prim-empty-title": EmptyTitle;
|
|
57
|
+
"pont2-prim-empty-description": EmptyDescription;
|
|
58
|
+
"pont2-prim-empty-content": EmptyContent;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { AttrMap } from '../../core/attrs';
|
|
3
|
+
import { HostElement, NativeEnhancer } from '../../core/host-element';
|
|
4
|
+
/**
|
|
5
|
+
* # Field family
|
|
6
|
+
*
|
|
7
|
+
* shadcn's `field.tsx` is plain markup (no Base UI primitive):
|
|
8
|
+
*
|
|
9
|
+
* | shadcn | renders | pont2 | tier |
|
|
10
|
+
* |-------------------|--------------------------------------------|-------------------------------|------|
|
|
11
|
+
* | FieldSet | `<fieldset data-slot="field-set">` | recipe/part on `<fieldset>`, `<pont2-prim-field-set>` enhancer | 3 |
|
|
12
|
+
* | FieldLegend | `<legend data-slot="field-legend" data-variant>` | recipe/part on `<legend>` only | 3 |
|
|
13
|
+
* | FieldGroup | `<div data-slot="field-group">` | `<pont2-prim-field-group>` | 1 |
|
|
14
|
+
* | Field | `<div role="group" data-slot="field" data-orientation>` | `<pont2-prim-field>` | 1 |
|
|
15
|
+
* | FieldContent | `<div data-slot="field-content">` | `<pont2-prim-field-content>` | 1 |
|
|
16
|
+
* | FieldLabel | `<label data-slot="field-label">` (Label) | recipe/part on `<label>`, `<pont2-prim-field-label>` enhancer | 3 |
|
|
17
|
+
* | FieldTitle | `<div data-slot="field-label">` | `<pont2-prim-field-title>` | 1 |
|
|
18
|
+
* | FieldDescription | `<p data-slot="field-description">` | `<pont2-prim-field-description>` | 1 |
|
|
19
|
+
* | FieldSeparator | `<div data-slot="field-separator">` > Separator + `<span>` | `<pont2-prim-field-separator>` (lines drawn in CSS) | 1 |
|
|
20
|
+
* | FieldError | `<div role="alert" data-slot="field-error">` | `<pont2-prim-field-error>` | 1 |
|
|
21
|
+
*
|
|
22
|
+
* Like shadcn, the family does no id wiring: you write `for`/`id` and
|
|
23
|
+
* `aria-describedby` yourself (Base UI's own `Field` primitive does wire ids;
|
|
24
|
+
* shadcn's Field does not use it). See docs/primitives/field.md.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyFieldSet(el: HTMLFieldSetElement): void;
|
|
27
|
+
export declare function fieldSet(o: {
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
attrs?: AttrMap;
|
|
30
|
+
}, content: unknown): import('lit-html').TemplateResult<1>;
|
|
31
|
+
export declare function fieldLegend(o: {
|
|
32
|
+
variant?: "legend" | "label";
|
|
33
|
+
attrs?: AttrMap;
|
|
34
|
+
}, content: unknown): import('lit-html').TemplateResult<1>;
|
|
35
|
+
/**
|
|
36
|
+
* Applies the FieldSet recipe to the `<fieldset>` inside it. The legend must
|
|
37
|
+
* be a direct child of that `<fieldset>` to name it, so write
|
|
38
|
+
* `<legend data-pont2-field-legend>` (there is no legend element).
|
|
39
|
+
*
|
|
40
|
+
* @tag pont2-prim-field-set
|
|
41
|
+
*/
|
|
42
|
+
export declare class FieldSetElement extends NativeEnhancer<HTMLFieldSetElement> {
|
|
43
|
+
static nativeSelector: string;
|
|
44
|
+
protected apply(control: HTMLFieldSetElement): void;
|
|
45
|
+
}
|
|
46
|
+
/** @tag pont2-prim-field-group */
|
|
47
|
+
export declare class FieldGroup extends HostElement {
|
|
48
|
+
static identity: string;
|
|
49
|
+
static slotName: string;
|
|
50
|
+
}
|
|
51
|
+
export type FieldOrientation = "vertical" | "horizontal" | "responsive";
|
|
52
|
+
/**
|
|
53
|
+
* @tag pont2-prim-field
|
|
54
|
+
* @attr orientation - vertical (default) | horizontal | responsive
|
|
55
|
+
* @attr invalid - Sets `data-invalid` (destructive text colour), like shadcn's `data-invalid`.
|
|
56
|
+
* @attr disabled - Sets `data-disabled` (dims the label/title), like shadcn's `data-disabled`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class Field extends HostElement {
|
|
59
|
+
static identity: string;
|
|
60
|
+
static slotName: string;
|
|
61
|
+
static role: string;
|
|
62
|
+
static properties: PropertyDeclarations;
|
|
63
|
+
orientation: FieldOrientation;
|
|
64
|
+
invalid: boolean;
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
constructor();
|
|
67
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
68
|
+
}
|
|
69
|
+
/** @tag pont2-prim-field-content */
|
|
70
|
+
export declare class FieldContent extends HostElement {
|
|
71
|
+
static identity: string;
|
|
72
|
+
static slotName: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function applyFieldLabel(el: HTMLLabelElement): void;
|
|
75
|
+
/** `<label data-pont2-label data-pont2-field-label data-slot="field-label">` */
|
|
76
|
+
export declare function fieldLabel(o: {
|
|
77
|
+
for?: string;
|
|
78
|
+
id?: string;
|
|
79
|
+
attrs?: AttrMap;
|
|
80
|
+
}, content: unknown): import('lit-html').TemplateResult<1>;
|
|
81
|
+
/** @tag pont2-prim-field-label */
|
|
82
|
+
export declare class FieldLabelElement extends NativeEnhancer<HTMLLabelElement> {
|
|
83
|
+
static nativeSelector: string;
|
|
84
|
+
protected apply(control: HTMLLabelElement): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A label-styled title for a field that has no single control to label
|
|
88
|
+
* (shadcn gives it `data-slot="field-label"` too, kept verbatim).
|
|
89
|
+
*
|
|
90
|
+
* @tag pont2-prim-field-title
|
|
91
|
+
*/
|
|
92
|
+
export declare class FieldTitle extends HostElement {
|
|
93
|
+
static identity: string;
|
|
94
|
+
static slotName: string;
|
|
95
|
+
}
|
|
96
|
+
/** @tag pont2-prim-field-description */
|
|
97
|
+
export declare class FieldDescription extends HostElement {
|
|
98
|
+
static identity: string;
|
|
99
|
+
static slotName: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* shadcn renders `div > Separator + span`. pont2 draws the two rule halves
|
|
103
|
+
* with `::before`/`::after`, so the only nodes are the host and your text.
|
|
104
|
+
* `data-content` is set when the separator has text, as in shadcn.
|
|
105
|
+
*
|
|
106
|
+
* @tag pont2-prim-field-separator
|
|
107
|
+
*/
|
|
108
|
+
export declare class FieldSeparator extends HostElement {
|
|
109
|
+
static identity: string;
|
|
110
|
+
static slotName: string;
|
|
111
|
+
private observer?;
|
|
112
|
+
connectedCallback(): void;
|
|
113
|
+
disconnectedCallback(): void;
|
|
114
|
+
private sync;
|
|
115
|
+
}
|
|
116
|
+
export interface FieldErrorItem {
|
|
117
|
+
message?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Write the message as children, or set `.errors` (shadcn's `errors` prop:
|
|
121
|
+
* de-duplicated by message; one renders as text, several as a list). Hidden
|
|
122
|
+
* while empty, like shadcn returning `null`.
|
|
123
|
+
*
|
|
124
|
+
* @tag pont2-prim-field-error
|
|
125
|
+
*/
|
|
126
|
+
export declare class FieldError extends HostElement {
|
|
127
|
+
static identity: string;
|
|
128
|
+
static slotName: string;
|
|
129
|
+
static role: string;
|
|
130
|
+
static properties: PropertyDeclarations;
|
|
131
|
+
errors: Array<FieldErrorItem | undefined> | undefined;
|
|
132
|
+
render(): string | import('lit-html').TemplateResult<1> | typeof nothing | undefined;
|
|
133
|
+
}
|
|
134
|
+
declare global {
|
|
135
|
+
interface HTMLElementTagNameMap {
|
|
136
|
+
"pont2-prim-field-set": FieldSetElement;
|
|
137
|
+
"pont2-prim-field-group": FieldGroup;
|
|
138
|
+
"pont2-prim-field": Field;
|
|
139
|
+
"pont2-prim-field-content": FieldContent;
|
|
140
|
+
"pont2-prim-field-label": FieldLabelElement;
|
|
141
|
+
"pont2-prim-field-title": FieldTitle;
|
|
142
|
+
"pont2-prim-field-description": FieldDescription;
|
|
143
|
+
"pont2-prim-field-separator": FieldSeparator;
|
|
144
|
+
"pont2-prim-field-error": FieldError;
|
|
145
|
+
}
|
|
146
|
+
}
|