vira 28.18.1 → 28.19.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.
@@ -3,7 +3,7 @@ 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
5
  import { type PopUpMenuCornerStyle } from './vira-pop-up-menu.element.js';
6
- import { HorizontalAnchor, type PopUpOffset } from './vira-pop-up-trigger.element.js';
6
+ import { type PopUpOffset, type PopUpTriggerPosition } from './vira-pop-up-trigger.element.js';
7
7
  /**
8
8
  * Test ids for {@link ViraMenuTrigger}.
9
9
  *
@@ -30,29 +30,7 @@ export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDe
30
30
  /** Hide menu item check mark icons. */
31
31
  hideCheckIcons: boolean;
32
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
- * When `true`, the pop-up will not have its maximum height/width constrained to fit within
49
- * the overflow container. The positioning logic (up/down, left/right) will still be
50
- * applied.
51
- *
52
- * @default false
53
- */
54
- ignoreMaxDimensions: boolean;
55
- }>, {
33
+ } & PopUpTriggerPosition>, {
56
34
  navController: undefined | NavController;
57
35
  popUpManager: undefined | PopUpManager;
58
36
  /** `undefined` means the pop up is not currently showing. */
@@ -51,12 +51,10 @@ export const ViraMenuTrigger = defineViraElement()({
51
51
  render({ inputs, state, updateState, dispatch, events }) {
52
52
  return html `
53
53
  <${ViraPopUpTrigger.assign({
54
- isDisabled: inputs.isDisabled,
54
+ ...inputs,
55
55
  keepOpenAfterInteraction: true,
56
- z_debug_forceOpenState: inputs.z_debug_forceOpenState,
57
56
  popUpOffset: inputs.popUpOffset,
58
57
  horizontalAnchor: inputs.horizontalAnchor || HorizontalAnchor.Left,
59
- ignoreMaxDimensions: inputs.ignoreMaxDimensions,
60
58
  })}
61
59
  class=${classMap({
62
60
  open: !!state.showPopUpResult,
@@ -38,44 +38,55 @@ export declare enum HorizontalAnchor {
38
38
  Auto = "auto"
39
39
  }
40
40
  /**
41
- * An element with slots for a pop-up trigger and pop-up contents.
41
+ * Configs for {@link ViraPopUpTrigger} pop-up positioning and sizing.
42
42
  *
43
- * @category PopUp
44
- * @category Elements
45
- * @see https://electrovir.github.io/vira/book/elements/vira-pop-up-trigger
43
+ * @category Internal
46
44
  */
47
- export declare const ViraPopUpTrigger: import("element-vir").DeclarativeElementDefinition<"vira-pop-up-trigger", PartialWithUndefined<{
48
- isDisabled: boolean;
49
- /** For debugging purposes only. Very bad for actual production code use. */
50
- z_debug_forceOpenState: boolean;
51
- /** Set to `true` to keep the pop-up open if it is interacted with. */
52
- keepOpenAfterInteraction: boolean;
53
- /** All values in px. */
54
- popUpOffset: PopUpOffset;
45
+ export type PopUpTriggerPosition = {
55
46
  /**
56
- * - `HorizontalAnchor.Left`: pop-up is anchored to the left side of the trigger and the
57
- * pop-up can grow to the right.
58
- * - `HorizontalAnchor.Right`: pop-up is anchored to the right side of the trigger and the
59
- * pop-up can grow to the left.
47
+ * - `HorizontalAnchor.Left`: pop-up is anchored to the left side of the trigger and the pop-up
48
+ * can grow to the right.
49
+ * - `HorizontalAnchor.Right`: pop-up is anchored to the right side of the trigger and the pop-up
50
+ * can grow to the left.
60
51
  * - `HorizontalAnchor.Both`: pop-up is anchored on both sides of the trigger and cannot grow
61
52
  * beyond it.
62
- * - `HorizontalAnchor.Auto`: automatically choose left or right anchor based on available
63
- * space, defaulting to left anchor. (This is the default experience.)
53
+ * - `HorizontalAnchor.Auto`: automatically choose left or right anchor based on available space,
54
+ * defaulting to left anchor. (This is the default experience.)
64
55
  *
65
56
  * Note that when `HorizontalAnchor.Both` is _not_ used, this anchor will cancel out any
66
57
  * `popUpOffset` for the direction _opposite_ of the chosen anchor.
67
- *
68
- * @default HorizontalAnchor.Auto
69
58
  */
70
59
  horizontalAnchor: HorizontalAnchor;
71
60
  /**
72
- * When `true`, the pop-up will not have its maximum height/width constrained to fit within
73
- * the overflow container. The positioning logic (up/down, left/right) will still be
74
- * applied.
61
+ * When `true`, the pop-up will not have its maximum width constrained to fit within the
62
+ * overflow container. The positioning logic (left/right) will still be applied.
75
63
  *
76
64
  * @default false
77
65
  */
78
- ignoreMaxDimensions: boolean;
66
+ ignoreMaxWidth: boolean;
67
+ /**
68
+ * When `true`, the pop-up will not have its maximum height constrained to fit within the
69
+ * overflow container. The positioning logic (up/down) will still be applied.
70
+ *
71
+ * @default false
72
+ */
73
+ ignoreMaxHeight: boolean;
74
+ };
75
+ /**
76
+ * An element with slots for a pop-up trigger and pop-up contents.
77
+ *
78
+ * @category PopUp
79
+ * @category Elements
80
+ * @see https://electrovir.github.io/vira/book/elements/vira-pop-up-trigger
81
+ */
82
+ export declare const ViraPopUpTrigger: import("element-vir").DeclarativeElementDefinition<"vira-pop-up-trigger", PartialWithUndefined<PopUpTriggerPosition & {
83
+ isDisabled: boolean;
84
+ /** For debugging purposes only. Very bad for actual production code use. */
85
+ z_debug_forceOpenState: boolean;
86
+ /** Set to `true` to keep the pop-up open if it is interacted with. */
87
+ keepOpenAfterInteraction: boolean;
88
+ /** All values in px. */
89
+ popUpOffset: PopUpOffset;
79
90
  }>, {
80
91
  /** `undefined` means the pop up is not currently showing. */
81
92
  showPopUpResult: ShowPopUpResult | undefined;
@@ -207,7 +207,7 @@ export const ViraPopUpTrigger = defineViraElement()({
207
207
  : HorizontalAnchor.Right
208
208
  : inputs.horizontalAnchor;
209
209
  const leftCss = effectiveHorizontalAnchor === HorizontalAnchor.Right && state.showPopUpResult
210
- ? inputs.ignoreMaxDimensions
210
+ ? inputs.ignoreMaxWidth
211
211
  ? css `
212
212
  left: unset;
213
213
  `
@@ -218,7 +218,7 @@ export const ViraPopUpTrigger = defineViraElement()({
218
218
  left: ${inputs.popUpOffset?.left || 0}px;
219
219
  `;
220
220
  const rightCss = state.showPopUpResult && effectiveHorizontalAnchor === HorizontalAnchor.Left
221
- ? inputs.ignoreMaxDimensions
221
+ ? inputs.ignoreMaxWidth
222
222
  ? css `
223
223
  right: unset;
224
224
  `
@@ -241,7 +241,7 @@ export const ViraPopUpTrigger = defineViraElement()({
241
241
  const positionerStyles = state.showPopUpResult
242
242
  ? state.showPopUpResult.popDown
243
243
  ? /** Dropdown going down position. */
244
- inputs.ignoreMaxDimensions
244
+ inputs.ignoreMaxHeight
245
245
  ? css `
246
246
  bottom: unset;
247
247
  top: calc(100% + ${inputs.popUpOffset?.vertical || 0}px);
@@ -253,7 +253,7 @@ export const ViraPopUpTrigger = defineViraElement()({
253
253
  ${horizontalPositionStyle}
254
254
  `
255
255
  : /** Dropdown going up position. */
256
- inputs.ignoreMaxDimensions
256
+ inputs.ignoreMaxHeight
257
257
  ? css `
258
258
  top: unset;
259
259
  bottom: calc(100% + ${inputs.popUpOffset?.vertical || 0}px);
@@ -2,7 +2,7 @@ import { type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type ViraIconSvg } from '../icons/icon-svg.js';
3
3
  import { type ShowPopUpResult } from '../util/pop-up-manager.js';
4
4
  import { type MenuItem } from './pop-up/pop-up-menu-item.js';
5
- import { HorizontalAnchor } from './pop-up/vira-pop-up-trigger.element.js';
5
+ import { type PopUpTriggerPosition } from './pop-up/vira-pop-up-trigger.element.js';
6
6
  /**
7
7
  * Test ids for {@link ViraDropdown}.
8
8
  *
@@ -37,26 +37,7 @@ export declare const ViraDropdown: import("element-vir").DeclarativeElementDefin
37
37
  isDisabled: boolean;
38
38
  /** For debugging purposes only. Very bad for actual production code use. */
39
39
  z_debug_forceOpenState: boolean;
40
- /**
41
- * - `HorizontalAnchor.Left`: dropdown is anchored to the left side of the trigger and the
42
- * dropdown can grow to the right.
43
- * - `HorizontalAnchor.Right`: dropdown is anchored to the right side of the trigger and the
44
- * dropdown can grow to the left.
45
- * - `HorizontalAnchor.Both`: dropdown is anchored on both sides of the trigger and cannot
46
- * grow beyond it. (This is the default experience.)
47
- *
48
- * @default HorizontalAnchor.Both
49
- */
50
- horizontalAnchor: HorizontalAnchor;
51
- /**
52
- * When `true`, the dropdown will not have its maximum height/width constrained to fit
53
- * within the overflow container. The positioning logic (up/down, left/right) will still be
54
- * applied.
55
- *
56
- * @default false
57
- */
58
- ignoreMaxDimensions: boolean;
59
- }>, {
40
+ } & PopUpTriggerPosition>, {
60
41
  /** `undefined` means the pop up is not currently showing. */
61
42
  showPopUpResult: ShowPopUpResult | undefined;
62
43
  }, {
@@ -132,17 +132,13 @@ export const ViraDropdown = defineViraElement()({
132
132
  : selectedOptions[0]?.label || '';
133
133
  return html `
134
134
  <${ViraMenuTrigger.assign({
135
+ ...inputs,
135
136
  items: inputs.options,
136
- selected: inputs.selected,
137
- isDisabled: inputs.isDisabled,
138
- isMultiSelect: inputs.isMultiSelect,
139
- z_debug_forceOpenState: inputs.z_debug_forceOpenState,
140
137
  popUpOffset: {
141
138
  vertical: -1,
142
139
  right: 24,
143
140
  },
144
141
  horizontalAnchor: inputs.horizontalAnchor || HorizontalAnchor.Both,
145
- ignoreMaxDimensions: inputs.ignoreMaxDimensions,
146
142
  })}
147
143
  ${listen(ViraMenuTrigger.events.openChange, (event) => {
148
144
  updateState({ showPopUpResult: event.detail });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "28.18.1",
3
+ "version": "28.19.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",