@exponential-at/ui-solid 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +54 -0
- package/README.md +135 -2
- package/dist/chunks/image-loading-status-DZOoj4RQ.js +1724 -0
- package/dist/chunks/image-loading-status-DZOoj4RQ.js.map +1 -0
- package/dist/exponential-ui-solid.css +2 -0
- package/dist/index.js +12305 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives.js +8439 -0
- package/dist/primitives.js.map +1 -0
- package/dist/types/behaviors/bubble-input.d.ts +35 -0
- package/dist/types/behaviors/collapsible.d.ts +15 -0
- package/dist/types/behaviors/dialog.d.ts +116 -0
- package/dist/types/behaviors/dismissable-layer.d.ts +48 -0
- package/dist/types/behaviors/drag-to-dismiss.d.ts +10 -0
- package/dist/types/behaviors/element-size.d.ts +7 -0
- package/dist/types/behaviors/focus-guards.d.ts +4 -0
- package/dist/types/behaviors/focus-scope.d.ts +20 -0
- package/dist/types/behaviors/grace-area.d.ts +10 -0
- package/dist/types/behaviors/image-loading-status.d.ts +4 -0
- package/dist/types/behaviors/index.d.ts +23 -0
- package/dist/types/behaviors/listbox.d.ts +44 -0
- package/dist/types/behaviors/menu.d.ts +95 -0
- package/dist/types/behaviors/modal.d.ts +3 -0
- package/dist/types/behaviors/picker-popover.d.ts +22 -0
- package/dist/types/behaviors/popper.d.ts +49 -0
- package/dist/types/behaviors/portal.d.ts +11 -0
- package/dist/types/behaviors/presence.d.ts +7 -0
- package/dist/types/behaviors/roving-focus.d.ts +30 -0
- package/dist/types/behaviors/scroll-lock.d.ts +4 -0
- package/dist/types/behaviors/search-match.d.ts +6 -0
- package/dist/types/behaviors/slider.d.ts +8 -0
- package/dist/types/behaviors/style-writer.d.ts +8 -0
- package/dist/types/behaviors/typeahead.d.ts +11 -0
- package/dist/types/behaviors/visually-hidden.d.ts +6 -0
- package/dist/types/bind-attrs.d.ts +4 -0
- package/dist/types/context.d.ts +74 -0
- package/dist/types/create-surface.d.ts +58 -0
- package/dist/types/extensions.d.ts +25 -0
- package/dist/types/form.d.ts +63 -0
- package/dist/types/host-surface.d.ts +33 -0
- package/dist/types/host.d.ts +37 -0
- package/dist/types/icons.d.ts +56 -0
- package/dist/types/index.d.ts +39 -0
- package/dist/types/inputs.d.ts +27 -0
- package/dist/types/list.d.ts +33 -0
- package/dist/types/markdown.d.ts +10 -0
- package/dist/types/media.d.ts +16 -0
- package/dist/types/natives/actions.d.ts +13 -0
- package/dist/types/natives/bound.d.ts +3 -0
- package/dist/types/natives/chart.d.ts +4 -0
- package/dist/types/natives/chips.d.ts +7 -0
- package/dist/types/natives/choice-tiles.d.ts +4 -0
- package/dist/types/natives/code.d.ts +4 -0
- package/dist/types/natives/dates.d.ts +30 -0
- package/dist/types/natives/feedback.d.ts +19 -0
- package/dist/types/natives/index.d.ts +6 -0
- package/dist/types/natives/inputs.d.ts +20 -0
- package/dist/types/natives/layout.d.ts +12 -0
- package/dist/types/natives/media.d.ts +14 -0
- package/dist/types/natives/nav.d.ts +14 -0
- package/dist/types/natives/overlays.d.ts +19 -0
- package/dist/types/natives/owners.d.ts +2 -0
- package/dist/types/natives/pending.d.ts +3 -0
- package/dist/types/natives/resizable.d.ts +4 -0
- package/dist/types/natives/search.d.ts +45 -0
- package/dist/types/natives/select.d.ts +10 -0
- package/dist/types/natives/shared.d.ts +50 -0
- package/dist/types/natives/table.d.ts +7 -0
- package/dist/types/natives/text.d.ts +5 -0
- package/dist/types/node-view.d.ts +83 -0
- package/dist/types/platform.d.ts +12 -0
- package/dist/types/primitives/alert-dialog.d.ts +24 -0
- package/dist/types/primitives/alert.d.ts +6 -0
- package/dist/types/primitives/avatar-color.d.ts +1 -0
- package/dist/types/primitives/avatar.d.ts +12 -0
- package/dist/types/primitives/badge.d.ts +8 -0
- package/dist/types/primitives/breadcrumb.d.ts +12 -0
- package/dist/types/primitives/button.d.ts +12 -0
- package/dist/types/primitives/calendar.d.ts +188 -0
- package/dist/types/primitives/card.d.ts +9 -0
- package/dist/types/primitives/checkbox.d.ts +14 -0
- package/dist/types/primitives/choice-tiles.d.ts +59 -0
- package/dist/types/primitives/cn.d.ts +1 -0
- package/dist/types/primitives/code-block.d.ts +34 -0
- package/dist/types/primitives/collapsible.d.ts +15 -0
- package/dist/types/primitives/command.d.ts +51 -0
- package/dist/types/primitives/context-ring.d.ts +14 -0
- package/dist/types/primitives/dialog-arms.d.ts +2 -0
- package/dist/types/primitives/dialog.d.ts +34 -0
- package/dist/types/primitives/disclosure-header.d.ts +7 -0
- package/dist/types/primitives/dock-card.d.ts +41 -0
- package/dist/types/primitives/dropdown-menu.d.ts +73 -0
- package/dist/types/primitives/empty-state.d.ts +19 -0
- package/dist/types/primitives/glass-card.d.ts +3 -0
- package/dist/types/primitives/hover-card.d.ts +28 -0
- package/dist/types/primitives/icon-disc.d.ts +11 -0
- package/dist/types/primitives/index.d.ts +51 -0
- package/dist/types/primitives/input.d.ts +6 -0
- package/dist/types/primitives/kbd.d.ts +4 -0
- package/dist/types/primitives/label.d.ts +3 -0
- package/dist/types/primitives/menu-surface.d.ts +1 -0
- package/dist/types/primitives/meter.d.ts +8 -0
- package/dist/types/primitives/popover.d.ts +31 -0
- package/dist/types/primitives/progress-ring.d.ts +12 -0
- package/dist/types/primitives/progress.d.ts +9 -0
- package/dist/types/primitives/scroll-area.d.ts +19 -0
- package/dist/types/primitives/segmented-control.d.ts +23 -0
- package/dist/types/primitives/select.d.ts +51 -0
- package/dist/types/primitives/separator.d.ts +6 -0
- package/dist/types/primitives/sheet-chrome.d.ts +11 -0
- package/dist/types/primitives/sheet.d.ts +21 -0
- package/dist/types/primitives/skeleton.d.ts +3 -0
- package/dist/types/primitives/spinner.d.ts +9 -0
- package/dist/types/primitives/switch.d.ts +14 -0
- package/dist/types/primitives/table.d.ts +11 -0
- package/dist/types/primitives/tabs.d.ts +29 -0
- package/dist/types/primitives/textarea.d.ts +5 -0
- package/dist/types/primitives/toast.d.ts +16 -0
- package/dist/types/primitives/tooltip.d.ts +34 -0
- package/dist/types/primitives/truncate.d.ts +1 -0
- package/dist/types/primitives/use-media-query.d.ts +4 -0
- package/dist/types/primitives/use-mobile.d.ts +4 -0
- package/dist/types/primitives/use-sheet-drag.d.ts +20 -0
- package/dist/types/style.d.ts +6 -0
- package/dist/types/surface.d.ts +99 -0
- package/package.json +55 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Accessor, type JSX } from "solid-js";
|
|
2
|
+
/** Radix's `isFormControl`: the control sits in a <form> (decided once
|
|
3
|
+
* mounted; Radix renders its bubble input only then). */
|
|
4
|
+
export declare function createInForm(el: Accessor<HTMLElement | undefined>): Accessor<boolean>;
|
|
5
|
+
/** Radix's bubble-input effect: a state change replays on the hidden input
|
|
6
|
+
* (the native setter + a bubbling event) so <form> listeners see it. */
|
|
7
|
+
export declare function bubbleOnChange<T>(input: () => HTMLInputElement | HTMLSelectElement | undefined, value: Accessor<T>, apply: (el: HTMLInputElement | HTMLSelectElement, v: T) => void, event: string, bubbles?: () => boolean): void;
|
|
8
|
+
export declare const setChecked: (el: HTMLInputElement | HTMLSelectElement, v: boolean) => void | undefined;
|
|
9
|
+
/** Radix's hidden checkbox/radio bubble input (inside a <form> only). */
|
|
10
|
+
export declare function BubbleCheck(props: {
|
|
11
|
+
type: `checkbox` | `radio`;
|
|
12
|
+
control: HTMLElement | undefined;
|
|
13
|
+
checked: boolean;
|
|
14
|
+
name?: string;
|
|
15
|
+
value: string;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
transformFirst: boolean;
|
|
18
|
+
bubbles: () => boolean;
|
|
19
|
+
}): JSX.Element;
|
|
20
|
+
export declare function SliderBubble(props: {
|
|
21
|
+
name?: string;
|
|
22
|
+
value: number;
|
|
23
|
+
}): JSX.Element;
|
|
24
|
+
/** Radix's visually-hidden native <select> (inside a <form>). */
|
|
25
|
+
export declare function NativeSelect(props: {
|
|
26
|
+
name: string;
|
|
27
|
+
value: string | undefined;
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
options: {
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
}[];
|
|
34
|
+
onChange: (v: string) => void;
|
|
35
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
/** Radix `CollapsibleContent`'s state: `shown()` = painted (open, or
|
|
3
|
+
* closing while its exit animation runs; the painter writes `hidden` and
|
|
4
|
+
* drops the children otherwise), `ref` = the content element, `style()` =
|
|
5
|
+
* Radix's variables in Radix's order (the measured
|
|
6
|
+
* `--radix-collapsible-content-*` appended by the render after a toggle,
|
|
7
|
+
* and the mount measurement by the render after mount;
|
|
8
|
+
* `transition-duration: 0s; animation-name: none` left in place on an item
|
|
9
|
+
* open at mount). `alias` = the outer primitive whose
|
|
10
|
+
* `--radix-<alias>-content-*` variables alias them (Accordion: `accordion`). */
|
|
11
|
+
export declare function createCollapsibleContent(open: Accessor<boolean>, alias?: string): {
|
|
12
|
+
shown: Accessor<boolean>;
|
|
13
|
+
ref: (el: HTMLElement) => void;
|
|
14
|
+
style: () => Record<string, string>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type Accessor, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
import { type OutsideEvent } from "./dismissable-layer.js";
|
|
3
|
+
import { type StyleObject } from "./style-writer.js";
|
|
4
|
+
export type { OutsideEvent };
|
|
5
|
+
/** Calls a Solid event handler prop (a function or a `[fn, data]` pair). */
|
|
6
|
+
export declare function callHandler<E extends Event>(handler: unknown, event: E): void;
|
|
7
|
+
/** Radix's `composeEventHandlers`: the caller's handler first, ours unless it
|
|
8
|
+
* prevented the default. */
|
|
9
|
+
export declare function composeHandlers<E extends Event>(user: unknown, ours: (event: E) => void, checkForDefaultPrevented?: boolean): (event: E) => void;
|
|
10
|
+
/** Calls a Solid `ref` prop (a compiled ref callback) with the element. */
|
|
11
|
+
export declare function callRef(ref: unknown, el: unknown): void;
|
|
12
|
+
/** Every ref callback of `refs` receives the element. */
|
|
13
|
+
export declare function mergeRefs<T>(...refs: unknown[]): (el: T) => void;
|
|
14
|
+
/** A Solid `style` prop (object or string) as a kebab-case object for
|
|
15
|
+
* `bindStyle` (React's semantics: the caller's style merges into ours). */
|
|
16
|
+
export declare function styleObject(style: unknown): StyleObject;
|
|
17
|
+
/** Radix `useControllableState` for an overlay's `open`: controlled when
|
|
18
|
+
* `open()` is defined, else local from `defaultOpen`; `onOpenChange` fires
|
|
19
|
+
* on a change only, BEFORE the parts re-render (Radix calls it before its
|
|
20
|
+
* portalled content mounts: a Tooltip's "another tooltip opened" event
|
|
21
|
+
* must not reach its own content). */
|
|
22
|
+
export declare function createOpenState(o: {
|
|
23
|
+
open: () => boolean | undefined;
|
|
24
|
+
defaultOpen?: boolean;
|
|
25
|
+
onOpenChange: () => ((open: boolean) => void) | undefined;
|
|
26
|
+
}): [Accessor<boolean>, (next: boolean) => void];
|
|
27
|
+
export declare const stateOf: (open: boolean) => "open" | "closed";
|
|
28
|
+
/** A primitive layer attached in this task (see `layerMountedThisTask`). */
|
|
29
|
+
export declare function noteLayerMount(): void;
|
|
30
|
+
/** Whether a primitive layer attached in this same task: a content created
|
|
31
|
+
* now mounts NESTED in it (Radix registers that outer layer one commit
|
|
32
|
+
* after this content's first render, so its first `pointer-events` is
|
|
33
|
+
* unset). */
|
|
34
|
+
export declare function layerMountedThisTask(): boolean;
|
|
35
|
+
/** The layer's `pointer-events` with that lag applied. */
|
|
36
|
+
export declare function layerPointerEvents(layer: {
|
|
37
|
+
pointerEvents: (registered: boolean) => string | undefined;
|
|
38
|
+
}, registered: boolean, lag: boolean): string | undefined;
|
|
39
|
+
export interface DialogContextValue {
|
|
40
|
+
open: Accessor<boolean>;
|
|
41
|
+
setOpen: (open: boolean) => void;
|
|
42
|
+
modal: boolean;
|
|
43
|
+
contentId: string;
|
|
44
|
+
titleId: string;
|
|
45
|
+
descriptionId: string;
|
|
46
|
+
trigger: Accessor<HTMLElement | undefined>;
|
|
47
|
+
setTrigger: (el: HTMLElement | undefined) => void;
|
|
48
|
+
}
|
|
49
|
+
export declare function useDialogContext(part: string): DialogContextValue;
|
|
50
|
+
export interface DialogRootProps {
|
|
51
|
+
open?: boolean;
|
|
52
|
+
defaultOpen?: boolean;
|
|
53
|
+
onOpenChange?: (open: boolean) => void;
|
|
54
|
+
modal?: boolean;
|
|
55
|
+
children?: JSX.Element;
|
|
56
|
+
}
|
|
57
|
+
/** Radix `Dialog` (Root): renders no element. */
|
|
58
|
+
export declare function DialogRoot(props: DialogRootProps): JSX.Element;
|
|
59
|
+
/** A fresh id: `radix-<n>` keeps the parity rename rule (generated ids). */
|
|
60
|
+
export declare function createId(): string;
|
|
61
|
+
export type AsProps = {
|
|
62
|
+
as?: ValidComponent;
|
|
63
|
+
ref?: unknown;
|
|
64
|
+
onClick?: unknown;
|
|
65
|
+
children?: JSX.Element;
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
};
|
|
68
|
+
/** Radix `DialogTrigger`: `type="button"`, `aria-haspopup="dialog"`,
|
|
69
|
+
* `aria-expanded`, `aria-controls`, `data-state`, a click toggles. */
|
|
70
|
+
export declare function DialogTriggerPart(props: AsProps): JSX.Element;
|
|
71
|
+
/** Radix `DialogClose`: `type="button"`, a click closes. */
|
|
72
|
+
export declare function DialogClosePart(props: AsProps): JSX.Element;
|
|
73
|
+
/** Radix `Portal` as the primitives use it: the children appended to
|
|
74
|
+
* `container`, no wrapper. Without a container Radix mounts into
|
|
75
|
+
* `document.body` one commit LATER (its `mounted` state): a portal nested
|
|
76
|
+
* in another portal's content lands after it, once the outer content's
|
|
77
|
+
* effects (`hideOthers`, the focus guards) ran. */
|
|
78
|
+
export declare function DialogPortalPart(props: {
|
|
79
|
+
container?: HTMLElement | null;
|
|
80
|
+
children?: JSX.Element;
|
|
81
|
+
}): JSX.Element;
|
|
82
|
+
/** Radix `DialogOverlay` (modal dialogs only): `data-state`, the scroll
|
|
83
|
+
* lock, `pointer-events: auto`; present while open (+ its exit animation). */
|
|
84
|
+
export declare function DialogOverlayPart(props: {
|
|
85
|
+
style?: unknown;
|
|
86
|
+
ref?: unknown;
|
|
87
|
+
[key: string]: unknown;
|
|
88
|
+
}): JSX.Element;
|
|
89
|
+
export interface DialogContentPartProps {
|
|
90
|
+
role?: string;
|
|
91
|
+
style?: unknown;
|
|
92
|
+
ref?: unknown;
|
|
93
|
+
onOpenAutoFocus?: (e: Event) => void;
|
|
94
|
+
onCloseAutoFocus?: (e: Event) => void;
|
|
95
|
+
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
|
96
|
+
onPointerDownOutside?: (e: OutsideEvent) => void;
|
|
97
|
+
onFocusOutside?: (e: OutsideEvent) => void;
|
|
98
|
+
onInteractOutside?: (e: OutsideEvent) => void;
|
|
99
|
+
onKeyDown?: unknown;
|
|
100
|
+
children?: JSX.Element;
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
/** Radix `DialogContent` (modal or not, per the Root): `role="dialog"`,
|
|
104
|
+
* `id`, `aria-describedby`, `aria-labelledby`, `data-state`,
|
|
105
|
+
* `tabindex="-1"`, the layer's `pointer-events`; present while open. */
|
|
106
|
+
export declare function DialogContentPart(props: DialogContentPartProps): JSX.Element;
|
|
107
|
+
/** Radix `DialogTitle`: `<h2 id=titleId>`. */
|
|
108
|
+
export declare function DialogTitlePart(props: {
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
children?: JSX.Element;
|
|
111
|
+
}): JSX.Element;
|
|
112
|
+
/** Radix `DialogDescription`: `<p id=descriptionId>`. */
|
|
113
|
+
export declare function DialogDescriptionPart(props: {
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
children?: JSX.Element;
|
|
116
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export interface Layer {
|
|
3
|
+
el?: HTMLElement;
|
|
4
|
+
parent?: Layer;
|
|
5
|
+
kids: Set<Layer>;
|
|
6
|
+
}
|
|
7
|
+
export declare const LAYERS: Layer[];
|
|
8
|
+
export declare const MODAL_LAYERS: Layer[];
|
|
9
|
+
export declare const LayerContext: import("solid-js").Context<Layer | undefined>;
|
|
10
|
+
/** Inside this layer or one it opened (Radix checks the React tree, where a
|
|
11
|
+
* portalled child layer still sits under its parent). */
|
|
12
|
+
export declare function layerContains(layer: Layer, target: Node | null): boolean;
|
|
13
|
+
export interface OutsideEvent {
|
|
14
|
+
target: EventTarget | null;
|
|
15
|
+
detail: {
|
|
16
|
+
originalEvent: Event;
|
|
17
|
+
};
|
|
18
|
+
defaultPrevented: boolean;
|
|
19
|
+
preventDefault: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const outsideEvent: (originalEvent: Event) => OutsideEvent;
|
|
22
|
+
export interface LayerOptions {
|
|
23
|
+
disableOutsidePointerEvents?: Accessor<boolean>;
|
|
24
|
+
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
|
25
|
+
onPointerDownOutside?: (e: OutsideEvent) => void;
|
|
26
|
+
onFocusOutside?: (e: OutsideEvent) => void;
|
|
27
|
+
onInteractOutside?: (e: OutsideEvent) => void;
|
|
28
|
+
onDismiss: () => void;
|
|
29
|
+
}
|
|
30
|
+
/** Radix `DismissableLayer` on `el` (call `attach(el)` once it is in the
|
|
31
|
+
* document): Escape (the highest layer only), a pointer down outside, a
|
|
32
|
+
* focus outside; a modal layer turns the body's pointer events off.
|
|
33
|
+
* `pointerEvents()` = the layer's own `pointer-events` (Radix's value). */
|
|
34
|
+
export declare function createLayer(o: LayerOptions): {
|
|
35
|
+
layer: Layer;
|
|
36
|
+
attach: (el: HTMLElement) => void;
|
|
37
|
+
pointerEvents: (registered: boolean) => string | undefined;
|
|
38
|
+
};
|
|
39
|
+
/** Radix's DismissableLayer: Escape, a pointerdown outside (and, unless
|
|
40
|
+
* `keepOnFocusOutside`, focus moving outside) dismiss. `isInside` widens
|
|
41
|
+
* "inside" (the trigger of a non-modal popover). */
|
|
42
|
+
export declare function dismissable(opts: {
|
|
43
|
+
layer: () => HTMLElement | undefined;
|
|
44
|
+
onDismiss: () => void;
|
|
45
|
+
isInside?: (target: Node) => boolean;
|
|
46
|
+
keepOnFocusOutside?: boolean;
|
|
47
|
+
onOutside?: () => void;
|
|
48
|
+
}): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
/** Drawer drag-to-dismiss: a drag toward the drawer's edge past 80 px (or a
|
|
3
|
+
* flick) closes it; anything less springs back. */
|
|
4
|
+
export declare function createDragToDismiss(side: Accessor<string>, enabled: Accessor<boolean>, onDismiss: () => void, reducedMotion: Accessor<boolean>): {
|
|
5
|
+
setPanel: (el: HTMLElement) => HTMLElement;
|
|
6
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
7
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
8
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
9
|
+
onPointerCancel: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
/** Radix's `useSize`: the element's border-box size once mounted, then
|
|
3
|
+
* followed by a ResizeObserver (undefined before the first measure). */
|
|
4
|
+
export declare function createElementSize(el: Accessor<HTMLElement | undefined>): Accessor<{
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
} | undefined>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export declare function tabbables(container: HTMLElement): HTMLElement[];
|
|
3
|
+
export declare function isHidden(node: HTMLElement | null, upTo: HTMLElement): boolean;
|
|
4
|
+
export declare function focusEl(el: HTMLElement | null | undefined, select?: boolean): void;
|
|
5
|
+
export declare function focusFirst(candidates: (HTMLElement | null | undefined)[], select?: boolean): void;
|
|
6
|
+
export declare const AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
7
|
+
export declare const AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
8
|
+
/** Radix `FocusScope` on `el`: auto focus on mount (the first tabbable, else
|
|
9
|
+
* the container; `onMountAutoFocus` may prevent it), focus back on unmount
|
|
10
|
+
* (`onUnmountAutoFocus` may prevent it), `trapped` keeps the focus inside,
|
|
11
|
+
* `loop` wraps Tab. Returns the container's keydown handler. */
|
|
12
|
+
export declare function createFocusScope(o: {
|
|
13
|
+
trapped: Accessor<boolean>;
|
|
14
|
+
loop: boolean;
|
|
15
|
+
onMountAutoFocus?: (e: Event) => void;
|
|
16
|
+
onUnmountAutoFocus?: (e: Event) => void;
|
|
17
|
+
}): {
|
|
18
|
+
attach: (el: HTMLElement) => void;
|
|
19
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Point = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
/** Is the point inside the polygon (ray casting, Radix's `isPointInPolygon`)? */
|
|
6
|
+
export declare function inPolygon(point: Point, polygon: Point[]): boolean;
|
|
7
|
+
/** The convex hull of points (Andrew's monotone chain, Radix's `getHull`). */
|
|
8
|
+
export declare function hull(points: Point[]): Point[];
|
|
9
|
+
/** The grace area from the exit point to a hover target's box. */
|
|
10
|
+
export declare function graceArea(exit: Point, from: DOMRect, to: DOMRect): Point[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type LoadingStatus = `idle` | `loading` | `loaded` | `error`;
|
|
2
|
+
/** Radix Avatar's `useImageLoadingStatus`: a detached `Image` probes the
|
|
3
|
+
* src; the <img> paints only once it LOADED. */
|
|
4
|
+
export declare function createImageLoadingStatus(src: () => string | undefined): () => LoadingStatus;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./style-writer.js";
|
|
2
|
+
export * from "./portal.js";
|
|
3
|
+
export * from "./presence.js";
|
|
4
|
+
export * from "./dismissable-layer.js";
|
|
5
|
+
export * from "./focus-scope.js";
|
|
6
|
+
export * from "./focus-guards.js";
|
|
7
|
+
export * from "./scroll-lock.js";
|
|
8
|
+
export * from "./modal.js";
|
|
9
|
+
export * from "./popper.js";
|
|
10
|
+
export * from "./grace-area.js";
|
|
11
|
+
export * from "./visually-hidden.js";
|
|
12
|
+
export * from "./typeahead.js";
|
|
13
|
+
export * from "./menu.js";
|
|
14
|
+
export * from "./roving-focus.js";
|
|
15
|
+
export * from "./listbox.js";
|
|
16
|
+
export * from "./picker-popover.js";
|
|
17
|
+
export * from "./collapsible.js";
|
|
18
|
+
export * from "./drag-to-dismiss.js";
|
|
19
|
+
export * from "./element-size.js";
|
|
20
|
+
export * from "./bubble-input.js";
|
|
21
|
+
export * from "./slider.js";
|
|
22
|
+
export * from "./image-loading-status.js";
|
|
23
|
+
export * from "./search-match.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export interface ListNavOptions {
|
|
3
|
+
count: Accessor<number>;
|
|
4
|
+
isDisabled?: (index: number) => boolean;
|
|
5
|
+
labelOf?: (index: number) => string;
|
|
6
|
+
onPick: (index: number) => void;
|
|
7
|
+
/** Type-ahead (off when a search field owns the keys). */
|
|
8
|
+
typeahead?: Accessor<boolean>;
|
|
9
|
+
initial?: number;
|
|
10
|
+
}
|
|
11
|
+
/** React's `useListNavigation`: an active option (aria-activedescendant,
|
|
12
|
+
* focus stays where it is), ArrowUp/ArrowDown move it (wrapping, skipping
|
|
13
|
+
* disabled), Home/End jump, Enter picks, printable keys type-ahead by label
|
|
14
|
+
* when the list owns focus. */
|
|
15
|
+
export declare function createListNavigation(o: ListNavOptions): {
|
|
16
|
+
active: Accessor<number>;
|
|
17
|
+
setActive: import("solid-js").Setter<number>;
|
|
18
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
export interface ListNavSyncOptions {
|
|
21
|
+
count: Accessor<number>;
|
|
22
|
+
isDisabled?: (index: number) => boolean;
|
|
23
|
+
labelOf?: (index: number) => string;
|
|
24
|
+
onPick: (index: number) => void;
|
|
25
|
+
/** Type-ahead (off when a search field owns the keys). */
|
|
26
|
+
typeahead?: boolean;
|
|
27
|
+
initial?: number;
|
|
28
|
+
}
|
|
29
|
+
/** The TimePicker's variant of `createListNavigation`: `typeahead` is a
|
|
30
|
+
* constant, the active index is clamped to the count SYNCHRONOUSLY
|
|
31
|
+
* (`createComputed`, before the list renders) and `setActive` is a plain
|
|
32
|
+
* setter (no updater function). React's `useListNavigation`: an active
|
|
33
|
+
* option (aria-activedescendant, focus stays where it is), ArrowUp/ArrowDown
|
|
34
|
+
* move it (wrapping, skipping disabled), Home/End jump, Enter picks,
|
|
35
|
+
* printable keys type-ahead. */
|
|
36
|
+
export declare function createListNavigationSync(o: ListNavSyncOptions): {
|
|
37
|
+
active: Accessor<number>;
|
|
38
|
+
setActive: (i: number) => void;
|
|
39
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
40
|
+
};
|
|
41
|
+
/** Radix Select: the keys that open the content from the trigger, and the
|
|
42
|
+
* keys that pick the focused item. */
|
|
43
|
+
export declare const OPEN_KEYS: string[];
|
|
44
|
+
export declare const SELECTION_KEYS: string[];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type Accessor, type JSX } from "solid-js";
|
|
2
|
+
import type { VirtualElement } from "@floating-ui/dom";
|
|
3
|
+
import { type OutsideEvent } from "./dismissable-layer.js";
|
|
4
|
+
import { type Point } from "./grace-area.js";
|
|
5
|
+
import { type Align, type Side } from "./popper.js";
|
|
6
|
+
export declare function useKeyboardTracking(): void;
|
|
7
|
+
/** One menu level's content (Radix `MenuContentImpl`): roving focus over its
|
|
8
|
+
* items, typeahead, first/last keys, the pointer grace toward a submenu. */
|
|
9
|
+
export interface MenuLevel {
|
|
10
|
+
content: () => HTMLElement | undefined;
|
|
11
|
+
highlighted: Accessor<HTMLElement | undefined>;
|
|
12
|
+
setHighlighted: (el: HTMLElement | undefined) => void;
|
|
13
|
+
tabStop: Accessor<HTMLElement | undefined>;
|
|
14
|
+
setTabStop: (el: HTMLElement | undefined) => void;
|
|
15
|
+
search: () => string;
|
|
16
|
+
onItemEnter: (e: PointerEvent) => boolean;
|
|
17
|
+
onItemLeave: (e: PointerEvent) => void;
|
|
18
|
+
onTriggerLeave: (e: PointerEvent) => boolean;
|
|
19
|
+
setGrace: (grace: {
|
|
20
|
+
area: Point[];
|
|
21
|
+
side: Side;
|
|
22
|
+
} | null) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const MenuLevelContext: import("solid-js").Context<MenuLevel | undefined>;
|
|
25
|
+
export declare const FIRST_KEYS: string[];
|
|
26
|
+
export declare const LAST_KEYS: string[];
|
|
27
|
+
export declare const itemsOf: (content: HTMLElement | undefined) => HTMLElement[];
|
|
28
|
+
export type MenuContentProps = {
|
|
29
|
+
anchor: Element | VirtualElement | null | undefined;
|
|
30
|
+
side: Side;
|
|
31
|
+
align: Align;
|
|
32
|
+
sideOffset: number;
|
|
33
|
+
alignOffset?: number;
|
|
34
|
+
/** The popper's collision padding (default `OVERLAY_PADDING`, the natives';
|
|
35
|
+
* the primitive set passes Radix's 0). */
|
|
36
|
+
collisionPadding?: number;
|
|
37
|
+
/** A layer registered in this same mount pass is not visible to this
|
|
38
|
+
* content's FIRST style (Radix's default-body portals: the outer layer
|
|
39
|
+
* registers one commit after the nested content first renders), so its
|
|
40
|
+
* `pointer-events` starts unset. The primitive set passes it. */
|
|
41
|
+
lagParentLayer?: boolean;
|
|
42
|
+
/** Root content: modal (trap, outside pointer events off, scroll lock,
|
|
43
|
+
* aria-hidden), focus to the content on mount. */
|
|
44
|
+
root: boolean;
|
|
45
|
+
id?: string;
|
|
46
|
+
labelledBy?: string;
|
|
47
|
+
attrs: () => Record<string, unknown>;
|
|
48
|
+
state: () => string;
|
|
49
|
+
onDismiss: () => void;
|
|
50
|
+
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
|
51
|
+
onFocusOutside?: (e: OutsideEvent) => void;
|
|
52
|
+
onInteractOutside?: (e: OutsideEvent) => void;
|
|
53
|
+
onCloseAutoFocus: (e: Event) => void;
|
|
54
|
+
/** The reading direction (the popper wrapper's and the content's `dir`). */
|
|
55
|
+
dir: `ltr` | `rtl`;
|
|
56
|
+
/** The `--radix-<kind>-content-*` prefix: `dropdown-menu` or `context-menu`. */
|
|
57
|
+
kind: string;
|
|
58
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
59
|
+
setContent?: (el: HTMLElement | undefined) => void;
|
|
60
|
+
children: JSX.Element;
|
|
61
|
+
};
|
|
62
|
+
export declare function MenuContent(props: MenuContentProps): JSX.Element;
|
|
63
|
+
/** The attributes + behaviour every menu row shares (Radix `MenuItemImpl` +
|
|
64
|
+
* `RovingFocusGroupItem`): roving tabindex, `data-highlighted` while
|
|
65
|
+
* focused, pointer highlight, arrow keys. */
|
|
66
|
+
export declare function createMenuRow(disabled: Accessor<boolean>): {
|
|
67
|
+
attrs: () => Record<string, unknown>;
|
|
68
|
+
handlers: {
|
|
69
|
+
onFocus: () => void;
|
|
70
|
+
onBlur: () => void;
|
|
71
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
72
|
+
onPointerLeave: (e: PointerEvent) => void;
|
|
73
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
74
|
+
};
|
|
75
|
+
ref: (node: HTMLElement) => HTMLElement;
|
|
76
|
+
level: MenuLevel;
|
|
77
|
+
};
|
|
78
|
+
/** A selectable row (Radix `MenuItem`): click / Enter / Space select it, a
|
|
79
|
+
* press that started elsewhere selects on release; `onSelect` may prevent
|
|
80
|
+
* the `close` (the root menu's). */
|
|
81
|
+
export declare function createSelectable(disabled: Accessor<boolean>, onSelect: (e: Event) => void, close: () => void): {
|
|
82
|
+
handlers: {
|
|
83
|
+
onClick: () => void;
|
|
84
|
+
onPointerDown: () => boolean;
|
|
85
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
86
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
87
|
+
onFocus: () => void;
|
|
88
|
+
onBlur: () => void;
|
|
89
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
90
|
+
onPointerLeave: (e: PointerEvent) => void;
|
|
91
|
+
};
|
|
92
|
+
attrs: () => Record<string, unknown>;
|
|
93
|
+
ref: (node: HTMLElement) => HTMLElement;
|
|
94
|
+
level: MenuLevel;
|
|
95
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export interface PickerPopoverProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
setOpen: (open: boolean) => void;
|
|
5
|
+
trigger: () => HTMLElement | undefined;
|
|
6
|
+
contentId: string;
|
|
7
|
+
/** The content's own attributes (the part, role, aria-label, overlay…). */
|
|
8
|
+
attrs: Record<string, unknown>;
|
|
9
|
+
/** Radix's `onOpenAutoFocus` (the default prevented): where focus goes. */
|
|
10
|
+
onOpenAutoFocus: (content: HTMLElement) => void;
|
|
11
|
+
onPointerOver?: (e: PointerEvent) => void;
|
|
12
|
+
onFocusIn?: (e: FocusEvent) => void;
|
|
13
|
+
/** The surface's overlay layer (the portal's mount) and reading direction. */
|
|
14
|
+
portal: HTMLElement | null;
|
|
15
|
+
dir: `ltr` | `rtl`;
|
|
16
|
+
children: JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
/** PopoverPrimitive.Portal + Content (align start, `OVERLAY_OFFSET`,
|
|
19
|
+
* `OVERLAY_PADDING`), non-modal, inside Radix's `Presence`: a close keeps
|
|
20
|
+
* the content (`data-state="closed"`) mounted while its exit animation
|
|
21
|
+
* runs, then unmounts it. */
|
|
22
|
+
export declare function PickerPopover(props: PickerPopoverProps): JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Accessor, type JSX } from "solid-js";
|
|
2
|
+
import { type Middleware, type VirtualElement } from "@floating-ui/dom";
|
|
3
|
+
import { type StyleObject } from "./style-writer.js";
|
|
4
|
+
export type Side = `top` | `right` | `bottom` | `left`;
|
|
5
|
+
export type Align = `start` | `center` | `end`;
|
|
6
|
+
/** Radix Popper's `transformOrigin` middleware (no arrow: always hidden). */
|
|
7
|
+
export declare const transformOrigin: Middleware;
|
|
8
|
+
export interface PopperState {
|
|
9
|
+
placedSide: Accessor<Side>;
|
|
10
|
+
placedAlign: Accessor<Align>;
|
|
11
|
+
isPositioned: Accessor<boolean>;
|
|
12
|
+
/** The content element (its computed `z-index` goes on the wrapper). */
|
|
13
|
+
setContent: (el: HTMLElement) => void;
|
|
14
|
+
}
|
|
15
|
+
/** Radix `PopperContent`: the `data-radix-popper-content-wrapper` (fixed,
|
|
16
|
+
* translated, `min-width: max-content`, the content's z-index, the
|
|
17
|
+
* `--radix-popper-*` variables) around the content `children(state)`.
|
|
18
|
+
* Placement = floating-ui with Radix's middleware, auto-updated. */
|
|
19
|
+
export declare function Popper(props: {
|
|
20
|
+
anchor: Element | VirtualElement | null | undefined;
|
|
21
|
+
side: Side;
|
|
22
|
+
align: Align;
|
|
23
|
+
sideOffset: number;
|
|
24
|
+
alignOffset?: number;
|
|
25
|
+
collisionPadding: number;
|
|
26
|
+
dir?: string;
|
|
27
|
+
children: (state: PopperState) => JSX.Element;
|
|
28
|
+
}): JSX.Element;
|
|
29
|
+
/** The content's own style the way Radix composes it: `prefix` (a menu's
|
|
30
|
+
* `outline`), the dismissable layer's `pointer-events`, the popper's
|
|
31
|
+
* `--radix-<kind>-*` variables, then `animation: none` until placed. */
|
|
32
|
+
export declare function popperContentStyle(kind: string, trigger: string, pointerEvents: string | undefined, positioned: boolean, prefix?: StyleObject): StyleObject;
|
|
33
|
+
export interface Placed {
|
|
34
|
+
side: string;
|
|
35
|
+
align: string;
|
|
36
|
+
positioned: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Radix's PopperContent: the fixed wrapper (`data-radix-popper-content-
|
|
39
|
+
* wrapper`, floating-ui's translate, `--radix-popper-*`), the content's
|
|
40
|
+
* placed side/align. `content` renders the content element. */
|
|
41
|
+
export declare function popperWrapper(opts: {
|
|
42
|
+
anchor: () => HTMLElement | undefined;
|
|
43
|
+
sideOffset: number;
|
|
44
|
+
align: `start` | `center` | `end`;
|
|
45
|
+
collisionPadding: number;
|
|
46
|
+
dir?: () => `ltr` | `rtl` | `auto` | undefined;
|
|
47
|
+
onPlaced?: () => void;
|
|
48
|
+
content: (placed: Accessor<Placed>, ref: (el: HTMLElement) => void) => JSX.Element;
|
|
49
|
+
}): HTMLElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
/** A portal WITHOUT a wrapper (Solid's `<Portal>` adds a `<div>`, Radix's
|
|
3
|
+
* appends the content itself): the children are inserted before an empty
|
|
4
|
+
* text marker appended to `mount`, in mount order. */
|
|
5
|
+
export declare function LayerPortal(props: {
|
|
6
|
+
mount: HTMLElement | null;
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
/** Mounts `el` at the end of `container` while the owner lives (Radix's
|
|
10
|
+
* Portal: no wrapper element, unlike Solid's <Portal>). */
|
|
11
|
+
export declare function mountIn(container: HTMLElement, el: Node): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
/** Radix `Presence`: mounted while `present`, and on close until the exit
|
|
3
|
+
* animation the closed state starts has ended (none = at once). */
|
|
4
|
+
export declare function createPresence(present: Accessor<boolean>): {
|
|
5
|
+
mounted: Accessor<boolean>;
|
|
6
|
+
ref: (el: HTMLElement) => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type Intent = `first` | `last` | `prev` | `next`;
|
|
2
|
+
export declare const KEY_INTENT: Record<string, Intent>;
|
|
3
|
+
export declare function focusIntent(e: KeyboardEvent, orientation: `horizontal` | `vertical` | undefined, dir: `ltr` | `rtl`): Intent | undefined;
|
|
4
|
+
/** Radix RovingFocusGroup's `focusFirst`: the first candidate that takes
|
|
5
|
+
* focus (a candidate already focused stops the walk). */
|
|
6
|
+
export declare function rovingFocusFirst(candidates: (HTMLElement | null | undefined)[]): void;
|
|
7
|
+
/** Radix's RovingFocusGroup: the group's own attributes + handlers, and
|
|
8
|
+
* each item's. `items()` = the item elements in order, `focusable(el)`,
|
|
9
|
+
* `active(el)` = the selected one (the group's entry focus). */
|
|
10
|
+
export declare function createRovingGroup(opts: {
|
|
11
|
+
orientation?: `horizontal` | `vertical`;
|
|
12
|
+
dir: () => `ltr` | `rtl`;
|
|
13
|
+
loop: boolean;
|
|
14
|
+
items: () => HTMLElement[];
|
|
15
|
+
focusable: (el: HTMLElement) => boolean;
|
|
16
|
+
active: (el: HTMLElement) => boolean;
|
|
17
|
+
}): {
|
|
18
|
+
group: () => Record<string, unknown>;
|
|
19
|
+
groupHandlers: {
|
|
20
|
+
onMouseDown: () => undefined;
|
|
21
|
+
onFocusIn: (e: FocusEvent) => void;
|
|
22
|
+
onFocusOut: () => false;
|
|
23
|
+
};
|
|
24
|
+
item: (el: () => HTMLElement | undefined, focusable: () => boolean) => {
|
|
25
|
+
tabindex: () => 0 | -1;
|
|
26
|
+
onMouseDown: (e: MouseEvent) => void;
|
|
27
|
+
onFocus: () => HTMLElement | null;
|
|
28
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PAGE_KEYS: string[];
|
|
2
|
+
export declare const BACK_KEYS: Record<`from-left` | `from-right`, string[]>;
|
|
3
|
+
export declare const linearScale: (input: [number, number], output: [number, number]) => (v: number) => number;
|
|
4
|
+
export declare const decimalCount: (v: number) => number;
|
|
5
|
+
export declare const roundValue: (v: number, decimals: number) => number;
|
|
6
|
+
export declare const clampTo: (v: number, [lo, hi]: [number, number]) => number;
|
|
7
|
+
export declare const percentOf: (v: number, min: number, max: number) => number;
|
|
8
|
+
export declare const inBoundsOffset: (width: number, left: number, direction: number) => number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export type StyleObject = Record<string, string | undefined>;
|
|
3
|
+
/** React's `setValueForStyles(node, next, prev)` (kebab-case keys): a key
|
|
4
|
+
* gone from `next` is cleared, a changed one is written; an existing
|
|
5
|
+
* declaration keeps its place in the `style` attribute, a new one appends. */
|
|
6
|
+
export declare function styleWriter(el: HTMLElement): (next: StyleObject) => void;
|
|
7
|
+
/** Write `style()` with React's semantics on `el`, first now, then on change. */
|
|
8
|
+
export declare function bindStyle(el: HTMLElement, style: Accessor<StyleObject>): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const wrapArray: <T>(array: T[], start: number) => T[];
|
|
2
|
+
export declare function getNextMatch(values: string[], search: string, currentMatch?: string): string | undefined;
|
|
3
|
+
/** Radix's Select type-ahead: a 1 s buffer, a repeated letter cycles. */
|
|
4
|
+
export declare function radixTypeahead(onSearch: (search: string) => void): {
|
|
5
|
+
readonly search: string;
|
|
6
|
+
type: (key: string) => void;
|
|
7
|
+
reset: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function findNextItem<T extends {
|
|
10
|
+
label: string;
|
|
11
|
+
}>(items: T[], search: string, current: T | undefined): T | undefined;
|