@pontive/pontkit-core 1.26.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/pont2/core/attrs.d.ts +22 -0
- package/dist/pont2/core/controllers/action.d.ts +79 -0
- package/dist/pont2/core/controllers/copy.d.ts +34 -0
- package/dist/pont2/core/controllers/roving-focus.d.ts +38 -0
- package/dist/pont2/core/events.d.ts +28 -0
- package/dist/pont2/core/form-control.d.ts +70 -0
- package/dist/pont2/core/host-element.d.ts +129 -0
- package/dist/pont2/core/icons.d.ts +28 -0
- package/dist/pont2/core/ids.d.ts +6 -0
- package/dist/pont2/core/index.d.ts +10 -0
- package/dist/pont2/core/names.d.ts +78 -0
- package/dist/pont2/core/popup/anchored.d.ts +48 -0
- package/dist/pont2/core/popup/index.d.ts +5 -0
- package/dist/pont2/core/popup/list.d.ts +38 -0
- package/dist/pont2/core/popup/popup-content.d.ts +68 -0
- package/dist/pont2/core/popup/popup-root.d.ts +94 -0
- package/dist/pont2/core/popup/position.d.ts +73 -0
- package/dist/pont2/globals.css +109 -0
- package/dist/pont2/index.d.ts +44 -0
- package/dist/pont2/index.mjs +5660 -0
- package/dist/pont2/index.mjs.map +1 -0
- package/dist/pont2/kit/alert/alert.d.ts +62 -0
- package/dist/pont2/kit/aliases.d.ts +33 -0
- package/dist/pont2/kit/auth-button/auth-button.d.ts +185 -0
- package/dist/pont2/kit/auth-button/providers.d.ts +15 -0
- package/dist/pont2/kit/auth-field/auth-field.d.ts +267 -0
- package/dist/pont2/kit/auth-field/password-field.d.ts +124 -0
- package/dist/pont2/kit/avatar/avatar.d.ts +52 -0
- package/dist/pont2/kit/block/block.d.ts +64 -0
- package/dist/pont2/kit/block/branding.d.ts +36 -0
- package/dist/pont2/kit/container/container.d.ts +40 -0
- package/dist/pont2/kit/countdown/countdown.d.ts +64 -0
- package/dist/pont2/kit/divider/divider.d.ts +30 -0
- package/dist/pont2/kit/edit-identifier/edit-identifier.d.ts +47 -0
- package/dist/pont2/kit/flow-widget/flow-widget.d.ts +151 -0
- package/dist/pont2/kit/gap/gap.d.ts +36 -0
- package/dist/pont2/kit/header/header.d.ts +37 -0
- package/dist/pont2/kit/index.d.ts +26 -0
- package/dist/pont2/kit/input-otp/input-otp.d.ts +59 -0
- package/dist/pont2/kit/layout/flow-error.d.ts +21 -0
- package/dist/pont2/kit/layout/layout.d.ts +120 -0
- package/dist/pont2/kit/link/link.d.ts +62 -0
- package/dist/pont2/kit/logo/logo.d.ts +57 -0
- package/dist/pont2/kit/otp-field/otp-field.d.ts +93 -0
- package/dist/pont2/kit/otp-field/otp-resend.d.ts +61 -0
- package/dist/pont2/kit/provider-field/provider-field.d.ts +87 -0
- package/dist/pont2/kit/qr-code/qr-code.d.ts +86 -0
- package/dist/pont2/kit/recovery-codes/recovery-codes.d.ts +64 -0
- package/dist/pont2/kit/scope-list/scope-list.d.ts +69 -0
- package/dist/pont2/kit/scope-list/scope-value.d.ts +16 -0
- package/dist/pont2/kit/secret/secret.d.ts +67 -0
- package/dist/pont2/kit/story-helpers.d.ts +9 -0
- package/dist/pont2/kit/typography/typography.d.ts +70 -0
- package/dist/pont2/kit/watermark/pontive-logo.d.ts +8 -0
- package/dist/pont2/kit/watermark/watermark.d.ts +42 -0
- package/dist/pont2/primitives/alert/alert.d.ts +49 -0
- package/dist/pont2/primitives/avatar/avatar.d.ts +89 -0
- package/dist/pont2/primitives/badge/badge.d.ts +30 -0
- package/dist/pont2/primitives/button/button.d.ts +113 -0
- package/dist/pont2/primitives/button-group/button-group.d.ts +55 -0
- package/dist/pont2/primitives/card/card.d.ts +63 -0
- package/dist/pont2/primitives/checkbox/checkbox.d.ts +54 -0
- package/dist/pont2/primitives/combobox/combobox.d.ts +213 -0
- package/dist/pont2/primitives/dropdown-menu/dropdown-menu.d.ts +267 -0
- package/dist/pont2/primitives/empty/empty.d.ts +60 -0
- package/dist/pont2/primitives/field/field.d.ts +146 -0
- package/dist/pont2/primitives/input/input.d.ts +47 -0
- package/dist/pont2/primitives/input-group/input-group.d.ts +97 -0
- package/dist/pont2/primitives/input-otp/input-otp.d.ts +121 -0
- package/dist/pont2/primitives/input-otp/otp.d.ts +22 -0
- package/dist/pont2/primitives/item/item.d.ts +100 -0
- package/dist/pont2/primitives/kbd/kbd.d.ts +29 -0
- package/dist/pont2/primitives/label/label.d.ts +37 -0
- package/dist/pont2/primitives/native-select/native-select.d.ts +59 -0
- package/dist/pont2/primitives/popover/popover.d.ts +85 -0
- package/dist/pont2/primitives/progress/progress.d.ts +80 -0
- package/dist/pont2/primitives/radio-group/radio-group.d.ts +93 -0
- package/dist/pont2/primitives/select/select.d.ts +184 -0
- package/dist/pont2/primitives/separator/separator.d.ts +34 -0
- package/dist/pont2/primitives/skeleton/skeleton.d.ts +18 -0
- package/dist/pont2/primitives/slider/slider-math.d.ts +42 -0
- package/dist/pont2/primitives/slider/slider.d.ts +85 -0
- package/dist/pont2/primitives/spinner/spinner.d.ts +29 -0
- package/dist/pont2/primitives/switch/switch.d.ts +55 -0
- package/dist/pont2/primitives/table/table.d.ts +55 -0
- package/dist/pont2/primitives/tabs/tabs.d.ts +126 -0
- package/dist/pont2/primitives/textarea/textarea.d.ts +41 -0
- package/dist/pont2/primitives/tooltip/tooltip.d.ts +69 -0
- package/dist/pont2/styles.css +4839 -0
- package/dist/pont2/with-legacy.css +10 -0
- package/package.json +16 -4
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type QrErrorCorrection = "L" | "M" | "Q" | "H";
|
|
4
|
+
/**
|
|
5
|
+
* One SVG path covering every dark module of `text`'s QR code, plus the
|
|
6
|
+
* code's size. `null` when the text cannot be encoded.
|
|
7
|
+
*/
|
|
8
|
+
export declare function qrPath(text: string, level: QrErrorCorrection): {
|
|
9
|
+
d: string;
|
|
10
|
+
size: number;
|
|
11
|
+
} | null;
|
|
12
|
+
export interface QrDetail {
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* # `<pont2-qr-code>`: the authenticator-app enrolment QR code
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <pont2-qr-code url="otpauth://totp/Acme:ada@example.com?secret=…&issuer=Acme" timeout="30"></pont2-qr-code>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* <pont2-qr-code data-pont2-qr-code data-slot="qr-code" [data-obscured]>
|
|
24
|
+
* <svg data-slot="qr-code-image" role="img" aria-label="QR code" viewBox="0 0 37 37">
|
|
25
|
+
* <rect …white…/><path d="M4 4h1v1h-1z…"/>
|
|
26
|
+
* </svg>
|
|
27
|
+
* <div data-slot="qr-code-overlay"> (when obscured)
|
|
28
|
+
* <button data-pont2-button type="button">Show QR code</button>
|
|
29
|
+
* </div>
|
|
30
|
+
* </pont2-qr-code>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* **An SVG built from the code's modules** (`qrcode`'s `create()` matrix →
|
|
34
|
+
* one `<path>`), not a canvas: crisp at any size and zoom, no pixel-ratio
|
|
35
|
+
* maths, nothing injected as markup. Always dark-on-white with the
|
|
36
|
+
* 4-module quiet zone, whatever the theme: inverted codes do not scan
|
|
37
|
+
* everywhere.
|
|
38
|
+
*
|
|
39
|
+
* **Obscured after `timeout` seconds** (it encodes the TOTP secret): the
|
|
40
|
+
* code fades and a "Show QR code" button brings it back for another
|
|
41
|
+
* `timeout`. `timeout="0"` never obscures.
|
|
42
|
+
*
|
|
43
|
+
* @tag pont2-qr-code
|
|
44
|
+
* @attr url - the text to encode (an `otpauth://` URI)
|
|
45
|
+
* @attr timeout - seconds before obscuring (default 10)
|
|
46
|
+
* @attr error-correction - L | M (default) | Q | H
|
|
47
|
+
* @attr label - accessible name of the image (default "QR code")
|
|
48
|
+
* @attr reveal-label - the button text (default "Show QR code")
|
|
49
|
+
* @attr disabled - never obscures, and disables the button
|
|
50
|
+
* @fires pont2-qr-obscured, pont2-qr-revealed - `{ url }`
|
|
51
|
+
* @fires pont2-qr-error - `{ url }` when the text cannot be encoded
|
|
52
|
+
*/
|
|
53
|
+
export declare class QrCode extends HostElement {
|
|
54
|
+
static identity: string;
|
|
55
|
+
static slotName: string;
|
|
56
|
+
static composite: boolean;
|
|
57
|
+
static properties: PropertyDeclarations;
|
|
58
|
+
url: string;
|
|
59
|
+
timeout: number;
|
|
60
|
+
errorCorrection: QrErrorCorrection;
|
|
61
|
+
label: string;
|
|
62
|
+
revealLabel: string;
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
obscured: boolean;
|
|
65
|
+
private timer;
|
|
66
|
+
private path;
|
|
67
|
+
constructor();
|
|
68
|
+
/** Shows the code again and restarts the timeout. */
|
|
69
|
+
reveal(): void;
|
|
70
|
+
private startTimer;
|
|
71
|
+
connectedCallback(): void;
|
|
72
|
+
disconnectedCallback(): void;
|
|
73
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
74
|
+
private onReveal;
|
|
75
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
76
|
+
}
|
|
77
|
+
declare global {
|
|
78
|
+
interface HTMLElementTagNameMap {
|
|
79
|
+
"pont2-qr-code": QrCode;
|
|
80
|
+
}
|
|
81
|
+
interface HTMLElementEventMap {
|
|
82
|
+
"pont2-qr-obscured": CustomEvent<QrDetail>;
|
|
83
|
+
"pont2-qr-revealed": CustomEvent<QrDetail>;
|
|
84
|
+
"pont2-qr-error": CustomEvent<QrDetail>;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { CopyController } from '../../core/controllers/copy';
|
|
3
|
+
import { HostElement } from '../../core/host-element';
|
|
4
|
+
/**
|
|
5
|
+
* # `<pont2-recovery-codes>`: one-time recovery codes after MFA enrolment
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <pont2-recovery-codes codes='["a1b2-c3d4","e5f6-g7h8"]'></pont2-recovery-codes>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <pont2-recovery-codes data-pont2-recovery-codes data-slot="recovery-codes">
|
|
13
|
+
* <p data-slot="recovery-codes-title">Recovery codes</p>
|
|
14
|
+
* <p data-slot="recovery-codes-description">Use these codes if you lose access…</p>
|
|
15
|
+
* <ul data-slot="recovery-codes-list"><li>a1b2-c3d4</li>…</ul>
|
|
16
|
+
* <div data-slot="recovery-codes-actions">
|
|
17
|
+
* <button data-pont2-button data-variant="outline">Copy codes</button>
|
|
18
|
+
* <button data-pont2-button data-variant="outline">Download codes</button>
|
|
19
|
+
* </div>
|
|
20
|
+
* <span data-slot="recovery-codes-copied" role="status">Copied!</span>
|
|
21
|
+
* </pont2-recovery-codes>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Buttons are the button primitive's parts, the list is a monospace grid,
|
|
25
|
+
* "Copied!" is announced (`role="status"`). Events carry **no codes**
|
|
26
|
+
* (`pont2-copied` / `pont2-copy-error` with `{ kind: "recovery-codes" }`,
|
|
27
|
+
* `pont2-recovery-codes-downloaded`); the legacy events included them.
|
|
28
|
+
*
|
|
29
|
+
* @tag pont2-recovery-codes
|
|
30
|
+
* @attr codes - JSON array or whitespace-separated list; `.codes` is an array
|
|
31
|
+
* @attr title-text, description, empty-text, copy-label, download-label, copied-text - copy
|
|
32
|
+
* @attr filename - download file name (default "recovery-codes.txt")
|
|
33
|
+
* @attr disabled
|
|
34
|
+
* @fires pont2-copied, pont2-copy-error, pont2-recovery-codes-downloaded
|
|
35
|
+
*/
|
|
36
|
+
export declare class RecoveryCodes extends HostElement {
|
|
37
|
+
static identity: string;
|
|
38
|
+
static slotName: string;
|
|
39
|
+
static composite: boolean;
|
|
40
|
+
static properties: PropertyDeclarations;
|
|
41
|
+
codes: string[];
|
|
42
|
+
titleText: string;
|
|
43
|
+
description: string;
|
|
44
|
+
emptyText: string;
|
|
45
|
+
copyLabel: string;
|
|
46
|
+
downloadLabel: string;
|
|
47
|
+
copiedText: string;
|
|
48
|
+
filename: string;
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
protected readonly clipboard: CopyController;
|
|
51
|
+
constructor();
|
|
52
|
+
private get text();
|
|
53
|
+
copy(): Promise<boolean>;
|
|
54
|
+
download(): void;
|
|
55
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
56
|
+
}
|
|
57
|
+
declare global {
|
|
58
|
+
interface HTMLElementTagNameMap {
|
|
59
|
+
"pont2-recovery-codes": RecoveryCodes;
|
|
60
|
+
}
|
|
61
|
+
interface HTMLElementEventMap {
|
|
62
|
+
"pont2-recovery-codes-downloaded": CustomEvent<Record<string, never>>;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { FormControlElement } from '../../core/form-control';
|
|
3
|
+
import { ConsentScope } from './scope-value';
|
|
4
|
+
export { isScopeChecked, normalizeScopes, scopeListValue, type ConsentScope } from './scope-value';
|
|
5
|
+
/**
|
|
6
|
+
* # `<pont2-scope-list>`: OAuth consent scopes
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <form>
|
|
10
|
+
* <pont2-scope-list name="scope"
|
|
11
|
+
* scopes='[{"scope":"openid","label":"Sign you in","required":true},{"scope":"email","label":"See your email"}]'>
|
|
12
|
+
* </pont2-scope-list>
|
|
13
|
+
* </form>
|
|
14
|
+
* → FormData: scope=openid email
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <pont2-scope-list data-pont2-scope-list data-slot="scope-list" role="list">
|
|
19
|
+
* <div role="listitem" data-slot="scope-list-item" data-scope="openid" data-required>
|
|
20
|
+
* <label data-slot="scope-list-label">
|
|
21
|
+
* <pont2-prim-checkbox checked disabled required></pont2-prim-checkbox>
|
|
22
|
+
* <span data-slot="scope-list-text">Sign you in</span>
|
|
23
|
+
* </label>
|
|
24
|
+
* </div>
|
|
25
|
+
* …
|
|
26
|
+
* </pont2-scope-list>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* **Form-associated** (`extends FormControlElement`): it submits the ticked
|
|
30
|
+
* scopes, space-separated (OAuth `scope` syntax), under `name` (default
|
|
31
|
+
* `scope`), resets, restores and follows `<fieldset disabled>` natively. The
|
|
32
|
+
* legacy element exposed `.value` for its custom form to read.
|
|
33
|
+
*
|
|
34
|
+
* Each row is a **Checkbox primitive element** (it has behaviour) inside a
|
|
35
|
+
* native `<label>`; the checkboxes have no `name`, so only the list submits.
|
|
36
|
+
* Required scopes are always ticked and disabled. Scopes default to ticked;
|
|
37
|
+
* the user unticks what they do not grant.
|
|
38
|
+
*
|
|
39
|
+
* @tag pont2-scope-list
|
|
40
|
+
* @attr scopes - JSON array of `{ scope, label?, required?, granted? }`; `.scopes` is an array
|
|
41
|
+
* @attr name - default "scope"
|
|
42
|
+
* @attr disabled
|
|
43
|
+
* @fires input, change - when a scope is toggled (read `.value`)
|
|
44
|
+
*/
|
|
45
|
+
export declare class ScopeList extends FormControlElement {
|
|
46
|
+
static identity: string;
|
|
47
|
+
static slotName: string;
|
|
48
|
+
static role: string;
|
|
49
|
+
static composite: boolean;
|
|
50
|
+
static properties: PropertyDeclarations;
|
|
51
|
+
scopes: ConsentScope[];
|
|
52
|
+
protected unticked: Set<string>;
|
|
53
|
+
constructor();
|
|
54
|
+
/** The normalised scope list. */
|
|
55
|
+
get list(): ConsentScope[];
|
|
56
|
+
/** The submitted value: ticked scopes, space-separated. */
|
|
57
|
+
get value(): string;
|
|
58
|
+
protected get hostFocusable(): boolean;
|
|
59
|
+
protected formValue(): string | null;
|
|
60
|
+
protected resetToDefault(): void;
|
|
61
|
+
protected restoreState(state: string | File | FormData | null): void;
|
|
62
|
+
private toggle;
|
|
63
|
+
render(): unknown;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
"pont2-scope-list": ScopeList;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure value logic of the scope list (ported from the legacy
|
|
3
|
+
* scope-list.value.ts, which has the same tests).
|
|
4
|
+
*/
|
|
5
|
+
export interface ConsentScope {
|
|
6
|
+
scope: string;
|
|
7
|
+
label: string;
|
|
8
|
+
granted?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Drops malformed and duplicate entries; trims names; label defaults to the scope. */
|
|
12
|
+
export declare function normalizeScopes(scopes: unknown): ConsentScope[];
|
|
13
|
+
/** Required scopes are always ticked; others unless the user unticked them. */
|
|
14
|
+
export declare function isScopeChecked(scope: ConsentScope, unticked: ReadonlySet<string>): boolean;
|
|
15
|
+
/** The submitted value: ticked scope names, space-separated (OAuth `scope` syntax). */
|
|
16
|
+
export declare function scopeListValue(scopes: ConsentScope[], unticked: ReadonlySet<string>): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { CopyController } from '../../core/controllers/copy';
|
|
3
|
+
import { HostElement } from '../../core/host-element';
|
|
4
|
+
/**
|
|
5
|
+
* # `<pont2-secret>`: the "Can't scan?" manual TOTP secret
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <pont2-secret secret="JBSWY3DPEHPK3PXP" issuer="Acme" account="ada@example.com"></pont2-secret>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <pont2-secret data-pont2-secret data-slot="secret">
|
|
13
|
+
* <p data-slot="secret-title">Can't scan?</p>
|
|
14
|
+
* <div data-pont2-input-group …>
|
|
15
|
+
* <input data-pont2-input-group-input readonly value="JBSWY3DPEHPK3PXP" aria-label="Manual secret">
|
|
16
|
+
* <div data-pont2-input-group-addon data-align="inline-end">
|
|
17
|
+
* <button … aria-label="Copy secret"><svg/></button>
|
|
18
|
+
* </div>
|
|
19
|
+
* </div>
|
|
20
|
+
* <span data-slot="secret-copied" role="status">Copied!</span> (after copying)
|
|
21
|
+
* <dl data-slot="secret-metadata"><div><dt>Issuer</dt><dd>Acme</dd></div><div><dt>Account</dt><dd>…</dd></div></dl>
|
|
22
|
+
* </pont2-secret>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Built from InputGroup parts (shadcn's input + addon button). Differences
|
|
26
|
+
* from the legacy element, each deliberate:
|
|
27
|
+
* - the input is **readonly**, not disabled: it can be focused and selected
|
|
28
|
+
* (copy by hand, screen readers read it); monospace, spaced for reading;
|
|
29
|
+
* - "Copied!" is a `role="status"` live region, so it is announced;
|
|
30
|
+
* - the copy events (`pont2-copied` / `pont2-copy-error`, `{ kind: "secret" }`)
|
|
31
|
+
* **do not carry the secret** (the legacy `pont-secret:copied` did);
|
|
32
|
+
* - issuer/account are a description list (`<dl>`), their semantic form.
|
|
33
|
+
*
|
|
34
|
+
* @tag pont2-secret
|
|
35
|
+
* @attr secret, issuer, account
|
|
36
|
+
* @attr title-text - default "Can't scan?" (`title` would be a native tooltip)
|
|
37
|
+
* @attr secret-label, issuer-label, account-label, copy-label, copied-text - copy
|
|
38
|
+
* @attr disabled - disables the copy button
|
|
39
|
+
* @fires pont2-copied, pont2-copy-error - `{ kind: "secret" }`
|
|
40
|
+
*/
|
|
41
|
+
export declare class Secret extends HostElement {
|
|
42
|
+
static identity: string;
|
|
43
|
+
static slotName: string;
|
|
44
|
+
static composite: boolean;
|
|
45
|
+
static properties: PropertyDeclarations;
|
|
46
|
+
secret: string;
|
|
47
|
+
issuer: string;
|
|
48
|
+
account: string;
|
|
49
|
+
titleText: string;
|
|
50
|
+
secretLabel: string;
|
|
51
|
+
issuerLabel: string;
|
|
52
|
+
accountLabel: string;
|
|
53
|
+
copyLabel: string;
|
|
54
|
+
copiedText: string;
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
protected readonly clipboard: CopyController;
|
|
57
|
+
private inputId;
|
|
58
|
+
constructor();
|
|
59
|
+
/** Copies the secret (also what the button does). */
|
|
60
|
+
copy(): Promise<boolean>;
|
|
61
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
62
|
+
}
|
|
63
|
+
declare global {
|
|
64
|
+
interface HTMLElementTagNameMap {
|
|
65
|
+
"pont2-secret": Secret;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for Storybook play functions (not part of the library build: nothing
|
|
3
|
+
* in src/index.ts imports this file).
|
|
4
|
+
*/
|
|
5
|
+
/** Replaces the clipboard for the duration of a play function. */
|
|
6
|
+
export declare function stubClipboard(): {
|
|
7
|
+
writes: string[];
|
|
8
|
+
restore: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PropertyDeclarations, TemplateResult } from 'lit';
|
|
2
|
+
import { ShellElement } from '../../core/host-element';
|
|
3
|
+
export type TitleLevel = "1" | "2" | "3" | "4";
|
|
4
|
+
export type TextAlign = "auto" | "start" | "center" | "end";
|
|
5
|
+
/**
|
|
6
|
+
* Title and subtitle: a heading and its supporting line.
|
|
7
|
+
*
|
|
8
|
+
* shadcn has no typography *components* (its typography page is classes), and
|
|
9
|
+
* its login blocks write `<h1 class="text-2xl font-bold">Welcome back</h1>
|
|
10
|
+
* <p class="text-muted-foreground text-balance">Login to your Acme Inc
|
|
11
|
+
* account</p>`. pont2 keeps the **native** `<h1>`–`<h4>` / `<p>` (document
|
|
12
|
+
* outline, heading navigation, reader modes), so these are Tier 3 shells:
|
|
13
|
+
* the host has no box (`display: contents`), the native element is styled.
|
|
14
|
+
*
|
|
15
|
+
* The text comes from `content` (the legacy attribute, and what render
|
|
16
|
+
* specs emit); a composite owns its children.
|
|
17
|
+
*/
|
|
18
|
+
declare abstract class TextShell extends ShellElement {
|
|
19
|
+
static composite: boolean;
|
|
20
|
+
static properties: PropertyDeclarations;
|
|
21
|
+
content: string;
|
|
22
|
+
align: TextAlign;
|
|
23
|
+
constructor();
|
|
24
|
+
get control(): HTMLElement | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* # `<pont2-title>`
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* <pont2-title level="1" content="Welcome back"></pont2-title>
|
|
31
|
+
* → <pont2-title data-pont2-shell><h1 data-pont2-title data-level="1" data-align="auto">Welcome back</h1></pont2-title>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Sizes follow shadcn's auth blocks: level 1 is the block heading (`text-2xl
|
|
35
|
+
* font-bold`), 2–4 step down (`text-xl`/`text-lg`/`text-base`, semibold).
|
|
36
|
+
*
|
|
37
|
+
* @tag pont2-title
|
|
38
|
+
* @attr level - 1 (default) | 2 | 3 | 4: the native heading level
|
|
39
|
+
* @attr content - the heading text
|
|
40
|
+
* @attr align - auto (default: inherit) | start | center | end
|
|
41
|
+
*/
|
|
42
|
+
export declare class Title extends TextShell {
|
|
43
|
+
static properties: PropertyDeclarations;
|
|
44
|
+
level: TitleLevel;
|
|
45
|
+
constructor();
|
|
46
|
+
render(): TemplateResult;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* # `<pont2-subtitle>`
|
|
50
|
+
*
|
|
51
|
+
* ```html
|
|
52
|
+
* <pont2-subtitle content="Login to your Acme Inc account"></pont2-subtitle>
|
|
53
|
+
* → <pont2-subtitle data-pont2-shell><p data-pont2-subtitle data-align="auto">…</p></pont2-subtitle>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* shadcn's block description: `text-muted-foreground text-balance` (text-sm).
|
|
57
|
+
*
|
|
58
|
+
* @tag pont2-subtitle
|
|
59
|
+
* @attr content, align - as Title
|
|
60
|
+
*/
|
|
61
|
+
export declare class Subtitle extends TextShell {
|
|
62
|
+
render(): TemplateResult;
|
|
63
|
+
}
|
|
64
|
+
declare global {
|
|
65
|
+
interface HTMLElementTagNameMap {
|
|
66
|
+
"pont2-title": Title;
|
|
67
|
+
"pont2-subtitle": Subtitle;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Pontive logo (mark + wordmark), the same geometry as the legacy
|
|
3
|
+
* watermark. Pontive's own asset, so it is inlined (no image request) and the
|
|
4
|
+
* mark and wordmark can be coloured separately in CSS.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PONTIVE_MARK: import('lit-html').TemplateResult<2>;
|
|
7
|
+
export declare const PONTIVE_WORDMARK: import('lit-html').TemplateResult<2>;
|
|
8
|
+
export declare const pontiveLogo: () => import('lit-html').TemplateResult<1>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PropertyDeclarations, TemplateResult } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type WatermarkVariant = "brand" | "theme" | "muted";
|
|
4
|
+
export type WatermarkLogoAlign = "start" | "end";
|
|
5
|
+
/** The watermark's content (label + logo), shared with the block's footer. */
|
|
6
|
+
export declare function watermarkContent(label: string, logoAlign: WatermarkLogoAlign): TemplateResult;
|
|
7
|
+
/**
|
|
8
|
+
* # `<pont2-watermark>`: "Powered by [Pontive]"
|
|
9
|
+
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <pont2-watermark variant="muted"></pont2-watermark>
|
|
12
|
+
* → <pont2-watermark data-pont2-watermark data-slot="watermark" data-variant="muted">
|
|
13
|
+
* <span data-slot="watermark-label">Powered by</span><svg data-slot="watermark-logo" role="img" aria-label="Pontive">…</svg>
|
|
14
|
+
* </pont2-watermark>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Host-as-root (the legacy element wrapped a `<span>` in its tag). The block
|
|
18
|
+
* renders the same content as a *part* in its footer (`Watermark.part()` +
|
|
19
|
+
* `watermarkContent()`), so the screen shell needs no nested element.
|
|
20
|
+
*
|
|
21
|
+
* @tag pont2-watermark
|
|
22
|
+
* @attr variant - brand (default: the mark in Pontive indigo) | theme (currentColor) | muted (muted text)
|
|
23
|
+
* @attr logo-align - start | end (default)
|
|
24
|
+
* @attr label - default "Powered by"
|
|
25
|
+
*/
|
|
26
|
+
export declare class Watermark extends HostElement {
|
|
27
|
+
static identity: string;
|
|
28
|
+
static slotName: string;
|
|
29
|
+
static composite: boolean;
|
|
30
|
+
static properties: PropertyDeclarations;
|
|
31
|
+
variant: WatermarkVariant;
|
|
32
|
+
logoAlign: WatermarkLogoAlign;
|
|
33
|
+
label: string;
|
|
34
|
+
constructor();
|
|
35
|
+
protected willUpdate(): void;
|
|
36
|
+
render(): TemplateResult;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
"pont2-watermark": Watermark;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export declare const ALERT_VARIANTS: readonly ["default", "destructive"];
|
|
4
|
+
export type AlertVariant = (typeof ALERT_VARIANTS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* # Alert: Tier 1 (structural)
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<Alert variant>` → `<div role="alert" data-slot="alert">` with
|
|
9
|
+
* `AlertTitle`, `AlertDescription`, `AlertAction` divs inside.
|
|
10
|
+
*
|
|
11
|
+
* pont2: every part is host-as-root. The alert's `role="alert"` is an
|
|
12
|
+
* ElementInternals default, so `role="status"` written by the author (a polite
|
|
13
|
+
* announcement) still wins.
|
|
14
|
+
*
|
|
15
|
+
* @tag pont2-prim-alert
|
|
16
|
+
* @attr variant - default | destructive
|
|
17
|
+
*/
|
|
18
|
+
export declare class Alert extends HostElement {
|
|
19
|
+
static identity: string;
|
|
20
|
+
static slotName: string;
|
|
21
|
+
static role: string;
|
|
22
|
+
static properties: PropertyDeclarations;
|
|
23
|
+
variant: AlertVariant;
|
|
24
|
+
constructor();
|
|
25
|
+
protected willUpdate(): void;
|
|
26
|
+
}
|
|
27
|
+
/** @tag pont2-prim-alert-title */
|
|
28
|
+
export declare class AlertTitle extends HostElement {
|
|
29
|
+
static identity: string;
|
|
30
|
+
static slotName: string;
|
|
31
|
+
}
|
|
32
|
+
/** @tag pont2-prim-alert-description */
|
|
33
|
+
export declare class AlertDescription extends HostElement {
|
|
34
|
+
static identity: string;
|
|
35
|
+
static slotName: string;
|
|
36
|
+
}
|
|
37
|
+
/** @tag pont2-prim-alert-action */
|
|
38
|
+
export declare class AlertAction extends HostElement {
|
|
39
|
+
static identity: string;
|
|
40
|
+
static slotName: string;
|
|
41
|
+
}
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
"pont2-prim-alert": Alert;
|
|
45
|
+
"pont2-prim-alert-title": AlertTitle;
|
|
46
|
+
"pont2-prim-alert-description": AlertDescription;
|
|
47
|
+
"pont2-prim-alert-action": AlertAction;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type AvatarSize = "default" | "sm" | "lg";
|
|
4
|
+
/** Base UI `Avatar.Root` state `imageLoadingStatus`. */
|
|
5
|
+
export type ImageLoadingStatus = "idle" | "loading" | "loaded" | "error";
|
|
6
|
+
/**
|
|
7
|
+
* # Avatar: Tier 1 (structural, with image-loading behaviour)
|
|
8
|
+
*
|
|
9
|
+
* shadcn: `<Avatar size>` → Base UI `<Avatar.Root>` (`<span data-slot="avatar"
|
|
10
|
+
* data-size>`) holding `<Avatar.Image>` (an `<img>`, rendered only once it has
|
|
11
|
+
* loaded) and `<Avatar.Fallback>` (a `<span>`, rendered until then).
|
|
12
|
+
*
|
|
13
|
+
* pont2: the host **is** the root span. The image is the author's own native
|
|
14
|
+
* `<img>` (Tier 3: it must stay an `<img>` for `alt`, `srcset`, lazy loading),
|
|
15
|
+
* written as a direct child. The host watches it and exposes Base UI's
|
|
16
|
+
* `imageLoadingStatus` as `data-image-loading-status`; CSS shows the image
|
|
17
|
+
* only when `loaded` and the fallback otherwise. Nothing is added, removed or
|
|
18
|
+
* moved: the image and fallback both stay in the DOM and CSS swaps them.
|
|
19
|
+
*
|
|
20
|
+
* ```html
|
|
21
|
+
* <pont2-prim-avatar>
|
|
22
|
+
* <img src="/u/42.png" alt="Ada Lovelace">
|
|
23
|
+
* <pont2-prim-avatar-fallback>AL</pont2-prim-avatar-fallback>
|
|
24
|
+
* </pont2-prim-avatar>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @tag pont2-prim-avatar
|
|
28
|
+
* @attr size - default | sm | lg
|
|
29
|
+
* @fires pont2-loading-status-change - `{ status }` when the image status changes (Base UI `onLoadingStatusChange`).
|
|
30
|
+
*/
|
|
31
|
+
export declare class Avatar extends HostElement {
|
|
32
|
+
static identity: string;
|
|
33
|
+
static slotName: string;
|
|
34
|
+
static properties: PropertyDeclarations;
|
|
35
|
+
size: AvatarSize;
|
|
36
|
+
/** Base UI's `imageLoadingStatus`; read-only for consumers. */
|
|
37
|
+
imageLoadingStatus: ImageLoadingStatus;
|
|
38
|
+
private img;
|
|
39
|
+
private observer?;
|
|
40
|
+
constructor();
|
|
41
|
+
/** The author's `<img>` (a direct child), if any. */
|
|
42
|
+
get image(): HTMLImageElement | null;
|
|
43
|
+
connectedCallback(): void;
|
|
44
|
+
disconnectedCallback(): void;
|
|
45
|
+
private detach;
|
|
46
|
+
private track;
|
|
47
|
+
private onLoad;
|
|
48
|
+
private onError;
|
|
49
|
+
private setStatus;
|
|
50
|
+
protected willUpdate(): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Shown until the avatar's image has loaded (CSS-driven; see Avatar).
|
|
54
|
+
*
|
|
55
|
+
* @tag pont2-prim-avatar-fallback
|
|
56
|
+
*/
|
|
57
|
+
export declare class AvatarFallback extends HostElement {
|
|
58
|
+
static identity: string;
|
|
59
|
+
static slotName: string;
|
|
60
|
+
}
|
|
61
|
+
/** @tag pont2-prim-avatar-badge */
|
|
62
|
+
export declare class AvatarBadge extends HostElement {
|
|
63
|
+
static identity: string;
|
|
64
|
+
static slotName: string;
|
|
65
|
+
}
|
|
66
|
+
/** @tag pont2-prim-avatar-group */
|
|
67
|
+
export declare class AvatarGroup extends HostElement {
|
|
68
|
+
static identity: string;
|
|
69
|
+
static slotName: string;
|
|
70
|
+
}
|
|
71
|
+
/** @tag pont2-prim-avatar-group-count */
|
|
72
|
+
export declare class AvatarGroupCount extends HostElement {
|
|
73
|
+
static identity: string;
|
|
74
|
+
static slotName: string;
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
"pont2-prim-avatar": Avatar;
|
|
79
|
+
"pont2-prim-avatar-fallback": AvatarFallback;
|
|
80
|
+
"pont2-prim-avatar-badge": AvatarBadge;
|
|
81
|
+
"pont2-prim-avatar-group": AvatarGroup;
|
|
82
|
+
"pont2-prim-avatar-group-count": AvatarGroupCount;
|
|
83
|
+
}
|
|
84
|
+
interface HTMLElementEventMap {
|
|
85
|
+
"pont2-loading-status-change": CustomEvent<{
|
|
86
|
+
status: ImageLoadingStatus;
|
|
87
|
+
}>;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export declare const BADGE_VARIANTS: readonly ["default", "secondary", "destructive", "outline", "ghost", "link"];
|
|
4
|
+
export type BadgeVariant = (typeof BADGE_VARIANTS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* # Badge: Tier 1 (structural)
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<Badge variant>` → Base UI `useRender({ defaultTagName: "span" })`
|
|
9
|
+
* → `<span data-slot="badge" data-variant>`; with `render={<a/>}` it becomes
|
|
10
|
+
* a link.
|
|
11
|
+
*
|
|
12
|
+
* pont2: `<pont2-prim-badge>` **is** the span. For a link badge, put the recipe on
|
|
13
|
+
* a real anchor: `<a data-pont2-badge data-variant="outline" href="…">`.
|
|
14
|
+
*
|
|
15
|
+
* @tag pont2-prim-badge
|
|
16
|
+
* @attr variant - default | secondary | destructive | outline | ghost | link
|
|
17
|
+
*/
|
|
18
|
+
export declare class Badge extends HostElement {
|
|
19
|
+
static identity: string;
|
|
20
|
+
static slotName: string;
|
|
21
|
+
static properties: PropertyDeclarations;
|
|
22
|
+
variant: BadgeVariant;
|
|
23
|
+
constructor();
|
|
24
|
+
protected willUpdate(): void;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
"pont2-prim-badge": Badge;
|
|
29
|
+
}
|
|
30
|
+
}
|