@eccenca/gui-elements

中文文档
26.2.1发布于 2026/11/02Apache-2.0TypeScriptESM + CJS近 30 天下载 4769

GUI elements based on other libraries, usable in React application, written in Typescript.

原始使用文档
文档目录12 节
  1. Usage
  2. Installation
  3. Inclusion
  4. Configuration
  5. Development
  6. Branch management
  7. Running tests
  8. Running Storybook
  9. Naming conventions
  10. Use via yalc
  11. Process for pull requests and publishing releases
  12. License

eccenca GUI elements

Collection of React elements based on Palantir BlueprintJS and IBM Carbon, used for eccenca Corporate Memory applications.

Usage

Installation

We provide a package via npmjs registry, install it by:

yarn add @eccenca/gui-elements

It could be also included as Git submodule to your projects and used via yarn link or yarn workspaces.

As long as IBM Carbon does not support TypeScript it is necessary to install @types/carbon-components-react as development dependency:

yarn add --dev @types/carbon-components-react

Inclusion

  • To include SCSS styles for all basic components add @import "~@eccenca/gui-elements/index"; into your main SCSS file.
  • To use extensions and special Corporate Memory components the include of @eccenca/gui-elements/extensions and @eccenca/gui-elements/cmem is necessary
  • To include only the default configuration add @import "~@eccenca/gui-elements/src/configuration/variables; into your SCSS file.

Configuration

All configuration variables can be set before importing the full library or the default configuration but for the main properties you should need to change only a few parameters

Colors

Since v25 we use a color palette as basic foundation for color configurations. The palette is defined in 4 sections containing various color tints, each tint includes 5 different weights from 100 (light color) to 900 (dark color).

The default palette can be overwritten if it is defined before the configuration or full library is imported to your Sass styles. The palette need to be defined entirely, we currently don't support overwriting it partly.

$eccgui-color-palette-light: (
    "identity": (
        "brand": #fae1cc #f8cd99 #f6b966 #f4a533 #f29100,
        "accent": #e5f4fb #aecfe3 #77abca #4186b2 #0a6199,
        "text": #f8f8f8 #bcbcbc #818181 #434343 #090909,
        "background": #fff #e8e8e8 #d6d6d6 #d4d4d4 #d3d3d3,
    ),
    "semantic": (
        "info": #e5f4fb #aecfe3 #77aaca #4086b2 #096199,
        "success": #e8f5e9 #b2c6b4 #7c967e #466749 #103713,
        "warning": #fff3e0 #fad2b3 #f5b287 #f0915a #eb702d,
        "danger": #fff5f6 #edbfc0 #db8989 #c95253 #b71c1c,
    ),
    "layout": (
        "yellow": #fff6d5 #f1ecb5 #e3db79 #d4c93c #c1a500,
        "purple": #f4ddf3 #c8a2d1 #9d6eb8 #71378f #480e75,
        "magenta": #ffd8e8 #f5a6c3 #e276a4 #be4c80 #59122d,
        "pink": #fde4f1 #e6b4ce #d08aae #bb5f8e #711c4d,
        "violet": #f4e3f4 #d8b0d8 #b377b3 #904490 #570057,
        "indigo": #efe4fb #b89ee0 #8f72c5 #6547aa #3b1e8f,
        "cyan": #dff9fc #86d6e5 #5abfd4 #2da9c4 #0092b3,
        "teal": #d4f2ec #a3ddd3 #6dc0b2 #479d8d #104c42,
        "lime": #cde0d6 #bce3c2 #9dcd99 #7ba66c #87b347,
        "amber": #ffe7b8 #ffe9c4 #f9cd8d #eeb757 #ef8f00,
        "vermilion": #ffd8cc #e4c4ba #b27a6b #8c4b3a #651c09,
        "grey": #f5f6f7 #b7b7b7 #808080 #484848 #1c2329,
    ),
    "extra": (
        "gold": #fff7d5 #ebd893 #dfc670 #d3b44e #c7a22b,
        "silver": #f0f0f0 #dedede #ccc #bababa #a8a8a8,
        "bronze": #fbe9db #f2d6bc #eac29d #e1af7e #d89b5f,
    ),
);

All palette colors will be transformed into CSS custom properties automatically and can be referenced by name scheme --eccgui-color-palette-{groupname}-{colortint}-{colorweight}, e.g. --eccgui-color-palette-identity-brand-100.

All other colors are based on the palette, but it is still possible to set a few special color configurations before the default values are used by importing the configuration or the full library.

  • $eccgui-color-applicationheader-text
  • $eccgui-color-applicationheader-background
  • $eccgui-color-workspace-text
  • $eccgui-color-workspace-background

Sizes

  • $eccgui-size-typo-base: size including absolute unit, currently only px is supported
  • $eccgui-size-typo-base-lineheight: only ratio to font size, no unit!
  • $eccgui-size-type-levelratio: ratio without unit! used to calculate different text sizes based on $eccgui-size-typo-base
  • $eccgui-size-block-whitespace: white space between block level elements, currently only px is supported

Development

Branch management

We have 4 types of major branches representing the current state:

  • main: contains the latest official release, only release/* branches will be merged into this branch
  • develop: contains the latest state of development, feature/*, bugfix/* and next branches will be merged into develop
  • next: development tree for an upcoming new major version, it will be merged into develop at some point, feature/*, bugfix/* and release/* branches will be merged into it
  • legacy: development tree for the predecessor of the current major version, only bugfix/* and hotfix/* branches will be merged into it

We allow a few more prefixes for valid branchnames:

  • feature/*: extend functionality
  • fix/*, bugfix/*, hotfix/*: fix functionality
  • release/*: branches to finalize releases, also used to publish release candidate packages
  • change/*, temp/*, test/*: unspecific changes, maybe only created to test something that won't end necessarily in a PR
  • maintain/*: maintain dependencies, changes created in publishing process

next and legacy only exist if necessary, otherwise we do not maintain those branches. Merges into main, develop, next and legacy are always managed by pull requests.

Running tests

Run the Jest tests with yarn test, for test coverage information run yarn test:coverage. You can check easily code for code errors by yarn compile (JS/Typescript) and yarn compile-scss (SASS).

If you run Jest tests in your app using our library you need to install @babel/plugin-transform-runtime as development dependeny and add it to your Babel plugins configuration.

Running Storybook

All story source files are kept in the respective components, extensions and cmem folders, using *.stories.tsx file name pattern. Run the storybook by

yarn install
yarn storybook

If you want to include Jest test results into the Storybook, run yarn test:generate-output before yarn storybook. If the stories and the tests share exactly the compononent name in the file names, e.g. Button.stories.tsx and Button., then tests are included automazically when the test output is available. In case the file names cannot match by pattern then test file names need to be configured in the stories:

Default.parameters = {
    jest: "MyTestFile.test.tsx",
};

Naming conventions

  • Use a *Props suffix for component interfaces.
  • Use a *Utils suffix for objects providing helper functions to compoents. Name should start with a lowercase letter.

Don't forget to export them. They need to be available via simple import from @eccenca/gui-elements.

Example: if you have your SimpleComponent then provide at least SimpleComponentProps, maybe simpleComponentUtils.

Use via yalc

If necessary you can use yalc to develop gui elements and your application side by side.

  1. Install yalc globally via npm or yarn
  2. Checkout @eccenca/gui-elements
  3. Inside gui elements folder: yarn build:all && yalc publish --push
  4. Inside your applications folder: yalc add @eccenca/gui-elements
  5. After updates to the gui elements rebuild and update the applications yalc folder: yarn build:all && yalc publish --push (you usually are not required to fire another yalc add in your applications folder)

After you tested the GUI elements package locally you can Clean up your applications folder by yalc remove --all && git checkout -- pakage.json yarn.lock.

Process for pull requests and publishing releases

  1. feature/* and bugfix/* branches are merged into develop (or next and legacy) via pull request
  2. release/*branch is created from develop (or next and legacy) via "Create: release branch", there will be created a pull request automatically
  3. Pull request from release branch into main need to be approved
    • then "Publish: final release " can be used on main (or next and legacy) to publish final release packages
    • another PR is automatically created for changes done during publishing process

License

Apache License, Version 2.0, January 2004

版本与发布记录

@eccenca/gui-elements 共发布 165 个版本,首次发布于 2018/01/24;过去 12 个月发布了 31 个版本。

版本发布日期距今
26.2.1latest2026/11/0211 天前
26.2.1-rc.02026/10/2915 天前
26.2.0-featurefileuploaduppyv5cmem5925.02026/10/131 个月前
26.2.02026/10/051 个月前
26.2.0-rc.02026/09/301 个月前
26.1.0-featureselecta11ycmem7856.12026/09/301 个月前

关于 @eccenca/gui-elements 的常见问题

@eccenca/gui-elements 是什么?

GUI elements based on other libraries, usable in React application, written in Typescript.

如何安装 @eccenca/gui-elements?

在项目目录运行 npm install @eccenca/gui-elements,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、@blueprintjs/core(>=6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@eccenca/gui-elements 支持 TypeScript 吗?

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

@eccenca/gui-elements 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eccenca/gui-elements 需要什么版本的 Node.js?

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

@eccenca/gui-elements 可以商用吗?

@eccenca/gui-elements 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eccenca/gui-elements 的下载量有多少?

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

@eccenca/gui-elements 还在维护吗?

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