@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,47 @@
|
|
|
1
|
+
import { AttrMap } from '../../core/attrs';
|
|
2
|
+
import { NativeEnhancer } from '../../core/host-element';
|
|
3
|
+
/**
|
|
4
|
+
* # Input: Tier 3 (native-bound)
|
|
5
|
+
*
|
|
6
|
+
* shadcn: `<Input>` → Base UI `<Input>` → a native `<input data-slot="input">`.
|
|
7
|
+
*
|
|
8
|
+
* A sign-in kit's inputs must be native and in light DOM: autofill, password
|
|
9
|
+
* managers, `autocomplete="one-time-code"`, form submission, `<label for>`
|
|
10
|
+
* and `aria-describedby` all depend on it.
|
|
11
|
+
*
|
|
12
|
+
* - recipe: `<input data-pont2-input type="email" name="email">`
|
|
13
|
+
* - part: `input({ type: "email", name: "email" })`
|
|
14
|
+
* - enhancer: `<pont2-prim-input><input type="email" name="email"></pont2-prim-input>`
|
|
15
|
+
*/
|
|
16
|
+
export interface InputOptions {
|
|
17
|
+
id?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
type?: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
autocomplete?: string;
|
|
23
|
+
inputmode?: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
readonly?: boolean;
|
|
27
|
+
invalid?: boolean;
|
|
28
|
+
describedBy?: string;
|
|
29
|
+
slot?: string;
|
|
30
|
+
attrs?: AttrMap;
|
|
31
|
+
onInput?: (e: InputEvent) => void;
|
|
32
|
+
onChange?: (e: Event) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare function applyInput(el: HTMLInputElement, slot?: string): void;
|
|
35
|
+
export declare function input(o?: InputOptions): import('lit-html').TemplateResult<1>;
|
|
36
|
+
/**
|
|
37
|
+
* @tag pont2-prim-input
|
|
38
|
+
*/
|
|
39
|
+
export declare class Pont2Input extends NativeEnhancer<HTMLInputElement> {
|
|
40
|
+
static nativeSelector: string;
|
|
41
|
+
protected apply(control: HTMLInputElement): void;
|
|
42
|
+
}
|
|
43
|
+
declare global {
|
|
44
|
+
interface HTMLElementTagNameMap {
|
|
45
|
+
"pont2-prim-input": Pont2Input;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement, NativeEnhancer } from '../../core/host-element';
|
|
3
|
+
import { Pont2Button, ButtonOptions } from '../button/button';
|
|
4
|
+
import { InputOptions } from '../input/input';
|
|
5
|
+
import { TextareaOptions } from '../textarea/textarea';
|
|
6
|
+
export type InputGroupAddonAlign = "inline-start" | "inline-end" | "block-start" | "block-end";
|
|
7
|
+
export type InputGroupButtonSize = "xs" | "sm" | "icon-xs" | "icon-sm";
|
|
8
|
+
/**
|
|
9
|
+
* # InputGroup family
|
|
10
|
+
*
|
|
11
|
+
* shadcn: `InputGroup` (`div role="group" data-slot="input-group"`),
|
|
12
|
+
* `InputGroupAddon` (`div role="group" data-align`, click focuses the input),
|
|
13
|
+
* `InputGroupText` (a `span`), and the controls `InputGroupInput` /
|
|
14
|
+
* `InputGroupTextarea` / `InputGroupButton`, which are shadcn's `Input`,
|
|
15
|
+
* `Textarea` and `Button` with extra classes and
|
|
16
|
+
* `data-slot="input-group-control"` (button: ghost, size xs).
|
|
17
|
+
*
|
|
18
|
+
* pont2:
|
|
19
|
+
* - `<pont2-prim-input-group>`, `<pont2-prim-input-group-addon>`, `<pont2-prim-input-group-text>`
|
|
20
|
+
* are host-as-root (Tier 1).
|
|
21
|
+
* - The controls stay native (Tier 3): the Input/Textarea/Button recipe plus
|
|
22
|
+
* an extra identity. Write them as recipes
|
|
23
|
+
* (`<input data-pont2-input data-pont2-input-group-input data-slot="input-group-control">`),
|
|
24
|
+
* parts (`inputGroupInput()`), or enhancers (`<pont2-prim-input-group-input><input></…>`).
|
|
25
|
+
*
|
|
26
|
+
* Like shadcn, the control must be a *direct* child of the group for the
|
|
27
|
+
* group's `has-[>input]` padding rules; with an enhancer the shell is
|
|
28
|
+
* `display: contents` and the rules also match through it.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @tag pont2-prim-input-group
|
|
32
|
+
* @attr disabled - Sets `data-disabled` (dims addons), like shadcn's `data-disabled="true"`.
|
|
33
|
+
*/
|
|
34
|
+
export declare class InputGroup extends HostElement {
|
|
35
|
+
static identity: string;
|
|
36
|
+
static slotName: string;
|
|
37
|
+
static role: string;
|
|
38
|
+
static properties: PropertyDeclarations;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
constructor();
|
|
41
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @tag pont2-prim-input-group-addon
|
|
45
|
+
* @attr align - inline-start (default) | inline-end | block-start | block-end
|
|
46
|
+
*/
|
|
47
|
+
export declare class InputGroupAddon extends HostElement {
|
|
48
|
+
static identity: string;
|
|
49
|
+
static slotName: string;
|
|
50
|
+
static role: string;
|
|
51
|
+
static properties: PropertyDeclarations;
|
|
52
|
+
align: InputGroupAddonAlign;
|
|
53
|
+
constructor();
|
|
54
|
+
protected willUpdate(): void;
|
|
55
|
+
}
|
|
56
|
+
/** shadcn's InputGroupText has no data-slot; pont2 keeps it that way. @tag pont2-prim-input-group-text */
|
|
57
|
+
export declare class InputGroupText extends HostElement {
|
|
58
|
+
static identity: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function inputGroupInput(o?: InputOptions): import('lit-html').TemplateResult<1>;
|
|
61
|
+
export declare function inputGroupTextarea(o?: TextareaOptions): import('lit-html').TemplateResult<1>;
|
|
62
|
+
export interface InputGroupButtonOptions extends Omit<ButtonOptions, "size"> {
|
|
63
|
+
size?: InputGroupButtonSize;
|
|
64
|
+
}
|
|
65
|
+
/** shadcn defaults: `variant="ghost"`, `size="xs"`, `type="button"`. */
|
|
66
|
+
export declare function inputGroupButton(o: InputGroupButtonOptions, content: unknown): import('lit-html').TemplateResult<1>;
|
|
67
|
+
/** @tag pont2-prim-input-group-input */
|
|
68
|
+
export declare class InputGroupInput extends NativeEnhancer<HTMLInputElement> {
|
|
69
|
+
static nativeSelector: string;
|
|
70
|
+
protected apply(control: HTMLInputElement): void;
|
|
71
|
+
}
|
|
72
|
+
/** @tag pont2-prim-input-group-textarea */
|
|
73
|
+
export declare class InputGroupTextarea extends NativeEnhancer<HTMLTextAreaElement> {
|
|
74
|
+
static nativeSelector: string;
|
|
75
|
+
protected apply(control: HTMLTextAreaElement): void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `<pont2-prim-button>` with shadcn's InputGroupButton defaults (ghost, xs) and its
|
|
79
|
+
* extra recipe. It *is* a Pont2Button enhancer, so everything else is inherited.
|
|
80
|
+
*
|
|
81
|
+
* @tag pont2-prim-input-group-button
|
|
82
|
+
* @attr size - xs (default) | sm | icon-xs | icon-sm
|
|
83
|
+
*/
|
|
84
|
+
export declare class InputGroupButton extends Pont2Button {
|
|
85
|
+
constructor();
|
|
86
|
+
protected apply(control: HTMLButtonElement | HTMLAnchorElement): void;
|
|
87
|
+
}
|
|
88
|
+
declare global {
|
|
89
|
+
interface HTMLElementTagNameMap {
|
|
90
|
+
"pont2-prim-input-group": InputGroup;
|
|
91
|
+
"pont2-prim-input-group-addon": InputGroupAddon;
|
|
92
|
+
"pont2-prim-input-group-text": InputGroupText;
|
|
93
|
+
"pont2-prim-input-group-input": InputGroupInput;
|
|
94
|
+
"pont2-prim-input-group-textarea": InputGroupTextarea;
|
|
95
|
+
"pont2-prim-input-group-button": InputGroupButton;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { OtpSlotState } from './otp';
|
|
4
|
+
export { REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from './otp';
|
|
5
|
+
export interface OtpCompleteDetail {
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* # InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator
|
|
10
|
+
*
|
|
11
|
+
* shadcn wraps the `input-otp` library: a container `div` holding the author's
|
|
12
|
+
* groups/slots plus ONE real `<input>` stretched transparently over them; the
|
|
13
|
+
* slots only *draw* the characters and a fake caret.
|
|
14
|
+
* ```
|
|
15
|
+
* shadcn: div.cn-input-otp > [InputOTPGroup > InputOTPSlot ×n, InputOTPSeparator] + div > input[data-slot=input-otp]
|
|
16
|
+
* pont2: pont2-prim-input-otp > [pont2-prim-input-otp-group > pont2-prim-input-otp-slot ×n, pont2-prim-input-otp-separator] + div > input[data-slot=input-otp]
|
|
17
|
+
* ```
|
|
18
|
+
* Same shape, same reason: the single native `<input autocomplete="one-time-code">`
|
|
19
|
+
* is what SMS autofill (iOS/Android), password managers, paste and form
|
|
20
|
+
* submission need. It is a Tier 3 core inside a Tier 1 container; the slots
|
|
21
|
+
* are Tier 1 hosts the container pushes state into.
|
|
22
|
+
*
|
|
23
|
+
* The input is rendered by the host (after the author's children, where
|
|
24
|
+
* input-otp puts it), so the author never writes it; `name`, `required`,
|
|
25
|
+
* `disabled`, `autocomplete`, `inputmode`, `pattern` and the ARIA naming
|
|
26
|
+
* attributes are forwarded to it.
|
|
27
|
+
*
|
|
28
|
+
* @tag pont2-prim-input-otp
|
|
29
|
+
* @attr maxlength - Number of characters (default 6).
|
|
30
|
+
* @attr pattern - Per-character regex source (default `^\d+$`, digits). `pattern=""` accepts anything.
|
|
31
|
+
* @attr value - Default value; `.value` is live.
|
|
32
|
+
* @attr name, required, disabled, autocomplete (one-time-code), inputmode, input-id
|
|
33
|
+
* @fires input, change - Native events from the inner input (bubble through the host).
|
|
34
|
+
* @fires pont2-complete - `{ value }` when every slot is filled (input-otp `onComplete`).
|
|
35
|
+
*/
|
|
36
|
+
export declare class InputOTP extends HostElement {
|
|
37
|
+
static identity: string;
|
|
38
|
+
static properties: PropertyDeclarations;
|
|
39
|
+
maxLength: number;
|
|
40
|
+
pattern: string | null;
|
|
41
|
+
defaultValue: string | null;
|
|
42
|
+
name: string | null;
|
|
43
|
+
required: boolean;
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
autocomplete: string;
|
|
46
|
+
/** Forwarded to the input as `inputmode` (named so it does not shadow HTMLElement.inputMode). */
|
|
47
|
+
keyboardMode: string | null;
|
|
48
|
+
inputId: string | null;
|
|
49
|
+
protected current: string;
|
|
50
|
+
protected forwarded: Record<string, string | null>;
|
|
51
|
+
private dirty;
|
|
52
|
+
private focused;
|
|
53
|
+
private observer?;
|
|
54
|
+
constructor();
|
|
55
|
+
/** The native input (the real form control). */
|
|
56
|
+
get input(): HTMLInputElement | null;
|
|
57
|
+
get value(): string;
|
|
58
|
+
set value(v: string);
|
|
59
|
+
focus(options?: FocusOptions): void;
|
|
60
|
+
connectedCallback(): void;
|
|
61
|
+
disconnectedCallback(): void;
|
|
62
|
+
private readForwarded;
|
|
63
|
+
private get slots();
|
|
64
|
+
/** Push per-slot state into the slot elements. */
|
|
65
|
+
private syncSlots;
|
|
66
|
+
private setFromInput;
|
|
67
|
+
private onInput;
|
|
68
|
+
private onPaste;
|
|
69
|
+
private placeCaret;
|
|
70
|
+
private onFocus;
|
|
71
|
+
private onBlur;
|
|
72
|
+
private onSelectionChange;
|
|
73
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
74
|
+
protected updated(): void;
|
|
75
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @tag pont2-prim-input-otp-group
|
|
79
|
+
*/
|
|
80
|
+
export declare class InputOTPGroup extends HostElement {
|
|
81
|
+
static identity: string;
|
|
82
|
+
static slotName: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Draws one character (and the fake caret). Purely visual: the native input
|
|
86
|
+
* is what assistive technology and autofill interact with.
|
|
87
|
+
*
|
|
88
|
+
* @tag pont2-prim-input-otp-slot
|
|
89
|
+
* @attr index - Character position; defaults to the slot's order in the InputOTP.
|
|
90
|
+
*/
|
|
91
|
+
export declare class InputOTPSlot extends HostElement {
|
|
92
|
+
static identity: string;
|
|
93
|
+
static slotName: string;
|
|
94
|
+
static properties: PropertyDeclarations;
|
|
95
|
+
protected state: OtpSlotState;
|
|
96
|
+
constructor();
|
|
97
|
+
connectedCallback(): void;
|
|
98
|
+
/** @internal Called by the InputOTP. */
|
|
99
|
+
sync(state: OtpSlotState, invalid: boolean): void;
|
|
100
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @tag pont2-prim-input-otp-separator
|
|
104
|
+
*/
|
|
105
|
+
export declare class InputOTPSeparator extends HostElement {
|
|
106
|
+
static identity: string;
|
|
107
|
+
static slotName: string;
|
|
108
|
+
static role: string;
|
|
109
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
110
|
+
}
|
|
111
|
+
declare global {
|
|
112
|
+
interface HTMLElementTagNameMap {
|
|
113
|
+
"pont2-prim-input-otp": InputOTP;
|
|
114
|
+
"pont2-prim-input-otp-group": InputOTPGroup;
|
|
115
|
+
"pont2-prim-input-otp-slot": InputOTPSlot;
|
|
116
|
+
"pont2-prim-input-otp-separator": InputOTPSeparator;
|
|
117
|
+
}
|
|
118
|
+
interface HTMLElementEventMap {
|
|
119
|
+
"pont2-complete": CustomEvent<OtpCompleteDetail>;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure InputOTP helpers (no DOM), unit-tested in node.
|
|
3
|
+
*
|
|
4
|
+
* `pattern` is a whole-string regular expression source, like the input-otp
|
|
5
|
+
* library's `REGEXP_ONLY_DIGITS` (`^\d+$`); each character is tested on its
|
|
6
|
+
* own, so pasted "123-456" or "12 34 56" is cleaned to "123456".
|
|
7
|
+
*/
|
|
8
|
+
export declare const REGEXP_ONLY_DIGITS = "^\\d+$";
|
|
9
|
+
export declare const REGEXP_ONLY_CHARS = "^[a-zA-Z]+$";
|
|
10
|
+
export declare const REGEXP_ONLY_DIGITS_AND_CHARS = "^[a-zA-Z0-9]+$";
|
|
11
|
+
export declare function sanitizeOtp(raw: string, maxLength: number, pattern?: string | null): string;
|
|
12
|
+
export interface OtpSlotState {
|
|
13
|
+
char: string | null;
|
|
14
|
+
isActive: boolean;
|
|
15
|
+
hasFakeCaret: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Per-slot state, as input-otp computes it: while focused, the slot(s) under
|
|
19
|
+
* the selection are active; a collapsed selection on an empty slot shows the
|
|
20
|
+
* fake caret. A full value with the caret at the end activates the last slot.
|
|
21
|
+
*/
|
|
22
|
+
export declare function otpSlots(value: string, maxLength: number, focused: boolean, selStart: number | null, selEnd: number | null): OtpSlotState[];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
import { Separator } from '../separator/separator';
|
|
4
|
+
export type ItemVariant = "default" | "outline" | "muted";
|
|
5
|
+
export type ItemSize = "default" | "sm" | "xs";
|
|
6
|
+
export type ItemMediaVariant = "default" | "icon" | "image";
|
|
7
|
+
/**
|
|
8
|
+
* # Item family: Tier 1 (structural)
|
|
9
|
+
*
|
|
10
|
+
* shadcn: `ItemGroup` (`div role="list"`), `Item` (Base UI `useRender`, a div
|
|
11
|
+
* by default, or the author's `<a>` through `render`), `ItemMedia`,
|
|
12
|
+
* `ItemContent`, `ItemTitle`, `ItemDescription` (a `p`), `ItemActions`,
|
|
13
|
+
* `ItemHeader`, `ItemFooter`, and `ItemSeparator` (a `Separator`).
|
|
14
|
+
*
|
|
15
|
+
* pont2: every part is host-as-root. A link item is the recipe on a real
|
|
16
|
+
* anchor: `<a data-pont2-item data-variant="outline" href="…">`.
|
|
17
|
+
* `ItemSeparator extends Separator`, so it *is* a separator (one node, role
|
|
18
|
+
* separator) that keeps the separator look and adds `data-slot="item-separator"`.
|
|
19
|
+
*/
|
|
20
|
+
/** @tag pont2-prim-item-group */
|
|
21
|
+
export declare class ItemGroup extends HostElement {
|
|
22
|
+
static identity: string;
|
|
23
|
+
static slotName: string;
|
|
24
|
+
static role: string;
|
|
25
|
+
}
|
|
26
|
+
/** @tag pont2-prim-item-separator */
|
|
27
|
+
export declare class ItemSeparator extends Separator {
|
|
28
|
+
static identity: string;
|
|
29
|
+
static slotName: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @tag pont2-prim-item
|
|
33
|
+
* @attr variant - default | outline | muted
|
|
34
|
+
* @attr size - default | sm | xs
|
|
35
|
+
*/
|
|
36
|
+
export declare class Item extends HostElement {
|
|
37
|
+
static identity: string;
|
|
38
|
+
static slotName: string;
|
|
39
|
+
static properties: PropertyDeclarations;
|
|
40
|
+
variant: ItemVariant;
|
|
41
|
+
size: ItemSize;
|
|
42
|
+
constructor();
|
|
43
|
+
protected willUpdate(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @tag pont2-prim-item-media
|
|
47
|
+
* @attr variant - default | icon | image
|
|
48
|
+
*/
|
|
49
|
+
export declare class ItemMedia extends HostElement {
|
|
50
|
+
static identity: string;
|
|
51
|
+
static slotName: string;
|
|
52
|
+
static properties: PropertyDeclarations;
|
|
53
|
+
variant: ItemMediaVariant;
|
|
54
|
+
constructor();
|
|
55
|
+
protected willUpdate(): void;
|
|
56
|
+
}
|
|
57
|
+
/** @tag pont2-prim-item-content */
|
|
58
|
+
export declare class ItemContent extends HostElement {
|
|
59
|
+
static identity: string;
|
|
60
|
+
static slotName: string;
|
|
61
|
+
}
|
|
62
|
+
/** @tag pont2-prim-item-title */
|
|
63
|
+
export declare class ItemTitle extends HostElement {
|
|
64
|
+
static identity: string;
|
|
65
|
+
static slotName: string;
|
|
66
|
+
}
|
|
67
|
+
/** @tag pont2-prim-item-description */
|
|
68
|
+
export declare class ItemDescription extends HostElement {
|
|
69
|
+
static identity: string;
|
|
70
|
+
static slotName: string;
|
|
71
|
+
}
|
|
72
|
+
/** @tag pont2-prim-item-actions */
|
|
73
|
+
export declare class ItemActions extends HostElement {
|
|
74
|
+
static identity: string;
|
|
75
|
+
static slotName: string;
|
|
76
|
+
}
|
|
77
|
+
/** @tag pont2-prim-item-header */
|
|
78
|
+
export declare class ItemHeader extends HostElement {
|
|
79
|
+
static identity: string;
|
|
80
|
+
static slotName: string;
|
|
81
|
+
}
|
|
82
|
+
/** @tag pont2-prim-item-footer */
|
|
83
|
+
export declare class ItemFooter extends HostElement {
|
|
84
|
+
static identity: string;
|
|
85
|
+
static slotName: string;
|
|
86
|
+
}
|
|
87
|
+
declare global {
|
|
88
|
+
interface HTMLElementTagNameMap {
|
|
89
|
+
"pont2-prim-item-group": ItemGroup;
|
|
90
|
+
"pont2-prim-item-separator": ItemSeparator;
|
|
91
|
+
"pont2-prim-item": Item;
|
|
92
|
+
"pont2-prim-item-media": ItemMedia;
|
|
93
|
+
"pont2-prim-item-content": ItemContent;
|
|
94
|
+
"pont2-prim-item-title": ItemTitle;
|
|
95
|
+
"pont2-prim-item-description": ItemDescription;
|
|
96
|
+
"pont2-prim-item-actions": ItemActions;
|
|
97
|
+
"pont2-prim-item-header": ItemHeader;
|
|
98
|
+
"pont2-prim-item-footer": ItemFooter;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HostElement } from '../../core/host-element';
|
|
2
|
+
/**
|
|
3
|
+
* # Kbd, KbdGroup: Tier 1 (structural)
|
|
4
|
+
*
|
|
5
|
+
* shadcn: `<Kbd>` → `<kbd data-slot="kbd">`; `<KbdGroup>` → `<kbd data-slot="kbd-group">`.
|
|
6
|
+
*
|
|
7
|
+
* pont2: the host is the key cap. `<kbd>` has no implicit ARIA role, so a
|
|
8
|
+
* custom element loses no semantics here. (If you need the literal element,
|
|
9
|
+
* use the recipe: `<kbd data-pont2-kbd>⌘</kbd>`.)
|
|
10
|
+
*
|
|
11
|
+
* @tag pont2-prim-kbd
|
|
12
|
+
*/
|
|
13
|
+
export declare class Kbd extends HostElement {
|
|
14
|
+
static identity: string;
|
|
15
|
+
static slotName: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @tag pont2-prim-kbd-group
|
|
19
|
+
*/
|
|
20
|
+
export declare class KbdGroup extends HostElement {
|
|
21
|
+
static identity: string;
|
|
22
|
+
static slotName: string;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
"pont2-prim-kbd": Kbd;
|
|
27
|
+
"pont2-prim-kbd-group": KbdGroup;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AttrMap } from '../../core/attrs';
|
|
2
|
+
import { NativeEnhancer } from '../../core/host-element';
|
|
3
|
+
/**
|
|
4
|
+
* # Label: Tier 3 (native-bound)
|
|
5
|
+
*
|
|
6
|
+
* shadcn: `<Label>` → a native `<label data-slot="label">`.
|
|
7
|
+
*
|
|
8
|
+
* It must be a real `<label>`: `for=` association, click-to-focus, and
|
|
9
|
+
* labelling form-associated custom elements (Checkbox, Switch …) only work
|
|
10
|
+
* on the native element. So:
|
|
11
|
+
*
|
|
12
|
+
* - recipe: `<label data-pont2-label for="email">Email</label>`
|
|
13
|
+
* - part: `label({ for: "email" }, "Email")`
|
|
14
|
+
* - enhancer: `<pont2-prim-label><label for="email">Email</label></pont2-prim-label>`
|
|
15
|
+
*/
|
|
16
|
+
export interface LabelOptions {
|
|
17
|
+
for?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
slot?: string;
|
|
20
|
+
/** Extra identities, e.g. FieldLabel passes `["field-label"]`. */
|
|
21
|
+
identities?: string[];
|
|
22
|
+
attrs?: AttrMap;
|
|
23
|
+
}
|
|
24
|
+
export declare function applyLabel(el: HTMLLabelElement, slot?: string): void;
|
|
25
|
+
export declare function label(o: LabelOptions, content: unknown): import('lit-html').TemplateResult<1>;
|
|
26
|
+
/**
|
|
27
|
+
* @tag pont2-prim-label
|
|
28
|
+
*/
|
|
29
|
+
export declare class Pont2Label extends NativeEnhancer<HTMLLabelElement> {
|
|
30
|
+
static nativeSelector: string;
|
|
31
|
+
protected apply(control: HTMLLabelElement): void;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
"pont2-prim-label": Pont2Label;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PropertyDeclarations } from 'lit';
|
|
2
|
+
import { AttrMap } from '../../core/attrs';
|
|
3
|
+
import { HostElement } from '../../core/host-element';
|
|
4
|
+
export type NativeSelectSize = "default" | "sm";
|
|
5
|
+
/**
|
|
6
|
+
* # NativeSelect: Tier 1 wrapper + native `<select>`
|
|
7
|
+
*
|
|
8
|
+
* shadcn: `<NativeSelect size>` renders
|
|
9
|
+
* `div[data-slot=native-select-wrapper][data-size] > select[data-slot=native-select][data-size] + svg[data-slot=native-select-icon]`;
|
|
10
|
+
* `NativeSelectOption` / `NativeSelectOptGroup` are `<option>` / `<optgroup>`.
|
|
11
|
+
*
|
|
12
|
+
* pont2: `<pont2-prim-native-select>` **is** the wrapper div; you write the native
|
|
13
|
+
* `<select>` (and its options) inside, and the host applies the recipe to it.
|
|
14
|
+
* The chevron is drawn by the wrapper's `::after`, so the DOM is
|
|
15
|
+
* `pont2-prim-native-select > select`: one node fewer than shadcn, and the select
|
|
16
|
+
* stays a real form control (submission, autofill, mobile pickers).
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <pont2-prim-native-select>
|
|
20
|
+
* <select name="country"><option>Norway</option><option>Japan</option></select>
|
|
21
|
+
* </pont2-prim-native-select>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @tag pont2-prim-native-select
|
|
25
|
+
* @attr size - default | sm
|
|
26
|
+
* @cssprop --pont2-native-select-icon - mask image for the chevron
|
|
27
|
+
*/
|
|
28
|
+
export declare class NativeSelect extends HostElement {
|
|
29
|
+
static identity: string;
|
|
30
|
+
static slotName: string;
|
|
31
|
+
static properties: PropertyDeclarations;
|
|
32
|
+
size: NativeSelectSize;
|
|
33
|
+
private observer?;
|
|
34
|
+
constructor();
|
|
35
|
+
/** The native `<select>`. */
|
|
36
|
+
get control(): HTMLSelectElement | null;
|
|
37
|
+
connectedCallback(): void;
|
|
38
|
+
disconnectedCallback(): void;
|
|
39
|
+
focus(options?: FocusOptions): void;
|
|
40
|
+
protected willUpdate(): void;
|
|
41
|
+
}
|
|
42
|
+
export declare function applyNativeSelect(el: HTMLSelectElement, size?: NativeSelectSize): void;
|
|
43
|
+
export interface NativeSelectOptions {
|
|
44
|
+
size?: NativeSelectSize;
|
|
45
|
+
id?: string;
|
|
46
|
+
name?: string;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
invalid?: boolean;
|
|
50
|
+
attrs?: AttrMap;
|
|
51
|
+
onChange?: (e: Event) => void;
|
|
52
|
+
}
|
|
53
|
+
/** Part: the wrapper div and the select in one template (options are the content). */
|
|
54
|
+
export declare function nativeSelect(o: NativeSelectOptions, options: unknown): import('lit-html').TemplateResult<1>;
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
"pont2-prim-native-select": NativeSelect;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { HostElement } from '../../core/host-element';
|
|
2
|
+
import { PopupContent } from '../../core/popup/popup-content';
|
|
3
|
+
import { PopupRoot, PopupTrigger } from '../../core/popup/popup-root';
|
|
4
|
+
/**
|
|
5
|
+
* # Popover
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Popover>` (Base UI `Popover.Root`, renders nothing) >
|
|
8
|
+
* `<PopoverTrigger>` (a `<button>`) + `<PopoverContent>` (Portal > Positioner >
|
|
9
|
+
* `<div data-slot="popover-content">`), with `PopoverHeader/Title/Description`.
|
|
10
|
+
*
|
|
11
|
+
* pont2:
|
|
12
|
+
* ```html
|
|
13
|
+
* <pont2-prim-popover> coordinator, display: contents
|
|
14
|
+
* <pont2-prim-popover-trigger><button data-pont2-button data-variant="outline">Open</button></pont2-prim-popover-trigger>
|
|
15
|
+
* <pont2-prim-popover-content> the popup itself: [popover], role=dialog
|
|
16
|
+
* <pont2-prim-popover-header>
|
|
17
|
+
* <pont2-prim-popover-title>Dimensions</pont2-prim-popover-title>
|
|
18
|
+
* <pont2-prim-popover-description>Set the dimensions for the layer.</pont2-prim-popover-description>
|
|
19
|
+
* </pont2-prim-popover-header>
|
|
20
|
+
* …
|
|
21
|
+
* </pont2-prim-popover-content>
|
|
22
|
+
* </pont2-prim-popover>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @tag pont2-prim-popover
|
|
26
|
+
* @attr open - Open state (initially: Base UI `defaultOpen`; property: controlled `open`).
|
|
27
|
+
* @fires pont2-open-change - cancelable, `{ open, reason }`.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Popover extends PopupRoot {
|
|
30
|
+
static identity: string;
|
|
31
|
+
get triggerElement(): HTMLButtonElement | null;
|
|
32
|
+
get contentElement(): PopoverContent | null;
|
|
33
|
+
protected get popupKind(): "dialog";
|
|
34
|
+
protected afterOpen(): void;
|
|
35
|
+
}
|
|
36
|
+
/** @tag pont2-prim-popover-trigger */
|
|
37
|
+
export declare class PopoverTrigger extends PopupTrigger {
|
|
38
|
+
static rootTag: string;
|
|
39
|
+
static controlSlot: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The popup. Non-modal, like Base UI's default: closes on Escape, on a press
|
|
43
|
+
* outside, and when focus leaves both the popup and its trigger.
|
|
44
|
+
*
|
|
45
|
+
* @tag pont2-prim-popover-content
|
|
46
|
+
* @attr side - bottom (default) | top | left | right | inline-start | inline-end
|
|
47
|
+
* @attr align - center (default) | start | end
|
|
48
|
+
* @attr side-offset - default 4
|
|
49
|
+
* @attr align-offset - default 0
|
|
50
|
+
*/
|
|
51
|
+
export declare class PopoverContent extends PopupContent {
|
|
52
|
+
static identity: string;
|
|
53
|
+
static slotName: string;
|
|
54
|
+
static role: string;
|
|
55
|
+
constructor();
|
|
56
|
+
show(): void;
|
|
57
|
+
private onFocusOut;
|
|
58
|
+
}
|
|
59
|
+
/** @tag pont2-prim-popover-header */
|
|
60
|
+
export declare class PopoverHeader extends HostElement {
|
|
61
|
+
static identity: string;
|
|
62
|
+
static slotName: string;
|
|
63
|
+
}
|
|
64
|
+
/** Base UI `Popover.Title` renders an `<h2>`; pont2 keeps the heading semantics through internals. @tag pont2-prim-popover-title */
|
|
65
|
+
export declare class PopoverTitle extends HostElement {
|
|
66
|
+
static identity: string;
|
|
67
|
+
static slotName: string;
|
|
68
|
+
static role: string;
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
}
|
|
71
|
+
/** Base UI `Popover.Description` renders a `<p>`. @tag pont2-prim-popover-description */
|
|
72
|
+
export declare class PopoverDescription extends HostElement {
|
|
73
|
+
static identity: string;
|
|
74
|
+
static slotName: string;
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
"pont2-prim-popover": Popover;
|
|
79
|
+
"pont2-prim-popover-trigger": PopoverTrigger;
|
|
80
|
+
"pont2-prim-popover-content": PopoverContent;
|
|
81
|
+
"pont2-prim-popover-header": PopoverHeader;
|
|
82
|
+
"pont2-prim-popover-title": PopoverTitle;
|
|
83
|
+
"pont2-prim-popover-description": PopoverDescription;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
|
|
2
|
+
import { HostElement } from '../../core/host-element';
|
|
3
|
+
export type ProgressStatus = "progressing" | "complete" | "indeterminate";
|
|
4
|
+
/**
|
|
5
|
+
* # Progress, ProgressLabel, ProgressValue: Tier 1/2 (status widget)
|
|
6
|
+
*
|
|
7
|
+
* shadcn: `<Progress value>` → Base UI `<Progress.Root>` (div[role=progressbar])
|
|
8
|
+
* holding the author's children, then `<Progress.Track>` > `<Progress.Indicator>`
|
|
9
|
+
* which shadcn always appends. `<ProgressLabel>` / `<ProgressValue>` are optional
|
|
10
|
+
* children (span).
|
|
11
|
+
*
|
|
12
|
+
* pont2:
|
|
13
|
+
* ```
|
|
14
|
+
* pont2-prim-progress[role=progressbar] ← root; aria-value* via ElementInternals
|
|
15
|
+
* pont2-prim-progress-label? pont2-prim-progress-value? ← author-written, never moved
|
|
16
|
+
* div[data-slot=progress-track] > div[data-slot=progress-indicator] ← rendered last, as shadcn does
|
|
17
|
+
* ```
|
|
18
|
+
* Status attributes are Base UI's: `data-progressing` | `data-complete` |
|
|
19
|
+
* `data-indeterminate`, on every part. No `value` attribute = indeterminate.
|
|
20
|
+
*
|
|
21
|
+
* @tag pont2-prim-progress
|
|
22
|
+
* @attr value - Current value; omit for indeterminate.
|
|
23
|
+
* @attr min, max - Range (default 0–100).
|
|
24
|
+
*/
|
|
25
|
+
export declare class Progress extends HostElement {
|
|
26
|
+
static identity: string;
|
|
27
|
+
static slotName: string;
|
|
28
|
+
static role: string;
|
|
29
|
+
static properties: PropertyDeclarations;
|
|
30
|
+
value: number | null;
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
constructor();
|
|
34
|
+
get status(): ProgressStatus;
|
|
35
|
+
/** 0..1, or null when indeterminate. */
|
|
36
|
+
get fraction(): number | null;
|
|
37
|
+
/** The value as Base UI formats it by default: a locale percentage. */
|
|
38
|
+
get formattedValue(): string;
|
|
39
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
40
|
+
protected updated(): void;
|
|
41
|
+
private own;
|
|
42
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
/** Shared status sync for the optional parts. */
|
|
45
|
+
declare abstract class ProgressPart extends HostElement {
|
|
46
|
+
connectedCallback(): void;
|
|
47
|
+
/** @internal Called by the root. */
|
|
48
|
+
sync(status: ProgressStatus, _formatted: string): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Labels the progress bar (the root's accessible name points at it).
|
|
52
|
+
* @tag pont2-prim-progress-label
|
|
53
|
+
*/
|
|
54
|
+
export declare class ProgressLabel extends ProgressPart {
|
|
55
|
+
static identity: string;
|
|
56
|
+
static slotName: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Shows the formatted value ("45%") unless you write your own text inside it.
|
|
60
|
+
* @tag pont2-prim-progress-value
|
|
61
|
+
*/
|
|
62
|
+
export declare class ProgressValue extends ProgressPart {
|
|
63
|
+
static identity: string;
|
|
64
|
+
static slotName: string;
|
|
65
|
+
static properties: PropertyDeclarations;
|
|
66
|
+
protected formatted: string;
|
|
67
|
+
private authored;
|
|
68
|
+
constructor();
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
sync(status: ProgressStatus, formatted: string): void;
|
|
71
|
+
render(): string | typeof nothing;
|
|
72
|
+
}
|
|
73
|
+
declare global {
|
|
74
|
+
interface HTMLElementTagNameMap {
|
|
75
|
+
"pont2-prim-progress": Progress;
|
|
76
|
+
"pont2-prim-progress-label": ProgressLabel;
|
|
77
|
+
"pont2-prim-progress-value": ProgressValue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export {};
|