DiamondLightSource / DiamondLightSource/sci-react-ui
Change Proposal: Increment/Decrement Spinner Buttons for `NumberInput`
- 主要言語
- TypeScript
- スター
- 8
- フォーク
- 3
- 平均マージ
- 3日 15時間
- マージ済み PR(30日)
- 5
説明
## What is being proposed?
Add optional up/down spinner buttons to `NumberInput` so users can nudge a numeric value by a configurable step, instead of only being able to type a value directly.
## Why is this needed?
`NumberInput` currently only accepts typed input. For small, discrete adjustments (e.g. incrementing an integer count), typing is slower and more error-prone than a click-to-step control, which is a common affordance for numeric fields. There was previously no way to adjust the value without full keyboard entry.
## What will change?
- Behaviour: `NumberInput` can now render a vertical up/down `ButtonGroup` inside the field as an end adornment. Clicking increases/decreases the current value by step, clamped to `minValue`/`maxValue`. Buttons disable automatically at the limits.
- New props:
- `step?: number`: the increment/decrement amount, defaults to `1`.
- `spinnerButtons?: "always" | "onHover" | "never"`: controls spinner visibility. Defaults to `"onHover"` for all number modes except `"scientific"`, which defaults to `"never"` (since stepping isn't a natural operation on scientific-notation values).
- No new component: this extends the existing `NumberInput`.
## Interface changes (if any)
Additive/optional only — existing usages of NumberInput are unaffected.
```ts
```
## Breaking change?
- [ ] Yes
- [X] No
## Next steps
A maintainer will review this issue.
If accepted, it will be marked as `accepted` and a PR may then be opened.
コントリビューションガイド
調査の方向性
まず既存の NumberInput コンポーネントと、numberMode、minValue、maxValue の現在の動作を確認し、その後、すでに進行中の作業を理解するためにオープンな pull request #271 を調査します。オプションのスピナーボタンが提案された step と visibility の設定をサポートし、値を制限値の範囲内に収め、既存の使用箇所に影響を与えなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- frontend
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100