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
@@ -1,49 +1,28 @@
1
- import {assertWrap} from '@augment-vir/assert';
2
- import {type PartialWithUndefined, randomString} from '@augment-vir/common';
3
- import {extractEventTarget} from '@augment-vir/web';
4
- import {
5
- attributes,
6
- css,
7
- defineElementEvent,
8
- html,
9
- ifDefined,
10
- listen,
11
- nothing,
12
- onResize,
13
- renderIf,
14
- } from 'element-vir';
15
- import {CloseX24Icon} from '../icons/icon-svgs/close-x-24.icon.js';
16
- import {EyeClosed24Icon, EyeOpen24Icon, type ViraIconSvg} from '../icons/index.js';
17
- import {createFocusStyles} from '../styles/focus.js';
18
- import {viraFormCssVars} from '../styles/form-styles.js';
19
- import {
20
- noUserSelect,
21
- viraAnimationDurations,
22
- viraBorders,
23
- viraDisabledStyles,
24
- } from '../styles/index.js';
25
- import {noNativeFormStyles} from '../styles/native-styles.js';
26
- import {defineViraElement} from './define-vira-element.js';
27
- import {
28
- type SharedTextInputElementInputs,
29
- filterTextInputValue,
30
- textInputListener,
31
- } from './shared-text-input-logic.js';
32
- import {ViraIcon} from './vira-icon.element.js';
33
-
1
+ import { assertWrap } from '@augment-vir/assert';
2
+ import { randomString } from '@augment-vir/common';
3
+ import { extractEventTarget } from '@augment-vir/web';
4
+ import { attributes, css, defineElementEvent, html, ifDefined, listen, nothing, onResize, renderIf, } from 'element-vir';
5
+ import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon.js';
6
+ import { EyeClosed24Icon, EyeOpen24Icon } from '../icons/index.js';
7
+ import { createFocusStyles } from '../styles/focus.js';
8
+ import { viraFormCssVars } from '../styles/form-styles.js';
9
+ import { noUserSelect, viraAnimationDurations, viraDisabledStyles } from '../styles/index.js';
10
+ import { noNativeFormStyles } from '../styles/native-styles.js';
11
+ import { defineViraElement } from './define-vira-element.js';
12
+ import { filterTextInputValue, textInputListener, } from './shared-text-input-logic.js';
13
+ import { ViraIcon } from './vira-icon.element.js';
34
14
  export * from './shared-text-input-logic.js';
35
-
36
15
  /**
37
16
  * Input types for {@link ViraInput}.
38
17
  *
39
18
  * @category Internal
40
19
  */
41
- export enum ViraInputType {
42
- Default = 'text',
43
- Password = 'password',
44
- Email = 'email',
45
- }
46
-
20
+ export var ViraInputType;
21
+ (function (ViraInputType) {
22
+ ViraInputType["Default"] = "text";
23
+ ViraInputType["Password"] = "password";
24
+ ViraInputType["Email"] = "email";
25
+ })(ViraInputType || (ViraInputType = {}));
47
26
  /**
48
27
  * A single line input element with all listeners properly attached. Multiple types are allowed with
49
28
  * {@link ViraInputType}.
@@ -52,39 +31,14 @@ export enum ViraInputType {
52
31
  * @category Elements
53
32
  * @see https://electrovir.github.io/vira/book/elements/vira-input
54
33
  */
55
- export const ViraInput = defineViraElement<
56
- Readonly<
57
- PartialWithUndefined<{
58
- icon: Pick<ViraIconSvg, 'svgTemplate'>;
59
- /** A suffix that, if provided, is shown following the input field. */
60
- suffix: string;
61
- /** A label that is shown above the input, if provided. */
62
- label: string;
63
- /** If true, applies error styling. */
64
- hasError: boolean;
65
- showClearButton: boolean;
66
- type: ViraInputType;
67
- }> &
68
- SharedTextInputElementInputs
69
- >
70
- >()({
34
+ export const ViraInput = defineViraElement()({
71
35
  tagName: 'vira-input',
72
36
  cssVars: {
73
- 'vira-input-action-button-color': '#aaaaaa',
74
-
75
- 'vira-input-clear-button-hover-color': '#ff0000',
76
- 'vira-input-clear-button-active-color': '#b30000',
77
-
78
- // eslint-disable-next-line sonarjs/no-hardcoded-passwords
79
- 'vira-input-show-password-button-hover-color': '#0a89ff',
80
- // eslint-disable-next-line sonarjs/no-hardcoded-passwords
81
- 'vira-input-show-password-button-active-color': '#0261ba',
82
-
83
37
  'vira-input-padding-horizontal': '10px',
84
38
  'vira-input-padding-vertical': '6px',
85
39
  },
86
- styles: ({hostClasses, cssVars}) => {
87
- return css`
40
+ styles: ({ hostClasses, cssVars }) => {
41
+ return css `
88
42
  :host {
89
43
  position: relative;
90
44
  display: inline-flex;
@@ -166,7 +120,7 @@ export const ViraInput = defineViraElement<
166
120
  left: 0;
167
121
  width: 100%;
168
122
  height: 100%;
169
- border-radius: ${viraBorders['vira-form-input-radius'].value};
123
+ border-radius: ${viraFormCssVars['vira-form-radius'].value};
170
124
  z-index: 0;
171
125
  pointer-events: none;
172
126
  }
@@ -186,7 +140,7 @@ export const ViraInput = defineViraElement<
186
140
  align-items: center;
187
141
  position: relative;
188
142
  padding: 0 ${cssVars['vira-input-padding-horizontal'].value};
189
- border-radius: ${viraBorders['vira-form-input-radius'].value};
143
+ border-radius: ${viraFormCssVars['vira-form-radius'].value};
190
144
  background-color: ${viraFormCssVars['vira-form-background-color'].value};
191
145
  /*
192
146
  Border colors are actually applied via the .wrapper-border class. However, we must
@@ -217,19 +171,19 @@ export const ViraInput = defineViraElement<
217
171
 
218
172
  &:focus:focus-visible:not([disabled]) ~ .focus-border {
219
173
  ${createFocusStyles({
220
- elementBorderSize: 0,
221
- noNesting: true,
222
- })}
174
+ elementBorderSize: 0,
175
+ noNesting: true,
176
+ })}
223
177
  }
224
178
  }
225
179
 
226
180
  ::selection {
227
181
  background: ${viraFormCssVars['vira-form-text-selection-color']
228
- .value}; /* WebKit/Blink Browsers */
182
+ .value}; /* WebKit/Blink Browsers */
229
183
  }
230
184
  ::-moz-selection {
231
185
  background: ${viraFormCssVars['vira-form-text-selection-color']
232
- .value}; /* Gecko Browsers */
186
+ .value}; /* Gecko Browsers */
233
187
  }
234
188
 
235
189
  input:placeholder-shown {
@@ -256,28 +210,28 @@ export const ViraInput = defineViraElement<
256
210
 
257
211
  .clear-x-button,
258
212
  .show-password-button {
259
- color: ${cssVars['vira-input-action-button-color'].value};
213
+ color: ${viraFormCssVars['vira-form-placeholder-color'].value};
260
214
  }
261
215
 
262
216
  .clear-x-button:hover {
263
- color: ${cssVars['vira-input-clear-button-hover-color'].value};
217
+ color: ${viraFormCssVars['vira-form-error-color'].value};
264
218
  }
265
219
 
266
220
  .clear-x-button:active {
267
- color: ${cssVars['vira-input-clear-button-active-color'].value};
221
+ color: ${viraFormCssVars['vira-form-error-active-color'].value};
268
222
  }
269
223
 
270
224
  .show-password-button:hover {
271
- color: ${cssVars['vira-input-show-password-button-hover-color'].value};
225
+ color: ${viraFormCssVars['vira-form-accent-primary-color'].value};
272
226
  }
273
227
 
274
228
  .show-password-button:active {
275
- color: ${cssVars['vira-input-show-password-button-active-color'].value};
229
+ color: ${viraFormCssVars['vira-form-accent-primary-active-color'].value};
276
230
  }
277
231
 
278
232
  ${hostClasses['vira-input-error'].selector} {
279
233
  & .wrapper-border {
280
- border-color: ${viraFormCssVars['vira-form-error-foreground-color'].value};
234
+ border-color: ${viraFormCssVars['vira-form-error-color'].value};
281
235
  }
282
236
  }
283
237
 
@@ -307,13 +261,13 @@ export const ViraInput = defineViraElement<
307
261
  * Fires whenever a user input created a new value. Does not fire if all input letters are
308
262
  * filtered out due to input restrictions.
309
263
  */
310
- valueChange: defineElementEvent<string>(),
264
+ valueChange: defineElementEvent(),
311
265
  /**
312
266
  * Fires when inputs are blocked. Useful for showing warnings or error messages to inform
313
267
  * the user why their input did not propagate if it was blocked. This does not fire for text
314
268
  * that was blocked out of programmatic "value" property assignments.
315
269
  */
316
- inputBlocked: defineElementEvent<string>(),
270
+ inputBlocked: defineElementEvent(),
317
271
  },
318
272
  state() {
319
273
  return {
@@ -327,69 +281,56 @@ export const ViraInput = defineViraElement<
327
281
  };
328
282
  },
329
283
  hostClasses: {
330
- 'vira-input-disabled': ({inputs}) => !!inputs.disabled,
331
- 'vira-input-fit-text': ({inputs}) => !!inputs.fitText,
332
- 'vira-input-clear-button-shown': ({inputs}) => !!inputs.showClearButton,
333
- 'vira-input-error': ({inputs}) => !!inputs.hasError,
284
+ 'vira-input-disabled': ({ inputs }) => !!inputs.disabled,
285
+ 'vira-input-fit-text': ({ inputs }) => !!inputs.fitText,
286
+ 'vira-input-clear-button-shown': ({ inputs }) => !!inputs.showClearButton,
287
+ 'vira-input-error': ({ inputs }) => !!inputs.hasError,
334
288
  },
335
- render: ({inputs, dispatch, state, updateState, events, host}) => {
336
- const {filtered: filteredValue} = filterTextInputValue({
289
+ render: ({ inputs, dispatch, state, updateState, events, host }) => {
290
+ const { filtered: filteredValue } = filterTextInputValue({
337
291
  value: inputs.value,
338
292
  allowed: inputs.allowedInputs,
339
293
  blocked: inputs.blockedInputs,
340
294
  });
341
-
342
295
  const iconTemplate = inputs.icon
343
- ? html`
344
- <${ViraIcon.assign({icon: inputs.icon})} class="left-side-icon"></${ViraIcon}>
296
+ ? html `
297
+ <${ViraIcon.assign({ icon: inputs.icon })} class="left-side-icon"></${ViraIcon}>
345
298
  `
346
299
  : nothing;
347
-
348
300
  const forcedInputWidthStyles = inputs.fitText
349
- ? css`
301
+ ? css `
350
302
  width: ${state.forcedInputWidth}px;
351
303
  `
352
304
  : nothing;
353
-
354
305
  const mousedownListener = listen('mousedown', (event) => {
355
306
  const eventTarget = extractEventTarget(event, HTMLElement, {
356
307
  useOriginalTarget: true,
357
308
  });
358
- const inputElement = assertWrap.instanceOf(
359
- host.shadowRoot.querySelector('input'),
360
- HTMLInputElement,
361
- );
362
-
309
+ const inputElement = assertWrap.instanceOf(host.shadowRoot.querySelector('input'), HTMLInputElement);
363
310
  if (eventTarget !== inputElement) {
364
311
  event.preventDefault();
365
312
  inputElement.focus();
366
313
  }
367
314
  });
368
-
369
- const shouldBlockBrowserHelps =
370
- inputs.disableBrowserHelps ||
315
+ const shouldBlockBrowserHelps = inputs.disableBrowserHelps ||
371
316
  /**
372
317
  * Some browsers leaks passwords with their browser helps (like Chrome with
373
318
  * spellchecking).
374
319
  */
375
320
  inputs.type === ViraInputType.Password;
376
-
377
- const inputTemplate = html`
321
+ const inputTemplate = html `
378
322
  <span class="input-wrapper" ${inputs.label ? nothing : mousedownListener}>
379
323
  ${iconTemplate}
380
- ${renderIf(
381
- !!inputs.fitText,
382
- html`
324
+ ${renderIf(!!inputs.fitText, html `
383
325
  <span
384
326
  class="size-span"
385
- ${onResize(({contentRect}) => {
386
- updateState({forcedInputWidth: contentRect.width});
387
- })}
327
+ ${onResize(({ contentRect }) => {
328
+ updateState({ forcedInputWidth: contentRect.width });
329
+ })}
388
330
  >
389
331
  <pre>${filteredValue || inputs.placeholder || nothing}</pre>
390
332
  </span>
391
- `,
392
- )}
333
+ `)}
393
334
 
394
335
  <input
395
336
  id=${ifDefined(inputs.label ? state.randomId : undefined)}
@@ -404,70 +345,61 @@ export const ViraInput = defineViraElement<
404
345
  ?disabled=${inputs.disabled}
405
346
  .value=${filteredValue}
406
347
  ${listen('input', (event) => {
407
- textInputListener({
408
- inputs,
409
- previousValue: filteredValue,
410
- event,
411
- inputBlockedCallback(blockedInput) {
412
- dispatch(new events.inputBlocked(blockedInput));
413
- },
414
- newValueCallback(newValue) {
415
- dispatch(new events.valueChange(newValue));
416
- },
417
- });
418
- })}
348
+ textInputListener({
349
+ inputs,
350
+ previousValue: filteredValue,
351
+ event,
352
+ inputBlockedCallback(blockedInput) {
353
+ dispatch(new events.inputBlocked(blockedInput));
354
+ },
355
+ newValueCallback(newValue) {
356
+ dispatch(new events.valueChange(newValue));
357
+ },
358
+ });
359
+ })}
419
360
  placeholder=${ifDefined(inputs.placeholder || undefined)}
420
361
  ${attributes(inputs.attributePassthrough)}
421
362
  />
422
363
 
423
- ${renderIf(
424
- !!(inputs.showClearButton && inputs.value),
425
- html`
364
+ ${renderIf(!!(inputs.showClearButton && inputs.value), html `
426
365
  <button
427
366
  class="clear-x-button"
428
367
  title="clear"
429
368
  ${listen('mousedown', (event) => {
430
- event.stopImmediatePropagation();
431
- event.preventDefault();
432
- })}
369
+ event.stopImmediatePropagation();
370
+ event.preventDefault();
371
+ })}
433
372
  ${listen('click', () => {
434
- if (inputs.disabled) {
435
- return;
436
- }
437
- dispatch(new events.valueChange(''));
438
- })}
373
+ if (inputs.disabled) {
374
+ return;
375
+ }
376
+ dispatch(new events.valueChange(''));
377
+ })}
439
378
  >
440
- <${ViraIcon.assign({icon: CloseX24Icon})}></${ViraIcon}>
379
+ <${ViraIcon.assign({ icon: CloseX24Icon })}></${ViraIcon}>
441
380
  </button>
442
- `,
443
- )}
444
- ${renderIf(
445
- inputs.type === ViraInputType.Password,
446
- html`
381
+ `)}
382
+ ${renderIf(inputs.type === ViraInputType.Password, html `
447
383
  <button
448
384
  class="show-password-button"
449
385
  title="show password"
450
386
  ${listen('mousedown', (event) => {
451
- /** Prevent focus of the input. */
452
- event.stopImmediatePropagation();
453
- event.preventDefault();
454
- })}
387
+ /** Prevent focus of the input. */
388
+ event.stopImmediatePropagation();
389
+ event.preventDefault();
390
+ })}
455
391
  ${listen('click', () => {
456
- updateState({showPassword: !state.showPassword});
457
- })}
392
+ updateState({ showPassword: !state.showPassword });
393
+ })}
458
394
  >
459
395
  <${ViraIcon.assign({
460
- icon: state.showPassword ? EyeOpen24Icon : EyeClosed24Icon,
461
- })}></${ViraIcon}>
396
+ icon: state.showPassword ? EyeOpen24Icon : EyeClosed24Icon,
397
+ })}></${ViraIcon}>
462
398
  </button>
463
- `,
464
- )}
465
- ${renderIf(
466
- !!inputs.suffix,
467
- html`
399
+ `)}
400
+ ${renderIf(!!inputs.suffix, html `
468
401
  <div class="suffix">${inputs.suffix}</div>
469
- `,
470
- )}
402
+ `)}
471
403
 
472
404
  <!--
473
405
  These separate style elements are necessary so that we can select them as
@@ -479,27 +411,22 @@ export const ViraInput = defineViraElement<
479
411
  <div class="border-style wrapper-border"></div>
480
412
  </span>
481
413
  `;
482
-
483
414
  if (inputs.label) {
484
- return html`
415
+ return html `
485
416
  <label for=${state.randomId} ${mousedownListener}>
486
417
  <span class="input-label">${inputs.label}</span>
487
418
  ${inputTemplate}
488
419
  </label>
489
420
  `;
490
- } else {
421
+ }
422
+ else {
491
423
  return inputTemplate;
492
424
  }
493
425
  },
494
426
  });
495
-
496
- function calculateEffectiveInputType(
497
- type: ViraInputType | undefined,
498
- showPassword: boolean,
499
- ): ViraInputType {
427
+ function calculateEffectiveInputType(type, showPassword) {
500
428
  if (type === ViraInputType.Password && showPassword) {
501
429
  return ViraInputType.Default;
502
430
  }
503
-
504
431
  return type || ViraInputType.Default;
505
432
  }
@@ -0,0 +1,73 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ import { type AttributeValues, type CSSResult } from 'element-vir';
3
+ import { type SpaRoute, type SpaRouter } from 'spa-router-vir';
4
+ /**
5
+ * The route properties required for using {@link ViraLink} with a route.
6
+ *
7
+ * @category Internal
8
+ */
9
+ export type ViraLinkRoute = Readonly<{
10
+ route: SpaRoute<any, any, any>;
11
+ router: Pick<SpaRouter<any, any, any>, 'createRouteUrl' | 'setRouteOnDirectNavigation'>;
12
+ scrollToTop?: boolean;
13
+ }>;
14
+ /**
15
+ * A hyperlink wrapper element that can be configured to emit route change events rather than just
16
+ * being a raw link.
17
+ *
18
+ * @category Link
19
+ * @category Elements
20
+ * @see https://electrovir.github.io/vira/book/elements/vira-link
21
+ */
22
+ export declare const ViraLink: import("element-vir").DeclarativeElementDefinition<"vira-link", (((Required<Pick<{
23
+ /**
24
+ * A full raw URL link that will navigate the current window away or open a new tab. If this
25
+ * property is provided for the inputs, don't provide a route property.
26
+ */
27
+ link: {
28
+ url: string;
29
+ newTab: boolean;
30
+ };
31
+ /**
32
+ * A route that'll change that current page without navigating the window. If this property
33
+ * is provided for the inputs, don't provide a link property.
34
+ */
35
+ route: ViraLinkRoute;
36
+ }, "link">> & Partial<Record<"route", never>>) | (Required<Pick<{
37
+ /**
38
+ * A full raw URL link that will navigate the current window away or open a new tab. If this
39
+ * property is provided for the inputs, don't provide a route property.
40
+ */
41
+ link: {
42
+ url: string;
43
+ newTab: boolean;
44
+ };
45
+ /**
46
+ * A route that'll change that current page without navigating the window. If this property
47
+ * is provided for the inputs, don't provide a link property.
48
+ */
49
+ route: ViraLinkRoute;
50
+ }, "route">> & Partial<Record<"link", never>>)) & Omit<{
51
+ /**
52
+ * A full raw URL link that will navigate the current window away or open a new tab. If this
53
+ * property is provided for the inputs, don't provide a route property.
54
+ */
55
+ link: {
56
+ url: string;
57
+ newTab: boolean;
58
+ };
59
+ /**
60
+ * A route that'll change that current page without navigating the window. If this property
61
+ * is provided for the inputs, don't provide a link property.
62
+ */
63
+ route: ViraLinkRoute;
64
+ }, "link" | "route">) & PartialWithUndefined<{
65
+ /** Styles that will be applied directly to the inner elements. */
66
+ stylePassthrough: Readonly<PartialWithUndefined<{
67
+ a: CSSResult;
68
+ }>>;
69
+ /** Attributes that will be applied directly to the inner elements. */
70
+ attributePassthrough: Readonly<PartialWithUndefined<{
71
+ a: AttributeValues;
72
+ }>>;
73
+ }>, {}, {}, "vira-link-", "vira-link-", readonly [], readonly []>;
@@ -1,28 +1,6 @@
1
- import {type PartialWithUndefined} from '@augment-vir/common';
2
- import {
3
- attributes,
4
- css,
5
- html,
6
- ifDefined,
7
- listen,
8
- type AttributeValues,
9
- type CSSResult,
10
- } from 'element-vir';
11
- import {type SpaRoute, type SpaRouter} from 'spa-router-vir';
12
- import {type RequireExactlyOne} from 'type-fest';
13
- import {defineViraElement} from './define-vira-element.js';
14
-
15
- /**
16
- * The route properties required for using {@link ViraLink} with a route.
17
- *
18
- * @category Internal
19
- */
20
- export type ViraLinkRoute = Readonly<{
21
- route: SpaRoute<any, any, any>;
22
- router: Pick<SpaRouter<any, any, any>, 'createRouteUrl' | 'setRouteOnDirectNavigation'>;
23
- scrollToTop?: boolean;
24
- }>;
25
-
1
+ import { attributes, css, html, ifDefined, listen, } from 'element-vir';
2
+ import { viraFormCssVars } from '../styles/form-styles.js';
3
+ import { defineViraElement } from './define-vira-element.js';
26
4
  /**
27
5
  * A hyperlink wrapper element that can be configured to emit route change events rather than just
28
6
  * being a raw link.
@@ -31,34 +9,9 @@ export type ViraLinkRoute = Readonly<{
31
9
  * @category Elements
32
10
  * @see https://electrovir.github.io/vira/book/elements/vira-link
33
11
  */
34
- export const ViraLink = defineViraElement<
35
- RequireExactlyOne<{
36
- /**
37
- * A full raw URL link that will navigate the current window away or open a new tab. If this
38
- * property is provided for the inputs, don't provide a route property.
39
- */
40
- link: {
41
- url: string;
42
- newTab: boolean;
43
- };
44
- /**
45
- * A route that'll change that current page without navigating the window. If this property
46
- * is provided for the inputs, don't provide a link property.
47
- */
48
- route: ViraLinkRoute;
49
- }> &
50
- PartialWithUndefined<{
51
- /** Styles that will be applied directly to the inner elements. */
52
- stylePassthrough: Readonly<PartialWithUndefined<{a: CSSResult}>>;
53
- /** Attributes that will be applied directly to the inner elements. */
54
- attributePassthrough: Readonly<PartialWithUndefined<{a: AttributeValues}>>;
55
- }>
56
- >()({
12
+ export const ViraLink = defineViraElement()({
57
13
  tagName: 'vira-link',
58
- cssVars: {
59
- 'vira-link-hover-color': 'currentColor',
60
- },
61
- styles: ({cssVars}) => css`
14
+ styles: css `
62
15
  :host {
63
16
  display: inline;
64
17
  text-decoration: underline;
@@ -75,23 +28,21 @@ export const ViraLink = defineViraElement<
75
28
  }
76
29
 
77
30
  :host(:hover) a,
78
- a:hover,
31
+ a:hover {
32
+ color: ${viraFormCssVars['vira-form-accent-primary-color'].value};
33
+ }
34
+
79
35
  :host(:active) a,
80
36
  a:active {
81
- color: ${cssVars['vira-link-hover-color'].value};
37
+ color: ${viraFormCssVars['vira-form-accent-primary-active-color'].value};
82
38
  }
83
39
  `,
84
- render({inputs}) {
85
- function clickCallback(event: MouseEvent) {
40
+ render({ inputs }) {
41
+ function clickCallback(event) {
86
42
  if (!inputs.route) {
87
43
  return;
88
44
  }
89
-
90
- const routed = inputs.route.router.setRouteOnDirectNavigation(
91
- inputs.route.route,
92
- event,
93
- );
94
-
45
+ const routed = inputs.route.router.setRouteOnDirectNavigation(inputs.route.route, event);
95
46
  if (routed && inputs.route.scrollToTop) {
96
47
  window.scrollTo({
97
48
  left: 0,
@@ -100,10 +51,9 @@ export const ViraLink = defineViraElement<
100
51
  });
101
52
  }
102
53
  }
103
-
104
54
  if (inputs.link?.newTab) {
105
55
  /** Noopener and noreferrer are needed for security reasons, do not remove! */
106
- return html`
56
+ return html `
107
57
  <a
108
58
  href=${inputs.link.url}
109
59
  target="_blank"
@@ -114,13 +64,13 @@ export const ViraLink = defineViraElement<
114
64
  <slot></slot>
115
65
  </a>
116
66
  `;
117
- } else {
67
+ }
68
+ else {
118
69
  const linkUrl = inputs.link
119
70
  ? inputs.link.url
120
71
  : inputs.route.router.createRouteUrl(inputs.route.route);
121
-
122
72
  /** Noopener and noreferrer are needed for security reasons, do not remove! */
123
- return html`
73
+ return html `
124
74
  <a
125
75
  href=${linkUrl}
126
76
  rel="noopener noreferrer"
@@ -0,0 +1,39 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ /**
3
+ * A modal element that uses the built-in `dialog` element.
4
+ *
5
+ * @category Elements
6
+ * @see https://electrovir.github.io/vira/book/elements/vira-modal
7
+ */
8
+ export declare const ViraModal: import("element-vir").DeclarativeElementDefinition<"vira-modal", Readonly<{
9
+ open: boolean;
10
+ } & PartialWithUndefined<{
11
+ /** If this isn't set, make sure to use the modal title slot to fill it in. */
12
+ modalTitle: string;
13
+ /**
14
+ * If `true`, the following conditions trigger the modal to close:
15
+ *
16
+ * - The user clicks the "x" close button
17
+ * - The `open` input is set to `false`
18
+ *
19
+ * If set to `false` (the default), the following conditions trigger the modal to close:
20
+ *
21
+ * - The user clicks outside of the modal
22
+ * - The user presses the "Escape" key
23
+ * - The user clicks the "x" close button
24
+ * - The `open` input is set to `false`
25
+ *
26
+ * @default false
27
+ */
28
+ blockLightDismissal: boolean;
29
+ modalSubtitle: string;
30
+ isMobileSize: boolean;
31
+ }>>, {
32
+ dialogElement: HTMLDialogElement | undefined;
33
+ contentElement: HTMLDivElement | undefined;
34
+ previousOpenValue: undefined | boolean;
35
+ /** Remove listeners. */
36
+ cleanup: undefined | (() => void);
37
+ }, {
38
+ modalClose: import("element-vir").DefineEvent<void>;
39
+ }, "vira-modal-phone-size", "vira-modal-backdrop-filter", readonly ["modalTitle"], readonly []>;