## KriUiRegistry Consumer Contract ### UI Component Selection When implementing or changing frontend UI, use this order: 1. Reuse an existing shared component in the project when it already meets the requirement. 2. Prefer an approved component from KriUiRegistry. 3. Otherwise, prefer a suitable shadcn/ui component. 4. Create a new custom component only when the preceding options cannot meet the requirement without an unsafe or misleading adaptation. ### Installation and Ownership - Inspect the registry item and its dependencies before installation. Use the shadcn CLI with the approved registry endpoint under `https://ui-registry.kric.com/r/` instead of copying files from `dist/r` manually. - `kri-data-table` uses the TanStack Table v8 API. Keep `@tanstack/react-table` within the supported `^8.21.3` range and do not upgrade it to v9 until KriUiRegistry provides an explicitly migrated component contract. - Respect the consumer project's component aliases, target paths, package manager, styling system, React version, and existing design tokens. - The shadcn workflow copies component source into the consumer repository. After installation, treat that copy as project-owned code; do not assume registry updates propagate automatically. - Do not overwrite an existing project component without reviewing the diff and confirming that local behavior and accessibility are preserved. - Keep package and lockfile changes produced by an installation within the approved scope. ### Adaptation and Verification - Adapt business data and application behavior outside the shared component when possible. Avoid embedding project-specific API, route, authentication, or environment logic into a reusable component. - Preserve the installed component's public props, accessibility, keyboard behavior, responsive layout, and loading, empty, error, and disabled states unless the task explicitly changes them. - If the registry lacks a generally reusable capability, propose it in KriUiRegistry; do not modify that repository unless it is explicitly in scope. - Run the consumer repository's focused type-check, lint, tests, and build after installation or upgrade. ### KriEditor HTML Compatibility - `enableImageMap` opt-in preserves `map`, nested `area`, and `img.usemap` HTML in WYSIWYG mode; consumers remain responsible for sanitizing URLs and attributes according to their server policy. - Use `htmlSanitizer` when a consumer must apply a stricter HTML policy than the editor's default DOMPurify profile. - Use `getWysiwygCompatibility` to keep lossy HTML in HTML mode. The callback must return `compatible: false` when WYSIWYG parsing would remove or materially rewrite content.