vira 28.19.6 → 29.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 (192) hide show
  1. package/dist/elements/define-vira-element.d.ts +18 -0
  2. package/dist/elements/define-vira-element.js +19 -0
  3. package/dist/elements/form/vira-form-fields.d.ts +100 -0
  4. package/dist/elements/form/vira-form-fields.js +60 -0
  5. package/dist/elements/form/vira-form.element.d.ts +35 -0
  6. package/dist/elements/form/vira-form.element.js +151 -0
  7. package/dist/elements/index.js +25 -0
  8. package/dist/elements/pop-up/pop-up-helpers.d.ts +33 -0
  9. package/dist/elements/pop-up/pop-up-helpers.js +58 -0
  10. package/{src/elements/pop-up/pop-up-menu-item.ts → dist/elements/pop-up/pop-up-menu-item.d.ts} +3 -4
  11. package/dist/elements/pop-up/pop-up-menu-item.js +1 -0
  12. package/dist/elements/pop-up/vira-menu-item.element.d.ts +19 -0
  13. package/{src/elements/pop-up/vira-menu-item.element.ts → dist/elements/pop-up/vira-menu-item.element.js} +11 -28
  14. package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +41 -0
  15. package/dist/elements/pop-up/vira-menu-trigger.element.js +121 -0
  16. package/dist/elements/pop-up/vira-menu.element.d.ts +38 -0
  17. package/{src/elements/pop-up/vira-menu.element.ts → dist/elements/pop-up/vira-menu.element.js} +49 -78
  18. package/dist/elements/pop-up/vira-pop-up-menu.element.d.ts +35 -0
  19. package/{src/elements/pop-up/vira-pop-up-menu.element.ts → dist/elements/pop-up/vira-pop-up-menu.element.js} +24 -37
  20. package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +105 -0
  21. package/{src/elements/pop-up/vira-pop-up-trigger.element.ts → dist/elements/pop-up/vira-pop-up-trigger.element.js} +104 -199
  22. package/dist/elements/shared-text-input-logic.d.ts +63 -0
  23. package/dist/elements/shared-text-input-logic.js +101 -0
  24. package/dist/elements/vira-bold-text.element.d.ts +9 -0
  25. package/{src/elements/vira-bold-text.element.ts → dist/elements/vira-bold-text.element.js} +7 -8
  26. package/dist/elements/vira-button.element.d.ts +34 -0
  27. package/dist/elements/vira-button.element.js +176 -0
  28. package/dist/elements/vira-card.element.d.ts +18 -0
  29. package/dist/elements/vira-card.element.js +60 -0
  30. package/dist/elements/vira-checkbox.element.d.ts +38 -0
  31. package/{src/elements/vira-checkbox.element.ts → dist/elements/vira-checkbox.element.js} +70 -83
  32. package/dist/elements/vira-collapsible-wrapper.element.d.ts +14 -0
  33. package/{src/elements/vira-collapsible-wrapper.element.ts → dist/elements/vira-collapsible-wrapper.element.js} +16 -18
  34. package/dist/elements/vira-dropdown.element.d.ts +46 -0
  35. package/{src/elements/vira-dropdown.element.ts → dist/elements/vira-dropdown.element.js} +48 -95
  36. package/dist/elements/vira-error.element.d.ts +7 -0
  37. package/{src/elements/vira-error.element.ts → dist/elements/vira-error.element.js} +6 -7
  38. package/dist/elements/vira-icon.element.d.ts +13 -0
  39. package/{src/elements/vira-icon.element.ts → dist/elements/vira-icon.element.js} +6 -13
  40. package/dist/elements/vira-image.element.d.ts +45 -0
  41. package/{src/elements/vira-image.element.ts → dist/elements/vira-image.element.js} +43 -63
  42. package/dist/elements/vira-input.element.d.ts +62 -0
  43. package/{src/elements/vira-input.element.ts → dist/elements/vira-input.element.js} +93 -166
  44. package/dist/elements/vira-link.element.d.ts +73 -0
  45. package/{src/elements/vira-link.element.ts → dist/elements/vira-link.element.js} +17 -67
  46. package/dist/elements/vira-modal.element.d.ts +39 -0
  47. package/{src/elements/vira-modal.element.ts → dist/elements/vira-modal.element.js} +56 -97
  48. package/dist/elements/vira-overflow-switch.element.d.ts +21 -0
  49. package/dist/elements/vira-overflow-switch.element.js +110 -0
  50. package/dist/elements/vira-progress.element.d.ts +18 -0
  51. package/{src/elements/vira-progress.element.ts → dist/elements/vira-progress.element.js} +14 -30
  52. package/dist/elements/vira-select.element.d.ts +48 -0
  53. package/{src/elements/vira-select.element.ts → dist/elements/vira-select.element.js} +45 -99
  54. package/dist/icons/icon-color.test-helper.d.ts +6 -0
  55. package/dist/icons/icon-color.test-helper.js +9 -0
  56. package/dist/icons/icon-css-vars.d.ts +14 -0
  57. package/{src/icons/icon-css-vars.ts → dist/icons/icon-css-vars.js} +1 -2
  58. package/dist/icons/icon-svg.d.ts +27 -0
  59. package/dist/icons/icon-svg.js +48 -0
  60. package/dist/icons/icon-svgs/bell-24.icon.d.ts +8 -0
  61. package/{src/icons/icon-svgs/bell-24.icon.ts → dist/icons/icon-svgs/bell-24.icon.js} +4 -5
  62. package/dist/icons/icon-svgs/chat-24.icon.d.ts +8 -0
  63. package/{src/icons/icon-svgs/chat-24.icon.ts → dist/icons/icon-svgs/chat-24.icon.js} +4 -5
  64. package/dist/icons/icon-svgs/check-24.icon.d.ts +8 -0
  65. package/{src/icons/icon-svgs/check-24.icon.ts → dist/icons/icon-svgs/check-24.icon.js} +4 -5
  66. package/dist/icons/icon-svgs/chevron-down-24.icon.d.ts +8 -0
  67. package/{src/icons/icon-svgs/chevron-down-24.icon.ts → dist/icons/icon-svgs/chevron-down-24.icon.js} +4 -5
  68. package/dist/icons/icon-svgs/chevron-up-24.icon.d.ts +8 -0
  69. package/{src/icons/icon-svgs/chevron-up-24.icon.ts → dist/icons/icon-svgs/chevron-up-24.icon.js} +4 -5
  70. package/dist/icons/icon-svgs/close-x-24.icon.d.ts +8 -0
  71. package/{src/icons/icon-svgs/close-x-24.icon.ts → dist/icons/icon-svgs/close-x-24.icon.js} +4 -5
  72. package/dist/icons/icon-svgs/commit-24.icon.d.ts +8 -0
  73. package/{src/icons/icon-svgs/commit-24.icon.ts → dist/icons/icon-svgs/commit-24.icon.js} +4 -5
  74. package/dist/icons/icon-svgs/copy-24.icon.d.ts +8 -0
  75. package/{src/icons/icon-svgs/copy-24.icon.ts → dist/icons/icon-svgs/copy-24.icon.js} +4 -5
  76. package/dist/icons/icon-svgs/document-24.icon.d.ts +8 -0
  77. package/{src/icons/icon-svgs/document-24.icon.ts → dist/icons/icon-svgs/document-24.icon.js} +4 -5
  78. package/dist/icons/icon-svgs/document-search-24.icon.d.ts +8 -0
  79. package/{src/icons/icon-svgs/document-search-24.icon.ts → dist/icons/icon-svgs/document-search-24.icon.js} +4 -5
  80. package/dist/icons/icon-svgs/double-chevron-24.icon.d.ts +8 -0
  81. package/{src/icons/icon-svgs/double-chevron-24.icon.ts → dist/icons/icon-svgs/double-chevron-24.icon.js} +4 -5
  82. package/dist/icons/icon-svgs/element-16.icon.d.ts +8 -0
  83. package/{src/icons/icon-svgs/element-16.icon.ts → dist/icons/icon-svgs/element-16.icon.js} +4 -5
  84. package/dist/icons/icon-svgs/element-24.icon.d.ts +8 -0
  85. package/{src/icons/icon-svgs/element-24.icon.ts → dist/icons/icon-svgs/element-24.icon.js} +4 -5
  86. package/dist/icons/icon-svgs/external-link-24.icon.d.ts +8 -0
  87. package/{src/icons/icon-svgs/external-link-24.icon.ts → dist/icons/icon-svgs/external-link-24.icon.js} +4 -5
  88. package/dist/icons/icon-svgs/eye-closed-24.icon.d.ts +8 -0
  89. package/{src/icons/icon-svgs/eye-closed-24.icon.ts → dist/icons/icon-svgs/eye-closed-24.icon.js} +4 -5
  90. package/dist/icons/icon-svgs/eye-open-24.icon.d.ts +8 -0
  91. package/{src/icons/icon-svgs/eye-open-24.icon.ts → dist/icons/icon-svgs/eye-open-24.icon.js} +4 -5
  92. package/dist/icons/icon-svgs/filter-24.icon.d.ts +8 -0
  93. package/{src/icons/icon-svgs/filter-24.icon.ts → dist/icons/icon-svgs/filter-24.icon.js} +4 -5
  94. package/dist/icons/icon-svgs/link-24.icon.d.ts +8 -0
  95. package/{src/icons/icon-svgs/link-24.icon.ts → dist/icons/icon-svgs/link-24.icon.js} +4 -5
  96. package/dist/icons/icon-svgs/loader-24.icon.d.ts +8 -0
  97. package/{src/icons/icon-svgs/loader-24.icon.ts → dist/icons/icon-svgs/loader-24.icon.js} +4 -5
  98. package/dist/icons/icon-svgs/loader-animated-24.icon.d.ts +8 -0
  99. package/{src/icons/icon-svgs/loader-animated-24.icon.ts → dist/icons/icon-svgs/loader-animated-24.icon.js} +6 -8
  100. package/dist/icons/icon-svgs/lock-24.icon.d.ts +8 -0
  101. package/{src/icons/icon-svgs/lock-24.icon.ts → dist/icons/icon-svgs/lock-24.icon.js} +4 -5
  102. package/dist/icons/icon-svgs/options-24.icon.d.ts +8 -0
  103. package/{src/icons/icon-svgs/options-24.icon.ts → dist/icons/icon-svgs/options-24.icon.js} +4 -5
  104. package/dist/icons/icon-svgs/pencil-24.icon.d.ts +8 -0
  105. package/{src/icons/icon-svgs/pencil-24.icon.ts → dist/icons/icon-svgs/pencil-24.icon.js} +4 -5
  106. package/dist/icons/icon-svgs/shield-24.icon.d.ts +8 -0
  107. package/{src/icons/icon-svgs/shield-24.icon.ts → dist/icons/icon-svgs/shield-24.icon.js} +4 -5
  108. package/dist/icons/icon-svgs/sort-ascending-24.icon.d.ts +8 -0
  109. package/{src/icons/icon-svgs/sort-ascending-24.icon.ts → dist/icons/icon-svgs/sort-ascending-24.icon.js} +4 -5
  110. package/dist/icons/icon-svgs/sort-descending-24.icon.d.ts +8 -0
  111. package/{src/icons/icon-svgs/sort-descending-24.icon.ts → dist/icons/icon-svgs/sort-descending-24.icon.js} +4 -5
  112. package/dist/icons/icon-svgs/speaker-loud-24.icon.d.ts +8 -0
  113. package/{src/icons/icon-svgs/speaker-loud-24.icon.ts → dist/icons/icon-svgs/speaker-loud-24.icon.js} +4 -5
  114. package/dist/icons/icon-svgs/speaker-medium-24.icon.d.ts +8 -0
  115. package/{src/icons/icon-svgs/speaker-medium-24.icon.ts → dist/icons/icon-svgs/speaker-medium-24.icon.js} +4 -5
  116. package/dist/icons/icon-svgs/speaker-muted-24.icon.d.ts +8 -0
  117. package/{src/icons/icon-svgs/speaker-muted-24.icon.ts → dist/icons/icon-svgs/speaker-muted-24.icon.js} +4 -5
  118. package/dist/icons/icon-svgs/speaker-quiet-24.icon.d.ts +8 -0
  119. package/{src/icons/icon-svgs/speaker-quiet-24.icon.ts → dist/icons/icon-svgs/speaker-quiet-24.icon.js} +4 -5
  120. package/dist/icons/icon-svgs/star-24.icon.d.ts +8 -0
  121. package/{src/icons/icon-svgs/star-24.icon.ts → dist/icons/icon-svgs/star-24.icon.js} +4 -5
  122. package/dist/icons/icon-svgs/status-failure-24.icon.d.ts +8 -0
  123. package/{src/icons/icon-svgs/status-failure-24.icon.ts → dist/icons/icon-svgs/status-failure-24.icon.js} +4 -5
  124. package/dist/icons/icon-svgs/status-in-progress-24.icon.d.ts +8 -0
  125. package/{src/icons/icon-svgs/status-in-progress-24.icon.ts → dist/icons/icon-svgs/status-in-progress-24.icon.js} +4 -5
  126. package/dist/icons/icon-svgs/status-success-24.icon.d.ts +8 -0
  127. package/{src/icons/icon-svgs/status-success-24.icon.ts → dist/icons/icon-svgs/status-success-24.icon.js} +4 -5
  128. package/dist/icons/icon-svgs/status-unknown-24.icon.d.ts +8 -0
  129. package/{src/icons/icon-svgs/status-unknown-24.icon.ts → dist/icons/icon-svgs/status-unknown-24.icon.js} +4 -5
  130. package/dist/icons/icon-svgs/status-warning-24.icon.d.ts +8 -0
  131. package/{src/icons/icon-svgs/status-warning-24.icon.ts → dist/icons/icon-svgs/status-warning-24.icon.js} +4 -5
  132. package/dist/icons/icon-svgs/upload-24.icon.d.ts +8 -0
  133. package/{src/icons/icon-svgs/upload-24.icon.ts → dist/icons/icon-svgs/upload-24.icon.js} +4 -5
  134. package/dist/icons/icon-svgs/x-24.icon.d.ts +8 -0
  135. package/{src/icons/icon-svgs/x-24.icon.ts → dist/icons/icon-svgs/x-24.icon.js} +4 -5
  136. package/dist/icons/index.d.ts +86 -0
  137. package/{src/icons/index.ts → dist/icons/index.js} +39 -43
  138. package/dist/index.js +4 -0
  139. package/dist/styles/disabled.d.ts +6 -0
  140. package/{src/styles/disabled.ts → dist/styles/disabled.js} +2 -3
  141. package/dist/styles/durations.d.ts +22 -0
  142. package/{src/styles/durations.ts → dist/styles/durations.js} +1 -2
  143. package/dist/styles/focus.d.ts +21 -0
  144. package/dist/styles/focus.js +41 -0
  145. package/dist/styles/font.d.ts +9 -0
  146. package/{src/styles/font.ts → dist/styles/font.js} +1 -2
  147. package/dist/styles/form-styles.d.ts +123 -0
  148. package/dist/styles/form-styles.js +126 -0
  149. package/{src/styles/index.ts → dist/styles/index.d.ts} +0 -2
  150. package/dist/styles/index.js +12 -0
  151. package/dist/styles/native-styles.d.ts +13 -0
  152. package/{src/styles/native-styles.ts → dist/styles/native-styles.js} +3 -6
  153. package/dist/styles/scrollbar.d.ts +6 -0
  154. package/{src/styles/scrollbar.ts → dist/styles/scrollbar.js} +3 -4
  155. package/dist/styles/shadows.d.ts +20 -0
  156. package/{src/styles/shadows.ts → dist/styles/shadows.js} +6 -8
  157. package/dist/styles/user-select.d.ts +6 -0
  158. package/{src/styles/user-select.ts → dist/styles/user-select.js} +2 -3
  159. package/dist/styles/vira-color-palette.d.ts +97 -0
  160. package/dist/styles/vira-color-palette.js +98 -0
  161. package/dist/styles/vira-color-theme.d.ts +1580 -0
  162. package/dist/styles/vira-color-theme.js +1516 -0
  163. package/dist/util/define-table.d.ts +110 -0
  164. package/dist/util/define-table.js +115 -0
  165. package/dist/util/dynamic-element.d.ts +63 -0
  166. package/dist/util/dynamic-element.js +61 -0
  167. package/dist/util/index.js +3 -0
  168. package/dist/util/pop-up-manager.d.ts +186 -0
  169. package/dist/util/pop-up-manager.js +214 -0
  170. package/package.json +6 -6
  171. package/src/elements/define-vira-element.ts +0 -29
  172. package/src/elements/form/vira-form-fields.ts +0 -140
  173. package/src/elements/form/vira-form.element.ts +0 -204
  174. package/src/elements/pop-up/pop-up-helpers.ts +0 -85
  175. package/src/elements/pop-up/vira-menu-trigger.element.ts +0 -158
  176. package/src/elements/shared-text-input-logic.ts +0 -173
  177. package/src/elements/vira-button.element.ts +0 -171
  178. package/src/elements/vira-card.element.ts +0 -54
  179. package/src/elements/vira-overflow-switch.element.ts +0 -137
  180. package/src/icons/icon-color.test-helper.ts +0 -9
  181. package/src/icons/icon-svg.ts +0 -71
  182. package/src/styles/border.ts +0 -11
  183. package/src/styles/focus.ts +0 -76
  184. package/src/styles/form-styles.ts +0 -26
  185. package/src/styles/vira-color-palette.ts +0 -106
  186. package/src/styles/vira-color-theme.ts +0 -1142
  187. package/src/util/define-table.ts +0 -279
  188. package/src/util/dynamic-element.ts +0 -129
  189. package/src/util/pop-up-manager.ts +0 -380
  190. /package/{src/elements/index.ts → dist/elements/index.d.ts} +0 -0
  191. /package/{src/index.ts → dist/index.d.ts} +0 -0
  192. /package/{src/util/index.ts → dist/util/index.d.ts} +0 -0
@@ -0,0 +1,46 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ import { type ViraIconSvg } from '../icons/icon-svg.js';
3
+ import { type ShowPopUpResult } from '../util/pop-up-manager.js';
4
+ import { type MenuItem } from './pop-up/pop-up-menu-item.js';
5
+ import { type PopUpTriggerPosition } from './pop-up/vira-pop-up-trigger.element.js';
6
+ /**
7
+ * Test ids for {@link ViraDropdown}.
8
+ *
9
+ * @category Internal
10
+ */
11
+ export declare const viraDropdownTestIds: {
12
+ trigger: string;
13
+ icon: string;
14
+ prefix: string;
15
+ };
16
+ /**
17
+ * A dropdown element that uses pop-up menus.
18
+ *
19
+ * @category Dropdown
20
+ * @category Elements
21
+ * @see https://electrovir.github.io/vira/book/elements/dropdown/vira-dropdown
22
+ */
23
+ export declare const ViraDropdown: import("element-vir").DeclarativeElementDefinition<"vira-dropdown", {
24
+ options: ReadonlyArray<Readonly<MenuItem>>;
25
+ /** The selected id from the given options. */
26
+ selected: ReadonlyArray<PropertyKey>;
27
+ } & PartialWithUndefined<{
28
+ /** Text to show if nothing is selected. */
29
+ placeholder: string;
30
+ /**
31
+ * If false, this will behave like a single select dropdown, otherwise you can select
32
+ * multiple.
33
+ */
34
+ isMultiSelect: boolean;
35
+ icon: ViraIconSvg;
36
+ selectionPrefix: string;
37
+ isDisabled: boolean;
38
+ /** For debugging purposes only. Very bad for actual production code use. */
39
+ z_debug_forceOpenState: boolean;
40
+ } & PopUpTriggerPosition>, {
41
+ /** `undefined` means the pop up is not currently showing. */
42
+ showPopUpResult: ShowPopUpResult | undefined;
43
+ }, {
44
+ selectedChange: import("element-vir").DefineEvent<PropertyKey[]>;
45
+ openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
46
+ }, "vira-dropdown-", "vira-dropdown-", readonly [], readonly []>;
@@ -1,28 +1,13 @@
1
- import {check} from '@augment-vir/assert';
2
- import {filterMap, type PartialWithUndefined} from '@augment-vir/common';
3
- import {
4
- classMap,
5
- css,
6
- defineElementEvent,
7
- html,
8
- type HTMLTemplateResult,
9
- ifDefined,
10
- listen,
11
- nothing,
12
- testId,
13
- } from 'element-vir';
14
- import {type ViraIconSvg} from '../icons/icon-svg.js';
15
- import {ChevronUp24Icon} from '../icons/index.js';
16
- import {viraBorders} from '../styles/border.js';
17
- import {viraFormCssVars} from '../styles/form-styles.js';
18
- import {noUserSelect, viraAnimationDurations} from '../styles/index.js';
19
- import {type ShowPopUpResult} from '../util/pop-up-manager.js';
20
- import {defineViraElement} from './define-vira-element.js';
21
- import {type MenuItem} from './pop-up/pop-up-menu-item.js';
22
- import {ViraMenuTrigger} from './pop-up/vira-menu-trigger.element.js';
23
- import {HorizontalAnchor, type PopUpTriggerPosition} from './pop-up/vira-pop-up-trigger.element.js';
24
- import {ViraIcon} from './vira-icon.element.js';
25
-
1
+ import { check } from '@augment-vir/assert';
2
+ import { filterMap } from '@augment-vir/common';
3
+ import { classMap, css, defineElementEvent, html, ifDefined, listen, nothing, testId, } from 'element-vir';
4
+ import { ChevronUp24Icon } from '../icons/index.js';
5
+ import { viraFormCssVars } from '../styles/form-styles.js';
6
+ import { noUserSelect, viraAnimationDurations } from '../styles/index.js';
7
+ import { defineViraElement } from './define-vira-element.js';
8
+ import { ViraMenuTrigger } from './pop-up/vira-menu-trigger.element.js';
9
+ import { HorizontalAnchor } from './pop-up/vira-pop-up-trigger.element.js';
10
+ import { ViraIcon } from './vira-icon.element.js';
26
11
  /**
27
12
  * Test ids for {@link ViraDropdown}.
28
13
  *
@@ -33,7 +18,6 @@ export const viraDropdownTestIds = {
33
18
  icon: 'dropdown-icon',
34
19
  prefix: 'dropdown-prefix',
35
20
  };
36
-
37
21
  /**
38
22
  * A dropdown element that uses pop-up menus.
39
23
  *
@@ -41,30 +25,9 @@ export const viraDropdownTestIds = {
41
25
  * @category Elements
42
26
  * @see https://electrovir.github.io/vira/book/elements/dropdown/vira-dropdown
43
27
  */
44
- export const ViraDropdown = defineViraElement<
45
- {
46
- options: ReadonlyArray<Readonly<MenuItem>>;
47
- /** The selected id from the given options. */
48
- selected: ReadonlyArray<PropertyKey>;
49
- } & PartialWithUndefined<
50
- {
51
- /** Text to show if nothing is selected. */
52
- placeholder: string;
53
- /**
54
- * If false, this will behave like a single select dropdown, otherwise you can select
55
- * multiple.
56
- */
57
- isMultiSelect: boolean;
58
- icon: ViraIconSvg;
59
- selectionPrefix: string;
60
- isDisabled: boolean;
61
- /** For debugging purposes only. Very bad for actual production code use. */
62
- z_debug_forceOpenState: boolean;
63
- } & PopUpTriggerPosition
64
- >
65
- >()({
28
+ export const ViraDropdown = defineViraElement()({
66
29
  tagName: 'vira-dropdown',
67
- styles: css`
30
+ styles: css `
68
31
  :host {
69
32
  display: inline-flex;
70
33
  vertical-align: middle;
@@ -123,7 +86,7 @@ export const ViraDropdown = defineViraElement<
123
86
  align-items: center;
124
87
  padding: 3px;
125
88
  padding-left: 10px;
126
- border-radius: ${viraBorders['vira-form-input-radius'].value};
89
+ border-radius: ${viraFormCssVars['vira-form-radius'].value};
127
90
  background-color: ${viraFormCssVars['vira-form-background-color'].value};
128
91
  color: ${viraFormCssVars['vira-form-foreground-color'].value};
129
92
  }
@@ -133,86 +96,76 @@ export const ViraDropdown = defineViraElement<
133
96
  }
134
97
  `,
135
98
  events: {
136
- selectedChange: defineElementEvent<PropertyKey[]>(),
137
- openChange: defineElementEvent<ShowPopUpResult | undefined>(),
99
+ selectedChange: defineElementEvent(),
100
+ openChange: defineElementEvent(),
138
101
  },
139
102
  state() {
140
103
  return {
141
104
  /** `undefined` means the pop up is not currently showing. */
142
- showPopUpResult: undefined as ShowPopUpResult | undefined,
105
+ showPopUpResult: undefined,
143
106
  };
144
107
  },
145
- render({state, inputs, dispatch, events, updateState}) {
146
- const selectedOptions = filterMap(
147
- inputs.selected,
148
- (selectedId) => inputs.options.find((option) => option.id === selectedId),
149
- check.isTruthy,
150
- );
151
-
108
+ render({ state, inputs, dispatch, events, updateState }) {
109
+ const selectedOptions = filterMap(inputs.selected, (selectedId) => inputs.options.find((option) => option.id === selectedId), check.isTruthy);
152
110
  const leadingIconTemplate = inputs.icon
153
- ? html`
111
+ ? html `
154
112
  <${ViraIcon.assign({
155
- icon: inputs.icon,
156
- })}
113
+ icon: inputs.icon,
114
+ })}
157
115
  ${testId(viraDropdownTestIds.icon)}
158
116
  ></${ViraIcon}>
159
117
  `
160
118
  : nothing;
161
-
162
- const shouldUsePlaceholder: boolean = !selectedOptions.length;
163
-
164
- const prefixTemplate =
165
- inputs.selectionPrefix && !shouldUsePlaceholder
166
- ? html`
119
+ const shouldUsePlaceholder = !selectedOptions.length;
120
+ const prefixTemplate = inputs.selectionPrefix && !shouldUsePlaceholder
121
+ ? html `
167
122
  <span class="selected-label-prefix" ${testId(viraDropdownTestIds.prefix)}>
168
123
  ${inputs.selectionPrefix}
169
124
  </span>
170
125
  `
171
- : nothing;
172
-
173
- const selectionDisplay: string | HTMLTemplateResult = shouldUsePlaceholder
126
+ : nothing;
127
+ const selectionDisplay = shouldUsePlaceholder
174
128
  ? inputs.placeholder || ''
175
129
  : inputs.isMultiSelect && selectedOptions.length > 1
176
- ? `${selectedOptions.length} Selected`
177
- : selectedOptions[0]?.label || '';
178
-
179
- return html`
130
+ ? `${selectedOptions.length} Selected`
131
+ : selectedOptions[0]?.label || '';
132
+ return html `
180
133
  <${ViraMenuTrigger.assign({
181
- ...inputs,
182
- items: inputs.options,
183
- popUpOffset: {
184
- vertical: -1,
185
- right: 24,
186
- },
187
- horizontalAnchor: inputs.horizontalAnchor || HorizontalAnchor.Both,
188
- })}
134
+ ...inputs,
135
+ items: inputs.options,
136
+ popUpOffset: {
137
+ vertical: -1,
138
+ right: 24,
139
+ },
140
+ horizontalAnchor: inputs.horizontalAnchor || HorizontalAnchor.Both,
141
+ })}
189
142
  ${listen(ViraMenuTrigger.events.openChange, (event) => {
190
- updateState({showPopUpResult: event.detail});
191
- dispatch(new events.openChange(event.detail));
192
- })}
143
+ updateState({ showPopUpResult: event.detail });
144
+ dispatch(new events.openChange(event.detail));
145
+ })}
193
146
  ${listen(ViraMenuTrigger.events.itemActivate, (event) => {
194
- dispatch(new events.selectedChange(event.detail));
195
- })}
147
+ dispatch(new events.selectedChange(event.detail));
148
+ })}
196
149
  >
197
150
  <div
198
151
  class="dropdown-trigger ${classMap({
199
- open: !!state.showPopUpResult,
200
- 'open-upwards': !state.showPopUpResult?.popDown,
201
- })}"
152
+ open: !!state.showPopUpResult,
153
+ 'open-upwards': !state.showPopUpResult?.popDown,
154
+ })}"
202
155
  ${testId(viraDropdownTestIds.trigger)}
203
156
  >
204
157
  ${leadingIconTemplate}
205
158
  <span
206
159
  class="selection-display ${classMap({
207
- 'using-placeholder': shouldUsePlaceholder,
208
- })}"
160
+ 'using-placeholder': shouldUsePlaceholder,
161
+ })}"
209
162
  title=${ifDefined(shouldUsePlaceholder ? undefined : selectionDisplay)}
210
163
  >
211
164
  ${prefixTemplate} ${selectionDisplay}
212
165
  </span>
213
166
 
214
167
  <span class="trigger-icon-wrapper">
215
- <${ViraIcon.assign({icon: ChevronUp24Icon})}
168
+ <${ViraIcon.assign({ icon: ChevronUp24Icon })}
216
169
  class="trigger-icon"
217
170
  ></${ViraIcon}>
218
171
  </span>
@@ -0,0 +1,7 @@
1
+ /**
2
+ * An error wrapper that applies error coloring (red, by default).
3
+ *
4
+ * @category Elements
5
+ * @see https://electrovir.github.io/vira/book/elements/vira-error
6
+ */
7
+ export declare const ViraError: import("element-vir").DeclarativeElementDefinition<"vira-error", {}, {}, {}, "vira-error-", "vira-error-font-weight", readonly [], readonly []>;
@@ -1,7 +1,6 @@
1
- import {css, html} from 'element-vir';
2
- import {viraFormCssVars} from '../styles/form-styles.js';
3
- import {defineViraElement} from './define-vira-element.js';
4
-
1
+ import { css, html } from 'element-vir';
2
+ import { viraFormCssVars } from '../styles/form-styles.js';
3
+ import { defineViraElement } from './define-vira-element.js';
5
4
  /**
6
5
  * An error wrapper that applies error coloring (red, by default).
7
6
  *
@@ -13,14 +12,14 @@ export const ViraError = defineViraElement()({
13
12
  cssVars: {
14
13
  'vira-error-font-weight': 'bold',
15
14
  },
16
- styles: ({cssVars}) => css`
15
+ styles: ({ cssVars }) => css `
17
16
  :host {
18
- color: ${viraFormCssVars['vira-form-error-foreground-color'].value};
17
+ color: ${viraFormCssVars['vira-form-error-color'].value};
19
18
  font-weight: ${cssVars['vira-error-font-weight'].value};
20
19
  }
21
20
  `,
22
21
  render() {
23
- return html`
22
+ return html `
24
23
  <slot></slot>
25
24
  `;
26
25
  },
@@ -0,0 +1,13 @@
1
+ import { type ViraIconSvg } from '../icons/icon-svg.js';
2
+ /**
3
+ * An element that renders a single {@link ViraIconSvg}.
4
+ *
5
+ * @category Icon
6
+ * @category Elements
7
+ * @see https://electrovir.github.io/vira/book/elements/vira-icon
8
+ */
9
+ export declare const ViraIcon: import("element-vir").DeclarativeElementDefinition<"vira-icon", {
10
+ icon: Pick<ViraIconSvg, "svgTemplate"> | undefined;
11
+ /** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
12
+ fitContainer?: boolean | undefined;
13
+ }, {}, {}, "vira-icon-fit-container", "vira-icon-", readonly [], readonly []>;
@@ -1,7 +1,5 @@
1
- import {css} from 'element-vir';
2
- import {type ViraIconSvg} from '../icons/icon-svg.js';
3
- import {defineViraElement} from './define-vira-element.js';
4
-
1
+ import { css } from 'element-vir';
2
+ import { defineViraElement } from './define-vira-element.js';
5
3
  /**
6
4
  * An element that renders a single {@link ViraIconSvg}.
7
5
  *
@@ -9,17 +7,13 @@ import {defineViraElement} from './define-vira-element.js';
9
7
  * @category Elements
10
8
  * @see https://electrovir.github.io/vira/book/elements/vira-icon
11
9
  */
12
- export const ViraIcon = defineViraElement<{
13
- icon: Pick<ViraIconSvg, 'svgTemplate'> | undefined;
14
- /** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
15
- fitContainer?: boolean | undefined;
16
- }>()({
10
+ export const ViraIcon = defineViraElement()({
17
11
  tagName: 'vira-icon',
18
12
  hostClasses: {
19
13
  /** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
20
- 'vira-icon-fit-container': ({inputs}) => !!inputs.fitContainer,
14
+ 'vira-icon-fit-container': ({ inputs }) => !!inputs.fitContainer,
21
15
  },
22
- styles: ({hostClasses}) => css`
16
+ styles: ({ hostClasses }) => css `
23
17
  :host {
24
18
  display: inline-block;
25
19
  }
@@ -37,11 +31,10 @@ export const ViraIcon = defineViraElement<{
37
31
  width: 100%;
38
32
  }
39
33
  `,
40
- render({inputs}) {
34
+ render({ inputs }) {
41
35
  if (!inputs.icon) {
42
36
  return '';
43
37
  }
44
-
45
38
  return inputs.icon.svgTemplate;
46
39
  },
47
40
  });
@@ -0,0 +1,45 @@
1
+ import { type Dimensions } from '@augment-vir/common';
2
+ import { type Duration, type DurationUnit } from 'date-vir';
3
+ /**
4
+ * An `<img>` element wrapper that handles size constraints and includes slots for loading and error
5
+ * indicators.
6
+ *
7
+ * Use CSS properties to constrain the image. In particular, set `min-height` and `min-width` on
8
+ * this to control the size of the loader and error slots.
9
+ *
10
+ * @category Image
11
+ * @category Elements
12
+ * @see https://electrovir.github.io/vira/book/elements/vira-image
13
+ */
14
+ export declare const ViraImage: import("element-vir").DeclarativeElementDefinition<"vira-image", {
15
+ /** The URL of the image to load. This is passed directly to the `<img>` element. */
16
+ imageUrl: string;
17
+ /**
18
+ * The dimension which should dominantly constrain the image size. Whichever dimension this is
19
+ * set to is the dimension that the image will grow to match. This is only relevant if you apply
20
+ * size constraints on ViraImage via CSS in its parent.
21
+ *
22
+ * @default 'width'
23
+ */
24
+ dominantDimension?: keyof Dimensions | undefined;
25
+ /** For debugging only: artificially set a delay for the image loading so you can see the loader. */
26
+ _debugLoadDelay?: Duration<DurationUnit.Milliseconds> | undefined;
27
+ }, {
28
+ /**
29
+ * To avoid race conditions between `<img>` element events and potential input changing,
30
+ * save the loaded state of an URL's image by the image's URL.
31
+ */
32
+ loadedUrls: Readonly<{
33
+ [url: string]: true;
34
+ }>;
35
+ /**
36
+ * To avoid race conditions between `<img>` element events and potential input changing,
37
+ * save the errored state of an URL's image by the image's URL.
38
+ */
39
+ erroredUrls: Readonly<{
40
+ [url: string]: true;
41
+ }>;
42
+ }, {
43
+ imageLoad: import("element-vir").DefineEvent<void>;
44
+ imageError: import("element-vir").DefineEvent<unknown>;
45
+ }, "vira-image-height-constrained", "vira-image-", readonly ["loading", "error"], readonly []>;
@@ -1,10 +1,8 @@
1
- import {type Dimensions, wait} from '@augment-vir/common';
2
- import {type Duration, type DurationUnit} from 'date-vir';
3
- import {classMap, css, defineElementEvent, html, listen, renderIf} from 'element-vir';
4
- import {LoaderAnimated24Icon, StatusFailure24Icon} from '../icons/index.js';
5
- import {defineViraElement} from './define-vira-element.js';
6
- import {ViraIcon} from './vira-icon.element.js';
7
-
1
+ import { wait } from '@augment-vir/common';
2
+ import { classMap, css, defineElementEvent, html, listen, renderIf } from 'element-vir';
3
+ import { LoaderAnimated24Icon, StatusFailure24Icon } from '../icons/index.js';
4
+ import { defineViraElement } from './define-vira-element.js';
5
+ import { ViraIcon } from './vira-icon.element.js';
8
6
  /**
9
7
  * An `<img>` element wrapper that handles size constraints and includes slots for loading and error
10
8
  * indicators.
@@ -16,20 +14,7 @@ import {ViraIcon} from './vira-icon.element.js';
16
14
  * @category Elements
17
15
  * @see https://electrovir.github.io/vira/book/elements/vira-image
18
16
  */
19
- export const ViraImage = defineViraElement<{
20
- /** The URL of the image to load. This is passed directly to the `<img>` element. */
21
- imageUrl: string;
22
- /**
23
- * The dimension which should dominantly constrain the image size. Whichever dimension this is
24
- * set to is the dimension that the image will grow to match. This is only relevant if you apply
25
- * size constraints on ViraImage via CSS in its parent.
26
- *
27
- * @default 'width'
28
- */
29
- dominantDimension?: keyof Dimensions | undefined;
30
- /** For debugging only: artificially set a delay for the image loading so you can see the loader. */
31
- _debugLoadDelay?: Duration<DurationUnit.Milliseconds> | undefined;
32
- }>()({
17
+ export const ViraImage = defineViraElement()({
33
18
  tagName: 'vira-image',
34
19
  state() {
35
20
  return {
@@ -37,26 +22,26 @@ export const ViraImage = defineViraElement<{
37
22
  * To avoid race conditions between `<img>` element events and potential input changing,
38
23
  * save the loaded state of an URL's image by the image's URL.
39
24
  */
40
- loadedUrls: {} as Readonly<{[url: string]: true}>,
25
+ loadedUrls: {},
41
26
  /**
42
27
  * To avoid race conditions between `<img>` element events and potential input changing,
43
28
  * save the errored state of an URL's image by the image's URL.
44
29
  */
45
- erroredUrls: {} as Readonly<{[url: string]: true}>,
30
+ erroredUrls: {},
46
31
  };
47
32
  },
48
33
  hostClasses: {
49
- 'vira-image-height-constrained': ({inputs}) => inputs.dominantDimension === 'height',
34
+ 'vira-image-height-constrained': ({ inputs }) => inputs.dominantDimension === 'height',
50
35
  },
51
36
  slotNames: [
52
37
  'loading',
53
38
  'error',
54
39
  ],
55
40
  events: {
56
- imageLoad: defineElementEvent<void>(),
57
- imageError: defineElementEvent<unknown>(),
41
+ imageLoad: defineElementEvent(),
42
+ imageError: defineElementEvent(),
58
43
  },
59
- styles: ({hostClasses}) => css`
44
+ styles: ({ hostClasses }) => css `
60
45
  :host {
61
46
  display: inline-flex;
62
47
  overflow: hidden;
@@ -103,60 +88,55 @@ export const ViraImage = defineViraElement<{
103
88
  display: none;
104
89
  }
105
90
  `,
106
- render({inputs, state, updateState, dispatch, events, slotNames}) {
91
+ render({ inputs, state, updateState, dispatch, events, slotNames }) {
107
92
  /**
108
93
  * Saved off for use in the image listeners. This is used to eliminate race conditions
109
94
  * between image events and the input URL changing.
110
95
  */
111
96
  const imageUrl = inputs.imageUrl;
112
-
113
97
  const statusTemplate = state.erroredUrls[imageUrl]
114
- ? html`
98
+ ? html `
115
99
  <slot class="status-wrapper" name=${slotNames.error}>
116
- <${ViraIcon.assign({icon: StatusFailure24Icon})} class="error"></${ViraIcon}>
100
+ <${ViraIcon.assign({ icon: StatusFailure24Icon })} class="error"></${ViraIcon}>
117
101
  </slot>
118
102
  `
119
103
  : state.loadedUrls[imageUrl]
120
- ? undefined
121
- : html`
104
+ ? undefined
105
+ : html `
122
106
  <slot class="status-wrapper" name=${slotNames.loading}>
123
- <${ViraIcon.assign({icon: LoaderAnimated24Icon})}></${ViraIcon}>
107
+ <${ViraIcon.assign({ icon: LoaderAnimated24Icon })}></${ViraIcon}>
124
108
  </slot>
125
109
  `;
126
-
127
- return html`
110
+ return html `
128
111
  ${renderIf(!!statusTemplate, statusTemplate)}
129
112
  <img
130
113
  class=${classMap({
131
- hidden: !!statusTemplate,
132
- })}
114
+ hidden: !!statusTemplate,
115
+ })}
133
116
  ${listen('load', async () => {
134
- if (inputs._debugLoadDelay) {
135
- await wait(inputs._debugLoadDelay);
136
- }
137
-
138
- updateState({
139
- loadedUrls: {
140
- ...state.loadedUrls,
141
- [imageUrl]: true,
142
- },
143
- });
144
-
145
- dispatch(new events.imageLoad());
146
- })}
117
+ if (inputs._debugLoadDelay) {
118
+ await wait(inputs._debugLoadDelay);
119
+ }
120
+ updateState({
121
+ loadedUrls: {
122
+ ...state.loadedUrls,
123
+ [imageUrl]: true,
124
+ },
125
+ });
126
+ dispatch(new events.imageLoad());
127
+ })}
147
128
  ${listen('error', async (event) => {
148
- if (inputs._debugLoadDelay) {
149
- await wait(inputs._debugLoadDelay);
150
- }
151
- updateState({
152
- erroredUrls: {
153
- ...state.erroredUrls,
154
- [imageUrl]: true,
155
- },
156
- });
157
-
158
- dispatch(new events.imageError(event.error));
159
- })}
129
+ if (inputs._debugLoadDelay) {
130
+ await wait(inputs._debugLoadDelay);
131
+ }
132
+ updateState({
133
+ erroredUrls: {
134
+ ...state.erroredUrls,
135
+ [imageUrl]: true,
136
+ },
137
+ });
138
+ dispatch(new events.imageError(event.error));
139
+ })}
160
140
  src=${imageUrl}
161
141
  />
162
142
  `;
@@ -0,0 +1,62 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ import { type ViraIconSvg } from '../icons/index.js';
3
+ export * from './shared-text-input-logic.js';
4
+ /**
5
+ * Input types for {@link ViraInput}.
6
+ *
7
+ * @category Internal
8
+ */
9
+ export declare enum ViraInputType {
10
+ Default = "text",
11
+ Password = "password",
12
+ Email = "email"
13
+ }
14
+ /**
15
+ * A single line input element with all listeners properly attached. Multiple types are allowed with
16
+ * {@link ViraInputType}.
17
+ *
18
+ * @category Input
19
+ * @category Elements
20
+ * @see https://electrovir.github.io/vira/book/elements/vira-input
21
+ */
22
+ export declare const ViraInput: import("element-vir").DeclarativeElementDefinition<"vira-input", Readonly<PartialWithUndefined<{
23
+ icon: Pick<ViraIconSvg, "svgTemplate">;
24
+ /** A suffix that, if provided, is shown following the input field. */
25
+ suffix: string;
26
+ /** A label that is shown above the input, if provided. */
27
+ label: string;
28
+ /** If true, applies error styling. */
29
+ hasError: boolean;
30
+ showClearButton: boolean;
31
+ type: ViraInputType;
32
+ }> & {
33
+ value: string;
34
+ } & PartialWithUndefined<{
35
+ placeholder: string;
36
+ disabled: boolean;
37
+ allowedInputs: string | RegExp;
38
+ blockedInputs: string | RegExp;
39
+ disableBrowserHelps: boolean;
40
+ fitText: boolean;
41
+ attributePassthrough: import("element-vir").AttributeValues;
42
+ }>>, {
43
+ forcedInputWidth: number;
44
+ showPassword: boolean;
45
+ /**
46
+ * Used to couple the label and input together. This is not applied if no label is
47
+ * provided.
48
+ */
49
+ randomId: string;
50
+ }, {
51
+ /**
52
+ * Fires whenever a user input created a new value. Does not fire if all input letters are
53
+ * filtered out due to input restrictions.
54
+ */
55
+ valueChange: import("element-vir").DefineEvent<string>;
56
+ /**
57
+ * Fires when inputs are blocked. Useful for showing warnings or error messages to inform
58
+ * the user why their input did not propagate if it was blocked. This does not fire for text
59
+ * that was blocked out of programmatic "value" property assignments.
60
+ */
61
+ inputBlocked: import("element-vir").DefineEvent<string>;
62
+ }, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown" | "vira-input-error", "vira-input-padding-horizontal" | "vira-input-padding-vertical", readonly [], readonly []>;