From 86f69ba05c8d8fd537ffc5e380d5bc1ac65d6981 Mon Sep 17 00:00:00 2001 From: Carlos Costa Date: Thu, 22 Oct 2026 20:03:15 -0300 Subject: [PATCH] fix(dashkit): chart colors, portal instance refs, scroll-lock stacking, and link/button nesting - charts: use existing --color-ds-primary-* tokens in Bar/Area/Pie default series colors (the --color-primary-NNN vars never existed, so extra series rendered black) - overlays: replace static portal DOM ids + getElementById with per-instance portalRefs in Select, Combobox, Dropdown, DatePicker and Popover, so multiple instances on one page no longer close each other - select: remove the scroll listener that was never unregistered (cleanup passed a new function instead of handleScroll) - button: add an asChild mode and use it for Link/anchor call sites in the app, removing invalid - - - + - + + {/* CLI Emulator */} diff --git a/src/dashkit/AreaChart/AreaChart.tsx b/src/dashkit/AreaChart/AreaChart.tsx index 4107768..5a784c7 100644 --- a/src/dashkit/AreaChart/AreaChart.tsx +++ b/src/dashkit/AreaChart/AreaChart.tsx @@ -7,11 +7,11 @@ import './area-chart.css'; import { useAreaChart, type AreaChartSeries } from './useAreaChart'; const DEFAULT_COLORS = [ - 'var(--color-primary)', - 'var(--color-primary-400)', - 'var(--color-primary-200)', - 'var(--color-primary-800)', - 'var(--color-primary-300)', + 'var(--color-ds-primary-600)', + 'var(--color-ds-primary-400)', + 'var(--color-ds-primary-200)', + 'var(--color-ds-primary-800)', + 'var(--color-ds-primary-300)', ]; export interface AreaChartProps { diff --git a/src/dashkit/Backdrop/Backdrop.test.tsx b/src/dashkit/Backdrop/Backdrop.test.tsx index 0c7cc18..c8104ac 100644 --- a/src/dashkit/Backdrop/Backdrop.test.tsx +++ b/src/dashkit/Backdrop/Backdrop.test.tsx @@ -51,10 +51,10 @@ describe('Backdrop', () => { expect(overlay).toHaveClass('backdrop__overlay'); }); - it('calls onClick when Escape key is pressed', () => { + it('does not handle Escape itself (overlay hooks own that)', () => { const handleClick = vi.fn(); render(); fireEvent.keyDown(window, { key: 'Escape' }); - expect(handleClick).toHaveBeenCalledTimes(1); + expect(handleClick).not.toHaveBeenCalled(); }); }); diff --git a/src/dashkit/Backdrop/Backdrop.tsx b/src/dashkit/Backdrop/Backdrop.tsx index 362d481..58c996e 100644 --- a/src/dashkit/Backdrop/Backdrop.tsx +++ b/src/dashkit/Backdrop/Backdrop.tsx @@ -22,19 +22,8 @@ export function Backdrop({ children, ...props }: BackdropProps) { - React.useEffect(() => { - if (!show || !onClick) return; - - const handleKeyDown = (event: KeyboardEvent) => { - if (event.key === 'Escape') { - onClick({} as React.MouseEvent); - } - }; - - window.addEventListener('keydown', handleKeyDown); - return () => window.removeEventListener('keydown', handleKeyDown); - }, [show, onClick]); - + // Note: Escape-to-close is handled by the overlay hooks (useModal/useDrawer) + // instead of here, so `onClose` is invoked exactly once with a real event. const overlay = ( { leftIcon?: ReactNode; rightIcon?: ReactNode; loading?: boolean; + /** + * Render the button styles onto its single child element instead of a + * - +