@pontive/pontkit-core 1.39.0 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/catalog.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/index.js +1410 -1263
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +14296 -12214
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/pont2/core/context-root.d.ts +1 -0
  8. package/dist/pont2/core/events.d.ts +1 -1
  9. package/dist/pont2/core/icons.d.ts +6 -0
  10. package/dist/pont2/core/index.d.ts +1 -0
  11. package/dist/pont2/core/messages.d.ts +21 -0
  12. package/dist/pont2/core/popup/index.d.ts +1 -0
  13. package/dist/pont2/core/popup/modal.d.ts +56 -0
  14. package/dist/pont2/core/popup/popup-content.d.ts +7 -0
  15. package/dist/pont2/core/popup/story-helpers.d.ts +6 -0
  16. package/dist/pont2/custom-elements.json +42864 -18238
  17. package/dist/pont2/index.d.ts +7 -0
  18. package/dist/pont2/index.mjs +4434 -2359
  19. package/dist/pont2/index.mjs.map +1 -1
  20. package/dist/pont2/kit/badge-selector/badge-selector.d.ts +65 -0
  21. package/dist/pont2/kit/consent/consent.d.ts +3 -2
  22. package/dist/pont2/kit/data-table/data-table.d.ts +120 -0
  23. package/dist/pont2/kit/data-table/rows.d.ts +25 -0
  24. package/dist/pont2/kit/flow-widget/flow-widget.d.ts +21 -8
  25. package/dist/pont2/kit/index.d.ts +7 -0
  26. package/dist/pont2/kit/layout/layout.d.ts +7 -0
  27. package/dist/pont2/kit/multi-email-input/emails.d.ts +19 -0
  28. package/dist/pont2/kit/multi-email-input/multi-email-input.d.ts +78 -0
  29. package/dist/pont2/kit/multi-select-filter/multi-select-filter.d.ts +53 -0
  30. package/dist/pont2/kit/pagination/pagination.d.ts +61 -0
  31. package/dist/pont2/kit/pagination/range.d.ts +17 -0
  32. package/dist/pont2/kit/provider/coexistence.d.ts +19 -0
  33. package/dist/pont2/kit/provider/contexts.d.ts +46 -0
  34. package/dist/pont2/kit/provider/provider.d.ts +185 -0
  35. package/dist/pont2/kit/provider/redirect.d.ts +122 -0
  36. package/dist/pont2/kit/provider/runtime-config.d.ts +24 -0
  37. package/dist/pont2/kit/provider/sdk.d.ts +86 -0
  38. package/dist/pont2/kit/provider/signed-in.d.ts +81 -0
  39. package/dist/pont2/kit/provider/widget-messages.d.ts +35 -0
  40. package/dist/pont2/primitives/alert-dialog/alert-dialog.d.ts +132 -0
  41. package/dist/pont2/primitives/combobox/combobox.d.ts +82 -14
  42. package/dist/pont2/primitives/dialog/dialog.d.ts +195 -0
  43. package/dist/pont2/primitives/drawer/drawer.d.ts +112 -0
  44. package/dist/pont2/primitives/hover-card/hover-card.d.ts +83 -0
  45. package/dist/pont2/primitives/pagination/pagination.d.ts +120 -0
  46. package/dist/pont2/primitives/sheet/sheet.d.ts +92 -0
  47. package/dist/pont2/primitives/sonner/sonner.d.ts +86 -0
  48. package/dist/pont2/primitives/sonner/toast-store.d.ts +81 -0
  49. package/dist/pont2/styles.css +1322 -75
  50. package/dist/pont2/theme/tokens.json.d.ts +700 -1
  51. package/dist/pont2/theme-golden.json +45 -45
  52. package/dist/pont2/theme.mjs +119 -119
  53. package/dist/pont2/tokens.json +700 -1
  54. package/dist/styles.css +1323 -76
  55. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { MessagesController } from '../../core/messages';
3
+ import { Combobox } from '../../primitives/combobox/combobox';
4
+ export interface BadgeOption {
5
+ value: string;
6
+ label: string;
7
+ /**
8
+ * Can't be added, and **locked** when selected: its badge has no remove
9
+ * button (a role the person may not assign or take away).
10
+ */
11
+ disabled?: boolean;
12
+ }
13
+ /**
14
+ * # `<pont2-badge-selector>`: kit composite over a multiple `<pont2-prim-combobox>`
15
+ *
16
+ * Pick several options as badges, with type-to-filter: the account widgets'
17
+ * role picker (legacy `pont-badge-selector`). It **is** the Combobox
18
+ * primitive's root in `multiple` mode (form-associated: it submits one
19
+ * `name=value` per selected value), and renders shadcn's multiple-combobox
20
+ * DOM inside it: the chips input, then the popup with the list of options.
21
+ *
22
+ * ```html
23
+ * <pont2-badge-selector name="roles" placeholder="Search roles"></pont2-badge-selector>
24
+ * <script>
25
+ * el.options = [{ value: "owner", label: "Owner", disabled: true }, { value: "admin", label: "Admin" }];
26
+ * el.values = ["owner"]; // owner is locked in
27
+ * el.addEventListener("change", () => save(el.values));
28
+ * </script>
29
+ * ```
30
+ *
31
+ * - **Locked badges:** a selected option with `disabled` can't be removed
32
+ * (no remove button, Backspace skips it) and a disabled option can't be
33
+ * added.
34
+ * - **`max-selections`:** once reached, the unselected options are disabled.
35
+ * - Events are the Combobox's: `input` and `change` when the selection
36
+ * changes (read `values`), `pont2-open-change`.
37
+ *
38
+ * Default words are `msg()` codes: `search_roles` (placeholder), `no_options`
39
+ * (nothing matches).
40
+ *
41
+ * @tag pont2-badge-selector
42
+ * @attr name, required, disabled - as the Combobox's
43
+ * @attr placeholder - shown while nothing is selected (default `msg("search_roles")`)
44
+ * @attr empty-label - shown when no option matches (default `msg("no_options")`)
45
+ * @attr max-selections - the most values that can be selected
46
+ * @fires input, change - the selection changed (read `values`)
47
+ */
48
+ export declare class BadgeSelector extends Combobox {
49
+ static composite: boolean;
50
+ static properties: PropertyDeclarations;
51
+ options: BadgeOption[];
52
+ placeholder: string;
53
+ emptyLabel: string;
54
+ maxSelections: number | undefined;
55
+ protected readonly messages: MessagesController;
56
+ constructor();
57
+ get maxReached(): boolean;
58
+ protected willUpdate(changed: PropertyValues): void;
59
+ render(): import('lit-html').TemplateResult<1>;
60
+ }
61
+ declare global {
62
+ interface HTMLElementTagNameMap {
63
+ "pont2-badge-selector": BadgeSelector;
64
+ }
65
+ }
@@ -41,7 +41,7 @@ export { CONSENT_EXPIRED_EN, ConsentError, consentEndpoint, consentExpired, fetc
41
41
  * @attr consent-request - the consent request's id (the page's `consent_request` parameter)
42
42
  * @attr base-url - where auth-api is; empty (default) means same origin, which the session cookie needs
43
43
  * @attr locales - preferred languages, passed to the load (`?locales=`)
44
- * @prop branding - the account's branding entitlements (fail closed: the watermark shows)
44
+ * @prop branding - the account's branding entitlements (this, else a `pont2-provider`'s; fail closed: the watermark shows)
45
45
  */
46
46
  export declare class Consent extends HostElement {
47
47
  static identity: string;
@@ -49,7 +49,8 @@ export declare class Consent extends HostElement {
49
49
  consentRequest: string;
50
50
  baseUrl: string;
51
51
  locales: string;
52
- branding: BrandingEntitlements;
52
+ branding: BrandingEntitlements | undefined;
53
+ private readonly brandingConsumer;
53
54
  protected renderSpec: string;
54
55
  protected loadError: {
55
56
  message: string;
@@ -0,0 +1,120 @@
1
+ import { PropertyDeclarations, PropertyValues, TemplateResult } from 'lit';
2
+ import { MessagesController } from '../../core/messages';
3
+ import { Table } from '../../primitives/table/table';
4
+ import { SortDirection } from './rows';
5
+ export { bodyState, nextSort, sortRows, type SortDirection, type SortState } from './rows';
6
+ export type DataTableRow = any;
7
+ /** One column. Everything but `key` and `header` is optional. */
8
+ export interface DataTableColumn<T = DataTableRow> {
9
+ /** The row field shown (and sorted on) by default; also the column's id in events. */
10
+ key: string;
11
+ /** Header text. */
12
+ header: string;
13
+ /** What the cell shows: text or a Lit template. Default: `row[key]` as text. */
14
+ cell?: (row: T, index: number) => unknown;
15
+ /** The header becomes a sort button. */
16
+ sortable?: boolean;
17
+ /** What the column sorts by (default `row[key]`): numbers and dates by value, text by the page's collation. */
18
+ sortValue?: (row: T) => unknown;
19
+ /** Cell alignment (default start). */
20
+ align?: "start" | "center" | "end";
21
+ }
22
+ /** One entry in each row's actions menu. */
23
+ export interface DataTableAction<T = DataTableRow> {
24
+ /** Sent in `pont2-row-action`. */
25
+ action: string;
26
+ label: string;
27
+ variant?: "default" | "destructive";
28
+ /** Leave the action out of this row's menu. */
29
+ hidden?: (row: T) => boolean;
30
+ disabled?: (row: T) => boolean;
31
+ }
32
+ export interface RowActionDetail<T = DataTableRow> {
33
+ action: string;
34
+ row: T;
35
+ key: string;
36
+ }
37
+ export interface SortChangeDetail {
38
+ key: string | null;
39
+ direction: SortDirection;
40
+ }
41
+ /**
42
+ * # `<pont2-data-table>`: kit composite over `<pont2-prim-table>`
43
+ *
44
+ * shadcn's "Data Table" is a recipe (TanStack Table + `<Table>`), not a
45
+ * component. This is that recipe as one element, with what the account
46
+ * widgets need (tracker W-11): columns, rows, sortable headers, a per-row
47
+ * actions menu, a loading state and an empty state. It **is** the table
48
+ * container (`extends Table`) and renders a native `<table>` inside it, which
49
+ * the Table primitive's recipe styles as it does any table.
50
+ *
51
+ * ```ts
52
+ * table.columns = [
53
+ * { key: "name", header: "Name", sortable: true },
54
+ * { key: "joined", header: "Joined", sortable: true, cell: r => formatDate(r.joined) },
55
+ * ];
56
+ * table.actions = [{ action: "remove", label: "Remove member", variant: "destructive", hidden: r => r.isOwner }];
57
+ * table.rows = members;
58
+ * ```
59
+ *
60
+ * - **Sorting:** pressing a sortable header cycles ascending → descending →
61
+ * unsorted and fires a cancelable `pont2-sort-change` `{ key, direction }`.
62
+ * Rows are sorted here unless `manual-sort` is set (server-side sorting:
63
+ * sort in the handler and set `rows`). The header carries `aria-sort`.
64
+ * - **Actions:** with `actions`, each row ends in a "⋯" menu (a Dropdown Menu
65
+ * primitive) labelled `actions-label`; an item fires `pont2-row-action`
66
+ * `{ action, row, key }`.
67
+ * - **Loading:** `loading` shows `loading-rows` skeleton rows and sets
68
+ * `aria-busy`.
69
+ * - **Empty:** no rows shows one full-width row with `empty-label`.
70
+ *
71
+ * Default words are `msg()` codes: `no_results`, `actions_menu`.
72
+ *
73
+ * @tag pont2-data-table
74
+ * @attr row-key - the row field that identifies a row (default `id`); the `rowKey` property may also be a function
75
+ * @attr sort-key, sort-direction - the current sort (`asc` | `desc`); set them to sort initially or to control it
76
+ * @attr manual-sort - don't sort the rows here, only report `pont2-sort-change`
77
+ * @attr loading - show skeleton rows
78
+ * @attr loading-rows - how many (default 5)
79
+ * @attr empty-label - shown when there are no rows (default `msg("no_results")`)
80
+ * @attr actions-label - the accessible name of each row's actions button (default `msg("actions_menu")`)
81
+ * @attr caption - a caption under the table
82
+ * @fires pont2-sort-change - cancelable `{ key, direction }`, a sortable header was pressed
83
+ * @fires pont2-row-action - `{ action, row, key }`, a row action was chosen
84
+ */
85
+ export declare class DataTable extends Table {
86
+ static composite: boolean;
87
+ static properties: PropertyDeclarations;
88
+ columns: DataTableColumn[];
89
+ rows: DataTableRow[];
90
+ actions: DataTableAction[];
91
+ rowKey: string | ((row: DataTableRow) => string);
92
+ sortKey: string | null;
93
+ sortDirection: SortDirection;
94
+ manualSort: boolean;
95
+ loading: boolean;
96
+ loadingRows: number;
97
+ emptyLabel: string;
98
+ actionsLabel: string;
99
+ caption: string;
100
+ protected readonly messages: MessagesController;
101
+ constructor();
102
+ /** The rows in the order shown. */
103
+ get visibleRows(): DataTableRow[];
104
+ /** Press a column's sort, as the user did. Returns false if a listener cancelled it. */
105
+ toggleSort(key: string): boolean;
106
+ private keyOf;
107
+ protected willUpdate(changed: PropertyValues): void;
108
+ private headerCell;
109
+ private actionsCell;
110
+ render(): TemplateResult<1>;
111
+ }
112
+ declare global {
113
+ interface HTMLElementTagNameMap {
114
+ "pont2-data-table": DataTable;
115
+ }
116
+ interface HTMLElementEventMap {
117
+ "pont2-sort-change": CustomEvent<SortChangeDetail>;
118
+ "pont2-row-action": CustomEvent<RowActionDetail>;
119
+ }
120
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The data table's pure logic (rows.test.ts): sorting and the three-step
3
+ * sort cycle. Kept out of the element so it runs without a DOM.
4
+ */
5
+ export type SortDirection = "asc" | "desc";
6
+ export interface SortState {
7
+ key: string | null;
8
+ direction: SortDirection;
9
+ }
10
+ /**
11
+ * The next sort after pressing a column's header: a new column sorts
12
+ * ascending, then the same column descending, then unsorted (the legacy
13
+ * `pont-data-table` cycle, and TanStack's default).
14
+ */
15
+ export declare function nextSort(current: SortState, key: string): SortState;
16
+ /** A value comparable across types: numbers and dates by value, strings by the locale's collation, empty last. */
17
+ export declare function compareValues(a: unknown, b: unknown, collator: Intl.Collator): number;
18
+ /**
19
+ * `rows` sorted by `sortValue(row)` in `direction`, stably (rows that compare
20
+ * equal keep their order). Empty values sort last in both directions. Returns
21
+ * a new array; with no key, the rows as given.
22
+ */
23
+ export declare function sortRows<T>(rows: readonly T[], sort: SortState, sortValue: (row: T, key: string) => unknown, locale?: string): T[];
24
+ /** What the body shows: skeleton rows while loading, the empty row when there is nothing, else the rows. */
25
+ export declare function bodyState(loading: boolean, rowCount: number): "loading" | "empty" | "rows";
@@ -76,8 +76,12 @@ export declare function escapeAttr(value: string): string;
76
76
  * Nesting `pont2-layout` in a kit template is the allow-listed case (docs/10
77
77
  * §5 rule 6): the layout is the stateful flow host, one per widget.
78
78
  *
79
- * @prop client - `WidgetClient` (e.g. the SDK's `Auth`); the flow starts once it is set and the widget is connected
80
- * @prop branding - `BrandingEntitlements` from the backend (attribute-less; fails closed)
79
+ * Inside a `<pont2-provider>` it needs nothing: the provider's client
80
+ * (`pont2:client`), branding entitlements (`pont2:branding`) and login hint
81
+ * (`pont2:login-hint`) are used unless the widget is given its own.
82
+ *
83
+ * @prop client - `WidgetClient` (e.g. the SDK's `Auth`); the flow starts once there is one (this, else the provider's) and the widget is connected
84
+ * @prop branding - `BrandingEntitlements` from the backend (attribute-less; this, else the provider's, else fail closed)
81
85
  * @attr flow-id - the flow to start (each widget has a default)
82
86
  * @fires pont2-flow-response - (from the layout) after every successful request
83
87
  */
@@ -86,8 +90,10 @@ export declare abstract class FlowWidget extends HostElement {
86
90
  static slotName: string;
87
91
  static composite: boolean;
88
92
  static properties: PropertyDeclarations;
93
+ /** The app's own client. Wins over the provider's. */
89
94
  client: WidgetClient | undefined;
90
- branding: BrandingEntitlements;
95
+ /** The app's own entitlements. Win over the provider's; without either, the watermark shows. */
96
+ branding: BrandingEntitlements | undefined;
91
97
  flowId: string;
92
98
  protected renderSpec: string;
93
99
  protected messages: Partial<Record<string, string>>;
@@ -98,12 +104,20 @@ export declare abstract class FlowWidget extends HostElement {
98
104
  } | null;
99
105
  /** Re-renders when the page's message table changes (the loading label). */
100
106
  protected readonly messagesController: MessagesController;
107
+ /** The provider's client (`pont2:client`), undefined until it has configured the SDK. */
108
+ protected providedClient: WidgetClient | undefined;
109
+ private readonly brandingConsumer;
110
+ private readonly hintConsumer;
101
111
  /** The SDK's `flowType` this widget runs ("signin", "signup"): which flow-state events apply. */
102
112
  protected abstract readonly flowType: string;
103
113
  private started;
104
114
  constructor();
105
115
  /** The widget's layout. */
106
116
  get layout(): Layout | null;
117
+ /** The client the flow runs on: the widget's own, else the provider's. */
118
+ get effectiveClient(): WidgetClient | undefined;
119
+ /** Whether the flow runs on the provider's client (which restarts it on a locale change). */
120
+ get usesProvidedClient(): boolean;
107
121
  /** Starts the flow over. */
108
122
  restart(): Promise<void>;
109
123
  /** Applies an SDK flow-state change (what `dispatchFlowState` delivers). */
@@ -155,11 +169,10 @@ export declare class SignUp extends FlowWidget {
155
169
  *
156
170
  * It starts with **no flow id**: the SDK takes the invitation flow from the
157
171
  * page's path, so the app names that path as `invitationUrl` when it configures
158
- * the SDK (the legacy provider's `env.invitationUrl`; `<pont2-provider>` will
159
- * do it, W-1). An invitation answered by the sign-in flow would sign the invitee
160
- * in and join them to nothing, which is why this is its own element. The page
161
- * should also drop an existing session before the flow (the legacy
162
- * `answersInvitation`; the provider's job, W-1).
172
+ * the SDK (`<pont2-provider invitation-url>`). An invitation answered by the
173
+ * sign-in flow would sign the invitee in and join them to nothing, which is why
174
+ * this is its own element. The page should also drop an existing session before
175
+ * the flow, which `<pont2-provider>` does on a page opened with `?invite_token=`.
163
176
  *
164
177
  * Everything on screen comes from the flow's render spec: the instance's own
165
178
  * invitation widgets if it published any, else the built-in ones.
@@ -27,3 +27,10 @@ export * from './consent/consent';
27
27
  export * from './flow-widget/flow-widget';
28
28
  export * from './flow-widget/preview';
29
29
  export * from './flow-widget/specimens';
30
+ export * from './provider/provider';
31
+ export * from './provider/signed-in';
32
+ export * from './pagination/pagination';
33
+ export * from './data-table/data-table';
34
+ export * from './badge-selector/badge-selector';
35
+ export * from './multi-email-input/multi-email-input';
36
+ export * from './multi-select-filter/multi-select-filter';
@@ -71,6 +71,7 @@ export declare function formDataToObject(fd: FormData | undefined | null): Recor
71
71
  * @prop renderSpec - the screen's HTML
72
72
  * @prop branding - `BrandingEntitlements` (attribute-less on purpose)
73
73
  * @prop messages - localised flow messages by code (the flow's `messages`)
74
+ * @prop loginHint - the identifier to pre-fill email and identifier fields with (the URL's `login_hint`, from the provider)
74
75
  * @fires pont2-flow-response - `{ action, result }` after every successful request
75
76
  * @fires pont2-layout-restart - "Start again" pressed (the widget restarts the flow)
76
77
  * @fires pont2-unregistered-element - on `document`, `{ tag }`
@@ -89,6 +90,12 @@ export declare class Layout extends HostElement {
89
90
  */
90
91
  designMode: boolean;
91
92
  messages: Partial<Record<string, string>>;
93
+ /**
94
+ * The identifier the page was opened with (OpenID Connect's `login_hint`). Email and identifier
95
+ * fields the screen leaves without a `value` are pre-filled with it, as the legacy fields did by
96
+ * reading the URL themselves (migration tracker F-11). A server prefill (`value`) wins.
97
+ */
98
+ loginHint: string | undefined;
92
99
  protected busy: boolean;
93
100
  private provider;
94
101
  private designProvider;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The multi-email input's pure logic (emails.test.ts).
3
+ */
4
+ /** `text` split into candidate addresses (trimmed, empty pieces dropped). */
5
+ export declare function splitEmails(text: string): string[];
6
+ export declare function isEmail(text: string): boolean;
7
+ export interface AddResult {
8
+ /** The new list (`current` plus what was accepted). */
9
+ values: string[];
10
+ /** Candidates that are not valid addresses, in the order given. */
11
+ invalid: string[];
12
+ /** Valid candidates left out because `max` was reached. */
13
+ overflow: string[];
14
+ }
15
+ /**
16
+ * Adds `candidates` to `current`: valid addresses only, each once (compared
17
+ * case-insensitively, the first spelling kept), up to `max` in total.
18
+ */
19
+ export declare function addEmails(current: readonly string[], candidates: readonly string[], max?: number): AddResult;
@@ -0,0 +1,78 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { FormControlElement, ValidityResult } from '../../core/form-control';
3
+ import { MessagesController } from '../../core/messages';
4
+ export { addEmails, isEmail, splitEmails, type AddResult } from './emails';
5
+ /**
6
+ * # `<pont2-multi-email-input>`: several email addresses as removable chips
7
+ *
8
+ * The account widgets' "invite members" field (legacy `pont-multi-email-input`).
9
+ * Type or paste addresses: Enter, a comma, a semicolon, a space, a paste or
10
+ * leaving the field turns what was typed into chips; invalid addresses stay
11
+ * out and are named in an error below. Backspace in the empty input removes
12
+ * the last chip.
13
+ *
14
+ * It is a form control (form-associated: one `name=address` entry per
15
+ * address, `required`, `disabled`, reset), labelled by its `<label for>`. It
16
+ * reuses the multiple Combobox's chips recipe (`ComboboxChips.part()`: the
17
+ * same box, chips and input as `<pont2-badge-selector>`), with a Field
18
+ * description (a count, `3 / 50`) or error under it.
19
+ *
20
+ * ```html
21
+ * <label data-pont2-label for="invite">Email addresses</label>
22
+ * <pont2-multi-email-input id="invite" name="emails" max="50" required></pont2-multi-email-input>
23
+ * ```
24
+ *
25
+ * Words are `msg()` codes: `invite_emails_placeholder`, `invalid_emails`,
26
+ * `email_limit_reached`, `action_remove`. The counter is formatted for the
27
+ * page's language.
28
+ *
29
+ * @tag pont2-multi-email-input
30
+ * @attr name, required, disabled - as a native control's
31
+ * @attr placeholder - shown while empty (default `msg("invite_emails_placeholder")`)
32
+ * @attr max - the most addresses (default 50)
33
+ * @fires input, change - the list changed (read `values`)
34
+ */
35
+ export declare class MultiEmailInput extends FormControlElement {
36
+ static identity: string;
37
+ static composite: boolean;
38
+ static properties: PropertyDeclarations;
39
+ values: string[];
40
+ placeholder: string;
41
+ max: number;
42
+ /** What the last attempt could not add. */
43
+ protected invalid: string[];
44
+ protected limitReached: boolean;
45
+ protected readonly messages: MessagesController;
46
+ private readonly inputId;
47
+ private readonly hintId;
48
+ private defaultValues;
49
+ constructor();
50
+ protected get hostFocusable(): boolean;
51
+ get input(): HTMLInputElement | null;
52
+ focus(options?: FocusOptions): void;
53
+ /** Add addresses (as if typed). Returns what could not be added. */
54
+ add(text: string | string[]): {
55
+ invalid: string[];
56
+ overflow: string[];
57
+ };
58
+ removeEmail(email: string): void;
59
+ private commit;
60
+ /** Turn the typed text into chips; keeps anything invalid in the input to fix. */
61
+ private flush;
62
+ private onKeyDown;
63
+ private onPaste;
64
+ private onInput;
65
+ protected formValue(): FormData | null;
66
+ protected resetToDefault(): void;
67
+ protected restoreState(state: string | File | FormData | null): void;
68
+ protected validate(): ValidityResult | null;
69
+ protected get validationAnchor(): HTMLElement | undefined;
70
+ protected willUpdate(changed: PropertyValues): void;
71
+ protected updated(changed: PropertyValues): void;
72
+ render(): import('lit-html').TemplateResult<1>;
73
+ }
74
+ declare global {
75
+ interface HTMLElementTagNameMap {
76
+ "pont2-multi-email-input": MultiEmailInput;
77
+ }
78
+ }
@@ -0,0 +1,53 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { MessagesController } from '../../core/messages';
3
+ import { DropdownMenu } from '../../primitives/dropdown-menu/dropdown-menu';
4
+ export interface FilterOption {
5
+ value: string;
6
+ label: string;
7
+ }
8
+ /**
9
+ * # `<pont2-multi-select-filter>`: a "filter by" menu of checkboxes
10
+ *
11
+ * The account widgets' role filter (legacy `pont-multi-select-filter`), as
12
+ * shadcn builds a faceted filter: an outline button with the filter's name
13
+ * and a count badge, opening a Dropdown Menu of checkbox items, plus "Clear
14
+ * filters" when something is chosen. It **is** the Dropdown Menu primitive's
15
+ * root (`extends DropdownMenu`, a `display: contents` coordinator) and
16
+ * renders its trigger and content, so keyboard, focus and dismissal are the
17
+ * menu's. The menu stays open while you tick items.
18
+ *
19
+ * ```html
20
+ * <pont2-multi-select-filter label="Roles"></pont2-multi-select-filter>
21
+ * <script>
22
+ * el.options = [{ value: "admin", label: "Admin" }, { value: "member", label: "Member" }];
23
+ * el.addEventListener("change", () => reload({ roles: el.values }));
24
+ * </script>
25
+ * ```
26
+ *
27
+ * Default words are `msg()` codes: `filter` (the label), `clear_filters`. The
28
+ * count is formatted for the page's language.
29
+ *
30
+ * @tag pont2-multi-select-filter
31
+ * @attr label - the button's text and the menu's heading (default `msg("filter")`)
32
+ * @attr disabled - as the menu's
33
+ * @fires change - the chosen values changed (read `values`)
34
+ * @fires pont2-open-change - cancelable `{ open, reason }`
35
+ */
36
+ export declare class MultiSelectFilter extends DropdownMenu {
37
+ static composite: boolean;
38
+ static properties: PropertyDeclarations;
39
+ options: FilterOption[];
40
+ values: string[];
41
+ label: string;
42
+ protected readonly messages: MessagesController;
43
+ constructor();
44
+ private toggleValue;
45
+ /** Untick everything, as the "Clear filters" item does. */
46
+ clear(): void;
47
+ render(): import('lit-html').TemplateResult<1>;
48
+ }
49
+ declare global {
50
+ interface HTMLElementTagNameMap {
51
+ "pont2-multi-select-filter": MultiSelectFilter;
52
+ }
53
+ }
@@ -0,0 +1,61 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { MessagesController } from '../../core/messages';
3
+ import { Pagination } from '../../primitives/pagination/pagination';
4
+ export { clampPage, paginationRange, type PageSlot } from './range';
5
+ export interface PageChangeDetail {
6
+ page: number;
7
+ }
8
+ /**
9
+ * # `<pont2-pagination>`: kit composite over `<pont2-prim-pagination>`
10
+ *
11
+ * A pager from two numbers. It **is** the primitive's nav (`extends
12
+ * Pagination`) and renders shadcn's DOM inside it: the list, its items,
13
+ * Previous / page buttons / ellipses / Next. The page links are `<button>`s
14
+ * (a pager in an app pages data, it does not navigate).
15
+ *
16
+ * ```html
17
+ * <pont2-pagination page="3" page-count="12"></pont2-pagination>
18
+ * ```
19
+ *
20
+ * Which pages show is `paginationRange()` (range.ts): first and last, the
21
+ * current page with `siblings` on each side, and an ellipsis for each longer
22
+ * gap, in a constant number of slots. Page numbers are formatted for the page's
23
+ * language (`Intl.NumberFormat`), and every word is a `msg()` code: `pagination`,
24
+ * `pagination_previous` / `_next` (button text), `pagination_previous_page` /
25
+ * `_next_page` (their labels), `pagination_more`.
26
+ *
27
+ * Pressing a page fires a cancelable `pont2-page-change` `{ page }`; unless it
28
+ * is cancelled, `page` becomes the new page (uncontrolled). Set `page` from
29
+ * the handler instead (and cancel) to control it.
30
+ *
31
+ * @tag pont2-pagination
32
+ * @attr page - the current page, 1-based (default 1)
33
+ * @attr page-count - how many pages there are (default 1)
34
+ * @attr siblings - pages shown on each side of the current one (default 1)
35
+ * @attr boundaries - pages always shown at each end (default 1)
36
+ * @attr disabled - every control disabled (for example while a page loads)
37
+ * @fires pont2-page-change - cancelable `{ page }`, the user pressed a page, Previous or Next
38
+ */
39
+ export declare class KitPagination extends Pagination {
40
+ static composite: boolean;
41
+ static properties: PropertyDeclarations;
42
+ page: number;
43
+ pageCount: number;
44
+ siblings: number;
45
+ boundaries: number;
46
+ disabled: boolean;
47
+ protected readonly kitMessages: MessagesController;
48
+ constructor();
49
+ /** Request a page, as the user did. Returns false if a listener cancelled it. */
50
+ goTo(page: number): boolean;
51
+ protected willUpdate(changed: PropertyValues): void;
52
+ render(): import('lit-html').TemplateResult<1>;
53
+ }
54
+ declare global {
55
+ interface HTMLElementTagNameMap {
56
+ "pont2-pagination": KitPagination;
57
+ }
58
+ interface HTMLElementEventMap {
59
+ "pont2-page-change": CustomEvent<PageChangeDetail>;
60
+ }
61
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The page numbers a pager shows, with gaps. Pure, so it is unit-tested
3
+ * (range.test.ts).
4
+ *
5
+ * Always shows the first and last `boundaries` pages and `siblings` pages on
6
+ * each side of the current one; a run of hidden pages becomes one
7
+ * `"ellipsis"`, except that a gap of exactly one page shows that page (an
8
+ * ellipsis standing for a single number saves nothing). The number of slots
9
+ * is constant while there are enough pages, so the pager does not change
10
+ * width as you page through (the MUI / Mantine `usePagination` rule).
11
+ *
12
+ * `paginationRange(5, 10)` → `[1, "ellipsis", 4, 5, 6, "ellipsis", 10]`
13
+ */
14
+ export type PageSlot = number | "ellipsis";
15
+ export declare function paginationRange(page: number, pageCount: number, siblings?: number, boundaries?: number): PageSlot[];
16
+ /** `page` as a whole page number within `1…pageCount` (1 when there are no pages). */
17
+ export declare function clampPage(page: number, pageCount: number): number;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `<pont-provider>` (the legacy kit) and `<pont2-provider>` drive **one** SDK:
3
+ * `Auth` is a singleton, and `configure()` replaces its whole configuration. On
4
+ * one page, whichever configures last owns the callbacks, the locale and the
5
+ * flow-state events, and the other's widgets stop hearing them. So the two must
6
+ * never be mounted together (migration tracker W-15). Each provider warns, once
7
+ * per page, when it finds the other.
8
+ *
9
+ * This file is the one place pont2 names a legacy tag (a guardrail exception
10
+ * with this reason). It goes when the legacy kit does (migration plan S7, R-3).
11
+ */
12
+ export declare const LEGACY_PROVIDER_TAG = "pont-provider";
13
+ /**
14
+ * Warns (once per page) when `root` holds the legacy provider. Returns whether
15
+ * it found one.
16
+ */
17
+ export declare function warnIfLegacyProvider(root?: Pick<ParentNode, "querySelector"> | undefined): boolean;
18
+ /** Forgets that the warning was given. For tests. */
19
+ export declare function resetCoexistenceWarning(): void;
@@ -0,0 +1,46 @@
1
+ import { WidgetClient } from '../flow-widget/flow-widget';
2
+ /**
3
+ * The contexts `<pont2-provider>` provides (docs/kit/provider.md), beside the
4
+ * `pont2:branding` one the block reads (`kit/block/branding.ts`).
5
+ *
6
+ * They are the Context Community Protocol (`context-request` events) through
7
+ * `@lit/context`, keyed `pont2:*`, apart from the legacy `pont:*` keys
8
+ * (docs/08-parallel-constraints.md §4). A consumer that connects before the
9
+ * provider is defined still finds it: `core/context-root.ts` replays the
10
+ * requests nobody answered.
11
+ */
12
+ /**
13
+ * Whether this browser is signed in, as the provider knows it.
14
+ *
15
+ * `resolved` is the provider's knowledge, not the SDK's: it means
16
+ * `restoreSession()` has come back. Until then `isAuthenticated` is `false` for
17
+ * everyone, so nothing may act on it (a signed-in user with an HttpOnly refresh
18
+ * cookie holds no session locally on a fresh page).
19
+ */
20
+ export interface AuthState {
21
+ isAuthenticated: boolean;
22
+ resolved: boolean;
23
+ }
24
+ /** Before the provider has asked: nobody is known to be signed in, and nobody may act on it. */
25
+ export declare const UNRESOLVED_AUTH: AuthState;
26
+ /** `pont2:auth`: the auth state, read by `pont2-signed-in` / `pont2-signed-out`. */
27
+ export declare const authStateContext: {
28
+ __context__: AuthState;
29
+ };
30
+ /**
31
+ * `pont2:client`: the flow widgets' client (the injected SDK). A widget given
32
+ * its own `client` keeps it; one without uses this. Undefined until the
33
+ * provider has configured the SDK, so no widget starts a flow on an
34
+ * unconfigured one.
35
+ */
36
+ export declare const clientContext: {
37
+ __context__: WidgetClient | undefined;
38
+ };
39
+ /**
40
+ * `pont2:login-hint`: the identifier the page was opened with (OpenID Connect's
41
+ * `login_hint`), which the flow host pre-fills the email and identifier fields
42
+ * with (migration tracker F-11).
43
+ */
44
+ export declare const loginHintContext: {
45
+ __context__: string | undefined;
46
+ };