mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.14k stars 1.29k forks source link

[pickers] DatePicker distribution #14918

Open michelengelen opened 1 day ago

michelengelen commented 1 day ago

I have exactly the same issue described by @BenByrdInMarket on his initial message. I will try to create a small reproduction case. In the meantime, the only solution I have is to wrap my design system components in a LocalizationProvider and to pass dateAdapter and adapterLocale as props. It's not great however. e.g. On my design system side:

import { DatePickerProps } from '@mui/x-date-pickers-pro';
import { PickerValidDate } from '@mui/x-date-pickers/models';

interface CustomDatePicker extends DatePickerProps<TDate, TEnableAccessibleFieldDOMStructure> {
  dateAdapter?: any;
  adapterLocale?: any;
}
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers-pro';

function CustomDatePicker<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: CustomDatePicker<TDate, TEnableAccessibleFieldDOMStructure>) {
  const { dateAdapter, adapterLocale, ...rest } = props;

  return (
    <LocalizationProvider dateAdapter={dateAdapter} adapterLocale={adapterLocale}>
      <DatePicker ... />
    </LocalizationProvider>
  );
}

On my app side (that consume the design system):

import { AdapterDateFns } from '@mui/x-date-pickers-pro/AdapterDateFns';
import { fr } from 'date-fns/locale';

<CustomDatePicker dateAdapter={AdapterDateFns} adapterLocale={fr} />

PS: @flaviendelangle this issue has been closed. is it possible to reopen it? Do you need my reproduction case? Can I create a support ticket with my premium support subscription?

If you could open up a new ticket and include your specific reproduction that would help a lot. This issue is kind of old and also has unrelated information. So it would be best to start a fresh issue and link this (or specific comments) for reference.

If you can include the premium order-id that would be great as well.

Thanks! 🙇🏼

Hi @michelengelen,

We have created a specific reproduction case that you can find here:

https://github.com/Seb-GRAF/design-system-consumer https://github.com/Seb-GRAF/design-system

We have a MUI X Premium license. Here is our support key / order ID: 96178

Best,

Originally posted by @guicara in https://github.com/mui/mui-x/issues/5349#issuecomment-2405343042

Search keywords:

michelengelen commented 1 day ago

@LukasTy I have extracted this from the mentioned ticket since it got very noisy. Could you have a look when you have some time on your hands?