Skip to content

Commit

Permalink
fix: export DateRangePickerValue
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptammergard committed Jun 20, 2023
1 parent b1f8f3f commit 337404e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-trains-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@einride/ui-dates": patch
---

Export DateRangePickerValue type.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export interface DateRangePicker {
maxDate?: Date

/** Called when date changes. */
onChange?: (value: RangeCalendarValue) => void
onChange?: (value: DateRangePickerValue) => void

/** Selected date, required with controlled input. */
value?: RangeCalendarValue
value?: DateRangePickerValue

/** Props passed to root element. */
wrapperProps?: ComponentPropsWithoutRef<typeof Box>
Expand All @@ -42,7 +42,7 @@ export const DateRangePicker = ({ wrapperProps, ...props }: DateRangePicker): Re
)
}

type RangeCalendarValue = [Date | null, Date | null]
export type DateRangePickerValue = [Date | null, Date | null]

const StyledDatePicker = styled(DatePicker)`
&.mantine-DatePicker-calendar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { userEvent, within } from "@storybook/testing-library"
import { DateTime } from "luxon"
import { ComponentProps, useState } from "react"
import { SnapshotWrapper } from "../../lib/storybook/SnapshotWrapper"
import { DateRangePickerInput, DateRangePickerValue } from "./DateRangePickerInput"
import { DateRangePickerValue } from "../DateRangePicker/DateRangePicker"
import { DateRangePickerInput } from "./DateRangePickerInput"

const meta = {
component: DateRangePickerInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const getMessageColor = (status: Status | undefined): ContentColor => {
}
}

export type DateRangePickerValue = [Date | null, Date | null]
type DateRangePickerValue = [Date | null, Date | null]

interface StyledDateRangePickerProps {
/** Whether to allow clearing value or not. Default is `false`. */
Expand Down
5 changes: 4 additions & 1 deletion packages/einride-ui-dates/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export { DatePicker } from "./components/DatePicker/DatePicker"
export { DatePickerInput } from "./components/DatePickerInput/DatePickerInput"
export { DateRangePicker } from "./components/DateRangePicker/DateRangePicker"
export {
DateRangePicker,
type DateRangePickerValue,
} from "./components/DateRangePicker/DateRangePicker"
export { DateRangePickerInput } from "./components/DateRangePickerInput/DateRangePickerInput"

0 comments on commit 337404e

Please sign in to comment.