courthive-components 3.14.1 → 3.14.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.
@@ -2,13 +2,40 @@ type CreateTypeAheadParams = {
2
2
  list: any[];
3
3
  element: HTMLInputElement;
4
4
  callback?: (value: string) => void;
5
+ /**
6
+ * A stored CODE to resolve to its display LABEL — e.g. `'FRA'` rendering as
7
+ * `'🇫🇷 France'`. Requires a `{ value, label }` list; see `resolveCurrentLabel`.
8
+ * This is NOT "the input's initial value": to set that directly, give the field
9
+ * a `value`, which `renderField` applies after this runs.
10
+ */
11
+ currentCode?: string;
12
+ /**
13
+ * @deprecated Misleading name — it never meant "the current value". Use `currentCode`.
14
+ * Still honoured so published consumers keep working.
15
+ */
5
16
  currentValue?: string;
17
+ /**
18
+ * Set false to silence the unresolved-code warning, for a caller that
19
+ * legitimately supplies a code absent from the list.
20
+ */
21
+ warnUnresolved?: boolean;
6
22
  withCatchTab?: boolean;
7
23
  onChange?: (event: Event) => void;
8
24
  onSelectComplete?: () => void;
9
25
  listProvider?: () => any[];
10
26
  };
11
- export declare function createTypeAhead({ list, element, callback, currentValue, withCatchTab, onChange, onSelectComplete, listProvider }: CreateTypeAheadParams): {
27
+ /**
28
+ * Resolve a stored code to the label that should be shown for it.
29
+ *
30
+ * Only a `{ value, label }` list can be resolved: the whole point is that what is
31
+ * stored (`'FRA'`) differs from what is read (`'🇫🇷 France'`). A list of plain
32
+ * strings has no such mapping — code and label are the same string — so it
33
+ * returns `undefined` and the caller should set the field's `value` instead.
34
+ *
35
+ * Exported for unit testing; the wiring below is the only production caller.
36
+ */
37
+ export declare function resolveCurrentLabel(list: any[], code?: string): string | undefined;
38
+ export declare function createTypeAhead({ list, element, callback, currentCode, currentValue, warnUnresolved, withCatchTab, onChange, onSelectComplete, listProvider }: CreateTypeAheadParams): {
12
39
  typeAhead: any;
13
40
  };
14
41
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "courthive-components",
3
3
  "packageManager": "pnpm@11.21.0",
4
- "version": "3.14.1",
4
+ "version": "3.14.2",
5
5
  "engines": {
6
6
  "node": ">=22"
7
7
  },