@opencxh/ui-kit 3.128.0 → 3.134.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.
@@ -0,0 +1,14 @@
1
+ export interface RichTextProps {
2
+ /** Markdown of HTML; welke van de twee wordt gedetecteerd. */
3
+ text: string | null | undefined;
4
+ /** Extra classes op de wrapper (bv. `text-sm` of een line-clamp). */
5
+ className?: string;
6
+ /**
7
+ * Forceer een tak in plaats van te detecteren. Alleen nodig als je zeker
8
+ * weet wat je hebt en de heuristiek in de weg zit (bv. platte tekst die
9
+ * toevallig op een tag lijkt).
10
+ */
11
+ as?: "markdown" | "html";
12
+ }
13
+ /** Veilig gerenderde markdown-of-HTML tekst. */
14
+ export declare function RichText({ text, className, as }: RichTextProps): import("react").JSX.Element;
@@ -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[];
@@ -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
  }
@@ -41,10 +41,11 @@ export { MessageBubble, type MessageBubbleProps } from './content/MessageBubble'
41
41
  export { KpiCard, type KpiCardProps } from './content/KpiCard';
42
42
  export { PageHeader, type PageHeaderAction, type PageHeaderProps } from './content/PageHeader';
43
43
  export { PageToolbar, type PageToolbarProps } from './content/PageToolbar';
44
+ export { RichText, type RichTextProps } from './content/RichText';
44
45
  export { SectionDivider, type SectionDividerProps } from './content/SectionDivider';
45
46
  export { SettingsRow, SettingsSection, type SettingsRowProps, type SettingsSectionProps } from './content/SettingsRow';
46
47
  export { SourceChip, type SourceChipProps } from './content/SourceChip';
47
- 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';
48
49
  export { View, type ViewGroup, type ViewProps } from './content/View';
49
50
  export { SidebarMenu, type MenuItem, type MenuItemAction } from './navigation/Sidebar';
50
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.128.0",
3
+ "version": "3.134.0",
4
4
  "description": "Theme-aware UI component library for OpenCXH platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,10 @@
30
30
  "lucide-react": "^0.460.0",
31
31
  "react": "^19.2.4",
32
32
  "react-dom": "^19.2.4",
33
- "@opencxh/domain": "workspace:*"
33
+ "@opencxh/domain": "workspace:*",
34
+ "dompurify": "^3.2.6",
35
+ "react-markdown": "^10.1.0",
36
+ "remark-gfm": "^4.0.1"
34
37
  },
35
38
  "devDependencies": {
36
39
  "@types/react": "^19.1.8",
@@ -41,9 +44,9 @@
41
44
  "eslint": "^9.15.0",
42
45
  "eslint-plugin-react": "^7.37.2",
43
46
  "eslint-plugin-react-hooks": "^5.0.0",
44
- "typescript": "^5.6.3",
47
+ "typescript": "6.0.3",
45
48
  "vite": "7.1.7",
46
- "vite-plugin-dts": "^4.5.4",
49
+ "vite-plugin-dts": "^5.0.3",
47
50
  "vitest": "^2.1.8"
48
51
  },
49
52
  "peerDependencies": {