@pontive/pontkit-core 1.38.0 → 1.40.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/index.js +1410 -1263
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14296 -12214
- package/dist/index.mjs.map +1 -1
- package/dist/pont2/core/context-root.d.ts +1 -0
- package/dist/pont2/core/events.d.ts +1 -1
- package/dist/pont2/core/icons.d.ts +6 -0
- package/dist/pont2/core/index.d.ts +1 -0
- package/dist/pont2/core/messages.d.ts +21 -0
- package/dist/pont2/core/popup/index.d.ts +1 -0
- package/dist/pont2/core/popup/modal.d.ts +56 -0
- package/dist/pont2/core/popup/popup-content.d.ts +7 -0
- package/dist/pont2/core/popup/story-helpers.d.ts +6 -0
- package/dist/pont2/custom-elements.json +42860 -18234
- package/dist/pont2/index.d.ts +7 -0
- package/dist/pont2/index.mjs +4434 -2359
- package/dist/pont2/index.mjs.map +1 -1
- package/dist/pont2/kit/badge-selector/badge-selector.d.ts +65 -0
- package/dist/pont2/kit/consent/consent.d.ts +3 -2
- package/dist/pont2/kit/data-table/data-table.d.ts +120 -0
- package/dist/pont2/kit/data-table/rows.d.ts +25 -0
- package/dist/pont2/kit/flow-widget/flow-widget.d.ts +21 -8
- package/dist/pont2/kit/index.d.ts +7 -0
- package/dist/pont2/kit/layout/layout.d.ts +7 -0
- package/dist/pont2/kit/multi-email-input/emails.d.ts +19 -0
- package/dist/pont2/kit/multi-email-input/multi-email-input.d.ts +78 -0
- package/dist/pont2/kit/multi-select-filter/multi-select-filter.d.ts +53 -0
- package/dist/pont2/kit/pagination/pagination.d.ts +61 -0
- package/dist/pont2/kit/pagination/range.d.ts +17 -0
- package/dist/pont2/kit/provider/coexistence.d.ts +19 -0
- package/dist/pont2/kit/provider/contexts.d.ts +46 -0
- package/dist/pont2/kit/provider/provider.d.ts +185 -0
- package/dist/pont2/kit/provider/redirect.d.ts +122 -0
- package/dist/pont2/kit/provider/runtime-config.d.ts +24 -0
- package/dist/pont2/kit/provider/sdk.d.ts +86 -0
- package/dist/pont2/kit/provider/signed-in.d.ts +81 -0
- package/dist/pont2/kit/provider/widget-messages.d.ts +35 -0
- package/dist/pont2/primitives/alert-dialog/alert-dialog.d.ts +132 -0
- package/dist/pont2/primitives/combobox/combobox.d.ts +82 -14
- package/dist/pont2/primitives/dialog/dialog.d.ts +195 -0
- package/dist/pont2/primitives/drawer/drawer.d.ts +112 -0
- package/dist/pont2/primitives/hover-card/hover-card.d.ts +83 -0
- package/dist/pont2/primitives/pagination/pagination.d.ts +120 -0
- package/dist/pont2/primitives/sheet/sheet.d.ts +92 -0
- package/dist/pont2/primitives/sonner/sonner.d.ts +86 -0
- package/dist/pont2/primitives/sonner/toast-store.d.ts +81 -0
- package/dist/pont2/styles.css +1325 -81
- package/dist/pont2/theme/tokens.json.d.ts +700 -1
- package/dist/pont2/theme-golden.json +85 -43
- package/dist/pont2/theme.mjs +119 -119
- package/dist/pont2/tokens.json +700 -1
- package/dist/styles.css +1325 -81
- package/package.json +11 -5
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
2
|
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { MessagesController } from '../../core/messages';
|
|
3
4
|
import { PopupContent } from '../../core/popup/popup-content';
|
|
4
5
|
import { PopupRoot } from '../../core/popup/popup-root';
|
|
5
6
|
import { Separator } from '../separator/separator';
|
|
6
7
|
/**
|
|
7
|
-
* # Combobox
|
|
8
|
+
* # Combobox
|
|
8
9
|
*
|
|
9
10
|
* shadcn: `<Combobox>` = Base UI `Combobox.Root` (a hidden `<input>` for
|
|
10
11
|
* forms, nothing else) > `<ComboboxInput>` (InputGroup > `<input
|
|
@@ -34,11 +35,21 @@ import { Separator } from '../separator/separator';
|
|
|
34
35
|
* Focus stays in the input; the highlighted item is announced with
|
|
35
36
|
* `aria-activedescendant` (virtual focus), as in Base UI.
|
|
36
37
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
38
|
+
* **Multiple selection** (`multiple`): the selection is `values` (an array),
|
|
39
|
+
* the popup stays open while you pick, and the input is a
|
|
40
|
+
* `<pont2-prim-combobox-chips>`, which shows a removable chip per value
|
|
41
|
+
* (shadcn's `ComboboxChips` + `ComboboxValue` + `ComboboxChip` +
|
|
42
|
+
* `ComboboxChipsInput`). The root submits one `name=value` entry per value.
|
|
43
|
+
* A selected item that is `disabled` is **locked**: its chip has no remove
|
|
44
|
+
* button and cannot be removed (pont2's addition, for roles a person may not
|
|
45
|
+
* take away).
|
|
46
|
+
*
|
|
47
|
+
* Not implemented yet: async items, `autoHighlight`, creatable items. See
|
|
48
|
+
* docs/primitives/combobox.md.
|
|
39
49
|
*
|
|
40
50
|
* @tag pont2-prim-combobox
|
|
41
|
-
* @attr value - selected value (initially: Base UI `defaultValue`)
|
|
51
|
+
* @attr value - selected value (initially: Base UI `defaultValue`); single selection
|
|
52
|
+
* @attr multiple - multiple selection: read and write the `values` property
|
|
42
53
|
* @attr name, required, disabled, open
|
|
43
54
|
* @fires input, change - the user picked (or cleared) a value
|
|
44
55
|
* @fires pont2-open-change - cancelable `{ open, reason }`
|
|
@@ -48,6 +59,9 @@ export declare class Combobox extends PopupRoot {
|
|
|
48
59
|
static identity: string;
|
|
49
60
|
static properties: PropertyDeclarations;
|
|
50
61
|
value: string;
|
|
62
|
+
/** The selection when `multiple` (Base UI's array `value`). */
|
|
63
|
+
values: string[];
|
|
64
|
+
multiple: boolean;
|
|
51
65
|
name: string;
|
|
52
66
|
required: boolean;
|
|
53
67
|
/** What the user typed since the popup opened; filters the items. */
|
|
@@ -55,7 +69,10 @@ export declare class Combobox extends PopupRoot {
|
|
|
55
69
|
protected formDisabled: boolean;
|
|
56
70
|
/** The virtually focused item. */
|
|
57
71
|
highlighted: ComboboxItem | null;
|
|
72
|
+
/** `values` as first set: what a form reset restores (multiple). */
|
|
73
|
+
private defaultValues;
|
|
58
74
|
constructor();
|
|
75
|
+
/** The ComboboxInput, or the ComboboxChips (which is one) when `multiple`. */
|
|
59
76
|
get inputHost(): ComboboxInput | null;
|
|
60
77
|
get inputElement(): HTMLInputElement | null;
|
|
61
78
|
/** The input is the combobox element: it gets aria-expanded/controls and receives focus back. */
|
|
@@ -69,6 +86,13 @@ export declare class Combobox extends PopupRoot {
|
|
|
69
86
|
/** Items matching the current query. */
|
|
70
87
|
get items(): ComboboxItem[];
|
|
71
88
|
get selectedItem(): ComboboxItem | null;
|
|
89
|
+
/** The selected values, in either mode. */
|
|
90
|
+
get selectedValues(): string[];
|
|
91
|
+
isSelected(value: string): boolean;
|
|
92
|
+
/** A selected value whose item is disabled cannot be removed (multiple). */
|
|
93
|
+
isLocked(value: string): boolean;
|
|
94
|
+
/** The text shown for a value: its item's label, else the value itself. */
|
|
95
|
+
labelOf(value: string): string;
|
|
72
96
|
get form(): HTMLFormElement | null;
|
|
73
97
|
get labels(): NodeList;
|
|
74
98
|
get validity(): ValidityState;
|
|
@@ -77,11 +101,16 @@ export declare class Combobox extends PopupRoot {
|
|
|
77
101
|
reportValidity(): boolean;
|
|
78
102
|
formResetCallback(): void;
|
|
79
103
|
formDisabledCallback(disabled: boolean): void;
|
|
80
|
-
formStateRestoreCallback(state: string | null): void;
|
|
104
|
+
formStateRestoreCallback(state: string | FormData | null): void;
|
|
81
105
|
/** Base UI default filter: case- and accent-insensitive "contains". */
|
|
82
106
|
static filter(label: string, query: string): boolean;
|
|
83
107
|
select(item: ComboboxItem | null): void;
|
|
84
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Remove one value (a chip's remove button, Backspace). Returns false for a
|
|
110
|
+
* locked or unselected value.
|
|
111
|
+
*/
|
|
112
|
+
removeValue(value: string): boolean;
|
|
113
|
+
/** Show the selected item's label in the input (after select/close/reset); empty in multiple mode. */
|
|
85
114
|
syncInputText(): void;
|
|
86
115
|
highlight(item: ComboboxItem | null, scroll?: boolean): void;
|
|
87
116
|
/** From the input: the user typed. */
|
|
@@ -119,19 +148,57 @@ export declare class ComboboxInput extends HostElement {
|
|
|
119
148
|
placeholder: string;
|
|
120
149
|
showTrigger: boolean;
|
|
121
150
|
showClear: boolean;
|
|
122
|
-
|
|
151
|
+
protected readonly inputId: string;
|
|
123
152
|
constructor();
|
|
124
153
|
get root(): Combobox | null;
|
|
125
154
|
get control(): HTMLInputElement | null;
|
|
126
155
|
focus(options?: FocusOptions): void;
|
|
127
156
|
protected updated(): void;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
protected onInput: (e: Event) => void | undefined;
|
|
158
|
+
protected onKeyDown: (e: KeyboardEvent) => void | undefined;
|
|
159
|
+
protected onInputClick: () => void;
|
|
160
|
+
protected onFocusOut: (e: FocusEvent) => void;
|
|
161
|
+
protected onTrigger: () => void;
|
|
162
|
+
protected onClear: () => void;
|
|
163
|
+
protected onAddonClick: (e: MouseEvent) => void;
|
|
164
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* shadcn `ComboboxChips` for a `multiple` combobox: the input box that holds a
|
|
168
|
+
* chip per selected value and the text input after them. It **is** a
|
|
169
|
+
* ComboboxInput (same input behaviour, same tokens), laid out as a wrapping
|
|
170
|
+
* row.
|
|
171
|
+
*
|
|
172
|
+
* shadcn writes the chips with a render prop (`<ComboboxValue>{values =>
|
|
173
|
+
* values.map(v => <ComboboxChip>…)}</ComboboxValue><ComboboxChipsInput/>`).
|
|
174
|
+
* HTML has no render prop, so the host renders them from the root's
|
|
175
|
+
* `values`, as parts with shadcn's slots:
|
|
176
|
+
*
|
|
177
|
+
* ```
|
|
178
|
+
* shadcn: div[data-slot=combobox-chips] > div[data-slot=combobox-chip] (> button[data-slot=combobox-chip-remove])… + input[data-slot=combobox-chip-input]
|
|
179
|
+
* pont2: pont2-prim-combobox-chips > div[data-slot=combobox-chip] (> button[data-slot=combobox-chip-remove])… + input[data-slot=combobox-chip-input]
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* Keyboard (Base UI): Backspace in the empty input removes the last chip;
|
|
183
|
+
* ArrowLeft moves to the chips, ArrowLeft / ArrowRight move between them,
|
|
184
|
+
* Backspace / Delete remove the focused one, ArrowRight past the last
|
|
185
|
+
* returns to the input. A locked chip (its item is `disabled`) has no remove
|
|
186
|
+
* button and is skipped by removal.
|
|
187
|
+
*
|
|
188
|
+
* @tag pont2-prim-combobox-chips
|
|
189
|
+
* @attr placeholder - shown while nothing is selected
|
|
190
|
+
*/
|
|
191
|
+
export declare class ComboboxChips extends ComboboxInput {
|
|
192
|
+
static identity: string;
|
|
193
|
+
static slotName: string;
|
|
194
|
+
protected readonly messages: MessagesController;
|
|
195
|
+
get control(): HTMLInputElement | null;
|
|
196
|
+
private get chipElements();
|
|
197
|
+
/** Focus the chip at `index` (clamped); past the end focuses the input. */
|
|
198
|
+
focusChip(index: number): void;
|
|
199
|
+
private onChipKeyDown;
|
|
200
|
+
private onChipsClick;
|
|
201
|
+
connectedCallback(): void;
|
|
135
202
|
render(): import('lit-html').TemplateResult<1>;
|
|
136
203
|
}
|
|
137
204
|
/**
|
|
@@ -202,6 +269,7 @@ declare global {
|
|
|
202
269
|
interface HTMLElementTagNameMap {
|
|
203
270
|
"pont2-prim-combobox": Combobox;
|
|
204
271
|
"pont2-prim-combobox-input": ComboboxInput;
|
|
272
|
+
"pont2-prim-combobox-chips": ComboboxChips;
|
|
205
273
|
"pont2-prim-combobox-content": ComboboxContent;
|
|
206
274
|
"pont2-prim-combobox-list": ComboboxList;
|
|
207
275
|
"pont2-prim-combobox-item": ComboboxItem;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement, NativeEnhancer } from '../../core/host-element';
|
|
3
|
+
import { MessagesController } from '../../core/messages';
|
|
4
|
+
import { PopupContent } from '../../core/popup/popup-content';
|
|
5
|
+
import { PopupRoot, PopupTrigger } from '../../core/popup/popup-root';
|
|
6
|
+
/** Boolean attribute that defaults to true and is turned off with `="false"`. */
|
|
7
|
+
export declare const trueUnlessFalse: {
|
|
8
|
+
fromAttribute: (v: string | null) => boolean;
|
|
9
|
+
toAttribute: (v: boolean) => string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* # ModalRoot: the coordinator of a modal popup family
|
|
13
|
+
*
|
|
14
|
+
* Base UI's `Dialog.Root` / `AlertDialog.Root` / `Drawer.Root` render no
|
|
15
|
+
* element; like every pont2 popup root this is a `display: contents`
|
|
16
|
+
* coordinator (core/popup/popup-root.ts). On top of a popup root it adds what
|
|
17
|
+
* Base UI's `modal` (default `true`) does, from core/popup/modal.ts:
|
|
18
|
+
*
|
|
19
|
+
* - everything outside the popup is `inert` (and so hidden from assistive tech);
|
|
20
|
+
* - the page does not scroll;
|
|
21
|
+
* - Tab and Shift+Tab cycle inside the popup;
|
|
22
|
+
* - on open, focus moves to the `autofocus` element, else the first tabbable
|
|
23
|
+
* element, else the popup; on close it returns to the element that had it
|
|
24
|
+
* (normally the trigger).
|
|
25
|
+
*
|
|
26
|
+
* `modal="false"` keeps the popup but drops all four (Base UI `modal={false}`).
|
|
27
|
+
* Subclasses name their family (`static family`), which their trigger,
|
|
28
|
+
* content and close are looked up by.
|
|
29
|
+
*/
|
|
30
|
+
export declare abstract class ModalRoot extends PopupRoot {
|
|
31
|
+
static family: string;
|
|
32
|
+
static properties: PropertyDeclarations;
|
|
33
|
+
modal: boolean;
|
|
34
|
+
private release;
|
|
35
|
+
private returnTo;
|
|
36
|
+
constructor();
|
|
37
|
+
protected get family(): string;
|
|
38
|
+
get triggerElement(): HTMLButtonElement | null;
|
|
39
|
+
get contentElement(): ModalContent | null;
|
|
40
|
+
protected get popupKind(): "dialog";
|
|
41
|
+
/** Whether a press outside the popup closes it (Base UI: yes for Dialog, no for AlertDialog). */
|
|
42
|
+
protected get dismissOnOutsidePress(): boolean;
|
|
43
|
+
wire(): void;
|
|
44
|
+
protected afterOpen(): void;
|
|
45
|
+
/** Base UI `finalFocus`: back to the element that opened it, whatever closed it. */
|
|
46
|
+
protected afterClose(focusWasInside: boolean): void;
|
|
47
|
+
private releaseModal;
|
|
48
|
+
disconnectedCallback(): void;
|
|
49
|
+
protected updated(changed: PropertyValues): void;
|
|
50
|
+
}
|
|
51
|
+
/** Tier 3 enhancer around a native `<button>` that toggles its modal root. */
|
|
52
|
+
export declare abstract class ModalTrigger extends PopupTrigger {
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* # ModalContent: the modal popup itself
|
|
56
|
+
*
|
|
57
|
+
* shadcn renders `Portal > Overlay + Popup`. In pont2 the popup **is** the
|
|
58
|
+
* content element, shown in the top layer with the Popover API (it is never
|
|
59
|
+
* moved), and the overlay is its `::backdrop`: the same box (fixed, full
|
|
60
|
+
* viewport, under the popup, above the page) with no element to write.
|
|
61
|
+
*
|
|
62
|
+
* It is labelled by its title and described by its description, has
|
|
63
|
+
* `aria-modal` while modal, and renders shadcn's close button (an × in the
|
|
64
|
+
* corner) after your content unless `show-close-button="false"`.
|
|
65
|
+
*/
|
|
66
|
+
export declare abstract class ModalContent extends PopupContent {
|
|
67
|
+
static role: string;
|
|
68
|
+
/** The family this content belongs to (its title, description and close are named after it). */
|
|
69
|
+
static family: string;
|
|
70
|
+
/** AlertDialog has no corner close button. */
|
|
71
|
+
static closeButton: boolean;
|
|
72
|
+
static properties: PropertyDeclarations;
|
|
73
|
+
showCloseButton: boolean;
|
|
74
|
+
/** Set by the root. */
|
|
75
|
+
modal: boolean;
|
|
76
|
+
protected readonly messages: MessagesController;
|
|
77
|
+
constructor();
|
|
78
|
+
protected get family(): string;
|
|
79
|
+
get isModal(): boolean;
|
|
80
|
+
protected get anchored(): boolean;
|
|
81
|
+
connectedCallback(): void;
|
|
82
|
+
show(): void;
|
|
83
|
+
protected closeButton(): unknown;
|
|
84
|
+
render(): unknown;
|
|
85
|
+
}
|
|
86
|
+
/** Tier 3 enhancer: the native `<button>` inside closes the modal it is in (Base UI `Close`). */
|
|
87
|
+
export declare abstract class ModalClose extends NativeEnhancer<HTMLButtonElement> {
|
|
88
|
+
static nativeSelector: string;
|
|
89
|
+
static controlSlot: string;
|
|
90
|
+
constructor();
|
|
91
|
+
protected apply(control: HTMLButtonElement): void;
|
|
92
|
+
}
|
|
93
|
+
/** A modal's title: Base UI renders an `<h2>`, pont2 keeps the heading semantics through internals. */
|
|
94
|
+
export declare abstract class ModalTitle extends HostElement {
|
|
95
|
+
static role: string;
|
|
96
|
+
connectedCallback(): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* # Dialog
|
|
100
|
+
*
|
|
101
|
+
* shadcn: `<Dialog>` (Base UI `Dialog.Root`, renders nothing) >
|
|
102
|
+
* `<DialogTrigger>` (a `<button>`) + `<DialogContent>` (Portal > Overlay +
|
|
103
|
+
* Popup > children + close button), with `DialogHeader/Footer/Title/
|
|
104
|
+
* Description/Close`.
|
|
105
|
+
*
|
|
106
|
+
* pont2:
|
|
107
|
+
* ```html
|
|
108
|
+
* <pont2-prim-dialog> coordinator, display: contents
|
|
109
|
+
* <pont2-prim-dialog-trigger><button data-pont2-button data-variant="outline">Edit profile</button></pont2-prim-dialog-trigger>
|
|
110
|
+
* <pont2-prim-dialog-content> the popup: [popover], role=dialog, ::backdrop = the overlay
|
|
111
|
+
* <pont2-prim-dialog-header>
|
|
112
|
+
* <pont2-prim-dialog-title>Edit profile</pont2-prim-dialog-title>
|
|
113
|
+
* <pont2-prim-dialog-description>Make changes to your profile here.</pont2-prim-dialog-description>
|
|
114
|
+
* </pont2-prim-dialog-header>
|
|
115
|
+
* …
|
|
116
|
+
* <pont2-prim-dialog-footer>
|
|
117
|
+
* <pont2-prim-dialog-close><button data-pont2-button data-variant="outline">Cancel</button></pont2-prim-dialog-close>
|
|
118
|
+
* <button data-pont2-button type="submit">Save changes</button>
|
|
119
|
+
* </pont2-prim-dialog-footer>
|
|
120
|
+
* </pont2-prim-dialog-content>
|
|
121
|
+
* </pont2-prim-dialog>
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @tag pont2-prim-dialog
|
|
125
|
+
* @attr open - Open state (initially: Base UI `defaultOpen`; property: controlled `open`).
|
|
126
|
+
* @attr modal - default true; `="false"`: no inert page, scroll lock or focus trap.
|
|
127
|
+
* @fires pont2-open-change - cancelable, `{ open, reason }` (reasons: trigger-press, escape-key, outside-press, close-press).
|
|
128
|
+
*/
|
|
129
|
+
export declare class Dialog extends ModalRoot {
|
|
130
|
+
static identity: string;
|
|
131
|
+
static family: string;
|
|
132
|
+
}
|
|
133
|
+
/** @tag pont2-prim-dialog-trigger */
|
|
134
|
+
export declare class DialogTrigger extends ModalTrigger {
|
|
135
|
+
static rootTag: string;
|
|
136
|
+
static controlSlot: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The dialog popup, centred, with the overlay as its `::backdrop`.
|
|
140
|
+
*
|
|
141
|
+
* @tag pont2-prim-dialog-content
|
|
142
|
+
* @attr show-close-button - default true; `="false"` hides the × button.
|
|
143
|
+
* @cssprop --pont2-dialog-bg, --pont2-dialog-fg, --pont2-dialog-border-color, --pont2-dialog-radius, --pont2-dialog-shadow - see docs/11-tokens.md
|
|
144
|
+
* @cssprop --pont2-dialog-max-width, --pont2-dialog-padding-x, --pont2-dialog-padding-y, --pont2-dialog-gap - sizes
|
|
145
|
+
* @cssprop --pont2-dialog-overlay-bg - the overlay colour
|
|
146
|
+
*/
|
|
147
|
+
export declare class DialogContent extends ModalContent {
|
|
148
|
+
static identity: string;
|
|
149
|
+
static slotName: string;
|
|
150
|
+
static family: string;
|
|
151
|
+
}
|
|
152
|
+
/** @tag pont2-prim-dialog-header */
|
|
153
|
+
export declare class DialogHeader extends HostElement {
|
|
154
|
+
static identity: string;
|
|
155
|
+
static slotName: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @tag pont2-prim-dialog-footer
|
|
159
|
+
* @attr show-close-button - renders shadcn's outline "Close" button after your content (default false).
|
|
160
|
+
*/
|
|
161
|
+
export declare class DialogFooter extends HostElement {
|
|
162
|
+
static identity: string;
|
|
163
|
+
static slotName: string;
|
|
164
|
+
static properties: PropertyDeclarations;
|
|
165
|
+
showCloseButton: boolean;
|
|
166
|
+
protected readonly messages: MessagesController;
|
|
167
|
+
constructor();
|
|
168
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
169
|
+
}
|
|
170
|
+
/** @tag pont2-prim-dialog-title */
|
|
171
|
+
export declare class DialogTitle extends ModalTitle {
|
|
172
|
+
static identity: string;
|
|
173
|
+
static slotName: string;
|
|
174
|
+
}
|
|
175
|
+
/** @tag pont2-prim-dialog-description */
|
|
176
|
+
export declare class DialogDescription extends HostElement {
|
|
177
|
+
static identity: string;
|
|
178
|
+
static slotName: string;
|
|
179
|
+
}
|
|
180
|
+
/** @tag pont2-prim-dialog-close */
|
|
181
|
+
export declare class DialogClose extends ModalClose {
|
|
182
|
+
static controlSlot: string;
|
|
183
|
+
}
|
|
184
|
+
declare global {
|
|
185
|
+
interface HTMLElementTagNameMap {
|
|
186
|
+
"pont2-prim-dialog": Dialog;
|
|
187
|
+
"pont2-prim-dialog-trigger": DialogTrigger;
|
|
188
|
+
"pont2-prim-dialog-content": DialogContent;
|
|
189
|
+
"pont2-prim-dialog-header": DialogHeader;
|
|
190
|
+
"pont2-prim-dialog-footer": DialogFooter;
|
|
191
|
+
"pont2-prim-dialog-title": DialogTitle;
|
|
192
|
+
"pont2-prim-dialog-description": DialogDescription;
|
|
193
|
+
"pont2-prim-dialog-close": DialogClose;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { ModalClose, ModalContent, ModalRoot, ModalTitle, ModalTrigger } from '../dialog/dialog';
|
|
4
|
+
export type DrawerSwipeDirection = "down" | "up" | "left" | "right";
|
|
5
|
+
/**
|
|
6
|
+
* # Drawer
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<Drawer swipeDirection showSwipeHandle>` (Base UI `Drawer.Root`) >
|
|
9
|
+
* `<DrawerTrigger>` + `<DrawerContent>` (Portal > Overlay + Viewport > Popup >
|
|
10
|
+
* [swipe handle] + Content > children), with `DrawerHeader/Footer/Title/
|
|
11
|
+
* Description/Close`.
|
|
12
|
+
*
|
|
13
|
+
* In pont2 the drawer is the Dialog machine (dialog.ts) docked to the edge it
|
|
14
|
+
* is swiped towards (`swipe-direction`, default `down`: a bottom drawer). The
|
|
15
|
+
* popup is the content element itself; Base UI's viewport and inner content
|
|
16
|
+
* wrappers have no counterpart.
|
|
17
|
+
*
|
|
18
|
+
* **Not yet:** dragging to dismiss, snap points and nested-drawer stacking
|
|
19
|
+
* (docs/primitives/drawer.md). Escape, the overlay, Close and the trigger
|
|
20
|
+
* close it.
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* <pont2-prim-drawer>
|
|
24
|
+
* <pont2-prim-drawer-trigger><button data-pont2-button data-variant="outline">Open</button></pont2-prim-drawer-trigger>
|
|
25
|
+
* <pont2-prim-drawer-content>
|
|
26
|
+
* <pont2-prim-drawer-header>
|
|
27
|
+
* <pont2-prim-drawer-title>Move goal</pont2-prim-drawer-title>
|
|
28
|
+
* <pont2-prim-drawer-description>Set your daily activity goal.</pont2-prim-drawer-description>
|
|
29
|
+
* </pont2-prim-drawer-header>
|
|
30
|
+
* <pont2-prim-drawer-footer>…</pont2-prim-drawer-footer>
|
|
31
|
+
* </pont2-prim-drawer-content>
|
|
32
|
+
* </pont2-prim-drawer>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @tag pont2-prim-drawer
|
|
36
|
+
* @attr open, modal
|
|
37
|
+
* @attr swipe-direction - down (default) | up | left | right: the edge the drawer is docked to
|
|
38
|
+
* @attr show-swipe-handle - shows the grab handle
|
|
39
|
+
* @fires pont2-open-change - cancelable, `{ open, reason }`
|
|
40
|
+
*/
|
|
41
|
+
export declare class Drawer extends ModalRoot {
|
|
42
|
+
static identity: string;
|
|
43
|
+
static family: string;
|
|
44
|
+
static properties: PropertyDeclarations;
|
|
45
|
+
swipeDirection: DrawerSwipeDirection;
|
|
46
|
+
showSwipeHandle: boolean;
|
|
47
|
+
constructor();
|
|
48
|
+
wire(): void;
|
|
49
|
+
}
|
|
50
|
+
/** @tag pont2-prim-drawer-trigger */
|
|
51
|
+
export declare class DrawerTrigger extends ModalTrigger {
|
|
52
|
+
static rootTag: string;
|
|
53
|
+
static controlSlot: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The drawer popup (shadcn's `drawer-popup`; its inner `drawer-content`
|
|
57
|
+
* wrapper is this same element). Carries `data-swipe-direction` and
|
|
58
|
+
* `data-swipe-axis` from the root.
|
|
59
|
+
*
|
|
60
|
+
* @tag pont2-prim-drawer-content
|
|
61
|
+
* @cssprop --pont2-drawer-bg, --pont2-drawer-fg, --pont2-drawer-border-color, --pont2-drawer-radius - see docs/11-tokens.md
|
|
62
|
+
* @cssprop --pont2-drawer-width, --pont2-drawer-max-height - left/right width (75%, 24rem from sm) and up/down height cap
|
|
63
|
+
* @cssprop --pont2-drawer-overlay-bg - the overlay colour
|
|
64
|
+
*/
|
|
65
|
+
export declare class DrawerContent extends ModalContent {
|
|
66
|
+
static identity: string;
|
|
67
|
+
static slotName: string;
|
|
68
|
+
static family: string;
|
|
69
|
+
static closeButton: boolean;
|
|
70
|
+
static properties: PropertyDeclarations;
|
|
71
|
+
swipeDirection: DrawerSwipeDirection;
|
|
72
|
+
showSwipeHandle: boolean;
|
|
73
|
+
constructor();
|
|
74
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
75
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
76
|
+
}
|
|
77
|
+
/** @tag pont2-prim-drawer-header */
|
|
78
|
+
export declare class DrawerHeader extends HostElement {
|
|
79
|
+
static identity: string;
|
|
80
|
+
static slotName: string;
|
|
81
|
+
}
|
|
82
|
+
/** @tag pont2-prim-drawer-footer */
|
|
83
|
+
export declare class DrawerFooter extends HostElement {
|
|
84
|
+
static identity: string;
|
|
85
|
+
static slotName: string;
|
|
86
|
+
}
|
|
87
|
+
/** @tag pont2-prim-drawer-title */
|
|
88
|
+
export declare class DrawerTitle extends ModalTitle {
|
|
89
|
+
static identity: string;
|
|
90
|
+
static slotName: string;
|
|
91
|
+
}
|
|
92
|
+
/** @tag pont2-prim-drawer-description */
|
|
93
|
+
export declare class DrawerDescription extends HostElement {
|
|
94
|
+
static identity: string;
|
|
95
|
+
static slotName: string;
|
|
96
|
+
}
|
|
97
|
+
/** @tag pont2-prim-drawer-close */
|
|
98
|
+
export declare class DrawerClose extends ModalClose {
|
|
99
|
+
static controlSlot: string;
|
|
100
|
+
}
|
|
101
|
+
declare global {
|
|
102
|
+
interface HTMLElementTagNameMap {
|
|
103
|
+
"pont2-prim-drawer": Drawer;
|
|
104
|
+
"pont2-prim-drawer-trigger": DrawerTrigger;
|
|
105
|
+
"pont2-prim-drawer-content": DrawerContent;
|
|
106
|
+
"pont2-prim-drawer-header": DrawerHeader;
|
|
107
|
+
"pont2-prim-drawer-footer": DrawerFooter;
|
|
108
|
+
"pont2-prim-drawer-title": DrawerTitle;
|
|
109
|
+
"pont2-prim-drawer-description": DrawerDescription;
|
|
110
|
+
"pont2-prim-drawer-close": DrawerClose;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { PopupContent } from '../../core/popup/popup-content';
|
|
3
|
+
import { PopupRoot, PopupTrigger } from '../../core/popup/popup-root';
|
|
4
|
+
type Reason = "trigger-hover" | "trigger-focus" | "focus-out";
|
|
5
|
+
/**
|
|
6
|
+
* # HoverCard (Base UI Preview Card)
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<HoverCard>` = Base UI `PreviewCard.Root` (renders nothing) >
|
|
9
|
+
* `<HoverCardTrigger>` (an `<a>`) + `<HoverCardContent>` (Portal > Positioner
|
|
10
|
+
* > Popup).
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <pont2-prim-hover-card>
|
|
14
|
+
* <pont2-prim-hover-card-trigger><a href="https://github.com/nextjs" data-pont2-button data-variant="link">@nextjs</a></pont2-prim-hover-card-trigger>
|
|
15
|
+
* <pont2-prim-hover-card-content>The React Framework – created and maintained by @vercel.</pont2-prim-hover-card-content>
|
|
16
|
+
* </pont2-prim-hover-card>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* A preview of what the trigger points at, for sighted pointer users: it
|
|
20
|
+
* opens after `delay` when the pointer rests on the trigger (or the trigger
|
|
21
|
+
* gets keyboard focus), stays open while the pointer is over the trigger or
|
|
22
|
+
* the card, and closes `close-delay` after it leaves both, on Escape, on a
|
|
23
|
+
* press outside, or when focus leaves. Like Base UI's, it is not announced
|
|
24
|
+
* and takes no focus: put nothing in it that is only there.
|
|
25
|
+
*
|
|
26
|
+
* @tag pont2-prim-hover-card
|
|
27
|
+
* @attr delay - ms before opening (default 600, Base UI's)
|
|
28
|
+
* @attr close-delay - ms before closing (default 300)
|
|
29
|
+
* @fires pont2-open-change - cancelable `{ open, reason }`
|
|
30
|
+
*/
|
|
31
|
+
export declare class HoverCard extends PopupRoot {
|
|
32
|
+
static identity: string;
|
|
33
|
+
static properties: PropertyDeclarations;
|
|
34
|
+
delay: number;
|
|
35
|
+
closeDelay: number;
|
|
36
|
+
private timer;
|
|
37
|
+
constructor();
|
|
38
|
+
get triggerElement(): HTMLElement | null;
|
|
39
|
+
get contentElement(): HoverCardContent | null;
|
|
40
|
+
protected get popupKind(): "true";
|
|
41
|
+
/** A preview card is not a popup the trigger "has": no aria-haspopup / aria-expanded (Base UI). */
|
|
42
|
+
wire(): void;
|
|
43
|
+
/** Open or close after the delay; a later call replaces a pending one. */
|
|
44
|
+
schedule(open: boolean, reason: Reason): void;
|
|
45
|
+
/** Keep the current state (the pointer moved between trigger and card). */
|
|
46
|
+
cancelScheduled(): void;
|
|
47
|
+
disconnectedCallback(): void;
|
|
48
|
+
protected afterClose(): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Tier 3 enhancer around the native `<a>` (Base UI renders a link) or `<button>`.
|
|
52
|
+
*
|
|
53
|
+
* @tag pont2-prim-hover-card-trigger
|
|
54
|
+
*/
|
|
55
|
+
export declare class HoverCardTrigger extends PopupTrigger {
|
|
56
|
+
static nativeSelector: string;
|
|
57
|
+
static rootTag: string;
|
|
58
|
+
static controlSlot: string;
|
|
59
|
+
constructor();
|
|
60
|
+
protected apply(control: HTMLButtonElement): void;
|
|
61
|
+
/** Activating the trigger follows the link; it never toggles the card (Base UI). */
|
|
62
|
+
protected onClick(): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The card. `side="bottom"`, `side-offset` 4, `align="center"`, `align-offset` 4 (shadcn).
|
|
66
|
+
*
|
|
67
|
+
* @tag pont2-prim-hover-card-content
|
|
68
|
+
* @cssprop --pont2-hover-card-bg, --pont2-hover-card-fg, --pont2-hover-card-border-color, --pont2-hover-card-radius, --pont2-hover-card-shadow - see docs/11-tokens.md
|
|
69
|
+
* @cssprop --pont2-hover-card-width, --pont2-hover-card-padding-x, --pont2-hover-card-padding-y - sizes (defaults 16rem, 1rem, 1rem)
|
|
70
|
+
*/
|
|
71
|
+
export declare class HoverCardContent extends PopupContent {
|
|
72
|
+
static identity: string;
|
|
73
|
+
static slotName: string;
|
|
74
|
+
constructor();
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
"pont2-prim-hover-card": HoverCard;
|
|
79
|
+
"pont2-prim-hover-card-trigger": HoverCardTrigger;
|
|
80
|
+
"pont2-prim-hover-card-content": HoverCardContent;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement, NativeEnhancer } from '../../core/host-element';
|
|
3
|
+
import { MessagesController } from '../../core/messages';
|
|
4
|
+
import { ButtonSize } from '../button/button';
|
|
5
|
+
/**
|
|
6
|
+
* # Pagination
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<Pagination>` (`<nav aria-label="pagination">`) > `<PaginationContent>`
|
|
9
|
+
* (`<ul>`) > `<PaginationItem>` (`<li>`) > `<PaginationLink isActive>` (a Button
|
|
10
|
+
* rendered as `<a>`), `<PaginationPrevious>`, `<PaginationNext>`,
|
|
11
|
+
* `<PaginationEllipsis>`.
|
|
12
|
+
*
|
|
13
|
+
* pont2: the nav, list and items are hosts with their native roles; links are
|
|
14
|
+
* Tier 3 enhancers around the native `<a>` (or `<button>`) you write, styled
|
|
15
|
+
* with the Button recipe.
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <pont2-prim-pagination>
|
|
19
|
+
* <pont2-prim-pagination-content>
|
|
20
|
+
* <pont2-prim-pagination-item><pont2-prim-pagination-previous><a href="?page=1">Previous</a></pont2-prim-pagination-previous></pont2-prim-pagination-item>
|
|
21
|
+
* <pont2-prim-pagination-item><pont2-prim-pagination-link><a href="?page=1">1</a></pont2-prim-pagination-link></pont2-prim-pagination-item>
|
|
22
|
+
* <pont2-prim-pagination-item><pont2-prim-pagination-link active><a href="?page=2">2</a></pont2-prim-pagination-link></pont2-prim-pagination-item>
|
|
23
|
+
* <pont2-prim-pagination-item><pont2-prim-pagination-ellipsis></pont2-prim-pagination-ellipsis></pont2-prim-pagination-item>
|
|
24
|
+
* <pont2-prim-pagination-item><pont2-prim-pagination-next><a href="?page=3">Next</a></pont2-prim-pagination-next></pont2-prim-pagination-item>
|
|
25
|
+
* </pont2-prim-pagination-content>
|
|
26
|
+
* </pont2-prim-pagination>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* For a pager driven by `page` / `page-count`, use the kit's `<pont2-pagination>`.
|
|
30
|
+
*
|
|
31
|
+
* @tag pont2-prim-pagination
|
|
32
|
+
*/
|
|
33
|
+
export declare class Pagination extends HostElement {
|
|
34
|
+
static identity: string;
|
|
35
|
+
static slotName: string;
|
|
36
|
+
static role: string;
|
|
37
|
+
protected readonly messages: MessagesController;
|
|
38
|
+
protected updated(): void;
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
}
|
|
41
|
+
/** shadcn `<ul data-slot="pagination-content">`. @tag pont2-prim-pagination-content */
|
|
42
|
+
export declare class PaginationContent extends HostElement {
|
|
43
|
+
static identity: string;
|
|
44
|
+
static slotName: string;
|
|
45
|
+
static role: string;
|
|
46
|
+
}
|
|
47
|
+
/** shadcn `<li data-slot="pagination-item">`. @tag pont2-prim-pagination-item */
|
|
48
|
+
export declare class PaginationItem extends HostElement {
|
|
49
|
+
static identity: string;
|
|
50
|
+
static slotName: string;
|
|
51
|
+
static role: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* shadcn `PaginationLink`: a Button (`ghost`, or `outline` when active) on
|
|
55
|
+
* the native `<a>` or `<button>` inside, with `aria-current="page"` and
|
|
56
|
+
* `data-active` when active.
|
|
57
|
+
*
|
|
58
|
+
* @tag pont2-prim-pagination-link
|
|
59
|
+
* @attr active - the current page (shadcn `isActive`)
|
|
60
|
+
* @attr size - Button size (default `icon`)
|
|
61
|
+
* @attr disabled
|
|
62
|
+
*/
|
|
63
|
+
export declare class PaginationLink extends NativeEnhancer<HTMLAnchorElement | HTMLButtonElement> {
|
|
64
|
+
static nativeSelector: string;
|
|
65
|
+
/** `data-slot` on the native element. */
|
|
66
|
+
static controlSlot: string;
|
|
67
|
+
static defaultSize: ButtonSize;
|
|
68
|
+
static properties: PropertyDeclarations;
|
|
69
|
+
active: boolean;
|
|
70
|
+
size: ButtonSize;
|
|
71
|
+
disabled: boolean;
|
|
72
|
+
constructor();
|
|
73
|
+
protected apply(control: HTMLAnchorElement | HTMLButtonElement): void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* shadcn `PaginationPrevious`: a default-size link labelled "Go to previous
|
|
77
|
+
* page", with a chevron before your text (drawn by CSS, so the native
|
|
78
|
+
* element's content stays yours). Wrap the text in
|
|
79
|
+
* `<span data-slot="pagination-previous-text">` to hide it below 640px, as
|
|
80
|
+
* shadcn does.
|
|
81
|
+
*
|
|
82
|
+
* @tag pont2-prim-pagination-previous
|
|
83
|
+
*/
|
|
84
|
+
export declare class PaginationPrevious extends PaginationLink {
|
|
85
|
+
static controlSlot: string;
|
|
86
|
+
static defaultSize: ButtonSize;
|
|
87
|
+
protected readonly messages: MessagesController;
|
|
88
|
+
protected apply(control: HTMLAnchorElement | HTMLButtonElement): void;
|
|
89
|
+
}
|
|
90
|
+
/** shadcn `PaginationNext`: as Previous, chevron after the text. @tag pont2-prim-pagination-next */
|
|
91
|
+
export declare class PaginationNext extends PaginationLink {
|
|
92
|
+
static controlSlot: string;
|
|
93
|
+
static defaultSize: ButtonSize;
|
|
94
|
+
protected readonly messages: MessagesController;
|
|
95
|
+
protected apply(control: HTMLAnchorElement | HTMLButtonElement): void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* shadcn `PaginationEllipsis`: `<span aria-hidden>` with a "more" icon and
|
|
99
|
+
* a screen-reader "More pages" (rendered by the host).
|
|
100
|
+
*
|
|
101
|
+
* @tag pont2-prim-pagination-ellipsis
|
|
102
|
+
*/
|
|
103
|
+
export declare class PaginationEllipsis extends HostElement {
|
|
104
|
+
static identity: string;
|
|
105
|
+
static slotName: string;
|
|
106
|
+
protected readonly messages: MessagesController;
|
|
107
|
+
connectedCallback(): void;
|
|
108
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
109
|
+
}
|
|
110
|
+
declare global {
|
|
111
|
+
interface HTMLElementTagNameMap {
|
|
112
|
+
"pont2-prim-pagination": Pagination;
|
|
113
|
+
"pont2-prim-pagination-content": PaginationContent;
|
|
114
|
+
"pont2-prim-pagination-item": PaginationItem;
|
|
115
|
+
"pont2-prim-pagination-link": PaginationLink;
|
|
116
|
+
"pont2-prim-pagination-previous": PaginationPrevious;
|
|
117
|
+
"pont2-prim-pagination-next": PaginationNext;
|
|
118
|
+
"pont2-prim-pagination-ellipsis": PaginationEllipsis;
|
|
119
|
+
}
|
|
120
|
+
}
|