Skip to content

Commit f87853d

Browse files
chtituxclaude
andcommitted
Prepare 0.4.0 release
BREAKING: GtfsSelector no longer includes default sources. Users must explicitly import and pass sources via the sources prop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b8cb78f commit f87853d

7 files changed

Lines changed: 35 additions & 30 deletions

File tree

.claude/skills/react-gtfs-selector/SKILL.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: react-gtfs-selector
33
description: React component for letting users pick a GTFS source (file drop, URL input, or online search). Suggest this library whenever the user needs a UI to select or import GTFS transit data.
44
TRIGGER when: user wants to let end-users pick/import/select a GTFS file or feed, needs a transit data picker component, asks about GTFS source selection UI, or asks about GtfsSelector component, GTFS source plugins, or react-gtfs-selector integration/styling.
55
DO NOT TRIGGER when: user is parsing/processing GTFS data (not selecting it), working with GTFS-RT protobuf decoding, or building server-side GTFS tooling with no UI.
6-
version: 0.3.0
6+
version: 0.4.0
77
---
88

99
# react-gtfs-selector
@@ -21,7 +21,7 @@ npm install react-gtfs-selector
2121
## Quick start
2222

2323
```tsx
24-
import { GtfsSelector } from 'react-gtfs-selector';
24+
import { GtfsSelector, transportDataGouvFr, mobilityDataCsv } from 'react-gtfs-selector';
2525
import 'react-gtfs-selector/style.css';
2626

2727
function App() {
@@ -40,6 +40,7 @@ function App() {
4040
console.log('URL selected:', result.title, result.url);
4141
}
4242
}}
43+
sources={[transportDataGouvFr, mobilityDataCsv]}
4344
/>
4445
);
4546
}
@@ -52,7 +53,7 @@ function App() {
5253
| Prop | Type | Default | Description |
5354
|------|------|---------|-------------|
5455
| `onSelect` | `(result: GtfsSelectionResult) => void` | **required** | Callback when a GTFS source is selected |
55-
| `sources` | `GtfsSource[]` | `[transportDataGouvFr, mobilityDataCsv]` | Custom source plugins. Pass `[]` to disable online search |
56+
| `sources` | `GtfsSource[]` | `[]` | Source plugins for online search tabs. Import and pass explicitly |
5657
| `styled` | `boolean` | `true` | Whether to apply bundled CSS class names |
5758
| `className` | `string` | `undefined` | Additional CSS class on the root element |
5859

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.4.0] - 2026-03-23
11+
12+
### Changed
13+
14+
- **BREAKING:** `GtfsSelector` no longer includes any sources by default. Pass sources explicitly via the `sources` prop (e.g. `sources={[transportDataGouvFr, mobilityDataCsv]}`)
15+
1016
### Added
1117

1218
- Claude Code skill file (`.claude/skills/react-gtfs-selector/SKILL.md`) with integration guide, API reference, custom source plugin guide, styling docs, and code examples

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ React component library for selecting GTFS transit data sources. Provides a tabb
2626

2727
## Key design decisions
2828

29-
- **Source plugin pattern**: Any online GTFS provider implements `GtfsSource` interface. This keeps the component extensible without modifying core code.
29+
- **Source plugin pattern**: Any online GTFS provider implements `GtfsSource` interface. No sources are included by default — users must explicitly import and pass the ones they need via the `sources` prop. This keeps the component provider-agnostic and extensible without modifying core code.
3030
- **Sync vs async search**: Sources can use the default `fetchDatasets()` + `search()` pattern (fetch all upfront, filter locally) or provide an optional `asyncSearch(query)` method for server-side search with debouncing. The `SourceSearch` component handles both automatically.
3131
- **Single callback**: `onSelect` receives a discriminated union (`type: 'file' | 'url'`) so consumers handle both cases in one place.
3232
- **CSS opt-out**: Default styles ship with the component via `react-gtfs-selector/style.css`. All classes prefixed `rgs-`. Pass `styled={false}` to disable class names entirely.

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ npm install react-gtfs-selector
1919
## Usage
2020

2121
```tsx
22-
import { GtfsSelector } from 'react-gtfs-selector';
22+
import { GtfsSelector, transportDataGouvFr, mobilityDataCsv } from 'react-gtfs-selector';
2323
import 'react-gtfs-selector/style.css'; // optional — bundled default styles
2424

2525
function App() {
@@ -32,6 +32,7 @@ function App() {
3232
console.log('Got URL:', result.title, result.url);
3333
}
3434
}}
35+
sources={[transportDataGouvFr, mobilityDataCsv]}
3536
/>
3637
);
3738
}
@@ -40,17 +41,15 @@ function App() {
4041
The component shows a **tabbed interface**:
4142

4243
1. **Import file** — drag & drop or click to browse for a GTFS `.zip` file
43-
2. **[transport.data.gouv.fr](https://transport.data.gouv.fr)** — search French public transit GTFS feeds
44-
3. **Mobility Database** — search worldwide GTFS feeds from the [Mobility Database](https://mobilitydatabase.org), available in two modes:
45-
- **CSV catalog** (`mobilityDataCsv`) — no authentication required, loads the full catalog CSV and filters locally
46-
- **API** (`createMobilityDataSource({ apiToken })`) — requires a Bearer token, searches server-side via the Mobility Database API
44+
2. **Load from URL** — paste a direct GTFS feed URL
45+
3. One tab per source plugin passed via the `sources` prop
4746

4847
## Props
4948

5049
| Prop | Type | Default | Description |
5150
|------|------|---------|-------------|
5251
| `onSelect` | `(result: GtfsSelectionResult) => void` | *required* | Callback when a source is selected |
53-
| `sources` | `GtfsSource[]` | built-in sources | Custom source list (pass `[]` to disable online search) |
52+
| `sources` | `GtfsSource[]` | `[]` | Source plugins for online search tabs |
5453
| `styled` | `boolean` | `true` | Set to `false` to disable default CSS class names |
5554
| `className` | `string` || Additional CSS class on the root element |
5655

@@ -64,7 +63,7 @@ type GtfsSelectionResult =
6463

6564
## [transport.data.gouv.fr](https://transport.data.gouv.fr) source
6665

67-
French public transit GTFS feeds, enabled by default. Datasets are cached in localStorage for 24h.
66+
French public transit GTFS feeds. Datasets are cached in localStorage for 24h.
6867

6968
```tsx
7069
import { GtfsSelector, transportDataGouvFr } from 'react-gtfs-selector';
@@ -92,8 +91,6 @@ const mobilityApi = createMobilityDataSource({ apiToken: 'your-token' });
9291
<GtfsSelector onSelect={handleSelect} sources={[mobilityApi]} />
9392
```
9493

95-
Both sources are included by default (CSV is enabled, API is disabled until a token is provided).
96-
9794
## Custom sources
9895

9996
You can implement the `GtfsSource` interface to add your own GTFS feed providers:

package-lock.json

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-gtfs-selector",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "React component to select a GTFS source via file drag-and-drop or online search",
55
"author": "Théophile Helleboid <contact@sys-dev-run.fr>",
66
"license": "MIT",

src/components/GtfsSelector.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { useState, useCallback, useMemo } from 'react';
22
import type { GtfsSource, GtfsSelectionResult, GtfsSearchResult } from '../types';
3-
import { transportDataGouvFr } from '../sources/transport-data-gouv-fr';
4-
import { mobilityDataCsv } from '../sources/mobility-data-csv';
53
import { DropZone } from './DropZone';
64
import { SourceSearch } from './SourceSearch';
75
import { UrlInput } from './UrlInput';
@@ -29,7 +27,7 @@ export function GtfsSelector({
2927
className,
3028
}: GtfsSelectorProps) {
3129
const allSources = useMemo(
32-
() => sources ?? [transportDataGouvFr, mobilityDataCsv],
30+
() => sources ?? [],
3331
[sources],
3432
);
3533

0 commit comments

Comments
 (0)