vira 22.1.3 → 22.2.1

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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/elements/define-vira-element.d.ts +1 -1
  3. package/dist/elements/dropdown/dropdown-helpers.d.ts +22 -0
  4. package/dist/elements/dropdown/dropdown-helpers.js +56 -0
  5. package/dist/elements/dropdown/dropdown.mock.d.ts +13 -0
  6. package/dist/elements/dropdown/dropdown.mock.js +18 -0
  7. package/dist/elements/dropdown/vira-dropdown-item.element.d.ts +16 -0
  8. package/dist/elements/dropdown/vira-dropdown-item.element.js +63 -0
  9. package/dist/elements/dropdown/vira-dropdown-options.element.d.ts +16 -0
  10. package/dist/elements/dropdown/vira-dropdown-options.element.js +100 -0
  11. package/dist/elements/dropdown/vira-dropdown.element.d.ts +37 -0
  12. package/dist/elements/dropdown/vira-dropdown.element.js +310 -0
  13. package/dist/elements/index.d.ts +3 -0
  14. package/dist/elements/index.js +3 -0
  15. package/dist/elements/vira-button.element.js +3 -3
  16. package/dist/elements/vira-collapsible-wrapper.element.d.ts +1 -4
  17. package/dist/elements/vira-collapsible-wrapper.element.js +3 -6
  18. package/dist/elements/vira-input.element.d.ts +1 -1
  19. package/dist/elements/vira-input.element.js +7 -7
  20. package/dist/icons/icon-svgs/check-24.icon.d.ts +1 -0
  21. package/dist/icons/icon-svgs/check-24.icon.js +16 -0
  22. package/dist/icons/icon-svgs/chevron-up-24.icon.d.ts +1 -0
  23. package/dist/icons/icon-svgs/chevron-up-24.icon.js +23 -0
  24. package/dist/icons/index.d.ts +4 -0
  25. package/dist/icons/index.js +6 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/styles/border.d.ts +3 -0
  29. package/dist/styles/border.js +4 -0
  30. package/dist/styles/color.d.ts +1 -1
  31. package/dist/styles/disabled.js +1 -0
  32. package/dist/styles/focus.d.ts +2 -2
  33. package/dist/styles/focus.js +5 -5
  34. package/dist/styles/form-themes.d.ts +8 -0
  35. package/dist/styles/form-themes.js +10 -0
  36. package/dist/styles/index.d.ts +3 -1
  37. package/dist/styles/index.js +3 -1
  38. package/dist/styles/scrollbar.js +4 -2
  39. package/dist/styles/shadows.d.ts +5 -0
  40. package/dist/styles/shadows.js +18 -0
  41. package/dist/styles/user-select.js +6 -3
  42. package/dist/util/index.d.ts +1 -0
  43. package/dist/util/index.js +1 -0
  44. package/dist/util/pop-up-manager.d.ts +90 -0
  45. package/dist/util/pop-up-manager.js +169 -0
  46. package/package.json +12 -8
  47. package/dist/styles/vira-css-vars.d.ts +0 -3
  48. package/dist/styles/vira-css-vars.js +0 -4
@@ -1,5 +1,8 @@
1
1
  /** This file is automatically updated by update-index-exports.ts */
2
2
  export * from './define-vira-element';
3
+ export * from './dropdown/vira-dropdown-item.element';
4
+ export * from './dropdown/vira-dropdown-options.element';
5
+ export * from './dropdown/vira-dropdown.element';
3
6
  export * from './vira-button.element';
4
7
  export * from './vira-collapsible-wrapper.element';
5
8
  export * from './vira-icon.element';
@@ -1,5 +1,8 @@
1
1
  /** This file is automatically updated by update-index-exports.ts */
2
2
  export * from './define-vira-element';
3
+ export * from './dropdown/vira-dropdown-item.element';
4
+ export * from './dropdown/vira-dropdown-options.element';
5
+ export * from './dropdown/vira-dropdown.element';
3
6
  export * from './vira-button.element';
4
7
  export * from './vira-collapsible-wrapper.element';
5
8
  export * from './vira-icon.element';
@@ -1,10 +1,10 @@
1
1
  import { css, html } from 'element-vir';
2
2
  import { noUserSelect } from '../styles';
3
+ import { viraBorders } from '../styles/border';
3
4
  import { viraDisabledStyles } from '../styles/disabled';
4
5
  import { viraAnimationDurations } from '../styles/durations';
5
6
  import { createFocusStyles, viraFocusCssVars } from '../styles/focus';
6
7
  import { noNativeFormStyles } from '../styles/native-styles';
7
- import { viraCssVars } from '../styles/vira-css-vars';
8
8
  import { defineViraElement } from './define-vira-element';
9
9
  import { ViraIcon } from './vira-icon.element';
10
10
  export var ViraButtonStyleEnum;
@@ -75,7 +75,7 @@ export const ViraButton = defineViraElement()({
75
75
  display: inline-flex;
76
76
  justify-content: center;
77
77
  align-items: center;
78
- border-radius: ${viraCssVars['vira-form-input-border-radius'].value};
78
+ border-radius: ${viraBorders['vira-form-input-radius'].value};
79
79
  background-color: ${cssVars['vira-button-internal-background-color'].value};
80
80
  color: ${cssVars['vira-button-internal-foreground-color'].value};
81
81
  padding: ${cssVars['vira-button-padding'].value};
@@ -87,7 +87,7 @@ export const ViraButton = defineViraElement()({
87
87
  }
88
88
 
89
89
  ${createFocusStyles({
90
- mainSelector: 'button:focus:focus-visible:not(:active):not([disabled])',
90
+ selector: 'button:focus:focus-visible:not(:active):not([disabled])',
91
91
  elementBorderSize: 2,
92
92
  })}
93
93
 
@@ -1,10 +1,7 @@
1
- export declare enum ViraCollapsibleSlotNameEnum {
2
- Header = "header"
3
- }
4
1
  export declare const ViraCollapsibleWrapper: import("element-vir").DeclarativeElementDefinition<"vira-collapsible-wrapper", {
5
2
  expanded: boolean;
6
3
  }, {
7
4
  contentHeight: number;
8
5
  }, {
9
6
  expandChange: import("element-vir").DefinedTypedEventNameDefinition<boolean>;
10
- }, "vira-collapsible-wrapper-expanded", `vira-collapsible-wrapper-${string}`, readonly string[]>;
7
+ }, "vira-collapsible-wrapper-expanded", `vira-collapsible-wrapper-${string}`, readonly ["header"]>;
@@ -1,15 +1,12 @@
1
1
  import { css, defineElementEvent, html, listen, onResize } from 'element-vir';
2
2
  import { noNativeFormStyles, viraAnimationDurations } from '../styles';
3
3
  import { defineViraElement } from './define-vira-element';
4
- export var ViraCollapsibleSlotNameEnum;
5
- (function (ViraCollapsibleSlotNameEnum) {
6
- ViraCollapsibleSlotNameEnum["Header"] = "header";
7
- })(ViraCollapsibleSlotNameEnum || (ViraCollapsibleSlotNameEnum = {}));
8
4
  export const ViraCollapsibleWrapper = defineViraElement()({
9
5
  tagName: 'vira-collapsible-wrapper',
10
6
  hostClasses: {
11
7
  'vira-collapsible-wrapper-expanded': ({ inputs }) => inputs.expanded,
12
8
  },
9
+ slotNames: ['header'],
13
10
  styles: ({ hostClasses }) => css `
14
11
  :host {
15
12
  display: flex;
@@ -42,7 +39,7 @@ export const ViraCollapsibleWrapper = defineViraElement()({
42
39
  stateInitStatic: {
43
40
  contentHeight: 0,
44
41
  },
45
- renderCallback({ state, updateState, dispatch, events, inputs }) {
42
+ renderCallback({ state, slotNames, updateState, dispatch, events, inputs }) {
46
43
  const collapsingStyles = inputs.expanded
47
44
  ? css `
48
45
  height: ${state.contentHeight}px;
@@ -57,7 +54,7 @@ export const ViraCollapsibleWrapper = defineViraElement()({
57
54
  dispatch(new events.expandChange(!inputs.expanded));
58
55
  })}
59
56
  >
60
- <slot name=${ViraCollapsibleSlotNameEnum.Header}>Header</slot>
57
+ <slot name=${slotNames.header}>Header</slot>
61
58
  </button>
62
59
  <div class="collapsing-element" style=${collapsingStyles} disabled="disabled">
63
60
  <div
@@ -27,4 +27,4 @@ export declare const ViraInput: import("element-vir").DeclarativeElementDefiniti
27
27
  * that was blocked out of programmatic "value" property assignments.
28
28
  */
29
29
  inputBlocked: import("element-vir").DefinedTypedEventNameDefinition<string>;
30
- }, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown", "vira-input-placeholder-color" | "vira-input-text-color" | "vira-input-border-color" | "vira-input-focus-border-color" | "vira-input-text-selection-color" | "vira-input-action-button-color" | "vira-input-clear-button-hover-color" | "vira-input-clear-button-active-color" | "vira-input-show-password-button-hover-color" | "vira-input-show-password-button-active-color" | "vira-input-padding-horizontal" | "vira-input-padding-vertical", readonly string[]>;
30
+ }, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown", "vira-input-background-color" | "vira-input-placeholder-color" | "vira-input-text-color" | "vira-input-border-color" | "vira-input-focus-border-color" | "vira-input-text-selection-color" | "vira-input-action-button-color" | "vira-input-clear-button-hover-color" | "vira-input-clear-button-active-color" | "vira-input-show-password-button-hover-color" | "vira-input-show-password-button-active-color" | "vira-input-padding-horizontal" | "vira-input-padding-vertical", readonly string[]>;
@@ -1,10 +1,9 @@
1
1
  import { css, defineElementEvent, html, listen, onResize, renderIf, } from 'element-vir';
2
2
  import { EyeClosed24Icon, EyeOpen24Icon } from '../icons';
3
3
  import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon';
4
- import { noUserSelect, viraAnimationDurations, viraDisabledStyles } from '../styles';
4
+ import { noUserSelect, viraAnimationDurations, viraBorders, viraDisabledStyles } from '../styles';
5
5
  import { createFocusStyles, viraFocusCssVars } from '../styles/focus';
6
6
  import { noNativeFormStyles } from '../styles/native-styles';
7
- import { viraCssVars } from '../styles/vira-css-vars';
8
7
  import { defineViraElement } from './define-vira-element';
9
8
  import { filterTextInputValue, textInputListener, } from './shared-text-input-logic';
10
9
  import { ViraIcon } from './vira-icon.element';
@@ -23,10 +22,11 @@ export const ViraInput = defineViraElement()({
23
22
  'vira-input-clear-button-shown': ({ inputs }) => !!inputs.showClearButton,
24
23
  },
25
24
  cssVars: {
25
+ 'vira-input-background-color': 'white',
26
26
  'vira-input-placeholder-color': '#cccccc',
27
27
  'vira-input-text-color': '#000000',
28
28
  'vira-input-border-color': '#cccccc',
29
- 'vira-input-focus-border-color': '#59b1ff',
29
+ 'vira-input-focus-border-color': viraFocusCssVars['vira-focus-outline-color'].default,
30
30
  'vira-input-text-selection-color': '#cfe9ff',
31
31
  'vira-input-action-button-color': '#aaaaaa',
32
32
  'vira-input-clear-button-hover-color': '#ff0000',
@@ -120,7 +120,7 @@ export const ViraInput = defineViraElement()({
120
120
  left: 0;
121
121
  width: 100%;
122
122
  height: 100%;
123
- border-radius: ${viraCssVars['vira-form-input-border-radius'].value};
123
+ border-radius: ${viraBorders['vira-form-input-radius'].value};
124
124
  z-index: 0;
125
125
  pointer-events: none;
126
126
  }
@@ -142,8 +142,8 @@ export const ViraInput = defineViraElement()({
142
142
  align-items: center;
143
143
  position: relative;
144
144
  padding: 0 ${cssVars['vira-input-padding-horizontal'].value};
145
- border-radius: ${viraCssVars['vira-form-input-border-radius'].value};
146
- background-color: transparent;
145
+ border-radius: ${viraBorders['vira-form-input-radius'].value};
146
+ background-color: ${cssVars['vira-input-background-color'].value};
147
147
  /*
148
148
  Border colors are actually applied via the .label-border class. However, we must
149
149
  apply a border here still so that it takes up space.
@@ -154,7 +154,7 @@ export const ViraInput = defineViraElement()({
154
154
  }
155
155
 
156
156
  ${createFocusStyles({
157
- mainSelector: 'input:focus:focus-visible:not(:active):not([disabled]) ~ .focus-border',
157
+ selector: 'input:focus:focus-visible:not(:active):not([disabled]) ~ .focus-border',
158
158
  elementBorderSize: 0,
159
159
  })}
160
160
 
@@ -0,0 +1 @@
1
+ export declare const Check24Icon: import("../icon-svg").ViraIconSvg;
@@ -0,0 +1,16 @@
1
+ import { html } from 'element-vir';
2
+ import { viraIconCssVars } from '../icon-css-vars';
3
+ import { defineIcon } from '../icon-svg';
4
+ export const Check24Icon = defineIcon({
5
+ name: 'Check24Icon',
6
+ svgTemplate: html `
7
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
8
+ <path
9
+ d="m17 8.5-7 8-3-3"
10
+ fill="none"
11
+ stroke=${viraIconCssVars['vira-icon-stroke-color'].value}
12
+ stroke-width=${viraIconCssVars['vira-icon-stroke-width'].value}
13
+ />
14
+ </svg>
15
+ `,
16
+ });
@@ -0,0 +1 @@
1
+ export declare const ChevronUp24Icon: import("../icon-svg").ViraIconSvg;
@@ -0,0 +1,23 @@
1
+ import { html } from 'element-vir';
2
+ import { viraIconCssVars } from '../icon-css-vars';
3
+ import { defineIcon } from '../icon-svg';
4
+ export const ChevronUp24Icon = defineIcon({
5
+ name: 'ChevronUp24Icon',
6
+ svgTemplate: html `
7
+ <svg
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ stroke=${viraIconCssVars['vira-icon-stroke-color'].value}
10
+ fill="none"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ width="24"
14
+ height="24"
15
+ viewBox="0 0 24 24"
16
+ >
17
+ <path
18
+ stroke-width=${viraIconCssVars['vira-icon-stroke-width'].value}
19
+ d="M6 15 L12 9 18 15"
20
+ />
21
+ </svg>
22
+ `,
23
+ });
@@ -1,6 +1,8 @@
1
1
  /** This file is automatically updated by update-icon-exports.ts */
2
2
  export * from './icon-css-vars';
3
3
  export * from './icon-svg';
4
+ export * from './icon-svgs/check-24.icon';
5
+ export * from './icon-svgs/chevron-up-24.icon';
4
6
  export * from './icon-svgs/close-x-24.icon';
5
7
  export * from './icon-svgs/element-16.icon';
6
8
  export * from './icon-svgs/element-24.icon';
@@ -13,6 +15,8 @@ export * from './icon-svgs/status-failure-24.icon';
13
15
  export * from './icon-svgs/status-in-progress-24.icon';
14
16
  export * from './icon-svgs/status-success-24.icon';
15
17
  export declare const allIconsByName: {
18
+ readonly Check24Icon: import("./icon-svg").ViraIconSvg;
19
+ readonly ChevronUp24Icon: import("./icon-svg").ViraIconSvg;
16
20
  readonly CloseX24Icon: import("./icon-svg").ViraIconSvg;
17
21
  readonly Element16Icon: import("./icon-svg").ViraIconSvg;
18
22
  readonly Element24Icon: import("./icon-svg").ViraIconSvg;
@@ -1,4 +1,6 @@
1
1
  /** This file is automatically updated by update-icon-exports.ts */
2
+ import { Check24Icon } from './icon-svgs/check-24.icon';
3
+ import { ChevronUp24Icon } from './icon-svgs/chevron-up-24.icon';
2
4
  import { CloseX24Icon } from './icon-svgs/close-x-24.icon';
3
5
  import { Element16Icon } from './icon-svgs/element-16.icon';
4
6
  import { Element24Icon } from './icon-svgs/element-24.icon';
@@ -12,6 +14,8 @@ import { StatusInProgress24Icon } from './icon-svgs/status-in-progress-24.icon';
12
14
  import { StatusSuccess24Icon } from './icon-svgs/status-success-24.icon';
13
15
  export * from './icon-css-vars';
14
16
  export * from './icon-svg';
17
+ export * from './icon-svgs/check-24.icon';
18
+ export * from './icon-svgs/chevron-up-24.icon';
15
19
  export * from './icon-svgs/close-x-24.icon';
16
20
  export * from './icon-svgs/element-16.icon';
17
21
  export * from './icon-svgs/element-24.icon';
@@ -24,6 +28,8 @@ export * from './icon-svgs/status-failure-24.icon';
24
28
  export * from './icon-svgs/status-in-progress-24.icon';
25
29
  export * from './icon-svgs/status-success-24.icon';
26
30
  export const allIconsByName = {
31
+ Check24Icon,
32
+ ChevronUp24Icon,
27
33
  CloseX24Icon,
28
34
  Element16Icon,
29
35
  Element24Icon,
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './elements';
3
3
  export * from './icons';
4
4
  export * from './re-exports';
5
5
  export * from './styles';
6
+ export * from './util';
package/dist/index.js CHANGED
@@ -3,3 +3,4 @@ export * from './elements';
3
3
  export * from './icons';
4
4
  export * from './re-exports';
5
5
  export * from './styles';
6
+ export * from './util';
@@ -0,0 +1,3 @@
1
+ export declare const viraBorders: import("lit-css-vars").CssVarDefinitions<{
2
+ 'vira-form-input-radius': string;
3
+ }>;
@@ -0,0 +1,4 @@
1
+ import { defineCssVars } from 'lit-css-vars';
2
+ export const viraBorders = defineCssVars({
3
+ 'vira-form-input-radius': '8px',
4
+ });
@@ -1,4 +1,4 @@
1
1
  import { Format } from 'colorjs.io/types/src/space';
2
2
  import { ColorTypes } from '../re-exports/colorjs-io';
3
- export declare function getAssertedValidColor(input: ColorTypes | undefined): import("colorjs.io/types").default;
3
+ export declare function getAssertedValidColor(input: ColorTypes | undefined): import("colorjs.io/types/src/color").default;
4
4
  export declare const rgbCssColorFormat: Format;
@@ -2,4 +2,5 @@ import { css } from 'element-vir';
2
2
  export const viraDisabledStyles = css `
3
3
  pointer-events: none;
4
4
  opacity: 0.3;
5
+ cursor: not-allowed;
5
6
  `;
@@ -8,8 +8,8 @@ export declare const viraFocusCssVars: import("lit-css-vars").CssVarDefinitions<
8
8
  * It is recommended to use the pseudo selectors ":focus:focus-visible:not(:active)" to preventing
9
9
  * clicking from creating focus styles in Chrome.
10
10
  */
11
- export declare function createFocusStyles({ mainSelector, elementBorderSize, outlineGap, outlineWidth, }: {
12
- mainSelector: string;
11
+ export declare function createFocusStyles({ selector, elementBorderSize, outlineGap, outlineWidth, }: {
12
+ selector: string;
13
13
  /**
14
14
  * ElementBorderSize here is used to fix the outline when the element these styles are attached
15
15
  * to has a border. The dev must specify that border size here for the offsets to be calculated
@@ -1,10 +1,10 @@
1
1
  import { addPx } from '@augment-vir/common';
2
2
  import { css, unsafeCSS } from 'element-vir';
3
3
  import { defineCssVars } from 'lit-css-vars';
4
- import { viraCssVars } from './vira-css-vars';
4
+ import { viraBorders } from './border';
5
5
  export const viraFocusCssVars = defineCssVars({
6
- 'vira-focus-outline-color': 'blue',
7
- 'vira-focus-outline-border-radius': css `calc(${viraCssVars['vira-form-input-border-radius'].value} + 4px)`,
6
+ 'vira-focus-outline-color': '#59b1ff',
7
+ 'vira-focus-outline-border-radius': css `calc(${viraBorders['vira-form-input-radius'].value} + 4px)`,
8
8
  });
9
9
  /**
10
10
  * Create styles that look like an outline for the given selector.
@@ -12,10 +12,10 @@ export const viraFocusCssVars = defineCssVars({
12
12
  * It is recommended to use the pseudo selectors ":focus:focus-visible:not(:active)" to preventing
13
13
  * clicking from creating focus styles in Chrome.
14
14
  */
15
- export function createFocusStyles({ mainSelector, elementBorderSize, outlineGap = 2, outlineWidth = 3, }) {
15
+ export function createFocusStyles({ selector, elementBorderSize, outlineGap = 2, outlineWidth = 2, }) {
16
16
  const outlineSpacing = unsafeCSS(addPx(outlineWidth + outlineGap + elementBorderSize));
17
17
  return css `
18
- ${unsafeCSS(mainSelector)}::after {
18
+ ${unsafeCSS(selector)}::after {
19
19
  content: '';
20
20
  top: calc(${outlineSpacing} * -1);
21
21
  left: calc(${outlineSpacing} * -1);
@@ -0,0 +1,8 @@
1
+ export declare const viraFormCssVars: import("lit-css-vars").CssVarDefinitions<{
2
+ 'vira-form-border-color': string;
3
+ 'vira-form-background-color': string;
4
+ 'vira-form-foreground-color': string;
5
+ 'vira-form-focus-color': import("lit").CSSResult;
6
+ 'vira-form-selection-hover-background-color': string;
7
+ 'vira-form-selection-hover-foreground-color': string;
8
+ }>;
@@ -0,0 +1,10 @@
1
+ import { defineCssVars } from 'lit-css-vars';
2
+ import { viraFocusCssVars } from './focus';
3
+ export const viraFormCssVars = defineCssVars({
4
+ 'vira-form-border-color': '#cccccc',
5
+ 'vira-form-background-color': 'white',
6
+ 'vira-form-foreground-color': 'black',
7
+ 'vira-form-focus-color': viraFocusCssVars['vira-focus-outline-color'].value,
8
+ 'vira-form-selection-hover-background-color': '#d2eaff',
9
+ 'vira-form-selection-hover-foreground-color': 'black',
10
+ });
@@ -1,9 +1,11 @@
1
1
  /** This file is automatically updated by update-index-exports.ts */
2
+ export * from './border';
2
3
  export * from './color';
3
4
  export * from './disabled';
4
5
  export * from './durations';
5
6
  export * from './focus';
7
+ export * from './form-themes';
6
8
  export * from './native-styles';
7
9
  export * from './scrollbar';
10
+ export * from './shadows';
8
11
  export * from './user-select';
9
- export * from './vira-css-vars';
@@ -1,9 +1,11 @@
1
1
  /** This file is automatically updated by update-index-exports.ts */
2
+ export * from './border';
2
3
  export * from './color';
3
4
  export * from './disabled';
4
5
  export * from './durations';
5
6
  export * from './focus';
7
+ export * from './form-themes';
6
8
  export * from './native-styles';
7
9
  export * from './scrollbar';
10
+ export * from './shadows';
8
11
  export * from './user-select';
9
- export * from './vira-css-vars';
@@ -2,8 +2,10 @@ import { css, unsafeCSS } from 'element-vir';
2
2
  export function hideScrollbars(selector) {
3
3
  return css `
4
4
  ${unsafeCSS(selector)} {
5
- scrollbar-width: none; /* hide scrollbars in Firefox */
6
- -ms-overflow-style: none; /* hide scrollbars in IE 10+ */
5
+ /* hide scrollbars in Firefox */
6
+ scrollbar-width: none;
7
+ /* hide scrollbars in IE 10+ */
8
+ -ms-overflow-style: none;
7
9
  }
8
10
 
9
11
  /* hide scrollbars in Chrome/Safari/Webkit */
@@ -0,0 +1,5 @@
1
+ import { CSSResult } from 'element-vir';
2
+ export declare const viraShadows: {
3
+ readonly menuShadow: CSSResult;
4
+ readonly menuShadowReversed: CSSResult;
5
+ };
@@ -0,0 +1,18 @@
1
+ import { css } from 'element-vir';
2
+ const shadowColor = css `#e2e2e2`;
3
+ export const viraShadows = {
4
+ menuShadow: css `
5
+ filter: drop-shadow(0px 5px 5px ${shadowColor});
6
+ /*
7
+ This helps force the drop shadow to re-render when the element moves or the page changes.
8
+ */
9
+ will-change: filter;
10
+ `,
11
+ menuShadowReversed: css `
12
+ filter: drop-shadow(0px -5px 5px ${shadowColor});
13
+ /*
14
+ This helps force the drop shadow to re-render when the element moves or the page changes.
15
+ */
16
+ will-change: filter;
17
+ `,
18
+ };
@@ -1,6 +1,9 @@
1
1
  import { css } from 'element-vir';
2
2
  export const noUserSelect = css `
3
- -webkit-touch-callout: none; /* iOS Safari */
4
- -webkit-user-select: none; /* Safari */
5
- user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
3
+ /* iOS Safari */
4
+ -webkit-touch-callout: none;
5
+ /* Safari */
6
+ -webkit-user-select: none;
7
+ /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
8
+ user-select: none;
6
9
  `;
@@ -0,0 +1 @@
1
+ export * from './pop-up-manager';
@@ -0,0 +1 @@
1
+ export * from './pop-up-manager';
@@ -0,0 +1,90 @@
1
+ import { MaybePromise } from '@augment-vir/common';
2
+ import { Coords } from 'device-navigation';
3
+ import { ExtractEventByType, ExtractEventTypes, ListenOptions, RemoveListenerCallback } from 'typed-event-target';
4
+ export type PositionRect = {
5
+ top: number;
6
+ left: number;
7
+ right: number;
8
+ bottom: number;
9
+ };
10
+ export declare const emptyPositionRect: PositionRect;
11
+ export type PopUpManagerOptions = {
12
+ /**
13
+ * The minimum number of pixels for allowing the pop-up to go downwards. If the downward
14
+ * available space is less than this, and if the upwards available space is
15
+ * `verticalDiffThreshold` more than the downwards space, the pop-up will be directed upwards.
16
+ *
17
+ * Equation:
18
+ *
19
+ * const directUpwards =
20
+ * downwardsSpace < minDownSpace &&
21
+ * upwardsSpace > DownwardsSpace + verticalDiffThreshold;
22
+ *
23
+ * @default 200
24
+ */
25
+ minDownSpace: number;
26
+ /**
27
+ * The number of pixels required for the upwards available space to be bigger than the downwards
28
+ * available space before directing the pop-up upwards.
29
+ *
30
+ * Equation:
31
+ *
32
+ * const directUpwards =
33
+ * downwardsSpace < minDownSpace &&
34
+ * upwardsSpace > DownwardsSpace + verticalDiffThreshold;
35
+ *
36
+ * @default 20
37
+ */
38
+ verticalDiffThreshold: number;
39
+ /**
40
+ * Supports navigation of the pop up via the `device-navigation` package.
41
+ *
42
+ * @default true
43
+ */
44
+ supportNavigation: boolean;
45
+ };
46
+ export type ShowPopUpResult = {
47
+ /**
48
+ * Indicates if the "pop up" should pop in the downwards direction or not. If not, it should pop
49
+ * in the upwards direction. This is determined by how much space is available on either side of
50
+ * the root element.
51
+ */
52
+ popDown: boolean;
53
+ positions: Record<'root' | 'container' | 'diff', PositionRect>;
54
+ };
55
+ declare const HidePopUpEvent_base: (new (eventInitDict?: EventInit | undefined) => import("typed-event-target").TypedEvent<"hide-pop-up">) & Pick<{
56
+ new (type: string, eventInitDict?: EventInit | undefined): Event;
57
+ prototype: Event;
58
+ readonly NONE: 0;
59
+ readonly CAPTURING_PHASE: 1;
60
+ readonly AT_TARGET: 2;
61
+ readonly BUBBLING_PHASE: 3;
62
+ }, "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE" | "prototype"> & Pick<import("typed-event-target").TypedEvent<"hide-pop-up">, "type">;
63
+ export declare class HidePopUpEvent extends HidePopUpEvent_base {
64
+ }
65
+ declare const NavSelectEvent_base: (new (eventInitDict: import("typed-event-target").TypedCustomEventInit<Coords>) => import("typed-event-target").TypedCustomEvent<Coords, "nav-select">) & Pick<{
66
+ new (type: string, eventInitDict?: EventInit | undefined): Event;
67
+ prototype: Event;
68
+ readonly NONE: 0;
69
+ readonly CAPTURING_PHASE: 1;
70
+ readonly AT_TARGET: 2;
71
+ readonly BUBBLING_PHASE: 3;
72
+ }, "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE" | "prototype"> & Pick<import("typed-event-target").TypedCustomEvent<Coords, "nav-select">, "type">;
73
+ export declare class NavSelectEvent extends NavSelectEvent_base {
74
+ }
75
+ export type PopUpManagerEvents = HidePopUpEvent | NavSelectEvent;
76
+ export declare class PopUpManager {
77
+ private listenTarget;
78
+ private options;
79
+ private cleanupCallbacks;
80
+ private lastRootElement;
81
+ constructor(options?: Partial<PopUpManagerOptions> | undefined);
82
+ private attachGlobalListeners;
83
+ listen<const EventDefinition extends Readonly<{
84
+ type: ExtractEventTypes<PopUpManagerEvents>;
85
+ }>>(event: EventDefinition, listener: (event: ExtractEventByType<PopUpManagerEvents, EventDefinition['type']>) => MaybePromise<void>, options?: ListenOptions | undefined): RemoveListenerCallback;
86
+ removePopUp(): void;
87
+ showPopUp(rootElement: HTMLElement, options?: Partial<PopUpManagerOptions> | undefined): ShowPopUpResult;
88
+ destroy(): void;
89
+ }
90
+ export {};