@rokkit/forms 1.0.0-next.149 → 1.0.0-next.151

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/forms",
3
- "version": "1.0.0-next.149",
3
+ "version": "1.0.0-next.151",
4
4
  "description": "Form building components for Rokkit applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -53,19 +53,17 @@
53
53
  }
54
54
  }
55
55
 
56
+ // Resolve new value from event based on input type
57
+ function resolveValue(event) {
58
+ if (type === 'checkbox' || type === 'radio') return event.target.checked
59
+ if (type === 'number' || type === 'range') return event.target.valueAsNumber
60
+ return event.target.value
61
+ }
62
+
56
63
  // Handle change events
57
64
  function handleChange(event) {
58
- if (type === 'checkbox' || type === 'radio') {
59
- value = event.target.checked
60
- } else if (type === 'number' || type === 'range') {
61
- value = event.target.valueAsNumber
62
- } else {
63
- value = event.target.value
64
- }
65
-
66
- if (onchange) {
67
- onchange(value)
68
- }
65
+ value = resolveValue(event)
66
+ if (onchange) onchange(value)
69
67
  }
70
68
 
71
69
  // Generate unique ID for accessibility
@@ -777,6 +777,7 @@ export class FormBuilder {
777
777
  * @returns {Set<string>}
778
778
  */
779
779
  get dirtyFields() {
780
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
780
781
  const dirty = new Set()
781
782
  this.#collectDirtyFields(this.#data, this.#initialData, '', dirty)
782
783
  return dirty