Skip to content

Commit 5a364b9

Browse files
committed
refactor: change hook name
1 parent 87c1a60 commit 5a364b9

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Main component. Renders the full picker.
110110
| `calendar` | `boolean` | No | `true` | Show the popover calendar on the left of the header. |
111111
| `CalendarProps` | `DayPickerProps` from `react-day-picker` | No | `undefined` | Pass through props to the inner calendar (months, locale, modifiers, etc.). |
112112
| `Slots` | `Slots` | No | `{}` | Replace any visible part with your own component. |
113-
| `api` | `RangeFlowApi` | No | `undefined` | Hook returned object for external control. See `useRangeflow`. |
113+
| `api` | `RangeFlowApi` | No | `undefined` | Hook returned object for external control. See `useRangeFlow`. |
114114

115115
#### Types
116116

@@ -126,12 +126,12 @@ type DateDisabled =
126126
| { before?: Date; after: Date }
127127
```
128128
129-
### `useRangeflow()`
129+
### `useRangeFlow()`
130130
131131
Returns an imperative API object. Pass it into `<RangeFlow api={...} />` to control the picker from outside.
132132
133133
```ts
134-
const rangeflow = useRangeflow()
134+
const rangeflow = useRangeFlow()
135135

136136
rangeflow.updateRange({ from, to }) // change the window
137137
rangeflow.updateSelectedDates({ from, to }) // change the picked range
@@ -339,16 +339,16 @@ Keep the slider and tabs, drop the popover calendar.
339339
/>
340340
```
341341

342-
### 8. External controls with `useRangeflow`
342+
### 8. External controls with `useRangeFlow`
343343

344344
Drive the picker from buttons, forms, or URL params.
345345

346346
```tsx
347-
import { RangeFlow, useRangeflow } from 'rangeflow'
347+
import { RangeFlow, useRangeFlow } from 'rangeflow'
348348
import dayjs from 'dayjs'
349349

350350
export function WithControls() {
351-
const rangeflow = useRangeflow()
351+
const rangeflow = useRangeFlow()
352352

353353
return (
354354
<div>
@@ -503,12 +503,12 @@ Use these class names to style parts of the picker without touching the tokens.
503503

504504
If you are an AI tool generating code with RangeFlow, keep these facts in mind:
505505

506-
- The package is `rangeflow`. Only two named exports are public: `RangeFlow` (component) and `useRangeflow` (hook). Also a type export `RangeFlowApi`.
506+
- The package is `rangeflow`. Only two named exports are public: `RangeFlow` (component) and `useRangeFlow` (hook). Also a type export `RangeFlowApi`.
507507
- Always import the CSS file once: `import 'rangeflow/style.css'`.
508508
- `defaultRange` and `defaultSelected` are required. Both must be `{ from: Date; to: Date }`.
509509
- `defaultSelected` must fit inside `defaultRange` or the slider will clamp it.
510510
- `onChange` is required and fires with `{ from: Date; to: Date }`.
511-
- To drive the picker from outside, call `useRangeflow()` and pass the result to `<RangeFlow api={...} />`. Then use `updateRange` or `updateSelectedDates`.
511+
- To drive the picker from outside, call `useRangeFlow()` and pass the result to `<RangeFlow api={...} />`. Then use `updateRange` or `updateSelectedDates`.
512512
- Theming is CSS variable based. Set `--rangeflow-accent` on any parent to re-skin the picker.
513513
- Dark mode turns on via a `dark` class or `data-theme="dark"` on the picker or any parent.
514514
- The picker is 560px wide and 140px tall by default (`w-140 h-35` in Tailwind units).

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import dayjs from 'dayjs'
22

3-
import { RangeFlow, useRangeflow } from './package/rangeflow'
3+
import { RangeFlow, useRangeFlow } from './package/rangeflow'
44

55
function App() {
6-
const rangeflow = useRangeflow()
6+
const rangeflow = useRangeFlow()
77

88
return (
99
<div

src/package/rangeflow/hooks/use-rangeflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { RangeFlowRefs, RangeFlowStore } from '../context/root'
55
import type { DateRange, RangeFlowApi } from '../types'
66
import { createSliderValues } from '../utils/create-slider-values'
77

8-
export function useRangeflow(): RangeFlowApi {
8+
export function useRangeFlow(): RangeFlowApi {
99
const storeRef = useRef<RangeFlowStore | null>(null)
1010
const refsRef = useRef<RangeFlowRefs | null>(null)
1111

src/package/rangeflow/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { RangeFlow } from './RangeFlow'
2-
export { useRangeflow } from './hooks/use-rangeflow'
2+
export { useRangeFlow } from './hooks/use-rangeflow'
33

44
export type { RangeFlowProps, RangeFlowApi } from './types'

0 commit comments

Comments
 (0)