Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mantinedev/mantine
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Dec 12, 2024
2 parents a773d0a + faebf90 commit b73f37a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
8 changes: 4 additions & 4 deletions packages/@docs/demos/src/demos/core/Tree/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ export const data: TreeNodeData[] = [
label: 'hooks',
value: 'node_modules/@mantine/hooks',
children: [
{ label: 'index.d.ts', value: 'node_modules/@mantine/core/index.d.ts' },
{ label: 'package.json', value: 'node_modules/@mantine/core/package.json' },
{ label: 'index.d.ts', value: 'node_modules/@mantine/hooks/index.d.ts' },
{ label: 'package.json', value: 'node_modules/@mantine/hooks/package.json' },
],
},
{
label: 'form',
value: 'node_modules/@mantine/form',
children: [
{ label: 'index.d.ts', value: 'node_modules/@mantine/core/index.d.ts' },
{ label: 'package.json', value: 'node_modules/@mantine/core/package.json' },
{ label: 'index.d.ts', value: 'node_modules/@mantine/form/index.d.ts' },
{ label: 'package.json', value: 'node_modules/@mantine/form/package.json' },
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,22 @@ describe('@mantine/dates/DateTimePicker', () => {
it('supports uncontrolled state with timezone', async () => {
const { container } = render(
<DatesProvider settings={{ timezone: 'UTC' }}>
<DateTimePicker {...defaultProps} defaultValue={new Date(2022, 0, 31, 23)} />
<DateTimePicker
{...defaultProps}
defaultValue={new Date(2022, 0, 31, 23)}
valueFormat="DD/MM/YYYY HH:mm Z"
/>
</DatesProvider>
);
expectValue(container, '01/02/2022 04:00');
expectValue(container, '01/02/2022 09:00 +00:00');

await clickInput(container);
await userEvent.click(container.querySelectorAll('table button')[6]);
expectValue(container, '06/02/2022 04:00');
expectValue(container, '06/02/2022 09:00 +00:00');

await userEvent.clear(getTimeInput());
await userEvent.type(getTimeInput(), '14:45');
expectValue(container, '06/02/2022 14:45');
expectValue(container, '06/02/2022 19:45 +00:00');
});

it('supports controlled state', async () => {
Expand All @@ -217,14 +221,19 @@ describe('@mantine/dates/DateTimePicker', () => {

const { container } = render(
<DatesProvider settings={{ timezone: 'UTC' }}>
<DateTimePicker {...defaultProps} value={new Date(2022, 0, 31, 23)} onChange={spy} />
<DateTimePicker
{...defaultProps}
value={new Date(2022, 0, 31, 23)}
onChange={spy}
valueFormat="DD/MM/YYYY HH:mm Z"
/>
</DatesProvider>
);
expectValue(container, '01/02/2022 04:00');
expectValue(container, '01/02/2022 09:00 +00:00');

await clickInput(container);
await userEvent.click(container.querySelectorAll('table button')[6]);
expectValue(container, '01/02/2022 04:00');
expectValue(container, '01/02/2022 09:00 +00:00');
expect(spy).toHaveBeenLastCalledWith(new Date(2022, 1, 5, 23));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const DateTimePicker = factory<DateTimePickerFactory>((_props, ref) => {

const [dropdownOpened, dropdownHandlers] = useDisclosure(false);
const formattedValue = _value
? dayjs(_value).locale(ctx.getLocale(locale)).format(_valueFormat)
? dayjs(_value).locale(ctx.getLocale(locale)).tz(ctx.getTimezone()).format(_valueFormat)
: '';

const handleTimeChange = (event: React.ChangeEvent<HTMLInputElement>) => {
Expand Down
5 changes: 3 additions & 2 deletions packages/@mantine/modals/src/ModalsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ export function ModalsProvider({ children, modalProps, labels, modals }: ModalsP
);

const updateContextModal = useCallback(
(payload: { modalId: string } & Partial<OpenContextModal<any>>) => {
dispatch({ type: 'UPDATE', modalId: payload.modalId, newProps: payload });
({ modalId, ...newProps }: { modalId: string } & Partial<OpenContextModal<any>>) => {
dispatch({ type: 'UPDATE', modalId, newProps });
},
[dispatch]
);
Expand All @@ -166,6 +166,7 @@ export function ModalsProvider({ children, modalProps, labels, modals }: ModalsP
});

const ctx: ModalsContextProps = {
modalProps: modalProps || {},
modals: state.modals,
openModal,
openConfirmModal,
Expand Down
1 change: 1 addition & 0 deletions packages/@mantine/modals/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type ModalState =
| { id: string; props: OpenContextModal; type: 'context'; ctx: string };

export interface ModalsContextProps {
modalProps: ModalSettings;
modals: ModalState[];
openModal: (props: ModalSettings) => string;
openConfirmModal: (props: OpenConfirmModal) => string;
Expand Down
1 change: 0 additions & 1 deletion scripts/build/rollup/create-package-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function createPackageConfig(packagePath: string): RollupOptions {
const plugins = [
nodeResolve({ extensions: ['.ts', '.tsx', '.js', '.jsx'] }),
esbuild({
sourceMap: false,
tsconfig: getPath('tsconfig.json'),
}),
alias({ entries: aliasEntries }),
Expand Down

0 comments on commit b73f37a

Please sign in to comment.