@opencxh/ui-kit 3.132.0 → 3.136.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.
@@ -56,6 +56,18 @@ export interface TableFilter {
56
56
  /** Whether filter is multi-select */
57
57
  multiSelect?: boolean;
58
58
  }
59
+ /**
60
+ * `TableFilter.onChange` covers every filter `type` in one signature, so a
61
+ * handler written for the type it is actually attached to does not fit it
62
+ * (parameters are contravariant). These adapters bridge that without pushing a
63
+ * cast into every call site.
64
+ *
65
+ * The fallbacks are unreachable in practice — a `type: "date"` filter only ever
66
+ * emits `Date | null`, a single `type: "select"` only ever a string — but they
67
+ * keep the coercion explicit instead of asserting it away.
68
+ */
69
+ export declare const dateFilterHandler: (fn: (value: Date | null) => void) => TableFilter["onChange"];
70
+ export declare const selectFilterHandler: (fn: (value: string) => void) => TableFilter["onChange"];
59
71
  export interface TableProps<T = any> {
60
72
  /** Table data */
61
73
  data: T[];
@@ -3,9 +3,18 @@ interface FederatedResourceProps {
3
3
  identifier: string;
4
4
  resourceLoader: () => Promise<any>;
5
5
  framework?: 'react' | 'svelte' | 'vanilla';
6
+ /** Getoond zolang de remote laadt. */
6
7
  fallback?: React.ReactNode;
8
+ /**
9
+ * Getoond wanneer de remote niet te laden is — app uitgezet, bundel stuk, sleutel fout.
10
+ *
11
+ * Zonder dit rendert dit component bij een fout niets, en dan verdwijnt de plek waar
12
+ * iets had moeten staan zonder spoor in de UI. Dat is precies het verschil tussen "de
13
+ * app is er niet" en "er is niks aan de hand".
14
+ */
15
+ errorFallback?: React.ReactNode;
7
16
  componentProps?: Record<string, any>;
8
17
  className?: string;
9
18
  }
10
- export declare function FederatedResource({ identifier, resourceLoader, framework, fallback, componentProps, className, }: FederatedResourceProps): React.JSX.Element;
19
+ export declare function FederatedResource({ identifier, resourceLoader, framework, fallback, errorFallback, componentProps, className, }: FederatedResourceProps): React.JSX.Element;
11
20
  export {};
@@ -1,9 +1,24 @@
1
1
  import { InternalSDK } from '@opencxh/domain';
2
2
  import { default as React } from 'react';
3
3
  export type FormFieldType = "text" | "email" | "password" | "number" | "tel" | "url" | "textarea" | "select" | "checkbox" | "radio" | "date" | "file" | "folder" | "custom" | "array";
4
- type NestedKeys<T> = {
5
- [K in keyof T]: T[K] extends object ? `${K & string}.${NestedKeys<T[K]>}` : K & string;
6
- }[keyof T];
4
+ /**
5
+ * `NonNullable` before the `object` test is load-bearing: form data is routinely
6
+ * a `Partial<T>`, which makes every property `X | undefined`, and
7
+ * `Address | undefined extends object` is false -- so without it every nested
8
+ * path silently disappears and only top-level keys survive.
9
+ *
10
+ * Arrays, Dates and functions are treated as leaves. Recursing into them would
11
+ * spell out every index and prototype method, and the resulting union is exactly
12
+ * the kind of size at which TypeScript gives up (see {@link FieldPath}).
13
+ *
14
+ * `T extends unknown ?` makes this distribute over unions. Without it a
15
+ * discriminated union like `OwnerScope` only contributes the keys its members
16
+ * share (`keyof (A | B)` is an intersection), so `ownerScope.teamId` is
17
+ * unspellable even though a `kind: "team"` conditional field needs exactly that.
18
+ */
19
+ type NestedKeys<T> = T extends unknown ? {
20
+ [K in keyof T]-?: NonNullable<T[K]> extends readonly unknown[] | Date | ((...args: never[]) => unknown) ? K & string : NonNullable<T[K]> extends object ? `${K & string}.${NestedKeys<NonNullable<T[K]>>}` : K & string;
21
+ }[keyof T] : never;
7
22
  /**
8
23
  * What a field may be named: any leaf path, plus any top-level key.
9
24
  *
@@ -136,8 +151,12 @@ export interface FormProps<T = Record<string, any>> {
136
151
  loading?: boolean;
137
152
  /** Additional CSS classes */
138
153
  className?: string;
139
- /** Form ref */
140
- ref?: React.RefObject<HTMLFormElement>;
154
+ /**
155
+ * Form ref. Includes `| null` because that is what React 19's
156
+ * `useRef<HTMLFormElement>(null)` produces; without it every caller has to
157
+ * cast at the call site.
158
+ */
159
+ ref?: React.RefObject<HTMLFormElement | null>;
141
160
  /** SDK instance */
142
161
  sdk?: InternalSDK<any>;
143
162
  }
@@ -45,7 +45,7 @@ export { RichText, type RichTextProps } from './content/RichText';
45
45
  export { SectionDivider, type SectionDividerProps } from './content/SectionDivider';
46
46
  export { SettingsRow, SettingsSection, type SettingsRowProps, type SettingsSectionProps } from './content/SettingsRow';
47
47
  export { SourceChip, type SourceChipProps } from './content/SourceChip';
48
- export { Table, type TableAction, type TableColumn, type TableFilter, type TableProps } from './content/Table';
48
+ export { Table, dateFilterHandler, selectFilterHandler, type TableAction, type TableColumn, type TableFilter, type TableProps } from './content/Table';
49
49
  export { View, type ViewGroup, type ViewProps } from './content/View';
50
50
  export { SidebarMenu, type MenuItem, type MenuItemAction } from './navigation/Sidebar';
51
51
  export { TabBar, Tabs, type TabItem, type TabsProps } from './navigation/Tabs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/ui-kit",
3
- "version": "3.132.0",
3
+ "version": "3.136.0",
4
4
  "description": "Theme-aware UI component library for OpenCXH platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -44,9 +44,9 @@
44
44
  "eslint": "^9.15.0",
45
45
  "eslint-plugin-react": "^7.37.2",
46
46
  "eslint-plugin-react-hooks": "^5.0.0",
47
- "typescript": "^5.6.3",
47
+ "typescript": "6.0.3",
48
48
  "vite": "7.1.7",
49
- "vite-plugin-dts": "^4.5.4",
49
+ "vite-plugin-dts": "^5.0.3",
50
50
  "vitest": "^2.1.8"
51
51
  },
52
52
  "peerDependencies": {