vira 25.3.1 → 25.4.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.
@@ -1,6 +1,6 @@
1
1
  import { assert } from '@augment-vir/assert';
2
2
  import { NavController } from 'device-navigation';
3
- import { classMap, css, defineElementEvent, html, ifDefined, listen, renderIf, testId, } from 'element-vir';
3
+ import { classMap, css, defineElementEvent, html, ifDefined, listen, nothing, renderIf, testId, } from 'element-vir';
4
4
  import { ChevronUp24Icon } from '../../icons/index.js';
5
5
  import { viraBorders } from '../../styles/border.js';
6
6
  import { createFocusStyles, viraFocusCssVars } from '../../styles/focus.js';
@@ -227,7 +227,7 @@ export const ViraDropdown = defineViraElement()({
227
227
  ${testId(viraDropdownTestIds.icon)}
228
228
  ></${ViraIcon}>
229
229
  `
230
- : '';
230
+ : nothing;
231
231
  const positionerStyles = state.showPopUpResult
232
232
  ? state.showPopUpResult.popDown
233
233
  ? /** Dropdown going down position. */
@@ -249,7 +249,7 @@ export const ViraDropdown = defineViraElement()({
249
249
  ${inputs.selectionPrefix}
250
250
  </span>
251
251
  `
252
- : '';
252
+ : nothing;
253
253
  const selectionDisplay = shouldUsePlaceholder
254
254
  ? inputs.placeholder || ''
255
255
  : selectedOptions.map((item) => item.label).join(', ');
@@ -1,3 +1,4 @@
1
+ import { type AttributeValues } from 'element-vir';
1
2
  /**
2
3
  * Inputs shared between the multiple input elements.
3
4
  *
@@ -23,6 +24,8 @@ export type SharedTextInputElementInputs = {
23
24
  disableBrowserHelps?: boolean;
24
25
  /** Set this to true to make the whole element size to only fit the input text. */
25
26
  fitText?: boolean;
27
+ /** A set of attributes that will be applied to the inner native text element. */
28
+ attributePassthrough?: AttributeValues | undefined;
26
29
  };
27
30
  /**
28
31
  * Inputs used to check if the current input element value is allowed.
@@ -1,4 +1,4 @@
1
- import { css, html } from 'element-vir';
1
+ import { css, html, nothing } from 'element-vir';
2
2
  import { viraBorders } from '../styles/border.js';
3
3
  import { viraDisabledStyles } from '../styles/disabled.js';
4
4
  import { viraAnimationDurations } from '../styles/durations.js';
@@ -114,12 +114,12 @@ export const ViraButton = defineViraElement()({
114
114
  icon: inputs.icon,
115
115
  })}></${ViraIcon}>
116
116
  `
117
- : '';
117
+ : nothing;
118
118
  const textTemplate = inputs.text
119
119
  ? html `
120
120
  <span class="text-template">${inputs.text}</span>
121
121
  `
122
- : '';
122
+ : nothing;
123
123
  return html `
124
124
  <button ?disabled=${inputs.disabled}>${iconTemplate} ${textTemplate}</button>
125
125
  `;
@@ -1,4 +1,4 @@
1
- import { css, defineElementEvent, html, listen, onResize, renderIf, } from 'element-vir';
1
+ import { attributes, css, defineElementEvent, html, ifDefined, listen, nothing, onResize, renderIf, } from 'element-vir';
2
2
  import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon.js';
3
3
  import { EyeClosed24Icon, EyeOpen24Icon } from '../icons/index.js';
4
4
  import { createFocusStyles, viraFocusCssVars } from '../styles/focus.js';
@@ -263,12 +263,12 @@ export const ViraInput = defineViraElement()({
263
263
  ? html `
264
264
  <${ViraIcon.assign({ icon: inputs.icon })} class="left-side-icon"></${ViraIcon}>
265
265
  `
266
- : '';
266
+ : nothing;
267
267
  const forcedInputWidthStyles = inputs.fitText
268
268
  ? css `
269
269
  width: ${state.forcedInputWidth}px;
270
270
  `
271
- : '';
271
+ : nothing;
272
272
  const shouldBlockBrowserHelps = inputs.disableBrowserHelps ||
273
273
  /**
274
274
  * Some browsers leaks passwords with their browser helps (like Chrome with
@@ -285,16 +285,16 @@ export const ViraInput = defineViraElement()({
285
285
  updateState({ forcedInputWidth: contentRect.width });
286
286
  })}
287
287
  >
288
- <pre>${filteredValue || inputs.placeholder || ''}</pre>
288
+ <pre>${filteredValue || inputs.placeholder || nothing}</pre>
289
289
  </span>
290
290
  `)}
291
291
  <input
292
292
  type=${calculateEffectiveInputType(inputs.type, state.showPassword)}
293
293
  style=${forcedInputWidthStyles}
294
- autocomplete=${shouldBlockBrowserHelps ? 'off' : ''}
295
- autocorrect=${shouldBlockBrowserHelps ? 'off' : ''}
296
- autocapitalize=${shouldBlockBrowserHelps ? 'off' : ''}
297
- spellcheck=${shouldBlockBrowserHelps ? 'false' : ''}
294
+ autocomplete=${ifDefined(shouldBlockBrowserHelps ? 'off' : undefined)}
295
+ autocorrect=${ifDefined(shouldBlockBrowserHelps ? 'off' : undefined)}
296
+ autocapitalize=${ifDefined(shouldBlockBrowserHelps ? 'off' : undefined)}
297
+ spellcheck=${ifDefined(shouldBlockBrowserHelps ? 'false' : undefined)}
298
298
  ?disabled=${inputs.disabled}
299
299
  .value=${filteredValue}
300
300
  ${listen('input', (event) => {
@@ -311,6 +311,9 @@ export const ViraInput = defineViraElement()({
311
311
  });
312
312
  })}
313
313
  placeholder=${inputs.placeholder}
314
+ ${inputs.attributePassthrough
315
+ ? attributes(inputs.attributePassthrough)
316
+ : nothing}
314
317
  />
315
318
  ${renderIf(!!(inputs.showClearButton && inputs.value), html `
316
319
  <button
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "25.3.1",
3
+ "version": "25.4.1",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",
@@ -37,23 +37,23 @@
37
37
  "test:docs": "virmator docs check"
38
38
  },
39
39
  "dependencies": {
40
- "@augment-vir/assert": "^31.18.0",
41
- "@augment-vir/common": "^31.18.0",
42
- "@augment-vir/web": "^31.18.0",
40
+ "@augment-vir/assert": "^31.20.0",
41
+ "@augment-vir/common": "^31.20.0",
42
+ "@augment-vir/web": "^31.20.0",
43
43
  "colorjs.io": "^0.5.2",
44
44
  "date-vir": "^7.3.1",
45
- "device-navigation": "^4.1.2",
45
+ "device-navigation": "^4.4.0",
46
46
  "lit-css-vars": "^3.0.11",
47
47
  "observavir": "^2.0.5",
48
48
  "page-active": "^1.0.1",
49
49
  "spa-router-vir": "^5.3.1",
50
50
  "type-fest": "^4.41.0",
51
- "typed-event-target": "^4.0.4"
51
+ "typed-event-target": "^4.1.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@augment-vir/test": "^31.18.0",
54
+ "@augment-vir/test": "^31.20.0",
55
55
  "@web/dev-server-esbuild": "^1.0.4",
56
- "@web/test-runner": "^0.20.1",
56
+ "@web/test-runner": "^0.20.2",
57
57
  "@web/test-runner-commands": "^0.9.0",
58
58
  "@web/test-runner-playwright": "^0.11.0",
59
59
  "@web/test-runner-visual-regression": "^0.10.0",
@@ -66,7 +66,7 @@
66
66
  "vite-tsconfig-paths": "^5.1.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "element-vir": "^25.3.1"
69
+ "element-vir": "^25.4.1"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=22"