@pontive/pontkit-core 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/pont2/core/attrs.d.ts +22 -0
- package/dist/pont2/core/controllers/roving-focus.d.ts +38 -0
- package/dist/pont2/core/events.d.ts +28 -0
- package/dist/pont2/core/form-control.d.ts +70 -0
- package/dist/pont2/core/host-element.d.ts +129 -0
- package/dist/pont2/core/icons.d.ts +20 -0
- package/dist/pont2/core/ids.d.ts +6 -0
- package/dist/pont2/core/index.d.ts +8 -0
- package/dist/pont2/core/names.d.ts +78 -0
- package/dist/pont2/core/popup/anchored.d.ts +48 -0
- package/dist/pont2/core/popup/index.d.ts +5 -0
- package/dist/pont2/core/popup/list.d.ts +38 -0
- package/dist/pont2/core/popup/popup-content.d.ts +68 -0
- package/dist/pont2/core/popup/popup-root.d.ts +94 -0
- package/dist/pont2/core/popup/position.d.ts +73 -0
- package/dist/pont2/globals.css +109 -0
- package/dist/pont2/index.d.ts +44 -0
- package/dist/pont2/index.mjs +3805 -0
- package/dist/pont2/index.mjs.map +1 -0
- package/dist/pont2/kit/alert/alert.d.ts +62 -0
- package/dist/pont2/kit/aliases.d.ts +33 -0
- package/dist/pont2/kit/avatar/avatar.d.ts +52 -0
- package/dist/pont2/kit/index.d.ts +3 -0
- package/dist/pont2/kit/input-otp/input-otp.d.ts +52 -0
- package/dist/pont2/primitives/alert/alert.d.ts +49 -0
- package/dist/pont2/primitives/avatar/avatar.d.ts +89 -0
- package/dist/pont2/primitives/badge/badge.d.ts +30 -0
- package/dist/pont2/primitives/button/button.d.ts +113 -0
- package/dist/pont2/primitives/button-group/button-group.d.ts +55 -0
- package/dist/pont2/primitives/card/card.d.ts +63 -0
- package/dist/pont2/primitives/checkbox/checkbox.d.ts +54 -0
- package/dist/pont2/primitives/combobox/combobox.d.ts +213 -0
- package/dist/pont2/primitives/dropdown-menu/dropdown-menu.d.ts +267 -0
- package/dist/pont2/primitives/empty/empty.d.ts +60 -0
- package/dist/pont2/primitives/field/field.d.ts +146 -0
- package/dist/pont2/primitives/input/input.d.ts +47 -0
- package/dist/pont2/primitives/input-group/input-group.d.ts +97 -0
- package/dist/pont2/primitives/input-otp/input-otp.d.ts +121 -0
- package/dist/pont2/primitives/input-otp/otp.d.ts +22 -0
- package/dist/pont2/primitives/item/item.d.ts +100 -0
- package/dist/pont2/primitives/kbd/kbd.d.ts +29 -0
- package/dist/pont2/primitives/label/label.d.ts +37 -0
- package/dist/pont2/primitives/native-select/native-select.d.ts +59 -0
- package/dist/pont2/primitives/popover/popover.d.ts +85 -0
- package/dist/pont2/primitives/progress/progress.d.ts +80 -0
- package/dist/pont2/primitives/radio-group/radio-group.d.ts +93 -0
- package/dist/pont2/primitives/select/select.d.ts +184 -0
- package/dist/pont2/primitives/separator/separator.d.ts +34 -0
- package/dist/pont2/primitives/skeleton/skeleton.d.ts +18 -0
- package/dist/pont2/primitives/slider/slider-math.d.ts +42 -0
- package/dist/pont2/primitives/slider/slider.d.ts +85 -0
- package/dist/pont2/primitives/spinner/spinner.d.ts +29 -0
- package/dist/pont2/primitives/switch/switch.d.ts +55 -0
- package/dist/pont2/primitives/table/table.d.ts +55 -0
- package/dist/pont2/primitives/tabs/tabs.d.ts +126 -0
- package/dist/pont2/primitives/textarea/textarea.d.ts +41 -0
- package/dist/pont2/primitives/tooltip/tooltip.d.ts +69 -0
- package/dist/pont2/styles.css +4137 -0
- package/dist/pont2/with-legacy.css +10 -0
- package/package.json +16 -4
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { PropertyDeclarations, TemplateResult } from 'lit';
|
|
2
|
+
import { Alert } from '../../primitives/alert/alert';
|
|
3
|
+
export declare const ALERT_STATUSES: readonly ["default", "error", "warning", "success", "info"];
|
|
4
|
+
export type AlertStatus = (typeof ALERT_STATUSES)[number];
|
|
5
|
+
/**
|
|
6
|
+
* # `<pont2-alert>`: kit composite over `<pont2-prim-alert>`
|
|
7
|
+
*
|
|
8
|
+
* The props-driven form of shadcn's Alert, and pont2's version of the legacy
|
|
9
|
+
* `pont-alert` (which composed `pont-callout`, the legacy shadcn alert).
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <pont2-alert status="error" icon heading="Payment failed"
|
|
13
|
+
* description="Check your card details and try again."></pont2-alert>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* renders exactly the DOM the primitive form produces:
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <pont2-alert data-pont2-alert data-slot="alert" data-variant="destructive" data-status="error">
|
|
20
|
+
* <svg …/>
|
|
21
|
+
* <div data-pont2-alert-title data-slot="alert-title">Payment failed</div>
|
|
22
|
+
* <div data-pont2-alert-description data-slot="alert-description">Check your…</div>
|
|
23
|
+
* </pont2-alert>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* - **It is a primitive Alert** (`extends Alert`): same identity, slot, recipe
|
|
27
|
+
* and `variant`. Title and description are rendered as *parts* (plain divs
|
|
28
|
+
* with the primitive's attributes), not nested elements.
|
|
29
|
+
* - **What it adds** over shadcn: `status` (`error` maps to shadcn's
|
|
30
|
+
* `destructive` variant; `warning`/`success`/`info` are coloured in
|
|
31
|
+
* `@layer pont2.kit` with the `--pont2-success|warning|info` tokens), a
|
|
32
|
+
* status icon, and a status-appropriate role (`alert` for error/warning,
|
|
33
|
+
* `status` otherwise, as the legacy `pont-alert` did). An author `role`
|
|
34
|
+
* attribute still wins.
|
|
35
|
+
* - **What it leaves out:** rich content (links, an action button). Use the
|
|
36
|
+
* primitive form for those; a composite ignores author children.
|
|
37
|
+
*
|
|
38
|
+
* `heading` instead of `title`: `title` is a global HTML attribute that shows
|
|
39
|
+
* a native tooltip, so the attribute would leak onto the whole alert.
|
|
40
|
+
*
|
|
41
|
+
* @tag pont2-alert
|
|
42
|
+
* @attr status - default | error | warning | success | info
|
|
43
|
+
* @attr heading - the alert title text
|
|
44
|
+
* @attr description - the description text
|
|
45
|
+
* @attr icon - show the status icon
|
|
46
|
+
*/
|
|
47
|
+
export declare class KitAlert extends Alert {
|
|
48
|
+
static composite: boolean;
|
|
49
|
+
static properties: PropertyDeclarations;
|
|
50
|
+
status: AlertStatus;
|
|
51
|
+
heading: string;
|
|
52
|
+
description: string;
|
|
53
|
+
icon: boolean;
|
|
54
|
+
constructor();
|
|
55
|
+
protected willUpdate(): void;
|
|
56
|
+
protected render(): TemplateResult<1>;
|
|
57
|
+
}
|
|
58
|
+
declare global {
|
|
59
|
+
interface HTMLElementTagNameMap {
|
|
60
|
+
"pont2-alert": KitAlert;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Badge } from '../primitives/badge/badge';
|
|
2
|
+
import { Pont2Button } from '../primitives/button/button';
|
|
3
|
+
import { Checkbox } from '../primitives/checkbox/checkbox';
|
|
4
|
+
import { Pont2Input } from '../primitives/input/input';
|
|
5
|
+
import { Kbd, KbdGroup } from '../primitives/kbd/kbd';
|
|
6
|
+
import { Pont2Label } from '../primitives/label/label';
|
|
7
|
+
import { NativeSelect } from '../primitives/native-select/native-select';
|
|
8
|
+
import { Separator } from '../primitives/separator/separator';
|
|
9
|
+
import { Skeleton } from '../primitives/skeleton/skeleton';
|
|
10
|
+
import { Slider } from '../primitives/slider/slider';
|
|
11
|
+
import { Spinner } from '../primitives/spinner/spinner';
|
|
12
|
+
import { Switch } from '../primitives/switch/switch';
|
|
13
|
+
import { Table } from '../primitives/table/table';
|
|
14
|
+
import { Pont2Textarea } from '../primitives/textarea/textarea';
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
"pont2-badge": Badge;
|
|
18
|
+
"pont2-button": Pont2Button;
|
|
19
|
+
"pont2-checkbox": Checkbox;
|
|
20
|
+
"pont2-input": Pont2Input;
|
|
21
|
+
"pont2-kbd": Kbd;
|
|
22
|
+
"pont2-kbd-group": KbdGroup;
|
|
23
|
+
"pont2-label": Pont2Label;
|
|
24
|
+
"pont2-native-select": NativeSelect;
|
|
25
|
+
"pont2-separator": Separator;
|
|
26
|
+
"pont2-skeleton": Skeleton;
|
|
27
|
+
"pont2-slider": Slider;
|
|
28
|
+
"pont2-spinner": Spinner;
|
|
29
|
+
"pont2-switch": Switch;
|
|
30
|
+
"pont2-table": Table;
|
|
31
|
+
"pont2-textarea": Pont2Textarea;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { Avatar } from '../../primitives/avatar/avatar';
|
|
3
|
+
/** "Ada Lovelace" → "AL", "ada" → "A". At most two letters, upper-cased. */
|
|
4
|
+
export declare function initials(name: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* # `<pont2-avatar>`: kit composite over `<pont2-prim-avatar>`
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <pont2-avatar src="/u/42.png" alt="Ada Lovelace" badge></pont2-avatar>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* renders the primitive's DOM:
|
|
13
|
+
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <pont2-avatar data-pont2-avatar data-slot="avatar" data-size="default" data-image-loading-status="loaded">
|
|
16
|
+
* <img src="/u/42.png" alt="Ada Lovelace" data-pont2-avatar-image data-slot="avatar-image">
|
|
17
|
+
* <span data-pont2-avatar-fallback data-slot="avatar-fallback">AL</span>
|
|
18
|
+
* <span data-pont2-avatar-badge data-slot="avatar-badge"></span>
|
|
19
|
+
* </pont2-avatar>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* - **It is a primitive Avatar** (`extends Avatar`): the primitive watches the
|
|
23
|
+
* rendered `<img>` and swaps image and fallback on
|
|
24
|
+
* `data-image-loading-status` as usual.
|
|
25
|
+
* - **Fallback text:** `fallback`, else the initials of `alt`. When `alt` is
|
|
26
|
+
* set the fallback is announced as an image named by `alt` (not as "AL"):
|
|
27
|
+
* only one of image and fallback is ever displayed, so nothing is read twice.
|
|
28
|
+
* - **Badge:** `badge` shows shadcn's status dot. For an icon inside the
|
|
29
|
+
* badge, use the primitive form.
|
|
30
|
+
*
|
|
31
|
+
* @tag pont2-avatar
|
|
32
|
+
* @attr src - image URL (no image is rendered without it)
|
|
33
|
+
* @attr alt - image alternative text; also the source of the default initials
|
|
34
|
+
* @attr fallback - fallback text (defaults to the initials of `alt`)
|
|
35
|
+
* @attr size - default | sm | lg (primitive)
|
|
36
|
+
* @attr badge - show the badge dot
|
|
37
|
+
*/
|
|
38
|
+
export declare class KitAvatar extends Avatar {
|
|
39
|
+
static composite: boolean;
|
|
40
|
+
static properties: PropertyDeclarations;
|
|
41
|
+
src: string;
|
|
42
|
+
alt: string;
|
|
43
|
+
fallback: string;
|
|
44
|
+
badge: boolean;
|
|
45
|
+
constructor();
|
|
46
|
+
protected render(): import('lit-html').TemplateResult<1>;
|
|
47
|
+
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLElementTagNameMap {
|
|
50
|
+
"pont2-avatar": KitAvatar;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { InputOTP } from '../../primitives/input-otp/input-otp';
|
|
3
|
+
/** `groupSizes(6, 3)` → `[3, 3]`; `groupSizes(7, 3)` → `[3, 3, 1]`; size ≤ 0 → one group. */
|
|
4
|
+
export declare function groupSizes(length: number, size: number): number[];
|
|
5
|
+
/**
|
|
6
|
+
* # `<pont2-input-otp>`: kit composite over `<pont2-prim-input-otp>`
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <pont2-input-otp name="code" maxlength="6" group-size="3" separator aria-label="Verification code"></pont2-input-otp>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* renders the primitive's DOM, which is shadcn's:
|
|
13
|
+
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <pont2-input-otp data-pont2-input-otp …>
|
|
16
|
+
* <div data-pont2-input-otp-group data-slot="input-otp-group">
|
|
17
|
+
* <pont2-prim-input-otp-slot index="0"></pont2-prim-input-otp-slot> ×3
|
|
18
|
+
* </div>
|
|
19
|
+
* <div data-pont2-input-otp-separator data-slot="input-otp-separator" role="separator"><svg/></div>
|
|
20
|
+
* <div data-pont2-input-otp-group …> …×3 </div>
|
|
21
|
+
* <div data-pont2-input-otp-input-wrapper><input data-slot="input-otp" autocomplete="one-time-code" …></div>
|
|
22
|
+
* </pont2-input-otp>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* - **It is a primitive InputOTP** (`extends InputOTP`): the one native input,
|
|
26
|
+
* form participation, paste cleaning, `pont2-complete` and every primitive
|
|
27
|
+
* attribute (`maxlength`, `pattern`, `value`, `name`, `required`,
|
|
28
|
+
* `disabled`, `aria-*`) work unchanged.
|
|
29
|
+
* - **What it adds:** the slots are generated from `maxlength`, split into
|
|
30
|
+
* groups of `group-size` (one group when absent), with a separator between
|
|
31
|
+
* groups when `separator` is set.
|
|
32
|
+
* - Groups and separators are **parts** (plain divs). Slots are rendered as
|
|
33
|
+
* `pont2-prim-input-otp-slot` **elements**, because each slot has behaviour
|
|
34
|
+
* (it draws its character and the fake caret from state the root pushes in).
|
|
35
|
+
*
|
|
36
|
+
* @tag pont2-input-otp
|
|
37
|
+
* @attr group-size - characters per group (default: all in one group)
|
|
38
|
+
* @attr separator - draw a separator between groups
|
|
39
|
+
*/
|
|
40
|
+
export declare class KitInputOTP extends InputOTP {
|
|
41
|
+
static composite: boolean;
|
|
42
|
+
static properties: PropertyDeclarations;
|
|
43
|
+
groupSize: number;
|
|
44
|
+
separator: boolean;
|
|
45
|
+
constructor();
|
|
46
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
47
|
+
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLElementTagNameMap {
|
|
50
|
+
"pont2-input-otp": KitInputOTP;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { AttrMap } from '../../core/attrs';
|
|
3
|
+
import { NativeEnhancer, ShellElement } from '../../core/host-element';
|
|
4
|
+
/**
|
|
5
|
+
* # Button: Tier 3 (native-bound)
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Button variant size>` → Base UI `<Button>` → a native `<button>`
|
|
8
|
+
* (or, through `render`, the author's `<a>`), with `data-slot="button"`.
|
|
9
|
+
*
|
|
10
|
+
* A button's root must stay native: implicit form submission,
|
|
11
|
+
* `SubmitEvent.submitter`, `name=value` in FormData, password-manager
|
|
12
|
+
* heuristics, middle-click on links. So the styled element is always a native
|
|
13
|
+
* `<button>`/`<a>`, reachable four ways that all share one recipe
|
|
14
|
+
* (button.css, keyed on `[data-pont2-button]`):
|
|
15
|
+
*
|
|
16
|
+
* | Entry point | You write | DOM nodes |
|
|
17
|
+
* |-------------|------------------------------------------------------------------|-----------|
|
|
18
|
+
* | Recipe | `<button data-pont2-button data-variant="outline">` | 1 |
|
|
19
|
+
* | Part | `button({ variant: "outline" }, content)` inside a Lit template | 1 |
|
|
20
|
+
* | Enhancer | `<pont2-prim-button variant="outline"><button>…</button></pont2-prim-button>` | shell + 1 |
|
|
21
|
+
* | Base class | `class ProviderButton extends ButtonBase` | shell + 1 |
|
|
22
|
+
*/
|
|
23
|
+
export declare const BUTTON_VARIANTS: readonly ["default", "outline", "secondary", "ghost", "destructive", "link"];
|
|
24
|
+
export declare const BUTTON_SIZES: readonly ["default", "xs", "sm", "lg", "icon", "icon-xs", "icon-sm", "icon-lg"];
|
|
25
|
+
export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
|
|
26
|
+
export type ButtonSize = (typeof BUTTON_SIZES)[number];
|
|
27
|
+
export interface ButtonRecipe {
|
|
28
|
+
variant?: ButtonVariant;
|
|
29
|
+
size?: ButtonSize;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Base UI `focusableWhenDisabled`: stay in the tab order while disabled
|
|
33
|
+
* (`aria-disabled` instead of `disabled`). Use it for loading states, so
|
|
34
|
+
* focus is not lost mid-submit.
|
|
35
|
+
*/
|
|
36
|
+
focusableWhenDisabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ButtonOptions extends ButtonRecipe {
|
|
39
|
+
type?: "button" | "submit" | "reset";
|
|
40
|
+
name?: string;
|
|
41
|
+
value?: string;
|
|
42
|
+
/** Renders an `<a>` instead of a `<button>` (shadcn `render={<a/>}`). */
|
|
43
|
+
href?: string;
|
|
44
|
+
target?: string;
|
|
45
|
+
rel?: string;
|
|
46
|
+
/** Overrides `data-slot` (shadcn `<Button data-slot="…">`). */
|
|
47
|
+
slot?: string;
|
|
48
|
+
/** Extra attributes on the same native element: the `{...props}` spread. */
|
|
49
|
+
attrs?: AttrMap;
|
|
50
|
+
onClick?: (e: MouseEvent) => void;
|
|
51
|
+
}
|
|
52
|
+
export declare function applyButton(el: HTMLElement, o: ButtonRecipe): void;
|
|
53
|
+
/** True when a click on `el` must be swallowed (aria-disabled buttons and links). */
|
|
54
|
+
export declare function isSoftDisabled(el: Element): boolean;
|
|
55
|
+
export declare function button(o: ButtonOptions, content: unknown): import('lit-html').TemplateResult<1>;
|
|
56
|
+
/**
|
|
57
|
+
* `<pont2-prim-button>`: applies the button recipe to the native `<button>` or
|
|
58
|
+
* `<a>` you put inside it.
|
|
59
|
+
*
|
|
60
|
+
* ```html
|
|
61
|
+
* <pont2-prim-button variant="outline"><button type="submit">Continue</button></pont2-prim-button>
|
|
62
|
+
* <pont2-prim-button variant="link"><a href="/forgot">Forgot password?</a></pont2-prim-button>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @tag pont2-prim-button
|
|
66
|
+
* @attr variant - default | outline | secondary | ghost | destructive | link
|
|
67
|
+
* @attr size - default | xs | sm | lg | icon | icon-xs | icon-sm | icon-lg
|
|
68
|
+
* @attr disabled - Disables the native child (or sets aria-disabled on a link).
|
|
69
|
+
* @attr focusable-when-disabled - Keep the disabled button in the tab order.
|
|
70
|
+
*/
|
|
71
|
+
export declare class Pont2Button extends NativeEnhancer<HTMLButtonElement | HTMLAnchorElement> {
|
|
72
|
+
static nativeSelector: string;
|
|
73
|
+
static properties: PropertyDeclarations;
|
|
74
|
+
variant: ButtonVariant;
|
|
75
|
+
size: ButtonSize;
|
|
76
|
+
disabled: boolean;
|
|
77
|
+
focusableWhenDisabled: boolean;
|
|
78
|
+
constructor();
|
|
79
|
+
private guard;
|
|
80
|
+
protected apply(control: HTMLButtonElement | HTMLAnchorElement): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Extend this when your component *is* a button whose content it generates
|
|
84
|
+
* (a provider sign-in button, a submit button with a spinner). Subclasses
|
|
85
|
+
* inherit `variant`/`size`/`disabled`/`type`/`href`… so nothing is forwarded
|
|
86
|
+
* by hand; they implement `renderContent()` and may override
|
|
87
|
+
* `buttonOptions()`. The DOM is always
|
|
88
|
+
* `<host data-pont2-shell> > <button|a data-pont2-button>`.
|
|
89
|
+
*/
|
|
90
|
+
export declare abstract class ButtonBase extends ShellElement {
|
|
91
|
+
static properties: PropertyDeclarations;
|
|
92
|
+
variant: ButtonVariant;
|
|
93
|
+
size: ButtonSize;
|
|
94
|
+
disabled: boolean;
|
|
95
|
+
focusableWhenDisabled: boolean;
|
|
96
|
+
type: "button" | "submit" | "reset";
|
|
97
|
+
name?: string;
|
|
98
|
+
value?: string;
|
|
99
|
+
href?: string;
|
|
100
|
+
target?: string;
|
|
101
|
+
rel?: string;
|
|
102
|
+
constructor();
|
|
103
|
+
/** The native element. Focus, tooltips and popovers anchor here, never on the shell. */
|
|
104
|
+
get control(): HTMLButtonElement | HTMLAnchorElement | null;
|
|
105
|
+
protected buttonOptions(): ButtonOptions;
|
|
106
|
+
protected abstract renderContent(): unknown;
|
|
107
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
108
|
+
}
|
|
109
|
+
declare global {
|
|
110
|
+
interface HTMLElementTagNameMap {
|
|
111
|
+
"pont2-prim-button": Pont2Button;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { Separator } from '../separator/separator';
|
|
4
|
+
export type ButtonGroupOrientation = "horizontal" | "vertical";
|
|
5
|
+
/**
|
|
6
|
+
* # ButtonGroup: Tier 1 (structural)
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<ButtonGroup orientation>` → `<div role="group" data-slot="button-group"
|
|
9
|
+
* data-orientation>`; `ButtonGroupText` (Base UI `useRender`, a div);
|
|
10
|
+
* `ButtonGroupSeparator` (a vertical `Separator`).
|
|
11
|
+
*
|
|
12
|
+
* pont2: host-as-root. Children are whatever you write: recipe buttons,
|
|
13
|
+
* `<pont2-prim-button>` shells, inputs, nested groups. The join rules (square inner
|
|
14
|
+
* corners, collapsed borders) see through Tier 3 shells, because a shell has
|
|
15
|
+
* no box. `ButtonGroupSeparator extends Separator`.
|
|
16
|
+
*
|
|
17
|
+
* @tag pont2-prim-button-group
|
|
18
|
+
* @attr orientation - horizontal (default) | vertical
|
|
19
|
+
*/
|
|
20
|
+
export declare class ButtonGroup extends HostElement {
|
|
21
|
+
static identity: string;
|
|
22
|
+
static slotName: string;
|
|
23
|
+
static role: string;
|
|
24
|
+
static properties: PropertyDeclarations;
|
|
25
|
+
orientation: ButtonGroupOrientation;
|
|
26
|
+
constructor();
|
|
27
|
+
protected willUpdate(): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* For a link or label instead of a div, use the recipe on that element:
|
|
31
|
+
* `<label data-pont2-button-group-text data-slot="button-group-text">`.
|
|
32
|
+
*
|
|
33
|
+
* @tag pont2-prim-button-group-text
|
|
34
|
+
*/
|
|
35
|
+
export declare class ButtonGroupText extends HostElement {
|
|
36
|
+
static identity: string;
|
|
37
|
+
static slotName: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A Separator whose default orientation is vertical.
|
|
41
|
+
*
|
|
42
|
+
* @tag pont2-prim-button-group-separator
|
|
43
|
+
*/
|
|
44
|
+
export declare class ButtonGroupSeparator extends Separator {
|
|
45
|
+
static identity: string;
|
|
46
|
+
static slotName: string;
|
|
47
|
+
constructor();
|
|
48
|
+
}
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
"pont2-prim-button-group": ButtonGroup;
|
|
52
|
+
"pont2-prim-button-group-text": ButtonGroupText;
|
|
53
|
+
"pont2-prim-button-group-separator": ButtonGroupSeparator;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type CardSize = "default" | "sm";
|
|
4
|
+
/**
|
|
5
|
+
* # Card: Tier 1 (structural)
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Card size>` → `<div data-slot="card" data-size>` and the
|
|
8
|
+
* `CardHeader | CardTitle | CardDescription | CardAction | CardContent |
|
|
9
|
+
* CardFooter` divs. Every part here is host-as-root: same depth as shadcn.
|
|
10
|
+
*
|
|
11
|
+
* @tag pont2-prim-card
|
|
12
|
+
* @attr size - default | sm
|
|
13
|
+
* @cssprop --pont2-card-spacing - padding/gap unit (1.5rem, 1rem when size="sm")
|
|
14
|
+
*/
|
|
15
|
+
export declare class Card extends HostElement {
|
|
16
|
+
static identity: string;
|
|
17
|
+
static slotName: string;
|
|
18
|
+
static properties: PropertyDeclarations;
|
|
19
|
+
size: CardSize;
|
|
20
|
+
constructor();
|
|
21
|
+
protected willUpdate(): void;
|
|
22
|
+
}
|
|
23
|
+
/** @tag pont2-prim-card-header */
|
|
24
|
+
export declare class CardHeader extends HostElement {
|
|
25
|
+
static identity: string;
|
|
26
|
+
static slotName: string;
|
|
27
|
+
}
|
|
28
|
+
/** @tag pont2-prim-card-title */
|
|
29
|
+
export declare class CardTitle extends HostElement {
|
|
30
|
+
static identity: string;
|
|
31
|
+
static slotName: string;
|
|
32
|
+
}
|
|
33
|
+
/** @tag pont2-prim-card-description */
|
|
34
|
+
export declare class CardDescription extends HostElement {
|
|
35
|
+
static identity: string;
|
|
36
|
+
static slotName: string;
|
|
37
|
+
}
|
|
38
|
+
/** @tag pont2-prim-card-action */
|
|
39
|
+
export declare class CardAction extends HostElement {
|
|
40
|
+
static identity: string;
|
|
41
|
+
static slotName: string;
|
|
42
|
+
}
|
|
43
|
+
/** @tag pont2-prim-card-content */
|
|
44
|
+
export declare class CardContent extends HostElement {
|
|
45
|
+
static identity: string;
|
|
46
|
+
static slotName: string;
|
|
47
|
+
}
|
|
48
|
+
/** @tag pont2-prim-card-footer */
|
|
49
|
+
export declare class CardFooter extends HostElement {
|
|
50
|
+
static identity: string;
|
|
51
|
+
static slotName: string;
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
"pont2-prim-card": Card;
|
|
56
|
+
"pont2-prim-card-header": CardHeader;
|
|
57
|
+
"pont2-prim-card-title": CardTitle;
|
|
58
|
+
"pont2-prim-card-description": CardDescription;
|
|
59
|
+
"pont2-prim-card-action": CardAction;
|
|
60
|
+
"pont2-prim-card-content": CardContent;
|
|
61
|
+
"pont2-prim-card-footer": CardFooter;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { FormControlElement, ValidityResult } from '../../core/form-control';
|
|
3
|
+
/**
|
|
4
|
+
* # Checkbox: Tier 2 (widget, form-associated)
|
|
5
|
+
*
|
|
6
|
+
* shadcn: `<Checkbox>` → Base UI `<Checkbox.Root>` (`<span role="checkbox">`
|
|
7
|
+
* plus a hidden `<input type="checkbox">`) > `<Checkbox.Indicator>` > icon.
|
|
8
|
+
*
|
|
9
|
+
* pont2: the host **is** the `role="checkbox"` root, and it is a
|
|
10
|
+
* form-associated custom element, so there is no hidden input:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* shadcn/Base UI: span[role=checkbox] > span[data-slot=checkbox-indicator] > svg + input[hidden]
|
|
14
|
+
* pont2: pont2-prim-checkbox > span[data-slot=checkbox-indicator] > svg
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* State attributes are Base UI's: `data-checked` | `data-unchecked`,
|
|
18
|
+
* `data-indeterminate`, `data-disabled`, `data-readonly`, `data-required`.
|
|
19
|
+
* The CustomStateSet mirrors them (`:state(checked)`).
|
|
20
|
+
*
|
|
21
|
+
* @tag pont2-prim-checkbox
|
|
22
|
+
* @attr checked - Initial checked state (`defaultChecked`); `.checked` is the live state.
|
|
23
|
+
* @attr indeterminate - Mixed state (`aria-checked="mixed"`).
|
|
24
|
+
* @attr name, value, unchecked-value, disabled, required, readonly
|
|
25
|
+
* @fires input - The checked state changed through interaction.
|
|
26
|
+
* @fires change - Same moment as `input`, like a native checkbox.
|
|
27
|
+
*/
|
|
28
|
+
export declare class Checkbox extends FormControlElement {
|
|
29
|
+
static identity: string;
|
|
30
|
+
static slotName: string;
|
|
31
|
+
static role: string;
|
|
32
|
+
static properties: PropertyDeclarations;
|
|
33
|
+
checked: boolean;
|
|
34
|
+
indeterminate: boolean;
|
|
35
|
+
value: string;
|
|
36
|
+
uncheckedValue: string | undefined;
|
|
37
|
+
constructor();
|
|
38
|
+
/** Toggle as if the user clicked (fires input/change). */
|
|
39
|
+
toggle(): void;
|
|
40
|
+
protected formValue(): string | null;
|
|
41
|
+
protected resetToDefault(): void;
|
|
42
|
+
protected restoreState(state: string | File | FormData | null): void;
|
|
43
|
+
protected validate(): ValidityResult | null;
|
|
44
|
+
private onClick;
|
|
45
|
+
private onKeyDown;
|
|
46
|
+
private onKeyUp;
|
|
47
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
48
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
"pont2-prim-checkbox": Checkbox;
|
|
53
|
+
}
|
|
54
|
+
}
|