nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.43k stars 1.39k forks source link

[BUG] - Datepicker don't apply DateInput classNames #3633

Open eliasdanielr opened 1 month ago

eliasdanielr commented 1 month ago

NextUI Version

2.1.6

Describe the bug

To optimize the final bundle of my application, I add dependencies only to the components I use. Each time I create a color variant for my application, but when I use the DatePicker components, I don't apply the inputWrapper classes

// components/date-picker/index.tsx

"use client";

import { DatePicker as NextDatePicker } from "@nextui-org/date-picker";
import { extendVariants } from "@nextui-org/system";

export const DatePicker = extendVariants(NextDatePicker, {
    variants: {
        color: {
            stone: {
                inputWrapper: [
                    "bg-red-500", // <- i tried others classes
                ],
                selectorButton: [
                    "bg-red-500", // <- this works
                ]
            },
        }
    },
    defaultVariants: {
        color: "stone",
        radius: "sm",
        labelPlacement: "outside",
    },
});

export * from "@nextui-org/date-picker";

Usage in my application:

// path/register-from.tsx
import { Input, DatePicker } from "#/components"; 
//                                       ↑
//                       Yes, i add index.ts in this folder

<DatePicker
    // @ts-ignore
    maxValue={today(getLocalTimeZone())}
    showMonthAndYearPickers
    label="Birth date"
    color="default"
    isRequired
/>

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Follow the docs after install DatePicker component.

  2. Create a extendVariants of the DatePicker component

  3. Add custom classNames (try all and some of them work, it seems that only the DateInput component works)

  4. Use your custom component.

Expected behavior

I expected the color of the inputWrapper and selectorButton to apply, but only the color of the selector applies

Screenshots or Videos

No response

Operating System Version

Linux

Browser

Chrome

linear[bot] commented 1 month ago

ENG-1264 [BUG] - Datepicker don't apply DateInput classNames

wingkwong commented 1 month ago

please provide a sandbox environment