From 9ebe3ae91426de22937ccf781420510f364fcd86 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 12 Dec 2024 06:30:55 +0100 Subject: [PATCH 1/4] [@mantine/modals] Fix `modalId` being passed to the DOM node as attribute (#7189) * expose modal props * minor refactor * formatting * Update ModalsProvider.tsx --- packages/@mantine/modals/src/ModalsProvider.tsx | 5 +++-- packages/@mantine/modals/src/context.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/@mantine/modals/src/ModalsProvider.tsx b/packages/@mantine/modals/src/ModalsProvider.tsx index 5fa59d7925..a594cc2633 100644 --- a/packages/@mantine/modals/src/ModalsProvider.tsx +++ b/packages/@mantine/modals/src/ModalsProvider.tsx @@ -148,8 +148,8 @@ export function ModalsProvider({ children, modalProps, labels, modals }: ModalsP ); const updateContextModal = useCallback( - (payload: { modalId: string } & Partial>) => { - dispatch({ type: 'UPDATE', modalId: payload.modalId, newProps: payload }); + ({ modalId, ...newProps }: { modalId: string } & Partial>) => { + dispatch({ type: 'UPDATE', modalId, newProps }); }, [dispatch] ); @@ -166,6 +166,7 @@ export function ModalsProvider({ children, modalProps, labels, modals }: ModalsP }); const ctx: ModalsContextProps = { + modalProps: modalProps || {}, modals: state.modals, openModal, openConfirmModal, diff --git a/packages/@mantine/modals/src/context.ts b/packages/@mantine/modals/src/context.ts index 2445481948..0ff6195e75 100644 --- a/packages/@mantine/modals/src/context.ts +++ b/packages/@mantine/modals/src/context.ts @@ -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; From 4de77ecbf61a4113677862f74901d5585461e03c Mon Sep 17 00:00:00 2001 From: Anthony Alayo Date: Wed, 11 Dec 2024 21:31:43 -0800 Subject: [PATCH 2/4] [core] Fix invalid source maps being generated (#7188) --- scripts/build/rollup/create-package-config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build/rollup/create-package-config.ts b/scripts/build/rollup/create-package-config.ts index af8bd78873..9f65fb3a99 100644 --- a/scripts/build/rollup/create-package-config.ts +++ b/scripts/build/rollup/create-package-config.ts @@ -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 }), From 9f2ff9bce51c4e1358e178d390eb12b01939867f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20=C5=A0ime=C4=8Dek?= Date: Thu, 12 Dec 2024 00:32:15 -0500 Subject: [PATCH 3/4] [mantine.dev] Fix typo (#7182) --- packages/@docs/demos/src/demos/core/Tree/data.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@docs/demos/src/demos/core/Tree/data.ts b/packages/@docs/demos/src/demos/core/Tree/data.ts index 3a9a992d7f..a70923ceb2 100644 --- a/packages/@docs/demos/src/demos/core/Tree/data.ts +++ b/packages/@docs/demos/src/demos/core/Tree/data.ts @@ -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' }, ], }, ], From faebf90c88bd9c6189d073f0747090f581172c3e Mon Sep 17 00:00:00 2001 From: Nixon Yiu Date: Wed, 11 Dec 2024 21:34:52 -0800 Subject: [PATCH 4/4] [@mantine/dates] Fix timezone not being applied to the formatted value (#7162) * pass timezone when formatting value * fix test --- .../DateTimePicker/DateTimePicker.test.tsx | 23 +++++++++++++------ .../DateTimePicker/DateTimePicker.tsx | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.test.tsx b/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.test.tsx index 6b0dd52f92..3b1d2d573f 100644 --- a/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.test.tsx +++ b/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.test.tsx @@ -185,18 +185,22 @@ describe('@mantine/dates/DateTimePicker', () => { it('supports uncontrolled state with timezone', async () => { const { container } = render( - + ); - 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 () => { @@ -217,14 +221,19 @@ describe('@mantine/dates/DateTimePicker', () => { const { container } = render( - + ); - 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)); }); diff --git a/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.tsx b/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.tsx index 46956b1705..110fd69053 100644 --- a/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.tsx +++ b/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.tsx @@ -151,7 +151,7 @@ export const DateTimePicker = factory((_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) => {