@glasshome/ui 1.41.0 → 1.42.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/SPEC.md +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/anchor-placement.d.ts +30 -0
- package/dist/lib/behavior/anchored.d.ts +12 -0
- package/dist/lib/behavior/collection.d.ts +24 -0
- package/dist/lib/behavior/controllable.d.ts +8 -0
- package/dist/lib/behavior/dismiss.d.ts +11 -0
- package/dist/lib/behavior/focus-scope.d.ts +18 -0
- package/dist/lib/behavior/hide-outside.d.ts +7 -0
- package/dist/lib/behavior/layer-stack.d.ts +33 -0
- package/dist/lib/behavior/modal-root.d.ts +66 -0
- package/dist/lib/behavior/polymorphic.d.ts +6 -0
- package/dist/lib/behavior/presence.d.ts +18 -0
- package/dist/lib/behavior/solid.d.ts +13 -0
- package/dist/lib/motion-classes.d.ts +5 -2
- package/dist/lib/overlay-classes.d.ts +3 -0
- package/dist/lib/page-cover.d.ts +8 -0
- package/dist/lib/shadow-layer.d.ts +8 -6
- package/dist/solid/alert-dialog.d.ts +5 -8
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +1 -1
- package/dist/solid/bottom-sheet/constants.d.ts +1 -1
- package/dist/solid/dialog-parts.d.ts +51 -14
- package/dist/solid/dialog.d.ts +7 -10
- package/dist/solid/index.d.ts +4 -1
- package/dist/solid/index.js +7797 -7710
- package/dist/solid/responsive-dialog.d.ts +2 -0
- package/dist/solid/sheet.d.ts +5 -8
- package/dist/solid/stale-veil.d.ts +7 -0
- package/dist/solid/tabs.d.ts +28 -9
- package/dist/solid/toggle-group.d.ts +30 -5
- package/dist/solid/tooltip.d.ts +71 -9
- package/dist/{utils-CGN4X-2O.js → utils-CxAii-e9.js} +606 -414
- package/package.json +4 -2
- package/src/index.ts +1 -0
- package/src/lib/anchor-placement.ts +68 -2
- package/src/lib/behavior/anchored.ts +88 -0
- package/src/lib/behavior/collection.ts +181 -0
- package/src/lib/behavior/controllable.ts +22 -0
- package/src/lib/behavior/dismiss.ts +145 -0
- package/src/lib/behavior/focus-scope.ts +202 -0
- package/src/lib/behavior/hide-outside.ts +85 -0
- package/src/lib/behavior/layer-stack.ts +125 -0
- package/src/lib/behavior/modal-root.tsx +446 -0
- package/src/lib/behavior/polymorphic.tsx +30 -0
- package/src/lib/behavior/presence.ts +89 -0
- package/src/lib/behavior/solid.ts +30 -0
- package/src/lib/clipboard.ts +3 -2
- package/src/lib/motion-classes.ts +27 -2
- package/src/lib/overlay-classes.ts +7 -0
- package/src/lib/page-cover.ts +47 -0
- package/src/lib/shadow-layer.ts +48 -66
- package/src/solid/alert-dialog.tsx +36 -85
- package/src/solid/area-picker.tsx +2 -1
- package/src/solid/badge.tsx +5 -5
- package/src/solid/bottom-sheet/bottom-sheet.tsx +72 -128
- package/src/solid/bottom-sheet/constants.ts +3 -1
- package/src/solid/bottom-sheet/drag-controller.ts +11 -0
- package/src/solid/breadcrumb.tsx +4 -4
- package/src/solid/button-group.tsx +4 -4
- package/src/solid/card.tsx +5 -4
- package/src/solid/context-menu.tsx +12 -2
- package/src/solid/dialog-parts.tsx +132 -43
- package/src/solid/dialog.tsx +44 -76
- package/src/solid/dock-edit.tsx +5 -4
- package/src/solid/dock.tsx +3 -3
- package/src/solid/dropdown-menu.tsx +15 -7
- package/src/solid/entity-selector.tsx +2 -1
- package/src/solid/form.tsx +4 -3
- package/src/solid/hover-card.tsx +7 -2
- package/src/solid/icon-picker.tsx +2 -1
- package/src/solid/image-picker.tsx +5 -4
- package/src/solid/index.ts +4 -1
- package/src/solid/input-group.tsx +5 -3
- package/src/solid/input-otp.tsx +2 -1
- package/src/solid/item.tsx +4 -4
- package/src/solid/logo.tsx +5 -4
- package/src/solid/picker-row.tsx +5 -4
- package/src/solid/picker-search.tsx +2 -1
- package/src/solid/popover.tsx +18 -10
- package/src/solid/responsive-dialog.tsx +9 -9
- package/src/solid/sheet.tsx +47 -79
- package/src/solid/spotlight.tsx +23 -11
- package/src/solid/stale-veil.tsx +20 -0
- package/src/solid/switch.tsx +8 -6
- package/src/solid/tabs.tsx +368 -49
- package/src/solid/toggle-group.tsx +305 -93
- package/src/solid/tooltip.tsx +285 -26
- package/src/styles/globals.css +3 -3
- package/src/styles/theme.css +5 -0
- package/dist/lib/when-animations-settle.d.ts +0 -4
- package/dist/solid/bottom-sheet/focus-trap.d.ts +0 -6
- package/dist/solid/bottom-sheet/scroll-lock.d.ts +0 -2
- package/dist/solid/bottom-sheet/sheet-motion.d.ts +0 -1
- package/src/lib/when-animations-settle.ts +0 -12
- package/src/solid/bottom-sheet/focus-trap.ts +0 -63
- package/src/solid/bottom-sheet/scroll-lock.ts +0 -66
- package/src/solid/bottom-sheet/sheet-motion.ts +0 -4
package/SPEC.md
CHANGED
|
@@ -218,6 +218,7 @@ role clears 4.5:1 against `--background`/`--card`/`--popover`/`--muted` (3:1 for
|
|
|
218
218
|
| tools beside the dock while a mode is on, or a control that belongs to the dock but is no item | `<Dock companion companionOpen>`: a second glass unit that grows out of the dock, above a bottom dock and under a side dock (so a side dock keeps its width), and adds to its measured size; `<Dock lead>`: inside the glass before the strip, never paged away | a bar positioned against `--dock-height` in the app, a chip that pages with the items |
|
|
219
219
|
| a segmented pick in a column | `<ToggleGroup orientation="vertical">` | a column of buttons with a hand-drawn selection |
|
|
220
220
|
| pointing at a control while the user operates it | `<Spotlight>` (`blocking` on a targetless veil so the action inside the bubble is the only press that lands; a target taller than half the viewport places the bubble inside it, near the top, instead of above or below; the bubble carries a tail toward its `anchor`, which defaults to `target` and may point at a different element than the hole) | a hand-rolled fixed overlay with a cutout |
|
|
221
|
+
| marking content that is a moment old and not live yet | `<StaleVeil shown>` as the last child of a positioned parent, with `STALE_CONTENT` (black and white, no transition) on that parent, surface tint included: a 40% veil in `--background` that fades in once on `--duration-state`, inert and `aria-hidden` (the host names and announces the state) | a hand-rolled dim `div`, a `backdrop-filter` grey, a looping pulse or a spinner over the content |
|
|
221
222
|
|
|
222
223
|
Server-run `.astro` markup imports `@glasshome/ui/solid` too: the `solid`
|
|
223
224
|
export condition hands Astro the source, and a component with no `client:`
|
|
@@ -302,6 +303,10 @@ Motion is one system, not per-component flair. Four rules, all held by
|
|
|
302
303
|
stills. A mode indicator is not decoration: it may loop for as long
|
|
303
304
|
as its mode is on, provided the mode itself is bounded (dash leaves edit mode
|
|
304
305
|
after three idle minutes). `.glass-edge-orbit` is that rim.
|
|
306
|
+
An open modal pauses all of it under itself: once its open animation ends,
|
|
307
|
+
`coverPage()` sets `data-covered` on the app's `[data-page]` root (never
|
|
308
|
+
`html`), and a sealed widget's modal reaches it through the realm. An app
|
|
309
|
+
without a `[data-page]` root gets no pause.
|
|
305
310
|
|
|
306
311
|
`HOLD_MOTION`: hold progress. A fill grows out of the touch while held, dissolves once the hold fires, and drains back faster if let go early (holding the dock to change modes).
|
|
307
312
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { CONTROL_H, CONTROL_ON, FIELD_CHROME, FIELD_CONTROL, FIELD_TEXT, FOCUS_R
|
|
|
8
8
|
export { Z, Z_CLASS } from "./lib/layers.js";
|
|
9
9
|
export { LOGO_DEFAULT_SIZE, LOGO_DEFAULT_SRC, LOGO_DEFAULT_SUB, LOGO_MARK_CLASS, LOGO_MARK_PX, LOGO_NAME_CLASS, LOGO_ROOT_CLASS, LOGO_SIZES, LOGO_STACK_CLASS, LOGO_SUB_CLASS, type LogoSize, } from "./lib/logo-lockup.js";
|
|
10
10
|
export { MENU_ITEM, MENU_ITEM_BASE, MENU_ITEM_X, MENU_LABEL, MENU_SEPARATOR, } from "./lib/menu-classes.js";
|
|
11
|
-
export { FIELD_MOTION, MODAL_MOTION, MORPH_MOTION, OVERLAY_MOTION, PRESS_DIP, SCRIM_MOTION, SETTLE_MOTION, STAGGER, } from "./lib/motion-classes.js";
|
|
11
|
+
export { FIELD_MOTION, MODAL_MOTION, MORPH_MOTION, OVERLAY_MOTION, PRESS_DIP, SCRIM_MOTION, SETTLE_MOTION, STAGGER, STALE_CONTENT, } from "./lib/motion-classes.js";
|
|
12
12
|
export { createHold, HOLD_GRACE_MS, HOLD_MS, spendLongPress } from "./lib/hold.js";
|
|
13
13
|
export type { Hold, HoldOptions, HoldPress } from "./lib/hold.js";
|
|
14
14
|
export { MOTION_WINDOW_MS, startMotionWindow } from "./lib/motion-window.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as e, B as t, Bt as n, C as r, Cn as i, D as a, Dn as ee, En as te, F as ne, G as o, Gt as s, H as c, I as l, J as u, K as d, L as f, M as p, Mt as m, N as h, P as g, Qt as _, R as v, S as y, Sn as b, T as x, Tn as S, U as C, V as w, Vt as T, W as E, Wt as D, X as O, Y as k, Yt as A, Z as j, Zt as M, _ as N, _n as P, _t as F, an as I, at as L, b as R, bn as z, bt as B, c as V, ct as H, d as U, dn as W, dt as G, en as K, et as q, f as J, fn as Y, ft as X, g as Z, gn as re, gt as ie, h as ae, hn as oe, ht as se, i as ce, in as le, it as ue, j as de, l as fe, ln as pe, lt as me, m as he, mt as ge, n as _e, nt as ve, o as ye, on as be, ot as xe, p as Se, pn as Ce, pt as we, q as Te, r as Ee, rn as De, rt as Oe, s as ke, st as Ae, t as je, tn as Me, u as Ne, un as Pe, ut as Fe, v as Q, vn as Ie, vt as Le, w as Re, wn as ze, y as Be, yn as Ve, yt as He, z as Ue, zt as We } from "./utils-CxAii-e9.js";
|
|
2
2
|
//#region src/lib/motion-window.ts
|
|
3
3
|
var $ = 3e4;
|
|
4
|
-
function
|
|
4
|
+
function Ge(e = $) {
|
|
5
5
|
let t, n = document.documentElement, r = () => {
|
|
6
6
|
clearTimeout(t), t = void 0, delete n.dataset.motion;
|
|
7
7
|
}, i = () => {
|
|
@@ -17,4 +17,4 @@ function We(e = $) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
-
export {
|
|
20
|
+
export { oe as ALERT_CLASS, re as ALERT_CONTENT_CLASS, P as ALERT_DESCRIPTION_CLASS, Ie as ALERT_ICON_BG_CLASS, Ve as ALERT_ICON_CLASS, z as ALERT_ICON_PATHS, b as ALERT_TITLE_CLASS, i as ALERT_TONES, pe as BUTTON_DEFAULT_CLASS, Pe as BUTTON_OUTLINE_CLASS, m as CARD_BLUR, We as CARD_SURFACE, n as CARD_SURFACE_BASE, T as CARD_SURFACE_OPAQUE, Oe as CAROUSEL_DOTS, ue as CAROUSEL_VIEWPORT, he as CHIP, Fe as CONTROL_H, N as CONTROL_H_TOUCH, G as CONTROL_ON, X as FIELD_CHROME, we as FIELD_CONTROL, A as FIELD_MOTION, ge as FIELD_TEXT, R as FLOATING_PANEL, se as FOCUS_RING, de as HOLD_GRACE_MS, p as HOLD_MS, W as ICON_BUTTON_CLASS, ae as ICON_PILL, Z as ICON_PILL_TINT, ie as INPUT_CLASS, F as INPUT_SURFACE, Le as INVALID_RING, t as LOGO_DEFAULT_SIZE, w as LOGO_DEFAULT_SRC, c as LOGO_DEFAULT_SUB, C as LOGO_MARK_CLASS, E as LOGO_MARK_PX, o as LOGO_NAME_CLASS, d as LOGO_ROOT_CLASS, Te as LOGO_SIZES, u as LOGO_STACK_CLASS, k as LOGO_SUB_CLASS, ne as MENU_ITEM, l as MENU_ITEM_BASE, f as MENU_ITEM_X, v as MENU_LABEL, Ue as MENU_SEPARATOR, _e as MOBILE_BREAKPOINT, M as MODAL_MOTION, _ as MORPH_MOTION, $ as MOTION_WINDOW_MS, Y as OUTLINE_SURFACE, y as OVERLAY_BLUR, K as OVERLAY_MOTION, r as OVERLAY_SURFACE, Re as OVERLAY_SURFACE_BASE, x as OVERLAY_SURFACE_OPAQUE, Q as PICKER_LIST, Be as PICKER_TRIGGER, H as POSITION_BAR, me as POSITION_BAR_LIT, Me as PRESS_DIP, a as SCRIM_CLASS, De as SCRIM_MOTION, Ne as SECTION_INNER_RADIUS, U as SECTION_OUTER_RADIUS, J as SECTION_PADDING, Se as SECTION_ROW_CLASS, D as SECTION_ROW_SURFACE, fe as SEGMENT_ITEM, le as SETTLE_MOTION, I as STAGGER, be as STALE_CONTENT, ce as THUMB_CLASS, ye as THUMB_RAIL_BLEED, ke as THUMB_RAIL_PAD, V as THUMB_SIZE, s as TRACK_SURFACE, O as Z, j as Z_CLASS, ze as alertBorder, S as alertFill, te as alertIconBgStyle, ee as alertIconFill, e as anchorToTriggerTop, Ce as buttonVariants, L as carouselDot, xe as carouselItem, Ae as carouselTrack, je as cn, He as copyImage, B as copyText, h as createHold, Ee as createIsMobile, q as glassToneText, g as spendLongPress, Ge as startMotionWindow, ve as toneTextMix };
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
import type { JSX } from "solid-js";
|
|
2
|
+
export interface Box {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export type Side = "top" | "bottom" | "left" | "right";
|
|
9
|
+
export type Align = "start" | "center" | "end";
|
|
10
|
+
export interface AnchorPlace {
|
|
11
|
+
side: Side;
|
|
12
|
+
align: Align;
|
|
13
|
+
offset: number;
|
|
14
|
+
matchAnchorWidth: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface Placement {
|
|
17
|
+
left: number;
|
|
18
|
+
top: number;
|
|
19
|
+
side: Side;
|
|
20
|
+
maxWidth: number;
|
|
21
|
+
maxHeight: number;
|
|
22
|
+
}
|
|
23
|
+
/** Where a part of this size sits beside its anchor: on the chosen side, or the opposite when that
|
|
24
|
+
* side lacks room and the other has more, aligned along the edge and held 16px inside the viewport. */
|
|
25
|
+
export declare function placeBeside(anchor: Box, floating: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}, viewport: {
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}, place: AnchorPlace): Placement;
|
|
2
32
|
/** A panel that grows out of the element that opened it. The --morph-* values start the panel
|
|
3
33
|
* clipped to the element's box (MORPH_MOTION's keyframes), so it unrolls out of it. */
|
|
4
34
|
export declare function overAnchor(anchor: HTMLElement, width: number, height?: number): JSX.CSSProperties;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Accessor } from "solid-js";
|
|
2
|
+
import { type Align, type Side } from "../anchor-placement";
|
|
3
|
+
export interface AnchoredOptions {
|
|
4
|
+
anchor: Accessor<Element | undefined>;
|
|
5
|
+
floating: Accessor<HTMLElement | undefined>;
|
|
6
|
+
open: Accessor<boolean>;
|
|
7
|
+
side?: Accessor<Side>;
|
|
8
|
+
align?: Accessor<Align>;
|
|
9
|
+
offset?: number;
|
|
10
|
+
matchAnchorWidth?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function createAnchored(options: AnchoredOptions): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export declare const TYPEAHEAD_MS = 1000;
|
|
3
|
+
type Orientation = "horizontal" | "vertical";
|
|
4
|
+
type HighlightBy = "keyboard" | "pointer";
|
|
5
|
+
export interface CollectionOptions {
|
|
6
|
+
root: Accessor<HTMLElement | undefined>;
|
|
7
|
+
itemSelector: string;
|
|
8
|
+
orientation: Accessor<Orientation>;
|
|
9
|
+
focus: "roving" | "virtual";
|
|
10
|
+
loop?: Accessor<boolean>;
|
|
11
|
+
dir?: Accessor<"ltr" | "rtl">;
|
|
12
|
+
/** Keys that hold the tab stop while focus is outside, first present wins (a selected tab). */
|
|
13
|
+
preferred?: Accessor<readonly string[]>;
|
|
14
|
+
}
|
|
15
|
+
export interface Collection {
|
|
16
|
+
highlighted: Accessor<string | undefined>;
|
|
17
|
+
highlight: (key: string, by: HighlightBy) => void;
|
|
18
|
+
tabIndex: (key: string) => 0 | -1;
|
|
19
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
20
|
+
/** Items call this as they mount, unmount or change disabled, so the tab stop always sits on a present, enabled item. */
|
|
21
|
+
refresh: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function createCollection(options: CollectionOptions): Collection;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export interface ControllableOptions<T> {
|
|
3
|
+
value: Accessor<T | undefined>;
|
|
4
|
+
defaultValue: Accessor<T>;
|
|
5
|
+
onChange?: (next: T) => void;
|
|
6
|
+
equals?: (a: T, b: T) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function createControllableSignal<T>(options: ControllableOptions<T>): [Accessor<T>, (next: T) => void];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Accessor } from "solid-js";
|
|
2
|
+
import { type LayerHandle } from "./layer-stack";
|
|
3
|
+
export type DismissReason = "escape" | "outside-press";
|
|
4
|
+
export interface DismissOptions {
|
|
5
|
+
layer: LayerHandle;
|
|
6
|
+
/** `event` is the keydown for `escape` and the pointerdown for `outside-press`. */
|
|
7
|
+
onDismiss: (reason: DismissReason, event: KeyboardEvent | PointerEvent) => void;
|
|
8
|
+
outsidePress?: Accessor<boolean>;
|
|
9
|
+
escapeFrom?: "layer" | "document";
|
|
10
|
+
}
|
|
11
|
+
export declare function createDismiss(options: DismissOptions): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export declare const CANDIDATES = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
|
|
3
|
+
export type InitialFocus = "container" | "first" | ((container: HTMLElement) => HTMLElement | null);
|
|
4
|
+
export interface FocusScopeOptions {
|
|
5
|
+
container: Accessor<HTMLElement | undefined>;
|
|
6
|
+
active: Accessor<boolean>;
|
|
7
|
+
trapped: Accessor<boolean>;
|
|
8
|
+
initialFocus?: InitialFocus;
|
|
9
|
+
}
|
|
10
|
+
export interface FocusScope {
|
|
11
|
+
skipRestore(): void;
|
|
12
|
+
untrap(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare const hasFocus: (el: Element) => boolean;
|
|
15
|
+
export declare function focusWithoutTracking(el: HTMLElement | null | undefined, options?: {
|
|
16
|
+
preventScroll?: boolean;
|
|
17
|
+
}): boolean;
|
|
18
|
+
export declare function createFocusScope(options: FocusScopeOptions): FocusScope;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
import type { LayerHandle } from "./layer-stack";
|
|
3
|
+
export interface HideOutsideOptions {
|
|
4
|
+
layer: LayerHandle;
|
|
5
|
+
active: Accessor<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createHideOutside(options: HideOutsideOptions): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export type LayerKind = "modal" | "popover" | "menu" | "tooltip" | "tour";
|
|
3
|
+
export type TopLayer = "auto" | "manual";
|
|
4
|
+
export interface LayerOptions {
|
|
5
|
+
element: Accessor<HTMLElement | undefined>;
|
|
6
|
+
open: Accessor<boolean>;
|
|
7
|
+
kind: LayerKind;
|
|
8
|
+
escape: Accessor<boolean>;
|
|
9
|
+
readsOwnEscape?: boolean;
|
|
10
|
+
dismiss?: () => void;
|
|
11
|
+
trigger?: Accessor<Element | undefined>;
|
|
12
|
+
topLayer?: TopLayer;
|
|
13
|
+
}
|
|
14
|
+
export interface Layer {
|
|
15
|
+
readonly id: number;
|
|
16
|
+
readonly kind: LayerKind;
|
|
17
|
+
readonly readsOwnEscape: boolean;
|
|
18
|
+
element(): HTMLElement | undefined;
|
|
19
|
+
trigger(): Element | undefined;
|
|
20
|
+
escape(): boolean;
|
|
21
|
+
dismiss?: () => void;
|
|
22
|
+
}
|
|
23
|
+
export interface LayerHandle {
|
|
24
|
+
layer: Accessor<Layer | undefined>;
|
|
25
|
+
isTop: Accessor<boolean>;
|
|
26
|
+
above(): readonly Layer[];
|
|
27
|
+
containsPath(path: readonly EventTarget[]): boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const layerStack: {
|
|
30
|
+
layers: Accessor<readonly Layer[]>;
|
|
31
|
+
top: Accessor<Layer | undefined>;
|
|
32
|
+
};
|
|
33
|
+
export declare function registerLayer(options: LayerOptions): LayerHandle;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type Accessor, type ComponentProps, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
export type ModalRole = "dialog" | "alertdialog";
|
|
3
|
+
export interface ModalRootProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
modal?: boolean;
|
|
8
|
+
keep?: boolean;
|
|
9
|
+
role?: ModalRole;
|
|
10
|
+
children?: JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export interface ModalContext {
|
|
13
|
+
isOpen: Accessor<boolean>;
|
|
14
|
+
close: () => void;
|
|
15
|
+
toggle: () => void;
|
|
16
|
+
modal: Accessor<boolean>;
|
|
17
|
+
keep: Accessor<boolean>;
|
|
18
|
+
dormant: Accessor<boolean>;
|
|
19
|
+
bindDormant: (source: Accessor<boolean>) => void;
|
|
20
|
+
readonly role: ModalRole;
|
|
21
|
+
titleId: Accessor<string | undefined>;
|
|
22
|
+
registerTitle: (id: string) => () => void;
|
|
23
|
+
descriptionId: Accessor<string | undefined>;
|
|
24
|
+
registerDescription: (id: string) => () => void;
|
|
25
|
+
contentId: Accessor<string | undefined>;
|
|
26
|
+
registerContent: (id: string) => () => void;
|
|
27
|
+
triggerRef: Accessor<HTMLElement | undefined>;
|
|
28
|
+
setTriggerRef: (el: HTMLElement | undefined) => void;
|
|
29
|
+
panel: Accessor<HTMLElement | undefined>;
|
|
30
|
+
setPanel: (el: HTMLElement | undefined) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function useDialogContext(): ModalContext;
|
|
33
|
+
/** Whether the modal around the caller is closed and kept; false outside one, so a ticker inside can pause. */
|
|
34
|
+
export declare function useDialogDormant(): Accessor<boolean>;
|
|
35
|
+
export declare function ModalRoot(props: ModalRootProps): JSX.Element;
|
|
36
|
+
export type ModalPartProps<T extends ValidComponent> = {
|
|
37
|
+
as?: T;
|
|
38
|
+
} & Omit<ComponentProps<T>, "as">;
|
|
39
|
+
export declare function ModalTrigger<T extends ValidComponent = "button">(props: ModalPartProps<T>): JSX.Element;
|
|
40
|
+
export declare function ModalTitle<T extends ValidComponent = "h2">(props: ModalPartProps<T>): JSX.Element;
|
|
41
|
+
export declare function ModalDescription<T extends ValidComponent = "p">(props: ModalPartProps<T>): JSX.Element;
|
|
42
|
+
export interface ModalFrameProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "ref" | "style" | "role" | "class"> {
|
|
43
|
+
slot: string;
|
|
44
|
+
panelClass: string;
|
|
45
|
+
scrimClass: string;
|
|
46
|
+
panelStyle?: JSX.CSSProperties;
|
|
47
|
+
ariaLabel?: string;
|
|
48
|
+
ref?: (el: HTMLElement) => void;
|
|
49
|
+
as?: ValidComponent;
|
|
50
|
+
mount?: Node;
|
|
51
|
+
exitMs: number;
|
|
52
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
53
|
+
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
|
54
|
+
onInteractOutside?: (event: InteractOutsideEvent) => void;
|
|
55
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
56
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
57
|
+
}
|
|
58
|
+
interface OutsideDetail<T extends Event> {
|
|
59
|
+
originalEvent: T;
|
|
60
|
+
isContextMenu: boolean;
|
|
61
|
+
}
|
|
62
|
+
export type PointerDownOutsideEvent = CustomEvent<OutsideDetail<PointerEvent>>;
|
|
63
|
+
export type FocusOutsideEvent = CustomEvent<OutsideDetail<FocusEvent>>;
|
|
64
|
+
export type InteractOutsideEvent = PointerDownOutsideEvent | FocusOutsideEvent;
|
|
65
|
+
export declare function ModalFrame(props: ModalFrameProps): JSX.Element;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentProps, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
export type PolymorphicProps<D extends ValidComponent> = {
|
|
3
|
+
as?: ValidComponent;
|
|
4
|
+
defaultAs: D;
|
|
5
|
+
} & ComponentProps<D>;
|
|
6
|
+
export declare function Polymorphic<D extends ValidComponent>(props: PolymorphicProps<D>): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export type PresencePhase = "opening" | "open" | "closing" | "closed";
|
|
3
|
+
export type MotionEvent = AnimationEvent | TransitionEvent;
|
|
4
|
+
export interface PresenceOptions {
|
|
5
|
+
present: Accessor<boolean>;
|
|
6
|
+
element: Accessor<Element | undefined>;
|
|
7
|
+
exitMs: number;
|
|
8
|
+
accept?: (e: MotionEvent) => boolean;
|
|
9
|
+
keep?: Accessor<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export interface Presence {
|
|
12
|
+
mounted: Accessor<boolean>;
|
|
13
|
+
phase: Accessor<PresencePhase>;
|
|
14
|
+
dormant: Accessor<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export declare const PRESENCE_TIMEOUT_MS = 1000;
|
|
17
|
+
export declare function watchMotion(el: Element, exitMs: number, done: () => void, accept?: (e: MotionEvent) => boolean): () => void;
|
|
18
|
+
export declare function createPresence(options: PresenceOptions): Presence;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type JSX, mergeProps } from "solid-js";
|
|
2
|
+
export declare function effect<T>(compute: () => T, apply: (value: T) => (() => void) | void): void;
|
|
3
|
+
export declare const merge: typeof mergeProps;
|
|
4
|
+
export declare function omit<T extends object, K extends keyof T>(props: T, ...keys: K[]): {
|
|
5
|
+
[P in keyof T as Exclude<P, K>]: T[P];
|
|
6
|
+
};
|
|
7
|
+
/** Solid's handler prop is a union: a plain function, or the bound
|
|
8
|
+
* `[handler, data]` form that calls `handler(data, event)`. A wrapper that
|
|
9
|
+
* only checks for a function silently drops the bound one. */
|
|
10
|
+
export declare function callEventHandler<T, E extends Event>(event: E & {
|
|
11
|
+
currentTarget: T;
|
|
12
|
+
target: Element;
|
|
13
|
+
}, handler: JSX.EventHandlerUnion<T, E> | undefined): void;
|
|
@@ -3,12 +3,15 @@ export declare const FIELD_MOTION = "data-[closed]:animate-select-out data-[expa
|
|
|
3
3
|
export declare const MORPH_MOTION = "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out";
|
|
4
4
|
export declare const ANCHORED_MOTION = "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out";
|
|
5
5
|
export declare const STAGGER = "gh-stagger";
|
|
6
|
-
export declare const MODAL_MOTION = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]";
|
|
7
|
-
export declare const SCRIM_MOTION = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[expanded]:fade-in-0 data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:fade-out-0";
|
|
6
|
+
export declare const MODAL_MOTION = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:fill-mode-forwards data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]";
|
|
7
|
+
export declare const SCRIM_MOTION = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[expanded]:fade-in-0 data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:fill-mode-forwards data-[closed]:fade-out-0";
|
|
8
8
|
export declare const SETTLE_MOTION = "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)";
|
|
9
|
+
export declare const VEIL_MOTION = "animate-in fade-in-0 duration-(--duration-state) ease-(--ease-emphasis) motion-reduce:animate-none in-[.reduce-motion]:animate-none";
|
|
10
|
+
export declare const STALE_CONTENT = "grayscale";
|
|
9
11
|
export declare const PRESS_DIP = "active:scale-[0.97]";
|
|
10
12
|
export declare const HOLD_MOTION = "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-hold) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0";
|
|
11
13
|
export declare const DOCK_ARRIVE_MOTION = "pointer-events-none absolute inset-0 rounded-[inherit] opacity-0 ring-2 ring-primary shadow-[0_0_14px_var(--primary)] group-data-[arrived]:animate-dock-arrive";
|
|
12
14
|
export declare const DOCK_EDIT_MOTION = "data-[editing]:animate-dock-jiggle data-[editing]:nth-even:[animation-direction:alternate-reverse] data-[dragging]:animate-none";
|
|
13
15
|
export declare const RISE_MOTION = "origin-bottom transition-[opacity,scale,translate] data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:pointer-events-none data-[closed]:translate-y-2 data-[closed]:scale-95 data-[closed]:opacity-0";
|
|
14
16
|
export declare const TRAVEL_MOTION = "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)";
|
|
17
|
+
export declare const MOTION_EXIT_MS: Record<"overlay" | "modal" | "anchored" | "scrim" | "field" | "sheet", number>;
|
|
@@ -3,6 +3,8 @@ export declare const OVERLAY_SURFACE_BASE = "glass glass-frost [--glass-rim:0.5]
|
|
|
3
3
|
export declare const OVERLAY_SURFACE = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)] [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)] backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(var(--_material-vibrancy,1)*1.2)] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]";
|
|
4
4
|
export declare const OVERLAY_SURFACE_OPAQUE = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)] [--glass-base:var(--popover)]";
|
|
5
5
|
export declare const SCRIM_CLASS = "bg-scrim backdrop-blur-md pointer-coarse:backdrop-blur-none";
|
|
6
|
+
export declare const SCROLL_CONTAIN = "overscroll-contain";
|
|
7
|
+
export declare const SCRIM_CONTAIN = "overscroll-contain overflow-hidden";
|
|
6
8
|
export declare const PANEL_TAIL: string;
|
|
7
9
|
export declare const FLOATING_PANEL_SURFACE: string;
|
|
8
10
|
export declare const FLOATING_PANEL: string;
|
|
@@ -12,3 +14,4 @@ export declare const anchorToTriggerTop: (anchor?: HTMLElement) => {
|
|
|
12
14
|
width: number;
|
|
13
15
|
height: number;
|
|
14
16
|
};
|
|
17
|
+
export declare const LAYER_ROOT: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** On a modal's panel from the end of its open animation; the widget realm carries it out of a sealed widget. */
|
|
2
|
+
export declare const COVERING_ATTR = "data-covering";
|
|
3
|
+
/** Pauses the page's ambient loops while a modal covers it: one attribute on the app's [data-page] root, never on html. Returns the release. */
|
|
4
|
+
export declare function coverPage(): () => void;
|
|
5
|
+
/** A modal panel covers the page from now until the returned release runs. */
|
|
6
|
+
export declare function coverNow(panel: Element): () => void;
|
|
7
|
+
/** A modal panel covers the page once its open animation ends, if it is still open then, until the returned release runs. */
|
|
8
|
+
export declare function coverOnceOpen(panel: Element, open: () => boolean): () => void;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type Accessor } from "solid-js";
|
|
2
|
-
import { type InitialFocus } from "../solid/bottom-sheet/focus-trap.js";
|
|
3
2
|
/** True for a node inside a shadow root, where page-level layer logic sees only the root's host. */
|
|
4
3
|
export declare const inShadowRoot: (node: Node | undefined) => boolean;
|
|
4
|
+
export declare const ReportCovered: import("solid-js").Context<((covered: Accessor<boolean>) => void) | undefined>;
|
|
5
|
+
/** True while a layer of this Kobalte root sits under an owned modal; the root drops `modal` then. */
|
|
6
|
+
export declare function createCoveredRoot(): {
|
|
7
|
+
covered: Accessor<boolean>;
|
|
8
|
+
report: (covered: Accessor<boolean>) => void;
|
|
9
|
+
};
|
|
5
10
|
type OutsideEvent = {
|
|
6
11
|
target: EventTarget | null;
|
|
7
12
|
preventDefault(): void;
|
|
@@ -12,9 +17,10 @@ type AutoFocusEvent = {
|
|
|
12
17
|
export interface LayerHandlers {
|
|
13
18
|
onInteractOutside: (e: OutsideEvent) => void;
|
|
14
19
|
onCloseAutoFocus: (e: AutoFocusEvent) => void;
|
|
15
|
-
onOpenAutoFocus: (e: AutoFocusEvent) => void;
|
|
16
20
|
/** The shadow root's host while the layer is in one: what the page sees as the target of anything inside. */
|
|
17
21
|
host: () => Element | undefined;
|
|
22
|
+
/** An owned modal sits above the layer: the modal owns every press and focus until it closes. */
|
|
23
|
+
covered: Accessor<boolean>;
|
|
18
24
|
}
|
|
19
25
|
interface ShadowLayerOptions {
|
|
20
26
|
content: Accessor<HTMLElement | undefined>;
|
|
@@ -25,13 +31,9 @@ interface ShadowLayerOptions {
|
|
|
25
31
|
trigger?: Accessor<Element | undefined>;
|
|
26
32
|
/** Menus: any press outside the layer and the layers above it dismisses it, newest or not, as Kobalte's menus do. */
|
|
27
33
|
tree?: boolean;
|
|
28
|
-
/** The layer keeps Tab inside itself (dialogs); its initial focus is then ui's, not Kobalte's. */
|
|
29
|
-
trapsFocus?: boolean;
|
|
30
|
-
initialFocus?: InitialFocus;
|
|
31
34
|
consumer: {
|
|
32
35
|
onInteractOutside?: (e: never) => void;
|
|
33
36
|
onCloseAutoFocus?: (e: never) => void;
|
|
34
|
-
onOpenAutoFocus?: (e: never) => void;
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { AlertDialog as AlertDialogPrimitive } from "@kobalte/core/alert-dialog";
|
|
2
1
|
import type { VariantProps } from "cva";
|
|
3
|
-
import { type Component, type
|
|
2
|
+
import { type Component, type JSX, type ParentComponent } from "solid-js";
|
|
4
3
|
import { buttonVariants } from "../lib/button-variants.js";
|
|
5
|
-
import { type ModalHeadProps, type ModalDismissProps, type ModalSize } from "./dialog-parts.js";
|
|
6
|
-
declare const AlertDialog: ParentComponent<
|
|
7
|
-
declare const AlertDialogTrigger:
|
|
8
|
-
type AlertDialogContentProps =
|
|
4
|
+
import { type ModalHeadProps, type ModalContentProps, type ModalDismissProps, type ModalSize } from "./dialog-parts.js";
|
|
5
|
+
declare const AlertDialog: ParentComponent<import("./dialog-parts.js").ModalRootSkinProps>;
|
|
6
|
+
declare const AlertDialogTrigger: <T extends import("solid-js").ValidComponent = "button">(props: import("../lib/behavior/modal-root.js").ModalPartProps<T>) => JSX.Element, AlertDialogTitle: <T extends import("solid-js").ValidComponent = "h2">(props: import("../lib/behavior/modal-root.js").ModalPartProps<T>) => JSX.Element, AlertDialogDescription: <T extends import("solid-js").ValidComponent = "p">(props: import("../lib/behavior/modal-root.js").ModalPartProps<T>) => JSX.Element;
|
|
7
|
+
type AlertDialogContentProps = ModalContentProps & {
|
|
9
8
|
size?: ModalSize;
|
|
10
9
|
/** Names a panel that has no `AlertDialogTitle`. A registered Title wins. */
|
|
11
10
|
ariaLabel?: string;
|
|
@@ -14,8 +13,6 @@ declare const AlertDialogContent: ParentComponent<AlertDialogContentProps>;
|
|
|
14
13
|
declare const AlertDialogHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, AlertDialogBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
15
14
|
as?: import("solid-js").ValidComponent;
|
|
16
15
|
}>, AlertDialogFooter: Component<JSX.HTMLAttributes<HTMLDivElement>>;
|
|
17
|
-
declare const AlertDialogTitle: Component<ComponentProps<typeof AlertDialogPrimitive.Title>>;
|
|
18
|
-
declare const AlertDialogDescription: Component<ComponentProps<typeof AlertDialogPrimitive.Description>>;
|
|
19
16
|
/** An alert dialog is read aloud as a description, and the line carries the consequence. */
|
|
20
17
|
type AlertDialogHeadProps = ModalHeadProps & {
|
|
21
18
|
line: JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Component, type ComponentProps, type JSX, type ParentComponent, type ValidComponent } from "solid-js";
|
|
2
|
-
import { type InitialFocus } from "
|
|
2
|
+
import { type InitialFocus } from "../../lib/behavior/focus-scope.js";
|
|
3
3
|
interface BottomSheetRootProps {
|
|
4
4
|
open?: boolean;
|
|
5
5
|
defaultOpen?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const EASE = "cubic-bezier(0.32, 0.72, 0, 1)";
|
|
2
|
-
export declare const TRANSITION_MS
|
|
2
|
+
export declare const TRANSITION_MS: number;
|
|
3
3
|
export declare const DEAD_ZONE_PX = 6;
|
|
4
4
|
export declare const CLOSE_DISTANCE_RATIO = 0.4;
|
|
5
5
|
export declare const CLOSE_VELOCITY_PX_PER_MS = 0.5;
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import { Button as KobalteButton } from "@kobalte/core/button";
|
|
2
2
|
import { type Accessor, type Component, type ComponentProps, type JSX, type ParentComponent, type ValidComponent } from "solid-js";
|
|
3
|
+
import { type FocusOutsideEvent, type InteractOutsideEvent, type ModalPartProps, type PointerDownOutsideEvent, type ModalRole } from "../lib/behavior/modal-root.js";
|
|
4
|
+
export interface ModalRootSkinProps {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
/** Modal toward the page. Defaults to true on the page and false inside a shadow root. */
|
|
9
|
+
modal?: boolean;
|
|
10
|
+
/** Stays mounted and dormant after it closes, so the next open shows the same nodes instead of building them. */
|
|
11
|
+
keep?: boolean;
|
|
12
|
+
/** @deprecated No effect; the panel takes its own id. */
|
|
13
|
+
id?: string;
|
|
14
|
+
/** @deprecated No effect; the panel stays mounted through its exit on its own. */
|
|
15
|
+
forceMount?: boolean;
|
|
16
|
+
/** @deprecated No effect; a dialog never locks page scroll. */
|
|
17
|
+
preventScroll?: boolean;
|
|
18
|
+
/** @deprecated No effect. */
|
|
19
|
+
translations?: Record<string, string>;
|
|
20
|
+
children?: JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export declare function createModalRootSkin(role: ModalRole): ParentComponent<ModalRootSkinProps>;
|
|
23
|
+
export type ModalContentProps = Omit<ComponentProps<"div">, "style" | "role"> & {
|
|
24
|
+
as?: ValidComponent;
|
|
25
|
+
style?: JSX.CSSProperties | string;
|
|
26
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
27
|
+
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
|
28
|
+
onInteractOutside?: (event: InteractOutsideEvent) => void;
|
|
29
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
30
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
31
|
+
/** @deprecated No effect; focus never leaves an open dialog. */
|
|
32
|
+
onFocusOutside?: (event: FocusOutsideEvent) => void;
|
|
33
|
+
/** @deprecated No effect; the panel stays mounted through its exit on its own. */
|
|
34
|
+
forceMount?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export interface ModalTextParts {
|
|
37
|
+
Trigger: <T extends ValidComponent = "button">(props: ModalPartProps<T>) => JSX.Element;
|
|
38
|
+
Title: <T extends ValidComponent = "h2">(props: ModalPartProps<T>) => JSX.Element;
|
|
39
|
+
Description: <T extends ValidComponent = "p">(props: ModalPartProps<T>) => JSX.Element;
|
|
40
|
+
}
|
|
41
|
+
export declare function createModalTextParts(slot: string): ModalTextParts;
|
|
3
42
|
export type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
4
43
|
export declare const MODAL_MAX_H = "[--modal-max-h:85dvh] max-h-[var(--modal-max-h)]";
|
|
5
44
|
export declare const MODAL_WIDTH: Record<ModalSize, string>;
|
|
@@ -54,21 +93,19 @@ export type ModalHeadProps = ModalMedia & {
|
|
|
54
93
|
* hands in its own Header, Title and Description so ResponsiveDialog still
|
|
55
94
|
* switches between dialog and sheet parts at render time. */
|
|
56
95
|
export declare function createModalHead<P extends ModalHeadProps = ModalHeadProps>(Header: Component<ModalHeaderProps>, Title: Component<ComponentProps<"h2">>, Description: Component<ComponentProps<"p">>): Component<P>;
|
|
57
|
-
/** Solid's handler prop is a union: a plain function, or the bound
|
|
58
|
-
* `[handler, data]` form that calls `handler(data, event)`. A wrapper that
|
|
59
|
-
* only checks for a function silently drops the bound one. */
|
|
60
|
-
export declare function callEventHandler<T, E extends Event>(event: E & {
|
|
61
|
-
currentTarget: T;
|
|
62
|
-
target: Element;
|
|
63
|
-
}, handler: JSX.EventHandlerUnion<T, E> | undefined): void;
|
|
64
96
|
export type ModalDismissProps = ComponentProps<typeof KobalteButton> & {
|
|
65
97
|
/** Presses do nothing, the dialog stays open and focus stays put; see Button. */
|
|
66
98
|
busy?: boolean;
|
|
67
99
|
};
|
|
68
|
-
export declare function createModalDismiss(slot: string
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
100
|
+
export declare function createModalDismiss(slot: string, useCloser: () => {
|
|
101
|
+
close(): void;
|
|
102
|
+
}): ParentComponent<ModalDismissProps>;
|
|
103
|
+
/** Renderless, inside the modal's portal: the panel covers the page from the end of its open animation until the portal leaves. */
|
|
104
|
+
export declare const ModalCover: Component<{
|
|
105
|
+
panel: Accessor<Element | undefined>;
|
|
106
|
+
open: Accessor<boolean>;
|
|
107
|
+
dormant: Accessor<boolean>;
|
|
108
|
+
}>;
|
|
72
109
|
export interface ModalLabels {
|
|
73
110
|
titleId: string;
|
|
74
111
|
descriptionId: string;
|
|
@@ -77,9 +114,9 @@ export interface ModalLabels {
|
|
|
77
114
|
registerTitle: (id: string | undefined) => void;
|
|
78
115
|
registerDescription: (id: string | undefined) => void;
|
|
79
116
|
}
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
117
|
+
/** ModalRoot wires title/description ids for its families; BottomSheet wires
|
|
118
|
+
* them through this. The part registers the id it actually rendered, so a
|
|
119
|
+
* caller's own `id` still labels the panel. */
|
|
83
120
|
export declare function createModalLabels(): ModalLabels;
|
|
84
121
|
export declare const ModalLabelsProvider: import("solid-js").ContextProviderComponent<ModalLabels | undefined>;
|
|
85
122
|
export declare function useModalLabels(): ModalLabels | undefined;
|
package/dist/solid/dialog.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { Dialog as DialogPrimitive } from "@kobalte/core/dialog";
|
|
2
1
|
import type { VariantProps } from "cva";
|
|
3
|
-
import { type Component, type
|
|
2
|
+
import { type Component, type JSX, type ParentComponent } from "solid-js";
|
|
4
3
|
import { buttonVariants } from "../lib/button-variants.js";
|
|
5
|
-
import { type ModalDismissProps, type ModalSize } from "./dialog-parts.js";
|
|
6
|
-
declare const Dialog: ParentComponent<
|
|
7
|
-
declare const DialogTrigger:
|
|
4
|
+
import { type ModalContentProps, type ModalDismissProps, type ModalSize } from "./dialog-parts.js";
|
|
5
|
+
declare const Dialog: ParentComponent<import("./dialog-parts.js").ModalRootSkinProps>;
|
|
6
|
+
declare const DialogTrigger: <T extends import("solid-js").ValidComponent = "button">(props: import("../lib/behavior/modal-root.js").ModalPartProps<T>) => JSX.Element, DialogTitle: <T extends import("solid-js").ValidComponent = "h2">(props: import("../lib/behavior/modal-root.js").ModalPartProps<T>) => JSX.Element, DialogDescription: <T extends import("solid-js").ValidComponent = "p">(props: import("../lib/behavior/modal-root.js").ModalPartProps<T>) => JSX.Element;
|
|
8
7
|
type DialogCloseProps = ModalDismissProps & Partial<Pick<VariantProps<typeof buttonVariants>, "variant" | "size">>;
|
|
9
8
|
/** Already the outline button, so `as` is for a non-button element (a link),
|
|
10
9
|
* never for `Button`: two buttonVariants() calls leave tone knobs side by side
|
|
11
10
|
* and the later stylesheet rule wins. */
|
|
12
11
|
declare const DialogClose: ParentComponent<DialogCloseProps>;
|
|
13
|
-
type DialogContentProps =
|
|
12
|
+
type DialogContentProps = ModalContentProps & {
|
|
14
13
|
size?: ModalSize;
|
|
15
14
|
/** Names a panel that has no `DialogTitle`. A registered Title wins. */
|
|
16
15
|
ariaLabel?: string;
|
|
@@ -19,10 +18,8 @@ type DialogContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
|
|
|
19
18
|
anchor?: HTMLElement;
|
|
20
19
|
};
|
|
21
20
|
declare const DialogContent: ParentComponent<DialogContentProps>;
|
|
22
|
-
declare const DialogHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, DialogBody: Component<
|
|
21
|
+
declare const DialogHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, DialogBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
|
|
23
22
|
as?: import("solid-js").ValidComponent;
|
|
24
|
-
}>, DialogFooter: Component<
|
|
25
|
-
declare const DialogTitle: Component<ComponentProps<typeof DialogPrimitive.Title>>;
|
|
26
|
-
declare const DialogDescription: Component<ComponentProps<typeof DialogPrimitive.Description>>;
|
|
23
|
+
}>, DialogFooter: Component<JSX.HTMLAttributes<HTMLDivElement>>;
|
|
27
24
|
declare const DialogHead: Component<import("./dialog-parts.js").ModalHeadProps>;
|
|
28
25
|
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHead, DialogHeader, DialogTitle, DialogTrigger, };
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export { SECTION_ROW_SURFACE } from "../lib/card-classes.js";
|
|
|
3
3
|
export { copyImage, copyText } from "../lib/clipboard.js";
|
|
4
4
|
export { createHold, HOLD_GRACE_MS, HOLD_MS, spendLongPress } from "../lib/hold.js";
|
|
5
5
|
export type { Hold, HoldOptions, HoldPress } from "../lib/hold.js";
|
|
6
|
-
export { RISE_MOTION, SETTLE_MOTION, TRAVEL_MOTION } from "../lib/motion-classes.js";
|
|
6
|
+
export { RISE_MOTION, SETTLE_MOTION, STALE_CONTENT, TRAVEL_MOTION } from "../lib/motion-classes.js";
|
|
7
|
+
export { COVERING_ATTR, coverPage } from "../lib/page-cover.js";
|
|
7
8
|
export { OVERLAY_SURFACE } from "../lib/overlay-classes.js";
|
|
8
9
|
export { SECTION_INNER_RADIUS, SECTION_OUTER_RADIUS, SECTION_PADDING, SECTION_ROW_CLASS, } from "../lib/section-tokens.js";
|
|
9
10
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./accordion.js";
|
|
@@ -33,6 +34,7 @@ export { CountPill } from "./count-pill.js";
|
|
|
33
34
|
export { DashboardPreview, type DashboardPreviewTile } from "./dashboard-preview.js";
|
|
34
35
|
export { DataTableHead, DataTableRow, type SortDirection, TABLE_BLEED, TABLE_CELL_X, TABLE_HEAD_CELL_CLASS, TABLE_HEAD_CLASS, TABLE_HEAD_LABEL_CLASS, TABLE_NUM_CELL_CLASS, TABLE_ROW_CLASS, TABLE_SCROLL_CLASS, TableBulkBar, TableEmpty, TableError, TableFilterSelect, TableLoadMore, TableSearchInput, TableSkeleton, TableSortHeader, createTableWindow, } from "./data-table.js";
|
|
35
36
|
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHead, DialogHeader, DialogTitle, DialogTrigger, } from "./dialog.js";
|
|
37
|
+
export { useDialogDormant } from "../lib/behavior/modal-root.js";
|
|
36
38
|
export { ConfirmDialog, type ConfirmDialogProps } from "./confirm-dialog.js";
|
|
37
39
|
export type { ModalHeadProps, ModalMedia, ModalSize } from "./dialog-parts.js";
|
|
38
40
|
export type { DockIconButtonProps, DockItem, DockPlacement, DockProps } from "./dock.js";
|
|
@@ -94,6 +96,7 @@ export { FaceToggle, FaceToggleGroup } from "./face-toggle.js";
|
|
|
94
96
|
export { GlyphTile, GlyphTileGroup } from "./glyph-tile.js";
|
|
95
97
|
export { Spinner } from "./spinner.js";
|
|
96
98
|
export { Spotlight } from "./spotlight.js";
|
|
99
|
+
export { StaleVeil } from "./stale-veil.js";
|
|
97
100
|
export { StepIndicator } from "./step-indicator.js";
|
|
98
101
|
export { SwatchPicker } from "./swatch-picker.js";
|
|
99
102
|
export { Switch } from "./switch.js";
|