@bloomreach/brie

中文文档
7.0.1发布于 2026/11/03TypeScriptES Module近 30 天下载 3134

Brie is a library and collection of UI components meant to be used within all the brXM frontend applications, with the ultimate goal of building a consistent user experience.

原始使用文档
文档目录11 节
  1. About
  2. Core contributors
  3. Working with brie in your local app
  4. Component development practices
  5. Development practices
  6. Testing
  7. Versioning strategy
  8. Form validation (validate-on-submit)
  9. Template form (existing pattern)
  10. Programmatic validation
  11. Button opt-in ( brie-button-group / brie-heading )

BRIE

About

Brie is a library and collection of UI components meant to be used within all the brXM frontend applications, with the ultimate goal of building a consistent user experience.

See more at BRIE Introduction storybook for general information.

Core contributors

Working with brie in your local app

When working on an application you will likely find yourself in the situation where you need to also make changes to a brie component. There are two ways to test local changes made to the library.

The simplest option is make your changes in the component and test them via the existing Storybook integration. This is best suited for testing the component API and other basic interactions.

Another way to test changes is to test the component directly within the context where it is being used, for example as part of one of the existing FE applications. This is possible out of the box since the brie project folder is mapped to the dependency within the FE application. This is configured via lerna or yalc.

Component development practices

Please read this section before contributing to the library. Any addition to the library must adhere to these practices for consistency, readability and maintainability reasons.

Development practices

// TO BE ADDED

Testing

When adding changes for any component part of the library it is mandatory to have them covered by tests. These tests need to be meaningful and developed with extensive coverage in mind. By their nature components will be used in a wide variety of scenarios and so extensive coverage is crucial in order to avoid unpredictable results.

As a rule of thumb, use the followings testing practices:

  • Snapshot testing
    • Prefer snapshot testing over unit testing because it allows you to reduce the time spent writing often large amounts of testing boilerplate code
  • Unit testing
  • No integration testing
    • Do not test components interacting with each other, this should be tested within the application that implements the interaction

What should be covered by tests?

  • Snapshots of the final rendered component in the various meaningful states
  • Component class methods
    • If a method has a single branch then they are usually already covered by snapshot tests
  • Asynchronous events
    • click, hover, blur, etc.
    • promises

Versioning strategy

// TO BE ADDED

Form validation (validate-on-submit)

BRIE provides optional helpers for the enable-on-change + validate-on-submit pattern. All APIs are opt-in; existing consumers are unaffected.

Template form (existing pattern)

<form [formGroup]="group" brieShowErrorsOnSubmit [brieFocusFirstError]="true" (ngSubmit)="onSubmit()">
  <brie-form [group]="group" [dataSource]="fields"></brie-form>
  <button mat-flat-button type="submit">Save</button>
</form>

Programmatic validation

Inject BrieFormValidationService from @bloomreach/brie/form:

save(): void {
  const result = this.validationService.showValidationErrors(this.form, {
    focusFirstError: true,
    focusRoot: this.formElement.nativeElement,
  });
  if (!result.valid) {
    return;
  }
  // proceed with save...
}

Button opt-in (brie-button-group / brie-heading)

{
  id: 'button-save',
  text: 'Save',
  isDisabled: () => !this.form?.dirty,
  validateBeforeAction: true,
  validateForm: () => this.form,
  validateFormOptions: { focusFirstError: true, focusRoot: this.formElement.nativeElement },
  action: () => this.save(),
}

Legacy pattern (isDisabled: () => this.form.invalid without validateBeforeAction) continues to work unchanged.

See Storybook stories LegacyDisabledUntilValid and ValidateBeforeAction under Components/Button Group.


Copyright 2022 Bloomreach. All rights reserved.

版本与发布记录

@bloomreach/brie 共发布 185 个版本,首次发布于 2022/01/10;过去 12 个月发布了 46 个版本。

版本发布日期距今
7.0.1latest2026/11/035 天前
6.2.22026/11/035 天前
6.2.2-alpha.52026/10/2613 天前
7.0.1-alpha.62026/10/2316 天前
7.0.1-alpha.52026/10/2316 天前
6.2.2-alpha.42026/10/1722 天前

其他发布通道:brie-123 → 2.0.4-alpha.2,brie-120 → 2.0.5-alpha.1,BRIE-125 → 3.0.0-alpha.2,BRIE-128 → 2.0.9-alpha.0,alpha → 3.0.1-alpha.1,BRIE-129-v2 → 2.0.10-alpha.1。

关于 @bloomreach/brie 的常见问题

@bloomreach/brie 是什么?

Brie is a library and collection of UI components meant to be used within all the brXM frontend applications, with the ultimate goal of building a consistent user experience.

如何安装 @bloomreach/brie?

在项目目录运行 npm install @bloomreach/brie,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/cdk(^22.1.0)、@angular/core(^22.1.0)、@angular/forms(^22.1.0)、@angular/common(^22.1.0)、@angular/material(^22.1.0)、@bloomreach/banana-theme(0.0.28)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bloomreach/brie 支持 TypeScript 吗?

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

@bloomreach/brie 支持 ESM 还是 CommonJS?

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

@bloomreach/brie 可以商用吗?

@bloomreach/brie 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@bloomreach/brie 的下载量有多少?

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

@bloomreach/brie 还在维护吗?

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