@pontive/pontkit-core 1.39.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 +42864 -18238
- 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 +1322 -75
- 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 +1323 -76
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { ModalClose, ModalContent, ModalRoot, ModalTitle, ModalTrigger } from '../dialog/dialog';
|
|
4
|
+
export type SheetSide = "top" | "right" | "bottom" | "left";
|
|
5
|
+
/**
|
|
6
|
+
* # Sheet
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<Sheet>` is Base UI's `Dialog.Root` again, with a popup that
|
|
9
|
+
* slides in from one edge of the screen (`<SheetContent side>`). In pont2 it
|
|
10
|
+
* is the Dialog machine (dialog.ts: modal, inert page, scroll lock, focus
|
|
11
|
+
* trap, Escape and outside press close it) with the sheet's layout.
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <pont2-prim-sheet>
|
|
15
|
+
* <pont2-prim-sheet-trigger><button data-pont2-button data-variant="outline">Invite members</button></pont2-prim-sheet-trigger>
|
|
16
|
+
* <pont2-prim-sheet-content side="right">
|
|
17
|
+
* <pont2-prim-sheet-header>
|
|
18
|
+
* <pont2-prim-sheet-title>Invite members</pont2-prim-sheet-title>
|
|
19
|
+
* <pont2-prim-sheet-description>They get an email with a link.</pont2-prim-sheet-description>
|
|
20
|
+
* </pont2-prim-sheet-header>
|
|
21
|
+
* …
|
|
22
|
+
* <pont2-prim-sheet-footer>…</pont2-prim-sheet-footer>
|
|
23
|
+
* </pont2-prim-sheet-content>
|
|
24
|
+
* </pont2-prim-sheet>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @tag pont2-prim-sheet
|
|
28
|
+
* @attr open, modal
|
|
29
|
+
* @fires pont2-open-change - cancelable, `{ open, reason }`
|
|
30
|
+
*/
|
|
31
|
+
export declare class Sheet extends ModalRoot {
|
|
32
|
+
static identity: string;
|
|
33
|
+
static family: string;
|
|
34
|
+
}
|
|
35
|
+
/** @tag pont2-prim-sheet-trigger */
|
|
36
|
+
export declare class SheetTrigger extends ModalTrigger {
|
|
37
|
+
static rootTag: string;
|
|
38
|
+
static controlSlot: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The sliding panel.
|
|
42
|
+
*
|
|
43
|
+
* @tag pont2-prim-sheet-content
|
|
44
|
+
* @attr side - right (default) | left | top | bottom
|
|
45
|
+
* @attr show-close-button - default true
|
|
46
|
+
* @cssprop --pont2-sheet-bg, --pont2-sheet-fg, --pont2-sheet-border-color, --pont2-sheet-shadow - see docs/11-tokens.md
|
|
47
|
+
* @cssprop --pont2-sheet-width, --pont2-sheet-max-width - left/right sheets (defaults 75%, 24rem)
|
|
48
|
+
* @cssprop --pont2-sheet-overlay-bg - the overlay colour
|
|
49
|
+
*/
|
|
50
|
+
export declare class SheetContent extends ModalContent {
|
|
51
|
+
static identity: string;
|
|
52
|
+
static slotName: string;
|
|
53
|
+
static family: string;
|
|
54
|
+
constructor();
|
|
55
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
56
|
+
}
|
|
57
|
+
/** @tag pont2-prim-sheet-header */
|
|
58
|
+
export declare class SheetHeader extends HostElement {
|
|
59
|
+
static identity: string;
|
|
60
|
+
static slotName: string;
|
|
61
|
+
}
|
|
62
|
+
/** @tag pont2-prim-sheet-footer */
|
|
63
|
+
export declare class SheetFooter extends HostElement {
|
|
64
|
+
static identity: string;
|
|
65
|
+
static slotName: string;
|
|
66
|
+
}
|
|
67
|
+
/** @tag pont2-prim-sheet-title */
|
|
68
|
+
export declare class SheetTitle extends ModalTitle {
|
|
69
|
+
static identity: string;
|
|
70
|
+
static slotName: string;
|
|
71
|
+
}
|
|
72
|
+
/** @tag pont2-prim-sheet-description */
|
|
73
|
+
export declare class SheetDescription extends HostElement {
|
|
74
|
+
static identity: string;
|
|
75
|
+
static slotName: string;
|
|
76
|
+
}
|
|
77
|
+
/** @tag pont2-prim-sheet-close */
|
|
78
|
+
export declare class SheetClose extends ModalClose {
|
|
79
|
+
static controlSlot: string;
|
|
80
|
+
}
|
|
81
|
+
declare global {
|
|
82
|
+
interface HTMLElementTagNameMap {
|
|
83
|
+
"pont2-prim-sheet": Sheet;
|
|
84
|
+
"pont2-prim-sheet-trigger": SheetTrigger;
|
|
85
|
+
"pont2-prim-sheet-content": SheetContent;
|
|
86
|
+
"pont2-prim-sheet-header": SheetHeader;
|
|
87
|
+
"pont2-prim-sheet-footer": SheetFooter;
|
|
88
|
+
"pont2-prim-sheet-title": SheetTitle;
|
|
89
|
+
"pont2-prim-sheet-description": SheetDescription;
|
|
90
|
+
"pont2-prim-sheet-close": SheetClose;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PropertyDeclarations, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { MessagesController } from '../../core/messages';
|
|
4
|
+
import { ToastData } from './toast-store';
|
|
5
|
+
export { toast, toasts, ToastStore, type ToastAction, type ToastData, type ToastOptions, type ToastType } from './toast-store';
|
|
6
|
+
export type ToasterPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
7
|
+
/**
|
|
8
|
+
* # Toaster (shadcn's Sonner)
|
|
9
|
+
*
|
|
10
|
+
* shadcn: `<Toaster />` (`components/ui/sonner.tsx`, Sonner themed with the
|
|
11
|
+
* popover colours and lucide icons) + `toast()` from `sonner`.
|
|
12
|
+
*
|
|
13
|
+
* pont2: `<pont2-prim-toaster>` once per page, and `toast()` exported from
|
|
14
|
+
* pont2 (toast-store.ts), with Sonner's API:
|
|
15
|
+
*
|
|
16
|
+
* ```html
|
|
17
|
+
* <pont2-prim-toaster></pont2-prim-toaster>
|
|
18
|
+
* <script type="module">
|
|
19
|
+
* import { toast } from "@pontive/pontkit-core/pont2";
|
|
20
|
+
* toast.success("Invitation sent", { description: "ann@example.com" });
|
|
21
|
+
* const id = toast.loading("Saving…"); toast.success("Saved", { id });
|
|
22
|
+
* toast.error("We couldn't remove this member.", { action: { label: "Retry", onClick: retry } });
|
|
23
|
+
* </script>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The host **is** Sonner's `<section aria-label="Notifications alt+T">`
|
|
27
|
+
* (`role=region`), holding the `<ol>` of toasts. It shows itself in the top
|
|
28
|
+
* layer (Popover API) while it has toasts, so toasts sit above dialogs, and
|
|
29
|
+
* a modal dialog leaves it interactive (core/popup/modal.ts exempts it).
|
|
30
|
+
*
|
|
31
|
+
* - Toasts close after `duration` (loading toasts stay until updated);
|
|
32
|
+
* hovering or focusing the toaster pauses every timer, as does a hidden tab.
|
|
33
|
+
* - Alt+T moves focus to the toaster (Sonner's hotkey); Escape there
|
|
34
|
+
* dismisses the focused toast.
|
|
35
|
+
* - Toasts are announced politely (`aria-live="polite"` on the list).
|
|
36
|
+
* - The newest `visible-toasts` (default 3) show.
|
|
37
|
+
*
|
|
38
|
+
* Not yet: Sonner's collapsed stack (toasts here are always listed, Sonner's
|
|
39
|
+
* `expand`), swipe to dismiss, `richColors`, custom JSX toasts.
|
|
40
|
+
*
|
|
41
|
+
* @tag pont2-prim-toaster
|
|
42
|
+
* @attr position - bottom-right (default) | bottom-left | bottom-center | top-right | top-left | top-center
|
|
43
|
+
* @attr duration - ms before a toast closes itself (default 4000)
|
|
44
|
+
* @attr visible-toasts - how many show at once (default 3)
|
|
45
|
+
* @attr close-button - show the × button on every toast
|
|
46
|
+
* @cssprop --pont2-toast-bg, --pont2-toast-fg, --pont2-toast-border-color, --pont2-toast-radius, --pont2-toast-shadow, --pont2-toast-width - see docs/11-tokens.md
|
|
47
|
+
*/
|
|
48
|
+
export declare class Toaster extends HostElement {
|
|
49
|
+
static identity: string;
|
|
50
|
+
static slotName: string;
|
|
51
|
+
static role: string;
|
|
52
|
+
static properties: PropertyDeclarations;
|
|
53
|
+
position: ToasterPosition;
|
|
54
|
+
duration: number;
|
|
55
|
+
visibleToasts: number;
|
|
56
|
+
closeButton: boolean;
|
|
57
|
+
protected items: readonly ToastData[];
|
|
58
|
+
protected readonly messages: MessagesController;
|
|
59
|
+
private unsubscribe?;
|
|
60
|
+
/** Per toast: the timer, when it started and how long was left. */
|
|
61
|
+
private timers;
|
|
62
|
+
private removing;
|
|
63
|
+
private paused;
|
|
64
|
+
private hovered;
|
|
65
|
+
private focusedWithin;
|
|
66
|
+
constructor();
|
|
67
|
+
connectedCallback(): void;
|
|
68
|
+
disconnectedCallback(): void;
|
|
69
|
+
private onHotkey;
|
|
70
|
+
private onVisibility;
|
|
71
|
+
private syncPause;
|
|
72
|
+
private durationOf;
|
|
73
|
+
private startTimer;
|
|
74
|
+
private dismiss;
|
|
75
|
+
/** The toasts shown: the newest `visible-toasts`, not counting those already leaving. */
|
|
76
|
+
get shown(): ToastData[];
|
|
77
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
78
|
+
protected updated(changed: PropertyValues): void;
|
|
79
|
+
private renderToast;
|
|
80
|
+
render(): TemplateResult<1>;
|
|
81
|
+
}
|
|
82
|
+
declare global {
|
|
83
|
+
interface HTMLElementTagNameMap {
|
|
84
|
+
"pont2-prim-toaster": Toaster;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # The toast queue behind `toast()` (Sonner's `toast` function)
|
|
3
|
+
*
|
|
4
|
+
* Page-wide, like Sonner's: `toast("Saved")` anywhere reaches every mounted
|
|
5
|
+
* `<pont2-prim-toaster>`. The queue holds data only (no DOM, no timers), so it
|
|
6
|
+
* is unit-tested (toast-store.test.ts); the toaster renders it and runs the
|
|
7
|
+
* auto-dismiss timers.
|
|
8
|
+
*/
|
|
9
|
+
export type ToastType = "default" | "success" | "info" | "warning" | "error" | "loading";
|
|
10
|
+
export interface ToastAction {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: (event: MouseEvent) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface ToastOptions {
|
|
15
|
+
/** Reuse an id to update a toast in place (e.g. loading → success). */
|
|
16
|
+
id?: string | number;
|
|
17
|
+
description?: string;
|
|
18
|
+
type?: ToastType;
|
|
19
|
+
/** ms before it closes itself; `Infinity` keeps it. Default: the toaster's `duration` (loading: Infinity). */
|
|
20
|
+
duration?: number;
|
|
21
|
+
/** A button in the toast; pressing it runs `onClick` and closes the toast unless the handler calls `preventDefault()`. */
|
|
22
|
+
action?: ToastAction;
|
|
23
|
+
/** A secondary, outline button that closes the toast. */
|
|
24
|
+
cancel?: ToastAction;
|
|
25
|
+
/** Show the × button on this toast (also a toaster-wide attribute). */
|
|
26
|
+
closeButton?: boolean;
|
|
27
|
+
/** Whether a press of × or a timeout may close it (default true). */
|
|
28
|
+
dismissible?: boolean;
|
|
29
|
+
onDismiss?: (toast: ToastData) => void;
|
|
30
|
+
onAutoClose?: (toast: ToastData) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface ToastData extends ToastOptions {
|
|
33
|
+
id: string | number;
|
|
34
|
+
title: string;
|
|
35
|
+
type: ToastType;
|
|
36
|
+
/** Set when the toast is leaving (its exit animation runs before it is removed). */
|
|
37
|
+
dismissed?: boolean;
|
|
38
|
+
/** Increases on every update, so a toaster restarts the timer. */
|
|
39
|
+
version: number;
|
|
40
|
+
createdAt: number;
|
|
41
|
+
}
|
|
42
|
+
type Listener = (toasts: readonly ToastData[]) => void;
|
|
43
|
+
export declare class ToastStore {
|
|
44
|
+
private toasts;
|
|
45
|
+
private listeners;
|
|
46
|
+
private counter;
|
|
47
|
+
get all(): readonly ToastData[];
|
|
48
|
+
subscribe(listener: Listener): () => void;
|
|
49
|
+
private emit;
|
|
50
|
+
/** Adds a toast, or updates the one with the same `id`. Returns the id. */
|
|
51
|
+
add(title: string, options?: ToastOptions): string | number;
|
|
52
|
+
/** Starts closing one toast (or all): it is marked `dismissed`, then `remove()`d by the toaster. */
|
|
53
|
+
dismiss(id?: string | number): void;
|
|
54
|
+
/** Drops a toast for good (after its exit animation). */
|
|
55
|
+
remove(id: string | number): void;
|
|
56
|
+
/** Forgets every toast. For tests and stories. */
|
|
57
|
+
clear(): void;
|
|
58
|
+
}
|
|
59
|
+
/** The page's queue. */
|
|
60
|
+
export declare const toasts: ToastStore;
|
|
61
|
+
type Typed = (title: string, options?: Omit<ToastOptions, "type">) => string | number;
|
|
62
|
+
/**
|
|
63
|
+
* Sonner's `toast()`: `toast("Event created")`, `toast.success(…)`,
|
|
64
|
+
* `toast.error(…)`, `toast.info(…)`, `toast.warning(…)`, `toast.loading(…)`,
|
|
65
|
+
* `toast.dismiss(id?)`, `toast.promise(p, { loading, success, error })`.
|
|
66
|
+
*/
|
|
67
|
+
export declare const toast: ((title: string, options?: ToastOptions) => string | number) & {
|
|
68
|
+
success: Typed;
|
|
69
|
+
info: Typed;
|
|
70
|
+
warning: Typed;
|
|
71
|
+
error: Typed;
|
|
72
|
+
loading: Typed;
|
|
73
|
+
dismiss: (id?: string | number) => void;
|
|
74
|
+
/** One toast that says "loading", then success or error, as Sonner's `toast.promise`. */
|
|
75
|
+
promise<T>(promise: Promise<T>, messages: {
|
|
76
|
+
loading: string;
|
|
77
|
+
success: string | ((value: T) => string);
|
|
78
|
+
error: string | ((error: unknown) => string);
|
|
79
|
+
}, options?: Omit<ToastOptions, "type" | "id">): string | number;
|
|
80
|
+
};
|
|
81
|
+
export {};
|