vira 26.13.1 → 27.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.
Files changed (38) hide show
  1. package/dist/elements/define-vira-element.d.ts +1 -1
  2. package/dist/elements/index.d.ts +7 -7
  3. package/dist/elements/index.js +7 -7
  4. package/dist/elements/{pop-up/pop-up-helpers.d.ts → popover/popover-helpers.d.ts} +6 -6
  5. package/dist/elements/{pop-up/pop-up-helpers.js → popover/popover-helpers.js} +5 -5
  6. package/dist/elements/{pop-up → popover}/vira-menu-item.element.d.ts +3 -3
  7. package/dist/elements/{pop-up → popover}/vira-menu-item.element.js +1 -1
  8. package/dist/elements/popover/vira-menu-trigger.element.d.ts +41 -0
  9. package/dist/elements/{pop-up → popover}/vira-menu-trigger.element.js +29 -33
  10. package/dist/elements/{pop-up → popover}/vira-menu.element.d.ts +3 -3
  11. package/dist/elements/{pop-up → popover}/vira-menu.element.js +2 -2
  12. package/dist/elements/popover/vira-popover-menu.element.d.ts +35 -0
  13. package/dist/elements/{pop-up/vira-pop-up-menu.element.js → popover/vira-popover-menu.element.js} +23 -23
  14. package/dist/elements/popover/vira-popover-trigger.element.d.ts +67 -0
  15. package/dist/elements/popover/vira-popover-trigger.element.js +301 -0
  16. package/dist/elements/vira-bold-text.element.d.ts +1 -1
  17. package/dist/elements/vira-button.element.d.ts +1 -1
  18. package/dist/elements/vira-checkbox.element.d.ts +1 -1
  19. package/dist/elements/vira-collapsible-wrapper.element.d.ts +1 -1
  20. package/dist/elements/vira-dropdown.element.d.ts +7 -19
  21. package/dist/elements/vira-dropdown.element.js +8 -10
  22. package/dist/elements/vira-icon.element.d.ts +1 -1
  23. package/dist/elements/vira-image.element.d.ts +1 -1
  24. package/dist/elements/vira-input.element.d.ts +1 -1
  25. package/dist/elements/vira-input.element.js +17 -8
  26. package/dist/elements/vira-link.element.d.ts +1 -1
  27. package/dist/elements/vira-progress.element.d.ts +1 -1
  28. package/dist/util/index.d.ts +1 -1
  29. package/dist/util/index.js +1 -1
  30. package/dist/util/{pop-up-manager.d.ts → popover-manager.d.ts} +60 -39
  31. package/dist/util/{pop-up-manager.js → popover-manager.js} +42 -45
  32. package/package.json +6 -6
  33. package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +0 -55
  34. package/dist/elements/pop-up/vira-pop-up-menu.element.d.ts +0 -35
  35. package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +0 -81
  36. package/dist/elements/pop-up/vira-pop-up-trigger.element.js +0 -282
  37. /package/dist/elements/{pop-up/pop-up-menu-item.d.ts → popover/popover-menu-item.d.ts} +0 -0
  38. /package/dist/elements/{pop-up/pop-up-menu-item.js → popover/popover-menu-item.js} +0 -0
@@ -12,6 +12,17 @@ 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
+ };
15
26
  /**
16
27
  * The default empty {@link PositionRect}, with all values set to 0.
17
28
  *
@@ -19,15 +30,15 @@ export type PositionRect = {
19
30
  */
20
31
  export declare const emptyPositionRect: PositionRect;
21
32
  /**
22
- * Options for {@link PopUpManager}.
33
+ * Options for {@link PopoverManager}.
23
34
  *
24
- * @category PopUp
35
+ * @category Popover
25
36
  */
26
- export type PopUpManagerOptions = {
37
+ export type PopoverManagerOptions = {
27
38
  /**
28
- * The minimum number of pixels for allowing the pop-up to go downwards. If the downward
39
+ * The minimum number of pixels for allowing the popover to go downwards. If the downward
29
40
  * available space is less than this, and if the upwards available space is
30
- * `verticalDiffThreshold` more than the downwards space, the pop-up will be directed upwards.
41
+ * `verticalDiffThreshold` more than the downwards space, the popover will be directed upwards.
31
42
  *
32
43
  * Equation:
33
44
  *
@@ -37,10 +48,10 @@ export type PopUpManagerOptions = {
37
48
  *
38
49
  * @default 200
39
50
  */
40
- minDownSpace: number;
51
+ minDownwardsSpace: number;
41
52
  /**
42
53
  * The number of pixels required for the upwards available space to be bigger than the downwards
43
- * available space before directing the pop-up upwards.
54
+ * available space before directing the popover upwards.
44
55
  *
45
56
  * Equation:
46
57
  *
@@ -52,40 +63,50 @@ export type PopUpManagerOptions = {
52
63
  */
53
64
  verticalDiffThreshold: number;
54
65
  /**
55
- * Supports navigation of the pop up via the `device-navigation` package.
66
+ * Supports navigation of the popover via the `device-navigation` package.
56
67
  *
57
68
  * @default true
58
69
  */
59
70
  supportNavigation: boolean;
60
71
  };
61
72
  /**
62
- * Output type from `PopUpManager.showPopUp`
73
+ * Output type from `PopoverManager.showPopover`
63
74
  *
64
- * @category PopUp
75
+ * @category Popover
65
76
  */
66
- export type ShowPopUpResult = {
77
+ export type ShowPopoverResult = {
67
78
  /**
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.
79
+ * Indicates if the popover should pop in the downwards direction or not. If not, it should pop
80
+ * in the upwards direction. This is determined by how much space is available on either
81
+ * vertical side of the root element.
71
82
  */
72
83
  popDown: boolean;
73
- positions: Record<'root' | 'container' | 'diff', PositionRect>;
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
+ };
74
95
  };
75
- declare const HidePopUpEvent_base: (new (eventInitDict?: EventInit) => import("typed-event-target").TypedEvent<"hide-pop-up">) & Pick<{
96
+ declare const HidePopoverEvent_base: (new (eventInitDict?: EventInit) => import("typed-event-target").TypedEvent<"hide-popover">) & Pick<{
76
97
  new (type: string, eventInitDict?: EventInit): Event;
77
98
  prototype: Event;
78
99
  readonly NONE: 0;
79
100
  readonly CAPTURING_PHASE: 1;
80
101
  readonly AT_TARGET: 2;
81
102
  readonly BUBBLING_PHASE: 3;
82
- }, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedEvent<"hide-pop-up">, "type">;
103
+ }, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedEvent<"hide-popover">, "type">;
83
104
  /**
84
- * An event fired from {@link PopUpManager} when the pop up should be hidden.
105
+ * An event fired from {@link PopoverManager} when the popover should be hidden.
85
106
  *
86
- * @category PopUp
107
+ * @category Popover
87
108
  */
88
- export declare class HidePopUpEvent extends HidePopUpEvent_base {
109
+ export declare class HidePopoverEvent extends HidePopoverEvent_base {
89
110
  }
90
111
  declare const NavSelectEvent_base: (new (eventInitDict: {
91
112
  bubbles?: boolean;
@@ -101,44 +122,44 @@ declare const NavSelectEvent_base: (new (eventInitDict: {
101
122
  readonly BUBBLING_PHASE: 3;
102
123
  }, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedCustomEvent<Coords, "nav-select">, "type">;
103
124
  /**
104
- * An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
105
- * by the user.
125
+ * An event fired from {@link PopoverManager} when an individual item in the popover has been
126
+ * selected by the user.
106
127
  *
107
- * @category PopUp
128
+ * @category Popover
108
129
  */
109
130
  export declare class NavSelectEvent extends NavSelectEvent_base {
110
131
  }
111
132
  /**
112
- * All events that can be emitted by {@link PopUpManager}.
133
+ * All events that can be emitted by {@link PopoverManager}.
113
134
  *
114
135
  * @category Internal
115
136
  */
116
- export type PopUpManagerEvents = HidePopUpEvent | NavSelectEvent;
137
+ export type PopoverManagerEvents = HidePopoverEvent | NavSelectEvent;
117
138
  /**
118
- * A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
139
+ * A "popover" manager for items that popover from the HTML page, like dropdowns or menus.
119
140
  *
120
- * @category PopUp
141
+ * @category Popover
121
142
  */
122
- export declare class PopUpManager {
143
+ export declare class PopoverManager {
123
144
  readonly navController: NavController;
124
145
  private listenTarget;
125
- options: PopUpManagerOptions;
146
+ options: PopoverManagerOptions;
126
147
  private cleanupCallbacks;
127
148
  private lastRootElement;
128
- constructor(navController: NavController, options?: Partial<PopUpManagerOptions> | undefined);
149
+ constructor(navController: NavController, options?: Partial<PopoverManagerOptions> | undefined);
129
150
  private attachGlobalListeners;
130
- /** Listen to events emitted from a {@link PopUpManager} instance. */
151
+ /** Listen to events emitted from a {@link PopoverManager} instance. */
131
152
  listen<const EventDefinition extends Readonly<{
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;
153
+ type: ExtractEventTypes<PopoverManagerEvents>;
154
+ }>>(event: EventDefinition, listener: (event: ExtractEventByType<PopoverManagerEvents, EventDefinition['type']>) => MaybePromise<void>, options?: ListenOptions | undefined): RemoveListenerCallback;
155
+ /** Trigger removal or hiding of the popover. */
156
+ removePopover(): void;
157
+ /** Trigger showing the popover. */
158
+ showPopover(rootElement: HTMLElement, options?: Partial<PopoverManagerOptions> | undefined): ShowPopoverResult;
138
159
  /**
139
- * Cleanup and destroy the {@link PopUpManager} instance. This:
160
+ * Cleanup and destroy the {@link PopoverManager} instance. This:
140
161
  *
141
- * - Removes the existing pop up
162
+ * - Removes the existing popover
142
163
  * - Cleans up all internal and external listeners
143
164
  */
144
165
  destroy(): void;
@@ -1,6 +1,4 @@
1
- import { assert } from '@augment-vir/assert';
2
1
  import { mapObjectValues } from '@augment-vir/common';
3
- import { findOverflowAncestor } from '@augment-vir/web';
4
2
  import { NavActivateEvent, NavDirection } from 'device-navigation';
5
3
  import { listenToPageActivation } from 'page-active';
6
4
  import { ListenTarget, defineTypedCustomEvent, defineTypedEvent, listenToGlobal, } from 'typed-event-target';
@@ -16,30 +14,30 @@ export const emptyPositionRect = {
16
14
  bottom: 0,
17
15
  };
18
16
  /**
19
- * An event fired from {@link PopUpManager} when the pop up should be hidden.
17
+ * An event fired from {@link PopoverManager} when the popover should be hidden.
20
18
  *
21
- * @category PopUp
19
+ * @category Popover
22
20
  */
23
- export class HidePopUpEvent extends defineTypedEvent('hide-pop-up') {
21
+ export class HidePopoverEvent extends defineTypedEvent('hide-popover') {
24
22
  }
25
23
  /**
26
- * An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
27
- * by the user.
24
+ * An event fired from {@link PopoverManager} when an individual item in the popover has been
25
+ * selected by the user.
28
26
  *
29
- * @category PopUp
27
+ * @category Popover
30
28
  */
31
29
  export class NavSelectEvent extends defineTypedCustomEvent()('nav-select') {
32
30
  }
33
31
  /**
34
- * A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
32
+ * A "popover" manager for items that popover from the HTML page, like dropdowns or menus.
35
33
  *
36
- * @category PopUp
34
+ * @category Popover
37
35
  */
38
- export class PopUpManager {
36
+ export class PopoverManager {
39
37
  navController;
40
38
  listenTarget = new ListenTarget();
41
39
  options = {
42
- minDownSpace: 200,
40
+ minDownwardsSpace: 200,
43
41
  verticalDiffThreshold: 20,
44
42
  supportNavigation: true,
45
43
  };
@@ -53,7 +51,7 @@ export class PopUpManager {
53
51
  let firstFired = false;
54
52
  const resizeObserver = new ResizeObserver(() => {
55
53
  if (firstFired) {
56
- this.removePopUp();
54
+ this.removePopover();
57
55
  }
58
56
  else {
59
57
  firstFired = true;
@@ -66,7 +64,7 @@ export class PopUpManager {
66
64
  },
67
65
  listenToPageActivation(false, (isPageActive) => {
68
66
  if (!isPageActive) {
69
- this.removePopUp();
67
+ this.removePopover();
70
68
  }
71
69
  }),
72
70
  this.navController.listen(NavActivateEvent, (event) => {
@@ -80,15 +78,15 @@ export class PopUpManager {
80
78
  listenToGlobal('mousedown', (event) => {
81
79
  if (this.lastRootElement &&
82
80
  event.composedPath().includes(this.lastRootElement)) {
83
- /** Ignore clicks that came from the pop up host itself. */
81
+ /** Ignore clicks that came from the popover host itself. */
84
82
  return;
85
83
  }
86
- this.removePopUp();
84
+ this.removePopover();
87
85
  }, { passive: true }),
88
86
  listenToGlobal('keydown', (event) => {
89
87
  const keyCode = event.code;
90
88
  if (keyCode === 'Escape') {
91
- this.removePopUp();
89
+ this.removePopover();
92
90
  }
93
91
  else if (this.options.supportNavigation) {
94
92
  if (keyCode === 'ArrowDown') {
@@ -132,51 +130,50 @@ export class PopUpManager {
132
130
  }),
133
131
  ];
134
132
  }
135
- /** Listen to events emitted from a {@link PopUpManager} instance. */
133
+ /** Listen to events emitted from a {@link PopoverManager} instance. */
136
134
  listen(event, listener, options) {
137
135
  return this.listenTarget.listen(event, listener, options);
138
136
  }
139
- /** Trigger removal or hiding of the pop up. */
140
- removePopUp() {
137
+ /** Trigger removal or hiding of the popover. */
138
+ removePopover() {
141
139
  this.cleanupCallbacks.forEach((callback) => callback());
142
- this.listenTarget.dispatch(new HidePopUpEvent());
140
+ this.listenTarget.dispatch(new HidePopoverEvent());
143
141
  }
144
- /** Trigger showing the pop up. */
145
- showPopUp(rootElement, options) {
142
+ /** Trigger showing the popover. */
143
+ showPopover(rootElement, options) {
146
144
  this.lastRootElement = rootElement;
147
145
  const currentOptions = { ...this.options, ...options };
148
- const container = findOverflowAncestor(rootElement);
149
- assert.instanceOf(container, HTMLElement);
146
+ const container = window.document.body;
150
147
  const rootRect = rootElement.getBoundingClientRect();
151
148
  const containerRect = container.getBoundingClientRect();
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
- };
149
+ const containerPosition = {
150
+ top: 0,
151
+ left: 0,
152
+ right: containerRect.width,
153
+ bottom: containerRect.height,
154
+ };
167
155
  const rootPosition = mapObjectValues(emptyPositionRect, (key) => {
168
156
  return rootRect[key];
169
157
  });
170
- const diff = mapObjectValues(emptyPositionRect, (key) => {
158
+ const diffPositions = mapObjectValues(emptyPositionRect, (key) => {
171
159
  const containerDimension = containerPosition[key];
172
160
  const hostDimension = rootPosition[key];
173
161
  return Math.abs(containerDimension - hostDimension);
174
162
  });
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
+ };
175
170
  const useUp = diff.top > diff.bottom + currentOptions.verticalDiffThreshold &&
176
- diff.bottom < currentOptions.minDownSpace;
171
+ diff.bottom < currentOptions.minDownwardsSpace;
177
172
  this.attachGlobalListeners(container);
173
+ const useLeft = diff.rootLeftToContainerRight + 100 < diff.rootRightToContainerLeft;
178
174
  return {
179
175
  popDown: !useUp,
176
+ popRight: !useLeft,
180
177
  positions: {
181
178
  container: containerPosition,
182
179
  root: rootPosition,
@@ -185,13 +182,13 @@ export class PopUpManager {
185
182
  };
186
183
  }
187
184
  /**
188
- * Cleanup and destroy the {@link PopUpManager} instance. This:
185
+ * Cleanup and destroy the {@link PopoverManager} instance. This:
189
186
  *
190
- * - Removes the existing pop up
187
+ * - Removes the existing popover
191
188
  * - Cleans up all internal and external listeners
192
189
  */
193
190
  destroy() {
194
- this.removePopUp();
191
+ this.removePopover();
195
192
  this.listenTarget.destroy();
196
193
  }
197
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "26.13.1",
3
+ "version": "27.0.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.40.0",
42
- "@augment-vir/common": "^31.40.0",
43
- "@augment-vir/web": "^31.40.0",
41
+ "@augment-vir/assert": "^31.41.0",
42
+ "@augment-vir/common": "^31.41.0",
43
+ "@augment-vir/web": "^31.41.0",
44
44
  "colorjs.io": "^0.5.2",
45
45
  "date-vir": "^8.0.0",
46
46
  "device-navigation": "^4.5.5",
@@ -52,7 +52,7 @@
52
52
  "typed-event-target": "^4.1.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@augment-vir/test": "^31.40.0",
55
+ "@augment-vir/test": "^31.41.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",
@@ -63,7 +63,7 @@
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.9",
66
+ "vite": "^7.1.10",
67
67
  "vite-tsconfig-paths": "^5.1.4"
68
68
  },
69
69
  "peerDependencies": {
@@ -1,55 +0,0 @@
1
- import { type PartialWithUndefined } from '@augment-vir/common';
2
- import { type NavController } from 'device-navigation';
3
- import { type PopUpManager, type ShowPopUpResult } from '../../util/pop-up-manager.js';
4
- import { type MenuItem } from './pop-up-menu-item.js';
5
- import { type PopUpMenuCornerStyle } from './vira-pop-up-menu.element.js';
6
- import { HorizontalAnchor, type PopUpOffset } from './vira-pop-up-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 `ViraPopUpTrigger` that always opens a menu.
17
- *
18
- * @category PopUp
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
- popUpOffset: PopUpOffset;
30
- /** Hide menu item check mark icons. */
31
- hideCheckIcons: boolean;
32
- menuCornerStyle: PopUpMenuCornerStyle;
33
- /**
34
- * - `HorizontalAnchor.Left`: pop-up is anchored to the left side of the trigger and the
35
- * pop-up can grow to the right.
36
- * - `HorizontalAnchor.Right`: pop-up is anchored to the right side of the trigger and the
37
- * pop-up can grow to the left.
38
- * - `HorizontalAnchor.Both`: pop-up is anchored on both sides of the trigger and cannot grow
39
- * beyond it.
40
- *
41
- * Note that when `HorizontalAnchor.Both` is _not_ used, this anchor will cancel out any
42
- * `popUpOffset` for the direction _opposite_ of the chosen anchor.
43
- *
44
- * @default HorizontalAnchor.Left
45
- */
46
- horizontalAnchor: HorizontalAnchor;
47
- }>, {
48
- navController: undefined | NavController;
49
- popUpManager: undefined | PopUpManager;
50
- /** `undefined` means the pop up is not currently showing. */
51
- showPopUpResult: ShowPopUpResult | undefined;
52
- }, {
53
- itemActivate: import("element-vir").DefineEvent<PropertyKey[]>;
54
- openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
55
- }, "vira-menu-trigger-", "vira-menu-trigger-", readonly []>;
@@ -1,35 +0,0 @@
1
- import { type PartialWithUndefined } from '@augment-vir/common';
2
- /**
3
- * Possible corner styles for {@link ViraPopUpMenu}.
4
- *
5
- * @category Internal
6
- */
7
- export declare enum PopUpMenuCornerStyle {
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 pop-up directions available for {@link ViraPopUpMenu}.
17
- *
18
- * @category Internal
19
- */
20
- export declare enum PopUpMenuDirection {
21
- Downwards = "downwards",
22
- Upwards = "upwards"
23
- }
24
- /**
25
- * A simple default style wrapper for pop-up menus.
26
- *
27
- * @category PopUp
28
- * @category Elements
29
- */
30
- export declare const ViraPopUpMenu: import("element-vir").DeclarativeElementDefinition<"vira-pop-up-menu", PartialWithUndefined<{
31
- /** @default PopUpMenuDirection.Downwards */
32
- direction: PopUpMenuDirection;
33
- /** @default PopUpMenuCornerStyle.Directional */
34
- cornerStyle: PopUpMenuCornerStyle;
35
- }>, {}, {}, "vira-pop-up-menu-open-upwards" | "vira-pop-up-menu-rounded" | "vira-pop-up-menu-square", "vira-pop-up-menu-", readonly []>;
@@ -1,81 +0,0 @@
1
- import { type PartialWithUndefined } from '@augment-vir/common';
2
- import { NavController, type Coords } from 'device-navigation';
3
- import { PopUpManager, type ShowPopUpResult } from '../../util/pop-up-manager.js';
4
- /**
5
- * Offsets applied to any menu opened by {@link ViraPopUpTrigger}.
6
- *
7
- * @category Internal
8
- */
9
- export type PopUpOffset = PartialWithUndefined<{
10
- vertical: number;
11
- right: number;
12
- left: number;
13
- }>;
14
- /**
15
- * Anchor options for pop-ups.
16
- *
17
- * @category Internal
18
- */
19
- export declare enum HorizontalAnchor {
20
- /**
21
- * The left side of the pop-up will be anchored to the left side of the trigger, allowing the
22
- * pop-up to grow on the right side of the trigger.
23
- */
24
- Left = "left",
25
- /**
26
- * The Right side of the pop-up will be anchored to the right side of the trigger, allowing the
27
- * pop-up to grow on the left side of the trigger.
28
- */
29
- Right = "right",
30
- /**
31
- * Restrict the pop-up on both sides.
32
- *
33
- * This is the default anchor for {@link ViraPopUpTrigger}.
34
- */
35
- Both = "both"
36
- }
37
- /**
38
- * An element with slots for a pop-up trigger and pop-up contents.
39
- *
40
- * @category PopUp
41
- * @category Elements
42
- * @see https://electrovir.github.io/vira/book/elements/vira-pop-up-trigger
43
- */
44
- export declare const ViraPopUpTrigger: import("element-vir").DeclarativeElementDefinition<"vira-pop-up-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 pop-up open if it is interacted with. */
49
- keepOpenAfterInteraction: boolean;
50
- /** All values in px. */
51
- popUpOffset?: PopUpOffset;
52
- /**
53
- * - `HorizontalAnchor.Left`: pop-up is anchored to the left side of the trigger and the
54
- * pop-up can grow to the right.
55
- * - `HorizontalAnchor.Right`: pop-up is anchored to the right side of the trigger and the
56
- * pop-up can grow to the left.
57
- * - `HorizontalAnchor.Both`: pop-up is anchored on both sides of the trigger and cannot grow
58
- * beyond it. (This is the default experience.)
59
- *
60
- * Note that when `HorizontalAnchor.Both` is _not_ used, this anchor will cancel out any
61
- * `popUpOffset` for the direction _opposite_ of the chosen anchor.
62
- *
63
- * @default HorizontalAnchor.Both
64
- */
65
- horizontalAnchor?: HorizontalAnchor;
66
- }>, {
67
- /** `undefined` means the pop up is not currently showing. */
68
- showPopUpResult: ShowPopUpResult | undefined;
69
- popUpManager: PopUpManager;
70
- }, {
71
- navSelect: import("element-vir").DefineEvent<Coords>;
72
- /**
73
- * - `undefined` indicates that the pop-up just closed.
74
- * - {@link ShowPopUpResult} indicates that the pop-up just opened.
75
- */
76
- openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
77
- init: import("element-vir").DefineEvent<{
78
- navController: NavController;
79
- popUpManager: PopUpManager;
80
- }>;
81
- }, "vira-pop-up-trigger-disabled", "vira-pop-up-trigger-", readonly ["trigger", "popUp"]>;