Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/yellow-years-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@heroui/date-picker": patch
---

remove dateInputClassNames for date picker (#4495)
6 changes: 6 additions & 0 deletions apps/docs/content/docs/components/date-input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,12 @@ import {parseZonedDateTime} from "@internationalized/date";
type: "boolean",
description: "Whether to disable animations.",
default: "false"
},
{
attribute: "classNames",
type: "Partial<Record<\"base\" | \"label\" | \"inputWrapper\" | \"input\" | \"segment\" | \"helperWrapper\" | \"description\" | \"errorMessage\", string>>",
description: "Allows to set custom class names for the date-input slots.",
default: "-"
}
]}
/>
Expand Down
50 changes: 49 additions & 1 deletion apps/docs/content/docs/components/date-picker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,55 @@ import {I18nProvider} from "@react-aria/i18n";
type: "boolean",
description: "Whether to always show leading zeros in the month, day, and hour fields.",
default: "true"
}
},
{
attribute: "CalendarBottomContent",
type: "ReactNode",
description: "Bottom content to be rendered in the calendar component.",
default: "-"
},
{
attribute: "showMonthAndYearPickers",
type: "boolean | undefined",
description: "Whether the calendar should show month and year pickers.",
default: "false"
},
{
attribute: "popoverProps",
type: "PopoverProps | undefined",
description: "Props to be passed to the popover component.",
default: `{ placement: "bottom", triggerScaleOnOpen: false, offset: 13 }`
},
{
attribute: "selectorButtonProps",
type: "ButtonProps | undefined",
description: "Props to be passed to the selector button component.",
default: `{ size: "sm", variant: "light", radius: "full", isIconOnly: true }`
},
{
attribute: "calendarProps",
type: "CalendarProps | undefined",
description: "Props to be passed to the calendar component.",
default: `{ size: "sm", variant: "light", radius: "full", isIconOnly: true }`
},
{
attribute: "timeInputProps",
type: "TimeInputProps | undefined",
description: "Props to be passed to the time input component.",
default: `{ size: "sm", variant: "light", radius: "full", isIconOnly: true }`
},
{
attribute: "disableAnimation",
type: "boolean",
description: "Whether to disable all animations in the date picker. Including the DateInput, Button, Calendar, and Popover.",
default: "false"
},
{
attribute: "classNames",
type: `Partial<Record<"base" | "selectorButton" | "selectorIcon" | "popoverContent" | "calendar" | "calendarContent" | "timeInputLabel" | "timeInput", string>>`,
description: "Allows to set custom class names for the date-picker slots. You can also pass Date Input classNames here.",
default: "-"
},
]}
/>

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/components/date-range-picker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,8 @@ You can customize the `DateRangePicker` component by passing custom Tailwind CSS
},
{
attribute: "classNames",
type: "Partial<Record<\"base\" | \"selectorButton\" | \"selectorIcon\" | \"popoverContent\" | \"calendar\" | \"calendarContent\" | \"timeInputLabel\" | \"timeInput\", string>>",
description: "Allows to set custom class names for the date-range-picker slots.",
type: "Partial<Record<\"base\" | \"label\" | \"calendar\" | \"selectorButton\" | \"selectorIcon\" | \"popoverContent\" | \"calendarContent\" | \"inputWrapper\" | \"input\" | \"segment\" | \"separator\" | \"bottomContent\" | \"timeInputWrapper\" | \"timeInputLabel\" | \"timeInput\" | \"helperWrapper\" | \"description\" | \"errorMessage\", string>>",
description: "Allows to set custom class names for the date-range-picker slots. You can also pass Date Input classNames here.",
default: "-"
}
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ describe("DatePicker", () => {
it("should apply custom dateInput classNames", function () {
const {getByText} = render(
<DatePicker
dateInputClassNames={{
classNames={{
inputWrapper: "border-green-500",
label: "text-green-500",
}}
Expand Down
10 changes: 2 additions & 8 deletions packages/components/date-picker/src/use-date-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@ interface Props<T extends DateValue>
classNames?: SlotsToClasses<DatePickerSlots> & DateInputProps<T>["classNames"];
}

export type UseDatePickerProps<T extends DateValue> = Props<T> &
AriaDatePickerProps<T> & {
/**
* Classname or List of classes to change the classNames of the date input element.
*/
dateInputClassNames?: DateInputProps<T>["classNames"];
};
export type UseDatePickerProps<T extends DateValue> = Props<T> & AriaDatePickerProps<T>;

export function useDatePicker<T extends DateValue>({
className,
Expand Down Expand Up @@ -143,7 +137,7 @@ export function useDatePicker<T extends DateValue>({
const getDateInputProps = () => {
return {
...dateInputProps,
classNames: {...originalProps?.dateInputClassNames},
classNames,
groupProps,
labelProps,
createCalendar,
Expand Down
2 changes: 2 additions & 0 deletions packages/components/date-picker/src/use-date-range-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ interface Props<T extends DateValue>
* separator: "separator-classes",
* bottomContent: "bottom-content-classes",
* timeInputWrapper: "time-input-wrapper-classes",
* timeInputLabel: "time-input-label-classes",
* timeInput: "time-input-classes",
* helperWrapper: "helper-wrapper-classes",
* description: "description-classes",
* errorMessage: "error-message-classes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ export const WithDateInputClassNames = {
render: Template,
args: {
...defaultProps,
dateInputClassNames: {
classNames: {
base: "bg-gray-200 p-2 rounded-md",
label: "text-blue-400 font-semibold",
inputWrapper: "border-3 border-solid border-blue-400 p-2 rounded-md",
Expand Down