@pontive/pontkit-core 1.39.0 → 1.41.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 +1846 -1289
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17059 -12690
- 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/format.d.ts +46 -0
- package/dist/pont2/core/icons.d.ts +11 -0
- package/dist/pont2/core/index.d.ts +2 -0
- package/dist/pont2/core/messages.d.ts +128 -2
- 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 +55405 -24958
- package/dist/pont2/index.d.ts +7 -0
- package/dist/pont2/index.mjs +6600 -2376
- package/dist/pont2/index.mjs.map +1 -1
- package/dist/pont2/kit/account-menu/account-menu.d.ts +115 -0
- package/dist/pont2/kit/account-settings/account-settings.d.ts +157 -0
- package/dist/pont2/kit/account-settings/profile.d.ts +74 -0
- 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 +11 -0
- package/dist/pont2/kit/layout/layout.d.ts +7 -0
- package/dist/pont2/kit/member-management/errors.d.ts +60 -0
- package/dist/pont2/kit/member-management/member-management.d.ts +237 -0
- package/dist/pont2/kit/member-management/roles.d.ts +42 -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/organization-switcher/organization-switcher.d.ts +111 -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/account-client.d.ts +355 -0
- package/dist/pont2/kit/provider/account-controller.d.ts +47 -0
- package/dist/pont2/kit/provider/account-user.d.ts +16 -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 +219 -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 +100 -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 +2489 -760
- package/dist/pont2/theme/tokens.json.d.ts +700 -1
- package/dist/pont2/theme-golden.json +45 -45
- package/dist/pont2/theme.mjs +119 -119
- package/dist/pont2/tokens.json +700 -1
- package/dist/styles.css +2475 -746
- package/package.json +2 -2
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { Pont2Button } from '../button/button';
|
|
4
|
+
import { ModalContent, ModalRoot, ModalTitle, ModalTrigger } from '../dialog/dialog';
|
|
5
|
+
/**
|
|
6
|
+
* # AlertDialog
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<AlertDialog>` (Base UI `AlertDialog.Root`) > `<AlertDialogTrigger>`
|
|
9
|
+
* + `<AlertDialogContent size>` (Portal > Overlay + Popup) with
|
|
10
|
+
* `AlertDialogHeader/Media/Title/Description/Footer/Action/Cancel`.
|
|
11
|
+
*
|
|
12
|
+
* A Dialog (dialog.ts) that interrupts: `role=alertdialog`, always modal, and
|
|
13
|
+
* **a press outside does not close it** (Base UI). Escape and Cancel do.
|
|
14
|
+
* `AlertDialogAction` is a plain button (shadcn's is a `<Button>`, not a
|
|
15
|
+
* Close): the app decides when the dialog closes, so an action that can fail
|
|
16
|
+
* keeps the dialog open to show the error.
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <pont2-prim-alert-dialog>
|
|
20
|
+
* <pont2-prim-alert-dialog-trigger><button data-pont2-button data-variant="outline">Remove member</button></pont2-prim-alert-dialog-trigger>
|
|
21
|
+
* <pont2-prim-alert-dialog-content>
|
|
22
|
+
* <pont2-prim-alert-dialog-header>
|
|
23
|
+
* <pont2-prim-alert-dialog-title>Remove this member?</pont2-prim-alert-dialog-title>
|
|
24
|
+
* <pont2-prim-alert-dialog-description>They lose access immediately.</pont2-prim-alert-dialog-description>
|
|
25
|
+
* </pont2-prim-alert-dialog-header>
|
|
26
|
+
* <pont2-prim-alert-dialog-footer>
|
|
27
|
+
* <pont2-prim-alert-dialog-cancel><button>Cancel</button></pont2-prim-alert-dialog-cancel>
|
|
28
|
+
* <pont2-prim-alert-dialog-action variant="destructive"><button>Remove</button></pont2-prim-alert-dialog-action>
|
|
29
|
+
* </pont2-prim-alert-dialog-footer>
|
|
30
|
+
* </pont2-prim-alert-dialog-content>
|
|
31
|
+
* </pont2-prim-alert-dialog>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @tag pont2-prim-alert-dialog
|
|
35
|
+
* @attr open
|
|
36
|
+
* @fires pont2-open-change - cancelable, `{ open, reason }`
|
|
37
|
+
*/
|
|
38
|
+
export declare class AlertDialog extends ModalRoot {
|
|
39
|
+
static identity: string;
|
|
40
|
+
static family: string;
|
|
41
|
+
constructor();
|
|
42
|
+
protected get dismissOnOutsidePress(): boolean;
|
|
43
|
+
/** An alert dialog is always modal (Base UI has no `modal` prop on it). */
|
|
44
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
45
|
+
}
|
|
46
|
+
/** @tag pont2-prim-alert-dialog-trigger */
|
|
47
|
+
export declare class AlertDialogTrigger extends ModalTrigger {
|
|
48
|
+
static rootTag: string;
|
|
49
|
+
static controlSlot: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The popup (`role=alertdialog`), no corner close button.
|
|
53
|
+
*
|
|
54
|
+
* @tag pont2-prim-alert-dialog-content
|
|
55
|
+
* @attr size - default | sm
|
|
56
|
+
* @cssprop --pont2-alert-dialog-bg, --pont2-alert-dialog-fg, --pont2-alert-dialog-border-color, --pont2-alert-dialog-radius - see docs/11-tokens.md
|
|
57
|
+
* @cssprop --pont2-alert-dialog-max-width, --pont2-alert-dialog-sm-max-width, --pont2-alert-dialog-padding-x, --pont2-alert-dialog-padding-y, --pont2-alert-dialog-gap - sizes
|
|
58
|
+
* @cssprop --pont2-alert-dialog-overlay-bg - the overlay colour
|
|
59
|
+
*/
|
|
60
|
+
export declare class AlertDialogContent extends ModalContent {
|
|
61
|
+
static identity: string;
|
|
62
|
+
static slotName: string;
|
|
63
|
+
static role: string;
|
|
64
|
+
static family: string;
|
|
65
|
+
static closeButton: boolean;
|
|
66
|
+
static properties: PropertyDeclarations;
|
|
67
|
+
size: "default" | "sm";
|
|
68
|
+
constructor();
|
|
69
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
70
|
+
}
|
|
71
|
+
/** @tag pont2-prim-alert-dialog-header */
|
|
72
|
+
export declare class AlertDialogHeader extends HostElement {
|
|
73
|
+
static identity: string;
|
|
74
|
+
static slotName: string;
|
|
75
|
+
}
|
|
76
|
+
/** @tag pont2-prim-alert-dialog-footer */
|
|
77
|
+
export declare class AlertDialogFooter extends HostElement {
|
|
78
|
+
static identity: string;
|
|
79
|
+
static slotName: string;
|
|
80
|
+
}
|
|
81
|
+
/** An icon tile beside (default size) or above (sm) the title. @tag pont2-prim-alert-dialog-media */
|
|
82
|
+
export declare class AlertDialogMedia extends HostElement {
|
|
83
|
+
static identity: string;
|
|
84
|
+
static slotName: string;
|
|
85
|
+
}
|
|
86
|
+
/** @tag pont2-prim-alert-dialog-title */
|
|
87
|
+
export declare class AlertDialogTitle extends ModalTitle {
|
|
88
|
+
static identity: string;
|
|
89
|
+
static slotName: string;
|
|
90
|
+
}
|
|
91
|
+
/** @tag pont2-prim-alert-dialog-description */
|
|
92
|
+
export declare class AlertDialogDescription extends HostElement {
|
|
93
|
+
static identity: string;
|
|
94
|
+
static slotName: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* shadcn `AlertDialogAction`: a Button (the button enhancer, so `variant` and
|
|
98
|
+
* `size` work) that does **not** close the dialog by itself. Listen for
|
|
99
|
+
* `click`, do the work, then set `open = false`.
|
|
100
|
+
*
|
|
101
|
+
* @tag pont2-prim-alert-dialog-action
|
|
102
|
+
* @attr variant, size, disabled - the Button's
|
|
103
|
+
*/
|
|
104
|
+
export declare class AlertDialogAction extends Pont2Button {
|
|
105
|
+
protected apply(control: HTMLButtonElement | HTMLAnchorElement): void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* shadcn `AlertDialogCancel`: Base UI `AlertDialog.Close` rendered as an
|
|
109
|
+
* outline Button. Closes the dialog (`reason: "close-press"`).
|
|
110
|
+
*
|
|
111
|
+
* @tag pont2-prim-alert-dialog-cancel
|
|
112
|
+
* @attr variant - default outline
|
|
113
|
+
* @attr size
|
|
114
|
+
*/
|
|
115
|
+
export declare class AlertDialogCancel extends Pont2Button {
|
|
116
|
+
constructor();
|
|
117
|
+
protected apply(control: HTMLButtonElement | HTMLAnchorElement): void;
|
|
118
|
+
}
|
|
119
|
+
declare global {
|
|
120
|
+
interface HTMLElementTagNameMap {
|
|
121
|
+
"pont2-prim-alert-dialog": AlertDialog;
|
|
122
|
+
"pont2-prim-alert-dialog-trigger": AlertDialogTrigger;
|
|
123
|
+
"pont2-prim-alert-dialog-content": AlertDialogContent;
|
|
124
|
+
"pont2-prim-alert-dialog-header": AlertDialogHeader;
|
|
125
|
+
"pont2-prim-alert-dialog-footer": AlertDialogFooter;
|
|
126
|
+
"pont2-prim-alert-dialog-media": AlertDialogMedia;
|
|
127
|
+
"pont2-prim-alert-dialog-title": AlertDialogTitle;
|
|
128
|
+
"pont2-prim-alert-dialog-description": AlertDialogDescription;
|
|
129
|
+
"pont2-prim-alert-dialog-action": AlertDialogAction;
|
|
130
|
+
"pont2-prim-alert-dialog-cancel": AlertDialogCancel;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -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
|
+
}
|