vira 25.4.2 → 25.4.3

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.
@@ -1,3 +1,4 @@
1
+ import { assertWrap } from '@augment-vir/assert';
1
2
  import { attributes, css, defineElementEvent, html, ifDefined, listen, nothing, onResize, renderIf, } from 'element-vir';
2
3
  import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon.js';
3
4
  import { EyeClosed24Icon, EyeOpen24Icon } from '../icons/index.js';
@@ -95,7 +96,7 @@ export const ViraInput = defineViraElement()({
95
96
  max-height: 100%;
96
97
  }
97
98
 
98
- ${hostClasses['vira-input-clear-button-shown'].selector} label {
99
+ ${hostClasses['vira-input-clear-button-shown'].selector} .input-wrapper {
99
100
  padding-right: 4px;
100
101
  }
101
102
 
@@ -122,7 +123,7 @@ export const ViraInput = defineViraElement()({
122
123
  pointer-events: none;
123
124
  }
124
125
 
125
- .label-border {
126
+ .wrapper-border {
126
127
  top: -1px;
127
128
  left: -1px;
128
129
  border: 1px solid ${cssVars['vira-input-border-color'].value};
@@ -130,7 +131,7 @@ export const ViraInput = defineViraElement()({
130
131
  ${viraAnimationDurations['vira-interaction-animation-duration'].value};
131
132
  }
132
133
 
133
- label {
134
+ .input-wrapper {
134
135
  ${noNativeFormStyles};
135
136
  max-width: 100%;
136
137
  flex-grow: 1;
@@ -142,7 +143,7 @@ export const ViraInput = defineViraElement()({
142
143
  border-radius: ${viraBorders['vira-form-input-radius'].value};
143
144
  background-color: ${cssVars['vira-input-background-color'].value};
144
145
  /*
145
- Border colors are actually applied via the .label-border class. However, we must
146
+ Border colors are actually applied via the .wrapper-border class. However, we must
146
147
  apply a border here still so that it takes up space.
147
148
  */
148
149
  border: 1px solid transparent;
@@ -253,7 +254,7 @@ export const ViraInput = defineViraElement()({
253
254
  'vira-input-fit-text': ({ inputs }) => !!inputs.fitText,
254
255
  'vira-input-clear-button-shown': ({ inputs }) => !!inputs.showClearButton,
255
256
  },
256
- render: ({ inputs, dispatch, state, updateState, events }) => {
257
+ render: ({ inputs, dispatch, state, updateState, events, host }) => {
257
258
  const { filtered: filteredValue } = filterTextInputValue({
258
259
  value: inputs.value,
259
260
  allowed: inputs.allowedInputs,
@@ -275,8 +276,19 @@ export const ViraInput = defineViraElement()({
275
276
  * spellchecking).
276
277
  */
277
278
  inputs.type === ViraInputType.Password;
279
+ /**
280
+ * Don't use a wrapping `<label>` element here because it will mess with browser and
281
+ * password manager autocomplete for passwords and usernames.
282
+ */
278
283
  return html `
279
- <label>
284
+ <span
285
+ class="input-wrapper"
286
+ ${listen('mouseup', () => {
287
+ assertWrap
288
+ .instanceOf(host.shadowRoot.querySelector('input'), HTMLInputElement)
289
+ .focus();
290
+ })}
291
+ >
280
292
  ${iconTemplate}
281
293
  ${renderIf(!!inputs.fitText, html `
282
294
  <span
@@ -353,8 +365,8 @@ export const ViraInput = defineViraElement()({
353
365
  siblings of the focused <input> element.
354
366
  -->
355
367
  <div class="border-style focus-border"></div>
356
- <div class="border-style label-border"></div>
357
- </label>
368
+ <div class="border-style wrapper-border"></div>
369
+ </span>
358
370
  `;
359
371
  },
360
372
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "25.4.2",
3
+ "version": "25.4.3",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",
@@ -66,7 +66,7 @@
66
66
  "vite-tsconfig-paths": "^5.1.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "element-vir": "^25.4.2"
69
+ "element-vir": "^25.4.3"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=22"