@opencxh/ui-kit 3.177.0 → 3.179.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.
@@ -72,4 +72,4 @@ export { type CatTone, catTone } from './utils/catTone';
72
72
  export { cn, createSizes, createVariants } from './utils/cn';
73
73
  export { IDENTITY_TONE_COUNT, type IdentityTone, identityDotClass, identityPlateClass, identityTone, } from './utils/identity';
74
74
  export { normalizeText, text } from './utils/text';
75
- export { type AnchoredPositionOptions, useAnchoredPosition, } from './utils/useAnchoredPosition';
75
+ export { type AnchoredPositionOptions, type AnchorRect, useAnchoredPosition, } from './utils/useAnchoredPosition';
@@ -10,8 +10,14 @@ export interface MentionPerson {
10
10
  export interface MentionComposerProps {
11
11
  /** Seed HTML, sanitised before it lands. Mention chips survive if they carry `data-mention-id`. */
12
12
  initialContent?: string;
13
- /** Plain text plus the ids of the chips still standing in it. */
14
- onChange: (plainText: string, mentionIds: string[]) => void;
13
+ /**
14
+ * Plain text, the ids of the chips still standing in it, and the sanitised HTML.
15
+ *
16
+ * Persist the HTML next to the text, never instead of it: everything that reads a comment
17
+ * without rendering it — an AI prompt, a search index, a notification, the native app —
18
+ * wants the plain text, and only the surface that draws chips wants the markup.
19
+ */
20
+ onChange: (plainText: string, mentionIds: string[], html: string) => void;
15
21
  people: MentionPerson[];
16
22
  placeholder?: string;
17
23
  /** Cmd/Ctrl+Enter. Omitted means the shortcut does nothing. */
@@ -0,0 +1,20 @@
1
+ /**
2
+ * How a mention chip looks, as descendant utilities.
3
+ *
4
+ * **The chip element itself carries no `class`** — only `data-mention-id`. Comment HTML is
5
+ * persisted, and class names baked into stored markup would freeze today's design tokens in
6
+ * the database: a token rename would leave every old comment styled by a class that no longer
7
+ * exists. The attribute is the contract, the styling is applied by whoever renders it.
8
+ *
9
+ * Used by both ends: the composer (so a chip looks the same while you type) and `RichText`
10
+ * (so it still looks the same once posted).
11
+ */
12
+ /**
13
+ * `info-soft`, not the `beta-container` the chip used to carry: that one is a hand-written
14
+ * rule in `global.css`, not an `@theme` token, so Tailwind can generate `.bg-beta-container`
15
+ * but not the `[&_…]:bg-beta-container` **variant** this needs. Verified against a compile:
16
+ * both tokens here resolve, and the chip would otherwise have been silently unstyled.
17
+ */
18
+ export declare const MENTION_CHIP_CLASSES: string;
19
+ /** DOMPurify must keep the marker attribute, or a sanitised chip is just text. */
20
+ export declare const MENTION_SANITIZE_ATTR = "data-mention-id";
@@ -1,4 +1,11 @@
1
1
  import { CSSProperties, RefObject } from 'react';
2
+ /**
3
+ * Anything that can report where it is. An element is the usual anchor, but a DOM `Range`
4
+ * qualifies too — which is how a panel anchors to the caret instead of to its whole field.
5
+ */
6
+ export interface AnchorRect {
7
+ getBoundingClientRect(): DOMRect;
8
+ }
2
9
  export interface AnchoredPositionOptions {
3
10
  /** Gap between the anchor and the panel, in px. */
4
11
  gap?: number;
@@ -19,4 +26,4 @@ export interface AnchoredPositionOptions {
19
26
  * Recomputes on scroll and resize while open, so the panel tracks its trigger
20
27
  * instead of detaching when the page moves under it.
21
28
  */
22
- export declare function useAnchoredPosition(open: boolean, anchorRef: RefObject<HTMLElement | null>, { gap, matchWidth, placement }?: AnchoredPositionOptions): CSSProperties;
29
+ export declare function useAnchoredPosition(open: boolean, anchorRef: RefObject<AnchorRect | null>, { gap, matchWidth, placement }?: AnchoredPositionOptions): CSSProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/ui-kit",
3
- "version": "3.177.0",
3
+ "version": "3.179.0",
4
4
  "description": "Theme-aware UI component library for OpenCXH platform",
5
5
  "type": "module",
6
6
  "exports": {