vira 25.0.1 → 25.0.2

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 { check, checkWrap } from '@augment-vir/assert';
1
2
  import { extractEventTarget } from '@augment-vir/web';
2
3
  function doesMatch({ input, matcher }) {
3
4
  if (!input || !matcher) {
@@ -61,15 +62,16 @@ export function filterTextInputValue(inputs) {
61
62
  * @category Internal
62
63
  */
63
64
  export function textInputListener({ inputs, previousValue, event, inputBlockedCallback, newValueCallback, }) {
64
- if (!(event instanceof InputEvent)) {
65
- throw new TypeError('Text input event was not an InputEvent.');
66
- }
67
65
  const inputElement = extractEventTarget(event, HTMLInputElement);
68
66
  /**
69
67
  * This is usually a single character, but can be a bunch of characters in some circumstances.
70
68
  * For example, when a bunch of characters are pasted, this will be the entire pasted contents.
69
+ *
70
+ * When a password manager auto fills the password, at least for Safari + iCloud Keychain, it'll
71
+ * fire a `CustomEvent` (rather than the typical `InputEvent`) and `event.data` won't be
72
+ * populated.
71
73
  */
72
- const changedText = event.data;
74
+ const changedText = (check.hasKey(event, 'data') && checkWrap.isString(event.data)) || '';
73
75
  /**
74
76
  * When changedText is falsy, that means an operation other than inserting characters happened.
75
77
  * Such as: deleting, cutting the text, etc.
@@ -29,17 +29,6 @@ export var ViraInputType;
29
29
  */
30
30
  export const ViraInput = defineViraElement()({
31
31
  tagName: 'vira-input',
32
- state() {
33
- return {
34
- forcedInputWidth: 0,
35
- showPassword: false,
36
- };
37
- },
38
- hostClasses: {
39
- 'vira-input-disabled': ({ inputs }) => !!inputs.disabled,
40
- 'vira-input-fit-text': ({ inputs }) => !!inputs.fitText,
41
- 'vira-input-clear-button-shown': ({ inputs }) => !!inputs.showClearButton,
42
- },
43
32
  cssVars: {
44
33
  'vira-input-background-color': 'white',
45
34
  'vira-input-placeholder-color': '#cccccc',
@@ -57,19 +46,6 @@ export const ViraInput = defineViraElement()({
57
46
  'vira-input-padding-horizontal': '10px',
58
47
  'vira-input-padding-vertical': '6px',
59
48
  },
60
- events: {
61
- /**
62
- * Fires whenever a user input created a new value. Does not fire if all input letters are
63
- * filtered out due to input restrictions.
64
- */
65
- valueChange: defineElementEvent(),
66
- /**
67
- * Fires when inputs are blocked. Useful for showing warnings or error messages to inform
68
- * the user why their input did not propagate if it was blocked. This does not fire for text
69
- * that was blocked out of programmatic "value" property assignments.
70
- */
71
- inputBlocked: defineElementEvent(),
72
- },
73
49
  styles: ({ hostClasses, cssVars }) => {
74
50
  return css `
75
51
  :host {
@@ -253,6 +229,30 @@ export const ViraInput = defineViraElement()({
253
229
  }
254
230
  `;
255
231
  },
232
+ events: {
233
+ /**
234
+ * Fires whenever a user input created a new value. Does not fire if all input letters are
235
+ * filtered out due to input restrictions.
236
+ */
237
+ valueChange: defineElementEvent(),
238
+ /**
239
+ * Fires when inputs are blocked. Useful for showing warnings or error messages to inform
240
+ * the user why their input did not propagate if it was blocked. This does not fire for text
241
+ * that was blocked out of programmatic "value" property assignments.
242
+ */
243
+ inputBlocked: defineElementEvent(),
244
+ },
245
+ state() {
246
+ return {
247
+ forcedInputWidth: 0,
248
+ showPassword: false,
249
+ };
250
+ },
251
+ hostClasses: {
252
+ 'vira-input-disabled': ({ inputs }) => !!inputs.disabled,
253
+ 'vira-input-fit-text': ({ inputs }) => !!inputs.fitText,
254
+ 'vira-input-clear-button-shown': ({ inputs }) => !!inputs.showClearButton,
255
+ },
256
256
  render: ({ inputs, dispatch, state, updateState, events }) => {
257
257
  const { filtered: filteredValue } = filterTextInputValue({
258
258
  value: inputs.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "25.0.1",
3
+ "version": "25.0.2",
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.0.1"
69
+ "element-vir": "^25.0.2"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=22"