Coder Social home page Coder Social logo

aboveyunhai / chakra-dayzed-datepicker Goto Github PK

View Code? Open in Web Editor NEW
214.0 2.0 43.0 1.65 MB

Chakra UI + Dayzed = datepicker

Home Page: https://aboveyunhai.github.io/chakra-dayzed-datepicker/

License: MIT License

HTML 0.71% TypeScript 98.67% JavaScript 0.61%
chakra-ui datepicker dayzed chakra-ui-react chakraui date

chakra-dayzed-datepicker's People

Contributors

abhishekmg avatar aboveyunhai avatar adobs avatar biko8 avatar david-morris avatar jcdogo avatar nt9142 avatar qadra42 avatar stieludv avatar vivasvan1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chakra-dayzed-datepicker's Issues

Add support for forwarding refs to DatePicker component

Currently, there's no provision for passing a ref to the DatePicker component, limiting our ability to interact with it programmatically. It would be valuable to introduce a ref prop or a method (e.g., getDatePickerRef()) that allows users to forward a ref to the DatePicker component. This enhancement would facilitate tasks like focusing the DatePicker or retrieving its current value.

How to show last month and this month on popover (Ranged)

Hi,

A quick question hopefully that can be answered easily - when the Range picker is employed, by default if it's set to show 2 months it's the current month and then next month. However for my needs, all future dates are disabled so it makes no sense to show next month on the right hand side since they're all disabled. So my question is, is there a way to offset it so that the two months showing are last month THEN this month side by side? I found something called offset but it doesn't seem to be settable from either the DatePicker props or the configs?

Is it possible to show the selected date when below minDate?

Hi there,

I'd like to allow users to see what the selected date is, even if it is disabled and earlier than the minDate. I don't seem to be able to make this work so far, as the selected date doesn't show the "selected" bg color, and just appears transparent like the other disabled dates. Is this possible via a workaround, or would it be possible to add this functionality?

Is there a way to change the selected color from purple to blue?

Hello! I'm trying to change the color scheme of the entire component to blue, but the onHover state isn't following the scheme - any idea how I can customize the background from purple to blue?

Here are the props I'm passing right now:

dayOfMonthBtnProps: {
  isInRangeBtnProps: {
    background: "blue.100",
  },
  selectedBtnProps: {
    background: "blue.200",
  },
  todayBtnProps: {
    background: "blue.400",
  },
  defaultBtnProps: {
    background: "white",
  }
},
Screenshot 2023-07-06 at 9 55 14 PM

Document Development Process

It would be easier to work on this project if it was documented in the README how to get from a git repo of this package to an installed forked version.

For example, I just added david-morris/chakra-dayzed-datepicker to my yarn classic project's package.json, installed, and ran npm install && npm run build in the node_modules/chakra-dayzed-datepicker directory. My changes were present, but the chakra theme was broken on the datepicker component. If I knew the correct way to install that, I would have been more confident in my PR.

Change fontWeight on weekDays and monthNames

Thanks for this useful component!
Screenshot 2023-06-14 at 18 39 26

Screenshot 2023-06-14 at 18 41 18

I had to do some tricky workaround in order to change this fontWeight. I think it could be a nice improvement by adding this as propsConfig.

bug - ArrowKeysReact.config isn't define

details:

error raise on console when clicking on a RangeDatepicker

build:

  • vite (es-build), production

deps:

  • react: 18.1
  • @chakra-ui/react: 2.1.2
  • chakra-dayzed-datepicker: ^0.2.2 - we had this issue in past versions as well

error on console:

TypeError: IU.config is not a function
    at uie (chakra-dayzed-datepicker.esm.js:165:18)
    at Y8 (react-dom.production.min.js:166:137)
    at AZ (react-dom.production.min.js:289:386)
    at $Z (react-dom.production.min.js:279:389)
    at q0e (react-dom.production.min.js:279:320)
    at wC (react-dom.production.min.js:279:180)
    at Vk (react-dom.production.min.js:270:88)
    at mF (react-dom.production.min.js:272:300)
    at sp (react-dom.production.min.js:127:105)
    at react-dom.production.min.js:266:269

possible solution, my coworker @hexelon solve it in this fork
(here is the specific commit)

I can open a pr if needed, please let me know ๐Ÿ™

Custom day renderer + month view change event handlers

Hi, we customized the datepicker to support a custom day button renderer along with event handlers on month view change, in order to accommodate our internal company needs. Is this something that you would be interested in merging back into this repository? If so, please let me know and I will prepare a pull request with the changes.

Themeable by Chakra theme

We used the date picker on multiple pages. So we created a component that just added styling and re-exported it to have a consistent design.

It would be cool to be able to theme it with Chakra's extendTheme as a multipart theme

Unable to change color of disabled dates when hovered

Upon upgrading from version 1.6 to 2.6, I encountered an issue with the background color of disabled dates in my application. The problem only occurs when hovering over the disabled dates. Editing the background color works as intended, except for the hover state. If I'm missing something obvious let me know

Code:

  defaultBtnProps: {
              color: 'paleBlue',
              _hover: { bg: 'octavGreen', _disabled: { bg: 'blue' } },
            }

Example:
image

Duplicated Keys

I'm getting warnings saying that the days of the month keys, e.g. "72022S", are duplicated, as well as a significant performance hit when I define configs.

How to make the field nullable or remove the selected date?

I am using SingleDatepicker and am trying to allow the field value to be removed in the event someone selected a date but then realizes they do not want one (it is an optional field for my form). I am using it with react-hook-form as well. Is this possible?

Disable individual dates

I'm trying to create an event calendar that allows people to select dates. Yet once someone selects a date, I need to disable it for others.

Thus how do I pass a disabled prop to individual dates?

Accessibility/form label

It would be nice if it was possible to add an aria-label and/or HTML label.

The <FormLabel> Chakra component doesn't work with this, presumably because the input's ID is being set by whatever is doing the popover logic.

Since that's probably a lot of internal logic, it would be nice to be able to explicitly pass down an aria-label.

Use predicate for calculating disabled date

<SingleDatepicker
  name="date-input"
  date={date}
  onDateChange={setDate}
  isDateDisabled={(date: Date) => date.getDay() === 0}
/>

I propose to check the date dynamically, this would be easier to filter out repeated days.

How to use this with Formik and Yup validation schema?

How do I integrate <SingleDatepicker /> with Formik and Yup validation schema? I just can't update the Formik/Yup date field value when date is selected...

{({ field, value }) => ( Invoice date

What exactly should I supply onDateChange so that Formik/Yup field value is updated? I tried supplying Formik's setFieldValue function, but this accepts 2 parameters fieldName and value.

Save date state to Redux

Hi,

I am using the library to my app and looking to save date state to Redux, to connect with the backend server as for now we are using Redux for this kind of task. The normal date and setDate setter would work at normal use case but when it comes to Redux, I guess the payload mostly return string type, so the onDateChange function is not working as it needs a Date type.

Here is my code:

const [date, setDate] = useState(new Date());

useEffect(() => {
        if (!state?.trialEndLocal) {
            setState({
                trialEndLocal: Date.now(),
            });
            setDate({
                trialEndLocal: Date.now(),
            });
        }

    }, [state?.trialEndLocal]);

...
<FormControl>
                       <FormLabel>Trial Expiry</FormLabel>
                                         <InputGroup>
                                             <SingleDatepicker
                                                    name="date-input"
                                                    date={
                                                    new Date(state.trialEndLocal)}
                                                    onDateChange={e => setDate(trialEndLocal: e))}
                                               />
                                          <InputRightElement
                                                    color="gray.500"
                                                    children={<CalendarIcon />}
                                          />
                                       </InputGroup>
</FormControl>

Issue: onDateChange not works with Redux and string type.

Setting the timezone

Hello,

How does the datepicker save the date? Is there a way to set the timezone?

month picker

Next step might be adding the month picker due to business need.

Update Framer-motion

dayzed uses framer-motion 4, but 6 is available. Upgrading this dependency would result in easier integration with other projects.

Input date manually

I can't enter the value inside <SingleDatepicker>, is that possible?

<Controller control={control} name="due_date" render={({ field }) => { const { value, onChange } = field; return ( <SingleDatepicker configs={{ dateFormat: "dd/MM/yyyy" }} usePortal onDateChange={onChange} date={value} {...field} /> ); }} />

using `minDate`, date button do not have disabled style

Hi everyone,
I have set a minDate : Tue Feb 28 2023 , days before minDate are not active but do not have any disabled styles.
I've tried to force it myself with the propsConfigs but it does not work.

Buttons keep whiteColor

Screenshot 2023-01-29 at 2 23 12 PM

propsConfigs={{
                inputProps: { size: 'lg' },
                dayOfMonthBtnProps: {
                  defaultBtnProps: {
                    _hover: {
                      background: 'primary.500'
                    },
                    _disabled: {
                      opacity: 0.4,
                    }
                  },
                  selectedBtnProps: {
                    color: 'white',
                    bgColor: 'primary.500'
                  }
                }
              }}

Any ideas?Thank you
Version:
chakra-ui/react: ^2.4.7
chakra-dayzed-datepicker: ^0.2.6

change positioning of calendar panels

Hi!

I am using your RandeDatePicker in a component on the right side of my page. The calendar panels overflow off screen and the user can not select dates from the second panel. I have tried changing the zIndex and the placement props with
propsConfigs={{
popoverCompProps:{
popoverContentProps: {
placement: 'left-start',
zIndex: 300
}
}
}}

I also tried this with popoverBodyProps which also did not work. If we can't change the placement, Is there a way to change the behavior of the overflow? Maybe switch to a column instead of a row? Or is there a way to do a RangeDatePicker with just one calendar panel?

Appreciate the help, thanks!

the default state for range picker.

I made an immature decision to let the range state as an array [startDate, endDate], this will cause some issues when doing state management.

My original intent is to have a empty object if user don't provide their own:

{
  startDate: undefined, 
  endDate: undefined
}

but it will break range usage from previous versions.

Display short name of days as the input label/value

I'm trying to display the short names of days as the label/value of the input, but it doesn't seem to work. If I look at the formatting docs of date-fns I should be able to pass 'ddd' to dateFormat of the config object. Doing this just prepends a 0 to the current day for each 'd' added.

Code:

<SingleDatepicker
    ...props
    configs={{
        dateFormat: 'ddd - dd/MM',
        monthNames: MonthNamesShort,
        dayNames: WeekdayNamesShort,
    }}
/>

Formatting like this gives me this result:
Screenshot 2023-01-19 at 12 33 47

The expected result would be: Thu - 19/01

Clear date selection for optional fields

How do I clear the date selection or start with an empty input? This is quite useful for optional fields. For example I might want user to specify an empty date to indicate there is no expiry date.

Seems like onDateChange have to set a Date object. Prehaps we can make it (date: Date | null) => void?

image

Always keep the date picker open

I want to keep the date picker always open and always displayed without the input field. I've set the input field visibility to none, but when i click around the datepicker closes.

Is there anyway, to keep the component always open and displayed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.