@digitransit-component/digitransit-component-control-panel

中文文档
11.0.5发布于 2026/11/09(AGPL-3.0 OR EUPL-1.2)ESM + CJS零依赖构建来源已验证近 30 天下载 2513

digitransit-component control-panel module

原始使用文档
文档目录7 节
  1. CtrlPanel
  2. Parameters
  3. Examples
  4. CtrlPanel.NearStopsAndRoutes
  5. Parameters
  6. Examples
  7. Installation

@digitransit-component/digitransit-component-control-panel

CtrlPanel

CtrlPanel gathers multiple components to same area (desktop-size: left or mobile-size: bottom)

Parameters

  • props Object

    • props.children node panel content (optional, default DEFAULT_CHILDREN)
    • props.position string 'left' or 'bottom'

Examples

<CtrlPanel language="fi" position="left">
   <CtrlPanel.SeparatorLine />
   <CtrlPanel.NearStopsAndRoutes
     modearray={['bus', 'tram', 'subway', 'rail', 'ferry', 'citybike']}
     language="fi"
   />
 </CtrlPanel>

CtrlPanel.NearStopsAndRoutes

Parameters

  • props Object

    • props.modeArray Array<string> Names of transport modes to show buttons for. Should be in lower case. Also defines button order

    • props.language string Language used for accessible labels

    • props.title Object Custom titles per language

    • props.alertsContext Object

      • props.alertsContext.getModesWithAlerts function Function which should return an array of transport modes that have active alerts (e.g. [BUS, SUBWAY])
      • props.alertsContext.currentTime Number Time stamp with which the returned alerts are validated with
      • props.alertsContext.feedIds Number feedIds for which the alerts are fetched for
    • props.colors Object theme color configuration

    • props.urlPrefix string URL prefix for links

Examples

const alertsContext = {
   getModesWithAlerts: () => ({}),
   currentTime: 123456789,
   feedIds: [HSL]
}
<CtrlPanel.NearStopsAndRoutes
     modeArray={['bus', 'tram', 'subway', 'rail', 'ferry', 'citybike']}
     language="fi"
     alertsContext={alertsContext}
   />

---

This module is part of the Digitransit-ui project. It is maintained in the HSLdevcom/digitransit-ui repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install @digitransit-component/digitransit-component-control-panel

版本与发布记录

@digitransit-component/digitransit-component-control-panel 共发布 94 个版本,首次发布于 2020/03/19;过去 12 个月发布了 25 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
11.0.5latest2026/11/093 天前
11.0.42026/11/048 天前
11.0.32026/10/3012 天前
11.0.22026/10/2914 天前
11.0.12026/10/2716 天前
11.0.02026/10/2320 天前

关于 @digitransit-component/digitransit-component-control-panel 的常见问题

@digitransit-component/digitransit-component-control-panel 是什么?

digitransit-component control-panel module

如何安装 @digitransit-component/digitransit-component-control-panel?

在项目目录运行 npm install @digitransit-component/digitransit-component-control-panel,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.3.1)、i18next(^22.5.1)、prop-types(^15.8.1)、@hsl-fi/sass(^1.0.0)、react-i18next(^12.3.1)、@hsl-fi/dialog(^3.1.3)、@hsl-fi/shimmer(^0.1.2)、@hsl-fi/layout-primitives(^4.9.0)、@digitransit-component/digitransit-component-icon(^5.0.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@digitransit-component/digitransit-component-control-panel 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/digitransit-component__digitransit-component-control-panel 是否存在。

@digitransit-component/digitransit-component-control-panel 支持 ESM 还是 CommonJS?

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

@digitransit-component/digitransit-component-control-panel 可以商用吗?

@digitransit-component/digitransit-component-control-panel 使用 (AGPL-3.0 OR EUPL-1.2) 许可。可在 AGPL-3.0、EUPL-1.2 中任选其一遵守。以上为概括,不构成法律意见,请以许可原文为准。

@digitransit-component/digitransit-component-control-panel 的下载量有多少?

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

@digitransit-component/digitransit-component-control-panel 还在维护吗?

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