vira 27.0.0 → 28.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/dist/elements/index.d.ts +7 -7
- package/dist/elements/index.js +7 -7
- package/dist/elements/{popover/popover-helpers.d.ts → pop-up/pop-up-helpers.d.ts} +6 -6
- package/dist/elements/{popover/popover-helpers.js → pop-up/pop-up-helpers.js} +5 -5
- package/dist/elements/{popover → pop-up}/vira-menu-item.element.d.ts +2 -2
- package/dist/elements/{popover → pop-up}/vira-menu-item.element.js +1 -1
- package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +55 -0
- package/dist/elements/{popover → pop-up}/vira-menu-trigger.element.js +33 -29
- package/dist/elements/{popover → pop-up}/vira-menu.element.d.ts +2 -2
- package/dist/elements/{popover → pop-up}/vira-menu.element.js +2 -2
- package/dist/elements/pop-up/vira-pop-up-menu.element.d.ts +35 -0
- package/dist/elements/{popover/vira-popover-menu.element.js → pop-up/vira-pop-up-menu.element.js} +23 -23
- package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +81 -0
- package/dist/elements/pop-up/vira-pop-up-trigger.element.js +282 -0
- package/dist/elements/vira-dropdown.element.d.ts +18 -6
- package/dist/elements/vira-dropdown.element.js +10 -8
- package/dist/icons/icon-svgs/status-failure-24.icon.js +8 -1
- package/dist/icons/icon-svgs/status-unknown-24.icon.d.ts +8 -0
- package/dist/icons/icon-svgs/status-unknown-24.icon.js +47 -0
- package/dist/icons/icon-svgs/status-warning-24.icon.js +15 -9
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +3 -0
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/{popover-manager.d.ts → pop-up-manager.d.ts} +39 -60
- package/dist/util/{popover-manager.js → pop-up-manager.js} +45 -42
- package/package.json +7 -7
- package/dist/elements/popover/vira-menu-trigger.element.d.ts +0 -41
- package/dist/elements/popover/vira-popover-menu.element.d.ts +0 -35
- package/dist/elements/popover/vira-popover-trigger.element.d.ts +0 -67
- package/dist/elements/popover/vira-popover-trigger.element.js +0 -301
- /package/dist/elements/{popover/popover-menu-item.d.ts → pop-up/pop-up-menu-item.d.ts} +0 -0
- /package/dist/elements/{popover/popover-menu-item.js → pop-up/pop-up-menu-item.js} +0 -0
|
@@ -12,17 +12,6 @@ export type PositionRect = {
|
|
|
12
12
|
right: number;
|
|
13
13
|
bottom: number;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Used to represent the diff between the root element and the viewport.
|
|
17
|
-
*
|
|
18
|
-
* @category Internal
|
|
19
|
-
*/
|
|
20
|
-
export type DiffRect = PositionRect & {
|
|
21
|
-
rootLeftToContainerRight: number;
|
|
22
|
-
rootRightToContainerLeft: number;
|
|
23
|
-
rootTopToContainerBottom: number;
|
|
24
|
-
rootBottomToContainerTop: number;
|
|
25
|
-
};
|
|
26
15
|
/**
|
|
27
16
|
* The default empty {@link PositionRect}, with all values set to 0.
|
|
28
17
|
*
|
|
@@ -30,15 +19,15 @@ export type DiffRect = PositionRect & {
|
|
|
30
19
|
*/
|
|
31
20
|
export declare const emptyPositionRect: PositionRect;
|
|
32
21
|
/**
|
|
33
|
-
* Options for {@link
|
|
22
|
+
* Options for {@link PopUpManager}.
|
|
34
23
|
*
|
|
35
|
-
* @category
|
|
24
|
+
* @category PopUp
|
|
36
25
|
*/
|
|
37
|
-
export type
|
|
26
|
+
export type PopUpManagerOptions = {
|
|
38
27
|
/**
|
|
39
|
-
* The minimum number of pixels for allowing the
|
|
28
|
+
* The minimum number of pixels for allowing the pop-up to go downwards. If the downward
|
|
40
29
|
* available space is less than this, and if the upwards available space is
|
|
41
|
-
* `verticalDiffThreshold` more than the downwards space, the
|
|
30
|
+
* `verticalDiffThreshold` more than the downwards space, the pop-up will be directed upwards.
|
|
42
31
|
*
|
|
43
32
|
* Equation:
|
|
44
33
|
*
|
|
@@ -48,10 +37,10 @@ export type PopoverManagerOptions = {
|
|
|
48
37
|
*
|
|
49
38
|
* @default 200
|
|
50
39
|
*/
|
|
51
|
-
|
|
40
|
+
minDownSpace: number;
|
|
52
41
|
/**
|
|
53
42
|
* The number of pixels required for the upwards available space to be bigger than the downwards
|
|
54
|
-
* available space before directing the
|
|
43
|
+
* available space before directing the pop-up upwards.
|
|
55
44
|
*
|
|
56
45
|
* Equation:
|
|
57
46
|
*
|
|
@@ -63,50 +52,40 @@ export type PopoverManagerOptions = {
|
|
|
63
52
|
*/
|
|
64
53
|
verticalDiffThreshold: number;
|
|
65
54
|
/**
|
|
66
|
-
* Supports navigation of the
|
|
55
|
+
* Supports navigation of the pop up via the `device-navigation` package.
|
|
67
56
|
*
|
|
68
57
|
* @default true
|
|
69
58
|
*/
|
|
70
59
|
supportNavigation: boolean;
|
|
71
60
|
};
|
|
72
61
|
/**
|
|
73
|
-
* Output type from `
|
|
62
|
+
* Output type from `PopUpManager.showPopUp`
|
|
74
63
|
*
|
|
75
|
-
* @category
|
|
64
|
+
* @category PopUp
|
|
76
65
|
*/
|
|
77
|
-
export type
|
|
66
|
+
export type ShowPopUpResult = {
|
|
78
67
|
/**
|
|
79
|
-
* Indicates if the
|
|
80
|
-
* in the upwards direction. This is determined by how much space is available on either
|
|
81
|
-
*
|
|
68
|
+
* Indicates if the "pop up" should pop in the downwards direction or not. If not, it should pop
|
|
69
|
+
* in the upwards direction. This is determined by how much space is available on either side of
|
|
70
|
+
* the root element.
|
|
82
71
|
*/
|
|
83
72
|
popDown: boolean;
|
|
84
|
-
|
|
85
|
-
* Indicates if the popover should pop in the rightwards direction or not. If not, it should pop
|
|
86
|
-
* in the leftwards position. This is determined by how much space is available on either
|
|
87
|
-
* horizontal side of the root element.
|
|
88
|
-
*/
|
|
89
|
-
popRight: boolean;
|
|
90
|
-
positions: {
|
|
91
|
-
root: PositionRect;
|
|
92
|
-
container: PositionRect;
|
|
93
|
-
diff: DiffRect;
|
|
94
|
-
};
|
|
73
|
+
positions: Record<'root' | 'container' | 'diff', PositionRect>;
|
|
95
74
|
};
|
|
96
|
-
declare const
|
|
75
|
+
declare const HidePopUpEvent_base: (new (eventInitDict?: EventInit) => import("typed-event-target").TypedEvent<"hide-pop-up">) & Pick<{
|
|
97
76
|
new (type: string, eventInitDict?: EventInit): Event;
|
|
98
77
|
prototype: Event;
|
|
99
78
|
readonly NONE: 0;
|
|
100
79
|
readonly CAPTURING_PHASE: 1;
|
|
101
80
|
readonly AT_TARGET: 2;
|
|
102
81
|
readonly BUBBLING_PHASE: 3;
|
|
103
|
-
}, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedEvent<"hide-
|
|
82
|
+
}, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedEvent<"hide-pop-up">, "type">;
|
|
104
83
|
/**
|
|
105
|
-
* An event fired from {@link
|
|
84
|
+
* An event fired from {@link PopUpManager} when the pop up should be hidden.
|
|
106
85
|
*
|
|
107
|
-
* @category
|
|
86
|
+
* @category PopUp
|
|
108
87
|
*/
|
|
109
|
-
export declare class
|
|
88
|
+
export declare class HidePopUpEvent extends HidePopUpEvent_base {
|
|
110
89
|
}
|
|
111
90
|
declare const NavSelectEvent_base: (new (eventInitDict: {
|
|
112
91
|
bubbles?: boolean;
|
|
@@ -122,44 +101,44 @@ declare const NavSelectEvent_base: (new (eventInitDict: {
|
|
|
122
101
|
readonly BUBBLING_PHASE: 3;
|
|
123
102
|
}, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedCustomEvent<Coords, "nav-select">, "type">;
|
|
124
103
|
/**
|
|
125
|
-
* An event fired from {@link
|
|
126
|
-
*
|
|
104
|
+
* An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
|
|
105
|
+
* by the user.
|
|
127
106
|
*
|
|
128
|
-
* @category
|
|
107
|
+
* @category PopUp
|
|
129
108
|
*/
|
|
130
109
|
export declare class NavSelectEvent extends NavSelectEvent_base {
|
|
131
110
|
}
|
|
132
111
|
/**
|
|
133
|
-
* All events that can be emitted by {@link
|
|
112
|
+
* All events that can be emitted by {@link PopUpManager}.
|
|
134
113
|
*
|
|
135
114
|
* @category Internal
|
|
136
115
|
*/
|
|
137
|
-
export type
|
|
116
|
+
export type PopUpManagerEvents = HidePopUpEvent | NavSelectEvent;
|
|
138
117
|
/**
|
|
139
|
-
* A "
|
|
118
|
+
* A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
|
|
140
119
|
*
|
|
141
|
-
* @category
|
|
120
|
+
* @category PopUp
|
|
142
121
|
*/
|
|
143
|
-
export declare class
|
|
122
|
+
export declare class PopUpManager {
|
|
144
123
|
readonly navController: NavController;
|
|
145
124
|
private listenTarget;
|
|
146
|
-
options:
|
|
125
|
+
options: PopUpManagerOptions;
|
|
147
126
|
private cleanupCallbacks;
|
|
148
127
|
private lastRootElement;
|
|
149
|
-
constructor(navController: NavController, options?: Partial<
|
|
128
|
+
constructor(navController: NavController, options?: Partial<PopUpManagerOptions> | undefined);
|
|
150
129
|
private attachGlobalListeners;
|
|
151
|
-
/** Listen to events emitted from a {@link
|
|
130
|
+
/** Listen to events emitted from a {@link PopUpManager} instance. */
|
|
152
131
|
listen<const EventDefinition extends Readonly<{
|
|
153
|
-
type: ExtractEventTypes<
|
|
154
|
-
}>>(event: EventDefinition, listener: (event: ExtractEventByType<
|
|
155
|
-
/** Trigger removal or hiding of the
|
|
156
|
-
|
|
157
|
-
/** Trigger showing the
|
|
158
|
-
|
|
132
|
+
type: ExtractEventTypes<PopUpManagerEvents>;
|
|
133
|
+
}>>(event: EventDefinition, listener: (event: ExtractEventByType<PopUpManagerEvents, EventDefinition['type']>) => MaybePromise<void>, options?: ListenOptions | undefined): RemoveListenerCallback;
|
|
134
|
+
/** Trigger removal or hiding of the pop up. */
|
|
135
|
+
removePopUp(): void;
|
|
136
|
+
/** Trigger showing the pop up. */
|
|
137
|
+
showPopUp(rootElement: HTMLElement, options?: Partial<PopUpManagerOptions> | undefined): ShowPopUpResult;
|
|
159
138
|
/**
|
|
160
|
-
* Cleanup and destroy the {@link
|
|
139
|
+
* Cleanup and destroy the {@link PopUpManager} instance. This:
|
|
161
140
|
*
|
|
162
|
-
* - Removes the existing
|
|
141
|
+
* - Removes the existing pop up
|
|
163
142
|
* - Cleans up all internal and external listeners
|
|
164
143
|
*/
|
|
165
144
|
destroy(): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { assert } from '@augment-vir/assert';
|
|
1
2
|
import { mapObjectValues } from '@augment-vir/common';
|
|
3
|
+
import { findOverflowAncestor } from '@augment-vir/web';
|
|
2
4
|
import { NavActivateEvent, NavDirection } from 'device-navigation';
|
|
3
5
|
import { listenToPageActivation } from 'page-active';
|
|
4
6
|
import { ListenTarget, defineTypedCustomEvent, defineTypedEvent, listenToGlobal, } from 'typed-event-target';
|
|
@@ -14,30 +16,30 @@ export const emptyPositionRect = {
|
|
|
14
16
|
bottom: 0,
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
|
-
* An event fired from {@link
|
|
19
|
+
* An event fired from {@link PopUpManager} when the pop up should be hidden.
|
|
18
20
|
*
|
|
19
|
-
* @category
|
|
21
|
+
* @category PopUp
|
|
20
22
|
*/
|
|
21
|
-
export class
|
|
23
|
+
export class HidePopUpEvent extends defineTypedEvent('hide-pop-up') {
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
|
-
* An event fired from {@link
|
|
25
|
-
*
|
|
26
|
+
* An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
|
|
27
|
+
* by the user.
|
|
26
28
|
*
|
|
27
|
-
* @category
|
|
29
|
+
* @category PopUp
|
|
28
30
|
*/
|
|
29
31
|
export class NavSelectEvent extends defineTypedCustomEvent()('nav-select') {
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
|
-
* A "
|
|
34
|
+
* A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
|
|
33
35
|
*
|
|
34
|
-
* @category
|
|
36
|
+
* @category PopUp
|
|
35
37
|
*/
|
|
36
|
-
export class
|
|
38
|
+
export class PopUpManager {
|
|
37
39
|
navController;
|
|
38
40
|
listenTarget = new ListenTarget();
|
|
39
41
|
options = {
|
|
40
|
-
|
|
42
|
+
minDownSpace: 200,
|
|
41
43
|
verticalDiffThreshold: 20,
|
|
42
44
|
supportNavigation: true,
|
|
43
45
|
};
|
|
@@ -51,7 +53,7 @@ export class PopoverManager {
|
|
|
51
53
|
let firstFired = false;
|
|
52
54
|
const resizeObserver = new ResizeObserver(() => {
|
|
53
55
|
if (firstFired) {
|
|
54
|
-
this.
|
|
56
|
+
this.removePopUp();
|
|
55
57
|
}
|
|
56
58
|
else {
|
|
57
59
|
firstFired = true;
|
|
@@ -64,7 +66,7 @@ export class PopoverManager {
|
|
|
64
66
|
},
|
|
65
67
|
listenToPageActivation(false, (isPageActive) => {
|
|
66
68
|
if (!isPageActive) {
|
|
67
|
-
this.
|
|
69
|
+
this.removePopUp();
|
|
68
70
|
}
|
|
69
71
|
}),
|
|
70
72
|
this.navController.listen(NavActivateEvent, (event) => {
|
|
@@ -78,15 +80,15 @@ export class PopoverManager {
|
|
|
78
80
|
listenToGlobal('mousedown', (event) => {
|
|
79
81
|
if (this.lastRootElement &&
|
|
80
82
|
event.composedPath().includes(this.lastRootElement)) {
|
|
81
|
-
/** Ignore clicks that came from the
|
|
83
|
+
/** Ignore clicks that came from the pop up host itself. */
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
|
-
this.
|
|
86
|
+
this.removePopUp();
|
|
85
87
|
}, { passive: true }),
|
|
86
88
|
listenToGlobal('keydown', (event) => {
|
|
87
89
|
const keyCode = event.code;
|
|
88
90
|
if (keyCode === 'Escape') {
|
|
89
|
-
this.
|
|
91
|
+
this.removePopUp();
|
|
90
92
|
}
|
|
91
93
|
else if (this.options.supportNavigation) {
|
|
92
94
|
if (keyCode === 'ArrowDown') {
|
|
@@ -130,50 +132,51 @@ export class PopoverManager {
|
|
|
130
132
|
}),
|
|
131
133
|
];
|
|
132
134
|
}
|
|
133
|
-
/** Listen to events emitted from a {@link
|
|
135
|
+
/** Listen to events emitted from a {@link PopUpManager} instance. */
|
|
134
136
|
listen(event, listener, options) {
|
|
135
137
|
return this.listenTarget.listen(event, listener, options);
|
|
136
138
|
}
|
|
137
|
-
/** Trigger removal or hiding of the
|
|
138
|
-
|
|
139
|
+
/** Trigger removal or hiding of the pop up. */
|
|
140
|
+
removePopUp() {
|
|
139
141
|
this.cleanupCallbacks.forEach((callback) => callback());
|
|
140
|
-
this.listenTarget.dispatch(new
|
|
142
|
+
this.listenTarget.dispatch(new HidePopUpEvent());
|
|
141
143
|
}
|
|
142
|
-
/** Trigger showing the
|
|
143
|
-
|
|
144
|
+
/** Trigger showing the pop up. */
|
|
145
|
+
showPopUp(rootElement, options) {
|
|
144
146
|
this.lastRootElement = rootElement;
|
|
145
147
|
const currentOptions = { ...this.options, ...options };
|
|
146
|
-
const container =
|
|
148
|
+
const container = findOverflowAncestor(rootElement);
|
|
149
|
+
assert.instanceOf(container, HTMLElement);
|
|
147
150
|
const rootRect = rootElement.getBoundingClientRect();
|
|
148
151
|
const containerRect = container.getBoundingClientRect();
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
const containerScrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
153
|
+
const containerScrollbarHeight = container.offsetHeight - container.clientHeight;
|
|
154
|
+
const containerPosition = container === document.body
|
|
155
|
+
? {
|
|
156
|
+
top: 0,
|
|
157
|
+
left: 0,
|
|
158
|
+
right: containerRect.width,
|
|
159
|
+
bottom: containerRect.height,
|
|
160
|
+
}
|
|
161
|
+
: {
|
|
162
|
+
top: containerRect.top,
|
|
163
|
+
left: containerRect.left,
|
|
164
|
+
right: containerRect.right - containerScrollbarWidth,
|
|
165
|
+
bottom: containerRect.bottom - containerScrollbarHeight,
|
|
166
|
+
};
|
|
155
167
|
const rootPosition = mapObjectValues(emptyPositionRect, (key) => {
|
|
156
168
|
return rootRect[key];
|
|
157
169
|
});
|
|
158
|
-
const
|
|
170
|
+
const diff = mapObjectValues(emptyPositionRect, (key) => {
|
|
159
171
|
const containerDimension = containerPosition[key];
|
|
160
172
|
const hostDimension = rootPosition[key];
|
|
161
173
|
return Math.abs(containerDimension - hostDimension);
|
|
162
174
|
});
|
|
163
|
-
const diff = {
|
|
164
|
-
...diffPositions,
|
|
165
|
-
rootLeftToContainerRight: containerPosition.right - diffPositions.left,
|
|
166
|
-
rootRightToContainerLeft: containerPosition.right - diffPositions.right,
|
|
167
|
-
rootTopToContainerBottom: containerPosition.bottom - diffPositions.top,
|
|
168
|
-
rootBottomToContainerTop: containerPosition.bottom - diffPositions.bottom,
|
|
169
|
-
};
|
|
170
175
|
const useUp = diff.top > diff.bottom + currentOptions.verticalDiffThreshold &&
|
|
171
|
-
diff.bottom < currentOptions.
|
|
176
|
+
diff.bottom < currentOptions.minDownSpace;
|
|
172
177
|
this.attachGlobalListeners(container);
|
|
173
|
-
const useLeft = diff.rootLeftToContainerRight + 100 < diff.rootRightToContainerLeft;
|
|
174
178
|
return {
|
|
175
179
|
popDown: !useUp,
|
|
176
|
-
popRight: !useLeft,
|
|
177
180
|
positions: {
|
|
178
181
|
container: containerPosition,
|
|
179
182
|
root: rootPosition,
|
|
@@ -182,13 +185,13 @@ export class PopoverManager {
|
|
|
182
185
|
};
|
|
183
186
|
}
|
|
184
187
|
/**
|
|
185
|
-
* Cleanup and destroy the {@link
|
|
188
|
+
* Cleanup and destroy the {@link PopUpManager} instance. This:
|
|
186
189
|
*
|
|
187
|
-
* - Removes the existing
|
|
190
|
+
* - Removes the existing pop up
|
|
188
191
|
* - Cleans up all internal and external listeners
|
|
189
192
|
*/
|
|
190
193
|
destroy() {
|
|
191
|
-
this.
|
|
194
|
+
this.removePopUp();
|
|
192
195
|
this.listenTarget.destroy();
|
|
193
196
|
}
|
|
194
197
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.1.0",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"test:docs": "virmator docs check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@augment-vir/assert": "^31.
|
|
42
|
-
"@augment-vir/common": "^31.
|
|
43
|
-
"@augment-vir/web": "^31.
|
|
41
|
+
"@augment-vir/assert": "^31.45.0",
|
|
42
|
+
"@augment-vir/common": "^31.45.0",
|
|
43
|
+
"@augment-vir/web": "^31.45.0",
|
|
44
44
|
"colorjs.io": "^0.5.2",
|
|
45
45
|
"date-vir": "^8.0.0",
|
|
46
46
|
"device-navigation": "^4.5.5",
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"typed-event-target": "^4.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@augment-vir/test": "^31.
|
|
55
|
+
"@augment-vir/test": "^31.45.0",
|
|
56
56
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
57
57
|
"@web/test-runner": "^0.20.2",
|
|
58
58
|
"@web/test-runner-commands": "^0.9.0",
|
|
59
59
|
"@web/test-runner-playwright": "^0.11.1",
|
|
60
60
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
61
|
-
"esbuild": "^0.25.
|
|
61
|
+
"esbuild": "^0.25.11",
|
|
62
62
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
63
63
|
"markdown-code-example-inserter": "^3.0.3",
|
|
64
64
|
"typedoc": "^0.28.14",
|
|
65
65
|
"typescript": "5.9.3",
|
|
66
|
-
"vite": "^7.1.
|
|
66
|
+
"vite": "^7.1.12",
|
|
67
67
|
"vite-tsconfig-paths": "^5.1.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { type NavController } from 'device-navigation';
|
|
3
|
-
import { type PopoverManager, type ShowPopoverResult } from '../../util/popover-manager.js';
|
|
4
|
-
import { type MenuItem } from './popover-menu-item.js';
|
|
5
|
-
import { type PopoverMenuCornerStyle } from './vira-popover-menu.element.js';
|
|
6
|
-
import { type PopoverOffset } from './vira-popover-trigger.element.js';
|
|
7
|
-
/**
|
|
8
|
-
* Test ids for {@link ViraMenuTrigger}.
|
|
9
|
-
*
|
|
10
|
-
* @category Internal
|
|
11
|
-
*/
|
|
12
|
-
export declare const viraMenuTriggerTestIds: {
|
|
13
|
-
menu: string;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* A more specific wrapper of `ViraPopoverTrigger` that always opens a menu.
|
|
17
|
-
*
|
|
18
|
-
* @category Popover
|
|
19
|
-
* @category Elements
|
|
20
|
-
*/
|
|
21
|
-
export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDefinition<"vira-menu-trigger", {
|
|
22
|
-
items: ReadonlyArray<Readonly<MenuItem>>;
|
|
23
|
-
} & PartialWithUndefined<{
|
|
24
|
-
/** The selected item ids from the given `items` object. */
|
|
25
|
-
selected: ReadonlyArray<PropertyKey>;
|
|
26
|
-
isDisabled: boolean;
|
|
27
|
-
isMultiSelect: boolean;
|
|
28
|
-
z_debug_forceOpenState: boolean;
|
|
29
|
-
popoverOffset: PopoverOffset;
|
|
30
|
-
/** Hide menu item check mark icons. */
|
|
31
|
-
hideCheckIcons: boolean;
|
|
32
|
-
menuCornerStyle: PopoverMenuCornerStyle;
|
|
33
|
-
}>, {
|
|
34
|
-
navController: undefined | NavController;
|
|
35
|
-
popoverManager: undefined | PopoverManager;
|
|
36
|
-
/** `undefined` means the popover is not currently showing. */
|
|
37
|
-
showPopoverResult: ShowPopoverResult | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
itemActivate: import("element-vir").DefineEvent<PropertyKey[]>;
|
|
40
|
-
openChange: import("element-vir").DefineEvent<ShowPopoverResult | undefined>;
|
|
41
|
-
}, "vira-menu-trigger-", "vira-menu-trigger-", readonly [], readonly []>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
/**
|
|
3
|
-
* Possible corner styles for {@link ViraPopoverMenu}.
|
|
4
|
-
*
|
|
5
|
-
* @category Internal
|
|
6
|
-
*/
|
|
7
|
-
export declare enum PopoverMenuCornerStyle {
|
|
8
|
-
/** Rounding of corners depends on the open direction of the menu. */
|
|
9
|
-
Directional = "directional",
|
|
10
|
-
/** All of the menus corners should be rounded. */
|
|
11
|
-
AllRounded = "all-rounded",
|
|
12
|
-
/** None of the menus corners should be rounded. */
|
|
13
|
-
AllSquare = "all-square"
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Menu popover directions available for {@link ViraPopoverMenu}.
|
|
17
|
-
*
|
|
18
|
-
* @category Internal
|
|
19
|
-
*/
|
|
20
|
-
export declare enum PopoverMenuDirection {
|
|
21
|
-
Downwards = "downwards",
|
|
22
|
-
Upwards = "upwards"
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* A simple default style wrapper for popover menus.
|
|
26
|
-
*
|
|
27
|
-
* @category Popover
|
|
28
|
-
* @category Elements
|
|
29
|
-
*/
|
|
30
|
-
export declare const ViraPopoverMenu: import("element-vir").DeclarativeElementDefinition<"vira-popover-menu", PartialWithUndefined<{
|
|
31
|
-
/** @default PopoverMenuDirection.Downwards */
|
|
32
|
-
direction: PopoverMenuDirection;
|
|
33
|
-
/** @default PopoverMenuCornerStyle.Directional */
|
|
34
|
-
cornerStyle: PopoverMenuCornerStyle;
|
|
35
|
-
}>, {}, {}, "vira-popover-menu-open-upwards" | "vira-popover-menu-rounded" | "vira-popover-menu-square", "vira-popover-menu-", readonly [], readonly []>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { NavController, type Coords } from 'device-navigation';
|
|
3
|
-
import { PopoverManager, type ShowPopoverResult } from '../../util/popover-manager.js';
|
|
4
|
-
/**
|
|
5
|
-
* Offsets applied to any menu opened by {@link ViraPopoverTrigger}.
|
|
6
|
-
*
|
|
7
|
-
* @category Internal
|
|
8
|
-
*/
|
|
9
|
-
export type PopoverOffset = PartialWithUndefined<{
|
|
10
|
-
vertical: number;
|
|
11
|
-
right: number;
|
|
12
|
-
left: number;
|
|
13
|
-
}>;
|
|
14
|
-
/**
|
|
15
|
-
* Anchor options for popovers.
|
|
16
|
-
*
|
|
17
|
-
* @category Internal
|
|
18
|
-
*/
|
|
19
|
-
export declare enum HorizontalAnchor {
|
|
20
|
-
/**
|
|
21
|
-
* The left side of the popover will be anchored to the left side of the trigger, allowing the
|
|
22
|
-
* popover to grow on the right side of the trigger.
|
|
23
|
-
*/
|
|
24
|
-
Left = "left",
|
|
25
|
-
/**
|
|
26
|
-
* The Right side of the popover will be anchored to the right side of the trigger, allowing the
|
|
27
|
-
* popover to grow on the left side of the trigger.
|
|
28
|
-
*/
|
|
29
|
-
Right = "right",
|
|
30
|
-
/**
|
|
31
|
-
* Restrict the popover on both sides.
|
|
32
|
-
*
|
|
33
|
-
* This is the default anchor for {@link ViraPopoverTrigger}.
|
|
34
|
-
*/
|
|
35
|
-
Both = "both"
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* An element with slots for a popover trigger and popover contents.
|
|
39
|
-
*
|
|
40
|
-
* @category Popover
|
|
41
|
-
* @category Elements
|
|
42
|
-
* @see https://electrovir.github.io/vira/book/elements/vira-popover-trigger
|
|
43
|
-
*/
|
|
44
|
-
export declare const ViraPopoverTrigger: import("element-vir").DeclarativeElementDefinition<"vira-popover-trigger", PartialWithUndefined<{
|
|
45
|
-
isDisabled: boolean;
|
|
46
|
-
/** For debugging purposes only. Very bad for actual production code use. */
|
|
47
|
-
z_debug_forceOpenState: boolean;
|
|
48
|
-
/** Set to `true` to keep the popover open if it is interacted with. */
|
|
49
|
-
keepOpenAfterInteraction: boolean;
|
|
50
|
-
/** All values in px. */
|
|
51
|
-
popoverOffset?: PopoverOffset;
|
|
52
|
-
}>, {
|
|
53
|
-
/** `undefined` means the popover is not currently showing. */
|
|
54
|
-
showPopoverResult: ShowPopoverResult | undefined;
|
|
55
|
-
popoverManager: PopoverManager;
|
|
56
|
-
}, {
|
|
57
|
-
navSelect: import("element-vir").DefineEvent<Coords>;
|
|
58
|
-
/**
|
|
59
|
-
* - `undefined` indicates that the popover just closed.
|
|
60
|
-
* - {@link ShowPopoverResult} indicates that the popover just opened.
|
|
61
|
-
*/
|
|
62
|
-
openChange: import("element-vir").DefineEvent<ShowPopoverResult | undefined>;
|
|
63
|
-
init: import("element-vir").DefineEvent<{
|
|
64
|
-
navController: NavController;
|
|
65
|
-
popoverManager: PopoverManager;
|
|
66
|
-
}>;
|
|
67
|
-
}, "vira-popover-trigger-disabled", "vira-popover-trigger-", readonly ["trigger", "popover"], readonly []>;
|