From 3caefc4768fb62924ac90d078333a9a7365502b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EA=B7=B9?= Date: Thu, 11 Jan 2024 13:58:56 +0900 Subject: [PATCH 1/2] fix: add "/" to RGBA calculations --- .../MantineProvider/color-functions/to-rgba/to-rgba.test.ts | 3 +++ .../core/MantineProvider/color-functions/to-rgba/to-rgba.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.test.ts b/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.test.ts index 93f9ee8f90e..587e96b144a 100644 --- a/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.test.ts +++ b/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.test.ts @@ -23,6 +23,9 @@ describe('@mantine/core/to-rgba', () => { expect(toRgba('rgb(240, 62, 62, 0.8)')).toStrictEqual({ r: 240, g: 62, b: 62, a: 0.8 }); expect(toRgba('rgb(214, 51, 108, 1)')).toStrictEqual({ r: 214, g: 51, b: 108, a: 1 }); expect(toRgba('rgb(112, 72, 232, .2)')).toStrictEqual({ r: 112, g: 72, b: 232, a: 0.2 }); + expect(toRgba('rgb(240, 62, 62 / 0.8)')).toStrictEqual({ r: 240, g: 62, b: 62, a: 0.8 }); + expect(toRgba('rgb(214, 51, 108 / 1)')).toStrictEqual({ r: 214, g: 51, b: 108, a: 1 }); + expect(toRgba('rgb(112, 72, 232 / .2)')).toStrictEqual({ r: 112, g: 72, b: 232, a: 0.2 }); }); it('returns the correct rgba values when given an hsl string', () => { diff --git a/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.ts b/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.ts index 0d8019dfb0d..138317daa04 100644 --- a/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.ts +++ b/packages/@mantine/core/src/core/MantineProvider/color-functions/to-rgba/to-rgba.ts @@ -52,8 +52,8 @@ function hexToRgba(color: string): RGBA { function rgbStringToRgba(color: string): RGBA { const [r, g, b, a] = color - .replace(/[^0-9,.]/g, '') - .split(',') + .replace(/[^0-9,./]/g, '') + .split(/[/,]/) .map(Number); return { r, g, b, a: a || 1 }; From b941c67c3c5f1cde17dd917a280841112d13e90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EA=B7=B9?= Date: Thu, 11 Jan 2024 22:14:28 +0900 Subject: [PATCH 2/2] fix(core): error in the expression caused by missing parentheses --- .../@mantine/core/src/components/NumberInput/NumberInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@mantine/core/src/components/NumberInput/NumberInput.tsx b/packages/@mantine/core/src/components/NumberInput/NumberInput.tsx index 6e4ad668ffe..832665aadab 100644 --- a/packages/@mantine/core/src/components/NumberInput/NumberInput.tsx +++ b/packages/@mantine/core/src/components/NumberInput/NumberInput.tsx @@ -401,7 +401,7 @@ export const NumberInput = factory((_props, ref) => { __staticSelector="NumberInput" decimalScale={allowDecimal ? decimalScale : 0} onKeyDown={handleKeyDown} - rightSectionPointerEvents={rightSectionPointerEvents ?? disabled ? 'none' : undefined} + rightSectionPointerEvents={rightSectionPointerEvents ?? (disabled ? 'none' : undefined)} rightSectionWidth={rightSectionWidth ?? `var(--ni-right-section-width-${size || 'sm'})`} allowLeadingZeros={allowLeadingZeros} onBlur={(event) => {