@tempots/ui 4.3.8 → 5.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/index.cjs +1 -1
- package/index.d.ts +4 -0
- package/index.js +899 -827
- package/package.json +1 -1
- package/renderables/onclickoutside.d.ts +8 -0
- package/renderables/onenterkey.d.ts +1 -0
- package/renderables/onescapekey.d.ts +1 -0
- package/renderables/onkeypressed.d.ts +23 -0
- package/renderables/pop-over.d.ts +46 -44
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes a callback function when a click event occurs outside of the parent element.
|
|
3
|
+
*
|
|
4
|
+
* @param handler - The callback function to be executed when a click event occurs outside of the parent element.
|
|
5
|
+
* @returns A renderable function that takes a DOMContext and returns a function that takes a boolean indicating whether to remove the tree.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare function OnClickOutside(handler: (event: MouseEvent) => void): import('@tempots/dom').Renderable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OnEnterKey(handler: (event: KeyboardEvent) => void): import('@tempots/dom').Renderable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OnEscapeKey(handler: (event: KeyboardEvent) => void): import('@tempots/dom').Renderable;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type KeyCombo = {
|
|
2
|
+
/** The key value (e.g., 'Enter', 'a', 'ArrowUp') */
|
|
3
|
+
key?: string;
|
|
4
|
+
/** The physical key code (e.g., 'KeyA', 'Enter', 'ArrowUp') - more reliable than key */
|
|
5
|
+
code?: string;
|
|
6
|
+
/** Control key modifier */
|
|
7
|
+
ctrlKey?: boolean;
|
|
8
|
+
/** Alt key modifier (Option key on Mac) */
|
|
9
|
+
altKey?: boolean;
|
|
10
|
+
/** Shift key modifier */
|
|
11
|
+
shiftKey?: boolean;
|
|
12
|
+
/** Meta key modifier (Cmd on Mac, Windows key on PC) */
|
|
13
|
+
metaKey?: boolean;
|
|
14
|
+
/** Whether the key is being held down (auto-repeat) */
|
|
15
|
+
repeat?: boolean;
|
|
16
|
+
/** Cross-platform shortcut: true if either Cmd (Mac) or Ctrl (PC) is pressed */
|
|
17
|
+
commandOrControlKey?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function matchesKeyCombo(keyCombo: KeyCombo | string, event: KeyboardEvent): boolean;
|
|
20
|
+
export declare function OnKeyPressed({ allowedKeys, handler, }: {
|
|
21
|
+
allowedKeys: (KeyCombo | string)[];
|
|
22
|
+
handler: (event: KeyboardEvent) => void;
|
|
23
|
+
}): import('@tempots/dom').Renderable;
|
|
@@ -6,69 +6,71 @@ import { TNode, Value, Signal } from '@tempots/dom';
|
|
|
6
6
|
*/
|
|
7
7
|
export type Placement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
8
8
|
/**
|
|
9
|
-
* Represents
|
|
9
|
+
* Represents all possible placements for a pop-over.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const allPlacements: Placement[];
|
|
14
|
+
/**
|
|
15
|
+
* Represents the options for the arrow of a pop-over.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export type PopOverArrowOptions = {
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
centerOffset: number;
|
|
23
|
+
alignmentOffset?: number;
|
|
24
|
+
placement: Placement;
|
|
25
|
+
containerWidth: number;
|
|
26
|
+
containerHeight: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Represents the properties for a pop-over.
|
|
10
30
|
*
|
|
11
31
|
* @public
|
|
12
32
|
*/
|
|
13
33
|
export type PopOverOptions = {
|
|
14
|
-
/**
|
|
15
|
-
* Specifies whether the PopOver is open or closed.
|
|
16
|
-
*/
|
|
17
|
-
open: Value<boolean>;
|
|
18
34
|
/**
|
|
19
35
|
* Specifies the content of the PopOver.
|
|
20
36
|
* This should be a function that returns a TNode.
|
|
21
37
|
*/
|
|
22
|
-
content:
|
|
38
|
+
content: TNode;
|
|
23
39
|
/**
|
|
24
40
|
* Specifies the placement of the PopOver.
|
|
25
41
|
* This is an optional property.
|
|
26
42
|
*/
|
|
27
43
|
placement?: Value<Placement>;
|
|
28
44
|
/**
|
|
29
|
-
* Specifies the offset
|
|
30
|
-
* This is an optional property.
|
|
45
|
+
* Specifies the offset on the main axis.
|
|
31
46
|
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Specifies the offset on the main axis.
|
|
35
|
-
*/
|
|
36
|
-
mainAxis?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Specifies the offset on the cross axis.
|
|
39
|
-
*/
|
|
40
|
-
crossAxis?: number;
|
|
41
|
-
}>;
|
|
47
|
+
mainAxisOffset?: Value<number>;
|
|
42
48
|
/**
|
|
43
|
-
* Specifies the
|
|
44
|
-
* When provided, an arrow element will be created and positioned.
|
|
45
|
-
* This is an optional property.
|
|
49
|
+
* Specifies the offset on the cross axis.
|
|
46
50
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
centerOffset: number;
|
|
62
|
-
alignmentOffset?: number;
|
|
63
|
-
placement: Placement;
|
|
64
|
-
containerWidth: number;
|
|
65
|
-
containerHeight: number;
|
|
51
|
+
crossAxisOffset?: Value<number>;
|
|
52
|
+
/**
|
|
53
|
+
* Specifies the padding between the arrow and the edges of the floating element.
|
|
54
|
+
*/
|
|
55
|
+
arrowPadding?: Value<number>;
|
|
56
|
+
/**
|
|
57
|
+
* Specifies the content of the arrow.
|
|
58
|
+
*/
|
|
59
|
+
arrow?: (signal: Signal<PopOverArrowOptions>) => TNode;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies the target element for the PopOver. If not provided, the PopOver will be
|
|
62
|
+
* positioned relative to the parent element.
|
|
63
|
+
*/
|
|
64
|
+
target?: string | HTMLElement;
|
|
66
65
|
};
|
|
67
66
|
/**
|
|
68
|
-
*
|
|
67
|
+
* Creates a pop-over component.
|
|
69
68
|
*
|
|
70
|
-
* @param
|
|
71
|
-
* @
|
|
69
|
+
* @param fn - A function that returns the content of the pop-over.
|
|
70
|
+
* @param options - The options for the pop-over.
|
|
71
|
+
* @returns The pop-over component.
|
|
72
72
|
* @public
|
|
73
73
|
*/
|
|
74
|
-
export declare const PopOver: (
|
|
74
|
+
export declare const PopOver: (fn: (open: (options: PopOverOptions) => void, close: () => void) => TNode, options?: {
|
|
75
|
+
isOpen: Value<boolean>;
|
|
76
|
+
}) => import('@tempots/dom').Renderable<import('@tempots/dom').DOMContext>;
|