@tempots/ui 4.3.7 → 5.0.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": "4.3.7",
3
+ "version": "5.0.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -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 the properties for a PopOver component.
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: () => TNode;
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 of the PopOver.
30
- * This is an optional property.
45
+ * Specifies the offset on the main axis.
31
46
  */
32
- offset?: Value<{
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 arrow configuration for the PopOver.
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
- arrow?: {
48
- /**
49
- * Specifies the padding between the arrow and the edges of the floating element.
50
- */
51
- padding?: number;
52
- /**
53
- * Specifies the content of the arrow.
54
- */
55
- content?: (signal: Signal<PopOverArrowOptions>) => TNode;
56
- };
57
- };
58
- export type PopOverArrowOptions = {
59
- x?: number;
60
- y?: number;
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
- * Renders a PopOver component.
67
+ * Creates a pop-over component.
69
68
  *
70
- * @param props - The properties for the PopOver component.
71
- * @returns The rendered PopOver component.
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: ({ content, open, placement: placementOption, offset, arrow: arrowOption, }: PopOverOptions) => import('@tempots/dom').Renderable;
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>;