@foodpilot/foods

中文文档
2.34.0发布于 2026/11/13TypeScriptES Module近 30 天下载 5660
foods_logo_banner_clean-min
原始使用文档
文档目录3 节
  1. Use foods
  2. Storybook
  3. Contribute
foods_logo_banner_clean-min

foods

@foodpilot/foods is FoodPilot's design system for React: the MUI-based components, tenant themes and charts of platform-app.

Use foods

npm install @foodpilot/foods

Peer dependencies:

  • always: react and react-dom 18 or 19, @mui/material ^6.4, @emotion/react and @emotion/styled ^11.14, i18next, react-i18next and lodash;
  • only for the components that use them: @mui/icons-material, @mui/lab, the @mui/x-* packages, recharts and material-react-table.
import { FoodsThemeProvider } from "@foodpilot/foods/themes";
import { Button } from "@foodpilot/foods/Button";

<FoodsThemeProvider theme="foodpilot">
    {/* "foodpilot" | "winepilot" | "collective" */}
    <App />
</FoodsThemeProvider>;

Every export is named, from the root entry or a component entry: see IMPORT_EXAMPLES.md. Style with the theme tokens (palette, 8 px spacing, typography variants, shadows), never raw values. Components translate their texts with react-i18next, the English strings being the keys; the application provides the translations.

Storybook

npm run storybook serves it on port 6006, npm run build-storybook builds it into storybook-static/. The demo.yml workflow deploys it after every release.

SectionWhat it holdsFolder
Getting StartedWelcome, and the guides for designers, product and developerssrc/getting-started/
ComponentsThe components to use, by Figma Design System page: Actions, Avatar and user, Content, Data display, Feedbacks, Inputs, Modals, Navigationsrc/components/<Category>/
ElementsThe foundations: colours, typography, spacing, shadows, breakpoints, iconssrc/elements/
LayoutPage layoutssrc/layout/
PreviewComponents still being built or redesignedsrc/preview/
LegacyComponents removed from the Figma Design System, kept for the screens that use themsrc/legacy/<Category>/
DeprecatedDeliberate deprecationssrc/deprecated/<Category>/

Each component has an Overview page (src/docs/DocsPage.tsx) with:

  • its match with the Figma design (the doc status of its Figma frame) and the day its usage guidelines were copied from Figma;
  • its description;
  • the usage guidelines from Figma: do's and don'ts, anatomy, behaviour, content and states, or No usage guidelines yet;
  • every story;
  • the props (Component API);
  • its references.

In Storybook:

  • each story has controls, logs its callbacks in Actions and plays its main interaction in Interactions;
  • the toolbar switches the tenant theme (FoodPilot, WinePilot, Positive), the background and the viewport;
  • the texts are in English.

Contribute

AGENTS.md holds the rules for any change. In short:

  • Stories: a component's stories go in src/components/<Category>/<Component>.stories.tsx, without a title, since the folder decides the sidebar, and their meta starts with a stable id, the file name in lower case, so the URLs survive a move. Their texts are in English, with fitting controls, fn() callbacks and a play function. Usage guidelines come from Figma, in parameters.guidelines, with the Figma doc status and the syncedAt day.

  • llms.txt: when a component or its stories are added, moved or removed, run npm run llms and commit llms.txt. CI fails when it is stale.

  • Legacy: a component's stories move to src/legacy/ with git mv once it is removed from the Figma Design System, then llms.txt is refreshed. The platform-design skill of the frontend harness reports the stories platform-app no longer imports; that alone does not move them.

  • Checks:

    • npm run prettier, npm run lint, npm run tsc;
    • npm test, which includes the stories' plays and the llms.txt check;
    • npm run build, npm run depcruise:check.

    CI is described in docs/ci.md, size budgets in BUNDLE_ANALYSIS.md.

  • Releases: npm run publish:patch|minor|major dispatches the release workflow from main. platform-app gets a change after that release and its own dependency update.

版本与发布记录

@foodpilot/foods 共发布 495 个版本,首次发布于 2024/01/10;过去 12 个月发布了 120 个版本。

版本发布日期距今
2.34.0latest2026/11/132 天前
2.33.02026/11/133 天前
2.32.12026/11/123 天前
2.32.02026/11/123 天前
2.31.02026/11/123 天前
2.30.02026/11/114 天前

关于 @foodpilot/foods 的常见问题

如何安装 @foodpilot/foods?

在项目目录运行 npm install @foodpilot/foods,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)、lodash(^4.18.1)、i18next(^23.0.0 || ^25.0.0)、react-dom(^18.0.0 || ^19.0.0)、@mui/material(^6.4.0)、react-i18next(^16.5.4)、@emotion/react(^11.14.0)、@emotion/styled(^11.14.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@foodpilot/foods 支持 TypeScript 吗?

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

@foodpilot/foods 支持 ESM 还是 CommonJS?

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

@foodpilot/foods 可以商用吗?

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

@foodpilot/foods 的下载量有多少?

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

@foodpilot/foods 还在维护吗?

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