vira 25.9.0 → 25.10.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.
@@ -2,6 +2,7 @@ import { type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type NavController } from 'device-navigation';
3
3
  import { type PopUpManager, type ShowPopUpResult } from '../../util/pop-up-manager.js';
4
4
  import { type MenuItem } from './pop-up-menu-item.js';
5
+ import { type PopUpMenuCornerStyle } from './vira-pop-up-menu.element.js';
5
6
  import { type PopUpOffset } from './vira-pop-up-trigger.element.js';
6
7
  /**
7
8
  * Test ids for {@link ViraMenuTrigger}.
@@ -28,6 +29,7 @@ export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDe
28
29
  popUpOffset: PopUpOffset;
29
30
  /** Hide menu item check mark icons. */
30
31
  hideCheckIcons: boolean;
32
+ menuCornerStyle: PopUpMenuCornerStyle;
31
33
  }>, {
32
34
  navController: undefined | NavController;
33
35
  popUpManager: undefined | PopUpManager;
@@ -2,7 +2,7 @@ import { classMap, css, defineElementEvent, html, listen, nothing, testId } from
2
2
  import { defineViraElement } from '../define-vira-element.js';
3
3
  import { updateSelectedItems } from './pop-up-helpers.js';
4
4
  import { ViraMenu } from './vira-menu.element.js';
5
- import { ViraPopUpMenu } from './vira-pop-up-menu.element.js';
5
+ import { PopUpMenuDirection, ViraPopUpMenu, } from './vira-pop-up-menu.element.js';
6
6
  import { ViraPopUpTrigger } from './vira-pop-up-trigger.element.js';
7
7
  /**
8
8
  * Test ids for {@link ViraMenuTrigger}.
@@ -86,7 +86,10 @@ export const ViraMenuTrigger = defineViraElement()({
86
86
  ${state.navController && state.showPopUpResult
87
87
  ? html `
88
88
  <${ViraPopUpMenu.assign({
89
- openUpwards: !state.showPopUpResult.popDown,
89
+ direction: state.showPopUpResult.popDown
90
+ ? PopUpMenuDirection.Downwards
91
+ : PopUpMenuDirection.Upwards,
92
+ cornerStyle: inputs.menuCornerStyle,
90
93
  })}
91
94
  slot=${ViraPopUpTrigger.slotNames.popUp}
92
95
  >
@@ -1,10 +1,35 @@
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
+ }
1
24
  /**
2
25
  * A simple default style wrapper for pop-up menus.
3
26
  *
4
27
  * @category PopUp
5
28
  * @category Elements
6
29
  */
7
- export declare const ViraPopUpMenu: import("element-vir").DeclarativeElementDefinition<"vira-pop-up-menu", {
8
- /** If true, indicates that the menu is opening upwards and should be styled accordingly. */
9
- openUpwards?: boolean;
10
- }, {}, {}, "vira-pop-up-menu-open-upwards", "vira-pop-up-menu-", readonly []>;
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 []>;
@@ -3,6 +3,30 @@ import { viraBorders } from '../../styles/border.js';
3
3
  import { viraFormCssVars } from '../../styles/form-themes.js';
4
4
  import { viraShadows } from '../../styles/shadows.js';
5
5
  import { defineViraElement } from '../define-vira-element.js';
6
+ /**
7
+ * Possible corner styles for {@link ViraPopUpMenu}.
8
+ *
9
+ * @category Internal
10
+ */
11
+ export var PopUpMenuCornerStyle;
12
+ (function (PopUpMenuCornerStyle) {
13
+ /** Rounding of corners depends on the open direction of the menu. */
14
+ PopUpMenuCornerStyle["Directional"] = "directional";
15
+ /** All of the menus corners should be rounded. */
16
+ PopUpMenuCornerStyle["AllRounded"] = "all-rounded";
17
+ /** None of the menus corners should be rounded. */
18
+ PopUpMenuCornerStyle["AllSquare"] = "all-square";
19
+ })(PopUpMenuCornerStyle || (PopUpMenuCornerStyle = {}));
20
+ /**
21
+ * Menu pop-up directions available for {@link ViraPopUpMenu}.
22
+ *
23
+ * @category Internal
24
+ */
25
+ export var PopUpMenuDirection;
26
+ (function (PopUpMenuDirection) {
27
+ PopUpMenuDirection["Downwards"] = "downwards";
28
+ PopUpMenuDirection["Upwards"] = "upwards";
29
+ })(PopUpMenuDirection || (PopUpMenuDirection = {}));
6
30
  /**
7
31
  * A simple default style wrapper for pop-up menus.
8
32
  *
@@ -12,7 +36,9 @@ import { defineViraElement } from '../define-vira-element.js';
12
36
  export const ViraPopUpMenu = defineViraElement()({
13
37
  tagName: 'vira-pop-up-menu',
14
38
  hostClasses: {
15
- 'vira-pop-up-menu-open-upwards': ({ inputs }) => !!inputs.openUpwards,
39
+ 'vira-pop-up-menu-open-upwards': ({ inputs }) => inputs.direction === PopUpMenuDirection.Upwards,
40
+ 'vira-pop-up-menu-rounded': ({ inputs }) => inputs.cornerStyle === PopUpMenuCornerStyle.AllRounded,
41
+ 'vira-pop-up-menu-square': ({ inputs }) => inputs.cornerStyle === PopUpMenuCornerStyle.AllSquare,
16
42
  },
17
43
  styles: ({ hostClasses }) => css `
18
44
  :host {
@@ -33,11 +59,18 @@ export const ViraPopUpMenu = defineViraElement()({
33
59
  }
34
60
 
35
61
  ${hostClasses['vira-pop-up-menu-open-upwards'].selector} {
62
+ ${viraShadows.menuShadowReversed}
63
+ border-radius: ${viraBorders['vira-form-input-radius'].value};
36
64
  border-bottom-left-radius: 0;
37
65
  border-bottom-right-radius: 0;
38
- border-top-left-radius: ${viraBorders['vira-form-input-radius'].value};
39
- border-top-right-radius: ${viraBorders['vira-form-input-radius'].value};
40
- ${viraShadows.menuShadowReversed}
66
+ }
67
+
68
+ ${hostClasses['vira-pop-up-menu-square'].selector} {
69
+ border-radius: 0;
70
+ }
71
+
72
+ ${hostClasses['vira-pop-up-menu-rounded'].selector} {
73
+ border-radius: ${viraBorders['vira-form-input-radius'].value};
41
74
  }
42
75
  `,
43
76
  render() {
@@ -1,4 +1,8 @@
1
- /** Use this element to reserve space for bolded text, even if it isn't bold yet. */
1
+ /**
2
+ * Use this element to reserve space for bolded text, even if it isn't bold yet.
3
+ *
4
+ * @category Elements
5
+ */
2
6
  export declare const ViraBoldText: import("element-vir").DeclarativeElementDefinition<"vira-bold", {
3
7
  bold: boolean;
4
8
  text: string;
@@ -1,6 +1,10 @@
1
1
  import { css, html } from 'element-vir';
2
2
  import { defineViraElement } from './define-vira-element.js';
3
- /** Use this element to reserve space for bolded text, even if it isn't bold yet. */
3
+ /**
4
+ * Use this element to reserve space for bolded text, even if it isn't bold yet.
5
+ *
6
+ * @category Elements
7
+ */
4
8
  export const ViraBoldText = defineViraElement()({
5
9
  tagName: 'vira-bold',
6
10
  cssVars: {
@@ -21,7 +21,7 @@ export declare const emptyPositionRect: PositionRect;
21
21
  /**
22
22
  * Options for {@link PopUpManager}.
23
23
  *
24
- * @category Pop Up
24
+ * @category PopUp
25
25
  */
26
26
  export type PopUpManagerOptions = {
27
27
  /**
@@ -61,7 +61,7 @@ export type PopUpManagerOptions = {
61
61
  /**
62
62
  * Output type from {@link PopUpManager.showPopUp}
63
63
  *
64
- * @category Pop Up
64
+ * @category PopUp
65
65
  */
66
66
  export type ShowPopUpResult = {
67
67
  /**
@@ -83,7 +83,7 @@ declare const HidePopUpEvent_base: (new (eventInitDict?: EventInit) => import("t
83
83
  /**
84
84
  * An event fired from {@link PopUpManager} when the pop up should be hidden.
85
85
  *
86
- * @category Pop Up
86
+ * @category PopUp
87
87
  */
88
88
  export declare class HidePopUpEvent extends HidePopUpEvent_base {
89
89
  }
@@ -104,7 +104,7 @@ declare const NavSelectEvent_base: (new (eventInitDict: {
104
104
  * An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
105
105
  * by the user.
106
106
  *
107
- * @category Pop Up
107
+ * @category PopUp
108
108
  */
109
109
  export declare class NavSelectEvent extends NavSelectEvent_base {
110
110
  }
@@ -117,7 +117,7 @@ export type PopUpManagerEvents = HidePopUpEvent | NavSelectEvent;
117
117
  /**
118
118
  * A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
119
119
  *
120
- * @category Pop Up
120
+ * @category PopUp
121
121
  */
122
122
  export declare class PopUpManager {
123
123
  readonly navController: NavController;
@@ -18,7 +18,7 @@ export const emptyPositionRect = {
18
18
  /**
19
19
  * An event fired from {@link PopUpManager} when the pop up should be hidden.
20
20
  *
21
- * @category Pop Up
21
+ * @category PopUp
22
22
  */
23
23
  export class HidePopUpEvent extends defineTypedEvent('hide-pop-up') {
24
24
  }
@@ -26,14 +26,14 @@ export class HidePopUpEvent extends defineTypedEvent('hide-pop-up') {
26
26
  * An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
27
27
  * by the user.
28
28
  *
29
- * @category Pop Up
29
+ * @category PopUp
30
30
  */
31
31
  export class NavSelectEvent extends defineTypedCustomEvent()('nav-select') {
32
32
  }
33
33
  /**
34
34
  * A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
35
35
  *
36
- * @category Pop Up
36
+ * @category PopUp
37
37
  */
38
38
  export class PopUpManager {
39
39
  navController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "25.9.0",
3
+ "version": "25.10.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",
@@ -67,7 +67,7 @@
67
67
  "vite-tsconfig-paths": "^5.1.4"
68
68
  },
69
69
  "peerDependencies": {
70
- "element-vir": "^25.9.0"
70
+ "element-vir": "^25.10.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22"