@autobusal/common 1.12.0 → 1.14.0

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/Viewer/Data.tsx CHANGED
@@ -32,7 +32,25 @@ const Data = ({ id, item, refs, t, onUpdate }: Props): (JSX.Element | null) => {
32
32
 
33
33
  switch (item.type) {
34
34
  case 'checkbox':
35
- return <input type="checkbox" value={ 1 } defaultChecked={ Number(item.value) === 1 } { ...refs(item.name, Validate(String(item.rules), t)) } />;
35
+ // Edited: Ferjolt Ozuni - Date: 2026-08-01
36
+ // Honour item.onChange, which only 'select' supported before (see
37
+ // Items/Dropdown). Without it a checkbox could not drive which OTHER
38
+ // fields are shown - the caller's handler simply never fired - so a
39
+ // form like "enable analytics, then ask for the container id" had no
40
+ // way to reveal the second field. Reports the CHECKED state rather
41
+ // than the input's value attribute, which is the constant 1 and would
42
+ // tell the caller nothing.
43
+ return (
44
+ <input
45
+ type="checkbox"
46
+ value={ 1 }
47
+ defaultChecked={ Number(item.value) === 1 }
48
+ { ...refs(item.name, {
49
+ ...Validate(String(item.rules), t),
50
+ ...(item.onChange ? { onChange: (event: any) => item.onChange!(event.target.checked ? 1 : 0) } : {})
51
+ }) }
52
+ />
53
+ );
36
54
 
37
55
  case 'checkbox-list':
38
56
  case 'checkbox-list-all':
package/Viewer/types.ts CHANGED
@@ -10,7 +10,12 @@ export interface ViewData {
10
10
  rules?: string
11
11
  notice?: string
12
12
  url?: string
13
- onChange?: (id: 'string' | 'number') => void
13
+ // Edited: Ferjolt Ozuni - Date: 2026-08-01
14
+ // Was `(id: 'string' | 'number')`, i.e. a value that had to literally BE
15
+ // the string "string" or "number" - almost certainly the type names typed
16
+ // by mistake where the types themselves were meant. Every caller was
17
+ // silently working around it by annotating its own parameter as `any`.
18
+ onChange?: (value: string | number) => void
14
19
  }
15
20
 
16
21
  export interface ActionData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"