@data-slot/ui 0.2.129 → 0.2.132

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/dist/index4.d.cts CHANGED
@@ -1,62 +1,42 @@
1
- //#region ../dialog/src/index.d.ts
2
- interface DialogOptions {
3
- /** Initial open state */
4
- defaultOpen?: boolean;
5
- /** Callback when open state changes */
6
- onOpenChange?: (open: boolean) => void;
7
- /** Close when clicking overlay */
8
- closeOnClickOutside?: boolean;
9
- /** Close when pressing Escape */
10
- closeOnEscape?: boolean;
11
- /** Lock body scroll when open */
12
- lockScroll?: boolean;
13
- /** Use alertdialog role for blocking confirmations */
14
- alertDialog?: boolean;
1
+ //#region ../command/src/index.d.ts
2
+ type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
3
+ interface CommandOptions {
4
+ /** Accessible label announced for the command input */
5
+ label?: string;
6
+ /** Initial active item value */
7
+ defaultValue?: string;
8
+ /** Initial search input value */
9
+ defaultSearch?: string;
10
+ /** Called whenever the active item value changes */
11
+ onValueChange?: (value: string | null) => void;
12
+ /** Called whenever the search query changes */
13
+ onSearchChange?: (search: string) => void;
14
+ /** Called when an item is selected via click or Enter */
15
+ onSelect?: (value: string) => void;
16
+ /** Disable built-in filtering and sorting */
17
+ shouldFilter?: boolean;
18
+ /** Custom ranking function. Return 0 to hide the item. */
19
+ filter?: CommandFilter;
20
+ /** Wrap arrow-key navigation */
21
+ loop?: boolean;
22
+ /** Disable pointer-move selection */
23
+ disablePointerSelection?: boolean;
24
+ /** Enable ctrl+j/k/n/p shortcuts @default true */
25
+ vimBindings?: boolean;
15
26
  }
16
- interface DialogController {
17
- /** Open the dialog */
18
- open(): void;
19
- /** Close the dialog */
20
- close(): void;
21
- /** Toggle the dialog */
22
- toggle(): void;
23
- /** Current open state */
24
- readonly isOpen: boolean;
25
- /** Cleanup all event listeners */
27
+ interface CommandController {
28
+ /** Current active item value */
29
+ readonly value: string | null;
30
+ /** Current search query */
31
+ readonly search: string;
32
+ /** Set the active item value programmatically */
33
+ select(value: string | null): void;
34
+ /** Set the search query programmatically */
35
+ setSearch(search: string): void;
36
+ /** Cleanup all event listeners and observers */
26
37
  destroy(): void;
27
- /** Internal: handle keydown for focus trap (used by global handler) */
28
- _handleKeydown?(e: KeyboardEvent): void;
29
- /** Internal: content element for focus trap */
30
- _content?: HTMLElement;
31
- /** Internal: overlay element for stack metadata */
32
- _overlay?: HTMLElement;
33
38
  }
34
- /**
35
- * Create a dialog controller for a root element
36
- *
37
- * Expected markup:
38
- * ```html
39
- * <div data-slot="dialog">
40
- * <button data-slot="dialog-trigger">Open</button>
41
- * <div data-slot="dialog-portal">
42
- * <div data-slot="dialog-overlay"></div>
43
- * <div data-slot="dialog-content">
44
- * <h2 data-slot="dialog-title">Title</h2>
45
- * <p data-slot="dialog-description">Description</p>
46
- * <button data-slot="dialog-close">Close</button>
47
- * </div>
48
- * </div>
49
- * </div>
50
- * ```
51
- *
52
- * Note: Overlay is required. The optional dialog-portal slot will be
53
- * automatically moved to document.body to escape stacking context issues.
54
- */
55
- declare function createDialog(root: Element, options?: DialogOptions): DialogController;
56
- /**
57
- * Find and bind all dialog components in a scope
58
- * Returns array of controllers for programmatic access
59
- */
60
- declare function create(scope?: ParentNode): DialogController[];
39
+ declare function createCommand(root: Element, options?: CommandOptions): CommandController;
40
+ declare function create(scope?: ParentNode): CommandController[];
61
41
  //#endregion
62
- export { createDialog as i, DialogOptions as n, create as r, DialogController as t };
42
+ export { createCommand as a, create as i, CommandFilter as n, CommandOptions as r, CommandController as t };
package/dist/index4.d.ts CHANGED
@@ -1,62 +1,42 @@
1
- //#region ../dialog/src/index.d.ts
2
- interface DialogOptions {
3
- /** Initial open state */
4
- defaultOpen?: boolean;
5
- /** Callback when open state changes */
6
- onOpenChange?: (open: boolean) => void;
7
- /** Close when clicking overlay */
8
- closeOnClickOutside?: boolean;
9
- /** Close when pressing Escape */
10
- closeOnEscape?: boolean;
11
- /** Lock body scroll when open */
12
- lockScroll?: boolean;
13
- /** Use alertdialog role for blocking confirmations */
14
- alertDialog?: boolean;
1
+ //#region ../command/src/index.d.ts
2
+ type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
3
+ interface CommandOptions {
4
+ /** Accessible label announced for the command input */
5
+ label?: string;
6
+ /** Initial active item value */
7
+ defaultValue?: string;
8
+ /** Initial search input value */
9
+ defaultSearch?: string;
10
+ /** Called whenever the active item value changes */
11
+ onValueChange?: (value: string | null) => void;
12
+ /** Called whenever the search query changes */
13
+ onSearchChange?: (search: string) => void;
14
+ /** Called when an item is selected via click or Enter */
15
+ onSelect?: (value: string) => void;
16
+ /** Disable built-in filtering and sorting */
17
+ shouldFilter?: boolean;
18
+ /** Custom ranking function. Return 0 to hide the item. */
19
+ filter?: CommandFilter;
20
+ /** Wrap arrow-key navigation */
21
+ loop?: boolean;
22
+ /** Disable pointer-move selection */
23
+ disablePointerSelection?: boolean;
24
+ /** Enable ctrl+j/k/n/p shortcuts @default true */
25
+ vimBindings?: boolean;
15
26
  }
16
- interface DialogController {
17
- /** Open the dialog */
18
- open(): void;
19
- /** Close the dialog */
20
- close(): void;
21
- /** Toggle the dialog */
22
- toggle(): void;
23
- /** Current open state */
24
- readonly isOpen: boolean;
25
- /** Cleanup all event listeners */
27
+ interface CommandController {
28
+ /** Current active item value */
29
+ readonly value: string | null;
30
+ /** Current search query */
31
+ readonly search: string;
32
+ /** Set the active item value programmatically */
33
+ select(value: string | null): void;
34
+ /** Set the search query programmatically */
35
+ setSearch(search: string): void;
36
+ /** Cleanup all event listeners and observers */
26
37
  destroy(): void;
27
- /** Internal: handle keydown for focus trap (used by global handler) */
28
- _handleKeydown?(e: KeyboardEvent): void;
29
- /** Internal: content element for focus trap */
30
- _content?: HTMLElement;
31
- /** Internal: overlay element for stack metadata */
32
- _overlay?: HTMLElement;
33
38
  }
34
- /**
35
- * Create a dialog controller for a root element
36
- *
37
- * Expected markup:
38
- * ```html
39
- * <div data-slot="dialog">
40
- * <button data-slot="dialog-trigger">Open</button>
41
- * <div data-slot="dialog-portal">
42
- * <div data-slot="dialog-overlay"></div>
43
- * <div data-slot="dialog-content">
44
- * <h2 data-slot="dialog-title">Title</h2>
45
- * <p data-slot="dialog-description">Description</p>
46
- * <button data-slot="dialog-close">Close</button>
47
- * </div>
48
- * </div>
49
- * </div>
50
- * ```
51
- *
52
- * Note: Overlay is required. The optional dialog-portal slot will be
53
- * automatically moved to document.body to escape stacking context issues.
54
- */
55
- declare function createDialog(root: Element, options?: DialogOptions): DialogController;
56
- /**
57
- * Find and bind all dialog components in a scope
58
- * Returns array of controllers for programmatic access
59
- */
60
- declare function create(scope?: ParentNode): DialogController[];
39
+ declare function createCommand(root: Element, options?: CommandOptions): CommandController;
40
+ declare function create(scope?: ParentNode): CommandController[];
61
41
  //#endregion
62
- export { createDialog as i, DialogOptions as n, create as r, DialogController as t };
42
+ export { createCommand as a, create as i, CommandFilter as n, CommandOptions as r, CommandController as t };
package/dist/index5.d.cts CHANGED
@@ -1,69 +1,62 @@
1
- //#region ../hover-card/src/index.d.ts
2
- type HoverCardSide = "top" | "right" | "bottom" | "left";
3
- type HoverCardAlign = "start" | "center" | "end";
4
- type HoverCardReason = "pointer" | "focus" | "blur" | "dismiss" | "api";
5
- interface HoverCardOptions {
6
- /** Initial open state (uncontrolled mode only) */
1
+ //#region ../dialog/src/index.d.ts
2
+ interface DialogOptions {
3
+ /** Initial open state */
7
4
  defaultOpen?: boolean;
8
- /** Controlled open state. Internal interactions do not mutate when set. */
9
- open?: boolean;
10
- /** Delay before opening on hover/keyboard focus (ms). @default 700 */
11
- delay?: number;
12
- /** Duration to skip delay after closing (ms). Set to 0 to disable warm-up. @default 300 */
13
- skipDelayDuration?: number;
14
- /** Delay before closing after leave/blur (ms). @default 300 */
15
- closeDelay?: number;
16
- /** The preferred side of the trigger to render against. @default "bottom" */
17
- side?: HoverCardSide;
18
- /** The preferred alignment against the trigger. @default "center" */
19
- align?: HoverCardAlign;
20
- /** The distance in pixels from the trigger. @default 4 */
21
- sideOffset?: number;
22
- /** Offset in pixels from the alignment edge. @default 0 */
23
- alignOffset?: number;
24
- /** When true, flips/shifts content to avoid viewport collisions. @default true */
25
- avoidCollisions?: boolean;
26
- /** Viewport padding used when avoiding collisions. @default 8 */
27
- collisionPadding?: number;
28
- /** Portal content to body while open. @default true */
29
- portal?: boolean;
30
- /** Close when clicking outside. @default true */
31
- closeOnClickOutside?: boolean;
32
- /** Close when pressing Escape. @default true */
33
- closeOnEscape?: boolean;
34
5
  /** Callback when open state changes */
35
6
  onOpenChange?: (open: boolean) => void;
7
+ /** Close when clicking overlay */
8
+ closeOnClickOutside?: boolean;
9
+ /** Close when pressing Escape */
10
+ closeOnEscape?: boolean;
11
+ /** Lock body scroll when open */
12
+ lockScroll?: boolean;
13
+ /** Use alertdialog role for blocking confirmations */
14
+ alertDialog?: boolean;
36
15
  }
37
- interface HoverCardController {
38
- /** Open the hover-card (request in controlled mode) */
16
+ interface DialogController {
17
+ /** Open the dialog */
39
18
  open(): void;
40
- /** Close the hover-card (request in controlled mode) */
19
+ /** Close the dialog */
41
20
  close(): void;
42
- /** Toggle the hover-card (request in controlled mode) */
21
+ /** Toggle the dialog */
43
22
  toggle(): void;
44
- /** Force open state update (works in both controlled/uncontrolled modes) */
45
- setOpen(open: boolean): void;
46
23
  /** Current open state */
47
24
  readonly isOpen: boolean;
48
25
  /** Cleanup all event listeners */
49
26
  destroy(): void;
27
+ /** Internal: handle keydown for focus trap (used by global handler) */
28
+ _handleKeydown?(e: KeyboardEvent): void;
29
+ /** Internal: content element for focus trap */
30
+ _content?: HTMLElement;
31
+ /** Internal: overlay element for stack metadata */
32
+ _overlay?: HTMLElement;
50
33
  }
51
34
  /**
52
- * Create a hover-card controller for a root element
35
+ * Create a dialog controller for a root element
53
36
  *
54
37
  * Expected markup:
55
38
  * ```html
56
- * <div data-slot="hover-card">
57
- * <button data-slot="hover-card-trigger">Hover me</button>
58
- * <div data-slot="hover-card-content">Preview content</div>
39
+ * <div data-slot="dialog">
40
+ * <button data-slot="dialog-trigger">Open</button>
41
+ * <div data-slot="dialog-portal">
42
+ * <div data-slot="dialog-overlay"></div>
43
+ * <div data-slot="dialog-content">
44
+ * <h2 data-slot="dialog-title">Title</h2>
45
+ * <p data-slot="dialog-description">Description</p>
46
+ * <button data-slot="dialog-close">Close</button>
47
+ * </div>
48
+ * </div>
59
49
  * </div>
60
50
  * ```
51
+ *
52
+ * Note: Overlay is required. The optional dialog-portal slot will be
53
+ * automatically moved to document.body to escape stacking context issues.
61
54
  */
62
- declare function createHoverCard(root: Element, options?: HoverCardOptions): HoverCardController;
55
+ declare function createDialog(root: Element, options?: DialogOptions): DialogController;
63
56
  /**
64
- * Find and bind all hover-card components in a scope
57
+ * Find and bind all dialog components in a scope
65
58
  * Returns array of controllers for programmatic access
66
59
  */
67
- declare function create(scope?: ParentNode): HoverCardController[];
60
+ declare function create(scope?: ParentNode): DialogController[];
68
61
  //#endregion
69
- export { HoverCardSide as a, HoverCardReason as i, HoverCardController as n, create as o, HoverCardOptions as r, createHoverCard as s, HoverCardAlign as t };
62
+ export { createDialog as i, DialogOptions as n, create as r, DialogController as t };
package/dist/index5.d.ts CHANGED
@@ -1,69 +1,62 @@
1
- //#region ../hover-card/src/index.d.ts
2
- type HoverCardSide = "top" | "right" | "bottom" | "left";
3
- type HoverCardAlign = "start" | "center" | "end";
4
- type HoverCardReason = "pointer" | "focus" | "blur" | "dismiss" | "api";
5
- interface HoverCardOptions {
6
- /** Initial open state (uncontrolled mode only) */
1
+ //#region ../dialog/src/index.d.ts
2
+ interface DialogOptions {
3
+ /** Initial open state */
7
4
  defaultOpen?: boolean;
8
- /** Controlled open state. Internal interactions do not mutate when set. */
9
- open?: boolean;
10
- /** Delay before opening on hover/keyboard focus (ms). @default 700 */
11
- delay?: number;
12
- /** Duration to skip delay after closing (ms). Set to 0 to disable warm-up. @default 300 */
13
- skipDelayDuration?: number;
14
- /** Delay before closing after leave/blur (ms). @default 300 */
15
- closeDelay?: number;
16
- /** The preferred side of the trigger to render against. @default "bottom" */
17
- side?: HoverCardSide;
18
- /** The preferred alignment against the trigger. @default "center" */
19
- align?: HoverCardAlign;
20
- /** The distance in pixels from the trigger. @default 4 */
21
- sideOffset?: number;
22
- /** Offset in pixels from the alignment edge. @default 0 */
23
- alignOffset?: number;
24
- /** When true, flips/shifts content to avoid viewport collisions. @default true */
25
- avoidCollisions?: boolean;
26
- /** Viewport padding used when avoiding collisions. @default 8 */
27
- collisionPadding?: number;
28
- /** Portal content to body while open. @default true */
29
- portal?: boolean;
30
- /** Close when clicking outside. @default true */
31
- closeOnClickOutside?: boolean;
32
- /** Close when pressing Escape. @default true */
33
- closeOnEscape?: boolean;
34
5
  /** Callback when open state changes */
35
6
  onOpenChange?: (open: boolean) => void;
7
+ /** Close when clicking overlay */
8
+ closeOnClickOutside?: boolean;
9
+ /** Close when pressing Escape */
10
+ closeOnEscape?: boolean;
11
+ /** Lock body scroll when open */
12
+ lockScroll?: boolean;
13
+ /** Use alertdialog role for blocking confirmations */
14
+ alertDialog?: boolean;
36
15
  }
37
- interface HoverCardController {
38
- /** Open the hover-card (request in controlled mode) */
16
+ interface DialogController {
17
+ /** Open the dialog */
39
18
  open(): void;
40
- /** Close the hover-card (request in controlled mode) */
19
+ /** Close the dialog */
41
20
  close(): void;
42
- /** Toggle the hover-card (request in controlled mode) */
21
+ /** Toggle the dialog */
43
22
  toggle(): void;
44
- /** Force open state update (works in both controlled/uncontrolled modes) */
45
- setOpen(open: boolean): void;
46
23
  /** Current open state */
47
24
  readonly isOpen: boolean;
48
25
  /** Cleanup all event listeners */
49
26
  destroy(): void;
27
+ /** Internal: handle keydown for focus trap (used by global handler) */
28
+ _handleKeydown?(e: KeyboardEvent): void;
29
+ /** Internal: content element for focus trap */
30
+ _content?: HTMLElement;
31
+ /** Internal: overlay element for stack metadata */
32
+ _overlay?: HTMLElement;
50
33
  }
51
34
  /**
52
- * Create a hover-card controller for a root element
35
+ * Create a dialog controller for a root element
53
36
  *
54
37
  * Expected markup:
55
38
  * ```html
56
- * <div data-slot="hover-card">
57
- * <button data-slot="hover-card-trigger">Hover me</button>
58
- * <div data-slot="hover-card-content">Preview content</div>
39
+ * <div data-slot="dialog">
40
+ * <button data-slot="dialog-trigger">Open</button>
41
+ * <div data-slot="dialog-portal">
42
+ * <div data-slot="dialog-overlay"></div>
43
+ * <div data-slot="dialog-content">
44
+ * <h2 data-slot="dialog-title">Title</h2>
45
+ * <p data-slot="dialog-description">Description</p>
46
+ * <button data-slot="dialog-close">Close</button>
47
+ * </div>
48
+ * </div>
59
49
  * </div>
60
50
  * ```
51
+ *
52
+ * Note: Overlay is required. The optional dialog-portal slot will be
53
+ * automatically moved to document.body to escape stacking context issues.
61
54
  */
62
- declare function createHoverCard(root: Element, options?: HoverCardOptions): HoverCardController;
55
+ declare function createDialog(root: Element, options?: DialogOptions): DialogController;
63
56
  /**
64
- * Find and bind all hover-card components in a scope
57
+ * Find and bind all dialog components in a scope
65
58
  * Returns array of controllers for programmatic access
66
59
  */
67
- declare function create(scope?: ParentNode): HoverCardController[];
60
+ declare function create(scope?: ParentNode): DialogController[];
68
61
  //#endregion
69
- export { HoverCardSide as a, HoverCardReason as i, HoverCardController as n, create as o, HoverCardOptions as r, createHoverCard as s, HoverCardAlign as t };
62
+ export { createDialog as i, DialogOptions as n, create as r, DialogController as t };
package/dist/index6.d.cts CHANGED
@@ -1,63 +1,69 @@
1
- //#region ../tabs/src/index.d.ts
2
- interface TabsOptions {
3
- /** Initial selected tab value */
4
- defaultValue?: string;
5
- /** Callback when selected tab changes */
6
- onValueChange?: (value: string) => void;
7
- /** Tab orientation for keyboard navigation */
8
- orientation?: "horizontal" | "vertical";
9
- /**
10
- * Activation mode for keyboard navigation
11
- * - "auto": Arrow keys select tabs immediately (default)
12
- * - "manual": Arrow keys move focus, Enter/Space activates
13
- */
14
- activationMode?: "auto" | "manual";
1
+ //#region ../hover-card/src/index.d.ts
2
+ type HoverCardSide = "top" | "right" | "bottom" | "left";
3
+ type HoverCardAlign = "start" | "center" | "end";
4
+ type HoverCardReason = "pointer" | "focus" | "blur" | "dismiss" | "api";
5
+ interface HoverCardOptions {
6
+ /** Initial open state (uncontrolled mode only) */
7
+ defaultOpen?: boolean;
8
+ /** Controlled open state. Internal interactions do not mutate when set. */
9
+ open?: boolean;
10
+ /** Delay before opening on hover/keyboard focus (ms). @default 700 */
11
+ delay?: number;
12
+ /** Duration to skip delay after closing (ms). Set to 0 to disable warm-up. @default 300 */
13
+ skipDelayDuration?: number;
14
+ /** Delay before closing after leave/blur (ms). @default 300 */
15
+ closeDelay?: number;
16
+ /** The preferred side of the trigger to render against. @default "bottom" */
17
+ side?: HoverCardSide;
18
+ /** The preferred alignment against the trigger. @default "center" */
19
+ align?: HoverCardAlign;
20
+ /** The distance in pixels from the trigger. @default 4 */
21
+ sideOffset?: number;
22
+ /** Offset in pixels from the alignment edge. @default 0 */
23
+ alignOffset?: number;
24
+ /** When true, flips/shifts content to avoid viewport collisions. @default true */
25
+ avoidCollisions?: boolean;
26
+ /** Viewport padding used when avoiding collisions. @default 8 */
27
+ collisionPadding?: number;
28
+ /** Portal content to body while open. @default true */
29
+ portal?: boolean;
30
+ /** Close when clicking outside. @default true */
31
+ closeOnClickOutside?: boolean;
32
+ /** Close when pressing Escape. @default true */
33
+ closeOnEscape?: boolean;
34
+ /** Callback when open state changes */
35
+ onOpenChange?: (open: boolean) => void;
15
36
  }
16
- interface TabsController {
17
- /** Select a tab by value */
18
- select(value: string): void;
19
- /** Currently selected value */
20
- readonly value: string;
21
- /** Update indicator position (call after layout changes) */
22
- updateIndicator(): void;
37
+ interface HoverCardController {
38
+ /** Open the hover-card (request in controlled mode) */
39
+ open(): void;
40
+ /** Close the hover-card (request in controlled mode) */
41
+ close(): void;
42
+ /** Toggle the hover-card (request in controlled mode) */
43
+ toggle(): void;
44
+ /** Force open state update (works in both controlled/uncontrolled modes) */
45
+ setOpen(open: boolean): void;
46
+ /** Current open state */
47
+ readonly isOpen: boolean;
23
48
  /** Cleanup all event listeners */
24
49
  destroy(): void;
25
50
  }
26
51
  /**
27
- * Create a tabs controller for a root element
28
- *
29
- * ## Events
30
- * - **Outbound** `tabs:change` (on root): Fires when selected tab changes.
31
- * `event.detail: { value: string }`
32
- * - **Inbound** `tabs:select` (on root): Select a tab programmatically.
33
- * `event.detail: { value: string } | string` (fallback: `event.currentTarget.dataset.value`)
34
- *
35
- * @example
36
- * ```js
37
- * // Listen for tab changes
38
- * root.addEventListener("tabs:change", (e) => console.log(e.detail.value));
39
- * // Select a tab from outside (object or string detail)
40
- * root.dispatchEvent(new CustomEvent("tabs:select", { detail: { value: "two" } }));
41
- * root.dispatchEvent(new CustomEvent("tabs:select", { detail: "two" }));
42
- * ```
52
+ * Create a hover-card controller for a root element
43
53
  *
44
54
  * Expected markup:
45
55
  * ```html
46
- * <div data-slot="tabs" data-default-value="two">
47
- * <div data-slot="tabs-list">
48
- * <button data-slot="tabs-trigger" data-value="one">Tab One</button>
49
- * <button data-slot="tabs-trigger" data-value="two">Tab Two</button>
50
- * </div>
51
- * <div data-slot="tabs-content" data-value="one">Content One</div>
52
- * <div data-slot="tabs-content" data-value="two">Content Two</div>
56
+ * <div data-slot="hover-card">
57
+ * <button data-slot="hover-card-trigger">Hover me</button>
58
+ * <div data-slot="hover-card-content">Preview content</div>
53
59
  * </div>
54
60
  * ```
55
61
  */
56
- declare function createTabs(root: Element, options?: TabsOptions): TabsController;
62
+ declare function createHoverCard(root: Element, options?: HoverCardOptions): HoverCardController;
57
63
  /**
58
- * Find and bind all tabs components in a scope
64
+ * Find and bind all hover-card components in a scope
59
65
  * Returns array of controllers for programmatic access
60
66
  */
61
- declare function create(scope?: ParentNode): TabsController[];
67
+ declare function create(scope?: ParentNode): HoverCardController[];
62
68
  //#endregion
63
- export { createTabs as i, TabsOptions as n, create as r, TabsController as t };
69
+ export { HoverCardSide as a, HoverCardReason as i, HoverCardController as n, create as o, HoverCardOptions as r, createHoverCard as s, HoverCardAlign as t };