@alfadocs/ui-kit-debug

中文文档
1.116.0发布于 2026/11/05BUSL-1.1TypeScriptES Module近 30 天下载 7787

AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe. (debug build — identical runtime to @alfadocs/ui-kit, ships source maps for symbolication).

原始使用文档
文档目录11 节
  1. Install
  2. Source maps (optional)
  3. Troubleshooting
  4. npm install fails with ETARGET No matching version found fo…
  5. Usage
  6. Tokens
  7. Components
  8. i18n
  9. Host integration
  10. Peer dependencies
  11. License

@alfadocs/ui-kit

The AlfaDocs design system — React components, tokens, and translations.

Released. Breaking changes land in majors and are called out in CHANGELOG.md.

Install

npm install @alfadocs/ui-kit

Requires React 18+ and Node ≥ 22.6.

Source maps (optional)

The default @alfadocs/ui-kit tarball ships without .map files to keep installs small (4.6 MB tarball / 17.3 MB unpacked, against 9.5 MB / 36.8 MB for the debug build). Browsers only request source maps on demand when devtools is open, so end-users don't pay this cost regardless.

If you need symbolicated stack traces (Sentry / Rollbar uploads, in-browser debugging of kit internals), install the -debug sibling instead. Both packages are runtime-identical and version-locked:

// package.json — alias-install so imports still resolve as @alfadocs/ui-kit.
// Pin the exact version you already have installed, not a range: maps from a
// different release point at lines that have moved.
"@alfadocs/ui-kit": "npm:@alfadocs/[email protected]"

Or as a separate dev-only dep if your error reporter accepts maps from a sibling package.

Never commit the alias — it rewrites the lockfile, so npm ci would pull the debug build into production images. See Storybook → "30. Debugging — Source Maps and the Debug Package" for the full guide.

Troubleshooting

npm install fails with ETARGET No matching version found for @alfadocs/ui-kit@<x.y.z> — even though the version exists on npmjs.org

This almost always means your ~/.npmrc (or a project-level .npmrc) has a stale @alfadocs:registry= line pointing somewhere other than https://registry.npmjs.org/. @alfadocs/ui-kit is published exclusively to public npmjs.org from 0.1.0 onwards; the @alfadocs scope on GitHub Packages only contains legacy 0.0.x builds and is not maintained.

Earlier 0.1.x bumps inside the same checkout can mask this — npm reuses the resolved tarball URL from package-lock.json and never re-consults the scope mapping. The first fresh resolve (a new minor, a clean checkout, a rm -rf node_modules) is when the dead end surfaces.

Fix. Open ~/.npmrc and remove any @alfadocs:registry=… line — or set it to the npm default, which is redundant but harmless:

@alfadocs:registry=https://registry.npmjs.org/

Then re-run npm install.

One-shot workaround (if you can't edit your .npmrc right now):

npm install --@alfadocs:registry=https://registry.npmjs.org

Usage

Tokens

Import the design tokens once at your app root so the CSS custom properties are available everywhere:

import '@alfadocs/ui-kit/tokens';

This full stylesheet includes all four third-party bridges. For an app that uses only part of the kit, choose core and add the bridges its components need:

import '@alfadocs/ui-kit/styles/core.css';
import '@alfadocs/ui-kit/styles/ag-grid.css'; // DataTable
Add after coreComponents and patterns that need it
@alfadocs/ui-kit/styles/ag-grid.cssDataTable, PatientTable, FileManager (list view), Heatmap's "View as table", and the calendar pattern's sheets
@alfadocs/ui-kit/styles/redactor.cssRichTextEditor with the host's Redactor runtime, NotesPanel, help-me-write-templates
@alfadocs/ui-kit/styles/fullcalendar.cssCalendar, CalendarWorkspace and the calendar patterns
@alfadocs/ui-kit/styles/apexcharts.cssChart, Sparkline, and the anamnesis indicators, compare panel and evolution grid

Anything else that renders one of these components needs the same bridge.

Choose either tokens or core plus the required bridges. Core keeps all tokens, themes, base rules, component utilities and kit font declarations. Date pickers and booking components need no bridge. Vendor JavaScript and optional peer dependencies are still installed or supplied as before. Load core first so it establishes the CSS layer order. If copying built stylesheets, keep them beside the fonts/ directory, as with tokens.css.

Then apply a theme class on the root element:

<html class="theme-light">
  <!-- or theme-dark, optionally combined with theme-accessible -->
</html>

Components

Each component is also available as its own subpath import for narrower bundles:

import { Button } from '@alfadocs/ui-kit/button';
import { Card } from '@alfadocs/ui-kit/card';

export function Example() {
  return (
    <Card>
      <Card.Body>
        <Button intent="primary">Save</Button>
      </Card.Body>
    </Card>
  );
}

Or import everything from the root entry:

import { Button, Card } from '@alfadocs/ui-kit';

i18n

The kit ships with react-i18next pre-configured and locale bundles in dist/locales/:

import i18n from '@alfadocs/ui-kit/i18n';
import en from '@alfadocs/ui-kit/locales/en.json';

i18n.addResourceBundle('en', 'ui', en);

Host integration

The kit's dismissable primitives — Dialog, Popover, DropdownMenu, Tooltip, Select, ContextMenu, NavigationMenu, AlertDialog — all build on Radix's @radix-ui/react-dismissable-layer, which attaches a bubble-phase pointerdown listener on document to detect outside clicks. Consuming applications must not register a capture-phase document (or body) listener that calls event.stopPropagation() on pointerdown / mousedown / click — capture-phase consumers run BEFORE Radix's detector and starve it, leaving overlays stuck open.

// Will break every dismissable primitive in the kit
document.addEventListener('pointerdown', (e) => e.stopPropagation(), true);

If a legacy script must intercept pointer events at document level (jQuery plugins, Bootstrap modals, in-house global menu handlers, etc.):

  • Scope the listener to a specific container instead of document / body.
  • Drop the useCapture: true flag — bubble-phase listeners fire AFTER Radix and don't interfere.
  • Drop the stopPropagation() call entirely if it isn't load-bearing.

Each dismissable component's Storybook page carries a WithHostInterference story that reproduces the failure mode for diagnosis.

Peer dependencies

react, react-dom, react-i18next, i18next. Tailwind CSS is not required to consume the kit — components ship pre-styled, and the tokens stylesheet exposes CSS custom properties you can reference from your own styles.

License

Business Source License 1.1 — production use is permitted; offering the Licensed Work, or a substantial portion of it, as a competing hosted, embedded, or rebranded design-system or component-library product is not. The Licensed Work converts to the Apache License 2.0 on the Change Date specified in the LICENSE.

For commercial licensing arrangements outside the BUSL grant, contact AlfaDocs GmbH.

版本与发布记录

@alfadocs/ui-kit-debug 共发布 340 个版本,首次发布于 2026/05/11;过去 12 个月发布了 340 个版本。

版本发布日期距今
1.116.0latest2026/11/051 天前
1.115.02026/11/051 天前
1.114.02026/11/051 天前
1.113.02026/11/051 天前
1.112.22026/11/041 天前
1.112.12026/11/032 天前

其他发布通道:calendar-preview → 1.25.1-calendar.18。

关于 @alfadocs/ui-kit-debug 的常见问题

@alfadocs/ui-kit-debug 是什么?

AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe. (debug build — identical runtime to @alfadocs/ui-kit, ships source maps for symbolication).

如何安装 @alfadocs/ui-kit-debug?

在项目目录运行 npm install @alfadocs/ui-kit-debug,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.2.0 || ^19.0.0)、i18next(^26.0.4)、react-dom(^18.2.0 || ^19.0.0)、react-i18next(^17.0.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@alfadocs/ui-kit-debug 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@alfadocs/ui-kit-debug 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@alfadocs/ui-kit-debug 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.6.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@alfadocs/ui-kit-debug 可以商用吗?

@alfadocs/ui-kit-debug 使用 BUSL-1.1 许可。声明的许可为 BUSL-1.1,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@alfadocs/ui-kit-debug 的下载量有多少?

根据 npm 官方下载统计,@alfadocs/ui-kit-debug 在 2026/10/06 – 2026/11/04 这 30 天内被下载 7,787 次,日均约 260 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alfadocs/ui-kit-debug 还在维护吗?

最新版本 1.116.0 发布于 2026/11/05(1 天前);至今共发布 340 个版本,其中过去 12 个月发布了 340 个;首次发布于 2026/05/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。