noph-ui 0.10.9 → 0.10.10

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.
@@ -67,8 +67,9 @@
67
67
  <button
68
68
  {...attributes}
69
69
  class={['np-item', selected && 'selected', attributes.class]}
70
- bind:this={element}>{@render content()}</button
71
- >
70
+ bind:this={element}
71
+ >{@render content()}
72
+ </button>
72
73
  {:else if attributes.variant === 'link'}
73
74
  <a
74
75
  {...attributes}
@@ -20,6 +20,7 @@
20
20
  ...attributes
21
21
  }: TextFieldProps = $props()
22
22
 
23
+ let errorRaw: boolean = $state(error)
23
24
  let errorTextRaw: string = $state(errorText)
24
25
  $effect(() => {
25
26
  errorTextRaw = errorText
@@ -29,7 +30,7 @@
29
30
  $effect(() => {
30
31
  if (textElement) {
31
32
  textElement.form?.addEventListener('reset', () => {
32
- error = false
33
+ errorRaw = error
33
34
  value = ''
34
35
  })
35
36
  textElement.addEventListener('invalid', (event) => {
@@ -37,7 +38,7 @@
37
38
  const { currentTarget } = event as Event & {
38
39
  currentTarget: HTMLInputElement | HTMLTextAreaElement
39
40
  }
40
- error = true
41
+ errorRaw = true
41
42
  if (errorText === '') {
42
43
  errorTextRaw = currentTarget.validationMessage
43
44
  }
@@ -51,7 +52,7 @@
51
52
  currentTarget: HTMLInputElement | HTMLTextAreaElement
52
53
  }
53
54
  if (currentTarget.checkValidity()) {
54
- error = false
55
+ errorRaw = error
55
56
  errorTextRaw = errorText
56
57
  }
57
58
  })
@@ -70,7 +71,7 @@
70
71
  >
71
72
  <div
72
73
  class="field"
73
- class:error
74
+ class:error={errorRaw}
74
75
  class:resizable={attributes.type === 'textarea'}
75
76
  class:no-label={!label?.length}
76
77
  class:with-start={start}
@@ -139,7 +140,7 @@
139
140
  bind:this={textElement}
140
141
  class="input"
141
142
  {placeholder}
142
- aria-invalid={error}
143
+ aria-invalid={errorRaw}
143
144
  />
144
145
  {#if suffixText}
145
146
  <span class="suffix">
@@ -157,10 +158,10 @@
157
158
  {/if}
158
159
  </div>
159
160
  </div>
160
- {#if supportingText || (errorTextRaw && error) || attributes.maxlength}
161
- <div class="supporting-text" role={error ? 'alert' : undefined}>
161
+ {#if supportingText || (errorTextRaw && errorRaw) || attributes.maxlength}
162
+ <div class="supporting-text" role={errorRaw ? 'alert' : undefined}>
162
163
  <span>
163
- {error && errorTextRaw ? errorTextRaw : supportingText}
164
+ {errorRaw && errorTextRaw ? errorTextRaw : supportingText}
164
165
  </span>
165
166
  {#if attributes.maxlength}
166
167
  <span>{value?.length || 0}/{attributes.maxlength}</span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.10.9",
3
+ "version": "0.10.10",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {