@tempots/ui 5.0.0 → 5.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -40,6 +40,6 @@
40
40
  "@floating-ui/dom": "^1.6.7"
41
41
  },
42
42
  "peerDependencies": {
43
- "@tempots/std": "0.19.0"
43
+ "@tempots/std": "0.22.0"
44
44
  }
45
45
  }
@@ -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;